// @bun
var{defineProperty:G,getOwnPropertyNames:P,getOwnPropertyDescriptor:Q}=Object,R=Object.prototype.hasOwnProperty;function T(j){return this[j]}var $=(j)=>{var q=(L??=new WeakMap).get(j),E;if(q)return q;if(q=G({},"__esModule",{value:!0}),j&&typeof j==="object"||typeof j==="function"){for(var D of P(j))if(!R.call(q,D))G(q,D,{get:T.bind(j,D),enumerable:!(E=Q(j,D))||E.enumerable})}return L.set(j,q),q},L;var V=(j)=>j;function W(j,q){this[j]=V.bind(null,q)}var w=(j,q)=>{for(var E in q)G(j,E,{get:q[E],enumerable:!0,configurable:!0,set:W.bind(q,E)})};var M=(j,q)=>()=>(j&&(q=j(j=0)),q);var B=import.meta.require;function F(j,q){return`${A[q]}${j}${A.reset}`}function g(j){return F(j,"green")}function C(j){return F(j,"yellow")}function h(j){return F(j,"red")}function k(j){return F(j,"cyan")}function z(j){return F(j,"gray")}var A;var N=M(()=>{A={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});function J(){console.log(`
Keyboard shortcuts:`),console.log(`  ${A.cyan}o${A.reset} + Enter - Open in browser`),console.log(`  ${A.cyan}c${A.reset} + Enter - Clear console`),console.log(`  ${A.cyan}q${A.reset} + Enter (or ${A.cyan}Ctrl+C${A.reset}) - Quit server`),console.log(`  ${A.cyan}h${A.reset} + Enter - Show this help`)}function X(j){console.log(`${A.green}Server running at ${A.cyan}${j}${A.reset}`),console.log(`Press ${A.cyan}Ctrl+C${A.reset} to stop the server`),J()}function Y(j){console.log(`${A.dim}Opening ${A.cyan}${j}${A.dim} in your browser...${A.reset}`),Bun.spawn(["open",j],{stderr:"inherit"})}function U(j,q,E){if(!process.stdin.isTTY)return;process.stdin.setRawMode(!0),process.stdin.setEncoding("utf8"),process.stdin.resume(),J();let D="";process.stdin.on("data",(K)=>{if(K==="\x03"){if(E?.onQuit)E.onQuit();q(),process.exit(0)}if(D+=K,D.endsWith("\r")||D.endsWith(`
`)){let O=D.trim().toLowerCase();D="",Z(O,j,q,E)}})}function Z(j,q,E,D){switch(j){case"o":if(D?.onOpen)D.onOpen();else Y(q);break;case"c":if(D?.onClear)D.onClear();else console.clear(),X(q);break;case"q":if(D?.onQuit)D.onQuit();console.log(`${A.yellow}Stopping server...${A.reset}`),E(),process.exit(0);break;case"h":if(D?.onHelp)D.onHelp();else J();break;default:break}}function f(){if(process.stdin.isTTY)process.stdin.setRawMode(!1),process.stdin.pause()}var _=M(()=>{N()});_();export{U as setupKeyboardShortcuts,J as printShortcutsHelp,X as printServerStatus,Y as openInBrowser,f as cleanupKeyboardShortcuts};
