"use strict";(self.rspackChunk_jupyter_collaboration_extension=self.rspackChunk_jupyter_collaboration_extension||[]).push([[667],{6918(e,r,a){a.r(r),a.d(r,{default:()=>h});var t,n=a(5748),o=a(2681),s=a(6697),l=a(2359),i=a(5518),d=a(3152),c=a(9180),u=a(1660),p=a(9323),y=a(7581),b=a(7784);let m={id:"@jupyter/collaboration-extension:userMenu",description:"Provide connected user menu.",requires:[],provides:p.IUserMenu,activate:e=>{let{commands:r}=e,{user:a}=e.serviceManager;return new p.UserMenu({commands:r,user:a})}},g={id:"@jupyter/collaboration-extension:user-menu-bar",description:"Add user menu to the interface.",autoStart:!0,requires:[p.IUserMenu,n.IToolbarWidgetRegistry],activate:async(e,r,a)=>{let{user:t}=e.serviceManager,n=new u.MenuBar({forceItemsPosition:{forceX:!1,forceY:!1},renderer:new p.RendererUserMenu(t)});n.id="jp-UserMenu",t.userChanged.connect(()=>n.update()),n.addMenu(r),a.addFactory("TopBar","user-menu",()=>n)}},v={id:"@jupyter/collaboration-extension:rtcGlobalAwareness",description:"Add global awareness to share working document of users.",requires:[d.IStateDB,l.IAwarenessProviderFactory],provides:s.IGlobalAwareness,activate:(e,r,a)=>{let{user:t}=e.serviceManager,n=new y.Doc,o=new b.ww(n),s={roomID:"JupyterLab:globalAwareness",awareness:o,user:t,serverSettings:e.serviceManager.serverSettings};return a.create(s),r.changed.connect(async()=>{var e,a;let t=(null==(a=null==(e=(await r.toJSON())["layout-restorer:data"])?void 0:e.main)?void 0:a.current)||"";t.match(/^\w+:.+/)?o.setLocalStateField("current",t):o.setLocalStateField("current",null)}),o}},w={id:"@jupyter/collaboration-extension:rtcPanel",description:"Add side panel to display all currently connected users.",autoStart:!0,requires:[s.IGlobalAwareness],optional:[c.ITranslator],activate:(e,r,a)=>{let{user:t}=e.serviceManager,n=(null!=a?a:c.nullTranslator).load("jupyter_collaboration"),o=new i.SidePanel({alignment:"justify"});o.id="jp-collaboration-panel",o.title.icon=i.usersIcon,o.title.caption=n.__("Collaboration"),o.addClass("jp-RTCPanel"),e.shell.add(o,"left",{rank:300});let s=new p.UserInfoPanel({userManager:t,serverSettings:e.serviceManager.serverSettings,trans:n});s.title.label=n.__("User info"),s.title.caption=n.__("User information"),o.addWidget(s);let l=new p.CollaboratorsPanel(t,r,r=>{e.commands.execute("docmanager:open",{path:r})},e.docRegistry);l.title.label=n.__("Online Collaborators"),o.addWidget(l)}},_={id:"@jupyter/collaboration-extension:userEditorCursors",description:"Add CodeMirror extension to display remote user cursors and selections.",autoStart:!0,requires:[o.IEditorExtensionRegistry],activate:(e,r)=>{r.addExtension({name:"remote-user-cursors",factory(e){let{awareness:r,ysource:a}=e.model.sharedModel;return o.EditorExtensionRegistry.createImmutableExtension((0,p.remoteUserCursors)({awareness:r,ytext:a}))}})}};(t||(t={})).share="collaboration:shared-link";let h=[m,g,v,w,{id:"@jupyter/collaboration-extension:shared-link",autoStart:!0,optional:[n.ICommandPalette,c.ITranslator],activate:async(e,r,a)=>{let{commands:o}=e,s=(null!=a?a:c.nullTranslator).load("jupyter_collaboration");o.addCommand(t.share,{label:s.__("Generate a Shared Link"),icon:i.shareIcon,execute:async()=>{let e=await (0,p.showSharedLinkDialog)({translator:a});e.button.accept&&e.value&&n.Clipboard.copyToSystem(e.value)}}),r&&r.addItem({command:t.share,category:s.__("Server")})}},_]}}]);