@jupyterlite/pyodide-kernel 0.7.0-alpha.0 → 0.7.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/_pypi.d.ts +2 -2
- package/lib/_pypi.js +2 -2
- package/lib/coincident.worker.js +9 -9
- package/lib/coincident.worker.js.map +3 -3
- package/lib/comlink.worker.js +9 -9
- package/lib/comlink.worker.js.map +3 -3
- package/lib/worker.js +8 -19
- package/package.json +7 -7
- package/pypi/all.json +33 -33
- package/pypi/ipykernel-6.9.2-py3-none-any.whl +0 -0
- package/pypi/{piplite-0.7.0a0-py3-none-any.whl → piplite-0.7.0a2-py3-none-any.whl} +0 -0
- package/pypi/{pyodide_kernel-0.7.0a0-py3-none-any.whl → pyodide_kernel-0.7.0a2-py3-none-any.whl} +0 -0
- package/pypi/widgetsnbextension-3.6.999-py3-none-any.whl +0 -0
- package/pypi/widgetsnbextension-4.0.999-py3-none-any.whl +0 -0
package/lib/comlink.worker.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
var vo=Object.create;var Xn=Object.defineProperty;var yo=Object.getOwnPropertyDescriptor;var wo=Object.getOwnPropertyNames;var bo=Object.getPrototypeOf,So=Object.prototype.hasOwnProperty;var et=(i,e)=>()=>(i&&(e=i(i=0)),e);var E=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),xo=(i,e)=>{for(var t in e)Xn(i,t,{get:e[t],enumerable:!0})},Co=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of wo(e))!So.call(i,s)&&s!==t&&Xn(i,s,{get:()=>e[s],enumerable:!(n=yo(e,s))||n.enumerable});return i};var Ee=(i,e,t)=>(t=i!=null?vo(bo(i)):{},Co(e||!i||!i.__esModule?Xn(t,"default",{value:i,enumerable:!0}):t,i));var ei=E((Vt,Cs)=>{(function(i,e){typeof Vt=="object"&&typeof Cs!="undefined"?e(Vt):typeof define=="function"&&define.amd?define(["exports"],e):(i=typeof globalThis!="undefined"?globalThis:i||self,e(i.lumino_algorithm={}))})(Vt,function(i){"use strict";i.ArrayExt=void 0,function(h){function y(b,k,m=0,f=-1){let g=b.length;if(g===0)return-1;m<0?m=Math.max(0,m+g):m=Math.min(m,g-1),f<0?f=Math.max(0,f+g):f=Math.min(f,g-1);let M;f<m?M=f+1+(g-m):M=f-m+1;for(let O=0;O<M;++O){let K=(m+O)%g;if(b[K]===k)return K}return-1}h.firstIndexOf=y;function S(b,k,m=-1,f=0){let g=b.length;if(g===0)return-1;m<0?m=Math.max(0,m+g):m=Math.min(m,g-1),f<0?f=Math.max(0,f+g):f=Math.min(f,g-1);let M;m<f?M=m+1+(g-f):M=m-f+1;for(let O=0;O<M;++O){let K=(m-O+g)%g;if(b[K]===k)return K}return-1}h.lastIndexOf=S;function C(b,k,m=0,f=-1){let g=b.length;if(g===0)return-1;m<0?m=Math.max(0,m+g):m=Math.min(m,g-1),f<0?f=Math.max(0,f+g):f=Math.min(f,g-1);let M;f<m?M=f+1+(g-m):M=f-m+1;for(let O=0;O<M;++O){let K=(m+O)%g;if(k(b[K],K))return K}return-1}h.findFirstIndex=C;function N(b,k,m=-1,f=0){let g=b.length;if(g===0)return-1;m<0?m=Math.max(0,m+g):m=Math.min(m,g-1),f<0?f=Math.max(0,f+g):f=Math.min(f,g-1);let M;m<f?M=m+1+(g-f):M=m-f+1;for(let O=0;O<M;++O){let K=(m-O+g)%g;if(k(b[K],K))return K}return-1}h.findLastIndex=N;function G(b,k,m=0,f=-1){let g=C(b,k,m,f);return g!==-1?b[g]:void 0}h.findFirstValue=G;function z(b,k,m=-1,f=0){let g=N(b,k,m,f);return g!==-1?b[g]:void 0}h.findLastValue=z;function F(b,k,m,f=0,g=-1){let M=b.length;if(M===0)return 0;f<0?f=Math.max(0,f+M):f=Math.min(f,M-1),g<0?g=Math.max(0,g+M):g=Math.min(g,M-1);let O=f,K=g-f+1;for(;K>0;){let we=K>>1,pt=O+we;m(b[pt],k)<0?(O=pt+1,K-=we+1):K=we}return O}h.lowerBound=F;function X(b,k,m,f=0,g=-1){let M=b.length;if(M===0)return 0;f<0?f=Math.max(0,f+M):f=Math.min(f,M-1),g<0?g=Math.max(0,g+M):g=Math.min(g,M-1);let O=f,K=g-f+1;for(;K>0;){let we=K>>1,pt=O+we;m(b[pt],k)>0?K=we:(O=pt+1,K-=we+1)}return O}h.upperBound=X;function $(b,k,m){if(b===k)return!0;if(b.length!==k.length)return!1;for(let f=0,g=b.length;f<g;++f)if(m?!m(b[f],k[f]):b[f]!==k[f])return!1;return!0}h.shallowEqual=$;function ee(b,k={}){let{start:m,stop:f,step:g}=k;if(g===void 0&&(g=1),g===0)throw new Error("Slice `step` cannot be zero.");let M=b.length;m===void 0?m=g<0?M-1:0:m<0?m=Math.max(m+M,g<0?-1:0):m>=M&&(m=g<0?M-1:M),f===void 0?f=g<0?-1:M:f<0?f=Math.max(f+M,g<0?-1:0):f>=M&&(f=g<0?M-1:M);let O;g<0&&f>=m||g>0&&m>=f?O=0:g<0?O=Math.floor((f-m+1)/g+1):O=Math.floor((f-m-1)/g+1);let K=[];for(let we=0;we<O;++we)K[we]=b[m+we*g];return K}h.slice=ee;function Y(b,k,m){let f=b.length;if(f<=1||(k<0?k=Math.max(0,k+f):k=Math.min(k,f-1),m<0?m=Math.max(0,m+f):m=Math.min(m,f-1),k===m))return;let g=b[k],M=k<m?1:-1;for(let O=k;O!==m;O+=M)b[O]=b[O+M];b[m]=g}h.move=Y;function ce(b,k=0,m=-1){let f=b.length;if(!(f<=1))for(k<0?k=Math.max(0,k+f):k=Math.min(k,f-1),m<0?m=Math.max(0,m+f):m=Math.min(m,f-1);k<m;){let g=b[k],M=b[m];b[k++]=M,b[m--]=g}}h.reverse=ce;function Ce(b,k,m=0,f=-1){let g=b.length;if(g<=1||(m<0?m=Math.max(0,m+g):m=Math.min(m,g-1),f<0?f=Math.max(0,f+g):f=Math.min(f,g-1),m>=f))return;let M=f-m+1;if(k>0?k=k%M:k<0&&(k=(k%M+M)%M),k===0)return;let O=m+k;ce(b,m,O-1),ce(b,O,f),ce(b,m,f)}h.rotate=Ce;function Me(b,k,m=0,f=-1){let g=b.length;if(g===0)return;m<0?m=Math.max(0,m+g):m=Math.min(m,g-1),f<0?f=Math.max(0,f+g):f=Math.min(f,g-1);let M;f<m?M=f+1+(g-m):M=f-m+1;for(let O=0;O<M;++O)b[(m+O)%g]=k}h.fill=Me;function uo(b,k,m){let f=b.length;k<0?k=Math.max(0,k+f):k=Math.min(k,f);for(let g=f;g>k;--g)b[g]=b[g-1];b[k]=m}h.insert=uo;function ut(b,k){let m=b.length;if(k<0&&(k+=m),k<0||k>=m)return;let f=b[k];for(let g=k+1;g<m;++g)b[g-1]=b[g];return b.length=m-1,f}h.removeAt=ut;function po(b,k,m=0,f=-1){let g=y(b,k,m,f);return g!==-1&&ut(b,g),g}h.removeFirstOf=po;function ho(b,k,m=-1,f=0){let g=S(b,k,m,f);return g!==-1&&ut(b,g),g}h.removeLastOf=ho;function fo(b,k,m=0,f=-1){let g=b.length;if(g===0)return 0;m<0?m=Math.max(0,m+g):m=Math.min(m,g-1),f<0?f=Math.max(0,f+g):f=Math.min(f,g-1);let M=0;for(let O=0;O<g;++O)m<=f&&O>=m&&O<=f&&b[O]===k||f<m&&(O<=f||O>=m)&&b[O]===k?M++:M>0&&(b[O-M]=b[O]);return M>0&&(b.length=g-M),M}h.removeAllOf=fo;function mo(b,k,m=0,f=-1){let g,M=C(b,k,m,f);return M!==-1&&(g=ut(b,M)),{index:M,value:g}}h.removeFirstWhere=mo;function go(b,k,m=-1,f=0){let g,M=N(b,k,m,f);return M!==-1&&(g=ut(b,M)),{index:M,value:g}}h.removeLastWhere=go;function _o(b,k,m=0,f=-1){let g=b.length;if(g===0)return 0;m<0?m=Math.max(0,m+g):m=Math.min(m,g-1),f<0?f=Math.max(0,f+g):f=Math.min(f,g-1);let M=0;for(let O=0;O<g;++O)m<=f&&O>=m&&O<=f&&k(b[O],O)||f<m&&(O<=f||O>=m)&&k(b[O],O)?M++:M>0&&(b[O-M]=b[O]);return M>0&&(b.length=g-M),M}h.removeAllWhere=_o}(i.ArrayExt||(i.ArrayExt={}));function*e(...h){for(let y of h)yield*y}function*t(){}function*n(h,y=0){for(let S of h)yield[y++,S]}function*s(h,y){let S=0;for(let C of h)y(C,S++)&&(yield C)}function r(h,y){let S=0;for(let C of h)if(y(C,S++))return C}function a(h,y){let S=0;for(let C of h)if(y(C,S++))return S-1;return-1}function o(h,y){let S;for(let C of h){if(S===void 0){S=C;continue}y(C,S)<0&&(S=C)}return S}function u(h,y){let S;for(let C of h){if(S===void 0){S=C;continue}y(C,S)>0&&(S=C)}return S}function c(h,y){let S=!0,C,N;for(let G of h)S?(C=G,N=G,S=!1):y(G,C)<0?C=G:y(G,N)>0&&(N=G);return S?void 0:[C,N]}function d(h){return Array.from(h)}function l(h){let y={};for(let[S,C]of h)y[S]=C;return y}function p(h,y){let S=0;for(let C of h)if(y(C,S++)===!1)return}function v(h,y){let S=0;for(let C of h)if(y(C,S++)===!1)return!1;return!0}function _(h,y){let S=0;for(let C of h)if(y(C,S++))return!0;return!1}function*I(h,y){let S=0;for(let C of h)yield y(C,S++)}function*P(h,y,S){y===void 0?(y=h,h=0,S=1):S===void 0&&(S=1);let C=D.rangeLength(h,y,S);for(let N=0;N<C;N++)yield h+S*N}var D;(function(h){function y(S,C,N){return N===0?1/0:S>C&&N>0||S<C&&N<0?0:Math.ceil((C-S)/N)}h.rangeLength=y})(D||(D={}));function q(h,y,S){let C=h[Symbol.iterator](),N=0,G=C.next();if(G.done&&S===void 0)throw new TypeError("Reduce of empty iterable with no initial value.");if(G.done)return S;let z=C.next();if(z.done&&S===void 0)return G.value;if(z.done)return y(S,G.value,N++);let F;S===void 0?F=y(G.value,z.value,N++):F=y(y(S,G.value,N++),z.value,N++);let X;for(;!(X=C.next()).done;)F=y(F,X.value,N++);return F}function*x(h,y){for(;0<y--;)yield h}function*w(h){yield h}function*R(h){if(typeof h.retro=="function")yield*h.retro();else for(let y=h.length-1;y>-1;y--)yield h[y]}function A(h){let y=[],S=new Set,C=new Map;for(let z of h)N(z);for(let[z]of C)G(z);return y;function N(z){let[F,X]=z,$=C.get(X);$?$.push(F):C.set(X,[F])}function G(z){if(S.has(z))return;S.add(z);let F=C.get(z);if(F)for(let X of F)G(X);y.push(z)}}function*T(h,y){let S=0;for(let C of h)S++%y===0&&(yield C)}i.StringExt=void 0,function(h){function y(z,F,X=0){let $=new Array(F.length);for(let ee=0,Y=X,ce=F.length;ee<ce;++ee,++Y){if(Y=z.indexOf(F[ee],Y),Y===-1)return null;$[ee]=Y}return $}h.findIndices=y;function S(z,F,X=0){let $=y(z,F,X);if(!$)return null;let ee=0;for(let Y=0,ce=$.length;Y<ce;++Y){let Ce=$[Y]-X;ee+=Ce*Ce}return{score:ee,indices:$}}h.matchSumOfSquares=S;function C(z,F,X=0){let $=y(z,F,X);if(!$)return null;let ee=0,Y=X-1;for(let ce=0,Ce=$.length;ce<Ce;++ce){let Me=$[ce];ee+=Me-Y-1,Y=Me}return{score:ee,indices:$}}h.matchSumOfDeltas=C;function N(z,F,X){let $=[],ee=0,Y=0,ce=F.length;for(;ee<ce;){let Ce=F[ee],Me=F[ee];for(;++ee<ce&&F[ee]===Me+1;)Me++;Y<Ce&&$.push(z.slice(Y,Ce)),Ce<Me+1&&$.push(X(z.slice(Ce,Me+1))),Y=Me+1}return Y<z.length&&$.push(z.slice(Y)),$}h.highlight=N;function G(z,F){return z<F?-1:z>F?1:0}h.cmp=G}(i.StringExt||(i.StringExt={}));function*j(h,y){if(y<1)return;let S=h[Symbol.iterator](),C;for(;0<y--&&!(C=S.next()).done;)yield C.value}function*U(...h){let y=h.map(C=>C[Symbol.iterator]()),S=y.map(C=>C.next());for(;v(S,C=>!C.done);S=y.map(C=>C.next()))yield S.map(C=>C.value)}i.chain=e,i.each=p,i.empty=t,i.enumerate=n,i.every=v,i.filter=s,i.find=r,i.findIndex=a,i.map=I,i.max=u,i.min=o,i.minmax=c,i.once=w,i.range=P,i.reduce=q,i.repeat=x,i.retro=R,i.some=_,i.stride=T,i.take=j,i.toArray=d,i.toObject=l,i.topologicSort=A,i.zip=U})});var te=E((Wt,ks)=>{(function(i,e){typeof Wt=="object"&&typeof ks!="undefined"?e(Wt,ei()):typeof define=="function"&&define.amd?define(["exports","@lumino/algorithm"],e):(i=typeof globalThis!="undefined"?globalThis:i||self,e(i.lumino_coreutils={},i.lumino_algorithm))})(Wt,function(i,e){"use strict";i.JSONExt=void 0,function(c){c.emptyObject=Object.freeze({}),c.emptyArray=Object.freeze([]);function d(x){return x===null||typeof x=="boolean"||typeof x=="number"||typeof x=="string"}c.isPrimitive=d;function l(x){return Array.isArray(x)}c.isArray=l;function p(x){return!d(x)&&!l(x)}c.isObject=p;function v(x,w){if(x===w)return!0;if(d(x)||d(w))return!1;let R=l(x),A=l(w);return R!==A?!1:R&&A?I(x,w):P(x,w)}c.deepEqual=v;function _(x){return d(x)?x:l(x)?D(x):q(x)}c.deepCopy=_;function I(x,w){if(x===w)return!0;if(x.length!==w.length)return!1;for(let R=0,A=x.length;R<A;++R)if(!v(x[R],w[R]))return!1;return!0}function P(x,w){if(x===w)return!0;for(let R in x)if(x[R]!==void 0&&!(R in w))return!1;for(let R in w)if(w[R]!==void 0&&!(R in x))return!1;for(let R in x){let A=x[R],T=w[R];if(!(A===void 0&&T===void 0)&&(A===void 0||T===void 0||!v(A,T)))return!1}return!0}function D(x){let w=new Array(x.length);for(let R=0,A=x.length;R<A;++R)w[R]=_(x[R]);return w}function q(x){let w={};for(let R in x){let A=x[R];A!==void 0&&(w[R]=_(A))}return w}}(i.JSONExt||(i.JSONExt={}));class t{constructor(){this._types=[],this._values=[]}types(){return this._types.slice()}hasData(d){return this._types.indexOf(d)!==-1}getData(d){let l=this._types.indexOf(d);return l!==-1?this._values[l]:void 0}setData(d,l){this.clearData(d),this._types.push(d),this._values.push(l)}clearData(d){let l=this._types.indexOf(d);l!==-1&&(this._types.splice(l,1),this._values.splice(l,1))}clear(){this._types.length=0,this._values.length=0}}class n{constructor(d={}){this._application=null,this._validatePlugin=()=>!0,this._plugins=new Map,this._services=new Map,d.validatePlugin&&(console.info("Plugins may be rejected by the custom validation plugin method."),this._validatePlugin=d.validatePlugin)}get application(){return this._application}set application(d){if(this._application!==null)throw Error("PluginRegistry.application is already set. It cannot be overridden.");this._application=d}get deferredPlugins(){return Array.from(this._plugins).filter(([d,l])=>l.autoStart==="defer").map(([d,l])=>d)}getPluginDescription(d){var l,p;return(p=(l=this._plugins.get(d))===null||l===void 0?void 0:l.description)!==null&&p!==void 0?p:""}hasPlugin(d){return this._plugins.has(d)}isPluginActivated(d){var l,p;return(p=(l=this._plugins.get(d))===null||l===void 0?void 0:l.activated)!==null&&p!==void 0?p:!1}listPlugins(){return Array.from(this._plugins.keys())}registerPlugin(d){if(this._plugins.has(d.id))throw new TypeError(`Plugin '${d.id}' is already registered.`);if(!this._validatePlugin(d))throw new Error(`Plugin '${d.id}' is not valid.`);let l=s.createPluginData(d);s.ensureNoCycle(l,this._plugins,this._services),l.provides&&this._services.set(l.provides,l.id),this._plugins.set(l.id,l)}registerPlugins(d){for(let l of d)this.registerPlugin(l)}deregisterPlugin(d,l){let p=this._plugins.get(d);if(p){if(p.activated&&!l)throw new Error(`Plugin '${d}' is still active.`);this._plugins.delete(d)}}async activatePlugin(d){let l=this._plugins.get(d);if(!l)throw new ReferenceError(`Plugin '${d}' is not registered.`);if(l.activated)return;if(l.promise)return l.promise;let p=l.requires.map(_=>this.resolveRequiredService(_)),v=l.optional.map(_=>this.resolveOptionalService(_));return l.promise=Promise.all([...p,...v]).then(_=>l.activate.apply(void 0,[this.application,..._])).then(_=>{l.service=_,l.activated=!0,l.promise=null}).catch(_=>{throw l.promise=null,_}),l.promise}async activatePlugins(d,l={}){switch(d){case"defer":{let p=this.deferredPlugins.filter(v=>this._plugins.get(v).autoStart).map(v=>this.activatePlugin(v));await Promise.all(p);break}case"startUp":{let v=s.collectStartupPlugins(this._plugins,l).map(async _=>{try{return await this.activatePlugin(_)}catch(I){console.error(`Plugin '${_}' failed to activate.`,I)}});await Promise.all(v);break}}}async deactivatePlugin(d){let l=this._plugins.get(d);if(!l)throw new ReferenceError(`Plugin '${d}' is not registered.`);if(!l.activated)return[];if(!l.deactivate)throw new TypeError(`Plugin '${d}'#deactivate() method missing`);let p=s.findDependents(d,this._plugins,this._services),v=p.map(_=>this._plugins.get(_));for(let _ of v)if(!_.deactivate)throw new TypeError(`Plugin ${_.id}#deactivate() method missing (depends on ${d})`);for(let _ of v){let I=[..._.requires,..._.optional].map(P=>{let D=this._services.get(P);return D?this._plugins.get(D).service:null});await _.deactivate(this.application,...I),_.service=null,_.activated=!1}return p.pop(),p}async resolveRequiredService(d){let l=this._services.get(d);if(!l)throw new TypeError(`No provider for: ${d.name}.`);let p=this._plugins.get(l);return p.activated||await this.activatePlugin(l),p.service}async resolveOptionalService(d){let l=this._services.get(d);if(!l)return null;let p=this._plugins.get(l);if(!p.activated)try{await this.activatePlugin(l)}catch(v){return console.error(v),null}return p.service}}var s;(function(c){class d{constructor(P){var D,q,x,w;this._activated=!1,this._promise=null,this._service=null,this.id=P.id,this.description=(D=P.description)!==null&&D!==void 0?D:"",this.activate=P.activate,this.deactivate=(q=P.deactivate)!==null&&q!==void 0?q:null,this.provides=(x=P.provides)!==null&&x!==void 0?x:null,this.autoStart=(w=P.autoStart)!==null&&w!==void 0?w:!1,this.requires=P.requires?P.requires.slice():[],this.optional=P.optional?P.optional.slice():[]}get activated(){return this._activated}set activated(P){this._activated=P}get service(){return this._service}set service(P){this._service=P}get promise(){return this._promise}set promise(P){this._promise=P}}function l(I){return new d(I)}c.createPluginData=l;function p(I,P,D){let q=[...I.requires,...I.optional],x=R=>{if(R===I.provides)return!0;let A=D.get(R);if(!A)return!1;let T=P.get(A),j=[...T.requires,...T.optional];return j.length===0?!1:(w.push(A),j.some(x)?!0:(w.pop(),!1))};if(!I.provides||q.length===0)return;let w=[I.id];if(q.some(x))throw new ReferenceError(`Cycle detected: ${w.join(" -> ")}.`)}c.ensureNoCycle=p;function v(I,P,D){let q=new Array,x=j=>{let U=P.get(j),h=[...U.requires,...U.optional];q.push(...h.reduce((y,S)=>{let C=D.get(S);return C&&y.push([j,C]),y},[]))};for(let j of P.keys())x(j);let w=q.filter(j=>j[1]===I),R=0;for(;w.length>R;){let j=w.length,U=new Set(w.map(h=>h[0]));for(let h of U)q.filter(y=>y[1]===h).forEach(y=>{w.includes(y)||w.push(y)});R=j}let A=e.topologicSort(w),T=A.findIndex(j=>j===I);return T===-1?[I]:A.slice(0,T+1)}c.findDependents=v;function _(I,P){let D=new Set;for(let q of I.keys())I.get(q).autoStart===!0&&D.add(q);if(P.startPlugins)for(let q of P.startPlugins)D.add(q);if(P.ignorePlugins)for(let q of P.ignorePlugins)D.delete(q);return Array.from(D)}c.collectStartupPlugins=_})(s||(s={}));class r{constructor(){this.promise=new Promise((d,l)=>{this._resolve=d,this._reject=l})}resolve(d){let l=this._resolve;l(d)}reject(d){let l=this._reject;l(d)}}class a{constructor(d,l){this.name=d,this.description=l!=null?l:"",this._tokenStructuralPropertyT=null}}function o(c){let d=0;for(let l=0,p=c.length;l<p;++l)l%4===0&&(d=Math.random()*4294967295>>>0),c[l]=d&255,d>>>=8}i.Random=void 0,function(c){c.getRandomValues=(()=>{let d=typeof window!="undefined"&&(window.crypto||window.msCrypto)||null;return d&&typeof d.getRandomValues=="function"?function(p){return d.getRandomValues(p)}:o})()}(i.Random||(i.Random={}));function u(c){let d=new Uint8Array(16),l=new Array(256);for(let p=0;p<16;++p)l[p]="0"+p.toString(16);for(let p=16;p<256;++p)l[p]=p.toString(16);return function(){return c(d),d[6]=64|d[6]&15,d[8]=128|d[8]&63,l[d[0]]+l[d[1]]+l[d[2]]+l[d[3]]+"-"+l[d[4]]+l[d[5]]+"-"+l[d[6]]+l[d[7]]+"-"+l[d[8]]+l[d[9]]+"-"+l[d[10]]+l[d[11]]+l[d[12]]+l[d[13]]+l[d[14]]+l[d[15]]}}i.UUID=void 0,function(c){c.uuid4=u(i.Random.getRandomValues)}(i.UUID||(i.UUID={})),i.MimeData=t,i.PluginRegistry=n,i.PromiseDelegate=r,i.Token=a})});var Z=E((Jt,Ps)=>{(function(i,e){typeof Jt=="object"&&typeof Ps!="undefined"?e(Jt,ei(),te()):typeof define=="function"&&define.amd?define(["exports","@lumino/algorithm","@lumino/coreutils"],e):(i=typeof globalThis!="undefined"?globalThis:i||self,e(i.lumino_signaling={},i.lumino_algorithm,i.lumino_coreutils))})(Jt,function(i,e,t){"use strict";class n{constructor(o){this.sender=o}connect(o,u){return r.connect(this,o,u)}disconnect(o,u){return r.disconnect(this,o,u)}emit(o){r.emit(this,o)}}(function(a){function o(_,I){r.disconnectBetween(_,I)}a.disconnectBetween=o;function u(_){r.disconnectSender(_)}a.disconnectSender=u;function c(_){r.disconnectReceiver(_)}a.disconnectReceiver=c;function d(_){r.disconnectAll(_)}a.disconnectAll=d;function l(_){r.disconnectAll(_)}a.clearData=l;function p(){return r.exceptionHandler}a.getExceptionHandler=p;function v(_){let I=r.exceptionHandler;return r.exceptionHandler=_,I}a.setExceptionHandler=v})(n||(n={}));class s extends n{constructor(){super(...arguments),this._pending=new t.PromiseDelegate}async*[Symbol.asyncIterator](){let o=this._pending;for(;;)try{let{args:u,next:c}=await o.promise;o=c,yield u}catch{return}}emit(o){let u=this._pending,c=this._pending=new t.PromiseDelegate;u.resolve({args:o,next:c}),super.emit(o)}stop(){this._pending.promise.catch(()=>{}),this._pending.reject("stop"),this._pending=new t.PromiseDelegate}}var r;(function(a){a.exceptionHandler=j=>{console.error(j)};function o(j,U,h){h=h||void 0;let y=_.get(j.sender);if(y||(y=[],_.set(j.sender,y)),q(y,j,U,h))return!1;let S=h||U,C=I.get(S);C||(C=[],I.set(S,C));let N={signal:j,slot:U,thisArg:h};return y.push(N),C.push(N),!0}a.connect=o;function u(j,U,h){h=h||void 0;let y=_.get(j.sender);if(!y||y.length===0)return!1;let S=q(y,j,U,h);if(!S)return!1;let C=h||U,N=I.get(C);return S.signal=null,w(y),w(N),!0}a.disconnect=u;function c(j,U){let h=_.get(j);if(!h||h.length===0)return;let y=I.get(U);if(!(!y||y.length===0)){for(let S of y)S.signal&&S.signal.sender===j&&(S.signal=null);w(h),w(y)}}a.disconnectBetween=c;function d(j){let U=_.get(j);if(!(!U||U.length===0)){for(let h of U){if(!h.signal)continue;let y=h.thisArg||h.slot;h.signal=null,w(I.get(y))}w(U)}}a.disconnectSender=d;function l(j){let U=I.get(j);if(!(!U||U.length===0)){for(let h of U){if(!h.signal)continue;let y=h.signal.sender;h.signal=null,w(_.get(y))}w(U)}}a.disconnectReceiver=l;function p(j){d(j),l(j)}a.disconnectAll=p;function v(j,U){let h=_.get(j.sender);if(!(!h||h.length===0))for(let y=0,S=h.length;y<S;++y){let C=h[y];C.signal===j&&x(C,U)}}a.emit=v;let _=new WeakMap,I=new WeakMap,P=new Set,D=typeof requestAnimationFrame=="function"?requestAnimationFrame:setImmediate;function q(j,U,h,y){return e.find(j,S=>S.signal===U&&S.slot===h&&S.thisArg===y)}function x(j,U){let{signal:h,slot:y,thisArg:S}=j;try{y.call(S,h.sender,U)}catch(C){a.exceptionHandler(C)}}function w(j){P.size===0&&D(R),P.add(j)}function R(){P.forEach(A),P.clear()}function A(j){e.ArrayExt.removeAllWhere(j,T)}function T(j){return j.signal===null}})(r||(r={})),i.Signal=n,i.Stream=s})});var Es=E(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});Ht.ActivityMonitor=void 0;var Ms=Z(),ti=class{constructor(e){this._timer=-1,this._timeout=-1,this._isDisposed=!1,this._activityStopped=new Ms.Signal(this),e.signal.connect(this._onSignalFired,this),this._timeout=e.timeout||1e3}get activityStopped(){return this._activityStopped}get timeout(){return this._timeout}set timeout(e){this._timeout=e}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed||(this._isDisposed=!0,Ms.Signal.clearData(this))}_onSignalFired(e,t){clearTimeout(this._timer),this._sender=e,this._args=t,this._timer=setTimeout(()=>{this._activityStopped.emit({sender:this._sender,args:this._args})},this._timeout)}};Ht.ActivityMonitor=ti});var Rs=E(Is=>{"use strict";Object.defineProperty(Is,"__esModule",{value:!0})});var Os=E(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.LruCache=void 0;var No=128,ni=class{constructor(e={}){this._map=new Map,this._maxSize=(e==null?void 0:e.maxSize)||No}get size(){return this._map.size}clear(){this._map.clear()}get(e){let t=this._map.get(e)||null;return t!=null&&(this._map.delete(e),this._map.set(e,t)),t}set(e,t){this._map.size>=this._maxSize&&this._map.delete(this._map.keys().next().value),this._map.set(e,t)}};Gt.LruCache=ni});var js=E(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.MarkdownCodeBlocks=void 0;var Ds;(function(i){i.CODE_BLOCK_MARKER="```";let e=[".markdown",".mdown",".mkdn",".md",".mkd",".mdwn",".mdtxt",".mdtext",".text",".txt",".Rmd"];class t{constructor(a){this.startLine=a,this.code="",this.endLine=-1}}i.MarkdownCodeBlock=t;function n(r){return e.indexOf(r)>-1}i.isMarkdown=n;function s(r){if(!r||r==="")return[];let a=r.split(`
|
|
1
|
+
var vo=Object.create;var Zn=Object.defineProperty;var yo=Object.getOwnPropertyDescriptor;var wo=Object.getOwnPropertyNames;var bo=Object.getPrototypeOf,So=Object.prototype.hasOwnProperty;var et=(i,e)=>()=>(i&&(e=i(i=0)),e);var E=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),xo=(i,e)=>{for(var t in e)Zn(i,t,{get:e[t],enumerable:!0})},Co=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of wo(e))!So.call(i,s)&&s!==t&&Zn(i,s,{get:()=>e[s],enumerable:!(n=yo(e,s))||n.enumerable});return i};var Ee=(i,e,t)=>(t=i!=null?vo(bo(i)):{},Co(e||!i||!i.__esModule?Zn(t,"default",{value:i,enumerable:!0}):t,i));var ti=E((Vt,ks)=>{(function(i,e){typeof Vt=="object"&&typeof ks!="undefined"?e(Vt):typeof define=="function"&&define.amd?define(["exports"],e):(i=typeof globalThis!="undefined"?globalThis:i||self,e(i.lumino_algorithm={}))})(Vt,function(i){"use strict";i.ArrayExt=void 0,function(h){function y(b,k,m=0,f=-1){let g=b.length;if(g===0)return-1;m<0?m=Math.max(0,m+g):m=Math.min(m,g-1),f<0?f=Math.max(0,f+g):f=Math.min(f,g-1);let M;f<m?M=f+1+(g-m):M=f-m+1;for(let O=0;O<M;++O){let K=(m+O)%g;if(b[K]===k)return K}return-1}h.firstIndexOf=y;function S(b,k,m=-1,f=0){let g=b.length;if(g===0)return-1;m<0?m=Math.max(0,m+g):m=Math.min(m,g-1),f<0?f=Math.max(0,f+g):f=Math.min(f,g-1);let M;m<f?M=m+1+(g-f):M=m-f+1;for(let O=0;O<M;++O){let K=(m-O+g)%g;if(b[K]===k)return K}return-1}h.lastIndexOf=S;function C(b,k,m=0,f=-1){let g=b.length;if(g===0)return-1;m<0?m=Math.max(0,m+g):m=Math.min(m,g-1),f<0?f=Math.max(0,f+g):f=Math.min(f,g-1);let M;f<m?M=f+1+(g-m):M=f-m+1;for(let O=0;O<M;++O){let K=(m+O)%g;if(k(b[K],K))return K}return-1}h.findFirstIndex=C;function N(b,k,m=-1,f=0){let g=b.length;if(g===0)return-1;m<0?m=Math.max(0,m+g):m=Math.min(m,g-1),f<0?f=Math.max(0,f+g):f=Math.min(f,g-1);let M;m<f?M=m+1+(g-f):M=m-f+1;for(let O=0;O<M;++O){let K=(m-O+g)%g;if(k(b[K],K))return K}return-1}h.findLastIndex=N;function G(b,k,m=0,f=-1){let g=C(b,k,m,f);return g!==-1?b[g]:void 0}h.findFirstValue=G;function z(b,k,m=-1,f=0){let g=N(b,k,m,f);return g!==-1?b[g]:void 0}h.findLastValue=z;function F(b,k,m,f=0,g=-1){let M=b.length;if(M===0)return 0;f<0?f=Math.max(0,f+M):f=Math.min(f,M-1),g<0?g=Math.max(0,g+M):g=Math.min(g,M-1);let O=f,K=g-f+1;for(;K>0;){let we=K>>1,pt=O+we;m(b[pt],k)<0?(O=pt+1,K-=we+1):K=we}return O}h.lowerBound=F;function X(b,k,m,f=0,g=-1){let M=b.length;if(M===0)return 0;f<0?f=Math.max(0,f+M):f=Math.min(f,M-1),g<0?g=Math.max(0,g+M):g=Math.min(g,M-1);let O=f,K=g-f+1;for(;K>0;){let we=K>>1,pt=O+we;m(b[pt],k)>0?K=we:(O=pt+1,K-=we+1)}return O}h.upperBound=X;function $(b,k,m){if(b===k)return!0;if(b.length!==k.length)return!1;for(let f=0,g=b.length;f<g;++f)if(m?!m(b[f],k[f]):b[f]!==k[f])return!1;return!0}h.shallowEqual=$;function ee(b,k={}){let{start:m,stop:f,step:g}=k;if(g===void 0&&(g=1),g===0)throw new Error("Slice `step` cannot be zero.");let M=b.length;m===void 0?m=g<0?M-1:0:m<0?m=Math.max(m+M,g<0?-1:0):m>=M&&(m=g<0?M-1:M),f===void 0?f=g<0?-1:M:f<0?f=Math.max(f+M,g<0?-1:0):f>=M&&(f=g<0?M-1:M);let O;g<0&&f>=m||g>0&&m>=f?O=0:g<0?O=Math.floor((f-m+1)/g+1):O=Math.floor((f-m-1)/g+1);let K=[];for(let we=0;we<O;++we)K[we]=b[m+we*g];return K}h.slice=ee;function Y(b,k,m){let f=b.length;if(f<=1||(k<0?k=Math.max(0,k+f):k=Math.min(k,f-1),m<0?m=Math.max(0,m+f):m=Math.min(m,f-1),k===m))return;let g=b[k],M=k<m?1:-1;for(let O=k;O!==m;O+=M)b[O]=b[O+M];b[m]=g}h.move=Y;function ce(b,k=0,m=-1){let f=b.length;if(!(f<=1))for(k<0?k=Math.max(0,k+f):k=Math.min(k,f-1),m<0?m=Math.max(0,m+f):m=Math.min(m,f-1);k<m;){let g=b[k],M=b[m];b[k++]=M,b[m--]=g}}h.reverse=ce;function Ce(b,k,m=0,f=-1){let g=b.length;if(g<=1||(m<0?m=Math.max(0,m+g):m=Math.min(m,g-1),f<0?f=Math.max(0,f+g):f=Math.min(f,g-1),m>=f))return;let M=f-m+1;if(k>0?k=k%M:k<0&&(k=(k%M+M)%M),k===0)return;let O=m+k;ce(b,m,O-1),ce(b,O,f),ce(b,m,f)}h.rotate=Ce;function Me(b,k,m=0,f=-1){let g=b.length;if(g===0)return;m<0?m=Math.max(0,m+g):m=Math.min(m,g-1),f<0?f=Math.max(0,f+g):f=Math.min(f,g-1);let M;f<m?M=f+1+(g-m):M=f-m+1;for(let O=0;O<M;++O)b[(m+O)%g]=k}h.fill=Me;function uo(b,k,m){let f=b.length;k<0?k=Math.max(0,k+f):k=Math.min(k,f);for(let g=f;g>k;--g)b[g]=b[g-1];b[k]=m}h.insert=uo;function ut(b,k){let m=b.length;if(k<0&&(k+=m),k<0||k>=m)return;let f=b[k];for(let g=k+1;g<m;++g)b[g-1]=b[g];return b.length=m-1,f}h.removeAt=ut;function po(b,k,m=0,f=-1){let g=y(b,k,m,f);return g!==-1&&ut(b,g),g}h.removeFirstOf=po;function ho(b,k,m=-1,f=0){let g=S(b,k,m,f);return g!==-1&&ut(b,g),g}h.removeLastOf=ho;function fo(b,k,m=0,f=-1){let g=b.length;if(g===0)return 0;m<0?m=Math.max(0,m+g):m=Math.min(m,g-1),f<0?f=Math.max(0,f+g):f=Math.min(f,g-1);let M=0;for(let O=0;O<g;++O)m<=f&&O>=m&&O<=f&&b[O]===k||f<m&&(O<=f||O>=m)&&b[O]===k?M++:M>0&&(b[O-M]=b[O]);return M>0&&(b.length=g-M),M}h.removeAllOf=fo;function mo(b,k,m=0,f=-1){let g,M=C(b,k,m,f);return M!==-1&&(g=ut(b,M)),{index:M,value:g}}h.removeFirstWhere=mo;function go(b,k,m=-1,f=0){let g,M=N(b,k,m,f);return M!==-1&&(g=ut(b,M)),{index:M,value:g}}h.removeLastWhere=go;function _o(b,k,m=0,f=-1){let g=b.length;if(g===0)return 0;m<0?m=Math.max(0,m+g):m=Math.min(m,g-1),f<0?f=Math.max(0,f+g):f=Math.min(f,g-1);let M=0;for(let O=0;O<g;++O)m<=f&&O>=m&&O<=f&&k(b[O],O)||f<m&&(O<=f||O>=m)&&k(b[O],O)?M++:M>0&&(b[O-M]=b[O]);return M>0&&(b.length=g-M),M}h.removeAllWhere=_o}(i.ArrayExt||(i.ArrayExt={}));function*e(...h){for(let y of h)yield*y}function*t(){}function*n(h,y=0){for(let S of h)yield[y++,S]}function*s(h,y){let S=0;for(let C of h)y(C,S++)&&(yield C)}function r(h,y){let S=0;for(let C of h)if(y(C,S++))return C}function a(h,y){let S=0;for(let C of h)if(y(C,S++))return S-1;return-1}function o(h,y){let S;for(let C of h){if(S===void 0){S=C;continue}y(C,S)<0&&(S=C)}return S}function u(h,y){let S;for(let C of h){if(S===void 0){S=C;continue}y(C,S)>0&&(S=C)}return S}function c(h,y){let S=!0,C,N;for(let G of h)S?(C=G,N=G,S=!1):y(G,C)<0?C=G:y(G,N)>0&&(N=G);return S?void 0:[C,N]}function d(h){return Array.from(h)}function l(h){let y={};for(let[S,C]of h)y[S]=C;return y}function p(h,y){let S=0;for(let C of h)if(y(C,S++)===!1)return}function v(h,y){let S=0;for(let C of h)if(y(C,S++)===!1)return!1;return!0}function _(h,y){let S=0;for(let C of h)if(y(C,S++))return!0;return!1}function*I(h,y){let S=0;for(let C of h)yield y(C,S++)}function*P(h,y,S){y===void 0?(y=h,h=0,S=1):S===void 0&&(S=1);let C=D.rangeLength(h,y,S);for(let N=0;N<C;N++)yield h+S*N}var D;(function(h){function y(S,C,N){return N===0?1/0:S>C&&N>0||S<C&&N<0?0:Math.ceil((C-S)/N)}h.rangeLength=y})(D||(D={}));function q(h,y,S){let C=h[Symbol.iterator](),N=0,G=C.next();if(G.done&&S===void 0)throw new TypeError("Reduce of empty iterable with no initial value.");if(G.done)return S;let z=C.next();if(z.done&&S===void 0)return G.value;if(z.done)return y(S,G.value,N++);let F;S===void 0?F=y(G.value,z.value,N++):F=y(y(S,G.value,N++),z.value,N++);let X;for(;!(X=C.next()).done;)F=y(F,X.value,N++);return F}function*x(h,y){for(;0<y--;)yield h}function*w(h){yield h}function*R(h){if(typeof h.retro=="function")yield*h.retro();else for(let y=h.length-1;y>-1;y--)yield h[y]}function A(h){let y=[],S=new Set,C=new Map;for(let z of h)N(z);for(let[z]of C)G(z);return y;function N(z){let[F,X]=z,$=C.get(X);$?$.push(F):C.set(X,[F])}function G(z){if(S.has(z))return;S.add(z);let F=C.get(z);if(F)for(let X of F)G(X);y.push(z)}}function*T(h,y){let S=0;for(let C of h)S++%y===0&&(yield C)}i.StringExt=void 0,function(h){function y(z,F,X=0){let $=new Array(F.length);for(let ee=0,Y=X,ce=F.length;ee<ce;++ee,++Y){if(Y=z.indexOf(F[ee],Y),Y===-1)return null;$[ee]=Y}return $}h.findIndices=y;function S(z,F,X=0){let $=y(z,F,X);if(!$)return null;let ee=0;for(let Y=0,ce=$.length;Y<ce;++Y){let Ce=$[Y]-X;ee+=Ce*Ce}return{score:ee,indices:$}}h.matchSumOfSquares=S;function C(z,F,X=0){let $=y(z,F,X);if(!$)return null;let ee=0,Y=X-1;for(let ce=0,Ce=$.length;ce<Ce;++ce){let Me=$[ce];ee+=Me-Y-1,Y=Me}return{score:ee,indices:$}}h.matchSumOfDeltas=C;function N(z,F,X){let $=[],ee=0,Y=0,ce=F.length;for(;ee<ce;){let Ce=F[ee],Me=F[ee];for(;++ee<ce&&F[ee]===Me+1;)Me++;Y<Ce&&$.push(z.slice(Y,Ce)),Ce<Me+1&&$.push(X(z.slice(Ce,Me+1))),Y=Me+1}return Y<z.length&&$.push(z.slice(Y)),$}h.highlight=N;function G(z,F){return z<F?-1:z>F?1:0}h.cmp=G}(i.StringExt||(i.StringExt={}));function*j(h,y){if(y<1)return;let S=h[Symbol.iterator](),C;for(;0<y--&&!(C=S.next()).done;)yield C.value}function*U(...h){let y=h.map(C=>C[Symbol.iterator]()),S=y.map(C=>C.next());for(;v(S,C=>!C.done);S=y.map(C=>C.next()))yield S.map(C=>C.value)}i.chain=e,i.each=p,i.empty=t,i.enumerate=n,i.every=v,i.filter=s,i.find=r,i.findIndex=a,i.map=I,i.max=u,i.min=o,i.minmax=c,i.once=w,i.range=P,i.reduce=q,i.repeat=x,i.retro=R,i.some=_,i.stride=T,i.take=j,i.toArray=d,i.toObject=l,i.topologicSort=A,i.zip=U})});var te=E((Wt,Ps)=>{(function(i,e){typeof Wt=="object"&&typeof Ps!="undefined"?e(Wt,ti()):typeof define=="function"&&define.amd?define(["exports","@lumino/algorithm"],e):(i=typeof globalThis!="undefined"?globalThis:i||self,e(i.lumino_coreutils={},i.lumino_algorithm))})(Wt,function(i,e){"use strict";i.JSONExt=void 0,function(c){c.emptyObject=Object.freeze({}),c.emptyArray=Object.freeze([]);function d(x){return x===null||typeof x=="boolean"||typeof x=="number"||typeof x=="string"}c.isPrimitive=d;function l(x){return Array.isArray(x)}c.isArray=l;function p(x){return!d(x)&&!l(x)}c.isObject=p;function v(x,w){if(x===w)return!0;if(d(x)||d(w))return!1;let R=l(x),A=l(w);return R!==A?!1:R&&A?I(x,w):P(x,w)}c.deepEqual=v;function _(x){return d(x)?x:l(x)?D(x):q(x)}c.deepCopy=_;function I(x,w){if(x===w)return!0;if(x.length!==w.length)return!1;for(let R=0,A=x.length;R<A;++R)if(!v(x[R],w[R]))return!1;return!0}function P(x,w){if(x===w)return!0;for(let R in x)if(x[R]!==void 0&&!(R in w))return!1;for(let R in w)if(w[R]!==void 0&&!(R in x))return!1;for(let R in x){let A=x[R],T=w[R];if(!(A===void 0&&T===void 0)&&(A===void 0||T===void 0||!v(A,T)))return!1}return!0}function D(x){let w=new Array(x.length);for(let R=0,A=x.length;R<A;++R)w[R]=_(x[R]);return w}function q(x){let w={};for(let R in x){let A=x[R];A!==void 0&&(w[R]=_(A))}return w}}(i.JSONExt||(i.JSONExt={}));class t{constructor(){this._types=[],this._values=[]}types(){return this._types.slice()}hasData(d){return this._types.indexOf(d)!==-1}getData(d){let l=this._types.indexOf(d);return l!==-1?this._values[l]:void 0}setData(d,l){this.clearData(d),this._types.push(d),this._values.push(l)}clearData(d){let l=this._types.indexOf(d);l!==-1&&(this._types.splice(l,1),this._values.splice(l,1))}clear(){this._types.length=0,this._values.length=0}}class n{constructor(d={}){this._application=null,this._validatePlugin=()=>!0,this._plugins=new Map,this._services=new Map,d.validatePlugin&&(console.info("Plugins may be rejected by the custom validation plugin method."),this._validatePlugin=d.validatePlugin)}get application(){return this._application}set application(d){if(this._application!==null)throw Error("PluginRegistry.application is already set. It cannot be overridden.");this._application=d}get deferredPlugins(){return Array.from(this._plugins).filter(([d,l])=>l.autoStart==="defer").map(([d,l])=>d)}getPluginDescription(d){var l,p;return(p=(l=this._plugins.get(d))===null||l===void 0?void 0:l.description)!==null&&p!==void 0?p:""}hasPlugin(d){return this._plugins.has(d)}isPluginActivated(d){var l,p;return(p=(l=this._plugins.get(d))===null||l===void 0?void 0:l.activated)!==null&&p!==void 0?p:!1}listPlugins(){return Array.from(this._plugins.keys())}registerPlugin(d){if(this._plugins.has(d.id))throw new TypeError(`Plugin '${d.id}' is already registered.`);if(!this._validatePlugin(d))throw new Error(`Plugin '${d.id}' is not valid.`);let l=s.createPluginData(d);s.ensureNoCycle(l,this._plugins,this._services),l.provides&&this._services.set(l.provides,l.id),this._plugins.set(l.id,l)}registerPlugins(d){for(let l of d)this.registerPlugin(l)}deregisterPlugin(d,l){let p=this._plugins.get(d);if(p){if(p.activated&&!l)throw new Error(`Plugin '${d}' is still active.`);this._plugins.delete(d)}}async activatePlugin(d){let l=this._plugins.get(d);if(!l)throw new ReferenceError(`Plugin '${d}' is not registered.`);if(l.activated)return;if(l.promise)return l.promise;let p=l.requires.map(_=>this.resolveRequiredService(_)),v=l.optional.map(_=>this.resolveOptionalService(_));return l.promise=Promise.all([...p,...v]).then(_=>l.activate.apply(void 0,[this.application,..._])).then(_=>{l.service=_,l.activated=!0,l.promise=null}).catch(_=>{throw l.promise=null,_}),l.promise}async activatePlugins(d,l={}){switch(d){case"defer":{let p=this.deferredPlugins.filter(v=>this._plugins.get(v).autoStart).map(v=>this.activatePlugin(v));await Promise.all(p);break}case"startUp":{let v=s.collectStartupPlugins(this._plugins,l).map(async _=>{try{return await this.activatePlugin(_)}catch(I){console.error(`Plugin '${_}' failed to activate.`,I)}});await Promise.all(v);break}}}async deactivatePlugin(d){let l=this._plugins.get(d);if(!l)throw new ReferenceError(`Plugin '${d}' is not registered.`);if(!l.activated)return[];if(!l.deactivate)throw new TypeError(`Plugin '${d}'#deactivate() method missing`);let p=s.findDependents(d,this._plugins,this._services),v=p.map(_=>this._plugins.get(_));for(let _ of v)if(!_.deactivate)throw new TypeError(`Plugin ${_.id}#deactivate() method missing (depends on ${d})`);for(let _ of v){let I=[..._.requires,..._.optional].map(P=>{let D=this._services.get(P);return D?this._plugins.get(D).service:null});await _.deactivate(this.application,...I),_.service=null,_.activated=!1}return p.pop(),p}async resolveRequiredService(d){let l=this._services.get(d);if(!l)throw new TypeError(`No provider for: ${d.name}.`);let p=this._plugins.get(l);return p.activated||await this.activatePlugin(l),p.service}async resolveOptionalService(d){let l=this._services.get(d);if(!l)return null;let p=this._plugins.get(l);if(!p.activated)try{await this.activatePlugin(l)}catch(v){return console.error(v),null}return p.service}}var s;(function(c){class d{constructor(P){var D,q,x,w;this._activated=!1,this._promise=null,this._service=null,this.id=P.id,this.description=(D=P.description)!==null&&D!==void 0?D:"",this.activate=P.activate,this.deactivate=(q=P.deactivate)!==null&&q!==void 0?q:null,this.provides=(x=P.provides)!==null&&x!==void 0?x:null,this.autoStart=(w=P.autoStart)!==null&&w!==void 0?w:!1,this.requires=P.requires?P.requires.slice():[],this.optional=P.optional?P.optional.slice():[]}get activated(){return this._activated}set activated(P){this._activated=P}get service(){return this._service}set service(P){this._service=P}get promise(){return this._promise}set promise(P){this._promise=P}}function l(I){return new d(I)}c.createPluginData=l;function p(I,P,D){let q=[...I.requires,...I.optional],x=R=>{if(R===I.provides)return!0;let A=D.get(R);if(!A)return!1;let T=P.get(A),j=[...T.requires,...T.optional];return j.length===0?!1:(w.push(A),j.some(x)?!0:(w.pop(),!1))};if(!I.provides||q.length===0)return;let w=[I.id];if(q.some(x))throw new ReferenceError(`Cycle detected: ${w.join(" -> ")}.`)}c.ensureNoCycle=p;function v(I,P,D){let q=new Array,x=j=>{let U=P.get(j),h=[...U.requires,...U.optional];q.push(...h.reduce((y,S)=>{let C=D.get(S);return C&&y.push([j,C]),y},[]))};for(let j of P.keys())x(j);let w=q.filter(j=>j[1]===I),R=0;for(;w.length>R;){let j=w.length,U=new Set(w.map(h=>h[0]));for(let h of U)q.filter(y=>y[1]===h).forEach(y=>{w.includes(y)||w.push(y)});R=j}let A=e.topologicSort(w),T=A.findIndex(j=>j===I);return T===-1?[I]:A.slice(0,T+1)}c.findDependents=v;function _(I,P){let D=new Set;for(let q of I.keys())I.get(q).autoStart===!0&&D.add(q);if(P.startPlugins)for(let q of P.startPlugins)D.add(q);if(P.ignorePlugins)for(let q of P.ignorePlugins)D.delete(q);return Array.from(D)}c.collectStartupPlugins=_})(s||(s={}));class r{constructor(){this.promise=new Promise((d,l)=>{this._resolve=d,this._reject=l})}resolve(d){let l=this._resolve;l(d)}reject(d){let l=this._reject;l(d)}}class a{constructor(d,l){this.name=d,this.description=l!=null?l:"",this._tokenStructuralPropertyT=null}}function o(c){let d=0;for(let l=0,p=c.length;l<p;++l)l%4===0&&(d=Math.random()*4294967295>>>0),c[l]=d&255,d>>>=8}i.Random=void 0,function(c){c.getRandomValues=(()=>{let d=typeof window!="undefined"&&(window.crypto||window.msCrypto)||null;return d&&typeof d.getRandomValues=="function"?function(p){return d.getRandomValues(p)}:o})()}(i.Random||(i.Random={}));function u(c){let d=new Uint8Array(16),l=new Array(256);for(let p=0;p<16;++p)l[p]="0"+p.toString(16);for(let p=16;p<256;++p)l[p]=p.toString(16);return function(){return c(d),d[6]=64|d[6]&15,d[8]=128|d[8]&63,l[d[0]]+l[d[1]]+l[d[2]]+l[d[3]]+"-"+l[d[4]]+l[d[5]]+"-"+l[d[6]]+l[d[7]]+"-"+l[d[8]]+l[d[9]]+"-"+l[d[10]]+l[d[11]]+l[d[12]]+l[d[13]]+l[d[14]]+l[d[15]]}}i.UUID=void 0,function(c){c.uuid4=u(i.Random.getRandomValues)}(i.UUID||(i.UUID={})),i.MimeData=t,i.PluginRegistry=n,i.PromiseDelegate=r,i.Token=a})});var Z=E((Jt,Ms)=>{(function(i,e){typeof Jt=="object"&&typeof Ms!="undefined"?e(Jt,ti(),te()):typeof define=="function"&&define.amd?define(["exports","@lumino/algorithm","@lumino/coreutils"],e):(i=typeof globalThis!="undefined"?globalThis:i||self,e(i.lumino_signaling={},i.lumino_algorithm,i.lumino_coreutils))})(Jt,function(i,e,t){"use strict";class n{constructor(o){this.sender=o}connect(o,u){return r.connect(this,o,u)}disconnect(o,u){return r.disconnect(this,o,u)}emit(o){r.emit(this,o)}}(function(a){function o(_,I){r.disconnectBetween(_,I)}a.disconnectBetween=o;function u(_){r.disconnectSender(_)}a.disconnectSender=u;function c(_){r.disconnectReceiver(_)}a.disconnectReceiver=c;function d(_){r.disconnectAll(_)}a.disconnectAll=d;function l(_){r.disconnectAll(_)}a.clearData=l;function p(){return r.exceptionHandler}a.getExceptionHandler=p;function v(_){let I=r.exceptionHandler;return r.exceptionHandler=_,I}a.setExceptionHandler=v})(n||(n={}));class s extends n{constructor(){super(...arguments),this._pending=new t.PromiseDelegate}async*[Symbol.asyncIterator](){let o=this._pending;for(;;)try{let{args:u,next:c}=await o.promise;o=c,yield u}catch{return}}emit(o){let u=this._pending,c=this._pending=new t.PromiseDelegate;u.resolve({args:o,next:c}),super.emit(o)}stop(){this._pending.promise.catch(()=>{}),this._pending.reject("stop"),this._pending=new t.PromiseDelegate}}var r;(function(a){a.exceptionHandler=j=>{console.error(j)};function o(j,U,h){h=h||void 0;let y=_.get(j.sender);if(y||(y=[],_.set(j.sender,y)),q(y,j,U,h))return!1;let S=h||U,C=I.get(S);C||(C=[],I.set(S,C));let N={signal:j,slot:U,thisArg:h};return y.push(N),C.push(N),!0}a.connect=o;function u(j,U,h){h=h||void 0;let y=_.get(j.sender);if(!y||y.length===0)return!1;let S=q(y,j,U,h);if(!S)return!1;let C=h||U,N=I.get(C);return S.signal=null,w(y),w(N),!0}a.disconnect=u;function c(j,U){let h=_.get(j);if(!h||h.length===0)return;let y=I.get(U);if(!(!y||y.length===0)){for(let S of y)S.signal&&S.signal.sender===j&&(S.signal=null);w(h),w(y)}}a.disconnectBetween=c;function d(j){let U=_.get(j);if(!(!U||U.length===0)){for(let h of U){if(!h.signal)continue;let y=h.thisArg||h.slot;h.signal=null,w(I.get(y))}w(U)}}a.disconnectSender=d;function l(j){let U=I.get(j);if(!(!U||U.length===0)){for(let h of U){if(!h.signal)continue;let y=h.signal.sender;h.signal=null,w(_.get(y))}w(U)}}a.disconnectReceiver=l;function p(j){d(j),l(j)}a.disconnectAll=p;function v(j,U){let h=_.get(j.sender);if(!(!h||h.length===0))for(let y=0,S=h.length;y<S;++y){let C=h[y];C.signal===j&&x(C,U)}}a.emit=v;let _=new WeakMap,I=new WeakMap,P=new Set,D=typeof requestAnimationFrame=="function"?requestAnimationFrame:setImmediate;function q(j,U,h,y){return e.find(j,S=>S.signal===U&&S.slot===h&&S.thisArg===y)}function x(j,U){let{signal:h,slot:y,thisArg:S}=j;try{y.call(S,h.sender,U)}catch(C){a.exceptionHandler(C)}}function w(j){P.size===0&&D(R),P.add(j)}function R(){P.forEach(A),P.clear()}function A(j){e.ArrayExt.removeAllWhere(j,T)}function T(j){return j.signal===null}})(r||(r={})),i.Signal=n,i.Stream=s})});var Is=E(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});Ht.ActivityMonitor=void 0;var Es=Z(),ni=class{constructor(e){this._timer=-1,this._timeout=-1,this._isDisposed=!1,this._activityStopped=new Es.Signal(this),e.signal.connect(this._onSignalFired,this),this._timeout=e.timeout||1e3}get activityStopped(){return this._activityStopped}get timeout(){return this._timeout}set timeout(e){this._timeout=e}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed||(this._isDisposed=!0,Es.Signal.clearData(this))}_onSignalFired(e,t){clearTimeout(this._timer),this._sender=e,this._args=t,this._timer=setTimeout(()=>{this._activityStopped.emit({sender:this._sender,args:this._args})},this._timeout)}};Ht.ActivityMonitor=ni});var Os=E(Rs=>{"use strict";Object.defineProperty(Rs,"__esModule",{value:!0})});var Ds=E(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.LruCache=void 0;var No=128,ii=class{constructor(e={}){this._map=new Map,this._maxSize=(e==null?void 0:e.maxSize)||No}get size(){return this._map.size}clear(){this._map.clear()}get(e){let t=this._map.get(e)||null;return t!=null&&(this._map.delete(e),this._map.set(e,t)),t}set(e,t){this._map.size>=this._maxSize&&this._map.delete(this._map.keys().next().value),this._map.set(e,t)}};Gt.LruCache=ii});var Ts=E(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.MarkdownCodeBlocks=void 0;var js;(function(i){i.CODE_BLOCK_MARKER="```";let e=[".markdown",".mdown",".mkdn",".md",".mkd",".mdwn",".mdtxt",".mdtext",".text",".txt",".Rmd"];class t{constructor(a){this.startLine=a,this.code="",this.endLine=-1}}i.MarkdownCodeBlock=t;function n(r){return e.indexOf(r)>-1}i.isMarkdown=n;function s(r){if(!r||r==="")return[];let a=r.split(`
|
|
2
2
|
`),o=[],u=null;for(let c=0;c<a.length;c++){let d=a[c],l=d.indexOf(i.CODE_BLOCK_MARKER)===0,p=u!=null;if(!(!l&&!p))if(p)u&&(l?(u.endLine=c-1,o.push(u),u=null):u.code+=d+`
|
|
3
|
-
`);else{u=new t(c);let v=d.indexOf(i.CODE_BLOCK_MARKER),_=d.lastIndexOf(i.CODE_BLOCK_MARKER);v!==_&&(u.code=d.substring(v+i.CODE_BLOCK_MARKER.length,_),u.endLine=c,o.push(u),u=null)}}return o}i.findMarkdownCodeBlocks=s})(Ds||(Yt.MarkdownCodeBlocks=Ds={}))});var As=E((Gd,Us)=>{"use strict";function Lo(i,e){var t=i;e.slice(0,-1).forEach(function(s){t=t[s]||{}});var n=e[e.length-1];return n in t}function Ts(i){return typeof i=="number"||/^0x[0-9a-f]+$/i.test(i)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(i)}function qs(i,e){return e==="constructor"&&typeof i[e]=="function"||e==="__proto__"}Us.exports=function(i,e){e||(e={});var t={bools:{},strings:{},unknownFn:null};typeof e.unknown=="function"&&(t.unknownFn=e.unknown),typeof e.boolean=="boolean"&&e.boolean?t.allBools=!0:[].concat(e.boolean).filter(Boolean).forEach(function(w){t.bools[w]=!0});var n={};function s(w){return n[w].some(function(R){return t.bools[R]})}Object.keys(e.alias||{}).forEach(function(w){n[w]=[].concat(e.alias[w]),n[w].forEach(function(R){n[R]=[w].concat(n[w].filter(function(A){return R!==A}))})}),[].concat(e.string).filter(Boolean).forEach(function(w){t.strings[w]=!0,n[w]&&[].concat(n[w]).forEach(function(R){t.strings[R]=!0})});var r=e.default||{},a={_:[]};function o(w,R){return t.allBools&&/^--[^=]+$/.test(R)||t.strings[w]||t.bools[w]||n[w]}function u(w,R,A){for(var T=w,j=0;j<R.length-1;j++){var U=R[j];if(qs(T,U))return;T[U]===void 0&&(T[U]={}),(T[U]===Object.prototype||T[U]===Number.prototype||T[U]===String.prototype)&&(T[U]={}),T[U]===Array.prototype&&(T[U]=[]),T=T[U]}var h=R[R.length-1];qs(T,h)||((T===Object.prototype||T===Number.prototype||T===String.prototype)&&(T={}),T===Array.prototype&&(T=[]),T[h]===void 0||t.bools[h]||typeof T[h]=="boolean"?T[h]=A:Array.isArray(T[h])?T[h].push(A):T[h]=[T[h],A])}function c(w,R,A){if(!(A&&t.unknownFn&&!o(w,A)&&t.unknownFn(A)===!1)){var T=!t.strings[w]&&Ts(R)?Number(R):R;u(a,w.split("."),T),(n[w]||[]).forEach(function(j){u(a,j.split("."),T)})}}Object.keys(t.bools).forEach(function(w){c(w,r[w]===void 0?!1:r[w])});var d=[];i.indexOf("--")!==-1&&(d=i.slice(i.indexOf("--")+1),i=i.slice(0,i.indexOf("--")));for(var l=0;l<i.length;l++){var p=i[l],v,_;if(/^--.+=/.test(p)){var I=p.match(/^--([^=]+)=([\s\S]*)$/);v=I[1];var P=I[2];t.bools[v]&&(P=P!=="false"),c(v,P,p)}else if(/^--no-.+/.test(p))v=p.match(/^--no-(.+)/)[1],c(v,!1,p);else if(/^--.+/.test(p))v=p.match(/^--(.+)/)[1],_=i[l+1],_!==void 0&&!/^(-|--)[^-]/.test(_)&&!t.bools[v]&&!t.allBools&&(!n[v]||!s(v))?(c(v,_,p),l+=1):/^(true|false)$/.test(_)?(c(v,_==="true",p),l+=1):c(v,t.strings[v]?"":!0,p);else if(/^-[^-]+/.test(p)){for(var D=p.slice(1,-1).split(""),q=!1,x=0;x<D.length;x++){if(_=p.slice(x+2),_==="-"){c(D[x],_,p);continue}if(/[A-Za-z]/.test(D[x])&&_[0]==="="){c(D[x],_.slice(1),p),q=!0;break}if(/[A-Za-z]/.test(D[x])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(_)){c(D[x],_,p),q=!0;break}if(D[x+1]&&D[x+1].match(/\W/)){c(D[x],p.slice(x+2),p),q=!0;break}else c(D[x],t.strings[D[x]]?"":!0,p)}v=p.slice(-1)[0],!q&&v!=="-"&&(i[l+1]&&!/^(-|--)[^-]/.test(i[l+1])&&!t.bools[v]&&(!n[v]||!s(v))?(c(v,i[l+1],p),l+=1):i[l+1]&&/^(true|false)$/.test(i[l+1])?(c(v,i[l+1]==="true",p),l+=1):c(v,t.strings[v]?"":!0,p))}else if((!t.unknownFn||t.unknownFn(p)!==!1)&&a._.push(t.strings._||!Ts(p)?p:Number(p)),e.stopEarly){a._.push.apply(a._,i.slice(l+1));break}}return Object.keys(r).forEach(function(w){Lo(a,w.split("."))||(u(a,w.split("."),r[w]),(n[w]||[]).forEach(function(R){u(a,R.split("."),r[w])}))}),e["--"]?a["--"]=d.slice():d.forEach(function(w){a._.push(w)}),a}});var Xt=E((Yd,Ls)=>{"use strict";function Ie(i){if(typeof i!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(i))}function Ns(i,e){for(var t="",n=0,s=-1,r=0,a,o=0;o<=i.length;++o){if(o<i.length)a=i.charCodeAt(o);else{if(a===47)break;a=47}if(a===47){if(!(s===o-1||r===1))if(s!==o-1&&r===2){if(t.length<2||n!==2||t.charCodeAt(t.length-1)!==46||t.charCodeAt(t.length-2)!==46){if(t.length>2){var u=t.lastIndexOf("/");if(u!==t.length-1){u===-1?(t="",n=0):(t=t.slice(0,u),n=t.length-1-t.lastIndexOf("/")),s=o,r=0;continue}}else if(t.length===2||t.length===1){t="",n=0,s=o,r=0;continue}}e&&(t.length>0?t+="/..":t="..",n=2)}else t.length>0?t+="/"+i.slice(s+1,o):t=i.slice(s+1,o),n=o-s-1;s=o,r=0}else a===46&&r!==-1?++r:r=-1}return t}function zo(i,e){var t=e.dir||e.root,n=e.base||(e.name||"")+(e.ext||"");return t?t===e.root?t+n:t+i+n:n}var nt={resolve:function(){for(var e="",t=!1,n,s=arguments.length-1;s>=-1&&!t;s--){var r;s>=0?r=arguments[s]:(n===void 0&&(n=process.cwd()),r=n),Ie(r),r.length!==0&&(e=r+"/"+e,t=r.charCodeAt(0)===47)}return e=Ns(e,!t),t?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(e){if(Ie(e),e.length===0)return".";var t=e.charCodeAt(0)===47,n=e.charCodeAt(e.length-1)===47;return e=Ns(e,!t),e.length===0&&!t&&(e="."),e.length>0&&n&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return Ie(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var e,t=0;t<arguments.length;++t){var n=arguments[t];Ie(n),n.length>0&&(e===void 0?e=n:e+="/"+n)}return e===void 0?".":nt.normalize(e)},relative:function(e,t){if(Ie(e),Ie(t),e===t||(e=nt.resolve(e),t=nt.resolve(t),e===t))return"";for(var n=1;n<e.length&&e.charCodeAt(n)===47;++n);for(var s=e.length,r=s-n,a=1;a<t.length&&t.charCodeAt(a)===47;++a);for(var o=t.length,u=o-a,c=r<u?r:u,d=-1,l=0;l<=c;++l){if(l===c){if(u>c){if(t.charCodeAt(a+l)===47)return t.slice(a+l+1);if(l===0)return t.slice(a+l)}else r>c&&(e.charCodeAt(n+l)===47?d=l:l===0&&(d=0));break}var p=e.charCodeAt(n+l),v=t.charCodeAt(a+l);if(p!==v)break;p===47&&(d=l)}var _="";for(l=n+d+1;l<=s;++l)(l===s||e.charCodeAt(l)===47)&&(_.length===0?_+="..":_+="/..");return _.length>0?_+t.slice(a+d):(a+=d,t.charCodeAt(a)===47&&++a,t.slice(a))},_makeLong:function(e){return e},dirname:function(e){if(Ie(e),e.length===0)return".";for(var t=e.charCodeAt(0),n=t===47,s=-1,r=!0,a=e.length-1;a>=1;--a)if(t=e.charCodeAt(a),t===47){if(!r){s=a;break}}else r=!1;return s===-1?n?"/":".":n&&s===1?"//":e.slice(0,s)},basename:function(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Ie(e);var n=0,s=-1,r=!0,a;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var o=t.length-1,u=-1;for(a=e.length-1;a>=0;--a){var c=e.charCodeAt(a);if(c===47){if(!r){n=a+1;break}}else u===-1&&(r=!1,u=a+1),o>=0&&(c===t.charCodeAt(o)?--o===-1&&(s=a):(o=-1,s=u))}return n===s?s=u:s===-1&&(s=e.length),e.slice(n,s)}else{for(a=e.length-1;a>=0;--a)if(e.charCodeAt(a)===47){if(!r){n=a+1;break}}else s===-1&&(r=!1,s=a+1);return s===-1?"":e.slice(n,s)}},extname:function(e){Ie(e);for(var t=-1,n=0,s=-1,r=!0,a=0,o=e.length-1;o>=0;--o){var u=e.charCodeAt(o);if(u===47){if(!r){n=o+1;break}continue}s===-1&&(r=!1,s=o+1),u===46?t===-1?t=o:a!==1&&(a=1):t!==-1&&(a=-1)}return t===-1||s===-1||a===0||a===1&&t===s-1&&t===n+1?"":e.slice(t,s)},format:function(e){if(e===null||typeof e!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return zo("/",e)},parse:function(e){Ie(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;var n=e.charCodeAt(0),s=n===47,r;s?(t.root="/",r=1):r=0;for(var a=-1,o=0,u=-1,c=!0,d=e.length-1,l=0;d>=r;--d){if(n=e.charCodeAt(d),n===47){if(!c){o=d+1;break}continue}u===-1&&(c=!1,u=d+1),n===46?a===-1?a=d:l!==1&&(l=1):a!==-1&&(l=-1)}return a===-1||u===-1||l===0||l===1&&a===u-1&&a===o+1?u!==-1&&(o===0&&s?t.base=t.name=e.slice(1,u):t.base=t.name=e.slice(o,u)):(o===0&&s?(t.name=e.slice(1,a),t.base=e.slice(1,u)):(t.name=e.slice(o,a),t.base=e.slice(o,u)),t.ext=e.slice(a,u)),o>0?t.dir=e.slice(0,o-1):s&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};nt.posix=nt;Ls.exports=nt});var Fs=E((Xd,zs)=>{"use strict";zs.exports=function(e,t){if(t=t.split(":")[0],e=+e,!e)return!1;switch(t){case"http":case"ws":return e!==80;case"https":case"wss":return e!==443;case"ftp":return e!==21;case"gopher":return e!==70;case"file":return!1}return e!==0}});var $s=E(ii=>{"use strict";var Fo=Object.prototype.hasOwnProperty,Ko;function Ks(i){try{return decodeURIComponent(i.replace(/\+/g," "))}catch{return null}}function Bs(i){try{return encodeURIComponent(i)}catch{return null}}function Bo(i){for(var e=/([^=?#&]+)=?([^&]*)/g,t={},n;n=e.exec(i);){var s=Ks(n[1]),r=Ks(n[2]);s===null||r===null||s in t||(t[s]=r)}return t}function $o(i,e){e=e||"";var t=[],n,s;typeof e!="string"&&(e="?");for(s in i)if(Fo.call(i,s)){if(n=i[s],!n&&(n===null||n===Ko||isNaN(n))&&(n=""),s=Bs(s),n=Bs(n),s===null||n===null)continue;t.push(s+"="+n)}return t.length?e+t.join("&"):""}ii.stringify=$o;ii.parse=Bo});var Zs=E((Qd,Xs)=>{"use strict";var Ws=Fs(),Zt=$s(),Vo=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,Js=/[\n\r\t]/g,Wo=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,Hs=/:\d+$/,Jo=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,Ho=/^[a-zA-Z]:/;function ri(i){return(i||"").toString().replace(Vo,"")}var si=[["#","hash"],["?","query"],function(e,t){return Re(t.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],Vs={hash:1,query:1};function Gs(i){var e;typeof window!="undefined"?e=window:typeof global!="undefined"?e=global:typeof self!="undefined"?e=self:e={};var t=e.location||{};i=i||t;var n={},s=typeof i,r;if(i.protocol==="blob:")n=new Oe(unescape(i.pathname),{});else if(s==="string"){n=new Oe(i,{});for(r in Vs)delete n[r]}else if(s==="object"){for(r in i)r in Vs||(n[r]=i[r]);n.slashes===void 0&&(n.slashes=Wo.test(i.href))}return n}function Re(i){return i==="file:"||i==="ftp:"||i==="http:"||i==="https:"||i==="ws:"||i==="wss:"}function Ys(i,e){i=ri(i),i=i.replace(Js,""),e=e||{};var t=Jo.exec(i),n=t[1]?t[1].toLowerCase():"",s=!!t[2],r=!!t[3],a=0,o;return s?r?(o=t[2]+t[3]+t[4],a=t[2].length+t[3].length):(o=t[2]+t[4],a=t[2].length):r?(o=t[3]+t[4],a=t[3].length):o=t[4],n==="file:"?a>=2&&(o=o.slice(2)):Re(n)?o=t[4]:n?s&&(o=o.slice(2)):a>=2&&Re(e.protocol)&&(o=t[4]),{protocol:n,slashes:s||Re(n),slashesCount:a,rest:o}}function Go(i,e){if(i==="")return e;for(var t=(e||"/").split("/").slice(0,-1).concat(i.split("/")),n=t.length,s=t[n-1],r=!1,a=0;n--;)t[n]==="."?t.splice(n,1):t[n]===".."?(t.splice(n,1),a++):a&&(n===0&&(r=!0),t.splice(n,1),a--);return r&&t.unshift(""),(s==="."||s==="..")&&t.push(""),t.join("/")}function Oe(i,e,t){if(i=ri(i),i=i.replace(Js,""),!(this instanceof Oe))return new Oe(i,e,t);var n,s,r,a,o,u,c=si.slice(),d=typeof e,l=this,p=0;for(d!=="object"&&d!=="string"&&(t=e,e=null),t&&typeof t!="function"&&(t=Zt.parse),e=Gs(e),s=Ys(i||"",e),n=!s.protocol&&!s.slashes,l.slashes=s.slashes||n&&e.slashes,l.protocol=s.protocol||e.protocol||"",i=s.rest,(s.protocol==="file:"&&(s.slashesCount!==2||Ho.test(i))||!s.slashes&&(s.protocol||s.slashesCount<2||!Re(l.protocol)))&&(c[3]=[/(.*)/,"pathname"]);p<c.length;p++){if(a=c[p],typeof a=="function"){i=a(i,l);continue}r=a[0],u=a[1],r!==r?l[u]=i:typeof r=="string"?(o=r==="@"?i.lastIndexOf(r):i.indexOf(r),~o&&(typeof a[2]=="number"?(l[u]=i.slice(0,o),i=i.slice(o+a[2])):(l[u]=i.slice(o),i=i.slice(0,o)))):(o=r.exec(i))&&(l[u]=o[1],i=i.slice(0,o.index)),l[u]=l[u]||n&&a[3]&&e[u]||"",a[4]&&(l[u]=l[u].toLowerCase())}t&&(l.query=t(l.query)),n&&e.slashes&&l.pathname.charAt(0)!=="/"&&(l.pathname!==""||e.pathname!=="")&&(l.pathname=Go(l.pathname,e.pathname)),l.pathname.charAt(0)!=="/"&&Re(l.protocol)&&(l.pathname="/"+l.pathname),Ws(l.port,l.protocol)||(l.host=l.hostname,l.port=""),l.username=l.password="",l.auth&&(o=l.auth.indexOf(":"),~o?(l.username=l.auth.slice(0,o),l.username=encodeURIComponent(decodeURIComponent(l.username)),l.password=l.auth.slice(o+1),l.password=encodeURIComponent(decodeURIComponent(l.password))):l.username=encodeURIComponent(decodeURIComponent(l.auth)),l.auth=l.password?l.username+":"+l.password:l.username),l.origin=l.protocol!=="file:"&&Re(l.protocol)&&l.host?l.protocol+"//"+l.host:"null",l.href=l.toString()}function Yo(i,e,t){var n=this;switch(i){case"query":typeof e=="string"&&e.length&&(e=(t||Zt.parse)(e)),n[i]=e;break;case"port":n[i]=e,Ws(e,n.protocol)?e&&(n.host=n.hostname+":"+e):(n.host=n.hostname,n[i]="");break;case"hostname":n[i]=e,n.port&&(e+=":"+n.port),n.host=e;break;case"host":n[i]=e,Hs.test(e)?(e=e.split(":"),n.port=e.pop(),n.hostname=e.join(":")):(n.hostname=e,n.port="");break;case"protocol":n.protocol=e.toLowerCase(),n.slashes=!t;break;case"pathname":case"hash":if(e){var s=i==="pathname"?"/":"#";n[i]=e.charAt(0)!==s?s+e:e}else n[i]=e;break;case"username":case"password":n[i]=encodeURIComponent(e);break;case"auth":var r=e.indexOf(":");~r?(n.username=e.slice(0,r),n.username=encodeURIComponent(decodeURIComponent(n.username)),n.password=e.slice(r+1),n.password=encodeURIComponent(decodeURIComponent(n.password))):n.username=encodeURIComponent(decodeURIComponent(e))}for(var a=0;a<si.length;a++){var o=si[a];o[4]&&(n[o[1]]=n[o[1]].toLowerCase())}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin=n.protocol!=="file:"&&Re(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function Xo(i){(!i||typeof i!="function")&&(i=Zt.stringify);var e,t=this,n=t.host,s=t.protocol;s&&s.charAt(s.length-1)!==":"&&(s+=":");var r=s+(t.protocol&&t.slashes||Re(t.protocol)?"//":"");return t.username?(r+=t.username,t.password&&(r+=":"+t.password),r+="@"):t.password?(r+=":"+t.password,r+="@"):t.protocol!=="file:"&&Re(t.protocol)&&!n&&t.pathname!=="/"&&(r+="@"),(n[n.length-1]===":"||Hs.test(t.hostname)&&!t.port)&&(n+=":"),r+=n+t.pathname,e=typeof t.query=="object"?i(t.query):t.query,e&&(r+=e.charAt(0)!=="?"?"?"+e:e),t.hash&&(r+=t.hash),r}Oe.prototype={set:Yo,toString:Xo};Oe.extractProtocol=Ys;Oe.location=Gs;Oe.trimLeft=ri;Oe.qs=Zt;Xs.exports=Oe});var ai=E(it=>{"use strict";var Zo=it&&it.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(it,"__esModule",{value:!0});it.URLExt=void 0;var Qo=Xt(),Qt=Zo(Zs()),Qs;(function(i){function e(c){if(typeof document!="undefined"&&document){let d=document.createElement("a");return d.href=c,d}return(0,Qt.default)(c)}i.parse=e;function t(c){return(0,Qt.default)(c).hostname}i.getHostName=t;function n(c){return c&&e(c).toString()}i.normalize=n;function s(...c){let d=(0,Qt.default)(c[0],{}),l=d.protocol===""&&d.slashes;l&&(d=(0,Qt.default)(c[0],"https:"+c[0]));let p=`${l?"":d.protocol}${d.slashes?"//":""}${d.auth}${d.auth?"@":""}${d.host}`,v=Qo.posix.join(`${p&&d.pathname[0]!=="/"?"/":""}${d.pathname}`,...c.slice(1));return`${p}${v==="."?"":v}`}i.join=s;function r(c){return s(...c.split("/").map(encodeURIComponent))}i.encodeParts=r;function a(c){let d=Object.keys(c).filter(l=>l.length>0);return d.length?"?"+d.map(l=>{let p=encodeURIComponent(String(c[l]));return l+(p?"="+p:"")}).join("&"):""}i.objectToQueryString=a;function o(c){return c.replace(/^\?/,"").split("&").reduce((d,l)=>{let[p,v]=l.split("=");return p.length>0&&(d[p]=decodeURIComponent(v||"")),d},{})}i.queryStringToObject=o;function u(c,d=!1){let{protocol:l}=e(c);return(!l||c.toLowerCase().indexOf(l)!==0)&&(d?c.indexOf("//")!==0:c.indexOf("/")!==0)}i.isLocal=u})(Qs||(it.URLExt=Qs={}))});var er=E((exports,module)=>{"use strict";var __importDefault=exports&&exports.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(exports,"__esModule",{value:!0});exports.PageConfig=void 0;var coreutils_1=te(),minimist_1=__importDefault(As()),url_1=ai(),PageConfig;(function(PageConfig){function getOption(name){if(configData)return configData[name]||getBodyData(name);configData=Object.create(null);let found=!1;if(typeof document!="undefined"&&document){let i=document.getElementById("jupyter-config-data");i&&(configData=JSON.parse(i.textContent||""),found=!0)}if(!found&&typeof process!="undefined"&&process.argv)try{let cli=(0,minimist_1.default)(process.argv.slice(2)),path=Xt(),fullPath="";"jupyter-config-data"in cli?fullPath=path.resolve(cli["jupyter-config-data"]):"JUPYTER_CONFIG_DATA"in process.env&&(fullPath=path.resolve(process.env.JUPYTER_CONFIG_DATA)),fullPath&&(configData=eval("require")(fullPath))}catch(i){console.error(i)}if(!coreutils_1.JSONExt.isObject(configData))configData=Object.create(null);else for(let i in configData)typeof configData[i]!="string"&&(configData[i]=JSON.stringify(configData[i]));return configData[name]||getBodyData(name)}PageConfig.getOption=getOption;function setOption(i,e){let t=getOption(i);return configData[i]=e,t}PageConfig.setOption=setOption;function getBaseUrl(){return url_1.URLExt.normalize(getOption("baseUrl")||"/")}PageConfig.getBaseUrl=getBaseUrl;function getTreeUrl(){return url_1.URLExt.join(getBaseUrl(),getOption("treeUrl"))}PageConfig.getTreeUrl=getTreeUrl;function getShareUrl(){return url_1.URLExt.normalize(getOption("shareUrl")||getBaseUrl())}PageConfig.getShareUrl=getShareUrl;function getTreeShareUrl(){return url_1.URLExt.normalize(url_1.URLExt.join(getShareUrl(),getOption("treeUrl")))}PageConfig.getTreeShareUrl=getTreeShareUrl;function getUrl(i){var e,t,n,s;let r=i.toShare?getShareUrl():getBaseUrl(),a=(e=i.mode)!==null&&e!==void 0?e:getOption("mode"),o=(t=i.workspace)!==null&&t!==void 0?t:getOption("workspace"),u=a==="single-document"?"doc":"lab";r=url_1.URLExt.join(r,u),o!==PageConfig.defaultWorkspace&&(r=url_1.URLExt.join(r,"workspaces",encodeURIComponent((n=getOption("workspace"))!==null&&n!==void 0?n:PageConfig.defaultWorkspace)));let c=(s=i.treePath)!==null&&s!==void 0?s:getOption("treePath");return c&&(r=url_1.URLExt.join(r,"tree",url_1.URLExt.encodeParts(c))),r}PageConfig.getUrl=getUrl,PageConfig.defaultWorkspace="default";function getWsUrl(i){let e=getOption("wsUrl");if(!e){if(i=i?url_1.URLExt.normalize(i):getBaseUrl(),i.indexOf("http")!==0)return"";e="ws"+i.slice(4)}return url_1.URLExt.normalize(e)}PageConfig.getWsUrl=getWsUrl;function getNBConvertURL({path:i,format:e,download:t}){let n=url_1.URLExt.encodeParts(i),s=url_1.URLExt.join(getBaseUrl(),"nbconvert",e,n);return t?s+"?download=true":s}PageConfig.getNBConvertURL=getNBConvertURL;function getToken(){return getOption("token")||getBodyData("jupyterApiToken")}PageConfig.getToken=getToken;function getNotebookVersion(){let i=getOption("notebookVersion");return i===""?[0,0,0]:JSON.parse(i)}PageConfig.getNotebookVersion=getNotebookVersion;let configData=null;function getBodyData(i){if(typeof document=="undefined"||!document.body)return"";let e=document.body.dataset[i];return typeof e=="undefined"?"":decodeURIComponent(e)}let Extension;(function(i){function e(s){try{let r=getOption(s);if(r)return JSON.parse(r)}catch(r){console.warn(`Unable to parse ${s}.`,r)}return[]}i.deferred=e("deferredExtensions"),i.disabled=e("disabledExtensions");function t(s){let r=s.indexOf(":"),a="";return r!==-1&&(a=s.slice(0,r)),i.deferred.some(o=>o===s||a&&o===a)}i.isDeferred=t;function n(s){let r=s.indexOf(":"),a="";return r!==-1&&(a=s.slice(0,r)),i.disabled.some(o=>o===s||a&&o===a)}i.isDisabled=n})(Extension=PageConfig.Extension||(PageConfig.Extension={}))})(PageConfig||(exports.PageConfig=PageConfig={}))});var nr=E(en=>{"use strict";Object.defineProperty(en,"__esModule",{value:!0});en.PathExt=void 0;var Ke=Xt(),tr;(function(i){function e(...l){let p=Ke.posix.join(...l);return p==="."?"":d(p)}i.join=e;function t(...l){let p=Ke.posix.join(...l);return p==="."?"":p}i.joinWithLeadingSlash=t;function n(l,p){return Ke.posix.basename(l,p)}i.basename=n;function s(l){let p=d(Ke.posix.dirname(l));return p==="."?"":p}i.dirname=s;function r(l){return Ke.posix.extname(l)}i.extname=r;function a(l){return l===""?"":d(Ke.posix.normalize(l))}i.normalize=a;function o(...l){return d(Ke.posix.resolve(...l))}i.resolve=o;function u(l,p){return d(Ke.posix.relative(l,p))}i.relative=u;function c(l){return l.length>0&&l.indexOf(".")!==0&&(l=`.${l}`),l}i.normalizeExtension=c;function d(l){return l.indexOf("/")===0&&(l=l.slice(1)),l}i.removeSlash=d})(tr||(en.PathExt=tr={}))});var ir=E(oi=>{"use strict";Object.defineProperty(oi,"__esModule",{value:!0});oi.signalToPromise=tl;var el=te();function tl(i,e){let t=new el.PromiseDelegate;function n(){i.disconnect(s)}function s(r,a){n(),t.resolve([r,a])}return i.connect(s),(e!=null?e:0)>0&&setTimeout(()=>{n(),t.reject(`Signal not emitted within ${e} ms.`)},e),t.promise}});var rr=E(tn=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0});tn.Text=void 0;var sr;(function(i){let e=2>1;function t(a,o){if(e)return a;let u=a;for(let c=0;c+1<o.length&&c<a;c++){let d=o.charCodeAt(c);if(d>=55296&&d<=56319){let l=o.charCodeAt(c+1);l>=56320&&l<=57343&&(u--,c++)}}return u}i.jsIndexToCharIndex=t;function n(a,o){if(e)return a;let u=a;for(let c=0;c+1<o.length&&c<u;c++){let d=o.charCodeAt(c);if(d>=55296&&d<=56319){let l=o.charCodeAt(c+1);l>=56320&&l<=57343&&(u++,c++)}}return u}i.charIndexToJsIndex=n;function s(a,o=!1){return a.replace(/^(\w)|[\s-_:]+(\w)/g,function(u,c,d){return d?d.toUpperCase():o?c.toUpperCase():c.toLowerCase()})}i.camelCase=s;function r(a){return(a||"").toLowerCase().split(" ").map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" ")}i.titleCase=r})(sr||(tn.Text=sr={}))});var or=E(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.Time=void 0;var nl=[{name:"years",milliseconds:365*24*60*60*1e3},{name:"months",milliseconds:30*24*60*60*1e3},{name:"days",milliseconds:24*60*60*1e3},{name:"hours",milliseconds:60*60*1e3},{name:"minutes",milliseconds:60*1e3},{name:"seconds",milliseconds:1e3}],ar;(function(i){function e(n,s="long"){let r=document.documentElement.lang||"en",a=new Intl.RelativeTimeFormat(r,{numeric:"auto",style:s}),o=new Date(n).getTime()-Date.now();for(let u of nl){let c=Math.ceil(o/u.milliseconds);if(c!==0)return a.format(c,u.name)}return a.format(0,"seconds")}i.formatHuman=e;function t(n){let s=document.documentElement.lang||"en";return new Intl.DateTimeFormat(s,{dateStyle:"short",timeStyle:"short"}).format(new Date(n))}i.format=t})(ar||(nn.Time=ar={}))});var J=E(ae=>{"use strict";var il=ae&&ae.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),De=ae&&ae.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&il(e,i,t)};Object.defineProperty(ae,"__esModule",{value:!0});De(Es(),ae);De(Rs(),ae);De(Os(),ae);De(js(),ae);De(er(),ae);De(nr(),ae);De(ir(),ae);De(rr(),ae);De(or(),ae);De(ai(),ae)});var st=E(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});B.supportedKernelWebSocketProtocols=void 0;B.createMessage=rl;B.isStreamMsg=al;B.isDisplayDataMsg=ol;B.isUpdateDisplayDataMsg=ll;B.isExecuteInputMsg=cl;B.isExecuteResultMsg=dl;B.isErrorMsg=ul;B.isStatusMsg=pl;B.isClearOutputMsg=hl;B.isDebugEventMsg=fl;B.isCommOpenMsg=ml;B.isCommCloseMsg=gl;B.isCommMsgMsg=_l;B.isInfoRequestMsg=vl;B.isExecuteReplyMsg=yl;B.isDebugRequestMsg=wl;B.isDebugReplyMsg=bl;B.isInputRequestMsg=Sl;B.isInputReplyMsg=xl;var sl=te();function rl(i){var e,t,n,s,r,a;return{buffers:(e=i.buffers)!==null&&e!==void 0?e:[],channel:i.channel,content:i.content,header:{date:new Date().toISOString(),msg_id:(t=i.msgId)!==null&&t!==void 0?t:sl.UUID.uuid4(),msg_type:i.msgType,session:i.session,username:(n=i.username)!==null&&n!==void 0?n:"",subshell_id:(s=i.subshellId)!==null&&s!==void 0?s:null,version:"5.2"},metadata:(r=i.metadata)!==null&&r!==void 0?r:{},parent_header:(a=i.parentHeader)!==null&&a!==void 0?a:{}}}function al(i){return i.header.msg_type==="stream"}function ol(i){return i.header.msg_type==="display_data"}function ll(i){return i.header.msg_type==="update_display_data"}function cl(i){return i.header.msg_type==="execute_input"}function dl(i){return i.header.msg_type==="execute_result"}function ul(i){return i.header.msg_type==="error"}function pl(i){return i.header.msg_type==="status"}function hl(i){return i.header.msg_type==="clear_output"}function fl(i){return i.header.msg_type==="debug_event"}function ml(i){return i.header.msg_type==="comm_open"}function gl(i){return i.header.msg_type==="comm_close"}function _l(i){return i.header.msg_type==="comm_msg"}function vl(i){return i.header.msg_type==="kernel_info_request"}function yl(i){return i.header.msg_type==="execute_reply"}function wl(i){return i.header.msg_type==="debug_request"}function bl(i){return i.header.msg_type==="debug_reply"}function Sl(i){return i.header.msg_type==="input_request"}function xl(i){return i.header.msg_type==="input_reply"}var lr;(function(i){i.v1KernelWebsocketJupyterOrg="v1.kernel.websocket.jupyter.org"})(lr||(B.supportedKernelWebSocketProtocols=lr={}))});var dr=E(je=>{"use strict";var Cl=je&&je.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),kl=je&&je.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),Pl=je&&je.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&Cl(e,i,t);return kl(e,i),e};Object.defineProperty(je,"__esModule",{value:!0});je.serialize=Ml;je.deserialize=El;var cr=Pl(st());function Ml(i,e=""){switch(e){case cr.supportedKernelWebSocketProtocols.v1KernelWebsocketJupyterOrg:return rt.serializeV1KernelWebsocketJupyterOrg(i);default:return rt.serializeDefault(i)}}function El(i,e=""){switch(e){case cr.supportedKernelWebSocketProtocols.v1KernelWebsocketJupyterOrg:return rt.deserializeV1KernelWebsocketJupyterOrg(i);default:return rt.deserializeDefault(i)}}var rt;(function(i){function e(o){let u,c=new DataView(o),d=Number(c.getBigUint64(0,!0)),l=[];for(let x=0;x<d;x++)l.push(Number(c.getBigUint64(8*(x+1),!0)));let p=new TextDecoder("utf8"),v=p.decode(o.slice(l[0],l[1])),_=JSON.parse(p.decode(o.slice(l[1],l[2]))),I=JSON.parse(p.decode(o.slice(l[2],l[3]))),P=JSON.parse(p.decode(o.slice(l[3],l[4]))),D=JSON.parse(p.decode(o.slice(l[4],l[5]))),q=[];for(let x=5;x<l.length-1;x++)q.push(new DataView(o.slice(l[x],l[x+1])));return u={channel:v,header:_,parent_header:I,metadata:P,content:D,buffers:q},u}i.deserializeV1KernelWebsocketJupyterOrg=e;function t(o){let u=JSON.stringify(o.header),c=o.parent_header==null?"{}":JSON.stringify(o.parent_header),d=JSON.stringify(o.metadata),l=JSON.stringify(o.content),p=o.buffers!==void 0?o.buffers:[],v=5+p.length+1,_=[];_.push(8*(1+v)),_.push(o.channel.length+_[_.length-1]);let I=new TextEncoder,P=I.encode(o.channel),D=I.encode(u),q=I.encode(c),x=I.encode(d),w=I.encode(l),R=new Uint8Array(P.length+D.length+q.length+x.length+w.length);R.set(P),R.set(D,P.length),R.set(q,P.length+D.length),R.set(x,P.length+D.length+q.length),R.set(w,P.length+D.length+q.length+x.length);for(let h of[D.length,q.length,x.length,w.length])_.push(h+_[_.length-1]);let A=0;for(let h of p){let y=h.byteLength;_.push(y+_[_.length-1]),A+=y}let T=new Uint8Array(8*(1+v)+R.byteLength+A),j=new ArrayBuffer(8),U=new DataView(j);U.setBigUint64(0,BigInt(v),!0),T.set(new Uint8Array(j),0);for(let h=0;h<_.length;h++)U.setBigUint64(0,BigInt(_[h]),!0),T.set(new Uint8Array(j),8*(h+1));T.set(R,_[0]);for(let h=0;h<p.length;h++){let y=p[h];T.set(new Uint8Array(ArrayBuffer.isView(y)?y.buffer:y),_[5+h])}return T.buffer}i.serializeV1KernelWebsocketJupyterOrg=t;function n(o){let u;return typeof o=="string"?u=JSON.parse(o):u=r(o),u}i.deserializeDefault=n;function s(o){var u;let c;return!((u=o.buffers)===null||u===void 0)&&u.length?c=a(o):c=JSON.stringify(o),c}i.serializeDefault=s;function r(o){let u=new DataView(o),c=u.getUint32(0),d=[];if(c<2)throw new Error("Invalid incoming Kernel Message");for(let v=1;v<=c;v++)d.push(u.getUint32(v*4));let l=new Uint8Array(o.slice(d[0],d[1])),p=JSON.parse(new TextDecoder("utf8").decode(l));p.buffers=[];for(let v=1;v<c;v++){let _=d[v],I=d[v+1]||o.byteLength;p.buffers.push(new DataView(o.slice(_,I)))}return p}function a(o){let u=[],c=[],d=new TextEncoder,l=[];o.buffers!==void 0&&(l=o.buffers,delete o.buffers);let p=d.encode(JSON.stringify(o));c.push(p.buffer);for(let P=0;P<l.length;P++){let D=l[P];c.push(ArrayBuffer.isView(D)?D.buffer:D)}let v=c.length;u.push(4*(v+1));for(let P=0;P+1<c.length;P++)u.push(u[u.length-1]+c[P].byteLength);let _=new Uint8Array(u[u.length-1]+c[c.length-1].byteLength),I=new DataView(_.buffer);I.setUint32(0,v);for(let P=0;P<u.length;P++)I.setUint32(4*(P+1),u[P]);for(let P=0;P<c.length;P++)_.set(new Uint8Array(c[P]),u[P]);return _.buffer}})(rt||(rt={}))});var ur=E(li=>{"use strict";Object.defineProperty(li,"__esModule",{value:!0});li.default=WebSocket});var de=E(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.ServerConnection=void 0;var Be=J(),pr=dr(),ci;typeof window=="undefined"?ci=ur():ci=WebSocket;var di;(function(i){function e(r){return sn.makeSettings(r)}i.makeSettings=e;function t(r,a,o){return sn.handleRequest(r,a,o)}i.makeRequest=t;class n extends Error{static async create(a){try{let o=await a.json(),{message:u,traceback:c}=o;return c&&console.error(c),new n(a,u!=null?u:n._defaultMessage(a),c!=null?c:"")}catch(o){return console.debug(o),new n(a)}}constructor(a,o=n._defaultMessage(a),u=""){super(o),this.response=a,this.traceback=u}static _defaultMessage(a){return`Invalid response: ${a.status} ${a.statusText}`}}i.ResponseError=n;class s extends TypeError{constructor(a){super(a.message),this.stack=a.stack}}i.NetworkError=s})(di||(rn.ServerConnection=di={}));var sn;(function(i){function e(s={}){var r;let a=Be.PageConfig.getBaseUrl(),o=Be.PageConfig.getWsUrl(),u=Be.URLExt.normalize(s.baseUrl)||a,c=s.wsUrl;!c&&u===a&&(c=o),!c&&u.indexOf("http")===0&&(c="ws"+u.slice(4)),c=c!=null?c:o;let d=Be.PageConfig.getOption("appendToken").toLowerCase(),l;return d===""?l=typeof window=="undefined"||typeof process!="undefined"&&((r=process==null?void 0:process.env)===null||r===void 0?void 0:r.JEST_WORKER_ID)!==void 0||Be.URLExt.getHostName(a)!==Be.URLExt.getHostName(c):l=d==="true",{init:{cache:"no-store",credentials:"same-origin"},fetch,Headers,Request,WebSocket:ci,token:Be.PageConfig.getToken(),appUrl:Be.PageConfig.getOption("appUrl"),appendToken:l,serializer:{serialize:pr.serialize,deserialize:pr.deserialize},...s,baseUrl:u,wsUrl:c}}i.makeSettings=e;function t(s,r,a){var o;if(s.indexOf(a.baseUrl)!==0)throw new Error("Can only be used for notebook server requests");((o=r.cache)!==null&&o!==void 0?o:a.init.cache)==="no-store"&&(s+=(/\?/.test(s)?"&":"?")+new Date().getTime());let c=new a.Request(s,{...a.init,...r}),d=!1;if(a.token&&(d=!0,c.headers.append("Authorization",`token ${a.token}`)),typeof document!="undefined"){let l=n("_xsrf");l!==void 0&&(d=!0,c.headers.append("X-XSRFToken",l))}return!c.headers.has("Content-Type")&&d&&c.headers.set("Content-Type","application/json"),a.fetch.call(null,c).catch(l=>{throw new di.NetworkError(l)})}i.handleRequest=t;function n(s){let r="";try{r=document.cookie}catch{return}let a=r.match("\\b"+s+"=([^;]*)\\b");return a==null?void 0:a[1]}})(sn||(sn={}))});var Ye=E(an=>{"use strict";Object.defineProperty(an,"__esModule",{value:!0});an.BaseManager=void 0;var hr=Z(),Il=de(),ui=class{constructor(e){var t;this._isDisposed=!1,this._disposed=new hr.Signal(this),this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Il.ServerConnection.makeSettings()}get disposed(){return this._disposed}get isDisposed(){return this._isDisposed}get isActive(){return!0}dispose(){this.isDisposed||(this._isDisposed=!0,this._disposed.emit(void 0),hr.Signal.clearData(this))}};an.BaseManager=ui});var mr=E($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.ConfigWithDefaults=$e.ConfigSection=$e.ConfigSectionManager=void 0;var Rl=J(),at=Te(),Ol="api/config",pi=class{constructor(e){var t;this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:at.ServerConnection.makeSettings()}async create(e){let t=new on({...e,serverSettings:this.serverSettings});return await t.load(),t}};$e.ConfigSectionManager=pi;var fr;(function(i){async function e(s){if(!t){let a=new on(s);return await a.load(),a}return await t.create(s)}i.create=e;let t;function n(s){if(t)throw new Error("ConfigSectionManager already set. If you would like to create a config section, use the `IConfigSectionManager` token in a plugin.");t=s}i._setConfigSectionManager=n})(fr||($e.ConfigSection=fr={}));var on=class{constructor(e){var t;this._url="unknown";let n=this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:at.ServerConnection.makeSettings();this._url=Rl.URLExt.join(n.baseUrl,Ol,encodeURIComponent(e.name))}get data(){return this._data}async load(){let e=await at.ServerConnection.makeRequest(this._url,{},this.serverSettings);if(e.status!==200)throw await at.ServerConnection.ResponseError.create(e);this._data=await e.json()}async update(e){this._data={...this._data,...e};let t={method:"PATCH",body:JSON.stringify(e)},n=await at.ServerConnection.makeRequest(this._url,t,this.serverSettings);if(n.status!==200)throw await at.ServerConnection.ResponseError.create(n);return this._data=await n.json(),this._data}},hi=class{constructor(e){var t,n;this._className="",this._section=e.section,this._defaults=(t=e.defaults)!==null&&t!==void 0?t:{},this._className=(n=e.className)!==null&&n!==void 0?n:""}get(e){let t=this._classData();return e in t?t[e]:this._defaults[e]}set(e,t){let n={};if(n[e]=t,this._className){let s={};return s[this._className]=n,this._section.update(s)}else return this._section.update(n)}_classData(){let e=this._section.data;return this._className&&this._className in e?e[this._className]:e}};$e.ConfigWithDefaults=hi});var gr=E(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});ln.ConnectionStatus=void 0;var fi=class{constructor(){this.isConnected=!0}};ln.ConnectionStatus=fi});var dn=E((cn,_r)=>{(function(i,e){typeof cn=="object"&&typeof _r!="undefined"?e(cn,Z()):typeof define=="function"&&define.amd?define(["exports","@lumino/signaling"],e):(i=typeof globalThis!="undefined"?globalThis:i||self,e(i.lumino_disposable={},i.lumino_signaling))})(cn,function(i,e){"use strict";class t{constructor(o){this._fn=o}get isDisposed(){return!this._fn}dispose(){if(!this._fn)return;let o=this._fn;this._fn=null,o()}}class n extends t{constructor(){super(...arguments),this._disposed=new e.Signal(this)}get disposed(){return this._disposed}dispose(){this.isDisposed||(super.dispose(),this._disposed.emit(void 0),e.Signal.clearData(this))}}class s{constructor(){this._isDisposed=!1,this._items=new Set}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed||(this._isDisposed=!0,this._items.forEach(o=>{o.dispose()}),this._items.clear())}contains(o){return this._items.has(o)}add(o){this._items.add(o)}remove(o){this._items.delete(o)}clear(){this._items.clear()}}(function(a){function o(u){let c=new a;for(let d of u)c.add(d);return c}a.from=o})(s||(s={}));class r extends s{constructor(){super(...arguments),this._disposed=new e.Signal(this)}get disposed(){return this._disposed}dispose(){this.isDisposed||(super.dispose(),this._disposed.emit(void 0),e.Signal.clearData(this))}}(function(a){function o(u){let c=new a;for(let d of u)c.add(d);return c}a.from=o})(r||(r={})),i.DisposableDelegate=t,i.DisposableSet=s,i.ObservableDisposableDelegate=n,i.ObservableDisposableSet=r})});var ht=E(mi=>{"use strict";Object.defineProperty(mi,"__esModule",{value:!0});mi.validateProperty=Dl;function Dl(i,e,t,n=[]){if(!i.hasOwnProperty(e))throw Error(`Missing property '${e}'`);let s=i[e];if(t!==void 0){let r=!0;switch(t){case"array":r=Array.isArray(s);break;case"object":r=typeof s!="undefined";break;default:r=typeof s===t}if(!r)throw new Error(`Property '${e}' is not of type '${t}'`);if(n.length>0){let a=!0;switch(t){case"string":case"number":case"boolean":a=n.includes(s);break;default:a=n.findIndex(o=>o===s)>=0;break}if(!a)throw new Error(`Property '${e}' is not one of the valid values ${JSON.stringify(n)}`)}}}});var vr=E(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.validateContentsModel=jl;un.validateCheckpointModel=Tl;var qe=ht();function jl(i){(0,qe.validateProperty)(i,"name","string"),(0,qe.validateProperty)(i,"path","string"),(0,qe.validateProperty)(i,"type","string"),(0,qe.validateProperty)(i,"created","string"),(0,qe.validateProperty)(i,"last_modified","string"),(0,qe.validateProperty)(i,"mimetype","object"),(0,qe.validateProperty)(i,"content","object"),(0,qe.validateProperty)(i,"format","object")}function Tl(i){(0,qe.validateProperty)(i,"id","string"),(0,qe.validateProperty)(i,"last_modified","string")}});var yi=E(oe=>{"use strict";var ql=oe&&oe.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),Ul=oe&&oe.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),Al=oe&&oe.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&ql(e,i,t);return Ul(e,i),e};Object.defineProperty(oe,"__esModule",{value:!0});oe.RestContentProvider=oe.Drive=oe.ContentsManager=oe.Contents=void 0;var ue=J(),Nl=dn(),ft=Z(),V=Te(),Fe=Al(vr()),Ll="api/contents",zl="files",yr;(function(i){function e(n){Fe.validateContentsModel(n)}i.validateContentsModel=e;function t(n){Fe.validateCheckpointModel(n)}i.validateCheckpointModel=t})(yr||(oe.Contents=yr={}));var gi=class{constructor(e={}){var t,n;this._isDisposed=!1,this._additionalDrives=new Map,this._fileChanged=new ft.Signal(this);let s=this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:V.ServerConnection.makeSettings();this._defaultDrive=(n=e.defaultDrive)!==null&&n!==void 0?n:new pn({serverSettings:s}),this._defaultDrive.fileChanged.connect(this._onFileChanged,this)}get defaultDrive(){return this._defaultDrive}get fileChanged(){return this._fileChanged}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,ft.Signal.clearData(this))}addDrive(e){this._additionalDrives.set(e.name,e),e.fileChanged.connect(this._onFileChanged,this)}getSharedModelFactory(e,t){var n,s;let[r]=this._driveForPath(e),a=(n=r.contentProviderRegistry)===null||n===void 0?void 0:n.getProvider(t==null?void 0:t.contentProviderId);return a!=null&&a.sharedModelFactory?a.sharedModelFactory:(s=r.sharedModelFactory)!==null&&s!==void 0?s:null}localPath(e){let t=e.split("/"),n=t[0].split(":");return n.length===1||!this._additionalDrives.has(n[0])?ue.PathExt.removeSlash(e):ue.PathExt.join(n.slice(1).join(":"),...t.slice(1))}normalize(e){let t=e.split(":");return t.length===1?ue.PathExt.normalize(e):`${t[0]}:${ue.PathExt.normalize(t.slice(1).join(":"))}`}resolvePath(e,t){let n=this.driveName(e),s=this.localPath(e),r=ue.PathExt.resolve("/",s,t);return n?`${n}:${r}`:r}driveName(e){let n=e.split("/")[0].split(":");return n.length===1?"":this._additionalDrives.has(n[0])?n[0]:""}get(e,t){let[n,s]=this._driveForPath(e);return n.get(s,t).then(r=>{let a=[];if(r.type==="directory"&&r.content){for(let o of r.content)a.push({...o,path:this._toGlobalPath(n,o.path)});return{...r,path:this._toGlobalPath(n,s),content:a,serverPath:r.path}}else return{...r,path:this._toGlobalPath(n,s),serverPath:r.path}})}getDownloadUrl(e){let[t,n]=this._driveForPath(e);return t.getDownloadUrl(n)}newUntitled(e={}){if(e.path){let t=this.normalize(e.path),[n,s]=this._driveForPath(t);return n.newUntitled({...e,path:s}).then(r=>({...r,path:ue.PathExt.join(t,r.name),serverPath:r.path}))}else return this._defaultDrive.newUntitled(e)}delete(e){let[t,n]=this._driveForPath(e);return t.delete(n)}rename(e,t){let[n,s]=this._driveForPath(e),[r,a]=this._driveForPath(t);if(n!==r)throw Error("ContentsManager: renaming files must occur within a Drive");return n.rename(s,a).then(o=>({...o,path:this._toGlobalPath(n,a),serverPath:o.path}))}save(e,t={}){let n=this.normalize(e),[s,r]=this._driveForPath(e);return s.save(r,{...t,path:r}).then(a=>({...a,path:n,serverPath:a.path}))}copy(e,t){let[n,s]=this._driveForPath(e),[r,a]=this._driveForPath(t);if(n===r)return n.copy(s,a).then(o=>({...o,path:this._toGlobalPath(n,o.path),serverPath:o.path}));throw Error("Copying files between drives is not currently implemented")}createCheckpoint(e){let[t,n]=this._driveForPath(e);return t.createCheckpoint(n)}listCheckpoints(e){let[t,n]=this._driveForPath(e);return t.listCheckpoints(n)}restoreCheckpoint(e,t){let[n,s]=this._driveForPath(e);return n.restoreCheckpoint(s,t)}deleteCheckpoint(e,t){let[n,s]=this._driveForPath(e);return n.deleteCheckpoint(s,t)}_toGlobalPath(e,t){return e===this._defaultDrive?ue.PathExt.removeSlash(t):`${e.name}:${ue.PathExt.removeSlash(t)}`}_driveForPath(e){let t=this.driveName(e),n=this.localPath(e);return t?[this._additionalDrives.get(t),n]:[this._defaultDrive,n]}_onFileChanged(e,t){var n,s;if(e===this._defaultDrive)this._fileChanged.emit(t);else{let r=null,a=null;!((n=t.newValue)===null||n===void 0)&&n.path&&(r={...t.newValue,path:this._toGlobalPath(e,t.newValue.path)}),!((s=t.oldValue)===null||s===void 0)&&s.path&&(a={...t.oldValue,path:this._toGlobalPath(e,t.oldValue.path)}),this._fileChanged.emit({type:t.type,newValue:r,oldValue:a})}}};oe.ContentsManager=gi;var pn=class{constructor(e={}){var t,n,s;this._isDisposed=!1,this._fileChanged=new ft.Signal(this),this.name=(t=e.name)!==null&&t!==void 0?t:"Default",this._apiEndpoint=(n=e.apiEndpoint)!==null&&n!==void 0?n:Ll,this.serverSettings=(s=e.serverSettings)!==null&&s!==void 0?s:V.ServerConnection.makeSettings();let r=new hn({apiEndpoint:this._apiEndpoint,serverSettings:this.serverSettings});this.contentProviderRegistry=new vi({defaultProvider:r}),this.contentProviderRegistry.fileChanged.connect((a,o)=>{this._fileChanged.emit(o)})}get fileChanged(){return this._fileChanged}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,ft.Signal.clearData(this))}async get(e,t){return this.contentProviderRegistry.getProvider(t==null?void 0:t.contentProviderId).get(e,t)}getDownloadUrl(e){let t=this.serverSettings.baseUrl,n=ue.URLExt.join(t,zl,ue.URLExt.encodeParts(e)),s="";try{s=document.cookie}catch{}let r=s.match("\\b_xsrf=([^;]*)\\b");if(r){let a=new URL(n);a.searchParams.append("_xsrf",r[1]),n=a.toString()}return Promise.resolve(n)}async newUntitled(e={}){var t;let n="{}";e&&(e.ext&&(e.ext=_i.normalizeExtension(e.ext)),n=JSON.stringify(e));let s=this.serverSettings,r=this._getUrl((t=e.path)!==null&&t!==void 0?t:""),a={method:"POST",body:n},o=await V.ServerConnection.makeRequest(r,a,s);if(o.status!==201)throw await V.ServerConnection.ResponseError.create(o);let u=await o.json();return Fe.validateContentsModel(u),this._fileChanged.emit({type:"new",oldValue:null,newValue:u}),u}async delete(e){let t=this._getUrl(e),n=this.serverSettings,s={method:"DELETE"},r=await V.ServerConnection.makeRequest(t,s,n);if(r.status!==204)throw await V.ServerConnection.ResponseError.create(r);this._fileChanged.emit({type:"delete",oldValue:{path:e},newValue:null})}async rename(e,t){let n=this.serverSettings,s=this._getUrl(e),r={method:"PATCH",body:JSON.stringify({path:t})},a=await V.ServerConnection.makeRequest(s,r,n);if(a.status!==200)throw await V.ServerConnection.ResponseError.create(a);let o=await a.json();return Fe.validateContentsModel(o),this._fileChanged.emit({type:"rename",oldValue:{path:e},newValue:o}),o}async save(e,t={}){let s=await this.contentProviderRegistry.getProvider(t==null?void 0:t.contentProviderId).save(e,t);return this._fileChanged.emit({type:"save",oldValue:null,newValue:s}),s}async copy(e,t){let n=this.serverSettings,s=this._getUrl(t),r={method:"POST",body:JSON.stringify({copy_from:e})},a=await V.ServerConnection.makeRequest(s,r,n);if(a.status!==201)throw await V.ServerConnection.ResponseError.create(a);let o=await a.json();return Fe.validateContentsModel(o),this._fileChanged.emit({type:"new",oldValue:null,newValue:o}),o}async createCheckpoint(e){let t=this._getUrl(e,"checkpoints"),n={method:"POST"},s=await V.ServerConnection.makeRequest(t,n,this.serverSettings);if(s.status!==201)throw await V.ServerConnection.ResponseError.create(s);let r=await s.json();return Fe.validateCheckpointModel(r),r}async listCheckpoints(e){let t=this._getUrl(e,"checkpoints"),n=await V.ServerConnection.makeRequest(t,{},this.serverSettings);if(n.status!==200)throw await V.ServerConnection.ResponseError.create(n);let s=await n.json();if(!Array.isArray(s))throw new Error("Invalid Checkpoint list");for(let r=0;r<s.length;r++)Fe.validateCheckpointModel(s[r]);return s}async restoreCheckpoint(e,t){let n=this._getUrl(e,"checkpoints",t),s={method:"POST"},r=await V.ServerConnection.makeRequest(n,s,this.serverSettings);if(r.status!==204)throw await V.ServerConnection.ResponseError.create(r)}async deleteCheckpoint(e,t){let n=this._getUrl(e,"checkpoints",t),s={method:"DELETE"},r=await V.ServerConnection.makeRequest(n,s,this.serverSettings);if(r.status!==204)throw await V.ServerConnection.ResponseError.create(r)}_getUrl(...e){let t=e.map(s=>ue.URLExt.encodeParts(s)),n=this.serverSettings.baseUrl;return ue.URLExt.join(n,this._apiEndpoint,...t)}};oe.Drive=pn;var _i;(function(i){function e(t){return t.length>0&&t.indexOf(".")!==0&&(t=`.${t}`),t}i.normalizeExtension=e})(_i||(_i={}));var vi=class{constructor(e){this._providers=new Map,this._fileChanged=new ft.Signal(this),this.register("default",e.defaultProvider),this._defaultProvider=e.defaultProvider}register(e,t){if(this._providers.has(e))throw Error(`Provider with ${e} identifier was already registered on this drive`);this._providers.set(e,t);let n=(s,r)=>{this._fileChanged.emit(r)};return t.fileChanged&&t.fileChanged.connect(n),new Nl.DisposableDelegate(()=>{t.fileChanged&&t.fileChanged.disconnect(n),this._providers.has(e)&&this._providers.delete(e)})}getProvider(e){if(!e)return this._defaultProvider;let t=this._providers.get(e);if(!t)throw Error(`Provider ${e} is not registered`);return t}get fileChanged(){return this._fileChanged}},hn=class{constructor(e){this._options=e}async get(e,t){let n=this._getUrl(e);if(t){t.type==="notebook"&&delete t.format;let o=t.content?"1":"0",u=t.hash?"1":"0",c={...t,content:o,hash:u};n+=ue.URLExt.objectToQueryString(c)}let s=this._options.serverSettings,r=await V.ServerConnection.makeRequest(n,{},s);if(r.status!==200)throw await V.ServerConnection.ResponseError.create(r);let a=await r.json();return Fe.validateContentsModel(a),a}async save(e,t={}){let n=this._options.serverSettings,s=this._getUrl(e),r={method:"PUT",body:JSON.stringify(t)},a=await V.ServerConnection.makeRequest(s,r,n);if(a.status!==200&&a.status!==201)throw await V.ServerConnection.ResponseError.create(a);let o=await a.json();return Fe.validateContentsModel(o),o}_getUrl(...e){let t=e.map(s=>ue.URLExt.encodeParts(s)),n=this._options.serverSettings.baseUrl;return ue.URLExt.join(n,this._options.apiEndpoint,...t)}};oe.RestContentProvider=hn});var Xe=E((fn,wr)=>{(function(i,e){typeof fn=="object"&&typeof wr!="undefined"?e(fn,te(),Z()):typeof define=="function"&&define.amd?define(["exports","@lumino/coreutils","@lumino/signaling"],e):(i=typeof globalThis!="undefined"?globalThis:i||self,e(i.lumino_polling={},i.lumino_coreutils,i.lumino_signaling))})(fn,function(i,e,t){"use strict";class n{constructor(c){var d;this._disposed=new t.Signal(this),this._lingered=0,this._tick=new e.PromiseDelegate,this._ticked=new t.Signal(this),this._factory=c.factory,this._linger=(d=c.linger)!==null&&d!==void 0?d:s.DEFAULT_LINGER,this._standby=c.standby||s.DEFAULT_STANDBY,this._state={...s.DEFAULT_STATE,timestamp:new Date().getTime()};let l=c.frequency||{},p=Math.max(l.interval||0,l.max||0,s.DEFAULT_FREQUENCY.max);this.frequency={...s.DEFAULT_FREQUENCY,...l,max:p},this.name=c.name||s.DEFAULT_NAME,(!("auto"in c)||c.auto)&&setTimeout(()=>this.start())}get disposed(){return this._disposed}get frequency(){return this._frequency}set frequency(c){if(this.isDisposed||e.JSONExt.deepEqual(c,this.frequency||{}))return;let{backoff:d,interval:l,max:p}=c;if(l=Math.round(l),p=Math.round(p),typeof d=="number"&&d<1)throw new Error("Poll backoff growth factor must be at least 1");if((l<0||l>p)&&l!==n.NEVER)throw new Error("Poll interval must be between 0 and max");if(p>n.MAX_INTERVAL&&p!==n.NEVER)throw new Error(`Max interval must be less than ${n.MAX_INTERVAL}`);this._frequency={backoff:d,interval:l,max:p}}get isDisposed(){return this.state.phase==="disposed"}get standby(){return this._standby}set standby(c){this.isDisposed||this.standby===c||(this._standby=c)}get state(){return this._state}get tick(){return this._tick.promise}get ticked(){return this._ticked}async*[Symbol.asyncIterator](){for(;!this.isDisposed;)yield this.state,await this.tick.catch(()=>{})}dispose(){this.isDisposed||(this._state={...s.DISPOSED_STATE,timestamp:new Date().getTime()},this._tick.promise.catch(c=>{}),this._tick.reject(new Error(`Poll (${this.name}) is disposed.`)),this._disposed.emit(void 0),t.Signal.clearData(this))}refresh(){return this.schedule({cancel:({phase:c})=>c==="refreshed",interval:n.IMMEDIATE,phase:"refreshed"})}async schedule(c={}){if(this.isDisposed||c.cancel&&c.cancel(this.state))return;let d=this._tick,l=new e.PromiseDelegate,p={interval:this.frequency.interval,payload:null,phase:"standby",timestamp:new Date().getTime(),...c};if(this._state=p,this._tick=l,clearTimeout(this._timeout),this._ticked.emit(this.state),d.resolve(this),await d.promise,p.interval===n.NEVER){this._timeout=void 0;return}let v=()=>{this.isDisposed||this.tick!==l.promise||this._execute()};this._timeout=setTimeout(v,p.interval)}start(){return this.schedule({cancel:({phase:c})=>c!=="constructed"&&c!=="standby"&&c!=="stopped",interval:n.IMMEDIATE,phase:"started"})}stop(){return this.schedule({cancel:({phase:c})=>c==="stopped",interval:n.NEVER,phase:"stopped"})}get hidden(){return s.hidden}_execute(){let c=typeof this.standby=="function"?this.standby():this.standby;if(c==="never"?c=!1:c==="when-hidden"&&(this.hidden?c=++this._lingered>this._linger:(this._lingered=0,c=!1)),c){this.schedule();return}let d=this.tick;this._factory(this.state).then(l=>{this.isDisposed||this.tick!==d||this.schedule({payload:l,phase:this.state.phase==="rejected"?"reconnected":"resolved"})}).catch(l=>{this.isDisposed||this.tick!==d||this.schedule({interval:s.sleep(this.frequency,this.state),payload:l,phase:"rejected"})})}}(function(u){u.IMMEDIATE=0,u.MAX_INTERVAL=2147483647,u.NEVER=1/0})(n||(n={}));var s;(function(u){u.DEFAULT_BACKOFF=3,u.DEFAULT_FREQUENCY={backoff:!0,interval:1e3,max:30*1e3},u.DEFAULT_LINGER=1,u.DEFAULT_NAME="unknown",u.DEFAULT_STANDBY="when-hidden",u.DEFAULT_STATE={interval:n.NEVER,payload:null,phase:"constructed",timestamp:new Date(0).getTime()},u.DISPOSED_STATE={interval:n.NEVER,payload:null,phase:"disposed",timestamp:new Date(0).getTime()};function c(l,p){let{backoff:v,interval:_,max:I}=l;if(_===n.NEVER)return _;let P=v===!0?u.DEFAULT_BACKOFF:v===!1?1:v,D=d(_,p.interval*P);return Math.min(I,D)}u.sleep=c,u.hidden=typeof document=="undefined"?!1:(document.addEventListener("visibilitychange",()=>{u.hidden=document.visibilityState==="hidden"}),document.addEventListener("pagehide",()=>{u.hidden=document.visibilityState==="hidden"}),document.visibilityState==="hidden");function d(l,p){return l=Math.ceil(l),p=Math.floor(p),Math.floor(Math.random()*(p-l+1))+l}})(s||(s={}));class r{constructor(c,d=500){this.args=void 0,this.payload=null,this.limit=d,this.poll=new n({auto:!1,factory:async()=>{let{args:l}=this;return this.args=void 0,c(...l)},frequency:{backoff:!1,interval:n.NEVER,max:n.NEVER},standby:"never"}),this.payload=new e.PromiseDelegate,this.poll.ticked.connect((l,p)=>{let{payload:v}=this;if(p.phase==="resolved"){this.payload=new e.PromiseDelegate,v.resolve(p.payload);return}if(p.phase==="rejected"||p.phase==="stopped"){this.payload=new e.PromiseDelegate,v.promise.catch(_=>{}),v.reject(p.payload);return}},this)}get isDisposed(){return this.payload===null}dispose(){this.isDisposed||(this.args=void 0,this.payload=null,this.poll.dispose())}async stop(){return this.poll.stop()}}class a extends r{invoke(...c){return this.args=c,this.poll.schedule({interval:this.limit,phase:"invoked"}),this.payload.promise}}class o extends r{constructor(c,d){super(c,typeof d=="number"?d:d&&d.limit),this._trailing=!1,typeof d!="number"&&d&&d.edge==="trailing"&&(this._trailing=!0),this._interval=this._trailing?this.limit:n.IMMEDIATE}invoke(...c){let d=this.poll.state.phase!=="invoked";return(d||this._trailing)&&(this.args=c),d&&this.poll.schedule({interval:this._interval,phase:"invoked"}),this.payload.promise}}i.Debouncer=a,i.Poll=n,i.RateLimiter=r,i.Throttler=o})});var bi=E(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.EventManager=void 0;var br=J(),Fl=Xe(),Sr=Z(),xr=de(),Cr="api/events",wi=class{constructor(e={}){var t,n;this._socket=null,this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:xr.ServerConnection.makeSettings(),this._poll=new Fl.Poll({factory:()=>this._subscribe(),standby:(n=e.standby)!==null&&n!==void 0?n:"when-hidden"}),this._stream=new Sr.Stream(this),this._poll.start()}get isDisposed(){return this._poll.isDisposed}get stream(){return this._stream}dispose(){if(this.isDisposed)return;this._poll.dispose();let e=this._socket;e&&(this._socket=null,e.onopen=()=>{},e.onerror=()=>{},e.onmessage=()=>{},e.onclose=()=>{},e.close()),Sr.Signal.clearData(this),this._stream.stop()}async emit(e){let{serverSettings:t}=this,{baseUrl:n}=t,{makeRequest:s,ResponseError:r}=xr.ServerConnection,a=br.URLExt.join(n,Cr),o={body:JSON.stringify(e),method:"POST"},u=await s(a,o,t);if(u.status!==204)throw new r(u)}_subscribe(){return new Promise((e,t)=>{if(this.isDisposed)return;let{appendToken:n,token:s,WebSocket:r,wsUrl:a}=this.serverSettings,o=br.URLExt.join(a,Cr,"subscribe");n&&s!==""&&(o+=`?token=${encodeURIComponent(s)}`);let u=this._socket=new r(o),c=this._stream;u.onclose=()=>t(new Error("EventManager socket closed")),u.onmessage=d=>d.data&&c.emit(JSON.parse(d.data))})}};mn.EventManager=wi});var Si=E(be=>{"use strict";var Kl=be&&be.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),Bl=be&&be.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),$l=be&&be.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&Kl(e,i,t);return Bl(e,i),e};Object.defineProperty(be,"__esModule",{value:!0});be.CommHandler=be.CommsOverSubshells=void 0;var Vl=te(),Wl=dn(),gn=$l(st()),ot;(function(i){i.Disabled="disabled",i.PerComm="perComm",i.PerCommTarget="perCommTarget"})(ot||(be.CommsOverSubshells=ot={}));var _n=class i extends Wl.DisposableDelegate{constructor(e,t,n,s,r){super(s),this._subshellStarted=new Vl.PromiseDelegate,this._subshellId=null,this._target="",this._id="",this._id=t,this._target=e,this._kernel=n,this._kernel.statusChanged.connect(()=>{this._kernel.status==="restarting"&&this._cleanSubshells()}),this.commsOverSubshells=r!=null?r:ot.PerCommTarget}get commId(){return this._id}get targetName(){return this._target}get subshellId(){return this._subshellId}get subshellStarted(){return this._subshellStarted.promise}get commsOverSubshells(){return this._commsOverSubshells}set commsOverSubshells(e){this._commsOverSubshells=e,this._commsOverSubshells===ot.Disabled?this._maybeCloseSubshell():this._maybeStartSubshell()}get onClose(){return this._onClose}set onClose(e){this._onClose=e}get onMsg(){return this._onMsg}set onMsg(e){this._onMsg=e}open(e,t,n=[]){if(this.isDisposed||this._kernel.isDisposed)throw new Error("Cannot open");let s=gn.createMessage({msgType:"comm_open",channel:"shell",username:this._kernel.username,session:this._kernel.clientId,subshellId:this._subshellId||this._kernel.subshellId,content:{comm_id:this._id,target_name:this._target,data:e!=null?e:{}},metadata:t,buffers:n});return this._kernel.sendShellMessage(s,!1,!0)}send(e,t,n=[],s=!0){if(this.isDisposed||this._kernel.isDisposed)throw new Error("Cannot send");let r=gn.createMessage({msgType:"comm_msg",channel:"shell",username:this._kernel.username,session:this._kernel.clientId,subshellId:this._subshellId||this._kernel.subshellId,content:{comm_id:this._id,data:e},metadata:t,buffers:n});return this._kernel.sendShellMessage(r,!1,s)}close(e,t,n=[]){if(this.isDisposed||this._kernel.isDisposed)throw new Error("Cannot close");let s=gn.createMessage({msgType:"comm_close",channel:"shell",username:this._kernel.username,session:this._kernel.clientId,subshellId:this._subshellId||this._kernel.subshellId,content:{comm_id:this._id,data:e!=null?e:{}},metadata:t,buffers:n}),r=this._kernel.sendShellMessage(s,!1,!0),a=this._onClose;if(a){let o=gn.createMessage({msgType:"comm_close",channel:"iopub",username:this._kernel.username,session:this._kernel.clientId,subshellId:this._subshellId||this._kernel.subshellId,content:{comm_id:this._id,data:e!=null?e:{}},metadata:t,buffers:n});a(o)}return this.dispose(),r}dispose(){this._maybeCloseSubshell(),super.dispose()}_cleanSubshells(){i._commTargetSubShellsId={}}async _maybeStartSubshell(){if(await this._kernel.info,!!this._kernel.supportsSubshells){if(this._commsOverSubshells===ot.PerComm){let e=await this._kernel.requestCreateSubshell({}).done;this._subshellId=e.content.subshell_id,this._subshellStarted.resolve();return}i._commTargetSubShellsId[this._target]?(this._subshellId=await i._commTargetSubShellsId[this._target],this._subshellStarted.resolve()):(i._commTargetSubShellsId[this._target]=this._kernel.requestCreateSubshell({}).done.then(e=>(this._subshellId=e.content.subshell_id,this._subshellId)),await i._commTargetSubShellsId[this._target],this._subshellStarted.resolve())}}_maybeCloseSubshell(){if(this._commsOverSubshells!==ot.PerComm){this._subshellId=null;return}this._subshellId&&this._kernel.status!=="dead"&&this._kernel.requestDeleteSubshell({subshell_id:this._subshellId},!0),this._subshellId=null}};be.CommHandler=_n;_n._commTargetSubShellsId={}});var Pr=E(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0})});var vn=E(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.validateMessage=Gl;mt.validateModel=Er;mt.validateModels=Xl;var Ze=ht(),Mr=["username","version","session","msg_id","msg_type"],Jl={stream:{name:"string",text:"string"},display_data:{data:"object",metadata:"object"},execute_input:{code:"string",execution_count:"number"},execute_result:{execution_count:"number",data:"object",metadata:"object"},error:{ename:"string",evalue:"string",traceback:"object"},status:{execution_state:["string",["starting","idle","busy","restarting","dead"]]},clear_output:{wait:"boolean"},comm_open:{comm_id:"string",target_name:"string",data:"object"},comm_msg:{comm_id:"string",data:"object"},comm_close:{comm_id:"string"},shutdown_reply:{restart:"boolean"}};function Hl(i){for(let e=0;e<Mr.length;e++)(0,Ze.validateProperty)(i,Mr[e],"string")}function Gl(i){(0,Ze.validateProperty)(i,"metadata","object"),(0,Ze.validateProperty)(i,"content","object"),(0,Ze.validateProperty)(i,"channel","string"),Hl(i.header),i.channel==="iopub"&&Yl(i)}function Yl(i){if(i.channel==="iopub"){let e=Jl[i.header.msg_type];if(e===void 0)return;let t=Object.keys(e),n=i.content;for(let s=0;s<t.length;s++){let r=e[t[s]];Array.isArray(r)||(r=[r]),(0,Ze.validateProperty)(n,t[s],...r)}}}function Er(i){(0,Ze.validateProperty)(i,"name","string"),(0,Ze.validateProperty)(i,"id","string")}function Xl(i){if(!Array.isArray(i))throw new Error("Invalid kernel list");i.forEach(e=>Er(e))}});var wn=E(ne=>{"use strict";Object.defineProperty(ne,"__esModule",{value:!0});ne.KernelAPIClient=ne.KERNEL_SERVICE_URL=void 0;ne.listRunning=Ir;ne.startNew=Rr;ne.restartKernel=Or;ne.interruptKernel=Dr;ne.shutdownKernel=jr;ne.getKernelModel=Tr;var Q=de(),lt=J(),yn=vn();ne.KERNEL_SERVICE_URL="api/kernels";async function Ir(i=Q.ServerConnection.makeSettings()){let e=lt.URLExt.join(i.baseUrl,ne.KERNEL_SERVICE_URL),t=await Q.ServerConnection.makeRequest(e,{},i);if(t.status!==200)throw await Q.ServerConnection.ResponseError.create(t);let n=await t.json();return(0,yn.validateModels)(n),n}async function Rr(i={},e=Q.ServerConnection.makeSettings()){let t=lt.URLExt.join(e.baseUrl,ne.KERNEL_SERVICE_URL),n={method:"POST",body:JSON.stringify(i)},s=await Q.ServerConnection.makeRequest(t,n,e);if(s.status!==201)throw await Q.ServerConnection.ResponseError.create(s);let r=await s.json();return(0,yn.validateModel)(r),r}async function Or(i,e=Q.ServerConnection.makeSettings()){let t=lt.URLExt.join(e.baseUrl,ne.KERNEL_SERVICE_URL,encodeURIComponent(i),"restart"),n={method:"POST"},s=await Q.ServerConnection.makeRequest(t,n,e);if(s.status!==200)throw await Q.ServerConnection.ResponseError.create(s);let r=await s.json();(0,yn.validateModel)(r)}async function Dr(i,e=Q.ServerConnection.makeSettings()){let t=lt.URLExt.join(e.baseUrl,ne.KERNEL_SERVICE_URL,encodeURIComponent(i),"interrupt"),n={method:"POST"},s=await Q.ServerConnection.makeRequest(t,n,e);if(s.status!==204)throw await Q.ServerConnection.ResponseError.create(s)}async function jr(i,e=Q.ServerConnection.makeSettings()){let t=lt.URLExt.join(e.baseUrl,ne.KERNEL_SERVICE_URL,encodeURIComponent(i)),n={method:"DELETE"},s=await Q.ServerConnection.makeRequest(t,n,e);if(s.status===404){let r=`The kernel "${i}" does not exist on the server`;console.warn(r)}else if(s.status!==204)throw await Q.ServerConnection.ResponseError.create(s)}async function Tr(i,e=Q.ServerConnection.makeSettings()){let t=lt.URLExt.join(e.baseUrl,ne.KERNEL_SERVICE_URL,encodeURIComponent(i)),n=await Q.ServerConnection.makeRequest(t,{},e);if(n.status===404)return;if(n.status!==200)throw await Q.ServerConnection.ResponseError.create(n);let s=await n.json();return(0,yn.validateModel)(s),s}var xi=class{constructor(e={}){var t;this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Q.ServerConnection.makeSettings()}async listRunning(){return Ir(this.serverSettings)}async getModel(e){return Tr(e,this.serverSettings)}async startNew(e={}){return Rr(e,this.serverSettings)}async restart(e){return Or(e,this.serverSettings)}async interrupt(e){return Dr(e,this.serverSettings)}async shutdown(e){return jr(e,this.serverSettings)}};ne.KernelAPIClient=xi});var Ur=E(_e=>{"use strict";var Zl=_e&&_e.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),Ql=_e&&_e.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),ec=_e&&_e.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&Zl(e,i,t);return Ql(e,i),e};Object.defineProperty(_e,"__esModule",{value:!0});_e.KernelShellFutureHandler=_e.KernelControlFutureHandler=_e.KernelFutureHandler=void 0;var qr=te(),tc=dn(),nc=ec(st()),gt=class extends tc.DisposableDelegate{constructor(e,t,n,s,r){super(e),this._status=0,this._stdin=ie.noOp,this._iopub=ie.noOp,this._reply=ie.noOp,this._done=new qr.PromiseDelegate,this._hooks=new ie.HookList,this._disposeOnDone=!0,this._msg=t,n||this._setFlag(ie.KernelFutureFlag.GotReply),this._disposeOnDone=s,this._kernel=r}get msg(){return this._msg}get done(){return this._done.promise}get onReply(){return this._reply}set onReply(e){this._reply=e}get onIOPub(){return this._iopub}set onIOPub(e){this._iopub=e}get onStdin(){return this._stdin}set onStdin(e){this._stdin=e}registerMessageHook(e){if(this.isDisposed)throw new Error("Kernel future is disposed");this._hooks.add(e)}removeMessageHook(e){this.isDisposed||this._hooks.remove(e)}sendInputReply(e,t){this._kernel.sendInputReply(e,t)}dispose(){this._stdin=ie.noOp,this._iopub=ie.noOp,this._reply=ie.noOp,this._hooks=null,this._testFlag(ie.KernelFutureFlag.IsDone)||(this._done.promise.catch(()=>{}),this._done.reject(new Error(`Canceled future for ${this.msg.header.msg_type} message before replies were done`))),super.dispose()}async handleMsg(e){switch(e.channel){case"control":case"shell":e.channel===this.msg.channel&&e.parent_header.msg_id===this.msg.header.msg_id&&await this._handleReply(e);break;case"stdin":await this._handleStdin(e);break;case"iopub":await this._handleIOPub(e);break;default:break}}async _handleReply(e){let t=this._reply;t&&await t(e),this._replyMsg=e,this._setFlag(ie.KernelFutureFlag.GotReply),this._testFlag(ie.KernelFutureFlag.GotIdle)&&this._handleDone()}async _handleStdin(e){this._kernel.hasPendingInput=!0;let t=this._stdin;t&&await t(e)}async _handleIOPub(e){let t=await this._hooks.process(e),n=this._iopub;t&&n&&await n(e),nc.isStatusMsg(e)&&e.content.execution_state==="idle"&&(this._setFlag(ie.KernelFutureFlag.GotIdle),this._testFlag(ie.KernelFutureFlag.GotReply)&&this._handleDone())}_handleDone(){this._testFlag(ie.KernelFutureFlag.IsDone)||(this._setFlag(ie.KernelFutureFlag.IsDone),this._done.resolve(this._replyMsg),this._disposeOnDone&&this.dispose())}_testFlag(e){return(this._status&e)!==0}_setFlag(e){this._status|=e}};_e.KernelFutureHandler=gt;var Ci=class extends gt{};_e.KernelControlFutureHandler=Ci;var ki=class extends gt{};_e.KernelShellFutureHandler=ki;var ie;(function(i){i.noOp=()=>{};let e=typeof requestAnimationFrame=="function"?requestAnimationFrame:setImmediate;class t{constructor(){this._hooks=[]}add(r){this.remove(r),this._hooks.push(r)}remove(r){let a=this._hooks.indexOf(r);a>=0&&(this._hooks[a]=null,this._scheduleCompact())}async process(r){await this._processing;let a=new qr.PromiseDelegate;this._processing=a.promise;let o;for(let u=this._hooks.length-1;u>=0;u--){let c=this._hooks[u];if(c!==null){try{o=await c(r)}catch(d){o=!0,console.error(d)}if(o===!1)return a.resolve(void 0),!1}}return a.resolve(void 0),!0}_scheduleCompact(){this._compactScheduled||(this._compactScheduled=!0,e(()=>{this._processing=this._processing.then(()=>{this._compactScheduled=!1,this._compact()})}))}_compact(){let r=0;for(let a=0,o=this._hooks.length;a<o;a++){let u=this._hooks[a];this._hooks[a]===null?r++:this._hooks[a-r]=u}this._hooks.length-=r}}i.HookList=t;let n;(function(s){s[s.GotReply=1]="GotReply",s[s.GotIdle=2]="GotIdle",s[s.IsDone=4]="IsDone",s[s.DisposeOnDone=8]="DisposeOnDone"})(n=i.KernelFutureFlag||(i.KernelFutureFlag={}))})(ie||(ie={}))});var Nr=E(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0});bn.validateSpecModel=Ar;bn.validateSpecModels=ic;var Qe=ht();function Ar(i){let e=i.spec;if(!e)throw new Error("Invalid kernel spec");(0,Qe.validateProperty)(i,"name","string"),(0,Qe.validateProperty)(i,"resources","object"),(0,Qe.validateProperty)(e,"language","string"),(0,Qe.validateProperty)(e,"display_name","string"),(0,Qe.validateProperty)(e,"argv","array");let t=null;e.hasOwnProperty("metadata")&&((0,Qe.validateProperty)(e,"metadata","object"),t=e.metadata);let n=null;return e.hasOwnProperty("env")&&((0,Qe.validateProperty)(e,"env","object"),n=e.env),{name:i.name,resources:i.resources,language:e.language,display_name:e.display_name,argv:e.argv,metadata:t,env:n}}function ic(i){if(!i.hasOwnProperty("kernelspecs"))throw new Error("No kernelspecs found");let e=Object.keys(i.kernelspecs),t=Object.create(null),n=i.default;for(let s=0;s<e.length;s++){let r=i.kernelspecs[e[s]];try{t[e[s]]=Ar(r)}catch{console.warn(`Removing errant kernel spec: ${e[s]}`)}}if(e=Object.keys(t),!e.length)throw new Error("No valid kernelspecs found");return(!n||typeof n!="string"||!(n in t))&&(n=e[0],console.warn(`Default kernel not found, using '${e[0]}'`)),{default:n,kernelspecs:t}}});var vt=E(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.KernelSpecAPIClient=void 0;_t.getSpecs=Lr;var Sn=de(),sc=Nr(),rc=J(),ac="api/kernelspecs";async function Lr(i=Sn.ServerConnection.makeSettings()){let e=rc.URLExt.join(i.baseUrl,ac),t=await Sn.ServerConnection.makeRequest(e,{},i);if(t.status!==200)throw await Sn.ServerConnection.ResponseError.create(t);let n=await t.json();return(0,sc.validateSpecModels)(n)}var Pi=class{constructor(e={}){var t;this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Sn.ServerConnection.makeSettings()}async get(){return Lr(this.serverSettings)}};_t.KernelSpecAPIClient=Pi});var Ei=E(Ue=>{"use strict";var oc=Ue&&Ue.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),lc=Ue&&Ue.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),$r=Ue&&Ue.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&oc(e,i,t);return lc(e,i),e};Object.defineProperty(Ue,"__esModule",{value:!0});Ue.KernelConnection=void 0;var zr=J(),Ve=te(),We=Z(),yt=Te(),Fr=Si(),se=$r(st()),Kr=Ur(),cc=$r(vn()),Br=wn(),dc=vt(),uc=3e3,ct="_RESTARTING_",pc="",Mi=class i{constructor(e){var t,n,s,r,a,o,u,c;this._createSocket=(d=!0)=>{this._errorIfDisposed(),this._clearSocket(),this._updateConnectionStatus("connecting");let l=this.serverSettings,p=zr.URLExt.join(l.wsUrl,Br.KERNEL_SERVICE_URL,encodeURIComponent(this._id)),v=p.replace(/^((?:\w+:)?\/\/)(?:[^@\/]+@)/,"$1");console.debug(`Starting WebSocket: ${v}`);let _=zr.URLExt.join(p,"channels?session_id="+encodeURIComponent(this._clientId)),I=l.token;l.appendToken&&I!==""&&(_=_+`&token=${encodeURIComponent(I)}`);let P=d?this._supportedProtocols:[];this._ws=new l.WebSocket(_,P),this._ws.binaryType="arraybuffer";let D=!1,q=async w=>{var R,A;if(!this._isDisposed){this._reason="",this._model=void 0;try{let T=await this._kernelAPIClient.getModel(this._id);this._model=T,(T==null?void 0:T.execution_state)==="dead"?this._updateStatus("dead"):this._onWSClose(w)}catch(T){if(T instanceof yt.ServerConnection.NetworkError||((R=T.response)===null||R===void 0?void 0:R.status)===503||((A=T.response)===null||A===void 0?void 0:A.status)===424){let j=Se.getRandomIntInclusive(10,30)*1e3;setTimeout(q,j,w)}else this._reason="Kernel died unexpectedly",this._updateStatus("dead")}}},x=async w=>{D||(D=!0,await q(w))};this._ws.onmessage=this._onWSMessage,this._ws.onopen=this._onWSOpen,this._ws.onclose=x,this._ws.onerror=x},this._onWSOpen=d=>{if(this._ws.protocol!==""&&!this._supportedProtocols.includes(this._ws.protocol))throw console.log("Server selected unknown kernel wire protocol:",this._ws.protocol),this._updateStatus("dead"),new Error(`Unknown kernel wire protocol: ${this._ws.protocol}`);this._selectedProtocol=this._ws.protocol,this._ws.onclose=this._onWSClose,this._ws.onerror=this._onWSClose,this._updateConnectionStatus("connected")},this._onWSMessage=d=>{let l;try{l=this.serverSettings.serializer.deserialize(d.data,this._ws.protocol),cc.validateMessage(l)}catch(p){throw p.message=`Kernel message validation error: ${p.message}`,p}this._kernelSession=l.header.session,this._msgChain=this._msgChain.then(()=>this._handleMessage(l)).catch(p=>{p.message.startsWith("Canceled future for ")&&console.error(p)}),this._anyMessage.emit({msg:l,direction:"recv"})},this._onWSClose=d=>{this.isDisposed||this._reconnect()},this._id="",this._name="",this._status="unknown",this._connectionStatus="connecting",this._kernelSession="",this._isDisposed=!1,this._ws=null,this._username="",this._reconnectLimit=7,this._reconnectAttempt=0,this._reconnectTimeout=null,this._supportedProtocols=Object.values(se.supportedKernelWebSocketProtocols),this._selectedProtocol="",this._commsOverSubshells=yt.CommsOverSubshells.PerCommTarget,this._futures=new Map,this._comms=new Map,this._targetRegistry=Object.create(null),this._info=new Ve.PromiseDelegate,this._pendingMessages=[],this._statusChanged=new We.Signal(this),this._connectionStatusChanged=new We.Signal(this),this._disposed=new We.Signal(this),this._iopubMessage=new We.Signal(this),this._anyMessage=new We.Signal(this),this._pendingInput=new We.Signal(this),this._unhandledMessage=new We.Signal(this),this._displayIdToParentIds=new Map,this._msgIdToDisplayIds=new Map,this._msgChain=Promise.resolve(),this._hasPendingInput=!1,this._reason="",this._noOp=()=>{},this._supportsSubshells=!1,this._name=e.model.name,this._id=e.model.id,this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:yt.ServerConnection.makeSettings(),this._kernelAPIClient=(n=e.kernelAPIClient)!==null&&n!==void 0?n:new Br.KernelAPIClient({serverSettings:this.serverSettings}),this._kernelSpecAPIClient=(s=e.kernelSpecAPIClient)!==null&&s!==void 0?s:new dc.KernelSpecAPIClient({serverSettings:this.serverSettings}),this._clientId=(r=e.clientId)!==null&&r!==void 0?r:Ve.UUID.uuid4(),this._username=(a=e.username)!==null&&a!==void 0?a:"",this.handleComms=(o=e.handleComms)!==null&&o!==void 0?o:!0,this._commsOverSubshells=(u=e.commsOverSubshells)!==null&&u!==void 0?u:yt.CommsOverSubshells.PerCommTarget,this._subshellId=(c=e.subshellId)!==null&&c!==void 0?c:null,this._createSocket()}get disposed(){return this._disposed}get commsOverSubshells(){return this._commsOverSubshells}set commsOverSubshells(e){this._commsOverSubshells=e;for(let[t,n]of this._comms)n.commsOverSubshells=e}get statusChanged(){return this._statusChanged}get connectionStatusChanged(){return this._connectionStatusChanged}get iopubMessage(){return this._iopubMessage}get unhandledMessage(){return this._unhandledMessage}get model(){return this._model||{id:this.id,name:this.name,reason:this._reason}}get anyMessage(){return this._anyMessage}get pendingInput(){return this._pendingInput}get id(){return this._id}get name(){return this._name}get username(){return this._username}get clientId(){return this._clientId}get subshellId(){return this._subshellId}set subshellId(e){this._subshellId=e}get status(){return this._status}get connectionStatus(){return this._connectionStatus}get isDisposed(){return this._isDisposed}get info(){return this._info.promise}get spec(){return this._specPromise?this._specPromise:(this._specPromise=this._kernelSpecAPIClient.get().then(e=>e.kernelspecs[this._name]),this._specPromise)}get supportsSubshells(){return this._supportsSubshells}clone(e={}){return new i({model:this.model,username:this.username,serverSettings:this.serverSettings,handleComms:!1,kernelAPIClient:this._kernelAPIClient,commsOverSubshells:yt.CommsOverSubshells.Disabled,...e})}dispose(){if(this.isDisposed)return;let e=()=>{this._isDisposed=!0,this._disposed.emit(),this._updateConnectionStatus("disconnected"),this._clearKernelState(),this._pendingMessages=[],this._clearSocket(),We.Signal.clearData(this)};if(this._subshellId!==null){let t=this.requestDeleteSubshell({subshell_id:this._subshellId},!0);t.onReply=n=>{e()}}else e()}sendShellMessage(e,t=!1,n=!0){return this._sendKernelShellControl(Kr.KernelShellFutureHandler,e,t,n)}sendControlMessage(e,t=!1,n=!0){return this._sendKernelShellControl(Kr.KernelControlFutureHandler,e,t,n)}_sendKernelShellControl(e,t,n=!1,s=!0){this._sendMessage(t),this._anyMessage.emit({msg:t,direction:"send"});let r=new e(()=>{let a=t.header.msg_id;this._futures.delete(a);let o=this._msgIdToDisplayIds.get(a);o&&(o.forEach(u=>{let c=this._displayIdToParentIds.get(u);if(c){let d=c.indexOf(a);if(d===-1)return;c.length===1?this._displayIdToParentIds.delete(u):(c.splice(d,1),this._displayIdToParentIds.set(u,c))}}),this._msgIdToDisplayIds.delete(a))},t,n,s,this);return this._futures.set(t.header.msg_id,r),r}_sendMessage(e,t=!0){if(this.status==="dead")throw new Error("Kernel is dead");if((this._kernelSession===pc||this._kernelSession===ct)&&se.isInfoRequestMsg(e))if(this.connectionStatus==="connected"){this._ws.send(this.serverSettings.serializer.serialize(e,this._ws.protocol));return}else throw new Error("Could not send message: status is not connected");if(t&&this._pendingMessages.length>0){this._pendingMessages.push(e);return}if(this.connectionStatus==="connected"&&this._kernelSession!==ct)this._ws.send(this.serverSettings.serializer.serialize(e,this._ws.protocol));else if(t)this._pendingMessages.push(e);else throw new Error("Could not send message")}async interrupt(){if(this.hasPendingInput=!1,this.status==="dead")throw new Error("Kernel is dead");return this._kernelAPIClient.interrupt(this.id)}async restart(){if(this.status==="dead")throw new Error("Kernel is dead");this._updateStatus("restarting"),this._clearKernelState(),this._kernelSession=ct,await this._kernelAPIClient.restart(this.id),await this.reconnect(),this.hasPendingInput=!1}reconnect(){this._errorIfDisposed();let e=new Ve.PromiseDelegate,t=(n,s)=>{s==="connected"?(e.resolve(),this.connectionStatusChanged.disconnect(t,this)):s==="disconnected"&&(e.reject(new Error("Kernel connection disconnected")),this.connectionStatusChanged.disconnect(t,this))};return this.connectionStatusChanged.connect(t,this),this._reconnectAttempt=0,this._reconnect(),e.promise}async shutdown(){this.status!=="dead"&&await this._kernelAPIClient.shutdown(this.id),this.handleShutdown()}handleShutdown(){this._updateStatus("dead"),this.dispose()}async requestKernelInfo(){let e=se.createMessage({msgType:"kernel_info_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:{}}),t;try{t=await Se.handleShellMessage(this,e)}catch(s){if(this.isDisposed)return;throw s}if(this._errorIfDisposed(),!t)return;if(t.content.status===void 0&&(t.content.status="ok"),t.content.status!=="ok")return this._info.reject("Kernel info reply errored"),t;this._info.resolve(t.content),this._kernelSession=t.header.session;let n=t.content.supported_features;return this._supportsSubshells=n!==void 0&&n.includes("kernel subshells"),t}requestComplete(e){let t=se.createMessage({msgType:"complete_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:e});return Se.handleShellMessage(this,t)}requestInspect(e){let t=se.createMessage({msgType:"inspect_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:e});return Se.handleShellMessage(this,t)}requestHistory(e){let t=se.createMessage({msgType:"history_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:e});return Se.handleShellMessage(this,t)}requestExecute(e,t=!0,n){let s={silent:!1,store_history:!0,user_expressions:{},allow_stdin:!0,stop_on_error:!1},r=se.createMessage({msgType:"execute_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:{...s,...e},metadata:n});return this.sendShellMessage(r,!0,t)}requestDebug(e,t=!0){let n=se.createMessage({msgType:"debug_request",channel:"control",username:this._username,session:this._clientId,content:e});return this.sendControlMessage(n,!0,t)}requestCreateSubshell(e,t=!0){if(!this.supportsSubshells)throw new Error("Kernel subshells are not supported");let n=se.createMessage({msgType:"create_subshell_request",channel:"control",username:this._username,session:this._clientId,content:e});return this.sendControlMessage(n,!0,t)}requestDeleteSubshell(e,t=!0){if(!this.supportsSubshells)throw new Error("Kernel subshells are not supported");let n=se.createMessage({msgType:"delete_subshell_request",channel:"control",username:this._username,session:this._clientId,content:e});return this.sendControlMessage(n,!0,t)}requestListSubshell(e,t=!0){if(!this.supportsSubshells)throw new Error("Kernel subshells are not supported");let n=se.createMessage({msgType:"list_subshell_request",channel:"control",username:this._username,session:this._clientId,content:e});return this.sendControlMessage(n,!0,t)}requestIsComplete(e){let t=se.createMessage({msgType:"is_complete_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:e});return Se.handleShellMessage(this,t)}requestCommInfo(e){let t=se.createMessage({msgType:"comm_info_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:e});return Se.handleShellMessage(this,t)}sendInputReply(e,t){let n=se.createMessage({msgType:"input_reply",channel:"stdin",username:this._username,session:this._clientId,content:e});n.parent_header=t,this._sendMessage(n),this._anyMessage.emit({msg:n,direction:"send"}),this.hasPendingInput=!1}createComm(e,t=Ve.UUID.uuid4()){if(!this.handleComms)throw new Error("Comms are disabled on this kernel connection");if(this._comms.has(t))throw new Error("Comm is already created");let n=new Fr.CommHandler(e,t,this,()=>{this._unregisterComm(t)},this._commsOverSubshells);return this._comms.set(t,n),n}hasComm(e){return this._comms.has(e)}registerCommTarget(e,t){this.handleComms&&(this._targetRegistry[e]=t)}removeCommTarget(e,t){this.handleComms&&!this.isDisposed&&this._targetRegistry[e]===t&&delete this._targetRegistry[e]}registerMessageHook(e,t){var n;let s=(n=this._futures)===null||n===void 0?void 0:n.get(e);s&&s.registerMessageHook(t)}removeMessageHook(e,t){var n;let s=(n=this._futures)===null||n===void 0?void 0:n.get(e);s&&s.removeMessageHook(t)}removeInputGuard(){this.hasPendingInput=!1}async _handleDisplayId(e,t){var n,s;let r=t.parent_header.msg_id,a=this._displayIdToParentIds.get(e);if(a){let u={header:Ve.JSONExt.deepCopy(t.header),parent_header:Ve.JSONExt.deepCopy(t.parent_header),metadata:Ve.JSONExt.deepCopy(t.metadata),content:Ve.JSONExt.deepCopy(t.content),channel:t.channel,buffers:t.buffers?t.buffers.slice():[]};u.header.msg_type="update_display_data",await Promise.all(a.map(async c=>{let d=this._futures&&this._futures.get(c);d&&await d.handleMsg(u)}))}if(t.header.msg_type==="update_display_data")return!0;a=(n=this._displayIdToParentIds.get(e))!==null&&n!==void 0?n:[],a.indexOf(r)===-1&&a.push(r),this._displayIdToParentIds.set(e,a);let o=(s=this._msgIdToDisplayIds.get(r))!==null&&s!==void 0?s:[];return o.indexOf(r)===-1&&o.push(r),this._msgIdToDisplayIds.set(r,o),!1}_clearSocket(){this._ws!==null&&(this._ws.onopen=this._noOp,this._ws.onclose=this._noOp,this._ws.onerror=this._noOp,this._ws.onmessage=this._noOp,this._ws.close(),this._ws=null)}_updateStatus(e){this._status===e||this._status==="dead"||(this._status=e,Se.logKernelStatus(this),this._statusChanged.emit(e),e==="dead"&&this.dispose())}_sendPending(){for(;this.connectionStatus==="connected"&&this._kernelSession!==ct&&this._pendingMessages.length>0;)this._sendMessage(this._pendingMessages[0],!1),this._pendingMessages.shift()}_clearKernelState(){this._kernelSession="",this._pendingMessages=[],this._futures.forEach(e=>{e.dispose()}),this._comms.forEach(e=>{e.dispose()}),this._msgChain=Promise.resolve(),this._futures=new Map,this._comms=new Map,this._displayIdToParentIds.clear(),this._msgIdToDisplayIds.clear()}_assertCurrentMessage(e){if(this._errorIfDisposed(),e.header.session!==this._kernelSession)throw new Error(`Canceling handling of old message: ${e.header.msg_type}`)}async _handleCommOpen(e){this._assertCurrentMessage(e);let t=e.content,n=new Fr.CommHandler(t.target_name,t.comm_id,this,()=>{this._unregisterComm(t.comm_id)},this.commsOverSubshells);this._comms.set(t.comm_id,n);try{await(await Se.loadObject(t.target_name,t.target_module,this._targetRegistry))(n,e)}catch(s){throw n.close(),console.error("Exception opening new comm"),s}}async _handleCommClose(e){this._assertCurrentMessage(e);let t=e.content,n=this._comms.get(t.comm_id);if(!n){console.error("Comm not found for comm id "+t.comm_id);return}this._unregisterComm(n.commId);let s=n.onClose;s&&await s(e),n.dispose()}async _handleCommMsg(e){this._assertCurrentMessage(e);let t=e.content,n=this._comms.get(t.comm_id);if(!n)return;let s=n.onMsg;s&&await s(e)}_unregisterComm(e){this._comms.delete(e)}_updateConnectionStatus(e){if(this._connectionStatus!==e){if(this._connectionStatus=e,e!=="connecting"&&(this._reconnectAttempt=0,clearTimeout(this._reconnectTimeout)),this.status!=="dead")if(e==="connected"){let t=this._kernelSession===ct,n=this.requestKernelInfo(),s=!1,r=()=>{s||(s=!0,t&&this._kernelSession===ct&&(this._kernelSession=""),clearTimeout(a),this._pendingMessages.length>0&&this._sendPending())};n.then(r);let a=setTimeout(r,uc)}else this._updateStatus("unknown");this._connectionStatusChanged.emit(e)}}async _handleMessage(e){var t,n;let s=!1;if(e.parent_header&&e.channel==="iopub"&&(se.isDisplayDataMsg(e)||se.isUpdateDisplayDataMsg(e)||se.isExecuteResultMsg(e))){let a=((t=e.content.transient)!==null&&t!==void 0?t:{}).display_id;a&&(s=await this._handleDisplayId(a,e),this._assertCurrentMessage(e))}if(!s&&e.parent_header){let r=e.parent_header,a=(n=this._futures)===null||n===void 0?void 0:n.get(r.msg_id);if(a)await a.handleMsg(e),this._assertCurrentMessage(e);else{let o=r.session===this.clientId;e.channel!=="iopub"&&o&&this._unhandledMessage.emit(e)}}if(e.channel==="iopub"){switch(e.header.msg_type){case"status":{let r=e.content.execution_state;r==="restarting"&&Promise.resolve().then(async()=>{this._updateStatus("autorestarting"),this._clearKernelState(),await this.reconnect()}),this._updateStatus(r);break}case"comm_open":this.handleComms&&await this._handleCommOpen(e);break;case"comm_msg":this.handleComms&&await this._handleCommMsg(e);break;case"comm_close":this.handleComms&&await this._handleCommClose(e);break;default:break}this.isDisposed||(this._assertCurrentMessage(e),this._iopubMessage.emit(e))}}_reconnect(){if(this._errorIfDisposed(),clearTimeout(this._reconnectTimeout),this._reconnectAttempt<this._reconnectLimit){this._updateConnectionStatus("connecting");let e=Se.getRandomIntInclusive(0,1e3*(Math.pow(2,this._reconnectAttempt)-1));console.warn(`Connection lost, reconnecting in ${Math.floor(e/1e3)} seconds.`);let t=this._selectedProtocol!=="";this._reconnectTimeout=setTimeout(this._createSocket,e,t),this._reconnectAttempt+=1}else this._updateConnectionStatus("disconnected");this._clearSocket()}_errorIfDisposed(){if(this.isDisposed)throw new Error("Kernel connection is disposed")}get hasPendingInput(){return this._hasPendingInput}set hasPendingInput(e){this._hasPendingInput=e,this._pendingInput.emit(e)}};Ue.KernelConnection=Mi;var Se;(function(i){function e(r){switch(r.status){case"idle":case"busy":case"unknown":return;default:console.debug(`Kernel: ${r.status} (${r.id})`);break}}i.logKernelStatus=e;async function t(r,a){return r.sendShellMessage(a,!0).done}i.handleShellMessage=t;function n(r,a,o){return new Promise((u,c)=>{if(a){if(typeof requirejs=="undefined")throw new Error("requirejs not found");requirejs([a],d=>{if(d[r]===void 0){let l=`Object '${r}' not found in module '${a}'`;c(new Error(l))}else u(d[r])},c)}else o!=null&&o[r]?u(o[r]):c(new Error(`Object '${r}' not found in registry`))})}i.loadObject=n;function s(r,a){return r=Math.ceil(r),a=Math.floor(a),Math.floor(Math.random()*(a-r+1))+r}i.getRandomIntInclusive=s})(Se||(Se={}))});var Jr=E(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.KernelManager=void 0;var hc=Xe(),Vr=Z(),Wr=Te(),fc=Ye(),mc=wn(),gc=Ei(),_c=vt(),wt=class extends fc.BaseManager{constructor(e={}){var t,n,s;super(e),this._commsOverSubshells=Wr.CommsOverSubshells.PerCommTarget,this._isReady=!1,this._kernelConnections=new Set,this._models=new Map,this._runningChanged=new Vr.Signal(this),this._connectionFailure=new Vr.Signal(this),this._kernelAPIClient=(t=e.kernelAPIClient)!==null&&t!==void 0?t:new mc.KernelAPIClient({serverSettings:this.serverSettings}),this._kernelSpecAPIClient=(n=e.kernelSpecAPIClient)!==null&&n!==void 0?n:new _c.KernelSpecAPIClient({serverSettings:this.serverSettings}),this._pollModels=new hc.Poll({auto:!1,factory:()=>this.requestRunning(),frequency:{interval:10*1e3,backoff:!0,max:300*1e3},name:"@jupyterlab/services:KernelManager#models",standby:(s=e.standby)!==null&&s!==void 0?s:"when-hidden"}),this._ready=(async()=>{await this._pollModels.start(),await this._pollModels.tick,this._isReady=!0})()}get isReady(){return this._isReady}get ready(){return this._ready}get runningChanged(){return this._runningChanged}get connectionFailure(){return this._connectionFailure}dispose(){this.isDisposed||(this._models.clear(),this._kernelConnections.forEach(e=>e.dispose()),this._pollModels.dispose(),super.dispose())}connectTo(e){var t;let{id:n}=e.model,s=(t=e.handleComms)!==null&&t!==void 0?t:!0;if(e.handleComms===void 0){for(let a of this._kernelConnections)if(a.id===n&&a.handleComms){s=!1;break}}e.commsOverSubshells=this._commsOverSubshells;let r=new gc.KernelConnection({handleComms:s,...e,serverSettings:this.serverSettings,kernelAPIClient:this._kernelAPIClient,kernelSpecAPIClient:this._kernelSpecAPIClient});return this._onStarted(r),this._models.has(n)||this.refreshRunning().catch(()=>{}),r}running(){return this._models.values()}get runningCount(){return this._models.size}get commsOverSubshells(){return this._commsOverSubshells}set commsOverSubshells(e){this._commsOverSubshells=e;for(let t of this._kernelConnections)t.commsOverSubshells=e}async refreshRunning(){await this._pollModels.refresh(),await this._pollModels.tick}async startNew(e={},t={}){let n=await this._kernelAPIClient.startNew(e);return this.connectTo({...t,model:n})}async shutdown(e){await this._kernelAPIClient.shutdown(e),await this.refreshRunning()}async shutdownAll(){await this.refreshRunning(),await Promise.all([...this._models.keys()].map(e=>this._kernelAPIClient.shutdown(e))),await this.refreshRunning()}async findById(e){return this._models.has(e)?this._models.get(e):(await this.refreshRunning(),this._models.get(e))}async requestRunning(){var e,t;let n;try{n=await this._kernelAPIClient.listRunning()}catch(s){throw(s instanceof Wr.ServerConnection.NetworkError||((e=s.response)===null||e===void 0?void 0:e.status)===503||((t=s.response)===null||t===void 0?void 0:t.status)===424)&&this._connectionFailure.emit(s),s}this.isDisposed||this._models.size===n.length&&n.every(s=>{let r=this._models.get(s.id);return r?r.connections===s.connections&&r.execution_state===s.execution_state&&r.last_activity===s.last_activity&&r.name===s.name&&r.reason===s.reason&&r.traceback===s.traceback:!1})||(this._models=new Map(n.map(s=>[s.id,s])),this._kernelConnections.forEach(s=>{this._models.has(s.id)||s.handleShutdown()}),this._runningChanged.emit(n))}_onStarted(e){this._kernelConnections.add(e),e.statusChanged.connect(this._onStatusChanged,this),e.disposed.connect(this._onDisposed,this)}_onDisposed(e){this._kernelConnections.delete(e),this.refreshRunning().catch(()=>{})}_onStatusChanged(e,t){t==="dead"&&this.refreshRunning().catch(()=>{})}};bt.KernelManager=wt;(function(i){class e extends i{constructor(){super(...arguments),this._readyPromise=new Promise(()=>{})}get isActive(){return!1}get parentReady(){return super.ready}async startNew(n={},s={}){return Promise.reject(new Error("Not implemented in no-op Kernel Manager"))}connectTo(n){throw new Error("Not implemented in no-op Kernel Manager")}async shutdown(n){return Promise.reject(new Error("Not implemented in no-op Kernel Manager"))}get ready(){return this.parentReady.then(()=>this._readyPromise)}async requestRunning(){return Promise.resolve()}}i.NoopManager=e})(wt||(bt.KernelManager=wt={}))});var Ri=E(H=>{"use strict";var Hr=H&&H.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),vc=H&&H.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),Ii=H&&H.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&Hr(e,i,t);return vc(e,i),e},yc=H&&H.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Hr(e,i,t)};Object.defineProperty(H,"__esModule",{value:!0});H.CommsOverSubshells=H.KernelConnection=H.KernelAPI=H.KernelMessage=H.Kernel=void 0;var wc=Si();Object.defineProperty(H,"CommsOverSubshells",{enumerable:!0,get:function(){return wc.CommsOverSubshells}});var bc=Ii(Pr());H.Kernel=bc;var Sc=Ii(st());H.KernelMessage=Sc;var xc=Ii(wn());H.KernelAPI=xc;var Cc=Ei();Object.defineProperty(H,"KernelConnection",{enumerable:!0,get:function(){return Cc.KernelConnection}});yc(Jr(),H)});var Yr=E(Gr=>{"use strict";Object.defineProperty(Gr,"__esModule",{value:!0})});var Zr=E(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.KernelSpecManager=void 0;var kc=te(),Pc=Xe(),Xr=Z(),Mc=Ye(),Ec=vt(),Oi=class extends Mc.BaseManager{constructor(e={}){var t,n;super(e),this._isReady=!1,this._connectionFailure=new Xr.Signal(this),this._specs=null,this._specsChanged=new Xr.Signal(this),this._kernelSpecAPIClient=(t=e.kernelSpecAPIClient)!==null&&t!==void 0?t:new Ec.KernelSpecAPIClient({serverSettings:this.serverSettings}),this._ready=Promise.all([this.requestSpecs()]).then(s=>{}).catch(s=>{}).then(()=>{this.isDisposed||(this._isReady=!0)}),this._pollSpecs=new Pc.Poll({auto:!1,factory:()=>this.requestSpecs(),frequency:{interval:61*1e3,backoff:!0,max:300*1e3},name:"@jupyterlab/services:KernelSpecManager#specs",standby:(n=e.standby)!==null&&n!==void 0?n:"when-hidden"}),this.ready.then(()=>{this._pollSpecs.start()})}get isReady(){return this._isReady}get ready(){return this._ready}get specs(){return this._specs}get specsChanged(){return this._specsChanged}get connectionFailure(){return this._connectionFailure}dispose(){this._pollSpecs.dispose(),super.dispose()}async refreshSpecs(){await this._pollSpecs.refresh(),await this._pollSpecs.tick}async requestSpecs(){let e=await this._kernelSpecAPIClient.get();this.isDisposed||kc.JSONExt.deepEqual(e,this._specs)||(this._specs=e,this._specsChanged.emit(e))}};xn.KernelSpecManager=Oi});var Di=E(pe=>{"use strict";var Qr=pe&&pe.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),Ic=pe&&pe.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),ea=pe&&pe.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&Qr(e,i,t);return Ic(e,i),e},Rc=pe&&pe.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Qr(e,i,t)};Object.defineProperty(pe,"__esModule",{value:!0});pe.KernelSpecAPI=pe.KernelSpec=void 0;var Oc=ea(Yr());pe.KernelSpec=Oc;var Dc=ea(vt());pe.KernelSpecAPI=Dc;Rc(Zr(),pe)});var ta=E(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});Cn.BuildManager=void 0;var ji=J(),Je=de(),jc="api/build",Ti=class{constructor(e={}){var t;this._url="",this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Je.ServerConnection.makeSettings();let{baseUrl:n,appUrl:s}=this.serverSettings;this._url=ji.URLExt.join(n,s,jc)}get isAvailable(){return ji.PageConfig.getOption("buildAvailable").toLowerCase()==="true"}get shouldCheck(){return ji.PageConfig.getOption("buildCheck").toLowerCase()==="true"}getStatus(){let{_url:e,serverSettings:t}=this;return Je.ServerConnection.makeRequest(e,{},t).then(s=>{if(s.status!==200)throw new Je.ServerConnection.ResponseError(s);return s.json()}).then(s=>{if(typeof s.status!="string")throw new Error("Invalid data");if(typeof s.message!="string")throw new Error("Invalid data");return s})}build(){let{_url:e,serverSettings:t}=this,n={method:"POST"};return Je.ServerConnection.makeRequest(e,n,t).then(r=>{if(r.status===400)throw new Je.ServerConnection.ResponseError(r,"Build aborted");if(r.status!==200){let a=`Build failed with ${r.status}.
|
|
3
|
+
`);else{u=new t(c);let v=d.indexOf(i.CODE_BLOCK_MARKER),_=d.lastIndexOf(i.CODE_BLOCK_MARKER);v!==_&&(u.code=d.substring(v+i.CODE_BLOCK_MARKER.length,_),u.endLine=c,o.push(u),u=null)}}return o}i.findMarkdownCodeBlocks=s})(js||(Yt.MarkdownCodeBlocks=js={}))});var Ns=E((Gd,As)=>{"use strict";function Lo(i,e){var t=i;e.slice(0,-1).forEach(function(s){t=t[s]||{}});var n=e[e.length-1];return n in t}function qs(i){return typeof i=="number"||/^0x[0-9a-f]+$/i.test(i)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(i)}function Us(i,e){return e==="constructor"&&typeof i[e]=="function"||e==="__proto__"}As.exports=function(i,e){e||(e={});var t={bools:{},strings:{},unknownFn:null};typeof e.unknown=="function"&&(t.unknownFn=e.unknown),typeof e.boolean=="boolean"&&e.boolean?t.allBools=!0:[].concat(e.boolean).filter(Boolean).forEach(function(w){t.bools[w]=!0});var n={};function s(w){return n[w].some(function(R){return t.bools[R]})}Object.keys(e.alias||{}).forEach(function(w){n[w]=[].concat(e.alias[w]),n[w].forEach(function(R){n[R]=[w].concat(n[w].filter(function(A){return R!==A}))})}),[].concat(e.string).filter(Boolean).forEach(function(w){t.strings[w]=!0,n[w]&&[].concat(n[w]).forEach(function(R){t.strings[R]=!0})});var r=e.default||{},a={_:[]};function o(w,R){return t.allBools&&/^--[^=]+$/.test(R)||t.strings[w]||t.bools[w]||n[w]}function u(w,R,A){for(var T=w,j=0;j<R.length-1;j++){var U=R[j];if(Us(T,U))return;T[U]===void 0&&(T[U]={}),(T[U]===Object.prototype||T[U]===Number.prototype||T[U]===String.prototype)&&(T[U]={}),T[U]===Array.prototype&&(T[U]=[]),T=T[U]}var h=R[R.length-1];Us(T,h)||((T===Object.prototype||T===Number.prototype||T===String.prototype)&&(T={}),T===Array.prototype&&(T=[]),T[h]===void 0||t.bools[h]||typeof T[h]=="boolean"?T[h]=A:Array.isArray(T[h])?T[h].push(A):T[h]=[T[h],A])}function c(w,R,A){if(!(A&&t.unknownFn&&!o(w,A)&&t.unknownFn(A)===!1)){var T=!t.strings[w]&&qs(R)?Number(R):R;u(a,w.split("."),T),(n[w]||[]).forEach(function(j){u(a,j.split("."),T)})}}Object.keys(t.bools).forEach(function(w){c(w,r[w]===void 0?!1:r[w])});var d=[];i.indexOf("--")!==-1&&(d=i.slice(i.indexOf("--")+1),i=i.slice(0,i.indexOf("--")));for(var l=0;l<i.length;l++){var p=i[l],v,_;if(/^--.+=/.test(p)){var I=p.match(/^--([^=]+)=([\s\S]*)$/);v=I[1];var P=I[2];t.bools[v]&&(P=P!=="false"),c(v,P,p)}else if(/^--no-.+/.test(p))v=p.match(/^--no-(.+)/)[1],c(v,!1,p);else if(/^--.+/.test(p))v=p.match(/^--(.+)/)[1],_=i[l+1],_!==void 0&&!/^(-|--)[^-]/.test(_)&&!t.bools[v]&&!t.allBools&&(!n[v]||!s(v))?(c(v,_,p),l+=1):/^(true|false)$/.test(_)?(c(v,_==="true",p),l+=1):c(v,t.strings[v]?"":!0,p);else if(/^-[^-]+/.test(p)){for(var D=p.slice(1,-1).split(""),q=!1,x=0;x<D.length;x++){if(_=p.slice(x+2),_==="-"){c(D[x],_,p);continue}if(/[A-Za-z]/.test(D[x])&&_[0]==="="){c(D[x],_.slice(1),p),q=!0;break}if(/[A-Za-z]/.test(D[x])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(_)){c(D[x],_,p),q=!0;break}if(D[x+1]&&D[x+1].match(/\W/)){c(D[x],p.slice(x+2),p),q=!0;break}else c(D[x],t.strings[D[x]]?"":!0,p)}v=p.slice(-1)[0],!q&&v!=="-"&&(i[l+1]&&!/^(-|--)[^-]/.test(i[l+1])&&!t.bools[v]&&(!n[v]||!s(v))?(c(v,i[l+1],p),l+=1):i[l+1]&&/^(true|false)$/.test(i[l+1])?(c(v,i[l+1]==="true",p),l+=1):c(v,t.strings[v]?"":!0,p))}else if((!t.unknownFn||t.unknownFn(p)!==!1)&&a._.push(t.strings._||!qs(p)?p:Number(p)),e.stopEarly){a._.push.apply(a._,i.slice(l+1));break}}return Object.keys(r).forEach(function(w){Lo(a,w.split("."))||(u(a,w.split("."),r[w]),(n[w]||[]).forEach(function(R){u(a,R.split("."),r[w])}))}),e["--"]?a["--"]=d.slice():d.forEach(function(w){a._.push(w)}),a}});var Xt=E((Yd,zs)=>{"use strict";function Ie(i){if(typeof i!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(i))}function Ls(i,e){for(var t="",n=0,s=-1,r=0,a,o=0;o<=i.length;++o){if(o<i.length)a=i.charCodeAt(o);else{if(a===47)break;a=47}if(a===47){if(!(s===o-1||r===1))if(s!==o-1&&r===2){if(t.length<2||n!==2||t.charCodeAt(t.length-1)!==46||t.charCodeAt(t.length-2)!==46){if(t.length>2){var u=t.lastIndexOf("/");if(u!==t.length-1){u===-1?(t="",n=0):(t=t.slice(0,u),n=t.length-1-t.lastIndexOf("/")),s=o,r=0;continue}}else if(t.length===2||t.length===1){t="",n=0,s=o,r=0;continue}}e&&(t.length>0?t+="/..":t="..",n=2)}else t.length>0?t+="/"+i.slice(s+1,o):t=i.slice(s+1,o),n=o-s-1;s=o,r=0}else a===46&&r!==-1?++r:r=-1}return t}function zo(i,e){var t=e.dir||e.root,n=e.base||(e.name||"")+(e.ext||"");return t?t===e.root?t+n:t+i+n:n}var nt={resolve:function(){for(var e="",t=!1,n,s=arguments.length-1;s>=-1&&!t;s--){var r;s>=0?r=arguments[s]:(n===void 0&&(n=process.cwd()),r=n),Ie(r),r.length!==0&&(e=r+"/"+e,t=r.charCodeAt(0)===47)}return e=Ls(e,!t),t?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(e){if(Ie(e),e.length===0)return".";var t=e.charCodeAt(0)===47,n=e.charCodeAt(e.length-1)===47;return e=Ls(e,!t),e.length===0&&!t&&(e="."),e.length>0&&n&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return Ie(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var e,t=0;t<arguments.length;++t){var n=arguments[t];Ie(n),n.length>0&&(e===void 0?e=n:e+="/"+n)}return e===void 0?".":nt.normalize(e)},relative:function(e,t){if(Ie(e),Ie(t),e===t||(e=nt.resolve(e),t=nt.resolve(t),e===t))return"";for(var n=1;n<e.length&&e.charCodeAt(n)===47;++n);for(var s=e.length,r=s-n,a=1;a<t.length&&t.charCodeAt(a)===47;++a);for(var o=t.length,u=o-a,c=r<u?r:u,d=-1,l=0;l<=c;++l){if(l===c){if(u>c){if(t.charCodeAt(a+l)===47)return t.slice(a+l+1);if(l===0)return t.slice(a+l)}else r>c&&(e.charCodeAt(n+l)===47?d=l:l===0&&(d=0));break}var p=e.charCodeAt(n+l),v=t.charCodeAt(a+l);if(p!==v)break;p===47&&(d=l)}var _="";for(l=n+d+1;l<=s;++l)(l===s||e.charCodeAt(l)===47)&&(_.length===0?_+="..":_+="/..");return _.length>0?_+t.slice(a+d):(a+=d,t.charCodeAt(a)===47&&++a,t.slice(a))},_makeLong:function(e){return e},dirname:function(e){if(Ie(e),e.length===0)return".";for(var t=e.charCodeAt(0),n=t===47,s=-1,r=!0,a=e.length-1;a>=1;--a)if(t=e.charCodeAt(a),t===47){if(!r){s=a;break}}else r=!1;return s===-1?n?"/":".":n&&s===1?"//":e.slice(0,s)},basename:function(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Ie(e);var n=0,s=-1,r=!0,a;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var o=t.length-1,u=-1;for(a=e.length-1;a>=0;--a){var c=e.charCodeAt(a);if(c===47){if(!r){n=a+1;break}}else u===-1&&(r=!1,u=a+1),o>=0&&(c===t.charCodeAt(o)?--o===-1&&(s=a):(o=-1,s=u))}return n===s?s=u:s===-1&&(s=e.length),e.slice(n,s)}else{for(a=e.length-1;a>=0;--a)if(e.charCodeAt(a)===47){if(!r){n=a+1;break}}else s===-1&&(r=!1,s=a+1);return s===-1?"":e.slice(n,s)}},extname:function(e){Ie(e);for(var t=-1,n=0,s=-1,r=!0,a=0,o=e.length-1;o>=0;--o){var u=e.charCodeAt(o);if(u===47){if(!r){n=o+1;break}continue}s===-1&&(r=!1,s=o+1),u===46?t===-1?t=o:a!==1&&(a=1):t!==-1&&(a=-1)}return t===-1||s===-1||a===0||a===1&&t===s-1&&t===n+1?"":e.slice(t,s)},format:function(e){if(e===null||typeof e!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return zo("/",e)},parse:function(e){Ie(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;var n=e.charCodeAt(0),s=n===47,r;s?(t.root="/",r=1):r=0;for(var a=-1,o=0,u=-1,c=!0,d=e.length-1,l=0;d>=r;--d){if(n=e.charCodeAt(d),n===47){if(!c){o=d+1;break}continue}u===-1&&(c=!1,u=d+1),n===46?a===-1?a=d:l!==1&&(l=1):a!==-1&&(l=-1)}return a===-1||u===-1||l===0||l===1&&a===u-1&&a===o+1?u!==-1&&(o===0&&s?t.base=t.name=e.slice(1,u):t.base=t.name=e.slice(o,u)):(o===0&&s?(t.name=e.slice(1,a),t.base=e.slice(1,u)):(t.name=e.slice(o,a),t.base=e.slice(o,u)),t.ext=e.slice(a,u)),o>0?t.dir=e.slice(0,o-1):s&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};nt.posix=nt;zs.exports=nt});var Ks=E((Xd,Fs)=>{"use strict";Fs.exports=function(e,t){if(t=t.split(":")[0],e=+e,!e)return!1;switch(t){case"http":case"ws":return e!==80;case"https":case"wss":return e!==443;case"ftp":return e!==21;case"gopher":return e!==70;case"file":return!1}return e!==0}});var Vs=E(si=>{"use strict";var Fo=Object.prototype.hasOwnProperty,Ko;function Bs(i){try{return decodeURIComponent(i.replace(/\+/g," "))}catch{return null}}function $s(i){try{return encodeURIComponent(i)}catch{return null}}function Bo(i){for(var e=/([^=?#&]+)=?([^&]*)/g,t={},n;n=e.exec(i);){var s=Bs(n[1]),r=Bs(n[2]);s===null||r===null||s in t||(t[s]=r)}return t}function $o(i,e){e=e||"";var t=[],n,s;typeof e!="string"&&(e="?");for(s in i)if(Fo.call(i,s)){if(n=i[s],!n&&(n===null||n===Ko||isNaN(n))&&(n=""),s=$s(s),n=$s(n),s===null||n===null)continue;t.push(s+"="+n)}return t.length?e+t.join("&"):""}si.stringify=$o;si.parse=Bo});var Qs=E((Qd,Zs)=>{"use strict";var Js=Ks(),Zt=Vs(),Vo=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,Hs=/[\n\r\t]/g,Wo=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,Gs=/:\d+$/,Jo=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,Ho=/^[a-zA-Z]:/;function ai(i){return(i||"").toString().replace(Vo,"")}var ri=[["#","hash"],["?","query"],function(e,t){return Re(t.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],Ws={hash:1,query:1};function Ys(i){var e;typeof window!="undefined"?e=window:typeof global!="undefined"?e=global:typeof self!="undefined"?e=self:e={};var t=e.location||{};i=i||t;var n={},s=typeof i,r;if(i.protocol==="blob:")n=new Oe(unescape(i.pathname),{});else if(s==="string"){n=new Oe(i,{});for(r in Ws)delete n[r]}else if(s==="object"){for(r in i)r in Ws||(n[r]=i[r]);n.slashes===void 0&&(n.slashes=Wo.test(i.href))}return n}function Re(i){return i==="file:"||i==="ftp:"||i==="http:"||i==="https:"||i==="ws:"||i==="wss:"}function Xs(i,e){i=ai(i),i=i.replace(Hs,""),e=e||{};var t=Jo.exec(i),n=t[1]?t[1].toLowerCase():"",s=!!t[2],r=!!t[3],a=0,o;return s?r?(o=t[2]+t[3]+t[4],a=t[2].length+t[3].length):(o=t[2]+t[4],a=t[2].length):r?(o=t[3]+t[4],a=t[3].length):o=t[4],n==="file:"?a>=2&&(o=o.slice(2)):Re(n)?o=t[4]:n?s&&(o=o.slice(2)):a>=2&&Re(e.protocol)&&(o=t[4]),{protocol:n,slashes:s||Re(n),slashesCount:a,rest:o}}function Go(i,e){if(i==="")return e;for(var t=(e||"/").split("/").slice(0,-1).concat(i.split("/")),n=t.length,s=t[n-1],r=!1,a=0;n--;)t[n]==="."?t.splice(n,1):t[n]===".."?(t.splice(n,1),a++):a&&(n===0&&(r=!0),t.splice(n,1),a--);return r&&t.unshift(""),(s==="."||s==="..")&&t.push(""),t.join("/")}function Oe(i,e,t){if(i=ai(i),i=i.replace(Hs,""),!(this instanceof Oe))return new Oe(i,e,t);var n,s,r,a,o,u,c=ri.slice(),d=typeof e,l=this,p=0;for(d!=="object"&&d!=="string"&&(t=e,e=null),t&&typeof t!="function"&&(t=Zt.parse),e=Ys(e),s=Xs(i||"",e),n=!s.protocol&&!s.slashes,l.slashes=s.slashes||n&&e.slashes,l.protocol=s.protocol||e.protocol||"",i=s.rest,(s.protocol==="file:"&&(s.slashesCount!==2||Ho.test(i))||!s.slashes&&(s.protocol||s.slashesCount<2||!Re(l.protocol)))&&(c[3]=[/(.*)/,"pathname"]);p<c.length;p++){if(a=c[p],typeof a=="function"){i=a(i,l);continue}r=a[0],u=a[1],r!==r?l[u]=i:typeof r=="string"?(o=r==="@"?i.lastIndexOf(r):i.indexOf(r),~o&&(typeof a[2]=="number"?(l[u]=i.slice(0,o),i=i.slice(o+a[2])):(l[u]=i.slice(o),i=i.slice(0,o)))):(o=r.exec(i))&&(l[u]=o[1],i=i.slice(0,o.index)),l[u]=l[u]||n&&a[3]&&e[u]||"",a[4]&&(l[u]=l[u].toLowerCase())}t&&(l.query=t(l.query)),n&&e.slashes&&l.pathname.charAt(0)!=="/"&&(l.pathname!==""||e.pathname!=="")&&(l.pathname=Go(l.pathname,e.pathname)),l.pathname.charAt(0)!=="/"&&Re(l.protocol)&&(l.pathname="/"+l.pathname),Js(l.port,l.protocol)||(l.host=l.hostname,l.port=""),l.username=l.password="",l.auth&&(o=l.auth.indexOf(":"),~o?(l.username=l.auth.slice(0,o),l.username=encodeURIComponent(decodeURIComponent(l.username)),l.password=l.auth.slice(o+1),l.password=encodeURIComponent(decodeURIComponent(l.password))):l.username=encodeURIComponent(decodeURIComponent(l.auth)),l.auth=l.password?l.username+":"+l.password:l.username),l.origin=l.protocol!=="file:"&&Re(l.protocol)&&l.host?l.protocol+"//"+l.host:"null",l.href=l.toString()}function Yo(i,e,t){var n=this;switch(i){case"query":typeof e=="string"&&e.length&&(e=(t||Zt.parse)(e)),n[i]=e;break;case"port":n[i]=e,Js(e,n.protocol)?e&&(n.host=n.hostname+":"+e):(n.host=n.hostname,n[i]="");break;case"hostname":n[i]=e,n.port&&(e+=":"+n.port),n.host=e;break;case"host":n[i]=e,Gs.test(e)?(e=e.split(":"),n.port=e.pop(),n.hostname=e.join(":")):(n.hostname=e,n.port="");break;case"protocol":n.protocol=e.toLowerCase(),n.slashes=!t;break;case"pathname":case"hash":if(e){var s=i==="pathname"?"/":"#";n[i]=e.charAt(0)!==s?s+e:e}else n[i]=e;break;case"username":case"password":n[i]=encodeURIComponent(e);break;case"auth":var r=e.indexOf(":");~r?(n.username=e.slice(0,r),n.username=encodeURIComponent(decodeURIComponent(n.username)),n.password=e.slice(r+1),n.password=encodeURIComponent(decodeURIComponent(n.password))):n.username=encodeURIComponent(decodeURIComponent(e))}for(var a=0;a<ri.length;a++){var o=ri[a];o[4]&&(n[o[1]]=n[o[1]].toLowerCase())}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin=n.protocol!=="file:"&&Re(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function Xo(i){(!i||typeof i!="function")&&(i=Zt.stringify);var e,t=this,n=t.host,s=t.protocol;s&&s.charAt(s.length-1)!==":"&&(s+=":");var r=s+(t.protocol&&t.slashes||Re(t.protocol)?"//":"");return t.username?(r+=t.username,t.password&&(r+=":"+t.password),r+="@"):t.password?(r+=":"+t.password,r+="@"):t.protocol!=="file:"&&Re(t.protocol)&&!n&&t.pathname!=="/"&&(r+="@"),(n[n.length-1]===":"||Gs.test(t.hostname)&&!t.port)&&(n+=":"),r+=n+t.pathname,e=typeof t.query=="object"?i(t.query):t.query,e&&(r+=e.charAt(0)!=="?"?"?"+e:e),t.hash&&(r+=t.hash),r}Oe.prototype={set:Yo,toString:Xo};Oe.extractProtocol=Xs;Oe.location=Ys;Oe.trimLeft=ai;Oe.qs=Zt;Zs.exports=Oe});var oi=E(it=>{"use strict";var Zo=it&&it.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(it,"__esModule",{value:!0});it.URLExt=void 0;var Qo=Xt(),Qt=Zo(Qs()),er;(function(i){function e(c){if(typeof document!="undefined"&&document){let d=document.createElement("a");return d.href=c,d}return(0,Qt.default)(c)}i.parse=e;function t(c){return(0,Qt.default)(c).hostname}i.getHostName=t;function n(c){return c&&e(c).toString()}i.normalize=n;function s(...c){let d=(0,Qt.default)(c[0],{}),l=d.protocol===""&&d.slashes;l&&(d=(0,Qt.default)(c[0],"https:"+c[0]));let p=`${l?"":d.protocol}${d.slashes?"//":""}${d.auth}${d.auth?"@":""}${d.host}`,v=Qo.posix.join(`${p&&d.pathname[0]!=="/"?"/":""}${d.pathname}`,...c.slice(1));return`${p}${v==="."?"":v}`}i.join=s;function r(c){return s(...c.split("/").map(encodeURIComponent))}i.encodeParts=r;function a(c){let d=Object.keys(c).filter(l=>l.length>0);return d.length?"?"+d.map(l=>{let p=encodeURIComponent(String(c[l]));return l+(p?"="+p:"")}).join("&"):""}i.objectToQueryString=a;function o(c){return c.replace(/^\?/,"").split("&").reduce((d,l)=>{let[p,v]=l.split("=");return p.length>0&&(d[p]=decodeURIComponent(v||"")),d},{})}i.queryStringToObject=o;function u(c,d=!1){let{protocol:l}=e(c);return(!l||c.toLowerCase().indexOf(l)!==0)&&(d?c.indexOf("//")!==0:c.indexOf("/")!==0)}i.isLocal=u})(er||(it.URLExt=er={}))});var tr=E((exports,module)=>{"use strict";var __importDefault=exports&&exports.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(exports,"__esModule",{value:!0});exports.PageConfig=void 0;var coreutils_1=te(),minimist_1=__importDefault(Ns()),url_1=oi(),PageConfig;(function(PageConfig){function getOption(name){if(configData)return configData[name]||getBodyData(name);configData=Object.create(null);let found=!1;if(typeof document!="undefined"&&document){let i=document.getElementById("jupyter-config-data");i&&(configData=JSON.parse(i.textContent||""),found=!0)}if(!found&&typeof process!="undefined"&&process.argv)try{let cli=(0,minimist_1.default)(process.argv.slice(2)),path=Xt(),fullPath="";"jupyter-config-data"in cli?fullPath=path.resolve(cli["jupyter-config-data"]):"JUPYTER_CONFIG_DATA"in process.env&&(fullPath=path.resolve(process.env.JUPYTER_CONFIG_DATA)),fullPath&&(configData=eval("require")(fullPath))}catch(i){console.error(i)}if(!coreutils_1.JSONExt.isObject(configData))configData=Object.create(null);else for(let i in configData)typeof configData[i]!="string"&&(configData[i]=JSON.stringify(configData[i]));return configData[name]||getBodyData(name)}PageConfig.getOption=getOption;function setOption(i,e){let t=getOption(i);return configData[i]=e,t}PageConfig.setOption=setOption;function getBaseUrl(){return url_1.URLExt.normalize(getOption("baseUrl")||"/")}PageConfig.getBaseUrl=getBaseUrl;function getTreeUrl(){return url_1.URLExt.join(getBaseUrl(),getOption("treeUrl"))}PageConfig.getTreeUrl=getTreeUrl;function getShareUrl(){return url_1.URLExt.normalize(getOption("shareUrl")||getBaseUrl())}PageConfig.getShareUrl=getShareUrl;function getTreeShareUrl(){return url_1.URLExt.normalize(url_1.URLExt.join(getShareUrl(),getOption("treeUrl")))}PageConfig.getTreeShareUrl=getTreeShareUrl;function getUrl(i){var e,t,n,s;let r=i.toShare?getShareUrl():getBaseUrl(),a=(e=i.mode)!==null&&e!==void 0?e:getOption("mode"),o=(t=i.workspace)!==null&&t!==void 0?t:getOption("workspace"),u=a==="single-document"?"doc":"lab";r=url_1.URLExt.join(r,u),o!==PageConfig.defaultWorkspace&&(r=url_1.URLExt.join(r,"workspaces",encodeURIComponent((n=getOption("workspace"))!==null&&n!==void 0?n:PageConfig.defaultWorkspace)));let c=(s=i.treePath)!==null&&s!==void 0?s:getOption("treePath");return c&&(r=url_1.URLExt.join(r,"tree",url_1.URLExt.encodeParts(c))),r}PageConfig.getUrl=getUrl,PageConfig.defaultWorkspace="default";function getWsUrl(i){let e=getOption("wsUrl");if(!e){if(i=i?url_1.URLExt.normalize(i):getBaseUrl(),i.indexOf("http")!==0)return"";e="ws"+i.slice(4)}return url_1.URLExt.normalize(e)}PageConfig.getWsUrl=getWsUrl;function getNBConvertURL({path:i,format:e,download:t}){let n=url_1.URLExt.encodeParts(i),s=url_1.URLExt.join(getBaseUrl(),"nbconvert",e,n);return t?s+"?download=true":s}PageConfig.getNBConvertURL=getNBConvertURL;function getToken(){return getOption("token")||getBodyData("jupyterApiToken")}PageConfig.getToken=getToken;function getNotebookVersion(){let i=getOption("notebookVersion");return i===""?[0,0,0]:JSON.parse(i)}PageConfig.getNotebookVersion=getNotebookVersion;let configData=null;function getBodyData(i){if(typeof document=="undefined"||!document.body)return"";let e=document.body.dataset[i];return typeof e=="undefined"?"":decodeURIComponent(e)}let Extension;(function(i){function e(s){try{let r=getOption(s);if(r)return JSON.parse(r)}catch(r){console.warn(`Unable to parse ${s}.`,r)}return[]}i.deferred=e("deferredExtensions"),i.disabled=e("disabledExtensions");function t(s){let r=s.indexOf(":"),a="";return r!==-1&&(a=s.slice(0,r)),i.deferred.some(o=>o===s||a&&o===a)}i.isDeferred=t;function n(s){let r=s.indexOf(":"),a="";return r!==-1&&(a=s.slice(0,r)),i.disabled.some(o=>o===s||a&&o===a)}i.isDisabled=n})(Extension=PageConfig.Extension||(PageConfig.Extension={}))})(PageConfig||(exports.PageConfig=PageConfig={}))});var ir=E(en=>{"use strict";Object.defineProperty(en,"__esModule",{value:!0});en.PathExt=void 0;var Ke=Xt(),nr;(function(i){function e(...l){let p=Ke.posix.join(...l);return p==="."?"":d(p)}i.join=e;function t(...l){let p=Ke.posix.join(...l);return p==="."?"":p}i.joinWithLeadingSlash=t;function n(l,p){return Ke.posix.basename(l,p)}i.basename=n;function s(l){let p=d(Ke.posix.dirname(l));return p==="."?"":p}i.dirname=s;function r(l){return Ke.posix.extname(l)}i.extname=r;function a(l){return l===""?"":d(Ke.posix.normalize(l))}i.normalize=a;function o(...l){return d(Ke.posix.resolve(...l))}i.resolve=o;function u(l,p){return d(Ke.posix.relative(l,p))}i.relative=u;function c(l){return l.length>0&&l.indexOf(".")!==0&&(l=`.${l}`),l}i.normalizeExtension=c;function d(l){return l.indexOf("/")===0&&(l=l.slice(1)),l}i.removeSlash=d})(nr||(en.PathExt=nr={}))});var sr=E(li=>{"use strict";Object.defineProperty(li,"__esModule",{value:!0});li.signalToPromise=tl;var el=te();function tl(i,e){let t=new el.PromiseDelegate;function n(){i.disconnect(s)}function s(r,a){n(),t.resolve([r,a])}return i.connect(s),(e!=null?e:0)>0&&setTimeout(()=>{n(),t.reject(`Signal not emitted within ${e} ms.`)},e),t.promise}});var ar=E(tn=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0});tn.Text=void 0;var rr;(function(i){let e=2>1;function t(a,o){if(e)return a;let u=a;for(let c=0;c+1<o.length&&c<a;c++){let d=o.charCodeAt(c);if(d>=55296&&d<=56319){let l=o.charCodeAt(c+1);l>=56320&&l<=57343&&(u--,c++)}}return u}i.jsIndexToCharIndex=t;function n(a,o){if(e)return a;let u=a;for(let c=0;c+1<o.length&&c<u;c++){let d=o.charCodeAt(c);if(d>=55296&&d<=56319){let l=o.charCodeAt(c+1);l>=56320&&l<=57343&&(u++,c++)}}return u}i.charIndexToJsIndex=n;function s(a,o=!1){return a.replace(/^(\w)|[\s-_:]+(\w)/g,function(u,c,d){return d?d.toUpperCase():o?c.toUpperCase():c.toLowerCase()})}i.camelCase=s;function r(a){return(a||"").toLowerCase().split(" ").map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" ")}i.titleCase=r})(rr||(tn.Text=rr={}))});var lr=E(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.Time=void 0;var nl=[{name:"years",milliseconds:365*24*60*60*1e3},{name:"months",milliseconds:30*24*60*60*1e3},{name:"days",milliseconds:24*60*60*1e3},{name:"hours",milliseconds:60*60*1e3},{name:"minutes",milliseconds:60*1e3},{name:"seconds",milliseconds:1e3}],or;(function(i){function e(n,s="long"){let r=document.documentElement.lang||"en",a=new Intl.RelativeTimeFormat(r,{numeric:"auto",style:s}),o=new Date(n).getTime()-Date.now();for(let u of nl){let c=Math.ceil(o/u.milliseconds);if(c!==0)return a.format(c,u.name)}return a.format(0,"seconds")}i.formatHuman=e;function t(n){let s=document.documentElement.lang||"en";return new Intl.DateTimeFormat(s,{dateStyle:"short",timeStyle:"short"}).format(new Date(n))}i.format=t})(or||(nn.Time=or={}))});var J=E(ae=>{"use strict";var il=ae&&ae.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),De=ae&&ae.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&il(e,i,t)};Object.defineProperty(ae,"__esModule",{value:!0});De(Is(),ae);De(Os(),ae);De(Ds(),ae);De(Ts(),ae);De(tr(),ae);De(ir(),ae);De(sr(),ae);De(ar(),ae);De(lr(),ae);De(oi(),ae)});var st=E(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});B.supportedKernelWebSocketProtocols=void 0;B.createMessage=rl;B.isStreamMsg=al;B.isDisplayDataMsg=ol;B.isUpdateDisplayDataMsg=ll;B.isExecuteInputMsg=cl;B.isExecuteResultMsg=dl;B.isErrorMsg=ul;B.isStatusMsg=pl;B.isClearOutputMsg=hl;B.isDebugEventMsg=fl;B.isCommOpenMsg=ml;B.isCommCloseMsg=gl;B.isCommMsgMsg=_l;B.isInfoRequestMsg=vl;B.isExecuteReplyMsg=yl;B.isDebugRequestMsg=wl;B.isDebugReplyMsg=bl;B.isInputRequestMsg=Sl;B.isInputReplyMsg=xl;var sl=te();function rl(i){var e,t,n,s,r,a;return{buffers:(e=i.buffers)!==null&&e!==void 0?e:[],channel:i.channel,content:i.content,header:{date:new Date().toISOString(),msg_id:(t=i.msgId)!==null&&t!==void 0?t:sl.UUID.uuid4(),msg_type:i.msgType,session:i.session,username:(n=i.username)!==null&&n!==void 0?n:"",subshell_id:(s=i.subshellId)!==null&&s!==void 0?s:null,version:"5.2"},metadata:(r=i.metadata)!==null&&r!==void 0?r:{},parent_header:(a=i.parentHeader)!==null&&a!==void 0?a:{}}}function al(i){return i.header.msg_type==="stream"}function ol(i){return i.header.msg_type==="display_data"}function ll(i){return i.header.msg_type==="update_display_data"}function cl(i){return i.header.msg_type==="execute_input"}function dl(i){return i.header.msg_type==="execute_result"}function ul(i){return i.header.msg_type==="error"}function pl(i){return i.header.msg_type==="status"}function hl(i){return i.header.msg_type==="clear_output"}function fl(i){return i.header.msg_type==="debug_event"}function ml(i){return i.header.msg_type==="comm_open"}function gl(i){return i.header.msg_type==="comm_close"}function _l(i){return i.header.msg_type==="comm_msg"}function vl(i){return i.header.msg_type==="kernel_info_request"}function yl(i){return i.header.msg_type==="execute_reply"}function wl(i){return i.header.msg_type==="debug_request"}function bl(i){return i.header.msg_type==="debug_reply"}function Sl(i){return i.header.msg_type==="input_request"}function xl(i){return i.header.msg_type==="input_reply"}var cr;(function(i){i.v1KernelWebsocketJupyterOrg="v1.kernel.websocket.jupyter.org"})(cr||(B.supportedKernelWebSocketProtocols=cr={}))});var ur=E(je=>{"use strict";var Cl=je&&je.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),kl=je&&je.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),Pl=je&&je.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&Cl(e,i,t);return kl(e,i),e};Object.defineProperty(je,"__esModule",{value:!0});je.serialize=Ml;je.deserialize=El;var dr=Pl(st());function Ml(i,e=""){switch(e){case dr.supportedKernelWebSocketProtocols.v1KernelWebsocketJupyterOrg:return rt.serializeV1KernelWebsocketJupyterOrg(i);default:return rt.serializeDefault(i)}}function El(i,e=""){switch(e){case dr.supportedKernelWebSocketProtocols.v1KernelWebsocketJupyterOrg:return rt.deserializeV1KernelWebsocketJupyterOrg(i);default:return rt.deserializeDefault(i)}}var rt;(function(i){function e(o){let u,c=new DataView(o),d=Number(c.getBigUint64(0,!0)),l=[];for(let x=0;x<d;x++)l.push(Number(c.getBigUint64(8*(x+1),!0)));let p=new TextDecoder("utf8"),v=p.decode(o.slice(l[0],l[1])),_=JSON.parse(p.decode(o.slice(l[1],l[2]))),I=JSON.parse(p.decode(o.slice(l[2],l[3]))),P=JSON.parse(p.decode(o.slice(l[3],l[4]))),D=JSON.parse(p.decode(o.slice(l[4],l[5]))),q=[];for(let x=5;x<l.length-1;x++)q.push(new DataView(o.slice(l[x],l[x+1])));return u={channel:v,header:_,parent_header:I,metadata:P,content:D,buffers:q},u}i.deserializeV1KernelWebsocketJupyterOrg=e;function t(o){let u=JSON.stringify(o.header),c=o.parent_header==null?"{}":JSON.stringify(o.parent_header),d=JSON.stringify(o.metadata),l=JSON.stringify(o.content),p=o.buffers!==void 0?o.buffers:[],v=5+p.length+1,_=[];_.push(8*(1+v)),_.push(o.channel.length+_[_.length-1]);let I=new TextEncoder,P=I.encode(o.channel),D=I.encode(u),q=I.encode(c),x=I.encode(d),w=I.encode(l),R=new Uint8Array(P.length+D.length+q.length+x.length+w.length);R.set(P),R.set(D,P.length),R.set(q,P.length+D.length),R.set(x,P.length+D.length+q.length),R.set(w,P.length+D.length+q.length+x.length);for(let h of[D.length,q.length,x.length,w.length])_.push(h+_[_.length-1]);let A=0;for(let h of p){let y=h.byteLength;_.push(y+_[_.length-1]),A+=y}let T=new Uint8Array(8*(1+v)+R.byteLength+A),j=new ArrayBuffer(8),U=new DataView(j);U.setBigUint64(0,BigInt(v),!0),T.set(new Uint8Array(j),0);for(let h=0;h<_.length;h++)U.setBigUint64(0,BigInt(_[h]),!0),T.set(new Uint8Array(j),8*(h+1));T.set(R,_[0]);for(let h=0;h<p.length;h++){let y=p[h];T.set(new Uint8Array(ArrayBuffer.isView(y)?y.buffer:y),_[5+h])}return T.buffer}i.serializeV1KernelWebsocketJupyterOrg=t;function n(o){let u;return typeof o=="string"?u=JSON.parse(o):u=r(o),u}i.deserializeDefault=n;function s(o){var u;let c;return!((u=o.buffers)===null||u===void 0)&&u.length?c=a(o):c=JSON.stringify(o),c}i.serializeDefault=s;function r(o){let u=new DataView(o),c=u.getUint32(0),d=[];if(c<2)throw new Error("Invalid incoming Kernel Message");for(let v=1;v<=c;v++)d.push(u.getUint32(v*4));let l=new Uint8Array(o.slice(d[0],d[1])),p=JSON.parse(new TextDecoder("utf8").decode(l));p.buffers=[];for(let v=1;v<c;v++){let _=d[v],I=d[v+1]||o.byteLength;p.buffers.push(new DataView(o.slice(_,I)))}return p}function a(o){let u=[],c=[],d=new TextEncoder,l=[];o.buffers!==void 0&&(l=o.buffers,delete o.buffers);let p=d.encode(JSON.stringify(o));c.push(p.buffer);for(let P=0;P<l.length;P++){let D=l[P];c.push(ArrayBuffer.isView(D)?D.buffer:D)}let v=c.length;u.push(4*(v+1));for(let P=0;P+1<c.length;P++)u.push(u[u.length-1]+c[P].byteLength);let _=new Uint8Array(u[u.length-1]+c[c.length-1].byteLength),I=new DataView(_.buffer);I.setUint32(0,v);for(let P=0;P<u.length;P++)I.setUint32(4*(P+1),u[P]);for(let P=0;P<c.length;P++)_.set(new Uint8Array(c[P]),u[P]);return _.buffer}})(rt||(rt={}))});var pr=E(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});ci.default=WebSocket});var de=E(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.ServerConnection=void 0;var Be=J(),hr=ur(),di;typeof window=="undefined"?di=pr():di=WebSocket;var ui;(function(i){function e(r){return sn.makeSettings(r)}i.makeSettings=e;function t(r,a,o){return sn.handleRequest(r,a,o)}i.makeRequest=t;class n extends Error{static async create(a){try{let o=await a.json(),{message:u,traceback:c}=o;return c&&console.error(c),new n(a,u!=null?u:n._defaultMessage(a),c!=null?c:"")}catch(o){return console.debug(o),new n(a)}}constructor(a,o=n._defaultMessage(a),u=""){super(o),this.response=a,this.traceback=u}static _defaultMessage(a){return`Invalid response: ${a.status} ${a.statusText}`}}i.ResponseError=n;class s extends TypeError{constructor(a){super(a.message),this.stack=a.stack}}i.NetworkError=s})(ui||(rn.ServerConnection=ui={}));var sn;(function(i){function e(s={}){var r;let a=Be.PageConfig.getBaseUrl(),o=Be.PageConfig.getWsUrl(),u=Be.URLExt.normalize(s.baseUrl)||a,c=s.wsUrl;!c&&u===a&&(c=o),!c&&u.indexOf("http")===0&&(c="ws"+u.slice(4)),c=c!=null?c:o;let d=Be.PageConfig.getOption("appendToken").toLowerCase(),l;return d===""?l=typeof window=="undefined"||typeof process!="undefined"&&((r=process==null?void 0:process.env)===null||r===void 0?void 0:r.JEST_WORKER_ID)!==void 0||Be.URLExt.getHostName(a)!==Be.URLExt.getHostName(c):l=d==="true",{init:{cache:"no-store",credentials:"same-origin"},fetch,Headers,Request,WebSocket:di,token:Be.PageConfig.getToken(),appUrl:Be.PageConfig.getOption("appUrl"),appendToken:l,serializer:{serialize:hr.serialize,deserialize:hr.deserialize},...s,baseUrl:u,wsUrl:c}}i.makeSettings=e;function t(s,r,a){var o;if(s.indexOf(a.baseUrl)!==0)throw new Error("Can only be used for notebook server requests");((o=r.cache)!==null&&o!==void 0?o:a.init.cache)==="no-store"&&(s+=(/\?/.test(s)?"&":"?")+new Date().getTime());let c=new a.Request(s,{...a.init,...r}),d=!1;if(a.token&&(d=!0,c.headers.append("Authorization",`token ${a.token}`)),typeof document!="undefined"){let l=n("_xsrf");l!==void 0&&(d=!0,c.headers.append("X-XSRFToken",l))}return!c.headers.has("Content-Type")&&d&&c.headers.set("Content-Type","application/json"),a.fetch.call(null,c).catch(l=>{throw new ui.NetworkError(l)})}i.handleRequest=t;function n(s){let r="";try{r=document.cookie}catch{return}let a=r.match("\\b"+s+"=([^;]*)\\b");return a==null?void 0:a[1]}})(sn||(sn={}))});var Ye=E(an=>{"use strict";Object.defineProperty(an,"__esModule",{value:!0});an.BaseManager=void 0;var fr=Z(),Il=de(),pi=class{constructor(e){var t;this._isDisposed=!1,this._disposed=new fr.Signal(this),this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Il.ServerConnection.makeSettings()}get disposed(){return this._disposed}get isDisposed(){return this._isDisposed}get isActive(){return!0}dispose(){this.isDisposed||(this._isDisposed=!0,this._disposed.emit(void 0),fr.Signal.clearData(this))}};an.BaseManager=pi});var gr=E($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.ConfigWithDefaults=$e.ConfigSection=$e.ConfigSectionManager=void 0;var Rl=J(),at=Te(),Ol="api/config",hi=class{constructor(e){var t;this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:at.ServerConnection.makeSettings()}async create(e){let t=new on({...e,serverSettings:this.serverSettings});return await t.load(),t}};$e.ConfigSectionManager=hi;var mr;(function(i){async function e(s){if(!t){let a=new on(s);return await a.load(),a}return await t.create(s)}i.create=e;let t;function n(s){if(t)throw new Error("ConfigSectionManager already set. If you would like to create a config section, use the `IConfigSectionManager` token in a plugin.");t=s}i._setConfigSectionManager=n})(mr||($e.ConfigSection=mr={}));var on=class{constructor(e){var t;this._url="unknown";let n=this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:at.ServerConnection.makeSettings();this._url=Rl.URLExt.join(n.baseUrl,Ol,encodeURIComponent(e.name))}get data(){return this._data}async load(){let e=await at.ServerConnection.makeRequest(this._url,{},this.serverSettings);if(e.status!==200)throw await at.ServerConnection.ResponseError.create(e);this._data=await e.json()}async update(e){this._data={...this._data,...e};let t={method:"PATCH",body:JSON.stringify(e)},n=await at.ServerConnection.makeRequest(this._url,t,this.serverSettings);if(n.status!==200)throw await at.ServerConnection.ResponseError.create(n);return this._data=await n.json(),this._data}},fi=class{constructor(e){var t,n;this._className="",this._section=e.section,this._defaults=(t=e.defaults)!==null&&t!==void 0?t:{},this._className=(n=e.className)!==null&&n!==void 0?n:""}get(e){let t=this._classData();return e in t?t[e]:this._defaults[e]}set(e,t){let n={};if(n[e]=t,this._className){let s={};return s[this._className]=n,this._section.update(s)}else return this._section.update(n)}_classData(){let e=this._section.data;return this._className&&this._className in e?e[this._className]:e}};$e.ConfigWithDefaults=fi});var _r=E(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});ln.ConnectionStatus=void 0;var mi=class{constructor(){this.isConnected=!0}};ln.ConnectionStatus=mi});var dn=E((cn,vr)=>{(function(i,e){typeof cn=="object"&&typeof vr!="undefined"?e(cn,Z()):typeof define=="function"&&define.amd?define(["exports","@lumino/signaling"],e):(i=typeof globalThis!="undefined"?globalThis:i||self,e(i.lumino_disposable={},i.lumino_signaling))})(cn,function(i,e){"use strict";class t{constructor(o){this._fn=o}get isDisposed(){return!this._fn}dispose(){if(!this._fn)return;let o=this._fn;this._fn=null,o()}}class n extends t{constructor(){super(...arguments),this._disposed=new e.Signal(this)}get disposed(){return this._disposed}dispose(){this.isDisposed||(super.dispose(),this._disposed.emit(void 0),e.Signal.clearData(this))}}class s{constructor(){this._isDisposed=!1,this._items=new Set}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed||(this._isDisposed=!0,this._items.forEach(o=>{o.dispose()}),this._items.clear())}contains(o){return this._items.has(o)}add(o){this._items.add(o)}remove(o){this._items.delete(o)}clear(){this._items.clear()}}(function(a){function o(u){let c=new a;for(let d of u)c.add(d);return c}a.from=o})(s||(s={}));class r extends s{constructor(){super(...arguments),this._disposed=new e.Signal(this)}get disposed(){return this._disposed}dispose(){this.isDisposed||(super.dispose(),this._disposed.emit(void 0),e.Signal.clearData(this))}}(function(a){function o(u){let c=new a;for(let d of u)c.add(d);return c}a.from=o})(r||(r={})),i.DisposableDelegate=t,i.DisposableSet=s,i.ObservableDisposableDelegate=n,i.ObservableDisposableSet=r})});var ht=E(gi=>{"use strict";Object.defineProperty(gi,"__esModule",{value:!0});gi.validateProperty=Dl;function Dl(i,e,t,n=[]){if(!i.hasOwnProperty(e))throw Error(`Missing property '${e}'`);let s=i[e];if(t!==void 0){let r=!0;switch(t){case"array":r=Array.isArray(s);break;case"object":r=typeof s!="undefined";break;default:r=typeof s===t}if(!r)throw new Error(`Property '${e}' is not of type '${t}'`);if(n.length>0){let a=!0;switch(t){case"string":case"number":case"boolean":a=n.includes(s);break;default:a=n.findIndex(o=>o===s)>=0;break}if(!a)throw new Error(`Property '${e}' is not one of the valid values ${JSON.stringify(n)}`)}}}});var yr=E(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.validateContentsModel=jl;un.validateCheckpointModel=Tl;var qe=ht();function jl(i){(0,qe.validateProperty)(i,"name","string"),(0,qe.validateProperty)(i,"path","string"),(0,qe.validateProperty)(i,"type","string"),(0,qe.validateProperty)(i,"created","string"),(0,qe.validateProperty)(i,"last_modified","string"),(0,qe.validateProperty)(i,"mimetype","object"),(0,qe.validateProperty)(i,"content","object"),(0,qe.validateProperty)(i,"format","object")}function Tl(i){(0,qe.validateProperty)(i,"id","string"),(0,qe.validateProperty)(i,"last_modified","string")}});var wi=E(oe=>{"use strict";var ql=oe&&oe.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),Ul=oe&&oe.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),Al=oe&&oe.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&ql(e,i,t);return Ul(e,i),e};Object.defineProperty(oe,"__esModule",{value:!0});oe.RestContentProvider=oe.Drive=oe.ContentsManager=oe.Contents=void 0;var ue=J(),Nl=dn(),ft=Z(),V=Te(),Fe=Al(yr()),Ll="api/contents",zl="files",wr;(function(i){function e(n){Fe.validateContentsModel(n)}i.validateContentsModel=e;function t(n){Fe.validateCheckpointModel(n)}i.validateCheckpointModel=t})(wr||(oe.Contents=wr={}));var _i=class{constructor(e={}){var t,n;this._isDisposed=!1,this._additionalDrives=new Map,this._fileChanged=new ft.Signal(this);let s=this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:V.ServerConnection.makeSettings();this._defaultDrive=(n=e.defaultDrive)!==null&&n!==void 0?n:new pn({serverSettings:s}),this._defaultDrive.fileChanged.connect(this._onFileChanged,this)}get defaultDrive(){return this._defaultDrive}get fileChanged(){return this._fileChanged}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,ft.Signal.clearData(this))}addDrive(e){this._additionalDrives.set(e.name,e),e.fileChanged.connect(this._onFileChanged,this)}getSharedModelFactory(e,t){var n,s;let[r]=this._driveForPath(e),a=(n=r.contentProviderRegistry)===null||n===void 0?void 0:n.getProvider(t==null?void 0:t.contentProviderId);return a!=null&&a.sharedModelFactory?a.sharedModelFactory:(s=r.sharedModelFactory)!==null&&s!==void 0?s:null}localPath(e){let t=e.split("/"),n=t[0].split(":");return n.length===1||!this._additionalDrives.has(n[0])?ue.PathExt.removeSlash(e):ue.PathExt.join(n.slice(1).join(":"),...t.slice(1))}normalize(e){let t=e.split(":");return t.length===1?ue.PathExt.normalize(e):`${t[0]}:${ue.PathExt.normalize(t.slice(1).join(":"))}`}resolvePath(e,t){let n=this.driveName(e),s=this.localPath(e),r=ue.PathExt.resolve("/",s,t);return n?`${n}:${r}`:r}driveName(e){let n=e.split("/")[0].split(":");return n.length===1?"":this._additionalDrives.has(n[0])?n[0]:""}get(e,t){let[n,s]=this._driveForPath(e);return n.get(s,t).then(r=>{let a=[];if(r.type==="directory"&&r.content){for(let o of r.content)a.push({...o,path:this._toGlobalPath(n,o.path)});return{...r,path:this._toGlobalPath(n,s),content:a,serverPath:r.path}}else return{...r,path:this._toGlobalPath(n,s),serverPath:r.path}})}getDownloadUrl(e){let[t,n]=this._driveForPath(e);return t.getDownloadUrl(n)}newUntitled(e={}){if(e.path){let t=this.normalize(e.path),[n,s]=this._driveForPath(t);return n.newUntitled({...e,path:s}).then(r=>({...r,path:ue.PathExt.join(t,r.name),serverPath:r.path}))}else return this._defaultDrive.newUntitled(e)}delete(e){let[t,n]=this._driveForPath(e);return t.delete(n)}rename(e,t){let[n,s]=this._driveForPath(e),[r,a]=this._driveForPath(t);if(n!==r)throw Error("ContentsManager: renaming files must occur within a Drive");return n.rename(s,a).then(o=>({...o,path:this._toGlobalPath(n,a),serverPath:o.path}))}save(e,t={}){let n=this.normalize(e),[s,r]=this._driveForPath(e);return s.save(r,{...t,path:r}).then(a=>({...a,path:n,serverPath:a.path}))}copy(e,t){let[n,s]=this._driveForPath(e),[r,a]=this._driveForPath(t);if(n===r)return n.copy(s,a).then(o=>({...o,path:this._toGlobalPath(n,o.path),serverPath:o.path}));throw Error("Copying files between drives is not currently implemented")}createCheckpoint(e){let[t,n]=this._driveForPath(e);return t.createCheckpoint(n)}listCheckpoints(e){let[t,n]=this._driveForPath(e);return t.listCheckpoints(n)}restoreCheckpoint(e,t){let[n,s]=this._driveForPath(e);return n.restoreCheckpoint(s,t)}deleteCheckpoint(e,t){let[n,s]=this._driveForPath(e);return n.deleteCheckpoint(s,t)}_toGlobalPath(e,t){return e===this._defaultDrive?ue.PathExt.removeSlash(t):`${e.name}:${ue.PathExt.removeSlash(t)}`}_driveForPath(e){let t=this.driveName(e),n=this.localPath(e);return t?[this._additionalDrives.get(t),n]:[this._defaultDrive,n]}_onFileChanged(e,t){var n,s;if(e===this._defaultDrive)this._fileChanged.emit(t);else{let r=null,a=null;!((n=t.newValue)===null||n===void 0)&&n.path&&(r={...t.newValue,path:this._toGlobalPath(e,t.newValue.path)}),!((s=t.oldValue)===null||s===void 0)&&s.path&&(a={...t.oldValue,path:this._toGlobalPath(e,t.oldValue.path)}),this._fileChanged.emit({type:t.type,newValue:r,oldValue:a})}}};oe.ContentsManager=_i;var pn=class{constructor(e={}){var t,n,s;this._isDisposed=!1,this._fileChanged=new ft.Signal(this),this.name=(t=e.name)!==null&&t!==void 0?t:"Default",this._apiEndpoint=(n=e.apiEndpoint)!==null&&n!==void 0?n:Ll,this.serverSettings=(s=e.serverSettings)!==null&&s!==void 0?s:V.ServerConnection.makeSettings();let r=new hn({apiEndpoint:this._apiEndpoint,serverSettings:this.serverSettings});this.contentProviderRegistry=new yi({defaultProvider:r}),this.contentProviderRegistry.fileChanged.connect((a,o)=>{this._fileChanged.emit(o)})}get fileChanged(){return this._fileChanged}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,ft.Signal.clearData(this))}async get(e,t){return this.contentProviderRegistry.getProvider(t==null?void 0:t.contentProviderId).get(e,t)}getDownloadUrl(e){let t=this.serverSettings.baseUrl,n=ue.URLExt.join(t,zl,ue.URLExt.encodeParts(e)),s="";try{s=document.cookie}catch{}let r=s.match("\\b_xsrf=([^;]*)\\b");if(r){let a=new URL(n);a.searchParams.append("_xsrf",r[1]),n=a.toString()}return Promise.resolve(n)}async newUntitled(e={}){var t;let n="{}";e&&(e.ext&&(e.ext=vi.normalizeExtension(e.ext)),n=JSON.stringify(e));let s=this.serverSettings,r=this._getUrl((t=e.path)!==null&&t!==void 0?t:""),a={method:"POST",body:n},o=await V.ServerConnection.makeRequest(r,a,s);if(o.status!==201)throw await V.ServerConnection.ResponseError.create(o);let u=await o.json();return Fe.validateContentsModel(u),this._fileChanged.emit({type:"new",oldValue:null,newValue:u}),u}async delete(e){let t=this._getUrl(e),n=this.serverSettings,s={method:"DELETE"},r=await V.ServerConnection.makeRequest(t,s,n);if(r.status!==204)throw await V.ServerConnection.ResponseError.create(r);this._fileChanged.emit({type:"delete",oldValue:{path:e},newValue:null})}async rename(e,t){let n=this.serverSettings,s=this._getUrl(e),r={method:"PATCH",body:JSON.stringify({path:t})},a=await V.ServerConnection.makeRequest(s,r,n);if(a.status!==200)throw await V.ServerConnection.ResponseError.create(a);let o=await a.json();return Fe.validateContentsModel(o),this._fileChanged.emit({type:"rename",oldValue:{path:e},newValue:o}),o}async save(e,t={}){let s=await this.contentProviderRegistry.getProvider(t==null?void 0:t.contentProviderId).save(e,t);return this._fileChanged.emit({type:"save",oldValue:null,newValue:s}),s}async copy(e,t){let n=this.serverSettings,s=this._getUrl(t),r={method:"POST",body:JSON.stringify({copy_from:e})},a=await V.ServerConnection.makeRequest(s,r,n);if(a.status!==201)throw await V.ServerConnection.ResponseError.create(a);let o=await a.json();return Fe.validateContentsModel(o),this._fileChanged.emit({type:"new",oldValue:null,newValue:o}),o}async createCheckpoint(e){let t=this._getUrl(e,"checkpoints"),n={method:"POST"},s=await V.ServerConnection.makeRequest(t,n,this.serverSettings);if(s.status!==201)throw await V.ServerConnection.ResponseError.create(s);let r=await s.json();return Fe.validateCheckpointModel(r),r}async listCheckpoints(e){let t=this._getUrl(e,"checkpoints"),n=await V.ServerConnection.makeRequest(t,{},this.serverSettings);if(n.status!==200)throw await V.ServerConnection.ResponseError.create(n);let s=await n.json();if(!Array.isArray(s))throw new Error("Invalid Checkpoint list");for(let r=0;r<s.length;r++)Fe.validateCheckpointModel(s[r]);return s}async restoreCheckpoint(e,t){let n=this._getUrl(e,"checkpoints",t),s={method:"POST"},r=await V.ServerConnection.makeRequest(n,s,this.serverSettings);if(r.status!==204)throw await V.ServerConnection.ResponseError.create(r)}async deleteCheckpoint(e,t){let n=this._getUrl(e,"checkpoints",t),s={method:"DELETE"},r=await V.ServerConnection.makeRequest(n,s,this.serverSettings);if(r.status!==204)throw await V.ServerConnection.ResponseError.create(r)}_getUrl(...e){let t=e.map(s=>ue.URLExt.encodeParts(s)),n=this.serverSettings.baseUrl;return ue.URLExt.join(n,this._apiEndpoint,...t)}};oe.Drive=pn;var vi;(function(i){function e(t){return t.length>0&&t.indexOf(".")!==0&&(t=`.${t}`),t}i.normalizeExtension=e})(vi||(vi={}));var yi=class{constructor(e){this._providers=new Map,this._fileChanged=new ft.Signal(this),this.register("default",e.defaultProvider),this._defaultProvider=e.defaultProvider}register(e,t){if(this._providers.has(e))throw Error(`Provider with ${e} identifier was already registered on this drive`);this._providers.set(e,t);let n=(s,r)=>{this._fileChanged.emit(r)};return t.fileChanged&&t.fileChanged.connect(n),new Nl.DisposableDelegate(()=>{t.fileChanged&&t.fileChanged.disconnect(n),this._providers.has(e)&&this._providers.delete(e)})}getProvider(e){if(!e)return this._defaultProvider;let t=this._providers.get(e);if(!t)throw Error(`Provider ${e} is not registered`);return t}get fileChanged(){return this._fileChanged}},hn=class{constructor(e){this._options=e}async get(e,t){let n=this._getUrl(e);if(t){t.type==="notebook"&&delete t.format;let o=t.content?"1":"0",u=t.hash?"1":"0",c={...t,content:o,hash:u};n+=ue.URLExt.objectToQueryString(c)}let s=this._options.serverSettings,r=await V.ServerConnection.makeRequest(n,{},s);if(r.status!==200)throw await V.ServerConnection.ResponseError.create(r);let a=await r.json();return Fe.validateContentsModel(a),a}async save(e,t={}){let n=this._options.serverSettings,s=this._getUrl(e),a={method:"PUT",body:new File([JSON.stringify(t)],"data.json",{type:"application/json"})},o=await V.ServerConnection.makeRequest(s,a,n);if(o.status!==200&&o.status!==201)throw await V.ServerConnection.ResponseError.create(o);let u=await o.json();return Fe.validateContentsModel(u),u}_getUrl(...e){let t=e.map(s=>ue.URLExt.encodeParts(s)),n=this._options.serverSettings.baseUrl;return ue.URLExt.join(n,this._options.apiEndpoint,...t)}};oe.RestContentProvider=hn});var Xe=E((fn,br)=>{(function(i,e){typeof fn=="object"&&typeof br!="undefined"?e(fn,te(),Z()):typeof define=="function"&&define.amd?define(["exports","@lumino/coreutils","@lumino/signaling"],e):(i=typeof globalThis!="undefined"?globalThis:i||self,e(i.lumino_polling={},i.lumino_coreutils,i.lumino_signaling))})(fn,function(i,e,t){"use strict";class n{constructor(c){var d;this._disposed=new t.Signal(this),this._lingered=0,this._tick=new e.PromiseDelegate,this._ticked=new t.Signal(this),this._factory=c.factory,this._linger=(d=c.linger)!==null&&d!==void 0?d:s.DEFAULT_LINGER,this._standby=c.standby||s.DEFAULT_STANDBY,this._state={...s.DEFAULT_STATE,timestamp:new Date().getTime()};let l=c.frequency||{},p=Math.max(l.interval||0,l.max||0,s.DEFAULT_FREQUENCY.max);this.frequency={...s.DEFAULT_FREQUENCY,...l,max:p},this.name=c.name||s.DEFAULT_NAME,(!("auto"in c)||c.auto)&&setTimeout(()=>this.start())}get disposed(){return this._disposed}get frequency(){return this._frequency}set frequency(c){if(this.isDisposed||e.JSONExt.deepEqual(c,this.frequency||{}))return;let{backoff:d,interval:l,max:p}=c;if(l=Math.round(l),p=Math.round(p),typeof d=="number"&&d<1)throw new Error("Poll backoff growth factor must be at least 1");if((l<0||l>p)&&l!==n.NEVER)throw new Error("Poll interval must be between 0 and max");if(p>n.MAX_INTERVAL&&p!==n.NEVER)throw new Error(`Max interval must be less than ${n.MAX_INTERVAL}`);this._frequency={backoff:d,interval:l,max:p}}get isDisposed(){return this.state.phase==="disposed"}get standby(){return this._standby}set standby(c){this.isDisposed||this.standby===c||(this._standby=c)}get state(){return this._state}get tick(){return this._tick.promise}get ticked(){return this._ticked}async*[Symbol.asyncIterator](){for(;!this.isDisposed;)yield this.state,await this.tick.catch(()=>{})}dispose(){this.isDisposed||(this._state={...s.DISPOSED_STATE,timestamp:new Date().getTime()},this._tick.promise.catch(c=>{}),this._tick.reject(new Error(`Poll (${this.name}) is disposed.`)),this._disposed.emit(void 0),t.Signal.clearData(this))}refresh(){return this.schedule({cancel:({phase:c})=>c==="refreshed",interval:n.IMMEDIATE,phase:"refreshed"})}async schedule(c={}){if(this.isDisposed||c.cancel&&c.cancel(this.state))return;let d=this._tick,l=new e.PromiseDelegate,p={interval:this.frequency.interval,payload:null,phase:"standby",timestamp:new Date().getTime(),...c};if(this._state=p,this._tick=l,clearTimeout(this._timeout),this._ticked.emit(this.state),d.resolve(this),await d.promise,p.interval===n.NEVER){this._timeout=void 0;return}let v=()=>{this.isDisposed||this.tick!==l.promise||this._execute()};this._timeout=setTimeout(v,p.interval)}start(){return this.schedule({cancel:({phase:c})=>c!=="constructed"&&c!=="standby"&&c!=="stopped",interval:n.IMMEDIATE,phase:"started"})}stop(){return this.schedule({cancel:({phase:c})=>c==="stopped",interval:n.NEVER,phase:"stopped"})}get hidden(){return s.hidden}_execute(){let c=typeof this.standby=="function"?this.standby():this.standby;if(c==="never"?c=!1:c==="when-hidden"&&(this.hidden?c=++this._lingered>this._linger:(this._lingered=0,c=!1)),c){this.schedule();return}let d=this.tick;this._factory(this.state).then(l=>{this.isDisposed||this.tick!==d||this.schedule({payload:l,phase:this.state.phase==="rejected"?"reconnected":"resolved"})}).catch(l=>{this.isDisposed||this.tick!==d||this.schedule({interval:s.sleep(this.frequency,this.state),payload:l,phase:"rejected"})})}}(function(u){u.IMMEDIATE=0,u.MAX_INTERVAL=2147483647,u.NEVER=1/0})(n||(n={}));var s;(function(u){u.DEFAULT_BACKOFF=3,u.DEFAULT_FREQUENCY={backoff:!0,interval:1e3,max:30*1e3},u.DEFAULT_LINGER=1,u.DEFAULT_NAME="unknown",u.DEFAULT_STANDBY="when-hidden",u.DEFAULT_STATE={interval:n.NEVER,payload:null,phase:"constructed",timestamp:new Date(0).getTime()},u.DISPOSED_STATE={interval:n.NEVER,payload:null,phase:"disposed",timestamp:new Date(0).getTime()};function c(l,p){let{backoff:v,interval:_,max:I}=l;if(_===n.NEVER)return _;let P=v===!0?u.DEFAULT_BACKOFF:v===!1?1:v,D=d(_,p.interval*P);return Math.min(I,D)}u.sleep=c,u.hidden=typeof document=="undefined"?!1:(document.addEventListener("visibilitychange",()=>{u.hidden=document.visibilityState==="hidden"}),document.addEventListener("pagehide",()=>{u.hidden=document.visibilityState==="hidden"}),document.visibilityState==="hidden");function d(l,p){return l=Math.ceil(l),p=Math.floor(p),Math.floor(Math.random()*(p-l+1))+l}})(s||(s={}));class r{constructor(c,d=500){this.args=void 0,this.payload=null,this.limit=d,this.poll=new n({auto:!1,factory:async()=>{let{args:l}=this;return this.args=void 0,c(...l)},frequency:{backoff:!1,interval:n.NEVER,max:n.NEVER},standby:"never"}),this.payload=new e.PromiseDelegate,this.poll.ticked.connect((l,p)=>{let{payload:v}=this;if(p.phase==="resolved"){this.payload=new e.PromiseDelegate,v.resolve(p.payload);return}if(p.phase==="rejected"||p.phase==="stopped"){this.payload=new e.PromiseDelegate,v.promise.catch(_=>{}),v.reject(p.payload);return}},this)}get isDisposed(){return this.payload===null}dispose(){this.isDisposed||(this.args=void 0,this.payload=null,this.poll.dispose())}async stop(){return this.poll.stop()}}class a extends r{invoke(...c){return this.args=c,this.poll.schedule({interval:this.limit,phase:"invoked"}),this.payload.promise}}class o extends r{constructor(c,d){super(c,typeof d=="number"?d:d&&d.limit),this._trailing=!1,typeof d!="number"&&d&&d.edge==="trailing"&&(this._trailing=!0),this._interval=this._trailing?this.limit:n.IMMEDIATE}invoke(...c){let d=this.poll.state.phase!=="invoked";return(d||this._trailing)&&(this.args=c),d&&this.poll.schedule({interval:this._interval,phase:"invoked"}),this.payload.promise}}i.Debouncer=a,i.Poll=n,i.RateLimiter=r,i.Throttler=o})});var Si=E(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.EventManager=void 0;var Sr=J(),Fl=Xe(),xr=Z(),Cr=de(),kr="api/events",bi=class{constructor(e={}){var t,n;this._socket=null,this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Cr.ServerConnection.makeSettings(),this._poll=new Fl.Poll({factory:()=>this._subscribe(),standby:(n=e.standby)!==null&&n!==void 0?n:"when-hidden"}),this._stream=new xr.Stream(this),this._poll.start()}get isDisposed(){return this._poll.isDisposed}get stream(){return this._stream}dispose(){if(this.isDisposed)return;this._poll.dispose();let e=this._socket;e&&(this._socket=null,e.onopen=()=>{},e.onerror=()=>{},e.onmessage=()=>{},e.onclose=()=>{},e.close()),xr.Signal.clearData(this),this._stream.stop()}async emit(e){let{serverSettings:t}=this,{baseUrl:n}=t,{makeRequest:s,ResponseError:r}=Cr.ServerConnection,a=Sr.URLExt.join(n,kr),o={body:JSON.stringify(e),method:"POST"},u=await s(a,o,t);if(u.status!==204)throw new r(u)}_subscribe(){return new Promise((e,t)=>{if(this.isDisposed)return;let{appendToken:n,token:s,WebSocket:r,wsUrl:a}=this.serverSettings,o=Sr.URLExt.join(a,kr,"subscribe");n&&s!==""&&(o+=`?token=${encodeURIComponent(s)}`);let u=this._socket=new r(o),c=this._stream;u.onclose=()=>t(new Error("EventManager socket closed")),u.onmessage=d=>d.data&&c.emit(JSON.parse(d.data))})}};mn.EventManager=bi});var xi=E(be=>{"use strict";var Kl=be&&be.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),Bl=be&&be.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),$l=be&&be.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&Kl(e,i,t);return Bl(e,i),e};Object.defineProperty(be,"__esModule",{value:!0});be.CommHandler=be.CommsOverSubshells=void 0;var Vl=te(),Wl=dn(),gn=$l(st()),ot;(function(i){i.Disabled="disabled",i.PerComm="perComm",i.PerCommTarget="perCommTarget"})(ot||(be.CommsOverSubshells=ot={}));var _n=class i extends Wl.DisposableDelegate{constructor(e,t,n,s,r){super(s),this._subshellStarted=new Vl.PromiseDelegate,this._subshellId=null,this._target="",this._id="",this._id=t,this._target=e,this._kernel=n,this._kernel.statusChanged.connect(()=>{this._kernel.status==="restarting"&&this._cleanSubshells()}),this.commsOverSubshells=r!=null?r:ot.PerCommTarget}get commId(){return this._id}get targetName(){return this._target}get subshellId(){return this._subshellId}get subshellStarted(){return this._subshellStarted.promise}get commsOverSubshells(){return this._commsOverSubshells}set commsOverSubshells(e){this._commsOverSubshells=e,this._commsOverSubshells===ot.Disabled?this._maybeCloseSubshell():this._maybeStartSubshell()}get onClose(){return this._onClose}set onClose(e){this._onClose=e}get onMsg(){return this._onMsg}set onMsg(e){this._onMsg=e}open(e,t,n=[]){if(this.isDisposed||this._kernel.isDisposed)throw new Error("Cannot open");let s=gn.createMessage({msgType:"comm_open",channel:"shell",username:this._kernel.username,session:this._kernel.clientId,subshellId:this._subshellId||this._kernel.subshellId,content:{comm_id:this._id,target_name:this._target,data:e!=null?e:{}},metadata:t,buffers:n});return this._kernel.sendShellMessage(s,!1,!0)}send(e,t,n=[],s=!0){if(this.isDisposed||this._kernel.isDisposed)throw new Error("Cannot send");let r=gn.createMessage({msgType:"comm_msg",channel:"shell",username:this._kernel.username,session:this._kernel.clientId,subshellId:this._subshellId||this._kernel.subshellId,content:{comm_id:this._id,data:e},metadata:t,buffers:n});return this._kernel.sendShellMessage(r,!1,s)}close(e,t,n=[]){if(this.isDisposed||this._kernel.isDisposed)throw new Error("Cannot close");let s=gn.createMessage({msgType:"comm_close",channel:"shell",username:this._kernel.username,session:this._kernel.clientId,subshellId:this._subshellId||this._kernel.subshellId,content:{comm_id:this._id,data:e!=null?e:{}},metadata:t,buffers:n}),r=this._kernel.sendShellMessage(s,!1,!0),a=this._onClose;if(a){let o=gn.createMessage({msgType:"comm_close",channel:"iopub",username:this._kernel.username,session:this._kernel.clientId,subshellId:this._subshellId||this._kernel.subshellId,content:{comm_id:this._id,data:e!=null?e:{}},metadata:t,buffers:n});a(o)}return this.dispose(),r}dispose(){this._maybeCloseSubshell(),super.dispose()}_cleanSubshells(){let e=this._kernel.id;i._commTargetSubShellsId.hasOwnProperty(e)&&delete i._commTargetSubShellsId[e]}async _maybeStartSubshell(){if(await this._kernel.info,!this._kernel.supportsSubshells)return;if(this._commsOverSubshells===ot.PerComm){let n=await this._kernel.requestCreateSubshell({}).done;this._subshellId=n.content.subshell_id,this._subshellStarted.resolve();return}let e=this._kernel.id;i._commTargetSubShellsId.hasOwnProperty(e)||(i._commTargetSubShellsId[e]={});let t=i._commTargetSubShellsId[e];t[this._target]?(this._subshellId=await t[this._target],this._subshellStarted.resolve()):(t[this._target]=this._kernel.requestCreateSubshell({}).done.then(n=>(this._subshellId=n.content.subshell_id,this._subshellId)),await t[this._target],this._subshellStarted.resolve())}_maybeCloseSubshell(){if(this._commsOverSubshells!==ot.PerComm){this._subshellId=null;return}this._subshellId&&this._kernel.status!=="dead"&&this._kernel.requestDeleteSubshell({subshell_id:this._subshellId},!0),this._subshellId=null}};be.CommHandler=_n;_n._commTargetSubShellsId={}});var Mr=E(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0})});var vn=E(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.validateMessage=Gl;mt.validateModel=Ir;mt.validateModels=Xl;var Ze=ht(),Er=["username","version","session","msg_id","msg_type"],Jl={stream:{name:"string",text:"string"},display_data:{data:"object",metadata:"object"},execute_input:{code:"string",execution_count:"number"},execute_result:{execution_count:"number",data:"object",metadata:"object"},error:{ename:"string",evalue:"string",traceback:"object"},status:{execution_state:["string",["starting","idle","busy","restarting","dead"]]},clear_output:{wait:"boolean"},comm_open:{comm_id:"string",target_name:"string",data:"object"},comm_msg:{comm_id:"string",data:"object"},comm_close:{comm_id:"string"},shutdown_reply:{restart:"boolean"}};function Hl(i){for(let e=0;e<Er.length;e++)(0,Ze.validateProperty)(i,Er[e],"string")}function Gl(i){(0,Ze.validateProperty)(i,"metadata","object"),(0,Ze.validateProperty)(i,"content","object"),(0,Ze.validateProperty)(i,"channel","string"),Hl(i.header),i.channel==="iopub"&&Yl(i)}function Yl(i){if(i.channel==="iopub"){let e=Jl[i.header.msg_type];if(e===void 0)return;let t=Object.keys(e),n=i.content;for(let s=0;s<t.length;s++){let r=e[t[s]];Array.isArray(r)||(r=[r]),(0,Ze.validateProperty)(n,t[s],...r)}}}function Ir(i){(0,Ze.validateProperty)(i,"name","string"),(0,Ze.validateProperty)(i,"id","string")}function Xl(i){if(!Array.isArray(i))throw new Error("Invalid kernel list");i.forEach(e=>Ir(e))}});var wn=E(ne=>{"use strict";Object.defineProperty(ne,"__esModule",{value:!0});ne.KernelAPIClient=ne.KERNEL_SERVICE_URL=void 0;ne.listRunning=Rr;ne.startNew=Or;ne.restartKernel=Dr;ne.interruptKernel=jr;ne.shutdownKernel=Tr;ne.getKernelModel=qr;var Q=de(),lt=J(),yn=vn();ne.KERNEL_SERVICE_URL="api/kernels";async function Rr(i=Q.ServerConnection.makeSettings()){let e=lt.URLExt.join(i.baseUrl,ne.KERNEL_SERVICE_URL),t=await Q.ServerConnection.makeRequest(e,{},i);if(t.status!==200)throw await Q.ServerConnection.ResponseError.create(t);let n=await t.json();return(0,yn.validateModels)(n),n}async function Or(i={},e=Q.ServerConnection.makeSettings()){let t=lt.URLExt.join(e.baseUrl,ne.KERNEL_SERVICE_URL),n={method:"POST",body:JSON.stringify(i)},s=await Q.ServerConnection.makeRequest(t,n,e);if(s.status!==201)throw await Q.ServerConnection.ResponseError.create(s);let r=await s.json();return(0,yn.validateModel)(r),r}async function Dr(i,e=Q.ServerConnection.makeSettings()){let t=lt.URLExt.join(e.baseUrl,ne.KERNEL_SERVICE_URL,encodeURIComponent(i),"restart"),n={method:"POST"},s=await Q.ServerConnection.makeRequest(t,n,e);if(s.status!==200)throw await Q.ServerConnection.ResponseError.create(s);let r=await s.json();(0,yn.validateModel)(r)}async function jr(i,e=Q.ServerConnection.makeSettings()){let t=lt.URLExt.join(e.baseUrl,ne.KERNEL_SERVICE_URL,encodeURIComponent(i),"interrupt"),n={method:"POST"},s=await Q.ServerConnection.makeRequest(t,n,e);if(s.status!==204)throw await Q.ServerConnection.ResponseError.create(s)}async function Tr(i,e=Q.ServerConnection.makeSettings()){let t=lt.URLExt.join(e.baseUrl,ne.KERNEL_SERVICE_URL,encodeURIComponent(i)),n={method:"DELETE"},s=await Q.ServerConnection.makeRequest(t,n,e);if(s.status===404){let r=`The kernel "${i}" does not exist on the server`;console.warn(r)}else if(s.status!==204)throw await Q.ServerConnection.ResponseError.create(s)}async function qr(i,e=Q.ServerConnection.makeSettings()){let t=lt.URLExt.join(e.baseUrl,ne.KERNEL_SERVICE_URL,encodeURIComponent(i)),n=await Q.ServerConnection.makeRequest(t,{},e);if(n.status===404)return;if(n.status!==200)throw await Q.ServerConnection.ResponseError.create(n);let s=await n.json();return(0,yn.validateModel)(s),s}var Ci=class{constructor(e={}){var t;this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Q.ServerConnection.makeSettings()}async listRunning(){return Rr(this.serverSettings)}async getModel(e){return qr(e,this.serverSettings)}async startNew(e={}){return Or(e,this.serverSettings)}async restart(e){return Dr(e,this.serverSettings)}async interrupt(e){return jr(e,this.serverSettings)}async shutdown(e){return Tr(e,this.serverSettings)}};ne.KernelAPIClient=Ci});var Ar=E(_e=>{"use strict";var Zl=_e&&_e.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),Ql=_e&&_e.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),ec=_e&&_e.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&Zl(e,i,t);return Ql(e,i),e};Object.defineProperty(_e,"__esModule",{value:!0});_e.KernelShellFutureHandler=_e.KernelControlFutureHandler=_e.KernelFutureHandler=void 0;var Ur=te(),tc=dn(),nc=ec(st()),gt=class extends tc.DisposableDelegate{constructor(e,t,n,s,r){super(e),this._status=0,this._stdin=ie.noOp,this._iopub=ie.noOp,this._reply=ie.noOp,this._done=new Ur.PromiseDelegate,this._hooks=new ie.HookList,this._disposeOnDone=!0,this._msg=t,n||this._setFlag(ie.KernelFutureFlag.GotReply),this._disposeOnDone=s,this._kernel=r}get msg(){return this._msg}get done(){return this._done.promise}get onReply(){return this._reply}set onReply(e){this._reply=e}get onIOPub(){return this._iopub}set onIOPub(e){this._iopub=e}get onStdin(){return this._stdin}set onStdin(e){this._stdin=e}registerMessageHook(e){if(this.isDisposed)throw new Error("Kernel future is disposed");this._hooks.add(e)}removeMessageHook(e){this.isDisposed||this._hooks.remove(e)}sendInputReply(e,t){this._kernel.sendInputReply(e,t)}dispose(){this._stdin=ie.noOp,this._iopub=ie.noOp,this._reply=ie.noOp,this._hooks=null,this._testFlag(ie.KernelFutureFlag.IsDone)||(this._done.promise.catch(()=>{}),this._done.reject(new Error(`Canceled future for ${this.msg.header.msg_type} message before replies were done`))),super.dispose()}async handleMsg(e){switch(e.channel){case"control":case"shell":e.channel===this.msg.channel&&e.parent_header.msg_id===this.msg.header.msg_id&&await this._handleReply(e);break;case"stdin":await this._handleStdin(e);break;case"iopub":await this._handleIOPub(e);break;default:break}}async _handleReply(e){let t=this._reply;t&&await t(e),this._replyMsg=e,this._setFlag(ie.KernelFutureFlag.GotReply),this._testFlag(ie.KernelFutureFlag.GotIdle)&&this._handleDone()}async _handleStdin(e){this._kernel.hasPendingInput=!0;let t=this._stdin;t&&await t(e)}async _handleIOPub(e){let t=await this._hooks.process(e),n=this._iopub;t&&n&&await n(e),nc.isStatusMsg(e)&&e.content.execution_state==="idle"&&(this._setFlag(ie.KernelFutureFlag.GotIdle),this._testFlag(ie.KernelFutureFlag.GotReply)&&this._handleDone())}_handleDone(){this._testFlag(ie.KernelFutureFlag.IsDone)||(this._setFlag(ie.KernelFutureFlag.IsDone),this._done.resolve(this._replyMsg),this._disposeOnDone&&this.dispose())}_testFlag(e){return(this._status&e)!==0}_setFlag(e){this._status|=e}};_e.KernelFutureHandler=gt;var ki=class extends gt{};_e.KernelControlFutureHandler=ki;var Pi=class extends gt{};_e.KernelShellFutureHandler=Pi;var ie;(function(i){i.noOp=()=>{};let e=typeof requestAnimationFrame=="function"?requestAnimationFrame:setImmediate;class t{constructor(){this._hooks=[]}add(r){this.remove(r),this._hooks.push(r)}remove(r){let a=this._hooks.indexOf(r);a>=0&&(this._hooks[a]=null,this._scheduleCompact())}async process(r){await this._processing;let a=new Ur.PromiseDelegate;this._processing=a.promise;let o;for(let u=this._hooks.length-1;u>=0;u--){let c=this._hooks[u];if(c!==null){try{o=await c(r)}catch(d){o=!0,console.error(d)}if(o===!1)return a.resolve(void 0),!1}}return a.resolve(void 0),!0}_scheduleCompact(){this._compactScheduled||(this._compactScheduled=!0,e(()=>{this._processing=this._processing.then(()=>{this._compactScheduled=!1,this._compact()})}))}_compact(){let r=0;for(let a=0,o=this._hooks.length;a<o;a++){let u=this._hooks[a];this._hooks[a]===null?r++:this._hooks[a-r]=u}this._hooks.length-=r}}i.HookList=t;let n;(function(s){s[s.GotReply=1]="GotReply",s[s.GotIdle=2]="GotIdle",s[s.IsDone=4]="IsDone",s[s.DisposeOnDone=8]="DisposeOnDone"})(n=i.KernelFutureFlag||(i.KernelFutureFlag={}))})(ie||(ie={}))});var Lr=E(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0});bn.validateSpecModel=Nr;bn.validateSpecModels=ic;var Qe=ht();function Nr(i){let e=i.spec;if(!e)throw new Error("Invalid kernel spec");(0,Qe.validateProperty)(i,"name","string"),(0,Qe.validateProperty)(i,"resources","object"),(0,Qe.validateProperty)(e,"language","string"),(0,Qe.validateProperty)(e,"display_name","string"),(0,Qe.validateProperty)(e,"argv","array");let t=null;e.hasOwnProperty("metadata")&&((0,Qe.validateProperty)(e,"metadata","object"),t=e.metadata);let n=null;return e.hasOwnProperty("env")&&((0,Qe.validateProperty)(e,"env","object"),n=e.env),{name:i.name,resources:i.resources,language:e.language,display_name:e.display_name,argv:e.argv,metadata:t,env:n}}function ic(i){if(!i.hasOwnProperty("kernelspecs"))throw new Error("No kernelspecs found");let e=Object.keys(i.kernelspecs),t=Object.create(null),n=i.default;for(let s=0;s<e.length;s++){let r=i.kernelspecs[e[s]];try{t[e[s]]=Nr(r)}catch{console.warn(`Removing errant kernel spec: ${e[s]}`)}}if(e=Object.keys(t),!e.length)throw new Error("No valid kernelspecs found");return(!n||typeof n!="string"||!(n in t))&&(n=e[0],console.warn(`Default kernel not found, using '${e[0]}'`)),{default:n,kernelspecs:t}}});var vt=E(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.KernelSpecAPIClient=void 0;_t.getSpecs=zr;var Sn=de(),sc=Lr(),rc=J(),ac="api/kernelspecs";async function zr(i=Sn.ServerConnection.makeSettings()){let e=rc.URLExt.join(i.baseUrl,ac),t=await Sn.ServerConnection.makeRequest(e,{},i);if(t.status!==200)throw await Sn.ServerConnection.ResponseError.create(t);let n=await t.json();return(0,sc.validateSpecModels)(n)}var Mi=class{constructor(e={}){var t;this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Sn.ServerConnection.makeSettings()}async get(){return zr(this.serverSettings)}};_t.KernelSpecAPIClient=Mi});var Ii=E(Ue=>{"use strict";var oc=Ue&&Ue.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),lc=Ue&&Ue.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),Vr=Ue&&Ue.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&oc(e,i,t);return lc(e,i),e};Object.defineProperty(Ue,"__esModule",{value:!0});Ue.KernelConnection=void 0;var Fr=J(),Ve=te(),We=Z(),yt=Te(),Kr=xi(),se=Vr(st()),Br=Ar(),cc=Vr(vn()),$r=wn(),dc=vt(),uc=3e3,ct="_RESTARTING_",pc="",Ei=class i{constructor(e){var t,n,s,r,a,o,u,c;this._createSocket=(d=!0)=>{this._errorIfDisposed(),this._clearSocket(),this._updateConnectionStatus("connecting");let l=this.serverSettings,p=Fr.URLExt.join(l.wsUrl,$r.KERNEL_SERVICE_URL,encodeURIComponent(this._id)),v=p.replace(/^((?:\w+:)?\/\/)(?:[^@\/]+@)/,"$1");console.debug(`Starting WebSocket: ${v}`);let _=Fr.URLExt.join(p,"channels?session_id="+encodeURIComponent(this._clientId)),I=l.token;l.appendToken&&I!==""&&(_=_+`&token=${encodeURIComponent(I)}`);let P=d?this._supportedProtocols:[];this._ws=new l.WebSocket(_,P),this._ws.binaryType="arraybuffer";let D=!1,q=async w=>{var R,A;if(!this._isDisposed){this._reason="",this._model=void 0;try{let T=await this._kernelAPIClient.getModel(this._id);this._model=T,(T==null?void 0:T.execution_state)==="dead"?this._updateStatus("dead"):this._onWSClose(w)}catch(T){if(T instanceof yt.ServerConnection.NetworkError||((R=T.response)===null||R===void 0?void 0:R.status)===503||((A=T.response)===null||A===void 0?void 0:A.status)===424){let j=Se.getRandomIntInclusive(10,30)*1e3;setTimeout(q,j,w)}else this._reason="Kernel died unexpectedly",this._updateStatus("dead")}}},x=async w=>{D||(D=!0,await q(w))};this._ws.onmessage=this._onWSMessage,this._ws.onopen=this._onWSOpen,this._ws.onclose=x,this._ws.onerror=x},this._onWSOpen=d=>{if(this._ws.protocol!==""&&!this._supportedProtocols.includes(this._ws.protocol))throw console.log("Server selected unknown kernel wire protocol:",this._ws.protocol),this._updateStatus("dead"),new Error(`Unknown kernel wire protocol: ${this._ws.protocol}`);this._selectedProtocol=this._ws.protocol,this._ws.onclose=this._onWSClose,this._ws.onerror=this._onWSClose,this._updateConnectionStatus("connected")},this._onWSMessage=d=>{let l;try{l=this.serverSettings.serializer.deserialize(d.data,this._ws.protocol),cc.validateMessage(l)}catch(p){throw p.message=`Kernel message validation error: ${p.message}`,p}this._kernelSession=l.header.session,this._msgChain=this._msgChain.then(()=>this._handleMessage(l)).catch(p=>{p.message.startsWith("Canceled future for ")&&console.error(p)}),this._anyMessage.emit({msg:l,direction:"recv"})},this._onWSClose=d=>{this.isDisposed||this._reconnect()},this._id="",this._name="",this._status="unknown",this._connectionStatus="connecting",this._kernelSession="",this._isDisposed=!1,this._ws=null,this._username="",this._reconnectLimit=7,this._reconnectAttempt=0,this._reconnectTimeout=null,this._supportedProtocols=Object.values(se.supportedKernelWebSocketProtocols),this._selectedProtocol="",this._commsOverSubshells=yt.CommsOverSubshells.PerCommTarget,this._futures=new Map,this._comms=new Map,this._targetRegistry=Object.create(null),this._info=new Ve.PromiseDelegate,this._pendingMessages=[],this._statusChanged=new We.Signal(this),this._connectionStatusChanged=new We.Signal(this),this._disposed=new We.Signal(this),this._iopubMessage=new We.Signal(this),this._anyMessage=new We.Signal(this),this._pendingInput=new We.Signal(this),this._unhandledMessage=new We.Signal(this),this._displayIdToParentIds=new Map,this._msgIdToDisplayIds=new Map,this._msgChain=Promise.resolve(),this._hasPendingInput=!1,this._reason="",this._noOp=()=>{},this._supportsSubshells=!1,this._name=e.model.name,this._id=e.model.id,this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:yt.ServerConnection.makeSettings(),this._kernelAPIClient=(n=e.kernelAPIClient)!==null&&n!==void 0?n:new $r.KernelAPIClient({serverSettings:this.serverSettings}),this._kernelSpecAPIClient=(s=e.kernelSpecAPIClient)!==null&&s!==void 0?s:new dc.KernelSpecAPIClient({serverSettings:this.serverSettings}),this._clientId=(r=e.clientId)!==null&&r!==void 0?r:Ve.UUID.uuid4(),this._username=(a=e.username)!==null&&a!==void 0?a:"",this.handleComms=(o=e.handleComms)!==null&&o!==void 0?o:!0,this._commsOverSubshells=(u=e.commsOverSubshells)!==null&&u!==void 0?u:yt.CommsOverSubshells.PerCommTarget,this._subshellId=(c=e.subshellId)!==null&&c!==void 0?c:null,this._createSocket()}get disposed(){return this._disposed}get commsOverSubshells(){return this._commsOverSubshells}set commsOverSubshells(e){this._commsOverSubshells=e;for(let[t,n]of this._comms)n.commsOverSubshells=e}get statusChanged(){return this._statusChanged}get connectionStatusChanged(){return this._connectionStatusChanged}get iopubMessage(){return this._iopubMessage}get unhandledMessage(){return this._unhandledMessage}get model(){return this._model||{id:this.id,name:this.name,reason:this._reason}}get anyMessage(){return this._anyMessage}get pendingInput(){return this._pendingInput}get id(){return this._id}get name(){return this._name}get username(){return this._username}get clientId(){return this._clientId}get subshellId(){return this._subshellId}set subshellId(e){this._subshellId=e}get status(){return this._status}get connectionStatus(){return this._connectionStatus}get isDisposed(){return this._isDisposed}get info(){return this._info.promise}get spec(){return this._specPromise?this._specPromise:(this._specPromise=this._kernelSpecAPIClient.get().then(e=>e.kernelspecs[this._name]),this._specPromise)}get supportsSubshells(){return this._supportsSubshells}clone(e={}){return new i({model:this.model,username:this.username,serverSettings:this.serverSettings,handleComms:!1,kernelAPIClient:this._kernelAPIClient,commsOverSubshells:yt.CommsOverSubshells.Disabled,...e})}dispose(){if(this.isDisposed)return;let e=()=>{this._isDisposed=!0,this._disposed.emit(),this._updateConnectionStatus("disconnected"),this._clearKernelState(),this._pendingMessages=[],this._clearSocket(),We.Signal.clearData(this)};if(this._subshellId!==null){let t=this.requestDeleteSubshell({subshell_id:this._subshellId},!0);t.onReply=n=>{e()}}else e()}sendShellMessage(e,t=!1,n=!0){return this._sendKernelShellControl(Br.KernelShellFutureHandler,e,t,n)}sendControlMessage(e,t=!1,n=!0){return this._sendKernelShellControl(Br.KernelControlFutureHandler,e,t,n)}_sendKernelShellControl(e,t,n=!1,s=!0){this._sendMessage(t),this._anyMessage.emit({msg:t,direction:"send"});let r=new e(()=>{let a=t.header.msg_id;this._futures.delete(a);let o=this._msgIdToDisplayIds.get(a);o&&(o.forEach(u=>{let c=this._displayIdToParentIds.get(u);if(c){let d=c.indexOf(a);if(d===-1)return;c.length===1?this._displayIdToParentIds.delete(u):(c.splice(d,1),this._displayIdToParentIds.set(u,c))}}),this._msgIdToDisplayIds.delete(a))},t,n,s,this);return this._futures.set(t.header.msg_id,r),r}_sendMessage(e,t=!0){if(this.status==="dead")throw new Error("Kernel is dead");if((this._kernelSession===pc||this._kernelSession===ct)&&se.isInfoRequestMsg(e))if(this.connectionStatus==="connected"){this._ws.send(this.serverSettings.serializer.serialize(e,this._ws.protocol));return}else throw new Error("Could not send message: status is not connected");if(t&&this._pendingMessages.length>0){this._pendingMessages.push(e);return}if(this.connectionStatus==="connected"&&this._kernelSession!==ct)this._ws.send(this.serverSettings.serializer.serialize(e,this._ws.protocol));else if(t)this._pendingMessages.push(e);else throw new Error("Could not send message")}async interrupt(){if(this.hasPendingInput=!1,this.status==="dead")throw new Error("Kernel is dead");return this._kernelAPIClient.interrupt(this.id)}async restart(){if(this.status==="dead")throw new Error("Kernel is dead");this._updateStatus("restarting"),this._clearKernelState(),this._kernelSession=ct,await this._kernelAPIClient.restart(this.id),await this.reconnect(),this.hasPendingInput=!1}reconnect(){this._errorIfDisposed();let e=new Ve.PromiseDelegate,t=(n,s)=>{s==="connected"?(e.resolve(),this.connectionStatusChanged.disconnect(t,this)):s==="disconnected"&&(e.reject(new Error("Kernel connection disconnected")),this.connectionStatusChanged.disconnect(t,this))};return this.connectionStatusChanged.connect(t,this),this._reconnectAttempt=0,this._reconnect(),e.promise}async shutdown(){this.status!=="dead"&&await this._kernelAPIClient.shutdown(this.id),this.handleShutdown()}handleShutdown(){this._updateStatus("dead"),this.dispose()}async requestKernelInfo(){let e=se.createMessage({msgType:"kernel_info_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:{}}),t;try{t=await Se.handleShellMessage(this,e)}catch(s){if(this.isDisposed)return;throw s}if(this._errorIfDisposed(),!t)return;if(t.content.status===void 0&&(t.content.status="ok"),t.content.status!=="ok")return this._info.reject("Kernel info reply errored"),t;this._info.resolve(t.content),this._kernelSession=t.header.session;let n=t.content.supported_features;return this._supportsSubshells=n!==void 0&&n.includes("kernel subshells"),t}requestComplete(e){let t=se.createMessage({msgType:"complete_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:e});return Se.handleShellMessage(this,t)}requestInspect(e){let t=se.createMessage({msgType:"inspect_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:e});return Se.handleShellMessage(this,t)}requestHistory(e){let t=se.createMessage({msgType:"history_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:e});return Se.handleShellMessage(this,t)}requestExecute(e,t=!0,n){let s={silent:!1,store_history:!0,user_expressions:{},allow_stdin:!0,stop_on_error:!1},r=se.createMessage({msgType:"execute_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:{...s,...e},metadata:n});return this.sendShellMessage(r,!0,t)}requestDebug(e,t=!0){let n=se.createMessage({msgType:"debug_request",channel:"control",username:this._username,session:this._clientId,content:e});return this.sendControlMessage(n,!0,t)}requestCreateSubshell(e,t=!0){if(!this.supportsSubshells)throw new Error("Kernel subshells are not supported");let n=se.createMessage({msgType:"create_subshell_request",channel:"control",username:this._username,session:this._clientId,content:e});return this.sendControlMessage(n,!0,t)}requestDeleteSubshell(e,t=!0){if(!this.supportsSubshells)throw new Error("Kernel subshells are not supported");let n=se.createMessage({msgType:"delete_subshell_request",channel:"control",username:this._username,session:this._clientId,content:e});return this.sendControlMessage(n,!0,t)}requestListSubshell(e,t=!0){if(!this.supportsSubshells)throw new Error("Kernel subshells are not supported");let n=se.createMessage({msgType:"list_subshell_request",channel:"control",username:this._username,session:this._clientId,content:e});return this.sendControlMessage(n,!0,t)}requestIsComplete(e){let t=se.createMessage({msgType:"is_complete_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:e});return Se.handleShellMessage(this,t)}requestCommInfo(e){let t=se.createMessage({msgType:"comm_info_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:e});return Se.handleShellMessage(this,t)}sendInputReply(e,t){let n=se.createMessage({msgType:"input_reply",channel:"stdin",username:this._username,session:this._clientId,content:e});n.parent_header=t,this._sendMessage(n),this._anyMessage.emit({msg:n,direction:"send"}),this.hasPendingInput=!1}createComm(e,t=Ve.UUID.uuid4()){if(!this.handleComms)throw new Error("Comms are disabled on this kernel connection");if(this._comms.has(t))throw new Error("Comm is already created");let n=new Kr.CommHandler(e,t,this,()=>{this._unregisterComm(t)},this._commsOverSubshells);return this._comms.set(t,n),n}hasComm(e){return this._comms.has(e)}registerCommTarget(e,t){this.handleComms&&(this._targetRegistry[e]=t)}removeCommTarget(e,t){this.handleComms&&!this.isDisposed&&this._targetRegistry[e]===t&&delete this._targetRegistry[e]}registerMessageHook(e,t){var n;let s=(n=this._futures)===null||n===void 0?void 0:n.get(e);s&&s.registerMessageHook(t)}removeMessageHook(e,t){var n;let s=(n=this._futures)===null||n===void 0?void 0:n.get(e);s&&s.removeMessageHook(t)}removeInputGuard(){this.hasPendingInput=!1}async _handleDisplayId(e,t){var n,s;let r=t.parent_header.msg_id,a=this._displayIdToParentIds.get(e);if(a){let u={header:Ve.JSONExt.deepCopy(t.header),parent_header:Ve.JSONExt.deepCopy(t.parent_header),metadata:Ve.JSONExt.deepCopy(t.metadata),content:Ve.JSONExt.deepCopy(t.content),channel:t.channel,buffers:t.buffers?t.buffers.slice():[]};u.header.msg_type="update_display_data",await Promise.all(a.map(async c=>{let d=this._futures&&this._futures.get(c);d&&await d.handleMsg(u)}))}if(t.header.msg_type==="update_display_data")return!0;a=(n=this._displayIdToParentIds.get(e))!==null&&n!==void 0?n:[],a.indexOf(r)===-1&&a.push(r),this._displayIdToParentIds.set(e,a);let o=(s=this._msgIdToDisplayIds.get(r))!==null&&s!==void 0?s:[];return o.indexOf(r)===-1&&o.push(r),this._msgIdToDisplayIds.set(r,o),!1}_clearSocket(){this._ws!==null&&(this._ws.onopen=this._noOp,this._ws.onclose=this._noOp,this._ws.onerror=this._noOp,this._ws.onmessage=this._noOp,this._ws.close(),this._ws=null)}_updateStatus(e){this._status===e||this._status==="dead"||(this._status=e,Se.logKernelStatus(this),this._statusChanged.emit(e),e==="dead"&&this.dispose())}_sendPending(){for(;this.connectionStatus==="connected"&&this._kernelSession!==ct&&this._pendingMessages.length>0;)this._sendMessage(this._pendingMessages[0],!1),this._pendingMessages.shift()}_clearKernelState(){this._kernelSession="",this._pendingMessages=[],this._futures.forEach(e=>{e.dispose()}),this._comms.forEach(e=>{e.dispose()}),this._msgChain=Promise.resolve(),this._futures=new Map,this._comms=new Map,this._displayIdToParentIds.clear(),this._msgIdToDisplayIds.clear()}_assertCurrentMessage(e){if(this._errorIfDisposed(),e.header.session!==this._kernelSession)throw new Error(`Canceling handling of old message: ${e.header.msg_type}`)}async _handleCommOpen(e){this._assertCurrentMessage(e);let t=e.content,n=new Kr.CommHandler(t.target_name,t.comm_id,this,()=>{this._unregisterComm(t.comm_id)},this.commsOverSubshells);this._comms.set(t.comm_id,n);try{await(await Se.loadObject(t.target_name,t.target_module,this._targetRegistry))(n,e)}catch(s){throw n.close(),console.error("Exception opening new comm"),s}}async _handleCommClose(e){this._assertCurrentMessage(e);let t=e.content,n=this._comms.get(t.comm_id);if(!n){console.error("Comm not found for comm id "+t.comm_id);return}this._unregisterComm(n.commId);let s=n.onClose;s&&await s(e),n.dispose()}async _handleCommMsg(e){this._assertCurrentMessage(e);let t=e.content,n=this._comms.get(t.comm_id);if(!n)return;let s=n.onMsg;s&&await s(e)}_unregisterComm(e){this._comms.delete(e)}_updateConnectionStatus(e){if(this._connectionStatus!==e){if(this._connectionStatus=e,e!=="connecting"&&(this._reconnectAttempt=0,clearTimeout(this._reconnectTimeout)),this.status!=="dead")if(e==="connected"){let t=this._kernelSession===ct,n=this.requestKernelInfo(),s=!1,r=()=>{s||(s=!0,t&&this._kernelSession===ct&&(this._kernelSession=""),clearTimeout(a),this._pendingMessages.length>0&&this._sendPending())};n.then(r);let a=setTimeout(r,uc)}else this._updateStatus("unknown");this._connectionStatusChanged.emit(e)}}async _handleMessage(e){var t,n;let s=!1;if(e.parent_header&&e.channel==="iopub"&&(se.isDisplayDataMsg(e)||se.isUpdateDisplayDataMsg(e)||se.isExecuteResultMsg(e))){let a=((t=e.content.transient)!==null&&t!==void 0?t:{}).display_id;a&&(s=await this._handleDisplayId(a,e),this._assertCurrentMessage(e))}if(!s&&e.parent_header){let r=e.parent_header,a=(n=this._futures)===null||n===void 0?void 0:n.get(r.msg_id);if(a)await a.handleMsg(e),this._assertCurrentMessage(e);else{let o=r.session===this.clientId;e.channel!=="iopub"&&o&&this._unhandledMessage.emit(e)}}if(e.channel==="iopub"){switch(e.header.msg_type){case"status":{let r=e.content.execution_state;r==="restarting"&&Promise.resolve().then(async()=>{this._updateStatus("autorestarting"),this._clearKernelState(),await this.reconnect()}),this._updateStatus(r);break}case"comm_open":this.handleComms&&await this._handleCommOpen(e);break;case"comm_msg":this.handleComms&&await this._handleCommMsg(e);break;case"comm_close":this.handleComms&&await this._handleCommClose(e);break;default:break}this.isDisposed||(this._assertCurrentMessage(e),this._iopubMessage.emit(e))}}_reconnect(){if(this._errorIfDisposed(),clearTimeout(this._reconnectTimeout),this._reconnectAttempt<this._reconnectLimit){this._updateConnectionStatus("connecting");let e=Se.getRandomIntInclusive(0,1e3*(Math.pow(2,this._reconnectAttempt)-1));console.warn(`Connection lost, reconnecting in ${Math.floor(e/1e3)} seconds.`);let t=this._selectedProtocol!=="";this._reconnectTimeout=setTimeout(this._createSocket,e,t),this._reconnectAttempt+=1}else this._updateConnectionStatus("disconnected");this._clearSocket()}_errorIfDisposed(){if(this.isDisposed)throw new Error("Kernel connection is disposed")}get hasPendingInput(){return this._hasPendingInput}set hasPendingInput(e){this._hasPendingInput=e,this._pendingInput.emit(e)}};Ue.KernelConnection=Ei;var Se;(function(i){function e(r){switch(r.status){case"idle":case"busy":case"unknown":return;default:console.debug(`Kernel: ${r.status} (${r.id})`);break}}i.logKernelStatus=e;async function t(r,a){return r.sendShellMessage(a,!0).done}i.handleShellMessage=t;function n(r,a,o){return new Promise((u,c)=>{if(a){if(typeof requirejs=="undefined")throw new Error("requirejs not found");requirejs([a],d=>{if(d[r]===void 0){let l=`Object '${r}' not found in module '${a}'`;c(new Error(l))}else u(d[r])},c)}else o!=null&&o[r]?u(o[r]):c(new Error(`Object '${r}' not found in registry`))})}i.loadObject=n;function s(r,a){return r=Math.ceil(r),a=Math.floor(a),Math.floor(Math.random()*(a-r+1))+r}i.getRandomIntInclusive=s})(Se||(Se={}))});var Hr=E(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.KernelManager=void 0;var hc=Xe(),Wr=Z(),Jr=Te(),fc=Ye(),mc=wn(),gc=Ii(),_c=vt(),wt=class extends fc.BaseManager{constructor(e={}){var t,n,s;super(e),this._commsOverSubshells=Jr.CommsOverSubshells.PerCommTarget,this._isReady=!1,this._kernelConnections=new Set,this._models=new Map,this._runningChanged=new Wr.Signal(this),this._connectionFailure=new Wr.Signal(this),this._kernelAPIClient=(t=e.kernelAPIClient)!==null&&t!==void 0?t:new mc.KernelAPIClient({serverSettings:this.serverSettings}),this._kernelSpecAPIClient=(n=e.kernelSpecAPIClient)!==null&&n!==void 0?n:new _c.KernelSpecAPIClient({serverSettings:this.serverSettings}),this._pollModels=new hc.Poll({auto:!1,factory:()=>this.requestRunning(),frequency:{interval:10*1e3,backoff:!0,max:300*1e3},name:"@jupyterlab/services:KernelManager#models",standby:(s=e.standby)!==null&&s!==void 0?s:"when-hidden"}),this._ready=(async()=>{await this._pollModels.start(),await this._pollModels.tick,this._isReady=!0})()}get isReady(){return this._isReady}get ready(){return this._ready}get runningChanged(){return this._runningChanged}get connectionFailure(){return this._connectionFailure}dispose(){this.isDisposed||(this._models.clear(),this._kernelConnections.forEach(e=>e.dispose()),this._pollModels.dispose(),super.dispose())}connectTo(e){var t;let{id:n}=e.model,s=(t=e.handleComms)!==null&&t!==void 0?t:!0;if(e.handleComms===void 0){for(let a of this._kernelConnections)if(a.id===n&&a.handleComms){s=!1;break}}e.commsOverSubshells=this._commsOverSubshells;let r=new gc.KernelConnection({handleComms:s,...e,serverSettings:this.serverSettings,kernelAPIClient:this._kernelAPIClient,kernelSpecAPIClient:this._kernelSpecAPIClient});return this._onStarted(r),this._models.has(n)||this.refreshRunning().catch(()=>{}),r}running(){return this._models.values()}get runningCount(){return this._models.size}get commsOverSubshells(){return this._commsOverSubshells}set commsOverSubshells(e){this._commsOverSubshells=e;for(let t of this._kernelConnections)t.commsOverSubshells=e}async refreshRunning(){await this._pollModels.refresh(),await this._pollModels.tick}async startNew(e={},t={}){let n=await this._kernelAPIClient.startNew(e);return this.connectTo({...t,model:n})}async shutdown(e){await this._kernelAPIClient.shutdown(e),await this.refreshRunning()}async shutdownAll(){await this.refreshRunning(),await Promise.all([...this._models.keys()].map(e=>this._kernelAPIClient.shutdown(e))),await this.refreshRunning()}async findById(e){return this._models.has(e)?this._models.get(e):(await this.refreshRunning(),this._models.get(e))}async requestRunning(){var e,t;let n;try{n=await this._kernelAPIClient.listRunning()}catch(s){throw(s instanceof Jr.ServerConnection.NetworkError||((e=s.response)===null||e===void 0?void 0:e.status)===503||((t=s.response)===null||t===void 0?void 0:t.status)===424)&&this._connectionFailure.emit(s),s}this.isDisposed||this._models.size===n.length&&n.every(s=>{let r=this._models.get(s.id);return r?r.connections===s.connections&&r.execution_state===s.execution_state&&r.last_activity===s.last_activity&&r.name===s.name&&r.reason===s.reason&&r.traceback===s.traceback:!1})||(this._models=new Map(n.map(s=>[s.id,s])),this._kernelConnections.forEach(s=>{this._models.has(s.id)||s.handleShutdown()}),this._runningChanged.emit(n))}_onStarted(e){this._kernelConnections.add(e),e.statusChanged.connect(this._onStatusChanged,this),e.disposed.connect(this._onDisposed,this)}_onDisposed(e){this._kernelConnections.delete(e),this.refreshRunning().catch(()=>{})}_onStatusChanged(e,t){t==="dead"&&this.refreshRunning().catch(()=>{})}};bt.KernelManager=wt;(function(i){class e extends i{constructor(){super(...arguments),this._readyPromise=new Promise(()=>{})}get isActive(){return!1}get parentReady(){return super.ready}async startNew(n={},s={}){return Promise.reject(new Error("Not implemented in no-op Kernel Manager"))}connectTo(n){throw new Error("Not implemented in no-op Kernel Manager")}async shutdown(n){return Promise.reject(new Error("Not implemented in no-op Kernel Manager"))}get ready(){return this.parentReady.then(()=>this._readyPromise)}async requestRunning(){return Promise.resolve()}}i.NoopManager=e})(wt||(bt.KernelManager=wt={}))});var Oi=E(H=>{"use strict";var Gr=H&&H.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),vc=H&&H.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),Ri=H&&H.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&Gr(e,i,t);return vc(e,i),e},yc=H&&H.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Gr(e,i,t)};Object.defineProperty(H,"__esModule",{value:!0});H.CommsOverSubshells=H.KernelConnection=H.KernelAPI=H.KernelMessage=H.Kernel=void 0;var wc=xi();Object.defineProperty(H,"CommsOverSubshells",{enumerable:!0,get:function(){return wc.CommsOverSubshells}});var bc=Ri(Mr());H.Kernel=bc;var Sc=Ri(st());H.KernelMessage=Sc;var xc=Ri(wn());H.KernelAPI=xc;var Cc=Ii();Object.defineProperty(H,"KernelConnection",{enumerable:!0,get:function(){return Cc.KernelConnection}});yc(Hr(),H)});var Xr=E(Yr=>{"use strict";Object.defineProperty(Yr,"__esModule",{value:!0})});var Qr=E(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.KernelSpecManager=void 0;var kc=te(),Pc=Xe(),Zr=Z(),Mc=Ye(),Ec=vt(),Di=class extends Mc.BaseManager{constructor(e={}){var t,n;super(e),this._isReady=!1,this._connectionFailure=new Zr.Signal(this),this._specs=null,this._specsChanged=new Zr.Signal(this),this._kernelSpecAPIClient=(t=e.kernelSpecAPIClient)!==null&&t!==void 0?t:new Ec.KernelSpecAPIClient({serverSettings:this.serverSettings}),this._ready=Promise.all([this.requestSpecs()]).then(s=>{}).catch(s=>{}).then(()=>{this.isDisposed||(this._isReady=!0)}),this._pollSpecs=new Pc.Poll({auto:!1,factory:()=>this.requestSpecs(),frequency:{interval:61*1e3,backoff:!0,max:300*1e3},name:"@jupyterlab/services:KernelSpecManager#specs",standby:(n=e.standby)!==null&&n!==void 0?n:"when-hidden"}),this.ready.then(()=>{this._pollSpecs.start()})}get isReady(){return this._isReady}get ready(){return this._ready}get specs(){return this._specs}get specsChanged(){return this._specsChanged}get connectionFailure(){return this._connectionFailure}dispose(){this._pollSpecs.dispose(),super.dispose()}async refreshSpecs(){await this._pollSpecs.refresh(),await this._pollSpecs.tick}async requestSpecs(){let e=await this._kernelSpecAPIClient.get();this.isDisposed||kc.JSONExt.deepEqual(e,this._specs)||(this._specs=e,this._specsChanged.emit(e))}};xn.KernelSpecManager=Di});var ji=E(pe=>{"use strict";var ea=pe&&pe.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),Ic=pe&&pe.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),ta=pe&&pe.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&ea(e,i,t);return Ic(e,i),e},Rc=pe&&pe.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&ea(e,i,t)};Object.defineProperty(pe,"__esModule",{value:!0});pe.KernelSpecAPI=pe.KernelSpec=void 0;var Oc=ta(Xr());pe.KernelSpec=Oc;var Dc=ta(vt());pe.KernelSpecAPI=Dc;Rc(Qr(),pe)});var na=E(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});Cn.BuildManager=void 0;var Ti=J(),Je=de(),jc="api/build",qi=class{constructor(e={}){var t;this._url="",this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Je.ServerConnection.makeSettings();let{baseUrl:n,appUrl:s}=this.serverSettings;this._url=Ti.URLExt.join(n,s,jc)}get isAvailable(){return Ti.PageConfig.getOption("buildAvailable").toLowerCase()==="true"}get shouldCheck(){return Ti.PageConfig.getOption("buildCheck").toLowerCase()==="true"}getStatus(){let{_url:e,serverSettings:t}=this;return Je.ServerConnection.makeRequest(e,{},t).then(s=>{if(s.status!==200)throw new Je.ServerConnection.ResponseError(s);return s.json()}).then(s=>{if(typeof s.status!="string")throw new Error("Invalid data");if(typeof s.message!="string")throw new Error("Invalid data");return s})}build(){let{_url:e,serverSettings:t}=this,n={method:"POST"};return Je.ServerConnection.makeRequest(e,n,t).then(r=>{if(r.status===400)throw new Je.ServerConnection.ResponseError(r,"Build aborted");if(r.status!==200){let a=`Build failed with ${r.status}.
|
|
4
4
|
|
|
5
5
|
If you are experiencing the build failure after installing an extension (or trying to include previously installed extension after updating JupyterLab) please check the extension repository for new installation instructions as many extensions migrated to the prebuilt extensions system which no longer requires rebuilding JupyterLab (but uses a different installation procedure, typically involving a package manager such as 'pip' or 'conda').
|
|
6
6
|
|
|
7
|
-
If you specifically intended to install a source extension, please run 'jupyter lab build' on the server for full output.`;throw new Je.ServerConnection.ResponseError(r,a)}})}cancel(){let{_url:e,serverSettings:t}=this,n={method:"DELETE"};return Je.ServerConnection.makeRequest(e,n,t).then(r=>{if(r.status!==204)throw new Je.ServerConnection.ResponseError(r)})}};Cn.BuildManager=Ti});var Ni=E(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.NbConvertManager=void 0;var qi=J(),Ui=de(),Tc=te(),qc="api/nbconvert",Uc="nbconvert",Ai=class{constructor(e={}){var t;this._exportFormats=null,this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Ui.ServerConnection.makeSettings()}async fetchExportFormats(){this._requestingFormats=new Tc.PromiseDelegate,this._exportFormats=null;let e=this.serverSettings.baseUrl,t=qi.URLExt.join(e,qc),{serverSettings:n}=this,s=await Ui.ServerConnection.makeRequest(t,{},n);if(s.status!==200)throw await Ui.ServerConnection.ResponseError.create(s);let r=await s.json(),a={};return Object.keys(r).forEach(function(u){let c=r[u].output_mimetype;a[u]={output_mimetype:c}}),this._exportFormats=a,this._requestingFormats.resolve(a),a}async getExportFormats(e=!0){return this._requestingFormats?this._requestingFormats.promise:e||!this._exportFormats?await this.fetchExportFormats():this._exportFormats}async exportAs(e){let{format:t,path:n}=e,{download:s=!1}=e.exporterOptions||{},r=this.serverSettings.baseUrl,a=qi.URLExt.encodeParts(n),o=qi.URLExt.join(r,Uc,t,a);s&&(o+="?download=true"),window==null||window.open(o,"_blank","noopener")}};kn.NbConvertManager=Ai});var ia=E(na=>{"use strict";Object.defineProperty(na,"__esModule",{value:!0})});var ra=E(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.validateModel=sa;xt.updateLegacySessionModel=Nc;xt.validateModels=Lc;var Ac=vn(),St=ht();function sa(i){(0,St.validateProperty)(i,"id","string"),(0,St.validateProperty)(i,"type","string"),(0,St.validateProperty)(i,"name","string"),(0,St.validateProperty)(i,"path","string"),(0,St.validateProperty)(i,"kernel","object"),(0,Ac.validateModel)(i.kernel)}function Nc(i){i.path===void 0&&i.notebook!==void 0&&(i.path=i.notebook.path,i.type="notebook",i.name="")}function Lc(i){if(!Array.isArray(i))throw new Error("Invalid session list");i.forEach(e=>sa(e))}});var En=E(he=>{"use strict";Object.defineProperty(he,"__esModule",{value:!0});he.SessionAPIClient=he.SESSION_SERVICE_URL=void 0;he.listRunning=aa;he.getSessionUrl=Mn;he.shutdownSession=oa;he.getSessionModel=la;he.startSession=ca;he.updateSession=da;var re=de(),Pn=J(),He=ra();he.SESSION_SERVICE_URL="api/sessions";async function aa(i=re.ServerConnection.makeSettings()){let e=Pn.URLExt.join(i.baseUrl,he.SESSION_SERVICE_URL),t=await re.ServerConnection.makeRequest(e,{},i);if(t.status!==200)throw await re.ServerConnection.ResponseError.create(t);let n=await t.json();if(!Array.isArray(n))throw new Error("Invalid Session list");return n.forEach(s=>{(0,He.updateLegacySessionModel)(s),(0,He.validateModel)(s)}),n}function Mn(i,e){let t=Pn.URLExt.join(i,he.SESSION_SERVICE_URL),n=Pn.URLExt.join(t,e);if(!n.startsWith(t))throw new Error("Can only be used for services requests");return n}async function oa(i,e=re.ServerConnection.makeSettings()){var t;let n=Mn(e.baseUrl,i),s={method:"DELETE"},r=await re.ServerConnection.makeRequest(n,s,e);if(r.status===404){let o=(t=(await r.json()).message)!==null&&t!==void 0?t:`The session "${i}"" does not exist on the server`;console.warn(o)}else{if(r.status===410)throw new re.ServerConnection.ResponseError(r,"The kernel was deleted but the session was not");if(r.status!==204)throw await re.ServerConnection.ResponseError.create(r)}}async function la(i,e=re.ServerConnection.makeSettings()){let t=Mn(e.baseUrl,i),n=await re.ServerConnection.makeRequest(t,{},e);if(n.status!==200)throw await re.ServerConnection.ResponseError.create(n);let s=await n.json();return(0,He.updateLegacySessionModel)(s),(0,He.validateModel)(s),s}async function ca(i,e=re.ServerConnection.makeSettings()){let t=Pn.URLExt.join(e.baseUrl,he.SESSION_SERVICE_URL),n={method:"POST",body:JSON.stringify(i)},s=await re.ServerConnection.makeRequest(t,n,e);if(s.status!==201)throw await re.ServerConnection.ResponseError.create(s);let r=await s.json();return(0,He.updateLegacySessionModel)(r),(0,He.validateModel)(r),r}async function da(i,e=re.ServerConnection.makeSettings()){let t=Mn(e.baseUrl,i.id),n={method:"PATCH",body:JSON.stringify(i)},s=await re.ServerConnection.makeRequest(t,n,e);if(s.status!==200)throw await re.ServerConnection.ResponseError.create(s);let r=await s.json();return(0,He.updateLegacySessionModel)(r),(0,He.validateModel)(r),r}var Li=class{constructor(e){var t;this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:re.ServerConnection.makeSettings()}async listRunning(){return aa(this.serverSettings)}async getModel(e){return la(e,this.serverSettings)}async startNew(e){return ca(e,this.serverSettings)}async shutdown(e){return oa(e,this.serverSettings)}async update(e){return da(e,this.serverSettings)}};he.SessionAPIClient=Li});var ua=E(In=>{"use strict";Object.defineProperty(In,"__esModule",{value:!0});In.SessionConnection=void 0;var Ae=Z(),zc=Te(),Fc=te(),Kc=En(),zi=class{constructor(e){var t,n,s,r,a;this._id="",this._path="",this._name="",this._type="",this._kernel=null,this._isDisposed=!1,this._disposed=new Ae.Signal(this),this._kernelChanged=new Ae.Signal(this),this._statusChanged=new Ae.Signal(this),this._connectionStatusChanged=new Ae.Signal(this),this._pendingInput=new Ae.Signal(this),this._iopubMessage=new Ae.Signal(this),this._unhandledMessage=new Ae.Signal(this),this._anyMessage=new Ae.Signal(this),this._propertyChanged=new Ae.Signal(this),this._id=e.model.id,this._name=e.model.name,this._path=e.model.path,this._type=e.model.type,this._username=(t=e.username)!==null&&t!==void 0?t:"",this._clientId=(n=e.clientId)!==null&&n!==void 0?n:Fc.UUID.uuid4(),this._connectToKernel=e.connectToKernel,this._kernelConnectionOptions=(s=e.kernelConnectionOptions)!==null&&s!==void 0?s:{},this.serverSettings=(r=e.serverSettings)!==null&&r!==void 0?r:zc.ServerConnection.makeSettings(),this._sessionAPIClient=(a=e.sessionAPIClient)!==null&&a!==void 0?a:new Kc.SessionAPIClient({serverSettings:this.serverSettings}),this.setupKernel(e.model.kernel)}get disposed(){return this._disposed}get kernelChanged(){return this._kernelChanged}get statusChanged(){return this._statusChanged}get connectionStatusChanged(){return this._connectionStatusChanged}get pendingInput(){return this._pendingInput}get iopubMessage(){return this._iopubMessage}get unhandledMessage(){return this._unhandledMessage}get anyMessage(){return this._anyMessage}get propertyChanged(){return this._propertyChanged}get id(){return this._id}get kernel(){return this._kernel}get path(){return this._path}get type(){return this._type}get name(){return this._name}get model(){return{id:this.id,kernel:this.kernel&&{id:this.kernel.id,name:this.kernel.name},path:this._path,type:this._type,name:this._name}}get isDisposed(){return this._isDisposed}update(e){let t=this.model;if(this._path=e.path,this._name=e.name,this._type=e.type,this._kernel===null&&e.kernel!==null||this._kernel!==null&&e.kernel===null||this._kernel!==null&&e.kernel!==null&&this._kernel.id!==e.kernel.id){this._kernel!==null&&this._kernel.dispose();let n=this._kernel||null;this.setupKernel(e.kernel);let s=this._kernel||null;this._kernelChanged.emit({name:"kernel",oldValue:n,newValue:s})}this._handleModelChange(t)}dispose(){if(!this.isDisposed){if(this._isDisposed=!0,this._disposed.emit(),this._kernel){this._kernel.dispose();let e=this._kernel;this._kernel=null;let t=this._kernel;this._kernelChanged.emit({name:"kernel",oldValue:e,newValue:t})}Ae.Signal.clearData(this)}}async setPath(e){if(this.isDisposed)throw new Error("Session is disposed");await this._patch({path:e})}async setName(e){if(this.isDisposed)throw new Error("Session is disposed");await this._patch({name:e})}async setType(e){if(this.isDisposed)throw new Error("Session is disposed");await this._patch({type:e})}async changeKernel(e){if(this.isDisposed)throw new Error("Session is disposed");return await this._patch({kernel:e}),this.kernel}async shutdown(){if(this.isDisposed)throw new Error("Session is disposed");await this._sessionAPIClient.shutdown(this.id),this.dispose()}setupKernel(e){if(e===null){this._kernel=null;return}let t=this._connectToKernel({...this._kernelConnectionOptions,model:e,username:this._username,clientId:this._clientId,serverSettings:this.serverSettings});this._kernel=t,t.statusChanged.connect(this.onKernelStatus,this),t.connectionStatusChanged.connect(this.onKernelConnectionStatus,this),t.pendingInput.connect(this.onPendingInput,this),t.unhandledMessage.connect(this.onUnhandledMessage,this),t.iopubMessage.connect(this.onIOPubMessage,this),t.anyMessage.connect(this.onAnyMessage,this)}onKernelStatus(e,t){this._statusChanged.emit(t)}onKernelConnectionStatus(e,t){this._connectionStatusChanged.emit(t)}onPendingInput(e,t){this._pendingInput.emit(t)}onIOPubMessage(e,t){this._iopubMessage.emit(t)}onUnhandledMessage(e,t){this._unhandledMessage.emit(t)}onAnyMessage(e,t){this._anyMessage.emit(t)}async _patch(e){let t=await this._sessionAPIClient.update({...e,id:this._id});return this.update(t),t}_handleModelChange(e){e.name!==this._name&&this._propertyChanged.emit("name"),e.type!==this._type&&this._propertyChanged.emit("type"),e.path!==this._path&&this._propertyChanged.emit("path")}};In.SessionConnection=zi});var ha=E(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.SessionManager=void 0;var Bc=Xe(),pa=Z(),$c=de(),Vc=Ye(),Wc=ua(),Jc=En(),Ct=class extends Vc.BaseManager{constructor(e){var t,n;super(e),this._isReady=!1,this._sessionConnections=new Set,this._models=new Map,this._runningChanged=new pa.Signal(this),this._connectionFailure=new pa.Signal(this),this._connectToKernel=s=>this._kernelManager.connectTo(s),this._kernelManager=e.kernelManager,this._sessionAPIClient=(t=e.sessionAPIClient)!==null&&t!==void 0?t:new Jc.SessionAPIClient({serverSettings:e.serverSettings}),this._pollModels=new Bc.Poll({auto:!1,factory:()=>this.requestRunning(),frequency:{interval:10*1e3,backoff:!0,max:300*1e3},name:"@jupyterlab/services:SessionManager#models",standby:(n=e.standby)!==null&&n!==void 0?n:"when-hidden"}),this._ready=(async()=>{await this._pollModels.start(),await this._pollModels.tick,this._kernelManager.isActive&&await this._kernelManager.ready,this._isReady=!0})()}get isReady(){return this._isReady}get ready(){return this._ready}get runningChanged(){return this._runningChanged}get connectionFailure(){return this._connectionFailure}dispose(){this.isDisposed||(this._models.clear(),this._sessionConnections.forEach(e=>e.dispose()),this._pollModels.dispose(),super.dispose())}connectTo(e){let t=new Wc.SessionConnection({...e,connectToKernel:this._connectToKernel,serverSettings:this.serverSettings,sessionAPIClient:this._sessionAPIClient});return this._onStarted(t),this._models.has(e.model.id)||this.refreshRunning().catch(()=>{}),t}running(){return this._models.values()}async refreshRunning(){await this._pollModels.refresh(),await this._pollModels.tick}async startNew(e,t={}){let n=await this._sessionAPIClient.startNew(e);return await this.refreshRunning(),this.connectTo({...t,model:n})}async shutdown(e){await this._sessionAPIClient.shutdown(e),await this.refreshRunning()}async shutdownAll(){await this.refreshRunning(),await Promise.all([...this._models.keys()].map(e=>this._sessionAPIClient.shutdown(e))),await this.refreshRunning()}async stopIfNeeded(e){try{let n=(await this._sessionAPIClient.listRunning()).filter(s=>s.path===e);if(n.length===1){let s=n[0].id;await this.shutdown(s)}}catch{}}async findById(e){return this._models.has(e)?this._models.get(e):(await this.refreshRunning(),this._models.get(e))}async findByPath(e){for(let t of this._models.values())if(t.path===e)return t;await this.refreshRunning();for(let t of this._models.values())if(t.path===e)return t}async requestRunning(){var e,t;let n;try{n=await this._sessionAPIClient.listRunning()}catch(s){throw(s instanceof $c.ServerConnection.NetworkError||((e=s.response)===null||e===void 0?void 0:e.status)===503||((t=s.response)===null||t===void 0?void 0:t.status)===424)&&this._connectionFailure.emit(s),s}this.isDisposed||this._models.size===n.length&&n.every(s=>{var r,a,o,u;let c=this._models.get(s.id);return c?((r=c.kernel)===null||r===void 0?void 0:r.id)===((a=s.kernel)===null||a===void 0?void 0:a.id)&&((o=c.kernel)===null||o===void 0?void 0:o.name)===((u=s.kernel)===null||u===void 0?void 0:u.name)&&c.name===s.name&&c.path===s.path&&c.type===s.type:!1})||(this._models=new Map(n.map(s=>[s.id,s])),this._sessionConnections.forEach(s=>{this._models.has(s.id)?s.update(this._models.get(s.id)):s.dispose()}),this._runningChanged.emit(n))}_onStarted(e){this._sessionConnections.add(e),e.disposed.connect(this._onDisposed,this),e.propertyChanged.connect(this._onChanged,this),e.kernelChanged.connect(this._onChanged,this)}_onDisposed(e){this._sessionConnections.delete(e),this.refreshRunning().catch(()=>{})}_onChanged(){this.refreshRunning().catch(()=>{})}};kt.SessionManager=Ct;(function(i){class e extends i{constructor(){super(...arguments),this._readyPromise=new Promise(()=>{})}get isActive(){return!1}get parentReady(){return super.ready}async startNew(n,s={}){return Promise.reject(new Error("Not implemented in no-op Session Manager"))}connectTo(n){throw Error("Not implemented in no-op Session Manager")}get ready(){return this.parentReady.then(()=>this._readyPromise)}async shutdown(n){return Promise.reject(new Error("Not implemented in no-op Session Manager"))}async requestRunning(){return Promise.resolve()}}i.NoopManager=e})(Ct||(kt.SessionManager=Ct={}))});var Fi=E(fe=>{"use strict";var fa=fe&&fe.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),Hc=fe&&fe.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),ma=fe&&fe.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&fa(e,i,t);return Hc(e,i),e},Gc=fe&&fe.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&fa(e,i,t)};Object.defineProperty(fe,"__esModule",{value:!0});fe.SessionAPI=fe.Session=void 0;var Yc=ma(ia());fe.Session=Yc;var Xc=ma(En());fe.SessionAPI=Xc;Gc(ha(),fe)});var ga=E(Rn=>{"use strict";Object.defineProperty(Rn,"__esModule",{value:!0});Rn.DataConnector=void 0;var Ki=class{async list(e){throw new Error("DataConnector#list method has not been implemented.")}async remove(e){throw new Error("DataConnector#remove method has not been implemented.")}async save(e,t){throw new Error("DataConnector#save method has not been implemented.")}};Rn.DataConnector=Ki});var va=E(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0})});var wa=E((On,ya)=>{(function(i,e){typeof On=="object"&&typeof ya!="undefined"?e(On):typeof define=="function"&&define.amd?define(["exports"],e):(i=typeof globalThis!="undefined"?globalThis:i||self,e(i.lumino_properties={}))})(On,function(i){"use strict";class e{constructor(s){this._pid=t.nextPID(),this.name=s.name,this._create=s.create,this._coerce=s.coerce||null,this._compare=s.compare||null,this._changed=s.changed||null}get(s){let r,a=t.ensureMap(s);return this._pid in a?r=a[this._pid]:r=a[this._pid]=this._createValue(s),r}set(s,r){let a,o=t.ensureMap(s);this._pid in o?a=o[this._pid]:a=o[this._pid]=this._createValue(s);let u=this._coerceValue(s,r);this._maybeNotify(s,a,o[this._pid]=u)}coerce(s){let r,a=t.ensureMap(s);this._pid in a?r=a[this._pid]:r=a[this._pid]=this._createValue(s);let o=this._coerceValue(s,r);this._maybeNotify(s,r,a[this._pid]=o)}_createValue(s){let r=this._create;return r(s)}_coerceValue(s,r){let a=this._coerce;return a?a(s,r):r}_compareValue(s,r){let a=this._compare;return a?a(s,r):s===r}_maybeNotify(s,r,a){let o=this._changed;o&&!this._compareValue(r,a)&&o(s,r,a)}}(function(n){function s(r){t.ownerData.delete(r)}n.clearData=s})(e||(e={}));var t;(function(n){n.ownerData=new WeakMap,n.nextPID=(()=>{let r=0;return()=>`pid-${`${Math.random()}`.slice(2)}-${r++}`})();function s(r){let a=n.ownerData.get(r);return a||(a=Object.create(null),n.ownerData.set(r,a),a)}n.ensureMap=s})(t||(t={})),i.AttachedProperty=e})});var Sa=E(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});jn.RestorablePool=void 0;var Zc=te(),ba=wa(),Dn=Z(),Bi=class{constructor(e){this._added=new Dn.Signal(this),this._current=null,this._currentChanged=new Dn.Signal(this),this._hasRestored=!1,this._isDisposed=!1,this._objects=new Set,this._restore=null,this._restored=new Zc.PromiseDelegate,this._updated=new Dn.Signal(this),this.namespace=e.namespace}get added(){return this._added}get current(){return this._current}set current(e){this._current!==e&&e!==null&&this._objects.has(e)&&(this._current=e,this._currentChanged.emit(this._current))}get currentChanged(){return this._currentChanged}get isDisposed(){return this._isDisposed}get restored(){return this._restored.promise}get size(){return this._objects.size}get updated(){return this._updated}async add(e){var t,n;if(e.isDisposed){let s="A disposed object cannot be added.";throw console.warn(s,e),new Error(s)}if(this._objects.has(e)){let s="This object already exists in the pool.";throw console.warn(s,e),new Error(s)}if(this._objects.add(e),e.disposed.connect(this._onInstanceDisposed,this),!Ne.injectedProperty.get(e)){if(this._restore){let{connector:s}=this._restore,r=this._restore.name(e);if(r){let a=`${this.namespace}:${r}`,o=(n=(t=this._restore).args)===null||n===void 0?void 0:n.call(t,e);Ne.nameProperty.set(e,a),await s.save(a,{data:o})}}this._added.emit(e)}}dispose(){this.isDisposed||(this._current=null,this._isDisposed=!0,this._objects.clear(),Dn.Signal.clearData(this))}find(e){let t=this._objects.values();for(let n of t)if(e(n))return n}forEach(e){this._objects.forEach(e)}filter(e){let t=[];return this.forEach(n=>{e(n)&&t.push(n)}),t}inject(e){return Ne.injectedProperty.set(e,!0),this.add(e)}has(e){return this._objects.has(e)}async restore(e){if(this._hasRestored)throw new Error("This pool has already been restored.");this._hasRestored=!0;let{command:t,connector:n,registry:s,when:r}=e,a=this.namespace,o=r?[n.list(a)].concat(r):[n.list(a)];this._restore=e;let[u]=await Promise.all(o),c=await Promise.all(u.ids.map(async(d,l)=>{let p=u.values[l],v=p&&p.data;return v===void 0?n.remove(d):s.execute(t,v).catch(()=>n.remove(d))}));return this._restored.resolve(),c}async save(e){var t,n;let s=Ne.injectedProperty.get(e);if(!this._restore||!this.has(e)||s)return;let{connector:r}=this._restore,a=this._restore.name(e),o=Ne.nameProperty.get(e),u=a?`${this.namespace}:${a}`:"";if(o&&o!==u&&await r.remove(o),Ne.nameProperty.set(e,u),u){let c=(n=(t=this._restore).args)===null||n===void 0?void 0:n.call(t,e);await r.save(u,{data:c})}o!==u&&this._updated.emit(e)}_onInstanceDisposed(e){if(this._objects.delete(e),e===this._current&&(this._current=null,this._currentChanged.emit(this._current)),Ne.injectedProperty.get(e)||!this._restore)return;let{connector:t}=this._restore,n=Ne.nameProperty.get(e);n&&t.remove(n)}};jn.RestorablePool=Bi;var Ne;(function(i){i.injectedProperty=new ba.AttachedProperty({name:"injected",create:()=>!1}),i.nameProperty=new ba.AttachedProperty({name:"name",create:()=>""})})(Ne||(Ne={}))});var xa=E(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.StateDB=void 0;var Qc=Z(),Pt=class i{constructor(e={}){this._changed=new Qc.Signal(this);let{connector:t,transform:n}=e;this._connector=t||new i.Connector,n?this._ready=n.then(s=>{let{contents:r,type:a}=s;switch(a){case"cancel":return;case"clear":return this._clear();case"merge":return this._merge(r||{});case"overwrite":return this._overwrite(r||{});default:return}}):this._ready=Promise.resolve(void 0)}get changed(){return this._changed}async clear(){await this._ready,await this._clear()}async fetch(e){return await this._ready,this._fetch(e)}async list(e){return await this._ready,this._list(e)}async remove(e){await this._ready,await this._remove(e),this._changed.emit({id:e,type:"remove"})}async save(e,t){await this._ready,await this._save(e,t),this._changed.emit({id:e,type:"save"})}async toJSON(){await this._ready;let{ids:e,values:t}=await this._list();return t.reduce((n,s,r)=>(n[e[r]]=s,n),{})}async _clear(){await Promise.all((await this._list()).ids.map(e=>this._remove(e)))}async _fetch(e){let t=await this._connector.fetch(e);if(t)return JSON.parse(t).v}async _list(e=""){let{ids:t,values:n}=await this._connector.list(e);return{ids:t,values:n.map(s=>JSON.parse(s).v)}}async _merge(e){await Promise.all(Object.keys(e).map(t=>e[t]&&this._save(t,e[t])))}async _overwrite(e){await this._clear(),await this._merge(e)}async _remove(e){return this._connector.remove(e)}async _save(e,t){return this._connector.save(e,JSON.stringify({v:t}))}};Mt.StateDB=Pt;(function(i){class e{constructor(){this._storage={}}async fetch(n){return this._storage[n]}async list(n=""){return Object.keys(this._storage).reduce((s,r)=>((n===""||n===r.split(":")[0])&&(s.ids.push(r),s.values.push(this._storage[r])),s),{ids:[],values:[]})}async remove(n){delete this._storage[n]}async save(n,s){this._storage[n]=s}}i.Connector=e})(Pt||(Mt.StateDB=Pt={}))});var Ca=E(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.IStateDB=void 0;var ed=te();Tn.IStateDB=new ed.Token("@jupyterlab/coreutils:IStateDB",`A service for the JupyterLab state database.
|
|
7
|
+
If you specifically intended to install a source extension, please run 'jupyter lab build' on the server for full output.`;throw new Je.ServerConnection.ResponseError(r,a)}})}cancel(){let{_url:e,serverSettings:t}=this,n={method:"DELETE"};return Je.ServerConnection.makeRequest(e,n,t).then(r=>{if(r.status!==204)throw new Je.ServerConnection.ResponseError(r)})}};Cn.BuildManager=qi});var Li=E(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.NbConvertManager=void 0;var Ui=J(),Ai=de(),Tc=te(),qc="api/nbconvert",Uc="nbconvert",Ni=class{constructor(e={}){var t;this._exportFormats=null,this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Ai.ServerConnection.makeSettings()}async fetchExportFormats(){this._requestingFormats=new Tc.PromiseDelegate,this._exportFormats=null;let e=this.serverSettings.baseUrl,t=Ui.URLExt.join(e,qc),{serverSettings:n}=this,s=await Ai.ServerConnection.makeRequest(t,{},n);if(s.status!==200)throw await Ai.ServerConnection.ResponseError.create(s);let r=await s.json(),a={};return Object.keys(r).forEach(function(u){let c=r[u].output_mimetype;a[u]={output_mimetype:c}}),this._exportFormats=a,this._requestingFormats.resolve(a),a}async getExportFormats(e=!0){return this._requestingFormats?this._requestingFormats.promise:e||!this._exportFormats?await this.fetchExportFormats():this._exportFormats}async exportAs(e){let{format:t,path:n}=e,{download:s=!1}=e.exporterOptions||{},r=this.serverSettings.baseUrl,a=Ui.URLExt.encodeParts(n),o=Ui.URLExt.join(r,Uc,t,a);s&&(o+="?download=true"),window==null||window.open(o,"_blank","noopener")}};kn.NbConvertManager=Ni});var sa=E(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0})});var aa=E(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.validateModel=ra;xt.updateLegacySessionModel=Nc;xt.validateModels=Lc;var Ac=vn(),St=ht();function ra(i){(0,St.validateProperty)(i,"id","string"),(0,St.validateProperty)(i,"type","string"),(0,St.validateProperty)(i,"name","string"),(0,St.validateProperty)(i,"path","string"),(0,St.validateProperty)(i,"kernel","object"),(0,Ac.validateModel)(i.kernel)}function Nc(i){i.path===void 0&&i.notebook!==void 0&&(i.path=i.notebook.path,i.type="notebook",i.name="")}function Lc(i){if(!Array.isArray(i))throw new Error("Invalid session list");i.forEach(e=>ra(e))}});var En=E(he=>{"use strict";Object.defineProperty(he,"__esModule",{value:!0});he.SessionAPIClient=he.SESSION_SERVICE_URL=void 0;he.listRunning=oa;he.getSessionUrl=Mn;he.shutdownSession=la;he.getSessionModel=ca;he.startSession=da;he.updateSession=ua;var re=de(),Pn=J(),He=aa();he.SESSION_SERVICE_URL="api/sessions";async function oa(i=re.ServerConnection.makeSettings()){let e=Pn.URLExt.join(i.baseUrl,he.SESSION_SERVICE_URL),t=await re.ServerConnection.makeRequest(e,{},i);if(t.status!==200)throw await re.ServerConnection.ResponseError.create(t);let n=await t.json();if(!Array.isArray(n))throw new Error("Invalid Session list");return n.forEach(s=>{(0,He.updateLegacySessionModel)(s),(0,He.validateModel)(s)}),n}function Mn(i,e){let t=Pn.URLExt.join(i,he.SESSION_SERVICE_URL),n=Pn.URLExt.join(t,e);if(!n.startsWith(t))throw new Error("Can only be used for services requests");return n}async function la(i,e=re.ServerConnection.makeSettings()){var t;let n=Mn(e.baseUrl,i),s={method:"DELETE"},r=await re.ServerConnection.makeRequest(n,s,e);if(r.status===404){let o=(t=(await r.json()).message)!==null&&t!==void 0?t:`The session "${i}"" does not exist on the server`;console.warn(o)}else{if(r.status===410)throw new re.ServerConnection.ResponseError(r,"The kernel was deleted but the session was not");if(r.status!==204)throw await re.ServerConnection.ResponseError.create(r)}}async function ca(i,e=re.ServerConnection.makeSettings()){let t=Mn(e.baseUrl,i),n=await re.ServerConnection.makeRequest(t,{},e);if(n.status!==200)throw await re.ServerConnection.ResponseError.create(n);let s=await n.json();return(0,He.updateLegacySessionModel)(s),(0,He.validateModel)(s),s}async function da(i,e=re.ServerConnection.makeSettings()){let t=Pn.URLExt.join(e.baseUrl,he.SESSION_SERVICE_URL),n={method:"POST",body:JSON.stringify(i)},s=await re.ServerConnection.makeRequest(t,n,e);if(s.status!==201)throw await re.ServerConnection.ResponseError.create(s);let r=await s.json();return(0,He.updateLegacySessionModel)(r),(0,He.validateModel)(r),r}async function ua(i,e=re.ServerConnection.makeSettings()){let t=Mn(e.baseUrl,i.id),n={method:"PATCH",body:JSON.stringify(i)},s=await re.ServerConnection.makeRequest(t,n,e);if(s.status!==200)throw await re.ServerConnection.ResponseError.create(s);let r=await s.json();return(0,He.updateLegacySessionModel)(r),(0,He.validateModel)(r),r}var zi=class{constructor(e){var t;this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:re.ServerConnection.makeSettings()}async listRunning(){return oa(this.serverSettings)}async getModel(e){return ca(e,this.serverSettings)}async startNew(e){return da(e,this.serverSettings)}async shutdown(e){return la(e,this.serverSettings)}async update(e){return ua(e,this.serverSettings)}};he.SessionAPIClient=zi});var pa=E(In=>{"use strict";Object.defineProperty(In,"__esModule",{value:!0});In.SessionConnection=void 0;var Ae=Z(),zc=Te(),Fc=te(),Kc=En(),Fi=class{constructor(e){var t,n,s,r,a;this._id="",this._path="",this._name="",this._type="",this._kernel=null,this._isDisposed=!1,this._disposed=new Ae.Signal(this),this._kernelChanged=new Ae.Signal(this),this._statusChanged=new Ae.Signal(this),this._connectionStatusChanged=new Ae.Signal(this),this._pendingInput=new Ae.Signal(this),this._iopubMessage=new Ae.Signal(this),this._unhandledMessage=new Ae.Signal(this),this._anyMessage=new Ae.Signal(this),this._propertyChanged=new Ae.Signal(this),this._id=e.model.id,this._name=e.model.name,this._path=e.model.path,this._type=e.model.type,this._username=(t=e.username)!==null&&t!==void 0?t:"",this._clientId=(n=e.clientId)!==null&&n!==void 0?n:Fc.UUID.uuid4(),this._connectToKernel=e.connectToKernel,this._kernelConnectionOptions=(s=e.kernelConnectionOptions)!==null&&s!==void 0?s:{},this.serverSettings=(r=e.serverSettings)!==null&&r!==void 0?r:zc.ServerConnection.makeSettings(),this._sessionAPIClient=(a=e.sessionAPIClient)!==null&&a!==void 0?a:new Kc.SessionAPIClient({serverSettings:this.serverSettings}),this.setupKernel(e.model.kernel)}get disposed(){return this._disposed}get kernelChanged(){return this._kernelChanged}get statusChanged(){return this._statusChanged}get connectionStatusChanged(){return this._connectionStatusChanged}get pendingInput(){return this._pendingInput}get iopubMessage(){return this._iopubMessage}get unhandledMessage(){return this._unhandledMessage}get anyMessage(){return this._anyMessage}get propertyChanged(){return this._propertyChanged}get id(){return this._id}get kernel(){return this._kernel}get path(){return this._path}get type(){return this._type}get name(){return this._name}get model(){return{id:this.id,kernel:this.kernel&&{id:this.kernel.id,name:this.kernel.name},path:this._path,type:this._type,name:this._name}}get isDisposed(){return this._isDisposed}update(e){let t=this.model;if(this._path=e.path,this._name=e.name,this._type=e.type,this._kernel===null&&e.kernel!==null||this._kernel!==null&&e.kernel===null||this._kernel!==null&&e.kernel!==null&&this._kernel.id!==e.kernel.id){this._kernel!==null&&this._kernel.dispose();let n=this._kernel||null;this.setupKernel(e.kernel);let s=this._kernel||null;this._kernelChanged.emit({name:"kernel",oldValue:n,newValue:s})}this._handleModelChange(t)}dispose(){if(!this.isDisposed){if(this._isDisposed=!0,this._disposed.emit(),this._kernel){this._kernel.dispose();let e=this._kernel;this._kernel=null;let t=this._kernel;this._kernelChanged.emit({name:"kernel",oldValue:e,newValue:t})}Ae.Signal.clearData(this)}}async setPath(e){if(this.isDisposed)throw new Error("Session is disposed");await this._patch({path:e})}async setName(e){if(this.isDisposed)throw new Error("Session is disposed");await this._patch({name:e})}async setType(e){if(this.isDisposed)throw new Error("Session is disposed");await this._patch({type:e})}async changeKernel(e){if(this.isDisposed)throw new Error("Session is disposed");return await this._patch({kernel:e}),this.kernel}async shutdown(){if(this.isDisposed)throw new Error("Session is disposed");await this._sessionAPIClient.shutdown(this.id),this.dispose()}setupKernel(e){if(e===null){this._kernel=null;return}let t=this._connectToKernel({...this._kernelConnectionOptions,model:e,username:this._username,clientId:this._clientId,serverSettings:this.serverSettings});this._kernel=t,t.statusChanged.connect(this.onKernelStatus,this),t.connectionStatusChanged.connect(this.onKernelConnectionStatus,this),t.pendingInput.connect(this.onPendingInput,this),t.unhandledMessage.connect(this.onUnhandledMessage,this),t.iopubMessage.connect(this.onIOPubMessage,this),t.anyMessage.connect(this.onAnyMessage,this)}onKernelStatus(e,t){this._statusChanged.emit(t)}onKernelConnectionStatus(e,t){this._connectionStatusChanged.emit(t)}onPendingInput(e,t){this._pendingInput.emit(t)}onIOPubMessage(e,t){this._iopubMessage.emit(t)}onUnhandledMessage(e,t){this._unhandledMessage.emit(t)}onAnyMessage(e,t){this._anyMessage.emit(t)}async _patch(e){let t=await this._sessionAPIClient.update({...e,id:this._id});return this.update(t),t}_handleModelChange(e){e.name!==this._name&&this._propertyChanged.emit("name"),e.type!==this._type&&this._propertyChanged.emit("type"),e.path!==this._path&&this._propertyChanged.emit("path")}};In.SessionConnection=Fi});var fa=E(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.SessionManager=void 0;var Bc=Xe(),ha=Z(),$c=de(),Vc=Ye(),Wc=pa(),Jc=En(),Ct=class extends Vc.BaseManager{constructor(e){var t,n;super(e),this._isReady=!1,this._sessionConnections=new Set,this._models=new Map,this._runningChanged=new ha.Signal(this),this._connectionFailure=new ha.Signal(this),this._connectToKernel=s=>this._kernelManager.connectTo(s),this._kernelManager=e.kernelManager,this._sessionAPIClient=(t=e.sessionAPIClient)!==null&&t!==void 0?t:new Jc.SessionAPIClient({serverSettings:e.serverSettings}),this._pollModels=new Bc.Poll({auto:!1,factory:()=>this.requestRunning(),frequency:{interval:10*1e3,backoff:!0,max:300*1e3},name:"@jupyterlab/services:SessionManager#models",standby:(n=e.standby)!==null&&n!==void 0?n:"when-hidden"}),this._ready=(async()=>{await this._pollModels.start(),await this._pollModels.tick,this._kernelManager.isActive&&await this._kernelManager.ready,this._isReady=!0})()}get isReady(){return this._isReady}get ready(){return this._ready}get runningChanged(){return this._runningChanged}get connectionFailure(){return this._connectionFailure}dispose(){this.isDisposed||(this._models.clear(),this._sessionConnections.forEach(e=>e.dispose()),this._pollModels.dispose(),super.dispose())}connectTo(e){let t=new Wc.SessionConnection({...e,connectToKernel:this._connectToKernel,serverSettings:this.serverSettings,sessionAPIClient:this._sessionAPIClient});return this._onStarted(t),this._models.has(e.model.id)||this.refreshRunning().catch(()=>{}),t}running(){return this._models.values()}async refreshRunning(){await this._pollModels.refresh(),await this._pollModels.tick}async startNew(e,t={}){let n=await this._sessionAPIClient.startNew(e);return await this.refreshRunning(),this.connectTo({...t,model:n})}async shutdown(e){await this._sessionAPIClient.shutdown(e),await this.refreshRunning()}async shutdownAll(){await this.refreshRunning(),await Promise.all([...this._models.keys()].map(e=>this._sessionAPIClient.shutdown(e))),await this.refreshRunning()}async stopIfNeeded(e){try{let n=(await this._sessionAPIClient.listRunning()).filter(s=>s.path===e);if(n.length===1){let s=n[0].id;await this.shutdown(s)}}catch{}}async findById(e){return this._models.has(e)?this._models.get(e):(await this.refreshRunning(),this._models.get(e))}async findByPath(e){for(let t of this._models.values())if(t.path===e)return t;await this.refreshRunning();for(let t of this._models.values())if(t.path===e)return t}async requestRunning(){var e,t;let n;try{n=await this._sessionAPIClient.listRunning()}catch(s){throw(s instanceof $c.ServerConnection.NetworkError||((e=s.response)===null||e===void 0?void 0:e.status)===503||((t=s.response)===null||t===void 0?void 0:t.status)===424)&&this._connectionFailure.emit(s),s}this.isDisposed||this._models.size===n.length&&n.every(s=>{var r,a,o,u;let c=this._models.get(s.id);return c?((r=c.kernel)===null||r===void 0?void 0:r.id)===((a=s.kernel)===null||a===void 0?void 0:a.id)&&((o=c.kernel)===null||o===void 0?void 0:o.name)===((u=s.kernel)===null||u===void 0?void 0:u.name)&&c.name===s.name&&c.path===s.path&&c.type===s.type:!1})||(this._models=new Map(n.map(s=>[s.id,s])),this._sessionConnections.forEach(s=>{this._models.has(s.id)?s.update(this._models.get(s.id)):s.dispose()}),this._runningChanged.emit(n))}_onStarted(e){this._sessionConnections.add(e),e.disposed.connect(this._onDisposed,this),e.propertyChanged.connect(this._onChanged,this),e.kernelChanged.connect(this._onChanged,this)}_onDisposed(e){this._sessionConnections.delete(e),this.refreshRunning().catch(()=>{})}_onChanged(){this.refreshRunning().catch(()=>{})}};kt.SessionManager=Ct;(function(i){class e extends i{constructor(){super(...arguments),this._readyPromise=new Promise(()=>{})}get isActive(){return!1}get parentReady(){return super.ready}async startNew(n,s={}){return Promise.reject(new Error("Not implemented in no-op Session Manager"))}connectTo(n){throw Error("Not implemented in no-op Session Manager")}get ready(){return this.parentReady.then(()=>this._readyPromise)}async shutdown(n){return Promise.reject(new Error("Not implemented in no-op Session Manager"))}async requestRunning(){return Promise.resolve()}}i.NoopManager=e})(Ct||(kt.SessionManager=Ct={}))});var Ki=E(fe=>{"use strict";var ma=fe&&fe.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),Hc=fe&&fe.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),ga=fe&&fe.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&ma(e,i,t);return Hc(e,i),e},Gc=fe&&fe.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&ma(e,i,t)};Object.defineProperty(fe,"__esModule",{value:!0});fe.SessionAPI=fe.Session=void 0;var Yc=ga(sa());fe.Session=Yc;var Xc=ga(En());fe.SessionAPI=Xc;Gc(fa(),fe)});var _a=E(Rn=>{"use strict";Object.defineProperty(Rn,"__esModule",{value:!0});Rn.DataConnector=void 0;var Bi=class{async list(e){throw new Error("DataConnector#list method has not been implemented.")}async remove(e){throw new Error("DataConnector#remove method has not been implemented.")}async save(e,t){throw new Error("DataConnector#save method has not been implemented.")}};Rn.DataConnector=Bi});var ya=E(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0})});var ba=E((On,wa)=>{(function(i,e){typeof On=="object"&&typeof wa!="undefined"?e(On):typeof define=="function"&&define.amd?define(["exports"],e):(i=typeof globalThis!="undefined"?globalThis:i||self,e(i.lumino_properties={}))})(On,function(i){"use strict";class e{constructor(s){this._pid=t.nextPID(),this.name=s.name,this._create=s.create,this._coerce=s.coerce||null,this._compare=s.compare||null,this._changed=s.changed||null}get(s){let r,a=t.ensureMap(s);return this._pid in a?r=a[this._pid]:r=a[this._pid]=this._createValue(s),r}set(s,r){let a,o=t.ensureMap(s);this._pid in o?a=o[this._pid]:a=o[this._pid]=this._createValue(s);let u=this._coerceValue(s,r);this._maybeNotify(s,a,o[this._pid]=u)}coerce(s){let r,a=t.ensureMap(s);this._pid in a?r=a[this._pid]:r=a[this._pid]=this._createValue(s);let o=this._coerceValue(s,r);this._maybeNotify(s,r,a[this._pid]=o)}_createValue(s){let r=this._create;return r(s)}_coerceValue(s,r){let a=this._coerce;return a?a(s,r):r}_compareValue(s,r){let a=this._compare;return a?a(s,r):s===r}_maybeNotify(s,r,a){let o=this._changed;o&&!this._compareValue(r,a)&&o(s,r,a)}}(function(n){function s(r){t.ownerData.delete(r)}n.clearData=s})(e||(e={}));var t;(function(n){n.ownerData=new WeakMap,n.nextPID=(()=>{let r=0;return()=>`pid-${`${Math.random()}`.slice(2)}-${r++}`})();function s(r){let a=n.ownerData.get(r);return a||(a=Object.create(null),n.ownerData.set(r,a),a)}n.ensureMap=s})(t||(t={})),i.AttachedProperty=e})});var xa=E(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});jn.RestorablePool=void 0;var Zc=te(),Sa=ba(),Dn=Z(),$i=class{constructor(e){this._added=new Dn.Signal(this),this._current=null,this._currentChanged=new Dn.Signal(this),this._hasRestored=!1,this._isDisposed=!1,this._objects=new Set,this._restore=null,this._restored=new Zc.PromiseDelegate,this._updated=new Dn.Signal(this),this.namespace=e.namespace}get added(){return this._added}get current(){return this._current}set current(e){this._current!==e&&e!==null&&this._objects.has(e)&&(this._current=e,this._currentChanged.emit(this._current))}get currentChanged(){return this._currentChanged}get isDisposed(){return this._isDisposed}get restored(){return this._restored.promise}get size(){return this._objects.size}get updated(){return this._updated}async add(e){var t,n;if(e.isDisposed){let s="A disposed object cannot be added.";throw console.warn(s,e),new Error(s)}if(this._objects.has(e)){let s="This object already exists in the pool.";throw console.warn(s,e),new Error(s)}if(this._objects.add(e),e.disposed.connect(this._onInstanceDisposed,this),!Ne.injectedProperty.get(e)){if(this._restore){let{connector:s}=this._restore,r=this._restore.name(e);if(r){let a=`${this.namespace}:${r}`,o=(n=(t=this._restore).args)===null||n===void 0?void 0:n.call(t,e);Ne.nameProperty.set(e,a),await s.save(a,{data:o})}}this._added.emit(e)}}dispose(){this.isDisposed||(this._current=null,this._isDisposed=!0,this._objects.clear(),Dn.Signal.clearData(this))}find(e){let t=this._objects.values();for(let n of t)if(e(n))return n}forEach(e){this._objects.forEach(e)}filter(e){let t=[];return this.forEach(n=>{e(n)&&t.push(n)}),t}inject(e){return Ne.injectedProperty.set(e,!0),this.add(e)}has(e){return this._objects.has(e)}async restore(e){if(this._hasRestored)throw new Error("This pool has already been restored.");this._hasRestored=!0;let{command:t,connector:n,registry:s,when:r}=e,a=this.namespace,o=r?[n.list(a)].concat(r):[n.list(a)];this._restore=e;let[u]=await Promise.all(o),c=await Promise.all(u.ids.map(async(d,l)=>{let p=u.values[l],v=p&&p.data;return v===void 0?n.remove(d):s.execute(t,v).catch(()=>n.remove(d))}));return this._restored.resolve(),c}async save(e){var t,n;let s=Ne.injectedProperty.get(e);if(!this._restore||!this.has(e)||s)return;let{connector:r}=this._restore,a=this._restore.name(e),o=Ne.nameProperty.get(e),u=a?`${this.namespace}:${a}`:"";if(o&&o!==u&&await r.remove(o),Ne.nameProperty.set(e,u),u){let c=(n=(t=this._restore).args)===null||n===void 0?void 0:n.call(t,e);await r.save(u,{data:c})}o!==u&&this._updated.emit(e)}_onInstanceDisposed(e){if(this._objects.delete(e),e===this._current&&(this._current=null,this._currentChanged.emit(this._current)),Ne.injectedProperty.get(e)||!this._restore)return;let{connector:t}=this._restore,n=Ne.nameProperty.get(e);n&&t.remove(n)}};jn.RestorablePool=$i;var Ne;(function(i){i.injectedProperty=new Sa.AttachedProperty({name:"injected",create:()=>!1}),i.nameProperty=new Sa.AttachedProperty({name:"name",create:()=>""})})(Ne||(Ne={}))});var Ca=E(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.StateDB=void 0;var Qc=Z(),Pt=class i{constructor(e={}){this._changed=new Qc.Signal(this);let{connector:t,transform:n}=e;this._connector=t||new i.Connector,n?this._ready=n.then(s=>{let{contents:r,type:a}=s;switch(a){case"cancel":return;case"clear":return this._clear();case"merge":return this._merge(r||{});case"overwrite":return this._overwrite(r||{});default:return}}):this._ready=Promise.resolve(void 0)}get changed(){return this._changed}async clear(){await this._ready,await this._clear()}async fetch(e){return await this._ready,this._fetch(e)}async list(e){return await this._ready,this._list(e)}async remove(e){await this._ready,await this._remove(e),this._changed.emit({id:e,type:"remove"})}async save(e,t){await this._ready,await this._save(e,t),this._changed.emit({id:e,type:"save"})}async toJSON(){await this._ready;let{ids:e,values:t}=await this._list();return t.reduce((n,s,r)=>(n[e[r]]=s,n),{})}async _clear(){await Promise.all((await this._list()).ids.map(e=>this._remove(e)))}async _fetch(e){let t=await this._connector.fetch(e);if(t)return JSON.parse(t).v}async _list(e=""){let{ids:t,values:n}=await this._connector.list(e);return{ids:t,values:n.map(s=>JSON.parse(s).v)}}async _merge(e){await Promise.all(Object.keys(e).map(t=>e[t]&&this._save(t,e[t])))}async _overwrite(e){await this._clear(),await this._merge(e)}async _remove(e){return this._connector.remove(e)}async _save(e,t){return this._connector.save(e,JSON.stringify({v:t}))}};Mt.StateDB=Pt;(function(i){class e{constructor(){this._storage={}}async fetch(n){return this._storage[n]}async list(n=""){return Object.keys(this._storage).reduce((s,r)=>((n===""||n===r.split(":")[0])&&(s.ids.push(r),s.values.push(this._storage[r])),s),{ids:[],values:[]})}async remove(n){delete this._storage[n]}async save(n,s){this._storage[n]=s}}i.Connector=e})(Pt||(Mt.StateDB=Pt={}))});var ka=E(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.IStateDB=void 0;var ed=te();Tn.IStateDB=new ed.Token("@jupyterlab/coreutils:IStateDB",`A service for the JupyterLab state database.
|
|
8
8
|
Use this if you want to store data that will persist across page loads.
|
|
9
|
-
See "state database" for more information.`)});var $i=E(ke=>{"use strict";var td=ke&&ke.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),Et=ke&&ke.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&td(e,i,t)};Object.defineProperty(ke,"__esModule",{value:!0});Et(ga(),ke);Et(va(),ke);Et(Sa(),ke);Et(xa(),ke);Et(Ca(),ke)});var Ji=E(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0});Un.SettingManager=void 0;var Vi=J(),nd=$i(),qn=de(),id="api/settings",Wi=class extends nd.DataConnector{constructor(e={}){var t;super(),this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:qn.ServerConnection.makeSettings()}async fetch(e){if(!e)throw new Error("Plugin `id` parameter is required for settings fetch.");let{serverSettings:t}=this,{baseUrl:n,appUrl:s}=t,{makeRequest:r,ResponseError:a}=qn.ServerConnection,o=n+s,u=It.url(o,e),c=await r(u,{},t);if(c.status!==200)throw await a.create(c);return c.json()}async list(e){var t,n,s,r;let{serverSettings:a}=this,{baseUrl:o,appUrl:u}=a,{makeRequest:c,ResponseError:d}=qn.ServerConnection,l=o+u,p=It.url(l,"",e==="ids"),v=await c(p,{},a);if(v.status!==200)throw new d(v);let _=await v.json(),I=(n=(t=_==null?void 0:_.settings)===null||t===void 0?void 0:t.map(D=>D.id))!==null&&n!==void 0?n:[],P=[];return e||(P=(r=(s=_==null?void 0:_.settings)===null||s===void 0?void 0:s.map(D=>(D.data={composite:{},user:{}},D)))!==null&&r!==void 0?r:[]),{ids:I,values:P}}async save(e,t){let{serverSettings:n}=this,{baseUrl:s,appUrl:r}=n,{makeRequest:a,ResponseError:o}=qn.ServerConnection,u=s+r,c=It.url(u,e),d={body:JSON.stringify({raw:t}),method:"PUT"},l=await a(c,d,n);if(l.status!==204)throw new o(l)}};Un.SettingManager=Wi;var It;(function(i){function e(t,n,s){let r=s?Vi.URLExt.objectToQueryString({ids_only:!0}):"",a=Vi.URLExt.join(t,id),o=Vi.URLExt.join(a,n);if(!o.startsWith(a))throw new Error("Can only be used for workspaces requests");return`${o}${r}`}i.url=e})(It||(It={}))});var Dt=E(ve=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.TerminalAPIClient=ve.TERMINAL_SERVICE_URL=void 0;ve.isAvailable=Gi;ve.startNew=ka;ve.listRunning=Pa;ve.shutdownTerminal=Ma;var Rt=J(),Le=de();ve.TERMINAL_SERVICE_URL="api/terminals";function Gi(){return String(Rt.PageConfig.getOption("terminalsAvailable")).toLowerCase()==="true"}async function ka(i=Le.ServerConnection.makeSettings(),e,t){Ot.errorIfNotAvailable();let n=Rt.URLExt.join(i.baseUrl,ve.TERMINAL_SERVICE_URL),s={method:"POST",body:JSON.stringify({name:e,cwd:t})},r=await Le.ServerConnection.makeRequest(n,s,i);if(r.status!==200)throw await Le.ServerConnection.ResponseError.create(r);return await r.json()}async function Pa(i=Le.ServerConnection.makeSettings()){Ot.errorIfNotAvailable();let e=Rt.URLExt.join(i.baseUrl,ve.TERMINAL_SERVICE_URL),t=await Le.ServerConnection.makeRequest(e,{},i);if(t.status!==200)throw await Le.ServerConnection.ResponseError.create(t);let n=await t.json();if(!Array.isArray(n))throw new Error("Invalid terminal list");return n}async function Ma(i,e=Le.ServerConnection.makeSettings()){var t;Ot.errorIfNotAvailable();let n=Rt.URLExt.join(e.baseUrl,ve.TERMINAL_SERVICE_URL),s=Rt.URLExt.join(n,i);if(!s.startsWith(n))throw new Error("Can only be used for terminal requests");let r={method:"DELETE"},a=await Le.ServerConnection.makeRequest(s,r,e);if(a.status===404){let u=(t=(await a.json()).message)!==null&&t!==void 0?t:`The terminal session "${i}"" does not exist on the server`;console.warn(u)}else if(a.status!==204)throw await Le.ServerConnection.ResponseError.create(a)}var Hi=class{constructor(e={}){var t;this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Le.ServerConnection.makeSettings()}get isAvailable(){return Gi()}async startNew(e={}){let{name:t,cwd:n}=e;return ka(this.serverSettings,t,n)}async listRunning(){return Pa(this.serverSettings)}async shutdown(e){return Ma(e,this.serverSettings)}};ve.TerminalAPIClient=Hi;var Ot;(function(i){function e(){if(!Gi())throw new Error("Terminals Unavailable")}i.errorIfNotAvailable=e})(Ot||(Ot={}))});var Ea=E(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.isAvailable=void 0;var sd=Dt();Object.defineProperty(An,"isAvailable",{enumerable:!0,get:function(){return sd.isAvailable}})});var Ia=E(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.TerminalConnection=void 0;var rd=J(),ad=te(),Nn=Z(),od=Te(),ld=Dt(),Yi=class i{constructor(e){var t,n;this._createSocket=()=>{this._errorIfDisposed(),this._clearSocket(),this._updateConnectionStatus("connecting");let s=this._name,r=this.serverSettings,a=rd.URLExt.join(r.wsUrl,"terminals","websocket",encodeURIComponent(s)),o=r.token;r.appendToken&&o!==""&&(a=a+`?token=${encodeURIComponent(o)}`),this._ws=new r.WebSocket(a),this._ws.onmessage=this._onWSMessage,this._ws.onclose=this._onWSClose,this._ws.onerror=this._onWSClose},this._onWSMessage=s=>{if(this._isDisposed)return;let r=JSON.parse(s.data);if(r[0]==="disconnect"&&this.dispose(),this._connectionStatus==="connecting"){r[0]==="setup"&&this._updateConnectionStatus("connected");return}this._messageReceived.emit({type:r[0],content:r.slice(1)})},this._onWSClose=s=>{console.warn(`Terminal websocket closed: ${s.code}`),this.isDisposed||this._reconnect()},this._connectionStatus="connecting",this._connectionStatusChanged=new Nn.Signal(this),this._isDisposed=!1,this._disposed=new Nn.Signal(this),this._messageReceived=new Nn.Signal(this),this._reconnectTimeout=null,this._ws=null,this._noOp=()=>{},this._reconnectLimit=7,this._reconnectAttempt=0,this._pendingMessages=[],this._name=e.model.name,this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:od.ServerConnection.makeSettings(),this._terminalAPIClient=(n=e.terminalAPIClient)!==null&&n!==void 0?n:new ld.TerminalAPIClient({serverSettings:this.serverSettings}),this._createSocket()}get disposed(){return this._disposed}get messageReceived(){return this._messageReceived}get name(){return this._name}get model(){return{name:this._name}}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed||(this._isDisposed=!0,this._disposed.emit(),this._updateConnectionStatus("disconnected"),this._clearSocket(),Nn.Signal.clearData(this))}send(e){this._sendMessage(e)}_sendMessage(e,t=!0){if(!(this._isDisposed||!e.content))if(this.connectionStatus==="connected"&&this._ws){let n=[e.type,...e.content];this._ws.send(JSON.stringify(n))}else if(t)this._pendingMessages.push(e);else throw new Error(`Could not send message: ${JSON.stringify(e)}`)}_sendPending(){for(;this.connectionStatus==="connected"&&this._pendingMessages.length>0;)this._sendMessage(this._pendingMessages[0],!1),this._pendingMessages.shift()}reconnect(){this._errorIfDisposed();let e=new ad.PromiseDelegate,t=(n,s)=>{s==="connected"?(e.resolve(),this.connectionStatusChanged.disconnect(t,this)):s==="disconnected"&&(e.reject(new Error("Terminal connection disconnected")),this.connectionStatusChanged.disconnect(t,this))};return this.connectionStatusChanged.connect(t,this),this._reconnectAttempt=0,this._reconnect(),e.promise}_reconnect(){if(this._errorIfDisposed(),clearTimeout(this._reconnectTimeout),this._reconnectAttempt<this._reconnectLimit){this._updateConnectionStatus("connecting");let e=Xi.getRandomIntInclusive(0,1e3*(Math.pow(2,this._reconnectAttempt)-1));console.error(`Connection lost, reconnecting in ${Math.floor(e/1e3)} seconds.`),this._reconnectTimeout=setTimeout(this._createSocket,e),this._reconnectAttempt+=1}else this._updateConnectionStatus("disconnected");this._clearSocket()}_clearSocket(){this._ws!==null&&(this._ws.onopen=this._noOp,this._ws.onclose=this._noOp,this._ws.onerror=this._noOp,this._ws.onmessage=this._noOp,this._ws.close(),this._ws=null)}async shutdown(){await this._terminalAPIClient.shutdown(this.name),this.dispose()}clone(){return new i({model:this.model,serverSettings:this.serverSettings,terminalAPIClient:this._terminalAPIClient})}_updateConnectionStatus(e){this._connectionStatus!==e&&(this._connectionStatus=e,e!=="connecting"&&(this._reconnectAttempt=0,clearTimeout(this._reconnectTimeout)),e==="connected"&&this._sendPending(),this._connectionStatusChanged.emit(e))}_errorIfDisposed(){if(this.isDisposed)throw new Error("Terminal connection is disposed")}get connectionStatusChanged(){return this._connectionStatusChanged}get connectionStatus(){return this._connectionStatus}};Ln.TerminalConnection=Yi;var Xi;(function(i){function e(t,n){return t=Math.ceil(t),n=Math.floor(n),Math.floor(Math.random()*(n-t+1))+t}i.getRandomIntInclusive=e})(Xi||(Xi={}))});var Oa=E(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.TerminalManager=void 0;var cd=Xe(),Ra=Z(),dd=Te(),ud=Ye(),pd=Dt(),hd=Ia(),jt=class extends ud.BaseManager{constructor(e={}){var t,n;if(super(e),this._isReady=!1,this._names=[],this._terminalConnections=new Set,this._runningChanged=new Ra.Signal(this),this._connectionFailure=new Ra.Signal(this),this._terminalAPIClient=(t=e.terminalAPIClient)!==null&&t!==void 0?t:new pd.TerminalAPIClient({serverSettings:this.serverSettings}),!this.isAvailable()){this._ready=Promise.reject("Terminals unavailable"),this._ready.catch(s=>{});return}this._pollModels=new cd.Poll({auto:!1,factory:()=>this.requestRunning(),frequency:{interval:10*1e3,backoff:!0,max:300*1e3},name:"@jupyterlab/services:TerminalManager#models",standby:(n=e.standby)!==null&&n!==void 0?n:"when-hidden"}),this._ready=(async()=>{await this._pollModels.start(),await this._pollModels.tick,this._isReady=!0})()}get isReady(){return this._isReady}get ready(){return this._ready}get runningChanged(){return this._runningChanged}get connectionFailure(){return this._connectionFailure}dispose(){this.isDisposed||(this._names.length=0,this._terminalConnections.forEach(e=>e.dispose()),this._pollModels.dispose(),super.dispose())}isAvailable(){return this._terminalAPIClient.isAvailable}connectTo(e){let t=new hd.TerminalConnection({...e,serverSettings:this.serverSettings,terminalAPIClient:this._terminalAPIClient});return this._onStarted(t),this._names.includes(e.model.name)||this.refreshRunning().catch(()=>{}),t}running(){return this._models[Symbol.iterator]()}async refreshRunning(){await this._pollModels.refresh(),await this._pollModels.tick}async startNew(e={}){let{name:t,cwd:n}=e,s=await this._terminalAPIClient.startNew({name:t,cwd:n});return await this.refreshRunning(),this.connectTo({model:s})}async shutdown(e){await this._terminalAPIClient.shutdown(e),await this.refreshRunning()}async shutdownAll(){await this.refreshRunning(),await Promise.all(this._names.map(e=>this._terminalAPIClient.shutdown(e))),await this.refreshRunning()}async requestRunning(){var e,t;let n;try{n=await this._terminalAPIClient.listRunning()}catch(r){throw(r instanceof dd.ServerConnection.NetworkError||((e=r.response)===null||e===void 0?void 0:e.status)===503||((t=r.response)===null||t===void 0?void 0:t.status)===424)&&this._connectionFailure.emit(r),r}if(this.isDisposed)return;let s=n.map(({name:r})=>r).sort();s!==this._names&&(this._names=s,this._terminalConnections.forEach(r=>{s.includes(r.name)||r.dispose()}),this._runningChanged.emit(this._models))}_onStarted(e){this._terminalConnections.add(e),e.disposed.connect(this._onDisposed,this)}_onDisposed(e){this._terminalConnections.delete(e),this.refreshRunning().catch(()=>{})}get _models(){return this._names.map(e=>({name:e}))}};Tt.TerminalManager=jt;(function(i){class e extends i{constructor(){super(...arguments),this._readyPromise=new Promise(()=>{})}get isActive(){return!1}get parentReady(){return super.ready}get ready(){return this.parentReady.then(()=>this._readyPromise)}async startNew(n){return Promise.reject(new Error("Not implemented in no-op Terminal Manager"))}connectTo(n){throw Error("Not implemented in no-op Terminal Manager")}async shutdown(n){return Promise.reject(new Error("Not implemented in no-op Terminal Manager"))}async requestRunning(){return Promise.resolve()}}i.NoopManager=e})(jt||(Tt.TerminalManager=jt={}))});var Zi=E(me=>{"use strict";var Da=me&&me.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),fd=me&&me.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),ja=me&&me.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&Da(e,i,t);return fd(e,i),e},md=me&&me.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Da(e,i,t)};Object.defineProperty(me,"__esModule",{value:!0});me.TerminalAPI=me.Terminal=void 0;var gd=ja(Ea());me.Terminal=gd;var _d=ja(Dt());me.TerminalAPI=_d;md(Oa(),me)});var ns=E(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.UserManager=void 0;var vd=J(),yd=te(),wd=Xe(),Ta=Z(),bd=de(),Sd=Ye(),xd="api/me",Qi="@jupyterlab/services:UserManager#user",es=class extends Sd.BaseManager{constructor(e={}){var t;super(e),this._isReady=!1,this._userChanged=new Ta.Signal(this),this._connectionFailure=new Ta.Signal(this),this._ready=this.requestUser().then(()=>{this.isDisposed||(this._isReady=!0)}).catch(n=>new Promise(()=>{})),this._pollSpecs=new wd.Poll({auto:!1,factory:()=>this.requestUser(),frequency:{interval:61*1e3,backoff:!0,max:300*1e3},name:Qi,standby:(t=e.standby)!==null&&t!==void 0?t:"when-hidden"}),this.ready.then(()=>{this._pollSpecs.start()})}get isReady(){return this._isReady}get ready(){return this._ready}get identity(){return this._identity}get permissions(){return this._permissions}get userChanged(){return this._userChanged}get connectionFailure(){return this._connectionFailure}dispose(){this._pollSpecs.dispose(),super.dispose()}async refreshUser(){await this._pollSpecs.refresh(),await this._pollSpecs.tick}async requestUser(){if(this.isDisposed)return;let{baseUrl:e}=this.serverSettings,{makeRequest:t,ResponseError:n}=bd.ServerConnection,s=vd.URLExt.join(e,xd),r=await t(s,{},this.serverSettings);if(r.status!==200)throw await n.create(r);let a={identity:this._identity,permissions:this._permissions},o=await r.json(),u=o.identity,{localStorage:c}=window,d=c.getItem(Qi);if(d&&(!u.initials||!u.color)){let l=JSON.parse(d);u.initials=u.initials||l.initials||u.name.substring(0,1),u.color=u.color||l.color||ts.getRandomColor()}yd.JSONExt.deepEqual(o,a)||(this._identity=u,this._permissions=o.permissions,c.setItem(Qi,JSON.stringify(u)),this._userChanged.emit(o))}};zn.UserManager=es;var ts;(function(i){let e=["var(--jp-collaborator-color1)","var(--jp-collaborator-color2)","var(--jp-collaborator-color3)","var(--jp-collaborator-color4)","var(--jp-collaborator-color5)","var(--jp-collaborator-color6)","var(--jp-collaborator-color7)"];i.getRandomColor=()=>e[Math.floor(Math.random()*e.length)]})(ts||(ts={}))});var ss=E(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:!0});Fn.WorkspaceManager=void 0;var qa=J(),Cd=$i(),qt=de(),kd="api/workspaces",is=class extends Cd.DataConnector{constructor(e={}){var t;super(),this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:qt.ServerConnection.makeSettings()}async fetch(e){let{serverSettings:t}=this,{baseUrl:n,appUrl:s}=t,{makeRequest:r,ResponseError:a}=qt.ServerConnection,o=n+s,u=dt.url(o,e),c=await r(u,{},t);if(c.status!==200)throw await a.create(c);return c.json()}async list(){let{serverSettings:e}=this,{baseUrl:t,appUrl:n}=e,{makeRequest:s,ResponseError:r}=qt.ServerConnection,a=t+n,o=dt.url(a,""),u=await s(o,{},e);if(u.status!==200)throw await r.create(u);return(await u.json()).workspaces}async remove(e){let{serverSettings:t}=this,{baseUrl:n,appUrl:s}=t,{makeRequest:r,ResponseError:a}=qt.ServerConnection,o=n+s,u=dt.url(o,e),d=await r(u,{method:"DELETE"},t);if(d.status!==204)throw await a.create(d)}async save(e,t){let{serverSettings:n}=this,{baseUrl:s,appUrl:r}=n,{makeRequest:a,ResponseError:o}=qt.ServerConnection,u=s+r,c=dt.url(u,e),d={body:JSON.stringify(t),method:"PUT"},l=await a(c,d,n);if(l.status!==204)throw await o.create(l)}};Fn.WorkspaceManager=is;var dt;(function(i){function e(t,n){let s=qa.URLExt.join(t,kd),r=qa.URLExt.join(s,n);if(!r.startsWith(s))throw new Error("Can only be used for workspaces requests");return r}i.url=e})(dt||(dt={}))});var Aa=E(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.ServiceManager=void 0;var Ua=Z(),Pd=ta(),Md=yi(),Ed=bi(),Id=Ri(),Rd=Di(),Od=Ni(),Dd=de(),jd=Fi(),Td=Ji(),qd=Zi(),Ud=ns(),Ad=ss(),rs=class{constructor(e={}){var t,n;this._isDisposed=!1,this._connectionFailure=new Ua.Signal(this),this._isReady=!1;let s=e.defaultDrive,r=(t=e.serverSettings)!==null&&t!==void 0?t:Dd.ServerConnection.makeSettings(),a=(n=e.standby)!==null&&n!==void 0?n:"when-hidden",o={defaultDrive:s,serverSettings:r,standby:a};this.serverSettings=r,this.contents=e.contents||new Md.ContentsManager(o),this.events=e.events||new Ed.EventManager(o),this.kernels=e.kernels||new Id.KernelManager(o),this.sessions=e.sessions||new jd.SessionManager({...o,kernelManager:this.kernels}),this.settings=e.settings||new Td.SettingManager(o),this.terminals=e.terminals||new qd.TerminalManager(o),this.builder=e.builder||new Pd.BuildManager(o),this.workspaces=e.workspaces||new Ad.WorkspaceManager(o),this.nbconvert=e.nbconvert||new Od.NbConvertManager(o),this.kernelspecs=e.kernelspecs||new Rd.KernelSpecManager(o),this.user=e.user||new Ud.UserManager(o),this.kernelspecs.connectionFailure.connect(this._onConnectionFailure,this),this.sessions.connectionFailure.connect(this._onConnectionFailure,this),this.terminals.connectionFailure.connect(this._onConnectionFailure,this);let u=[this.sessions.ready,this.kernelspecs.ready];this.terminals.isAvailable()&&u.push(this.terminals.ready),this._readyPromise=Promise.all(u).then(()=>{this._isReady=!0})}get connectionFailure(){return this._connectionFailure}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,Ua.Signal.clearData(this),this.contents.dispose(),this.events.dispose(),this.sessions.dispose(),this.terminals.dispose())}get isReady(){return this._isReady}get ready(){return this._readyPromise}_onConnectionFailure(e,t){this._connectionFailure.emit(t)}};Kn.ServiceManager=rs});var Na=E(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.IWorkspaceManager=L.IUserManager=L.ITerminalManager=L.IServiceManager=L.ISettingManager=L.ISessionManager=L.IServerSettings=L.INbConvertManager=L.IKernelSpecManager=L.IKernelManager=L.IEventManager=L.IDefaultDrive=L.IContentsManager=L.IConfigSectionManager=L.IConnectionStatus=void 0;var ge=te();L.IConnectionStatus=new ge.Token("@jupyterlab/application:IConnectionStatus","A service providing the application connection status.");L.IConfigSectionManager=new ge.Token("@jupyterlab/services:IConfigSectionManager","A service providing the config section manager.");L.IContentsManager=new ge.Token("@jupyterlab/services:IContentsManager","The contents manager token.");L.IDefaultDrive=new ge.Token("@jupyterlab/services:IDefaultDrive","The default drive for the contents manager.");L.IEventManager=new ge.Token("@jupyterlab/services:IEventManager","The event manager token.");L.IKernelManager=new ge.Token("@jupyterlab/services:IKernelManager","The kernel manager token.");L.IKernelSpecManager=new ge.Token("@jupyterlab/services:IKernelSpecManager","The kernel spec manager token.");L.INbConvertManager=new ge.Token("@jupyterlab/services:INbConvertManager","The nbconvert manager token.");L.IServerSettings=new ge.Token("@jupyterlab/services:IServerSettings","The server settings for the application.");L.ISessionManager=new ge.Token("@jupyterlab/services:ISessionManager","The session manager token.");L.ISettingManager=new ge.Token("@jupyterlab/services:ISettingManager","The setting manager token.");L.IServiceManager=new ge.Token("@jupyterlab/services:IServiceManager","The service manager for the application.");L.ITerminalManager=new ge.Token("@jupyterlab/services:ITerminalManager","The terminal manager token.");L.IUserManager=new ge.Token("@jupyterlab/services:IUserManager","The user manager token.");L.IWorkspaceManager=new ge.Token("@jupyterlab/services:IWorkspaceManager","The workspace manager token.")});var Te=E(W=>{"use strict";var Nd=W&&W.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),le=W&&W.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Nd(e,i,t)};Object.defineProperty(W,"__esModule",{value:!0});le(Ye(),W);le(mr(),W);le(gr(),W);le(yi(),W);le(bi(),W);le(Ri(),W);le(Di(),W);le(Aa(),W);le(de(),W);le(Fi(),W);le(Ji(),W);le(Zi(),W);le(Na(),W);le(ns(),W);le(ss(),W);le(Ni(),W)});var za=E((tp,La)=>{"use strict";function Bn(){this._types=Object.create(null),this._extensions=Object.create(null);for(let i=0;i<arguments.length;i++)this.define(arguments[i]);this.define=this.define.bind(this),this.getType=this.getType.bind(this),this.getExtension=this.getExtension.bind(this)}Bn.prototype.define=function(i,e){for(let t in i){let n=i[t].map(function(s){return s.toLowerCase()});t=t.toLowerCase();for(let s=0;s<n.length;s++){let r=n[s];if(r[0]!=="*"){if(!e&&r in this._types)throw new Error('Attempt to change mapping for "'+r+'" extension from "'+this._types[r]+'" to "'+t+'". Pass `force=true` to allow this, otherwise remove "'+r+'" from the list of extensions for "'+t+'".');this._types[r]=t}}if(e||!this._extensions[t]){let s=n[0];this._extensions[t]=s[0]!=="*"?s:s.substr(1)}}};Bn.prototype.getType=function(i){i=String(i);let e=i.replace(/^.*[/\\]/,"").toLowerCase(),t=e.replace(/^.*\./,"").toLowerCase(),n=e.length<i.length;return(t.length<e.length-1||!n)&&this._types[t]||null};Bn.prototype.getExtension=function(i){return i=/^\s*([^;\s]*)/.test(i)&&RegExp.$1,i&&this._extensions[i.toLowerCase()]||null};La.exports=Bn});var Ka=E((np,Fa)=>{Fa.exports={"application/andrew-inset":["ez"],"application/applixware":["aw"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomdeleted+xml":["atomdeleted"],"application/atomsvc+xml":["atomsvc"],"application/atsc-dwd+xml":["dwd"],"application/atsc-held+xml":["held"],"application/atsc-rsat+xml":["rsat"],"application/bdoc":["bdoc"],"application/calendar+xml":["xcs"],"application/ccxml+xml":["ccxml"],"application/cdfx+xml":["cdfx"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cu-seeme":["cu"],"application/dash+xml":["mpd"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["es","ecma"],"application/emma+xml":["emma"],"application/emotionml+xml":["emotionml"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/express":["exp"],"application/fdt+xml":["fdt"],"application/font-tdpfr":["pfr"],"application/geo+json":["geojson"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/gzip":["gz"],"application/hjson":["hjson"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/its+xml":["its"],"application/java-archive":["jar","war","ear"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["js","mjs"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/ld+json":["jsonld"],"application/lgr+xml":["lgr"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/manifest+json":["webmanifest"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mmt-aei+xml":["maei"],"application/mmt-usd+xml":["musd"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["mp4s","m4p"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/n-quads":["nq"],"application/n-triples":["nt"],"application/node":["cjs"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/p2p-overlay+xml":["relo"],"application/patch-ops-error+xml":["xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-signature":["asc","sig"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/provenance+xml":["provx"],"application/pskc+xml":["pskcxml"],"application/raml+yaml":["raml"],"application/rdf+xml":["rdf","owl"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/route-apd+xml":["rapd"],"application/route-s-tsid+xml":["sls"],"application/route-usd+xml":["rusd"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/senml+xml":["senmlx"],"application/sensml+xml":["sensmlx"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/sieve":["siv","sieve"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/swid+xml":["swidtag"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/toml":["toml"],"application/trig":["trig"],"application/ttml+xml":["ttml"],"application/ubjson":["ubj"],"application/urc-ressheet+xml":["rsheet"],"application/urc-targetdesc+xml":["td"],"application/voicexml+xml":["vxml"],"application/wasm":["wasm"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/xaml+xml":["xaml"],"application/xcap-att+xml":["xav"],"application/xcap-caps+xml":["xca"],"application/xcap-diff+xml":["xdf"],"application/xcap-el+xml":["xel"],"application/xcap-ns+xml":["xns"],"application/xenc+xml":["xenc"],"application/xhtml+xml":["xhtml","xht"],"application/xliff+xml":["xlf"],"application/xml":["xml","xsl","xsd","rng"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["*xsl","xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"audio/3gpp":["*3gpp"],"audio/adpcm":["adp"],"audio/amr":["amr"],"audio/basic":["au","snd"],"audio/midi":["mid","midi","kar","rmi"],"audio/mobile-xmf":["mxmf"],"audio/mp3":["*mp3"],"audio/mp4":["m4a","mp4a"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx","opus"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/wav":["wav"],"audio/wave":["*wav"],"audio/webm":["weba"],"audio/xm":["xm"],"font/collection":["ttc"],"font/otf":["otf"],"font/ttf":["ttf"],"font/woff":["woff"],"font/woff2":["woff2"],"image/aces":["exr"],"image/apng":["apng"],"image/avif":["avif"],"image/bmp":["bmp"],"image/cgm":["cgm"],"image/dicom-rle":["drle"],"image/emf":["emf"],"image/fits":["fits"],"image/g3fax":["g3"],"image/gif":["gif"],"image/heic":["heic"],"image/heic-sequence":["heics"],"image/heif":["heif"],"image/heif-sequence":["heifs"],"image/hej2k":["hej2"],"image/hsj2":["hsj2"],"image/ief":["ief"],"image/jls":["jls"],"image/jp2":["jp2","jpg2"],"image/jpeg":["jpeg","jpg","jpe"],"image/jph":["jph"],"image/jphc":["jhc"],"image/jpm":["jpm"],"image/jpx":["jpx","jpf"],"image/jxr":["jxr"],"image/jxra":["jxra"],"image/jxrs":["jxrs"],"image/jxs":["jxs"],"image/jxsc":["jxsc"],"image/jxsi":["jxsi"],"image/jxss":["jxss"],"image/ktx":["ktx"],"image/ktx2":["ktx2"],"image/png":["png"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/t38":["t38"],"image/tiff":["tif","tiff"],"image/tiff-fx":["tfx"],"image/webp":["webp"],"image/wmf":["wmf"],"message/disposition-notification":["disposition-notification"],"message/global":["u8msg"],"message/global-delivery-status":["u8dsn"],"message/global-disposition-notification":["u8mdn"],"message/global-headers":["u8hdr"],"message/rfc822":["eml","mime"],"model/3mf":["3mf"],"model/gltf+json":["gltf"],"model/gltf-binary":["glb"],"model/iges":["igs","iges"],"model/mesh":["msh","mesh","silo"],"model/mtl":["mtl"],"model/obj":["obj"],"model/step+xml":["stpx"],"model/step+zip":["stpz"],"model/step-xml+zip":["stpxz"],"model/stl":["stl"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["*x3db","x3dbz"],"model/x3d+fastinfoset":["x3db"],"model/x3d+vrml":["*x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"model/x3d-vrml":["x3dv"],"text/cache-manifest":["appcache","manifest"],"text/calendar":["ics","ifb"],"text/coffeescript":["coffee","litcoffee"],"text/css":["css"],"text/csv":["csv"],"text/html":["html","htm","shtml"],"text/jade":["jade"],"text/jsx":["jsx"],"text/less":["less"],"text/markdown":["markdown","md"],"text/mathml":["mml"],"text/mdx":["mdx"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in","ini"],"text/richtext":["rtx"],"text/rtf":["*rtf"],"text/sgml":["sgml","sgm"],"text/shex":["shex"],"text/slim":["slim","slm"],"text/spdx":["spdx"],"text/stylus":["stylus","styl"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vtt":["vtt"],"text/xml":["*xml"],"text/yaml":["yaml","yml"],"video/3gpp":["3gp","3gpp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/iso.segment":["m4s"],"video/jpeg":["jpgv"],"video/jpm":["*jpm","jpgm"],"video/mj2":["mj2","mjp2"],"video/mp2t":["ts"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/webm":["webm"]}});var $a=E((ip,Ba)=>{Ba.exports={"application/prs.cww":["cww"],"application/vnd.1000minds.decision-model+xml":["1km"],"application/vnd.3gpp.pic-bw-large":["plb"],"application/vnd.3gpp.pic-bw-small":["psb"],"application/vnd.3gpp.pic-bw-var":["pvb"],"application/vnd.3gpp2.tcap":["tcap"],"application/vnd.3m.post-it-notes":["pwn"],"application/vnd.accpac.simply.aso":["aso"],"application/vnd.accpac.simply.imp":["imp"],"application/vnd.acucobol":["acu"],"application/vnd.acucorp":["atc","acutc"],"application/vnd.adobe.air-application-installer-package+zip":["air"],"application/vnd.adobe.formscentral.fcdt":["fcdt"],"application/vnd.adobe.fxp":["fxp","fxpl"],"application/vnd.adobe.xdp+xml":["xdp"],"application/vnd.adobe.xfdf":["xfdf"],"application/vnd.ahead.space":["ahead"],"application/vnd.airzip.filesecure.azf":["azf"],"application/vnd.airzip.filesecure.azs":["azs"],"application/vnd.amazon.ebook":["azw"],"application/vnd.americandynamics.acc":["acc"],"application/vnd.amiga.ami":["ami"],"application/vnd.android.package-archive":["apk"],"application/vnd.anser-web-certificate-issue-initiation":["cii"],"application/vnd.anser-web-funds-transfer-initiation":["fti"],"application/vnd.antix.game-component":["atx"],"application/vnd.apple.installer+xml":["mpkg"],"application/vnd.apple.keynote":["key"],"application/vnd.apple.mpegurl":["m3u8"],"application/vnd.apple.numbers":["numbers"],"application/vnd.apple.pages":["pages"],"application/vnd.apple.pkpass":["pkpass"],"application/vnd.aristanetworks.swi":["swi"],"application/vnd.astraea-software.iota":["iota"],"application/vnd.audiograph":["aep"],"application/vnd.balsamiq.bmml+xml":["bmml"],"application/vnd.blueice.multipass":["mpm"],"application/vnd.bmi":["bmi"],"application/vnd.businessobjects":["rep"],"application/vnd.chemdraw+xml":["cdxml"],"application/vnd.chipnuts.karaoke-mmd":["mmd"],"application/vnd.cinderella":["cdy"],"application/vnd.citationstyles.style+xml":["csl"],"application/vnd.claymore":["cla"],"application/vnd.cloanto.rp9":["rp9"],"application/vnd.clonk.c4group":["c4g","c4d","c4f","c4p","c4u"],"application/vnd.cluetrust.cartomobile-config":["c11amc"],"application/vnd.cluetrust.cartomobile-config-pkg":["c11amz"],"application/vnd.commonspace":["csp"],"application/vnd.contact.cmsg":["cdbcmsg"],"application/vnd.cosmocaller":["cmc"],"application/vnd.crick.clicker":["clkx"],"application/vnd.crick.clicker.keyboard":["clkk"],"application/vnd.crick.clicker.palette":["clkp"],"application/vnd.crick.clicker.template":["clkt"],"application/vnd.crick.clicker.wordbank":["clkw"],"application/vnd.criticaltools.wbs+xml":["wbs"],"application/vnd.ctc-posml":["pml"],"application/vnd.cups-ppd":["ppd"],"application/vnd.curl.car":["car"],"application/vnd.curl.pcurl":["pcurl"],"application/vnd.dart":["dart"],"application/vnd.data-vision.rdz":["rdz"],"application/vnd.dbf":["dbf"],"application/vnd.dece.data":["uvf","uvvf","uvd","uvvd"],"application/vnd.dece.ttml+xml":["uvt","uvvt"],"application/vnd.dece.unspecified":["uvx","uvvx"],"application/vnd.dece.zip":["uvz","uvvz"],"application/vnd.denovo.fcselayout-link":["fe_launch"],"application/vnd.dna":["dna"],"application/vnd.dolby.mlp":["mlp"],"application/vnd.dpgraph":["dpg"],"application/vnd.dreamfactory":["dfac"],"application/vnd.ds-keypoint":["kpxx"],"application/vnd.dvb.ait":["ait"],"application/vnd.dvb.service":["svc"],"application/vnd.dynageo":["geo"],"application/vnd.ecowin.chart":["mag"],"application/vnd.enliven":["nml"],"application/vnd.epson.esf":["esf"],"application/vnd.epson.msf":["msf"],"application/vnd.epson.quickanime":["qam"],"application/vnd.epson.salt":["slt"],"application/vnd.epson.ssf":["ssf"],"application/vnd.eszigno3+xml":["es3","et3"],"application/vnd.ezpix-album":["ez2"],"application/vnd.ezpix-package":["ez3"],"application/vnd.fdf":["fdf"],"application/vnd.fdsn.mseed":["mseed"],"application/vnd.fdsn.seed":["seed","dataless"],"application/vnd.flographit":["gph"],"application/vnd.fluxtime.clip":["ftc"],"application/vnd.framemaker":["fm","frame","maker","book"],"application/vnd.frogans.fnc":["fnc"],"application/vnd.frogans.ltf":["ltf"],"application/vnd.fsc.weblaunch":["fsc"],"application/vnd.fujitsu.oasys":["oas"],"application/vnd.fujitsu.oasys2":["oa2"],"application/vnd.fujitsu.oasys3":["oa3"],"application/vnd.fujitsu.oasysgp":["fg5"],"application/vnd.fujitsu.oasysprs":["bh2"],"application/vnd.fujixerox.ddd":["ddd"],"application/vnd.fujixerox.docuworks":["xdw"],"application/vnd.fujixerox.docuworks.binder":["xbd"],"application/vnd.fuzzysheet":["fzs"],"application/vnd.genomatix.tuxedo":["txd"],"application/vnd.geogebra.file":["ggb"],"application/vnd.geogebra.tool":["ggt"],"application/vnd.geometry-explorer":["gex","gre"],"application/vnd.geonext":["gxt"],"application/vnd.geoplan":["g2w"],"application/vnd.geospace":["g3w"],"application/vnd.gmx":["gmx"],"application/vnd.google-apps.document":["gdoc"],"application/vnd.google-apps.presentation":["gslides"],"application/vnd.google-apps.spreadsheet":["gsheet"],"application/vnd.google-earth.kml+xml":["kml"],"application/vnd.google-earth.kmz":["kmz"],"application/vnd.grafeq":["gqf","gqs"],"application/vnd.groove-account":["gac"],"application/vnd.groove-help":["ghf"],"application/vnd.groove-identity-message":["gim"],"application/vnd.groove-injector":["grv"],"application/vnd.groove-tool-message":["gtm"],"application/vnd.groove-tool-template":["tpl"],"application/vnd.groove-vcard":["vcg"],"application/vnd.hal+xml":["hal"],"application/vnd.handheld-entertainment+xml":["zmm"],"application/vnd.hbci":["hbci"],"application/vnd.hhe.lesson-player":["les"],"application/vnd.hp-hpgl":["hpgl"],"application/vnd.hp-hpid":["hpid"],"application/vnd.hp-hps":["hps"],"application/vnd.hp-jlyt":["jlt"],"application/vnd.hp-pcl":["pcl"],"application/vnd.hp-pclxl":["pclxl"],"application/vnd.hydrostatix.sof-data":["sfd-hdstx"],"application/vnd.ibm.minipay":["mpy"],"application/vnd.ibm.modcap":["afp","listafp","list3820"],"application/vnd.ibm.rights-management":["irm"],"application/vnd.ibm.secure-container":["sc"],"application/vnd.iccprofile":["icc","icm"],"application/vnd.igloader":["igl"],"application/vnd.immervision-ivp":["ivp"],"application/vnd.immervision-ivu":["ivu"],"application/vnd.insors.igm":["igm"],"application/vnd.intercon.formnet":["xpw","xpx"],"application/vnd.intergeo":["i2g"],"application/vnd.intu.qbo":["qbo"],"application/vnd.intu.qfx":["qfx"],"application/vnd.ipunplugged.rcprofile":["rcprofile"],"application/vnd.irepository.package+xml":["irp"],"application/vnd.is-xpr":["xpr"],"application/vnd.isac.fcs":["fcs"],"application/vnd.jam":["jam"],"application/vnd.jcp.javame.midlet-rms":["rms"],"application/vnd.jisp":["jisp"],"application/vnd.joost.joda-archive":["joda"],"application/vnd.kahootz":["ktz","ktr"],"application/vnd.kde.karbon":["karbon"],"application/vnd.kde.kchart":["chrt"],"application/vnd.kde.kformula":["kfo"],"application/vnd.kde.kivio":["flw"],"application/vnd.kde.kontour":["kon"],"application/vnd.kde.kpresenter":["kpr","kpt"],"application/vnd.kde.kspread":["ksp"],"application/vnd.kde.kword":["kwd","kwt"],"application/vnd.kenameaapp":["htke"],"application/vnd.kidspiration":["kia"],"application/vnd.kinar":["kne","knp"],"application/vnd.koan":["skp","skd","skt","skm"],"application/vnd.kodak-descriptor":["sse"],"application/vnd.las.las+xml":["lasxml"],"application/vnd.llamagraphics.life-balance.desktop":["lbd"],"application/vnd.llamagraphics.life-balance.exchange+xml":["lbe"],"application/vnd.lotus-1-2-3":["123"],"application/vnd.lotus-approach":["apr"],"application/vnd.lotus-freelance":["pre"],"application/vnd.lotus-notes":["nsf"],"application/vnd.lotus-organizer":["org"],"application/vnd.lotus-screencam":["scm"],"application/vnd.lotus-wordpro":["lwp"],"application/vnd.macports.portpkg":["portpkg"],"application/vnd.mapbox-vector-tile":["mvt"],"application/vnd.mcd":["mcd"],"application/vnd.medcalcdata":["mc1"],"application/vnd.mediastation.cdkey":["cdkey"],"application/vnd.mfer":["mwf"],"application/vnd.mfmp":["mfm"],"application/vnd.micrografx.flo":["flo"],"application/vnd.micrografx.igx":["igx"],"application/vnd.mif":["mif"],"application/vnd.mobius.daf":["daf"],"application/vnd.mobius.dis":["dis"],"application/vnd.mobius.mbk":["mbk"],"application/vnd.mobius.mqy":["mqy"],"application/vnd.mobius.msl":["msl"],"application/vnd.mobius.plc":["plc"],"application/vnd.mobius.txf":["txf"],"application/vnd.mophun.application":["mpn"],"application/vnd.mophun.certificate":["mpc"],"application/vnd.mozilla.xul+xml":["xul"],"application/vnd.ms-artgalry":["cil"],"application/vnd.ms-cab-compressed":["cab"],"application/vnd.ms-excel":["xls","xlm","xla","xlc","xlt","xlw"],"application/vnd.ms-excel.addin.macroenabled.12":["xlam"],"application/vnd.ms-excel.sheet.binary.macroenabled.12":["xlsb"],"application/vnd.ms-excel.sheet.macroenabled.12":["xlsm"],"application/vnd.ms-excel.template.macroenabled.12":["xltm"],"application/vnd.ms-fontobject":["eot"],"application/vnd.ms-htmlhelp":["chm"],"application/vnd.ms-ims":["ims"],"application/vnd.ms-lrm":["lrm"],"application/vnd.ms-officetheme":["thmx"],"application/vnd.ms-outlook":["msg"],"application/vnd.ms-pki.seccat":["cat"],"application/vnd.ms-pki.stl":["*stl"],"application/vnd.ms-powerpoint":["ppt","pps","pot"],"application/vnd.ms-powerpoint.addin.macroenabled.12":["ppam"],"application/vnd.ms-powerpoint.presentation.macroenabled.12":["pptm"],"application/vnd.ms-powerpoint.slide.macroenabled.12":["sldm"],"application/vnd.ms-powerpoint.slideshow.macroenabled.12":["ppsm"],"application/vnd.ms-powerpoint.template.macroenabled.12":["potm"],"application/vnd.ms-project":["mpp","mpt"],"application/vnd.ms-word.document.macroenabled.12":["docm"],"application/vnd.ms-word.template.macroenabled.12":["dotm"],"application/vnd.ms-works":["wps","wks","wcm","wdb"],"application/vnd.ms-wpl":["wpl"],"application/vnd.ms-xpsdocument":["xps"],"application/vnd.mseq":["mseq"],"application/vnd.musician":["mus"],"application/vnd.muvee.style":["msty"],"application/vnd.mynfc":["taglet"],"application/vnd.neurolanguage.nlu":["nlu"],"application/vnd.nitf":["ntf","nitf"],"application/vnd.noblenet-directory":["nnd"],"application/vnd.noblenet-sealer":["nns"],"application/vnd.noblenet-web":["nnw"],"application/vnd.nokia.n-gage.ac+xml":["*ac"],"application/vnd.nokia.n-gage.data":["ngdat"],"application/vnd.nokia.n-gage.symbian.install":["n-gage"],"application/vnd.nokia.radio-preset":["rpst"],"application/vnd.nokia.radio-presets":["rpss"],"application/vnd.novadigm.edm":["edm"],"application/vnd.novadigm.edx":["edx"],"application/vnd.novadigm.ext":["ext"],"application/vnd.oasis.opendocument.chart":["odc"],"application/vnd.oasis.opendocument.chart-template":["otc"],"application/vnd.oasis.opendocument.database":["odb"],"application/vnd.oasis.opendocument.formula":["odf"],"application/vnd.oasis.opendocument.formula-template":["odft"],"application/vnd.oasis.opendocument.graphics":["odg"],"application/vnd.oasis.opendocument.graphics-template":["otg"],"application/vnd.oasis.opendocument.image":["odi"],"application/vnd.oasis.opendocument.image-template":["oti"],"application/vnd.oasis.opendocument.presentation":["odp"],"application/vnd.oasis.opendocument.presentation-template":["otp"],"application/vnd.oasis.opendocument.spreadsheet":["ods"],"application/vnd.oasis.opendocument.spreadsheet-template":["ots"],"application/vnd.oasis.opendocument.text":["odt"],"application/vnd.oasis.opendocument.text-master":["odm"],"application/vnd.oasis.opendocument.text-template":["ott"],"application/vnd.oasis.opendocument.text-web":["oth"],"application/vnd.olpc-sugar":["xo"],"application/vnd.oma.dd2+xml":["dd2"],"application/vnd.openblox.game+xml":["obgx"],"application/vnd.openofficeorg.extension":["oxt"],"application/vnd.openstreetmap.data+xml":["osm"],"application/vnd.openxmlformats-officedocument.presentationml.presentation":["pptx"],"application/vnd.openxmlformats-officedocument.presentationml.slide":["sldx"],"application/vnd.openxmlformats-officedocument.presentationml.slideshow":["ppsx"],"application/vnd.openxmlformats-officedocument.presentationml.template":["potx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":["xlsx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.template":["xltx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":["docx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.template":["dotx"],"application/vnd.osgeo.mapguide.package":["mgp"],"application/vnd.osgi.dp":["dp"],"application/vnd.osgi.subsystem":["esa"],"application/vnd.palm":["pdb","pqa","oprc"],"application/vnd.pawaafile":["paw"],"application/vnd.pg.format":["str"],"application/vnd.pg.osasli":["ei6"],"application/vnd.picsel":["efif"],"application/vnd.pmi.widget":["wg"],"application/vnd.pocketlearn":["plf"],"application/vnd.powerbuilder6":["pbd"],"application/vnd.previewsystems.box":["box"],"application/vnd.proteus.magazine":["mgz"],"application/vnd.publishare-delta-tree":["qps"],"application/vnd.pvi.ptid1":["ptid"],"application/vnd.quark.quarkxpress":["qxd","qxt","qwd","qwt","qxl","qxb"],"application/vnd.rar":["rar"],"application/vnd.realvnc.bed":["bed"],"application/vnd.recordare.musicxml":["mxl"],"application/vnd.recordare.musicxml+xml":["musicxml"],"application/vnd.rig.cryptonote":["cryptonote"],"application/vnd.rim.cod":["cod"],"application/vnd.rn-realmedia":["rm"],"application/vnd.rn-realmedia-vbr":["rmvb"],"application/vnd.route66.link66+xml":["link66"],"application/vnd.sailingtracker.track":["st"],"application/vnd.seemail":["see"],"application/vnd.sema":["sema"],"application/vnd.semd":["semd"],"application/vnd.semf":["semf"],"application/vnd.shana.informed.formdata":["ifm"],"application/vnd.shana.informed.formtemplate":["itp"],"application/vnd.shana.informed.interchange":["iif"],"application/vnd.shana.informed.package":["ipk"],"application/vnd.simtech-mindmapper":["twd","twds"],"application/vnd.smaf":["mmf"],"application/vnd.smart.teacher":["teacher"],"application/vnd.software602.filler.form+xml":["fo"],"application/vnd.solent.sdkm+xml":["sdkm","sdkd"],"application/vnd.spotfire.dxp":["dxp"],"application/vnd.spotfire.sfs":["sfs"],"application/vnd.stardivision.calc":["sdc"],"application/vnd.stardivision.draw":["sda"],"application/vnd.stardivision.impress":["sdd"],"application/vnd.stardivision.math":["smf"],"application/vnd.stardivision.writer":["sdw","vor"],"application/vnd.stardivision.writer-global":["sgl"],"application/vnd.stepmania.package":["smzip"],"application/vnd.stepmania.stepchart":["sm"],"application/vnd.sun.wadl+xml":["wadl"],"application/vnd.sun.xml.calc":["sxc"],"application/vnd.sun.xml.calc.template":["stc"],"application/vnd.sun.xml.draw":["sxd"],"application/vnd.sun.xml.draw.template":["std"],"application/vnd.sun.xml.impress":["sxi"],"application/vnd.sun.xml.impress.template":["sti"],"application/vnd.sun.xml.math":["sxm"],"application/vnd.sun.xml.writer":["sxw"],"application/vnd.sun.xml.writer.global":["sxg"],"application/vnd.sun.xml.writer.template":["stw"],"application/vnd.sus-calendar":["sus","susp"],"application/vnd.svd":["svd"],"application/vnd.symbian.install":["sis","sisx"],"application/vnd.syncml+xml":["xsm"],"application/vnd.syncml.dm+wbxml":["bdm"],"application/vnd.syncml.dm+xml":["xdm"],"application/vnd.syncml.dmddf+xml":["ddf"],"application/vnd.tao.intent-module-archive":["tao"],"application/vnd.tcpdump.pcap":["pcap","cap","dmp"],"application/vnd.tmobile-livetv":["tmo"],"application/vnd.trid.tpt":["tpt"],"application/vnd.triscape.mxs":["mxs"],"application/vnd.trueapp":["tra"],"application/vnd.ufdl":["ufd","ufdl"],"application/vnd.uiq.theme":["utz"],"application/vnd.umajin":["umj"],"application/vnd.unity":["unityweb"],"application/vnd.uoml+xml":["uoml"],"application/vnd.vcx":["vcx"],"application/vnd.visio":["vsd","vst","vss","vsw"],"application/vnd.visionary":["vis"],"application/vnd.vsf":["vsf"],"application/vnd.wap.wbxml":["wbxml"],"application/vnd.wap.wmlc":["wmlc"],"application/vnd.wap.wmlscriptc":["wmlsc"],"application/vnd.webturbo":["wtb"],"application/vnd.wolfram.player":["nbp"],"application/vnd.wordperfect":["wpd"],"application/vnd.wqd":["wqd"],"application/vnd.wt.stf":["stf"],"application/vnd.xara":["xar"],"application/vnd.xfdl":["xfdl"],"application/vnd.yamaha.hv-dic":["hvd"],"application/vnd.yamaha.hv-script":["hvs"],"application/vnd.yamaha.hv-voice":["hvp"],"application/vnd.yamaha.openscoreformat":["osf"],"application/vnd.yamaha.openscoreformat.osfpvg+xml":["osfpvg"],"application/vnd.yamaha.smaf-audio":["saf"],"application/vnd.yamaha.smaf-phrase":["spf"],"application/vnd.yellowriver-custom-menu":["cmp"],"application/vnd.zul":["zir","zirz"],"application/vnd.zzazz.deck+xml":["zaz"],"application/x-7z-compressed":["7z"],"application/x-abiword":["abw"],"application/x-ace-compressed":["ace"],"application/x-apple-diskimage":["*dmg"],"application/x-arj":["arj"],"application/x-authorware-bin":["aab","x32","u32","vox"],"application/x-authorware-map":["aam"],"application/x-authorware-seg":["aas"],"application/x-bcpio":["bcpio"],"application/x-bdoc":["*bdoc"],"application/x-bittorrent":["torrent"],"application/x-blorb":["blb","blorb"],"application/x-bzip":["bz"],"application/x-bzip2":["bz2","boz"],"application/x-cbr":["cbr","cba","cbt","cbz","cb7"],"application/x-cdlink":["vcd"],"application/x-cfs-compressed":["cfs"],"application/x-chat":["chat"],"application/x-chess-pgn":["pgn"],"application/x-chrome-extension":["crx"],"application/x-cocoa":["cco"],"application/x-conference":["nsc"],"application/x-cpio":["cpio"],"application/x-csh":["csh"],"application/x-debian-package":["*deb","udeb"],"application/x-dgc-compressed":["dgc"],"application/x-director":["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"],"application/x-doom":["wad"],"application/x-dtbncx+xml":["ncx"],"application/x-dtbook+xml":["dtb"],"application/x-dtbresource+xml":["res"],"application/x-dvi":["dvi"],"application/x-envoy":["evy"],"application/x-eva":["eva"],"application/x-font-bdf":["bdf"],"application/x-font-ghostscript":["gsf"],"application/x-font-linux-psf":["psf"],"application/x-font-pcf":["pcf"],"application/x-font-snf":["snf"],"application/x-font-type1":["pfa","pfb","pfm","afm"],"application/x-freearc":["arc"],"application/x-futuresplash":["spl"],"application/x-gca-compressed":["gca"],"application/x-glulx":["ulx"],"application/x-gnumeric":["gnumeric"],"application/x-gramps-xml":["gramps"],"application/x-gtar":["gtar"],"application/x-hdf":["hdf"],"application/x-httpd-php":["php"],"application/x-install-instructions":["install"],"application/x-iso9660-image":["*iso"],"application/x-iwork-keynote-sffkey":["*key"],"application/x-iwork-numbers-sffnumbers":["*numbers"],"application/x-iwork-pages-sffpages":["*pages"],"application/x-java-archive-diff":["jardiff"],"application/x-java-jnlp-file":["jnlp"],"application/x-keepass2":["kdbx"],"application/x-latex":["latex"],"application/x-lua-bytecode":["luac"],"application/x-lzh-compressed":["lzh","lha"],"application/x-makeself":["run"],"application/x-mie":["mie"],"application/x-mobipocket-ebook":["prc","mobi"],"application/x-ms-application":["application"],"application/x-ms-shortcut":["lnk"],"application/x-ms-wmd":["wmd"],"application/x-ms-wmz":["wmz"],"application/x-ms-xbap":["xbap"],"application/x-msaccess":["mdb"],"application/x-msbinder":["obd"],"application/x-mscardfile":["crd"],"application/x-msclip":["clp"],"application/x-msdos-program":["*exe"],"application/x-msdownload":["*exe","*dll","com","bat","*msi"],"application/x-msmediaview":["mvb","m13","m14"],"application/x-msmetafile":["*wmf","*wmz","*emf","emz"],"application/x-msmoney":["mny"],"application/x-mspublisher":["pub"],"application/x-msschedule":["scd"],"application/x-msterminal":["trm"],"application/x-mswrite":["wri"],"application/x-netcdf":["nc","cdf"],"application/x-ns-proxy-autoconfig":["pac"],"application/x-nzb":["nzb"],"application/x-perl":["pl","pm"],"application/x-pilot":["*prc","*pdb"],"application/x-pkcs12":["p12","pfx"],"application/x-pkcs7-certificates":["p7b","spc"],"application/x-pkcs7-certreqresp":["p7r"],"application/x-rar-compressed":["*rar"],"application/x-redhat-package-manager":["rpm"],"application/x-research-info-systems":["ris"],"application/x-sea":["sea"],"application/x-sh":["sh"],"application/x-shar":["shar"],"application/x-shockwave-flash":["swf"],"application/x-silverlight-app":["xap"],"application/x-sql":["sql"],"application/x-stuffit":["sit"],"application/x-stuffitx":["sitx"],"application/x-subrip":["srt"],"application/x-sv4cpio":["sv4cpio"],"application/x-sv4crc":["sv4crc"],"application/x-t3vm-image":["t3"],"application/x-tads":["gam"],"application/x-tar":["tar"],"application/x-tcl":["tcl","tk"],"application/x-tex":["tex"],"application/x-tex-tfm":["tfm"],"application/x-texinfo":["texinfo","texi"],"application/x-tgif":["*obj"],"application/x-ustar":["ustar"],"application/x-virtualbox-hdd":["hdd"],"application/x-virtualbox-ova":["ova"],"application/x-virtualbox-ovf":["ovf"],"application/x-virtualbox-vbox":["vbox"],"application/x-virtualbox-vbox-extpack":["vbox-extpack"],"application/x-virtualbox-vdi":["vdi"],"application/x-virtualbox-vhd":["vhd"],"application/x-virtualbox-vmdk":["vmdk"],"application/x-wais-source":["src"],"application/x-web-app-manifest+json":["webapp"],"application/x-x509-ca-cert":["der","crt","pem"],"application/x-xfig":["fig"],"application/x-xliff+xml":["*xlf"],"application/x-xpinstall":["xpi"],"application/x-xz":["xz"],"application/x-zmachine":["z1","z2","z3","z4","z5","z6","z7","z8"],"audio/vnd.dece.audio":["uva","uvva"],"audio/vnd.digital-winds":["eol"],"audio/vnd.dra":["dra"],"audio/vnd.dts":["dts"],"audio/vnd.dts.hd":["dtshd"],"audio/vnd.lucent.voice":["lvp"],"audio/vnd.ms-playready.media.pya":["pya"],"audio/vnd.nuera.ecelp4800":["ecelp4800"],"audio/vnd.nuera.ecelp7470":["ecelp7470"],"audio/vnd.nuera.ecelp9600":["ecelp9600"],"audio/vnd.rip":["rip"],"audio/x-aac":["aac"],"audio/x-aiff":["aif","aiff","aifc"],"audio/x-caf":["caf"],"audio/x-flac":["flac"],"audio/x-m4a":["*m4a"],"audio/x-matroska":["mka"],"audio/x-mpegurl":["m3u"],"audio/x-ms-wax":["wax"],"audio/x-ms-wma":["wma"],"audio/x-pn-realaudio":["ram","ra"],"audio/x-pn-realaudio-plugin":["rmp"],"audio/x-realaudio":["*ra"],"audio/x-wav":["*wav"],"chemical/x-cdx":["cdx"],"chemical/x-cif":["cif"],"chemical/x-cmdf":["cmdf"],"chemical/x-cml":["cml"],"chemical/x-csml":["csml"],"chemical/x-xyz":["xyz"],"image/prs.btif":["btif"],"image/prs.pti":["pti"],"image/vnd.adobe.photoshop":["psd"],"image/vnd.airzip.accelerator.azv":["azv"],"image/vnd.dece.graphic":["uvi","uvvi","uvg","uvvg"],"image/vnd.djvu":["djvu","djv"],"image/vnd.dvb.subtitle":["*sub"],"image/vnd.dwg":["dwg"],"image/vnd.dxf":["dxf"],"image/vnd.fastbidsheet":["fbs"],"image/vnd.fpx":["fpx"],"image/vnd.fst":["fst"],"image/vnd.fujixerox.edmics-mmr":["mmr"],"image/vnd.fujixerox.edmics-rlc":["rlc"],"image/vnd.microsoft.icon":["ico"],"image/vnd.ms-dds":["dds"],"image/vnd.ms-modi":["mdi"],"image/vnd.ms-photo":["wdp"],"image/vnd.net-fpx":["npx"],"image/vnd.pco.b16":["b16"],"image/vnd.tencent.tap":["tap"],"image/vnd.valve.source.texture":["vtf"],"image/vnd.wap.wbmp":["wbmp"],"image/vnd.xiff":["xif"],"image/vnd.zbrush.pcx":["pcx"],"image/x-3ds":["3ds"],"image/x-cmu-raster":["ras"],"image/x-cmx":["cmx"],"image/x-freehand":["fh","fhc","fh4","fh5","fh7"],"image/x-icon":["*ico"],"image/x-jng":["jng"],"image/x-mrsid-image":["sid"],"image/x-ms-bmp":["*bmp"],"image/x-pcx":["*pcx"],"image/x-pict":["pic","pct"],"image/x-portable-anymap":["pnm"],"image/x-portable-bitmap":["pbm"],"image/x-portable-graymap":["pgm"],"image/x-portable-pixmap":["ppm"],"image/x-rgb":["rgb"],"image/x-tga":["tga"],"image/x-xbitmap":["xbm"],"image/x-xpixmap":["xpm"],"image/x-xwindowdump":["xwd"],"message/vnd.wfa.wsc":["wsc"],"model/vnd.collada+xml":["dae"],"model/vnd.dwf":["dwf"],"model/vnd.gdl":["gdl"],"model/vnd.gtw":["gtw"],"model/vnd.mts":["mts"],"model/vnd.opengex":["ogex"],"model/vnd.parasolid.transmit.binary":["x_b"],"model/vnd.parasolid.transmit.text":["x_t"],"model/vnd.sap.vds":["vds"],"model/vnd.usdz+zip":["usdz"],"model/vnd.valve.source.compiled-map":["bsp"],"model/vnd.vtu":["vtu"],"text/prs.lines.tag":["dsc"],"text/vnd.curl":["curl"],"text/vnd.curl.dcurl":["dcurl"],"text/vnd.curl.mcurl":["mcurl"],"text/vnd.curl.scurl":["scurl"],"text/vnd.dvb.subtitle":["sub"],"text/vnd.fly":["fly"],"text/vnd.fmi.flexstor":["flx"],"text/vnd.graphviz":["gv"],"text/vnd.in3d.3dml":["3dml"],"text/vnd.in3d.spot":["spot"],"text/vnd.sun.j2me.app-descriptor":["jad"],"text/vnd.wap.wml":["wml"],"text/vnd.wap.wmlscript":["wmls"],"text/x-asm":["s","asm"],"text/x-c":["c","cc","cxx","cpp","h","hh","dic"],"text/x-component":["htc"],"text/x-fortran":["f","for","f77","f90"],"text/x-handlebars-template":["hbs"],"text/x-java-source":["java"],"text/x-lua":["lua"],"text/x-markdown":["mkd"],"text/x-nfo":["nfo"],"text/x-opml":["opml"],"text/x-org":["*org"],"text/x-pascal":["p","pas"],"text/x-processing":["pde"],"text/x-sass":["sass"],"text/x-scss":["scss"],"text/x-setext":["etx"],"text/x-sfv":["sfv"],"text/x-suse-ymp":["ymp"],"text/x-uuencode":["uu"],"text/x-vcalendar":["vcs"],"text/x-vcard":["vcf"],"video/vnd.dece.hd":["uvh","uvvh"],"video/vnd.dece.mobile":["uvm","uvvm"],"video/vnd.dece.pd":["uvp","uvvp"],"video/vnd.dece.sd":["uvs","uvvs"],"video/vnd.dece.video":["uvv","uvvv"],"video/vnd.dvb.file":["dvb"],"video/vnd.fvt":["fvt"],"video/vnd.mpegurl":["mxu","m4u"],"video/vnd.ms-playready.media.pyv":["pyv"],"video/vnd.uvvu.mp4":["uvu","uvvu"],"video/vnd.vivo":["viv"],"video/x-f4v":["f4v"],"video/x-fli":["fli"],"video/x-flv":["flv"],"video/x-m4v":["m4v"],"video/x-matroska":["mkv","mk3d","mks"],"video/x-mng":["mng"],"video/x-ms-asf":["asf","asx"],"video/x-ms-vob":["vob"],"video/x-ms-wm":["wm"],"video/x-ms-wmv":["wmv"],"video/x-ms-wmx":["wmx"],"video/x-ms-wvx":["wvx"],"video/x-msvideo":["avi"],"video/x-sgi-movie":["movie"],"video/x-smv":["smv"],"x-conference/x-cooltalk":["ice"]}});var Wa=E((sp,Va)=>{"use strict";var Ld=za();Va.exports=new Ld(Ka(),$a())});var Ja,Ha,ye,ze,as=et(()=>{Ja=Ee(J()),Ha=Ee(Wa());(function(i){i.JSON="application/json",i.PLAIN_TEXT="text/plain",i.OCTET_STREAM="octet/stream"})(ye||(ye={}));(function(i){let e=JSON.parse(Ja.PageConfig.getOption("fileTypes")||"{}");function t(s,r=null){s=s.toLowerCase();for(let a of Object.values(e))for(let o of a.extensions||[])if(o===s&&a.mimeTypes&&a.mimeTypes.length)return a.mimeTypes[0];return Ha.default.getType(s)||r||ye.OCTET_STREAM}i.getType=t;function n(s,r){s=s.toLowerCase();for(let a of Object.values(e))if(a.fileFormat===r){for(let o of a.extensions||[])if(o===s)return!0}return!1}i.hasFormat=n})(ze||(ze={}))});var Pe,Xa,xe,Za,ls,Ga,Qa,Ya,Ut,os,cs,$n,eo=et(()=>{Pe=Ee(J()),Xa=Ee(Te()),xe=Ee(J()),Za=Ee(te()),ls=Ee(Z());as();Ga="JupyterLite Storage",Qa="BrowserStorage",Ya=5,Ut=new TextEncoder,os=new TextDecoder("utf-8"),cs=class{constructor(e){var t;this.reduceBytesToString=(n,s)=>n+String.fromCharCode(s),this._serverContents=new Map,this._isDisposed=!1,this._fileChanged=new ls.Signal(this),this._storageName=Ga,this._storageDrivers=null,this._localforage=e.localforage,this._storageName=e.storageName||Ga,this._storageDrivers=e.storageDrivers||null,this._serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Xa.ServerConnection.makeSettings(),this._ready=new Za.PromiseDelegate,this.initialize().catch(console.warn)}dispose(){this.isDisposed||(this._isDisposed=!0,ls.Signal.clearData(this))}get isDisposed(){return this._isDisposed}get name(){return Qa}get serverSettings(){return this._serverSettings}get fileChanged(){return this._fileChanged}async getDownloadUrl(e){e=decodeURIComponent(e.replace(/^\//,""));let n=await(await this.storage).getItem(e);if(n&&n.content!==null){let a;if(n.format==="base64"){let o=atob(n.content),u=new Uint8Array(o.length);for(let c=0;c<o.length;c++)u[c]=o.charCodeAt(c);a=new Blob([u],{type:n.mimetype})}else if(n.format==="json"){let o=JSON.stringify(n.content);a=new Blob([o],{type:n.mimetype})}else a=new Blob([n.content],{type:n.mimetype});return URL.createObjectURL(a)}let s=this.serverSettings.baseUrl;return Pe.URLExt.join(s,"files",Pe.URLExt.encodeParts(e))}async initialize(){await this.initStorage(),this._ready.resolve(void 0)}async initStorage(){this._storage=this.createDefaultStorage(),this._counters=this.createDefaultCounters(),this._checkpoints=this.createDefaultCheckpoints()}get ready(){return this._ready.promise}get storage(){return this.ready.then(()=>this._storage)}get counters(){return this.ready.then(()=>this._counters)}get checkpoints(){return this.ready.then(()=>this._checkpoints)}get defaultStorageOptions(){let e=this._storageDrivers&&this._storageDrivers.length?this._storageDrivers:null;return{version:1,name:this._storageName,...e?{driver:e}:{}}}createDefaultStorage(){return this._localforage.createInstance({description:"Offline Storage for Notebooks and Files",storeName:"files",...this.defaultStorageOptions})}createDefaultCounters(){return this._localforage.createInstance({description:"Store the current file suffix counters",storeName:"counters",...this.defaultStorageOptions})}createDefaultCheckpoints(){return this._localforage.createInstance({description:"Offline Storage for Checkpoints",storeName:"checkpoints",...this.defaultStorageOptions})}async clearStorage(){await Promise.all([(await this.storage).clear(),(await this.counters).clear(),(await this.checkpoints).clear()])}async newUntitled(e){var t,n,s;let r=(t=e==null?void 0:e.path)!==null&&t!==void 0?t:"",a=(n=e==null?void 0:e.type)!==null&&n!==void 0?n:"notebook",o=new Date().toISOString(),u=xe.PathExt.dirname(r),c=xe.PathExt.basename(r),d=xe.PathExt.extname(r),l=await this.get(u).catch(()=>null),p="";r&&!d&&l?(u=`${r}/`,p=""):u&&c?(u=`${u}/`,p=c):(u="",p=r);let v;switch(a){case"directory":{p=`Untitled Folder${await this._incrementCounter("directory")||""}`,v={name:p,path:`${u}${p}`,last_modified:o,created:o,format:"json",mimetype:"",content:null,size:0,writable:!0,type:"directory"};break}case"notebook":{let I=await this._incrementCounter("notebook");p=p||`Untitled${I||""}.ipynb`,v={name:p,path:`${u}${p}`,last_modified:o,created:o,format:"json",mimetype:ye.JSON,content:$n.EMPTY_NB,size:Ut.encode(JSON.stringify($n.EMPTY_NB)).length,writable:!0,type:"notebook"};break}default:{let I=(s=e==null?void 0:e.ext)!==null&&s!==void 0?s:".txt";I.startsWith(".")||(I=`.${I}`);let P=await this._incrementCounter("file"),D=ze.getType(I)||ye.OCTET_STREAM,q;ze.hasFormat(I,"text")||D.indexOf("text")!==-1?q="text":I.indexOf("json")!==-1||I.indexOf("ipynb")!==-1?q="json":q="base64",p=p||`untitled${P||""}${I}`,v={name:p,path:`${u}${p}`,last_modified:o,created:o,format:q,mimetype:D,content:"",size:0,writable:!0,type:"file"};break}}let _=v.path;return await(await this.storage).setItem(_,v),this._fileChanged.emit({type:"new",oldValue:null,newValue:v}),v}async copy(e,t){let n=xe.PathExt.basename(e);for(t=t===""?"":`${xe.PathExt.removeSlash(t)}/`;await this.get(`${t}${n}`,{content:!0}).then(()=>!0).catch(()=>!1);){let a=xe.PathExt.extname(n);n=`${n.replace(a,"")} (copy)${a}`}let s=`${t}${n}`,r=await this.get(e,{content:!0}).catch(()=>null);if(!r)throw Error(`Could not find file with path ${e}`);return r={...r,name:n,path:s},await(await this.storage).setItem(s,r),this._fileChanged.emit({type:"new",oldValue:null,newValue:r}),r}async get(e,t){if(e=decodeURIComponent(e.replace(/^\//,"")),e===""){let o=await this._getFolder(e);if(o===null)throw Error(`Could not find file with path ${e}`);return o}let n=await this.storage,s=await n.getItem(e),r=await this._getServerContents(e,t),a=s||r;if(!a)throw Error(`Could not find content with path ${e}`);if(!(t!=null&&t.content))return{size:0,...a,content:null};if(a.type==="directory"){let o=new Map;await n.iterate((d,l)=>{l===`${e}/${d.name}`&&o.set(d.name,d)});let u=r?r.content:Array.from((await this._getServerDirectory(e)).values());for(let d of u)o.has(d.name)||o.set(d.name,d);let c=[...o.values()];return{name:xe.PathExt.basename(e),path:e,last_modified:a.last_modified,created:a.created,format:"json",mimetype:ye.JSON,content:c,size:0,writable:!0,type:"directory"}}return a}async rename(e,t){let n=decodeURIComponent(e),s=await this.get(n,{content:!0}).catch(()=>null);if(!s)throw Error(`Could not find file with path ${n}`);let r=new Date().toISOString(),a=xe.PathExt.basename(t),o={...s,name:a,path:t,last_modified:r},u=await this.storage;if(await u.setItem(t,o),await u.removeItem(n),await(await this.checkpoints).removeItem(n),s.type==="directory"){let c;for(c of s.content)await this.rename(Pe.URLExt.join(e,c.name),Pe.URLExt.join(t,c.name))}return this._fileChanged.emit({type:"rename",oldValue:{path:e},newValue:o}),o}async save(e,t={}){var n;e=decodeURIComponent(e);let s=xe.PathExt.extname((n=t.name)!==null&&n!==void 0?n:""),r=t.chunk,a=r?r>1||r===-1:!1,o=await this.get(e,{content:a}).catch(()=>null);if(o||(o=await this.newUntitled({path:e,ext:s,type:"file"})),!o)throw Error(`Could not find file with path ${e}`);let u=o.content,c=new Date().toISOString();if(o={...o,...t,last_modified:c},t.content&&t.format==="base64"){let d=r?r===-1:!0,l=this._handleUploadChunk(t.content,u,a);if(s===".ipynb"){let p=d?JSON.parse(os.decode(this._binaryStringToBytes(l))):l;o={...o,content:p,format:"json",type:"notebook",size:l.length}}else if(ze.hasFormat(s,"json")){let p=d?JSON.parse(os.decode(this._binaryStringToBytes(l))):l;o={...o,content:p,format:"json",type:"file",size:l.length}}else if(ze.hasFormat(s,"text")){let p=d?os.decode(this._binaryStringToBytes(l)):l;o={...o,content:p,format:"text",type:"file",size:l.length}}else{let p=d?btoa(l):l;o={...o,content:p,format:"base64",type:"file",size:l.length}}}if(o.content)switch(t.format){case"json":{o={...o,size:Ut.encode(JSON.stringify(o.content)).length};break}case"text":{o={...o,size:Ut.encode(o.content).length};break}case"base64":break;default:{o={...o,size:0};break}}else o={...o,size:0};return await(await this.storage).setItem(e,o),this._fileChanged.emit({type:"save",oldValue:null,newValue:o}),o}async delete(e){e=decodeURIComponent(e);let t=`${e}/`,n=(await(await this.storage).keys()).filter(s=>s===e||s.startsWith(t));await Promise.all(n.map(this.forgetPath,this)),this._fileChanged.emit({type:"delete",oldValue:{path:e},newValue:null})}async forgetPath(e){await Promise.all([(await this.storage).removeItem(e),(await this.checkpoints).removeItem(e)])}async createCheckpoint(e){var t;let n=await this.checkpoints;e=decodeURIComponent(e);let s=await this.get(e,{content:!0}).catch(()=>null);if(!s)throw Error(`Could not find file with path ${e}`);let r=((t=await n.getItem(e))!==null&&t!==void 0?t:[]).filter(Boolean);return r.push(s),r.length>Ya&&r.splice(0,r.length-Ya),await n.setItem(e,r),{id:`${r.length-1}`,last_modified:s.last_modified}}async listCheckpoints(e){return(await(await this.checkpoints).getItem(e)||[]).filter(Boolean).map(this.normalizeCheckpoint,this)}normalizeCheckpoint(e,t){return{id:t.toString(),last_modified:e.last_modified}}async restoreCheckpoint(e,t){e=decodeURIComponent(e);let n=await(await this.checkpoints).getItem(e)||[],s=parseInt(t),r=n[s];await(await this.storage).setItem(e,r)}async deleteCheckpoint(e,t){e=decodeURIComponent(e);let n=await(await this.checkpoints).getItem(e)||[],s=parseInt(t);n.splice(s,1),await(await this.checkpoints).setItem(e,n)}_handleUploadChunk(e,t,n){let s=atob(e);return n?t+s:s}_binaryStringToBytes(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}async _getFolder(e){let t=new Map;await(await this.storage).iterate((s,r)=>{r.includes("/")||t.set(s.path,s)});for(let s of(await this._getServerDirectory(e)).values())t.has(s.path)||t.set(s.path,s);return e&&t.size===0?null:{name:"",path:e,last_modified:new Date(0).toISOString(),created:new Date(0).toISOString(),format:"json",mimetype:ye.JSON,content:Array.from(t.values()),size:0,writable:!0,type:"directory"}}async _getServerContents(e,t){let n=xe.PathExt.basename(e),r=(await this._getServerDirectory(Pe.URLExt.join(e,".."))).get(n);if(!r)return null;if(r=r||{name:n,path:e,last_modified:new Date(0).toISOString(),created:new Date(0).toISOString(),format:"text",mimetype:ye.PLAIN_TEXT,type:"file",writable:!0,size:0,content:""},t!=null&&t.content)if(r.type==="directory"){let a=await this._getServerDirectory(e);r={...r,content:Array.from(a.values())}}else{let a=Pe.URLExt.join(Pe.PageConfig.getBaseUrl(),"files",e),o=await fetch(a);if(!o.ok)return null;let u=r.mimetype||o.headers.get("Content-Type"),c=xe.PathExt.extname(n);if(r.type==="notebook"||ze.hasFormat(c,"json")||(u==null?void 0:u.indexOf("json"))!==-1||e.match(/\.(ipynb|[^/]*json[^/]*)$/)){let d=await o.text();r={...r,content:JSON.parse(d),format:"json",mimetype:r.mimetype||ye.JSON,size:Ut.encode(d).length}}else if(ze.hasFormat(c,"text")||u.indexOf("text")!==-1){let d=await o.text();r={...r,content:d,format:"text",mimetype:u||ye.PLAIN_TEXT,size:Ut.encode(d).length}}else{let d=await o.arrayBuffer(),l=new Uint8Array(d);r={...r,content:btoa(l.reduce(this.reduceBytesToString,"")),format:"base64",mimetype:u||ye.OCTET_STREAM,size:l.length}}}return r}async _getServerDirectory(e){let t=this._serverContents.get(e)||new Map;if(!this._serverContents.has(e)){let n=Pe.URLExt.join(Pe.PageConfig.getBaseUrl(),"api/contents",e,"all.json");try{let s=await fetch(n),r=JSON.parse(await s.text());for(let a of r.content)t.set(a.name,a)}catch(s){console.warn(`don't worry, about ${s}... nothing's broken. If there had been a
|
|
10
|
-
file at ${n}, you might see some more files.`)}this._serverContents.set(e,t)}return t}async _incrementCounter(e){var t;let n=await this.counters,r=((t=await n.getItem(e))!==null&&t!==void 0?t:-1)+1;return await n.setItem(e,r),r}};(function(i){i.EMPTY_NB={metadata:{orig_nbformat:4},nbformat_minor:5,nbformat:4,cells:[]}})($n||($n={}))});function ds(i){return"node"in i}var At,to,no,io,us=et(()=>{At=16895,to=33206,no=1,io=2});var ro,Gn,zd,Fd,so,Vn,Wn,Jn,Hn,Nt,ps=et(()=>{us();ro=":",Gn=4096,zd=new TextEncoder,Fd=new TextDecoder("utf-8"),so={0:!1,1:!0,2:!0,64:!0,65:!0,66:!0,129:!0,193:!0,514:!0,577:!0,578:!0,705:!0,706:!0,1024:!0,1025:!0,1026:!0,1089:!0,1090:!0,1153:!0,1154:!0,1217:!0,1218:!0,4096:!0,4098:!0},Vn=class{constructor(e){this.fs=e}open(e){let t=this.fs.realPath(e.node);this.fs.FS.isFile(e.node.mode)&&(e.file=this.fs.API.get(t))}close(e){if(!this.fs.FS.isFile(e.node.mode)||!e.file)return;let t=this.fs.realPath(e.node),n=e.flags,s=typeof n=="string"?parseInt(n,10):n;s&=8191;let r=!0;s in so&&(r=so[s]),r&&this.fs.API.put(t,e.file),e.file=void 0}read(e,t,n,s,r){if(s<=0||e.file===void 0||r>=(e.file.data.length||0))return 0;let a=Math.min(e.file.data.length-r,s);return t.set(e.file.data.subarray(r,r+a),n),a}write(e,t,n,s,r){var a;if(s<=0||e.file===void 0)return 0;if(e.node.timestamp=Date.now(),r+s>(((a=e.file)===null||a===void 0?void 0:a.data.length)||0)){let o=e.file.data?e.file.data:new Uint8Array;e.file.data=new Uint8Array(r+s),e.file.data.set(o)}return e.file.data.set(t.subarray(n,n+s),r),s}llseek(e,t,n){let s=t;if(n===1)s+=e.position;else if(n===2&&this.fs.FS.isFile(e.node.mode))if(e.file!==void 0)s+=e.file.data.length;else throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EPERM);if(s<0)throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EINVAL);return s}},Wn=class{constructor(e){this.node=t=>ds(t)?t.node:t,this.getattr=t=>{let n=this.node(t);return{...this.fs.API.getattr(this.fs.realPath(n)),mode:n.mode,ino:n.id}},this.setattr=(t,n)=>{let s=this.node(t);for(let[r,a]of Object.entries(n))switch(r){case"mode":s.mode=a;break;case"timestamp":s.timestamp=a;break;case"size":{let o=a,u=this.fs.realPath(s);if(this.fs.FS.isFile(s.mode)&&o>=0){let c=this.fs.API.get(u),d=c.data?c.data:new Uint8Array;o!==d.length&&(o<d.length?c.data=c.data.slice(0,o):(c.data=new Uint8Array(o),c.data.set(d)),this.fs.API.put(u,c))}else console.warn("setattr size of",o,"on",s,"not yet implemented");break}default:console.warn("setattr",r,"of",a,"on",s,"not yet implemented");break}},this.lookup=(t,n)=>{let s=this.node(t),r=this.fs.PATH.join2(this.fs.realPath(s),n),a=this.fs.API.lookup(r);if(!a.ok)throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.ENOENT);return this.fs.createNode(s,n,a.mode,0)},this.mknod=(t,n,s,r)=>{let a=this.node(t),o=this.fs.PATH.join2(this.fs.realPath(a),n);return this.fs.API.mknod(o,s),this.fs.createNode(a,n,s,r)},this.rename=(t,n,s)=>{let r=this.node(t),a=this.node(n);this.fs.API.rename(r.parent?this.fs.PATH.join2(this.fs.realPath(r.parent),r.name):r.name,this.fs.PATH.join2(this.fs.realPath(a),s)),r.name=s,r.parent=a},this.unlink=(t,n)=>this.fs.API.rmdir(this.fs.PATH.join2(this.fs.realPath(this.node(t)),n)),this.rmdir=(t,n)=>this.fs.API.rmdir(this.fs.PATH.join2(this.fs.realPath(this.node(t)),n)),this.readdir=t=>this.fs.API.readdir(this.fs.realPath(this.node(t))),this.symlink=(t,n,s)=>{throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EPERM)},this.readlink=t=>{throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EPERM)},this.fs=e}},Jn=class{constructor(e){this._driveName=e.driveName,this._mountpoint=e.mountpoint,this.FS=e.FS,this.ERRNO_CODES=e.ERRNO_CODES}lookup(e){return this.request({method:"lookup",path:this.normalizePath(e)})}getmode(e){return this.request({method:"getmode",path:this.normalizePath(e)})}mknod(e,t){return this.request({method:"mknod",path:this.normalizePath(e),data:{mode:t}})}rename(e,t){return this.request({method:"rename",path:this.normalizePath(e),data:{newPath:this.normalizePath(t)}})}readdir(e){let t=this.request({method:"readdir",path:this.normalizePath(e)});return t.push("."),t.push(".."),t}rmdir(e){return this.request({method:"rmdir",path:this.normalizePath(e)})}get(e){let t=this.request({method:"get",path:this.normalizePath(e)});if(!t)throw new this.FS.ErrnoError(this.ERRNO_CODES.ENOENT);let n=t.content,s=t.format;switch(s){case"json":case"text":return{data:zd.encode(n),format:s};case"base64":{let r=atob(n),a=r.length,o=new Uint8Array(a);for(let u=0;u<a;u++)o[u]=r.charCodeAt(u);return{data:o,format:s}}default:throw new this.FS.ErrnoError(this.ERRNO_CODES.ENOENT)}}put(e,t){switch(t.format){case"json":case"text":return this.request({method:"put",path:this.normalizePath(e),data:{format:t.format,data:Fd.decode(t.data)}});case"base64":{let n="";for(let s=0;s<t.data.byteLength;s++)n+=String.fromCharCode(t.data[s]);return this.request({method:"put",path:this.normalizePath(e),data:{format:t.format,data:btoa(n)}})}}}getattr(e){let t=this.request({method:"getattr",path:this.normalizePath(e)});return t.atime&&(t.atime=new Date(t.atime)),t.mtime&&(t.mtime=new Date(t.mtime)),t.ctime&&(t.ctime=new Date(t.ctime)),t.size=t.size||0,t}normalizePath(e){return e.startsWith(this._mountpoint)&&(e=e.slice(this._mountpoint.length)),this._driveName&&(e=`${this._driveName}${ro}${e}`),e}},Hn=class extends Jn{constructor(e){super(e),this._baseUrl=e.baseUrl,this._browsingContextId=e.browsingContextId||""}request(e){let t=new XMLHttpRequest;t.open("POST",encodeURI(this.endpoint),!1);let n={data:e,browsingContextId:this._browsingContextId};try{t.send(JSON.stringify(n))}catch(s){console.error(s)}if(t.status>=400)throw new this.FS.ErrnoError(this.ERRNO_CODES.EINVAL);return JSON.parse(t.responseText)}get endpoint(){return`${this._baseUrl}api/drive`}},Nt=class{constructor(e){this.FS=e.FS,this.PATH=e.PATH,this.ERRNO_CODES=e.ERRNO_CODES,this.API=this.createAPI(e),this.driveName=e.driveName,this.node_ops=new Wn(this),this.stream_ops=new Vn(this)}createAPI(e){if(!e.browsingContextId||!e.baseUrl)throw new Error("Cannot create service-worker API without current browsingContextId");return new Hn(e)}mount(e){return this.createNode(null,e.mountpoint,16895,0)}createNode(e,t,n,s){let r=this.FS;if(!r.isDir(n)&&!r.isFile(n))throw new r.ErrnoError(this.ERRNO_CODES.EINVAL);let a=r.createNode(e,t,n,s);return a.node_ops=this.node_ops,a.stream_ops=this.stream_ops,a}getMode(e){return this.API.getmode(e)}realPath(e){let t=[],n=e;for(t.push(n.name);n.parent!==n;)n=n.parent,t.push(n.name);return t.reverse(),this.PATH.join.apply(null,t)}}});var hs,fs,ao=et(()=>{hs=Ee(J());ps();fs=class{constructor(e){this.contentsManager=e.contentsManager}async processDriveRequest(e){switch(e.method){case"readdir":return this.readdir(e);case"rmdir":return this.rmdir(e);case"rename":return this.rename(e);case"getmode":return this.getmode(e);case"lookup":return this.lookup(e);case"mknod":return this.mknod(e);case"getattr":return this.getattr(e);case"get":return this.get(e);case"put":return this.put(e)}throw`Drive request ${e.method} does not exist.`}async readdir(e){let t=await this.contentsManager.get(e.path,{content:!0}),n=[];return t.type==="directory"&&t.content&&(n=t.content.map(s=>s.name)),n}async rmdir(e){return await this.contentsManager.delete(e.path),null}async rename(e){return await this.contentsManager.rename(e.path,e.data.newPath),null}async getmode(e){let t=await this.contentsManager.get(e.path),n;return t.type==="directory"?n=16895:n=33206,n}async lookup(e){let t;try{t={ok:!0,mode:(await this.contentsManager.get(e.path)).type==="directory"?16895:33206}}catch{t={ok:!1}}return t}async mknod(e){let t=await this.contentsManager.newUntitled({path:hs.PathExt.dirname(e.path),type:e.data.mode===16895?"directory":"file",ext:hs.PathExt.extname(e.path)});return await this.contentsManager.rename(t.path,e.path),null}async getattr(e){let t=await this.contentsManager.get(e.path),n=new Date(0).toISOString();return{dev:1,nlink:1,uid:0,gid:0,rdev:0,size:t.size||0,blksize:Gn,blocks:Math.ceil(t.size||0/Gn),atime:t.last_modified||n,mtime:t.last_modified||n,ctime:t.created||n,timestamp:0}}async get(e){let t=await this.contentsManager.get(e.path,{content:!0}),n;return t.type!=="directory"&&(n={content:t.format==="json"?JSON.stringify(t.content):t.content,format:t.format}),n}async put(e){return await this.contentsManager.save(e.path,{content:e.data.format==="json"?JSON.parse(e.data.data):e.data.data,type:"file",format:e.data.format}),null}}});var oo={};xo(oo,{BLOCK_SIZE:()=>Gn,BrowserStorageDrive:()=>cs,ContentsAPI:()=>Jn,DIR_MODE:()=>At,DRIVE_NAME:()=>Qa,DRIVE_SEPARATOR:()=>ro,DriveContentsProcessor:()=>fs,DriveFS:()=>Nt,DriveFSEmscriptenNodeOps:()=>Wn,DriveFSEmscriptenStreamOps:()=>Vn,FILE:()=>ze,FILE_MODE:()=>to,MIME:()=>ye,SEEK_CUR:()=>no,SEEK_END:()=>io,ServiceWorkerContentsAPI:()=>Hn,instanceOfStream:()=>ds});var ms=et(()=>{eo();ps();as();us();ao()});var vs=Symbol("Comlink.proxy"),ko=Symbol("Comlink.endpoint"),Po=Symbol("Comlink.releaseProxy"),Zn=Symbol("Comlink.finalizer"),zt=Symbol("Comlink.thrown"),ys=i=>typeof i=="object"&&i!==null||typeof i=="function",Mo={canHandle:i=>ys(i)&&i[vs],serialize(i){let{port1:e,port2:t}=new MessageChannel;return $t(i,e),[t,[t]]},deserialize(i){return i.start(),Oo(i)}},Eo={canHandle:i=>ys(i)&&zt in i,serialize({value:i}){let e;return i instanceof Error?e={isError:!0,value:{message:i.message,name:i.name,stack:i.stack}}:e={isError:!1,value:i},[e,[]]},deserialize(i){throw i.isError?Object.assign(new Error(i.value.message),i.value):i.value}},ws=new Map([["proxy",Mo],["throw",Eo]]);function Io(i,e){for(let t of i)if(e===t||t==="*"||t instanceof RegExp&&t.test(e))return!0;return!1}function $t(i,e=globalThis,t=["*"]){e.addEventListener("message",function n(s){if(!s||!s.data)return;if(!Io(t,s.origin)){console.warn(`Invalid origin '${s.origin}' for comlink proxy`);return}let{id:r,type:a,path:o}=Object.assign({path:[]},s.data),u=(s.data.argumentList||[]).map(Ge),c;try{let d=o.slice(0,-1).reduce((p,v)=>p[v],i),l=o.reduce((p,v)=>p[v],i);switch(a){case"GET":c=l;break;case"SET":d[o.slice(-1)[0]]=Ge(s.data.value),c=!0;break;case"APPLY":c=l.apply(d,u);break;case"CONSTRUCT":{let p=new l(...u);c=Uo(p)}break;case"ENDPOINT":{let{port1:p,port2:v}=new MessageChannel;$t(i,v),c=qo(p,[p])}break;case"RELEASE":c=void 0;break;default:return}}catch(d){c={value:d,[zt]:0}}Promise.resolve(c).catch(d=>({value:d,[zt]:0})).then(d=>{let[l,p]=Bt(d);e.postMessage(Object.assign(Object.assign({},l),{id:r}),p),a==="RELEASE"&&(e.removeEventListener("message",n),bs(e),Zn in i&&typeof i[Zn]=="function"&&i[Zn]())}).catch(d=>{let[l,p]=Bt({value:new TypeError("Unserializable return value"),[zt]:0});e.postMessage(Object.assign(Object.assign({},l),{id:r}),p)})}),e.start&&e.start()}function Ro(i){return i.constructor.name==="MessagePort"}function bs(i){Ro(i)&&i.close()}function Oo(i,e){let t=new Map;return i.addEventListener("message",function(s){let{data:r}=s;if(!r||!r.id)return;let a=t.get(r.id);if(a)try{a(r)}finally{t.delete(r.id)}}),Qn(i,t,[],e)}function Lt(i){if(i)throw new Error("Proxy has been released and is not useable")}function Ss(i){return tt(i,new Map,{type:"RELEASE"}).then(()=>{bs(i)})}var Ft=new WeakMap,Kt="FinalizationRegistry"in globalThis&&new FinalizationRegistry(i=>{let e=(Ft.get(i)||0)-1;Ft.set(i,e),e===0&&Ss(i)});function Do(i,e){let t=(Ft.get(e)||0)+1;Ft.set(e,t),Kt&&Kt.register(i,e,i)}function jo(i){Kt&&Kt.unregister(i)}function Qn(i,e,t=[],n=function(){}){let s=!1,r=new Proxy(n,{get(a,o){if(Lt(s),o===Po)return()=>{jo(r),Ss(i),e.clear(),s=!0};if(o==="then"){if(t.length===0)return{then:()=>r};let u=tt(i,e,{type:"GET",path:t.map(c=>c.toString())}).then(Ge);return u.then.bind(u)}return Qn(i,e,[...t,o])},set(a,o,u){Lt(s);let[c,d]=Bt(u);return tt(i,e,{type:"SET",path:[...t,o].map(l=>l.toString()),value:c},d).then(Ge)},apply(a,o,u){Lt(s);let c=t[t.length-1];if(c===ko)return tt(i,e,{type:"ENDPOINT"}).then(Ge);if(c==="bind")return Qn(i,e,t.slice(0,-1));let[d,l]=_s(u);return tt(i,e,{type:"APPLY",path:t.map(p=>p.toString()),argumentList:d},l).then(Ge)},construct(a,o){Lt(s);let[u,c]=_s(o);return tt(i,e,{type:"CONSTRUCT",path:t.map(d=>d.toString()),argumentList:u},c).then(Ge)}});return Do(r,i),r}function To(i){return Array.prototype.concat.apply([],i)}function _s(i){let e=i.map(Bt);return[e.map(t=>t[0]),To(e.map(t=>t[1]))]}var xs=new WeakMap;function qo(i,e){return xs.set(i,e),i}function Uo(i){return Object.assign(i,{[vs]:!0})}function Bt(i){for(let[e,t]of ws)if(t.canHandle(i)){let[n,s]=t.serialize(i);return[{type:"HANDLER",name:e,value:n},s]}return[{type:"RAW",value:i},xs.get(i)||[]]}function Ge(i){switch(i.type){case"HANDLER":return ws.get(i.name).deserialize(i.value);case"RAW":return i.value}}function tt(i,e,t,n){return new Promise(s=>{let r=Ao();e.set(r,s),i.start&&i.start(),i.postMessage(Object.assign({id:r},t),n)})}function Ao(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}var lo=Ee(J()),co=Ee(Te());ms();var Yn=class{constructor(){this._options=null;this._initializer=null;this._pyodide=null;this._localPath="";this._driveName="";this._driveFS=null;this._sendWorkerMessage=()=>{};this._logMessage=()=>{};this._initialized=new Promise((e,t)=>{this._initializer={resolve:e,reject:t}})}async initialize(e){var t;if(this._options=e,e.location.includes(":")){let n=e.location.split(":");this._driveName=n[0],this._localPath=n[1]}else this._driveName="",this._localPath=e.location;await this.initRuntime(e),await this.initFilesystem(e),await this.initPackageManager(e),await this.initKernel(e),await this.initGlobals(e),(t=this._initializer)==null||t.resolve()}async initRuntime(e){let{pyodideUrl:t,indexUrl:n}=e,s;t.endsWith(".mjs")?s=(await import(t)).loadPyodide:(importScripts(t),s=self.loadPyodide),this._pyodide=await s({indexURL:n,...e.loadPyodideOptions}),this._pyodide._api.on_fatal=async u=>{let c="";u.name==="Exit"?c="Pyodide has exited and can no longer be used.":c=`Pyodide has suffered a fatal error. Please report this to the Pyodide maintainers.
|
|
11
|
-
The cause of the error was: ${
|
|
12
|
-
${
|
|
9
|
+
See "state database" for more information.`)});var Vi=E(ke=>{"use strict";var td=ke&&ke.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),Et=ke&&ke.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&td(e,i,t)};Object.defineProperty(ke,"__esModule",{value:!0});Et(_a(),ke);Et(ya(),ke);Et(xa(),ke);Et(Ca(),ke);Et(ka(),ke)});var Hi=E(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0});Un.SettingManager=void 0;var Wi=J(),nd=Vi(),qn=de(),id="api/settings",Ji=class extends nd.DataConnector{constructor(e={}){var t;super(),this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:qn.ServerConnection.makeSettings()}async fetch(e){if(!e)throw new Error("Plugin `id` parameter is required for settings fetch.");let{serverSettings:t}=this,{baseUrl:n,appUrl:s}=t,{makeRequest:r,ResponseError:a}=qn.ServerConnection,o=n+s,u=It.url(o,e),c=await r(u,{},t);if(c.status!==200)throw await a.create(c);return c.json()}async list(e){var t,n,s,r;let{serverSettings:a}=this,{baseUrl:o,appUrl:u}=a,{makeRequest:c,ResponseError:d}=qn.ServerConnection,l=o+u,p=It.url(l,"",e==="ids"),v=await c(p,{},a);if(v.status!==200)throw new d(v);let _=await v.json(),I=(n=(t=_==null?void 0:_.settings)===null||t===void 0?void 0:t.map(D=>D.id))!==null&&n!==void 0?n:[],P=[];return e||(P=(r=(s=_==null?void 0:_.settings)===null||s===void 0?void 0:s.map(D=>(D.data={composite:{},user:{}},D)))!==null&&r!==void 0?r:[]),{ids:I,values:P}}async save(e,t){let{serverSettings:n}=this,{baseUrl:s,appUrl:r}=n,{makeRequest:a,ResponseError:o}=qn.ServerConnection,u=s+r,c=It.url(u,e),d={body:JSON.stringify({raw:t}),method:"PUT"},l=await a(c,d,n);if(l.status!==204)throw new o(l)}};Un.SettingManager=Ji;var It;(function(i){function e(t,n,s){let r=s?Wi.URLExt.objectToQueryString({ids_only:!0}):"",a=Wi.URLExt.join(t,id),o=Wi.URLExt.join(a,n);if(!o.startsWith(a))throw new Error("Can only be used for workspaces requests");return`${o}${r}`}i.url=e})(It||(It={}))});var Dt=E(ve=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.TerminalAPIClient=ve.TERMINAL_SERVICE_URL=void 0;ve.isAvailable=Yi;ve.startNew=Pa;ve.listRunning=Ma;ve.shutdownTerminal=Ea;var Rt=J(),Le=de();ve.TERMINAL_SERVICE_URL="api/terminals";function Yi(){return String(Rt.PageConfig.getOption("terminalsAvailable")).toLowerCase()==="true"}async function Pa(i=Le.ServerConnection.makeSettings(),e,t){Ot.errorIfNotAvailable();let n=Rt.URLExt.join(i.baseUrl,ve.TERMINAL_SERVICE_URL),s={method:"POST",body:JSON.stringify({name:e,cwd:t})},r=await Le.ServerConnection.makeRequest(n,s,i);if(r.status!==200)throw await Le.ServerConnection.ResponseError.create(r);return await r.json()}async function Ma(i=Le.ServerConnection.makeSettings()){Ot.errorIfNotAvailable();let e=Rt.URLExt.join(i.baseUrl,ve.TERMINAL_SERVICE_URL),t=await Le.ServerConnection.makeRequest(e,{},i);if(t.status!==200)throw await Le.ServerConnection.ResponseError.create(t);let n=await t.json();if(!Array.isArray(n))throw new Error("Invalid terminal list");return n}async function Ea(i,e=Le.ServerConnection.makeSettings()){var t;Ot.errorIfNotAvailable();let n=Rt.URLExt.join(e.baseUrl,ve.TERMINAL_SERVICE_URL),s=Rt.URLExt.join(n,i);if(!s.startsWith(n))throw new Error("Can only be used for terminal requests");let r={method:"DELETE"},a=await Le.ServerConnection.makeRequest(s,r,e);if(a.status===404){let u=(t=(await a.json()).message)!==null&&t!==void 0?t:`The terminal session "${i}"" does not exist on the server`;console.warn(u)}else if(a.status!==204)throw await Le.ServerConnection.ResponseError.create(a)}var Gi=class{constructor(e={}){var t;this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Le.ServerConnection.makeSettings()}get isAvailable(){return Yi()}async startNew(e={}){let{name:t,cwd:n}=e;return Pa(this.serverSettings,t,n)}async listRunning(){return Ma(this.serverSettings)}async shutdown(e){return Ea(e,this.serverSettings)}};ve.TerminalAPIClient=Gi;var Ot;(function(i){function e(){if(!Yi())throw new Error("Terminals Unavailable")}i.errorIfNotAvailable=e})(Ot||(Ot={}))});var Ia=E(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.isAvailable=void 0;var sd=Dt();Object.defineProperty(An,"isAvailable",{enumerable:!0,get:function(){return sd.isAvailable}})});var Ra=E(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.TerminalConnection=void 0;var rd=J(),ad=te(),Nn=Z(),od=Te(),ld=Dt(),Xi=class i{constructor(e){var t,n;this._createSocket=()=>{this._errorIfDisposed(),this._clearSocket(),this._updateConnectionStatus("connecting");let s=this._name,r=this.serverSettings,a=rd.URLExt.join(r.wsUrl,"terminals","websocket",encodeURIComponent(s)),o=r.token;r.appendToken&&o!==""&&(a=a+`?token=${encodeURIComponent(o)}`),this._ws=new r.WebSocket(a),this._ws.onmessage=this._onWSMessage,this._ws.onclose=this._onWSClose,this._ws.onerror=this._onWSClose},this._onWSMessage=s=>{if(this._isDisposed)return;let r=JSON.parse(s.data);if(r[0]==="disconnect"&&this.dispose(),this._connectionStatus==="connecting"){r[0]==="setup"&&this._updateConnectionStatus("connected");return}this._messageReceived.emit({type:r[0],content:r.slice(1)})},this._onWSClose=s=>{console.warn(`Terminal websocket closed: ${s.code}`),this.isDisposed||this._reconnect()},this._connectionStatus="connecting",this._connectionStatusChanged=new Nn.Signal(this),this._isDisposed=!1,this._disposed=new Nn.Signal(this),this._messageReceived=new Nn.Signal(this),this._reconnectTimeout=null,this._ws=null,this._noOp=()=>{},this._reconnectLimit=7,this._reconnectAttempt=0,this._pendingMessages=[],this._name=e.model.name,this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:od.ServerConnection.makeSettings(),this._terminalAPIClient=(n=e.terminalAPIClient)!==null&&n!==void 0?n:new ld.TerminalAPIClient({serverSettings:this.serverSettings}),this._createSocket()}get disposed(){return this._disposed}get messageReceived(){return this._messageReceived}get name(){return this._name}get model(){return{name:this._name}}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed||(this._isDisposed=!0,this._disposed.emit(),this._updateConnectionStatus("disconnected"),this._clearSocket(),Nn.Signal.clearData(this))}send(e){this._sendMessage(e)}_sendMessage(e,t=!0){if(!(this._isDisposed||!e.content))if(this.connectionStatus==="connected"&&this._ws){let n=[e.type,...e.content];this._ws.send(JSON.stringify(n))}else if(t)this._pendingMessages.push(e);else throw new Error(`Could not send message: ${JSON.stringify(e)}`)}_sendPending(){for(;this.connectionStatus==="connected"&&this._pendingMessages.length>0;)this._sendMessage(this._pendingMessages[0],!1),this._pendingMessages.shift()}reconnect(){this._errorIfDisposed();let e=new ad.PromiseDelegate,t=(n,s)=>{s==="connected"?(e.resolve(),this.connectionStatusChanged.disconnect(t,this)):s==="disconnected"&&(e.reject(new Error("Terminal connection disconnected")),this.connectionStatusChanged.disconnect(t,this))};return this.connectionStatusChanged.connect(t,this),this._reconnectAttempt=0,this._reconnect(),e.promise}_reconnect(){if(this._errorIfDisposed(),clearTimeout(this._reconnectTimeout),this._reconnectAttempt<this._reconnectLimit){this._updateConnectionStatus("connecting");let e=Zi.getRandomIntInclusive(0,1e3*(Math.pow(2,this._reconnectAttempt)-1));console.error(`Connection lost, reconnecting in ${Math.floor(e/1e3)} seconds.`),this._reconnectTimeout=setTimeout(this._createSocket,e),this._reconnectAttempt+=1}else this._updateConnectionStatus("disconnected");this._clearSocket()}_clearSocket(){this._ws!==null&&(this._ws.onopen=this._noOp,this._ws.onclose=this._noOp,this._ws.onerror=this._noOp,this._ws.onmessage=this._noOp,this._ws.close(),this._ws=null)}async shutdown(){await this._terminalAPIClient.shutdown(this.name),this.dispose()}clone(){return new i({model:this.model,serverSettings:this.serverSettings,terminalAPIClient:this._terminalAPIClient})}_updateConnectionStatus(e){this._connectionStatus!==e&&(this._connectionStatus=e,e!=="connecting"&&(this._reconnectAttempt=0,clearTimeout(this._reconnectTimeout)),e==="connected"&&this._sendPending(),this._connectionStatusChanged.emit(e))}_errorIfDisposed(){if(this.isDisposed)throw new Error("Terminal connection is disposed")}get connectionStatusChanged(){return this._connectionStatusChanged}get connectionStatus(){return this._connectionStatus}};Ln.TerminalConnection=Xi;var Zi;(function(i){function e(t,n){return t=Math.ceil(t),n=Math.floor(n),Math.floor(Math.random()*(n-t+1))+t}i.getRandomIntInclusive=e})(Zi||(Zi={}))});var Da=E(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.TerminalManager=void 0;var cd=Xe(),Oa=Z(),dd=Te(),ud=Ye(),pd=Dt(),hd=Ra(),jt=class extends ud.BaseManager{constructor(e={}){var t,n;if(super(e),this._isReady=!1,this._names=[],this._terminalConnections=new Set,this._runningChanged=new Oa.Signal(this),this._connectionFailure=new Oa.Signal(this),this._terminalAPIClient=(t=e.terminalAPIClient)!==null&&t!==void 0?t:new pd.TerminalAPIClient({serverSettings:this.serverSettings}),!this.isAvailable()){this._ready=Promise.reject("Terminals unavailable"),this._ready.catch(s=>{});return}this._pollModels=new cd.Poll({auto:!1,factory:()=>this.requestRunning(),frequency:{interval:10*1e3,backoff:!0,max:300*1e3},name:"@jupyterlab/services:TerminalManager#models",standby:(n=e.standby)!==null&&n!==void 0?n:"when-hidden"}),this._ready=(async()=>{await this._pollModels.start(),await this._pollModels.tick,this._isReady=!0})()}get isReady(){return this._isReady}get ready(){return this._ready}get runningChanged(){return this._runningChanged}get connectionFailure(){return this._connectionFailure}dispose(){this.isDisposed||(this._names.length=0,this._terminalConnections.forEach(e=>e.dispose()),this._pollModels.dispose(),super.dispose())}isAvailable(){return this._terminalAPIClient.isAvailable}connectTo(e){let t=new hd.TerminalConnection({...e,serverSettings:this.serverSettings,terminalAPIClient:this._terminalAPIClient});return this._onStarted(t),this._names.includes(e.model.name)||this.refreshRunning().catch(()=>{}),t}running(){return this._models[Symbol.iterator]()}async refreshRunning(){await this._pollModels.refresh(),await this._pollModels.tick}async startNew(e={}){let{name:t,cwd:n}=e,s=await this._terminalAPIClient.startNew({name:t,cwd:n});return await this.refreshRunning(),this.connectTo({model:s})}async shutdown(e){await this._terminalAPIClient.shutdown(e),await this.refreshRunning()}async shutdownAll(){await this.refreshRunning(),await Promise.all(this._names.map(e=>this._terminalAPIClient.shutdown(e))),await this.refreshRunning()}async requestRunning(){var e,t;let n;try{n=await this._terminalAPIClient.listRunning()}catch(r){throw(r instanceof dd.ServerConnection.NetworkError||((e=r.response)===null||e===void 0?void 0:e.status)===503||((t=r.response)===null||t===void 0?void 0:t.status)===424)&&this._connectionFailure.emit(r),r}if(this.isDisposed)return;let s=n.map(({name:r})=>r).sort();s!==this._names&&(this._names=s,this._terminalConnections.forEach(r=>{s.includes(r.name)||r.dispose()}),this._runningChanged.emit(this._models))}_onStarted(e){this._terminalConnections.add(e),e.disposed.connect(this._onDisposed,this)}_onDisposed(e){this._terminalConnections.delete(e),this.refreshRunning().catch(()=>{})}get _models(){return this._names.map(e=>({name:e}))}};Tt.TerminalManager=jt;(function(i){class e extends i{constructor(){super(...arguments),this._readyPromise=new Promise(()=>{})}get isActive(){return!1}get parentReady(){return super.ready}get ready(){return this.parentReady.then(()=>this._readyPromise)}async startNew(n){return Promise.reject(new Error("Not implemented in no-op Terminal Manager"))}connectTo(n){throw Error("Not implemented in no-op Terminal Manager")}async shutdown(n){return Promise.reject(new Error("Not implemented in no-op Terminal Manager"))}async requestRunning(){return Promise.resolve()}}i.NoopManager=e})(jt||(Tt.TerminalManager=jt={}))});var Qi=E(me=>{"use strict";var ja=me&&me.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),fd=me&&me.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),Ta=me&&me.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&ja(e,i,t);return fd(e,i),e},md=me&&me.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&ja(e,i,t)};Object.defineProperty(me,"__esModule",{value:!0});me.TerminalAPI=me.Terminal=void 0;var gd=Ta(Ia());me.Terminal=gd;var _d=Ta(Dt());me.TerminalAPI=_d;md(Da(),me)});var is=E(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.UserManager=void 0;var vd=J(),yd=te(),wd=Xe(),qa=Z(),bd=de(),Sd=Ye(),xd="api/me",es="@jupyterlab/services:UserManager#user",ts=class extends Sd.BaseManager{constructor(e={}){var t;super(e),this._isReady=!1,this._userChanged=new qa.Signal(this),this._connectionFailure=new qa.Signal(this),this._ready=this.requestUser().then(()=>{this.isDisposed||(this._isReady=!0)}).catch(n=>new Promise(()=>{})),this._pollSpecs=new wd.Poll({auto:!1,factory:()=>this.requestUser(),frequency:{interval:61*1e3,backoff:!0,max:300*1e3},name:es,standby:(t=e.standby)!==null&&t!==void 0?t:"when-hidden"}),this.ready.then(()=>{this._pollSpecs.start()})}get isReady(){return this._isReady}get ready(){return this._ready}get identity(){return this._identity}get permissions(){return this._permissions}get userChanged(){return this._userChanged}get connectionFailure(){return this._connectionFailure}dispose(){this._pollSpecs.dispose(),super.dispose()}async refreshUser(){await this._pollSpecs.refresh(),await this._pollSpecs.tick}async requestUser(){if(this.isDisposed)return;let{baseUrl:e}=this.serverSettings,{makeRequest:t,ResponseError:n}=bd.ServerConnection,s=vd.URLExt.join(e,xd),r=await t(s,{},this.serverSettings);if(r.status!==200)throw await n.create(r);let a={identity:this._identity,permissions:this._permissions},o=await r.json(),u=o.identity,{localStorage:c}=window,d=c.getItem(es);if(d&&(!u.initials||!u.color)){let l=JSON.parse(d);u.initials=u.initials||l.initials||u.name.substring(0,1),u.color=u.color||l.color||ns.getRandomColor()}yd.JSONExt.deepEqual(o,a)||(this._identity=u,this._permissions=o.permissions,c.setItem(es,JSON.stringify(u)),this._userChanged.emit(o))}};zn.UserManager=ts;var ns;(function(i){let e=["var(--jp-collaborator-color1)","var(--jp-collaborator-color2)","var(--jp-collaborator-color3)","var(--jp-collaborator-color4)","var(--jp-collaborator-color5)","var(--jp-collaborator-color6)","var(--jp-collaborator-color7)"];i.getRandomColor=()=>e[Math.floor(Math.random()*e.length)]})(ns||(ns={}))});var rs=E(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:!0});Fn.WorkspaceManager=void 0;var Ua=J(),Cd=Vi(),qt=de(),kd="api/workspaces",ss=class extends Cd.DataConnector{constructor(e={}){var t;super(),this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:qt.ServerConnection.makeSettings()}async fetch(e){let{serverSettings:t}=this,{baseUrl:n,appUrl:s}=t,{makeRequest:r,ResponseError:a}=qt.ServerConnection,o=n+s,u=dt.url(o,e),c=await r(u,{},t);if(c.status!==200)throw await a.create(c);return c.json()}async list(){let{serverSettings:e}=this,{baseUrl:t,appUrl:n}=e,{makeRequest:s,ResponseError:r}=qt.ServerConnection,a=t+n,o=dt.url(a,""),u=await s(o,{},e);if(u.status!==200)throw await r.create(u);return(await u.json()).workspaces}async remove(e){let{serverSettings:t}=this,{baseUrl:n,appUrl:s}=t,{makeRequest:r,ResponseError:a}=qt.ServerConnection,o=n+s,u=dt.url(o,e),d=await r(u,{method:"DELETE"},t);if(d.status!==204)throw await a.create(d)}async save(e,t){let{serverSettings:n}=this,{baseUrl:s,appUrl:r}=n,{makeRequest:a,ResponseError:o}=qt.ServerConnection,u=s+r,c=dt.url(u,e),d={body:JSON.stringify(t),method:"PUT"},l=await a(c,d,n);if(l.status!==204)throw await o.create(l)}};Fn.WorkspaceManager=ss;var dt;(function(i){function e(t,n){let s=Ua.URLExt.join(t,kd),r=Ua.URLExt.join(s,n);if(!r.startsWith(s))throw new Error("Can only be used for workspaces requests");return r}i.url=e})(dt||(dt={}))});var Na=E(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.ServiceManager=void 0;var Aa=Z(),Pd=na(),Md=wi(),Ed=Si(),Id=Oi(),Rd=ji(),Od=Li(),Dd=de(),jd=Ki(),Td=Hi(),qd=Qi(),Ud=is(),Ad=rs(),as=class{constructor(e={}){var t,n;this._isDisposed=!1,this._connectionFailure=new Aa.Signal(this),this._isReady=!1;let s=e.defaultDrive,r=(t=e.serverSettings)!==null&&t!==void 0?t:Dd.ServerConnection.makeSettings(),a=(n=e.standby)!==null&&n!==void 0?n:"when-hidden",o={defaultDrive:s,serverSettings:r,standby:a};this.serverSettings=r,this.contents=e.contents||new Md.ContentsManager(o),this.events=e.events||new Ed.EventManager(o),this.kernels=e.kernels||new Id.KernelManager(o),this.sessions=e.sessions||new jd.SessionManager({...o,kernelManager:this.kernels}),this.settings=e.settings||new Td.SettingManager(o),this.terminals=e.terminals||new qd.TerminalManager(o),this.builder=e.builder||new Pd.BuildManager(o),this.workspaces=e.workspaces||new Ad.WorkspaceManager(o),this.nbconvert=e.nbconvert||new Od.NbConvertManager(o),this.kernelspecs=e.kernelspecs||new Rd.KernelSpecManager(o),this.user=e.user||new Ud.UserManager(o),this.kernelspecs.connectionFailure.connect(this._onConnectionFailure,this),this.sessions.connectionFailure.connect(this._onConnectionFailure,this),this.terminals.connectionFailure.connect(this._onConnectionFailure,this);let u=[this.sessions.ready,this.kernelspecs.ready];this.terminals.isAvailable()&&u.push(this.terminals.ready),this._readyPromise=Promise.all(u).then(()=>{this._isReady=!0})}get connectionFailure(){return this._connectionFailure}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,Aa.Signal.clearData(this),this.contents.dispose(),this.events.dispose(),this.sessions.dispose(),this.terminals.dispose())}get isReady(){return this._isReady}get ready(){return this._readyPromise}_onConnectionFailure(e,t){this._connectionFailure.emit(t)}};Kn.ServiceManager=as});var La=E(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.IWorkspaceManager=L.IUserManager=L.ITerminalManager=L.IServiceManager=L.ISettingManager=L.ISessionManager=L.IServerSettings=L.INbConvertManager=L.IKernelSpecManager=L.IKernelManager=L.IEventManager=L.IDefaultDrive=L.IContentsManager=L.IConfigSectionManager=L.IConnectionStatus=void 0;var ge=te();L.IConnectionStatus=new ge.Token("@jupyterlab/application:IConnectionStatus","A service providing the application connection status.");L.IConfigSectionManager=new ge.Token("@jupyterlab/services:IConfigSectionManager","A service providing the config section manager.");L.IContentsManager=new ge.Token("@jupyterlab/services:IContentsManager","The contents manager token.");L.IDefaultDrive=new ge.Token("@jupyterlab/services:IDefaultDrive","The default drive for the contents manager.");L.IEventManager=new ge.Token("@jupyterlab/services:IEventManager","The event manager token.");L.IKernelManager=new ge.Token("@jupyterlab/services:IKernelManager","The kernel manager token.");L.IKernelSpecManager=new ge.Token("@jupyterlab/services:IKernelSpecManager","The kernel spec manager token.");L.INbConvertManager=new ge.Token("@jupyterlab/services:INbConvertManager","The nbconvert manager token.");L.IServerSettings=new ge.Token("@jupyterlab/services:IServerSettings","The server settings for the application.");L.ISessionManager=new ge.Token("@jupyterlab/services:ISessionManager","The session manager token.");L.ISettingManager=new ge.Token("@jupyterlab/services:ISettingManager","The setting manager token.");L.IServiceManager=new ge.Token("@jupyterlab/services:IServiceManager","The service manager for the application.");L.ITerminalManager=new ge.Token("@jupyterlab/services:ITerminalManager","The terminal manager token.");L.IUserManager=new ge.Token("@jupyterlab/services:IUserManager","The user manager token.");L.IWorkspaceManager=new ge.Token("@jupyterlab/services:IWorkspaceManager","The workspace manager token.")});var Te=E(W=>{"use strict";var Nd=W&&W.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),le=W&&W.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Nd(e,i,t)};Object.defineProperty(W,"__esModule",{value:!0});le(Ye(),W);le(gr(),W);le(_r(),W);le(wi(),W);le(Si(),W);le(Oi(),W);le(ji(),W);le(Na(),W);le(de(),W);le(Ki(),W);le(Hi(),W);le(Qi(),W);le(La(),W);le(is(),W);le(rs(),W);le(Li(),W)});var Fa=E((tp,za)=>{"use strict";function Bn(){this._types=Object.create(null),this._extensions=Object.create(null);for(let i=0;i<arguments.length;i++)this.define(arguments[i]);this.define=this.define.bind(this),this.getType=this.getType.bind(this),this.getExtension=this.getExtension.bind(this)}Bn.prototype.define=function(i,e){for(let t in i){let n=i[t].map(function(s){return s.toLowerCase()});t=t.toLowerCase();for(let s=0;s<n.length;s++){let r=n[s];if(r[0]!=="*"){if(!e&&r in this._types)throw new Error('Attempt to change mapping for "'+r+'" extension from "'+this._types[r]+'" to "'+t+'". Pass `force=true` to allow this, otherwise remove "'+r+'" from the list of extensions for "'+t+'".');this._types[r]=t}}if(e||!this._extensions[t]){let s=n[0];this._extensions[t]=s[0]!=="*"?s:s.substr(1)}}};Bn.prototype.getType=function(i){i=String(i);let e=i.replace(/^.*[/\\]/,"").toLowerCase(),t=e.replace(/^.*\./,"").toLowerCase(),n=e.length<i.length;return(t.length<e.length-1||!n)&&this._types[t]||null};Bn.prototype.getExtension=function(i){return i=/^\s*([^;\s]*)/.test(i)&&RegExp.$1,i&&this._extensions[i.toLowerCase()]||null};za.exports=Bn});var Ba=E((np,Ka)=>{Ka.exports={"application/andrew-inset":["ez"],"application/applixware":["aw"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomdeleted+xml":["atomdeleted"],"application/atomsvc+xml":["atomsvc"],"application/atsc-dwd+xml":["dwd"],"application/atsc-held+xml":["held"],"application/atsc-rsat+xml":["rsat"],"application/bdoc":["bdoc"],"application/calendar+xml":["xcs"],"application/ccxml+xml":["ccxml"],"application/cdfx+xml":["cdfx"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cu-seeme":["cu"],"application/dash+xml":["mpd"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["es","ecma"],"application/emma+xml":["emma"],"application/emotionml+xml":["emotionml"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/express":["exp"],"application/fdt+xml":["fdt"],"application/font-tdpfr":["pfr"],"application/geo+json":["geojson"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/gzip":["gz"],"application/hjson":["hjson"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/its+xml":["its"],"application/java-archive":["jar","war","ear"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["js","mjs"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/ld+json":["jsonld"],"application/lgr+xml":["lgr"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/manifest+json":["webmanifest"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mmt-aei+xml":["maei"],"application/mmt-usd+xml":["musd"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["mp4s","m4p"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/n-quads":["nq"],"application/n-triples":["nt"],"application/node":["cjs"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/p2p-overlay+xml":["relo"],"application/patch-ops-error+xml":["xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-signature":["asc","sig"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/provenance+xml":["provx"],"application/pskc+xml":["pskcxml"],"application/raml+yaml":["raml"],"application/rdf+xml":["rdf","owl"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/route-apd+xml":["rapd"],"application/route-s-tsid+xml":["sls"],"application/route-usd+xml":["rusd"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/senml+xml":["senmlx"],"application/sensml+xml":["sensmlx"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/sieve":["siv","sieve"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/swid+xml":["swidtag"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/toml":["toml"],"application/trig":["trig"],"application/ttml+xml":["ttml"],"application/ubjson":["ubj"],"application/urc-ressheet+xml":["rsheet"],"application/urc-targetdesc+xml":["td"],"application/voicexml+xml":["vxml"],"application/wasm":["wasm"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/xaml+xml":["xaml"],"application/xcap-att+xml":["xav"],"application/xcap-caps+xml":["xca"],"application/xcap-diff+xml":["xdf"],"application/xcap-el+xml":["xel"],"application/xcap-ns+xml":["xns"],"application/xenc+xml":["xenc"],"application/xhtml+xml":["xhtml","xht"],"application/xliff+xml":["xlf"],"application/xml":["xml","xsl","xsd","rng"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["*xsl","xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"audio/3gpp":["*3gpp"],"audio/adpcm":["adp"],"audio/amr":["amr"],"audio/basic":["au","snd"],"audio/midi":["mid","midi","kar","rmi"],"audio/mobile-xmf":["mxmf"],"audio/mp3":["*mp3"],"audio/mp4":["m4a","mp4a"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx","opus"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/wav":["wav"],"audio/wave":["*wav"],"audio/webm":["weba"],"audio/xm":["xm"],"font/collection":["ttc"],"font/otf":["otf"],"font/ttf":["ttf"],"font/woff":["woff"],"font/woff2":["woff2"],"image/aces":["exr"],"image/apng":["apng"],"image/avif":["avif"],"image/bmp":["bmp"],"image/cgm":["cgm"],"image/dicom-rle":["drle"],"image/emf":["emf"],"image/fits":["fits"],"image/g3fax":["g3"],"image/gif":["gif"],"image/heic":["heic"],"image/heic-sequence":["heics"],"image/heif":["heif"],"image/heif-sequence":["heifs"],"image/hej2k":["hej2"],"image/hsj2":["hsj2"],"image/ief":["ief"],"image/jls":["jls"],"image/jp2":["jp2","jpg2"],"image/jpeg":["jpeg","jpg","jpe"],"image/jph":["jph"],"image/jphc":["jhc"],"image/jpm":["jpm"],"image/jpx":["jpx","jpf"],"image/jxr":["jxr"],"image/jxra":["jxra"],"image/jxrs":["jxrs"],"image/jxs":["jxs"],"image/jxsc":["jxsc"],"image/jxsi":["jxsi"],"image/jxss":["jxss"],"image/ktx":["ktx"],"image/ktx2":["ktx2"],"image/png":["png"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/t38":["t38"],"image/tiff":["tif","tiff"],"image/tiff-fx":["tfx"],"image/webp":["webp"],"image/wmf":["wmf"],"message/disposition-notification":["disposition-notification"],"message/global":["u8msg"],"message/global-delivery-status":["u8dsn"],"message/global-disposition-notification":["u8mdn"],"message/global-headers":["u8hdr"],"message/rfc822":["eml","mime"],"model/3mf":["3mf"],"model/gltf+json":["gltf"],"model/gltf-binary":["glb"],"model/iges":["igs","iges"],"model/mesh":["msh","mesh","silo"],"model/mtl":["mtl"],"model/obj":["obj"],"model/step+xml":["stpx"],"model/step+zip":["stpz"],"model/step-xml+zip":["stpxz"],"model/stl":["stl"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["*x3db","x3dbz"],"model/x3d+fastinfoset":["x3db"],"model/x3d+vrml":["*x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"model/x3d-vrml":["x3dv"],"text/cache-manifest":["appcache","manifest"],"text/calendar":["ics","ifb"],"text/coffeescript":["coffee","litcoffee"],"text/css":["css"],"text/csv":["csv"],"text/html":["html","htm","shtml"],"text/jade":["jade"],"text/jsx":["jsx"],"text/less":["less"],"text/markdown":["markdown","md"],"text/mathml":["mml"],"text/mdx":["mdx"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in","ini"],"text/richtext":["rtx"],"text/rtf":["*rtf"],"text/sgml":["sgml","sgm"],"text/shex":["shex"],"text/slim":["slim","slm"],"text/spdx":["spdx"],"text/stylus":["stylus","styl"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vtt":["vtt"],"text/xml":["*xml"],"text/yaml":["yaml","yml"],"video/3gpp":["3gp","3gpp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/iso.segment":["m4s"],"video/jpeg":["jpgv"],"video/jpm":["*jpm","jpgm"],"video/mj2":["mj2","mjp2"],"video/mp2t":["ts"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/webm":["webm"]}});var Va=E((ip,$a)=>{$a.exports={"application/prs.cww":["cww"],"application/vnd.1000minds.decision-model+xml":["1km"],"application/vnd.3gpp.pic-bw-large":["plb"],"application/vnd.3gpp.pic-bw-small":["psb"],"application/vnd.3gpp.pic-bw-var":["pvb"],"application/vnd.3gpp2.tcap":["tcap"],"application/vnd.3m.post-it-notes":["pwn"],"application/vnd.accpac.simply.aso":["aso"],"application/vnd.accpac.simply.imp":["imp"],"application/vnd.acucobol":["acu"],"application/vnd.acucorp":["atc","acutc"],"application/vnd.adobe.air-application-installer-package+zip":["air"],"application/vnd.adobe.formscentral.fcdt":["fcdt"],"application/vnd.adobe.fxp":["fxp","fxpl"],"application/vnd.adobe.xdp+xml":["xdp"],"application/vnd.adobe.xfdf":["xfdf"],"application/vnd.ahead.space":["ahead"],"application/vnd.airzip.filesecure.azf":["azf"],"application/vnd.airzip.filesecure.azs":["azs"],"application/vnd.amazon.ebook":["azw"],"application/vnd.americandynamics.acc":["acc"],"application/vnd.amiga.ami":["ami"],"application/vnd.android.package-archive":["apk"],"application/vnd.anser-web-certificate-issue-initiation":["cii"],"application/vnd.anser-web-funds-transfer-initiation":["fti"],"application/vnd.antix.game-component":["atx"],"application/vnd.apple.installer+xml":["mpkg"],"application/vnd.apple.keynote":["key"],"application/vnd.apple.mpegurl":["m3u8"],"application/vnd.apple.numbers":["numbers"],"application/vnd.apple.pages":["pages"],"application/vnd.apple.pkpass":["pkpass"],"application/vnd.aristanetworks.swi":["swi"],"application/vnd.astraea-software.iota":["iota"],"application/vnd.audiograph":["aep"],"application/vnd.balsamiq.bmml+xml":["bmml"],"application/vnd.blueice.multipass":["mpm"],"application/vnd.bmi":["bmi"],"application/vnd.businessobjects":["rep"],"application/vnd.chemdraw+xml":["cdxml"],"application/vnd.chipnuts.karaoke-mmd":["mmd"],"application/vnd.cinderella":["cdy"],"application/vnd.citationstyles.style+xml":["csl"],"application/vnd.claymore":["cla"],"application/vnd.cloanto.rp9":["rp9"],"application/vnd.clonk.c4group":["c4g","c4d","c4f","c4p","c4u"],"application/vnd.cluetrust.cartomobile-config":["c11amc"],"application/vnd.cluetrust.cartomobile-config-pkg":["c11amz"],"application/vnd.commonspace":["csp"],"application/vnd.contact.cmsg":["cdbcmsg"],"application/vnd.cosmocaller":["cmc"],"application/vnd.crick.clicker":["clkx"],"application/vnd.crick.clicker.keyboard":["clkk"],"application/vnd.crick.clicker.palette":["clkp"],"application/vnd.crick.clicker.template":["clkt"],"application/vnd.crick.clicker.wordbank":["clkw"],"application/vnd.criticaltools.wbs+xml":["wbs"],"application/vnd.ctc-posml":["pml"],"application/vnd.cups-ppd":["ppd"],"application/vnd.curl.car":["car"],"application/vnd.curl.pcurl":["pcurl"],"application/vnd.dart":["dart"],"application/vnd.data-vision.rdz":["rdz"],"application/vnd.dbf":["dbf"],"application/vnd.dece.data":["uvf","uvvf","uvd","uvvd"],"application/vnd.dece.ttml+xml":["uvt","uvvt"],"application/vnd.dece.unspecified":["uvx","uvvx"],"application/vnd.dece.zip":["uvz","uvvz"],"application/vnd.denovo.fcselayout-link":["fe_launch"],"application/vnd.dna":["dna"],"application/vnd.dolby.mlp":["mlp"],"application/vnd.dpgraph":["dpg"],"application/vnd.dreamfactory":["dfac"],"application/vnd.ds-keypoint":["kpxx"],"application/vnd.dvb.ait":["ait"],"application/vnd.dvb.service":["svc"],"application/vnd.dynageo":["geo"],"application/vnd.ecowin.chart":["mag"],"application/vnd.enliven":["nml"],"application/vnd.epson.esf":["esf"],"application/vnd.epson.msf":["msf"],"application/vnd.epson.quickanime":["qam"],"application/vnd.epson.salt":["slt"],"application/vnd.epson.ssf":["ssf"],"application/vnd.eszigno3+xml":["es3","et3"],"application/vnd.ezpix-album":["ez2"],"application/vnd.ezpix-package":["ez3"],"application/vnd.fdf":["fdf"],"application/vnd.fdsn.mseed":["mseed"],"application/vnd.fdsn.seed":["seed","dataless"],"application/vnd.flographit":["gph"],"application/vnd.fluxtime.clip":["ftc"],"application/vnd.framemaker":["fm","frame","maker","book"],"application/vnd.frogans.fnc":["fnc"],"application/vnd.frogans.ltf":["ltf"],"application/vnd.fsc.weblaunch":["fsc"],"application/vnd.fujitsu.oasys":["oas"],"application/vnd.fujitsu.oasys2":["oa2"],"application/vnd.fujitsu.oasys3":["oa3"],"application/vnd.fujitsu.oasysgp":["fg5"],"application/vnd.fujitsu.oasysprs":["bh2"],"application/vnd.fujixerox.ddd":["ddd"],"application/vnd.fujixerox.docuworks":["xdw"],"application/vnd.fujixerox.docuworks.binder":["xbd"],"application/vnd.fuzzysheet":["fzs"],"application/vnd.genomatix.tuxedo":["txd"],"application/vnd.geogebra.file":["ggb"],"application/vnd.geogebra.tool":["ggt"],"application/vnd.geometry-explorer":["gex","gre"],"application/vnd.geonext":["gxt"],"application/vnd.geoplan":["g2w"],"application/vnd.geospace":["g3w"],"application/vnd.gmx":["gmx"],"application/vnd.google-apps.document":["gdoc"],"application/vnd.google-apps.presentation":["gslides"],"application/vnd.google-apps.spreadsheet":["gsheet"],"application/vnd.google-earth.kml+xml":["kml"],"application/vnd.google-earth.kmz":["kmz"],"application/vnd.grafeq":["gqf","gqs"],"application/vnd.groove-account":["gac"],"application/vnd.groove-help":["ghf"],"application/vnd.groove-identity-message":["gim"],"application/vnd.groove-injector":["grv"],"application/vnd.groove-tool-message":["gtm"],"application/vnd.groove-tool-template":["tpl"],"application/vnd.groove-vcard":["vcg"],"application/vnd.hal+xml":["hal"],"application/vnd.handheld-entertainment+xml":["zmm"],"application/vnd.hbci":["hbci"],"application/vnd.hhe.lesson-player":["les"],"application/vnd.hp-hpgl":["hpgl"],"application/vnd.hp-hpid":["hpid"],"application/vnd.hp-hps":["hps"],"application/vnd.hp-jlyt":["jlt"],"application/vnd.hp-pcl":["pcl"],"application/vnd.hp-pclxl":["pclxl"],"application/vnd.hydrostatix.sof-data":["sfd-hdstx"],"application/vnd.ibm.minipay":["mpy"],"application/vnd.ibm.modcap":["afp","listafp","list3820"],"application/vnd.ibm.rights-management":["irm"],"application/vnd.ibm.secure-container":["sc"],"application/vnd.iccprofile":["icc","icm"],"application/vnd.igloader":["igl"],"application/vnd.immervision-ivp":["ivp"],"application/vnd.immervision-ivu":["ivu"],"application/vnd.insors.igm":["igm"],"application/vnd.intercon.formnet":["xpw","xpx"],"application/vnd.intergeo":["i2g"],"application/vnd.intu.qbo":["qbo"],"application/vnd.intu.qfx":["qfx"],"application/vnd.ipunplugged.rcprofile":["rcprofile"],"application/vnd.irepository.package+xml":["irp"],"application/vnd.is-xpr":["xpr"],"application/vnd.isac.fcs":["fcs"],"application/vnd.jam":["jam"],"application/vnd.jcp.javame.midlet-rms":["rms"],"application/vnd.jisp":["jisp"],"application/vnd.joost.joda-archive":["joda"],"application/vnd.kahootz":["ktz","ktr"],"application/vnd.kde.karbon":["karbon"],"application/vnd.kde.kchart":["chrt"],"application/vnd.kde.kformula":["kfo"],"application/vnd.kde.kivio":["flw"],"application/vnd.kde.kontour":["kon"],"application/vnd.kde.kpresenter":["kpr","kpt"],"application/vnd.kde.kspread":["ksp"],"application/vnd.kde.kword":["kwd","kwt"],"application/vnd.kenameaapp":["htke"],"application/vnd.kidspiration":["kia"],"application/vnd.kinar":["kne","knp"],"application/vnd.koan":["skp","skd","skt","skm"],"application/vnd.kodak-descriptor":["sse"],"application/vnd.las.las+xml":["lasxml"],"application/vnd.llamagraphics.life-balance.desktop":["lbd"],"application/vnd.llamagraphics.life-balance.exchange+xml":["lbe"],"application/vnd.lotus-1-2-3":["123"],"application/vnd.lotus-approach":["apr"],"application/vnd.lotus-freelance":["pre"],"application/vnd.lotus-notes":["nsf"],"application/vnd.lotus-organizer":["org"],"application/vnd.lotus-screencam":["scm"],"application/vnd.lotus-wordpro":["lwp"],"application/vnd.macports.portpkg":["portpkg"],"application/vnd.mapbox-vector-tile":["mvt"],"application/vnd.mcd":["mcd"],"application/vnd.medcalcdata":["mc1"],"application/vnd.mediastation.cdkey":["cdkey"],"application/vnd.mfer":["mwf"],"application/vnd.mfmp":["mfm"],"application/vnd.micrografx.flo":["flo"],"application/vnd.micrografx.igx":["igx"],"application/vnd.mif":["mif"],"application/vnd.mobius.daf":["daf"],"application/vnd.mobius.dis":["dis"],"application/vnd.mobius.mbk":["mbk"],"application/vnd.mobius.mqy":["mqy"],"application/vnd.mobius.msl":["msl"],"application/vnd.mobius.plc":["plc"],"application/vnd.mobius.txf":["txf"],"application/vnd.mophun.application":["mpn"],"application/vnd.mophun.certificate":["mpc"],"application/vnd.mozilla.xul+xml":["xul"],"application/vnd.ms-artgalry":["cil"],"application/vnd.ms-cab-compressed":["cab"],"application/vnd.ms-excel":["xls","xlm","xla","xlc","xlt","xlw"],"application/vnd.ms-excel.addin.macroenabled.12":["xlam"],"application/vnd.ms-excel.sheet.binary.macroenabled.12":["xlsb"],"application/vnd.ms-excel.sheet.macroenabled.12":["xlsm"],"application/vnd.ms-excel.template.macroenabled.12":["xltm"],"application/vnd.ms-fontobject":["eot"],"application/vnd.ms-htmlhelp":["chm"],"application/vnd.ms-ims":["ims"],"application/vnd.ms-lrm":["lrm"],"application/vnd.ms-officetheme":["thmx"],"application/vnd.ms-outlook":["msg"],"application/vnd.ms-pki.seccat":["cat"],"application/vnd.ms-pki.stl":["*stl"],"application/vnd.ms-powerpoint":["ppt","pps","pot"],"application/vnd.ms-powerpoint.addin.macroenabled.12":["ppam"],"application/vnd.ms-powerpoint.presentation.macroenabled.12":["pptm"],"application/vnd.ms-powerpoint.slide.macroenabled.12":["sldm"],"application/vnd.ms-powerpoint.slideshow.macroenabled.12":["ppsm"],"application/vnd.ms-powerpoint.template.macroenabled.12":["potm"],"application/vnd.ms-project":["mpp","mpt"],"application/vnd.ms-word.document.macroenabled.12":["docm"],"application/vnd.ms-word.template.macroenabled.12":["dotm"],"application/vnd.ms-works":["wps","wks","wcm","wdb"],"application/vnd.ms-wpl":["wpl"],"application/vnd.ms-xpsdocument":["xps"],"application/vnd.mseq":["mseq"],"application/vnd.musician":["mus"],"application/vnd.muvee.style":["msty"],"application/vnd.mynfc":["taglet"],"application/vnd.neurolanguage.nlu":["nlu"],"application/vnd.nitf":["ntf","nitf"],"application/vnd.noblenet-directory":["nnd"],"application/vnd.noblenet-sealer":["nns"],"application/vnd.noblenet-web":["nnw"],"application/vnd.nokia.n-gage.ac+xml":["*ac"],"application/vnd.nokia.n-gage.data":["ngdat"],"application/vnd.nokia.n-gage.symbian.install":["n-gage"],"application/vnd.nokia.radio-preset":["rpst"],"application/vnd.nokia.radio-presets":["rpss"],"application/vnd.novadigm.edm":["edm"],"application/vnd.novadigm.edx":["edx"],"application/vnd.novadigm.ext":["ext"],"application/vnd.oasis.opendocument.chart":["odc"],"application/vnd.oasis.opendocument.chart-template":["otc"],"application/vnd.oasis.opendocument.database":["odb"],"application/vnd.oasis.opendocument.formula":["odf"],"application/vnd.oasis.opendocument.formula-template":["odft"],"application/vnd.oasis.opendocument.graphics":["odg"],"application/vnd.oasis.opendocument.graphics-template":["otg"],"application/vnd.oasis.opendocument.image":["odi"],"application/vnd.oasis.opendocument.image-template":["oti"],"application/vnd.oasis.opendocument.presentation":["odp"],"application/vnd.oasis.opendocument.presentation-template":["otp"],"application/vnd.oasis.opendocument.spreadsheet":["ods"],"application/vnd.oasis.opendocument.spreadsheet-template":["ots"],"application/vnd.oasis.opendocument.text":["odt"],"application/vnd.oasis.opendocument.text-master":["odm"],"application/vnd.oasis.opendocument.text-template":["ott"],"application/vnd.oasis.opendocument.text-web":["oth"],"application/vnd.olpc-sugar":["xo"],"application/vnd.oma.dd2+xml":["dd2"],"application/vnd.openblox.game+xml":["obgx"],"application/vnd.openofficeorg.extension":["oxt"],"application/vnd.openstreetmap.data+xml":["osm"],"application/vnd.openxmlformats-officedocument.presentationml.presentation":["pptx"],"application/vnd.openxmlformats-officedocument.presentationml.slide":["sldx"],"application/vnd.openxmlformats-officedocument.presentationml.slideshow":["ppsx"],"application/vnd.openxmlformats-officedocument.presentationml.template":["potx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":["xlsx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.template":["xltx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":["docx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.template":["dotx"],"application/vnd.osgeo.mapguide.package":["mgp"],"application/vnd.osgi.dp":["dp"],"application/vnd.osgi.subsystem":["esa"],"application/vnd.palm":["pdb","pqa","oprc"],"application/vnd.pawaafile":["paw"],"application/vnd.pg.format":["str"],"application/vnd.pg.osasli":["ei6"],"application/vnd.picsel":["efif"],"application/vnd.pmi.widget":["wg"],"application/vnd.pocketlearn":["plf"],"application/vnd.powerbuilder6":["pbd"],"application/vnd.previewsystems.box":["box"],"application/vnd.proteus.magazine":["mgz"],"application/vnd.publishare-delta-tree":["qps"],"application/vnd.pvi.ptid1":["ptid"],"application/vnd.quark.quarkxpress":["qxd","qxt","qwd","qwt","qxl","qxb"],"application/vnd.rar":["rar"],"application/vnd.realvnc.bed":["bed"],"application/vnd.recordare.musicxml":["mxl"],"application/vnd.recordare.musicxml+xml":["musicxml"],"application/vnd.rig.cryptonote":["cryptonote"],"application/vnd.rim.cod":["cod"],"application/vnd.rn-realmedia":["rm"],"application/vnd.rn-realmedia-vbr":["rmvb"],"application/vnd.route66.link66+xml":["link66"],"application/vnd.sailingtracker.track":["st"],"application/vnd.seemail":["see"],"application/vnd.sema":["sema"],"application/vnd.semd":["semd"],"application/vnd.semf":["semf"],"application/vnd.shana.informed.formdata":["ifm"],"application/vnd.shana.informed.formtemplate":["itp"],"application/vnd.shana.informed.interchange":["iif"],"application/vnd.shana.informed.package":["ipk"],"application/vnd.simtech-mindmapper":["twd","twds"],"application/vnd.smaf":["mmf"],"application/vnd.smart.teacher":["teacher"],"application/vnd.software602.filler.form+xml":["fo"],"application/vnd.solent.sdkm+xml":["sdkm","sdkd"],"application/vnd.spotfire.dxp":["dxp"],"application/vnd.spotfire.sfs":["sfs"],"application/vnd.stardivision.calc":["sdc"],"application/vnd.stardivision.draw":["sda"],"application/vnd.stardivision.impress":["sdd"],"application/vnd.stardivision.math":["smf"],"application/vnd.stardivision.writer":["sdw","vor"],"application/vnd.stardivision.writer-global":["sgl"],"application/vnd.stepmania.package":["smzip"],"application/vnd.stepmania.stepchart":["sm"],"application/vnd.sun.wadl+xml":["wadl"],"application/vnd.sun.xml.calc":["sxc"],"application/vnd.sun.xml.calc.template":["stc"],"application/vnd.sun.xml.draw":["sxd"],"application/vnd.sun.xml.draw.template":["std"],"application/vnd.sun.xml.impress":["sxi"],"application/vnd.sun.xml.impress.template":["sti"],"application/vnd.sun.xml.math":["sxm"],"application/vnd.sun.xml.writer":["sxw"],"application/vnd.sun.xml.writer.global":["sxg"],"application/vnd.sun.xml.writer.template":["stw"],"application/vnd.sus-calendar":["sus","susp"],"application/vnd.svd":["svd"],"application/vnd.symbian.install":["sis","sisx"],"application/vnd.syncml+xml":["xsm"],"application/vnd.syncml.dm+wbxml":["bdm"],"application/vnd.syncml.dm+xml":["xdm"],"application/vnd.syncml.dmddf+xml":["ddf"],"application/vnd.tao.intent-module-archive":["tao"],"application/vnd.tcpdump.pcap":["pcap","cap","dmp"],"application/vnd.tmobile-livetv":["tmo"],"application/vnd.trid.tpt":["tpt"],"application/vnd.triscape.mxs":["mxs"],"application/vnd.trueapp":["tra"],"application/vnd.ufdl":["ufd","ufdl"],"application/vnd.uiq.theme":["utz"],"application/vnd.umajin":["umj"],"application/vnd.unity":["unityweb"],"application/vnd.uoml+xml":["uoml"],"application/vnd.vcx":["vcx"],"application/vnd.visio":["vsd","vst","vss","vsw"],"application/vnd.visionary":["vis"],"application/vnd.vsf":["vsf"],"application/vnd.wap.wbxml":["wbxml"],"application/vnd.wap.wmlc":["wmlc"],"application/vnd.wap.wmlscriptc":["wmlsc"],"application/vnd.webturbo":["wtb"],"application/vnd.wolfram.player":["nbp"],"application/vnd.wordperfect":["wpd"],"application/vnd.wqd":["wqd"],"application/vnd.wt.stf":["stf"],"application/vnd.xara":["xar"],"application/vnd.xfdl":["xfdl"],"application/vnd.yamaha.hv-dic":["hvd"],"application/vnd.yamaha.hv-script":["hvs"],"application/vnd.yamaha.hv-voice":["hvp"],"application/vnd.yamaha.openscoreformat":["osf"],"application/vnd.yamaha.openscoreformat.osfpvg+xml":["osfpvg"],"application/vnd.yamaha.smaf-audio":["saf"],"application/vnd.yamaha.smaf-phrase":["spf"],"application/vnd.yellowriver-custom-menu":["cmp"],"application/vnd.zul":["zir","zirz"],"application/vnd.zzazz.deck+xml":["zaz"],"application/x-7z-compressed":["7z"],"application/x-abiword":["abw"],"application/x-ace-compressed":["ace"],"application/x-apple-diskimage":["*dmg"],"application/x-arj":["arj"],"application/x-authorware-bin":["aab","x32","u32","vox"],"application/x-authorware-map":["aam"],"application/x-authorware-seg":["aas"],"application/x-bcpio":["bcpio"],"application/x-bdoc":["*bdoc"],"application/x-bittorrent":["torrent"],"application/x-blorb":["blb","blorb"],"application/x-bzip":["bz"],"application/x-bzip2":["bz2","boz"],"application/x-cbr":["cbr","cba","cbt","cbz","cb7"],"application/x-cdlink":["vcd"],"application/x-cfs-compressed":["cfs"],"application/x-chat":["chat"],"application/x-chess-pgn":["pgn"],"application/x-chrome-extension":["crx"],"application/x-cocoa":["cco"],"application/x-conference":["nsc"],"application/x-cpio":["cpio"],"application/x-csh":["csh"],"application/x-debian-package":["*deb","udeb"],"application/x-dgc-compressed":["dgc"],"application/x-director":["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"],"application/x-doom":["wad"],"application/x-dtbncx+xml":["ncx"],"application/x-dtbook+xml":["dtb"],"application/x-dtbresource+xml":["res"],"application/x-dvi":["dvi"],"application/x-envoy":["evy"],"application/x-eva":["eva"],"application/x-font-bdf":["bdf"],"application/x-font-ghostscript":["gsf"],"application/x-font-linux-psf":["psf"],"application/x-font-pcf":["pcf"],"application/x-font-snf":["snf"],"application/x-font-type1":["pfa","pfb","pfm","afm"],"application/x-freearc":["arc"],"application/x-futuresplash":["spl"],"application/x-gca-compressed":["gca"],"application/x-glulx":["ulx"],"application/x-gnumeric":["gnumeric"],"application/x-gramps-xml":["gramps"],"application/x-gtar":["gtar"],"application/x-hdf":["hdf"],"application/x-httpd-php":["php"],"application/x-install-instructions":["install"],"application/x-iso9660-image":["*iso"],"application/x-iwork-keynote-sffkey":["*key"],"application/x-iwork-numbers-sffnumbers":["*numbers"],"application/x-iwork-pages-sffpages":["*pages"],"application/x-java-archive-diff":["jardiff"],"application/x-java-jnlp-file":["jnlp"],"application/x-keepass2":["kdbx"],"application/x-latex":["latex"],"application/x-lua-bytecode":["luac"],"application/x-lzh-compressed":["lzh","lha"],"application/x-makeself":["run"],"application/x-mie":["mie"],"application/x-mobipocket-ebook":["prc","mobi"],"application/x-ms-application":["application"],"application/x-ms-shortcut":["lnk"],"application/x-ms-wmd":["wmd"],"application/x-ms-wmz":["wmz"],"application/x-ms-xbap":["xbap"],"application/x-msaccess":["mdb"],"application/x-msbinder":["obd"],"application/x-mscardfile":["crd"],"application/x-msclip":["clp"],"application/x-msdos-program":["*exe"],"application/x-msdownload":["*exe","*dll","com","bat","*msi"],"application/x-msmediaview":["mvb","m13","m14"],"application/x-msmetafile":["*wmf","*wmz","*emf","emz"],"application/x-msmoney":["mny"],"application/x-mspublisher":["pub"],"application/x-msschedule":["scd"],"application/x-msterminal":["trm"],"application/x-mswrite":["wri"],"application/x-netcdf":["nc","cdf"],"application/x-ns-proxy-autoconfig":["pac"],"application/x-nzb":["nzb"],"application/x-perl":["pl","pm"],"application/x-pilot":["*prc","*pdb"],"application/x-pkcs12":["p12","pfx"],"application/x-pkcs7-certificates":["p7b","spc"],"application/x-pkcs7-certreqresp":["p7r"],"application/x-rar-compressed":["*rar"],"application/x-redhat-package-manager":["rpm"],"application/x-research-info-systems":["ris"],"application/x-sea":["sea"],"application/x-sh":["sh"],"application/x-shar":["shar"],"application/x-shockwave-flash":["swf"],"application/x-silverlight-app":["xap"],"application/x-sql":["sql"],"application/x-stuffit":["sit"],"application/x-stuffitx":["sitx"],"application/x-subrip":["srt"],"application/x-sv4cpio":["sv4cpio"],"application/x-sv4crc":["sv4crc"],"application/x-t3vm-image":["t3"],"application/x-tads":["gam"],"application/x-tar":["tar"],"application/x-tcl":["tcl","tk"],"application/x-tex":["tex"],"application/x-tex-tfm":["tfm"],"application/x-texinfo":["texinfo","texi"],"application/x-tgif":["*obj"],"application/x-ustar":["ustar"],"application/x-virtualbox-hdd":["hdd"],"application/x-virtualbox-ova":["ova"],"application/x-virtualbox-ovf":["ovf"],"application/x-virtualbox-vbox":["vbox"],"application/x-virtualbox-vbox-extpack":["vbox-extpack"],"application/x-virtualbox-vdi":["vdi"],"application/x-virtualbox-vhd":["vhd"],"application/x-virtualbox-vmdk":["vmdk"],"application/x-wais-source":["src"],"application/x-web-app-manifest+json":["webapp"],"application/x-x509-ca-cert":["der","crt","pem"],"application/x-xfig":["fig"],"application/x-xliff+xml":["*xlf"],"application/x-xpinstall":["xpi"],"application/x-xz":["xz"],"application/x-zmachine":["z1","z2","z3","z4","z5","z6","z7","z8"],"audio/vnd.dece.audio":["uva","uvva"],"audio/vnd.digital-winds":["eol"],"audio/vnd.dra":["dra"],"audio/vnd.dts":["dts"],"audio/vnd.dts.hd":["dtshd"],"audio/vnd.lucent.voice":["lvp"],"audio/vnd.ms-playready.media.pya":["pya"],"audio/vnd.nuera.ecelp4800":["ecelp4800"],"audio/vnd.nuera.ecelp7470":["ecelp7470"],"audio/vnd.nuera.ecelp9600":["ecelp9600"],"audio/vnd.rip":["rip"],"audio/x-aac":["aac"],"audio/x-aiff":["aif","aiff","aifc"],"audio/x-caf":["caf"],"audio/x-flac":["flac"],"audio/x-m4a":["*m4a"],"audio/x-matroska":["mka"],"audio/x-mpegurl":["m3u"],"audio/x-ms-wax":["wax"],"audio/x-ms-wma":["wma"],"audio/x-pn-realaudio":["ram","ra"],"audio/x-pn-realaudio-plugin":["rmp"],"audio/x-realaudio":["*ra"],"audio/x-wav":["*wav"],"chemical/x-cdx":["cdx"],"chemical/x-cif":["cif"],"chemical/x-cmdf":["cmdf"],"chemical/x-cml":["cml"],"chemical/x-csml":["csml"],"chemical/x-xyz":["xyz"],"image/prs.btif":["btif"],"image/prs.pti":["pti"],"image/vnd.adobe.photoshop":["psd"],"image/vnd.airzip.accelerator.azv":["azv"],"image/vnd.dece.graphic":["uvi","uvvi","uvg","uvvg"],"image/vnd.djvu":["djvu","djv"],"image/vnd.dvb.subtitle":["*sub"],"image/vnd.dwg":["dwg"],"image/vnd.dxf":["dxf"],"image/vnd.fastbidsheet":["fbs"],"image/vnd.fpx":["fpx"],"image/vnd.fst":["fst"],"image/vnd.fujixerox.edmics-mmr":["mmr"],"image/vnd.fujixerox.edmics-rlc":["rlc"],"image/vnd.microsoft.icon":["ico"],"image/vnd.ms-dds":["dds"],"image/vnd.ms-modi":["mdi"],"image/vnd.ms-photo":["wdp"],"image/vnd.net-fpx":["npx"],"image/vnd.pco.b16":["b16"],"image/vnd.tencent.tap":["tap"],"image/vnd.valve.source.texture":["vtf"],"image/vnd.wap.wbmp":["wbmp"],"image/vnd.xiff":["xif"],"image/vnd.zbrush.pcx":["pcx"],"image/x-3ds":["3ds"],"image/x-cmu-raster":["ras"],"image/x-cmx":["cmx"],"image/x-freehand":["fh","fhc","fh4","fh5","fh7"],"image/x-icon":["*ico"],"image/x-jng":["jng"],"image/x-mrsid-image":["sid"],"image/x-ms-bmp":["*bmp"],"image/x-pcx":["*pcx"],"image/x-pict":["pic","pct"],"image/x-portable-anymap":["pnm"],"image/x-portable-bitmap":["pbm"],"image/x-portable-graymap":["pgm"],"image/x-portable-pixmap":["ppm"],"image/x-rgb":["rgb"],"image/x-tga":["tga"],"image/x-xbitmap":["xbm"],"image/x-xpixmap":["xpm"],"image/x-xwindowdump":["xwd"],"message/vnd.wfa.wsc":["wsc"],"model/vnd.collada+xml":["dae"],"model/vnd.dwf":["dwf"],"model/vnd.gdl":["gdl"],"model/vnd.gtw":["gtw"],"model/vnd.mts":["mts"],"model/vnd.opengex":["ogex"],"model/vnd.parasolid.transmit.binary":["x_b"],"model/vnd.parasolid.transmit.text":["x_t"],"model/vnd.sap.vds":["vds"],"model/vnd.usdz+zip":["usdz"],"model/vnd.valve.source.compiled-map":["bsp"],"model/vnd.vtu":["vtu"],"text/prs.lines.tag":["dsc"],"text/vnd.curl":["curl"],"text/vnd.curl.dcurl":["dcurl"],"text/vnd.curl.mcurl":["mcurl"],"text/vnd.curl.scurl":["scurl"],"text/vnd.dvb.subtitle":["sub"],"text/vnd.fly":["fly"],"text/vnd.fmi.flexstor":["flx"],"text/vnd.graphviz":["gv"],"text/vnd.in3d.3dml":["3dml"],"text/vnd.in3d.spot":["spot"],"text/vnd.sun.j2me.app-descriptor":["jad"],"text/vnd.wap.wml":["wml"],"text/vnd.wap.wmlscript":["wmls"],"text/x-asm":["s","asm"],"text/x-c":["c","cc","cxx","cpp","h","hh","dic"],"text/x-component":["htc"],"text/x-fortran":["f","for","f77","f90"],"text/x-handlebars-template":["hbs"],"text/x-java-source":["java"],"text/x-lua":["lua"],"text/x-markdown":["mkd"],"text/x-nfo":["nfo"],"text/x-opml":["opml"],"text/x-org":["*org"],"text/x-pascal":["p","pas"],"text/x-processing":["pde"],"text/x-sass":["sass"],"text/x-scss":["scss"],"text/x-setext":["etx"],"text/x-sfv":["sfv"],"text/x-suse-ymp":["ymp"],"text/x-uuencode":["uu"],"text/x-vcalendar":["vcs"],"text/x-vcard":["vcf"],"video/vnd.dece.hd":["uvh","uvvh"],"video/vnd.dece.mobile":["uvm","uvvm"],"video/vnd.dece.pd":["uvp","uvvp"],"video/vnd.dece.sd":["uvs","uvvs"],"video/vnd.dece.video":["uvv","uvvv"],"video/vnd.dvb.file":["dvb"],"video/vnd.fvt":["fvt"],"video/vnd.mpegurl":["mxu","m4u"],"video/vnd.ms-playready.media.pyv":["pyv"],"video/vnd.uvvu.mp4":["uvu","uvvu"],"video/vnd.vivo":["viv"],"video/x-f4v":["f4v"],"video/x-fli":["fli"],"video/x-flv":["flv"],"video/x-m4v":["m4v"],"video/x-matroska":["mkv","mk3d","mks"],"video/x-mng":["mng"],"video/x-ms-asf":["asf","asx"],"video/x-ms-vob":["vob"],"video/x-ms-wm":["wm"],"video/x-ms-wmv":["wmv"],"video/x-ms-wmx":["wmx"],"video/x-ms-wvx":["wvx"],"video/x-msvideo":["avi"],"video/x-sgi-movie":["movie"],"video/x-smv":["smv"],"x-conference/x-cooltalk":["ice"]}});var Ja=E((sp,Wa)=>{"use strict";var Ld=Fa();Wa.exports=new Ld(Ba(),Va())});var Ha,Ga,ye,ze,os=et(()=>{Ha=Ee(J()),Ga=Ee(Ja());(function(i){i.JSON="application/json",i.PLAIN_TEXT="text/plain",i.OCTET_STREAM="octet/stream"})(ye||(ye={}));(function(i){let e=JSON.parse(Ha.PageConfig.getOption("fileTypes")||"{}");function t(s,r=null){s=s.toLowerCase();for(let a of Object.values(e))for(let o of a.extensions||[])if(o===s&&a.mimeTypes&&a.mimeTypes.length)return a.mimeTypes[0];return Ga.default.getType(s)||r||ye.OCTET_STREAM}i.getType=t;function n(s,r){s=s.toLowerCase();for(let a of Object.values(e))if(a.fileFormat===r){for(let o of a.extensions||[])if(o===s)return!0}return!1}i.hasFormat=n})(ze||(ze={}))});var Pe,Za,xe,Qa,cs,Ya,eo,Xa,Ut,ls,ds,$n,to=et(()=>{Pe=Ee(J()),Za=Ee(Te()),xe=Ee(J()),Qa=Ee(te()),cs=Ee(Z());os();Ya="JupyterLite Storage",eo="BrowserStorage",Xa=5,Ut=new TextEncoder,ls=new TextDecoder("utf-8"),ds=class{constructor(e){var t;this.reduceBytesToString=(n,s)=>n+String.fromCharCode(s),this._serverContents=new Map,this._isDisposed=!1,this._fileChanged=new cs.Signal(this),this._storageName=Ya,this._storageDrivers=null,this._localforage=e.localforage,this._storageName=e.storageName||Ya,this._storageDrivers=e.storageDrivers||null,this._serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Za.ServerConnection.makeSettings(),this._ready=new Qa.PromiseDelegate,this.initialize().catch(console.warn)}dispose(){this.isDisposed||(this._isDisposed=!0,cs.Signal.clearData(this))}get isDisposed(){return this._isDisposed}get name(){return eo}get serverSettings(){return this._serverSettings}get fileChanged(){return this._fileChanged}async getDownloadUrl(e){e=decodeURIComponent(e.replace(/^\//,""));let n=await(await this.storage).getItem(e);if(n&&n.content!==null){let a;if(n.format==="base64"){let o=atob(n.content),u=new Uint8Array(o.length);for(let c=0;c<o.length;c++)u[c]=o.charCodeAt(c);a=new Blob([u],{type:n.mimetype})}else if(n.format==="json"){let o=JSON.stringify(n.content);a=new Blob([o],{type:n.mimetype})}else a=new Blob([n.content],{type:n.mimetype});return URL.createObjectURL(a)}let s=this.serverSettings.baseUrl;return Pe.URLExt.join(s,"files",Pe.URLExt.encodeParts(e))}async initialize(){await this.initStorage(),this._ready.resolve(void 0)}async initStorage(){this._storage=this.createDefaultStorage(),this._counters=this.createDefaultCounters(),this._checkpoints=this.createDefaultCheckpoints()}get ready(){return this._ready.promise}get storage(){return this.ready.then(()=>this._storage)}get counters(){return this.ready.then(()=>this._counters)}get checkpoints(){return this.ready.then(()=>this._checkpoints)}get defaultStorageOptions(){let e=this._storageDrivers&&this._storageDrivers.length?this._storageDrivers:null;return{version:1,name:this._storageName,...e?{driver:e}:{}}}createDefaultStorage(){return this._localforage.createInstance({description:"Offline Storage for Notebooks and Files",storeName:"files",...this.defaultStorageOptions})}createDefaultCounters(){return this._localforage.createInstance({description:"Store the current file suffix counters",storeName:"counters",...this.defaultStorageOptions})}createDefaultCheckpoints(){return this._localforage.createInstance({description:"Offline Storage for Checkpoints",storeName:"checkpoints",...this.defaultStorageOptions})}async clearStorage(){await Promise.all([(await this.storage).clear(),(await this.counters).clear(),(await this.checkpoints).clear()])}async newUntitled(e){var t,n,s;let r=(t=e==null?void 0:e.path)!==null&&t!==void 0?t:"",a=(n=e==null?void 0:e.type)!==null&&n!==void 0?n:"notebook",o=new Date().toISOString(),u=xe.PathExt.dirname(r),c=xe.PathExt.basename(r),d=xe.PathExt.extname(r),l=await this.get(u).catch(()=>null),p="";r&&!d&&l?(u=`${r}/`,p=""):u&&c?(u=`${u}/`,p=c):(u="",p=r);let v;switch(a){case"directory":{p=`Untitled Folder${await this._incrementCounter("directory")||""}`,v={name:p,path:`${u}${p}`,last_modified:o,created:o,format:"json",mimetype:"",content:null,size:0,writable:!0,type:"directory"};break}case"notebook":{let I=await this._incrementCounter("notebook");p=p||`Untitled${I||""}.ipynb`,v={name:p,path:`${u}${p}`,last_modified:o,created:o,format:"json",mimetype:ye.JSON,content:$n.EMPTY_NB,size:Ut.encode(JSON.stringify($n.EMPTY_NB)).length,writable:!0,type:"notebook"};break}default:{let I=(s=e==null?void 0:e.ext)!==null&&s!==void 0?s:".txt";I.startsWith(".")||(I=`.${I}`);let P=await this._incrementCounter("file"),D=ze.getType(I)||ye.OCTET_STREAM,q;ze.hasFormat(I,"text")||D.indexOf("text")!==-1?q="text":I.indexOf("json")!==-1||I.indexOf("ipynb")!==-1?q="json":q="base64",p=p||`untitled${P||""}${I}`,v={name:p,path:`${u}${p}`,last_modified:o,created:o,format:q,mimetype:D,content:"",size:0,writable:!0,type:"file"};break}}let _=v.path;return await(await this.storage).setItem(_,v),this._fileChanged.emit({type:"new",oldValue:null,newValue:v}),v}async copy(e,t){let n=xe.PathExt.basename(e);for(t=t===""?"":`${xe.PathExt.removeSlash(t)}/`;await this.get(`${t}${n}`,{content:!0}).then(()=>!0).catch(()=>!1);){let a=xe.PathExt.extname(n);n=`${n.replace(a,"")} (copy)${a}`}let s=`${t}${n}`,r=await this.get(e,{content:!0}).catch(()=>null);if(!r)throw Error(`Could not find file with path ${e}`);return r={...r,name:n,path:s},await(await this.storage).setItem(s,r),this._fileChanged.emit({type:"new",oldValue:null,newValue:r}),r}async get(e,t){if(e=decodeURIComponent(e.replace(/^\//,"")),e===""){let o=await this._getFolder(e);if(o===null)throw Error(`Could not find file with path ${e}`);return o}let n=await this.storage,s=await n.getItem(e),r=await this._getServerContents(e,t),a=s||r;if(!a)throw Error(`Could not find content with path ${e}`);if(!(t!=null&&t.content))return{size:0,...a,content:null};if(a.type==="directory"){let o=new Map;await n.iterate((d,l)=>{l===`${e}/${d.name}`&&o.set(d.name,d)});let u=r?r.content:Array.from((await this._getServerDirectory(e)).values());for(let d of u)o.has(d.name)||o.set(d.name,d);let c=[...o.values()];return{name:xe.PathExt.basename(e),path:e,last_modified:a.last_modified,created:a.created,format:"json",mimetype:ye.JSON,content:c,size:0,writable:!0,type:"directory"}}return a}async rename(e,t){let n=decodeURIComponent(e),s=await this.get(n,{content:!0}).catch(()=>null);if(!s)throw Error(`Could not find file with path ${n}`);let r=new Date().toISOString(),a=xe.PathExt.basename(t),o={...s,name:a,path:t,last_modified:r},u=await this.storage;if(await u.setItem(t,o),await u.removeItem(n),await(await this.checkpoints).removeItem(n),s.type==="directory"){let c;for(c of s.content)await this.rename(Pe.URLExt.join(e,c.name),Pe.URLExt.join(t,c.name))}return this._fileChanged.emit({type:"rename",oldValue:{path:e},newValue:o}),o}async save(e,t={}){var n;e=decodeURIComponent(e);let s=xe.PathExt.extname((n=t.name)!==null&&n!==void 0?n:""),r=t.chunk,a=r?r>1||r===-1:!1,o=await this.get(e,{content:a}).catch(()=>null);if(o||(o=await this.newUntitled({path:e,ext:s,type:"file"})),!o)throw Error(`Could not find file with path ${e}`);let u=o.content,c=new Date().toISOString();if(o={...o,...t,last_modified:c},t.content&&t.format==="base64"){let d=r?r===-1:!0,l=this._handleUploadChunk(t.content,u,a);if(s===".ipynb"){let p=d?JSON.parse(ls.decode(this._binaryStringToBytes(l))):l;o={...o,content:p,format:"json",type:"notebook",size:l.length}}else if(ze.hasFormat(s,"json")){let p=d?JSON.parse(ls.decode(this._binaryStringToBytes(l))):l;o={...o,content:p,format:"json",type:"file",size:l.length}}else if(ze.hasFormat(s,"text")){let p=d?ls.decode(this._binaryStringToBytes(l)):l;o={...o,content:p,format:"text",type:"file",size:l.length}}else{let p=d?btoa(l):l;o={...o,content:p,format:"base64",type:"file",size:l.length}}}if(o.content)switch(t.format){case"json":{o={...o,size:Ut.encode(JSON.stringify(o.content)).length};break}case"text":{o={...o,size:Ut.encode(o.content).length};break}case"base64":break;default:{o={...o,size:0};break}}else o={...o,size:0};return await(await this.storage).setItem(e,o),this._fileChanged.emit({type:"save",oldValue:null,newValue:o}),o}async delete(e){e=decodeURIComponent(e);let t=`${e}/`,n=(await(await this.storage).keys()).filter(s=>s===e||s.startsWith(t));await Promise.all(n.map(this.forgetPath,this)),this._fileChanged.emit({type:"delete",oldValue:{path:e},newValue:null})}async forgetPath(e){await Promise.all([(await this.storage).removeItem(e),(await this.checkpoints).removeItem(e)])}async createCheckpoint(e){var t;let n=await this.checkpoints;e=decodeURIComponent(e);let s=await this.get(e,{content:!0}).catch(()=>null);if(!s)throw Error(`Could not find file with path ${e}`);let r=((t=await n.getItem(e))!==null&&t!==void 0?t:[]).filter(Boolean);return r.push(s),r.length>Xa&&r.splice(0,r.length-Xa),await n.setItem(e,r),{id:`${r.length-1}`,last_modified:s.last_modified}}async listCheckpoints(e){return(await(await this.checkpoints).getItem(e)||[]).filter(Boolean).map(this.normalizeCheckpoint,this)}normalizeCheckpoint(e,t){return{id:t.toString(),last_modified:e.last_modified}}async restoreCheckpoint(e,t){e=decodeURIComponent(e);let n=await(await this.checkpoints).getItem(e)||[],s=parseInt(t),r=n[s];await(await this.storage).setItem(e,r)}async deleteCheckpoint(e,t){e=decodeURIComponent(e);let n=await(await this.checkpoints).getItem(e)||[],s=parseInt(t);n.splice(s,1),await(await this.checkpoints).setItem(e,n)}_handleUploadChunk(e,t,n){let s=atob(e);return n?t+s:s}_binaryStringToBytes(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}async _getFolder(e){let t=new Map;await(await this.storage).iterate((s,r)=>{r.includes("/")||t.set(s.path,s)});for(let s of(await this._getServerDirectory(e)).values())t.has(s.path)||t.set(s.path,s);return e&&t.size===0?null:{name:"",path:e,last_modified:new Date(0).toISOString(),created:new Date(0).toISOString(),format:"json",mimetype:ye.JSON,content:Array.from(t.values()),size:0,writable:!0,type:"directory"}}async _getServerContents(e,t){let n=xe.PathExt.basename(e),r=(await this._getServerDirectory(Pe.URLExt.join(e,".."))).get(n);if(!r)return null;if(r=r||{name:n,path:e,last_modified:new Date(0).toISOString(),created:new Date(0).toISOString(),format:"text",mimetype:ye.PLAIN_TEXT,type:"file",writable:!0,size:0,content:""},t!=null&&t.content)if(r.type==="directory"){let a=await this._getServerDirectory(e);r={...r,content:Array.from(a.values())}}else{let a=Pe.URLExt.join(Pe.PageConfig.getBaseUrl(),"files",e),o=await fetch(a);if(!o.ok)return null;let u=r.mimetype||o.headers.get("Content-Type"),c=xe.PathExt.extname(n);if(r.type==="notebook"||ze.hasFormat(c,"json")||(u==null?void 0:u.indexOf("json"))!==-1||e.match(/\.(ipynb|[^/]*json[^/]*)$/)){let d=await o.text();r={...r,content:JSON.parse(d),format:"json",mimetype:r.mimetype||ye.JSON,size:Ut.encode(d).length}}else if(ze.hasFormat(c,"text")||u.indexOf("text")!==-1){let d=await o.text();r={...r,content:d,format:"text",mimetype:u||ye.PLAIN_TEXT,size:Ut.encode(d).length}}else{let d=await o.arrayBuffer(),l=new Uint8Array(d);r={...r,content:btoa(l.reduce(this.reduceBytesToString,"")),format:"base64",mimetype:u||ye.OCTET_STREAM,size:l.length}}}return r}async _getServerDirectory(e){let t=this._serverContents.get(e)||new Map;if(!this._serverContents.has(e)){let n=Pe.URLExt.join(Pe.PageConfig.getBaseUrl(),"api/contents",e,"all.json");try{let s=await fetch(n),r=JSON.parse(await s.text());for(let a of r.content)t.set(a.name,a)}catch(s){console.warn(`don't worry, about ${s}... nothing's broken. If there had been a
|
|
10
|
+
file at ${n}, you might see some more files.`)}this._serverContents.set(e,t)}return t}async _incrementCounter(e){var t;let n=await this.counters,r=((t=await n.getItem(e))!==null&&t!==void 0?t:-1)+1;return await n.setItem(e,r),r}};(function(i){i.EMPTY_NB={metadata:{orig_nbformat:4},nbformat_minor:5,nbformat:4,cells:[]}})($n||($n={}))});function us(i){return"node"in i}var At,no,io,so,ps=et(()=>{At=16895,no=33206,io=1,so=2});var ro,Yn,zd,Fd,Vn,Wn,Jn,Hn,Gn,Nt,hs=et(()=>{ps();ro=":",Yn=4096,zd=new TextEncoder,Fd=new TextDecoder("utf-8"),Vn={0:!1,1:!0,2:!0,64:!0,65:!0,66:!0,129:!0,193:!0,514:!0,577:!0,578:!0,705:!0,706:!0,1024:!0,1025:!0,1026:!0,1089:!0,1090:!0,1153:!0,1154:!0,1217:!0,1218:!0,4096:!0,4098:!0},Wn=class{constructor(e){this.fs=e}open(e){var t;let n=this.fs.realPath(e.node);if(this.fs.FS.isFile(e.node.mode))try{let s=this.fs.API.get(n);e.file=s}catch{let r=(t=e.flags)!==null&&t!==void 0?t:e.shared.flags,a=typeof r=="string"?parseInt(r,10):r;a&=8191;let o=!0;if(a in Vn&&(o=Vn[a]),o){e.node=this.fs.node_ops.mknod(e.node.parent,e.node.name,e.node.mode,0);let u=this.fs.API.get(n);e.file=u}else throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.ENOENT)}}close(e){var t;if(!this.fs.FS.isFile(e.node.mode)||!e.file)return;let n=this.fs.realPath(e.node),s=(t=e.flags)!==null&&t!==void 0?t:e.shared.flags,r=typeof s=="string"?parseInt(s,10):s;r&=8191;let a=!0;r in Vn&&(a=Vn[r]),a&&this.fs.API.put(n,e.file),e.file=void 0}read(e,t,n,s,r){if(s<=0||e.file===void 0||r>=(e.file.data.length||0))return 0;let a=Math.min(e.file.data.length-r,s);return t.set(e.file.data.subarray(r,r+a),n),a}write(e,t,n,s,r){var a;if(s<=0||e.file===void 0)return 0;if(e.node.timestamp=Date.now(),r+s>(((a=e.file)===null||a===void 0?void 0:a.data.length)||0)){let o=e.file.data?e.file.data:new Uint8Array;e.file.data=new Uint8Array(r+s),e.file.data.set(o)}return e.file.data.set(t.subarray(n,n+s),r),s}llseek(e,t,n){var s;let r=t;if(n===1)r+=(s=e.position)!==null&&s!==void 0?s:e.shared.position;else if(n===2&&this.fs.FS.isFile(e.node.mode))if(e.file!==void 0)r+=e.file.data.length;else throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EPERM);if(r<0)throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EINVAL);return r}},Jn=class{constructor(e){this.node=t=>us(t)?t.node:t,this.getattr=t=>{let n=this.node(t);return{...this.fs.API.getattr(this.fs.realPath(n)),mode:n.mode,ino:n.id}},this.setattr=(t,n)=>{let s=this.node(t);for(let[r,a]of Object.entries(n))switch(r){case"mode":s.mode=a;break;case"timestamp":s.timestamp=a;break;case"size":{let o=a,u=this.fs.realPath(s);if(this.fs.FS.isFile(s.mode)&&o>=0){let c;try{c=this.fs.API.get(u)}catch{break}let d=c.data?c.data:new Uint8Array;o!==d.length&&(o<d.length?c.data=c.data.slice(0,o):(c.data=new Uint8Array(o),c.data.set(d)),this.fs.API.put(u,c))}else console.warn("setattr size of",o,"on",s,"not yet implemented");break}case"ctime":case"dontFollow":break;default:console.warn("setattr",r,"of",a,"on",s,"not yet implemented");break}},this.lookup=(t,n)=>{let s=this.node(t),r=this.fs.PATH.join2(this.fs.realPath(s),n),a=this.fs.API.lookup(r);if(!a.ok)throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.ENOENT);return this.fs.createNode(s,n,a.mode,0)},this.mknod=(t,n,s,r)=>{let a=this.node(t),o=this.fs.PATH.join2(this.fs.realPath(a),n);return this.fs.API.mknod(o,s),this.fs.createNode(a,n,s,r)},this.rename=(t,n,s)=>{let r=this.node(t),a=this.node(n);this.fs.API.rename(r.parent?this.fs.PATH.join2(this.fs.realPath(r.parent),r.name):r.name,this.fs.PATH.join2(this.fs.realPath(a),s)),r.name=s,r.parent=a},this.unlink=(t,n)=>this.fs.API.rmdir(this.fs.PATH.join2(this.fs.realPath(this.node(t)),n)),this.rmdir=(t,n)=>this.fs.API.rmdir(this.fs.PATH.join2(this.fs.realPath(this.node(t)),n)),this.readdir=t=>this.fs.API.readdir(this.fs.realPath(this.node(t))),this.symlink=(t,n,s)=>{throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EPERM)},this.readlink=t=>{throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EPERM)},this.fs=e}},Hn=class{constructor(e){this._driveName=e.driveName,this._mountpoint=e.mountpoint,this.FS=e.FS,this.ERRNO_CODES=e.ERRNO_CODES}lookup(e){return this.request({method:"lookup",path:this.normalizePath(e)})}getmode(e){return this.request({method:"getmode",path:this.normalizePath(e)})}mknod(e,t){return this.request({method:"mknod",path:this.normalizePath(e),data:{mode:t}})}rename(e,t){return this.request({method:"rename",path:this.normalizePath(e),data:{newPath:this.normalizePath(t)}})}readdir(e){let t=this.request({method:"readdir",path:this.normalizePath(e)});return t.push("."),t.push(".."),t}rmdir(e){return this.request({method:"rmdir",path:this.normalizePath(e)})}get(e){let t=this.request({method:"get",path:this.normalizePath(e)});if(!t)throw new this.FS.ErrnoError(this.ERRNO_CODES.ENOENT);let n=t.content,s=t.format;switch(s){case"json":case"text":return{data:zd.encode(n),format:s};case"base64":{let r=atob(n),a=r.length,o=new Uint8Array(a);for(let u=0;u<a;u++)o[u]=r.charCodeAt(u);return{data:o,format:s}}default:throw new this.FS.ErrnoError(this.ERRNO_CODES.ENOENT)}}put(e,t){switch(t.format){case"json":case"text":return this.request({method:"put",path:this.normalizePath(e),data:{format:t.format,data:Fd.decode(t.data)}});case"base64":{let n="";for(let s=0;s<t.data.byteLength;s++)n+=String.fromCharCode(t.data[s]);return this.request({method:"put",path:this.normalizePath(e),data:{format:t.format,data:btoa(n)}})}}}getattr(e){let t=this.request({method:"getattr",path:this.normalizePath(e)});return t.atime&&(t.atime=new Date(t.atime)),t.mtime&&(t.mtime=new Date(t.mtime)),t.ctime&&(t.ctime=new Date(t.ctime)),t.size=t.size||0,t}normalizePath(e){return e.startsWith(this._mountpoint)&&(e=e.slice(this._mountpoint.length)),this._driveName&&(e=`${this._driveName}${ro}${e}`),e}},Gn=class extends Hn{constructor(e){super(e),this._baseUrl=e.baseUrl,this._browsingContextId=e.browsingContextId||""}request(e){let t=new XMLHttpRequest;t.open("POST",encodeURI(this.endpoint),!1);let n={data:e,browsingContextId:this._browsingContextId};try{t.send(JSON.stringify(n))}catch(s){console.error(s)}if(t.status>=400)throw new this.FS.ErrnoError(this.ERRNO_CODES.EINVAL);return JSON.parse(t.responseText)}get endpoint(){return`${this._baseUrl}api/drive`}},Nt=class{constructor(e){this.FS=e.FS,this.PATH=e.PATH,this.ERRNO_CODES=e.ERRNO_CODES,this.API=this.createAPI(e),this.driveName=e.driveName,this.node_ops=new Jn(this),this.stream_ops=new Wn(this)}createAPI(e){if(!e.browsingContextId||!e.baseUrl)throw new Error("Cannot create service-worker API without current browsingContextId");return new Gn(e)}mount(e){return this.createNode(null,e.mountpoint,16895,0)}createNode(e,t,n,s){let r=this.FS;if(!r.isDir(n)&&!r.isFile(n))throw new r.ErrnoError(this.ERRNO_CODES.EINVAL);let a=r.createNode(e,t,n,s);return a.node_ops=this.node_ops,a.stream_ops=this.stream_ops,a}getMode(e){return this.API.getmode(e)}realPath(e){let t=[],n=e;for(t.push(n.name);n.parent!==n;)n=n.parent,t.push(n.name);return t.reverse(),this.PATH.join.apply(null,t)}}});var fs,ms,ao=et(()=>{fs=Ee(J());hs();ms=class{constructor(e){this.contentsManager=e.contentsManager}async processDriveRequest(e){switch(e.method){case"readdir":return this.readdir(e);case"rmdir":return this.rmdir(e);case"rename":return this.rename(e);case"getmode":return this.getmode(e);case"lookup":return this.lookup(e);case"mknod":return this.mknod(e);case"getattr":return this.getattr(e);case"get":return this.get(e);case"put":return this.put(e)}throw`Drive request ${e.method} does not exist.`}async readdir(e){let t=await this.contentsManager.get(e.path,{content:!0}),n=[];return t.type==="directory"&&t.content&&(n=t.content.map(s=>s.name)),n}async rmdir(e){return await this.contentsManager.delete(e.path),null}async rename(e){return await this.contentsManager.rename(e.path,e.data.newPath),null}async getmode(e){let t=await this.contentsManager.get(e.path),n;return t.type==="directory"?n=16895:n=33206,n}async lookup(e){let t;try{t={ok:!0,mode:(await this.contentsManager.get(e.path)).type==="directory"?16895:33206}}catch{t={ok:!1}}return t}async mknod(e){let t=await this.contentsManager.newUntitled({path:fs.PathExt.dirname(e.path),type:e.data.mode===16895?"directory":"file",ext:fs.PathExt.extname(e.path)});return await this.contentsManager.rename(t.path,e.path),null}async getattr(e){let t=await this.contentsManager.get(e.path),n=new Date(0).toISOString();return{dev:1,nlink:1,uid:0,gid:0,rdev:0,size:t.size||0,blksize:Yn,blocks:Math.ceil(t.size||0/Yn),atime:t.last_modified||n,mtime:t.last_modified||n,ctime:t.created||n,timestamp:0}}async get(e){let t;try{t=await this.contentsManager.get(e.path,{content:!0})}catch{return null}let n=null;return t.type!=="directory"&&(n={content:t.format==="json"?JSON.stringify(t.content):t.content,format:t.format}),n}async put(e){return await this.contentsManager.save(e.path,{content:e.data.format==="json"&&e.data.data?JSON.parse(e.data.data):e.data.data,type:"file",format:e.data.format}),null}}});var oo={};xo(oo,{BLOCK_SIZE:()=>Yn,BrowserStorageDrive:()=>ds,ContentsAPI:()=>Hn,DIR_MODE:()=>At,DRIVE_NAME:()=>eo,DRIVE_SEPARATOR:()=>ro,DriveContentsProcessor:()=>ms,DriveFS:()=>Nt,DriveFSEmscriptenNodeOps:()=>Jn,DriveFSEmscriptenStreamOps:()=>Wn,FILE:()=>ze,FILE_MODE:()=>no,MIME:()=>ye,SEEK_CUR:()=>io,SEEK_END:()=>so,ServiceWorkerContentsAPI:()=>Gn,instanceOfStream:()=>us});var gs=et(()=>{to();hs();os();ps();ao()});var ys=Symbol("Comlink.proxy"),ko=Symbol("Comlink.endpoint"),Po=Symbol("Comlink.releaseProxy"),Qn=Symbol("Comlink.finalizer"),zt=Symbol("Comlink.thrown"),ws=i=>typeof i=="object"&&i!==null||typeof i=="function",Mo={canHandle:i=>ws(i)&&i[ys],serialize(i){let{port1:e,port2:t}=new MessageChannel;return $t(i,e),[t,[t]]},deserialize(i){return i.start(),Oo(i)}},Eo={canHandle:i=>ws(i)&&zt in i,serialize({value:i}){let e;return i instanceof Error?e={isError:!0,value:{message:i.message,name:i.name,stack:i.stack}}:e={isError:!1,value:i},[e,[]]},deserialize(i){throw i.isError?Object.assign(new Error(i.value.message),i.value):i.value}},bs=new Map([["proxy",Mo],["throw",Eo]]);function Io(i,e){for(let t of i)if(e===t||t==="*"||t instanceof RegExp&&t.test(e))return!0;return!1}function $t(i,e=globalThis,t=["*"]){e.addEventListener("message",function n(s){if(!s||!s.data)return;if(!Io(t,s.origin)){console.warn(`Invalid origin '${s.origin}' for comlink proxy`);return}let{id:r,type:a,path:o}=Object.assign({path:[]},s.data),u=(s.data.argumentList||[]).map(Ge),c;try{let d=o.slice(0,-1).reduce((p,v)=>p[v],i),l=o.reduce((p,v)=>p[v],i);switch(a){case"GET":c=l;break;case"SET":d[o.slice(-1)[0]]=Ge(s.data.value),c=!0;break;case"APPLY":c=l.apply(d,u);break;case"CONSTRUCT":{let p=new l(...u);c=Uo(p)}break;case"ENDPOINT":{let{port1:p,port2:v}=new MessageChannel;$t(i,v),c=qo(p,[p])}break;case"RELEASE":c=void 0;break;default:return}}catch(d){c={value:d,[zt]:0}}Promise.resolve(c).catch(d=>({value:d,[zt]:0})).then(d=>{let[l,p]=Bt(d);e.postMessage(Object.assign(Object.assign({},l),{id:r}),p),a==="RELEASE"&&(e.removeEventListener("message",n),Ss(e),Qn in i&&typeof i[Qn]=="function"&&i[Qn]())}).catch(d=>{let[l,p]=Bt({value:new TypeError("Unserializable return value"),[zt]:0});e.postMessage(Object.assign(Object.assign({},l),{id:r}),p)})}),e.start&&e.start()}function Ro(i){return i.constructor.name==="MessagePort"}function Ss(i){Ro(i)&&i.close()}function Oo(i,e){let t=new Map;return i.addEventListener("message",function(s){let{data:r}=s;if(!r||!r.id)return;let a=t.get(r.id);if(a)try{a(r)}finally{t.delete(r.id)}}),ei(i,t,[],e)}function Lt(i){if(i)throw new Error("Proxy has been released and is not useable")}function xs(i){return tt(i,new Map,{type:"RELEASE"}).then(()=>{Ss(i)})}var Ft=new WeakMap,Kt="FinalizationRegistry"in globalThis&&new FinalizationRegistry(i=>{let e=(Ft.get(i)||0)-1;Ft.set(i,e),e===0&&xs(i)});function Do(i,e){let t=(Ft.get(e)||0)+1;Ft.set(e,t),Kt&&Kt.register(i,e,i)}function jo(i){Kt&&Kt.unregister(i)}function ei(i,e,t=[],n=function(){}){let s=!1,r=new Proxy(n,{get(a,o){if(Lt(s),o===Po)return()=>{jo(r),xs(i),e.clear(),s=!0};if(o==="then"){if(t.length===0)return{then:()=>r};let u=tt(i,e,{type:"GET",path:t.map(c=>c.toString())}).then(Ge);return u.then.bind(u)}return ei(i,e,[...t,o])},set(a,o,u){Lt(s);let[c,d]=Bt(u);return tt(i,e,{type:"SET",path:[...t,o].map(l=>l.toString()),value:c},d).then(Ge)},apply(a,o,u){Lt(s);let c=t[t.length-1];if(c===ko)return tt(i,e,{type:"ENDPOINT"}).then(Ge);if(c==="bind")return ei(i,e,t.slice(0,-1));let[d,l]=vs(u);return tt(i,e,{type:"APPLY",path:t.map(p=>p.toString()),argumentList:d},l).then(Ge)},construct(a,o){Lt(s);let[u,c]=vs(o);return tt(i,e,{type:"CONSTRUCT",path:t.map(d=>d.toString()),argumentList:u},c).then(Ge)}});return Do(r,i),r}function To(i){return Array.prototype.concat.apply([],i)}function vs(i){let e=i.map(Bt);return[e.map(t=>t[0]),To(e.map(t=>t[1]))]}var Cs=new WeakMap;function qo(i,e){return Cs.set(i,e),i}function Uo(i){return Object.assign(i,{[ys]:!0})}function Bt(i){for(let[e,t]of bs)if(t.canHandle(i)){let[n,s]=t.serialize(i);return[{type:"HANDLER",name:e,value:n},s]}return[{type:"RAW",value:i},Cs.get(i)||[]]}function Ge(i){switch(i.type){case"HANDLER":return bs.get(i.name).deserialize(i.value);case"RAW":return i.value}}function tt(i,e,t,n){return new Promise(s=>{let r=Ao();e.set(r,s),i.start&&i.start(),i.postMessage(Object.assign({id:r},t),n)})}function Ao(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}var lo=Ee(J()),co=Ee(Te());gs();var Xn=class{constructor(){this._options=null;this._initializer=null;this._pyodide=null;this._localPath="";this._driveName="";this._driveFS=null;this._sendWorkerMessage=()=>{};this._logMessage=()=>{};this._initialized=new Promise((e,t)=>{this._initializer={resolve:e,reject:t}})}async initialize(e){var t;if(this._options=e,e.location.includes(":")){let n=e.location.split(":");this._driveName=n[0],this._localPath=n[1]}else this._driveName="",this._localPath=e.location;await this.initRuntime(e),await this.initFilesystem(e),await this.initPackageManager(e),await this.initKernel(e),await this.initGlobals(e),(t=this._initializer)==null||t.resolve()}async initRuntime(e){let{pyodideUrl:t,indexUrl:n}=e,s;t.endsWith(".mjs")?s=(await import(t)).loadPyodide:(importScripts(t),s=self.loadPyodide),this._pyodide=await s({indexURL:n,stdout:r=>{console.log(r),this._logMessage({type:"text",level:"info",data:r})},stderr:r=>{console.error(r),this._logMessage({type:"text",level:"critical",data:r})},...e.loadPyodideOptions}),this._pyodide._api.on_fatal=async r=>{let a="";r.name==="Exit"?a="Pyodide has exited and can no longer be used.":a=`Pyodide has suffered a fatal error. Please report this to the Pyodide maintainers.
|
|
11
|
+
The cause of the error was: ${r.name}
|
|
12
|
+
${r.message}
|
|
13
13
|
Stack trace:
|
|
14
|
-
${
|
|
14
|
+
${r.stack}`,this._logMessage({type:"text",level:"critical",data:a})}}async initPackageManager(e){if(!this._options)throw new Error("Uninitialized");let{pipliteWheelUrl:t,disablePyPIFallback:n,pipliteUrls:s,loadPyodideOptions:r}=this._options,a=(r||{}).packages||[];a.includes("micropip")||await this._pyodide.loadPackage(["micropip"]),a.includes("piplite")||await this._pyodide.runPythonAsync(`
|
|
15
15
|
import micropip
|
|
16
16
|
await micropip.install('${t}', keep_going=True)
|
|
17
17
|
`),await this._pyodide.runPythonAsync(`
|
|
@@ -19,7 +19,7 @@ ${u.stack}`,this._logMessage({type:"text",level:"critical",data:c})};let r=u=>{c
|
|
|
19
19
|
piplite.piplite._PIPLITE_DISABLE_PYPI = ${n?"True":"False"}
|
|
20
20
|
piplite.piplite._PIPLITE_URLS = ${JSON.stringify(s)}
|
|
21
21
|
`)}async initKernel(e){let t=(e.loadPyodideOptions||{}).packages||[],n=["sqlite3","ipykernel","comm","pyodide_kernel","jedi","ipython"],s=[];for(let r of n)t.includes(r)||s.push(`await piplite.install('${r}', keep_going=True)`);s.push("import pyodide_kernel"),e.mountDrive&&this._localPath&&s.push("import os",`os.chdir("${this._localPath}")`),await this._pyodide.runPythonAsync(s.join(`
|
|
22
|
-
`))}async initGlobals(e){let{globals:t}=this._pyodide;this._kernel=t.get("pyodide_kernel").kernel_instance.copy(),this._stdout_stream=t.get("pyodide_kernel").stdout_stream.copy(),this._stderr_stream=t.get("pyodide_kernel").stderr_stream.copy(),this._interpreter=this._kernel.interpreter.copy(),this._interpreter.send_comm=this.sendComm.bind(this)}async initFilesystem(e){if(e.mountDrive){let t="/drive",{FS:n,PATH:s,ERRNO_CODES:r}=this._pyodide,{baseUrl:a}=e,{DriveFS:o}=await Promise.resolve().then(()=>(
|
|
22
|
+
`))}async initGlobals(e){let{globals:t}=this._pyodide;this._kernel=t.get("pyodide_kernel").kernel_instance.copy(),this._stdout_stream=t.get("pyodide_kernel").stdout_stream.copy(),this._stderr_stream=t.get("pyodide_kernel").stderr_stream.copy(),this._interpreter=this._kernel.interpreter.copy(),this._interpreter.send_comm=this.sendComm.bind(this)}async initFilesystem(e){if(e.mountDrive){let t="/drive",{FS:n,PATH:s,ERRNO_CODES:r}=this._pyodide,{baseUrl:a}=e,{DriveFS:o}=await Promise.resolve().then(()=>(gs(),oo)),u=new o({FS:n,PATH:s,ERRNO_CODES:r,baseUrl:a,driveName:this._driveName,mountpoint:t,browsingContextId:this._browsingContextId});n.mkdirTree(t),n.mount(u,{},t),n.chdir(t),this._driveFS=u}}mapToObject(e){let t=e instanceof Array?[]:{};return e.forEach((n,s)=>{t[s]=n instanceof Map||n instanceof Array?this.mapToObject(n):n}),t}formatResult(e){if(!(e instanceof this._pyodide.ffi.PyProxy))return e;let t=e.toJs();return this.mapToObject(t)}registerWorkerMessageCallback(e){this._sendWorkerMessage=e}registerLogMessageCallback(e){this._logMessage=e}async setup(e){await this._initialized,this._kernel._parent_header=this._pyodide.toPy(e)}async execute(e,t){await this.setup(t);let n=(l,p,v)=>{let _={execution_count:l,data:this.formatResult(p),metadata:this.formatResult(v)};this._sendWorkerMessage({parentHeader:this.formatResult(this._kernel._parent_header).header,bundle:_,type:"execute_result"})},s=(l,p,v)=>{let _={ename:l,evalue:p,traceback:v};this._sendWorkerMessage({parentHeader:this.formatResult(this._kernel._parent_header).header,bundle:_,type:"execute_error"})},r=l=>{let p={wait:this.formatResult(l)};this._sendWorkerMessage({parentHeader:this.formatResult(this._kernel._parent_header).header,bundle:p,type:"clear_output"})},a=(l,p,v)=>{let _={data:this.formatResult(l),metadata:this.formatResult(p),transient:this.formatResult(v)};this._sendWorkerMessage({parentHeader:this.formatResult(this._kernel._parent_header).header,bundle:_,type:"display_data"})},o=(l,p,v)=>{let _={data:this.formatResult(l),metadata:this.formatResult(p),transient:this.formatResult(v)};this._sendWorkerMessage({parentHeader:this.formatResult(this._kernel._parent_header).header,bundle:_,type:"update_display_data"})},u=(l,p)=>{let v={name:this.formatResult(l),text:this.formatResult(p)};this._sendWorkerMessage({parentHeader:this.formatResult(this._kernel._parent_header).header,bundle:v,type:"stream"})};this._stdout_stream.publish_stream_callback=u,this._stderr_stream.publish_stream_callback=u,this._interpreter.display_pub.clear_output_callback=r,this._interpreter.display_pub.display_data_callback=a,this._interpreter.display_pub.update_display_data_callback=o,this._interpreter.displayhook.publish_execution_result=n,this._interpreter.input=this.input.bind(this),this._interpreter.getpass=this.getpass.bind(this);let c=await this._kernel.run(e.code),d=this.formatResult(c);return d.status==="error"&&s(d.ename,d.evalue,d.traceback),d}async complete(e,t){await this.setup(t);let n=this._kernel.complete(e.code,e.cursor_pos);return this.formatResult(n)}async inspect(e,t){await this.setup(t);let n=this._kernel.inspect(e.code,e.cursor_pos,e.detail_level);return this.formatResult(n)}async isComplete(e,t){await this.setup(t);let n=this._kernel.is_complete(e.code);return this.formatResult(n)}async commInfo(e,t){await this.setup(t);let n=this._kernel.comm_info(e.target_name);return{comms:this.formatResult(n),status:"ok"}}async commOpen(e,t){await this.setup(t);let n=this._kernel.comm_manager.comm_open(this._pyodide.toPy(null),this._pyodide.toPy(null),this._pyodide.toPy(e));return this.formatResult(n)}async commMsg(e,t){await this.setup(t);let n=this._kernel.comm_manager.comm_msg(this._pyodide.toPy(null),this._pyodide.toPy(null),this._pyodide.toPy(e));return this.formatResult(n)}async commClose(e,t){await this.setup(t);let n=this._kernel.comm_manager.comm_close(this._pyodide.toPy(null),this._pyodide.toPy(null),this._pyodide.toPy(e));return this.formatResult(n)}async inputReply(e,t){}getpass(e){return e=typeof e=="undefined"?"":e,this.sendInputRequest(e,!0)}input(e){return e=typeof e=="undefined"?"":e,this.sendInputRequest(e,!1)}async sendComm(e,t,n,s,r){this._sendWorkerMessage({type:e,content:this.formatResult(t),metadata:this.formatResult(n),ident:this.formatResult(s),buffers:this.formatResult(r),parentHeader:this.formatResult(this._kernel._parent_header).header})}};var _s=class extends Xn{constructor(){super(),this._sendWorkerMessage=e=>{postMessage({_kernelMessage:e})},this._logMessage=e=>{postMessage({_logMessage:e})}}async initFilesystem(e){if(e.mountDrive){let t="/drive",{FS:n,PATH:s,ERRNO_CODES:r}=this._pyodide,{baseUrl:a,browsingContextId:o}=e,u=new Nt({FS:n,PATH:s,ERRNO_CODES:r,baseUrl:a,driveName:this._driveName,mountpoint:t,browsingContextId:o});n.mkdirTree(t),n.mount(u,{},t),n.chdir(t),this._driveFS=u}}sendInputRequest(e,t){var r,a;let n=this.formatResult(this._kernel._parent_header).header,s=co.KernelMessage.createMessage({channel:"stdin",msgType:"input_request",session:(r=n==null?void 0:n.session)!=null?r:"",parentHeader:n,content:{prompt:e,password:t}});try{if(!this._options)throw new Error("Kernel options not set");let{baseUrl:o,browsingContextId:u}=this._options;if(!u)throw new Error("Kernel browsingContextId not set");let c=new XMLHttpRequest,d=lo.URLExt.join(o,"/api/stdin/kernel");c.open("POST",d,!1);let l=JSON.stringify({browsingContextId:u,data:s});c.send(l);let p=JSON.parse(c.response);if("error"in p)throw new Error(p.error);return(a=p.content)==null?void 0:a.value}catch(o){console.warn(`Failed to request stdin via service worker: ${o}`);return}}},Kd=new _s;$t(Kd);export{_s as PyodideComlinkKernel};
|
|
23
23
|
/*! Bundled license information:
|
|
24
24
|
|
|
25
25
|
comlink/dist/esm/comlink.mjs:
|