
static.chunk-JC6BB4QW.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of yamcs-web Show documentation
Show all versions of yamcs-web Show documentation
Web UI for managing and monitoring Yamcs
import{d as B,e as E}from"./chunk-SJGMX7IO.js";import{Aa as w,Fa as C,Ka as S,L as v,La as R,Ma as H,Q as x,Wa as M,ea as m,f,ga as y,kf as l,mb as L}from"./chunk-7FNOC45H.js";var g=0,u=class{constructor(t){this.lines=[];this.bitlength=t.length*8;for(let e=0;e=i.length;this.addWord(i.substring(s,s+2),n)}if(i.length<16){let s={id:"p"+g++,type:"filler",content:" ".repeat(16-i.length),bitpos:this.range.stop,trailing:!0};this.asciiComponents.push(s);let n="";for(let o=0;o<32-2*(i.length%16);o++)o!==0&&(2*i.length+o)%4===0?n+=" ":n+=" ";n+=" ",s={id:"p"+g++,type:"filler",content:n,bitpos:this.range.stop,trailing:!0},this.hexComponents.push(s)}}get hexLengthInChars(){let t=0;for(let e of this.hexComponents)e.type==="word"?t+=e.nibbles.length:e.type==="filler"&&!e.trailing&&(t+=e.content.length);return t}get asciiLengthInChars(){let t=0;for(let e of this.asciiComponents)e.type==="word"?t+=e.chars.length:e.type==="filler"&&!e.trailing&&(t+=e.content.length);return t}lpad(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t}addWord(t,e){let i="",s="";for(let r=0;r{new FontFace("Roboto Mono",e).load().then(()=>i(!0)).catch(()=>i(!1))})}ngAfterViewInit(){this.fontPreloaded$.then(()=>this.initCanvas())}get highlight(){return this._highlight}set highlight(t){this._highlight=t,(t||null)!==this.highlighted$.value&&this.highlighted$.next(t||null)}get selection(){return this._selection}set selection(t){this._selection=t,(t||null)!==this.selection$.value&&this.selection$.next(t||null)}initCanvas(){let t=this.canvasEl.nativeElement,e=t.getContext("2d");e.font=`${this.fontSize}px 'Roboto Mono', monospace`,this.charWidth=e.measureText("0").width,this.g=new E(t),new B(this.g.canvas,this.g.hitCanvas),this.mediaQueryListEventListener=()=>{this.dirty=!0,this.mediaQueryList=matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`),this.mediaQueryList.addEventListener("change",this.mediaQueryListEventListener,{once:!0})},this.mediaQueryListEventListener(),this.animationFrameRequest=window.requestAnimationFrame(()=>this.step())}ngOnChanges(){let t=window.atob(this.base64String??"");this.model=new u(t),this.highlight=void 0,this.selection=void 0,this.pressStart=void 0,this.dirty=!0}setHighlight(t){t?this.highlight=t:this.highlight=void 0,this.dirty=!0}setSelection(t){t?this.selection=t:this.selection=void 0,this.dirty=!0}onMouseUp(){this.pressStart=void 0}onMouseOut(){this.highlight=void 0}step(){if(this.animationFrameRequest=window.requestAnimationFrame(()=>this.step()),!this.dirty)return;let t=Math.ceil(this.charWidth*63);this.g.resize(t,this.fontSize*this.model.lines.length),this.g.ctx.clearRect(0,0,this.g.canvas.width,this.g.canvas.height),this.g.clearHitCanvas();let e=0;for(let i of this.model.lines)this.drawCharcount(i,e),this.drawHex(i,e),this.drawAscii(i,e),e+=this.fontSize;this.dirty=!1}drawCharcount(t,e){let i=t.charCountHex+": ";this.g.addHitRegion({id:t.id,mouseDown:()=>{this.pressStart=t.range,this.selection=t.range,this.dirty=!0},mouseEnter:()=>{this.highlight=t.range,this.dirty=!0},mouseLeave:()=>{this.highlight=void 0,this.dirty=!0},mouseMove:s=>{if(s&&this.pressStart){let n=this.pressStart.join(t.range);this.selection=n,this.dirty=!0}}}).addRect(0,e,this.charWidth*i.length,this.fontSize),this.g.fillText({x:0,y:e,baseline:"top",align:"left",font:`${this.fontSize}px 'Roboto Mono', monospace`,color:"#777777",text:i})}drawHex(t,e){let i=this.charWidth*(t.charCountHex+": ").length;for(let s=0;s{this.pressStart=n.range,this.selection=n.range,this.dirty=!0},mouseEnter:()=>{this.highlight=n.range,this.dirty=!0},mouseLeave:()=>{this.highlight=void 0,this.dirty=!0},mouseMove:o=>{if(o&&this.pressStart){let h=this.pressStart.join(n.range);this.selection=h,this.dirty=!0}}}).addRect(i,e,n.nibbles.length*this.charWidth,this.fontSize);for(let o of n.nibbles){let h,a="#000000";!this.pressStart&&this.highlight&&this.highlight.overlaps(o.range)?h="lightgrey":this.selection&&this.selection.overlaps(o.range)&&(h="#009e87",a="#ffffff"),h&&this.g.fillRect({x:Math.floor(i),y:Math.floor(e),width:Math.ceil(this.charWidth),height:this.fontSize,fill:h}),this.g.fillText({x:i,y:e,baseline:"top",align:"left",font:`${this.fontSize}px 'Roboto Mono', monospace`,color:a,text:o.content}),i+=this.charWidth}}else if(n.type==="filler"){this.g.addHitRegion({id:n.id,mouseDown:()=>{this.pressStart=new l(n.bitpos,0)},mouseMove:h=>{if(h&&this.pressStart){let a=this.pressStart.joinBit(n.bitpos);this.selection=a,this.dirty=!0}}}).addRect(i,e,n.content.length*this.charWidth,this.fontSize);let o;!this.pressStart&&this.highlight&&this.highlight.containsBitExclusive(n.bitpos)?o="lightgrey":this.selection&&this.selection.containsBitExclusive(n.bitpos)&&(o="#009e87"),o&&s!==t.hexComponents.length-1&&this.g.fillRect({x:Math.floor(i),y:Math.floor(e),width:Math.ceil(this.charWidth*n.content.length),height:this.fontSize,fill:o}),i+=n.content.length*this.charWidth}}}drawAscii(t,e){let i=47*this.charWidth;for(let s of t.asciiComponents)if(s.type==="word")for(let n of s.chars){this.g.addHitRegion({id:s.id,mouseDown:()=>{this.pressStart=n.range,this.selection=n.range,this.dirty=!0},mouseEnter:()=>{this.highlight=n.range,this.dirty=!0},mouseLeave:()=>{this.highlight=void 0,this.dirty=!0},mouseMove:a=>{if(a&&this.pressStart){let d=this.pressStart.join(n.range);this.selection=d,this.dirty=!0}}}).addRect(i,e,this.charWidth,this.fontSize);let o,h="#777";!this.pressStart&&this.highlight&&this.highlight.overlaps(n.range)?o="lightgrey":this.selection&&this.selection.overlaps(n.range)&&(o="#009e87",h="#ffffff"),o&&this.g.fillRect({x:Math.floor(i),y:Math.floor(e),width:Math.ceil(this.charWidth),height:this.fontSize,fill:o}),this.g.fillText({x:i,y:e,baseline:"top",align:"left",font:`${this.fontSize}px 'Roboto Mono', monospace`,color:h,text:n.content}),i+=this.charWidth}else s.type==="filler"&&this.g.addHitRegion({id:s.id,mouseDown:()=>{this.pressStart=new l(s.bitpos,0)},mouseMove:n=>{if(n&&this.pressStart){let o=this.pressStart.joinBit(s.bitpos);this.selection=o,this.dirty=!0}}}).addRect(i,e,s.content.length*this.charWidth,this.fontSize)}ngOnDestroy(){this.mediaQueryList?.removeEventListener("change",this.mediaQueryListEventListener),this.animationFrameRequest&&window.cancelAnimationFrame(this.animationFrameRequest)}static{this.\u0275fac=function(e){return new(e||c)(y(L))}}static{this.\u0275cmp=v({type:c,selectors:[["app-hex"]],viewQuery:function(e,i){if(e&1&&S(A,5),e&2){let s;R(s=H())&&(i.canvasEl=s.first)}},hostBindings:function(e,i){e&1&&C("mouseup",function(){return i.onMouseUp()},!1,m)("mouseout",function(){return i.onMouseOut()},!1,m)},inputs:{base64String:"base64String",fontSize:"fontSize"},standalone:!0,features:[x,M],decls:2,vars:0,consts:[["canvasEl",""],["width","200","height","200"]],template:function(e,i){e&1&&w(0,"canvas",1,0)},styles:["*[_ngcontent-%COMP%]{user-select:none;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none}"],changeDetection:0})}};export{W as a};
© 2015 - 2025 Weber Informatics LLC | Privacy Policy