class t{canvas=null;ctx=null;getShowData=null;storage=[];constructor(t,e,s,a){this.canvas=t,this.ctx=t.getContext("2d"),this.getShowData=e,this.outputLayer=s,this.cropFullInfo=JSON.parse(a)}#t(t,e){return t.length===e.length&&t.every((function(t,s){return t===e[s]}))}#e(t){if(t.length)for(let e=0;e{self.postMessage({img:t,type:"img"})})),self.GetImg=!1);const e=this.getShowData();e&&this.#e(e),t.close()}}self.GetImg=!1;let e=null,s=null;var a=new class{constructor(){this._items=[]}enqueue(t){this._items.push(t)}dequeue(){return this._items.shift()}head(){return this._items[0]}tail(){return this._items[this._items.length-1]}isEmpty(){return!this._items.length}size(){return this._items.length}clear(){this._items=[]}};const i=new VideoDecoder({output(t){!function(t){a.enqueue(t)}(t)},error(t){console.error(t)}});function h(){return s}setInterval((function(){a.size()>0&&e.draw(a.dequeue())}),39);var o=0,r="";self.addEventListener("message",(a=>{let{canvas:n,device:l,url:c,type:d}=a.data;if("jt"===d&&(self.GetImg=!0),"Opt"===a.data.DataType&&(r=a.data.data),"Start"===a.data.DataType&&(e=new t(n,h,null,r),!VideoDecoder))throw new Error("The current browser does not support the VideoDecoder API");if("Track"===a.data.DataType&&(i.configure({codec:a.data.codec,codedHeight:a.data.codedHeight,codedWidth:a.data.codedWidth,description:a.data.description}),console.log(a.data)),"Samples"===a.data.DataType)if(s=a.data.showData||null,i.decode(new EncodedVideoChunk({type:a.data.type,timestamp:a.data.timestamp,duration:a.data.duration,data:a.data.data})),3===o){self.postMessage(!0),o=4}else{if(4===o)return;o++}}));