thomasfrank.notion.site Open in urlscan Pro
2606:4700::6812:81f  Public Scan

URL: https://thomasfrank.notion.site/postRender-5a5c92768e824f5d82b0.js
Submission: On February 22 via manual from IT — Scanned from IT

Form analysis 0 forms found in the DOM

Text Content

"use strict";(self.webpackChunknotion_next=self.webpackChunknotion_next||[]).push([[586],{80567:(e,t,i)=>{i.d(t,{a:()=>o});var s=i(58762),a=i(19234);async function o(e,t){const i=(0,a.gq)(t);if("skip"===i)return{valid:!0};if("insufficient_data"===i)return{valid:!1};const o=await(0,s.resolveAddress)(e,{address:{line1:t.addressLine1,city:t.city,zip:t.zipCode,state:t.state,country:t.country}});return"failed"===o.type?{valid:!1}:o.data}},51582:(e,t,i)=>{i.d(t,{w:()=>h});var s=i(58762),a=i(15356),o=i(64002),n=i(74335),r=i(95477),l=i(91924),d=i(92625),c=i(47307),u=i(50906),m=i(46190),p=i(47593);const g=(0,i(5366).defineMessages)({authenticatingWithAsana:{id:"asanaActions.authenticatingWithAsana.loadingMessage",defaultMessage:"Authenticating with Asana…"},titleMessage:{defaultMessage:"Asana login",id:"asanaActions.loginWithAsanaPopupModal.title"}});async function h(e){const{environment:t,requestStore:i}=e,h=(0,l.eC)(t);let f=(0,n.s1)(r.default.domainBaseUrl,{authType:h,userId:t.currentUser.id});f=h.redirectToAuth?f:await(0,l.HU)(t,f);const v=await a.M(t,{width:580,height:800,url:f,titleMessage:g.titleMessage});if(!v)return;const y=o.Qc(v);if(!y.query.code||!y.query.state)return;d.j({message:g.authenticatingWithAsana});const M=await s.authWithAsana(t,{code:y.query.code,encryptedState:y.query.state});"failed"===M.type?(console.error(M.error),c.showError(M),d.x()):(u.L3B(t,{name:"asana"}),await i.refresh(),m.Z.setState({open:!0}),p.Z.setState({open:!0}),d.x())}},83805:(e,t,i)=>{i.d(t,{e:()=>h});var s=i(58762),a=i(15356),o=i(64002),n=i(74335),r=i(95477),l=i(91924),d=i(92625),c=i(47307),u=i(50906),m=i(90365),p=i(47593);const g=(0,i(5366).defineMessages)({authenticatingWithEvernote:{id:"evernoteActions.authenticatingWithEvernote.loadingMessage",defaultMessage:"Authenticating with Evernote…"},titleMessage:{defaultMessage:"Evernote login",id:"evernoteActions.loginPopupModal.title"}});async function h(e){const{environment:t,requestStore:i}=e,h=(0,l.eC)(t);let f=(0,n.Qp)(r.default.domainBaseUrl,{authType:h,userId:t.currentUser.id});f=h.redirectToAuth?f:await(0,l.HU)(t,f);const v=await a.M(t,{width:580,height:700,url:f,titleMessage:g.titleMessage});if(!v)return;const y=o.Qc(v),M=y.query.oauth_token,S=y.query.oauth_verifier;if(!M||!S)return;d.j({message:g.authenticatingWithEvernote});const b=await s.authWithEvernote(t,{requestToken:M,verifier:S});if("failed"===b.type)return console.error(b.error),c.showError(b),void d.x();u.L3B(t,{name:"evernote"}),await i.refresh(),m.Z.setState({open:!0}),p.Z.setState({open:!0}),d.x()}},95209:(e,t,i)=>{i.d(t,{z:()=>m,M:()=>p});i(73210),i(33948);var s=i(33728),a=i(27006),o=i(65598),n=i(29677),r=i(76464),l=i(21202),d=i(75246),c=i(97880),u=i(75472);const m=async e=>{const{environment:t,store:i,permissionsInviteStore:m,onInviteStart:p}=e,{tokenQuery:g}=m.state;if((0,s.oH)(g.trim())&&(m.state.isInviteTargetsEmpty||!(0,n.ow)(m.state))){const e={type:"newUser",value:{email:g.trim()}};(0,u.Nd)({target:e,permissionsInviteStore:m})||m.setState({...m.state,inviteTargets:[...m.state.inviteTargets,e],isInviteTargetsEmpty:!1,tokenQuery:""})}if(!m.state.isInviteTargetsEmpty&&m.state.inviteTargets.length>0)if(null==p||p(),(0,n.ow)(m.state)){if(m.state.table===l.iU){if(!(0,o.NZ)(i))throw new Error("Table mismatch.");const{inviteTargets:e}=m.state;return m.reset(),await r.n_({environment:t,store:i,inviteTargets:e,inviteRole:void 0,isOnboarding:!1})}if(m.state.table===d.bx){if(!(0,o.Mm)(i))throw new Error("Table mismatch.");const{inviteTargets:e,inviteRole:s}=m.state;return m.reset(),await r.n_({environment:t,store:i,inviteTargets:e,inviteRole:s,isOnboarding:!1})}(0,c.t1)(m.state)}else{const{inviteTargets:e,inviteRole:s}=m.state;if(m.reset(),(0,a.iC)(s))return await r.n_({environment:t,store:i,inviteTargets:e,inviteRole:s,isOnboarding:!1});if((0,o.Y)(i))return await r.GQ({environment:t,store:i,inviteTargets:e,inviteRole:s})}return!0},p=e=>{e.permissionsInviteStore.setState({...e.permissionsInviteStore.state,modalOpen:!1})}},32465:(e,t,i)=>{i.d(t,{fs:()=>c,lH:()=>u,MH:()=>m,mX:()=>p,F8:()=>g,aQ:()=>h,kt:()=>f,DI:()=>v,jg:()=>y});i(33948);var s=i(27006),a=i(64684),o=i(63143),n=i(9953),r=i(8646),l=i(76464),d=i(58762);function c(e){const{store:t,update:i,transaction:s}=e;n.sW({store:t,data:(0,o.Q2)(i),transaction:s})}function u(e){const{addedStores:t,removedStores:i,transaction:s}=e;for(const a of t)n.sW({store:a,data:(0,o.Q2)({is_default:!0}),transaction:s});for(const a of i)n.sW({store:a,data:(0,o.Q2)({is_default:!1}),transaction:s})}const m=async e=>{const{environment:t,teamStore:i,isDefault:s}=e,a=r.create(t);u({addedStores:s?[i]:[],removedStores:s?[]:[i],transaction:a}),await r.commit({environment:t,transaction:a})};async function p(e){var t,i;const{userId:o,teamStore:n,transaction:d,environment:c,permissionRole:u}=e,m=n.getValue();if(!m)return!1;if(u&&(0,a.bk)(m,u))throw new Error("Cannot set member's permission to be lower than default team permission.");const p=(0,a.XO)(m);if(!p.includes(o))throw new Error("Specified user is not an owner of the team");if(p.length<=1)throw new Error("There should be at least one owner for a team");const g=m.membership;if(g&&g.length>0){const e=g.filter((e=>!("user"===e.entity_type&&e.user_id===o))),t=[{entity_type:"user",type:"member",user_id:o},...e];r.applyOperation({store:n,operation:{pointer:n.pointer,path:["membership"],command:"set",args:t},transaction:d})}const h=null===(t=m.permissions)||void 0===t?void 0:t.find((e=>(0,s.jg)(e)&&e.user_id===o));if(!h)return!1;let f=u||"none";const v=null===(i=m.permissions)||void 0===i?void 0:i.find(s.Ix);v&&u===v.role&&(f="none");const y={...h,role:f};return await l.ep({environment:c,store:n,permissionItems:[y],transaction:d})}async function g(e){const{userId:t,teamStore:i,transaction:s,environment:o}=e,n=i.getValue();if(!n)return!1;const d=(0,a.hY)(n),c=d.filter((e=>"user"!==e.entity_type||e.user_id!==t));if(c.length>=d.length)throw new Error("Specified user is not on the team");const u=[{entity_type:"user",type:"owner",user_id:t},...c];r.applyOperation({store:i,operation:{pointer:i.pointer,path:["membership"],command:"set",args:u},transaction:s});const m={type:"user_permission",role:"editor",user_id:t};return await l.ep({environment:o,store:i,permissionItems:[m],transaction:s})}function h(e,t){const i=e.currentUser.id;return!!i&&(c({store:t.store,update:{archived_by:i},transaction:t.transaction}),!0)}function f(e){c({store:e.store,update:{archived_by:void 0},transaction:e.transaction})}async function v({store:e,environment:t,isClosed:i}){const s=e.getSpacePermission();let a="none";if(!i){const t=e.getTeamPermission();a=t?t.role:"editor"}if((null==s?void 0:s.role)===a)return!1;const o={type:"space_permission",role:a},n=r.create(t),d=await l.ep({environment:t,store:e,permissionItems:[o],transaction:n});return await r.commit({environment:t,transaction:n}),d}async function y(e){const{memberInfo:t,teamStore:i,spaceStore:o,transaction:n,environment:r,permissionRole:c}=e;if("owner"===t.type)return p({userId:t.user_id,teamStore:i,transaction:n,environment:r,permissionRole:c});const u=i.getValue();if(!u)return!1;if(c&&(0,a.bk)(u,c))throw new Error("Cannot set member's permission to be lower than default team permission.");const m=(0,a.hY)(u);if("user"===t.entity_type&&!m.find((e=>"user"===e.entity_type&&e.user_id===t.user_id))||"group"===t.entity_type&&!m.find((e=>"group"===e.entity_type&&e.group_id===t.group_id)))throw new Error("Specified memberInfo not found on team");if("none"===c){if(o&&i){if("success"===(await d.updateTeamMembers(r,{spaceId:o.id,teamId:i.id,existingMembersToRemove:[t]})).type)return!0}return!1}{var g;let e=c||"none";const a=null===(g=u.permissions)||void 0===g?void 0:g.find(s.Ix);a&&c===a.role&&(e="none");const o="user"===t.entity_type?{type:"user_permission",user_id:t.user_id,role:e}:{type:"group_permission",group_id:t.group_id,role:e};return await l.ep({environment:r,store:i,permissionItems:[o],transaction:n})}}},52192:(e,t,i)=>{i.d(t,{M:()=>h});var s=i(58762),a=i(15356),o=i(64002),n=i(74335),r=i(95477),l=i(91924),d=i(92625),c=i(47307),u=i(50906),m=i(82066),p=i(47593);const g=(0,i(5366).defineMessages)({authenticatingWithTrello:{id:"trelloActions.authenticatingWithTrello.loadingMessage",defaultMessage:"Authenticating with Trello…"},titleMessage:{defaultMessage:"Trello login",id:"trelloActions.loginPopupModal.title"}});async function h(e){const{environment:t,requestStore:i}=e,h=(0,l.eC)(t);let f=(0,n.ae)(r.default.domainBaseUrl,{authType:h,userId:t.currentUser.id});f=h.redirectToAuth?f:await(0,l.HU)(t,f);const v=await a.M(t,{width:580,height:700,url:f,titleMessage:g.titleMessage});if(!v)return;const y=o.Qc(v),M=y.query.oauth_token,S=y.query.oauth_verifier;if(!M||!S)return;d.j({message:g.authenticatingWithTrello});const b=await s.authWithTrello(t,{requestToken:M,verifier:S});"failed"===b.type?(console.error(b.error),c.showError(b),d.x()):(u.L3B(t,{name:"trello"}),await i.refresh(),m.Z.setState({open:!0}),p.Z.setState({open:!0}),d.x())}},99762:(e,t,i)=>{i.r(t),i.d(t,{default:()=>$n});var s=i(98135),a=i.n(s),o=i(67294),n=i.n(o),r=i(41464),l=i(59713),d=i.n(l),c=(i(33948),i(12534)),u=i(66832),m=i(36324);class p extends u.Z{constructor(...e){super(...e),d()(this,"handleContextMenu",(e=>{const{device:t}=this.environment;t.isAndroid||m.default.isOnboarding||(0,c.ZP)({event:e,context:c.Af.EditorContextMenu,callback:()=>{t.isElectron||this.environment.currentUser.isLoggedIn()&&e.preventDefault()}})})),d()(this,"handleDragStart",(e=>{e.preventDefault()}))}didMount(){window.addEventListener("contextmenu",this.handleContextMenu),window.addEventListener("dragstart",this.handleDragStart)}willUnmount(){window.removeEventListener("contextmenu",this.handleContextMenu),window.removeEventListener("dragstart",this.handleDragStart)}}const g=p;i(65069);var h=i(96486),f=i.n(h),v=i(24677),y=i(55367),M=i(66094),S=i(73744),b=i(9714),T=i(21202),C=i(28314),Z=i(27724),w=i(95802),k=i(81844),A=i(50628),P=i(86486),I=i(13023),x=i(19671),F=i(88923),B=i(17031),E=i(28020),R=i(69784),D=i(16339),_=i(617),L=i(3750),O=i(17215),U=i(40756),N=i(14248),V=i(14714),W=i(27406),z=i(12211);const H=200;var q;function G(e){return e.type===q.Selectable?{type:y.Dl.Selectable,store:e.target.props.store,direction:e.direction}:{type:y.Dl.DropTarget,key:e.target.props.dropTargetKey,direction:e.direction}}function K(e){const{target:t,device:i,direction:s,points:a}=e;return s===y.vh.Onto||!i.isPhone||t.props.dropzoneShouldNeverUseOrigin?a.mousePoint:{x:a.originPoint.x,y:a.mousePoint.y}}function j(e){return e instanceof M.Z?{type:q.Selectable,target:e}:{type:q.DropTarget,target:e}}function Y(e){if(!(e&&e instanceof M.Z))return!1;let t=e;const i=y.ZP.state;if(!i.isDragging)return!1;const{draggedStores:s}=i;for(;t;){if(s.indexOf(t.props.store)>=0)return!0;t=t.getContextClosestSelectable()}return!1}function Q(e){const{dropzoneMustBeWithinHorizontalBound:t,device:i}=e;return t?0:i.isPhone?9999:0}function J(e){switch(e.direction){case y.vh.Onto:return function(e){const{device:t,isNativeDrag:i,rect:s,target:a,points:o,priority:n,canAcceptDrop:r}=e,l=y.vh.Onto,d=K({device:t,target:a,direction:l,points:o});if((i?a.props.canNativeDropOnto:a.props.canDropOnto)&&$(d,s)&&!Y(a)&&r(a,l))return{...j(a),direction:l,left:s.left,top:s.top,width:s.width,height:s.height,priority:n}}(e);case y.vh.Left:return function(e){const{device:t,isNativeDrag:i,rect:s,target:a,points:o,priority:n,optionKeyDown:r,canAcceptDrop:l}=e,d=y.vh.Left,c=K({device:t,target:a,direction:d,points:o});if((i?a.props.canNativeDropLeft:a.props.canDropLeft)&&s&&c.y>=s.top&&c.y<=s.bottom&&Math.abs(c.x-s.left)<=200&&(r||!Y(a))&&l(a,d))return{...j(a),direction:d,left:s.left,top:s.top,width:0,height:s.height,priority:n}}(e);case y.vh.Right:return function(e){const{device:t,isNativeDrag:i,rect:s,target:a,points:o,priority:n,optionKeyDown:r,canAcceptDrop:l}=e,d=y.vh.Right,c=K({device:t,target:a,direction:d,points:o});if((i?a.props.canNativeDropRight:a.props.canDropRight)&&s&&c.y>=s.top&&c.y<=s.bottom&&Math.abs(c.x-s.right)<=H&&(r||!Y(a))&&l(a,d))return{...j(a),direction:d,left:s.right,top:s.top,width:0,height:s.height,priority:n}}(e);case y.vh.Above:return function(e){const{device:t,isNativeDrag:i,rect:s,target:a,points:o,priority:n,optionKeyDown:r,canAcceptDrop:l}=e,d=Q({dropzoneMustBeWithinHorizontalBound:a.props.dropzoneMustBeWithinHorizontalBound,device:t}),c=y.vh.Above,u=K({device:t,target:a,direction:c,points:o});if((i?a.props.canNativeDropAbove:a.props.canDropAbove)&&s&&u.x>=s.left-14-d&&u.x<=s.right+d&&(r||!Y(a))&&l(a,c))return{...j(a),direction:c,left:s.left,top:s.top,width:s.width,height:0,priority:n}}(e);case y.vh.Below:return function(e){const{device:t,isNativeDrag:i,rect:s,target:a,points:o,priority:n,optionKeyDown:r,canAcceptDrop:l}=e,d=Q({dropzoneMustBeWithinHorizontalBound:a.props.dropzoneMustBeWithinHorizontalBound,device:t}),c=y.vh.Below,u=K({device:t,target:a,direction:c,points:o});if((i?a.props.canNativeDropBelow:a.props.canDropBelow)&&s&&u.x>=s.left-14-d&&u.x<=s.right+d&&(r||!Y(a))&&l(a,y.vh.Below))return{...j(a),direction:y.vh.Below,left:s.left,top:s.bottom,width:s.width,height:0,priority:n}}(e)}}function X(e){const{device:t,rect:i,target:s,points:a,optionKeyDown:o}=e;return $(K({device:t,target:s,direction:y.vh.Onto,points:a}),i)&&Y(s)&&!o}function $(e,t){return Boolean(t&&e.x>=t.left&&e.x<=t.right&&e.y>=t.top&&e.y<=t.bottom)}!function(e){e[e.Selectable=0]="Selectable",e[e.DropTarget=1]="DropTarget"}(q||(q={}));class ee extends u.Z{constructor(...e){super(...e),d()(this,"didTouchEnd",!1),d()(this,"lastMouseInfo",void 0),d()(this,"handleWindowMouseMove",(e=>{if(this.didTouchEnd)return void(this.didTouchEnd=!1);this.lastMouseInfo={target:e.target,x:e.clientX,y:e.clientY};const{isDragging:t}=y.ZP.state;t?this.updateDragState():this.updateHoverState(e.target,e.clientX,e.clientY)})),d()(this,"handleWindowMouseMoveThrottled",f().throttle((e=>U.Z.withListenerIgnored((()=>this.handleWindowMouseMove(e)))),60)),d()(this,"handleSelectionChange",(()=>{const{isDragging:e}=y.ZP.state;L.default.afterNextFlush((()=>{this.lastMouseInfo&&!e&&this.updateHoverState(this.lastMouseInfo.target,this.lastMouseInfo.x,this.lastMouseInfo.y)}))})),d()(this,"handleSelectionChangeThrottled",f().throttle(this.handleSelectionChange,60)),d()(this,"handleWindowKeyEvent",(()=>{const{isDragging:e}=y.ZP.state;e&&this.updateDragState()})),d()(this,"handleWindowTouchEnd",(()=>{this.didTouchEnd=!0})),d()(this,"handleWindowScroll",(()=>{v.Ch(),this.clearHoverState()})),d()(this,"handleWindowResize",(()=>{v.Ch(),this.clearHoverState()})),d()(this,"handleGlobalMenuIsOpenChange",(()=>{const e=P.Z.state,t=E.kw.state;e.isOpen&&!e.menuIsOpen&&t&&P.Z.reset()})),d()(this,"memoizedCanDragCache",new WeakMap),d()(this,"memoizedCanDrag",(e=>{const t=this.memoizedCanDragCache.get(e);if(this.memoizedCanDragCache.has(e))return t;const i=(0,_.OO)({environment:this.environment,blocks:e,publicEditMode:this.pageContext&&this.pageContext.publicEditModeStore.state});return this.memoizedCanDragCache.set(e,i),i})),d()(this,"getDropZonePriority",(e=>{var t;return null!==(t=null==e?void 0:e.priority)&&void 0!==t?t:0}))}didMount(){super.didMount();const{device:e}=this.environment;S.l(window,"mousemove",this.handleWindowMouseMoveThrottled),Z.default.addListener(this.handleSelectionChangeThrottled),e.isIOS&&S.l(window,"touchend",this.handleWindowTouchEnd),S.l(window,"keydown",this.handleWindowKeyEvent),S.l(window,"keyup",this.handleWindowKeyEvent),y.ZP.addListener(this.handleWindowMouseMoveThrottled),S.l(window,"scroll",this.handleWindowScroll,!0),S.l(window,"resize",this.handleWindowResize),E.kw.addListener(this.handleGlobalMenuIsOpenChange),v.Jy()}willUnmount(){super.willUnmount();const{device:e}=this.environment;S.Z(window,"mousemove",this.handleWindowMouseMoveThrottled),Z.default.removeListener(this.handleSelectionChangeThrottled),e.isIOS&&S.Z(window,"touchend",this.handleWindowTouchEnd),S.Z(window,"keydown",this.handleWindowKeyEvent),S.Z(window,"keyup",this.handleWindowKeyEvent),y.ZP.removeListener(this.handleWindowMouseMoveThrottled),S.Z(window,"scroll",this.handleWindowScroll,!0),S.Z(window,"resize",this.handleWindowResize),E.kw.removeListener(this.handleGlobalMenuIsOpenChange)}updateDragState(){const e=y.ZP.state;if(!e.isDragging)return;const{draggedStores:t,currentX:i,currentY:s,offsetX:a,offsetY:o,isNativeDrag:n}=e,r={x:i,y:s},l={x:i-a,y:s-o},d=this.findNearbyDropZones({mousePoint:r,originPoint:l},t[0],n);if(d.ontoDropZone)y.ZP.setState({...e,currentDropZone:d.ontoDropZone,currentHintDropZones:[],currentParentStore:void 0});else if(d.verticalDropZone)y.ZP.setState({...e,currentDropZone:d.verticalDropZone,currentHintDropZones:[],currentParentStore:void 0});else{if(d.horizontalDropZones.length>0){const t=d.horizontalDropZones[0],i=f().tail(d.horizontalDropZones);if(t.type===y.Dl.Selectable){const s=w.C.findSelectableFromStore(t.store);if(s){const a=s.getContextClosestSelectable();let o;return a&&a.props.store!==t.store&&a.props.shouldShowParentHalo&&(o=a.props.store),void y.ZP.setState({...e,currentDropZone:t,currentHintDropZones:i,currentParentStore:o})}}else{if(W.Z.findDropTargetFromKey(t.key))return void y.ZP.setState({...e,currentDropZone:t,currentHintDropZones:i,currentParentStore:void 0})}}y.ZP.setState({...e,currentDropZone:void 0,currentHintDropZones:[],currentParentStore:void 0})}}clearHoverState(){const e=P.Z.state;e.isOpen&&!e.menuIsOpen&&P.Z.reset()}updateHoverState(e,t,i){const s=P.Z.state;if(!s.isOpen||!s.menuIsOpen){const a=this.findHoverMenuTarget(e,t,i);a?s.isOpen&&a.selectable.props.store===s.currentStore||P.Z.setState({isOpen:!0,currentStore:a.selectable.props.store,container:a.container,menuIsOpen:!1}):P.Z.reset()}}getHighestDropZonePriorityRects(e){const t=this.getDropZonePriority(f().maxBy(e,this.getDropZonePriority));return e.filter((e=>this.getDropZonePriority(e)===t))}getSelectableContainerPriority(e){return(Z.default.state.droppableContainerStack||[]).indexOf(e)}findNearbyDropZones(e,t,i){const{device:s}=this.environment,a=C.y(),o=function(){const{selectableRectMap:e}=A.Z.state,{dropTargetRectMap:t}=z.Z.state,i=new Map;return e.forEach(((e,t)=>{i.set(t,e)})),t.forEach(((e,t)=>{i.set(t,e)})),i}(),n=o.keys();let r=n.next();const l=w.C.findSelectableFromStore(t),d=l?l.getContextSelectableContainer():void 0;let c=[];for(;!r.done;){const t=r.value;r=n.next();const l=o.get(t),u=t.getContextSelectableContainer();if(s.isPhone&&u!==d)continue;if(!u||u.props.disable)continue;const m=this.getSelectableContainerPriority(u),p={device:this.environment.device,isNativeDrag:i,rect:l,target:t,points:e,priority:m,optionKeyDown:a.option,canAcceptDrop:(e,t)=>this.selectableCanAcceptDrop(e,t)};if(X(p))return{ontoDropZone:void 0,verticalDropZone:void 0,horizontalDropZones:[]};c.push(...f().compact([J({...p,direction:y.vh.Onto}),J({...p,direction:y.vh.Left}),J({...p,direction:y.vh.Right}),J({...p,direction:y.vh.Above}),J({...p,direction:y.vh.Below})]))}c=this.getHighestDropZonePriorityRects(c);const u=c.filter((e=>e.direction===y.vh.Above||e.direction===y.vh.Below)),m=f().minBy(u,(t=>Math.abs(t.top-this.getReferencePointForRect(t,e).y)));let p=u.filter((({top:e})=>Math.abs(e-(m?m.top:0))<=ee.competingHorizontalDropZoneMinDist));if(p.length>1){p=p.filter((t=>{const i=this.getReferencePointForRect(t,e).x,s=Q({device:this.environment.device});return i>=t.left-s&&i<=t.left+t.width+s})),p=f().sortBy(p,(({left:e})=>e));let t=0;for(;t<p.length-1;t++){const i=p[t+1],s=this.getReferencePointForRect(i,e).x;if(i.left>s)break}p=p.slice(0,t+1),p.reverse()}const g=p.map(G);let h;const v=c.filter((e=>e.direction===y.vh.Onto)),M=f().minBy(v,(e=>e.height));if(M){u.some((t=>{const i=this.getReferencePointForRect(t,e).y;return Math.abs(t.top-i)<ee.competingOntoDropZoneVerticalOffset}))||(h=G(M))}let S;const b=c.filter((e=>e.direction===y.vh.Left||e.direction===y.vh.Right));let T=f().minBy(b,(t=>{const i=this.getReferencePointForRect(t,e).x;return Math.abs(t.left-i)}));if(T){const e=T,t=b.filter((t=>Math.abs(t.left-e.left)<ee.verticalDropZoneAmbiguousDist));t.length>0&&(T=f().minBy(t,(e=>e.left)))}if(T){const e=T;u.some((t=>t.top>=e.top&&t.top+t.height<=e.top+e.height))||(S=G(T))}return{ontoDropZone:h,verticalDropZone:S,horizontalDropZones:g}}findHoverMenuTarget(e,t,i){if(y.ZP.state.isDragging||R.Z.state.isActive||E.kw.state)return;const{selectableRectMap:s}=A.Z.state,a=D.Z.getMembersByDOMOrder().find((t=>{const i=t.getNode();return Boolean(i&&i.contains(e))})),o=Z.default.getCurrentDefaultContainer(),n=a||o;if(!n)return;const r=s.keys();let l=r.next();const d=[];for(;!l.done;){const e=l.value,a=s.get(e);(e.props.shouldShowHoverMenu||e.props.shouldShowCommentMenu)&&e.getContextSelectableContainer()===n&&a&&i>=a.top&&i<=a.bottom&&t>=a.left-ee.hoverMaxHorizontalOffset&&t<=a.right&&d.push(e),l=r.next()}const c=f().sortBy(d,(e=>{const t=s.get(e);return t?-t.left:1/0})),u=c.find((e=>{const t=e.getNode();if(t){if(c.find((i=>{if(i!==e){const e=i.getNode();return Boolean(e&&t.contains(e))}return!1})))return!1}return!0}));return u?{selectable:u,container:n}:void 0}selectableIsDragging(e){const t=y.ZP.state;if(!t.isDragging)return;const{draggedStores:i}=t;for(;e;){if(i.indexOf(e.props.store)>=0)return!0;e=e.getContextClosestSelectable()}return!1}selectableCanAcceptDrop(e,t){if(x.Z.state.isOpen&&!F.ZP.state.open)return!1;if(I.Z.state.isOpen)return!1;const i=y.ZP.state,s=i.isDragging?i.draggedStores:[],a=!!i.isDragging&&i.isNativeDrag;if(!(e instanceof M.Z))return e.props.canAcceptDrop({direction:t,draggingStores:s,isNativeDrag:a});const o=e.props.store;let n,r,l=!1,d=!1;if(s.find((e=>{const t=k.Z.findOutlinerItemFromStore(e);return!!t&&(n=t.props.type,l=t.props.isTopLevelItem,!0)})),t===y.vh.Onto&&"collection"===o.getParentTable()){const e=o.getParentId();if(s.find((t=>Boolean(t instanceof b.Z&&"collection"===t.getParentTable()&&t.getParentId()===e))))return!1}if(e.props.groupsPointer){if(e.props.groupsPointer.find((e=>!(0,N.WL)(e)))){if(s.find((t=>{var i;const s=w.C.findSelectableFromStore(t);return(null==s||null===(i=s.props)||void 0===i?void 0:i.groupsPointer)&&e.props.groupsPointer&&!(0,V.HH)(s.props.groupsPointer,e.props.groupsPointer)})))return!1}}const c=Boolean(s.find((e=>e.isCollectionView())));if(c&&"collection"===o.getParentTable()&&t!==y.vh.Onto&&"bookmarks"!==n)return!1;if(c&&o.isCollectionView()&&t===y.vh.Onto)return!1;if(c&&o.isCollectionView()&&!o.recordStoreParent()&&t!==y.vh.Onto)return!1;const u=k.Z.findOutlinerItemFromStore(o),m=null==u?void 0:u.props.parentStore;var p;u&&(r=u.props.type,d=u.props.isTopLevelItem||"team"===(null===(p=u.props.parentStore)||void 0===p?void 0:p.table));if(r&&a)return!1;if("bookmarks"===n&&l&&("bookmarks"!==r||!d||t===y.vh.Onto))return!1;if("bookmarks"===r&&d&&t!==y.vh.Onto&&("bookmarks"!==n||!l))return!1;if(u&&"team"===r&&d&&t!==y.vh.Onto&&null!=m&&m.getRole()&&"editor"!==m.getRole())return!1;if("shared"===r&&"shared"!==n&&t!==y.vh.Onto)return!1;if("shared"===n&&"shared"!==r&&s.some((e=>!e.isTopLevel())))return!1;if(r&&d&&t!==y.vh.Onto){if(s.find((e=>{const t=e.getType();return Boolean(!t||!T.Z7[t])})))return!1}const{device:g}=this.environment;if(r&&g.isMobile&&t===y.vh.Onto&&d)return!1;if(s.find((e=>Boolean(e instanceof b.Z&&e.isInlineCollectionView())))&&(t===y.vh.Left||t===y.vh.Right))return!1;if(s.some((e=>Boolean(B.Z.findCollectionTemplatePickerItemFromStore(e))))!==Boolean(B.Z.findCollectionTemplatePickerItemFromStore(o)))return!1;if(t===y.vh.Onto&&o&&!(0,_.J5)({environment:this.environment,blocks:[o],publicEditMode:this.pageContext&&this.pageContext.publicEditModeStore.state}))return!1;if(!this.memoizedCanDrag(s))return!1;if(s.some((e=>e.isTransclusionType()))){if(o.findRecordStoreAncestor((e=>{if(e===o)return!1;const t=e.getValue();return t&&(0,O.nq)(t)})).ancestor)return!1}return!0}getReferencePointForRect(e,t){return K({device:this.environment.device,target:e.target,points:t})}}d()(ee,"hoverMaxHorizontalOffset",150),d()(ee,"competingOntoDropZoneVerticalOffset",7),d()(ee,"verticalDropZoneAmbiguousDist",20),d()(ee,"competingHorizontalDropZoneMinDist",2);const te=ee;var ie=i(74647),se=i(27832),ae=i(49427),oe=i(7755),ne=i(45094);class re extends u.Z{constructor(...e){super(...e),d()(this,"cachedPageViewRect",void 0),d()(this,"previousMousePosition",void 0),d()(this,"mouseSpeed",1/0),d()(this,"timerId",void 0),d()(this,"setPreviousMousePosition",((e,t)=>{this.previousMousePosition={x:e,y:t},clearTimeout(this.timerId),this.timerId=setTimeout((()=>{this.previousMousePosition=void 0}),100)})),d()(this,"handleWindowMouseMove",(e=>{(0,c.ZP)({event:e,context:c.Af.SidebarMouseMove,callback:()=>{if(this.updatePageViewRectThrottled(),void 0!==this.previousMousePosition&&(this.mouseSpeed=Math.sqrt(Math.pow(e.clientX-this.previousMousePosition.x,2)+Math.pow(e.clientY-this.previousMousePosition.y,2))),this.setPreviousMousePosition(e.clientX,e.clientY),this.cachedPageViewRect){const{sidebarMinTriggerWidth:t,sidebarOpenWidthPercent:i}=re,s=oe.TC.state,a=(0,ne.Wk)(this.environment),o=e.clientX,n=this.cachedPageViewRect.left,r=Math.max(n*i,t,oe.Ic.get());o<r&&!F.ZP.state.open&&this.mouseSpeed<re.mouseSpeedThreshold&&0!==this.mouseSpeed&&!s&&ie.open(),o>a&&o>r&&s&&ie.close()}}})})),d()(this,"handleWindowMouseOut",(e=>{e.toElement||e.relatedTarget||ie.close()})),d()(this,"handleWindowResize",(e=>{this.environment.WindowSizeStore.state.width<ie.OnlyOneSidebarVisibleWidthThreshold&&(0,ne.Sx)(this.environment)&&(0,ne.in)(this.environment)&&ie.setExpand({environment:this.environment,isExpanded:!1})})),d()(this,"updatePageViewRectThrottled",f().throttle(this.updatePageViewRect,500))}didMount(){window.addEventListener("mousemove",this.handleWindowMouseMove),window.addEventListener("mouseout",this.handleWindowMouseOut),window.addEventListener("resize",this.handleWindowResize)}willUnmount(){window.removeEventListener("mousemove",this.handleWindowMouseMove),window.removeEventListener("mouseout",this.handleWindowMouseOut),window.removeEventListener("resize",this.handleWindowResize)}updatePageViewRect(){const e=this.getPageViewWrapEl();this.cachedPageViewRect=e?e.getBoundingClientRect():document.body.getBoundingClientRect()}getPageViewWrapEl(){const{currentBlockStore:e}=se.default.state,t=ae.Z.find((t=>t.props.store===e));if(t){const e=t.getContentWrapEl();if(e)return e}}}d()(re,"sidebarOpenWidthPercent",.38),d()(re,"sidebarMinTriggerWidth",18),d()(re,"mouseSpeedThreshold",5);const le=re;i(85827);var de=i(65311),ce=i(90031),ue=i(58762),me=i(40902),pe=i(95477),ge=i(26111),he=i(69519),fe=i(84908),ve=i(32918),ye=i(76487),Me=i(12252),Se=i(6650),be=i(44615),Te=i(5366),Ce=i(65598),Ze=i(77907);class we extends u.Z{constructor(...e){super(...e),d()(this,"lastEmitValue",-1),d()(this,"lastSentBadgeNumber",void 0),d()(this,"lastSentCurrentSpaceBadgeNumber",void 0),d()(this,"handleNotificationEmit",(async(e,t)=>{if(t===this.lastEmitValue)return;this.lastEmitValue=t;const i=await ue.getUserNotifications(this.environment,{size:21});if("failed"===i.type)return;const{results:s}=i.data;ye.Z.setState({results:s}),this.syncInitialBadgeNumber();const a=f().union.apply(null,s.map((e=>e.unreceived.notificationIds)));for(const o of a)this.displayNotification(o)})),d()(this,"handleNotificationEmitThrottled",f().throttle(this.handleNotificationEmit,1e3)),d()(this,"handleNotificationEmitWhenActive",((e,t)=>{Me.Z.whenActive((()=>{this.handleNotificationEmitThrottled(e,t)}))})),d()(this,"listenerReference",void 0),d()(this,"updateBadgeNumbers",(()=>{const{results:e}=ye.Z.state,{mobileNative:t}=this.environment,i=e.reduce(((e,t)=>e+t.unread.mentions),0);if(t){const e=ye.Z.getUnreadCountForCurrentSpace().mentions;i===this.lastSentBadgeNumber&&e===this.lastSentCurrentSpaceBadgeNumber||t.setBadgeNumber(i,e),this.lastSentCurrentSpaceBadgeNumber=e}i!==this.lastSentBadgeNumber&&(i>0?fe.setBadge("".concat(i)):fe.setBadge("")),this.lastSentBadgeNumber=i})),d()(this,"syncInitialBadgeNumber",f().once(this.updateBadgeNumbers))}willMount(){this.startMessageListeners(),ye.Z.addListener(this.updateBadgeNumbers),this.environment.mobileNative&&se.default.addListener(this.updateBadgeNumbers)}willUnmount(){this.stopMessageListeners(),ye.Z.removeListener(this.updateBadgeNumbers),this.environment.mobileNative&&se.default.removeListener(this.updateBadgeNumbers)}startMessageListeners(){const{currentUserStore:e}=se.default.state;if(e){const t=(0,be.Lp)(e.id);this.listenerReference=Se.Z.addListener(t,this.handleNotificationEmitWhenActive,void 0,this.environment)}}stopMessageListeners(){this.listenerReference&&Se.Z.removeListener(this.listenerReference,this.environment)}async displayNotification(e){const t=(0,ce.Kv)(this.props.rootStore,{table:de.uX,id:e});await t.load();const i=t.getValue();if(!i)return;const s=(0,Ce.No)(t,i.activity_id,i.space_id);await s.load();const a=s.getValue(),{currentUserStore:o,currentSpaceViewStore:n}=se.default.state;if(o&&n&&a&&!a.invalid&&!me.BX(a,o.id)&&await fe.shouldSendNotification()&&"undefined"!=typeof Notification){await n.load();const e=n.getValue();if(!e)return;if(!me.OJ(a))return;if(!e.notify_desktop)return;if(!this.environment.device.isDesktop)return;const i=(0,(await Ze.deps.desktop.loader()).PushNotification)({activity:a,getRecordValue:t.getRecordValue,userTimeZone:ve.x7,intl:this.props.intl});if(!i)return;const{subject:s,body:o}=i;new Notification(s,{body:o,silent:!0}).addEventListener("click",(()=>{const e=me.hY({activity:a,getRecordValue:t.getRecordValue,baseUrl:pe.default.domainBaseUrl}),i=me.Fb(a),s=(0,he.k)(e,[i,"desktop_push"]);ge.navigate({environment:this.environment,url:s})}))}}}const ke=(0,Te.injectIntl)(we);var Ae=i(94416);class Pe extends u.Z{constructor(...e){super(...e),d()(this,"handleOpen",(()=>{Ae.Z.setState({open:!0})})),d()(this,"handleClose",(()=>{Ae.Z.setState({open:!1})}))}willMount(){fe.inPageSearch.started.addListener(this.handleOpen),fe.inPageSearch.stopped.addListener(this.handleClose)}willUnmount(){fe.inPageSearch.started.removeListener(this.handleOpen),fe.inPageSearch.stopped.removeListener(this.handleClose)}}const Ie=Pe;var xe=i(6404),Fe=i(52858),Be=i(66722),Ee=i(50906),Re=i(83071),De=i(73581),_e=i(71202),Le=i(89206),Oe=i(13713),Ue=i(8949),Ne=i(83182),Ve=i(15282),We=i(33665),ze=i(80209);class He extends u.Z{constructor(...e){super(...e),d()(this,"renderOverlay",(()=>{const{device:e}=this.environment,t=Ue.Z.state;if(!t.isActive)return;const{originBlockRect:i,actions:s,inputValue:o,publicEditMode:r}=t,l={environment:this.environment,blocks:t.stores,originRect:i,publicEditMode:r},d=t.showInput&&this.renderInputSection(),c=t.stores[0];let u;return u=e.isPhone?{menuType:_e.ZP.MenuType.Modal,title:a()(Te.FormattedMessage,{defaultMessage:"Actions",id:"blockMenu.actionButton.label"}),right:a()(Ve.DoneMenuText,{}),onClickRight:this.handleOverlayBgClick,header:d}:e.isNative?{menuType:_e.ZP.MenuType.Popup,width:265,header:d}:{menuType:_e.ZP.MenuType.Popup,width:245,header:d},a()(Le.Z,{capture:!0,onBackspace:f().identity},void 0,n().createElement(_e.ZP,u,a()(Fe.Z,{filter:o,context:l,sections:s,onAccept:this.handleAccept,initialFocus:o?0:void 0}),!o&&this.renderBlockAuthorInfo(),!o&&a()(ze.Z,{store:c}),!o&&c.isCollectionView()&&this.renderCollectionHelpButton()))})),d()(this,"handleOverlayBgClick",(()=>{xe.xv()})),d()(this,"handleAccept",(e=>{const t=Ue.Z.state;if(!t.isActive)return;const{stores:i}=Z.default.state,{analyticsFrom:s}=t,a=i[0];if(a){const t=a.getValue();t&&Ee.dhV(this.environment,{analyticsName:e.analyticsName,from:s,block_type:t.type})}e.closeParentMenu&&xe.xv()})),d()(this,"handleInputChange",(e=>{Ue.Z.state.isActive&&Ue.Z.setState({...Ue.Z.state,inputValue:e.target.value})}))}renderComponent(){const{device:e}=this.environment,t=Ue.Z.state;return a()(Be.ZP,{popupType:e.isPhone?Be.ZP.PopupType.SlideUp:Be.ZP.PopupType.Popup,open:t.isActive,originRect:t.isActive?t.originBlockRect:void 0,onDismiss:this.handleOverlayBgClick,placementToOrigin:Be.ZP.Placement.Bottom,alignmentToOrigin:Be.ZP.Alignment.Start,originGap:0,preventScaleTransition:!0,render:this.renderOverlay,preventBlockRenderQueueOnEnter:e.isMobile})}renderBlockAuthorInfo(){const e=Ue.Z.state;if(e.isActive&&!(e.stores.length>1))return a()(Oe.Z,{store:e.stores[0],isPageMoreButton:!1})}renderInputSection(){const{device:e}=this.environment,{intl:t}=this.props,i=Ue.Z.state;if(!i.isActive||e.isPhone)return;const{inputValue:s}=i;return a()(Re.Z,{isInput:!0},void 0,a()(De.Z,{value:s,onChange:this.handleInputChange,focus:!0,focusAfterAnimation:!0,placeholder:t.formatMessage({defaultMessage:"Filter actions…",id:"blockMenu.filterForActions.placeholder"}),preventCaptureDeleteWhenEmpty:!0}))}renderCollectionHelpButton(){return a()(Re.Z,{topBorder:!0},void 0,a()(Ne.Z,{title:a()(Te.FormattedMessage,{defaultMessage:"Learn about databases",id:"blocks.blockMenu.collectionHelpButton"}),href:(0,We.UY)("guides.database"),analyticsFrom:"block_menu"}))}}const qe=(0,Te.injectIntl)(He);var Ge=i(62727),Ke=i(87143),je=i(46951);class Ye extends u.Z{constructor(...e){super(...e),d()(this,"handleOverlayBgClick",(e=>{Ke.Z.setState({...Ke.Z.state,active:!1,stringValue:""})}))}renderComponent(){const{device:e}=this.environment,{active:t,stringValue:i}=Ke.Z.state,s=window.innerWidth/2-150,o=window.innerHeight/2;return a()(Be.ZP,{popupType:e.isMobileNative?Be.ZP.PopupType.SlideUp:Be.ZP.PopupType.Popup,open:t,originRect:{top:o,left:s},onDismiss:this.handleOverlayBgClick,placementToOrigin:Be.ZP.Placement.Bottom,alignmentToOrigin:Be.ZP.Alignment.Start,originGap:0,render:()=>a()(Le.Z,{capture:!0,onEnter:f().identity,onCommandEnter:f().identity,onCommandShiftEnter:f().identity,onCommandSlash:f().identity,onDelete:f().identity,onBackspace:f().identity,onEsc:f().identity,onLeft:f().identity,onRight:f().identity,onUntab:f().identity,onTab:f().identity,onSelectAll:f().identity,onRedo:f().identity,onUndo:f().identity,onToggleBold:f().identity,onToggleItalics:f().identity,onToggleStrike:f().identity,onToggleCode:f().identity,onCut:f().identity,onCopy:f().identity,onPaste:f().identity,onKeypress:f().identity},void 0,a()("div",{style:{padding:8,width:300}},void 0,a()(Ge.Z,{style:{width:"100%",fontSize:12},value:i,focus:!0,textarea:!0,selectAll:!0,readOnly:!0}),a()(je.Z,{isSmall:!0,style:{marginTop:6,pointerEvents:"none"}},void 0,a()(Te.FormattedMessage,{defaultMessage:"Right click and copy the link above",id:"clipboardInputRenderer.copyLink.message"}))))})}}const Qe=Ye;var Je=i(34041),Xe=i(27431);class $e extends u.Z{constructor(...e){super(...e),d()(this,"renderGhost",(()=>{const e=y.ZP.state;if(!e.isDragging)return;const t=e.draggedStores.map(((t,i)=>a()(Je.Z,{store:t,ghostElement:e.ghostElements[i]},"".concat(i))));return a()("div",{style:this.getGhostStyle()},void 0,t)})),d()(this,"isDragging",this.createComputedStore((()=>y.ZP.state.isDragging)))}renderComponent(){return a()(Xe.Z,{open:this.isDragging.state,render:this.renderGhost})}getGhostStyle(){const e=y.ZP.state;if(!e.isDragging)return;const{startX:t,startY:i,currentX:s,currentY:a}=e,o=a-i;return{position:"absolute",top:0,left:0,transform:"translate3d(".concat(s-t,"px, ").concat(o,"px, 0)")}}}const et=$e;var tt=i(67154),it=i.n(tt),st=i(73935),at=i.n(st),ot=i(17504),nt=i(51454),rt=i(13548),lt=i(72704),dt=i(17903),ct=i(82990),ut=i(38302),mt=i(8848),pt=i(42001),gt=i(54604),ht=i(39500),ft=i(592);class vt extends u.Z{constructor(...e){super(...e),d()(this,"rootEl",void 0),d()(this,"animatedEl",void 0),d()(this,"responsiveSettings",this.createComputedStore((()=>({edgePadding:this.environment.WindowSizeStore.state.width<1020?0:32,backgroundOpacity:.8})))),d()(this,"renderOverlay",(()=>{const{isOpen:e,renderFullScreenNode:t,fullScreenNodeRect:i,contentAspectRatio:s}=ut.Z.state;if(!i)return;const{edgePadding:o,backgroundOpacity:r}=this.responsiveSettings.state,l=window.innerWidth,d=window.innerHeight,c=d-2*o;let u=l-2*o;let m=u*(s||i.height/i.width);if(m>c){const e=m/c;m/=e,u/=e}const p=(l-u)/2,g=(d-m)/2,h={translateX:i.left,translateY:i.top,width:i.width,height:i.height},v={translateX:p,translateY:g,width:u,height:m};let y;return t&&(y=t()),(0,ot.Z)((t=>a()(Le.Z,{capture:e,onEsc:this.handleClose,onEnter:f().identity,onSpace:this.handleClose,onCommandEnter:this.handleClose,onCommandShiftEnter:f().identity,onCommandSlash:f().identity,onUp:f().identity,onDown:f().identity,onDelete:f().identity,onBackspace:f().identity,onLeft:f().identity,onRight:f().identity,onUntab:f().identity,onTab:f().identity,onSelectAll:f().identity,onRedo:f().identity,onUndo:f().identity,onToggleBold:f().identity,onToggleItalics:f().identity,onToggleStrike:f().identity,onToggleCode:f().identity,onCut:f().identity,onCopy:f().identity,onPaste:f().identity,onKeypress:f().identity},void 0,a()(lt.Z,{capture:e,preventType:ft.xm.All},void 0,n().createElement("div",it()({onClick:this.handleAreaClick,ref:e=>{this.rootEl=e},style:this.getStyle(e)},t),a()(rt.Z,{isVisible:e,enterAnimationStyle:{opacity:0},exitAnimationStyle:{opacity:0},animationStyle:{opacity:r},render:()=>a()("div",{style:vt.backgroundStyle}),onAnimationEnd:this.handleBackgroundAnimationEnd}),n().createElement(rt.Z,{ref:e=>{this.animatedEl=e},isVisible:e,enterAnimationStyle:h,exitAnimationStyle:h,animationStyle:v,springConfig:{translateX:vt.springConfig,translateY:vt.springConfig,width:vt.springConfig,height:vt.springConfig},render:()=>a()("div",{style:vt.fullScreenNodeWrapStyle},void 0,y),onAnimationEnd:this.handleFullscreenNodeAnimationEnd}),a()("div",{style:this.getCloseButtonStyle(e)},void 0,a()(pt.Z,{onClick:this.handleClose,style:{color:"#fff"}},void 0,a()(Te.FormattedMessage,{defaultMessage:"Close",id:"fullscreenRenderer.closeButton.label",description:"Shown in the top right corner when viewing an asset (image, file, etc.) in full screen mode, to close out of full screen mode."}))))))))})),d()(this,"handleAreaClick",(e=>{(0,ht.uG)(e)||this.handleClose()})),d()(this,"handleClose",(()=>{gt.x(),v.ZH(this.environment)})),d()(this,"handleResize",(()=>{const{isOpen:e}=ut.Z.state;e&&this.enqueueForceUpdate()})),d()(this,"handleFrameScrollerUpdate",(()=>{this.updateRootElFromScroll()})),d()(this,"handleBackgroundAnimationEnd",(()=>{const{isOpen:e}=ut.Z.state;e||ut.Z.setState({...ut.Z.state,backgroundAnimationComplete:!0})})),d()(this,"handleFullscreenNodeAnimationEnd",(()=>{const{isOpen:e}=ut.Z.state;e||ut.Z.setState({...ut.Z.state,fullscreenNodeAnimationComplete:!0})}))}didMount(){super.didMount(),window.addEventListener("resize",this.handleResize),dt.Z.addListener(this.handleFrameScrollerUpdate)}didMountOrUpdate(){super.didMountOrUpdate(),this.updateRootElFromScroll()}willUnmount(){super.willUnmount(),window.removeEventListener("resize",this.handleResize),dt.Z.removeListener(this.handleFrameScrollerUpdate)}renderComponent(){const{isOpen:e,fullscreenNodeAnimationComplete:t,backgroundAnimationComplete:i}=ut.Z.state;return a()(Xe.Z,{open:e||!t||!i,render:this.renderOverlay})}getRenderedEl(){const e=at().findDOMNode(this.animatedEl);if(e)return e.childNodes[0]}updateRootElFromScroll(){if(this.getRenderedEl()){const{scrollTop:e}=dt.Z.state,{startScrollTop:t}=ut.Z.state,i=e-t;this.rootEl.style.transform="translateY(".concat(-i,"px)")}}getStyle(e){return{zIndex:nt.mJ,position:"fixed",top:0,left:0,right:0,bottom:0,pointerEvents:e?"auto":"none",cursor:"zoom-out"}}getCloseButtonStyle(e){const{WindowSizeStore:t}=this.environment;return{position:"absolute",top:t.getSafePaddingBottomCSS(16),right:t.getSafePaddingRightCSS(18),display:e?"block":"none",fontWeight:ct.Z.fontWeight.medium}}}d()(vt,"edgePadding",32),d()(vt,"springConfig",{stiffness:65,damping:10,precision:.001}),d()(vt,"fullScreenNodeWrapStyle",{position:"absolute",top:0,left:0,display:"flex"}),d()(vt,"backgroundStyle",{position:"absolute",top:0,left:0,right:0,bottom:0,background:mt.ZP.black});const yt=vt;var Mt=i(27153),St=i(91584),bt=i(4323),Tt=i(33846),Ct=i(73657),Zt=i(1994),wt=i(4637),kt=i(37235),At=i(61543),Pt=i(53471),It=i(66957),xt=i(46034),Ft=i(6202),Bt=i(3779),Et=i(1643),Rt=i(78609),Dt=i(78291),_t=i(91390),Lt=i(14947),Ot=i(33058),Ut=i(86512),Nt=i(48243),Vt=i(7765),Wt=i(31299),zt=i(68932),Ht=i(42402),qt=i(48762),Gt=i(78948),Kt=i(43250),jt=i(33929),Yt=i(34809),Qt=i(96802);const Jt=(0,Te.defineMessages)({embedPlaceholder:{id:"mediaPicker.embedPlaceholder.text",defaultMessage:"Paste in https://…"},filterPlaceholder:{id:"mediaPicker.emojiFilter.text",defaultMessage:"Filter…"},unsplashPlaceholder:{id:"mediaPicker.unsplashPlaceholder.text",defaultMessage:"Search for an image…"}});class Xt extends u.Z{constructor(...e){super(...e),d()(this,"storeTypes",{embedInputStore:Tt.Z,emojiInputStore:Tt.Z,emojiPickerStore:Rt.Z,unsplashInputStore:Tt.Z}),d()(this,"renderUnsplashResults",((e,t,i,s)=>s?!i||i&&!i.length?a()(Ct.Z,{shouldWrapCaption:!0,caption:a()(Te.FormattedMessage,{defaultMessage:"No results found.",id:"mediaPicker.unsplash.noResultsText"}),style:{textAlign:this.props.isSmallWidth?"left":"center",color:this.theme.mediumTextColor}}):a()(o.Fragment,{},void 0,i.map((t=>this.renderUnsplashImage(e,t))),a()(Ct.Z,{shouldWrapCaption:!0,caption:a()(Te.FormattedMessage,{defaultMessage:"Search to find more results.",id:"mediaPicker.unsplash.searchText"}),style:{textAlign:this.props.isSmallWidth?"left":"center",color:this.theme.mediumTextColor}})):a()("div",{style:this.getLoadingContainerStyle()},void 0,a()(zt.Z,{})))),d()(this,"renderUnsplashImage",((e,t)=>{const{device:i}=this.environment;return a()("div",{style:{width:i.isMobile?"33%":"25%",padding:3}},t.id,a()(Lt.Z,{hoveredStyle:{opacity:.85},onClick:()=>this.handleSelectUnsplashImage(e,t)},void 0,a()(wt.Z,{src:t.thumbUrl,style:{width:"100%",height:64,objectFit:"cover",objectPosition:"center 0%",borderRadius:3}})),a()(je.Z,{isSmall:!0,isSecondaryColor:!0,style:{marginTop:2,marginBottom:4}},void 0,a()(Te.FormattedMessage,{defaultMessage:"by <inlinetextlink>{authorName}</inlinetextlink>",id:"mediaPicker.unsplash.byAuthor",description:"Caption attributing the author of the Unsplash image",values:{authorName:t.authorName,inlinetextlink:(...e)=>a()(Ht.Z,{external:!0,href:t.unsplashUrl},void 0,e)}})))})),d()(this,"handleEmbedSubmit",(e=>()=>{const t=this.stores.embedInputStore.state.inputValue;t&&(e.onChange(t),Ee.bOx(this.environment,{pastedText:t,source:"media_picker"}))})),d()(this,"handleSelectUnsplashImage",(async(e,t)=>{const i=await(0,Yt.Z)({environment:this.environment,url:t.downloadUrl,method:"GET",format:"json"});"success"===i.type&&e.onChange({url:i.data.url})})),d()(this,"handleSwipeLeft",(()=>{if(!_t.Z.state.isActive)return;const e=this.getTabs(),t=e.map((e=>e.type)).indexOf(_t.Z.state.currentTab),i=e[t+1];void 0!==i&&this.handleTabChange(i.type)})),d()(this,"handleSwipeRight",(()=>{if(!_t.Z.state.isActive)return;const e=this.getTabs(),t=e.map((e=>e.type)).indexOf(_t.Z.state.currentTab),i=e[t-1];void 0!==i&&this.handleTabChange(i.type)})),d()(this,"handleTabChange",(e=>{_t.Z.state.isActive&&_t.Z.setState({..._t.Z.state,currentTab:e})})),d()(this,"handleRandomEmojiClick",(()=>{const{device:e}=this.environment,t=this.getTabs().find((e=>e.type===this.props.currentTab));if(t&&"emoji"===t.type){const i=(0,Qt.zM)();t.onChange(i,{keepVisible:!e.isMobile})}})),d()(this,"handleEmojiFilterChange",(e=>{const{emojiInputStore:t,emojiPickerStore:i}=this.stores;t.setState({...t.state,inputValue:e.currentTarget.value}),i.setState({...i.state,loadEmojiCount:Rt.Z.emojisPerPage})}))}renderComponent(){const{device:e}=this.environment,t=this.renderTabsHeader(),i=this.renderInputHeader(),s=(t||i)&&a()(o.Fragment,{},void 0,t,i);let r;return e.isMobile?r={menuType:_e.ZP.MenuType.Modal,title:this.props.title,header:s,right:a()(Te.FormattedMessage,{defaultMessage:"Close",id:"mediaPicker.mobileCloseButton.label"}),onClickRight:this.props.onCancel,left:this.props.onDelete&&a()(Te.FormattedMessage,{defaultMessage:"Remove",id:"mediaPicker.mobileRemoveButton.label"}),onClickLeft:this.props.onDelete}:(r={menuType:_e.ZP.MenuType.Popup,header:s},r.width=this.props.popupWidth||300,r.height=this.props.popupHeight,r.maxHeight=this.props.maxHeight,r.maxWidth=this.props.maxWidth),a()(xt.Z,{onSwipeLeft:this.handleSwipeLeft,onSwipeRight:this.handleSwipeRight,render:e=>n().createElement(_e.ZP,it()({},r,e,{className:Kt.tQ}),this.renderCurrentTab())})}renderTabsHeader(){const{device:e}=this.environment;if(!(this.getTabs().length<=1)||this.props.onDelete){const t={gallery:a()(Te.FormattedMessage,{id:"mediaPicker.tabs.gallery",defaultMessage:"Gallery"}),embed:a()(Te.FormattedMessage,{id:"mediaPicker.tabs.embedLink",defaultMessage:"Embed link"}),file:a()(Te.FormattedMessage,{id:"mediaPicker.tabs.upload",defaultMessage:"Upload"}),emoji:a()(Te.FormattedMessage,{id:"mediaPicker.tabs.emoji",defaultMessage:"Emoji"}),unsplash:a()(o.Fragment,{},void 0,Bt.Z.unsplashLogo({width:12,marginRight:4,height:12}),a()("span",{},void 0,"Unsplash")),drive:a()(Te.FormattedMessage,{id:"mediaPicker.tabs.browse",defaultMessage:"Browse"})},i=this.getTabs(),s=i.findIndex((e=>e.type===this.props.currentTab)),n=i.map((e=>e.title||t[e.type])),r=i.find((e=>e.type===this.props.currentTab)),l=r&&"emoji"!==r.type&&e.isAndroid;return a()(It.Z,{tabs:n,selectedIndex:s,onChange:e=>{const t=i[e];this.handleTabChange(t.type)},right:a()(o.Fragment,{},void 0,r&&"emoji"===r.type&&a()(pt.Z,{isGray:!0,icon:Bt.Z.random,onClick:this.handleRandomEmojiClick},void 0,a()(Te.FormattedMessage,{id:"mediaPicker.emojiTab.random",defaultMessage:"Random"})),this.props.onDelete&&!e.isMobile&&a()(pt.Z,{isGray:!0,onClick:this.props.onDelete},void 0,a()(Te.FormattedMessage,{id:"mediaPicker.tabs.remove",defaultMessage:"Remove"}))),style:{...l&&{borderBottom:"none"}}})}}renderInputHeader(){const{device:e}=this.environment,t=this.getTabs().find((e=>e.type===this.props.currentTab)),i=!e.isMobile||void 0;if(t&&"emoji"===t.type)return a()("div",{style:{margin:e.isMobile?0:"10px 0"}},void 0,a()(De.Z,{value:this.stores.emojiInputStore.state.inputValue,focusInitial:i,placeholder:jt.default.formatMessage(Jt.filterPlaceholder),showClearButton:!0,left:Bt.Z.searchThick(this.getSearchIconStyle()),onChange:this.handleEmojiFilterChange,style:{...e.isAndroid&&{borderBottom:"none"}}}))}renderCurrentTab(){const e=this.getTabs().find((e=>e.type===this.props.currentTab));if(!e)return a()(Te.FormattedMessage,{defaultMessage:"Uh oh! Something went wrong.",id:"mediaPicker.errorMessage"});switch(e.type){case"embed":return this.renderEmbedTab(e);case"file":return this.renderUploadTab(e);case"emoji":return this.renderEmojiTab(e);case"gallery":return this.renderGalleryTab(e);case"unsplash":return this.renderUnsplashTab(e);case"drive":return this.renderGoogleDriveTab(e)}}renderEmojiTab(e){return a()(Zt.Z,{onSubmit:e.onChange,filter:this.stores.emojiInputStore.state.inputValue||"",store:this.stores.emojiPickerStore,isCallout:this.props.isCallout})}renderGalleryTab(e){return a()("div",{style:{paddingBottom:8}},void 0,f().map(bt.Z,((t,i)=>a()(Re.Z,{title:a()(Ut.Z,{style:{marginLeft:-5},href:t.url,external:!0},void 0,a()(Ot.Z,{},void 0,jt.default.formatMessage(t.title))),isTitleUppercase:!0,noTextOverflow:!0},i,a()("div",{style:this.getGalleryWrapStyle()},void 0,t.items.map((({coverUrl:t,title:i,subtitle:s,position:o},r)=>a()("div",{style:{width:"25%",padding:3}},r,a()(kt.Z,{originGap:0,placement:kt.Z.Placement.Bottom,delayThreshold:600,renderTooltip:()=>a()("div",{style:{maxWidth:180,whiteSpace:"normal"}},void 0,a()("span",{style:{color:this.theme.regularInvertedTextColor}},void 0,jt.default.formatMessage(i))," ",a()("span",{style:{color:this.theme.mediumInvertedTextColor}},void 0,s&&jt.default.formatMessage(s))),render:i=>n().createElement(Lt.Z,it()({hoveredStyle:{opacity:.85}},i,{onClick:()=>{e.onChange({url:t,position:o})}}),a()(Nt.Z,{url:t,width:200,isAuthenticated:!1,render:(e,t)=>t&&a()(wt.Z,{src:t,style:{width:"100%",height:64,objectFit:"cover",objectPosition:"center ".concat(100*(o||0),"%"),borderRadius:3}})}))})))))))))}renderUnsplashTab(e){const{device:t}=this.environment;return a()("div",{style:{paddingBottom:8}},void 0,a()(Re.Z,{desktopStyle:{marginTop:8,marginBottom:6}},void 0,a()(De.Z,{value:this.stores.unsplashInputStore.state.inputValue,placeholder:jt.default.formatMessage(Jt.unsplashPlaceholder),showClearButton:!0,focus:!t.isMobile||void 0,onChange:e=>{this.stores.unsplashInputStore.setState({...this.stores.unsplashInputStore.state,inputValue:e.target.value})}})),a()("div",{style:this.getGalleryWrapStyle()},void 0,a()(Vt.Z,{request:this.stores.unsplashInputStore.state.inputValue,debounce:Wt.vp,performRequest:async e=>{const t=await ue.searchUnsplashImages(this.environment,{query:e,page:0});if("success"===t.type)return t.data.results;throw t.error},render:(t,i,s)=>this.renderUnsplashResults(e,t,i,s)})))}renderUploadTab(e){const{data:t}=Dt.default.state;return a()(o.Fragment,{},void 0,e.fileUpload&&a()(Re.Z,{desktopStyle:{marginTop:this.props.isSmallWidth?8:24}},void 0,a()(Ft.Z,{title:a()(Te.FormattedMessage,{defaultMessage:"Choose a file",id:"mediaPicker.chooseFile.button.label"}),focused:!1,onClick:()=>this.handleUpload(e),fullWidth:this.props.isSmallWidth})),this.renderMediaCapture(e),e.caption&&a()(Ct.Z,{shouldWrapCaption:!0,caption:e.caption,style:{textAlign:this.props.isSmallWidth?"left":"center",color:this.theme.mediumTextColor}}),e.preventUploadLimitFreeFileSize||t&&Et.YK(t)&&a()("div",{style:{height:8}}),t&&!e.preventUploadLimitFreeFileSize&&!Et.YK(t)&&a()(Ct.Z,{shouldWrapCaption:!0,caption:a()("div",{style:{display:"flex",alignItems:"center",justifyContent:this.props.isSmallWidth?"flex-start":"center"}},void 0,a()("div",{style:{marginRight:6,color:this.theme.mediumTextColor}},void 0,a()(Te.FormattedMessage,{defaultMessage:"The maximum size per file is {filesize} MB.",id:"mediaPicker.maximumFileSize.notice",values:{filesize:Pt.K_}})),!m.default.isOnboarding.state&&a()(At.Z,{subscriptionTier:Et.M9(this.environment)||"team",onClick:()=>{this.props.onCancel&&this.props.onCancel()},analyticsName:"media_picker",desktopStyle:{marginBottom:1}}))}))}renderMediaCapture(e){if(e.imageUpload||e.videoUpload)return a()(Re.Z,{desktopStyle:{marginTop:this.props.isSmallWidth?8:24}},void 0,e.imageUpload&&a()(Ft.Z,{title:a()(Te.FormattedMessage,{defaultMessage:"Choose an image",id:"mediaPicker.chooseImage.buttonText"}),focused:!1,onClick:()=>this.handleUpload(e,"image/*"),fullWidth:this.props.isSmallWidth}),e.videoUpload&&a()(Ft.Z,{title:a()(Te.FormattedMessage,{defaultMessage:"Choose a video",id:"mediaPicker.chooseVideo.buttonText"}),focused:!1,onClick:()=>this.handleUpload(e,"video/*"),fullWidth:this.props.isSmallWidth}))}renderEmbedTab(e){const{device:t}=this.environment;return a()(o.Fragment,{},void 0,a()(Re.Z,{desktopStyle:{marginTop:8,marginBottom:6}},void 0,a()(De.Z,{type:"url",value:this.stores.embedInputStore.state.inputValue,placeholder:e.inputPlaceholder||jt.default.formatMessage(Jt.embedPlaceholder),autoFocus:!t.isMobile||void 0,showClearButton:!0,focus:!t.isMobile||void 0,onSubmit:this.handleEmbedSubmit(e),onChange:e=>{this.stores.embedInputStore.setState({...this.stores.embedInputStore.state,inputValue:e.target.value})}})),a()(Re.Z,{},void 0,a()(Ft.Z,{onClick:this.handleEmbedSubmit(e),focused:!1,title:e.buttonText||a()(Te.FormattedMessage,{defaultMessage:"Embed link",id:"mediaPicker.embedTab.embedLinkButtonText"}),fullWidth:this.props.isSmallWidth})),e.caption&&a()(Ct.Z,{shouldWrapCaption:!0,caption:e.caption,style:{textAlign:t.isMobile?"left":"center"}}))}renderGoogleDriveTab(e){return a()(Vt.Z,{request:this.environment,performRequest:St.vQ,render:(t,i,s)=>{if(!s)return a()(Re.Z,{},void 0,a()(Gt.Z,{}));const o=i&&i.accounts?i.accounts:[];return this.renderGoogleDriveAccounts(e,o)}})}renderGoogleDriveAccounts(e,t){return 0===t.length?a()(Re.Z,{},void 0,a()(qt.Z,{title:a()(Te.FormattedMessage,{defaultMessage:"Connect Google account",id:"mediaPicker.menuItem.connectFirstGoogleAccount.label"}),onClick:()=>e.onSelect(),focused:!1,style:{color:this.theme.blueColor}}),a()(Ct.Z,{shouldWrapCaption:!1,caption:a()(Te.FormattedMessage,{defaultMessage:"Find and embed your Google Drive files.",id:"mediaPicker.menuItem.connectFirstGoogleAccount.caption"})})):a()(o.Fragment,{},void 0,a()(Re.Z,{},void 0,t.map(((t,i)=>a()(qt.Z,{title:a()(Te.FormattedMessage,{defaultMessage:"Choose from {accountName}",id:"mediaPicker.menuItem.choosePagesFromAccount.label",values:{accountName:t.accountName}}),onClick:()=>e.onSelect(t),focused:!1},t.accountId)))),a()(Re.Z,{topBorder:!0},void 0,a()(qt.Z,{title:a()(Te.FormattedMessage,{defaultMessage:"Connect another account",id:"mediaPicker.menuItem.connectMoreGoogleAccounts.label"}),onClick:()=>e.onSelect(),style:{color:this.theme.mediumTextColor},focused:!1})))}getTabs(){return this.props.tabs}async handleUpload(e,t){const i=await Pt.y({multiple:!1,accept:t});i.length&&e.onUpload(i[0])}getLoadingContainerStyle(){return{display:"flex",alignItems:"center",justifyContent:"center",minHeight:320,flex:1}}getSearchIconStyle(){return{width:14,height:14,marginRight:6,flexGrow:0,flexShrink:0,color:this.theme.regularIconColor}}getGalleryWrapStyle(){const{device:e,WindowSizeStore:t}=this.environment;return{display:"flex",flexWrap:"wrap",alignContent:"flex-start",background:this.theme.popoverBackground,paddingTop:e.isMobile?12:0,paddingBottom:e.isMobile?12:0,paddingLeft:e.isMobile?t.getSafePaddingLeftCSS(14):12,paddingRight:e.isMobile?t.getSafePaddingRightCSS(14):12,boxShadow:e.isMobile?"0 1px 0 ".concat(this.theme.regularDividerColor):""}}}const $t=Xt;class ei extends u.Z{constructor(...e){super(...e),d()(this,"handleCloseOverlay",(()=>{Mt.Z()}))}renderComponent(){const{device:e}=this.environment,{state:t}=_t.Z;return a()(Be.ZP,{popupType:e.isMobile?Be.ZP.PopupType.SlideUp:Be.ZP.PopupType.Popup,open:t.isActive,originRect:t.isActive?t.originRect:void 0,originGap:t.isActive?t.originGap:void 0,placementToOrigin:Be.ZP.Placement.Bottom,alignmentToOrigin:Be.ZP.Alignment.Center,preventScaleTransition:!0,onDismiss:this.handleCloseOverlay,render:()=>{if(t.isActive)return n().createElement($t,it()({},t,{onCancel:this.handleCloseOverlay}))}})}}const ti=ei;var ii=i(42239),si=i(8646);class ai extends u.Z{constructor(...e){super(...e),d()(this,"cancelDragTimeout",void 0),d()(this,"handleDragOver",(e=>{e.preventDefault(),this.startDrag(e),this.continueDragThrottled(e)})),d()(this,"handleDrop",(e=>{e.preventDefault();const t=Array.from(e.dataTransfer.files);t.length>0&&si.createAndCommit(this.environment,(e=>{ii._4({environment:this.environment,files:t,analyticsFrom:"native_drag",transaction:e})}))})),d()(this,"startDrag",(e=>{ii.f$(this.environment,{startX:e.clientX,startY:e.clientY,stores:[],isNativeDrag:!0,getGhostElement:void 0})&&v.ZH(this.environment)})),d()(this,"continueDrag",(e=>{this.cancelDragTimeout&&window.clearTimeout(this.cancelDragTimeout),this.cancelDragTimeout=window.setTimeout(this.cancelDrag,this.getCancelDragTimeoutMS()),ii.td(this.environment,{currentX:e.clientX,currentY:e.clientY})})),d()(this,"continueDragThrottled",f().throttle(this.continueDrag,ai.dragOverThrottleMS)),d()(this,"cancelDrag",(()=>{ii.cQ(this.environment)}))}didMount(){super.didMount(),window.addEventListener("dragover",this.handleDragOver),window.addEventListener("drop",this.handleDrop)}willUnmount(){super.willUnmount(),window.removeEventListener("dragover",this.handleDragOver),window.removeEventListener("drop",this.handleDrop)}getCancelDragTimeoutMS(){const{device:e}=this.environment;return e.isLinux?2e3:200}}d()(ai,"dragOverThrottleMS",62.5);const oi=ai;var ni=i(52771),ri=i(40039),li=i(65187),di=i(9953),ci=i(82187),ui=i(98104),mi=i(80527),pi=i(42858),gi=i(4708);class hi extends u.Z{constructor(...e){super(...e),d()(this,"renderPopupContent",(()=>{const{renderDelete:e}=ci.Z.state;return a()(vi,{renderDelete:Boolean(e)})}))}renderComponent(){const{device:e}=this.environment,{clonedBlockStore:t,originRect:i}=ci.Z.state;return a()(Be.ZP,{popupType:e.isMobile?Be.ZP.PopupType.SlideUp:Be.ZP.PopupType.Popup,open:Boolean(t),originRect:i,placementToOrigin:Be.ZP.Placement.Bottom,alignmentToOrigin:Be.ZP.Alignment.Center,originGap:4,onDismiss:()=>ni.x(this.environment),render:this.renderPopupContent})}}class fi extends u.Z{constructor(...e){super(...e),d()(this,"handleRecordIconChange",(e=>{const{clonedBlockStore:t}=ci.Z.state;if(t){const i=t.getIconStore();i&&si.createAndCommit(this.environment,(t=>{di.sO({store:i,value:e,transaction:t})}))}}))}didMount(){const{clonedBlockStore:e}=ci.Z.state;if(!e)return;const t=e.getTitleStore();t&&ui.mT({environment:this.environment,store:t,canSelectAllBlocks:!1})}renderComponent(){const{device:e}=this.environment,{clonedBlockStore:t}=ci.Z.state;if(!t)return;const i=t.getTitleStore();if(!i)return;const{renderDelete:s}=this.props;let o;return o=e.isMobile?{menuType:_e.ZP.MenuType.ActionSheet}:{menuType:_e.ZP.MenuType.Popup,width:380},n().createElement(_e.ZP,o,a()("div",{style:this.getWrapStyle()},void 0,this.renderIcon(t),a()(li.Z,{store:i,disabled:!t.canEdit(),onEsc:()=>ni.x(this.environment),onEnter:()=>ni.x(this.environment),disableSlashCommands:!0,disableEmojiCommands:!0,disableSelectAllBlocks:!0,disableSelectionDrag:!0,disableStyleAnnotations:!0,placeholder:this.renderEmptyTitlePlaceholder(),style:this.getInputStyle(),pasteBehavior:"inline"}),s&&t.canEdit()&&this.renderDeleteButton()))}renderDeleteButton(){return a()(mi.Z,{icon:e=>Bt.Z.trash({height:20,width:20,...e}),style:{marginLeft:6},hasBackground:!0,isDarkIconColor:!0,showShadow:!0,onClick:async()=>{const{originalBlockStore:e}=ci.Z.state;e&&await pi.Qw({environment:this.environment,blocks:[e]}),ni.x(this.environment)}})}renderIcon(e){const t={width:28,height:28,marginRight:6,flexShrink:0,flexGrow:0,boxShadow:"inset 0 0 0 1px ".concat(this.theme.darkDividerColor)};return e.canEdit()?a()(ri.Z,{disabled:!1,bucket:"secure",store:e,icon:e.getIcon(),isEmptyPage:e.isEmptyPage(),size:18,style:t,onChange:this.handleRecordIconChange}):a()(ri.Z,{disabled:!0,icon:e.getIcon(),isEmptyPage:e.isEmptyPage(),size:18,style:t})}renderEmptyTitlePlaceholder(){const{clonedBlockStore:e}=ci.Z.state,{intl:t}=this.props;if(!e)return;const i=e.getValue();return i?(0,O.Q2)({table:e.table,value:i,getRecordValue:e.getRecordValue,userTimeZone:ve.x7,newViewsEnabled:(0,gi.is)(this.environment),intl:t}):void 0}getWrapStyle(){return{display:"flex",alignItems:"center",color:this.theme.regularTextColor,fontSize:"13px",padding:"4px 8px"}}getInputStyle(){return{display:"flex",alignItems:"center",flexGrow:1,fontSize:14,lineHeight:"20px",paddingTop:4,paddingBottom:4,paddingLeft:10,paddingRight:10,width:"100%",borderRadius:3,boxShadow:this.theme.inputBoxShadow,background:this.theme.inputBackground,cursor:"text",position:"relative"}}}const vi=(0,Te.injectIntl)(fi),yi=hi;var Mi=i(28358),Si=i(24229),bi=i(69326),Ti=i(54564),Ci=i(627),Zi=i(69972),wi=i(37064),ki=i(78089);const Ai=[Si.u.Open,Si.u.Resolved];class Pi extends u.Z{constructor(...e){super(...e),d()(this,"deepDiscussionsStores",this.createComputedStore((()=>{const{discussionIds:e}=this.props,{blockStore:t,recursivelyLoadAllDiscussions:i}=this.props;return Ce.al(t,{recursivelyLoadAllDiscussions:i}).filter((t=>!e||e.includes(t.id)||(0,ki.De)(t)))}))),d()(this,"handleChangeTab",(e=>{const t=Si.Z.state;t.open&&Si.Z.setState({...t,tab:Ai[e]})})),d()(this,"handleBackspace",(e=>{null==e||e.preventDefault(),Ti.LZ()}))}renderComponent(){if((0,ne.Sx)(this.environment))return null;const{device:e}=this.environment;let t;return t=e.isMobile?{menuType:_e.ZP.MenuType.Modal,title:a()(Te.FormattedMessage,{defaultMessage:"Comments",id:"blockDiscussionMenu.mobileMenu.title"}),header:this.renderMenuHeader(),right:a()(Ve.DoneMenuText,{}),onClickRight:Ti.LZ,whiteBackground:!0}:{menuType:_e.ZP.MenuType.Popup,header:this.renderMenuHeader(),width:480,maxHeight:"50vh",onClickOutside:Ti.LZ},a()(lt.Z,{capture:!0,preventType:ft.xm.All},void 0,a()(Zi.Z,{capture:!0,allowMobileAutoScroll:!0,render:()=>a()(Le.Z,{capture:!0,onEsc:Ti.LZ,onBackspace:this.handleBackspace,onDelete:this.handleBackspace},void 0,a()(wi.Z,{store:this.props.blockStore,droppable:!0,render:()=>n().createElement(_e.ZP,t,this.renderMenuContent())},this.props.blockStore.id))}))}renderMenuHeader(){const{device:e}=this.environment,{resolved:t,unresolved:i}=Ce.bB(this.deepDiscussionsStores.state),s=i.length,o=t.length;return 0===o||0===s?null:a()(It.Z,{tabs:[a()(Te.FormattedMessage,{defaultMessage:"Open ({numberOfOpenDiscussions})",id:"blockDiscussionMenu.openDiscussionsTab.title",values:{numberOfOpenDiscussions:s}}),a()(Te.FormattedMessage,{defaultMessage:"Resolved ({numberOfResolvedDiscussions})",id:"blockDiscussionMenu.resolvedDiscussionsTab.title",values:{numberOfResolvedDiscussions:o}})],selectedIndex:Ai.indexOf(this.props.tab),onChange:this.handleChangeTab,style:{...e.isAndroid&&{borderBottom:"none"}}})}renderMenuContent(){const{device:e}=this.environment,{resolved:t,unresolved:i}=Ce.bB(this.deepDiscussionsStores.state);if(this.props.tab===Si.u.Open){if(i.length){const t=i.map(((e,t,i)=>a()(bi.Z,{store:e,format:bi.Z.Format.Menu,isFirst:0===t,isOnly:1===i.length,discussionLocation:"block_menu",showResolveButtonByDefaultIfPossible:!0,blockStore:this.props.blockStore,onDismiss:Ti.LZ},e.id))),s=this.props.blockStore.getType(),n=s&&T.p2[s];if(e.isMobile&&n){const e=Ci.h(this.props.blockStore);return e?a()(o.Fragment,{},void 0,a()("div",{style:{padding:"12px 16px",boxShadow:"0 1px 0 ".concat(this.theme.regularDividerColor),marginBottom:1}},void 0,a()(e,{store:this.props.blockStore,disabled:!0,hideContent:!0,style:{fontSize:14,pointerEvents:"none"},isQuickFind:!0})),t):t}return t}return this.renderEmptyState(a()(Te.FormattedMessage,{defaultMessage:"No comments to show.",id:"blockDiscussionMenu.emptyState.noCommentsMessage"}))}return t.length?t.map(((e,t,i)=>a()(bi.Z,{store:e,format:bi.Z.Format.Menu,isFirst:0===t,isOnly:1===i.length,discussionLocation:"block_menu",showResolveButtonByDefaultIfPossible:!0,blockStore:this.props.blockStore,onDismiss:Ti.LZ},e.id))):this.renderEmptyState(a()(Te.FormattedMessage,{defaultMessage:"No resolved comments.",id:"blockDiscussionMenu.emptyState.noResolvedCommentsMessage"}))}renderEmptyState(e){const{device:t}=this.environment;return a()("div",{style:{textAlign:"center",padding:t.isMobile?"64px 18px":"32px 18px 36px",fontSize:14,color:this.theme.mediumTextColor}},void 0,e)}}const Ii=Pi;var xi=i(10663);class Fi extends u.Z{constructor(...e){super(...e),d()(this,"renderDiscussionMenu",(()=>{if(Si.Z.state.open&&!(0,ne.Sx)(this.environment))return a()(Ii,{rect:Si.Z.state.rect,tab:Si.Z.state.tab,blockStore:Si.Z.state.blockStore,discussionIds:Si.Z.state.discussionIds,recursivelyLoadAllDiscussions:Si.Z.state.recursivelyLoadAllDiscussions})}))}renderComponent(){const{device:e}=this.environment,{rect:t}=Si.Z.state,i=!(0,ne.Sx)(this.environment)&&Si.Z.state.open&&!(0,xi.az)(this.environment,Si.Z.state.blockStore);return a()(Be.ZP,{popupType:e.isMobile?Be.ZP.PopupType.SlideUp:Be.ZP.PopupType.Popup,open:i,originRect:t,placementToOrigin:Be.ZP.Placement.Bottom,alignmentToOrigin:Be.ZP.Alignment.Center,disableMouseCapture:!0,originGap:4,render:this.renderDiscussionMenu,preventScaleTransition:!0,preventOpacityTransition:!0,onDismiss:Ti.LZ})}}const Bi=Fi;var Ei=i(63437),Ri=i(7476),Di=i(53536),_i=i(13884);class Li extends u.Z{constructor(...e){super(...e),d()(this,"renderDiscussionInput",(()=>{if(_i.Z.state.open){const{blockStore:e,discussionInputStore:t}=_i.Z.state;return a()(Di.Z,{capture:!0},void 0,a()(Zi.Z,{capture:!0,allowOpenLinkMenu:!0,render:()=>a()(wi.Z,{store:e,droppable:!0,render:()=>a()("div",{style:this.getStyle()},void 0,a()(Ei.Z,{parentStore:e,onCancel:this.handleDismiss,onSubmit:this.handleSubmit,discussionInputStore:t,isMobileSlideUpMenu:!0,shouldSaveUnsentComments:!1,discussionFormat:ki.O2.Page,blockStore:e,canDrop:!0}))},e.id)}))}})),d()(this,"handleSubmit",(()=>{Ri.ZL(this.environment)})),d()(this,"handleDismiss",(()=>{const e=_i.Z.state;e.open&&Ri.uK(e.discussionInputStore,this.environment)}))}renderComponent(){const{device:e}=this.environment,{rect:t,open:i}=_i.Z.state;return _i.Z.state.open&&(0,xi.az)(this.environment,_i.Z.state.blockStore)?null:a()(Be.ZP,{popupType:e.isMobileNative?Be.ZP.PopupType.SlideUp:Be.ZP.PopupType.Popup,keepFocus:!0,open:i,originRect:t,placementToOrigin:Be.ZP.Placement.Bottom,alignmentToOrigin:Be.ZP.Alignment.Center,originGap:4,onDismiss:this.handleDismiss,render:this.renderDiscussionInput})}getStyle(){const{device:e,WindowSizeStore:t}=this.environment;return{width:e.isMobileNative?"100%":470,maxWidth:e.isMobileBrowser?"90vw":"100%",paddingTop:8,paddingBottom:e.isAndroid?12:8,paddingLeft:e.isMobileNative?t.getSafePaddingLeftCSS(10):10,paddingRight:e.isMobileNative?t.getSafePaddingRightCSS(10):10}}}const Oi=Li;var Ui=i(4083),Ni=i(13264);class Vi extends u.Z{constructor(...e){super(...e),d()(this,"renderDiscussion",(()=>{const{device:e}=this.environment;if(Ni.Z.state.open){const{discussionStore:t,discussionInputStore:i,blockStore:s}=Ni.Z.state;let o;return o=e.isMobile?{menuType:_e.ZP.MenuType.Modal,title:a()(Te.FormattedMessage,{defaultMessage:"Comments",id:"discussion.mobileReplyMenu.title"}),right:a()(Te.FormattedMessage,{defaultMessage:"Close",id:"discussion.mobileReplyMenu.closeButton.label"}),onClickRight:()=>Ui.UZ(this.environment),whiteBackground:!0}:{menuType:_e.ZP.MenuType.Popup,width:420,maxWidth:e.isMobileBrowser?"80vw":"100%"},n().createElement(_e.ZP,o,a()(Zi.Z,{capture:!0,render:()=>a()(bi.Z,{store:t,discussionInputStore:i,onDismiss:()=>Ui.UZ(this.environment),format:bi.Z.Format.Menu,isFirst:!0,isOnly:!0,discussionLocation:"reply_menu",showResolveButtonByDefaultIfPossible:!0,blockStore:s})}))}}))}renderComponent(){const{device:e}=this.environment,{open:t,rect:i}=Ni.Z.state;return a()(Be.ZP,{popupType:e.isMobile?Be.ZP.PopupType.SlideUp:Be.ZP.PopupType.Popup,open:t,originRect:i,placementToOrigin:Be.ZP.Placement.Bottom,alignmentToOrigin:Be.ZP.Alignment.Center,originGap:4,onDismiss:()=>Ui.UZ(this.environment),render:this.renderDiscussion})}}const Wi=Vi;i(73210);var zi=i(47798),Hi=i(25584),qi=i(97680),Gi=i(24042),Ki=i(16328),ji=i(92166),Yi=i(23566),Qi=i(31352),Ji=i(70203),Xi=i(85114),$i=i(57269),es=i(88632),ts=i(14568),is=i(19111),ss=i(33426),as=i(24666),os=i(19889),ns=i(44805),rs=i(17731),ls=i(88295),ds=i(77100),cs=i(63334),us=(i(82902),i(61766)),ms=i(92251);const ps={...ct.Z.textOverflowStyle,fontWeight:ct.Z.fontWeight.medium,maxWidth:160,display:"inline-block",verticalAlign:"bottom"};function gs(e){const{pageTitle:t}=e;return a()(Te.FormattedMessage,t?{defaultMessage:"New “{filterText}” page in…",id:"createPageMenuItem.title.withPageName",values:{filterText:a()("span",{style:ps},void 0,t)}}:{defaultMessage:"Add new page in…",id:"createPageMenuItem.title.withoutPageName"})}function hs(e){const{pageTitle:t}=e;return a()(Te.FormattedMessage,t?{defaultMessage:"New “{filterText}” sub-page",id:"createSubpageMenuItem.title.withPageName",values:{filterText:a()("span",{style:ps},void 0,t)}}:{defaultMessage:"Add new sub-page",id:"createSubpageMenuItem.title.withoutPageName"})}var fs=i(60442),vs=i(41892),ys=i(98742),Ms=i(92338),Ss=i(29026),bs=i(72087),Ts=i(472),Cs=i(68056),Zs=i(69454);const ws=(0,Te.defineMessages)({mentionAll:{defaultMessage:"Mention a person, page, or date…",id:"mentionMenu.personPageDate.prompt2"},mentionPersonPage:{defaultMessage:"Mention a person or page…",id:"mentionMenu.personPage.prompt2"},mentionPersonDate:{defaultMessage:"Mention a person or date…",id:"mentionMenu.personDate.prompt2"},mentionPageDate:{defaultMessage:"Mention a page or date…",id:"mentionMenu.pageDate.prompt2"},mentionPerson:{defaultMessage:"Mention a person…",id:"mentionMenu.person.prompt2"},mentionDate:{defaultMessage:"Mention a date…",id:"mentionMenu.date.prompt2"},mentionPage:{defaultMessage:"Type to link or add page…",id:"mentionMenu.page.prompt2"},addPage:{defaultMessage:"Type to add or link page…",id:"mentionMenu.addPage.prompt2"}}),ks=(0,Te.defineMessages)({autocompleteToday:{defaultMessage:"Today",id:"mentionMenu.date.autocomplete.today"},autocompleteNextTuesday:{defaultMessage:"Next Tuesday 3pm",id:"mentionMenu.date.autocomplete.nextTuesday"},autocompleteReminder:{defaultMessage:"Remind tomorrow 9am",id:"mentionMenu.date.autocomplete.reminder"},reminder:{defaultMessage:"Remind {dateTime}",id:"mentionMenu.date.remindAtDateTime",description:"dateTime will be a message representing the date (with or without time) that the user wants to be reminded at, like 'Tomorrow 3pm' or 'Mar 1, 2020'"},noResults:{defaultMessage:"No results",id:"mentionMenu.noSearchResults.title",description:"A label describing that no results have been found."}});class As extends u.Z{constructor(...e){super(...e),d()(this,"storeTypes",{ignoreSelectionAreaStore:cs.Z,localPageMentionRequestStore:bs.Z,localCachePageMentionRequestStore:bs.Z}),d()(this,"renderMentionResult",((e,t)=>{const{intl:i}=this.props,s=is.Z.state,o=s.open&&s.insertionType,r={sections:[],nextSectionShouldHaveTopBorder:()=>r.sections.length>0,addSection(e){e&&this.sections.push(e)}};"+"===o&&r.addSection(this.getCreatePageMenuSection(r.nextSectionShouldHaveTopBorder())),r.addSection(this.getDateResultsMenuSection(t,r.nextSectionShouldHaveTopBorder())),r.addSection(this.getUserResultsMenuSection(t,r.nextSectionShouldHaveTopBorder())),r.addSection(this.getPageResultsMenuSection(t,r.nextSectionShouldHaveTopBorder())),("@"===o&&this.filterStore.state||"[["===o)&&r.addSection(this.getCreatePageMenuSection(r.nextSectionShouldHaveTopBorder()));const{sections:l}=r;let d,c;if(es.Z.state.online){const e=s.mentionTypes.user,t=s.mentionTypes.page,a=s.mentionTypes.date;let o="";const n=ws;e&&t&&a?o=i.formatMessage(n.mentionAll):e&&t?o=i.formatMessage(n.mentionPersonPage):e&&a?o=i.formatMessage(n.mentionPersonDate):t&&a?o=i.formatMessage(n.mentionPageDate):e?o=i.formatMessage(n.mentionPerson):a?o=i.formatMessage(n.mentionDate):t&&s&&(o=s.open&&"+"===s.insertionType?i.formatMessage(ws.addPage):i.formatMessage(n.mentionPage)),this.setTemporaryInputData({title:o,icon:this.renderTemporaryInputEmptyIcon(),allowTabCompletion:!1}),d=void 0}else d=a()(Ki.Z,{title:a()(Te.FormattedMessage,{defaultMessage:"Please go online to mention a person or page.",id:"mentionMenu.offlineMessage"})});0===l.length&&(c=a()(Re.Z,{},void 0,a()(Ki.Z,{title:n().createElement(Te.FormattedMessage,ks.noResults)})));const{device:u}=this.environment;let m;return m=this.isActionSheet()?{menuType:_e.ZP.MenuType.ActionSheet,disableBottomPadding:!0,height:"calc(70vh - ".concat(Zs.Z.estimatedKeyboardWebViewOverlap(),"px)")}:{menuType:_e.ZP.MenuType.Popup,width:this.getMenuDesktopWidth(),maxHeight:u.isMobile?"30vh":"40vh",onClickOutside:zi.xv},n().createElement(_e.ZP,it()({},m,{header:d}),a()(Le.Z,{capture:is.Z.state.open,onBackspace:this.shouldCaptureBackspace()?this.handleEmptyBackspace:void 0,onTab:this.handleTab}),a()(Hi.Z,{type:Hi.Z.Type.Vertical,initialFocus:this.getMenuInitialFocus(),sections:l,onEmptyEnter:this.handleCancel}),c)})),d()(this,"handleCreateInAutocompleteQueryChange",(e=>{this.updateOpenState({createInQuery:e})})),d()(this,"renderCreateInMenu",(()=>{const e=is.Z.state;if(!e.open)return;const t="block"===e.textStore.table?e.textStore.id:void 0;return a()(Yi.Z,{targets:[],isAddTo:!0,isCreateIn:!0,onAccept:e=>{zi.Br({environment:this.environment,titleText:this.getNormalizedFilter(),ignoreSelectionAreaStore:this.stores.ignoreSelectionAreaStore,createInValue:e})},captureSelection:!0,restoreSelection:!0,parentBlockId:t,onAutocompleteQueryChange:this.handleCreateInAutocompleteQueryChange,ignoreSelectionAreaStore:this.stores.ignoreSelectionAreaStore,autocompleteQuery:e.createInQuery,desktopWidth:this.getMenuDesktopWidth(),onCancel:this.handleCreateInCancel})})),d()(this,"handleCreateInStart",(()=>{this.updateOpenState({showCreateIn:!0})})),d()(this,"handleCreateInCancel",(()=>{this.updateOpenState({showCreateIn:!1,createInQuery:""})})),d()(this,"handleEmptyBackspace",(e=>{this.shouldCaptureBackspace()&&e.preventDefault(),this.handleCancel()})),d()(this,"handleCancel",(()=>{zi.xv()})),d()(this,"handleTab",(e=>{e.preventDefault();const t=this.tabCompletionString;if(!t)return;const i=as.default.state;if("editing"!==i.mode)return;const s=(0,Cs.QY)(i.multiSelection);if(!s)return;const a=is.Z.state;a.open&&a.textStore===s.store&&si.createAndCommit(this.environment,(e=>{ds.hJ({environment:this.environment,transaction:e,string:t,store:s.store,selection:s.selection,disableMentions:!0,disableDateMentions:!0,disableEmojiCommands:!0,disableSlashCommands:!0})}))})),d()(this,"tabCompletionString",void 0),d()(this,"letterCharacterClass",(()=>{try{return/\p{L}/u}catch(e){return/[a-zA-Z]/}})()),d()(this,"inputSelectionsStore",this.createComputedStore((()=>{const e=is.Z.state;if(e.open)return Qi.O2(e.textStore,e.oldTextValue,e.insertionType)}))),d()(this,"filterStore",this.createComputedStore((()=>{const e=this.inputSelectionsStore.state,t=is.Z.state;if(e&&t.open)return Qi.ug(t.textStore,e)}))),d()(this,"popupOpenStore",this.createComputedStore((()=>{const e=is.Z.state;return!!e.open&&("+"!==e.insertionType||""!==this.getNormalizedFilter())}))),d()(this,"performUserMentionRequest",(async e=>{const t=is.Z.state;if(!t.open)return;const i=t.mentionTypes.user?await this.getUserResults(e):[];return""===e?i.slice(0,2):i.slice(0,20)})),d()(this,"performLocalCachePageMentionRequest",(async()=>{const{currentSpaceStore:e,currentSpaceViewStore:t}=se.default.state;if(!e)return;return ss.hb({environment:this.environment,currentSpaceStore:e,currentSpaceViewStore:t})})),d()(this,"performLocalPageMentionRequest",(e=>{const{localCachePageMentionRequestStore:t}=this.stores,i=t.state.result;if(!i)return;const s=ss.tz({input:e,cache:i});if(!s)return;if(0===s.results.length)return{error:Ms.Ix.NoResults};const a=E.RM();if(!a)return;const o=ss.YB({sort:e.query.sort,unsorted:s.results,batchSize:Ss.Xv,currentUserId:this.environment.currentUser.id}).results.map((e=>({...e,store:b.Z.createChildStore(a,{table:T.iU,id:e.id})})));return{value:{total:o.length,results:o}}})),d()(this,"performPageMentionRequest",(async e=>{const t=is.Z.state;if(!t.open)return[];const i=t.mentionTypes.page?await this.getPageResults(e):[];return""===e?i.slice(0,2):i.slice(0,20)})),d()(this,"getUserResults",(async e=>{if(es.Z.state.online){return await Wt.O$({environment:this.environment,query:e,membersOnly:!1})}return[]})),d()(this,"getPageResults",(async e=>{if(!es.Z.state.online)return[];const t=is.Z.state,i=t.open&&(0,Ce.NZ)(t.textStore)&&t.textStore;return await Wt.WL({nearBlock:i||void 0,environment:this.environment,query:e,source:"mention_menu",limit:20})})),d()(this,"getDateResults",(e=>{const t=is.Z.state;if(!t.open)return[];const{intl:i}=this.props,s=t.mentionTypes.reminder;return t.mentionTypes.date?function(e,t,i){if(0===e.length)return f().compact([{label:i.formatMessage(ks.autocompleteToday),value:()=>ve.Lg(ve.x7)},t?void 0:{label:i.formatMessage(ks.autocompleteNextTuesday),value:()=>{const e=ve.bU(ve.x7),t=e.clone().day(2);return t.isSameOrBefore(e)&&t.add(1,"week"),t.add(1,"week"),t.hour(15),{type:"datetime",start_date:t.format(ve.Q1),start_time:t.format(ve.jK),time_zone:ve.x7}}},t?{label:i.formatMessage(ks.autocompleteReminder),value:()=>({type:"datetime",start_date:ve.Ro(ve.x7).start_date,start_time:"09:00",reminder:{unit:"day",value:0,time:ve.HZ},time_zone:ve.x7})}:void 0]);const s=t?(0,Xi.St)(e,i):(0,Xi.cg)(e,i);if(s){let e=(0,$i.ZV)({value:s,date_format:"relative",userTimeZone:ve.x7,intl:i,allowRelativeDates:!0});return s.reminder&&(e=i.formatMessage(ks.reminder,{dateTime:e})),[{label:e,value:()=>s}]}return[]}(e,s,i).slice(0,6):[]})),d()(this,"getTemplateVariableResults",(e=>{const t=is.Z.state;if(!t.open)return[];if(!t.mentionTypes.templateVariable)return[];const{intl:i}=this.props;return Ji.XV(e,i)}))}willMountOrUpdate(){const e=is.Z.state,t=this.filterStore.state;if(e.open){var i;const s=as.default.state,a="editing"===s.mode?(0,Cs.QY)(s.multiSelection):void 0,o=(null==a?void 0:a.store)===e.textStore,n=this.stores.ignoreSelectionAreaStore.state.savedTextSelectionStoreState,r=n&&"editing"===n.mode&&(null===(i=(0,Cs.QY)(n.multiSelection))||void 0===i?void 0:i.store)===e.textStore;if(!o&&!r)return void zi.xv();const l=o&&(null==a?void 0:a.selection),d=this.inputSelectionsStore.state;if(d&&l&&(l.startIndex<d.filter.startIndex||l.endIndex>d.filter.endIndex))return void zi.xv();const c=this.filterStore.state&&this.filterStore.state[0];if("+"===e.insertionType&&c&&!c.match(this.letterCharacterClass))return void zi.xv();if(void 0===t)return void zi.xv()}}renderComponent(){const{device:e}=this.environment,t=is.Z.state,i=ts.Z.find((e=>e.props.capture)),s=this.popupOpenStore.state;let o;if(i&&e.isMobile){const e=i.stores.store.state.rect;e&&(o={height:"calc(100vh - ".concat(e.height,"px)")})}const r=t.open&&t.showCreateIn;return a()(Be.ZP,{popupType:this.isActionSheet()?Be.ZP.PopupType.SlideUp:Be.ZP.PopupType.Popup,open:s,originRect:t.open?t.selectionRect:void 0,slideUpWrapStyle:o,placementToOrigin:Be.ZP.Placement.Bottom,alignmentToOrigin:Be.ZP.Alignment.Start,originGap:8,disableMouseCapture:!0,disableContentScroll:!0,onDismiss:this.handleCancel,disableDarkOverlayBackground:e.isMobile,keepFocus:!0,render:()=>e.isMobile?n().createElement(n().Fragment,null,this.renderMentionSearch(),a()(Be.ZP,{popupType:Be.ZP.PopupType.SlideUp,render:this.renderCreateInMenu,open:r,keepFocus:!0})):r?this.renderCreateInMenu():this.renderMentionSearch()})}renderMentionSearch(){const e=this.getNormalizedFilter(),t=is.Z.state,i=Ts.default.createMetric("rum.mention_menu_ready");return a()(Vt.Z,{requestStore:t.userRequestStore,request:e,performRequest:this.performUserMentionRequest,render:s=>a()(Vt.Z,{requestStore:t.pageRequestStore,request:e,performRequest:this.performPageMentionRequest,debounce:Wt.vp,render:t=>a()(Vt.Z,{requestStore:this.stores.localCachePageMentionRequestStore,request:se.default.state.currentSpaceStore&&se.default.state.currentSpaceStore.id,performRequest:this.performLocalCachePageMentionRequest,render:o=>a()(Vt.Z,{requestStore:this.stores.localPageMentionRequestStore,debounce:Wt.E5,request:{query:{text:e,filters:Ms.u4({isDeletedOnly:!1,isNavigableOnly:!0,excludeTemplates:!0,requireEditPermissions:void 0}),sort:Ms.As.Relevance},limit:5},performRequest:(...e)=>Promise.resolve(this.performLocalPageMentionRequest(...e)),render:e=>this.renderMentionResult(s||t||e,this.getCurrentMentionResults(i))})})})})}getDateResultsMenuSection(e,t){const{dateResults:i}=e,{intl:s}=this.props,o=this.getTemplateVariableMenuItems(e,"date");if(0===i.length&&0===o.length)return;const r=i.map((({label:e,value:t})=>({key:e,render:i=>{if(i.focused&&this.setTemporaryInputData({title:e,icon:this.renderTemporaryInputAtMentionIcon(),allowTabCompletion:!0}),(0,Xi.UL)(e,s)){const a=(0,$i.ZV)({value:t(),userTimeZone:ve.x7,intl:s,allowRelativeDates:!1});return n().createElement(qt.Z,it()({},i,{title:e,caption:a,inline:!0}))}return n().createElement(qt.Z,it()({},i,{title:e}))},action:()=>{si.createAndCommit(this.environment,(e=>{zi.RL({environment:this.environment,annotation:["d",{...t(),date_format:"relative"}],transaction:e})}))}})));return this.applySectionLimit("date",{key:"date results",render:e=>n().createElement(Re.Z,it()({},e,{title:a()(Te.FormattedMessage,{defaultMessage:"Date",id:"mentionMenu.dateSection.title"}),topBorder:t,isTitleUppercase:!0})),items:o.concat(r)})}getTemplateVariableMenuItems(e,t){const{templateVariableResults:i}=e,{intl:s}=this.props;return i.filter((e=>Ji.i6(e,t))).map((e=>({key:e,render:t=>{const i=Ji.U$(e,s),a=Ji.Z0(e,s);return t.focused&&this.setTemporaryInputData({title:i,icon:this.renderTemporaryInputAtMentionIcon(),allowTabCompletion:!0}),n().createElement(qt.Z,it()({},t,{title:i,caption:a,inline:!0}))},action:()=>{si.createAndCommit(this.environment,(t=>{zi.RL({environment:this.environment,annotation:["tv",{type:e}],transaction:t})}))}})))}renderSpinner(e){return a()(ji.Z,{show:e,showDelay:500,showHold:300,render:e=>a()(zt.Z,{style:{textAlign:"center",visibility:e?"visible":"hidden",display:"inline",marginLeft:8}})})}renderTemporaryInputEmptyIcon(){const e=is.Z.state;if(e.open)return"+"===e.insertionType?this.renderTemporaryInputAddIcon():a()("span",{style:{width:"1em",display:"inline-block",verticalAlign:"-0.15em",fill:this.theme.mediumIconColor,marginRight:"0.2em"}},void 0,Bt.Z.searchThick())}renderTemporaryInputAddIcon(){return a()("span",{style:{width:"1em",display:"inline-block",verticalAlign:"-0.15em",fill:this.theme.mediumIconColor,marginRight:"0.2em"}},void 0,Bt.Z.plus())}renderTemporaryInputPageIcon(e){return(0,ns.tp)({pageValue:e.getValue(),pageRole:e.getRole(),showEmojiInline:!0,emojiType:(0,rs.e)(this.environment),baseUrl:pe.default.domainBaseUrl,getRecordValue:e.getRecordValue,isClient:!0,isSafariOrIOS:this.environment.device.isSafari||this.environment.device.isIOS,currentUserId:this.environment.currentUser.id,deeperDarkEnabled:(0,gi.GN)(),theme:this.theme.mode})}renderTemporaryInputAtMentionIcon(){return a()("span",{style:{width:"1em",display:"inline-block",verticalAlign:"-0.15em",fill:this.theme.mediumIconColor,marginRight:"0.2em"}},void 0,Bt.Z.at())}getUserResultsMenuSection(e,t){const{userResults:i}=e,s=this.getTemplateVariableMenuItems(e,"user");if(0===i.length&&0===s.length)return;const o=f().compact(i.map((e=>({key:e.id,render:t=>(t.focused&&this.setTemporaryInputData({title:(0,os.Nz)(this.props.intl,e),icon:this.renderTemporaryInputAtMentionIcon(),allowTabCompletion:!0}),n().createElement(qi.Z,it()({},t,{user:e}))),action:()=>{si.createAndCommit(this.environment,(t=>{zi.RL({environment:this.environment,annotation:(0,Ji.tE)(e.id),transaction:t})}))}}))));return this.applySectionLimit("user",{key:"user results",render:e=>n().createElement(Re.Z,it()({},e,{title:a()(Te.FormattedMessage,{defaultMessage:"People",id:"mentionMenu.peopleSection.title"}),topBorder:t,isTitleUppercase:!0})),items:s.concat(o)})}getPageResultsMenuSection(e,t){const{pageResults:i}=e,s=n().createElement(n().Fragment,null,0===i.length?n().createElement(Te.FormattedMessage,ks.noResults):a()(Te.FormattedMessage,{defaultMessage:"Link to page",id:"mentionMenu.pagesSection.title2"}),this.renderSpinner(is.Z.state.pageRequestStore.state.loading));return this.applySectionLimit("page",{key:"page results",render:e=>n().createElement(Re.Z,it()({},e,{title:s,topBorder:t,isTitleUppercase:!0})),items:f().compact(i.map((e=>{const t=E.RM();if(!t)return;const i=b.Z.createChildStore(t,{table:T.iU,id:e});return{key:e,render:e=>{if(e.focused){const e=i.getValue();if(e){const t=(0,O.T5)({table:i.table,value:e,getRecordValue:i.getRecordValue,userTimeZone:ve.x7,intl:this.props.intl,newViewsEnabled:(0,gi.is)(this.environment)});this.setTemporaryInputData({title:t||"",icon:this.renderTemporaryInputPageIcon(i),allowTabCompletion:!0})}}return n().createElement(Gi.Z,it()({},e,{store:i}))},action:()=>{si.createAndCommit(this.environment,(t=>{zi.RL({environment:this.environment,annotation:["p",e],transaction:t})}))}}})))})}getCreatePageMenuSection(e){if(!this.canCreatePage())return;const t=is.Z.state;if(!t.open)return;const{intl:i}=this.props,s=this.getNormalizedFilter(),o="@"===t.insertionType?a()(Te.FormattedMessage,{id:"mentionMenu.createPageSection.title",defaultMessage:"New page"}):void 0;return{key:"create page",render:t=>n().createElement(Re.Z,it()({title:o,isTitleUppercase:!0},t,{topBorder:e})),items:[{key:"add new subpage",action:async()=>{const e=(0,ls.gt)(t.textStore);e&&await zi.Br({environment:this.environment,ignoreSelectionAreaStore:this.stores.ignoreSelectionAreaStore,titleText:this.getNormalizedFilter(),createInValue:e.createInValue,onPageCreated:e=>{e&&""===Ji.Q(e.getTitleValue())&&ge.navigateToBlock({environment:this.environment,store:e})}})},render:e=>{e.focused&&this.setTemporaryInputData({title:0===s.length?i.formatMessage(ws.addPage):"",icon:this.renderTemporaryInputAddIcon(),allowTabCompletion:!1});const t=t=>n().createElement(qt.Z,it()({},(0,ys.Z)(t||{},e),{icon:Bt.Z.plus({width:16}),title:a()(hs,{pageTitle:this.getNormalizedFilter()})}));return this.environment.device.isMobile?t():a()(kt.Z,{renderTooltip:()=>a()(fs.Z,{imageURL:vs.Z.images.tooltips.pageMenu.newSubpagePng,imageWidth:140,imageHeight:100,caption:n().createElement(Te.FormattedMessage,Yi.s.createSubpage)}),placement:kt.Z.Placement.Right,delayThreshold:0,render:e=>t(e)})}},{key:"open create in menu",action:this.handleCreateInStart,render:e=>{e.focused&&this.setTemporaryInputData({title:0===s.length?i.formatMessage(ws.addPage):"",icon:this.renderTemporaryInputAddIcon(),allowTabCompletion:!1});const t=a()(gs,{pageTitle:this.getNormalizedFilter()}),o=i=>n().createElement(qt.Z,it()({},(0,ys.Z)(i||{},e),{icon:Bt.Z.alias({width:16}),title:t}));return this.environment.device.isMobile?o():a()(kt.Z,{renderTooltip:()=>a()(fs.Z,{imageURL:vs.Z.images.tooltips.pageMenu.newPageInPng,imageWidth:140,imageHeight:100,caption:n().createElement(Te.FormattedMessage,Yi.s.newPageIn)}),placement:kt.Z.Placement.Right,delayThreshold:0,render:e=>o(e)})}}]}}applySectionLimit(e,t){const i=is.Z.state;if(!i.open)return t;if(i.expandSection&&i.expandSection===e)return t;const{items:s}=t,o=this.environment.device.isPhone?3:5;if(s.length<=o)return t;const r=[...s.slice(0,o),{key:"show more",render:e=>n().createElement(qt.Z,it()({},e,{icon:Bt.Z.dots({width:16,fill:this.theme.mediumTextColor}),title:a()("span",{style:{color:this.theme.mediumTextColor}},void 0,a()(Te.FormattedMessage,{defaultMessage:"{numberMore} more results",id:"mentionMenu.showMoreResultsButton.title",values:{numberMore:s.length-o}}))})),action:()=>{this.updateOpenState({expandSection:e})}}];return{...t,items:r}}updateOpenState(e){const t=is.Z.state;t.open&&is.Z.setState({...t,...e})}getNormalizedFilter(){const e=this.filterStore.state;return e?is.Z.state.open&&"[["===is.Z.state.insertionType&&e.endsWith("]]")?e.slice(0,-2).trim():e.trim():""}setTemporaryInputData(e){const t=is.Z.state;if(!t.open)return;if(!e)return void t.temporaryInputData.set(void 0);const{device:i}=this.environment,{title:s,icon:a,allowTabCompletion:o}=e,n=this.filterStore.state||"",r=s.toLowerCase().startsWith(n)?s.slice(n.length):"";this.tabCompletionString=o?r:void 0;const l=i.isFirefox?void 0:a;t.temporaryInputData.set({prefix:t.insertionType,suffix:"[["===t.insertionType&&n.endsWith("]]")?"]]":"",completion:r,prefixIcon:l})}getCurrentMentionResults(e){const t=is.Z.state,i=t.userRequestStore.state.result||[],s=t.pageRequestStore.state.result||[],a=this.getDateResults(this.getNormalizedFilter()),o=this.getTemplateVariableResults(this.getNormalizedFilter());let n=s;const{result:r}=this.stores.localPageMentionRequestStore.state;if(r&&!r.error){const e=r.value.results,t=E.RM();n=t?ss.oO({environment:this.environment,isOnline:es.Z.state.online,results:{local:e,server:s.map((e=>({...e,store:b.Z.createChildStore(t,{table:T.iU,id:e.id})})))}})||[]:e}const l=t.userRequestStore.state.ready&&t.pageRequestStore.state.ready;return l&&Ts.default.emit(this.environment,e),{userResults:i,pageResults:n.map((e=>e.id)),dateResults:a,templateVariableResults:o,ready:l}}canCreatePage(){return!!is.Z.state.mentionTypes.createPage}isActionSheet(){const{device:e}=this.environment;return e.isMobileNative&&!e.isTablet}shouldCaptureBackspace(){return""===this.filterStore.state}getMenuInitialFocus(){if(""!==this.getNormalizedFilter())return 0}getMenuDesktopWidth(){return(0,ms.bq)()?400:330}}const Ps=(0,Te.injectIntl)(As);var Is=i(84084),xs=i(68204),Fs=i(2297),Bs=i(10743),Es=i(74350);class Rs extends u.Z{constructor(...e){super(...e),d()(this,"renderMenu",(()=>{const{device:e}=this.environment,t=Bs.Z.state;if(!t.open)return;const i=this.getSections(t),s=this.getFilter(t);let o;return o=e.isMobileNative&&!e.isTablet?{menuType:_e.ZP.MenuType.ActionSheet}:{menuType:_e.ZP.MenuType.Popup,width:this.getWidth(),maxHeight:"40vh",onClickOutside:Is.xv},n().createElement(_e.ZP,o,a()(Fe.Z,{sections:i,onAccept:this.handleAccept,context:{environment:this.environment,blocks:Z.default.state.stores,originRect:t.selectionRect,publicEditMode:void 0},filter:s,initialFocus:0,onEmptyEnter:this.handleCancel,useLimit:!0}))})),d()(this,"handleCancel",(()=>{Is.xv()})),d()(this,"handleAccept",(e=>{const t=Z.default.state.stores[0];t&&Ee.dhV(this.environment,{analyticsName:e.analyticsName,from:"slash_menu",block_type:t.getType()}),si.createAndCommit(this.environment,(e=>{Is.RL({environment:this.environment,transaction:e})}))}))}willMountOrUpdate(){const e=Bs.Z.state;if(e.open){const t=as.default.state;if("editing"!==t.mode)return!1;const i=this.getFilter(e),s=(0,xs.sG)({sections:this.getSections(e),context:{blocks:Z.default.state.stores,environment:this.environment,publicEditMode:void 0},query:i||""}),{multiSelection:a}=t;(0,Cs.qS)(a)&&a.start.store===e.textStore&&!Qi.Ye(i,!0,s.length)||Is.xv()}}renderComponent(){const{device:e}=this.environment,t=Bs.Z.state;return a()(Be.ZP,{popupType:e.isMobileNative&&!e.isTablet?Be.ZP.PopupType.SlideUp:Be.ZP.PopupType.Popup,open:t.open,originRect:t.open?t.selectionRect:void 0,placementToOrigin:Be.ZP.Placement.Bottom,alignmentToOrigin:Be.ZP.Alignment.Start,originGap:4,disableMouseCapture:!0,disableContentScroll:!0,preventBlockRenderQueueOnEnter:!0,onDismiss:this.handleCancel,render:this.renderMenu})}getFilter(e){return Qi.zK(e.textStore,e.oldTextValue,!e.isAddMenu)}getSections(e){return e.isAddMenu?Fs.kR:Fs.CR}getWidth(){return"fr-FR"===Es.SP?375:324}}const Ds=Rs;var _s=i(89951),Ls=i(59043),Os=i(41432),Us=i(63143),Ns=i(64233),Vs=i(74335);const Ws=(0,Te.defineMessages)({image:{defaultMessage:"Embed image",id:"embedMenu.action.image"},video:{defaultMessage:"Embed video",id:"embedMenu.action.video"},tweet:{defaultMessage:"Embed Tweet",id:"embedMenu.action.tweet"},drive:{defaultMessage:"Embed Google Drive",id:"embedMenu.action.drive"},gist:{defaultMessage:"Embed GitHub Gist",id:"embedMenu.action.gist"},figma:{defaultMessage:"Embed Figma",id:"embedMenu.action.figma"},invision:{defaultMessage:"Embed Invision project",id:"embedMenu.action.invision"},abstract:{defaultMessage:"Embed Abstract project",id:"embedMenu.action.abstract"},framer:{defaultMessage:"Embed Framer prototype",id:"embedMenu.action.framer"},whimsical:{defaultMessage:"Embed Whimsical board",id:"embedMenu.action.whimsical"},sketch:{defaultMessage:"Embed Sketch document",id:"embedMenu.action.sketch"},excalidraw:{defaultMessage:"Embed excalidraw",id:"embedMenu.action.excalidraw"},replit:{defaultMessage:"Embed a repl",id:"embedMenu.action.replit"},miro:{defaultMessage:"Embed Miro board",id:"embedMenu.action.miro"},audio:{defaultMessage:"Embed audio",id:"embedMenu.action.audio"},maps:{defaultMessage:"Embed Google Map",id:"embedMenu.action.maps"},loom:{defaultMessage:"Embed Loom",id:"embedMenu.action.loom"},typeform:{defaultMessage:"Embed Typeform",id:"embedMenu.action.typeform"},codepen:{defaultMessage:"Embed CodePen",id:"embedMenu.action.codepen"},pdf:{defaultMessage:"Embed PDF",id:"embedMenu.action.pdf"},embed:{defaultMessage:"Create embed",id:"embedMenu.action.createEmbed"},hex:{defaultMessage:"Embed Hex",id:"embedMenu.action.hex"},deepnote:{defaultMessage:"Embed Deepnote",id:"embedMenu.action.deepnote"}}),zs=(0,Te.defineMessages)({linkToPage:{defaultMessage:"Link to page",id:"embedMenu.actions.linkToPage.title"},mentionPage:{defaultMessage:"Mention page",id:"embedMenu.actions.mentionPage.title"},createLinkedDatabase:{defaultMessage:"Create linked database",id:"embedMenu.actions.createLinkedDatabase.title"},createLinkedViewOfDatabase:{defaultMessage:"Create linked view of database",id:"embedMenu.actions.createLinkedViewOfDatabase.title"},bookmarkMenuItem:{defaultMessage:"Create bookmark",id:"embedMenu.actions.createBookmark.title"},createTransclusionItem:{defaultMessage:"Paste and sync",id:"embedMenu.actions.createTransclusion.title"},dismissItem:{defaultMessage:"Dismiss",id:"embedMenu.actions.dismiss.title"}}),Hs={image:jt.default.formatMessage(Ws.image),video:jt.default.formatMessage(Ws.video),tweet:jt.default.formatMessage(Ws.tweet),drive:jt.default.formatMessage(Ws.drive),gist:jt.default.formatMessage(Ws.gist),figma:jt.default.formatMessage(Ws.figma),invision:jt.default.formatMessage(Ws.invision),abstract:jt.default.formatMessage(Ws.abstract),framer:jt.default.formatMessage(Ws.framer),whimsical:jt.default.formatMessage(Ws.whimsical),miro:jt.default.formatMessage(Ws.miro),sketch:jt.default.formatMessage(Ws.sketch),excalidraw:jt.default.formatMessage(Ws.excalidraw),replit:jt.default.formatMessage(Ws.replit),audio:jt.default.formatMessage(Ws.audio),maps:jt.default.formatMessage(Ws.maps),loom:jt.default.formatMessage(Ws.loom),typeform:jt.default.formatMessage(Ws.typeform),codepen:jt.default.formatMessage(Ws.codepen),pdf:jt.default.formatMessage(Ws.pdf),embed:jt.default.formatMessage(Ws.embed),hex:jt.default.formatMessage(Ws.hex),deepnote:jt.default.formatMessage(Ws.deepnote)};class qs extends u.Z{constructor(...e){super(...e),d()(this,"renderMenu",(()=>{const{device:e}=this.environment,t=Ns.Z.state;if(!t.open)return;const i=this.getSections(t);let s;return s=e.isMobile?{menuType:_e.ZP.MenuType.ActionSheet}:{menuType:_e.ZP.MenuType.Popup,width:320,maxHeight:"40vh"},n().createElement(_e.ZP,it()({},s,{className:Kt.sr}),a()(Hi.Z,{type:Hi.Z.Type.Vertical,sections:i,initialFocus:0}))})),d()(this,"handleDismiss",(()=>{_s.xv()})),d()(this,"handleAccept",(e=>{_s.RL({environment:this.environment,type:e})}))}willMountOrUpdate(){const e=Ns.Z.state;if(e.open){const t=as.default.state;if("editing"===t.mode){const{multiSelection:i}=t;(0,Cs.qS)(i)&&i.start.store.id===e.textStore.id&&i.end.index===e.urlSelection.endIndex||_s.xv()}}}renderComponent(){const{device:e}=this.environment,t=Ns.Z.state;return a()(Be.ZP,{popupType:e.isMobileNative&&!e.isTablet?Be.ZP.PopupType.SlideUp:Be.ZP.PopupType.Popup,open:t.open,originRect:t.open?t.selectionRect:void 0,placementToOrigin:Be.ZP.Placement.Bottom,alignmentToOrigin:Be.ZP.Alignment.Start,originGap:4,disableMouseCapture:!0,disableContentScroll:!0,disableDarkOverlayBackground:e.isMobile,keepFocus:e.isMobile,render:this.renderMenu,onDismiss:this.handleDismiss})}getSections(e){const{device:t}=this.environment,{url:i,textStore:s}=e,a=[],o=(0,Vs.Wj)({url:i,baseUrl:pe.default.domainBaseUrl,publicDomainName:pe.default.publicDomainName,isMobile:t.isMobile,protocol:pe.default.protocol,currentUrl:window.location.href});if("page"===o.name){const e=b.Z.createChildStore(s,{table:T.iU,id:o.blockId}),t=o.scrollToBlockId?b.Z.createChildStore(s,{table:T.iU,id:o.scrollToBlockId}):void 0;a.push({name:jt.default.formatMessage((0,gi.is)(this.environment)?zs.createLinkedViewOfDatabase:zs.createLinkedDatabase),validator:()=>!t&&e.isCollectionView(),type:Os.ZP.collectionView}),a.push({name:jt.default.formatMessage(zs.createTransclusionItem),validator:()=>Boolean(t&&!t.isNavigableBlock()),type:"create-transclusion"}),a.push({name:jt.default.formatMessage(zs.mentionPage),validator:()=>!t,type:"mention-page"}),a.push({name:jt.default.formatMessage(zs.linkToPage),validator:()=>!t&&!e.isCollectionView(),type:Os.ZP.page})}const r=Us.XP(Hs);for(const n of r)"embed"!==n&&a.push({name:Hs[n],validator:Ls.Wb[n],type:n});a.push({name:jt.default.formatMessage(zs.bookmarkMenuItem),validator:Ls.Cm,type:Os.ZP.bookmark}),a.push({name:Hs.embed,validator:Ls.Wb.embed,type:"embed"});return[{key:"embed section",render:e=>n().createElement(Re.Z,e),items:[{key:"dismiss",render:e=>n().createElement(qt.Z,it()({},e,{title:jt.default.formatMessage(zs.dismissItem)})),action:this.handleDismiss},...f().compact(a.map((({name:e,validator:t,type:s})=>{if(t({url:i,baseUrl:pe.default.domainBaseUrl,publicDomainName:pe.default.publicDomainName})){return{key:"embed ".concat(e),render:t=>n().createElement(qt.Z,it()({},t,{title:e})),action:()=>this.handleAccept(s)}}})))]}]}}const Gs=qs;var Ks=i(89314),js=i(6389),Ys=i(97880);class Qs extends u.Z{constructor(...e){super(...e),d()(this,"menuRef",(0,o.createRef)()),d()(this,"renderMenu",(()=>{const{device:e}=this.environment,t=js.Z.state;if(!t.open)return;const{allOptionTypes:i}=t,s={key:"embed section",render:e=>n().createElement(Re.Z,e),items:i.map((e=>({key:e,render:t=>a()(kt.Z,{placement:kt.Z.Placement.Right,alignment:kt.Z.Alignment.Center,render:i=>n().createElement(qt.Z,it()({},t,i,{title:this.renderTitleForOptionType(e)})),renderTooltip:()=>this.renderTooltipForOptionType(e),delayThreshold:0}),action:()=>this.handleDismiss(e)})))};let o;return o=e.isMobile?{menuType:_e.ZP.MenuType.ActionSheet}:{menuType:_e.ZP.MenuType.Popup,width:320,maxHeight:"40vh"},n().createElement(_e.ZP,it()({},o,{className:Kt.b_,ref:this.menuRef}),a()(Hi.Z,{type:Hi.Z.Type.Vertical,sections:[s],initialFocus:0,onKeyboardArrow:this.handleMenuListKeyboardArrow,priority:1}))})),d()(this,"handleDefaultDismiss",(()=>{this.handleDismiss(void 0)})),d()(this,"handleDismiss",(e=>{(0,si.createAndCommit)(this.environment,(t=>{Ks.xv({environment:this.environment,setType:e,transaction:t})}))})),d()(this,"handleMenuListKeyboardArrow",(e=>{const t=js.Z.state;if(!t.open||void 0===e.indexGlobal)return;const i=t.allOptionTypes[e.indexGlobal];i&&(0,si.createAndCommit)(this.environment,(e=>{Ks.hJ({environment:this.environment,type:i,useTemporaryRecordCache:!0,transaction:e,intl:this.props.intl})}))})),d()(this,"handleWindowKeydown",(e=>{js.Z.state.open&&"ArrowUp"!==e.key&&"ArrowDown"!==e.key&&"Enter"!==e.key&&this.handleDismiss(void 0)})),d()(this,"handleWindowMousedown",(e=>{const t=js.Z.state,i=this.menuRef.current;if(!t.open||!e.target||!i)return;const s=at().findDOMNode(i);s&&(s.contains(e.target)||this.handleDismiss(void 0))}))}willMount(){(0,S.l)(window,"keydown",this.handleWindowKeydown),(0,S.l)(window,"mousedown",this.handleWindowMousedown)}willUnmount(){(0,S.Z)(window,"keydown",this.handleWindowKeydown),(0,S.Z)(window,"mousedown",this.handleWindowMousedown)}renderComponent(){const{device:e}=this.environment,t=js.Z.state;return a()(Be.ZP,{popupType:e.isMobileNative&&!e.isTablet?Be.ZP.PopupType.SlideUp:Be.ZP.PopupType.Popup,open:Boolean(t.open&&t.renderRect),originRect:t.open?t.renderRect:void 0,placementToOrigin:Be.ZP.Placement.Top,alignmentToOrigin:Be.ZP.Alignment.Start,originGap:4,disableMouseCapture:!0,disableContentScroll:!0,disableDarkOverlayBackground:e.isMobile,keepFocus:e.isMobile,render:this.renderMenu,onDismiss:this.handleDefaultDismiss})}renderTitleForOptionType(e){return"preview"===e?a()(Te.FormattedMessage,{id:"unfurlingMenu.actions.pasteAsPreview.title",defaultMessage:"Paste as preview"}):"mention"===e?a()(Te.FormattedMessage,{id:"unfurlingMenu.actions.pasteAsMention.title",defaultMessage:"Paste as mention"}):"link"===e?a()(Te.FormattedMessage,{id:"unfurlingMenu.actions.pasteAsLink.title",defaultMessage:"Paste as link"}):"collection"===e?a()(Te.FormattedMessage,{id:"unfurlingMenu.actions.pasteAsDatabase.title",defaultMessage:"Paste as database"}):void(0,Ys.t1)(e)}renderTooltipForOptionType(e){return"preview"===e?a()(fs.Z,{imageURL:vs.Z.images.tooltips.linkPreviews.blockPng,imageWidth:240,imageHeight:90,caption:a()(Te.FormattedMessage,{id:"unfurlingMenu.optionTypeTooltip.preview",defaultMessage:"Preview link as a block."})}):"mention"===e?a()(fs.Z,{imageURL:vs.Z.images.tooltips.linkPreviews.inlinePng,imageWidth:300,imageHeight:50,caption:a()(Te.FormattedMessage,{id:"unfurlingMenu.optionTypeTooltip.mention",defaultMessage:"Preview link as an inline mention."})}):"link"===e?a()(fs.Z,{caption:a()(Te.FormattedMessage,{id:"unfurlingMenu.optionTypeTooltip.link",defaultMessage:"Paste as a regular link."})}):"collection"===e?a()(fs.Z,{caption:a()(Te.FormattedMessage,{id:"unfurlingMenu.optionTypeTooltip.database",defaultMessage:"Paste as a database."})}):void(0,Ys.t1)(e)}}const Js=(0,Te.injectIntl)(Qs);var Xs=i(80935),$s=i(40959),ea=i(46167),ta=i(40464),ia=i(73383),sa=i(32404),aa=i(13966),oa=i(31819),na=i(94610),ra=i(82945),la=i(70279),da=i(6287),ca=i(56863),ua=i(42057),ma=i(4548),pa=i(23178),ga=i(4935),ha=i(49557),fa=i(52016);class va extends fa.Z{getInitialState(){return{open:!1}}}const ya=new va;var Ma=i(64951),Sa=i(64131),ba=i(99757),Ta=i(66949),Ca=i(45162),Za=i(87078),wa=i(67067);class ka extends u.Z{constructor(...e){super(...e),d()(this,"mouseIsDownExternally",!1),d()(this,"lastRenderState",void 0),d()(this,"renderOverlay",(()=>{const{isActive:e}=ha.Z.state;return a()(rt.Z,{isVisible:e,enterAnimationStyle:{opacity:0},animationStyle:{opacity:1},exitAnimationStyle:{opacity:0},springConfig:{opacity:{stiffness:100,damping:10,precision:1e-4}},render:this.renderAnimated,onAnimationEnd:this.handleAnimationEnd})})),d()(this,"renderAnimated",(()=>{const{top:e,left:t}=ha.Z.state;return a()("div",{className:Kt.Qc,style:{pointerEvents:"none",position:"absolute",top:e,left:0,display:"flex",width:"100%"}},void 0,a()("div",{style:{flexShrink:1,width:Math.max(t-ka.leftOffset,0),minWidth:24}}),(0,ot.Z)((e=>n().createElement("div",it()({style:{pointerEvents:"none",padding:12}},e),this.lastRenderState&&this.renderMenu(this.lastRenderState)))),a()("div",{style:{flexGrow:1,flexShrink:1,minWidth:36}}))})),d()(this,"updateRichTextState",(()=>{const e=ha.Z.state;if(pa.Z.state.open||ga.Z.state.open)return;if(ba.n.state)return ca.w();const t=as.default.state;if("editing"!==t.mode)return ca.w();const i=(0,Ca.L5)(t.multiSelection);if(0===i.length)return ca.w();if(!i.every((({store:e})=>e.table===T.iU||e.table===la.x_||e.table===da.v)))return ca.w();if(!this.environment.currentUser.isLoggedIn()||!i.every((({store:e})=>e.canComment())))return;const s=Xs.get();if(E.JE())return ca.w();if(i.some((({editable:e})=>e.props.disableAnnotation)))return ca.w();if(i.some((({editable:e})=>e.props.disabled)))return ca.w();const a=i.map((({editable:e})=>e.getContextClosestSelectableStore()));if(a.some(((e,t)=>e&&i[t].store.table!==la.x_&&(e.isLocked()||e.isNavigableAncestorLocked()))))return ca.w();if(this.mouseIsDownExternally&&e.blockTarget!==a[0])return ca.w();const o=i.some((({store:e})=>{if(e.table!==T.iU)return!1;const t=e.getRecordStoreAtRootPath().getValue();return!!t&&ka.richTextMenuBlockTypesBlacklist[t.type]}));if(o)return ca.w();const n=s?Xs.getRect(s):void 0;if(n&&!wa.kK(n,(0,Za.Z)()))return ca.w();if(ci.Z.isActive()||Ma.Z.isActive()||Ta.Z.isOpen()||o||!s||!this.hasNonCollapsedTextSelection()||ya.state.open)return ca.w();let r=0,l=0;if(n){r=n.left;const e=25,t=n.top-ka.height-e,i=oa.Z.getTopbarHeight(this.environment),s=this.environment.WindowSizeStore.state.height-ka.height-e;l=Math.min(Math.max(t,i),s)}0===Math.abs(ha.Z.state.top-l)&&Math.abs(ha.Z.state.left-r)<10&&(l=ha.Z.state.top,r=ha.Z.state.left),ha.Z.setState({...ha.Z.state,isActive:!0,isAnimatingClosed:!1,top:l,left:r,blockTarget:Z.default.state.stores[0]})})),d()(this,"updateRichTextStateThrottled",f().throttle(this.updateRichTextState,200,{leading:!1})),d()(this,"handleAnimationEnd",(()=>{ha.Z.state.isActive||ha.Z.setState({...ha.Z.state,isAnimatingClosed:!1}),this.lastRenderState=this.renderStateStore.state})),d()(this,"renderStateStore",this.createComputedStore((()=>{const{isActive:e,blockTarget:t}=ha.Z.state,i=as.default.state;if(!e||"editing"!==i.mode)return;const{multiSelection:s}=i,a=(0,Cs.qS)(s),o=as.default.isEditingComment(),n=as.default.isEditingCaption(),r=t&&t.getParentTable()===da.v,l=this.pageContext&&this.pageContext.publicEditModeStore.state,d=(!l||"edit"===l)&&(s.start.store.canEdit()&&s.end.store.canEdit()),c=t&&t.getType(),u=c&&ka.richTextMenuActionsBlacklist[c],m={isSingleStoreSelection:a,showTurnInto:Boolean(a&&!o&&!r&&!n&&t&&d),showBold:Boolean(d),showItalic:Boolean(d),showStrikethrough:Boolean(d),showUnderline:Boolean(d),showCode:Boolean(d),showLink:Boolean(a&&d),showHighlight:Boolean(d&&!o),showDiscuss:Boolean(!o&&t&&!r),showEquation:Boolean(a&&d),showMention:Boolean(a&&!o&&t&&!r&&d),showActionButton:Boolean(a&&!o&&!n&&t&&!r),blockTarget:t,isComment:o};if(u&&u.size>0)for(const p of u)m[p]=!1;return m})))}didMount(){Z.default.addListener(this.updateRichTextStateThrottled),as.default.addListener(this.updateRichTextStateThrottled),dt.Z.addListener(this.updateRichTextState),ua.Z.addListener(this.updateRichTextState),ma.Z.addListener(this.updateRichTextState)}willUnmount(){as.default.removeListener(this.updateRichTextStateThrottled),Z.default.removeListener(this.updateRichTextStateThrottled),dt.Z.removeListener(this.updateRichTextState),ua.Z.removeListener(this.updateRichTextState),ma.Z.removeListener(this.updateRichTextState)}willMountOrUpdate(){const e=this.renderStateStore.state;e&&(this.lastRenderState=e)}renderComponent(){const{isActive:e,isAnimatingClosed:t}=ha.Z.state;return a()(Xe.Z,{open:e||t,render:this.renderOverlay})}renderMenu(e){const{isActive:t}=ha.Z.state;return a()("div",{style:{display:"inline-flex",alignItems:"stretch",height:ka.height,background:this.theme.popoverBackground,overflow:"hidden",fontSize:14,lineHeight:1.2,borderRadius:3,boxShadow:this.theme.mediumBoxShadow,pointerEvents:t?"auto":"none"},onMouseDown:e=>e.preventDefault()},void 0,e.showTurnInto&&e.blockTarget&&this.renderTurnInto(e.blockTarget),e.showLink&&this.renderLinkButton(!0),e.showDiscuss&&e.blockTarget&&this.renderCommentButton(e.blockTarget),a()("div",{style:{display:"flex"}},void 0,e.showBold&&this.renderBoldButton(),e.showItalic&&this.renderItalicButton(),e.showUnderline&&this.renderUnderlineButton(),e.showStrikethrough&&this.renderStrikethroughButton(),e.showCode&&this.renderCodeButton(),e.showEquation&&this.renderEquationButton()),e.showHighlight&&a()(Sa.Z,{style:this.getBorderRight()}),e.showMention&&this.renderMention(),e.showActionButton&&e.blockTarget&&this.renderActionButton(e.blockTarget))}renderTurnInto(e){let t=a()(Te.FormattedMessage,{defaultMessage:"Turn into",id:"richTextMenu.turnIntoButton.label"});const{intl:i}=this.props,s=e.getType();if(s){const e=$s.Hc[s];t=e&&e.displayName||t}return a()(ea.Z,{popupType:ea.Z.PopupType.Popup,buttonPopupStore:ga.Z,originGap:4,renderOrigin:e=>a()(kt.Z,{renderTooltip:()=>i.formatMessage({defaultMessage:"Turn into",id:"richTextMenu.turnIntoButton.tooltip"}),render:i=>n().createElement(Lt.Z,it()({style:{display:"flex",alignItems:"center",padding:"0 8px",whiteSpace:"nowrap",...this.getBorderRight()}},(0,ys.Z)(e,i)),t,Bt.Z.chevronDown({width:10,marginLeft:4,fill:this.theme.lightIconColor}))}),render:()=>a()(_e.ZP,{menuType:_e.ZP.MenuType.Popup},void 0,a()(Fe.Z,{context:{blocks:[e],environment:this.environment,publicEditMode:void 0},sections:[Fs.gH],onAccept:t=>{ca.w(),Ee.dhV(this.environment,{analyticsName:t.analyticsName,from:"rich_text_menu",block_type:e.getType()})}})),onClick:()=>{Ee.mt_(this.environment,{action:"turn_into"})}})}renderBoldButton(){return a()(ta.Z,{type:"b",tooltipLabel:a()(o.Fragment,{},void 0,a()("div",{},void 0,a()(Te.FormattedMessage,{defaultMessage:"Bold",id:"richTextMenu.boldButton.tooltip"})),a()("div",{},void 0,a()(na.Z,{style:{color:this.theme.mediumInvertedTextColor},name:"toggleBold"})))},void 0,"B")}renderItalicButton(){return a()(ta.Z,{type:"i",tooltipLabel:a()(o.Fragment,{},void 0,a()("div",{},void 0,a()(Te.FormattedMessage,{defaultMessage:"Italicize",id:"richTextMenu.italicsButton.tooltip"})),a()("div",{},void 0,a()(na.Z,{style:{color:this.theme.mediumInvertedTextColor},name:"toggleItalics"})))},void 0,a()("span",{style:{fontStyle:"italic"}},void 0,"i"))}renderStrikethroughButton(){return a()(ta.Z,{type:"s",tooltipLabel:a()(o.Fragment,{},void 0,a()("div",{},void 0,a()(Te.FormattedMessage,{defaultMessage:"Strike-through",id:"richTextMenu.strikeThroughButton.tooltip"})),a()("div",{},void 0,a()(na.Z,{style:{color:this.theme.mediumInvertedTextColor},name:"toggleStrike"})))},void 0,a()("span",{style:{textDecoration:"line-through"}},void 0,"S"))}renderUnderlineButton(){return a()(ta.Z,{type:"_",tooltipLabel:a()(o.Fragment,{},void 0,a()("div",{},void 0,a()(Te.FormattedMessage,{defaultMessage:"Underline",id:"richTextMenu.underlineButton.tooltip"})),a()("div",{},void 0,a()(na.Z,{style:{color:this.theme.mediumInvertedTextColor},name:"toggleUnderline"})))},void 0,a()("span",{style:{textDecoration:"underline"}},void 0,"U"))}renderCodeButton(){return a()(ta.Z,{type:"c",style:{padding:"0 6px"},tooltipLabel:a()(o.Fragment,{},void 0,a()("div",{},void 0,a()(Te.FormattedMessage,{defaultMessage:"Mark as code",id:"richTextMenu.markAsCodeButton.tooltip"})),a()("div",{},void 0,a()(na.Z,{style:{color:this.theme.mediumInvertedTextColor},name:"toggleCode"})))},void 0,Bt.Z.code({width:15,height:15}))}renderLinkButton(e){const t=this.environment.device.isMobile;return a()(ia.Z,{style:this.getBorderRight()},void 0,e&&Bt.Z.alias({width:t?18:16,height:t?18:16,marginRight:4,fill:this.theme.regularIconColor}),a()("span",{style:{borderBottom:"1px solid ".concat(this.theme.linkDecorationColor)}},void 0,a()(Te.FormattedMessage,{defaultMessage:"Link",id:"richTextMenu.linkButton.tooltip"})),e&&Bt.Z.chevronDown({width:10,marginLeft:4,fill:this.theme.lightIconColor}))}renderEquationButton(){return a()(sa.Z,{style:this.getBorderRight(),onClick:()=>{Ee.mt_(this.environment,{action:"e"}),ca.w()}},void 0,Bt.Z.equation({width:16,height:16}))}renderMention(){return a()(kt.Z,{renderTooltip:()=>a()(o.Fragment,{},void 0,a()("div",{},void 0,a()(Te.FormattedMessage,{defaultMessage:"Mention a person,{br}page, or date",id:"richTextMenu.mentionButton.tooltip",values:{br:a()("br",{})}})),a()("div",{style:{color:this.theme.mediumInvertedTextColor}},void 0,"@")),render:e=>n().createElement(Lt.Z,it()({style:{...this.getBorderRight(),padding:"0 8px"}},e,{onClick:()=>{zi.lZ(this.environment,{page:!0,createPage:!0,user:!0,bot:!0,date:!0,reminder:!0,templateVariable:!0}),Ee.mt_(this.environment,{action:"mention"})}}),Bt.Z.mention({width:14,fill:this.theme.regularTextColor}))})}renderCommentButton(e){return a()(ra.Z,{style:this.getBorderRight(),blockStore:e})}renderActionButton(e){return a()(aa.Z,{store:e,style:{borderRight:"none",borderRadius:0,padding:0,width:30,height:"none"},iconStyle:{fill:this.theme.regularTextColor},fadeIn:!1,onClick:()=>{Ee.mt_(this.environment,{action:"more"})}})}hasNonCollapsedTextSelection(){const e=Xs.get();return!!e&&!e.collapsed&&"editing"===as.default.state.mode&&!(0,Cs.iG)(as.default.state.multiSelection)}getBorderRight(){return{boxShadow:"1px 0 0 ".concat(this.theme.regularDividerColor),marginRight:1}}}d()(ka,"richTextMenuBlockTypesBlacklist",{[Os.ZP.factory]:!0}),d()(ka,"richTextMenuActionsBlacklist",{[Os.ZP.code]:new Set(["showMention","showCode"]),[Os.ZP.table]:new Set(["showTurnInto","showActionButton"]),[Os.ZP.tableRow]:new Set(["showTurnInto","showActionButton"])}),d()(ka,"leftOffset",60),d()(ka,"height",32);const Aa=(0,Te.injectIntl)(ka);var Pa=i(58945),Ia=i(56109),xa=i(81212);class Fa extends u.Z{constructor(...e){super(...e),d()(this,"handleContextMenu",((e,t)=>{if(e.preventDefault(),t.misspelledWord){const e=as.default.state,i="editing"===e.mode&&(0,Cs.QY)(e.multiSelection);if(i&&i.selection.startIndex===i.selection.endIndex){const e=Ji.Oq(i.store.getValue()||[],t.misspelledWord),s=i.selection.startIndex,a=Ji.PE(e,s);a&&ui.Z5({store:i.store,selection:a})}}ya.setState({open:!0,menuInfo:t})})),d()(this,"handleDismiss",(()=>{ya.setState({...ya.state,open:!1})}))}willMount(){fe.electronApi&&fe.electronApi.contextMenu&&fe.electronApi.contextMenu.addListener(this.handleContextMenu)}willUnmount(){fe.electronApi&&fe.electronApi.contextMenu&&fe.electronApi.contextMenu.removeListener(this.handleContextMenu)}renderComponent(){const{menuInfo:e,open:t}=ya.state,{device:i}=this.environment,{x:s,y:o}=this.getClickPosition(e),n=new DOMRect(s,o,0,0),r=e?this.getMenuSections(e):[],l=document.activeElement,d=Xs.get();let c=null,u=null;(l instanceof HTMLInputElement||l instanceof HTMLTextAreaElement)&&(c=l.selectionStart,u=l.selectionEnd);for(const a of r)for(const e of a.items){const t=e.action;e.action=e=>{l.focus(),l instanceof HTMLInputElement||l instanceof HTMLTextAreaElement?(l.selectionStart=c,l.selectionEnd=u):d&&Xs.set(d,i),L.default.afterNextFlush((()=>{t(e)}))}}return a()(Be.ZP,{open:t&&r.length>0,popupType:Be.ZP.PopupType.Popup,originRect:n,render:()=>a()(Ia.Z,{capture:!0,allowEsc:!0},void 0,a()(_e.ZP,{menuType:_e.ZP.MenuType.Popup},void 0,a()(Hi.Z,{type:Hi.Z.Type.Vertical,sections:r,initialFocus:void 0,onAccept:this.handleDismiss}))),onDismiss:this.handleDismiss,overlayContainerStore:xa.Z})}getClickPosition(e){const t=(0,fe.getCurrentZoom)();return{x:e?e.x/t:0,y:e?e.y/t:0}}getMenuSections(e){const t=[],i=this.getSpellingCorrectionItems(e);if(i.length>0){const e=t.length>0;t.push({key:"spellingCorrectionItems",items:i,render:t=>n().createElement(Re.Z,it()({},t,{topBorder:e}))})}const s=this.getDisableSpellCheckItems(e);if(s.length>0){const e=t.length>0;t.push({key:"disableSpellCheckItems",items:s,render:t=>n().createElement(Re.Z,it()({},t,{topBorder:e}))})}const a=this.getSearchItems(e);if(a.length>0){const e=t.length>0;t.push({key:"searchItems",items:a,render:t=>n().createElement(Re.Z,it()({},t,{topBorder:e}))})}const o=this.getLinkMenuItems(e);if(o.length>0){const e=t.length>0;t.push({key:"linkMenuItems",items:o,render:t=>n().createElement(Re.Z,it()({},t,{topBorder:e}))})}const r=this.getImageMenuItems(e);if(r.length>0){const e=t.length>0;t.push({key:"imageMenuItems",items:r,render:t=>n().createElement(Re.Z,it()({},t,{topBorder:e}))})}const l=this.getTextEditingItems(e);if(l.length>0){const e=t.length>0;t.push({key:"textEditingItems",items:l,render:t=>n().createElement(Re.Z,it()({},t,{topBorder:e}))})}const d=this.getEnableSpellCheckItem(e);if(d.length>0){const e=t.length>0;t.push({key:"enableSpellCheckItems",items:d,render:t=>n().createElement(Re.Z,it()({},t,{topBorder:e}))})}return t}getLinkMenuItems(e){const t=[];return e.linkURL&&e.linkURL.length>0&&(e.linkURL.startsWith("mailto:")?t.push({key:"copy-email",action:()=>{fe.electronApi&&fe.electronApi.copyText&&fe.electronApi&&fe.electronApi.copyText(e.linkText)},render:e=>n().createElement(qt.Z,it()({},e,{title:a()(Te.FormattedMessage,{defaultMessage:"Copy email address",id:"desktop.rightClickMenu.copyEmailAddress"})}))}):t.push({key:"copy-link",action:()=>{fe.electronApi&&fe.electronApi.copyText&&fe.electronApi&&fe.electronApi.copyText(e.linkURL)},render:e=>n().createElement(qt.Z,it()({},e,{title:a()(Te.FormattedMessage,{defaultMessage:"Copy link",id:"desktop.rightClickMenu.copyLink"})}))}),t.push({key:"open-link",action:()=>{fe.electronApi&&fe.electronApi.openExternalUrl(e.linkURL)},render:e=>n().createElement(qt.Z,it()({},e,{title:a()(Te.FormattedMessage,{defaultMessage:"Open link",id:"desktop.rightClickMenu.openLink"})}))})),t}getImageMenuItems(e){const t=[];return e.hasImageContents&&e.srcURL&&e.srcURL.length>0&&(t.push({key:"copy-image",action:()=>{fe.electronApi&&fe.electronApi.copyImage&&fe.electronApi.copyImage(e.srcURL)},render:e=>n().createElement(qt.Z,it()({},e,{title:a()(Te.FormattedMessage,{defaultMessage:"Copy image",id:"desktop.rightClickMenu.copyImage"})}))}),t.push({key:"copy-image-address",action:()=>{fe.electronApi&&fe.electronApi.copyText&&fe.electronApi.copyText(e.srcURL)},render:e=>n().createElement(qt.Z,it()({},e,{title:a()(Te.FormattedMessage,{defaultMessage:"Copy image address",id:"desktop.rightClickMenu.copyImageAddress"})}))})),t}isEditing(e){return e.isEditable||e.inputFieldType&&"none"!==e.inputFieldType}hasMisspelling(e){return this.isEditing(e)&&e.misspelledWord&&e.misspelledWord.length>0}getSpellingCorrectionItems(e){const t="SpellCheckStore"in this.environment&&this.environment.SpellCheckStore,i=[];if(this.hasMisspelling(e)&&t&&t.isEnabled()){const s=t.getCorrections(e);for(const e of s)i.push({key:e,action:()=>{fe.electronApi&&fe.electronApi.replaceMisspelling&&fe.electronApi.replaceMisspelling(e)},render:t=>n().createElement(qt.Z,it()({},t,{title:e}))})}return i}getDisableSpellCheckItems(e){const t="SpellCheckStore"in this.environment&&this.environment.SpellCheckStore,i=[];return this.hasMisspelling(e)&&t&&t.isEnabled()&&i.push({key:"disable",action:()=>{t.setEnabled(!1)},render:e=>n().createElement(qt.Z,it()({},e,{title:a()(Te.FormattedMessage,{defaultMessage:"Disable spell check",id:"desktop.spellcheckMenuItem.disableSpellcheck.title"})}))}),i}getEnableSpellCheckItem(e){const t="SpellCheckStore"in this.environment&&this.environment.SpellCheckStore,i=[];return this.isEditing(e)&&t&&!t.isEnabled()&&i.push({key:"enable",action:()=>{t.setEnabled(!0)},render:e=>n().createElement(qt.Z,it()({},e,{title:a()(Te.FormattedMessage,{defaultMessage:"Enable spell check",id:"desktop.spellcheckMenuItem.enableSpellcheck.title"})}))}),i}getSearchItems(e){const t=[];return e.selectionText&&e.selectionText.length>0&&t.push({key:"google",action:()=>{if(fe.electronApi){const t="https://www.google.com/search?q=".concat(encodeURIComponent(e.selectionText.trim()));fe.electronApi.openExternalUrl(t)}},render:e=>n().createElement(qt.Z,it()({},e,{title:a()(Te.FormattedMessage,{defaultMessage:"Search with Google",id:"desktop.searchMenuItem.searchWithGoogle.title"})}))}),t}getTextEditingItems(e){const t=[];return this.isEditing(e)&&(e.editFlags.canCut&&t.push({key:"cut",action:()=>{fe.electronApi&&fe.electronApi.cut&&fe.electronApi.cut()},render:e=>n().createElement(Pa.Z,it()({},e,{title:a()(Te.FormattedMessage,{defaultMessage:"Cut",id:"desktop.textEditingMenuItem.cutAction.title"}),shortcuts:["cut"]}))}),e.editFlags.canCopy&&t.push({key:"copy",action:()=>{fe.electronApi&&fe.electronApi.copy&&fe.electronApi.copy()},render:e=>n().createElement(Pa.Z,it()({},e,{title:a()(Te.FormattedMessage,{defaultMessage:"Copy",id:"desktop.textEditingMenuItem.copyAction.title"}),shortcuts:["copy"]}))}),e.editFlags.canPaste&&t.push({key:"paste",action:()=>{fe.electronApi&&fe.electronApi.paste&&fe.electronApi.paste()},render:e=>n().createElement(Pa.Z,it()({},e,{title:a()(Te.FormattedMessage,{defaultMessage:"Paste",id:"desktop.textEditingMenuItem.pasteAction.title"}),shortcuts:["paste"]}))})),t}}const Ba=Fa;var Ea=i(67133),Ra=i(28748);class Da extends u.Z{constructor(...e){super(...e),d()(this,"handleChangeValue",(e=>{if(!e)return void this.removeDateAnnotation();const t=this.getEverythingIWant();if(!t)return;const{date_format:i,time_format:s}=t;this.setDateAnnotationData({date_format:i,time_format:s,...e})})),d()(this,"handleChangeDateFormat",(e=>{const t=this.getEverythingIWant();if(!t)return;const{dateValue:i,time_format:s}=t;this.setDateAnnotationData({date_format:e,time_format:s,...i})})),d()(this,"handleChangeTimeFormat",(e=>{const t=this.getEverythingIWant();if(!t)return;const{dateValue:i,date_format:s}=t;this.setDateAnnotationData({date_format:s,time_format:e,...i})})),d()(this,"setDateAnnotationData",(e=>{const t=this.getEverythingIWant();if(!t)return;const{textStore:i,textValue:s,tokenIndex:a,annotations:o}=t,n=s.map(((t,i)=>{if(i===a){const i=o.map((t=>Ji.fp(t)?["d",e]:t));return Ji.V3(t[0],i)}return t}));si.createAndCommit(this.environment,(e=>{di.sO({store:i,value:n,transaction:e})}))})),d()(this,"removeDateAnnotation",(()=>{const e=this.getEverythingIWant();if(!e)return;const{textStore:t,textValue:i,tokenIndex:s}=e,a=i.filter(((e,t)=>t!==s));si.createAndCommit(this.environment,(e=>{di.sO({store:t,value:a,transaction:e})}))}))}renderComponent(){const{device:e}=this.environment,t=Ra.Z.state;return a()(Be.ZP,{popupType:e.isMobile?Be.ZP.PopupType.SlideUp:Be.ZP.PopupType.Popup,open:t.open,originRect:t.originRect,onDismiss:Ea.x,render:()=>{const e=this.getEverythingIWant();if(!e)return null;const{date_format:i,time_format:s,dateValue:o}=e;return a()(Ze.DependencyConsumer,{dependency:Ze.deps.menus},void 0,(({DatePropertyMenu:e})=>a()(e,{firstDayOfWeek:E.AK.state,value:o,canConfigureCollection:!0,onChangeValue:this.handleChangeValue,dateFormat:i,onChangeDateFormat:this.handleChangeDateFormat,timeFormat:s,onChangeTimeFormat:this.handleChangeTimeFormat,onDismiss:Ea.x,disabled:!1,shouldShowReminder:!!t.open&&t.allowReminders})))}})}getEverythingIWant(){const e=Ra.Z.state;if(e.open){const{textStore:t,tokenIndex:i}=e,s=t.getValue();if(s){const e=s[i];if(e){const a=Ji.hD(e),o=Ji.K9(a);if(o){const{date_format:n,time_format:r,...l}=Ji.Ot(o);return{textStore:t,textValue:s,tokenIndex:i,token:e,annotations:a,date_format:n,time_format:r,dateValue:l}}}}}}}const _a=Da;var La=i(15102),Oa=i(34190),Ua=i(95773),Na=i(86646),Va=i(79029),Wa=i(98195),za=i(47853);class Ha extends u.Z{renderComponent(){const{device:e}=this.environment,{title:t,caption:i,image:s,onClick:o}=this.props,r=(0,za.D)(s);return a()(Wa.Z,{render:({mouseEntered:s,events:l})=>n().createElement("div",it()({},l,{onClick:o,style:this.getWrapStyle(s)}),a()("img",{src:r,style:this.getImageStyle(s)}),a()("div",{style:this.getInfoStyle()},void 0,a()("div",{style:this.getTitleStyle()},void 0,a()("span",{style:this.getMobileTitleStyle()},void 0,t)),!e.isMobile&&a()("div",{style:this.getCaptionStyle()},void 0,i)))})}getWrapStyle(e){const{device:t}=this.environment;return{display:"flex",flexDirection:t.isMobile?"column":"row",alignItems:"center",flexGrow:0,...e&&{cursor:"pointer"},...t.isMobile?{padding:"12px 4px 16px"}:{marginBottom:8}}}getImageStyle(e){const{device:t}=this.environment,{selected:i}=this.props,s=(()=>i?"0 0 0 2px ".concat(mt.ZP.blue):e?"0 0 0 2px ".concat(this.theme.darkDividerColor):"0 0 0 1px ".concat(this.theme.darkDividerColor))(),a=t.isMobile?"42vw":"169px";return{display:"flex",flexDirection:"column",borderRadius:3,boxShadow:s,transition:"box-shadow 200ms ease-out",marginTop:8,marginBottom:t.isMobile?12:8,height:"calc(".concat(a," / (169 / 97))"),maxHeight:97,maxWidth:a}}getInfoStyle(){const{device:e}=this.environment;return{display:"flex",flexDirection:"column",...!e.isMobile&&{marginLeft:16}}}getTitleStyle(){const{device:e}=this.environment,{selected:t}=this.props;return{display:"flex",fontSize:14,...t&&!e.isMobile&&{fontWeight:600},marginBottom:2,...e.isMobile&&{justifyContent:"center"}}}getMobileTitleStyle(){const{device:e}=this.environment,{selected:t}=this.props;return e.isMobile?{fontSize:12,padding:"2px 10px",borderRadius:20,textAlign:"center",...t&&{background:mt.ZP.blue,color:mt.ZP.white}}:{}}getCaptionStyle(){return{fontSize:12,color:this.theme.mediumTextColor}}}const qa=Ha;var Ga=i(51768),Ka=i(72693),ja=i(47966),Ya=i(74523);class Qa extends u.Z{constructor(...e){super(...e),d()(this,"storeTypes",{databaseSearchButtonPopupStore:us.Z}),d()(this,"renderDesktopModalContent",(()=>{const{currentBlockStore:e}=se.default.state,t=Ga.Z.state;if(t.open&&e)return a()("div",{style:Qa.modalStyle},void 0,a()("div",{style:Qa.modalHeaderStyle},void 0,a()(Te.FormattedMessage,{id:"configureRelationModal.relationProperty.createModal.header",defaultMessage:"Create a relation to another database"})),a()("div",{style:Qa.sourceSectionStyle},void 0,a()("div",{style:Qa.defaultTextStyle},void 0,a()(Te.FormattedMessage,{id:"configureRelationModal.relationProperty.createModal.description",defaultMessage:"A relation allows you to link pages from other databases."})),this.renderDatabaseButtonPopup()),t.relationCollectionId===t.targetCollectionId&&a()("div",{style:Qa.selfRelationSectionStyle},void 0,a()("div",{style:Qa.defaultTextStyle},void 0,a()(Te.FormattedMessage,{id:"configureRelationModal.relationProperty.createModal.selfRelationPrompt",defaultMessage:"You selected the same database. In which property should the linked pages appear?"})),this.renderSelfRelationConfigure()),a()("div",{style:{display:"flex",alignItems:"center"}},void 0,a()(Ya.Z,{title:a()(Te.FormattedMessage,{id:"configureRelationModal.relationProperty.createModal.helpCenterLink",defaultMessage:"Learn about relations"}),href:(0,We.UY)("guides.relations"),analyticsFrom:"configure_relation_modal"}),a()(ja.Z,{isLarge:!0,style:{marginLeft:"auto",marginRight:12},onClick:this.handleCancelClick},void 0,a()(Te.FormattedMessage,{id:"configureRelationModal.relationProperty.createModal.cancelButton",defaultMessage:"Cancel"})),a()(Ka.Z,{isLarge:!0,onClick:this.handleDoneClick,disabled:!this.canAccept()},void 0,a()(Te.FormattedMessage,{id:"configureRelationModal.relationProperty.createModal.confirmButton",defaultMessage:"Create relation"}))))})),d()(this,"renderMobilePopupContent",(()=>{const e=Ga.Z.state;if(e.open)return a()(_e.ZP,{menuType:_e.ZP.MenuType.Modal,right:a()(Ve.DoneMenuText,{}),left:a()(Ve.CancelMenuText,{}),title:a()(Te.FormattedMessage,{id:"configureRelationModal.relationProperty.createModal.databaseSelect.label",defaultMessage:"Select a database"}),onClickRight:this.handleDoneClick,onClickLeft:this.handleCancelClick,rightDisabled:!this.canAccept()},void 0,a()(Re.Z,{title:a()(Te.FormattedMessage,{id:"configureRelationModal.relationProperty.createModal.databaseSelect.mobile.title",defaultMessage:"Database source"})},void 0,a()(Na.Z,{title:this.renderDatabaseButtonPopup()})),a()("div",{style:this.getMobileSectionCaption()},void 0,a()(Te.FormattedMessage,{id:"configureRelationModal.relationProperty.createModal.databaseSelect.mobile.caption",defaultMessage:"The database you wish to link to."})),e.relationCollectionId===e.targetCollectionId&&a()(o.Fragment,{},void 0,a()("div",{style:{...this.getMobileSectionHeading(),marginTop:28}},void 0,a()(Te.FormattedMessage,{id:"configureRelationModal.relationProperty.createModal.selfRelationPrompt.mobileTitle",defaultMessage:"Self-relation type"})),a()("div",{style:this.getMobileSectionCaption()},void 0,a()(Te.FormattedMessage,{id:"configureRelationModal.relationProperty.createModal.selfRelationPrompt",defaultMessage:"You selected the same database. In which property should the linked pages appear?"})),a()(Re.Z,{disableMobilePadding:!0},void 0,a()(Na.Z,{title:this.renderSelfRelationConfigure()})),a()("div",{style:this.getMobileSectionCaption()},void 0,this.renderSelfRelationCaption(e.selfRelationType))),a()(Re.Z,{},void 0,a()(Ne.Z,{title:a()(Te.FormattedMessage,{id:"configureRelationModal.relationProperty.createModal.helpCenterLinkMobile",defaultMessage:"Learn about relations"}),href:(0,We.UY)("guides.relations"),analyticsFrom:"configure_relation_modal"})))})),d()(this,"renderDatabaseButtonPopupOrigin",(e=>{const{device:t}=this.environment,{currentBlockStore:i}=se.default.state;if(Ga.Z.state.open&&i)return t.isMobile?n().createElement(Lt.Z,it()({mobileFeedback:!0,style:{width:"100%"}},e),this.getButtonTitle()):n().createElement(ja.Z,it()({isLarge:!0,style:{width:"100%"}},e),this.getButtonTitle(),Bt.Z.chevronDown({width:10,marginLeft:4,fill:this.theme.lightIconColor}))})),d()(this,"renderDatabaseButtonPopupContent",(()=>{const{device:e}=this.environment,{currentBlockStore:t}=se.default.state,i=Ga.Z.state;if(!i.open||!t)return;const s={request:i.collectionSearchQuery,debounce:Wt.vp,performRequest:this.getCollectionAutocompleteItems,render:(s,r,l)=>{let d;if(s&&(d=a()(Re.Z,{},void 0,a()(Ki.Z,{title:this.props.intl.formatMessage({id:"configureRelationModal.relationProperty.render.error",defaultMessage:"Something went wrong."})}))),l||(d=a()(Re.Z,{},void 0,a()(Ki.Z,{title:this.props.intl.formatMessage({id:"configureRelationModal.relationProperty.render.loading",defaultMessage:"Loading..."})}))),r&&0===r.length)d=a()(Re.Z,{},void 0,a()(Ki.Z,{title:this.props.intl.formatMessage({id:"configureRelationModal.relationProperty.createModal.noResults",defaultMessage:"No results"})}));else{const e=(r||[]).map((e=>{const i=Oa.Z.createChildStore(t,{table:da.v,id:e});return{key:e,render:e=>n().createElement(Gi.Z,it()({store:i},e)),action:()=>{this.handleSelectCollection(e)}}}));d=a()(Hi.Z,{type:Hi.Z.Type.Vertical,initialFocus:i.collectionSearchQuery?0:void 0,sections:[{key:"results",render:e=>n().createElement(Re.Z,e),items:e}]})}return e.isMobile?a()(o.Fragment,{},void 0,d):a()("div",{style:Qa.customPopupStyle},void 0,d)}},r=a()(Re.Z,{isInput:!0},void 0,this.renderDatabaseInputMenuItem());let l;return l=e.isMobile?{menuType:_e.ZP.MenuType.Modal,title:a()(Te.FormattedMessage,{id:"configureRelationModal.relationProperty.createModal.databaseSelect.label",defaultMessage:"Select a database"}),right:a()(Ve.DoneMenuText,{}),header:r,onClickRight:this.handleDatabaseSearchDoneClick}:{menuType:_e.ZP.MenuType.Popup,width:"100%",header:r},n().createElement(_e.ZP,l,n().createElement(Vt.Z,s))})),d()(this,"handleSamePropertyClick",(()=>{const e=Ga.Z.state;e.open&&Ga.Z.setState({...e,selfRelationType:"same_property"})})),d()(this,"handleSeparatePropertyClick",(()=>{const e=Ga.Z.state;e.open&&Ga.Z.setState({...e,selfRelationType:"separate_property"})})),d()(this,"getCollectionAutocompleteItems",(async e=>(await Wt.bm(this.environment,{query:e,limit:20,source:"relation_setup_menu"})).results)),d()(this,"handleDatabaseSearchInputChange",(e=>{const t=Ga.Z.state;t.open&&Ga.Z.setState({...t,collectionSearchQuery:e.target.value})})),d()(this,"handleSelectCollection",(e=>{const t=Ga.Z.state;t.open&&(Ga.Z.setState({...t,targetCollectionId:e}),this.stores.databaseSearchButtonPopupStore.setState({open:!1}))})),d()(this,"handleDatabaseSearchDoneClick",(()=>{this.stores.databaseSearchButtonPopupStore.setState({open:!1})})),d()(this,"handleCancelClick",(()=>{Ua.xv()})),d()(this,"handleDoneClick",(()=>{Ua.RL(this.environment)})),d()(this,"handleDatabaseButtonPopupClick",(()=>{const e=Ga.Z.state;e.open&&Ga.Z.setState({...e,collectionSearchQuery:""})}))}renderComponent(){const{device:e}=this.environment,{open:t}=Ga.Z.state;return e.isMobile?a()(Be.GI,{popupType:Be.kQ.SlideUp,alignmentToOrigin:Be.GI.Alignment.Start,open:t,render:this.renderMobilePopupContent,onDismiss:Ua.xv}):a()(La.Z,{open:t,render:this.renderDesktopModalContent,onDismiss:Ua.xv})}renderSelfRelationConfigure(){const e=Ga.Z.state;if(e.open)return a()("div",{style:this.getSelfRelationButtonWrapStyle()},void 0,a()(qa,{title:a()(Te.FormattedMessage,{id:"configureRelationModal.relationProperty.createModal.selfRelationPrompt.createNewPropertyOption.title",defaultMessage:"Create a new property"}),caption:this.renderSelfRelationCaption("separate_property"),image:vs.Z.images.selfRelationSeparateSvg,selected:"separate_property"===e.selfRelationType,onClick:this.handleSeparatePropertyClick}),a()(qa,{title:a()(Te.FormattedMessage,{id:"configureRelationModal.relationProperty.createModal.selfRelationPrompt.samePropertyOption.title",defaultMessage:"Use the same property"}),caption:this.renderSelfRelationCaption("same_property"),image:vs.Z.images.selfRelationSameSvg,selected:"same_property"===e.selfRelationType,onClick:this.handleSamePropertyClick}))}getButtonTitle(){const{currentBlockStore:e}=se.default.state,t=Ga.Z.state;if(t.open&&e){if(t.targetCollectionId){const i=Oa.Z.createChildStore(e,{table:da.v,id:t.targetCollectionId});return a()("div",{style:{display:"flex",alignItems:"center"}},void 0,a()(ri.Z,{disabled:!0,icon:i.getIcon(),isEmptyPage:!1,size:20}),a()(Va.Z,{store:i,style:{margin:"0 6px"}}))}return a()("span",{style:{color:this.theme.mediumTextColor}},void 0,a()(Te.FormattedMessage,{id:"configureRelationModal.relationProperty.createModal.databaseSelect.label",defaultMessage:"Select a database"}))}}renderDatabaseButtonPopup(){const{device:e}=this.environment;return a()(ea.Z,{popupType:e.isMobile?Be.kQ.SlideUp:Be.kQ.Popup,renderOrigin:this.renderDatabaseButtonPopupOrigin,render:this.renderDatabaseButtonPopupContent,buttonPopupStore:this.stores.databaseSearchButtonPopupStore,onClick:this.handleDatabaseButtonPopupClick,style:{width:440}})}renderDatabaseInputMenuItem(){const e=Ga.Z.state;if(e.open)return a()(De.Z,{focus:!0,focusAfterAnimation:!0,value:e.collectionSearchQuery,onChange:this.handleDatabaseSearchInputChange,placeholder:this.props.intl.formatMessage({id:"configureRelationModal.relationProperty.createModal.databaseSelect.placeholder",defaultMessage:"Search for a database…"})})}renderSelfRelationCaption(e){return a()(o.Fragment,{},void 0,a()(Te.FormattedMessage,"same_property"===e?{id:"configureRelationModal.relationProperty.createModal.selfRelationPrompt.createNewPropertyOption.caption",defaultMessage:'<b>No syncing.</b> Use this option when modeling a "Related tasks" property in a "Task" database.',values:{b:(...e)=>a()("b",{style:{color:this.theme.regularTextColor}},void 0,e)}}:{id:"configureRelationModal.relationProperty.createModal.selfRelationPrompt.samePropertyOption.caption",defaultMessage:'<b>Sync both ways.</b> Use this option when modeling "Parent Task" and "Child Task" properties in a "Task" database.',values:{b:(...e)=>a()("b",{style:{color:this.theme.regularTextColor}},void 0,e)}}))}canAccept(){const e=Ga.Z.state;return e.open&&e.targetCollectionId}getSelfRelationButtonWrapStyle(){const{device:e}=this.environment;return{display:"flex",flexDirection:e.isMobile?"row":"column",justifyContent:"space-between"}}getMobileSectionHeading(){return{marginTop:8,marginRight:16,marginBottom:8,marginLeft:16,fontSize:12,textTransform:"uppercase",color:this.theme.mediumTextColor}}getMobileSectionCaption(){return{marginTop:8,marginRight:16,marginBottom:8,marginLeft:16,fontSize:12,color:this.theme.mediumTextColor}}}d()(Qa,"defaultTextStyle",{marginBottom:8,fontSize:14}),d()(Qa,"modalStyle",{padding:30,width:538}),d()(Qa,"modalHeaderStyle",{fontWeight:600,marginBottom:20}),d()(Qa,"sourceSectionStyle",{marginBottom:30}),d()(Qa,"selfRelationSectionStyle",{marginBottom:30}),d()(Qa,"customPopupStyle",{maxHeight:"24vh"});const Ja=(0,Te.injectIntl)(Qa);i(15306);var Xa=i(81700),$a=i(86080),eo=i(47307);class to extends u.Z{constructor(...e){super(...e),d()(this,"lastOpenState",void 0),d()(this,"renderModal",(()=>{if(!this.lastOpenState)return;const{acceptLabel:e,requiredInputValue:t}=this.lastOpenState,i=[{key:"accept",render:t=>n().createElement(ja.Z,it()({isRed:!0,isLarge:!0,style:to.buttonStyle,hovered:t.focused},t),e),action:this.handleAccept},{key:"cancel",render:e=>n().createElement(ja.Z,it()({isLarge:!0,style:to.buttonStyle,hovered:e.focused},e),a()(Te.FormattedMessage,{id:"confirmationInputDialog.cancelButton.label",defaultMessage:"Cancel"})),action:this.handleCancel}];return a()(lt.Z,{capture:!0,preventType:ft.xm.All},void 0,a()("div",{},void 0,a()("div",{style:{minHeight:64,display:"flex",alignItems:"center",justifyContent:"center",marginBottom:16}},void 0,this.lastOpenState.message),a()(Ge.Z,{value:this.lastOpenState.inputValue,onChange:this.handleInputChange,style:{height:38,marginBottom:2},placeholder:t}),a()(Hi.Z,{type:Hi.Z.Type.Vertical,initialFocus:void 0,sections:[{key:"dialog",render:e=>n().createElement(Re.Z,e),items:i}]})))})),d()(this,"handleAccept",(()=>{const e=Xa.Z.state;e.open&&(this.cleanAcceptInput(e.inputValue)===this.cleanAcceptInput(e.requiredInputValue)?$a.x({didConfirm:!0}):eo.showErrorMessage(a()(Te.FormattedMessage,{id:"confirmDialogInput.incorrectInputError.message",defaultMessage:'Please type "{requiredInputValue}" to continue',values:{requiredInputValue:e.requiredInputValue}})))})),d()(this,"cleanAcceptInput",(e=>e.trim().toLowerCase().replace(/’/g,"'"))),d()(this,"handleCancel",(()=>{$a.x({didConfirm:!1})})),d()(this,"handleInputChange",(e=>{const t=Xa.Z.state;t.open&&Xa.Z.setState({...t,inputValue:e.target.value})}))}renderComponent(){const e=Xa.Z.state;return e.open&&(this.lastOpenState={...e}),a()(La.Z,{open:e.open,keepFocus:!0,overlayZIndex:nt.Wd,onDismiss:this.handleCancel,preventHideChildrenWhileOpening:!0,innerStyle:{borderRadius:3,paddingTop:24,paddingBottom:16,paddingLeft:32,paddingRight:32,width:this.lastOpenState&&this.lastOpenState.width||336,fontSize:16,boxShadow:this.theme.largeBoxShadow,background:(0,gi.GN)()?this.theme.modalBackground:this.theme.contentBackground,maxHeight:"90vh",overflowY:"scroll",marginLeft:24,marginRight:24},render:this.renderModal})}}d()(to,"buttonStyle",{width:"100%",marginTop:16});const io=to;var so=i(51118),ao=i(17256),oo=i(74597),no=i(45953),ro=i(92995),lo=i(77546),co=i(4615),uo=i(77420),mo=i(68718),po=i(98459),go=i(82136),ho=i(13493),fo=i(16691);class vo extends u.Z{constructor(...e){super(...e),d()(this,"handleOverrideLinkClick",(e=>{(0,so.U4)(),ge.navigate({environment:this.environment,url:e})})),d()(this,"loadSnapshot",(async e=>{const{timestamp:t}=e,i=e.block.id,s=await ue.getSnapshotContents(this.environment,e);if("failed"===s.type)throw s.error;const a=no.Ak.create(s.data.contentMap),o=this.environment.currentUser.id,n=new oo.Z;for(const{pointer:m,value:p}of a)p&&n.setRecord({pointer:m,userId:o},{...p,role:"reader"});n.snapshotData={blockId:i,timestamp:t};const r=new Map,l=e=>{const t=n.getRecord({pointer:e,userId:o}),i=(0,fo.dn)(e);t||!(0,co.e)(e.id)||r.has(i)||r.set(i,(0,ce.Kv)(this.props.blockStore,e))};for(const{pointer:m,value:p}of a)if(p&&p.value)if(m.table===T.iU){var d;const{value:e}=p,t=e,i=O.jD(t);for(const n of i)l(n);const s=O.DF(t)?[]:t.content||[];for(const n of s)l({table:T.iU,id:n});const a=null===(d=t.format)||void 0===d?void 0:d.collection_pointer;a&&l(a);const o=t.collection_id;o&&l({table:da.v,id:o});for(const n of O.lc(t))l({table:os.KJ,id:n});t.created_by_table&&t.created_by_id&&(t.created_by_table===os.KJ?l({table:os.KJ,id:t.created_by_id}):l({table:uo.c,id:t.created_by_id})),t.last_edited_by_table&&t.last_edited_by_id&&(t.last_edited_by_table===os.KJ?l({table:os.KJ,id:t.last_edited_by_id}):l({table:uo.c,id:t.last_edited_by_id}))}else if(m.table===ho.n){var c;const{value:e}=p,t=null===(c=e.format)||void 0===c?void 0:c.collection_pointer;t&&l(t)}else if(m.table===la.x_){const{value:e}=p,t=e;t.created_by_id&&t.created_by_table&&(t.created_by_table===os.KJ?l({table:os.KJ,id:t.created_by_id}):l({table:uo.c,id:t.created_by_id}))}const u=Array.from(r.values());return await Promise.all(u.map((async e=>{await e.load();const t=e.getValue();t&&n.setRecord({pointer:e.pointer,userId:o},{role:"reader",value:t})}))),{blockStore:new b.Z(this.environment,{table:T.iU,id:i},{inMemoryRecordCache:n}),timestamp:t}}))}getChildContext(){return{...this.context,overrideLinkClick:this.handleOverrideLinkClick}}renderComponent(){const e=this.props.blockStore.id,t=this.props.timestamp,i={request:{block:{id:e,spaceId:(0,po.CG)(this.props.blockStore.pointer.spaceId)},timestamp:t},performRequest:this.loadSnapshot,render:(e,t,i)=>a()(ji.Z,{show:!i||!t,showDelay:400,showHold:400,render:i=>i?a()("div",{style:this.getSpinnerWrapperStyles()},void 0,a()(zt.Z,{})):e?a()("div",{style:{padding:32}},void 0,a()(Te.FormattedMessage,{defaultMessage:"Something went wrong.",id:"pageSnapshotPreview.unknownPreviewLoadError.message"})):t?a()(wi.Z,{store:t.blockStore,isDefaultContainer:!0,droppable:!0,render:e=>n().createElement(ft.ZP,it()({style:{background:this.theme.contentBackground,zIndex:1,flexGrow:1},type:this.useSeparateHorizontalScroller(t.blockStore)?ft.xm.Y:ft.xm.All},e),a()(ro.Z,{store:t.blockStore,disabled:!0,loadingContainerStore:void 0,context:go.S.InAppTemplatePreview,paddingBottom:ro.Z.paddingBottom(this.environment),paddingLeft:ro.Z.defaultPaddingLeftRight(this.environment),paddingRight:ro.Z.defaultPaddingLeftRight(this.environment),pageCoverHeight:ro.Z.defaultPageCoverHeight(this.environment)}))},t.timestamp):void 0})};return n().createElement(Vt.Z,i)}useSeparateHorizontalScroller(e){return!e.isCollectionView()||!lo.eA(this.environment)}getSpinnerWrapperStyles(){return{padding:32,display:"flex",alignItems:"center",justifyContent:"center"}}}d()(vo,"contextTypes",u.w),d()(vo,"childContextTypes",mo.u);const yo=vo;var Mo=i(12235);class So extends u.Z{constructor(...e){super(...e),d()(this,"handleScroll",(e=>{if(this.props.loading)return;if(e>(this.props.loadMoreOffsetThreshold||200))return;this.props.resultSize>=this.props.fetchSize&&this.props.onLoadMore()}))}renderComponent(){return a()(Mo.Z,{onChange:this.handleScroll})}}const bo=So;var To=i(93678),Co=i(46096),Zo=i(46247),wo=i(52533);class ko extends u.Z{constructor(...e){super(...e),d()(this,"renderSnapshotsListRequest",(()=>{const{device:e}=this.environment,t=Co.Z.state;if(!t.open)return;const i={request:{block:{id:t.blockStore.id,spaceId:(0,po.CG)(t.blockStore.pointer.spaceId)},size:t.size},performRequest:e=>this.loadSnapshotsList(e,t),render:(i,s,o)=>a()(ji.Z,{show:Boolean(!s||s.snapshots.length>=t.size&&t.openSnapshotNearTimestamp),showDelay:400,showHold:100,render:a=>e.isMobile?this.renderMobileHistory({snapshotValues:s?s.snapshots:[],menuState:t,error:i,initialLoading:a,loadingMore:!o}):this.renderDesktopHistory({snapshotValues:s?s.snapshots:[],menuState:t,error:i,initialLoading:a,loadingMore:!o})})};return n().createElement(Vt.Z,i)})),d()(this,"renderMobileHistory",(e=>{let t,i;return this.historyIsEnabled()?e.loadingMore||0!==e.snapshotValues.length||(t=this.renderUnavailableMessage(ko.noSnapshotsMessage,!1)):t=this.renderUnavailableMessage(this.getUnavailableMessage(),Et.M9(this.environment)||"team"),i=e.error?a()("div",{style:ko.wrapStyle},void 0,a()(Te.FormattedMessage,{defaultMessage:"Something went wrong",id:"historyModal.errorMessage"})):e.initialLoading?a()("div",{style:ko.wrapStyle},void 0,a()(zt.Z,{})):a()(o.Fragment,{},void 0,a()(ft.ZP,{type:ft.xm.Y},void 0,this.renderSnapshotsMenuList(e)),this.renderMobileSnapshotPreview(e.menuState)),a()(_e.ZP,{menuType:_e.ZP.MenuType.Modal,title:a()(Te.FormattedMessage,{defaultMessage:"History",id:"historyModal.mobileHistoryMenu.title"}),left:this.renderMobileHelpButton(),right:a()(Ve.DoneMenuText,{}),onClickRight:so.U4,header:t},void 0,i)})),d()(this,"renderDesktopHistory",(e=>{let t;return t=e.error?a()("div",{style:ko.wrapStyle},void 0,a()(Te.FormattedMessage,{defaultMessage:"Something went wrong",id:"historyModal.desktopModal.errorMessage"})):e.initialLoading?a()("div",{style:ko.wrapStyle},void 0,a()(zt.Z,{})):this.historyIsEnabled()?e.menuState.snapshot&&!this.snapshotIsAvailable(e.menuState.snapshot)?this.renderUnavailableMessage(ko.restrictedMessage,"enterprise"):e.loadingMore||0!==e.snapshotValues.length?this.renderDesktopSnapshotPreview(e.menuState):this.renderUnavailableMessage(ko.noSnapshotsMessage,!1):this.renderUnavailableMessage(this.getUnavailableMessage(),Et.M9(this.environment)||"team"),a()(o.Fragment,{},void 0,a()("div",{style:{display:"flex",flexDirection:"column",width:"calc(100% - ".concat(ko.sidebarWidth,"px)"),boxShadow:"1px 0 0 ".concat(this.theme.regularDividerColor)}},void 0,t),this.renderDesktopSidebar(e))})),d()(this,"renderSnapshotsMenuList",(e=>{const{device:t}=this.environment,{menuState:i,loadingMore:s}=e,r=f().compact(e.snapshotValues.map((e=>{const s=this.snapshotIsAvailable(e);return{key:e.id,action:()=>{so.gs(this.environment,e)},render:o=>{const r=e.authors||[],l=this.props.intl.formatList(f().compact(r.map(((e,t)=>{if(e.table===os.KJ){const t=(0,ce.Kv)(i.blockStore,e).getValue();if(!t)return;return(0,os.Nz)(this.props.intl,t)}{const t=(0,ce.Kv)(i.blockStore,e).getValue();if(!t)return;return t.name}}))),{type:"conjunction",style:"narrow"}),d=a()("div",{style:{...ct.Z.textOverflowStyle}},void 0,l),c=Boolean(i.snapshot&&i.snapshot.id===e.id),u=6*Us.A0,m=(0,ao.Z)(parseInt(e.timestamp)),p=m.format("lll");let g=m.format("LL");if((0,ao.Z)().diff(m)<=u&&(g=m.calendar()),s)return a()(kt.Z,{render:e=>n().createElement(qt.Z,it()({},(0,ys.Z)(o,e),{title:g,focused:!t.isMobile&&c,caption:d})),renderTooltip:()=>a()("div",{style:{maxWidth:270,whiteSpace:"normal"}},void 0,a()("div",{},void 0,p),a()("div",{},void 0,l))},o.key);{const e=!this.historyIsEnabled();return a()(kt.Z,{render:i=>n().createElement(qt.Z,it()({},(0,ys.Z)(i,o),{title:a()("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},void 0,a()("div",{style:{...t.isMobile&&{display:"flex",flex:1},...ct.Z.textOverflowStyle}},void 0,g),!e&&a()(At.Z,{subscriptionTier:"enterprise",analyticsName:"history_modal",desktopStyle:{marginLeft:8},onClick:()=>this.handleUpgrade("enterprise")})),focused:!t.isMobile&&c,disabled:e,caption:d})),renderTooltip:()=>a()(Te.FormattedMessage,{defaultMessage:"Upgrade to view this snapshot.",id:"historyModal.snapshotsMenuList.upgrade.tooltip"}),disableTooltip:!e},o.key)}}}}))),l=i.snapshot&&i.snapshot.id,d=r.findIndex((e=>l===e.key)),c=[{key:"snapshots",render:e=>n().createElement(Re.Z,e),items:r}];return a()(o.Fragment,{},void 0,a()(Hi.Z,{type:Hi.Z.Type.Vertical,initialFocus:d,sections:c}),a()(bo,{loading:s,fetchSize:i.size,resultSize:e.snapshotValues.length,onLoadMore:so.FF}),a()(ji.Z,{show:s,showDelay:300,showHold:100,render:e=>e&&a()("div",{style:ko.wrapStyle},void 0,a()(zt.Z,{}))}))})),d()(this,"handleUpgrade",(e=>{To.y(this.environment,{from:"history_modal",for:e})})),d()(this,"loadSnapshotsList",(async(e,t)=>{const{device:i}=this.environment,s=await ue.getSnapshotsList(this.environment,e);if("failed"===s.type)throw s.error;const{snapshots:a}=s.data;if(t.openSnapshotNearTimestamp){const e=parseInt(t.openSnapshotNearTimestamp),i=a.findIndex((t=>parseInt(t.timestamp)<e));0===a.length||(0===i?so.gs(this.environment,a[i]):i>0?so.gs(this.environment,a[i-1]):a.length<t.size?so.gs(this.environment,a[a.length-1]):so.FF())}else Boolean(t.snapshot)||i.isMobile||Co.Z.setState({...t,snapshot:a[0]});return s.data})),d()(this,"iconSize",(()=>{const{device:e}=this.environment;return e.isMobile?24:20}))}renderComponent(){const{device:e}=this.environment,t=Co.Z.state;return e.isMobile?a()(Be.ZP,{popupType:Be.ZP.PopupType.SlideUp,open:t.open,render:this.renderSnapshotsListRequest,onDismiss:so.U4}):a()(La.Z,{open:t.open,innerStyle:{height:"80vh",width:"80vw",overflow:"hidden",display:"flex"},onDismiss:so.U4,render:this.renderSnapshotsListRequest,className:Kt.Nn})}renderMobileSnapshotPreview(e){if(this.historyIsEnabled())return a()(Be.ZP,{popupType:Be.ZP.PopupType.SlideUp,open:Boolean(e.snapshot),forceFullScreenSlideUp:!0,render:()=>{if(!e.snapshot)return;const t=this.snapshotIsAvailable(e.snapshot),i=t?a()(yo,{blockStore:e.blockStore,timestamp:e.snapshot.timestamp}):this.renderUnavailableMessage(ko.restrictedMessage,"enterprise");return a()(_e.ZP,{menuType:_e.ZP.MenuType.Modal,title:(0,ao.Z)(parseInt(e.snapshot.timestamp)).calendar(),right:a()(Ve.DoneMenuText,{}),onClickRight:so.zb,leftDisabled:!t,left:a()(Te.FormattedMessage,{defaultMessage:"Restore",id:"historyModal.mobileSnapshotMenu.restoreButton.label"}),onClickLeft:()=>so.xx(this.environment),whiteBackground:t,forceFullScreenSlideUp:!0},void 0,i)}})}renderDesktopSidebar(e){const{menuState:t}=e,i=Boolean(t.snapshot&&this.snapshotIsAvailable(t.snapshot)),s=!this.historyIsEnabled();return a()("div",{style:this.getSidebarStyle()},void 0,a()(ft.ZP,{type:ft.xm.Y,style:{flex:1}},void 0,this.renderSnapshotsMenuList(e)),a()("div",{style:{display:"flex",padding:14,borderTop:"\n\t\t\t\t\t\t\t1px solid ".concat(this.theme.regularDividerColor,"\n\t\t\t\t\t\t")}},void 0,a()(kt.Z,{disableTooltip:!s,renderTooltip:()=>a()(Te.FormattedMessage,{defaultMessage:"Upgrade to restore snapshots.",id:"historyModal.desktopModal.sidebar.upgradeMessage.tooltip"}),render:e=>n().createElement(Ka.Z,it()({isLarge:!0,onClick:()=>so.xx(this.environment),disabled:!i},e),a()(Te.FormattedMessage,{defaultMessage:"Restore version",id:"historyModal.desktopModal.restoreButton.label"}))}),a()(ja.Z,{isLarge:!0,style:{marginLeft:12},onClick:so.U4},void 0,a()(Te.FormattedMessage,{defaultMessage:"Cancel",id:"historyModal.desktopModal.cancelButton.label"}))),a()(Re.Z,{topBorder:!0,disableDesktopPadding:!0},void 0,a()(Ne.Z,{title:a()(Te.FormattedMessage,{id:"historyModal.desktopModal.learnMoreButton.label",defaultMessage:"Learn about page history"}),href:(0,We.UY)("guides.pageHistory"),analyticsFrom:"page_history"})))}renderDesktopSnapshotPreview(e){if(e.snapshot)return a()(o.Fragment,{},void 0,a()("div",{style:{display:"flex",alignItems:"center",flexShrink:0,height:45,fontSize:14,paddingLeft:14}},void 0,e.blockStore.hasIcon()&&a()(ri.Z,{disabled:!0,icon:e.blockStore.getIcon(),isEmptyPage:e.blockStore.isEmptyPage(),size:this.iconSize(),style:{marginRight:6}}),a()(Va.Z,{store:e.blockStore})),a()(yo,{blockStore:e.blockStore,timestamp:e.snapshot.timestamp}))}deviceSupportsUpgrade(e){const{device:t}=this.environment;return!t.isMobile||"personal"===e&&(0,wo.S)({environment:this.environment})}renderUnavailableMessage(e,t){const{device:i}=this.environment,s=Dt.default.state.data;let o=this.deviceSupportsUpgrade(t);const n=s&&Et.GJ(s);return o&&(0,wo.S)({environment:this.environment})&&"personal"===t&&!n&&(o=!1),a()("div",{style:this.getUnavailableMessageStyle()},void 0,this.deviceSupportsUpgrade(t)&&this.renderVersionHistoryIcon(),a()("div",{style:{...!i.isMobile&&{maxWidth:340}}},void 0,e),o&&t&&a()(Ka.Z,{isLarge:!0,onClick:()=>this.handleUpgrade(t),style:{marginTop:16}},void 0,a()(Te.FormattedMessage,{defaultMessage:"Upgrade",id:"historyModal.upgradeForHistoryButton.label"})))}renderVersionHistoryIcon(){return Bt.Z.versionHistory({width:64,height:"auto",fill:this.theme.lightIconColor,marginBottom:12})}renderMobileHelpButton(){return a()(Zo.Z,{href:(0,We.UY)("guides.pageHistory"),analyticsFrom:"page_history"})}snapshotIsAvailable(e){return!!pe.default.isAdminMode||!!this.historyIsEnabled()&&(!!Et.qb(this.environment,"enterprise")||parseInt(e.timestamp)>Date.now()-30*Us.A0)}historyIsEnabled(){return!!pe.default.isAdminMode||Et.t9(this.environment)}getUnavailableMessage(){return a()(o.Fragment,{},void 0,a()(Te.FormattedMessage,{defaultMessage:"Version history is not available for free workspaces.",id:"historyModal.unavailableForFreeWorkspaces.messagePart1"}),a()("br",{}),a()(Te.FormattedMessage,{defaultMessage:"Please upgrade to one of our paid plans.",id:"historyModal.unavailableForFreeWorkspaces.messagePart2"}))}getSidebarStyle(){return{display:"flex",flexDirection:"column",flexShrink:0,width:ko.sidebarWidth}}getUnavailableMessageStyle(){const{device:e}=this.environment;return{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",marginTop:28,padding:16,textAlign:"center",fontSize:14,...e.isMobile?{position:"relative",zIndex:1,background:this.theme.popoverBackground,boxShadow:"\n\t\t\t\t\t\t\t0 -1px 0 ".concat(this.theme.regularDividerColor,",\n\t\t\t\t\t\t\t0 1px 0 ").concat(this.theme.regularDividerColor,"\n\t\t\t\t\t\t")}:{height:"100%"}}}}d()(ko,"sidebarWidth",240),d()(ko,"restrictedMessage",a()(Te.FormattedMessage,{defaultMessage:"Please upgrade to the Enterprise Plan to access versions older than 30 days.",id:"historyModal.upgradeToEnterprise.message"})),d()(ko,"noSnapshotsMessage",a()(Te.FormattedMessage,{defaultMessage:"This page does not have any snapshots yet. Allow up to 10 minutes for the first snapshot to be generated.",id:"historyModal.noSnapshotsYet.message"})),d()(ko,"wrapStyle",{display:"flex",justifyContent:"center",padding:32});const Ao=(0,Te.injectIntl)(ko);var Po=i(43008);class Io extends u.Z{constructor(...e){super(...e),d()(this,"renderPopupContent",(()=>a()(Fo,{})))}renderComponent(){const{device:e}=this.environment,{blockStore:t,originRect:i}=Ma.Z.state;return a()(Be.ZP,{popupType:e.isMobile?Be.ZP.PopupType.SlideUp:Be.ZP.PopupType.Popup,open:Boolean(t),originRect:i,placementToOrigin:Be.ZP.Placement.Bottom,alignmentToOrigin:Be.ZP.Alignment.Center,originGap:4,onDismiss:()=>Po.x(this.environment),render:this.renderPopupContent})}}class xo extends u.Z{didMount(){const{blockStore:e}=Ma.Z.state;if(!e)return;const t=e.getTitleStore();t&&ui.mT({environment:this.environment,store:t,canSelectAllBlocks:!1})}renderComponent(){const{device:e}=this.environment,{blockStore:t}=Ma.Z.state;if(!t)return;const i=t.getTitleStore();if(!i)return;let s;return s=e.isMobile?{menuType:_e.ZP.MenuType.ActionSheet}:{menuType:_e.ZP.MenuType.Popup,width:380},n().createElement(_e.ZP,s,a()("div",{style:this.getWrapStyle()},void 0,a()(li.Z,{store:i,disabled:!t.canEdit(),onEsc:()=>Po.x(this.environment),onEnter:()=>Po.x(this.environment),disableSlashCommands:!0,disableEmojiCommands:!0,disableSelectAllBlocks:!0,disableSelectionDrag:!0,placeholder:this.props.intl.formatMessage({defaultMessage:"Untitled",id:"renameFileMenuPopup.input.placeholder"}),style:this.getInputStyle(),pasteBehavior:"inline"})))}getWrapStyle(){return{display:"flex",alignItems:"center",color:this.theme.regularTextColor,fontSize:"13px",padding:"4px 8px"}}getInputStyle(){return{display:"flex",alignItems:"center",flexGrow:1,fontSize:14,lineHeight:"20px",paddingTop:4,paddingBottom:4,paddingLeft:10,paddingRight:10,width:"100%",borderRadius:3,boxShadow:this.theme.inputBoxShadow,background:this.theme.inputBackground,cursor:"text",position:"relative"}}}const Fo=(0,Te.injectIntl)(xo),Bo=Io;var Eo=i(4727),Ro=i(88833);class Do extends u.Z{constructor(...e){super(...e),d()(this,"renderMenu",(()=>{const{device:e}=this.environment,t=Ro.Z.state;if(!t.open)return;let i;return i=e.isMobileNative&&!e.isTablet?{menuType:_e.ZP.MenuType.ActionSheet}:{menuType:_e.ZP.MenuType.Popup,width:410,maxHeight:270,onClickOutside:Eo.xv},n().createElement(_e.ZP,i,a()(Zt.Z,{filter:this.getFilter(t)||"",onSubmit:this.handleSubmit,onNoResults:this.handleNoResults,isCallout:!1}))})),d()(this,"handleNoResults",(()=>{const e=Ro.Z.state;if(!e.open)return;const t=this.getFilter(e),i=f().last(t);i&&/\s/g.test(i)&&Eo.xv()})),d()(this,"handleSubmit",(e=>{si.createAndCommit(this.environment,(t=>{Eo.RL({environment:this.environment,emoji:e,transaction:t})}))})),d()(this,"handleCancel",(()=>{Eo.xv()}))}willMountOrUpdate(){const e=Ro.Z.state;if(e.open){var t;const i=as.default.state,s=this.getFilter(e);("editing"!==i.mode||(null===(t=(0,Cs.QY)(i.multiSelection))||void 0===t?void 0:t.store)!==e.textStore||void 0===s||":"===s||s.startsWith("\n")||s.startsWith(" "))&&Eo.xv()}}renderComponent(){const{device:e}=this.environment,t=Ro.Z.state;let i=!1;if(t.open){const e=this.getFilter(t);e&&e.length>0&&(i=!0),t.showPopupWithEmptyFilter&&(i=!0)}return a()(Be.ZP,{popupType:e.isMobileNative&&!e.isTablet?Be.ZP.PopupType.SlideUp:Be.ZP.PopupType.Popup,open:i,originRect:t.open?t.selectionRect:void 0,placementToOrigin:Be.ZP.Placement.Bottom,alignmentToOrigin:Be.ZP.Alignment.Start,originGap:4,disableMouseCapture:!0,disableContentScroll:!0,onDismiss:this.handleCancel,render:this.renderMenu,keepFocus:!0})}getFilter(e){return Qi.zK(e.textStore,e.oldTextValue,!0)}}const _o=Do;var Lo=i(30366),Oo=i(36280),Uo=i(3702),No=i(73959),Vo=i(89086);class Wo extends u.Z{constructor(...e){super(...e),d()(this,"input",n().createRef()),d()(this,"handleInputChange",((e,t)=>{Ta.Z.isOpen()&&Ta.Z.setState({...Ta.Z.state,value:e,error:t})})),d()(this,"handleSubmit",(()=>{si.createAndCommit(this.environment,(e=>{Oo.gt({environment:this.environment,equationStore:Ta.Z,transaction:e})}))})),d()(this,"handleClose",(()=>{Oo.Wj()})),d()(this,"handleLeft",(e=>{if(!this.input.current)return;const t=this.input.current.getSelection();t&&"altKey"in e&&!e.altKey&&"shiftKey"in e&&!e.shiftKey&&0===t.startIndex&&0===t.endIndex&&(this.handleSubmit(),Oo.Wj(Ta.P.Backward))})),d()(this,"handleRight",(e=>{if(!Ta.Z.isOpen())return;if(!this.input.current)return;const t=this.input.current.getSelection();if(!t)return;const i=Ta.Z.state.value.length;"altKey"in e&&!e.altKey&&"shiftKey"in e&&!e.shiftKey&&t.startIndex===i&&t.endIndex===i&&(this.handleSubmit(),Oo.Wj())})),d()(this,"isDisabled",(()=>{var e;if("editing"!==as.default.state.mode&&!Ta.Z.isOpen())return!0;const t=Ta.Z.isOpen()?null===(e=(0,Cs.QY)(Ta.Z.state.savedTextSelectionState.multiSelection))||void 0===e?void 0:e.store:void 0;if(t&&!t.canEdit())return!0;if(t){const e=(0,No.J2)(t);if(e&&e.isLocked())return!0}if(t&&t.table===la.x_){const e=this.getCommentValue(t),{currentUserStore:i}=se.default.state;if(!e||!i)return!0;if(e.created_by_table!==os.KJ||i.id!==e.created_by_id)return!0}const i={[Ji.GK.User]:Ji.GK.User,[Ji.GK.Page]:Ji.GK.Page,[Ji.GK.Bot]:Ji.GK.Bot,[Ji.GK.Date]:Ji.GK.Date,[Ji.GK.ExternalObjectInstance]:Ji.GK.ExternalObjectInstance,[Ji.GK.TemporaryPage]:Ji.GK.TemporaryPage,[Ji.GK.TemplateVariable]:Ji.GK.TemplateVariable};for(const s of Object.values(i))if((0,Vo.J6)(s))return!0;return!1})),d()(this,"INPUT_ORIGIN_GAP_PX",8)}renderComponent(){if(!Ta.Z.isOpen())return;const e=!Ta.Z.isOpen(),t=this.isDisabled(),i=this.getInputOriginRect(),s=Ta.Z.state.value,o=Ta.Z.state.error;return a()(Ze.DependencyConsumer,{dependency:Ze.deps.prismjs},void 0,(a=>{if(!e)return n().createElement(Uo.Z,{Prism:a,ref:this.input,isOpen:!0,equationValue:s,error:o,displayMode:"inline",disabled:t,originRect:i,originGap:this.INPUT_ORIGIN_GAP_PX,onDismiss:this.handleClose,onChange:this.handleInputChange,onSubmit:this.handleSubmit,onLeft:this.handleLeft,onRight:this.handleRight})}))}getCommentValue(e){return Lo.Z.createChildStore(e,{table:la.x_,id:e.id,spaceId:(0,po.CG)(e.pointer.spaceId)}).getValue()}getInputOriginRect(){if(Ta.Z.isOpen())return Ta.Z.state.savedTextSelectionRect}}const zo=Wo;var Ho=i(22889);class qo extends u.Z{constructor(...e){super(...e),d()(this,"renderTooltip",(()=>a()(Le.Z,{capture:!0,onEnter:this.handleEnter,onCommandEnter:this.handleCommandEnter},void 0,n().createElement(n().Fragment,null,a()(Te.FormattedMessage,{defaultMessage:"Open page",id:"pageMentionOverlay.openPage"}),a()("div",{},void 0,a()(na.Z,{onlyShowFirst:!0,name:"enter",style:{color:this.theme.mediumInvertedTextColor}})))))),d()(this,"handleEnter",(e=>{const t=this.pageMentionTokenStore.state;if(!t)return;const{pageId:i,store:s}=t;if(!i)return;e.preventDefault&&e.preventDefault();const a=b.Z.createChildStore(s,{table:T.iU,id:i});ge.navigateToBlock({store:a,environment:this.environment,visitType:Ho.vu.Link})})),d()(this,"handleCommandEnter",(e=>{const t=this.pageMentionTokenStore.state;if(!t)return;const{pageId:i,store:s}=t;if(!i)return;e.preventDefault();const a=b.Z.createChildStore(s,{table:T.iU,id:i});ge.navigateToBlock({store:a,environment:this.environment,visitType:Ho.vu.Link,metaClick:!0})})),d()(this,"pageMentionTokenStore",this.createComputedStore((()=>{const e=as.default.state;if("editing"!==e.mode)return;const t=(0,Cs.QY)(e.multiSelection);if(!t)return;const{store:i,selection:s}=t;if(s.endIndex!==s.startIndex+1)return;const a=i.getValue(),o=Ji.b1(a,s.startIndex);if(!o||!Ji.eO(o))return;const[n]=Ji.jD([o]);return{pageId:n,store:i}})))}renderComponent(){if(this.environment.device.isMobile)return;const e=Xs.getSelectionRect(),t=this.pageMentionTokenStore.state;return a()(kt.Z,{render:()=>{},renderTooltip:this.renderTooltip,originRect:e,forceVisibleState:Boolean(t&&e),placement:kt.Z.Placement.Bottom})}}const Go=qo;var Ko=i(52989);class jo extends u.Z{constructor(...e){super(...e),d()(this,"handleKey",(e=>{R.Z.state.isActive&&(e.preventDefault(),(0,Ko.MZ)({environment:this.environment,currentX:R.Z.state.currentX,currentY:R.Z.state.currentY,toggle:e.shiftKey}))})),d()(this,"handleMouseMove",(e=>{R.Z.state.isActive&&(e.preventDefault(),(0,Ko.MZ)({environment:this.environment,currentX:e.clientX,currentY:e.clientY,toggle:e.shiftKey}))})),d()(this,"handleMouseUp",(e=>{R.Z.state.isActive&&(e.preventDefault(),(0,Ko.qw)(this.environment))}))}willMount(){window.addEventListener("keydown",this.handleKey),window.addEventListener("keyup",this.handleKey),window.addEventListener("mousemove",this.handleMouseMove),window.addEventListener("mouseup",this.handleMouseUp)}willUnmount(){window.removeEventListener("keydown",this.handleKey),window.removeEventListener("keyup",this.handleKey),window.removeEventListener("mousemove",this.handleMouseMove),window.removeEventListener("mouseup",this.handleMouseUp)}renderComponent(){return null}}const Yo=jo;var Qo=i(89940),Jo=i(58879),Xo=i(45990),$o=i(21325),en=i(64572),tn=i(59054),sn=i(64002),an=i(1941),on=i(64215),nn=i(66055),rn=i(1800);function ln(){const[e]=(0,Qo.oR)(pa.Z),t=(0,Jo.Fy)(),i=(0,Qo.VK)((()=>{if(!e.open)return!1;if(e.focusMenu)return!1;const t=as.default.state;if("editing"!==t.mode)return!0;const i=(0,Cs.QY)(t.multiSelection);if(!i)return!0;const{store:s,selection:a}=i;return(0,Vo.wd)(a)?!Ji.oP(s.getValue(),a.startIndex,a.endIndex,Ji.GK.Link):!(0,Cs._v)(t.multiSelection,e.savedTextSelectionState.multiSelection)}),[e]);return(0,o.useEffect)((()=>{i&&Xo.F5()}),[i]),a()(Be.ZP,{popupType:t.isMobile?t.isTablet?Be.ZP.PopupType.Popup:Be.ZP.PopupType.SlideUp:Be.ZP.PopupType.Popup,style:{width:330},keepFocus:t.isPhone,open:e.open,originRect:e.open?e.selectionRect:void 0,placementToOrigin:Be.ZP.Placement.Bottom,alignmentToOrigin:Be.ZP.Alignment.Center,originGap:8,disableContentScroll:!0,onDismiss:Xo.F5,render:()=>e.open?a()(dn,{state:e}):void 0})}function dn(e){const{state:t}=e,i=(0,Jo.MO)(),s=(0,Te.useIntl)(),r=s.formatMessage({defaultMessage:"Paste link or search pages",id:"selectionLinkButton.search.createNewLinkPlaceholder",description:"Placeholder text in the link input field when there is no current link"}),l=s.formatMessage({defaultMessage:"Edit link or search pages",id:"selectionLinkButton.search.editLinkPlaceholder",description:"Placeholder text in the link input field when there is an existing link that will be modified"}),[d,c]=(0,o.useState)(!0);if((0,o.useEffect)((()=>c(!1)),[]),t.showCreateIn&&!i)return a()(cn,{state:t});const u=!i||!t.showCreateIn,m=i?void 0:!t.showCreateIn&&t.focusMenu,p=t.editingToken?l:r,g=a()(Re.Z,{isInput:!0,desktopStyle:Sn(t)?{marginBottom:8}:void 0},void 0,u&&a()(De.Z,{onFocus:vn,placeholder:p,value:t.url,onChange:fn,focus:m,focusInitial:i,focusAfterAnimation:!0,preventCaptureArrowShortcuts:!0}));let h;return h=i?{menuType:_e.ZP.MenuType.Modal,title:a()(Te.FormattedMessage,{defaultMessage:"Link",id:"selectionLinkButton.mobile.title"}),right:a()(Ve.CancelMenuText,{}),onClickRight:Xo.F5,header:g,footer:a()(Be.ZP,{popupType:Be.ZP.PopupType.SlideUp,open:t.showCreateIn||!1,render:()=>a()(cn,{state:t})})}:{menuType:_e.ZP.MenuType.Popup,header:g},a()(Ia.Z,{capture:t.open&&(d||t.focusMenu),allowEsc:!0},void 0,n().createElement(_e.ZP,h,a()(un,{state:t})),a()(Le.Z,{capture:!0,onCommandSlash:vn}))}function cn(e){var t;const{state:i}=e,s=(0,Jo.O7)(),n=(0,o.useCallback)((async e=>{var t;if(!$o.M_(s))return;const a=null===(t=(0,Cs.QY)(i.savedTextSelectionState.multiSelection))||void 0===t?void 0:t.store;if(!a)return;const o=si.create(s),n=(0,ls.f8)({environment:s,transaction:o,titleText:i.url||"",createInValue:e,recordStoreParent:a}),[r]=n.createdPages;r&&Xo.gp({environment:s,url:(0,en.nR)({pageId:r.id}),transaction:o,editingToken:i.editingToken,savedTextSelectionState:i.savedTextSelectionState}),await n.moveToStorePromise,await si.commit({environment:s,transaction:o}),await(0,ls.c_)({analyticsFrom:"link_menu",createInState:n})}),[i,s]),r=null===(t=(0,Cs.QY)(i.savedTextSelectionState.multiSelection))||void 0===t?void 0:t.store,l=r&&"block"===r.table?r.id:void 0;return a()(Yi.Z,{targets:[],isAddTo:!0,isCreateIn:!0,onAccept:n,captureSelection:!1,restoreSelection:!1,parentBlockId:l,onAutocompleteQueryChange:mn,autocompleteQuery:i.createInQuery||"",desktopWidth:(0,ms.bq)()?400:330,onCancel:gn})}function un(e){var t;const{state:i}=e,s=(0,Jo.O7)(),r=(0,Jo.MO)(),l=(0,on.F)(),[{online:d}]=(0,Qo.oR)(es.Z),c=(0,o.useMemo)((()=>Mn(i)),[i]),u=(0,o.useMemo)((()=>bn(c)),[c]),m=(0,o.useMemo)((()=>{var e;const t=null===(e=(0,Cs.QY)(i.savedTextSelectionState.multiSelection))||void 0===e?void 0:e.store;if(t&&(0,Ce.NZ)(t))return t}),[i]),[{value:p,status:g}]=(0,tn.r5)((async()=>{if(!c||!d)return[];return(await(0,Wt.WL)({nearBlock:m,environment:s,query:c,source:"mention_menu",limit:10})).map((e=>e.id))}),[c,m,s,d]),h=(0,o.useMemo)((()=>{if(u&&"notion"===u.type){const e=p?f().without(p,u.notionPage.blockId):[];return[u,...e]}return p}),[p,u]),v=(0,o.useMemo)((()=>{if(!h||0===h.length)return;if(u&&"web"===u.type&&u.url===c)return;const e=U.Z.withListenerIgnored(E.RM);if(!e)return;const t=i.url?5:3,o=a()(Te.FormattedMessage,{id:"selectionLinkButton.linkToPage.linkToBlock",defaultMessage:"Link to block",description:"Shown beneath a page title if linking to a block inside that page"}),r=a()(Te.FormattedMessage,{defaultMessage:"Link to page",id:"selectionLinkButton.linkToPageSection.title"}),l=f().compact(h.map((t=>{const r="object"==typeof t?t.notionPage.peekViewBlockId||t.notionPage.blockId:t,l=b.Z.createChildStore(e,{table:T.iU,id:r});return{key:r,action:()=>{if("object"==typeof t){const e=(0,en.nR)({pageId:t.notionPage.blockId,peekViewBlockId:t.notionPage.peekViewBlockId,discussionId:t.notionPage.discussionId,collectionViewId:t.notionPage.collectionViewId,scrollToBlockId:t.notionPage.scrollToBlockId});hn(s,i,e)}else hn(s,i,(0,en.nR)({pageId:r}))},render:e=>{const i="object"==typeof t&&t.notionPage.scrollToBlockId;return n().createElement(Gi.Z,it()({},e,{store:l,caption:i?o:void 0,placeholder:a()(ji.Z,{showHold:300,showDelay:300,show:"resolved"===g,render:e=>a()(Te.FormattedMessage,e?{id:"selectionLinkButton.linkToPage.unknownBlock",defaultMessage:"Unknown block"}:{id:"selectionLinkButton.linkToPage.loading",defaultMessage:"Loading..."})})}))}}}))).slice(0,t),d=h.some((e=>Boolean("object"==typeof e&&e.notionPage.scrollToBlockId)));return{key:"mention results",items:l,render:e=>n().createElement(Re.Z,it()({},e,{title:d?r:o,isTitleUppercase:!0}))}}),[h,i,s,c,u,g]),y=(0,o.useMemo)((()=>{const e=a()(Te.FormattedMessage,{defaultMessage:"Linked to",id:"selectionLinkButton.linkedToSection.title"}),t=yn(i),o=t?(0,en.A5)({url:t,baseUrl:pe.default.domainBaseUrl,publicDomainName:pe.default.publicDomainName}):void 0;if(o&&t){const i=U.Z.withListenerIgnored(E.RM);if(!i)return;const a=b.Z.createChildStore(i,{table:T.iU,id:o});return{key:"linked to",render:t=>n().createElement(Re.Z,it()({title:e,isTitleUppercase:!0},t)),items:[{key:"linked to page",action:({event:e})=>{const i=e&&e.metaKey;i||pa.Z.setState({open:!1}),(0,ge.navigate)({environment:s,url:t,metaClick:i})},render:e=>n().createElement(Gi.Z,it()({},e,{store:a}))}]}}if(t)return{key:"linked to",render:t=>n().createElement(Re.Z,it()({title:e,isTitleUppercase:!0},t)),items:[{key:"linked to web",action:({event:e})=>(0,ge.navigate)({environment:s,url:t,metaClick:e&&e.metaKey}),render:e=>n().createElement(qt.Z,it()({},e,{title:t,caption:a()(Te.FormattedMessage,{defaultMessage:"Web page",id:"selectionLinkButton.linkedToSection.webPage"}),icon:Bt.Z.globe2({width:16,fill:l.mediumIconColor})}))}]}}),[s,i,l]),M=(0,o.useMemo)((()=>{if(!u)return;if("notion"===u.type&&d)return;let e;return"web"===u.type?e=a()(Te.FormattedMessage,{id:"selectionLinkButton.linkToWebPage",defaultMessage:"Link to web page"}):"notion"===u.type?e=a()(Te.FormattedMessage,{id:"selectionLinkButton.linkToPage",defaultMessage:"Link to page"}):"other"===u.type?e=a()(Te.FormattedMessage,{id:"selectionLinkButton.linkToURL",defaultMessage:"Link to URL"}):(0,Ys.t1)(u),{key:"link to url",action:()=>hn(s,i,c),render:t=>n().createElement(qt.Z,it()({},t,{title:e,icon:Bt.Z.link({width:16})}))}}),[i,c,s,d,u]),S=(0,o.useMemo)((()=>{if(i.editingToken)return{key:"copy link",action:()=>function(e,t){const i=yn(t);if(!i)return;const s=(0,en.A5)({url:i,baseUrl:pe.default.domainBaseUrl,publicDomainName:pe.default.publicDomainName}),a=s?(0,rn.Z)({pageId:s,baseUrl:pe.default.domainBaseUrl}):i;nn.RD({environment:e,stringValue:a,copiedMessage:nn.tq.copiedLinkToClipboard}),Xo.F5()}(s,i),render:e=>n().createElement(qt.Z,it()({},e,{title:a()(Te.FormattedMessage,{id:"selectionLinkButton.copyLink",defaultMessage:"Copy link",description:"Copies the URL for the focused link to the user's clipboard"}),icon:Bt.Z.copy({width:16})}))}}),[i,s]),C=(0,o.useMemo)((()=>{if(i.editingToken)return{key:"unlink",action:()=>Xo.PP(s),render:e=>n().createElement(qt.Z,it()({},e,{title:a()(Te.FormattedMessage,{id:"selectionLinkButton.removeLink",defaultMessage:"Remove link"}),icon:Bt.Z.trash({width:16})}))}}),[i.editingToken,s]),Z=null===(t=(0,Cs.QY)(i.savedTextSelectionState.multiSelection))||void 0===t?void 0:t.store,w=(0,o.useMemo)((()=>{if(!c)return;if(!Z||!Z.isDefaultRecordCache())return;const e=bn(c);return!e||e.url!==c&&!e.notionPage?{key:"create page",action:pn,render:e=>n().createElement(qt.Z,it()({},e,{icon:Bt.Z.alias({width:16}),title:a()(gs,{pageTitle:c})}))}:void 0}),[c,Z]),k=f().compact([v,y]),A=k.length>0,P=(0,o.useMemo)((()=>{const e=f().compact([M,S,C,w]);if(0!==e.length)return{key:"link actions",render:e=>n().createElement(Re.Z,it()({topBorder:A},e)),items:e}}),[A,M,S,C,w]),I=f().compact([...k,P]),x=(0,o.useMemo)((()=>{if(r)return;if(!u||!P||!M)return 0===I.length?void 0:0;const e=f().sum(k.map((e=>e.items.length)))+P.items.indexOf(M);return Math.max(e,0)}),[r,u,P,M,I,k]);return a()(Hi.Z,{type:Hi.Z.Type.Vertical,initialFocus:x,sections:I})}function mn(e){const t=pa.Z.state;t.open&&pa.Z.setState({...t,createInQuery:e})}function pn(){const e=pa.Z.state;e.open&&pa.Z.setState({...e,showCreateIn:!0})}function gn(){const e=pa.Z.state;e.open&&pa.Z.setState({...e,showCreateIn:!1,createInQuery:""})}function hn(e,t,i){const s=(0,an.Z)(i);s&&(si.createAndCommit(e,(i=>{Xo.gp({environment:e,transaction:i,url:s,editingToken:t.editingToken,savedTextSelectionState:t.savedTextSelectionState})})),Ee.bOx(e,{pastedText:s,source:"link_menu"}))}const fn=e=>{const t=pa.Z.state;t.open&&pa.Z.setState({...t,url:e.target.value,focusMenu:!0})};function vn(){const e=pa.Z.state;e.open&&(e.focusMenu||pa.Z.setState({...e,focusMenu:!0}))}function yn(e){const{editingToken:t}=e;if(!t)return;const i=Ji.hD(t),s=Ji.rl(i);return s?Ji.zW(s):void 0}function Mn(e){return e.url||""}function Sn(e){return""===Mn(e)&&void 0===yn(e)}function bn(e){const t=Ji.rO(e);if(t&&"url"===t.type){const e=(0,Vs.Wj)({url:t.href,baseUrl:pe.default.domainBaseUrl,publicDomainName:pe.default.publicDomainName,isMobile:!1,protocol:void 0,currentUrl:void 0});return"page"===e.name?{type:"notion",url:t.href,notionPage:e}:{type:"web",url:t.href}}const i=(0,sn.yn)(e);if(i)return{type:"other",url:i}}var Tn=i(48588),Cn=i(96049),Zn=i(29551),wn=i(66673),kn=i(25103),An=i(88804);function Pn(e){const t=(0,Qo.Kw)(Cn.Z,{debugName:"HoverPreviewOverlay"}),{state:i,pinPopup:s,unpinPopup:n,hasBeenHovering:r}=function(){const[e]=(0,Qo.oR)(Tn.Z),t=(0,wn.Kt)(e,400,Object.is),[i,s]=(0,o.useState)(void 0),a=i||t,n=(0,o.useCallback)((()=>s(a)),[a]),r=(0,o.useCallback)((()=>{s(void 0)}),[]);return{state:a,pinPopup:n,unpinPopup:r,hasBeenHovering:e&&e===a}}(),l=function(e){const t=(0,Jo.O7)();return(0,Qo.VK)((()=>!!e&&(0,An.E)(t,e.store)),[e,t])}(i),d=(0,o.useMemo)((()=>Boolean(i&&function(e,t){return t&&Boolean(e.annotations.find(Ji.j0))}(i,l))),[i,l]),c=!!d||Boolean(!t&&r),u=(0,o.useMemo)((()=>i&&i.token.node.getBoundingClientRect()),[i]);return a()(Be.ZP,{disableMouseCapture:!0,preventCaptureEsc:!0,preventPointerEvents:!d,preventScaleTransition:!0,preventOpacityTransition:!0,popupType:Be.ZP.PopupType.Popup,open:c,originRect:u,originGap:8,alignmentToOrigin:Be.ZP.Alignment.Start,placementToOrigin:Be.ZP.Placement.Bottom,useLightBoxShadow:!0,render:()=>i&&a()("div",{onMouseEnter:s,onMouseLeave:n},void 0,a()(In,{state:i,isHoveredTokenEditable:l,onDismiss:n}))})}function In(e){(0,o.useEffect)((()=>{const e=f().throttle(kn.l,200,{leading:!0});return S.l(window,"scroll",e,!0),()=>S.Z(window,"scroll",e,!0)}),[]);const t=e.state.annotations,i=t.find(Ji.j0),s=t.find(Ji.fp),a=t.find(Ji.aq);return i?n().createElement(xn,it()({},e,{state:{...e.state,annotation:i}})):s?n().createElement(Fn,it()({},e,{state:{...e.state,annotation:s}})):a?n().createElement(Bn,it()({},e,{state:{...e.state,annotation:a}})):null}function xn(e){const{onDismiss:t}=e,{annotation:i,store:s,token:n}=e.state,r=(0,Jo.O7)(),l=Ji.zW(i),d=(0,en.A5)({url:l,baseUrl:pe.default.domainBaseUrl,publicDomainName:pe.default.publicDomainName}),c=(0,o.useCallback)((async()=>{t(),ds.AE({token:n,store:s,readOnly:!1}),await L.default.afterNextFlush(),Xo.dz({type:"focusOnly",focus:!0})}),[t,s,n]),u=(0,on.y)((e=>({wrapper:{fontSize:ct.Z.fontSize.UIRegular.desktop,color:e.mediumTextColor,fontWeight:ct.Z.fontWeight.regular,fill:e.mediumIconColor},destination:{padding:"4px 0 4px 6px"},button:{display:"flex",alignItems:"center",padding:"2px 6px",whiteSpace:"nowrap",marginRight:2,borderRadius:3,color:e.regularTextColor},destinationText:{paddingRight:6,maxWidth:250,...ct.Z.textOverflowStyle},icon:{height:"1em",width:"1em",marginRight:"0.25em",fill:e.mediumIconColor}})),[]),m=(0,Qo.VK)((()=>{if(!d)return;const e=b.Z.createChildStore(s,{table:T.iU,id:d});return{pageIcon:(0,ns.tp)({pageValue:e.getValue(),pageRole:e.getRole(),baseUrl:pe.default.domainBaseUrl,getRecordValue:s.getRecordValue,emojiType:(0,rs.e)(r),isSafariOrIOS:r.device.isSafari||r.device.isIOS,isClient:!0,showEmojiInline:r.device.isWindows,currentUserId:r.currentUser.id,deeperDarkEnabled:(0,gi.GN)(),theme:r.ThemeModeStore.state}),title:a()(Va.Z,{style:u.destinationText,store:e})}}),[r,s,d,u])||{pageIcon:Bt.Z.globe2(u.icon),title:a()("div",{style:u.destinationText},void 0,l)};return a()(Zn.gq,{style:u.wrapper,alignItems:"center"},void 0,a()(Zn.gq,{style:u.destination,alignItems:"center"},void 0,m.pageIcon,m.title),e.isHoveredTokenEditable&&a()(Lt.Z,{style:u.button,onClick:c},void 0,a()(Te.FormattedMessage,{defaultMessage:"Edit",id:"hoverPreviewOverlay.editButton.label"})))}function Fn(e){const{annotation:t}=e.state,i=Ji.Ot(t),s=(0,on.y)((e=>({container:{fontSize:ct.Z.fontSize.UISmall.desktop,color:e.mediumTextColor,padding:"4px 8px"},icon:{height:"1em",width:"1em",marginRight:"0.25em",fill:e.mediumIconColor}})),[]),o=(0,Te.useIntl)(),n="relative"===i.date_format?"ll":"relative",r=(0,$i.ZV)({value:i,date_format:n,time_format:"h:mm A",allowRelativeDates:!0,intl:o});return r===(0,$i.ZV)({value:i,date_format:i.date_format,time_format:i.time_format,allowRelativeDates:!0,intl:o})?null:a()(Zn.gq,{style:s.container,alignItems:"center"},void 0,Bt.Z.calendar(s.icon),a()("div",{style:ct.Z.textOverflowStyle},void 0,r))}function Bn(e){const{annotation:t}=e.state,i=Ji.fs(t),s=(0,Te.useIntl)(),o=Ji.Z0(i.type,s),n=(0,on.y)((e=>({container:{fontSize:ct.Z.fontSize.UISmall.desktop,color:e.mediumTextColor,padding:"4px 8px"}})),[]);return a()(Zn.gq,{style:n.container,alignItems:"center"},void 0,a()("div",{style:ct.Z.textOverflowStyle},void 0,o))}var En=i(79554),Rn=i(61207),Dn=i(62965);const _n=(0,Te.defineMessages)({createTransclusion:{defaultMessage:"Paste and sync",id:"blockPasteMenu.actions.createTransclusion.title"},linkToPage:{defaultMessage:"Link to page",id:"blockPasteMenu.actions.linkToPage.title"},dismissItem:{defaultMessage:"Dismiss",id:"blockPasteMenu.actions.dismiss.title"}});class Ln extends u.Z{constructor(...e){super(...e),d()(this,"renderMenu",(()=>{const{device:e}=this.environment,t=Rn.Z.state;if(!t.open)return;const i=this.getSections(t);let s;return s=e.isMobile?{menuType:_e.ZP.MenuType.ActionSheet}:{menuType:_e.ZP.MenuType.Popup,width:320,maxHeight:"40vh"},n().createElement(_e.ZP,it()({},s,{className:Kt.sr}),a()(Hi.Z,{type:Hi.Z.Type.Vertical,sections:i,initialFocus:0}))})),d()(this,"handleDismiss",(()=>{En.xv()}))}willMountOrUpdate(){const e=Rn.Z.state;if(e.open){const{stores:t,phase:i}=Z.default.state;(0,Dn.Z)(t,e.blocks)&&i===Z.SelectionPhase.Selected||En.xv()}}renderComponent(){const{device:e}=this.environment,t=Rn.Z.state;return a()(Be.ZP,{popupType:e.isMobileNative&&!e.isTablet?Be.ZP.PopupType.SlideUp:Be.ZP.PopupType.Popup,open:t.open,originRect:t.open?t.rect:void 0,placementToOrigin:Be.ZP.Placement.Bottom,alignmentToOrigin:Be.ZP.Alignment.End,originGap:4,disableMouseCapture:!0,disableContentScroll:!0,disableDarkOverlayBackground:e.isMobile,keepFocus:e.isMobile,render:this.renderMenu,onDismiss:this.handleDismiss})}getSections(e){const{blocks:t}=e,i=[];if("blocks"===e.type){const{copiedStores:s,pageSource:a}=e;En.H8({blocks:t,copiedStores:s})&&i.push({name:jt.default.formatMessage(_n.createTransclusion),action:async()=>{await En.ry({environment:this.environment,blocks:t,copiedBlockIds:s.map((e=>e.id))})}}),En.wK({blocks:t})&&i.push({name:jt.default.formatMessage(_n.linkToPage),action:async()=>En.Dq({environment:this.environment,blocks:t,source:{type:"blocks",copiedStores:s,pageSource:a}})})}"links"===e.type&&i.push({name:jt.default.formatMessage(_n.linkToPage),action:async()=>En.Dq({environment:this.environment,blocks:t,source:{type:"links",copiedLinks:e.copiedLinks}})});return[{key:"embed section",render:e=>n().createElement(Re.Z,e),items:[{key:"dismiss",render:e=>n().createElement(qt.Z,it()({},e,{title:jt.default.formatMessage(_n.dismissItem)})),action:this.handleDismiss},...i.map((({name:e,action:t})=>({key:"embed ".concat(e),render:t=>n().createElement(qt.Z,it()({},t,{title:e})),action:t})))]}]}}const On=Ln;var Un=i(1310),Nn=i(28240),Vn=i(39134),Wn=i(12318);class zn extends u.Z{constructor(...e){super(...e),d()(this,"showingAnimatedList",new Wn.Z(!1)),d()(this,"handleShow",(()=>{this.showingAnimatedList.set(!0)})),d()(this,"handleHide",(()=>{this.showingAnimatedList.set(!1)}))}renderComponent(){const{currentItem:e}=Un.Z.state,t=Boolean(e||this.showingAnimatedList.get());return a()(Xe.Z,{open:t,render:()=>a()(Vn.Z,{render:()=>f().compact([this.renderCurrentItem()]),onShow:this.handleShow,onHide:this.handleHide})})}renderCurrentItem(){const{currentItem:e}=Un.Z.state;if(e)return a()(rt.Z,{isVisible:!0,enterAnimationStyle:{translateY:50,opacity:1,scale:1},animationStyle:{translateY:0,opacity:1,scale:1},exitAnimationStyle:{translateY:0,opacity:0,scale:.95},render:()=>a()("div",{style:{position:"fixed",bottom:24,left:0,width:"100%",display:"flex"}},void 0,a()("div",{style:{background:this.theme.tooltipBackground,color:this.theme.regularInvertedTextColor,borderRadius:3,padding:"6px 12px",boxShadow:this.theme.largeBoxShadow,margin:"0 auto",fontSize:14,display:"flex",alignItems:"center"}},void 0,e.label,e.helpUrl&&a()(Nn.Z,{href:e.helpUrl,external:!0,style:{marginLeft:8,width:16,height:16}},void 0,Bt.Z.help({fill:this.theme.mediumInvertedTextColor})),e.button))},e.key)}}const Hn=zn;var qn=i(1634),Gn=i(92452),Kn=i(4926),jn=i(37181),Yn=i(89475);class Qn extends u.Z{constructor(...e){super(...e),d()(this,"handleConnectClick",(async()=>{const e=qn.Z.state,{currentSpaceStore:t}=se.default.state;e.open&&t&&(await(0,Yn.h)({environment:this.environment,integration:e.integration,spaceId:t.id,unfurlUrl:e.unfurlUrl,externalObjectInstanceBlockId:e.externalObjectInstanceBlockId}),this.markPopupAsDismissed(e.integration.id),Ee.IvM(this.environment,{integrationId:e.integration.id,from:"external_object_instance_inline_popup"}),qn.Z.reset())})),d()(this,"handleCloseClick",(()=>{const e=qn.Z.state;e.open&&this.markPopupAsDismissed(e.integration.id),qn.Z.reset()})),d()(this,"markPopupAsDismissed",(e=>{const{currentUserSettingsStore:t}=se.default.state;t&&(0,si.createAndCommit)(this.environment,(i=>{jn.GK({transaction:i,userSettingsStore:t,integrationId:e})}))}))}renderComponent(){const e=qn.Z.state;if(!e.open)return;const t=e.integration.info.icon;return t?a()("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",cursor:"default",padding:16,background:this.theme.popoverBackground,borderRadius:3,boxShadow:this.theme.lightBoxShadow,position:"absolute",bottom:65+Kn.Z.state,right:16+Kn.Z.state,width:240,zIndex:nt.hT,clipPath:"inset(-10px -10px -10px -10px)"}},void 0,a()(Gn.Z,{type:"image_url",imageURL:t,size:38,style:{marginBottom:6}}),a()("div",{style:{color:this.theme.regularTextColor,fontSize:14,fontWeight:ct.Z.fontWeight.semibold,marginBottom:6,textAlign:"center"}},void 0,a()(Te.FormattedMessage,{id:"inlineUnfurlingAuthenticationPopup.title",defaultMessage:"Connect to {integration}",values:{integration:e.integration.name}})),a()("div",{style:{color:this.theme.mediumTextColor,fontSize:12,marginBottom:8,textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"}},void 0,a()(Te.FormattedMessage,{id:"inlineUnfurlingAuthenticationPopup.caption",defaultMessage:"Sign in to show richer content previews that update live."}),a()(Ht.Z,{href:(0,We.UY)("guides.unfurling"),external:!0},void 0,a()(Te.FormattedMessage,{id:"inlineUnfurlingAuthenticationPopup.learnMore.text",defaultMessage:"Learn more"}))),a()(Ka.Z,{onClick:this.handleConnectClick,style:{width:"100%"}},void 0,a()(Te.FormattedMessage,{id:"inlineUnfurlingAuthenticationPopup.connectButton",defaultMessage:"Connect"})),a()(mi.Z,{icon:Bt.Z.close,onClick:this.handleCloseClick,style:{position:"absolute",top:6,right:6}})):void 0}}const Jn=(0,Te.injectIntl)(Qn);class Xn extends u.Z{willMount(){this.environment.device.isMobile&&document.addEventListener("gesturestart",(function(e){e.preventDefault()}))}renderComponent(){const e=this.environment.currentUser.isLoggedIn(),{isMobile:t,isElectron:i}=this.environment.device,{currentSpaceStore:s}=se.default.state;return a()(o.Fragment,{},void 0,a()(Ie,{}),a()(Bi,{}),a()(Oi,{}),a()(Wi,{}),a()(g,{}),a()(r.Z,{priority:-1,capture:!0}),a()(te,{}),e&&!t&&a()(le,{}),e&&s&&a()(ke,{rootStore:s}),a()(et,{}),a()(oi,{}),a()(qe,{}),a()(yi,{}),a()(Bo,{}),a()(yt,{}),a()(Qe,{}),!t&&a()(Aa,{}),a()(zo,{}),a()(Go,{}),a()(ti,{}),a()(Mi.Z,{store:x.Z}),a()(Mi.Z,{store:I.Z}),a()(Ps,{}),a()(Ds,{}),a()(_o,{}),a()(Gs,{}),a()(Js,{}),a()(Jn,{}),a()(On,{}),a()(Hn,{}),a()(ln,{}),i&&a()(Ba,{}),a()(_a,{}),a()(Ja,{}),a()(io,{}),a()(Yo,{}),e&&a()(Ao,{}),a()(Pn,{}))}}const $n=Xn},75801:(e,t,i)=>{i.r(t),i.d(t,{default:()=>Ne});var s=i(67154),a=i.n(s),o=i(98135),n=i.n(o),r=i(59713),l=i.n(r),d=(i(33948),i(96486)),c=i.n(d),u=i(67294),m=i.n(u),p=i(27006),g=i(66055),h=i(3779),f=i(76464),v=i(81997),y=i(9714),M=i(84210),S=i(38978),b=i(66832),T=i(23596),C=i(592),Z=i(71202),w=i(52377),k=i(8646),A=i(37235),P=i(40039),I=i(79029),x=i(82990),F=i(19889),B=i(56109),E=i(1643),R=i(16639),D=i(41892),_=i(32739),L=i(27832),O=i(88632),U=i(78291),N=i(95477),V=i(47966),W=i(43250),z=i(67669),H=i(26825),q=i(14947),G=i(90031),K=i(77420),j=i(60442),Y=i(46951),Q=i(84882),J=i(47307),X=i(5366),$=i(28020),ee=i(15282),te=i(42001),ie=i(46247),se=i(33665),ae=i(38755),oe=i(12318),ne=i(28240),re=i(53009),le=i(86512),de=i(50906),ce=i(92251);class ue extends b.Z{renderComponent(){const{device:e,WindowSizeStore:t}=this.environment;return n()(le.Z,{href:(0,se.UY)("guides.sharing"),onClick:()=>de.Fsx(this.environment,{from:"sharing"}),style:{width:e.isMobile?"100%":void 0},external:!0},void 0,n()(te.Z,{mobileFeedback:e.isMobile,isSmall:!0,style:{display:"flex",alignItems:"center",width:e.isMobile?"100%":void 0,height:e.isMobile?44:24,paddingTop:e.isMobile?12:4,paddingBottom:e.isMobile?12:4,paddingLeft:t.getSafePaddingLeftCSS(8),paddingRight:t.getSafePaddingRightCSS(12)}},void 0,n()("div",{style:{marginLeft:e.isMobile?2:0,marginRight:e.isMobile?8:6}},void 0,h.Z.help({width:e.isMobile?16:14,height:e.isMobile?16:14,fill:e.isMobile?this.theme.mediumIconColor:this.theme.lightIconColor})),n()(Y.Z,{isSmall:!0,isMobile:e.isMobile,isSecondaryColor:!e.isMobile},void 0,(0,ce.bq)()?n()(X.FormattedMessage,{defaultMessage:"Learn more",id:"blockPermissionsSettings.learnMore.prompt"}):n()(X.FormattedMessage,{defaultMessage:"Learn about sharing",id:"blockPermissionsSettings.learnAboutSharing.prompt"}))))}}const me=ue;var pe=i(41493),ge=i(617),he=i(29368),fe=i(49481),ve=i(21202),ye=i(77907),Me=i(89940),Se=i(81236),be=i(91376),Te=i(8848),Ce=i(64215),Ze=i(58879);function we(e){const{permissionItemWrapStyle:t,safePaddingRightCSS:i,safePaddingLeftCSS:s}=e,[{publicSpaceDataMap:a}]=(0,Me.oR)(Se.Z),o=(0,Ce.F)(),{isMobile:r}=(0,Ze.Fy)(),{canChangeSettings:l,currentSpaceId:d}=(0,Me.VK)((()=>{var e,t;return{canChangeSettings:null===(e=L.default.state.currentSpaceStore)||void 0===e?void 0:e.canAdmin(),currentSpaceId:null===(t=L.default.state.currentSpaceStore)||void 0===t?void 0:t.id}}),[]);if(r)return null;if(!d)return null;const c=a[d];if(!c)return null;return c.domainIsAutogenerated&&l?n()("span",{style:{...t,display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",textAlign:"center",padding:"8px 8px",paddingLeft:s,paddingRight:i,color:o.mediumTextColor,backgroundColor:o.inputBackground}},void 0,n()("div",{style:{display:"flex"}},void 0,n()(Y.Z,{isSmall:!0,isMobile:!1,isSecondaryColor:!0,style:{paddingRight:"4px"}},void 0,n()(X.FormattedMessage,{defaultMessage:"Set a domain for your public links in",id:"blockPermissionsSettings.learnAboutAutogeneratedDomains.setDomainForPublicLinks"})),n()("span",{style:{cursor:"pointer",userSelect:"none",WebkitUserSelect:"none",color:Te.ZP.inherit},onClick:()=>{be.r({currentTab:"settings"})}},void 0,n()(Y.Z,{isSmall:!0,isMobile:!1,isSecondaryColor:!1,style:{textDecoration:"underline"}},void 0,n()(X.FormattedMessage,{defaultMessage:"Settings",id:"blockPermissionsSettings.learnAboutAutogeneratedDomains.openSettingsCTA"}))))):null}var ke=i(97880),Ae=i(52016);class Pe extends Ae.Z{getInitialState(){return{selectedTab:0}}}const Ie=Pe;var xe=i(15070),Fe=i(42330),Be=i(73935),Ee=i.n(Be),Re=i(29716),De=i(29369),_e=i(64684),Le=i(97373);class Oe extends b.Z{constructor(...e){super(...e),l()(this,"sidebarState",this.createComputedStore((()=>(0,$.vK)(this.environment)))),l()(this,"storeTypes",{restrictConfirmationModalStore:oe.Z.of({open:!1,onClose:void 0}),blockPermissionsSettingsStore:Ie}),l()(this,"renderBotPermissionTooltip",(()=>n()(j.Z,{imageWidth:240,caption:n()(X.FormattedMessage,{defaultMessage:"This is an integration in your workspace.",id:"blockPermissionsSettings.botPermission.tooltip"})}))),l()(this,"renderPublicPermissionTooltip",(()=>n()(j.Z,{imageURL:D.Z.images.tooltips.share.publicPagePng,imageWidth:240,imageHeight:120,caption:n()(X.FormattedMessage,{defaultMessage:"Anybody with the link can access the page.",id:"blockPermissionsSettings.publicPermission.tooltip"})}))),l()(this,"renderSpacePermissionTooltip",(()=>n()(j.Z,{imageURL:D.Z.images.tooltips.share.workspacePng,imageWidth:240,imageHeight:180,caption:n()(X.FormattedMessage,{defaultMessage:"For all members in your workspace, this page will show up in the <boldtext>Workspace</boldtext> section in their sidebar.",values:{boldtext:(...e)=>n()("span",{style:{fontWeight:x.Z.fontWeight.bold}},void 0,e)},id:"blockPermissionsSettings.spacePermission.tooltip"})}))),l()(this,"renderTeamPermissionTooltip",((e,t)=>n()(j.Z,{imageURL:void 0,imageWidth:240,imageHeight:180,caption:n()(X.FormattedMessage,{defaultMessage:"Applies to all non-guest team members ({memberCount} total) of {teamName}.",values:{teamName:e.name,memberCount:t},id:"blockPermissionsSettings.teamPermission.tooltip"})}))),l()(this,"renderGroupPermissionTooltip",(e=>{const{currentSpaceStore:t}=L.default.state,{countRemainingUsers:i,limitedUserValues:s}=R.r({group:e,spaceStore:t,limit:15});if(s.length>0)return n()("div",{style:{marginBottom:4}},void 0,s.map((e=>n()("div",{style:{display:"flex",alignContent:"flex-end",minWidth:140,width:"100%",marginTop:4}},e.id,n()(pe.Z,{style:{flexGrow:1},userValue:e,avatarSize:18})))),i>0&&n()("div",{style:{marginLeft:2,marginTop:2,color:this.theme.mediumInvertedTextColor}},void 0,n()(X.FormattedMessage,{id:"blockPermissionsSettings.groupPermissionUsers.tooltip",defaultMessage:"{countRemainingUsers} more…",values:{countRemainingUsers:i}})));const a=(0,R.k)({intl:this.props.intl,group:e});return n()(j.Z,{imageURL:D.Z.images.tooltips.share.sharedPng,imageWidth:240,imageHeight:120,caption:n()(X.FormattedMessage,{defaultMessage:"For all members of the {groupName} group, this page will show up in the <boldtext>Shared</boldtext> section in their sidebar.",values:{boldtext:(...e)=>n()("span",{style:{fontWeight:x.Z.fontWeight.bold}},void 0,e),groupName:a},id:"blockPermissionsSettings.groupPermission.tooltip"})})})),l()(this,"renderUserPermissionItem",(e=>{const{store:t}=this.props,i=e.from.table===ve.iU?y.Z.createChildStore(t,{table:ve.iU,id:e.from.blockId}):Re.Z.createChildStore(t,{table:De.e0,id:e.from.teamId}),s=S.Z.createChildStore(t,{table:F.KJ,id:e.permissionItem.user_id}).getValue(),a=i.id!==t.id,o=s?n()(Q.Z,{userValue:s,size:T.Z.iconSize}):n()(Ue,{style:{height:T.Z.iconSize,width:T.Z.iconSize,borderRadius:20},theme:this.theme}),{data:r}=U.default.state,l=(r?E.uF(r):[]).find((t=>t.userId===e.permissionItem.user_id)),d=Boolean(l&&!p.zz(l.role)&&!p.J5(l.role)),c=s&&s.email?d?n()("div",{style:x.Z.textOverflowStyle},void 0,h.Z.globe2({width:14,fill:"#CF8807",display:"inline",verticalAlign:"middle"})," ",n()("span",{style:{color:"#CF8807",fontWeight:500}},void 0,n()(X.FormattedMessage,{defaultMessage:"Guest",id:"blockPermissionsSettings.permissionsForUserGuest.label"}))," • ",s.email):s.email:void 0;return n()("div",{},e.permissionItem.user_id,n()(T.Z,{format:T.Z.Format.User,currentBlockStore:t,store:i,permissionItem:e.permissionItem,disabled:!this.canEdit(),icon:o,title:s?(0,F.Nz)(this.props.intl,s)||n()(X.FormattedMessage,{defaultMessage:"Invitation sent",id:"blockPermissionsSettings.sentInvitation.message"}):n()(Ue,{style:{height:8,width:81,borderRadius:3},theme:this.theme}),subtitle:s?c:n()(Ue,{style:{height:8,width:139,borderRadius:3,marginTop:10},theme:this.theme}),isSubscribed:this.isSubscribed(),isInherited:a,tooltip:a?this.renderInheritedPermissionTooltip(i):void 0,upgradeButtonName:"user_permission_item",onUpgradeButtonClick:this.props.onUpgradeButtonClick,onChange:async t=>{await this.handlePermissionItemChange({isInherited:a,oldPermissionItem:e.permissionItem,newPermissionItem:t})}}))})),l()(this,"maybeRenderBotPermissionItem",(e=>{const{store:t}=this.props,{currentUserRootStore:i,currentSpaceStore:s,currentBlockStore:a}=L.default.state;if(!i||!s||!a)return;const o=e.from.table===ve.iU?y.Z.createChildStore(t,{table:ve.iU,id:e.from.blockId}):Re.Z.createChildStore(t,{table:De.e0,id:e.from.teamId}),r=(0,G.Kv)(t,{table:K.c,id:e.permissionItem.bot_id,spaceId:s.id}),l=r.getValue();if(l&&!l.alive)return;if(l&&(0,xe.oA)(l)){if(l.parent_id!==i.id)return;{const t=a.getRole()||"none";if(!(0,H.yY)(t,e.permissionItem.role))return}}const d=o.id!==t.id,c=(null==l?void 0:l.name)||n()(Ue,{style:{height:8,width:81,borderRadius:3},theme:this.theme}),u=n()(fe.Z,{botValue:l,size:T.Z.iconSize});return n()("div",{},r.id,n()(T.Z,{format:T.Z.Format.Workspace,currentBlockStore:t,store:o,permissionItem:e.permissionItem,disabled:!this.canEdit(),icon:u,title:c,tooltip:d?this.renderInheritedPermissionTooltip(o):this.renderBotPermissionTooltip(),subtitle:l?n()("div",{style:x.Z.textOverflowStyle},void 0,h.Z.bot({width:12,display:"inline",verticalAlign:"middle",fill:this.theme.mediumIconColor})," ",n()(X.FormattedMessage,{defaultMessage:"Integration",id:"blockPermissionsSettings.permissionsForBot.label",description:"Inform user that this page is shared with a bot."})," · ",(0,xe.oA)(l)?n()(X.FormattedMessage,{defaultMessage:"Only visible to you",id:"blockPermissionsSettings.permissionsForBot.personalBot.label"}):n()(X.FormattedMessage,{defaultMessage:"Shared with workspace",id:"blockPermissionsSettings.permissionsForBot.spaceBot.label"})):n()(Ue,{style:{height:8,width:139,borderRadius:3,marginTop:10},theme:this.theme}),isSubscribed:this.isSubscribed(),isInherited:d,upgradeButtonName:"bot_permission_item",onUpgradeButtonClick:this.props.onUpgradeButtonClick,onChange:async t=>{await this.handlePermissionItemChange({isInherited:d,oldPermissionItem:e.permissionItem,newPermissionItem:t})}}))})),l()(this,"handleCopy",(()=>{const e=(0,M.Z)({store:this.props.store});g.RD({environment:this.environment,stringValue:e,copiedMessage:g.tq.copiedLinkToClipboard}),this.props.buttonPopupStore.setState({open:!1})})),l()(this,"handleMoveTo",(()=>{const e=Ee().findDOMNode(this);Fe.Z.setState({isOpen:!0,rect:null==e?void 0:e.getBoundingClientRect(),targets:L.default.state.currentBlockStore?[L.default.state.currentBlockStore]:[],autocompleteQuery:"",analyticsFrom:"permission_settings",isAddTo:!1,lastPageId:Fe.Z.state.lastPageId,needsConfirmation:!1}),this.props.buttonPopupStore.setState({open:!1})})),l()(this,"handleMobileNativeShareClick",(()=>{const{mobileNative:e}=this.environment,t=_.u5({schemeUrl:window.location.href,baseUrl:N.default.domainBaseUrl});e&&e.share(t)})),l()(this,"handleCloseRestrictConfirmationModal",(()=>{this.stores.restrictConfirmationModalStore.setState({open:!1,onClose:void 0})})),l()(this,"handlePermissionItemChange",(async e=>{const{isInherited:t,oldPermissionItem:i,newPermissionItem:s}=e;if(!(0,H.Kf)(i,s))throw new Error("Permission type mismatch.");const a=(0,H.nl)(i.role,s.role);if(t&&a!==s.role)return void this.handleRestrictPermission(s);const o=this.props.store.isTopLevel();if(o&&p.ix(s)){const{data:e}=U.default.state,t=e?E.su(e):1;if(p.YX(i.role)&&!p.YX(s.role)&&t>1){if(!(await J.confirmUserAction({message:n()("span",{},void 0,n()(X.FormattedMessage,{defaultMessage:"Are you sure you want to make this page private? <semibold>Only you will be able to access it.</semibold>",values:{semibold:(...e)=>n()("span",{style:{fontWeight:x.Z.fontWeight.semibold}},void 0,e)},id:"blockPermissionsSettings.confirmationDialog.private.message"})),acceptLabel:n()(X.FormattedMessage,{defaultMessage:"Move to Private",id:"blockPermissionsSettings.confirmationDialog.privateButton.label"})})))return}else if(o&&!p.YX(i.role)&&p.YX(s.role)){if(!(await J.confirmUserAction({message:n()("span",{},void 0,n()(X.FormattedMessage,{defaultMessage:"Are you sure you want to share this page with the workspace? <semibold>It will be accessible by all {memberCount} members.</semibold>",id:"blockPermissionsSettings.confirmationDialog.workspace.message",values:{semibold:(...e)=>n()("span",{style:{fontWeight:x.Z.fontWeight.semibold}},void 0,e),memberCount:t}})),acceptLabel:n()(X.FormattedMessage,{defaultMessage:"Move to workspace",id:"blockPermissionsSettings.confirmationDialog.workspaceButton.label"})})))return}}!o&&i.role!==s.role&&a!==i.role&&de.SMF(this.environment),k.createAndCommit(this.environment,(e=>{f.ep({environment:this.environment,store:this.props.store,permissionItems:[s],transaction:e})}))})),l()(this,"handleRestrictPermission",(e=>{const t=()=>{k.createAndCommit(this.environment,(async t=>{await f.Pk({environment:this.environment,store:this.props.store,permissionItem:e,transaction:t})}))};"none"===e.role?this.stores.restrictConfirmationModalStore.setState({open:!0,onClose:this.handleCloseRestrictConfirmationModal,type:"remove",permissionItem:e,onAccept:t}):this.stores.restrictConfirmationModalStore.setState({open:!0,onClose:this.handleCloseRestrictConfirmationModal,type:"restrict",onAccept:t})}))}renderComponent(){const{device:e}=this.environment;let t;return t=e.isMobile?{menuType:Z.ZP.MenuType.Modal,title:n()(X.FormattedMessage,{defaultMessage:"Share",id:"blockPermissionsSettings.mobileShareMenu.title"}),left:this.renderMobileHelpButton(),right:n()(ee.DoneMenuText,{}),onClickRight:this.props.onClose}:{menuType:Z.ZP.MenuType.Popup},m().createElement(m().Fragment,null,m().createElement(re.Z,this.stores.restrictConfirmationModalStore.state),m().createElement(Z.ZP,a()({},t,{className:W.B8}),n()(B.Z,{capture:!0,allowEsc:!0},void 0,n()(w.Z,{capture:!0,ignoreBlockSelection:!0,restoreSelection:!1,focusOffscreenInput:!1,render:()=>O.Z.state.online?this.renderPermissions():this.renderOfflineMessage()}))))}renderMobileHelpButton(){return n()(ie.Z,{href:(0,se.UY)("guides.sharing"),analyticsFrom:"sharing"})}renderOfflineMessage(){const{device:e}=this.environment;return n()("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:160}},void 0,n()(Y.Z,{isMobile:e.isMobile,isSecondaryColor:!0,isMultiline:!0,style:{textAlign:"center"}},void 0,n()(X.FormattedMessage,{defaultMessage:"Please go online to publish & share.",id:"blockPermissionsSettings.offline.prompt"})))}renderPermissions(){const{device:e,WindowSizeStore:t}=this.environment,{currentSpaceStore:i}=L.default.state,{store:s}=this.props,o=(0,z.YO)(s);let r=[];if(i){const e=i.getValue();e&&e.permission_groups&&(r=e.permission_groups)}const l=v.VP(s),d=null==l?void 0:l.getValue();let g={permissionItem:{type:"public_permission",role:"none"},from:{table:ve.iU,blockId:s.id}},f={permissionItem:{type:"space_permission",role:"none"},from:{table:ve.iU,blockId:s.id}},y={permissionItem:{type:"team_permission",role:"none"},from:{table:ve.iU,blockId:s.id}};for(const a of o)if(p.$D(a.permissionItem)){g=a}else if(p.ix(a.permissionItem)){f=a}else if(p.Ix(a.permissionItem)){y=a}let M=o.filter((({permissionItem:e})=>p.hV(e)));M=c().sortBy(M,(e=>{if(i){const t=i.getValue();if(t&&t.permission_groups)return t.permission_groups.findIndex((t=>t.id===e.permissionItem.group_id))}return e.permissionItem.group_id}));const S=o.filter((({permissionItem:e})=>p.jg(e))),b=o.filter((({permissionItem:e})=>p.FB(e))),T={};let Z=C.xm.Y;e.isMobile?(T.backgroundColor=this.theme.contentBackground,Z=C.xm.None):T.maxHeight="calc(70vh - 80px)";const w=this.shouldShowPublicPermissionItem(),k=this.sidebarState.state,P=Boolean(d);let I=k&&k.showWorkspaceSection||i&&"team"===i.getPlanType();(0,ce.bq)()&&(I=k&&k.showWorkspaceSection||P);const x=I||P||S.length>1||S.length&&!p.zz(S[0].permissionItem.role)||M.length||p.YX(f.permissionItem.role),F=o.some((e=>p.Le(e.permissionItem)&&e.from.table===ve.iU&&e.from.blockId===s.id)),B=(x?S.length:0)+b.length+(I?1:0)+(P?1:0),E={environment:this.environment,blocks:[s],publicEditMode:void 0},R=ge.xD([ge._z,ge.zz,ge.KE,ge.Gg,ge.jl,ge.ff(ge.uZ),ge.ff(ge.xw)])(E);return n()("div",{style:{flexGrow:1,flexShrink:1,display:"flex",flexDirection:"column"}},void 0,e.isMobile&&n()(u.Fragment,{},void 0,this.renderContentOnlyEditorEducationPill(),F&&this.renderRestrictedPermissionBanner(),n()("div",{style:{display:"flex",paddingTop:8,paddingBottom:8,paddingRight:t.getSafePaddingRightCSS(14),background:this.theme.sidebarBackground}},void 0,this.renderPageLinkButton()),n()("div",{style:{borderBottom:"1px solid ".concat(this.theme.regularDividerColor)}})),n()(C.ZP,{style:T,type:Z},void 0,!e.isMobile&&this.renderContentOnlyEditorEducationPill(),!e.isMobile&&F&&this.renderRestrictedPermissionBanner(),"none"!==g.permissionItem.role&&n()(we,{permissionItemWrapStyle:this.getPermissionItemWrapStyle(),safePaddingLeftCSS:t.getSafePaddingLeftCSS(8),safePaddingRightCSS:t.getSafePaddingRightCSS(8)}),w&&this.renderPublicPermissionItem(g),this.renderAddGuests(),I&&this.renderSpacePermissionItem(f),P&&this.renderTeamPermissionItem(y),n()("div",{style:{...this.getPermissionItemWrapStyle(),paddingBottom:B>0?8:void 0}},void 0,this.renderGroupPermissions({spacePermissionGroups:r,mostPermissiveGroupPermissions:M}),x&&n()("div",{},void 0,S.map(this.renderUserPermissionItem)),b.map(this.maybeRenderBotPermissionItem).filter(ke.$K))),n()("div",{style:{display:"flex",alignItems:e.isMobile?"flex-start":"center",boxShadow:"0 -1px 0 ".concat(this.theme.regularDividerColor),paddingLeft:t.getSafePaddingRightCSS(8),paddingRight:t.getSafePaddingRightCSS(8),flexDirection:"column-reverse",...!e.isMobile&&{flexDirection:"row",justifyContent:"space-between",padding:"4px 4px"}}},void 0,!e.isMobile&&n()(u.Fragment,{},void 0,n()(me,{}),(0,ce.bq)()&&R&&n()(te.Z,{isSmall:!0,onClick:this.handleMoveTo,mobileFeedback:e.isMobile,style:{height:24,paddingRight:8,color:this.theme.regularTextColor,marginRight:0,marginLeft:100}},void 0,h.Z.moveTo({width:14,height:14,fill:this.theme.regularIconColor,marginLeft:0,marginRight:6}),n()(Y.Z,{isSmall:!0,isMobile:e.isMobile,style:{color:this.theme.regularTextColor}},void 0,n()(X.FormattedMessage,{id:"blockPermissionsSettings.moveToButton.label",defaultMessage:"Move to"}))),n()(A.Z,{delayThreshold:0,placement:A.Z.Placement.Bottom,renderTooltip:()=>this.getPageLinkInfoTooltip(),render:t=>m().createElement(te.Z,a()({isSmall:!0,onClick:e.isMobileNative?this.handleMobileNativeShareClick:this.handleCopy,mobileFeedback:e.isMobile,style:{height:e.isMobile?44:24,width:e.isMobile?"100%":void 0,paddingLeft:8,paddingRight:8,color:this.theme.regularTextColor}},t),h.Z.link({width:e.isMobile?16:14,height:e.isMobile?16:14,fill:this.theme.regularIconColor,marginLeft:e.isMobile?2:0,marginRight:e.isMobile?8:6}),n()(Y.Z,{isSmall:!0,isMobile:e.isMobile,style:{color:this.theme.regularTextColor}},void 0,n()(X.FormattedMessage,{id:"blockPermissionsSettings.copyLinkButton.label",defaultMessage:"Copy link"})))}))))}renderInviteButton(){const{currentSpaceStore:e}=L.default.state,{device:t}=this.environment,{store:i}=this.props,s=v.VP(i);return n()(ye.LazyPermissionsInviteWithModal,{store:i,disabled:!this.canEdit(),membersOnly:Boolean(!s&&(null==e?void 0:e.getDisableGuests())||s&&s.getDisableGuests()),isSubscribed:this.isSubscribed(),onUpgradeButtonClick:this.props.onUpgradeButtonClick,upgradeButtonName:"invite_permission_block",shouldGrow:!0,buttonStyle:{height:t.isMobile?36:28}})}renderPageLinkButton(){const{device:e}=this.environment;return n()(A.Z,{delayThreshold:0,placement:A.Z.Placement.Bottom,renderTooltip:()=>this.getPageLinkInfoTooltip(),render:t=>m().createElement(V.Z,a()({isLarge:!0,onClick:e.isMobileNative?this.handleMobileNativeShareClick:this.handleCopy,style:{marginLeft:12,flex:1,height:this.environment.device.isMobile?36:void 0,background:this.theme.contentBackground}},t),e.isMobileNative?n()(X.FormattedMessage,{id:"pageShareMenu.sharePageLinkButton.label",defaultMessage:"Share page link"}):n()(X.FormattedMessage,{id:"pageShareMenu.copyPageLinkButton.label",defaultMessage:"Copy page link"}))})}renderRestrictedPermissionBanner(){const{device:e}=this.environment,{store:t}=this.props,i=v.uJ(t)[1],s=ge.or([ge.zz,ge.xD([ge.c2,ge.ff(ge.zz)])])({environment:this.environment,blocks:[t],publicEditMode:void 0});if(i&&i.canRead())return n()("div",{},void 0,n()("div",{style:{...this.getPermissionItemWrapStyle(),...this.getMenuItemStyle(),backgroundColor:e.isMobile?this.theme.darkBannerBackground:this.theme.sidebarSecondaryBackground,flexDirection:e.isMobile?"column":"row",alignItems:e.isMobile?"flex-start":"center",paddingTop:e.isMobile?14:10}},void 0,n()("div",{style:{display:"flex",alignItems:"flex-start",marginRight:e.isMobile?void 0:6}},void 0,h.Z.eyeHide({width:e.isMobile?20:16,marginTop:e.isMobile?3:2,marginRight:e.isMobile?10:8,marginLeft:e.isMobile?2:0,fill:this.theme.regularIconColor}),n()(Y.Z,{isMultiline:!0,isMobile:e.isMobile,isSmall:!0,style:{color:this.theme.regularTextColor}},void 0,n()(X.FormattedMessage,{id:"pageShareMenu.restrictedAccessBanner.label",defaultMessage:"Access restricted. May not be shared with everyone from {linkBoxWithPageTitle}.",description:"This text tells the user that this permission setting for the page is NOT inherited from the parent page.",values:{linkBoxWithPageTitle:n()(ne.Z,{style:{color:this.theme.mediumTextColor},underline:!0,inline:!0,onClick:i.table===De.e0?()=>{i.table===De.e0&&(0,ce.RF)({teamId:i.id})}:void 0,href:i.table===ve.iU?(0,M.Z)({store:i,fullyQualified:!1}):void 0},void 0,n()(I.Z,{shouldWrap:!0,maxLength:30,store:i,style:{display:"inline"}}))}}))),s&&n()(te.Z,{isSmall:!e.isMobile||void 0,style:{fontSize:e.isMobile?14:12,marginTop:e.isMobile?2:void 0,marginLeft:e.isMobile?24:void 0,fontWeight:e.isMobile?x.Z.fontWeight.medium:void 0},onClick:()=>{const e=t.getPermissionItems(),i=v.Om(t),s=i?(0,H.Wo)(v.fJ(i)):[],a=(0,H.Xr)(e,s);this.stores.restrictConfirmationModalStore.setState({open:!0,onClose:this.handleCloseRestrictConfirmationModal,type:"restore",permissionChanges:a,onAccept:()=>{t.getPermissionsStore().canAdmin()?k.createAndCommit(this.environment,(async e=>{await f.MX({environment:this.environment,store:t,transaction:e})})):f.hs({environment:this.environment,store:t})}})}},void 0,n()(X.FormattedMessage,{id:"pageShareMenu.restrictedAccessBanner.restore",defaultMessage:"Restore",description:"Action for when user wants to remove restricted access to a page."}))),e.isMobile?n()(he.Z,{size:1,style:{opacity:"75%"}}):void 0)}renderPublicPermissionItem(e){const{store:t}=this.props,i=e.from.table===ve.iU?y.Z.createChildStore(t,{table:ve.iU,id:e.from.blockId}):Re.Z.createChildStore(t,{table:De.e0,id:e.from.teamId}),s=i.id!==t.id;return n()("div",{style:this.getPermissionItemWrapStyle(),className:W.a8},void 0,n()(T.Z,{format:T.Z.Format.Web,currentBlockStore:t,store:i,permissionItem:e.permissionItem,disabled:!this.canEdit(),icon:h.Z.globe({width:26,height:26,fill:this.theme.lightIconColor}),title:n()(X.FormattedMessage,{defaultMessage:"Share to web",id:"blockPermissionsSettings.permissionItem.linkSharing"}),subtitle:p.J5(e.permissionItem.role)?n()(X.FormattedMessage,{defaultMessage:"Anyone with the link can edit and comment",id:"blockPermissionsSettings.publicPermission.canEdit"}):p.RF(e.permissionItem.role)?n()(X.FormattedMessage,{defaultMessage:"Anyone with the link can comment",id:"blockPermissionsSettings.publicPermission.canComment"}):p.YX(e.permissionItem.role)?n()(X.FormattedMessage,{defaultMessage:"Anyone with the link can view",id:"blockPermissionsSettings.publicPermission.canRead"}):n()(X.FormattedMessage,{defaultMessage:"Publish and share link with anyone",id:"blockPermissionsSettings.publicPermission.none"}),tooltip:s?this.renderInheritedPermissionTooltip(i):this.renderPublicPermissionTooltip(),isSubscribed:this.isSubscribed(),isInherited:s,upgradeButtonName:"public_permission_item",onUpgradeButtonClick:this.props.onUpgradeButtonClick,switcherRole:"reader",onChange:async t=>{await this.handlePermissionItemChange({isInherited:s,oldPermissionItem:e.permissionItem,newPermissionItem:t})}}))}renderSpacePermissionItem(e){const{store:t}=this.props,i=e.from.table===ve.iU?y.Z.createChildStore(t,{table:ve.iU,id:e.from.blockId}):Re.Z.createChildStore(t,{table:De.e0,id:e.from.teamId}),s=v.Pj(t)||L.default.state.currentSpaceStore;if(!s||!s.getValue())return;const a=(0,ae.getSpacePermissionItems)(s).filter((e=>p.J5(p.cY(e)))),o=i.id!==t.id;return n()("div",{style:{width:"100%"},className:W.af},void 0,n()(T.Z,{format:T.Z.Format.Workspace,currentBlockStore:t,store:i,permissionItem:e.permissionItem,disabled:!this.canEdit(),icon:this.renderSpaceIcon(),title:n()(X.FormattedMessage,{defaultMessage:"Everyone at {workspaceName}",id:"blockPermissionsSettings.permissionItem.workspaceAccessNew",values:{workspaceName:(0,ae.getSpaceName)(this.environment,s)}}),tooltip:o?this.renderInheritedPermissionTooltip(i):this.renderSpacePermissionTooltip(),subtitle:n()(X.FormattedMessage,{defaultMessage:"{numberOfWorkspaceMembers, plural, one {{numberOfWorkspaceMembers} workspace member} other {{numberOfWorkspaceMembers} workspace members}}",id:"blockPermissionsSettings.spacePermission.none",values:{numberOfWorkspaceMembers:a.length}}),isSubscribed:this.isSubscribed(),isInherited:o,upgradeButtonName:"space_permission_item",onUpgradeButtonClick:this.props.onUpgradeButtonClick,onChange:async t=>{await this.handlePermissionItemChange({isInherited:o,oldPermissionItem:e.permissionItem,newPermissionItem:t})}}))}renderTeamPermissionItem(e){const{store:t}=this.props,i=e.from.table===ve.iU?y.Z.createChildStore(t,{table:ve.iU,id:e.from.blockId}):Re.Z.createChildStore(t,{table:De.e0,id:e.from.teamId}),s=v.Pj(t)||L.default.state.currentSpaceStore,a=v.VP(t),o=null==s?void 0:s.getValue(),r=null==a?void 0:a.getValue();if(!(s&&o&&a&&r))return;const l=(0,_e.Xk)(r,o).length,d=i.id!==t.id;return n()("div",{style:{width:"100%"},className:W.YH},void 0,n()(T.Z,{format:T.Z.Format.Workspace,currentBlockStore:t,store:i,permissionItem:e.permissionItem,disabled:!this.canEdit(),icon:this.renderTeamIcon(r),title:n()(X.FormattedMessage,{defaultMessage:"{teamName} team",id:"blockPermissionsSettings.permissionItem.teamAccess",values:{teamName:r.name}}),tooltip:d?this.renderInheritedPermissionTooltip(i):this.renderTeamPermissionTooltip(r,l),subtitle:n()(X.FormattedMessage,{defaultMessage:"{nonGuestTeamMembersCount, plural, one {{nonGuestTeamMembersCount} team member} other {{nonGuestTeamMembersCount} team members}}",id:"blockPermissionsSettings.teamPermission.subtitle",values:{nonGuestTeamMembersCount:l}}),isSubscribed:this.isSubscribed(),isInherited:d,upgradeButtonName:"team_permission_item",onUpgradeButtonClick:this.props.onUpgradeButtonClick,onChange:async t=>{await this.handlePermissionItemChange({isInherited:d,oldPermissionItem:e.permissionItem,newPermissionItem:t})}}))}renderInheritedPermissionTooltip(e){const t=e.getIcon();return n()("div",{style:{whiteSpace:"normal",width:180}},void 0,n()(X.FormattedMessage,{defaultMessage:"This access is based on {inlineIconAndName}. Changing this access will restrict permissions of this page.",id:"blockPermissionsSettings.restrictedPermissions.tooltip",values:{inlineIconAndName:n()("span",{style:{whiteSpace:"nowrap",fontWeight:x.Z.fontWeight.bold}},void 0,t&&n()(P.Z,{disabled:!0,icon:t,isEmptyPage:!1,size:12,style:{marginRight:4,display:"inline-block"}}),n()(I.Z,{store:e,style:{display:"inline"}}))}}))}renderSpaceIcon(){const{currentSpaceStore:e}=L.default.state;return e?n()(P.Z,{disabled:!0,title:(0,ae.getSpaceName)(this.environment,e),icon:(0,ae.getSpaceIcon)(this.environment,e),isEmptyPage:!1,size:T.Z.iconSize}):h.Z.team()}renderTeamIcon(e){return n()(P.Z,{disabled:!0,title:e.name,icon:e.icon?{pointer:{table:"team",id:e.id,spaceId:e.space_id},icon:e.icon}:void 0,isEmptyPage:!1,size:T.Z.iconSize})}renderGroupPermissions(e){const{currentSpaceStore:t}=L.default.state,{spacePermissionGroups:i,mostPermissiveGroupPermissions:s}=e;return s.map((e=>{const s=e.permissionItem.group_id,a=i.find((e=>e.id===s));if(a&&t)return this.renderGroupPermissionItem(e,a,t.id)}))}renderGroupPermissionItem(e,t,i){const{store:s,intl:a}=this.props,o=e.from.table===ve.iU?y.Z.createChildStore(s,{table:ve.iU,id:e.from.blockId}):Re.Z.createChildStore(s,{table:De.e0,id:e.from.teamId}),r=t.user_ids||[],l=(0,R.k)({intl:a,group:t}),d=o.id!==s.id,c=n()(P.Z,{disabled:!0,title:l,icon:t.icon?{pointer:{table:"space",id:i},icon:t.icon}:void 0,isEmptyPage:!1,size:T.Z.iconSize});return n()("div",{style:{fontWeight:400},className:W.gG},t.id,n()(T.Z,{format:T.Z.Format.Workspace,currentBlockStore:s,store:o,permissionItem:e.permissionItem,disabled:!this.canEdit(),icon:c,title:l,tooltip:d?this.renderInheritedPermissionTooltip(o):this.renderGroupPermissionTooltip(t),subtitle:n()(X.FormattedMessage,{defaultMessage:"{numberOfGroupMembers, plural, one {{numberOfGroupMembers} group member} other {{numberOfGroupMembers} group members}}",id:"blockPermissionsSettings.groupPermission.none",values:{numberOfGroupMembers:r.length}}),isSubscribed:this.isSubscribed(),isInherited:d,upgradeButtonName:"group_permission_item",onUpgradeButtonClick:this.props.onUpgradeButtonClick,onChange:async t=>{await this.handlePermissionItemChange({isInherited:d,oldPermissionItem:e.permissionItem,newPermissionItem:t})}}))}renderAddGuests(){const{device:e}=this.environment,{WindowSizeStore:t}=this.environment;return n()(q.Z,{mobileFeedback:e.isMobile,disabled:!0},void 0,n()("div",{style:{...this.getMenuItemStyle(),paddingTop:e.isMobile?12:10,paddingBottom:e.isMobile?12:10,paddingLeft:t.getSafePaddingLeftCSS(14),paddingRight:t.getSafePaddingRightCSS(14)}},void 0,n()("div",{style:{width:"100%"}},void 0,this.renderInviteButton())))}renderContentOnlyEditorEducationPill(){const{store:e}=this.props,t=e.getRole();if(t&&p.WY(t))return n()(Le.V,{showAdminContent:!1,userSettingsStore:void 0,style:{margin:void 0,borderRadius:void 0}});const i=(0,z.YO)(e).some((({permissionItem:e})=>p.WY(p.cY(e))));if(t&&p.zz(t)&&e.isCollectionView()&&!E.M9(this.environment)&&!i&&(0,z.Wq)(this.environment)){const e=L.default.state.currentUserSettingsStore;return n()(Le.V,{showAdminContent:!0,userSettingsStore:e,style:{margin:void 0,borderRadius:void 0}})}}getPermissionItemWrapStyle(){return{boxShadow:"0 1px 0 ".concat(this.theme.regularDividerColor),width:"100%"}}getMenuItemStyle(){const{WindowSizeStore:e}=this.environment;return{display:"flex",alignItems:"center",minHeight:52,paddingTop:8,paddingBottom:8,paddingLeft:e.getSafePaddingLeftCSS(16),paddingRight:e.getSafePaddingRightCSS(12)}}isSubscribed(){const{data:e}=U.default.state;return Boolean(e&&E.YK(e))}canEdit(){return p.zz(this.props.store.getRole()||"editor")}shouldShowPublicPermissionItem(){const{currentSpaceStore:e}=L.default.state,t=v.VP(this.props.store);return Boolean(t&&!t.getDisablePublicAccess()||!t&&!(null!=e&&e.getDisablePublicAccess()))}getPageLinkInfoTooltip(){const e=(0,z.YO)(this.props.store).map((({permissionItem:e})=>e)),t=e.find((e=>"public_permission"===e.type)),i=e.find((e=>"space_permission"===e.type)),s=e.filter((e=>"user_permission"===e.type));return t?n()("div",{},void 0,n()(X.FormattedMessage,{defaultMessage:"This page has public link access, so anyone{br}with the link will be able to view the page.",id:"blockPermissionsSettings.publicLinkInfo.tooltip",values:{br:n()("br",{})}})):i?n()("div",{},void 0,n()(X.FormattedMessage,{defaultMessage:"This page has workspace access, so anyone{br}in the workspace will be able to view the link.",id:"blockPermissionsSettings.workspacePermissions.tooltip",values:{br:n()("br",{})}})):s.length>1?n()("div",{},void 0,n()(X.FormattedMessage,{defaultMessage:"Only you and other invited members{br}and guests will be able to view the link.",id:"blockPermissionsSettings.userPermissions.tooltip",values:{br:n()("br",{})}})):n()("div",{},void 0,n()(X.FormattedMessage,{defaultMessage:"Only you can access this page,{br}so the link will only work for you.",id:"blockPermissionsSettings.privatePermissions.tooltip",values:{br:n()("br",{})}}))}}const Ue=e=>n()("div",{style:{...e.style,background:e.theme.lightDividerColor}}),Ne=(0,X.injectIntl)(Oe)},85324:(e,t,i)=>{i.r(t),i.d(t,{default:()=>A});var s=i(67154),a=i.n(s),o=i(98135),n=i.n(o),r=(i(41817),i(5366)),l=i(67294),d=i.n(l),c=i(41892),u=i(86658),m=i(82990),p=i(92108),g=i(64215),h=i(45293),f=i(72693),v=i(10182),y=i(92660),M=i(29551),S=i(42001),b=i(58879),T=i(36867),C=i(63143);function Z(){const e=(0,g.y)(k,[]),t=(0,b.O7)();return n()(f.Z,{isLarge:!0,style:e.acceptAllButton,onClick:()=>{p.a9(t,{necessary:!0,preference:!0,performance:!0,targeting:!0}),h.Z.setState({open:!1}),(0,p.qo)()}},void 0,d().createElement(r.FormattedMessage,u.ze.acceptAllButtonLabel))}function w(){const e=(0,g.y)(k,[]);return n()(v.Z,{hasDismissButton:!0,onDismiss:()=>{h.Z.setState({open:!1})},renderOrigin:t=>d().createElement(S.Z,a()({},t,{isLarge:!0,isGray:!0,style:e.moreOptionsButton}),d().createElement(r.FormattedMessage,u.ze.moreOptionsButtonLabel))})}function k(e){return{modal:{maxWidth:400,padding:24},image:{height:100},title:{marginTop:8,color:e.regularTextColor,fontWeight:m.Z.fontWeight.semibold,fontSize:18},description:{color:e.mediumTextColor,textAlign:"center",fontSize:14,marginTop:8,marginBottom:18},acceptAllButton:{width:"100%",marginBottom:6},moreOptionsButton:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center"}}}const A=(0,r.injectIntl)((function(){const e=(0,b.O7)().currentUser.id;(0,l.useEffect)((()=>{if(!e)return;(0,T._)(e);const t=window.setInterval((()=>{(0,T._)(e)}),C.A0);return()=>{window.clearInterval(t)}}),[e]);const t=(0,g.y)(k,[]);return n()(y.Z,{onDismiss:()=>{},render:()=>n()("div",{style:t.modal},void 0,n()(M.gq,{flexDirection:"column",justifyContent:"center",alignItems:"center"},void 0,n()("img",{style:t.image,src:c.Z.images.feedbackThankYouPng}),n()("div",{style:t.title},void 0,"Set your cookie preferences"),n()("div",{style:t.description},void 0,(0,u.Fd)(p.Tz,"banner")),n()(Z,{}),n()(w,{}))),requireOnline:!0,modalStore:h.Z})}))},42333:(e,t,i)=>{i.r(t),i.d(t,{default:()=>z});var s=i(98135),a=i.n(s),o=i(59713),n=i.n(o),r=(i(33948),i(67294)),l=i.n(r),d=i(66832),c=i(5188),u=i(51454),m=i(3779),p=i(5366),g=i(82990),h=i(52016);const f="rate",v="send",y="thanks";class M extends h.Z{getInitialState(){return{starRating:void 0,step:f}}}const S=M;var b=i(96486),T=i.n(b),C=i(13548),Z=i(62727),w=i(33929),k=i(73409),A=i(68989),P=i(17215);function I(e,t,i){if(i){const{templateId:s}=i;return e.some((e=>e.milestone===t&&e.template_id===s))}return e.some((e=>e.milestone===t))}var x=i(72693),F=i(41892),B=i(58762),E=i(27832),R=i(89206),D=i(14947),_=i(1643),L=i(40039),O=i(29551),U=i(40756),N=i(4926);const V=(0,p.defineMessages)({additionalFeedbackPlaceholder:{id:"csatPopup.additionalFeedback.placeholder",defaultMessage:"Tell us more..."}});class W extends d.Z{constructor(...e){super(...e),n()(this,"storeTypes",{csatPopupStore:S}),n()(this,"renderCancel",(()=>a()(D.Z,{onClick:this.handleCancel,style:this.getCancelStyle(),hoveredStyle:{background:this.theme.buttonPressedBackground}},void 0,m.Z.closeSmall({width:14,fill:this.theme.mediumTextColor})))),n()(this,"renderStep",(()=>{const{step:e}=this.stores.csatPopupStore.state,{currentSpaceStore:t}=E.default.state;let i;if(t){const e=t.getValue();e&&e.initial_use_cases&&(i=T().sample(e.initial_use_cases))}return l().createElement(l().Fragment,null,a()(C.Z,{isVisible:e===f,enterAnimationStyle:{opacity:1},exitAnimationStyle:{opacity:0,translateY:-120},render:()=>a()("div",{style:{paddingBottom:40}},void 0,this.renderIcon(),this.renderFeedbackPrompt(i))}),a()(C.Z,{isVisible:e===f||e===v,enterAnimationStyle:{opacity:1},exitAnimationStyle:{opacity:0},render:()=>a()("div",{style:this.getSlideContainerStyle()},void 0,this.renderStars(i),this.renderInput(),this.renderSendButton())}),a()(C.Z,{isVisible:e===y,animationStyle:this.getAnimationStyle(e===y),enterAnimationStyle:this.getEnterExitAnimationStyle(),exitAnimationStyle:this.getEnterExitAnimationStyle(),render:this.renderThanks}))})),n()(this,"renderThanks",(()=>a()("div",{},void 0,a()("img",{style:{width:165,height:80},src:F.Z.images.feedbackThankYouPng}),a()("div",{style:this.getThanksHeaderStyle()},void 0,a()(p.FormattedMessage,{defaultMessage:"Thanks for your feedback!",id:"csatPopup.thanks.header"})),a()("div",{style:this.getThanksDescriptionStyle()},void 0,a()(p.FormattedMessage,{defaultMessage:"Your feedback will help us make Notion better.",id:"csatPopup.thanks.description"}))))),n()(this,"renderIcon",(()=>{const{currentBlockStore:e}=E.default.state;if(e){const t=e.getIcon();if(t)return a()(O.gq,{justifyContent:"center",alignItems:"center"},void 0,a()(L.Z,{icon:t,isEmptyPage:!1,size:32,disabled:!0}))}return a()(O.gq,{justifyContent:"center",alignItems:"center"},void 0,m.Z.notionLogo({width:32,height:32}))})),n()(this,"renderFeedbackPrompt",(e=>{switch(e){case"doc_notes":return a()("div",{style:this.getFeedbackPromptStyle()},"feedback-prompt",a()(p.FormattedMessage,{defaultMessage:"How satisfied are you with using Notion for notes & docs?",id:"csatPopup.feedbackPrompt.docNotesLabel"}));case"project_management":return a()("div",{style:this.getFeedbackPromptStyle()},"feedback-prompt",a()(p.FormattedMessage,{defaultMessage:"How satisfied are you with managing projects and tasks in Notion?",id:"csatPopup.feedbackPrompt.projManagementLabel"}));case"wiki":return a()("div",{style:this.getFeedbackPromptStyle()},"feedback-prompt",a()(p.FormattedMessage,{defaultMessage:"How satisfied are you with using Notion for team wikis?",id:"csatPopup.feedbackPrompt.wikiLabel"}));default:const t=this.shouldRenderAsNPS(e);return a()("div",{style:this.getFeedbackPromptStyle()},"feedback-prompt",a()(p.FormattedMessage,t?{defaultMessage:"How likely are you to recommend Notion to a friend?",id:"csatPopup.feedbackPrompt.enterpriseDefaultLabel"}:{defaultMessage:"How satisfied are you with using Notion? ",id:"csatPopup.feedbackPrompt.defaultlabel"}))}})),n()(this,"renderInput",(()=>{const{step:e,additionalFeedback:t}=this.stores.csatPopupStore.state;return a()(R.Z,{capture:!0,onBackspace:T().identity,onLeft:T().identity,onRight:T().identity,onSelectAll:T().identity,onRedo:T().identity,onUndo:T().identity,onCut:T().identity,onCopy:T().identity,onPaste:T().identity,onKeypress:T().identity,onDelete:T().identity,onTab:T().identity},void 0,a()(Z.Z,{textarea:!0,style:this.getInputContainerStyle(),focus:e===v,value:t,placeholder:w.default.formatMessage(V.additionalFeedbackPlaceholder),onChange:e=>{this.stores.csatPopupStore.setState({...this.stores.csatPopupStore.state,additionalFeedback:e.target.value})}}))})),n()(this,"renderSendButton",(()=>a()(x.Z,{isLarge:!0,style:this.getButtonStyle(),onClick:this.handleSend},void 0,a()(p.FormattedMessage,{id:"csatPopup.sendButton.label",defaultMessage:"Send"})))),n()(this,"renderStars",(e=>{const{starRating:t,step:i}=this.stores.csatPopupStore.state,s=({rating:e})=>a()("div",{style:this.getStarStyle(),onMouseEnter:()=>{i===f&&this.stores.csatPopupStore.setState({...this.stores.csatPopupStore.state,starRating:e})},onClick:()=>{this.stores.csatPopupStore.setState({starRating:e,step:v})}},void 0,m.Z.star({width:18,fill:this.theme.mediumIconColor,position:"absolute",opacity:t&&t>=e?0:1}),m.Z.starFilled({width:18,fill:"#F6C050",position:"absolute",opacity:t&&t>=e?1:0})),o=()=>{const i=this.shouldRenderAsNPS(e);switch(t){case 1:return a()(p.FormattedMessage,i?{defaultMessage:"Very unlikely",id:"csatPopup.stars.1StarLabelNps"}:{defaultMessage:"Very dissatisfied",id:"csatPopup.stars.1StarLabel"});case 2:return a()(p.FormattedMessage,i?{defaultMessage:"Somewhat unlikely",id:"csatPopup.stars.2StarLabelNps"}:{defaultMessage:"Somewhat dissatisfied",id:"csatPopup.stars.2StarLabel"});case 3:return a()(p.FormattedMessage,i?{defaultMessage:"Not likely nor unlikely",id:"csatPopup.stars.3StarLabelNps"}:{defaultMessage:"Not dissatisfied nor satisfied",id:"csatPopup.stars.3StarLabel"});case 4:return a()(p.FormattedMessage,i?{defaultMessage:"Somewhat likely",id:"csatPopup.stars.4StarLabelNps"}:{defaultMessage:"Somewhat satisfied",id:"csatPopup.stars.4StarLabel"});case 5:return a()(p.FormattedMessage,i?{defaultMessage:"Very likely",id:"csatPopup.stars.5StarLabelNps"}:{defaultMessage:"Very satisfied",id:"csatPopup.stars.5StarLabel"});default:return a()(p.FormattedMessage,{defaultMessage:"Select an option",id:"csatPopup.stars.notSpecifiedLabel"})}};return a()("div",{onMouseLeave:()=>{T().delay((()=>{this.stores.csatPopupStore.state.step===f&&this.stores.csatPopupStore.setState({...this.stores.csatPopupStore.state,starRating:void 0})}),500)},style:this.getStarsContainerStyle()},void 0,a()("div",{style:this.getStarsStyle()},void 0,a()(s,{rating:1}),a()(s,{rating:2}),a()(s,{rating:3}),a()(s,{rating:4}),a()(s,{rating:5})),a()("div",{style:this.getStarLabelStyle()},void 0,a()(o,{})))})),n()(this,"handleCancel",(async()=>{const{state:e}=c.Z;if(!e.open)return;const{open:t,...i}=e;if(t&&"trigger"===i.type){const{currentSpaceStore:e}=E.default.state;if(!e)return;await B.submitCsatFeedback(this.environment,{spaceId:e.id,rating:void 0,additionalFeedback:void 0,templateId:void 0,...i})}c.Z.setState({...c.Z,open:!1})})),n()(this,"handleSend",(async()=>{const{additionalFeedback:e,starRating:t}=this.stores.csatPopupStore.state,{currentSpaceStore:i}=E.default.state;if(!i||!t)return;const{state:s}=c.Z;if(!s.open)return;const{open:a,...o}=s,n="passive"===o.type?await B.submitCsatFeedback(this.environment,{spaceId:i.id,rating:t,additionalFeedback:e,type:o.type,milestone:void 0,templateId:void 0}):await B.submitCsatFeedback(this.environment,{spaceId:i.id,rating:t,additionalFeedback:e,templateId:void 0,...o});if("success"!==n.type)throw n.error;this.stores.csatPopupStore.setState({...this.stores.csatPopupStore.state,step:y}),T().delay((()=>{c.Z.setState({...c.Z,open:!1}),T().delay((()=>{this.stores.csatPopupStore.reset()}),1e3)}),2e3)})),n()(this,"flexCenteredStyle",{display:"flex",alignItems:"center",flexDirection:"column"})}willMount(){const{userSettingsStore:e,blockStore:t,spaceStore:i}=this.props;if(e&&t&&i){const s=this.environment;if("CsatMilestoneStore"in s){const a=U.Z.withListenerIgnored((()=>function(e,t){const{userSettingsStore:i,blockStore:s,spaceStore:a}=t,o=i.getSettings(),{signup_time:n}=o,{CsatMilestoneStore:r}=e,{data:l}=r.state,d=864e5,c=e=>Math.floor((Date.now()-e)/d),u=a.getValue();if(!u||!l)return;const{milestones:m}=l;if(!m)return;if(Math.max(...m.map((e=>e.created_time)))>Date.now()-24192e5)return;if(n){const e=c(n),t=T().sample(u.initial_use_cases)||"legacy";if(e>=180){if(!I(m,k.Hf))return{milestone:k.Hf,useCase:t}}else if(e>=90){if(!I(m,k.Vx))return{milestone:k.Vx,useCase:t}}else if(e>=28){if(!I(m,k.Sh))return{milestone:k.Sh,useCase:t}}else if(e>=7&&!I(m,k.zK))return{milestone:k.zK,useCase:t}}const p=s.getValue(),g=p?(0,P.zc)(p,"block"):void 0;return p&&g&&(0,A.JY)(g)&&c(p.created_time)>=7&&!I(m,k.a0,{templateId:g.id})?{milestone:k.a0,useCase:"legacy",templateId:g.id}:void 0}(s,{userSettingsStore:e,blockStore:t,spaceStore:i})));if(a){const{milestone:e,useCase:t,templateId:i}=a;T().delay((()=>{c.Z.setState({open:!0,milestone:e,type:"trigger",useCase:t,templateId:i})}),2e3)}}}}renderComponent(){const{device:e}=this.environment;if(e.isMobile)return;const{currentSpaceStore:t}=E.default.state;return t&&t.canRead()?a()(C.Z,{isVisible:c.Z.state.open,animationStyle:this.getAnimationStyle(c.Z.state.open),enterAnimationStyle:this.getEnterExitAnimationStyle(),exitAnimationStyle:this.getEnterExitAnimationStyle(),springConfig:this.getSpringConfig(),render:()=>a()("div",{style:this.getContainerStyle()},void 0,this.renderCancel(),a()("div",{style:this.getInnerContainerStyle()},void 0,this.renderStep()))}):void 0}shouldRenderAsNPS(e){const t=_.CM(this.environment),{state:i}=c.Z,s=i.open&&"trigger"===i.type;return"enterprise"===t&&!e&&s}getSpringConfig(){return{scale:{stiffness:58,damping:4.3}}}getAnimationStyle(e){return{opacity:e?1:0,scale:e?1:.96}}getEnterExitAnimationStyle(){return{opacity:0,scale:.96}}getThanksHeaderStyle(){return{color:this.theme.regularTextColor,fontWeight:g.Z.fontWeight.semibold,fontSize:14}}getThanksDescriptionStyle(){return{color:this.theme.mediumTextColor,fontSize:12}}getButtonStyle(){return{width:"calc(100% - 30px)"}}getInputContainerStyle(){const{step:e}=this.stores.csatPopupStore.state;return{width:"calc(100% - 30px)",display:"block",background:this.theme.popoverBackground,height:80,marginTop:10,marginBottom:10,opacity:e===f?0:1}}getStarLabelStyle(){return{fontSize:12,color:this.theme.mediumTextColor,paddingTop:4}}getFeedbackPromptStyle(){return{paddingTop:12,paddingBottom:12,color:this.theme.regularTextColor,fontWeight:g.Z.fontWeight.semibold,fontSize:14,lineHeight:1.4,width:188}}getStarStyle(){return{display:"inline-flex",position:"relative",width:20,height:20,marginRight:3}}getSlideContainerStyle(){const{step:e}=this.stores.csatPopupStore.state;return{...this.flexCenteredStyle,position:"absolute",transition:"transform 200ms ease",width:240,transform:e===f?"translateY(120px)":"translateY(0px)"}}getStarsContainerStyle(){return{width:"100%",...this.flexCenteredStyle}}getStarsStyle(){return{display:"flex",cursor:"pointer"}}getContainerStyle(){return{background:this.theme.popoverBackground,borderRadius:5,boxShadow:this.theme.mediumBoxShadow,position:"absolute",bottom:65+N.Z.state,right:16+N.Z.state,zIndex:u.hT}}getInnerContainerStyle(){return{...this.flexCenteredStyle,width:240,height:195,overflow:"hidden",position:"relative",padding:12,cursor:"default",textAlign:"center",justifyContent:"center"}}getCancelStyle(){return{position:"absolute",top:"10px",right:"10px",background:this.theme.buttonHoveredBackground,borderRadius:"100%",width:20,height:20,display:"flex",alignItems:"center",justifyContent:"center",zIndex:10}}}const z=(0,p.injectIntl)(W)},1459:(e,t,i)=>{i.r(t),i.d(t,{default:()=>Y});var s=i(98135),a=i.n(s),o=i(59713),n=i.n(o),r=(i(33948),i(67294)),l=i.n(r),d=i(79257),c=i(66832),u=i(66722),m=i(5366),p=i(85680),g=i(67154),h=i.n(g),f=(i(85827),i(8646)),v=i(96802),y=i(83071),M=i(15510),S=i(99036),b=i(11599),T=i(71202),C=i(86646),Z=i(26909),w=i(44514),k=i(43700),A=i(6695),P=i(3779),I=i(81870),x=i(33665),F=i(15282),B=i(40039),E=i(79029),R=i(12318),D=i(69872),_=i(61766);class L extends c.Z{constructor(...e){super(...e),n()(this,"storeTypes",{hovered:R.Z.of(!1),buttonPopupStore:R.Z.of(new _.Z)})}renderComponent(){const{schema:e,property:t,format:i}=this.props,s=e[t];if(!s)return;const o=this.getPropertyVisibility(s);return a()(D.Z,{onMouseEnter:()=>this.stores.hovered.set(!0),onMouseLeave:()=>this.stores.hovered.set(!1),focused:this.stores.hovered.get(),showDragHandle:!this.environment.device.isMobile,showExtensionArrow:!1,propertySchema:s,format:D.Z.DisplayFormat.Name,dontShrinkRight:!0,ignoreLocalHoverState:!0,locked:this.props.locked,onClick:()=>{if(!this.props.locked){const e=this.stores.buttonPopupStore.get();e.setState({open:!e.state.open})}},right:a()(k.Z,{buttonPopupStore:this.stores.buttonPopupStore.get(),visibility:o,locked:this.props.locked,onSelect:e=>{d.M0({environment:this.environment,property:t,visibility:e,format:i,store:this.props.store})},onClose:()=>this.stores.hovered.set(!1),type:"property",propertySchema:s})},t)}getPropertyVisibility(e){const{visibility:t}=this.props;switch(t){case"hide_if_empty":return b.kq({propertySchema:e})?"hide_if_empty":"show";default:return t}}}const O=L;var U=i(82990),N=i(42001),V=i(92547),W=i(28240),z=i(84210);class H extends c.Z{constructor(...e){super(...e),n()(this,"storeTypes",{lockStore:V.Z}),n()(this,"handleDraggableDrop",(e=>{const t=this.getCollectionPageProperties();if(t){const i=e.map((e=>t.find((t=>t.property===e))));d.D2({environment:this.environment,properties:i,store:this.props.store})}})),n()(this,"handleToggleLockClick",(()=>{const e=b.$0();if(!e)return!1;const t=e.getParentBlockStore();t&&(f.createAndCommit(this.environment,(e=>{v.Wq({environment:this.environment,store:t,isLocked:!b.p1(),transaction:e})})),this.stores.lockStore.setState({justUnlocked:!this.stores.lockStore.state.justUnlocked}))}))}renderComponent(){const{device:e}=this.environment;let t;t=e.isMobile?{menuType:T.ZP.MenuType.Modal,right:a()(F.DoneMenuText,{}),onClickRight:d.xv,title:this.props.intl.formatMessage({id:"customizePageMenu.mobileHeader.label",defaultMessage:"Customize page"})}:{menuType:T.ZP.MenuType.Popup,minWidth:400};const i=this.getNormalizedFormat();return l().createElement(T.ZP,h()({},t,{header:this.renderHeader()}),(this.props.locked||this.stores.lockStore.state.justUnlocked)&&this.renderLockControls(),this.renderPageSectionsSectionMenuItem(i),this.renderPropertiesSectionMenuItem(i))}renderLockControls(){return a()("div",{style:{fontSize:12,display:"flex",justifyContent:"center",alignItems:"center",borderTop:"1px solid ".concat(this.theme.regularDividerColor),borderBottom:"1px solid ".concat(this.theme.regularDividerColor),background:this.theme.sidebarBackground,color:this.theme.mediumTextColor,paddingTop:6,paddingBottom:6}},void 0,a()("span",{style:{display:"inline-block",verticalAlign:"middle",paddingRight:6}},void 0,this.stores.lockStore.state.justUnlocked?P.Z.unlocked({height:12,width:12,fill:this.theme.mediumIconColor}):P.Z.locked({height:12,width:12,fill:this.theme.mediumIconColor})),this.stores.lockStore.state.justUnlocked?a()(m.FormattedMessage,{id:"customizePageMenu.unlocked.header",defaultMessage:"Settings unlocked on parent database."}):a()(m.FormattedMessage,{id:"customizePageMenu.locked.header",defaultMessage:"Settings locked on parent database."}),a()(N.Z,{style:{fontSize:12,color:this.theme.mediumTextColor,fontWeight:U.Z.fontWeight.semibold,marginLeft:2,paddingLeft:4,paddingRight:4,height:20},onClick:this.handleToggleLockClick},void 0,this.stores.lockStore.state.justUnlocked?a()(m.FormattedMessage,{id:"customizePageMenu.lock.label",defaultMessage:"Re-lock"}):a()(m.FormattedMessage,{id:"customizePageMenu.unlock.label",defaultMessage:"Unlock"})))}renderPropertiesSectionMenuItem(e){const t=this.getSchema();if(!t||"page"===this.props.type)return;const i=this.getPageCustomization(e);if(!i)return;const{propertyVisibility:s}=i;if(!s)return;const o=s.reduce(((e,t)=>(e[t.property]=t.visibility,e)),{});return a()(y.Z,{style:{opacity:this.props.locked?.5:1},isTitleUppercase:!0,title:a()(m.FormattedMessage,{id:"customizePageMenu.propertiesSection.header",defaultMessage:"Properties"})},void 0,a()(M.Z,{direction:M.K.Vertical,keys:this.getCollectionPageProperties().map((e=>e.property)),renderKey:i=>{if("collection"===this.props.type)return a()(O,{schema:t,visibility:o[i],property:i,format:e,store:this.props.store,locked:this.props.locked})},onDrop:this.handleDraggableDrop}))}renderPageSectionsSectionMenuItem(e){const t=this.getPageCustomization(e);if(!t)return;const{pageSectionVisibility:i}=t;return i?a()(y.Z,{style:{opacity:this.props.locked?.5:1},title:a()(m.FormattedMessage,{id:"customizePageMenu.sectionsSection.header",defaultMessage:"Sections"}),isTitleUppercase:!0,topBorder:!this.props.locked&&!this.stores.lockStore.state.justUnlocked},void 0,a()(C.Z,{title:a()(m.FormattedMessage,{id:"customizePageMenu.pageSections.backlinksTitle",defaultMessage:"Backlinks"}),icon:P.Z.alias({height:16,width:16,transform:"rotate(180deg)"}),right:a()(k.Z,{visibility:i.backlinks,locked:this.props.locked,visibilityLevels:["section_show","section_hide","section_collapsed"],onSelect:t=>{d.W4({environment:this.environment,pageSection:"backlinks",visibility:t,store:this.props.store,format:e})},type:"page"})}),a()(C.Z,{title:a()(m.FormattedMessage,{id:"customizePageMenu.pageSections.topLevelPageDiscussionsTitle",defaultMessage:"Top-level page discussions"}),icon:P.Z.speechBubbleThick({height:16,width:16}),right:a()(k.Z,{visibility:i.comments,visibilityLevels:["section_show","section_hide"],locked:this.props.locked,onSelect:t=>{d.W4({environment:this.environment,pageSection:"comments",visibility:t,store:this.props.store,format:e})},type:"page"})}),a()(C.Z,{title:a()(m.FormattedMessage,{id:"customizePageMenu.pageSections.pageCommentsTitle",defaultMessage:"Page comments"}),icon:P.Z.speechBubbleThick({height:16,width:16}),right:a()(k.Z,{visibility:(0,b.ab)(i,"margin_comments"),visibilityLevels:["inline","minimal"],locked:this.props.locked,onSelect:t=>{d.W4({environment:this.environment,pageSection:"margin_comments",visibility:t,store:this.props.store,format:e})},type:"page"})})):void 0}renderHeader(){if(this.environment.device.isMobile)return;const{store:e}=this.props;if(e){const t=e.getIcon(),i="collection"===this.props.type?this.props.store.getParentBlockStore():void 0,s=t&&a()(B.Z,{icon:t,isEmptyPage:!1,size:14,disabled:!0,style:{display:"inline-flex",marginRight:2}}),o=a()(E.Z,{store:e,style:{display:"inline"}}),n=a()(w.Z,{prefix:a()(m.FormattedMessage,{id:"customizePageMenu.header.label",defaultMessage:"Page view for "}),viewName:i?l().createElement(l().Fragment,null,a()(W.Z,{onClick:d.xv,href:(0,z.Z)({store:i,fullyQualified:!1}),inline:!0},void 0,s,o)):l().createElement(l().Fragment,null,s,o)});return a()(C.Z,{style:{...Z.ZP.headingStyle},title:n,right:a()(I.Z,{helpButtonContext:"collection_properties_menu",href:(0,x.UY)("guides.databaseProperties")})})}}getSchema(){if("collection"!==this.props.type)return this.props.store.getSchema();{const e=this.props.store.getValue();if(e)return S.oC(e)}}getNormalizedFormat(){const e=this.props.store.getFormat(),t=this.getSchema();if(!t)return{};return A.iB(e,t,void 0,A.j5.Collection)}getCollectionPageProperties(){if("collection"!==this.props.type)return[];return this.getNormalizedFormat().collection_page_properties||[]}getPageCustomization(e){return{propertyVisibility:e.property_visibility,pageSectionVisibility:e.page_section_visibility}}}const q=H;var G=i(88923),K=i(27832);class j extends c.Z{constructor(...e){super(...e),n()(this,"renderModal",(()=>{if(!p.Z.state.isOpen)return;const e=b.$0(),{currentBlockStore:t}=K.default.state,i=G.ZP.state.open&&G.ZP.state.target||t;return e?a()(q,{store:e,type:"collection",intl:this.props.intl,locked:b.p1()}):i?a()(q,{store:i,type:"page",intl:this.props.intl,locked:!1}):void 0}))}renderComponent(){const{device:e}=this.environment,t=p.Z.state;return a()(u.ZP,{popupType:e.isMobile?u.ZP.PopupType.SlideUp:u.ZP.PopupType.Popup,alignmentToOrigin:u.ZP.Alignment.Center,open:t.isOpen,render:this.renderModal,originRect:t.isOpen?t.rect:void 0,onDismiss:()=>d.xv()})}}const Y=(0,m.injectIntl)(j)},20115:(e,t,i)=>{i.r(t),i.d(t,{default:()=>oe});var s=i(67154),a=i.n(s),o=i(98135),n=i.n(o),r=i(59713),l=i.n(r),d=(i(33948),i(67294)),c=i.n(d),u=i(96486),m=i.n(u),p=i(66832),g=i(32918),h=i(27211),f=i.n(h),v=i(17256),y=i(79583),M=i(47714),S=i(92555),b=i(39336);const T=m().memoize((e=>({"Africa/Abidjan":e.formatMessage({id:"allTimeZones.Africa/Abidjan",defaultMessage:"Africa/Abidjan"}),"Africa/Accra":e.formatMessage({id:"allTimeZones.Africa/Accra",defaultMessage:"Africa/Accra"}),"Africa/Addis_Ababa":e.formatMessage({id:"allTimeZones.Africa/Addis_Ababa",defaultMessage:"Africa/Addis_Ababa"}),"Africa/Algiers":e.formatMessage({id:"allTimeZones.Africa/Algiers",defaultMessage:"Africa/Algiers"}),"Africa/Asmara":e.formatMessage({id:"allTimeZones.Africa/Asmara",defaultMessage:"Africa/Asmara"}),"Africa/Asmera":e.formatMessage({id:"allTimeZones.Africa/Asmera",defaultMessage:"Africa/Asmera"}),"Africa/Bamako":e.formatMessage({id:"allTimeZones.Africa/Bamako",defaultMessage:"Africa/Bamako"}),"Africa/Bangui":e.formatMessage({id:"allTimeZones.Africa/Bangui",defaultMessage:"Africa/Bangui"}),"Africa/Banjul":e.formatMessage({id:"allTimeZones.Africa/Banjul",defaultMessage:"Africa/Banjul"}),"Africa/Bissau":e.formatMessage({id:"allTimeZones.Africa/Bissau",defaultMessage:"Africa/Bissau"}),"Africa/Blantyre":e.formatMessage({id:"allTimeZones.Africa/Blantyre",defaultMessage:"Africa/Blantyre"}),"Africa/Brazzaville":e.formatMessage({id:"allTimeZones.Africa/Brazzaville",defaultMessage:"Africa/Brazzaville"}),"Africa/Bujumbura":e.formatMessage({id:"allTimeZones.Africa/Bujumbura",defaultMessage:"Africa/Bujumbura"}),"Africa/Cairo":e.formatMessage({id:"allTimeZones.Africa/Cairo",defaultMessage:"Africa/Cairo"}),"Africa/Casablanca":e.formatMessage({id:"allTimeZones.Africa/Casablanca",defaultMessage:"Africa/Casablanca"}),"Africa/Ceuta":e.formatMessage({id:"allTimeZones.Africa/Ceuta",defaultMessage:"Africa/Ceuta"}),"Africa/Conakry":e.formatMessage({id:"allTimeZones.Africa/Conakry",defaultMessage:"Africa/Conakry"}),"Africa/Dakar":e.formatMessage({id:"allTimeZones.Africa/Dakar",defaultMessage:"Africa/Dakar"}),"Africa/Dar_es_Salaam":e.formatMessage({id:"allTimeZones.Africa/Dar_es_Salaam",defaultMessage:"Africa/Dar_es_Salaam"}),"Africa/Djibouti":e.formatMessage({id:"allTimeZones.Africa/Djibouti",defaultMessage:"Africa/Djibouti"}),"Africa/Douala":e.formatMessage({id:"allTimeZones.Africa/Douala",defaultMessage:"Africa/Douala"}),"Africa/El_Aaiun":e.formatMessage({id:"allTimeZones.Africa/El_Aaiun",defaultMessage:"Africa/El_Aaiun"}),"Africa/Freetown":e.formatMessage({id:"allTimeZones.Africa/Freetown",defaultMessage:"Africa/Freetown"}),"Africa/Gaborone":e.formatMessage({id:"allTimeZones.Africa/Gaborone",defaultMessage:"Africa/Gaborone"}),"Africa/Harare":e.formatMessage({id:"allTimeZones.Africa/Harare",defaultMessage:"Africa/Harare"}),"Africa/Johannesburg":e.formatMessage({id:"allTimeZones.Africa/Johannesburg",defaultMessage:"Africa/Johannesburg"}),"Africa/Juba":e.formatMessage({id:"allTimeZones.Africa/Juba",defaultMessage:"Africa/Juba"}),"Africa/Kampala":e.formatMessage({id:"allTimeZones.Africa/Kampala",defaultMessage:"Africa/Kampala"}),"Africa/Khartoum":e.formatMessage({id:"allTimeZones.Africa/Khartoum",defaultMessage:"Africa/Khartoum"}),"Africa/Kigali":e.formatMessage({id:"allTimeZones.Africa/Kigali",defaultMessage:"Africa/Kigali"}),"Africa/Kinshasa":e.formatMessage({id:"allTimeZones.Africa/Kinshasa",defaultMessage:"Africa/Kinshasa"}),"Africa/Lagos":e.formatMessage({id:"allTimeZones.Africa/Lagos",defaultMessage:"Africa/Lagos"}),"Africa/Libreville":e.formatMessage({id:"allTimeZones.Africa/Libreville",defaultMessage:"Africa/Libreville"}),"Africa/Lome":e.formatMessage({id:"allTimeZones.Africa/Lome",defaultMessage:"Africa/Lome"}),"Africa/Luanda":e.formatMessage({id:"allTimeZones.Africa/Luanda",defaultMessage:"Africa/Luanda"}),"Africa/Lubumbashi":e.formatMessage({id:"allTimeZones.Africa/Lubumbashi",defaultMessage:"Africa/Lubumbashi"}),"Africa/Lusaka":e.formatMessage({id:"allTimeZones.Africa/Lusaka",defaultMessage:"Africa/Lusaka"}),"Africa/Malabo":e.formatMessage({id:"allTimeZones.Africa/Malabo",defaultMessage:"Africa/Malabo"}),"Africa/Maputo":e.formatMessage({id:"allTimeZones.Africa/Maputo",defaultMessage:"Africa/Maputo"}),"Africa/Maseru":e.formatMessage({id:"allTimeZones.Africa/Maseru",defaultMessage:"Africa/Maseru"}),"Africa/Mbabane":e.formatMessage({id:"allTimeZones.Africa/Mbabane",defaultMessage:"Africa/Mbabane"}),"Africa/Mogadishu":e.formatMessage({id:"allTimeZones.Africa/Mogadishu",defaultMessage:"Africa/Mogadishu"}),"Africa/Monrovia":e.formatMessage({id:"allTimeZones.Africa/Monrovia",defaultMessage:"Africa/Monrovia"}),"Africa/Nairobi":e.formatMessage({id:"allTimeZones.Africa/Nairobi",defaultMessage:"Africa/Nairobi"}),"Africa/Ndjamena":e.formatMessage({id:"allTimeZones.Africa/Ndjamena",defaultMessage:"Africa/Ndjamena"}),"Africa/Niamey":e.formatMessage({id:"allTimeZones.Africa/Niamey",defaultMessage:"Africa/Niamey"}),"Africa/Nouakchott":e.formatMessage({id:"allTimeZones.Africa/Nouakchott",defaultMessage:"Africa/Nouakchott"}),"Africa/Ouagadougou":e.formatMessage({id:"allTimeZones.Africa/Ouagadougou",defaultMessage:"Africa/Ouagadougou"}),"Africa/Porto-Novo":e.formatMessage({id:"allTimeZones.Africa/Porto-Novo",defaultMessage:"Africa/Porto-Novo"}),"Africa/Sao_Tome":e.formatMessage({id:"allTimeZones.Africa/Sao_Tome",defaultMessage:"Africa/Sao_Tome"}),"Africa/Timbuktu":e.formatMessage({id:"allTimeZones.Africa/Timbuktu",defaultMessage:"Africa/Timbuktu"}),"Africa/Tripoli":e.formatMessage({id:"allTimeZones.Africa/Tripoli",defaultMessage:"Africa/Tripoli"}),"Africa/Tunis":e.formatMessage({id:"allTimeZones.Africa/Tunis",defaultMessage:"Africa/Tunis"}),"Africa/Windhoek":e.formatMessage({id:"allTimeZones.Africa/Windhoek",defaultMessage:"Africa/Windhoek"}),"America/Adak":e.formatMessage({id:"allTimeZones.America/Adak",defaultMessage:"America/Adak"}),"America/Anchorage":e.formatMessage({id:"allTimeZones.America/Anchorage",defaultMessage:"America/Anchorage"}),"America/Anguilla":e.formatMessage({id:"allTimeZones.America/Anguilla",defaultMessage:"America/Anguilla"}),"America/Antigua":e.formatMessage({id:"allTimeZones.America/Antigua",defaultMessage:"America/Antigua"}),"America/Araguaina":e.formatMessage({id:"allTimeZones.America/Araguaina",defaultMessage:"America/Araguaina"}),"America/Argentina/Buenos_Aires":e.formatMessage({id:"allTimeZones.America/Argentina/Buenos_Aires",defaultMessage:"America/Argentina/Buenos_Aires"}),"America/Argentina/Catamarca":e.formatMessage({id:"allTimeZones.America/Argentina/Catamarca",defaultMessage:"America/Argentina/Catamarca"}),"America/Argentina/ComodRivadavia":e.formatMessage({id:"allTimeZones.America/Argentina/ComodRivadavia",defaultMessage:"America/Argentina/ComodRivadavia"}),"America/Argentina/Cordoba":e.formatMessage({id:"allTimeZones.America/Argentina/Cordoba",defaultMessage:"America/Argentina/Cordoba"}),"America/Argentina/Jujuy":e.formatMessage({id:"allTimeZones.America/Argentina/Jujuy",defaultMessage:"America/Argentina/Jujuy"}),"America/Argentina/La_Rioja":e.formatMessage({id:"allTimeZones.America/Argentina/La_Rioja",defaultMessage:"America/Argentina/La_Rioja"}),"America/Argentina/Mendoza":e.formatMessage({id:"allTimeZones.America/Argentina/Mendoza",defaultMessage:"America/Argentina/Mendoza"}),"America/Argentina/Rio_Gallegos":e.formatMessage({id:"allTimeZones.America/Argentina/Rio_Gallegos",defaultMessage:"America/Argentina/Rio_Gallegos"}),"America/Argentina/Salta":e.formatMessage({id:"allTimeZones.America/Argentina/Salta",defaultMessage:"America/Argentina/Salta"}),"America/Argentina/San_Juan":e.formatMessage({id:"allTimeZones.America/Argentina/San_Juan",defaultMessage:"America/Argentina/San_Juan"}),"America/Argentina/San_Luis":e.formatMessage({id:"allTimeZones.America/Argentina/San_Luis",defaultMessage:"America/Argentina/San_Luis"}),"America/Argentina/Tucuman":e.formatMessage({id:"allTimeZones.America/Argentina/Tucuman",defaultMessage:"America/Argentina/Tucuman"}),"America/Argentina/Ushuaia":e.formatMessage({id:"allTimeZones.America/Argentina/Ushuaia",defaultMessage:"America/Argentina/Ushuaia"}),"America/Aruba":e.formatMessage({id:"allTimeZones.America/Aruba",defaultMessage:"America/Aruba"}),"America/Asuncion":e.formatMessage({id:"allTimeZones.America/Asuncion",defaultMessage:"America/Asuncion"}),"America/Atikokan":e.formatMessage({id:"allTimeZones.America/Atikokan",defaultMessage:"America/Atikokan"}),"America/Atka":e.formatMessage({id:"allTimeZones.America/Atka",defaultMessage:"America/Atka"}),"America/Bahia":e.formatMessage({id:"allTimeZones.America/Bahia",defaultMessage:"America/Bahia"}),"America/Bahia_Banderas":e.formatMessage({id:"allTimeZones.America/Bahia_Banderas",defaultMessage:"America/Bahia_Banderas"}),"America/Barbados":e.formatMessage({id:"allTimeZones.America/Barbados",defaultMessage:"America/Barbados"}),"America/Belem":e.formatMessage({id:"allTimeZones.America/Belem",defaultMessage:"America/Belem"}),"America/Belize":e.formatMessage({id:"allTimeZones.America/Belize",defaultMessage:"America/Belize"}),"America/Blanc-Sablon":e.formatMessage({id:"allTimeZones.America/Blanc-Sablon",defaultMessage:"America/Blanc-Sablon"}),"America/Boa_Vista":e.formatMessage({id:"allTimeZones.America/Boa_Vista",defaultMessage:"America/Boa_Vista"}),"America/Bogota":e.formatMessage({id:"allTimeZones.America/Bogota",defaultMessage:"America/Bogota"}),"America/Boise":e.formatMessage({id:"allTimeZones.America/Boise",defaultMessage:"America/Boise"}),"America/Buenos_Aires":e.formatMessage({id:"allTimeZones.America/Buenos_Aires",defaultMessage:"America/Buenos_Aires"}),"America/Cambridge_Bay":e.formatMessage({id:"allTimeZones.America/Cambridge_Bay",defaultMessage:"America/Cambridge_Bay"}),"America/Campo_Grande":e.formatMessage({id:"allTimeZones.America/Campo_Grande",defaultMessage:"America/Campo_Grande"}),"America/Cancun":e.formatMessage({id:"allTimeZones.America/Cancun",defaultMessage:"America/Cancun"}),"America/Caracas":e.formatMessage({id:"allTimeZones.America/Caracas",defaultMessage:"America/Caracas"}),"America/Catamarca":e.formatMessage({id:"allTimeZones.America/Catamarca",defaultMessage:"America/Catamarca"}),"America/Cayenne":e.formatMessage({id:"allTimeZones.America/Cayenne",defaultMessage:"America/Cayenne"}),"America/Cayman":e.formatMessage({id:"allTimeZones.America/Cayman",defaultMessage:"America/Cayman"}),"America/Chicago":e.formatMessage({id:"allTimeZones.America/Chicago",defaultMessage:"America/Chicago"}),"America/Chihuahua":e.formatMessage({id:"allTimeZones.America/Chihuahua",defaultMessage:"America/Chihuahua"}),"America/Coral_Harbour":e.formatMessage({id:"allTimeZones.America/Coral_Harbour",defaultMessage:"America/Coral_Harbour"}),"America/Cordoba":e.formatMessage({id:"allTimeZones.America/Cordoba",defaultMessage:"America/Cordoba"}),"America/Costa_Rica":e.formatMessage({id:"allTimeZones.America/Costa_Rica",defaultMessage:"America/Costa_Rica"}),"America/Creston":e.formatMessage({id:"allTimeZones.America/Creston",defaultMessage:"America/Creston"}),"America/Cuiaba":e.formatMessage({id:"allTimeZones.America/Cuiaba",defaultMessage:"America/Cuiaba"}),"America/Curacao":e.formatMessage({id:"allTimeZones.America/Curacao",defaultMessage:"America/Curacao"}),"America/Danmarkshavn":e.formatMessage({id:"allTimeZones.America/Danmarkshavn",defaultMessage:"America/Danmarkshavn"}),"America/Dawson":e.formatMessage({id:"allTimeZones.America/Dawson",defaultMessage:"America/Dawson"}),"America/Dawson_Creek":e.formatMessage({id:"allTimeZones.America/Dawson_Creek",defaultMessage:"America/Dawson_Creek"}),"America/Denver":e.formatMessage({id:"allTimeZones.America/Denver",defaultMessage:"America/Denver"}),"America/Detroit":e.formatMessage({id:"allTimeZones.America/Detroit",defaultMessage:"America/Detroit"}),"America/Dominica":e.formatMessage({id:"allTimeZones.America/Dominica",defaultMessage:"America/Dominica"}),"America/Edmonton":e.formatMessage({id:"allTimeZones.America/Edmonton",defaultMessage:"America/Edmonton"}),"America/Eirunepe":e.formatMessage({id:"allTimeZones.America/Eirunepe",defaultMessage:"America/Eirunepe"}),"America/El_Salvador":e.formatMessage({id:"allTimeZones.America/El_Salvador",defaultMessage:"America/El_Salvador"}),"America/Ensenada":e.formatMessage({id:"allTimeZones.America/Ensenada",defaultMessage:"America/Ensenada"}),"America/Fort_Nelson":e.formatMessage({id:"allTimeZones.America/Fort_Nelson",defaultMessage:"America/Fort_Nelson"}),"America/Fort_Wayne":e.formatMessage({id:"allTimeZones.America/Fort_Wayne",defaultMessage:"America/Fort_Wayne"}),"America/Fortaleza":e.formatMessage({id:"allTimeZones.America/Fortaleza",defaultMessage:"America/Fortaleza"}),"America/Glace_Bay":e.formatMessage({id:"allTimeZones.America/Glace_Bay",defaultMessage:"America/Glace_Bay"}),"America/Godthab":e.formatMessage({id:"allTimeZones.America/Godthab",defaultMessage:"America/Godthab"}),"America/Goose_Bay":e.formatMessage({id:"allTimeZones.America/Goose_Bay",defaultMessage:"America/Goose_Bay"}),"America/Grand_Turk":e.formatMessage({id:"allTimeZones.America/Grand_Turk",defaultMessage:"America/Grand_Turk"}),"America/Grenada":e.formatMessage({id:"allTimeZones.America/Grenada",defaultMessage:"America/Grenada"}),"America/Guadeloupe":e.formatMessage({id:"allTimeZones.America/Guadeloupe",defaultMessage:"America/Guadeloupe"}),"America/Guatemala":e.formatMessage({id:"allTimeZones.America/Guatemala",defaultMessage:"America/Guatemala"}),"America/Guayaquil":e.formatMessage({id:"allTimeZones.America/Guayaquil",defaultMessage:"America/Guayaquil"}),"America/Guyana":e.formatMessage({id:"allTimeZones.America/Guyana",defaultMessage:"America/Guyana"}),"America/Halifax":e.formatMessage({id:"allTimeZones.America/Halifax",defaultMessage:"America/Halifax"}),"America/Havana":e.formatMessage({id:"allTimeZones.America/Havana",defaultMessage:"America/Havana"}),"America/Hermosillo":e.formatMessage({id:"allTimeZones.America/Hermosillo",defaultMessage:"America/Hermosillo"}),"America/Indiana/Indianapolis":e.formatMessage({id:"allTimeZones.America/Indiana/Indianapolis",defaultMessage:"America/Indiana/Indianapolis"}),"America/Indiana/Knox":e.formatMessage({id:"allTimeZones.America/Indiana/Knox",defaultMessage:"America/Indiana/Knox"}),"America/Indiana/Marengo":e.formatMessage({id:"allTimeZones.America/Indiana/Marengo",defaultMessage:"America/Indiana/Marengo"}),"America/Indiana/Petersburg":e.formatMessage({id:"allTimeZones.America/Indiana/Petersburg",defaultMessage:"America/Indiana/Petersburg"}),"America/Indiana/Tell_City":e.formatMessage({id:"allTimeZones.America/Indiana/Tell_City",defaultMessage:"America/Indiana/Tell_City"}),"America/Indiana/Vevay":e.formatMessage({id:"allTimeZones.America/Indiana/Vevay",defaultMessage:"America/Indiana/Vevay"}),"America/Indiana/Vincennes":e.formatMessage({id:"allTimeZones.America/Indiana/Vincennes",defaultMessage:"America/Indiana/Vincennes"}),"America/Indiana/Winamac":e.formatMessage({id:"allTimeZones.America/Indiana/Winamac",defaultMessage:"America/Indiana/Winamac"}),"America/Indianapolis":e.formatMessage({id:"allTimeZones.America/Indianapolis",defaultMessage:"America/Indianapolis"}),"America/Inuvik":e.formatMessage({id:"allTimeZones.America/Inuvik",defaultMessage:"America/Inuvik"}),"America/Iqaluit":e.formatMessage({id:"allTimeZones.America/Iqaluit",defaultMessage:"America/Iqaluit"}),"America/Jamaica":e.formatMessage({id:"allTimeZones.America/Jamaica",defaultMessage:"America/Jamaica"}),"America/Jujuy":e.formatMessage({id:"allTimeZones.America/Jujuy",defaultMessage:"America/Jujuy"}),"America/Juneau":e.formatMessage({id:"allTimeZones.America/Juneau",defaultMessage:"America/Juneau"}),"America/Kentucky/Louisville":e.formatMessage({id:"allTimeZones.America/Kentucky/Louisville",defaultMessage:"America/Kentucky/Louisville"}),"America/Kentucky/Monticello":e.formatMessage({id:"allTimeZones.America/Kentucky/Monticello",defaultMessage:"America/Kentucky/Monticello"}),"America/Knox_IN":e.formatMessage({id:"allTimeZones.America/Knox_IN",defaultMessage:"America/Knox_IN"}),"America/Kralendijk":e.formatMessage({id:"allTimeZones.America/Kralendijk",defaultMessage:"America/Kralendijk"}),"America/La_Paz":e.formatMessage({id:"allTimeZones.America/La_Paz",defaultMessage:"America/La_Paz"}),"America/Lima":e.formatMessage({id:"allTimeZones.America/Lima",defaultMessage:"America/Lima"}),"America/Los_Angeles":e.formatMessage({id:"allTimeZones.America/Los_Angeles",defaultMessage:"America/Los_Angeles"}),"America/Louisville":e.formatMessage({id:"allTimeZones.America/Louisville",defaultMessage:"America/Louisville"}),"America/Lower_Princes":e.formatMessage({id:"allTimeZones.America/Lower_Princes",defaultMessage:"America/Lower_Princes"}),"America/Maceio":e.formatMessage({id:"allTimeZones.America/Maceio",defaultMessage:"America/Maceio"}),"America/Managua":e.formatMessage({id:"allTimeZones.America/Managua",defaultMessage:"America/Managua"}),"America/Manaus":e.formatMessage({id:"allTimeZones.America/Manaus",defaultMessage:"America/Manaus"}),"America/Marigot":e.formatMessage({id:"allTimeZones.America/Marigot",defaultMessage:"America/Marigot"}),"America/Martinique":e.formatMessage({id:"allTimeZones.America/Martinique",defaultMessage:"America/Martinique"}),"America/Matamoros":e.formatMessage({id:"allTimeZones.America/Matamoros",defaultMessage:"America/Matamoros"}),"America/Mazatlan":e.formatMessage({id:"allTimeZones.America/Mazatlan",defaultMessage:"America/Mazatlan"}),"America/Mendoza":e.formatMessage({id:"allTimeZones.America/Mendoza",defaultMessage:"America/Mendoza"}),"America/Menominee":e.formatMessage({id:"allTimeZones.America/Menominee",defaultMessage:"America/Menominee"}),"America/Merida":e.formatMessage({id:"allTimeZones.America/Merida",defaultMessage:"America/Merida"}),"America/Metlakatla":e.formatMessage({id:"allTimeZones.America/Metlakatla",defaultMessage:"America/Metlakatla"}),"America/Mexico_City":e.formatMessage({id:"allTimeZones.America/Mexico_City",defaultMessage:"America/Mexico_City"}),"America/Miquelon":e.formatMessage({id:"allTimeZones.America/Miquelon",defaultMessage:"America/Miquelon"}),"America/Moncton":e.formatMessage({id:"allTimeZones.America/Moncton",defaultMessage:"America/Moncton"}),"America/Monterrey":e.formatMessage({id:"allTimeZones.America/Monterrey",defaultMessage:"America/Monterrey"}),"America/Montevideo":e.formatMessage({id:"allTimeZones.America/Montevideo",defaultMessage:"America/Montevideo"}),"America/Montreal":e.formatMessage({id:"allTimeZones.America/Montreal",defaultMessage:"America/Montreal"}),"America/Montserrat":e.formatMessage({id:"allTimeZones.America/Montserrat",defaultMessage:"America/Montserrat"}),"America/Nassau":e.formatMessage({id:"allTimeZones.America/Nassau",defaultMessage:"America/Nassau"}),"America/New_York":e.formatMessage({id:"allTimeZones.America/New_York",defaultMessage:"America/New_York"}),"America/Nipigon":e.formatMessage({id:"allTimeZones.America/Nipigon",defaultMessage:"America/Nipigon"}),"America/Nome":e.formatMessage({id:"allTimeZones.America/Nome",defaultMessage:"America/Nome"}),"America/Noronha":e.formatMessage({id:"allTimeZones.America/Noronha",defaultMessage:"America/Noronha"}),"America/North_Dakota/Beulah":e.formatMessage({id:"allTimeZones.America/North_Dakota/Beulah",defaultMessage:"America/North_Dakota/Beulah"}),"America/North_Dakota/Center":e.formatMessage({id:"allTimeZones.America/North_Dakota/Center",defaultMessage:"America/North_Dakota/Center"}),"America/North_Dakota/New_Salem":e.formatMessage({id:"allTimeZones.America/North_Dakota/New_Salem",defaultMessage:"America/North_Dakota/New_Salem"}),"America/Ojinaga":e.formatMessage({id:"allTimeZones.America/Ojinaga",defaultMessage:"America/Ojinaga"}),"America/Panama":e.formatMessage({id:"allTimeZones.America/Panama",defaultMessage:"America/Panama"}),"America/Pangnirtung":e.formatMessage({id:"allTimeZones.America/Pangnirtung",defaultMessage:"America/Pangnirtung"}),"America/Paramaribo":e.formatMessage({id:"allTimeZones.America/Paramaribo",defaultMessage:"America/Paramaribo"}),"America/Phoenix":e.formatMessage({id:"allTimeZones.America/Phoenix",defaultMessage:"America/Phoenix"}),"America/Port-au-Prince":e.formatMessage({id:"allTimeZones.America/Port-au-Prince",defaultMessage:"America/Port-au-Prince"}),"America/Port_of_Spain":e.formatMessage({id:"allTimeZones.America/Port_of_Spain",defaultMessage:"America/Port_of_Spain"}),"America/Porto_Acre":e.formatMessage({id:"allTimeZones.America/Porto_Acre",defaultMessage:"America/Porto_Acre"}),"America/Porto_Velho":e.formatMessage({id:"allTimeZones.America/Porto_Velho",defaultMessage:"America/Porto_Velho"}),"America/Puerto_Rico":e.formatMessage({id:"allTimeZones.America/Puerto_Rico",defaultMessage:"America/Puerto_Rico"}),"America/Punta_Arenas":e.formatMessage({id:"allTimeZones.America/Punta_Arenas",defaultMessage:"America/Punta_Arenas"}),"America/Rainy_River":e.formatMessage({id:"allTimeZones.America/Rainy_River",defaultMessage:"America/Rainy_River"}),"America/Rankin_Inlet":e.formatMessage({id:"allTimeZones.America/Rankin_Inlet",defaultMessage:"America/Rankin_Inlet"}),"America/Recife":e.formatMessage({id:"allTimeZones.America/Recife",defaultMessage:"America/Recife"}),"America/Regina":e.formatMessage({id:"allTimeZones.America/Regina",defaultMessage:"America/Regina"}),"America/Resolute":e.formatMessage({id:"allTimeZones.America/Resolute",defaultMessage:"America/Resolute"}),"America/Rio_Branco":e.formatMessage({id:"allTimeZones.America/Rio_Branco",defaultMessage:"America/Rio_Branco"}),"America/Rosario":e.formatMessage({id:"allTimeZones.America/Rosario",defaultMessage:"America/Rosario"}),"America/Santa_Isabel":e.formatMessage({id:"allTimeZones.America/Santa_Isabel",defaultMessage:"America/Santa_Isabel"}),"America/Santarem":e.formatMessage({id:"allTimeZones.America/Santarem",defaultMessage:"America/Santarem"}),"America/Santiago":e.formatMessage({id:"allTimeZones.America/Santiago",defaultMessage:"America/Santiago"}),"America/Santo_Domingo":e.formatMessage({id:"allTimeZones.America/Santo_Domingo",defaultMessage:"America/Santo_Domingo"}),"America/Sao_Paulo":e.formatMessage({id:"allTimeZones.America/Sao_Paulo",defaultMessage:"America/Sao_Paulo"}),"America/Scoresbysund":e.formatMessage({id:"allTimeZones.America/Scoresbysund",defaultMessage:"America/Scoresbysund"}),"America/Shiprock":e.formatMessage({id:"allTimeZones.America/Shiprock",defaultMessage:"America/Shiprock"}),"America/Sitka":e.formatMessage({id:"allTimeZones.America/Sitka",defaultMessage:"America/Sitka"}),"America/St_Barthelemy":e.formatMessage({id:"allTimeZones.America/St_Barthelemy",defaultMessage:"America/St_Barthelemy"}),"America/St_Johns":e.formatMessage({id:"allTimeZones.America/St_Johns",defaultMessage:"America/St_Johns"}),"America/St_Kitts":e.formatMessage({id:"allTimeZones.America/St_Kitts",defaultMessage:"America/St_Kitts"}),"America/St_Lucia":e.formatMessage({id:"allTimeZones.America/St_Lucia",defaultMessage:"America/St_Lucia"}),"America/St_Thomas":e.formatMessage({id:"allTimeZones.America/St_Thomas",defaultMessage:"America/St_Thomas"}),"America/St_Vincent":e.formatMessage({id:"allTimeZones.America/St_Vincent",defaultMessage:"America/St_Vincent"}),"America/Swift_Current":e.formatMessage({id:"allTimeZones.America/Swift_Current",defaultMessage:"America/Swift_Current"}),"America/Tegucigalpa":e.formatMessage({id:"allTimeZones.America/Tegucigalpa",defaultMessage:"America/Tegucigalpa"}),"America/Thule":e.formatMessage({id:"allTimeZones.America/Thule",defaultMessage:"America/Thule"}),"America/Thunder_Bay":e.formatMessage({id:"allTimeZones.America/Thunder_Bay",defaultMessage:"America/Thunder_Bay"}),"America/Tijuana":e.formatMessage({id:"allTimeZones.America/Tijuana",defaultMessage:"America/Tijuana"}),"America/Toronto":e.formatMessage({id:"allTimeZones.America/Toronto",defaultMessage:"America/Toronto"}),"America/Tortola":e.formatMessage({id:"allTimeZones.America/Tortola",defaultMessage:"America/Tortola"}),"America/Vancouver":e.formatMessage({id:"allTimeZones.America/Vancouver",defaultMessage:"America/Vancouver"}),"America/Virgin":e.formatMessage({id:"allTimeZones.America/Virgin",defaultMessage:"America/Virgin"}),"America/Whitehorse":e.formatMessage({id:"allTimeZones.America/Whitehorse",defaultMessage:"America/Whitehorse"}),"America/Winnipeg":e.formatMessage({id:"allTimeZones.America/Winnipeg",defaultMessage:"America/Winnipeg"}),"America/Yakutat":e.formatMessage({id:"allTimeZones.America/Yakutat",defaultMessage:"America/Yakutat"}),"America/Yellowknife":e.formatMessage({id:"allTimeZones.America/Yellowknife",defaultMessage:"America/Yellowknife"}),"Antarctica/Casey":e.formatMessage({id:"allTimeZones.Antarctica/Casey",defaultMessage:"Antarctica/Casey"}),"Antarctica/Davis":e.formatMessage({id:"allTimeZones.Antarctica/Davis",defaultMessage:"Antarctica/Davis"}),"Antarctica/DumontDUrville":e.formatMessage({id:"allTimeZones.Antarctica/DumontDUrville",defaultMessage:"Antarctica/DumontDUrville"}),"Antarctica/Macquarie":e.formatMessage({id:"allTimeZones.Antarctica/Macquarie",defaultMessage:"Antarctica/Macquarie"}),"Antarctica/Mawson":e.formatMessage({id:"allTimeZones.Antarctica/Mawson",defaultMessage:"Antarctica/Mawson"}),"Antarctica/McMurdo":e.formatMessage({id:"allTimeZones.Antarctica/McMurdo",defaultMessage:"Antarctica/McMurdo"}),"Antarctica/Palmer":e.formatMessage({id:"allTimeZones.Antarctica/Palmer",defaultMessage:"Antarctica/Palmer"}),"Antarctica/Rothera":e.formatMessage({id:"allTimeZones.Antarctica/Rothera",defaultMessage:"Antarctica/Rothera"}),"Antarctica/South_Pole":e.formatMessage({id:"allTimeZones.Antarctica/South_Pole",defaultMessage:"Antarctica/South_Pole"}),"Antarctica/Syowa":e.formatMessage({id:"allTimeZones.Antarctica/Syowa",defaultMessage:"Antarctica/Syowa"}),"Antarctica/Troll":e.formatMessage({id:"allTimeZones.Antarctica/Troll",defaultMessage:"Antarctica/Troll"}),"Antarctica/Vostok":e.formatMessage({id:"allTimeZones.Antarctica/Vostok",defaultMessage:"Antarctica/Vostok"}),"Arctic/Longyearbyen":e.formatMessage({id:"allTimeZones.Arctic/Longyearbyen",defaultMessage:"Arctic/Longyearbyen"}),"Asia/Aden":e.formatMessage({id:"allTimeZones.Asia/Aden",defaultMessage:"Asia/Aden"}),"Asia/Almaty":e.formatMessage({id:"allTimeZones.Asia/Almaty",defaultMessage:"Asia/Almaty"}),"Asia/Amman":e.formatMessage({id:"allTimeZones.Asia/Amman",defaultMessage:"Asia/Amman"}),"Asia/Anadyr":e.formatMessage({id:"allTimeZones.Asia/Anadyr",defaultMessage:"Asia/Anadyr"}),"Asia/Aqtau":e.formatMessage({id:"allTimeZones.Asia/Aqtau",defaultMessage:"Asia/Aqtau"}),"Asia/Aqtobe":e.formatMessage({id:"allTimeZones.Asia/Aqtobe",defaultMessage:"Asia/Aqtobe"}),"Asia/Ashgabat":e.formatMessage({id:"allTimeZones.Asia/Ashgabat",defaultMessage:"Asia/Ashgabat"}),"Asia/Ashkhabad":e.formatMessage({id:"allTimeZones.Asia/Ashkhabad",defaultMessage:"Asia/Ashkhabad"}),"Asia/Atyrau":e.formatMessage({id:"allTimeZones.Asia/Atyrau",defaultMessage:"Asia/Atyrau"}),"Asia/Baghdad":e.formatMessage({id:"allTimeZones.Asia/Baghdad",defaultMessage:"Asia/Baghdad"}),"Asia/Bahrain":e.formatMessage({id:"allTimeZones.Asia/Bahrain",defaultMessage:"Asia/Bahrain"}),"Asia/Baku":e.formatMessage({id:"allTimeZones.Asia/Baku",defaultMessage:"Asia/Baku"}),"Asia/Bangkok":e.formatMessage({id:"allTimeZones.Asia/Bangkok",defaultMessage:"Asia/Bangkok"}),"Asia/Barnaul":e.formatMessage({id:"allTimeZones.Asia/Barnaul",defaultMessage:"Asia/Barnaul"}),"Asia/Beirut":e.formatMessage({id:"allTimeZones.Asia/Beirut",defaultMessage:"Asia/Beirut"}),"Asia/Bishkek":e.formatMessage({id:"allTimeZones.Asia/Bishkek",defaultMessage:"Asia/Bishkek"}),"Asia/Brunei":e.formatMessage({id:"allTimeZones.Asia/Brunei",defaultMessage:"Asia/Brunei"}),"Asia/Calcutta":e.formatMessage({id:"allTimeZones.Asia/Calcutta",defaultMessage:"Asia/Calcutta"}),"Asia/Chita":e.formatMessage({id:"allTimeZones.Asia/Chita",defaultMessage:"Asia/Chita"}),"Asia/Choibalsan":e.formatMessage({id:"allTimeZones.Asia/Choibalsan",defaultMessage:"Asia/Choibalsan"}),"Asia/Chongqing":e.formatMessage({id:"allTimeZones.Asia/Chongqing",defaultMessage:"Asia/Chongqing"}),"Asia/Chungking":e.formatMessage({id:"allTimeZones.Asia/Chungking",defaultMessage:"Asia/Chungking"}),"Asia/Colombo":e.formatMessage({id:"allTimeZones.Asia/Colombo",defaultMessage:"Asia/Colombo"}),"Asia/Dacca":e.formatMessage({id:"allTimeZones.Asia/Dacca",defaultMessage:"Asia/Dacca"}),"Asia/Damascus":e.formatMessage({id:"allTimeZones.Asia/Damascus",defaultMessage:"Asia/Damascus"}),"Asia/Dhaka":e.formatMessage({id:"allTimeZones.Asia/Dhaka",defaultMessage:"Asia/Dhaka"}),"Asia/Dili":e.formatMessage({id:"allTimeZones.Asia/Dili",defaultMessage:"Asia/Dili"}),"Asia/Dubai":e.formatMessage({id:"allTimeZones.Asia/Dubai",defaultMessage:"Asia/Dubai"}),"Asia/Dushanbe":e.formatMessage({id:"allTimeZones.Asia/Dushanbe",defaultMessage:"Asia/Dushanbe"}),"Asia/Famagusta":e.formatMessage({id:"allTimeZones.Asia/Famagusta",defaultMessage:"Asia/Famagusta"}),"Asia/Gaza":e.formatMessage({id:"allTimeZones.Asia/Gaza",defaultMessage:"Asia/Gaza"}),"Asia/Harbin":e.formatMessage({id:"allTimeZones.Asia/Harbin",defaultMessage:"Asia/Harbin"}),"Asia/Hebron":e.formatMessage({id:"allTimeZones.Asia/Hebron",defaultMessage:"Asia/Hebron"}),"Asia/Ho_Chi_Minh":e.formatMessage({id:"allTimeZones.Asia/Ho_Chi_Minh",defaultMessage:"Asia/Ho_Chi_Minh"}),"Asia/Hong_Kong":e.formatMessage({id:"allTimeZones.Asia/Hong_Kong",defaultMessage:"Asia/Hong_Kong"}),"Asia/Hovd":e.formatMessage({id:"allTimeZones.Asia/Hovd",defaultMessage:"Asia/Hovd"}),"Asia/Irkutsk":e.formatMessage({id:"allTimeZones.Asia/Irkutsk",defaultMessage:"Asia/Irkutsk"}),"Asia/Istanbul":e.formatMessage({id:"allTimeZones.Asia/Istanbul",defaultMessage:"Asia/Istanbul"}),"Asia/Jakarta":e.formatMessage({id:"allTimeZones.Asia/Jakarta",defaultMessage:"Asia/Jakarta"}),"Asia/Jayapura":e.formatMessage({id:"allTimeZones.Asia/Jayapura",defaultMessage:"Asia/Jayapura"}),"Asia/Jerusalem":e.formatMessage({id:"allTimeZones.Asia/Jerusalem",defaultMessage:"Asia/Jerusalem"}),"Asia/Kabul":e.formatMessage({id:"allTimeZones.Asia/Kabul",defaultMessage:"Asia/Kabul"}),"Asia/Kamchatka":e.formatMessage({id:"allTimeZones.Asia/Kamchatka",defaultMessage:"Asia/Kamchatka"}),"Asia/Karachi":e.formatMessage({id:"allTimeZones.Asia/Karachi",defaultMessage:"Asia/Karachi"}),"Asia/Kashgar":e.formatMessage({id:"allTimeZones.Asia/Kashgar",defaultMessage:"Asia/Kashgar"}),"Asia/Kathmandu":e.formatMessage({id:"allTimeZones.Asia/Kathmandu",defaultMessage:"Asia/Kathmandu"}),"Asia/Katmandu":e.formatMessage({id:"allTimeZones.Asia/Katmandu",defaultMessage:"Asia/Katmandu"}),"Asia/Khandyga":e.formatMessage({id:"allTimeZones.Asia/Khandyga",defaultMessage:"Asia/Khandyga"}),"Asia/Kolkata":e.formatMessage({id:"allTimeZones.Asia/Kolkata",defaultMessage:"Asia/Kolkata"}),"Asia/Krasnoyarsk":e.formatMessage({id:"allTimeZones.Asia/Krasnoyarsk",defaultMessage:"Asia/Krasnoyarsk"}),"Asia/Kuala_Lumpur":e.formatMessage({id:"allTimeZones.Asia/Kuala_Lumpur",defaultMessage:"Asia/Kuala_Lumpur"}),"Asia/Kuching":e.formatMessage({id:"allTimeZones.Asia/Kuching",defaultMessage:"Asia/Kuching"}),"Asia/Kuwait":e.formatMessage({id:"allTimeZones.Asia/Kuwait",defaultMessage:"Asia/Kuwait"}),"Asia/Macao":e.formatMessage({id:"allTimeZones.Asia/Macao",defaultMessage:"Asia/Macao"}),"Asia/Macau":e.formatMessage({id:"allTimeZones.Asia/Macau",defaultMessage:"Asia/Macau"}),"Asia/Magadan":e.formatMessage({id:"allTimeZones.Asia/Magadan",defaultMessage:"Asia/Magadan"}),"Asia/Makassar":e.formatMessage({id:"allTimeZones.Asia/Makassar",defaultMessage:"Asia/Makassar"}),"Asia/Manila":e.formatMessage({id:"allTimeZones.Asia/Manila",defaultMessage:"Asia/Manila"}),"Asia/Muscat":e.formatMessage({id:"allTimeZones.Asia/Muscat",defaultMessage:"Asia/Muscat"}),"Asia/Nicosia":e.formatMessage({id:"allTimeZones.Asia/Nicosia",defaultMessage:"Asia/Nicosia"}),"Asia/Novokuznetsk":e.formatMessage({id:"allTimeZones.Asia/Novokuznetsk",defaultMessage:"Asia/Novokuznetsk"}),"Asia/Novosibirsk":e.formatMessage({id:"allTimeZones.Asia/Novosibirsk",defaultMessage:"Asia/Novosibirsk"}),"Asia/Omsk":e.formatMessage({id:"allTimeZones.Asia/Omsk",defaultMessage:"Asia/Omsk"}),"Asia/Oral":e.formatMessage({id:"allTimeZones.Asia/Oral",defaultMessage:"Asia/Oral"}),"Asia/Phnom_Penh":e.formatMessage({id:"allTimeZones.Asia/Phnom_Penh",defaultMessage:"Asia/Phnom_Penh"}),"Asia/Pontianak":e.formatMessage({id:"allTimeZones.Asia/Pontianak",defaultMessage:"Asia/Pontianak"}),"Asia/Pyongyang":e.formatMessage({id:"allTimeZones.Asia/Pyongyang",defaultMessage:"Asia/Pyongyang"}),"Asia/Qatar":e.formatMessage({id:"allTimeZones.Asia/Qatar",defaultMessage:"Asia/Qatar"}),"Asia/Qostanay":e.formatMessage({id:"allTimeZones.Asia/Qostanay",defaultMessage:"Asia/Qostanay"}),"Asia/Qyzylorda":e.formatMessage({id:"allTimeZones.Asia/Qyzylorda",defaultMessage:"Asia/Qyzylorda"}),"Asia/Rangoon":e.formatMessage({id:"allTimeZones.Asia/Rangoon",defaultMessage:"Asia/Rangoon"}),"Asia/Riyadh":e.formatMessage({id:"allTimeZones.Asia/Riyadh",defaultMessage:"Asia/Riyadh"}),"Asia/Saigon":e.formatMessage({id:"allTimeZones.Asia/Saigon",defaultMessage:"Asia/Saigon"}),"Asia/Sakhalin":e.formatMessage({id:"allTimeZones.Asia/Sakhalin",defaultMessage:"Asia/Sakhalin"}),"Asia/Samarkand":e.formatMessage({id:"allTimeZones.Asia/Samarkand",defaultMessage:"Asia/Samarkand"}),"Asia/Seoul":e.formatMessage({id:"allTimeZones.Asia/Seoul",defaultMessage:"Asia/Seoul"}),"Asia/Shanghai":e.formatMessage({id:"allTimeZones.Asia/Shanghai",defaultMessage:"Asia/Shanghai"}),"Asia/Singapore":e.formatMessage({id:"allTimeZones.Asia/Singapore",defaultMessage:"Asia/Singapore"}),"Asia/Srednekolymsk":e.formatMessage({id:"allTimeZones.Asia/Srednekolymsk",defaultMessage:"Asia/Srednekolymsk"}),"Asia/Taipei":e.formatMessage({id:"allTimeZones.Asia/Taipei",defaultMessage:"Asia/Taipei"}),"Asia/Tashkent":e.formatMessage({id:"allTimeZones.Asia/Tashkent",defaultMessage:"Asia/Tashkent"}),"Asia/Tbilisi":e.formatMessage({id:"allTimeZones.Asia/Tbilisi",defaultMessage:"Asia/Tbilisi"}),"Asia/Tehran":e.formatMessage({id:"allTimeZones.Asia/Tehran",defaultMessage:"Asia/Tehran"}),"Asia/Tel_Aviv":e.formatMessage({id:"allTimeZones.Asia/Tel_Aviv",defaultMessage:"Asia/Tel_Aviv"}),"Asia/Thimbu":e.formatMessage({id:"allTimeZones.Asia/Thimbu",defaultMessage:"Asia/Thimbu"}),"Asia/Thimphu":e.formatMessage({id:"allTimeZones.Asia/Thimphu",defaultMessage:"Asia/Thimphu"}),"Asia/Tokyo":e.formatMessage({id:"allTimeZones.Asia/Tokyo",defaultMessage:"Asia/Tokyo"}),"Asia/Tomsk":e.formatMessage({id:"allTimeZones.Asia/Tomsk",defaultMessage:"Asia/Tomsk"}),"Asia/Ujung_Pandang":e.formatMessage({id:"allTimeZones.Asia/Ujung_Pandang",defaultMessage:"Asia/Ujung_Pandang"}),"Asia/Ulaanbaatar":e.formatMessage({id:"allTimeZones.Asia/Ulaanbaatar",defaultMessage:"Asia/Ulaanbaatar"}),"Asia/Ulan_Bator":e.formatMessage({id:"allTimeZones.Asia/Ulan_Bator",defaultMessage:"Asia/Ulan_Bator"}),"Asia/Urumqi":e.formatMessage({id:"allTimeZones.Asia/Urumqi",defaultMessage:"Asia/Urumqi"}),"Asia/Ust-Nera":e.formatMessage({id:"allTimeZones.Asia/Ust-Nera",defaultMessage:"Asia/Ust-Nera"}),"Asia/Vientiane":e.formatMessage({id:"allTimeZones.Asia/Vientiane",defaultMessage:"Asia/Vientiane"}),"Asia/Vladivostok":e.formatMessage({id:"allTimeZones.Asia/Vladivostok",defaultMessage:"Asia/Vladivostok"}),"Asia/Yakutsk":e.formatMessage({id:"allTimeZones.Asia/Yakutsk",defaultMessage:"Asia/Yakutsk"}),"Asia/Yangon":e.formatMessage({id:"allTimeZones.Asia/Yangon",defaultMessage:"Asia/Yangon"}),"Asia/Yekaterinburg":e.formatMessage({id:"allTimeZones.Asia/Yekaterinburg",defaultMessage:"Asia/Yekaterinburg"}),"Asia/Yerevan":e.formatMessage({id:"allTimeZones.Asia/Yerevan",defaultMessage:"Asia/Yerevan"}),"Atlantic/Azores":e.formatMessage({id:"allTimeZones.Atlantic/Azores",defaultMessage:"Atlantic/Azores"}),"Atlantic/Bermuda":e.formatMessage({id:"allTimeZones.Atlantic/Bermuda",defaultMessage:"Atlantic/Bermuda"}),"Atlantic/Canary":e.formatMessage({id:"allTimeZones.Atlantic/Canary",defaultMessage:"Atlantic/Canary"}),"Atlantic/Cape_Verde":e.formatMessage({id:"allTimeZones.Atlantic/Cape_Verde",defaultMessage:"Atlantic/Cape_Verde"}),"Atlantic/Faeroe":e.formatMessage({id:"allTimeZones.Atlantic/Faeroe",defaultMessage:"Atlantic/Faeroe"}),"Atlantic/Faroe":e.formatMessage({id:"allTimeZones.Atlantic/Faroe",defaultMessage:"Atlantic/Faroe"}),"Atlantic/Jan_Mayen":e.formatMessage({id:"allTimeZones.Atlantic/Jan_Mayen",defaultMessage:"Atlantic/Jan_Mayen"}),"Atlantic/Madeira":e.formatMessage({id:"allTimeZones.Atlantic/Madeira",defaultMessage:"Atlantic/Madeira"}),"Atlantic/Reykjavik":e.formatMessage({id:"allTimeZones.Atlantic/Reykjavik",defaultMessage:"Atlantic/Reykjavik"}),"Atlantic/South_Georgia":e.formatMessage({id:"allTimeZones.Atlantic/South_Georgia",defaultMessage:"Atlantic/South_Georgia"}),"Atlantic/St_Helena":e.formatMessage({id:"allTimeZones.Atlantic/St_Helena",defaultMessage:"Atlantic/St_Helena"}),"Atlantic/Stanley":e.formatMessage({id:"allTimeZones.Atlantic/Stanley",defaultMessage:"Atlantic/Stanley"}),"Australia/ACT":e.formatMessage({id:"allTimeZones.Australia/ACT",defaultMessage:"Australia/ACT"}),"Australia/Adelaide":e.formatMessage({id:"allTimeZones.Australia/Adelaide",defaultMessage:"Australia/Adelaide"}),"Australia/Brisbane":e.formatMessage({id:"allTimeZones.Australia/Brisbane",defaultMessage:"Australia/Brisbane"}),"Australia/Broken_Hill":e.formatMessage({id:"allTimeZones.Australia/Broken_Hill",defaultMessage:"Australia/Broken_Hill"}),"Australia/Canberra":e.formatMessage({id:"allTimeZones.Australia/Canberra",defaultMessage:"Australia/Canberra"}),"Australia/Currie":e.formatMessage({id:"allTimeZones.Australia/Currie",defaultMessage:"Australia/Currie"}),"Australia/Darwin":e.formatMessage({id:"allTimeZones.Australia/Darwin",defaultMessage:"Australia/Darwin"}),"Australia/Eucla":e.formatMessage({id:"allTimeZones.Australia/Eucla",defaultMessage:"Australia/Eucla"}),"Australia/Hobart":e.formatMessage({id:"allTimeZones.Australia/Hobart",defaultMessage:"Australia/Hobart"}),"Australia/LHI":e.formatMessage({id:"allTimeZones.Australia/LHI",defaultMessage:"Australia/LHI"}),"Australia/Lindeman":e.formatMessage({id:"allTimeZones.Australia/Lindeman",defaultMessage:"Australia/Lindeman"}),"Australia/Lord_Howe":e.formatMessage({id:"allTimeZones.Australia/Lord_Howe",defaultMessage:"Australia/Lord_Howe"}),"Australia/Melbourne":e.formatMessage({id:"allTimeZones.Australia/Melbourne",defaultMessage:"Australia/Melbourne"}),"Australia/NSW":e.formatMessage({id:"allTimeZones.Australia/NSW",defaultMessage:"Australia/NSW"}),"Australia/North":e.formatMessage({id:"allTimeZones.Australia/North",defaultMessage:"Australia/North"}),"Australia/Perth":e.formatMessage({id:"allTimeZones.Australia/Perth",defaultMessage:"Australia/Perth"}),"Australia/Queensland":e.formatMessage({id:"allTimeZones.Australia/Queensland",defaultMessage:"Australia/Queensland"}),"Australia/South":e.formatMessage({id:"allTimeZones.Australia/South",defaultMessage:"Australia/South"}),"Australia/Sydney":e.formatMessage({id:"allTimeZones.Australia/Sydney",defaultMessage:"Australia/Sydney"}),"Australia/Tasmania":e.formatMessage({id:"allTimeZones.Australia/Tasmania",defaultMessage:"Australia/Tasmania"}),"Australia/Victoria":e.formatMessage({id:"allTimeZones.Australia/Victoria",defaultMessage:"Australia/Victoria"}),"Australia/West":e.formatMessage({id:"allTimeZones.Australia/West",defaultMessage:"Australia/West"}),"Australia/Yancowinna":e.formatMessage({id:"allTimeZones.Australia/Yancowinna",defaultMessage:"Australia/Yancowinna"}),"Brazil/Acre":e.formatMessage({id:"allTimeZones.Brazil/Acre",defaultMessage:"Brazil/Acre"}),"Brazil/DeNoronha":e.formatMessage({id:"allTimeZones.Brazil/DeNoronha",defaultMessage:"Brazil/DeNoronha"}),"Brazil/East":e.formatMessage({id:"allTimeZones.Brazil/East",defaultMessage:"Brazil/East"}),"Brazil/West":e.formatMessage({id:"allTimeZones.Brazil/West",defaultMessage:"Brazil/West"}),CET:e.formatMessage({id:"allTimeZones.CET",defaultMessage:"CET"}),CST6CDT:e.formatMessage({id:"allTimeZones.CST6CDT",defaultMessage:"CST6CDT"}),"Canada/Atlantic":e.formatMessage({id:"allTimeZones.Canada/Atlantic",defaultMessage:"Canada/Atlantic"}),"Canada/Central":e.formatMessage({id:"allTimeZones.Canada/Central",defaultMessage:"Canada/Central"}),"Canada/Eastern":e.formatMessage({id:"allTimeZones.Canada/Eastern",defaultMessage:"Canada/Eastern"}),"Canada/Mountain":e.formatMessage({id:"allTimeZones.Canada/Mountain",defaultMessage:"Canada/Mountain"}),"Canada/Newfoundland":e.formatMessage({id:"allTimeZones.Canada/Newfoundland",defaultMessage:"Canada/Newfoundland"}),"Canada/Pacific":e.formatMessage({id:"allTimeZones.Canada/Pacific",defaultMessage:"Canada/Pacific"}),"Canada/Saskatchewan":e.formatMessage({id:"allTimeZones.Canada/Saskatchewan",defaultMessage:"Canada/Saskatchewan"}),"Canada/Yukon":e.formatMessage({id:"allTimeZones.Canada/Yukon",defaultMessage:"Canada/Yukon"}),"Chile/Continental":e.formatMessage({id:"allTimeZones.Chile/Continental",defaultMessage:"Chile/Continental"}),"Chile/EasterIsland":e.formatMessage({id:"allTimeZones.Chile/EasterIsland",defaultMessage:"Chile/EasterIsland"}),Cuba:e.formatMessage({id:"allTimeZones.Cuba",defaultMessage:"Cuba"}),EET:e.formatMessage({id:"allTimeZones.EET",defaultMessage:"EET"}),EST:e.formatMessage({id:"allTimeZones.EST",defaultMessage:"EST"}),EST5EDT:e.formatMessage({id:"allTimeZones.EST5EDT",defaultMessage:"EST5EDT"}),Egypt:e.formatMessage({id:"allTimeZones.Egypt",defaultMessage:"Egypt"}),Eire:e.formatMessage({id:"allTimeZones.Eire",defaultMessage:"Eire"}),"Etc/GMT":e.formatMessage({id:"allTimeZones.Etc/GMT",defaultMessage:"Etc/GMT"}),"Etc/GMT+0":e.formatMessage({id:"allTimeZones.Etc/GMT+0",defaultMessage:"Etc/GMT+0"}),"Etc/GMT+1":e.formatMessage({id:"allTimeZones.Etc/GMT+1",defaultMessage:"Etc/GMT+1"}),"Etc/GMT+10":e.formatMessage({id:"allTimeZones.Etc/GMT+10",defaultMessage:"Etc/GMT+10"}),"Etc/GMT+11":e.formatMessage({id:"allTimeZones.Etc/GMT+11",defaultMessage:"Etc/GMT+11"}),"Etc/GMT+12":e.formatMessage({id:"allTimeZones.Etc/GMT+12",defaultMessage:"Etc/GMT+12"}),"Etc/GMT+2":e.formatMessage({id:"allTimeZones.Etc/GMT+2",defaultMessage:"Etc/GMT+2"}),"Etc/GMT+3":e.formatMessage({id:"allTimeZones.Etc/GMT+3",defaultMessage:"Etc/GMT+3"}),"Etc/GMT+4":e.formatMessage({id:"allTimeZones.Etc/GMT+4",defaultMessage:"Etc/GMT+4"}),"Etc/GMT+5":e.formatMessage({id:"allTimeZones.Etc/GMT+5",defaultMessage:"Etc/GMT+5"}),"Etc/GMT+6":e.formatMessage({id:"allTimeZones.Etc/GMT+6",defaultMessage:"Etc/GMT+6"}),"Etc/GMT+7":e.formatMessage({id:"allTimeZones.Etc/GMT+7",defaultMessage:"Etc/GMT+7"}),"Etc/GMT+8":e.formatMessage({id:"allTimeZones.Etc/GMT+8",defaultMessage:"Etc/GMT+8"}),"Etc/GMT+9":e.formatMessage({id:"allTimeZones.Etc/GMT+9",defaultMessage:"Etc/GMT+9"}),"Etc/GMT-0":e.formatMessage({id:"allTimeZones.Etc/GMT-0",defaultMessage:"Etc/GMT-0"}),"Etc/GMT-1":e.formatMessage({id:"allTimeZones.Etc/GMT-1",defaultMessage:"Etc/GMT-1"}),"Etc/GMT-10":e.formatMessage({id:"allTimeZones.Etc/GMT-10",defaultMessage:"Etc/GMT-10"}),"Etc/GMT-11":e.formatMessage({id:"allTimeZones.Etc/GMT-11",defaultMessage:"Etc/GMT-11"}),"Etc/GMT-12":e.formatMessage({id:"allTimeZones.Etc/GMT-12",defaultMessage:"Etc/GMT-12"}),"Etc/GMT-13":e.formatMessage({id:"allTimeZones.Etc/GMT-13",defaultMessage:"Etc/GMT-13"}),"Etc/GMT-14":e.formatMessage({id:"allTimeZones.Etc/GMT-14",defaultMessage:"Etc/GMT-14"}),"Etc/GMT-2":e.formatMessage({id:"allTimeZones.Etc/GMT-2",defaultMessage:"Etc/GMT-2"}),"Etc/GMT-3":e.formatMessage({id:"allTimeZones.Etc/GMT-3",defaultMessage:"Etc/GMT-3"}),"Etc/GMT-4":e.formatMessage({id:"allTimeZones.Etc/GMT-4",defaultMessage:"Etc/GMT-4"}),"Etc/GMT-5":e.formatMessage({id:"allTimeZones.Etc/GMT-5",defaultMessage:"Etc/GMT-5"}),"Etc/GMT-6":e.formatMessage({id:"allTimeZones.Etc/GMT-6",defaultMessage:"Etc/GMT-6"}),"Etc/GMT-7":e.formatMessage({id:"allTimeZones.Etc/GMT-7",defaultMessage:"Etc/GMT-7"}),"Etc/GMT-8":e.formatMessage({id:"allTimeZones.Etc/GMT-8",defaultMessage:"Etc/GMT-8"}),"Etc/GMT-9":e.formatMessage({id:"allTimeZones.Etc/GMT-9",defaultMessage:"Etc/GMT-9"}),"Etc/GMT0":e.formatMessage({id:"allTimeZones.Etc/GMT0",defaultMessage:"Etc/GMT0"}),"Etc/Greenwich":e.formatMessage({id:"allTimeZones.Etc/Greenwich",defaultMessage:"Etc/Greenwich"}),"Etc/UCT":e.formatMessage({id:"allTimeZones.Etc/UCT",defaultMessage:"Etc/UCT"}),"Etc/UTC":e.formatMessage({id:"allTimeZones.Etc/UTC",defaultMessage:"Etc/UTC"}),"Etc/Universal":e.formatMessage({id:"allTimeZones.Etc/Universal",defaultMessage:"Etc/Universal"}),"Etc/Zulu":e.formatMessage({id:"allTimeZones.Etc/Zulu",defaultMessage:"Etc/Zulu"}),"Europe/Amsterdam":e.formatMessage({id:"allTimeZones.Europe/Amsterdam",defaultMessage:"Europe/Amsterdam"}),"Europe/Andorra":e.formatMessage({id:"allTimeZones.Europe/Andorra",defaultMessage:"Europe/Andorra"}),"Europe/Astrakhan":e.formatMessage({id:"allTimeZones.Europe/Astrakhan",defaultMessage:"Europe/Astrakhan"}),"Europe/Athens":e.formatMessage({id:"allTimeZones.Europe/Athens",defaultMessage:"Europe/Athens"}),"Europe/Belfast":e.formatMessage({id:"allTimeZones.Europe/Belfast",defaultMessage:"Europe/Belfast"}),"Europe/Belgrade":e.formatMessage({id:"allTimeZones.Europe/Belgrade",defaultMessage:"Europe/Belgrade"}),"Europe/Berlin":e.formatMessage({id:"allTimeZones.Europe/Berlin",defaultMessage:"Europe/Berlin"}),"Europe/Bratislava":e.formatMessage({id:"allTimeZones.Europe/Bratislava",defaultMessage:"Europe/Bratislava"}),"Europe/Brussels":e.formatMessage({id:"allTimeZones.Europe/Brussels",defaultMessage:"Europe/Brussels"}),"Europe/Bucharest":e.formatMessage({id:"allTimeZones.Europe/Bucharest",defaultMessage:"Europe/Bucharest"}),"Europe/Budapest":e.formatMessage({id:"allTimeZones.Europe/Budapest",defaultMessage:"Europe/Budapest"}),"Europe/Busingen":e.formatMessage({id:"allTimeZones.Europe/Busingen",defaultMessage:"Europe/Busingen"}),"Europe/Chisinau":e.formatMessage({id:"allTimeZones.Europe/Chisinau",defaultMessage:"Europe/Chisinau"}),"Europe/Copenhagen":e.formatMessage({id:"allTimeZones.Europe/Copenhagen",defaultMessage:"Europe/Copenhagen"}),"Europe/Dublin":e.formatMessage({id:"allTimeZones.Europe/Dublin",defaultMessage:"Europe/Dublin"}),"Europe/Gibraltar":e.formatMessage({id:"allTimeZones.Europe/Gibraltar",defaultMessage:"Europe/Gibraltar"}),"Europe/Guernsey":e.formatMessage({id:"allTimeZones.Europe/Guernsey",defaultMessage:"Europe/Guernsey"}),"Europe/Helsinki":e.formatMessage({id:"allTimeZones.Europe/Helsinki",defaultMessage:"Europe/Helsinki"}),"Europe/Isle_of_Man":e.formatMessage({id:"allTimeZones.Europe/Isle_of_Man",defaultMessage:"Europe/Isle_of_Man"}),"Europe/Istanbul":e.formatMessage({id:"allTimeZones.Europe/Istanbul",defaultMessage:"Europe/Istanbul"}),"Europe/Jersey":e.formatMessage({id:"allTimeZones.Europe/Jersey",defaultMessage:"Europe/Jersey"}),"Europe/Kaliningrad":e.formatMessage({id:"allTimeZones.Europe/Kaliningrad",defaultMessage:"Europe/Kaliningrad"}),"Europe/Kiev":e.formatMessage({id:"allTimeZones.Europe/Kyiv",defaultMessage:"Europe/Kyiv"}),"Europe/Kirov":e.formatMessage({id:"allTimeZones.Europe/Kirov",defaultMessage:"Europe/Kirov"}),"Europe/Lisbon":e.formatMessage({id:"allTimeZones.Europe/Lisbon",defaultMessage:"Europe/Lisbon"}),"Europe/Ljubljana":e.formatMessage({id:"allTimeZones.Europe/Ljubljana",defaultMessage:"Europe/Ljubljana"}),"Europe/London":e.formatMessage({id:"allTimeZones.Europe/London",defaultMessage:"Europe/London"}),"Europe/Luxembourg":e.formatMessage({id:"allTimeZones.Europe/Luxembourg",defaultMessage:"Europe/Luxembourg"}),"Europe/Madrid":e.formatMessage({id:"allTimeZones.Europe/Madrid",defaultMessage:"Europe/Madrid"}),"Europe/Malta":e.formatMessage({id:"allTimeZones.Europe/Malta",defaultMessage:"Europe/Malta"}),"Europe/Mariehamn":e.formatMessage({id:"allTimeZones.Europe/Mariehamn",defaultMessage:"Europe/Mariehamn"}),"Europe/Minsk":e.formatMessage({id:"allTimeZones.Europe/Minsk",defaultMessage:"Europe/Minsk"}),"Europe/Monaco":e.formatMessage({id:"allTimeZones.Europe/Monaco",defaultMessage:"Europe/Monaco"}),"Europe/Moscow":e.formatMessage({id:"allTimeZones.Europe/Moscow",defaultMessage:"Europe/Moscow"}),"Europe/Nicosia":e.formatMessage({id:"allTimeZones.Europe/Nicosia",defaultMessage:"Europe/Nicosia"}),"Europe/Oslo":e.formatMessage({id:"allTimeZones.Europe/Oslo",defaultMessage:"Europe/Oslo"}),"Europe/Paris":e.formatMessage({id:"allTimeZones.Europe/Paris",defaultMessage:"Europe/Paris"}),"Europe/Podgorica":e.formatMessage({id:"allTimeZones.Europe/Podgorica",defaultMessage:"Europe/Podgorica"}),"Europe/Prague":e.formatMessage({id:"allTimeZones.Europe/Prague",defaultMessage:"Europe/Prague"}),"Europe/Riga":e.formatMessage({id:"allTimeZones.Europe/Riga",defaultMessage:"Europe/Riga"}),"Europe/Rome":e.formatMessage({id:"allTimeZones.Europe/Rome",defaultMessage:"Europe/Rome"}),"Europe/Samara":e.formatMessage({id:"allTimeZones.Europe/Samara",defaultMessage:"Europe/Samara"}),"Europe/San_Marino":e.formatMessage({id:"allTimeZones.Europe/San_Marino",defaultMessage:"Europe/San_Marino"}),"Europe/Sarajevo":e.formatMessage({id:"allTimeZones.Europe/Sarajevo",defaultMessage:"Europe/Sarajevo"}),"Europe/Saratov":e.formatMessage({id:"allTimeZones.Europe/Saratov",defaultMessage:"Europe/Saratov"}),"Europe/Simferopol":e.formatMessage({id:"allTimeZones.Europe/Simferopol",defaultMessage:"Europe/Simferopol"}),"Europe/Skopje":e.formatMessage({id:"allTimeZones.Europe/Skopje",defaultMessage:"Europe/Skopje"}),"Europe/Sofia":e.formatMessage({id:"allTimeZones.Europe/Sofia",defaultMessage:"Europe/Sofia"}),"Europe/Stockholm":e.formatMessage({id:"allTimeZones.Europe/Stockholm",defaultMessage:"Europe/Stockholm"}),"Europe/Tallinn":e.formatMessage({id:"allTimeZones.Europe/Tallinn",defaultMessage:"Europe/Tallinn"}),"Europe/Tirane":e.formatMessage({id:"allTimeZones.Europe/Tirane",defaultMessage:"Europe/Tirane"}),"Europe/Tiraspol":e.formatMessage({id:"allTimeZones.Europe/Tiraspol",defaultMessage:"Europe/Tiraspol"}),"Europe/Ulyanovsk":e.formatMessage({id:"allTimeZones.Europe/Ulyanovsk",defaultMessage:"Europe/Ulyanovsk"}),"Europe/Uzhgorod":e.formatMessage({id:"allTimeZones.Europe/Uzhgorod",defaultMessage:"Europe/Uzhgorod"}),"Europe/Vaduz":e.formatMessage({id:"allTimeZones.Europe/Vaduz",defaultMessage:"Europe/Vaduz"}),"Europe/Vatican":e.formatMessage({id:"allTimeZones.Europe/Vatican",defaultMessage:"Europe/Vatican"}),"Europe/Vienna":e.formatMessage({id:"allTimeZones.Europe/Vienna",defaultMessage:"Europe/Vienna"}),"Europe/Vilnius":e.formatMessage({id:"allTimeZones.Europe/Vilnius",defaultMessage:"Europe/Vilnius"}),"Europe/Volgograd":e.formatMessage({id:"allTimeZones.Europe/Volgograd",defaultMessage:"Europe/Volgograd"}),"Europe/Warsaw":e.formatMessage({id:"allTimeZones.Europe/Warsaw",defaultMessage:"Europe/Warsaw"}),"Europe/Zagreb":e.formatMessage({id:"allTimeZones.Europe/Zagreb",defaultMessage:"Europe/Zagreb"}),"Europe/Zaporozhye":e.formatMessage({id:"allTimeZones.Europe/Zaporozhye",defaultMessage:"Europe/Zaporozhye"}),"Europe/Zurich":e.formatMessage({id:"allTimeZones.Europe/Zurich",defaultMessage:"Europe/Zurich"}),GB:e.formatMessage({id:"allTimeZones.GB",defaultMessage:"GB"}),"GB-Eire":e.formatMessage({id:"allTimeZones.GB-Eire",defaultMessage:"GB-Eire"}),GMT:e.formatMessage({id:"allTimeZones.GMT",defaultMessage:"GMT"}),"GMT+0":e.formatMessage({id:"allTimeZones.GMT+0",defaultMessage:"GMT+0"}),"GMT-0":e.formatMessage({id:"allTimeZones.GMT-0",defaultMessage:"GMT-0"}),GMT0:e.formatMessage({id:"allTimeZones.GMT0",defaultMessage:"GMT0"}),Greenwich:e.formatMessage({id:"allTimeZones.Greenwich",defaultMessage:"Greenwich"}),HST:e.formatMessage({id:"allTimeZones.HST",defaultMessage:"HST"}),Hongkong:e.formatMessage({id:"allTimeZones.Hongkong",defaultMessage:"Hongkong"}),Iceland:e.formatMessage({id:"allTimeZones.Iceland",defaultMessage:"Iceland"}),"Indian/Antananarivo":e.formatMessage({id:"allTimeZones.Indian/Antananarivo",defaultMessage:"Indian/Antananarivo"}),"Indian/Chagos":e.formatMessage({id:"allTimeZones.Indian/Chagos",defaultMessage:"Indian/Chagos"}),"Indian/Christmas":e.formatMessage({id:"allTimeZones.Indian/Christmas",defaultMessage:"Indian/Christmas"}),"Indian/Cocos":e.formatMessage({id:"allTimeZones.Indian/Cocos",defaultMessage:"Indian/Cocos"}),"Indian/Comoro":e.formatMessage({id:"allTimeZones.Indian/Comoro",defaultMessage:"Indian/Comoro"}),"Indian/Kerguelen":e.formatMessage({id:"allTimeZones.Indian/Kerguelen",defaultMessage:"Indian/Kerguelen"}),"Indian/Mahe":e.formatMessage({id:"allTimeZones.Indian/Mahe",defaultMessage:"Indian/Mahe"}),"Indian/Maldives":e.formatMessage({id:"allTimeZones.Indian/Maldives",defaultMessage:"Indian/Maldives"}),"Indian/Mauritius":e.formatMessage({id:"allTimeZones.Indian/Mauritius",defaultMessage:"Indian/Mauritius"}),"Indian/Mayotte":e.formatMessage({id:"allTimeZones.Indian/Mayotte",defaultMessage:"Indian/Mayotte"}),"Indian/Reunion":e.formatMessage({id:"allTimeZones.Indian/Reunion",defaultMessage:"Indian/Reunion"}),Iran:e.formatMessage({id:"allTimeZones.Iran",defaultMessage:"Iran"}),Israel:e.formatMessage({id:"allTimeZones.Israel",defaultMessage:"Israel"}),Jamaica:e.formatMessage({id:"allTimeZones.Jamaica",defaultMessage:"Jamaica"}),Japan:e.formatMessage({id:"allTimeZones.Japan",defaultMessage:"Japan"}),Kwajalein:e.formatMessage({id:"allTimeZones.Kwajalein",defaultMessage:"Kwajalein"}),Libya:e.formatMessage({id:"allTimeZones.Libya",defaultMessage:"Libya"}),MET:e.formatMessage({id:"allTimeZones.MET",defaultMessage:"MET"}),MST:e.formatMessage({id:"allTimeZones.MST",defaultMessage:"MST"}),MST7MDT:e.formatMessage({id:"allTimeZones.MST7MDT",defaultMessage:"MST7MDT"}),"Mexico/BajaNorte":e.formatMessage({id:"allTimeZones.Mexico/BajaNorte",defaultMessage:"Mexico/BajaNorte"}),"Mexico/BajaSur":e.formatMessage({id:"allTimeZones.Mexico/BajaSur",defaultMessage:"Mexico/BajaSur"}),"Mexico/General":e.formatMessage({id:"allTimeZones.Mexico/General",defaultMessage:"Mexico/General"}),NZ:e.formatMessage({id:"allTimeZones.NZ",defaultMessage:"NZ"}),"NZ-CHAT":e.formatMessage({id:"allTimeZones.NZ-CHAT",defaultMessage:"NZ-CHAT"}),Navajo:e.formatMessage({id:"allTimeZones.Navajo",defaultMessage:"Navajo"}),PRC:e.formatMessage({id:"allTimeZones.PRC",defaultMessage:"PRC"}),PST8PDT:e.formatMessage({id:"allTimeZones.PST8PDT",defaultMessage:"PST8PDT"}),"Pacific/Apia":e.formatMessage({id:"allTimeZones.Pacific/Apia",defaultMessage:"Pacific/Apia"}),"Pacific/Auckland":e.formatMessage({id:"allTimeZones.Pacific/Auckland",defaultMessage:"Pacific/Auckland"}),"Pacific/Bougainville":e.formatMessage({id:"allTimeZones.Pacific/Bougainville",defaultMessage:"Pacific/Bougainville"}),"Pacific/Chatham":e.formatMessage({id:"allTimeZones.Pacific/Chatham",defaultMessage:"Pacific/Chatham"}),"Pacific/Chuuk":e.formatMessage({id:"allTimeZones.Pacific/Chuuk",defaultMessage:"Pacific/Chuuk"}),"Pacific/Easter":e.formatMessage({id:"allTimeZones.Pacific/Easter",defaultMessage:"Pacific/Easter"}),"Pacific/Efate":e.formatMessage({id:"allTimeZones.Pacific/Efate",defaultMessage:"Pacific/Efate"}),"Pacific/Enderbury":e.formatMessage({id:"allTimeZones.Pacific/Enderbury",defaultMessage:"Pacific/Enderbury"}),"Pacific/Fakaofo":e.formatMessage({id:"allTimeZones.Pacific/Fakaofo",defaultMessage:"Pacific/Fakaofo"}),"Pacific/Fiji":e.formatMessage({id:"allTimeZones.Pacific/Fiji",defaultMessage:"Pacific/Fiji"}),"Pacific/Funafuti":e.formatMessage({id:"allTimeZones.Pacific/Funafuti",defaultMessage:"Pacific/Funafuti"}),"Pacific/Galapagos":e.formatMessage({id:"allTimeZones.Pacific/Galapagos",defaultMessage:"Pacific/Galapagos"}),"Pacific/Gambier":e.formatMessage({id:"allTimeZones.Pacific/Gambier",defaultMessage:"Pacific/Gambier"}),"Pacific/Guadalcanal":e.formatMessage({id:"allTimeZones.Pacific/Guadalcanal",defaultMessage:"Pacific/Guadalcanal"}),"Pacific/Guam":e.formatMessage({id:"allTimeZones.Pacific/Guam",defaultMessage:"Pacific/Guam"}),"Pacific/Honolulu":e.formatMessage({id:"allTimeZones.Pacific/Honolulu",defaultMessage:"Pacific/Honolulu"}),"Pacific/Johnston":e.formatMessage({id:"allTimeZones.Pacific/Johnston",defaultMessage:"Pacific/Johnston"}),"Pacific/Kiritimati":e.formatMessage({id:"allTimeZones.Pacific/Kiritimati",defaultMessage:"Pacific/Kiritimati"}),"Pacific/Kosrae":e.formatMessage({id:"allTimeZones.Pacific/Kosrae",defaultMessage:"Pacific/Kosrae"}),"Pacific/Kwajalein":e.formatMessage({id:"allTimeZones.Pacific/Kwajalein",defaultMessage:"Pacific/Kwajalein"}),"Pacific/Majuro":e.formatMessage({id:"allTimeZones.Pacific/Majuro",defaultMessage:"Pacific/Majuro"}),"Pacific/Marquesas":e.formatMessage({id:"allTimeZones.Pacific/Marquesas",defaultMessage:"Pacific/Marquesas"}),"Pacific/Midway":e.formatMessage({id:"allTimeZones.Pacific/Midway",defaultMessage:"Pacific/Midway"}),"Pacific/Nauru":e.formatMessage({id:"allTimeZones.Pacific/Nauru",defaultMessage:"Pacific/Nauru"}),"Pacific/Niue":e.formatMessage({id:"allTimeZones.Pacific/Niue",defaultMessage:"Pacific/Niue"}),"Pacific/Norfolk":e.formatMessage({id:"allTimeZones.Pacific/Norfolk",defaultMessage:"Pacific/Norfolk"}),"Pacific/Noumea":e.formatMessage({id:"allTimeZones.Pacific/Noumea",defaultMessage:"Pacific/Noumea"}),"Pacific/Pago_Pago":e.formatMessage({id:"allTimeZones.Pacific/Pago_Pago",defaultMessage:"Pacific/Pago_Pago"}),"Pacific/Palau":e.formatMessage({id:"allTimeZones.Pacific/Palau",defaultMessage:"Pacific/Palau"}),"Pacific/Pitcairn":e.formatMessage({id:"allTimeZones.Pacific/Pitcairn",defaultMessage:"Pacific/Pitcairn"}),"Pacific/Pohnpei":e.formatMessage({id:"allTimeZones.Pacific/Pohnpei",defaultMessage:"Pacific/Pohnpei"}),"Pacific/Ponape":e.formatMessage({id:"allTimeZones.Pacific/Ponape",defaultMessage:"Pacific/Ponape"}),"Pacific/Port_Moresby":e.formatMessage({id:"allTimeZones.Pacific/Port_Moresby",defaultMessage:"Pacific/Port_Moresby"}),"Pacific/Rarotonga":e.formatMessage({id:"allTimeZones.Pacific/Rarotonga",defaultMessage:"Pacific/Rarotonga"}),"Pacific/Saipan":e.formatMessage({id:"allTimeZones.Pacific/Saipan",defaultMessage:"Pacific/Saipan"}),"Pacific/Samoa":e.formatMessage({id:"allTimeZones.Pacific/Samoa",defaultMessage:"Pacific/Samoa"}),"Pacific/Tahiti":e.formatMessage({id:"allTimeZones.Pacific/Tahiti",defaultMessage:"Pacific/Tahiti"}),"Pacific/Tarawa":e.formatMessage({id:"allTimeZones.Pacific/Tarawa",defaultMessage:"Pacific/Tarawa"}),"Pacific/Tongatapu":e.formatMessage({id:"allTimeZones.Pacific/Tongatapu",defaultMessage:"Pacific/Tongatapu"}),"Pacific/Truk":e.formatMessage({id:"allTimeZones.Pacific/Truk",defaultMessage:"Pacific/Truk"}),"Pacific/Wake":e.formatMessage({id:"allTimeZones.Pacific/Wake",defaultMessage:"Pacific/Wake"}),"Pacific/Wallis":e.formatMessage({id:"allTimeZones.Pacific/Wallis",defaultMessage:"Pacific/Wallis"}),"Pacific/Yap":e.formatMessage({id:"allTimeZones.Pacific/Yap",defaultMessage:"Pacific/Yap"}),Poland:e.formatMessage({id:"allTimeZones.Poland",defaultMessage:"Poland"}),Portugal:e.formatMessage({id:"allTimeZones.Portugal",defaultMessage:"Portugal"}),ROC:e.formatMessage({id:"allTimeZones.ROC",defaultMessage:"ROC"}),ROK:e.formatMessage({id:"allTimeZones.ROK",defaultMessage:"ROK"}),Singapore:e.formatMessage({id:"allTimeZones.Singapore",defaultMessage:"Singapore"}),Turkey:e.formatMessage({id:"allTimeZones.Turkey",defaultMessage:"Turkey"}),UCT:e.formatMessage({id:"allTimeZones.UCT",defaultMessage:"UCT"}),"US/Alaska":e.formatMessage({id:"allTimeZones.US/Alaska",defaultMessage:"US/Alaska"}),"US/Aleutian":e.formatMessage({id:"allTimeZones.US/Aleutian",defaultMessage:"US/Aleutian"}),"US/Arizona":e.formatMessage({id:"allTimeZones.US/Arizona",defaultMessage:"US/Arizona"}),"US/Central":e.formatMessage({id:"allTimeZones.US/Central",defaultMessage:"US/Central"}),"US/East-Indiana":e.formatMessage({id:"allTimeZones.US/East-Indiana",defaultMessage:"US/East-Indiana"}),"US/Eastern":e.formatMessage({id:"allTimeZones.US/Eastern",defaultMessage:"US/Eastern"}),"US/Hawaii":e.formatMessage({id:"allTimeZones.US/Hawaii",defaultMessage:"US/Hawaii"}),"US/Indiana-Starke":e.formatMessage({id:"allTimeZones.US/Indiana-Starke",defaultMessage:"US/Indiana-Starke"}),"US/Michigan":e.formatMessage({id:"allTimeZones.US/Michigan",defaultMessage:"US/Michigan"}),"US/Mountain":e.formatMessage({id:"allTimeZones.US/Mountain",defaultMessage:"US/Mountain"}),"US/Pacific":e.formatMessage({id:"allTimeZones.US/Pacific",defaultMessage:"US/Pacific"}),"US/Pacific-New":e.formatMessage({id:"allTimeZones.US/Pacific-New",defaultMessage:"US/Pacific-New"}),"US/Samoa":e.formatMessage({id:"allTimeZones.US/Samoa",defaultMessage:"US/Samoa"}),UTC:e.formatMessage({id:"allTimeZones.UTC",defaultMessage:"UTC"}),Universal:e.formatMessage({id:"allTimeZones.Universal",defaultMessage:"Universal"}),"W-SU":e.formatMessage({id:"allTimeZones.W-SU",defaultMessage:"W-SU"}),WET:e.formatMessage({id:"allTimeZones.WET",defaultMessage:"WET"}),Zulu:e.formatMessage({id:"allTimeZones.Zulu",defaultMessage:"Zulu"})})));var C=i(64875),Z=i(2911);function w(e,t){const i=b.default.tz(t),s=T(e)[t];return s?"GMT".concat(i.format("Z")," - ").concat(s," (").concat(i.format("z"),")"):(C.log({level:"error",from:"timeZoneHelpers",type:"localizedName",error:(0,Z.Ui)("Missing ".concat(t," from timeZoneToLocalizedTimeZone"))}),"GMT".concat(i.format("Z")))}var k=i(76150),A=i(46167),P=i(62727),I=i(37235),x=i(63143),F=i(31942),B=i(56109),E=i(48762),R=i(83071),D=i(12318),_=i(71202),L=i(73581),O=i(25584),U=i(16328),N=i(3779),V=i(51454),W=i(1464),z=i(85114),H=i(57269),q=i(41101),G=i(50906),K=i(8848),j=i(80527),Y=i(83182),Q=i(46247),J=i(46951),X=i(5366),$=i(15282),ee=i(33665),te=i(11843),ie=i(74350),se=i(33800);class ae extends p.Z{constructor(...e){super(...e),l()(this,"storeTypes",{store:k.ZP,timezoneQuery:D.Z.of("")}),l()(this,"renderNavbarElement",(({onPreviousClick:e,onNextClick:t})=>{const{device:i}=this.environment;return n()("div",{style:i.isMobile?ae.mobileNavStyle:ae.desktopNavStyle},void 0,n()(j.Z,{mobileFeedback:i.isMobile,icon:N.Z.chevronLeft,onClick:()=>e()}),n()(j.Z,{mobileFeedback:i.isMobile,icon:N.Z.chevronRight,onClick:()=>t()}))})),l()(this,"handleDateFormatChange",(e=>{this.props.onChangeDateFormat(e)})),l()(this,"handleTimeFormatChange",(e=>{const t=this.getTimeFormatOptions()[e];this.props.onChangeTimeFormat(t)})),l()(this,"handleChangeReminder",(e=>{const t=this.getDateValue();e?g.vJ(e)?this.props.onChangeValue({...t,reminder:e}):"datetime"!==t.type&&"datetimerange"!==t.type||this.props.onChangeValue({...t,reminder:e}):this.props.onChangeValue({...t,reminder:e}),G.IMD(this.environment,{date:t,reminder:e})})),l()(this,"handleInputChange",(e=>{const{device:t}=this.environment,{store:i}=this.stores;i.setState({...i.state,inputTemporaryValue:{...i.state.inputTemporaryValue,[i.state.focus]:e.target.value||""}}),t.isAndroid&&this.handleInputBlur()})),l()(this,"handleStartDateInputChange",(()=>{const{inputTemporaryValue:e}=this.stores.store.state,t=e.startDate;if(!t)return;const i=this.parseInputDateValue(t);if(!i)return k.pd.InvalidDate;const s=this.getDateValue();if(g.h(s)||g.qg(s)){const{newDate:e,currentMonth:t}=g.KZ({previous:s,updatedStartDate:i});this.applyValidDateState({newDate:e,currentMonth:t,resetField:k.Hv.StartDate})}else{const e={...s,start_date:i},t=g.pI(e);this.applyValidDateState({newDate:e,currentMonth:t.start,resetField:k.Hv.StartDate})}})),l()(this,"handleStartTimeInputChange",(()=>{const{inputTemporaryValue:e}=this.stores.store.state,t=e.startTime;if(!t)return;const i=this.parseInputTimeValue(t);if(!i)return k.pd.InvalidTime;const s=this.getDateValue();if(g.qg(s)){const{newDate:e,currentMonth:t}=g.vz({previous:s,updatedStartTime:i});this.applyValidDateState({newDate:e,currentMonth:t,resetField:k.Hv.StartTime}),this.resetInputState(k.Hv.EndDate),this.resetInputState(k.Hv.EndTime)}else{const e={...s,start_time:i},t=g.pI(e);this.applyValidDateState({newDate:e,currentMonth:t.start,resetField:k.Hv.StartTime})}})),l()(this,"handleEndDateInputChange",(()=>{const{inputTemporaryValue:e}=this.stores.store.state,t=e.endDate;if(!t)return;const i=this.parseInputDateValue(t);if(!i)return k.pd.InvalidDate;const s={...this.getDateValue(),end_date:i},a=g.pI(s);if(!a)return k.pd.InvalidRange;this.applyValidDateState({newDate:s,currentMonth:a.end,resetField:k.Hv.EndDate})})),l()(this,"handleEndTimeInputChange",(()=>{const{inputTemporaryValue:e}=this.stores.store.state,t=e.endTime;if(!t)return;const i=this.parseInputTimeValue(t);if(!i)return k.pd.InvalidTime;const s={...this.getDateValue(),end_time:i},a=g.pI(s);if(!a)return k.pd.InvalidRange;this.applyValidDateState({newDate:s,currentMonth:a.end,resetField:k.Hv.EndTime})})),l()(this,"handleInputBlur",(e=>{const{focus:t}=this.stores.store.state;let i;t===k.Hv.StartDate?i=this.handleStartDateInputChange():t===k.Hv.StartTime?i=this.handleStartTimeInputChange():t===k.Hv.EndDate?i=this.handleEndDateInputChange():t===k.Hv.EndTime&&(i=this.handleEndTimeInputChange()),i?this.stores.store.setState({...this.stores.store.state,error:{...this.stores.store.state.error,[t]:i}}):this.stores.store.setState({...this.stores.store.state,inputTemporaryValue:{startDate:void 0,startTime:void 0,endDate:void 0,endTime:void 0},inputIsFocused:!1,error:{startDate:void 0,startTime:void 0,endDate:void 0,endTime:void 0}})})),l()(this,"handleInputSubmit",(()=>{const{focus:e}=this.stores.store.state;let t;e===k.Hv.StartDate?t=this.handleStartDateInputChange():e===k.Hv.StartTime?t=this.handleStartTimeInputChange():e===k.Hv.EndDate?t=this.handleEndDateInputChange():e===k.Hv.EndTime&&(t=this.handleEndTimeInputChange()),t?this.stores.store.setState({...this.stores.store.state,error:{...this.stores.store.state.error,[e]:t}}):this.stores.store.setState({...this.stores.store.state,inputTemporaryValue:{startDate:void 0,startTime:void 0,endDate:void 0,endTime:void 0},error:{startDate:void 0,startTime:void 0,endDate:void 0,endTime:void 0}})})),l()(this,"handleDayPickerDayClick",(e=>{if(this.props.disabled)return;const t=m().cloneDeep(this.getDateValue()),{focus:i}=this.stores.store.state,s=(0,v.Z)(e).locale(g.ah).format(g.Q1);if("daterange"===t.type||"datetimerange"===t.type){const e=i===k.Hv.StartDate||i===k.Hv.StartTime?k.Hv.EndDate:k.Hv.StartDate;if(s===t[e===k.Hv.StartDate?"start_date":"end_date"])return void this.stores.store.setState({...this.stores.store.state,focus:e});i===k.Hv.StartDate||i===k.Hv.StartTime?t.start_date=s:i!==k.Hv.EndDate&&i!==k.Hv.EndTime||(t.end_date=s);const a=g.iS(t,g.x7);if(a.end&&a.end.isBefore(a.start)){if("datetimerange"===t.type){const{start_date:e,start_time:i,end_date:s,end_time:a}=t;t.start_date=s,t.start_time=a,t.end_date=e,t.end_time=i}else{const{start_date:e,end_date:i}=t;t.start_date=i,t.end_date=e}this.stores.store.setState({...this.stores.store.state,focus:i===k.Hv.StartDate||i===k.Hv.StartTime?k.Hv.EndDate:k.Hv.StartDate})}this.props.onChangeValue(t),this.resetInputState(i)}else t.start_date=s,this.props.onChangeValue(t),this.resetInputState(i)})),l()(this,"handleDayPickerMonthChange",(e=>{this.stores.store.setState({...this.stores.store.state,currentMonth:(0,v.Z)(e)})})),l()(this,"handleEndDateControlChange",(()=>{const e=this.getDateValue();if("datetimerange"===e.type){const t={type:"datetime",start_date:e.start_date,start_time:e.start_time,time_zone:e.time_zone,reminder:e.reminder};this.props.onChangeValue(t)}else if("daterange"===e.type){const t={type:"date",start_date:e.start_date,reminder:e.reminder};this.props.onChangeValue(t)}else if("datetime"===e.type){const t={type:"datetimerange",start_date:e.start_date,start_time:e.start_time,end_date:e.start_date,end_time:e.start_time,time_zone:e.time_zone,reminder:e.reminder};this.props.onChangeValue(t),this.stores.store.setState({...this.stores.store.state,focus:k.Hv.EndDate})}else{const t={type:"daterange",start_date:e.start_date,end_date:e.start_date,reminder:e.reminder};this.props.onChangeValue(t),this.stores.store.setState({...this.stores.store.state,focus:k.Hv.EndDate})}})),l()(this,"handleAllDayChange",(()=>{const e=this.getDateValue();if("date"===e.type){const t={type:"datetime",start_date:e.start_date,start_time:"00:00",time_zone:g.x7,reminder:e.reminder&&g.AE(e.reminder)};this.props.onChangeValue(t)}else if("daterange"===e.type){const t={type:"datetimerange",start_date:e.start_date,start_time:"00:00",end_date:e.end_date,end_time:"00:00",time_zone:g.x7,reminder:e.reminder&&g.AE(e.reminder)};this.props.onChangeValue(t)}else if("datetime"===e.type){const t={type:"date",start_date:e.start_date,reminder:e.reminder&&g.wg(e.reminder)};this.props.onChangeValue(t)}else{const t={type:"daterange",start_date:e.start_date,end_date:e.end_date,reminder:e.reminder&&g.wg(e.reminder)};this.props.onChangeValue(t)}})),l()(this,"handleTimeZoneChange",(e=>{const t=S.W3.find((t=>t.name===e));if(!t)return;const i=t.name,s=this.getDateValue();if("datetime"===s.type||"datetimerange"===s.type){const e={...s,time_zone:i};this.props.onChangeValue(e)}})),l()(this,"handleStartInputDateFocus",(()=>{const e=this.getDateValue(),t=g.iS(e,g.x7);this.stores.store.setState({...this.stores.store.state,focus:k.Hv.StartDate,inputIsFocused:!0,currentMonth:t.start})})),l()(this,"handleStartInputTimeFocus",(()=>{const e=this.getDateValue(),t=g.iS(e,g.x7);this.stores.store.setState({...this.stores.store.state,focus:k.Hv.StartTime,inputIsFocused:!0,currentMonth:t.start})})),l()(this,"handleEndInputDateFocus",(()=>{const e=this.getDateValue(),t=g.iS(e,g.x7);t.end&&this.stores.store.setState({...this.stores.store.state,focus:k.Hv.EndDate,inputIsFocused:!0,currentMonth:t.end})})),l()(this,"handleEndInputTimeFocus",(()=>{const e=this.getDateValue(),t=g.iS(e,g.x7);t.end&&this.stores.store.setState({...this.stores.store.state,focus:k.Hv.EndTime,inputIsFocused:!0,currentMonth:t.end})})),l()(this,"handleClearClick",(()=>{this.props.onChangeValue(void 0)})),l()(this,"getTimeFormatOptions",(()=>(0,te.E)(ie.SP).time)),l()(this,"getSelectedTimeFormatType",(()=>{const e=this.getTimeFormat(),t=this.getTimeFormatOptions();for(const i in t)if(t[i]===e)return i;return"12h"})),l()(this,"getTimeZoneItemsSync",(e=>(0,F.ZP)(e,S.W3,(e=>m().compact([e.name,w(this.props.intl,e.name)]).join(" "))).map(((e,t)=>({key:e.name,render:t=>c().createElement(E.Z,a()({},t,{title:w(this.props.intl,e.name)})),action:()=>{this.handleTimeZoneChange(e.name)}}))))),l()(this,"tooltipOriginGap",12)}willMount(e){super.willMount(e),this.openTimeFormat=g.Lg(g.x7)}renderComponent(){const{device:e,WindowSizeStore:t}=this.environment,{disabled:i,canConfigureCollection:s,shouldShowReminder:a}=this.props,{inputIsFocused:o}=this.stores.store.state,r=this.getDateValue(),l="datetime"===r.type||"datetimerange"===r.type,d="daterange"===r.type||"datetimerange"===r.type,u=n()("div",{style:{paddingTop:e.isMobile?16:8,paddingBottom:e.isMobile?16:8,paddingLeft:e.isMobile?t.getSafePaddingLeftCSS(16):14,paddingRight:e.isMobile?t.getSafePaddingRightCSS(16):14,display:l?"block":"flex",...e.isMobile&&{boxShadow:"\n\t\t\t\t\t\t\t0 1px 0 ".concat(this.theme.regularDividerColor,"\n\t\t\t\t\t\t"),position:"relative",zIndex:2},background:e.isMobile?this.theme.popoverBackground:void 0}},void 0,this.renderStartInput(),d&&n()("div",{style:{width:12,height:8}}),this.renderEndInput(),this.renderTimeZone());let m;return m=e.isMobile?{menuType:_.ZP.MenuType.Modal,title:n()(X.FormattedMessage,{defaultMessage:"Date",id:"datePropertyMenu.mobileDate.title"}),right:n()(X.FormattedMessage,{defaultMessage:"Done",id:"datePropertyMenu.mobileDoneButton.label"}),left:a?this.renderRemindersHelp():void 0,onClickRight:this.props.onDismiss,header:u}:{menuType:_.ZP.MenuType.Popup,maxHeight:"none",width:270},n()(B.Z,{capture:o,allowEsc:!0,allowTabUntab:!1},void 0,n()(B.Z,{capture:!0,allowUndo:!0,allowEsc:!0,allowTabUntab:!1},void 0,c().createElement(_.ZP,m,n()(q.Z,{show:o}),n()(R.Z,{},void 0,!e.isMobile&&u,n()("div",{style:{padding:e.isMobile?"16px 14px 16px":"4px 0 4px",textAlign:"center",...e.isMobile&&{borderBottom:"1px solid ".concat(this.theme.regularDividerColor),background:this.theme.popoverBackground}}},void 0,this.renderCalendar())),!i&&this.renderControls(),!i&&s&&n()(R.Z,{topBorder:!0},void 0,this.renderFormatPopup()),!i&&n()(R.Z,{topBorder:!0},void 0,this.renderClearButton()),!i&&!e.isMobile&&a&&n()(R.Z,{topBorder:!0},void 0,this.renderRemindersHelp()))))}renderStartInput(){const{device:e}=this.environment,{disabled:t}=this.props,{focus:i,inputTemporaryValue:s,error:a}=this.stores.store.state,o=this.getDateValue(),r=g.iS(o,g.x7),l=Boolean(a.startDate||a.startTime),d="datetime"===o.type||"datetimerange"===o.type,c="daterange"===o.type||"datetimerange"===o.type,u=i===k.Hv.StartDate||i===k.Hv.StartTime,m=(0,x.z4)(s.startDate)?r.start.locale(!1).format(this.getDateDisplayFormat()):s.startDate,p=(0,x.z4)(s.startTime)?r.start.locale(!1).format(this.getTimeFormat()):s.startTime,h=(0,x.z4)(s.startDate)?r.start.format(g.Q1):s.startDate,f=(0,x.z4)(s.startTime)?r.start.format(g.jK):s.startTime;return n()("div",{style:{...l?this.getInputWrapErrorStyle():u&&c?this.getInputWrapActiveStyle():this.getInputWrapInactiveStyle(),fontSize:e.isMobile?16:14}},void 0,n()(I.Z,{renderTooltip:()=>this.getInputErrorMessage(a.startDate),originGap:this.tooltipOriginGap,forceVisibleState:Boolean(a.startDate),placement:I.Z.Placement.Left,render:()=>e.isMobile?n()(P.Z,{type:"date",format:P.B.Transparent,value:h,onChange:this.handleInputChange,onFocus:this.handleStartInputDateFocus,onBlur:this.handleInputBlur,onSubmit:this.handleInputSubmit,disabled:t,size:1}):n()(P.Z,{format:P.B.Transparent,value:m,focusInitial:i===k.Hv.StartDate,onChange:this.handleInputChange,onFocus:this.handleStartInputDateFocus,onBlur:this.handleInputBlur,onSubmit:this.handleInputSubmit,disabled:t,size:1})}),d&&this.getInputSeparator(),d&&n()(I.Z,{renderTooltip:()=>this.getInputErrorMessage(a.startTime),originGap:this.tooltipOriginGap,forceVisibleState:Boolean(a.startTime),placement:I.Z.Placement.Right,render:()=>e.isMobile?n()(P.Z,{type:"time",format:P.B.Transparent,value:f,onChange:this.handleInputChange,onFocus:this.handleStartInputTimeFocus,onBlur:this.handleInputBlur,onSubmit:this.handleInputSubmit,size:1,disabled:t}):n()(P.Z,{format:P.B.Transparent,value:p,focusInitial:i===k.Hv.StartTime,onChange:this.handleInputChange,onFocus:this.handleStartInputTimeFocus,onBlur:this.handleInputBlur,onSubmit:this.handleInputSubmit,size:1,disabled:t})}))}renderEndInput(){const{device:e}=this.environment,{disabled:t}=this.props,i=this.getDateValue(),s=g.iS(i,g.x7),a="datetime"===i.type||"datetimerange"===i.type;if(s.end){const{focus:i,error:o,inputTemporaryValue:r}=this.stores.store.state,l=Boolean(o.endDate||o.endTime),d=i===k.Hv.EndDate||i===k.Hv.EndTime,c=(0,x.z4)(r.endDate)?s.end.locale(!1).format(this.getDateDisplayFormat()):r.endDate,u=(0,x.z4)(r.endTime)?s.end.locale(!1).format(this.getTimeFormat()):r.endTime,m=(0,x.z4)(r.endDate)?s.end.format(g.Q1):r.endDate,p=(0,x.z4)(r.endTime)?s.end.format(g.jK):r.endTime,h=this.getDateRangeBounds(),f=h&&h.earliestValidEnd;return n()("div",{style:{...l?this.getInputWrapErrorStyle():d?this.getInputWrapActiveStyle():this.getInputWrapInactiveStyle(),fontSize:e.isMobile?16:14}},void 0,n()(I.Z,{renderTooltip:()=>this.getInputErrorMessage(o.endDate),originGap:this.tooltipOriginGap,forceVisibleState:Boolean(o.endDate),placement:I.Z.Placement.Left,render:()=>e.isMobile?n()(P.Z,{type:"date",format:P.B.Transparent,value:m,onChange:this.handleInputChange,onFocus:this.handleEndInputDateFocus,onBlur:this.handleInputBlur,onSubmit:this.handleInputSubmit,size:1,disabled:t,inputElementAttributes:{min:f}}):n()(P.Z,{format:P.B.Transparent,value:c,focusInitial:i===k.Hv.EndDate,onChange:this.handleInputChange,onFocus:this.handleEndInputDateFocus,onBlur:this.handleInputBlur,onSubmit:this.handleInputSubmit,size:1,disabled:t})}),a&&this.getInputSeparator(),a&&n()(I.Z,{renderTooltip:()=>this.getInputErrorMessage(o.endTime),originGap:this.tooltipOriginGap,forceVisibleState:Boolean(o.endTime),placement:I.Z.Placement.Right,render:()=>e.isMobile?n()(P.Z,{type:"time",format:P.B.Transparent,value:p,onChange:this.handleInputChange,onFocus:this.handleEndInputTimeFocus,onBlur:this.handleInputBlur,onSubmit:this.handleInputSubmit,size:1,disabled:t}):n()(P.Z,{format:P.B.Transparent,value:u,focusInitial:i===k.Hv.EndTime,onChange:this.handleInputChange,onFocus:this.handleEndInputTimeFocus,onBlur:this.handleInputBlur,onSubmit:this.handleInputSubmit,size:1,disabled:t})}))}}renderTimeZone(){const{device:e}=this.environment,t=this.getDateValue(),i=g.iS(t,g.x7),s=v.Z.tz(i.start,g.x7);if(("datetime"===t.type||"datetimerange"===t.type)&&s.utcOffset()!==i.start.utcOffset()){const i=S.W3.find((e=>e.name===t.time_zone));if(i)return n()(J.Z,{isSmall:!0,isMobile:e.isMobile,style:{marginTop:8}},void 0,w(this.props.intl,i.name))}}renderCalendar(){const{firstDayOfWeek:e}=this.props,t=this.getDateValueForceCurrentTimeZone(),i=g.iS(t,g.x7),s=this.stores.store.state.currentMonth||i.start,{focus:a}=this.stores.store.state;if(i.end){const t=i.start.toDate(),o=i.end.toDate(),r=a===k.Hv.StartDate||a===k.Hv.StartTime;return n()(f(),{className:"notion-calendar-picker notranslate",firstDayOfWeek:e,numberOfMonths:1,initialMonth:s.toDate(),month:s.toDate(),locale:ie.SP,localeUtils:se.q,modifiers:{range:{from:t,to:o},...r?{end:o,start:t}:{start:t,end:o}},modifiersStyles:{range:ae.dayPickerRangeDayStyle,start:r?this.getDayPickerActiveDayStyle():this.getDayPickerInactiveDayStyle(),end:r?this.getDayPickerInactiveDayStyle():this.getDayPickerActiveDayStyle()},showOutsideDays:!0,fixedWeeks:!0,onDayClick:this.handleDayPickerDayClick,navbarElement:this.renderNavbarElement,onMonthChange:this.handleDayPickerMonthChange})}{const t=i.start.toDate();return n()(f(),{className:"notion-calendar-picker notranslate",numberOfMonths:1,firstDayOfWeek:e,initialMonth:s.toDate(),month:s.toDate(),locale:ie.SP,localeUtils:se.q,selectedDays:[t],modifiers:{start:t},modifiersStyles:{start:this.getDayPickerActiveDayStyle()},showOutsideDays:!0,fixedWeeks:!0,navbarElement:this.renderNavbarElement,onDayClick:this.handleDayPickerDayClick,onMonthChange:this.handleDayPickerMonthChange})}}renderControls(){const{device:e}=this.environment,{shouldShowReminder:t}=this.props;return e.isMobile?n()(R.Z,{topBorder:!0},void 0,t&&this.renderReminderControl(),this.renderEndDateControl(),this.renderAllDayControl()):n()(d.Fragment,{},void 0,t&&n()(R.Z,{topBorder:!0},void 0,this.renderReminderControl()),n()(R.Z,{topBorder:!0},void 0,this.renderEndDateControl(),this.renderAllDayControl()))}renderEndDateControl(){const{device:e}=this.environment,t=this.getDateValue();return n()(E.Z,{focused:!1,onClick:this.handleEndDateControlChange,title:n()(X.FormattedMessage,{defaultMessage:"End date",id:"datePropertyMenu.menuItem.endDate.label"}),right:n()(M.Z,{on:"daterange"===t.type||"datetimerange"===t.type,onClick:this.handleEndDateControlChange,isAndroid:e.isAndroid})})}renderAllDayControl(){const{device:e}=this.environment,t=this.getDateValue();return n()(E.Z,{focused:!1,onClick:this.handleAllDayChange,title:n()(X.FormattedMessage,{defaultMessage:"Include time",id:"datePropertyMenu.menuItem.includeTime.label",description:"Shown in the date property menu as an option for whether this date includes a time."}),right:n()(M.Z,{on:"date"!==t.type&&"daterange"!==t.type,onClick:this.handleAllDayChange,isAndroid:e.isAndroid})})}renderReminderControl(){const{device:e}=this.environment,{intl:t}=this.props,i=this.getDateValue();return n()(A.Z,{popupType:e.isMobile?A.Z.PopupType.SlideUp:A.Z.PopupType.Popup,placementToOrigin:A.Z.Placement.Right,renderOrigin:s=>c().createElement(W.Z,a()({},s,{icon:N.Z.alarmClock({width:14}),title:n()(X.FormattedMessage,{defaultMessage:"Remind",id:"datePropertyMenu.menuItem.remind.label"}),focused:!1,showExtensionArrow:e.isMobile,right:(0,H.nN)({reminder:i.reminder,intl:t})})),render:s=>{let o;o=e.isMobile?{menuType:_.ZP.MenuType.Modal,title:n()(X.FormattedMessage,{defaultMessage:"Remind",id:"datePropertyMenu.mobileRemindModal.title"}),right:n()(X.FormattedMessage,{defaultMessage:"Done",id:"datePropertyMenu.mobileDoneReminderButton.label"}),onClickRight:s.close}:{menuType:_.ZP.MenuType.Popup,width:250};const r=("date"===i.type||"daterange"===i.type?g.PI:g.dG).map((e=>{const i=(0,H.nN)({reminder:e,shouldShowTime:!0,intl:t});return{key:i,action:t=>{this.handleChangeReminder(e),s.close()},render:(e,t)=>c().createElement(E.Z,a()({},e,{title:i}))}}));return c().createElement(_.ZP,o,n()(O.Z,{type:O.Z.Type.Vertical,sections:[{key:"reminder section",render:e=>c().createElement(R.Z,e),items:r}],initialFocus:void 0}))}})}renderFormatPopup(){const{device:e}=this.environment;return n()(A.Z,{popupType:e.isMobile?A.Z.PopupType.SlideUp:A.Z.PopupType.Popup,placementToOrigin:A.Z.Placement.Right,renderOrigin:t=>c().createElement(E.Z,a()({},t,{icon:N.Z.sidebarSettings({width:14}),title:n()(X.FormattedMessage,{defaultMessage:"Date format & timezone",id:"datePropertyMenu.menuItem.formatAndTimezone.label"}),focused:!1,showExtensionArrow:e.isMobile})),render:t=>{let i;return i=e.isMobile?{menuType:_.ZP.MenuType.Modal,title:n()(X.FormattedMessage,{defaultMessage:"Date format",id:"datePropertyMenu.mobileDateFormatModal.title"}),right:n()(X.FormattedMessage,{defaultMessage:"Done",id:"datePropertyMenu.mobileDoneButton.label"}),onClickRight:t.close}:{menuType:_.ZP.MenuType.Popup,width:250},c().createElement(_.ZP,i,n()(R.Z,{},void 0,this.renderDateFormatControl(),this.renderTimeFormatControl(),this.renderTimeZoneControl()))}})}renderDateFormatControl(){const e=this.props.dateFormat||g.sF,{intl:t}=this.props,i={menuTitle:t.formatMessage({defaultMessage:"Date format",id:"datePropertyMenu.dateFormatDropdownButton.label"}),items:g.Zy,getKey:e=>e,selectedItem:e,onSelect:this.handleDateFormatChange,renderItem:e=>c().createElement(E.Z,a()({},e,{title:t.formatMessage(g.fy[e.value])})),renderOrigin:i=>c().createElement(W.Z,a()({focused:!1,title:n()(X.FormattedMessage,{defaultMessage:"Date format",id:"datePropertyMenu.menuItem.format.label"}),right:e?t.formatMessage(g.fy[e]):n()(X.FormattedMessage,{defaultMessage:"Empty",id:"datePropertyMenu.formatMenu.emptyButton.label"})},i))};return c().createElement(y.Z,i)}renderTimeFormatControl(){const e=this.getDateValue(),t="date"===e.type||"daterange"===e.type,i=this.getTimeFormat(),{intl:s}=this.props,o=this.getSelectedTimeFormatType(),r={menuTitle:s.formatMessage({defaultMessage:"Time format",id:"datePropertyMenu.timeFormatMenu.title"}),items:g.L7,getKey:e=>e,selectedItem:o,onSelect:this.handleTimeFormatChange,renderItem:e=>c().createElement(E.Z,a()({},e,{title:s.formatMessage(g.Fi[e.value])})),disabled:t,renderOrigin:e=>c().createElement(W.Z,a()({focused:!1,title:n()(X.FormattedMessage,{defaultMessage:"Time format",id:"datePropertyMenu.menuItem.timeFormat.label"}),disabled:t,right:!t&&(i?s.formatMessage(g.Fi[o]):n()(X.FormattedMessage,{defaultMessage:"Empty",id:"datePropertyMenu.timeFormatMenu.emptyButton.label"}))},e))};return c().createElement(y.Z,r)}renderTimeZoneControl(){const{device:e}=this.environment,t=this.getDateValue(),i="date"===t.type||"daterange"===t.type,s=this.getCurrentTimeZone(),o=S.W3.find((e=>e.name===s)),{intl:r}=this.props;if(o)return n()(A.Z,{popupType:e.isMobile?A.Z.PopupType.SlideUp:A.Z.PopupType.Popup,disabled:i,onClick:()=>this.stores.timezoneQuery.set(""),renderOrigin:e=>c().createElement(W.Z,a()({focused:!1,title:n()(X.FormattedMessage,{defaultMessage:"Timezone",id:"datePropertyMenu.menuItem.time.label"}),disabled:i,right:!i&&v.Z.tz.zone(o.name).abbr(Date.now())},e)),render:t=>{const i=this.stores.timezoneQuery.get(),s=this.getTimeZoneItemsSync(i),o=n()(R.Z,{isInput:!0},void 0,n()(L.Z,{focus:!e.isMobile||void 0,focusAfterAnimation:!0,value:this.stores.timezoneQuery.get(),onChange:e=>this.stores.timezoneQuery.set(e.target.value),placeholder:r.formatMessage({defaultMessage:"Search for a timezone…",id:"datePropertyMenu.timeSearch.placeholder"})}));let l;return l=e.isMobile?{menuType:_.ZP.MenuType.Modal,title:n()(X.FormattedMessage,{defaultMessage:"Timezone",id:"datePropertyMenu.mobileTimezoneMenu.title"}),right:n()($.CancelMenuText,{}),onClickRight:t.close,header:o}:{menuType:_.ZP.MenuType.Popup,header:o},c().createElement(_.ZP,l,0===s.length?n()(R.Z,{title:n()(X.FormattedMessage,{defaultMessage:"Select a timezone",id:"datePropertyMenu.timezoneMenu.select.placeholder"})},void 0,n()(U.Z,{title:n()(X.FormattedMessage,{defaultMessage:"No results",id:"datePropertyMenu.timezoneMenu.noResults"})})):n()(O.Z,{type:O.Z.Type.Vertical,initialFocus:0,sections:[{key:"timezone section",render:e=>c().createElement(R.Z,a()({},e,{title:n()(X.FormattedMessage,{defaultMessage:"Select a timezone",id:"datePropertyMenu.menuItem.select.title"})})),items:s}],onAccept:t.close}))}})}renderClearButton(){return n()(E.Z,{focused:!1,onClick:this.handleClearClick,title:n()(X.FormattedMessage,{defaultMessage:"Clear",id:"datePropertyMenu.clearButton.label"})})}renderRemindersHelp(){const{device:e}=this.environment;return e.isMobile?n()(Q.Z,{href:(0,ee.UY)("guides.reminders"),analyticsFrom:"date_selector"}):n()(Y.Z,{title:n()(X.FormattedMessage,{defaultMessage:"Learn about reminders",id:"datePropertyMenu.learnMore.helpButton.label"}),href:(0,ee.UY)("guides.reminders"),analyticsFrom:"date_selector"})}getDateValue(){const{value:e}=this.props;return e&&!m().isNaN(e)?e:this.openTimeFormat}getDateRangeBounds(){const e=this.getDateValue();if(g.h(e)||g.qg(e)){const t=g.iS(e,g.x7);return{earliestValidEnd:t.start.format(g.Q1),latestValidStart:t.end.format(g.Q1)}}}getDateValueForceCurrentTimeZone(){const{value:e}=this.props;return e&&!m().isNaN(e)?"datetime"===e.type||"datetimerange"===e.type?{...e,time_zone:g.x7}:e:this.openTimeFormat}getDateDisplayFormat(){const e=this.props.dateFormat||g.sF;return"relative"===e?g.sF:e}getTimeFormat(){return this.props.timeFormat||g.c_}getCurrentTimeZone(){const e=this.getDateValue();return"datetime"===e.type||"datetimerange"===e.type?e.time_zone:g.x7}parseInputDateValue(e){const{intl:t}=this.props;return this.environment.device.isMobile?(0,z.f_)(e,g.Q1,t):(0,z.f_)(e,this.getDateDisplayFormat(),t)}parseInputTimeValue(e){const t=(0,v.Z)(e,this.getTimeFormat(),!0);return t.isValid()?t.locale(g.ah).format(g.jK):(0,z.TD)(e,this.props.intl)}applyValidDateState(e){const{newDate:t,currentMonth:i,resetField:s}=e;this.props.onChangeValue(t),this.stores.store.setState({...this.stores.store.state,currentMonth:i}),this.resetInputState(s)}resetInputState(e){const{state:t}=this.stores.store;this.stores.store.setState({...t,error:{...t.error,[t.focus]:void 0},inputTemporaryValue:{...t.inputTemporaryValue,[t.focus]:void 0}})}getInputErrorMessage(e){const{intl:t}=this.props;switch(e){case k.pd.InvalidDate:return t.formatMessage({id:"datePropertyMenu.invalidDateError.tooltip",defaultMessage:"Invalid date"});case k.pd.InvalidRange:return t.formatMessage({id:"datePropertyMenu.invalidDateOrTimeRangeError.tooltip",defaultMessage:"Invalid range"});case k.pd.InvalidTime:return t.formatMessage({id:"datePropertyMenu.invalidTimeError.tooltip",defaultMessage:"Invalid time"});default:return}}getInputSeparator(){return n()("div",{style:{height:14,width:1,background:this.theme.regularDividerColor,marginLeft:6,marginRight:12,flexShrink:0}})}getInputWrapStyle(){return{display:"flex",alignItems:"center",borderRadius:3,height:28,lineHeight:1.2,background:this.theme.inputBackground,paddingLeft:8,paddingRight:8,flexBasis:"50%"}}getInputWrapInactiveStyle(){return{...this.getInputWrapStyle(),boxShadow:this.theme.inputBoxShadow,flexGrow:1}}getInputWrapErrorStyle(){return{...this.getInputWrapStyle(),boxShadow:"inset 0 0 0 2px ".concat(K.ZP.red),background:K.ZP.redWithAlpha(.15),flexGrow:1}}getInputWrapActiveStyle(){return{...this.getInputWrapStyle(),boxShadow:"inset 0 0 0 2px ".concat(K.ZP.blue),background:K.ZP.blueWithAlpha(.15),flexGrow:1}}getDayPickerActiveDayStyle(){return{backgroundColor:K.ZP.blue,color:K.ZP.white}}getDayPickerInactiveDayStyle(){return{backgroundColor:K.ZP.blueWithAlpha(.5)}}}l()(ae,"dayPickerRangeDayStyle",{backgroundColor:K.ZP.blueWithAlpha(.15)}),l()(ae,"desktopNavStyle",{display:"flex",position:"absolute",top:0,right:4,zIndex:V.mJ}),l()(ae,"mobileNavStyle",{display:"flex",position:"absolute",top:-2,right:4,zIndex:V.mJ});const oe=(0,X.injectIntl)(ae)},92660:(e,t,i)=>{i.d(t,{Z:()=>l});var s=i(98135),a=i.n(s),o=(i(67294),i(66832)),n=i(66722),r=i(15102);class l extends o.Z{renderComponent(){const{render:e}=this.props,{device:t}=this.environment,i=this.props.modalStore.state;return t.isMobile?a()(n.ZP,{open:i.open,popupType:n.ZP.PopupType.SlideUp,origin:this.props.origin,onDismiss:this.props.onDismiss,render:e}):a()(r.Z,{open:i.open,preventHideChildrenWhileOpening:!0,render:e,onDismiss:this.props.onDismiss})}}},29345:(e,t,i)=>{i.r(t),i.d(t,{default:()=>V});var s=i(98135),a=i.n(s),o=i(59713),n=i.n(o),r=(i(33948),i(67294)),l=i.n(r),d=i(66832),c=i(66205),u=i(15102),m=i(14947),p=i(3779),g=i(29551),h=i(82990),f=i(8848),v=i(62727),y=i(42001),M=i(72693),S=i(67154),b=i.n(S),T=i(5366),C=i(79583),Z=i(48762),w=i(47966);class k extends d.Z{renderComponent(){const{intl:e,question:t}=this.props,i={setup_trial:a()(T.FormattedMessage,{id:"enterpriseContactModalQuestionSelect.question.setup_trial",defaultMessage:"Setup an enterprise trial"}),live_demo:a()(T.FormattedMessage,{id:"enterpriseContactModalQuestionSelect.question.live_demo",defaultMessage:"Schedule a live demo"}),plan_help:a()(T.FormattedMessage,{id:"enterpriseContactModalQuestionSelect.question.plan_help",defaultMessage:"Need help choosing a plan"}),other:a()(T.FormattedMessage,{id:"enterpriseContactModalQuestionSelect.question.other",defaultMessage:"Other"})},s={menuTitle:e.formatMessage({defaultMessage:"Your question",id:"enterpriseContactModal.yourQuestion.title"}),items:["setup_trial","live_demo","plan_help","other"],width:280,getKey:e=>e,selectedItem:t,originGap:4,onSelect:e=>{this.props.onSelect(e)},renderItem:e=>l().createElement(Z.Z,b()({title:i[e.key]},e)),renderOrigin:e=>l().createElement(w.Z,b()({},e,{isLarge:!0,style:{...this.getInputStyle(),...this.props.invalid&&{border:"1px solid ".concat(f.ZP.red)}}}),a()("div",{style:{display:"flex",alignItems:"center",color:t?this.theme.regularTextColor:this.theme.lightTextColor}},void 0,t?i[t]:a()(T.FormattedMessage,{defaultMessage:"Select question",id:"enterpriseContactModal.selectQuestion.label"})),p.Z.expand({width:10,fill:this.theme.lightIconColor}))};return l().createElement(C.Z,b()({key:"onboarding"},s))}getInputStyle(){const{device:e}=this.environment;return{backgroundColor:this.theme.whiteButtonBackground,height:31,...e.isMobile&&{height:42},padding:"2px 10px",display:"flex",alignItems:"center",justifyContent:"space-between",borderRadius:3,border:0,transition:"box-shadow 0.3s ease",boxShadow:"0 0 0 1px ".concat(this.theme.outlineButtonBorder),background:this.theme.buttonBackground}}}const A=(0,T.injectIntl)(k);var P=i(52016);class I extends P.Z{getInitialState(){return{step:"initial"}}}const x=I;var F=i(41892),B=i(13548),E=i(89206),R=i(96486),D=i.n(R),_=i(33929),L=i(50906),O=i(30845);const U=(0,T.defineMessages)({additionalFeedbackPlaceholder:{id:"enterpriseContactModal.additionalFeedback.placeholder",defaultMessage:"What would you like to learn more about?"}});class N extends d.Z{constructor(...e){super(...e),n()(this,"storeTypes",{store:x}),n()(this,"renderMenu",(()=>a()("div",{style:this.getContainerStyle()},void 0,this.renderCancel(),a()(g.gq,{style:this.getInnerContainerStyle(),alignItems:"center",alignContent:"center"},void 0,this.renderStep())))),n()(this,"renderInitial",(()=>{const{invalidField:e}=this.stores.store.state;if(c.Z.state.open)return a()("div",{style:{...this.getSlideUpStyle(),padding:20}},void 0,p.Z.speechBubbleThin({width:"100%",height:24}),a()("div",{style:{fontSize:14,fontWeight:h.Z.fontWeight.semibold,paddingTop:6,paddingBottom:4}},void 0,a()(T.FormattedMessage,{id:"enterpriseContactModal.initial.header",defaultMessage:"Get in touch with sales"})),a()("div",{style:{fontSize:12,color:this.theme.mediumTextColor,width:200,margin:"0 auto"}},void 0,a()(T.FormattedMessage,{id:"enterpriseContactModal.initial.caption",defaultMessage:"We'll work with you on your setup and help you land on the best plan."})),a()("div",{style:{...this.getLabelStyle(),marginTop:24}},void 0,a()(T.FormattedMessage,{id:"enterpriseContactModal.initial.nameLabel",defaultMessage:"Your name"})),a()(v.Z,{focusInitial:!0,value:this.getName(),placeholder:"Ada Lovelace",style:{marginRight:4,...this.getInputStyle(),..."name"===e&&this.getInvalidInputStyle()},onChange:e=>{c.Z.setState({...c.Z.state,open:!0,name:void 0}),this.stores.store.setState({...this.stores.store.state,name:e.target.value})}}),a()("div",{style:this.getLabelStyle()},void 0,a()(T.FormattedMessage,{id:"enterpriseContactModal.initial.emailLabel",defaultMessage:"Your work email"})),a()(v.Z,{value:this.getEmail(),placeholder:"ada@lovelace.app",type:"email",style:{marginRight:4,...this.getInputStyle(),..."email"===e&&this.getInvalidInputStyle()},onChange:e=>{c.Z.setState({...c.Z.state,open:!0,email:void 0}),this.stores.store.setState({...this.stores.store.state,email:e.target.value})}}),a()("div",{style:this.getLabelStyle()},void 0,a()(T.FormattedMessage,{id:"enterpriseContactModal.initial.companySizeLabel",defaultMessage:"Company size"})),a()(g.gq,{},void 0,this.getCompanySizeButtonData().map((({type:e,message:t,style:i})=>a()(y.Z,{isLightGray:!0,isLarge:!0,style:{...this.getBaseButtonStyle(),...this.stores.store.state.companySize===e&&this.getSelectedButtonStyle(),...i},onClick:()=>{this.stores.store.setState({...this.stores.store.state,companySize:e})}},void 0,t)))),a()("div",{style:this.getLabelStyle()},void 0,a()(T.FormattedMessage,{id:"enterpriseContactModal.initial.questionLabel",defaultMessage:"Your question"})),a()(A,{question:this.stores.store.state.question,invalid:"question"===e,onSelect:e=>{this.stores.store.setState({...this.stores.store.state,question:e,step:"other"===e?"additional_input":"initial"})}}),a()(v.Z,{textarea:!0,textareaElementAttributes:{style:this.getInnerTextAreaStyle()},style:this.getTextAreaStyle(),focus:"additional_input"===this.stores.store.state.step,value:this.stores.store.state.additionalFeedback,placeholder:_.default.formatMessage(U.additionalFeedbackPlaceholder),onChange:e=>{this.stores.store.setState({...this.stores.store.state,additionalFeedback:e.target.value})}}))})),n()(this,"renderCancel",(()=>a()(m.Z,{onClick:this.handleCancel,style:this.getCancelStyle(),hoveredStyle:{background:this.theme.buttonPressedBackground}},void 0,p.Z.closeSmall({width:14,fill:this.theme.mediumTextColor})))),n()(this,"renderThanks",(()=>a()("div",{},void 0,a()("img",{style:{width:165,height:80},src:F.Z.images.feedbackThankYouPng}),a()("div",{style:this.getThanksHeaderStyle()},void 0,a()(T.FormattedMessage,{id:"enterpriseContactModal.thanks.caption",defaultMessage:"We've received your inquiry and will be contacting you via email shortly."}))))),n()(this,"handleCancel",(()=>{c.Z.setState({open:!1})}))}renderComponent(){return a()(u.Z,{preventHideChildrenWhileOpening:!0,open:c.Z.state.open,render:this.renderMenu,onDismiss:this.handleCancel})}renderStep(){const{step:e}=this.stores.store.state;return l().createElement(l().Fragment,null,a()(B.Z,{isVisible:"initial"===e||"additional_input"===e,enterAnimationStyle:{opacity:1},exitAnimationStyle:{opacity:0},render:()=>a()(E.Z,{capture:!0,onBackspace:D().identity,onLeft:D().identity,onRight:D().identity,onSelectAll:D().identity,onRedo:D().identity,onUndo:D().identity,onCut:D().identity,onCopy:D().identity,onPaste:D().identity,onKeypress:D().identity,onDelete:D().identity,onTab:D().identity},void 0,this.renderInitial())}),a()(B.Z,{isVisible:"thanks"===e,animationStyle:this.getAnimationStyle("thanks"===e),enterAnimationStyle:this.getEnterExitAnimationStyle(),exitAnimationStyle:this.getEnterExitAnimationStyle(),render:this.renderThanks}),a()(B.Z,{isVisible:"initial"===e||"additional_input"===e,enterAnimationStyle:{opacity:1},exitAnimationStyle:{opacity:0},render:()=>a()(M.Z,{isLarge:!0,style:{marginTop:17,width:284,position:"absolute",bottom:20},onClick:()=>{const e=this.getInvalidField();if(e){const{question:t}=this.stores.store.state;this.stores.store.setState({...this.stores.store.state,step:"initial",invalidField:e,question:"other"===t?void 0:t})}else this.stores.store.setState({...this.stores.store.state,invalidField:void 0,step:"thanks"}),c.Z.state.open&&L.Ls9(this.environment,{email:c.Z.state.email,name:c.Z.state.name,...this.stores.store.state}),D().delay((()=>{c.Z.reset(),D().delay((()=>{this.stores.store.reset()}),1e3)}),2e3)}},void 0,a()(T.FormattedMessage,{id:"enterpriseContactModal.initial.sendLabel",defaultMessage:"Send"}))}))}getName(){if(c.Z.state.open)return this.stores.store.state.name||c.Z.state.name}getEmail(){if(c.Z.state.open)return this.stores.store.state.email||c.Z.state.email}getInvalidField(){const e=this.getEmail(),t=this.getName(),{question:i,companySize:s}=this.stores.store.state;return t?e&&O.B(e,"email")?s?i?void 0:"question":"company_size":"email":"name"}getCompanySizeButtonData(){return[{type:"1_100",message:a()(T.FormattedMessage,{id:"enterpriseContactModal.initial.1_100Label",defaultMessage:"1-100"})},{type:"101_1000",message:a()(T.FormattedMessage,{id:"enterpriseContactModal.initial.101_1000Label",defaultMessage:"101-1,000"}),style:{marginLeft:8,marginRight:8}},{type:"1001+",message:a()(T.FormattedMessage,{id:"enterpriseContactModal.initial.1000PlusLabel",defaultMessage:"1,001+"})}]}getThanksHeaderStyle(){return{color:this.theme.regularTextColor,fontWeight:h.Z.fontWeight.semibold,fontSize:14}}getContainerStyle(){return{background:this.theme.popoverBackground,borderRadius:5,boxShadow:this.theme.mediumBoxShadow}}getCancelStyle(){return{position:"absolute",top:"10px",right:"10px",background:this.theme.buttonHoveredBackground,borderRadius:"100%",width:20,height:20,display:"flex",alignItems:"center",justifyContent:"center",zIndex:10}}getInnerContainerStyle(){return{width:320,height:470,overflow:"hidden",position:"relative",padding:20,cursor:"default",textAlign:"center",justifyContent:"center"}}getLabelStyle(){return{marginTop:17,fontSize:12,color:this.theme.mediumTextColor,fontWeight:h.Z.fontWeight.medium,lineHeight:"135%",marginBottom:4,textAlign:"left"}}getInputStyle(){return{backgroundColor:this.theme.whiteButtonBackground,height:31}}getInvalidInputStyle(){return{border:"1px solid ".concat(f.ZP.red)}}getAnimationStyle(e){return{opacity:e?1:0,scale:e?1:.96}}getEnterExitAnimationStyle(){return{opacity:0,scale:.96}}getBaseButtonStyle(){return{border:"1px solid #E7E6E5",flexGrow:1,justifyContent:"center"}}getSelectedButtonStyle(){return{color:f.ZP.blue,border:"1px solid ".concat(f.ZP.blue)}}getSlideUpStyle(){const{step:e}=this.stores.store.state;return{position:"absolute",transition:"transform 200ms ease",transform:"initial"===e?"translateY(153px)":"translateY(-180px)"}}getInnerTextAreaStyle(){return{width:"100%",height:"100%",background:"none",border:"none",resize:"none"}}getTextAreaStyle(){return{width:"100%",background:this.theme.popoverBackground,display:"block",padding:"7px 10px",height:310,marginTop:17,marginBottom:17,transition:"opacity 200ms ease-in",opacity:"additional_input"===this.stores.store.state.step?1:.001}}}const V=N},75765:(e,t,i)=>{i.r(t),i.d(t,{default:()=>j});var s=i(67154),a=i.n(s),o=i(98135),n=i.n(o),r=i(59713),l=i.n(r),d=(i(33948),i(96486)),c=i.n(d),u=i(67294),m=i.n(u),p=i(66832),g=i(71071),h=i(88632),f=i(42001),v=i(83071),y=i(6202),M=i(71202),S=i(25584),b=i(48762),T=i(47714),C=i(20083),Z=i(43593),w=i(61766),k=i(72693),A=i(70630),P=i(75246),I=i(93678),x=i(42115),F=i(5366),B=i(98742),E=i(37235),R=i(60442),D=i(41892),_=i(46951),L=i(32056),O=i(62727),U=i(56109),N=i(92166),V=i(92660),W=i(98459);const z=["pdf","html","markdown"],H=e=>e>.1&&e<2,q=["everything","no_files"];class G extends p.Z{constructor(...e){super(...e),l()(this,"storeTypes",{includeContentsPopupStore:w.Z,exportTypePopupStore:w.Z,pdfFormatPopupStore:w.Z}),l()(this,"renderMenu",(()=>{const{device:e}=this.environment;if(!h.Z.state.online)return this.renderOffline();const t=g.ZP.state;return t.open&&e.isMobile?this.renderMobileModal(t):t.open?this.renderDesktopModal(t):void 0})),l()(this,"handleSelectExportType",((e,t)=>{const i=g.ZP.state;if(!i.open)return;const{exportOptions:s}=i;if(e===s.exportType)return;let a;a="pdf"===e?{...s,exportType:"pdf",pdfFormat:A.GI(t)}:{...s,exportType:e},A.BO(this.environment,{...i,exportOptions:a})})),l()(this,"handleSelectPaperFormat",(e=>{const t=g.ZP.state;t.open&&g.Sw(t)&&A.BO(this.environment,{...t,exportOptions:{...t.exportOptions,pdfFormat:e}})})),l()(this,"handleSelectIncludeContents",(e=>{const t=g.ZP.state;t.open&&A.BO(this.environment,{...t,exportOptions:{...t.exportOptions,includeContents:e}})})),l()(this,"handleToggleRecursive",(()=>{const e=g.ZP.state;if(e.open){if(g.Sw(e)&&!A.y1(this.environment))return I.y(this.environment,{from:"export_modal",for:"enterprise"}),void this.handleUpgrade();A.BO(this.environment,{...e,recursive:!e.recursive})}})),l()(this,"handleSetScalePercent",(e=>{const t=g.ZP.state;t.open&&g.Sw(t)&&A.BO(this.environment,{...t,exportOptions:{...t.exportOptions,scale:e}})})),l()(this,"handleCancel",(()=>{A.Qr()})),l()(this,"handleSubmit",(()=>{if(!this.canSubmit())return;const e=g.ZP.state;e.open&&(A.Qr(),e.root.table===P.bx?A.AW(this.environment,{spaceId:e.root.id,exportOptions:e.exportOptions}):A.ZO(this.environment,{block:{id:e.root.id,spaceId:(0,W.CG)(e.root.spaceId)},recursive:e.recursive,exportOptions:e.exportOptions}))})),l()(this,"handleUpgrade",(()=>{A.Qr()}))}renderComponent(){return n()(V.Z,{onDismiss:this.handleCancel,render:this.renderMenu,requireOnline:!0,modalStore:g.ZP})}renderOffline(){return n()("div",{style:this.getOfflineStyle()},void 0,n()(F.FormattedMessage,{defaultMessage:"Please go online to export.",id:"exportModal.offlineMessage.description"}))}renderMobileModal(e){const t={menuType:M.og.Modal,title:n()(F.FormattedMessage,{id:"exportModal.title",defaultMessage:"Export"}),right:n()(F.FormattedMessage,{id:"exportModal.closeButton.label",defaultMessage:"Close"}),onClickRight:this.handleCancel};return m().createElement(M.ZP,t,n()(S.Z,{type:S.Z.Type.Vertical,initialFocus:void 0,sections:[{key:"exportOptions",render:e=>m().createElement(v.Z,e),items:this.getMobileExportOptionsMenuItems(e)},{key:"actions",render:({children:e,...t})=>m().createElement(v.Z,a()({isSubmitButton:!0},t),e),items:[{key:"submit",render:e=>{const{onClick:t,...i}=e;return m().createElement(y.Z,a()({},i,{onClick:t||this.handleSubmit,disabled:!this.canSubmit(),title:n()(F.FormattedMessage,{id:"exportModal.exportButton.label",defaultMessage:"Export"})}))},action:this.handleSubmit}]}]}))}renderDesktopModal(e){const{device:t,currentUser:i}=this.environment,s=g.Sw(e)&&!A.y1(this.environment);return n()("div",{style:this.getModalWrapStyle()},void 0,n()(C.Z,{isMenuItem:t.isMobile,buttonPopupStore:this.stores.exportTypePopupStore,label:n()(F.FormattedMessage,{id:"exportModal.exportFormat.description",defaultMessage:"Export format"}),selectedTitle:this.getBlockExportTypeTitle(e.exportOptions.exportType),renderMenuSections:e=>[{key:"exportType",render:e=>m().createElement(v.Z,e),items:z.map((t=>this.getBlockExportTypeMenuListItem(t,e,i.id)))}]}),n()(C.Z,{isMenuItem:t.isMobile,buttonPopupStore:this.stores.includeContentsPopupStore,label:n()(F.FormattedMessage,{id:"exportModal.includeContents.description",defaultMessage:"Include content"}),selectedTitle:this.getBlockIncludeContentsTitle(e.exportOptions.includeContents||"everything"),renderMenuSections:e=>[{key:"includeContents",render:e=>m().createElement(v.Z,e),items:q.map((t=>this.getIncludeContentsMenuListItem(t,e)))}]}),g.Sw(e)&&m().createElement(m().Fragment,null,n()(C.Z,{isMenuItem:t.isMobile,buttonPopupStore:this.stores.pdfFormatPopupStore,label:n()(F.FormattedMessage,{id:"exportModal.pageFormat.description",defaultMessage:"Page format"}),selectedTitle:this.getPDFFormatTitle(e.exportOptions.pdfFormat),renderMenuSections:e=>[{key:"isoPaperFormats",render:e=>m().createElement(v.Z,e),items:Z.lJ.map((t=>this.getPaperFormatMenuListItem(t,e)))},{key:"otherPaperFormats",render:e=>m().createElement(v.Z,a()({topBorder:!0},e)),items:Z.bY.map((t=>this.getPaperFormatMenuListItem(t,e)))}]}),this.renderScalePercent()),"space"!==e.root.table&&n()(x.Z,{requireUpgradeToTier:s&&"enterprise",analyticsName:"export_modal",onClick:this.handleToggleRecursive,render:(i,o)=>m().createElement("div",a()({},i,{style:{display:"flex",alignItems:"center",height:32}}),n()("div",{style:{display:"flex",alignItems:"center",marginRight:"auto",color:this.theme.lightTextColor,fontSize:14}},void 0,n()(F.FormattedMessage,{defaultMessage:"Include subpages",id:"exportModal.includeSubpages.label"})," ",o&&n()("div",{style:{marginLeft:8}},void 0,o)),n()(T.Z,{on:e.recursive,isAndroid:t.isAndroid,disabled:s})),renderUpgradeTooltip:()=>n()(R.Z,{imageURL:D.Z.images.tooltips.upsells.exportPdfSubpagesPng,imageWidth:240,imageHeight:100,title:n()(F.FormattedMessage,{defaultMessage:"Upgrade to include subpages in PDF exports",id:"exportModal.pdfSubpageUpgradeTooltip.title"}),caption:n()(F.FormattedMessage,{defaultMessage:"Creates a zip file containing all the pages nested inside the current page as PDF files.",id:"exportModal.pdfSubpageUpgradeTooltip.caption"})}),tooltipPlacement:E.Z.Placement.Left,upgradeButtonDesktopStyle:{marginTop:2},onUpgradeClick:this.handleUpgrade}),n()("div",{style:{display:"flex",alignItems:"center",marginTop:16}},void 0,n()(f.Z,{isGray:!0,style:{marginLeft:"auto",marginRight:8},onClick:this.handleCancel},void 0,n()(F.FormattedMessage,{defaultMessage:"Cancel",id:"exportModal.cancelButton.label"})),n()(k.Z,{onClick:this.handleSubmit,disabled:!this.canSubmit()},void 0,n()(F.FormattedMessage,{defaultMessage:"Export",id:"exportModal.exportButton.label"}))))}renderScalePercent(){const e=this.getScalePercent();return m().createElement(m().Fragment,null,n()("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",height:32}},void 0,n()(_.Z,{style:{color:this.theme.lightTextColor}},void 0,n()(F.FormattedMessage,{id:"exportModal.pageScale.description",defaultMessage:"Scale percent"})),n()(K,{value:e,onChange:this.handleSetScalePercent})),!H(e)&&n()(N.Z,{show:!0,showDelay:500,showHold:100,render:e=>e&&n()("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",minHeight:32,padding:"4px 0"}},void 0,n()(_.Z,{isSmall:!0,isMultiline:!0,style:{color:this.theme.errorText}},void 0,n()(F.FormattedMessage,{id:"exportModal.pageScale.invalidScaleError",defaultMessage:"Scale percent must be a number between 10 and 200",description:"Shown if the scale percent for pdf export is outside of range."})))}))}getMobileExportOptionsMenuItems(e){const{currentUser:t,device:i}=this.environment;return c().compact([{key:"export type",render:s=>m().createElement(C.Z,a()({},s,{isMenuItem:i.isMobile,buttonPopupStore:this.stores.exportTypePopupStore,label:n()(F.FormattedMessage,{defaultMessage:"Export format",id:"exportModal.exportFormat.description"}),selectedTitle:this.getBlockExportTypeTitle(e.exportOptions.exportType),renderMenuSections:e=>[{key:"exportType",render:e=>m().createElement(v.Z,e),items:z.map((i=>this.getBlockExportTypeMenuListItem(i,e,t.id)))}]})),action:()=>{this.stores.exportTypePopupStore.setState({open:!0})}},g.Sw(e)&&{key:"pdf format",render:t=>m().createElement(C.Z,a()({},t,{isMenuItem:i.isMobile,buttonPopupStore:this.stores.pdfFormatPopupStore,label:n()(F.FormattedMessage,{defaultMessage:"Page format",id:"exportModal.pageFormat.description"}),selectedTitle:this.getPDFFormatTitle(e.exportOptions.pdfFormat),renderMenuSections:e=>[{key:"isoPaperFormats",render:e=>m().createElement(v.Z,e),items:Z.lJ.map((t=>this.getPaperFormatMenuListItem(t,e)))},{key:"otherPaperFormats",render:e=>m().createElement(v.Z,a()({topBorder:!0},e)),items:Z.bY.map((t=>this.getPaperFormatMenuListItem(t,e)))}]})),action:()=>{this.stores.pdfFormatPopupStore.setState({open:!0})}},"space"!==e.root.table&&{key:"recursive",render:({onClick:t,key:s,...o})=>{const r=g.Sw(e)&&!A.y1(this.environment);return n()(x.Z,{requireUpgradeToTier:r&&"enterprise",analyticsName:"export_modal",onClick:t,render:(t,s)=>{const l=(0,B.Z)(o,t);return m().createElement(b.Z,a()({},l,{title:n()("div",{style:{display:"flex",alignItems:"center"}},void 0,n()(F.FormattedMessage,{defaultMessage:"Include subpages",id:"exportModal.includeSubpages.label"})," ",s&&n()("div",{style:{marginLeft:8}},void 0,s)),right:m().createElement(T.Z,a()({},l,{on:e.recursive,isAndroid:i.isAndroid,disabled:r}))}))},renderUpgradeTooltip:()=>n()(R.Z,{imageURL:D.Z.images.tooltips.upsells.exportPdfSubpagesPng,imageWidth:240,imageHeight:100,title:n()(F.FormattedMessage,{defaultMessage:"Upgrade to include subpages in PDF exports",id:"exportModal.pdfSubpageUpgradeTooltip.title"}),caption:n()(F.FormattedMessage,{defaultMessage:"Creates a zip file containing all the pages nested inside the current page as PDF files.",id:"exportModal.pdfSubpageUpgradeTooltip.caption"})}),tooltipPlacement:E.Z.Placement.Left,upgradeButtonDesktopStyle:{marginTop:2},onUpgradeClick:this.handleUpgrade},s)},action:this.handleToggleRecursive}])}getBlockExportTypeTitle(e){switch(e){case"pdf":return n()(F.FormattedMessage,{id:"exportModal.exportFormatButton.pdf.label",defaultMessage:"PDF"});case"markdown":return n()(F.FormattedMessage,{id:"exportModal.exportFormatButton.markdownAndCSV.label",defaultMessage:"Markdown & CSV"});case"html":return n()(F.FormattedMessage,{id:"exportModal.exportFormatButton.html.label",defaultMessage:"HTML"})}}getBlockIncludeContentsTitle(e){switch(e){case"everything":return n()(F.FormattedMessage,{id:"exportModal.includeContentTypes.everything.label",defaultMessage:"Everything"});case"no_files":return n()(F.FormattedMessage,{id:"exportModal.includeContentTypes.no_files.label",defaultMessage:"No Files or Images"})}}getPDFFormatTitle(e){switch(e){case"Letter":return n()(F.FormattedMessage,{id:"exportModal.pageFormatButton.letter.label",defaultMessage:"Letter"});case"A3":return n()(F.FormattedMessage,{id:"exportModal.pageFormatButton.a3.label",defaultMessage:"A3"});case"A4":return n()(F.FormattedMessage,{id:"exportModal.pageFormatButton.a4.label",defaultMessage:"A4"});case"Legal":return n()(F.FormattedMessage,{id:"exportModal.pageFormatButton.legal.label",defaultMessage:"Legal"});case"Tabloid":return n()(F.FormattedMessage,{id:"exportModal.pageFormatButton.tabloid.label",defaultMessage:"Tabloid"})}}getBlockExportTypeMenuListItem(e,t,i){const s=g.ZP.state,o=s.open&&"pdf"===e&&"space"===s.root.table&&!A.y1(this.environment);return{key:e,action:()=>{if(t.close(),o)return I.y(this.environment,{from:"export_modal",for:"enterprise"}),void this.handleUpgrade();this.handleSelectExportType(e,i)},render:({onClick:i,key:s,...r})=>n()(x.Z,{requireUpgradeToTier:o&&"enterprise",analyticsName:"export_modal",onClick:i,onUpgradeClick:()=>{t.close(),this.handleUpgrade()},render:(t,i)=>m().createElement(b.Z,a()({},(0,B.Z)(r,t),{title:this.getBlockExportTypeTitle(e),right:i})),renderUpgradeTooltip:()=>n()(R.Z,{imageURL:D.Z.images.tooltips.upsells.exportPdfSubpagesPng,imageWidth:240,imageHeight:100,title:n()(F.FormattedMessage,{defaultMessage:"Upgrade to export the workspace as PDFs",id:"exportModal.workspacePdfUpgradeTooltip.title"}),caption:n()(F.FormattedMessage,{defaultMessage:"Creates a zip file containing all pages in the workspace as PDF files.",id:"exportModal.workspacePdfUpgradeTooltip.caption"})}),tooltipPlacement:E.Z.Placement.Left,upgradeButtonDesktopStyle:{marginTop:2}},s)}}getIncludeContentsMenuListItem(e,t){return{key:e,action:()=>{t.close(),this.handleSelectIncludeContents(e)},render:t=>m().createElement(b.Z,a()({},t,{title:this.getBlockIncludeContentsTitle(e)}))}}getPaperFormatMenuListItem(e,t){return{key:e,action:()=>{t.close(),this.handleSelectPaperFormat(e)},render:t=>m().createElement(b.Z,a()({},t,{title:this.getPDFFormatTitle(e)}))}}getScalePercent(){const e=g.ZP.state;return e.open&&g.Sw(e)?void 0===e.exportOptions.scale?1:e.exportOptions.scale:1}canSubmit(){return H(this.getScalePercent())}getModalWrapStyle(){return{width:320,padding:24,fontSize:14}}getOfflineStyle(){return{...this.getModalWrapStyle(),color:this.theme.mediumTextColor}}}function K({value:e,onChange:t}){const i=(0,F.useIntl)(),s=m().useCallback((e=>{const i=e.target.value,s=(0,L._g)(i)||(0,L.p3)(i);let a;"object"==typeof s?a="percent"===s.format?s.value:s.value/100:"number"==typeof s&&(a=s/100),void 0!==a&&t(a)}),[t]),[a,o]=m().useState(!1),r=m().useMemo((()=>(0,L.uf)(Math.round(100*e),"number",i)),[e,i]);return n()(U.Z,{capture:a},void 0,n()(O.Z,{value:r,onChange:s,onFocus:()=>o(!0),onBlur:()=>o(!1),style:{width:60},inputStyle:{textAlign:"right"}}))}const j=G},79027:(e,t,i)=>{i.r(t),i.d(t,{default:()=>M});var s=i(98135),a=i.n(s),o=i(59713),n=i.n(o),r=(i(33948),i(67294)),l=i(66832),d=i(7844),c=i(15102),u=i(82990),m=i(72693),p=i(41892),g=i(17311),h=i(91376),f=i(33058),v=i(5366);class y extends l.Z{constructor(...e){super(...e),n()(this,"handleModalDismiss",(()=>{d.Z.state.open&&d.Z.state.onDecline&&d.Z.state.onDecline(),d.Z.setState({open:!1})})),n()(this,"handleConnectClick",(()=>{d.Z.state.open&&d.Z.state.onConfirm(),d.Z.setState({open:!1})})),n()(this,"handleConnectedAppsClick",(()=>{this.handleModalDismiss(),h.r({currentTab:"connected_apps"})}))}renderComponent(){const{device:e}=this.environment,t=d.Z.state;return a()(c.Z,{open:t.open,innerStyle:y.wrapStyle,preventHideChildrenWhileOpening:!0,render:()=>a()(r.Fragment,{},void 0,a()("div",{style:y.modalHeaderWrapStyle},void 0,a()("img",{src:p.Z.images.googleDriveLogoPng,style:{width:50,display:"inline-block"}}),a()("div",{style:this.getModalMessageStyle()},void 0,a()(v.FormattedMessage,{defaultMessage:"Notion cannot access the Google Drive file you are trying to embed.",id:"googleAuthPromptModal.noAccessFile.errorMessage"})),e.isMobileNative?a()("div",{style:this.getModalMessageStyle()},void 0,a()(v.FormattedMessage,{defaultMessage:"Please use Notion on desktop to connect a new account.",id:"googleAuthPromptModal.mobileUseDesktopPrompt.errorMessage"})):a()(m.Z,{isLarge:!0,onClick:this.handleConnectClick},void 0,a()(v.FormattedMessage,{defaultMessage:"Connect to Google",id:"googleAuthPromptModal.connectToGoogleButton.label"})),!e.isMobile&&this.renderConnectedAccountsLink())),onDismiss:this.handleModalDismiss})}renderConnectedAccountsLink(){return a()("div",{style:{display:"block",marginTop:g.Z.vertical.tiny}},void 0,a()(f.Z,{underlined:!0,onClick:this.handleConnectedAppsClick},void 0,a()(v.FormattedMessage,{defaultMessage:"See my connected accounts",id:"googleAuthPromptModal.seeConnectedAccountsButton.label"})))}getModalMessageStyle(){return{fontSize:16,lineHeight:1.5,fontWeight:u.Z.fontWeight.medium,marginTop:15,marginBottom:20,color:this.theme.mediumTextColor}}}n()(y,"wrapStyle",{padding:"24px 36px 24px",minWidth:300,maxWidth:400}),n()(y,"modalHeaderWrapStyle",{textAlign:"center",marginTop:8,marginBottom:18,justifyContent:"space-between"});const M=y},41804:(e,t,i)=>{i.r(t),i.d(t,{default:()=>qe});var s=i(98135),a=i.n(s),o=i(59713),n=i.n(o),r=(i(33948),i(67294)),l=i.n(r),d=i(66832),c=i(27832),u=i(47593),m=i(67154),p=i.n(m),g=i(86512),h=i(80527),f=i(48762),v=i(46167),y=i(88632),M=i(14947),S=i(8848),b=i(82990),T=i(4708);class C extends d.Z{renderComponent(){const{title:e,actionButton:t,onClick:i}=this.props;return a()(M.Z,{onClick:i,style:this.getButtonStyle()},void 0,this.renderIcon(),a()("div",{style:{minWidth:0,width:"100%"}},void 0,a()("div",{style:{display:"flex"}},void 0,a()("div",{style:C.titleStyle},void 0,e),a()("div",{style:{marginLeft:"auto"}},void 0,t)),this.renderCaption()))}renderIcon(){const{icon:e,logo:t}=this.props;return t?a()("img",{style:C.imageIconStyle,src:t}):e?a()("div",{style:this.getIconWrapStyle()},void 0,e(this.getIconStyle())):void 0}renderCaption(){const{caption:e}=this.props;if(e)return a()("div",{style:this.getCaptionStyle()},void 0,e)}getButtonStyle(){return{display:"flex",alignItems:"center",padding:10,paddingRight:8,borderRadius:3,marginBottom:12,cursor:"pointer",boxShadow:this.theme.lightBoxShadow,transition:"background 200ms ease-out",background:(0,T.GN)()?this.theme.importOptionsButtonBackground:this.theme.contentBackground}}getIconWrapStyle(){return{display:"flex",alignItems:"center",justifyContent:"center",width:C.iconSize,height:C.iconSize,borderRadius:3,marginRight:8,color:this.theme.mediumTextColor,background:(0,T.GN)()?this.theme.importOptionsIconWrapBackground:this.theme.sidebarBackground}}getIconStyle(){return{flexShrink:0,width:C.iconSize,height:C.iconSize}}getCaptionStyle(){return{fontSize:12,color:this.theme.mediumTextColor,wordBreak:"keep-all",...!this.props.shouldWrapCaption&&{...b.Z.textOverflowStyle}}}}n()(C,"iconSize",28),n()(C,"imageIconStyle",{flexShrink:0,width:C.iconSize,height:C.iconSize,borderRadius:3,marginRight:10,background:S.ZP.white}),n()(C,"titleStyle",{fontSize:16,fontWeight:b.Z.fontWeight.medium});const Z=C;var w=i(68932),k=i(71202),A=i(25584),P=i(7765),I=i(72087),x=i(83071),F=i(37235),B=i(66722),E=i(50906),R=(i(65069),i(17256)),D=i(29477),_=i(9714),L=i(58762),O=i(9953),U=i(8646),N=i(53471),V=i(29974),W=i(92625),z=i(47307),H=i(94419),q=i(46190),G=i(82066),K=i(96486),j=i.n(K),Y=i(21202),Q=i(41432),J=i(90365),X=i(5366),$=i(33929);const ee=["application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.wordprocessingml.template","application/vnd.ms-word.document.macroEnabled.12","application/vnd.ms-word.template.macroEnabled.12"],te=["text/plain",".md",".mdown",".markdown",".mkdn",".mkd",".Rmd",".md.txt"],ie={markdown:te,csv:["text/plain",".csv"],html:["text/html"],docx:ee,gdocs:ee,dropbox:ee,quip:["text/html",te],workflowy:["text/plain"],confluence:["application/zip"]};var se=i(33954),ae=i(98459);const oe=(0,X.defineMessages)({uploadingOneFile:{id:"importActions.uploadingOneFile.loadingMessage",defaultMessage:"Uploading… ({percentComplete}%)"},uploadingMultipleFilesNotStarted:{id:"importActions.uploadingMultipleFilesNotStarted.loadingMessage",defaultMessage:"Uploaded 0 of {totalNumberOfFiles}"},uploadingMultipleFilesInProgress:{id:"importActions.uploadingMultipleFilesInProgress.loadingMessage",defaultMessage:"Uploaded {numberOfUploadedFiles} of {totalNumberOfFiles}"},uploadingMultipleFilesComplete:{id:"importActions.uploadingMultipleFilesComplete.loadingMessage",defaultMessage:"Uploaded {totalNumberOfFiles} of {totalNumberOfFiles}"},importingOneFile:{id:"importActions.importingOneFile.loadingMessage",defaultMessage:"Importing…"},importingMultipleFilesNotStarted:{id:"importActions.importingMultipleFilesNotStarted.loadingMessage",defaultMessage:"Imported 0 of {totalNumberOfFiles}"},importingMultipleFilesInProgress:{id:"importActions.importingMultipleFilesInProgress.loadingMessage",defaultMessage:"Imported {numberOfImportedFiles} of {totalNumberOfFiles}"},importingMultipleFilesComplete:{id:"importActions.importingMultipleFilesComplete.loadingMessage",defaultMessage:"Imported {totalNumberOfFiles} of {totalNumberOfFiles}"},importingFromTrelloMessage:{id:"importActions.importingFromTrello.loadingMessage",defaultMessage:"{importingCount, plural, one {Importing {importingCount} board from Trello} other {Importing {importingCount} boards from Trello}}"},importingFromAsanaMessage:{id:"importActions.importingFromAsana.loadingMessage",defaultMessage:"{importingCount, plural, one {Importing {importingCount} project from Asana} other {Importing {importingCount} projects from Asana}}"},importingFromEvernoteMessage:{id:"importActions.importingFromEvernote.loadingMessage",defaultMessage:"{importingCount, plural, one {Importing {importingCount} notebook from Evernote} other {Importing {importingCount} notebooks from Evernote}}"},importFailed:{id:"importActions.importFailedError.message",defaultMessage:"Import failed."},trelloImportFailed:{id:"importActions.trelloImportFailedError.message",defaultMessage:"Trello import failed."},asanaImportFailed:{id:"importActions.asanaImportFailedError.message",defaultMessage:"Asana import failed."},evernoteImportFailed:{id:"importActions.evernoteImportFailedError.message",defaultMessage:"Evernote import failed."},importTitle:{id:"importActions.importTitle",defaultMessage:"Import {date}",description:"'Import' is a noun"}});async function ne(e){const{environment:t,spaceStore:i,spaceViewStore:s,notebooks:a,userSettingsStore:o}=e;if(0===a.length)throw new Error("Expected at least one notebook");W.j({message:oe.importingFromEvernoteMessage,interpolatedValues:{importingCount:a.length}}),J.Z.setState({open:!1});const n=await async function(e){const{environment:t,spaceStore:i,spaceViewStore:s,notebooks:a}=e,o=U.create(t),n=j().uniq(j().compact(a.map((e=>e.stack)))).sort().reverse(),r={};let l=e=>!0;a.length>1&&n.length>0&&(n.forEach((e=>{const n=V.KE({environment:t,spaceStore:i,spaceViewStore:s,isPrivate:!0,prepend:!0,loading:!1,title:e,transaction:o}),l=n.getContentStore();a.filter((t=>t.stack===e)).forEach((e=>{const i=O.j4({environment:t,type:Q.ZP.copyIndicator,inMemoryRecordCache:n.inMemoryRecordCache,transaction:o,spaceId:l.pointer.spaceId});H.R3({parent:l,append:i,transaction:o}),r[e.guid]=i}))})),l=e=>!Boolean(e.stack));return a.filter(l).reverse().forEach((e=>{const a=V.KE({environment:t,spaceStore:i,spaceViewStore:s,isPrivate:!0,prepend:!0,loading:!0,title:e.title,transaction:o});r[e.guid]=a})),await U.commit({environment:t,transaction:o}),r}({environment:t,spaceStore:i,spaceViewStore:s,notebooks:a}),r=n[a[0].guid];try{return await async function(e){const{environment:t,spaceStore:i,spaceViewStore:s,notebooks:a,waitForNotebook:o,notebookMapping:n,userSettingsStore:r}=e;let l;if(D.dC(a,2,(async e=>{await Promise.all(e.map((async e=>{const i=n[e.guid];if(!i)throw new Error("Missing notebook page ".concat(e.guid));const s=D.UZ();i===o&&(l=s),await async function(e){const{environment:t,notebookStore:i,notebook:s,firstCompleted:a}=e,o=L.importEvernote(t,{notebookId:s.guid,block:{id:i.id,spaceId:(0,ae.CG)(i.pointer.spaceId)},timestamp:Date.now(),parentTable:Y.iU}),{value:n}=await o.next();if(n.error)throw console.error(n.error),U.createAndCommit(t,(e=>{const t=i.getParentBlockStore();if(t){const s=t.getContentStore();H.Od({parent:s,remove:i,transaction:e})}})),n.error;a.resolve(void 0)}({environment:t,notebookStore:i,notebook:e,firstCompleted:s})})))})),!l)throw new Error("waitForNotebookFirstCompleted not defined.");r.getSettings().created_evernote_getting_started||await V.FI({environment:t,type:"evernote",spaceStore:i,spaceViewStore:s,userSettingsStore:r});await l.promise}({environment:t,waitForNotebook:r,notebookMapping:n,notebooks:a,spaceStore:i,spaceViewStore:s,userSettingsStore:o}),W.x(),r}catch(l){throw z.showErrorMessage($.default.formatMessage(oe.evernoteImportFailed)),W.x(),l}}var re=i(3779),le=i(41892),de=i(16328),ce=i(52016);class ue extends ce.Z{getInitialState(){return{searchQuery:"",selection:new Set}}}const me=ue;var pe=i(73581),ge=i(82970),he=i(31942),fe=i(72693),ve=i(86646),ye=i(33058);class Me extends d.Z{renderComponent(){return a()("div",{style:this.getStyle()},void 0,"·")}getStyle(){return{display:"inline-block",textAlign:"center",color:this.props.disabled?this.theme.lightTextColor:this.theme.mediumTextColor,userSelect:"none",WebkitUserSelect:"none",width:8}}}const Se=Me;var be=i(46951);class Te extends d.Z{constructor(...e){super(...e),n()(this,"storeTypes",{store:me}),n()(this,"handleSelectAllClick",(()=>{const{sections:e,analyticsName:t}=this.props,{store:i}=this.stores,{selection:s}=i.state;for(const a of e)for(const e of a.items)s.add(e.key);i.emit(),E.VfZ(this.environment,{name:t})})),n()(this,"handleDeselectAllClick",(()=>{const{analyticsName:e}=this.props,{store:t}=this.stores,{selection:i}=t.state;i.clear(),t.emit(),E.FIS(this.environment,{name:e})})),n()(this,"handleToggleItem",(e=>{const{analyticsName:t}=this.props,{store:i}=this.stores,{selection:s}=i.state;s.has(e.key)?(s.delete(e.key),E.Z36(this.environment,{name:t})):(s.add(e.key),E.Glf(this.environment,{name:t})),i.emit()})),n()(this,"handleImport",(()=>{const{sections:e}=this.props,{selection:t}=this.stores.store.state,i=j().flatten(e.map((e=>e.items))),s=[];t.forEach((e=>{const t=i.find((t=>t.key===e));t&&s.push(t)})),this.props.onComplete(s)}))}willMount(e){const t=this.stores.store.state.selection,[i]=e.sections;if(i){const[e]=i.items;e&&t.add(e.key)}this.stores.store.emit()}renderComponent(){return a()(k.ZP,{menuType:k.ZP.MenuType.Popup,header:this.renderMenuHeader(),footer:this.renderMenuFooter(),width:280,maxHeight:350},void 0,this.renderMenuList())}renderMenuHeader(){const{searchInputPlaceholder:e}=this.props,{searchQuery:t}=this.stores.store.state,i=Boolean(t);return a()(x.Z,{isInput:!0,desktopStyle:{paddingBottom:2}},void 0,a()(pe.Z,{focus:!0,focusAfterAnimation:!0,value:t,onChange:e=>{const{store:t}=this.stores;t.setState({...t.state,searchQuery:e.target.value})},placeholder:e}),a()(ve.Z,{isTokenTitle:!0,style:{marginTop:2},title:a()("div",{style:{marginLeft:-3}},void 0,a()(ye.Z,{onClick:this.handleSelectAllClick,disabled:i,disabledFeedback:!0},void 0,a()(X.FormattedMessage,{id:"importPopup.selectAll",defaultMessage:"Select all"})),a()(Se,{disabled:i}),a()(ye.Z,{onClick:this.handleDeselectAllClick,disabled:i,disabledFeedback:!0},void 0,a()(X.FormattedMessage,{id:"importPopup.deselectAll",defaultMessage:"Deselect all"})))}))}renderMenuFooter(){const e=0===this.stores.store.state.selection.size;return a()(x.Z,{topBorder:!0,desktopStyle:{paddingTop:8,paddingBottom:8}},void 0,a()(ve.Z,{title:a()(fe.Z,{disabled:e,onClick:this.handleImport},void 0,a()(X.FormattedMessage,{id:"integrationImportPopup.importButton.label",defaultMessage:"Import"}))}))}renderMenuList(){const{sections:e,noSearchResultsPlaceholder:t}=this.props,{store:i}=this.stores,{searchQuery:s,selection:o}=i.state,n=e.map((e=>{const t=(0,he.ZP)(s,e.items,(t=>"".concat(t.name," ").concat(e.name)));return{...e,items:t}})).filter((e=>e.items.length>0));if(0===n.length)return a()(x.Z,{},void 0,a()(de.Z,{title:t}));const r=n.map((t=>({key:t.name,render:i=>l().createElement(x.Z,p()({},i,{title:e.length>1?t.name:void 0})),items:t.items.map((e=>{const t=()=>this.handleToggleItem(e);return{key:e.key,render:i=>l().createElement(f.Z,p()({},i,{title:e.name,icon:a()(ge.Z,{checked:o.has(e.key),size:16,onClick:t}),right:void 0!==e.count&&a()(be.Z,{isSmall:!0},void 0,e.count)})),action:t}}))})));return a()(A.Z,{type:A.Z.Type.Vertical,initialFocus:void 0,sections:r})}}const Ce=Te;var Ze=i(52192);class we extends d.Z{constructor(...e){super(...e),n()(this,"handleClickImportTrello",(()=>{E.ays(this.environment,{name:"trello",from:this.props.analyticsFrom})})),n()(this,"handleTrelloAuth",(async()=>{await Ze.M({environment:this.environment,requestStore:this.props.requestStore})})),n()(this,"handleRemoveTrello",(async()=>{await L.disconnectTrello(this.environment,{}),await this.props.requestStore.refresh(),E.qJZ(this.environment,{name:"trello"})})),n()(this,"handleImportTrelloComplete",(async(e,t)=>{const{boards:i}=e,s=i.filter((e=>Boolean(t.find((t=>t.key===e.id)))));E.G7t(this.environment,{name:"trello",count:t.length});const a=await async function(e){const{environment:t,boards:i,spaceStore:s,spaceViewStore:a}=e;W.j({message:oe.importingFromTrelloMessage,interpolatedValues:{importingCount:i.length}}),G.Z.setState({open:!1});const o=U.create(t),n=i.map((e=>V.KE({environment:t,spaceStore:s,spaceViewStore:a,isPrivate:!0,prepend:!0,loading:!0,title:e.name,transaction:o})));await new Promise((e=>{o.postSubmitCallbacks.push(e),U.commit({environment:t,transaction:o})}));try{return await Promise.all(n.map((async(e,s)=>{const a=i[s],{value:o}=await L.importTrello(t,{boardId:a.id,block:{id:e.id,spaceId:(0,ae.CG)(e.pointer.spaceId)}}).next();if(o.error)throw o.error}))),W.x(),n[0]}catch(r){throw U.createAndCommit(t,(e=>{for(const t of n)H.Od({parent:s.getPagesStore(),remove:t,transaction:e})})),z.showErrorMessage($.default.formatMessage(oe.trelloImportFailed)),W.x(),new Error(r)}}({environment:this.environment,spaceStore:this.props.spaceStore,spaceViewStore:this.props.spaceViewStore,boards:s});this.props.onComplete(a)}))}renderComponent(){const{device:e}=this.environment,{trelloResult:t,intl:i}=this.props,{account:s,boards:o}=t,n={key:"default",name:i.formatMessage({id:"trelloImportOption.boardProperty.defaultName",defaultMessage:"Boards"}),items:o.map((e=>({key:e.id,name:e.name})))},r={title:"Trello",logo:le.Z.images.import.trelloPng,actionButton:s&&this.props.renderItemActionsButton([{name:i.formatMessage({id:"trelloImportOption.actionsMenu.import",defaultMessage:"Import"}),action:()=>G.Z.setState({open:!0})},{name:i.formatMessage({id:"trelloImportOption.actionsMenu.connectAnotherAccount",defaultMessage:"Connect another account"}),action:this.handleTrelloAuth},{name:i.formatMessage({id:"trelloImportOption.actionsMenu.removeIntegration",defaultMessage:"Remove"}),action:this.handleRemoveTrello}]),onClick:()=>{}};return a()(v.Z,{popupType:e.isMobile?v.Z.PopupType.SlideUp:v.Z.PopupType.Popup,buttonPopupStore:G.Z,onClick:this.handleClickImportTrello,render:()=>a()(Ce,{searchInputPlaceholder:i.formatMessage({id:"trelloImportOption.search.placeholder",defaultMessage:"Search for a board…",description:"'Board' is a Trello term."}),noSearchResultsPlaceholder:i.formatMessage({id:"trelloImportOption.search.noResultsPlaceholder",defaultMessage:"No boards",description:"'Board' is a Trello term."}),analyticsName:"trello",sections:[n],onComplete:e=>this.handleImportTrelloComplete(t,e)}),renderOrigin:({onClick:e})=>l().createElement(Z,p()({},r,{onClick:s?e:this.handleTrelloAuth}))})}}const ke=(0,X.injectIntl)(we);var Ae=i(78291),Pe=i(26111),Ie=i(83805),xe=i(33665);class Fe extends d.Z{constructor(...e){super(...e),n()(this,"handleClickImportEvernote",(()=>{E.ays(this.environment,{name:"evernote",from:this.props.analyticsFrom})})),n()(this,"handleRemoveEvernote",(async()=>{await L.disconnectEvernote(this.environment,{}),await this.props.requestStore.refresh(),E.qJZ(this.environment,{name:"evernote"})})),n()(this,"handleEvernoteAuth",(async()=>{await Ie.e({environment:this.environment,requestStore:this.props.requestStore})})),n()(this,"handleImportEvernoteComplete",(async(e,t)=>{const{notebooks:i}=e,s=i.filter((e=>Boolean(t.find((t=>t.key===e.guid)))));E.G7t(this.environment,{name:"evernote",count:t.length});const a=await ne({environment:this.environment,spaceStore:this.props.spaceStore,spaceViewStore:this.props.spaceViewStore,userSettingsStore:this.props.userSettingsStore,notebooks:s});this.props.onComplete(a)})),n()(this,"handleEvernoteHelpClick",(()=>{Pe.navigateToExternalURL({environment:this.environment,url:(0,xe.UY)("guides.importEvernote")})}))}renderComponent(){const{device:e}=this.environment,{evernoteResult:t,intl:i}=this.props,{userInfo:s,notebooks:o}=t,n=j().groupBy(o,(e=>e.stack||"")),r=Object.keys(n).map((e=>{const t=e||"Top-Level";return{key:t,name:t,items:(n[e]||[]).map((e=>({key:e.guid,name:e.title,count:e.noteCount})))}})),{data:d}=Ae.default.state,c=Boolean(d&&d.credits.find((e=>"import_evernote"===e.type&&e.activated))),u={title:"Evernote",logo:le.Z.images.import.evernotePng,shouldWrapCaption:!s&&!c,caption:s?s.name||s.username||s.email:c?void 0:i.formatMessage({id:"evernoteImportOption.caption.getCredit",defaultMessage:"Get $5 in credit on import"}),actionButton:s?this.props.renderItemActionsButton([{name:i.formatMessage({id:"evernoteImportOption.actionsMenu.learnMore",defaultMessage:"Learn more"}),action:this.handleEvernoteHelpClick},{name:i.formatMessage({id:"evernoteImportOption.actionsMenu.import",defaultMessage:"Import"}),action:()=>J.Z.setState({open:!0})},{name:i.formatMessage({id:"evernoteImportOption.actionsMenu.connectAnotherAccount",defaultMessage:"Connect another account"}),action:this.handleEvernoteAuth},{name:i.formatMessage({id:"evernoteImportOption.actionsMenu.removeIntegration",defaultMessage:"Remove"}),action:this.handleRemoveEvernote}]):this.props.defaultActionButton,onClick:()=>{}};return a()(v.Z,{popupType:e.isMobile?v.Z.PopupType.SlideUp:v.Z.PopupType.Popup,buttonPopupStore:J.Z,onClick:this.handleClickImportEvernote,render:()=>a()(Ce,{searchInputPlaceholder:i.formatMessage({id:"evernoteImportOption.search.placeholder",defaultMessage:"Search for a notebook…",description:"'Notebook' is an Evernote term."}),noSearchResultsPlaceholder:i.formatMessage({id:"evernoteImportOption.search.noResultsPlaceholder",defaultMessage:"No notebooks",description:"'Notebook' is an Evernote term."}),analyticsName:"evernote",sections:r,onComplete:e=>this.handleImportEvernoteComplete(t,e)}),renderOrigin:({onClick:e})=>l().createElement(Z,p()({},u,{onClick:s?e:this.handleEvernoteAuth}))})}}const Be=(0,X.injectIntl)(Fe);var Ee=i(51582);class Re extends d.Z{constructor(...e){super(...e),n()(this,"handleClickImportAsana",(()=>{E.ays(this.environment,{name:"asana",from:this.props.analyticsFrom})})),n()(this,"handleAsanaAuth",(async()=>{await Ee.w({environment:this.environment,requestStore:this.props.requestStore})})),n()(this,"handleRemoveAsana",(async()=>{await L.disconnectAsana(this.environment,{}),await this.props.requestStore.refresh(),E.qJZ(this.environment,{name:"asana"})})),n()(this,"handleImportAsanaComplete",(async(e,t)=>{const i=j().flatten(j().values(e.projects)).filter((e=>Boolean(t.find((t=>t.key===e.gid.toString())))));E.G7t(this.environment,{name:"asana",count:t.length});const s=await async function(e){const{environment:t,projects:i,spaceStore:s,spaceViewStore:a}=e;W.j({message:oe.importingFromAsanaMessage,interpolatedValues:{importingCount:i.length}}),q.Z.setState({open:!1});const o=U.create(t),n=i.map((e=>V.KE({environment:t,spaceStore:s,spaceViewStore:a,isPrivate:!0,prepend:!0,loading:!0,title:e.name,transaction:o})));await U.commit({environment:t,transaction:o});try{return await Promise.all(n.map((async(e,s)=>{const a=i[s],{value:o}=await L.importAsana(t,{block:{id:e.id,spaceId:(0,ae.CG)(e.pointer.spaceId)},projectId:a.gid}).next();if(o.error)throw o.error}))),W.x(),n[0]}catch(r){throw U.createAndCommit(t,(e=>{for(const t of n)H.Od({parent:s.getPagesStore(),remove:t,transaction:e})})),z.showErrorMessage($.default.formatMessage(oe.asanaImportFailed)),W.x(),new Error(r)}}({environment:this.environment,spaceStore:this.props.spaceStore,spaceViewStore:this.props.spaceViewStore,projects:i});this.props.onComplete(s)}))}renderComponent(){const{asanaResult:e,intl:t}=this.props,{account:i,workspaces:s,projects:o}=e,n=s.map((e=>{const t=o[e.gid]||[];return{key:e.gid.toString(),name:e.name,items:t.map((e=>({key:e.gid.toString(),name:e.name})))}})),r={title:"Asana",logo:le.Z.images.import.asanaPng,caption:i&&i,actionButton:i&&this.props.renderItemActionsButton([{name:t.formatMessage({id:"asanaImportOption.actionsMenu.import",defaultMessage:"Import"}),action:()=>q.Z.setState({open:!0})},{name:t.formatMessage({id:"asanaImportOption.actionsMenu.connectAnotherAccount",defaultMessage:"Connect another account"}),action:this.handleAsanaAuth},{name:t.formatMessage({id:"asanaImportOption.actionsMenu.removeIntegration",defaultMessage:"Remove"}),action:this.handleRemoveAsana}]),onClick:()=>{}},{device:d}=this.environment;return a()(v.Z,{popupType:d.isMobile?v.Z.PopupType.SlideUp:v.Z.PopupType.Popup,buttonPopupStore:q.Z,onClick:this.handleClickImportAsana,render:()=>a()(Ce,{searchInputPlaceholder:t.formatMessage({id:"asanaImportOption.search.placeholder",defaultMessage:"Search for a project…",description:"'Project' is an Asana term."}),noSearchResultsPlaceholder:t.formatMessage({id:"asanaImportOption.search.noResultsPlaceholder",defaultMessage:"No projects",description:"'Project' is an Asana term."}),analyticsName:"asana",sections:n,onComplete:t=>this.handleImportAsanaComplete(e,t)}),renderOrigin:({onClick:e})=>l().createElement(Z,p()({},r,{onClick:i?e:this.handleAsanaAuth}))})}}const De=(0,X.injectIntl)(Re);async function _e(e){const t=await L.getTrelloBoards(e,{});return"success"===t.type?t.data:(console.error(t.error),{boards:[]})}async function Le(e){const t=await L.getAsanaWorkspaces(e,{});if("success"===t.type){const{account:e}=t.data;return e?t.data:{workspaces:[],projects:{}}}return console.error(t.error),{workspaces:[],projects:{}}}async function Oe(e){try{const t=await L.getEvernoteNotebooks(e,{});if("success"===t.type){const{notebooks:e,userInfo:i}=t.data;return{notebooks:e,userInfo:i}}return console.error(t.error),{notebooks:[],userInfo:void 0}}catch(t){return console.error(t),{notebooks:[],userInfo:void 0}}}var Ue=i(95155);class Ne extends d.Z{constructor(...e){super(...e),n()(this,"storeTypes",{trelloRequestStore:I.Z,asanaRequestStore:I.Z,evernoteRequestStore:I.Z}),n()(this,"handleFileUploadClick",(async e=>{E.ays(this.environment,{name:e,from:this.props.analyticsFrom});const t=await async function(e){const{environment:t,pageStore:i,spaceStore:s,isTeamPage:a,spaceViewStore:o,uploadType:n}=e;let r;try{const e=await N.y({multiple:!0,accept:ie[n].join(",")});if(0===e.length)return;const l=1===e.length,d=await new Promise(((i,s)=>{N.IL({environment:t,files:e,bucket:"temporary",preventLimitFreeFileSize:!0,onBatchStart:()=>{W.j({message:l?oe.uploadingOneFile:oe.uploadingMultipleFilesNotStarted,interpolatedValues:{totalNumberOfFiles:e.length,percentComplete:0}})},onBatchProgress:({uploadedFiles:t,progressPercent:i})=>{W.j({message:l?oe.uploadingOneFile:oe.uploadingMultipleFilesInProgress,interpolatedValues:{numberOfUploadedFiles:t,totalNumberOfFiles:e.length,percentComplete:i}})},onBatchComplete:t=>{W.j({message:l?oe.uploadingOneFile:oe.uploadingMultipleFilesComplete,interpolatedValues:{totalNumberOfFiles:e.length,percentComplete:100}}),i(t)},onBatchError:s})}));let c,u;if(i&&i.isEmptyPage())e.length>1||i.isInsideCollection()?(c=i.id,u="AppendToBlock"):(c=i.id,u="ReplaceBlock");else{const i=U.create(t),n=$.default.formatMessage(oe.importTitle,{date:(0,R.Z)().format("ll")}),l=V.KE({environment:t,spaceStore:s,spaceViewStore:o,isPrivate:!a,prepend:!a,title:n,transaction:i});r=l,c=l.id,u=e.length>1?"AppendToBlock":"ReplaceBlock";const d=D.UZ();i.postSubmitCallbacks.push(d.resolve),U.commit({environment:t,transaction:i}),await d.promise}const m=d.map(((t,i)=>({fileURL:t,fileName:e[i].name})));let p=0;W.j({message:l?oe.importingOneFile:oe.importingMultipleFilesInProgress,interpolatedValues:{numberOfImportedFiles:p,totalNumberOfFiles:e.length}});for(const{fileURL:i,fileName:a}of m){if("confluence"===n){const e=L.importConfluenceExport(t,{fileURL:i,fileName:a,page:{id:c,spaceId:s.id}});for await(const t of e){if(t.error)throw t.error;t.value.isComplete||W.j(t.value.status)}}else if("AppendToBlock"===u){const{value:e}=await L.importFile(t,{fileURL:i,fileName:a,importType:u,block:{id:c,spaceId:s.id}}).next();if(e.error)throw e.error}else if("ReplaceBlock"===u){const{value:e}=await L.importFile(t,{fileURL:i,fileName:a,importType:u,block:{id:c,spaceId:s.id}}).next();if(e.error)throw e.error}p++,W.j({message:l?oe.importingOneFile:oe.importingMultipleFilesInProgress,interpolatedValues:{numberOfImportedFiles:p,totalNumberOfFiles:e.length}})}return W.x(),_.Z.createChildStore(s,{table:Y.iU,id:c})}catch(l){let e;throw W.x(),U.createAndCommit(t,(e=>{r&&H.Od({parent:s.getPagesStore(),remove:r,transaction:e})})),e=l.clientData&&l.clientData.type&&se.zP[l.clientData.type]?$.default.formatMessage(se.zP[l.clientData.type],l.clientData.messageValues):$.default.formatMessage(oe.importFailed),z.showErrorMessage(e),l}}({environment:this.environment,pageStore:this.props.pageStore,spaceStore:this.props.spaceStore,spaceViewStore:this.props.spaceViewStore,uploadType:e});t&&this.props.onComplete(t)}))}renderComponent(){if(!y.Z.state.online)return a()("div",{style:{...Ne.wrapStyle,fontSize:14,color:this.theme.mediumTextColor}},void 0,a()(X.FormattedMessage,{id:"importOptions.offlineErrorMessage",defaultMessage:"Please go online to import."}));const{analyticsFrom:e}=this.props;return this.renderRequests((t=>t?a()("div",{style:Ne.wrapStyle},void 0,this.renderOptions(t)):a()("div",{style:"onboarding"===e?{}:Ne.wrapStyle},void 0,a()(w.Z,{}))))}renderOptions(e){return a()("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gridAutoRows:"1fr",gap:"4px 16px",width:"100%"}},void 0,this.renderEvernoteImportOption(e.evernoteResult),this.renderTrelloImportOption(e.trelloResult),this.renderAsanaImportOption(e.asanaResult),this.renderConfluenceImportOption(),a()(Z,{title:a()(X.FormattedMessage,{id:"importOptions.textMarkdown.title",defaultMessage:"Text & Markdown",description:"Button title for importing plain text and/or Markdown content into Notion"}),icon:re.Z.importText,onClick:()=>this.handleFileUploadClick("markdown")}),a()(Z,{title:"CSV",icon:re.Z.importCSV,onClick:()=>this.handleFileUploadClick("csv")}),a()(Z,{title:"HTML",icon:re.Z.importHTML,onClick:()=>this.handleFileUploadClick("html")}),a()(Z,{title:"Word",logo:le.Z.images.import.wordPng,onClick:()=>this.handleFileUploadClick("docx")}),a()(Z,{title:"Google Docs",logo:le.Z.images.import.googleDocsPng,actionButton:this.renderHelpButtonToURL((0,xe.UY)("guides.importGoogleDocs")),onClick:()=>this.handleFileUploadClick("gdocs")}),a()(Z,{title:"Dropbox Paper",logo:le.Z.images.import.dropboxPaperPng,actionButton:this.renderHelpButtonToURL((0,xe.UY)("guides.importDropboxPaper")),onClick:()=>this.handleFileUploadClick("dropbox")}),a()(Z,{title:"Quip",logo:le.Z.images.import.quipPng,actionButton:this.renderHelpButtonToURL((0,xe.UY)("guides.importQuip")),onClick:()=>this.handleFileUploadClick("quip")}),a()(Z,{title:"Workflowy",logo:le.Z.images.import.workflowyPng,actionButton:this.renderHelpButtonToURL((0,xe.UY)("guides.importWorkflowy")),onClick:()=>this.handleFileUploadClick("workflowy")}))}renderRequests(e){return a()(P.Z,{request:this.environment,performRequest:_e,requestStore:this.stores.trelloRequestStore,render:(t,i)=>a()(P.Z,{request:this.environment,performRequest:Le,requestStore:this.stores.asanaRequestStore,render:(t,s)=>a()(P.Z,{request:this.environment,performRequest:Oe,requestStore:this.stores.evernoteRequestStore,render:(t,a)=>e(i&&s&&a?{trelloResult:i,asanaResult:s,evernoteResult:a}:void 0)})})})}renderTrelloImportOption(e){return a()(ke,{trelloResult:e,analyticsFrom:this.props.analyticsFrom,renderItemActionsButton:this.renderItemActionsButton,onComplete:this.props.onComplete,requestStore:this.stores.trelloRequestStore,spaceStore:this.props.spaceStore,spaceViewStore:this.props.spaceViewStore,userSettingsStore:this.props.userSettingsStore})}renderAsanaImportOption(e){return a()(De,{asanaResult:e,analyticsFrom:"onboarding",renderItemActionsButton:this.renderItemActionsButton,onComplete:this.props.onComplete,requestStore:this.stores.asanaRequestStore,spaceStore:this.props.spaceStore,spaceViewStore:this.props.spaceViewStore,userSettingsStore:this.props.userSettingsStore})}renderConfluenceImportOption(){if(this.environment,"on"===Ue.default.getGroup("confluence-import"))return a()(Z,{title:"Confluence",logo:le.Z.images.import.confluencePng,onClick:()=>this.handleFileUploadClick("confluence"),actionButton:this.renderHelpButtonToURL((0,xe.UY)("guides.importConfluence"))})}renderEvernoteImportOption(e){return a()(Be,{evernoteResult:e,analyticsFrom:"onboarding",renderItemActionsButton:this.renderItemActionsButton,defaultActionButton:this.renderHelpButtonToURL((0,xe.UY)("guides.importEvernote")),onComplete:this.props.onComplete,requestStore:this.stores.evernoteRequestStore,spaceStore:this.props.spaceStore,spaceViewStore:this.props.spaceViewStore,userSettingsStore:this.props.userSettingsStore})}renderHelpButtonToURL(e){return a()(F.Z,{renderTooltip:()=>a()(X.FormattedMessage,{id:"importOptions.helpButton.tooltip",defaultMessage:"Learn about how to import"}),render:t=>l().createElement(g.Z,p()({external:!0,href:e,style:{marginLeft:"auto"}},t),a()(h.Z,{icon:re.Z.help}))})}renderItemActionsButton(e){return a()(v.Z,{popupType:B.kQ.Popup,renderOrigin:e=>l().createElement(h.Z,p()({icon:re.Z.dots},e)),render:t=>{const i={key:"section",render:e=>l().createElement(x.Z,e),items:e.map((({name:e,action:i})=>({key:e,render:t=>l().createElement(f.Z,p()({},t,{title:e})),action:()=>{i(),t.close()}})))};return a()(k.ZP,{menuType:k.ZP.MenuType.Popup,width:200},void 0,a()(A.Z,{type:A.Z.Type.Vertical,initialFocus:void 0,sections:[i]}))}})}}n()(Ne,"wrapStyle",{display:"flex",alignItems:"center",justifyContent:"center",width:752,minHeight:240}),n()(Ne,"optionsColumnStyle",{width:240});const Ve=Ne;var We=i(15102),ze=i(42001);class He extends d.Z{constructor(...e){super(...e),n()(this,"handleModalDismiss",(()=>{u.Z.setState({open:!1})})),n()(this,"handleImportComplete",(e=>{u.Z.setState({open:!1}),Pe.navigateToBlock({environment:this.environment,store:e})}))}renderComponent(){const e=u.Z.state;return a()(We.Z,{open:e.open,innerStyle:He.wrapStyle,preventHideChildrenWhileOpening:!0,render:()=>a()(r.Fragment,{},void 0,a()("div",{style:He.modalTopbarWrapStyle},void 0,a()("div",{style:He.modalTopbarHeaderStyle},void 0,a()(X.FormattedMessage,{id:"importModal.importButton.label",defaultMessage:"Import"})),this.renderHelpButton()),a()("div",{},void 0,this.renderImportOptions(e))),onDismiss:this.handleModalDismiss})}renderHelpButton(){return a()(g.Z,{href:(0,xe.UY)("guides.import"),onClick:()=>E.Fsx(this.environment,{from:"import"}),external:!0},void 0,a()(ze.Z,{isSmall:!0,icon:re.Z.help,isGray:!0},void 0,a()(X.FormattedMessage,{id:"importModal.helpButton.label",defaultMessage:"Learn about importing"})))}renderImportOptions(e){const{currentBlockStore:t,currentSpaceStore:i,currentSpaceViewStore:s,currentUserSettingsStore:o}=c.default.state;if(t&&i&&s&&o)return a()(Ve,{pageStore:e.open&&e.pageStore?e.pageStore:t,spaceStore:i,spaceViewStore:s,userSettingsStore:o,analyticsFrom:"modal",onComplete:this.handleImportComplete,readOnlyCreditButton:!1})}}n()(He,"wrapStyle",{padding:"24px 36px 24px",minWidth:300}),n()(He,"modalTopbarWrapStyle",{display:"flex",alignItems:"center",marginTop:8,marginBottom:18}),n()(He,"modalTopbarHeaderStyle",{fontSize:24,lineHeight:1.2,marginBottom:6,fontWeight:b.Z.fontWeight.bold,marginRight:"auto"});const qe=He},67719:(e,t,i)=>{i.d(t,{Z:()=>c});var s=i(98135),a=i.n(s),o=(i(67294),i(66832)),n=i(15102),r=i(66722),l=i(31819);class d extends o.Z{renderComponent(){const{device:e}=this.environment;return e.isMobile?a()(r.ZP,{popupType:e.isMobile?r.ZP.PopupType.SlideUp:r.ZP.PopupType.Popup,open:this.props.open,render:this.props.renderContent,onDismiss:this.props.onDismiss,origin:this.props.origin}):a()(n.Z,{open:this.props.open,preventHideChildrenWhileOpening:!0,style:{alignItems:"flex-start"},innerStyle:this.getModalStyle(),onDismiss:this.props.onDismiss,render:this.props.renderContent,origin:this.props.origin,disableAnimation:this.props.disableAnimation})}getModalStyle(){const{modalStyle:e}=this.props;return{top:2*l.Z.getTopbarHeight(this.environment),borderRadius:3,overflow:"hidden",boxShadow:this.theme.largeBoxShadow,background:this.theme.contentBackground,...e}}}const c=d},93187:(e,t,i)=>{i.r(t),i.d(t,{default:()=>v});var s=i(98135),a=i.n(s),o=i(59713),n=i.n(o),r=(i(33948),i(67294),i(11302)),l=i(66832),d=i(66722),c=i(8646),u=i(42330),m=i(5366),p=i(23566),g=i(92251),h=i(90447);class f extends l.Z{constructor(...e){super(...e),n()(this,"renderModal",(()=>{const e=u.Z.state;if(e.isOpen)return a()(p.Z,{captureSelection:!0,restoreSelection:!this.environment.device.isMobile,autocompleteQuery:e.autocompleteQuery,targets:e.targets,onAutocompleteQueryChange:this.handleAutocompleteQueryChange,onAccept:this.handleAccept,onCancel:this.handleCancel,desktopWidth:(0,g.bq)()?330:220,isAddTo:e.isAddTo,isCreateIn:!1})})),n()(this,"completeMoveTransaction",(async e=>{const t=c.create(this.environment);await r.RL({environment:this.environment,value:e,transaction:t}),c.commit({environment:this.environment,transaction:t})})),n()(this,"handleAccept",(async e=>{const t=u.Z.state.isOpen&&u.Z.state.needsConfirmation,i=u.Z.state.isOpen&&u.Z.state.targets||[];let s=!0;t&&(s=await(0,h.vW)({environment:this.environment,moveToLocation:(0,h.WH)(e),movedItems:i})),s?this.completeMoveTransaction(e):this.handleCancel()})),n()(this,"handleCancel",(()=>{r.xv(this.environment)})),n()(this,"handleAutocompleteQueryChange",(e=>{u.Z.state.isOpen&&u.Z.setState({...u.Z.state,autocompleteQuery:e})}))}renderComponent(){const{device:e}=this.environment,t=u.Z.state;return a()(d.ZP,{popupType:e.isMobile?d.ZP.PopupType.SlideUp:d.ZP.PopupType.Popup,alignmentToOrigin:d.ZP.Alignment.Start,open:t.isOpen,render:this.renderModal,originRect:t.isOpen?t.rect:void 0,onDismiss:()=>r.xv(this.environment)})}}const v=(0,m.injectIntl)(f)},7811:(e,t,i)=>{i.r(t),i.d(t,{default:()=>q});var s=i(67154),a=i.n(s),o=i(98135),n=i.n(o),r=i(59713),l=i.n(r),d=(i(33948),i(67294)),c=i.n(d),u=i(66832),m=i(15102),p=i(89302),g=i(68989),h=i(6958),f=i(14694),v=i(592),y=i(82990),M=i(70442),S=i(8646),b=i(68932),T=i(50906),C=i(15282),Z=i(66722),w=i(54564),k=i(47307),A=i(27832),P=i(88632),I=i(56638),x=i(72693),F=i(14947),B=i(43250),E=i(3779),R=i(31792);class D extends u.Z{constructor(...e){super(...e),l()(this,"storeTypes",{mouseStore:R.Z,labelMouseStore:R.Z}),l()(this,"handleToggleClick",(()=>{const{section:e}=this.props;this.isOpen()?M.Jj(e.sectionName):M.GS(e.sectionName)})),l()(this,"handleMouseMove",(()=>this.stores.mouseStore.setState({...this.stores.mouseStore.state,mouseEntered:!0}))),l()(this,"handleMouseLeave",(()=>this.stores.mouseStore.setState({...this.stores.mouseStore.state,mouseEntered:!1}))),l()(this,"handleLabelMouseMove",(()=>{const{labelMouseStore:e}=this.stores;e.setState({...e.state,mouseEntered:!0})})),l()(this,"handleLabelMouseLeave",(()=>{const{labelMouseStore:e}=this.stores;e.setState({...e.state,mouseEntered:!1})}))}renderComponent(){const{renderSection:e}=this.props,t=!this.isOpen();return n()("div",{onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,style:this.getButtonContainerStyle()},void 0,this.renderLabel(),!t&&e())}renderLabel(){const e=!this.isOpen();return n()(f.Z,{isMobile:this.props.isMobile,disableMobileBorder:e,shouldShowMobileMarginBottom:e,style:this.getSectionSidebarItemStyle(),childrenStyle:{overflow:"visible"}},void 0,n()("div",{style:{display:"flex",alignItems:"center"}},void 0,n()(F.Z,{onClick:this.handleToggleClick,onMouseMove:this.handleLabelMouseMove,onMouseLeave:this.handleLabelMouseLeave,style:this.getLabelButtonStyle()},void 0,!Boolean(this.props.forceOpen)&&E.Z.triangle(this.getArrowStyle()),n()("span",{style:this.getToggleButtonStyle()},void 0,this.props.icon&&n()("span",{style:{paddingRight:4,display:"inline-block"}},void 0,this.props.icon),this.props.section.name))))}isOpen(){const{section:e,expandedSections:t}=this.props;return!!t&&-1!==t.indexOf(e.sectionName)}getSectionSidebarItemStyle(){return{minHeight:24,padding:0}}getSectionLabelStyle(){return{lineHeight:1,marginBottom:1,color:this.theme.sidebarTextColor,fontWeight:y.Z.fontWeight.semibold,marginLeft:9}}getMobileSectionLabelStyle(){return{lineHeight:1,color:this.theme.sidebarTextColor,fontWeight:y.Z.fontWeight.semibold,marginLeft:9}}getLabelButtonStyle(){return{display:"flex",alignItems:"center",paddingBottom:12,paddingTop:12,paddingLeft:25,...this.props.isMobile&&{marginBottom:8},width:"100%"}}getToggleButtonStyle(){const{labelMouseStore:e}=this.stores,{mouseEntered:t}=e.state;return{...this.props.isMobile?this.getMobileSectionLabelStyle():this.getSectionLabelStyle(),color:t?this.theme.regularTextColor:this.theme.mediumTextColor,transition:"color 100ms ease-out"}}getButtonContainerStyle(){const e=!this.isOpen(),{first:t}=this.props;return{...t?{borderTop:"1px solid ".concat(this.theme.regularDividerColor)}:{},borderBottom:"1px solid ".concat(this.theme.regularDividerColor),width:"100%",paddingBottom:e?0:10}}getArrowStyle(){return{width:"0.6875em",height:"0.6875em",transition:"transform 200ms ease-out",transform:"rotateZ(".concat(this.isOpen()?180:90,"deg)"),fill:this.theme.regularIconColor}}}const _=D;var L=i(26111),O=i(89101),U=i(5366),N=i(95155),V=i(4708),W=i(88923),z=i(50795);class H extends u.Z{constructor(...e){super(...e),l()(this,"storeTypes",{templateRecordCacheStore:z.$}),l()(this,"renderMobilePopup",(()=>{const e=I.Z.state;if(e.open)return n()(C.default,{title:n()(U.FormattedMessage,{defaultMessage:"Try this template",id:"pageTemplateModal.mobileModal.title"}),left:n()(C.CancelMenuText,{}),onClickLeft:this.handleDismiss,right:e.isLoading?n()(b.Z,{}):n()(U.FormattedMessage,{defaultMessage:"Use",id:"pageTemplateModal.mobileModal.useButton.label",description:"'Use' is utilized as a verb for a button label on the top right of a mobile menu, indicating to the user to click on the button to use the template they are previewing."}),onClickRight:this.handleUseTemplateClick,forceFullScreenSlideUp:!0},void 0,this.renderPreview(e))})),l()(this,"renderModal",(()=>{const e=I.Z.state;if(e.open)return n()("div",{style:H.modalStyle,className:B.fH},void 0,this.renderPreview(e),this.renderSidebar(e))})),l()(this,"handleDismiss",(async()=>{const{inMemoryRecordCache:e}=this.stores.templateRecordCacheStore.state;if(e.appliedTransaction){await this.showEditConfirmDialog()?this.accept(!0):this.close()}else this.close()})),l()(this,"handleUseTemplateClick",(async()=>{const{inMemoryRecordCache:e}=this.stores.templateRecordCacheStore.state;if(e.appliedTransaction){await this.showEditConfirmDialog()?this.accept(!0):this.accept(!1)}else this.accept(!1)})),l()(this,"handleItemClick",(async e=>{const{inMemoryRecordCache:t}=this.stores.templateRecordCacheStore.state;if(t.appliedTransaction){await this.showEditConfirmDialog()?this.accept(!0):this.setCurrentItem(e)}else this.setCurrentItem(e);T.n1D(this.environment,{name:e.name})}))}willMountOrUpdate(){const e=I.Z.state,{currentSpaceViewStore:t}=A.default.state;e.open&&t&&S.createAndCommit(this.environment,(i=>{M.GF({item:e.item,spaceViewStore:t,transaction:i})}))}renderComponent(){const{device:e}=this.environment,t=I.Z.state;return e.isMobile?n()(Z.GI,{open:t.open,render:this.renderMobilePopup,forceFullScreenSlideUp:!0,onDismiss:this.handleDismiss,popupType:e.isMobile?Z.GI.PopupType.SlideUp:Z.GI.PopupType.Popup}):n()(m.Z,{open:t.open,render:this.renderModal,onDismiss:this.handleDismiss})}renderSidebar(e){const{currentSpaceViewStore:t,currentSpaceStore:i}=A.default.state;if(!t||!i)return;const s=M.YH(),o=(0,g.dz)(this.props.intl),r="on"===N.default.getGroup("suggested-templates");return n()("div",{style:this.getSidebarStyle()},void 0,n()(x.Z,{isLarge:!0,onClick:this.handleUseTemplateClick,style:H.useTemplateButtonStyle,disabled:e.isLoading||!P.Z.state.online},void 0,e.isLoading&&n()(b.Z,{isWhite:!0,style:{marginRight:6}}),n()(U.FormattedMessage,{defaultMessage:"Use this template",id:"pageTemplateModal.useTemplateButton.label"})),n()(v.ZP,{style:H.scrollerStyle,type:v.xm.Y},void 0,r&&n()(_,{isMobile:!1,section:o,expandedSections:[...s||[],"suggested"],spaceStore:i,spaceViewStore:t,showAddPageButton:!1,first:!0,forceOpen:!0,icon:E.Z.sparkles({width:12}),renderSection:()=>n()(d.Fragment,{},void 0,o.items.map(((t,i)=>{const s=e.item.rootId===t.rootId,o=s?this.hoveredButtonStyle():{};return c().createElement(F.Z,a()({hovered:s,style:o,key:i},this.props,{onClick:()=>this.handleItemClick(t)}),this.renderSidebarItem(t))})))},"suggested"),e.sections.map(((o,l)=>n()(_,{isMobile:!1,section:o,expandedSections:s,spaceStore:i,spaceViewStore:t,showAddPageButton:!1,first:!r&&0===l,renderSection:()=>n()(d.Fragment,{},void 0,o.items.map(((t,i)=>{const s=e.item.rootId===t.rootId,o=s?this.hoveredButtonStyle():{};return c().createElement(F.Z,a()({hovered:s,style:o,key:i},this.props,{onClick:()=>this.handleItemClick(t)}),this.renderSidebarItem(t))})))},o.sectionName))),n()(F.Z,{onClick:()=>(0,L.navigateToExternalURL)({environment:this.environment,url:O._j.templates}),style:this.fixedLinkStyle(),hoveredStyle:{background:this.theme.sidebarHideButtonHoveredBackground},pressedStyle:{background:this.theme.sidebarHideButtonPressedBackground}},void 0,E.Z.typesRelation(this.fixedLinkIconStyle()),n()(U.FormattedMessage,{defaultMessage:"Browse more templates",id:"pageTemplateModal.goToFullTemplateGalleryButton.label"}))))}renderSidebarItem(e){return n()(f.Z,{style:{paddingLeft:30,fontWeight:y.Z.fontWeight.semibold},isMobile:!1,icon:n()("div",{style:this.getIconWrapStyle()},void 0,n()(h.Z,{size:20,emoji:e.emoji}))},void 0,e.name)}renderPreview(e){const{device:t}=this.environment;return n()(p.Z,{previewRootId:e.item.previewRootId,isFrontPage:!1,style:t.isMobile?H.previewMobileStyle:H.previewStyle,templateRecordCacheStore:this.stores.templateRecordCacheStore,disabled:!1},e.item.previewRootId)}accept(e){const{inMemoryRecordCache:t}=this.stores.templateRecordCacheStore.state,i=I.Z.state,{currentSpaceViewStore:s,currentSpaceStore:a,currentBlockStore:o}=A.default.state;if(i.open&&s&&a){const n=o&&o.isEmptyPage()?o:void 0,r=W.ZP.state.open&&W.ZP.state.target&&W.ZP.state.target.isEmptyPage()?W.ZP.state.target:void 0;M.RL({environment:this.environment,item:i.item,spaceStore:a,spaceViewStore:s,useRecordCache:e?t:void 0,initializeStore:i.createNewPage?void 0:n||r,isPrivate:i.isPrivate})}}close(){M.xv(this.environment),w.LZ()}setCurrentItem(e){I.Z.state.open&&M.zO({templateItem:e,currentUserId:this.environment.currentUser.id})}showEditConfirmDialog(){return new Promise(((e,t)=>{k.showDialog({message:n()(U.FormattedMessage,{id:"pageTemplateModal.modifiedTemplateDialog.prompt",defaultMessage:"It looks like you've modified the template. Would you like to save your edits?"}),showCancel:!1,keepFocus:!0,items:[{label:n()(U.FormattedMessage,{id:"pageTemplateModal.modifiedTemplateDialog.saveButton.label",defaultMessage:"Save edits"}),onAccept:()=>{e(!0)}},{label:n()(U.FormattedMessage,{id:"pageTemplateModal.modifiedTemplateDialog.discardEditsButton.label",defaultMessage:"Discard"}),color:"red",onAccept:()=>{e(!1)}}]})}))}getSidebarStyle(){return{width:H.sidebarWidth,color:this.theme.mediumTextColor,background:(0,V.GN)()&&"dark"===this.theme.mode?this.theme.popoverBackground:this.theme.sidebarBackground,display:"flex",flexDirection:"column",borderTopRightRadius:H.borderRadius,borderBottomRightRadius:H.borderRadius}}getIconWrapStyle(){return{color:this.theme.regularTextColor,position:"relative"}}hoveredButtonStyle(){return{color:this.theme.regularTextColor,fontWeight:y.Z.fontWeight.medium}}fixedLinkStyle(){return{padding:12,color:this.theme.mediumTextColor,background:(0,V.GN)()&&"dark"===this.theme.mode?this.theme.popoverBackground:this.theme.sidebarBackground,fontSize:13,fontWeight:y.Z.fontWeight.medium,display:"flex",alignItems:"center",position:"absolute",bottom:0,right:0,height:45,width:H.sidebarWidth,borderTop:"1px solid ".concat(this.theme.regularDividerColor)}}fixedLinkIconStyle(){return{width:12,height:12,marginLeft:8,marginRight:10,marginBottom:0,fill:this.theme.regularIconColor,fontWeight:y.Z.fontWeight.medium}}}l()(H,"sidebarWidth",240),l()(H,"borderRadius",3),l()(H,"modalStyle",{display:"flex",width:"85vw",height:"85vh",borderRadius:H.borderRadius}),l()(H,"useTemplateButtonStyle",{position:"relative",marginTop:16,marginLeft:20,marginRight:20,marginBottom:16,whiteSpace:"nowrap"}),l()(H,"previewStyle",{width:"calc(100% - ".concat(H.sidebarWidth,"px)"),flexGrow:1,flexShrink:1,display:"flex",flexDirection:"column",overflow:"hidden"}),l()(H,"previewMobileStyle",{width:"100%",flexGrow:1,flexShrink:1,display:"flex",flexDirection:"column",overflow:"hidden"}),l()(H,"scrollerStyle",{flexGrow:1,flexShrink:1,paddingBottom:44});const q=(0,U.injectIntl)(H)},23596:(e,t,i)=>{i.d(t,{Z:()=>ce});var s=i(67154),a=i.n(s),o=i(98135),n=i.n(o),r=i(59713),l=i.n(r),d=(i(33948),i(67294)),c=i.n(d),u=i(96486),m=i.n(u),p=i(27006),g=i(84210),h=i(61766),f=i(66832),v=i(28240),y=i(7567),M=i(79029),S=i(50906),b=i(47714),T=i(37235),C=i(14947),Z=i(41892),w=i(60442),k=i(46951),A=i(5366),P=i(66055),I=i(47966),x=i(62727),F=i(12318),B=i(3779),E=i(42001),R=i(1643),D=i(42115),_=i(21202),L=i(98459),O=i(81236),U=i(92251),N=i(29369),V=i(63143),W=i(74350),z=i(58879),H=i(89940),q=i(64215),G=i(60709),K=i(48762),j=i(46167),Y=i(71202),Q=i(25584),J=i(83071),X=i(43250),$=i(39336),ee=i(82902),te=i(93289),ie=i(28020);function se(e){const t=(0,z.Fy)(),[,,i]=(0,H.oR)(void 0,h.Z),s=(0,q.F)(),o=(0,z.O7)(),r=(0,H.VK)((()=>(0,R.y$)(o)),[o]);return c().createElement(j.Z,a()({},e.upsellEvents,{disablePopup:!r,popupType:t.isMobile?j.Z.PopupType.SlideUp:j.Z.PopupType.Popup,buttonPopupStore:i,renderOrigin:t=>c().createElement(K.Z,a()({},t,{focused:!1,title:n()(k.Z,{},void 0,n()(A.FormattedMessage,{id:"publicPermissionItem.expirationTime.label",defaultMessage:"Link expires"})," ",e.upgradeLabel),right:c().createElement(E.Z,a()({},t,{ignoreLocalHoverState:!0,style:{paddingLeft:0,paddingRight:0}}),n()(ae,{expirationTimestamp:e.permissionItem.expiration_timestamp}),B.Z.chevronDown({width:10,marginLeft:4,fill:s.lightIconColor}))})),placementToOrigin:G.Iw.Bottom,render:i=>{const s=[{key:"options",render:e=>c().createElement(J.Z,e),items:ne().map((t=>({key:t.type,action:()=>{oe(e,o,t.time),i.close()},render:e=>c().createElement(K.Z,a()({},e,{focused:e.focused,disabled:!1,title:t.title,caption:t.caption}))})))},{key:"custom",render:e=>c().createElement(J.Z,a()({},e,{topBorder:!0})),items:[{key:"custom",action:()=>{i.close()},render:(t,s)=>c().createElement(ee.Z,a()({},t,{renderOrigin:e=>c().createElement(K.Z,a()({},e,{disabled:!1,title:n()(A.FormattedMessage,{id:"publicPermissionItem.expiration.chooseDate",defaultMessage:"Choose date"})})),onFocus:s.onFocus,disableDefaultClick:!0,renderExtension:(t,s)=>n()("div",{style:{padding:"18px 14px 14px"}},void 0,c().createElement(te.Z,a()({},t,{firstDayOfWeek:ie.AK.state,value:e.permissionItem.expiration_timestamp||(new Date).getTime(),onChange:t=>{oe(e,o,t),s.close(),i.close()},disabledDays:{before:new Date}})))}))}]}];let r;return r=t.isMobile?{menuType:Y.ZP.MenuType.Modal,title:n()(A.FormattedMessage,{id:"publicPermissionsMenu.expiration.mobile.title",defaultMessage:"Expiration time"}),right:n()(A.FormattedMessage,{id:"publicPermissionsMenu.expiration.mobile.label",defaultMessage:"Done"}),onClickRight:i.close}:{menuType:Y.ZP.MenuType.Popup,width:264},c().createElement(Y.ZP,a()({className:X.Ip},r),n()(Q.Z,{type:Q.Z.Type.Vertical,initialFocus:void 0,sections:s}))}}))}function ae(e){return e.expirationTimestamp?n()(k.Z,{},void 0,(0,$.default)(e.expirationTimestamp).fromNow()):n()(A.FormattedMessage,{id:"publicPermissionItem.expiration.never",defaultMessage:"Never"})}function oe(e,t,i){const{permissionItem:s,onChange:a}=e;if("public_permission"!==s.type)return;if(void 0!==i&&i<=(new Date).getTime())return;const o=s,n=m().clone(o),r=i;n.expiration_timestamp=r,a(n),(0,S.n4j)(t,{expiration_time:r})}function ne(){const e=(new Date).getTime()+V.U6,t=(new Date).getTime()+V.A0,i=(new Date).getTime()+7*V.A0;return[{type:"never",time:void 0,title:n()(A.FormattedMessage,{id:"publicPermissionItem.expiration.never",defaultMessage:"Never"})},{type:"hour",time:e,title:n()(A.FormattedMessage,{id:"permissionItem.publicPermissionItem.expiration.hour",defaultMessage:"In an hour"}),caption:new Intl.DateTimeFormat(W.SP,{hour:"numeric",minute:"numeric"}).format(e)},{type:"day",time:t,title:n()(A.FormattedMessage,{id:"permissionItem.publicPermissionItem.expiration.day",defaultMessage:"In a day"}),caption:new Intl.DateTimeFormat(W.SP,{day:"numeric",month:"long",hour:"numeric",minute:"numeric"}).format(t)},{type:"week",time:i,title:n()(A.FormattedMessage,{id:"permissionItem.publicPermissionItem.expiration.week",defaultMessage:"In a week"}),caption:new Intl.DateTimeFormat(W.SP,{day:"numeric",month:"long",hour:"numeric",minute:"numeric"}).format(i)}]}var re=i(95477);let le;!function(e){e[e.Web=0]="Web",e[e.Workspace=1]="Workspace",e[e.User=2]="User"}(le||(le={}));class de extends f.Z{constructor(...e){super(...e),l()(this,"copiedLinkTimeout",void 0),l()(this,"copiedLink",new F.Z(!1)),l()(this,"showLinkOptions",new F.Z(!1)),l()(this,"storeTypes",{buttonPopupStore:h.Z}),l()(this,"renderLinkOptionsButton",(()=>n()(E.Z,{onClick:this.handleShowLinkOptionsClick,style:{...this.getPublicAccessOptionStyle()}},void 0,n()(k.Z,{isSmall:!0},void 0,n()(A.FormattedMessage,{defaultMessage:"Show link options",id:"pagePermissionItem.showLinkOptions.label"}),B.Z.chevronDown({width:9,height:9,marginLeft:4,display:"inline"}))))),l()(this,"renderAllowEditsTooltip",(()=>n()(w.Z,{caption:n()(A.FormattedMessage,{defaultMessage:"Any logged in Notion user can edit this page. Share the secret link with people you trust.",id:"pagePermissionItem.allowEdits.tooltip"}),imageHeight:120,imageWidth:240,imageURL:Z.Z.images.tooltips.share.allowEditingPng}))),l()(this,"renderAllowCommentsTooltip",(()=>n()(w.Z,{caption:n()(A.FormattedMessage,{defaultMessage:"Any logged in Notion user can comment on this page.",id:"pagePermissionItem.allowComments.tooltip"}),imageHeight:120,imageWidth:240,imageURL:Z.Z.images.tooltips.share.allowCommentsPng}))),l()(this,"renderAllowSearchEngineTooltip",(()=>n()(w.Z,{caption:n()(A.FormattedMessage,{defaultMessage:"If allowed, your public page may appear in search engines such as Google, but only if you or someone else links to it elsewhere on the web.",id:"pagePermissionItem.allowSearchEngine.tooltip"}),imageHeight:120,imageWidth:240,imageURL:Z.Z.images.tooltips.share.allowSearchEnginesPng}))),l()(this,"renderAllowSearchEngineUpgradeTooltip",(()=>n()(w.Z,{imageURL:Z.Z.images.tooltips.upsells.searchEngineIndexingPng,imageWidth:240,imageHeight:100,title:n()(A.FormattedMessage,{defaultMessage:"Upgrade for search engine indexing",id:"pagePermissionItem.searchEngineUpgradeTooltip.title"}),caption:n()(A.FormattedMessage,{defaultMessage:"Have your page appear in search engine results.",id:"pagePermissionItem.searchEngineUpgradeTooltip.caption"})}))),l()(this,"renderAllowDuplicateTooltip",(()=>n()(w.Z,{caption:n()(A.FormattedMessage,{defaultMessage:"If allowed, this will allow other people to duplicate your public page to their workspace.",id:"pagePermissionItem.allowDuplicateTemplate.tooltip"}),imageHeight:120,imageWidth:240,imageURL:Z.Z.images.tooltips.share.allowDuplicatePng}))),l()(this,"handleCopy",(()=>{const e=(0,g.Z)({store:this.props.currentBlockStore,preferPublicLink:!0,getSpaceDomain:()=>{var e,t;return null===(e=O.Z.getPublicSpaceData(this.environment,(0,L.CG)(null===(t=this.props.currentBlockStore.getValue())||void 0===t?void 0:t.space_id)))||void 0===e?void 0:e.domain}});P.RD({environment:this.environment,stringValue:e,copiedMessage:P.tq.copiedLinkToClipboard}),clearTimeout(this.copiedLinkTimeout),this.copiedLink.set(!0),this.copiedLinkTimeout=window.setTimeout((()=>{this.copiedLink.set(!1)}),1e3)})),l()(this,"handleShowLinkOptionsClick",(()=>{this.showLinkOptions.set(!0)})),l()(this,"handleToggleAllowEdits",(()=>{const{permissionItem:e}=this.props;"public_permission"===e.type&&this.props.onChange({...e,role:"read_and_write"===e.role?"comment_only":"read_and_write"})})),l()(this,"handleToggleAllowComments",(()=>{const{permissionItem:e}=this.props;"public_permission"===e.type&&this.props.onChange({...e,role:"comment_only"===e.role||"read_and_write"===e.role?"reader":"comment_only"})})),l()(this,"handleToggleSearchEngine",(()=>{const{permissionItem:e}=this.props;if("public_permission"===e.type){const t=e,i=Boolean(t.allow_search_engine_indexing),s=m().clone(t),a=!i;s.allow_search_engine_indexing=a,this.props.onChange(s),S.g0v(this.environment,{allow_search_engine_indexing:a})}})),l()(this,"handleToggleDuplicate",(()=>{const{permissionItem:e}=this.props;if("public_permission"===e.type){const t=e,i=void 0===t.allow_duplicate||!0===t.allow_duplicate,s=m().clone(t),a=!i;s.allow_duplicate=a,this.props.onChange(s),S.l7z(this.environment,{allow_duplicate:a})}})),l()(this,"handleRoleSelect",(e=>{const t=m().clone(this.props.permissionItem);t.role=e,this.props.onChange(t)})),l()(this,"handleSwitcherButtonClick",(()=>{"none"===this.role?this.handleRoleSelect(this.props.switcherRole||"editor"):this.handleRoleSelect("none")})),l()(this,"handleUserItemClick",(()=>{this.stores.buttonPopupStore.setState({...this.stores.buttonPopupStore.state,open:!0})}))}willMount(e){super.willMount(e),p.$D(e.permissionItem)&&"none"===e.permissionItem.role&&this.showLinkOptions.set(!0)}renderComponent(){const{device:e}=this.environment,{tooltip:t}=this.props,i=this.isUserItem()||!this.isPublicPermissionItem?this.handleUserItemClick:this.handleSwitcherButtonClick;return n()(d.Fragment,{},void 0,t?n()(T.Z,{delayThreshold:0,renderTooltip:()=>t,render:t=>c().createElement(C.Z,a()({disabled:this.props.disabled,mobileFeedback:e.isMobile,style:{...this.props.disabled?{cursor:"not-allowed"}:{}},onClick:i},t),this.renderMenuItem()),placement:T.Z.Placement.Left}):n()(C.Z,{disabled:this.props.disabled,style:{...this.props.disabled?{cursor:"not-allowed"}:{}},onClick:i},void 0,this.renderMenuItem()),this.renderPublicPermissionSettings())}renderMenuItem(){const{device:e}=this.environment,{isInherited:t,permissionItem:i}=this.props,s=this.isUserItem(),a=this.isBotPermissionItem(),o=!s&&!a,r=p.ix(i)||p.hV(i),l=!(this.isPublicPermissionItem||r&&"none"===this.role);return n()("div",{className:"notranslate",style:this.getMenuItemStyle(s)},void 0,n()("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,marginRight:e.isMobile?12:10}},void 0,this.props.icon),n()("div",{style:{marginRight:"auto",minWidth:0}},void 0,n()(k.Z,{style:{...!s&&{fontWeight:400}}},void 0,this.props.title),this.props.subtitle&&n()(k.Z,{isSmall:!0},void 0,this.props.subtitle),t&&this.renderInheritedRecordTitle()),n()("div",{style:{display:"flex",alignItems:"center",flexShrink:0,marginLeft:8}},void 0,this.isPublicPermissionItem?c().createElement(c().Fragment,null,l&&!r&&n()(y.Z,{role:this.role,table:_.iU,blockType:this.props.currentBlockStore.getType(),type:i.type,disabled:this.props.disabled,isSubscribed:this.props.isSubscribed,isUserPermission:this.permissionItemIsUserItem(i),onChange:this.handleRoleSelect,onUpgradeButtonClick:this.props.onUpgradeButtonClick,upgradeButtonName:this.props.upgradeButtonName,buttonPopupStore:this.stores.buttonPopupStore,buttonStyle:{marginRight:e.isMobile||s||a?-6:8,color:this.theme.mediumTextColor,fontSize:e.isMobile?14:12}}),o&&n()(b.Z,{on:"none"!==this.role,onClick:this.handleSwitcherButtonClick,disabled:this.props.disabled,isAndroid:e.isAndroid})):n()(y.Z,{role:this.role,table:_.iU,blockType:this.props.currentBlockStore.getType(),type:i.type,disabled:this.props.disabled,isSubscribed:this.props.isSubscribed,isUserPermission:this.permissionItemIsUserItem(i),onChange:this.handleRoleSelect,onUpgradeButtonClick:this.props.onUpgradeButtonClick,upgradeButtonName:this.props.upgradeButtonName,buttonPopupStore:this.stores.buttonPopupStore,buttonStyle:{marginRight:-6,color:this.theme.mediumTextColor,fontSize:e.isMobile?14:12},showPermissionOverrideWarning:this.props.isInherited})))}getPublicPermissionSettingsHeight(e){const{device:t}=this.environment;return e?0:t.isMobile?this.showLinkOptions.get()?240:94:this.showLinkOptions.get()?200:88}renderPublicPermissionSettings(){const{device:e}=this.environment,{permissionItem:t}=this.props;if(p.$D(t)){const i="none"===this.role;return n()("div",{style:{maxHeight:this.getPublicPermissionSettingsHeight(i),transition:"max-height ease 200ms, padding-bottom ease 200ms",overflow:"hidden",paddingBottom:i?0:this.showLinkOptions.get()?12:8}},void 0,this.renderPageLinkButton(),this.showLinkOptions.get()?c().createElement(c().Fragment,null,c().createElement(c().Fragment,null,"production"!==re.default.env&&n()(D.Z,{alwaysAllowClick:Boolean(t.expiration_timestamp),onClick:()=>{},analyticsName:"public_permission_item_expiration",requireUpgradeToTier:!(0,R.y$)(this.environment)&&(0,R.M9)(this.environment),tooltipPlacement:T.Z.Placement.Left,renderTooltip:this.renderAllowSearchEngineTooltip,renderUpgradeTooltip:this.renderAllowSearchEngineUpgradeTooltip,onUpgradeClick:this.props.onUpgradeButtonClick,render:(e,i)=>n()(se,{upsellEvents:e,upgradeLabel:i,permissionItem:t,onChange:e=>{this.props.onChange(e)}})}),n()(T.Z,{placement:T.Z.Placement.Left,renderTooltip:this.renderAllowEditsTooltip,render:i=>c().createElement(C.Z,a()({onClick:this.handleToggleAllowEdits,style:this.getPublicAccessOptionStyle(),disabled:this.props.disabled},i),n()(k.Z,{style:this.getPublicAccessOptionLabelStyle(this.props.disabled)},void 0,n()(A.FormattedMessage,{defaultMessage:"Allow editing",id:"pagePermissionItem.allowEdits.setting"})),n()(b.Z,{on:"read_and_write"===t.role,onClick:this.handleToggleAllowEdits,disabled:this.props.disabled,isAndroid:e.isAndroid}))}),n()(T.Z,{placement:T.Z.Placement.Left,renderTooltip:this.renderAllowCommentsTooltip,render:t=>c().createElement(C.Z,a()({onClick:this.handleToggleAllowComments,style:this.getPublicAccessOptionStyle(),disabled:this.props.disabled},t),n()(k.Z,{style:this.getPublicAccessOptionLabelStyle(this.props.disabled)},void 0,n()(A.FormattedMessage,{defaultMessage:"Allow comments",id:"pagePermissionItem.allowComments.setting"})),n()(b.Z,{on:"comment_only"===this.role||"read_and_write"===this.role,onClick:this.handleToggleAllowComments,disabled:this.props.disabled,isAndroid:e.isAndroid}))})),n()(T.Z,{placement:T.Z.Placement.Left,renderTooltip:this.renderAllowDuplicateTooltip,render:i=>c().createElement(C.Z,a()({onClick:this.handleToggleDuplicate,disabled:this.props.disabled,style:this.getPublicAccessOptionStyle()},i),n()(k.Z,{style:this.getPublicAccessOptionLabelStyle(this.props.disabled)},void 0,n()(A.FormattedMessage,{defaultMessage:"Allow duplicate as template",id:"pagePermissionItem.allowDuplicateTemplate.setting"})),n()(b.Z,{on:!1!==t.allow_duplicate,onClick:this.handleToggleDuplicate,disabled:this.props.disabled,isAndroid:e.isAndroid}))}),n()(D.Z,{requireUpgradeToTier:!(0,R.f3)(this.environment)&&(0,R.M9)(this.environment),alwaysAllowClick:t.allow_search_engine_indexing,analyticsName:"allow_search_engine_indexing",onClick:this.handleToggleSearchEngine,onUpgradeClick:this.props.onUpgradeButtonClick,tooltipPlacement:T.Z.Placement.Left,renderTooltip:this.renderAllowSearchEngineTooltip,renderUpgradeTooltip:this.renderAllowSearchEngineUpgradeTooltip,render:(i,s)=>c().createElement(C.Z,a()({style:this.getPublicAccessOptionStyle(),disabled:this.props.disabled},i),n()(k.Z,{style:this.getPublicAccessOptionLabelStyle(this.props.disabled)},void 0,n()(A.FormattedMessage,{defaultMessage:"Search engine indexing",id:"pagePermissionItem.allowSearchEngines.setting"})," ",s),n()(b.Z,{on:Boolean(t.allow_search_engine_indexing),onClick:this.handleToggleSearchEngine,disabled:this.props.disabled||Boolean(s),isAndroid:e.isAndroid}))})):this.renderLinkOptionsButton())}}renderPageLinkButton(){const e=(0,g.Z)({store:this.props.currentBlockStore,preferPublicLink:!0,getSpaceDomain:()=>{var e,t;return null===(e=O.Z.getPublicSpaceData(this.environment,(0,L.CG)(null===(t=this.props.currentBlockStore.getValue())||void 0===t?void 0:t.space_id)))||void 0===e?void 0:e.domain}});return n()("div",{style:{...this.getPublicAccessOptionStyle(),height:"auto"}},void 0,n()("div",{style:{flex:1}},void 0,n()("div",{style:{display:"flex",padding:"1px 0"}},void 0,n()(x.Z,{value:e,disabled:!0,style:{flex:1,borderTopRightRadius:0,borderBottomRightRadius:0,paddingRight:0}}),n()(I.Z,{onClick:()=>this.handleCopy(),style:{height:28,borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeft:"none"}},void 0,this.copiedLink.get()?n()(A.FormattedMessage,{id:"pageShareMenu.copiedLinkButton.label",defaultMessage:"✓ Copied"}):n()(A.FormattedMessage,{id:"pageShareMenu.copyMaybePublicLinkButton.label",defaultMessage:"Copy"})))))}renderInheritedRecordTitle(){const e=this.props.store,t=e.table===_.iU?(0,g.Z)({store:e,fullyQualified:!1}):void 0,i=e.table===N.e0?()=>{e.table===N.e0&&(0,U.RF)({teamId:e.id})}:void 0;return n()(k.Z,{isSmall:!0,style:{lineHeight:1.4}},void 0,n()(A.FormattedMessage,{defaultMessage:"Based on {linkBoxWithPageTitle}",description:"This text tells the user that this permission setting for the page is inherited from the parent page or team.",id:"pagePermissionItem.inheritedRecordPermissions.setting",values:{linkBoxWithPageTitle:n()(v.Z,{underline:!0,inline:!0,href:t,onClick:i},void 0,n()(M.Z,{store:e,style:{display:"inline"}}))}}))}permissionItemIsUserItem(e){const t=this.environment.currentUser.id;return"user_permission"===e.type&&e.user_id===t}isUserItem(){return this.props.format===le.User}get role(){const{permissionItem:e,isInherited:t,store:i,currentBlockStore:s}=this.props;if("content_only_editor"===e.role&&t){const t=s.getParentCollectionStore(),a=null==t?void 0:t.getParentBlockStore();return a&&a.table===i.table&&a.id===i.id?e.role:"read_and_write"}return e.role}get isPublicPermissionItem(){return p.$D(this.props.permissionItem)}isBotPermissionItem(){return p.FB(this.props.permissionItem)}getMenuItemStyle(e){const{WindowSizeStore:t}=this.environment;return{display:"flex",alignItems:"center",minHeight:52,paddingTop:8,paddingBottom:8,paddingLeft:t.getSafePaddingLeftCSS(14),paddingRight:t.getSafePaddingRightCSS(14)}}getPublicAccessOptionStyle(){const{device:e,WindowSizeStore:t}=this.environment;let i;return i=e.isMobile?36:30,{display:"flex",alignItems:"center",width:"100%",height:i,paddingTop:5,paddingBottom:5,paddingLeft:t.getSafePaddingLeftCSS(14),paddingRight:t.getSafePaddingRightCSS(14)}}getPublicAccessOptionLabelStyle(e){return{marginRight:"auto",opacity:e?.6:1}}}l()(de,"Format",le),l()(de,"iconSize",32);const ce=de},26177:(e,t,i)=>{i.r(t),i.d(t,{default:()=>oe});var s=i(67154),a=i.n(s),o=i(98135),n=i.n(o),r=i(59713),l=i.n(r),d=(i(33948),i(73210),i(67294)),c=i.n(d),u=i(3779),m=i(66832),p=i(7567),g=i(47307),h=i(95209),f=i(29677),v=i(8848),y=i(82990),M=i(37235),S=i(7765),b=i(25584),T=i(83071),C=i(97680),Z=i(48762),w=i(71202),k=i(16328),A=i(47082),P=i(1643),I=i(21325),x=i(78291),F=i(72693),B=i(43250),E=i(33728),R=i(83182),D=i(91487),_=i(19889),L=i(27006),O=i(15070),U=i(49481),N=i(27832),V=i(75246),W=i(5366);class z extends m.Z{renderComponent(){const{bot:e}=this.props,{currentUserRootStore:t}=N.default.state;if(!e||!t)return;const i=c().createElement(c().Fragment,null,n()("span",{},void 0,(0,O.Mh)(e)),e.parent_table===V.bx&&n()("span",{style:{...y.Z.textOverflowStyle,color:this.theme.mediumTextColor}},void 0," · ",n()(W.FormattedMessage,{id:"botMenuItem.spaceBot.label",defaultMessage:"Shared with workspace"})));return c().createElement(Z.Z,a()({},this.props,{icon:n()(U.Z,{botValue:e}),title:i}))}}l()(z,"contextTypes",w.ff);const H=z;var q=i(15282),G=i(67669),K=i(93678),j=i(60969),Y=i(19757),Q=i(33665),J=i(16639),X=i(97880),$=i(40039),ee=i(65598),te=i(21202),ie=i(75472),se=i(1903);class ae extends m.Z{constructor(...e){super(...e),l()(this,"storeTypes",{permissionsInviteStore:se.Z}),l()(this,"handleTrialClick",(()=>{K.y(this.environment,{from:this.props.upgradeButtonName,for:"team_free"}),this.props.onUpgradeButtonClick&&this.props.onUpgradeButtonClick()})),l()(this,"handleUpgradeClick",(()=>{K.y(this.environment,{from:this.props.upgradeButtonName,for:"team"}),this.props.onUpgradeButtonClick&&this.props.onUpgradeButtonClick()})),l()(this,"handleInviteClick",(async()=>{var e,t;const{store:i}=this.props,{permissionsInviteStore:s}=this.stores;await h.z({environment:this.environment,store:i,permissionsInviteStore:s,onInviteStart:this.props.onInviteClick}),null===(e=(t=this.props).onInviteComplete)||void 0===e||e.call(t)})),l()(this,"handleModalDismiss",(async()=>{const{permissionsInviteStore:e}=this.stores;return e.setState({...e.state,modalOpen:await this.attemptCloseInviteModal()})})),l()(this,"handleInputChange",(e=>{if(!this.stores.permissionsInviteStore.state.isInviteTargetsEmpty&&(0,f.ow)(this.stores.permissionsInviteStore.state)){const t=e.target.value;this.stores.permissionsInviteStore.setState({...this.stores.permissionsInviteStore.state,tokenQuery:t})}else{const t=e.target.value,{extractedEmails:i,newInputValue:s}=(0,E.zI)(t),a=i.map((e=>({type:"newUser",value:{email:e}}))).filter((e=>!(0,ie.Nd)({target:e,permissionsInviteStore:this.stores.permissionsInviteStore}))),o=[...this.stores.permissionsInviteStore.state.inviteTargets,...a];o.length>0?this.stores.permissionsInviteStore.setState({...this.stores.permissionsInviteStore.state,inviteTargets:o,isInviteTargetsEmpty:!1,tokenQuery:s}):this.stores.permissionsInviteStore.setState({...this.stores.permissionsInviteStore.state,inviteTargets:[],isInviteTargetsEmpty:!0,tokenQuery:s})}})),l()(this,"handleClickRemoveToken",(e=>{const{permissionsInviteStore:t}=this.stores;if(!t.state.isInviteTargetsEmpty)if((0,f.ow)(t.state))if((0,f.ow)(t.state)){const i=t.state.inviteTargets.filter((t=>t!==e));0===i.length?t.setState({...t.state,inviteTargets:[],inviteRole:this.getDefaultRoleForNonBot(),isInviteTargetsEmpty:!0}):t.setState({...t.state,inviteTargets:i})}else(0,X.t1)(t.state);else{const i=t.state.inviteTargets.filter((t=>t!==e));0===i.length?t.setState({...t.state,inviteTargets:[],inviteRole:this.getDefaultRoleForNonBot(),isInviteTargetsEmpty:!0}):t.setState({...t.state,inviteTargets:i})}}))}async willMount(){await I.bi(this.environment)}renderComponent(){const{permissionsInviteStore:e}=this.stores,{tokenQuery:t}=e.state,i=(0,ee.NZ)(this.props.store),s=(0,ee.NZ)(this.props.store),o=e.state.inviteTargets.map((t=>{const i="newUser"===t.type?t.value.email:"".concat(t.type,"-").concat(t.value.id);return n()(D.Z,{target:t,onClickRemove:this.handleClickRemoveToken,role:e.state.inviteRole},i)})),{device:r}=this.environment,l=(0,ee.Mm)(this.props.store)?this.props.intl.formatMessage({id:"inviteUserModal.searchInput.placeholder",defaultMessage:"Search name or emails"}):this.props.intl.formatMessage({id:"permissionsInvite.searchInput.placeholder",defaultMessage:"Search emails, names, or groups"}),d=n()(A.Z,{focus:this.stores.permissionsInviteStore.state.isFocused,focusInitial:r.isMobile,focusAfterAnimation:!0,format:A.Z.Format.Share,value:t,onChange:this.handleInputChange,type:"email",tokens:o,disabled:!1,placeholder:l,onRemoveLastToken:()=>{const e={...this.stores.permissionsInviteStore.state};e.inviteTargets=e.inviteTargets.slice(0,-1),0===e.inviteTargets.length&&(e.isInviteTargetsEmpty=!0,e.inviteRole=this.getDefaultRoleForNonBot()),this.stores.permissionsInviteStore.setState(e)},right:!r.isMobile&&this.renderDesktopInputRightInner(),inputAndTokenWrapRightStyle:{paddingTop:this.environment.device.isMobile?0:6,paddingBottom:this.environment.device.isMobile?0:6},onEmptySubmit:this.handleInviteClick,dontShowBorderBottom:r.isAndroid}),m={request:t,performRequest:e=>(0,ie.jL)({query:e,sectionLimit:10,shouldShowBots:s,shouldShowGroups:i,membersOnly:this.props.membersOnly,environment:this.environment,intl:this.props.intl}),render:(e,s,o)=>{if(e)return n()(j.l,{loading:!o},void 0,n()(k.Z,{title:n()(W.FormattedMessage,{id:"inviteUserModal.searchInput.errorMessage",defaultMessage:"Something went wrong"})}));const{inviteUsers:r,inviteBots:l,inviteGroups:d}=(0,ie.oP)({usersToInvite:s,permissionsInviteStore:this.stores.permissionsInviteStore,targetStore:this.props.store}),{data:m}=x.default.state,p=r.map((e=>({key:"newUser"===e.type?e.value.email:e.value.id,render:t=>{const i=m?P.uF(m):[],s="existingUser"===e.type&&i.find((t=>t.userId===e.value.id));let o;return s&&(0,L.zz)(s.role)?o=n()(M.Z,{renderTooltip:()=>n()(W.FormattedMessage,{id:"inviteUserModal.userRole.adminBadge.tooltip",defaultMessage:"This person is an admin in this workspace"}),render:e=>c().createElement("div",a()({style:this.getBadgeStyle()},e),n()(W.FormattedMessage,{id:"inviteUserModal.userRole.adminBadge.label",defaultMessage:"Admin"}))}):s&&(0,L.J5)(s.role)?o=n()(M.Z,{renderTooltip:()=>n()(W.FormattedMessage,{id:"inviteUserModal.userRole.memberBadge.tooltip",defaultMessage:"This person is a member in this workspace"}),render:e=>c().createElement("div",a()({style:this.getBadgeStyle()},e),n()(W.FormattedMessage,{id:"inviteUserModal.userRole.memberBadge.label",defaultMessage:"Member"}))}):s&&(o=n()(M.Z,{renderTooltip:()=>n()(W.FormattedMessage,{id:"inviteUserModal.userRole.guest.tooltip",defaultMessage:"This person is a guest in this workspace"}),render:e=>c().createElement("div",a()({style:this.getBadgeStyle()},e),n()(W.FormattedMessage,{id:"inviteUserModal.userRole.guestBadge.label",defaultMessage:"Guest"}))})),"existingUser"===e.type?c().createElement(C.Z,a()({},t,{user:e.value,right:o})):c().createElement(Z.Z,a()({},t,{icon:u.Z.mail({width:ae.avatarSize,height:ae.avatarSize}),right:o,title:e.value.email.trim()}))},action:()=>{const{permissionsInviteStore:t}=this.stores;!t.state.isInviteTargetsEmpty&&(0,f.ow)(t.state)||t.setState({...t.state,inviteTargets:[...t.state.inviteTargets,e],isInviteTargetsEmpty:!1,tokenQuery:""})}}))),{currentUserRootStore:g}=N.default.state,h=l.map((e=>{const{value:t}=e;if(g&&(t.parent_table!==_.KJ||t.parent_id===g.id))return{key:t.id,render:e=>c().createElement(H,a()({},e,{bot:t})),action:()=>{const{permissionsInviteStore:t}=this.stores;(t.state.isInviteTargetsEmpty||(0,f.ow)(t.state))&&(t.state.table===te.iU?this.stores.permissionsInviteStore.setState({...t.state,inviteTargets:[...t.state.inviteTargets,e],inviteRole:void 0,isInviteTargetsEmpty:!1,tokenQuery:"",table:t.state.table}):t.state.table===V.bx?this.stores.permissionsInviteStore.setState({...t.state,inviteTargets:[...t.state.inviteTargets,e],inviteRole:this.getDefaultRoleForSpaceBot(),isInviteTargetsEmpty:!1,tokenQuery:"",table:t.state.table}):(0,X.t1)(t.state.table))}}})).filter(X.$K),{currentSpaceStore:v}=N.default.state,S=d.map((e=>{const{value:t}=e,i=(0,J.k)({intl:this.props.intl,group:t}),s=v&&t.icon?{pointer:{table:v.table,id:v.id},icon:t.icon}:void 0;return{key:t.id,render:e=>c().createElement(Z.Z,a()({},e,{icon:n()($.Z,{disabled:!0,size:22,icon:s,isEmptyPage:!1,title:i}),title:i})),action:()=>{const{permissionsInviteStore:t}=this.stores;!t.state.isInviteTargetsEmpty&&(0,f.ow)(t.state)||t.setState({...t.state,inviteTargets:[...t.state.inviteTargets,e],isInviteTargetsEmpty:!1,tokenQuery:""})}}})),w=[],{permissionsInviteStore:A}=this.stores;if(p.length>0&&(A.state.isInviteTargetsEmpty||!(0,f.ow)(A.state))&&w.push({key:"user results",render:e=>c().createElement(j.l,a()({},e,{loading:!o})),items:p}),h.length>0&&(A.state.isInviteTargetsEmpty||(0,f.ow)(A.state))&&w.push({key:"bot results",render:e=>c().createElement(T.Z,a()({},e,{title:this.props.intl.formatMessage({id:"permissionsInvite.integration.select.message",defaultMessage:"Select an integration"}),loading:!o})),items:h}),i&&S.length>0&&(A.state.isInviteTargetsEmpty||!(0,f.ow)(A.state))&&w.push({key:"group results",render:e=>c().createElement(T.Z,a()({},e,{title:n()(W.FormattedMessage,{id:"inviteUserModal.searchDropdown.selectGroupTitle",defaultMessage:"Select a group"}),loading:!o})),items:S}),0===w.length&&(A.state.isInviteTargetsEmpty||!(0,f.ow)(A.state))){const e=(0,E.H3)(A.state.tokenQuery);if(e){const t={type:"newUser",value:{email:e}},i=(0,ie.Nd)({target:t,permissionsInviteStore:A});if(!i)return;if(i)return n()(j.l,{loading:!o},void 0,n()(k.Z,{title:n()(W.FormattedMessage,{id:"inviteUserModal.userAlreadyInvitedMessage",defaultMessage:"Already inviting {user}.",values:{user:n()("span",{style:{fontWeight:y.Z.fontWeight.bold}},void 0,(0,ie.DF)({intl:this.props.intl,target:i}))}})}));const a=(s&&s.inviteUsers||[]).find((t=>"existingUser"===t.type&&t.value.email===e));if(a&&"existingUser"===a.type&&(0,ie.Zp)({store:this.props.store,target:a}))return n()(j.l,{loading:!o},void 0,n()(k.Z,{title:n()(W.FormattedMessage,{id:"inviteUserModal.userAlreadyHasPermissionMessage",defaultMessage:"{user} already has permission.",values:{user:n()("span",{style:{fontWeight:y.Z.fontWeight.bold}},void 0,(0,_.Nz)(this.props.intl,a.value))}})}))}return n()(j.l,{loading:!o},void 0,n()(k.Z,{title:n()(W.FormattedMessage,{id:"inviteUserModal.searchPersonDropdown.noSearchResultsMessage",defaultMessage:"Type or paste in emails above, separated by commas."})}))}return n()(b.Z,{type:b.Z.Type.Vertical,initialFocus:t.length>0?0:void 0,sections:w})}};let p;return p=r.isMobile?{menuType:w.ZP.MenuType.Modal,title:(0,ee.Mm)(this.props.store)?n()(W.FormattedMessage,{id:"inviteUserModal.addMemberMenu.title",defaultMessage:"Add members"}):n()(W.FormattedMessage,{id:"inviteUserModal.invitePersonMenu.title",defaultMessage:"Invite a person"}),right:n()("div",{style:{color:v.ZP.blue}},void 0,n()(W.FormattedMessage,{id:"inviteUserModal.mobile.inviteButton.label",defaultMessage:"Invite"})),left:n()(q.CancelMenuText,{}),onClickLeft:this.handleModalDismiss,onClickRight:this.handleInviteClick,header:d}:{menuType:w.ZP.MenuType.Popup,width:480,height:"60vh",header:d,tokenInputHeader:!0,footer:this.renderHelpButton(),disableScroller:!1},n()("div",{onFocus:()=>{e.setState({...e.state,isFocused:!0})},onBlur:()=>{e.setState({...e.state,isFocused:!1})}},void 0,c().createElement(w.ZP,a()({},p,{className:B.FJ}),r.isMobile&&n()(T.Z,{title:n()(W.FormattedMessage,{id:"inviteUserModal.permissionLevel.title",defaultMessage:"Permission level"})},void 0,this.renderDesktopInputRightInnerSelect()),n()("div",{},void 0,c().createElement(S.Z,m)),r.isMobile&&this.renderHelpButton()))}renderHelpButton(){return n()(T.Z,{topBorder:!0,disableDesktopPadding:!0},void 0,n()(R.Z,{title:n()(W.FormattedMessage,{id:"inviteUserModal.helpButton.caption",defaultMessage:"Learn how to invite people and set permissions"}),href:(0,Q.UY)("guides.invitePerson"),analyticsFrom:"invite_person"}))}renderDesktopInputRightInner(){return n()("div",{style:{marginLeft:8,display:"flex",alignItems:"center"}},void 0,this.renderDesktopInputRightInnerSelect(),this.renderDesktopInputRightInnerButton())}renderDesktopInputRightInnerButton(){const{disabled:e}=this.props,{permissionsInviteStore:t}=this.stores,i=t.state.inviteTargets,s=i.filter((({type:e})=>"newUser"===e)).map((({value:e})=>e.email)),o=i.filter((({type:e})=>"existingUser"===e)).map((({value:e})=>e.id)),r=e||(0,G.T0)({environment:this.environment,userIds:[...s,...o],includesOwner:!0});return n()(M.Z,{textWrap:!0,alignment:Y.v2.Center,disableTooltip:!r,renderTooltip:()=>n()(c().Fragment,{},void 0,n()("div",{style:{width:280}},void 0,n()(W.FormattedMessage,{id:"inviteUserButton.modalTooltip.guestLimitLine1",defaultMessage:"Your personal plan allows up to 5 unique guests."})),n()("div",{},void 0,n()(W.FormattedMessage,{id:"inviteUserButton.modalTooltip.guestLimitLine2",defaultMessage:"Upgrade to go unlimited."}))),render:e=>c().createElement(F.Z,a()({style:{minWidth:ae.inviteButtonWidth},onClick:r?this.handleUpgradeClick:this.handleInviteClick},e),n()(W.FormattedMessage,r?{id:"inviteUserModal.inviteButton.upgradeLabel",defaultMessage:"Upgrade"}:{id:"inviteUserModal.inviteButton.label",defaultMessage:"Invite"}))})}renderDesktopInputRightInnerSelect(){const{device:e}=this.environment,{isSubscribed:t,store:i}=this.props,{permissionsInviteStore:s}=this.stores;if(s.state.isInviteTargetsEmpty||!(0,f.ow)(s.state))return n()(p.Z,{role:s.state.inviteRole,table:s.state.table,type:"user_permission",blockType:(0,ee.NZ)(i)?i.getType():void 0,isSubscribed:t,isInvite:!0,onUpgradeButtonClick:this.props.onUpgradeButtonClick,upgradeButtonName:this.props.upgradeButtonName,buttonStyle:{display:"flex",whiteSpace:"nowrap",marginTop:e.isMobile?4:0,color:v.ZP.uiGray},isMenuItem:e.isMobile,onChange:e=>{!s.state.isInviteTargetsEmpty&&(0,f.ow)(s.state)||s.setState({...s.state,inviteRole:e})}})}async attemptCloseInviteModal(){const{permissionsInviteStore:e}=this.stores,t=n()(W.FormattedMessage,{id:"permissionsInvite.closeInviteDialog.confirmationMessage",defaultMessage:"Your changes have not been saved. Discard changes?"}),i=n()(W.FormattedMessage,{id:"permissionsInvite.closeInviteDialog.confirmationButton.label",defaultMessage:"Yes",description:"Label for button that appears below the question, 'Your changes have not been saved. Discard changes?' to confirm that the user would like to discard the changes."}),s=n()(W.FormattedMessage,{id:"permissionsInvite.closeInviteDialog.cancelButton.label",defaultMessage:"Cancel",description:"Label for button that appears below the question, 'Your changes have not been saved. Discard changes?' to confirm that the user does not want to discard the changes."});if(e.state.inviteTargets.length>0){return!(await g.confirmUserAction({message:t,acceptLabel:i,cancelLabel:s}))}return!1}getDefaultRoleForNonBot(){const{store:e,isSubscribed:t}=this.props;return(0,ee.Mm)(e)?t?"read_and_write":"editor":P.lw(this.environment)?"editor":"read_and_write"}getDefaultRoleForSpaceBot(){return"editor"}getBadgeStyle(){const{device:e}=this.environment;return{display:"inline-flex",height:18,textTransform:"uppercase",fontSize:10,marginBottom:2,fontWeight:y.Z.fontWeight.medium,letterSpacing:1,color:v.ZP.uiLightGray,border:"1px solid ".concat(v.ZP.uiLightGray),minWidth:ae.inviteButtonWidth,alignItems:"center",justifyContent:"center",paddingTop:e.isAndroid?2:1,paddingBottom:1,paddingLeft:3,paddingRight:3,borderRadius:3}}}l()(ae,"avatarSize",24),l()(ae,"inviteButtonWidth",70);const oe=(0,W.injectIntl)(ae)},22771:(e,t,i)=>{i.r(t),i.d(t,{default:()=>R});var s=i(98135),a=i.n(s),o=i(67154),n=i.n(o),r=i(59713),l=i.n(r),d=(i(33948),i(67294)),c=i.n(d),u=i(66832),m=i(50906),p=i(37235),g=i(1643),h=i(21325),f=i(78291),v=i(72693),y=i(5366),M=i(93678),S=i(60442),b=i(41892),T=i(67719),C=i(14947),Z=i(8848);class w extends u.Z{renderComponent(){return a()(C.Z,{hovered:this.props.hovered,onClick:this.props.onClick,disabled:this.props.disabled,disabledFeedback:!0,style:{...this.getButtonStyle(),...this.props.isLarge&&{height:32},...this.props.style},hoveredStyle:{background:this.theme.buttonHoveredBackground},pressedStyle:{background:this.theme.buttonPressedBackground},onMouseDown:this.props.onMouseDown,onMouseEnter:this.props.onMouseEnter,onMouseLeave:this.props.onMouseLeave,className:this.props.className},void 0,this.props.children)}getButtonStyle(){return{display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,whiteSpace:"nowrap",height:28,borderRadius:3,boxShadow:this.theme.plainButtonBoxShadow,background:this.theme.inputBackground,color:this.theme.mediumTextColor,fill:Z.ZP.white,lineHeight:1.2,paddingLeft:12,paddingRight:12,fontSize:14}}}const k=w;var A=i(65598),P=i(75246),I=i(21202),x=i(26177),F=i(75472),B=i(1903);class E extends u.Z{constructor(...e){super(...e),l()(this,"storeTypes",{permissionsInviteStore:B.Z}),l()(this,"renderOverlay",(()=>c().createElement(x.default,n()({},this.props,{permissionsInviteStore:this.stores.permissionsInviteStore})))),l()(this,"handleTrialClick",(()=>{M.y(this.environment,{from:this.props.upgradeButtonName,for:"team_free"}),this.props.onUpgradeButtonClick&&this.props.onUpgradeButtonClick()})),l()(this,"handleButtonClick",(()=>{this.stores.permissionsInviteStore.setState({isFocused:!0,modalOpen:!0,tokenQuery:"",inviteTargets:[],inviteRole:this.getDefaultRoleForNonBot(),isInviteTargetsEmpty:!0,table:(0,A.Mm)(this.props.store)?P.bx:I.iU}),(0,A.Mm)(this.props.store)?m.$zQ(this.environment):m.Mqg(this.environment)})),l()(this,"handleModalDismiss",(async()=>{const{permissionsInviteStore:e}=this.stores;return e.setState({...e.state,modalOpen:await(0,F.Aw)(e.state)})}))}async willMount(){await h.bi(this.environment)}renderComponent(){const{store:e}=this.props,{device:t}=this.environment,{modalOpen:i}=this.stores.permissionsInviteStore.state;let s,o,r=!1;return e.canAdmin()?e.canAdmin()&&(0,A.Mm)(e)&&f.default.state.data&&!g.qF(this.environment)?(s=!1,r=!0,o=a()(S.Z,{imageURL:b.Z.images.tooltips.upsells.spaceReadAndWritePng,imageWidth:240,imageHeight:100,caption:a()(y.FormattedMessage,{defaultMessage:"Members are teammates you invite to your workspace. They can access and add pages for all members to see, or be added to pages with permissions for private collaboration.",id:"permissionsInvite.spaceAddMemberUpgradeTooltip.caption"}),title:a()(y.FormattedMessage,{defaultMessage:"Upgrade to add members",id:"permissionsInvite.spaceAddMemberUpgradeTooltip.title"})})):s=!0:(s=!1,o=(0,A.Mm)(e)?a()(y.FormattedMessage,{id:"inviteUserButton.tooltip.adminsOnlyMessage",defaultMessage:"Only admins can add members."}):a()(y.FormattedMessage,{id:"inviteUserButton.tooltip.fullAccessOnlyMessage",defaultMessage:"Only those with full access can add people."})),a()("div",{},void 0,(0,A.Mm)(e)?a()(T.Z,{open:i,onDismiss:this.handleModalDismiss,renderContent:this.renderOverlay,origin:a()(p.Z,{renderTooltip:()=>o,disableTooltip:s,render:e=>c().createElement(v.Z,n()({isLarge:!0,onClick:r?this.handleTrialClick:this.handleButtonClick,disabled:!s&&!r,style:{flex:this.props.shouldGrow?1:0,...this.props.buttonStyle}},e),a()(y.FormattedMessage,{id:"inviteUserButton.addMemberLabel",defaultMessage:"Add members"}))})}):a()(T.Z,{open:i,onDismiss:this.handleModalDismiss,renderContent:this.renderOverlay,origin:a()(p.Z,{renderTooltip:()=>o,disableTooltip:s,render:e=>a()("div",{style:{display:"flex",alignItems:"center"}},void 0,a()(k,{onClick:r?this.handleTrialClick:this.handleButtonClick,disabled:!s&&!r,style:{flex:1,justifyContent:"flex-start",height:t.isMobile?34:26,borderTopRightRadius:0,borderBottomRightRadius:0,overflow:"hidden"}},void 0,a()("div",{style:{textOverflow:"ellipsis",overflow:"hidden"}},void 0,a()(y.FormattedMessage,{defaultMessage:"People, emails, groups, or integrations",id:"inviteUserButton.addGuestsAndGroupsAndIntegrationsLabel"}))),c().createElement(v.Z,n()({onClick:r?this.handleTrialClick:this.handleButtonClick,disabled:!s&&!r,style:{height:t.isMobile?36:28,borderTopLeftRadius:0,borderBottomLeftRadius:0}},e),a()(y.FormattedMessage,{id:"inviteUserButton.invitePersonLabel",defaultMessage:"Invite"})))})}))}getDefaultRoleForNonBot(){const{store:e,isSubscribed:t}=this.props;return(0,A.Mm)(e)?t?"read_and_write":"editor":g.lw(this.environment)?"editor":"read_and_write"}}const R=(0,y.injectIntl)(E)},26200:(e,t,i)=>{i.r(t),i.d(t,{default:()=>U});var s=i(67154),a=i.n(s),o=i(98135),n=i.n(o),r=i(59713),l=i.n(r),d=i(67294),c=i.n(d),u=i(66832),m=i(25399),p=i(5366),g=i(92660),h=i(88632),f=i(47966),v=i(82990),y=i(360),M=i(14598),S=i(58762),b=i(28020),T=i(46562),C=i(25584),Z=i(71202),w=i(83071),k=i(6202),A=i(3779),P=i(47307);const I=(0,p.defineMessages)({phishing_or_spam:{id:"reportPage.reportReasons.phishing_or_spam",defaultMessage:"Phishing or spam"},inappropriate_content:{id:"reportPage.reportReasons.inappropriate_content",defaultMessage:"Inappropriate content"},other_content_policy_violation:{id:"reportPage.reportReasons.other_content_policy_violation",defaultMessage:"Other"}});var x=i(33929),F=i(8848),B=i(74523),E=i(33665),R=i(62727),D=i(86646),_=i(69972);const L=(0,p.defineMessages)({additionalInformationPlaceholder:{id:"reportPage.additionalInformation.placeholder",defaultMessage:"Add additional information (optional)"}});class O extends u.Z{constructor(e){super(e),l()(this,"handleCancel",(()=>{(0,y.q)()})),l()(this,"renderContent",(()=>{const{device:e}=this.environment;if(!h.Z.state.online)return this.renderOffline();const t=m.Z.state;return t.open?e.isMobile?this.renderMobileModal(t):this.renderDesktopModal(t):void 0})),l()(this,"onSubmit",(async()=>{const e=this.environment,t=m.Z.getState();if(!t.open)return;const{additionalInformation:i,reason:s}=t,a=(0,b.FZ)();if(!s||null==a||!a.id)return void P.showErrorMessage(n()(p.FormattedMessage,{defaultMessage:"Something went wrong.",id:"reportPageModal.somethingWentWrong.label"}));const o=await(r=(0,T.OP)(),(0,S.reportPage)(e,{reason:s,page:a,intercomVisitorId:r,additionalInformation:i}));var r;"failed"===o.type?P.showError(o):(m.Z.setState({open:!1}),P.showMessage({message:c().createElement(c().Fragment,null,n()("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"}},void 0,A.Z.thanksShield({width:40}),n()("div",{style:{paddingTop:12,paddingBottom:8,fontSize:"large",textAlign:"center"}},void 0,n()(p.FormattedMessage,{id:"reportPageModal.thanksForReporting",defaultMessage:"Thanks for reporting this page, our team will take a look."}))))}))})),l()(this,"modalTitleStyle",{fontSize:16,marginBottom:12,fontWeight:v.Z.fontWeight.medium})}renderComponent(){return n()(g.Z,{onDismiss:this.handleCancel,render:this.renderContent,requireOnline:!0,modalStore:m.Z})}renderOptionButtons(e){const{reason:t}=e;return c().createElement(c().Fragment,null,n()(M.Z,{title:n()(p.FormattedMessage,{id:"reportPageModal.reportReasons.phishing_or_spam",defaultMessage:"Phishing or spam"}),isSelected:"phishing_or_spam"===t,onClick:()=>m.Z.setState({...e,reason:"phishing_or_spam"})},"phishing_or_spam"),n()(M.Z,{title:x.default.formatMessage(I.inappropriate_content),isSelected:"inappropriate_content"===t,onClick:()=>m.Z.setState({...e,reason:"inappropriate_content"})},"inappropriate_content"),n()(M.Z,{title:n()(p.FormattedMessage,{id:"reportPageModal.reportReasons.other_content_policy_violation",defaultMessage:"Other"}),isSelected:"other_content_policy_violation"===t,onClick:()=>m.Z.setState({...e,reason:"other_content_policy_violation"})},"other_content_policy_violation"))}renderMobileModal(e){if(!e.open)return;const{reason:t}=e,i={menuType:Z.og.Modal,title:n()(p.FormattedMessage,{id:"reportPageModal.mobile.title",defaultMessage:"Report page"}),right:n()(p.FormattedMessage,{id:"reportPageModal.closeButton.label",defaultMessage:"Close"}),onClickRight:this.handleCancel};return c().createElement(Z.ZP,i,n()(C.Z,{type:C.Z.Type.Vertical,initialFocus:void 0,sections:[{key:"help",render:({children:e,...t})=>c().createElement(w.Z,t,e),items:[{key:"help",render:()=>n()(D.Z,{title:n()(B.Z,{title:n()(p.FormattedMessage,{id:"reportPage.helpButton.caption",defaultMessage:"Notion's content policy"}),href:(0,E.UY)("contentPolicy"),analyticsFrom:"report_page"}),right:c().createElement(c().Fragment,null),onClick:()=>{}}),action:()=>{}}]},{key:"reportOptions",render:({children:e,...t})=>c().createElement(w.Z,t,e),items:[{key:"options",render:()=>this.renderOptionButtons(e),action:()=>{}},{key:"additionalInfo",render:()=>t&&n()(R.Z,{textarea:!0,style:this.getTextAreaStyle(),focus:Boolean(e.reason),value:e.additionalInformation,placeholder:x.default.formatMessage(L.additionalInformationPlaceholder),onChange:t=>{m.Z.setState({...e,additionalInformation:t.target.value})}}),action:()=>{}}]},{key:"actions",render:({children:e,...t})=>c().createElement(w.Z,a()({isSubmitButton:!0},t),e),items:[{key:"submit",render:e=>{const{onClick:t,...i}=e;return c().createElement(k.Z,a()({},i,{disabled:!this.canSubmit(),title:n()("div",{style:{color:F.ZP.red}},void 0,n()(p.FormattedMessage,{id:"reportPageModal.reportButton.label",defaultMessage:"Report"})),onClick:t||this.onSubmit}))},action:this.onSubmit}]}]},"main list"))}canSubmit(){const{state:e}=m.Z;if(e.open){const{reason:t}=e;return void 0!==t}return!1}renderDesktopModal(e){if(!e.open)return;const{reason:t}=e;return n()(_.Z,{capture:!0,allowUndo:!0,allowEsc:!0,allowTabUntab:!1,render:()=>n()("div",{style:this.getModalWrapStyle()},void 0,n()("div",{style:this.modalTitleStyle},void 0,n()(p.FormattedMessage,{id:"reportPageModal.title",defaultMessage:"Why are you reporting this page?"})),n()("div",{style:{paddingBottom:12}},void 0,n()(B.Z,{title:n()(p.FormattedMessage,{id:"reportPage.helpButton.caption",defaultMessage:"Notion's content policy"}),href:(0,E.UY)("contentPolicy"),analyticsFrom:"report_page"})),n()("div",{},void 0,this.renderOptionButtons(e)),t&&n()(R.Z,{textarea:!0,style:this.getTextAreaStyle(),focus:Boolean(e.reason),value:e.additionalInformation,placeholder:x.default.formatMessage(L.additionalInformationPlaceholder),onChange:t=>{m.Z.setState({...e,additionalInformation:t.target.value})}}),n()("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:18}},void 0,n()(f.Z,{isLarge:!0,onClick:this.handleCancel,style:{marginRight:12}},void 0,n()(p.FormattedMessage,{id:"reportPageModal.cancelButton.label",defaultMessage:"Cancel"})),n()(f.Z,{isRed:!0,isLarge:!0,onClick:this.onSubmit,disabled:!this.canSubmit(),disabledFeedback:!0},void 0,n()(p.FormattedMessage,{id:"reportPageModal.reportButton.label",defaultMessage:"Report"}))))})}renderOffline(){return n()("div",{style:this.getOfflineStyle()},void 0,n()(p.FormattedMessage,{defaultMessage:"Please go online to make a report.",id:"reportPageModal.offlineMessage.description"}))}getModalWrapStyle(){return{width:360,padding:24,fontSize:14}}getOfflineStyle(){return{...this.getModalWrapStyle(),color:this.theme.mediumTextColor}}getTextAreaStyle(){const{device:e}=this.environment;return{width:"100%",background:this.theme.popoverBackground,display:"block",padding:e.isMobile?16:"10px 12px",height:e.isMobile?150:130,marginTop:17,marginBottom:17,fontSize:e.isMobile?16:14}}}const U=O},67552:(e,t,i)=>{i.r(t),i.d(t,{default:()=>ft});var s=i(67154),a=i.n(s),o=i(98135),n=i.n(o),r=i(59713),l=i.n(r),d=(i(33948),i(73210),i(96486)),c=i.n(d),u=i(67294),m=i.n(u),p=i(50906),g=i(31299),h=i(27832),f=i(9714),v=i(21202),y=i(43250),M=i(3779),S=i(69972),b=i(52377),T=i(16328),C=i(71202),Z=i(25584),w=i(29798),k=i(67719),A=i(81997),P=i(87531),I=i(48762),x=i(76725),F=i(79029),B=i(33426),E=i(66832),R=i(82990),D=i(38978),_=i(19889),L=i(5366);class O extends E.Z{constructor(...e){super(...e),l()(this,"createBlockStore",(e=>{const{parentStore:t}=this.props;return f.Z.createChildStore(t,{table:v.iU,id:e})})),l()(this,"createUserStore",(e=>{const{parentStore:t}=this.props;return D.Z.createChildStore(t,{table:_.KJ,id:e})})),l()(this,"getUserValue",(e=>this.createUserStore(e).getValue())),l()(this,"getCreatedTimeDetail",(e=>{const{intl:t}=this.props,{starting:i,ending:s}=e;return i&&s?n()(L.FormattedMessage,{defaultMessage:"Created {startDate} to {endDate}",id:"search.recentMenuItem.createdDateWithRange.subtitle",description:"Shown as part of the subtitle if the recent search involved searching for content created in a specific date range. {startDate} and {endDate} are dates including the month, day, and year.",values:{startDate:B.p6(i,t),endDate:B.p6(s,t)}}):i?n()(L.FormattedMessage,{defaultMessage:"Created after {startDate}",id:"search.recentMenuItem.createdDateAfter.subtitle",description:"Shown as part of the subtitle if the recent search involved searching for content created after a specific date. {startDate} is a date including the month, day, and year.",values:{startDate:B.p6(i,t)}}):s?n()(L.FormattedMessage,{defaultMessage:"Created before {endDate}",description:"Shown as part of the subtitle if the recent search involved searching for content created before a specific date. {endDate} is a date including the month, day, and year.",id:"search.recentMenuItem.createdDateBefore.subtitle",values:{endDate:B.p6(s,t)}}):void 0})),l()(this,"getLastEditedTimeDetail",(e=>{const{intl:t}=this.props,{starting:i,ending:s}=e;return i&&s?n()(L.FormattedMessage,{defaultMessage:"Last edited {startDate} to {endDate}",id:"search.recentMenuItem.lastEditedDateWithRange.subtitle",description:"Shown as part of the subtitle if the recent search involved searching for content last edited in a specific date range. {startDate} and {endDate} are dates including the month, day, and year.",values:{startDate:B.p6(i,t),endDate:B.p6(s,t)}}):i?n()(L.FormattedMessage,{defaultMessage:"Last edited after {startDate}",id:"search.recentMenuItem.lastEditedDateAfter.subtitle",description:"Shown as part of the subtitle if the recent search involved searching for content last edited after a specific date. {startDate} is a date including the month, day, and year.",values:{startDate:B.p6(i,t)}}):s?n()(L.FormattedMessage,{defaultMessage:"Last edited before {endDate}",description:"Shown as part of the subtitle if the recent search involved searching for content last edited before a specific date. {endDate} is a date including the month, day, and year.",id:"search.recentMenuItem.lastEditedDateBefore.subtitle",values:{endDate:B.p6(s,t)}}):void 0})),l()(this,"styles",{recentSearchItem:()=>{const{device:e}=this.environment;return{minHeight:void 0,paddingTop:e.isMobile?12:8,paddingBottom:e.isMobile?12:8}},inlineCaption:{display:"block",marginTop:1},queryText:{flexShrink:0},detailEmphasis:{fontWeight:R.Z.fontWeight.medium},enterIcon:{height:14,width:14},textWrapper:{marginLeft:8},iconWrapper:{height:19,width:19,display:"flex",alignItems:"center"}})}renderComponent(){const{device:e}=this.environment,{query:t,...i}=this.props,s=this.styles,o=this.getThemeColors(),r=n()("div",{style:s.queryText},void 0,t.text.trim()),l={...s.recentSearchItem(),...this.environment.device.isMobile&&o.menuItemMobile},d=!e.isMobile;return m().createElement(I.Z,a()({},i,{style:l,inline:d,icon:this.renderIcon(),title:r,caption:this.renderRecentSearchCaption(),captionStyle:d?s.inlineCaption:void 0,right:this.renderEnterIcon(),disableTransition:!0,dontShrinkRight:!0,textWrapperStyle:s.textWrapper,className:"notranslate"}))}renderRecentSearchCaption(){const{query:e}=this.props,{isNavigableOnly:t,ancestors:i,createdBy:s,editedBy:a,lastEditedTime:o,createdTime:r}=e.filters,l=[];if(t&&l.push(n()(L.FormattedMessage,{defaultMessage:"Only match titles",id:"search.recentMenuItem.onlyMatchTitles.subtitle"})),i.length>0){const e=this.renderRecentSearchAncestors(i);l.push(n()(L.FormattedMessage,{defaultMessage:"In {pages}",id:"search.recentMenuItemDetail.inPage.subtitle",description:"Shown as part of the subtitle if the recent search involved searching for content in specific pages. {pages} is the title of the first page that the search was conducted in, with something like '+ 1' or '+ 2' following it, depending on the number of additional pages that were searched.",values:{pages:this.renderListItems(e)}}))}if(s.length>0){const e=this.renderRecentSearchUsers(s);l.push(n()(L.FormattedMessage,{defaultMessage:"Created by {people}",id:"search.recentMenuItemDetail.createdBy.subtitle",description:"Shown as part of the subtitle if the recent search involved searching for content created by specific people. {people} is the name of the first person, with something like '+ 1' or '+ 2' following it, depending on the number of additional people in the search.",values:{people:this.renderListItems(e)}}))}if(a.length>0){const e=this.renderRecentSearchUsers(a);l.push(n()(L.FormattedMessage,{defaultMessage:"Edited by {people}",id:"search.recentMenuItemDetail.editedBy.subtitle",description:"Shown as part of the subtitle if the recent search involved searching for content edited by specific people. {people} is the name of the first person, with something like '+ 1' or '+ 2' following it, depending on the number of additional people in the search.",values:{people:this.renderListItems(e)}}))}if(r.starting||r.ending){const e=this.getCreatedTimeDetail(r);l.push(e)}if(o.starting||o.ending){const e=this.getLastEditedTimeDetail(o);l.push(e)}if(l.length>0)return(0,x.Z)(l,(()=>" · "))}renderListItems(e){if(0===e.length)return;if(1===e.length)return e;const[t,...i]=e,s=i.length;return n()(L.FormattedMessage,{defaultMessage:"{firstPageOrPerson} + {numberRemaining}",id:"search.recentMenuItem.listOfPeopleOrPages.label",values:{firstPageOrPerson:t,numberRemaining:s},description:"This shows the people or pages the recent search item was conducted against. The '+' symbol means 'and'."})}renderRecentSearchAncestors(e){const t=this.styles;return e.map((e=>n()(m().Fragment,{},e," ",n()(F.Z,{store:this.createBlockStore(e),style:t.detailEmphasis,shouldWrap:!0},e))))}renderRecentSearchUsers(e){const t=this.styles;return e.map((e=>{const i=this.getUserValue(e);return n()(m().Fragment,{},e," ",n()("span",{style:t.detailEmphasis},void 0,(0,_.Nz)(this.props.intl,i)))}))}renderEnterIcon(){const{device:e}=this.environment,{focused:t}=this.props,i=this.styles,s=this.getThemeColors();if(e.isMobile)return;const a={...i.enterIcon,...s.enterIcon};return t?M.Z.enter(a):void 0}renderIcon(){const{icon:e}=this.props;return n()("div",{style:this.styles.iconWrapper},void 0,e)}getThemeColors(){return{menuItemMobile:{boxShadow:"0 1px 0 ".concat(this.theme.lightDividerColor)},enterIcon:{fill:this.theme.mediumIconColor}}}}l()(O,"contextTypes",C.ff);const U=(0,L.injectIntl)(O);var N=i(7765),V=i(72087),W=i(26111),z=i(12235),H=i(86646),q=i(75024);class G extends E.Z{constructor(...e){super(...e),l()(this,"styles",{menuItem:{minHeight:void 0,...this.environment.device.isMobile&&{background:void 0,boxShadow:void 0},paddingTop:32,paddingBottom:32},text:{textAlign:"center"},title:{margin:0,fontWeight:R.Z.fontWeight.medium,fontSize:q.yv(this.environment,"UIRegular"),lineHeight:q.Dp(this.environment,"UIRegular")},caption:{fontSize:q.yv(this.environment,"UIRegular")}})}renderComponent(){const{style:e,...t}=this.props,i=e?{...this.styles.menuItem,...e}:this.styles.menuItem;return m().createElement(H.Z,a()({},t,{title:this.renderTitle(),caption:this.renderCaption(),textWrapperStyle:this.styles.text,style:i}))}renderTitle(){const{title:e}=this.props;if(!e)return;const t=this.styles,i=this.getThemeColors(),s={...t.title,...i.title};return n()("h4",{role:"alert",style:s},void 0,e)}renderCaption(){const{caption:e}=this.props;if(!e)return;const t=this.styles,i=this.getThemeColors(),s={...t.caption,...i.caption};return n()("div",{style:s},void 0,e)}getThemeColors(){return{title:{color:this.theme.mediumTextColor},caption:{color:this.theme.lightTextColor}}}}l()(G,"contextTypes",{...C.ff});const K=G;var j=i(86512),Y=i(92338),Q=i(97880),J=i(39634);class X extends E.Z{constructor(...e){super(...e),l()(this,"handleSendMessageClick",(()=>{J.O({environment:this.environment,from:"quick_find"})})),l()(this,"styles",{menuItem:{marginTop:"auto",marginBottom:"auto"},reportProblemButton:{display:"inline"}})}renderComponent(){return m().createElement(K,a()({},this.getErrorMessage(),{style:this.styles.menuItem}))}renderNoResults(){const{searchStore:e}=this.props,t=B.FN(e.state.query.filters);return{title:X.noResultsTitle,caption:n()(L.FormattedMessage,t?{defaultMessage:"Try different search terms or filters",id:"searchErrorMenuItem.errorPrompt.searchTermsAndFilters"}:{defaultMessage:"Try different search terms",id:"searchErrorMenuItem.errorPrompt.searchTerms"})}}renderOffline(){return{title:X.noResultsTitle,caption:n()(L.FormattedMessage,{defaultMessage:"Go online for more results.",id:"searchErrorMenuItem.errorPrompt.goOnline"})}}renderRequestFailed(){const e=this.styles,t=this.getThemeColors(),i={...e.reportProblemButton,...t.reportProblemButton};return{title:n()(L.FormattedMessage,{id:"searchErrorMenuItem.error.genericErrorMessage",defaultMessage:"Something went wrong"}),caption:n()(L.FormattedMessage,{id:"searchErrorMenuItem.errorPrompt.refreshOrReport",defaultMessage:"Try refreshing or <reportlink>report a problem</reportlink>.",values:{reportlink:(...e)=>n()(j.Z,{onClick:this.handleSendMessageClick,style:i},void 0,e)}})}}getErrorMessage(){const{error:e}=this.props;switch(e.type){case Y.Ix.NoResults.type:return this.renderNoResults();case Y.Ix.Offline.type:return this.renderOffline();case Y.Ix.RequestFailed.type:return this.renderRequestFailed();default:(0,Q.t1)(e)}}getThemeColors(){return{reportProblemButton:{color:this.theme.blueColor}}}}l()(X,"contextTypes",{...C.ff}),l()(X,"noResultsTitle",n()(L.FormattedMessage,{defaultMessage:"No results",id:"searchErrorMenuItem.error.noResults"}));const $=X;var ee=i(62134),te=i(68932),ie=i(29026),se=i(83071),ae=i(92166);class oe extends E.Z{constructor(...e){super(...e),l()(this,"renderKeyboardShortcut",((e,t)=>{const i=this.styles,s=this.getThemeColors(),a={...i.keyboardShortcut,...s.keyboardShortcut,...t};return n()("span",{style:a},void 0,e)})),l()(this,"styles",{footer:()=>{const{device:e}=this.environment;return{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",fontSize:e.isMobile?R.Z.fontSize.UIRegular.mobile:R.Z.fontSize.UIRegular.desktop}},footerText:{fontSize:q.yv(this.environment,"UISmall"),...R.Z.textOverflowStyle},inlineHint:{display:"inline",marginRight:16},resultCountWrapper:{display:"flex",alignItems:"center",...R.Z.textOverflowStyle},resultCount:{fontWeight:R.Z.fontWeight.medium},resultText:{verticalAlign:"middle",marginRight:6},spinner:{display:"inline",width:12,height:12,verticalAlign:"middle"},keyboardShortcut:{marginRight:4,marginBottom:1,fontVariant:"all-small-caps",fontSize:1.1*q.yv(this.environment,"UISmall")},commandGlyph:{fontSize:.75*q.yv(this.environment,"UIRegular")}})}renderComponent(){return this.props.mode===ie.ZP.Mode.Results?this.renderResultState(this.props.results):this.renderSection(this.renderHelpText())}renderResultState(e){const t=this.styles,i=this.getThemeColors(),s={...t.resultCount,...i.resultCount},{count:a,isLowerBound:o}=this.getResultCount(e),r=n()("span",{style:t.resultText},void 0,o?this.props.intl.formatMessage({id:"searchFooter.helpText.resultCountApproximate",description:"Approximate number of results displayed in footer of search modal.",defaultMessage:"{resultCount, plural, other {<resultwrapper>{resultCount}+</resultwrapper> results}}"},{resultCount:a,resultwrapper:(...e)=>n()("span",{style:s},void 0,e)}):this.props.intl.formatMessage({id:"searchFooter.helpText.resultCount",description:"Exact number of results displayed in footer of search modal.",defaultMessage:"{resultCount, plural, one {<resultwrapper>{resultCount}</resultwrapper> result} other {<resultwrapper>{resultCount}</resultwrapper> results}}"},{resultCount:a,resultwrapper:(...e)=>n()("span",{style:s},void 0,e)})),l=n()("div",{style:t.resultCountWrapper},void 0,r,this.props.mode===ie.AR.Results&&this.renderSpinner(this.props.showSpinner));return this.renderSection(l)}renderSpinner(e){const t=this.styles;return n()(ae.Z,{show:e,showDelay:500,showHold:200,render:e=>e&&n()(te.Z,{style:t.spinner})})}renderSection(e){const t=this.styles,i=this.getThemeColors(),s={...t.footerText,...i.footerText};return n()(se.Z,{topBorder:!0,style:t.footer(),disableDesktopPadding:!0},void 0,n()(H.Z,{title:e,style:s}))}renderHelpText(){const e=this.styles,t=this.getThemeColors(),i={...q.mK,...e.footerText,...t.footerText},s={...e.commandGlyph,...t.keyboardShortcut},{command:a}=ee.fg(this.environment),{device:o}=this.environment;return n()("ul",{style:i},void 0,n()("li",{style:e.inlineHint},void 0,this.renderKeyboardShortcut("↑↓"),this.props.intl.formatMessage({id:"searchFooter.helpText.selectHint",defaultMessage:"Select"})),n()("li",{style:e.inlineHint},void 0,this.renderKeyboardShortcut("↵"),this.props.intl.formatMessage({id:"searchFooter.helpText.openHint",defaultMessage:"Open"})),n()("li",{style:e.inlineHint},void 0,n()("span",{style:s},void 0,a),this.renderKeyboardShortcut("+↵"),o.isElectron?this.props.intl.formatMessage({id:"searchFooter.helpText.openNewWindow",defaultMessage:"Open in a new window"}):this.props.intl.formatMessage({id:"searchFooter.helpText.openNewTab",defaultMessage:"Open in a new tab"})))}getResultCount(e){const t=e.server?e.server.total:e.local.total;return{count:t,isLowerBound:Boolean(e.server&&e.local&&t<ie.Xv)}}getThemeColors(){return{footerText:{color:this.theme.lightTextColor},resultCount:{color:this.theme.mediumTextColor},keyboardShortcut:{color:this.theme.mediumTextColor}}}}const ne=(0,L.injectIntl)(oe);var re=i(42001),le=i(46167),de=i(61766),ce=i(94168),ue=i(3059),me=i(14947),pe=i(32918);let ge;!function(e){e[e.Button=0]="Button",e[e.MenuItem=1]="MenuItem"}(ge||(ge={}));class he extends E.Z{constructor(...e){super(...e),l()(this,"handleFilterClick",(e=>{const{onMenuDismiss:t}=this.props;this.applyFilter(e),this.openSidebar(),t&&t()})),l()(this,"applyFilter",(e=>{const{searchStore:t}=this.props;t.updateFilters(e)})),l()(this,"openSidebar",(()=>{const{searchStore:e}=this.props;e.isSidebarOpen()||e.setState({...e.state,isSidebarOpen:!0})})),l()(this,"styles",{menuItem:{minHeight:void 0,paddingTop:this.environment.device.isMobile?12:4,paddingBottom:this.environment.device.isMobile?12:4},buttonFilter:{padding:"4px 8px",display:"flex",alignItems:"center",overflow:"hidden"},buttonText:{...R.Z.textOverflowStyle},icon:{display:"inline-block",height:14,width:14,fill:"currentColor"},buttonIcon:{marginRight:6}})}renderComponent(){const{mode:e}=this.props;return e===ge.Button?this.renderAsButton():e===ge.MenuItem?this.renderAsMenuItem():void(0,Q.t1)(e)}renderAsButton(){const{icon:e,title:t,filter:i}=this.props,s=this.styles,a=this.getThemeColors();return n()(me.Z,{style:{...s.buttonFilter,...a.buttonFilter},onClick:()=>this.handleFilterClick(i)},void 0,e&&e({...s.icon,...s.buttonIcon}),n()("span",{style:s.buttonText},void 0,t))}renderAsMenuItem(){const{icon:e,title:t,filter:i,focused:s}=this.props,a=this.styles,o=this.getThemeColors(),r={...a.menuItem,...o.menuItem};return n()(I.Z,{icon:e&&e(a.icon),focused:s,title:t,onClick:()=>this.handleFilterClick(i),style:r})}getThemeColors(){const{device:e}=this.environment;return{menuItem:{color:e.isDesktop?this.theme.mediumTextColor:void 0,...this.props.isLastInSection&&{boxShadow:void 0}},buttonFilter:{color:this.theme.mediumTextColor}}}}l()(he,"Mode",ge);class fe extends E.Z{renderComponent(){const e=fe.getCurrentPageFilter();if(e)return m().createElement(he,a()({icon:M.Z.searchInPage,title:n()(L.FormattedMessage,{id:"search.filterMenu.quickFilters.inCurrentPage",defaultMessage:"In current page"}),filter:e},this.props))}static isActive(e){const t=fe.getCurrentPageFilter();if(!t)return!1;if(!t.ancestors)return!1;const i=t.ancestors[0];return-1!==e.ancestors.indexOf(i)}}l()(fe,"getCurrentPageFilter",(()=>{const{currentBlockStore:e}=h.default.state;if(e&&e.id)return{ancestors:[e.id]}}));class ve extends E.Z{renderComponent(){const e=ve.getCurrentUserFilter(this.environment);if(e)return m().createElement(he,a()({icon:M.Z.person,title:n()(L.FormattedMessage,{id:"search.filterMenu.quickFilters.createdByMe",defaultMessage:"Created by me"}),filter:e},this.props))}static isActive(e,t){const i=ve.getCurrentUserFilter(e);if(!i)return!1;if(!i.createdBy)return!1;const s=i.createdBy[0];return-1!==t.createdBy.indexOf(s)}}l()(ve,"getCurrentUserFilter",(e=>{const{id:t}=e.currentUser;if(t)return{createdBy:[t]}}));class ye extends E.Z{renderComponent(){const e=ye.getPastWeekFilter();if(e)return m().createElement(he,a()({icon:M.Z.calendar,title:n()(L.FormattedMessage,{id:"search.filterMenu.quickFilters.editedLastWeek",defaultMessage:"Edited last week"}),filter:e},this.props))}static isActive(e){const{lastEditedTime:t}=ye.getPastWeekFilter();return c().isEqual(t,e.lastEditedTime)}}l()(ye,"getPastWeekFilter",(()=>({lastEditedTime:{starting:pe.Oo(pe.x7),ending:pe.Lg(pe.x7)}})));var Me=i(255),Se=i(24042),be=i(85567),Te=i(33929),Ce=i(40039),Ze=i(84619);const we=(0,L.defineMessages)({searchPages:{defaultMessage:"Search pages",id:"searchPageFilter.searchTokenFilter.tokenInput.placeholder"},selectAPage:{defaultMessage:"Select a page",id:"searchPageFilter.searchTokenFilter.resultSection.title"}});class ke extends E.Z{constructor(...e){super(...e),l()(this,"renderFilterListItem",((e,{disabled:t,onRemove:i,onClick:s})=>{const a=this.styles,o=this.createBlockStore(e),r=n()(Me.Z,{disabled:t,onClick:i});return n()(Se.Z,{disabled:t,focused:!1,store:o,right:r,style:a.menuItem,desktopTitleStyle:a.menuItemTitle,onClick:s})})),l()(this,"renderItemForSummary",(e=>n()(F.Z,{store:this.createBlockStore(e),shouldWrap:!0,maxLength:50}))),l()(this,"renderToken",((e,t)=>{const{blockIds:i}=this.props,s=this.tokenStyles,a=1===i.length,o=this.createBlockStore(e),r=n()("div",{style:s.token},void 0,n()(Ce.Z,{disabled:!0,icon:o.getIcon(),isEmptyPage:!1,size:20,style:s.icon}),n()(F.Z,{store:o}));return n()(be.Z,{format:Ze.l.Large,value:r,showRemoveButton:!0,onClickRemove:t.onRemove,isSingle:a,shouldShrink:!0},e)})),l()(this,"renderResultMenuItem",((e,t)=>{const i=this.createBlockStore(e);return m().createElement(Se.Z,a()({},t,{key:e,store:i}))})),l()(this,"performRequest",(async({query:e,current:t})=>{const{currentSpaceStore:i}=h.default.state;if(!i)return[];const{results:s}=await g.nJ({environment:this.environment,query:e,limit:20,spaceId:i.id,requireEditPermissions:!1,excludeTemplates:!1,source:"quick_find_ancestor_filter"}),a=new Set(t);return s.filter((e=>!a.has(e)))})),l()(this,"createBlockStore",(e=>{const{parentStore:t}=this.props;return f.Z.createChildStore(t,{table:v.iU,id:e})})),l()(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:4}}),l()(this,"tokenStyles",{token:{display:"flex",alignItems:"center"},icon:{marginRight:4}})}renderComponent(){const{mode:e,title:t,blockIds:i,onChange:s,disabled:a,focused:o,onMenuDismiss:r}=this.props;return n()(ue.Z,{mode:e,title:t,icon:M.Z.searchInPage,items:i,onChange:s,focused:o,renderFilter:this.renderFilterListItem,renderToken:this.renderToken,renderItemForSummary:this.renderItemForSummary,addItemLabel:n()(L.FormattedMessage,{defaultMessage:"Add a page",id:"searchPageFilter.searchTokenFilter.addAPage.button"}),labelText:{title:t,tokenInputPlaceholder:Te.default.formatMessage(we.searchPages),resultSectionTitle:Te.default.formatMessage(we.selectAPage),componentDebugName:"SearchPageFilter"},performRequest:this.performRequest,renderResultMenuItem:this.renderResultMenuItem,disabled:a,onMenuDismiss:r})}}const Ae=ke;var Pe=i(43997),Ie=i(97680),xe=i(66897);class Fe extends E.Z{constructor(...e){super(...e),l()(this,"renderFilterListItem",((e,{disabled:t,onRemove:i,onClick:s})=>{const a=this.styles,o=this.getUserValue(e),r=n()(Me.Z,{disabled:t,onClick:i});return n()(Ie.Z,{disabled:t,focused:!1,user:o,right:r,style:a.menuItem,desktopTitleStyle:a.menuItemTitle,onClick:s},e)})),l()(this,"renderItemForSummary",(e=>(0,_.Nz)(this.props.intl,this.getUserValue(e)))),l()(this,"renderToken",((e,t)=>{const{userIds:i}=this.props,s=1===i.length,a=this.getUserValue(e);if(a)return n()(Pe.ZP,{format:Pe.ZP.Format.Large,showRemoveButton:!0,isSingle:s,onClickRemove:t.onRemove,actor:(0,xe.m3)(a)},e)})),l()(this,"renderResultMenuItem",((e,t)=>{const i=this.getUserValue(e);return m().createElement(Ie.Z,a()({},t,{key:e,user:i}))})),l()(this,"performRequest",(async({query:e,current:t})=>{const i=new Set(t);return(await g.O$({environment:this.environment,query:e,membersOnly:!1})).filter((e=>!i.has(e.id))).slice(0,20).map((e=>e.id))})),l()(this,"getUserValue",(e=>this.createUserStore(e).getValue())),l()(this,"createUserStore",(e=>{const{parentStore:t}=this.props;return D.Z.createChildStore(t,{table:_.KJ,id:e})})),l()(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:4}})}renderComponent(){const{mode:e,title:t,userIds:i,onChange:s,disabled:a,focused:o,onMenuDismiss:r,intl:l}=this.props;return n()(ue.Z,{mode:e,title:t,icon:M.Z.person,items:i,onChange:s,disabled:a,focused:o,renderFilter:this.renderFilterListItem,renderToken:this.renderToken,renderItemForSummary:this.renderItemForSummary,addItemLabel:n()(L.FormattedMessage,{defaultMessage:"Add a person",id:"search.filterMenu.addAPersonButton.label"}),labelText:{title:t,tokenInputPlaceholder:l.formatMessage({defaultMessage:"Search people",id:"search.filterMenu.searchPeople.placeholder"}),resultSectionTitle:l.formatMessage({defaultMessage:"Select a person",id:"search.filterMenu.searchPeople.resultsTitle"}),componentDebugName:"SearchPersonFilter"},performRequest:this.performRequest,renderResultMenuItem:this.renderResultMenuItem,onMenuDismiss:r,hasItemsSelected:(null==i?void 0:i.length)>0})}}const Be=(0,L.injectIntl)(Fe);var Ee=i(90175),Re=i(70510),De=i(60843);class _e extends E.Z{constructor(...e){super(...e),l()(this,"handleToggle",(()=>{const{value:e,onChange:t}=this.props;t(!e)})),l()(this,"styles",{menuItem:{minHeight:void 0,paddingTop:this.environment.device.isMobile?12:4,paddingBottom:this.environment.device.isMobile?12:4},icon:{height:14,width:14,fill:"currentColor"}})}renderComponent(){const{device:e}=this.environment,{mode:t}=this.props;return e.isMobile?this.renderMobile(t):this.renderDesktop(t)}renderDesktop(e){const t=e===ue.z.Section;return n()(Ee.Z,{marginAfter:t},void 0,this.renderSwitcherMenuItem())}renderMobile(e){const{title:t,value:i,disabled:s}=this.props;return e===ue.z.Button?this.renderSwitcherMenuItem():n()(Re.Z,{disabled:s,onClick:this.handleToggle,label:t,isToggle:!0,isToggleActive:i})}renderSwitcherMenuItem(){const{title:e,icon:t,value:i,style:s,...o}=this.props,n=this.styles,r=this.getThemeColors(),l={...n.menuItem,...r.menuItem,...s};return m().createElement(De.Z,a()({title:e,icon:t(n.icon),on:i,onClick:this.handleToggle,style:l},o))}getThemeColors(){return{menuItem:{color:this.theme.mediumTextColor}}}}l()(_e,"Mode",ue.z);const Le=_e;let Oe;!function(e){e.Button="Button",e.Section="Section"}(Oe||(Oe={}));class Ue extends E.Z{constructor(...e){super(...e),l()(this,"storeTypes",{buttonPopupStore:de.Z}),l()(this,"renderAddFilterOrigin",(e=>{const t=this.styles;return m().createElement(re.Z,a()({},e,{style:t.addFilterButtonMobile,icon:M.Z.filterCircled,isBlue:!0}),n()(L.FormattedMessage,{defaultMessage:"Add filter",id:"search.addFilter.button.label"}))})),l()(this,"renderAddFilterMenu",(()=>n()(C.ZP,{menuType:C.ZP.MenuType.ActionSheet},void 0,this.renderSuggestedFilters(),n()(Ee.Z,{title:this.renderMoreFiltersTitle()},void 0,this.renderCreatedByFilter(ue.Z.Mode.Button),this.renderCreatedTimeFilter(ue.Z.Mode.Button),this.renderLastEditedTimeFilter(ue.Z.Mode.Button),this.renderAncestorFilter(ue.Z.Mode.Button))))),l()(this,"closeAddFilterMenu",(()=>{const{buttonPopupStore:e}=this.stores;e.setState({...e.state,open:!1})})),l()(this,"styles",{sidebar:{paddingTop:12,paddingBottom:24,overflowY:"auto",overflowX:"hidden",flex:"0 0 220px",minHeight:400},sidebarHidden:{display:"none"},addFilterButtonMobile:{fontSize:this.props.isMobile?R.Z.fontSize.UISmall.mobile:R.Z.fontSize.UISmall.desktop,fontWeight:R.Z.fontWeight.medium,marginRight:-8}})}renderComponent(){return this.props.isMobile?this.props.mode===Oe.Button?this.renderAddButtonMobile():this.props.mode===Oe.Section?this.renderActiveFiltersMobile():void(0,Q.t1)(this.props.mode):this.renderSidebar()}renderActiveFiltersMobile(){const{searchStore:{state:e}}=this.props,t=B.De(e.query.filters);return n()(se.Z,{disableMobilePadding:!0,disableMobileBorders:!0},void 0,this.renderTitlesOnlyFilter(ue.z.Section),this.renderActiveFilters(t,ue.Z.Mode.Section))}renderAddButtonMobile(){const{buttonPopupStore:e}=this.stores;return n()(le.Z,{popupType:le.Z.PopupType.SlideUp,buttonPopupStore:e,renderOrigin:this.renderAddFilterOrigin,render:this.renderAddFilterMenu})}renderSidebar(){const{searchStore:e,searchStore:{state:t}}=this.props,i=this.styles,s=this.getThemeColors(),a=B.De(t.query.filters),o={...i.sidebar,...s.sidebar,...!e.isSidebarOpen()&&i.sidebarHidden};return n()("aside",{style:o},void 0,this.renderTitlesOnlyFilter(ue.z.Section),this.renderActiveFilters(a,ue.Z.Mode.Section),this.renderSuggestedFilters(),this.renderInactiveFilters(a))}renderActiveFilters(e,t){return n()(m().Fragment,{},void 0,e.createdBy&&this.renderCreatedByFilter(t),e.createdTime&&this.renderCreatedTimeFilter(t),e.lastEditedTime&&this.renderLastEditedTimeFilter(t),e.ancestors&&this.renderAncestorFilter(t))}renderInactiveFilters(e){if(!(e.ancestors&&e.createdBy&&e.createdTime&&e.lastEditedTime))return n()(Ee.Z,{title:this.renderMoreFiltersTitle(),marginAfter:!0},void 0,!e.ancestors&&this.renderAncestorFilter(ue.Z.Mode.Button),!e.createdBy&&this.renderCreatedByFilter(ue.Z.Mode.Button),!e.createdTime&&this.renderCreatedTimeFilter(ue.z.Button),!e.lastEditedTime&&this.renderLastEditedTimeFilter(ue.z.Button))}renderSuggestedFilters(){const{searchStore:e}=this.props,{filters:t}=e.state.query,i=ve.isActive(this.environment,t),s=ye.isActive(t),a=fe.isActive(t);if(!(i&&s&&a))return n()(Ee.Z,{title:n()(L.FormattedMessage,{id:"search.filterMenu.quickFiltersSection.title",defaultMessage:"Quick filters"}),marginAfter:!0},void 0,!i&&n()(ve,{mode:ge.MenuItem,searchStore:e,focused:!1,onMenuDismiss:this.closeAddFilterMenu}),!s&&n()(ye,{mode:ge.MenuItem,searchStore:e,focused:!1,onMenuDismiss:this.closeAddFilterMenu}),!a&&n()(fe,{mode:ge.MenuItem,searchStore:e,focused:!1,onMenuDismiss:this.closeAddFilterMenu,isLastInSection:!0}))}renderTitlesOnlyFilter(e){const{searchStore:t}=this.props,{filters:i}=t.state.query;return n()(Le,{mode:e,focused:!1,title:n()(L.FormattedMessage,{id:"search.filterMenu.onlyMatchTitlesToggle.label",defaultMessage:"Only match titles",description:"Label for only match titles toggle in search modal"}),icon:M.Z.typesTitle,value:i.isNavigableOnly,onChange:this.createUpdateFunction("isNavigableOnly")})}renderMoreFiltersTitle(){return n()(L.FormattedMessage,{id:"search.filterMenu.moreFiltersSection.title",defaultMessage:"More filters"})}renderAncestorFilter(e){const{searchStore:t,parentStore:i}=this.props,{filters:s}=t.state.query;return n()(Ae,{mode:e,focused:!1,title:n()(L.FormattedMessage,{id:"search.filterMenu.moreFilters.inPage",defaultMessage:"In page"}),parentStore:i,blockIds:s.ancestors,onMenuDismiss:this.closeAddFilterMenu,onChange:this.createUpdateFunction("ancestors")})}renderCreatedByFilter(e){const{searchStore:t,parentStore:i}=this.props,{filters:s}=t.state.query;return n()(Be,{mode:e,focused:!1,title:n()(L.FormattedMessage,{id:"search.filterMenu.moreFilters.createdBy",defaultMessage:"Created by"}),parentStore:i,userIds:s.createdBy,onMenuDismiss:this.closeAddFilterMenu,onChange:this.createUpdateFunction("createdBy")})}renderCreatedTimeFilter(e){const{searchStore:t}=this.props,{filters:i}=t.state.query;return n()(ce.Z,{mode:e,focused:!1,title:n()(L.FormattedMessage,{id:"search.filterMenu.moreFilters.created",defaultMessage:"Created"}),icon:M.Z.calendar,value:i.createdTime,onMenuDismiss:this.closeAddFilterMenu,onChange:this.createUpdateFunction("createdTime")})}renderLastEditedTimeFilter(e){const{searchStore:t}=this.props,{filters:i}=t.state.query;return n()(ce.Z,{mode:e,focused:!1,title:n()(L.FormattedMessage,{id:"search.filterMenu.moreFilters.lastEdited",defaultMessage:"Last edited"}),icon:M.Z.calendar,value:i.lastEditedTime,onMenuDismiss:this.closeAddFilterMenu,onChange:this.createUpdateFunction("lastEditedTime")})}createUpdateFunction(e){const{searchStore:t}=this.props;return i=>t.updateFilters({[e]:i})}getThemeColors(){return{sidebar:{backgroundColor:this.theme.sidebarSecondaryBackground,borderLeft:"1px solid ".concat(this.theme.regularDividerColor)}}}}const Ne=Ue;var Ve=i(78092);class We extends E.Z{constructor(...e){super(...e),l()(this,"openSidebar",(()=>{const{searchStore:e}=this.props;e.setState({...e.state,isSidebarOpen:!0})})),l()(this,"styles",{menuItem:{minHeight:0},menuItemMobile:{paddingBottom:8},titleWrapper:{flex:void 0},showSidebarButton:()=>{const{device:e}=this.environment;return{padding:"0 4px",fontSize:e.isMobile?R.Z.fontSize.UISmall.mobile:R.Z.fontSize.UISmall.desktop,fontWeight:R.Z.fontWeight.medium,borderRadius:3,height:20,lineHeight:"20px"}}})}renderComponent(){const{device:e}=this.environment,t=this.styles,i={...t.menuItem,...e.isMobile&&t.menuItemMobile},s=this.shouldAllowFilters()&&this.renderAddFilterButton();return n()(H.Z,{title:this.renderSortMenu(),right:s,textWrapperStyle:t.titleWrapper,style:i})}renderSortMenu(){const{searchStore:e}=this.props;return n()(Ve.Z,{currentSortBy:e.state.query.sort,setSortBy:t=>{(e.state.mode===ie.ZP.Mode.Default||e.state.mode===ie.ZP.Mode.Results)&&e.setState({...e.state,query:{...e.state.query,sort:t}})},sortOptions:this.sortOptions})}renderAddFilterButton(){const{device:e}=this.environment,{parentStore:t,searchStore:i}=this.props,s=this.styles;return e.isMobile?n()(Ne,{parentStore:t,searchStore:i,isMobile:!0,mode:Oe.Button}):i.isSidebarOpen()?void 0:n()(re.Z,{icon:M.Z.filterCircled,onClick:this.openSidebar,style:s.showSidebarButton(),isBlue:!0},void 0,n()(L.FormattedMessage,{defaultMessage:"Add filter",id:"search.header.addFilter.button.label"}))}shouldAllowFilters(){const{isPublicPageSearch:e}=this.props;return!e}get sortOptions(){return[{key:Y.As.Relevance,formattedName:n()(L.FormattedMessage,{id:"search.sort.sortOrder.bestMatches",defaultMessage:"Best matches"})},{key:Y.As.LastEditedNewest,formattedName:n()(L.FormattedMessage,{id:"search.sort.sortOrder.lastEdited.newestFirst",defaultMessage:"Last edited: Newest first"})},{key:Y.As.LastEditedOldest,formattedName:n()(L.FormattedMessage,{id:"search.sort.sortOrder.lastEdited.oldestFirst",defaultMessage:"Last edited: Oldest first"})},{key:Y.As.CreatedNewest,formattedName:n()(L.FormattedMessage,{id:"search.sort.sortOrder.created.newestFirst",defaultMessage:"Created: Newest first"})},{key:Y.As.CreatedOldest,formattedName:n()(L.FormattedMessage,{id:"search.sort.sortOrder.created.oldestFirst",defaultMessage:"Created: Oldest first"})}]}}const ze=We;var He=i(62727),qe=i(69454),Ge=i(70203),Ke=i(38755);class je extends E.Z{constructor(...e){super(...e),l()(this,"typingTimer",void 0),l()(this,"renderSpinner",(()=>{const{showSpinner:e}=this.props,t=this.styles,i={...this.getThemeColors().searchIcon,...t.searchIcon()};return n()(ae.Z,{show:e,showDelay:500,showHold:200,render:e=>e?n()(te.Z,{style:i}):M.Z.searchThick(i)})})),l()(this,"handleQueryChange",(e=>{const{searchStore:t,resultListStore:i}=this.props;this.handleTyping(),this.props.onKeyDown();const s=String(e.target.value);""===s?t.resetQuery({resetFilters:!1}):t.setState({...t.state,mode:ie.ZP.Mode.Results,query:{...t.state.query,text:s},limit:ie.Xv,allResultsLoaded:!1}),i.setState({...i.state,focus:{section:0,indexLocal:0,indexGlobal:0}})})),l()(this,"handleClearButtonClick",(()=>{const{searchStore:e}=this.props;e.resetQuery({resetFilters:!0}),e.setState({...e.state,isSidebarOpen:!1})})),l()(this,"handleFocus",(()=>{const{isFocusedStore:e}=this.props;e.get()||e.set(!0)})),l()(this,"handleBlur",(()=>{const{isFocusedStore:e}=this.props,{device:t}=this.environment;e.get()&&(e.set(!1),t.isMobileNative&&qe.Z.updateKeyboardPhase(qe.i.willHide,0))})),l()(this,"setTypingStart",(()=>{const{isTypingStore:e}=this.props;e.get()||e.set(!0)})),l()(this,"setTypingEnd",(()=>{const{isTypingStore:e}=this.props;e.set(!1)})),l()(this,"styles",{inputDesktop:{fontSize:18,height:je.DESKTOP_INPUT_HEIGHT,paddingLeft:16,paddingRight:16,flexGrow:0,flexShrink:0,zIndex:1},inputMobile:{fontSize:16,border:"none",boxShadow:"none",borderRadius:7,lineHeight:"1.2",padding:"6px 8px"},searchIcon:()=>{const{device:e}=this.environment;return{width:e.isMobile?16:18,height:e.isMobile?16:18,marginRight:e.isMobile?12:10,flexGrow:0,flexShrink:0}},input:{minWidth:0,...R.Z.textOverflowStyle},clearButton:{marginLeft:8}})}willUnmount(){this.typingTimer&&(clearTimeout(this.typingTimer),this.typingTimer=void 0)}renderComponent(){const{device:e}=this.environment,{isOpen:t,searchStore:{state:i}}=this.props,s=this.styles,a=this.getThemeColors(),o=e.isMobile?He.Z.Format.ExtraLarge:He.Z.Format.Transparent,r=e.isMobile?{...s.inputMobile,...a.inputMobile}:{...s.inputDesktop,...a.inputDesktop};return n()(He.Z,{format:o,placeholder:this.getPlaceholderText(),left:this.renderSpinner(),value:i.query.text,focus:e.isMobile?void 0:t,focusInitial:e.isMobile,focusAfterAnimation:!0,showClearButton:!0,selectAll:!0,onChange:this.handleQueryChange,onClearButtonClick:this.handleClearButtonClick,onFocus:this.handleFocus,onBlur:this.handleBlur,style:r,inputStyle:s.input,clearButtonStyle:s.clearButton})}handleTyping(){this.typingTimer&&window.clearTimeout(this.typingTimer),this.setTypingStart(),this.typingTimer=window.setTimeout(this.setTypingEnd,je.TYPING_DEBOUNCE_MS)}getPlaceholderText(){const{currentSpaceStore:e,currentBlockStore:t}=h.default.state,i=e&&(0,Ke.getSpaceName)(this.environment,e);if(i)return this.props.intl.formatMessage({id:"searchInputMenuItem.placeholder.namedSpace",defaultMessage:"Search {spaceName}…"},{spaceName:i});if(t){const e=Ge.Jc(t.getTitleValue()).slice(0,je.MAX_PLACEHOLDER_TITLE_LENGTH);return this.props.intl.formatMessage({id:"searchInputMenuItem.placeholder.namedPage",defaultMessage:"Search in {pageTitle}…"},{pageTitle:e})}return this.props.intl.formatMessage({id:"searchInputMenuItem.placeholder.unnamedPage",defaultMessage:"Search in page…"})}getThemeColors(){return{inputDesktop:{boxShadow:"0 1px 0 ".concat(this.theme.regularDividerColor)},inputMobile:{background:this.theme.inputBackground},searchIcon:{fill:this.theme.mediumIconColor}}}}l()(je,"TYPING_DEBOUNCE_MS",300),l()(je,"DESKTOP_INPUT_HEIGHT",52),l()(je,"MAX_PLACEHOLDER_TITLE_LENGTH",100);const Ye=(0,L.injectIntl)(je);var Qe=i(69988),Je=i(8934),Xe=i(74538),$e=i(94184),et=i.n($e);class tt extends E.Z{constructor(...e){super(...e),l()(this,"styles",{title:{fontWeight:R.Z.fontWeight.medium,lineHeight:"20px"},menuItem:{minHeight:36,paddingTop:this.environment.device.isMobile?12:8,paddingBottom:this.environment.device.isMobile?12:8},textWrapper:{marginLeft:8,alignItems:void 0,flex:void 0},inlineTextWrapper:{alignItems:"baseline"},highlight:{fontWeight:R.Z.fontWeight.medium},enterIcon:{height:14,width:14},caption:{marginTop:1}})}renderComponent(){const{focused:e,isLastInSection:t,isBeforeFocused:i,inline:s,className:o}=this.props,n=this.styles,r=this.getThemeColors(),l={...n.menuItem,...!s&&!t&&!i&&!e&&r.menuItemBorder},d={...n.caption,...r.caption},c={...n.textWrapper,...this.props.inline&&n.inlineTextWrapper};return m().createElement(I.Z,a()({},this.props,{title:this.renderTitle(),icon:this.renderIcon(),caption:this.renderCaption(),body:this.renderPreview(),right:this.renderEnterIcon(),disableTransition:!0,dontShrinkRight:!0,ignoreLocalHoverState:!0,captionStyle:d,style:l,textWrapperStyle:c,className:et()("notranslate",o)}))}renderTitle(){const{store:e,result:t,placeholder:i}=this.props,s=this.styles,a=this.getThemeColors(),o={...s.title,...this.hasAnyHighlight()&&a.highlightedTitle},r=this.getHighlightedWordsFromText(t&&t.highlight&&t.highlight.pathText);t&&t.isNavigable&&r.push(...this.getHighlightedWordsFromText(t&&t.highlight&&t.highlight.text));const l=this.getWordHighlighter(r);return n()(F.Z,{style:o,store:e,placeholder:i,highlighter:l})}renderIcon(){const{store:e}=this.props;return n()(Ce.Z,{disabled:!0,icon:e.getIcon(),isEmptyPage:e.isEmptyPage(),size:19})}renderCaption(){const{store:e,result:t,inline:i}=this.props;if(!this.hasPath())return;const s=this.getWordHighlighter(this.getHighlightedWordsFromText(t&&t.highlight&&t.highlight.pathText)),{device:a}=this.environment,o=i||a.isMobile?0:2;return n()(Je.Z,{store:e,extraLength:o,showFullPathInTooltip:!0,highlighter:s})}renderPreview(){const{result:e}=this.props;if(!e)return;if(!e.highlight)return;if(e.isNavigable)return;if(!e.highlight.text)return;const t=this.styles,i=this.getThemeColors(),s=e.highlight.text;return n()(Xe.Z,{text:s,highlighter:{tokenize:e=>(0,Qe.Vu)((0,Qe.ZP)(e)),style:{...t.highlight,...i.highlight}}})}getHighlightedWordsFromText(e){if(!e)return[];let t=(0,Qe.ZP)(e);return t.some((e=>(0,Qe.il)(e)&&1===(0,Qe.LX)(e).length))&&(t=(0,Qe.Vu)(t)),c()(t).filter(Qe.il).map(Qe.LX).uniq().value()}getWordHighlighter(e){if(0===e.length)return;const t=this.styles,i=this.getThemeColors();return{tokenize:t=>(0,Qe.Qu)(t,e),style:{...t.highlight,...i.highlight}}}renderEnterIcon(){const{device:e}=this.environment,{focused:t}=this.props,i=this.styles,s=this.getThemeColors();if(e.isMobile)return;const a={...i.enterIcon,...s.enterIcon,opacity:t?1:0};return M.Z.enter(a)}hasPath(){const{hidePath:e,store:t}=this.props;return!e&&(0,Je.L)(t)}hasAnyHighlight(){const{result:e}=this.props;if(!e)return!1;const{highlight:t}=e;return!!t&&Boolean(t.text||t.pathText)}getThemeColors(){return{highlightedTitle:{color:this.theme.mediumTextColor},menuItemBorder:{boxShadow:"0 1px 0 ".concat(this.theme.lightDividerColor)},highlight:{color:this.theme.regularTextColor},enterIcon:{fill:this.theme.mediumIconColor},caption:{color:this.theme.mediumTextColor}}}}l()(tt,"contextTypes",C.ff);const it=tt;var st=i(55320),at=i(74647),ot=i(15447),nt=i(15517),rt=i(63143),lt=i(12318),dt=i(88632),ct=i(15282),ut=i(472),mt=i(44615),pt=i(6650),gt=i(4708);class ht extends E.Z{constructor(...e){super(...e),l()(this,"inactiveTimer",void 0),l()(this,"spaceId",void 0),l()(this,"isOpen",!1),l()(this,"userPageVisitListenerReference",void 0),l()(this,"queryResultsSectionRef",m().createRef()),l()(this,"searchFilterMenuRef",m().createRef()),l()(this,"modalBodyMenuRef",m().createRef()),l()(this,"storeTypes",{searchStore:ie.ZP,resultListStore:w.Z,serverRequestStore:V.Z,localRequestStore:V.Z,localCacheRequestStore:V.Z,isTypingStore:lt.Z.of(!1),isInputFocusedStore:lt.Z.of(!1),approxNumQueriesRendered:lt.Z.of(0),selectedQueryResult:lt.Z.of(!1),numKeystrokes:lt.Z.of(0),numServerRequests:lt.Z.of(0),numLocalRequests:lt.Z.of(0),hadMetaClick:lt.Z.of(!1),serverEventProperties:lt.Z.of({})}),l()(this,"handleKeyDown",(()=>{this.stores.numKeystrokes.update((e=>e+1))})),l()(this,"resetSessionState",(()=>{this.stores.numKeystrokes.reset(),this.stores.selectedQueryResult.reset(),this.stores.approxNumQueriesRendered.reset(),this.stores.numServerRequests.reset(),this.stores.numLocalRequests.reset(),this.stores.hadMetaClick.reset(),this.stores.serverEventProperties.reset()})),l()(this,"renderBody",(e=>{const{device:t}=this.environment,{searchStore:{state:i}}=this.stores,s=this.layoutStyles,{currentSpaceStore:o}=h.default.state;return m().createElement(C.ZP,a()({},this.getMenuProps(e),{className:y.wJ,ref:this.modalBodyMenuRef}),n()("div",{style:s.body},void 0,!t.isMobile&&this.renderInput(),n()(N.Z,{requestStore:this.stores.localCacheRequestStore,request:o&&o.id,performRequest:this.performLocalCacheRequest,render:i.mode===ie.ZP.Mode.Results?this.renderResults:this.renderDefaultBody})),this.shouldShowSidebar()&&this.renderFilterMenu())})),l()(this,"renderDefaultBody",(()=>{const{device:e}=this.environment,{resultListStore:t}=this.stores,i=this.defaultViewStyles;if(!this.recentPageStores.state)return;const s=this.getInitialFocus(),a={mode:ie.ZP.Mode.Default,isMobile:e.isMobile,recentSearches:this.recentSearches.state,recentPages:this.recentPageStores.state};return n()(m().Fragment,{},void 0,n()("main",{style:i.wrapper},void 0,n()(Z.Z,{type:Z.Z.Type.Vertical,store:t,initialFocus:s,disableKeyboardArrowWrap:!0,sections:c().compact([this.getRecentPagesSection(),this.getRecentSearchesSection()])})),this.shouldShowFooter(a)&&this.renderFooter())})),l()(this,"renderResults",(()=>{const{device:e}=this.environment,{searchStore:t,serverRequestStore:i,localRequestStore:s}=this.stores,a={query:t.state.query,limit:t.state.limit};return n()(N.Z,{debounce:g.vp,requestStore:i,request:a,performRequest:this.performServerRequest,render:(t,i)=>n()(N.Z,{debounce:g.E5,requestStore:s,request:a,performRequest:(...e)=>Promise.resolve(this.performLocalRequest(...e)),render:(t,s)=>n()(m().Fragment,{},void 0,e.isMobile&&this.renderFilterMenu(),this.renderRequestResults({localResponse:s,serverResponse:i}))})})})),l()(this,"renderRequestResults",(e=>{const{device:t}=this.environment,{serverResponse:i,localResponse:s}=e,{serverRequestStore:a}=this.stores;if(!i&&!s)return;const o=B.ZC({localResponse:s,serverResponse:i,serverRequestStore:a});this.incrementApproxNumQueriesRendered();const r={mode:ie.ZP.Mode.Results,isMobile:t.isMobile,errorState:o};return n()(m().Fragment,{},void 0,this.shouldShowHeaderDesktop(r)&&this.renderHeader(),this.renderResultsSection({errorState:o,localResponse:s,serverResponse:i}),this.shouldShowFooter(r)&&this.renderFooter({localResponse:s,serverResponse:i}))})),l()(this,"renderSearchResult",((e,t)=>{const{store:i}=e,s=i.isNavigableBlock()?i:i.getNavigableBlockStore();if(s)return{key:"".concat(i.id,":").concat(t),action:t=>this.handleSelectResult({store:i,action:t,context:"query_results",source:e.source}),render:i=>m().createElement(it,a()({},i,{isFirstInSection:0===t,store:s,hidePath:!1,result:e,className:y.ul}))}})),l()(this,"handleComponentOpenClose",(()=>{this.isOpen!==st.default.state.open&&(this.isOpen=st.default.state.open,st.default.state.open?clearTimeout(this.inactiveTimer):this.addRecentSearch())})),l()(this,"getNumResultsAboveFold",(()=>B.MQ({environment:this.environment,searchResultsSection:this.queryResultsSectionRef.current,modalBodyMenu:this.modalBodyMenuRef.current,searchFilterMenu:this.searchFilterMenuRef.current}))),l()(this,"handleComponentClose",(()=>{const{device:e}=this.environment,{searchStore:t,approxNumQueriesRendered:i,selectedQueryResult:s,numKeystrokes:a,numServerRequests:o,numLocalRequests:n,serverEventProperties:r}=this.stores,l=s.get(),d=i.get(),c=a.get(),u=o.get(),m=n.get(),{query:g}=t.state;if(c>0&&(u>0||m>0)&&!l&&st.default.state.open){const e=Date.now();p.EH8(this.environment,{...r.get(),approxNumQueriesRendered:d,timeToAbandonMs:e-st.default.state.openedTimeMs,numKeystrokes:c,numResultsAboveFold:this.getNumResultsAboveFold(),searchSessionId:st.default.state.sessionId})}P.IB(),this.resetSessionState(),""===g.text.trim()?t.reset():B.FN(g.filters)||t.setState({...t.state,isSidebarOpen:!1}),this.inactiveTimer=window.setTimeout(this.resetState,2*rt.hM),e.isMobile&&at.close()})),l()(this,"handleRecentSearch",((e,t)=>{const{searchStore:i}=this.stores;i.setState({...i.state,query:e,mode:ie.ZP.Mode.Results,isSidebarOpen:!0})})),l()(this,"handleSelectResult",(({store:e,action:t,context:i,source:s})=>{const{searchStore:a,approxNumQueriesRendered:o,selectedQueryResult:n,numKeystrokes:r,hadMetaClick:l,serverEventProperties:d}=this.stores;if(!st.default.state.open)return;const{event:c}=t,u=c.metaKey||c.ctrlKey;"query_results"===i&&n.set(!0);const m=Date.now(),{openedTimeMs:g,sessionId:h}=st.default.state,{query:f}=a.state;p.nLf(this.environment,{...d.get(),context:i,queryStringLength:f.text.trim().length,hasFilters:B.FN(f.filters),selectedItemIndex:t.index,isNavigable:e.isNavigableBlock(),approxNumQueriesRendered:o.get(),numKeystrokes:r.get(),isMetaClick:Boolean(u),timeToSelectMs:m-g,source:s,hadMetaClick:l.get(),numResultsAboveFold:this.getNumResultsAboveFold(),searchSessionId:h}),W.navigateToPage(e,u,this.environment),u?l.set(!0):this.handleComponentClose()})),l()(this,"handleScrollOffsetChange",(e=>{const{searchStore:t,searchStore:{state:i},serverRequestStore:{state:s}}=this.stores;!(e<=ht.LOAD_MORE_RESULTS_SCROLL_OFFSET_PX)||s.loading||i.allResultsLoaded||t.setState({...i,limit:i.limit+ie.Xv})})),l()(this,"handleScrollResults",(()=>{this.stores.isInputFocusedStore.get()&&this.blurInputDebounced()})),l()(this,"handleSpaceChange",(()=>{const e=h.default.state.currentSpaceStore&&h.default.state.currentSpaceStore.id;this.spaceId!==e&&(this.spaceId=e,this.resetState(),this.fetchAndStoreRecentPages())})),l()(this,"fetchAndStoreRecentPages",(async()=>{const e=this.environment.currentUser.id;this.spaceId&&e&&(await ot.kX({environment:this.environment,userId:e,spaceId:this.spaceId}),this.recentPageStores.recompute())})),l()(this,"performLocalCacheRequest",(async()=>{const{currentSpaceStore:e,currentSpaceViewStore:t}=h.default.state;if(!this.getPublicAccessPermissionForPage()&&e)return B.hb({environment:this.environment,currentSpaceStore:e,currentSpaceViewStore:t})})),l()(this,"performLocalRequest",(e=>{const{query:t}=e,{localCacheRequestStore:i,numLocalRequests:s}=this.stores,a=i.state.result;if(!a)return;if(!t.text.trim())return;if(this.getPublicAccessPermissionForPage())return;s.update((e=>st.default.state.open?e+1:e));const o=ut.default.createMetric("rum.local_quick_search_query"),n=B.tz({input:e,cache:a});if(!n)return;if(0===n.results.length)return{error:Y.Ix.NoResults};const r=B.YB({sort:t.sort,unsorted:n.results,batchSize:ie.Xv,currentUserId:this.environment.currentUser.id}).results.map((e=>({...e,store:this.createBlockStore(e.id)}))),l=this.isOnline()?B.g8(this.environment,r):r,d=this.isOnline()?l.length:n.total;if(0===d)return{error:Y.Ix.NoResults};const c={value:{total:d,results:l}};return ut.default.emit(this.environment,o),c})),l()(this,"performServerRequest",(async e=>{const{searchStore:t,numServerRequests:i,serverEventProperties:s}=this.stores,{currentSpaceStore:a}=h.default.state,{query:o,limit:n}=e;if(!st.default.state.open)return;if(!o.text.trim()&&!B.FN(o.filters))return;if(!this.isOnline())return{error:Y.Ix.Offline};i.update((e=>e+1));const r=ut.default.createMetric("rum.server_quick_search_query"),l=await B.MS({environment:this.environment,input:e,currentSpaceStore:a,publicAccessPermission:this.getPublicAccessPermissionForPage(),searchSessionId:st.default.state.sessionId});if(!l)return;if("failed"===l.type)return l.offline?{error:Y.Ix.Offline}:{error:Y.Ix.RequestFailed};const d=l.data.trackEventProperties;if(st.default.state.open){const e={};Object.keys(d).forEach((t=>{e["server-".concat(t)]=d[t]})),s.setState(e)}if(0===l.data.results.length)return{error:Y.Ix.NoResults};const{results:c,total:u}=B.YB({sort:o.sort,unsorted:l.data.results,batchSize:ie.Xv,currentUserId:this.environment.currentUser.id});return t.setState({...t.state,allResultsLoaded:u<n}),ut.default.emit(this.environment,r),{value:{results:c.map((e=>({...e,store:this.createBlockStore(e.id)}))),total:l.data.total}}})),l()(this,"recentPageStores",this.createComputedStore((()=>{const{currentSpaceStore:e}=h.default.state,t=(e?ot.pp(e.id).slice(0,this.getMaxRecentPages()):[]).map(this.createBlockStore),i=t.map(A.js);return c().every(i)&&t.filter((e=>e.pathIsAlive()))}))),l()(this,"clearRecentlyVisitedPages",(()=>{const{currentSpaceStore:e}=h.default.state;e&&(ot.r$({currentUserId:this.environment.currentUser.id,spaceId:e.id}),this.recentPageStores.recompute())})),l()(this,"recentSearches",this.createComputedStore((()=>{const{currentSpaceStore:e}=h.default.state;return e?nt.KM({currentUserId:this.environment.currentUser.id,spaceId:e.id}).slice(0,ht.MAX_RECENT_SEARCHES):[]}))),l()(this,"clearRecentSearches",(()=>{const{currentSpaceStore:e}=h.default.state;e&&(nt.lU({currentUserId:this.environment.currentUser.id,spaceId:e.id}),this.recentSearches.recompute())})),l()(this,"addRecentSearch",(()=>{const{searchStore:e,serverRequestStore:t,localRequestStore:i}=this.stores,{currentSpaceStore:s}=h.default.state;if(!s)return;const{query:a}=e.state;if(!a.text.trim())return;const o=this.getCurrentResults(),n=o.local&&!i.state.loading,r=o.server&&!t.state.loading;(n||r)&&nt._({currentUserId:this.environment.currentUser.id,spaceId:s.id,query:a})})),l()(this,"createBlockStore",(e=>{const{parentStore:t}=this.props;return f.Z.createChildStore(t,{table:v.iU,id:e})})),l()(this,"shouldDismissKeyboardOnScroll",(()=>{const{device:e}=this.environment;return!!e.isMobile&&(!e.isIOS||e.isMobileNative)})),l()(this,"blurInput",(()=>{const{activeElement:e}=document;e instanceof HTMLInputElement&&e.blur()})),l()(this,"blurInputDebounced",c().debounce(this.blurInput,500,{leading:!0})),l()(this,"resetState",(()=>{const{searchStore:e,resultListStore:t,serverRequestStore:i,localRequestStore:s,localCacheRequestStore:a}=this.stores;e.reset(),t.reset(),i.reset(),s.reset(),a.reset(),st.default.reset()})),l()(this,"incrementApproxNumQueriesRendered",c().debounce((()=>{this.stores.approxNumQueriesRendered.update((e=>e+1))}),500)),l()(this,"searchIcon",(()=>M.Z.searchThick({height:14,width:14,marginLeft:2,marginRight:6,flexGrow:0,flexShrink:0,fill:this.theme.mediumIconColor}))),l()(this,"layoutStyles",{modalWithSidebar:{maxWidth:820},body:{flex:1,overflow:"hidden",display:"flex",flexDirection:"column"},scroller:{display:"flex",flexDirection:"row",flexWrap:"nowrap",justifyContent:"space-between",maxHeight:ht.MAX_MENU_HEIGHT},footer:{flexShrink:0}}),l()(this,"modalMenuStyles",{topbar:{height:void 0},topbarLeftInput:{marginLeft:10,marginTop:10,marginBottom:10},topbarRightButtonWrapper:{flex:void 0},topbarButton:{fontWeight:void 0}}),l()(this,"defaultViewStyles",{wrapper:{width:"100%",height:"100%",overflowX:"hidden",overflowY:"auto"},recentSection:{paddingTop:0,paddingBottom:8},recentTitle:{margin:0,padding:"0 14px",height:32,alignItems:"center",paddingTop:2},clearButton:{fontWeight:R.Z.fontWeight.medium,padding:0,background:"none",fontSize:12,height:void 0},clearButtonDesktop:{textTransform:"none",letterSpacing:"normal",padding:"0 4px",fontSize:R.Z.fontSize.UISmall.desktop,height:20,lineHeight:"20px",borderRadius:3}}),l()(this,"resultStyles",{results:{flex:1,display:"flex",flexDirection:"column",overflow:"auto",height:"100%"},messageMenuItem:{...this.environment.device.isMobile&&{background:void 0,boxShadow:void 0}}})}getMaxRecentPages(){const{device:e}=this.environment;return e.isMobile?5:7}willMount(){var e;this.spaceId=null===(e=h.default.state.currentSpaceStore)||void 0===e?void 0:e.id,this.fetchAndStoreRecentPages()}didMount(){st.default.addListener(this.handleComponentOpenClose),h.default.addListener(this.handleSpaceChange),this.recentPageStores.addListener(c().noop),this.listenToMessageStoreForPageVisits()}listenToMessageStoreForPageVisits(){var e;const t=null===(e=h.default.state.currentUserStore)||void 0===e?void 0:e.id;t&&(this.userPageVisitListenerReference=pt.Z.addListener((0,mt.Ns)(t),c().throttle(((e,i)=>this.addRecentPageFromMessage(t,i)),1e3),void 0,this.environment))}addRecentPageFromMessage(e,t){if("object"==typeof t&&t){var i,s;const e=null===(i=t.userPageVisit)||void 0===i?void 0:i.spaceId,a=null===(s=t.userPageVisit)||void 0===s?void 0:s.blockId;e&&a&&(ot.eJ({spaceId:e,pageId:a}),this.recentPageStores.recompute())}}willUnmount(){this.userPageVisitListenerReference&&(pt.Z.removeListener(this.userPageVisitListenerReference,this.environment),this.userPageVisitListenerReference=void 0),st.default.removeListener(this.handleComponentOpenClose),h.default.removeListener(this.handleSpaceChange),this.recentPageStores.removeListener(c().noop),this.inactiveTimer&&(clearTimeout(this.inactiveTimer),this.inactiveTimer=void 0)}renderComponent(){const{device:e}=this.environment,t=this.layoutStyles,i=Boolean(st.default.state.open),s={...this.getModalStyle(),...this.shouldShowSidebar()&&t.modalWithSidebar};return n()(k.Z,{open:i,onDismiss:this.handleComponentClose,modalStyle:s,disableAnimation:!e.isMobile,renderContent:()=>n()(b.Z,{capture:!0,ignoreBlockSelection:!0,focusOffscreenInput:!1,restoreSelection:!e.isMobile,render:()=>n()(S.Z,{capture:!0,allowMenuList:!0,render:this.renderBody})})})}getMenuProps(e){const{device:t}=this.environment,{searchStore:i}=this.stores,s=this.modalMenuStyles,a=this.getThemeColors();if(t.isMobile){const{mode:t}=i.state,o={...s.topbarButton,...a.topbarButton};return{menuType:C.og.Modal,left:this.renderInput(),shouldRenderLeftDirectly:!0,leftOuterStyle:s.topbarLeftInput,right:n()(ct.CancelMenuText,{}),onClickRight:this.handleComponentClose,rightOuterStyle:s.topbarRightButtonWrapper,header:this.shouldShowHeaderMobile({mode:t})&&this.renderHeader(),disableHeaderShadow:!0,topbarStyle:s.topbar,leftRightButtonStyle:o,onScroll:this.shouldDismissKeyboardOnScroll()?this.handleScrollResults:void 0,bodyScrollerClassName:y.GZ,...e}}return{menuType:C.og.Popup,maxHeight:ht.MAX_MENU_HEIGHT,minHeight:ht.MIN_MENU_HEIGHT,disableScroller:!0,scrollerStyle:this.layoutStyles.scroller,...e}}getPublicAccessPermissionForPage(){return B.bC(this.environment)}renderHeader(){const{parentStore:e}=this.props,{searchStore:t}=this.stores,i=Boolean(this.getPublicAccessPermissionForPage());return n()(ze,{parentStore:e,searchStore:t,isPublicPageSearch:i})}renderInput(){const{searchStore:e,resultListStore:t,isTypingStore:i,isInputFocusedStore:s}=this.stores;return n()(Ye,{isOpen:Boolean(st.default.state.open),searchStore:e,resultListStore:t,isTypingStore:i,isFocusedStore:s,showSpinner:this.showSpinner(),onKeyDown:this.handleKeyDown})}getRecentPagesSection(){const{device:e}=this.environment,t=this.defaultViewStyles,i=this.recentPageStores.state;if(!i||0===i.length)return;return{key:"recentlyVisitedPages",items:i.map(((t,i)=>({key:"".concat(t.id,":").concat(i),action:e=>this.handleSelectResult({store:t,action:e,context:"recent_pages"}),render:s=>m().createElement(it,a()({},s,{isFirstInSection:0===i,inline:!e.isMobile,store:t,hidePath:!1}))}))),render:i=>n()(Ee.Z,{title:n()(L.FormattedMessage,{id:"search.recentlyVisitedPages.title",defaultMessage:"Recent pages",description:"Title text for recently visited pages"}),desktopTitleStyle:t.recentTitle,desktopStyle:t.recentSection,right:(void 0!==i.focusedIndex||e.isMobile)&&this.renderClearRecentsButton(this.clearRecentlyVisitedPages)},i.key,n()("ul",{style:q.mK},void 0,i.children))}}getRecentSearchesSection(){const{device:e}=this.environment,{parentStore:t}=this.props,i=this.defaultViewStyles,s=this.recentSearches.state;if(0===s.length)return;return{key:"recentSearches",items:s.slice(0,ht.MAX_RECENT_SEARCHES).map(((e,i)=>({key:i,action:t=>this.handleRecentSearch(e,t),render:s=>n()("li",{},s.key,m().createElement(U,a()({},s,{isFirstInSection:0===i,parentStore:t,query:e,icon:this.searchIcon()})))}))),render:t=>n()(Ee.Z,{title:n()(L.FormattedMessage,{id:"search.recentSearches.title",defaultMessage:"Recent searches",description:"Title text for recent searches"}),desktopTitleStyle:i.recentTitle,desktopStyle:i.recentSection,right:(void 0!==t.focusedIndex||e.isMobile)&&this.renderClearRecentsButton(this.clearRecentSearches)},t.key,n()("ul",{style:q.mK},void 0,t.children))}}getInitialFocus(){if(this.stores.searchStore.state.query.text.trim())return;const e=this.recentPageStores.state;return e&&e.length>0?1:0}renderFooter(e){const{searchStore:t}=this.stores,i=this.layoutStyles,{mode:s}=t.state;if(s===ie.ZP.Mode.Default)return n()("footer",{style:i.footer},void 0,n()(ne,{mode:s}));const a=this.getCurrentResultsWithCount(e);return a?n()("footer",{style:i.footer},void 0,n()(ne,{mode:s,results:a,showSpinner:this.showSpinner()})):void 0}renderClearRecentsButton(e){const{device:t}=this.environment,i=this.defaultViewStyles,s=this.getThemeColors(),a={...i.clearButton,...s.clearButton,...!t.isMobile&&i.clearButtonDesktop};return n()(re.Z,{onClick:e,style:a},void 0,n()(L.FormattedMessage,{id:"search.clearRecentsButton.text",defaultMessage:"Clear",description:"Button text for clearing recent searches and pages"}))}renderResultsSection(e){const{localResponse:t,serverResponse:i,errorState:s}=e,{resultListStore:o}=this.stores,r=this.resultStyles,l=B.oO({environment:this.environment,results:this.getCurrentResults({localResponse:t,serverResponse:i}),isOnline:this.isOnline()}),d=l&&{key:"results",render:e=>m().createElement(se.Z,a()({},e,{shouldShowBottomDivider:!1,disableDesktopPadding:!0,disableMobilePadding:!0,disableMobileBorders:!0})),items:c().compact(l.map(this.renderSearchResult))};return m().createElement("section",{style:r.results,ref:this.queryResultsSectionRef},d&&n()(Z.Z,{type:Z.Z.Type.Vertical,initialFocus:0,store:o,disableKeyboardArrowWrap:!0,sections:[d]}),this.renderError(s)||n()(z.Z,{onChange:this.handleScrollOffsetChange}))}renderError(e){const{searchStore:t}=this.stores;if(!e.isLoading)return e.showMajorError?n()($,{error:e.serverError,searchStore:t}):e.serverError&&e.serverError!==Y.Ix.NoResults?this.renderMessage(e.serverError.message):void 0}renderFilterMenu(){const{device:e}=this.environment,{parentStore:t}=this.props,{searchStore:i}=this.stores,s=e.isMobile?{isMobile:!0,mode:Oe.Section}:{};return m().createElement(Ne,a()({parentStore:t,searchStore:i,ref:this.searchFilterMenuRef},s))}renderMessage(e){const t=this.resultStyles;return n()(se.Z,{disableMobilePadding:!0,disableMobileBorders:!0},void 0,n()(T.Z,{title:e,style:t.messageMenuItem}))}getCurrentResults(e){const{serverRequestStore:t,localRequestStore:i}=this.stores,s=e&&e.localResponse||i.state.result,a=e&&e.serverResponse||t.state.result;return{local:B.O7(s),server:B.O7(a)}}getCurrentResultsWithCount(e){const{serverRequestStore:t,localRequestStore:i}=this.stores,s=e&&e.localResponse||i.state.result,a=e&&e.serverResponse||t.state.result,o=B.b9(s),n=B.b9(a);return n&&o?{server:n,local:o}:n?{server:n,local:void 0}:o?{server:void 0,local:o}:void 0}isOnline(){return Boolean(dt.Z.state.online)}shouldShowSidebar(){const{device:e}=this.environment,{searchStore:t}=this.stores;if(!this.getPublicAccessPermissionForPage()&&!e.isMobile)return t.isSidebarOpen()}shouldShowHeaderDesktop(e){const{errorState:t,mode:i,isMobile:s}=e;if(s)return!1;if(i===ie.ZP.Mode.Default)return!1;if(t.isLoading){const e=this.getCurrentResults();return Boolean(e.local||e.server)}return!t.showMajorError}shouldShowHeaderMobile(e){const{mode:t}=e;return t===ie.ZP.Mode.Results}shouldShowFooter(e){const{isMobile:t}=e;if(t)return!1;if(e.mode===ie.ZP.Mode.Default){const t=e.recentSearches.length>0,i=e.recentPages.length>0;return Boolean(t||i)}if(e.errorState.isLoading){const e=this.getCurrentResults();return Boolean(e.local||e.server)}return!e.errorState.showMajorError}showSpinner(){const{searchStore:e,serverRequestStore:t,isTypingStore:i}=this.stores;return this.isOnline()&&e.state.mode===ie.ZP.Mode.Results&&!t.state.ready&&!i.get()}getThemeColors(){return{topbarButton:{color:this.theme.mediumTextColor},clearButton:{color:this.theme.lightTextColor}}}getModalStyle(){return{width:"75%",maxWidth:600,minHeight:ht.MIN_MENU_HEIGHT,maxHeight:ht.MAX_MENU_HEIGHT,background:(0,gt.GN)()?this.theme.popoverBackground:this.theme.cardContentBackground}}}l()(ht,"MAX_RECENT_SEARCHES",5),l()(ht,"LOAD_MORE_RESULTS_SCROLL_OFFSET_PX",200),l()(ht,"MIN_MENU_HEIGHT",50),l()(ht,"MAX_MENU_HEIGHT","80vh");const ft=ht},60969:(e,t,i)=>{i.d(t,{l:()=>m});var s=i(67154),a=i.n(s),o=i(98135),n=i.n(o),r=i(83071),l=i(66832),d=i(5366),c=i(67294),u=i.n(c);class m extends l.Z{renderComponent(){return u().createElement(r.Z,a()({},this.props,{title:n()(d.FormattedMessage,{id:"inviteUserModal.searchDropdown.selectPersonTitle",defaultMessage:"Select a person"})}))}}},92181:(e,t,i)=>{i.r(t),i.d(t,{Divider:()=>ot,InputLabelRow:()=>lt,PeopleRow:()=>ct,SidebarTeamModal:()=>ut});var s=i(98135),a=i.n(s),o=(i(33948),i(96486)),n=i.n(o),r=i(5366),l=i(67294),d=i.n(l),c=i(82990),u=i(58879),m=i(89940),p=i(64215),g=i(27832),h=i(96650),f=i(29716),v=i(62727),y=i(89206),M=i(15102),S=i(40039),b=i(13490),T=i(66957),C=i(41493),Z=i(32918),w=i(39336),k=i(31792),A=i(8646),P=i(32465),I=i(38978),x=i(67154),F=i.n(x),B=(i(41817),i(9714)),E=i(24813),R=i(29368),D=i(20260),_=i(86917),L=i(3779),O=i(8848);function U(e){const{pageIds:t}=e,[{currentSpaceStore:i}]=(0,m.oR)(g.default),s=(0,p.y)((e=>({teamSettingsLabel:{letterSpacing:"0.03em",textTransform:"uppercase",fontSize:11,lineHeight:1,marginBottom:1,color:e.mediumTextColor,fontWeight:c.Z.fontWeight.medium,paddingLeft:16,paddingRight:16,paddingTop:4,paddingBottom:8,textOverflow:"ellipsis",overflow:"hidden"},teamSettingsPage:{fontSize:14,paddingLeft:12,paddingRight:12}})),[]);return i?d().createElement(d().Fragment,null,a()("div",{style:s.teamSettingsLabel},void 0,a()(r.FormattedMessage,{id:"sidebarTeamModal.aboutScreenTopLevelPages.label",defaultMessage:"Team pages",description:"Top-level pages for the team"})),t.map((e=>{const t=B.Z.createChildStore(i,{table:"block",id:e,spaceId:i.id});return a()(E.Z,{store:t,style:s.teamSettingsPage,isAlias:!1,disableUnderline:!0,disabled:!0})}))):null}function N(e){const{teamId:t,currentSpaceStore:i}=e,[s,,o]=(0,m.oR)(f.Z.createChildStore(i,{table:"team",id:t,spaceId:null==i?void 0:i.id})),n=s.value,l=(0,u.O7)(),c=d().createElement(lt,F()({},e,{value:null==n?void 0:n.description,style:{fontSize:14},labelContainerStyle:{width:"100%",marginTop:l.device.isMobile?0:16},textarea:!0,autosize:!0,hideLabel:l.device.isMobile,placeholder:a()("div",{style:{display:"flex",alignItems:"center"}},void 0,L.Z.plus({width:14,height:14,marginRight:6,fill:O.ZP.mediumIconColor}),a()(r.FormattedMessage,{id:"sidebarTeamModal.aboutScreen.descriptionPlaceholder",defaultMessage:"Add description",description:"Placeholder for description prompting user to fill out the team description"})),onBlur:e=>{A.createAndCommit(l,(t=>{P.fs({store:o,update:{description:e},transaction:t})}))}}));return l.device.isMobile?d().createElement(d().Fragment,null,a()("div",{style:{paddingBottom:10}},void 0,c),a()(_.u,{teamStore:o,spaceStore:i})):d().createElement(d().Fragment,null,a()("div",{style:{paddingLeft:16,paddingRight:16}},void 0,!Boolean(null==n?void 0:n.archived_by)&&a()(D.M,{teamStore:o}),c,a()(R.Z,{size:26})),a()(U,{pageIds:(null==n?void 0:n.team_pages)||[]}))}var V=i(46951),W=i(47714),z=i(47966),H=i(86080),q=i(64684),G=i(47307),K=i(21115);function j(e){const{title:t,caption:i,on:s,onChange:o,disabled:n}=e,r=(0,p.y)((()=>({title:{fontSize:14,marginRight:8,flexGrow:1}})),[]);return d().createElement(d().Fragment,null,a()("div",{style:{display:"flex",alignItems:"center",width:"100%"}},void 0,a()("div",{style:r.title},void 0,t,a()(V.Z,{isSmall:!0,isMultiline:!0,style:{marginTop:2,width:"95%"}},void 0,i)),a()("div",{style:{marginTop:5,marginRight:18}},void 0,a()(W.Z,{on:s,disabled:n,onClick:o}))),a()(R.Z,{size:1,style:{marginTop:14,marginBottom:14}}))}function Y(e,t){const{store:i,teamValue:s,settingName:a}=t;A.createAndCommit(e,(e=>{P.fs({store:i,update:{settings:{...null==s?void 0:s.settings,[a]:!Boolean(((null==s?void 0:s.settings)||{})[a])}},transaction:e})}))}function Q(e){var t,i,s,o;const[n,l,c]=(0,m.oR)(e.teamStore),p=n.value,h=(0,u.O7)(),{canAdminSpace:f}=(0,m.VK)((()=>{var e;return{canAdminSpace:Boolean(null===(e=g.default.state.currentSpaceStore)||void 0===e?void 0:e.canAdmin())}}),[]),v=(0,m.VK)((()=>{var e;return!!f||!(!p||!h.currentUser.id)&&((0,q.pd)(p,h.currentUser.id)&&!(null!==(e=g.default.state.currentSpaceStore)&&void 0!==e&&e.getDisablePublicAccess()))}),[f,h.currentUser.id,p]),y=(0,m.VK)((()=>{var e;return!!f||!(!p||!h.currentUser.id)&&((0,q.pd)(p,h.currentUser.id)&&!(null!==(e=g.default.state.currentSpaceStore)&&void 0!==e&&e.getDisableGuests()))}),[f,h.currentUser.id,p]),M=(0,m.VK)((()=>{var e;return!!f||!(!p||!h.currentUser.id)&&((0,q.pd)(p,h.currentUser.id)&&!(null!==(e=g.default.state.currentSpaceStore)&&void 0!==e&&e.getDisableExport()))}),[f,h.currentUser.id,p]);return p&&h.currentUser.id&&p?d().createElement(d().Fragment,null,a()(b.Z,{hasMarginTop:!0},void 0,a()(r.FormattedMessage,{id:"sidebarTeamModalSettingsScreen.header.title",defaultMessage:"Security"})),a()(j,{on:Boolean(null===(t=p.settings)||void 0===t?void 0:t.disable_public_access),disabled:!v,onChange:async()=>{await async function(e,t){const{store:i,teamValue:s}=t;if(!i.getDisablePublicAccess()&&!(await G.confirmUserAction({message:a()(r.FormattedMessage,{id:"sidebarTeamModalSettingsScreen.preventPublicSharing.confirmationModal.message",defaultMessage:"Are you sure? This will remove access for anyone who is not a member or guest of the workspace from all pages in this team."}),acceptLabel:a()(r.FormattedMessage,{id:"sidebarTeamModalSettingsScreen.preventPublicSharing.confirmationModal.confirmButton.label",defaultMessage:"Yes"})})))return;Y(e,{store:i,teamValue:s,settingName:"disable_public_access"})}(h,{store:c,teamValue:p})},title:a()(r.FormattedMessage,{id:"sidebarTeamModalSettingsScreen.setting.shareTitle",defaultMessage:"Disable public page sharing"}),caption:a()(r.FormattedMessage,{id:"sidebarTeamModalSettingsScreen.setting.shareCaption",defaultMessage:"Disable the “Share to web” option in the Share menu for all pages in this team"})}),a()(j,{on:Boolean(null===(i=p.settings)||void 0===i?void 0:i.disable_team_page_edits),disabled:!(f||(0,q.pd)(p,h.currentUser.id)),onChange:()=>{Y(h,{store:c,settingName:"disable_team_page_edits",teamValue:p})},title:a()(r.FormattedMessage,{id:"sidebarTeamModalSettingsScreen.setting.topLockTitle",defaultMessage:"Lock top-level section"}),caption:a()(r.FormattedMessage,{id:"sidebarTeamModalSettingsScreen.setting.topLockCaption",defaultMessage:"Prevent members from creating, moving, re-ordering, or deleting top-level team pages"})}),a()(j,{on:Boolean(null===(s=p.settings)||void 0===s?void 0:s.disable_guests),disabled:!y,onChange:async()=>{await async function(e,t){const{store:i,teamValue:s}=t;if(!i.getDisableGuests()&&!(await G.confirmUserAction({message:a()(r.FormattedMessage,{id:"sidebarTeamModalSettingsScreen.disableGuests.confirmationModal.message",defaultMessage:"Are you sure? All page guests in this team will be removed."}),acceptLabel:a()(r.FormattedMessage,{id:"sidebarTeamModalSettingsScreen.disableGuests.confirmationModal.confirmButton.label",defaultMessage:"Yes"})})))return;Y(e,{store:i,teamValue:s,settingName:"disable_guests"})}(h,{store:c,teamValue:p})},title:a()(r.FormattedMessage,{id:"sidebarTeamModalSettingsScreen.setting.guestTitle",defaultMessage:"Disable guest"}),caption:a()(r.FormattedMessage,{id:"sidebarTeamModalSettingsScreen.setting.guestCaption",defaultMessage:"Disable inviting members external to this workspace"})}),a()(j,{on:Boolean(null===(o=p.settings)||void 0===o?void 0:o.disable_export),disabled:!M,onChange:()=>{Y(h,{store:c,settingName:"disable_export",teamValue:p})},title:a()(r.FormattedMessage,{id:"sidebarTeamModalSettingsScreen.setting.exportTitle",defaultMessage:"Disable export"}),caption:a()(r.FormattedMessage,{id:"sidebarTeamModalSettingsScreen.setting.exportCaption",defaultMessage:"Prevent exporting as Markdown, CSV, or PDF"})})):null}function J(e){const[t,,i]=(0,m.oR)(e.teamStore),s=t.value,{canAdminSpace:o}=(0,m.VK)((()=>{var e;return{canAdminSpace:Boolean(null===(e=g.default.state.currentSpaceStore)||void 0===e?void 0:e.canAdmin())}}),[]),n=(0,u.O7)();if(!s)return null;if(!n.currentUser.id)return null;if(!(o||(0,q.pd)(s,n.currentUser.id)))return null;return d().createElement(d().Fragment,null,a()(b.Z,{hasMarginTop:!0},void 0,a()(r.FormattedMessage,{id:"sidebarTeamModalSettingsScreen.dangerZone.title",defaultMessage:"Danger zone"})),Boolean(s.archived_by)?d().createElement(d().Fragment,null,a()(z.Z,{style:{marginTop:6},isLarge:!0,onClick:()=>{return e={teamName:s.name,teamStore:i},A.createAndCommit(n,(e=>{P.kt({store:i,transaction:e})})),void(0,K.JB)(e.teamName);var e}},void 0,a()(r.FormattedMessage,{id:"sidebarTeamModalSettingsScreen.dangerZone.restoreTeamButton",defaultMessage:"Restore team"})),a()(V.Z,{isSmall:!0,isMultiline:!0,style:{marginTop:8,width:"95%"}},void 0,a()(r.FormattedMessage,{id:"sidebarTeamModalSettingsScreen.dangerZone.restoreTeamCaption",defaultMessage:"Restoring this team will add the team from the sidebar for all team members that were previously added."}))):d().createElement(d().Fragment,null,a()(z.Z,{style:{marginTop:6},isLarge:!0,isRed:!0,onClick:()=>(async e=>{await H.b({message:a()("div",{style:{display:"flex",flexDirection:"column"}},void 0,a()(r.FormattedMessage,{id:"sidebarTeamModalSettingsScreen.dangerZone.archiveTeamConfirmHeader",defaultMessage:"Are you sure you want to archive this team?"}),a()(V.Z,{isMultiline:!0,style:{marginTop:8}},void 0,a()(r.FormattedMessage,{id:"sidebarTeamModalSettingsScreen.dangerZone.archiveTeamConfirmLabel",defaultMessage:"Archiving this team will remove the team from the sidebar for all team members. Type the team name to confirm."}))),acceptLabel:a()(r.FormattedMessage,{id:"sidebarTeamModalSettingsScreen.dangerZone.archiveTeamConfirmButton",defaultMessage:"Archive team"}),requiredInputValue:e.teamName})&&A.createAndCommit(n,(t=>P.aQ(n,{store:e.teamStore,transaction:t})))&&(0,K.CC)(e.teamName)})({teamName:s.name,teamStore:i})},void 0,a()(r.FormattedMessage,{id:"sidebarTeamModalSettingsScreen.dangerZone.archiveTeamButton",defaultMessage:"Archive team"})),a()(V.Z,{isSmall:!0,isMultiline:!0,style:{marginTop:8,width:"95%"}},void 0,a()(r.FormattedMessage,{id:"sidebarTeamModalSettingsScreen.dangerZone.archiveTeamCaption",defaultMessage:"Archiving this team will remove the team from the sidebar for all team members."}))))}function X(e){return d().createElement(d().Fragment,null,a()(Q,{teamStore:e.teamStore}),a()(J,{teamStore:e.teamStore}))}var $=i(77907),ee=i(27006),te=i(592),ie=i(19889),se=i(23596),ae=i(7567),oe=i(29369),ne=i(76464),re=i(38755),le=i(26825),de=i(72693),ce=i(33052),ue=i(63829),me=i(37235);function pe(e){const{iconComponent:t,label:i,name:s,permissionRoleSelectComponent:o,tag:n,tooltip:r,style:l}=e;return a()("div",{style:{display:"flex",flexDirection:"row",lineHeight:1.2,fontSize:14,width:"100%",minHeight:52,justifyContent:"space-between",alignItems:"center",...l}},void 0,a()("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"}},void 0,t,a()("div",{style:{display:"flex",flexDirection:"column",marginLeft:10,maxWidth:290}},void 0,a()("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"}},void 0,a()(V.Z,{},void 0,s),n),a()(V.Z,{isSmall:!0,isSecondaryColor:!1,isMultiline:!0},void 0,i))),a()(me.Z,{textWrap:!0,style:{width:200},disableTooltip:!r,placement:me.Z.Placement.Left,renderTooltip:()=>r,render:e=>d().createElement("span",e,o)}))}function ge(e){const{teamStore:t,numTeamMembers:i}=e,s=(0,u.O7)(),o=(0,r.useIntl)(),n=(0,m.VK)((()=>t.getTeamPermission()),[t]),l=(0,m.VK)((()=>{var e;const i=null==t?void 0:t.getValue(),s=null===(e=g.default.state.currentUserStore)||void 0===e?void 0:e.userId;return!(!i||!s)&&(0,q.pd)(i,s)}),[t]),d=(0,m.VK)((()=>{var e,i;const s=null===(e=t.getValue())||void 0===e||null===(i=e.permissions)||void 0===i?void 0:i.find((e=>"space_permission"===e.type)),a=o.formatMessage({id:"teamPermissionsSettings.team.disabledPermissionitem.description",defaultMessage:"Team level permission cannot be lower than the default workspace permission."});function n(e){return s&&e!==s.role&&(0,le.nl)(e,s.role)===s.role?{isDisabled:!0,disabledMessage:a}:void 0}return[{role:"editor",disabledInfo:n("editor")},{role:"read_and_write",disabledInfo:n("read_and_write")},{role:"comment_only",disabledInfo:n("comment_only")},{role:"reader",disabledInfo:n("reader")}]}),[o,t]),c=(0,p.F)(),h=n&&a()(ae.Z,{role:n.role,table:oe.e0,type:"team_permission",upgradeButtonName:"team_permission_item",disabled:!l,buttonStyle:{fontSize:12,marginRight:0,color:c.mediumTextColor},availableRoleItems:d,onChange:async e=>{const i={...n,role:e};await A.createAndCommit(s,(async e=>{await ne.ep({environment:s,store:t,permissionItems:[i],transaction:e})}))}}),{teamName:f,teamIcon:v}=(0,m.VK)((()=>({teamName:t.getName(),teamIcon:t.getIcon()})),[t]),y=a()(S.Z,{disabled:!0,title:f,icon:v,isEmptyPage:!1,size:se.Z.iconSize});return a()(pe,{permissionRoleSelectComponent:h,iconComponent:y,name:he(f),label:a()(r.FormattedMessage,{id:"teamPermissionSettings.teamPermissionItem.description",defaultMessage:"{num, plural, one {{num} team member} other {{num} team members}}",values:{num:i}})})}function he(e){return a()(r.FormattedMessage,e?{defaultMessage:"Team members of {teamName}",id:"TeamMembersTopSection.permissionItem.defaultAccessTeamName",values:{teamName:e}}:{defaultMessage:"Team members",id:"TeamMembersTopSection.permissionItem.defaultAccessWithoutTeamName"})}function fe(e){const{teamStore:t,teamOwnerIds:i}=e,s=(0,p.F)(),{teamName:o,teamIcon:n}=(0,m.VK)((()=>({teamName:t.getName(),teamIcon:t.getIcon()})),[t]);return a()(pe,{tooltip:a()(r.FormattedMessage,{id:"TeamOwnersPermissionRow.teamOwnersRowTooltip",defaultMessage:"Team owners have full access to team pages by default"}),permissionRoleSelectComponent:a()(ae.Z,{role:"editor",table:oe.e0,type:"team_permission",upgradeButtonName:"team_permission_item",disabled:!0,buttonStyle:{fontSize:12,marginRight:0,color:s.mediumTextColor},availableRoleItems:[]}),iconComponent:a()(S.Z,{disabled:!0,title:o,icon:n,isEmptyPage:!1,size:se.Z.iconSize}),name:ve(o),label:a()(r.FormattedMessage,{id:"teamPermissionSettings.teamPermissionItem.description",defaultMessage:"{num, plural, one {{num} team owner} other {{num} team owners}}",values:{num:i.length}})})}function ve(e){return a()(r.FormattedMessage,e?{defaultMessage:"Team owners of {teamName}",id:"TeamOwnersPermissionRow.permissionItem.teamOwnersAccessToggleName",values:{teamName:e}}:{defaultMessage:"Team owners",id:"TeamOwnersPermissionRow.permissionItem.teamOwnersAccessToggleNameWithoutTeamName"})}i(99244);function ye({rows:e}){const t=(0,p.y)((e=>({container:{borderRadius:5,border:"1px solid ".concat(e.darkDividerColor),marginTop:12},rowContainer:{paddingLeft:14,paddingRight:14}})),[]),i=a()(R.Z,{vertical:!1,size:1});return a()("div",{style:t.container},void 0,e.flatMap(((s,o)=>{const n=o===e.length-1,r=a()("div",{style:t.rowContainer},void 0,s);return n?[r]:[r,i]})))}function Me({title:e,subtitle:t}){const i=(0,p.y)((e=>({base:{width:"100%"},title:{fontWeight:c.Z.fontWeight.medium,color:e.regularTextColor,fontSize:14},subtitle:{fontWeight:c.Z.fontWeight.regular,color:e.mediumTextColor,fontSize:12}})),[]);return a()("div",{style:i.base},void 0,a()("div",{style:i.title},void 0,e),t&&a()("div",{style:i.subtitle},void 0,t))}function Se(e){const{teamStore:t}=e,i=(0,u.O7)(),s=(0,p.F)(),[{currentSpaceStore:o,currentUserStore:n}]=(0,m.oR)(g.default),l=(0,m.VK)((()=>t.getSpacePermission()),[t]),d=(0,m.VK)((()=>{const e=null==t?void 0:t.getValue(),i=null==n?void 0:n.userId;return!(!e||!i)&&(0,q.pd)(e,i)}),[t,n]),c=(0,m.VK)((()=>l&&"none"!==l.role?a()(ae.Z,{role:l.role,table:oe.e0,type:"space_permission",upgradeButtonName:"space_permission_item",disabled:!d,buttonStyle:{fontSize:12,color:s.mediumTextColor,marginRight:0},availableRoleItems:[{role:"editor"},{role:"read_and_write"},{role:"comment_only"},{role:"reader"}],onChange:async e=>{const s={...l,role:e};await A.createAndCommit(i,(async e=>{await ne.ep({environment:i,store:t,permissionItems:[s],transaction:e})}))}}):a()("div",{style:{display:"flex",alignItems:"center"}},void 0,L.Z.locked({width:14,height:14,fill:s.errorText,marginRight:4}),a()("div",{style:{fontSize:12,color:s.errorText,marginRight:l&&"none"!==l.role?10:8}},void 0,a()(r.FormattedMessage,{id:"teamPermissionsSettings.closedTeam.noAccessLabel",defaultMessage:"No access"})))),[l,s.errorText,s.mediumTextColor,d,i,t]),{iconComponent:h,spaceName:f}=(0,m.VK)((()=>{if(!o)return{iconComponent:void 0,spaceName:void 0};const e=(0,re.getSpaceName)(i,o);return{iconComponent:a()(S.Z,{disabled:!0,title:e,icon:(0,re.getSpaceIcon)(i,o),isEmptyPage:!1,size:se.Z.iconSize}),spaceName:e}}),[o,i]),v=(0,m.VK)((()=>{const e=null==t?void 0:t.getValue(),i=null==o?void 0:o.getValue();if(!e||!i||!o)return;return(0,re.getSpacePermissionItems)(o).filter((e=>(0,ee.J5)((0,ee.cY)(e)))).length}),[o,t]);return a()(pe,{permissionRoleSelectComponent:a()("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"}},void 0,c),iconComponent:h,name:be(f),label:a()(r.FormattedMessage,{id:"teamPermissionSettings.openSpacePermissionItem.description",defaultMessage:"{num, plural, one {{num} workspace member} other {{num} workspace members}}",values:{num:v}})})}function be(e){return a()(r.FormattedMessage,e?{defaultMessage:"Everyone else in {spaceName}",id:"TeamMembersTopSection.permissionItem.defaultAccessSpaceName",values:{spaceName:e}}:{defaultMessage:"Everyone else in the workspace",id:"TeamMembersTopSection.permissionItem.defaultAccessWithoutSpaceName"})}function Te({teamStore:e}){const t=(0,m.VK)((()=>e.getIsClosedTeam()),[e]),i=(0,u.O7)(),[{currentSpaceStore:s,currentUserStore:o}]=(0,m.oR)(g.default),n=(0,m.VK)((()=>{const t=e.getValue();return t&&(0,q.XO)(t)}),[e]),l=(0,m.VK)((()=>{var t;const i=e.getValue(),a=null==s?void 0:s.getValue(),o=null!==(t=null==n?void 0:n.length)&&void 0!==t?t:0;return i&&a&&(0,q.Xk)(i,a).length-o}),[s,n,e]),c=(0,m.VK)((()=>{const e=null==o?void 0:o.id,t=e&&(null==n?void 0:n.find((t=>t===e)));return Boolean(t)}),[null==o?void 0:o.id,n]);return d().createElement(d().Fragment,null,a()("div",{style:{marginTop:22,display:"flex"}},void 0,function(e){if(e)return a()(Me,{title:a()(r.FormattedMessage,{id:"TeamMembersTopSection.header.privateTeamTitle",description:"Header that says the team is private (meaning other members of the workspace cannot join it",defaultMessage:"Private team"}),subtitle:a()(r.FormattedMessage,{id:"TeamMembersTopSection.header.privateTeamSubtitle",description:"Subtitle that explains what it means for the current team to be a private team",defaultMessage:"Only invited team members have access to this team"})});return a()(Me,{title:a()(r.FormattedMessage,{id:"TeamMembersTopSection.header.openTeamTitle",description:"Header that says the team is open (meaning other members of the workspace can join it",defaultMessage:"Open team"}),subtitle:a()(r.FormattedMessage,{id:"TeamMembersTopSection.header.openTeamSubtitle",description:"Subtitle that explains what it means for the current team to be an open team.",defaultMessage:"Everyone in the workspace can access this team's pages"})})}(t),c&&a()(ue.p,{isClosedTeam:t,onChange:t=>{P.DI({environment:i,isClosed:t,store:e})}})),a()(ye,{rows:Ce({teamStore:e,teamOwnerIds:n,numTeamMembers:l})}))}function Ce({teamStore:e,teamOwnerIds:t,numTeamMembers:i}){const s=[];return t&&s.push(a()(fe,{teamStore:e,teamOwnerIds:t})),void 0!==i&&s.push(a()(ge,{teamStore:e,numTeamMembers:i})),s.push(a()(Se,{teamStore:e})),s}i(85827);var Ze=i(84882),we=i(43250),ke=i(46167),Ae=i(42001),Pe=i(25584),Ie=i(71202),xe=i(83071),Fe=i(48762),Be=i(97880),Ee=i(60709),Re=i(61766),De=i(67669),_e=i(92251),Le=i(58762),Oe=i(24736);function Ue(e){const{teamStore:t,memberInfo:i,permissionItem:s,memberName:o,focused:n,onMenuItemClicked:f}=e,[{currentUserStore:v,currentSpaceViewStore:y,currentSpaceStore:M}]=(0,m.oR)(g.default),S=(0,u.O7)(),b=(0,r.useIntl)(),T=(0,p.F)(),C=(0,l.useMemo)((()=>new Re.Z),[]),Z="on"===(0,u.aq)("teams-settings-members"),w=(0,p.y)((e=>({header:{display:"flex",flexDirection:"column",backgroundColor:e.sidebarSecondaryBackground,fontSize:12,color:e.mediumTextColor,alignItems:"flex-start",paddingTop:10,paddingLeft:12,paddingRight:12,paddingBottom:10}})),[]),k=(0,m.VK)((()=>t.getTeamPermission()),[t]),I=(0,m.VK)((()=>{var e,i;return null==t||null===(e=t.getValue())||void 0===e||null===(i=e.permissions)||void 0===i?void 0:i.find((e=>"space_permission"===e.type))}),[t]),x=(0,m.VK)((()=>{const e=null==t?void 0:t.getValue(),i=null==v?void 0:v.userId;return!(!e||!i)&&(0,q.pd)(e,i)}),[t,v]),B=(0,m.VK)((()=>{const e=null==v?void 0:v.userId;return"user"===i.entity_type&&i.user_id===e}),[null==v?void 0:v.userId,i]),E=(0,m.VK)((()=>{const e=null==t?void 0:t.getValue();if(Z){const t=b.formatMessage({id:"teamMemberPermissionRoleSelect.member.permissionitem.description",defaultMessage:"You can't give less access than the team default."}),i=a()(r.FormattedMessage,{id:"teamMemberPermissionRoleSelect.permissionItem.defaultTag",defaultMessage:"default"});function s(i){return e&&(0,q.bk)(e,i)?{isDisabled:!0,disabledMessage:t}:void 0}return["editor","read_and_write","comment_only","reader"].map((e=>({role:e,disabledInfo:s(e),tag:(null==k?void 0:k.role)===e?i:void 0})))}if("owner"===i.type){return[{role:"editor",disabledInfo:{isDisabled:!0,disabledMessage:b.formatMessage({id:"teamMemberPermissionRoleSelect.owner.permissionitem.description",defaultMessage:"Team owners will always have full access to team pages."})}},{role:"none"}]}if("member"===i.type){const t=b.formatMessage({id:"teamMemberPermissionRoleSelect.member.permissionitem.description",defaultMessage:"You can't give less access than the team default."});function i(i){return e&&(0,q.bk)(e,i)?{isDisabled:!0,disabledMessage:t}:void 0}return[{role:"editor",disabledInfo:i("editor")},{role:"read_and_write",disabledInfo:i("read_and_write")},{role:"comment_only",disabledInfo:i("comment_only")},{role:"reader",disabledInfo:i("reader")},{role:"none"}]}return[{role:"editor"},{role:"read_and_write"},{role:"comment_only"},{role:"reader"},{role:"none"}]}),[k,b,i.type,Z,t]),D=(0,m.VK)((()=>"member"===i.type?s.role!==(null==k?void 0:k.role)?d().createElement(d().Fragment,null,a()("div",{style:w.header},void 0,a()(V.Z,{isMultiline:!0,isSmall:!0},void 0,a()(r.FormattedMessage,{id:"teamMemberPermissionRoleSelect.member.permissionItem.overrideDescription",defaultMessage:"This member has more permissions than the team default."})),a()(Ae.Z,{isSmall:!0,onClick:async()=>{await async function(e,t,i){const s={...t,role:"none"};await A.createAndCommit(e,(async t=>{await ne.ep({environment:e,store:i,permissionItems:[s],transaction:t})}))}(S,s,t),C.setState({open:!1}),f&&f()},style:{marginLeft:-6,marginTop:4,marginBottom:-6,fontSize:12,fontWeight:c.Z.fontWeight.medium}},void 0,a()(r.FormattedMessage,{defaultMessage:"Restore team default",id:"teamMemberPermissionRoleSelect.member.permissionItem.restoreButton"}))),a()(R.Z,{vertical:!1,size:1})):d().createElement(d().Fragment,null,a()("div",{style:w.header},void 0,a()(r.FormattedMessage,{id:"teamMemberPermissionRoleSelect.member.permissionItem.defaultDescription",defaultMessage:"Give the member more permissions than the team default."})),a()(R.Z,{vertical:!1,size:1})):"owner"===i.type&&Z?d().createElement(d().Fragment,null,a()("div",{style:w.header},void 0,a()(Ae.Z,{isSmall:!0,onClick:()=>{G.showDialog({message:a()(r.FormattedMessage,B?{id:"teamMemberPermissionSettings.removeSelfTeamOwner.confirmation.message",defaultMessage:"Are you sure you want to remove yourself as a team owner? You'll no longer be able to edit team settings and permissions."}:{id:"teamMemberPermissionSettings.removeTeamOwner.confirmation.message",defaultMessage:"Are you sure you want to remove {name} as a team owner? They'll no longer be able to edit team settings and permissions.",values:{name:o}}),showCancel:!0,keepFocus:!1,handleCancel:G.dismissDialog,items:[{label:a()(r.FormattedMessage,{id:"teamMemberPermissionSettings.permissionSwitcher.accept",defaultMessage:"Change access"}),color:"red",onAccept:async()=>{await A.createAndCommit(S,(async e=>await P.mX({userId:i.user_id,teamStore:t,transaction:e,environment:S})))&&K.Pr(o),C.setState({open:!1})}}]})},style:{marginLeft:-6,marginTop:4,marginBottom:-6,fontSize:12,fontWeight:c.Z.fontWeight.medium}},void 0,a()(r.FormattedMessage,{id:"teamMemberPermissionRoleSelect.owner.permissionItem.downgradeButton.new",defaultMessage:"Downgrade to default member"}))),a()(R.Z,{vertical:!1,size:1})):void 0),[C,null==k?void 0:k.role,S,B,i,o,f,s,Z,w.header,t]),_=(0,m.VK)((()=>{const s=null==t?void 0:t.getValue();if(s)if("owner"===i.type){if(!(0,q.O3)(s,i.user_id))return d().createElement(d().Fragment,null,a()(R.Z,{vertical:!1,size:1}),d().createElement(Fe.Z,F()({},e,{focused:!1,style:{marginTop:6,marginBottom:6},title:a()(r.FormattedMessage,{id:"teamMemberPermissionRoleSelect.owner.permissionItem.downgradeButton",defaultMessage:"Downgrade to member"}),onClick:()=>{G.showDialog({message:a()(r.FormattedMessage,B?{id:"teamMemberPermissionSettings.removeSelfTeamOwner.confirmation.message",defaultMessage:"Are you sure you want to remove yourself as a team owner? You'll no longer be able to edit team settings and permissions."}:{id:"teamMemberPermissionSettings.removeTeamOwner.confirmation.message",defaultMessage:"Are you sure you want to remove {name} as a team owner? They'll no longer be able to edit team settings and permissions.",values:{name:o}}),showCancel:!0,keepFocus:!1,handleCancel:G.dismissDialog,items:[{label:a()(r.FormattedMessage,{id:"teamMemberPermissionSettings.permissionSwitcher.accept",defaultMessage:"Change access"}),color:"red",onAccept:async()=>{await A.createAndCommit(S,(async e=>await P.mX({userId:i.user_id,teamStore:t,transaction:e,environment:S})))&&K.Pr(o),C.setState({open:!1})}}]})}})))}else if("member"===i.type){const e=e=>d().createElement(Fe.Z,F()({style:{marginTop:6,marginBottom:6}},e,{disabled:"group"===i.entity_type,disabledFeedback:"group"===i.entity_type,focused:!1,title:a()(r.FormattedMessage,{id:"teamMemberPermissionRoleSelect.member.permissionItem.upgradeButton",defaultMessage:"Make team owner"}),onClick:()=>{G.showDialog({message:a()(r.FormattedMessage,{id:"teamMemberPermissionSettings.makeTeamOwner.confirmation.message",defaultMessage:"Are you sure you want to make {name} a team owner? They will be able to edit team settings and permissions.",values:{name:o}}),showCancel:!0,keepFocus:!1,handleCancel:G.dismissDialog,items:[{label:a()(r.FormattedMessage,{id:"teamMemberPermissionSettings.permissionSwitcher.accept",defaultMessage:"Change access"}),color:"red",onAccept:async()=>{if("user"===i.entity_type){await A.createAndCommit(S,(async e=>await P.F8({userId:i.user_id,teamStore:t,transaction:e,environment:S})))&&K.vA(o)}C.setState({open:!1})}}]})}}));return d().createElement(d().Fragment,null,a()(R.Z,{vertical:!1,size:1}),a()(me.Z,{renderTooltip:()=>"group"===i.entity_type&&a()(r.FormattedMessage,{id:"teamMemberPermissionSettings.makeMemberOwner.group.disabledMessage",defaultMessage:"Permission groups cannot be team owners."}),render:e,placement:me.Z.Placement.Left}))}}),[C,S,i,o,e,t,B]);return a()(ae.Z,{role:Z&&"owner"===i.type?"none":s.role,table:oe.e0,type:"user"===i.entity_type?"user_permission":"group_permission",upgradeButtonName:"user"===i.entity_type?"user_permission_item":"group_permission_item",disabled:!x,buttonStyle:{marginRight:0,fontSize:12,color:T.mediumTextColor},availableRoleItems:E,header:D,footer:Z?void 0:_,onChange:e=>{!function(e){if("none"===e&&B){var s,n;const e=null==t?void 0:t.getValue();if(!e)return;"owner"===i.type&&(0,q.O3)(e,i.user_id)?G.showDialog({message:a()(r.FormattedMessage,{id:"teamMemberPermissionSettings.leaveTeamAsLastOwner.confirmation.message",defaultMessage:"You can't leave this team"}),description:a()(r.FormattedMessage,{id:"teamMemberPermissionSettings.leaveTeamAsLastOwner.confirmation.description",defaultMessage:"You can't leave this team because you're the only owner. Invite another owner to leave this team"}),showCancel:!0,keepFocus:!1,handleCancel:G.dismissDialog,items:[{label:a()(r.FormattedMessage,{id:"teamMemberPermissionSettings.leaveTeamAsLastOwner.invitePeople",defaultMessage:"Invite people"}),color:"blue",onAccept:()=>{h.ZP.setState({...h.ZP.state,open:!0,tab:h.aj.People,selectedTeamId:t.id})}}]}):((null==y||null===(s=y.getValue())||void 0===s||null===(n=s.joined_teams)||void 0===n?void 0:n.length)||0)<2?G.showDialog({message:a()(r.FormattedMessage,{id:"teamMemberPermissionSettings.leaveLastTeam.confirmation.message",defaultMessage:"You can't leave this team"}),description:a()(r.FormattedMessage,{id:"teamMemberPermissionSettings.leaveLastTeam.confirmation.description",defaultMessage:"You can't leave this team because you only belong to one team. Join another team to leave this team"}),showCancel:!0,keepFocus:!1,handleCancel:G.dismissDialog,items:[{label:a()(r.FormattedMessage,{id:"teamMemberPermissionSettings.leaveLastTeam.joinTeam",defaultMessage:"Join teams"}),color:"blue",onAccept:()=>{M&&(0,_e.tn)(S,{spaceStore:M})}}]}):G.showDialog({message:a()(r.FormattedMessage,{id:"teamMemberPermissionSettings.leaveTeam.confirmation.message",defaultMessage:"Are you sure you want to leave this team?"}),description:I&&"none"!==I.role?a()(r.FormattedMessage,{id:"teamMemberPermissionSettings.leaveOpenTeam.confirmation.description",defaultMessage:"Leaving this team means you'll no longer see this team in your sidebar."}):a()(r.FormattedMessage,{id:"teamMemberPermissionSettings.leaveCloseTeam.confirmation.description",defaultMessage:"Leaving this team means you'll lose access to all pages in this team and no longer see it in your sidebar."}),showCancel:!0,keepFocus:!1,handleCancel:G.dismissDialog,items:[{label:a()(r.FormattedMessage,{id:"teamMemberPermissionSettings.leaveTeam.confirmationButton.leaveTeam",defaultMessage:"Leave team"}),color:"red",onAccept:async()=>{if(M&&t){await Le.updateTeamMembers(S,{spaceId:M.id,teamId:t.id,existingMembersToRemove:[i]});const e=t.getName();e&&K.e6(e)}C.setState({open:!1})}}]})}else G.showDialog({message:a()(r.FormattedMessage,{id:"teamMemberPermissionSettings.permissionSwitcher.confirmation.message",defaultMessage:"Are you sure you want to change {name}'s role to {role}?",values:{name:o,role:(0,De.r_)(e).toLowerCase()}}),description:a()(r.FormattedMessage,{id:"teamMemberPermissionSettings.permissionSwitcher.confirmation.description",defaultMessage:"This change won't apply to any restricted pages in the team."}),showCancel:!0,keepFocus:!1,handleCancel:G.dismissDialog,items:[{label:a()(r.FormattedMessage,{id:"teamMemberPermissionSettings.permissionSwitcher.accept",defaultMessage:"Change access"}),color:"red",onAccept:async()=>{const s=A.create(S),a=await P.jg({memberInfo:i,teamStore:t,spaceStore:M,transaction:s,environment:S,permissionRole:e});await A.commit({environment:S,transaction:s});const n=t.getName();a&&n&&"none"===e&&K.oi({memberName:o,teamName:n})}}]})}(e),f&&f()},buttonPopupStore:C,origin:Z&&a()(Oe.Z,{onClick:()=>C.setState({open:!0}),isMobile:S.device.isMobile,style:{opacity:n||S.device.isMobile?1:0}})})}function Ne({teamStore:e,memberInfo:t,permissionItem:i,memberName:s,isPermissionOverriden:o,disabled:n}){const l=(0,m.qz)(void 0,Re.Z),[d,c]=(0,m.oR)(l),p=(0,u.O7)(),[{currentUserStore:f,currentSpaceViewStore:v,currentSpaceStore:y}]=(0,m.oR)(g.default),M=(0,m.VK)((()=>{const t=null==e?void 0:e.getValue(),i=null==f?void 0:f.userId;return!(!t||!i)&&(0,q.O3)(t,i)}),[e,f]),S=(0,m.VK)((()=>{const e=null==f?void 0:f.userId;return"user"===t.entity_type&&t.user_id===e}),[null==f?void 0:f.userId,t]),b=(0,m.VK)((()=>{var t,i;return null==e||null===(t=e.getValue())||void 0===t||null===(i=t.permissions)||void 0===i?void 0:i.find((e=>"space_permission"===e.type))}),[e]),T=()=>c({...d,open:!1}),C=i=>{T(),"owner"===i?G.showDialog({message:a()(r.FormattedMessage,{id:"teamMemberPermissionSettings.makeTeamOwner.confirmation.message",defaultMessage:"Are you sure you want to make {name} a team owner? They will be able to edit team settings and permissions.",values:{name:s}}),showCancel:!0,keepFocus:!1,handleCancel:G.dismissDialog,items:[{label:a()(r.FormattedMessage,{id:"teamMemberPermissionSettings.permissionSwitcher.accept",defaultMessage:"Change access"}),color:"red",onAccept:async()=>{if("user"===t.entity_type){const i=A.create(p),a=await P.F8({userId:t.user_id,teamStore:e,transaction:i,environment:p});await A.commit({environment:p,transaction:i}),a&&K.vA(s)}}}]}):G.showDialog({message:a()(r.FormattedMessage,S?{id:"teamMemberPermissionSettings.removeSelfTeamOwner.confirmation.message",defaultMessage:"Are you sure you want to remove yourself as a team owner? You'll no longer be able to edit team settings and permissions."}:{id:"teamMemberPermissionSettings.removeTeamOwner.confirmation.message",defaultMessage:"Are you sure you want to remove {name} as a team owner? They'll no longer be able to edit team settings and permissions.",values:{name:s}}),showCancel:!0,keepFocus:!1,handleCancel:G.dismissDialog,items:[{label:a()(r.FormattedMessage,{id:"teamMemberPermissionSettings.permissionSwitcher.accept",defaultMessage:"Change access"}),color:"red",onAccept:async()=>{if("user"===t.entity_type){const i=A.create(p),a=await P.mX({userId:t.user_id,teamStore:e,transaction:i,environment:p});await A.commit({environment:p,transaction:i}),a&&K.Pr(s)}}}]})},Z=()=>{if(T(),S){var i,o;if(!(null==e?void 0:e.getValue()))return;"owner"===t.type&&M?G.showDialog({message:a()(r.FormattedMessage,{id:"teamMemberPermissionSettings.leaveTeamAsLastOwner.confirmation.message",defaultMessage:"You can't leave this team"}),description:a()(r.FormattedMessage,{id:"teamMemberPermissionSettings.leaveTeamAsLastOwner.confirmation.description",defaultMessage:"You can't leave this team because you're the only owner. Invite another owner to leave this team"}),showCancel:!0,keepFocus:!1,handleCancel:G.dismissDialog,items:[{label:a()(r.FormattedMessage,{id:"teamMemberPermissionSettings.leaveTeamAsLastOwner.invitePeople",defaultMessage:"Invite people"}),color:"blue",onAccept:()=>{h.ZP.setState({...h.ZP.state,open:!0,tab:h.aj.People,selectedTeamId:e.id})}}]}):((null==v||null===(i=v.getValue())||void 0===i||null===(o=i.joined_teams)||void 0===o?void 0:o.length)||0)<2?G.showDialog({message:a()(r.FormattedMessage,{id:"teamMemberPermissionSettings.leaveLastTeam.confirmation.message",defaultMessage:"You can't leave this team"}),description:a()(r.FormattedMessage,{id:"teamMemberPermissionSettings.leaveLastTeam.confirmation.description",defaultMessage:"You can't leave this team because you only belong to one team. Join another team to leave this team"}),showCancel:!0,keepFocus:!1,handleCancel:G.dismissDialog,items:[{label:a()(r.FormattedMessage,{id:"teamMemberPermissionSettings.leaveLastTeam.joinTeam",defaultMessage:"Join teams"}),color:"blue",onAccept:()=>{y&&(0,_e.tn)(p,{spaceStore:y})}}]}):G.showDialog({message:a()(r.FormattedMessage,{id:"teamMemberPermissionSettings.leaveTeam.confirmation.message",defaultMessage:"Are you sure you want to leave this team?"}),description:b&&"none"!==b.role?a()(r.FormattedMessage,{id:"teamMemberPermissionSettings.leaveOpenTeam.confirmation.description",defaultMessage:"Leaving this team means you'll no longer see this team in your sidebar."}):a()(r.FormattedMessage,{id:"teamMemberPermissionSettings.leaveCloseTeam.confirmation.description",defaultMessage:"Leaving this team means you'll lose access to all pages in this team and no longer see it in your sidebar."}),showCancel:!0,keepFocus:!1,handleCancel:G.dismissDialog,items:[{label:a()(r.FormattedMessage,{id:"teamMemberPermissionSettings.leaveTeam.confirmationButton.leaveTeam",defaultMessage:"Leave team"}),color:"red",onAccept:async()=>{if(y&&e){await Le.updateTeamMembers(p,{spaceId:y.id,teamId:e.id,existingMembersToRemove:[t]});const i=e.getName();i&&K.e6(i)}l.setState({open:!1})}}]})}else G.showDialog({message:a()(r.FormattedMessage,{id:"teamMemberPermissionSettings.removeMember.confirmation.message",defaultMessage:"Are you sure you want to remove {name} from the team?",values:{name:s}}),description:a()(r.FormattedMessage,{id:"teamMemberPermissionSettings.removeMember.confirmation.description",defaultMessage:"This change won't apply to any restricted pages in the team."}),showCancel:!0,keepFocus:!1,handleCancel:G.dismissDialog,items:[{label:a()(r.FormattedMessage,{id:"teamMemberPermissionSettings.removeMember.accept",defaultMessage:"Remove"}),color:"red",onAccept:async()=>{if(y&&e){const i=await Le.updateTeamMembers(p,{spaceId:y.id,teamId:e.id,existingMembersToRemove:[t]}),a=e.getName();"success"===i.type&&a&&K.oi({memberName:s,teamName:a})}}}]})};return a()(ke.Z,{buttonPopupStore:l,placementToOrigin:Ee.Iw.Bottom,renderOrigin:e=>a()(We,{buttonPopupEvents:e,isPermissionOverriden:o,permissionItem:i,memberInfo:t,disabled:n}),render:()=>a()(Ve,{teamStore:e,isPermissionOverriden:o,memberInfo:t,permissionItem:i,memberName:s,onMenuItemClicked:C,onRemoveClicked:Z,onSubMenuItemClicked:T}),popupType:ke.Z.PopupType.Popup})}function Ve({teamStore:e,isPermissionOverriden:t,memberInfo:i,permissionItem:s,memberName:o,onRemoveClicked:n,onMenuItemClicked:l,onSubMenuItemClicked:c}){const m=(0,p.y)((e=>({removeButton:{color:e.errorText},menuItem:{width:250},indentedMenuItem:{width:250,paddingLeft:20}})),[]),g=((0,u.O7)(),(i,n,r)=>{const u="owner"===i&&"group"===n.entity_type;return{key:i,action:()=>l(i),render:r=>d().createElement(Fe.Z,F()({},r,{style:n.type===i?m.menuItem:m.indentedMenuItem,disabled:u,disabledFeedback:u,title:a()(ze,{isPermissionOverriden:t,type:i,permissionItem:s}),caption:qe(i),shouldWrapCaption:!0,icon:n.type===i?L.Z.check({width:14}):void 0,right:"member"===i&&d().createElement(Ue,F()({},r,{teamStore:e,memberInfo:n,permissionItem:s,memberName:o,onMenuItemClicked:c}))}))}}),h=[{key:"teamRoles",items:[g("owner",i),g("member",i),{key:"remove",action:n,render:e=>d().createElement(Fe.Z,F()({},e,{style:{...m.removeButton,...m.indentedMenuItem},title:a()(r.FormattedMessage,{id:"TeamMemberOwnerSelect.remove",defaultMessage:"Remove"})}))}],render:e=>d().createElement(xe.Z,F()({},e,{topBorder:0!==e.index}))}];return a()(Ie.ZP,{className:we.a6,menuType:Ie.ZP.MenuType.Popup},void 0,a()(Pe.Z,{type:Pe.Z.Type.Vertical,initialFocus:void 0,sections:h}))}function We({buttonPopupEvents:e,disabled:t,isPermissionOverriden:i,permissionItem:s,memberInfo:o}){const n=(0,p.y)((e=>({label:{color:i?e.regularTextColor:e.mediumTextColor,fontSize:12,fontWeight:c.Z.fontWeight.regular},overrideLabel:{color:e.mediumTextColor,fontSize:12,fontWeight:c.Z.fontWeight.regular},button:{...i&&{backgroundColor:e.whiteButtonHoveredBackground}},chevron:{width:10,marginLeft:4,fill:e.lightIconColor}})),[i]),r=He(o.type),l=Ge(s.role);return d().createElement(Ae.Z,F()({style:n.button,disabled:t},e),i&&a()("span",{style:n.overrideLabel},void 0,l),a()("span",{style:n.label},void 0,r),!t&&L.Z.chevronDown(n.chevron))}function ze({isPermissionOverriden:e,permissionItem:t,type:i}){const s=(0,p.y)((e=>({overrideLabel:{color:e.mediumTextColor,fontSize:12,fontWeight:c.Z.fontWeight.regular}})),[]),o=He(i),n=Ge(t.role);return a()("div",{},void 0,a()("span",{},void 0,o),e&&"member"===i&&a()("span",{style:s.overrideLabel},void 0,n))}function He(e){switch(e){case"owner":return a()(r.FormattedMessage,{id:"TeamMemberOwnerSelect.ownerLabel",defaultMessage:"Team owner"});case"member":return a()(r.FormattedMessage,{id:"TeamMemberOwnerSelect.memberLabel",defaultMessage:"Member"});case"team_level_guest":return a()(r.FormattedMessage,{id:"TeamMemberOwnerSelect.guestLabel",defaultMessage:"Guest"});default:(0,Be.t1)(e)}}function qe(e){switch(e){case"owner":return a()(r.FormattedMessage,{id:"TeamMemberOwnerSelect.ownerCaption",defaultMessage:"Full access to team pages and can edit team settings"});case"member":return a()(r.FormattedMessage,{id:"TeamMemberOwnerSelect.memberCaption",defaultMessage:"Access to team pages but cannot edit team settings"});case"team_level_guest":return;default:(0,Be.t1)(e)}}function Ge(e){switch(e){case"none":return a()(r.FormattedMessage,{id:"TeamMemberOwnerSelect.roleName.none",defaultMessage:"No access"});case"reader":return a()(r.FormattedMessage,{id:"TeamMemberOwnerSelect.roleName.reader",defaultMessage:"Can view"});case"comment_only":return a()(r.FormattedMessage,{id:"TeamMemberOwnerSelect.roleName.comment_only",defaultMessage:"Can comment"});case"content_only_editor":return a()(r.FormattedMessage,{id:"TeamMemberOwnerSelect.roleName.content_only_editor",defaultMessage:"Can edit content"});case"read_and_write":return a()(r.FormattedMessage,{id:"TeamMemberOwnerSelect.roleName.read_and_write",defaultMessage:"Can edit"});case"editor":return a()(r.FormattedMessage,{id:"TeamMemberOwnerSelect.roleName.editor",defaultMessage:"Full access"});default:(0,Be.t1)(e)}}var Ke=i(26524);function je(e){const t=(0,r.useIntl)(),i=(0,p.F)(),{store:s,memberInfo:o,permissionItem:n,userStore:l,permissionGroup:u,isMemberSpaceAdmin:h}=e,f=(0,m.VK)((()=>"user"===o.entity_type?l&&(0,ie.Nz)(t,l.getValue())||"":u&&u.name||t.formatMessage({defaultMessage:"Unknown Group",id:"teamPermissionSettings.unknownGroup"})),[t,o.entity_type,u,l]),[{currentUserStore:v}]=(0,m.oR)(g.default),y=(0,m.VK)((()=>{const e=null==s?void 0:s.getValue(),t=null==v?void 0:v.userId;return!(!e||!t)&&(0,q.pd)(e,t)}),[s,v]),M=(0,m.VK)((()=>{var e;return"owner"!==o.type&&n.role!==(null===(e=s.getTeamPermission())||void 0===e?void 0:e.role)}),[o.type,n.role,s]),b=a()("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"}},void 0,M&&a()(me.Z,{allowHover:!0,style:{width:220},textWrap:!0,renderTooltip:e=>d().createElement("div",e,a()(r.FormattedMessage,{defaultMessage:"Overrides the default team permission and won’t inherit any team permission changes.",id:"teamPermissionSettings.member.permissionItem.overrideWarning"})),placement:me.Z.Placement.Left,render:e=>d().createElement("div",e,L.Z.squareExclamation({width:14,height:14,fill:i.mediumIconColor,marginRight:4}))}),a()(Ne,{teamStore:s,memberInfo:o,permissionItem:n,memberName:f,isPermissionOverriden:M,disabled:!y})),T=(0,m.VK)((()=>"user"===o.entity_type?l&&a()(Ze.Z,{avatarShouldShowShadow:!0,userValue:l.getValue(),size:se.Z.iconSize}):a()(S.Z,{bucket:"public",disabled:!0,onChange:()=>{},isEmptyPage:!1,title:f,size:32,icon:void 0})),[o.entity_type,f,l]),C=(0,m.VK)((()=>{var e;if("user"===o.entity_type)return l&&(null===(e=l.getValue())||void 0===e?void 0:e.email)||"";{var t;const e=u&&(null===(t=u.user_ids)||void 0===t?void 0:t.length)||"?";return"".concat(e," group members")}}),[o.entity_type,u,l]),Z=(0,p.y)((e=>({row:{minHeight:57},pill:{marginLeft:6,height:17},pillInner:{display:"flex",height:"100%",alignItems:"center",color:e.regularTextColor,fontWeight:c.Z.fontWeight.regular,textTransform:"unset",fontSize:11}})),[]);return a()(pe,{style:Z.row,tag:h?a()(Ke.Z,{desktopStyle:Z.pill,mobileStyle:Z.pill,innerStyle:Z.pillInner},void 0,a()(r.FormattedMessage,{defaultMessage:"Admin",description:"Label that shows on a team member row that identifies that member as a workspace admin.",id:"SpecificTeamMemberPermissionRow.permissionItem.rolePill.admin"})):void 0,permissionRoleSelectComponent:b,iconComponent:T,name:f,label:C})}function Ye({store:e,sortType:t}){const i=(0,u.Fy)(),s=(0,p.F)(),[o]=(0,m.oR)(h.ZP),l=(0,m.VK)((()=>{const t=null==e?void 0:e.getValue();if(!t)return[];return(0,q.hY)(t)}),[e]),[{currentUserStore:d,currentSpaceStore:c}]=(0,m.oR)(g.default),f=(0,m.VK)((()=>{if(!c)return{};const e=n().compact(l.map((e=>"user"===e.entity_type?e.user_id:void 0)));return n().mapValues(function({userIds:e,spaceStore:t}){const i=e.reduce(((e,t)=>(e[t]=void 0,e)),{});return t.getPermissionItems().forEach((e=>{"user_permission"===e.type&&e.user_id in i&&(i[e.user_id]=e.role)})),i}({userIds:e,spaceStore:c}),(e=>"editor"===e))}),[c,l]),v=(0,m.VK)((()=>n().compact(l.map((t=>{const i="user"===t.entity_type&&d?I.Z.createChildStore(d,{table:ie.KJ,id:t.user_id}):void 0,s="group"===t.entity_type?null==c?void 0:c.getPermissionGroups().find((e=>e.id===t.group_id)):void 0;if("user"===t.entity_type&&!i||"group"===t.entity_type&&!s)return;const a=function(){var i,s,a,o;const n=null===(i=e.getValue())||void 0===i||null===(s=i.permissions)||void 0===s?void 0:s.find((e=>(0,ee.hV)(e)&&"group"===t.entity_type&&e.group_id===t.group_id||(0,ee.jg)(e)&&"user"===t.entity_type&&t.user_id===e.user_id));if(n)return n;const r=null===(a=e.getValue())||void 0===a||null===(o=a.permissions)||void 0===o?void 0:o.find((e=>"team_permission"===e.type));return r?"group"===t.entity_type?{type:"group_permission",role:null==r?void 0:r.role,group_id:t.group_id}:{type:"user_permission",role:null==r?void 0:r.role,user_id:t.user_id}:void 0}();return a?{memberInfo:t,isSpaceAdmin:Boolean("user"===t.entity_type&&f[t.user_id]),permissionItem:a,user:i,group:s}:void 0})))),[c,d,f,l,e]),y=(0,m.VK)((()=>{const e={data:v,sortAscending:t.sortedAscending};return"role"===t.column?function({data:e,sortAscending:t}){const i=["owner","member","team_level_guest"],s=["user","group"];return[...e].sort(((e,a)=>{const o=e.memberInfo.type,n=a.memberInfo.type,r=e.memberInfo.entity_type,l=a.memberInfo.entity_type;if(o===n&&r===l)return 0;let d=0;return d=o===n&&r===l?0:o!==n?i.indexOf(o)-i.indexOf(n):s.indexOf(r)-s.indexOf(l),t?-d:d}))}(e):function({data:e,sortAscending:t}){return[...e].sort(((e,i)=>{var s,a;const o=null!==(s=Qe(e))&&void 0!==s?s:"",n=null!==(a=Qe(i))&&void 0!==a?a:"";if(o===n)return 0;const r=o<n?-1:1;return t?-r:r}))}(e)}),[v,t.column,t.sortedAscending]),M=(0,m.VK)((()=>""===o.memberFilterQuery?y:y.filter((e=>{var t;const i=o.memberFilterQuery.toLowerCase();return(null!==(t=Qe(e))&&void 0!==t?t:"").toLowerCase().includes(i)}))),[y,o.memberFilterQuery]),S={};let b=te.xm.Y;return i.isMobile?(S.backgroundColor=s.contentBackground,b=te.xm.None):S.maxHeight="calc(70vh - 80px)",a()("div",{style:{flexGrow:1,flexShrink:1,display:"flex",flexDirection:"column"}},void 0,a()(te.ZP,{style:S,type:b},void 0,a()("div",{style:{boxShadow:"0 1px 0 ".concat(s.regularDividerColor),width:"100%"}},void 0,0===M.length&&a()("div",{style:{fontSize:14,marginTop:8,color:s.mediumTextColor}},void 0,a()(r.FormattedMessage,{id:"teamPermissionSettings.member.search.zeroState",defaultMessage:"No members found"})),M.map((t=>{if(t.memberInfo&&t.permissionItem)return a()(je,{memberInfo:t.memberInfo,isMemberSpaceAdmin:t.isSpaceAdmin,permissionItem:t.permissionItem,userStore:t.user,permissionGroup:t.group,store:e})})))))}function Qe(e){var t,i,s;return e.user?null!==(i=null===(s=e.user.getName())||void 0===s?void 0:s.name)&&void 0!==i?i:e.user.getEmail():null===(t=e.group)||void 0===t?void 0:t.name}function Je({sortType:e,onChangeSortType:t}){const i=(0,p.y)((e=>({container:{width:"100%",display:"flex",justifyContent:"space-between"}})),[]),s=t=>t===e.column?e.sortedAscending?"ascending":"descending":"none",o=i=>{const s=i===e.column&&!e.sortedAscending;t({column:i,sortedAscending:s})};return d().createElement(d().Fragment,null,a()("div",{style:i.container},void 0,a()(Xe,{title:a()(r.FormattedMessage,{id:"TeamPermissionsListHeader.nameColumn",defaultMessage:"Name"}),sortedType:s("name"),onClick:()=>o("name")}),a()(Xe,{title:a()(r.FormattedMessage,{id:"TeamPermissionsListHeader.roleColumn",defaultMessage:"Role"}),sortedType:s("role"),onClick:()=>o("role")})),a()(R.Z,{size:1}))}function Xe({sortedType:e,title:t,onClick:i}){const s=(0,p.y)((e=>({button:{color:e.mediumTextColor,fontWeight:c.Z.fontWeight.medium,padding:0},buttonHover:{background:"unset"},sortIcon:{width:14,height:14,marginRight:5}})),[]);return a()(Ae.Z,{style:s.button,hoveredStyle:s.buttonHover,onClick:i},void 0,"ascending"===e&&L.Z.arrowUp(s.sortIcon),"descending"===e&&L.Z.arrowDown(s.sortIcon),t)}function $e({teamStore:e}){const t=(0,p.F)(),i=(0,p.y)((e=>({container:{marginTop:32},input:{boxShadow:e.inputBoxShadow,borderRadius:3,fontSize:14,width:"50%"},inputAndAddMembersRow:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:15},membersListRow:{marginTop:26}})),[]),[s,o]=(0,m.oR)(h.ZP),[n,d,c]=(0,m.oR)(void 0,ce.Z),[u,g]=(0,l.useState)({column:"role",sortedAscending:!1}),f=L.Z.searchThick({width:14,height:14,marginRight:6,flexGrow:0,flexShrink:0,fill:t.mediumIconColor});return a()("div",{style:i.container},void 0,a()(Me,{title:a()(r.FormattedMessage,{defaultMessage:"Members",id:"TeamMembersListSection.generalSection.members"})}),a()("div",{style:i.inputAndAddMembersRow},void 0,a()(v.Z,{placeholder:"Filter by name or email...",style:i.input,value:s.memberFilterQuery,onChange:e=>{o({...s,memberFilterQuery:e.target.value})},left:f}),a()($.LazyTeamPermissionsInviteWithModal,{store:e,permissionsInviteStore:c,origin:a()(de.Z,{isLarge:!0,onClick:()=>{d({...n,modalOpen:!0})}},void 0,a()(r.FormattedMessage,{id:"teamPermissionsInviteWithModal.openModal",defaultMessage:"Add members"}))})),a()("div",{style:i.membersListRow},void 0,a()(Je,{sortType:u,onChangeSortType:e=>{g(e)}})),a()(Ye,{store:e,sortType:u}))}function et(e){const{teamStore:t}=e,i=(0,u.O7)(),s=(0,p.F)(),o=(0,r.useIntl)(),[{currentSpaceStore:n,currentUserStore:l}]=(0,m.oR)(g.default),d=(0,m.VK)((()=>{var e,i;if(t&&t.getValue())return null===(e=t.getValue())||void 0===e||null===(i=e.permissions)||void 0===i?void 0:i.find((e=>"space_permission"===e.type))}),[t]),c=(0,m.VK)((()=>{const e=null==t?void 0:t.getValue(),i=null==l?void 0:l.userId;return!(!e||!i)&&(0,q.pd)(e,i)}),[t,l]),h=(0,m.VK)((()=>d&&"none"!==d.role?a()(ae.Z,{role:d.role,table:oe.e0,type:"space_permission",upgradeButtonName:"space_permission_item",disabled:!c,buttonStyle:{fontSize:12,color:s.mediumTextColor,marginRight:0},availableRoleItems:[{role:"editor"},{role:"read_and_write"},{role:"comment_only"},{role:"reader"}],onChange:async e=>{const s={...d,role:e};await A.createAndCommit(i,(async e=>{await ne.ep({environment:i,store:t,permissionItems:[s],transaction:e})}))}}):a()("div",{style:{display:"flex",alignItems:"center"}},void 0,L.Z.locked({width:14,height:14,fill:s.mediumIconColor,marginRight:4}),a()("div",{style:{fontSize:12,color:s.mediumTextColor,marginRight:d&&"none"!==d.role?10:8}},void 0,a()(r.FormattedMessage,{id:"teamPermissionsSettings.closedTeam.noAccessLabel",defaultMessage:"No access"})))),[d,s.mediumIconColor,s.mediumTextColor,c,i,t]),f=(0,m.VK)((()=>a()("div",{style:{marginLeft:8}},void 0,a()(W.Z,{on:d&&"none"!==d.role||!1,onClick:()=>{G.showDialog({message:d&&"none"!==d.role?a()(r.FormattedMessage,{id:"teamPermissionsSettings.openTeamToClose.dialogDescription",defaultMessage:"Are you sure you want to remove access for everyone in the workspace? Only team members will have access and new members must join by invite."}):a()(r.FormattedMessage,{id:"teamPermissionsSettings.closeTeamToOpen.dialogDescription",defaultMessage:"Are you sure you want to give everyone in the workspace access to pages in this team?"}),showCancel:!0,keepFocus:!1,handleCancel:G.dismissDialog,items:[{label:d&&"none"!==d.role?a()(r.FormattedMessage,{id:"teamPermissionsSettings.openTeamToClose.accept",defaultMessage:"Remove access"}):a()(r.FormattedMessage,{id:"teamPermissionsSettings.closeTeamToOpen.accept",defaultMessage:"Give everyone access"}),color:"red",onAccept:()=>{const e={type:"space_permission",role:d&&"none"!==d.role?"none":"editor"};A.createAndCommit(i,(s=>{ne.ep({environment:i,store:t,permissionItems:[e],transaction:s})}))}}]})},disabled:!c}))),[i,c,d,t]),{iconComponent:v,spaceName:y}=(0,m.VK)((()=>{if(!n)return{iconComponent:void 0,spaceName:void 0};const e=(0,re.getSpaceName)(i,n);return{iconComponent:a()(S.Z,{disabled:!0,title:e,icon:(0,re.getSpaceIcon)(i,n),isEmptyPage:!1,size:se.Z.iconSize}),spaceName:e}}),[n,i]),M=(0,m.VK)((()=>{const e=null==t?void 0:t.getValue(),i=null==n?void 0:n.getValue();if(!e||!i||!n)return"";const s=(0,re.getSpacePermissionItems)(n).filter((e=>ee.J5(ee.cY(e))));return o.formatMessage({id:"teamPermissionSettings.openSpacePermissionItem.description",defaultMessage:"{num, plural, one {{num} workspace member} other {{num} workspace members}}"},{num:s.length})}),[n,o,t]);return a()(pe,{permissionRoleSelectComponent:a()("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"}},void 0,h,c&&f),iconComponent:v,name:y?a()(r.FormattedMessage,{defaultMessage:"Everyone at {spaceName}",id:"teamPermissionsSettings.permissionItem.defaultAccessSpaceName",values:{spaceName:y}}):"",label:M})}function tt(e){const{teamStore:t}=e,i=(0,u.O7)(),s=(0,r.useIntl)(),o=(0,m.VK)((()=>t.getTeamPermission()),[t]),n=(0,m.VK)((()=>{var e;const i=null==t?void 0:t.getValue(),s=null===(e=g.default.state.currentUserStore)||void 0===e?void 0:e.userId;return!(!i||!s)&&(0,q.pd)(i,s)}),[t]),l=(0,m.VK)((()=>{var e,i;const a=null===(e=t.getValue())||void 0===e||null===(i=e.permissions)||void 0===i?void 0:i.find((e=>"space_permission"===e.type)),o=s.formatMessage({id:"teamPermissionsSettings.team.disabledPermissionitem.description",defaultMessage:"Team level permission cannot be lower than the default workspace permission."});function n(e){return a&&e!==a.role&&(0,le.nl)(e,a.role)===a.role?{isDisabled:!0,disabledMessage:o}:void 0}return[{role:"editor",disabledInfo:n("editor")},{role:"read_and_write",disabledInfo:n("read_and_write")},{role:"comment_only",disabledInfo:n("comment_only")},{role:"reader",disabledInfo:n("reader")}]}),[s,t]),d=(0,p.F)(),c=o&&a()(ae.Z,{role:o.role,table:oe.e0,type:"team_permission",upgradeButtonName:"team_permission_item",disabled:!n,buttonStyle:{fontSize:12,marginRight:0,color:d.mediumTextColor},availableRoleItems:l,onChange:async e=>{const s={...o,role:e};await A.createAndCommit(i,(async e=>{await ne.ep({environment:i,store:t,permissionItems:[s],transaction:e})}))}}),{teamName:h,teamIcon:f}=(0,m.VK)((()=>({teamName:t.getName(),teamIcon:t.getIcon()})),[t]),v=a()(S.Z,{disabled:!0,title:h,icon:f,isEmptyPage:!1,size:se.Z.iconSize}),y=(0,m.VK)((()=>{const e=g.default.state.currentSpaceStore,i=null==t?void 0:t.getValue(),a=null==e?void 0:e.getValue();if(!i||!a||!e)return"";const o=(0,q.Xk)(i,a);return s.formatMessage({id:"teamPermissionSettings.teamPermissionItem.description",defaultMessage:"{num, plural, one {{num} team member} other {{num} team members}}"},{num:o.length})}),[s,t]);return a()(pe,{permissionRoleSelectComponent:c,iconComponent:v,name:h?a()(r.FormattedMessage,{defaultMessage:"Everyone at {teamName} team",id:"teamPermissionsSettings.permissionItem.defaultAccessTeamName",values:{teamName:h}}):"",label:y})}function it(e){const t=(0,r.useIntl)(),i=(0,p.F)(),{store:s,memberInfo:o,permissionItem:n,userStore:l,permissionGroup:c}=e,u=(0,m.VK)((()=>"user"===o.entity_type?l&&(0,ie.Nz)(t,l.getValue())||"":c&&c.name||t.formatMessage({defaultMessage:"Unknown Group",id:"teamPermissionSettings.unknownGroup"})),[t,o.entity_type,c,l]),g=(0,m.VK)((()=>{const e=s.getTeamPermission();return"owner"!==o.type&&n.role!==(null==e?void 0:e.role)}),[o.type,n.role,s]),h=a()("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"}},void 0,g&&a()(me.Z,{allowHover:!0,style:{width:220},textWrap:!0,renderTooltip:e=>d().createElement("div",e,a()(r.FormattedMessage,{defaultMessage:"Overrides the default team permission and won’t inherit any team permission changes.",id:"teamPermissionSettings.member.permissionItem.overrideWarning"})),placement:me.Z.Placement.Left,render:e=>d().createElement("div",e,L.Z.squareExclamation({width:14,height:14,fill:i.mediumIconColor,marginRight:4}))}),a()(Ue,{teamStore:s,memberInfo:o,permissionItem:n,memberName:u})),f=(0,m.VK)((()=>"user"===o.entity_type?l&&a()(Ze.Z,{avatarShouldShowShadow:!0,userValue:l.getValue(),size:se.Z.iconSize}):a()(S.Z,{bucket:"public",disabled:!0,onChange:()=>{},isEmptyPage:!1,title:u,size:32,icon:void 0})),[o.entity_type,u,l]),v=(0,m.VK)((()=>{var e;if("user"===o.entity_type)return l&&(null===(e=l.getValue())||void 0===e?void 0:e.email)||"";{var t;const e=c&&(null===(t=c.user_ids)||void 0===t?void 0:t.length)||"?";return"".concat(e," group members")}}),[o.entity_type,c,l]);return a()(pe,{permissionRoleSelectComponent:h,iconComponent:f,name:u,label:v,tag:"owner"===o.type?a()(Ke.Z,{desktopStyle:{marginLeft:7}},void 0,a()(r.FormattedMessage,{defaultMessage:"team owner",id:"teamPermissionSettings.permissionItem.rolePill.owner"})):void 0})}function st(e){const t=(0,u.Fy)(),i=(0,p.F)(),{store:s}=e,[o]=(0,m.oR)(h.ZP),l=(0,m.VK)((()=>{const e=null==s?void 0:s.getValue();if(!e)return[];const t=(0,q.hY)(e);return[...t.filter((e=>"owner"===e.type)),...t.filter((e=>"member"===e.type)).sort(((e,t)=>{const i=["group","user"];return i.indexOf(e.entity_type)-i.indexOf(t.entity_type)}))]}),[s]),d=(0,m.VK)((()=>{const e=g.default.state.currentUserStore,t=g.default.state.currentSpaceStore;return n().compact(l.map((i=>{const a="user"===i.entity_type&&e?I.Z.createChildStore(e,{table:ie.KJ,id:i.user_id}):void 0,o="group"===i.entity_type?null==t?void 0:t.getPermissionGroups().find((e=>e.id===i.group_id)):void 0;if("user"===i.entity_type&&!a||"group"===i.entity_type&&!o)return;const n=function(){var e,t;const a=null===(e=s.getValue())||void 0===e||null===(t=e.permissions)||void 0===t?void 0:t.find((e=>(0,ee.hV)(e)&&"group"===i.entity_type&&e.group_id===i.group_id||(0,ee.jg)(e)&&"user"===i.entity_type&&i.user_id===e.user_id));if(a)return a;const o=s.getTeamPermission();return o?"group"===i.entity_type?{type:"group_permission",role:null==o?void 0:o.role,group_id:i.group_id}:{type:"user_permission",role:null==o?void 0:o.role,user_id:i.user_id}:void 0}();return n?{memberInfo:i,permissionItem:n,user:a,group:o}:void 0})))}),[l,s]),c=(0,m.VK)((()=>d.filter((e=>{if(""!==o.memberFilterQuery){var t;const i=o.memberFilterQuery.toLowerCase();return(e.group&&e.group.name||e.user&&e.user.getValue()&&(null===(t=e.user.getValue())||void 0===t?void 0:t.name)||"").toLowerCase().includes(i)}return!0}))),[o.memberFilterQuery,d]),f={};let v=te.xm.Y;return t.isMobile?(f.backgroundColor=i.contentBackground,v=te.xm.None):f.maxHeight="calc(70vh - 80px)",a()("div",{style:{flexGrow:1,flexShrink:1,display:"flex",flexDirection:"column"}},void 0,a()(te.ZP,{style:f,type:v},void 0,a()("div",{style:{boxShadow:"0 1px 0 ".concat(i.regularDividerColor),width:"100%"}},void 0,0===c.length&&a()("div",{style:{fontSize:14,marginTop:8,color:i.mediumTextColor}},void 0,a()(r.FormattedMessage,{id:"teamPermissionSettings.member.search.zeroState",defaultMessage:"No members found"})),c.map((e=>{if(e.memberInfo&&e.permissionItem)return a()(it,{memberInfo:e.memberInfo,permissionItem:e.permissionItem,userStore:e.user,permissionGroup:e.group,store:s})})))))}function at({teamStore:e}){const[t,i]=(0,m.oR)(h.ZP),[s,o,n]=(0,m.oR)(void 0,ce.Z),l=(0,p.F)(),g="on"===(0,u.aq)("teams-settings-members"),f=g?a()(Te,{teamStore:e}):d().createElement(d().Fragment,null,a()("div",{style:{fontWeight:c.Z.fontWeight.medium,color:l.mediumTextColor,marginTop:24,marginBottom:4,fontSize:12.5}},void 0,a()(r.FormattedMessage,{defaultMessage:"Default access",id:"teamPermissionSettings.generalSection.spacePermission"})),a()(et,{teamStore:e}),a()(R.Z,{style:{marginTop:4,marginBottom:4},vertical:!1,size:1}),a()(tt,{teamStore:e})),y=g?a()($e,{teamStore:e}):d().createElement(d().Fragment,null,a()("div",{style:{fontWeight:c.Z.fontWeight.medium,color:l.mediumTextColor,marginTop:28,marginBottom:10,fontSize:12.5}},void 0,a()(r.FormattedMessage,{defaultMessage:"Team members",id:"teamPermissionSettings.generalSection.teamPermission"})),a()("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:6,marginBottom:8}},void 0,a()(v.Z,{placeholder:"Filter by name or email...",style:{boxShadow:l.inputBoxShadow,borderRadius:3,fontSize:14,width:"50%"},value:t.memberFilterQuery,onChange:e=>{i({...t,memberFilterQuery:e.target.value})},left:L.Z.searchThick({width:14,height:14,marginRight:6,flexGrow:0,flexShrink:0,fill:l.mediumIconColor})}),a()($.LazyTeamPermissionsInviteWithModal,{store:e,permissionsInviteStore:n,origin:a()(de.Z,{isLarge:!0,onClick:()=>{o({...s,modalOpen:!0})}},void 0,a()(r.FormattedMessage,{id:"teamPermissionsInviteWithModal.openModal",defaultMessage:"Add members"}))})),a()(st,{store:e}));return a()("div",{style:{width:"100%"}},void 0,f,y)}function ot(e){const t=(0,p.y)((e=>({divider:{height:1,outline:"none",border:"none",width:400,marginLeft:-18,boxShadow:"0 -1px 0 ".concat(e.regularDividerColor)}})),[]);return a()("hr",{style:{...t.divider,...e.style}})}function nt(e){var t,i;const{currentSpaceStore:s,selectedTeamId:o}=e,n=(0,u.Fy)(),[l,d,h]=(0,m.oR)(f.Z.createChildStore(s,{table:"team",id:o,spaceId:null==s?void 0:s.id})),v=(0,p.y)((e=>({wrapper:{display:"flex",paddingLeft:16,paddingRight:16,paddingTop:12,paddingBottom:16,alignItems:"center",flexDirection:n.isMobile?"row":void 0},header:{fontSize:14,fontWeight:c.Z.fontWeight.medium},caption:{color:e.mediumTextColor,fontSize:11}})),[n.isMobile]),[{currentUserSettingsStore:y}]=(0,m.oR)(g.default),M=(0,u.O7)(),b=(0,m.VK)((()=>null==y?void 0:y.getValue()),[y]);if(!l.value)return null;const T=l.value.name,C=l.value.last_edited_time,k=C?Z.CQ(C):void 0,I=null!==(t=null==b||null===(i=b.settings)||void 0===i?void 0:i.time_zone)&&void 0!==t?t:w.default.tz.guess(),x=l.value.icon?{pointer:{table:"team",id:l.value.id},icon:l.value.icon}:void 0;return a()("div",{style:v.wrapper},void 0,a()("div",{style:{marginRight:10}},void 0,a()(S.Z,{disabled:!1,title:T,icon:x,size:25,isEmptyPage:!1,bucket:"public",onChange:e=>{A.createAndCommit(M,(t=>{P.fs({store:h,update:{icon:e},transaction:t})}))}})),a()("div",{},void 0,a()(lt,{value:T,style:v.header,onBlur:e=>{A.createAndCommit(M,(t=>{P.fs({store:h,update:{name:e},transaction:t})}))}}),a()("div",{style:v.caption},void 0,k&&a()(r.FormattedMessage,{id:"sidebarTeamModal.lastUpdated.label",defaultMessage:"Updated {time}",description:"The last time this team was updated",values:{time:w.default.tz(C,I).fromNow()}}))))}function rt(e){const[t]=(0,m.oR)(h.ZP),{currentSpaceStore:i,selectedTeamId:s}=e,[o,n,r]=(0,m.oR)(f.Z.createChildStore(i,{table:"team",id:s,spaceId:null==i?void 0:i.id}));if(t.open)switch(t.tab){case h.aj.People:return a()(at,{teamStore:r});case h.aj.Settings:return a()(X,{teamStore:r});default:return null}return null}function lt(e){const{label:t,value:i,style:s,labelContainerStyle:o,onBlur:n,placeholder:r,hideLabel:c}=e,[u,g]=(0,l.useState)(!1),[h,f]=(0,m.oR)(void 0,k.Z),y=(0,l.useRef)(null),M=(0,p.y)((e=>({label:{width:"100%",...h.mouseEntered?{boxShadow:"0 0 0px 3px ".concat(e.inputBackground),background:e.inputBackground,borderRadius:3,cursor:"pointer",color:"inherit"}:{}},placeholder:{color:e.mediumTextColor}})),[h.mouseEntered]),S=()=>{f({...h,mouseEntered:!0})},T=()=>{f({...h,mouseEntered:!1})},C=t?a()(b.Z,{},void 0,t):void 0;return u?a()("div",{style:{...s,...o}},void 0,!c&&C,d().createElement(v.Z,{textarea:e.textarea,autosize:e.autosize,format:v.B.Transparent,focusInitial:!0,inputStyle:s,ref:y,onBlur:e=>{g(!1),T(),n(e.target.value)},value:i})):a()("div",{style:o},void 0,!c&&C,a()("div",{onMouseMove:S,onMouseLeave:T,onClick:()=>{g(!0)},style:{...M.label,...s}},void 0,i||a()("div",{style:M.placeholder},void 0,r)))}function dt(e){const{userId:t,currentSpaceStore:i}=e,[s]=(0,m.oR)(I.Z.createChildStore(i,{table:"notion_user",id:t,spaceId:i.id})),o=s.value;return s.ready||o?a()(C.Z,{avatarShouldShowShadow:!0,userValue:o,style:{paddingRight:6,minHeight:34,lineHeight:1.2,fontSize:14,width:"100%"},avatarSize:24}):null}function ct(e){const{userIds:t,label:i,hasMarginTop:s}=e,[{currentSpaceStore:o}]=(0,m.oR)(g.default);return o?d().createElement(d().Fragment,null,a()(b.Z,{hasMarginTop:s},void 0,i),t.map((e=>a()(dt,{userId:e,currentSpaceStore:o})))):null}function ut(){const[e,t]=(0,m.oR)(h.ZP),[{currentSpaceStore:i,currentSpaceViewStore:s}]=(0,m.oR)(g.default),o=(0,u.Fy)(),l=(0,p.y)((e=>({modal:{width:o.isMobile?"auto":840,height:o.isMobile?"auto":600,maxWidth:"calc(100vw - 100px)",maxHeight:"calc(100vh - 100px)",borderRadius:3},description:{fontSize:14,color:e.mediumTextColor,width:350,marginTop:12,marginBottom:20,textAlign:"center",lineHeight:1.3},wrapper:{display:"flex",flexDirection:"column",userSelect:"none",WebkitUserSelect:"none",height:"100%"}})),[o.isMobile]),d=(0,p.F)();if(!i||!s)return null;const{open:c}=e;return a()(M.Z,{open:c,innerStyle:l.modal,onDismiss:()=>h.ZP.reset(),render:()=>e.open?a()("div",{style:{height:"100%"}},void 0,a()("div",{style:l.wrapper},void 0,a()(y.Z,{capture:!0,onBackspace:n().identity,onLeft:n().identity,onRight:n().identity,onSelectAll:n().identity,onRedo:n().identity,onUndo:n().identity,onCut:n().identity,onCopy:n().identity,onPaste:n().identity,onKeypress:n().identity,onDelete:n().identity,onTab:n().identity},void 0,a()("div",{style:{display:"flex",flexDirection:"row",height:"100%"}},void 0,a()("div",{style:{width:230,minWidth:230,background:d.sidebarSecondaryBackground,borderRight:"1px solid ".concat(d.lightDividerColor),height:"100%",borderBottomLeftRadius:3,borderTopLeftRadius:3,display:"flex",flexDirection:"column"}},void 0,a()("div",{style:{flexShrink:0}},void 0,a()(nt,{currentSpaceStore:i,selectedTeamId:e.selectedTeamId})),a()("div",{style:{paddingBottom:15,overflow:"scroll",maxHeight:"100%"}},void 0,a()(N,{currentSpaceStore:i,teamId:e.selectedTeamId}))),!o.isMobile&&a()("div",{style:{width:"100%",padding:"8px 38px 28px 38px",overflow:"scroll"}},void 0,a()("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"}},void 0,a()(T.Z,{tabs:[a()(r.FormattedMessage,{id:"sidebarTeamModalTab.option.people",defaultMessage:"Members"}),a()(r.FormattedMessage,{id:"sidebarTeamModalTab.option.settings",defaultMessage:"Settings"})],selectedIndex:e.open?h.uX.indexOf(e.tab):1,onChange:i=>{e.open&&t({...e,tab:h.uX[i]})},tabStyle:{marginLeft:-8},style:{paddingLeft:0,paddingRight:0},tabTitleStyle:{marginLeft:8,marginRight:8}})),a()("div",{style:{display:"flex",alignItems:"start",alignContent:"start",flexDirection:"column",width:"100%"}},void 0,a()(rt,{currentSpaceStore:i,selectedTeamId:e.selectedTeamId}))))))):null})}},41205:(e,t,i)=>{i.r(t),i.d(t,{default:()=>F});var s=i(98135),a=i.n(s),o=i(59713),n=i.n(o),r=(i(33948),i(67294)),l=i.n(r),d=i(66832),c=i(15102),u=i(35875),m=i(5366),p=i(67154),g=i.n(p),h=i(3779),f=i(82990),v=i(37235),y=i(27242),M=i(92083),S=i(64498),b=i(1643),T=i(8848),C=i(95477);class Z extends d.Z{renderComponent(){return l().createElement(l().Fragment,null,h.Z.notionLogoStroked({width:34,height:34,marginBottom:18}),a()("div",{style:{...this.getPrimaryTextStyle(),marginBottom:6}},void 0,this.getPlanTitle()),a()("div",{style:this.getSecondaryTextStyle()},void 0,this.getOneLiner()),this.renderPriceAndTerms(),this.renderBlockLimit(),this.renderPlanFeatures(),this.renderLearnMore())}renderBlockLimit(){const{planInfo:e}=this.props;if("team_free"===e.subscriptionTier)return l().createElement(l().Fragment,null,a()("div",{style:{fontWeight:f.Z.fontWeight.semibold,fontSize:24}},void 0,a()(m.FormattedMessage,{id:"spaceSubscriptionUpgradePlanFeatures.blockLimit.title",defaultMessage:"Free"})),a()("div",{style:this.getSecondaryTextStyle()},void 0,a()(m.FormattedMessage,{id:"spaceSubscriptionUpgradePlanFeatures.blockLimit.description",defaultMessage:"For the first 1,000 blocks"}),a()(v.Z,{renderTooltip:()=>a()(m.FormattedMessage,{id:"spaceSubscriptionUpgradePlanFeatures.blockLimit.tooltip",defaultMessage:"Blocks are pieces of content you add to a page, like a paragraph or to-do item.{br}Some features on the Team Plan are not available on the Team Trial.",values:{br:a()("br",{})}}),placement:v.Z.Placement.Top,render:e=>l().createElement("span",e,h.Z.help({marginLeft:6,width:14,fill:T.ZP.mediumIconColor,verticalAlign:"middle",display:"inline-block"}))})))}renderPriceAndTerms(){const{planInfo:e,intl:t}=this.props;if("team_free"!==e.subscriptionTier)return l().createElement(l().Fragment,null,a()("div",{style:this.getPrimaryTextStyle()},void 0,a()(m.FormattedMessage,{id:"subscriptionUpgradeDetails.price",defaultMessage:"{price}",description:"Price is already formatted, e.g. $10",values:{price:(0,b._B)({subscriptionTier:e.subscriptionTier,billingInterval:e.billingInterval,intl:t})}})),a()("div",{style:this.getSecondaryTextStyle()},void 0,this.getFormattedTerm()))}getFormattedTerm(){const{planInfo:e,intl:t}=this.props,i=(0,S.MZ)(C.default,t),s={personal:i.terms.pro,team:i.terms.team,enterprise:i.terms.enterprise}[e.subscriptionTier];return{per_month:a()(m.FormattedMessage,{id:"subscriptionUpgradeDetails.perMonthPricing.label",defaultMessage:"per month",description:"Appears after the price per month for a given plan, e.g. $10 per month"}),per_member_per_month:a()(m.FormattedMessage,{id:"subscriptionUpgradeDetails.perUserPerMonthPricing.label",defaultMessage:"per member, per month",description:"Appears after the price per member, per month for a given plan, e.g. $10 per member, per month"})}[s]}renderPlanFeatures(){const{planInfo:e}=this.props;return l().createElement(l().Fragment,null,a()(v.Z,{delayThreshold:0,placement:v.Z.Placement.Left,renderTooltip:()=>this.renderPreviousPlanTierFeatures(),render:e=>l().createElement("span",g()({},e,{style:{cursor:"help",fontSize:14}}),a()(m.FormattedMessage,{id:"subscriptionUpgradeDetails.features",defaultMessage:"<span>Everything in {planName},</span> plus:",description:"Shown when comparing plan tier features in upgrade modal; 'planName' will be Personal, Team Trial, or Team",values:{span:(...e)=>a()("span",{style:{paddingBottom:1,borderBottom:"1px dotted ".concat(this.theme.lightTextColor)}},void 0,e),planName:this.getPreviousPlanName()}}))}),this.getFeaturesByPlanKey(e.subscriptionTier).map(((t,i)=>a()("div",{style:{display:"flex",alignItems:"center",padding:"4px 0px",fontSize:14}},"".concat(e.subscriptionTier,"-feature-").concat(i),h.Z.thinCheck({width:14,height:14,marginRight:5,color:this.theme.lightTextColor}),t.label,t.isComingSoon&&a()("div",{style:{background:this.theme.buttonHoveredBackground,fontSize:10,fontWeight:500,letterSpacing:"0.015em",color:this.theme.mediumTextColor,display:"inline",textTransform:"uppercase",padding:"2px 4px",marginLeft:6,borderRadius:3,whiteSpace:"nowrap"}},void 0,S.Mn)))))}renderPreviousPlanTierFeatures(){const e=this.getTierBelowKey();return this.getFeaturesByPlanKey(e).map(((t,i)=>a()("div",{style:{display:"flex",alignItems:"center",padding:"4px 0px",fontSize:14}},"".concat(e,"-feature-").concat(i),h.Z.thinCheck({width:14,height:14,marginRight:5,color:this.theme.regularInvertedTextColor}),t.label)))}renderLearnMore(){return a()("div",{style:{fontWeight:f.Z.fontWeight.regular,fontSize:14,marginBottom:16,color:this.theme.mediumTextColor,textDecoration:"underline",marginTop:8,cursor:"pointer"},onClick:()=>{y.Z.reset(),u.Z.reset(),M.ZP.setState({open:!0,currentTab:"plans"})}},void 0,a()(m.FormattedMessage,{id:"subscriptionUpgradeDetails.learnMore",defaultMessage:"Learn more"}))}getPlanTitle(){const{planInfo:e}=this.props;return{personal:a()(m.FormattedMessage,{id:"subscriptionUpgradeDetails.title.personal",defaultMessage:"Upgrade to Personal Pro"}),team:a()(m.FormattedMessage,{id:"subscriptionUpgradeDetails.title.team",defaultMessage:"Upgrade to Team"}),enterprise:a()(m.FormattedMessage,{id:"subscriptionUpgradeDetails.title.enterprise",defaultMessage:"Upgrade to Enterprise"}),team_free:a()(m.FormattedMessage,{id:"subscriptionUpgradeDetails.title.teamFree",defaultMessage:"Upgrade to Team Trial"})}[e.subscriptionTier]}getOneLiner(){const{planInfo:e}=this.props;switch(e.subscriptionTier){case"personal":return a()(m.FormattedMessage,{id:"subscriptionUpgradeDetails.oneLiner.personal",defaultMessage:"For power users who want to do even more."});case"team":case"team_free":return a()(m.FormattedMessage,{id:"subscriptionUpgradeDetails.oneLiner.team",defaultMessage:"For teams to write, plan, and work together in one spot."});case"enterprise":return a()(m.FormattedMessage,{id:"subscriptionUpgradeDetails.oneLiner.enterprise",defaultMessage:"Controls and support to run your company."})}}getPreviousPlanName(){return{personal:a()(m.FormattedMessage,{id:"subscriptionUpgradeDetails.planName.personal",defaultMessage:"Pro"}),personal_free:a()(m.FormattedMessage,{id:"subscriptionUpgradeDetails.planName.free",defaultMessage:"Personal"}),team_free:a()(m.FormattedMessage,{id:"subscriptionUpgradeDetails.planName.teamTrial",defaultMessage:"Team Trial"}),team:a()(m.FormattedMessage,{id:"subscriptionUpgradeDetails.planName.team",defaultMessage:"Team"})}[this.getTierBelowKey()]}getTierBelowKey(){const{planInfo:e}=this.props;return{personal:"personal_free",team:"team_free",team_free:"personal",enterprise:"team"}[e.subscriptionTier]}getFeaturesByPlanKey(e){const t=(0,S.Cq)();return{personal_free:[t.unlimitedBlocks,t.shareWithLimitedGuests,t.syncAcrossDevices],personal:[t.unlimitedFileUploads,t.unlimitedGuests,t.versionHistory,t.contentApi],team_free:[t.unlimitedTeamMembers,t.collaborativeWorkspace,t.adminTools],team:[t.unlimitedBlocks,t.unlimitedFileUploads,t.versionHistory,t.advancedPermissions],enterprise:[t.sso,t.scimApi,t.advancedSecurity,t.dedicatedManager,t.customContract]}[e]}getPrimaryTextStyle(){return{fontWeight:f.Z.fontWeight.bold,fontSize:22,lineHeight:1.1,marginBottom:2}}getSecondaryTextStyle(){return{fontWeight:f.Z.fontWeight.regular,fontSize:14,lineHeight:1.4,marginBottom:22,color:this.theme.mediumTextColor}}}const w=(0,m.injectIntl)(Z);var k=i(72693),A=i(47966),P=i(21325),I=i(27832);class x extends d.Z{constructor(...e){super(...e),n()(this,"storeTypes",{}),n()(this,"renderModal",(()=>a()("div",{style:this.getModalStyle()},void 0,a()(w,{planInfo:{subscriptionTier:"team_free"}}),a()("div",{style:this.getButtonContainerStyle()},void 0,a()(A.Z,{isLarge:!0,style:{marginLeft:"auto",marginRight:12},onClick:this.handleModalClose},void 0,a()(m.FormattedMessage,{id:"spacePermissionSettingsTrialModal.cancel.label",defaultMessage:"Cancel"})),a()(k.Z,{onClick:this.handleTrialAccept,isLarge:!0},void 0,a()(m.FormattedMessage,{id:"spacePermissionSettingsTrialModal.tryItFree.label",defaultMessage:"Try it free"})))))),n()(this,"handleTrialAccept",(async()=>{const{currentSpaceStore:e}=I.default.state;e&&(await P.EO({environment:this.environment,spaceStore:e,planType:"team"}),this.handleModalClose())})),n()(this,"handleModalClose",(()=>{u.Z.setState({...u.Z.state,open:!1})}))}renderComponent(){return a()(c.Z,{open:u.Z.state.open,render:this.renderModal,onDismiss:this.handleModalClose})}getButtonContainerStyle(){return{display:"flex",marginTop:40}}getModalStyle(){return{background:this.theme.popoverBackground,borderRadius:3,width:349,padding:24}}}const F=x},70789:(e,t,i)=>{i.r(t),i.d(t,{default:()=>qr});var s=i(98135),a=i.n(s),o=i(67154),n=i.n(o),r=i(59713),l=i.n(r),d=(i(33948),i(67294)),c=i.n(d),u=i(96486),m=i.n(u),p=i(7512),g=i(50906),h=i(47307),f=i(29974),v=i(21325),y=i(52016),M=i(32918);class S extends y.Z{getInitialState(){return{uploadingProfilePhoto:!1,givenName:"",familyName:"",name:"",startDayOfWeek:(0,M.aN)()}}getValueForUser(e,t){const i=e.getValue();if(i){const{profile_photo:e,name:s}=i,a=t.getSettings();return{uploadingProfilePhoto:!1,profilePhoto:e,name:s||"",startDayOfWeek:void 0===a.start_day_of_week?(0,M.aN)():a.start_day_of_week}}}}const b=S;class T extends y.Z{getInitialState(){return{name:"",domain:"",domainState:"current-space",emailDomains:[],publicHomePage:void 0}}getValueForSpace(e){const t=e.getValue(),i=e.getPublicContentDomain(),s=e.getPublicHomePage();if(t){const{name:e,email_domains:a}=t;return{name:e||"",domain:i||"",emailDomains:a||[],domainState:"current-space",publicHomePage:s}}}}const C=T;class Z extends y.Z{getInitialState(){return{disablePublicAccess:!1,disableGuests:!1,disableMoveToSpace:!1,disableExport:!1,disableSpacePageEdits:!1,disablePublicAccessRequests:!1,disablePersonalBots:!1,disableTeamCreation:!1}}getValueForSpace(e){const t=e.getValue();if(t){const{disable_public_access:e,disable_guests:i,disable_move_to_space:s,disable_export:a,disable_space_page_edits:o,disable_public_access_requests:n,disable_team_creation:r,bot_settings:l}=t;return{disablePublicAccess:Boolean(e),disableGuests:Boolean(i),disableMoveToSpace:Boolean(s),disableExport:Boolean(a),disableSpacePageEdits:Boolean(o),disablePublicAccessRequests:Boolean(n),disablePersonalBots:Boolean(null==l?void 0:l.disable_personal_bots),disableTeamCreation:Boolean(r)}}}}const w=Z;var k=i(58762);async function A(e){const{environment:t,spaceId:i,store:s}=e,a=await k.getSamlConfigForSpace(t,{spaceId:i});if("failed"===a.type)h.showError(a);else if(a.data&&a.data.samlConfig){const e={...a.data.samlConfig,useMetadataUrl:Boolean(a.data.samlConfig.idpMetadataUrl)};return s.setState(e),a.data}return s.reset(),{}}class P extends y.Z{getInitialState(){return{status:"unconfigured",emailDomains:[],spaceIds:[],createAccount:!1,useMetadataUrl:!1}}async getValueForSpace(e,t){const i=new P;return await A({environment:e,spaceId:t.id,store:i}),Promise.resolve(i.state)}}const I=P;var x=i(92083),F=i(66832),B=i(29368),E=i(15102),R=i(5366),D=i(95477),_=i(4637),L=i(62727),O=i(68932),U=i(27386),N=i(23189),V=i(13490),W=i(8646),z=i(12318),H=i(53471),q=i(48243),G=i(27832),K=i(88632),j=i(72693),Y=i(47966),Q=i(74523),J=i(46951),X=i(28020),$=i(1548),ee=i(72087),te=i(1643),ie=i(8848),se=i(3779),ae=i(37770),oe=i(78873),ne=i(33058),re=i(82990),le=i(39634);let de;!function(e){e.Password="Password",e.CurrentEmail="TemporaryPasscode"}(de||(de={}));class ce extends y.Z{getInitialState(){return{open:!1,authorized:!1,authorizationType:void 0}}}const ue=ce;var me=i(42402),pe=i(33954);class ge extends F.Z{constructor(...e){super(...e),l()(this,"storeTypes",{store:ue}),l()(this,"renderModalContent",(()=>{const{store:e}=this.stores,{state:t}=e;return a()("div",{style:{...this.styles.modal,...this.getColors().modal}},void 0,a()(ae.Z,{fetch:this.getAuthorizationType,loading:e=>e&&a()("div",{style:this.styles.loadingSpinner},void 0,a()(O.Z,{})),render:()=>a()(c().Fragment,{},void 0,t.authorizationType===de.Password?this.renderVerifyPassword(t):t.authorizationType===de.CurrentEmail?this.renderVerifyCurrentEmail(t):void 0,t.authorized&&this.renderSetNewEmail(t))}))})),l()(this,"renderSetNewEmail",(e=>{const{store:t}=this.stores;if(t.state.authorized)return a()(c().Fragment,{},void 0,a()("p",{style:this.styles.paragraph},void 0,a()(R.FormattedMessage,{id:"profileSettings.changeEmailModal.newEmailInstructions",defaultMessage:"Please enter a new email and we will send you a verification code."})),a()("div",{},void 0,this.renderNewEmailInput()),t.state.newEmailPasscodeSent?this.renderNewEmailPasscodeInput(e):this.renderSendNewEmailPasscodeButton(e),this.renderEducationPlanDowngradeWarning())})),l()(this,"handleSendCurrentEmailVerification",(async()=>{const{userValue:e}=this.props,{store:t}=this.stores;if(!e)return;const i=await k.sendTemporaryPassword(this.environment,{email:e.email,disableLoginLink:!0,isSignup:!1});"success"===i.type?t.setState({...t.state,currentEmailPasscodeSent:!0,currentEmailPasscode:"",error:void 0}):t.setState({...t.state,currentEmailPasscodeSent:!0,error:(0,pe.wf)(this.props.intl,i)})})),l()(this,"handleChangeCurrentEmailPasscode",(e=>{const{store:t}=this.stores;t.setState({...t.state,currentEmailPasscode:e.currentTarget.value,error:void 0})})),l()(this,"handleChangePassword",(e=>{const{store:t}=this.stores;t.setState({open:!0,authorized:!1,authorizationType:de.Password,password:e.currentTarget.value,error:void 0})})),l()(this,"handleClearPassword",(()=>{const{store:e}=this.stores;e.setState({open:!0,authorized:!1,authorizationType:de.Password,password:""})})),l()(this,"handleSubmitAuthorization",(async()=>{const{store:e}=this.stores;if(!e.state.authorized)if(e.state.authorizationType===de.Password){const t=this.getUserCurrentEmail();if(!t)return;const i=await k.loginWithEmail(this.environment,{email:t,password:e.state.password});if("failed"===i.type)return void e.setState({...e.state,error:(0,pe.wf)(this.props.intl,i)});e.setState({...e.state,authorized:!0,newEmail:"",newEmailPasscode:"",newEmailPasscodeSent:!1})}else e.state.authorizationType===de.CurrentEmail&&e.setState({...e.state,authorized:!0,newEmail:"",newEmailPasscode:"",newEmailPasscodeSent:!1})})),l()(this,"handleChangeNewEmail",(e=>{const{store:t}=this.stores;t.setState({...t.state,newEmail:e.currentTarget.value,error:void 0})})),l()(this,"handleClearNewEmail",(()=>{const{store:e}=this.stores;e.setState({...e.state,newEmail:"",newEmailPasscodeSent:!1,error:void 0})})),l()(this,"handleSendNewEmailVerification",(async()=>{const{store:e}=this.stores;if(!e.state.authorized)return;const t=await k.sendEmailVerification(this.environment,{email:e.state.newEmail});"success"===t.type?e.setState({...e.state,newEmailPasscodeSent:!0,newEmailPasscode:"",error:void 0}):e.setState({...e.state,error:(0,pe.wf)(this.props.intl,t)})})),l()(this,"handleChangeNewEmailPasscode",(e=>{const{store:t}=this.stores;t.setState({...t.state,newEmailPasscode:e.currentTarget.value,error:void 0})})),l()(this,"handleSubmit",(async()=>{const{store:e}=this.stores;if(!e.state.authorized)return;const t=e.state.authorizationType===de.Password?{type:"Password",password:e.state.password,newEmail:e.state.newEmail,newEmailPasscode:e.state.newEmailPasscode}:{type:"CurrentEmail",currentEmailPasscode:e.state.currentEmailPasscode,newEmail:e.state.newEmail,newEmailPasscode:e.state.newEmailPasscode},i=await k.changeEmail(this.environment,t);"success"===i.type?await this.closeModal():e.setState({...e.state,error:(0,pe.wf)(this.props.intl,i)})})),l()(this,"handleSendUsMessageClick",(()=>{le.O({environment:this.environment,from:"change_email_student"})})),l()(this,"openModal",(()=>{const{store:e}=this.stores;e.setState({open:!0,authorized:!1,authorizationType:void 0})})),l()(this,"closeModal",(async()=>{const{store:e}=this.stores,{hasEducationPlan:t}=this.props;e.reset(),t&&await v.bi(this.environment)})),l()(this,"getAuthorizationType",(async()=>{const{store:e}=this.stores,{intl:t}=this.props,i=this.getUserCurrentEmail();if(!i)return;const s=await oe.c({environment:this.environment,userEmail:i});s.error?e.setState({open:e.state.open,authorized:!1,authorizationType:void 0,error:t.formatMessage({id:"profileSettings.changeEmailModal.errorFetchingAccountData",defaultMessage:"Could not fetch account information for {currentEmail}."},{currentEmail:i})}):s.value.hasPassword?e.setState({open:!0,authorized:!1,authorizationType:de.Password,password:""}):e.setState({open:!0,authorized:!1,authorizationType:de.CurrentEmail,currentEmailPasscodeSent:!1,currentEmailPasscode:""})})),l()(this,"styles",{modal:{width:460,padding:32,borderRadius:3,fontSize:14},loadingSpinner:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center"},paragraph:{marginTop:12,marginBottom:14},error:{color:ie.ZP.red,fontSize:12,marginTop:4,marginLeft:8},bold:{fontWeight:re.Z.fontWeight.bold},input:{padding:"4px 8px"},button:{marginTop:14},educationPlanWarning:{display:"flex",marginTop:14,paddingTop:14}})}renderComponent(){const{userValue:e}=this.props,{store:t}=this.stores;return a()(c().Fragment,{},void 0,a()(V.Z,{},void 0,a()(R.FormattedMessage,{id:"profileSettings.personalInfoSection.emailSetting.label",defaultMessage:"Email"})),a()("div",{},void 0,a()("span",{style:{marginRight:12}},void 0,e&&e.email),a()(ne.Z,{onClick:this.openModal},void 0,a()(R.FormattedMessage,{id:"profileSettings.personalInfoSection.emailSetting.changeEmailButton.label",defaultMessage:"Change email"}))),a()(E.Z,{open:t.state.open,onDismiss:this.closeModal,render:this.renderModalContent}))}renderVerifyPassword(e){const{userValue:t}=this.props;if(t)return a()(c().Fragment,{},void 0,a()("p",{style:{margin:0}},void 0,this.renderCurrentEmail()),a()("p",{style:this.styles.paragraph},void 0,a()(R.FormattedMessage,{id:"profileSettings.changeEmailModal.enterPasswordInstructions",defaultMessage:"Please enter your password."})),a()(L.Z,{style:{display:"none"},type:"text",value:t.email,autoComplete:"username",disabled:!0}),a()(L.Z,{type:"password",disabled:e.authorized,value:e.password,onChange:this.handleChangePassword,showClearButton:!0,onClearButtonClick:this.handleClearPassword,onSubmit:this.handleSubmitAuthorization,placeholder:this.props.intl.formatMessage({id:"profileSettings.changeEmailModal.passwordInput.label",defaultMessage:"Password"}),style:this.styles.input,focusInitial:!0,autoComplete:"current-password"}),!e.authorized&&e.error&&a()("div",{style:this.styles.error},void 0,e.error),!e.authorized&&a()(j.Z,{isLarge:!0,style:this.styles.button,onClick:this.handleSubmitAuthorization},void 0,a()(R.FormattedMessage,{id:"profileSettings.changeEmailModal.continueButton.label",defaultMessage:"Continue",description:"After the user verifies their current password or email, they click this button to continue changing their email."})))}renderVerifyCurrentEmail(e){return a()(c().Fragment,{},void 0,a()("p",{style:{...this.styles.paragraph,marginTop:0}},void 0,this.renderCurrentEmail()," ",e.currentEmailPasscodeSent?a()(R.FormattedMessage,{id:"profileSettings.changeEmailModal.sentVerificationCodeToCurrentEmail",defaultMessage:"We've sent a temporary verification code to this email."}):a()(R.FormattedMessage,{id:"profileSettings.changeEmailModal.sendVerificationCodeToCurrentEmail",defaultMessage:"We'll send a temporary verification code to this email."})),e.currentEmailPasscodeSent?this.renderCurrentEmailPasscodeInput(e):this.renderSendCurrentEmailPasscodeButton())}renderSendCurrentEmailPasscodeButton(){return a()(j.Z,{isLarge:!0,onClick:this.handleSendCurrentEmailVerification},void 0,a()(R.FormattedMessage,{id:"profileSettings.changeEmailModal.sendCurrentEmailVerificationCode.label",defaultMessage:"Send verification code",description:"Sends a temporary verification passcode to the user's current email."}))}renderCurrentEmailPasscodeInput(e){return a()(c().Fragment,{},void 0,a()(L.Z,{value:e.currentEmailPasscode,onChange:this.handleChangeCurrentEmailPasscode,onSubmit:this.handleSubmitAuthorization,placeholder:this.props.intl.formatMessage({id:"profileSettings.changeEmailModal.enterCurrentEmailVerificationCodeInput.placeholder",defaultMessage:"Enter verification code"}),focusInitial:!0,style:this.styles.input}),!e.authorized&&a()(j.Z,{isLarge:!0,style:this.styles.button,onClick:this.handleSubmitAuthorization},void 0,a()(R.FormattedMessage,{id:"profileSettings.changeEmailModal.continueButton.label",defaultMessage:"Continue",description:"After the user verifies their current password or email, they click this button to continue changing their email."})))}renderNewEmailInput(){const{store:e}=this.stores;if(e.state.authorized)return a()(L.Z,{value:e.state.newEmail,onChange:this.handleChangeNewEmail,onSubmit:this.handleSendNewEmailVerification,showClearButton:!0,onClearButtonClick:this.handleClearNewEmail,placeholder:this.props.intl.formatMessage({id:"profileSettings.changeEmailModal.newEmailInput.placeholder",defaultMessage:"Enter new email"}),style:this.styles.input,focusInitial:!0})}renderSendNewEmailPasscodeButton(e){return a()(c().Fragment,{},void 0,e.error&&a()("div",{style:this.styles.error},void 0,e.error),a()(j.Z,{isLarge:!0,style:this.styles.button,onClick:this.handleSendNewEmailVerification},void 0,a()(R.FormattedMessage,{id:"profileSettings.changeEmailModal.sendVerificationCodeButton.label",defaultMessage:"Send verification code"})))}renderNewEmailPasscodeInput(e){return a()(c().Fragment,{},void 0,a()("p",{style:this.styles.paragraph},void 0,a()(R.FormattedMessage,{id:"profileSettings.changeEmailModal.verificationCodeSentMessage",defaultMessage:"We just sent you a temporary verification code to {newEmail}.",values:{newEmail:a()("span",{style:this.styles.bold},void 0,e.newEmail)}})),a()(L.Z,{value:e.newEmailPasscode,onChange:this.handleChangeNewEmailPasscode,onSubmit:this.handleSubmit,placeholder:this.props.intl.formatMessage({id:"profileSettings.changeEmailModal.enterVerificationCodeInput.placeholder",defaultMessage:"Enter verification code"}),focusInitial:!0,style:this.styles.input}),e.error&&a()("div",{style:this.styles.error},void 0,e.error),a()(j.Z,{isLarge:!0,style:this.styles.button,onClick:this.handleSubmit},void 0,a()(R.FormattedMessage,{id:"profileSettings.changeEmailModal.changeEmailButton.label",defaultMessage:"Change email"})))}renderEducationPlanDowngradeWarning(){const{hasEducationPlan:e}=this.props;if(e)return a()("div",{style:{...this.styles.educationPlanWarning,...this.getColors().educationPlanWarning}},void 0,se.Z.help({width:14,marginTop:4,marginRight:6,fill:this.theme.lightIconColor})," ",a()("div",{},void 0,a()(R.FormattedMessage,{defaultMessage:"Changing your email may downgrade your workspace on a Free Education Plan to the basic Free Plan. You won't lose any data, but you'll need to upgrade to re-access paid features. Have questions about this? <sendmessagelink>Send us a message</sendmessagelink>.",id:"emailChangeSettings.downgradeEducationPlan.warning.message",values:{sendmessagelink:(...e)=>a()(me.Z,{onClick:this.handleSendUsMessageClick},void 0,e)}})))}renderCurrentEmail(){const{userValue:e}=this.props;if(e)return a()(R.FormattedMessage,{id:"profileSettings.changeEmailModal.currentEmail",defaultMessage:"Your current email is {currentEmail}.",values:{currentEmail:a()("span",{style:this.styles.bold},void 0,e&&e.email)}})}getUserCurrentEmail(){const{store:e}=this.stores,{userValue:t,intl:i}=this.props;if(t)return t.email;e.setState({open:e.state.open,authorized:!1,authorizationType:void 0,error:i.formatMessage({id:"profileSettings.changeEmailModal.errorNoUserValue",defaultMessage:"User value is undefined."})})}getColors(){return{modal:{background:this.theme.contentBackground},educationPlanWarning:{color:this.theme.lightTextColor,borderTop:"1px solid ".concat(this.theme.regularDividerColor)}}}}const he=(0,R.injectIntl)(ge);var fe=i(95155),ve=i(33665);class ye extends y.Z{getInitialState(){return{open:!1}}}const Me=new ye;class Se extends F.Z{constructor(...e){super(...e),l()(this,"handleLogOutFromActiveSessions",(async()=>{g.AQD(this.environment),await k.logoutActiveSessions(this.environment,{}),this.openConfirmationModal()}))}renderComponent(){return c().createElement(c().Fragment,null,a()("div",{style:this.getSettingsOptionStyle()},void 0,a()(N.Z,{smallMarginBottom:!0},void 0,a()(R.FormattedMessage,{id:"manageActiveSessions.title",defaultMessage:"Log out of all devices"})),a()(J.Z,{isSmall:!0,isMultiline:!0,style:{marginTop:2,width:"80%"}},void 0,a()(R.FormattedMessage,{id:"manageActiveSessions.logOutActiveSessions.label",defaultMessage:"You will be logged out of all other active sessions besides this one and will have to log back in."})),a()(Y.Z,{isLarge:!0,isRed:!0,onClick:this.handleLogOutFromActiveSessions,style:{marginTop:12}},void 0,a()(R.FormattedMessage,{id:"manageActiveSessions.logOutActiveSessions.button",defaultMessage:"Log out"}))),this.renderManageActiveSessionsModal())}renderManageActiveSessionsModal(){const{device:e}=this.environment,{open:t}=Me.state,i=this.getUserEmailAddress();return a()(E.Z,{open:t,onDismiss:this.closeConfirmationModal,innerStyle:{width:e.isPhone?"90%":350,padding:24,display:"flex",flexDirection:"column"},render:()=>c().createElement(c().Fragment,null,a()("div",{style:{marginBottom:24}},void 0,a()(R.FormattedMessage,i?{id:"manageActiveSessions.confirmationModal.withEmail",defaultMessage:"You have been logged out from other active sessions for {email}.",values:{email:i}}:{id:"manageActiveSessions.confirmationModal.withoutEmail",defaultMessage:"You have been logged out from other active sessions for your account."})),a()(j.Z,{onClick:this.closeConfirmationModal},void 0,a()(R.FormattedMessage,{id:"manageActiveSessions.confirmationModal.close",defaultMessage:"Close"})))})}openConfirmationModal(){Me.setState({...Me.state,open:!0})}closeConfirmationModal(){Me.setState({...Me.state,open:!1})}getUserEmailAddress(){let e;const{currentUserStore:t}=G.default.state;if(t){const i=t.getValue();e=i&&i.email}return e}getSettingsOptionStyle(){const{device:e,WindowSizeStore:t}=this.environment;return{display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",height:"auto",paddingLeft:e.isMobile?t.state.paddingLeftCSS:0,paddingRight:e.isMobile?t.state.paddingRightCSS:0}}}const be=Se;var Te=i(30045),Ce=i(97832);class Ze extends F.Z{constructor(...e){super(...e),l()(this,"storeTypes",{spaceProfileSettingsStore:b,passwordRequestStore:ee.Z,isEducationStore:z.Z.of(!1)}),l()(this,"handleUploadProfilePhoto",(()=>{g.Her(this.environment),H.cR({environment:this.environment,onStart:this.handleUploadStart,bucket:"public",onError:this.handleUploadError,onComplete:this.handleUploadComplete,accept:"image/*"})})),l()(this,"handleDeleteProfilePhoto",(()=>{this.stores.spaceProfileSettingsStore.setState({...this.stores.spaceProfileSettingsStore.state,profilePhoto:void 0})})),l()(this,"handleUpdateClick",(()=>{const{name:e,profilePhoto:t}=this.stores.spaceProfileSettingsStore.state;e?(W.createAndCommit(this.environment,(i=>{const{currentUserStore:s}=G.default.state;s&&p.A({userStore:s,data:{profilePhoto:t,name:e},transaction:i})})),x.ZP.setState({...x.ZP.state,open:!1})):h.showErrorMessage(a()(R.FormattedMessage,{id:"profileSettings.personalInfoSection.nameMissing.message",defaultMessage:"Please fill in name."}))})),l()(this,"handleCancelClick",(()=>{x.ZP.setState({...x.ZP.state,open:!1})})),l()(this,"handleNameChange",(e=>{g.O$H(this.environment,{from:this.stores.spaceProfileSettingsStore.state.name,to:e.target.value}),this.stores.spaceProfileSettingsStore.setState({...this.stores.spaceProfileSettingsStore.state,name:e.target.value})})),l()(this,"handleUploadStart",(()=>{this.stores.spaceProfileSettingsStore.setState({...this.stores.spaceProfileSettingsStore.state,uploadingProfilePhoto:!0})})),l()(this,"handleUploadError",(()=>{this.stores.spaceProfileSettingsStore.setState({...this.stores.spaceProfileSettingsStore.state,uploadingProfilePhoto:!1}),h.showErrorMessage(a()(R.FormattedMessage,{id:"profileSettings.profilePhotoSection.uploadProfilePhotoError.message",defaultMessage:"Upload failed."}))})),l()(this,"handleUploadComplete",(e=>{this.stores.spaceProfileSettingsStore.setState({...this.stores.spaceProfileSettingsStore.state,profilePhoto:e[0],uploadingProfilePhoto:!1})}))}willMount(e){super.willMount(e);const{spaceProfileSettingsStore:t,isEducationStore:i}=this.stores,{currentUserStore:s,currentUserSettingsStore:a,currentUserRootStore:o}=G.default.state;if(s&&a){const e=t.getValueForUser(s,a);e&&t.setState(e)}if(o){const e=((0,te.xR)({environment:this.environment,userRootStore:o})||[]).some((e=>e===D.default.pricing.student.productId));i.set(e)}}renderComponent(){return K.Z.state.online?this.renderSettings():this.renderOfflineMessage()}renderOfflineMessage(){return a()(U.Z,{},void 0,a()(J.Z,{isSmall:!0,style:{textAlign:"center"}},void 0,a()(R.FormattedMessage,{defaultMessage:"Please go online to manage your profile.",id:"profileSettings.offline.message"})))}renderSettings(){const{currentUserStore:e}=G.default.state;if(!e)return;e.getValue();const{profilePhoto:t,uploadingProfilePhoto:i,name:s}=this.stores.spaceProfileSettingsStore.state,{passwordRequestStore:o}=this.stores,n="on"===fe.default.getGroup("user-data-consent");return o.state.loading?a()(O.Z,{style:{margin:"50% auto"}}):a()(U.Z,{controlRow:this.renderControlRow()},void 0,this.renderSpaceProfileHeader(),a()("div",{style:{marginBottom:24}},void 0,a()(Q.Z,{style:{display:"block"},buttonStyle:{height:"inherit",whiteSpace:"inherit"},title:a()("div",{style:{display:"block"}},void 0,a()(R.FormattedMessage,{id:"profileSettings.helpButton.caption",defaultMessage:"Changes to account settings will apply to all of your workspaces."})," ",a()(R.FormattedMessage,{id:"profileSettings.helpButton.learnMoreLink",defaultMessage:"<s>Learn more.</s>",values:{s:(...e)=>a()("span",{style:{textDecoration:"underline"}},void 0,e)}})),href:(0,ve.UY)("guides.profileSettings"),analyticsFrom:"profile_settings"})),a()(N.Z,{},void 0,a()(R.FormattedMessage,{id:"profileSettings.profilePhotoSection.title",defaultMessage:"Photo"})),t&&a()(q.Z,{url:t,isAuthenticated:!1,stripGoogleIconQuery:!0,width:90,render:(e,t)=>a()("div",{style:{width:90,height:90}},void 0,a()(_.Z,{src:t,style:{width:90,height:90,objectFit:"cover",borderRadius:"100%"}}))}),a()(Y.Z,{isLarge:!0,onClick:this.handleUploadProfilePhoto,style:{marginTop:8,marginBottom:4}},void 0,a()("div",{style:{display:"flex",alignItems:"center"}},void 0,a()(R.FormattedMessage,{id:"profileSettings.profilePhotoSection.uploadPhotoButton.label",defaultMessage:"Upload photo"}),i&&a()(O.Z,{style:{marginLeft:4}}))),t&&"on"===fe.default.getGroup("remove-profile-photo-string")&&a()(Y.Z,{onClick:this.handleDeleteProfilePhoto,style:{marginTop:4,marginLeft:12,marginBottom:2}},void 0,a()("div",{style:{display:"flex",alignItems:"center"}},void 0,a()(R.FormattedMessage,{id:"profileSettings.profilePhotoSection.removePhotoButton.label",defaultMessage:"Remove"}))),U.Z.renderDivider(),a()(N.Z,{},void 0,a()(R.FormattedMessage,{id:"profileSettings.personalInfoSection.title",defaultMessage:"Personal info"})),a()(he,{userValue:(0,X.S4)(this.environment),hasEducationPlan:this.stores.isEducationStore.get()}),this.renderNameRow(s),U.Z.renderDivider(),a()($.Z,{isEducationPlan:this.props.isEducationPlan,requestStore:o}),n&&U.Z.renderDivider(),n&&a()(Te.Z,{}),U.Z.renderDivider(),a()(be,{}),U.Z.renderDivider(),a()(Ce.Z,{}))}renderNameRow(e){return c().createElement(c().Fragment,null,a()(V.Z,{hasMarginTop:!0},void 0,a()(R.FormattedMessage,{id:"profileSettings.personalInfoSection.nameInput.label",defaultMessage:"Preferred name",description:"User's name, may be full name or a nickname."})),a()(L.Z,{value:e,onChange:this.handleNameChange}))}renderControlRow(){return a()("div",{style:{display:"flex"}},void 0,a()(j.Z,{isLarge:!0,onClick:this.handleUpdateClick},void 0,a()(R.FormattedMessage,{id:"profileSettings.updateButton.label",defaultMessage:"Update"})),a()(Y.Z,{isLarge:!0,style:{marginLeft:12},onClick:this.handleCancelClick},void 0,a()(R.FormattedMessage,{id:"profileSettings.cancelButton.label",defaultMessage:"Cancel"})))}renderSpaceProfileHeader(){return a()(N.Z,{large:!0,divider:"full"},void 0,a()(R.FormattedMessage,{id:"profileSettings.title",defaultMessage:"Account"}))}}const we=(0,R.injectIntl)(Ze);class ke extends F.Z{renderComponent(){return a()("div",{style:this.getStyle(),onMouseDown:this.props.onMouseDown,onClick:this.props.onClick,onDoubleClick:this.props.onDoubleClick,onContextMenu:this.props.onContextMenu},void 0,a()("div",{style:this.getSidebarStyle()},void 0,this.props.sidebar),a()("div",{style:this.getChildrenStyle()},void 0,this.props.children))}getStyle(){return{display:"flex",height:"100%",flexDirection:this.props.isReversed?"row-reverse":"row"}}getSidebarStyle(){return{height:"100%",background:this.theme.cardSidebarBackground,flexGrow:0,flexShrink:0,maxWidth:250}}getChildrenStyle(){return{flexGrow:1,position:"relative",zIndex:1,height:"100%"}}}const Ae=ke;i(73210);var Pe=i(86080),Ie=i(40039),xe=i(719),Fe=i(85567),Be=i(9953),Ee=i(66722),Re=i(71202),De=i(25584),_e=i(48762),Le=i(83071),Oe=i(78291);class Ue extends y.Z{getInitialState(){return{displaySummary:!0,openDropdown:!1,query:""}}}const Ne=new Ue;var Ve=i(93007),We=i(89940),ze=i(58879),He=i(93678),qe=i(64215);const Ge=e=>{const t=(0,R.useIntl)(),i=(0,qe.F)(),s=(0,ze.O7)(),o=(0,We.VK)((()=>(0,te.M9)(s)),[s]),n=!Boolean(o),[r,l]=(0,We.oR)(Ne);return a()("div",{onClick:()=>{o&&(0,He.y)(s,{from:"public_domain_home_page",for:o})}},void 0,c().createElement(L.Z,{type:"text",ref:e.textInputRef,style:{background:i.inputBackground,borderRadius:3,boxShadow:"rgb(15 15 15 / 10%) 0px 0px 0px 1px inset",display:"flex",padding:"4px 6px"},value:r.query,onChange:e=>{l({...r,query:e.target.value})},onFocus:()=>{n&&l({...r,openDropdown:!0})},disabled:!n,left:se.Z.searchThick({fill:i.mediumIconColor,width:16,height:16,marginRight:8,marginLeft:8,flexGrow:0,flexShrink:0}),placeholder:t.formatMessage({defaultMessage:"Select a page shared to web",id:"spaceBasicSettings.PublicHomePageSection.input.placeholder"})}))};var Ke=i(21202),je=i(59054),Ye=i(31299),Qe=i(9714),Je=i(29026),Xe=i(24042),$e=i(92166);const et=()=>a()($e.Z,{show:!0,showDelay:500,showHold:300,render:()=>a()(O.Z,{style:{textAlign:"center",visibility:"visible",display:"inline",marginLeft:8}})}),tt=async(e,t)=>{if(!K.Z.state.online)return[];const i=await(0,Ye.UJ)({environment:t,query:e,source:"public_home_page_menu",limit:Je.Xv});return""===e?i.splice(0,5):i},it=e=>{const t=(0,ze.O7)(),[i,s]=(0,We.oR)(e.spaceBasicSettingsStore,C),[o,r]=(0,We.oR)(Ne),{query:l}=o,[{value:d,status:u}]=(0,je.r5)((()=>tt(l,t)),[l,t]),m=(0,We.VK)((()=>(0,X.RM)()),[]);if(!(l||d&&0!==d.length))return null;return a()("div",{style:{marginTop:2,marginBottom:2}},void 0,a()(De.Z,{type:De.Z.Type.Vertical,sections:[{key:"recent public pages section",render:e=>c().createElement(Le.Z,e),items:"idle"===u||"pending"===u?[{key:"loading spinner",render:et,action:()=>{}}]:m&&d&&0!==d.length?[...d.map((e=>{const t=Qe.Z.createChildStore(m,{table:Ke.iU,id:e.id});return{key:"".concat(e.id," page"),render:e=>c().createElement(Xe.Z,n()({store:t},e)),action:()=>{s({...i,publicHomePage:e.id}),r({...o,openDropdown:!1,displaySummary:!0})}}}))]:[{key:"no results",render:()=>a()(J.Z,{isSmall:!0,style:{marginLeft:8}},void 0,a()(R.FormattedMessage,{id:"spaceBasicSettings.PublicHomePageSection.dropdownLabel.noResults",defaultMessage:"No results"})),action:()=>{}}]}],initialFocus:void 0}))};var st=i(22808),at=i(17755);class ot extends c().PureComponent{render(){return a()("div",{style:{height:this.getSize(),width:this.getSize(),...ot.wrapStyle,verticalAlign:"top",marginTop:1,...this.props.style}},void 0,this.renderIcon())}renderIcon(){const{icon:e}=this.props;if(e){if((0,st.Z)(e.icon))return a()("div",{style:{fontSize:this.getEmojiSize()}},void 0,e.icon);{const t=at.EK({url:e.icon,baseUrl:this.props.baseUrl,fullyQualified:!0,permissionRecord:e.pointer,width:this.getImageSize(),userId:void 0});return a()("img",{alt:"icon",src:t,style:{width:this.getImageSize(),height:this.getImageSize(),...ot.imageStyle}})}}}getSize(){return this.props.size}getEmojiSize(){return.9*this.props.size}getImageSize(){return.888*this.props.size}}l()(ot,"wrapStyle",{display:"flex",alignItems:"center",justifyContent:"center",borderRadius:3}),l()(ot,"imageStyle",{objectFit:"cover",borderRadius:3,marginTop:1});const nt=ot;var rt=i(79029);const lt=e=>{const[t,i]=(0,We.oR)(e.spaceBasicSettingsStore,C),[s,o]=(0,We.oR)(Ne),[n,r]=(0,We.VK)((()=>{const e=(0,X.RM)();if(!e||!t.publicHomePage)return[];const i=Qe.Z.createChildStore(e,{table:Ke.iU,id:t.publicHomePage});return[i,i.getIcon()]}),[t]);return n?a()("div",{style:{display:"flex",alignItems:"center"}},void 0,a()("div",{style:{display:"flex",paddingRight:8}},void 0,r&&a()(nt,{baseUrl:"",icon:r,size:18,style:{display:"inline-flex",marginRight:2,verticalAlign:"text-top"}}),a()(rt.Z,{store:n,style:{display:"inline",whiteSpace:"normal",marginRight:Boolean(r)?3:0,wordBreak:"break-word"}})),a()(Y.Z,{onClick:()=>{o({...s,displaySummary:!1}),i({...t,publicHomePage:void 0})}},void 0,a()(R.FormattedMessage,{id:"spaceBasicSettings.PublicHomePageSection.dropdownLabel",defaultMessage:"Clear"}))):null};var dt=i(61543),ct=i(37235),ut=i(66055);const mt=e=>{const t=(0,ze.O7)(),i=c().createRef(),[s,o]=(0,We.oR)(Ne),[r]=(0,We.oR)(e.spaceBasicSettingsStore),{openDropdown:l,displaySummary:d}=s,{publicHomePage:u,domain:m}=r,p="".concat(m,".").concat(D.default.publicDomainName),g=(0,We.VK)((()=>(0,te.M9)(t)),[t]),h=!Boolean(g);return c().createElement(c().Fragment,null,a()(N.Z,{style:{display:"flex",alignItems:"center"}},void 0,a()("span",{style:{marginRight:8}},void 0,a()(R.FormattedMessage,{id:"spaceBasicSettings.PublicHomePageSection.title",defaultMessage:"Public home page"})),g&&a()(dt.Z,{subscriptionTier:g,analyticsName:"public_domain_home_page",desktopStyle:{marginTop:-1}})),h&&u&&d?a()(lt,{spaceBasicSettingsStore:e.spaceBasicSettingsStore}):a()(Ee.ZP,{alignmentToOrigin:Ee.ZP.Alignment.Start,keepFocus:t.device.isPhone,onDismiss:()=>{var e;null===(e=i.current)||void 0===e||e.handleBlur(),o({...s,openDropdown:!1,displaySummary:!0})},origin:a()(Ge,{textInputRef:i}),open:l,popupType:Ee.ZP.PopupType.Popup,style:{width:250},render:()=>a()(Re.ZP,{menuType:Re.ZP.MenuType.Popup,width:250},void 0,a()(it,{spaceBasicSettingsStore:e.spaceBasicSettingsStore}))}),a()(J.Z,{isSmall:!0,isMultiline:!0,style:{marginTop:8}},void 0,a()(R.FormattedMessage,{id:"spaceBasicSettings.PublicHomePageSection.caption",defaultMessage:"Access your public home page via {linkText}.",values:{linkText:a()(ct.Z,{delayThreshold:0,renderTooltip:()=>a()(R.FormattedMessage,{id:"spaceBasicSettings.PublicHomePageSection.caption.tooltip",defaultMessage:"Click to copy link"}),render:e=>c().createElement(me.Z,n()({onClick:()=>{(0,ut.RD)({environment:t,stringValue:p,copiedMessage:ut.tq.copiedLinkToClipboard})}},e),p)})}})))};var pt=i(33929);const gt=(0,R.defineMessages)({workspaceDomainInputPlaceholder:{id:"spaceBasicSettings.domainSection.workspaceDomainInput.placeholder",defaultMessage:"Your domain"},copyDomainTooltip:{id:"spaceBasicSettings.workspaceDomain.tooltip",defaultMessage:"Click to copy link"}}),ht=()=>a()("div",{style:{color:"#53C22B",display:"flex",flexDirection:"row",alignItems:"center",fontSize:"14px"}},void 0,se.Z.circleCheckFilled({height:16,width:16,margin:"0 4px 0 8px"}),a()("span",{},void 0,a()(R.FormattedMessage,{defaultMessage:"Available",description:"website domain is available for selection",id:"spaceBasicSettings.domainSection.workspaceDomainInput.validationMessage.available"}))),ft=()=>a()("div",{style:{color:ie.ZP.red,display:"flex",flexDirection:"row",alignItems:"center",fontSize:"14px"}},void 0,se.Z.warning({height:16,width:16,margin:"0 4px 0 8px"}),a()("span",{},void 0,a()(R.FormattedMessage,{defaultMessage:"Used",description:"website domain is available for selection",id:"spaceBasicSettings.domainSection.workspaceDomainInput.validationMessage.used"}))),vt=()=>a()($e.Z,{show:!0,showDelay:500,showHold:300,render:()=>a()(O.Z,{style:{textAlign:"center",visibility:"visible",display:"inline",marginLeft:8}})}),yt=e=>{const[t,i]=(0,We.oR)(e.spaceBasicSettingsStore),{domain:s,domainState:o}=t,r=(0,ze.O7)(),l=(0,qe.F)(),[u,m]=(0,d.useState)(!0),p=c().createRef();return c().createElement(c().Fragment,null,a()(N.Z,{},void 0,a()(R.FormattedMessage,{id:"spaceBasicSettings.domainSection.title",defaultMessage:"Domain"})),a()("div",{style:{display:"flex",alignItems:"center"}},void 0,a()("div",{style:{background:l.inputBackground,borderRadius:3,boxShadow:"rgb(15 15 15 / 10%) 0px 0px 0px 1px inset",display:"flex"}},void 0,c().createElement(L.Z,{type:"text",style:{background:"none",boxShadow:"none",padding:"4px 6px",width:255},ref:p,value:s,placeholder:pt.default.formatMessage(gt.workspaceDomainInputPlaceholder),readOnly:!e.canAdminSpaceStore,onChange:e.handleSpaceUrlChange,onFocus:e=>e.target.select()})),u&&e.domainIsAutogenerated&&a()("div",{style:{color:ie.ZP.blue,fontSize:re.Z.fontSize.UIRegular.desktop,fontWeight:500,textAlign:"right",padding:"4px 6px",whiteSpace:"nowrap"},onClick:()=>{var e;null===(e=p.current)||void 0===e||e.focusInput(),m(!1),i({...t,domain:""})}},void 0,a()(R.FormattedMessage,{id:"spaceBasicSettings.changeDomain.cta.text",defaultMessage:"Set your own",description:"Prompt beside an autogenerated domain name that encourages the user to set / customize their public website domain name"})),s&&"available"===o&&ht(),("inuse"===o||"disallowed"===o)&&ft(),"loading"===o&&vt()),a()(J.Z,{isSmall:!0,isMultiline:!0,style:{marginTop:4}},void 0,((e,t)=>{const i=t=>a()(ct.Z,{delayThreshold:0,renderTooltip:()=>pt.default.formatMessage(gt.copyDomainTooltip),render:i=>c().createElement(me.Z,n()({onClick:()=>{(0,ut.RD)({environment:e,stringValue:t,copiedMessage:ut.tq.copiedLinkToClipboard})}},i),t)});return a()("div",{style:{paddingTop:8}},void 0,a()(R.FormattedMessage,{id:"spaceBasicSettings.domainSection.workspaceDomainInput.viewPublicPage.caption",defaultMessage:"Pages shared to web will be under {linkText}.",values:{linkText:i("".concat(t,".").concat(D.default.publicDomainName))}}),a()("div",{style:{paddingTop:6}}),a()(R.FormattedMessage,{id:"spaceBasicSettings.domainSection.workspaceDomainInput.joinWorkspace.caption",defaultMessage:"Anyone with an allowed email domain can join this workspace via {linkText}.",values:{linkText:i("".concat(window.location.host,"/").concat(t))}}))})(r,s)))};i(33728);var Mt=i(70630),St=i(38978),bt=i(31942),Tt=i(38755),Ct=i(19889),Zt=i(25488),wt=i(84619),kt=i(81236);function At(){return a()(R.FormattedMessage,{id:"spaceBasicSettings.workspaceNameSection.nameInput.caption",defaultMessage:"You can use your name or the name of your team. Keep it simple.",description:"The caption below the text input where a user edits the name of their workspace"})}const Pt=(0,R.defineMessages)({nameInputPlaceholder:{id:"spaceBasicSettings.nameInput.placeholder",defaultMessage:"e.g. company name"},workspaceDomainInputPlaceholder:{id:"spaceBasicSettings.domainSection.workspaceDomainInput.placeholder",defaultMessage:"URL"},allowedEmailDomainsInputPlaceholder:{id:"spaceBasicSettings.allowedEmailDomainsSection.emailDomainInput.placeholder",defaultMessage:"Type an email domain…"},copyDomainTooltip:{id:"spaceBasicSettings.workspaceDomain.tooltip",defaultMessage:"Click to copy link"}});class It extends F.Z{constructor(...e){super(...e),l()(this,"storeTypes",{spaceBasicSettingsStore:C,tokenQuery:z.Z.of("")}),l()(this,"handleSpaceNameChange",(e=>{this.stores.spaceBasicSettingsStore.setState({...this.stores.spaceBasicSettingsStore.state,name:e.target.value})})),l()(this,"handleCheckDomainAvailability",(e=>{const{spaceBasicSettingsStore:t}=this.stores,{spaceStore:i}=this.props;f._u({environment:this.environment,spaceStore:i,domain:e}).then((e=>{if("success"!==e.type)this.stores.spaceBasicSettingsStore.setState({...this.stores.spaceBasicSettingsStore.state,domainState:"loading"});else{const i=e.data.domain===t.state.domain;this.stores.spaceBasicSettingsStore.setState({...this.stores.spaceBasicSettingsStore.state,domainState:i?e.data.domainState:t.state.domainState})}}))})),l()(this,"checkSpaceDomainAvailabilityDebounced",u.debounce(this.handleCheckDomainAvailability,250)),l()(this,"handleSpaceUrlChange",(e=>{const t=f.$U(e.target.value);this.checkSpaceDomainAvailabilityDebounced(t),this.stores.spaceBasicSettingsStore.setState({...this.stores.spaceBasicSettingsStore.state,domain:t}),this.forceUpdate()})),l()(this,"handleConfirm",(async()=>{const{spaceStore:e}=this.props,{spaceBasicSettingsStore:t}=this.stores;await f.Y5({environment:this.environment,spaceId:e.id,spaceBasicSettingsStore:t})&&(await f.OF({environment:this.environment,spaceStore:e,spaceBasicSettingsStore:t}),Ne.setState(Ne.getInitialState()),x.ZP.setState({...x.ZP.state,open:!1}))})),l()(this,"handleCancelClick",(()=>{x.ZP.setState({...x.ZP.state,open:!1}),Ne.setState(Ne.getInitialState())})),l()(this,"handleExportClick",(()=>{const{currentSpaceStore:e}=G.default.state;e&&Mt.q$({environment:this.environment,root:{table:"space",id:e.id,spaceId:e.id}})})),l()(this,"handleExportMembersClick",(()=>{const{currentSpaceStore:e}=G.default.state,{data:t}=Oe.default.state;e&&t&&"subscribed_admin"===t.type&&Mt.$G({spaceStore:e,subscriptionData:t,intl:this.props.intl})})),l()(this,"handleLeaveClick",(()=>{const{spaceStore:e}=this.props,{currentUserSettingsStore:t}=G.default.state;t&&h.showDialog({message:a()(R.FormattedMessage,{id:"spaceBasicSettings.leaveWorkspaceConfirmationDialog.prompt",defaultMessage:"Are you sure you want to leave this workspace?"}),showCancel:!0,keepFocus:!0,items:[{label:a()(R.FormattedMessage,{id:"spaceBasicSettings.leaveWorkspaceConfirmationDialog.leaveButton.label",defaultMessage:"Leave"}),color:"red",onAccept:async()=>{await f.bf({environment:this.environment,spaceId:e.id,userSettingsStore:t})&&(g.z01(this.environment),x.ZP.setState({...x.ZP.state,open:!1}))}}]})})),l()(this,"handleDeleteClick",(async()=>{const{currentUserSettingsStore:e}=G.default.state;if(!e)return;const{spaceStore:t,intl:i}=this.props,s=(0,Tt.getSpaceName)(this.environment,t)||i.formatMessage({defaultMessage:"Untitled workspace",id:"spaceBasicSettings.deleteWorkspace.untitledWorkspace.placeholder"});await Pe.b({message:a()("div",{},void 0,a()("div",{},void 0,a()(R.FormattedMessage,{id:"spaceBasicSettings.deleteWorkspaceConfirmationDialog.prompt",defaultMessage:"This action cannot be undone. This will permanently delete the workspace, including all pages and files. Please type the name of the workspace to confirm."})),a()(Ve.Z,{style:{marginTop:16},translations:{es:"Esta acción no se puede deshacer. Esto eliminará permanentemente el espacio de trabajo, incluidas todas las páginas y archivos. Por favor escriba el nombre del espacio de trabajo para confirmar.",ru:"Это действие не может быть отменено. Это навсегда удалит рабочее пространство, включая все страницы и файлы. Пожалуйста, введите название рабочей области для подтверждения.",zh:"此操作无法撤消。 这将永久删除工作区,包括所有页面和文件。 请输入要确认的工作空间的名称。",de:"Diese Aktion kann nicht rückgängig gemacht werden. Dadurch wird der Arbeitsbereich einschließlich aller Seiten und Dateien dauerhaft gelöscht. Bitte geben Sie den Namen des Arbeitsbereichs zur Bestätigung ein.",fr:"Cette action ne peut pas être annulée. Cela supprimera définitivement l'espace de travail, y compris toutes les pages et tous les fichiers. Veuillez saisir le nom de l'espace de travail pour confirmer.",ja:"この操作を元に戻すことはできません。 これにより、すべてのページとファイルを含むワークスペースが完全に削除されます。 確認するワークスペースの名前を入力してください。",it:"Questa azione non può essere annullata. Questo eliminerà definitivamente l'area di lavoro, incluse tutte le pagine e i file. Digita il nome dell'area di lavoro per confermare.",pt:"Essa ação não pode ser desfeita. Isso excluirá permanentemente o espaço de trabalho, incluindo todas as páginas e arquivos. Por favor, digite o nome do espaço de trabalho para confirmar.",nl:"Deze actie kan niet ongedaan gemaakt worden. Hiermee wordt de werkruimte permanent verwijderd, inclusief alle pagina's en bestanden. Typ de naam van de werkruimte om te bevestigen.",pl:"Tego działania nie można cofnąć. Spowoduje to trwałe usunięcie obszaru roboczego, w tym wszystkich stron i plików. Wpisz nazwę obszaru roboczego, aby potwierdzić.",sv:"Den här åtgärden kan inte ångras. Detta tar bort arbetsytan permanent, inklusive alla sidor och filer. Vänligen skriv in arbetsplatsens namn för att bekräfta.",uk:"Цю дію не можна скасувати. Це дозволить остаточно видалити робочу область, включаючи всі сторінки та файли. Введіть назву робочої області для підтвердження.",no:"Denne handlingen kan ikke fortrykkes. Dette vil permanent slette arbeidsområdet, inkludert alle sider og filer. Vennligst skriv navnet på arbeidsområdet for å bekrefte.",tr:"Bu işlem geri alınamaz. Bu, tüm sayfaları ve dosyaları içeren çalışma alanını kalıcı olarak siler. Lütfen onaylamak için çalışma alanının adını yazın.",cs:"Tuto akci nelze vrátit zpět. Tím se trvale odstraní pracovní prostor včetně všech stránek a souborů. Zadejte prosím název pracovního prostoru, který chcete potvrdit.",vi:"Hành động này không thể được hoàn tác. Điều này sẽ xóa vĩnh viễn không gian làm việc, bao gồm tất cả các trang và tệp. Vui lòng nhập tên của không gian làm việc để xác nhận.",da:"Denne handling kan ikke fortrydes. Dette vil permanent slette arbejdsområdet, inklusive alle sider og filer. Indtast navnet på arbejdsområdet for at bekræfte.",hu:"Ez a művelet nem visszavonható. Ez véglegesen törli a munkaterületet, beleértve az összes oldalt és fájlt. Kérjük, írja be a munkaterület nevét a megerősítéshez.",ar:"لا يمكن التراجع عن هذا الإجراء. سيؤدي ذلك إلى حذف مساحة العمل كليا ، بما يشمل جميع الصفحات والملفات. يرجى كتابة اسم مساحة العمل للتأكيد.",th:"การกระทำนี้ไม่สามารถยกเลิกได้ นี่จะเป็นการลบพื้นที่ทำงานอย่างถาวรรวมถึงหน้าและไฟล์ทั้งหมด โปรดพิมพ์ชื่อของพื้นที่ทำงานเพื่อยืนยัน",he:"לא ניתן לבטל פעולה זו. פעולה זו תמחק לצמיתות את סביבת העבודה, כולל כל הדפים והקבצים. הקלד את שם מרחב העבודה כדי לאשר.",fi:"Tätä toimintoa ei voi peruuttaa. Tämä poistaa työtilan pysyvästi, mukaan lukien kaikki sivut ja tiedostot. Vahvista kirjoittamalla työtilan nimi.",id:"Tindakan ini tidak bisa dibatalkan. Ini akan secara permanen menghapus ruang kerja, termasuk semua halaman dan file. Silakan ketik nama ruang kerja untuk mengonfirmasi."}})),acceptLabel:a()(R.FormattedMessage,{id:"spaceBasicSettings.deleteWorkspaceConfirmationDialog.deleteWorkspaceButton.label",defaultMessage:"Permanently delete workspace"}),requiredInputValue:s})&&(f.Ns({environment:this.environment,spaceId:t.id,userSettingsStore:e}),g.BPl(this.environment),x.ZP.setState({...x.ZP.state,open:!1}))})),l()(this,"handleRecordIconChange",(e=>{const{spaceStore:t}=this.props;W.createAndCommit(this.environment,(i=>{Be.sO({store:t.getIconStore(),value:e,transaction:i})}))}))}willMount(e){super.willMount(e);const{spaceStore:t}=this.props,{spaceBasicSettingsStore:i}=this.stores,s=i.getValueForSpace(t);s&&i.setState(s)}renderComponent(){return K.Z.state.online?this.renderSettings():this.renderOfflineMessage()}renderOfflineMessage(){return a()(U.Z,{},void 0,a()(J.Z,{isSmall:!0,style:{textAlign:"center"}},void 0,a()(R.FormattedMessage,{id:"spaceBasicSettings.offlineMessage",defaultMessage:"Please go online to manage settings."})))}validateDomain(){const{spaceBasicSettingsStore:e}=this.stores,{domain:t,domainState:i}=e.state;return!!t&&("available"===i||"current-space"===i)}renderSettings(){const{spaceStore:e}=this.props,{spaceBasicSettingsStore:t}=this.stores,{name:i}=t.state,{data:s}=Oe.default.state,o="on"===fe.default.getGroup("set-homepage");if(!s)return;const n=e.canAdmin(),r=!e.canRead(),l=(0,Tt.getSpacePermissionItems)(e),u=te.qF(this.environment),m=e.getValue(),p=n&&m&&!m.disable_export,g=n,h="subscribed_admin"===s.type&&"enterprise"===te.CM(this.environment),f=kt.Z.getPublicSpaceData(this.environment,e.id);return a()(U.Z,{controlRow:n&&this.renderControlRow()},void 0,this.renderSpaceBasicHeader(),r&&a()(J.Z,{isSmall:!0,isMultiline:!0,style:{textAlign:"center"}},void 0,a()(R.FormattedMessage,{id:"spaceBasicSettings.guestLimitedAccessMessage",defaultMessage:"You are currently a guest in this workspace. Ask an admin to add you as a member in order to see other pages and workspace settings."})),r&&U.Z.renderDivider(),n&&a()(d.Fragment,{},void 0,a()(N.Z,{},void 0,a()(R.FormattedMessage,{id:"spaceBasicSettings.workspaceNameSection.title",defaultMessage:"Name"})),a()(L.Z,{value:i,placeholder:pt.default.formatMessage(Pt.nameInputPlaceholder),readOnly:!n,onChange:this.handleSpaceNameChange}),a()(J.Z,{isSmall:!0,isMultiline:!0,style:{marginTop:4}},void 0,a()(At,{})),U.Z.renderDivider()),n&&a()(d.Fragment,{},void 0,a()(N.Z,{},void 0,a()(R.FormattedMessage,{id:"spaceBasicSettings.workspaceIconSection.title",defaultMessage:"Icon"})),a()("div",{style:{width:72,height:72,border:"1px solid ".concat(this.theme.regularDividerColor),borderRadius:6,display:"flex",justifyContent:"center",alignItems:"center"}},void 0,a()(Ie.Z,n?{bucket:"public",disabled:!1,icon:(0,Tt.getSpaceIcon)(this.environment,e),isEmptyPage:!1,title:i,size:64,onChange:this.handleRecordIconChange}:{disabled:!0,icon:(0,Tt.getSpaceIcon)(this.environment,e),isEmptyPage:!1,title:i,size:64})),a()(J.Z,{isSmall:!0,isMultiline:!0,style:{marginTop:8}},void 0,a()(R.FormattedMessage,{id:"spaceBasicSettings.workspaceIconSection.caption",defaultMessage:"Upload an image or pick an emoji. It will show up in your sidebar and notifications."})),U.Z.renderDivider()),n&&c().createElement(c().Fragment,null,a()(yt,{canAdminSpaceStore:n,domainIsAutogenerated:null==f?void 0:f.domainIsAutogenerated,spaceStore:e,spaceBasicSettingsStore:t,handleSpaceUrlChange:this.handleSpaceUrlChange}),U.Z.renderDivider()),n&&u&&a()(d.Fragment,{},void 0,a()(N.Z,{},void 0,a()(R.FormattedMessage,{id:"spaceBasicSettings.allowedEmailDomainsSection.title",defaultMessage:"Allowed email domains"})),this.renderAllowedEmailDomains(),a()(J.Z,{isSmall:!0,isMultiline:!0,style:{marginTop:4}},void 0,a()(R.FormattedMessage,{id:"spaceBasicSettings.allowedEmailDomainsSection.emailDomainInput.caption",defaultMessage:"Anyone with email addresses at these domains can automatically join your workspace."})),U.Z.renderDivider()),o&&n&&a()(d.Fragment,{},void 0,a()(mt,{spaceBasicSettingsStore:t}),U.Z.renderDivider()),p&&a()(d.Fragment,{},void 0,a()(N.Z,{},void 0,a()(R.FormattedMessage,{id:"spaceBasicSettings.exportContentSection.title",defaultMessage:"Export content"})),a()("div",{style:{display:"flex"}},void 0,a()(Y.Z,{isLarge:!0,onClick:this.handleExportClick},void 0,a()(R.FormattedMessage,{id:"spaceBasicSettings.exportContentSection.exportButton.label",defaultMessage:"Export all workspace content"}))),a()("div",{style:{height:12}}),a()(Q.Z,{title:a()(R.FormattedMessage,{id:"spaceBasicSettings.exportContentSection.helpButton.caption",defaultMessage:"Learn about exporting workspaces."}),href:(0,ve.UY)("guides.exportWorkspace"),analyticsFrom:"space_settings"}),U.Z.renderDivider()),g&&a()(d.Fragment,{},void 0,a()(N.Z,{style:{display:"flex",alignItems:"center"}},void 0,a()("span",{style:{marginRight:8}},void 0,a()(R.FormattedMessage,{id:"spaceBasicSettings.exportMembersSection.title",defaultMessage:"Export members"})),!h&&a()(dt.Z,{subscriptionTier:"enterprise",analyticsName:"space_export_members",desktopStyle:{marginTop:-1}})),a()("div",{style:{display:"flex"}},void 0,a()(Y.Z,{isLarge:!0,disabled:!h,onClick:this.handleExportMembersClick,disabledFeedback:!0},void 0,a()(R.FormattedMessage,{id:"spaceBasicSettings.exportMembersSection.exportAsCSVButton.label",defaultMessage:"Export members as CSV"}))),a()("div",{style:{height:12}}),a()(Q.Z,{title:a()(R.FormattedMessage,{id:"spaceBasicSettings.exportMembersSection.helpButton.caption",defaultMessage:"Learn about exporting members."}),href:(0,ve.UY)("guides.exportMembers"),analyticsFrom:"space_settings"}),U.Z.renderDivider()),a()(N.Z,{},void 0,a()(R.FormattedMessage,{id:"spaceBasicSettings.dangerousSettingsSection.title",defaultMessage:"Danger zone"})),a()("div",{style:{display:"flex"}},void 0,(l.length>1||r)&&a()(Y.Z,{isLarge:!0,onClick:this.handleLeaveClick,style:{marginRight:n?12:void 0}},void 0,a()(R.FormattedMessage,{id:"spaceBasicSettings.dangerousSettingsSection.leaveWorkspaceButton.label",defaultMessage:"Leave workspace"})),n&&a()(Y.Z,{isLarge:!0,isRed:!0,onClick:this.handleDeleteClick},void 0,a()(R.FormattedMessage,{id:"spaceBasicSettings.dangerousSettingsSection.deleteWorkspaceButton.label",defaultMessage:"Delete entire workspace"}))),n&&a()(d.Fragment,{},void 0,a()("div",{style:{height:12}}),a()(Q.Z,{title:a()(R.FormattedMessage,{id:"spaceBasicSettings.dangerousSettingsSection.deleteWorkspaceHelpButton.caption",defaultMessage:"Learn about deleting workspaces."}),href:(0,ve.UY)("guides.deleteWorkspace"),analyticsFrom:"space_settings"})))}renderSpaceBasicHeader(){return a()(N.Z,{large:!0,divider:"full"},void 0,a()(R.FormattedMessage,{id:"spaceBasicSettings.title",defaultMessage:"Workspace settings"}))}renderControlRow(){return a()("div",{style:{display:"flex"}},void 0,a()(j.Z,{isLarge:!0,onClick:this.handleConfirm,disabled:!this.validateDomain()},void 0,a()(R.FormattedMessage,{id:"spaceBasicSettings.updateButton.label",defaultMessage:"Update"})),a()(Y.Z,{isLarge:!0,style:{marginLeft:12},onClick:this.handleCancelClick},void 0,a()(R.FormattedMessage,{id:"spaceBasicSettings.cancelButton.label",defaultMessage:"Cancel"})))}renderAllowedEmailDomains(){const{device:e}=this.environment,{spaceStore:t}=this.props,{spaceBasicSettingsStore:i}=this.stores,{emailDomains:s}=i.state,o=t.canAdmin();return a()(Ee.ZP,{popupType:e.isMobile?Ee.ZP.PopupType.SlideUp:Ee.ZP.PopupType.Popup,sameWidthAsOrigin:!0,open:this.stores.tokenQuery.get().length>0,origin:a()(xe.Z,{placeholder:pt.default.formatMessage(Pt.allowedEmailDomainsInputPlaceholder),value:this.stores.tokenQuery.get(),onChange:e=>this.stores.tokenQuery.set(e.target.value),readOnly:!o,onRemoveLastToken:()=>{const e=s.slice(0,s.length-1);i.setState({...i.state,emailDomains:e})},tokens:s.map((e=>a()(Fe.Z,{showRemoveButton:!0,isSingle:!1,format:wt.l.Medium,onClickRemove:()=>{const t=s.filter((t=>t!==e));i.setState({...i.state,emailDomains:t})},value:e},e)))}),render:()=>{const t=this.stores.tokenQuery.get().trim(),{data:o}=Oe.default.state,{spaceStore:r}=this.props,l=a()(R.FormattedMessage,{id:"spaceBasicSettings.allowedEmailDomainsSection.emailDomainsDropdown.placeholder",defaultMessage:"Type an email domain…"}),d=a()(R.FormattedMessage,{id:"spaceBasicSettings.allowedEmailDomainsSection.emailDomainsDropdown.placeholderNoResults",defaultMessage:"Type an email domain of a member of this workspace…"}),u=o?te.hn(o).map((e=>{if(("unsubscribed_admin"===o.type||"unsubscribed_member"===o.type||"subscribed_admin"===o.type)&&o.joinedMemberIds.includes(e.userId)){const t=St.Z.createChildStore(r,{table:Ct.KJ,id:e.userId}).getEmail();return t&&(0,Zt.Z)(t)}})).filter(((e,t,i)=>Boolean(e&&t===i.indexOf(e)&&!s.includes(e)))):[],m=(0,bt.ZP)(t,u,(e=>e)).map(((e,t)=>({key:t,render:t=>c().createElement(_e.Z,n()({},t,{title:e})),action:()=>{const t=[...s,e];i.setState({...i.state,emailDomains:t}),this.stores.tokenQuery.set("")}})));let p;return p=e.isMobile?{menuType:Re.ZP.MenuType.ActionSheet}:{menuType:Re.ZP.MenuType.Popup,width:"100%"},c().createElement(Re.ZP,p,a()(De.Z,{type:De.Z.Type.Vertical,initialFocus:m.length>0?0:void 0,sections:[{key:0,render:e=>c().createElement(Le.Z,n()({},e,{disableDesktopPadding:!0,title:m.length>0?l:d})),items:m}]}))},onDismiss:()=>{this.stores.tokenQuery.set("")}})}}const xt=(0,R.injectIntl)(It);var Ft=i(58280),Bt=i(52377),Et=i(69972),Rt=i(60897),Dt=i(592);class _t extends y.Z{getInitialState(){return{churnSurveyModalOpen:!1}}}const Lt=_t;var Ot=i(32056),Ut=i(7678),Nt=i(95256),Vt=i(74350);const Wt={"en-US":{enterpriseContact:"https://notionup.typeform.com/to/FbZ6Tk",enterpriseTrial:"https://notionup.typeform.com/to/OHk8LR",startupFounder:"https://notionup.typeform.com/to/HgYsu8",startupPartner:"https://notionup.typeform.com/to/XEqmGB",nonprofit:"https://notionup.typeform.com/to/nlhrVv",apiPrivateBeta:"https://notionup.typeform.com/to/dSurQQp2"},"ko-KR":{enterpriseContact:"https://notionup.typeform.com/to/K5knuI18",enterpriseTrial:"https://notionup.typeform.com/to/XkdAkTfV",startupFounder:"https://notionup.typeform.com/to/DYAiiu7x",startupPartner:"https://notionup.typeform.com/to/GfPkKEJZ",nonprofit:"https://notionup.typeform.com/to/cSKAL2LL",apiPrivateBeta:"https://notionup.typeform.com/to/dSurQQp2"}};async function zt(e){const t=Wt[Vt.SP][e.typeform];let i={};e.params&&(i={...i,...e.params});const s=t+"?".concat(Object.keys(i).map((e=>"".concat(e,"=").concat(i[e]))).join("&"));g.PHi(e.environment,{from:e.frontContext,name:e.typeform}),await(0,Nt.Z)("https://embed.typeform.com/embed.js"),window.typeformEmbed.makePopup(s,{hideHeaders:!0,hideFooter:!1}).open()}const Ht=(...e)=>a()("p",{style:{marginTop:8,marginBottom:8}},void 0,1===e.length?e[0]:c().Children.toArray(e)),qt=(...e)=>a()(me.Z,{external:!0,href:(0,ve.UY)("guides.guides")},void 0,e),Gt=(...e)=>a()(me.Z,{external:!0,href:(0,ve.UY)("guides.billingAndPayment")},void 0,e);function Kt(e,t,i){zt({environment:e,typeform:"enterpriseContact",frontContext:t,params:{source:i}})}const jt={general:function(e){return[{question:a()(R.FormattedMessage,{id:"faq.freeVsPersonalAndTeam.question",defaultMessage:"How is the free Personal Plan different from the Personal Pro and Team Plans?"}),answer:a()(R.FormattedMessage,{id:"faq.freeVsPersonalAndTeam.answer",defaultMessage:'<p>The biggest difference is how you can collaborate with others.</p><p>The free Personal Plan is designed for individual use, but allows up to 5 unique guests. These are friends, family members, and others you can invite to collaborate with you privately on any page. You can also share a page publicly and turn on commenting or editing access. In the Share menu at the top right, turn on "Share to web" then "Allow editing." Any Notion user with the link will be able to edit your page.</p><p>With the Personal Pro Plan, you can invite unlimited guests for private collaboration. For example, if you run your own business, you can invite all your clients to provide feedback on your work. </p><p>With the Team Plan, you can add members to your workspace so you all share and work on the same content. It also comes with more permission and admin controls so you and your teammates can work together securely. See the plan comparison chart for more details.</p>',values:{p:Ht}})},{question:a()(R.FormattedMessage,{id:"faq.overGuestLimitInFreePlan.question",defaultMessage:"What happens when I go over the guest limit on my Personal Plan?"}),answer:a()(R.FormattedMessage,{id:"faq.overGuestLimitInFreePlan.answer",defaultMessage:"<p>Upgrade to the Personal Pro Plan for unlimited guests, or the Team Plan if you collaborate with the same group of people automatically. You can also review and remove inactive guests in Settings & Members.</p>",values:{p:Ht}})},{question:a()(R.FormattedMessage,{id:"faq.teamTrial.question",defaultMessage:"How do I try out the Team Plan for free?"}),answer:a()(R.FormattedMessage,{id:"faq.teamTrial.answer",defaultMessage:"<p>When asked how you would like to set up Notion during sign up, select Team, and you’ll be automatically enrolled in a Team Plan trial. You’ll get access to most features of a paid Team Plan, with a 1,000 block storage limit. If your team wants to add more than that, upgrade to the full Team Plan. Details above.</p>",values:{p:Ht}})},{question:a()(R.FormattedMessage,{id:"faq.overStorageLimitInFreePlan.question",defaultMessage:"What happens when I go over the block storage limit on my Team trial?"}),answer:a()(R.FormattedMessage,{id:"faq.overStorageLimitInFreePlan.answer",defaultMessage:"<p>You can still read, edit, and organize existing content blocks as usual, but you won’t be able to add new content blocks.</p><p>However, you can delete existing content blocks to free up your storage.</p>",values:{p:Ht}})},{question:a()(R.FormattedMessage,{id:"faq.useNotionForFree.question",defaultMessage:"Can I use Notion for free?"}),answer:a()(R.FormattedMessage,{id:"faq.useNotionForFree.answer",defaultMessage:"<p>Absolutely! Notion is free to use indefinitely.</p><p>The Personal Plan is completely free for individual use. The Team Plan has a free trial with a 1,000 block limit, more than enough to try out Notion with your team before upgrading.</p>",values:{p:Ht}})},{question:a()(R.FormattedMessage,{id:"faq.whatIsABlock.question",defaultMessage:"What is a block?"}),answer:a()(R.FormattedMessage,{id:"faq.whatIsABlock.answer",defaultMessage:"<p>A block is any single piece of content you add to your page, like a paragraph of text, a to-do item, an image, a code block, an embedded file, etc. Think of your page as being made up of these building blocks.</p>",values:{p:Ht}})},{question:a()(R.FormattedMessage,{id:"faq.deleteBlocks.question",defaultMessage:"Can I delete blocks to free up my storage?"}),answer:a()(R.FormattedMessage,{id:"faq.deleteBlocks.answer",defaultMessage:"<p>Of course! It works just like the storage limit on your phone or computer. If you delete something, you will free up space for more.</p>",values:{p:Ht}})},{question:a()(R.FormattedMessage,{id:"faq.studentDiscount.question",defaultMessage:"Do you offer student discounts?"}),answer:a()(R.FormattedMessage,{id:"faq.studentDiscount.answer",defaultMessage:"<p>The Personal Pro Plan is free for students and educators. This lets you collaborate with unlimited guests and gives you version history. Simply sign up with your school email address and you’ll immediately gain access to these features.</p><p>If you’re already on a Personal Pro Plan, change the email associated with your account to your school email address to get it for free. If you're already on our free Education Plan, you've been automatically upgraded to the Personal Pro Plan.</p><p><helpcenterlink>Visit the help center to learn more</helpcenterlink></p>",values:{p:Ht,helpcenterlink:qt}})},{question:a()(R.FormattedMessage,{id:"faq.howToEarnCredit.question",defaultMessage:"How do I earn credit?"}),answer:a()(R.FormattedMessage,{id:"faq.howToEarnCredit.answer",defaultMessage:"<p>You can earn credit by using Notion across your devices and trying out new features. Go to the Earn Credit tab in Settings & Members to learn more.</p>",values:{p:Ht}})},{question:a()(R.FormattedMessage,{id:"faq.howToApplyCredit.question",defaultMessage:"How do I apply credit to my workspace?"}),answer:a()(R.FormattedMessage,{id:"faq.howToApplyCredit.answer",defaultMessage:"<p>To apply credit, you must first upgrade to a paid plan. As part of this process, you can choose to apply some or all of your account credit to the plan.</p>",values:{p:Ht}})},{question:a()(R.FormattedMessage,{id:"faq.whyBillingInformation.question",defaultMessage:"Why do you need my billing information if I have enough credit to pay for Notion?"}),answer:a()(R.FormattedMessage,{id:"faq.whyBillingInformation.answer",defaultMessage:"<p>We still require your billing information, even if you applied enough credit to make your first bill $0, because you may run out of credit in the future and we need to be able to charge your account.</p>",values:{p:Ht}})},{question:a()(R.FormattedMessage,{id:"faq.runOutOfCredit.question",defaultMessage:"What happens if I run out of credit?"}),answer:a()(R.FormattedMessage,{id:"faq.runOutOfCredit.answer",defaultMessage:"<p>If you run out of credit, your account will be charged via your selected payment method.</p>",values:{p:Ht}})},{question:a()(R.FormattedMessage,{id:"faq.maximumEarnedCredit.question",defaultMessage:"Is there a maximum amount of credit I can earn?"}),answer:a()(R.FormattedMessage,{id:"faq.maximumEarnedCredit.answer",defaultMessage:"<p>Yes, you can earn up to {maximumAmountInDollars} in credit.</p>",values:{p:Ht,maximumAmountInDollars:(0,Ot.Dx)({amount:Ut.cw,currency:"dollar",intl:pt.default.getIntl()})}})},{question:a()(R.FormattedMessage,{id:"faq.advancedPermissions.question",defaultMessage:"What advanced permissions does the paid Team & Enterprise Plans offer?"}),answer:a()(R.FormattedMessage,{id:"faq.advancedPermissions.answer",defaultMessage:'<p>If you are on a free Team trial, you can set the access level on each page to "Full access," "Can view," or "Can comment." That dictates how other users can interact with that page. "Full access" means someone can edit, comment, and share the page with others.</p><p>On paid Team and Enterprise Plans, you have the ability to grant "Can edit" access to other users. This gives someone the ability to edit and comment on that page, but not share it with others. This is especially useful if you do not want your content leaking outside your team.</p><p><contactsales>Contact sales to learn more</contactsales></p>',values:{p:Ht,contactsales:(...t)=>a()(me.Z,{onClick:()=>Kt(e,"faq","Advanced permissions")},void 0,t)}})},{question:a()(R.FormattedMessage,{id:"faq.teamAdminTools.question",defaultMessage:"What admin tools come with the Team Plan? "}),answer:a()(R.FormattedMessage,{id:"faq.teamAdminTools.answer",defaultMessage:"<p>On a free Team trial, every member in your workspace is an admin. This means all of you can adjust team settings and invite other people into the workspace.</p><p>If you want only a few people to have admin abilities, we recommend upgrading to the full Team Plan. It comes with tools that allow you to make only select people admins while everyone else is a member. Members can't edit billing information or security options, and can't share your content outside the workspace.</p>",values:{p:Ht}})},{question:a()(R.FormattedMessage,{id:"faq.personalPricing.question",defaultMessage:"How is pricing calculated for the Personal Pro Plan?"}),answer:a()(R.FormattedMessage,{id:"faq.personalPricing.answer",defaultMessage:"<p>If you upgrade your workspace to Personal Pro, you will be charged a flat fee ($5 monthly or $48 yearly).</p><p>Guests are free of charge, but they can only be added to one page at a time.</p>",values:{p:Ht}})},{question:a()(R.FormattedMessage,{id:"faq.teamPricing.question",defaultMessage:"How is pricing calculated for the Team Plan?"}),answer:a()(R.FormattedMessage,{id:"faq.teamPricing.answer",defaultMessage:'<p>If you upgrade your workspace to the Team Plan, you will be charged a fee per member ($10 monthly or $96 yearly). For example, if you pay per month and have 5 members, you will be charged $50 each month.</p><p>Guests are free of charge – but they can only access individual pages they are invited to. In other words, guests won’t be able to see all the team pages under the "Workspace" section in the left sidebar.</p>',values:{p:Ht}})},{question:a()(R.FormattedMessage,{id:"faq.monthlyAndYearlyBilling.question",defaultMessage:"Do you have monthly and yearly billing options?"}),answer:a()(R.FormattedMessage,{id:"faq.monthlyAndYearlyBilling.answer",defaultMessage:"<p>Yes! We offer both monthly and yearly billing options. The yearly billing option is always cheaper (an estimated 20% discount). For example, the Team Plan is $10 per member per month when you choose the monthly option, but $8 per member per month if you choose to pay yearly.</p>",values:{p:Ht}})},{question:a()(R.FormattedMessage,{id:"faq.addingAndRemovingMembers.question",defaultMessage:"How does adding and removing members work?"}),answer:a()(R.FormattedMessage,{id:"faq.addingAndRemovingMembers.answer",defaultMessage:"<p>Whether you're on a monthly or yearly billing schedule, your account may be charged on a monthly basis if you make these types of changes. If you added members, your account will be charged a prorated amount based on the percentage of the billing cycle left at the time each member was added. If you removed members, your account will be credited in the same way.</p>",values:{p:Ht}})},{question:a()(R.FormattedMessage,{id:"faq.changePlans.question",defaultMessage:"What happens when I change plans?"}),answer:a()(R.FormattedMessage,{id:"faq.changePlans.answer",defaultMessage:"<p>Upgrading or downgrading your plan works similarly to adding and removing members. Your account will be charged or credited based on the percentage of the billing cycle left at the time the plan was changed.</p>",values:{p:Ht}})},{question:a()(R.FormattedMessage,{id:"faq.cancelPlan.question",defaultMessage:"How do I cancel my paid plan?"}),answer:a()(R.FormattedMessage,{id:"faq.cancelPlan.answer",defaultMessage:'<p>Your Notion subscription, annual or monthly, will automatically renew until you cancel it. You can cancel your subscription by going to "Settings & Members" in the left-hand sidebar on a desktop computer, then selecting "Plans," then "Downgrade." After you cancel, you’ll still have access to all the paid features until the end of your billing cycle.</p><p><billingandpaymentlink>More on billing & payment here</billingandpaymentlink></p>',values:{p:Ht,billingandpaymentlink:Gt}})},{question:a()(R.FormattedMessage,{id:"faq.paymentFailure.question",defaultMessage:"What happens if my payment fails? Like if my credit card expires?"}),answer:a()(R.FormattedMessage,{id:"faq.paymentFailure.answer",defaultMessage:"<p>Your account email will be notified after each failed payment. Payments may be retried up to 4 times within the next month. After this, if the payment did not succeed, you will be downgraded to the free plan.</p>",values:{p:Ht}})},{question:a()(R.FormattedMessage,{id:"faq.changePaymentMethod.question",defaultMessage:"Can I change my payment method?"}),answer:a()(R.FormattedMessage,{id:"faq.changePaymentMethod.answer",defaultMessage:"<p>You can change your payment method at any time in your billing settings.</p>",values:{p:Ht}})},{question:a()(R.FormattedMessage,{id:"faq.refund.question",defaultMessage:"How do refunds work?"}),answer:a()(R.FormattedMessage,{id:"faq.refund.answer",defaultMessage:"<p>Our refund policy is simple. If you believe you've made a mistake signing up for a paid Notion subscription online or in-app, please contact us inside the app or email team@makenotion.com. We'll be happy to refund you the full amount (not pro-rated) if you downgrade your subscription within 72 hours of signing up for monthly billing, or within 30 days of signing up for annual billing.</p><p>And if for any reason you're unhappy with Notion, please let us know at team@makenotion.com — we'd love to hear your feedback, and will be happy to work with you to create the best experience possible.</p>",values:{p:Ht}})},{question:a()(R.FormattedMessage,{id:"faq.mandatoryRefund.question",defaultMessage:"What if I live in a region with a mandatory refund policy?"}),answer:a()(R.FormattedMessage,{id:"faq.mandatoryRefund.answer",defaultMessage:"<p>If you live in the European Union, United Kingdom, or another region with a mandatory refund policy, you may be eligible for a monthly subscription refund past 72 hours. For example, customers in the European Union can receive a full refund for a monthly subscription within 14 days of purchase, rather than 72 hours.</p><p>To request a refund, please contact us inside the app or email team@makenotion.com. If you live in a region with a mandatory refund policy, please let us know and we'll be happy to assist you.</p>",values:{p:Ht}})},{question:a()(R.FormattedMessage,{id:"faq.serviceLevelAgreement.question",defaultMessage:"Do you have a Service-Level Agreement (SLA)?"}),answer:a()(R.FormattedMessage,{id:"faq.serviceLevelAgreement.answer",defaultMessage:"<p>We do not offer a standard SLA. For teams with greater than 100 members, we can offer a custom SLA.</p><p><contactsales>Contact sales to learn more</contactsales></p>",values:{p:Ht,contactsales:(...t)=>a()(me.Z,{onClick:()=>Kt(e,"faq","SLA")},void 0,t)}})},{question:a()(R.FormattedMessage,{id:"faq.importStorageLimit.question",defaultMessage:"How does importing content from another app affect my block storage limit if I'm on the Team Plan trial?"}),answer:a()(R.FormattedMessage,{id:"faq.importStorageLimit.answer",defaultMessage:"<p>Content created via import doesn’t count toward your workspace’s storage limit. We want to make sure you get started with Notion as smoothly as possible.</p>",values:{p:Ht}})},{question:a()(R.FormattedMessage,{id:"faq.paymentProcessor.question",defaultMessage:"How is my payment being processed?"}),answer:a()(R.FormattedMessage,{id:"faq.paymentProcessor.answer",defaultMessage:"<p>We use Stripe to process your payment. It’s the same payment provider used by products such as Twitter, Pinterest, and Lyft. We do not handle your credit card information directly.</p>",values:{p:Ht}})},{question:a()(R.FormattedMessage,{id:"faq.multipleTeams.question",defaultMessage:"Can I belong to multiple teams on Notion? "}),answer:a()(R.FormattedMessage,{id:"faq.multipleTeams.answer",defaultMessage:"<p>Yes! You can use the same email address to create and join multiple teams. However, each one of these workspaces is on its own plan and needs to be upgraded individually.</p>",values:{p:Ht}})}]}};class Yt extends F.Z{constructor(...e){super(...e),l()(this,"renderFaqItem",((e,t)=>a()(d.Fragment,{},t,a()("div",{style:Yt.questionStyle},void 0,e.question),a()("div",{style:this.getAnswerStyle()},void 0,e.answer)))),l()(this,"handleHelpButtonClick",(()=>{le.O({environment:this.environment,from:"pricing"})}))}renderComponent(){return a()("div",{style:{maxWidth:600}},void 0,this.getFaqList().map(((e,t)=>this.renderFaqItem(e,t))),a()("div",{style:{color:this.props.isSettings?this.theme.mediumTextColor:ie.ZP.frontTextMedium}},void 0,this.props.cta?"intercom"===this.props.cta?this.renderIntercomCTA():this.renderGuidesCTA():null))}renderIntercomCTA(){return a()(R.FormattedMessage,{id:"faqList.moreQuestionsTextIntercom",defaultMessage:"Still have more questions? <messagelink>Send us a message</messagelink>",values:{messagelink:(...e)=>a()(me.Z,{onClick:this.handleHelpButtonClick},void 0,e)}})}renderGuidesCTA(){return a()(R.FormattedMessage,{id:"faqList.moreQuestionsTextHelpCenter",defaultMessage:"Still have more questions? Learn more in our <messagelink>help center</messagelink>.",values:{messagelink:(...e)=>a()(me.Z,{href:(0,ve.UY)("guides.guides")},void 0,e)}})}getFaqList(){return jt[this.props.type](this.environment)}getAnswerStyle(){return{color:this.props.isSettings?this.theme.mediumTextColor:ie.ZP.frontTextMedium,marginBottom:"1.5rem",lineHeight:1.5}}}l()(Yt,"questionStyle",{fontWeight:re.Z.fontWeight.semibold,marginBottom:4});const Qt=Yt;var Jt=i(53834),Xt=i(9618),$t=i(46911),ei=i(31079),ti=i(70043),ii=i(97977),si=i(26111),ai=i(89101),oi=i(57422);class ni extends F.Z{constructor(...e){super(...e),l()(this,"storeTypes",{loginStore:ei.Z,loginPermissionsStore:$t.Z}),l()(this,"handleLoginClick",(async()=>{const{email:e}=this.stores.loginStore.state;this.props.analyticsName&&g._$f(this.environment,{from:this.props.analyticsName});const t=await k.checkEmailType(this.environment,{email:e});if("failed"===t.type)return;const i=t.data;i.samlRedirect?ii.redirectToSaml(this.environment,i.samlRedirect.redirectUrl):i.isGoogleAppsEmail?ii.requestLoginWithGoogle({environment:this.environment,store:this.stores.loginStore,email:e,permissionsStore:this.stores.loginPermissionsStore}):i.hasPassword?(si.navigate({environment:this.environment,url:ai._j.login}),i.mustReverify?(await ii.sendTemporaryPassword({environment:this.environment,store:Xt.Z,reverify:!0}),this.stores.loginStore.reset()):Xt.Z.setState({loginType:"password",email:e,password:"",emailInputFocused:!1,alert:void 0})):(si.navigate({environment:this.environment,url:ai._j.signup}),Xt.Z.setState({loginType:"email",email:e,password:"",emailInputFocused:!1}),await ii.sendTemporaryPassword({environment:this.environment,store:Xt.Z}),this.stores.loginStore.reset())})),l()(this,"handleInputChange",(e=>{""===e.target.value&&this.stores.loginStore.reset(),this.stores.loginStore.setState({...this.stores.loginStore.state,email:e.target.value})})),l()(this,"handleInputFocus",(e=>{this.stores.loginStore.setState({...this.stores.loginStore.state,emailInputFocused:!0})})),l()(this,"handleInputBlur",(e=>{this.stores.loginStore.setState({...this.stores.loginStore.state,emailInputFocused:!1})}))}renderComponent(){const e=this.renderPlaceholderText();return a()("div",{style:this.getWrapStyle()},void 0,a()(L.Z,{style:ni.inputStyle,value:this.stores.loginStore.state.email,type:"email",format:L.Z.Format.Large,autoFocus:!1,autoComplete:"off",placeholder:e,onSubmit:this.handleLoginClick,showClearButton:!0,onFocus:this.handleInputFocus,onBlur:this.handleInputBlur,onChange:this.handleInputChange}),a()(Jt.Z,{variant:this.props.buttonVariant?this.props.buttonVariant:"primary",style:{textAlign:"center",width:this.props.buttonWidth?this.props.buttonWidth:"auto"},onClick:this.handleLoginClick},void 0,this.props.buttonTitle||a()(R.FormattedMessage,{id:"frontSignupComponent.submitButton.label",defaultMessage:"Sign up"})))}renderPlaceholderText(){const{persona:e,intl:t}=this.props,i=t.formatMessage({id:"frontSignupComponent.emailInput.genericEmailPlaceholder",defaultMessage:"Enter your email…"});switch(e){case"personal":return i;case"education":return t.formatMessage({id:"frontSignupComponent.emailInput.educationEmailPlaceholder",defaultMessage:"Enter your school email…"});case"team":return t.formatMessage({id:"frontSignupComponent.emailInput.teamEmailPlaceholder",defaultMessage:"Enter your work email…"});default:return i}}getWrapStyle(){return{width:"100%",maxWidth:this.props.maxWidth?this.props.maxWidth:320,display:"flex",alignItems:"center"}}}l()(ni,"inputStyle",{fontSize:oi.Z.fontSize.ui.m,height:36,flex:1,background:ie.ZP.white,boxShadow:ti.Z.frontInputShadow,marginRight:8});const ri=(0,R.injectIntl)(ni);var li=i(41892),di=i(64498);class ci extends y.Z{getInitialState(){return{termType:"yearly"}}}const ui=new ci;var mi=i(47714);class pi extends F.Z{renderComponent(){const e="yearly"===ui.state.termType?"monthly":"yearly";return a()("div",{style:this.getTermToggleStyle(this.theme),onClick:()=>{g.iw$(this.environment,{from:"pricing_grid_top",toggle_to:e}),ui.setState({...ui.state,termType:e})}},void 0,a()("div",{style:{marginRight:8}},void 0,this.props.isSettings?a()(R.FormattedMessage,{id:"pricingGrid.pricingTermToggle.payAnnually.label",defaultMessage:"Pay annually"}):a()(R.FormattedMessage,{id:"frontPricingPage.pricingTermToggle.payAnnually.label",defaultMessage:"Pay annually"})),a()(mi.Z,{on:"monthly"===ui.state.termType}),a()("div",{style:{marginLeft:8}},void 0,this.props.isSettings?a()(R.FormattedMessage,{id:"pricingGrid.pricingTermToggle.payMonthly.label",defaultMessage:"Monthly"}):a()(R.FormattedMessage,{id:"frontPricingPage.pricingTermToggle.payMonthly.label",defaultMessage:"Pay monthly"})))}getTermToggleStyle(e){return{cursor:"pointer",fontSize:14,color:e.mediumTextColor,display:"flex",alignItems:"center",marginBottom:8}}}const gi=pi;const hi=function(e){return!!e.device.isMobile||e.WindowSizeStore.state.width<960};var fi=i(25476),vi=i(97880),yi=i(66205),Mi=i(4708);const Si=["free","personal","team","enterprise"];class bi extends F.Z{willMount(e){const t=te.XX(e.data);t&&e.data&&ui.setState({termType:"year"===t.interval?"yearly":"monthly"})}renderComponent(){const e=(0,di.Sl)();return a()("div",{},void 0,a()("table",{style:this.getTableStyle(this.props.isSettings)},void 0,this.props.isSettings&&this.renderHeader(),a()("tbody",{},void 0,e.map(((e,t)=>this.renderSection(e,t)))),!this.props.isSettings&&this.renderFooter()))}renderCheck(){return se.Z.thinCheck({display:"inline",height:this.props.isSettings?12:14,width:this.props.isSettings?12:14,color:this.theme.regularTextColor})}upgradeLink(e,t){const{planState:i}=this.props;if(i)return a()(me.Z,{onClick:i.plans[e].onClick,style:{fontSize:12,fontWeight:500,textDecoration:"none",color:this.theme.mediumTextColor,lineHeight:1.2}},void 0,t||a()(R.FormattedMessage,{id:"pricingGrid.planAttribute.button.upgrade",defaultMessage:"Upgrade"}))}renderPlanContent(e){const{label:t,upgradeCta:i,upgradeCTALabel:s}=e;return t&&i?a()(d.Fragment,{},void 0,t,a()("br",{}),this.upgradeLink(i,s)):t||(i?a()(d.Fragment,{},void 0,a()(R.FormattedMessage,{id:"pricingGrid.planAttribute.notInTrial",defaultMessage:"Not in trial"}),a()("br",{}),this.upgradeLink(i,s)):this.renderCheck())}renderPlan(e,t,i){return a()("td",{style:{...this.getRowStyle(this.theme),...this.getValueStyle(),...this.getActiveStyle(this.theme,this.isPlanActive(e)),...this.getBorderStyle(e)}},void 0,i.hasFeature&&a()(ct.Z,{delayThreshold:0,placement:ct.Z.Placement.Right,renderTooltip:()=>(0,di.O_)(t),textWrap:!0,render:e=>c().createElement("div",n()({style:{cursor:"help",lineHeight:1.3,padding:"6px 0"}},e),this.renderPlanContent(i))}))}renderItem(e,t){const i=this.props.isSettings?"auto":300,s=this.props.planState&&this.props.planState.isTeamTrial;return a()("tr",{},"table-row-".concat(t),a()("td",{style:{...this.getRowStyle(this.theme),...this.getRowLabelStyle(this.theme),width:i,maxWidth:i,minWidth:i}},void 0,a()(ct.Z,{delayThreshold:0,placement:ct.Z.Placement.Right,renderTooltip:()=>(0,di.O_)(e.tooltip),textWrap:!0,render:t=>c().createElement("span",n()({},t,{style:this.getTooltipInnerStyle(this.theme)}),e.label,e.isComingSoon&&this.renderBadge("comingSoon"),e.isBeta&&this.renderBadge("beta"))})),Si.map((t=>{const i="team"===t&&s?"teamTrial":t;return this.renderPlan(t,e.tooltip,e.plans[i])})))}renderEmptyTableCell(e,t){return a()("td",{style:{...this.getSectionStyle(this.theme,t),...this.getValueStyle(),...this.getActiveStyle(this.theme,this.isPlanActive(e)),...this.getBorderStyle(e),color:ie.ZP.lightTextColor,fontWeight:400}},void 0,!this.props.isSettings&&this.getPlanName(e))}renderEmptyTableCells(e){return a()(d.Fragment,{},void 0,Si.map((t=>this.renderEmptyTableCell(t,e))))}renderSection(e,t){const i=this.props.isSettings?"auto":300;return a()(d.Fragment,{},"table-section-".concat(t),a()("tr",{},void 0,a()("td",{style:{...this.getSectionStyle(this.theme,t),width:i,maxWidth:i,minWidth:i}},void 0,e.label),this.renderEmptyTableCells(t)),e.items.map(((e,t)=>this.renderItem(e,t))))}renderButton(e,t){const i=t.plans[e],s="notion-pricing-grid-upgrade-".concat(e);let o;switch(i.buttonType){case"current":o=a()(R.FormattedMessage,{id:"pricingGrid.currentPlanButton.label",defaultMessage:"Current"});break;case"upgrade":o=a()(R.FormattedMessage,{id:"pricingGrid.upgradePlanButton.label",defaultMessage:"Upgrade"});break;case"downgrade":o=a()(R.FormattedMessage,{id:"pricingGrid.downgradePlanButton.label",defaultMessage:"Downgrade"});break;case"will-downgrade":o=a()(R.FormattedMessage,{id:"pricingGrid.willDowngradePlanButton.label",defaultMessage:"Future plan"});break;case"resubscribe":o=a()(R.FormattedMessage,{id:"pricingGrid.resubscribePlanButton.label",defaultMessage:"Resubscribe"});break;default:vi.t1(i.buttonType)}if("current"===i.buttonType)return this.renderDisabledButtonWithTooltip({tooltip:a()(R.FormattedMessage,{id:"pricingGrid.currentPlan.tooltip",defaultMessage:"This is your current active plan"}),label:a()(R.FormattedMessage,{id:"pricingGrid.currentPlan.largeScreenLabel",defaultMessage:"Current plan"}),buttonClassName:s,wrapTooltip:!1});if(!t.canSwitchPlans){let e;return e=t.isInAppPurchase?a()(R.FormattedMessage,{id:"pricingGrid.switchPlanFromInAppPurchase.tooltip",defaultMessage:"You're currently subscribed through an in-app purchase with Apple. To switch plans, cancel your subscription with Apple first."}):a()(R.FormattedMessage,{id:"pricingGrid.switchPlanAsMember.tooltip",defaultMessage:"You need to be an administrator of this workspace to switch plans."}),this.renderDisabledButtonWithTooltip({tooltip:e,label:o,buttonClassName:s,wrapTooltip:!0})}return("personal"===e||"free"===e)&&t.memberCount>1?this.renderDisabledButtonWithTooltip({tooltip:a()(R.FormattedMessage,{id:"pricingGrid.switchToPersonalPlanButton.tooltip",defaultMessage:"The Personal and Personal Pro Plans are only available for 1-person use. If you'd like to use these plans, please remove the other members in this workspace."}),label:o,buttonClassName:s,wrapTooltip:!0}):"will-downgrade"===i.buttonType?this.renderDisabledButtonWithTooltip({tooltip:a()(R.FormattedMessage,{id:"pricingGrid.willDowngradePlan.tooltip",defaultMessage:"This is the plan after your current plan expires"}),label:a()(R.FormattedMessage,{id:"pricingGrid.willDowngradePlan.largeScreenLabel",defaultMessage:"Future plan"}),buttonClassName:s,wrapTooltip:!1}):"downgrade"===i.buttonType?a()(Y.Z,{isLarge:!0,style:{width:"100%"},onClick:()=>{g.rOZ(this.environment,{plan:e,from:"pricing_grid_top",button_text:i.buttonType}),i.onClick()},className:s},void 0,o):a()(j.Z,{isLarge:!0,style:{width:"100%"},onClick:()=>{g.rOZ(this.environment,{plan:e,from:"pricing_grid_top",button_text:i.buttonType}),i.onClick()},className:s},void 0,o)}renderDisabledButtonWithTooltip(e){const{tooltip:t,label:i,buttonClassName:s,wrapTooltip:o}=e;return a()(ct.Z,{style:{width:o?320:"auto"},textWrap:o,renderTooltip:()=>t,render:e=>c().createElement(Y.Z,n()({style:{width:"100%",opacity:.5},isLarge:!0,disabled:!0},e,{className:s}),i)})}renderSalesContactLink(){return a()(me.Z,{onClick:()=>{const{currentUserStore:e}=G.default.state,t=e&&e.getValue();g.EUb(this.environment),yi.Z.setState({open:!0,email:t&&t.email,name:t&&(0,Ct.Nz)(this.props.intl,t)})}},void 0,a()("div",{style:this.getUpgradeButtonBelowLinkStyle()},void 0,a()(R.FormattedMessage,{id:"pricingGrid.contactSalesLink",defaultMessage:"Contact sales"})))}renderTeamTrialIndicator(){return a()(ct.Z,{delayThreshold:0,placement:ct.Z.Placement.Bottom,renderTooltip:()=>a()(R.FormattedMessage,{id:"pricingGrid.inTeamTrial.tooltip",defaultMessage:"Your current Team trial has a 1,000 block limit. Upgrade to go unlimited."}),textWrap:!0,style:{width:280},render:e=>c().createElement("div",n()({style:{...this.getUpgradeButtonBelowLinkStyle(),fontWeight:500,display:"flex",flexDirection:"row",cursor:"help"}},e),a()("div",{style:{paddingRight:4,paddingTop:2}},void 0,this.renderCheck()),a()("div",{},void 0,a()(R.FormattedMessage,{id:"pricingGrid.inTeamTrial",defaultMessage:"In free trial"})))})}renderTeamTrialButton(e){if(e.isActive&&"resubscribe"===e.buttonType)return;const t="current"===e.buttonType?a()(R.FormattedMessage,{id:"pricingGrid.cancelPlanLink",defaultMessage:"Cancel plan"}):a()(R.FormattedMessage,{id:"pricingGrid.teamTrialLink",defaultMessage:"Try for free"});return a()(me.Z,{onClick:e.onClickTeamFree},void 0,a()("div",{style:this.getUpgradeButtonBelowLinkStyle()},void 0,t))}getPlanName(e){const{intl:t}=this.props;switch(e){case"free":return t.formatMessage({id:"pricingGrid.personalFreePlanColumn.header",defaultMessage:"Personal"});case"personal":return t.formatMessage({id:"pricingGrid.personalProPlanColumn.header",defaultMessage:"Personal Pro"});case"team":return t.formatMessage({id:"pricingGrid.teamPlanColumn.header",defaultMessage:"Team"});case"enterprise":return t.formatMessage({id:"pricingGrid.enterprisePlanColumn.header",defaultMessage:"Enterprise"});default:vi.t1(e)}}renderHeaderTitle(e){const t=this.getPlanName(e.plan);return a()("td",{style:{...this.getHeaderStyle(),...this.getActiveStyle(this.theme,this.isPlanActive(e.plan)),...this.getBorderStyle(e.plan)}},void 0,!this.props.isSettings&&a()("img",{style:{height:80,marginBottom:-5},src:e.image,alt:t}),a()("div",{style:this.getHeaderTitleStyle()},void 0,t),void 0!==e.price&&a()("div",{style:{display:hi(this.environment)?"block":"flex"}},void 0,a()("div",{style:this.getHeaderPriceStyle()},void 0,e.price),void 0!==e.terms&&a()("div",{style:this.getHeaderTermsStyle(this.theme)},void 0,(0,di.X6)(this.props.intl,e.terms))),!this.props.isSettings&&"enterprise"===e.plan&&a()("div",{style:{height:30}},void 0,this.renderSalesContactLink()))}renderHeaderLabels(){const e=this.isPlanActive("team")||this.isPlanActive("enterprise");return a()("tr",{},void 0,a()("td",{style:{width:"28%"}}),a()("td",{style:{...this.getHeaderLabelStyle(!e),...this.getBorderStyle("free"),borderLeft:this.props.isSettings?"1px solid ".concat(this.theme.lightDividerColor):void 0},colSpan:2},void 0,a()(R.FormattedMessage,{id:"pricingGrid.personalPlans.label",defaultMessage:"For individuals"})),a()("td",{style:{...this.getHeaderLabelStyle(e),...this.getBorderStyle("enterprise")},colSpan:2},void 0,a()(R.FormattedMessage,{id:"pricingGrid.teamPlans.label",defaultMessage:"For teams & businesses"})))}renderHeaderTitles(){const e=ui.state.termType,t=(0,di.MZ)(D.default,this.props.intl);return a()("tr",{},void 0,a()("td",{}),this.renderHeaderTitle({plan:"free",price:t.price[e].personal,image:li.Z.images.pricing.pricingFreeV2Png}),this.renderHeaderTitle({plan:"personal",price:t.price[e].pro,image:li.Z.images.pricing.pricingPersonalV2Png,terms:t.terms.pro}),this.renderHeaderTitle({plan:"team",price:t.price[e].team,image:li.Z.images.pricing.pricingTeamV2Png,terms:t.terms.team}),this.props.isSettings?this.renderHeaderTitle({plan:"enterprise",price:t.price[e].enterprise,image:li.Z.images.pricing.pricingEnterpriseV2Png,terms:t.terms.enterprise}):this.renderHeaderTitle({plan:"enterprise",image:li.Z.images.pricing.pricingEnterpriseV2Png}))}renderHeaderAction(e){const{planState:t}=this.props;if(t)return a()("td",{style:{...this.getHeaderStyle(),...this.getActiveStyle(this.theme,this.isPlanActive(e)),...this.getBorderStyle(e)}},void 0,this.renderButton(e,t),this.renderHeaderSubAction(e))}renderHeaderSubAction(e){if("enterprise"===e)return a()("div",{style:{marginTop:7}},void 0,this.renderSalesContactLink());if("team"===e){const{planState:t}=this.props;if(!t||!t.canSwitchPlans||t.plans.personal.isActive)return;return a()("div",{style:{marginTop:7}},void 0,t.isTeamTrial?this.renderTeamTrialIndicator():this.renderTeamTrialButton(t.plans[e]))}}renderHeaderActions(){if(this.props.isSettings&&this.props.planState)return a()("tr",{},void 0,a()("td",{style:{width:"28%",verticalAlign:"top",paddingTop:16}},void 0,a()(gi,{isSettings:this.props.isSettings})),Si.map((e=>this.renderHeaderAction(e))))}renderHeader(){return a()("thead",{},void 0,this.renderHeaderLabels(),this.renderHeaderTitles(),this.renderHeaderActions())}renderStandardCTA(){return a()(ri,{buttonTitle:a()(R.FormattedMessage,{id:"pricingGrid.signupComponent.submitButton.label",defaultMessage:"Try it free"}),analyticsName:"pricing_grid_bottom",buttonWidth:100,persona:"personal"})}renderEnterpriseCTA(){return a()(Jt.Z,{variant:"secondary",isFullWidth:!0,onClick:()=>{zt({environment:this.environment,typeform:"enterpriseTrial",frontContext:"pricing_grid_bottom",params:{source:"pricing_grid_bottom"}})}},void 0,a()(R.FormattedMessage,{defaultMessage:"Try Enterprise",id:"pricingGrid.enterpriseCallToAction.message"}))}renderCTAs(){return a()(d.Fragment,{},void 0,a()("td",{colSpan:3,style:{...this.getCTACellStyle()}},void 0,a()("div",{style:{display:"flex",justifyContent:"flex-start",width:"100%"}},void 0,this.renderStandardCTA())),a()("td",{style:{...this.getCTACellStyle()}},void 0,this.renderEnterpriseCTA()))}renderFooter(){return a()("tfoot",{},void 0,a()("tr",{},void 0,a()("td",{style:{verticalAlign:"middle",fontWeight:500}},void 0,a()(R.FormattedMessage,{defaultMessage:"Sign up for free.{br}Add your team later.",id:"pricingGrid.footerSignupCallToAction.message",values:{br:a()("br",{})}})),this.renderCTAs()))}renderBadge(e){return a()("div",{style:{background:this.theme.buttonHoveredBackground,fontSize:10,fontWeight:500,letterSpacing:"0.015em",color:this.theme.mediumTextColor,display:"inline",textTransform:"uppercase",padding:"2px 4px",marginLeft:6,borderRadius:3,whiteSpace:"nowrap",position:"relative",top:-1}},void 0,"comingSoon"===e&&a()(R.FormattedMessage,{id:"pricingGrid.comingSoonBadge",defaultMessage:"Coming soon"}),"beta"===e&&a()(R.FormattedMessage,{id:"pricingGrid.betaBadge",defaultMessage:"Beta"}))}isPlanActive(e){return!(!this.props.planState||!this.props.planState.plans[e].isActive)}getTableStyle(e){return{fontSize:e?14:16,width:e?"100%":fi.P.m,tableLayout:"fixed",borderCollapse:"initial"}}getSectionStyle(e,t){const i={borderBottom:"1px solid ".concat(e.regularDividerColor),paddingBottom:7,paddingRight:15,fontWeight:500,verticalAlign:"bottom"};return 0===t?{...i,paddingTop:this.props.isSettings?0:54}:{...i,paddingTop:this.props.isSettings?20:42}}getUpgradeButtonBelowLinkStyle(){return{fontSize:this.props.isSettings?12:14}}getRowStyle(e){return{borderBottom:"1px solid ".concat(e.regularDividerColor)}}getRowLabelStyle(e){const t=(this.props.isSettings,5);return{color:e.mediumTextColor,paddingRight:10,paddingTop:t,paddingBottom:t+1,verticalAlign:"top"}}getCTACellStyle(){return{padding:"20px 15px"}}getValueStyle(){const e=this.props.isSettings?10:15;return{paddingLeft:e,paddingRight:e,textAlign:"left",overflow:"hidden",verticalAlign:"top"}}getActiveStyle(e,t){const i=(0,Mi.GN)()?e.cardSidebarBackground:e.sidebarBackground;return{background:t?i:ie.ZP.transparent}}getBorderStyle(e){return{borderLeft:this.props.isSettings?"1px solid ".concat(this.theme.lightDividerColor):void 0,borderRight:this.props.isSettings&&["enterprise"].includes(e)?"1px solid ".concat(this.theme.lightDividerColor):void 0}}getHeaderLabelStyle(e){const t=this.props.isSettings?10:15;return{paddingLeft:t,paddingRight:t,verticalAlign:"top",width:"36%",paddingTop:this.props.isSettings?10:0,fontWeight:700,fontSize:12,paddingBottom:10,borderBottom:e?"2px solid ".concat(this.theme.regularTextColor):"1px solid ".concat(this.theme.lightDividerColor),borderTop:"1px solid ".concat(this.theme.lightDividerColor)}}getHeaderStyle(){const e=this.props.isSettings?10:15;return{paddingLeft:e,paddingRight:e,verticalAlign:"top",width:"18%",paddingTop:this.props.isSettings?10:0}}getHeaderTitleStyle(){return{fontSize:this.props.isSettings?16:25,fontWeight:this.props.isSettings&&hi(this.environment)?500:700,lineHeight:1.3,marginBottom:2}}getHeaderPriceStyle(){return{fontSize:this.props.isSettings?20:25,marginRight:7}}getTooltipInnerStyle(e){return{cursor:"help",width:"100%",display:"inline-block"}}getHeaderTermsStyle(e){return{fontSize:this.props.isSettings?10:12,lineHeight:1,color:e.mediumTextColor,width:70,paddingTop:this.props.isSettings?hi(this.environment)?0:3:5}}}const Ti=(0,R.injectIntl)(bi),Ci=["not_using_enough","too_difficult","trial_over","too_expensive","security_compliance_requirements","company_shutting_down","upgraded_by_mistake","using_alternative","missing_features","other"],Zi=["google_drive_docs","asana","trello","microsoft_office","atlassian_confluence","atlassian_jira","airtable","coda","dropbox_paper","quip","evernote","other"];class wi extends y.Z{getInitialState(){return{reasons:[],reasonMissingFeatures:"",reasonOther:"",alternatives:[],alternativeOther:"",otherFeedback:""}}}const ki=wi;var Ai=i(82970),Pi=i(17256);const Ii=(0,R.defineMessages)({missingFeaturesPlaceholder:{id:"churnSurveyMenu.reasons.missingFeaturesPlaceholder",defaultMessage:"Let us know which features are missing..."},reasonOtherPlaceholder:{id:"churnSurveyMenu.reasons.reasonOtherPlaceholder",defaultMessage:"Tell us more..."},alternativeOtherPlaceholder:{id:"churnSurveyMenu.alternatives.alternativeOtherPlaceholder",defaultMessage:"Tell us more..."},otherFeedbackPlaceholder:{id:"churnSurveyMenu.other.otherFeedbackPlaceholder",defaultMessage:"Our team will review your feedback to make Notion better."}});class xi extends F.Z{constructor(...e){super(...e),l()(this,"shuffledReasons",[...m().shuffle(m().without(Ci,"other")),"other"]),l()(this,"shuffledAlternatives",[...m().shuffle(m().without(Zi,"other")),"other"]),l()(this,"storeTypes",{store:ki}),l()(this,"handleAccept",(()=>{(0,g.OXe)(this.environment,this.stores.store.state),this.props.onAccept()}))}renderComponent(){const{churnType:e,onClose:t,periodEnd:i}=this.props,{store:s}=this.stores,{reasons:o,reasonMissingFeatures:n,reasonOther:r,alternatives:l,alternativeOther:d,otherFeedback:u}=s.state,p=(0,Pi.Z)(i).format("LL");return a()("div",{style:{fontSize:14}},void 0,a()("div",{style:{display:"flex",fontSize:14,padding:24,paddingBottom:20,borderBottom:"1px solid ".concat(this.theme.lightDividerColor)}},void 0,a()("div",{},void 0,a()("h3",{style:xi.headerStyle},void 0,a()(R.FormattedMessage,"personal"===e?{id:"churnSurveyMenu.header.personal.title",defaultMessage:"Downgrade to Personal"}:{id:"churnSurveyMenu.header.team.title",defaultMessage:"Downgrade to Team Trial"})),a()("p",{style:{lineHeight:1.4,margin:"8px 0 12px"}},void 0,a()(R.FormattedMessage,{id:"churnSurveyMenu.header.description",defaultMessage:"Notion is constantly improving. Before you downgrade, we’d love your input to help us make Notion better for everyone. Thank you for your feedback."})),a()(Y.Z,{onClick:t},void 0,a()(R.FormattedMessage,{id:"churnSurveyMenu.goBackButton.title",defaultMessage:"Back to Plans"}))),a()("div",{style:{alignSelf:"center",padding:"0px 8px"}},void 0,a()("img",{src:li.Z.images.downgradeFeedbackPng,style:{filter:this.theme.illustrationFilter},width:160}))),a()("div",{style:{padding:"8px 12px",margin:"20px 24px 12px 24px",background:this.theme.sidebarBackground,borderRadius:3}},void 0,a()(R.FormattedMessage,{id:"churnSurveyMenu.header.covidMessage",defaultMessage:"💛 If you are impacted by COVID-19, <contactuslink>contact us</contactuslink> for assistance.",values:{contactuslink:(...e)=>a()(me.Z,{onClick:()=>{(0,le.O)({environment:this.environment,from:"churn_survey"})}},void 0,e)}})),a()("div",{style:xi.surveySectionStyle},void 0,a()("h4",{style:xi.subheaderStyle},void 0,a()(R.FormattedMessage,{id:"churnSurveyMenu.reasons.title",defaultMessage:"1. What are your reasons for downgrading?"})),a()("div",{style:this.getDescriptionStyle()},void 0,a()(R.FormattedMessage,{id:"churnSurveyMenu.reasons.description",defaultMessage:"Please select one or more"})),this.shuffledReasons.map((e=>{const t=o.includes(e);return c().createElement(c().Fragment,null,a()("div",{style:xi.optionRowStyle,onClick:()=>{s.setState({...s.state,reasons:t?m().without(o,e):[...o,e]})}},e,a()(Ai.Z,{checked:t,size:14}),a()("span",{style:{marginLeft:4}},void 0,this.renderMessageForReason(e))),"missing_features"===e&&t&&a()(L.Z,{style:xi.inlineInputStyle,autoFocus:!0,value:n,placeholder:pt.default.formatMessage(Ii.missingFeaturesPlaceholder),onChange:e=>{s.setState({...s.state,reasonMissingFeatures:e.target.value})}}),"other"===e&&t&&a()(L.Z,{style:xi.inlineInputStyle,autoFocus:!0,value:r,placeholder:pt.default.formatMessage(Ii.reasonOtherPlaceholder),onChange:e=>{s.setState({...s.state,reasonOther:e.target.value})}}))}))),a()("div",{style:xi.surveySectionStyle},void 0,a()("h4",{style:xi.subheaderStyle},void 0,a()(R.FormattedMessage,{id:"churnSurveyMenu.alternatives.title",defaultMessage:"2. What tools are you using instead?"})),a()("div",{style:this.getDescriptionStyle()},void 0,a()(R.FormattedMessage,{id:"churnSurveyMenu.alternatives.description",defaultMessage:"Please select one or more"})),this.shuffledAlternatives.map((e=>{const t=l.includes(e);return c().createElement(c().Fragment,null,a()("div",{style:xi.optionRowStyle,onClick:()=>{s.setState({...s.state,alternatives:t?m().without(l,e):[...l,e]})}},e,a()(Ai.Z,{checked:t,size:14}),a()("span",{style:{marginLeft:4}},void 0,this.renderMessageForAlternative(e))),"other"===e&&t&&a()(L.Z,{style:xi.inlineInputStyle,autoFocus:!0,value:d,placeholder:pt.default.formatMessage(Ii.alternativeOtherPlaceholder),onChange:e=>{s.setState({...s.state,alternativeOther:e.target.value})}}))}))),a()("div",{style:xi.surveySectionStyle},void 0,a()("h4",{style:xi.subheaderStyle},void 0,a()(R.FormattedMessage,{id:"churnSurveyMenu.otherFeedback.title",defaultMessage:"3. Any other feedback for us?"})),a()(L.Z,{textarea:!0,style:{marginTop:4},value:u,placeholder:pt.default.formatMessage(Ii.otherFeedbackPlaceholder),onChange:e=>{s.setState({...s.state,otherFeedback:e.target.value})}})),a()("div",{style:{padding:"20px 24px",marginTop:20,borderTop:"1px solid ".concat(this.theme.lightDividerColor)}},void 0,a()("h4",{style:xi.subheaderStyle},void 0,a()(R.FormattedMessage,{id:"churnSurveyMenu.continueDowngrade.title",defaultMessage:"Continue downgrade?"})),a()("p",{style:{margin:"4px 0 20px",lineHeight:1.4}},void 0,a()(R.FormattedMessage,"personal"===e?{id:"churnSurveyMenu.continueDowngrade.downgradeMessage.personal",defaultMessage:"If you cancel now, you'll still enjoy all the features of your paid plan until {periodEnd}. You can resubscribe or switch to another paid plan anytime.{br}After {periodEnd}, this workspace will be downgraded to the free Personal plan, with these restrictions: <li>Single-person use</li><li>Guest limit of 5 per workspace</li><li>Upload files up to 5 MB</li><li>No version history</li><li>No member shared workspace</li>",values:{periodEnd:a()("span",{style:{fontWeight:600}},void 0,p),br:a()("div",{style:{height:8}}),li:(...e)=>a()("ul",{style:xi.restrictionListItemStyle},void 0,a()("li",{},void 0,e))}}:{id:"churnSurveyMenu.continueDowngrade.downgradeMessage.team",defaultMessage:"If you cancel now, you'll still enjoy all the features of your paid plan until {periodEnd}. You can resubscribe or switch to another paid plan anytime.{br}After {periodEnd}, this workspace will be downgraded to a free trial of the Team Plan, with these restrictions: <li>1,000 block limit</li><li>Upload files up to 5 MB</li><li>No version history</li><li>No bulk exports</li><li>No advanced permissions</li><li>No permission groups</li>",values:{periodEnd:a()("span",{style:{fontWeight:600}},void 0,p),br:a()("div",{style:{height:8}}),li:(...e)=>a()("ul",{style:xi.restrictionListItemStyle},void 0,a()("li",{},void 0,e))}})),a()("div",{style:{display:"flex"}},void 0,a()(Y.Z,{isRed:!0,onClick:this.handleAccept},void 0,a()(R.FormattedMessage,{id:"churnSurveyMenu.downgradeButton.title",defaultMessage:"Downgrade"})),a()(Y.Z,{onClick:t,style:{marginLeft:12}},void 0,a()(R.FormattedMessage,{id:"churnSurveyMenu.cancelButton.title",defaultMessage:"Cancel"})))))}renderMessageForReason(e){return"not_using_enough"===e?a()(R.FormattedMessage,{id:"churnSurveyMenu.reasons.notUsingEnough",defaultMessage:"Not using it enough"}):"too_difficult"===e?a()(R.FormattedMessage,{id:"churnSurveyMenu.reasons.toDifficult",defaultMessage:"Too difficult to use"}):"trial_over"===e?a()(R.FormattedMessage,{id:"churnSurveyMenu.reasons.trialOver",defaultMessage:"Trial is over"}):"too_expensive"===e?a()(R.FormattedMessage,{id:"churnSurveyMenu.reasons.tooExpensive",defaultMessage:"Too expensive"}):"security_compliance_requirements"===e?a()(R.FormattedMessage,{id:"churnSurveyMenu.reasons.securityComplianceRequirements",defaultMessage:"Security or compliance requirements"}):"company_shutting_down"===e?a()(R.FormattedMessage,{id:"churnSurveyMenu.reasons.companyShuttingDown",defaultMessage:"Company is shutting down or making cuts"}):"upgraded_by_mistake"===e?a()(R.FormattedMessage,{id:"churnSurveyMenu.reasons.upgradedByMistake",defaultMessage:"Upgraded by mistake"}):"using_alternative"===e?a()(R.FormattedMessage,{id:"churnSurveyMenu.reasons.usingAlternative",defaultMessage:"Using an alternative"}):"missing_features"===e?a()(R.FormattedMessage,{id:"churnSurveyMenu.reasons.missingFeatures",defaultMessage:"Missing features"}):"other"===e?a()(R.FormattedMessage,{id:"churnSurveyMenu.reasons.other",defaultMessage:"Other"}):void(0,vi.t1)(e)}renderMessageForAlternative(e){return"google_drive_docs"===e?a()(R.FormattedMessage,{id:"churnSurveyMenu.alternatives.googleDriveDocs",defaultMessage:"Google Drive / Docs"}):"asana"===e?a()(R.FormattedMessage,{id:"churnSurveyMenu.alternatives.asana",defaultMessage:"Asana"}):"trello"===e?a()(R.FormattedMessage,{id:"churnSurveyMenu.alternatives.trello",defaultMessage:"Trello"}):"microsoft_office"===e?a()(R.FormattedMessage,{id:"churnSurveyMenu.alternatives.microsoftOffice",defaultMessage:"Microsoft 365 / Office"}):"atlassian_confluence"===e?a()(R.FormattedMessage,{id:"churnSurveyMenu.alternatives.atlassianConfluence",defaultMessage:"Confluence"}):"atlassian_jira"===e?a()(R.FormattedMessage,{id:"churnSurveyMenu.alternatives.atlassianJira",defaultMessage:"Jira"}):"airtable"===e?a()(R.FormattedMessage,{id:"churnSurveyMenu.alternatives.airtable",defaultMessage:"Airtable"}):"coda"===e?a()(R.FormattedMessage,{id:"churnSurveyMenu.alternatives.coda",defaultMessage:"Coda"}):"dropbox_paper"===e?a()(R.FormattedMessage,{id:"churnSurveyMenu.alternatives.dropboxPaper",defaultMessage:"Dropbox Paper"}):"quip"===e?a()(R.FormattedMessage,{id:"churnSurveyMenu.alternatives.quip",defaultMessage:"Quip"}):"evernote"===e?a()(R.FormattedMessage,{id:"churnSurveyMenu.alternatives.evernote",defaultMessage:"Evernote"}):"other"===e?a()(R.FormattedMessage,{id:"churnSurveyMenu.alternatives.other",defaultMessage:"Other"}):void(0,vi.t1)(e)}getDescriptionStyle(){return{margin:0,color:this.theme.mediumTextColor,marginBottom:8}}}l()(xi,"optionRowStyle",{display:"flex",alignItems:"center",cursor:"pointer",marginBottom:4}),l()(xi,"restrictionListItemStyle",{paddingLeft:20,margin:"6px 0"}),l()(xi,"surveySectionStyle",{padding:"8px 24px"}),l()(xi,"headerStyle",{margin:0,marginBottom:8}),l()(xi,"subheaderStyle",{margin:0,marginTop:8,fontSize:16,fontWeight:600}),l()(xi,"inlineInputStyle",{marginBottom:12,marginLeft:18,width:"calc(100% - 18px)"});const Fi=xi;var Bi=i(10644);class Ei extends F.Z{constructor(...e){super(...e),l()(this,"storeTypes",{store:Lt}),l()(this,"renderChurnSurveyModal",(()=>{const e=this.stores.store.state,{data:t}=this.props,i=te.XX(t),s=te.CM(this.environment);if(e.churnSurveyModalOpen&&s&&i)return a()(Fi,{churnType:e.churnType,periodEnd:i.periodEnd,onAccept:this.handleChurnSurveyModalAccept,onClose:this.handleChurnSurveyModalClose})})),l()(this,"handleFreeClick",(async()=>{const{data:e}=this.props;if(e&&"subscribed_admin"===e.type){const e=await new Promise((e=>{const{store:t}=this.stores;t.setState({churnType:"personal",churnSurveyModalOpen:!0,onAccept:()=>e(!0),onClose:()=>e(!1)})}));if(!e)return;e&&await v.EO({environment:this.environment,spaceStore:this.props.spaceStore,planType:"personal"})}else if(e&&("unsubscribed_admin"===e.type||"unsubscribed_member"===e.type)){await new Promise(((e,t)=>{h.showDialog({showCancel:!0,keepFocus:!1,message:a()("div",{},void 0,a()("h4",{style:{margin:"8px 0 0"}},void 0,a()(R.FormattedMessage,{id:"subscriptSettings.freePersonal.downgradeTitle",defaultMessage:"Downgrade to the Personal Plan?"})),a()("p",{style:{margin:"8px 0"}},void 0,a()(R.FormattedMessage,{id:"subscriptionSettings.freePersonal.downgradeMessage",defaultMessage:"The Personal Plan is free for 1-person use. You'll lose the ability to add members, and guests will be limited to 5 per workspace."}))),items:[{label:a()(R.FormattedMessage,{id:"subscriptionSettings.freePersonal.downgradeConfirmationButton",defaultMessage:"Downgrade to Personal Plan"}),color:"red",onAccept:()=>{e(!0)}}],handleCancel:()=>{e(!1)}})}))&&await v.EO({environment:this.environment,spaceStore:this.props.spaceStore,planType:"personal"})}})),l()(this,"handlePersonalClick",(async()=>{const{spaceStore:e,data:t}=this.props,i=te.XX(t);if(i&&te.lr(t)){const t=Rt.HA.personal[i.interval];await v.Mg({environment:this.environment,spaceStore:e,plan:t,billing:i.billing})}else v.I0(this.environment,{subscriptionTier:"personal",from:"pricing_grid"})})),l()(this,"handleEducationPlanClick",(()=>{const{spaceStore:e}=this.props;v.r7({environment:this.environment,spaceStore:e})})),l()(this,"handleTeamClick",(async()=>{const{spaceStore:e,data:t}=this.props,i=te.XX(t),s=i&&void 0===i.canceledAt;let o;if(i&&s&&"enterprise"!==te.CM(this.environment)&&(o=this.props.intl.formatMessage({id:"spaceSubscriptionPlans.teamPlan.confirmMessage",defaultMessage:"You are about to subscribe to Notion's Team Plan for {price} per member per month.{br}You will be charged a prorated amount, minus any account balance."},{price:te._B({subscriptionTier:"team",billingInterval:i.interval,intl:this.props.intl}),br:a()("br",{})})),o){const e="unsubscribed_admin"===t.type||"unsubscribed_member"===t.type||i&&i.canceledAt||"enterprise"!==te.CM(this.environment);if(!(await h.confirmUserAction({message:o,acceptLabel:this.props.intl.formatMessage({id:"spaceSubscriptionPlans.teamPlan.confirmButtonLabel",defaultMessage:"{upgrading, select, true {Upgrade to Team Plan} other {Downgrade to Team Plan}}"},{upgrading:e})})))return}if(i&&te.lr(t)){const t=Rt.HA.team[i.interval];await v.Mg({environment:this.environment,spaceStore:e,plan:t,billing:i.billing})}else v.I0(this.environment,{subscriptionTier:"team",from:"pricing_grid"})})),l()(this,"handleTeamFreeClick",(async()=>{const{data:e}=this.props;if(e&&"subscribed_admin"===e.type){const e=await new Promise((e=>{const{store:t}=this.stores;t.setState({churnType:"team",churnSurveyModalOpen:!0,onAccept:()=>e(!0),onClose:()=>e(!1)})}));if(g.rrP(this.environment,{confirmed:e}),!e)return;e&&await v.EO({environment:this.environment,spaceStore:this.props.spaceStore,planType:"team"})}else if(e&&("unsubscribed_admin"===e.type||"unsubscribed_member"===e.type)){const e=await new Promise(((e,t)=>{h.showDialog({showCancel:!0,keepFocus:!1,message:a()("div",{},void 0,a()("h4",{style:{margin:"8px 0 0"}},void 0,a()(R.FormattedMessage,{id:"subscriptionSettings.freeTeam.upgradeTitle",defaultMessage:"Try the Team Plan for free"})),a()("p",{style:{margin:"8px 0"}},void 0,a()(R.FormattedMessage,{id:"subscriptionSettings.freeTeam.upgradeMessage",defaultMessage:"You'll get access to most features of a paid Team Plan, with a 1,000 block storage limit. Upgrade to go unlimited anytime."}))),items:[{label:a()(R.FormattedMessage,{id:"subscriptionSettings.startTeamTrialDialog.confirmationbutton",defaultMessage:"Start Team trial"}),color:"blue",onAccept:()=>{e(!0)}}],handleCancel:()=>{e(!1)}})}));if(g.Ygf(this.environment,{confirmed:Boolean(e)}),!e)return;e&&await v.EO({environment:this.environment,spaceStore:this.props.spaceStore,planType:"team"})}})),l()(this,"handleEnterpriseClick",(async()=>{const{spaceStore:e,data:t}=this.props,i=te.XX(t),s=i&&void 0===i.canceledAt;if(i&&s){const e=a()(R.FormattedMessage,{id:"subscriptionSettings.upgradeToEnterpriseDialog.message",defaultMessage:"You are about to subscribe to Notion's Enterprise Plan for {price} per member per month.{br}You will be charged a prorated amount, minus any account balance.",values:{price:te._B({subscriptionTier:"enterprise",billingInterval:i.interval,intl:this.props.intl}),br:a()("br",{})}});if(!(await h.confirmUserAction({message:e,acceptLabel:a()(R.FormattedMessage,{id:"subscriptionSettings.upgradeToEnterpriseDialog.confirmationbutton",defaultMessage:"Upgrade to Enterprise Plan"})})))return}if(i&&te.lr(t)){const t=Rt.HA.enterprise[i.interval];await v.Mg({environment:this.environment,spaceStore:e,plan:t,billing:i.billing})}else v.I0(this.environment,{subscriptionTier:"enterprise",from:"pricing_grid"})})),l()(this,"handleChurnSurveyModalAccept",(()=>{const{store:e}=this.stores;e.state.churnSurveyModalOpen&&e.state.onAccept(),e.reset()})),l()(this,"handleChurnSurveyModalClose",(()=>{const{store:e}=this.stores;e.state.churnSurveyModalOpen&&e.state.onClose(),e.reset()}))}willMount(){v.bi(this.environment)}renderComponent(){return K.Z.state.online?this.renderPlans():a()(Bi.Z,{})}renderPlans(){const{churnSurveyModalOpen:e}=this.stores.store.state;return a()("div",{style:Ei.wrapStyle},void 0,a()(Dt.ZP,{style:Ei.scrollerStyle,type:Dt.xm.Y},void 0,this.renderSubscriptionInfo(),this.renderPricingGrid(),this.renderPriceDisclaimer(),this.allowEducationUpgrade()&&this.renderStudentUpgrade(),this.renderFAQ(),a()(E.Z,{innerStyle:{width:600,height:"80vh",overflow:"scroll"},open:e,render:this.renderChurnSurveyModal,onDismiss:this.handleChurnSurveyModalClose})))}renderPriceDisclaimer(){const{intl:e}=this.props;return a()("div",{style:Ei.priceDisclaimerStyle},void 0,a()(R.FormattedMessage,{id:"spaceSubscriptionPlans.priceDisclaimer",defaultMessage:"Prices shown are for annual billing. When billed month-to-month, the <b>Personal Pro Plan</b> is {personalMonthlyPrice} per month, the <b>Team Plan</b> is {teamMonthlyPrice} per member per month, and the <b>Enterprise Plan</b> is {enterpriseMonthlyPrice} per member per month.",values:{b:(...e)=>a()("b",{},void 0,e),personalMonthlyPrice:(0,Ot.Dx)({amount:D.default.pricing.personal.monthlyPrice,currency:"dollar",intl:e}),teamMonthlyPrice:(0,Ot.Dx)({amount:D.default.pricing.team.monthlyPricePerMember,currency:"dollar",intl:e}),enterpriseMonthlyPrice:(0,Ot.Dx)({amount:D.default.pricing.enterprise.monthlyPricePerMember,currency:"dollar",intl:e})}}))}renderSubscriptionInfo(){const{spaceStore:e}=this.props,{data:t}=this.props;return"subscribed_admin"===t.type?a()("div",{style:this.subscriptionInfoStyle()},void 0,te.D0(this.environment,e,t)):"unsubscribed_admin"===t.type||"unsubscribed_member"===t.type?a()("div",{style:{...this.subscriptionInfoStyle(),display:"flex",alignItems:"center",justifyContent:"space-between"}},void 0,a()("div",{},void 0,te.D0(this.environment,e,t))):void 0}renderPricingGrid(){const e=this.getPlanState();return a()(Ti,{isSettings:!0,planState:e,data:this.props.data})}renderStudentUpgrade(){return a()("div",{style:Ei.subsectionStyle},void 0,a()("div",{style:Ei.subsectionTitleStyle},void 0,a()(R.FormattedMessage,{id:"spaceSubscriptionPlans.studentsAndEducatorsSection.title",defaultMessage:"Students & educators"})),a()("div",{style:{color:this.theme.mediumTextColor,marginBottom:15}},void 0,a()(R.FormattedMessage,{id:"spaceSubscriptionPlans.studentsAndEducatorsSection.text",defaultMessage:"<p>Personal Pro Plans are free for students and educators! Simply sign up with your school email address and you'll immediately gain access to those features.</p><p>If you're already on a Personal Pro Plan, change the email associated with your account to your school email address to get it for free.</p>",values:{p:(...e)=>a()("div",{style:{marginBottom:4}},void 0,e)}})),a()(j.Z,{isLarge:!0,onClick:this.handleEducationPlanClick},void 0,a()(R.FormattedMessage,{id:"spaceSubscriptionPlans.studentsAndEducatorsSection.getEducationPlanButton.label",defaultMessage:"Get free Education plan"})))}renderFAQ(){return a()("div",{style:Ei.subsectionStyle},void 0,a()("div",{style:Ei.subsectionTitleStyle},void 0,a()(R.FormattedMessage,{id:"spaceSubscriptionPlans.faqSection.title",defaultMessage:"FAQ"})),a()(Qt,{cta:"intercom",type:"general",isSettings:!0}))}getMemberCount(){return te.su(this.props.data)}canSwitchPlans(){const e=te.wY(this.props.data);return this.props.spaceStore.canAdmin()&&!e}calculateButtonState(e){const{data:t}=this.props,i=te.DH(t);return"personal_free"===e?{free:"current",personal:"upgrade",team:"upgrade",enterprise:"upgrade"}:"personal"===e||"student"===e?{free:i?"current":"downgrade",personal:i?"resubscribe":"current",team:"upgrade",enterprise:"upgrade"}:"team_free"===e||"free"===e?{free:"downgrade",personal:"upgrade",team:"upgrade",enterprise:"upgrade"}:"team"===e?{free:"downgrade",personal:"downgrade",team:i?"resubscribe":"current",enterprise:"upgrade"}:"enterprise"===e?{free:"downgrade",personal:"downgrade",team:"downgrade",enterprise:i?"resubscribe":"current"}:void(0,vi.t1)(e)}isButtonStateActive(e){return["current","resubscribe"].includes(e)}getPlanState(){const e=te.CM(this.environment);if(!e)return;const t="team_free"===e||"free"===e,i=te.wY(this.props.data),s=this.calculateButtonState(e);return{plans:{free:{buttonType:s.free,isActive:this.isButtonStateActive(s.free),onClick:this.handleFreeClick},personal:{buttonType:s.personal,isActive:this.isButtonStateActive(s.personal),onClick:this.handlePersonalClick},team:{buttonType:s.team,isActive:this.isButtonStateActive(s.team)||t,onClick:this.handleTeamClick,onClickTeamFree:this.handleTeamFreeClick},enterprise:{buttonType:s.enterprise,isActive:this.isButtonStateActive(s.enterprise),onClick:this.handleEnterpriseClick}},isTeamTrial:t,isInAppPurchase:i,canSwitchPlans:this.canSwitchPlans(),memberCount:this.getMemberCount()}}allowEducationUpgrade(){const{data:e}=this.props,t=this.getPlanState();return t&&t.canSwitchPlans&&!te.wl(e)&&1===t.memberCount&&(t.plans.free.isActive||t.plans.personal.isActive)}subscriptionInfoStyle(){return{textAlign:"left",marginBottom:24,fontSize:14,borderBottom:"1px solid ".concat(this.theme.regularDividerColor),paddingBottom:16}}}l()(Ei,"wrapStyle",{display:"flex",flexDirection:"column",height:"100%"}),l()(Ei,"scrollerStyle",{transform:"translateZ(0px)",flexGrow:1,padding:30}),l()(Ei,"subscriptionInfoCtaButtonStyle",{marginLeft:16,paddingLeft:10}),l()(Ei,"priceDisclaimerStyle",{fontSize:14,marginTop:20,marginBottom:40}),l()(Ei,"subsectionStyle",{fontSize:14,marginTop:40}),l()(Ei,"subsectionTitleStyle",{fontSize:20,fontWeight:re.Z.fontWeight.bold,marginBottom:12});const Ri=(0,R.injectIntl)(Ei);var Di=i(6906);class _i extends y.Z{getInitialState(){return{paymentMethodModalOpen:!1,billingIntervalModalOpen:!1,billingEmailModalOpen:!1,vatIdModalOpen:!1,addressModalOpen:!1,applyCreditModalOpen:!1,billingEventsLimit:20,applyCouponModalOpen:!1,addressErrorMessage:void 0}}setAddressField(e){const t=this.state.temporaryAddress?this.state.temporaryAddress:{name:"",businessName:"",addressLine1:"",addressLine2:"",zipCode:"",city:"",state:"",country:""};this.setState({...this.state,temporaryAddress:{...t,...e},addressErrorMessage:void 0})}}const Li=_i;class Oi extends y.Z{getInitialState(){return{inputValue:void 0}}}const Ui=Oi;class Ni extends F.Z{constructor(...e){super(...e),l()(this,"storeTypes",{store:Ui}),l()(this,"handleInputChange",(e=>{const{store:t}=this.stores,i=e.target.value,s=this.inputValueToCents(i);let a;a=i?void 0!==s?i:this.getCurrentInputValue():"",t.setState({inputValue:a}),this.forceUpdate(),this.props.onChange(this.inputValueToCents(a)||0)}))}renderComponent(){const{focus:e,selectAll:t,availableCredit:i}=this.props,s=this.getCurrentInputValue();return a()(L.Z,{value:s,onChange:this.handleInputChange,focus:e,selectAll:t,disabled:i<=0,style:{maxWidth:120},inputStyle:{textAlign:"right"}})}getCurrentInputValue(){const{availableCredit:e}=this.props,{inputValue:t}=this.stores.store.state;return void 0===t?"".concat(Math.floor(e/100)):t}inputValueToCents(e){const{availableCredit:t}=this.props,i=Math.floor(100*parseFloat(e));if(!isNaN(i)&&i<=t&&i>=0)return i}}const Vi=Ni,Wi={workspaceBalance:a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.subscriptionSettingsSection.workspaceSubscriptionBalance.title",defaultMessage:"Workspace balance"}),applyCoupon:a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.subscriptionSettingsSection.applyCoupon.title",defaultMessage:"Apply coupon"}),discount:a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.subscriptionSettingsSection.discount.title",defaultMessage:"Discount"})};var zi=i(7765),Hi=i(42001),qi=i(28240);class Gi extends F.Z{constructor(...e){super(...e),l()(this,"storeTypes",{store:Li,billingHistoryRequestStore:ee.Z}),l()(this,"performGetBillingHistoryRequest",(async e=>{const{spaceStore:t}=this.props,i=await k.getBillingHistory(this.environment,{spaceId:t.id,limit:e});if("failed"===i.type)throw i.error;return i.data})),l()(this,"renderBillingHistoryResults",((e,t)=>{this.props.mockBillingHistoryResult&&(t=this.props.mockBillingHistoryResult);const{billingHistoryRequestStore:i}=this.stores;return a()("div",{},void 0,t&&0===t.events.length&&a()("div",{style:{color:this.theme.mediumTextColor,fontSize:14}},void 0,a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.invoicesSection.noInvoicesMessage",defaultMessage:"This workspace has no payments yet."})),t&&t.events.length>0&&a()("table",{},void 0,a()("tbody",{},void 0,t.events.map(this.renderBillingHistoryEvent))),t&&!t.reachedEndOfResults&&a()(Hi.Z,{onClick:this.handleLoadMoreBillingEventsClick,style:{marginLeft:-4,width:"100%"}},void 0,a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.invoicesSection.loadMoreInvoicesButton.label",defaultMessage:"Load more"})),i.state.loading&&a()(O.Z,{}))})),l()(this,"renderBillingHistoryEvent",((e,t)=>{let i;const{intl:s}=this.props;return i="paid"===e.status?e.total<0?a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.invoicesSection.invoiceStatus.credited",defaultMessage:"Credited"}):a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.invoicesSection.invoiceStatus.paid",defaultMessage:"Paid"}):e.attempted?a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.invoicesSection.invoiceStatus.failed",defaultMessage:"Failed"}):a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.invoicesSection.invoiceStatus.due",defaultMessage:"Due",description:"Label for the amount that the user owes on a given invoice"}),a()("tr",{style:{height:28,fontSize:14,whiteSpace:"nowrap"}},t,a()("td",{style:{width:"100%",paddingRight:18,color:this.theme.mediumTextColor}},void 0,(0,Pi.Z)(e.timestamp).format("LL")),a()("td",{style:{paddingRight:18}},void 0,i),a()("td",{style:{paddingRight:18,textAlign:"right"}},void 0,(0,Ot.Dx)({amount:e.total,currency:"dollar",intl:s})),a()("td",{},void 0,a()(qi.Z,{inline:!0,href:"/invoice/".concat(e.id),external:!0,innerStyle:this.getViewInvoiceButtonStyle()},void 0,a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.invoicesSection.viewInvoiceButton",defaultMessage:"View invoice"}))))})),l()(this,"handleLoadMoreBillingEventsClick",(()=>{this.stores.store.setState({...this.stores.store.state,billingEventsLimit:this.stores.store.state.billingEventsLimit+Gi.billingEventsLimitIncrement})}))}renderComponent(){const{store:e,billingHistoryRequestStore:t}=this.stores,i={request:e.state.billingEventsLimit,performRequest:this.performGetBillingHistoryRequest,render:this.renderBillingHistoryResults};return a()("div",{},void 0,a()(N.Z,{large:!0,divider:"full",style:{marginTop:36}},void 0,a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.invoicesSection.title",defaultMessage:"Invoices"})),c().createElement(zi.Z,n()({},i,{requestStore:t})))}static getModalStyle(e){return{width:480,background:e.popoverBackground,padding:24,borderRadius:3}}getViewInvoiceButtonStyle(){return{color:this.theme.mediumTextColor,padding:"2px 3px",borderRadius:3}}}l()(Gi,"billingEventsLimitIncrement",20),l()(Gi,"modalTitleStyle",{fontSize:18,marginBottom:16,fontWeight:re.Z.fontWeight.medium});const Ki=(0,R.injectIntl)(Gi),ji=(0,R.defineMessages)({apply_credit:{id:"spaceSubscriptionBilling.applyCreditButton.label",defaultMessage:"Apply credit",description:"Button a user clicks to apply Notion credits towards their Notion bill."},update:{id:"spaceSubscriptionBilling.updateButton.label",defaultMessage:"Update"},add:{id:"spaceSubscriptionBilling.addButton.label",defaultMessage:"Add"},apply:{id:"spaceSubscriptionBilling.apply.label",defaultMessage:"Apply"}});class Yi extends F.Z{renderComponent(){const{title:e,caption:t,buttonArgs:i}=this.props,s=c().createElement(R.FormattedMessage,ji[i.buttonPurpose]);return a()("div",{style:{display:"flex",alignItems:"center",fontSize:14}},void 0,a()("div",{style:{marginRight:"auto"}},void 0,e),a()("div",{style:{color:this.theme.mediumTextColor}},void 0,t),a()("div",{style:{minWidth:110,display:"flex",justifyContent:"flex-end"}},void 0,i.showButton&&a()(Hi.Z,{isBlue:!0,onClick:i.onClick,style:Yi.buttonStyle},void 0,s)))}}l()(Yi,"buttonStyle",{marginLeft:18,marginRight:-4,fontWeight:re.Z.fontWeight.medium});const Qi=(0,R.injectIntl)(Yi);var Ji=i(77907),Xi=i(90850);class $i extends y.Z{getInitialState(){return{temporaryCouponCode:void 0,couponCodeInput:void 0,error:void 0}}}const es=$i;var ts=i(4122);const is=(0,R.defineMessages)({couponCodePlaceholder:{id:"couponEntryInput.placeholder",defaultMessage:"Coupon code"},couponCodeNotFoundError:{id:"couponEntryInput.error.noPromo",defaultMessage:"Invalid coupon code"}});class ss extends F.Z{constructor(...e){super(...e),l()(this,"storeTypes",{couponCode:es})}didMount(){const e=(0,Xi.Zk)(this.environment.currentUser.id);e&&this.stores.couponCode.setState({...this.stores.couponCode.state,temporaryCouponCode:e})}renderComponent(){return a()("div",{style:this.getContainerStyle()},void 0,a()("div",{style:{display:"flex",flexDirection:"row"}},void 0,a()(L.Z,{textarea:!1,value:this.stores.couponCode.state.couponCodeInput,placeholder:pt.default.formatMessage(is.couponCodePlaceholder),onSubmit:()=>this.checkCouponCode(),onChange:e=>{this.stores.couponCode.setState({...this.stores.couponCode.state,couponCodeInput:e.target.value})},style:{height:32,paddingLeft:10,marginRight:this.props.hideApply?0:10}}),a()(zi.Z,{request:this.stores.couponCode.state.temporaryCouponCode||null,performRequest:async e=>{if(e)return this.applyCouponCode(e)},render:(e,t,i)=>{if(!this.props.hideApply)return a()(Y.Z,{isLarge:!1,onClick:()=>this.checkCouponCode()},void 0,a()(ts.Z,{loaded:i,spinnerSize:16,showSpinnerTimeout:500},void 0,a()(R.FormattedMessage,{id:"couponEntryInput.button.apply",defaultMessage:"Apply"})))}})),this.stores.couponCode.state.error&&a()(J.Z,{isMultiline:!1,style:{paddingTop:8,color:ie.ZP.red}},void 0,this.stores.couponCode.state.error))}checkCouponCode(){const e=this.stores.couponCode.state.couponCodeInput;e&&(this.stores.couponCode.setState({...this.stores.couponCode.state,temporaryCouponCode:e}),this.stores.couponCode.setState({...this.stores.couponCode.state,couponCodeInput:""}))}async applyCouponCode(e){const t=await k.getPromoCode(this.environment,{code:e});if("success"===t.type){var i;if(t.data.promo)return null!==(i=t.data.promo.applies_to)&&void 0!==i&&i.length&&!t.data.promo.applies_to.includes(this.props.plan)?void this.showError(e):(this.stores.couponCode.setState({...this.stores.couponCode.state,error:void 0}),this.props.handlePromo(t.data.promo),g.p8V(this.environment,{code:e,valid:!0,id:t.data.promo.id}),t.data.promo);this.showError(e)}else if("failed"===t.type){const e=t.error.name;this.stores.couponCode.setState({...this.stores.couponCode.state,error:e})}else(0,vi.t1)(t)}showError(e){this.stores.couponCode.setState({...this.stores.couponCode.state,error:pt.default.formatMessage(is.couponCodeNotFoundError)}),g.p8V(this.environment,{code:e,valid:!1,id:void 0})}getContainerStyle(){return{display:"flex",flexDirection:"column",...this.props.style?this.props.style:void 0}}}const as=ss;var os=i(93039),ns=i(80567);var rs=i(1063);const ls={offline:a()(R.FormattedMessage,{defaultMessage:"Please go online to manage billing.",id:"spaceSubscriptionBilling.offline.message"})};class ds extends F.Z{constructor(...e){super(...e),l()(this,"couponEntryInput",null),l()(this,"storeTypes",{store:Li,billingHistoryRequestStore:ee.Z}),l()(this,"renderPaymentMethodModal",(()=>{const{customerData:e,spaceStore:t}=this.props;return a()(Ji.LazySpaceSubscriptionUpdatePaymentMethodModal,{customerData:e,spaceStore:t,onComplete:this.handleModalClose})})),l()(this,"renderBillingIntervalModal",(()=>{const{temporaryBillingInterval:e}=this.stores.store.state,{customerData:t}=this.props,i=e||t.interval,{monthlyPlanAmount:s,yearlyPlanAmount:o}=t,n=1-o/(12*s);return a()(cs,{theme:this.theme,title:a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.changeBillingInterval.title",defaultMessage:"Change billing interval"}),helpButton:a()(Q.Z,{title:a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.changeBillingInterval.helpButton.label",defaultMessage:"Learn about how this change will impact what you pay."}),href:(0,ve.UY)("guides.changeBillingInterval"),analyticsFrom:"billing_interval_settings"}),acceptAction:"update",onAccept:this.handleBillingIntervalAccept,onClose:this.handleModalClose},void 0,a()("div",{style:{marginTop:12,marginBottom:16}},void 0,te.Rj({environment:this.environment,productId:t.productId,yearlyPlanAmount:o,monthlyPlanAmount:s,yearlySavingsPercent:n,currentBillingInterval:i,handleMonthlyBillingClick:this.handleMonthlyBillingClick,handleYearlyBillingClick:this.handleYearlyBillingClick})))})),l()(this,"renderApplyCreditModal",(()=>{const{subscriptionData:e,customerData:t,intl:i}=this.props,{availableCredit:s}=e,o=this.getCurrentFormCreditAmount(),n=Math.max(0,(t.nextInvoiceAmount||0)-o);return a()("div",{style:ds.getModalStyle(this.theme)},void 0,a()("div",{style:ds.modalTitleStyle},void 0,a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.useCreditModal.title",defaultMessage:"Use Notion credit - {creditInDollars} available",values:{creditInDollars:(0,Ot.Dx)({amount:s,currency:"dollar",intl:i})}})),a()("div",{style:{fontSize:14,display:"flex",alignItems:"center",marginBottom:16}},void 0,a()("div",{style:{width:"100%",marginRight:20,color:this.theme.mediumTextColor}},void 0,a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.useCreditModal.amountOfCreditQuestion",defaultMessage:"How much credit would you like to apply to your next invoice?"})),a()(Vi,{availableCredit:s,focus:!0,selectAll:!0,onChange:this.handleApplyCreditAmountInputChange}),a()("div",{style:{whiteSpace:"nowrap",marginLeft:8}},void 0,"/"," ",(0,Ot.Dx)({amount:s,currency:"dollar",intl:i}))),a()("div",{style:{borderTop:"1px solid ".concat(this.theme.regularDividerColor),paddingTop:16}},void 0,a()("div",{style:{paddingBottom:18,fontSize:12,color:this.theme.mediumTextColor}},void 0,a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.useCreditModal.warning",defaultMessage:"Applying credit to your account <bold>cannot be undone</bold>.",values:{bold:(...e)=>a()("b",{},void 0,e)}})),a()("div",{style:{display:"flex",alignItems:"center"}},void 0,a()("div",{style:{fontSize:36,lineHeight:1}},void 0,(0,Ot.Dx)({amount:n,currency:"dollar",intl:i})),a()("div",{style:{marginLeft:8,fontSize:12,color:this.theme.mediumTextColor,alignSelf:"flex-end"}},void 0,a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.useCreditModal.nextInvoiceAmount",defaultMessage:"next invoice total",description:"Text that appears next to the amount, in dollars, that the user's next invoice will be after applying their Notion credits to their bill."})),a()(Y.Z,{isLarge:!0,style:{marginLeft:"auto"},onClick:this.handleModalClose},void 0,a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.useCreditModal.cancelButton.label",defaultMessage:"Cancel"})),a()(j.Z,{isLarge:!0,style:{marginLeft:12},disabled:o<=0,onClick:this.handleApplyCreditAccept},void 0,a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.useCreditModal.applyCreditButton.label",defaultMessage:"Apply credit"})))))})),l()(this,"renderSingleTextFieldModal",((e,t,i,s,o)=>a()(cs,{theme:this.theme,title:t,acceptAction:o,onAccept:s,onClose:this.handleModalClose},void 0,a()(L.Z,{focus:!0,selectAll:!0,value:e,onChange:i,onSubmit:s,style:ds.modalInputStyle})))),l()(this,"renderBillingEmailModal",(()=>{const{customerData:e}=this.props,{temporaryBillingEmail:t}=this.stores.store.state,i=void 0!==t?t:e.billingEmail||"",s=e.billingEmail?"update":"add";return this.renderSingleTextFieldModal(i,a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.changeBillingEmailModal.title",defaultMessage:"Change billing email"}),this.handleBillingEmailChange,this.handleBillingEmailAccept,s)})),l()(this,"renderVatIdModal",(()=>{const{customerData:e}=this.props,{temporaryVatId:t}=this.stores.store.state,i=void 0!==t?t:e.vatId||"",s=e.vatId?"update":"add";return a()(cs,{theme:this.theme,title:a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.changeVATIDModal.title",defaultMessage:"Change VAT/GST number"}),acceptAction:s,onAccept:this.handleVatIdAccept,onClose:this.handleModalClose},void 0,a()(L.Z,{focus:!0,selectAll:!0,value:i,onChange:this.handleVatIdChange,onSubmit:this.handleVatIdAccept,style:ds.modalInputStyle}),a()("div",{style:{color:this.theme.mediumTextColor,fontSize:re.Z.fontSize.UISmall.desktop,marginTop:-10}},void 0,a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.changeVATIDModal.subtitle",defaultMessage:"Please include your country code"})))})),l()(this,"renderApplyCouponModal",(()=>a()(cs,{theme:this.theme,title:a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.applyCouponModal.title",defaultMessage:"Apply coupon"}),acceptAction:"apply",onAccept:()=>{this.couponEntryInput&&this.couponEntryInput.checkCouponCode()},onClose:this.handleModalClose},void 0,c().createElement(as,{ref:e=>this.couponEntryInput=e,hideApply:!0,plan:this.props.customerData.plan,handlePromo:async e=>{this.handleModalClose();await v.Mg({environment:this.environment,spaceStore:this.props.spaceStore,coupon:e&&"coupon"===e.source?e.code:void 0,promoCodeId:e&&"promo_code"===e.source?e.code:void 0})&&(0,h.showMessage)({message:a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.applyCouponModal.successMessage",defaultMessage:"Coupon applied!"})})}})))),l()(this,"updateTemporaryAddress",(e=>{const{temporaryAddress:t}=this.stores.store.state;this.stores.store.setState({...this.stores.store.state,temporaryAddress:{...this.props.customerData.address,...t,...e}})})),l()(this,"renderAddressModal",(()=>{const{customerData:e}=this.props,{temporaryAddress:t,addressErrorMessage:i}=this.stores.store.state,s=te.CM(this.environment);return a()("div",{style:{display:"flex",flexDirection:"column",maxHeight:"75vh"}},void 0,a()("div",{style:ds.getModalStyle(this.theme)},void 0,a()("div",{style:ds.modalTitleStyle},void 0,a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.changeYourAddressModal.title",defaultMessage:"Change your address"})),a()(os.J,{address:t||{name:e.customerName||"",businessName:"",addressLine1:"",addressLine2:"",zipCode:"",city:"",state:"",country:""},updateAddress:e=>{this.stores.store.setAddressField(e)},shouldShowBusinessName:Boolean(s&&["team","enterprise"].includes(s))}),a()("div",{style:{color:ie.ZP.red,marginTop:10}},void 0,i)),a()("div",{style:{display:"flex",justifyContent:"flex-end",padding:"16px 24px",background:this.theme.cardContentBackground}},void 0,a()(Y.Z,{isLarge:!0,onClick:this.handleModalClose},void 0,a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.changeBillingAddressModal.cancelButton.label",defaultMessage:"Cancel"})),a()(j.Z,{style:{marginLeft:12},isLarge:!0,disabled:void 0===this.getUpdatedAddress(),onClick:this.handleAddressAccept},void 0,a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.changeBillingAddressModal.updateButton.label",defaultMessage:"Update"}))))})),l()(this,"handleChangePlanClick",(()=>{x.ZP.setState({open:!0,currentTab:"plans"})})),l()(this,"handlePaymentMethodChangeClick",(()=>{this.stores.store.setState({...this.stores.store.state,paymentMethodModalOpen:!0})})),l()(this,"handleBillingIntervalChangeClick",(()=>{this.stores.store.setState({...this.stores.store.state,billingIntervalModalOpen:!0})})),l()(this,"handleBillingEmailChangeClick",(()=>{this.stores.store.setState({...this.stores.store.state,billingEmailModalOpen:!0})})),l()(this,"handleAddressChangeClick",(()=>{this.stores.store.setState({...this.stores.store.state,addressModalOpen:!0})})),l()(this,"handleVatIdChangeClick",(e=>{const t=e.address.country;if(!t)return void(0,h.showErrorMessage)(a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.vatId.missingCountry",defaultMessage:"To update your VAT/GST number, please update your billing address."}));!{AE:"ae_trn",AU:"au_abn",CA:"ca_bn",CH:"ch_vat",ES:"eu_vat",AT:"eu_vat",BE:"eu_vat",BG:"eu_vat",CY:"eu_vat",CZ:"eu_vat",DE:"eu_vat",EE:"eu_vat",FI:"eu_vat",FR:"eu_vat",GR:"eu_vat",HR:"eu_vat",HU:"eu_vat",IE:"eu_vat",IT:"eu_vat",LT:"eu_vat",LU:"eu_vat",LV:"eu_vat",MT:"eu_vat",NL:"eu_vat",PL:"eu_vat",PT:"eu_vat",RO:"eu_vat",RU:"ru_inn",SE:"eu_vat",SI:"eu_vat",SK:"eu_vat",GB:"gb_vat",IN:"in_gst",KR:"kr_brn",NZ:"nz_gst",SG:"sg_gst"}[t]?(0,h.showErrorMessage)(a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.vatId.vatNotRequired",defaultMessage:"A VAT/GST number is not required for your tax jurisdiction."})):this.stores.store.setState({...this.stores.store.state,vatIdModalOpen:!0})})),l()(this,"handleApplyCouponClick",(()=>{this.stores.store.setState({...this.stores.store.state,applyCouponModalOpen:!0})})),l()(this,"handleModalClose",(()=>{this.stores.store.reset()})),l()(this,"handleBillingEmailChange",(e=>{this.stores.store.setState({...this.stores.store.state,temporaryBillingEmail:e.target.value})})),l()(this,"handleBillingEmailAccept",(async()=>{const{spaceStore:e,customerData:t}=this.props,{temporaryBillingEmail:i}=this.stores.store.state;i!==t.billingEmail&&await v.Mg({environment:this.environment,spaceStore:e,billingEmail:i}),this.handleModalClose()})),l()(this,"handleVatIdChange",(e=>{this.stores.store.setState({...this.stores.store.state,temporaryVatId:e.target.value})})),l()(this,"handleVatIdAccept",(async()=>{const{spaceStore:e,customerData:t}=this.props,{temporaryVatId:i}=this.stores.store.state;i!==t.vatId&&await v.Mg({environment:this.environment,spaceStore:e,vatId:i}),this.handleModalClose()})),l()(this,"handleAddressAccept",(async()=>{const{spaceStore:e}=this.props,t=this.getUpdatedAddress();if(!t)return void this.stores.store.setState({...this.stores.store.state,addressErrorMessage:this.props.intl.formatMessage({id:"spaceSubscriptionBilling.address.invalidError",defaultMessage:"Your address is invalid. Please update your address so we can process your payment."})});const i=await(0,ns.a)(this.environment,t);if(!i.valid)return void this.stores.store.setState({...this.stores.store.state,addressErrorMessage:this.props.intl.formatMessage({id:"spaceSubscriptionBilling.address.invalidError",defaultMessage:"Your address is invalid. Please update your address so we can process your payment."})});const s={...t,...i.validatedAddresses?i.validatedAddresses[0]:void 0};if(t)try{await v.y3({environment:this.environment,spaceStore:e,address:s}),this.handleModalClose()}catch(a){}})),l()(this,"getUpdatedAddress",(()=>{const{customerData:e}=this.props,{temporaryAddress:t}=this.stores.store.state;if(t&&t!==e.address)return t})),l()(this,"handleMonthlyBillingClick",(()=>{this.stores.store.setState({...this.stores.store.state,temporaryBillingInterval:"month"})})),l()(this,"handleYearlyBillingClick",(()=>{this.stores.store.setState({...this.stores.store.state,temporaryBillingInterval:"year"})})),l()(this,"handleBillingIntervalAccept",(async()=>{const{spaceStore:e,customerData:t}=this.props,{temporaryBillingInterval:i}=this.stores.store.state;if(i&&i!==t.interval){const t=this.getPlanForOppositeBillingInterval();t&&await v.Mg({environment:this.environment,spaceStore:e,plan:t})}this.handleModalClose()})),l()(this,"handleUseCardClick",(()=>{this.stores.store.setState({...this.stores.store.state,temporaryBillingType:"charge_automatically"})})),l()(this,"handleSendInvoiceClick",(()=>{this.stores.store.setState({...this.stores.store.state,temporaryBillingType:"send_invoice"})})),l()(this,"handleCardUpdateClick",(async()=>{const{spaceStore:e}=this.props,{customerData:t}=this.props;if(t.billingEmail){const i=await v.Ay({name:"Update your Card",panelLabel:"Update",email:t.billingEmail});await v.Mg({environment:this.environment,spaceStore:e,billing:"charge_automatically",stripeToken:i})}this.handleModalClose()})),l()(this,"handlePaymentMethodAccept",(async()=>{const{spaceStore:e}=this.props,{customerData:t}=this.props,{temporaryBillingType:i}=this.stores.store.state,s=i||t.billing;if("charge_automatically"!==s||t.brand)s!==t.billing&&await v.Mg({environment:this.environment,spaceStore:e,billing:i});else{const{currentUserStore:i}=G.default.state,s=i?i.getValue():void 0,a=t.billingEmail||(s?s.email:void 0);if(!a)throw new Error("No billing email found.");const o=await v.Ay({name:"Update your Card",panelLabel:"Update",email:a});await v.Mg({environment:this.environment,spaceStore:e,billing:"charge_automatically",stripeToken:o,billingEmail:a})}this.handleModalClose()})),l()(this,"handleApplyCreditClick",(()=>{this.stores.store.setState({...this.stores.store.state,applyCreditModalOpen:!0})})),l()(this,"handleApplyCreditAccept",(async()=>{const e=this.getCurrentFormCreditAmount(),{spaceStore:t}=this.props;e>0&&await v.Mg({environment:this.environment,spaceStore:t,creditAmount:e}),this.handleModalClose(),g.MFb(this.environment,{amount:e})})),l()(this,"handleApplyCreditAmountInputChange",(e=>{this.stores.store.setState({...this.stores.store.state,temporaryApplyCreditCents:e})})),l()(this,"handleRestartSubscriptionClick",(async()=>{const{spaceStore:e}=this.props,{customerData:t}=this.props;await v.Mg({environment:this.environment,spaceStore:e,plan:t.plan}),this.handleModalClose()}))}willMount(){v.bi(this.environment)}renderComponent(){return K.Z.state.online?this.renderBilling():ds.renderOfflineMessage()}static renderOfflineMessage(){return a()(U.Z,{},void 0,a()(J.Z,{isSmall:!0,style:{textAlign:"center"}},void 0,ls.offline))}renderBilling(){const{customerData:e,subscriptionData:t}=this.props,{paymentMethodModalOpen:i,billingIntervalModalOpen:s,billingEmailModalOpen:o,addressModalOpen:r,applyCreditModalOpen:l,vatIdModalOpen:d,applyCouponModalOpen:u}=this.stores.store.state;return a()("div",{style:ds.wrapStyle},void 0,a()(Dt.ZP,{style:ds.scrollerStyle,type:Dt.xm.Y},void 0,this.renderHeader(e),this.renderSummary(t),this.renderPaymentMethod(e),this.renderSeparator(),this.renderBillingInterval(e),this.renderSeparator(),this.renderBillingEmail(e),this.renderSeparator(),this.renderAddress(e),this.renderSeparator(),this.renderVatId(e),this.renderSeparator(),this.renderCredit(e),this.renderSeparator(),this.renderCoupon(),this.renderDiscount(),c().createElement(Ki,n()({},this.props,{data:t})),a()(E.Z,{open:i,render:this.renderPaymentMethodModal,onDismiss:this.handleModalClose}),a()(E.Z,{open:s,render:this.renderBillingIntervalModal,onDismiss:this.handleModalClose}),a()(E.Z,{open:l,render:this.renderApplyCreditModal,onDismiss:this.handleModalClose}),a()(E.Z,{open:o,render:this.renderBillingEmailModal,onDismiss:this.handleModalClose}),a()(E.Z,{open:r,render:this.renderAddressModal,onDismiss:this.handleModalClose}),a()(E.Z,{open:d,render:this.renderVatIdModal,onDismiss:this.handleModalClose}),a()(E.Z,{open:u,render:this.renderApplyCouponModal,onDismiss:this.handleModalClose})))}renderHeader(e){let t=a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.subscriptionSettingsSection.legacyPlanTitle",defaultMessage:"Legacy Plan"});switch(e.productId){case D.default.pricing.personal.productId:t=a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.subscriptionSettingsSection.personalPlanTitle",defaultMessage:"Personal Pro Plan"});break;case D.default.pricing.student.productId:t=a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.subscriptionSettingsSection.personalEducationPlanTitle",defaultMessage:"Personal Pro (Education) Plan"});break;case D.default.pricing.team.productId:t=a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.subscriptionSettingsSection.teamPlanTitle",defaultMessage:"Team Plan"});break;case D.default.pricing.enterprise.productId:t=a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.subscriptionSettingsSection.enterprisePlanTitle",defaultMessage:"Enterprise Plan"})}return a()(N.Z,{large:!0,divider:"full"},void 0,t)}renderSummary(e){const{spaceStore:t}=this.props,i=te.D0(this.environment,t,e),s=te.DH(e),o="subscribed_admin"===e.type;return a()("div",{style:ds.summaryStyle},void 0,a()("div",{style:ds.summaryMessageStyle},void 0,i),s&&a()(j.Z,{isLarge:!0,onClick:this.handleRestartSubscriptionClick,style:{marginRight:8}},void 0,a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.subscriptionSettingsSection.restartSubscriptionButton.label",defaultMessage:"Restart subscription"})),o&&a()(Y.Z,{isLarge:!0,onClick:this.handleChangePlanClick},void 0,a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.subscriptionSettingsSection.changePlanButton.label",defaultMessage:"Change plan"})))}renderSeparator(){return a()("div",{style:{flex:"none",height:1,marginTop:10,marginBottom:10,background:this.theme.regularDividerColor}})}renderPaymentMethod(e){return a()(Qi,{title:a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.subscriptionSettingsSection.paymentMethod.title",defaultMessage:"Payment method"}),caption:a()(d.Fragment,{},void 0,"send_invoice"===e.billing&&a()("div",{},void 0,a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.subscriptionSettingsSection.paymentMethod.value.achOrWireTransfer",defaultMessage:"ACH or Wire Transfer"})),"charge_automatically"===e.billing&&(e.last4&&e.brand?a()("div",{},void 0,a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.subscriptionSettingsSection.paymentMethod.value.creditCard",defaultMessage:"{creditCardBrand} ending in {lastFourDigits}",values:{creditCardBrand:(0,Di.Z)(e.brand),lastFourDigits:e.last4}})):a()("div",{},void 0,a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.subscriptionSettingsSection.paymentMethod.value.none",defaultMessage:"None",description:"The payment method setting we display for users who haven't set up a payment method yet"})))),buttonArgs:{showButton:!0,buttonPurpose:"update",onClick:this.handlePaymentMethodChangeClick}})}renderBillingInterval(e){return a()(Qi,{title:a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.subscriptionSettingsSection.billingInterval.title",defaultMessage:"Billing interval"}),caption:a()("div",{},void 0,"month"===e.interval?a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.subscriptionSettingsSection.billingInterval.value.monthly",defaultMessage:"Monthly"}):a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.subscriptionSettingsSection.billingInterval.value.yearly",defaultMessage:"Yearly"})),buttonArgs:{showButton:Boolean(this.getPlanForOppositeBillingInterval()),buttonPurpose:"update",onClick:this.handleBillingIntervalChangeClick}})}renderBillingEmail(e){return a()(Qi,{title:a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.subscriptionSettingsSection.billingEmail.title",defaultMessage:"Billing email"}),caption:a()("div",{},void 0,e.billingEmail||""),buttonArgs:{showButton:!0,buttonPurpose:Boolean(e.billingEmail)?"update":"add",onClick:this.handleBillingEmailChangeClick}})}renderVatId(e){return a()(Qi,{title:a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.subscriptionSettingsSection.VATID.title",defaultMessage:"VAT/GST number",description:"Title for the section where users can update their VAT (value added tax) identification number"}),caption:a()("div",{},void 0,e.vatId||""),buttonArgs:{showButton:!0,buttonPurpose:Boolean(e.vatId)?"update":"add",onClick:()=>this.handleVatIdChangeClick(e)}})}renderAddress(e){return a()(Qi,{title:a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.subscriptionSettingsSection.yourAddress.title",defaultMessage:"Your address"}),caption:a()("div",{style:{textAlign:"right",width:"80%",float:"right"}},void 0,this.renderAddressString(e.address)||""),buttonArgs:{showButton:!0,buttonPurpose:e.address&&!m().isEmpty(e.address)?"update":"add",onClick:this.handleAddressChangeClick}})}renderCredit(e){const t=-Math.min(0,e.accountBalance),{intl:i}=this.props;return a()(Qi,{title:Wi.workspaceBalance,caption:a()("div",{},void 0,(0,Ot.Dx)({amount:t,currency:"dollar",intl:i})),buttonArgs:{showButton:!0,buttonPurpose:"apply_credit",onClick:this.handleApplyCreditClick}})}renderCoupon(){const e=te.CM(this.environment);return e&&te.Fu(this.environment,e)?a()("div",{style:{display:"flex",alignItems:"center",fontSize:14,justifyContent:"end"}},void 0,a()("div",{style:{minWidth:110,display:"flex",justifyContent:"flex-end"}},void 0,a()(rs.X,{tier:e}))):null}renderDiscount(){var e;const{customerData:t}=this.props;return null!==(e=t.promo)&&void 0!==e&&e.percent_off?a()(Qi,{title:Wi.discount,caption:a()("div",{},void 0,a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.discount.percentOff",defaultMessage:"{percentOff}% off",values:{percentOff:t.promo.percent_off}})),buttonArgs:{showButton:!1,buttonPurpose:"add",onClick:()=>{}}}):null}renderAddressString(e){return e?this.props.intl.formatList([e.name,e.businessName,e.addressLine1,e.country].filter(Boolean),{type:"conjunction",style:"narrow"}):""}getCurrentFormCreditAmount(){const{subscriptionData:e}=this.props,{store:t}=this.stores,{temporaryApplyCreditCents:i}=t.state;return void 0!==i?i:e.availableCredit}getPlanForOppositeBillingInterval(){const{customerData:e}=this.props,t=Rt.KK.find((t=>t.indexOf(e.plan)>=0));if(t){const i=t.indexOf(e.plan);return t[0===i?1:0]}}static getModalStyle(e){return{width:500,background:e.popoverBackground,padding:24,borderRadius:3}}}function cs(e){const t=c().createElement(R.FormattedMessage,ji[e.acceptAction]);return a()("div",{style:ds.getModalStyle(e.theme)},void 0,a()("div",{style:ds.modalTitleStyle},void 0,e.title),e.children,a()("div",{style:{marginBottom:20}},void 0,e.helpButton),a()("div",{style:{display:"flex",justifyContent:"flex-end"}},void 0,a()(Y.Z,{isLarge:!0,onClick:e.onClose,style:{marginRight:12}},void 0,a()(R.FormattedMessage,{id:"spaceSubscriptionBilling.cancelButton.label",defaultMessage:"Cancel"})),a()(j.Z,{isLarge:!0,onClick:e.onAccept},void 0,t)))}l()(ds,"modalTitleStyle",{fontSize:18,marginBottom:16,fontWeight:re.Z.fontWeight.medium}),l()(ds,"wrapStyle",{display:"flex",flexDirection:"column",height:"100%"}),l()(ds,"scrollerStyle",{height:"100%",padding:"36px 60px"}),l()(ds,"summaryStyle",{display:"flex",alignItems:"flex-start",fontSize:14,marginBottom:36}),l()(ds,"summaryMessageStyle",{marginRight:"auto",paddingRight:32}),l()(ds,"modalInputStyle",{marginTop:12,marginBottom:20});const us=(0,R.injectIntl)(ds);class ms extends F.Z{constructor(...e){super(...e),l()(this,"storeTypes",{store:Li,billingHistoryRequestStore:ee.Z})}willMount(){v.bi(this.environment)}renderComponent(){const{data:e}=this.props;return K.Z.state.online?a()("div",{style:ms.wrapStyle},void 0,a()(Dt.ZP,{style:ms.scrollerStyle,type:Dt.xm.Y},void 0,a()(N.Z,{large:!0,divider:"full"},void 0,c().createElement(R.FormattedMessage,x.sY.billingTab)),this.renderCredit(e),this.renderSeparator(),c().createElement(Ki,this.props))):ms.renderOfflineMessage()}static renderOfflineMessage(){return a()(U.Z,{},void 0,a()(J.Z,{isSmall:!0,style:{textAlign:"center"}},void 0,ls.offline))}renderCredit(e){const t=-Math.min(0,e.accountBalance),{intl:i}=this.props;return a()(Qi,{title:Wi.workspaceBalance,caption:a()("div",{},void 0,(0,Ot.Dx)({amount:t,currency:"dollar",intl:i})),buttonArgs:{showButton:!1,buttonPurpose:"apply_credit",onClick:m().noop}})}renderSeparator(){return a()("div",{style:{flex:"none",marginTop:30}})}}l()(ms,"wrapStyle",{display:"flex",flexDirection:"column",height:"100%"}),l()(ms,"scrollerStyle",{height:"100%",padding:"36px 60px"});const ps=(0,R.injectIntl)(ms);i(85827);class gs extends y.Z{getInitialState(){return{emailInputValue:"",showAllInviteCredits:!1}}}const hs=gs;var fs=i(47593),vs=i(84882);class ys extends F.Z{constructor(...e){super(...e),l()(this,"handleImportActionClick",(()=>{fs.Z.setState({open:!0}),g.dDy(this.environment,{type:"import_evernote"})})),l()(this,"handleWebActionClick",(()=>{si.navigateToExternalURL({environment:this.environment,url:"/product"}),g.dDy(this.environment,{type:"web_login"})})),l()(this,"handleDesktopActionClick",(()=>{si.navigateToExternalURL({environment:this.environment,url:"/desktop"}),g.dDy(this.environment,{type:"desktop_login"})})),l()(this,"handleMobileActionClick",(()=>{si.navigateToExternalURL({environment:this.environment,url:"/mobile"}),g.dDy(this.environment,{type:"mobile_login"})})),l()(this,"handleBrowserExtensionActionClick",(()=>{si.navigateToExternalURL({environment:this.environment,url:"/web-clipper"}),g.dDy(this.environment,{type:"browser_extension"})})),l()(this,"handleMobileShareSheetActionClick",(()=>{si.navigateToExternalURL({environment:this.environment,url:"/mobile"}),g.dDy(this.environment,{type:"mobile_share_sheet"})}))}renderComponent(){return a()("div",{style:this.getWrapperStyle()},void 0,a()("div",{style:{flex:0}},void 0,this.renderLeft()),a()("div",{style:this.getCenterStyle()},void 0,a()("div",{},void 0,this.renderTitle()),a()(J.Z,{isSmall:!0,style:{marginBottom:2}},void 0,this.renderCaption())),a()("div",{style:{flex:0}},void 0,this.renderRight()))}renderTitle(){const{credit:e,intl:t}=this.props;if("invited_user"===e.type){const i=this.getUserStore(e.to_user_id).getValue();return a()(d.Fragment,{},void 0,(0,Ct.Nz)(t,i)," ",!e.activated&&i&&!i.onboarding_completed&&a()("span",{style:{color:this.theme.mediumTextColor}},void 0,a()(R.FormattedMessage,{id:"userCreditSettings.inviteFriendsSection.userHasNotSignedUpNote",defaultMessage:"(has not signed up)",description:"Annotation that appears next to a referred user's name if the user hasn't signed up for Notion yet"})),!e.activated&&i&&i.onboarding_completed&&a()("span",{style:{color:this.theme.mediumTextColor}},void 0,a()(R.FormattedMessage,{id:"userCreditSettings.inviteFriendsSection.userHasAlreadySignedUpNote",defaultMessage:"(has already signed up)",description:"Annotation that appears next to a referred user's name if the user has signed up for Notion already"})))}if("invited_by_user"===e.type){const i=this.getUserStore(e.from_user_id).getValue();return a()(d.Fragment,{},void 0,(0,Ct.Nz)(t,i),a()("span",{style:{color:this.theme.mediumTextColor}},void 0,a()(R.FormattedMessage,{id:"userCreditSettings.inviteFriendsSection.sourceOfReferralNote",defaultMessage:"(invited you)",description:"Annotation that appears next to the name of the user who invited this user to Notion"})))}return"import_evernote"===e.type?t.formatMessage({id:"userCreditSettings.otherWaysToEarnCreditSection.evernoteImport.title",defaultMessage:"Import from Evernote"}):"web_login"===e.type?t.formatMessage({id:"userCreditSettings.otherWaysToEarnCreditSection.webApp.title",defaultMessage:"Log in on the web"}):"desktop_login"===e.type?t.formatMessage({id:"userCreditSettings.otherWaysToEarnCreditSection.desktopApp.title",defaultMessage:"Log in on the desktop app"}):"mobile_login"===e.type?t.formatMessage({id:"userCreditSettings.otherWaysToEarnCreditSection.mobileApp.title",defaultMessage:"Log in on the mobile app"}):"browser_extension"===e.type?t.formatMessage({id:"userCreditSettings.otherWaysToEarnCreditSection.webClipper.title",defaultMessage:"Use the Web Clipper"}):"mobile_share_sheet"===e.type?t.formatMessage({id:"userCreditSettings.otherWaysToEarnCreditSection.mobileShare.title",defaultMessage:"Use the iOS or Android system share menu"}):void 0}renderCaption(){const{credit:e,intl:t}=this.props;if("invited_user"===e.type){const t=this.getUserStore(e.to_user_id).getValue();return t&&t.email}if("invited_by_user"===e.type){const t=this.getUserStore(e.from_user_id).getValue();return t&&t.email}return"import_evernote"===e.type?t.formatMessage({id:"userCreditSettings.otherWaysToEarnCreditSection.evernoteImport.description",defaultMessage:"Import your notes and notebooks"}):"web_login"===e.type?t.formatMessage({id:"userCreditSettings.otherWaysToEarnCreditSection.webApp.description",defaultMessage:"Sign in to Notion from any web browser"}):"desktop_login"===e.type?t.formatMessage({id:"userCreditSettings.otherWaysToEarnCreditSection.desktopApp.description",defaultMessage:"Download the desktop app and sign in"}):"mobile_login"===e.type?t.formatMessage({id:"userCreditSettings.otherWaysToEarnCreditSection.mobileApp.description",defaultMessage:"Download the mobile app and sign in"}):"browser_extension"===e.type?t.formatMessage({id:"userCreditSettings.otherWaysToEarnCreditSection.webClipper.description",defaultMessage:"Download the Chrome extension and save a link"}):"mobile_share_sheet"===e.type?t.formatMessage({id:"userCreditSettings.otherWaysToEarnCreditSection.mobileShare.description",defaultMessage:"Use the share menu to save a link into Notion"}):void 0}renderLeft(){const{credit:e}=this.props;if("invited_user"===e.type){const t=this.getUserStore(e.to_user_id);return a()(vs.Z,{userValue:t.getValue(),style:{marginRight:8},size:24,hasTooltip:!0})}if("invited_by_user"===e.type){const t=this.getUserStore(e.from_user_id);return a()(vs.Z,{userValue:t.getValue(),style:{marginRight:8},size:24,hasTooltip:!0})}return"import_evernote"===e.type?se.Z.evernoteLogo(this.getIconStyle()):"web_login"===e.type?se.Z.logInWeb(this.getIconStyle()):"desktop_login"===e.type?se.Z.deviceDesktop(this.getIconStyle()):"mobile_login"===e.type?se.Z.deviceMobile(this.getIconStyle()):"browser_extension"===e.type?se.Z.googleChrome(this.getIconStyle()):"mobile_share_sheet"===e.type?se.Z.deviceMobileShareSheet(this.getIconStyle()):void 0}renderRight(){const{credit:e,intl:t}=this.props;let i;return"import_evernote"===e.type?i={text:t.formatMessage({id:"userCreditSettings.otherWaysToEarnCreditSection.evernoteImport.actionLink",defaultMessage:"Connect"}),onClick:this.handleImportActionClick}:"web_login"===e.type?i={text:t.formatMessage({id:"userCreditSettings.otherWaysToEarnCreditSection.webApp.actionLink",defaultMessage:"Visit"}),onClick:this.handleWebActionClick}:"desktop_login"===e.type?i={text:t.formatMessage({id:"userCreditSettings.otherWaysToEarnCreditSection.desktopApp.actionLink",defaultMessage:"Download"}),onClick:this.handleDesktopActionClick}:"mobile_login"===e.type?i={text:t.formatMessage({id:"userCreditSettings.otherWaysToEarnCreditSection.mobileApp.actionLink",defaultMessage:"Download"}),onClick:this.handleMobileActionClick}:"browser_extension"===e.type?i={text:t.formatMessage({id:"userCreditSettings.otherWaysToEarnCreditSection.webClipper.actionLink",defaultMessage:"Install"}),onClick:this.handleBrowserExtensionActionClick}:"mobile_share_sheet"===e.type&&(i={text:t.formatMessage({id:"userCreditSettings.otherWaysToEarnCreditSection.mobileShare.actionLink",defaultMessage:"Download"}),onClick:this.handleMobileShareSheetActionClick}),a()("div",{style:{display:"flex",alignItems:"center"}},void 0,i&&!e.activated&&a()(Hi.Z,{isBlue:!0,isSmall:!0,onClick:i.onClick},void 0,i.text),a()("div",{style:{minWidth:32,marginLeft:8,marginRight:8,textAlign:"right",fontWeight:re.Z.fontWeight.semibold,...!e.activated&&{color:this.theme.lightTextColor}}},void 0,(0,Ot.Dx)({amount:e.amount,currency:"dollar",intl:this.props.intl})),a()("div",{style:this.getTickStyles(e.activated)},void 0,se.Z.check({fill:ie.ZP.white,width:12,height:12,opacity:e.activated?1:0})))}getUserStore(e){const{currentSpaceStore:t}=G.default.state;if(!t)throw new Error("No current space.");return St.Z.createChildStore(t,{table:Ct.KJ,id:e})}getWrapperStyle(){const e="1px solid ".concat(this.theme.regularDividerColor);return{display:"flex",alignItems:"center",borderTop:this.props.isFirst?e:void 0,borderBottom:e,paddingTop:8,paddingBottom:8}}getCenterStyle(){return{flex:1,fontSize:14,marginLeft:4}}getIconStyle(){return{width:24,height:24,fill:this.theme.mediumIconColor,marginRight:8}}getTickStyles(e){const t=e?void 0:"inset 0 0 0 2px ".concat(this.theme.regularDividerColor);return{display:"flex",alignItems:"center",justifyContent:"center",width:20,height:20,borderRadius:20,background:e?ie.ZP.blue:void 0,boxShadow:t}}}const Ms=(0,R.injectIntl)(ys);class Ss extends F.Z{constructor(...e){super(...e),l()(this,"storeTypes",{store:hs}),l()(this,"renderCredit",((e,t)=>a()(Ms,{credit:e,isFirst:0===t},e.id))),l()(this,"handleInviteCreditsToggleShowMoreClick",(()=>{const{store:e}=this.stores;e.setState({...e.state,showAllInviteCredits:!e.state.showAllInviteCredits})})),l()(this,"handleApplyCreditClick",(()=>{const{data:e}=this.props;x.ZP.setState({open:!0,currentTab:"subscribed_admin"===e.type?"billing":"plans"}),g.UxC(this.environment)}))}willMount(){v.bi(this.environment)}renderComponent(){if(K.Z.state.online){const{credits:e}=this.props.data;return this.renderSettings(e)}return this.renderOfflineMessage()}renderOfflineMessage(){return a()(U.Z,{},void 0,a()(J.Z,{isSmall:!0,style:{textAlign:"center"}},void 0,a()(R.FormattedMessage,{id:"userCreditSettings.offline.message",defaultMessage:"Please go online to manage your account credit."})))}renderOtherCreditWays(e){const t=this.getActionCredits(e);return t.length>0&&a()(d.Fragment,{},void 0,a()(N.Z,{large:!0},void 0,a()(R.FormattedMessage,{id:"userCreditSettings.otherWaysToEarnCreditSectionAlt.title",defaultMessage:"Ways to earn credit"})),a()("div",{},void 0,t.map(this.renderCredit)))}renderReferralSection(e){const{store:t}=this.stores,{showAllInviteCredits:i}=t.state,s=this.getInviteCredits(e),o=i?s:s.slice(0,Ss.showInviteCreditCount);return s.length>0&&a()(c().Fragment,{},void 0,a()("div",{style:this.getHeaderContainerStyles()},void 0,a()("div",{style:this.getHeaderStyles()},void 0,a()(R.FormattedMessage,{id:"userCreditSettings.inviteFriendsSection.title",defaultMessage:"Invite friends and earn credit"}))),a()("div",{style:this.getInviteCreditStyles()},void 0,o.map((e=>this.renderCredit(e,1))),s.length>Ss.showInviteCreditCount&&a()(ne.Z,{style:{marginTop:8},onClick:this.handleInviteCreditsToggleShowMoreClick},void 0,a()(R.FormattedMessage,i?{id:"userCreditSettings.inviteFriendsSection.showLessReferredUsers.link",defaultMessage:"Show {numberOfReferredUsers} less",values:{numberOfReferredUsers:s.length-Ss.showInviteCreditCount}}:{id:"userCreditSettings.inviteFriendsSection.showMoreReferredUsers.link",defaultMessage:"Show {numberOfReferredUsers} more",values:{numberOfReferredUsers:s.length-Ss.showInviteCreditCount}}))))}renderTotalCreditEarned(e){const{intl:t}=this.props,i=e.reduce(((e,t)=>e+(t.activated?t.amount:0)),0);return i>0&&a()("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-end"}},void 0,a()(Q.Z,{title:t.formatMessage({id:"userCreditSettings.helpButton.caption",defaultMessage:"Learn how to earn and apply credits"}),href:(0,ve.UY)("guides.referralsAndCredit"),analyticsFrom:"credit_settings"}),a()("div",{style:{display:"flex",alignItems:"center",paddingRight:28,marginTop:16}},void 0,a()("div",{style:{marginLeft:"auto",fontSize:14,color:this.theme.mediumTextColor}},void 0,a()(R.FormattedMessage,{id:"userCreditSettings.otherWaysToEarnCreditSection.totalCreditSummaryText",defaultMessage:"Total credit earned"})),a()("div",{style:{minWidth:44,fontWeight:re.Z.fontWeight.semibold,textAlign:"right"}},void 0,(0,Ot.Dx)({amount:i,currency:"dollar",intl:t}))))}renderSettings(e){return a()(U.Z,{},void 0,this.renderCreditBalance(),this.renderReferralSection(e),this.renderOtherCreditWays(e),this.renderTotalCreditEarned(e))}renderCreditBalance(){const{data:e,intl:t}=this.props,{availableCredit:i,totalCredit:s}=e,o=Oe.default.state.data;if(!o)return;const n=te.YK(o),r=Math.floor(i/D.default.pricing.personal.monthlyPrice),l=s>=Ut.cw;return a()(d.Fragment,{},void 0,a()(N.Z,{large:!0,divider:"full"},void 0,a()(R.FormattedMessage,{id:"userCreditSettings.creditBalanceSection.title",defaultMessage:"Credit balance"})),a()("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:40,fontSize:14}},void 0,a()("div",{},void 0,a()(R.FormattedMessage,{id:"userCreditSettings.creditBalanceSection.creditBalanceMessage",defaultMessage:"Your current credit balance is {creditBalance}.",values:{creditBalance:a()("b",{style:{color:this.theme.regularTextColor}},void 0,(0,Ot.Dx)({amount:i,currency:"dollar",intl:t}))}})," ",i>0&&!l&&a()(R.FormattedMessage,{id:"userCreditSettings.creditBalanceSection.freeMonthMessage",description:"Message in sidebar letting user know how many months of free Notion they can get with their credits",defaultMessage:"{numberOfMonths, plural, one {That's equivalent to <b>{numberOfMonths} month</b> of the Personal Pro Plan.} other {That's equivalent to <b>{numberOfMonths} months</b> of the Personal Pro Plan.}}",values:{numberOfMonths:r,b:(...e)=>a()("b",{style:{color:this.theme.regularTextColor}},void 0,e)}}),l&&a()(R.FormattedMessage,{id:"userCreditSettings.creditBalanceSection.maximumCreditBalanceExceeded",defaultMessage:"You've exceeded the maximum amount of credit per account, {maximumCreditBalance}. Any additional credit you earn will not increase your balance.",values:{maximumCreditBalance:(0,Ot.Dx)({amount:Ut.cw,currency:"dollar",intl:t})}})),i>0&&a()(Y.Z,{isLarge:!0,onClick:this.handleApplyCreditClick},void 0,n?se.Z.settingsBilling(Ss.applyCreditButtonIconStyle):se.Z.settingsUpgrade(Ss.applyCreditButtonIconStyle),n?t.formatMessage({id:"userCreditSettings.creditBalanceSection.applyCreditButton.label",defaultMessage:"Apply your credit"}):t.formatMessage({id:"userCreditSettings.creditBalanceSection.upgradeForFreeButton.label",defaultMessage:"Upgrade for free"}))))}getActionCredits(e){const{id:t}=this.environment.currentUser,{currentUserSettingsStore:i}=G.default.state;if(!t||!i)return[];const s=[],a=i.getValue();if(a&&Ut.qQ(a)){const i={id:"web_login_default",version:0,amount:Ut.lk.web_login,activated:!1,created_timestamp:Date.now(),type:"web_login",user_id:t};s.push(e.find((e=>"web_login"===e.type))||i);const a={id:"desktop_login_default",version:0,amount:Ut.lk.desktop_login,activated:!1,created_timestamp:Date.now(),type:"desktop_login",user_id:t};s.push(e.find((e=>"desktop_login"===e.type))||a);const o={id:"mobile_login_default",version:0,amount:Ut.lk.mobile_login,activated:!1,created_timestamp:Date.now(),type:"mobile_login",user_id:t};s.push(e.find((e=>"mobile_login"===e.type))||o)}const o={id:"import_evernote_default",version:0,amount:Ut.lk.import_evernote,activated:!1,created_timestamp:Date.now(),type:"import_evernote",user_id:t};s.push(e.find((e=>"import_evernote"===e.type))||o);const n={id:"browser_extension_default",version:0,amount:Ut.lk.browser_extension,activated:!1,created_timestamp:Date.now(),type:"browser_extension",user_id:t};s.push(e.find((e=>"browser_extension"===e.type))||n);const r={id:"mobile_share_sheet_default",version:0,amount:Ut.lk.mobile_share_sheet,activated:!1,created_timestamp:Date.now(),type:"mobile_share_sheet",user_id:t};return s.push(e.find((e=>"mobile_share_sheet"===e.type))||r),s}getInviteCredits(e){const t=e.find((e=>"invited_by_user"===e.type)),i=e.filter((e=>"invited_user"===e.type&&!e.activated)),s=e.filter((e=>"invited_user"===e.type&&e.activated));return m().compact([t,...m().sortBy(i,(e=>-e.created_timestamp)),...m().sortBy(s,(e=>-e.created_timestamp))])}getHeaderContainerStyles(){return{borderBottom:"1px solid ".concat(this.theme.regularDividerColor),paddingBottom:4,marginBottom:12}}getHeaderStyles(){return{fontWeight:re.Z.fontWeight.medium,fontSize:18}}getInviteCreditStyles(){return{marginBottom:44}}}l()(Ss,"showInviteCreditCount",3),l()(Ss,"applyCreditButtonIconStyle",{width:20,height:20,marginRight:6});const bs=(0,R.injectIntl)(Ss);var Ts=i(35402);class Cs extends F.Z{renderComponent(){const{account:e,intl:t,showNewBadge:i,shouldHideConnectAccount:s}=this.props;return a()(d.Fragment,{},void 0,a()("div",{style:{display:"flex",alignItems:"center",fontSize:14,paddingTop:2,paddingBottom:2}},void 0,this.renderIcon(),a()("div",{style:{marginRight:"auto"}},void 0,a()("div",{style:{display:"flex",alignItems:"center"}},void 0,a()("span",{style:{marginRight:6}},void 0,this.props.appName),i&&a()(Ts.Z,{})),a()("div",{style:{fontSize:12,color:this.theme.mediumTextColor}},void 0,this.props.caption)),!Boolean(s)&&a()("div",{style:Cs.buttonWrapStyle},void 0,this.renderConnectButton(this.isConnected(e)?t.formatMessage({id:"connectedAppsSettingsItem.connectAnotherAccountLink",defaultMessage:"Connect another account",description:"Link that enables user to connect another account from a 3rd-party app (like Google Drive) to Notion, assuming they've already connected an account previously"}):t.formatMessage({id:"connectedAppsSettingsItem.connectAccountLink",defaultMessage:"Connect",description:"Link that enables user to connect an account from a 3rd-party app (like Google Drive) to Notion"})))),this.isSingleAccount(e)?this.renderAccount({accountName:e,onDisconnect:this.props.onDisconnect}):this.renderMultipleAccounts(),a()(B.Z,{size:12}))}renderIcon(){const{logo:e}=this.props;return a()("img",{style:Cs.imageIconStyle,src:e})}renderConnectButton(e){return a()(Hi.Z,{isBlue:!0,onClick:this.props.onConnect,style:Cs.buttonStyle},void 0,e)}renderAccount(e){const{accountName:t,onDisconnect:i,key:s}=e;return a()("div",{style:{marginLeft:44}},s,a()(B.Z,{size:12}),a()("div",{style:{display:"flex",alignItems:"center",height:32,marginBottom:2,fontSize:14}},void 0,a()("div",{style:{marginRight:"auto"}},void 0,a()("div",{style:{color:this.theme.mediumTextColor}},void 0,t)),a()("div",{style:Cs.buttonWrapStyle},void 0,a()(Hi.Z,{isRed:!0,onClick:()=>i(),style:Cs.buttonStyle},void 0,a()(R.FormattedMessage,{id:"connectedAppsSettingsItem.disconnectLink",defaultMessage:"Disconnect",description:"If a user has connected an account from a 3rd-party app (like Google Drive) to Notion, they can click this link to disconnect the account."})))))}renderMultipleAccounts(){const e=this.props.account;if(this.isMultipleAccounts(e))return e.map((e=>this.renderAccount({accountName:e.accountName,onDisconnect:()=>{this.props.onDisconnect(e)},key:e.accountId})))}isMultipleAccounts(e){return Array.isArray(e)}isSingleAccount(e){return"string"==typeof e}isConnected(e){return this.isSingleAccount(e)||this.isMultipleAccounts(e)&&e.length>0}}l()(Cs,"iconSize",32),l()(Cs,"buttonStyle",{marginLeft:14,marginRight:-4}),l()(Cs,"buttonWrapStyle",{minWidth:80,display:"flex",justifyContent:"flex-end"}),l()(Cs,"imageIconStyle",{flexShrink:0,width:Cs.iconSize,height:Cs.iconSize,borderRadius:3,marginRight:12});const Zs=(0,R.injectIntl)(Cs);async function ws(e){const t=await k.getConnectedAppsStatus(e,{});if("failed"===t.type){const e=t.error;return console.error(e),{drive:[],evernote:void 0,trello:void 0,asana:void 0}}return t.data}var ks=i(91584),As=i(83805),Ps=i(51582),Is=i(52192),xs=i(89314),Fs=i(30874),Bs=i(76463),Es=i(90031),Rs=i(77420);function Ds(e){const{apps:t,numberOfConnectedApps:i}=e,s=(0,ze.O7)(),[o,r]=(0,d.useState)(!1),l=o?t:t.slice(0,3);return c().createElement(c().Fragment,null,a()(N.Z,{large:!0,divider:"full"},void 0,a()("div",{style:{display:"flex",justifyContent:"space-between"}},void 0,a()(R.FormattedMessage,{id:"connectedAppsSettings.discoverNewAppsSection.title",defaultMessage:"Discover new apps"}),a()(Hi.Z,{isBlue:!0,onClick:()=>{o||(r(!0),g.EUq(s,{numberOfConnectedApps:i}))}},void 0,a()(R.FormattedMessage,{id:"connectedAppsSettings.discoverNewAppSection.showAll.label",defaultMessage:"Show all"})))),a()("div",{style:{display:"grid",gridTemplateColumns:"repeat(".concat(3,", 1fr)"),gap:32}},void 0,l.map((e=>!e.shouldHideInDiscover&&c().createElement(_s,n()({},e,{key:e.id}))))))}function _s(e){const{appName:t,caption:i,logo:s,shouldShowNewBadge:o,onConnect:n}=e,r=(0,qe.y)((e=>({card:{display:"flex",flexDirection:"column",width:160},image:{width:32,height:32,borderRadius:3},title:{fontWeight:re.Z.fontWeight.medium,fontSize:14,marginTop:8},caption:{marginTop:2,fontWeight:re.Z.fontWeight.regular,color:e.mediumTextColor,fontSize:12,maxHeight:64,overflow:"hidden"},button:{marginLeft:-8,marginTop:3}})),[]);return a()("div",{style:r.card},void 0,a()("img",{style:r.image,src:s}),a()("div",{style:{display:"flex",alignItems:"center"}},void 0,a()("div",{style:r.title},void 0,t),o&&a()(Ts.Z,{})),a()("div",{style:r.caption},void 0,i),a()("div",{style:r.button},void 0,a()(Hi.Z,{isBlue:!0,onClick:n},void 0,a()(R.FormattedMessage,{id:"connectedAppSettingsDiscoverItem.connectButton.label",defaultMessage:"Connect"}))))}var Ls=i(89475),Os=i(90965),Us=i(74181);class Ns extends F.Z{constructor(...e){super(...e),l()(this,"storeTypes",{connectedAppsStatus:ee.Z})}renderComponent(){return K.Z.state.online?a()(zi.Z,{request:this.environment,performRequest:ws,requestStore:this.stores.connectedAppsStatus,render:(e,t)=>t?this.renderConnectedAppsSettings():a()("div",{style:Ns.loadingWrapStyle},void 0,a()(O.Z,{}))}):this.renderOfflineMessage()}renderOfflineMessage(){return a()(U.Z,{},void 0,a()(J.Z,{isSmall:!0,style:{textAlign:"center"}},void 0,a()(R.FormattedMessage,{id:"connectedAppsSettings.offline.message",defaultMessage:"Please go online to manage connecting to apps."})))}renderConnectedAppsSettings(){const{intl:e}=this.props,{connected:t,discover:i}=this.getAppsByCategory(),s=t.length>0;return a()("div",{style:Ns.wrapStyle},void 0,a()(Dt.ZP,{style:Ns.scrollerStyle,type:Dt.xm.Y},void 0,s&&c().createElement(c().Fragment,null,a()(N.Z,{large:!0,divider:"full"},void 0,a()(R.FormattedMessage,{id:"connectedAppsSettings.connectedAppsSection.title",defaultMessage:"Connected apps"})),a()(J.Z,{isMultiline:!0,isSecondaryColor:!0},void 0,a()(R.FormattedMessage,{id:"connectedAppsSettings.connectedAppsSection.subtitle",defaultMessage:"Manage your connections with apps that bring content from other tools into Notion. <helpcenterlink>Learn more.</helpcenterlink>",values:{helpcenterlink:(...e)=>a()(me.Z,{href:(0,ve.UY)("guides.connectedApps"),external:!0},void 0,e)}})),a()(B.Z,{size:32}),t.map((e=>c().createElement(Zs,n()({},e,{key:e.id}))))),a()("div",{style:{marginTop:s?32:void 0}},void 0,a()(Ds,{apps:i,numberOfConnectedApps:t.length})),a()(B.Z,{size:32}),a()("div",{style:{marginTop:8}},void 0,a()(Q.Z,{title:e.formatMessage({id:"connectedAppsSettings.helpButton.caption",defaultMessage:"Learn more about embedding content in Notion"}),href:(0,ve.UY)("guides.import"),analyticsFrom:"connected_apps_settings"}))))}async handleDriveAuth(){g.SOV(this.environment,{name:"google",from:"connected_apps"}),await ks.qN(this.environment),await ws(this.environment),await this.stores.connectedAppsStatus.refresh()}handleDisconnectDrive(e){const{intl:t}=this.props;h.showDialog({message:t.formatMessage({id:"connectedAppsSettings.disconnectGoogleDriveModal.message",defaultMessage:"Disconnecting disables file preview on Google Drive files embedded in all of your workspaces. It would not delete your embeds from Notion, so you can re-connect at anytime."}),showCancel:!0,keepFocus:!0,items:[{label:t.formatMessage({id:"connectedAppsSettings.disconnectGoogleDriveModal.disconnectButton.label",defaultMessage:"Disconnect"}),color:"red",onAccept:async()=>{await k.disconnectDrive(this.environment,{googleUserId:e.accountId}),await ws(this.environment),await this.stores.connectedAppsStatus.refresh()}}]})}getAppsByCategory(){const e=m().groupBy([...this.getExternalIntegrations(),...this.getLegacyConnectedApps()],(e=>e.account&&e.account.length>0?"connected":"discover"));return{connected:e.connected||[],discover:e.discover||[]}}getLegacyConnectedApps(){var e,t,i,s,a,o,n;const{intl:r}=this.props,l=this.stores.connectedAppsStatus,{currentSpaceStore:d}=G.default.state,c=null==d||null===(e=d.getValue())||void 0===e?void 0:e.bot_settings,u=!(0,Os.CJ)(c)||Boolean((null==c?void 0:c.integration_approval_statuses)&&c.integration_approval_statuses[Us.ns.legacyGoogle.id]),m=(null===(t=l.state.result)||void 0===t?void 0:t.drive)&&(null===(i=l.state.result)||void 0===i?void 0:i.drive.length)>0;return[...u||m?[{id:"drive",appName:"Google Drive",caption:r.formatMessage({id:"connectedAppsSettings.googleDrive.caption",defaultMessage:"Find and embed your files."}),shouldHideConnectAccount:!u,logo:li.Z.images.import.googleDrivePng,account:null===(s=l.state.result)||void 0===s?void 0:s.drive,onConnect:()=>this.handleDriveAuth(),onDisconnect:e=>{e&&this.handleDisconnectDrive(e)}}]:[],{id:"evernote",appName:"Evernote",caption:r.formatMessage({id:"connectedAppsSettings.evernote.caption",defaultMessage:"Import notebooks."}),logo:li.Z.images.import.evernotePng,account:null===(a=l.state.result)||void 0===a?void 0:a.evernote,onConnect:()=>As.e({environment:this.environment,requestStore:l}),onDisconnect:()=>async function(e,t){await k.disconnectEvernote(e,{}),await t.refresh(),g.qJZ(e,{name:"evernote"})}(this.environment,l)},{id:"trello",appName:"Trello",caption:r.formatMessage({id:"connectedAppsSettings.trello.caption",defaultMessage:"Import your boards."}),logo:li.Z.images.import.trelloPng,shouldHideInDiscover:!0,account:null===(o=l.state.result)||void 0===o?void 0:o.trello,onConnect:()=>Is.M({environment:this.environment,requestStore:l}),onDisconnect:()=>async function(e,t){await k.disconnectTrello(e,{}),await t.refresh(),g.qJZ(e,{name:"trello"})}(this.environment,l)},{id:"asana",appName:"Asana",caption:r.formatMessage({id:"connectedAppsSettings.asana.caption",defaultMessage:"Import tasks from boards and lists."}),logo:li.Z.images.import.asanaPng,shouldHideInDiscover:!0,account:null===(n=l.state.result)||void 0===n?void 0:n.asana,onConnect:()=>Ps.w({environment:this.environment,requestStore:l}),onDisconnect:()=>async function(e,t){await k.disconnectAsana(e,{}),await t.refresh(),g.qJZ(e,{name:"asana"})}(this.environment,l)}]}getExternalIntegrations(){var e;const{currentSpaceStore:t}=G.default.state;if(!t)return[];const i=null===(e=t.getValue())||void 0===e?void 0:e.bot_settings,s=t.id,{integrations:{state:o},bots:{state:n},externalAuthentications:{state:r}}=Fs.Z;return o.map((e=>{if(!e.info.icon)return;const o=n.filter((t=>t.integration_id===e.id)),l=m().compact(o.map((e=>{const t=r.find((t=>t.parent_id===e.id));if(t)return{accountId:e.id,accountName:t.account_name}}))),d=(0,Os.hU)({spaceBotSettings:i,integrationId:e.id}),c=l.length>0;return d||c?{id:e.id,appName:e.name,caption:e.info.tagline,logo:e.info.icon,account:l,shouldHideConnectAccount:!d,shouldShowNewBadge:!0,onConnect:async()=>{await(0,Ls.h)({environment:this.environment,integration:e,spaceId:s}),xs.pJ({environment:this.environment}),g.IvM(this.environment,{integrationId:e.id,numberOfAccountsAlreadyConnected:l.length,from:"connected_apps_settings"})},onDisconnect:async i=>{const s=n.find((e=>e.id===(null==i?void 0:i.accountId)));if(s){const o=(0,Es.Kv)(t,{table:Rs.c,id:s.id,spaceId:s.space_id}),n=null!=i&&i.accountName?a()(R.FormattedMessage,{id:"connectedAppSettings.deleteExternalAuthorization.withAccountName.confirmationMessage",defaultMessage:"Are you sure you want to revoke access for {accountName}?",values:{accountName:i.accountName}}):a()(R.FormattedMessage,{id:"connectedAppSettings.deleteExternalAuthorization.withoutAccountName.confirmationMessage",defaultMessage:"Are you sure you want to revoke access for this account?"});await h.confirmUserAction({message:a()("span",{},void 0,n),acceptLabel:a()(R.FormattedMessage,{id:"connectedAppSettings.deleteExternalAuthorization.confirmDelete.label",defaultMessage:"Yes"})})&&(await(0,Bs.P0)({environment:this.environment,botId:o.id,onSuccess:()=>{}}),g.lLm(this.environment,{integrationId:e.id}))}}}:void 0})).filter(vi.$K)}}l()(Ns,"loadingWrapStyle",{alignItems:"center",display:"flex",flexDirection:"column",flex:1,height:"100%",justifyContent:"center"}),l()(Ns,"wrapStyle",{display:"flex",flexDirection:"column",height:"100%"}),l()(Ns,"scrollerStyle",{height:"100%",padding:"36px 60px"});const Vs=(0,R.injectIntl)(Ns);var Ws=i(14947),zs=i(43250),Hs=i(37181);function qs(e,t){const{securitySettingsStore:i,spaceStore:s}=t,{disablePublicAccess:a,disableGuests:o,disableMoveToSpace:n,disableExport:r,disableSpacePageEdits:l,disablePublicAccessRequests:d,disablePersonalBots:c,disableTeamCreation:u}=i.state;return W.createAndCommit(e,(t=>{f.Xr({environment:e,transaction:t,spaceStore:s,disablePublicAccess:a,disableGuests:o,disableMoveToSpace:n,disableExport:r,disableSpacePageEdits:l,disablePublicAccessRequests:d,disablePersonalBots:c,disableTeamCreation:u})}))}var Gs=i(78454);function Ks(e,t){return"".concat(function(e){return"".concat(e).concat(ai._j.samlAuth)}(t),"/").concat(e)}var js=i(83328),Ys=i(69435),Qs=i(67669),Js=i(61766),Xs=i(93079),$s=i(46167),ea=i(24736),ta=i(75246);class ia extends F.Z{constructor(...e){super(...e),l()(this,"storeTypes",{tokenOptionsButtonPopupStore:Js.Z,botsRequestStore:ee.Z}),l()(this,"renderScimBotTokens",((e,t,i)=>{if(!i)return a()(O.Z,{});if(t&&!e){const{botIds:e}=t,i=e[0]&&(0,Es.Kv)(this.props.spaceStore,{table:Rs.c,id:e[0],spaceId:this.props.spaceStore.id});return a()(d.Fragment,{},void 0,i?this.renderBot(i):this.renderGenerateScimToken())}})),l()(this,"handleGenerateScimTokenClick",(async()=>{const{spaceStore:e}=this.props,{transactionPromise:t}=(0,Bs.bf)({environment:this.environment,name:"SCIM",userId:this.props.userStore.id,spaceStore:e,spaceRole:"editor",type:"scim"});await t,this.stores.botsRequestStore.refresh()})),l()(this,"handleRevokeApiTokenClick",(async e=>{const t=e.getValue();if(!t)return;if(!(await h.confirmUserAction({message:a()(R.FormattedMessage,{id:"securitySAMLSettings.SCIMSection.revokeTokenModal.message",defaultMessage:"Revoke SCIM token? All SCIM API requests that use this token will no longer succeed."}),acceptLabel:a()(R.FormattedMessage,{id:"securitySAMLSettings.SCIMSection.revokeTokenModal.acceptButton.label",defaultMessage:"Revoke SCIM token"}),cancelLabel:a()(R.FormattedMessage,{id:"securitySAMLSettings.SCIMSection.revokeTokenModal.cancelButton.label",defaultMessage:"Cancel"})})))return;await(0,Bs.Xi)({environment:this.environment,botId:t.id})&&h.showMessage({message:a()(R.FormattedMessage,{id:"securitySAMLSettings.SCIMSection.tokenRevoked.message",defaultMessage:"SCIM token revoked successfully. A new token is available."})})}))}renderComponent(){return a()(zi.Z,{requestStore:this.stores.botsRequestStore,request:{environment:this.environment,table:ta.bx,id:this.props.spaceStore.id,type:"scim"},performRequest:Bs.Yw,render:this.renderScimBotTokens})}renderGenerateScimToken(){return a()(j.Z,{isLarge:!0,onClick:this.handleGenerateScimTokenClick},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.SCIMSection.generateScimTokenButton.label",defaultMessage:"Generate SCIM API Token"}))}renderBot(e){const{device:t}=this.environment;let i;return i=t.isMobile?{menuType:Re.ZP.MenuType.ActionSheet}:{menuType:Re.ZP.MenuType.Popup},a()("div",{style:{display:"flex"}},void 0,a()(Xs.Z,{botValue:e.getValue(),avatarSize:24,style:{fontSize:14,flex:1}}),a()(Hi.Z,{onClick:()=>(0,Bs.Pp)({environment:this.environment,botStore:e,from:"scim-settings"}),isBlue:!0},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.SCIMSection.viewToken.label",defaultMessage:"View token"})),a()($s.Z,{popupType:t.isMobile?$s.Z.PopupType.SlideUp:$s.Z.PopupType.Popup,buttonPopupStore:this.stores.tokenOptionsButtonPopupStore,renderOrigin:e=>c().createElement(ea.Z,n()({isMobile:t.isMobile},e,{style:{marginLeft:8,marginRight:8}})),render:t=>c().createElement(Re.ZP,i,a()(De.Z,{type:De.Z.Type.Vertical,sections:[{key:"token options",render:e=>c().createElement(Le.Z,e),items:[{key:"revoke token",render:e=>c().createElement(_e.Z,n()({title:a()(R.FormattedMessage,{id:"securitySAMLSettings.SCIMSection.revokeToken.label",defaultMessage:"Revoke token"}),icon:se.Z.showDeletedPages({width:18,fill:"currentColor"})},e)),action:()=>{this.handleRevokeApiTokenClick(e),t.close()}}]}],initialFocus:void 0}))}))}}const sa=ia;class aa extends F.Z{constructor(...e){super(...e),l()(this,"storeTypes",{tokenOptionsButtonPopupStore:Js.Z}),l()(this,"handleDisablePublicAccessSwitcherClick",(async()=>{const{securitySettingsStore:e}=this.props,t=e.state.disablePublicAccess;if(!t){if(!(await h.confirmUserAction({message:a()(R.FormattedMessage,{id:"securitySAMLSettings.preventPublicSharing.confirmationModal.message",defaultMessage:"Are you sure? This will remove access for anyone who is not a member or guest of the workspace from all pages in this workspace."}),acceptLabel:a()(R.FormattedMessage,{id:"securitySAMLSettings.preventPublicSharing.confirmationModal.confirmButton.label",defaultMessage:"Yes"})})))return}e.setState({...e.state,disablePublicAccess:!t})})),l()(this,"handleAllowDisableGuestsSwitcherClick",(async()=>{const{securitySettingsStore:e}=this.props,t=e.state.disableGuests;if(!t){if(!(await h.confirmUserAction({message:a()(R.FormattedMessage,{id:"securitySAMLSettings.disableGuests.confirmationModal.message",defaultMessage:"Are you sure? All guests in this workspace will be removed."}),acceptLabel:a()(R.FormattedMessage,{id:"securitySAMLSettings.disableGuests.confirmationModal.confirmButton.label",defaultMessage:"Yes"})})))return}e.setState({...e.state,disableGuests:!t})})),l()(this,"handleDisableMoveToSwitcherClick",(()=>{const{securitySettingsStore:e}=this.props;e.setState({...e.state,disableMoveToSpace:!e.state.disableMoveToSpace})})),l()(this,"handleAllowDisableWorkspaceTopLevelSwitcherClick",(()=>{const{securitySettingsStore:e}=this.props;e.setState({...e.state,disableSpacePageEdits:!e.state.disableSpacePageEdits})})),l()(this,"handleDisableExportClick",(()=>{const{securitySettingsStore:e}=this.props;e.setState({...e.state,disableExport:!e.state.disableExport})})),l()(this,"handleDisablePersonalIntegrationsClick",(()=>{const{securitySettingsStore:e}=this.props;e.setState({...e.state,disablePersonalBots:!e.state.disablePersonalBots})})),l()(this,"handleDisablePublicAccessRequestsClick",(()=>{const{securitySettingsStore:e}=this.props;e.setState({...e.state,disablePublicAccessRequests:!e.state.disablePublicAccessRequests})})),l()(this,"handleUpdateClick",(async()=>{await Promise.all([qs(this.environment,{securitySettingsStore:this.props.securitySettingsStore,spaceStore:this.props.spaceStore}),this.saveSamlConfig()]),this.props.securitySettingsStore.state.error?h.showError(this.props.securitySettingsStore.state.error):this.closeSettings()})),l()(this,"handleCancelClick",(()=>{this.closeSettings()})),l()(this,"handleEnableSamlToggle",(()=>{if(!this.isSamlEditable())return;const{state:e}=this.props.samlConfigStore,t=!this.isInvalidSamlConfig(e);"unconfigured"===e.status||"disabled"===e.status?t&&this.props.samlConfigStore.setState({...e,status:"configured"}):this.props.samlConfigStore.setState({...e,status:t?"disabled":"unconfigured"})})),l()(this,"handleIdpMetadataUrlChange",(e=>{this.props.samlConfigStore.setState({...this.props.samlConfigStore.state,idpMetadataUrl:e.target.value})})),l()(this,"handleIdpMetadataUrlBlur",(e=>{Boolean(e.target.value)&&this.setUseMetadataUrl(!0)})),l()(this,"handleIdpMetadataChange",(e=>{this.props.samlConfigStore.setState({...this.props.samlConfigStore.state,idpMetadata:e.target.value})})),l()(this,"handleIdpMetadataBlur",(e=>{Boolean(e.target.value)&&this.setUseMetadataUrl(!1)})),l()(this,"handleEnforceSamlToggle",(()=>{const{state:e}=this.props.samlConfigStore;if(this.isSamlEditable()&&!this.isInvalidSamlConfig(e)){const t="enforced"===e.status?"configured":"enforced";this.props.samlConfigStore.setState({...e,status:t})}})),l()(this,"handleCreateAccountToggle",(()=>{const{state:e}=this.props.samlConfigStore;this.isSamlEditable()&&this.props.samlConfigStore.setState({...e,createAccount:!e.createAccount})})),l()(this,"handleEmailDomainContactUsClick",(()=>{le.O({environment:this.environment,from:"saml_settings",prepopulatedContent:"Request to add or change an email domain for SAML Single Sign-on on workspace ".concat(this.props.spaceStore.id,".")})})),l()(this,"handleWorkspaceContactUsClick",(()=>{le.O({environment:this.environment,from:"saml_settings",prepopulatedContent:"Request to add or remove a workspace for SAML Single Sign-on on workspace ".concat(this.props.spaceStore.id,".")})})),l()(this,"handleUpgradeClick",(()=>{He.y(this.environment,{from:"space_saml",for:"enterprise"})})),l()(this,"setUseMetadataUrl",(e=>{this.props.samlConfigStore.setState({...this.props.samlConfigStore.state,useMetadataUrl:e})}))}renderComponent(){return K.Z.state.online?a()(U.Z,{controlRow:this.renderControlRow()},void 0,this.renderSecuritySettings(),this.renderSamlSettings(),this.renderScimSettings()):this.renderOfflineMessage()}renderUpsell(){if(!this.isSecuritySubscribed())return a()("div",{style:{border:"1px solid ".concat(this.theme.regularDividerColor),borderRadius:3,padding:16,marginTop:(0,Qs.uT)(this.environment)?void 0:24,marginBottom:24}},void 0,a()(Ys.Z,{for:"enterprise",from:"space_saml",icon:se.Z.key,title:a()(R.FormattedMessage,{id:"securitySAMLSettings.upsell.title",defaultMessage:"Upgrade for advanced security, SAML & SCIM"}),caption:a()(R.FormattedMessage,{id:"securitySAMLSettings.upsell.caption",defaultMessage:"Upgrade to the Enterprise Plan for advanced security settings, SAML single sign-on, and automated user and group provisioning."}),learnMoreRoute:"guides.securitySettings"}))}renderSecuritySettings(){const{securitySettingsStore:e}=this.props,t=.5,i=a()(dt.Z,{subscriptionTier:"enterprise",analyticsName:"space_saml",onClick:this.handleUpgradeClick,desktopStyle:{display:"inline-block",marginLeft:8,marginTop:-3}}),s=s=>a()("div",{},void 0,a()("div",{style:{display:"flex",alignItems:"center",cursor:"pointer"},onClick:s?this.handleDisablePublicAccessSwitcherClick:this.handleUpgradeClick},void 0,a()("div",{style:this.getTitleStyle()},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.securitySection.preventPublicSharing.label",defaultMessage:"Prevent members from sharing pages publicly"}),!s&&i,a()(J.Z,{isSmall:!0,isMultiline:!0,style:{marginTop:2,width:"80%"}},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.securitySection.preventPublicSharing.caption",defaultMessage:"This will disable the Share to web option in the Share menu on every page in this workspace."}))),a()("div",{style:{marginTop:5,opacity:s?void 0:t}},void 0,a()(mi.Z,{on:e.state.disablePublicAccess,disabled:!s}))),a()(B.Z,{size:24,style:{opacity:0}})),o=s=>a()("div",{},void 0,a()("div",{style:{display:"flex",alignItems:"center",cursor:"pointer"},onClick:s?this.handleAllowDisableWorkspaceTopLevelSwitcherClick:this.handleUpgradeClick},void 0,a()("div",{style:this.getTitleStyle()},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.securitySection.disableSpacePageEdits.label",defaultMessage:"Prevent members from changing the Workspace section"}),!s&&i,a()(J.Z,{isSmall:!0,isMultiline:!0,style:{marginTop:2,width:"85%"}},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.securitySection.disableSpacePageEdits.caption",defaultMessage:"This disables the ability for members to create, move, reorder, and delete top-level Workspace pages."}))),a()("div",{style:{marginTop:5,opacity:s?void 0:t}},void 0,a()(mi.Z,{on:e.state.disableSpacePageEdits,disabled:!s}))),a()(B.Z,{size:24,style:{opacity:0}})),n=s=>a()("div",{},void 0,a()("div",{style:{display:"flex",alignItems:"center",cursor:"pointer"},onClick:s?this.handleAllowDisableGuestsSwitcherClick:this.handleUpgradeClick},void 0,a()("div",{style:this.getTitleStyle()},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.securitySection.disableGuests.label",defaultMessage:"Disable guests"}),!s&&i,a()(J.Z,{isSmall:!0,isMultiline:!0,style:{marginTop:2,width:"80%"}},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.securitySection.disableGuests.caption",defaultMessage:"This prevents anyone from inviting people outside the workspace to any page."}))),a()("div",{style:{marginTop:5,opacity:s?void 0:t}},void 0,a()(mi.Z,{on:e.state.disableGuests,disabled:!s}))),a()(B.Z,{size:24,style:{opacity:0}})),r=s=>a()("div",{},void 0,a()("div",{style:{display:"flex",alignItems:"center",cursor:"pointer"},onClick:s?this.handleDisableMoveToSwitcherClick:this.handleUpgradeClick},void 0,a()("div",{style:this.getTitleStyle()},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.securitySection.disableMovingPages.label",defaultMessage:"Disable moving or duplicating pages to other workspaces"}),!s&&i,a()(J.Z,{isSmall:!0,isMultiline:!0,style:{marginTop:2,width:"80%"}},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.securitySection.disableMovingPages.caption",defaultMessage:"This prevents anyone from moving or duplicating pages to other workspaces via the Move To or Duplicate To action."}))),a()("div",{style:{marginTop:5,opacity:s?void 0:t}},void 0,a()(mi.Z,{on:e.state.disableMoveToSpace,disabled:!s}))),a()(B.Z,{size:24,style:{opacity:0}})),{state:l}=e,c=s=>a()("div",{},void 0,a()("div",{style:{display:"flex",alignItems:"center",cursor:"pointer"},onClick:s?this.handleDisableExportClick:this.handleUpgradeClick},void 0,a()("div",{style:this.getTitleStyle()},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.securitySection.disableExport.label",defaultMessage:"Disable export"}),!s&&i,a()(J.Z,{isSmall:!0,isMultiline:!0,style:{marginTop:2,width:"80%"}},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.securitySection.disableExport.caption",defaultMessage:"This prevents anyone from exporting as Markdown, CSV, or PDF."}))),a()("div",{style:{marginTop:5,opacity:s?void 0:t}},void 0,a()(mi.Z,{on:e.state.disableExport,disabled:!s}))),a()(B.Z,{size:24,style:{opacity:0}})),u=s=>a()("div",{},void 0,a()("div",{style:{display:"flex",alignItems:"center",cursor:"pointer"},onClick:s?this.handleDisablePersonalIntegrationsClick:this.handleUpgradeClick},void 0,a()("div",{style:this.getTitleStyle()},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.securitySection.disablePersonalIntegrations.label",defaultMessage:"Prevent members from installing new third party integrations"}),!s&&i,a()(J.Z,{isSmall:!0,isMultiline:!0,style:{marginTop:2,width:"80%"}},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.securitySection.disablePersonalIntegrations.caption",defaultMessage:"This prevents any members from installing new third party integrations on this workspace with their Notion account. Admins can always remove existing integrations in the Integrations section."}))),a()("div",{style:{marginTop:5,opacity:s?void 0:t}},void 0,a()(mi.Z,{on:e.state.disablePersonalBots,disabled:!s}))),a()(B.Z,{size:24,style:{opacity:0}})),m=s=>{if((0,Qs.uT)(this.environment))return a()("div",{},void 0,a()("div",{style:{display:"flex",alignItems:"center",cursor:"pointer"},onClick:s?this.handleDisablePublicAccessRequestsClick:this.handleUpgradeClick},void 0,a()("div",{style:this.getTitleStyle()},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.securitySection.disablePublicAccessRequests.label",defaultMessage:"Disable page access requests from non-members"}),!s&&i,a()(J.Z,{isSmall:!0,isMultiline:!0,style:{marginTop:2,width:"80%"}},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.securitySection.disablePublicAccessRequests.caption",defaultMessage:"This prevents anyone with the link to a page from requesting access. Workspace members can always request access."}))),a()("div",{style:{marginTop:5,opacity:s?void 0:t}},void 0,a()(mi.Z,{on:e.state.disablePublicAccessRequests,disabled:!s}))),a()(B.Z,{size:24,style:{opacity:0}}))},p="on"!==fe.default.getGroup("integration-approvals");return this.isSecuritySubscribed()?a()(d.Fragment,{},void 0,a()(N.Z,{large:!0,divider:"full"},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.securitySection.title",defaultMessage:"Security"})),m(!0),s(!0),o(!0),n(!0),r(!0),c(!0),p&&u(!0),a()("div",{style:{height:36}})):a()(d.Fragment,{},void 0,this.renderUpsell(),a()("div",{style:this.getHeaderStyle()},void 0,a()("span",{style:{marginRight:8}},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.securitySection.title",defaultMessage:"Security"}))),m(!0),s(l.disablePublicAccess),o(l.disableSpacePageEdits),n(l.disableGuests),r(l.disableMoveToSpace),c(l.disableExport),u(l.disablePersonalBots),a()("div",{style:{height:32}}))}renderSamlSettings(){return a()(zi.Z,{request:{environment:this.environment,spaceId:this.props.spaceStore.id,store:this.props.samlConfigStore},performRequest:A,render:(e,t,i)=>i?t&&!e?this.isSamlAvailable()?this.renderSamlConfig():this.renderUpgradeSamlPrompt():void 0:a()(O.Z,{})})}renderSamlHelp(){return a()("div",{style:{marginTop:18,marginBottom:24}},void 0,a()(Q.Z,{title:a()(R.FormattedMessage,{id:"securitySAMLSettings.SAMLSection.helpButton.label",defaultMessage:"Learn about SAML and single sign-on"}),href:(0,ve.UY)("guides.samlSettings"),analyticsFrom:"saml_settings"}))}renderSamlUneditable(e){if(this.isSamlEditable()||!e)return;const t=kt.Z.getPublicSpaceData(this.environment,e);return t?a()("div",{style:{marginBottom:24}},void 0,a()(J.Z,{isMultiline:!0},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.SAMLSection.uneditableMessage",defaultMessage:"SAML is being managed by the workspace <bold>{workspaceName}</bold>. Please go there to change any SAML settings.",values:{workspaceName:t.name,bold:(...e)=>a()("span",{style:{fontWeight:re.Z.fontWeight.semibold}},void 0,e)}}))):void 0}renderUpgradeSamlPrompt(){return a()("div",{},void 0,a()(d.Fragment,{},void 0,a()("div",{style:this.getHeaderStyle()},void 0,a()("span",{style:{marginRight:8}},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.SAMLSingleSignOnSection.title",defaultMessage:"SAML single sign-on"})),a()(dt.Z,{subscriptionTier:"enterprise",analyticsName:"space_saml",onClick:this.handleUpgradeClick,desktopStyle:{marginTop:-1}})),this.renderSamlHelp()))}renderEmailDomains(e){return a()(d.Fragment,{},void 0,a()(N.Z,{smallMarginBottom:!0},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.emailDomainsSection.title",defaultMessage:"Email domains"})),a()(J.Z,{isSmall:!0,isMultiline:!0,style:{...aa.captionStyle,marginBottom:12,marginTop:2}},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.emailDomainsSection.emailInput.caption",defaultMessage:"Once you enable SAML, anyone using an email address with the domains below will be able to log in using SAML SSO. <contactlink>Contact support</contactlink> to add or remove a domain.",values:{contactlink:(...e)=>a()(me.Z,{onClick:this.handleEmailDomainContactUsClick},void 0,e)}})),a()("div",{style:{height:32}},void 0,a()(xe.Z,{placeholder:this.props.intl.formatMessage({id:"securitySAMLSettings.emailDomainsSection.emailInput.placeholder",defaultMessage:"No email domains configured"}),value:"",onChange:()=>{},onRemoveLastToken:()=>{},readOnly:!0,tokens:e.map((e=>a()(Fe.Z,{showRemoveButton:!1,isSingle:!1,format:wt.l.Medium,value:e},e)))})),a()(B.Z,{size:40}))}renderSpaceNames(e){if(!this.isSamlEditable())return;const t=e.map((e=>kt.Z.getPublicSpaceData(this.environment,e))).filter((e=>Boolean(e)));return t.length<=1?void 0:a()(d.Fragment,{},void 0,a()(N.Z,{smallMarginBottom:!0},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.spaceNamesSection.title",defaultMessage:"Workspaces"})),a()(J.Z,{isSmall:!0,isMultiline:!0,style:{...aa.captionStyle,marginBottom:12,marginTop:2}},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.spaceNamesSection.spaceNameInput.caption",defaultMessage:"The SAML settings here apply to multiple workspaces. <contactlink>Contact support</contactlink> to add or remove a workspace.",values:{contactlink:(...e)=>a()(me.Z,{onClick:this.handleWorkspaceContactUsClick},void 0,e)}})),a()("div",{style:{height:32}},void 0,a()(xe.Z,{placeholder:"",value:"",onChange:()=>{},onRemoveLastToken:()=>{},readOnly:!0,tokens:t.map((e=>a()(Fe.Z,{showRemoveButton:!1,isSingle:!1,format:wt.l.Medium,value:e.name},e.id)))})),a()(B.Z,{size:40}))}renderSingleSignOnUrl(){const e=Ks(this.props.spaceStore.id,D.default.domainBaseUrl);return a()(d.Fragment,{},void 0,a()(N.Z,{},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.SAMLSingleSignOnSection.singleSignOnURLSettings.title",defaultMessage:"Single sign-on URL"})),a()(J.Z,{isSmall:!0,isMultiline:!0,style:{...aa.captionStyle,marginTop:2}},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.SAMLSingleSignOnSection.singleSignOnURLSettings.url.caption",defaultMessage:"Enter this in your Identity Provider's SAML configuration."})),a()("div",{},void 0,a()("div",{style:{display:"flex",alignItems:"flex-start",marginTop:12,marginBottom:6}},void 0,a()(L.Z,{type:"text",format:L.B.Default,value:e,disabled:!0,style:{borderTopRightRadius:0,borderBottomRightRadius:0,width:"calc(100% - 90px)",height:32}}),a()(j.Z,{onClick:()=>{ut.RD({environment:this.environment,stringValue:e,copiedMessage:ut.tq.copiedLinkToClipboard})},style:{borderTopLeftRadius:0,borderBottomLeftRadius:0},isLarge:!0},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.SAMLSingleSignOnSection.singleSignOnURLSettings.url.tooltip",defaultMessage:"Copy link"})))))}renderIdpSettings(e){return a()(d.Fragment,{},void 0,a()(Hi.Z,{style:this.getRadioTitleStyle(),onClick:e=>{this.setUseMetadataUrl(!0)},disabled:!this.isSamlEditable()},void 0,a()(js.Z,{isSelected:Boolean(e.useMetadataUrl)})," ",a()(R.FormattedMessage,{id:"securitySAMLSettings.SAMLSingleSignOnSection.singleSignOnURLSettings.IdentityProviderMetadataURLOption.label",defaultMessage:"IDP metadata URL"})),a()("div",{style:{maxWidth:"100%",marginLeft:32}},void 0,a()(L.Z,{value:e.idpMetadataUrl,onChange:this.handleIdpMetadataUrlChange,onBlur:this.handleIdpMetadataUrlBlur,placeholder:"https://...",style:{height:32},readOnly:!this.isSamlEditable()})),a()(Hi.Z,{style:this.getRadioTitleStyle(),onClick:e=>{this.setUseMetadataUrl(!1)},disabled:!this.isSamlEditable()},void 0,a()(js.Z,{isSelected:!e.useMetadataUrl})," ",a()(R.FormattedMessage,{id:"securitySAMLSettings.SAMLSingleSignOnSection.singleSignOnURLSettings.IdentityProviderMetadataXMLOption.label",defaultMessage:"IDP metadata XML"})),a()("div",{style:{maxWidth:"100%",marginLeft:32}},void 0,a()(L.Z,{textarea:!0,value:e.idpMetadata,onChange:this.handleIdpMetadataChange,onBlur:this.handleIdpMetadataBlur,placeholder:this.props.intl.formatMessage({id:"securitySAMLSettings.SAMLSingleSignOnSection.singleSignOnURLSettings.IdentityProviderMetadataXMLOption.input.placeholder",defaultMessage:"IDP metadata XML"}),readOnly:!this.isSamlEditable()}),a()(J.Z,{isSmall:!0,isMultiline:!0,style:aa.captionStyle},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.SAMLSingleSignOnSection.singleSignOnURLSettings.IdentityProviderMetadataXMLOption.caption",defaultMessage:"Enter the value provided by your Identity Provider (IDP)."}))))}renderCreateAccountToggle(e){const t=!this.isSamlEditable();return a()("div",{},void 0,a()(B.Z,{size:24,style:{marginTop:12}}),a()("div",{style:aa.settingOptionStyle(t),onClick:this.handleCreateAccountToggle},void 0,a()("div",{style:this.getTitleStyle()},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.SAMLSingleSignOnSection.automaticallyCreateAccounts.label",defaultMessage:"Automatically create accounts on sign-in"}),a()(J.Z,{isSmall:!0,isMultiline:!0,style:aa.captionStyle},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.SAMLSingleSignOnSection.automaticallyCreateAccounts.caption",defaultMessage:"Allow users to create Notion accounts without provisioning from the IDP."}))),a()(mi.Z,{on:e,disabled:t})),a()(B.Z,{size:24}))}renderEnableSamlToggle(e,t){return a()("div",{},void 0,a()("div",{style:aa.settingOptionStyle(t||!this.isSamlEditable()),onClick:this.handleEnableSamlToggle},void 0,a()("div",{style:this.getTitleStyle()},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.SAMLSingleSignOnSection.enableSAML.label",defaultMessage:"Enable SAML"}),a()(J.Z,{isSmall:!0,isMultiline:!0,style:aa.captionStyle},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.SAMLSingleSignOnSection.enableSAML.caption",defaultMessage:"This allows users with emails on the configured domains to log in with SAML. SAML authentication can be enforced below."}))),a()("div",{},void 0,t?a()(ct.Z,{delayThreshold:0,renderTooltip:()=>a()(R.FormattedMessage,{id:"securitySAMLSettings.SAMLSingleSignOnSection.enableSAML.tooltip",defaultMessage:"SAML can be enabled once it is fully configured."}),alignment:Gs.v2.End,render:e=>c().createElement("div",e,a()(mi.Z,{on:!1,disabled:!0}))}):a()(mi.Z,{on:"disabled"!==e&&"unconfigured"!==e,disabled:!this.isSamlEditable()}))),a()(B.Z,{size:24}))}renderEnforceSamlToggle(e,t){return a()("div",{style:aa.settingOptionStyle(t||!this.isSamlEditable()),onClick:this.handleEnforceSamlToggle},void 0,a()("div",{style:this.getTitleStyle()},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.SAMLSingleSignOnSection.enforceSAML.label",defaultMessage:"Enforce SAML"}),a()(J.Z,{isSmall:!0,isMultiline:!0,style:aa.captionStyle},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.SAMLSingleSignOnSection.enforceSAML.captionMulti",defaultMessage:"Once enforced, workspace members with an email on the domains configured above can only use SAML SSO to log in. Administrator accounts can still log in using email."}))),a()("div",{},void 0,t?a()(ct.Z,{delayThreshold:0,renderTooltip:()=>a()(R.FormattedMessage,{id:"securitySAMLSettings.SAMLSingleSignOnSection.enforceSAML.tooltip",defaultMessage:"Enable SAML to access this option."}),alignment:Gs.v2.End,render:e=>c().createElement("div",e,a()(mi.Z,{on:!1,disabled:!0}))}):a()(mi.Z,{on:"enforced"===e,disabled:!this.isSamlEditable()})))}renderSamlConfig(){const e=this.props.samlConfigStore.state,t=this.isInvalidSamlConfig(e);return a()(d.Fragment,{},void 0,a()("div",{style:this.getHeaderStyle()},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.SAMLSingleSignOnSection.title",defaultMessage:"SAML single sign-on"})),this.renderSamlHelp(),this.renderSamlUneditable(e.id),this.renderEmailDomains(e.emailDomains),this.renderSpaceNames(e.spaceIds),this.renderSingleSignOnUrl(),this.renderIdpSettings(e),this.renderCreateAccountToggle(e.createAccount),this.renderEnableSamlToggle(e.status,t),this.renderEnforceSamlToggle(e.status,t))}renderScimSettings(){const e="enterprise"===te.CM(this.environment);return a()(d.Fragment,{},void 0,a()(B.Z,{size:48,style:{opacity:0}}),a()("div",{style:this.getHeaderStyle()},void 0,a()("span",{style:{marginRight:8}},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.SCIMSection.title",defaultMessage:"SCIM configuration"})),!e&&a()(dt.Z,{subscriptionTier:"enterprise",analyticsName:"space_saml",onClick:this.handleUpgradeClick,desktopStyle:{marginTop:-1}})),e&&a()(sa,{spaceStore:this.props.spaceStore,userStore:this.props.userStore}),this.renderScimHelp())}renderScimHelp(){return a()("div",{style:{marginTop:18,marginBottom:24}},void 0,a()(Q.Z,{title:a()(R.FormattedMessage,{id:"securitySAMLSettings.SCIMSection.helpButton.label",defaultMessage:"Learn about SCIM"}),href:(0,ve.UY)("guides.scim"),analyticsFrom:"scim_settings"}))}renderControlRow(){if(this.isSecuritySubscribed()||(0,Qs.uT)(this.environment))return a()("div",{style:{display:"flex"}},void 0,a()(j.Z,{isLarge:!0,onClick:this.handleUpdateClick},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.updateButton.label",defaultMessage:"Update"})),a()(Y.Z,{isLarge:!0,style:{marginLeft:12},onClick:this.handleCancelClick},void 0,a()(R.FormattedMessage,{id:"securitySAMLSettings.cancelButton.label",defaultMessage:"Cancel"})))}renderOfflineMessage(){return a()(U.Z,{},void 0,a()(J.Z,{isSmall:!0,isMultiline:!0,style:{textAlign:"center"}},void 0,a()(R.FormattedMessage,{defaultMessage:"Please go online to manage security settings.",id:"securitySAMLSettings.offline.message"})))}closeSettings(){x.ZP.setState({...x.ZP.state,open:!1})}isSamlAvailable(){return this.props.samlConfigStore.state.emailDomains.length>0||"enterprise"===te.CM(this.environment)}isSamlEditable(){const e=this.props.samlConfigStore.state;return this.isSamlAvailable()&&(!e.id||e.id===this.props.spaceStore.id)}isSecuritySubscribed(){const e=te.CM(this.environment);if("enterprise"===e)return!0;if("team"===e||"team_free"===e){const{data:e}=Oe.default.state,t=te.XX(e);return e&&t&&"subscribed_admin"===e.type&&t.created<M.Xn}return!1}isInvalidSamlConfig(e){return 0===e.emailDomains.length||e.useMetadataUrl&&!e.idpMetadataUrl||!e.useMetadataUrl&&!e.idpMetadata}async saveSamlConfig(){if(this.isSamlAvailable()){const e=this.props.samlConfigStore.state,t=await k.adminSamlConfigForSpace(this.environment,{spaceId:this.props.spaceStore.id,status:e.status,useMetadataUrl:e.useMetadataUrl,idpMetadataUrl:e.idpMetadataUrl,idpMetadata:e.idpMetadata,createAccount:e.createAccount});"failed"===t.type?this.props.securitySettingsStore.setState({...this.props.securitySettingsStore.state,error:t}):this.props.securitySettingsStore.setState({...this.props.securitySettingsStore.state,error:void 0})}}static settingOptionStyle(e=!1){return{display:"flex",alignItems:"center",width:"100%",cursor:e?"default":"pointer"}}getHeaderStyle(){return{fontWeight:re.Z.fontWeight.medium,fontSize:18,borderBottom:"1px solid ".concat(this.theme.regularDividerColor),paddingBottom:6,marginBottom:12,display:"flex",alignItems:"center"}}getTitleStyle(){return{fontSize:14,marginRight:8,flexGrow:1}}getRadioTitleStyle(){return{marginTop:8,marginBottom:4}}}l()(aa,"captionStyle",{marginTop:4,width:"85%"});const oa=(0,R.injectIntl)(aa);var na=i(26255),ra=i(79092),la=i(65680),da=i(60709);var ca=i(26524);class ua extends F.Z{constructor(...e){super(...e),l()(this,"storeTypes",{buttonPopupStore:Js.Z}),l()(this,"handleSelectChange",(e=>{const{label:t}=this.getItemLabelAndCaption(e);if(this.props.confirm){const i=()=>{this.props.onChange(e)};h.showDialog({showCancel:!0,keepFocus:!1,message:a()(R.FormattedMessage,{id:"languagePicker.changeLanguage.confirmationMessage",defaultMessage:"Are you sure you want to update the language to {language}?",values:{language:t}}),items:[{label:a()(R.FormattedMessage,{id:"languagePicker.changeLanguage.updateButton.label",defaultMessage:"Update"}),color:"red",onAccept:i}]})}else this.props.onChange(e)}))}renderComponent(){const{device:e}=this.environment;if(!e.isMobile)return a()($s.Z,{popupType:$s.Z.PopupType.Popup,buttonPopupStore:this.stores.buttonPopupStore,renderOrigin:e=>c().createElement(c().Fragment,null,c().createElement(Hi.Z,n()({style:{marginLeft:-8,paddingLeft:8,paddingRight:8}},e),this.getItemLabelAndCaption(this.props.currentLocale).label,(0,la.ay)(this.props.currentLocale)&&a()(ca.Z,{desktopStyle:{marginLeft:4}},void 0,a()(R.FormattedMessage,{id:"languagePicker.betaBadge",defaultMessage:"Beta"})),se.Z.chevronDown({width:10,marginLeft:4,fill:this.theme.lightIconColor}))),placementToOrigin:da.Iw.Bottom,alignmentToOrigin:da.lU.Start,render:e=>{let t;t="on"===fe.default.getGroup("polyglot")?[...la.tp,...la.is]:[...la.tp];const i=[{key:"languages",render:e=>c().createElement(Le.Z,n()({},e,{topBorder:0!==e.index})),items:t.map((t=>({key:t,render:e=>this.getItem(t,e.focused,e),action:()=>{this.handleSelect(t),e.close()}})))}],s={menuType:Re.ZP.MenuType.Popup,width:240};return c().createElement(Re.ZP,n()({className:zs.hK},s),a()(De.Z,{type:De.Z.Type.Vertical,initialFocus:void 0,sections:i}))}})}renderItem(e){return c().createElement(_e.Z,n()({},e.props,{title:a()("div",{style:{display:"flex",alignItems:"center"}},void 0,a()("div",{style:{...e.style,marginRight:0}},void 0,e.label)),caption:e.caption&&a()("span",{style:{color:this.theme.mediumTextColor}},void 0,e.caption),shouldWrapCaption:!0,right:(0,la.ay)(e.locale)&&a()(ca.Z,{},void 0,a()(R.FormattedMessage,{id:"languagePicker.betaBadge",defaultMessage:"Beta"}))}))}handleSelect(e){this.props.currentLocale!==e&&this.handleSelectChange(e)}getItemLabelAndCaption(e){var t;return{"en-US":{label:"English",caption:(t=this.props.intl).formatMessage({defaultMessage:"English (US)",id:"languagePicker.captions.englishUS"})},"ko-KR":{label:"한국어",caption:t.formatMessage({defaultMessage:"Korean",id:"languagePicker.captions.koreanKo"})},"zh-CN":{label:"简体中文",caption:t.formatMessage({defaultMessage:"Simplified Chinese",id:"languagePicker.captions.chineseS"})},"zh-TW":{label:"繁體中文",caption:t.formatMessage({defaultMessage:"Traditional Chinese",id:"languagePicker.captions.chineseT"})},"ja-JP":{label:"日本語",caption:t.formatMessage({defaultMessage:"Japanese",id:"languagePicker.captions.japaneseJa"})},"es-ES":{label:"Español (España)",caption:t.formatMessage({defaultMessage:"Spanish (Spain)",id:"languagePicker.captions.spanishEs"})},"es-LA":{label:"Español (Latinoamérica)",caption:t.formatMessage({defaultMessage:"Spanish (Latin America)",id:"languagePicker.captions.spanishLatam"})},"pt-BR":{label:"Português (Brasil)",caption:t.formatMessage({defaultMessage:"Portuguese (Brazil)",id:"languagePicker.captions.portugueseBr"})},"fr-FR":{label:"Français (France)",caption:t.formatMessage({defaultMessage:"French",id:"languagePicker.captions.frenchFr"})}}[e]}getItem(e,t,i){return this.renderItem({...this.getItemLabelAndCaption(e),focused:t,props:i,locale:e})}}const ma=(0,R.injectIntl)(ua);var pa=i(39218),ga=i(54153),ha=i(84908);class fa extends F.Z{renderComponent(){return a()("div",{style:this.getSettingsOptionStyle()},void 0,a()("div",{style:{display:"flex",alignItems:"flex-start",width:"100%"}},void 0,a()("div",{style:{flex:1}},void 0,a()(J.Z,{},void 0,a()(R.FormattedMessage,{id:"languageRegionSettings.language.label",defaultMessage:"Language"})),a()(J.Z,{isSmall:!0,isMultiline:!0,style:{width:"80%"}},void 0,a()(R.FormattedMessage,{id:"languageSettings.languageSwitcher.subtitle",defaultMessage:"Change the language used in the user interface."}))),a()(ma,{confirm:!0,onChange:async e=>{(0,g.A01)(this.environment,{locale:e});const t=await k.setLocale(this.environment,{locale:e});"success"===t.type?(ga.Z.set("preferredLocale",e),await pa.transactionQueue.drain(),this.environment.device.isElectron?ha.refreshAll({includeFocusedWindow:!0}):window.location.reload()):h.showError(t)},currentLocale:this.props.locale})))}getSettingsOptionStyle(){const{device:e,WindowSizeStore:t}=this.environment;return{display:"flex",flexDirection:"column",alignItems:"flex-start",width:"100%",height:"auto",paddingLeft:e.isMobile?t.state.paddingLeftCSS:0,paddingRight:e.isMobile?t.state.paddingRightCSS:0}}}const va=fa;var ya=i(24211);const Ma=[{name:"Afghanistan",countryCode:"AF"},{name:"Åland Islands",countryCode:"AX"},{name:"Albania",countryCode:"AL"},{name:"Algeria",countryCode:"DZ"},{name:"American Samoa",countryCode:"AS"},{name:"Andorra",countryCode:"AD"},{name:"Angola",countryCode:"AO"},{name:"Anguilla",countryCode:"AI"},{name:"Antarctica",countryCode:"AQ"},{name:"Antigua and Barbuda",countryCode:"AG"},{name:"Argentina",countryCode:"AR"},{name:"Armenia",countryCode:"AM"},{name:"Aruba",countryCode:"AW"},{name:"Australia",countryCode:"AU",vatApplicable:!0},{name:"Austria",countryCode:"AT",vatApplicable:!0},{name:"Azerbaijan",countryCode:"AZ"},{name:"Bahamas",countryCode:"BS"},{name:"Bahrain",countryCode:"BH"},{name:"Bangladesh",countryCode:"BD"},{name:"Barbados",countryCode:"BB"},{name:"Belarus",countryCode:"BY"},{name:"Belgium",countryCode:"BE",vatApplicable:!0},{name:"Belize",countryCode:"BZ"},{name:"Benin",countryCode:"BJ"},{name:"Bermuda",countryCode:"BM"},{name:"Bhutan",countryCode:"BT"},{name:"Bolivia (Plurinational State of)",countryCode:"BO"},{name:"Bonaire, Sint Eustatius and Saba",countryCode:"BQ"},{name:"Bosnia and Herzegovina",countryCode:"BA"},{name:"Botswana",countryCode:"BW"},{name:"Bouvet Island",countryCode:"BV"},{name:"Brazil",countryCode:"BR"},{name:"British Indian Ocean Territory",countryCode:"IO"},{name:"Brunei Darussalam",countryCode:"BN"},{name:"Bulgaria",countryCode:"BG",vatApplicable:!0},{name:"Burkina Faso",countryCode:"BF"},{name:"Burundi",countryCode:"BI"},{name:"Cabo Verde",countryCode:"CV"},{name:"Cambodia",countryCode:"KH"},{name:"Cameroon",countryCode:"CM"},{name:"Canada",countryCode:"CA",vatApplicable:!0},{name:"Cayman Islands",countryCode:"KY"},{name:"Central African Republic",countryCode:"CF"},{name:"Chad",countryCode:"TD"},{name:"Chile",countryCode:"CL"},{name:"China",countryCode:"CN"},{name:"Christmas Island",countryCode:"CX"},{name:"Cocos (Keeling) Islands",countryCode:"CC"},{name:"Colombia",countryCode:"CO"},{name:"Comoros",countryCode:"KM"},{name:"Congo",countryCode:"CG"},{name:"Congo, Democratic Republic of the",countryCode:"CD"},{name:"Cook Islands",countryCode:"CK"},{name:"Costa Rica",countryCode:"CR"},{name:"Côte d'Ivoire",countryCode:"CI"},{name:"Croatia",countryCode:"HR",vatApplicable:!0},{name:"Cuba",countryCode:"CU"},{name:"Curaçao",countryCode:"CW"},{name:"Cyprus",countryCode:"CY",vatApplicable:!0},{name:"Czechia",countryCode:"CZ",vatApplicable:!0},{name:"Denmark",countryCode:"DK",vatApplicable:!0},{name:"Djibouti",countryCode:"DJ"},{name:"Dominica",countryCode:"DM"},{name:"Dominican Republic",countryCode:"DO"},{name:"Ecuador",countryCode:"EC"},{name:"Egypt",countryCode:"EG"},{name:"El Salvador",countryCode:"SV"},{name:"Equatorial Guinea",countryCode:"GQ"},{name:"Eritrea",countryCode:"ER"},{name:"Estonia",countryCode:"EE",vatApplicable:!0},{name:"Eswatini",countryCode:"SZ"},{name:"Ethiopia",countryCode:"ET"},{name:"Falkland Islands (Malvinas)",countryCode:"FK"},{name:"Faroe Islands",countryCode:"FO"},{name:"Fiji",countryCode:"FJ"},{name:"Finland",countryCode:"FI",vatApplicable:!0},{name:"France",countryCode:"FR",vatApplicable:!0},{name:"French Guiana",countryCode:"GF"},{name:"French Polynesia",countryCode:"PF"},{name:"French Southern Territories",countryCode:"TF"},{name:"Gabon",countryCode:"GA"},{name:"Gambia",countryCode:"GM"},{name:"Georgia",countryCode:"GE"},{name:"Germany",countryCode:"DE",vatApplicable:!0},{name:"Ghana",countryCode:"GH"},{name:"Gibraltar",countryCode:"GI"},{name:"Greece",countryCode:"GR",vatApplicable:!0},{name:"Greenland",countryCode:"GL"},{name:"Grenada",countryCode:"GD"},{name:"Guadeloupe",countryCode:"GP"},{name:"Guam",countryCode:"GU"},{name:"Guatemala",countryCode:"GT"},{name:"Guernsey",countryCode:"GG"},{name:"Guinea",countryCode:"GN"},{name:"Guinea-Bissau",countryCode:"GW"},{name:"Guyana",countryCode:"GY"},{name:"Haiti",countryCode:"HT"},{name:"Heard Island and McDonald Islands",countryCode:"HM"},{name:"Holy See",countryCode:"VA"},{name:"Honduras",countryCode:"HN"},{name:"Hong Kong",countryCode:"HK"},{name:"Hungary",countryCode:"HU",vatApplicable:!0},{name:"Iceland",countryCode:"IS"},{name:"India",countryCode:"IN",vatApplicable:!0},{name:"Indonesia",countryCode:"ID"},{name:"Iran (Islamic Republic of)",countryCode:"IR"},{name:"Iraq",countryCode:"IQ"},{name:"Ireland",countryCode:"IE",vatApplicable:!0},{name:"Isle of Man",countryCode:"IM"},{name:"Israel",countryCode:"IL"},{name:"Italy",countryCode:"IT",vatApplicable:!0},{name:"Jamaica",countryCode:"JM"},{name:"Japan",countryCode:"JP"},{name:"Jersey",countryCode:"JE"},{name:"Jordan",countryCode:"JO"},{name:"Kazakhstan",countryCode:"KZ"},{name:"Kenya",countryCode:"KE"},{name:"Kiribati",countryCode:"KI"},{name:"Korea, Republic of",countryCode:"KR",vatApplicable:!0},{name:"Kosovo",countryCode:"XK"},{name:"Kuwait",countryCode:"KW"},{name:"Kyrgyzstan",countryCode:"KG"},{name:"Lao People's Democratic Republic",countryCode:"LA"},{name:"Latvia",countryCode:"LV",vatApplicable:!0},{name:"Lebanon",countryCode:"LB"},{name:"Lesotho",countryCode:"LS"},{name:"Liberia",countryCode:"LR"},{name:"Libya",countryCode:"LY"},{name:"Liechtenstein",countryCode:"LI"},{name:"Lithuania",countryCode:"LT",vatApplicable:!0},{name:"Luxembourg",countryCode:"LU",vatApplicable:!0},{name:"Macao",countryCode:"MO"},{name:"Madagascar",countryCode:"MG"},{name:"Malawi",countryCode:"MW"},{name:"Malaysia",countryCode:"MY"},{name:"Maldives",countryCode:"MV"},{name:"Mali",countryCode:"ML"},{name:"Malta",countryCode:"MT",vatApplicable:!0},{name:"Marshall Islands",countryCode:"MH"},{name:"Martinique",countryCode:"MQ"},{name:"Mauritania",countryCode:"MR"},{name:"Mauritius",countryCode:"MU"},{name:"Mayotte",countryCode:"YT"},{name:"Mexico",countryCode:"MX"},{name:"Micronesia (Federated States of)",countryCode:"FM"},{name:"Moldova, Republic of",countryCode:"MD"},{name:"Monaco",countryCode:"MC"},{name:"Mongolia",countryCode:"MN"},{name:"Montenegro",countryCode:"ME"},{name:"Montserrat",countryCode:"MS"},{name:"Morocco",countryCode:"MA"},{name:"Mozambique",countryCode:"MZ"},{name:"Myanmar",countryCode:"MM"},{name:"Namibia",countryCode:"NA"},{name:"Nauru",countryCode:"NR"},{name:"Nepal",countryCode:"NP"},{name:"Netherlands",countryCode:"NL",vatApplicable:!0},{name:"New Caledonia",countryCode:"NC"},{name:"New Zealand",countryCode:"NZ",vatApplicable:!0},{name:"Nicaragua",countryCode:"NI"},{name:"Niger",countryCode:"NE"},{name:"Nigeria",countryCode:"NG"},{name:"Niue",countryCode:"NU"},{name:"Norfolk Island",countryCode:"NF"},{name:"North Macedonia",countryCode:"MK"},{name:"Northern Mariana Islands",countryCode:"MP"},{name:"Norway",countryCode:"NO",vatApplicable:!0},{name:"Oman",countryCode:"OM"},{name:"Pakistan",countryCode:"PK"},{name:"Palau",countryCode:"PW"},{name:"Palestine, State of",countryCode:"PS"},{name:"Panama",countryCode:"PA"},{name:"Papua New Guinea",countryCode:"PG"},{name:"Paraguay",countryCode:"PY"},{name:"Peru",countryCode:"PE"},{name:"Philippines",countryCode:"PH"},{name:"Pitcairn",countryCode:"PN"},{name:"Poland",countryCode:"PL",vatApplicable:!0},{name:"Portugal",countryCode:"PT",vatApplicable:!0},{name:"Puerto Rico",countryCode:"PR"},{name:"Qatar",countryCode:"QA"},{name:"Réunion",countryCode:"RE"},{name:"Romania",countryCode:"RO",vatApplicable:!0},{name:"Russian Federation",countryCode:"RU",vatApplicable:!0},{name:"Rwanda",countryCode:"RW"},{name:"Saint Barthélemy",countryCode:"BL"},{name:"Saint Helena, Ascension and Tristan da Cunha",countryCode:"SH"},{name:"Saint Kitts and Nevis",countryCode:"KN"},{name:"Saint Lucia",countryCode:"LC"},{name:"Saint Martin (French part)",countryCode:"MF"},{name:"Saint Pierre and Miquelon",countryCode:"PM"},{name:"Saint Vincent and the Grenadines",countryCode:"VC"},{name:"Samoa",countryCode:"WS"},{name:"San Marino",countryCode:"SM"},{name:"Sao Tome and Principe",countryCode:"ST"},{name:"Saudi Arabia",countryCode:"SA"},{name:"Senegal",countryCode:"SN"},{name:"Serbia",countryCode:"RS"},{name:"Seychelles",countryCode:"SC"},{name:"Sierra Leone",countryCode:"SL"},{name:"Singapore",countryCode:"SG",vatApplicable:!0},{name:"Sint Maarten (Dutch part)",countryCode:"SX"},{name:"Slovakia",countryCode:"SK",vatApplicable:!0},{name:"Slovenia",countryCode:"SI",vatApplicable:!0},{name:"Solomon Islands",countryCode:"SB"},{name:"Somalia",countryCode:"SO"},{name:"South Africa",countryCode:"ZA"},{name:"South Georgia and the South Sandwich Islands",countryCode:"GS"},{name:"South Sudan",countryCode:"SS"},{name:"Spain",countryCode:"ES",vatApplicable:!0},{name:"Sri Lanka",countryCode:"LK"},{name:"Sudan",countryCode:"SD"},{name:"Suriname",countryCode:"SR"},{name:"Svalbard and Jan Mayen",countryCode:"SJ"},{name:"Sweden",countryCode:"SE",vatApplicable:!0},{name:"Switzerland",countryCode:"CH",vatApplicable:!0},{name:"Syrian Arab Republic",countryCode:"SY"},{name:"Taiwan",countryCode:"TW",vatApplicable:!0},{name:"Tajikistan",countryCode:"TJ"},{name:"Tanzania, United Republic of",countryCode:"TZ"},{name:"Thailand",countryCode:"TH"},{name:"Timor-Leste",countryCode:"TL"},{name:"Togo",countryCode:"TG"},{name:"Tokelau",countryCode:"TK"},{name:"Tonga",countryCode:"TO"},{name:"Trinidad and Tobago",countryCode:"TT"},{name:"Tunisia",countryCode:"TN"},{name:"Turkey",countryCode:"TR"},{name:"Turkmenistan",countryCode:"TM"},{name:"Turks and Caicos Islands",countryCode:"TC"},{name:"Tuvalu",countryCode:"TV"},{name:"Uganda",countryCode:"UG"},{name:"Ukraine",countryCode:"UA"},{name:"United Arab Emirates",countryCode:"AE"},{name:"United Kingdom",countryCode:"GB",vatApplicable:!0},{name:"United States",countryCode:"US"},{name:"United States Minor Outlying Islands",countryCode:"UM"},{name:"Uruguay",countryCode:"UY"},{name:"Uzbekistan",countryCode:"UZ"},{name:"Vanuatu",countryCode:"VU"},{name:"Venezuela (Bolivarian Republic of)",countryCode:"VE"},{name:"Viet Nam",countryCode:"VN"},{name:"Virgin Islands (British)",countryCode:"VG"},{name:"Virgin Islands (U.S.)",countryCode:"VI"},{name:"Wallis and Futuna",countryCode:"WF"},{name:"Western Sahara",countryCode:"EH"},{name:"Yemen",countryCode:"YE"},{name:"Zambia",countryCode:"ZM"},{name:"Zimbabwe",countryCode:"ZW"}];var Sa=i(73581),ba=i(39336),Ta=i(57269);function Ca(e){var t,i;return(null==e||null===(t=e.settings)||void 0===t||null===(i=t.regional_format_settings)||void 0===i?void 0:i.region)||"United States"}function Za(e,t){var i;const s=null==e||null===(i=e.settings)||void 0===i?void 0:i.regional_format_settings;return"full_date"===t?null!=s&&s.use_default_region_settings?wa(Ca(e)):(null==s?void 0:s.full_date)||wa(Ca(e)):"short_date"===t?null!=s&&s.use_default_region_settings?{type:"short"}:(null==s?void 0:s.short_date)||{type:"short"}:"number"===t?null!=s&&s.use_default_region_settings?"number":(null==s?void 0:s.number)||"number":"week_start_on"===t?null!=s&&s.use_default_region_settings?"sunday":(null==s?void 0:s.week_start_on)||"sunday":(0,vi.t1)(t)}function wa(e){return"ja"===e?{type:"short"}:{type:"long"}}const ka={full_date:(0,R.defineMessages)({full:{defaultMessage:"Full date",id:"regionalFormatSettings.customSettingOption.fullDate.full"},long:{defaultMessage:"Long",id:"regionalFormatSettings.customSettingOption.fullDate.long"},medium:{defaultMessage:"Medium",id:"regionalFormatSettings.customSettingOption.fullDate.medium"},short:{defaultMessage:"Short",id:"regionalFormatSettings.customSettingOption.fullDate.short"},iso:{defaultMessage:"ISO",id:"regionalFormatSettings.customSettingOption.fullDate.iso"},custom:{defaultMessage:"Custom",id:"regionalFormatSettings.customSettingOption.fullDate.custom"}}),short_date:(0,R.defineMessages)({short:{defaultMessage:"Short",id:"regionalFormatSettings.customSettingOption.shortDate.short"},iso:{defaultMessage:"ISO",id:"regionalFormatSettings.customSettingOption.shortDate.iso"},custom:{defaultMessage:"Custom",id:"regionalFormatSettings.customSettingOption.shortDate.custom"}}),number:(0,R.defineMessages)({number:{defaultMessage:"Number",id:"regionalFormatSettings.customSettingOption.number.number"},number_with_commas:{defaultMessage:"Number with commas",id:"regionalFormatSettings.customSettingOption.number.withCommas"},percent:{defaultMessage:"Percent",id:"regionalFormatSettings.customSettingOption.number.percent"}}),week_start_on:(0,R.defineMessages)({sunday:{defaultMessage:"Sunday",id:"regionalFormatSettings.customSettingOption.weekStartOn.sunday"},monday:{defaultMessage:"Monday",id:"regionalFormatSettings.customSettingOption.weekStartOn.monday"}})},Aa=(0,R.defineMessages)({full_date:{defaultMessage:"Full date",id:"regionalFormatSettings.defaultSetting.fullDate"},short_date:{defaultMessage:"Short date",id:"regionalFormatSettings.defaultSetting.shortDate"},number:{defaultMessage:"Numbers",id:"regionalFormatSettings.defaultSetting.numbers"},week_start_on:{defaultMessage:"Week starts",id:"regionalFormatSettings.defaultSetting.weekStart"}});function Pa(e,t){return(0,Ot.uf)(1234567,e,t)}const Ia=(0,R.defineMessages)({sunday:{id:"regionalFormatSettings.defaultRegionalSettings.startDayOfWeek.sunday",defaultMessage:"Sunday"},monday:{id:"regionalFormatSettings.defaultRegionalSettings.startDayOfWeek.monday",defaultMessage:"Monday"}});function xa(e,t){const i=(0,ba.default)();return(0,Ta.mT)((0,ya.E2)(t),i,e)}function Fa(e,t){const i=(0,ba.default)();return(0,Ta.T0)((0,ya.E2)(t),i,e)}function Ba(e){const t=(0,qe.y)((()=>({container:{flex:1,display:"flex"},label:{flex:1},subtitle:{width:"80%"}})),[]);return a()("div",{style:t.container},void 0,a()("div",{style:t.label},void 0,a()(J.Z,{},void 0,a()(R.FormattedMessage,{id:"regionSettings.region.label",defaultMessage:"Region"})),a()(J.Z,{isSmall:!0,isMultiline:!0,style:t.subtitle},void 0,a()(R.FormattedMessage,{id:"regionSettings.region.subtitle",defaultMessage:"Affects the default formats for dates, numbers, and currencies"}))),a()(Ea,{userSettingsStore:e.userSettingsStore,onChange:e=>{}}))}function Ea(e){const t=(0,qe.F)(),[,,i]=(0,We.oR)(void 0,Js.Z),s=(0,We.VK)((()=>e.userSettingsStore.state),[e.userSettingsStore]),[o,r]=c().useState("");return a()($s.Z,{popupType:$s.Z.PopupType.Popup,buttonPopupStore:i,renderOrigin:e=>c().createElement(Hi.Z,e,Ca(s.value),se.Z.chevronDown({width:10,marginLeft:4,fill:t.lightIconColor})),placementToOrigin:da.Iw.Bottom,alignmentToOrigin:da.lU.Start,render:t=>a()(Re.ZP,{menuType:Re.ZP.MenuType.Popup,width:216,header:a()(Da,{value:o,onChange:e=>r(e)})},void 0,a()(De.Z,{type:De.Z.Type.Vertical,initialFocus:void 0,sections:[{key:"regions",render:e=>c().createElement(Le.Z,n()({},e,{topBorder:0!==e.index})),items:(0,bt.ZP)(o,Ma,(e=>e.name)).map((i=>({key:i.countryCode,render:e=>c().createElement(_e.Z,n()({},e,{title:i.name})),action:()=>{e.onChange(i.countryCode),t.close(),r("")}})))}]}))})}const Ra=(0,R.defineMessages)({regionSearchPlaceholder:{defaultMessage:"Search for a region...",id:"settings.regionSettings.regionSearch"}});function Da(e){return a()(Le.Z,{isInput:!0},void 0,a()(Sa.Z,{value:e.value,onChange:t=>{e.onChange(t.target.value)},focus:!0,placeholder:pt.default.formatMessage(Ra.regionSearchPlaceholder),focusAfterAnimation:!0}))}var _a=i(82902);const La={full_date:(0,R.defineMessages)({full:{defaultMessage:"Full date",id:"regionalFormatSettings.customSettingOption.fullDate.full"},long:{defaultMessage:"Long",id:"regionalFormatSettings.customSettingOption.fullDate.long"},medium:{defaultMessage:"Medium",id:"regionalFormatSettings.customSettingOption.fullDate.medium"},short:{defaultMessage:"Short",id:"regionalFormatSettings.customSettingOption.fullDate.short"},iso:{defaultMessage:"ISO",id:"regionalFormatSettings.customSettingOption.fullDate.iso"},custom:{defaultMessage:"Custom",id:"regionalFormatSettings.customSettingOption.fullDate.custom"}}),short_date:(0,R.defineMessages)({short:{defaultMessage:"Short",id:"regionalFormatSettings.customSettingOption.shortDate.short"},iso:{defaultMessage:"ISO",id:"regionalFormatSettings.customSettingOption.shortDate.iso"},custom:{defaultMessage:"Custom",id:"regionalFormatSettings.customSettingOption.shortDate.custom"}}),number:(0,R.defineMessages)({number:{defaultMessage:"Number",id:"regionalFormatSettings.customSettingOption.number.number"},number_with_commas:{defaultMessage:"Number with commas",id:"regionalFormatSettings.customSettingOption.number.withCommas"},percent:{defaultMessage:"Percent",id:"regionalFormatSettings.customSettingOption.number.percent"}}),week_start_on:(0,R.defineMessages)({sunday:{defaultMessage:"Sunday",id:"regionalFormatSettings.customSettingOption.weekStartOn.sunday"},monday:{defaultMessage:"Monday",id:"regionalFormatSettings.customSettingOption.weekStartOn.monday"}})};function Oa(e){const[,,t]=(0,We.oR)(void 0,Js.Z),i=(0,qe.F)(),s=(0,We.VK)((()=>e.userSettingsStore.state),[e.userSettingsStore]);if(!s.ready||!s.value)return a()(O.Z,{});const o=function(e,t){if("full_date"===t)return ka[t][Za(e,t).type];if("short_date"===t)return ka[t][Za(e,t).type];if("number"===t)return ka[t][Za(e,t)];if("week_start_on"===t)return ka[t][Za(e,t)];return(0,vi.t1)(t)}(s.value,e.option);return a()($s.Z,{popupType:$s.Z.PopupType.Popup,buttonPopupStore:t,renderOrigin:e=>c().createElement(Hi.Z,e,pt.default.formatMessage(o),se.Z.chevronDown({width:10,marginLeft:4,fill:i.lightIconColor})),placementToOrigin:da.Iw.Bottom,alignmentToOrigin:da.lU.Start,render:t=>"week_start_on"===e.option||"number"===e.option?a()(Ua,{userSettingsStore:e.userSettingsStore,option:e.option,onAccept:()=>{t.close()}}):"full_date"===e.option||"short_date"===e.option?a()(Na,{userSettingsStore:e.userSettingsStore,option:e.option,onAccept:()=>{t.close()}}):(0,vi.t1)(e.option)})}function Ua(e){const t=(0,ze.O7)(),i=(0,We.VK)((()=>e.userSettingsStore.state),[e.userSettingsStore]),s=(0,R.useIntl)();return a()(Re.ZP,{menuType:Re.ZP.MenuType.Popup,width:216},void 0,a()(De.Z,{type:De.Z.Type.Vertical,initialFocus:void 0,sections:[{key:"options",render:e=>c().createElement(Le.Z,n()({},e,{topBorder:0!==e.index})),items:(0,vi.Yd)(La[e.option]).map((a=>({key:a,render:t=>{const i="number"===e.option?Pa(a,s):void 0;return c().createElement(_e.Z,n()({},t,{title:pt.default.formatMessage(La[e.option][a]),caption:i}))},action:()=>{(0,W.createAndCommit)(t,(t=>{var s,o;(0,Hs.d2)({userSettingsStore:e.userSettingsStore,data:{regional_format_settings:{...null===(s=i.value)||void 0===s||null===(o=s.settings)||void 0===o?void 0:o.regional_format_settings,use_default_region_settings:!1,region:Ca(e.userSettingsStore.getValue()),[e.option]:a}},transaction:t})})),e.onAccept()}})))}]}))}function Na(e){const t=(0,ze.O7)(),i=(0,We.VK)((()=>e.userSettingsStore.state),[e.userSettingsStore]),[s,o]=(0,d.useState)((()=>{})),r=(0,R.useIntl)(),l=(0,vi.Yd)(La[e.option]),u=a=>{const o="custom"===a?{type:a,format:s}:{type:a};(0,W.createAndCommit)(t,(t=>{var s,a;(0,Hs.d2)({userSettingsStore:e.userSettingsStore,data:{regional_format_settings:{...null===(s=i.value)||void 0===s||null===(a=s.settings)||void 0===a?void 0:a.regional_format_settings,use_default_region_settings:!1,region:Ca(e.userSettingsStore.getValue()),[e.option]:o}},transaction:t})})),e.onAccept()};return a()(Re.ZP,{menuType:Re.ZP.MenuType.Popup,width:216},void 0,a()(De.Z,{type:De.Z.Type.Vertical,initialFocus:void 0,disableMouseLeaveBlur:!0,sections:[{key:"options",render:e=>c().createElement(Le.Z,n()({},e,{topBorder:0!==e.index})),items:l.map((t=>({key:t,render:i=>{if("custom"===t)return c().createElement(_a.Z,n()({},i,{renderOrigin:i=>c().createElement(_e.Z,n()({},i,{title:pt.default.formatMessage(La[e.option][t])})),onFocus:()=>{},renderExtension:()=>a()(Va,{customFormat:s,onChange:e=>{o(e)},onAccept:()=>{u(t)}}),title:pt.default.formatMessage(La[e.option][t])}));{const s="full_date"===e.option?xa({type:t},r):Fa({type:t},r);return c().createElement(_e.Z,n()({},i,{title:pt.default.formatMessage(La[e.option][t]),caption:s}))}},action:()=>{u(t)}})))}]}))}function Va(e){const t=(0,qe.y)((e=>({container:{},label:{color:e.mediumTextColor,fontWeight:re.Z.fontWeight.semibold,paddingTop:6,paddingBottom:6,paddingLeft:14,paddingRight:14},actionButton:{marginTop:6}})),[]);return a()("div",{style:t.container},void 0,a()("div",{},void 0,a()(J.Z,{isSmall:!0,style:t.label},void 0,a()(R.FormattedMessage,{id:"regionalFormatSettings.customDateFormat.title",defaultMessage:"Custom format"}))),a()(Sa.Z,{focus:!0,value:e.customFormat||"",onChange:t=>{e.onChange(t.target.value)}}),a()(_e.Z,{style:t.actionButton,focused:!1,onClick:e.onAccept,title:a()(R.FormattedMessage,{id:"regionalFormatSettings.customDateFormat.applyChanges",defaultMessage:"Apply changes"})}))}function Wa(e){const t=(0,qe.y)((()=>({container:{flex:1,display:"flex",flexDirection:"column"},controlRow:{flex:1,display:"flex"},label:{flex:1},subtitle:{width:"80%"}})),[]),i=(0,We.VK)((()=>e.userSettingsStore.state),[e.userSettingsStore]),s=(0,We.VK)((()=>e.userSettingsStore.shouldUseDefaultRegionalFormatting()),[e.userSettingsStore]),o=(0,ze.O7)();return i.ready?a()("div",{style:t.container},void 0,a()("div",{style:t.controlRow},void 0,a()("div",{style:t.label},void 0,a()(J.Z,{},void 0,a()(R.FormattedMessage,{id:"regionalFormatSettings.label.title",defaultMessage:"Use regional defaults"})),a()(J.Z,{isSmall:!0,isMultiline:!0,style:t.subtitle},void 0,a()(R.FormattedMessage,{id:"regionalFormatSettings.label.subtitle",defaultMessage:"Automatically apply standard formats of your region"}))),a()(mi.Z,{on:s,onClick:()=>{(0,W.createAndCommit)(o,(t=>{const i=s?{use_default_region_settings:!1,full_date:void 0,short_date:void 0,time:void 0,number:void 0,week_start_on:void 0}:{use_default_region_settings:!0};(0,Hs.d2)({userSettingsStore:e.userSettingsStore,data:{regional_format_settings:{region:Ca(e.userSettingsStore.getValue()),...i}},transaction:t})}))}})),a()("div",{},void 0,a()(s?za:Ka,{userSettingsStore:e.userSettingsStore}))):a()(O.Z,{})}function za(e){const t=(0,qe.y)((()=>({container:{marginTop:12}})),[]);return a()("div",{style:t.container},void 0,Ga.map((t=>a()(Ha,{userSettingsStore:e.userSettingsStore,option:t}))))}function Ha(e){const t=(0,qe.y)((e=>({container:{display:"flex"},option:{color:e.lightTextColor,fontSize:re.Z.fontSize.UIRegular.desktop,width:100},example:{color:e.mediumTextColor,fontSize:re.Z.fontSize.UIRegular.desktop}})),[]),i=(0,We.VK)((()=>e.userSettingsStore.state),[e.userSettingsStore]),s=(0,R.useIntl)();if(!i.ready||!i.value)return a()(O.Z,{});const o=qa(i.value,s,e.option);return a()("div",{style:t.container},void 0,a()("div",{style:t.option},void 0,pt.default.formatMessage(Aa[e.option])),a()("div",{style:t.example},void 0,o))}function qa(e,t,i){if("full_date"===i){return xa(Za(e,i),t)}if("short_date"===i){return Fa(Za(e,i),t)}if("number"===i){return Pa(Za(e,i),t)}if("week_start_on"===i){return function(e){return"sunday"===e?pt.default.formatMessage(Ia.sunday):"monday"===e?pt.default.formatMessage(Ia.monday):(0,vi.t1)(e)}(Za(e,i))}return(0,vi.t1)(i)}const Ga=["full_date","short_date","number","week_start_on"];function Ka(e){return a()("div",{},void 0,Ga.map((t=>a()(ja,{userSettingsStore:e.userSettingsStore,option:t}))))}function ja(e){const t=(0,R.useIntl)(),i=(0,We.VK)((()=>e.userSettingsStore.state),[e.userSettingsStore]),s=(0,qe.y)(Ya,[]);if(!i.ready||!i.value)return a()(O.Z,{});const o=Ca(i.value),n=qa(i.value,t,e.option);return c().createElement(c().Fragment,null,a()(B.Z,{size:24}),a()("div",{style:s.container},void 0,a()("div",{style:s.controlRow},void 0,a()("div",{style:s.label},void 0,a()(J.Z,{},void 0,pt.default.formatMessage(Aa[e.option])),a()(J.Z,{isSmall:!0,isMultiline:!0,style:s.subtitle},void 0,n)),a()(Oa,{userSettingsStore:e.userSettingsStore,region:o,option:e.option}))))}function Ya(){return{container:{flex:1,display:"flex",flexDirection:"column"},controlRow:{flex:1,display:"flex"},label:{flex:1},subtitle:{width:"80%"}}}class Qa extends F.Z{renderComponent(){return K.Z.state.online?this.renderSettings():this.renderOfflineMessage()}renderOfflineMessage(){return a()(U.Z,{},void 0,a()(J.Z,{isSmall:!0,style:{textAlign:"center"}},void 0,a()(R.FormattedMessage,{defaultMessage:"Please go online to manage your language and region.",id:"languageSettings.offline.message"})))}renderSettings(){var e;const{currentUserSettingsStore:t}=G.default.state;if(!t)return;const i=(null===(e=t.getSettings())||void 0===e?void 0:e.preferred_locale)||ya.al,s="on"===fe.default.getGroup("aloha");return a()(U.Z,{},void 0,a()(N.Z,{large:!0,divider:"full"},void 0,a()(R.FormattedMessage,{id:"languageSettings.languageSection.title",defaultMessage:"Language & region"})),a()(va,{locale:i,userSettingsStore:t}),a()(B.Z,{size:24}),s?a()("div",{style:{marginTop:12}},void 0,a()(Ba,{locale:i,userSettingsStore:t}),a()(B.Z,{size:24}),a()(N.Z,{large:!0,divider:"full"},void 0,a()(R.FormattedMessage,{id:"languageSettings.formatsSection.title",defaultMessage:"Formats"})),a()(Wa,{locale:i,userSettingsStore:t}),a()(B.Z,{size:24})):a()(ra.Z,{}))}}const Ja=Qa;var Xa=i(42982),$a=i(86512),eo=i(9844),to=i(40235),io=i(5500),so=i(41493);function ao(e){const{integrationId:t,integrationTable:i,isLegacy:s,disableDisconnectUser:o,disableDisconnectAll:r,botIds:l}=e,[{currentSpaceStore:u}]=(0,We.oR)(G.default),m=(0,ze.Fy)(),p=(0,ze.O7)(),g=(0,R.useIntl)(),[h,f]=(0,d.useState)(void 0),[v,y]=(0,d.useState)(!1),[M,S]=(0,d.useState)(!1),[b,T]=(0,d.useState)(!1),[C,Z]=(0,d.useState)(void 0),w=(0,We.VK)((()=>u&&i?(0,Es.Kv)(u,{table:i,id:t}):void 0),[u,t,i]),k=(0,We.VK)((()=>{if(s){const e=Object.values(Us.ns).find((e=>e.id===t));return{name:null==e?void 0:e.name,url:null==e?void 0:e.url}}if(u&&i){const e=u.getRecordValue({table:i,id:t});return{name:null==e?void 0:e.name,url:void 0}}}),[u,t,i,s]),A=(0,We.VK)((()=>l&&!o?l.map((e=>u&&w?(0,Es.Kv)(w,{table:Rs.c,id:e,spaceId:u.id}):void 0)):[]),[u,l,w,o]).filter(vi.$K),P=(0,We.VK)((()=>A.map((e=>{var t;return null!==(t=e.getValue())&&void 0!==t&&t.alive?e.getValue():void 0})).filter(vi.$K)),[A]),I=(0,We.VK)((()=>{if(u&&P&&!o){return P.map((e=>e.created_by_id)).map((e=>u.getRecordValue({table:Ct.KJ,id:e}))).filter(vi.$K)}return[]}),[P,u,o]),x=(0,We.VK)((()=>{var e;return null==u||null===(e=u.getValue())||void 0===e?void 0:e.bot_settings}),[u]),F=null==P?void 0:P.reduce(((e,t)=>{const i=I.find((e=>e.id===t.created_by_id));return e[t.id]={user:i,bot:t},e}),{}),B=h?(0,bt.ZP)(h,Object.entries(F),(([,{user:e}])=>(0,Ct.of)(e))):Object.entries(F),D=!o&&(null==l?void 0:l.length)&&a()(Le.Z,{isInput:!0,style:{padding:8}},void 0,a()(Sa.Z,{textWrapperStyle:{margin:0},focus:!m.isMobile||void 0,focusAfterAnimation:!0,value:h||"",onChange:e=>f(e.target.value),placeholder:g.formatMessage({id:"integrationInstallerFilter.userSearch.placeholder",defaultMessage:"Filter by user"})})),_=B.length?[{key:"disconnect user section",render:e=>c().createElement(Le.Z,e),items:no({users:B,disableDisconnectUser:o,showDisplayModal:()=>S(!0),setSelectedUser:Z,intl:g})}]:[],L=a()(Le.Z,{topBorder:Boolean(B.length)},void 0,Boolean(null==l?void 0:l.length)&&a()(ro,{showDisplayModal:()=>T(!0)}),(0,Os.CJ)(x)&&a()(lo,{showDisplayModal:()=>y(!0)}));return((0,Os.CJ)(x)||null!=k&&k.url)&&k?a()($s.Z,{popupType:m.isMobile?$s.Z.PopupType.SlideUp:$s.Z.PopupType.Popup,renderOrigin:e=>c().createElement(ea.Z,n()({},e,{isMobile:m.isMobile,style:{marginLeft:8,marginRight:8}})),render:()=>c().createElement(c().Fragment,null,a()(Re.ZP,{menuType:m.isMobile?Re.ZP.MenuType.ActionSheet:Re.ZP.MenuType.Popup,header:!o&&D,footer:L,width:230},void 0,a()(De.Z,{type:De.Z.Type.Vertical,sections:_,initialFocus:void 0})),a()(E.Z,{open:!o&&M,onDismiss:()=>{S(!1)},disableAnimation:!0,render:()=>a()(co,{title:a()(ho,{integrationName:k.name}),caption:a()(fo,{integrationName:k.name,userName:null==C?void 0:C.userName}),type:"disconnect",handleCancel:()=>{S(!1),Z(void 0)},handleConfirmation:async()=>{C&&(await oo({botIds:[C.botId],environment:p}),Z(void 0)),S(!1)}})}),a()(E.Z,{open:!r&&b,onDismiss:()=>{T(!1)},disableAnimation:!0,render:()=>a()(co,{title:a()(po,{integrationName:k.name}),caption:a()(go,{integrationName:k.name}),type:"disconnect",handleCancel:()=>T(!1),handleConfirmation:async()=>{await oo({botIds:l,environment:p}),T(!1)}})}),a()(E.Z,{open:v,onDismiss:()=>{y(!1)},disableAnimation:!0,render:()=>a()(co,{title:a()(uo,{integrationName:k.name}),caption:a()(mo,{integrationName:k.name,disableDisconnectAll:r}),type:"disapprove",handleCancel:()=>y(!1),handleConfirmation:async()=>{!function(e){const{currentSpaceStore:t,environment:i,integrationId:s}=e;t&&(0,W.createAndCommit)(i,(e=>{(0,W.applyOperation)({store:t,operation:{pointer:t.pointer,path:["bot_settings","integration_approval_statuses"],command:"update",args:{[s]:null}},transaction:e})}))}({currentSpaceStore:u,environment:p,integrationId:t}),r||await oo({botIds:l,environment:p}),y(!1)}})}))}):null}async function oo({botIds:e,environment:t}){e&&await Promise.all(e.map((e=>(0,Bs.P0)({environment:t,botId:e,onSuccess:()=>{g.IN8(t,{type:"public"})}}))))}function no(e){const{intl:t,disableDisconnectUser:i,users:s,showDisplayModal:o,setSelectedUser:r}=e;return i?[]:s.map((([e,{user:i,bot:s}])=>({key:i.id,render:e=>c().createElement(_e.Z,n()({},e,{title:a()("div",{style:{display:"flex",alignContent:"center",justifyContent:"space-between"}},void 0,a()(so.Z,{userValue:i,avatarSize:18,inline:!0,avatarShouldShowShadow:!0,style:{flexShrink:1,maxWidth:130}}),a()(J.Z,{isSecondaryColor:!0,style:{lineHeight:"inherit"}},void 0,a()(R.FormattedMessage,{id:"spaceIntegrationSettings.actionMenu.revokeUserAccess.label",defaultMessage:"Revoke"}))),textWrapperStyle:{marginLeft:12,marginRight:12},focused:!1})),action:()=>{o(),r({botId:e,userName:(0,Ct.Nz)(t,i)})}})))}function ro({showDisplayModal:e}){return a()(_e.Z,{onClick:e,title:a()(R.FormattedMessage,{id:"spaceIntegrationSettings.actionMenu.disconnectAll.label",defaultMessage:"Disconnect all users"}),shouldWrapCaption:!0,focused:!1,textWrapperStyle:{marginLeft:12,marginRight:12}})}function lo({showDisplayModal:e}){return a()(_e.Z,{onClick:e,title:a()(R.FormattedMessage,{id:"spaceIntegrationSettings.actionMenu.removeIntegrationApproval.label",defaultMessage:"Remove from allow list"}),focused:!1,textWrapperStyle:{marginLeft:12,marginRight:12}})}function co({title:e,caption:t,handleConfirmation:i,handleCancel:s,type:o}){return a()("div",{style:{padding:20,width:333}},void 0,a()(J.Z,{isMultiline:!0,style:{marginBottom:8,fontWeight:re.Z.fontWeight.semibold}},void 0,e),a()(J.Z,{isMultiline:!0,isSecondaryColor:!0,style:{marginBottom:8}},void 0,t),a()("div",{style:{display:"flex",marginTop:12}},void 0,a()(Y.Z,{style:{width:140,marginRight:9},isLarge:!0,onClick:s},void 0,a()(J.Z,{},void 0,a()(R.FormattedMessage,{id:"spaceIntegrationSettings.actionMenu.removeIntegrationApproval.modal.button.cancel",defaultMessage:"Cancel"}))),a()(Y.Z,{style:{width:140},isLarge:!0,onClick:i,backgroundColor:ie.ZP.red},void 0,a()(J.Z,{style:{color:ie.ZP.white}},void 0,"disconnect"===o&&a()(R.FormattedMessage,{id:"spaceIntegrationSettings.actionMenu.removeIntegrationApproval.modal.button.disconnect",defaultMessage:"Disconnect"}),"disapprove"===o&&a()(R.FormattedMessage,{id:"spaceIntegrationSettings.actionMenu.removeIntegrationApproval.modal.button.remove",defaultMessage:"Remove"})))))}function uo({integrationName:e}){return a()(R.FormattedMessage,{id:"spaceIntegrationSettings.actionMenu.removeIntegrationApproval.modal.title",defaultMessage:"Remove {integrationName} from allowed integrations",values:{integrationName:e}})}function mo({integrationName:e,disableDisconnectAll:t}){return a()(R.FormattedMessage,t?{id:"spaceIntegrationSettings.actionMenu.removeIntegrationApproval.modal.caption",defaultMessage:"Prevent members from installing {integrationName}.",values:{integrationName:e}}:{id:"spaceIntegrationSettings.actionMenu.removeIntegrationApprovalAndDisconnectAll.caption",defaultMessage:"Revoke access for {integrationName} for all users in this workspace and prevent members from installing {integrationName}.",values:{integrationName:e}})}function po({integrationName:e}){return a()(R.FormattedMessage,{id:"spaceIntegrationSettings.actionMenu.disconnectAll.modal.label",defaultMessage:"Disconnect {integrationName} for all users in workspace",values:{integrationName:e}})}function go({integrationName:e}){return a()(R.FormattedMessage,{id:"spaceIntegrationSettings.actionMenu.disconnectAll.modal.caption",defaultMessage:"Revoke access for {integrationName} for all users in this workspace.",values:{integrationName:e}})}function ho({integrationName:e}){return a()(R.FormattedMessage,{id:"spaceIntegrationSettings.actionMenu.disconnectUser.modal.label",defaultMessage:"Disconnect {integrationName}?",values:{integrationName:e}})}function fo({integrationName:e,userName:t}){return a()(R.FormattedMessage,{id:"spaceIntegrationSettings.actionMenu.disconnectUser.modal.caption",defaultMessage:"Revoke access for {integrationName} for {userName}",values:{integrationName:e,userName:t}})}const vo={internal:a()(R.FormattedMessage,{id:"spaceIntegrationSettings.integrationTable.pillLabel.internal",defaultMessage:"INTERNAL",description:"This label indicates that an integration is internal to the workspace, as opposed to public."}),databaseSync:a()(R.FormattedMessage,{id:"spaceIntegrationSettings.integrationTable.pillLabel.sync",defaultMessage:"SYNC",description:"This label indicates that the integration type is database sync."}),linkPreview:a()(R.FormattedMessage,{id:"spaceIntegrationSettings.integrationTable.pillLabel.preview",defaultMessage:"PREVIEW",description:"This label indicates that the integration type is link preview."}),importer:a()(R.FormattedMessage,{id:"spaceIntegrationSettings.integrationTable.pillLabel.importer",defaultMessage:"IMPORTER",description:"This label indicates that the integration type is a first-party / legacy importers."})};function yo(e){const{integrationIdToBotIds:t,internalIntegrationIds:i,integrationIdToUsers:s}=e,[{currentSpaceStore:o}]=(0,We.oR)(G.default),n=(0,qe.F)(),r=(0,We.VK)((()=>{var e;return null==o||null===(e=o.getValue())||void 0===e?void 0:e.bot_settings}),[o]),l=(0,We.VK)((()=>Boolean(null==r?void 0:r.integration_restrictions)),[r]),d=(0,We.VK)((()=>null!=r&&r.integration_approval_statuses?Object.keys(r.integration_approval_statuses):[]),[r]),u=d.filter((e=>!Object.keys(t).includes(e)&&!Us.T2.includes(e))),m=(0,We.VK)((()=>null==o?void 0:o.id),[o]),p=t?Object.entries(t).map((([e,t])=>Mo({integrationPointer:{table:eo.K,id:e},users:s[e],botIds:t}))):[],g=m?i.map((e=>Mo({integrationPointer:{table:Rs.c,id:e,spaceId:m},users:s[e],botIds:[e]}))):[],h=l?u.map((e=>Mo({integrationPointer:{table:eo.K,id:e},users:[],botIds:[]}))):[],f=Object.values(Us.ns).filter((e=>!(0,Os.CJ)(r)||d.includes(e.id))).map((e=>function(e){const{info:t}=e,{id:i,name:s,icon:o}=t;return{key:i,columns:[a()("div",{style:{display:"flex",alignItems:"center",maxWidth:300}},void 0,a()("img",{src:o,style:{height:28}}),a()("div",{style:{minWidth:0,marginLeft:15}},void 0,a()("div",{style:{display:"flex"}},void 0,a()(J.Z,{},void 0,s)),a()(J.Z,{isSmall:!0,style:{display:"flex"}},void 0,a()(R.FormattedMessage,{id:"spaceIntegrationSettings.integrationTable.installerInfoColumn.legacy",defaultMessage:"Notion Connected App"})))),a()(Zo,{renderedUsers:void 0}),a()("div",{},void 0,a()(ao,{integrationId:i,isLegacy:!0,disableDisconnectAll:!0,disableDisconnectUser:!0}))]}}({botSettings:r,info:e}))),v=p.length+g.length+h.length+f.length;return c().createElement(c().Fragment,null,a()(to.Z,{columns:[{key:"integration",header:a()(R.FormattedMessage,{id:"spaceIntegrationSettings.integrationTable.integrationColumn.title",defaultMessage:"Integration"}),style:{width:"40%"}},{key:"added_by",header:a()(R.FormattedMessage,{id:"spaceIntegrationSettings.integrationtable.creationInfoColumn.title",defaultMessage:"Users"})},{key:"more",header:void 0,style:{width:"5%"}}],rows:[...p,...g,...h,...f]}),0===v?a()("div",{style:{height:120,width:"100%",fontSize:12,color:n.lightTextColor,display:"flex",alignItems:"center",justifyContent:"center",borderBottom:"1px solid ".concat(n.lightDividerColor)}},void 0,a()(R.FormattedMessage,{id:"spaceIntegrationSettings.integrationTable.emptyTable.message",defaultMessage:"No integration installed"})):void 0)}function Mo(e){const{integrationPointer:t,users:i,botIds:s}=e;return t.table===eo.K?{key:t.id,columns:[a()(So,{integrationTable:eo.K,integrationId:t.id}),a()(Zo,{renderedUsers:(0,io.BP)(t.id)?void 0:i}),a()(ao,{integrationId:t.id,integrationTable:eo.K,botIds:s,disableDisconnectUser:(0,io.BP)(t.id)||void 0})]}:t.table===Rs.c?{key:t.id,columns:[a()(So,{integrationTable:Rs.c,integrationId:t.id}),a()(Zo,{renderedUsers:i,integrationType:"internal"}),a()(ao,{integrationId:t.id,integrationTable:Rs.c,disableDisconnectUser:!0})]}:void(0,vi.t1)(t)}function So(e){const{integrationId:t,integrationTable:i}=e,[{currentSpaceStore:s}]=(0,We.oR)(G.default),o=(0,We.VK)((()=>{if(s)return s.getRecordValue({table:i,id:t})}),[s,t,i]);if(!o)return a()(O.Z,{});let n;const r=[];let l;if(i===Rs.c){const e=o;e.icon&&(n={pointer:{table:i,id:t},icon:e.icon}),r.push("internal"),l=a()(bo,{botId:e.id})}else if(i===eo.K){const e=o;e.info.icon&&(n={pointer:{table:i,id:t},icon:e.info.icon}),(0,Us.mo)(e)&&(r.push("linkPreview"),(0,Us.zc)(e)&&r.push("databaseSync")),l=a()(To,{integrationId:e.id})}else(0,vi.t1)(i);return a()("div",{style:{display:"flex",alignItems:"center",maxWidth:300}},void 0,a()(Ie.Z,{disabled:!0,icon:n,title:o.name,isEmptyPage:!1,size:28,isLarge:!0,useInvertedColors:!0}),a()("div",{style:{minWidth:0,marginLeft:15}},void 0,a()("div",{style:{display:"flex",marginRight:16}},void 0,a()(J.Z,{},void 0,o.name),r.map((e=>e&&a()(ca.Z,{desktopStyle:{marginLeft:4}},void 0,vo[e])))),l))}const bo=({botId:e})=>{const[{currentSpaceStore:t}]=(0,We.oR)(G.default),i=(0,R.useIntl)(),s=(0,We.VK)((()=>null==t?void 0:t.getRecordValue({table:Rs.c,id:e})),[t,e]),o=(0,We.VK)((()=>{if(t&&s)return t.getRecordValue({table:s.created_by_table,id:s.created_by_id})}),[t,s]);if(o){const e=(0,Ct.Nz)(i,o);return a()(J.Z,{className:"notranslate",isSmall:!0},void 0,e)}return a()(Co,{})},To=({integrationId:e})=>{const[{currentSpaceStore:t}]=(0,We.oR)(G.default),i=(0,qe.F)(),s=(0,We.VK)((()=>{const i=null==t?void 0:t.getRecordValue({table:eo.K,id:e});return null==i?void 0:i.info.developer_name}),[t,e]);return(0,io.BP)(e)?a()(J.Z,{isSmall:!0,style:{display:"flex",alignItems:"center"}},void 0,a()(R.FormattedMessage,{id:"spaceIntegrationSettings.integrationTable.installerInfoColumn.notion",defaultMessage:"Notion {icon}",values:{icon:a()(ct.Z,{renderTooltip:()=>a()("div",{},void 0,a()(R.FormattedMessage,{id:"spaceIntegrationSettings.integrationTable.installerInfo.notion.tooltip",defaultMessage:"Developed by Notion"})),placement:ct.Z.Placement.Right,render:e=>c().createElement("div",e,se.Z.integrationSecurity({width:12,height:12,fill:i.invoiceGreen}))})}})):s?a()(J.Z,{className:"notranslate",isSmall:!0},void 0,s):a()(Co,{})},Co=()=>a()(J.Z,{isSmall:!0},void 0,a()(R.FormattedMessage,{id:"spaceIntegrationSettings.integrationTable.label.unknownDeveloper",defaultMessage:"Unknown developer",description:"The placeholder name of an integration developer if not provided"}));function Zo(e){const{renderedUsers:t,integrationType:i}=e,[{currentSpaceStore:s}]=(0,We.oR)(G.default),o=(0,R.useIntl)(),n=(0,ze.O7)(),r=(0,We.VK)((()=>{if(s)return(0,Tt.getSpaceName)(n,s)}),[n,s]);if("internal"===i||!t)return a()(J.Z,{style:{display:"flex",alignItems:"center"}},void 0,a()(R.FormattedMessage,{id:"spaceIntegrationSettings.integrationTable.installerInfoColumn.anyone",defaultMessage:"Anyone in {spaceName}",values:{spaceName:a()(J.Z,{style:{fontWeight:re.Z.fontWeight.medium}},void 0,r)}}));if(0===t.length)return a()(J.Z,{isSecondaryColor:!0,style:{display:"flex",alignItems:"center"}},void 0,a()(R.FormattedMessage,{id:"spaceIntegrationSettings.integrationTable.installerInfoColumn.noUsers",defaultMessage:"No users"}));const l=(0,Ct.Nz)(o,t[0]);return a()("div",{style:{display:"flex",alignItems:"center"}},void 0,a()(vs.Z,{userValue:t[0],avatarShouldShowShadow:!0,style:{marginRight:8},size:28}),a()(J.Z,{},void 0,a()(R.FormattedMessage,{id:"spaceIntegrationSettings.integrationTable.installerInfoColumn.listOfUsers",defaultMessage:"{remainingCount, plural, =0 {{firstUser}} one {{firstUser} and {remainingCount}+} other {{firstUser} and {remainingCount}+}}",values:{firstUser:l,remainingCount:t.length-1}})))}var wo=i(16328),ko=i(97680),Ao=i(82276);function Po(e){const{integration:t,botStores:i}=e,[s,o]=(0,d.useState)(void 0),[{currentSpaceStore:r}]=(0,We.oR)(G.default),l=(0,ze.Fy)(),u=(0,ze.O7)(),m=(0,R.useIntl)(),p=(0,We.VK)((()=>i.map((e=>{var t;return null!==(t=e.getValue())&&void 0!==t&&t.alive?e.getValue():void 0})).filter(vi.$K)),[i]),f=(0,We.VK)((()=>{if(r&&p){return p.map((e=>e.created_by_id)).map((e=>r.getRecordValue({table:Ct.KJ,id:e}))).filter(vi.$K)}return[]}),[p,r]),v=p.reduce(((e,t)=>{const i=f.find((e=>e.id===t.created_by_id));return e[t.id]={user:i,bot:t},e}),{}),y=s?(0,bt.ZP)(s,Object.entries(v),(([,{user:e}])=>(0,Ct.of)(e))):Object.entries(v),M=a()(Le.Z,{isInput:!0},void 0,a()(Sa.Z,{focus:!l.isMobile||void 0,focusAfterAnimation:!0,value:s||"",onChange:e=>o(e.target.value),placeholder:m.formatMessage({id:"integrationInstallerFilter.userSearch.placeholder",defaultMessage:"Filter by user"})})),S=a()(Le.Z,{topBorder:!0},void 0,a()(_e.Z,{title:a()(R.FormattedMessage,{id:"integrationInstallerFilter.disconnectAllIntegrationsButton.label",defaultMessage:"Disconnect all"}),onClick:async()=>{await h.confirmUserAction({message:a()(R.FormattedMessage,{id:"integrationInstallerFilter.disconnectAllIntegrationsModal.title",defaultMessage:"Disconnect {integrationName}?",values:{integrationName:t.name}}),description:a()(R.FormattedMessage,{id:"integrationInstallerFilter.disconnectAllIntegrationsModal.description",defaultMessage:"Revoke access for {integrationName} for all users in this workspace.",values:{integrationName:t.name}}),acceptLabel:a()(R.FormattedMessage,{id:"integrationInstallerFilter.disconnectAllIntegrationsModal.confirmButton.label",defaultMessage:"Disconnect"}),cancelLabel:a()(R.FormattedMessage,{id:"integrationInstallerFilter.disconnectAllIntegrationsModal.cancelButton.label",defaultMessage:"Cancel"})})&&await Promise.all(i.map((e=>Bs.P0({environment:u,botId:e.id,onSuccess:()=>{g.IN8(u,{type:"public"})}}))))},focused:!1,style:{color:ie.ZP.red}})),b="on"===(0,ze.aq)("granular-bot-capabilities"),T=y.map((([e,{user:i,bot:s}])=>({key:e,action:async()=>{b||await Io(m,u,i,t,e)},render:o=>b?a()($s.Z,{popupType:l.isMobile?$s.Z.PopupType.SlideUp:$s.Z.PopupType.Popup,placementToOrigin:$s.Z.Placement.Right,renderOrigin:e=>c().createElement(ko.Z,n()({},o,e,{user:i})),render:()=>a()(Re.ZP,{width:240,menuType:l.isMobile?Re.ZP.MenuType.ActionSheet:Re.ZP.MenuType.Popup},void 0,a()(De.Z,{type:De.Z.Type.Vertical,sections:[{key:"integration capabilities",render:e=>c().createElement(Le.Z,e),items:[{key:"access",render:()=>a()(Ao.T,{role:s.capabilities,renderUserCapabilities:!0}),action:()=>{}}]},{key:"remove bot",render:e=>c().createElement(Le.Z,n()({},e,{topBorder:!0})),items:[{key:"remove",render:e=>c().createElement(_e.Z,n()({},e,{focused:!1,title:a()("div",{style:{color:ie.ZP.red}},void 0,a()(R.FormattedMessage,{id:"integrationInstallerFilter.removeBot.label",defaultMessage:"Remove"}))})),action:async()=>{await Io(m,u,i,t,e)}}]}],initialFocus:void 0}))}):c().createElement(ko.Z,n()({},o,{user:i}))}))),C=0===T.length?a()(Le.Z,{},void 0,a()(wo.Z,{title:a()(R.FormattedMessage,{id:"integrationInstallerFilter.userSearch.noResults",defaultMessage:"No results"})})):function(e){return a()(De.Z,{type:De.Z.Type.Vertical,initialFocus:void 0,sections:[{key:"results",items:e,render:e=>c().createElement(Le.Z,e)}]})}(T);return a()(Re.ZP,{menuType:Re.ZP.MenuType.Popup,header:M,footer:S,width:200},void 0,C)}async function Io(e,t,i,s,o){await h.confirmUserAction({message:a()(R.FormattedMessage,{id:"integrationInstallerFilter.disconnectIndividualIntegrationModal.title",defaultMessage:"Disconnect {integrationName}?",values:{integrationName:s.name}}),description:a()(R.FormattedMessage,{id:"integrationInstallerFilter.disconnectIndividualIntegrationModal.title",defaultMessage:"Revoke {integrationName} access for {userName}",values:{integrationName:s.name,userName:(0,Ct.Nz)(e,i)}}),acceptLabel:a()(R.FormattedMessage,{id:"integrationInstallerFilter.disconnectIndividualIntegrationModal.confirmButton.label",defaultMessage:"Disconnect"}),cancelLabel:a()(R.FormattedMessage,{id:"integrationInstallerFilter.disconnectIndividualIntegrationModal.cancelButton.label",defaultMessage:"Cancel"})})&&await Bs.P0({environment:t,botId:o,onSuccess:()=>{g.IN8(t,{type:"public"})}})}function xo(e){const{integrationId:t,botIds:i}=e,s=(0,ze.Fy)(),o=(0,ze.O7)(),[,,r]=(0,We.oR)(void 0,Js.Z),[{currentSpaceStore:l}]=(0,We.oR)(G.default),d=(0,We.VK)((()=>l?(0,Es.Kv)(l,{table:eo.K,id:t}):void 0),[l,t]),u=(0,We.VK)((()=>null==d?void 0:d.getValue()),[d]),m=(0,We.VK)((()=>i.map((e=>l&&d?(0,Es.Kv)(d,{table:Rs.c,id:e,spaceId:l.id}):void 0))),[l,i,d]).filter(vi.$K);if(!u)return a()(O.Z,{});const p=u.info.website_url,h=u.info.email;return a()($s.Z,{popupType:s.isMobile?$s.Z.PopupType.SlideUp:$s.Z.PopupType.Popup,buttonPopupStore:r,renderOrigin:e=>c().createElement(ea.Z,n()({},e,{isMobile:s.isMobile,style:{marginLeft:8,marginRight:8}})),render:e=>a()(Re.ZP,{menuType:s.isMobile?Re.ZP.MenuType.ActionSheet:Re.ZP.MenuType.Popup},void 0,a()(De.Z,{type:De.Z.Type.Vertical,sections:[{key:"integration options",render:e=>c().createElement(Le.Z,e),items:[...p?[{key:"visit developer website",action:()=>{e.close(),si.navigateToExternalURL({environment:o,url:p}),g.fco(o,{href:p,from:"integration-settings"})},render:e=>c().createElement(_e.Z,n()({title:a()(R.FormattedMessage,{id:"spaceIntegrationSettings.actionMenu.visitDeveloperWebsiteButton.label",defaultMessage:"Visit developer website"})},e))}]:[],...h?[{key:"contact support",action:()=>{e.close(),si.navigateToExternalURL({environment:o,url:"mailto:".concat(h)}),g.Z9y(o,{from:"integration-settings"})},render:e=>c().createElement(_e.Z,n()({title:a()(R.FormattedMessage,{id:"spaceIntegrationSettings.actionMenu.contactDeveloperSupportButton.label",defaultMessage:"Contact support",description:"Label for a button that users can click to contact customer support for an integration that's been added to their workspace"})},e))}]:[],{key:"disconnect",action:()=>{},render:()=>a()($s.Z,{popupType:s.isMobile?$s.Z.PopupType.SlideUp:$s.Z.PopupType.Popup,renderOrigin:e=>c().createElement(_e.Z,n()({},e,{style:{color:ie.ZP.red},title:a()(R.FormattedMessage,{id:"spaceIntegrationSettings.actionMenu.disconnectIntegrationButton.laber",defaultMessage:"Disconnect {integrationName}",values:{integrationName:u.name}}),focused:!1})),render:()=>a()(Po,{integration:u,botStores:m})})}]}],initialFocus:void 0}))})}var Fo=i(15070);function Bo(e){const{botId:t}=e,[,,i]=(0,We.oR)(void 0,Js.Z),s=(0,ze.Fy)(),o=(0,ze.O7)(),[{currentSpaceStore:r}]=(0,We.oR)(G.default),l=(0,We.VK)((()=>r?(0,Es.Kv)(r,{table:Rs.c,id:t,spaceId:r.id}):void 0),[t,r]),d=(0,We.VK)((()=>null==l?void 0:l.getValue()),[l]);if(!l)return null;let u;return u=s.isMobile?{menuType:Re.ZP.MenuType.ActionSheet}:{menuType:Re.ZP.MenuType.Popup},a()($s.Z,{popupType:s.isMobile?$s.Z.PopupType.SlideUp:$s.Z.PopupType.Popup,buttonPopupStore:i,renderOrigin:e=>c().createElement(ea.Z,n()({isMobile:s.isMobile},e,{style:{marginLeft:8,marginRight:8}})),render:e=>c().createElement(Re.ZP,u,a()(De.Z,{type:De.Z.Type.Vertical,sections:[{key:"integration options",render:e=>c().createElement(Le.Z,e),items:[{key:"copy bot token",action:()=>Bs.Pp({environment:o,botStore:l,from:"integration-settings"}),render:e=>c().createElement(_e.Z,n()({title:a()(R.FormattedMessage,{id:"spaceIntegrationSettings.actionMenu.copyInternalIntegrationTokenButton.label",defaultMessage:"Copy internal integration token"})},e))},{key:"delete",action:async()=>{await Bs.HU(l)&&await Bs.P0({environment:o,botId:l.id,onSuccess:()=>{g.IN8(o,{type:"internal"})}}),e.close()},render:e=>c().createElement(_e.Z,n()({title:a()(R.FormattedMessage,{id:"spaceIntegrationSettings.actionMenu.disconnectIntegrationButton.laber",defaultMessage:"Disconnect {integrationName}",values:{integrationName:(0,Fo.Mh)(d)}}),style:{color:ie.ZP.red}},e))}]}],initialFocus:void 0}))})}function Eo(e){const{botIds:t}=e,[{currentSpaceStore:i}]=(0,We.oR)(G.default),s=(0,qe.F)(),o=(0,We.VK)((()=>null==i?void 0:i.id),[i]),n=(0,We.VK)((()=>i?t.map((e=>(0,Es.Kv)(i,{table:Rs.c,id:e,spaceId:i.id}))).filter(vi.$K):[]),[t,i]),r=(0,We.VK)((()=>n?n.map((e=>{var t;return null!==(t=e.getValue())&&void 0!==t&&t.alive?e.getValue():void 0})).filter(vi.$K):[]),[n]),l=(0,We.VK)((()=>{if(i&&r){return r.map((e=>e.created_by_id)).map((e=>i.getRecordValue({table:Ct.KJ,id:e}))).filter(vi.$K)}return[]}),[r,i]),d=r.reduce(((e,t)=>(t.integration_id&&(e[t.integration_id]=t.integration_id in e?[...e[t.integration_id],t.id]:[t.id]),e)),{}),u=r.filter((e=>!e.integration_id)).map((e=>e.id)),m=r.reduce(((e,t)=>{const i=l.find((e=>e.id===t.created_by_id));return t.integration_id?e[t.integration_id]=t.integration_id in e?[...e[t.integration_id],i]:[i]:e[t.id]=[i],e}),{}),p=Object.entries(d).map((([e,t])=>Ro({integrationPointer:{table:eo.K,id:e},users:m[e],botIds:t}))),g=o?u.map((e=>Ro({integrationPointer:{table:Rs.c,id:e,spaceId:o},users:m[e],botIds:[e]}))):[];return c().createElement(c().Fragment,null,a()(to.Z,{columns:[{key:"integration",header:a()(R.FormattedMessage,{id:"spaceIntegrationSettings.integrationTable.integrationColumn.title",defaultMessage:"Integration"}),style:{width:"40%"}},{key:"added_by",header:a()(R.FormattedMessage,{id:"spaceIntegrationSettings.integrationtable.creationInfoColumn.title",defaultMessage:"Added by"})},{key:"more",header:void 0}],rows:[...p,...g]}),p.length+g.length===0?a()("div",{style:{height:120,width:"100%",fontSize:12,color:s.mediumTextColor,display:"flex",alignItems:"center",justifyContent:"center",borderBottom:"1px solid ".concat(s.lightDividerColor)}},void 0,a()(R.FormattedMessage,{id:"spaceIntegrationSettings.integrationTable.emptyTable.message",defaultMessage:"No integration installed"})):void 0)}function Ro(e){const{integrationPointer:t,users:i,botIds:s}=e;return t.table===eo.K?{key:t.id,columns:[a()(Do,{integrationTable:eo.K,integrationId:t.id}),a()(_o,{users:i}),a()(xo,{integrationId:t.id,botIds:s})]}:t.table===Rs.c?{key:t.id,columns:[a()(Do,{integrationTable:Rs.c,integrationId:t.id}),a()(_o,{users:i}),a()(Bo,{botId:t.id})]}:void(0,vi.t1)(t)}function Do(e){const{integrationId:t,integrationTable:i}=e,[{currentSpaceStore:s}]=(0,We.oR)(G.default),o=(0,We.VK)((()=>{if(s)return s.getRecordValue({table:i,id:t})}),[s,t,i]);if(!o)return a()(O.Z,{});let n;if(i===Rs.c){const e=o;e.icon&&(n={pointer:{table:i,id:t},icon:e.icon})}else if(i===eo.K){const e=o;e.info.icon&&(n={pointer:{table:i,id:t},icon:e.info.icon})}return a()("div",{style:{maxWidth:300,display:"flex"}},void 0,a()(Ie.Z,{disabled:!0,icon:n,title:o.name,isEmptyPage:!1,size:21,isLarge:!0,useInvertedColors:!0,style:{marginRight:6}}),i===Rs.c&&a()(ca.Z,{},void 0,a()(R.FormattedMessage,{id:"spaceIntegrationSettings.integrationTable.row.internalIntegrationLabel",defaultMessage:"Internal",description:"This label indicates that an integration is internal, as opposed to public."})),a()("div",{style:{marginLeft:6}},void 0,o.name))}function _o(e){const{users:t}=e,i=(0,R.useIntl)(),s=t.map((e=>(0,Ct.Nz)(i,e)));return a()(R.FormattedMessage,{id:"spaceIntegrationSettings.integrationTable.installerInfoColumn.contents",defaultMessage:"{remainingCount, plural, =0 {{firstUser}} one {{firstUser} and {remainingCount} other user} other {{firstUser} and {remainingCount} other users}}",values:{firstUser:s[0],remainingCount:s.length-1}})}var Lo=i(4615),Oo=i(78948),Uo=i(86646),No=i(55216);function Vo(e){const{query:t}=e,i=(0,ze.O7)(),[{currentSpaceStore:s}]=(0,We.oR)(G.default),o=(0,We.VK)((()=>{var e;return null==s||null===(e=s.getValue())||void 0===e?void 0:e.bot_settings}),[s]),r=(0,We.VK)((()=>null!=o&&o.integration_approval_statuses?Object.keys(o.integration_approval_statuses):[]),[o]),l=(0,No.Z)(io.iK).reduce(((e,t)=>(t[1].published.production&&e.push(t[1].id),e)),[]),d=(0,We.VK)((()=>l.filter((e=>!r.includes(e))).slice(0,5)),[r,l]);return a()(Re.ZP,{menuType:Re.ZP.MenuType.Popup,width:255,header:Ho(t,d)},void 0,a()(zi.Z,{request:t,performRequest:e=>Wo({query:e,environment:i,spaceId:null==s?void 0:s.id,approvedIntegrationIds:r,popularIntegrationIds:d}),debounce:Ye.vp,render:(l,d,u)=>{if(!d||!u)return a()(Le.Z,{},void 0,a()(Oo.Z,{}));const m=Object.values(Us.ns).filter((e=>t&&e.name.toLowerCase().includes(t.toLowerCase())&&!r.includes(e.id))),p=[];if(0===d.length&&0===m.length)p.push({key:"no_results",render:()=>a()(J.Z,{isSmall:!0,style:{marginLeft:8}},void 0,a()(R.FormattedMessage,{id:"adminIntegrationSettings.search.label.noResults",defaultMessage:"No results"})),action:()=>{}});else{const t=d.map((t=>{const r={table:eo.K,id:t},l=null==s?void 0:s.getRecordValue(r);if(l)return{key:"".concat(t),render:e=>c().createElement(_e.Z,n()({},e,{title:a()(J.Z,{style:{fontWeight:re.Z.fontWeight.semibold}},void 0,l.name),icon:l.info.icon&&a()(Ie.Z,{disabled:!0,icon:{pointer:r,icon:l.info.icon},isEmptyPage:!1,size:20}),style:l.info.icon?{paddingBottom:12}:{paddingLeft:30,paddingBottom:12},shouldWrapCaption:!0,caption:a()(qo,{tagline:null==l?void 0:l.info.tagline,isNotionIntegration:(0,io.BP)(l.id)}),className:"notranslate"})),action:()=>{e.closeDropdown(),zo({environment:i,currentSpaceStore:s,botSettings:o,integrationId:t})}}})).filter(vi.$K),r=m.map((t=>({key:"".concat(t.id),render:e=>c().createElement(_e.Z,n()({},e,{title:a()(J.Z,{style:{fontWeight:re.Z.fontWeight.semibold}},void 0,t.name),icon:a()("img",{src:t.icon,style:{height:20}}),caption:t.tagline,style:{paddingBottom:12},shouldWrapCaption:!0,className:"notranslate"})),action:()=>{e.closeDropdown(),zo({environment:i,currentSpaceStore:s,botSettings:o,integrationId:t.id})}}))).filter(vi.$K);p.push(...t,...r)}return a()(De.Z,{type:De.Z.Type.Vertical,initialFocus:0,sections:[{key:"results",render:e=>c().createElement(Le.Z,e),items:p}]})}}))}const Wo=async e=>{const{query:t,environment:i,spaceId:s,approvedIntegrationIds:a,popularIntegrationIds:o}=e;if(!K.Z.state.online||!s)return[];if((0,Lo.e)(t)||(0,Lo.qn)(t))return[t];if(""===t)return o;const n=await(0,k.searchIntegrations)(i,{query:t,spaceId:s});if("success"===n.type){return n.data.integrationIds.filter((e=>!a.includes(e))).sort(((e,t)=>(0,io.BP)(e)===(0,io.BP)(t)?0:(0,io.BP)(e)?-1:1)).slice(0,5)}if("failed"===n.type)throw n.error;return(0,vi.t1)(n)};function zo(e){const{environment:t,currentSpaceStore:i,botSettings:s,integrationId:a}=e;if(i){const e={...null==s?void 0:s.integration_approval_statuses,[a]:{type:"integration",status:"approved"}};(0,W.createAndCommit)(t,(t=>{(0,Be.sW)({store:i,data:{bot_settings:{...s,integration_approval_statuses:e}},transaction:t})}))}}const Ho=(e,t)=>!e&&t.length>0&&a()(Uo.Z,{title:a()(J.Z,{isSmall:!0,style:{marginTop:4,fontWeight:re.Z.fontWeight.medium}},void 0,a()(R.FormattedMessage,{defaultMessage:"Popular integrations",id:"adminIntegrationSettings.search.title.popularIntegrations"}))}),qo=e=>{const{tagline:t,isNotionIntegration:i}=e,s=(0,qe.F)(),o=i?{}:{maxHeight:48,overflow:"scroll"};return t?a()("div",{style:o},void 0,t,i&&a()("div",{style:{display:"flex",alignItems:"center",marginTop:8}},void 0,a()(R.FormattedMessage,{defaultMessage:"Developed by Notion",id:"adminIntegrationSettings.search.subtitle.notionBuilt"}),se.Z.integrationSecurity({marginLeft:3,width:12,height:12,fill:s.invoiceGreen}))):null},Go=(0,R.defineMessages)({searchButtonLabel:{id:"adminIntegrationSettings.search.button.label",defaultMessage:"+ Add allowed integration",description:"Text for button to open dropdown menu for selecting and adding a new integration to the approved list"},searchInputPlaceholder:{id:"adminIntegrationSettings.search.input.placeholder",defaultMessage:"Add by name or integration ID"}});function Ko(){const e=(0,ze.O7)(),t=(0,qe.F)(),[i,s]=(0,d.useState)(!0),[o,n]=(0,d.useState)(!1),[r,l]=(0,d.useState)(""),u=c().createRef();return i?a()(Ws.Z,{style:{display:"flex",alignItems:"center",height:28,fontWeight:re.Z.fontWeight.medium,fontSize:re.Z.fontSize.UIRegular.desktop,color:ie.ZP.blue,padding:"0px 6px"},onClick:()=>{var e;s(!1),null===(e=u.current)||void 0===e||e.focusInput()}},void 0,a()(R.FormattedMessage,{id:"adminIntegrationSettings.search.button.label",defaultMessage:"{plusIcon} Add allowed integration",description:"Text for button to open dropdown menu for selecting and adding a new integration to the approved list",values:{plusIcon:se.Z.plus({fill:ie.ZP.blue,width:14,height:14,flexGrow:0,flexShrink:0})}})):a()(Ee.ZP,{alignmentToOrigin:Ee.ZP.Alignment.Start,keepFocus:e.device.isPhone,onDismiss:()=>{var e;null===(e=u.current)||void 0===e||e.handleBlur(),s(!0),n(!1)},origin:c().createElement(L.Z,{type:"text",style:{width:255},left:se.Z.plus({fill:t.lightIconColor,width:14,height:14,marginRight:8,flexGrow:0,flexShrink:0}),ref:u,value:r,onFocus:()=>{n(!0)},placeholder:pt.default.formatMessage(Go.searchInputPlaceholder),onChange:e=>l(e.target.value)}),open:o,popupType:Ee.ZP.PopupType.Popup,style:{width:255},render:()=>a()(Vo,{query:r,closeDropdown:()=>n(!1)})})}var jo=i(55422);function Yo(e){const t=(0,ze.O7)(),{isMobile:i}=t.device,{externalBotIds:s,guestBotIds:o}=e,[{currentSpaceStore:n}]=(0,We.oR)(G.default),r=(0,We.VK)((()=>n?[...o,...s].map((e=>{var t;const i=(0,Es.Kv)(n,{table:Rs.c,id:e,spaceId:n.id});return null!=i&&null!==(t=i.getValue())&&void 0!==t&&t.alive?i.getValue():void 0})).filter(vi.$K):[]),[n,o,s]),l=(0,We.VK)((()=>function(e){return e.reduce(((e,t)=>(t.integration_id&&(e[t.integration_id]=t.integration_id in e?[...e[t.integration_id],t.id]:[t.id]),e)),{})}([...r])),[r]),d=(0,We.VK)((()=>function(e){return e.filter((e=>!e.integration_id)).map((e=>e.id))}(r)),[r]),u=(0,We.VK)((()=>function(e,t){if(!t)return{};return e.reduce(((e,i)=>{const s=t.getRecordValue({table:Ct.KJ,id:i.created_by_id});return i.integration_id?e[i.integration_id]=i.integration_id in e?[...e[i.integration_id],s]:[s]:e[i.id]=[s],e}),{})}(r,n)),[r,n]),m=(0,We.VK)((()=>{var e;return null==n||null===(e=n.getValue())||void 0===e?void 0:e.bot_settings}),[n]),p=Object.keys(l).length+d.length,g=(0,We.VK)((()=>null!=m&&m.integration_approval_statuses?Object.keys(m.integration_approval_statuses).length+d.length:d.length),[m,d]),[,,h]=(0,We.oR)(fe.default);return(0,We.VK)((()=>"on"===h.getGroup("integration-approvals")),[h])?c().createElement(c().Fragment,null,a()(Qo,{}),(null==m?void 0:m.integration_restrictions)&&a()("div",{style:{marginTop:"19px"}},void 0,a()(Jo,{})),a()(B.Z,{size:i?32:18,isHidden:!i}),Boolean(null==m?void 0:m.integration_restrictions)?a()("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"19px"}},void 0,a()(J.Z,{style:{fontWeight:re.Z.fontWeight.medium,display:"flex",alignItems:"center",height:28}},void 0,a()(R.FormattedMessage,{id:"adminIntegrationSettings.table.allowIntegrations.title",defaultMessage:"Allowed integrations{numberOfIntegrations}",values:{numberOfIntegrations:0!==g&&a()(J.Z,{isSecondaryColor:!0,style:{marginLeft:6}},void 0,g)}})),a()(Ko,{})):a()(J.Z,{style:{fontWeight:re.Z.fontWeight.medium,display:"flex",height:28,alignItems:"center",marginBottom:"19px"}},void 0,a()(R.FormattedMessage,{id:"adminIntegrationSettings.table.default.title",defaultMessage:"All integrations{numberOfIntegrations}",values:{numberOfIntegrations:0!==p&&a()(J.Z,{isSecondaryColor:!0,style:{marginLeft:6}},void 0,p+Us.T2.length)}})),a()(yo,{integrationIdToBotIds:l,internalIntegrationIds:d,integrationIdToUsers:u})):c().createElement(c().Fragment,null,a()(J.Z,{style:{fontWeight:re.Z.fontWeight.medium,display:"flex",alignItems:"center",marginBottom:"19px"}},void 0,a()(R.FormattedMessage,{id:"adminIntegrationSettings.table.default.title",defaultMessage:"All integrations{numberOfIntegrations}",values:{numberOfIntegrations:0!==p&&a()(J.Z,{isSecondaryColor:!0,style:{marginLeft:6}},void 0,p)}})),a()(Eo,{botIds:o}))}const Qo=()=>{const e=(0,ze.O7)(),[{currentSpaceStore:t}]=(0,We.oR)(G.default),{isMobile:i}=e.device,s=(0,We.VK)((()=>"enterprise"===te.CM(e)),[e]),o=(0,We.VK)((()=>{var e;return null==t||null===(e=t.getValue())||void 0===e?void 0:e.bot_settings}),[t]);return a()(jo.Z,{isMobile:i,title:a()(R.FormattedMessage,{id:"adminIntegrationSettings.requireApprovalSetting.title",defaultMessage:"Restrict members from installing integrations"}),caption:(0,Os.CJ)(o)?a()(R.FormattedMessage,{id:"adminIntegrationSettings.requireApprovalSetting.allowList.caption",defaultMessage:"Workspace members can only install integrations pre-approved by admins."}):a()(R.FormattedMessage,{id:"adminIntegrationSettings.requireApprovalSetting.off.caption",defaultMessage:"Workspace members can install any new integration."}),upsellOptions:{shouldUpsell:!s,subscriptionTier:"enterprise",analyticsName:"integration_settings"},type:"dropdown",currentOption:(0,Os.CJ)(o)?"allow_list":"any_integrations",options:[{key:"any_integrations",label:a()(R.FormattedMessage,{id:"adminIntegrationSettings.integrationRestrictions.off.title",defaultMessage:"Off"}),caption:a()(R.FormattedMessage,{id:"adminIntegrationSettings.integrationRestrictions.off.caption",defaultMessage:"Workspace members can install any integration."})},{key:"allow_list",label:a()(R.FormattedMessage,{id:"adminIntegrationSettings.integrationRestrictions.allowList.title",defaultMessage:"From allowed list"}),caption:a()(R.FormattedMessage,{id:"adminIntegrationSettings.integrationRestrictions.allowList.title",defaultMessage:"Workspace members can only install integrations pre-approved by an admin."})}],onSelectOption:i=>{!function(e){const{environment:t,currentSpaceStore:i,botSettings:s,setting:a}=e;if(i){if("allow_list"===a&&(0,Os.CJ)(s))return;const e="allow_list"===a?"approved_only":void 0;W.createAndCommit(t,(t=>{Be.sW({store:i,data:{bot_settings:{...s,integration_restrictions:e}},transaction:t})}))}}({environment:e,currentSpaceStore:t,botSettings:o,setting:i})},info:[{key:"learn_more",label:a()(R.FormattedMessage,{id:"adminIntegrationSettings.integrationRestrictions.info.title",defaultMessage:"Admins can always install and allow new integrations."})}]})};const Jo=()=>{const e=(0,ze.O7)(),t=(0,qe.F)(),[{currentSpaceStore:i}]=(0,We.oR)(G.default),{isMobile:s}=e.device,o=(0,We.VK)((()=>"enterprise"===te.CM(e)),[e]),n=(0,We.VK)((()=>{var e;return null==i||null===(e=i.getValue())||void 0===e?void 0:e.bot_settings}),[i]);return a()(jo.Z,{isMobile:s,title:a()(R.FormattedMessage,{id:"adminIntegrationSettings.autoApproveBuiltByNotion.title",description:"This message is for the option to auto approve integrations that are built by Notion.",defaultMessage:"Auto-approve <builtbynotion>Built by Notion</builtbynotion> integrations",values:{builtbynotion:(...e)=>a()("span",{style:{color:t.invoiceGreen}},void 0,se.Z.integrationSecurity({width:14,display:"inline",verticalAlign:"text-bottom",marginRight:2}),e)}}),caption:a()(R.FormattedMessage,{defaultMessage:"Automatically approve integrations built by Notion.",id:"adminIntegrationSettings.autoApproveBuiltByNotion.caption"}),upsellOptions:{shouldUpsell:!o,subscriptionTier:"enterprise",analyticsName:"integration_settings"},type:"toggle",isOn:"approved_or_built_by_notion"===(null==n?void 0:n.integration_restrictions),onToggle:()=>function(e){const{environment:t,currentSpaceStore:i,botSettings:s}=e;if(i){const e="approved_or_built_by_notion"===(null==s?void 0:s.integration_restrictions)?"approved_only":"approved_or_built_by_notion";W.createAndCommit(t,(t=>{Be.sW({store:i,data:{bot_settings:{...s,integration_restrictions:e}},transaction:t})}))}}({environment:e,currentSpaceStore:i,botSettings:n})})};var Xo=i(30381),$o=i.n(Xo);function en(e){const{botIds:t}=e,i=(0,R.useIntl)(),[{currentSpaceStore:s}]=(0,We.oR)(G.default),o=(0,qe.F)(),n=(0,We.VK)((()=>s?t.map((e=>function(e,t){const{currentSpaceStore:i}=G.default.state,s=e.getValue();if(!s||!s.alive||!i||!e.canAdmin()&&!i.canAdmin())return;const o=null==i?void 0:i.getRecordValue({table:Ct.KJ,id:s.created_by_id}),n=(0,Ct.Nz)(t,{name:null==o?void 0:o.name}),r=$o()(s.created_at,"x").format("LLL"),l=!s.integration_id;return{key:s.id,columns:[a()("div",{style:{maxWidth:300,display:"flex"}},void 0,a()(Xs.Z,{botValue:s,avatarSize:24,style:{marginRight:6}}),l&&a()(ca.Z,{},void 0,a()(R.FormattedMessage,{id:"spaceIntegrationSettings.integrationTable.row.internalIntegrationLabel",defaultMessage:"Internal",description:"This label indicates that an integration is internal, as opposed to public."}))),a()(R.FormattedMessage,{id:"spaceIntegrationSettings.integrationTable.creationInfoColumn.contents",defaultMessage:"{installerName} on {installedTime}",values:{installerName:n,installedTime:r},description:"Text describing who added an integration to a workspace and when. For example: 'Johnny Appleseed on May 13, 2021'"}),a()(Bo,{botId:s.id})]}}((0,Es.Kv)(s,{table:Rs.c,id:e,spaceId:s.id}),i))).filter(vi.$K):[]),[s,t,i]);return c().createElement(c().Fragment,null,a()("div",{style:{marginBottom:"19px",display:"flex",alignItems:"center"}},void 0,a()(J.Z,{style:{fontWeight:re.Z.fontWeight.medium}},void 0,a()(R.FormattedMessage,{id:"adminIntegrationSettings.table.default.title",defaultMessage:"All integrations"})),a()(J.Z,{isSecondaryColor:!0,style:{marginLeft:6}},void 0,n.length)),a()(to.Z,{columns:[{key:"integration",header:a()(R.FormattedMessage,{id:"spaceIntegrationSettings.integrationTable.integrationColumn.title",defaultMessage:"Integration"}),style:{width:"40%"}},{key:"added_by",header:a()(R.FormattedMessage,{id:"spaceIntegrationSettings.integrationtable.creationInfoColumn.title",defaultMessage:"Added by"})},{key:"more",header:void 0}],rows:n}),0===n.length?a()("div",{style:{height:120,width:"100%",fontSize:12,color:o.lightTextColor,display:"flex",alignItems:"center",justifyContent:"center",borderBottom:"1px solid ".concat(o.lightDividerColor)}},void 0,a()(R.FormattedMessage,{id:"spaceIntegrationSettings.integrationTable.emptyMessage",defaultMessage:"No integration installed"})):void 0)}class tn extends F.Z{constructor(...e){super(...e),l()(this,"storeTypes",{requestStore:ee.Z}),l()(this,"renderResult",((e,t,i)=>{const{currentSpaceStore:s}=G.default.state;if(s)return a()(ts.Z,{loaded:i,spinnerSize:16,showSpinnerTimeout:600},void 0,e&&a()("div",{},void 0,a()(R.FormattedMessage,{id:"spaceIntegrationSettings.error",defaultMessage:"Something went wrong…"})),t&&(s.canAdmin()?a()(Yo,{guestBotIds:t.guestBotIds,externalBotIds:t.externalBotIds}):a()(en,{botIds:t.guestBotIds})),a()("div",{style:{marginTop:16,marginBottom:32,display:"grid",gridTemplateColumns:"1fr",gap:4}},void 0,a()($a.Z,{style:{display:"flex",marginLeft:-6},className:"notion-print-ignore",href:(0,ve.UY)("guides.publicAPI"),external:!0},void 0,a()(Hi.Z,{icon:se.Z.help,isSmall:!0,isLightGray:!0},void 0,a()(R.FormattedMessage,{id:"spaceIntegrationSettings.integrationManagement.sitelink",defaultMessage:"Learn more about managing integrations",description:"This link, when clicked, will direct the user to the help center."}))),a()($a.Z,{style:{display:"flex",marginLeft:-6},className:"notion-print-ignore",href:ai._j.myIntegrations,external:!0,onClick:()=>{g.YYl(this.environment,{from:"integration-settings",href:ai._j.myIntegrations})}},void 0,a()(Hi.Z,{icon:se.Z.alias,isSmall:!0,isLightGray:!0},void 0,a()(R.FormattedMessage,{id:"spaceIntegrationSettings.integrationDevelopment.sitelink",defaultMessage:"Develop your own integrations",description:"This link, when clicked, take users to a page where they can create their own public or private integration."})))))})),l()(this,"fetchBotsInSpace",(async({spaceId:e})=>{const t=await(0,Bs.Yw)({environment:this.environment,table:ta.bx,id:e,type:"guest"}),i=await(0,Bs.Yw)({environment:this.environment,table:ta.bx,id:e,type:"external"});return{guestBotIds:t.botIds,externalBotIds:i.botIds}}))}renderComponent(){const{device:e}=this.environment;return a()(U.Z,{},void 0,a()(N.Z,{large:!e.isMobile||void 0,divider:e.isMobile?void 0:"full",style:{paddingBottom:12}},void 0,a()(R.FormattedMessage,{id:"spaceIntegrationSettings.title",defaultMessage:"Integrations"})),this.renderRequest())}renderRequest(){const{spaceStore:e,userStore:t}=this.props;return a()(zi.Z,{requestStore:this.stores.requestStore,request:{spaceId:e.id,userId:t.id},performRequest:this.fetchBotsInSpace,render:this.renderResult})}}const sn=(0,R.injectIntl)(tn);var an=i(79603),on=i(92251),nn=i(47082);class rn extends y.Z{getInitialState(){return{tokenQuery:"",defaultTeams:{}}}addedAndCurrentTeams(){return Object.values(this.state.defaultTeams).filter((({state:e})=>"current-default"===e||"add-default"===e))}addedTeams(){return Object.values(this.state.defaultTeams).filter((({state:e})=>"add-default"===e))}removedTeams(){return Object.values(this.state.defaultTeams).filter((({state:e})=>"remove-default"===e))}}const ln=new rn;var dn=i(29716),cn=i(29369);function un(e){const{teamStore:t}=e,{name:i,icon:s}=(0,We.VK)((()=>({name:t.getName(),icon:t.getIcon()})),[t]);return c().createElement(_e.Z,n()({},e,{icon:a()(Ie.Z,{disabled:!0,icon:s,isEmptyPage:!1,size:14}),title:i}))}var mn=i(32465);function pn(){const e=(0,ze.Fy)();return a()(N.Z,{large:!e.isMobile||void 0,divider:e.isMobile?void 0:"full"},void 0,a()(R.FormattedMessage,{id:"teamsWorkspaceSettings.title",defaultMessage:"Teams"}))}function gn(e){const t=(0,ze.Fy)(),{teamStore:i}=e,{name:s,id:o,icon:n}=(0,We.VK)((()=>({name:i.getName(),id:i.id,icon:i.getIcon()})),[i]),[r,l]=(0,We.oR)(ln);return a()(Fe.Z,{showRemoveButton:!0,isSingle:!1,format:t.isMobile?wt.l.Large:wt.l.Medium,style:{margin:0,marginLeft:6},onClickRemove:()=>{l({...r,defaultTeams:{...r.defaultTeams,[o]:{store:i,state:"remove-default"}}})},value:a()("div",{style:{display:"flex"}},void 0,a()(Ie.Z,{disabled:!0,icon:n,isEmptyPage:!1,size:14,style:{marginRight:4}}),s)})}function hn(e){const{queryMatchedTeams:t}=e,i=(0,ze.Fy)(),s=(0,R.useIntl)(),o=(0,qe.y)((e=>({tokenInputMenu:{border:"1px solid ".concat(e.darkDividerColor),borderRadius:3,margin:0},menuList:{border:"1px solid ".concat(e.darkDividerColor),boxShadow:e.mediumBoxShadow,borderTop:0,borderRadius:3,borderTopLeftRadius:0,borderTopRightRadius:0}})),[]),[r,l]=(0,We.oR)(ln),{addedAndCurrentTeams:d,removedTeams:u}=(0,We.VK)((()=>({addedAndCurrentTeams:ln.addedAndCurrentTeams(),removedTeams:ln.removedTeams()})),[]),p=[];return t.length>0&&""!==r.tokenQuery&&p.push({key:"default-teams-list",render:e=>c().createElement(Le.Z,n()({},e,{title:s.formatMessage({id:"teamsWorkspaceSettings.defaultTeamList.title",defaultMessage:"Teams"}),loading:!1})),items:t.map((e=>({key:e.id,render:t=>c().createElement(un,n()({},t,{teamStore:e})),action:()=>{l({...r,defaultTeams:{...r.defaultTeams,[e.id]:{state:"add-default",store:e}},tokenQuery:""})}})))}),c().createElement(c().Fragment,null,a()(N.Z,{style:{fontWeight:re.Z.fontWeight.semibold}},void 0,a()(R.FormattedMessage,{id:"teamsWorkspaceSettings.defaultTeams.title",defaultMessage:"Default teams"})),a()(J.Z,{isSmall:!0,isMultiline:!0},void 0,a()(R.FormattedMessage,{id:"teamsWorkspaceSettings.defaultTeams.caption",defaultMessage:"Default teams are teams that new workspace members auto-join. You must choose at least one default team."})),a()("div",{style:{paddingTop:6}},void 0,a()(nn.Z,{style:o.tokenInputMenu,focusInitial:i.isMobile,focusAfterAnimation:!0,format:nn.Z.Format.Share,inputDivStyle:{margin:0,alignItems:"center"},value:r.tokenQuery,onChange:e=>{const t=e.target.value;l({...r,tokenQuery:t})},type:"default-teams",tokens:[...Object.values(r.defaultTeams).map((e=>e.store))].filter((e=>!u.map((e=>e.store)).includes(e))).map((e=>a()(gn,{teamStore:e}))),disabled:!1,placeholder:s.formatMessage({id:"teamsWorkspaceSettings.defaultTeams.inputPlaceholder",defaultMessage:"Select a default team..."}),onRemoveLastToken:()=>{const e=d,t=m().last(e);t&&l({...r,defaultTeams:{...r.defaultTeams,[t.store.id]:{store:t.store,state:"remove-default"}}})},onEmptySubmit:m().identity}),p.length>0&&a()("div",{style:o.menuList},void 0,a()(De.Z,{type:De.Z.Type.Vertical,initialFocus:r.tokenQuery.length>0?0:void 0,sections:p}))))}function fn(e){const[t,,i]=(0,We.oR)(e.securitySettingsStore),[{currentSpaceStore:s}]=(0,We.oR)(G.default),{disableTeamCreation:o}=(0,We.VK)((()=>{var e;return{disableTeamCreation:Boolean(null===(e=G.default.state.currentSpaceStore)||void 0===e?void 0:e.getDisableTeamCreation())}}),[]),n=(0,ze.O7)(),r=e.resetFn,l=()=>x.ZP.setState({...x.ZP.state,open:!1}),{addedTeams:d,removedTeams:c,addedAndCurrentTeams:u}=(0,We.VK)((()=>({addedAndCurrentTeams:ln.addedAndCurrentTeams(),addedTeams:ln.addedTeams(),removedTeams:ln.removedTeams()})),[]);if(!s)return null;const m=d.length>0||c.length>0,p=t.disableTeamCreation!==o;return a()("div",{style:{display:"flex"}},void 0,a()(j.Z,{disabled:!m&&!p,isLarge:!0,onClick:()=>{0!==u.length?(p&&qs(n,{securitySettingsStore:i,spaceStore:s}),W.createAndCommit(n,(e=>{m&&(0,mn.lH)({transaction:e,addedStores:d.map((({store:e})=>e)),removedStores:c.map((({store:e})=>e))}),l(),r()}))):h.showErrorMessage(a()(R.FormattedMessage,{id:"teamsWorkspaceSettings.updateButton.errorLabel",defaultMessage:"You must select at least one default team."}))}},void 0,a()(R.FormattedMessage,{id:"teamsWorkspaceSettings.updateButton.label",defaultMessage:"Update"})),a()(Y.Z,{isLarge:!0,style:{marginLeft:12},onClick:()=>{l(),r()}},void 0,a()(R.FormattedMessage,{id:"teamsWorkspaceSettings.cancelButton.label",defaultMessage:"Cancel"})))}function vn(e){const[t,i]=(0,We.oR)(e.securitySettingsStore);return c().createElement(c().Fragment,null,a()(N.Z,{style:{fontWeight:re.Z.fontWeight.semibold,paddingTop:20}},void 0,a()(R.FormattedMessage,{id:"teamWorkspacesSettings.security.title",defaultMessage:"Security"})),a()("div",{},void 0,a()("div",{style:{display:"flex",alignItems:"center",cursor:"pointer"},onClick:()=>{i({...t,disableTeamCreation:!t.disableTeamCreation})}},void 0,a()("div",{style:{fontSize:14,marginRight:8,flexGrow:1}},void 0,a()(R.FormattedMessage,{id:"teamWorkspacesSettings.disableTeamCreation.title",defaultMessage:"Limit team creation to only workspace admins"}),a()(J.Z,{isSmall:!0,isMultiline:!0,style:{marginTop:2,width:"80%"}},void 0,a()(R.FormattedMessage,{id:"teamWorkspacesSettings.disableTeamCreation.caption",defaultMessage:"This will only allow workspace admins to create teams. Workspace members will not be able to create teams, they will continue to be able to join and leave teams."}))),a()("div",{style:{marginTop:5}},void 0,a()(mi.Z,{on:t.disableTeamCreation})))))}function yn(e){const t=(0,ze.O7)(),[{currentSpaceStore:i,currentUserStore:s,currentSpaceViewStore:o}]=(0,We.oR)(G.default),[n,r]=(0,We.oR)(ln),[l]=(0,je.r5)((async()=>{if(!i||!s)return;const e=await k.getTeams(t,{spaceId:i.id},s.id);var a;if("failed"===e.type)throw new Error(JSON.stringify({message:null===(a=e.body)||void 0===a?void 0:a.message,status:e.status}));return e.data.teams.map((e=>dn.Z.createChildStore(i,{table:cn.e0,id:e.id})))}),[t,i,s]),{loaded:c,teams:u}=(0,We.VK)((()=>{const e={loaded:!1,teams:[]};if("idle"===l.status||"pending"===l.status)return e;const t=null==i?void 0:i.getValue(),s=null==o?void 0:o.getValue();return t&&s&&o?{loaded:!0,teams:m().uniqBy([...l.value||[],...o.getTeamsStores()],(e=>e.id))}:e}),[l.status,l.value,o,i]),[p,g]=(0,d.useState)(!1),{queryMatchedTeams:h,previouslyEnabledTeams:f}=(0,We.VK)((()=>({queryMatchedTeams:u.filter((e=>{var t;return!n.tokenQuery||-1!==(null===(t=e.getName())||void 0===t?void 0:t.toLowerCase().indexOf(n.tokenQuery.toLowerCase()))})),previouslyEnabledTeams:u.filter((e=>e.isDefault()))})),[u,n]),v=(0,d.useCallback)((()=>{r({tokenQuery:n.tokenQuery,defaultTeams:f.reduce(((e,t)=>(e[t.id]={state:"current-default",store:t},e)),{})})}),[r,n.tokenQuery,f]),[y,M,S]=(0,We.oR)(void 0,w),[b,T]=(0,d.useState)(!1);return(0,d.useEffect)((()=>{!p&&c&&(v(),g(!0)),!b&&i&&(M({...y,...S.getValueForSpace(i)}),T(!0))}),[i,c,p,v,b,y,S,M]),a()(U.Z,{controlRow:a()(fn,{resetFn:v,securitySettingsStore:S})},void 0,a()(pn,{}),a()(hn,{queryMatchedTeams:h}),a()(vn,{securitySettingsStore:S}))}i(60285);let Mn;function Sn(e,t,i=M.sF){const s={type:"date",start_date:e.start_date};return M.OQ.toMomentRange(s).start.locale(t.locale).format(i)}function bn(e,t,i=M.c_){return M.OQ.dateTimeToMoment(e).locale(t.locale).format(i)}function Tn(e,t,i=M.YF){return M.OQ.dateTimeToMoment(e).locale(t.locale).format(i)}function Cn(e){return e.starting&&e.ending?{starting:{type:"date",start_date:e.starting.start_date},ending:{type:"date",start_date:e.ending.start_date}}:e.starting?{starting:{type:"date",start_date:e.starting.start_date}}:e.ending?{ending:{type:"date",start_date:e.ending.start_date}}:{}}function Zn(e){if(e)return{type:"date",start_date:e.start_date}}function wn(e){return"".concat(e.actorType,":").concat(e.actorId)}function kn(e){const t=e.split(":");if(2===t.length)return"bot"===t[0]?{actorId:t[1],actorType:"bot"}:"notion_user"===t[0]?{actorId:t[1],actorType:"notion_user"}:void 0}!function(e){e.CreatedNewest="CreatedNewest",e.CreatedOldest="CreatedOldest"}(Mn||(Mn={}));class An extends y.Z{getInitialState(){return{pageNum:1,pageSize:10,timeRange:{},actors:[],actions:[],sortOrder:void 0}}}const Pn=new An,In=e=>{const{timeRange:t,actors:i,actions:s,sortOrder:a}=e,o=new URLSearchParams;return t.starting&&o.append("starting","".concat(M.OQ.toUnixMs(t.starting))),t.ending&&o.append("ending","".concat(M.OQ.toUnixMs(t.ending))),(null==i?void 0:i.length)>0&&o.append("actors",i.map(wn).join(",")),(null==s?void 0:s.length)>0&&o.append("actions",s.join(",")),o.append("sort","".concat(a||Mn.CreatedNewest)),o.toString()};class xn extends y.Z{getInitialState(){return{cachedResponses:{}}}getCursor(e,t,i){if(i<=1||this.state.spaceId!==e)return;const s=In(t);if(this.state.filterStr!==s)return;const a=this.state.cachedResponses[i-1];return"success"===a.status?null==a?void 0:a.nextCursor:void 0}startLoading(e,t){this.updateResultHelper(e,t,{status:"loading"})}updateLoadedResult(e,t,i){this.updateResultHelper(e,t,{...i,status:"success",loadedAt:Date.now()})}updateError(e,t){this.updateResultHelper(e,t,{status:"error"})}updateResultHelper(e,t,i){const s=In(t);1!==t.pageNum&&this.state.spaceId===e&&this.state.filterStr===s?this.setState({spaceId:e,filterStr:s,cachedResponses:{...this.state.cachedResponses,[t.pageNum]:{...i}}}):this.setState({spaceId:e,filterStr:s,cachedResponses:{[t.pageNum||1]:{...i}}})}}const Fn=new xn,Bn=(0,R.defineMessages)({loadCurrentAuditLogError:{id:"auditlog.error.loadCurrentAuditLogError",defaultMessage:"Failed to load audit logs",description:"The error message when audit log cannot be loaded from the server"}});var En=i(86933);function Rn(){return a()(N.Z,{large:!0,style:{marginBottom:0,paddingBottom:0,fontSize:16,fontWeight:re.Z.fontWeight.medium,display:"flex",justifyContent:"space-between"}},void 0,a()(En.Z,{id:"auditlog.title",defaultMessage:"Audit log"}),a()(Dn,{}))}function Dn(){const e=(0,ze.O7)();return D.default.isLocalhost||"development"===D.default.env?a()(Y.Z,{style:{marginLeft:10},isSmall:!0,onClick:()=>{(0,si.navigateToExternalURL)({environment:e,url:"https://dev.notion.so/notion/Audit-Log-Dev-feedback-e9048c4e7d544369b0b8413ec20f02cf",targetSelf:!0})}},void 0,"🎁 Feedback is a gift!"):null}var _n=i(3059),Ln=i(89206),On=i(255),Un=i(13854),Nn=i(70510),Vn=i(33426),Wn=i(90175),zn=i(67950),Hn=i(46945),qn=i(41558),Gn=i(15282);const Kn="Invalid date",jn="Invalid range";class Yn extends y.Z{getInitialState(){return{dateEdited:!1,timeEdited:!1,temporaryValue:{date:void 0,time:void 0},error:void 0}}}const Qn=Yn;var Jn=i(85114);class Xn extends F.Z{constructor(...e){super(...e),l()(this,"storeTypes",{store:Qn}),l()(this,"renderInput",(()=>{const{device:e}=this.environment,{store:t,hideClearButton:i,focus:s,showTime:o,placeholder:r,...l}=this.props,d=e.isMobile?"date":"text",u=e.isMobile?"time":"text",m=L.Z.Format.Transparent,p=e.isMobile?void 0:s;return a()("div",{style:{display:"flex",alignItems:"center",borderRadius:3,lineHeight:2,background:this.theme.inputBackground,paddingLeft:8,paddingRight:8,flexBasis:"50%",...this.getInputStyles().inputOuterStyle}},void 0,c().createElement(L.Z,n()({},l,{type:d,format:m,placeholder:r,focus:"date"===p,onFocus:this.handleDateFocus,onChange:this.handleDateChange,onSubmit:e=>this.handleSubmit(e,"date"),onBlur:this.handleBlur,value:this.getDateInputValue(),size:1,style:{fontSize:e.isMobile?16:14},showClearButton:!o&&this.showClearButton(),onClearButtonClick:this.handleClear})),o&&c().createElement(c().Fragment,null,a()("div",{style:{height:14,width:1,background:this.theme.regularDividerColor,marginLeft:6,marginRight:12,flexShrink:0}}),c().createElement(L.Z,n()({},l,{placeholder:pt.default.formatMessage(ir.timePlaceholder),type:u,format:m,focus:"time"===p,onFocus:this.handleTimeFocus,onChange:this.handleTimeChange,onSubmit:e=>this.handleSubmit(e,"time"),onBlur:this.handleBlur,value:this.getTimeInputValue(),size:1,style:{fontSize:e.isMobile?16:14},showClearButton:this.showClearButton(),onClearButtonClick:this.handleClear}))))})),l()(this,"handleDateFocus",(e=>{const{onDateFocus:t}=this.props,{store:i}=this.stores;i.setState({...i.state,dateEdited:!1}),t&&t(e)})),l()(this,"handleTimeFocus",(e=>{const{onTimeFocus:t}=this.props,{store:i}=this.stores;i.setState({...i.state,timeEdited:!1}),t&&t(e)})),l()(this,"handleClear",(()=>{const{onClear:e,onUpdate:t}=this.props,{store:i}=this.stores;i.setState({...i.state,dateEdited:!0,timeEdited:!0,temporaryValue:{date:void 0,time:void 0},error:void 0});const s=this.validateCurrent();s&&t(s),i.setState({...i.state,dateEdited:!1,timeEdited:!1}),e&&e()})),l()(this,"handleDateChange",(e=>{const{device:t}=this.environment,{store:i}=this.stores;i.setState({...i.state,dateEdited:!0,temporaryValue:{...i.state.temporaryValue,date:e.target.value||""}}),t.isAndroid&&this.handleBlur()})),l()(this,"handleTimeChange",(e=>{const{device:t}=this.environment,{store:i}=this.stores;i.setState({...i.state,timeEdited:!0,temporaryValue:{...i.state.temporaryValue,time:e.target.value||""}}),t.isAndroid&&this.handleBlur()})),l()(this,"handleSubmit",((e,t)=>{var i,s;const{onUpdate:a,onSubmit:o,showTime:n}=this.props,{store:r}=this.stores;let l;(!n||"date"===t&&null!==(i=this.props.value)&&void 0!==i&&i.start_time||"time"===t&&null!==(s=this.props.value)&&void 0!==s&&s.start_date)&&(l=this.validateCurrent(),l&&(a(l),l.error?r.setState({...r.state,dateEdited:!1,error:l.error}):r.reset())),o&&o(e,l)})),l()(this,"handleBlur",(e=>{const{onUpdate:t,onBlur:i}=this.props,{store:s}=this.stores,a=this.validateCurrent();a?(t(a),a.error?s.setState({...s.state,dateEdited:!1,timeEdited:!1,error:a.error}):s.reset()):s.setState({...s.state,dateEdited:!1,timeEdited:!1}),e&&i&&i(e)})),l()(this,"styles",{menuItem:{marginBottom:this.environment.device.isMobile?1:12},inputWrapper:{borderRadius:3,height:28,paddingRight:this.showClearButton()?6:0,position:"relative"},inputEditRegion:{width:this.showClearButton()?"calc(100% - 14px)":"100%"},inputEditRegionMobile:{padding:"2px 6px",position:"relative"},tooltipOriginGap:-8})}didUpdate(e){const{store:t}=this.stores;m().isEqual(e.value,this.props.value)||t.reset()}renderComponent(){const e=this.styles,t=this.getError();return t?a()(ct.Z,{renderTooltip:()=>t,forceVisibleState:!0,placement:ct.Z.Placement.Left,render:this.renderInput,originGap:e.tooltipOriginGap}):this.renderInput()}getDateInputValue(){const{device:e}=this.environment,{value:t,dateFormat:i,intl:s}=this.props,{store:a}=this.stores;return e.isMobile?t?Sn(t,s):"":a.state.temporaryValue.date?a.state.temporaryValue.date:a.state.dateEdited?a.state.temporaryValue.date||"":t?Sn(t,s,i):""}getTimeInputValue(){const{device:e}=this.environment,{value:t,timeFormat:i,intl:s}=this.props,{store:a}=this.stores;return e.isMobile?t?bn(t,s):"":a.state.temporaryValue.time?a.state.temporaryValue.time:a.state.timeEdited?a.state.temporaryValue.time||"":t?bn(t,s,i):""}getError(){const{store:e}=this.stores,{intl:t}=this.props;if(e.state.error)switch(e.state.error){case Kn:return t.formatMessage({id:"dateInputError.invalidDateError.tooltip",defaultMessage:"Invalid date"});case jn:return t.formatMessage({id:"dateInputError.invalidDateRangeError.tooltip",defaultMessage:"Invalid range"});default:(0,vi.t1)(e.state.error)}}validateCurrent(){const{validate:e}=this.props,t=this.parseCurrentDateTimeValue();if(t)return e?e(t):t}parseCurrentDateTimeValue(){const{store:e}=this.stores,{value:t,showTime:i,isEndingDate:s}=this.props;if(!e.state.dateEdited&&!e.state.timeEdited)return;if(!e.state.temporaryValue.date&&!e.state.temporaryValue.time)return{value:void 0};const a=(0,Jn.uy)(e.state.temporaryValue.date||"",this.props.intl);if(a){let e="";return e=i?(null==t?void 0:t.start_time)||"00:00":s?"23:59":"00:00",{value:{type:"datetime",start_date:a,time_zone:(null==t?void 0:t.time_zone)||M.x7,start_time:e}}}const o=(0,Jn.wk)(e.state.temporaryValue.time||"",this.props.intl);return(null!=t&&t.start_date||a)&&o?{value:{type:"datetime",start_date:(null==t?void 0:t.start_date)||a,start_time:o,time_zone:(null==t?void 0:t.time_zone)||M.x7}}:{error:Kn}}showClearButton(){const{device:e}=this.environment,{hideClearButton:t}=this.props;return!!e.isMobile||!t}getInputStyles(){const{device:e}=this.environment,{inputStyle:t,inputOuterStyle:i,style:s}=this.props,a=this.styles;return{style:{...a.menuItem,...s},inputOuterStyle:{...a.inputWrapper,...i,...this.getInputBorders()},inputStyle:{...a.inputEditRegion,...e.isMobile&&a.inputEditRegionMobile,...t}}}getInputBorders(){const{disabled:e,focus:t}=this.props,i=this.getThemeColors(),s=this.getError();if(!e)return s?i.inputError:t?i.inputFocused:i.inputDefault}getThemeColors(){return{inputDefault:{background:this.theme.inputBackground,boxShadow:this.theme.inputBoxShadow},inputFocused:{boxShadow:this.theme.outlineBlueInputBoxShadow},inputError:{boxShadow:this.theme.outlineRedInputBoxShadow},placeholder:{color:this.theme.lightTextColor}}}}const $n=(0,R.injectIntl)(Xn);var er=i(60843),tr=i(76150);const ir=(0,R.defineMessages)({startingDateMessage:{defaultMessage:"Starting",id:"auditLog.dateTimeRangeMenu.startingDatePlaceholder",description:"Placeholder for the starting date in audit log date filter."},endingDateMessage:{defaultMessage:"Ending",id:"auditLog.dateTimeRangeMenu.endingDatePlaceholder",description:"Placeholder for the ending date in audit log date filter."},timePlaceholder:{defaultMessage:"HH:MM AM",id:"auditLog.dateTimeRangeMenu.timePlaceholder",description:"Placeholder for the time input in audit log. Layout is <Hours>:<Minutes> <AM/PM>"}});class sr extends F.Z{constructor(...e){super(...e),l()(this,"storeTypes",{store:Un.ZP,dayRangeStore:qn.Z}),l()(this,"renderInputs",(()=>{const{device:e,WindowSizeStore:t}=this.environment,{value:i,disabled:s}=this.props,{store:o}=this.stores,n=o.getFocus();let r="date";n!==tr.Hv.StartTime&&n!==tr.Hv.EndTime||(r="time");const l=this.getRangeBounds();return a()("div",{style:{paddingTop:e.isMobile?16:12,paddingBottom:e.isMobile?16:8,paddingLeft:e.isMobile?t.getSafePaddingLeftCSS(16):14,paddingRight:e.isMobile?t.getSafePaddingRightCSS(16):14,display:o.state.showTime?"block":"flex",...e.isMobile&&{boxShadow:"\n\t\t\t\t\t\t\t0 1px 0 ".concat(this.theme.regularDividerColor,"\n\t\t\t\t\t\t"),position:"relative",zIndex:2},background:e.isMobile?this.theme.popoverBackground:void 0}},void 0,a()($n,{disabled:s,placeholder:pt.default.formatMessage(ir.startingDateMessage),focus:n===tr.Hv.StartDate||n===tr.Hv.StartTime?r:void 0,value:i.starting,validate:this.validateStart,onUpdate:this.handleUpdateStart,onDateFocus:()=>this.handleDateFocus(tr.Hv.StartDate),onTimeFocus:()=>this.handleTimeFocus(tr.Hv.StartTime),onSubmit:(e,t)=>this.handleStartSubmit(e,t,n),inputElementAttributes:{max:l.latestValidStarting},showTime:o.state.showTime}),a()("div",{style:{width:12,height:8}}),a()($n,{disabled:s,placeholder:pt.default.formatMessage(ir.endingDateMessage),focus:n===tr.Hv.EndDate||n===tr.Hv.EndTime?r:void 0,value:i.ending,validate:this.validateEnd,onUpdate:this.handleUpdateEnd,onDateFocus:()=>this.handleDateFocus(tr.Hv.EndDate),onTimeFocus:()=>this.handleTimeFocus(tr.Hv.EndTime),onSubmit:(e,t)=>this.handleEndSubmit(e,t,n),inputElementAttributes:{min:l.earliestValidEnding},showTime:o.state.showTime}))})),l()(this,"renderCalendar",(()=>{const{device:e}=this.environment,{value:t,onUpdate:i}=this.props,{store:s,dayRangeStore:o}=this.stores,n=this.styles,r=this.getThemeColors(),l={...n.pickerSection,...e.isMobile&&n.pickerSectionMobile,...e.isMobile&&r.pickerSectionMobile};return a()(Le.Z,{},void 0,a()("div",{style:l},void 0,a()(Hn.Z,{value:Cn(t),dateTimeStore:s,store:o,onUpdate:e=>{if(e.error)return;const s=function(e,t){let i={starting:void 0,ending:void 0};var s,a,o,n;if(t.starting&&t.ending)i={starting:{type:"datetime",start_time:"",start_date:t.starting.start_date,time_zone:""},ending:{type:"datetime",start_time:"",start_date:t.ending.start_date,time_zone:""}},null!==(s=e.starting)&&void 0!==s&&s.start_time&&null!==(a=e.starting)&&void 0!==a&&a.time_zone&&(i.starting={...i.starting,start_time:e.starting.start_time,time_zone:e.starting.time_zone}),null!==(o=e.ending)&&void 0!==o&&o.start_time&&null!==(n=e.ending)&&void 0!==n&&n.time_zone?i.ending={...i.ending,start_time:e.ending.start_time,time_zone:e.ending.time_zone}:i={starting:{...i.starting,start_time:"00:00",time_zone:M.x7},ending:{...i.ending,start_time:"00:00",time_zone:M.x7}};else if(t.starting){var r,l;i=null!==(r=e.starting)&&void 0!==r&&r.start_time&&null!==(l=e.starting)&&void 0!==l&&l.time_zone?{starting:{type:"datetime",start_date:t.starting.start_date,start_time:e.starting.start_time,time_zone:e.starting.time_zone},ending:e.ending}:{starting:{type:"datetime",start_date:t.starting.start_date,start_time:"00:00",time_zone:M.x7},ending:e.ending}}else if(t.ending){var d,c;i=null!==(d=e.ending)&&void 0!==d&&d.start_time&&null!==(c=e.ending)&&void 0!==c&&c.time_zone?{ending:{type:"datetime",start_date:t.ending.start_date,start_time:e.ending.start_time,time_zone:e.ending.time_zone},starting:e.starting}:{ending:{type:"datetime",start_date:t.ending.start_date,start_time:"00:00",time_zone:M.x7},starting:e.starting}}else i={starting:e.starting,ending:e.ending};return i}(t,e.value);return i({error:e.error,value:s})},validate:this.validateDateRangeField})))})),l()(this,"handleDateFocus",(e=>{const{store:t,dayRangeStore:i}=this.stores;t.setState({...t.state,focus:e});const s=Un.QJ[e];i.setState({...i.state,focus:s})})),l()(this,"handleTimeFocus",(e=>{const{store:t}=this.stores;t.setState({...t.state,focus:e})})),l()(this,"handleUpdateStart",(e=>{const{onUpdate:t}=this.props;e.error||t({value:{...this.props.value,starting:e.value}})})),l()(this,"handleUpdateEnd",(e=>{const{onUpdate:t}=this.props;e.error||t({value:{...this.props.value,ending:e.value}})})),l()(this,"handleStartSubmit",((e,t,i)=>{const{store:s,dayRangeStore:a}=this.stores;t&&t.error||(i===tr.Hv.StartDate&&s.state.showTime?s.setState({...s.state,focus:tr.Hv.StartTime}):(s.setState({...s.state,focus:tr.Hv.EndDate}),a.setState({...a.state,focus:"ending"})))})),l()(this,"handleEndSubmit",((e,t,i)=>{const{store:s}=this.stores;t&&t.error||i===tr.Hv.EndDate&&s.state.showTime&&s.setState({...s.state,focus:tr.Hv.EndTime})})),l()(this,"validateStart",(e=>{const t=this.validateField("starting",e);return t.error?t:{value:t.value.starting}})),l()(this,"validateEnd",(e=>{const t=this.validateField("ending",e);return t.error?t:{value:t.value.ending}})),l()(this,"validateField",((e,t)=>{const{value:i}=this.props;return t.error?t:this.validateRange({...i,[e]:t.value})})),l()(this,"validateRange",(e=>{if(e.starting&&e.ending){const t=M.OQ.dateTimeToMoment(e.starting);return M.OQ.dateTimeToMoment(e.ending).isSameOrAfter(t)?{value:e}:{error:zn.B.INVALID_RANGE}}return{value:e}})),l()(this,"getMenuProps",(()=>{const{device:e}=this.environment,{onDismiss:t,title:i}=this.props;if(e.isMobile){return{menuType:Re.ZP.MenuType.Modal,title:i,right:a()(Gn.DoneMenuText,{}),onClickRight:t,header:this.renderInputs()}}return{menuType:Re.ZP.MenuType.Popup,onClickOutside:t,footer:this.props.footer}})),l()(this,"validateDateRangeField",((e,t)=>{const{value:i}=this.props;if(t.error)return t;const s=Cn(i);return this.validateDateRange({...s,[e]:t.value})})),l()(this,"validateDateRange",(e=>{if(e.starting&&e.ending){const t=M.OQ.toMoment(e.starting);return M.OQ.toMoment(e.ending).isSameOrAfter(t)?{value:e}:{error:zn.B.INVALID_RANGE}}return{value:e}})),l()(this,"styles",{pickerSection:{paddingLeft:16,paddingRight:16},pickerSectionMobile:{paddingTop:16,paddingBottom:8},sidebar:{paddingTop:12,paddingBottom:24,overflowY:"auto",overflowX:"hidden",flex:"0 0 220px",backgroundColor:this.theme.sidebarSecondaryBackground,borderLeft:"1px solid ".concat(this.theme.regularDividerColor),maxWidth:"fit-content"},menuItem:{minHeight:void 0,paddingTop:this.environment.device.isMobile?12:4,paddingBottom:this.environment.device.isMobile?12:4,color:this.theme.mediumTextColor}})}didMount(){const{store:e}=this.stores;void 0!==this.props.showTime&&e.setState({...e.state,showTime:this.props.showTime})}renderComponent(){const{device:e}=this.environment;return c().createElement(Re.ZP,this.getMenuProps(),a()("div",{style:{display:"flex",flexDirection:"row"}},void 0,a()("div",{},void 0,!e.isMobile&&this.renderInputs(),this.renderCalendar()),this.renderSidebar()))}renderSidebar(){const{store:e}=this.stores,{onUpdate:t,value:i}=this.props;return a()("aside",{style:this.styles.sidebar},void 0,a()(er.Z,{title:a()(R.FormattedMessage,{id:"auditlogDateFilter.timeToggle",defaultMessage:"Use time",description:"Toggle to show or not show time in audit log date filter."}),on:e.state.showTime,onClick:()=>{if(e.toggleShowTime(),e.state.showTime){const e=i;e.starting&&(e.starting.start_time="00:00"),e.ending&&(e.ending.start_time="23:59"),t({value:e})}},focused:!1}),a()(_e.Z,{focused:!1,title:a()(R.FormattedMessage,{id:"auditlogDateFilter.quickFilters.today",defaultMessage:"Today"}),onClick:()=>{const e=Date.now(),t=M.CQ(e);this.setStoresTemporaryValue({starting:{...t,start_time:"00:00"},ending:t})},style:this.styles.menuItem}),a()(_e.Z,{focused:!1,title:a()(R.FormattedMessage,{id:"auditlogDateFilter.quickFilters.yesterday",defaultMessage:"Yesterday"}),onClick:()=>{const e=M.Cv();this.setStoresTemporaryValue({starting:{type:"datetime",start_date:e.start_date,start_time:"00:00",time_zone:M.x7},ending:{type:"datetime",start_date:e.start_date,start_time:"23:59",time_zone:M.x7}})},style:this.styles.menuItem}),a()(_e.Z,{focused:!1,title:a()(R.FormattedMessage,{id:"auditlogDateFilter.quickFilters.lastWeek",defaultMessage:"Last 7 days"}),onClick:()=>{const e=M.Oo(),t=M.CQ(Date.now());this.setStoresTemporaryValue({starting:{type:"datetime",start_date:e.start_date,start_time:"00:00",time_zone:M.x7},ending:t})},style:this.styles.menuItem}),a()(_e.Z,{focused:!1,title:a()(R.FormattedMessage,{id:"auditlogDateFilter.quickFilters.lastMonth",defaultMessage:"Last 30 days"}),onClick:()=>{const e=M.dj(),t=M.CQ(Date.now());this.setStoresTemporaryValue({starting:{type:"datetime",start_date:e.start_date,start_time:"00:00",time_zone:M.x7},ending:t})},style:this.styles.menuItem}))}setStoresTemporaryValue(e){const{store:t,dayRangeStore:i}=this.stores;t.setState({...t.state,temporary:e}),i.setState({...i.state,displayMonth:e.starting||e.ending?M.OQ.dateTimeToMoment(e.starting||e.ending):void 0,temporary:{starting:Zn(e.starting),ending:Zn(e.ending)}})}getRangeBounds(){const{value:e,intl:t}=this.props;return{earliestValidEnding:e.starting&&Tn(e.starting,t,M.M8),latestValidStarting:e.ending&&Tn(e.ending,t,M.M8)}}getThemeColors(){return{pickerSectionMobile:{background:this.theme.popoverBackground,boxShadow:"0 1px 0 ".concat(this.theme.regularDividerColor),marginBottom:1}}}}const ar=(0,R.injectIntl)(sr);var or=i(55662);class nr extends F.Z{constructor(...e){super(...e),l()(this,"storeTypes",{store:Un.ZP,dayRangeStore:qn.Z}),l()(this,"renderActiveButtonOrigin",(()=>{const{value:e,dateFormat:t,disabled:i,focused:s,intl:o}=this.props,n=this.styles,r=this.getThemeColors(),l={...n.menuItem,...r.activeMenuItem},d=Vn._Q(e,o,t),c=a()(On.Z,{onClick:this.handleClear,disabled:i});return a()(_e.Z,{focused:s,disabled:i,icon:se.Z.calendar(n.iconActiveDesktop),title:d,right:c,isTokenTitle:!0,alignIconTop:!0,onClick:this.handleOriginActivate,desktopTitleStyle:n.menuItemTitleDesktop,desktopIconStyle:n.iconActiveDesktopWrapper,style:l})})),l()(this,"renderInactiveButtonOrigin",(()=>{const{title:e,icon:t,disabled:i,focused:s,mode:o}=this.props,n=this.styles,r=this.getThemeColors(),l={...n.menuItem,...r.buttonMenuItem,...o===_n.Z.Mode.Pill?{width:"fit-content",border:"solid 1px",paddingLeft:0,paddingRight:0,borderRadius:20,fontSize:12}:{}};return a()(_e.Z,{focused:s,disabled:i,icon:t(n.icon),title:e,onClick:this.handleOriginActivate,style:l})})),l()(this,"renderPillButtonOrigin",(()=>{const{value:e}=this.props,t=a()(R.FormattedMessage,{id:"searchDateFilter.shortTitle",defaultMessage:"Date"});return a()(or.u8,{on:Boolean(e.starting||e.ending),icon:se.Z.calendar({width:16,marginRight:6}),title:a()("span",{},void 0,t),onClick:this.handleOriginActivate})})),l()(this,"renderPopupContents",(()=>{const{title:e,showButtons:t,sidebar:i}=this.props,{store:s,dayRangeStore:o}=this.stores;return c().createElement(c().Fragment,null,a()(ar,{title:e,value:this.getCurrentValue(),onUpdate:this.updateTemporary,store:s,dayRangeStore:o,onDismiss:this.handleMenuClose,footer:"footer"===t&&this.renderFooter(),sidebar:i}),"side"===t&&a()("div",{style:{display:"flex",justifyContent:"space-between",width:"100%",padding:"0px 10px"}},void 0,a()(Hi.Z,{isGray:!0,style:{marginLeft:"auto",marginRight:8},onClick:this.handleMenuClose},void 0,a()(R.FormattedMessage,{defaultMessage:"Cancel",id:"searchDateFilter.cancelButton.label"})),a()(j.Z,{onClick:()=>this.props.onChange(this.stores.store.state.temporary)},void 0,a()(R.FormattedMessage,{defaultMessage:"Accept",id:"searchDateFilter.acceptButton.label"}))))})),l()(this,"renderFooter",(()=>{const{store:e,dayRangeStore:t}=this.stores;return a()(Le.Z,{topBorder:!0,style:{padding:"8px 8px 2px 8px",justifyContent:"space-between",display:"flex"}},void 0,a()(Hi.Z,{onClick:()=>{e.setState({...e.state,temporary:{}}),t.setState({...t.state,temporary:{}}),this.props.onChange({})}},void 0,a()(R.FormattedMessage,{id:"searchDateFilter.clearButton",defaultMessage:"Clear"})),a()(j.Z,{onClick:e=>{this.props.onChange(this.stores.store.state.temporary),this.handleMenuClose(e)}},void 0,a()(R.FormattedMessage,{id:"searchDateFilter.applyButton",defaultMessage:"Apply"})))})),l()(this,"handleOriginActivate",(()=>{const{disabled:e}=this.props,{store:t,dayRangeStore:i}=this.stores;e||(t.setState({...t.state,isOpen:!0,focus:tr.Hv.StartDate}),i.setState({...i.state,isOpen:!0,focus:"starting"}))})),l()(this,"handleMenuClose",(e=>{const{onChange:t,onMenuDismiss:i,showButtons:s}=this.props,{store:a,dayRangeStore:o}=this.stores,{temporary:n}=a.state;Vn.zD(e)||(s||t(n),a.setState({...a.state,isOpen:!1,temporary:{}}),o.setState({...o.state,isOpen:!1,temporary:{}}),i&&i())})),l()(this,"handleClear",(()=>{const{onChange:e}=this.props;e({starting:void 0,ending:void 0})})),l()(this,"handleMenuListKey",(e=>{e.preventDefault&&e.preventDefault()})),l()(this,"updateTemporary",(e=>{const{store:t,dayRangeStore:i}=this.stores;if(e.error)return;const s={starting:Zn(e.value.starting),ending:Zn(e.value.ending)};return i.setState({...i.state,temporary:{...i.state.temporary,...s}}),t.setState({...t.state,temporary:{...t.state.temporary,...e.value}})})),l()(this,"styles",{menuItem:{minHeight:void 0,paddingTop:this.environment.device.isMobile?12:4,paddingBottom:this.environment.device.isMobile?12:4},icon:{height:16,width:16,marginRight:6},iconActiveDesktop:{height:14,width:14,fill:"currentColor",alignSelf:"flex-start",marginTop:2,marginRight:2},iconActiveDesktopWrapper:{marginTop:0},iconActiveMobile:{height:14,width:14,fill:"currentColor",marginTop:1,marginRight:6},popup:{paddingTop:0,paddingBottom:8},popupWithSidebar:{display:"flex"},menuItemTitleDesktop:{width:"100%"},summary:{display:"inline-flex"}})}didMount(){this.updateTemporary({value:this.props.value})}renderComponent(){const{device:e}=this.environment,{mode:t}=this.props;return e.isMobile?this.renderMobile(t):this.renderDesktop(t)}renderDesktop(e){const{title:t,sidebar:i}=this.props,{store:s}=this.stores,o=this.styles,n=e===_n.z.Section,r=n?t:void 0,l=(()=>e===_n.Z.Mode.Section?this.renderActiveButtonOrigin():e===_n.Z.Mode.Button?this.renderInactiveButtonOrigin():e===_n.Z.Mode.Pill?this.renderPillButtonOrigin():void(0,vi.t1)(e))();return a()(Wn.Z,{title:r,marginAfter:n},void 0,a()(Ln.Z,{capture:s.state.isOpen,onUp:this.handleMenuListKey,onDown:this.handleMenuListKey,onEnter:this.handleMenuListKey},void 0,a()(Ee.ZP,{popupType:this.getPopupType(),open:s.state.isOpen,origin:l,render:this.renderPopupContents,onDismiss:this.handleMenuClose,placementToOrigin:Ee.ZP.Placement.Bottom,alignmentToOrigin:Ee.ZP.Alignment.Start,style:i?o.popupWithSidebar:o.popup})))}renderMobile(e){const{store:t}=this.stores,i=e===_n.z.Section?this.renderMobileFilterSummary():this.renderMobileButtonOrigin();return a()(Ee.ZP,{popupType:Ee.ZP.PopupType.SlideUp,open:t.state.isOpen,origin:i,render:this.renderPopupContents,onDismiss:this.handleMenuClose,preventScaleTransition:!0})}renderMobileButtonOrigin(){const{icon:e,title:t,disabled:i}=this.props,s=this.styles;return a()(_e.Z,{disabled:i,focused:!1,icon:e(s.icon),title:t,onClick:this.handleOriginActivate})}renderMobileFilterSummary(){const{title:e,value:t,dateFormat:i,disabled:s,intl:o}=this.props,n=this.styles,r=a()("div",{style:n.summary},void 0,se.Z.calendar(n.iconActiveMobile),Vn._Q(t,o,i));return a()(Nn.Z,{disabled:s,onClick:this.handleOriginActivate,onClickClear:this.handleClear,label:e,title:r})}getCurrentValue(){const{value:e}=this.props,{store:t}=this.stores,{temporary:i}=t.state;return{...e,...i}}getPopupType(){const{device:e}=this.environment;return e.isMobile?$s.Z.PopupType.SlideUp:$s.Z.PopupType.Popup}getThemeColors(){return{buttonMenuItem:{color:this.theme.mediumTextColor},activeMenuItem:{color:this.theme.regularTextColor}}}}const rr=(0,R.injectIntl)(nr);class lr extends y.Z{getInitialState(){return{tempSelections:new Set([])}}setTempSelections(e){this.setState({tempSelections:new Set(e)})}}class dr extends F.Z{constructor(...e){super(...e),l()(this,"storeTypes",{localStore:lr}),l()(this,"renderResultMenuItem",((e,t)=>{const{localStore:i}=this.stores,s=this.getActorValue(e);return c().createElement(ko.Z,n()({},t,{key:e,user:s,checkState:i.state.tempSelections.has(e)}))})),l()(this,"performRequest",(async({query:e})=>{const t=await Ye.CO({environment:this.environment,query:e,membersOnly:!1});return[...t.users.map((e=>"notion_user:".concat(e.id))),...t.bots.map((e=>"bot:".concat(e.id)))].slice(0,100)})),l()(this,"getActorValue",(e=>{const t=kn(e);if(t)return"notion_user"===t.actorType?this.createUserValue(t.actorId):this.createBotValue(t.actorId)})),l()(this,"createUserValue",(e=>St.Z.createChildStore(this.props.parentStore,{table:Ct.KJ,id:e}).getValue())),l()(this,"createBotValue",(e=>(0,Es.Kv)(this.props.parentStore,{table:Rs.c,id:e}).getValue()))}didMount(){this.updateTempSelectionFromProps()}renderComponent(){const{selectedActors:e,intl:t}=this.props,{localStore:i}=this.stores,s=a()(R.FormattedMessage,{id:"auditlogActorFilter.title",defaultMessage:"User",description:"The title of the actor filter in the pill mode"});return a()(_n.Z,{mode:_n.z.Pill,title:s,icon:se.Z.person,items:Array.from(i.state.tempSelections),hasItemsSelected:(null==e?void 0:e.length)>0,onChange:e=>{i.setTempSelections(e)},renderFooter:!0,allowApplyBatchSelection:!0,onMenuDismiss:e=>{"applyButton"!==e?this.updateTempSelectionFromProps():this.updateOnChangeToParent()},labelText:{title:s,tokenInputPlaceholder:t.formatMessage({defaultMessage:"Search user...",id:"auditlogActorFilter.searchActor.placeholder",description:"The placeholder in the input for search an actor in audit log filter"}),resultSectionTitle:t.formatMessage({defaultMessage:"Select users",id:"auditlogActorFilter.searchActor.resultsTitle",description:"The text shown above the list of all selectable actors in audit log filter"}),componentDebugName:"SearchActorFilter"},performRequest:this.performRequest,renderResultMenuItem:this.renderResultMenuItem,renderToken:()=>null,renderFilter:()=>null,renderItemForSummary:()=>null,addItemLabel:null,focused:!1})}updateOnChangeToParent(){const{onChange:e}=this.props,{localStore:t}=this.stores;e(Array.from(t.state.tempSelections).map(kn).filter((e=>Boolean(e))))}updateTempSelectionFromProps(){const{selectedActors:e}=this.props,{localStore:t}=this.stores,i=e.map(wn);t.setTempSelections(i)}}const cr=(0,R.injectIntl)(dr);var ur=i(29798);let mr,pr;!function(e){e.Page="Page",e.Workspace="Workspace",e.Account="Account"}(mr||(mr={})),function(e){e.All="All",e.Partial="Partial",e.None="None"}(pr||(pr={}));class gr extends y.Z{getInitialState(){return{categorySelections:{[mr.Page]:pr.All,[mr.Workspace]:pr.All,[mr.Account]:pr.All},actionSelections:{page_viewed:!0,page_created:!0,page_deleted:!0,page_restored:!0,page_exported:!0,page_moved:!0,page_permission_updated:!0,password_set:!0,password_cleared:!0,password_changed:!0,login:!0,logout:!0,member_invited:!0,member_role_updated:!0,member_removed:!0,guest_removed:!0,email_changed:!0,user_deleted:!0,member_joined:!0,picture_changed:!0,file_uploaded:!0},isMenuOpen:!1,renderOrder:[{category:mr.Page,orderedActions:["page_viewed","page_created","page_deleted","page_restored","page_exported","page_moved","page_permission_updated","file_uploaded"]},{category:mr.Workspace,orderedActions:["member_invited","member_joined","member_role_updated","member_removed","guest_removed"]},{category:mr.Account,orderedActions:["login","logout","password_set","password_cleared","password_changed","email_changed","picture_changed","user_deleted"]}]}}getAllActionNames(){return(0,vi.Yd)(this.state.actionSelections)}getSelectedActionNames(){return this.getAllActionNames().filter((e=>this.state.actionSelections[e]))}hasActionNameSelected(){const e=this.getAllActionNames(),t=this.getSelectedActionNames();return t.length>0&&t.length!==e.length}toggleCategorySelection(e){const t=e.category,i=this.state.categorySelections[t],s=i===pr.None||i===pr.Partial?pr.All:pr.None,a=s===pr.All,o={...this.state.actionSelections},n=this.state.renderOrder.find((e=>e.category===t));n&&(n.orderedActions.forEach((e=>{o[e]=a})),this.setState({...this.state,actionSelections:o,categorySelections:{...this.state.categorySelections,[n.category]:s}}))}toggleActionNameSelection(e,t){const i=this.state.actionSelections[e],s={...this.state.actionSelections,[e]:!i},a=t.orderedActions.filter((e=>s[e])).length,o=0===a?pr.None:a===t.orderedActions.length?pr.All:pr.Partial;this.setState({...this.state,actionSelections:s,categorySelections:{...this.state.categorySelections,[t.category]:o}})}clearAllSelections(){const e=this.getBulkUpdateNextActionSelectionState((0,vi.Yd)(this.state.actionSelections),!1),t=this.getBulkUpdateNextCategorySelectionState((0,vi.Yd)(this.state.categorySelections),pr.None);this.setState({...this.state,actionSelections:e,categorySelections:t})}getBulkUpdateNextCategorySelectionState(e,t){const i={...this.state.categorySelections};return e.forEach((e=>{i[e]=t})),i}getBulkUpdateNextActionSelectionState(e,t){const i={...this.state.actionSelections};return e.forEach((e=>{i[e]=t})),i}}class hr extends F.Z{constructor(...e){super(...e),l()(this,"storeTypes",{componentStore:gr,lastSelectionStore:gr,menuListStore:ur.Z}),l()(this,"renderMenu",(()=>{const{componentStore:e,menuListStore:t}=this.stores,i=[];e.state.renderOrder.forEach((e=>{i.push(this.renderCategoryMenu(e)),e.orderedActions.forEach((t=>{i.push(this.renderActionNameMenu(t,e))}))}));const s={key:"results",items:i,render:e=>c().createElement(Le.Z,n()({},e,{title:null,loading:!1}))};return c().createElement(c().Fragment,null,a()(Re.ZP,{menuType:Re.ZP.MenuType.Popup,header:null,width:250,maxHeight:356},void 0,a()(De.Z,{type:De.Z.Type.Vertical,store:t,initialFocus:0,sections:[s]})),a()(Le.Z,{topBorder:!0,style:{padding:"8px 8px 2px 8px",justifyContent:"space-between",display:"flex"}},void 0,a()(Hi.Z,{onClick:()=>{this.handleClear()}},void 0,a()(R.FormattedMessage,{id:"auditlogEventFilter.clearButton",defaultMessage:"Clear"})),a()(j.Z,{onClick:()=>{this.handleApply()}},void 0,a()(R.FormattedMessage,{id:"auditlogEventFilter.applyButton",defaultMessage:"Apply"}))))})),l()(this,"renderPillButtonOrigin",(e=>{const{componentStore:t}=this.stores,i=t.hasActionNameSelected();return a()(or.u8,{on:i,icon:se.Z.bot({width:16,marginRight:6}),title:a()("span",{},void 0,e),onClick:()=>{this.setMenuOpen(!0)}})})),l()(this,"setMenuOpen",(e=>{const{componentStore:t}=this.stores;t.setState({...t.state,isMenuOpen:e})})),l()(this,"styles",{menu:{width:250,maxHeight:"40vh"},menuItem:{width:"fit-content",border:"solid 1px",borderColor:this.theme.outlineButtonBorder,paddingLeft:0,paddingRight:0,borderRadius:20,fontSize:12},icon:{height:14,width:14,fill:"currentColor"},popup:{paddingTop:8,paddingBottom:8}})}renderComponent(){const{componentStore:e}=this.stores,t=this.styles,i=a()(R.FormattedMessage,{id:"auditlogEventFilter.title",defaultMessage:"Event",description:"The title of the event filter in the pill mode"}),s=this.renderPillButtonOrigin(i);return a()(Wn.Z,{marginAfter:!1},void 0,a()(Ee.ZP,{popupType:Ee.ZP.PopupType.Popup,placementToOrigin:Ee.ZP.Placement.Bottom,alignmentToOrigin:Ee.ZP.Alignment.Start,open:e.state.isMenuOpen,render:this.renderMenu,onDismiss:()=>{this.handleMenuCloseFromOutside()},keepFocus:!0,origin:s,preventScaleTransition:!0,style:t.popup}))}renderCategoryMenu(e){const{intl:t}=this.props,{componentStore:i}=this.stores,s=e.category,o=()=>{i.toggleCategorySelection(e)};return{key:s,action:o,render:e=>c().createElement(_e.Z,n()({},e,{icon:a()(Ai.Z,{checked:i.state.categorySelections[s]===pr.All,size:16,onClick:o}),focused:!1,title:t.formatMessage(fr[s]),className:"notranslate"}))}}renderActionNameMenu(e,t){const{intl:i}=this.props,{componentStore:s}=this.stores,o=()=>{s.toggleActionNameSelection(e,t)};return{key:e,action:o,render:t=>c().createElement(_e.Z,n()({},t,{icon:a()(Ai.Z,{checked:s.state.actionSelections[e],size:16,onClick:o}),focused:!1,title:i.formatMessage(vr[e]),className:"notranslate",style:{paddingLeft:20}}))}}handleMenuCloseFromOutside(){const{componentStore:e,lastSelectionStore:t}=this.stores;e.setState({...e.state,actionSelections:{...t.state.actionSelections},categorySelections:{...t.state.categorySelections}}),this.setMenuOpen(!1)}handleClear(){const{componentStore:e}=this.stores;e.clearAllSelections()}handleApply(){const{onChange:e}=this.props,{componentStore:t,lastSelectionStore:i}=this.stores,s=t.getAllActionNames(),a=t.getSelectedActionNames();e(s.length===a.length?[]:a),0===a.length&&t.reset(),i.setState({...i.state,actionSelections:{...t.state.actionSelections},categorySelections:{...t.state.categorySelections}}),this.setMenuOpen(!1)}}const fr=(0,R.defineMessages)({[mr.Page]:{id:"auditlogEventFilter.categoryName.page",defaultMessage:"Page",description:"audit log action category - page"},[mr.Workspace]:{id:"auditlogEventFilter.categoryName.workspace",defaultMessage:"Workspace",description:"audit log action category - workspace"},[mr.Account]:{id:"auditlogEventFilter.categoryName.account",defaultMessage:"Account",description:"audit log action category - account"}}),vr=(0,R.defineMessages)({page_viewed:{id:"auditlogEventFilter.actionName.page_viewed",defaultMessage:"Page viewed",description:"An audit log that describe a user viewed a page"},page_created:{id:"auditlogEventFilter.actionName.page_created",defaultMessage:"Page created",description:"An audit log that describe a user created a page"},page_deleted:{id:"auditlogEventFilter.actionName.page_deleted",defaultMessage:"Page deleted",description:"An audit log that describe a user deleted a page"},page_restored:{id:"auditlogEventFilter.actionName.page_restored",defaultMessage:"Page restored",description:"An audit log that describe a user restored a deleted page"},page_exported:{id:"auditlogEventFilter.actionName.page_exported",defaultMessage:"Page exported",description:"An audit log that describe a user exported a page"},page_moved:{id:"auditlogEventFilter.actionName.page_moved",defaultMessage:"Page moved",description:"An audit log that describe a user moved a page"},page_permission_updated:{id:"auditlogEventFilter.actionName.page_permission_updated",defaultMessage:"Page permission updated",description:"An audit log that describe a page's permission has been changed. It means members, guests, bots can be added, removed, or changed role for this page"},password_set:{id:"auditlogEventFilter.actionName.password_set",defaultMessage:"Password set",description:"An audit log that describe a user set their password"},password_cleared:{id:"auditlogEventFilter.actionName.password_cleared",defaultMessage:"Password cleared",description:"An audit log that describe a user cleared their password"},password_changed:{id:"auditlogEventFilter.actionName.password_changed",defaultMessage:"Password changed",description:"An audit log that describe a user changed their password"},login:{id:"auditlogEventFilter.actionName.login",defaultMessage:"Login",description:"An audit log that describe a user logs in"},logout:{id:"auditlogEventFilter.actionName.logout",defaultMessage:"Logout",description:"An audit log that describe a user logs out"},member_invited:{id:"auditlogEventFilter.actionName.member_invited",defaultMessage:"Member invited",description:"An audit log that describe a user is invited to the workspace"},member_joined:{id:"auditlogEventFilter.actionName.member_joined",defaultMessage:"Member joined",description:"An audit log that describe a member has joined the workspace"},member_role_updated:{id:"auditlogEventFilter.actionName.member_role_updated",defaultMessage:"Member role updated",description:"An audit log that describe a member is updated with a role"},member_removed:{id:"auditlogEventFilter.actionName.member_removed",defaultMessage:"Member removed",description:"An audit log that describe a member is removed access from the space"},guest_removed:{id:"auditlogEventFilter.actionName.guest_removed",defaultMessage:"Guest removed",description:"An audit log that describe a guest is removed access from the space"},user_deleted:{id:"auditlogEventFilter.actionName.user_deleted",defaultMessage:"User deleted",description:"An audit log that describe a user is deleted"},email_changed:{id:"auditlogEventFilter.actionName.email_changed",defaultMessage:"Email changed",description:"An audit log that describe a user changed their email"},picture_changed:{id:"auditlogEventFilter.actionName.picture_changed",defaultMessage:"Picture changed",description:"An audit log that describe a user changed their picture"},file_uploaded:{id:"auditlogEventFilter.actionName.file_uploaded",defaultMessage:"File uploaded",description:"An audit log that describe a file is uploaded by a user"}}),yr=(0,R.injectIntl)(hr);const Mr=(0,R.injectIntl)((function(e){const{spaceStore:t}=e,[i,s]=(0,We.oR)(Pn);return a()("div",{style:{display:"flex",flexDirection:"row",paddingTop:12,paddingBottom:12,width:"100%",gap:4}},void 0,a()(rr,{mode:_n.z.Pill,focused:!1,title:a()(R.FormattedMessage,{id:"auditlogDateFilter.title",defaultMessage:"Date"}),icon:se.Z.calendar,value:i.timeRange,showButtons:"footer",onChange:e=>{s({...i,timeRange:e,pageNum:1})}}),a()(cr,{parentStore:t,selectedActors:i.actors,onChange:e=>{s({...i,actors:e,pageNum:1})}}),a()(yr,{parentStore:t,selectedEvents:i.actions,onChange:e=>{s({...i,actions:e,pageNum:1})}}))}));function Sr(e){const{paragraphs:t}=e,i=(0,qe.y)((e=>({skeletonRect:{borderRadius:3,backgroundColor:e.lightDividerColor}})),[]),s=null==t?void 0:t.map((e=>{const t={height:e.lineHeight,marginTop:e.lineMargin,marginBottom:e.lineMargin},s={marginTop:e.sectionMargin,marginBottom:e.sectionMargin},o=[...Array(e.repeat||1)].map((o=>a()("div",{style:{...s}},void 0,e.sectionWidths.map((e=>a()("div",{className:zs.MD,style:{...i.skeletonRect,...t,width:"".concat(e,"%")}}))))));return c().createElement(c().Fragment,null," ",o," ")}));return c().createElement(c().Fragment,null," ",s," ")}const br=function(){return a()("div",{style:{}},void 0,a()(Sr,{paragraphs:[{lineHeight:45,lineMargin:20,sectionWidths:[100],repeat:1,sectionMargin:15},{lineHeight:40,lineMargin:5,sectionWidths:[100],repeat:8,sectionMargin:10}]}))};var Tr=i(21752);function Cr(e){const{auditLogEntry:t,actorStore:i,id:s}=e,[o]=(0,We.oR)(i);if(o.ready&&o.value){const e=i.pointer.table;if(e===Ct.KJ)return a()(Tr.Z,{id:s,userValue:o.value});if(e===Rs.c)return a()(Tr.Z,{id:s,userValue:{id:t.actor.actorId,version:1,email:t.actor.actorId,name:o.value.name}})}return a()(Tr.Z,{id:s,userValue:{id:t.actor.actorId,version:1,email:"Loading"}})}var Zr=i(19757);function wr(e){const{auditLogEntry:t,id:i}=e;return a()(ct.Z,{renderTooltip:()=>a()("div",{style:{display:"flex",flexDirection:"column",fontVariantNumeric:"tabular-nums"}},void 0,a()("div",{},void 0,(0,ba.default)(t.serverTimestamp).tz(M.x7).format("z: YYYY/MM/DD hh:mm A")),a()("div",{},void 0,a()(R.FormattedMessage,{id:"auditLogSettings.timeTooltip.utcTime",defaultMessage:"UTC: {time}",description:"Tooltip for UTC time on hover in the audit log.",values:{time:(0,ba.default)(t.serverTimestamp).tz("UTC").format("YYYY/MM/DD hh:mm A")}}))),render:e=>a()("div",{id:i},void 0,c().createElement(J.Z,n()({isSecondaryColor:!0},e),(0,ba.default)(t.serverTimestamp).format("YYYY/MM/DD hh:mm A"))),placement:Zr.ug.Bottom})}var kr=i(64875);function Ar(e){var t;return"workspace"!==(null===(t=e.meta)||void 0===t?void 0:t.permissionLevel)}const Pr=(0,R.defineMessages)({picture_changed:{id:"auditlog.actionNames.eventColumn.picture_changed",defaultMessage:"Changed profile picture",description:"Changed picture event for audit log"},password_cleared:{id:"auditlog.actionNames.eventColumn.password_cleared",defaultMessage:"Cleared login password",description:"Password cleared event for audit log"},password_set:{id:"auditlog.actionNames.eventColumn.password_set",defaultMessage:"Created a login password",description:"Password set event for audit log"},password_changed:{id:"auditlog.actionNames.eventColumn.password_changed",defaultMessage:"Changed login password",description:"Password change event for audit log"},logout:{id:"auditlog.actionNames.eventColumn.logout",defaultMessage:"Logged out",description:"Logout picture event for audit log"},user_deleted:{id:"auditlog.actionNames.eventColumn.user_deleted",defaultMessage:"User was deleted",description:"User deleted event for audit log"},member_joined:{id:"auditlog.actionNames.eventColumn.member_joined",defaultMessage:"Joined the workspace",description:"Member joined event for audit log"},file_uploaded:{id:"auditlog.actionNames.eventColumn.file_uploaded",defaultMessage:"Uploaded a file",description:"File uploaded event for audit log"}});function Ir(e){return"user"in e.target&&e.target.user?e.target.user.name?"“".concat(e.target.user.name,"“"):e.target.user.email?"“".concat(e.target.user.email,"“"):"user":"bot"in e.target&&e.target.bot?e.target.bot.name?"“".concat(e.target.bot.name,"“"):"bot":void 0}function xr(e){return c().createElement(R.FormattedMessage,function(e){if(!e)return Qs.mq.noAccessLabel;switch(e){case"editor":return Qs.mq.fullAccessLabel;case"read_and_write":return Qs.mq.canEditLabel;case"content_only_editor":return Qs.mq.canEditContentLabel;case"reader":return Qs.mq.canReadLabel;case"comment_only":return Qs.mq.canCommentLabel;case"none":return Qs.mq.noAccessLabel;default:(0,vi.t1)(e)}}(e))}function Fr(e){var t,i,s,a;return{oldRole:c().createElement(R.FormattedMessage,Br(null===(t=e.changes)||void 0===t||null===(i=t.permission)||void 0===i?void 0:i.oldValue)),newRole:c().createElement(R.FormattedMessage,Br(null===(s=e.changes)||void 0===s||null===(a=s.permission)||void 0===a?void 0:a.newValue))}}const Br=e=>{if(!e)return Qs.mq.noAccessLabel;switch(e){case"editor":return Qs.mq.adminLabel;case"read_and_write":return Qs.mq.memberLabel;default:return Qs.mq.noAccessLabel}};function Er(e){var t,i,s,o,n;const{auditLogEntry:r}=e;switch(r.actionName){case"page_viewed":return Ar(r.target.page)?a()(R.FormattedMessage,{defaultMessage:"Viewed a private page",id:"auditlog.actionNames.eventColumn.page_viewed_private",description:"Viewed private page event for audit log"}):a()(R.FormattedMessage,{defaultMessage:"Viewed “{pageName}”",id:"auditlog.actionNames.eventColumn.page_viewed_under",description:"Viewed page event for audit log",values:{pageName:r.target.page.title}});case"page_deleted":return r.target.page.meta.permanentDeletion?Ar(r.target.page)?a()(R.FormattedMessage,{defaultMessage:"Permanently deleted a private page",id:"auditlog.actionNames.eventColumn.page_permanently_deleted_private",description:"Permanently deleted private page event for audit log"}):a()(R.FormattedMessage,{defaultMessage:"Permanently deleted “{pageName}”",id:"auditlog.actionNames.eventColumn.page_permanently_deleted",description:"Permanently deleted page event for audit log",values:{pageName:r.target.page.title}}):Ar(r.target.page)?a()(R.FormattedMessage,{defaultMessage:"Deleted a private page",id:"auditlog.actionNames.eventColumn.page_deleted_private",description:"Deleted private page event for audit log"}):a()(R.FormattedMessage,{defaultMessage:"Deleted “{pageName}”",id:"auditlog.actionNames.eventColumn.page_deleted",description:"Deleted page event for audit log",values:{pageName:r.target.page.title}});case"page_restored":return Ar(r.target.page)?a()(R.FormattedMessage,{defaultMessage:"Restored a private page",id:"auditlog.actionNames.eventColumn.page_restored_private",description:"Restored private page event for audit log"}):a()(R.FormattedMessage,{defaultMessage:'Restored "{pageName}"',id:"auditlog.actionNames.eventColumn.page_restored",description:"Restored page event for audit log",values:{pageName:r.target.page.title}});case"page_exported":return Ar(r.target.page)?a()(R.FormattedMessage,{defaultMessage:"Exported a private page",id:"auditlog.actionNames.eventColumn.page_exported_private",description:"Exported private page event for audit log"}):a()(R.FormattedMessage,{defaultMessage:'Exported "{pageName}"',id:"auditlog.actionNames.eventColumn.page_exported",description:"Exported page event for audit log",values:{pageName:r.target.page.title}});case"page_moved":return Ar(r.target.page)?a()(R.FormattedMessage,{defaultMessage:"Moved a private page",id:"auditlog.actionNames.eventColumn.page_moved_private",description:"Moved private page event for audit log"}):a()(R.FormattedMessage,{defaultMessage:'Moved "{pageName}"',id:"auditlog.actionNames.eventColumn.page_moved",description:"Moved page event for audit log",values:{pageName:r.target.page.title}});case"page_permission_updated":return function(e){var t,i,s,o,n;const r=Ar(e.target.page),l="bot"in e.target,d="user"in e.target&&"guest"===(null===(t=e.target.user.meta)||void 0===t?void 0:t.spaceRole);if(r){var c,u,m,p,g,h,f,v,y,M,S,b;return a()(R.FormattedMessage,l?{defaultMessage:"Updated permissions of a private page for bot {botName} from <f>{oldRole}</f> to <f>{newRole}</f>",id:"auditlog.actionNames.eventColumn.page_permissions_updated_private_bot",description:"An audit log that describe a page's permission has been changed. It means members, guests, bots can be added, removed, or changed role for this page",values:{botName:Ir(e),oldRole:xr(null===(g=e.changes)||void 0===g||null===(h=g.permission)||void 0===h?void 0:h.oldValue),newRole:xr(null===(f=e.changes)||void 0===f||null===(v=f.permission)||void 0===v?void 0:v.newValue),f:(...e)=>a()("span",{},void 0,e)}}:d?{defaultMessage:"Updated permissions of a private page for guest {guestNameOrEmail} from <f>{oldRole}</f> to <f>{newRole}</f>",id:"auditlog.actionNames.eventColumn.page_permissions_updated_private_guest",description:"An audit log that describe a page's permission has been changed. It means members, guests, bots can be added, removed, or changed role for this page",values:{guestNameOrEmail:Ir(e),oldRole:xr(null===(y=e.changes)||void 0===y||null===(M=y.permission)||void 0===M?void 0:M.oldValue),newRole:xr(null===(S=e.changes)||void 0===S||null===(b=S.permission)||void 0===b?void 0:b.newValue),f:(...e)=>a()("span",{},void 0,e)}}:{defaultMessage:"Updated permissions of a private page for {memberNameOrEmail} from <f>{oldRole}</f> to <f>{newRole}</f>",id:"auditlog.actionNames.eventColumn.page_permissions_updated_private_default",description:"An audit log that describe a page's permission has been changed. It means members, guests, bots can be added, removed, or changed role for this page",values:{memberNameOrEmail:Ir(e),oldRole:xr(null===(c=e.changes)||void 0===c||null===(u=c.permission)||void 0===u?void 0:u.oldValue),newRole:xr(null===(m=e.changes)||void 0===m||null===(p=m.permission)||void 0===p?void 0:p.newValue),f:(...e)=>a()("span",{},void 0,e)}})}var T,C,Z,w;if(l)return a()(R.FormattedMessage,{defaultMessage:"Updated permissions of {pageName} for bot {botName} from <f>{oldRole}</f> to <f>{newRole}</f>",id:"auditlog.actionNames.eventColumn.page_permissions_updated_workspace_bot",description:"An audit log that describe a page's permission has been changed. It means members, guests, bots can be added, removed, or changed role for this page",values:{botName:Ir(e),oldRole:xr(null===(T=e.changes)||void 0===T||null===(C=T.permission)||void 0===C?void 0:C.oldValue),newRole:xr(null===(Z=e.changes)||void 0===Z||null===(w=Z.permission)||void 0===w?void 0:w.newValue),pageName:e.target.page.title,f:(...e)=>a()("span",{},void 0,e)}});var k,A,P,I;if(d)return a()(R.FormattedMessage,{defaultMessage:"Updated permissions of {pageName} for guest {guestNameOrEmail} from <f>{oldRole}</f> to <f>{newRole}</f>",id:"auditlog.actionNames.eventColumn.page_permissions_updated_workspace_guest",description:"An audit log that describe a page's permission has been changed. It means members, guests, bots can be added, removed, or changed role for this page",values:{guestNameOrEmail:Ir(e),oldRole:xr(null===(k=e.changes)||void 0===k||null===(A=k.permission)||void 0===A?void 0:A.oldValue),newRole:xr(null===(P=e.changes)||void 0===P||null===(I=P.permission)||void 0===I?void 0:I.newValue),pageName:e.target.page.title,f:(...e)=>a()("span",{},void 0,e)}});return a()(R.FormattedMessage,{defaultMessage:"Updated permissions of {pageName} for {memberNameOrEmail} from <f>{oldRole}</f> to <f>{newRole}</f>",id:"auditlog.actionNames.eventColumn.page_permissions_updated_workspace_default",description:"An audit log that describe a page's permission has been changed. It means members, guests, bots can be added, removed, or changed role for this page",values:{memberNameOrEmail:Ir(e),oldRole:xr(null===(i=e.changes)||void 0===i||null===(s=i.permission)||void 0===s?void 0:s.oldValue),newRole:xr(null===(o=e.changes)||void 0===o||null===(n=o.permission)||void 0===n?void 0:n.newValue),pageName:e.target.page.title,f:(...e)=>a()("span",{},void 0,e)}})}(r);case"page_created":if("workspace"!==(null===(t=r.target.page.meta)||void 0===t?void 0:t.permissionLevel))return a()(R.FormattedMessage,{defaultMessage:"Created a private page",description:"Created private page event for audit log",id:"auditlog.actionNames.eventColumn.page_created_private"});if(null!==(i=r.target.page)&&void 0!==i&&null!==(s=i.meta)&&void 0!==s&&s.parent){if(r.target.page.meta.parent.table===ta.bx)return a()(R.FormattedMessage,{defaultMessage:"Created a page in the workspace",description:"Created page event for audit log",id:"auditlog.actionNames.eventColumn.page_created_workspace"});if(r.target.page.meta.parent.title)return a()(R.FormattedMessage,{defaultMessage:'Created a page under "{parentPageName}"',description:"Created page event for audit log",id:"auditlog.actionNames.eventColumn.page_created_under",values:{parentPageName:r.target.page.meta.parent.title}})}return a()(R.FormattedMessage,{defaultMessage:"Created a page",description:"Created page (audit log)",id:"auditlog.actionNames.eventColumn.page_created_general"});case"login":return null!==(o=r.actor.meta)&&void 0!==o&&o.geolocation&&null!==(n=r.actor.meta)&&void 0!==n&&n.platform?a()(R.FormattedMessage,{id:"auditLog.actionNames.eventColumn.loginWithMetadata",defaultMessage:"Logged in on {platform} in {city}",description:"Login event for audit log with additional metadata (platform is device i.e. web, mobile)",values:{platform:r.actor.meta.platform,city:r.actor.meta.geolocation}}):a()(R.FormattedMessage,{id:"auditLog.actionNames.eventColumn.login",defaultMessage:"Logged in",description:"Login event for audit log"});case"email_changed":return a()(R.FormattedMessage,{defaultMessage:"Changed email from {oldEmail} to {newEmail}",id:"auditlog.actionNames.eventColumn.email_changed",description:"Email changed event for audit log",values:{oldEmail:r.changes.email.oldValue,newEmail:r.changes.email.newValue}});case"member_invited":{const e=Fr(r);return a()(R.FormattedMessage,{defaultMessage:"{memberNameOrEmail} invited to the workspace as <f>{newRole}</f>",id:"auditlog.actionNames.eventColumn.member_invited",description:"An audit log that describe a user is invited to the workspace",values:{memberNameOrEmail:Ir(r),newRole:e.newRole,f:(...e)=>a()("span",{},void 0,e)}})}case"member_role_updated":{const e=Fr(r);return a()(R.FormattedMessage,{defaultMessage:"Updated {memberNameOrEmail} from <f>{oldRole}</f> to <f>{newRole}</f>",id:"auditlog.actionNames.eventColumn.member_role_updated",description:"An audit log that describe a member is updated with a role",values:{memberNameOrEmail:Ir(r),oldRole:e.oldRole,newRole:e.newRole,f:(...e)=>a()("span",{},void 0,e)}})}case"member_removed":return a()(R.FormattedMessage,{defaultMessage:"Removed {memberNameOrEmail} from the workspace",id:"auditlog.actionNames.eventColumn.member_removed",description:"An audit log that describe a member is removed access from the space",values:{memberNameOrEmail:Ir(r)}});case"guest_removed":return a()(R.FormattedMessage,{defaultMessage:"Removed guest {guestNameOrEmail} from the workspace",id:"auditlog.actionNames.eventColumn.guest_removed",description:"An audit log that describe a guest is removed access from the space",values:{guestNameOrEmail:Ir(r)}});case"file_uploaded":return Ar(r.target.page)?a()(R.FormattedMessage,{defaultMessage:"Uploaded a file to a private page",id:"auditlog.actionNames.eventColumn.file_uploaded_private",description:"Uploaded a file to a private page event for audit log"}):a()(R.FormattedMessage,{defaultMessage:'Uploaded a file to "{pageName}"',id:"auditlog.actionNames.eventColumn.file_uploaded",description:"Uploaded a file to a non-private page event for audit log",values:{pageName:r.target.page.title}});case"logout":case"password_changed":case"password_cleared":case"password_set":case"picture_changed":case"user_deleted":case"member_joined":return c().createElement(R.FormattedMessage,Pr[r.actionName]);default:if("local"!==D.default.env)return kr.log({level:"error",from:"auditLogEvent",type:"AuditLogGeneralEvent",data:{miscDataToConvertToString:{data:r}}}),c().createElement(c().Fragment,null);(0,vi.t1)(r)}}function Rr(e){const{auditLogEntry:t,id:i}=e,[s,o]=(0,d.useState)("");(0,d.useEffect)((()=>{const e=document.getElementById(i);o((null==e?void 0:e.textContent)||"")}),[i]);const r=s.length<=40;return a()(ct.Z,{disableTooltip:r&&"login"!==t.actionName,style:{whiteSpace:"normal"},delayThreshold:80,renderTooltip:()=>a()(Dr,{text:s,auditLogEntry:t}),placement:ct.Z.Placement.Bottom,render:e=>c().createElement("div",n()({},e,{style:{fontSize:14,...re.Z.textOverflowStyle},id:i}),a()(Er,{auditLogEntry:t}))})}function Dr(e){var t;const{auditLogEntry:i,text:s}=e;return a()("div",{},void 0,s,"login"===i.actionName&&c().createElement(c().Fragment,null,a()("div",{},void 0,a()(R.FormattedMessage,{description:"User's IP address in audit log",defaultMessage:"IP address: {ip}",values:{ip:null===(t=i.actor.meta)||void 0===t?void 0:t.ipAddress},id:"auditLogSettings.metadata.ipAddress"}))))}function _r(e){const{children:t,disabled:i,onClick:s}=e;return a()(Hi.Z,{onClick:s,disabled:i,style:{justifyContent:"center",marginLeft:6},isBlue:!i,isLightGray:i},void 0,t)}function Lr(e){const{sortOrder:t}=e;if(!t)return null;const i={width:10,height:10,marginRight:4};return t===Mn.CreatedOldest?se.Z.arrowDownSmall({...i,transform:"rotate(180deg)"}):se.Z.arrowDownSmall(i)}const Or=(0,R.defineMessages)({nameMessage:{id:"auditLogPaginatedTable.copyButton.namePlaceholder",defaultMessage:"name",description:"Placeholder for name if it does not exist when copying a row from audit log"},eventMessage:{id:"auditLogPaginatedTable.copyButton.eventPlaceholder",defaultMessage:"event",description:"Placeholder for event if it does not exist when copying a row from audit log"},dateTimeMessage:{id:"auditLogPaginatedTable.copyButton.dateTimePlaceholder",defaultMessage:"dateTime",description:"Placeholder for dateTime if it does not exist when copying a row from audit log"}});function Ur(e){const{ids:t}=e,i=(0,R.useIntl)(),s=(0,ze.O7)(),o=(0,qe.F)(),r=(0,qe.y)((e=>({button:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:28,borderRadius:3}})),[]);return a()(ct.Z,{delayThreshold:80,placement:ct.Z.Placement.Bottom,render:e=>c().createElement(Ws.Z,n()({style:r.button,onClick:()=>{(0,ut.RD)({environment:s,stringValue:Nr(t,i),copiedMessage:ut.tq.copiedToClipboard})}},e),se.Z.copy({width:16,height:16,fill:o.regularIconColor})),renderTooltip:()=>a()(R.FormattedMessage,{id:"AuditLogSettings.copyAuditLogEvent",description:"Tooltip that shows up when you hover over the copy button for copying a row",defaultMessage:"Copy row"})})}function Nr(e,t){var i,s,a;const o=null===(i=document.getElementById(e.actorColumnId))||void 0===i?void 0:i.textContent,n=null===(s=document.getElementById(e.eventColumnId))||void 0===s?void 0:s.textContent,r=null===(a=document.getElementById(e.dateTimeColumnId))||void 0===a?void 0:a.textContent;return"".concat(o||t.formatMessage(Or.nameMessage),",").concat(n||t.formatMessage(Or.eventMessage),",").concat(r||t.formatMessage(Or.dateTimeMessage))}const Vr=(0,R.injectIntl)((function(e){const{searchResponse:t,spaceStore:i}=e,s=i.id,[o,r]=(0,We.oR)(Pn),l=t.results||[],d=t.hasMoreResults,u=Boolean(l.length),m=null==l?void 0:l.map((e=>({auditLogEntry:e,actorStore:(0,Es.Kv)(i,{id:e.actor.actorId,table:e.actor.actorType,spaceId:s})}))),p=e=>{const t={...o,pageNum:e};r(t)};return c().createElement(c().Fragment,null,a()(to.Z,{tableStyle:{tableLayout:"fixed"},cellStyle:{wordWrap:"break-word",paddingTop:6,paddingBottom:6},columns:[{key:"user",header:a()(R.FormattedMessage,{id:"auditlog.logTable.userColumn.header",defaultMessage:"User"}),style:{width:"30%",paddingLeft:35}},{key:"event",header:a()(R.FormattedMessage,{id:"auditlog.logTable.eventColumn.header",defaultMessage:"Event"}),style:{width:"40%"}},{key:"Date",header:a()(Ws.Z,{disabled:!1,ignoreLocalHoverState:!0,onClick:()=>{const e=o.sortOrder===Mn.CreatedOldest?Mn.CreatedNewest:Mn.CreatedOldest;r({...o,sortOrder:e,pageNum:1})},style:{display:"flex",alignItems:"center"}},void 0,a()(Lr,{sortOrder:o.sortOrder}),a()(R.FormattedMessage,{id:"auditlog.logTable.dateColumn.header",defaultMessage:"Date"})),style:{width:"25%"}},{key:"otherActions",header:a()("span",{}),style:{width:"5%"}}],rows:m.map(((e,t)=>{const i="actor-".concat(e.auditLogEntry.actionName,"-").concat(t),s="event-".concat(e.auditLogEntry.actionName,"-").concat(t),o="datetime-".concat(e.auditLogEntry.actionName,"-").concat(t);return{key:t.toString(),columns:[c().createElement(Cr,n()({},e,{id:i})),a()(Rr,{auditLogEntry:e.auditLogEntry,id:s}),a()(wr,{auditLogEntry:e.auditLogEntry,id:o}),a()(Ur,{ids:{actorColumnId:i,eventColumnId:s,dateTimeColumnId:o}})]}}))}),u?a()("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:10}},void 0,a()(_r,{onClick:()=>{p(o.pageNum-1)},disabled:1===o.pageNum},void 0,a()(R.FormattedMessage,{id:"auditlog.logTable.previousPage",defaultMessage:"Previous"})),a()(_r,{disabled:!d,onClick:()=>{p(o.pageNum+1)}},void 0,a()(R.FormattedMessage,{id:"auditlog.logTable.nextPage",defaultMessage:"Next"}))):a()("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"40vh",flexDirection:"column"}},void 0,a()("div",{},void 0,a()(J.Z,{isSecondaryColor:!0,style:{fontWeight:500}},void 0,a()(R.FormattedMessage,{id:"auditlog.logTable.noResults",defaultMessage:"No results"}))),a()(J.Z,{isSecondaryColor:!0},void 0,a()(R.FormattedMessage,{id:"auditlog.logTable.noResultsHelpText",defaultMessage:"Try different filters. Logs may take some time to show up."}))))}));const Wr=(0,R.injectIntl)((function(e){const{spaceStore:t}=e,i=(0,ze.O7)(),s=null==t?void 0:t.id,[o]=(0,We.oR)(Fn),[n]=(0,We.oR)(Pn),r=In(n)!==o.filterStr?void 0:o.cachedResponses[n.pageNum];return(0,d.useEffect)((()=>{s&&(async e=>{var t,i;const{environment:s,spaceId:a}=e,o=Pn.getState();Fn.startLoading(a,o);const{sortOrder:n,pageSize:r,pageNum:l}=o,d=Fn.getCursor(a,o,l),c=o.timeRange.starting?M.OQ.toUnixMs(o.timeRange.starting):void 0,u=o.timeRange.ending?M.OQ.toUnixMs(o.timeRange.ending):void 0,m=await k.searchAuditLog(s,{spaceId:a,limit:r,cursor:d,filters:{timeRange:{starting:c,ending:u},...(null===(t=o.actors)||void 0===t?void 0:t.length)>0?{actors:o.actors}:void 0,...(null===(i=o.actions)||void 0===i?void 0:i.length)>0?{actions:o.actions}:void 0},sort:n||Mn.CreatedNewest});"success"!==m.type?(Fn.updateError(a,o),h.showErrorMessage(pt.default.formatMessage(Bn.loadCurrentAuditLogError))):Fn.updateLoadedResult(a,o,m.data)})({environment:i,spaceId:s})}),[i,s,n]),c().createElement(c().Fragment,null,a()(Rn,{}),a()(Mr,{spaceStore:t}),"loading"===(null==r?void 0:r.status)&&a()(br,{}),"success"===(null==r?void 0:r.status)&&a()(Vr,{searchResponse:r,spaceStore:t}))}));var zr=i(52796);class Hr extends F.Z{constructor(...e){super(...e),l()(this,"lastSpaceSettingsStoreState",void 0),l()(this,"lastSpaceSettingsModalStoreOpen",!1),l()(this,"storeTypes",{spaceBasicSettingsStore:C,spaceProfileSettingsStore:b,securitySettingsStore:w,spaceSecuritySamlSettingsStore:I}),l()(this,"renderContent",(()=>{const e={profile:this.renderProfile,notifications_and_settings:this.renderNotificationsAndSettings,credit:this.renderCredit,language_and_region:this.renderLanguageAndRegion,connected_apps:this.renderConnectedApps,settings:this.renderSettings,teams:this.renderTeamsSettings,members:this.renderMembers,plans:this.renderPlans,billing:this.renderBilling,subscription:this.renderSubscription,security_saml:this.renderSecuritySaml,integrations:this.renderIntegrations,experiments:this.renderExperiments,audit_log:this.renderAuditLog};return a()(Et.Z,{capture:!0,allowEsc:!0,render:t=>a()(Bt.Z,{capture:!0,ignoreBlockSelection:!0,restoreSelection:!0,focusOffscreenInput:!1,render:()=>c().createElement(Ae,n()({sidebar:this.renderSidebar()},t),e[x.ZP.state.currentTab]())})})})),l()(this,"renderProfile",(()=>a()(we,{isEducationPlan:te.wl(Oe.default.state.data),spaceProfileSettingsStore:this.stores.spaceProfileSettingsStore}))),l()(this,"renderNotificationsAndSettings",(()=>a()(zr.Z,{isMobile:!1}))),l()(this,"renderLanguageAndRegion",(()=>a()(Ja,{}))),l()(this,"renderSettings",(()=>a()(xt,{spaceStore:this.props.spaceStore,spaceBasicSettingsStore:this.stores.spaceBasicSettingsStore}))),l()(this,"renderTeamsSettings",(()=>a()(yn,{}))),l()(this,"renderMembers",(()=>a()(Ft.Z,{store:this.props.spaceStore}))),l()(this,"renderPlans",(()=>{const{data:e}=Oe.default.state;if(e)return a()(Ri,{spaceStore:this.props.spaceStore,data:e})})),l()(this,"renderBilling",(()=>{const{data:e}=Oe.default.state,t=te.XX(e);return e&&"subscribed_admin"===e.type&&t?a()(us,{spaceStore:this.props.spaceStore,subscriptionData:e,customerData:t}):e&&"unsubscribed_admin"===e.type?a()(ps,{spaceStore:this.props.spaceStore,data:e}):void 0})),l()(this,"renderExperiments",(()=>a()(U.Z,{},void 0,a()(an.Ub,{})))),l()(this,"shouldRenderAuditLog",(()=>{const{device:e}=this.environment;return!e.isMobile&&"enterprise"===te.CM(this.environment)&&"on"===fe.default.getGroup("show_audit_log")})),l()(this,"renderAuditLog",(()=>this.shouldRenderAuditLog()?a()(U.Z,{},void 0,a()(Wr,{spaceStore:this.props.spaceStore})):null)),l()(this,"renderSubscription",(()=>a()(U.Z,{},void 0,a()(Xa.Z,{})))),l()(this,"renderCredit",(()=>{const{data:e}=Oe.default.state;if(e)return a()(bs,{data:e})})),l()(this,"renderConnectedApps",(()=>a()(Vs,{}))),l()(this,"renderSecuritySaml",(()=>a()(oa,{spaceStore:this.props.spaceStore,securitySettingsStore:this.stores.securitySettingsStore,samlConfigStore:this.stores.spaceSecuritySamlSettingsStore,userStore:this.props.userStore}))),l()(this,"renderIntegrations",(()=>a()(sn,{spaceStore:this.props.spaceStore,userStore:this.props.userStore}))),l()(this,"handleModalOpen",(()=>{v.bi(this.environment),this.resetAuditLogSetting()})),l()(this,"handleModalDismiss",(()=>this.attemptCloseCurrentTab((()=>{x.ZP.setState({...x.ZP.state,open:!1}),Ne.setState(Ne.getInitialState()),this.resetAuditLogSetting()}))))}willMount(e){super.willMount(e);const{spaceStore:t}=this.props,{securitySettingsStore:i}=this.stores,s=i.getValueForSpace(t);s&&i.setState(s)}willMountOrUpdate(e){super.willMountOrUpdate(e);const{open:t}=x.ZP.state,i=x.ZP.state;this.lastSpaceSettingsModalStoreOpen===t&&m().isEqual(this.lastSpaceSettingsStoreState,i)||t&&g.SUq(this.environment,{tab:i.currentTab}),this.lastSpaceSettingsModalStoreOpen=t,this.lastSpaceSettingsStoreState=m().clone(i)}renderComponent(){const{open:e}=x.ZP.state;return a()(E.Z,{open:e,innerStyle:{width:1150,maxWidth:"calc(100vw - 100px)",height:"calc(100vh - 100px)",overflow:"hidden",borderRadius:3,maxHeight:715},onOpen:this.handleModalOpen,onDismiss:this.handleModalDismiss,render:this.renderContent,className:zs.zY})}renderSidebar(){const{spaceStore:e}=this.props,{data:t}=Oe.default.state,i=(0,X.S4)(this.environment),s=te.wY(t),o=(0,an.mS)();return a()("div",{style:Hr.sidebarStyle},void 0,a()("div",{},void 0,a()("div",{style:this.getSidebarHeader()},void 0,i&&i.email||a()(R.FormattedMessage,{id:"spaceSettings.sidebar.personalSettingsSection.title",defaultMessage:"Me"})),this.renderTabButton("profile"),this.renderTabButton("notifications_and_settings"),this.renderTabButton("connected_apps"),this.renderTabButton("language_and_region"),t&&t.creditEnabled&&this.renderTabButton("credit"),a()(B.Z,{size:18,isHidden:!0}),a()("div",{style:this.getSidebarHeader()},void 0,a()(R.FormattedMessage,{id:"spaceSettings.sidebar.workspaceSettingsSection.title",defaultMessage:"Workspace"})),this.renderTabButton("settings"),e.canAdmin()&&(0,on.bq)()&&this.renderTabButton("teams"),e.canRead()&&this.renderTabButton("members"),e.canRead()&&this.renderTabButton("plans"),e.canAdmin()&&t&&("subscribed_admin"===t.type||"unsubscribed_admin"===t.type)&&!s&&this.renderTabButton("billing"),s&&this.renderTabButton("subscription"),e.canAdmin()&&this.renderTabButton("security_saml"),e.canRead()&&this.renderTabButton("integrations"),this.shouldRenderAuditLog()&&this.renderTabButton("audit_log"),o&&this.renderTabButton("experiments"),e.canRead()&&a()(na.Z,{source:"settings"})))}renderTabButton(e){const t=x.ZP.state.currentTab===e,i=x.mY[e](this.environment),s=x.j7[e]();return a()(Ws.Z,{hovered:t,style:{display:"flex",alignItems:"center",padding:"5px 15px",...t&&{fontWeight:re.Z.fontWeight.semibold}},onClick:i=>{t||this.attemptCloseCurrentTab((()=>{x.ZP.setState({...x.ZP.state,currentTab:e}),g.XI1(this.environment,{tab:e})}))}},void 0,a()("div",{style:this.getIconWrapStyle()},void 0,i),a()(J.Z,{},void 0,s))}async attemptCloseCurrentTab(e){const{spaceStore:t}=this.props,{spaceProfileSettingsStore:i}=this.stores,{currentUserStore:s,currentUserSettingsStore:o}=G.default.state;if(!s||!o)throw new Error("No user or settings store.");const n=a()(R.FormattedMessage,{id:"spaceSettings.closeSettingsDialog.confirmationMessage",defaultMessage:"Your changes have not been saved. Save changes?"}),r=a()(R.FormattedMessage,{id:"spaceSettings.closeSettingsDialog.confirmationButton.label",defaultMessage:"Yes",description:"Label for button that appears below the question, 'Your changes have not been saved. Save changes?' to confirm that the user would like to save their changes."}),l=a()(R.FormattedMessage,{id:"spaceSettings.closeSettingsDialog.cancelationButton.label",defaultMessage:"No",description:"Label for button that appears below the question, 'Your changes have not been saved. Save changes?' to not save changes and return to settings menu."}),{currentTab:d}=x.ZP.state;if("profile"===d){if(!m().isEqual(i.state,i.getValueForUser(s,o))){const{profilePhoto:t,name:s,startDayOfWeek:r}=i.state;return s?h.showDialog({message:n,showCancel:!0,keepFocus:!0,items:[{label:a()(R.FormattedMessage,{id:"spaceSettings.closeSettingsDialog.updateSettingsButton.label",defaultMessage:"Update"}),color:"blue",onAccept:()=>{W.createAndCommit(this.environment,(e=>{const{currentUserStore:i}=G.default.state;if(i&&p.A({userStore:i,data:{name:s,profilePhoto:t},transaction:e}),o){o.getSettings().start_day_of_week!==r&&(0,Hs.d2)({userSettingsStore:o,data:{start_day_of_week:r},transaction:e})}})),e()}}],handleCancel:()=>{e()}}):h.showErrorMessage(a()(R.FormattedMessage,{id:"profileSettings.personalInfoSection.nameMissing.message",defaultMessage:"Please fill in name."})),!0}e()}else if("settings"===d&&t.canEdit()){const{spaceBasicSettingsStore:i}=this.stores;if(!m().isEqual(i.state,i.getValueForSpace(t))){if(await h.confirmUserAction({message:n,acceptLabel:r,cancelLabel:l})){if(!(await f.Y5({environment:this.environment,spaceId:t.id,spaceBasicSettingsStore:i})))return!1;f.OF({environment:this.environment,spaceStore:this.props.spaceStore,spaceBasicSettingsStore:i}),e()}else e();return!0}e()}else if("security_saml"===d&&t.canAdmin()){const{securitySettingsStore:i,spaceSecuritySamlSettingsStore:s}=this.stores,a=!m().isEqual(i.state,i.getValueForSpace(t)),o=await s.getValueForSpace(this.environment,t),d=(s.state.emailDomains.length>0||"enterprise"===te.CM(this.environment))&&(!s.state.id||s.state.id===t.id)&&!m().isEqual(s.state,o);if(a||d){if(await h.confirmUserAction({message:n,acceptLabel:r,cancelLabel:l})){const{disablePublicAccess:t,disableGuests:o,disableMoveToSpace:n,disableExport:r,disableSpacePageEdits:l,disablePublicAccessRequests:c,disablePersonalBots:u,disableTeamCreation:m}=i.state;if(a&&W.createAndCommit(this.environment,(e=>{f.Xr({environment:this.environment,disablePublicAccess:t,disableGuests:o,disableMoveToSpace:n,disableExport:r,disableSpacePageEdits:l,disablePublicAccessRequests:c,transaction:e,spaceStore:this.props.spaceStore,disablePersonalBots:u,disableTeamCreation:m})})),d){const{state:e}=s,t=await k.adminSamlConfigForSpace(this.environment,{spaceId:this.props.spaceStore.id,status:e.status,useMetadataUrl:e.useMetadataUrl,idpMetadataUrl:e.idpMetadataUrl,idpMetadata:e.idpMetadata,createAccount:e.createAccount});"failed"===t.type&&h.showError(t)}e()}else e();return!0}e()}else"audit_log"===d?(this.resetAuditLogSetting(),e()):e();return!1}resetAuditLogSetting(){Pn.reset(),Fn.reset()}getSidebarHeader(){return{letterSpacing:"0.03em",textTransform:"uppercase",fontSize:11,lineHeight:1,marginBottom:1,color:this.theme.mediumTextColor,fontWeight:re.Z.fontWeight.medium,padding:"5px 15px",textOverflow:"ellipsis",overflow:"hidden"}}getIconWrapStyle(){return{width:20,height:20,marginRight:8,color:this.theme.regularIconColor,fill:this.theme.regularIconColor}}}l()(Hr,"theme",void 0),l()(Hr,"sidebarStyle",{display:"flex",flexDirection:"column",height:"100%",paddingTop:10,paddingBottom:12,justifyContent:"space-between"});const qr=Hr},93039:(e,t,i)=>{i.d(t,{J:()=>w});var s=i(67154),a=i.n(s),o=i(98135),n=i.n(o),r=(i(33948),i(67294)),l=i.n(r),d=i(64215),c=i(5366),u=i(58879),m=i(62727),p=i(71202),g=i(25584),h=i(83071),f=i(31942),v=i(59054),y=i(97880),M=i(58762),S=i(48762),b=i(66722),T=i(19234),C=i(27242),Z=i(80366);function w(e){const t=(0,d.y)((e=>({container:(0,Z.s)(e),cityZipRow:{display:"flex"},verticalDivider:{display:"flex",borderLeft:"1px solid",borderLeftColor:e.groupedFormBorder},zipRow:{display:"flex",flex:2},stateRow:{display:"flex",flex:3}})),[]),i=(0,c.useIntl)();return n()("div",{},void 0,n()("div",{style:t.container},void 0,n()(A,{placeholder:i.formatMessage({id:"spaceSubscriptionPaymentForm.billingInformation.fullName",defaultMessage:"Full name"}),address:e.address,updateAddress:e.updateAddress,addressKey:"name"}),e.shouldShowBusinessName&&n()(A,{placeholder:i.formatMessage({id:"spaceSubscriptionPaymentForm.billingInformation.businessName",defaultMessage:"Business name (optional)"}),address:e.address,updateAddress:e.updateAddress,addressKey:"businessName"}),n()(k,{updateAddress:e.updateAddress,address:e.address}),e.address&&(0,T.Le)(e.address.country)&&l().createElement(l().Fragment,null,n()(A,{placeholder:i.formatMessage({id:"spaceSubscriptionPaymentForm.billingInformation.address",defaultMessage:"Address"}),address:e.address,addressKey:"addressLine1",updateAddress:e.updateAddress}),n()(A,{placeholder:i.formatMessage({id:"spaceSubscriptionPaymentForm.billingInformation.city",defaultMessage:"City"}),addressKey:"city",address:e.address,updateAddress:e.updateAddress}),n()("div",{style:t.cityZipRow},void 0,n()("div",{style:t.zipRow},void 0,n()(A,{placeholder:i.formatMessage({id:"spaceSubscriptionPaymentForm.billingInformation.zipCode",defaultMessage:"Zip code"}),address:e.address,addressKey:"zipCode",updateAddress:e.updateAddress})),n()("div",{style:t.verticalDivider}),n()("div",{style:t.stateRow},void 0,n()(A,{placeholder:i.formatMessage({id:"spaceSubscriptionPaymentForm.billingInformation.state",defaultMessage:"State / Province"}),address:e.address,addressKey:"state",updateAddress:e.updateAddress}))))))}function k(e){const t=(0,u.O7)(),[i,s]=(0,r.useState)(!1),o=(0,c.useIntl)(),T=(0,d.y)((()=>({input:{background:"none",boxShadow:"none",padding:8}})),[]),[w,k]=l().useState(""),[A]=(0,v.r5)((async()=>{const e=await M.getAvailableCountries(t,{});return"success"===e.type?e.data.countries:"failed"===e.type?[]:void(0,y.t1)(e)}),[t]),P=A.value;if(!P)return null;const I=(0,f.ZP)(w,P,(e=>e.name)).map(((t,i)=>({key:i,render:e=>l().createElement(S.Z,a()({},e,{title:t.name})),action:()=>{t.countryCode!==e.address.country&&e.updateAddress({addressLine1:"",addressLine2:"",zipCode:"",city:"",state:"",country:t.countryCode});const i=C.Z.state;i.open&&C.Z.setState({...i,vatApplicable:Boolean(t.vatApplicable)}),k(t.name),s(!1)}})));return n()(Z.c,{},void 0,n()(b.ZP,{popupType:b.ZP.PopupType.Popup,alignmentToOrigin:b.ZP.Alignment.End,placementToOrigin:b.ZP.Placement.Right,originGap:0,open:i,origin:n()(m.Z,{value:w,focus:i,placeholder:o.formatMessage({id:"spaceSubscriptionPaymentForm.billingInformation.country",defaultMessage:"Country or region"}),style:T.input,onChange:t=>{k(t.target.value),e.updateAddress({country:void 0})},onFocus:()=>{s(!0)}}),onDismiss:()=>{s(!1)},render:()=>n()(p.ZP,{menuType:p.ZP.MenuType.Popup,width:"100%"},void 0,n()(g.Z,{type:g.Z.Type.Vertical,initialFocus:w.length>0?0:void 0,sections:[{key:0,showNoResultMessage:!0,render:e=>l().createElement(h.Z,a()({},e,{title:n()(c.FormattedMessage,{id:"spaceSubscriptionBillingInfoForm.countryDropdown.title",defaultMessage:"Select a country or region"})})),items:I}]}))}))}function A(e){const t=(0,d.y)((()=>({input:{background:"none",boxShadow:"none",padding:8}})),[]);return n()(Z.c,{},void 0,n()(m.Z,{value:e.address[e.addressKey],style:t.input,placeholder:e.placeholder,onChange:(i=e.updateAddress,s=e.addressKey,e=>{i({[s]:e.target.value})})}));var i,s}},10644:(e,t,i)=>{i.d(t,{Z:()=>c});var s=i(98135),a=i.n(s),o=(i(67294),i(66832)),n=i(27386),r=i(46951),l=i(5366);class d extends o.Z{renderComponent(){return a()(n.Z,{},void 0,a()(r.Z,{isSmall:!0,style:{textAlign:"center"}},void 0,a()(l.FormattedMessage,{id:"spaceSubscriptionPlans.offlineMessage",defaultMessage:"Please go online to manage your plan."})))}}const c=d},1063:(e,t,i)=>{i.d(t,{X:()=>u});var s=i(98135),a=i.n(s),o=(i(67294),i(42402)),n=i(50906),r=i(58879),l=i(64215),d=i(5366),c=i(1643);function u(e){const t=(0,r.O7)(),i=(0,l.y)((()=>({couponLink:{fontSize:12}})),[]);return a()(o.Z,{href:"https://notionup.typeform.com/to/qYXezfBW",external:!0,style:i.couponLink,onClick:()=>{const i=c.CM(t);n.sS1(t,{tier:e.tier,currentTier:i})}},void 0,a()("div",{},void 0,a()(d.FormattedMessage,{id:"startupCouponInlineLink.text",defaultMessage:"Have a coupon code?"})))}},13787:(e,t,i)=>{i.r(t),i.d(t,{default:()=>k});var s=i(98135),a=i.n(s),o=i(59713),n=i.n(o),r=(i(33948),i(67294)),l=i.n(r),d=i(58762),c=i(8848),u=i(82990),m=i(92083),p=i(9209),g=i(33846),h=i(12318),f=i(66832),v=i(15102),y=i(62727),M=i(72693),S=i(42402),b=i(3779),T=i(28020),C=i(5366),Z=i(89101);class w extends f.Z{constructor(...e){super(...e),n()(this,"storeTypes",{promoCodeStore:g.Z,promoError:h.Z.of(void 0)}),n()(this,"handleModalDismiss",(()=>{p.Z.setState({open:!1})})),n()(this,"handleChangeEmail",(()=>{this.handleModalDismiss(),m.ZP.setState({...m.ZP.state,open:!0,currentTab:"profile"})})),n()(this,"handleInputChange",(e=>{this.stores.promoCodeStore.setState({...this.stores.promoCodeStore.state,inputValue:e.target.value.toUpperCase()}),this.stores.promoError.set(void 0)})),n()(this,"handleSubmitPromoCode",(async()=>{const e=this.stores.promoCodeStore.state.inputValue;if(e){const t=await d.getPromoCode(this.environment,{code:e});"failed"!==t.type&&t.data.promo?p.Z.state.open&&(await p.Z.state.handlePromoCode(this.stores.promoCodeStore.state.inputValue),this.handleModalDismiss()):this.stores.promoError.set(this.props.intl.formatMessage({defaultMessage:"Promo code {code} does not exist",id:"studentNotEligibleModal.numberedList.item2.promocode.errorMessage"},{code:e}))}}))}renderComponent(){const{open:e}=p.Z.state;return a()(v.Z,{open:e,innerStyle:w.wrapStyle,preventHideChildrenWhileOpening:!0,render:()=>this.renderModalContents(),onDismiss:this.handleModalDismiss})}renderModalContents(){return a()("div",{style:{fontSize:14}},void 0,a()("div",{},void 0,a()(C.FormattedMessage,{defaultMessage:"<p>Unfortunately you are not eligible for a free Personal Pro plan if you use this email address.</p><p>K-12 students, K-12 educators, and personal email addresses such as Gmail and Outlook are not eligible to receive the <pricinglink>Personal Pro Plan</pricinglink> for free, but anyone is welcome to use the <pricinglink>Personal Plan</pricinglink> for free with unlimited storage.</p>",id:"studentNotEligibleModal.header",values:{br:a()("br",{}),p:(...e)=>a()("p",{style:{marginTop:0,marginBottom:8}},void 0,1===e.length?e[0]:l().Children.toArray(e)),pricinglink:(...e)=>a()(S.Z,{external:!0,href:Z.AR.pricing},void 0,e)}})),this.renderSchoolEmailCodePrompt(),this.renderPromoCode(),this.renderContactUs())}renderSchoolEmailCodePrompt(){const e=(0,T.S4)(this.environment);return a()("div",{style:{display:"flex",marginTop:16}},void 0,a()("div",{style:{width:18,flexShrink:0,color:this.theme.mediumTextColor}},void 0,a()(C.FormattedMessage,{defaultMessage:"1.",id:"studentNotEligibleModal.numberedList.firstItem"})),a()("div",{style:{flexGrow:1}},void 0,a()("div",{style:{color:this.theme.mediumTextColor}},void 0,a()(C.FormattedMessage,{defaultMessage:"Your current email is:",id:"studentNotEligibleModal.numberedList.changeEmailItem.message"})),a()("div",{style:{fontWeight:u.Z.fontWeight.medium,marginTop:0}},void 0,e&&e.email),a()("div",{style:{color:this.theme.mediumTextColor,marginTop:4}},void 0,a()(C.FormattedMessage,{defaultMessage:"Thousands of university, college, and post-secondary school domains are already eligible, not just .edu emails!",id:"studentNotEligibleModal.numberedList.changeEmailItem.message2"})),a()(M.Z,{style:{marginTop:12},onClick:this.handleChangeEmail,isLarge:!0},void 0,a()(C.FormattedMessage,{defaultMessage:"Change email",id:"studentNotEligibleModal.numberedList.changeEmailItem.button.label"}))))}renderPromoCode(){const e=this.stores.promoError.get(),t=this.props.intl.formatMessage({defaultMessage:"Enter student promo code…",id:"studentNotEligibleModal.numberedList.item2.promocodePlaceholder"});return a()("div",{style:{display:"flex",marginTop:16}},void 0,a()("div",{style:{width:18,flexShrink:0,color:this.theme.mediumTextColor}},void 0,a()(C.FormattedMessage,{defaultMessage:"2.",id:"studentNotEligibleModal.numberedList.secondItem"})),a()("div",{style:{flexGrow:1}},void 0,a()("div",{style:{color:this.theme.mediumTextColor}},void 0,a()(C.FormattedMessage,{defaultMessage:"Have a student promo code?",id:"studentNotEligibleModal.numberedList.promoCodeItem.message"})),a()("div",{style:{display:"flex",marginTop:12}},void 0,a()(y.Z,{style:{marginRight:8,height:32},value:this.stores.promoCodeStore.state.inputValue,onChange:this.handleInputChange,onSubmit:this.handleSubmitPromoCode,placeholder:t}),a()(M.Z,{onClick:this.handleSubmitPromoCode,disabled:!this.stores.promoCodeStore.state.inputValue,isLarge:!0},void 0,a()(C.FormattedMessage,{defaultMessage:"Submit",id:"studentNotEligibleModal.numberedList.promoCodeItem.submitButton"}))),a()("div",{style:{color:c.ZP.red,fontSize:12,marginTop:4,marginLeft:8,height:20}},void 0,e)))}renderContactUs(){return a()("div",{style:{display:"flex",alignItems:"center",color:this.theme.lightTextColor,borderTop:"1px solid ".concat(this.theme.regularDividerColor),paddingTop:14}},void 0,b.Z.help({width:14,marginTop:1,marginRight:6,fill:this.theme.lightIconColor})," ",a()("div",{},void 0,a()(C.FormattedMessage,{defaultMessage:"Have questions about this? <inlinelink>More info & FAQs</inlinelink>.",id:"studentNotEligibleModal.contactUsSection.message",values:{inlinelink:(...e)=>a()(S.Z,{href:"https://www.notion.so/Notion-for-students-teachers-adc631df15ee4ab9a7a33dd50f4c16fe",external:!0},void 0,e)}})))}}n()(w,"wrapStyle",{padding:"24px 36px 24px",minWidth:300,maxWidth:400});const k=(0,C.injectIntl)(w)},719:(e,t,i)=>{i.d(t,{Z:()=>h});var s=i(67154),a=i.n(s),o=i(98135),n=i.n(o),r=i(59713),l=i.n(r),d=(i(33948),i(67294)),c=i.n(d),u=i(66832),m=i(62727),p=i(98742);class g extends u.Z{constructor(...e){super(...e),l()(this,"handleKeyDown",(e=>{"Backspace"===e.key&&0===this.props.value.length&&this.props.onRemoveLastToken()}))}renderComponent(){const{device:e}=this.environment;return n()("div",{onClick:this.props.onClick,style:e.isMobile?this.getMobileWrapStyle():this.getDesktopWrapStyle()},void 0,this.props.tokens,this.renderInput())}renderInput(){const{device:e}=this.environment,t=0===this.props.tokens.length;return c().createElement(m.Z,a()({format:m.Z.Format.Transparent},(0,p.Z)({onKeyDown:this.handleKeyDown},{onChange:this.props.onChange}),{value:this.props.value,onSubmit:this.props.onSubmit,onBlur:this.props.onBlur,focus:this.props.focus,style:{...g.inputStyle,margin:e.isMobile?"0 8px 8px 0":"0 6px 6px 0"},readOnly:this.props.readOnly,inputStyle:{height:18},size:1,type:this.props.type,placeholder:t?this.props.placeholder:"",autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1}))}getDesktopWrapStyle(){return{display:"flex",flexWrap:"wrap",alignItems:"flex-start",minHeight:32,boxShadow:this.theme.inputBoxShadow,background:this.theme.inputBackground,borderRadius:3,fontSize:14,cursor:"text",overflow:"hidden",padding:"7px 9px 0px",...this.props.style}}getMobileWrapStyle(){return{...this.getDesktopWrapStyle(),fontSize:14,padding:"7px 10px 0"}}}l()(g,"inputStyle",{flexGrow:1,flexShrink:1,flexBasis:60,minWidth:60,width:"auto",lineHeight:"20px"});const h=g},92843:(e,t,i)=>{i.r(t),i.d(t,{SidebarCreateTeamModal:()=>J});var s=i(98135),a=i.n(s),o=(i(33948),i(41817),i(96486)),n=i.n(o),r=i(5366),l=i(67294),d=i.n(l),c=i(82990),u=i(58879),m=i(89940),p=i(64215),g=i(19522),h=i(72693),f=i(62727),v=i(89206),y=i(15102),M=i(13490),S=i(58762),b=i(68989),T=i(33929),C=i(70442),Z=i(89858),w=i(26111),k=i(22889),A=i(27832);async function P(e){const{environment:t,teamId:i,spaceStore:s,spaceViewStore:a}=e,o=s||A.default.state.currentSpaceStore,n=a||A.default.state.currentSpaceViewStore;if(!o||!n)return!1;const r=(0,b.OU)(T.default.getIntl()),l=await async function(e){const{environment:t,template:i,teamId:s,spaceStore:a,spaceViewStore:o}=e,n=await Z.mv({environment:t,spaceStore:a,spaceViewStore:o,teamId:s,andNavigate:!1});return await C.rC({environment:t,item:i,isPrivate:!1,spaceStore:a,spaceViewStore:o,useMinimalTemplates:!1,initializeStore:n})}({environment:t,teamId:i,spaceStore:o,spaceViewStore:n,template:r});return!!l&&(w.navigateToBlock({environment:t,store:l,visitType:k.vu.Link}),!0)}var I=i(40039),x=i(29716),F=i(3779),B=i(14947),E=i(46951),R=i(33052),D=i(68932),_=i(92512),L=i(92251),O=i(63829);const U={container:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",userSelect:"none",WebkitUserSelect:"none",width:"100%",position:"relative",padding:22},full:{width:"100%"},inputs:{paddingLeft:30,paddingRight:30,paddingBottom:28}},N=(0,r.defineMessages)({teamNamePlaceholder:{id:"sidebarCreateTeamModal.teamScreen.namePlaceholder",defaultMessage:"Acme Labs"},teamDescriptionPlaceholder:{id:"sidebarCreateTeamModal.teamScreen.descriptionPlaceholder",defaultMessage:"Details about your team"}});function V(){const[e,t]=(0,m.oR)(g.Z);return d().createElement(d().Fragment,null,a()(M.Z,{hasMarginTop:!0,style:{fontWeight:c.Z.fontWeight.medium,marginTop:18}},void 0,a()(r.FormattedMessage,{id:"sidebarCreateTeamModal.teamScreen.teamDescriptionLabel",defaultMessage:"Team description"})),a()(f.Z,{value:e.description,placeholder:T.default.formatMessage(N.teamDescriptionPlaceholder),textarea:!0,onChange:i=>{t({...e,description:i.target.value})}}))}function W(e){return a()("div",{style:{fontSize:18,fontWeight:c.Z.fontWeight.semibold,marginTop:26,textAlign:"center"}},void 0,(()=>{switch(e.screen){case g.F.Team:return a()(r.FormattedMessage,{id:"sidebarCreateTeamModal.teamTitle.label",defaultMessage:"Create new team"});case g.F.Members:return a()(r.FormattedMessage,{id:"sidebarCreateTeamModal.membersTitle.label",defaultMessage:"Add people"})}})())}function z(){const[e]=(0,m.oR)(g.Z),{open:t,screen:i}=e;if(t)switch(i){case g.F.Team:return a()(j,{});case g.F.Members:const t=e.teamId;return t?a()(Q,{teamId:t}):null}return null}function H(){const[e,t]=(0,m.oR)(g.Z);return d().createElement(d().Fragment,null,a()(M.Z,{hasMarginTop:!0,style:{fontWeight:c.Z.fontWeight.medium}},void 0,a()(r.FormattedMessage,{id:"sidebarCreateTeamModal.teamScreen.teamNameLabel",defaultMessage:"Team name"})),a()(f.Z,{value:e.name,placeholder:T.default.formatMessage(N.teamNamePlaceholder),onChange:i=>{t({...e,name:i.target.value})}}))}function q(e){const t=(0,p.F)();return a()("div",{style:{fontSize:14,color:t.mediumTextColor,width:280,marginTop:3,marginBottom:22,textAlign:"center",lineHeight:1.3}},void 0,(()=>{switch(e.screen){case g.F.Team:return a()(r.FormattedMessage,{id:"sidebarCreateTeamModal.teamDescription.label",defaultMessage:"Space to collaborate and organize pages"});case g.F.Members:return a()(r.FormattedMessage,{id:"sidebarCreateTeamModal.membersDescription.label",defaultMessage:"Invite people to collaborate"})}})())}function G(){const[e,t]=(0,m.oR)(g.Z),[i]=(0,m.oR)(A.default),s=(0,u.O7)(),o=(0,p.y)((e=>({box:{justifyContent:"flex-end",alignItems:"center",display:"flex",width:"100%",paddingTop:12,paddingBottom:14,paddingRight:14,paddingLeft:14,boxShadow:"0 -1px 0 ".concat(e.regularDividerColor)},previous:{fontSize:14,color:e.mediumTextColor,cursor:"pointer"}})),[]),{handleNextClick:n,nextMessage:l,isDisabled:d}={handleNextClick:async()=>{if(!i.currentSpaceStore)return;t((e=>({...e,loading:!0})));const a=await S.createTeam(s,{spaceId:i.currentSpaceStore.id,name:e.name,description:e.description,icon:e.icon,spacePermissionRole:e.isClosedTeam?"none":"editor"});var o;if("failed"===a.type)throw t((e=>({...e,loading:!1}))),new Error(JSON.stringify({message:null===(o=a.body)||void 0===o?void 0:o.message,status:a.status}));(0,L.rq)()&&await P({environment:s,teamId:a.data.teamId}),t((e=>({...e,loading:!1,screen:g.F.Members,name:"",open:!0,description:"",teamId:a.data.teamId})))},nextMessage:a()(r.FormattedMessage,{id:"sidebarCreateTeamModal.footer.createTeam",defaultMessage:"Create team"}),isDisabled:""===e.name};return a()("div",{style:o.box},void 0,a()("div",{},void 0,a()(h.Z,{isLarge:!0,onClick:n,disabled:d},void 0,l)))}function K(){const[e,t]=(0,m.oR)(g.Z),i=(0,p.y)((e=>({logo:{fontSize:12,color:e.lightTextColor,marginTop:4},container:{justifyContent:"center",display:"flex",width:"100%"}})),[]),[{currentSpaceStore:s}]=(0,m.oR)(A.default);if(!s)return null;const o=e.icon?{icon:e.icon,pointer:{table:"space",id:s.id}}:void 0;return a()("div",{style:i.container},void 0,a()("div",{},void 0,a()(I.Z,{disabled:!1,bucket:"public",icon:o,isEmptyPage:!1,title:"team-icon-".concat(s.id),size:56,onChange:i=>{t({...e,icon:i})}}),a()("div",{style:i.logo},void 0,a()(r.FormattedMessage,{id:"sidebarCreateTeamModal.logo.label",defaultMessage:"Add a logo"}))))}function j(){const[e]=(0,m.oR)(g.Z),{loading:t}=e,i=(0,p.F)();return a()("div",{style:U.full},void 0,a()("div",{style:U.container},void 0,a()(W,{screen:g.F.Team}),a()(q,{screen:g.F.Team}),a()("div",{style:{...U.full,...U.inputs}},void 0,a()(K,{}),a()(H,{}),a()(V,{}),a()(Y,{}))),a()(G,{}),t&&a()("div",{style:{width:"100%",height:"100%",backgroundColor:i.modalUnderlayBackground,position:"absolute",top:0,left:0}},void 0,a()(D.Z,{style:{position:"absolute",top:"50%",left:"50%"}})))}function Y(){const[e,t]=(0,m.oR)(g.Z),i="on"===(0,u.aq)("teams-settings-members");return a()("div",{style:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center",marginTop:20}},void 0,a()("div",{style:{display:"flex",flexDirection:"column",alignContent:"flex-start",width:200}},void 0,a()("div",{style:{fontSize:14,fontWeight:c.Z.fontWeight.medium,marginBottom:4}},void 0,function(e){if(!e.isClosed)return a()(r.FormattedMessage,{id:"sidebarCreateTeamModal.teamScreen.openTeam.title",defaultMessage:"Open team"});return e.showNewTeamSettings?a()(r.FormattedMessage,{id:"sidebarCreateTeamModal.teamScreen.privateTeam.title",defaultMessage:"Private team"}):a()(r.FormattedMessage,{id:"sidebarCreateTeamModal.teamScreen.closedTeam.title",defaultMessage:"Closed team"})}({isClosed:Boolean(e.isClosedTeam),showNewTeamSettings:i})),a()(E.Z,{isSmall:!0,isMultiline:!0},void 0,e.isClosedTeam?a()(r.FormattedMessage,{id:"sidebarCreateTeamModal.teamScreen.closedTeam.description",defaultMessage:"Only team members will have access to pages in the team."}):a()(r.FormattedMessage,{id:"sidebarCreateTeamModal.teamScreen.openTeam.description",defaultMessage:"Everyone in the workspace will have access to pages in the team."}))),a()(O.p,{isClosedTeam:Boolean(e.isClosedTeam),onChange:i=>{t({...e,isClosedTeam:i})}}))}function Q(e){const[,,t]=(0,m.oR)(g.Z),[,,i]=(0,m.oR)(void 0,R.Z),[s]=(0,m.oR)(A.default);if(!s.currentSpaceStore)return null;const o=x.Z.createChildStore(s.currentSpaceStore,{table:"team",id:e.teamId,spaceId:s.currentSpaceStore.id});return a()("div",{style:U.full},void 0,a()("div",{style:U.container},void 0,a()(_.Z,{onSubmitSuccessful:()=>t.reset(),onDismiss:()=>t.reset(),isNewlyCreatedTeam:!0,store:o,permissionsInviteStore:i})))}function J(){const e=(0,u.O7)(),[t,,i]=(0,m.oR)(g.Z),s=(0,p.y)((e=>({modal:{width:448,maxWidth:"calc(100vw - 100px)",borderRadius:3},closeButton:{position:"absolute",top:14,right:14,zIndex:10,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"100%",background:e.buttonHoveredBackground,width:20,height:20},closeButtonHover:{background:e.buttonPressedBackground},closeButtonIcon:{width:14,fill:e.mediumTextColor},wrapper:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",userSelect:"none",WebkitUserSelect:"none"},container:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",userSelect:"none",WebkitUserSelect:"none"},contentContainer:{display:"flex",alignItems:"start",alignContent:"start",flexDirection:"column",width:"100%"}})),[]),{open:o}=t;return a()(y.Z,{open:o,innerStyle:s.modal,onDismiss:()=>g.Z.reset(),render:()=>{const{device:t}=e;return a()("div",{style:{height:"100%"}},void 0,!t.isMobile&&a()(B.Z,{onClick:()=>i.reset(),style:s.closeButton,hoveredStyle:s.closeButtonHover},void 0,F.Z.closeSmall(s.closeButtonIcon)),a()("div",{style:s.wrapper},void 0,a()(v.Z,{capture:!0,onBackspace:n().identity,onLeft:n().identity,onRight:n().identity,onSelectAll:n().identity,onRedo:n().identity,onUndo:n().identity,onCut:n().identity,onCopy:n().identity,onPaste:n().identity,onKeypress:n().identity,onDelete:n().identity,onTab:n().identity},void 0,a()("div",{style:s.contentContainer},void 0,a()(z,{})))))}})}},63829:(e,t,i)=>{i.d(t,{p:()=>c});var s=i(98135),a=i.n(s),o=(i(67294),i(3779)),n=i(5366),r=i(14947),l=i(64215),d=i(58879);function c({isClosedTeam:e,onChange:t}){return a()("div",{style:{display:"flex"}},void 0,a()(u,{type:"open",selected:!e,onClick:()=>t(!1)}),a()(u,{type:"close",selected:e,onClick:()=>t(!0)}))}function u({type:e,selected:t,onClick:i}){const s=(0,l.F)(),c="on"===(0,d.aq)("teams-settings-members"),u="close"===e;return a()(r.Z,{style:{display:"flex",flexDirection:"column",alignItems:"center",width:74,flexGrow:0,flexShrink:0,fontSize:11,borderRadius:5,marginLeft:10,padding:"8px 7px 6px 7px",border:"1px solid ".concat(s.regularDividerColor),color:s.mediumTextColor,fill:s.mediumTextColor,...t&&{border:"2px solid ".concat(s.blueColor),color:s.blueColor,fill:s.blueColor,padding:"7px 6px 5px 6px"}},disabled:t,onClick:i},void 0,u?o.Z.locked({width:void 0,height:18,marginBottom:3}):o.Z.membersFilled({width:void 0,height:22,marginBottom:-1}),a()("div",{},void 0,function(e){if(!e.isClosed)return a()(n.FormattedMessage,{id:"sidebarCreateTeamModal.teamScreen.openTeam.caption",defaultMessage:"Open"});return e.showNewTeamSettingsStyle?a()(n.FormattedMessage,{id:"sidebarCreateTeamModal.teamScreen.privateTeam.caption",defaultMessage:"Private"}):a()(n.FormattedMessage,{id:"sidebarCreateTeamModal.teamScreen.closedTeam.caption",defaultMessage:"Closed"})}({isClosed:u,showNewTeamSettingsStyle:c})))}},67110:(e,t,i)=>{i.r(t),i.d(t,{default:()=>se});var s=i(67154),a=i.n(s),o=i(98135),n=i.n(o),r=i(59713),l=i.n(r),d=(i(33948),i(73210),i(67294)),c=i.n(d),u=i(3779),m=i(66832),p=i(8848),g=i(82990),h=i(37235),f=i(7765),v=i(25584),y=i(83071),M=i(97680),S=i(48762),b=i(71202),T=i(16328),C=i(47082),Z=i(1643),w=i(21325),k=i(78291),A=i(43250),P=i(33728),I=i(83182),x=i(91487),F=i(19889),B=i(27006),E=i(5366),R=i(15282),D=i(60969),_=i(33665),L=i(16639),O=i(40039),U=i(27832),N=i(58879),V=i(64215),W=i(60709),z=i(46167),H=i(42001),q=i(96486),G=i.n(q),K=i(64684),j=i(89940);const Y=["owner","member"],Q=(0,E.defineMessages)({ownerLabel:{id:"teamPermissionsMenu.ownerItem.label",defaultMessage:"Team owner"},ownerCaption:{id:"teamPermissionsMenu.ownerItem.caption",defaultMessage:"Can edit team settings and full access to team pages."},memberLabel:{id:"teamPermissionsMenu.memberItem.label",defaultMessage:"Member"},memberCaption:{id:"teamPermissionsMenu.memberItem.caption",defaultMessage:"Cannot edit team settings and can access team pages."}}),J={owner:{label:Q.ownerLabel,caption:Q.ownerCaption},member:{label:Q.memberLabel,caption:Q.memberCaption}};function X(e){const{disabled:t,selectedRole:i,onChange:s,store:o}=e,{device:r}=(0,N.O7)(),l=(0,V.F)(),d=(0,j.VK)((()=>{var e;const t=null==o?void 0:o.getValue(),i=null===(e=U.default.state.currentUserStore)||void 0===e?void 0:e.userId;return!(!t||!i)&&(0,K.pd)(t,i)}),[o]);return n()(z.Z,{popupType:r.isMobile?z.Z.PopupType.SlideUp:z.Z.PopupType.Popup,renderOrigin:e=>c().createElement(H.Z,a()({disabled:t,disabledFeedback:!0},e),c().createElement(E.FormattedMessage,J[i].label),u.Z.chevronDown({width:10,marginLeft:4,fill:l.lightIconColor})),placementToOrigin:W.Iw.Bottom,render:e=>{const t=[{key:"roles",render:e=>c().createElement(y.Z,a()({},e,{topBorder:0!==e.index})),items:Y.map((t=>{const o=!d&&"owner"===t;return{key:t,render:e=>c().createElement(S.Z,a()({},e,{focused:!1,checkState:G().isEqual(t,i),disabled:o,disabledFeedback:o,title:n()("div",{style:{display:"flex",alignItems:"center"}},void 0,c().createElement(E.FormattedMessage,J[t].label)),caption:n()("span",{style:{color:l.mediumTextColor}},void 0,c().createElement(E.FormattedMessage,J[t].caption)),shouldWrapCaption:!0})),action:()=>{s(t),e.close()}}}))}];let o;return o=r.isMobile?{menuType:b.ZP.MenuType.Modal,title:n()(E.FormattedMessage,{id:"userPermissionsMenu.mobile.title",defaultMessage:"Select team role"}),right:n()(E.FormattedMessage,{id:"userPermissionsMenu.mobile.doneButton.label",defaultMessage:"Done"}),onClickRight:e.close}:{menuType:b.ZP.MenuType.Popup,width:264},c().createElement(b.ZP,o,n()(v.Z,{type:v.Z.Type.Vertical,initialFocus:void 0,sections:t}))}})}var $=i(33052),ee=i(75472);const te="member";class ie extends m.Z{constructor(...e){super(...e),l()(this,"storeTypes",{permissionsInviteStore:$.Z}),l()(this,"handleModalDismiss",(async()=>{const{permissionsInviteStore:e}=this.stores,{disabled:t}=this.props;return e.setState({...e.state,inviteTargets:[],isInviteTargetsEmpty:!0,modalOpen:!t&&await(0,ee.Aw)(e.state)})})),l()(this,"handleInputChange",(e=>{const t=e.target.value,{extractedEmails:i,newInputValue:s}=(0,P.zI)(t),a=i.map((e=>({type:"newUser",value:{email:e}}))).filter((e=>!(0,ee.Nd)({target:e,permissionsInviteStore:this.stores.permissionsInviteStore}))),o=[...this.stores.permissionsInviteStore.state.inviteTargets,...a];o.length>0?this.stores.permissionsInviteStore.setState({...this.stores.permissionsInviteStore.state,inviteTargets:o,isInviteTargetsEmpty:!1,tokenQuery:s}):this.stores.permissionsInviteStore.setState({...this.stores.permissionsInviteStore.state,inviteTargets:[],isInviteTargetsEmpty:!0,tokenQuery:s})})),l()(this,"handleClickRemoveToken",(e=>{const{permissionsInviteStore:t}=this.stores;if(t.state.isInviteTargetsEmpty)return;const i=t.state.inviteTargets.filter((t=>t!==e));0===i.length?t.setState({...t.state,inviteTargets:[],inviteRole:te,isInviteTargetsEmpty:!0}):t.setState({...t.state,inviteTargets:i})}))}async willMount(){await w.bi(this.environment)}renderComponent(){const{permissionsInviteStore:e}=this.stores,{tokenQuery:t}=e.state,i=e.state.inviteTargets.map((t=>{const i="newUser"===t.type?t.value.email:"".concat(t.type,"-").concat(t.value.id);return n()(x.Z,{target:t,onClickRemove:this.handleClickRemoveToken,role:e.state.inviteRole,disabled:this.props.disabled,style:this.getInputTokenVerticalMarginStyle()},i)})),{device:s}=this.environment,o=this.props.intl.formatMessage({id:"permissionsInvite.searchInput.placeholder",defaultMessage:"Search emails, names, or groups"}),r=n()(C.Z,{focus:this.isInputFocusedAndEnabled(),focusInitial:s.isMobile,focusAfterAnimation:!0,format:C.Z.Format.Share,value:t,onChange:this.handleInputChange,type:"email",tokens:i,disabled:this.props.disabled,placeholder:o,onRemoveLastToken:()=>{const e={...this.stores.permissionsInviteStore.state};e.inviteTargets=e.inviteTargets.slice(0,-1),0===e.inviteTargets.length&&(e.isInviteTargetsEmpty=!0,e.inviteRole=te),this.stores.permissionsInviteStore.setState(e)},right:!s.isMobile&&this.renderDesktopInputRightInnerSelect({marginLeft:8,display:"flex",alignItems:"center"}),style:this.getTokenMenuItemStyle(),inputAndTokenWrapRightStyle:{alignItems:"center"},inputStyle:this.getInputTokenVerticalMarginStyle(),inputDivStyle:{marginBottom:0},dontShowBorderBottom:s.isAndroid}),l=this.isInputFocusedAndEnabled()&&t.length>0,d={request:t,performRequest:e=>(0,ee.jL)({query:e,sectionLimit:10,shouldShowBots:!1,shouldShowGroups:!0,membersOnly:this.props.membersOnly,environment:this.environment,intl:this.props.intl}),render:(e,i,s)=>{if(!l)return null;if(e)return n()(D.l,{loading:!s},void 0,n()(T.Z,{title:n()(E.FormattedMessage,{id:"inviteUserModal.searchInput.errorMessage",defaultMessage:"Something went wrong"})}));const{inviteUsers:o,inviteGroups:r}=(0,ee.oP)({targetStore:this.props.store,permissionsInviteStore:this.stores.permissionsInviteStore,usersToInvite:i}),{data:d}=k.default.state,m=o.map((e=>({key:"newUser"===e.type?e.value.email:e.value.id,render:t=>{const i=d?Z.uF(d):[],s="existingUser"===e.type&&i.find((t=>t.userId===e.value.id));let o;return s&&(0,B.zz)(s.role)?o=n()(h.Z,{renderTooltip:()=>n()(E.FormattedMessage,{id:"inviteUserModal.userRole.adminBadge.tooltip",defaultMessage:"This person is an admin in this workspace"}),render:e=>c().createElement("div",a()({style:this.getBadgeStyle()},e),n()(E.FormattedMessage,{id:"inviteUserModal.userRole.adminBadge.label",defaultMessage:"Admin"}))}):s&&(0,B.J5)(s.role)?o=n()(h.Z,{renderTooltip:()=>n()(E.FormattedMessage,{id:"inviteUserModal.userRole.memberBadge.tooltip",defaultMessage:"This person is a member in this workspace"}),render:e=>c().createElement("div",a()({style:this.getBadgeStyle()},e),n()(E.FormattedMessage,{id:"inviteUserModal.userRole.memberBadge.label",defaultMessage:"Member"}))}):s&&(o=n()(h.Z,{renderTooltip:()=>n()(E.FormattedMessage,{id:"inviteUserModal.userRole.guest.tooltip",defaultMessage:"This person is a guest in this workspace"}),render:e=>c().createElement("div",a()({style:this.getBadgeStyle()},e),n()(E.FormattedMessage,{id:"inviteUserModal.userRole.guestBadge.label",defaultMessage:"Guest"}))})),"existingUser"===e.type?c().createElement(M.Z,a()({},t,{user:e.value,right:o})):c().createElement(S.Z,a()({},t,{icon:u.Z.mail({width:ie.avatarSize,height:ie.avatarSize}),right:o,title:e.value.email.trim()}))},action:()=>{const{permissionsInviteStore:t}=this.stores;t.setState({...t.state,inviteTargets:[...t.state.inviteTargets,e],isInviteTargetsEmpty:!1,tokenQuery:""})}}))),{currentSpaceStore:p}=U.default.state,f=r.map((e=>{const{value:t}=e,i=(0,L.k)({intl:this.props.intl,group:t}),s=p&&t.icon?{pointer:{table:p.table,id:p.id},icon:t.icon}:void 0;return{key:t.id,render:e=>c().createElement(S.Z,a()({},e,{icon:n()(O.Z,{disabled:!0,size:22,icon:s,isEmptyPage:!1,title:i}),title:i})),action:()=>{const{permissionsInviteStore:t}=this.stores;t.setState({...t.state,inviteTargets:[...t.state.inviteTargets,e],isInviteTargetsEmpty:!1,tokenQuery:""})}}})),b=[],{permissionsInviteStore:C}=this.stores;if(m.length>0&&b.push({key:"user results",render:e=>c().createElement(D.l,a()({},e,{loading:!s})),items:m}),f.length>0&&b.push({key:"group results",render:e=>c().createElement(y.Z,a()({},e,{title:n()(E.FormattedMessage,{id:"inviteUserModal.searchDropdown.selectGroupTitle",defaultMessage:"Select a group"}),loading:!s})),items:f}),0===b.length){const e=(0,P.H3)(C.state.tokenQuery);if(e){const t={type:"newUser",value:{email:e}},a=(0,ee.Nd)({target:t,permissionsInviteStore:this.stores.permissionsInviteStore});if(!a)return;if(a)return n()(D.l,{loading:!s},void 0,n()(T.Z,{title:n()(E.FormattedMessage,{id:"inviteUserModal.userAlreadyInvitedMessage",defaultMessage:"Already inviting {user}.",values:{user:n()("span",{style:{fontWeight:g.Z.fontWeight.bold}},void 0,(0,ee.DF)({intl:this.props.intl,target:a}))}})}));const o=(i&&i.inviteUsers||[]).find((t=>"existingUser"===t.type&&t.value.email===e));if(o&&"existingUser"===o.type&&(0,ee.Zp)({store:this.props.store,target:o}))return n()(D.l,{loading:!s},void 0,n()(T.Z,{title:n()(E.FormattedMessage,{id:"inviteUserModal.userAlreadyHasPermissionMessage",defaultMessage:"{user} already has permission.",values:{user:n()("span",{style:{fontWeight:g.Z.fontWeight.bold}},void 0,(0,F.Nz)(this.props.intl,o.value))}})}))}return n()(D.l,{loading:!s},void 0,n()(T.Z,{title:n()(E.FormattedMessage,{id:"inviteUserModal.searchPersonDropdown.noSearchResultsMessage",defaultMessage:"Type or paste in emails above, separated by commas."})}))}return n()(v.Z,{type:v.Z.Type.Vertical,initialFocus:t.length>0?0:void 0,sections:b})}};let m;return m=s.isMobile?{menuType:b.ZP.MenuType.Modal,title:n()(E.FormattedMessage,{id:"inviteUserModal.invitePersonMenu.title",defaultMessage:"Invite a person"}),right:n()("div",{style:{color:p.ZP.blue}},void 0,n()(E.FormattedMessage,{id:"inviteUserModal.mobile.inviteButton.label",defaultMessage:"Invite"})),left:n()(R.CancelMenuText,{}),onClickLeft:this.handleModalDismiss,header:r}:{menuType:b.ZP.MenuType.Popup,width:"100%",header:r,tokenInputHeader:!1,disableScroller:!0,scrollerStyle:{zIndex:1}},n()("div",{style:{borderRadius:3,boxShadow:this.isInputFocusedAndEnabled()?this.theme.outlineBlueInputBoxShadow:this.theme.inputBoxShadow},onFocus:()=>{e.setState({...e.state,isFocused:!0})},onBlur:()=>{e.setState({...e.state,isFocused:!1})}},void 0,c().createElement(b.ZP,a()({},m,{className:A.FJ}),s.isMobile&&n()(y.Z,{title:n()(E.FormattedMessage,{id:"inviteUserModal.permissionLevel.title",defaultMessage:"Permission level"})},void 0,this.renderDesktopInputRightInnerSelect()),n()("div",{style:{position:"absolute",width:"100%",zIndex:1,backgroundColor:"white",borderRadius:3,boxShadow:this.theme.inputBoxShadow}},void 0,c().createElement(f.Z,d)),s.isMobile&&this.renderHelpButton()))}renderHelpButton(){return n()(y.Z,{topBorder:!0,disableDesktopPadding:!0},void 0,n()(I.Z,{title:n()(E.FormattedMessage,{id:"inviteUserModal.helpButton.caption",defaultMessage:"Learn how to invite people and set permissions"}),href:(0,_.UY)("guides.invitePerson"),analyticsFrom:"invite_person"}))}renderDesktopInputRightInnerSelect(e){const{permissionsInviteStore:t}=this.stores,i=n()(X,{disabled:this.props.disabled,store:this.props.store,selectedRole:t.state.inviteRole,onChange:e=>t.setState({...t.state,inviteRole:e})});return e?n()("div",{style:e},void 0,i):i}isInputFocusedAndEnabled(){return Boolean(this.stores.permissionsInviteStore.state.isFocused)&&!this.props.disabled}getTokenMenuItemStyle(){const e=8-ie.inputTokenVerticalMargin;return{alignItems:"unset",borderRadius:3,paddingTop:e,paddingBottom:e,paddingLeft:8,paddingRight:e}}getInputTokenVerticalMarginStyle(){return{marginTop:ie.inputTokenVerticalMargin,marginBottom:ie.inputTokenVerticalMargin}}getBadgeStyle(){const{device:e}=this.environment;return{display:"inline-flex",height:18,textTransform:"uppercase",fontSize:10,marginBottom:2,fontWeight:g.Z.fontWeight.medium,letterSpacing:1,color:p.ZP.uiLightGray,border:"1px solid ".concat(p.ZP.uiLightGray),minWidth:ie.inviteButtonWidth,alignItems:"center",justifyContent:"center",paddingTop:e.isAndroid?2:1,paddingBottom:1,paddingLeft:3,paddingRight:3,borderRadius:3}}}l()(ie,"avatarSize",24),l()(ie,"inviteButtonWidth",70),l()(ie,"inputTokenVerticalMargin",3);const se=(0,E.injectIntl)(ie)},92512:(e,t,i)=>{i.d(t,{Z:()=>_});var s=i(98135),a=i.n(s),o=(i(33948),i(13490)),n=i(5366),r=i(77907),l=i(67294),d=i.n(l),c=i(89940),u=i(14598),m=i(95209),p=i(32465),g=i(76464),h=i(1643),f=i(82990),v=i(27832),y=i(27006),M=i(47966),S=i(72693),b=i(58879),T=i(78291),C=i(38755),Z=i(64215),w=i(47714),k=i(46951);const A=({title:e,subtitle:t,on:i,onChange:s,disabled:o,style:n})=>{const r=(0,Z.y)((()=>({container:{display:"flex",alignItems:"center",width:"100%"},title:{fontSize:14,marginRight:8,flexGrow:1}})),[]);return a()("div",{style:{...r.container,...n}},void 0,a()("div",{style:r.title},void 0,e,a()(k.Z,{isSmall:!0,isMultiline:!0,style:{marginTop:2,width:"95%"}},void 0,t)),a()(w.Z,{on:i,disabled:o,onClick:s}))};A.defaultProps={disabled:!1,style:{}};const P=A;var I=i(29368),x=i(64684),F=i(21115);const B={button:{height:32},buttonContainer:{width:"100%",paddingTop:22,display:"flex",justifyContent:"end"},autoAddToggleContainer:{width:"100%",marginTop:22},switcherRow:{marginTop:22},container:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",userSelect:"none",WebkitUserSelect:"none",width:"100%"},title:{paddingBottom:22},full:{width:"100%"}},E=(...e)=>a()("span",{style:{fontWeight:f.Z.fontWeight.semibold}},void 0,e),R=e=>{const{store:t,permissionsInviteStore:i,showInviteAllMembersToggle:s,isAddAllMembersToggled:l,membersOnly:c,onChangeAllMembersInvited:m,totalWorkspaceMembers:p,workspaceName:g}=e,h=a()(r.LazyTeamPermissionsInvite,{store:t,permissionsInviteStore:i,disabled:s&&l,membersOnly:c});return s?d().createElement(d().Fragment,null,a()(u.Z,{title:a()(n.FormattedMessage,g?{id:"sidebarCreateTeamModal.teamScreen.addAllMembers",defaultMessage:"{numMembers, plural, one {Add {numMembers} member of <semibold>{workspaceName}</semibold>} other {Add all {numMembers} members of <semibold>{workspaceName}</semibold>}}",values:{numMembers:p,workspaceName:g,semibold:E}}:{id:"sidebarCreateTeamModal.teamScreen.addAllMembers",defaultMessage:"{numMembers, plural, one {Add {numMembers} member of the current workspace} other {Add all {numMembers} members of the current workspace}}",values:{numMembers:p}}),isSelected:l,onClick:()=>m(!0)},"add_all_members"),a()(u.Z,{title:a()(n.FormattedMessage,{id:"teamPermissionsInviteOverlay.teamScreen.addSpecificPeople",defaultMessage:"Add specific people"}),isSelected:!l,onClick:()=>m(!1)},"select_members"),a()("div",{style:{paddingLeft:24}},void 0,h)):d().createElement(d().Fragment,null,a()(o.Z,{},void 0,a()(n.FormattedMessage,{id:"sidebarCreateTeamModal.teamScreen.inviteTeamMembersLabel",defaultMessage:"Invite team members"})),h)},D=e=>{const{isLoading:t,isNewlyCreatedTeam:i,isDefaultTeamChanged:s,onDismiss:o,onSubmit:r,workspaceMembersToInvite:l}=e;let d=a()(n.FormattedMessage,{id:"teamPermissionsInviteOverlay.inviteModal.done",defaultMessage:"Done"});const c=l>0,u=c||s;return i?c?d=a()(n.FormattedMessage,{id:"teamPermissionsInviteOverlay.inviteModal.inviteNMembers",defaultMessage:"{numMembers, plural, one {Invite {numMembers} member} other {Invite {numMembers} members}}",values:{numMembers:l}}):u||(d=a()(n.FormattedMessage,{id:"teamPermissionsInviteOverlay.inviteModal.skipForNow",defaultMessage:"Skip for now"})):c&&(d=a()(n.FormattedMessage,{id:"teamPermissionsInviteOverlay.inviteModal.addNMembers",defaultMessage:"{numMembers, plural, one {Add {numMembers} member} other {Add {numMembers} members}}",values:{numMembers:l}})),u?a()(S.Z,{style:B.button,onClick:r,disabled:t},void 0,d):a()(M.Z,{style:B.button,onClick:o,disabled:t},void 0,d)},_=e=>{const{store:t,permissionsInviteStore:i,onSubmitSuccessful:s,onDismiss:o,isNewlyCreatedTeam:r}=e,d=(0,b.O7)(),{membersOnly:u,teamName:f,isDefaultTeam:M}=(0,c.VK)((()=>{var e;return{membersOnly:Boolean(t.getDisableGuests()||(null===(e=v.default.state.currentSpaceStore)||void 0===e?void 0:e.getDisableGuests())),teamName:t.getName(),isDefaultTeam:t.isDefault()}}),[t]),[S,Z]=(0,l.useState)(!1),[w,k]=(0,l.useState)(!1),[A,_]=(0,l.useState)(M),L=(0,c.VK)((()=>{var e,i;const s=null===(e=v.default.state.currentSpaceStore)||void 0===e?void 0:e.getRole(),a=!!s&&(0,y.zz)(s),o=t.getValue(),n=Boolean(o&&(0,x.jm)(o)),r=null===(i=v.default.state.currentUserStore)||void 0===i?void 0:i.id,l=Boolean(o&&r&&(0,x.pd)(o,r));return a&&n&&l}),[t]),O=(0,c.VK)((()=>{const e=v.default.state.currentSpaceStore;if(e)return(0,C.getSpaceName)(d,e)}),[d]),U=(0,c.VK)((()=>{const{data:e}=T.default.state;return e?h.su(e):0}),[]),N=S&&L,V=(0,c.VK)((()=>N?U:i.state.inviteTargets.length),[N,U,i]),W=M!==A;return a()("div",{style:{...B.full}},void 0,a()("div",{style:B.container},void 0,a()("div",{style:{...B.title}},void 0,a()(n.FormattedMessage,{id:"sidebarCreateTeamModal.membersTitle.label",defaultMessage:"Add people to {teamName}",values:{teamName:f}})),a()("div",{style:B.full},void 0,a()(R,{store:t,permissionsInviteStore:i,showInviteAllMembersToggle:L,isAddAllMembersToggled:S,membersOnly:u,onChangeAllMembersInvited:Z,totalWorkspaceMembers:U,workspaceName:O})),L&&a()("div",{style:B.autoAddToggleContainer},void 0,a()(I.Z,{size:"100%"}),a()(P,{style:B.switcherRow,title:a()(n.FormattedMessage,{id:"teamPermissionsInviteOverlay.defaultTeams.autoAddPeopleToTeamTitle",defaultMessage:"Auto-add anyone who joins <semibold>{workspaceName}</semibold>",values:{workspaceName:O,semibold:E}}),subtitle:a()(n.FormattedMessage,{id:"teamPermissionsInviteOverlay.defaultTeams.autoAddPeopleToTeamSubtitle",defaultMessage:"New workspace members will be added to this team by default."}),on:A,onChange:()=>{_(!A)},disabled:w})),a()("div",{style:B.buttonContainer},void 0,a()(D,{isLoading:w,onSubmit:async()=>{k(!0);let e=!1;if(N){const i=v.default.state.currentSpaceStore;i&&(e=await g.M9({environment:d,teamStore:t,spaceStore:i}))}else V>0&&(e=await m.z({environment:d,store:t,permissionsInviteStore:i}));if(e){const e=t.getName();e&&(0,F._9)({numMembersAdded:V,teamName:e})}W&&await p.MH({environment:d,teamStore:t,isDefault:A}),m.M({permissionsInviteStore:i}),k(!1),null==s||s()},onDismiss:()=>{m.M({permissionsInviteStore:i}),null==o||o()},isNewlyCreatedTeam:r,isDefaultTeamChanged:W,workspaceMembersToInvite:V}))))}},86100:(e,t,i)=>{i.r(t),i.d(t,{default:()=>l});var s=i(98135),a=i.n(s),o=(i(33948),i(67294),i(89940)),n=i(67719),r=i(92512);const l=function(e){const[t,,i]=(0,o.oR)(e.permissionsInviteStore),s=()=>{i.reset()};return a()(n.Z,{modalStyle:{overflow:"visible",width:500},open:t.modalOpen,onDismiss:s,renderContent:()=>a()("div",{style:{display:"flex",flexDirection:"column",alignItems:"end",padding:22}},void 0,a()(r.Z,{isNewlyCreatedTeam:!1,permissionsInviteStore:i,store:e.store,onSubmitSuccessful:s,onDismiss:s})),origin:e.origin})}},80366:(e,t,i)=>{i.d(t,{s:()=>n,c:()=>r});var s=i(98135),a=i.n(s),o=(i(67294),i(64215));function n(e){return{backgroundColor:e.groupedFormBackground,borderWidth:1,borderStyle:"solid",borderColor:e.groupedFormBorder,borderRadius:3,borderBottomWidth:0}}function r(e){const t=(0,o.y)((t=>({group:{display:"flex",borderBottomColor:t.groupedFormBorder,borderBottomWidth:1,borderBottomStyle:"solid",alignItems:"center",flex:1,...e.style}})),[e.style]);return a()("div",{style:t.group},void 0,e.children)}},75472:(e,t,i)=>{i.d(t,{Aw:()=>f,Nd:()=>v,oP:()=>y,DF:()=>M,Zp:()=>S,jL:()=>b});var s=i(98135),a=i.n(s),o=(i(33948),i(5366)),n=i(47307),r=i(31299),l=(i(67294),i(96486)),d=i.n(l),c=i(15070),u=i(26825),m=i(27006),p=i(19889),g=i(97880),h=i(16639);async function f(e){const t=a()(o.FormattedMessage,{id:"permissionsInvite.closeInviteDialog.confirmationMessage",defaultMessage:"Your changes have not been saved. Discard changes?"}),i=a()(o.FormattedMessage,{id:"permissionsInvite.closeInviteDialog.confirmationButton.label",defaultMessage:"Yes",description:"Label for button that appears below the question, 'Your changes have not been saved. Discard changes?' to confirm that the user would like to discard the changes."}),s=a()(o.FormattedMessage,{id:"permissionsInvite.closeInviteDialog.cancelButton.label",defaultMessage:"Cancel",description:"Label for button that appears below the question, 'Your changes have not been saved. Discard changes?' to confirm that the user does not want to discard the changes."});if(e.inviteTargets.length>0){return!(await n.confirmUserAction({message:t,acceptLabel:i,cancelLabel:s}))}return!1}const v=e=>{const{target:t,permissionsInviteStore:i}=e;return i.state.inviteTargets.find((e=>"newUser"===t.type?"newUser"===e.type&&t.value.email===e.value.email:e.type===t.type&&e.value.id===t.value.id))},y=e=>{const{targetStore:t,permissionsInviteStore:i,usersToInvite:s}=e;if(!s)return{inviteUsers:[],inviteGroups:[],inviteBots:[]};const a=s.inviteUsers.filter((e=>!v({permissionsInviteStore:i,target:e})&&!("existingUser"===e.type&&S({target:e,store:t}))));return{inviteBots:s.inviteBots.filter((e=>!(!e.value.alive||v({permissionsInviteStore:i,target:e})||!(0,c.oA)(e.value)&&!(0,c.c9)(e.value))&&!S({target:e,store:t}))),inviteGroups:s.inviteGroups.filter((e=>!v({permissionsInviteStore:i,target:e})&&!S({target:e,store:t}))),inviteUsers:a}},M=e=>{const{intl:t,target:i}=e;switch(i.type){case"newUser":return i.value.email;case"existingUser":return(0,p.Nz)(t,i.value);case"bot":return(0,c.Mh)(i.value);case"group":return(0,h.k)({intl:t,group:i.value});default:(0,g.t1)(i)}},S=e=>{const{target:t,store:i}=e,s=i.getValue();if(!s)return!1;return(0,u.uO)(s).some((e=>{switch(t.type){case"existingUser":return(0,m.jg)(e)&&e.user_id===t.value.id;case"bot":return(0,m.FB)(e)&&e.bot_id===t.value.id;case"group":return(0,m.hV)(e)&&e.group_id===t.value.id;case"newUser":return!1;default:return(0,g.t1)(t)}}))},b=async e=>{const{query:t,environment:i,sectionLimit:s,shouldShowBots:a,shouldShowGroups:o,intl:n,membersOnly:l}=e,[c,u,m,{user:p,email:g}]=await Promise.all([r.O$({environment:i,query:t,membersOnly:l}),a?r.RF({environment:i,query:t}):[],o?r.$w({query:t,intl:n}):[],r.yy(i,t)]),h=c.slice(0,s).map((e=>({type:"existingUser",value:e}))),f=u.slice(0,s).map((e=>({type:"bot",value:e}))),v=m.slice(0,s).map((e=>({type:"group",value:e})));return p&&h.push({type:"existingUser",value:p}),g&&h.push({type:"newUser",value:{email:g}}),{inviteUsers:d().uniqBy(h,(e=>e.value.email)),inviteBots:f,inviteGroups:v}}},46190:(e,t,i)=>{i.d(t,{Z:()=>s});const s=new(i(61766).Z)},90365:(e,t,i)=>{i.d(t,{Z:()=>s});const s=new(i(61766).Z)},82066:(e,t,i)=>{i.d(t,{Z:()=>s});const s=new(i(61766).Z)},1903:(e,t,i)=>{i.d(t,{Z:()=>n});var s=i(21202),a=i(52016);class o extends a.Z{getInitialState(){return{modalOpen:!1,tokenQuery:"",inviteTargets:[],inviteRole:"editor",isInviteTargetsEmpty:!0,table:s.iU,isFocused:!0}}}const n=o},29026:(e,t,i)=>{i.d(t,{Xv:()=>r,AR:()=>l,ZP:()=>c});var s=i(59713),a=i.n(s),o=(i(33948),i(92338)),n=i(52016);const r=20;let l;!function(e){e.Default="Default",e.Results="Results"}(l||(l={}));class d extends n.Z{constructor(...e){super(...e),a()(this,"resetQuery",(({resetFilters:e})=>{this.setState({...this.state,mode:l.Default,query:{...this.state.query,text:"",...e&&{filters:(0,o.u4)()}},limit:r,allResultsLoaded:!1})})),a()(this,"updateFilters",(e=>{const t=this.state.query.filters,i=(0,o.jl)(t,e);this.state.mode,l.Default,this.setState({...this.state,query:{...this.state.query,filters:i}})}))}getInitialState(){return{mode:l.Default,isSidebarOpen:!1,query:{text:"",filters:(0,o.u4)(),sort:o.As.Relevance},limit:r,allResultsLoaded:!1}}isSidebarOpen(){if(this.state.isSidebarOpen){const{state:e}=this;return!0}return!1}}a()(d,"Mode",l);const c=d},19234:(e,t,i)=>{i.d(t,{gq:()=>s,Le:()=>a});i(96486);function s(e){return e.country&&!a(e.country)?"skip":e.addressLine1&&e.zipCode||e.addressLine1&&e.city&&e.state||e.zipCode?"should_resolve":"insufficient_data"}function a(e){return["US","CA"].includes(e)}}}]);