notios
Version:
<br /> <img src="https://raw.githubusercontent.com/frouriojs/notios/main/docs/assets/images/ogp.svg" width="1280" alt="notios" />
8 lines • 395 kB
JavaScript
var Oe=Object.defineProperty;var Eo=Object.getOwnPropertyDescriptor;var Vo=Object.getOwnPropertyNames;var Do=Object.prototype.hasOwnProperty;var o=(e,t)=>Oe(e,"name",{value:t,configurable:!0}),ht=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,r)=>(typeof require!="undefined"?require:t)[r]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var Fo=(e,t)=>()=>(e&&(t=e(e=0)),t);var Wo=(e,t)=>{for(var r in t)Oe(e,r,{get:t[r],enumerable:!0})},Ko=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of Vo(t))!Do.call(e,c)&&c!==r&&Oe(e,c,{get:()=>t[c],enumerable:!(n=Eo(t,c))||n.enumerable});return e};var zo=e=>Ko(Oe({},"__esModule",{value:!0}),e);var At={};Wo(At,{author:()=>vt,bin:()=>Ut,default:()=>Go,dependencies:()=>Ot,description:()=>St,devDependencies:()=>Bt,keywords:()=>Pt,license:()=>kt,name:()=>Tt,scripts:()=>Lt,type:()=>Nt,version:()=>wt});var Tt,wt,Nt,St,Pt,kt,vt,Ut,Lt,Ot,Bt,Go,Ct=Fo(()=>{Tt="notios",wt="0.5.3",Nt="module",St="",Pt=["notios","npm","npm-scripts","ui","TUI"],kt="MIT",vt="Frourio Inc.",Ut={"n-npm-run-all":"./bin/npm-run-all","n-run-p":"./bin/run-p","n-run-s":"./bin/run-s",notios:"./bin/notios","npm-run-all":"./bin/npm-run-all","run-p":"./bin/run-p","run-s":"./bin/run-s"},Lt={build:"run-p build:*","build:libs":'pnpm run "--filter=./libs/*" build',"build:notios":"tsx ./scripts/build.ts --from-dir ./src/entrypoints --to-dir ./build --clean --target es2020",typecheck:"run-p typecheck:*","typecheck:notios":"tsc --noEmit","typecheck:libs":'pnpm run "--filter=./libs/*" typecheck',dev:"run-p dev:*","dev:libs":'pnpm run "--filter=./libs/*" build-dev',"dev:notios":"pnpm run build:notios --watch",test:"run-p test:*","test:libs":'pnpm run "--filter=./libs/*" test',lint:'eslint && prettier --check "./**/*.{js,ts,tsx}"',"lint:fix":'eslint --fix && prettier --check "./**/*.{js,ts,tsx}" --write'},Ot={commander:"^12.1.0","cross-spawn":"7.0.3",ink:"^5.0.1","node-ipc":"10.1.0","npm-run-all":"4.1.5",pidtree:"^0.5.0",react:"^18.3.1","source-map-support":"^0.5.21","string-length":"^5.0.1","string-width":"^7.2.0",wcwidth:"^1.0.1","xdg-portable":"10.6.0"},Bt={"@changesets/changelog-github":"^0.4.3","@changesets/cli":"^2.21.1","@types/cross-spawn":"^6.0.2","@types/node":"^17.0.21","@types/node-ipc":"^9.2.0","@types/react":"^18.3.3","@types/source-map-support":"^0.5.4","@types/wcwidth":"^1.0.0","ansi-parser":"workspace:*",arg:"^5.0.1","better-typescript-lib":"^2.0.0",c8:"^7.11.0",esbuild:"^0.14.34","esbuild-node-externals":"^1.14.0",eslint:"^9.6.0","eslint-config-prettier":"^8.5.0","eslint-import-resolver-node":"^0.3.6","eslint-import-resolver-typescript":"^2.7.0","eslint-plugin-import":"^2.25.4","eslint-plugin-react":"^7.34.3","eslint-plugin-react-hooks":"^4.3.0",globals:"^15.8.0","ink-testing-library":"^2.1.0",prettier:"^2.6.0","prettier-plugin-organize-imports":"^2.3.4",tsx:"^4.16.2",typescript:"^5.5.3","typescript-eslint":"^7.16.0",vitest:"^0.6.0"},Go={name:Tt,version:wt,type:Nt,description:St,keywords:Pt,license:kt,author:vt,bin:Ut,scripts:Lt,dependencies:Ot,devDependencies:Bt}});import ni from"source-map-support";import{program as ne}from"commander";import qo from"fs";import Ie from"path";import Jo from"xdg-portable";import we from"fs";import je from"path";var xt=o(e=>{try{return we.accessSync(e,we.constants.X_OK),!0}catch{return!1}},"executable"),Ho=o(({cwd:e})=>we.existsSync(je.resolve(e,"package-lock.json"))?"npm":xt("yarn")&&we.existsSync(je.resolve(e,"yarn.lock"))?"yarn":xt("pnpm")&&we.existsSync(je.resolve(e,"pnpm-lock.yaml"))?"pnpm":"npm","detectNpmClient"),Be=Ho;import jo from"assert";var Ge=Symbol("error hint"),ie=o((e,t)=>{try{return e()}catch(r){throw jo(r instanceof Error),Object.assign(r,{[Ge]:t})}},"tryWithHint"),bt=o(e=>{try{e()}catch(t){if(t instanceof Error&&Ge in t){let r=t[Ge];console.error(t),console.error("[NOTIOS ERROR HINT] %s",r)}else console.error(t);process.exit(1)}},"catchWithHint");var It=o(()=>{let e=Ie.resolve(Jo.config(),"notios","notios.config.cjs");ne.option("--manifest <string>","package.json path","package.json"),ne.option("--no-color","force to suppress coloring"),ne.option("--config <string>","notios config file location",e),ne.name("notios"),ne.argument("[run-script-name...]"),ne.version((Ct(),zo(At)).version,"-v, --version"),ne.parse();let t=ne.args,r=ne.opts(),n=!r.color,c=Ie.resolve(process.cwd(),r.manifest),s=Ie.relative(process.cwd(),c),a=Ie.resolve(process.cwd(),r.config),x=ie(()=>qo.readFileSync(c).toString(),`Failed to read file ${JSON.stringify(c)}.
Please check existense of file and access permissions.`),y=ie(()=>JSON.parse(x),`Failed to parse file ${JSON.stringify(c)} as json.`),h=ie(()=>Object.entries(y.scripts).map(([u,m])=>{if(typeof m!="string")throw new TypeError("command is not string");return{name:u,command:m}}),`Manifest json ${JSON.stringify(c)} does not have scripts section correctly.
Please check the npm documentation for more information: https://docs.npmjs.com/misc/scripts/`);return t.forEach(u=>{ie(()=>{if(!(u in y.scripts))throw new Error("no such script")},`Manifest json ${JSON.stringify(c)} does not have such script: ${JSON.stringify(u)}`)}),{forceNoColor:n,manifestFullPath:c,manifestRelativePath:s,initialScriptNames:t,scripts:h,npmClient:Be({cwd:process.cwd()}),configFileFullPath:a}},"setupArgs");var Yo=o(e=>{switch(e){case"black":return 0;case"red":return 1;case"green":return 2;case"yellow":return 3;case"blue":return 4;case"magenta":return 5;case"cyan":return 6;case"white":return 7}},"colorIndexOf"),Q=Yo;var Zo=o(()=>({actionType:"controll",char:"\0",byte:0,symbol:"NUL"}),"ansiActionControll00"),Xo=o(()=>({actionType:"controll",char:"",byte:1,symbol:"SOH"}),"ansiActionControll01"),Qo=o(()=>({actionType:"controll",char:"",byte:2,symbol:"STX"}),"ansiActionControll02"),Ro=o(()=>({actionType:"controll",char:"",byte:3,symbol:"ETX"}),"ansiActionControll03"),er=o(()=>({actionType:"controll",char:"",byte:4,symbol:"EOT"}),"ansiActionControll04"),tr=o(()=>({actionType:"controll",char:"",byte:5,symbol:"ENQ"}),"ansiActionControll05"),or=o(()=>({actionType:"controll",char:"",byte:6,symbol:"ACK"}),"ansiActionControll06"),rr=o(()=>({actionType:"controll",char:"\x07",byte:7,symbol:"BEL"}),"ansiActionControll07"),nr=o(()=>({actionType:"controll",char:"\b",byte:8,symbol:"BS"}),"ansiActionControll08"),ir=o(()=>({actionType:"controll",char:" ",byte:9,symbol:"HT"}),"ansiActionControll09"),sr=o(()=>({actionType:"controll",char:`
`,byte:10,symbol:"LF"}),"ansiActionControll0a"),cr=o(()=>({actionType:"controll",char:"\v",byte:11,symbol:"VT"}),"ansiActionControll0b"),ar=o(()=>({actionType:"controll",char:"\f",byte:12,symbol:"FF"}),"ansiActionControll0c"),lr=o(()=>({actionType:"controll",char:"\r",byte:13,symbol:"CR"}),"ansiActionControll0d"),pr=o(()=>({actionType:"controll",char:"",byte:14,symbol:"SO"}),"ansiActionControll0e"),ur=o(()=>({actionType:"controll",char:"",byte:15,symbol:"SI"}),"ansiActionControll0f"),dr=o(()=>({actionType:"controll",char:"",byte:16,symbol:"DLE"}),"ansiActionControll10"),mr=o(()=>({actionType:"controll",char:"",byte:17,symbol:"DC1"}),"ansiActionControll11"),fr=o(()=>({actionType:"controll",char:"",byte:18,symbol:"DC2"}),"ansiActionControll12"),yr=o(()=>({actionType:"controll",char:"",byte:19,symbol:"DC3"}),"ansiActionControll13"),gr=o(()=>({actionType:"controll",char:"",byte:20,symbol:"DC4"}),"ansiActionControll14"),hr=o(()=>({actionType:"controll",char:"",byte:21,symbol:"NAK"}),"ansiActionControll15"),xr=o(()=>({actionType:"controll",char:"",byte:22,symbol:"SYN"}),"ansiActionControll16"),br=o(()=>({actionType:"controll",char:"",byte:23,symbol:"ETB"}),"ansiActionControll17"),Ar=o(()=>({actionType:"controll",char:"",byte:24,symbol:"CAN"}),"ansiActionControll18"),Cr=o(()=>({actionType:"controll",char:"",byte:25,symbol:"EM"}),"ansiActionControll19"),Tr=o(()=>({actionType:"controll",char:"",byte:26,symbol:"SUB"}),"ansiActionControll1a"),wr=o(()=>({actionType:"controll",char:"\x1B",byte:27,symbol:"ESC"}),"ansiActionControll1b"),Nr=o(()=>({actionType:"controll",char:"",byte:28,symbol:"FS"}),"ansiActionControll1c"),Sr=o(()=>({actionType:"controll",char:"",byte:29,symbol:"GS"}),"ansiActionControll1d"),Pr=o(()=>({actionType:"controll",char:"",byte:30,symbol:"RS"}),"ansiActionControll1e"),kr=o(()=>({actionType:"controll",char:"",byte:31,symbol:"US"}),"ansiActionControll1f"),$t=o(()=>[Zo(),Xo(),Qo(),Ro(),er(),tr(),or(),rr(),nr(),ir(),sr(),cr(),ar(),lr(),pr(),ur(),dr(),mr(),fr(),yr(),gr(),hr(),xr(),br(),Ar(),Cr(),Tr(),wr(),Nr(),Sr(),Pr(),kr()],"ansiActionControllList");var vr=o(e=>{if(e<16)switch(e){case 0:return{colorType:"8bit",color8bitType:"standard",colorName:"black"};case 1:return{colorType:"8bit",color8bitType:"standard",colorName:"red"};case 2:return{colorType:"8bit",color8bitType:"standard",colorName:"green"};case 3:return{colorType:"8bit",color8bitType:"standard",colorName:"yellow"};case 4:return{colorType:"8bit",color8bitType:"standard",colorName:"blue"};case 5:return{colorType:"8bit",color8bitType:"standard",colorName:"magenta"};case 6:return{colorType:"8bit",color8bitType:"standard",colorName:"cyan"};case 7:return{colorType:"8bit",color8bitType:"standard",colorName:"white"};case 8:return{colorType:"8bit",color8bitType:"high_intensity",colorName:"black"};case 9:return{colorType:"8bit",color8bitType:"high_intensity",colorName:"red"};case 10:return{colorType:"8bit",color8bitType:"high_intensity",colorName:"green"};case 11:return{colorType:"8bit",color8bitType:"high_intensity",colorName:"yellow"};case 12:return{colorType:"8bit",color8bitType:"high_intensity",colorName:"blue"};case 13:return{colorType:"8bit",color8bitType:"high_intensity",colorName:"magenta"};case 14:return{colorType:"8bit",color8bitType:"high_intensity",colorName:"cyan"};case 15:default:return{colorType:"8bit",color8bitType:"high_intensity",colorName:"white"}}else if(e<232){let t=(e-16)%6,r=Math.floor((e-16)/6)%6,n=Math.floor((e-16)/36);return{colorType:"8bit",color8bitType:"rgb",r:n,g:r,b:t}}else return{colorType:"8bit",color8bitType:"grayscale",lightness:e-232}},"decodeAnsiColor8bit"),$e=vr;var i=o(()=>({waitingBytes:Uint8Array.from([])}),"defaultAnsiParser"),qe=i;var _e=o(e=>e.length<3?!0:e.length>3?!1:e<"256","lessThan256"),Ne=o(e=>48<=e&&e<=57?e-48:null,"decodeNumberByte"),Se=o(e=>{let t=0;for(;t<e.length&&e[t]===48;)t+=1;return e.length>=1&&e.length<=t?"0":(e=e.slice(t),e.map(r=>`${r-48}`).join(""))},"decodeIntegerBytes"),Ur=o((e,t)=>{let r=Array.from(e.waitingBytes);r.push(t);let n=Array.from(e.waitingBytes),c=r[r.length-1];if(t<=255&&n.push(t),r[0]!==27)return r[0]<32?[i(),$t()[r[0]]]:[i(),{actionType:"print",byte:r[0]}];if(r.length<=1)return[{waitingBytes:Uint8Array.from(n)},{actionType:"noop"}];if(r[1]!==91)return 48<=c&&c<=126?[i(),{actionType:"unknown",unknownBytes:Uint8Array.from(n)}]:[{waitingBytes:Uint8Array.from(n)},{actionType:"noop"}];let s=2;for(;r.length>s&&Ne(r[s])!==null;)s+=1;let a=Se(r.slice(2,s));if(r.length<=s)return 3<=r.length&&64<=c&&c<=126?[i(),{actionType:"unknown",unknownBytes:Uint8Array.from(n)}]:[{waitingBytes:Uint8Array.from(n)},{actionType:"noop"}];switch(r[s]){case 65:return[i(),{actionType:"cuu",cells:a}];case 66:return[i(),{actionType:"cud",cells:a}];case 67:return[i(),{actionType:"cuf",cells:a}];case 68:return[i(),{actionType:"cub",cells:a}];case 69:return[i(),{actionType:"cnl",cells:a}];case 70:return[i(),{actionType:"cpl",cells:a}];case 71:return[i(),{actionType:"cha",column:a}];case 72:return[i(),{actionType:"cup",row:a,column:null}];case 74:switch(a){case"":case"0":case"1":case"2":case"3":return[i(),{actionType:"ed",eraseInDisplayType:a}];default:return[i(),{actionType:"unknown",unknownBytes:Uint8Array.from(n)}]}case 75:switch(a){case"":case"0":case"1":case"2":return[i(),{actionType:"el",eraseInLineType:a}];default:return[i(),{actionType:"unknown",unknownBytes:Uint8Array.from(n)}]}case 83:return[i(),{actionType:"su",n:a}];case 84:return[i(),{actionType:"sd",n:a}];case 105:switch(a){case"4":return[i(),{actionType:"aux_port",auxPort:!1}];case"5":return[i(),{actionType:"aux_port",auxPort:!0}];default:return[i(),{actionType:"unknown",unknownBytes:Uint8Array.from(n)}]}case 102:return[i(),{actionType:"hvp",horizontal:a,vertical:null}];case 109:switch(a){case"":case"0":return[i(),{actionType:"reset"}];case"1":return[i(),{actionType:"intensity",intensity:"bold"}];case"2":return[i(),{actionType:"intensity",intensity:"dim"}];case"3":return[i(),{actionType:"italic",italic:!0}];case"4":return[i(),{actionType:"underline",underline:"single"}];case"5":return[i(),{actionType:"blink",blink:"slow"}];case"6":return[i(),{actionType:"blink",blink:"rapid"}];case"7":return[i(),{actionType:"invert",invert:!0}];case"8":return[i(),{actionType:"hide",hide:!0}];case"9":return[i(),{actionType:"strike",strike:!0}];case"10":return[i(),{actionType:"font",font:"default"}];case"11":return[i(),{actionType:"font",font:1}];case"12":return[i(),{actionType:"font",font:2}];case"13":return[i(),{actionType:"font",font:3}];case"14":return[i(),{actionType:"font",font:4}];case"15":return[i(),{actionType:"font",font:5}];case"16":return[i(),{actionType:"font",font:6}];case"17":return[i(),{actionType:"font",font:7}];case"18":return[i(),{actionType:"font",font:8}];case"19":return[i(),{actionType:"font",font:9}];case"20":return[i(),{actionType:"font",font:"fraktur"}];case"21":return[i(),{actionType:"underline",underline:"double"}];case"22":return[i(),{actionType:"intensity",intensity:"normal"}];case"23":return[i(),{actionType:"italic",italic:!1}];case"24":return[i(),{actionType:"underline",underline:"none"}];case"25":return[i(),{actionType:"blink",blink:"off"}];case"26":return[i(),{actionType:"propositional_spacing",propositionalSpacing:!0}];case"27":return[i(),{actionType:"invert",invert:!1}];case"28":return[i(),{actionType:"hide",hide:!1}];case"29":return[i(),{actionType:"strike",strike:!1}];case"30":return[i(),{actionType:"fg_color",fgColor:{colorType:"4bit",color4bitType:"standard",colorName:"black"}}];case"31":return[i(),{actionType:"fg_color",fgColor:{colorType:"4bit",color4bitType:"standard",colorName:"red"}}];case"32":return[i(),{actionType:"fg_color",fgColor:{colorType:"4bit",color4bitType:"standard",colorName:"green"}}];case"33":return[i(),{actionType:"fg_color",fgColor:{colorType:"4bit",color4bitType:"standard",colorName:"yellow"}}];case"34":return[i(),{actionType:"fg_color",fgColor:{colorType:"4bit",color4bitType:"standard",colorName:"blue"}}];case"35":return[i(),{actionType:"fg_color",fgColor:{colorType:"4bit",color4bitType:"standard",colorName:"magenta"}}];case"36":return[i(),{actionType:"fg_color",fgColor:{colorType:"4bit",color4bitType:"standard",colorName:"cyan"}}];case"37":return[i(),{actionType:"fg_color",fgColor:{colorType:"4bit",color4bitType:"standard",colorName:"white"}}];case"38":break;case"39":return[i(),{actionType:"fg_color",fgColor:{colorType:"default"}}];case"40":return[i(),{actionType:"bg_color",bgColor:{colorType:"4bit",color4bitType:"standard",colorName:"black"}}];case"41":return[i(),{actionType:"bg_color",bgColor:{colorType:"4bit",color4bitType:"standard",colorName:"red"}}];case"42":return[i(),{actionType:"bg_color",bgColor:{colorType:"4bit",color4bitType:"standard",colorName:"green"}}];case"43":return[i(),{actionType:"bg_color",bgColor:{colorType:"4bit",color4bitType:"standard",colorName:"yellow"}}];case"44":return[i(),{actionType:"bg_color",bgColor:{colorType:"4bit",color4bitType:"standard",colorName:"blue"}}];case"45":return[i(),{actionType:"bg_color",bgColor:{colorType:"4bit",color4bitType:"standard",colorName:"magenta"}}];case"46":return[i(),{actionType:"bg_color",bgColor:{colorType:"4bit",color4bitType:"standard",colorName:"cyan"}}];case"47":return[i(),{actionType:"bg_color",bgColor:{colorType:"4bit",color4bitType:"standard",colorName:"white"}}];case"48":break;case"49":return[i(),{actionType:"bg_color",bgColor:{colorType:"default"}}];case"50":return[i(),{actionType:"propositional_spacing",propositionalSpacing:!1}];case"51":return[i(),{actionType:"emoji_variation",emojiVariation:"framed"}];case"52":return[i(),{actionType:"emoji_variation",emojiVariation:"encircled"}];case"53":return[i(),{actionType:"overlined",overlined:!0}];case"54":return[i(),{actionType:"emoji_variation",emojiVariation:"default"}];case"55":return[i(),{actionType:"overlined",overlined:!1}];case"73":return[i(),{actionType:"script",script:"superscript"}];case"74":return[i(),{actionType:"script",script:"subscript"}];case"75":return[i(),{actionType:"script",script:"default"}];case"90":return[i(),{actionType:"fg_color",fgColor:{colorType:"4bit",color4bitType:"high_intensity",colorName:"black"}}];case"91":return[i(),{actionType:"fg_color",fgColor:{colorType:"4bit",color4bitType:"high_intensity",colorName:"red"}}];case"92":return[i(),{actionType:"fg_color",fgColor:{colorType:"4bit",color4bitType:"high_intensity",colorName:"green"}}];case"93":return[i(),{actionType:"fg_color",fgColor:{colorType:"4bit",color4bitType:"high_intensity",colorName:"yellow"}}];case"94":return[i(),{actionType:"fg_color",fgColor:{colorType:"4bit",color4bitType:"high_intensity",colorName:"blue"}}];case"95":return[i(),{actionType:"fg_color",fgColor:{colorType:"4bit",color4bitType:"high_intensity",colorName:"magenta"}}];case"96":return[i(),{actionType:"fg_color",fgColor:{colorType:"4bit",color4bitType:"high_intensity",colorName:"cyan"}}];case"97":return[i(),{actionType:"fg_color",fgColor:{colorType:"4bit",color4bitType:"high_intensity",colorName:"white"}}];case"100":return[i(),{actionType:"bg_color",bgColor:{colorType:"4bit",color4bitType:"high_intensity",colorName:"black"}}];case"101":return[i(),{actionType:"bg_color",bgColor:{colorType:"4bit",color4bitType:"high_intensity",colorName:"red"}}];case"102":return[i(),{actionType:"bg_color",bgColor:{colorType:"4bit",color4bitType:"high_intensity",colorName:"green"}}];case"103":return[i(),{actionType:"bg_color",bgColor:{colorType:"4bit",color4bitType:"high_intensity",colorName:"yellow"}}];case"104":return[i(),{actionType:"bg_color",bgColor:{colorType:"4bit",color4bitType:"high_intensity",colorName:"blue"}}];case"105":return[i(),{actionType:"bg_color",bgColor:{colorType:"4bit",color4bitType:"high_intensity",colorName:"magenta"}}];case"106":return[i(),{actionType:"bg_color",bgColor:{colorType:"4bit",color4bitType:"high_intensity",colorName:"cyan"}}];case"107":return[i(),{actionType:"bg_color",bgColor:{colorType:"4bit",color4bitType:"high_intensity",colorName:"white"}}]}break;case 110:switch(a){case"6":return[i(),{actionType:"dsr"}];default:return[i(),{actionType:"unknown",unknownBytes:Uint8Array.from(n)}]}}if(r.length<=s)return 64<=c&&c<=126?[i(),{actionType:"unknown",unknownBytes:Uint8Array.from(n)}]:[{waitingBytes:Uint8Array.from(n)},{actionType:"noop"}];if(r[s]!==59)return 64<=c&&c<=126?[i(),{actionType:"unknown",unknownBytes:Uint8Array.from(n)}]:[{waitingBytes:Uint8Array.from(n)},{actionType:"noop"}];s+=1;let x=s;for(;r.length>s&&Ne(r[s])!==null;)s+=1;let y=Se(r.slice(x,s));if(r.length<=s)return 64<=c&&c<=126?[i(),{actionType:"unknown",unknownBytes:Uint8Array.from(n)}]:[{waitingBytes:Uint8Array.from(n)},{actionType:"noop"}];switch(r[s]){case 72:return[i(),{actionType:"cup",row:a,column:y}];case 102:return[i(),{actionType:"hvp",horizontal:a,vertical:y}]}if(r.length<=s)return 64<=c&&c<=126?[i(),{actionType:"unknown",unknownBytes:Uint8Array.from(n)}]:[{waitingBytes:Uint8Array.from(n)},{actionType:"noop"}];if(r[s]!==59)return 64<=c&&c<=126?[i(),{actionType:"unknown",unknownBytes:Uint8Array.from(n)}]:[{waitingBytes:Uint8Array.from(n)},{actionType:"noop"}];s+=1;let h=s;for(;r.length>s&&Ne(r[s])!==null;)s+=1;let u=Se(r.slice(h,s));if(r.length<=s)return 64<=c&&c<=126?[i(),{actionType:"unknown",unknownBytes:Uint8Array.from(n)}]:[{waitingBytes:Uint8Array.from(n)},{actionType:"noop"}];if(r[s]===109){if(a!=="38"&&a!=="48"||y!=="5"||u===""||!_e(u))return[i(),{actionType:"unknown",unknownBytes:Uint8Array.from(n)}];let T=Number.parseInt(u,10);return a==="38"?[i(),{actionType:"fg_color",fgColor:$e(T)}]:[i(),{actionType:"bg_color",bgColor:$e(T)}]}if(r.length<=s)return 64<=c&&c<=126?[i(),{actionType:"unknown",unknownBytes:Uint8Array.from(n)}]:[{waitingBytes:Uint8Array.from(n)},{actionType:"noop"}];if(r[s]!==59)return 64<=c&&c<=126?[i(),{actionType:"unknown",unknownBytes:Uint8Array.from(n)}]:[{waitingBytes:Uint8Array.from(n)},{actionType:"noop"}];s+=1;let m=s;for(;r.length>s&&Ne(r[s])!==null;)s+=1;let A=Se(r.slice(m,s));if(r.length<=s)return 64<=c&&c<=126?[i(),{actionType:"unknown",unknownBytes:Uint8Array.from(n)}]:[{waitingBytes:Uint8Array.from(n)},{actionType:"noop"}];if(r.length<=s)return[{waitingBytes:Uint8Array.from(n)},{actionType:"noop"}];if(r[s]!==59)return 64<=c&&c<=126?[i(),{actionType:"unknown",unknownBytes:Uint8Array.from(n)}]:[{waitingBytes:Uint8Array.from(n)},{actionType:"noop"}];s+=1;let g=s;for(;r.length>s&&Ne(r[s])!==null;)s+=1;let C=Se(r.slice(g,s));return r.length<=s?[{waitingBytes:Uint8Array.from(n)},{actionType:"noop"}]:r[s]===109?a!=="38"&&a!=="48"||y!=="2"||u===""||A===""||C===""||!_e(u)||!_e(A)||!_e(C)?[i(),{actionType:"unknown",unknownBytes:Uint8Array.from(n)}]:a==="38"?[i(),{actionType:"fg_color",fgColor:{colorType:"24bit",r:Number.parseInt(u,10),g:Number.parseInt(A,10),b:Number.parseInt(C,10)}}]:[i(),{actionType:"bg_color",bgColor:{colorType:"24bit",r:Number.parseInt(u,10),g:Number.parseInt(A,10),b:Number.parseInt(C,10)}}]:64<=c&&c<=126?[i(),{actionType:"unknown",unknownBytes:Uint8Array.from(n)}]:[{waitingBytes:Uint8Array.from(n)},{actionType:"noop"}]},"decodeAnsiByte"),Me=Ur;var Lr=o((e,t)=>{let r=e,n=[...t].map(c=>{let[s,a]=Me(r,c);return r=s,a}).filter(c=>c.actionType!=="noop");return[r,n]},"decodeAnsiBytes"),Je=Lr;var S=o(e=>Uint8Array.from([...e].map(t=>t.charCodeAt(0))),"encodeInteger"),Or=o(e=>{let t=[27,91];switch(e.actionType){case"noop":return Uint8Array.from([]);case"unknown":return e.unknownBytes;case"print":return Uint8Array.from([e.byte]);case"cuu":return Uint8Array.from([...t,...S(e.cells),65]);case"cud":return Uint8Array.from([...t,...S(e.cells),66]);case"cuf":return Uint8Array.from([...t,...S(e.cells),67]);case"cub":return Uint8Array.from([...t,...S(e.cells),68]);case"cnl":return Uint8Array.from([...t,...S(e.cells),69]);case"cpl":return Uint8Array.from([...t,...S(e.cells),70]);case"cha":return Uint8Array.from([...t,...S(e.column),71]);case"cup":return e.column===null?Uint8Array.from([...t,...S(e.row),72]):Uint8Array.from([...t,...S(e.row),59,...S(e.column),72]);case"ed":return Uint8Array.from([...t,...S(e.eraseInDisplayType),74]);case"el":return Uint8Array.from([...t,...S(e.eraseInLineType),75]);case"su":return Uint8Array.from([...t,...S(e.n),83]);case"sd":return Uint8Array.from([...t,...S(e.n),84]);case"aux_port":return Uint8Array.from([...t,e.auxPort?53:52,105]);case"hvp":return e.vertical===null?Uint8Array.from([...t,...S(e.horizontal),102]):Uint8Array.from([...t,...S(e.horizontal),59,...S(e.vertical),102]);case"dsr":return Uint8Array.from([...t,54,110]);case"reset":return Uint8Array.from([...t,48,109]);case"intensity":switch(e.intensity){case"bold":return Uint8Array.from([...t,49,109]);case"dim":return Uint8Array.from([...t,50,109]);default:return Uint8Array.from([...t,50,50,109])}case"italic":return e.italic?Uint8Array.from([...t,51,109]):Uint8Array.from([...t,50,51,109]);case"underline":switch(e.underline){case"single":return Uint8Array.from([...t,52,109]);case"double":return Uint8Array.from([...t,50,49,109]);default:return Uint8Array.from([...t,50,52,109])}case"blink":switch(e.blink){case"slow":return Uint8Array.from([...t,53,109]);case"rapid":return Uint8Array.from([...t,54,109]);default:return Uint8Array.from([...t,50,53,109])}case"invert":return e.invert?Uint8Array.from([...t,55,109]):Uint8Array.from([...t,50,55,109]);case"hide":return e.hide?Uint8Array.from([...t,56,109]):Uint8Array.from([...t,50,56,109]);case"strike":return e.strike?Uint8Array.from([...t,57,109]):Uint8Array.from([...t,50,57,109]);case"font":switch(e.font){case"default":return Uint8Array.from([...t,49,48,109]);default:return Uint8Array.from([...t,49,48+e.font,109]);case"fraktur":return Uint8Array.from([...t,50,48,109])}case"propositional_spacing":return e.propositionalSpacing?Uint8Array.from([...t,50,54,109]):Uint8Array.from([...t,53,48,109]);case"fg_color":switch(e.fgColor.colorType){case"4bit":switch(e.fgColor.color4bitType){case"standard":return Uint8Array.from([...t,51,48+Q(e.fgColor.colorName),109]);case"high_intensity":default:return Uint8Array.from([...t,57,48+Q(e.fgColor.colorName),109])}case"8bit":switch(e.fgColor.color8bitType){case"standard":return Uint8Array.from([...t,51,56,59,53,59,...S(Q(e.fgColor.colorName).toString()),109]);case"high_intensity":return Uint8Array.from([...t,51,56,59,53,59,...S((8+Q(e.fgColor.colorName)).toString()),109]);case"rgb":{let r=16+e.fgColor.r*36+e.fgColor.g*6+e.fgColor.b;return Uint8Array.from([...t,51,56,59,53,59,...S(r.toString()),109])}case"grayscale":default:return Uint8Array.from([...t,51,56,59,53,59,...S((232+e.fgColor.lightness).toString()),109])}case"24bit":return Uint8Array.from([...t,51,56,59,50,59,...S(e.fgColor.r.toString()),59,...S(e.fgColor.g.toString()),59,...S(e.fgColor.b.toString()),109]);default:return Uint8Array.from([...t,51,57,109])}case"bg_color":switch(e.bgColor.colorType){case"4bit":switch(e.bgColor.color4bitType){case"standard":return Uint8Array.from([...t,52,48+Q(e.bgColor.colorName),109]);case"high_intensity":default:return Uint8Array.from([...t,49,48,48+Q(e.bgColor.colorName),109])}case"8bit":switch(e.bgColor.color8bitType){case"standard":return Uint8Array.from([...t,52,56,59,53,59,...S(Q(e.bgColor.colorName).toString()),109]);case"high_intensity":return Uint8Array.from([...t,52,56,59,53,59,...S((8+Q(e.bgColor.colorName)).toString()),109]);case"rgb":{let r=16+e.bgColor.r*36+e.bgColor.g*6+e.bgColor.b;return Uint8Array.from([...t,52,56,59,53,59,...S(r.toString()),109])}case"grayscale":default:return Uint8Array.from([...t,52,56,59,53,59,...S((232+e.bgColor.lightness).toString()),109])}case"24bit":return Uint8Array.from([...t,52,56,59,50,59,...S(e.bgColor.r.toString()),59,...S(e.bgColor.g.toString()),59,...S(e.bgColor.b.toString()),109]);default:return Uint8Array.from([...t,52,57,109])}case"emoji_variation":switch(e.emojiVariation){case"framed":return Uint8Array.from([...t,53,49,109]);case"encircled":return Uint8Array.from([...t,53,50,109]);default:return Uint8Array.from([...t,53,52,109])}case"overlined":return e.overlined?Uint8Array.from([...t,53,51,109]):Uint8Array.from([...t,53,53,109]);case"script":switch(e.script){case"superscript":return Uint8Array.from([...t,55,51,109]);case"subscript":return Uint8Array.from([...t,55,52,109]);default:return Uint8Array.from([...t,55,53,109])}case"controll":return Uint8Array.from([e.byte])}},"encodeAnsiAction"),H=Or;import _r from"cross-spawn";import Mr from"tty";var _t="notios",ge=Object.freeze({rootToken:"NOTIOS_ROOT_TOKEN",parentToken:"NOTIOS_PARENT_TOKEN",doNotAlternate:"NOTIOS_DO_NOT_ALTERNATE"});import Br from"cross-spawn";import Ir from"pidtree";var Pe=0,Ye=o(()=>new Promise(e=>{if(Pe<=0){e();return}let t=setInterval(()=>{if(Pe<=0){clearInterval(t),e();return}},0)}),"waitKillDone"),$r=o(e=>{if(typeof e=="number")if(process.platform==="win32")Br("taskkill",["/F","/T","/PID",e.toString()],{stdio:"ignore"});else try{Pe+=1,Ir(e,(t,r)=>{try{process.kill(e)}catch{}if(!t){for(let n of r)try{process.kill(n)}catch{}Pe-=1}})}catch{Pe-=1}},"crossKill"),Mt=$r;var Et=o(()=>({}),"defaultStyContext"),Vt=o((e,t)=>{switch(t.actionType){case"reset":return{};case"fg_color":return{...e,fgColor:t.fgColor};case"bg_color":return{...e,bgColor:t.bgColor};case"intensity":return{...e,intensity:t.intensity};case"italic":return{...e,italic:t.italic};case"underline":return{...e,underline:t.underline};case"blink":return{...e,blink:t.blink};case"invert":return{...e,invert:t.invert};case"hide":return{...e,hide:t.hide};case"strike":return{...e,strike:t.strike};case"font":return{...e,font:t.font};case"propositional_spacing":return{...e,propositionalSpacing:t.propositionalSpacing};case"emoji_variation":return{...e,emojiVariation:t.emojiVariation};case"overlined":return{...e,overlined:t.overlined};case"script":return{...e,script:t.script};default:return e}},"applyActionToSty");var Ze=o(e=>{let t=[...H({actionType:"reset"})];return e.fgColor!==void 0&&t.push(...H({actionType:"fg_color",fgColor:e.fgColor})),e.bgColor!==void 0&&t.push(...H({actionType:"bg_color",bgColor:e.bgColor})),e.intensity!==void 0&&t.push(...H({actionType:"intensity",intensity:e.intensity})),e.italic!==void 0&&t.push(...H({actionType:"italic",italic:e.italic})),e.underline!==void 0&&t.push(...H({actionType:"underline",underline:e.underline})),e.blink!==void 0&&t.push(...H({actionType:"blink",blink:e.blink})),e.invert!==void 0&&t.push(...H({actionType:"invert",invert:e.invert})),e.hide!==void 0&&t.push(...H({actionType:"hide",hide:e.hide})),e.strike!==void 0&&t.push(...H({actionType:"strike",strike:e.strike})),e.propositionalSpacing!==void 0&&t.push(...H({actionType:"propositional_spacing",propositionalSpacing:e.propositionalSpacing})),e.emojiVariation!==void 0&&t.push(...H({actionType:"emoji_variation",emojiVariation:e.emojiVariation})),e.overlined!==void 0&&t.push(...H({actionType:"overlined",overlined:e.overlined})),e.script!==void 0&&t.push(...H({actionType:"script",script:e.script})),Uint8Array.from(t)},"restoreSty");var ke=o(()=>({lineCount:0,lines:[],$unreadLines:new Set,$lastLineToTitle:{}}),"$createEmptyLogAccumulated"),Dt=o(()=>ke(),"createEmptyLogAccumulated"),Ft=o(({forceNoColor:e,enableUnreadMarker:t,historyAlwaysKeepHeadSize:r,historyCacheSize:n})=>{let c=!("NO_COLOR"in process.env||e)&&("FORCE_COLOR"in process.env||process.platform==="win32"||Mr.isatty(1)&&process.env.TERM!=="dumb"||"CI"in process.env),s=c?"\x1B[0m":"",a=c?"\x1B[33m":"",x=new Set,y=o(()=>{[...x].forEach(d=>{d()})},"$notifyUpdate"),h=new Map,u=o(d=>{if(d.status==="running"&&d.type==="serial"&&d.children.length>0)if(d.children[0].status==="waiting")k(d.children[0]);else for(let p=0;p+1<d.children.length;p+=1)d.children[p].status==="finished"&&d.children[p+1].status==="waiting"&&k(d.children[p+1])},"$checkSerial"),m=o(d=>{let p=new Set,O=o(U=>{p.add(U)},"addUpdateListener"),B=o(U=>{p.delete(U)},"removeUpdateListener"),K=(()=>{for(;;){let U=Math.random().toString().slice(2,14);if(!h.has(U))return U}})(),N={...d,addUpdateListener:O,removeUpdateListener:B,token:K,$notifyUpdate:()=>{let U=N.children.filter(L=>!L.ignored);if(U.length>0&&(N.status=(()=>{let L=U.map(_=>_.status),G=Math.max(...L.map(_=>_==="killed"?0:1))===0,z=Math.max(...L.map(_=>_==="finished"?0:1))===0,q=Math.max(...L.map(_=>_==="waiting"?0:1))===0;return N.procOwn&&G?"killed":z?"finished":q?"waiting":"running"})(),N.exitCode=U.reduce((L,G)=>L||G.exitCode,null)),u(N),U.length>0){let L={};N.logAccumulated.lineCount=0;let G=[];for(let _ of U){N.logAccumulated.lineCount+=_.logAccumulated.lineCount;let J=_.name,Ue=0;for(;L[J];)Ue+=1,J=`${_.name}(${Ue})`;L[J]=!0;let re=_.logAccumulated.lines,Le=re.length===0?0:re[re.length-1].main.timestamp?re.length:re.length-1;if(Le>0){let gt=N.logAccumulated.$lastLineToTitle[J],ye=0;if(gt)for(ye=Le;ye>=1&&re[ye-1].main.id!==-1&&re[ye-1].main.id!==gt.main.id;)ye-=1;N.logAccumulated.$lastLineToTitle[J]=re[Le-1],G.push(...re.slice(ye,Le).map(Mo=>({title:J,main:Mo.main})))}}let z=N.logAccumulated.lines,q=G.sort((_,J)=>_.main.timestamp.getTime()-J.main.timestamp.getTime());if(z.push(...q),t){let _=N.logAccumulated.$unreadLines;q.forEach(J=>{_.add(J)})}}N.parent?.$notifyUpdate();{let L=N.logAccumulated.lines,G=Math.max(0,r),z=Math.max(1,n+1);if(L.length>G+z){N.logOmitted=!0;let q=N.logAccumulated.lines.slice(0,G),_=N.logAccumulated.lines.slice(G);if(t){let J=N.logAccumulated.$unreadLines;_.slice(0,-z).forEach(Ue=>{J.delete(Ue)})}_=_.slice(-z),N.logAccumulated.lines=[...q,{title:"[NOTIOS]",main:{id:-1,read:!0,timestamp:new Date(0),content:[{type:"style",bytes:Uint8Array.from(Buffer.from(`${s}${a}`))},...[...Buffer.from("[NOTIOS] HISTORY DROPPED")].map(J=>({type:"print",byte:J})),{type:"style",bytes:Uint8Array.from(Buffer.from(`${s}`))}]}},..._]}}[...p].forEach(L=>{L()})}};return h.set(K,N),N},"$createNode"),A=o((d,p)=>{if(!p.logOwn)throw new Error("[INTERNAL UNREACHABLE ERROR]: appending to log-accumulate-only node");let[O,B]=Je(p.logOwn.currentParser,new Uint8Array(d));p.logOwn.currentParser=O;for(let K of B){let N=p.logAccumulated.lines,U=p.logAccumulated.$unreadLines;if(N.length===0){let z="",q={main:{timestamp:void 0,read:!1,id:p.logAccumulated.lineCount,content:[]},title:z};N.push(q),t&&U.add(q),p.logAccumulated.$lastLineToTitle[z]=q}let L=N[N.length-1],G=o(z=>{z.main.timestamp||(z.main.timestamp=new Date,p.logAccumulated.lineCount+=1)},"checkTimestamp");switch(K.actionType){case"print":G(L),L.main.content.push({type:"print",byte:K.byte});break;case"controll":switch(K.char){case" ":G(L),L.main.content.push({type:"print",byte:32});break;case`
`:{G(L);let z="",q={main:{timestamp:void 0,read:!1,id:p.logAccumulated.lineCount,content:[{type:"style",bytes:Ze(p.logOwn.currentSty)}]},title:z};N.push(q),t&&U.add(q),p.logAccumulated.$lastLineToTitle[z]=q;break}default:break}break;default:p.logOwn.currentSty=Vt(p.logOwn.currentSty,K),L.main.content.push({type:"style",bytes:Ze(p.logOwn.currentSty)});break}}},"$appendLogToNode"),g=o(()=>({currentSty:Et(),currentParser:qe()}),"$createEmptyLogOwn"),C=m({name:"<root>",status:"waiting",type:"none",logOwn:g(),logAccumulated:ke(),logOmitted:!1,children:[],ignored:!1}),T=o(d=>typeof d=="string"?h.get(d):C,"findNodeByToken"),k=o(d=>{if(d.status="running",!d.procOwn){u(d);return}let p=m({name:"<out>",status:"running",type:"none",logOwn:g(),logAccumulated:ke(),logOmitted:!1,children:[],ignored:!1}),O=m({name:"<err>",status:"running",type:"none",logOwn:g(),logAccumulated:ke(),logOmitted:!1,children:[],ignored:!1});d.children=[p,O,...d.children],p.parent=d,O.parent=d,y();let B=_r.spawn(d.procOwn.npmPath,["run",d.name],{stdio:["pipe","pipe","pipe"],cwd:d.procOwn.cwd,env:{...process.env,...c?{npm_config_color:"always",NO_COLOR:void 0,FORCE_COLOR:"true",CARGO_TERM_COLOR:"always"}:{npm_config_color:"false",NO_COLOR:"true",FORCE_COLOR:"0",CARGO_TERM_COLOR:"none"},[ge.rootToken]:C.token,[ge.parentToken]:d.token}});d.procOwn.$raw=B,d.$notifyUpdate();let K=o(U=>{A(U,p),p.$notifyUpdate()},"stdoutDataListener"),N=o(U=>{A(U,O),O.$notifyUpdate()},"stderrDataListener");B.stdout.on("data",K),B.stderr.on("data",N),B.once("exit",U=>{p.status==="running"&&(p.status="finished"),O.status==="running"&&(O.status="finished"),p.exitCode=U,O.exitCode=U,p.$notifyUpdate(),O.$notifyUpdate(),B.stdout.off("data",K),B.stderr.off("data",N)})},"$startRunning"),P=o(({parentToken:d,...p})=>{let O=T(d);if(O==null)return null;let B=m({...p,logOwn:g(),logAccumulated:ke(),logOmitted:!1,children:[],ignored:!1});return O.children.push(B),B.parent=O,p.procOwn&&p.status==="running"&&k(B),B},"createNode"),W=o(d=>{x.add(d)},"addUpdateListener"),D=o(d=>{x.delete(d)},"removeUpdateListener"),f=o(d=>{if(!d)return;let p=d;!p.procOwn||p.status!=="finished"&&p.status!=="killed"||(p.children[0].ignored=!0,p.children[1].ignored=!0,k(p),A(Buffer.from(`${s}${a}[NOTIOS] MANUALLY RESTARTED${s}
`),p.children[0]))},"restartNode"),I=o(d=>{!d||(f(d),d.children.forEach(p=>{I(p)}))},"restartAllNode"),$=o(d=>{if(!d)return;let p=d;!p.procOwn||!p.procOwn.$raw||p.status==="running"&&(Mt(p.procOwn.$raw.pid),delete p.procOwn.$raw,p.status="killed",p.children[0].status="killed",p.children[1].status="killed",A(Buffer.from(`
${s}${a}[NOTIOS] MANUALLY KILLED${s}
`),p.children[0]),p.$notifyUpdate())},"killNode"),M=o(d=>{!d||($(d),d.children.forEach(p=>{M(p)}))},"killAllNode");return{createNode:P,restartNode:f,restartAllNode:I,killNode:$,killAllNode:M,rootNode:C,addUpdateListener:W,removeUpdateListener:D,findNodeByToken:T,markNodeAsRead:o(d=>{if(!t||!d)return;let p=d,O=o(B=>{[...B.logAccumulated.$unreadLines].forEach(K=>{K.main.read=!0}),B.logAccumulated.$unreadLines.clear(),B.children.forEach(K=>{O(K)})},"internal");O(p),p.$notifyUpdate()},"markNodeAsRead")}},"createProcManager");var Er=o(({uiOptions:e,notiosConfig:t})=>{let r=Ft({forceNoColor:e.forceNoColor,enableUnreadMarker:t.v1.enableUnreadMarker,historyAlwaysKeepHeadSize:t.v1.historyAlwaysKeepHeadSize,historyCacheSize:t.v1.historyCacheSize});return e.initialScriptNames.forEach(n=>{let c=process.cwd();r.createNode({name:n,type:"none",status:"running",procOwn:{cwd:c,command:n,npmPath:Be({cwd:c})}})}),r},"initiateProcManager"),Wt=Er;import he from"node-ipc";var Kt=o(({procManager:e})=>{he.config.id=`${_t}-${e.rootNode.token}`,he.config.logger=()=>{},he.serve(()=>{he.server.on(e.rootNode.token,(t,r)=>{if(t.runGroups.length<=0)return;let n=e.createNode({name:`[${t.cliName}] ${t.args.join(" ")}`,type:(()=>t.runGroups.length===1?t.runGroups[0].parallel?"parallel":"serial":"none")(),status:"waiting",parentToken:t.parentToken});if(!n)return;for(let s of t.runGroups){let a=(()=>t.runGroups.length===1?n:e.createNode({name:`${s.parallel?"<parallel>":"<serial>"} ${s.patterns.join(" ")}`,type:s.parallel?"parallel":"serial",status:"waiting",parentToken:n.token}))();if(!a)return;let x=!0;for(let y of s.runTasks)e.createNode({name:y.name,status:!x&&!s.parallel?"waiting":"running",type:"none",procOwn:{cwd:t.cwd,command:y.command,npmPath:t.npmPath??t.npmClient},parentToken:a.token}),x=!1}let c=o(()=>{n.status==="finished"&&(he.server.emit(r,"exit",n.exitCode),n.removeUpdateListener(c))},"listener");n.addUpdateListener(c)})}),he.server.start()},"setupIpc");import qr from"fs";var b=o(e=>e,"defineAction"),Vr={exit:b({description:"Exit notios app."})},Dr={back:b({description:"Close help page."}),"scroll-down-line":b({description:"Scroll down by single line."}),"scroll-up-line":b({description:"Scroll up by single line."}),"scroll-down-paragraph":b({description:"Scroll down by paragraph size which can be configured(deafult=5)."}),"scroll-up-paragraph":b({description:"Scroll up by paragraph size which can be configured(deafult=5)."}),"scroll-down-page":b({description:"Scroll down by number of lines of visually shown page."}),"scroll-up-page":b({description:"Scroll up by number of lines of visually shown page."}),"scroll-down-half-page":b({description:"Scroll down by half number of lines of visually shown page."}),"scroll-up-half-page":b({description:"Scroll down by half number of lines of visually shown page."}),"scroll-to-bottom":b({description:"Scroll down to the bottom(latest) of messages."}),"scroll-to-top":b({description:"Scroll down to the top(oldest) of messages."})},Fr={back:b({description:"Back to tree-procs page."}),"scroll-down-line":b({description:"Scroll down by single line."}),"scroll-up-line":b({description:"Scroll up by single line."}),"scroll-down-paragraph":b({description:"Scroll down by paragraph size which can be configured(deafult=5)."}),"scroll-up-paragraph":b({description:"Scroll up by paragraph size which can be configured(deafult=5)."}),"scroll-down-page":b({description:"Scroll down by number of lines of visually shown page."}),"scroll-up-page":b({description:"Scroll up by number of lines of visually shown page."}),"scroll-down-half-page":b({description:"Scroll down by half number of lines of visually shown page."}),"scroll-up-half-page":b({description:"Scroll down by half number of lines of visually shown page."}),"scroll-to-bottom":b({description:"Scroll down to the bottom(latest) of messages."}),"scroll-to-top":b({description:"Scroll down to the top(oldest) of messages."}),"scroll-to-leftmost":b({description:"Scroll to the beggining of lines."}),"scroll-right-char":b({description:"Scroll right by single char."}),"scroll-left-char":b({description:"Scroll left by single char."}),"scroll-right-word":b({description:"Scroll right by word size which can be configured(deafult=5)."}),"scroll-left-word":b({description:"Scroll left by word size which can be configured(deafult=5)."}),"toggle-timestamp":b({description:"Toggle timestamp view."}),"toggle-label":b({description:"Toggle label view. Note that <out>/<err> messages does not have label."})},Wr={"cursor-prev":b({description:"Cursor prev."}),"cursor-next":b({description:"Cursor next."}),"select-script":b({description:"Go to select-script page."}),expand:b({description:"Expand process node under the cursor."}),collapse:b({description:"Collapse process node under the cursor."}),restart:b({description:"Restart process node under the cursor if possible."}),"restart-recrusive":b({description:"Restart processes of all node of subtree of node under the cursor."}),kill:b({description:"Kill process node under the cursor if possible."}),"kill-recrusive":b({description:"Kill processes of all node of subtree of node under the cursor."}),inspect:b({description:"Inspect process node under the cursor."})},Kr={back:b({description:"Back to tree-procs page."}),"cursor-prev":b({description:"Cursor prev."}),"cursor-next":b({description:"Cursor next."}),"start-and-back":b({description:"Start script under the cursor and back to tree-procs."}),start:b({description:"Just start script under the cursor."})},se={common:Vr,"inspect-proc":Fr,"tree-procs":Wr,"select-script":Kr,help:Dr},zt=["common","inspect-proc","tree-procs","select-script","help"];var Ht=[{type:"special",special:"return"},{type:"char",char:"m",ctrl:!0}],jt=[{type:"special",special:"upArrow"},{type:"special",special:"tab",shift:!0},{type:"char",char:"k"},{type:"char",char:"p",ctrl:!0}],Gt=[{type:"special",special:"downArrow"},{type:"special",special:"tab"},{type:"char",char:"i",ctrl:!0},{type:"char",char:"j"},{type:"char",char:"n",ctrl:!0}],qt=[{type:"special",special:"leftArrow"},{type:"char",char:"h"},{type:"char",ctrl:!0,char:"b"}],Xe=[{type:"special",special:"rightArrow"},{type:"char",char:"l"},{type:"char",ctrl:!0,char:"f"}],Qe=[{type:"special",special:"backspace"},{type:"special",special:"delete"},{type:"char",char:"h",ctrl:!0},{type:"char",char:"q"},{type:"char",char:"o",ctrl:!0}],Jt=[{type:"special",special:"downArrow"},{type:"char",char:"j"},{type:"char",ctrl:!0,char:"e"},{type:"char",ctrl:!0,char:"n"}],Yt=[{type:"special",special:"upArrow"},{type:"char",char:"k"},{type:"char",ctrl:!0,char:"y"},{type:"char",ctrl:!0,char:"p"}],Zt=[{type:"special",special:"downArrow",ctrl:!0},{type:"special",special:"upWheel"}],Xt=[{type:"special",special:"upArrow",ctrl:!0},{type:"special",special:"downWheel"}],Qt=[],Rt=[],eo=[{type:"special",special:"pageDown"},{type:"char",char:"d"}],to=[{type:"special",special:"pageUp"},{type:"char",char:"u"}],oo=[{type:"special",special:"end",ctrl:!0},{type:"char",char:"g",shift:!0}],ro=[{type:"special",special:"home",ctrl:!0},{type:"char",char:"g"}],zr={v1:{keymappings:{common:{exit:[{type:"char",char:"c",ctrl:!0}]},help:{back:Qe,"scroll-down-line":Jt,"scroll-up-line":Yt,"scroll-down-paragraph":Zt,"scroll-up-paragraph":Xt,"scroll-down-page":Qt,"scroll-up-page":Rt,"scroll-down-half-page":eo,"scroll-up-half-page":to,"scroll-to-bottom":oo,"scroll-to-top":ro},"tree-procs":{"cursor-prev":jt,"cursor-next":Gt,"select-script":[{type:"char",char:"n"}],expand:Xe,collapse:qt,restart:[{type:"char",char:"r"}],"restart-recrusive":[],kill:[{type:"char",char:"x"}],"kill-recrusive":[],inspect:Ht},"select-script":{back:Qe,"cursor-prev":[...jt,{type:"special",special:"downWheel"}],"cursor-next":[...Gt,{type:"special",special:"upWheel"}],"start-and-back":[...Ht,...Xe],start:[]},"inspect-proc":{back:Qe,"scroll-down-line":Jt,"scroll-up-line":Yt,"scroll-down-paragraph":Zt,"scroll-up-paragraph":Xt,"scroll-down-page":Qt,"scroll-up-page":Rt,"scroll-down-half-page":eo,"scroll-up-half-page":to,"scroll-to-bottom":oo,"scroll-to-top":ro,"scroll-to-leftmost":[{type:"special",special:"home"},{type:"char",char:"^"},{type:"char",char:"0"}],"scroll-right-char":Xe,"scroll-left-char":qt,"scroll-right-word":[{type:"special",special:"rightArrow",ctrl:!0},{type:"char",char:"e"},{type:"char",meta:!0,char:"f"}],"scroll-left-word":[{type:"special",special:"leftArrow",ctrl:!0},{type:"char",char:"b"},{type:"char",meta:!0,char:"b"}],"toggle-timestamp":[{type:"char",char:"t"}],"toggle-label":[{type:"char",char:"v"}]}},paragraphSize:5,wordSize:5,showTimestampByDefault:!1,showLabelByDefault:!0,showScriptCommandInSelectScript:!0,showScriptCommandInTreeProcs:!0,enableUnreadMarker:!0,enableTimeElapseGradationBar:!0,historyAlwaysKeepHeadSize:100,historyCacheSize:3e3}},Hr=zr,Re=Hr;var no=["return","backspace","delete","pageUp","pageDown","downArrow","upArrow","rightArrow","leftArrow","tab"];var E=o(e=>{switch(e.type){case"char":return e.char+(e.ctrl?"c":"-")+(e.meta?"m":"-")+(e.shift?"s":"-");case"special":return e.special+";"+(e.ctrl?"c":"-")+(e.shift?"s":"-")}},"keymappingToString"),jr=o(e=>{switch(e.type){case"char":return(e.ctrl?"C-":"")+(e.meta?"M-":"")+(e.shift?"S-":"")+(e.char===" "?"<SPACE>":e.char);case"special":return(e.ctrl?"C-":"")+(e.shift?"S-":"")+e.special}},"keymappingToRepr"),Gr=o(e=>e.type==="seq"?e.seq:[e],"toSeq"),Ee=o(e=>{let t={children:new Map},r=(()=>Object.entries(e).filter(a=>a[1]!=null).flatMap(([a,x])=>x.map(y=>[a,Gr(y)])).sort(([,a],[,x])=>a.length-x.length))();for(let[n,c]of r){if(c.length===0)throw new Error(`Keymap for action "${n}" is zero-length sequential, which is not allowed.`);let s=t;for(let a of c){let x=E(a),y=s.children.get(x);if(y==null){let h={children:new Map};s.children.set(x,h),s=h}else s=y;if(s.action!=null)throw new Error(`Keymap for action "${n}" [${c.map(h=>jr(h)).join(" ")}] including keymap for action "${s.action}".`)}s.action=n}return t},"constructKeymapping"),io=o((e,t,r)=>{let n={ctrl:r.ctrl,meta:r.meta,shift:r.shift},c=(()=>{{let a={ctrl:t.startsWith("[1;5")||t.startsWith("[1;6"),shift:t.startsWith("[1;2")||t.startsWith("[1;6")};if(/^\[B(?:\x1b\[B)+$/.test(t))return E({type:"special",special:"upWheel"});if(/^\[A(?:\x1b\[A)+$/.test(t))return E({type:"special",special:"downWheel"});if(t==="[1~")return E({...a,type:"special",special:"home"});if(t==="[4~")return E({...a,type:"special",special:"end"});if(t==="[5;2~")return E({...a,type:"special",special:"pageUp",shift:!0});if(t==="[6;2~")return E({...a,type:"special",special:"pageDown",shift:!0});if(t==="[5;6~")return E({...a,type:"special",special:"pageUp",ctrl:!0,shift:!0});if(t==="[6;6~")return E({...a,type:"special",special:"pageDown",ctrl:!0,shift:!0});if(a.ctrl||a.shift){if(t.endsWith("H"))return E({...a,type:"special",special:"home"});if(t.endsWith("F"))return E({...a,type:"special",special:"end"});if(t.endsWith("D"))return E({...a,type:"special",special:"leftArrow"});if(t.endsWith("B"))return E({...a,type:"special",special:"downArrow"});if(t.endsWith("C"))return E({...a,type:"special",special:"rightArrow"});if(t.endsWith("A"))return E({...a,type:"special",special:"upArrow"})}}for(let a of no)if(r[a])return E(a==="tab"?{type:"special",special:a,shift:n.shift}:a==="delete"||a==="backspace"||a==="return"?{type:"special",special:a}:{...n,type:"special",special:a});return E({...n,type:"char",char:t.toLowerCase()})})(),s=e.children.get(c);return s==null?[void 0,void 0]:s.action!=null?[void 0,s.action]:[s,void 0]},"matchKeymapping");var so=o(({uiOptions:{configFileFullPath:e}})=>{let t=(()=>{try{return qr.readFileSync(e)}catch{return null}})(),r=(()=>t===null?Re:ht(e)(Re))();return zt.filter(n=>n!=="common").map(n=>{ie(()=>{Ee({...r.v1.keymappings.common,...r.v1.keymappings[n]})},[`Detected the confliction of keymapping or invalid configuration for page "${n}"(including "common" keymapping).`,"See error message for more details.","Review your notios configuration."].join(" "))}),r.v1.keymappings.common.exit.length<1&&ie(()=>{throw new Error("no keymapping for exit")},"Keymapping for common.exit is necessary because you would be unable to exit notios."),r},"setupNotiosConfig");var co=o(()=>{process.platform!=="win32"&&process.env[ge.doNotAlternate]!=="1"&&process.stdout.write("\x1B[?1049h")},"setupTerminal"),Ve=o(()=>{if(process.platform!=="win32"&&process.env[ge.doNotAlternate]!=="1"&&!process.stdout.write("\x1B[?1049l")){process.stdout.once("drain",()=>{Ye().then(()=>{process.exit(0)})});return}Ye().then(()=>{process.exit(0)})},"exitNotios");import{render as oi}from"ink";import ri from"react";import X,{useEffect as Rn,useMemo as ei}from"react";import Jr,{useContext as Yr,useState as Zr}from"react";var ao=o(()=>{let[e,t]=Zr("");return{inspectingToken:e,setInspectingToken:t}},"useInspectContextDefaultValue"),Xr=o(()=>Jr.createContext(void 0),"createInspectContext"),et=Xr(),De=o(()=>Yr(et),"useInspectContext");import Qr,{useContext as Rr}from"react";var en=o(()=>Qr.createContext(void 0),"createNotiosConfigContext"),tt=en(),ce=o(()=>Rr(tt),"useNotiosConfigContext");import tn,{useContext as on,useState as rn}from"react";var nn="select-script",lo=o(()=>{let[e,t]=rn(nn);return{page:e,setPage:t}},"usePageContextDefaultValue"),sn=o(()=>tn.createContext(void 0),"createPageContext"),ot=sn(),xe=o(()=>on(ot),"usePageContext");import cn,{useContext as an}from"react";var ln=o(()=>cn.createContext(void 0),"createProcManagerContext"),rt=ln(),be=o(()=>an(rt),"useProcManagerContext");import pn,{useContext as un,useEffect as po,useState as uo}from"react";var mo=o(()=>{let[e,t]=uo(process.stdout.rows),[r,n]=uo(process.stdout.columns);return po(()=>{let c=setInterval(()=>{t(process.stdout.rows),n(process.stdout.columns)},1e3);return()=>{clearInterval(c)}},[]),po(()=>{let c=o(()=>{t(process.stdout.rows),n(process.stdout.columns)},"handleResize");return process.stdout.on("resize",c),()=>{process.stdout.off("resize",c)}},[]),{termWidth:r,termHeight:e}},"useTermShapeContextDefaultValue"),dn=o(()=>pn.createContext(void 0),"createTermShapeContext"),nt=dn(),ae=o(()=>un(nt),"useTermShapeContext");import mn,{useContext as fn,useState as fo}from"react";var yo=o(()=>{let[e,t]=fo(null),[r,n]=fo({});return{selectedNodeToken:e,setSelectedNodeToken:t,openMap:r,setOpenMap:n}},"useTreeProcContextDefaultValue"),yn=o(()=>mn.createContext(void 0),"createTreeProcContext"