"use strict";(self.webpackChunk_jupyterlite_xeus_python_kernel=self.webpackChunk_jupyterlite_xeus_python_kernel||[]).push([[686],{686:(e,t,s)=>{s.r(t),s.d(t,{default:()=>_});var i=s(474),r=s(635),a=s(684),n=s(840),o=s(526),d=s(309);class h{constructor(e){this._isDisposed=!1,this._disposed=new n.Signal(this),this._executeDelegate=new o.PromiseDelegate,this._parentHeader=void 0,this._parent=void 0;const{id:t,name:i,sendMessage:r,location:d}=e;this._id=t,this._name=i,this._location=d,this._sendMessage=r,this._worker=new Worker(new URL(s.p+s.u(213),s.b),{type:void 0}),this._worker.onmessage=e=>{this._processWorkerMessage(e.data)},this._remote=(0,a.wrap)(this._worker),this.initFileSystem(e)}async handleMessage(e){this._parent=e,this._parentHeader=e.header,await this._sendMessageToWorker(e)}async _sendMessageToWorker(e){if("input_reply"!==e.header.msg_type&&(this._executeDelegate=new o.PromiseDelegate),await this._remote.processMessage({msg:e,parent:this.parent}),"input_reply"!==e.header.msg_type)return await this._executeDelegate.promise}get parentHeader(){return this._parentHeader}get parent(){return this._parent}get location(){return this._location}_processWorkerMessage(e){var t,s,i,r;e.header&&(e.header.session=null!==(s=null===(t=this._parentHeader)||void 0===t?void 0:t.session)&&void 0!==s?s:"",e.session=null!==(r=null===(i=this._parentHeader)||void 0===i?void 0:i.session)&&void 0!==r?r:"",this._sendMessage(e),"status"===e.header.msg_type&&"idle"===e.content.execution_state&&this._executeDelegate.resolve())}get ready(){return Promise.resolve()}get isDisposed(){return this._isDisposed}get disposed(){return this._disposed}dispose(){this.isDisposed||(this._worker.terminate(),this._worker=null,this._remote=null,this._isDisposed=!0,this._disposed.emit(void 0))}get id(){return this._id}get name(){return this._name}async initFileSystem(e){let t,s;if(e.location.includes(":")){const i=e.location.split(":");t=i[0],s=i[1]}else t="",s=e.location;await this._remote.ready(),e.mountDrive&&(await this._remote.mount(t,"/drive",d.PageConfig.getBaseUrl()),await this._remote.cd(s))}}const p=s.p+"e32b5c282072d717887b60da73178fdd35a65dc3caeacba7a026e5a4255cc997.png",l=s.p+"5c9063b436cedf0567480fe487ece0d1479ea9545f310cba93fa184ccbab290d.png",_=[{id:"@jupyterlite/xeus-python-kernel-extension:kernel",autoStart:!0,requires:[r.IKernelSpecs,i.IServiceWorkerRegistrationWrapper],activate:(e,t,s)=>{t.register({spec:{name:"xeus-python",display_name:"Python (XPython)",language:"python",argv:[],resources:{"logo-32x32":p,"logo-64x64":l}},create:async e=>new h({...e,mountDrive:s.enabled})})}}]}}]);