(function(){"use strict";function _(s){s=s.split(`
`),s[s.length-1]==""&&s.pop();for(var t=!0,e={data:[],end_of_file:!1,bytes_total:0,start_linear_address:0},d=0,l=0,r=0;r<s.length&&t;r++){var n=parseInt(s[r].substr(1,2),16),i=parseInt(s[r].substr(3,4),16),u=parseInt(s[r].substr(7,2),16),a=s[r].substr(9,n*2),I=parseInt(s[r].substr(9+n*2,2),16);switch(u){case 0:(i!=l||l==0)&&e.data.push({address:d+i,bytes:0,data:[]}),l=i+n;for(var f=n+parseInt(s[r].substr(3,2),16)+parseInt(s[r].substr(5,2),16)+u,o=0;o<n*2;o+=2){var v=parseInt(a.substr(o,2),16),b=e.data.length-1;e.data[b].data.push(v),e.data[b].bytes++,f+=v,e.bytes_total++}f=~f+1&255,f!=I&&(t=!1);break;case 1:e.end_of_file=!0;break;case 2:parseInt(a,16)!=0&&console.log("extended segment address record found - NOT IMPLEMENTED !!!");break;case 3:parseInt(a,16)!=0&&console.log("start segment address record found - NOT IMPLEMENTED !!!");break;case 4:d=parseInt(a.substr(0,2),16)<<24|parseInt(a.substr(2,2),16)<<16;break;case 5:e.start_linear_address=parseInt(a,16);break}}e.end_of_file&&t?postMessage(e):postMessage(!1)}function p(){var s=new Date().getTime()/1e3;return s}onmessage=function(s){var t=p();_(s.data),console.log("HEX_PARSER - File parsed in: "+(p()-t).toFixed(4)+" seconds"),close()}})();
