slnodejs 6.1.259 → 6.1.263

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,7 +22,7 @@ if(s.dyn_ltree[9*2]!==0||s.dyn_ltree[10*2]!==0||s.dyn_ltree[13*2]!==0){return Z_
22
22
  sourceFile=aSourceMapConsumer.file}var sourceRoot=this._sourceRoot;if(sourceRoot!=null){sourceFile=util.relative(sourceRoot,sourceFile)}var newSources=new ArraySet;var newNames=new ArraySet;this._mappings.unsortedForEach(function(mapping){if(mapping.source===sourceFile&&mapping.originalLine!=null){var original=aSourceMapConsumer.originalPositionFor({line:mapping.originalLine,column:mapping.originalColumn});if(original.source!=null){mapping.source=original.source;if(aSourceMapPath!=null){mapping.source=util.join(aSourceMapPath,mapping.source)}if(sourceRoot!=null){mapping.source=util.relative(sourceRoot,mapping.source)}mapping.originalLine=original.line;mapping.originalColumn=original.column;if(original.name!=null){mapping.name=original.name}}}var source=mapping.source;if(source!=null&&!newSources.has(source)){newSources.add(source)}var name=mapping.name;if(name!=null&&!newNames.has(name)){newNames.add(name)}},this);this._sources=newSources;this._names=newNames;aSourceMapConsumer.sources.forEach(function(sourceFile){var content=aSourceMapConsumer.sourceContentFor(sourceFile);if(content!=null){if(aSourceMapPath!=null){sourceFile=util.join(aSourceMapPath,sourceFile)}if(sourceRoot!=null){sourceFile=util.relative(sourceRoot,sourceFile)}this.setSourceContent(sourceFile,content)}},this)};SourceMapGenerator.prototype._validateMapping=function SourceMapGenerator_validateMapping(aGenerated,aOriginal,aSource,aName){if(aOriginal&&typeof aOriginal.line!=="number"&&typeof aOriginal.column!=="number"){throw new Error("original.line and original.column are not numbers -- you probably meant to omit "+"the original mapping entirely and only map the generated position. If so, pass "+"null for the original mapping instead of an object with empty or null values.")}if(aGenerated&&"line"in aGenerated&&"column"in aGenerated&&aGenerated.line>0&&aGenerated.column>=0&&!aOriginal&&!aSource&&!aName){return}else if(aGenerated&&"line"in aGenerated&&"column"in aGenerated&&aOriginal&&"line"in aOriginal&&"column"in aOriginal&&aGenerated.line>0&&aGenerated.column>=0&&aOriginal.line>0&&aOriginal.column>=0&&aSource){return}else{throw new Error("Invalid mapping: "+JSON.stringify({generated:aGenerated,source:aSource,original:aOriginal,name:aName}))}};SourceMapGenerator.prototype._serializeMappings=function SourceMapGenerator_serializeMappings(){var previousGeneratedColumn=0;var previousGeneratedLine=1;var previousOriginalColumn=0;var previousOriginalLine=0;var previousName=0;var previousSource=0;var result="";var next;var mapping;var nameIdx;var sourceIdx;var mappings=this._mappings.toArray();for(var i=0,len=mappings.length;i<len;i++){mapping=mappings[i];next="";if(mapping.generatedLine!==previousGeneratedLine){previousGeneratedColumn=0;while(mapping.generatedLine!==previousGeneratedLine){next+=";";previousGeneratedLine++}}else{if(i>0){if(!util.compareByGeneratedPositionsInflated(mapping,mappings[i-1])){continue}next+=","}}next+=base64VLQ.encode(mapping.generatedColumn-previousGeneratedColumn);previousGeneratedColumn=mapping.generatedColumn;if(mapping.source!=null){sourceIdx=this._sources.indexOf(mapping.source);next+=base64VLQ.encode(sourceIdx-previousSource);previousSource=sourceIdx;next+=base64VLQ.encode(mapping.originalLine-1-previousOriginalLine);previousOriginalLine=mapping.originalLine-1;next+=base64VLQ.encode(mapping.originalColumn-previousOriginalColumn);previousOriginalColumn=mapping.originalColumn;if(mapping.name!=null){nameIdx=this._names.indexOf(mapping.name);next+=base64VLQ.encode(nameIdx-previousName);previousName=nameIdx}}result+=next}return result};SourceMapGenerator.prototype._generateSourcesContent=function SourceMapGenerator_generateSourcesContent(aSources,aSourceRoot){return aSources.map(function(source){if(!this._sourcesContents){return null}if(aSourceRoot!=null){source=util.relative(aSourceRoot,source)}var key=util.toSetString(source);return Object.prototype.hasOwnProperty.call(this._sourcesContents,key)?this._sourcesContents[key]:null},this)};SourceMapGenerator.prototype.toJSON=function SourceMapGenerator_toJSON(){var map={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};if(this._file!=null){map.file=this._file}if(this._sourceRoot!=null){map.sourceRoot=this._sourceRoot}if(this._sourcesContents){map.sourcesContent=this._generateSourcesContent(map.sources,map.sourceRoot)}return map};SourceMapGenerator.prototype.toString=function SourceMapGenerator_toString(){return JSON.stringify(this.toJSON())};exports.SourceMapGenerator=SourceMapGenerator},{"./array-set":218,"./base64-vlq":219,"./mapping-list":222,"./util":227}],226:[function(require,module,exports){var SourceMapGenerator=require("./source-map-generator").SourceMapGenerator;var util=require("./util");var REGEX_NEWLINE=/(\r?\n)/;var NEWLINE_CODE=10;var isSourceNode="$$$isSourceNode$$$";function SourceNode(aLine,aColumn,aSource,aChunks,aName){this.children=[];this.sourceContents={};this.line=aLine==null?null:aLine;this.column=aColumn==null?null:aColumn;this.source=aSource==null?null:aSource;this.name=aName==null?null:aName;this[isSourceNode]=true;if(aChunks!=null)this.add(aChunks)}SourceNode.fromStringWithSourceMap=function SourceNode_fromStringWithSourceMap(aGeneratedCode,aSourceMapConsumer,aRelativePath){var node=new SourceNode;var remainingLines=aGeneratedCode.split(REGEX_NEWLINE);var remainingLinesIndex=0;var shiftNextLine=function(){var lineContents=getNextLine();var newLine=getNextLine()||"";return lineContents+newLine;function getNextLine(){return remainingLinesIndex<remainingLines.length?remainingLines[remainingLinesIndex++]:undefined}};var lastGeneratedLine=1,lastGeneratedColumn=0;var lastMapping=null;aSourceMapConsumer.eachMapping(function(mapping){if(lastMapping!==null){if(lastGeneratedLine<mapping.generatedLine){addMappingWithCode(lastMapping,shiftNextLine());lastGeneratedLine++;lastGeneratedColumn=0}else{var nextLine=remainingLines[remainingLinesIndex];var code=nextLine.substr(0,mapping.generatedColumn-lastGeneratedColumn);remainingLines[remainingLinesIndex]=nextLine.substr(mapping.generatedColumn-lastGeneratedColumn);lastGeneratedColumn=mapping.generatedColumn;addMappingWithCode(lastMapping,code);lastMapping=mapping;return}}while(lastGeneratedLine<mapping.generatedLine){node.add(shiftNextLine());lastGeneratedLine++}if(lastGeneratedColumn<mapping.generatedColumn){var nextLine=remainingLines[remainingLinesIndex];node.add(nextLine.substr(0,mapping.generatedColumn));remainingLines[remainingLinesIndex]=nextLine.substr(mapping.generatedColumn);lastGeneratedColumn=mapping.generatedColumn}lastMapping=mapping},this);if(remainingLinesIndex<remainingLines.length){if(lastMapping){addMappingWithCode(lastMapping,shiftNextLine())}node.add(remainingLines.splice(remainingLinesIndex).join(""))}aSourceMapConsumer.sources.forEach(function(sourceFile){var content=aSourceMapConsumer.sourceContentFor(sourceFile);if(content!=null){if(aRelativePath!=null){sourceFile=util.join(aRelativePath,sourceFile)}node.setSourceContent(sourceFile,content)}});return node;function addMappingWithCode(mapping,code){if(mapping===null||mapping.source===undefined){node.add(code)}else{var source=aRelativePath?util.join(aRelativePath,mapping.source):mapping.source;node.add(new SourceNode(mapping.originalLine,mapping.originalColumn,source,code,mapping.name))}}};SourceNode.prototype.add=function SourceNode_add(aChunk){if(Array.isArray(aChunk)){aChunk.forEach(function(chunk){this.add(chunk)},this)}else if(aChunk[isSourceNode]||typeof aChunk==="string"){if(aChunk){this.children.push(aChunk)}}else{throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+aChunk)}return this};SourceNode.prototype.prepend=function SourceNode_prepend(aChunk){if(Array.isArray(aChunk)){for(var i=aChunk.length-1;i>=0;i--){this.prepend(aChunk[i])}}else if(aChunk[isSourceNode]||typeof aChunk==="string"){this.children.unshift(aChunk)}else{throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+aChunk)}return this};SourceNode.prototype.walk=function SourceNode_walk(aFn){var chunk;for(var i=0,len=this.children.length;i<len;i++){chunk=this.children[i];if(chunk[isSourceNode]){chunk.walk(aFn)}else{if(chunk!==""){aFn(chunk,{source:this.source,line:this.line,column:this.column,name:this.name})}}}};SourceNode.prototype.join=function SourceNode_join(aSep){var newChildren;var i;var len=this.children.length;if(len>0){newChildren=[];for(i=0;i<len-1;i++){newChildren.push(this.children[i]);newChildren.push(aSep)}newChildren.push(this.children[i]);this.children=newChildren}return this};SourceNode.prototype.replaceRight=function SourceNode_replaceRight(aPattern,aReplacement){var lastChild=this.children[this.children.length-1];if(lastChild[isSourceNode]){lastChild.replaceRight(aPattern,aReplacement)}else if(typeof lastChild==="string"){this.children[this.children.length-1]=lastChild.replace(aPattern,aReplacement)}else{this.children.push("".replace(aPattern,aReplacement))}return this};SourceNode.prototype.setSourceContent=function SourceNode_setSourceContent(aSourceFile,aSourceContent){this.sourceContents[util.toSetString(aSourceFile)]=aSourceContent};SourceNode.prototype.walkSourceContents=function SourceNode_walkSourceContents(aFn){for(var i=0,len=this.children.length;i<len;i++){if(this.children[i][isSourceNode]){this.children[i].walkSourceContents(aFn)}}var sources=Object.keys(this.sourceContents);for(var i=0,len=sources.length;i<len;i++){aFn(util.fromSetString(sources[i]),this.sourceContents[sources[i]])}};SourceNode.prototype.toString=function SourceNode_toString(){var str="";this.walk(function(chunk){str+=chunk});return str};SourceNode.prototype.toStringWithSourceMap=function SourceNode_toStringWithSourceMap(aArgs){var generated={code:"",line:1,column:0};var map=new SourceMapGenerator(aArgs);var sourceMappingActive=false;var lastOriginalSource=null;var lastOriginalLine=null;var lastOriginalColumn=null;var lastOriginalName=null;this.walk(function(chunk,original){generated.code+=chunk;if(original.source!==null&&original.line!==null&&original.column!==null){if(lastOriginalSource!==original.source||lastOriginalLine!==original.line||lastOriginalColumn!==original.column||lastOriginalName!==original.name){map.addMapping({source:original.source,original:{line:original.line,column:original.column},generated:{line:generated.line,column:generated.column},name:original.name})}lastOriginalSource=original.source;lastOriginalLine=original.line;lastOriginalColumn=original.column;lastOriginalName=original.name;sourceMappingActive=true}else if(sourceMappingActive){map.addMapping({generated:{line:generated.line,column:generated.column}});lastOriginalSource=null;sourceMappingActive=false}for(var idx=0,length=chunk.length;idx<length;idx++){if(chunk.charCodeAt(idx)===NEWLINE_CODE){generated.line++;generated.column=0;if(idx+1===length){lastOriginalSource=null;sourceMappingActive=false}else if(sourceMappingActive){map.addMapping({source:original.source,original:{line:original.line,column:original.column},generated:{line:generated.line,column:generated.column},name:original.name})}}else{generated.column++}}});this.walkSourceContents(function(sourceFile,sourceContent){map.setSourceContent(sourceFile,sourceContent)});return{code:generated.code,map:map}};exports.SourceNode=SourceNode},{"./source-map-generator":225,"./util":227}],227:[function(require,module,exports){function getArg(aArgs,aName,aDefaultValue){if(aName in aArgs){return aArgs[aName]}else if(arguments.length===3){return aDefaultValue}else{throw new Error('"'+aName+'" is a required argument.')}}exports.getArg=getArg;var urlRegexp=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/;var dataUrlRegexp=/^data:.+\,.+$/;function urlParse(aUrl){var match=aUrl.match(urlRegexp);if(!match){return null}return{scheme:match[1],auth:match[2],host:match[3],port:match[4],path:match[5]}}exports.urlParse=urlParse;function urlGenerate(aParsedUrl){var url="";if(aParsedUrl.scheme){url+=aParsedUrl.scheme+":"}url+="//";if(aParsedUrl.auth){url+=aParsedUrl.auth+"@"}if(aParsedUrl.host){url+=aParsedUrl.host}if(aParsedUrl.port){url+=":"+aParsedUrl.port}if(aParsedUrl.path){url+=aParsedUrl.path}return url}exports.urlGenerate=urlGenerate;function normalize(aPath){var path=aPath;var url=urlParse(aPath);if(url){if(!url.path){return aPath}path=url.path}var isAbsolute=exports.isAbsolute(path);var parts=path.split(/\/+/);for(var part,up=0,i=parts.length-1;i>=0;i--){part=parts[i];if(part==="."){parts.splice(i,1)}else if(part===".."){up++}else if(up>0){if(part===""){parts.splice(i+1,up);up=0}else{parts.splice(i,2);up--}}}path=parts.join("/");if(path===""){path=isAbsolute?"/":"."}if(url){url.path=path;return urlGenerate(url)}return path}exports.normalize=normalize;function join(aRoot,aPath){if(aRoot===""){aRoot="."}if(aPath===""){aPath="."}var aPathUrl=urlParse(aPath);var aRootUrl=urlParse(aRoot);if(aRootUrl){aRoot=aRootUrl.path||"/"}if(aPathUrl&&!aPathUrl.scheme){if(aRootUrl){aPathUrl.scheme=aRootUrl.scheme}return urlGenerate(aPathUrl)}if(aPathUrl||aPath.match(dataUrlRegexp)){return aPath}if(aRootUrl&&!aRootUrl.host&&!aRootUrl.path){aRootUrl.host=aPath;return urlGenerate(aRootUrl)}var joined=aPath.charAt(0)==="/"?aPath:normalize(aRoot.replace(/\/+$/,"")+"/"+aPath);if(aRootUrl){aRootUrl.path=joined;return urlGenerate(aRootUrl)}return joined}exports.join=join;exports.isAbsolute=function(aPath){return aPath.charAt(0)==="/"||!!aPath.match(urlRegexp)};function relative(aRoot,aPath){if(aRoot===""){aRoot="."}aRoot=aRoot.replace(/\/$/,"");var level=0;while(aPath.indexOf(aRoot+"/")!==0){var index=aRoot.lastIndexOf("/");if(index<0){return aPath}aRoot=aRoot.slice(0,index);if(aRoot.match(/^([^\/]+:\/)?\/*$/)){return aPath}++level}return Array(level+1).join("../")+aPath.substr(aRoot.length+1)}exports.relative=relative;var supportsNullProto=function(){var obj=Object.create(null);return!("__proto__"in obj)}();function identity(s){return s}function toSetString(aStr){if(isProtoString(aStr)){return"$"+aStr}return aStr}exports.toSetString=supportsNullProto?identity:toSetString;function fromSetString(aStr){if(isProtoString(aStr)){return aStr.slice(1)}return aStr}exports.fromSetString=supportsNullProto?identity:fromSetString;function isProtoString(s){if(!s){return false}var length=s.length;if(length<9){return false}if(s.charCodeAt(length-1)!==95||s.charCodeAt(length-2)!==95||s.charCodeAt(length-3)!==111||s.charCodeAt(length-4)!==116||s.charCodeAt(length-5)!==111||s.charCodeAt(length-6)!==114||s.charCodeAt(length-7)!==112||s.charCodeAt(length-8)!==95||s.charCodeAt(length-9)!==95){return false}for(var i=length-10;i>=0;i--){if(s.charCodeAt(i)!==36){return false}}return true}function compareByOriginalPositions(mappingA,mappingB,onlyCompareOriginal){var cmp=mappingA.source-mappingB.source;if(cmp!==0){return cmp}cmp=mappingA.originalLine-mappingB.originalLine;if(cmp!==0){return cmp}cmp=mappingA.originalColumn-mappingB.originalColumn;if(cmp!==0||onlyCompareOriginal){return cmp}cmp=mappingA.generatedColumn-mappingB.generatedColumn;if(cmp!==0){return cmp}cmp=mappingA.generatedLine-mappingB.generatedLine;if(cmp!==0){return cmp}return mappingA.name-mappingB.name}exports.compareByOriginalPositions=compareByOriginalPositions;function compareByGeneratedPositionsDeflated(mappingA,mappingB,onlyCompareGenerated){var cmp=mappingA.generatedLine-mappingB.generatedLine;if(cmp!==0){return cmp}cmp=mappingA.generatedColumn-mappingB.generatedColumn;if(cmp!==0||onlyCompareGenerated){return cmp}cmp=mappingA.source-mappingB.source;if(cmp!==0){return cmp}cmp=mappingA.originalLine-mappingB.originalLine;if(cmp!==0){return cmp}cmp=mappingA.originalColumn-mappingB.originalColumn;if(cmp!==0){return cmp}return mappingA.name-mappingB.name}exports.compareByGeneratedPositionsDeflated=compareByGeneratedPositionsDeflated;function strcmp(aStr1,aStr2){if(aStr1===aStr2){return 0}if(aStr1>aStr2){return 1}return-1}function compareByGeneratedPositionsInflated(mappingA,mappingB){var cmp=mappingA.generatedLine-mappingB.generatedLine;if(cmp!==0){return cmp}cmp=mappingA.generatedColumn-mappingB.generatedColumn;if(cmp!==0){return cmp}cmp=strcmp(mappingA.source,mappingB.source);if(cmp!==0){return cmp}cmp=mappingA.originalLine-mappingB.originalLine;if(cmp!==0){return cmp}cmp=mappingA.originalColumn-mappingB.originalColumn;if(cmp!==0){return cmp}return strcmp(mappingA.name,mappingB.name)}exports.compareByGeneratedPositionsInflated=compareByGeneratedPositionsInflated},{}],228:[function(require,module,exports){exports.SourceMapGenerator=require("./lib/source-map-generator").SourceMapGenerator;exports.SourceMapConsumer=require("./lib/source-map-consumer").SourceMapConsumer;exports.SourceNode=require("./lib/source-node").SourceNode},{"./lib/source-map-consumer":224,"./lib/source-map-generator":225,"./lib/source-node":226}],229:[function(require,module,exports){module.exports=Stream;var EE=require("events").EventEmitter;var inherits=require("inherits");inherits(Stream,EE);Stream.Readable=require("readable-stream/readable.js");Stream.Writable=require("readable-stream/writable.js");Stream.Duplex=require("readable-stream/duplex.js");Stream.Transform=require("readable-stream/transform.js");Stream.PassThrough=require("readable-stream/passthrough.js");Stream.Stream=Stream;function Stream(){EE.call(this)}Stream.prototype.pipe=function(dest,options){var source=this;function ondata(chunk){if(dest.writable){if(false===dest.write(chunk)&&source.pause){source.pause()}}}source.on("data",ondata);function ondrain(){if(source.readable&&source.resume){source.resume()}}dest.on("drain",ondrain);if(!dest._isStdio&&(!options||options.end!==false)){source.on("end",onend);source.on("close",onclose)}var didOnEnd=false;function onend(){if(didOnEnd)return;didOnEnd=true;dest.end()}function onclose(){if(didOnEnd)return;didOnEnd=true;if(typeof dest.destroy==="function")dest.destroy()}function onerror(er){cleanup();if(EE.listenerCount(this,"error")===0){throw er}}source.on("error",onerror);dest.on("error",onerror);function cleanup(){source.removeListener("data",ondata);dest.removeListener("drain",ondrain);source.removeListener("end",onend);source.removeListener("close",onclose);source.removeListener("error",onerror);dest.removeListener("error",onerror);source.removeListener("end",cleanup);source.removeListener("close",cleanup);dest.removeListener("close",cleanup)}source.on("end",cleanup);source.on("close",cleanup);dest.on("close",cleanup);dest.emit("pipe",source);return dest}},{events:110,inherits:145,"readable-stream/duplex.js":193,"readable-stream/passthrough.js":204,"readable-stream/readable.js":205,"readable-stream/transform.js":206,"readable-stream/writable.js":207}],230:[function(require,module,exports){(function(global){(function(){var ClientRequest=require("./lib/request");var response=require("./lib/response");var extend=require("xtend");var statusCodes=require("builtin-status-codes");var url=require("url");var http=exports;http.request=function(opts,cb){if(typeof opts==="string")opts=url.parse(opts);else opts=extend(opts);var defaultProtocol=global.location.protocol.search(/^https?:$/)===-1?"http:":"";var protocol=opts.protocol||defaultProtocol;var host=opts.hostname||opts.host;var port=opts.port;var path=opts.path||"/";if(host&&host.indexOf(":")!==-1)host="["+host+"]";opts.url=(host?protocol+"//"+host:"")+(port?":"+port:"")+path;opts.method=(opts.method||"GET").toUpperCase();opts.headers=opts.headers||{};var req=new ClientRequest(opts);if(cb)req.on("response",cb);return req};http.get=function get(opts,cb){var req=http.request(opts,cb);req.end();return req};http.ClientRequest=ClientRequest;http.IncomingMessage=response.IncomingMessage;http.Agent=function(){};http.Agent.defaultMaxSockets=4;http.globalAgent=new http.Agent;http.STATUS_CODES=statusCodes;http.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}).call(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./lib/request":232,"./lib/response":233,"builtin-status-codes":72,url:238,xtend:245}],231:[function(require,module,exports){(function(global){(function(){exports.fetch=isFunction(global.fetch)&&isFunction(global.ReadableStream);exports.writableStream=isFunction(global.WritableStream);exports.abortController=isFunction(global.AbortController);exports.blobConstructor=false;try{new Blob([new ArrayBuffer(1)]);exports.blobConstructor=true}catch(e){}var xhr;function getXHR(){if(xhr!==undefined)return xhr;if(global.XMLHttpRequest){xhr=new global.XMLHttpRequest;try{xhr.open("GET",global.XDomainRequest?"/":"https://example.com")}catch(e){xhr=null}}else{xhr=null}return xhr}function checkTypeSupport(type){var xhr=getXHR();if(!xhr)return false;try{xhr.responseType=type;return xhr.responseType===type}catch(e){}return false}var haveArrayBuffer=typeof global.ArrayBuffer!=="undefined";var haveSlice=haveArrayBuffer&&isFunction(global.ArrayBuffer.prototype.slice);exports.arraybuffer=exports.fetch||haveArrayBuffer&&checkTypeSupport("arraybuffer");exports.msstream=!exports.fetch&&haveSlice&&checkTypeSupport("ms-stream");exports.mozchunkedarraybuffer=!exports.fetch&&haveArrayBuffer&&checkTypeSupport("moz-chunked-arraybuffer");exports.overrideMimeType=exports.fetch||(getXHR()?isFunction(getXHR().overrideMimeType):false);exports.vbArray=isFunction(global.VBArray);function isFunction(value){return typeof value==="function"}xhr=null}).call(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],232:[function(require,module,exports){(function(process,global,Buffer){(function(){var capability=require("./capability");var inherits=require("inherits");var response=require("./response");var stream=require("readable-stream");var toArrayBuffer=require("to-arraybuffer");var IncomingMessage=response.IncomingMessage;var rStates=response.readyStates;function decideMode(preferBinary,useFetch){if(capability.fetch&&useFetch){return"fetch"}else if(capability.mozchunkedarraybuffer){return"moz-chunked-arraybuffer"}else if(capability.msstream){return"ms-stream"}else if(capability.arraybuffer&&preferBinary){return"arraybuffer"}else if(capability.vbArray&&preferBinary){return"text:vbarray"}else{return"text"}}var ClientRequest=module.exports=function(opts){var self=this;stream.Writable.call(self);self._opts=opts;self._body=[];self._headers={};if(opts.auth)self.setHeader("Authorization","Basic "+new Buffer(opts.auth).toString("base64"));Object.keys(opts.headers).forEach(function(name){self.setHeader(name,opts.headers[name])});var preferBinary;var useFetch=true;if(opts.mode==="disable-fetch"||"requestTimeout"in opts&&!capability.abortController){useFetch=false;preferBinary=true}else if(opts.mode==="prefer-streaming"){preferBinary=false}else if(opts.mode==="allow-wrong-content-type"){preferBinary=!capability.overrideMimeType}else if(!opts.mode||opts.mode==="default"||opts.mode==="prefer-fast"){preferBinary=true}else{throw new Error("Invalid value for opts.mode")}self._mode=decideMode(preferBinary,useFetch);self._fetchTimer=null;self.on("finish",function(){self._onFinish()})};inherits(ClientRequest,stream.Writable);ClientRequest.prototype.setHeader=function(name,value){var self=this;var lowerName=name.toLowerCase();if(unsafeHeaders.indexOf(lowerName)!==-1)return;self._headers[lowerName]={name:name,value:value}};ClientRequest.prototype.getHeader=function(name){var header=this._headers[name.toLowerCase()];if(header)return header.value;return null};ClientRequest.prototype.removeHeader=function(name){var self=this;delete self._headers[name.toLowerCase()]};ClientRequest.prototype._onFinish=function(){var self=this;if(self._destroyed)return;var opts=self._opts;var headersObj=self._headers;var body=null;if(opts.method!=="GET"&&opts.method!=="HEAD"){if(capability.arraybuffer){body=toArrayBuffer(Buffer.concat(self._body))}else if(capability.blobConstructor){body=new global.Blob(self._body.map(function(buffer){return toArrayBuffer(buffer)}),{type:(headersObj["content-type"]||{}).value||""})}else{body=Buffer.concat(self._body).toString()}}var headersList=[];Object.keys(headersObj).forEach(function(keyName){var name=headersObj[keyName].name;var value=headersObj[keyName].value;if(Array.isArray(value)){value.forEach(function(v){headersList.push([name,v])})}else{headersList.push([name,value])}});if(self._mode==="fetch"){var signal=null;var fetchTimer=null;if(capability.abortController){var controller=new AbortController;signal=controller.signal;self._fetchAbortController=controller;if("requestTimeout"in opts&&opts.requestTimeout!==0){self._fetchTimer=global.setTimeout(function(){self.emit("requestTimeout");if(self._fetchAbortController)self._fetchAbortController.abort()},opts.requestTimeout)}}global.fetch(self._opts.url,{method:self._opts.method,headers:headersList,body:body||undefined,mode:"cors",credentials:opts.withCredentials?"include":"same-origin",signal:signal}).then(function(response){self._fetchResponse=response;self._connect()},function(reason){global.clearTimeout(self._fetchTimer);if(!self._destroyed)self.emit("error",reason)})}else{var xhr=self._xhr=new global.XMLHttpRequest;try{xhr.open(self._opts.method,self._opts.url,true)}catch(err){process.nextTick(function(){self.emit("error",err)});return}if("responseType"in xhr)xhr.responseType=self._mode.split(":")[0];if("withCredentials"in xhr)xhr.withCredentials=!!opts.withCredentials;if(self._mode==="text"&&"overrideMimeType"in xhr)xhr.overrideMimeType("text/plain; charset=x-user-defined");if("requestTimeout"in opts){xhr.timeout=opts.requestTimeout;xhr.ontimeout=function(){self.emit("requestTimeout")}}headersList.forEach(function(header){xhr.setRequestHeader(header[0],header[1])});self._response=null;xhr.onreadystatechange=function(){switch(xhr.readyState){case rStates.LOADING:case rStates.DONE:self._onXHRProgress();break}};if(self._mode==="moz-chunked-arraybuffer"){xhr.onprogress=function(){self._onXHRProgress()}}xhr.onerror=function(){if(self._destroyed)return;self.emit("error",new Error("XHR error"))};try{xhr.send(body)}catch(err){process.nextTick(function(){self.emit("error",err)});return}}};function statusValid(xhr){try{var status=xhr.status;return status!==null&&status!==0}catch(e){return false}}ClientRequest.prototype._onXHRProgress=function(){var self=this;if(!statusValid(self._xhr)||self._destroyed)return;if(!self._response)self._connect();self._response._onXHRProgress()};ClientRequest.prototype._connect=function(){var self=this;if(self._destroyed)return;self._response=new IncomingMessage(self._xhr,self._fetchResponse,self._mode,self._fetchTimer);self._response.on("error",function(err){self.emit("error",err)});self.emit("response",self._response)};ClientRequest.prototype._write=function(chunk,encoding,cb){var self=this;self._body.push(chunk);cb()};ClientRequest.prototype.abort=ClientRequest.prototype.destroy=function(){var self=this;self._destroyed=true;global.clearTimeout(self._fetchTimer);if(self._response)self._response._destroyed=true;if(self._xhr)self._xhr.abort();else if(self._fetchAbortController)self._fetchAbortController.abort()};ClientRequest.prototype.end=function(data,encoding,cb){var self=this;if(typeof data==="function"){cb=data;data=undefined}stream.Writable.prototype.end.call(self,data,encoding,cb)};ClientRequest.prototype.flushHeaders=function(){};ClientRequest.prototype.setTimeout=function(){};ClientRequest.prototype.setNoDelay=function(){};ClientRequest.prototype.setSocketKeepAlive=function(){};var unsafeHeaders=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"]}).call(this)}).call(this,require("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},require("buffer").Buffer)},{"./capability":231,"./response":233,_process:179,buffer:71,inherits:145,"readable-stream":205,"to-arraybuffer":237}],233:[function(require,module,exports){(function(process,global,Buffer){(function(){var capability=require("./capability");var inherits=require("inherits");var stream=require("readable-stream");var rStates=exports.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4};var IncomingMessage=exports.IncomingMessage=function(xhr,response,mode,fetchTimer){var self=this;stream.Readable.call(self);self._mode=mode;self.headers={};self.rawHeaders=[];self.trailers={};self.rawTrailers=[];self.on("end",function(){process.nextTick(function(){self.emit("close")})});if(mode==="fetch"){self._fetchResponse=response;self.url=response.url;self.statusCode=response.status;self.statusMessage=response.statusText;response.headers.forEach(function(header,key){self.headers[key.toLowerCase()]=header;self.rawHeaders.push(key,header)});if(capability.writableStream){var writable=new WritableStream({write:function(chunk){return new Promise(function(resolve,reject){if(self._destroyed){reject()}else if(self.push(new Buffer(chunk))){resolve()}else{self._resumeFetch=resolve}})},close:function(){global.clearTimeout(fetchTimer);if(!self._destroyed)self.push(null)},abort:function(err){if(!self._destroyed)self.emit("error",err)}});try{response.body.pipeTo(writable).catch(function(err){global.clearTimeout(fetchTimer);if(!self._destroyed)self.emit("error",err)});return}catch(e){}}var reader=response.body.getReader();function read(){reader.read().then(function(result){if(self._destroyed)return;if(result.done){global.clearTimeout(fetchTimer);self.push(null);return}self.push(new Buffer(result.value));read()}).catch(function(err){global.clearTimeout(fetchTimer);if(!self._destroyed)self.emit("error",err)})}read()}else{self._xhr=xhr;self._pos=0;self.url=xhr.responseURL;self.statusCode=xhr.status;self.statusMessage=xhr.statusText;var headers=xhr.getAllResponseHeaders().split(/\r?\n/);headers.forEach(function(header){var matches=header.match(/^([^:]+):\s*(.*)/);if(matches){var key=matches[1].toLowerCase();if(key==="set-cookie"){if(self.headers[key]===undefined){self.headers[key]=[]}self.headers[key].push(matches[2])}else if(self.headers[key]!==undefined){self.headers[key]+=", "+matches[2]}else{self.headers[key]=matches[2]}self.rawHeaders.push(matches[1],matches[2])}});self._charset="x-user-defined";if(!capability.overrideMimeType){var mimeType=self.rawHeaders["mime-type"];if(mimeType){var charsetMatch=mimeType.match(/;\s*charset=([^;])(;|$)/);if(charsetMatch){self._charset=charsetMatch[1].toLowerCase()}}if(!self._charset)self._charset="utf-8"}}};inherits(IncomingMessage,stream.Readable);IncomingMessage.prototype._read=function(){var self=this;var resolve=self._resumeFetch;if(resolve){self._resumeFetch=null;resolve()}};IncomingMessage.prototype._onXHRProgress=function(){var self=this;var xhr=self._xhr;var response=null;switch(self._mode){case"text:vbarray":if(xhr.readyState!==rStates.DONE)break;try{response=new global.VBArray(xhr.responseBody).toArray()}catch(e){}if(response!==null){self.push(new Buffer(response));break}case"text":try{response=xhr.responseText}catch(e){self._mode="text:vbarray";break}if(response.length>self._pos){var newData=response.substr(self._pos);if(self._charset==="x-user-defined"){var buffer=new Buffer(newData.length);for(var i=0;i<newData.length;i++)buffer[i]=newData.charCodeAt(i)&255;self.push(buffer)}else{self.push(newData,self._charset)}self._pos=response.length}break;case"arraybuffer":if(xhr.readyState!==rStates.DONE||!xhr.response)break;response=xhr.response;self.push(new Buffer(new Uint8Array(response)));break;case"moz-chunked-arraybuffer":response=xhr.response
23
23
  ;if(xhr.readyState!==rStates.LOADING||!response)break;self.push(new Buffer(new Uint8Array(response)));break;case"ms-stream":response=xhr.response;if(xhr.readyState!==rStates.LOADING)break;var reader=new global.MSStreamReader;reader.onprogress=function(){if(reader.result.byteLength>self._pos){self.push(new Buffer(new Uint8Array(reader.result.slice(self._pos))));self._pos=reader.result.byteLength}};reader.onload=function(){self.push(null)};reader.readAsArrayBuffer(response);break}if(self._xhr.readyState===rStates.DONE&&self._mode!=="ms-stream"){self.push(null)}}}).call(this)}).call(this,require("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},require("buffer").Buffer)},{"./capability":231,_process:179,buffer:71,inherits:145,"readable-stream":205}],234:[function(require,module,exports){"use strict";var Buffer=require("safe-buffer").Buffer;var isEncoding=Buffer.isEncoding||function(encoding){encoding=""+encoding;switch(encoding&&encoding.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return true;default:return false}};function _normalizeEncoding(enc){if(!enc)return"utf8";var retried;while(true){switch(enc){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return enc;default:if(retried)return;enc=(""+enc).toLowerCase();retried=true}}}function normalizeEncoding(enc){var nenc=_normalizeEncoding(enc);if(typeof nenc!=="string"&&(Buffer.isEncoding===isEncoding||!isEncoding(enc)))throw new Error("Unknown encoding: "+enc);return nenc||enc}exports.StringDecoder=StringDecoder;function StringDecoder(encoding){this.encoding=normalizeEncoding(encoding);var nb;switch(this.encoding){case"utf16le":this.text=utf16Text;this.end=utf16End;nb=4;break;case"utf8":this.fillLast=utf8FillLast;nb=4;break;case"base64":this.text=base64Text;this.end=base64End;nb=3;break;default:this.write=simpleWrite;this.end=simpleEnd;return}this.lastNeed=0;this.lastTotal=0;this.lastChar=Buffer.allocUnsafe(nb)}StringDecoder.prototype.write=function(buf){if(buf.length===0)return"";var r;var i;if(this.lastNeed){r=this.fillLast(buf);if(r===undefined)return"";i=this.lastNeed;this.lastNeed=0}else{i=0}if(i<buf.length)return r?r+this.text(buf,i):this.text(buf,i);return r||""};StringDecoder.prototype.end=utf8End;StringDecoder.prototype.text=utf8Text;StringDecoder.prototype.fillLast=function(buf){if(this.lastNeed<=buf.length){buf.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed);return this.lastChar.toString(this.encoding,0,this.lastTotal)}buf.copy(this.lastChar,this.lastTotal-this.lastNeed,0,buf.length);this.lastNeed-=buf.length};function utf8CheckByte(byte){if(byte<=127)return 0;else if(byte>>5===6)return 2;else if(byte>>4===14)return 3;else if(byte>>3===30)return 4;return-1}function utf8CheckIncomplete(self,buf,i){var j=buf.length-1;if(j<i)return 0;var nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-1;return nb}if(--j<i)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-2;return nb}if(--j<i)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0){if(nb===2)nb=0;else self.lastNeed=nb-3}return nb}return 0}function utf8CheckExtraBytes(self,buf,p){if((buf[0]&192)!==128){self.lastNeed=0;return"�".repeat(p)}if(self.lastNeed>1&&buf.length>1){if((buf[1]&192)!==128){self.lastNeed=1;return"�".repeat(p+1)}if(self.lastNeed>2&&buf.length>2){if((buf[2]&192)!==128){self.lastNeed=2;return"�".repeat(p+2)}}}}function utf8FillLast(buf){var p=this.lastTotal-this.lastNeed;var r=utf8CheckExtraBytes(this,buf,p);if(r!==undefined)return r;if(this.lastNeed<=buf.length){buf.copy(this.lastChar,p,0,this.lastNeed);return this.lastChar.toString(this.encoding,0,this.lastTotal)}buf.copy(this.lastChar,p,0,buf.length);this.lastNeed-=buf.length}function utf8Text(buf,i){var total=utf8CheckIncomplete(this,buf,i);if(!this.lastNeed)return buf.toString("utf8",i);this.lastTotal=total;var end=buf.length-(total-this.lastNeed);buf.copy(this.lastChar,0,end);return buf.toString("utf8",i,end)}function utf8End(buf){var r=buf&&buf.length?this.write(buf):"";if(this.lastNeed)return r+"�".repeat(this.lastTotal-this.lastNeed);return r}function utf16Text(buf,i){if((buf.length-i)%2===0){var r=buf.toString("utf16le",i);if(r){var c=r.charCodeAt(r.length-1);if(c>=55296&&c<=56319){this.lastNeed=2;this.lastTotal=4;this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1];return r.slice(0,-1)}}return r}this.lastNeed=1;this.lastTotal=2;this.lastChar[0]=buf[buf.length-1];return buf.toString("utf16le",i,buf.length-1)}function utf16End(buf){var r=buf&&buf.length?this.write(buf):"";if(this.lastNeed){var end=this.lastTotal-this.lastNeed;return r+this.lastChar.toString("utf16le",0,end)}return r}function base64Text(buf,i){var n=(buf.length-i)%3;if(n===0)return buf.toString("base64",i);this.lastNeed=3-n;this.lastTotal=3;if(n===1){this.lastChar[0]=buf[buf.length-1]}else{this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1]}return buf.toString("base64",i,buf.length-n)}function base64End(buf){var r=buf&&buf.length?this.write(buf):"";if(this.lastNeed)return r+this.lastChar.toString("base64",0,3-this.lastNeed);return r}function simpleWrite(buf){return buf.toString(this.encoding)}function simpleEnd(buf){return buf&&buf.length?this.write(buf):""}},{"safe-buffer":235}],235:[function(require,module,exports){arguments[4][202][0].apply(exports,arguments)},{buffer:71,dup:202}],236:[function(require,module,exports){(function(setImmediate,clearImmediate){(function(){var nextTick=require("process/browser.js").nextTick;var apply=Function.prototype.apply;var slice=Array.prototype.slice;var immediateIds={};var nextImmediateId=0;exports.setTimeout=function(){return new Timeout(apply.call(setTimeout,window,arguments),clearTimeout)};exports.setInterval=function(){return new Timeout(apply.call(setInterval,window,arguments),clearInterval)};exports.clearTimeout=exports.clearInterval=function(timeout){timeout.close()};function Timeout(id,clearFn){this._id=id;this._clearFn=clearFn}Timeout.prototype.unref=Timeout.prototype.ref=function(){};Timeout.prototype.close=function(){this._clearFn.call(window,this._id)};exports.enroll=function(item,msecs){clearTimeout(item._idleTimeoutId);item._idleTimeout=msecs};exports.unenroll=function(item){clearTimeout(item._idleTimeoutId);item._idleTimeout=-1};exports._unrefActive=exports.active=function(item){clearTimeout(item._idleTimeoutId);var msecs=item._idleTimeout;if(msecs>=0){item._idleTimeoutId=setTimeout(function onTimeout(){if(item._onTimeout)item._onTimeout()},msecs)}};exports.setImmediate=typeof setImmediate==="function"?setImmediate:function(fn){var id=nextImmediateId++;var args=arguments.length<2?false:slice.call(arguments,1);immediateIds[id]=true;nextTick(function onNextTick(){if(immediateIds[id]){if(args){fn.apply(null,args)}else{fn.call(null)}exports.clearImmediate(id)}});return id};exports.clearImmediate=typeof clearImmediate==="function"?clearImmediate:function(id){delete immediateIds[id]}}).call(this)}).call(this,require("timers").setImmediate,require("timers").clearImmediate)},{"process/browser.js":179,timers:236}],237:[function(require,module,exports){var Buffer=require("buffer").Buffer;module.exports=function(buf){if(buf instanceof Uint8Array){if(buf.byteOffset===0&&buf.byteLength===buf.buffer.byteLength){return buf.buffer}else if(typeof buf.buffer.slice==="function"){return buf.buffer.slice(buf.byteOffset,buf.byteOffset+buf.byteLength)}}if(Buffer.isBuffer(buf)){var arrayCopy=new Uint8Array(buf.length);var len=buf.length;for(var i=0;i<len;i++){arrayCopy[i]=buf[i]}return arrayCopy.buffer}else{throw new Error("Argument must be a Buffer")}}},{buffer:71}],238:[function(require,module,exports){"use strict";var punycode=require("punycode");var util=require("./util");exports.parse=urlParse;exports.resolve=urlResolve;exports.resolveObject=urlResolveObject;exports.format=urlFormat;exports.Url=Url;function Url(){this.protocol=null;this.slashes=null;this.auth=null;this.host=null;this.port=null;this.hostname=null;this.hash=null;this.search=null;this.query=null;this.pathname=null;this.path=null;this.href=null}var protocolPattern=/^([a-z0-9.+-]+:)/i,portPattern=/:[0-9]*$/,simplePathPattern=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,delims=["<",">",'"',"`"," ","\r","\n","\t"],unwise=["{","}","|","\\","^","`"].concat(delims),autoEscape=["'"].concat(unwise),nonHostChars=["%","/","?",";","#"].concat(autoEscape),hostEndingChars=["/","?","#"],hostnameMaxLen=255,hostnamePartPattern=/^[+a-z0-9A-Z_-]{0,63}$/,hostnamePartStart=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,unsafeProtocol={javascript:true,"javascript:":true},hostlessProtocol={javascript:true,"javascript:":true},slashedProtocol={http:true,https:true,ftp:true,gopher:true,file:true,"http:":true,"https:":true,"ftp:":true,"gopher:":true,"file:":true},querystring=require("querystring");function urlParse(url,parseQueryString,slashesDenoteHost){if(url&&util.isObject(url)&&url instanceof Url)return url;var u=new Url;u.parse(url,parseQueryString,slashesDenoteHost);return u}Url.prototype.parse=function(url,parseQueryString,slashesDenoteHost){if(!util.isString(url)){throw new TypeError("Parameter 'url' must be a string, not "+typeof url)}var queryIndex=url.indexOf("?"),splitter=queryIndex!==-1&&queryIndex<url.indexOf("#")?"?":"#",uSplit=url.split(splitter),slashRegex=/\\/g;uSplit[0]=uSplit[0].replace(slashRegex,"/");url=uSplit.join(splitter);var rest=url;rest=rest.trim();if(!slashesDenoteHost&&url.split("#").length===1){var simplePath=simplePathPattern.exec(rest);if(simplePath){this.path=rest;this.href=rest;this.pathname=simplePath[1];if(simplePath[2]){this.search=simplePath[2];if(parseQueryString){this.query=querystring.parse(this.search.substr(1))}else{this.query=this.search.substr(1)}}else if(parseQueryString){this.search="";this.query={}}return this}}var proto=protocolPattern.exec(rest);if(proto){proto=proto[0];var lowerProto=proto.toLowerCase();this.protocol=lowerProto;rest=rest.substr(proto.length)}if(slashesDenoteHost||proto||rest.match(/^\/\/[^@\/]+@[^@\/]+/)){var slashes=rest.substr(0,2)==="//";if(slashes&&!(proto&&hostlessProtocol[proto])){rest=rest.substr(2);this.slashes=true}}if(!hostlessProtocol[proto]&&(slashes||proto&&!slashedProtocol[proto])){var hostEnd=-1;for(var i=0;i<hostEndingChars.length;i++){var hec=rest.indexOf(hostEndingChars[i]);if(hec!==-1&&(hostEnd===-1||hec<hostEnd))hostEnd=hec}var auth,atSign;if(hostEnd===-1){atSign=rest.lastIndexOf("@")}else{atSign=rest.lastIndexOf("@",hostEnd)}if(atSign!==-1){auth=rest.slice(0,atSign);rest=rest.slice(atSign+1);this.auth=decodeURIComponent(auth)}hostEnd=-1;for(var i=0;i<nonHostChars.length;i++){var hec=rest.indexOf(nonHostChars[i]);if(hec!==-1&&(hostEnd===-1||hec<hostEnd))hostEnd=hec}if(hostEnd===-1)hostEnd=rest.length;this.host=rest.slice(0,hostEnd);rest=rest.slice(hostEnd);this.parseHost();this.hostname=this.hostname||"";var ipv6Hostname=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!ipv6Hostname){var hostparts=this.hostname.split(/\./);for(var i=0,l=hostparts.length;i<l;i++){var part=hostparts[i];if(!part)continue;if(!part.match(hostnamePartPattern)){var newpart="";for(var j=0,k=part.length;j<k;j++){if(part.charCodeAt(j)>127){newpart+="x"}else{newpart+=part[j]}}if(!newpart.match(hostnamePartPattern)){var validParts=hostparts.slice(0,i);var notHost=hostparts.slice(i+1);var bit=part.match(hostnamePartStart);if(bit){validParts.push(bit[1]);notHost.unshift(bit[2])}if(notHost.length){rest="/"+notHost.join(".")+rest}this.hostname=validParts.join(".");break}}}}if(this.hostname.length>hostnameMaxLen){this.hostname=""}else{this.hostname=this.hostname.toLowerCase()}if(!ipv6Hostname){this.hostname=punycode.toASCII(this.hostname)}var p=this.port?":"+this.port:"";var h=this.hostname||"";this.host=h+p;this.href+=this.host;if(ipv6Hostname){this.hostname=this.hostname.substr(1,this.hostname.length-2);if(rest[0]!=="/"){rest="/"+rest}}}if(!unsafeProtocol[lowerProto]){for(var i=0,l=autoEscape.length;i<l;i++){var ae=autoEscape[i];if(rest.indexOf(ae)===-1)continue;var esc=encodeURIComponent(ae);if(esc===ae){esc=escape(ae)}rest=rest.split(ae).join(esc)}}var hash=rest.indexOf("#");if(hash!==-1){this.hash=rest.substr(hash);rest=rest.slice(0,hash)}var qm=rest.indexOf("?");if(qm!==-1){this.search=rest.substr(qm);this.query=rest.substr(qm+1);if(parseQueryString){this.query=querystring.parse(this.query)}rest=rest.slice(0,qm)}else if(parseQueryString){this.search="";this.query={}}if(rest)this.pathname=rest;if(slashedProtocol[lowerProto]&&this.hostname&&!this.pathname){this.pathname="/"}if(this.pathname||this.search){var p=this.pathname||"";var s=this.search||"";this.path=p+s}this.href=this.format();return this};function urlFormat(obj){if(util.isString(obj))obj=urlParse(obj);if(!(obj instanceof Url))return Url.prototype.format.call(obj);return obj.format()}Url.prototype.format=function(){var auth=this.auth||"";if(auth){auth=encodeURIComponent(auth);auth=auth.replace(/%3A/i,":");auth+="@"}var protocol=this.protocol||"",pathname=this.pathname||"",hash=this.hash||"",host=false,query="";if(this.host){host=auth+this.host}else if(this.hostname){host=auth+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]");if(this.port){host+=":"+this.port}}if(this.query&&util.isObject(this.query)&&Object.keys(this.query).length){query=querystring.stringify(this.query)}var search=this.search||query&&"?"+query||"";if(protocol&&protocol.substr(-1)!==":")protocol+=":";if(this.slashes||(!protocol||slashedProtocol[protocol])&&host!==false){host="//"+(host||"");if(pathname&&pathname.charAt(0)!=="/")pathname="/"+pathname}else if(!host){host=""}if(hash&&hash.charAt(0)!=="#")hash="#"+hash;if(search&&search.charAt(0)!=="?")search="?"+search;pathname=pathname.replace(/[?#]/g,function(match){return encodeURIComponent(match)});search=search.replace("#","%23");return protocol+host+pathname+search+hash};function urlResolve(source,relative){return urlParse(source,false,true).resolve(relative)}Url.prototype.resolve=function(relative){return this.resolveObject(urlParse(relative,false,true)).format()};function urlResolveObject(source,relative){if(!source)return relative;return urlParse(source,false,true).resolveObject(relative)}Url.prototype.resolveObject=function(relative){if(util.isString(relative)){var rel=new Url;rel.parse(relative,false,true);relative=rel}var result=new Url;var tkeys=Object.keys(this);for(var tk=0;tk<tkeys.length;tk++){var tkey=tkeys[tk];result[tkey]=this[tkey]}result.hash=relative.hash;if(relative.href===""){result.href=result.format();return result}if(relative.slashes&&!relative.protocol){var rkeys=Object.keys(relative);for(var rk=0;rk<rkeys.length;rk++){var rkey=rkeys[rk];if(rkey!=="protocol")result[rkey]=relative[rkey]}if(slashedProtocol[result.protocol]&&result.hostname&&!result.pathname){result.path=result.pathname="/"}result.href=result.format();return result}if(relative.protocol&&relative.protocol!==result.protocol){if(!slashedProtocol[relative.protocol]){var keys=Object.keys(relative);for(var v=0;v<keys.length;v++){var k=keys[v];result[k]=relative[k]}result.href=result.format();return result}result.protocol=relative.protocol;if(!relative.host&&!hostlessProtocol[relative.protocol]){var relPath=(relative.pathname||"").split("/");while(relPath.length&&!(relative.host=relPath.shift()));if(!relative.host)relative.host="";if(!relative.hostname)relative.hostname="";if(relPath[0]!=="")relPath.unshift("");if(relPath.length<2)relPath.unshift("");result.pathname=relPath.join("/")}else{result.pathname=relative.pathname}result.search=relative.search;result.query=relative.query;result.host=relative.host||"";result.auth=relative.auth;result.hostname=relative.hostname||relative.host;result.port=relative.port;if(result.pathname||result.search){var p=result.pathname||"";var s=result.search||"";result.path=p+s}result.slashes=result.slashes||relative.slashes;result.href=result.format();return result}var isSourceAbs=result.pathname&&result.pathname.charAt(0)==="/",isRelAbs=relative.host||relative.pathname&&relative.pathname.charAt(0)==="/",mustEndAbs=isRelAbs||isSourceAbs||result.host&&relative.pathname,removeAllDots=mustEndAbs,srcPath=result.pathname&&result.pathname.split("/")||[],relPath=relative.pathname&&relative.pathname.split("/")||[],psychotic=result.protocol&&!slashedProtocol[result.protocol];if(psychotic){result.hostname="";result.port=null;if(result.host){if(srcPath[0]==="")srcPath[0]=result.host;else srcPath.unshift(result.host)}result.host="";if(relative.protocol){relative.hostname=null;relative.port=null;if(relative.host){if(relPath[0]==="")relPath[0]=relative.host;else relPath.unshift(relative.host)}relative.host=null}mustEndAbs=mustEndAbs&&(relPath[0]===""||srcPath[0]==="")}if(isRelAbs){result.host=relative.host||relative.host===""?relative.host:result.host;result.hostname=relative.hostname||relative.hostname===""?relative.hostname:result.hostname;result.search=relative.search;result.query=relative.query;srcPath=relPath}else if(relPath.length){if(!srcPath)srcPath=[];srcPath.pop();srcPath=srcPath.concat(relPath);result.search=relative.search;result.query=relative.query}else if(!util.isNullOrUndefined(relative.search)){if(psychotic){result.hostname=result.host=srcPath.shift();var authInHost=result.host&&result.host.indexOf("@")>0?result.host.split("@"):false;if(authInHost){result.auth=authInHost.shift();result.host=result.hostname=authInHost.shift()}}result.search=relative.search;result.query=relative.query;if(!util.isNull(result.pathname)||!util.isNull(result.search)){result.path=(result.pathname?result.pathname:"")+(result.search?result.search:"")}result.href=result.format();return result}if(!srcPath.length){result.pathname=null;if(result.search){result.path="/"+result.search}else{result.path=null}result.href=result.format();return result}var last=srcPath.slice(-1)[0];var hasTrailingSlash=(result.host||relative.host||srcPath.length>1)&&(last==="."||last==="..")||last==="";var up=0;for(var i=srcPath.length;i>=0;i--){last=srcPath[i];if(last==="."){srcPath.splice(i,1)}else if(last===".."){srcPath.splice(i,1);up++}else if(up){srcPath.splice(i,1);up--}}if(!mustEndAbs&&!removeAllDots){for(;up--;up){srcPath.unshift("..")}}if(mustEndAbs&&srcPath[0]!==""&&(!srcPath[0]||srcPath[0].charAt(0)!=="/")){srcPath.unshift("")}if(hasTrailingSlash&&srcPath.join("/").substr(-1)!=="/"){srcPath.push("")}var isAbsolute=srcPath[0]===""||srcPath[0]&&srcPath[0].charAt(0)==="/";if(psychotic){result.hostname=result.host=isAbsolute?"":srcPath.length?srcPath.shift():"";var authInHost=result.host&&result.host.indexOf("@")>0?result.host.split("@"):false;if(authInHost){result.auth=authInHost.shift();result.host=result.hostname=authInHost.shift()}}mustEndAbs=mustEndAbs||result.host&&srcPath.length;if(mustEndAbs&&!isAbsolute){srcPath.unshift("")}if(!srcPath.length){result.pathname=null;result.path=null}else{result.pathname=srcPath.join("/")}if(!util.isNull(result.pathname)||!util.isNull(result.search)){result.path=(result.pathname?result.pathname:"")+(result.search?result.search:"")}result.auth=relative.auth||result.auth;result.slashes=result.slashes||relative.slashes;result.href=result.format();return result};Url.prototype.parseHost=function(){var host=this.host;var port=portPattern.exec(host);if(port){port=port[0];if(port!==":"){this.port=port.substr(1)}host=host.substr(0,host.length-port.length)}if(host)this.hostname=host}},{"./util":239,punycode:187,querystring:190}],239:[function(require,module,exports){"use strict";module.exports={isString:function(arg){return typeof arg==="string"},isObject:function(arg){return typeof arg==="object"&&arg!==null},isNull:function(arg){return arg===null},isNullOrUndefined:function(arg){return arg==null}}},{}],240:[function(require,module,exports){(function(global){(function(){module.exports=deprecate;function deprecate(fn,msg){if(config("noDeprecation")){return fn}var warned=false;function deprecated(){if(!warned){if(config("throwDeprecation")){throw new Error(msg)}else if(config("traceDeprecation")){console.trace(msg)}else{console.warn(msg)}warned=true}return fn.apply(this,arguments)}return deprecated}function config(name){try{if(!global.localStorage)return false}catch(_){return false}var val=global.localStorage[name];if(null==val)return false;return String(val).toLowerCase()==="true"}}).call(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],241:[function(require,module,exports){arguments[4][17][0].apply(exports,arguments)},{dup:17}],242:[function(require,module,exports){arguments[4][18][0].apply(exports,arguments)},{dup:18}],243:[function(require,module,exports){arguments[4][19][0].apply(exports,arguments)},{"./support/isBuffer":242,_process:179,dup:19,inherits:241}],244:[function(require,module,exports){var indexOf=require("indexof");var Object_keys=function(obj){if(Object.keys)return Object.keys(obj);else{var res=[];for(var key in obj)res.push(key);return res}};var forEach=function(xs,fn){if(xs.forEach)return xs.forEach(fn);else for(var i=0;i<xs.length;i++){fn(xs[i],i,xs)}};var defineProp=function(){try{Object.defineProperty({},"_",{});return function(obj,name,value){Object.defineProperty(obj,name,{writable:true,enumerable:false,configurable:true,value:value})}}catch(e){return function(obj,name,value){obj[name]=value}}}();var globals=["Array","Boolean","Date","Error","EvalError","Function","Infinity","JSON","Math","NaN","Number","Object","RangeError","ReferenceError","RegExp","String","SyntaxError","TypeError","URIError","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","eval","isFinite","isNaN","parseFloat","parseInt","undefined","unescape"];function Context(){}Context.prototype={};var Script=exports.Script=function NodeScript(code){if(!(this instanceof Script))return new Script(code);this.code=code};Script.prototype.runInContext=function(context){if(!(context instanceof Context)){throw new TypeError("needs a 'context' argument.")}var iframe=document.createElement("iframe");if(!iframe.style)iframe.style={};iframe.style.display="none";document.body.appendChild(iframe);var win=iframe.contentWindow;var wEval=win.eval,wExecScript=win.execScript;if(!wEval&&wExecScript){wExecScript.call(win,"null");wEval=win.eval}forEach(Object_keys(context),function(key){win[key]=context[key]});forEach(globals,function(key){if(context[key]){win[key]=context[key]}});var winKeys=Object_keys(win);var res=wEval.call(win,this.code);forEach(Object_keys(win),function(key){if(key in context||indexOf(winKeys,key)===-1){context[key]=win[key]}});forEach(globals,function(key){if(!(key in context)){defineProp(context,key,win[key])}});document.body.removeChild(iframe);return res};Script.prototype.runInThisContext=function(){return eval(this.code)};Script.prototype.runInNewContext=function(context){var ctx=Script.createContext(context);var res=this.runInContext(ctx);forEach(Object_keys(ctx),function(key){context[key]=ctx[key]});return res};forEach(Object_keys(Script.prototype),function(name){exports[name]=Script[name]=function(code){var s=Script(code);return s[name].apply(s,[].slice.call(arguments,1))}});exports.createScript=function(code){return exports.Script(code)};exports.createContext=Script.createContext=function(context){var copy=new Context;if(typeof context==="object"){forEach(Object_keys(context),function(key){copy[key]=context[key]})}return copy}},{indexof:144}],245:[function(require,module,exports){module.exports=extend;var hasOwnProperty=Object.prototype.hasOwnProperty;function extend(){var target={};for(var i=0;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target}},{}],246:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","./lib/feature-detection","./lib/config","./lib/browser-agent","./lib/configuration-override"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var feature_detection_1=require("./lib/feature-detection");var config_1=require("./lib/config");var browser_agent_1=require("./lib/browser-agent");var configuration_override_1=require("./lib/configuration-override");var SEALIGHTS_WINDOW_OBJECT="$Sealights";var COMPONENTS="components";var featureDetection=null;try{featureDetection=new feature_detection_1.FeatureDetection(window);if(window&&window[SEALIGHTS_WINDOW_OBJECT]){window[SEALIGHTS_WINDOW_OBJECT].configuration=configuration_override_1.ConfigurationOverride.create(window[SEALIGHTS_WINDOW_OBJECT].configuration);var browserAgent_1=new browser_agent_1.BrowserAgent(window,featureDetection);window["$SealightsAgent"]=browserAgent_1;window[SEALIGHTS_WINDOW_OBJECT].agentVersion=config_1.SL_AGENT_VERSION;if(window[SEALIGHTS_WINDOW_OBJECT]&&window[SEALIGHTS_WINDOW_OBJECT][COMPONENTS]){Object.keys(window[SEALIGHTS_WINDOW_OBJECT][COMPONENTS]).forEach(function(buildSessionId){browserAgent_1.createInstance(window[SEALIGHTS_WINDOW_OBJECT][COMPONENTS][buildSessionId])})}else{browserAgent_1.createInstance(window[SEALIGHTS_WINDOW_OBJECT])}}}catch(e){if(featureDetection&&featureDetection.hasConsoleLogAPI()){console.log("Sealights browser listener failed to start. Error: ",e)}}})},{"./lib/browser-agent":251,"./lib/config":257,"./lib/configuration-override":259,"./lib/feature-detection":266}],247:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","./state-tracker","../../common/state-tracker-fpv6","./test-state-helper","./entities/environment-data","./services/http/http-client","./services/json/json-client","./istanbul-to-footprints-convertor","./istanbul-to-footprints-convertor-v3","./services/light-backend-proxy","./footprints-queue-sender","./watchdog","./code-coverage-manager","./browser-agent-instance","./queues/footprints-items-queue","./configuration-manager","./logger/log-factory","./basic-uuid-generator","./window-timers-wrapper","./color-cookie-handler","./queues/queue","./delegate","./services/json/json-client-adapter","./browser-events-process","./browser-hits-converter","./browser-agent-instance-fpv6","./browser-hits-collector","./sl-mapping-loader","./services/json/noop-json-client","../../common/agent-instance-data","../../common/agent-events/agent-events-conracts","../../common/agent-events/cockpit-notifier","../../common/http/backend-proxy","../../common/config-process/config-loader","../../common/footprints-process-v6/relative-path-resolver","../../common/footprints-process-v6/footprints-buffer","../../common/footprints-process-v6/index","../../common/config-process","../../common/system-date"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.AgentFactory=void 0;var state_tracker_1=require("./state-tracker");var state_tracker_fpv6_1=require("../../common/state-tracker-fpv6");var test_state_helper_1=require("./test-state-helper");var environment_data_1=require("./entities/environment-data");var http_client_1=require("./services/http/http-client");var json_client_1=require("./services/json/json-client");var istanbul_to_footprints_convertor_1=require("./istanbul-to-footprints-convertor");var istanbul_to_footprints_convertor_v3_1=require("./istanbul-to-footprints-convertor-v3");var light_backend_proxy_1=require("./services/light-backend-proxy");var footprints_queue_sender_1=require("./footprints-queue-sender");var watchdog_1=require("./watchdog");var code_coverage_manager_1=require("./code-coverage-manager");var browser_agent_instance_1=require("./browser-agent-instance");var footprints_items_queue_1=require("./queues/footprints-items-queue");var configuration_manager_1=require("./configuration-manager");var log_factory_1=require("./logger/log-factory");var basic_uuid_generator_1=require("./basic-uuid-generator");var window_timers_wrapper_1=require("./window-timers-wrapper");var color_cookie_handler_1=require("./color-cookie-handler");var queue_1=require("./queues/queue");var delegate_1=require("./delegate");var json_client_adapter_1=require("./services/json/json-client-adapter");var browser_events_process_1=require("./browser-events-process");var browser_hits_converter_1=require("./browser-hits-converter");var browser_agent_instance_fpv6_1=require("./browser-agent-instance-fpv6");var browser_hits_collector_1=require("./browser-hits-collector");var sl_mapping_loader_1=require("./sl-mapping-loader");var noop_json_client_1=require("./services/json/noop-json-client");var agent_instance_data_1=require("../../common/agent-instance-data");var agent_events_conracts_1=require("../../common/agent-events/agent-events-conracts");var cockpit_notifier_1=require("../../common/agent-events/cockpit-notifier");var backend_proxy_1=require("../../common/http/backend-proxy");var config_loader_1=require("../../common/config-process/config-loader");var relative_path_resolver_1=require("../../common/footprints-process-v6/relative-path-resolver");var footprints_buffer_1=require("../../common/footprints-process-v6/footprints-buffer");var index_1=require("../../common/footprints-process-v6/index");var config_process_1=require("../../common/config-process");var system_date_1=require("../../common/system-date");var FOOTPRINTS_SENDER_WATCHDOG="FootPrintsSenderWatchdog";var FOOTPRINTS_FLUSH_WATCHDOG="FootprintsFlushWatchdog";var ACTIVE_EXECUTION_WATCHDOG="ActiveExecutionWatchdog";var KEEP_ALIVE_WATCHDOG="KeepaliveWatchdog";var CONFIGURATION_WATCHDOG="getConfigFromServerWatchdog";var AgentFactory=function(){function AgentFactory(){}AgentFactory.createBrowserAgent=function(window,featureDetection,basicConfiguration){var configurationManager=AgentFactory.createConfigurationManager(basicConfiguration,window);var configuration=configurationManager.getConfiguration();var colorCookieHandler=AgentFactory.createColorCookieHandler(window);if(!configurationManager.isValidConfiguration()){return null}var agentInstanceData=new agent_instance_data_1.AgentInstanceData(agent_events_conracts_1.AgentType.TEST_LISTENER,agent_events_conracts_1.Technology.BROWSER);var logger=AgentFactory.createLogger("BrowserAgent",configuration,window);var agentConfiguration=this.createAgentConfiguration(configuration);var backendProxy=this.createBackendProxy(agentConfiguration,agentInstanceData,window,featureDetection,configuration);var eventProcess=this.createEventProcess(window,featureDetection,configuration,agentConfiguration,agentInstanceData,backendProxy);cockpit_notifier_1.CockpitNotifier.notifyStart(agentConfiguration,agentInstanceData,logger,{},backendProxy);if(agentConfiguration.footprintsEnableV6.value){return this.createBrowserAgentInstanceFPV6(window,featureDetection,configuration,agentInstanceData,logger,agentConfiguration,backendProxy,eventProcess,colorCookieHandler)}var stateTracker=AgentFactory.createStateTracker(configuration,window,featureDetection,agentInstanceData);var footprintsQueueSender=AgentFactory.createFootprintsQueueSender(window,featureDetection,configuration,stateTracker,agentInstanceData);var agent=new browser_agent_instance_1.BrowserAgentInstance(logger,footprintsQueueSender,configuration,window,colorCookieHandler,stateTracker,eventProcess,agentConfiguration);return agent};AgentFactory.createBrowserAgentInstanceFPV6=function(window,featureDetection,configuration,agentInstanceData,logger,agentConfig,backendProxy,eventsProcess,colorCookieHandler){
24
24
  var configProcess=this.createConfigProcess(window,configuration,agentInstanceData,agentConfig,backendProxy);var stateTracker=this.createStateTrackerInfra(window,configuration,agentInstanceData,agentConfig,backendProxy,configProcess);var footprintsProcessV6=this.getCreateFootprintsProcessV6(window,configuration,agentInstanceData,agentConfig,backendProxy,stateTracker);var lightBackendProxy=AgentFactory.createLightBackendProxy(window,featureDetection,configuration,agentInstanceData);var slMappingLoader=this.createSlMappingLoader(window,lightBackendProxy,configuration);var flushFootprintsWatchdog=AgentFactory.createWatchdog(window,configuration,FOOTPRINTS_FLUSH_WATCHDOG,agentConfig.footprintsCollectIntervalSecs.value);return new browser_agent_instance_fpv6_1.BrowserAgentInstanceFpv6(logger,footprintsProcessV6,configuration,window,colorCookieHandler,stateTracker,eventsProcess,agentConfig,flushFootprintsWatchdog,slMappingLoader)};AgentFactory.createFootprintsQueueSender=function(window,featureDetection,configuration,stateTracker,agentInstanceData){var watchdog=AgentFactory.createWatchdog(window,configuration,FOOTPRINTS_SENDER_WATCHDOG);var lightBackendProxy=AgentFactory.createLightBackendProxy(window,featureDetection,configuration,agentInstanceData);var codeCoverageManager=AgentFactory.createCodeCoverageManager(window,configuration);var testStateHelper=AgentFactory.createTestStateHelper();var environmentData=AgentFactory.createEnvironmentData(window,configuration);var footprintsItemsQueue=AgentFactory.createFootprintsItemsQueue(configuration);var logger=AgentFactory.createLogger("FootprintsQueueSender",configuration,window);var slMappingLoader=this.createSlMappingLoader(window,lightBackendProxy,configuration);var footprintsQueueSender=new footprints_queue_sender_1.FootprintsQueueSender(watchdog,lightBackendProxy,codeCoverageManager,stateTracker,testStateHelper,environmentData,configuration,footprintsItemsQueue,window,logger,slMappingLoader);return footprintsQueueSender};AgentFactory.createWatchdog=function(window,configuration,classname,intervalSec){var intervalMS=(intervalSec||configuration.interval||10)*1e3;var logger=AgentFactory.createLogger(classname,configuration,window);var windowTimeoutWrapper=AgentFactory.createWindowTimersWrapper(window);var watchdog=new watchdog_1.Watchdog(intervalMS,windowTimeoutWrapper,{autoReset:true},logger);return watchdog};AgentFactory.createCodeCoverageManager=function(window,configuration){var istanbulToFootprintsConvertor=AgentFactory.createInstanbulToFootprintsConvertor(window,configuration);var codeCoverageManager=new code_coverage_manager_1.CodeCoverageManager(istanbulToFootprintsConvertor,configuration);return codeCoverageManager};AgentFactory.createLightBackendProxy=function(window,featureDetection,configuration,agentInstanceData){var jsonClient=AgentFactory.createJsonClient(window,featureDetection,configuration,agentInstanceData);var logger=AgentFactory.createLogger("FootprintsServiceProxy",configuration,window);var lightBackendProxy=new light_backend_proxy_1.LightBackendProxy(configuration,jsonClient,logger);return lightBackendProxy};AgentFactory.createSlMappingLoader=function(window,lightBackendProxy,configuration){var logger=AgentFactory.createLogger("slMappingLoader",configuration,window);return new sl_mapping_loader_1.SlMappingLoader(lightBackendProxy,window,logger)};AgentFactory.createJsonClient=function(window,featureDetection,configuration,agentInstanceData){var httpClient=AgentFactory.createHttpClient(window,featureDetection,configuration);return configuration.blockBrowserHttpTraffic?new noop_json_client_1.NoopJsonClient(httpClient,configuration,agentInstanceData):new json_client_1.JsonClient(httpClient,configuration,agentInstanceData)};AgentFactory.createHttpClient=function(window,featureDetection,configuration){var logger=AgentFactory.createLogger("HttpClient",configuration,window);var httpClient=new http_client_1.HttpClient(window,featureDetection,logger);return httpClient};AgentFactory.createStateTracker=function(configuration,window,featureDetection,agentInstanceData){var watchdog=AgentFactory.createWatchdog(window,configuration,ACTIVE_EXECUTION_WATCHDOG);var logger=AgentFactory.createLogger("StateTracker",configuration,window);var jsonClient=AgentFactory.createJsonClient(window,featureDetection,configuration,agentInstanceData);var stateTracker=new state_tracker_1.StateTracker(configuration,jsonClient,watchdog,logger);return stateTracker};AgentFactory.createColorCookieHandler=function(window){var colorCookieHandler=new color_cookie_handler_1.ColorCookieHandler(window);return colorCookieHandler};AgentFactory.createTestStateHelper=function(){var testStateHelper=new test_state_helper_1.TestStateHelper;return testStateHelper};AgentFactory.createWindowTimersWrapper=function(window){var windowTimersWrapper=new window_timers_wrapper_1.WindowTimersWrapper(window);return windowTimersWrapper};AgentFactory.createEnvironmentData=function(window,configuration){if(!environment_data_1.EnvironmentData.constantAgentId)environment_data_1.EnvironmentData.constantAgentId=basic_uuid_generator_1.BasicUuidGenerator.createUuid()+"<|>"+this.getTime(window);var environmentData=environment_data_1.EnvironmentData.create(configuration);return environmentData};AgentFactory.createInstanbulToFootprintsConvertor=function(window,configuration){var instanbulToFootprintsConvertor=null;if(configuration.resolveWithoutHash){instanbulToFootprintsConvertor=new istanbul_to_footprints_convertor_v3_1.IstanbulToFootprintsConvertorV3(window,configuration)}else{instanbulToFootprintsConvertor=new istanbul_to_footprints_convertor_1.IstanbulToFootprintsConverter(window,configuration)}return instanbulToFootprintsConvertor};AgentFactory.createFootprintsItemsQueue=function(configuration){var footprintsItemsQueue=new footprints_items_queue_1.FootprintsItemsQueue(configuration);return footprintsItemsQueue};AgentFactory.createEventProcess=function(window,featureDetection,configurationData,agentConfiguration,agentInstanceData,backendProxy){var sendToServerWatchdog=this.createWatchdog(window,configurationData,"sendToServer");var keepAliveWatchdog=this.createWatchdog(window,configurationData,"keepAlive");var environmentData=this.createEnvironmentData(window,configurationData);environmentData.testStage=agentConfiguration.testStage.value;var logger=AgentFactory.createLogger("BrowserAgent",configurationData,window);var queue=new queue_1.Queue(new delegate_1.Delegate);var eventsProcess=new browser_events_process_1.BrowserEventsProcess(agentConfiguration,agentInstanceData,sendToServerWatchdog,keepAliveWatchdog,environmentData,backendProxy,queue,logger);return eventsProcess};AgentFactory.createBackendProxy=function(agentConfiguration,agentInstanceData,window,featureDetection,configurationData){var logger=this.createLogger("BackendProxy",configurationData,window);var httpClientConfig=this.createHttpClientConfig(agentConfiguration);var jsonClientAdapter=this.createJsonClientAdapter(window,featureDetection,configurationData,agentInstanceData);var backendProxy=new backend_proxy_1.BackendProxy(agentInstanceData,httpClientConfig,logger,jsonClientAdapter);return backendProxy};AgentFactory.createHttpClientConfig=function(agentConfig){return{token:agentConfig.token.value,proxy:agentConfig.proxy.value,server:agentConfig.server.value,compressRequests:agentConfig.gzip.value}};AgentFactory.createConfigurationManager=function(basicConfiguration,window){var logger=AgentFactory.createLogger("ConfigurationManager",basicConfiguration,window);var configurationManager=new configuration_manager_1.ConfigurationManager(logger,basicConfiguration,window);return configurationManager};AgentFactory.createLogger=function(className,basicConfiguration,window){var _a,_b;return log_factory_1.LogFactory.createLogger(className,basicConfiguration.logLevel||((_b=(_a=window===null||window===void 0?void 0:window.$Sealights)===null||_a===void 0?void 0:_a.configuration)===null||_b===void 0?void 0:_b.logLevel))};AgentFactory.getTime=function(window){if(window&&window.performance&&typeof window.performance.now==="function"){return performance.now()}return system_date_1.getSystemDateValueOf()};AgentFactory.createAgentConfiguration=function(configuration){var configLoader=new config_loader_1.ConfigLoader;var configObject=configuration;if(!configObject.build){configObject.build=configObject.buildName}if(!configObject.branch){configObject.branch=configObject.branchName}return configLoader.loadAgentConfiguration(configuration)};AgentFactory.createJsonClientAdapter=function(window,featureDetection,config,agentInstanceData){var jsonClient=this.createJsonClient(window,featureDetection,config,agentInstanceData);return new json_client_adapter_1.JsonClientAdapter(jsonClient,config.server)};AgentFactory.getCreateFootprintsProcessV6=function(window,configuration,agentInstanceData,agentConfig,backendProxy,stateTracker){var sendToServerWatchdog=AgentFactory.createWatchdog(window,configuration,FOOTPRINTS_SENDER_WATCHDOG,agentConfig.footprintsSendIntervalSecs.value);var keepaliveWatchdog=AgentFactory.createWatchdog(window,configuration,KEEP_ALIVE_WATCHDOG);var relativePathResolver=new relative_path_resolver_1.RelativePathResolver;var hitsCollector=new browser_hits_collector_1.BrowserHitsCollector(configuration.buildSessionId,this.createLogger("browserHitsCollector",configuration,window));var hitsConverter=new browser_hits_converter_1.BrowserHitsConverter(relativePathResolver,window,agentConfig.buildSessionId.value,this.createLogger("HitsConverter",configuration,window));var footprintsBuffer=new footprints_buffer_1.FootprintsBuffer(agentInstanceData,agentConfig);return new index_1.FootprintsProcess(agentConfig,sendToServerWatchdog,keepaliveWatchdog,this.createLogger("footprintsProcess",configuration,window),hitsCollector,hitsConverter,footprintsBuffer,backendProxy,stateTracker)};AgentFactory.createConfigProcess=function(window,configuration,agentInstanceData,agentConfig,backendProxy){var sendToServerWatchdog=AgentFactory.createWatchdog(window,configuration,CONFIGURATION_WATCHDOG,30);return new config_process_1.ConfigProcess(agentConfig,sendToServerWatchdog,backendProxy,this.createLogger("configProcess",configuration,window))};AgentFactory.createStateTrackerInfra=function(window,configuration,agentInstanceData,agentConfig,backendProxy,configProcess){var watchdog=AgentFactory.createWatchdog(window,configuration,ACTIVE_EXECUTION_WATCHDOG,agentConfig.executionQueryIntervalSecs.value);return new state_tracker_fpv6_1.StateTrackerFpv6(agentConfig,configProcess,watchdog,backendProxy,this.createLogger("stateTracker",configuration,window))};return AgentFactory}();exports.AgentFactory=AgentFactory})},{"../../common/agent-events/agent-events-conracts":289,"../../common/agent-events/cockpit-notifier":294,"../../common/agent-instance-data":299,"../../common/config-process":303,"../../common/config-process/config-loader":300,"../../common/footprints-process-v6/footprints-buffer":317,"../../common/footprints-process-v6/index":320,"../../common/footprints-process-v6/relative-path-resolver":322,"../../common/http/backend-proxy":324,"../../common/state-tracker-fpv6":331,"../../common/system-date":333,"./basic-uuid-generator":248,"./browser-agent-instance":250,"./browser-agent-instance-fpv6":249,"./browser-events-process":252,"./browser-hits-collector":253,"./browser-hits-converter":254,"./code-coverage-manager":255,"./color-cookie-handler":256,"./configuration-manager":258,"./delegate":261,"./entities/environment-data":264,"./footprints-queue-sender":267,"./istanbul-to-footprints-convertor":269,"./istanbul-to-footprints-convertor-v3":268,"./logger/log-factory":272,"./queues/footprints-items-queue":274,"./queues/queue":275,"./services/http/http-client":276,"./services/json/json-client":280,"./services/json/json-client-adapter":279,"./services/json/noop-json-client":281,"./services/light-backend-proxy":282,"./sl-mapping-loader":283,"./state-tracker":284,"./test-state-helper":285,"./watchdog":287,"./window-timers-wrapper":288}],248:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.BasicUuidGenerator=void 0;var BasicUuidGenerator=function(){function BasicUuidGenerator(){}BasicUuidGenerator.createUuid=function(){var uuid="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(c){var r=Math.random()*16|0,v=c=="x"?r:r&3|8;return v.toString(16)});return uuid};return BasicUuidGenerator}();exports.BasicUuidGenerator=BasicUuidGenerator})},{}],249:[function(require,module,exports){var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(Object.prototype.hasOwnProperty.call(b,p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};var __generator=this&&this.__generator||function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}};(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","./browser-agent-instance"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.BrowserAgentInstanceFpv6=void 0;var browser_agent_instance_1=require("./browser-agent-instance");var BrowserAgentInstanceFpv6=function(_super){__extends(BrowserAgentInstanceFpv6,_super);function BrowserAgentInstanceFpv6(logger,footprintsProcess,configuration,window,colorCookieHandler,stateTracker,eventsProcess,agentConfig,flushFootprintsWatchdog,slMappingLoader){var _this=_super.call(this,logger,{},configuration,window,colorCookieHandler,stateTracker,eventsProcess,agentConfig)||this;_this.footprintsProcess=footprintsProcess;_this.flushFootprintsWatchdog=flushFootprintsWatchdog;_this.slMappingLoader=slMappingLoader;_this.stateTracker.on("test_identifier_changed",_this.footprintsProcess.handleTestIdChanged.bind(_this.footprintsProcess));return _this}BrowserAgentInstanceFpv6.prototype.delegateEvents=function(){};BrowserAgentInstanceFpv6.prototype.startFootprintsProcess=function(){this.flushFootprintsWatchdog.addOnAlarmListener(this.footprintsProcess.flushCurrentFootprints.bind(this.footprintsProcess));this.flushFootprintsWatchdog.start();this.footprintsProcess.start();this.stateTracker.start();this.slMappingLoader.loadSlMapping(this.configuration.buildSessionId)};BrowserAgentInstanceFpv6.prototype.stopFootprintsProcess=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:this.flushFootprintsWatchdog.stop();return[4,this.footprintsProcess.stop()];case 1:_a.sent();return[2]}})})};BrowserAgentInstanceFpv6.prototype.submitFootprints=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.footprintsProcess.submitQueuedFootprints(this.stateTracker.currentExecution)];case 1:_a.sent();return[2]}})})};BrowserAgentInstanceFpv6.prototype.submitFootprintsSync=function(){return __awaiter(this,void 0,void 0,function(){var e_1;return __generator(this,function(_a){switch(_a.label){case 0:_a.trys.push([0,3,,4]);return[4,this.footprintsProcess.flushCurrentFootprints()];case 1:_a.sent();return[4,this.footprintsProcess.submitQueuedFootprints(this.stateTracker.currentExecution)];case 2:_a.sent();return[3,4];case 3:e_1=_a.sent();this.logger.error("Failed to submit footprint sync '"+e_1.message+"'");return[3,4];case 4:return[2]}})})};return BrowserAgentInstanceFpv6}(browser_agent_instance_1.BrowserAgentInstance);exports.BrowserAgentInstanceFpv6=BrowserAgentInstanceFpv6})},{"./browser-agent-instance":250}],250:[function(require,module,exports){var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};var __generator=this&&this.__generator||function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}};(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","./config","./karma-handler","./basic-uuid-generator","../../common/agent-events/cockpit-notifier"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.BrowserAgentInstance=void 0;var config_1=require("./config");var karma_handler_1=require("./karma-handler");var basic_uuid_generator_1=require("./basic-uuid-generator");var cockpit_notifier_1=require("../../common/agent-events/cockpit-notifier");var BrowserAgentInstance=function(){function BrowserAgentInstance(logger,footprintsQueueSender,configuration,window,colorCookieHandler,stateTracker,eventsProcess,agentConfig){this.logger=logger;this.footprintsQueueSender=footprintsQueueSender;this.configuration=configuration;this.window=window;this.colorCookieHandler=colorCookieHandler;this.stateTracker=stateTracker;this.eventsProcess=eventsProcess;this.agentConfig=agentConfig;this._isStarted=false;if(logger==null)throw new Error("'logger' cannot be null or undefined");if(configuration==null)throw new Error("'configuration' cannot be null or undefined");if(window==null)throw new Error("'window' cannot be null or undefined");if(eventsProcess==null)throw new Error("'eventsProcess' cannot be null or undefined");if(agentConfig==null)throw new Error("'agentConfig' cannot be null or undefined");logger.info("Sealights "+config_1.SL_AGENT_TYPE+" version "+config_1.SL_AGENT_VERSION+" has been loaded");this.delegateEvents()}BrowserAgentInstance.prototype.delegateEvents=function(footprintsProcess){var _this=this;this.stateTracker.addOnColorChangedListener(function(){var color=_this.stateTracker.getCurrentColor();_this.colorCookieHandler.handleColorChange(color)})};BrowserAgentInstance.getExecutionId=function(){if(!BrowserAgentInstance.executionId){var execId=basic_uuid_generator_1.BasicUuidGenerator.createUuid();BrowserAgentInstance.executionId=execId}return BrowserAgentInstance.executionId};BrowserAgentInstance.prototype.enqueueEvent=function(event){this.eventsProcess.enqueueEvent(event)};BrowserAgentInstance.prototype.start=function(){if(this._isStarted)return;this.logger.info("Agent is starting. registerShutdownHook:"+this.configuration.registerShutdownHook);if(this.configuration.registerShutdownHook){this.registerShutdownHook()}this.eventsProcess.start();this.startFootprintsProcess();this._isStarted=true};BrowserAgentInstance.prototype.startFootprintsProcess=function(){this.footprintsQueueSender.start()};BrowserAgentInstance.prototype.stop=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:if(!this._isStarted)return[2];this.logger.info("Agent is stopping.");return[4,this.eventsProcess.stop()];case 1:_a.sent();this.stopFootprintsProcess();return[4,cockpit_notifier_1.CockpitNotifier.notifyShutdown()];case 2:_a.sent();this._isStarted=false;return[2]}})})};BrowserAgentInstance.prototype.stopFootprintsProcess=function(){this.footprintsQueueSender.sendAllSync()};BrowserAgentInstance.prototype.setCurrentTestIdentifier=function(testIdentifier){this.logger.info("Agent is setting current test identifier. testIdentifier:'"+testIdentifier+"'.");this.stateTracker.setCurrentTestIdentifier(testIdentifier)};BrowserAgentInstance.prototype.endTest=function(){this.logger.info("Test '"+this.stateTracker.getCurrentTestIdentifier()+"' ended, sending remaining footprints");this.submitFootprints();this.stateTracker.setCurrentTestIdentifier(null)};BrowserAgentInstance.prototype.submitFootprints=function(){this.footprintsQueueSender.sendAll()};BrowserAgentInstance.prototype.submitFootprintsSync=function(){try{this.footprintsQueueSender.sendAllSync()}catch(e){this.logger.error("Failed to submit footprint sync '"+e.message+"'")}};BrowserAgentInstance.prototype.isStarted=function(){return this._isStarted};BrowserAgentInstance.prototype.registerShutdownHook=function(){var context=this;var oldUnload=this.window.onunload;this.window.onunload=function(){if(oldUnload){oldUnload.call(arguments)}context.stop()};var oldBeforeUnload=this.window.onbeforeunload;this.window.onbeforeunload=function(){if(oldBeforeUnload){oldBeforeUnload.call(arguments)}context.stop()};if(this.window.__karma__){var handler=new karma_handler_1.KarmaHandler(this.window,this,this.logger);handler.overrideKarmaMethods();handler.start()}};return BrowserAgentInstance}();exports.BrowserAgentInstance=BrowserAgentInstance})},{"../../common/agent-events/cockpit-notifier":294,"./basic-uuid-generator":248,"./config":257,"./karma-handler":270}],251:[function(require,module,exports){var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};var __generator=this&&this.__generator||function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}};(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","./agent-factory","./logger/log-factory"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.BrowserAgent=void 0;var agent_factory_1=require("./agent-factory");var log_factory_1=require("./logger/log-factory");var BrowserAgent=function(){function BrowserAgent(window,featureDetection){this.instances=[];this.running=false;this.logger=log_factory_1.LogFactory.createLogger("BrowserAgent");this.instanceAddedForBsid={};this.window=window;this.featureDetection=featureDetection}BrowserAgent.prototype.addInstance=function(instance){this.instances.push(instance)};BrowserAgent.prototype.createInstance=function(configuration){if(this.instanceAddedForBsid[configuration.buildSessionId]){this.logger.info("Already has instance for bsid '"+configuration.buildSessionId+"'");return}try{this.instanceAddedForBsid[configuration.buildSessionId]=true;var browserAgent=agent_factory_1.AgentFactory.createBrowserAgent(this.window,this.featureDetection,configuration);if(browserAgent){browserAgent.start();this.instances.push(browserAgent)}else{this.logger.error("Invalid configuration for app: "+configuration.appName+",\n build: "+configuration.buildName+", branch: "+configuration.branchName+"\n Sealights agent disabled")}}catch(e){this.logger.error("Error while creating agent for app: "+configuration.appName+", build: "+configuration.buildName+",\n branch: "+configuration.branchName+". Error "+e)}};BrowserAgent.prototype.start=function(){if(this.instances.length==0){return}this.instances.forEach(function(instance){return instance.start()});this.running=true};BrowserAgent.prototype.stop=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,Promise.all(this.instances.map(function(instance){return instance.stop()}))];case 1:_a.sent();this.running=false;return[2]}})})};BrowserAgent.prototype.isRunning=function(){return this.running};BrowserAgent.prototype.setCurrentTestIdentifier=function(identifier){this.instances.forEach(function(instance){return instance.setCurrentTestIdentifier(identifier)})};BrowserAgent.prototype.sendAllFootprints=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,Promise.all(this.instances.map(function(instance){return instance.submitFootprintsSync()}))];case 1:_a.sent();return[2]}})})};return BrowserAgent}();exports.BrowserAgent=BrowserAgent})},{"./agent-factory":247,"./logger/log-factory":272}],252:[function(require,module,exports){var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(Object.prototype.hasOwnProperty.call(b,p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};var __generator=this&&this.__generator||function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}};(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","../../common/events-process"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.BrowserEventsProcess=void 0;var events_process_1=require("../../common/events-process");var BrowserEventsProcess=function(_super){__extends(BrowserEventsProcess,_super);function BrowserEventsProcess(){return _super!==null&&_super.apply(this,arguments)||this}BrowserEventsProcess.prototype.stop=function(){return __awaiter(this,void 0,void 0,function(){var callback,items,packet;var _this=this
25
- ;return __generator(this,function(_a){this.isRunning=false;this.sendToServerWatchdog.stop();if(this.configuration.enabled.value===false||this.configuration.sendEvents.value===false){return[2]}callback=function(err){if(err){_this.logger.error("Failed to submit final events, Error : '"+err+"'")}};while(this.eventsQueue.getQueueSize()>0){items=this.eventsQueue.dequeue(events_process_1.EventsProcess.ITEMS_TO_DEQUE);packet=this.createEventsPacket(items);this.backendProxy.submitEvents(packet,callback,false)}return[2]})})};return BrowserEventsProcess}(events_process_1.EventsProcess);exports.BrowserEventsProcess=BrowserEventsProcess})},{"../../common/events-process":314}],253:[function(require,module,exports){var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(Object.prototype.hasOwnProperty.call(b,p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","../../common/footprints-process-v6/hits-collector"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.BrowserHitsCollector=void 0;var hits_collector_1=require("../../common/footprints-process-v6/hits-collector");var BrowserHitsCollector=function(_super){__extends(BrowserHitsCollector,_super);function BrowserHitsCollector(buildSessionId,logger,globalCoverageObject){var _this=_super.call(this,logger,globalCoverageObject)||this;_this.buildSessionId=buildSessionId;return _this}BrowserHitsCollector.prototype.getGlobalCoverageObject=function(){if(!this.globalCoverageObject){var coverageObject="$SealightsCoverage";var coverageObjectForBSID=coverageObject+"_"+this.buildSessionId;this.globalCoverageObject=window[coverageObjectForBSID]||window[coverageObject]}return this.globalCoverageObject};return BrowserHitsCollector}(hits_collector_1.HitsCollector);exports.BrowserHitsCollector=BrowserHitsCollector})},{"../../common/footprints-process-v6/hits-collector":318}],254:[function(require,module,exports){var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(Object.prototype.hasOwnProperty.call(b,p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","../../common/footprints-process-v6/base-browser-hits-converter"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.BrowserHitsConverter=void 0;var base_browser_hits_converter_1=require("../../common/footprints-process-v6/base-browser-hits-converter");var BrowserHitsConverter=function(_super){__extends(BrowserHitsConverter,_super);function BrowserHitsConverter(relativePathResolver,window,buildSessionId,logger){var _this=_super.call(this,relativePathResolver,buildSessionId,logger)||this;_this.window=window;return _this}BrowserHitsConverter.prototype.getSlMapping=function(){return this.window.slMappings[this.buildSessionId]||{}};return BrowserHitsConverter}(base_browser_hits_converter_1.BaseBrowserHitsConverter);exports.BrowserHitsConverter=BrowserHitsConverter})},{"../../common/footprints-process-v6/base-browser-hits-converter":315}],255:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.CodeCoverageManager=void 0;var CodeCoverageManager=function(){function CodeCoverageManager(convertor,configuration){this.convertor=convertor;this.configuration=configuration;this.aggregatedCoverage={};this.isDestroyed=false}CodeCoverageManager.prototype.findCoverageContainer=function(){var coverageObject="$SealightsCoverage";var coverageObjectForBSID=coverageObject+"_"+this.configuration.buildSessionId;return window[coverageObjectForBSID]||window[coverageObject]};CodeCoverageManager.prototype.getFootprints=function(testInfo){var counters=this.getCounters(true);return this.convertor.convert(counters,testInfo.testName,testInfo.executionId)};CodeCoverageManager.prototype._clearCounters=function(istanbulCoverageObject){if(!istanbulCoverageObject)return;if(this.isDestroyed)return;var context=this;this.forEachProp(istanbulCoverageObject,function(moduleName,m){context.aggregatedCoverage[moduleName]=context.aggregatedCoverage[moduleName]||{s:{},b:{},f:{}};var am=context.aggregatedCoverage[moduleName];context.forEachProp(m.s,function(sid,s){am.s[sid]=(am.s[sid]||0)+m.s[sid];m.s[sid]=0});context.forEachProp(m.b,function(bid,b){am.b[bid]=am.b[bid]||Array.apply(null,Array(m.b[bid].length)).map(Number.prototype.valueOf,0);for(var idx=0;idx<am.b[bid].length;idx++){am.b[bid][idx]+=m.b[bid][idx];m.b[bid][idx]=0}});context.forEachProp(m.f,function(fid,f){am.f[fid]=(am.f[fid]||0)+m.f[fid];m.f[fid]=0})})};CodeCoverageManager.prototype.cloneCodeMetrics=function(o){var cloned={};for(var i in o){cloned[i]=this.cloneModule(o[i])}return cloned};CodeCoverageManager.prototype.cloneModule=function(m){var cm={b:{},f:{},s:{}};for(var i in m.s){cm.s[i]=m.s[i]}for(var i in m.f){cm.f[i]=m.f[i]}for(var i in m.b){cm.b[i]=m.b[i].slice()}cm.metadata=m.metadata;cm.path=m.path;cm.fnMap=m.fnMap;cm.fnToBranch=m.fnToBranch;cm.branchMap=m.branchMap;cm.inputSourceMap=m.inputSourceMap;return cm};CodeCoverageManager.prototype.forEachProp=function(obj,func){Object.keys(obj).forEach(function(k){func(k,obj[k])})};CodeCoverageManager.prototype.clearCounters=function(){if(this.isDestroyed)return;var ct=this.findCoverageContainer();if(ct){this._clearCounters(ct)}};CodeCoverageManager.prototype.getCounters=function(clearAfterwards){if(this.isDestroyed)return{};var ct=this.findCoverageContainer();if(ct){var ret=this.cloneCodeMetrics(ct);if(clearAfterwards)this._clearCounters(ct);return ret}};return CodeCoverageManager}();exports.CodeCoverageManager=CodeCoverageManager})},{}],256:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","./state-tracker"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ColorCookieHandler=void 0;var state_tracker_1=require("./state-tracker");var ColorCookieHandler=function(){function ColorCookieHandler(window){this.window=window;this.COOKIE_KEY="x-sl-testid"}ColorCookieHandler.prototype.setCookie=function(color){var cookie=this.COOKIE_KEY+"="+color;this.window.document.cookie=cookie};ColorCookieHandler.prototype.handleColorChange=function(color){if(color!=null&&color!=state_tracker_1.StateTracker.ANONYMOUS_FOOTPRINTS_COLOR){this.setCookie(color)}else{this.removeCookie()}};ColorCookieHandler.prototype.removeCookie=function(){this.window.document.cookie=this.COOKIE_KEY+"=;expires=Thu, 01 Jan 1970 00:00:01 GMT;"};ColorCookieHandler.prototype.getCookie=function(){return this.window.document.cookie};return ColorCookieHandler}();exports.ColorCookieHandler=ColorCookieHandler})},{"./state-tracker":284}],257:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.SL_AGENT_TYPE=exports.SL_AGENT_VERSION=void 0;exports.SL_AGENT_VERSION="6.1.259";exports.SL_AGENT_TYPE="browser"})},{}],258:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","./entities/configuration-data"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ConfigurationManager=void 0;var configuration_data_1=require("./entities/configuration-data");var ConfigurationManager=function(){function ConfigurationManager(logger,basicConfiguration,window){this.logger=logger;this.basicConfiguration=basicConfiguration;this.window=window;if(logger==null)throw new Error("'logger' cannot be null or undefined");if(basicConfiguration==null)throw new Error("'basicConfiguration' cannot be null or undefined");if(window==null)throw new Error("'window' cannot be null or undefined")}ConfigurationManager.prototype.getConfiguration=function(){if(this.currentConfiguration)return this.currentConfiguration;var configurationData=this.getDefaults();this.overrideConfiguration(configurationData);configurationData.labId=this.resolveLabId();this.currentConfiguration=configurationData;this.printConfiguration(configurationData);this.validateConfiguration(configurationData);return configurationData};ConfigurationManager.prototype.getDefaults=function(){var config=new configuration_data_1.ConfigurationData;config.appName=this.basicConfiguration.appName;config.branchName=this.basicConfiguration.branchName;config.buildName=this.basicConfiguration.buildName;config.buildSessionId=this.basicConfiguration.buildSessionId;config.customerId=this.basicConfiguration.customerId;config.token=this.basicConfiguration.token;config.server=this.basicConfiguration.server;config.interval=this.basicConfiguration.interval||10;config.maxItemsInQueue=this.basicConfiguration.maxItemsInQueue||500;config.workspacepath=this.basicConfiguration.workspacepath;return config};ConfigurationManager.prototype.resolveLabId=function(){var labId=this.readLabIdFromWindow();if(labId){this.logger.info("Using labId from the 'window' object. LabId:"+labId);return labId}labId=this.basicConfiguration.labId;if(labId){this.logger.info("Using labId from basic configuration. LabId:"+labId);return labId}labId=this.readLabIdFromSessionStorage();if(labId){this.logger.info("Using labId from session storage. LabId:"+labId);return labId}labId=this.basicConfiguration.buildSessionId;if(labId){this.logger.info("Using buildSessionId as labId. LabId:"+labId);return labId}labId=this.basicConfiguration.appName;if(labId){this.logger.info("Using appName as labId. LabId:"+labId);return labId}return"DefaultLabId"};ConfigurationManager.prototype.overrideConfiguration=function(configurationData){for(var p in this.basicConfiguration){configurationData[p]=this.basicConfiguration[p]}this.logger.info("[TO CS] - TODO: Send request to server to get the configuration.")};ConfigurationManager.prototype.printConfiguration=function(configurationData){this.logger.info("***********************************************************");this.logger.info("Current configuration:");this.logger.info("------------------------------------------------");for(var prop in configurationData){this.logger.info(prop+": '"+configurationData[prop])+"'"}this.logger.info("***********************************************************")};ConfigurationManager.prototype.validateConfiguration=function(configurationData){var _this=this;var fieldsWithError=[];if(!configurationData.customerId||configurationData.customerId=="")fieldsWithError.push("customerId");if(!configurationData.server||configurationData.server=="")fieldsWithError.push("server");if(!configurationData.appName||configurationData.appName=="")fieldsWithError.push("appName");if(!configurationData.branchName||configurationData.branchName=="")fieldsWithError.push("branchName");if(!configurationData.buildName||configurationData.buildName=="")fieldsWithError.push("buildName");if(!configurationData.token||configurationData.token=="")fieldsWithError.push("token");if(fieldsWithError.length>0){this.logger.warn("------------------------------------------------");this.logger.warn("Detected an invalid configuration:");fieldsWithError.forEach(function(field){_this.logger.warn("'"+field+"' is required but it had a 'null' or empty value.")});this.logger.warn("Please fix the configuration prior to using SeaLights.");this.logger.warn("------------------------------------------------")}this._isValidConfiguration=fieldsWithError.length==0};ConfigurationManager.prototype.isValidConfiguration=function(){return this._isValidConfiguration};ConfigurationManager.prototype.readLabIdFromSessionStorage=function(){var labId=null;if(this.window.sessionStorage&&typeof this.window.sessionStorage==="function"){labId=this.window.sessionStorage.getItem(ConfigurationManager.LAB_ID_KEY)}return labId};ConfigurationManager.prototype.readLabIdFromWindow=function(){return this.window[ConfigurationManager.LAB_ID_KEY]};ConfigurationManager.LAB_ID_KEY="__sl.labId__";return ConfigurationManager}();exports.ConfigurationManager=ConfigurationManager})},{"./entities/configuration-data":263}],259:[function(require,module,exports){var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(Object.prototype.hasOwnProperty.call(b,p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","events","./logger/console-logger"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ConfigurationOverride=exports.ConfigChangedEvents=void 0;var EventEmitter=require("events");var console_logger_1=require("./logger/console-logger");var ConfigChangedEvents;(function(ConfigChangedEvents){ConfigChangedEvents["LOG_LEVEL_CHANGED"]="logLevelChanged"})(ConfigChangedEvents=exports.ConfigChangedEvents||(exports.ConfigChangedEvents={}));var ConfigurationOverride=function(_super){__extends(ConfigurationOverride,_super);function ConfigurationOverride(initialConfig){var _this=_super.call(this)||this;_this._logLevel=console_logger_1.LogLevels.INFO;_this.setMaxListeners(500);_this.loadInitialConfig(initialConfig);return _this}Object.defineProperty(ConfigurationOverride.prototype,"logLevel",{get:function(){return this._logLevel},set:function(value){this._logLevel=value;this.emit(ConfigChangedEvents.LOG_LEVEL_CHANGED,value)},enumerable:false,configurable:true});ConfigurationOverride.prototype.loadInitialConfig=function(initialConfig){if(initialConfig===void 0){initialConfig={}}for(var prop in initialConfig){var descriptor=Object.getOwnPropertyDescriptor(this.constructor.prototype,prop);if(descriptor&&typeof descriptor.set==="function"){this[prop]=initialConfig[prop]}}};ConfigurationOverride.create=function(configuration){if(configuration instanceof ConfigurationOverride){return configuration}return new ConfigurationOverride(configuration)};return ConfigurationOverride}(EventEmitter);exports.ConfigurationOverride=ConfigurationOverride})},{"./logger/console-logger":271,events:110}],260:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ExecutionStatus=void 0;var ExecutionStatus;(function(ExecutionStatus){ExecutionStatus["InProgress"]="created";ExecutionStatus["Ending"]="pendingDelete"})(ExecutionStatus=exports.ExecutionStatus||(exports.ExecutionStatus={}))})},{}],261:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Delegate=void 0;var Delegate=function(){function Delegate(){this.functions=new Array}Delegate.prototype.addListener=function(func){if(!func)return;if(this.functions)this.functions.push(func)};Delegate.prototype.fire=function(){if(!this.functions)return;for(var i=0;i<this.functions.length;i++){this.functions[i]()}};return Delegate}();exports.Delegate=Delegate})},{}],262:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.BasicConfigurationData=void 0;var BasicConfigurationData=function(){function BasicConfigurationData(){}return BasicConfigurationData}();exports.BasicConfigurationData=BasicConfigurationData})},{}],263:[function(require,module,exports){var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(Object.prototype.hasOwnProperty.call(b,p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","./basic-configuation-data"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ConfigurationData=void 0;var basic_configuation_data_1=require("./basic-configuation-data");var ConfigurationData=function(_super){__extends(ConfigurationData,_super);function ConfigurationData(){var _this=_super!==null&&_super.apply(this,arguments)||this;_this.registerShutdownHook=true;_this.enabled=true;return _this}return ConfigurationData}(basic_configuation_data_1.BasicConfigurationData);exports.ConfigurationData=ConfigurationData})},{"./basic-configuation-data":262}],264:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","../config"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.EnvironmentData=void 0;var config_1=require("../config");var EnvironmentData=function(){function EnvironmentData(){}EnvironmentData.create=function(configuration){var data=new EnvironmentData;data.agentType=config_1.SL_AGENT_TYPE;data.agentVersion=config_1.SL_AGENT_VERSION;data.agentId=EnvironmentData.constantAgentId;data.labId=configuration.labId||"";data.meta={navigator:window.navigator,userAgent:window.navigator&&window.navigator.userAgent,location:window.location};return data};return EnvironmentData}();exports.EnvironmentData=EnvironmentData})},{"../config":257}],265:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.FootprintsItemData=void 0;var FootprintsItemData=function(){function FootprintsItemData(){}return FootprintsItemData}();exports.FootprintsItemData=FootprintsItemData})},{}],266:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.FeatureDetection=void 0;var FeatureDetection=function(){function FeatureDetection(window){this.window=window;if(!window)throw new Error("'window' cannot be null or undefined")}FeatureDetection.prototype.hasBeaconAPI=function(){var result=window.navigator&&this.isFunction(window.navigator["sendBeacon"]);return result};FeatureDetection.prototype.hasConsoleLogAPI=function(){var result=window.console&&this.isFunction(window.console.log);return result};FeatureDetection.prototype.hasJsonAPI=function(){var result=JSON&&this.isFunction(JSON.stringify)&&this.isFunction(JSON.parse);return result};FeatureDetection.prototype.isFunction=function(o){return o&&typeof o==="function"};return FeatureDetection}();exports.FeatureDetection=FeatureDetection})},{}],267:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","./entities/footprints-item-data","../../common/system-date","../../common/agent-events/cockpit-notifier"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.FootprintsQueueSender=void 0;var footprints_item_data_1=require("./entities/footprints-item-data");var system_date_1=require("../../common/system-date");var cockpit_notifier_1=require("../../common/agent-events/cockpit-notifier");var FootprintsQueueSender=function(){function FootprintsQueueSender(watchdog,lightBackendProxy,codeCoverageManager,stateTracker,testStateHelper,environmentData,configuration,footprintsQueue,window,logger,slMappingLoader){var _this=this;this.watchdog=watchdog;this.lightBackendProxy=lightBackendProxy;this.codeCoverageManager=codeCoverageManager;this.stateTracker=stateTracker;this.testStateHelper=testStateHelper;this.environmentData=environmentData;this.configuration=configuration;this.footprintsQueue=footprintsQueue;this.window=window;this.logger=logger;this.slMappingLoader=slMappingLoader;this.isStarted=false;if(watchdog==null)throw new Error("'watchdog' cannot be null or undefined");if(lightBackendProxy==null)throw new Error("'lightBackendProxy' cannot be null or undefined");if(codeCoverageManager==null)throw new Error("'codeCoverageManager' cannot be null or undefined");if(stateTracker==null)throw new Error("'stateTracker' cannot be null or undefined");if(testStateHelper==null)throw new Error("'testStateHelper' cannot be null or undefined");if(environmentData==null)throw new Error("'environmentData' cannot be null or undefined");if(configuration==null)throw new Error("'configuration' cannot be null or undefined");if(footprintsQueue==null)throw new Error("'footprintsQueue' cannot be null or undefined");if(window==null)throw new Error("'window' cannot be null or undefined");if(logger==null)throw new Error("'logger' cannot be null or undefined");this.context=this;this.watchdog.addOnAlarmListener(function(){_this.context.onTimerTick()})}FootprintsQueueSender.prototype.onTimerTick=function(){if(!this.stateTracker.shouldCollectFootprints()){return}var footprints=this.getCurrentFootprints();this.send(footprints)};FootprintsQueueSender.prototype.start=function(){if(this.isStarted)return;this.watchdog.start();this.slMappingLoader.loadSlMapping(this.configuration.buildSessionId);this.isStarted=true};FootprintsQueueSender.prototype.stop=function(){if(!this.isStarted)return;this.watchdog.stop();this.isStarted=false};FootprintsQueueSender.prototype.send=function(footprintsData,async,shouldRequeue){if(async===void 0){async=true}if(shouldRequeue===void 0){shouldRequeue=true}if(!footprintsData){this.logger.info("No need to send footprints as the 'footprintsData' is null or undefined.");return}var request=this.createRequest(footprintsData);if(request==null){this.logger.info("No need to send footprints as the request is empty.");return}var context=this;var onSuccess=function(){context.logger.info("Sent footprints successfully")};var onError=function(response){context.logger.error("Failed while trying to send footprints. response.responseText: '"+response.responseText+"'. response.statusCode:"+response.statusCode);if(shouldRequeue){context.logger.info("Requeuing footprints again");context.footprintsQueue.requeueItems(footprintsData)}};this.lightBackendProxy.submitRequest(request,onSuccess,onError,async)};FootprintsQueueSender.prototype.sendAllSync=function(){if(!this.stateTracker.shouldCollectFootprints()){return}this.logger.info("Sending all remaining footprints synchronously.");this.delayIfHasRequestsInProgress();var async=false;var footprints=this.getCurrentFootprints();this.send(footprints,async)};FootprintsQueueSender.prototype.sendAll=function(){var footprints=this.getCurrentFootprints();this.send(footprints)};FootprintsQueueSender.prototype.delayIfHasRequestsInProgress=function(){var counter=this.configuration.delayShutdownInSeconds||30;while(this.lightBackendProxy.hasRequestsInProgress()&&counter-- >0){this.logger.info("Has other requests in progress. Sleeping.. # of requests: "+this.lightBackendProxy.getRequestsInProgressCount()+". Remaining retries: "+counter);this.sleep(1e3)}};FootprintsQueueSender.prototype.pushCurrentFootprints=function(){if(!this.stateTracker.shouldCollectFootprints()){return}var testId=this.stateTracker.getCurrentTestIdentifier();var testInfo=this.testStateHelper.splitTestIdToExecutionAndTestName(testId);var footprints=this.codeCoverageManager.getFootprints(testInfo);if(this.configuration.resolveWithoutHash){this.enqueueV5Footprints(footprints)}else{this.enqueueV2Footprints(footprints,testInfo)}};FootprintsQueueSender.prototype.enqueueV2Footprints=function(appsAndFootprintsArray,testInfo){if(appsAndFootprintsArray&&appsAndFootprintsArray.length){var queueItem=new footprints_item_data_1.FootprintsItemData;queueItem.testName=testInfo.testName;queueItem.executionId=testInfo.executionId;queueItem.apps=appsAndFootprintsArray;this.footprintsQueue.enqueueItem(queueItem)}};FootprintsQueueSender.prototype.enqueueV5Footprints=function(footprintsRequest){if(!footprintsRequest)return;if(!footprintsRequest.apps||footprintsRequest.apps.length==0)return;if(!footprintsRequest.tests||footprintsRequest.tests.length==0)return;this.footprintsQueue.enqueueItem(footprintsRequest)};FootprintsQueueSender.prototype.getCurrentFootprints=function(){this.pushCurrentFootprints();var footprints=this.footprintsQueue.getQueueContentsAndEmptyQueue();return footprints};FootprintsQueueSender.prototype.createRequest=function(data){if(this.configuration.resolveWithoutHash){return this.createV5FootprintsRequest(data)}return this.createV2FootprintsRequest(data)};FootprintsQueueSender.prototype.createV5FootprintsRequest=function(footprintsData){var originalRequest=footprintsData[0];if(!originalRequest){return null}if(!this.hasApps(originalRequest)||!this.hasTests(originalRequest)){return null}var request={};request.customerId=this.configuration.customerId;request.environment=this.environmentData;request.configurationData=this.configuration;request.apps=originalRequest.apps;request.tests=originalRequest.tests;request.meta=originalRequest.meta;return request};FootprintsQueueSender.prototype.createV2FootprintsRequest=function(appsAndFootprintsArray){if(!appsAndFootprintsArray||!appsAndFootprintsArray.length){return null}var request={};request.customerId=this.configuration.customerId;request.items=appsAndFootprintsArray;request.environment=this.environmentData;request.configurationData=this.configuration;return request};FootprintsQueueSender.prototype.sleep=function(millis){var start=system_date_1.getSystemDateValueOf();var end=null;do{end=system_date_1.getSystemDateValueOf()}while(end-start<millis)};FootprintsQueueSender.prototype.hasApps=function(request){return request.apps&&request.apps.length>0};FootprintsQueueSender.prototype.hasTests=function(request){return request.tests&&request.tests.length>0};FootprintsQueueSender.prototype.loadSlMapping=function(){var _this=this;this.window.slMappings=this.window.slMappings||{};if(!this.window.slMappings[this.configuration.buildSessionId]){this.lightBackendProxy.getSlMappingFromServer(this.configuration.buildSessionId).then(function(mapping){return _this.window.slMappings[_this.configuration.buildSessionId]=mapping},function(err){var errMsg="Error while trying to load slMapping from server '"+err+"'";_this.logger.error(errMsg);cockpit_notifier_1.CockpitNotifier.sendGenericMessage(errMsg);_this.window.slMappings[_this.configuration.buildSessionId]={}})}};return FootprintsQueueSender}();exports.FootprintsQueueSender=FootprintsQueueSender})},{"../../common/agent-events/cockpit-notifier":294,"../../common/system-date":333,"./entities/footprints-item-data":265}],268:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","./logger/log-factory","../../common/footprints-process-v6/location-formatter","../../common/footprints-process/collection-interval","../../common/system-date"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.IstanbulToFootprintsConvertorV3=void 0;var log_factory_1=require("./logger/log-factory");var location_formatter_1=require("../../common/footprints-process-v6/location-formatter");var collection_interval_1=require("../../common/footprints-process/collection-interval");var system_date_1=require("../../common/system-date");var IstanbulToFootprintsConvertorV3=function(){function IstanbulToFootprintsConvertorV3(window,cfg){this.window=window;this.cfg=cfg;this.totalTests=0;if(!window)throw new Error("window is required");if(!cfg)throw new Error("cfg is required");this.collectionInterval=new collection_interval_1.CollectionInterval(this.cfg.interval*1e3);this.logger=log_factory_1.LogFactory.createLogger("IstanbulToFootprintsConvertor")}IstanbulToFootprintsConvertorV3.prototype.resetState=function(){this.totalTests=0;this.eidToHitsIndex={};this.uniqueIdToElement={};this.testNameToTestData={};this.fileNameToAppFile={};this.collectionInterval.next()};IstanbulToFootprintsConvertorV3.prototype.convert=function(istanbulFootprints,testName,executionId,mockTime){this.resetState();var result=this.createFootprintsFile();var app=result.apps[0];var localTime=mockTime?mockTime:system_date_1.getSystemDateValueOf();var test=this.getOrCreateTestData(testName,executionId,localTime,result);for(var moduleName in istanbulFootprints){
25
+ ;return __generator(this,function(_a){this.isRunning=false;this.sendToServerWatchdog.stop();if(this.configuration.enabled.value===false||this.configuration.sendEvents.value===false){return[2]}callback=function(err){if(err){_this.logger.error("Failed to submit final events, Error : '"+err+"'")}};while(this.eventsQueue.getQueueSize()>0){items=this.eventsQueue.dequeue(events_process_1.EventsProcess.ITEMS_TO_DEQUE);packet=this.createEventsPacket(items);this.backendProxy.submitEvents(packet,callback,false)}return[2]})})};return BrowserEventsProcess}(events_process_1.EventsProcess);exports.BrowserEventsProcess=BrowserEventsProcess})},{"../../common/events-process":314}],253:[function(require,module,exports){var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(Object.prototype.hasOwnProperty.call(b,p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","../../common/footprints-process-v6/hits-collector"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.BrowserHitsCollector=void 0;var hits_collector_1=require("../../common/footprints-process-v6/hits-collector");var BrowserHitsCollector=function(_super){__extends(BrowserHitsCollector,_super);function BrowserHitsCollector(buildSessionId,logger,globalCoverageObject){var _this=_super.call(this,logger,globalCoverageObject)||this;_this.buildSessionId=buildSessionId;return _this}BrowserHitsCollector.prototype.getGlobalCoverageObject=function(){if(!this.globalCoverageObject){var coverageObject="$SealightsCoverage";var coverageObjectForBSID=coverageObject+"_"+this.buildSessionId;this.globalCoverageObject=window[coverageObjectForBSID]||window[coverageObject]}return this.globalCoverageObject};return BrowserHitsCollector}(hits_collector_1.HitsCollector);exports.BrowserHitsCollector=BrowserHitsCollector})},{"../../common/footprints-process-v6/hits-collector":318}],254:[function(require,module,exports){var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(Object.prototype.hasOwnProperty.call(b,p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","../../common/footprints-process-v6/base-browser-hits-converter"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.BrowserHitsConverter=void 0;var base_browser_hits_converter_1=require("../../common/footprints-process-v6/base-browser-hits-converter");var BrowserHitsConverter=function(_super){__extends(BrowserHitsConverter,_super);function BrowserHitsConverter(relativePathResolver,window,buildSessionId,logger){var _this=_super.call(this,relativePathResolver,buildSessionId,logger)||this;_this.window=window;return _this}BrowserHitsConverter.prototype.getSlMapping=function(){return this.window.slMappings[this.buildSessionId]||{}};return BrowserHitsConverter}(base_browser_hits_converter_1.BaseBrowserHitsConverter);exports.BrowserHitsConverter=BrowserHitsConverter})},{"../../common/footprints-process-v6/base-browser-hits-converter":315}],255:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.CodeCoverageManager=void 0;var CodeCoverageManager=function(){function CodeCoverageManager(convertor,configuration){this.convertor=convertor;this.configuration=configuration;this.aggregatedCoverage={};this.isDestroyed=false}CodeCoverageManager.prototype.findCoverageContainer=function(){var coverageObject="$SealightsCoverage";var coverageObjectForBSID=coverageObject+"_"+this.configuration.buildSessionId;return window[coverageObjectForBSID]||window[coverageObject]};CodeCoverageManager.prototype.getFootprints=function(testInfo){var counters=this.getCounters(true);return this.convertor.convert(counters,testInfo.testName,testInfo.executionId)};CodeCoverageManager.prototype._clearCounters=function(istanbulCoverageObject){if(!istanbulCoverageObject)return;if(this.isDestroyed)return;var context=this;this.forEachProp(istanbulCoverageObject,function(moduleName,m){context.aggregatedCoverage[moduleName]=context.aggregatedCoverage[moduleName]||{s:{},b:{},f:{}};var am=context.aggregatedCoverage[moduleName];context.forEachProp(m.s,function(sid,s){am.s[sid]=(am.s[sid]||0)+m.s[sid];m.s[sid]=0});context.forEachProp(m.b,function(bid,b){am.b[bid]=am.b[bid]||Array.apply(null,Array(m.b[bid].length)).map(Number.prototype.valueOf,0);for(var idx=0;idx<am.b[bid].length;idx++){am.b[bid][idx]+=m.b[bid][idx];m.b[bid][idx]=0}});context.forEachProp(m.f,function(fid,f){am.f[fid]=(am.f[fid]||0)+m.f[fid];m.f[fid]=0})})};CodeCoverageManager.prototype.cloneCodeMetrics=function(o){var cloned={};for(var i in o){cloned[i]=this.cloneModule(o[i])}return cloned};CodeCoverageManager.prototype.cloneModule=function(m){var cm={b:{},f:{},s:{}};for(var i in m.s){cm.s[i]=m.s[i]}for(var i in m.f){cm.f[i]=m.f[i]}for(var i in m.b){cm.b[i]=m.b[i].slice()}cm.metadata=m.metadata;cm.path=m.path;cm.fnMap=m.fnMap;cm.fnToBranch=m.fnToBranch;cm.branchMap=m.branchMap;cm.inputSourceMap=m.inputSourceMap;return cm};CodeCoverageManager.prototype.forEachProp=function(obj,func){Object.keys(obj).forEach(function(k){func(k,obj[k])})};CodeCoverageManager.prototype.clearCounters=function(){if(this.isDestroyed)return;var ct=this.findCoverageContainer();if(ct){this._clearCounters(ct)}};CodeCoverageManager.prototype.getCounters=function(clearAfterwards){if(this.isDestroyed)return{};var ct=this.findCoverageContainer();if(ct){var ret=this.cloneCodeMetrics(ct);if(clearAfterwards)this._clearCounters(ct);return ret}};return CodeCoverageManager}();exports.CodeCoverageManager=CodeCoverageManager})},{}],256:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","./state-tracker"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ColorCookieHandler=void 0;var state_tracker_1=require("./state-tracker");var ColorCookieHandler=function(){function ColorCookieHandler(window){this.window=window;this.COOKIE_KEY="x-sl-testid"}ColorCookieHandler.prototype.setCookie=function(color){var cookie=this.COOKIE_KEY+"="+color;this.window.document.cookie=cookie};ColorCookieHandler.prototype.handleColorChange=function(color){if(color!=null&&color!=state_tracker_1.StateTracker.ANONYMOUS_FOOTPRINTS_COLOR){this.setCookie(color)}else{this.removeCookie()}};ColorCookieHandler.prototype.removeCookie=function(){this.window.document.cookie=this.COOKIE_KEY+"=;expires=Thu, 01 Jan 1970 00:00:01 GMT;"};ColorCookieHandler.prototype.getCookie=function(){return this.window.document.cookie};return ColorCookieHandler}();exports.ColorCookieHandler=ColorCookieHandler})},{"./state-tracker":284}],257:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.SL_AGENT_TYPE=exports.SL_AGENT_VERSION=void 0;exports.SL_AGENT_VERSION="6.1.263";exports.SL_AGENT_TYPE="browser"})},{}],258:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","./entities/configuration-data"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ConfigurationManager=void 0;var configuration_data_1=require("./entities/configuration-data");var ConfigurationManager=function(){function ConfigurationManager(logger,basicConfiguration,window){this.logger=logger;this.basicConfiguration=basicConfiguration;this.window=window;if(logger==null)throw new Error("'logger' cannot be null or undefined");if(basicConfiguration==null)throw new Error("'basicConfiguration' cannot be null or undefined");if(window==null)throw new Error("'window' cannot be null or undefined")}ConfigurationManager.prototype.getConfiguration=function(){if(this.currentConfiguration)return this.currentConfiguration;var configurationData=this.getDefaults();this.overrideConfiguration(configurationData);configurationData.labId=this.resolveLabId();this.currentConfiguration=configurationData;this.printConfiguration(configurationData);this.validateConfiguration(configurationData);return configurationData};ConfigurationManager.prototype.getDefaults=function(){var config=new configuration_data_1.ConfigurationData;config.appName=this.basicConfiguration.appName;config.branchName=this.basicConfiguration.branchName;config.buildName=this.basicConfiguration.buildName;config.buildSessionId=this.basicConfiguration.buildSessionId;config.customerId=this.basicConfiguration.customerId;config.token=this.basicConfiguration.token;config.server=this.basicConfiguration.server;config.interval=this.basicConfiguration.interval||10;config.maxItemsInQueue=this.basicConfiguration.maxItemsInQueue||500;config.workspacepath=this.basicConfiguration.workspacepath;return config};ConfigurationManager.prototype.resolveLabId=function(){var labId=this.readLabIdFromWindow();if(labId){this.logger.info("Using labId from the 'window' object. LabId:"+labId);return labId}labId=this.basicConfiguration.labId;if(labId){this.logger.info("Using labId from basic configuration. LabId:"+labId);return labId}labId=this.readLabIdFromSessionStorage();if(labId){this.logger.info("Using labId from session storage. LabId:"+labId);return labId}labId=this.basicConfiguration.buildSessionId;if(labId){this.logger.info("Using buildSessionId as labId. LabId:"+labId);return labId}labId=this.basicConfiguration.appName;if(labId){this.logger.info("Using appName as labId. LabId:"+labId);return labId}return"DefaultLabId"};ConfigurationManager.prototype.overrideConfiguration=function(configurationData){for(var p in this.basicConfiguration){configurationData[p]=this.basicConfiguration[p]}this.logger.info("[TO CS] - TODO: Send request to server to get the configuration.")};ConfigurationManager.prototype.printConfiguration=function(configurationData){this.logger.info("***********************************************************");this.logger.info("Current configuration:");this.logger.info("------------------------------------------------");for(var prop in configurationData){this.logger.info(prop+": '"+configurationData[prop])+"'"}this.logger.info("***********************************************************")};ConfigurationManager.prototype.validateConfiguration=function(configurationData){var _this=this;var fieldsWithError=[];if(!configurationData.customerId||configurationData.customerId=="")fieldsWithError.push("customerId");if(!configurationData.server||configurationData.server=="")fieldsWithError.push("server");if(!configurationData.appName||configurationData.appName=="")fieldsWithError.push("appName");if(!configurationData.branchName||configurationData.branchName=="")fieldsWithError.push("branchName");if(!configurationData.buildName||configurationData.buildName=="")fieldsWithError.push("buildName");if(!configurationData.token||configurationData.token=="")fieldsWithError.push("token");if(fieldsWithError.length>0){this.logger.warn("------------------------------------------------");this.logger.warn("Detected an invalid configuration:");fieldsWithError.forEach(function(field){_this.logger.warn("'"+field+"' is required but it had a 'null' or empty value.")});this.logger.warn("Please fix the configuration prior to using SeaLights.");this.logger.warn("------------------------------------------------")}this._isValidConfiguration=fieldsWithError.length==0};ConfigurationManager.prototype.isValidConfiguration=function(){return this._isValidConfiguration};ConfigurationManager.prototype.readLabIdFromSessionStorage=function(){var labId=null;if(this.window.sessionStorage&&typeof this.window.sessionStorage==="function"){labId=this.window.sessionStorage.getItem(ConfigurationManager.LAB_ID_KEY)}return labId};ConfigurationManager.prototype.readLabIdFromWindow=function(){return this.window[ConfigurationManager.LAB_ID_KEY]};ConfigurationManager.LAB_ID_KEY="__sl.labId__";return ConfigurationManager}();exports.ConfigurationManager=ConfigurationManager})},{"./entities/configuration-data":263}],259:[function(require,module,exports){var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(Object.prototype.hasOwnProperty.call(b,p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","events","./logger/console-logger"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ConfigurationOverride=exports.ConfigChangedEvents=void 0;var EventEmitter=require("events");var console_logger_1=require("./logger/console-logger");var ConfigChangedEvents;(function(ConfigChangedEvents){ConfigChangedEvents["LOG_LEVEL_CHANGED"]="logLevelChanged"})(ConfigChangedEvents=exports.ConfigChangedEvents||(exports.ConfigChangedEvents={}));var ConfigurationOverride=function(_super){__extends(ConfigurationOverride,_super);function ConfigurationOverride(initialConfig){var _this=_super.call(this)||this;_this._logLevel=console_logger_1.LogLevels.INFO;_this.setMaxListeners(500);_this.loadInitialConfig(initialConfig);return _this}Object.defineProperty(ConfigurationOverride.prototype,"logLevel",{get:function(){return this._logLevel},set:function(value){this._logLevel=value;this.emit(ConfigChangedEvents.LOG_LEVEL_CHANGED,value)},enumerable:false,configurable:true});ConfigurationOverride.prototype.loadInitialConfig=function(initialConfig){if(initialConfig===void 0){initialConfig={}}for(var prop in initialConfig){var descriptor=Object.getOwnPropertyDescriptor(this.constructor.prototype,prop);if(descriptor&&typeof descriptor.set==="function"){this[prop]=initialConfig[prop]}}};ConfigurationOverride.create=function(configuration){if(configuration instanceof ConfigurationOverride){return configuration}return new ConfigurationOverride(configuration)};return ConfigurationOverride}(EventEmitter);exports.ConfigurationOverride=ConfigurationOverride})},{"./logger/console-logger":271,events:110}],260:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ExecutionStatus=void 0;var ExecutionStatus;(function(ExecutionStatus){ExecutionStatus["InProgress"]="created";ExecutionStatus["Ending"]="pendingDelete"})(ExecutionStatus=exports.ExecutionStatus||(exports.ExecutionStatus={}))})},{}],261:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Delegate=void 0;var Delegate=function(){function Delegate(){this.functions=new Array}Delegate.prototype.addListener=function(func){if(!func)return;if(this.functions)this.functions.push(func)};Delegate.prototype.fire=function(){if(!this.functions)return;for(var i=0;i<this.functions.length;i++){this.functions[i]()}};return Delegate}();exports.Delegate=Delegate})},{}],262:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.BasicConfigurationData=void 0;var BasicConfigurationData=function(){function BasicConfigurationData(){}return BasicConfigurationData}();exports.BasicConfigurationData=BasicConfigurationData})},{}],263:[function(require,module,exports){var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(Object.prototype.hasOwnProperty.call(b,p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","./basic-configuation-data"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ConfigurationData=void 0;var basic_configuation_data_1=require("./basic-configuation-data");var ConfigurationData=function(_super){__extends(ConfigurationData,_super);function ConfigurationData(){var _this=_super!==null&&_super.apply(this,arguments)||this;_this.registerShutdownHook=true;_this.enabled=true;return _this}return ConfigurationData}(basic_configuation_data_1.BasicConfigurationData);exports.ConfigurationData=ConfigurationData})},{"./basic-configuation-data":262}],264:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","../config"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.EnvironmentData=void 0;var config_1=require("../config");var EnvironmentData=function(){function EnvironmentData(){}EnvironmentData.create=function(configuration){var data=new EnvironmentData;data.agentType=config_1.SL_AGENT_TYPE;data.agentVersion=config_1.SL_AGENT_VERSION;data.agentId=EnvironmentData.constantAgentId;data.labId=configuration.labId||"";data.meta={navigator:window.navigator,userAgent:window.navigator&&window.navigator.userAgent,location:window.location};return data};return EnvironmentData}();exports.EnvironmentData=EnvironmentData})},{"../config":257}],265:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.FootprintsItemData=void 0;var FootprintsItemData=function(){function FootprintsItemData(){}return FootprintsItemData}();exports.FootprintsItemData=FootprintsItemData})},{}],266:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.FeatureDetection=void 0;var FeatureDetection=function(){function FeatureDetection(window){this.window=window;if(!window)throw new Error("'window' cannot be null or undefined")}FeatureDetection.prototype.hasBeaconAPI=function(){var result=window.navigator&&this.isFunction(window.navigator["sendBeacon"]);return result};FeatureDetection.prototype.hasConsoleLogAPI=function(){var result=window.console&&this.isFunction(window.console.log);return result};FeatureDetection.prototype.hasJsonAPI=function(){var result=JSON&&this.isFunction(JSON.stringify)&&this.isFunction(JSON.parse);return result};FeatureDetection.prototype.isFunction=function(o){return o&&typeof o==="function"};return FeatureDetection}();exports.FeatureDetection=FeatureDetection})},{}],267:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","./entities/footprints-item-data","../../common/system-date","../../common/agent-events/cockpit-notifier"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.FootprintsQueueSender=void 0;var footprints_item_data_1=require("./entities/footprints-item-data");var system_date_1=require("../../common/system-date");var cockpit_notifier_1=require("../../common/agent-events/cockpit-notifier");var FootprintsQueueSender=function(){function FootprintsQueueSender(watchdog,lightBackendProxy,codeCoverageManager,stateTracker,testStateHelper,environmentData,configuration,footprintsQueue,window,logger,slMappingLoader){var _this=this;this.watchdog=watchdog;this.lightBackendProxy=lightBackendProxy;this.codeCoverageManager=codeCoverageManager;this.stateTracker=stateTracker;this.testStateHelper=testStateHelper;this.environmentData=environmentData;this.configuration=configuration;this.footprintsQueue=footprintsQueue;this.window=window;this.logger=logger;this.slMappingLoader=slMappingLoader;this.isStarted=false;if(watchdog==null)throw new Error("'watchdog' cannot be null or undefined");if(lightBackendProxy==null)throw new Error("'lightBackendProxy' cannot be null or undefined");if(codeCoverageManager==null)throw new Error("'codeCoverageManager' cannot be null or undefined");if(stateTracker==null)throw new Error("'stateTracker' cannot be null or undefined");if(testStateHelper==null)throw new Error("'testStateHelper' cannot be null or undefined");if(environmentData==null)throw new Error("'environmentData' cannot be null or undefined");if(configuration==null)throw new Error("'configuration' cannot be null or undefined");if(footprintsQueue==null)throw new Error("'footprintsQueue' cannot be null or undefined");if(window==null)throw new Error("'window' cannot be null or undefined");if(logger==null)throw new Error("'logger' cannot be null or undefined");this.context=this;this.watchdog.addOnAlarmListener(function(){_this.context.onTimerTick()})}FootprintsQueueSender.prototype.onTimerTick=function(){if(!this.stateTracker.shouldCollectFootprints()){return}var footprints=this.getCurrentFootprints();this.send(footprints)};FootprintsQueueSender.prototype.start=function(){if(this.isStarted)return;this.watchdog.start();this.slMappingLoader.loadSlMapping(this.configuration.buildSessionId);this.isStarted=true};FootprintsQueueSender.prototype.stop=function(){if(!this.isStarted)return;this.watchdog.stop();this.isStarted=false};FootprintsQueueSender.prototype.send=function(footprintsData,async,shouldRequeue){if(async===void 0){async=true}if(shouldRequeue===void 0){shouldRequeue=true}if(!footprintsData){this.logger.info("No need to send footprints as the 'footprintsData' is null or undefined.");return}var request=this.createRequest(footprintsData);if(request==null){this.logger.info("No need to send footprints as the request is empty.");return}var context=this;var onSuccess=function(){context.logger.info("Sent footprints successfully")};var onError=function(response){context.logger.error("Failed while trying to send footprints. response.responseText: '"+response.responseText+"'. response.statusCode:"+response.statusCode);if(shouldRequeue){context.logger.info("Requeuing footprints again");context.footprintsQueue.requeueItems(footprintsData)}};this.lightBackendProxy.submitRequest(request,onSuccess,onError,async)};FootprintsQueueSender.prototype.sendAllSync=function(){if(!this.stateTracker.shouldCollectFootprints()){return}this.logger.info("Sending all remaining footprints synchronously.");this.delayIfHasRequestsInProgress();var async=false;var footprints=this.getCurrentFootprints();this.send(footprints,async)};FootprintsQueueSender.prototype.sendAll=function(){var footprints=this.getCurrentFootprints();this.send(footprints)};FootprintsQueueSender.prototype.delayIfHasRequestsInProgress=function(){var counter=this.configuration.delayShutdownInSeconds||30;while(this.lightBackendProxy.hasRequestsInProgress()&&counter-- >0){this.logger.info("Has other requests in progress. Sleeping.. # of requests: "+this.lightBackendProxy.getRequestsInProgressCount()+". Remaining retries: "+counter);this.sleep(1e3)}};FootprintsQueueSender.prototype.pushCurrentFootprints=function(){if(!this.stateTracker.shouldCollectFootprints()){return}var testId=this.stateTracker.getCurrentTestIdentifier();var testInfo=this.testStateHelper.splitTestIdToExecutionAndTestName(testId);var footprints=this.codeCoverageManager.getFootprints(testInfo);if(this.configuration.resolveWithoutHash){this.enqueueV5Footprints(footprints)}else{this.enqueueV2Footprints(footprints,testInfo)}};FootprintsQueueSender.prototype.enqueueV2Footprints=function(appsAndFootprintsArray,testInfo){if(appsAndFootprintsArray&&appsAndFootprintsArray.length){var queueItem=new footprints_item_data_1.FootprintsItemData;queueItem.testName=testInfo.testName;queueItem.executionId=testInfo.executionId;queueItem.apps=appsAndFootprintsArray;this.footprintsQueue.enqueueItem(queueItem)}};FootprintsQueueSender.prototype.enqueueV5Footprints=function(footprintsRequest){if(!footprintsRequest)return;if(!footprintsRequest.apps||footprintsRequest.apps.length==0)return;if(!footprintsRequest.tests||footprintsRequest.tests.length==0)return;this.footprintsQueue.enqueueItem(footprintsRequest)};FootprintsQueueSender.prototype.getCurrentFootprints=function(){this.pushCurrentFootprints();var footprints=this.footprintsQueue.getQueueContentsAndEmptyQueue();return footprints};FootprintsQueueSender.prototype.createRequest=function(data){if(this.configuration.resolveWithoutHash){return this.createV5FootprintsRequest(data)}return this.createV2FootprintsRequest(data)};FootprintsQueueSender.prototype.createV5FootprintsRequest=function(footprintsData){var originalRequest=footprintsData[0];if(!originalRequest){return null}if(!this.hasApps(originalRequest)||!this.hasTests(originalRequest)){return null}var request={};request.customerId=this.configuration.customerId;request.environment=this.environmentData;request.configurationData=this.configuration;request.apps=originalRequest.apps;request.tests=originalRequest.tests;request.meta=originalRequest.meta;return request};FootprintsQueueSender.prototype.createV2FootprintsRequest=function(appsAndFootprintsArray){if(!appsAndFootprintsArray||!appsAndFootprintsArray.length){return null}var request={};request.customerId=this.configuration.customerId;request.items=appsAndFootprintsArray;request.environment=this.environmentData;request.configurationData=this.configuration;return request};FootprintsQueueSender.prototype.sleep=function(millis){var start=system_date_1.getSystemDateValueOf();var end=null;do{end=system_date_1.getSystemDateValueOf()}while(end-start<millis)};FootprintsQueueSender.prototype.hasApps=function(request){return request.apps&&request.apps.length>0};FootprintsQueueSender.prototype.hasTests=function(request){return request.tests&&request.tests.length>0};FootprintsQueueSender.prototype.loadSlMapping=function(){var _this=this;this.window.slMappings=this.window.slMappings||{};if(!this.window.slMappings[this.configuration.buildSessionId]){this.lightBackendProxy.getSlMappingFromServer(this.configuration.buildSessionId).then(function(mapping){return _this.window.slMappings[_this.configuration.buildSessionId]=mapping},function(err){var errMsg="Error while trying to load slMapping from server '"+err+"'";_this.logger.error(errMsg);cockpit_notifier_1.CockpitNotifier.sendGenericMessage(errMsg);_this.window.slMappings[_this.configuration.buildSessionId]={}})}};return FootprintsQueueSender}();exports.FootprintsQueueSender=FootprintsQueueSender})},{"../../common/agent-events/cockpit-notifier":294,"../../common/system-date":333,"./entities/footprints-item-data":265}],268:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","./logger/log-factory","../../common/footprints-process-v6/location-formatter","../../common/footprints-process/collection-interval","../../common/system-date"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.IstanbulToFootprintsConvertorV3=void 0;var log_factory_1=require("./logger/log-factory");var location_formatter_1=require("../../common/footprints-process-v6/location-formatter");var collection_interval_1=require("../../common/footprints-process/collection-interval");var system_date_1=require("../../common/system-date");var IstanbulToFootprintsConvertorV3=function(){function IstanbulToFootprintsConvertorV3(window,cfg){this.window=window;this.cfg=cfg;this.totalTests=0;if(!window)throw new Error("window is required");if(!cfg)throw new Error("cfg is required");this.collectionInterval=new collection_interval_1.CollectionInterval(this.cfg.interval*1e3);this.logger=log_factory_1.LogFactory.createLogger("IstanbulToFootprintsConvertor")}IstanbulToFootprintsConvertorV3.prototype.resetState=function(){this.totalTests=0;this.eidToHitsIndex={};this.uniqueIdToElement={};this.testNameToTestData={};this.fileNameToAppFile={};this.collectionInterval.next()};IstanbulToFootprintsConvertorV3.prototype.convert=function(istanbulFootprints,testName,executionId,mockTime){this.resetState();var result=this.createFootprintsFile();var app=result.apps[0];var localTime=mockTime?mockTime:system_date_1.getSystemDateValueOf();var test=this.getOrCreateTestData(testName,executionId,localTime,result);for(var moduleName in istanbulFootprints){
26
26
  var istanbulModule=istanbulFootprints[moduleName];if(!istanbulModule){continue}var scopeData={test:test,app:app,modulePath:istanbulModule.path.replace(/\\/g,"/"),istanbulModule:istanbulModule};if(istanbulModule.f){this.addMethodsWithHits(scopeData)}if(istanbulModule.b){this.addBranchesWithHits(scopeData)}}result.apps=this.filterAppsWithoutHits(result.apps);return result};IstanbulToFootprintsConvertorV3.prototype.filterAppsWithoutHits=function(apps){var _this=this;if(!apps)return apps;return apps.filter(function(app){return _this.filterFilesWithoutHits(app)})};IstanbulToFootprintsConvertorV3.prototype.filterFilesWithoutHits=function(app){var _this=this;var hasFiles=false;if(!app||!app.files){return hasFiles}app.files=app.files.filter(function(file){return _this.filterElementsWithoutHits(file)});hasFiles=app.files.length>0;return hasFiles};IstanbulToFootprintsConvertorV3.prototype.filterElementsWithoutHits=function(file){var hasMethodHits=this.filterElementWithoutHits(file,"methods");var hasBranchHits=this.filterElementWithoutHits(file,"branches");var hasLineHits=this.filterElementWithoutHits(file,"lines");var hasHits=hasMethodHits||hasBranchHits||hasLineHits;return hasHits};IstanbulToFootprintsConvertorV3.prototype.filterElementWithoutHits=function(file,coverageType){var _this=this;var fileObject=file;var arrayOfCodeElements=fileObject[coverageType]||[];arrayOfCodeElements=arrayOfCodeElements.filter(function(ce){return _this.hasHit(ce)});fileObject[coverageType]=arrayOfCodeElements;var hasHits=arrayOfCodeElements.length>0;return hasHits};IstanbulToFootprintsConvertorV3.prototype.hasHit=function(element){var hasHitInAnyTest=element.hits.some(function(hitToTest){return hitToTest[1]>0});return hasHitInAnyTest};IstanbulToFootprintsConvertorV3.prototype.addMethodsWithHits=function(scopeData){var istanbulModule=scopeData.istanbulModule;for(var methodId in istanbulModule.f){var hits=istanbulModule.f[methodId];if(hits>0){var methodData=istanbulModule.fnMap[methodId];this.addOrUpdateMethodElement(scopeData,methodData,hits)}}};IstanbulToFootprintsConvertorV3.prototype.addBranchesWithHits=function(scopeData){var istanbulModule=scopeData.istanbulModule;for(var branchId in istanbulModule.b){var probesArray=istanbulModule.b[branchId];for(var idx=0;idx<probesArray.length;idx++){var hits=probesArray[idx];if(hits>0){var branchData=istanbulModule.branchMap[branchId];this.addOrUpdateBranchElement(scopeData,branchData,idx,hits)}}}};IstanbulToFootprintsConvertorV3.prototype.addOrUpdateMethodElement=function(scopeData,methodData,hits){var loc=methodData.loc||methodData.lc;var decl=methodData.decl||methodData.d;this.addOrUpdateElement(scopeData,loc,hits,this.getOrCreateMethodElement,false);if(decl){this.addOrUpdateElement(scopeData,decl,hits,this.getOrCreateMethodElement,false)}};IstanbulToFootprintsConvertorV3.prototype.addOrUpdateBranchElement=function(scopeData,branchData,probeIndex,hits){var locations=branchData.locations||branchData.lcs;var probePositionData=locations[probeIndex];this.addOrUpdateElement(scopeData,probePositionData,hits,this.getOrCreateBranchElement,true,probeIndex)};IstanbulToFootprintsConvertorV3.prototype.addOrUpdateElement=function(scopeData,startPositionData,hits,getOrCreateElement,isBranch,probIndex){var file=this.getOrCreateFootprintsAppFile(scopeData.modulePath,scopeData.app);var startPosition=startPositionData.start||startPositionData.st;var uniqueId=this.createUniqueId(startPosition,scopeData.modulePath,isBranch,probIndex);if(!uniqueId){return}var element=getOrCreateElement.call(this,uniqueId,file);this.addOrUpdateElementHits(scopeData.test,uniqueId,element,hits)};IstanbulToFootprintsConvertorV3.prototype.createUniqueId=function(startPosition,fullFilePath,isBranch,probIndex){var delimiter=isBranch?"|":"@";var uniqueId=fullFilePath+delimiter+this.formatLoc(startPosition);if(probIndex!=null){uniqueId+="|"+probIndex}var mapping=this.window.slMappings[this.cfg.buildSessionId];if(mapping){uniqueId=mapping[uniqueId]||uniqueId}return uniqueId};IstanbulToFootprintsConvertorV3.prototype.addOrUpdateElementHits=function(testData,elementUniqueId,element,hits){var HITS_INDEX=1;var eid=elementUniqueId+"|"+testData.index;var index=this.eidToHitsIndex[eid];if(index!=null){var testIndexAndHits=element.hits[index];var elementHits=testIndexAndHits[HITS_INDEX];elementHits=elementHits+hits;testIndexAndHits[HITS_INDEX]=elementHits}else{var testIndexAndHits=new Array;testIndexAndHits.push(testData.index);testIndexAndHits.push(hits);var length_1=element.hits.push(testIndexAndHits);this.eidToHitsIndex[eid]=length_1-1}};IstanbulToFootprintsConvertorV3.prototype.getOrCreateTestData=function(testName,executionId,localTime,result){if(!this.testNameToTestData[testName]){var test_1={executionId:executionId,localTime:localTime,testName:testName,collectionInterval:this.collectionInterval.toJson()};result.tests.push(test_1);this.testNameToTestData[testName]={index:this.totalTests++,test:test_1}}return this.testNameToTestData[testName]};IstanbulToFootprintsConvertorV3.prototype.getOrCreateMethodElement=function(uniqueId,file){if(!this.uniqueIdToElement[uniqueId]){var x={hits:new Array,uniqueId:uniqueId};this.uniqueIdToElement[uniqueId]=x;file.methods.push(x)}return this.uniqueIdToElement[uniqueId]};IstanbulToFootprintsConvertorV3.prototype.getOrCreateBranchElement=function(uniqueId,file){if(!this.uniqueIdToElement[uniqueId]){var x={hits:new Array,uniqueId:uniqueId};this.uniqueIdToElement[uniqueId]=x;if(file.branches)file.branches.push(x)}return this.uniqueIdToElement[uniqueId]};IstanbulToFootprintsConvertorV3.prototype.getOrCreateFootprintsAppFile=function(fileName,app){if(this.fileNameToAppFile[fileName]){return this.fileNameToAppFile[fileName]}var file={methods:new Array,branches:new Array,lines:new Array,path:fileName};app.files.push(file);this.fileNameToAppFile[fileName]=file;return file};IstanbulToFootprintsConvertorV3.prototype.createFootprintsFile=function(){var result={configurationData:{},customerId:this.cfg.customerId,environment:{},tests:[],apps:[],meta:{}};this.fileNameToAppFile={};this.testNameToTestData={};var app={appName:this.cfg.appName,branchName:this.cfg.branchName,buildName:this.cfg.buildName,moduleName:"",buildSessionId:this.cfg.buildSessionId,files:new Array};result.apps.push(app);return result};IstanbulToFootprintsConvertorV3.prototype.formatLoc=function(loc){return location_formatter_1.formatLocation(loc,this.logger)};return IstanbulToFootprintsConvertorV3}();exports.IstanbulToFootprintsConvertorV3=IstanbulToFootprintsConvertorV3})},{"../../common/footprints-process-v6/location-formatter":321,"../../common/footprints-process/collection-interval":323,"../../common/system-date":333,"./logger/log-factory":272}],269:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","./utils"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.IstanbulToFootprintsConverter=void 0;var utils_1=require("./utils");var IstanbulToFootprintsConverter=function(){function IstanbulToFootprintsConverter(window,configuration){this.window=window;this.configuration=configuration;if(configuration==null)throw new Error("'configuration' cannot be null or undefined")}IstanbulToFootprintsConverter.prototype.convert=function(istanbulFootprints){var apps={};var appsArray=new Array;if(istanbulFootprints){var context_1=this;Object.keys(istanbulFootprints).forEach(function(moduleName){var m=istanbulFootprints[moduleName];context_1.configuration.appName=context_1.configuration.appName||"";var a=apps[context_1.configuration.appName];var isNewApp=false;if(!a){a={appName:context_1.configuration.appName,build:context_1.configuration.buildName,branch:context_1.configuration.branchName,footprints:[]};isNewApp=true}var footprints=a.footprints;var filename=m.path;filename=filename.replace(/\\/g,"/");Object.keys(m.f).forEach(function(funcId){var funcInfo=m.fnMap[funcId];if(!funcInfo||funcInfo.skip)return;if(m.f[funcId]>0){var mn=context_1.getMethodName(funcInfo.name,funcInfo.guessedName);var pos=context_1.formatLoc(funcInfo.loc.originalStart||funcInfo.loc.start);if(m.inputSourceMap&&context_1.window["sourceMap"]){var sourceMapConsumer=new context_1.window["sourceMap"].SourceMapConsumer(m.inputSourceMap);pos=context_1.formatLoc(sourceMapConsumer.originalPositionFor(funcInfo.loc.start))}filename=funcInfo.originalFilename||filename;filename=context_1.getRelativeModulePath(filename);var fqmn=[mn,filename,pos].join("@");var hash=funcInfo.hash&&funcInfo.hash.hash;var footprintsItem_1={name:fqmn,hits:m.f[funcId],hash:hash,branches:new Array};if(m.fnToBranch&&m.fnToBranch[funcId]&&m.fnToBranch[funcId].length){m.fnToBranch[funcId].forEach(function(branchArray,index){var fileBranch=branchArray[0];var branchIndex=branchArray[1];if(m.b[fileBranch.toString()][branchIndex]>0){footprintsItem_1.branches.push(index)}})}footprints.push(footprintsItem_1)}});if(footprints.length&&isNewApp){appsArray.push(a);apps[a.appName]=a}})}return appsArray};IstanbulToFootprintsConverter.prototype.getMethodName=function(name,guessedName){var mn=name||guessedName||"(Anonymous)";if(mn.indexOf("(anonymous")>=0){mn="(Anonymous)"}return mn};IstanbulToFootprintsConverter.prototype.formatLoc=function(loc){return[loc.line,loc.column].join(",")};IstanbulToFootprintsConverter.prototype.getRelativeModulePath=function(path){var workspacepath=utils_1.Utils.adjustPathSlashes(this.configuration.workspacepath);path=utils_1.Utils.adjustPathSlashes(path);if(workspacepath){return path.replace(workspacepath,"")}return path};return IstanbulToFootprintsConverter}();exports.IstanbulToFootprintsConverter=IstanbulToFootprintsConverter})},{"./utils":286}],270:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","./browser-agent-instance","../../common/utils/validation-utils","../../common/events-process/events-creator","../../common/events-process/events-contracts"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.KarmaHandler=void 0;var browser_agent_instance_1=require("./browser-agent-instance");var validation_utils_1=require("../../common/utils/validation-utils");var events_creator_1=require("../../common/events-process/events-creator");var events_contracts_1=require("../../common/events-process/events-contracts");var KarmaHandler=function(){function KarmaHandler(window,agent,logger){validation_utils_1.ValidationUtils.verifyNotNullOrEmpty(window,"window");validation_utils_1.ValidationUtils.verifyNotNullOrEmpty(agent,"agent");validation_utils_1.ValidationUtils.verifyNotNullOrEmpty(logger,"logger");this.window=window;this.agent=agent;this.logger=logger}KarmaHandler.prototype.overrideKarmaMethods=function(){if(!this.window.__karma__){this.logger.warn("Could not find '__karma__' object on window, skip overriding methods");return}var that=this;var originalResult=this.window.__karma__.result;var originalComplete=this.window.__karma__.complete;this.window.__karma__.result=function(resultObject){var testResult=that.resolveTestResult(resultObject);var testStartEvent=events_creator_1.EventsCreator.createTestStartedEvent(browser_agent_instance_1.BrowserAgentInstance.getExecutionId(),"karma",resultObject.fullName,resultObject.time);var testEndEvent=events_creator_1.EventsCreator.createTestEndEvent(browser_agent_instance_1.BrowserAgentInstance.getExecutionId(),"karma",resultObject.fullName,testResult,resultObject.time);that.agent.enqueueEvent(testStartEvent);that.agent.enqueueEvent(testEndEvent);var currentTestIdentifier=browser_agent_instance_1.BrowserAgentInstance.getExecutionId()+"/"+resultObject.fullName;that.agent.setCurrentTestIdentifier(currentTestIdentifier);if(originalResult instanceof Function){originalResult.apply(this,arguments)}};this.window.__karma__.complete=function(){var executionEndEvent=events_creator_1.EventsCreator.createEvent(events_contracts_1.EventTypes.ExecutionIdEnded,browser_agent_instance_1.BrowserAgentInstance.getExecutionId(),"karma");that.agent.enqueueEvent(executionEndEvent);that.agent.stop();if(originalComplete instanceof Function){originalComplete.apply(this,arguments)}}};KarmaHandler.prototype.start=function(){var agentStartedEvent=events_creator_1.EventsCreator.createEvent(events_contracts_1.EventTypes.AgentStarted,browser_agent_instance_1.BrowserAgentInstance.getExecutionId(),"karma");var executionStartedEvent=events_creator_1.EventsCreator.createEvent(events_contracts_1.EventTypes.ExecutionIdStarted,browser_agent_instance_1.BrowserAgentInstance.getExecutionId(),"karma");this.agent.enqueueEvent(agentStartedEvent);this.agent.enqueueEvent(executionStartedEvent)};KarmaHandler.prototype.resolveTestResult=function(result){if(result.skipped){return"skipped"}if(result.success){return"passed"}return"failed"};return KarmaHandler}();exports.KarmaHandler=KarmaHandler})},{"../../common/events-process/events-contracts":312,"../../common/events-process/events-creator":313,"../../common/utils/validation-utils":337,"./browser-agent-instance":250}],271:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","../../../common/system-date","../configuration-override"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ConsoleLogger=exports.LogLevels=void 0;var system_date_1=require("../../../common/system-date");var configuration_override_1=require("../configuration-override");var LogLevels;(function(LogLevels){LogLevels["TRACE"]="trace";LogLevels["DEBUG"]="debug";LogLevels["INFO"]="info";LogLevels["WARNING"]="warning";LogLevels["ERROR"]="error";LogLevels["CRITICAL"]="critical";LogLevels["FATAL"]="fatal"})(LogLevels=exports.LogLevels||(exports.LogLevels={}));var ConsoleLogger=function(){function ConsoleLogger(level,selectedLogLevels){if(level===void 0){level=LogLevels.INFO}if(selectedLogLevels===void 0){selectedLogLevels=null}var _a,_b;this.level=level;this.selectedLogLevels=selectedLogLevels;this.logFn=function(){};this.stringifyFn=function(o){return""};this.context={};(_b=(_a=window.$Sealights)===null||_a===void 0?void 0:_a.configuration)===null||_b===void 0?void 0:_b.on(configuration_override_1.ConfigChangedEvents.LOG_LEVEL_CHANGED,this.initLogLevels.bind(this));if(!selectedLogLevels)this.initLogLevels(level);this.initStringifyFn();this.initLogFn()}ConsoleLogger.prototype.withLogLevel=function(level){var c=new ConsoleLogger(this.level);c.context=this.context;return c};ConsoleLogger.prototype.initLogFn=function(){var _this=this;if(console&&typeof console.log=="function"){this.logFn=function(o){var line=_this.stringifyFn(o);console.log(line)}}else{}};ConsoleLogger.prototype.initStringifyFn=function(){if(JSON&&typeof JSON.stringify=="function"){this.stringifyFn=JSON.stringify}else{this.stringifyFn=this.crudeStringifier}};ConsoleLogger.prototype.crudeStringifier=function(o){var strParts=Array();for(var p in o){strParts.push(p+"="+o[p].toString())}return strParts.join(", ")};ConsoleLogger.prototype.initLogLevels=function(level){var orderedLogLevels=[LogLevels.TRACE,LogLevels.DEBUG,LogLevels.INFO,LogLevels.WARNING,LogLevels.ERROR,LogLevels.CRITICAL,LogLevels.FATAL];var logLevel=level.toLowerCase();var minIdx=orderedLogLevels.indexOf(logLevel);if(minIdx===-1){this.handleLevelNotFound(level)}else{this.selectedLogLevels={};for(var i=0;i<orderedLogLevels.length;i++){this.selectedLogLevels[orderedLogLevels[i]]=i>=minIdx}}};ConsoleLogger.prototype.handleLevelNotFound=function(logLevel){if(logLevel=="off"){this.selectedLogLevels={}}};ConsoleLogger.prototype.internalLog=function(logLevel,logMsg,obj){if(!this.selectedLogLevels||!this.selectedLogLevels[logLevel])return;var logObject={level:logLevel.toUpperCase(),ts:system_date_1.getSystemDate().toISOString(),msg:logMsg?logMsg.toString():undefined};var ctx=this.context;for(var p in ctx){logObject[p]=ctx[p]}if(obj){if(obj instanceof Error){logObject.error=obj.toString()}else if(obj instanceof Object){for(var p in obj){logObject[p]=obj[p]}}else{logObject.data=obj}}this.logFn(logObject)};ConsoleLogger.prototype.clone=function(){var c=new ConsoleLogger(this.level,this.selectedLogLevels);var _t=this.context;for(var p in _t){c.context[p]=_t[p]}return c};ConsoleLogger.prototype.withClass=function(className){var c=this.clone();c.context.className=className;delete c.context.methodName;return c};ConsoleLogger.prototype.withMethod=function(methodName){var c=this.clone();c.context.methodName=methodName;return c};ConsoleLogger.prototype.withTx=function(tx){var c=this.clone();c.context.tx=tx;return c};ConsoleLogger.prototype.withComponent=function(componentName,componentVersion){var c=this.clone();c.context.componentName=componentName;c.context.componentVersion=componentVersion;return c};ConsoleLogger.prototype.withActivity=function(activityName){var c=this.clone();c.context.activityName=activityName;return c};ConsoleLogger.prototype.withProperty=function(propName,propValue){var c=this.clone();c.context[propName]=propValue;return c};ConsoleLogger.prototype.withProperties=function(objWithProperties,propNames){var c=this.clone();if(!propNames){propNames=Object.keys(objWithProperties)}propNames.forEach(function(pn){c.context[pn]=objWithProperties[pn]});return c};ConsoleLogger.prototype.fatal=function(logMsg,obj){this.internalLog(LogLevels.FATAL,logMsg,obj)};ConsoleLogger.prototype.critical=function(logMsg,obj){this.internalLog(LogLevels.CRITICAL,logMsg,obj)};ConsoleLogger.prototype.error=function(logMsg,obj){this.internalLog(LogLevels.ERROR,logMsg,obj)};ConsoleLogger.prototype.warn=function(logMsg,obj){this.internalLog(LogLevels.WARNING,logMsg,obj)};ConsoleLogger.prototype.info=function(logMsg,obj){this.internalLog(LogLevels.INFO,logMsg,obj)};ConsoleLogger.prototype.debug=function(logMsg,obj){this.internalLog(LogLevels.DEBUG,logMsg,obj)};ConsoleLogger.prototype.trace=function(logMsg,obj){this.internalLog(LogLevels.TRACE,logMsg,obj)};return ConsoleLogger}();exports.ConsoleLogger=ConsoleLogger})},{"../../../common/system-date":333,"../configuration-override":259}],272:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","./null-logger","./console-logger"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.LogFactory=void 0;var null_logger_1=require("./null-logger");var console_logger_1=require("./console-logger");var LogFactory=function(){function LogFactory(){}LogFactory.createLogger=function(className,logLevel){try{var logger=new console_logger_1.ConsoleLogger(logLevel);logger.withClass(className);return logger}catch(e){return null_logger_1.NullLogger.INSTANCE}};return LogFactory}();exports.LogFactory=LogFactory})},{"./console-logger":271,"./null-logger":273}],273:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.NullLogger=void 0;var NullLogger=function(){function NullLogger(){}NullLogger.prototype.fatal=function(logMsg,obj){};NullLogger.prototype.critical=function(logMsg,obj){};NullLogger.prototype.error=function(logMsg,obj){};NullLogger.prototype.warn=function(logMsg,obj){};NullLogger.prototype.info=function(logMsg,obj){};NullLogger.prototype.debug=function(logMsg,obj){};NullLogger.prototype.trace=function(logMsg,obj){};NullLogger.prototype.withClass=function(className){return NullLogger.INSTANCE};NullLogger.prototype.withMethod=function(methodName){return NullLogger.INSTANCE};NullLogger.prototype.withTx=function(tx){return NullLogger.INSTANCE};NullLogger.prototype.withComponent=function(componentName,componentVersion){return NullLogger.INSTANCE};NullLogger.prototype.withActivity=function(activityName){return NullLogger.INSTANCE};NullLogger.prototype.withProperty=function(propName,propValue){return NullLogger.INSTANCE};NullLogger.prototype.withProperties=function(objWithProperties,propNames){return NullLogger.INSTANCE};NullLogger.prototype.withLogLevel=function(level){return NullLogger.INSTANCE};NullLogger.INSTANCE=new NullLogger;return NullLogger}();exports.NullLogger=NullLogger})},{}],274:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","../entities/footprints-item-data","../delegate","../../../common/system-date"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.FootprintsItemsQueue=void 0;var footprints_item_data_1=require("../entities/footprints-item-data");var delegate_1=require("../delegate");var system_date_1=require("../../../common/system-date");var FootprintsItemsQueue=function(){function FootprintsItemsQueue(configuration){this.maxItemsInQueue=500;this.queueSize=0;this.queue=new Array;this.onQueueFull=new delegate_1.Delegate;this.isQueueFull=function(){return this.getCurrentQueueSize()>=this.maxItemsInQueue};if(!configuration)throw new Error("'configuration' cannot be null or undefined");this.enabled=configuration.enabled;this.maxItemsInQueue=configuration.maxItemsInQueue}FootprintsItemsQueue.prototype.setEnabled=function(isEnabled){isEnabled=!!isEnabled;if(isEnabled!==this.enabled){this.enabled=isEnabled}if(!isEnabled){this.queue=new Array}};FootprintsItemsQueue.prototype.getEnabled=function(){return this.enabled};FootprintsItemsQueue.prototype.enqueueItem=function(footprintsItem){if(!this.enabled){return}footprintsItem=footprintsItem||new footprints_item_data_1.FootprintsItemData;footprintsItem.localTime=system_date_1.getSystemDateValueOf();this.queue.push(footprintsItem);this.queueSize++;this.checkQueueSize()};FootprintsItemsQueue.prototype.checkQueueSize=function(){if(this.isQueueFull()){this.onQueueFull.fire()}};FootprintsItemsQueue.prototype.getCurrentQueueSize=function(){return this.queueSize};FootprintsItemsQueue.prototype.requeueItems=function(footprintsItems){if(!this.enabled){return}var context=this;footprintsItems.forEach(function(item){context.queue.push(item);context.queueSize+=1});this.checkQueueSize()};FootprintsItemsQueue.prototype.getQueueContentsAndEmptyQueue=function(){var returnedItems=this.queue;this.queue=new Array;this.queueSize=0;return returnedItems};return FootprintsItemsQueue}();exports.FootprintsItemsQueue=FootprintsItemsQueue})},{"../../../common/system-date":333,"../delegate":261,"../entities/footprints-item-data":265}],275:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","../../../common/utils/validation-utils"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Queue=void 0;var validation_utils_1=require("../../../common/utils/validation-utils");var Queue=function(){function Queue(onQueueFull){this.queue=[];this._maxItemsInQueue=Queue.DEFAULT_MAX_ITEMS_IN_QUEUE;validation_utils_1.ValidationUtils.verifyNotNullOrEmpty(onQueueFull,"onQueueFull");this.onQueueFull=onQueueFull}Queue.prototype.requeue=function(items){if(!items||!items.length){return}this.queue=items.concat(this.queue)};Queue.prototype.enqueue=function(item){this.queue.push(item);if(this._maxItemsInQueue===this.queue.length){this.onQueueFull.fire()}};Queue.prototype.getQueueSize=function(){return this.queue.length};Queue.prototype.dequeue=function(size){if(!size){size=this.queue.length}if(this.queue.length===0){return[]}if(size>this.queue.length){size=this.queue.length}var dequeuedItems=this.queue.splice(0,size);return dequeuedItems};Queue.prototype.clear=function(){this.queue=[]};Queue.prototype.on=function(event,listener){this.onQueueFull.addListener(listener);return this};Object.defineProperty(Queue.prototype,"maxItemsInQueue",{get:function(){return this._maxItemsInQueue},set:function(value){this._maxItemsInQueue=value},enumerable:false,configurable:true});Queue.DEFAULT_MAX_ITEMS_IN_QUEUE=1e3;return Queue}();exports.Queue=Queue})},{"../../../common/utils/validation-utils":337}],276:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","./http-response"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.HttpClient=void 0;var http_response_1=require("./http-response");var HttpClient=function(){function HttpClient(window,featureDetection,logger){this.window=window;this.featureDetection=featureDetection;this.logger=logger;if(window==null)throw new Error("'window' cannot be null or undefined");if(featureDetection==null)throw new Error("'featureDetection' cannot be null or undefined")}HttpClient.prototype.send=function(request,onSuccess,onError){if(!request.url)return;var url=request.url;var httpMethod=request.httpMethod;var httpRequest=new XMLHttpRequest;httpRequest.open(httpMethod,url,request.async);if(request.headers){for(var i=0;i<request.headers.length;i++){var header=request.headers[i];if(header&&header.name&&header.value){httpRequest.setRequestHeader(header.name,header.value)}}}httpRequest.onreadystatechange=function(){if(httpRequest.readyState===XMLHttpRequest.DONE){var httpResponse=new http_response_1.HttpResponse;httpResponse.statusCode=httpRequest.status;httpResponse.responseText=httpRequest.responseText;if(httpRequest.status===200){if(onSuccess){onSuccess(httpResponse)}}else{if(onError){onError(httpResponse)}}}};httpRequest.send(request.data)};return HttpClient}();exports.HttpClient=HttpClient})},{"./http-response":278}],277:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.HttpRequest=void 0;var HttpRequest=function(){function HttpRequest(){this.async=true}return HttpRequest}();exports.HttpRequest=HttpRequest})},{}],278:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.HttpResponse=void 0;var HttpResponse=function(){function HttpResponse(){}return HttpResponse}();exports.HttpResponse=HttpResponse})},{}],279:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","../../../../common/utils/validation-utils"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.JsonClientAdapter=void 0;var validation_utils_1=require("../../../../common/utils/validation-utils");var JsonClientAdapter=function(){function JsonClientAdapter(jsonClient,serverUrl){validation_utils_1.ValidationUtils.verifyNotNullOrEmpty(jsonClient,"jsonClient");validation_utils_1.ValidationUtils.verifyNotNullOrEmpty(serverUrl,"serverUrl");this.jsonClient=jsonClient;this.serverUrl=serverUrl}JsonClientAdapter.prototype.delete=function(body,urlPath,callback){throw new Error("'delete' not implemented yet")};JsonClientAdapter.prototype.get=function(urlPath,callback,isNotFoundAcceptable,async){if(isNotFoundAcceptable===void 0){isNotFoundAcceptable=true}if(async===void 0){async=false}urlPath=this.serverUrl+urlPath;var onSuccess=function(response){return callback(null,response,response.statusCode)};var onError=function(response){var error=new Error(response.responseText);callback(error,null,response.statusCode)};this.jsonClient.get(urlPath,onSuccess,onError,async)};JsonClientAdapter.prototype.put=function(requestData,urlPath,callback,async){if(async===void 0){async=true}throw new Error("'delete' not implemented yet")};JsonClientAdapter.prototype.post=function(requestData,urlPath,callback,async,contentType){if(async===void 0){async=true}urlPath=this.serverUrl+urlPath;var onSuccess=function(response){return callback(null,response,response.statusCode)};var onError=function(response){var error=new Error(response.responseText);callback(error,null,response.statusCode)};this.jsonClient.post(urlPath,requestData,onSuccess,onError,async,contentType)};JsonClientAdapter.prototype.postMultipart=function(requestData,urlPath,callback){throw new Error("'postMultipart' not implemented yet")};return JsonClientAdapter}();exports.JsonClientAdapter=JsonClientAdapter})},{"../../../../common/utils/validation-utils":337}],280:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","../http/http-request","../../../../common/http/contracts"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.JsonClient=void 0;var http_request_1=require("../http/http-request");var contracts_1=require("../../../../common/http/contracts");var JsonClient=function(){function JsonClient(httpClient,configuration,agentInstanceData){this.httpClient=httpClient;this.configuration=configuration;this.agentInstanceData=agentInstanceData;this.requestsInProgress=0;this.requestsInProgress=0}JsonClient.prototype.sendHttpRequest=function(request,onSuccess,onError,contentType){var context=this;try{this.requestsInProgress++;var httpRequest=new http_request_1.HttpRequest;httpRequest.headers=this.getHeaders(contentType);httpRequest.url=request.url;httpRequest.httpMethod=request.httpMethod;httpRequest.async=request.async;if(request.data!=null)httpRequest.data=JSON.stringify(request.data);this.httpClient.send(httpRequest,parseResponse,function(response){context.requestsInProgress--;if(onError!=null){onError(response)}})}catch(e){this.requestsInProgress--}function parseResponse(jsonResponse){try{var object=void 0;context.requestsInProgress--;if(jsonResponse&&jsonResponse.responseText&&jsonResponse.responseText!=""){object=JSON.parse(jsonResponse.responseText)}else{object=jsonResponse}if(onSuccess!=null){onSuccess(object)}}catch(e){if(onError!=null){jsonResponse.responseText="Failed parsing response. Response: '"+jsonResponse.responseText+"'";onError(jsonResponse)}}}}
27
27
  ;JsonClient.prototype.post=function(url,data,onSuccess,onError,async,contentType){if(async===void 0){async=true}this.send(url,data,onSuccess,onError,async,"POST",contentType)};JsonClient.prototype.get=function(url,onSuccess,onError,async,data){if(async===void 0){async=true}this.send(url,data,onSuccess,onError,async,"GET")};JsonClient.prototype.send=function(url,data,onSuccess,onError,async,httpMethod,contentType){if(async===void 0){async=true}var request=new http_request_1.HttpRequest;request.url=url;request.data=data;request.httpMethod=httpMethod;request.async=async;this.sendHttpRequest(request,onSuccess,onError,contentType)};JsonClient.prototype.hasRequestsInProgress=function(){return this.requestsInProgress>0};JsonClient.prototype.getHeaders=function(contentType){var _a,_b;var headers=[{name:"Content-Type",value:contentType||contracts_1.ContentType.JSON}];headers.push({name:"sl-metadata",value:JSON.stringify(this.getSlMetadataHeaders())});if((_a=this===null||this===void 0?void 0:this.configuration)===null||_a===void 0?void 0:_a.token){headers.push({name:"Authorization",value:"Bearer "+((_b=this===null||this===void 0?void 0:this.configuration)===null||_b===void 0?void 0:_b.token)})}return headers};JsonClient.prototype.getSlMetadataHeaders=function(){var _a;return{agentId:this.agentInstanceData.agentId,buildSessionId:(_a=this.configuration)===null||_a===void 0?void 0:_a.buildSessionId,agentType:"browser"}};return JsonClient}();exports.JsonClient=JsonClient})},{"../../../../common/http/contracts":325,"../http/http-request":277}],281:[function(require,module,exports){var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(Object.prototype.hasOwnProperty.call(b,p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","./json-client","../../logger/log-factory"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.NoopJsonClient=void 0;var json_client_1=require("./json-client");var log_factory_1=require("../../logger/log-factory");var NoopJsonClient=function(_super){__extends(NoopJsonClient,_super);function NoopJsonClient(){var _this=_super!==null&&_super.apply(this,arguments)||this;_this.logger=log_factory_1.LogFactory.createLogger("NoopJsonClient");return _this}NoopJsonClient.prototype.send=function(url,data,onSuccess,onError,async,httpMethod,contentType){if(async===void 0){async=true}this.logger.info("noop json client not executing http request for url '"+url);onSuccess({})};return NoopJsonClient}(json_client_1.JsonClient);exports.NoopJsonClient=NoopJsonClient})},{"../../logger/log-factory":272,"./json-client":280}],282:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.LightBackendProxy=void 0;var LightBackendProxy=function(){function LightBackendProxy(configuration,jsonClient,logger){this.configuration=configuration;this.jsonClient=jsonClient;this.logger=logger}LightBackendProxy.prototype.submitRequest=function(request,onSuccess,onError,async){if(async===void 0){async=true}var url=this.createServerUrl(this.configuration);this.jsonClient.post(url,request,onSuccess,onError,async)};LightBackendProxy.prototype.hasRequestsInProgress=function(){return this.jsonClient.hasRequestsInProgress()};LightBackendProxy.prototype.getRequestsInProgressCount=function(){return this.jsonClient.requestsInProgress};LightBackendProxy.prototype.getSlMappingFromServer=function(buildSessionId){var _this=this;var url=[this.configuration.server,"v1","agents","blobs",buildSessionId].join("/")+"?view=concatJson";url=encodeURI(url);return new Promise(function(resolve,reject){_this.jsonClient.get(url,resolve,reject,false)})};LightBackendProxy.prototype.createServerUrl=function(configuration){if(configuration.token){var apiVersion=configuration.resolveWithoutHash?"/v5":"/v3";return configuration.server+apiVersion+"/agents/footprints/"}return configuration.server+"/v1/testfootprints/"};return LightBackendProxy}();exports.LightBackendProxy=LightBackendProxy})},{}],283:[function(require,module,exports){var __assign=this&&this.__assign||function(){__assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)if(Object.prototype.hasOwnProperty.call(s,p))t[p]=s[p]}return t};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};var __generator=this&&this.__generator||function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}};(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","../../common/agent-events/cockpit-notifier"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.SlMappingLoader=void 0;var cockpit_notifier_1=require("../../common/agent-events/cockpit-notifier");var SlMappingLoader=function(){function SlMappingLoader(lightBackendProxy,window,logger){this.lightBackendProxy=lightBackendProxy;this.window=window;this.logger=logger}SlMappingLoader.prototype.loadSlMapping=function(buildSessionId){return __awaiter(this,void 0,void 0,function(){var flatted_1,slMappingArr,err_1,errMsg;return __generator(this,function(_a){switch(_a.label){case 0:this.window.slMappings=this.window.slMappings||{};if(!!this.window.slMappings[buildSessionId])return[3,4];_a.label=1;case 1:_a.trys.push([1,3,,4]);flatted_1={};return[4,this.lightBackendProxy.getSlMappingFromServer(buildSessionId)];case 2:slMappingArr=_a.sent();slMappingArr.forEach(function(mapping){flatted_1=__assign(__assign({},flatted_1),mapping)});this.window.slMappings[buildSessionId]=flatted_1;return[3,4];case 3:err_1=_a.sent();errMsg="Error while trying to load slMapping from server '"+err_1+"'";this.logger.error(errMsg);cockpit_notifier_1.CockpitNotifier.sendGenericMessage(errMsg);this.window.slMappings[buildSessionId]={};return[3,4];case 4:return[2]}})})};return SlMappingLoader}();exports.SlMappingLoader=SlMappingLoader})},{"../../common/agent-events/cockpit-notifier":294}],284:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","./delegate","./contracts"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.StateTracker=void 0;var delegate_1=require("./delegate");var contracts_1=require("./contracts");var StateTracker=function(){function StateTracker(configuration,jsonClient,watchdog,logger){var _this=this;this.configuration=configuration;this.jsonClient=jsonClient;this.watchdog=watchdog;this.logger=logger;this.colorChanged=new delegate_1.Delegate;this.setCurrentTestIdentifier(StateTracker.ANONYMOUS_FOOTPRINTS_COLOR);this.watchdog.addOnAlarmListener(function(){_this.checkForActiveExecution()});this.checkForActiveExecution(false);this.watchdog.start()}StateTracker.prototype.setCurrentTestIdentifier=function(newColorOnWindow){if(newColorOnWindow!=null){if(newColorOnWindow!=StateTracker.ANONYMOUS_FOOTPRINTS_COLOR){this.stopWatchdog()}else{this.startWatchdog()}if(newColorOnWindow!=this.currentColorOnWindow){this.currentColorOnWindow=newColorOnWindow;this.colorChanged.fire()}}else if(this.currentColorOnWindow!=null&&newColorOnWindow==null){this.currentColorOnWindow=null;this.colorChanged.fire()}};StateTracker.prototype.getCurrentTestIdentifier=function(){return this.currentColorOnWindow};StateTracker.prototype.addOnColorChangedListener=function(listener){this.colorChanged.addListener(listener)};StateTracker.prototype.getCurrentColor=function(){return this.currentColorOnWindow};StateTracker.prototype.checkForActiveExecution=function(async){var _this=this;if(async===void 0){async=true}var url=this.configuration.server+("/v4/testExecution/"+this.configuration.labId);this.logger.info("[TO TST] - checkMappingStatus. Url '"+url+"'.");var onSuccess=function(data){_this.logger.info("[ACTIVE EXECUTION] Checking for active execution. No errors");if(data==null){_this.logger.warn("[ACTIVE EXECUTION] Received empty response. not sending footprints.");_this.hasActiveExecution=false;return}if(data.execution==null){_this.logger.info("[ACTIVE EXECUTION] Couldn't find active execution. not sending footprints.");_this.hasActiveExecution=false}else if(data.execution.status==contracts_1.ExecutionStatus.Ending){_this.logger.info("[ACTIVE EXECUTION] Execution is pending delete. sending last footprints");_this.hasActiveExecution=true}else if(data.execution.status==contracts_1.ExecutionStatus.InProgress){_this.logger.info("[ACTIVE EXECUTION] Active execution for labid '"+_this.configuration.labId+"'");_this.hasActiveExecution=true}else{_this.logger.warn("[ACTIVE EXECUTION] Unexpected status. status: ",data.execution.status);_this.hasActiveExecution=false}};var onError=function(response){_this.logger.error("[ACTIVE EXECUTION] Error checking for active execution: %s",response.responseText);_this.hasActiveExecution=false};this.jsonClient.get(url,onSuccess,onError,async)};StateTracker.prototype.shouldCollectFootprints=function(){if(this.getCurrentColor()==null){this.logger.info("Current test identifier is null, should not collect footprints");return false}if(this.getCurrentColor()!=StateTracker.ANONYMOUS_FOOTPRINTS_COLOR){this.logger.info("Not in anonymous footprints, should collect footprints");return true}if(this.hasActiveExecution){this.logger.info("Has active execution, should collect footprints");return true}this.logger.info("No active execution, should not collect footprints");return false};StateTracker.prototype.setActiveExecution=function(value){this.hasActiveExecution=value};StateTracker.prototype.stopWatchdog=function(){if(this.watchdog.getStatus().running){this.watchdog.stop()}};StateTracker.prototype.startWatchdog=function(){if(!this.watchdog.getStatus().running){this.watchdog.start()}};StateTracker.ANONYMOUS_FOOTPRINTS_COLOR="00000000-0000-0000-0000-000000000000/__init";return StateTracker}();exports.StateTracker=StateTracker})},{"./contracts":260,"./delegate":261}],285:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.TestStateHelper=void 0;var TestStateHelper=function(){function TestStateHelper(){this.combineExecutionIdAndTestName=function(executionId,testName){testName=testName||"";if(!executionId)return"";return executionId+"/"+testName};this.splitTestIdToExecutionAndTestName=function(testId){testId=testId||"";var executionId=testId.split("/")[0];var testName=testId.indexOf("/")==-1?"":testId.substring(executionId.length+1);if(!executionId)testName="";return{executionId:executionId,testName:testName}}}return TestStateHelper}();exports.TestStateHelper=TestStateHelper})},{}],286:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","path"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Utils=void 0;var path=require("path");var Utils=function(){function Utils(){}Utils.adjustPathSlashes=function(path){path=(path||"").replace(/\\/g,"/");return path};Utils.getRelativeModulePath=function(path,workspacepath){workspacepath=Utils.adjustPathSlashes(workspacepath);path=Utils.adjustPathSlashes(path);if(workspacepath){return path.replace(workspacepath,"")}return path};Utils.resolveOriginalFullFileName=function(fullPath,originalFilename){if(path.isAbsolute(originalFilename)){return originalFilename}var generatedDir=path.dirname(fullPath);originalFilename=path.resolve(generatedDir,originalFilename);return originalFilename};Utils.parseBooleanValue=function(value){if(value&&typeof value=="boolean"){return value}if(value&&typeof value=="string"){return value.toLowerCase()=="true"}return false};return Utils}();exports.Utils=Utils})},{path:171}],287:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","./delegate"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Watchdog=void 0;var delegate_1=require("./delegate");var Watchdog=function(){function Watchdog(timeout,timersWrapper,options,logger){this.timeout=timeout;this.timersWrapper=timersWrapper;this.options=options;this.logger=logger;this.handle=null;this.alarm=new delegate_1.Delegate;this.context=this;this.stopped=false;this.options=options||{}}Watchdog.prototype.abortTimer=function(){if(this.handle){this.timersWrapper.clearTimeout(this.handle);this.handle=null}};Watchdog.prototype.fireAlarm=function(){this.handle=null;try{this.alarm.fire()}catch(e){this.logger.error("Alarm caught an exception: ",e)}if(this.options.autoReset){this.context.reset()}};Watchdog.prototype.addOnAlarmListener=function(listener){this.alarm.addListener(listener)};Watchdog.prototype.reset=function(){var _this=this;this.abortTimer();if(!this.stopped){this.handle=this.timersWrapper.setTimeout(function(){_this.fireAlarm()},this.timeout)}};Watchdog.prototype.stop=function(){this.stopped=true;this.abortTimer()};Watchdog.prototype.start=function(){this.stopped=false;this.reset()};Watchdog.prototype.getStatus=function(){return{running:!this.stopped}};Watchdog.prototype.on=function(event,listener){this.addOnAlarmListener(listener)};Watchdog.prototype.startIfNotRunning=function(){if(this.stopped||!this.handle){this.start()}};Watchdog.prototype.setInterval=function(newInterval){if(newInterval<=0)throw new Error("Invalid value for interval: "+newInterval);this.timeout=newInterval};return Watchdog}();exports.Watchdog=Watchdog})},{"./delegate":261}],288:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.WindowTimersWrapper=void 0;var WindowTimersWrapper=function(){function WindowTimersWrapper(window){this.window=window;if(!this.window)throw new Error("'window' cannot be null or undefined")}WindowTimersWrapper.prototype.clearInterval=function(handle){this.window.clearInterval(handle)};WindowTimersWrapper.prototype.clearTimeout=function(handle){this.window.clearTimeout(handle)};WindowTimersWrapper.prototype.setInterval=function(handler,timeout){var args=[];for(var _i=2;_i<arguments.length;_i++){args[_i-2]=arguments[_i]}return this.window.setInterval(handler,timeout,args)};WindowTimersWrapper.prototype.setTimeout=function(handler,timeout){var args=[];for(var _i=2;_i<arguments.length;_i++){args[_i-2]=arguments[_i]}return this.window.setTimeout(handler,timeout,args)};return WindowTimersWrapper}();exports.WindowTimersWrapper=WindowTimersWrapper})},{}],289:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Technology=exports.AgentEventCode=exports.AgentType=void 0;var AgentType;(function(AgentType){AgentType["BUILD_SCANNER"]="BuildScanner";AgentType["TEST_LISTENER"]="TestListener";AgentType["PRODUCTION_LISTENER"]="ProductionListener";AgentType["BROWSER_AGENT"]="BrowserAgent";AgentType["SLNODEJS"]="slnodejs"})(AgentType=exports.AgentType||(exports.AgentType={}));var AgentEventCode;(function(AgentEventCode){AgentEventCode[AgentEventCode["GENERIC_AGENT_EVENT"]=1e3]="GENERIC_AGENT_EVENT";AgentEventCode[AgentEventCode["AGENT_STARTED"]=1001]="AGENT_STARTED";AgentEventCode[AgentEventCode["AGENT_SHUTDOWN"]=1002]="AGENT_SHUTDOWN";AgentEventCode[AgentEventCode["AGENT_PING"]=1003]="AGENT_PING";AgentEventCode[AgentEventCode["AGENT_CONFIG_CHANGED"]=1004]="AGENT_CONFIG_CHANGED";AgentEventCode[AgentEventCode["FIRST_COVERAGE_INSTRUMENTATION_PERFORMED"]=1005]="FIRST_COVERAGE_INSTRUMENTATION_PERFORMED";AgentEventCode[AgentEventCode["FIRST_TIME_HAS_EXECUTION"]=1006]="FIRST_TIME_HAS_EXECUTION";AgentEventCode[AgentEventCode["FIRST_TIME_NO_EXECUTION"]=1007]="FIRST_TIME_NO_EXECUTION";AgentEventCode[AgentEventCode["AGENT_MUTED"]=1008]="AGENT_MUTED";AgentEventCode[AgentEventCode["AGENT_UNMUTED"]=1009]="AGENT_UNMUTED";AgentEventCode[AgentEventCode["FIRST_TIME_COLLECTED_FP"]=1010]="FIRST_TIME_COLLECTED_FP";AgentEventCode[AgentEventCode["GENERIC_MESSAGE"]=2e3]="GENERIC_MESSAGE";AgentEventCode[AgentEventCode["GENERIC_MESSAGE_SUPERUSER"]=2999]="GENERIC_MESSAGE_SUPERUSER";AgentEventCode[AgentEventCode["WARN"]=3e3]="WARN";AgentEventCode[AgentEventCode["AGENT_DID_NOT_SHUTDOWN"]=3001]="AGENT_DID_NOT_SHUTDOWN";AgentEventCode[AgentEventCode["GENERIC_WARNING_SUPERUSER"]=3999]="GENERIC_WARNING_SUPERUSER";AgentEventCode[AgentEventCode["GENERIC_ERROR"]=4e3]="GENERIC_ERROR";AgentEventCode[AgentEventCode["DUPLICATE_MODULE"]=4001]="DUPLICATE_MODULE";AgentEventCode[AgentEventCode["DATA_PROCESSOR_NO_EXECUTIONS"]=4002]="DATA_PROCESSOR_NO_EXECUTIONS";AgentEventCode[AgentEventCode["DATA_PROCESSOR_INVALID_FORMAT"]=4003]="DATA_PROCESSOR_INVALID_FORMAT";AgentEventCode[AgentEventCode["DATA_PROCESSOR_EMPTY_DATA"]=4004]="DATA_PROCESSOR_EMPTY_DATA";AgentEventCode[AgentEventCode["BUILD_MAP_SUBMISSION_ERROR"]=4005]="BUILD_MAP_SUBMISSION_ERROR";AgentEventCode[AgentEventCode["FOOTPRINTS_SUBMISSION_ERROR"]=4006]="FOOTPRINTS_SUBMISSION_ERROR";AgentEventCode[AgentEventCode["TEST_EVENTS_SUBMISSION_ERROR"]=4007]="TEST_EVENTS_SUBMISSION_ERROR";AgentEventCode[AgentEventCode["EXTERNAL_DATA_PROCESSOR_SUBMISSION_ERROR"]=4008]="EXTERNAL_DATA_PROCESSOR_SUBMISSION_ERROR";AgentEventCode[AgentEventCode["UNSUPPORTED_OS"]=4009]="UNSUPPORTED_OS";AgentEventCode[AgentEventCode["UNSUPPORTED_RUNTIME"]=4010]="UNSUPPORTED_RUNTIME";AgentEventCode[AgentEventCode["THIRD_PARTY_PACKAGE_DETECTED"]=4011]="THIRD_PARTY_PACKAGE_DETECTED";AgentEventCode[AgentEventCode["THIRD_PARTY_FILE_DETECTED"]=4012]="THIRD_PARTY_FILE_DETECTED";AgentEventCode[AgentEventCode["OTEL_ERROR"]=4013]="OTEL_ERROR";AgentEventCode[AgentEventCode["FOOTPRINTS_LOSS"]=4999]="FOOTPRINTS_LOSS";AgentEventCode[AgentEventCode["LEAST_VERBOSE_LOG"]=5001]="LEAST_VERBOSE_LOG";AgentEventCode[AgentEventCode["MOST_VERBOSE_LOG"]=5999]="MOST_VERBOSE_LOG"})(AgentEventCode=exports.AgentEventCode||(exports.AgentEventCode={}));var Technology;(function(Technology){Technology["NODEJS"]="nodejs";Technology["BROWSER"]="browser"})(Technology=exports.Technology||(exports.Technology={}))})},{}],290:[function(require,module,exports){var __assign=this&&this.__assign||function(){__assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)if(Object.prototype.hasOwnProperty.call(s,p))t[p]=s[p]}return t};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};var __generator=this&&this.__generator||function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}};var __spreadArrays=this&&this.__spreadArrays||function(){for(var s=0,i=0,il=arguments.length;i<il;i++)s+=arguments[i].length;for(var r=Array(s),k=0,i=0;i<il;i++)for(var a=arguments[i],j=0,jl=a.length;j<jl;j++,k++)r[k]=a[j];return r};(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","./agent-events-conracts","./agent-instance-info-builder","./machine-info-builder","./nodejs-env-info-builder","./agent-start-info-builder","./ci-info-builder","../http/backend-proxy","../utils/validation-utils","../watchdog","../system-date"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.AgentEventsController=void 0;var agent_events_conracts_1=require("./agent-events-conracts");var agent_instance_info_builder_1=require("./agent-instance-info-builder");var machine_info_builder_1=require("./machine-info-builder");var nodejs_env_info_builder_1=require("./nodejs-env-info-builder");var agent_start_info_builder_1=require("./agent-start-info-builder");var ci_info_builder_1=require("./ci-info-builder");var backend_proxy_1=require("../http/backend-proxy");var validation_utils_1=require("../utils/validation-utils");var watchdog_1=require("../watchdog");var system_date_1=require("../system-date");var AgentEventsController=function(){function AgentEventsController(agentConfig,agentInstanceData,logger,backendProxy,tool,tags){this.active=false;validation_utils_1.ValidationUtils.verifyNotNullOrEmpty(agentConfig,"agentConfig");validation_utils_1.ValidationUtils.verifyNotNullOrEmpty(agentInstanceData,"agentInstanceData");validation_utils_1.ValidationUtils.verifyNotNullOrEmpty(logger,"logger");this._agentConfig=agentConfig;this._logger=logger;this._agentInstanceData=agentInstanceData;this.shutDownRetries=0;this.backendProxy=backendProxy||this.createBackendProxy();this.addTags(tags);this.addTool(tool);this.initWatchdog();this.submittedEventsMap=new Map}AgentEventsController.prototype.submitAgentStartedEvent=function(packageJsonFile){return __awaiter(this,void 0,void 0,function(){var event,result;return __generator(this,function(_a){switch(_a.label){case 0:this.active=true;this.startRequestStatus=StartRequestStatus.PENDING;event=this.buildAgentStartEvent(packageJsonFile||{});return[4,this.submitAgentEventRequest(event)];case 1:result=_a.sent();this.startRequestStatus=result?StartRequestStatus.SUCCEED:StartRequestStatus.FAILED;if(this.startRequestStatus!==StartRequestStatus.SUCCEED){this._logger.info("Agent start event failed to submit - ping events will not be sent")}else{this._pingWatchdog.start()}return[2]}})})};AgentEventsController.prototype.submitAgentEventRequest=function(event){return __awaiter(this,void 0,void 0,function(){var request,e_1;return __generator(this,function(_a){switch(_a.label){case 0:if(!this.active){this._logger.debug("Agent not active - not submitting event");return[2,false]}request={agentId:this._agentInstanceData.agentId,events:Array.isArray(event)?event:[event],appName:this._agentConfig.appName.value,buildSessionId:this._agentConfig.buildSessionId.value};_a.label=1;case 1:_a.trys.push([1,3,,4]);return[4,this.backendProxy.submitAgentEvent(request)];case 2:_a.sent();this._logger.info("Submitted '"+request.events.length+"' events successfully");return[2,true];case 3:e_1=_a.sent();this._logger.warn("Failed to submit '"+request.events.length+"' events. Error "+e_1);return[2,false];case 4:return[2]}})})};AgentEventsController.prototype.buildAgentStartEvent=function(packageJsonFile){var agentInstanceInfoBuilder=new agent_instance_info_builder_1.AgentInstanceInfoBuilder(this);var machineInfoBuilder=new machine_info_builder_1.MachineInfoBuilder;var dependencies=__assign(__assign({},packageJsonFile.dependencies),packageJsonFile.devDependencies);var nodejsEnvInfoBuilder=new nodejs_env_info_builder_1.NodejsEnvInfoBuilder(dependencies);var ciInfoBuilder=new ci_info_builder_1.CiInfoBuilder;var agentStartInfoBuilder=new agent_start_info_builder_1.AgentStartInfoBuilder(agentInstanceInfoBuilder,machineInfoBuilder,nodejsEnvInfoBuilder,ciInfoBuilder);var agentStartInfo=agentStartInfoBuilder.build();return this.buildEvent(agent_events_conracts_1.AgentEventCode.AGENT_STARTED,agentStartInfo)};AgentEventsController.prototype.buildAgentShutdownEvent=function(){return this.buildEvent(agent_events_conracts_1.AgentEventCode.AGENT_SHUTDOWN)};AgentEventsController.prototype.submitAgentShutdownEvent=function(){return __awaiter(this,void 0,void 0,function(){var event,result;var _this=this;return __generator(this,function(_a){switch(_a.label){case 0:this.shutDownRetries++;if(this.startRequestStatus==StartRequestStatus.FAILED){this._logger.debug("Agent start not submitted - not sending shut down events");return[2]}if(this.shutDownRetries>AgentEventsController.MAX_SHUTDOWN_RETRIES){this._logger.debug("Stop trying to send shutdown event after 60 seconds ");return[2]}this._pingWatchdog.stop();event=this.buildAgentShutdownEvent();if(!(this.startRequestStatus==StartRequestStatus.PENDING))return[3,1];setTimeout(function(){return _this.submitAgentShutdownEvent.call(_this)},1e3);return[3,3];case 1:return[4,this.submitAgentEventRequest(event)];case 2:result=_a.sent();this.active=false;return[2,result];case 3:return[2]}})})};AgentEventsController.prototype.submitPingEvent=function(){return this.submitEvent(agent_events_conracts_1.AgentEventCode.AGENT_PING,{agentInfo:{labId:this.agentConfig.labId.value}})};AgentEventsController.prototype.submitEvent=function(code,data){var _this=this;this.submittedEventsMap.set(code,true);this._logger.debug("About to send event with code '"+code+"', current time: "+system_date_1.getSystemDateValueOf());var event=this.buildEvent(code,data);this.submitAgentEventRequest(event).then(function(){return _this._logger.debug("Event with code '"+code+"' submitted successfully")})};AgentEventsController.prototype.submitEventOnce=function(code){if(!this.submittedEventsMap.get(code)){this.submitEvent(code)}};AgentEventsController.prototype.submitGenericMessage=function(message){this.sendMessage(message,agent_events_conracts_1.AgentEventCode.GENERIC_MESSAGE)};AgentEventsController.prototype.submitWarning=function(message){this.sendMessage(message,agent_events_conracts_1.AgentEventCode.WARN)};AgentEventsController.prototype.submitError=function(message){this.sendMessage(message,agent_events_conracts_1.AgentEventCode.GENERIC_ERROR)};AgentEventsController.prototype.submitErrorsBatch=function(messages){var _this=this;if(!messages||!messages.length){return}var events=messages.map(function(msg){return _this.buildEvent(agent_events_conracts_1.AgentEventCode.GENERIC_ERROR,msg)});this.submitAgentEventRequest(events).then(function(){return _this.logger.debug("'"+events.length+"' events were submitted successfully")})};AgentEventsController.prototype.sendMessage=function(message,code){var _this=this;this.logger.debug("About to send message '"+message+"' with code '"+code+"', current time: "+system_date_1.getSystemDateValueOf());var messageEvent=this.buildEvent(code,message);this.submitAgentEventRequest(messageEvent).then(function(){return _this.logger.debug("Message submitted successfully")})};AgentEventsController.prototype.submitConfigChanged=function(){var _this=this;var messageEvent=this.buildEvent(agent_events_conracts_1.AgentEventCode.AGENT_CONFIG_CHANGED,this._agentConfig.toJsonObject());this.submitAgentEventRequest(messageEvent).then(function(){return _this.logger.debug("Config changed event submitted successfully")})};Object.defineProperty(AgentEventsController.prototype,"watchdog",{get:function(){return this._pingWatchdog},enumerable:false,configurable:true});Object.defineProperty(AgentEventsController.prototype,"agentConfig",{get:function(){return this._agentConfig},enumerable:false,configurable:true});Object.defineProperty(AgentEventsController.prototype,"logger",{get:function(){return this._logger},enumerable:false,configurable:true});Object.defineProperty(AgentEventsController.prototype,"tools",{get:function(){return this._tools},enumerable:false,configurable:true})
28
28
  ;AgentEventsController.prototype.resolveTags=function(){return this._tags||[]};AgentEventsController.prototype.addTags=function(tags){if(!tags)return;this._tags=__spreadArrays(this._tags||[],tags||[])};AgentEventsController.prototype.addTool=function(tollInfo){if(!tollInfo)return;this._tools=this._tools||[];this._tools.push(tollInfo)};AgentEventsController.prototype.createBackendProxy=function(){var httpConfig={token:this._agentConfig.token.value,proxy:this._agentConfig.proxy.value,server:this._agentConfig.server.value,compressRequests:this._agentConfig.gzip.value};return new backend_proxy_1.BackendProxy(this._agentInstanceData,httpConfig,this._logger)};AgentEventsController.prototype.initWatchdog=function(){var watchdogOptions={interval:AgentEventsController.PING_INTERVAL,name:"AgentEventsWatchdog",autoReset:true,unref:true};var timers=this.getTimers();this._pingWatchdog=new watchdog_1.Watchdog(watchdogOptions,timers);this._pingWatchdog.on("alarm",this.submitPingEvent.bind(this))};AgentEventsController.prototype.getTimers=function(){if(this._agentInstanceData.technology===agent_events_conracts_1.Technology.BROWSER){return{setTimeout:setTimeout.bind(window),clearTimeout:clearTimeout.bind(window)}}else{return{setTimeout:setTimeout,clearTimeout:clearTimeout}}};AgentEventsController.prototype.buildEvent=function(type,data){return{type:type,utcTimestamp_ms:system_date_1.getSystemDateValueOf(),data:data}};Object.defineProperty(AgentEventsController.prototype,"agentInstanceData",{get:function(){return this._agentInstanceData},enumerable:false,configurable:true});AgentEventsController.PING_INTERVAL=2*60*1e3;AgentEventsController.MAX_SHUTDOWN_RETRIES=60;return AgentEventsController}();exports.AgentEventsController=AgentEventsController;var StartRequestStatus;(function(StartRequestStatus){StartRequestStatus["FAILED"]="failed";StartRequestStatus["SUCCEED"]="succeed";StartRequestStatus["PENDING"]="pending"})(StartRequestStatus||(StartRequestStatus={}))})},{"../http/backend-proxy":324,"../system-date":333,"../utils/validation-utils":337,"../watchdog":338,"./agent-events-conracts":289,"./agent-instance-info-builder":291,"./agent-start-info-builder":292,"./ci-info-builder":293,"./machine-info-builder":296,"./nodejs-env-info-builder":297}],291:[function(require,module,exports){(function(process){(function(){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","./sensitive-data-filter"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.AgentInstanceInfoBuilder=void 0;var sensitive_data_filter_1=require("./sensitive-data-filter");var SEALIGHTS_ENV_VAR_PREFIX="SL_";var AgentInstanceInfoBuilder=function(){function AgentInstanceInfoBuilder(agentEventsController){this.sendsPing=true;this.agentConfig=agentEventsController.agentConfig;this.agentId=agentEventsController.agentInstanceData.agentId;this.agentType=agentEventsController.agentInstanceData.agentType;this.tags=agentEventsController.resolveTags();this.tools=agentEventsController.tools;this.logger=agentEventsController.logger;this.technology=agentEventsController.agentInstanceData.technology;this.info={agentId:agentEventsController.agentInstanceData.agentId,agentType:agentEventsController.agentInstanceData.agentType,agentVersion:agentEventsController.agentInstanceData.agentVersion,technology:agentEventsController.agentInstanceData.technology}}AgentInstanceInfoBuilder.prototype.fillData=function(){this.info.tags=this.tags;this.info.tools=this.tools;this.info.technology=this.technology;this.info.sendsPing=this.sendsPing;this.fillFromAgentConfig();this.fillFromProcessObject()};AgentInstanceInfoBuilder.prototype.build=function(){this.fillData();return this.info};AgentInstanceInfoBuilder.prototype.fillFromAgentConfig=function(){this.info.buildSessionId=this.agentConfig.buildSessionId.value;this.info.labId=this.agentConfig.labId.value||this.agentConfig.buildSessionId.value;this.info.testStage=this.agentConfig.testStage.value;this.info.agentConfig=this.agentConfig.toJsonObject()};AgentInstanceInfoBuilder.prototype.fillFromProcessObject=function(){this.info.processId=process.pid;this.info.processArch=process.arch;this.info.argv=process.argv;this.info.cwd=process.cwd();this.info.envVars=this.extractSealightsEnvVars()};AgentInstanceInfoBuilder.prototype.extractSealightsEnvVars=function(){var _this=this;var slEnvVars={};Object.keys(process.env).forEach(function(key){if(key.indexOf(SEALIGHTS_ENV_VAR_PREFIX)===0||key==="NODE_OPTIONS"){slEnvVars[key]=sensitive_data_filter_1.isSensitive(key,process.env[key],_this.logger)?AgentInstanceInfoBuilder.SECRET_VALUE_PLACEHOLDER:process.env[key]}});return slEnvVars};AgentInstanceInfoBuilder.DEFAULT_BROWSER_AGENT_VERSION="1.0.0";AgentInstanceInfoBuilder.SEALIGHTS_WINDOW_OBJECT="$Sealights";AgentInstanceInfoBuilder.SECRET_VALUE_PLACEHOLDER="********";return AgentInstanceInfoBuilder}();exports.AgentInstanceInfoBuilder=AgentInstanceInfoBuilder})}).call(this)}).call(this,require("_process"))},{"./sensitive-data-filter":298,_process:179}],292:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.AgentStartInfoBuilder=void 0;var AgentStartInfoBuilder=function(){function AgentStartInfoBuilder(agentInstanceInfoBuilder,machineInfoBuilder,techSpecificInfoBuilder,ciInfoBuilder){this.agentInstanceInfoBuilder=agentInstanceInfoBuilder;this.machineInfoBuilder=machineInfoBuilder;this.techSpecificInfoBuilder=techSpecificInfoBuilder;this.ciInfoBuilder=ciInfoBuilder}AgentStartInfoBuilder.prototype.fillData=function(){};AgentStartInfoBuilder.prototype.build=function(){return{agentInfo:this.agentInstanceInfoBuilder.build(),machineInfo:this.machineInfoBuilder.build(),techSpecificInfo:this.techSpecificInfoBuilder.build(),ciInfo:this.ciInfoBuilder.build()}};return AgentStartInfoBuilder}();exports.AgentStartInfoBuilder=AgentStartInfoBuilder})},{}],293:[function(require,module,exports){(function(process){(function(){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.CiInfoBuilder=void 0;var JENKINS_JOB_NAME_ENV="JOB_NAME";var JENKINS_JOB_ID_ENV="BUILD_ID";var JENKINS_JOB_URL_ENV="BUILD_URL";var CiInfoBuilder=function(){function CiInfoBuilder(){this.info={}}CiInfoBuilder.prototype.fillData=function(){if(this.isJenkins()){this.info.jobId=process.env[JENKINS_JOB_ID_ENV];this.info.jobName=process.env[JENKINS_JOB_NAME_ENV];this.info.jobUrl=process.env[JENKINS_JOB_URL_ENV]}};CiInfoBuilder.prototype.isJenkins=function(){return process.env[JENKINS_JOB_ID_ENV]&&process.env[JENKINS_JOB_NAME_ENV]&&process.env[JENKINS_JOB_URL_ENV]};CiInfoBuilder.prototype.build=function(){this.fillData();return this.info};return CiInfoBuilder}();exports.CiInfoBuilder=CiInfoBuilder})}).call(this)}).call(this,require("_process"))},{_process:179}],294:[function(require,module,exports){var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};var __generator=this&&this.__generator||function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}};(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","./agent-events-controller","./dry-run-agent-events-controller"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.CockpitNotifier=void 0;var agent_events_controller_1=require("./agent-events-controller");var dry_run_agent_events_controller_1=require("./dry-run-agent-events-controller");var CockpitNotifier=function(){function CockpitNotifier(){}CockpitNotifier.notifyStart=function(agentConfig,agentInstanceData,logger,packageJsonFile,backendProxy,tool,tags){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:CockpitNotifier.controller=new agent_events_controller_1.AgentEventsController(agentConfig,agentInstanceData,logger,backendProxy,tool,tags);return[4,CockpitNotifier.controller.submitAgentStartedEvent(packageJsonFile)];case 1:_a.sent();return[2]}})})};CockpitNotifier.notifyShutdown=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:CockpitNotifier.verifyControllerInitialized();return[4,CockpitNotifier.controller.submitAgentShutdownEvent()];case 1:_a.sent();return[2]}})})};CockpitNotifier.sendGenericMessage=function(message){CockpitNotifier.verifyControllerInitialized();CockpitNotifier.controller.submitGenericMessage(message)};CockpitNotifier.sendWarning=function(message){CockpitNotifier.verifyControllerInitialized();CockpitNotifier.controller.submitWarning(message)};CockpitNotifier.sendError=function(message){CockpitNotifier.verifyControllerInitialized();CockpitNotifier.controller.submitError(message)};CockpitNotifier.sendErrorsBatch=function(messages){CockpitNotifier.verifyControllerInitialized();CockpitNotifier.controller.submitErrorsBatch(messages)};CockpitNotifier.sendEvent=function(code,data){CockpitNotifier.verifyControllerInitialized();CockpitNotifier.controller.submitEvent(code,data)};CockpitNotifier.sendEventOnce=function(code){CockpitNotifier.verifyControllerInitialized();CockpitNotifier.controller.submitEventOnce(code)};CockpitNotifier.verifyControllerInitialized=function(){if(!CockpitNotifier.controller&&!CockpitNotifier.isDryRunMode){throw new Error("'Agent started' event was not sent. Disabling!")}};CockpitNotifier.reset=function(){CockpitNotifier.controller=undefined;CockpitNotifier.controllerNullLogged=false;CockpitNotifier.isDryRunMode=false};CockpitNotifier.setDryRunMode=function(logger,proxy){CockpitNotifier.isDryRunMode=true;CockpitNotifier.controller=new dry_run_agent_events_controller_1.DryRunAgentEventsController(logger,proxy)};CockpitNotifier.controllerNullLogged=false;return CockpitNotifier}();exports.CockpitNotifier=CockpitNotifier})},{"./agent-events-controller":290,"./dry-run-agent-events-controller":295}],295:[function(require,module,exports){var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(Object.prototype.hasOwnProperty.call(b,p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","./agent-events-conracts","./agent-events-controller","../config-process/config","../agent-instance-data"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.DryRunAgentEventsController=void 0;var agent_events_conracts_1=require("./agent-events-conracts");var agent_events_controller_1=require("./agent-events-controller");var config_1=require("../config-process/config");var agent_instance_data_1=require("../agent-instance-data");var DryRunAgentEventsController=function(_super){__extends(DryRunAgentEventsController,_super);function DryRunAgentEventsController(logger,proxy){return _super.call(this,new config_1.AgentConfig,new agent_instance_data_1.AgentInstanceData(agent_events_conracts_1.AgentType.SLNODEJS,agent_events_conracts_1.Technology.NODEJS),logger,proxy,null)||this}DryRunAgentEventsController.prototype.submitAgentStartedEvent=function(packageJsonFile){return Promise.resolve(undefined)};return DryRunAgentEventsController}(agent_events_controller_1.AgentEventsController);exports.DryRunAgentEventsController=DryRunAgentEventsController})},{"../agent-instance-data":299,"../config-process/config":302,"./agent-events-conracts":289,"./agent-events-controller":290}],296:[function(require,module,exports){(function(process){(function(){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","os","../system-date"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.MachineInfoBuilder=void 0;var os=require("os");var system_date_1=require("../system-date");var MachineInfoBuilder=function(){function MachineInfoBuilder(){this.info={}}MachineInfoBuilder.prototype.fillData=function(){var currentDate=system_date_1.getSystemDate();this.info.machineName=os.hostname();this.info.arch=os.arch();this.info.os=os.platform();this.info.localDateTime=currentDate.toString();this.info.localDateTimeUnix_s=currentDate.getTime();this.info.runtime=process.version;this.info.ipAddress=this.extractIpAddresses()};MachineInfoBuilder.prototype.build=function(){this.fillData();return this.info};MachineInfoBuilder.prototype.extractIpAddresses=function(){var ipAddresses=[];var interfaces=os.networkInterfaces();Object.keys(interfaces).forEach(function(key){var addressesArr=interfaces[key];ipAddresses=ipAddresses.concat(addressesArr.map(function(addressObject){return addressObject.address}))});return ipAddresses};return MachineInfoBuilder}();exports.MachineInfoBuilder=MachineInfoBuilder})}).call(this)}).call(this,require("_process"))},{"../system-date":333,_process:179,os:154}],297:[function(require,module,exports){(function(process){(function(){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.NodejsEnvInfoBuilder=void 0;var NodejsEnvInfoBuilder=function(){function NodejsEnvInfoBuilder(dependencies){this.info={};this.dependencies=dependencies||{}}NodejsEnvInfoBuilder.prototype.fillData=function(){this.info.indexJsonDeps=this.dependencies;this.info.nodeVersion=process.versions.node;this.info.execArgv=process.execArgv};NodejsEnvInfoBuilder.prototype.build=function(){this.fillData();return this.info};return NodejsEnvInfoBuilder}();exports.NodejsEnvInfoBuilder=NodejsEnvInfoBuilder})}).call(this)}).call(this,require("_process"))},{_process:179}],298:[function(require,module,exports){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.isSensitive=void 0;var secretKeysRegexes={"Slack Token":"(xox[p|b|o|a]-[0-9]{12}-[0-9]{12}-[0-9]{12}-[a-z0-9]{32})","RSA private key":"-----BEGIN RSA PRIVATE KEY-----","SSH (DSA) private key":"-----BEGIN DSA PRIVATE KEY-----","SSH (EC) private key":"-----BEGIN EC PRIVATE KEY-----","PGP private key block":"-----BEGIN PGP PRIVATE KEY BLOCK-----","Amazon AWS Access Key ID":"AKIA[0-9A-Z]{16}","Amazon MWS Auth Token":"amzn\\.mws\\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}","AWS API Key":"AKIA[0-9A-Z]{16}","Facebook Access Token":"EAACEdEose0cBA[0-9A-Za-z]+","Facebook OAuth":"[f|F][a|A][c|C][e|E][b|B][o|O][o|O][k|K].*['|\"][0-9a-f]{32}['|\"]",GitHub:"[g|G][i|I][t|T][h|H][u|U][b|B].*['|\"][0-9a-zA-Z]{35,40}['|\"]","Generic API Key":"[a|A][p|P][i|I][_]?[k|K][e|E][y|Y].*['|\"][0-9a-zA-Z]{32,45}['|\"]","Generic Secret":"[s|S][e|E][c|C][r|R][e|E][t|T].*['|\"][0-9a-zA-Z]{32,45}['|\"]","Google API Key":"AIza[0-9A-Za-z\\-_]{35}","Google Cloud Platform API Key":"AIza[0-9A-Za-z\\-_]{35}","Google Cloud Platform OAuth":"[0-9]+-[0-9A-Za-z_]{32}\\.apps\\.googleusercontent\\.com","Google Drive API Key":"AIza[0-9A-Za-z\\-_]{35}","Google Drive OAuth":"[0-9]+-[0-9A-Za-z_]{32}\\.apps\\.googleusercontent\\.com","Google (GCP) Service-account":'"type": "service_account"',"Google Gmail API Key":"AIza[0-9A-Za-z\\-_]{35}","Google Gmail OAuth":"[0-9]+-[0-9A-Za-z_]{32}\\.apps\\.googleusercontent\\.com","Google OAuth Access Token":"ya29\\.[0-9A-Za-z\\-_]+","Google YouTube API Key":"AIza[0-9A-Za-z\\-_]{35}","Google YouTube OAuth":"[0-9]+-[0-9A-Za-z_]{32}\\.apps\\.googleusercontent\\.com","Heroku API Key":"[h|H][e|E][r|R][o|O][k|K][u|U].*[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}","MailChimp API Key":"[0-9a-f]{32}-us[0-9]{1,2}","Mailgun API Key":"key-[0-9a-zA-Z]{32}","Password in URL":"[a-zA-Z]{3,10}://[^/\\s:@]{3,20}:[^/\\s:@]{3,20}@.{1,100}[\"'\\s]","PayPal Braintree Access Token":"access_token\\$production\\$[0-9a-z]{16}\\$[0-9a-f]{32}","Picatic API Key":"sk_live_[0-9a-z]{32}","Slack Webhook":"https://hooks.slack.com/services/T[a-zA-Z0-9_]{8}/B[a-zA-Z0-9_]{8}/[a-zA-Z0-9_]{24}","Stripe API Key":"sk_live_[0-9a-zA-Z]{24}","Stripe Restricted API Key":"rk_live_[0-9a-zA-Z]{24}","Square Access Token":"sq0atp-[0-9A-Za-z\\-_]{22}","Square OAuth Secret":"sq0csp-[0-9A-Za-z\\-_]{43}","Twilio API Key":"SK[0-9a-fA-F]{32}","Twitter Access Token":"[t|T][w|W][i|I][t|T][t|T][e|E][r|R].*[1-9][0-9]+-[0-9a-zA-Z]{40}","Twitter OAuth":"[t|T][w|W][i|I][t|T][t|T][e|E][r|R].*['|\"][0-9a-zA-Z]{35,44}['|\"]"};function isSensitive(envVar,value,logger){for(var _i=0,_a=Object.entries(secretKeysRegexes);_i<_a.length;_i++){var _b=_a[_i],key=_b[0],regex=_b[1];if(new RegExp(regex).test(value)){logger.debug("Value for key "+envVar+" filtered out since it suspected to contains data fpr "+key);return true}}return false}exports.isSensitive=isSensitive})},{}],299:[function(require,module,exports){(function(__dirname){(function(){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","uuid","./agent-events/agent-events-conracts","./utils/files-utils","fs","./agent-events/agent-instance-info-builder"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.AgentInstanceData=void 0;var uuid=require("uuid");var agent_events_conracts_1=require("./agent-events/agent-events-conracts");var files_utils_1=require("./utils/files-utils");var fs_1=require("fs");var agent_instance_info_builder_1=require("./agent-events/agent-instance-info-builder");var AgentInstanceData=function(){function AgentInstanceData(agentType,technology){this.agentType=agentType;this.technology=technology;this.agentId=uuid();this.agentVersion=this.resolveAgentVersion()}AgentInstanceData.prototype.resolveAgentVersion=function(){if(this.technology===agent_events_conracts_1.Technology.BROWSER){return this.resolveAgentVersionForBrowserAgent()}var packageJsonFilePath=files_utils_1.FilesUtils.findFileUp("package.json",__dirname);if(packageJsonFilePath){try{var packageJson=fs_1.readFileSync(packageJsonFilePath).toString();var parsed=JSON.parse(packageJson);return parsed.version}catch(e){console.warn("Failed to resolve agent version, Error: '"+e);return null}}return null};AgentInstanceData.prototype.resolveAgentVersionForBrowserAgent=function(){var windowVar=typeof window!=="undefined"?window:null;return windowVar&&windowVar[agent_instance_info_builder_1.AgentInstanceInfoBuilder.SEALIGHTS_WINDOW_OBJECT]&&windowVar[agent_instance_info_builder_1.AgentInstanceInfoBuilder.SEALIGHTS_WINDOW_OBJECT].agentVersion||agent_instance_info_builder_1.AgentInstanceInfoBuilder.DEFAULT_BROWSER_AGENT_VERSION};return AgentInstanceData}();exports.AgentInstanceData=AgentInstanceData})}).call(this)}).call(this,"/tsOutputs/common")},{"./agent-events/agent-events-conracts":289,"./agent-events/agent-instance-info-builder":291,"./utils/files-utils":335,fs:69,uuid:507}],300:[function(require,module,exports){(function(process){(function(){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","./config-system","./config","../constants/sl-env-vars","fs","jwt-decode"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ConfigLoader=void 0;var config_system_1=require("./config-system");var config_1=require("./config");var sl_env_vars_1=require("../constants/sl-env-vars");var fs=require("fs");var jwtDecode=require("jwt-decode");var ConfigLoader=function(){function ConfigLoader(logger){this.logger=logger}ConfigLoader.prototype.loadAgentConfiguration=function(initialJsonConfig){var agentCfg=new config_1.AgentConfig;if(process.env.SL_CONFIGURATION){try{var jsonCfg=JSON.parse(process.env.SL_CONFIGURATION);agentCfg.loadConfiguration(new config_system_1.JsonObjectConfigurationProvider(jsonCfg))}catch(e){console.error("Error parsing agent configuration %s",e)}}agentCfg.loadConfiguration(new config_system_1.EnvVariableConfigurationProvider("SL_"));if(initialJsonConfig){agentCfg.loadConfiguration(new config_system_1.JsonObjectConfigurationProvider(initialJsonConfig))}if(!agentCfg.token.hasValue&&agentCfg.tokenFile.hasValue){try{agentCfg.token.value=fs.readFileSync(agentCfg.tokenFile.value).toString()}catch(err){}}if(agentCfg.token.hasValue){this.loadConfigFromToken(agentCfg,agentCfg.token.value)}this.resolveUsingOtel(agentCfg);this.printConfiguration(agentCfg);return agentCfg};ConfigLoader.prototype.printConfiguration=function(agentCfg){if(!this.logger)return;this.logger.info("****************************************************");this.logger.info("Current config");this.logger.info("****************************************************");this.logger.info(agentCfg.toJsonObject())};ConfigLoader.prototype.resolveUsingOtel=function(agentCfg){agentCfg.useOtel.value=sl_env_vars_1.SlEnvVars.shouldUseOtel()};ConfigLoader.prototype.loadConfigFromToken=function(agentCfg,token){if(!token)return null;try{var tokenData=jwtDecode(token);if(!tokenData["x-sl-server"]){throw new Error("Token Is Invalid. Doesn't Contain Server")}if(!tokenData["subject"]){throw new Error("Token Is Invalid. Doesn't Contain Subject")}var customerId=tokenData["subject"];var subjectParts=tokenData["subject"].split("@");if(subjectParts.length>=1){customerId=subjectParts[0]}if(!agentCfg.server.hasValue){agentCfg.server.value=tokenData["x-sl-server"]}agentCfg.customerId.value=customerId}catch(err){}};return ConfigLoader}();exports.ConfigLoader=ConfigLoader})}).call(this)}).call(this,require("_process"))},{"../constants/sl-env-vars":305,"./config":302,"./config-system":301,_process:179,fs:69,"jwt-decode":441}],301:[function(require,module,exports){(function(process){(function(){(function(factory){if(typeof module==="object"&&typeof module.exports==="object"){var v=factory(require,exports);if(v!==undefined)module.exports=v}else if(typeof define==="function"&&define.amd){define(["require","exports","fs"],factory)}})(function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.BaseConfiguration=exports.BooleanConfigKey=exports.NumberConfigKey=exports.StringConfigKey=exports.AgentConfigKey=exports.JsonConfigFileConfigurationProvider=exports.ConfigProviderAggregator=exports.EnvVariableConfigurationProvider=exports.JsonObjectConfigurationProvider=void 0;var fs=require("fs");var JsonObjectConfigurationProvider=function(){function JsonObjectConfigurationProvider(configObject){this.configObject=configObject;this.configObject=configObject||{}}JsonObjectConfigurationProvider.prototype.getAllKeyValues=function(callback){return callback(null,this.configObject)};JsonObjectConfigurationProvider.prototype.getName=function(){return"JSON Object"};return JsonObjectConfigurationProvider}();exports.JsonObjectConfigurationProvider=JsonObjectConfigurationProvider;var EnvVariableConfigurationProvider=function(){function EnvVariableConfigurationProvider(prefix){this.prefix=prefix}EnvVariableConfigurationProvider.prototype.getAllKeyValues=function(callback){if(this.prefix){var ret={};for(var key in process.env){if(key.indexOf(this.prefix)==0){ret[key.substr(this.prefix.length)]=process.env[key]}}callback(null,ret)}else{return callback(null,process.env)}};EnvVariableConfigurationProvider.prototype.getName=function(){return"Environment Variables"};return EnvVariableConfigurationProvider}();exports.EnvVariableConfigurationProvider=EnvVariableConfigurationProvider;var ConfigProviderAggregator=function(){function ConfigProviderAggregator(providers){this.providers=providers;if(!providers)throw new Error("no provider was specified")}ConfigProviderAggregator.prototype.getAllKeyValues=function(callback){var flattenedConfiguration={};var remainingProviders=[].concat(this.providers);var attemptNext=function(){if(remainingProviders.length==0){return callback(null,flattenedConfiguration)}var nextProvider=remainingProviders.shift();nextProvider.getAllKeyValues(function(err,keysAndValues){if(err)return attemptNext();Object.keys(keysAndValues).forEach(function(k){if(!flattenedConfiguration.hasOwnProperty(k))flattenedConfiguration[k]=keysAndValues[k]});return attemptNext()})};attemptNext()};ConfigProviderAggregator.prototype.getName=function(){return"Aggregated config from multiple providers: "+this.providers.map(function(t){return t.getName()})};return ConfigProviderAggregator}();exports.ConfigProviderAggregator=ConfigProviderAggregator;var JsonConfigFileConfigurationProvider=function(){function JsonConfigFileConfigurationProvider(filename){this.filename=filename;if(!filename)throw new Error("filename is required")}JsonConfigFileConfigurationProvider.prototype.getAllKeyValues=function(callback){try{var cfg=JSON.parse(fs.readFileSync(this.filename).toString().trim());return callback(null,cfg)}catch(e){return callback(e,null)}};JsonConfigFileConfigurationProvider.prototype.getName=function(){return"Config filename: "+this.filename};return JsonConfigFileConfigurationProvider}();exports.JsonConfigFileConfigurationProvider=JsonConfigFileConfigurationProvider;var AgentConfigKey=function(){function AgentConfigKey(){}return AgentConfigKey}();exports.AgentConfigKey=AgentConfigKey;var StringConfigKey=function(){function StringConfigKey(required,defaultValue){this.required=required;this.isConfigKey=true;this.metadata={required:required,type:"string"};if(defaultValue!==undefined){this.value=defaultValue}}Object.defineProperty(StringConfigKey.prototype,"value",{get:function(){return this._value},set:function(value){this._value=value;this.hasValue=true},enumerable:false,configurable:true});StringConfigKey.prototype.loadFromRawData=function(s){this.value=s;this.hasValue=true};return StringConfigKey}();exports.StringConfigKey=StringConfigKey;var NumberConfigKey=function(){function NumberConfigKey(required,defaultValue){this.required=required;this.isConfigKey=true;this.metadata={required:required,type:"number"};if(defaultValue!==undefined){this.value=defaultValue}}Object.defineProperty(NumberConfigKey.prototype,"value",{get:function(){return this._value},set:function(value){this._value=value;this.hasValue=true},enumerable:false,configurable:true});NumberConfigKey.prototype.loadFromRawData=function(s){var parsed=parseInt(s);if(isNaN(parsed))throw new Error(s+" is not a valid number");this.value=parsed;this.hasValue=true};return NumberConfigKey}();exports.NumberConfigKey=NumberConfigKey;var BooleanConfigKey=function(){function BooleanConfigKey(required,defaultValue){this.required=required;this.isConfigKey=true;this.metadata={required:required,type:"boolean"};if(defaultValue!==undefined){this.value=defaultValue}}Object.defineProperty(BooleanConfigKey.prototype,"value",{get:function(){return this._value},set:function(value){this._value=value;this.hasValue=true},enumerable:false,configurable:true});BooleanConfigKey.prototype.loadFromRawData=function(s){if(s==null)s="";if(typeof s==="boolean")s=String(s);s=s.toLowerCase();switch(s){case"true":this.value=true;this.hasValue=true;return;case"false":this.value=false;this.hasValue=true;return;case"undefined":this.value=false;this.hasValue=false;return;default:throw new Error("Invalid boolean value: "+s)}};return BooleanConfigKey}();exports.BooleanConfigKey=BooleanConfigKey;var BaseConfiguration=function(){function BaseConfiguration(){}BaseConfiguration.prototype.loadConfigurationFromMultipleProviders=function(configProviders,callback){var provider=new ConfigProviderAggregator(configProviders);this.loadConfiguration(provider,callback)};BaseConfiguration.prototype.loadConfiguration=function(configProvider,callback,dbg){var _this=this;try{configProvider.getAllKeyValues(function(err,keysAndValues){if(err){if(callback){callback(err)}return}keysAndValues=keysAndValues||{};var knownKeys=Object.keys(_this);var hadError=false;var keyWithError="";knownKeys.forEach(function(keyName){if(hadError){console.log("[Sealights Test Listener] - Failed to load configuration due to invalid value in '"+keyWithError+"' field'.");return}var cfgKey=_this[keyName];if(!cfgKey.isConfigKey)return;var rawValue=keysAndValues[keyName];if(cfgKey.metadata.required&&rawValue==undefined){var msg="Required configuration is missing: "+keyName+", provider:"+configProvider.getName();hadError=true;if(callback){callback(new Error(msg))}}if(rawValue==undefined)return;try{cfgKey.loadFromRawData(rawValue)}catch(e){var msg="Invalid configuration for key="+keyName+", value="+rawValue+ +", provider="+configProvider.getName()+": "+e.toString();console.log("[Sealights Test Listener] - "+msg);hadError=true;keyWithError=keyName;if(callback){