PageSourceSearch

https://renewcalm-pxvbntr.gamma.site/_next/static/chunks/8518-c564b9d3f9aee05e.js

js renewcalm-pxvbntr.gamma.site collected 2026-10-03 04:09:17 UTC 53,196 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8518],{23312:function(e,i,s){s.d(i,{C:function(){return h}});var n=s(52322),l=s(5389),t=s(56915),o=s(48273),a=s(92619),r=s(64827),c=s(2167),d=s(91012),u=s(80353),x=s(71354),p=s(45650),m=s(5879);let h=e=>{let{invitationCount:i,isOpen:s,onClose:h,onSendInvitationsClick:j,onDiscardClick:g}=e;return s?(0,n.jsxs)(l.u_,{returnFocusOnClose:!1,onClose:h,closeOnOverlayClick:!0,isOpen:!0,isCentered:!0,children:[(0,n.jsx)(t.Z,{}),(0,n.jsxs)(o.h,{children:[(0,n.jsx)(a.x,{children:(0,n.jsx)(m.cC,{id:"tW/kB6",values:{invitationCount:i}})}),(0,n.jsx)(r.o,{}),(0,n.jsx)(c.f,{children:(0,n.jsx)(d.x,{children:(0,n.jsx)(m.cC,{id:"qxNK2k",values:{invitationCount:i}})})}),(0,n.jsx)(u.m,{children:(0,n.jsxs)(x.K,{spacing:2,direction:"row",align:"center",children:[(0,n.jsx)(p.z,{onClick:g,children:(0,n.jsx)(m.cC,{id:"bzSI52"})}),(0,n.jsx)(p.z,{variant:"solid",onClick:j,children:(0,n.jsx)(m.cC,{id:"6dWGPZ",values:{invitationCount:i}})})]})})]})]}):null}},4758:function(e,i,s){s.d(i,{L:function(){return h}});var n=s(52322),l=s(11919),t=s(13061),o=s(8283),a=s(12221),r=s(91012),c=s(53738),d=s(42946),u=s(49929),x=s(9877),p=s(5879),m=s(7985);s(30579);let h=e=>{let{selectedCollaborator:i,idx:s,handleRemoveClick:h}=e,j=i&&(0,m.G)((null==i?void 0:i.email)||""),g=0===s?170:300;return(0,n.jsx)(l.k,{width:0===s?"calc(100% - 100px)":"",className:"searchbartag","data-testid":"searchbartag-collaborator-".concat(i.email),children:(0,n.jsxs)(t.Vp,{size:"md",minW:110,...j?{}:{colorScheme:"red",bg:"red",color:"white"},children:["id"in i?(0,n.jsx)(x.kH,{label:i.email,"aria-label":i.email,children:(0,n.jsxs)(o.U,{children:[(0,n.jsx)(a.q,{size:"2xs",m:0,name:i.displayName,src:i.profileImageUrl}),(0,n.jsx)(r.x,{textTransform:"capitalize",wordBreak:"break-word",noOfLines:1,maxW:g,lineHeight:"1.5",children:i.displayName})]})}):(0,n.jsx)(x.kH,{label:j?i.email:(0,n.jsx)(p.cC,{id:"XILg0L"}),"aria-label":i.email,children:(0,n.jsxs)(o.U,{flex:1,children:[(0,n.jsx)(c.Cd,{bg:j?"trueblue.100":"none",size:6,children:(0,n.jsx)(u.G,{icon:j?d.FU$:d.WV2})}),(0,n.jsx)(r.x,{wordBreak:"break-all",display:"block",height:"100%",width:"100%",noOfLines:1,maxW:g,lineHeight:"1.5",children:i.email})]})}),(0,n.jsx)(t.SD,{onClick:h})]})},"id"in i?i.id:i.email)}},60740:function(e,i,s){s.d(i,{y:function(){return t}});var n=s(81032),l=s(2784);let t=()=>{let{isOpen:e,onOpen:i,onClose:s}=(0,n.q)({id:"sharePanelDisclosure"}),[t,o]=(0,l.useState)("invite");return{isSharePanelOpen:e,onSharePanelOpen:i,onSharePanelClose:s,view:t,setView:o}}},22008:function(e,i,s){s.d(i,{Nj:function(){return e8},t9:function(){return e9},o$:function(){return it},aA:function(){return ib},WQ:function(){return iO}});var n,l=s(52322),t=s(5389),o=s(56915),a=s(48273),r=s(92619),c=s(53738),d=s(64827),u=s(40110),x=s(2167),p=s(71354),m=s(81927),h=s(85982),j=s(45650),g=s(4036),v=s(80353),C=s(11919),b=s(93319),_=s(42946),f=s(49929),y=s(9877),A=s(5879),I=s(2784),R=s(38290),N=s(11550),k=s(67964),O=s(30579),P=s(16710),w=s(29705),E=s(55479),T=s(91012),M=s(84103),D=s(76360),S=s(75342),G=s(8283),U=s(36895),z=s(56920),F=s(37164),L=s(5632),V=s(71113),Y=s(94199),W=s(11050),$=s(15041),K=s(36651),B=s(78462),q=s(46232);let H=e=>{var i;let{title:s,site:n}=e,l="/".concat((0,z.IR)(s||"untitled"));return(null==n?void 0:null===(i=n.routes)||void 0===i?void 0:i.find(e=>e.path===l))&&(l="".concat(l,"-").concat((0,F.x0)(6))),l},Z={variant:"outline",transitionProperty:"all",transitionDuration:"normal",cursor:"pointer",boxShadow:"none",tabIndex:0,_hover:{shadow:"lg",borderColor:"trueblue.300",bg:"trueblue.50"},_focusVisible:{boxShadow:"none",outline:"none"},_focus:{boxShadow:"outline"}},J=e=>{let{doc:i,onCreateSiteClick:s}=e,n=(0,W.z$)(),[t]=(0,R.So6)(),{currentWorkspace:o}=(0,K.SE)(),a=(0,q.zY)(!0),[r]=(0,R.qbt)(),[c,d]=(0,I.useState)(!1),{data:x,loading:m}=(0,R.bBo)({variables:{workspaceId:null==o?void 0:o.id},skip:!(null==o?void 0:o.id)}),h=(0,E.p)(),{push:j}=(0,L.useRouter)(),g=null==x?void 0:x.sites,v=(0,I.useCallback)(async e=>{d(!0);let s=null==g?void 0:g.find(i=>i.id===e),c=i.id;if(!(null==o?void 0:o.id)){console.error("[CopyToSiteModal] No currentWorkspace found");return}let u=H({title:i.title,site:s});await (0,$.iL)(c),t({variables:{duplicateDocInput:{sourceDocId:c,source:R.L17.SitesCopyToSite,title:i.title,orgId:null==o?void 0:o.id,orgAccess:R.y3$.Manage,mainPage:!1,themeId:null}}}).then(i=>{var s;let t=null==i?void 0:null===(s=i.data)||void 0===s?void 0:s.duplicateDoc.id;if(!t){console.error("[CopyToSiteModal] No docId found");return}
1null==n||n.track(W.AA.DOC_COPIED_TO_SITE,{doc_id:c,site_id:e,source:R.L17.SitesCopyToSite}),r({variables:{input:{siteId:e,docId:t,path:u}},refetchQueries:["GetSite"]}).then(()=>{let i=(0,B.yQ)({siteId:e,docId:t,unifiedEditorEnabled:a});console.debug("[CopyToSiteModal] Doc added to site. Adding route then navigating to editor",c),h({position:"top",title:(0,l.jsx)(A.cC,{id:"oMgC5V"}),description:(0,l.jsx)(A.cC,{id:"/qBkEJ"}),status:"success",duration:5e3}),j(i)}).catch(e=>{h({position:"top",title:"Error",description:e.message,status:"error",duration:5e3}),d(!1)}).finally(()=>{d(!1)})}).catch(e=>{h({position:"top",title:"Error",description:e.message,status:"error",duration:5e3}),d(!1)})},[n,null==o?void 0:o.id,i.id,i.title,t,j,r,g,h,a]),y=m||c;return(0,l.jsxs)(l.Fragment,{children:[y&&(0,l.jsx)(C.k,{w:"100",h:"400px",maxH:"30vh",children:(0,l.jsx)(V.AA,{})}),!y&&(0,l.jsxs)(p.K,{spacing:4,children:[(0,l.jsxs)(p.K,{pt:2,pb:2,children:[(0,l.jsx)(T.x,{fontSize:"sm",letterSpacing:"normal",color:"gray.600",fontWeight:"500",children:(0,l.jsx)(A.cC,{id:"g3e5hy",values:{GAMMA_ARTIFACT_PROPER_NOUN:Y.Yc}})})," ",(0,l.jsxs)(T.x,{fontSize:"xs",letterSpacing:"normal",color:"gray.600",fontWeight:"500",children:[(0,l.jsx)(A.cC,{id:"Fdj1VM",values:{GAMMA_ARTIFACT_PROPER_NOUN:Y.Yc},components:{0:(0,l.jsx)("strong",{})}}),(0,l.jsxs)(M.r,{href:"https://help.gamma.app/en/articles/8429268-how-to-publish-your-page-to-a-custom-domain",textDecoration:"underline",isExternal:!0,color:"trueblue.500",children:[(0,l.jsx)(A.cC,{id:"Px95UX"}),(0,l.jsx)(w.h,{mx:"2px"})]})," "]})]}),g&&g.length>0&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(T.x,{fontSize:"sm",letterSpacing:"normal",color:"gray.600",fontWeight:"500",children:(0,l.jsx)(A.cC,{id:"KTpbiY",values:{GAMMA_ARTIFACT_PROPER_NOUN:Y.Yc}})}),null==g?void 0:g.map(e=>(0,l.jsx)(D.Z,{onClick:()=>v(e.id),onKeyPress:i=>{"Enter"===i.key&&v(e.id)},...Z,children:(0,l.jsx)(S.e,{children:(0,l.jsxs)(G.U,{children:[(0,l.jsx)(p.K,{spacing:0,children:(0,l.jsxs)(G.U,{children:[e.faviconUrl&&(0,l.jsx)(U.E,{w:"4",src:e.faviconUrl}),(0,l.jsx)(T.x,{fontWeight:"600",children:e.name})]})}),(0,l.jsx)(b.L,{}),(0,l.jsx)(f.G,{icon:_.eFW})]})})},e.id)),(0,l.jsxs)(G.U,{children:[(0,l.jsx)(u.i,{}),(0,l.jsx)(T.x,{fontSize:"sm",color:"gray.500",children:(0,l.jsx)(A.cC,{id:"ZAVklK"})}),(0,l.jsx)(u.i,{})]})]}),(0,l.jsx)(D.Z,{onClick:()=>{s()},onKeyPress:e=>{"Enter"===e.key&&s()},...Z,children:(0,l.jsx)(S.e,{children:(0,l.jsxs)(G.U,{children:[(0,l.jsxs)(p.K,{spacing:0,children:[(0,l.jsx)(T.x,{fontWeight:"600",children:(0,l.jsx)(A.cC,{id:"31WSA3"})}),(0,l.jsx)(G.U,{children:(0,l.jsx)(T.x,{fontSize:"sm",color:"gray.500",children:(0,l.jsx)(A.cC,{id:"zz0nEd",values:{GAMMA_ARTIFACT_PROPER_NOUN:Y.Yc}})})})]}),(0,l.jsx)(b.L,{}),(0,l.jsx)(f.G,{icon:_.r8p})]})})})]})]})};var X=s(46759),Q=s(90221),ee=s(94659),ei=s(42111),es=s(25566),en=s(75652),el=s.n(en),et=s(14274),eo=s(91994),ea=s(47968);let er=(e,i)=>"".concat(et.v.API_HOST||"","/export/docs/").concat(e,"/").concat(i),ec=async(e,i,s)=>{let n=er(e,s);return fetch(n,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json","share-token":et.v.SHARE_TOKEN||""},body:JSON.stringify({docContent:i})})},ed=function(e,i,s){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"pdf",t=(0,E.p)(),o=(0,I.useRef)(null),a=(0,W.z$)(),[r,c]=(0,I.useState)(!1),d=(0,I.useCallback)(()=>{o.current=t({id:"export-toast-".concat(e.id,"-").concat(n),isClosable:!1,position:"top",duration:null,status:"loading",variant:"light",title:(0,l.jsx)(A.cC,{id:"eJOEBy"})})},[null==e?void 0:e.id,t,n]),u=(0,I.useCallback)(()=>{o.current&&t.update(o.current,{status:"loading",variant:"light",title:(0,l.jsx)(A.cC,{id:"eJOEBy"}),description:(0,l.jsx)(A.cC,{id:"vMANwD"}),isClosable:!0})},[t,n]),x=(0,I.useCallback)(()=>{o.current&&t.update(o.current,{title:(0,l.jsx)(A.cC,{id:"walT1X"}),status:"error",duration:null,isClosable:!0})},[t]),p=(0,I.useCallback)(e=>{o.current&&t.update(o.current,{status:"success",title:(0,l.jsx)(A.cC,{id:"pK8dQg"}),description:(0,l.jsx)(T.x,{children:(0,l.jsx)(A.cC,{id:"MTtTC2",components:{0:(0,l.jsx)(M.r,{textDecoration:"underline",target:"_blank",href:e||void 0,onClick:()=>o.current&&t.close(o.current)})}})}),isClosable:!0})},[t,n]),m=(0,I.useCallback)(()=>{let l=null==s?void 0:s.getJSON();c(!0),d();let t=setTimeout(u,3e4);ec(e.id,l,n).then(async s=>{var l;let t=await s.blob();if(!s.ok)throw Error("Export failed.");let o="pdf"===n?W.AA.PDF_EXPORTED:W.AA.PPTX_EXPORTED;null==a||a.track(o,{doc_id:e.id,source:i}),p(decodeURIComponent(s.headers.get("x-gamma-download-url")||"")||void 0);let r=window.URL.createObjectURL(t),c=document.createElement("a"),d=decodeURIComponent((null===(l=(s.headers.get("Content-Disposition")||"").split(";").find(e=>e.includes("filename=")))||void 0===l?void 0:l.replace("filename=","").trim())||"".concat(e.id,".").concat(n));c.download=d,c.href=r,c.style.display="none",document.body.appendChild(c),c.click(),c.remove()}).catch(()=>{x()}).finally(()=>{c(!1),clearTimeout(t)})},[a,null==e?void 0:e.id,s,i,n,x,d,u,p]);return{handleExport:m,exportInProgress:r}},eu=e=>{let i=(0,eo.CG)(ea.Pu),s=e.theme||i,n=(0,I.useMemo)(()=>{let e=s.fonts?[...s.fonts]:[];return e.length<2&&e.push({id:"Inter",name:"Inter",url:"https://fonts.googleapis.com/css2?family=Inter"}),el()(e).map(e=>{var i;return(null===(i=e.url)||void 0===i?void 0:i.includes("fonts.googleapis.com"))?{name:e.name,url:"https://fonts.google.com/specimen/".concat(e.name)}
1:{name:e.name}}).filter(e=>!!e)},[s]);return n};var ex=s(69747),ep=s(68727),em=s(60536);let eh=e=>{let{doc:i,editor:s,onSharePanelOpen:n,onSharePanelClose:t,isMultipage:o=!1}=e,a=(0,ei.ye)("pptExport"),r=(0,K.py)("edit",i);return(0,l.jsxs)(ee.g,{spacing:4,align:"start",pt:2,children:[(0,l.jsx)(T.x,{fontSize:"sm",color:"gray.600",children:o?(0,l.jsx)(A.cC,{id:"QI+Cf0",values:{0:i.title},components:{0:(0,l.jsx)("strong",{})}}):(0,l.jsx)(A.cC,{id:"qwhOQ/",values:{GAMMA_ARTIFACT_PROPER_NOUN:Y.Yc}})}),(0,l.jsxs)(p.K,{spacing:2,width:"100%",children:[(0,l.jsx)(eg,{format:"pdf",label:"PDF",icon:_.gSj,accentColor:"red",doc:i,editor:s}),a&&(0,l.jsx)(eg,{format:"pptx",label:"PowerPoint",icon:_.WOY,accentColor:"orange",doc:i,editor:s})]}),a&&(0,l.jsx)(ej,{doc:i}),s&&r&&(0,l.jsx)(T.x,{fontSize:"sm",color:"gray.600",children:(0,l.jsx)(A.cC,{id:"8LhjM/",components:{0:(0,l.jsx)(j.z,{variant:"link",as:"span",size:"sm",cursor:"pointer",onClick:()=>{t(),ex.pw.emit(ex.TI.OPEN_PAGE_SETUP,"cards")}})}})}),(0,l.jsx)(em.V,{onClose:t,onOpen:n,segmentEvent:es.AA.GAMMA_PRO_UPSELL_EXPORT_SETTINGS_REMOVE_WATERMARK,doc:i})]})},ej=e=>{let{doc:i}=e,s=eu(i);return s.length?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(T.x,{fontSize:"sm",color:"gray.600",children:(0,l.jsx)(A.cC,{id:"5qYpE7"})}),(0,l.jsx)(G.U,{children:s.map(e=>{let{name:i,url:s}=e;return(0,l.jsx)(c.xu,{border:"1px",borderColor:"gray.200",borderRadius:"md",h:"auto",_hover:s?{boxShadow:"var(--chakra-shadows-md)",borderColor:"var(--chakra-colors-trueblue-300)",color:"var(--chakra-colors-trueblue-400)"}:{},onClick:s?()=>window.open(s,"_blank"):void 0,cursor:s?"pointer":void 0,children:(0,l.jsxs)(G.U,{p:3,paddingRight:4,spacing:4,children:[(0,l.jsx)(T.x,{fontWeight:"medium",children:i}),s&&(0,l.jsx)(f.G,{icon:_.wlW,size:"1x"})]})},"name")})})]}):null},eg=e=>{let{format:i,doc:s,editor:n,icon:t,accentColor:o,label:a,badge:r}=e,{handleExport:c,exportInProgress:d}=ed(s,"share_panel",n,i);return(0,l.jsx)(ep.j,{onClick:c,icon:t,formatLabel:a,accentColor:o,exportInProgress:d,exportInProgressNote:(0,l.jsx)(A.cC,{id:"57bp6s"}),badge:r})};var ev=s(49747),eC=(s(97907),s(50390)),eb=s(72360),e_=s(48322),ef=s(12221),ey=(s(82655),s(54933)),eA=s(87254),eI=s(1842),eR=s.n(eI),eN=s(21979),ek=s(16893),eO=s(20336),eP=s(84405),ew=s(93441),eE=s(89458),eT=s(88640),eM=s(8174);let eD=e=>{let{icon:i,showDisabled:s=!1}=e;return(0,l.jsx)(c.Cd,{color:"gray.800",textAlign:"center",bg:"gray.200",size:8,opacity:s?.5:1,children:s?(0,l.jsxs)("span",{className:"fa-stack",children:[(0,l.jsx)(f.G,{icon:_.u6k,className:"fa-stack-1x"}),(0,l.jsx)(f.G,{icon:i,className:"fa-stack-1x"})]}):(0,l.jsx)(f.G,{size:"1x",icon:i})})},eS=e=>{let{channel:i,doc:s,isDisabled:n,showDisabledIcon:t=!1}=e,{removeDocChannel:o}=(0,eM.Z)(),a=(0,I.useCallback)(()=>{s&&o(s,i.id)},[i.id,s,o]),r=(0,B.j)({slug:i.slug,id:i.id});return(0,l.jsxs)(G.U,{py:2,w:"100%",justify:"space-between","data-testid":"workspace-row-".concat(i.id),children:[(0,l.jsx)(c.xu,{children:(0,l.jsxs)(C.k,{alignItems:"center",children:[(0,l.jsx)(eD,{icon:O.Ty,showDisabled:t}),(0,l.jsx)(c.xu,{ml:3,opacity:t?.5:1,children:(0,l.jsx)(M.r,{href:r,target:"_blank",children:i.name})})]})}),(0,l.jsx)(j.z,{size:"sm",variant:"ghost",colorScheme:"red",onClick:a,isDisabled:n,children:(0,l.jsx)(A.cC,{id:"t/YqKh"})})]},i.id)};var eG=s(46949),eU=s(76648),ez=s(21891),eF=s(420),eL=s(35316),eV=s(46028),eY=s(38421),eW=s.n(eY);let e$=e=>{let{workspaceId:i,docId:s,existingChannels:n,isDisabled:t}=e,o=(0,I.useRef)(null),[a,r]=(0,I.useState)(""),[d,u]=(0,I.useState)([]),[x,m]=(0,I.useState)(!1),{addDocChannel:h}=(0,eM.Z)(),{data:j,loading:g}=(0,R.Kce)({variables:{query:a,workspaceId:i},skip:!a});(0,I.useEffect)(()=>{if(g||!j)return;let e=j.search.filter(Boolean);u(e),m(0===e.length)},[j,g]);let v=(0,I.useMemo)(()=>a?d.filter(e=>!n.find(i=>i.id===e.id)):[],[n,a,d]),b=(0,I.useCallback)(e=>{let i=v.find(i=>i.id===e);if(!i){console.error("[ChannelSearchBar.addSelectedChannel] No matching channel found");return}h({docId:s,channel:i,existingChannels:n})},[h,s,n,v]);return(0,l.jsx)(eU.h,{w:"100%",mb:2,alignItems:"flex-start","data-testid":"sharepanel-channel-search-bar",children:(0,l.jsx)(c.xu,{flex:1,children:(0,l.jsxs)(ez.B,{w:"100%",justifyContent:"center",zIndex:1,children:[(0,l.jsx)(C.k,{display:"none",position:"absolute",h:"100%",w:"100%",alignItems:"center",justifyContent:"center",bg:"gray.300",zIndex:"overlay",opacity:.4,children:(0,l.jsx)(eF.$,{})}),(0,l.jsxs)(eV.Qc,{rollNavigation:!0,multiple:!0,emptyState:()=>!!x&&(0,l.jsxs)(C.k,{direction:"column",justify:"center",align:"center",w:"100%",my:6,children:[(0,l.jsx)(c.xu,{w:"80%",maxW:"200px",mb:6,alignContent:"center",children:(0,l.jsx)(eW(),{src:"/images/Sal-Fishing-2x.png",width:"640",height:"361",alt:"Sal, the Gamma mascot, fishing extraterrestrially"})}),(0,l.jsx)(eC.X,{size:"xs",mb:2,textAlign:"center",children:(0,l.jsx)(A.cC,{id:"NmfOr+"})}),(0,l.jsx)(T.x,{fontSize:"sm",color:"gray.400",textAlign:"center",children:(0,l.jsx)(A.cC,{id:"kXnLEt"})})]}),suggestWhenEmpty:!1,openOnFocus:!0,filter:()=>!0,onSelectOption:e=>{let{item:i}=e;b(i.value),r("")},children:[(0,l.jsxs)(eL.Z,{pointerEvents:"none",color:"gray.300",h:"100%",flexDirection:"column",children:[(0,l.jsx)(C.k,{flex:1}),(0,l.jsx)(C.k,{h:10,py:4,alignItems:"center",children:(0,l.jsx)(eG.W,{w:10})})]}),(0,l.jsx)(eV.Vp,{ref:o,"data-testid":"autocomplete-channels-input",cursor:t?"not-allowed":void 0,disabled:t,w:"100%",pl:5,wrapStyles:{px:2}
1,fontSize:"md",placeholder:eA.ag._({id:"KmCmUJ"}),transition:"width 1s ease-in-out",value:a,onChange:e=>{let{target:i}=e,{value:s}=i;r(s),s||u([])}}),(0,l.jsx)(eV.Jm,{w:"100%",mt:0,display:a.length>0?"flex":"none",children:v.length>0&&v.map(e=>{let{id:i,name:s,memberCount:n,isMember:t,members:o}=e;return(0,l.jsx)(eV.Gb,{"data-testid":"autocomplete-item-channel-".concat(i),value:{id:e.id},getValue:e=>e.id,align:"center",_focus:{bg:"trueblue.50"},children:(0,l.jsxs)(G.U,{spacing:4,p:0,flex:1,children:[(0,l.jsx)(c.xu,{color:"gray.700",children:(0,l.jsx)(f.G,{icon:O.Ty})}),(0,l.jsxs)(p.K,{spacing:0,flex:"1",children:[(0,l.jsx)(T.x,{children:s}),(0,l.jsx)(T.x,{fontSize:"sm",color:"gray.400",children:t?(0,l.jsx)(A.cC,{id:"tWPlLK",values:{0:n||0}}):(0,l.jsx)(A.cC,{id:"pkIIls",values:{0:n||0}})})]}),(0,l.jsx)(y.NL,{size:"xs",overflowTooltipLabel:eA.ag._({id:"25VyZX"}),avatars:o||[],max:3,onClick:e=>{e.preventDefault(),e.stopPropagation()}})]})},i)})})]})]})})})};var eK=s(81032),eB=s(4448),eq=s(7985),eH=s(41004),eZ=s(99016),eJ=s(23312),eX=s(80498),eQ=s(62549),e0=s(9088),e1=s(30893),e3=s(40771),e5=s(63849),e2=s(2575),e4=s(95258),e6=s(82904);(n||(n={})).NoAccess="no_access";let e8={[R.y3$.Manage]:{title:()=>eA.ag._({id:"DZfDCl"}),description:()=>eA.ag._({id:"r59J7Q"})},[R.y3$.Edit]:{title:()=>eA.ag._({id:"ePK91l"}),description:()=>eA.ag._({id:"kuZsYI"})},[R.y3$.Comment]:{title:()=>eA.ag._({id:"NBdIgR"}),description:()=>eA.ag._({id:"IwFh5+"})},[R.y3$.View]:{title:()=>eA.ag._({id:"jpctdh"}),description:()=>eA.ag._({id:"yzFEXd"})},[n.NoAccess]:{title:()=>eA.ag._({id:"oPoLg+"}),description:()=>eA.ag._({id:"Vcif8/"})}},e9=e=>{let{isDisabled:i,options:s,disabledOptions:t=[],selected:o,variant:a="ghost",onClick:r=()=>{},onRemove:d}=e;return(0,l.jsxs)(e0.v,{closeOnSelect:!0,children:[(0,l.jsx)(e1.j,{"data-testid":"permission-menu-value-".concat(o),as:j.z,display:"flex",size:"sm",isDisabled:i,variant:a,rightIcon:(0,l.jsx)(f.G,{icon:_.ptq}),children:e8[o||n.NoAccess].title()}),(0,l.jsx)(e3.q,{textAlign:"left",zIndex:"overlay",children:(0,l.jsxs)(e5._,{defaultValue:o,value:o,title:eA.ag._({id:"9cDpsw"}),type:"radio",onChange:e=>{r(e)},children:[s.map(e=>{let i=t.find(i=>i.permission===e),s=i&&i.reason;return(0,l.jsx)(e2.i,{isDisabled:!!i,value:e,alignItems:"start",pt:3,children:(0,l.jsx)(y.kH,{label:s,"aria-label":s,isDisabled:!i,placement:"top",children:(0,l.jsxs)(c.xu,{children:[(0,l.jsx)(T.x,{mt:-1,children:e8[e].title()}),(0,l.jsx)(T.x,{fontSize:"sm",color:"gray.500",mt:1,children:e8[e].description()})]})},e)},e)}),d&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(e4.R,{}),(0,l.jsx)(e6.s,{color:"red.500",onClick:d,icon:(0,l.jsx)(f.G,{icon:_.XAH,fixedWidth:!0}),children:(0,l.jsx)(A.cC,{id:"t/YqKh"})})]})]})})]})};var e7=s(4758);let ie=(0,eH.E)(c.xu),ii=(e,i,s)=>{if(!s)return e;let n=[...e],l=e.findIndex(e=>"email"in e&&e.email===s),t=i.find(e=>e.email===s);return -1!==l&&n.splice(l,1),[...n,t||{email:s}]},is=(e,i)=>{let s=(0,eQ.Hs)(i.map(e=>"displayName"in e?e.displayName:e.email),3);
1return e===R.y3$.Manage?eA.ag._({id:"4bKxWq",values:{userNames:s,GAMMA_ARTIFACT_PROPER_NOUN:Y.Yc,0:i.length}}):e===R.y3$.Edit?eA.ag._({id:"3rbi6Y",values:{userNames:s,GAMMA_ARTIFACT_PROPER_NOUN:Y.Yc,0:i.length}}):e===R.y3$.Comment?eA.ag._({id:"uGWY40",values:{userNames:s,GAMMA_ARTIFACT_PROPER_NOUN:Y.Yc,0:i.length}}):e===R.y3$.View?eA.ag._({id:"p5IG6F",values:{userNames:s,GAMMA_ARTIFACT_PROPER_NOUN:Y.Yc,0:i.length}}):eA.ag._({id:"Ai1TAT",values:{userNames:s,GAMMA_ARTIFACT_PROPER_NOUN:Y.Yc,0:i.length}})},il=e=>{let{workspaceId:i,docId:s,user:n,existingDocCollaborators:t,existingInvitations:o,registerDoneFn:a,isDisabled:r}=e,d=(0,E.p)(),[u,x]=(0,I.useState)(!1),p=(0,I.useRef)(),m=(0,I.useRef)(null),[h,g]=(0,I.useState)(""),[v,b]=(0,I.useState)([]),[N,k]=(0,I.useState)(R.y3$.Manage),[O,P]=(0,I.useState)(new eX.B),[w,M]=(0,I.useState)([]),D=w.filter(e=>"email"in e),S=t.map(e=>e.user),{isOpen:U,onOpen:z,onClose:F}=(0,eK.q)({id:"unsentInvitationsModalDisclosure"}),[L,{loading:V,error:Y}]=(0,R.qVw)();(0,ew.GJ)("Error inviting collaborators.",Y);let W=(0,eZ.j)(R.aAR),{data:$,loading:K}=(0,R.PGi)({variables:{query:h,workspaceId:i},skip:!h});(0,I.useEffect)(()=>{if(K||!$)return;let e=$.search.filter(Boolean);b(e)},[$,K]);let B=(0,I.useMemo)(()=>h?v.filter(e=>"User"===e.__typename&&e.id!==n.id&&!D.concat(S).find(i=>i.email===e.email)):[],[v,S,h,D,n.id]),q=!!h&&!B.find(e=>e.email===h),H=N===R.y3$.Manage&&D.some(e=>!("__typename"in e&&"User"===e.__typename)),Z=w.concat({email:h}).filter(e=>!("email"in e)||(0,eq.G)(e.email||"")),J=!!w.length,X=!!Z.length;(0,I.useEffect)(()=>{a(()=>()=>(X?z():O.resolve(),O.promise))},[a,O,X,z]);let Q=(0,I.useCallback)(async e=>{x(!0),M(i=>e.reduce((e,i)=>ii(e,B,i.trim()),i));let s=(await Promise.all(e.map(e=>W({workspaceId:i,query:e}).then(i=>{var s;return null===(s=i.data)||void 0===s?void 0:s.search.find(i=>"User"===i.__typename&&i.email===e)})))).filter(Boolean);M(i=>e.reduce((e,i)=>ii(e,s,i.trim()),i)),x(!1)},[B,W,i]),ee=(0,I.useCallback)(async()=>{if(0===D.length)return;let e=ii(D,B,h.trim()).filter(e=>"email"in e&&(0,eq.G)(e.email||"")),i=[...t,...e.map(e=>{if("id"in e)return{docId:s,user:e,guest:!1,permission:N,__typename:"DocCollaborator"}})].filter(e=>!!e),l=[...o,...e.map(e=>{if("id"in e)return;let i={id:"temp",docTitle:"temp-title",invitedBy:n,docId:s,email:e.email,permission:N,__typename:"DocInvitation"};return i})].filter(e=>!!e);return L({variables:{docId:s,collaborators:e.map(e=>{let i="id"in e?{userId:e.id}:{email:e.email};return{...i,permission:N}})},update:(e,i)=>{let{data:n}=i;e.writeFragment({id:"Doc:".concat(s),fragment:R.yAO,data:null==n?void 0:n.addCollaborators})},optimisticResponse:{addCollaborators:{id:s,collaborators:i,invitations:l}}}).then(()=>{let i=eA.ag._({id:"Ka86rB",values:{0:e.length}}),s=is(N,e);d({title:i,description:s,status:"success",duration:5e3,isClosable:!0,position:"top"})})},[L,s,h,N,B,D,t,o,d,n]),ei=(0,I.useCallback)(async()=>Promise.all([ee()]).then(()=>{var e;M([]),g(""),null===(e=p.current)||void 0===e||e.resetItems(!0),O.resolve(),P(new eX.B)}).catch(e=>{console.warn(e)}),[ee,O]),es=r||V||u;return(0,l.jsxs)(eU.h,{w:"100%",mb:2,alignItems:"flex-start","data-testid":"sharepanel-search-bar",children:[(0,l.jsx)(c.xu,{flex:1,children:(0,l.jsxs)(ez.B,{w:"100%",justifyContent:"center",zIndex:2,children:[(0,l.jsx)(C.k,{display:u?"flex":"none",position:"absolute",h:"100%",w:"100%",alignItems:"center",justifyContent:"center",bg:"gray.300",zIndex:"overlay",opacity:.4,children:(0,l.jsx)(eF.$,{})}),(0,l.jsxs)(eV.Qc,{ref:p,values:w,maxSelections:100,maxSuggestions:20,creatable:!0,multiple:!0,freeSolo:!0,suggestWhenEmpty:!1,openOnFocus:!0,filter:(e,i)=>!D.find(e=>e.email===i),onSelectOption:e=>{let{item:i}=e,{type:s}=i.originalValue;"collaborator"===s&&M(e=>ii(e,B,i.value)),g("")},onTagRemoved:e=>{M(i=>[...i].filter(i=>"email"in i?i.email!==e:!("id"in i)||i.id!==e))},children:[(0,l.jsxs)(eL.Z,{pointerEvents:"none",color:"gray.300",h:"100%",flexDirection:"column",children:[(0,l.jsx)(C.k,{flex:1}),(0,l.jsx)(C.k,{h:10,py:4,alignItems:"center",children:(0,l.jsx)(eG.W,{w:10})})]}),(0,l.jsx)(eV.Vp,{ref:m,"data-testid":"autocomplete-collaborators-input",cursor:es?"not-allowed":void 0,disabled:es,w:"100%",pl:5,wrapStyles:{px:2}
1,fontSize:"md",placeholder:eA.ag._({id:"P8H57Z"}),transition:"width 1s ease-in-out",value:h,onKeyDown:e=>{let{key:i}=e;if("Backspace"===i&&0===h.length&&w.length>0){let e=w.slice(-1).pop();if(e){var s;null===(s=p.current)||void 0===s||s.removeItem("email"in e?e.email:e.id)}}},onPaste:e=>{e.preventDefault(),e.stopPropagation();let i=e.clipboardData.getData("Text"),s=i.trim().split(/[,|;\s]+/);Q(s),g(""),b([])},onChange:e=>{let{target:i}=e,{value:s}=i;g(s),s||b([])},children:w.map((e,i)=>(0,l.jsx)(e7.L,{idx:i,selectedCollaborator:e,handleRemoveClick:()=>{var i;null===(i=p.current)||void 0===i||i.removeItem(e.email)}},"id"in e?e.id:e.email))}),(0,l.jsx)(eV.Jm,{w:"100%",mt:0,display:h.length>0?"flex":"none",children:B.map(e=>{let{id:i,email:s,displayName:n,profileImageUrl:t}=e;return(0,l.jsx)(eV.Gb,{fixed:!0,"data-testid":"autocomplete-item-user-".concat(i),value:{email:s,type:"collaborator"},getValue:e=>e.email,align:"center",_focus:{bg:"trueblue.50"},children:(0,l.jsxs)(G.U,{children:[(0,l.jsx)(ef.q,{size:"sm",name:n,src:t}),(0,l.jsxs)(c.xu,{children:[(0,l.jsx)(T.x,{textTransform:"capitalize",children:n}),(0,l.jsx)(T.x,{fontSize:"xs",color:"gray.500",children:null==s?void 0:s.toLowerCase()})]})]})},i)}).concat((0,l.jsx)(eV.Gb,{value:{email:h,type:"collaborator"},align:"center",display:q?"flex":"none",_focus:{bg:"trueblue.50"},children:(0,l.jsxs)(G.U,{children:[(0,l.jsx)(c.Cd,{bg:"trueblue.100",size:8,children:(0,l.jsx)(f.G,{icon:_.FU$})}),(0,l.jsx)(T.x,{size:"md",children:h})]})},h))})]}),(0,l.jsx)(eB.p,{in:J,unmountOnExit:!0,children:(0,l.jsx)(eL.x,{w:"auto",justifyContent:"flex-end",pr:1,children:(0,l.jsx)(e9,{isDisabled:V,options:[R.y3$.Manage,R.y3$.Edit,R.y3$.Comment,R.y3$.View],variant:"ghost",selected:N,onClick:e=>k(e)})})})]})}),(0,l.jsx)(ie,{overflowX:"hidden",mr:-2,transition:"slow",animate:{maxWidth:J?"200px":"0px"},children:(0,l.jsx)(y.kH,{label:(0,l.jsx)(A.cC,{id:"Rxin92"}),"aria-label":eA.ag._({id:"Rxin92"}),isDisabled:!H,placement:"top",children:(0,l.jsx)(c.xu,{children:(0,l.jsx)(j.z,{variant:"solid",onClick:ei,isDisabled:!X||H,isLoading:V,"data-testid":"add-selected-items",children:(0,l.jsx)(A.cC,{id:"m16xKo"})})})})}),(0,l.jsx)(eJ.C,{invitationCount:Z.length,onDiscardClick:()=>{F(),O.resolve(),P(new eX.B)},onSendInvitationsClick:()=>{F(),ei()},onClose:()=>{F(),O.reject(),P(new eX.B)},isOpen:U})]})},it=e=>{let{title:i,subtitle:s,img:n,isDisabled:t=!1,disabledText:o,tooltipText:a,testId:r,infoIcon:d,permissionsControl:u,workspaceGuestInvite:x}=e,p="string"==typeof s?(0,l.jsx)(T.x,{fontSize:"xs",color:"gray.500",children:s}):s,m=(0,l.jsx)(y.kH,{isDisabled:!a,label:a,placement:"top",children:(0,l.jsx)(c.xu,{children:u})});return(0,l.jsxs)(G.U,{w:"100%",justify:"space-between",py:2,"data-testid":"permission-settings-row".concat(r?"-"+r:""),children:[(0,l.jsx)(c.xu,{children:(0,l.jsxs)(C.k,{alignItems:"center",children:[n,(0,l.jsxs)(c.xu,{ml:3,children:[(0,l.jsx)(T.x,{children:i}),(0,l.jsxs)(C.k,{align:"center",children:[x&&x,p&&p]})]})]})}),(0,l.jsx)(c.xu,{children:(0,l.jsx)(y.kH,{isDisabled:!a,label:(0,l.jsx)(T.x,{children:a}),placement:"top",children:t?(0,l.jsx)(T.x,{size:"sm",color:"gray.500","data-testid":"permission-controls-disabled-".concat(r),children:o}):d?(0,l.jsxs)(G.U,{children:[d,m]}):m})})]})},io=e=>{let{children:i,showDivider:s=!0,...n}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(ee.g,{spacing:1,align:"stretch",py:4,...n,children:i}),s&&(0,l.jsx)(u.i,{})]})},ia=e=>{let{subtitle:i,tooltipLabel:s,ariaLabel:n,icon:t}=e;return(0,l.jsxs)(G.U,{spacing:1,align:"center",children:[(0,l.jsx)(T.x,{fontSize:"xs",color:"gray.500",children:i}),(0,l.jsx)(y.kH,{label:s,placement:"top","aria-label":n,children:(0,l.jsx)(c.xu,{color:"gray.500",lineHeight:"1",children:(0,l.jsx)(f.G,{size:"xs",icon:t})})})]})};var ir=s(54728),ic=s(51434),id=s(91333),iu=s(10344),ix=s(23742),ip=s(83897);let im=e=>{let{email:i,name:s,workspaceName:n,workspaceId:t}=e,[o]=(0,R.f4M)(),[a,r]=(0,I.useState)(!1),c=(0,E.p)();return(0,l.jsx)(ir.J,{closeOnBlur:!0,children:e=>{let{onClose:d}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(ic.x,{children:(0,l.jsx)(j.z,{leftIcon:(0,l.jsx)(f.G,{icon:_.Gg}),size:"xs",colorScheme:"gray",mr:1,px:2,h:"auto",py:1,children:(0,l.jsx)(A.cC,{id:"O1wAlQ"})})}),(0,l.jsxs)(id.y,{bg:"white",children:[(0,l.jsx)(iu.Q,{}),(0,l.jsx)(ix.Y,{fontWeight:"bold",children:(0,l.jsx)(A.cC,{id:"XYV7FR"})}),(0,l.jsxs)(ip.b,{children:[(0,l.jsx)(T.x,{fontSize:"sm",children:(0,l.jsx)(A.cC,{id:"hJZ5XP",values:{name:s,workspaceName:n,GAMMA_ARTIFACT_PROPER_NOUN_PLURAL:Y.aq}})}),(0,l.jsx)(j.z,{isDisabled:a,w:"100%",mt:2,onClick:()=>{t&&i&&(r(!0),o({variables:{workspaceId:t,invitees:[{email:i}]}}).then(()=>
1{c({title:eA.ag._({id:"oNCcm2"}),status:"success",duration:5e3,isClosable:!0,position:"top"})}).catch(e=>{console.error(e),c({title:eA.ag._({id:"h37zlR",values:{0:e.message}}),status:"error",isClosable:!0,position:"top"})}).finally(()=>{r(!1),d()}))},children:(0,l.jsx)(A.cC,{id:"qVqqmP"})})]})]})]})}})},ih=()=>({view:{subtitle:eA.ag._({id:"ihPQra"}),tooltip:(0,O.tN)()},comment:{subtitle:eA.ag._({id:"qPZYdC"}),tooltip:eA.ag._({id:"oKPro/",values:{0:(0,O.tN)()}})},edit:{subtitle:eA.ag._({id:"TVFcVE"}),tooltip:eA.ag._({id:"2gPY9r",values:{0:(0,O.tN)()}})}}),ij=(e,i)=>{var s,n;let l="DocCollaborator"===e.__typename?null===(s=e.user.displayName)||void 0===s?void 0:s.toUpperCase():"DocInvitation"===e.__typename?e.email.toUpperCase():"",t="DocCollaborator"===i.__typename?null===(n=i.user.displayName)||void 0===n?void 0:n.toUpperCase():"DocInvitation"===i.__typename?i.email.toUpperCase():"";return!t||l&&l<t?-1:!l||t&&l>t?1:0},ig=(e,i)=>{if(e.permission!==i.permission){if("manage"===e.permission)return -1;if("manage"===i.permission)return 1}return ij(e,i)},iv=e=>{var i,s,t;let{workspaceId:o,isFromOtherOrg:a,doc:r,user:d,setVerifySearchDone:u,canManage:x}=e,p=(0,ek.A)(ih),m=(0,E.p)(),[h,j]=(0,eE.I)(eT.H.hasDismissedDocWorkspaceNotice,!1),[g,v]=(0,I.useState)(!1),{isConnected:b}=(0,R.$gs)(),[N,{error:k}]=(0,R.qVw)(),[O,{error:w}]=(0,R.mrc)();(0,ew.GJ)("Error updating collaborator.",k),(0,ew.GJ)("Error removing collaborator.",w);let[M]=(0,R.rIg)(),[D]=(0,R.kTH)(),S=null==r?void 0:null===(i=r.accessLinks)||void 0===i?void 0:i[0],U=(0,I.useMemo)(()=>(0,B.Gn)({docTitle:null==r?void 0:r.title,docId:null==r?void 0:r.id,token:null==S?void 0:S.token,absolute:!0}),[r,null==S?void 0:S.token]),z=x&&b,F=!a,L=(F&&(h||!r||r.orgAccess),!!(!(null==r?void 0:r.orgAccess)&&(null==r?void 0:r.channels)&&(null==r?void 0:r.channels.length)>0&&(null==r?void 0:r.channels.every(e=>eR()(e.permission))))),V=(null==r?void 0:r.orgAccess)==null&&(null==r?void 0:r.publicAccess)==R.y3$.View,W=(0,P.qw)(r),$=(null==r?void 0:r.collaborators)||[],K=(null==r?void 0:r.invitations)||[],q=$.filter(e=>e.permission===R.y3$.Manage).length,H=[...$,...K].sort(ig),Z=e=>()=>{let i="updated"===e?eA.ag._({id:"Xpw8aE"}):eA.ag._({id:"jwO7L7"});m({title:i,status:"success",duration:5e3,isClosable:!0,position:"top"})},J=(null==S?void 0:S.permission)?null==S?void 0:S.permission:n.NoAccess,X=J===n.NoAccess,Q=(null==S?void 0:S.token)==="",ei=S&&S.permission!==R.y3$.View,es=r.orgAccess?r.orgAccess:n.NoAccess,en=es!==n.NoAccess;return(0,l.jsxs)(l.Fragment,{children:[z&&(0,l.jsx)(il,{workspaceId:o,docId:r.id,user:d,existingDocCollaborators:$,existingInvitations:K,registerDoneFn:u,isDisabled:!x}),(0,l.jsx)(eO.V,{label:(0,l.jsx)(A.cC,{id:"i5bpoc"}),isConnected:b,mb:4}),(0,l.jsx)(T.x,{fontSize:"sm",color:"gray.600",pt:2,children:W}),(0,l.jsxs)(io,{children:[!1,(0,l.jsx)(it,{testId:"workspace",title:(0,l.jsx)(A.cC,{id:"wtxjAY"}),subtitle:en?eA.ag._({id:"aC87LX",values:{0:null==r?void 0:null===(s=r.organization)||void 0===s?void 0:s.name}}):"",img:(0,l.jsx)(eD,{icon:_.P88,showDisabled:!en}),isDisabled:!z,disabledText:e8[es].title(),infoIcon:V?(0,l.jsx)(y.kH,{label:(0,l.jsx)(A.cC,{id:"paaewf",values:{GAMMA_ARTIFACT_PROPER_NOUN:Y.Yc}}),placement:"top",children:(0,l.jsx)(c.xu,{color:"yellow.500",children:(0,l.jsx)(f.G,{icon:_.DBf})})}):void 0,permissionsControl:(0,l.jsx)(e9,{isDisabled:!z,selected:es,options:[R.y3$.Manage,R.y3$.Edit,R.y3$.Comment,R.y3$.View,n.NoAccess],onClick:e=>{let i={id:r.id,orgAccess:e===n.NoAccess?null:e};M({variables:i,optimisticResponse:{updateDoc:{...i,__typename:"Doc"}},refetchQueries:["GetDocs"]}
1).then(Z(e===n.NoAccess?"removed":"updated"))}})}),F&&(null===(t=r.channels)||void 0===t?void 0:t.map(e=>(0,l.jsx)(eS,{channel:e,doc:r,isDisabled:!b,showDisabledIcon:L},e.id))),!!r.orgAccess&&F&&!r.site&&!L&&(0,l.jsx)(c.xu,{w:"100%",mt:2,children:(0,l.jsx)(e$,{existingChannels:r.channels,workspaceId:o,docId:r.id,isDisabled:!b})}),(0,l.jsx)(ev.U,{in:F&&L,children:(0,l.jsxs)(eb.b,{status:"warning",children:[(0,l.jsx)(e_.z,{}),(0,l.jsx)(A.cC,{id:"RZRM4l",values:{GAMMA_ARTIFACT_PROPER_NOUN:Y.Yc}})]})})]}),H&&(0,l.jsx)(io,{showDivider:x,children:H.map(e=>{let i=e.permission===R.y3$.Manage&&q<2,s=!z||i,n=i?eA.ag._({id:"0q0LJR"}):void 0,t=e8[e.permission].title();if("DocCollaborator"===e.__typename){var a;let i=e.user;return(0,l.jsx)(it,{testId:i.email,title:"".concat(i.displayName," ").concat(i.id===d.id?eA.ag._({id:"dDUgzP"}):""),img:(0,l.jsx)(ef.q,{name:i.displayName,src:i.profileImageUrl,size:"sm"}),subtitle:s?void 0:i.email,isDisabled:s,disabledText:t,tooltipText:n,workspaceGuestInvite:!s&&e.guest?(0,l.jsx)(im,{name:i.displayName,workspaceName:null===(a=r.organization)||void 0===a?void 0:a.name,workspaceId:o,email:e.user.email}):void 0,permissionsControl:(0,l.jsx)(e9,{isDisabled:s,selected:e.permission,options:[R.y3$.Manage,R.y3$.Edit,R.y3$.Comment,R.y3$.View],disabledOptions:e.guest?[{permission:R.y3$.Manage,reason:eA.ag._({id:"Rxin92"})}]:[],onClick:e=>{let s={docId:r.id,collaborators:[{userId:i.id,permission:e}]};N({variables:s,optimisticResponse:{addCollaborators:{id:s.docId,collaborators:$.map(s=>({...s,permission:s.user.id===i.id?e:s.permission})),invitations:K,__typename:"Doc"}}}).then(Z("updated")).catch(()=>{})},onRemove:()=>{let e={docId:r.id,collaborators:[{userId:i.id}]};O({variables:e,optimisticResponse:{removeCollaborators:{id:e.docId,collaborators:$.filter(e=>e.user.id!==i.id),invitations:K,__typename:"Doc"}}}).then(Z("removed"))}})},i.id)}return"DocInvitation"===e.__typename?(0,l.jsx)(it,{testId:e.email,title:e.email,subtitle:eA.ag._({id:"MActeE"}),img:(0,l.jsx)(c.Cd,{bg:"trueblue.50",size:8,children:(0,l.jsx)(f.G,{icon:_.FU$,size:"sm"})}),isDisabled:s,disabledText:t,permissionsControl:(0,l.jsx)(e9,{selected:e.permission,options:[R.y3$.Manage,R.y3$.Edit,R.y3$.Comment,R.y3$.View],disabledOptions:[{permission:R.y3$.Manage,reason:eA.ag._({id:"Rxin92"})}],onClick:i=>{let s={docId:r.id,collaborators:[{email:e.email,permission:i}]};N({variables:s,optimisticResponse:{addCollaborators:{id:s.docId,invitations:K.map(s=>({...s,permission:s.email===e.email?i:s.permission})),collaborators:$,__typename:"Doc"}}}).then(Z("updated")).catch(()=>{console.warn("Error updating permission")})},onRemove:()=>{let i={docId:r.id,collaborators:[{email:e.email}]};O({variables:i,optimisticResponse:{removeCollaborators:{id:i.docId,invitations:K.filter(i=>i.email!==e.email),collaborators:$,__typename:"Doc"}}}).then(Z("removed"))}})},e.email):null})}),x&&(0,l.jsxs)(io,{showDivider:!1,children:[(0,l.jsx)(it,{title:(0,l.jsx)(A.cC,{id:"qZu20V"}),subtitle:X?eA.ag._({id:"vMZPZT"}):(0,l.jsx)(ia,{subtitle:p[J].subtitle,tooltipLabel:p[J].tooltip,ariaLabel:p[J].subtitle,icon:_.DBf}),img:(0,l.jsx)(eD,{icon:_.nNP,showDisabled:X}),isDisabled:!z,disabledText:e8[J].title(),permissionsControl:(0,l.jsx)(e9,{selected:J,options:[R.y3$.Edit,R.y3$.Comment,R.y3$.View,n.NoAccess],onClick:e=>{let i=null==S?void 0:S.id,s={id:r.id,accessLinks:e===n.NoAccess?[{permission:null}]:[{permission:e}]};D({variables:s,optimisticResponse:{updateDoc:{...s,accessLinks:[{__typename:"AccessLink",id:i||"temp-id",permission:e===n.NoAccess?null:e}],__typename:"Doc"}}}).then(Z(e===n.NoAccess?"removed":"updated"))}})}),(0,l.jsxs)(ev.U,{animateOpacity:!0,in:!!(null==S?void 0:S.permission),children:[(0,l.jsx)(eN.I,{url:U,customLabel:eA.ag._({id:"y1eoq1"}),onClick:()=>{(0,eP.J)({docId:r.id,source:"sharePanel",type:"tokenUrl"})}}),!Q&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(ev.U,{in:g,unmountOnExit:!0,children:(0,l.jsxs)(ee.g,{mt:3,align:"stretch",spacing:4,bg:"gray.50",p:6,borderRadius:"md",children:[(0,l.jsxs)(G.U,{spacing:4,align:"center",children:[(0,l.jsx)(c.xu,{color:"purple.600",children:(0,l.jsx)(f.G,{fixedWidth:!0,icon:ey._1N})}),(0,l.jsx)(T.x,{fontSize:"sm",children:(0,l.jsx)(A.cC,{id:"asiJbp"})})]}),(0,l.jsxs)(G.U,{spacing:4,align:"center",children:[(0,l.jsx)(c.xu,{c
1olor:"purple.600",children:(0,l.jsx)(f.G,{fixedWidth:!0,icon:ey.Mdf})}),(0,l.jsx)(T.x,{fontSize:"sm",display:"inline-block",children:(0,l.jsx)(A.cC,{id:"+g8rkW",values:{GAMMA_ARTIFACT_PROPER_NOUN:Y.Yc,GAMMA_PROPER_NOUN:Y.N6}})})]}),ei&&(0,l.jsxs)(G.U,{spacing:4,align:"center",children:[(0,l.jsx)(c.xu,{color:"purple.600",children:(0,l.jsx)(f.G,{fixedWidth:!0,icon:ey.FKd})}),(0,l.jsx)(T.x,{fontSize:"sm",children:(0,l.jsx)(A.cC,{id:"NSCwrX",values:{GAMMA_PROPER_NOUN:Y.N6,selectedAccessLinkPermission:J},components:{0:(0,l.jsx)(T.x,{as:"span",fontWeight:"bold"})}})})]})]})}),(0,l.jsx)(C.k,{justify:"center",alignItems:"center",my:3,children:(0,l.jsxs)(G.U,{spacing:1,as:"button",onClick:()=>v(!g),children:[g?(0,l.jsx)(f.G,{fixedWidth:!0,size:"xs",icon:_.onQ}):(0,l.jsx)(f.G,{fixedWidth:!0,size:"xs",icon:_.r8p}),(0,l.jsx)(T.x,{lineHeight:"normal",marginLeft:"auto",marginRight:"auto",fontSize:"xs",fontWeight:"medium",children:g?(0,l.jsx)(A.cC,{id:"BRvU04"}):(0,l.jsx)(A.cC,{id:"l0Ck42"})})]})})]})]})]})]})};var iC=s(34638);let ib=e=>{let{visibility:i,isFromOtherOrg:s}=e,n=(0,iC.ff)("white","var(--chakra-colors-gray-900)");return(0,l.jsxs)(l.Fragment,{children:[s&&(0,l.jsx)(f.G,{icon:_.Gg}),(0,l.jsxs)(c.xu,{as:"span",className:"fa-layers fa-fw",children:[(0,l.jsx)(f.G,{icon:i.primaryIcon}),i.secondaryIcon&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(f.G,{icon:ey.diR,color:n,transform:"down-6 right-6"}),(0,l.jsx)(f.G,{icon:i.secondaryIcon,transform:"shrink-7 right-6 down-6"})]})]})]})};var i_=s(2046),iy=s(71193),iA=s(49294),iI=s(25793);let iR="embed-copied-toast",iN=e=>{let{embedCode:i,isDisabled:s,docId:n}=e,t=(0,E.p)(),[o,a]=(0,I.useState)(!1),{hasCopied:r,onCopy:c}=(0,iA.V)(i),d=(0,I.useRef)(null);(0,I.useEffect)(()=>{d.current&&o&&(d.current.focus(),d.current.select())},[o]);let u=(0,I.useCallback)(()=>a(!0),[]),x=(0,I.useCallback)(()=>a(!1),[]),p=(0,I.useCallback)(()=>{c(),t.isActive(iR)||t({id:iR,title:(0,l.jsx)(A.cC,{id:"ETv+Uw"}),status:"success",duration:5e3}),(0,eP.J)({docId:n,source:"sharePanel",type:"embed"})},[n,c,t]);return(0,l.jsxs)(ee.g,{spacing:4,align:"stretch",children:[(0,l.jsx)(iI.g,{ref:d,rows:5,variant:"filled",fontFamily:"mono",colorScheme:"gray",disabled:s,onClick:u,onBlur:x,isReadOnly:!0,resize:"none",pointerEvents:s?"none":void 0,children:i}),(0,l.jsx)(j.z,{alignSelf:"flex-end",onClick:p,isDisabled:s,size:"sm",...s?{opacity:"1 !important",color:"gray.400",_hover:{opacity:"1"},_active:{boxShadow:"0 none"}}:{},children:r?(0,l.jsx)(A.cC,{id:"6V3Ea3"}):(0,l.jsx)(A.cC,{id:"Sx4kHi"})})]})},ik=e=>{let{doc:i,isSharePublic:s,isConnected:t,onSharePanelOpen:o,onSharePanelClose:a,editor:r}=e,d=(0,E.p)(),[u,x]=(0,I.useState)(!!i.publicAccess),[p]=(0,R.o6I)(),m=(0,I.useMemo)(()=>{let e=(0,B.Gn)({docId:i.id,docTitle:i.title,path:"public",absolute:!0});return s?e:(0,B.lT)({docId:i.id,docTitle:i.title})},[i.id,i.title,s]),h=(0,I.useCallback)(e=>{x(e.target.checked);let s={id:i.id,publicAccess:e.target.checked?R.y3$.View:null};p({variables:s,optimisticResponse:{updateDoc:{...s,__typename:"Doc"}}}).then(()=>{let i=e.target.checked?eA.ag._({id:"OnQp1B"}):eA.ag._({id:"e5veeL"});d({title:i,status:"success",duration:5e3,isClosable:!0,position:"top"})})},[i.id,d,p]),g=i.publicAccess?e8[R.y3$.View].title():e8[n.NoAccess].title(),v=s?(0,l.jsx)(A.cC,{id:"kGj/zu",values:{GAMMA_ARTIFACT_PROPER_NOUN:Y.Yc},components:{0:(0,l.jsx)(T.x,{as:"span",borderBottom:"0.125em dashed",borderColor:"gray.400",cursor:"help"}),1:(0,l.jsx)(y.kH,{placement:"top",label:eA.ag._({id:"kni5pb",values:{GAMMA_ARTIFACT_PROPER_NOUN:Y.Yc}}),"aria-label":"public access is read only"})}}):(0,l.jsx)(A.cC,{id:"RmtWc6",values:{GAMMA_ARTIFACT_PROPER_NOUN:Y.Yc}});return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(T.x,{fontSize:"sm",color:"gray.600",pt:2,children:v}),(0,l.jsx)(io,{showDivider:!1,children:(0,l.jsx)(it,{title:(0,l.jsx)(A.cC,{id:"YsO5Wf"}),testId:"public-access",subtitle:(0,l.jsx)(ia,{subtitle:(0,l.jsx)(A.cC,{id:"oEQSnD"}),tooltipLabel:(0,O.tN)(),ariaLabel:eA.ag._({id:"oEQSnD"}),icon:_.DBf}),img:(0,l.jsx)(eD,{icon:_.Xj}),isDisabled:!t,disabledText:g,permissionsControl:(0,l.jsx)(i_.NI,{children:(0,l.jsx)(iy.r,{id:"public-access",isChecked:u,onChange:h})})})}),(0,l.jsx)(y.kH,{label:s?(0,l.jsx)(A.cC,{id:"RFk/SS"}):(0,l.jsx)(A.cC,{id:"4wpR4l"}
1),placement:"top",isDisabled:u,children:(0,l.jsx)(c.xu,{children:s?(0,l.jsx)(eN.I,{isDisabled:!i.publicAccess,url:m,customLabel:eA.ag._({id:"FO91Ip"}),onClick:()=>{(0,eP.J)({docId:i.id,source:"sharePanel",type:"public"})}}):(0,l.jsx)(iN,{embedCode:m,isDisabled:!u,docId:i.id})})}),s&&r&&(0,l.jsx)(T.x,{fontSize:"sm",color:"gray.500",mt:4,children:(0,l.jsx)(A.cC,{id:"a9n+CI",components:{0:(0,l.jsx)(j.z,{variant:"link",as:"span",size:"sm",cursor:"pointer",onClick:()=>{a(),ex.pw.emit(ex.TI.OPEN_PAGE_SETUP,"preview")}})}})}),(0,l.jsx)(em.V,{onClose:a,onOpen:o,segmentEvent:W.AA.GAMMA_PRO_UPSELL_SHARE_SETTINGS_REMOVE_WATERMARK,doc:i})]})},iO=e=>{var i;let{doc:s,editor:n,isSharePanelOpen:w,onSharePanelClose:E,onSharePanelOpen:T,onAnalyticsPanelOpen:M,view:D,setView:S,showAnalytics:G=!0,showSharePublic:U=!0,showEmbed:z=!0}=e,F=(0,k._O)(),L=(0,I.useRef)(!1),{user:V,currentWorkspace:Y}=(0,K.SE)(),{isConnected:W}=(0,R.$gs)(),B=(0,K.py)("manage",s),H=(0,K.py)("comment",s),{isOpen:Z,onOpen:ee,onClose:ei}=(0,N.M)({id:"create-site-modal"}),es=(0,q.zY)(!0),en=s&&s.site&&s.site.routes.length>1,el=F&&B&&s&&!s.site&&!es,et=s&&(0,$.Vr)(s.site),eo=(0,O.ei)({showSharePublic:U&&B&&!et,showEmbed:z&&B&&!et,showWebsites:el&&!(0,Q.s2)()}),ea=B&&M&&s&&!et,[er,ec]=(0,I.useState)(()=>()=>Promise.resolve()),ed=s?en?s.site.name:s.title:null,eu=(0,I.useCallback)(()=>{er().then(()=>{S("invite"),E()},()=>{console.debug("[handleSharePanelClose] CollaboratorSearchBar rejected \uD83D\uDC4E\uD83C\uDFFC")})},[S,E,er]),ex=(0,I.useCallback)(()=>{M&&(E(),M())},[M,E]);if(!V)return null;let ep=(0,P.h_)(s,V),em=ep?(0,P.Xp)()[ep]:null,ej=(0,P.Gi)(s,Y);if(s&&null===em)return console.error("[SharePanel] Unknown VisibilityValue for doc",s),null;let eg=null==s?void 0:null===(i=s.organization)||void 0===i?void 0:i.id;return!s||eg||L.current||(console.error("[SharePanelModal] Doc unexpectedly doesnt have a workspaceId",{docId:s.id,organization:s.organization}),L.current=!0),(0,l.jsxs)(y.Wk,{isDark:!1,children:[(0,l.jsxs)(t.u_,{onEsc:eu,isOpen:w,onClose:E,trapFocus:!1,size:"3xl",returnFocusOnClose:!1,children:[(0,l.jsx)(o.Z,{}),(0,l.jsxs)(a.h,{"data-share-panel-modal-content":!0,mx:2,children:[(0,l.jsxs)(r.x,{children:[em&&(0,l.jsx)(c.xu,{as:"span",mr:3,children:(0,l.jsx)(ib,{visibility:em,isFromOtherOrg:ej})}),ed?(0,l.jsx)(A.cC,{id:"sit2to",values:{displayName:ed}}):(0,l.jsx)(A.cC,{id:"Z8lGw6"})]}),(0,l.jsx)(d.o,{"data-share-panel-close-button":!0,onClick:e=>{e.preventDefault(),eu()}}),(0,l.jsx)(u.i,{}),s?(0,l.jsx)(x.f,{pb:6,"data-testid":"share-panel-modal-body",children:s&&eg&&(0,l.jsxs)(l.Fragment,{children:[B&&(0,l.jsx)(h.E,{my:4,children:eo.map(e=>{let{viewKey:i,icon:s,ariaLabel:n,label:t,isBeta:o}=e,a=D===i;return(0,l.jsx)(h.U,{children:(0,l.jsx)(j.z,{leftIcon:(0,l.jsx)(f.G,{icon:s,"aria-label":n}),variant:"ghost",size:"sm",fontWeight:"600",bg:a?"trueblue.50":"transparent",color:a?"trueblue.500":"gray.600",onClick:()=>S(i),rightIcon:o?(0,l.jsx)(g.C,{colorScheme:"green",children:(0,l.jsx)(A.cC,{id:"YBt9YP"})}):void 0,children:t})},i)})}),(!H||"invite"==D)&&(0,l.jsx)(iv,{workspaceId:eg,doc:s,user:V,setVerifySearchDone:ec,canManage:B,isFromOtherOrg:ej,isMultipage:en}),B&&("public"===D||"embed"===D)&&(0,l.jsx)(ik,{doc:s,isSharePublic:"public"==D,isConnected:W,onSharePanelOpen:T,onSharePanelClose:E,editor:n}),H&&"export"===D&&(0,l.jsx)(eh,{doc:s,editor:n,onSharePanelOpen:T,onSharePanelClose:E,isMultipage:en}),el&&"website"===D&&(0,l.jsx)(J,{doc:s,onCreateSiteClick:ee})]})}):(0,l.jsx)(x.f,{pb:6,"data-testid":"share-panel-modal-body",children:(0,l.jsxs)(p.K,{children:[(0,l.jsx)(m.O,{height:"55px"}),(0,l.jsx)(m.O,{height:"55px"}),(0,l.jsx)(m.O,{height:"55px"}),(0,l.jsx)(m.O,{height:"55px"})]})}),(0,l.jsx)(u.i,{}),(0,l.jsx)(v.m,{children:(0,l.jsxs)(C.k,{justifyContent:"space-between",flex:1,children:[G&&ea&&(0,l.jsx)(j.z,{isDisabled:!W,leftIcon:(0,l.jsx)(f.G,{icon:_.Ma4}),variant:"ghost",onClick:ex,children:(0,l.jsx)(A.cC,{id:"YaUqUV"})}),(0,l.jsx)(b.L,{}),(0,l.jsx)(j.z,{onClick:e=>{e.preventDefault(),eu()},variant:"solid",children:(0,l.jsx)(A.cC,{id:"DPfwMq"})})]})})]})]}),(null==s?void 0:s.id)&&F&&B&&Z&&(0,l.jsx)(X.M,{isOpen:Z,onClose:ei,existingDoc:s})]})}},8174:function(e,i,s){s.d(i,{Z:function(){return c}});var n=s(52322),l=s(55479),t=s(5879),o=s(2784),a=s(38290),r=s(94199);let c=()=>{let e=(0,l.p)(),[i]=(0,a.yx3)({refetchQueries:["GetChannelDocActivity","GetChannels"]}),s=(0,o.useCallback)(s=>
1{let{docId:l,doc:o,channel:c,existingChannels:d=[]}=s,u=l||(null==o?void 0:o.id);if(!u){console.error("Invalid docid");return}let x={input:{docId:u,sharing:[{op:a.Bdm.Add,path:"/channels",value:[{channelId:c.id}]}]}},p=(null==o?void 0:o.title)||r.Yc,m=[...d,{id:c.id,slug:c.slug,name:c.name,permission:a.y3$.Comment}].sort((e,i)=>e.slug.localeCompare(i.slug,"en"));i({variables:x,update:(e,i)=>{let{data:s}=i;e.writeFragment({id:"Doc:".concat(u),fragment:a.IiT,data:null==s?void 0:s.updatePublicChannels})},optimisticResponse:{updatePublicChannels:{id:x.input.docId,channels:m}}}).then(()=>{e({title:(0,n.jsx)(t.cC,{id:"7hDHpt",values:{title:p}}),description:(0,n.jsx)(t.cC,{id:"A2xcFn",values:{GAMMA_ARTIFACT_PROPER_NOUN:r.Yc,0:c.name}}),status:"success",duration:5e3,isClosable:!0,position:"top"})},i=>{e({title:(0,n.jsx)(t.cC,{id:"bLdU0Q",values:{title:p,0:c.name}}),description:i.message,duration:null,status:"error",isClosable:!0,position:"top"})})},[i,e]),c=(0,o.useCallback)((s,l)=>{var o;if(!l)return;let c={input:{docId:s.id,sharing:[{op:a.Bdm.Remove,path:"/channels",value:[{channelId:l}]}]}};i({variables:c,update:(e,i)=>{let{data:n}=i;e.writeFragment({id:"Doc:".concat(s.id),fragment:a.P6u,data:null==n?void 0:n.updatePublicChannels})},optimisticResponse:{updatePublicChannels:{id:c.input.docId,channels:null===(o=s.channels)||void 0===o?void 0:o.filter(e=>e.id!==l)}}}).then(()=>{e({title:(0,n.jsx)(t.cC,{id:"qsnpV6",values:{GAMMA_ARTIFACT_PROPER_NOUN:r.Yc}}),status:"success",duration:1e4,position:"top"})}).catch(i=>{e({title:(0,n.jsx)(t.cC,{id:"+yMzgs"}),description:i.message,status:"error",duration:3e3,isClosable:!0,position:"top"}),console.error("[addRemoveDocChannel] Error removing channel:",i.message)})},[i,e]);return{addDocChannel:s,removeDocChannel:c}}},16710:function(e,i,s){s.d(i,{Gi:function(){return d},Xp:function(){return p},h_:function(){return m},nZ:function(){return g},qw:function(){return h},uG:function(){return v}});var n=s(52322),l=s(42946),t=s(5879),o=s(87254),a=s(94199),r=s(30579),c=s(78462);let d=(e,i)=>{var s;return(null==e?void 0:null===(s=e.organization)||void 0===s?void 0:s.id)!==(null==i?void 0:i.id)},u={PRIVATE:"private",LINK_VIEW:"link-view",LINK_COMMENT:"link-comment",LINK_EDIT:"link-edit",INDIVIDUAL:"individual",ORG_VIEW:"org-view",ORG_COMMENT:"org-comment",ORG_EDIT:"org-edit",ORG_MANAGE:"org-manage",CHANNEL_PRIVATE:"channel-private",PUBLIC:"public"},x=[u.ORG_VIEW,u.ORG_COMMENT,u.ORG_EDIT,u.ORG_MANAGE],p=()=>({[u.PRIVATE]:{title:()=>o.ag._({id:"IZiYjM",values:{GAMMA_ARTIFACT_PROPER_NOUN:a.Yc}}),subtitle:()=>o.ag._({id:"nHujJB",values:{GAMMA_ARTIFACT_PROPER_NOUN:a.Yc}}),primaryIcon:l.byT},[u.LINK_VIEW]:{title:()=>o.ag._({id:"Pb5t/X",values:{GAMMA_ARTIFACT_PROPER_NOUN:a.Yc}}),primaryIcon:l.nNP},[u.LINK_COMMENT]:{title:()=>o.ag._({id:"FUtIA5",values:{GAMMA_ARTIFACT_PROPER_NOUN:a.Yc}}),primaryIcon:l.nNP},[u.LINK_EDIT]:{title:()=>o.ag._({id:"tNOSZi",values:{GAMMA_ARTIFACT_PROPER_NOUN:a.Yc}}),primaryIcon:l.nNP},[u.INDIVIDUAL]:{title:()=>o.ag._({id:"IB6oAl",values:{GAMMA_ARTIFACT_PROPER_NOUN:a.Yc}}),subtitle:e=>"".concat(e," can access this ").concat(a.Yc,"."),primaryIcon:l.ILF},[u.ORG_VIEW]:{title:e=>o.ag._({id:"S+losC",values:{GAMMA_ARTIFACT_PROPER_NOUN:a.Yc,org:e}}),primaryIcon:l.P88,secondaryIcon:l.Mdf},[u.ORG_COMMENT]:{title:e=>o.ag._({id:"acq2w5",values:{GAMMA_ARTIFACT_PROPER_NOUN:a.Yc,org:e}}),primaryIcon:l.P88,secondaryIcon:l.Mzg},[u.ORG_EDIT]:{title:e=>o.ag._({id:"FFdz7p",values:{GAMMA_ARTIFACT_PROPER_NOUN:a.Yc,org:e}}),primaryIcon:l.P88,secondaryIcon:l.TzT},[u.ORG_MANAGE]:{title:e=>o.ag._({id:"3yNlmN",values:{GAMMA_ARTIFACT_PROPER_NOUN:a.Yc,org:e}}),primaryIcon:l.P88},[u.CHANNEL_PRIVATE]:{title:()=>o.ag._({id:"Tw6Jzi"}),primaryIcon:r.Ty},[u.PUBLIC]:{title:()=>o.ag._({id:"NMHF69",values:{GAMMA_ARTIFACT_PROPER_NOUN:a.Yc}}),primaryIcon:l.Xj}}),m=(e,i)=>{var s;if(!e)return null;let n=(null==e?void 0:e.publicAccess)?u.PUBLIC:(null==e?void 0:e.orgAccess)==="manage"?u.ORG_MANAGE:(null==e?void 0:e.orgAccess)==="edit"?u.ORG_EDIT:(null==e?void 0:e.orgAccess)==="comment"?u.ORG_COMMENT:(null==e?void 0:e.orgAccess)==="view"?u.ORG_VIEW:(null==e?void 0:e.channels)&&e.channels.some(e=>null!==e.permission)?u.CHANNEL_PRIVATE:(null==e?void 0:e.collaborators)&&(null==e?void 0:null===(s=e.collaborators)||void 0===s?void 0:s.length)>1?u.INDIVIDUAL:(null==e?void 0:e.accessLinks)&&e.accessLinks.some(e=>
1"view"===e.permission&&""===e.token)?u.LINK_VIEW:(null==e?void 0:e.accessLinks)&&e.accessLinks.some(e=>"comment"===e.permission&&""===e.token)?u.LINK_COMMENT:(null==e?void 0:e.accessLinks)&&e.accessLinks.some(e=>"edit"===e.permission&&""===e.token)?u.LINK_EDIT:v(e,i)?u.PRIVATE:u.INDIVIDUAL;return n},h=e=>(null==e?void 0:e.publicAccess)?o.ag._({id:"gJUdlS",values:{GAMMA_ARTIFACT_PROPER_NOUN:a.Yc}}):(null==e?void 0:e.orgAccess)?o.ag._({id:"5Ma3Lv",values:{GAMMA_ARTIFACT_PROPER_NOUN:a.Yc}}):o.ag._({id:"QbKKqw",values:{GAMMA_ARTIFACT_PROPER_NOUN:a.Yc}}),j=(e,i,s)=>{var o,a;if(!i)return[];let p=(null==e?void 0:null===(o=e.channels)||void 0===o?void 0:o.map(e=>{let{id:i,name:s,slug:n}=e;return{id:i,label:s,href:(0,c.j)({id:i,slug:n}),icon:r.Ty}}))||[],h=m(e,i),j=d(e,s),g=j?[{id:"shared-from-external-org",label:(null==e?void 0:null===(a=e.organization)||void 0===a?void 0:a.name)?(0,n.jsx)(t.cC,{id:"lFZJ+N",values:{0:e.organization.name}}):(0,n.jsx)(t.cC,{id:"qn35Ez"}),icon:l.Gg,color:"gray.500"}]:[];if(h===u.PUBLIC)return[{id:"public",label:(0,n.jsx)(t.cC,{id:"7d1a0d"}),icon:l.Xj,color:"gray.500"},...g,...p];if(h===u.PRIVATE)return[{id:"private",label:(0,n.jsx)(t.cC,{id:"zwBp5t"}),icon:l.byT,color:"gray.500"},...g];if(h===u.INDIVIDUAL){let s=(e.collaborators||[]).filter(e=>e.user.id!==i.id).length;return[{id:"collaborators",label:(0,n.jsx)(t.cC,{id:"o2NxSP",values:{numCollaborators:s}}),icon:l.ILF,color:"gray.500"},...g]}return j?g:h&&x.includes(h)?[{id:"workspace",label:(0,n.jsx)(t.cC,{id:"0Gd0NU"}),icon:l.P88,color:"gray.500"},...g,...p]:p},g=e=>{let{doc:i,user:s,currentWorkspace:n,channelToExclude:l}=e;return j(i,s,n).filter(e=>e.id!==l)},v=(e,i)=>{var s;return e&&i&&!e.orgAccess&&!e.publicAccess&&(null===(s=e.createdBy)||void 0===s?void 0:s.id)===i.id}},46759:function(e,i,s){s.d(i,{M:function(){return O}});var n=s(52322),l=s(55479),t=s(5389),o=s(56915),a=s(48273),r=s(92619),c=s(64827),d=s(2167),u=s(71354),x=s(2046),p=s(70287),m=s(27777),h=s(80353),j=s(76648),g=s(45650),v=s(9877),C=s(5879),b=s(87254),_=s(5632),f=s(2784),y=s(38290),A=s(83669),I=s(15041),R=s(36651),N=s(78462),k=s(46232);let O=e=>{var i;let{isOpen:s,onClose:O,existingDoc:P}=e,w=(0,k.zY)(!0),E=(0,l.p)(),T=(0,f.useRef)(null),[M,D]=(0,f.useState)(!1),{currentWorkspace:S}=(0,R.SE)(),[G,U]=(0,f.useState)(""),[z]=(0,y.V$$)(),[F]=(0,y.So6)(),L=(0,A.b)(),{push:V}=(0,_.useRouter)(),Y=(0,f.useCallback)(async()=>{if(null==P?void 0:P.id){await (0,I.iL)(P.id),D(!0);try{var e,i;let{data:s}=await F({variables:{duplicateDocInput:{sourceDocId:P.id,source:y.L17.SitesCopyToSite,title:(null==P?void 0:P.title)||b.ag._({id:"wja8aL"}),orgId:null==S?void 0:S.id,orgAccess:y.y3$.Manage,themeId:null}}}),n=null==s?void 0:null===(e=s.duplicateDoc)||void 0===e?void 0:e.id;if(!n){console.error("[CreateSiteModal] Failed to duplicate doc with id",P.id);return}let{data:l}=await z({variables:{input:{workspaceId:null==S?void 0:S.id,name:G,routes:[{docId:n,path:"/"}],themeId:null==P?void 0:null===(i=P.theme)||void 0===i?void 0:i.id}}}),t=null==l?void 0:l.createSite;if(!t){console.error("[CreateSiteModal] Failed to create site, no site returned");return}let o=(0,N.yQ)({siteId:t.id,docId:n,unifiedEditorEnabled:w});V(o)}catch(e){E({status:"error",title:(0,n.jsx)(C.cC,{id:"Pdboh4"}),description:(0,n.jsx)(C.cC,{id:"c6YG3V"})}),console.error(e)}D(!1)}},[z,null==S?void 0:S.id,F,null==P?void 0:P.id,null==P?void 0:null===(i=P.theme)||void 0===i?void 0:i.id,null==P?void 0:P.title,G,V,E,w]),W=(0,f.useCallback)(async()=>{D(!0);let{data:e}=await z({variables:{input:{workspaceId:null==S?void 0:S.id,name:G,routes:[]}}}),i=null==e?void 0:e.createSite;if(!i){console.error("[CreateSiteModal] Failed to create site, no site returned");return}L({siteId:null==i?void 0:i.id,routes:null==i?void 0:i.routes,title:"Home",path:"/"})},[L,z,null==S?void 0:S.id,G]),$=(0,f.useCallback)(async()=>(null==P?void 0:P.id)?Y():W(),[null==P?void 0:P.id,Y,W]),K=G.length>0;return(0,n.jsx)(v.Wk,{isDark:!1,children:(0,n.jsxs)(t.u_,{isOpen:s,onClose:O,initialFocusRef:T,size:"2xl",children:[(0,n.jsx)(o.Z,{}),(0,n.jsxs)(a.h,{children:[(0,n.jsx)(r.x,{children:(0,n.jsx)(C.cC,{id:"JHMOcq"})}),(0,n.jsx)(c.o,{}),(0,n.jsx)(d.f,{children:(0,n.jsx)(u.K,{spacing:4,children:(0,n.jsxs)(x.NI,{children:[(0,n.jsx)(p.l,{children:(0,n.jsx)(C.cC,{id:"Lve3H6"})}
1),(0,n.jsx)(m.I,{ref:T,placeholder:b.ag._({id:"tlD7N3"}),onChange:e=>{U(e.target.value)},onKeyDown:e=>{K&&"Enter"===e.key&&$()}})]})})}),(0,n.jsx)(h.m,{children:(0,n.jsxs)(j.h,{children:[(0,n.jsx)(g.z,{variant:"ghost",onClick:O,children:(0,n.jsx)(C.cC,{id:"dEgA5A"})}),(0,n.jsx)(g.z,{variant:"solid",onClick:$,isDisabled:!K,isLoading:M,children:(0,n.jsx)(C.cC,{id:"JHMOcq"})})]})})]})]})})}}}]);
2//# sourceMappingURL=8518-c564b9d3f9aee05e.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.