import{u as s}from"./common-36ea9db2.js";import{o as i,l as n}from"./index-7aa7f2ab.js";const a={id:"term",style:{"background-color":"#1e1e1e",padding:"16px","border-radius":"8px","overflow-y":"scroll"}},h={name:"ConsoleDisplayer",data(){return{logColorAnsiMap:{"\x1B[1;34m":"color: #0000FF; font-weight: bold;","\x1B[1;36m":"color: #00FFFF; font-weight: bold;","\x1B[1;33m":"color: #FFFF00; font-weight: bold;","\x1B[31m":"color: #FF0000;","\x1B[1;31m":"color: #FF0000; font-weight: bold;","\x1B[0m":"color: inherit; font-weight: normal;","\x1B[32m":"color: #00FF00;",default:"color: #FFFFFF;"},logCache:s().getLogCache(),historyNum_:-1}},props:{historyNum:{type:String,default:-1}},watch:{logCache:{handler(o){this.printLog(o[this.logCache.length-1])},deep:!0}},mounted(){this.historyNum_=parseInt(this.historyNum);let o=0;for(let t of this.logCache)this.historyNum_!=-1&&o>=this.logCache.length-this.historyNum_?(this.printLog(t),++o):this.historyNum_==-1&&this.printLog(t)},methods:{printLog(o){let t=document.getElementById("term"),e=document.createElement("pre"),r=this.logColorAnsiMap.default;for(let l in this.logColorAnsiMap)if(o.startsWith(l)){r=this.logColorAnsiMap[l],o=o.replace(l,"").replace("\x1B[0m","");break}e.style=r+"display: block; font-size: 12px; font-family: Consolas, monospace;",e.classList.add("fade-in"),e.innerText=o,t.appendChild(e),t.scrollTop=t.scrollHeight}}},p=Object.assign(h,{setup(o){return(t,e)=>(i(),n("div",a))}});export{p as _};
