diff --git a/assets/index-XjKm47hu.js b/assets/index-yRoI0hNl.js similarity index 59% rename from assets/index-XjKm47hu.js rename to assets/index-yRoI0hNl.js index 706ec8d..fa9efce 100644 --- a/assets/index-XjKm47hu.js +++ b/assets/index-yRoI0hNl.js @@ -1,37 +1,37 @@ -var Et=Object.defineProperty;var xt=(s,t,e)=>t in s?Et(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var h=(s,t,e)=>(xt(s,typeof t!="symbol"?t+"":t,e),e),Y=(s,t,e)=>{if(!t.has(s))throw TypeError("Cannot "+e)};var c=(s,t,e)=>(Y(s,t,"read from private field"),e?e.call(s):t.get(s)),v=(s,t,e)=>{if(t.has(s))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(s):t.set(s,e)},y=(s,t,e,i)=>(Y(s,t,"write to private field"),i?i.call(s,e):t.set(s,e),e);var T=(s,t,e)=>(Y(s,t,"access private method"),e);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const n of r)if(n.type==="childList")for(const o of n.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function e(r){const n={};return r.integrity&&(n.integrity=r.integrity),r.referrerPolicy&&(n.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?n.credentials="include":r.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function i(r){if(r.ep)return;r.ep=!0;const n=e(r);fetch(r.href,n)}})();/** +var At=Object.defineProperty;var St=(s,t,e)=>t in s?At(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var h=(s,t,e)=>(St(s,typeof t!="symbol"?t+"":t,e),e),Y=(s,t,e)=>{if(!t.has(s))throw TypeError("Cannot "+e)};var c=(s,t,e)=>(Y(s,t,"read from private field"),e?e.call(s):t.get(s)),v=(s,t,e)=>{if(t.has(s))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(s):t.set(s,e)},y=(s,t,e,i)=>(Y(s,t,"write to private field"),i?i.call(s,e):t.set(s,e),e);var T=(s,t,e)=>(Y(s,t,"access private method"),e);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const n of r)if(n.type==="childList")for(const o of n.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function e(r){const n={};return r.integrity&&(n.integrity=r.integrity),r.referrerPolicy&&(n.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?n.credentials="include":r.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function i(r){if(r.ep)return;r.ep=!0;const n=e(r);fetch(r.href,n)}})();/** * XTerminal - v2.1.7 * @author Henry Hale * @license MIT * @url https://github.com/henryhale/xterminal - */var F,pt;let gt=(pt=class{constructor(){v(this,F,void 0);h(this,"isDisposed");this.isDisposed=!1,y(this,F,[])}register(t){this.isDisposed?t==null||t.dispose():c(this,F).push(t)}dispose(){this.isDisposed||(this.isDisposed=!0,c(this,F).forEach(t=>t==null?void 0:t.dispose()))}},F=new WeakMap,pt);var x,ft;let it=(ft=class extends gt{constructor(){super();v(this,x,void 0);y(this,x,{stack:[],store:new Map}),this.register({dispose:()=>c(this,x).store.clear()})}on(e,i){var n;const r=c(this,x).store;r.has(e)?(n=r.get(e))==null||n.add(i):r.set(e,new Set([i]))}once(e,i){var o;const r=(...a)=>{i.call(void 0,...a),this.off(e,r)},n=c(this,x).store;n.has(e)?(o=n.get(e))==null||o.add(r):n.set(e,new Set([r]))}off(e,i){const r=c(this,x).store.get(e);if(r){for(const n of r)if(n===i){r.delete(i);break}}}emit(e,...i){if(this.isDisposed)return;const r=c(this,x).stack;if(r.includes(e))return;const n=c(this,x).store.get(e);if(n){r.push(e);for(const o of n)o.call(void 0,...i);r.pop()}}},x=new WeakMap,ft);const mt=Array.isArray;function rt(s){return typeof s=="object"&&s!==null}function $(s){return typeof s=="function"}let At=class{constructor(t=[]){h(this,"store");h(this,"ptr");this.store=mt(t)?t:[],this.ptr=-1}get size(){return this.store.length}get list(){return[].slice.call(this.store).reverse()}add(t){t&&t!==this.store[0]&&this.store.unshift(t),this.ptr=-1}get previous(){return this.ptr++,this.ptr>=this.size&&(this.ptr=this.size-1),this.store[this.ptr]||""}get next(){return this.ptr--,this.ptr<=-1&&(this.ptr=-1),this.store[this.ptr]||""}clear(){this.store.splice(0)}};const N=" ",St="xt",nt="xt-inactive",Ot="xt-cursor",$t="xt-stdout",kt="xt-stdin";function ot(s){s&&s.scrollTo(0,s.scrollHeight)}function S(s,t){const e=document.createElement(s);return rt(t)&&(t!=null&&t.id&&(e.id=t.id||""),t!=null&&t.class&&(e.className=t.class||""),t!=null&&t.content&&e.appendChild(document.createTextNode(""+t.content)),t!=null&&t.html&&(e.innerHTML=t.html),mt(t==null?void 0:t.children)&&t.children.forEach(i=>e.append(i)),rt(t==null?void 0:t.props)&&Object.entries(t.props).forEach(i=>e.setAttribute(i[0],i[1]))),e}function Tt(s=""){return(""+s).replace(/(\n)|(\n\r)|(\r\n)/g,"
").replace(/\s{2}/g,N.repeat(2)).replace(/\t/g,N.repeat(4))}let Mt=class{constructor(t){h(this,"el");h(this,"console");h(this,"lastOutput");h(this,"onoutput");const{outputBox:e,consoleBox:i}=function(r){const n=S("span"),o=S("div",{class:$t,children:[n]});return r.appendChild(o),{outputBox:o,consoleBox:n}}(t);this.el=e,this.console=i}write(t,e){this.lastOutput=S("span",{html:Tt(t)}),this.console.appendChild(this.lastOutput),$(this.onoutput)&&this.onoutput(),$(e)&&e()}clear(){this.console&&(this.console.innerHTML="")}clearLast(){var t;this.lastOutput&&((t=this.lastOutput.parentNode)==null||t.removeChild(this.lastOutput)),this.lastOutput=void 0}};const vt="Enter";function O(s,t,e,i){s.addEventListener(t,e,i);let r=!1;return{dispose(){r||(s.removeEventListener(t,e,i),r=!0)}}}const Nt=0;function yt(s,...t){return setTimeout(s,Nt,...t)}function at(s){let t;return(...e)=>{$(s)&&(clearTimeout(t),t=yt(s,...e))}}let X;function j(s){const t=new Set;let e=!1;return{get value(){return!e&&$(X)&&t.add(X),s},set value(i){s=i,e||t.forEach(r=>r.call(void 0))},dispose(){e||(e=!0,t.clear())}}}function Z(s){if($(s)){X=s;try{s.call(void 0)}finally{X=null}}}class Lt extends gt{constructor(e){super();h(this,"el");h(this,"buffer");h(this,"data");h(this,"ptr");h(this,"isActive");h(this,"showInput");h(this,"isFocused");h(this,"onkeypress");this.el=function(o){const a=S("input",{props:{spellcheck:!1,autocapitalize:"off",autocomplete:"off"}}),l=S("div",{class:kt,children:[a]});return o.appendChild(l),a}(e),this.buffer="",this.data=j(""),this.ptr=j(0),this.isActive=j(!0),this.showInput=j(!0),this.isFocused=j(!1),this.register(this.data),this.register(this.ptr),this.register(this.isActive),this.register(this.showInput),this.register(this.isFocused);const i=()=>function(o,a,l){let d="selectionStart"in(u=o)?u.selectionStart:0;var u;const m=a.value.length;d>m?d=m:d<0&&(d=0),l.value=d}(this.el,this.data,this.ptr),r=at(i),n=at(()=>{this.data.value=this.buffer=this.el.value});Z(i),this.register(O(this.el,"blur",()=>this.isFocused.value=!1)),this.register(O(this.el,"focus",()=>this.isFocused.value=!0,!1)),this.register(O(this.el,"keyup",()=>this.isActive.value&&r(),!1)),this.register(O(this.el,"input",()=>{n(),r()})),this.register(O(this.el,"keydown",o=>{o.stopImmediatePropagation();const a=this.data.value;o.key===vt&&(this.el&&(this.el.value=""),this.data.value="",this.buffer="",this.showInput.value=!0),this.isActive.value&&$(this.onkeypress)&&(this.onkeypress({key:o.key,altKey:o.altKey,ctrlKey:o.ctrlKey,metaKey:o.metaKey,shiftKey:o.shiftKey,value:a,cancel(){o.preventDefault(),o.stopPropagation()}}),r())}))}blur(){this.el&&this.el.blur()}focus(){this.el&&this.el.focus()}pause(){this.isActive.value=!1}resume(){this.isActive.value=!0}setValue(e){e=e||this.buffer,this.el&&(this.el.value=e),this.data.value=e}pipe(e){var o;const i=S("span"),r=S("span",{class:Ot,html:N}),n=S("span");(o=e.el)==null||o.append(i,r,n),Z(()=>{const a=this.ptr.value,l=this.data.value;if(!this.isActive.value||!this.showInput.value)return i.innerHTML="",r.innerHTML=N,void(n.innerHTML="");i.innerHTML=l.substring(0,a).replace(/\s{2}/g," "+N),r.innerHTML=l.substring(a,a+1).trim()||N,n.innerHTML=l.substring(a+1).replace(/\s{2}/g," "+N)})}}function Pt(s,t){const e=S("div",{class:St,props:{tabindex:0}}),i=new At,r=new Mt(e),n=new Lt(e),o={input:n,output:r,history:i,completer:a=>a};return n.pipe(r),r.onoutput=()=>ot(e),s.register(O(e,"keydown",function(a){n.focus(),yt(()=>{n.el.dispatchEvent(new KeyboardEvent("keydown",a)),n.el.dispatchEvent(new KeyboardEvent("input",a))})})),s.register(O(e,"focus",()=>n.isFocused.value=!0)),s.register(O(e,"blur",()=>n.isFocused.value=!1)),function(){const a=window||{},l=navigator||{};return!(!("ontouchstart"in a)&&!l.maxTouchPoints||!/Mobi/.test(l.userAgent))}()&&s.register(O(e,"click",n.focus.bind(n))),t.appendChild(e),n.onkeypress=a=>{a.key==vt?(a.cancel(),i.add(a.value),s.writeln(a.value),s.emit("data",a.value)):a.key=="Tab"?(a.cancel(),$(o.completer)&&n.setValue(o.completer(a.value))):a.key=="ArrowDown"?(a.cancel(),n.setValue(i.next)):a.key=="ArrowUp"?(a.cancel(),n.setValue(i.previous)):s.emit("keypress",a),ot(e)},Z(()=>{n.isFocused.value?e.classList.remove(nt):e.classList.add(nt)}),o}class Ct extends Error{constructor(t){super(t="[x] "+t),this.name="XTerminalError"}}var p;class Dt extends it{constructor(e){super();v(this,p,void 0);h(this,"isMounted");this.isMounted=!1,e&&(e!=null&&e.target)&&this.mount(e.target)}focus(){c(this,p).input.focus()}blur(){c(this,p).input.blur()}pause(){c(this,p).input.pause(),this.emit("pause")}resume(){c(this,p).input.resume(),this.emit("resume")}write(e,i){c(this,p).output.write(""+e,i)}writeln(e,i){c(this,p).output.write(e+` -`,i)}clear(){c(this,p).output.clear(),this.emit("clear")}clearLast(){c(this,p).output.clearLast()}get history(){return c(this,p).history.list||[]}set history(e){e.forEach(i=>c(this,p).history.add(i))}clearHistory(){c(this,p).history.clear()}setCompleter(e){$(e)&&(c(this,p).completer=e)}mount(e){if(!this.isMounted){if(e&&typeof e=="string"&&(e=document.querySelector(e)),!(e instanceof HTMLElement))throw new Ct("mount: A parent HTMLElement (target) is required");!e.isConnected&&console&&console.warn("'mount' was called on an HTMLElement (target) that is not attached to DOM."),e.innerHTML="",y(this,p,Pt(this,e)),this.isMounted=!0}}dispose(){var r;super.dispose();const e=c(this,p);e.history.clear(),e.completer=void 0,e.input.dispose();const i=e.output.el.parentNode;(r=i==null?void 0:i.parentNode)==null||r.removeChild(i)}static get version(){return"2.1.7"}static get XEventEmitter(){return it}}p=new WeakMap;/** - * viteshell - v0.6.2 + */var F,gt;let vt=(gt=class{constructor(){v(this,F,void 0);h(this,"isDisposed");this.isDisposed=!1,y(this,F,[])}register(t){this.isDisposed?t==null||t.dispose():c(this,F).push(t)}dispose(){this.isDisposed||(this.isDisposed=!0,c(this,F).forEach(t=>t==null?void 0:t.dispose()))}},F=new WeakMap,gt);var x,mt;let rt=(mt=class extends vt{constructor(){super();v(this,x,void 0);y(this,x,{stack:[],store:new Map}),this.register({dispose:()=>c(this,x).store.clear()})}on(e,i){var n;const r=c(this,x).store;r.has(e)?(n=r.get(e))==null||n.add(i):r.set(e,new Set([i]))}once(e,i){var o;const r=(...a)=>{i.call(void 0,...a),this.off(e,r)},n=c(this,x).store;n.has(e)?(o=n.get(e))==null||o.add(r):n.set(e,new Set([r]))}off(e,i){const r=c(this,x).store.get(e);if(r){for(const n of r)if(n===i){r.delete(i);break}}}emit(e,...i){if(this.isDisposed)return;const r=c(this,x).stack;if(r.includes(e))return;const n=c(this,x).store.get(e);if(n){r.push(e);for(const o of n)o.call(void 0,...i);r.pop()}}},x=new WeakMap,mt);const yt=Array.isArray;function nt(s){return typeof s=="object"&&s!==null}function $(s){return typeof s=="function"}let Ot=class{constructor(t=[]){h(this,"store");h(this,"ptr");this.store=yt(t)?t:[],this.ptr=-1}get size(){return this.store.length}get list(){return[].slice.call(this.store).reverse()}add(t){t&&t!==this.store[0]&&this.store.unshift(t),this.ptr=-1}get previous(){return this.ptr++,this.ptr>=this.size&&(this.ptr=this.size-1),this.store[this.ptr]||""}get next(){return this.ptr--,this.ptr<=-1&&(this.ptr=-1),this.store[this.ptr]||""}clear(){this.store.splice(0)}};const N=" ",$t="xt",ot="xt-inactive",kt="xt-cursor",Tt="xt-stdout",Mt="xt-stdin";function at(s){s&&s.scrollTo(0,s.scrollHeight)}function S(s,t){const e=document.createElement(s);return nt(t)&&(t!=null&&t.id&&(e.id=t.id||""),t!=null&&t.class&&(e.className=t.class||""),t!=null&&t.content&&e.appendChild(document.createTextNode(""+t.content)),t!=null&&t.html&&(e.innerHTML=t.html),yt(t==null?void 0:t.children)&&t.children.forEach(i=>e.append(i)),nt(t==null?void 0:t.props)&&Object.entries(t.props).forEach(i=>e.setAttribute(i[0],i[1]))),e}function Nt(s=""){return(""+s).replace(/(\n)|(\n\r)|(\r\n)/g,"
").replace(/\s{2}/g,N.repeat(2)).replace(/\t/g,N.repeat(4))}let Lt=class{constructor(t){h(this,"el");h(this,"console");h(this,"lastOutput");h(this,"onoutput");const{outputBox:e,consoleBox:i}=function(r){const n=S("span"),o=S("div",{class:Tt,children:[n]});return r.appendChild(o),{outputBox:o,consoleBox:n}}(t);this.el=e,this.console=i}write(t,e){this.lastOutput=S("span",{html:Nt(t)}),this.console.appendChild(this.lastOutput),$(this.onoutput)&&this.onoutput(),$(e)&&e()}clear(){this.console&&(this.console.innerHTML="")}clearLast(){var t;this.lastOutput&&((t=this.lastOutput.parentNode)==null||t.removeChild(this.lastOutput)),this.lastOutput=void 0}};const wt="Enter";function O(s,t,e,i){s.addEventListener(t,e,i);let r=!1;return{dispose(){r||(s.removeEventListener(t,e,i),r=!0)}}}const Pt=0;function bt(s,...t){return setTimeout(s,Pt,...t)}function ct(s){let t;return(...e)=>{$(s)&&(clearTimeout(t),t=bt(s,...e))}}let X;function j(s){const t=new Set;let e=!1;return{get value(){return!e&&$(X)&&t.add(X),s},set value(i){s=i,e||t.forEach(r=>r.call(void 0))},dispose(){e||(e=!0,t.clear())}}}function Q(s){if($(s)){X=s;try{s.call(void 0)}finally{X=null}}}class Ct extends vt{constructor(e){super();h(this,"el");h(this,"buffer");h(this,"data");h(this,"ptr");h(this,"isActive");h(this,"showInput");h(this,"isFocused");h(this,"onkeypress");this.el=function(o){const a=S("input",{props:{spellcheck:!1,autocapitalize:"off",autocomplete:"off"}}),l=S("div",{class:Mt,children:[a]});return o.appendChild(l),a}(e),this.buffer="",this.data=j(""),this.ptr=j(0),this.isActive=j(!0),this.showInput=j(!0),this.isFocused=j(!1),this.register(this.data),this.register(this.ptr),this.register(this.isActive),this.register(this.showInput),this.register(this.isFocused);const i=()=>function(o,a,l){let d="selectionStart"in(u=o)?u.selectionStart:0;var u;const m=a.value.length;d>m?d=m:d<0&&(d=0),l.value=d}(this.el,this.data,this.ptr),r=ct(i),n=ct(()=>{this.data.value=this.buffer=this.el.value});Q(i),this.register(O(this.el,"blur",()=>this.isFocused.value=!1)),this.register(O(this.el,"focus",()=>this.isFocused.value=!0,!1)),this.register(O(this.el,"keyup",()=>this.isActive.value&&r(),!1)),this.register(O(this.el,"input",()=>{n(),r()})),this.register(O(this.el,"keydown",o=>{o.stopImmediatePropagation();const a=this.data.value;o.key===wt&&(this.el&&(this.el.value=""),this.data.value="",this.buffer="",this.showInput.value=!0),this.isActive.value&&$(this.onkeypress)&&(this.onkeypress({key:o.key,altKey:o.altKey,ctrlKey:o.ctrlKey,metaKey:o.metaKey,shiftKey:o.shiftKey,value:a,cancel(){o.preventDefault(),o.stopPropagation()}}),r())}))}blur(){this.el&&this.el.blur()}focus(){this.el&&this.el.focus()}pause(){this.isActive.value=!1}resume(){this.isActive.value=!0}setValue(e){e=e||this.buffer,this.el&&(this.el.value=e),this.data.value=e}pipe(e){var o;const i=S("span"),r=S("span",{class:kt,html:N}),n=S("span");(o=e.el)==null||o.append(i,r,n),Q(()=>{const a=this.ptr.value,l=this.data.value;if(!this.isActive.value||!this.showInput.value)return i.innerHTML="",r.innerHTML=N,void(n.innerHTML="");i.innerHTML=l.substring(0,a).replace(/\s{2}/g," "+N),r.innerHTML=l.substring(a,a+1).trim()||N,n.innerHTML=l.substring(a+1).replace(/\s{2}/g," "+N)})}}function Dt(s,t){const e=S("div",{class:$t,props:{tabindex:0}}),i=new Ot,r=new Lt(e),n=new Ct(e),o={input:n,output:r,history:i,completer:a=>a};return n.pipe(r),r.onoutput=()=>at(e),s.register(O(e,"keydown",function(a){n.focus(),bt(()=>{n.el.dispatchEvent(new KeyboardEvent("keydown",a)),n.el.dispatchEvent(new KeyboardEvent("input",a))})})),s.register(O(e,"focus",()=>n.isFocused.value=!0)),s.register(O(e,"blur",()=>n.isFocused.value=!1)),function(){const a=window||{},l=navigator||{};return!(!("ontouchstart"in a)&&!l.maxTouchPoints||!/Mobi/.test(l.userAgent))}()&&s.register(O(e,"click",n.focus.bind(n))),t.appendChild(e),n.onkeypress=a=>{a.key==wt?(a.cancel(),i.add(a.value),s.writeln(a.value),s.emit("data",a.value)):a.key=="Tab"?(a.cancel(),$(o.completer)&&n.setValue(o.completer(a.value))):a.key=="ArrowDown"?(a.cancel(),n.setValue(i.next)):a.key=="ArrowUp"?(a.cancel(),n.setValue(i.previous)):s.emit("keypress",a),at(e)},Q(()=>{n.isFocused.value?e.classList.remove(ot):e.classList.add(ot)}),o}class Ft extends Error{constructor(t){super(t="[x] "+t),this.name="XTerminalError"}}var p;class Ht extends rt{constructor(e){super();v(this,p,void 0);h(this,"isMounted");this.isMounted=!1,e&&(e!=null&&e.target)&&this.mount(e.target)}focus(){c(this,p).input.focus()}blur(){c(this,p).input.blur()}pause(){c(this,p).input.pause(),this.emit("pause")}resume(){c(this,p).input.resume(),this.emit("resume")}write(e,i){c(this,p).output.write(""+e,i)}writeln(e,i){c(this,p).output.write(e+` +`,i)}clear(){c(this,p).output.clear(),this.emit("clear")}clearLast(){c(this,p).output.clearLast()}get history(){return c(this,p).history.list||[]}set history(e){e.forEach(i=>c(this,p).history.add(i))}clearHistory(){c(this,p).history.clear()}setCompleter(e){$(e)&&(c(this,p).completer=e)}mount(e){if(!this.isMounted){if(e&&typeof e=="string"&&(e=document.querySelector(e)),!(e instanceof HTMLElement))throw new Ft("mount: A parent HTMLElement (target) is required");!e.isConnected&&console&&console.warn("'mount' was called on an HTMLElement (target) that is not attached to DOM."),e.innerHTML="",y(this,p,Dt(this,e)),this.isMounted=!0}}dispose(){var r;super.dispose();const e=c(this,p);e.history.clear(),e.completer=void 0,e.input.dispose();const i=e.output.el.parentNode;(r=i==null?void 0:i.parentNode)==null||r.removeChild(i)}static get version(){return"2.1.7"}static get XEventEmitter(){return rt}}p=new WeakMap;/** + * viteshell - v0.6.4 * @author Henry Hale * @license MIT * @url https://github.com/henryhale/viteshell - */function M(s){return typeof s=="function"}function Q(){return Math.floor(1024*Math.random()*50)}class Ft{constructor(){h(this,"buffer");h(this,"extractor");this.buffer=[],this.extractor=void 0}get isBusy(){return this.extractor!==void 0}insert(t=""){this.buffer.push(t),M(this.extractor)&&this.extractor.call(void 0)}get extract(){var t;return((t=this.buffer.shift())==null?void 0:t.trim())||""}readline(){return new Promise(t=>{this.buffer.length?t(this.extract):this.extractor=()=>{this.extractor=void 0,t(this.extract)}})}clear(){this.buffer.splice(0)}}class Ht{constructor(){h(this,"isActive");h(this,"bufferOutput");h(this,"buffer");h(this,"onoutput");h(this,"onerror");h(this,"onclear");this.isActive=!0,this.bufferOutput=!1,this.buffer=[]}disable(){this.isActive=!1}enable(){this.isActive=!0}clear(){var t;(t=this.onclear)==null||t.call(void 0)}write(t,e="data"){var i;this.isActive&&(t=t==null?void 0:t.toString(),this.bufferOutput?this.buffer.push({type:e,data:t}):(i=e=="data"?this.onoutput:this.onerror)==null||i.call(void 0,t))}error(t){this.write(t,"error")}get extract(){return this.buffer.splice(0).map(t=>t.data+"")}flush(){this.bufferOutput=!1,this.buffer.length&&this.buffer.splice(0).forEach(t=>{t.type==="error"?this.error(t.data):this.write(t.data)})}reset(){this.flush(),this.enable()}}const tt="v0.6.2",C="vsh",U="?",ct=C+": process aborted!",It=C+": process timed out!",jt=C+": process terminated!",lt="RANDOM",Rt=C+": inactive, use shell.init() to activate",Kt={SHELL:C,USERNAME:"user",HOSTNAME:"web",CWD:"/",PS1:"$USERNAME@$HOSTNAME: $CWD $ ",PS2:"> ","?":"0",RANDOM:""+Q()};function _(s,t=""){let e;return(""+t).replace(/(?:\$([a-z_][a-z0-9_]+|\?))/gi,i=>(e=s[i.slice(1)],e===void 0?"":e.toString()))}function ut(s){return s.match(/^([a-zA-Z0-9_]+)=(.*)$/)}function et(s,t){if(s)return t&&s.AND?s.AND:!t&&s.OR?s.OR:et(s.AND,t)||et(s.OR,t)}const R=[";","|","&&","||"];function W(s){const t={cmd:"",args:"",argv:[],PIPE:void 0,AND:void 0,OR:void 0};t.cmd=s.shift()||"";const e=s.findIndex(i=>R.slice(1).includes(i));return e===-1?(t.argv=s.splice(0),t.args=(t.cmd+" "+t.argv.join(" ")).trim(),t):(t.argv=s.splice(0,e),t.args=(t.cmd+" "+t.argv.join(" ")).trim(),s[0]===R[1]&&(t.PIPE=W(s.splice(1))),s[0]===R[2]&&(t.AND=W(s.splice(1))),s[0]===R[3]&&(t.OR=W(s.splice(1))),t)}function Bt(s){return function(t){const e=[];if(!t||typeof t!="string")return e;const i=[];let r,n=!1,o=!1,a=!1,l=!1,d="";if(R.some(u=>t.startsWith(r=u)||t.endsWith(u)))throw new SyntaxError("unexpected token '"+r+"'");if(t.split("").forEach((u,m,B)=>{if(n&&u==="'")return n=!1,void(l=!0);if(!n&&!o&&!a){if(u==="'")return void(n=!0);if(u==='"')return void(o=!0);if(u==="\\")return void(a=!0);if(["\b","\f",` -`,"\r"," "," ",";"].includes(u))return(d.length>0||l)&&(i.push(d),l=!1),u===";"&&i.length&&e.push(i.splice(0)),void(d="")}if(!n&&o&&!a&&u==='"')return o=!1,void(l=!0);!n&&o&&!a&&u==="\\"&&(a=!0,['"',"`","$","\\"].includes(B[m+1]))||(a&&(a=!1),d+=u)}),(d.length>0||l)&&(i.push(d),l=!1),i.length&&e.push(i),o)throw new SyntaxError("unexpected end of string while looking for matching double quote");if(n)throw new SyntaxError("unexpected end of string while looking for matching single quote");if(a)throw new SyntaxError("unexpected end of string right after slash");return e}(s).map(t=>W(t))}function zt(s,t,e,i){let r=!1;const n={readline:t.readline.bind(t)},o={clear:()=>!r&&e.clear(),write:l=>{r||e.write(_(s.env,l))},writeln:l=>o.write(l+` + */function M(s){return typeof s=="function"}function tt(){return Math.floor(1024*Math.random()*50)}class It{constructor(){h(this,"buffer");h(this,"extractor");this.buffer=[],this.extractor=void 0}get isBusy(){return this.extractor!==void 0}insert(t=""){this.buffer.push(t),M(this.extractor)&&this.extractor.call(void 0)}get extract(){var t;return((t=this.buffer.shift())==null?void 0:t.trim())||""}readline(){return new Promise(t=>{this.buffer.length?t(this.extract):this.extractor=()=>{this.extractor=void 0,t(this.extract)}})}clear(){this.buffer.splice(0)}}class jt{constructor(){h(this,"isActive");h(this,"bufferOutput");h(this,"buffer");h(this,"onoutput");h(this,"onerror");h(this,"onclear");this.isActive=!0,this.bufferOutput=!1,this.buffer=[]}disable(){this.isActive=!1}enable(){this.isActive=!0}clear(){var t;(t=this.onclear)==null||t.call(void 0)}write(t,e="data"){var i;this.isActive&&(t=t==null?void 0:t.toString(),this.bufferOutput?this.buffer.push({type:e,data:t}):(i=e=="data"?this.onoutput:this.onerror)==null||i.call(void 0,t))}error(t){this.write(t,"error")}get extract(){return this.buffer.splice(0).map(t=>t.data+"")}flush(){this.bufferOutput=!1,this.buffer.length&&this.buffer.splice(0).forEach(t=>{t.type==="error"?this.error(t.data):this.write(t.data)})}reset(){this.flush(),this.enable()}}const et="v0.6.4",C="vsh",U="?",lt=C+": process aborted!",Rt=C+": process timed out!",Kt=C+": process terminated!",ut="RANDOM",Bt=C+": inactive, use shell.init() to activate",zt={SHELL:C,USERNAME:"user",HOSTNAME:"web",CWD:"/",PS1:"$USERNAME@$HOSTNAME: $CWD $ ",PS2:"> ","?":"0",RANDOM:""+tt()};function _(s,t=""){let e;return(""+t).replace(/(?:\$([a-z_][a-z0-9_]+|\?))/gi,i=>(e=s[i.slice(1)],e===void 0?"":e.toString()))}function ht(s){return s.match(/^([a-zA-Z0-9_]+)=(.*)$/)}function st(s,t){if(s)return t&&s.AND?s.AND:!t&&s.OR?s.OR:st(s.AND,t)||st(s.OR,t)}const R=[";","|","&&","||"];function W(s){const t={cmd:"",args:"",argv:[],PIPE:void 0,AND:void 0,OR:void 0};t.cmd=s.shift()||"";const e=s.findIndex(i=>R.slice(1).includes(i));return e===-1?(t.argv=s.splice(0),t.args=(t.cmd+" "+t.argv.join(" ")).trim(),t):(t.argv=s.splice(0,e),t.args=(t.cmd+" "+t.argv.join(" ")).trim(),s[0]===R[1]&&(t.PIPE=W(s.splice(1))),s[0]===R[2]&&(t.AND=W(s.splice(1))),s[0]===R[3]&&(t.OR=W(s.splice(1))),t)}function Ut(s){return function(t){const e=[];if(!t||typeof t!="string")return e;const i=[];let r,n=!1,o=!1,a=!1,l=!1,d="";if(R.some(u=>t.startsWith(r=u)||t.endsWith(u)))throw new SyntaxError("unexpected token '"+r+"'");if(t.split("").forEach((u,m,B)=>{if(n&&u==="'")return n=!1,void(l=!0);if(!n&&!o&&!a){if(u==="'")return void(n=!0);if(u==='"')return void(o=!0);if(u==="\\")return void(a=!0);if(["\b","\f",` +`,"\r"," "," ",";"].includes(u))return(d.length>0||l)&&(i.push(d),l=!1),u===";"&&i.length&&e.push(i.splice(0)),void(d="")}if(!n&&o&&!a&&u==='"')return o=!1,void(l=!0);!n&&o&&!a&&u==="\\"&&(a=!0,['"',"`","$","\\"].includes(B[m+1]))||(a&&(a=!1),d+=u)}),(d.length>0||l)&&(i.push(d),l=!1),i.length&&e.push(i),o)throw new SyntaxError("unexpected end of string while looking for matching double quote");if(n)throw new SyntaxError("unexpected end of string while looking for matching single quote");if(a)throw new SyntaxError("unexpected end of string right after slash");return e}(s).map(t=>W(t))}function Wt(s,t,e,i){let r=!1;const n={readline:t.readline.bind(t)},o={clear:()=>!r&&e.clear(),write:l=>{r||e.write(_(s.env,l))},writeln:l=>o.write(l+` `)},a={write:l=>{r||e.error(_(s.env,l))},writeln:l=>a.write(l+` -`)};return{cmd:"",args:"",argv:[],get env(){return s.env},get stderr(){return a},get stdin(){return n},get stdout(){return o},get history(){return s.history},get version(){return tt},get exitCode(){return function(l,d=0){const u=parseInt(""+l);return isNaN(u)?d:u}(s.env[U])},exit:l=>{i.onAbort(()=>r=!0),i.abort(typeof l=="number"?""+l:l||jt)},onExit:i.onAbort.bind(i)}}function ht(){return{env:Object.assign(Object.create(null),Kt),alias:{},history:[]}}function dt(s){return JSON.parse(typeof s=="string"?s:JSON.stringify(s))}var f,L,w,A,P,b,K,H,V,I,q;class Ut{constructor(){v(this,H);v(this,I);v(this,f,void 0);v(this,L,void 0);v(this,w,void 0);v(this,A,void 0);v(this,P,void 0);v(this,b,void 0);v(this,K,void 0);var t,e;y(this,f,new Ht),y(this,L,new Ft),y(this,w,ht()),y(this,A,new Map),y(this,P,!1),y(this,b,function(){const i=new Set;let r=!1;return{abort:function(n){r||(r=!0,i.forEach(o=>o.call(void 0,n)))},onAbort:function(n){M(n)&&(r?n.call(void 0):i.add(n))},reset:function(){r=!1,i.size&&i.clear()},get isAborted(){return r}}}()),t=c(this,A),e=c(this,w),t.set("exit",{synopsis:"exit",description:"Terminate the current process",action:({exit:i})=>i()}),t.set("clear",{synopsis:"clear",description:"Clear the entire standard output stream.",action:({stdout:i})=>i.clear()}),e.alias.cls="clear",t.set("pwd",{synopsis:"pwd",description:"Print current working directory.",action:({stdout:i})=>i.writeln("$CWD")}),t.set("echo",{synopsis:"echo [...args]",description:"Write arguments to the standard output followed by a new line character.",action:({argv:i,stdout:r})=>r.writeln(i.join(" "))}),e.alias.print="echo",t.set("alias",{synopsis:"alias [-p] [name=[value] ... ]",description:"Defines aliases for commands",action:({argv:i,stdout:r})=>{!i.length||i.includes("-p")?(r.write("Aliases:"),Object.entries(e.alias).forEach(([n,o])=>{r.write(` +`)};return{cmd:"",args:"",argv:[],get env(){return s.env},get stderr(){return a},get stdin(){return n},get stdout(){return o},get history(){return s.history},get version(){return et},get exitCode(){return function(l,d=0){const u=parseInt(""+l);return isNaN(u)?d:u}(s.env[U])},exit:l=>{i.onAbort(()=>r=!0),i.abort(typeof l=="number"?""+l:l||Kt)},onExit:i.onAbort.bind(i)}}function dt(){return{env:Object.assign(Object.create(null),zt),alias:{},history:[]}}function pt(s){return JSON.parse(typeof s=="string"?s:JSON.stringify(s))}var f,L,w,A,P,b,K,H,V,I,q;class Vt{constructor(){v(this,H);v(this,I);v(this,f,void 0);v(this,L,void 0);v(this,w,void 0);v(this,A,void 0);v(this,P,void 0);v(this,b,void 0);v(this,K,void 0);var t,e;y(this,f,new jt),y(this,L,new It),y(this,w,dt()),y(this,A,new Map),y(this,P,!1),y(this,b,function(){const i=new Set;let r=!1;return{abort:function(n){r||(r=!0,i.forEach(o=>o.call(void 0,n)))},onAbort:function(n){M(n)&&(r?n.call(void 0):i.add(n))},reset:function(){r=!1,i.size&&i.clear()},get isAborted(){return r}}}()),t=c(this,A),e=c(this,w),t.set("exit",{synopsis:"exit",description:"Terminate the current process",action:({exit:i})=>i()}),t.set("clear",{synopsis:"clear",description:"Clear the entire standard output stream.",action:({stdout:i})=>i.clear()}),e.alias.cls="clear",t.set("pwd",{synopsis:"pwd",description:"Print current working directory.",action:({stdout:i})=>i.writeln("$CWD")}),t.set("echo",{synopsis:"echo [...args]",description:"Write arguments to the standard output followed by a new line character.",action:({argv:i,stdout:r})=>r.writeln(i.join(" "))}),e.alias.print="echo",t.set("alias",{synopsis:"alias [-p] [name=[value] ... ]",description:"Defines aliases for commands",action:({argv:i,stdout:r})=>{!i.length||i.includes("-p")?(r.write("Aliases:"),Object.entries(e.alias).forEach(([n,o])=>{r.write(` alias `+n+"='"+o+"'")}),r.write(` -`)):i.forEach(n=>{const o=ut(n);if(o){const[,a,l]=o;e.alias[a.trim()]=l.trim()}})}}),t.set("unalias",{synopsis:"unalias [name ... ]",description:"Removes aliases for commands",action:({argv:i})=>{i.length&&i.forEach(r=>{delete e.alias[r]})}}),t.set("export",{synopsis:"export [-p] [name=[value] ... ]",description:"Set shell variables by name and value",action:({argv:i,env:r,stdout:n})=>{!i.length||i.includes("-p")?Object.entries(r).forEach(([o,a])=>{n.write("var "+o+'="'+(a!=null&&a.toString().includes("$")?a.toString().split("").join("\\"):a)+`" -`)}):i.forEach(o=>{const a=ut(o);if(a){const[,l,d]=a;r[l.trim()]=d.trim()}})}}),t.set("history",{synopsis:"history [-c] [-n]",description:"Retrieve previous input entries",action:({argv:i,history:r,stdout:n})=>{i.includes("-c")?r.splice(0):i.includes("-n")?n.writeln(`History: ${r.length}`):r.forEach((o,a)=>{n.writeln(" "+a+" "+o)})}}),t.set("help",{synopsis:"help [command]",description:"Displays information on available commands.",action:({argv:i,stdout:r})=>{if(i[0]){const n=i[0],o=t.get(n);if(!o)throw"help: no information matching '"+n+"'";const{synopsis:a,description:l}=o;r.writeln(n+": "+a+` - `+l)}else r.write(`ViteShell, ${tt} Help +`)):i.forEach(n=>{const o=ht(n);if(o){const[,a,l]=o;e.alias[a.trim()]=l.trim()}})}}),t.set("unalias",{synopsis:"unalias [name ... ]",description:"Removes aliases for commands",action:({argv:i})=>{i.length&&i.forEach(r=>{delete e.alias[r]})}}),t.set("export",{synopsis:"export [-p] [name=[value] ... ]",description:"Set shell variables by name and value",action:({argv:i,env:r,stdout:n})=>{!i.length||i.includes("-p")?Object.entries(r).forEach(([o,a])=>{n.write("var "+o+'="'+(a!=null&&a.toString().includes("$")?a.toString().split("").join("\\"):a)+`" +`)}):i.forEach(o=>{const a=ht(o);if(a){const[,l,d]=a;r[l.trim()]=d.trim()}})}}),t.set("history",{synopsis:"history [-c] [-n]",description:"Retrieve previous input entries",action:({argv:i,history:r,stdout:n})=>{i.includes("-c")?r.splice(0):i.includes("-n")?n.writeln(`History: ${r.length}`):r.forEach((o,a)=>{n.writeln(" "+a+" "+o)})}}),t.set("help",{synopsis:"help [command]",description:"Displays information on available commands.",action:({argv:i,stdout:r})=>{if(i[0]){const n=i[0],o=t.get(n);if(!o)throw"help: no information matching '"+n+"'";const{synopsis:a,description:l}=o;r.writeln(n+": "+a+` + `+l)}else r.write(`ViteShell, ${et} Help A list of all available commands -`),Array.from(t.values()).map(n=>n.synopsis).sort().forEach(n=>r.writeln(n))}}),e.alias.info="help",e.alias.man="help",t.set("read",{synopsis:"read [prompt] [variable]",description:"Capture input and save it in the env object.",action:async({argv:i,env:r,stdin:n,stdout:o})=>{if(!i[0]||!i[1])throw"invalid arguments: specify the prompt and variable name";o.write(i[0]),r[i[1]]=await n.readline()}}),t.set("sleep",{synopsis:"sleep [seconds]",description:"Delay for a specified amount of time (in seconds).",action:async({argv:i})=>{const r=parseInt(i[0],10);if(isNaN(r)||r<=0)throw"invalid time specified (minimum is 1)";await new Promise(n=>setTimeout(()=>n(),1e3*r))}}),t.set("grep",{synopsis:"grep [keyword] [context ...]",description:"Searches for matching phrases in the text",action:async({argv:i,stdout:r})=>{if(i.length<2)throw"invalid arguments";const n=new RegExp(i[0],"g");i.slice(1).forEach(o=>{n.test(o)&&r.writeln(o.replaceAll(i[0],a=>"**"+a+"**"))})}})}get alias(){return c(this,w).alias}get env(){return c(this,w).env}get history(){return c(this,w).history}set onoutput(t){if(!M(t))throw new TypeError("onoutput handler must be a function.");c(this,f).onoutput=t}set onerror(t){if(!M(t))throw new TypeError("onerror handler must be a function.");c(this,f).onerror=t}set onclear(t){if(!M(t))throw new TypeError("onclear handler must be a function.");c(this,f).onclear=t}set onexit(t){if(!M(t))throw new TypeError("onexit handler must be a function.");c(this,b).onAbort(t)}addCommand(t,e){if(c(this,A).has(t))throw new Error(`${C}: '${t}' command already exists. If you are providing a custom command implementation, remove the command first.`);if(!function(i){return typeof(r=i)=="object"&&r!==null&&M(i.action)&&!!i.description&&!!i.synopsis;var r}(e))throw new Error(`${C}: invalid command configuration`);c(this,A).set(t,e)}removeCommand(t){c(this,A).delete(t)}exportState(){return JSON.stringify(c(this,w))}loadState(t){y(this,w,Object.assign(ht(),dt(t)))}init(t=""){c(this,P)||(y(this,P,!0),c(this,f).clear(),t&&(t=_(this.env,t+` -`),c(this,f).write(t)),T(this,H,V).call(this))}setExecutionTimeout(t){typeof t=="number"&&t>=0&&y(this,K,t)}async execute(t=""){if(!c(this,P))return Promise.reject(Rt);if(c(this,f).reset(),c(this,L).isBusy)return c(this,L).insert(t),Promise.resolve();if(typeof t!="string"||!t.trim())return T(this,H,V).call(this),Promise.resolve();(t=t.trim())!=this.history.at(-1)&&this.history.push(t);const e=dt(c(this,w));c(this,b).reset();const i=zt(e,c(this,L),c(this,f),c(this,b));return await function(r,n,o){function a(){return new Promise((d,u)=>{r.onAbort(m=>u(m||ct));try{n==null||n.call(void 0,d,u)}catch(m){u(m==null?void 0:m.toString())}})}if(!o)return a();let l;return Promise.race([l=a(),new Promise((d,u)=>{const m=setTimeout(()=>{r.abort(It)},o);function B(bt){m&&clearTimeout(m),u(bt)}l==null||l.catch(B),r.onAbort(B)})])}(c(this,b),async(r,n)=>{try{const l=Bt(t);for(const d of l){if(c(this,b).isAborted)throw ct;try{await T(this,I,q).call(this,d,i),e.env[U]="0",o=c(this,w),a=e,Object.assign(o.alias,a.alias),Object.assign(o.env,a.env),o.history.splice(0),o.history.push(...a.history)}catch(u){if(!(l.length>1))throw u;i.stderr.write(u+` +`),Array.from(t.values()).map(n=>n.synopsis).sort().forEach(n=>r.writeln(n))}}),e.alias.info="help",e.alias.man="help",t.set("read",{synopsis:"read [prompt] [variable]",description:"Capture input and save it in the env object.",action:async({argv:i,env:r,stdin:n,stdout:o})=>{if(!i[0]||!i[1])throw"invalid arguments: specify the prompt and variable name";o.write(i[0]),r[i[1]]=await n.readline()}}),t.set("sleep",{synopsis:"sleep [seconds]",description:"Delay for a specified amount of time (in seconds).",action:async({argv:i})=>{const r=parseInt(i[0],10);if(isNaN(r)||r<=0)throw"invalid time specified (minimum is 1)";await new Promise(n=>setTimeout(()=>n(),1e3*r))}}),t.set("grep",{synopsis:"grep [keyword] [context ...]",description:"Searches for matching phrases in the text",action:async({argv:i,stdout:r})=>{if(i.length<2)throw"invalid arguments";const n=new RegExp(i[0],"g");i.slice(1).forEach(o=>{n.test(o)&&r.writeln(o.replaceAll(i[0],a=>"**"+a+"**"))})}})}get alias(){return c(this,w).alias}get env(){return c(this,w).env}get history(){return c(this,w).history}set onoutput(t){if(!M(t))throw new TypeError("onoutput handler must be a function.");c(this,f).onoutput=t}set onerror(t){if(!M(t))throw new TypeError("onerror handler must be a function.");c(this,f).onerror=t}set onclear(t){if(!M(t))throw new TypeError("onclear handler must be a function.");c(this,f).onclear=t}set onexit(t){if(!M(t))throw new TypeError("onexit handler must be a function.");c(this,b).onAbort(t)}addCommand(t,e){if(c(this,A).has(t))throw new Error(`${C}: '${t}' command already exists. If you are providing a custom command implementation, remove the command first.`);if(!function(i){return typeof(r=i)=="object"&&r!==null&&M(i.action)&&!!i.description&&!!i.synopsis;var r}(e))throw new Error(`${C}: invalid command configuration`);c(this,A).set(t,e)}removeCommand(t){c(this,A).delete(t)}exportState(){return JSON.stringify(c(this,w))}loadState(t){y(this,w,Object.assign(dt(),pt(t)))}init(t=""){c(this,P)||(y(this,P,!0),c(this,f).clear(),t&&(t=_(this.env,t+` +`),c(this,f).write(t)),T(this,H,V).call(this))}setExecutionTimeout(t){typeof t=="number"&&t>=0&&y(this,K,t)}async execute(t=""){if(!c(this,P))return Promise.reject(Bt);if(c(this,f).reset(),c(this,L).isBusy)return c(this,L).insert(t),Promise.resolve();if(typeof t!="string"||!t.trim())return T(this,H,V).call(this),Promise.resolve();(t=t.trim())!=this.history.at(-1)&&this.history.push(t);const e=pt(c(this,w));c(this,b).reset();const i=Wt(e,c(this,L),c(this,f),c(this,b));return await function(r,n,o){function a(){return new Promise((d,u)=>{r.onAbort(m=>u(m||lt));try{n==null||n.call(void 0,d,u)}catch(m){u(m==null?void 0:m.toString())}})}if(!o)return a();let l;return Promise.race([l=a(),new Promise((d,u)=>{const m=setTimeout(()=>{r.abort(Rt)},o);function B(xt){m&&clearTimeout(m),u(xt)}l==null||l.catch(B),r.onAbort(B)})])}(c(this,b),async(r,n)=>{try{const l=Ut(t);for(const d of l){if(c(this,b).isAborted)throw lt;try{await T(this,I,q).call(this,d,i),e.env[U]="0",o=c(this,w),a=e,Object.assign(o.alias,a.alias),Object.assign(o.env,a.env),o.history.splice(0),o.history.push(...a.history)}catch(u){if(!(l.length>1))throw u;i.stderr.write(u+` `),e.env[U]="1"}}r()}catch(l){n(l)}var o,a},c(this,K)).catch(r=>{c(this,f).error(r+` -`),c(this,w).env[U]="1"}).finally(()=>{T(this,H,V).call(this)})}abort(t){c(this,b).abort(t)}static get version(){return tt}}f=new WeakMap,L=new WeakMap,w=new WeakMap,A=new WeakMap,P=new WeakMap,b=new WeakMap,K=new WeakMap,H=new WeakSet,V=function(){this.env[lt]=""+Q(),c(this,b).reset(),c(this,f).reset(),c(this,f).write(_(this.env,this.env.PS1))},I=new WeakSet,q=async function(t,e){const i=this.alias[t.cmd];if(i){const o=i.split(" ");t.cmd=o.shift()||"",o.length&&t.argv.unshift(...o),t.args=(t.cmd+" "+t.argv.join(" ")).trim()}const r=c(this,A).get(t.cmd);if(!r)throw t.cmd+": command not found";e.cmd=t.cmd,e.argv=t.argv,e.env[lt]=""+Q(),c(this,f).bufferOutput=t.PIPE!==void 0;let n="";try{await r.action.call(void 0,e)}catch(o){n=t.cmd+": "+o}if(t.PIPE&&(t.PIPE.argv.push(...c(this,f).extract),await T(this,I,q).call(this,t.PIPE,e)),t.OR||t.AND){const o=et(t,!n.length);o&&(n.length&&(e.stderr.writeln(n),n=""),await T(this,I,q).call(this,o,e))}if(n.length)throw n};const D=function(t,e){return function(){const i=arguments,r=arguments.length;let n=arguments[0];if(r===0)return"";if(r>1)for(let a=1;a':"")+(this.bold?"":"")+(this.underline?"":"")+(this.strikethrough?"":"")+(this.italic?"":"")+(this.value||"")+(this.italic?"":"")+(this.strikethrough?"":"")+(this.underline?"":"")+(this.bold?"":"")+(a?"":"")},toJSON(){return this.toString()}};return o[t]=e,o.value=n,o}},z={black:"#000000",red:"#FA5E5E",green:"#50FA7B",yellow:"#FEF08A",blue:"#60A5FA",magenta:"#FF79C6",cyan:"#67E8F9",white:"#FFFFFF",gray:"#71717A"},k={};k.bold=D("bold",!0);k.italic=D("italic",!0);k.underline=D("underline",!0);k.strikethrough=D("strikethrough",!0);k.dim=D("dim",!0);for(const s in z)Object.hasOwnProperty.call(z,s)&&(k[s]=D("fg",z[s]),k["bg"+s[0].toUpperCase()+s.slice(1)]=D("bg",z[s]));const{bold:Qt,italic:Wt,underline:te,strikethrough:ee,dim:Vt,black:se,red:J,green:st,yellow:ie,blue:re,magenta:ne,cyan:wt,white:oe,gray:qt,bgBlack:ae,bgRed:ce,bgGreen:le,bgYellow:ue,bgBlue:he,bgMagenta:de,bgCyan:pe,bgWhite:fe,bgGray:ge}=k,G={key:"viteshell",read(){return localStorage.getItem(this.key)},write(s){return localStorage.setItem(this.key,s)}};function Jt(){return`
+`),c(this,w).env[U]="1"}).finally(()=>{T(this,H,V).call(this)})}abort(t){c(this,b).abort(t)}static get version(){return et}}f=new WeakMap,L=new WeakMap,w=new WeakMap,A=new WeakMap,P=new WeakMap,b=new WeakMap,K=new WeakMap,H=new WeakSet,V=function(){this.env[ut]=""+tt(),c(this,b).reset(),c(this,f).reset(),c(this,f).write(_(this.env,this.env.PS1))},I=new WeakSet,q=async function(t,e){const i=this.alias[t.cmd];if(i){const o=i.split(" ");t.cmd=o.shift()||"",o.length&&t.argv.unshift(...o),t.args=(t.cmd+" "+t.argv.join(" ")).trim()}const r=c(this,A).get(t.cmd);if(!r)throw t.cmd+": command not found";e.cmd=t.cmd,e.argv=t.argv,e.env[ut]=""+tt(),c(this,f).bufferOutput=t.PIPE!==void 0;let n="";try{await r.action.call(void 0,e)}catch(o){n=t.cmd+": "+o}if(t.PIPE&&(t.PIPE.argv.push(...c(this,f).extract),await T(this,I,q).call(this,t.PIPE,e)),t.OR||t.AND){const o=st(t,!n.length);o&&(n.length&&(e.stderr.writeln(n),n=""),await T(this,I,q).call(this,o,e))}if(n.length)throw n};const D=function(t,e){return function(){const i=arguments,r=arguments.length;let n=arguments[0];if(r===0)return"";if(r>1)for(let a=1;a':"")+(this.bold?"":"")+(this.underline?"":"")+(this.strikethrough?"":"")+(this.italic?"":"")+(this.value||"")+(this.italic?"":"")+(this.strikethrough?"":"")+(this.underline?"":"")+(this.bold?"":"")+(a?"":"")},toJSON(){return this.toString()}};return o[t]=e,o.value=n,o}},z={black:"#000000",red:"#FA5E5E",green:"#50FA7B",yellow:"#FEF08A",blue:"#60A5FA",magenta:"#FF79C6",cyan:"#67E8F9",white:"#FFFFFF",gray:"#71717A"},k={};k.bold=D("bold",!0);k.italic=D("italic",!0);k.underline=D("underline",!0);k.strikethrough=D("strikethrough",!0);k.dim=D("dim",!0);for(const s in z)Object.hasOwnProperty.call(z,s)&&(k[s]=D("fg",z[s]),k["bg"+s[0].toUpperCase()+s.slice(1)]=D("bg",z[s]));const{bold:te,italic:qt,underline:ee,strikethrough:se,dim:Jt,black:ie,red:J,green:it,yellow:re,blue:ne,magenta:Z,cyan:Et,white:oe,gray:ft,bgBlack:ae,bgRed:ce,bgGreen:le,bgYellow:ue,bgBlue:he,bgMagenta:de,bgCyan:pe,bgWhite:fe,bgGray:ge}=k,G={key:"viteshell",read(){return localStorage.getItem(this.key)},write(s){return localStorage.setItem(this.key,s)}};function Xt(){return`
-${st("WELCOME TO THE COMMAND LINE INTERFACE")} +${it("WELCOME TO THE COMMAND LINE INTERFACE")} -${Vt(Wt("powered by")+"")} +${Jt(qt("powered by")+"")} -${qt(`ViteShell ~ Inken ~ XTerminal +${Z('ViteShell')} ${ft("~")} ${Z('Inken')} ${ft("~")} ${Z(`XTerminal `)} -
`}const g=new Ut,E=new Dt;g.onoutput=s=>{E.write(st(s).toString())};g.onerror=s=>{E.write(J(s).toString())};g.onclear=E.clear.bind(E);g.onexit=()=>{G.write(g.exportState()),E.dispose(),document.body.innerHTML="
The terminal process terminated with code: "+g.env["?"]+"
Reload
"};E.on("data",async s=>{await g.execute(s)});E.on("keypress",s=>{s.ctrlKey&&s.key.toLowerCase()==="c"&&(s.cancel(),g.abort())});g.env.PS1=""+J("┌[")+st("$USERNAME")+J("@")+wt("$HOSTNAME")+J(`] -└$`);g.alias.println="echo";g.addCommand("login",{synopsis:"login",description:"Demo login process",async action({env:s,stdin:t,stdout:e}){e.write("Username: ");const i=await t.readline();e.write("Token: ");const r=await t.readline();e.write("Logging in as "+wt(i)+` -`),s.USERNAME=i,s.TOKEN=r}});E.on("clear",()=>E.write(Jt()));E.mount("#app");window.onload=()=>{const s=G.read();s?g.loadState(s):G.write(g.exportState()),g.init()};window.onunload=()=>{G.write(g.exportState()),E.dispose()}; +
`}const g=new Vt,E=new Ht;g.onoutput=s=>{E.write(it(s).toString())};g.onerror=s=>{E.write(J(s).toString())};g.onclear=E.clear.bind(E);g.onexit=()=>{G.write(g.exportState()),E.dispose(),document.body.innerHTML="
The terminal process terminated with code: "+g.env["?"]+"
Reload
"};E.on("data",async s=>{await g.execute(s)});E.on("keypress",s=>{s.ctrlKey&&s.key.toLowerCase()==="c"&&(s.cancel(),g.abort())});g.env.PS1=""+J("┌[")+it("$USERNAME")+J("@")+Et("$HOSTNAME")+J(`] +└$`);g.alias.println="echo";g.addCommand("login",{synopsis:"login",description:"Demo login process",async action({env:s,stdin:t,stdout:e}){e.write("Username: ");const i=await t.readline();e.write("Token: ");const r=await t.readline();e.write("Logging in as "+Et(i)+` +`),s.USERNAME=i,s.TOKEN=r}});E.on("clear",()=>E.write(Xt()));E.mount("#app");window.onload=()=>{const s=G.read();s?g.loadState(s):G.write(g.exportState()),g.init()};window.onunload=()=>{G.write(g.exportState()),E.dispose()}; diff --git a/index.html b/index.html index 06fefa7..115f436 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,7 @@ XTERMINAL | INKEN | VITESHELL - +