@runmedev/react-components 3.15.6-next.2 → 3.15.6-next.3
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/dist/app/index.js
CHANGED
|
@@ -6656,7 +6656,7 @@ Open Dashboard to configure it`)},N=function(){var De;const He=(0,Y.getContext)(
|
|
|
6656
6656
|
!*** ./src/client/index.ts ***!
|
|
6657
6657
|
\*****************************/Object.defineProperty(t,"__esModule",{value:!0}),t.ClientMessages=t.setContext=t.activate=void 0;const e=po("./src/constants.ts");Object.defineProperty(t,"ClientMessages",{enumerable:!0,get:function(){return e.ClientMessages}});const n=po("./src/client/utils.ts");Object.defineProperty(t,"setContext",{enumerable:!0,get:function(){return n.setContext}}),po("./src/client/components/index.ts");const r=s=>((0,n.setContext)(s),{renderOutputItem(c,i){var o,u,l;const a=c.json();switch(a.type){case e.OutputType.vercel:if(a.output.error){d(a.output.error);break}const h=document.createElement(e.RENDERERS.VercelOutput);h.setAttribute("content",JSON.stringify(a.output)),i.appendChild(h);break;case e.OutputType.daggerCall:if(!((o=a.output)!=null&&o.cellId))return;const p=document.createElement(e.RENDERERS.DaggerCli);p.setAttribute("cellId",a.output.cellId);const v={...a.output,cli:{status:"active"}};p.setAttribute("state",JSON.stringify(v)),i.appendChild(p);break;case e.OutputType.deno:if((u=a.output)!=null&&u.error){d(a.output.error);break}const m=a.output||{},b=document.createElement(e.RENDERERS.DenoOutput);b.setAttribute("state",JSON.stringify(m)),i.appendChild(b);break;case e.OutputType.outputItems:const y=decodeURIComponent(escape(window.atob(a.output.content))),_=document.createElement(e.RENDERERS.ShellOutput);_.innerHTML=y,i.appendChild(_);const S=document.createElement(e.RENDERERS.ShellOutputItems);S.setAttribute("id",a.output.id),S.setAttribute("content",y),i.appendChild(S);break;case e.OutputType.annotations:const C=document.createElement(e.RENDERERS.EditAnnotations);C.setAttribute("annotations",JSON.stringify(a.output.annotations??[])),C.setAttribute("validationErrors",JSON.stringify(a.output.validationErrors??[])),C.setAttribute("settings",JSON.stringify(a.output.settings)),i.appendChild(C);break;case e.OutputType.terminal:const x=document.createElement(e.RENDERERS.TerminalView);x.setAttribute("id",a.output["runme.dev/id"]),x.setAttribute("fontFamily",a.output.fontFamily),typeof a.output.fontSize=="number"&&x.setAttribute("fontSize",a.output.fontSize.toString()),a.output.cursorStyle&&x.setAttribute("cursorStyle",a.output.cursorStyle),typeof a.output.cursorBlink=="boolean"&&x.setAttribute("cursorBlink",a.output.cursorBlink?"true":"false"),typeof a.output.cursorWidth=="number"&&x.setAttribute("cursorWidth",a.output.cursorWidth.toString()),typeof a.output.smoothScrollDuration=="number"&&x.setAttribute("smoothScrollDuration",a.output.smoothScrollDuration.toString()),typeof a.output.scrollback=="number"&&x.setAttribute("scrollback",a.output.scrollback.toString()),a.output.initialRows!==void 0&&x.setAttribute("initialRows",a.output.initialRows.toString()),a.output.content!==void 0&&x.setAttribute("initialContent",a.output.content),a.output.isAutoSaveEnabled&&x.setAttribute("isAutoSaveEnabled",a.output.isAutoSaveEnabled.toString()),a.output.isPlatformAuthEnabled&&x.setAttribute("isPlatformAuthEnabled",a.output.isPlatformAuthEnabled.toString()),a.output.isDaggerOutput&&x.setAttribute("isDaggerOutput",a.output.isDaggerOutput.toString()),i.appendChild(x);break;case e.OutputType.error:d(a.output);break;case e.OutputType.github:const j=document.createElement(e.RENDERERS.GitHubWorkflowViewer);(l=a.output)!=null&&l.content&&j.setAttribute("state",JSON.stringify(a.output)),i.appendChild(j);break;case e.OutputType.gcp:const k=document.createElement(e.RENDERERS.GCPView);a.output&&k.setAttribute("state",JSON.stringify(a.output)),i.appendChild(k);break;case e.OutputType.aws:const A=document.createElement(e.RENDERERS.AWSView);a.output&&A.setAttribute("state",JSON.stringify(a.output)),i.appendChild(A);break;default:i.innerHTML="No renderer found!"}function d(h){i.innerHTML=`⚠️ ${h}`}},disposeOutputItem(){}});t.activate=r})();const Nu=yd.ClientMessages;yd.__esModule;yd.activate;const xP=yd.setContext,P5=gp("ChVnb29nbGUvcnBjL2NvZGUucHJvdG8SCmdvb2dsZS5ycGMqtwIKBENvZGUSBgoCT0sQABINCglDQU5DRUxMRUQQARILCgdVTktOT1dOEAISFAoQSU5WQUxJRF9BUkdVTUVOVBADEhUKEURFQURMSU5FX0VYQ0VFREVEEAQSDQoJTk9UX0ZPVU5EEAUSEgoOQUxSRUFEWV9FWElTVFMQBhIVChFQRVJNSVNTSU9OX0RFTklFRBAHEhMKD1VOQVVUSEVOVElDQVRFRBAQEhYKElJFU09VUkNFX0VYSEFVU1RFRBAIEhcKE0ZBSUxFRF9QUkVDT05ESVRJT04QCRILCgdBQk9SVEVEEAoSEAoMT1VUX09GX1JBTkdFEAsSEQoNVU5JTVBMRU1FTlRFRBAMEgwKCElOVEVSTkFMEA0SDwoLVU5BVkFJTEFCTEUQDhINCglEQVRBX0xPU1MQD0JYCg5jb20uZ29vZ2xlLnJwY0IJQ29kZVByb3RvUAFaM2dvb2dsZS5nb2xhbmcub3JnL2dlbnByb3RvL2dvb2dsZWFwaXMvcnBjL2NvZGU7Y29kZaICA1JQQ2IGcHJvdG8z"),CP=D0(P5,0),EP=M0(CP),B5=gp("CiBydW5tZS9zdHJlYW0vdjEvd2Vic29ja2V0cy5wcm90bxIPcnVubWUuc3RyZWFtLnYxIkIKD1dlYnNvY2tldFN0YXR1cxIeCgRjb2RlGAEgASgOMhAuZ29vZ2xlLnJwYy5Db2RlEg8KB21lc3NhZ2UYAiABKAkiGQoEUGluZxIRCgl0aW1lc3RhbXAYASABKAMiGQoEUG9uZxIRCgl0aW1lc3RhbXAYASABKAMiugEKEFdlYnNvY2tldFJlcXVlc3QSOgoPZXhlY3V0ZV9yZXF1ZXN0GAEgASgLMh8ucnVubWUucnVubmVyLnYyLkV4ZWN1dGVSZXF1ZXN0SAASIwoEcGluZxhkIAEoCzIVLnJ1bm1lLnN0cmVhbS52MS5QaW5nEhYKDWF1dGhvcml6YXRpb24YyAEgASgJEhEKCGtub3duX2lkGNIBIAEoCRIPCgZydW5faWQY3AEgASgJQgkKB3BheWxvYWQi2AEKEVdlYnNvY2tldFJlc3BvbnNlEjwKEGV4ZWN1dGVfcmVzcG9uc2UYASABKAsyIC5ydW5tZS5ydW5uZXIudjIuRXhlY3V0ZVJlc3BvbnNlSAASIwoEcG9uZxhkIAEoCzIVLnJ1bm1lLnN0cmVhbS52MS5Qb25nEjEKBnN0YXR1cxjIASABKAsyIC5ydW5tZS5zdHJlYW0udjEuV2Vic29ja2V0U3RhdHVzEhEKCGtub3duX2lkGNIBIAEoCRIPCgZydW5faWQY3AEgASgJQgkKB3BheWxvYWRCSFpGZ2l0aHViLmNvbS9ydW5tZWRldi9ydW5tZS92My9hcGkvZ2VuL3Byb3RvL2dvL3J1bm1lL3N0cmVhbS92MTtzdHJlYW12MWIGcHJvdG8z",[P5,bp]),qg=bd(B5,3),jP=bd(B5,4);var Jg=function(t,e){return Jg=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},Jg(t,e)};function ma(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Jg(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}function kP(t,e,n,r){function s(c){return c instanceof n?c:new n(function(i){i(c)})}return new(n||(n=Promise))(function(c,i){function o(a){try{l(r.next(a))}catch(d){i(d)}}function u(a){try{l(r.throw(a))}catch(d){i(d)}}function l(a){a.done?c(a.value):s(a.value).then(o,u)}l((r=r.apply(t,[])).next())})}function $5(t,e){var n={label:0,sent:function(){if(c[0]&1)throw c[1];return c[1]},trys:[],ops:[]},r,s,c,i=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function o(l){return function(a){return u([l,a])}}function u(l){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(n=0)),n;)try{if(r=1,s&&(c=l[0]&2?s.return:l[0]?s.throw||((c=s.return)&&c.call(s),0):s.next)&&!(c=c.call(s,l[1])).done)return c;switch(s=0,c&&(l=[l[0]&2,c.value]),l[0]){case 0:case 1:c=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,s=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(c=n.trys,!(c=c.length>0&&c[c.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!c||l[1]>c[0]&&l[1]<c[3])){n.label=l[1];break}if(l[0]===6&&n.label<c[1]){n.label=c[1],c=l;break}if(c&&n.label<c[2]){n.label=c[2],n.ops.push(l);break}c[2]&&n.ops.pop(),n.trys.pop();continue}l=e.call(t,n)}catch(a){l=[6,a],s=0}finally{r=c=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function oc(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function yo(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),s,c=[],i;try{for(;(e===void 0||e-- >0)&&!(s=r.next()).done;)c.push(s.value)}catch(o){i={error:o}}finally{try{s&&!s.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return c}function da(t,e,n){if(arguments.length===2)for(var r=0,s=e.length,c;r<s;r++)(c||!(r in e))&&(c||(c=Array.prototype.slice.call(e,0,r)),c[r]=e[r]);return t.concat(c||Array.prototype.slice.call(e))}function Gl(t){return this instanceof Gl?(this.v=t,this):new Gl(t)}function TP(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),s,c=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),o("next"),o("throw"),o("return",i),s[Symbol.asyncIterator]=function(){return this},s;function i(p){return function(v){return Promise.resolve(v).then(p,d)}}function o(p,v){r[p]&&(s[p]=function(m){return new Promise(function(b,y){c.push([p,m,b,y])>1||u(p,m)})},v&&(s[p]=v(s[p])))}function u(p,v){try{l(r[p](v))}catch(m){h(c[0][3],m)}}function l(p){p.value instanceof Gl?Promise.resolve(p.value.v).then(a,d):h(c[0][2],p)}function a(p){u("next",p)}function d(p){u("throw",p)}function h(p,v){p(v),c.shift(),c.length&&u(c[0][0],c[0][1])}}function AP(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof oc=="function"?oc(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(c){n[c]=t[c]&&function(i){return new Promise(function(o,u){i=t[c](i),s(o,u,i.done,i.value)})}}function s(c,i,o,u){Promise.resolve(u).then(function(l){c({value:l,done:o})},i)}}function Cn(t){return typeof t=="function"}function U5(t){var e=function(r){Error.call(r),r.stack=new Error().stack},n=t(e);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var qv=U5(function(t){return function(e){t(this),this.message=e?e.length+` errors occurred during unsubscription:
|
|
6658
6658
|
`+e.map(function(n,r){return r+1+") "+n.toString()}).join(`
|
|
6659
|
-
`):"",this.name="UnsubscriptionError",this.errors=e}});function Rh(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var _d=function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,n,r,s,c;if(!this.closed){this.closed=!0;var i=this._parentage;if(i)if(this._parentage=null,Array.isArray(i))try{for(var o=oc(i),u=o.next();!u.done;u=o.next()){var l=u.value;l.remove(this)}}catch(m){e={error:m}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}else i.remove(this);var a=this.initialTeardown;if(Cn(a))try{a()}catch(m){c=m instanceof qv?m.errors:[m]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var h=oc(d),p=h.next();!p.done;p=h.next()){var v=p.value;try{X2(v)}catch(m){c=c??[],m instanceof qv?c=da(da([],yo(c)),yo(m.errors)):c.push(m)}}}catch(m){r={error:m}}finally{try{p&&!p.done&&(s=h.return)&&s.call(h)}finally{if(r)throw r.error}}}if(c)throw new qv(c)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)X2(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(e)}},t.prototype._hasParent=function(e){var n=this._parentage;return n===e||Array.isArray(n)&&n.includes(e)},t.prototype._addParent=function(e){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(e),n):n?[n,e]:e},t.prototype._removeParent=function(e){var n=this._parentage;n===e?this._parentage=null:Array.isArray(n)&&Rh(n,e)},t.prototype.remove=function(e){var n=this._finalizers;n&&Rh(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),V5=_d.EMPTY;function F5(t){return t instanceof _d||t&&"closed"in t&&Cn(t.remove)&&Cn(t.add)&&Cn(t.unsubscribe)}function X2(t){Cn(t)?t():t.unsubscribe()}var IP={Promise:void 0},OP={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,da([t,e],yo(n)))},clearTimeout:function(t){return clearTimeout(t)},delegate:void 0};function z5(t){OP.setTimeout(function(){throw t})}function rd(){}function lh(t){t()}var B0=function(t){ma(e,t);function e(n){var r=t.call(this)||this;return r.isStopped=!1,n?(r.destination=n,F5(n)&&n.add(r)):r.destination=LP,r}return e.create=function(n,r,s){return new sd(n,r,s)},e.prototype.next=function(n){this.isStopped||this._next(n)},e.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(n){this.destination.next(n)},e.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(_d),RP=function(){function t(e){this.partialObserver=e}return t.prototype.next=function(e){var n=this.partialObserver;if(n.next)try{n.next(e)}catch(r){zf(r)}},t.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(r){zf(r)}else zf(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(n){zf(n)}},t}(),sd=function(t){ma(e,t);function e(n,r,s){var c=t.call(this)||this,i;return Cn(n)||!n?i={next:n??void 0,error:r??void 0,complete:s??void 0}:i=n,c.destination=new RP(i),c}return e}(B0);function zf(t){z5(t)}function NP(t){throw t}var LP={closed:!0,next:rd,error:NP,complete:rd},$0=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function yp(t){return t}function DP(t){return t.length===0?yp:t.length===1?t[0]:function(e){return t.reduce(function(n,r){return r(n)},e)}}var ur=function(){function t(e){e&&(this._subscribe=e)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(e,n,r){var s=this,c=PP(e)?e:new sd(e,n,r);return lh(function(){var i=s,o=i.operator,u=i.source;c.add(o?o.call(c,u):u?s._subscribe(c):s._trySubscribe(c))}),c},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(n){e.error(n)}},t.prototype.forEach=function(e,n){var r=this;return n=q2(n),new n(function(s,c){var i=new sd({next:function(o){try{e(o)}catch(u){c(u),i.unsubscribe()}},error:c,complete:s});r.subscribe(i)})},t.prototype._subscribe=function(e){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(e)},t.prototype[$0]=function(){return this},t.prototype.pipe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return DP(e)(this)},t.prototype.toPromise=function(e){var n=this;return e=q2(e),new e(function(r,s){var c;n.subscribe(function(i){return c=i},function(i){return s(i)},function(){return r(c)})})},t.create=function(e){return new t(e)},t}();function q2(t){var e;return(e=t??IP.Promise)!==null&&e!==void 0?e:Promise}function MP(t){return t&&Cn(t.next)&&Cn(t.error)&&Cn(t.complete)}function PP(t){return t&&t instanceof B0||MP(t)&&F5(t)}function BP(t){return Cn(t==null?void 0:t.lift)}function $r(t){return function(e){if(BP(e))return e.lift(function(n){try{return t(n,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function nr(t,e,n,r,s){return new $P(t,e,n,r,s)}var $P=function(t){ma(e,t);function e(n,r,s,c,i,o){var u=t.call(this,n)||this;return u.onFinalize=i,u.shouldUnsubscribe=o,u._next=r?function(l){try{r(l)}catch(a){n.error(a)}}:t.prototype._next,u._error=c?function(l){try{c(l)}catch(a){n.error(a)}finally{this.unsubscribe()}}:t.prototype._error,u._complete=s?function(){try{s()}catch(l){n.error(l)}finally{this.unsubscribe()}}:t.prototype._complete,u}return e.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;t.prototype.unsubscribe.call(this),!r&&((n=this.onFinalize)===null||n===void 0||n.call(this))}},e}(B0),UP=U5(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),zs=function(t){ma(e,t);function e(){var n=t.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return e.prototype.lift=function(n){var r=new J2(this,this);return r.operator=n,r},e.prototype._throwIfClosed=function(){if(this.closed)throw new UP},e.prototype.next=function(n){var r=this;lh(function(){var s,c;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var i=oc(r.currentObservers),o=i.next();!o.done;o=i.next()){var u=o.value;u.next(n)}}catch(l){s={error:l}}finally{try{o&&!o.done&&(c=i.return)&&c.call(i)}finally{if(s)throw s.error}}}})},e.prototype.error=function(n){var r=this;lh(function(){if(r._throwIfClosed(),!r.isStopped){r.hasError=r.isStopped=!0,r.thrownError=n;for(var s=r.observers;s.length;)s.shift().error(n)}})},e.prototype.complete=function(){var n=this;lh(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var r=n.observers;r.length;)r.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(n){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,n)},e.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},e.prototype._innerSubscribe=function(n){var r=this,s=this,c=s.hasError,i=s.isStopped,o=s.observers;return c||i?V5:(this.currentObservers=null,o.push(n),new _d(function(){r.currentObservers=null,Rh(o,n)}))},e.prototype._checkFinalizedStatuses=function(n){var r=this,s=r.hasError,c=r.thrownError,i=r.isStopped;s?n.error(c):i&&n.complete()},e.prototype.asObservable=function(){var n=new ur;return n.source=this,n},e.create=function(n,r){return new J2(n,r)},e}(ur),J2=function(t){ma(e,t);function e(n,r){var s=t.call(this)||this;return s.destination=n,s.source=r,s}return e.prototype.next=function(n){var r,s;(s=(r=this.destination)===null||r===void 0?void 0:r.next)===null||s===void 0||s.call(r,n)},e.prototype.error=function(n){var r,s;(s=(r=this.destination)===null||r===void 0?void 0:r.error)===null||s===void 0||s.call(r,n)},e.prototype.complete=function(){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||r===void 0||r.call(n)},e.prototype._subscribe=function(n){var r,s;return(s=(r=this.source)===null||r===void 0?void 0:r.subscribe(n))!==null&&s!==void 0?s:V5},e}(zs),VP={now:function(){return Date.now()}},FP=function(t){ma(e,t);function e(n,r){return t.call(this)||this}return e.prototype.schedule=function(n,r){return this},e}(_d),Q2={setInterval:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,da([t,e],yo(n)))},clearInterval:function(t){return clearInterval(t)},delegate:void 0},zP=function(t){ma(e,t);function e(n,r){var s=t.call(this,n,r)||this;return s.scheduler=n,s.work=r,s.pending=!1,s}return e.prototype.schedule=function(n,r){var s;if(r===void 0&&(r=0),this.closed)return this;this.state=n;var c=this.id,i=this.scheduler;return c!=null&&(this.id=this.recycleAsyncId(i,c,r)),this.pending=!0,this.delay=r,this.id=(s=this.id)!==null&&s!==void 0?s:this.requestAsyncId(i,this.id,r),this},e.prototype.requestAsyncId=function(n,r,s){return s===void 0&&(s=0),Q2.setInterval(n.flush.bind(n,this),s)},e.prototype.recycleAsyncId=function(n,r,s){if(s===void 0&&(s=0),s!=null&&this.delay===s&&this.pending===!1)return r;r!=null&&Q2.clearInterval(r)},e.prototype.execute=function(n,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var s=this._execute(n,r);if(s)return s;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(n,r){var s=!1,c;try{this.work(n)}catch(i){s=!0,c=i||new Error("Scheduled action threw falsy error")}if(s)return this.unsubscribe(),c},e.prototype.unsubscribe=function(){if(!this.closed){var n=this,r=n.id,s=n.scheduler,c=s.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Rh(c,this),r!=null&&(this.id=this.recycleAsyncId(s,r,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(FP),ex=function(){function t(e,n){n===void 0&&(n=t.now),this.schedulerActionCtor=e,this.now=n}return t.prototype.schedule=function(e,n,r){return n===void 0&&(n=0),new this.schedulerActionCtor(this,e).schedule(r,n)},t.now=VP.now,t}(),HP=function(t){ma(e,t);function e(n,r){r===void 0&&(r=ex.now);var s=t.call(this,n,r)||this;return s.actions=[],s._active=!1,s}return e.prototype.flush=function(n){var r=this.actions;if(this._active){r.push(n);return}var s;this._active=!0;do if(s=n.execute(n.state,n.delay))break;while(n=r.shift());if(this._active=!1,s){for(;n=r.shift();)n.unsubscribe();throw s}},e}(ex),_p=new HP(zP),GP=_p,H5=new ur(function(t){return t.complete()});function G5(t){return t&&Cn(t.schedule)}function U0(t){return t[t.length-1]}function WP(t){return Cn(U0(t))?t.pop():void 0}function W5(t){return G5(U0(t))?t.pop():void 0}function ZP(t,e){return typeof U0(t)=="number"?t.pop():e}var V0=function(t){return t&&typeof t.length=="number"&&typeof t!="function"};function Z5(t){return Cn(t==null?void 0:t.then)}function K5(t){return Cn(t[$0])}function Y5(t){return Symbol.asyncIterator&&Cn(t==null?void 0:t[Symbol.asyncIterator])}function X5(t){return new TypeError("You provided "+(t!==null&&typeof t=="object"?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function KP(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var q5=KP();function J5(t){return Cn(t==null?void 0:t[q5])}function Q5(t){return TP(this,arguments,function(){var e,n,r,s;return $5(this,function(c){switch(c.label){case 0:e=t.getReader(),c.label=1;case 1:c.trys.push([1,,9,10]),c.label=2;case 2:return[4,Gl(e.read())];case 3:return n=c.sent(),r=n.value,s=n.done,s?[4,Gl(void 0)]:[3,5];case 4:return[2,c.sent()];case 5:return[4,Gl(r)];case 6:return[4,c.sent()];case 7:return c.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}})})}function ek(t){return Cn(t==null?void 0:t.getReader)}function Ir(t){if(t instanceof ur)return t;if(t!=null){if(K5(t))return YP(t);if(V0(t))return XP(t);if(Z5(t))return qP(t);if(Y5(t))return tk(t);if(J5(t))return JP(t);if(ek(t))return QP(t)}throw X5(t)}function YP(t){return new ur(function(e){var n=t[$0]();if(Cn(n.subscribe))return n.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function XP(t){return new ur(function(e){for(var n=0;n<t.length&&!e.closed;n++)e.next(t[n]);e.complete()})}function qP(t){return new ur(function(e){t.then(function(n){e.closed||(e.next(n),e.complete())},function(n){return e.error(n)}).then(null,z5)})}function JP(t){return new ur(function(e){var n,r;try{for(var s=oc(t),c=s.next();!c.done;c=s.next()){var i=c.value;if(e.next(i),e.closed)return}}catch(o){n={error:o}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}e.complete()})}function tk(t){return new ur(function(e){eB(t,e).catch(function(n){return e.error(n)})})}function QP(t){return tk(Q5(t))}function eB(t,e){var n,r,s,c;return kP(this,void 0,void 0,function(){var i,o;return $5(this,function(u){switch(u.label){case 0:u.trys.push([0,5,6,11]),n=AP(t),u.label=1;case 1:return[4,n.next()];case 2:if(r=u.sent(),!!r.done)return[3,4];if(i=r.value,e.next(i),e.closed)return[2];u.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return o=u.sent(),s={error:o},[3,11];case 6:return u.trys.push([6,,9,10]),r&&!r.done&&(c=n.return)?[4,c.call(n)]:[3,8];case 7:u.sent(),u.label=8;case 8:return[3,10];case 9:if(s)throw s.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function Wa(t,e,n,r,s){r===void 0&&(r=0),s===void 0&&(s=!1);var c=e.schedule(function(){n(),s?t.add(this.schedule(null,r)):this.unsubscribe()},r);if(t.add(c),!s)return c}function nk(t,e){return e===void 0&&(e=0),$r(function(n,r){n.subscribe(nr(r,function(s){return Wa(r,t,function(){return r.next(s)},e)},function(){return Wa(r,t,function(){return r.complete()},e)},function(s){return Wa(r,t,function(){return r.error(s)},e)}))})}function rk(t,e){return e===void 0&&(e=0),$r(function(n,r){r.add(t.schedule(function(){return n.subscribe(r)},e))})}function tB(t,e){return Ir(t).pipe(rk(e),nk(e))}function nB(t,e){return Ir(t).pipe(rk(e),nk(e))}function rB(t,e){return new ur(function(n){var r=0;return e.schedule(function(){r===t.length?n.complete():(n.next(t[r++]),n.closed||this.schedule())})})}function sB(t,e){return new ur(function(n){var r;return Wa(n,e,function(){r=t[q5](),Wa(n,e,function(){var s,c,i;try{s=r.next(),c=s.value,i=s.done}catch(o){n.error(o);return}i?n.complete():n.next(c)},0,!0)}),function(){return Cn(r==null?void 0:r.return)&&r.return()}})}function sk(t,e){if(!t)throw new Error("Iterable cannot be null");return new ur(function(n){Wa(n,e,function(){var r=t[Symbol.asyncIterator]();Wa(n,e,function(){r.next().then(function(s){s.done?n.complete():n.next(s.value)})},0,!0)})})}function iB(t,e){return sk(Q5(t),e)}function oB(t,e){if(t!=null){if(K5(t))return tB(t,e);if(V0(t))return rB(t,e);if(Z5(t))return nB(t,e);if(Y5(t))return sk(t,e);if(J5(t))return sB(t,e);if(ek(t))return iB(t,e)}throw X5(t)}function ik(t,e){return e?oB(t,e):Ir(t)}function aB(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=W5(t);return ik(t,n)}function lB(t){return t instanceof Date&&!isNaN(t)}function Fs(t,e){return $r(function(n,r){var s=0;n.subscribe(nr(r,function(c){r.next(t.call(e,c,s++))}))})}var cB=Array.isArray;function uB(t,e){return cB(e)?t.apply(void 0,da([],yo(e))):t(e)}function dB(t){return Fs(function(e){return uB(t,e)})}function fB(t,e,n,r,s,c,i,o){var u=[],l=0,a=0,d=!1,h=function(){d&&!u.length&&!l&&e.complete()},p=function(m){return l<r?v(m):u.push(m)},v=function(m){l++;var b=!1;Ir(n(m,a++)).subscribe(nr(e,function(y){e.next(y)},function(){b=!0},void 0,function(){if(b)try{l--;for(var y=function(){var _=u.shift();i||v(_)};u.length&&l<r;)y();h()}catch(_){e.error(_)}}))};return t.subscribe(nr(e,p,function(){d=!0,h()})),function(){}}function za(t,e,n){return n===void 0&&(n=1/0),Cn(e)?za(function(r,s){return Fs(function(c,i){return e(r,c,s,i)})(Ir(t(r,s)))},n):(typeof e=="number"&&(n=e),$r(function(r,s){return fB(r,s,t,n)}))}function hB(t){return t===void 0&&(t=1/0),za(yp,t)}function pB(t){return new ur(function(e){Ir(t()).subscribe(e)})}var mB={connector:function(){return new zs},resetOnDisconnect:!0};function Ua(t,e){e===void 0&&(e=mB);var n=null,r=e.connector,s=e.resetOnDisconnect,c=s===void 0?!0:s,i=r(),o=new ur(function(u){return i.subscribe(u)});return o.connect=function(){return(!n||n.closed)&&(n=pB(function(){return t}).subscribe(i),c&&n.add(function(){return i=r()})),n},o}var vB=["addListener","removeListener"],gB=["addEventListener","removeEventListener"],bB=["on","off"];function Qg(t,e,n,r){if(Cn(n)&&(r=n,n=void 0),r)return Qg(t,e,n).pipe(dB(r));var s=yo(wB(t)?gB.map(function(o){return function(u){return t[o](e,u,n)}}):yB(t)?vB.map(tx(t,e)):_B(t)?bB.map(tx(t,e)):[],2),c=s[0],i=s[1];if(!c&&V0(t))return za(function(o){return Qg(o,e,n)})(Ir(t));if(!c)throw new TypeError("Invalid event target");return new ur(function(o){var u=function(){for(var l=[],a=0;a<arguments.length;a++)l[a]=arguments[a];return o.next(1<l.length?l:l[0])};return c(u),function(){return i(u)}})}function tx(t,e){return function(n){return function(r){return t[n](e,r)}}}function yB(t){return Cn(t.addListener)&&Cn(t.removeListener)}function _B(t){return Cn(t.on)&&Cn(t.off)}function wB(t){return Cn(t.addEventListener)&&Cn(t.removeEventListener)}function Lu(t,e,n){t===void 0&&(t=0),n===void 0&&(n=GP);var r=-1;return e!=null&&(G5(e)?n=e:r=e),new ur(function(s){var c=lB(t)?+t-n.now():t;c<0&&(c=0);var i=0;return n.schedule(function(){s.closed||(s.next(i++),0<=r?this.schedule(void 0,r):s.complete())},c)})}function SB(t,e){return e===void 0&&(e=_p),Lu(t,t,e)}function xB(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=W5(t),r=ZP(t,1/0),s=t;return s.length?s.length===1?Ir(s[0]):hB(r)(ik(s,n)):H5}var CB=Array.isArray;function EB(t){return t.length===1&&CB(t[0])?t[0]:t}function na(t,e){return $r(function(n,r){var s=0;n.subscribe(nr(r,function(c){return t.call(e,c,s++)&&r.next(c)}))})}function jB(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t=EB(t),t.length===1?Ir(t[0]):new ur(kB(t))}function kB(t){return function(e){for(var n=[],r=function(c){n.push(Ir(t[c]).subscribe(nr(e,function(i){if(n){for(var o=0;o<n.length;o++)o!==c&&n[o].unsubscribe();n=null}e.next(i)})))},s=0;n&&!e.closed&&s<t.length;s++)r(s)}}function TB(t){return $r(function(e,n){var r=null,s=null,c=function(){s==null||s.unsubscribe();var i=r;r=[],i&&n.next(i),Ir(t()).subscribe(s=nr(n,c,rd))};c(),e.subscribe(nr(n,function(i){return r==null?void 0:r.push(i)},function(){r&&n.next(r),n.complete()},void 0,function(){return r=s=null}))})}function ok(t){return $r(function(e,n){var r=null,s=!1,c;r=e.subscribe(nr(n,void 0,void 0,function(i){c=Ir(t(i,ok(t)(e))),r?(r.unsubscribe(),r=null,c.subscribe(n)):s=!0})),s&&(r.unsubscribe(),r=null,c.subscribe(n))})}function AB(t,e,n,r,s){return function(c,i){var o=n,u=e,l=0;c.subscribe(nr(i,function(a){var d=l++;u=o?t(u,a,d):(o=!0,a),i.next(u)},s))}}function nx(t){return t<=0?function(){return H5}:$r(function(e,n){var r=0;e.subscribe(nr(n,function(s){++r<=t&&(n.next(s),t<=r&&n.complete())}))})}function IB(t){return $r(function(e,n){try{e.subscribe(n)}finally{n.add(t)}})}function OB(t,e){return $r(AB(t,e,arguments.length>=2,!0))}function RB(t){t===void 0&&(t={});var e=t.connector,n=e===void 0?function(){return new zs}:e,r=t.resetOnError,s=r===void 0?!0:r,c=t.resetOnComplete,i=c===void 0?!0:c,o=t.resetOnRefCountZero,u=o===void 0?!0:o;return function(l){var a,d,h,p=0,v=!1,m=!1,b=function(){d==null||d.unsubscribe(),d=void 0},y=function(){b(),a=h=void 0,v=m=!1},_=function(){var S=a;y(),S==null||S.unsubscribe()};return $r(function(S,C){p++,!m&&!v&&b();var x=h=h??n();C.add(function(){p--,p===0&&!m&&!v&&(d=Jv(_,u))}),x.subscribe(C),!a&&p>0&&(a=new sd({next:function(j){return x.next(j)},error:function(j){m=!0,b(),d=Jv(y,s,j),x.error(j)},complete:function(){v=!0,b(),d=Jv(y,i),x.complete()}}),Ir(S).subscribe(a))})(l)}}function Jv(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(e===!0){t();return}if(e!==!1){var s=new sd({next:function(){s.unsubscribe(),t()}});return Ir(e.apply(void 0,da([],yo(n)))).subscribe(s)}}function NB(t){return $r(function(e,n){var r=!1,s=nr(n,function(){s==null||s.unsubscribe(),r=!0},rd);Ir(t).subscribe(s),e.subscribe(nr(n,function(c){return r&&n.next(c)}))})}function rx(t,e){return $r(function(n,r){var s=null,c=0,i=!1,o=function(){return i&&!s&&r.complete()};n.subscribe(nr(r,function(u){s==null||s.unsubscribe();var l=0,a=c++;Ir(t(u,a)).subscribe(s=nr(r,function(d){return r.next(e?e(u,d,a,l++):d)},function(){s=null,o()}))},function(){i=!0,o()}))})}function Hf(t,e){return e===void 0&&(e=!1),$r(function(n,r){var s=0;n.subscribe(nr(r,function(c){var i=t(c,s++);(i||e)&&r.next(c),!i&&r.complete()}))})}function LB(t,e,n){var r=Cn(t)||e||n?{next:t,error:e,complete:n}:t;return r?$r(function(s,c){var i;(i=r.subscribe)===null||i===void 0||i.call(r);var o=!0;s.subscribe(nr(c,function(u){var l;(l=r.next)===null||l===void 0||l.call(r,u),c.next(u)},function(){var u;o=!1,(u=r.complete)===null||u===void 0||u.call(r),c.complete()},function(u){var l;o=!1,(l=r.error)===null||l===void 0||l.call(r,u),c.error(u)},function(){var u,l;o&&((u=r.unsubscribe)===null||u===void 0||u.call(r)),(l=r.finalize)===null||l===void 0||l.call(r)}))}):yp}function DB(t,e){return $r(function(n,r){var s=e??{},c=s.leading,i=c===void 0?!0:c,o=s.trailing,u=o===void 0?!1:o,l=!1,a=null,d=null,h=!1,p=function(){d==null||d.unsubscribe(),d=null,u&&(b(),h&&r.complete())},v=function(){d=null,h&&r.complete()},m=function(y){return d=Ir(t(y)).subscribe(nr(r,p,v))},b=function(){if(l){l=!1;var y=a;a=null,r.next(y),!h&&m(y)}};n.subscribe(nr(r,function(y){l=!0,a=y,!(d&&!d.closed)&&(i?b():m(y))},function(){h=!0,!(u&&l&&d&&!d.closed)&&r.complete()}))})}function sx(t,e,n){e===void 0&&(e=_p);var r=Lu(t,e);return DB(function(){return r},n)}function Qv(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=WP(t);return $r(function(r,s){for(var c=t.length,i=new Array(c),o=t.map(function(){return!1}),u=!1,l=function(d){Ir(t[d]).subscribe(nr(s,function(h){i[d]=h,!u&&!o[d]&&(o[d]=!0,(u=o.every(yp))&&(o=null))},rd))},a=0;a<c;a++)l(a);r.subscribe(nr(s,function(d){if(u){var h=da([d],yo(i));s.next(n?n.apply(void 0,da([],yo(h))):h)}}))})}const ak="0123456789ABCDEFGHJKMNPQRSTVWXYZ",Nh=32,MB=16,lk=10,ix=0xffffffffffff;var Ha;(function(t){t.Base32IncorrectEncoding="B32_ENC_INVALID",t.DecodeTimeInvalidCharacter="DEC_TIME_CHAR",t.DecodeTimeValueMalformed="DEC_TIME_MALFORMED",t.EncodeTimeNegative="ENC_TIME_NEG",t.EncodeTimeSizeExceeded="ENC_TIME_SIZE_EXCEED",t.EncodeTimeValueMalformed="ENC_TIME_MALFORMED",t.PRNGDetectFailure="PRNG_DETECT",t.ULIDInvalid="ULID_INVALID",t.Unexpected="UNEXPECTED",t.UUIDInvalid="UUID_INVALID"})(Ha||(Ha={}));class Cu extends Error{constructor(e,n){super(`${n} (${e})`),this.name="ULIDError",this.code=e}}function PB(t){const e=Math.floor(t()*Nh)%Nh;return ak.charAt(e)}function BB(t){const e=$B(),n=e&&(e.crypto||e.msCrypto)||null;if(typeof(n==null?void 0:n.getRandomValues)=="function")return()=>{const r=new Uint8Array(1);return n.getRandomValues(r),r[0]/255};if(typeof(n==null?void 0:n.randomBytes)=="function")return()=>n.randomBytes(1).readUInt8()/255;throw new Cu(Ha.PRNGDetectFailure,"Failed to find a reliable PRNG")}function $B(){return FB()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function UB(t,e){let n="";for(;t>0;t--)n=PB(e)+n;return n}function VB(t,e=lk){if(isNaN(t))throw new Cu(Ha.EncodeTimeValueMalformed,`Time must be a number: ${t}`);if(t>ix)throw new Cu(Ha.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${ix}: ${t}`);if(t<0)throw new Cu(Ha.EncodeTimeNegative,`Time must be positive: ${t}`);if(Number.isInteger(t)===!1)throw new Cu(Ha.EncodeTimeValueMalformed,`Time must be an integer: ${t}`);let n,r="";for(let s=e;s>0;s--)n=t%Nh,r=ak.charAt(n)+r,t=(t-n)/Nh;return r}function FB(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function zB(t,e){const n=BB(),r=Date.now();return VB(r,lk)+UB(MB,n)}const Pr=[];for(let t=0;t<256;++t)Pr.push((t+256).toString(16).slice(1));function HB(t,e=0){return(Pr[t[e+0]]+Pr[t[e+1]]+Pr[t[e+2]]+Pr[t[e+3]]+"-"+Pr[t[e+4]]+Pr[t[e+5]]+"-"+Pr[t[e+6]]+Pr[t[e+7]]+"-"+Pr[t[e+8]]+Pr[t[e+9]]+"-"+Pr[t[e+10]]+Pr[t[e+11]]+Pr[t[e+12]]+Pr[t[e+13]]+Pr[t[e+14]]+Pr[t[e+15]]).toLowerCase()}let eg;const GB=new Uint8Array(16);function WB(){if(!eg){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");eg=crypto.getRandomValues.bind(crypto)}return eg(GB)}const ZB=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),ox={randomUUID:ZB};function KB(t,e,n){var r;if(ox.randomUUID&&!t)return ox.randomUUID();t=t||{};const s=t.random??((r=t.rng)==null?void 0:r.call(t))??WB();if(s.length<16)throw new Error("Random bytes length must be >= 16");return s[6]=s[6]&15|64,s[8]=s[8]&63|128,HB(s)}const YB=5e3,XB=1e3,Gf=4e3,ax=1e3;var ck=(t=>(t.CONTINUOUS="CONTINUOUS",t.INITIAL="INITIAL",t))(ck||{});class uk{constructor({knownID:e,runID:n,sequence:r,options:s}){Ln(this,"callback"),Ln(this,"queue",new zs),Ln(this,"subscriptions",[]),Ln(this,"reconnect",new zs),Ln(this,"client",new ur),Ln(this,"_latencies",new zs),Ln(this,"_latenciesConnectable",Ua(this._latencies.asObservable().pipe(OB((c,i)=>{if(i.latency<0){const o=c.get(i.streamID);o&&c.set(i.streamID,{...o,readyState:i.readyState})}else c.set(i.streamID,i);return c},new Map)))),Ln(this,"_errors",new zs),Ln(this,"_errorsConnectable",Ua(this._errors.asObservable())),Ln(this,"_stdout",new zs),Ln(this,"_stderr",new zs),Ln(this,"_exitCode",new zs),Ln(this,"_pid",new zs),Ln(this,"_mimeType",new zs),Ln(this,"_stdoutConnectable",Ua(this._stdout.asObservable())),Ln(this,"_stderrConnectable",Ua(this._stderr.asObservable())),Ln(this,"_exitCodeConnectable",Ua(this._exitCode.asObservable())),Ln(this,"_pidConnectable",Ua(this._pid.asObservable())),Ln(this,"_mimeTypeConnectable",Ua(this._mimeType.asObservable())),Ln(this,"knownID"),Ln(this,"runID"),Ln(this,"sequence"),Ln(this,"runnerEndpoint"),Ln(this,"interceptors"),Ln(this,"autoReconnect"),this.knownID=e,this.runID=n,this.sequence=r,this.runnerEndpoint=s.runnerEndpoint,this.interceptors=s.interceptors,this.autoReconnect=s.autoReconnect,this._latenciesConnectable.connect(),this._errorsConnectable.connect(),this._stdoutConnectable.connect(),this._stderrConnectable.connect(),this._exitCodeConnectable.connect(),this._pidConnectable.connect(),this._mimeTypeConnectable.connect(),this.client=this.reconnect.pipe(sx(ax,_p,{leading:!0,trailing:!0}),rx(c=>this.useSocketClient(c.streamID).pipe(rx(i=>this.useHeartbeat(i,c))))).pipe(RB()),this.subscriptions.push(this.monitor()),this.subscriptions.push(this.process())}get latencies(){return this._latenciesConnectable}get errors(){return this._errorsConnectable}get stdout(){return this._stdoutConnectable}get stderr(){return this._stderrConnectable}get exitCode(){return this._exitCodeConnectable}get pid(){return this._pidConnectable}get mimeType(){return this._mimeTypeConnectable}monitor(){return SB(XB).pipe(na(()=>this.autoReconnect),Qv(this.reconnect),na(([,e])=>e.heartbeat==="CONTINUOUS"),Qv(this.latencies),Fs(([,e])=>Array.from(e.values()).filter(n=>n.readyState===WebSocket.OPEN&&n.latency>=Gf)),na(e=>e.length>0),sx(ax)).subscribe({next:e=>{console.log(new Date,"Triggering reconnect",e),this.connect()},complete:()=>{console.log("Monitor complete")},error:e=>{console.error("Error in monitor",e)}})}process(){const e=this.client.pipe(na(s=>(s==null?void 0:s.readyState)===WebSocket.OPEN),nx(1)),n=this.queue.pipe(TB(()=>e),na(s=>s.length>0),Fs(s=>s.sort((c,i)=>{const o=u=>{var l;return!!((l=u.payload.value)!=null&&l.config)};return o(i)?1:o(c)?-1:0}))),r=this.queue.pipe(NB(e));return xB(n.pipe(za(s=>s)),r).pipe(Qv(this.client),Hf(([,s])=>s.readyState===WebSocket.OPEN),za(async([s,c])=>{await cx({req:s,interceptors:this.interceptors,socket:c,knownID:this.knownID,runID:this.runID})})).subscribe({error:s=>{this._errors.next(s)}})}useSocketClient(e){return new ur(n=>{const r=new URL(this.runnerEndpoint);r.searchParams.set("id",e),r.searchParams.set("runID",this.runID);const s=new WebSocket(r.toString()),c=l=>{if(console.log(new Date,`WebSocket transport ${e} closed`,l),l.code===1005){n.complete();return}if(this.autoReconnect){this.connect();return}},i=l=>{console.log(new Date,`WebSocket transport ${e} error`,l),this.autoReconnect||n.error(l)},o=l=>{var a,d;if(typeof l.data!="string"){console.warn("Unexpected WebSocket message type:",typeof l.data);return}let h;try{h=lx(l.data),console.log("Received WebsocketResponse:",h)}catch(m){console.error("Failed to parse WebsocketResponse:",m)}const p=h.status;if(p&&p.code!==EP.OK){n.error(p);return}if(h.pong)return;const v=h.payload.value;if(v.stdoutData&&v.stdoutData.length>0&&((a=this.callback)==null||a.call(this,{type:Nu.terminalStdout,output:{"runme.dev/id":this.knownID,data:v.stdoutData}}),this._stdout.next(v.stdoutData)),v.stderrData&&v.stderrData.length>0&&((d=this.callback)==null||d.call(this,{type:Nu.terminalStderr,output:{"runme.dev/id":this.knownID,data:v.stderrData}}),this._stderr.next(v.stderrData)),v.exitCode!==void 0&&(this._exitCode.next(v.exitCode),n.complete()),v.pid!==void 0&&this._pid.next(v.pid),v.mimeType){const m=v.mimeType.split(";")[0];this._mimeType.next(m)}},u=()=>{console.log(new Date,`✅ Connected WebSocket for cell ${this.knownID} (#${this.sequence}) with runID ${this.runID}`),n.next(s)};return s.addEventListener("close",c),s.addEventListener("error",i),s.addEventListener("message",o),s.addEventListener("open",u),()=>{console.log(new Date,`☑️ Cleanly disconnected WebSocket for cell ${this.knownID} (#${this.sequence}) with runID ${this.runID}`),s.removeEventListener("close",c),s.removeEventListener("error",i),s.removeEventListener("message",o),s.removeEventListener("open",u),s.close()}})}setCallback(e){this.callback=e}sendExecuteRequest(e){this.queue.next(tn(qg,{payload:{value:e,case:"executeRequest"}}))}useHeartbeat(e,{streamID:n,heartbeat:r}){return new ur(s=>{const c=Qg(e,"message").pipe(Hf(()=>e.readyState===WebSocket.OPEN),Fs(u=>lx(u.data)),Fs(u=>u.pong),na(u=>u!==void 0),Fs(u=>({receivedAt:BigInt(Date.now()),pong:u}))),i=(r==="INITIAL"?Lu(0):Lu(0,YB)).pipe(Hf(()=>e.readyState===WebSocket.OPEN),Fs(()=>{const u={timestamp:BigInt(Date.now())};return tn(qg,{ping:u})}),za(async u=>(await cx({req:u,interceptors:this.interceptors,socket:e}),u)),Fs(u=>u.ping)).pipe(na(u=>(u==null?void 0:u.timestamp)!==void 0),za(u=>jB(c.pipe(na(l=>l.pong.timestamp===u.timestamp),nx(1),Fs(l=>{const a=u.timestamp,d=l.receivedAt;return Number(d-a)})),Lu(Gf).pipe(Fs(()=>{throw new Error(`Pong not received within ${Gf}ms for stream ${n}`)}))).pipe(ok(l=>(this._latencies.next({streamID:n,latency:Gf,readyState:e.readyState,updatedAt:BigInt(Date.now())}),console.log(new Date,"Ping deadline exceeded",l.message),aB(null))))),IB(()=>{this._latencies.next({streamID:n,latency:-1,readyState:e.readyState,updatedAt:BigInt(Date.now())})}),LB(u=>{u!==null&&this._latencies.next({streamID:n,latency:u,readyState:e.readyState,updatedAt:BigInt(Date.now())})})),o=[];return o.push(i.subscribe({error:u=>{console.error("Unexpected error sending heartbeat",u)}})),s.next(e),()=>{o.forEach(u=>u.unsubscribe())}})}connect(e="CONTINUOUS"){const n=qB(),r=this.latencies.pipe(Fs(s=>{const c=s.get(n);return c===void 0?null:c}),Hf(s=>(s==null?void 0:s.readyState)===WebSocket.OPEN));return this.reconnect.next({streamID:n,heartbeat:e}),r}close(){this.reconnect.complete(),this.queue.complete(),this._latencies.complete(),this.subscriptions.forEach(e=>e.unsubscribe())}}function lx(t){const e=JSON.parse(t);return b0(jP,e)}async function cx({req:t,interceptors:e,socket:n,knownID:r,runID:s}){r&&(t.knownId=r),s&&(t.runId=s);const c={stream:!1,message:{},method:{},service:{},requestMethod:"UPGRADE",url:n.url,signal:new AbortController().signal,header:new Headers,contextValues:{}};let i=async u=>({stream:!1,message:{},method:{},service:{},header:u.header});for(const u of e.concat().reverse())i=u(i);const o=(await i(c)).header.get("Authorization");o&&t&&(t.authorization=o),n.send(JSON.stringify(V3(qg,t)))}function qB(){return KB().replace(/-/g,"")}function dk(){return`run_${zB()}`}function JB({cellID:t,runID:e,sequence:n,commands:r,content:s,runner:c,settings:i={},onStdout:o,onStderr:u,onExitCode:l,onPid:a,onMimeType:d}){var h;const{rows:p=20,className:v,fontSize:m=12,fontFamily:b="monospace",takeFocus:y=!0,scrollToFit:_=!0}=i,S=B.useMemo(()=>!t||s===""?null:s,[t,s]),C=B.useMemo(()=>{if(!(!t||!e||!c.endpoint))return console.log("Creating stream",t,e,c.endpoint),new uk({knownID:t,runID:e,sequence:n,options:{runnerEndpoint:c.endpoint,interceptors:c.interceptors,autoReconnect:c.reconnect}})},[t,e,n,c]);B.useEffect(()=>{const N=C==null?void 0:C.connect().subscribe(D=>console.log(`Heartbeat latency for streamID ${D==null?void 0:D.streamID} (${(D==null?void 0:D.readyState)===1?"open":"closed"}): ${D==null?void 0:D.latency}ms`));return()=>{N==null||N.unsubscribe(),C==null||C.close()}},[C]);let x=tn(K2,{rows:34,cols:100,x:0,y:0});const j=B.useMemo(()=>tn(Xv,{sessionStrategy:wP.MOST_RECENT,storeStdoutInEnv:!0,config:{languageId:"sh",background:!1,fileExtension:"",env:[`RUNME_ID=${t}`,"RUNME_RUNNER=v2","TERM=xterm-256color"],source:{case:"commands",value:{items:r}},interactive:!0,mode:yP.INLINE,runId:e,knownId:t},winsize:x}),[t,e,r,x]),k=B.useMemo(()=>{var N;return{output:{"runme.dev/id":(N=j.config)==null?void 0:N.knownId,fontFamily:b||"monospace",fontSize:m||12,cursorStyle:"block",cursorBlink:!0,cursorWidth:1,takeFocus:y,scrollToFit:_,smoothScrollDuration:0,scrollback:4e3,initialRows:p,content:S||"",isAutoSaveEnabled:!1,isPlatformAuthEnabled:!1}}},[(h=j.config)==null?void 0:h.knownId,b,m,y,_,p,S]),A=new TextEncoder;return xP({postMessage:N=>{if(N.type===Nu.terminalOpen||N.type===Nu.terminalResize){const D=Number(N.output.terminalDimensions.columns),M=Number(N.output.terminalDimensions.rows);if(Number.isFinite(D)&&Number.isFinite(M)){if(x.cols===D&&x.rows===M)return;x=tn(K2,{cols:D,rows:M,x:0,y:0});const $=tn(Xv,{winsize:x});C==null||C.sendExecuteRequest($)}}if(N.type===Nu.terminalStdin){const D=A.encode(N.output.input),M=tn(Xv,{inputData:D});C==null||C.sendExecuteRequest(M)}},onDidReceiveMessage:N=>{C==null||C.setCallback(N)}}),B.useEffect(()=>{const N=C==null?void 0:C.stdout.subscribe(D=>{o==null||o(D)});return()=>N==null?void 0:N.unsubscribe()},[C,o]),B.useEffect(()=>{const N=C==null?void 0:C.stderr.subscribe(D=>{u==null||u(D)});return()=>N==null?void 0:N.unsubscribe()},[C,u]),B.useEffect(()=>{const N=C==null?void 0:C.exitCode.subscribe(D=>{l==null||l(D),C==null||C.close()});return()=>N==null?void 0:N.unsubscribe()},[C,l]),B.useEffect(()=>{const N=C==null?void 0:C.pid.subscribe(D=>{a==null||a(D)});return()=>N==null?void 0:N.unsubscribe()},[C,a]),B.useEffect(()=>{const N=C==null?void 0:C.mimeType.subscribe(D=>{d==null||d(D)});return()=>N==null?void 0:N.unsubscribe()},[C,d]),B.useEffect(()=>{!C||!j||(console.log("useEffect invoked - Commands changed:",JSON.stringify(j.config.source.value)),C==null||C.sendExecuteRequest(j))},[j,C]),ie.jsx("div",{className:v,ref:N=>{if(!N||N.hasChildNodes())return;const D=document.createElement("terminal-view");D.setAttribute("buttons","false"),D.setAttribute("id",k.output["runme.dev/id"]),D.setAttribute("fontFamily",k.output.fontFamily),typeof k.output.fontSize=="number"&&D.setAttribute("fontSize",k.output.fontSize.toString()),k.output.cursorStyle&&D.setAttribute("cursorStyle",k.output.cursorStyle),typeof k.output.cursorBlink=="boolean"&&D.setAttribute("cursorBlink",k.output.cursorBlink?"true":"false"),typeof k.output.cursorWidth=="number"&&D.setAttribute("cursorWidth",k.output.cursorWidth.toString()),typeof k.output.takeFocus=="boolean"&&D.setAttribute("takeFocus",k.output.takeFocus?"true":"false"),typeof k.output.smoothScrollDuration=="number"&&D.setAttribute("smoothScrollDuration",k.output.smoothScrollDuration.toString()),typeof k.output.scrollback=="number"&&D.setAttribute("scrollback",k.output.scrollback.toString()),k.output.initialRows!==void 0&&D.setAttribute("initialRows",k.output.initialRows.toString()),k.output.content!==void 0&&D.setAttribute("initialContent",k.output.content),k.output.isAutoSaveEnabled&&D.setAttribute("isAutoSaveEnabled",k.output.isAutoSaveEnabled.toString()),k.output.isPlatformAuthEnabled&&D.setAttribute("isPlatformAuthEnabled",k.output.isPlatformAuthEnabled.toString()),N.appendChild(D);const M=document.createElement("div");M.setAttribute("className","h-1"),N.appendChild(M),setTimeout(()=>{_&&!QB(M)&&M.scrollIntoView({behavior:"smooth"})},0)}})}function QB(t){const e=t.getBoundingClientRect();return e.top>=0&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth)}class Eu extends Error{}Eu.prototype.name="InvalidTokenError";function e$(t){return decodeURIComponent(atob(t).replace(/(.)/g,(e,n)=>{let r=n.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r}))}function t$(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return e$(e)}catch{return atob(e)}}function fk(t,e){if(typeof t!="string")throw new Eu("Invalid token specified: must be a string");e||(e={});const n=e.header===!0?0:1,r=t.split(".")[n];if(typeof r!="string")throw new Eu(`Invalid token specified: missing part #${n+1}`);let s;try{s=t$(r)}catch(c){throw new Eu(`Invalid token specified: invalid base64 for part #${n+1} (${c.message})`)}try{return JSON.parse(s)}catch(c){throw new Eu(`Invalid token specified: invalid json for part #${n+1} (${c.message})`)}}const hk="0123456789ABCDEFGHJKMNPQRSTVWXYZ",Lh=32,n$=16,pk=10,ux=0xffffffffffff;var Ga;(function(t){t.Base32IncorrectEncoding="B32_ENC_INVALID",t.DecodeTimeInvalidCharacter="DEC_TIME_CHAR",t.DecodeTimeValueMalformed="DEC_TIME_MALFORMED",t.EncodeTimeNegative="ENC_TIME_NEG",t.EncodeTimeSizeExceeded="ENC_TIME_SIZE_EXCEED",t.EncodeTimeValueMalformed="ENC_TIME_MALFORMED",t.PRNGDetectFailure="PRNG_DETECT",t.ULIDInvalid="ULID_INVALID",t.Unexpected="UNEXPECTED",t.UUIDInvalid="UUID_INVALID"})(Ga||(Ga={}));class ju extends Error{constructor(e,n){super(`${n} (${e})`),this.name="ULIDError",this.code=e}}function r$(t){const e=Math.floor(t()*Lh)%Lh;return hk.charAt(e)}function s$(t){const e=i$(),n=e&&(e.crypto||e.msCrypto)||null;if(typeof(n==null?void 0:n.getRandomValues)=="function")return()=>{const r=new Uint8Array(1);return n.getRandomValues(r),r[0]/255};if(typeof(n==null?void 0:n.randomBytes)=="function")return()=>n.randomBytes(1).readUInt8()/255;throw new ju(Ga.PRNGDetectFailure,"Failed to find a reliable PRNG")}function i$(){return l$()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function o$(t,e){let n="";for(;t>0;t--)n=r$(e)+n;return n}function a$(t,e=pk){if(isNaN(t))throw new ju(Ga.EncodeTimeValueMalformed,`Time must be a number: ${t}`);if(t>ux)throw new ju(Ga.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${ux}: ${t}`);if(t<0)throw new ju(Ga.EncodeTimeNegative,`Time must be positive: ${t}`);if(Number.isInteger(t)===!1)throw new ju(Ga.EncodeTimeValueMalformed,`Time must be an integer: ${t}`);let n,r="";for(let s=e;s>0;s--)n=t%Lh,r=hk.charAt(n)+r,t=(t-n)/Lh;return r}function l$(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function c$(t,e){const n=s$(),r=Date.now();return a$(r,pk)+o$(n$,n)}const mk=B.createContext(void 0),Ui=()=>{console.log("CODE WAS MODIFIED useSettings");const t=B.useContext(mk);if(!t)throw new Error("useSettings must be used within a SettingsProvider");return t},u$=({children:t,requireAuth:e,webApp:n})=>{const[r,s]=B.useState(null),c=B.useMemo(()=>{const h=Wg();if(!h)return"unauthenticated";let p;try{return p=fk(h),p.email||p.sub||"unauthenticated"}catch(v){return console.error("Error decoding token",v),"unauthenticated"}},[]),i=B.useMemo(()=>{const h=window.location.hostname==="localhost",p=window.location.protocol==="http:",v=window.location.port==="4173"||window.location.port==="5173",m=h&&p&&v;let b=new URL(window.location.href);n!=null&&n.runner&&(b=new URL(n.runner));const y={requireAuth:!1,agentEndpoint:m?"http://localhost:8080":window.location.origin,webApp:{runner:m?"ws://localhost:8080/ws":`${b.protocol==="https:"?"wss:":"ws:"}//${b.host}/ws`,reconnect:(n==null?void 0:n.reconnect)??!0,invertedOrder:(n==null?void 0:n.invertedOrder)??!1}};return e!==void 0&&(y.requireAuth=e),y},[e,n]),[o,u]=B.useState(()=>{const h=localStorage.getItem("cloudAssistantSettings"),p=h?JSON.parse(h):{};return p&&p.webApp&&p.webApp.reconnect!==void 0&&(p.webApp.reconnect=i.webApp.reconnect),h?{...i,...p}:i});B.useEffect(()=>{localStorage.setItem("cloudAssistantSettings",JSON.stringify(o))},[o]);const l=B.useCallback(h=>{const p=v=>{const m=xn.from(v);m.code===ln.Unauthenticated&&(window.location.href=`/login?error=${encodeURIComponent(m.name)}&error_description=${encodeURIComponent(m.message)}`)};return[v=>async m=>{const b=Wg();return b&&m.header.set("Authorization",`Bearer ${b}`),h?v(m).catch(y=>{throw p(y),y}):v(m)}]},[]),a=B.useCallback(async()=>{if(!o.webApp.runner)return;s(null);const h=new uk({knownID:`check_${c$()}`,runID:dk(),sequence:0,options:{runnerEndpoint:o.webApp.runner,interceptors:l(!1),autoReconnect:!1}}),p=[];return p.push(h.errors.subscribe({next:v=>s(v)})),p.push(h.connect(ck.INITIAL).subscribe(v=>{v!==null&&(console.log(`Initial heartbeat latency for streamID ${v.streamID} (${v.readyState===1?"open":"closed"}): ${v.latency}ms`),h.close())})),()=>{p.forEach(v=>v.unsubscribe())}},[l,o.webApp.runner]);B.useEffect(()=>{a()},[a]);const d=h=>{u(p=>({...p,...h,webApp:{...p.webApp,...h.webApp}}))};return ie.jsx(mk.Provider,{value:{principal:c,checkRunnerAuth:a,createAuthInterceptors:l,defaultSettings:i,runnerError:r,settings:o,updateSettings:d},children:t})},vk=B.createContext(void 0),d$=()=>{const t=B.useContext(vk);if(!t)throw new Error("useClient must be used within a ClientProvider");return t},f$=({children:t})=>{const[e,n]=B.useState(),{settings:r,createAuthInterceptors:s}=Ui();return B.useEffect(()=>{n(h$(r.agentEndpoint,s(!0)))},[r.agentEndpoint,s]),ie.jsx(vk.Provider,{value:{client:e,setClient:n},children:t})};function h$(t,e){console.log("code modified"),console.log(`initializing the client: baseURL ${t}`);const n=n5({baseUrl:t,interceptors:e});return K3(r7,n)}const gk=B.createContext(void 0),xo=()=>{const t=B.useContext(gk);if(!t)throw new Error("useCell must be used within a CellProvider");return t};function dx(t,e){if(!t)return[];const n=t.positions.map(r=>{const s=t.cells[r];return s.languageId="sh",s});return n.length===0?[]:e?n.reverse():n}const p$=({children:t})=>{const{settings:e,createAuthInterceptors:n,principal:r}=Ui(),[s,c]=B.useState(0),[i,o]=B.useState(!1),[u,l]=B.useState(!1),[a,d]=B.useState(),h=B.useMemo(()=>{console.log("CODE WAS MODIFIED runnerConnectEndpoint",e.webApp.runner);const G=new URL(e.webApp.runner);return G.protocol==="ws:"?G.protocol="http:":G.protocol="https:",G.pathname="",G.toString()},[e.webApp.runner]),p=B.useMemo(()=>{if(r)return new YD("agent",r,e2(F7,h,n(!0)))},[e.agentEndpoint,r]),v=B.useMemo(()=>e.webApp.invertedOrder,[e.webApp.invertedOrder]),{client:m}=d$(),[b,y]=B.useState(void 0),_=B.useCallback(()=>{if(!b)return;const G=dx(b,v),ne=tn(IS,{cells:G});a&&(ne.metadata[Fg.PreviousResponseId]=a),p==null||p.saveNotebook(b.runmeSession,ne)},[b,v,a,p]),S=B.useCallback(async({attemptRestore:G})=>{if(!p)return;c(0),d(void 0);const ne=p.createSession();let U;if(!G)U=await ne;else{const H=await p.listActiveSessions(),Y=(await p.loadSessions(H)).filter(W=>W.data.cells.length!==0);if(Y.length===0)U=await ne;else{const W=Y[0];let F=W.data.cells.map(le=>le.refId);v&&(F=F.reverse());const ae=W.data.metadata[Fg.PreviousResponseId];ae&&d(ae),y({runmeSession:W.id,cells:W.data.cells.reduce((le,ee)=>(le[ee.refId]=ee,le),{}),positions:F});return}}y({runmeSession:U,cells:{},positions:[]})},[v,p]);B.useEffect(()=>{_()},[b,p,v,_]),B.useEffect(()=>{y(G=>({runmeSession:(G==null?void 0:G.runmeSession)??"",cells:(G==null?void 0:G.cells)??{},positions:[...(G==null?void 0:G.positions)??[]].reverse()}))},[v]),B.useEffect(()=>{S&&S({attemptRestore:!0})},[S]);const C=B.useMemo(()=>b?b.positions.map(G=>b.cells[G]).filter(G=>!!G&&(G.kind===Hs.MARKUP||G.kind===Hs.CODE)):[],[b]),x=B.useMemo(()=>b?b.positions.map(G=>b.cells[G]).filter(G=>!!G&&G.kind===Hs.CODE):[],[b]),j=B.useMemo(()=>b?b.positions.map(G=>b.cells[G]).filter(G=>!!G&&G.kind===Hs.DOC_RESULTS):[],[b]),k=()=>({chat:C,actions:x,files:j}),A=G=>IL(Iu,G),N=async G=>{const ne=eM(),U=tn(n7,{cells:G,previousResponseId:a});U.openaiAccessToken=ne.accessToken,ne.accessToken||console.error("No access token found");try{const H=m.generate(U);for await(const R of H){for(const Y of R.cells)l(!1),$(Y);d(R.responseId)}}catch(H){console.log(H)}finally{l(!1),o(!1)}},D=async G=>{if(!G.trim())return;const ne=tn(Iu,{refId:`user_${BS()}`,role:bo.USER,kind:Hs.MARKUP,value:G});$(ne),o(!0),l(!0),await N([ne])},M=async G=>{G.outputs.length!==0&&(console.log("sending output cell",G.refId,"previousResponseId",a),o(!0),l(!0),await N([G]))},$=G=>{y(ne=>{if(ne){if(!ne.cells[G.refId]){const U=v?[G.refId,...ne.positions]:[...ne.positions,G.refId];return{runmeSession:ne.runmeSession,cells:{...ne.cells,[G.refId]:G},positions:U}}return{...ne,runmeSession:ne.runmeSession,cells:{...ne.cells,[G.refId]:G}}}})},X=()=>{const G=`code_${BS().replace(/-/g,"")}`,ne=tn(Iu,{metadata:{[cs.ID]:G,[cs.RunmeID]:G},refId:G,role:bo.USER,kind:Hs.CODE,value:""});$(ne)},Q=G=>{if(!x.find(H=>H.refId===G.refId))return;const U=new CustomEvent("runCodeCell",{detail:{cellId:G.refId}});G.executionSummary=void 0,G.outputs=[],c(H=>{const R=H+1;return G.metadata[cs.Sequence]=R.toString(),R}),window.dispatchEvent(U)},te=async({asSessionRecord:G})=>{var ee;const ne=dx(b,v);if(!b||ne.length===0)return;const U=tn(IS,{cells:ne}),H=e2(t7,e.agentEndpoint),R=tn(JL,{notebook:U,options:tn(qL,{outputs:tn(XL,{enabled:!1,summary:!1})})});G&&((ee=R.options)!=null&&ee.outputs)&&(R.options.outputs.enabled=!0,R.options.outputs.summary=!0,R.options.session=tn(YL,{id:b.runmeSession}));const Y=await H.serialize(R),W=new Blob([Y.result],{type:"text/plain"}),F=URL.createObjectURL(W),ae=document.createElement("a");ae.href=F;const le=G?"Session":"Notebook";ae.download=`${le}-${a5()}.md`,document.body.appendChild(ae),ae.click(),document.body.removeChild(ae),URL.revokeObjectURL(F)};return ie.jsx(gk.Provider,{value:{useColumns:k,sequence:s,saveState:_,exportDocument:te,sendOutputCell:M,createOutputCell:A,sendUserCell:D,addCodeCell:X,isInputDisabled:i,isTyping:u,runCodeCell:Q,resetSession:S},children:t})},fx=new TextEncoder;function m$({pid:t,exitCode:e},n,r,s){let c;return t!==null&&e!==null&&(c=tn(ZL,{pid:BigInt(t),exitReason:tn(WL,{type:"exit",code:e})})),[tn(RS,{items:[tn(OS,{mime:jh.VSCodeNotebookStdOut,type:"Buffer",data:fx.encode(n)})],processInfo:c}),tn(RS,{items:[tn(OS,{mime:jh.VSCodeNotebookStdErr,type:"Buffer",data:fx.encode(r)})]})]}const v$=tn(Iu,{kind:Hs.MARKUP,role:bo.ASSISTANT,value:"..."}),eb={fontSize:14,fontFamily:"monospace"},g$=new TextDecoder,b$=B.memo(JB,(t,e)=>t.cellID===e.cellID&&t.runID===e.runID),y$=({cell:t,onExitCode:e,onPid:n})=>{const{createAuthInterceptors:r,settings:{webApp:s}}=Ui(),{sendOutputCell:c,saveState:i}=xo(),o=s.invertedOrder,[u,l]=B.useState(!1),[a,d]=B.useState({value:"",runID:""}),[h,p]=B.useState(null),[v,m]=B.useState(null),[b,y]=B.useState(null),[_,S]=B.useState(null),[C,x]=B.useState(""),[j,k]=B.useState(""),[A,N]=B.useState(""),D=B.useMemo(()=>Number(t.metadata[cs.Sequence]??0),[t,v,b]),M=B.useCallback((le=!1)=>{p(BigInt(Date.now())),x(""),k(""),m(null),y(null),l(le),d({value:t.value,runID:dk()})},[t]),$=B.useMemo(()=>({...eb,className:"rounded-md overflow-hidden",rows:14,scrollToFit:!o,takeFocus:u}),[o,u]);B.useEffect(()=>{const le=ee=>{ee.detail.cellId===t.refId&&M()};return window.addEventListener("runCodeCell",le),()=>{window.removeEventListener("runCodeCell",le)}},[t.refId,M]);const X=B.useMemo(()=>m$({pid:v,exitCode:b},C,j),[v,b,C,j,_]);B.useEffect(()=>{h!==null&&(t.outputs=X,t.executionSummary=tn(KL,{timing:tn(GL,{startTime:h,endTime:BigInt(Date.now())}),executionOrder:D,success:Number.isFinite(b)&&b===0}))},[t,X,b,D,h]);const Q=B.useMemo(()=>v===null||b===null||a.runID===""||!Number.isFinite(v)||!Number.isInteger(b)?null:t,[t,a.runID,b,v]);B.useEffect(()=>{!Q||A===a.runID||(N(a.runID),c(Q))},[c,Q,a.runID,A]),B.useEffect(()=>{v!==null&&n(v)},[v,n]),B.useEffect(()=>{b!==null&&e(b)},[b,e]),B.useEffect(()=>{t.kind===Hs.CODE&&(a.runID!==""&&(t.metadata[cs.LastRunID]=a.runID),v?t.metadata[cs.Pid]=v.toString():delete t.metadata[cs.Pid],b!==null&&Number.isFinite(b)?(delete t.metadata[cs.Pid],t.metadata[cs.ExitCode]=b.toString()):delete t.metadata[cs.ExitCode],i())},[v,b,t,i,a.runID]);const te=B.useMemo(()=>{if(t.kind!==Hs.CODE||A!=="")return;const le=t.outputs.flatMap(ee=>ee.items).find(ee=>ee.mime===jh.VSCodeNotebookStdOut);if(le)return g$.decode(le.data)},[t.kind,t.outputs,A]),G=B.useMemo(()=>{var ee;return((ee=t.metadata)==null?void 0:ee[cs.Pid])??""?t.metadata[cs.LastRunID]??"":""},[t.metadata]),ne=B.useMemo(()=>a.value===""||a.runID===""?[]:a.value.split(`
|
|
6659
|
+
`):"",this.name="UnsubscriptionError",this.errors=e}});function Rh(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var _d=function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,n,r,s,c;if(!this.closed){this.closed=!0;var i=this._parentage;if(i)if(this._parentage=null,Array.isArray(i))try{for(var o=oc(i),u=o.next();!u.done;u=o.next()){var l=u.value;l.remove(this)}}catch(m){e={error:m}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}else i.remove(this);var a=this.initialTeardown;if(Cn(a))try{a()}catch(m){c=m instanceof qv?m.errors:[m]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var h=oc(d),p=h.next();!p.done;p=h.next()){var v=p.value;try{X2(v)}catch(m){c=c??[],m instanceof qv?c=da(da([],yo(c)),yo(m.errors)):c.push(m)}}}catch(m){r={error:m}}finally{try{p&&!p.done&&(s=h.return)&&s.call(h)}finally{if(r)throw r.error}}}if(c)throw new qv(c)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)X2(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(e)}},t.prototype._hasParent=function(e){var n=this._parentage;return n===e||Array.isArray(n)&&n.includes(e)},t.prototype._addParent=function(e){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(e),n):n?[n,e]:e},t.prototype._removeParent=function(e){var n=this._parentage;n===e?this._parentage=null:Array.isArray(n)&&Rh(n,e)},t.prototype.remove=function(e){var n=this._finalizers;n&&Rh(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),V5=_d.EMPTY;function F5(t){return t instanceof _d||t&&"closed"in t&&Cn(t.remove)&&Cn(t.add)&&Cn(t.unsubscribe)}function X2(t){Cn(t)?t():t.unsubscribe()}var IP={Promise:void 0},OP={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,da([t,e],yo(n)))},clearTimeout:function(t){return clearTimeout(t)},delegate:void 0};function z5(t){OP.setTimeout(function(){throw t})}function rd(){}function lh(t){t()}var B0=function(t){ma(e,t);function e(n){var r=t.call(this)||this;return r.isStopped=!1,n?(r.destination=n,F5(n)&&n.add(r)):r.destination=LP,r}return e.create=function(n,r,s){return new sd(n,r,s)},e.prototype.next=function(n){this.isStopped||this._next(n)},e.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(n){this.destination.next(n)},e.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(_d),RP=function(){function t(e){this.partialObserver=e}return t.prototype.next=function(e){var n=this.partialObserver;if(n.next)try{n.next(e)}catch(r){zf(r)}},t.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(r){zf(r)}else zf(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(n){zf(n)}},t}(),sd=function(t){ma(e,t);function e(n,r,s){var c=t.call(this)||this,i;return Cn(n)||!n?i={next:n??void 0,error:r??void 0,complete:s??void 0}:i=n,c.destination=new RP(i),c}return e}(B0);function zf(t){z5(t)}function NP(t){throw t}var LP={closed:!0,next:rd,error:NP,complete:rd},$0=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function yp(t){return t}function DP(t){return t.length===0?yp:t.length===1?t[0]:function(e){return t.reduce(function(n,r){return r(n)},e)}}var ur=function(){function t(e){e&&(this._subscribe=e)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(e,n,r){var s=this,c=PP(e)?e:new sd(e,n,r);return lh(function(){var i=s,o=i.operator,u=i.source;c.add(o?o.call(c,u):u?s._subscribe(c):s._trySubscribe(c))}),c},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(n){e.error(n)}},t.prototype.forEach=function(e,n){var r=this;return n=q2(n),new n(function(s,c){var i=new sd({next:function(o){try{e(o)}catch(u){c(u),i.unsubscribe()}},error:c,complete:s});r.subscribe(i)})},t.prototype._subscribe=function(e){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(e)},t.prototype[$0]=function(){return this},t.prototype.pipe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return DP(e)(this)},t.prototype.toPromise=function(e){var n=this;return e=q2(e),new e(function(r,s){var c;n.subscribe(function(i){return c=i},function(i){return s(i)},function(){return r(c)})})},t.create=function(e){return new t(e)},t}();function q2(t){var e;return(e=t??IP.Promise)!==null&&e!==void 0?e:Promise}function MP(t){return t&&Cn(t.next)&&Cn(t.error)&&Cn(t.complete)}function PP(t){return t&&t instanceof B0||MP(t)&&F5(t)}function BP(t){return Cn(t==null?void 0:t.lift)}function $r(t){return function(e){if(BP(e))return e.lift(function(n){try{return t(n,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function nr(t,e,n,r,s){return new $P(t,e,n,r,s)}var $P=function(t){ma(e,t);function e(n,r,s,c,i,o){var u=t.call(this,n)||this;return u.onFinalize=i,u.shouldUnsubscribe=o,u._next=r?function(l){try{r(l)}catch(a){n.error(a)}}:t.prototype._next,u._error=c?function(l){try{c(l)}catch(a){n.error(a)}finally{this.unsubscribe()}}:t.prototype._error,u._complete=s?function(){try{s()}catch(l){n.error(l)}finally{this.unsubscribe()}}:t.prototype._complete,u}return e.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;t.prototype.unsubscribe.call(this),!r&&((n=this.onFinalize)===null||n===void 0||n.call(this))}},e}(B0),UP=U5(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),zs=function(t){ma(e,t);function e(){var n=t.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return e.prototype.lift=function(n){var r=new J2(this,this);return r.operator=n,r},e.prototype._throwIfClosed=function(){if(this.closed)throw new UP},e.prototype.next=function(n){var r=this;lh(function(){var s,c;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var i=oc(r.currentObservers),o=i.next();!o.done;o=i.next()){var u=o.value;u.next(n)}}catch(l){s={error:l}}finally{try{o&&!o.done&&(c=i.return)&&c.call(i)}finally{if(s)throw s.error}}}})},e.prototype.error=function(n){var r=this;lh(function(){if(r._throwIfClosed(),!r.isStopped){r.hasError=r.isStopped=!0,r.thrownError=n;for(var s=r.observers;s.length;)s.shift().error(n)}})},e.prototype.complete=function(){var n=this;lh(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var r=n.observers;r.length;)r.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(n){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,n)},e.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},e.prototype._innerSubscribe=function(n){var r=this,s=this,c=s.hasError,i=s.isStopped,o=s.observers;return c||i?V5:(this.currentObservers=null,o.push(n),new _d(function(){r.currentObservers=null,Rh(o,n)}))},e.prototype._checkFinalizedStatuses=function(n){var r=this,s=r.hasError,c=r.thrownError,i=r.isStopped;s?n.error(c):i&&n.complete()},e.prototype.asObservable=function(){var n=new ur;return n.source=this,n},e.create=function(n,r){return new J2(n,r)},e}(ur),J2=function(t){ma(e,t);function e(n,r){var s=t.call(this)||this;return s.destination=n,s.source=r,s}return e.prototype.next=function(n){var r,s;(s=(r=this.destination)===null||r===void 0?void 0:r.next)===null||s===void 0||s.call(r,n)},e.prototype.error=function(n){var r,s;(s=(r=this.destination)===null||r===void 0?void 0:r.error)===null||s===void 0||s.call(r,n)},e.prototype.complete=function(){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||r===void 0||r.call(n)},e.prototype._subscribe=function(n){var r,s;return(s=(r=this.source)===null||r===void 0?void 0:r.subscribe(n))!==null&&s!==void 0?s:V5},e}(zs),VP={now:function(){return Date.now()}},FP=function(t){ma(e,t);function e(n,r){return t.call(this)||this}return e.prototype.schedule=function(n,r){return this},e}(_d),Q2={setInterval:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,da([t,e],yo(n)))},clearInterval:function(t){return clearInterval(t)},delegate:void 0},zP=function(t){ma(e,t);function e(n,r){var s=t.call(this,n,r)||this;return s.scheduler=n,s.work=r,s.pending=!1,s}return e.prototype.schedule=function(n,r){var s;if(r===void 0&&(r=0),this.closed)return this;this.state=n;var c=this.id,i=this.scheduler;return c!=null&&(this.id=this.recycleAsyncId(i,c,r)),this.pending=!0,this.delay=r,this.id=(s=this.id)!==null&&s!==void 0?s:this.requestAsyncId(i,this.id,r),this},e.prototype.requestAsyncId=function(n,r,s){return s===void 0&&(s=0),Q2.setInterval(n.flush.bind(n,this),s)},e.prototype.recycleAsyncId=function(n,r,s){if(s===void 0&&(s=0),s!=null&&this.delay===s&&this.pending===!1)return r;r!=null&&Q2.clearInterval(r)},e.prototype.execute=function(n,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var s=this._execute(n,r);if(s)return s;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(n,r){var s=!1,c;try{this.work(n)}catch(i){s=!0,c=i||new Error("Scheduled action threw falsy error")}if(s)return this.unsubscribe(),c},e.prototype.unsubscribe=function(){if(!this.closed){var n=this,r=n.id,s=n.scheduler,c=s.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Rh(c,this),r!=null&&(this.id=this.recycleAsyncId(s,r,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(FP),ex=function(){function t(e,n){n===void 0&&(n=t.now),this.schedulerActionCtor=e,this.now=n}return t.prototype.schedule=function(e,n,r){return n===void 0&&(n=0),new this.schedulerActionCtor(this,e).schedule(r,n)},t.now=VP.now,t}(),HP=function(t){ma(e,t);function e(n,r){r===void 0&&(r=ex.now);var s=t.call(this,n,r)||this;return s.actions=[],s._active=!1,s}return e.prototype.flush=function(n){var r=this.actions;if(this._active){r.push(n);return}var s;this._active=!0;do if(s=n.execute(n.state,n.delay))break;while(n=r.shift());if(this._active=!1,s){for(;n=r.shift();)n.unsubscribe();throw s}},e}(ex),_p=new HP(zP),GP=_p,H5=new ur(function(t){return t.complete()});function G5(t){return t&&Cn(t.schedule)}function U0(t){return t[t.length-1]}function WP(t){return Cn(U0(t))?t.pop():void 0}function W5(t){return G5(U0(t))?t.pop():void 0}function ZP(t,e){return typeof U0(t)=="number"?t.pop():e}var V0=function(t){return t&&typeof t.length=="number"&&typeof t!="function"};function Z5(t){return Cn(t==null?void 0:t.then)}function K5(t){return Cn(t[$0])}function Y5(t){return Symbol.asyncIterator&&Cn(t==null?void 0:t[Symbol.asyncIterator])}function X5(t){return new TypeError("You provided "+(t!==null&&typeof t=="object"?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function KP(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var q5=KP();function J5(t){return Cn(t==null?void 0:t[q5])}function Q5(t){return TP(this,arguments,function(){var e,n,r,s;return $5(this,function(c){switch(c.label){case 0:e=t.getReader(),c.label=1;case 1:c.trys.push([1,,9,10]),c.label=2;case 2:return[4,Gl(e.read())];case 3:return n=c.sent(),r=n.value,s=n.done,s?[4,Gl(void 0)]:[3,5];case 4:return[2,c.sent()];case 5:return[4,Gl(r)];case 6:return[4,c.sent()];case 7:return c.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}})})}function ek(t){return Cn(t==null?void 0:t.getReader)}function Ir(t){if(t instanceof ur)return t;if(t!=null){if(K5(t))return YP(t);if(V0(t))return XP(t);if(Z5(t))return qP(t);if(Y5(t))return tk(t);if(J5(t))return JP(t);if(ek(t))return QP(t)}throw X5(t)}function YP(t){return new ur(function(e){var n=t[$0]();if(Cn(n.subscribe))return n.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function XP(t){return new ur(function(e){for(var n=0;n<t.length&&!e.closed;n++)e.next(t[n]);e.complete()})}function qP(t){return new ur(function(e){t.then(function(n){e.closed||(e.next(n),e.complete())},function(n){return e.error(n)}).then(null,z5)})}function JP(t){return new ur(function(e){var n,r;try{for(var s=oc(t),c=s.next();!c.done;c=s.next()){var i=c.value;if(e.next(i),e.closed)return}}catch(o){n={error:o}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}e.complete()})}function tk(t){return new ur(function(e){eB(t,e).catch(function(n){return e.error(n)})})}function QP(t){return tk(Q5(t))}function eB(t,e){var n,r,s,c;return kP(this,void 0,void 0,function(){var i,o;return $5(this,function(u){switch(u.label){case 0:u.trys.push([0,5,6,11]),n=AP(t),u.label=1;case 1:return[4,n.next()];case 2:if(r=u.sent(),!!r.done)return[3,4];if(i=r.value,e.next(i),e.closed)return[2];u.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return o=u.sent(),s={error:o},[3,11];case 6:return u.trys.push([6,,9,10]),r&&!r.done&&(c=n.return)?[4,c.call(n)]:[3,8];case 7:u.sent(),u.label=8;case 8:return[3,10];case 9:if(s)throw s.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function Wa(t,e,n,r,s){r===void 0&&(r=0),s===void 0&&(s=!1);var c=e.schedule(function(){n(),s?t.add(this.schedule(null,r)):this.unsubscribe()},r);if(t.add(c),!s)return c}function nk(t,e){return e===void 0&&(e=0),$r(function(n,r){n.subscribe(nr(r,function(s){return Wa(r,t,function(){return r.next(s)},e)},function(){return Wa(r,t,function(){return r.complete()},e)},function(s){return Wa(r,t,function(){return r.error(s)},e)}))})}function rk(t,e){return e===void 0&&(e=0),$r(function(n,r){r.add(t.schedule(function(){return n.subscribe(r)},e))})}function tB(t,e){return Ir(t).pipe(rk(e),nk(e))}function nB(t,e){return Ir(t).pipe(rk(e),nk(e))}function rB(t,e){return new ur(function(n){var r=0;return e.schedule(function(){r===t.length?n.complete():(n.next(t[r++]),n.closed||this.schedule())})})}function sB(t,e){return new ur(function(n){var r;return Wa(n,e,function(){r=t[q5](),Wa(n,e,function(){var s,c,i;try{s=r.next(),c=s.value,i=s.done}catch(o){n.error(o);return}i?n.complete():n.next(c)},0,!0)}),function(){return Cn(r==null?void 0:r.return)&&r.return()}})}function sk(t,e){if(!t)throw new Error("Iterable cannot be null");return new ur(function(n){Wa(n,e,function(){var r=t[Symbol.asyncIterator]();Wa(n,e,function(){r.next().then(function(s){s.done?n.complete():n.next(s.value)})},0,!0)})})}function iB(t,e){return sk(Q5(t),e)}function oB(t,e){if(t!=null){if(K5(t))return tB(t,e);if(V0(t))return rB(t,e);if(Z5(t))return nB(t,e);if(Y5(t))return sk(t,e);if(J5(t))return sB(t,e);if(ek(t))return iB(t,e)}throw X5(t)}function ik(t,e){return e?oB(t,e):Ir(t)}function aB(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=W5(t);return ik(t,n)}function lB(t){return t instanceof Date&&!isNaN(t)}function Fs(t,e){return $r(function(n,r){var s=0;n.subscribe(nr(r,function(c){r.next(t.call(e,c,s++))}))})}var cB=Array.isArray;function uB(t,e){return cB(e)?t.apply(void 0,da([],yo(e))):t(e)}function dB(t){return Fs(function(e){return uB(t,e)})}function fB(t,e,n,r,s,c,i,o){var u=[],l=0,a=0,d=!1,h=function(){d&&!u.length&&!l&&e.complete()},p=function(m){return l<r?v(m):u.push(m)},v=function(m){l++;var b=!1;Ir(n(m,a++)).subscribe(nr(e,function(y){e.next(y)},function(){b=!0},void 0,function(){if(b)try{l--;for(var y=function(){var _=u.shift();i||v(_)};u.length&&l<r;)y();h()}catch(_){e.error(_)}}))};return t.subscribe(nr(e,p,function(){d=!0,h()})),function(){}}function za(t,e,n){return n===void 0&&(n=1/0),Cn(e)?za(function(r,s){return Fs(function(c,i){return e(r,c,s,i)})(Ir(t(r,s)))},n):(typeof e=="number"&&(n=e),$r(function(r,s){return fB(r,s,t,n)}))}function hB(t){return t===void 0&&(t=1/0),za(yp,t)}function pB(t){return new ur(function(e){Ir(t()).subscribe(e)})}var mB={connector:function(){return new zs},resetOnDisconnect:!0};function Ua(t,e){e===void 0&&(e=mB);var n=null,r=e.connector,s=e.resetOnDisconnect,c=s===void 0?!0:s,i=r(),o=new ur(function(u){return i.subscribe(u)});return o.connect=function(){return(!n||n.closed)&&(n=pB(function(){return t}).subscribe(i),c&&n.add(function(){return i=r()})),n},o}var vB=["addListener","removeListener"],gB=["addEventListener","removeEventListener"],bB=["on","off"];function Qg(t,e,n,r){if(Cn(n)&&(r=n,n=void 0),r)return Qg(t,e,n).pipe(dB(r));var s=yo(wB(t)?gB.map(function(o){return function(u){return t[o](e,u,n)}}):yB(t)?vB.map(tx(t,e)):_B(t)?bB.map(tx(t,e)):[],2),c=s[0],i=s[1];if(!c&&V0(t))return za(function(o){return Qg(o,e,n)})(Ir(t));if(!c)throw new TypeError("Invalid event target");return new ur(function(o){var u=function(){for(var l=[],a=0;a<arguments.length;a++)l[a]=arguments[a];return o.next(1<l.length?l:l[0])};return c(u),function(){return i(u)}})}function tx(t,e){return function(n){return function(r){return t[n](e,r)}}}function yB(t){return Cn(t.addListener)&&Cn(t.removeListener)}function _B(t){return Cn(t.on)&&Cn(t.off)}function wB(t){return Cn(t.addEventListener)&&Cn(t.removeEventListener)}function Lu(t,e,n){t===void 0&&(t=0),n===void 0&&(n=GP);var r=-1;return e!=null&&(G5(e)?n=e:r=e),new ur(function(s){var c=lB(t)?+t-n.now():t;c<0&&(c=0);var i=0;return n.schedule(function(){s.closed||(s.next(i++),0<=r?this.schedule(void 0,r):s.complete())},c)})}function SB(t,e){return e===void 0&&(e=_p),Lu(t,t,e)}function xB(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=W5(t),r=ZP(t,1/0),s=t;return s.length?s.length===1?Ir(s[0]):hB(r)(ik(s,n)):H5}var CB=Array.isArray;function EB(t){return t.length===1&&CB(t[0])?t[0]:t}function na(t,e){return $r(function(n,r){var s=0;n.subscribe(nr(r,function(c){return t.call(e,c,s++)&&r.next(c)}))})}function jB(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t=EB(t),t.length===1?Ir(t[0]):new ur(kB(t))}function kB(t){return function(e){for(var n=[],r=function(c){n.push(Ir(t[c]).subscribe(nr(e,function(i){if(n){for(var o=0;o<n.length;o++)o!==c&&n[o].unsubscribe();n=null}e.next(i)})))},s=0;n&&!e.closed&&s<t.length;s++)r(s)}}function TB(t){return $r(function(e,n){var r=null,s=null,c=function(){s==null||s.unsubscribe();var i=r;r=[],i&&n.next(i),Ir(t()).subscribe(s=nr(n,c,rd))};c(),e.subscribe(nr(n,function(i){return r==null?void 0:r.push(i)},function(){r&&n.next(r),n.complete()},void 0,function(){return r=s=null}))})}function ok(t){return $r(function(e,n){var r=null,s=!1,c;r=e.subscribe(nr(n,void 0,void 0,function(i){c=Ir(t(i,ok(t)(e))),r?(r.unsubscribe(),r=null,c.subscribe(n)):s=!0})),s&&(r.unsubscribe(),r=null,c.subscribe(n))})}function AB(t,e,n,r,s){return function(c,i){var o=n,u=e,l=0;c.subscribe(nr(i,function(a){var d=l++;u=o?t(u,a,d):(o=!0,a),i.next(u)},s))}}function nx(t){return t<=0?function(){return H5}:$r(function(e,n){var r=0;e.subscribe(nr(n,function(s){++r<=t&&(n.next(s),t<=r&&n.complete())}))})}function IB(t){return $r(function(e,n){try{e.subscribe(n)}finally{n.add(t)}})}function OB(t,e){return $r(AB(t,e,arguments.length>=2,!0))}function RB(t){t===void 0&&(t={});var e=t.connector,n=e===void 0?function(){return new zs}:e,r=t.resetOnError,s=r===void 0?!0:r,c=t.resetOnComplete,i=c===void 0?!0:c,o=t.resetOnRefCountZero,u=o===void 0?!0:o;return function(l){var a,d,h,p=0,v=!1,m=!1,b=function(){d==null||d.unsubscribe(),d=void 0},y=function(){b(),a=h=void 0,v=m=!1},_=function(){var S=a;y(),S==null||S.unsubscribe()};return $r(function(S,C){p++,!m&&!v&&b();var x=h=h??n();C.add(function(){p--,p===0&&!m&&!v&&(d=Jv(_,u))}),x.subscribe(C),!a&&p>0&&(a=new sd({next:function(j){return x.next(j)},error:function(j){m=!0,b(),d=Jv(y,s,j),x.error(j)},complete:function(){v=!0,b(),d=Jv(y,i),x.complete()}}),Ir(S).subscribe(a))})(l)}}function Jv(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(e===!0){t();return}if(e!==!1){var s=new sd({next:function(){s.unsubscribe(),t()}});return Ir(e.apply(void 0,da([],yo(n)))).subscribe(s)}}function NB(t){return $r(function(e,n){var r=!1,s=nr(n,function(){s==null||s.unsubscribe(),r=!0},rd);Ir(t).subscribe(s),e.subscribe(nr(n,function(c){return r&&n.next(c)}))})}function rx(t,e){return $r(function(n,r){var s=null,c=0,i=!1,o=function(){return i&&!s&&r.complete()};n.subscribe(nr(r,function(u){s==null||s.unsubscribe();var l=0,a=c++;Ir(t(u,a)).subscribe(s=nr(r,function(d){return r.next(e?e(u,d,a,l++):d)},function(){s=null,o()}))},function(){i=!0,o()}))})}function Hf(t,e){return e===void 0&&(e=!1),$r(function(n,r){var s=0;n.subscribe(nr(r,function(c){var i=t(c,s++);(i||e)&&r.next(c),!i&&r.complete()}))})}function LB(t,e,n){var r=Cn(t)||e||n?{next:t,error:e,complete:n}:t;return r?$r(function(s,c){var i;(i=r.subscribe)===null||i===void 0||i.call(r);var o=!0;s.subscribe(nr(c,function(u){var l;(l=r.next)===null||l===void 0||l.call(r,u),c.next(u)},function(){var u;o=!1,(u=r.complete)===null||u===void 0||u.call(r),c.complete()},function(u){var l;o=!1,(l=r.error)===null||l===void 0||l.call(r,u),c.error(u)},function(){var u,l;o&&((u=r.unsubscribe)===null||u===void 0||u.call(r)),(l=r.finalize)===null||l===void 0||l.call(r)}))}):yp}function DB(t,e){return $r(function(n,r){var s=e??{},c=s.leading,i=c===void 0?!0:c,o=s.trailing,u=o===void 0?!1:o,l=!1,a=null,d=null,h=!1,p=function(){d==null||d.unsubscribe(),d=null,u&&(b(),h&&r.complete())},v=function(){d=null,h&&r.complete()},m=function(y){return d=Ir(t(y)).subscribe(nr(r,p,v))},b=function(){if(l){l=!1;var y=a;a=null,r.next(y),!h&&m(y)}};n.subscribe(nr(r,function(y){l=!0,a=y,!(d&&!d.closed)&&(i?b():m(y))},function(){h=!0,!(u&&l&&d&&!d.closed)&&r.complete()}))})}function sx(t,e,n){e===void 0&&(e=_p);var r=Lu(t,e);return DB(function(){return r},n)}function Qv(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=WP(t);return $r(function(r,s){for(var c=t.length,i=new Array(c),o=t.map(function(){return!1}),u=!1,l=function(d){Ir(t[d]).subscribe(nr(s,function(h){i[d]=h,!u&&!o[d]&&(o[d]=!0,(u=o.every(yp))&&(o=null))},rd))},a=0;a<c;a++)l(a);r.subscribe(nr(s,function(d){if(u){var h=da([d],yo(i));s.next(n?n.apply(void 0,da([],yo(h))):h)}}))})}const ak="0123456789ABCDEFGHJKMNPQRSTVWXYZ",Nh=32,MB=16,lk=10,ix=0xffffffffffff;var Ha;(function(t){t.Base32IncorrectEncoding="B32_ENC_INVALID",t.DecodeTimeInvalidCharacter="DEC_TIME_CHAR",t.DecodeTimeValueMalformed="DEC_TIME_MALFORMED",t.EncodeTimeNegative="ENC_TIME_NEG",t.EncodeTimeSizeExceeded="ENC_TIME_SIZE_EXCEED",t.EncodeTimeValueMalformed="ENC_TIME_MALFORMED",t.PRNGDetectFailure="PRNG_DETECT",t.ULIDInvalid="ULID_INVALID",t.Unexpected="UNEXPECTED",t.UUIDInvalid="UUID_INVALID"})(Ha||(Ha={}));class Cu extends Error{constructor(e,n){super(`${n} (${e})`),this.name="ULIDError",this.code=e}}function PB(t){const e=Math.floor(t()*Nh)%Nh;return ak.charAt(e)}function BB(t){const e=$B(),n=e&&(e.crypto||e.msCrypto)||null;if(typeof(n==null?void 0:n.getRandomValues)=="function")return()=>{const r=new Uint8Array(1);return n.getRandomValues(r),r[0]/255};if(typeof(n==null?void 0:n.randomBytes)=="function")return()=>n.randomBytes(1).readUInt8()/255;throw new Cu(Ha.PRNGDetectFailure,"Failed to find a reliable PRNG")}function $B(){return FB()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function UB(t,e){let n="";for(;t>0;t--)n=PB(e)+n;return n}function VB(t,e=lk){if(isNaN(t))throw new Cu(Ha.EncodeTimeValueMalformed,`Time must be a number: ${t}`);if(t>ix)throw new Cu(Ha.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${ix}: ${t}`);if(t<0)throw new Cu(Ha.EncodeTimeNegative,`Time must be positive: ${t}`);if(Number.isInteger(t)===!1)throw new Cu(Ha.EncodeTimeValueMalformed,`Time must be an integer: ${t}`);let n,r="";for(let s=e;s>0;s--)n=t%Nh,r=ak.charAt(n)+r,t=(t-n)/Nh;return r}function FB(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function zB(t,e){const n=BB(),r=Date.now();return VB(r,lk)+UB(MB,n)}const Pr=[];for(let t=0;t<256;++t)Pr.push((t+256).toString(16).slice(1));function HB(t,e=0){return(Pr[t[e+0]]+Pr[t[e+1]]+Pr[t[e+2]]+Pr[t[e+3]]+"-"+Pr[t[e+4]]+Pr[t[e+5]]+"-"+Pr[t[e+6]]+Pr[t[e+7]]+"-"+Pr[t[e+8]]+Pr[t[e+9]]+"-"+Pr[t[e+10]]+Pr[t[e+11]]+Pr[t[e+12]]+Pr[t[e+13]]+Pr[t[e+14]]+Pr[t[e+15]]).toLowerCase()}let eg;const GB=new Uint8Array(16);function WB(){if(!eg){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");eg=crypto.getRandomValues.bind(crypto)}return eg(GB)}const ZB=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),ox={randomUUID:ZB};function KB(t,e,n){var r;if(ox.randomUUID&&!t)return ox.randomUUID();t=t||{};const s=t.random??((r=t.rng)==null?void 0:r.call(t))??WB();if(s.length<16)throw new Error("Random bytes length must be >= 16");return s[6]=s[6]&15|64,s[8]=s[8]&63|128,HB(s)}const YB=5e3,XB=1e3,Gf=4e3,ax=1e3;var ck=(t=>(t.CONTINUOUS="CONTINUOUS",t.INITIAL="INITIAL",t))(ck||{});class uk{constructor({knownID:e,runID:n,sequence:r,options:s}){Ln(this,"callback"),Ln(this,"queue",new zs),Ln(this,"subscriptions",[]),Ln(this,"reconnect",new zs),Ln(this,"client",new ur),Ln(this,"_latencies",new zs),Ln(this,"_latenciesConnectable",Ua(this._latencies.asObservable().pipe(OB((c,i)=>{if(i.latency<0){const o=c.get(i.streamID);o&&c.set(i.streamID,{...o,readyState:i.readyState})}else c.set(i.streamID,i);return c},new Map)))),Ln(this,"_errors",new zs),Ln(this,"_errorsConnectable",Ua(this._errors.asObservable())),Ln(this,"_stdout",new zs),Ln(this,"_stderr",new zs),Ln(this,"_exitCode",new zs),Ln(this,"_pid",new zs),Ln(this,"_mimeType",new zs),Ln(this,"_stdoutConnectable",Ua(this._stdout.asObservable())),Ln(this,"_stderrConnectable",Ua(this._stderr.asObservable())),Ln(this,"_exitCodeConnectable",Ua(this._exitCode.asObservable())),Ln(this,"_pidConnectable",Ua(this._pid.asObservable())),Ln(this,"_mimeTypeConnectable",Ua(this._mimeType.asObservable())),Ln(this,"knownID"),Ln(this,"runID"),Ln(this,"sequence"),Ln(this,"runnerEndpoint"),Ln(this,"interceptors"),Ln(this,"autoReconnect"),this.knownID=e,this.runID=n,this.sequence=r,this.runnerEndpoint=s.runnerEndpoint,this.interceptors=s.interceptors,this.autoReconnect=s.autoReconnect,this._latenciesConnectable.connect(),this._errorsConnectable.connect(),this._stdoutConnectable.connect(),this._stderrConnectable.connect(),this._exitCodeConnectable.connect(),this._pidConnectable.connect(),this._mimeTypeConnectable.connect(),this.client=this.reconnect.pipe(sx(ax,_p,{leading:!0,trailing:!0}),rx(c=>this.useSocketClient(c.streamID).pipe(rx(i=>this.useHeartbeat(i,c))))).pipe(RB()),this.subscriptions.push(this.monitor()),this.subscriptions.push(this.process())}get latencies(){return this._latenciesConnectable}get errors(){return this._errorsConnectable}get stdout(){return this._stdoutConnectable}get stderr(){return this._stderrConnectable}get exitCode(){return this._exitCodeConnectable}get pid(){return this._pidConnectable}get mimeType(){return this._mimeTypeConnectable}monitor(){return SB(XB).pipe(na(()=>this.autoReconnect),Qv(this.reconnect),na(([,e])=>e.heartbeat==="CONTINUOUS"),Qv(this.latencies),Fs(([,e])=>Array.from(e.values()).filter(n=>n.readyState===WebSocket.OPEN&&n.latency>=Gf)),na(e=>e.length>0),sx(ax)).subscribe({next:e=>{console.log(new Date,"Triggering reconnect",e),this.connect()},complete:()=>{console.log("Monitor complete")},error:e=>{console.error("Error in monitor",e)}})}process(){const e=this.client.pipe(na(s=>(s==null?void 0:s.readyState)===WebSocket.OPEN),nx(1)),n=this.queue.pipe(TB(()=>e),na(s=>s.length>0),Fs(s=>s.sort((c,i)=>{const o=u=>{var l;return!!((l=u.payload.value)!=null&&l.config)};return o(i)?1:o(c)?-1:0}))),r=this.queue.pipe(NB(e));return xB(n.pipe(za(s=>s)),r).pipe(Qv(this.client),Hf(([,s])=>s.readyState===WebSocket.OPEN),za(async([s,c])=>{await cx({req:s,interceptors:this.interceptors,socket:c,knownID:this.knownID,runID:this.runID})})).subscribe({error:s=>{this._errors.next(s)}})}useSocketClient(e){return new ur(n=>{const r=new URL(this.runnerEndpoint);r.searchParams.set("id",e),r.searchParams.set("runID",this.runID);const s=new WebSocket(r.toString()),c=l=>{if(console.log(new Date,`WebSocket transport ${e} closed`,l),l.code===1005){n.complete();return}if(this.autoReconnect){this.connect();return}},i=l=>{console.log(new Date,`WebSocket transport ${e} error`,l),this.autoReconnect||n.error(l)},o=l=>{var a,d;if(typeof l.data!="string"){console.warn("Unexpected WebSocket message type:",typeof l.data);return}let h;try{h=lx(l.data),console.log("Received WebsocketResponse:",h)}catch(m){console.error("Failed to parse WebsocketResponse:",m)}const p=h.status;if(p&&p.code!==EP.OK){n.error(p);return}if(h.pong)return;const v=h.payload.value;if(v.stdoutData&&v.stdoutData.length>0&&((a=this.callback)==null||a.call(this,{type:Nu.terminalStdout,output:{"runme.dev/id":this.knownID,data:v.stdoutData}}),this._stdout.next(v.stdoutData)),v.stderrData&&v.stderrData.length>0&&((d=this.callback)==null||d.call(this,{type:Nu.terminalStderr,output:{"runme.dev/id":this.knownID,data:v.stderrData}}),this._stderr.next(v.stderrData)),v.exitCode!==void 0&&(this._exitCode.next(v.exitCode),n.complete()),v.pid!==void 0&&this._pid.next(v.pid),v.mimeType){const m=v.mimeType.split(";")[0];this._mimeType.next(m)}},u=()=>{console.log(new Date,`✅ Connected WebSocket for cell ${this.knownID} (#${this.sequence}) with runID ${this.runID}`),n.next(s)};return s.addEventListener("close",c),s.addEventListener("error",i),s.addEventListener("message",o),s.addEventListener("open",u),()=>{console.log(new Date,`☑️ Cleanly disconnected WebSocket for cell ${this.knownID} (#${this.sequence}) with runID ${this.runID}`),s.removeEventListener("close",c),s.removeEventListener("error",i),s.removeEventListener("message",o),s.removeEventListener("open",u),s.close()}})}setCallback(e){this.callback=e}sendExecuteRequest(e){this.queue.next(tn(qg,{payload:{value:e,case:"executeRequest"}}))}useHeartbeat(e,{streamID:n,heartbeat:r}){return new ur(s=>{const c=Qg(e,"message").pipe(Hf(()=>e.readyState===WebSocket.OPEN),Fs(u=>lx(u.data)),Fs(u=>u.pong),na(u=>u!==void 0),Fs(u=>({receivedAt:BigInt(Date.now()),pong:u}))),i=(r==="INITIAL"?Lu(0):Lu(0,YB)).pipe(Hf(()=>e.readyState===WebSocket.OPEN),Fs(()=>{const u={timestamp:BigInt(Date.now())};return tn(qg,{ping:u})}),za(async u=>(await cx({req:u,interceptors:this.interceptors,socket:e}),u)),Fs(u=>u.ping)).pipe(na(u=>(u==null?void 0:u.timestamp)!==void 0),za(u=>jB(c.pipe(na(l=>l.pong.timestamp===u.timestamp),nx(1),Fs(l=>{const a=u.timestamp,d=l.receivedAt;return Number(d-a)})),Lu(Gf).pipe(Fs(()=>{throw new Error(`Pong not received within ${Gf}ms for stream ${n}`)}))).pipe(ok(l=>(this._latencies.next({streamID:n,latency:Gf,readyState:e.readyState,updatedAt:BigInt(Date.now())}),console.log(new Date,"Ping deadline exceeded",l.message),aB(null))))),IB(()=>{this._latencies.next({streamID:n,latency:-1,readyState:e.readyState,updatedAt:BigInt(Date.now())})}),LB(u=>{u!==null&&this._latencies.next({streamID:n,latency:u,readyState:e.readyState,updatedAt:BigInt(Date.now())})})),o=[];return o.push(i.subscribe({error:u=>{console.error("Unexpected error sending heartbeat",u)}})),s.next(e),()=>{o.forEach(u=>u.unsubscribe())}})}connect(e="CONTINUOUS"){const n=qB(),r=this.latencies.pipe(Fs(s=>{const c=s.get(n);return c===void 0?null:c}),Hf(s=>(s==null?void 0:s.readyState)===WebSocket.OPEN));return this.reconnect.next({streamID:n,heartbeat:e}),r}close(){this.reconnect.complete(),this.queue.complete(),this._latencies.complete(),this.subscriptions.forEach(e=>e.unsubscribe())}}function lx(t){const e=JSON.parse(t);return b0(jP,e)}async function cx({req:t,interceptors:e,socket:n,knownID:r,runID:s}){r&&(t.knownId=r),s&&(t.runId=s);const c={stream:!1,message:{},method:{},service:{},requestMethod:"UPGRADE",url:n.url,signal:new AbortController().signal,header:new Headers,contextValues:{}};let i=async u=>({stream:!1,message:{},method:{},service:{},header:u.header});for(const u of e.concat().reverse())i=u(i);const o=(await i(c)).header.get("Authorization");o&&t&&(t.authorization=o),n.send(JSON.stringify(V3(qg,t)))}function qB(){return KB().replace(/-/g,"")}function dk(){return`run_${zB()}`}function JB({cellID:t,runID:e,sequence:n,commands:r,content:s,runner:c,settings:i={},onStdout:o,onStderr:u,onExitCode:l,onPid:a,onMimeType:d}){var h;const{rows:p=20,className:v,fontSize:m=12,fontFamily:b="monospace",takeFocus:y=!0,scrollToFit:_=!0}=i,S=B.useMemo(()=>!t||s===""?null:s,[t,s]),C=B.useMemo(()=>{if(!(!t||!e||!c.endpoint))return console.log("Creating stream",t,e,c.endpoint),new uk({knownID:t,runID:e,sequence:n,options:{runnerEndpoint:c.endpoint,interceptors:c.interceptors,autoReconnect:c.reconnect}})},[t,e,n,c]);B.useEffect(()=>{const N=C==null?void 0:C.connect().subscribe(D=>console.log(`Heartbeat latency for streamID ${D==null?void 0:D.streamID} (${(D==null?void 0:D.readyState)===1?"open":"closed"}): ${D==null?void 0:D.latency}ms`));return()=>{N==null||N.unsubscribe(),C==null||C.close()}},[C]);let x=tn(K2,{rows:34,cols:100,x:0,y:0});const j=B.useMemo(()=>tn(Xv,{sessionStrategy:wP.MOST_RECENT,storeStdoutInEnv:!0,config:{languageId:"sh",background:!1,fileExtension:"",env:[`RUNME_ID=${t}`,"RUNME_RUNNER=v2","TERM=xterm-256color"],source:{case:"commands",value:{items:r}},interactive:!0,mode:yP.INLINE,runId:e,knownId:t},winsize:x}),[t,e,r,x]),k=B.useMemo(()=>{var N;return{output:{"runme.dev/id":(N=j.config)==null?void 0:N.knownId,fontFamily:b||"monospace",fontSize:m||12,cursorStyle:"block",cursorBlink:!0,cursorWidth:1,takeFocus:y,scrollToFit:_,smoothScrollDuration:0,scrollback:4e3,initialRows:p,content:S||"",isAutoSaveEnabled:!1,isPlatformAuthEnabled:!1}}},[(h=j.config)==null?void 0:h.knownId,b,m,y,_,p,S]),A=new TextEncoder;return xP({postMessage:N=>{if(N.type===Nu.terminalOpen||N.type===Nu.terminalResize){const D=Number(N.output.terminalDimensions.columns),M=Number(N.output.terminalDimensions.rows);if(Number.isFinite(D)&&Number.isFinite(M)){if(x.cols===D&&x.rows===M)return;x=tn(K2,{cols:D,rows:M,x:0,y:0});const $=tn(Xv,{winsize:x});C==null||C.sendExecuteRequest($)}}if(N.type===Nu.terminalStdin){const D=A.encode(N.output.input),M=tn(Xv,{inputData:D});C==null||C.sendExecuteRequest(M)}},onDidReceiveMessage:N=>{C==null||C.setCallback(N)}}),B.useEffect(()=>{const N=C==null?void 0:C.stdout.subscribe(D=>{o==null||o(D)});return()=>N==null?void 0:N.unsubscribe()},[C,o]),B.useEffect(()=>{const N=C==null?void 0:C.stderr.subscribe(D=>{u==null||u(D)});return()=>N==null?void 0:N.unsubscribe()},[C,u]),B.useEffect(()=>{const N=C==null?void 0:C.exitCode.subscribe(D=>{l==null||l(D),C==null||C.close()});return()=>N==null?void 0:N.unsubscribe()},[C,l]),B.useEffect(()=>{const N=C==null?void 0:C.pid.subscribe(D=>{a==null||a(D)});return()=>N==null?void 0:N.unsubscribe()},[C,a]),B.useEffect(()=>{const N=C==null?void 0:C.mimeType.subscribe(D=>{d==null||d(D)});return()=>N==null?void 0:N.unsubscribe()},[C,d]),B.useEffect(()=>{!C||!j||(console.log("useEffect invoked - Commands changed:",JSON.stringify(j.config.source.value)),C==null||C.sendExecuteRequest(j))},[j,C]),ie.jsx("div",{className:v,ref:N=>{if(!N||N.hasChildNodes())return;const D=document.createElement("terminal-view");D.setAttribute("buttons","false"),D.setAttribute("id",k.output["runme.dev/id"]),D.setAttribute("fontFamily",k.output.fontFamily),typeof k.output.fontSize=="number"&&D.setAttribute("fontSize",k.output.fontSize.toString()),k.output.cursorStyle&&D.setAttribute("cursorStyle",k.output.cursorStyle),typeof k.output.cursorBlink=="boolean"&&D.setAttribute("cursorBlink",k.output.cursorBlink?"true":"false"),typeof k.output.cursorWidth=="number"&&D.setAttribute("cursorWidth",k.output.cursorWidth.toString()),typeof k.output.takeFocus=="boolean"&&D.setAttribute("takeFocus",k.output.takeFocus?"true":"false"),typeof k.output.smoothScrollDuration=="number"&&D.setAttribute("smoothScrollDuration",k.output.smoothScrollDuration.toString()),typeof k.output.scrollback=="number"&&D.setAttribute("scrollback",k.output.scrollback.toString()),k.output.initialRows!==void 0&&D.setAttribute("initialRows",k.output.initialRows.toString()),k.output.content!==void 0&&D.setAttribute("initialContent",k.output.content),k.output.isAutoSaveEnabled&&D.setAttribute("isAutoSaveEnabled",k.output.isAutoSaveEnabled.toString()),k.output.isPlatformAuthEnabled&&D.setAttribute("isPlatformAuthEnabled",k.output.isPlatformAuthEnabled.toString()),N.appendChild(D);const M=document.createElement("div");M.setAttribute("className","h-1"),N.appendChild(M),setTimeout(()=>{_&&!QB(M)&&M.scrollIntoView({behavior:"smooth"})},0)}})}function QB(t){const e=t.getBoundingClientRect();return e.top>=0&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth)}class Eu extends Error{}Eu.prototype.name="InvalidTokenError";function e$(t){return decodeURIComponent(atob(t).replace(/(.)/g,(e,n)=>{let r=n.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r}))}function t$(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return e$(e)}catch{return atob(e)}}function fk(t,e){if(typeof t!="string")throw new Eu("Invalid token specified: must be a string");e||(e={});const n=e.header===!0?0:1,r=t.split(".")[n];if(typeof r!="string")throw new Eu(`Invalid token specified: missing part #${n+1}`);let s;try{s=t$(r)}catch(c){throw new Eu(`Invalid token specified: invalid base64 for part #${n+1} (${c.message})`)}try{return JSON.parse(s)}catch(c){throw new Eu(`Invalid token specified: invalid json for part #${n+1} (${c.message})`)}}const hk="0123456789ABCDEFGHJKMNPQRSTVWXYZ",Lh=32,n$=16,pk=10,ux=0xffffffffffff;var Ga;(function(t){t.Base32IncorrectEncoding="B32_ENC_INVALID",t.DecodeTimeInvalidCharacter="DEC_TIME_CHAR",t.DecodeTimeValueMalformed="DEC_TIME_MALFORMED",t.EncodeTimeNegative="ENC_TIME_NEG",t.EncodeTimeSizeExceeded="ENC_TIME_SIZE_EXCEED",t.EncodeTimeValueMalformed="ENC_TIME_MALFORMED",t.PRNGDetectFailure="PRNG_DETECT",t.ULIDInvalid="ULID_INVALID",t.Unexpected="UNEXPECTED",t.UUIDInvalid="UUID_INVALID"})(Ga||(Ga={}));class ju extends Error{constructor(e,n){super(`${n} (${e})`),this.name="ULIDError",this.code=e}}function r$(t){const e=Math.floor(t()*Lh)%Lh;return hk.charAt(e)}function s$(t){const e=i$(),n=e&&(e.crypto||e.msCrypto)||null;if(typeof(n==null?void 0:n.getRandomValues)=="function")return()=>{const r=new Uint8Array(1);return n.getRandomValues(r),r[0]/255};if(typeof(n==null?void 0:n.randomBytes)=="function")return()=>n.randomBytes(1).readUInt8()/255;throw new ju(Ga.PRNGDetectFailure,"Failed to find a reliable PRNG")}function i$(){return l$()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function o$(t,e){let n="";for(;t>0;t--)n=r$(e)+n;return n}function a$(t,e=pk){if(isNaN(t))throw new ju(Ga.EncodeTimeValueMalformed,`Time must be a number: ${t}`);if(t>ux)throw new ju(Ga.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${ux}: ${t}`);if(t<0)throw new ju(Ga.EncodeTimeNegative,`Time must be positive: ${t}`);if(Number.isInteger(t)===!1)throw new ju(Ga.EncodeTimeValueMalformed,`Time must be an integer: ${t}`);let n,r="";for(let s=e;s>0;s--)n=t%Lh,r=hk.charAt(n)+r,t=(t-n)/Lh;return r}function l$(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function c$(t,e){const n=s$(),r=Date.now();return a$(r,pk)+o$(n$,n)}const mk=B.createContext(void 0),Ui=()=>{console.log("CODE WAS MODIFIED useSettings");const t=B.useContext(mk);if(!t)throw new Error("useSettings must be used within a SettingsProvider");return t},u$=({children:t,requireAuth:e,webApp:n,createAuthInterceptors:r})=>{const[s,c]=B.useState(null),i=B.useMemo(()=>{const v=Wg();if(!v)return"unauthenticated";let m;try{return m=fk(v),m.email||m.sub||"unauthenticated"}catch(b){return console.error("Error decoding token",b),"unauthenticated"}},[]),o=B.useMemo(()=>{const v=window.location.hostname==="localhost",m=window.location.protocol==="http:",b=window.location.port==="4173"||window.location.port==="5173",y=v&&m&&b;let _=new URL(window.location.href);n!=null&&n.runner&&(_=new URL(n.runner));const S={requireAuth:!1,agentEndpoint:y?"http://localhost:8080":window.location.origin,webApp:{runner:y?"ws://localhost:8080/ws":`${_.protocol==="https:"?"wss:":"ws:"}//${_.host}/ws`,reconnect:(n==null?void 0:n.reconnect)??!0,invertedOrder:(n==null?void 0:n.invertedOrder)??!1}};return e!==void 0&&(S.requireAuth=e),S},[e,n]),[u,l]=B.useState(()=>{const v=localStorage.getItem("cloudAssistantSettings"),m=v?JSON.parse(v):{};return m&&m.webApp&&m.webApp.reconnect!==void 0&&(m.webApp.reconnect=o.webApp.reconnect),v?{...o,...m}:o});B.useEffect(()=>{localStorage.setItem("cloudAssistantSettings",JSON.stringify(u))},[u]);const a=B.useCallback(v=>{const m=b=>{const y=xn.from(b);y.code===ln.Unauthenticated&&(window.location.href=`/login?error=${encodeURIComponent(y.name)}&error_description=${encodeURIComponent(y.message)}`)};return[b=>async y=>{const _=Wg();return _&&y.header.set("Authorization",`Bearer ${_}`),v?b(y).catch(S=>{throw m(S),S}):b(y)}]},[]),d=B.useMemo(()=>r??a,[r,a]),h=B.useCallback(async()=>{if(!u.webApp.runner)return;c(null);const v=new uk({knownID:`check_${c$()}`,runID:dk(),sequence:0,options:{runnerEndpoint:u.webApp.runner,interceptors:d(!1),autoReconnect:!1}}),m=[];return m.push(v.errors.subscribe({next:b=>c(b)})),m.push(v.connect(ck.INITIAL).subscribe(b=>{b!==null&&(console.log(`Initial heartbeat latency for streamID ${b.streamID} (${b.readyState===1?"open":"closed"}): ${b.latency}ms`),v.close())})),()=>{m.forEach(b=>b.unsubscribe())}},[r,u.webApp.runner]);B.useEffect(()=>{h()},[h]);const p=v=>{l(m=>({...m,...v,webApp:{...m.webApp,...v.webApp}}))};return ie.jsx(mk.Provider,{value:{principal:i,checkRunnerAuth:h,createAuthInterceptors:d,defaultSettings:o,runnerError:s,settings:u,updateSettings:p},children:t})},vk=B.createContext(void 0),d$=()=>{const t=B.useContext(vk);if(!t)throw new Error("useClient must be used within a ClientProvider");return t},f$=({children:t})=>{const[e,n]=B.useState(),{settings:r,createAuthInterceptors:s}=Ui();return B.useEffect(()=>{n(h$(r.agentEndpoint,s(!0)))},[r.agentEndpoint,s]),ie.jsx(vk.Provider,{value:{client:e,setClient:n},children:t})};function h$(t,e){console.log("code modified"),console.log(`initializing the client: baseURL ${t}`);const n=n5({baseUrl:t,interceptors:e});return K3(r7,n)}const gk=B.createContext(void 0),xo=()=>{const t=B.useContext(gk);if(!t)throw new Error("useCell must be used within a CellProvider");return t};function dx(t,e){if(!t)return[];const n=t.positions.map(r=>{const s=t.cells[r];return s.languageId="sh",s});return n.length===0?[]:e?n.reverse():n}const p$=({children:t})=>{const{settings:e,createAuthInterceptors:n,principal:r}=Ui(),[s,c]=B.useState(0),[i,o]=B.useState(!1),[u,l]=B.useState(!1),[a,d]=B.useState(),h=B.useMemo(()=>{console.log("CODE WAS MODIFIED runnerConnectEndpoint",e.webApp.runner);const G=new URL(e.webApp.runner);return G.protocol==="ws:"?G.protocol="http:":G.protocol="https:",G.pathname="",G.toString()},[e.webApp.runner]),p=B.useMemo(()=>{if(r)return new YD("agent",r,e2(F7,h,n(!0)))},[e.agentEndpoint,r]),v=B.useMemo(()=>e.webApp.invertedOrder,[e.webApp.invertedOrder]),{client:m}=d$(),[b,y]=B.useState(void 0),_=B.useCallback(()=>{if(!b)return;const G=dx(b,v),ne=tn(IS,{cells:G});a&&(ne.metadata[Fg.PreviousResponseId]=a),p==null||p.saveNotebook(b.runmeSession,ne)},[b,v,a,p]),S=B.useCallback(async({attemptRestore:G})=>{if(!p)return;c(0),d(void 0);const ne=p.createSession();let U;if(!G)U=await ne;else{const H=await p.listActiveSessions(),Y=(await p.loadSessions(H)).filter(W=>W.data.cells.length!==0);if(Y.length===0)U=await ne;else{const W=Y[0];let F=W.data.cells.map(le=>le.refId);v&&(F=F.reverse());const ae=W.data.metadata[Fg.PreviousResponseId];ae&&d(ae),y({runmeSession:W.id,cells:W.data.cells.reduce((le,ee)=>(le[ee.refId]=ee,le),{}),positions:F});return}}y({runmeSession:U,cells:{},positions:[]})},[v,p]);B.useEffect(()=>{_()},[b,p,v,_]),B.useEffect(()=>{y(G=>({runmeSession:(G==null?void 0:G.runmeSession)??"",cells:(G==null?void 0:G.cells)??{},positions:[...(G==null?void 0:G.positions)??[]].reverse()}))},[v]),B.useEffect(()=>{S&&S({attemptRestore:!0})},[S]);const C=B.useMemo(()=>b?b.positions.map(G=>b.cells[G]).filter(G=>!!G&&(G.kind===Hs.MARKUP||G.kind===Hs.CODE)):[],[b]),x=B.useMemo(()=>b?b.positions.map(G=>b.cells[G]).filter(G=>!!G&&G.kind===Hs.CODE):[],[b]),j=B.useMemo(()=>b?b.positions.map(G=>b.cells[G]).filter(G=>!!G&&G.kind===Hs.DOC_RESULTS):[],[b]),k=()=>({chat:C,actions:x,files:j}),A=G=>IL(Iu,G),N=async G=>{const ne=eM(),U=tn(n7,{cells:G,previousResponseId:a});U.openaiAccessToken=ne.accessToken,ne.accessToken||console.error("No access token found");try{const H=m.generate(U);for await(const R of H){for(const Y of R.cells)l(!1),$(Y);d(R.responseId)}}catch(H){console.log(H)}finally{l(!1),o(!1)}},D=async G=>{if(!G.trim())return;const ne=tn(Iu,{refId:`user_${BS()}`,role:bo.USER,kind:Hs.MARKUP,value:G});$(ne),o(!0),l(!0),await N([ne])},M=async G=>{G.outputs.length!==0&&(console.log("sending output cell",G.refId,"previousResponseId",a),o(!0),l(!0),await N([G]))},$=G=>{y(ne=>{if(ne){if(!ne.cells[G.refId]){const U=v?[G.refId,...ne.positions]:[...ne.positions,G.refId];return{runmeSession:ne.runmeSession,cells:{...ne.cells,[G.refId]:G},positions:U}}return{...ne,runmeSession:ne.runmeSession,cells:{...ne.cells,[G.refId]:G}}}})},X=()=>{const G=`code_${BS().replace(/-/g,"")}`,ne=tn(Iu,{metadata:{[cs.ID]:G,[cs.RunmeID]:G},refId:G,role:bo.USER,kind:Hs.CODE,value:""});$(ne)},Q=G=>{if(!x.find(H=>H.refId===G.refId))return;const U=new CustomEvent("runCodeCell",{detail:{cellId:G.refId}});G.executionSummary=void 0,G.outputs=[],c(H=>{const R=H+1;return G.metadata[cs.Sequence]=R.toString(),R}),window.dispatchEvent(U)},te=async({asSessionRecord:G})=>{var ee;const ne=dx(b,v);if(!b||ne.length===0)return;const U=tn(IS,{cells:ne}),H=e2(t7,e.agentEndpoint),R=tn(JL,{notebook:U,options:tn(qL,{outputs:tn(XL,{enabled:!1,summary:!1})})});G&&((ee=R.options)!=null&&ee.outputs)&&(R.options.outputs.enabled=!0,R.options.outputs.summary=!0,R.options.session=tn(YL,{id:b.runmeSession}));const Y=await H.serialize(R),W=new Blob([Y.result],{type:"text/plain"}),F=URL.createObjectURL(W),ae=document.createElement("a");ae.href=F;const le=G?"Session":"Notebook";ae.download=`${le}-${a5()}.md`,document.body.appendChild(ae),ae.click(),document.body.removeChild(ae),URL.revokeObjectURL(F)};return ie.jsx(gk.Provider,{value:{useColumns:k,sequence:s,saveState:_,exportDocument:te,sendOutputCell:M,createOutputCell:A,sendUserCell:D,addCodeCell:X,isInputDisabled:i,isTyping:u,runCodeCell:Q,resetSession:S},children:t})},fx=new TextEncoder;function m$({pid:t,exitCode:e},n,r,s){let c;return t!==null&&e!==null&&(c=tn(ZL,{pid:BigInt(t),exitReason:tn(WL,{type:"exit",code:e})})),[tn(RS,{items:[tn(OS,{mime:jh.VSCodeNotebookStdOut,type:"Buffer",data:fx.encode(n)})],processInfo:c}),tn(RS,{items:[tn(OS,{mime:jh.VSCodeNotebookStdErr,type:"Buffer",data:fx.encode(r)})]})]}const v$=tn(Iu,{kind:Hs.MARKUP,role:bo.ASSISTANT,value:"..."}),eb={fontSize:14,fontFamily:"monospace"},g$=new TextDecoder,b$=B.memo(JB,(t,e)=>t.cellID===e.cellID&&t.runID===e.runID),y$=({cell:t,onExitCode:e,onPid:n})=>{const{createAuthInterceptors:r,settings:{webApp:s}}=Ui(),{sendOutputCell:c,saveState:i}=xo(),o=s.invertedOrder,[u,l]=B.useState(!1),[a,d]=B.useState({value:"",runID:""}),[h,p]=B.useState(null),[v,m]=B.useState(null),[b,y]=B.useState(null),[_,S]=B.useState(null),[C,x]=B.useState(""),[j,k]=B.useState(""),[A,N]=B.useState(""),D=B.useMemo(()=>Number(t.metadata[cs.Sequence]??0),[t,v,b]),M=B.useCallback((le=!1)=>{p(BigInt(Date.now())),x(""),k(""),m(null),y(null),l(le),d({value:t.value,runID:dk()})},[t]),$=B.useMemo(()=>({...eb,className:"rounded-md overflow-hidden",rows:14,scrollToFit:!o,takeFocus:u}),[o,u]);B.useEffect(()=>{const le=ee=>{ee.detail.cellId===t.refId&&M()};return window.addEventListener("runCodeCell",le),()=>{window.removeEventListener("runCodeCell",le)}},[t.refId,M]);const X=B.useMemo(()=>m$({pid:v,exitCode:b},C,j),[v,b,C,j,_]);B.useEffect(()=>{h!==null&&(t.outputs=X,t.executionSummary=tn(KL,{timing:tn(GL,{startTime:h,endTime:BigInt(Date.now())}),executionOrder:D,success:Number.isFinite(b)&&b===0}))},[t,X,b,D,h]);const Q=B.useMemo(()=>v===null||b===null||a.runID===""||!Number.isFinite(v)||!Number.isInteger(b)?null:t,[t,a.runID,b,v]);B.useEffect(()=>{!Q||A===a.runID||(N(a.runID),c(Q))},[c,Q,a.runID,A]),B.useEffect(()=>{v!==null&&n(v)},[v,n]),B.useEffect(()=>{b!==null&&e(b)},[b,e]),B.useEffect(()=>{t.kind===Hs.CODE&&(a.runID!==""&&(t.metadata[cs.LastRunID]=a.runID),v?t.metadata[cs.Pid]=v.toString():delete t.metadata[cs.Pid],b!==null&&Number.isFinite(b)?(delete t.metadata[cs.Pid],t.metadata[cs.ExitCode]=b.toString()):delete t.metadata[cs.ExitCode],i())},[v,b,t,i,a.runID]);const te=B.useMemo(()=>{if(t.kind!==Hs.CODE||A!=="")return;const le=t.outputs.flatMap(ee=>ee.items).find(ee=>ee.mime===jh.VSCodeNotebookStdOut);if(le)return g$.decode(le.data)},[t.kind,t.outputs,A]),G=B.useMemo(()=>{var ee;return((ee=t.metadata)==null?void 0:ee[cs.Pid])??""?t.metadata[cs.LastRunID]??"":""},[t.metadata]),ne=B.useMemo(()=>a.value===""||a.runID===""?[]:a.value.split(`
|
|
6660
6660
|
`),[a]),U=B.useMemo(()=>a.runID===""?G:a.runID,[a.runID,G]),H=B.useMemo(()=>({endpoint:s.runner,reconnect:s.reconnect,interceptors:r(!1)}),[s.runner,s.reconnect,r]),R=B.useCallback(le=>{x(ee=>ee+new TextDecoder().decode(le))},[]),Y=B.useCallback(le=>{k(ee=>ee+new TextDecoder().decode(le))},[]),W=B.useCallback(le=>{m(le)},[]),F=B.useCallback(le=>{y(le)},[]),ae=B.useCallback(le=>{S(le)},[]);return ne.length===0&&(!te||te.length===0)?null:ie.jsx(b$,{cellID:t.refId,runID:U,sequence:D,commands:ne,content:te,runner:H,settings:$,onPid:W,onStdout:R,onStderr:Y,onExitCode:F,onMimeType:ae},U)};function _$(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function hx(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function px(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?hx(Object(n),!0).forEach(function(r){_$(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):hx(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function w$(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,c;for(c=0;c<r.length;c++)s=r[c],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}function S$(t,e){if(t==null)return{};var n=w$(t,e),r,s;if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(t);for(s=0;s<c.length;s++)r=c[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function x$(t,e){return C$(t)||E$(t,e)||j$(t,e)||k$()}function C$(t){if(Array.isArray(t))return t}function E$(t,e){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(t)))){var n=[],r=!0,s=!1,c=void 0;try{for(var i=t[Symbol.iterator](),o;!(r=(o=i.next()).done)&&(n.push(o.value),!(e&&n.length===e));r=!0);}catch(u){s=!0,c=u}finally{try{!r&&i.return!=null&&i.return()}finally{if(s)throw c}}return n}}function j$(t,e){if(t){if(typeof t=="string")return mx(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return mx(t,e)}}function mx(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function k$(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
6661
6661
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function T$(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function vx(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function gx(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?vx(Object(n),!0).forEach(function(r){T$(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):vx(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function A$(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return function(r){return e.reduceRight(function(s,c){return c(s)},r)}}function ku(t){return function e(){for(var n=this,r=arguments.length,s=new Array(r),c=0;c<r;c++)s[c]=arguments[c];return s.length>=t.length?t.apply(this,s):function(){for(var i=arguments.length,o=new Array(i),u=0;u<i;u++)o[u]=arguments[u];return e.apply(n,[].concat(s,o))}}}function Dh(t){return{}.toString.call(t).includes("Object")}function I$(t){return!Object.keys(t).length}function id(t){return typeof t=="function"}function O$(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function R$(t,e){return Dh(e)||aa("changeType"),Object.keys(e).some(function(n){return!O$(t,n)})&&aa("changeField"),e}function N$(t){id(t)||aa("selectorType")}function L$(t){id(t)||Dh(t)||aa("handlerType"),Dh(t)&&Object.values(t).some(function(e){return!id(e)})&&aa("handlersType")}function D$(t){t||aa("initialIsRequired"),Dh(t)||aa("initialType"),I$(t)&&aa("initialContent")}function M$(t,e){throw new Error(t[e]||t.default)}var P$={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},aa=ku(M$)(P$),Wf={changes:R$,selector:N$,handler:L$,initial:D$};function B$(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Wf.initial(t),Wf.handler(e);var n={current:t},r=ku(V$)(n,e),s=ku(U$)(n),c=ku(Wf.changes)(t),i=ku($$)(n);function o(){var l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(a){return a};return Wf.selector(l),l(n.current)}function u(l){A$(r,s,c,i)(l)}return[o,u]}function $$(t,e){return id(e)?e(t.current):e}function U$(t,e){return t.current=gx(gx({},t.current),e),e}function V$(t,e,n){return id(e)?e(t.current):Object.keys(n).forEach(function(r){var s;return(s=e[r])===null||s===void 0?void 0:s.call(e,t.current[r])}),n}var F$={create:B$},z$={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.2/min/vs"}};function H$(t){return function e(){for(var n=this,r=arguments.length,s=new Array(r),c=0;c<r;c++)s[c]=arguments[c];return s.length>=t.length?t.apply(this,s):function(){for(var i=arguments.length,o=new Array(i),u=0;u<i;u++)o[u]=arguments[u];return e.apply(n,[].concat(s,o))}}}function G$(t){return{}.toString.call(t).includes("Object")}function W$(t){return t||bx("configIsRequired"),G$(t)||bx("configType"),t.urls?(Z$(),{paths:{vs:t.urls.monacoBase}}):t}function Z$(){console.warn(bk.deprecation)}function K$(t,e){throw new Error(t[e]||t.default)}var bk={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
|
|
6662
6662
|
You are using deprecated way of configuration.
|
|
@@ -22,7 +22,9 @@ interface SettingsProviderProps {
|
|
|
22
22
|
children: ReactNode;
|
|
23
23
|
requireAuth?: boolean;
|
|
24
24
|
webApp?: WebAppConfig;
|
|
25
|
+
/** If provided, this replaces the default implementation entirely */
|
|
26
|
+
createAuthInterceptors?: (redirect: boolean) => Interceptor[];
|
|
25
27
|
}
|
|
26
|
-
export declare const SettingsProvider: ({ children, requireAuth, webApp, }: SettingsProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export declare const SettingsProvider: ({ children, requireAuth, webApp, createAuthInterceptors, }: SettingsProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
29
|
export {};
|
|
28
30
|
//# sourceMappingURL=SettingsContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsContext.d.ts","sourceRoot":"","sources":["../../src/contexts/SettingsContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAOV,MAAM,OAAO,CAAA;AAEd,OAAO,EAAE,YAAY,EAAE,MAAM,oDAAoD,CAAA;AACjF,OAAO,EAAsB,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACrE,OAAO,EAEL,WAAW,EAGZ,MAAM,yBAAyB,CAAA;AAChC,OAAO,2CAA2C,CAAA;AAOlD,UAAU,QAAQ;IAChB,aAAa,EAAE,MAAM,CAAA;IACrB,WAAW,EAAE,OAAO,CAAA;IACpB,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,YAAY,EAAE,WAAW,GAAG,UAAU,CAAC,CAAC,CAAA;CAC/D;AAED,UAAU,mBAAmB;IAC3B,SAAS,EAAE,MAAM,CAAA;IACjB,eAAe,EAAE,MAAM,IAAI,CAAA;IAC3B,sBAAsB,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,WAAW,EAAE,CAAA;IAC5D,eAAe,EAAE,QAAQ,CAAA;IACzB,WAAW,EAAE,WAAW,GAAG,IAAI,CAAA;IAC/B,QAAQ,EAAE,QAAQ,CAAA;IAClB,cAAc,EAAE,CAAC,WAAW,EAAE,OAAO,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAA;CACzD;AAOD,eAAO,MAAM,WAAW,2BAOvB,CAAA;AAED,UAAU,qBAAqB;IAC7B,QAAQ,EAAE,SAAS,CAAA;IACnB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,MAAM,CAAC,EAAE,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"SettingsContext.d.ts","sourceRoot":"","sources":["../../src/contexts/SettingsContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAOV,MAAM,OAAO,CAAA;AAEd,OAAO,EAAE,YAAY,EAAE,MAAM,oDAAoD,CAAA;AACjF,OAAO,EAAsB,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACrE,OAAO,EAEL,WAAW,EAGZ,MAAM,yBAAyB,CAAA;AAChC,OAAO,2CAA2C,CAAA;AAOlD,UAAU,QAAQ;IAChB,aAAa,EAAE,MAAM,CAAA;IACrB,WAAW,EAAE,OAAO,CAAA;IACpB,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,YAAY,EAAE,WAAW,GAAG,UAAU,CAAC,CAAC,CAAA;CAC/D;AAED,UAAU,mBAAmB;IAC3B,SAAS,EAAE,MAAM,CAAA;IACjB,eAAe,EAAE,MAAM,IAAI,CAAA;IAC3B,sBAAsB,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,WAAW,EAAE,CAAA;IAC5D,eAAe,EAAE,QAAQ,CAAA;IACzB,WAAW,EAAE,WAAW,GAAG,IAAI,CAAA;IAC/B,QAAQ,EAAE,QAAQ,CAAA;IAClB,cAAc,EAAE,CAAC,WAAW,EAAE,OAAO,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAA;CACzD;AAOD,eAAO,MAAM,WAAW,2BAOvB,CAAA;AAED,UAAU,qBAAqB;IAC7B,QAAQ,EAAE,SAAS,CAAA;IACnB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,qEAAqE;IACrE,sBAAsB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,WAAW,EAAE,CAAA;CAC9D;AAED,eAAO,MAAM,gBAAgB,GAAI,4DAK9B,qBAAqB,4CAoLvB,CAAA"}
|