"use strict";(self.webpackChunktelemetry_router=self.webpackChunktelemetry_router||[]).push([[763],{763:(e,o,t)=>{t.r(o),t.d(o,{ITelemetryRouter:()=>r,TelemetryRouter:()=>l,default:()=>a});var n=t(987),s=t(790);const i="telemetry-router:plugin",r=new(t(930).Token)(i);class l{constructor(){this.sequence=0}loadNotebookPanel(e){this.notebookPanel=e}async consumeEventSignal(e){var o,t,i,r,l,a,c;this.sessionID===(null===(t=null===(o=this.notebookPanel)||void 0===o?void 0:o.sessionContext.session)||void 0===t?void 0:t.id)?this.sequence=this.sequence+1:(this.sessionID=null===(r=null===(i=this.notebookPanel)||void 0===i?void 0:i.sessionContext.session)||void 0===r?void 0:r.id,this.sequence=0);const u={event:e,notebookState:{sessionID:this.sessionID,sequence:this.sequence,notebookPath:null===(l=this.notebookPanel)||void 0===l?void 0:l.context.path,notebookContent:null===(c=null===(a=this.notebookPanel)||void 0===a?void 0:a.model)||void 0===c?void 0:c.toJSON()}};console.log("Request",u);let d=await async function(e="",o={}){const t=s.ServerConnection.makeSettings(),i=n.URLExt.join(t.baseUrl,"telemetry-router",e);let r;try{r=await s.ServerConnection.makeRequest(i,o,t)}catch(e){throw new s.ServerConnection.NetworkError(e)}let l=await r.text();if(l.length>0)try{l=JSON.parse(l)}catch(e){console.log("Not a JSON response body.",r)}if(!r.ok)throw new s.ServerConnection.ResponseError(r,l.message||l);return l}("mongo",{method:"POST",body:JSON.stringify(u)});console.log("Response",d)}}const a={id:i,description:"A JupyterLab extension.",provides:r,autoStart:!0,activate:e=>(console.log("JupyterLab extension telemetry-router is activated!"),new l)}}}]);