@checksum-ai/runtime 1.0.27 → 1.0.29

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.
package/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- var f=Object.create;var g=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var u=(n,t)=>g(n,"name",{value:t,configurable:!0});var P=(n,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of C(t))!k.call(n,o)&&o!==e&&g(n,o,{get:()=>t[o],enumerable:!(s=w(t,o))||s.enumerable});return n};var R=(n,t,e)=>(e=n!=null?f(y(n)):{},P(t||!n||!n.__esModule?g(e,"default",{value:n,enumerable:!0}):e,n));var i=require("fs"),l=R(require("child_process")),r=require("path");var d="checksum";var h=class{constructor(){this.TEST_RUN_MONITOR_PATH=(0,r.join)(__dirname,"test-run-monitor.js");this.CHECKSUM_API_URL="https://api.checksum.ai";this.didFail=!1;this.mock=!1;this.isolatedMode=!1;this.completeIndicators={upload:!1,tests:!1,report:!1};this.guardReturn=async(t,e=1e3,s="action hang guard timed out")=>{let o="guard-timed-out",a=u(async()=>(await this.awaitSleep(e+1e3),o),"guard"),c=await Promise.race([t,a()]);if(typeof c=="string"&&c===o)throw new Error(s);return c};this.awaitSleep=t=>new Promise(e=>setTimeout(e,t))}async execute(){switch(process.argv.find(t=>t==="--help"||t==="-h")&&(await this.printHelp(process.argv[2]),process.exit(0)),process.argv[2]){case"init":this.install();break;case"test":await this.test(process.argv.slice(3));break;case"show-report":this.showReport(process.argv.slice(3));break;default:await this.printHelp()}process.exit(0)}async execCmd(t){let e=await l.spawn(t,{shell:!0,stdio:"inherit"});return new Promise((o,a)=>{e.on("exit",c=>{c===0?o(!0):a(new Error(`Checsum failed execution with code: ${c} `))})})}async getCmdOutput(t){return new Promise(function(e,s){l.exec(t,(o,a,c)=>{if(o){s(`Error executing command: ${o.message}`);return}e(a)})})}async printHelp(t){switch(t){default:console.log(`
1
+ var f=Object.create;var g=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty;var u=(n,t)=>g(n,"name",{value:t,configurable:!0});var k=(n,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of w(t))!P.call(n,o)&&o!==e&&g(n,o,{get:()=>t[o],enumerable:!(s=C(t,o))||s.enumerable});return n};var R=(n,t,e)=>(e=n!=null?f(y(n)):{},k(t||!n||!n.__esModule?g(e,"default",{value:n,enumerable:!0}):e,n));var i=require("fs"),l=R(require("child_process")),r=require("path");var d="checksum";var h=class{constructor(){this.TEST_RUN_MONITOR_PATH=(0,r.join)(__dirname,"test-run-monitor.js");this.CHECKSUM_API_URL="https://api.checksum.ai";this.CHECKSUM_APP_URL="https://app.checksum.ai";this.didFail=!1;this.mock=!1;this.isolatedMode=!1;this.completeIndicators={upload:!1,tests:!1,report:!1};this.guardReturn=async(t,e=1e3,s="action hang guard timed out")=>{let o="guard-timed-out",a=u(async()=>(await this.awaitSleep(e+1e3),o),"guard"),c=await Promise.race([t,a()]);if(typeof c=="string"&&c===o)throw new Error(s);return c};this.awaitSleep=t=>new Promise(e=>setTimeout(e,t))}async execute(){switch(process.argv.find(t=>t==="--help"||t==="-h")&&(await this.printHelp(process.argv[2]),process.exit(0)),process.argv[2]){case"init":this.install();break;case"test":await this.test(process.argv.slice(3));break;case"show-report":this.showReport(process.argv.slice(3));break;default:await this.printHelp()}process.exit(0)}async execCmd(t){let e=await l.spawn(t,{shell:!0,stdio:"inherit"});return new Promise((o,a)=>{e.on("exit",c=>{c===0?o(!0):a(new Error(`Checsum failed execution with code: ${c} `))})})}async getCmdOutput(t){return new Promise(function(e,s){l.exec(t,(o,a,c)=>{if(o){s(`Error executing command: ${o.message}`);return}e(a)})})}async printHelp(t){switch(t){default:console.log(`
2
2
  Checksum CLI
3
3
  Usage: checksum [command] [options]
4
4
 
@@ -10,8 +10,8 @@ show-report [options] [report] show HTML report
10
10
  `);break;case"test":try{let e="npx playwright test --help",s=(await this.getCmdOutput(e)).replace(/npx playwright/g,"yarn checksum").split(`
11
11
  `);s.splice(5,0," --checksum-config=<config> Checksum configuration in JSON format").join(`
12
12
  `),console.log(s.join(`
13
- `))}catch(e){console.log("Error",e.message)}break;case"show-report":try{let e="npx playwright show-report --help",s=(await this.getCmdOutput(e)).replace(/npx playwright/g,"yarn checksum");console.log(s)}catch(e){console.log("Error",e.message)}break}}async showReport(t){let e=`npx playwright show-report ${t.join(" ")}`;try{await this.execCmd(e)}catch(s){console.log("Error showing report",s.message)}}async test(t){this.processChecksumArguments(t),this.setChecksumConfig(),await this.getSession();let e;try{e=await this.guardReturn(this.startTestRunMonitor(this.testSession),1e4,"test run monitor timeout")}catch{console.log("Error starting test run monitor. Test results will not be available on checksum.")}this.buildVolatileConfig();let s=`${e?`CHECKSUM_UPLOAD_AGENT_PORT=${e} `:""} PWDEBUG=console npx playwright test --config ${this.getPlaywrightConfigFile()} ${t.join(" ")}`;await this.patchPlaywright();try{await this.execCmd(s),console.log("Tests execution finished")}catch(o){this.didFail=!0,console.log("Error during test",o.message)}finally{let o=this.getPlaywrightReportPath();(0,i.existsSync)(o)?this.testRunMonitorProcess.stdin.write(`cli:report=${o}`):console.log(`Could not find report file at ${o}`),await this.patchPlaywright(!0),this.completeIndicators.tests=!0,await this.handleCompleteMessage()}}async patchPlaywright(t=!1){let e=`bash ${(0,r.join)(__dirname,"scripts/patch.sh")}${t?" off":""}`;try{await this.execCmd(e)}catch(s){console.log("Error patching playwright",s.message)}}getPlaywrightReportPath(){var o,a;let t=(0,r.join)(process.cwd(),"playwright-report"),e=require(this.getPlaywrightConfigFile()),{reporter:s}=e;return s instanceof Array&&s.length>1&&((o=s[1])!=null&&o.outputFolder)&&(t=(a=s[1])==null?void 0:a.outputFolder),process.env.PLAYWRIGHT_HTML_REPORT&&(t=process.env.PLAYWRIGHT_HTML_REPORT),(0,r.join)(t,"index.html")}getPlaywrightConfigFile(){return(0,r.join)(this.getRootDirPath(),"playwright.config.ts")}startTestRunMonitor(t){return new Promise(e=>{console.log("Starting test run monitor"),this.testRunMonitorProcess=l.spawn("node",[this.TEST_RUN_MONITOR_PATH,JSON.stringify({sessionId:t,checksumApiURL:this.CHECKSUM_API_URL,apiKey:this.config.apiKey}),...this.mock?["mock"]:[]]),this.testRunMonitorProcess.stdout.on("data",s=>{var p,m;let o=s.toString().trim();if(!o.startsWith("monitor")){(m=(p=this.config)==null?void 0:p.options)!=null&&m.printLogs&&console.log(`Message from test run monitor: ${o}`);return}let[a,c]=o.substring(o.indexOf(":")+1).split("=");a==="port"?e(c):this.handleTestRunMonitorMessage(a,c)}),this.testRunMonitorProcess.on("exit",(s,o)=>{console.log(`test run monitor process exited with code ${s} and signal ${o}`)}),this.testRunMonitorProcess.on("error",s=>{console.error(`Error starting test run monitor: ${s.message}`)})})}async handleTestRunMonitorMessage(t,e){switch(t){case"complete":this.isolatedMode||console.log("Test artifacts uploaded successfully"),this.sendUploadsComplete().then(()=>{this.completeIndicators.upload=!0});break;case"report-uploaded":{this.isolatedMode||console.log("Report generated and uploaded to checksum");let s={};try{s=JSON.parse(e)}catch(o){console.log("Error parsing stats",o.message)}await this.sendTestRunEnd(s),this.completeIndicators.report=!0,this.isolatedMode||console.log(`*******************
14
- * Checksum report URL: ${this.CHECKSUM_API_URL}/#/test-runs/${this.testSession}
13
+ `))}catch(e){console.log("Error",e.message)}break;case"show-report":try{let e="npx playwright show-report --help",s=(await this.getCmdOutput(e)).replace(/npx playwright/g,"yarn checksum");console.log(s)}catch(e){console.log("Error",e.message)}break}}async showReport(t){let e=`npx playwright show-report ${t.join(" ")}`;try{await this.execCmd(e)}catch(s){console.log("Error showing report",s.message)}}async test(t){this.processChecksumArguments(t),this.setChecksumConfig(),await this.getSession();let e;try{e=await this.guardReturn(this.startTestRunMonitor(this.testSession),1e4,"test run monitor timeout")}catch{console.log("Error starting test run monitor. Test results will not be available on checksum.")}this.buildVolatileConfig();let s=`${e?`CHECKSUM_UPLOAD_AGENT_PORT=${e} `:""} npx playwright test --config ${this.getPlaywrightConfigFile()} ${t.join(" ")}`;await this.patchPlaywright();try{await this.execCmd(s),console.log("Tests execution finished")}catch(o){this.didFail=!0,console.log("Error during test",o.message)}finally{let o=this.getPlaywrightReportPath();(0,i.existsSync)(o)?this.testRunMonitorProcess.stdin.write(`cli:report=${o}`):console.log(`Could not find report file at ${o}`),await this.patchPlaywright(!0),this.completeIndicators.tests=!0,await this.handleCompleteMessage()}}async patchPlaywright(t=!1){let e=`bash ${(0,r.join)(__dirname,"scripts/patch.sh")}${t?" off":""}`;try{await this.execCmd(e)}catch(s){console.log("Error patching playwright",s.message)}}getPlaywrightReportPath(){var o,a;let t=(0,r.join)(process.cwd(),"playwright-report"),e=require(this.getPlaywrightConfigFile()),{reporter:s}=e;return s instanceof Array&&s.length>1&&((o=s[1])!=null&&o.outputFolder)&&(t=(a=s[1])==null?void 0:a.outputFolder),process.env.PLAYWRIGHT_HTML_REPORT&&(t=process.env.PLAYWRIGHT_HTML_REPORT),(0,r.join)(t,"index.html")}getPlaywrightConfigFile(){return(0,r.join)(this.getRootDirPath(),"playwright.config.ts")}startTestRunMonitor(t){return new Promise(e=>{console.log("Starting test run monitor"),this.testRunMonitorProcess=l.spawn("node",[this.TEST_RUN_MONITOR_PATH,JSON.stringify({sessionId:t,checksumApiURL:this.CHECKSUM_API_URL,apiKey:this.config.apiKey}),...this.mock?["mock"]:[]]),this.testRunMonitorProcess.stdout.on("data",s=>{var p,m;let o=s.toString().trim();if(!o.startsWith("monitor")){(m=(p=this.config)==null?void 0:p.options)!=null&&m.printLogs&&console.log(`Message from test run monitor: ${o}`);return}let[a,c]=o.substring(o.indexOf(":")+1).split("=");a==="port"?e(c):this.handleTestRunMonitorMessage(a,c)}),this.testRunMonitorProcess.on("exit",(s,o)=>{console.log(`test run monitor process exited with code ${s} and signal ${o}`)}),this.testRunMonitorProcess.on("error",s=>{console.error(`Error starting test run monitor: ${s.message}`)})})}async handleTestRunMonitorMessage(t,e){switch(t){case"complete":this.isolatedMode||console.log("Test artifacts uploaded successfully"),this.sendUploadsComplete().then(()=>{this.completeIndicators.upload=!0});break;case"report-uploaded":{this.isolatedMode||console.log("Report generated and uploaded to checksum");let s={};try{s=JSON.parse(e)}catch(o){console.log("Error parsing stats",o.message)}await this.sendTestRunEnd(s),this.completeIndicators.report=!0,this.isolatedMode||console.log(`*******************
14
+ * Checksum report URL: ${this.CHECKSUM_APP_URL}/#/test-runs/${this.testSession}
15
15
  *******************`);break}default:console.warn(`Unhandled test run monitor message: ${t}=${e}`)}}async handleCompleteMessage(){for(;;)Object.keys(this.completeIndicators).find(t=>!this.completeIndicators[t])?await this.awaitSleep(1e3):(console.log("Checksum test run complete"),this.shutdown(this.didFail?1:0))}shutdown(t=0){this.cleanup(),process.exit(t)}buildVolatileConfig(){if(!this.volatileChecksumConfig)return;let t=this.getVolatileConfigPath(),e=`
16
16
  import { RunMode, getChecksumConfig } from "@checksum-ai/runtime";
17
17
 
package/index.js CHANGED
@@ -267,8 +267,8 @@ m2: `).concat(this.mapper2.__debugToString().split(`
267
267
  `,P+=be.classification+`
268
268
  `}return P+=E.finalLexState,P},L}(z),ce=function(F){nv(L,F);function L(_,b,x){var E=F.call(this,_)||this;return E.logger=b,E.host=x,E.logPerformance=!1,E}return n(L,"CoreServicesShimObject"),L.prototype.forwardJSONCall=function(_,b){return B(this.logger,_,b,this.logPerformance)},L.prototype.resolveModuleName=function(_,b,x){var E=this;return this.forwardJSONCall("resolveModuleName('".concat(_,"')"),function(){var P=JSON.parse(x),A=e.resolveModuleName(b,e.normalizeSlashes(_),P,E.host),ve=A.resolvedModule?A.resolvedModule.resolvedFileName:void 0;return A.resolvedModule&&A.resolvedModule.extension!==".ts"&&A.resolvedModule.extension!==".tsx"&&A.resolvedModule.extension!==".d.ts"&&(ve=void 0),{resolvedFileName:ve,failedLookupLocations:A.failedLookupLocations,affectingLocations:A.affectingLocations}})},L.prototype.resolveTypeReferenceDirective=function(_,b,x){var E=this;return this.forwardJSONCall("resolveTypeReferenceDirective(".concat(_,")"),function(){var P=JSON.parse(x),A=e.resolveTypeReferenceDirective(b,e.normalizeSlashes(_),P,E.host);return{resolvedFileName:A.resolvedTypeReferenceDirective?A.resolvedTypeReferenceDirective.resolvedFileName:void 0,primary:A.resolvedTypeReferenceDirective?A.resolvedTypeReferenceDirective.primary:!0,failedLookupLocations:A.failedLookupLocations}})},L.prototype.getPreProcessedFileInfo=function(_,b){var x=this;return this.forwardJSONCall("getPreProcessedFileInfo('".concat(_,"')"),function(){var E=e.preProcessFile(e.getSnapshotText(b),!0,!0);return{referencedFiles:x.convertFileReferences(E.referencedFiles),importedFiles:x.convertFileReferences(E.importedFiles),ambientExternalModules:E.ambientExternalModules,isLibFile:E.isLibFile,typeReferenceDirectives:x.convertFileReferences(E.typeReferenceDirectives),libReferenceDirectives:x.convertFileReferences(E.libReferenceDirectives)}})},L.prototype.getAutomaticTypeDirectiveNames=function(_){var b=this;return this.forwardJSONCall("getAutomaticTypeDirectiveNames('".concat(_,"')"),function(){var x=JSON.parse(_);return e.getAutomaticTypeDirectiveNames(x,b.host)})},L.prototype.convertFileReferences=function(_){if(_){for(var b=[],x=0,E=_;x<E.length;x++){var P=E[x];b.push({path:e.normalizeSlashes(P.fileName),position:P.pos,length:P.end-P.pos})}return b}},L.prototype.getTSConfigFileInfo=function(_,b){var x=this;return this.forwardJSONCall("getTSConfigFileInfo('".concat(_,"')"),function(){var E=e.parseJsonText(_,e.getSnapshotText(b)),P=e.normalizeSlashes(_),A=e.parseJsonSourceFileConfigFileContent(E,x.host,e.getDirectoryPath(P),{},P);return{options:A.options,typeAcquisition:A.typeAcquisition,files:A.fileNames,raw:A.raw,errors:p(Gn(Gn([],E.parseDiagnostics,!0),A.errors,!0),`\r
269
269
  `)}})},L.prototype.getDefaultCompilationSettings=function(){return this.forwardJSONCall("getDefaultCompilationSettings()",function(){return e.getDefaultCompilerOptions()})},L.prototype.discoverTypings=function(_){var b=this,x=e.createGetCanonicalFileName(!1);return this.forwardJSONCall("discoverTypings()",function(){var E=JSON.parse(_);return b.safeList===void 0&&(b.safeList=e.JsTyping.loadSafeList(b.host,e.toPath(E.safeListPath,E.safeListPath,x))),e.JsTyping.discoverTypings(b.host,function(P){return b.logger.log(P)},E.fileNames,e.toPath(E.projectRootPath,E.projectRootPath,x),b.safeList,E.packageNameToTypingLocation,E.typeAcquisition,E.unresolvedImports,E.typesRegistry,e.emptyOptions)})},L}(z),ue=function(){function F(){this._shims=[]}return n(F,"TypeScriptServicesFactory"),F.prototype.getServicesVersion=function(){return e.servicesVersion},F.prototype.createLanguageServiceShim=function(L){try{this.documentRegistry===void 0&&(this.documentRegistry=e.createDocumentRegistry(L.useCaseSensitiveFileNames&&L.useCaseSensitiveFileNames(),L.getCurrentDirectory()));var _=new v(L),b=e.createLanguageService(_,this.documentRegistry,!1);return new fe(this,L,b)}catch(x){throw a(L,x),x}},F.prototype.createClassifierShim=function(L){try{return new se(this,L)}catch(_){throw a(L,_),_}},F.prototype.createCoreServicesShim=function(L){try{var _=new O(L);return new ce(this,L,_)}catch(b){throw a(L,b),b}},F.prototype.close=function(){e.clear(this._shims),this.documentRegistry=void 0},F.prototype.registerShim=function(L){this._shims.push(L)},F.prototype.unregisterShim=function(L){for(var _=0;_<this._shims.length;_++)if(this._shims[_]===L){delete this._shims[_];return}throw new Error("Invalid operation")},F}();e.TypeScriptServicesFactory=ue})(_r||(_r={}));(function(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,typeof globalThis>"u"&&(window.globalThis=window),delete Object.prototype.__magic__}catch{window.globalThis=window}})();(typeof process>"u"||process.browser)&&(globalThis.TypeScript=globalThis.TypeScript||{},globalThis.TypeScript.Services=globalThis.TypeScript.Services||{},globalThis.TypeScript.Services.TypeScriptServicesFactory=_r.TypeScriptServicesFactory,globalThis.toolsVersion=_r.versionMajorMinor);typeof Ih<"u"&&Ih.exports&&(Ih.exports=_r);var _r;(function(e){function a(O,h,B,re){if(Object.defineProperty(se,"name",Ri(Ri({},Object.getOwnPropertyDescriptor(se,"name")),{value:O})),re)for(var z=0,p=Object.keys(re);z<p.length;z++){var m=p[z],fe=+m;!isNaN(fe)&&e.hasProperty(h,"".concat(fe))&&(h[fe]=e.Debug.deprecate(h[fe],Ri(Ri({},re[fe]),{name:O})))}var le=y(h,B);return se;function se(){for(var ce=[],ue=0;ue<arguments.length;ue++)ce[ue]=arguments[ue];var F=le(ce),L=F!==void 0?h[F]:void 0;if(typeof L=="function")return L.apply(void 0,ce);throw new TypeError("Invalid arguments")}}n(a,"createOverload"),e.createOverload=a;function y(O,h){return function(B){for(var re=0;e.hasProperty(O,"".concat(re))&&e.hasProperty(h,"".concat(re));re++){var z=h[re];if(z(B))return re}}}n(y,"createBinder");function v(O){return{overload:function(h){return{bind:function(B){return{finish:function(){return a(O,h,B)},deprecate:function(re){return{finish:function(){return a(O,h,B,re)}}}}}}}}}n(v,"buildOverload"),e.buildOverload=v})(_r||(_r={}));var _r;(function(e){var a={since:"4.0",warnAfter:"4.1",message:"Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead."};e.createNodeArray=e.Debug.deprecate(e.factory.createNodeArray,a),e.createNumericLiteral=e.Debug.deprecate(e.factory.createNumericLiteral,a),e.createBigIntLiteral=e.Debug.deprecate(e.factory.createBigIntLiteral,a),e.createStringLiteral=e.Debug.deprecate(e.factory.createStringLiteral,a),e.createStringLiteralFromNode=e.Debug.deprecate(e.factory.createStringLiteralFromNode,a),e.createRegularExpressionLiteral=e.Debug.deprecate(e.factory.createRegularExpressionLiteral,a),e.createLoopVariable=e.Debug.deprecate(e.factory.createLoopVariable,a),e.createUniqueName=e.Debug.deprecate(e.factory.createUniqueName,a),e.createPrivateIdentifier=e.Debug.deprecate(e.factory.createPrivateIdentifier,a),e.createSuper=e.Debug.deprecate(e.factory.createSuper,a),e.createThis=e.Debug.deprecate(e.factory.createThis,a),e.createNull=e.Debug.deprecate(e.factory.createNull,a),e.createTrue=e.Debug.deprecate(e.factory.createTrue,a),e.createFalse=e.Debug.deprecate(e.factory.createFalse,a),e.createModifier=e.Debug.deprecate(e.factory.createModifier,a),e.createModifiersFromModifierFlags=e.Debug.deprecate(e.factory.createModifiersFromModifierFlags,a),e.createQualifiedName=e.Debug.deprecate(e.factory.createQualifiedName,a),e.updateQualifiedName=e.Debug.deprecate(e.factory.updateQualifiedName,a),e.createComputedPropertyName=e.Debug.deprecate(e.factory.createComputedPropertyName,a),e.updateComputedPropertyName=e.Debug.deprecate(e.factory.updateComputedPropertyName,a),e.createTypeParameterDeclaration=e.Debug.deprecate(e.factory.createTypeParameterDeclaration,a),e.updateTypeParameterDeclaration=e.Debug.deprecate(e.factory.updateTypeParameterDeclaration,a),e.createParameter=e.Debug.deprecate(e.factory.createParameterDeclaration,a),e.updateParameter=e.Debug.deprecate(e.factory.updateParameterDeclaration,a),e.createDecorator=e.Debug.deprecate(e.factory.createDecorator,a),e.updateDecorator=e.Debug.deprecate(e.factory.updateDecorator,a),e.createProperty=e.Debug.deprecate(e.factory.createPropertyDeclaration,a),e.updateProperty=e.Debug.deprecate(e.factory.updatePropertyDeclaration,a),e.createMethod=e.Debug.deprecate(e.factory.createMethodDeclaration,a),e.updateMethod=e.Debug.deprecate(e.factory.updateMethodDeclaration,a),e.createConstructor=e.Debug.deprecate(e.factory.createConstructorDeclaration,a),e.updateConstructor=e.Debug.deprecate(e.factory.updateConstructorDeclaration,a),e.createGetAccessor=e.Debug.deprecate(e.factory.createGetAccessorDeclaration,a),e.updateGetAccessor=e.Debug.deprecate(e.factory.updateGetAccessorDeclaration,a),e.createSetAccessor=e.Debug.deprecate(e.factory.createSetAccessorDeclaration,a),e.updateSetAccessor=e.Debug.deprecate(e.factory.updateSetAccessorDeclaration,a),e.createCallSignature=e.Debug.deprecate(e.factory.createCallSignature,a),e.updateCallSignature=e.Debug.deprecate(e.factory.updateCallSignature,a),e.createConstructSignature=e.Debug.deprecate(e.factory.createConstructSignature,a),e.updateConstructSignature=e.Debug.deprecate(e.factory.updateConstructSignature,a),e.updateIndexSignature=e.Debug.deprecate(e.factory.updateIndexSignature,a),e.createKeywordTypeNode=e.Debug.deprecate(e.factory.createKeywordTypeNode,a),e.createTypePredicateNodeWithModifier=e.Debug.deprecate(e.factory.createTypePredicateNode,a),e.updateTypePredicateNodeWithModifier=e.Debug.deprecate(e.factory.updateTypePredicateNode,a),e.createTypeReferenceNode=e.Debug.deprecate(e.factory.createTypeReferenceNode,a),e.updateTypeReferenceNode=e.Debug.deprecate(e.factory.updateTypeReferenceNode,a),e.createFunctionTypeNode=e.Debug.deprecate(e.factory.createFunctionTypeNode,a),e.updateFunctionTypeNode=e.Debug.deprecate(e.factory.updateFunctionTypeNode,a),e.createConstructorTypeNode=e.Debug.deprecate(function(y,v,O){return e.factory.createConstructorTypeNode(void 0,y,v,O)},a),e.updateConstructorTypeNode=e.Debug.deprecate(function(y,v,O,h){return e.factory.updateConstructorTypeNode(y,y.modifiers,v,O,h)},a),e.createTypeQueryNode=e.Debug.deprecate(e.factory.createTypeQueryNode,a),e.updateTypeQueryNode=e.Debug.deprecate(e.factory.updateTypeQueryNode,a),e.createTypeLiteralNode=e.Debug.deprecate(e.factory.createTypeLiteralNode,a),e.updateTypeLiteralNode=e.Debug.deprecate(e.factory.updateTypeLiteralNode,a),e.createArrayTypeNode=e.Debug.deprecate(e.factory.createArrayTypeNode,a),e.updateArrayTypeNode=e.Debug.deprecate(e.factory.updateArrayTypeNode,a),e.createTupleTypeNode=e.Debug.deprecate(e.factory.createTupleTypeNode,a),e.updateTupleTypeNode=e.Debug.deprecate(e.factory.updateTupleTypeNode,a),e.createOptionalTypeNode=e.Debug.deprecate(e.factory.createOptionalTypeNode,a),e.updateOptionalTypeNode=e.Debug.deprecate(e.factory.updateOptionalTypeNode,a),e.createRestTypeNode=e.Debug.deprecate(e.factory.createRestTypeNode,a),e.updateRestTypeNode=e.Debug.deprecate(e.factory.updateRestTypeNode,a),e.createUnionTypeNode=e.Debug.deprecate(e.factory.createUnionTypeNode,a),e.updateUnionTypeNode=e.Debug.deprecate(e.factory.updateUnionTypeNode,a),e.createIntersectionTypeNode=e.Debug.deprecate(e.factory.createIntersectionTypeNode,a),e.updateIntersectionTypeNode=e.Debug.deprecate(e.factory.updateIntersectionTypeNode,a),e.createConditionalTypeNode=e.Debug.deprecate(e.factory.createConditionalTypeNode,a),e.updateConditionalTypeNode=e.Debug.deprecate(e.factory.updateConditionalTypeNode,a),e.createInferTypeNode=e.Debug.deprecate(e.factory.createInferTypeNode,a),e.updateInferTypeNode=e.Debug.deprecate(e.factory.updateInferTypeNode,a),e.createImportTypeNode=e.Debug.deprecate(e.factory.createImportTypeNode,a),e.updateImportTypeNode=e.Debug.deprecate(e.factory.updateImportTypeNode,a),e.createParenthesizedType=e.Debug.deprecate(e.factory.createParenthesizedType,a),e.updateParenthesizedType=e.Debug.deprecate(e.factory.updateParenthesizedType,a),e.createThisTypeNode=e.Debug.deprecate(e.factory.createThisTypeNode,a),e.updateTypeOperatorNode=e.Debug.deprecate(e.factory.updateTypeOperatorNode,a),e.createIndexedAccessTypeNode=e.Debug.deprecate(e.factory.createIndexedAccessTypeNode,a),e.updateIndexedAccessTypeNode=e.Debug.deprecate(e.factory.updateIndexedAccessTypeNode,a),e.createMappedTypeNode=e.Debug.deprecate(e.factory.createMappedTypeNode,a),e.updateMappedTypeNode=e.Debug.deprecate(e.factory.updateMappedTypeNode,a),e.createLiteralTypeNode=e.Debug.deprecate(e.factory.createLiteralTypeNode,a),e.updateLiteralTypeNode=e.Debug.deprecate(e.factory.updateLiteralTypeNode,a),e.createObjectBindingPattern=e.Debug.deprecate(e.factory.createObjectBindingPattern,a),e.updateObjectBindingPattern=e.Debug.deprecate(e.factory.updateObjectBindingPattern,a),e.createArrayBindingPattern=e.Debug.deprecate(e.factory.createArrayBindingPattern,a),e.updateArrayBindingPattern=e.Debug.deprecate(e.factory.updateArrayBindingPattern,a),e.createBindingElement=e.Debug.deprecate(e.factory.createBindingElement,a),e.updateBindingElement=e.Debug.deprecate(e.factory.updateBindingElement,a),e.createArrayLiteral=e.Debug.deprecate(e.factory.createArrayLiteralExpression,a),e.updateArrayLiteral=e.Debug.deprecate(e.factory.updateArrayLiteralExpression,a),e.createObjectLiteral=e.Debug.deprecate(e.factory.createObjectLiteralExpression,a),e.updateObjectLiteral=e.Debug.deprecate(e.factory.updateObjectLiteralExpression,a),e.createPropertyAccess=e.Debug.deprecate(e.factory.createPropertyAccessExpression,a),e.updatePropertyAccess=e.Debug.deprecate(e.factory.updatePropertyAccessExpression,a),e.createPropertyAccessChain=e.Debug.deprecate(e.factory.createPropertyAccessChain,a),e.updatePropertyAccessChain=e.Debug.deprecate(e.factory.updatePropertyAccessChain,a),e.createElementAccess=e.Debug.deprecate(e.factory.createElementAccessExpression,a),e.updateElementAccess=e.Debug.deprecate(e.factory.updateElementAccessExpression,a),e.createElementAccessChain=e.Debug.deprecate(e.factory.createElementAccessChain,a),e.updateElementAccessChain=e.Debug.deprecate(e.factory.updateElementAccessChain,a),e.createCall=e.Debug.deprecate(e.factory.createCallExpression,a),e.updateCall=e.Debug.deprecate(e.factory.updateCallExpression,a),e.createCallChain=e.Debug.deprecate(e.factory.createCallChain,a),e.updateCallChain=e.Debug.deprecate(e.factory.updateCallChain,a),e.createNew=e.Debug.deprecate(e.factory.createNewExpression,a),e.updateNew=e.Debug.deprecate(e.factory.updateNewExpression,a),e.createTypeAssertion=e.Debug.deprecate(e.factory.createTypeAssertion,a),e.updateTypeAssertion=e.Debug.deprecate(e.factory.updateTypeAssertion,a),e.createParen=e.Debug.deprecate(e.factory.createParenthesizedExpression,a),e.updateParen=e.Debug.deprecate(e.factory.updateParenthesizedExpression,a),e.createFunctionExpression=e.Debug.deprecate(e.factory.createFunctionExpression,a),e.updateFunctionExpression=e.Debug.deprecate(e.factory.updateFunctionExpression,a),e.createDelete=e.Debug.deprecate(e.factory.createDeleteExpression,a),e.updateDelete=e.Debug.deprecate(e.factory.updateDeleteExpression,a),e.createTypeOf=e.Debug.deprecate(e.factory.createTypeOfExpression,a),e.updateTypeOf=e.Debug.deprecate(e.factory.updateTypeOfExpression,a),e.createVoid=e.Debug.deprecate(e.factory.createVoidExpression,a),e.updateVoid=e.Debug.deprecate(e.factory.updateVoidExpression,a),e.createAwait=e.Debug.deprecate(e.factory.createAwaitExpression,a),e.updateAwait=e.Debug.deprecate(e.factory.updateAwaitExpression,a),e.createPrefix=e.Debug.deprecate(e.factory.createPrefixUnaryExpression,a),e.updatePrefix=e.Debug.deprecate(e.factory.updatePrefixUnaryExpression,a),e.createPostfix=e.Debug.deprecate(e.factory.createPostfixUnaryExpression,a),e.updatePostfix=e.Debug.deprecate(e.factory.updatePostfixUnaryExpression,a),e.createBinary=e.Debug.deprecate(e.factory.createBinaryExpression,a),e.updateConditional=e.Debug.deprecate(e.factory.updateConditionalExpression,a),e.createTemplateExpression=e.Debug.deprecate(e.factory.createTemplateExpression,a),e.updateTemplateExpression=e.Debug.deprecate(e.factory.updateTemplateExpression,a),e.createTemplateHead=e.Debug.deprecate(e.factory.createTemplateHead,a),e.createTemplateMiddle=e.Debug.deprecate(e.factory.createTemplateMiddle,a),e.createTemplateTail=e.Debug.deprecate(e.factory.createTemplateTail,a),e.createNoSubstitutionTemplateLiteral=e.Debug.deprecate(e.factory.createNoSubstitutionTemplateLiteral,a),e.updateYield=e.Debug.deprecate(e.factory.updateYieldExpression,a),e.createSpread=e.Debug.deprecate(e.factory.createSpreadElement,a),e.updateSpread=e.Debug.deprecate(e.factory.updateSpreadElement,a),e.createOmittedExpression=e.Debug.deprecate(e.factory.createOmittedExpression,a),e.createAsExpression=e.Debug.deprecate(e.factory.createAsExpression,a),e.updateAsExpression=e.Debug.deprecate(e.factory.updateAsExpression,a),e.createNonNullExpression=e.Debug.deprecate(e.factory.createNonNullExpression,a),e.updateNonNullExpression=e.Debug.deprecate(e.factory.updateNonNullExpression,a),e.createNonNullChain=e.Debug.deprecate(e.factory.createNonNullChain,a),e.updateNonNullChain=e.Debug.deprecate(e.factory.updateNonNullChain,a),e.createMetaProperty=e.Debug.deprecate(e.factory.createMetaProperty,a),e.updateMetaProperty=e.Debug.deprecate(e.factory.updateMetaProperty,a),e.createTemplateSpan=e.Debug.deprecate(e.factory.createTemplateSpan,a),e.updateTemplateSpan=e.Debug.deprecate(e.factory.updateTemplateSpan,a),e.createSemicolonClassElement=e.Debug.deprecate(e.factory.createSemicolonClassElement,a),e.createBlock=e.Debug.deprecate(e.factory.createBlock,a),e.updateBlock=e.Debug.deprecate(e.factory.updateBlock,a),e.createVariableStatement=e.Debug.deprecate(e.factory.createVariableStatement,a),e.updateVariableStatement=e.Debug.deprecate(e.factory.updateVariableStatement,a),e.createEmptyStatement=e.Debug.deprecate(e.factory.createEmptyStatement,a),e.createExpressionStatement=e.Debug.deprecate(e.factory.createExpressionStatement,a),e.updateExpressionStatement=e.Debug.deprecate(e.factory.updateExpressionStatement,a),e.createStatement=e.Debug.deprecate(e.factory.createExpressionStatement,a),e.updateStatement=e.Debug.deprecate(e.factory.updateExpressionStatement,a),e.createIf=e.Debug.deprecate(e.factory.createIfStatement,a),e.updateIf=e.Debug.deprecate(e.factory.updateIfStatement,a),e.createDo=e.Debug.deprecate(e.factory.createDoStatement,a),e.updateDo=e.Debug.deprecate(e.factory.updateDoStatement,a),e.createWhile=e.Debug.deprecate(e.factory.createWhileStatement,a),e.updateWhile=e.Debug.deprecate(e.factory.updateWhileStatement,a),e.createFor=e.Debug.deprecate(e.factory.createForStatement,a),e.updateFor=e.Debug.deprecate(e.factory.updateForStatement,a),e.createForIn=e.Debug.deprecate(e.factory.createForInStatement,a),e.updateForIn=e.Debug.deprecate(e.factory.updateForInStatement,a),e.createForOf=e.Debug.deprecate(e.factory.createForOfStatement,a),e.updateForOf=e.Debug.deprecate(e.factory.updateForOfStatement,a),e.createContinue=e.Debug.deprecate(e.factory.createContinueStatement,a),e.updateContinue=e.Debug.deprecate(e.factory.updateContinueStatement,a),e.createBreak=e.Debug.deprecate(e.factory.createBreakStatement,a),e.updateBreak=e.Debug.deprecate(e.factory.updateBreakStatement,a),e.createReturn=e.Debug.deprecate(e.factory.createReturnStatement,a),e.updateReturn=e.Debug.deprecate(e.factory.updateReturnStatement,a),e.createWith=e.Debug.deprecate(e.factory.createWithStatement,a),e.updateWith=e.Debug.deprecate(e.factory.updateWithStatement,a),e.createSwitch=e.Debug.deprecate(e.factory.createSwitchStatement,a),e.updateSwitch=e.Debug.deprecate(e.factory.updateSwitchStatement,a),e.createLabel=e.Debug.deprecate(e.factory.createLabeledStatement,a),e.updateLabel=e.Debug.deprecate(e.factory.updateLabeledStatement,a),e.createThrow=e.Debug.deprecate(e.factory.createThrowStatement,a),e.updateThrow=e.Debug.deprecate(e.factory.updateThrowStatement,a),e.createTry=e.Debug.deprecate(e.factory.createTryStatement,a),e.updateTry=e.Debug.deprecate(e.factory.updateTryStatement,a),e.createDebuggerStatement=e.Debug.deprecate(e.factory.createDebuggerStatement,a),e.createVariableDeclarationList=e.Debug.deprecate(e.factory.createVariableDeclarationList,a),e.updateVariableDeclarationList=e.Debug.deprecate(e.factory.updateVariableDeclarationList,a),e.createFunctionDeclaration=e.Debug.deprecate(e.factory.createFunctionDeclaration,a),e.updateFunctionDeclaration=e.Debug.deprecate(e.factory.updateFunctionDeclaration,a),e.createClassDeclaration=e.Debug.deprecate(e.factory.createClassDeclaration,a),e.updateClassDeclaration=e.Debug.deprecate(e.factory.updateClassDeclaration,a),e.createInterfaceDeclaration=e.Debug.deprecate(e.factory.createInterfaceDeclaration,a),e.updateInterfaceDeclaration=e.Debug.deprecate(e.factory.updateInterfaceDeclaration,a),e.createTypeAliasDeclaration=e.Debug.deprecate(e.factory.createTypeAliasDeclaration,a),e.updateTypeAliasDeclaration=e.Debug.deprecate(e.factory.updateTypeAliasDeclaration,a),e.createEnumDeclaration=e.Debug.deprecate(e.factory.createEnumDeclaration,a),e.updateEnumDeclaration=e.Debug.deprecate(e.factory.updateEnumDeclaration,a),e.createModuleDeclaration=e.Debug.deprecate(e.factory.createModuleDeclaration,a),e.updateModuleDeclaration=e.Debug.deprecate(e.factory.updateModuleDeclaration,a),e.createModuleBlock=e.Debug.deprecate(e.factory.createModuleBlock,a),e.updateModuleBlock=e.Debug.deprecate(e.factory.updateModuleBlock,a),e.createCaseBlock=e.Debug.deprecate(e.factory.createCaseBlock,a),e.updateCaseBlock=e.Debug.deprecate(e.factory.updateCaseBlock,a),e.createNamespaceExportDeclaration=e.Debug.deprecate(e.factory.createNamespaceExportDeclaration,a),e.updateNamespaceExportDeclaration=e.Debug.deprecate(e.factory.updateNamespaceExportDeclaration,a),e.createImportEqualsDeclaration=e.Debug.deprecate(e.factory.createImportEqualsDeclaration,a),e.updateImportEqualsDeclaration=e.Debug.deprecate(e.factory.updateImportEqualsDeclaration,a),e.createImportDeclaration=e.Debug.deprecate(e.factory.createImportDeclaration,a),e.updateImportDeclaration=e.Debug.deprecate(e.factory.updateImportDeclaration,a),e.createNamespaceImport=e.Debug.deprecate(e.factory.createNamespaceImport,a),e.updateNamespaceImport=e.Debug.deprecate(e.factory.updateNamespaceImport,a),e.createNamedImports=e.Debug.deprecate(e.factory.createNamedImports,a),e.updateNamedImports=e.Debug.deprecate(e.factory.updateNamedImports,a),e.createImportSpecifier=e.Debug.deprecate(e.factory.createImportSpecifier,a),e.updateImportSpecifier=e.Debug.deprecate(e.factory.updateImportSpecifier,a),e.createExportAssignment=e.Debug.deprecate(e.factory.createExportAssignment,a),e.updateExportAssignment=e.Debug.deprecate(e.factory.updateExportAssignment,a),e.createNamedExports=e.Debug.deprecate(e.factory.createNamedExports,a),e.updateNamedExports=e.Debug.deprecate(e.factory.updateNamedExports,a),e.createExportSpecifier=e.Debug.deprecate(e.factory.createExportSpecifier,a),e.updateExportSpecifier=e.Debug.deprecate(e.factory.updateExportSpecifier,a),e.createExternalModuleReference=e.Debug.deprecate(e.factory.createExternalModuleReference,a),e.updateExternalModuleReference=e.Debug.deprecate(e.factory.updateExternalModuleReference,a),e.createJSDocTypeExpression=e.Debug.deprecate(e.factory.createJSDocTypeExpression,a),e.createJSDocTypeTag=e.Debug.deprecate(e.factory.createJSDocTypeTag,a),e.createJSDocReturnTag=e.Debug.deprecate(e.factory.createJSDocReturnTag,a),e.createJSDocThisTag=e.Debug.deprecate(e.factory.createJSDocThisTag,a),e.createJSDocComment=e.Debug.deprecate(e.factory.createJSDocComment,a),e.createJSDocParameterTag=e.Debug.deprecate(e.factory.createJSDocParameterTag,a),e.createJSDocClassTag=e.Debug.deprecate(e.factory.createJSDocClassTag,a),e.createJSDocAugmentsTag=e.Debug.deprecate(e.factory.createJSDocAugmentsTag,a),e.createJSDocEnumTag=e.Debug.deprecate(e.factory.createJSDocEnumTag,a),e.createJSDocTemplateTag=e.Debug.deprecate(e.factory.createJSDocTemplateTag,a),e.createJSDocTypedefTag=e.Debug.deprecate(e.factory.createJSDocTypedefTag,a),e.createJSDocCallbackTag=e.Debug.deprecate(e.factory.createJSDocCallbackTag,a),e.createJSDocSignature=e.Debug.deprecate(e.factory.createJSDocSignature,a),e.createJSDocPropertyTag=e.Debug.deprecate(e.factory.createJSDocPropertyTag,a),e.createJSDocTypeLiteral=e.Debug.deprecate(e.factory.createJSDocTypeLiteral,a),e.createJSDocImplementsTag=e.Debug.deprecate(e.factory.createJSDocImplementsTag,a),e.createJSDocAuthorTag=e.Debug.deprecate(e.factory.createJSDocAuthorTag,a),e.createJSDocPublicTag=e.Debug.deprecate(e.factory.createJSDocPublicTag,a),e.createJSDocPrivateTag=e.Debug.deprecate(e.factory.createJSDocPrivateTag,a),e.createJSDocProtectedTag=e.Debug.deprecate(e.factory.createJSDocProtectedTag,a),e.createJSDocReadonlyTag=e.Debug.deprecate(e.factory.createJSDocReadonlyTag,a),e.createJSDocTag=e.Debug.deprecate(e.factory.createJSDocUnknownTag,a),e.createJsxElement=e.Debug.deprecate(e.factory.createJsxElement,a),e.updateJsxElement=e.Debug.deprecate(e.factory.updateJsxElement,a),e.createJsxSelfClosingElement=e.Debug.deprecate(e.factory.createJsxSelfClosingElement,a),e.updateJsxSelfClosingElement=e.Debug.deprecate(e.factory.updateJsxSelfClosingElement,a),e.createJsxOpeningElement=e.Debug.deprecate(e.factory.createJsxOpeningElement,a),e.updateJsxOpeningElement=e.Debug.deprecate(e.factory.updateJsxOpeningElement,a),e.createJsxClosingElement=e.Debug.deprecate(e.factory.createJsxClosingElement,a),e.updateJsxClosingElement=e.Debug.deprecate(e.factory.updateJsxClosingElement,a),e.createJsxFragment=e.Debug.deprecate(e.factory.createJsxFragment,a),e.createJsxText=e.Debug.deprecate(e.factory.createJsxText,a),e.updateJsxText=e.Debug.deprecate(e.factory.updateJsxText,a),e.createJsxOpeningFragment=e.Debug.deprecate(e.factory.createJsxOpeningFragment,a),e.createJsxJsxClosingFragment=e.Debug.deprecate(e.factory.createJsxJsxClosingFragment,a),e.updateJsxFragment=e.Debug.deprecate(e.factory.updateJsxFragment,a),e.createJsxAttribute=e.Debug.deprecate(e.factory.createJsxAttribute,a),e.updateJsxAttribute=e.Debug.deprecate(e.factory.updateJsxAttribute,a),e.createJsxAttributes=e.Debug.deprecate(e.factory.createJsxAttributes,a),e.updateJsxAttributes=e.Debug.deprecate(e.factory.updateJsxAttributes,a),e.createJsxSpreadAttribute=e.Debug.deprecate(e.factory.createJsxSpreadAttribute,a),e.updateJsxSpreadAttribute=e.Debug.deprecate(e.factory.updateJsxSpreadAttribute,a),e.createJsxExpression=e.Debug.deprecate(e.factory.createJsxExpression,a),e.updateJsxExpression=e.Debug.deprecate(e.factory.updateJsxExpression,a),e.createCaseClause=e.Debug.deprecate(e.factory.createCaseClause,a),e.updateCaseClause=e.Debug.deprecate(e.factory.updateCaseClause,a),e.createDefaultClause=e.Debug.deprecate(e.factory.createDefaultClause,a),e.updateDefaultClause=e.Debug.deprecate(e.factory.updateDefaultClause,a),e.createHeritageClause=e.Debug.deprecate(e.factory.createHeritageClause,a),e.updateHeritageClause=e.Debug.deprecate(e.factory.updateHeritageClause,a),e.createCatchClause=e.Debug.deprecate(e.factory.createCatchClause,a),e.updateCatchClause=e.Debug.deprecate(e.factory.updateCatchClause,a),e.createPropertyAssignment=e.Debug.deprecate(e.factory.createPropertyAssignment,a),e.updatePropertyAssignment=e.Debug.deprecate(e.factory.updatePropertyAssignment,a),e.createShorthandPropertyAssignment=e.Debug.deprecate(e.factory.createShorthandPropertyAssignment,a),e.updateShorthandPropertyAssignment=e.Debug.deprecate(e.factory.updateShorthandPropertyAssignment,a),e.createSpreadAssignment=e.Debug.deprecate(e.factory.createSpreadAssignment,a),e.updateSpreadAssignment=e.Debug.deprecate(e.factory.updateSpreadAssignment,a),e.createEnumMember=e.Debug.deprecate(e.factory.createEnumMember,a),e.updateEnumMember=e.Debug.deprecate(e.factory.updateEnumMember,a),e.updateSourceFileNode=e.Debug.deprecate(e.factory.updateSourceFile,a),e.createNotEmittedStatement=e.Debug.deprecate(e.factory.createNotEmittedStatement,a),e.createPartiallyEmittedExpression=e.Debug.deprecate(e.factory.createPartiallyEmittedExpression,a),e.updatePartiallyEmittedExpression=e.Debug.deprecate(e.factory.updatePartiallyEmittedExpression,a),e.createCommaList=e.Debug.deprecate(e.factory.createCommaListExpression,a),e.updateCommaList=e.Debug.deprecate(e.factory.updateCommaListExpression,a),e.createBundle=e.Debug.deprecate(e.factory.createBundle,a),e.updateBundle=e.Debug.deprecate(e.factory.updateBundle,a),e.createImmediatelyInvokedFunctionExpression=e.Debug.deprecate(e.factory.createImmediatelyInvokedFunctionExpression,a),e.createImmediatelyInvokedArrowFunction=e.Debug.deprecate(e.factory.createImmediatelyInvokedArrowFunction,a),e.createVoidZero=e.Debug.deprecate(e.factory.createVoidZero,a),e.createExportDefault=e.Debug.deprecate(e.factory.createExportDefault,a),e.createExternalModuleExport=e.Debug.deprecate(e.factory.createExternalModuleExport,a),e.createNamespaceExport=e.Debug.deprecate(e.factory.createNamespaceExport,a),e.updateNamespaceExport=e.Debug.deprecate(e.factory.updateNamespaceExport,a),e.createToken=e.Debug.deprecate(n(function(v){return e.factory.createToken(v)},"createToken"),a),e.createIdentifier=e.Debug.deprecate(n(function(v){return e.factory.createIdentifier(v,void 0,void 0)},"createIdentifier"),a),e.createTempVariable=e.Debug.deprecate(n(function(v){return e.factory.createTempVariable(v,void 0)},"createTempVariable"),a),e.getGeneratedNameForNode=e.Debug.deprecate(n(function(v){return e.factory.getGeneratedNameForNode(v,void 0)},"getGeneratedNameForNode"),a),e.createOptimisticUniqueName=e.Debug.deprecate(n(function(v){return e.factory.createUniqueName(v,16)},"createOptimisticUniqueName"),a),e.createFileLevelUniqueName=e.Debug.deprecate(n(function(v){return e.factory.createUniqueName(v,48)},"createFileLevelUniqueName"),a),e.createIndexSignature=e.Debug.deprecate(n(function(v,O,h,B){return e.factory.createIndexSignature(v,O,h,B)},"createIndexSignature"),a),e.createTypePredicateNode=e.Debug.deprecate(n(function(v,O){return e.factory.createTypePredicateNode(void 0,v,O)},"createTypePredicateNode"),a),e.updateTypePredicateNode=e.Debug.deprecate(n(function(v,O,h){return e.factory.updateTypePredicateNode(v,void 0,O,h)},"updateTypePredicateNode"),a),e.createLiteral=e.Debug.deprecate(n(function(v){return typeof v=="number"?e.factory.createNumericLiteral(v):typeof v=="object"&&"base10Value"in v?e.factory.createBigIntLiteral(v):typeof v=="boolean"?v?e.factory.createTrue():e.factory.createFalse():typeof v=="string"?e.factory.createStringLiteral(v,void 0):e.factory.createStringLiteralFromNode(v)},"createLiteral"),{since:"4.0",warnAfter:"4.1",message:"Use `factory.createStringLiteral`, `factory.createStringLiteralFromNode`, `factory.createNumericLiteral`, `factory.createBigIntLiteral`, `factory.createTrue`, `factory.createFalse`, or the factory supplied by your transformation context instead."}),e.createMethodSignature=e.Debug.deprecate(n(function(v,O,h,B,re){return e.factory.createMethodSignature(void 0,B,re,v,O,h)},"createMethodSignature"),a),e.updateMethodSignature=e.Debug.deprecate(n(function(v,O,h,B,re,z){return e.factory.updateMethodSignature(v,v.modifiers,re,z,O,h,B)},"updateMethodSignature"),a),e.createTypeOperatorNode=e.Debug.deprecate(n(function(v,O){var h;return O?h=v:(O=v,h=141),e.factory.createTypeOperatorNode(h,O)},"createTypeOperatorNode"),a),e.createTaggedTemplate=e.Debug.deprecate(n(function(v,O,h){var B;return h?B=O:h=O,e.factory.createTaggedTemplateExpression(v,B,h)},"createTaggedTemplate"),a),e.updateTaggedTemplate=e.Debug.deprecate(n(function(v,O,h,B){var re;return B?re=h:B=h,e.factory.updateTaggedTemplateExpression(v,O,re,B)},"updateTaggedTemplate"),a),e.updateBinary=e.Debug.deprecate(n(function(v,O,h,B){return B===void 0&&(B=v.operatorToken),typeof B=="number"&&(B=B===v.operatorToken.kind?v.operatorToken:e.factory.createToken(B)),e.factory.updateBinaryExpression(v,O,B,h)},"updateBinary"),a),e.createConditional=e.Debug.deprecate(n(function(v,O,h,B,re){return arguments.length===5?e.factory.createConditionalExpression(v,O,h,B,re):arguments.length===3?e.factory.createConditionalExpression(v,e.factory.createToken(57),O,e.factory.createToken(58),h):e.Debug.fail("Argument count mismatch")},"createConditional"),a),e.createYield=e.Debug.deprecate(n(function(v,O){var h;return O?h=v:O=v,e.factory.createYieldExpression(h,O)},"createYield"),a),e.createClassExpression=e.Debug.deprecate(n(function(v,O,h,B,re){return e.factory.createClassExpression(void 0,v,O,h,B,re)},"createClassExpression"),a),e.updateClassExpression=e.Debug.deprecate(n(function(v,O,h,B,re,z){return e.factory.updateClassExpression(v,void 0,O,h,B,re,z)},"updateClassExpression"),a),e.createPropertySignature=e.Debug.deprecate(n(function(v,O,h,B,re){var z=e.factory.createPropertySignature(v,O,h,B);return z.initializer=re,z},"createPropertySignature"),a),e.updatePropertySignature=e.Debug.deprecate(n(function(v,O,h,B,re,z){var p=e.factory.updatePropertySignature(v,O,h,B,re);return v.initializer!==z&&(p===v&&(p=e.factory.cloneNode(v)),p.initializer=z),p},"updatePropertySignature"),a),e.createExpressionWithTypeArguments=e.Debug.deprecate(n(function(v,O){return e.factory.createExpressionWithTypeArguments(O,v)},"createExpressionWithTypeArguments"),a),e.updateExpressionWithTypeArguments=e.Debug.deprecate(n(function(v,O,h){return e.factory.updateExpressionWithTypeArguments(v,h,O)},"updateExpressionWithTypeArguments"),a),e.createArrowFunction=e.Debug.deprecate(n(function(v,O,h,B,re,z){return arguments.length===6?e.factory.createArrowFunction(v,O,h,B,re,z):arguments.length===5?e.factory.createArrowFunction(v,O,h,B,void 0,re):e.Debug.fail("Argument count mismatch")},"createArrowFunction"),a),e.updateArrowFunction=e.Debug.deprecate(n(function(v,O,h,B,re,z,p){return arguments.length===7?e.factory.updateArrowFunction(v,O,h,B,re,z,p):arguments.length===6?e.factory.updateArrowFunction(v,O,h,B,re,v.equalsGreaterThanToken,z):e.Debug.fail("Argument count mismatch")},"updateArrowFunction"),a),e.createVariableDeclaration=e.Debug.deprecate(n(function(v,O,h,B){return arguments.length===4?e.factory.createVariableDeclaration(v,O,h,B):arguments.length>=1&&arguments.length<=3?e.factory.createVariableDeclaration(v,void 0,O,h):e.Debug.fail("Argument count mismatch")},"createVariableDeclaration"),a),e.updateVariableDeclaration=e.Debug.deprecate(n(function(v,O,h,B,re){return arguments.length===5?e.factory.updateVariableDeclaration(v,O,h,B,re):arguments.length===4?e.factory.updateVariableDeclaration(v,O,v.exclamationToken,h,B):e.Debug.fail("Argument count mismatch")},"updateVariableDeclaration"),a),e.createImportClause=e.Debug.deprecate(n(function(v,O,h){return h===void 0&&(h=!1),e.factory.createImportClause(h,v,O)},"createImportClause"),a),e.updateImportClause=e.Debug.deprecate(n(function(v,O,h,B){return e.factory.updateImportClause(v,B,O,h)},"updateImportClause"),a),e.createExportDeclaration=e.Debug.deprecate(n(function(v,O,h,B,re){return re===void 0&&(re=!1),e.factory.createExportDeclaration(v,O,re,h,B)},"createExportDeclaration"),a),e.updateExportDeclaration=e.Debug.deprecate(n(function(v,O,h,B,re,z){return e.factory.updateExportDeclaration(v,O,h,z,B,re,v.assertClause)},"updateExportDeclaration"),a),e.createJSDocParamTag=e.Debug.deprecate(n(function(v,O,h,B){return e.factory.createJSDocParameterTag(void 0,v,O,h,!1,B?e.factory.createNodeArray([e.factory.createJSDocText(B)]):void 0)},"createJSDocParamTag"),a),e.createComma=e.Debug.deprecate(n(function(v,O){return e.factory.createComma(v,O)},"createComma"),a),e.createLessThan=e.Debug.deprecate(n(function(v,O){return e.factory.createLessThan(v,O)},"createLessThan"),a),e.createAssignment=e.Debug.deprecate(n(function(v,O){return e.factory.createAssignment(v,O)},"createAssignment"),a),e.createStrictEquality=e.Debug.deprecate(n(function(v,O){return e.factory.createStrictEquality(v,O)},"createStrictEquality"),a),e.createStrictInequality=e.Debug.deprecate(n(function(v,O){return e.factory.createStrictInequality(v,O)},"createStrictInequality"),a),e.createAdd=e.Debug.deprecate(n(function(v,O){return e.factory.createAdd(v,O)},"createAdd"),a),e.createSubtract=e.Debug.deprecate(n(function(v,O){return e.factory.createSubtract(v,O)},"createSubtract"),a),e.createLogicalAnd=e.Debug.deprecate(n(function(v,O){return e.factory.createLogicalAnd(v,O)},"createLogicalAnd"),a),e.createLogicalOr=e.Debug.deprecate(n(function(v,O){return e.factory.createLogicalOr(v,O)},"createLogicalOr"),a),e.createPostfixIncrement=e.Debug.deprecate(n(function(v){return e.factory.createPostfixIncrement(v)},"createPostfixIncrement"),a),e.createLogicalNot=e.Debug.deprecate(n(function(v){return e.factory.createLogicalNot(v)},"createLogicalNot"),a),e.createNode=e.Debug.deprecate(n(function(v,O,h){return O===void 0&&(O=0),h===void 0&&(h=0),e.setTextRangePosEnd(v===308?e.parseBaseNodeFactory.createBaseSourceFileNode(v):v===79?e.parseBaseNodeFactory.createBaseIdentifierNode(v):v===80?e.parseBaseNodeFactory.createBasePrivateIdentifierNode(v):e.isNodeKind(v)?e.parseBaseNodeFactory.createBaseNode(v):e.parseBaseNodeFactory.createBaseTokenNode(v),O,h)},"createNode"),{since:"4.0",warnAfter:"4.1",message:"Use an appropriate `factory` method instead."}),e.getMutableClone=e.Debug.deprecate(n(function(v){var O=e.factory.cloneNode(v);return e.setTextRange(O,v),e.setParent(O,v.parent),O},"getMutableClone"),{since:"4.0",warnAfter:"4.1",message:"Use an appropriate `factory.update...` method instead, use `setCommentRange` or `setSourceMapRange`, and avoid setting `parent`."})})(_r||(_r={}));var _r;(function(e){e.isTypeAssertion=e.Debug.deprecate(n(function(y){return y.kind===213},"isTypeAssertion"),{since:"4.0",warnAfter:"4.1",message:"Use `isTypeAssertionExpression` instead."})})(_r||(_r={}));var _r;(function(e){e.isIdentifierOrPrivateIdentifier=e.Debug.deprecate(n(function(y){return e.isMemberName(y)},"isIdentifierOrPrivateIdentifier"),{since:"4.2",warnAfter:"4.3",message:"Use `isMemberName` instead."})})(_r||(_r={}));var _r;(function(e){function a(v){var O=v.createConstructorTypeNode,h=v.updateConstructorTypeNode;v.createConstructorTypeNode=e.buildOverload("createConstructorTypeNode").overload({0:function(B,re,z,p){return O(B,re,z,p)},1:function(B,re,z){return O(void 0,B,re,z)}}).bind({0:function(B){return B.length===4},1:function(B){return B.length===3}}).deprecate({1:{since:"4.2",warnAfter:"4.3",message:"Use the overload that accepts 'modifiers'"}}).finish(),v.updateConstructorTypeNode=e.buildOverload("updateConstructorTypeNode").overload({0:function(B,re,z,p,m){return h(B,re,z,p,m)},1:function(B,re,z,p){return h(B,B.modifiers,re,z,p)}}).bind({0:function(B){return B.length===5},1:function(B){return B.length===4}}).deprecate({1:{since:"4.2",warnAfter:"4.3",message:"Use the overload that accepts 'modifiers'"}}).finish()}n(a,"patchNodeFactory");var y=e.createNodeFactory;e.createNodeFactory=function(v,O){var h=y(v,O);return a(h),h},a(e.factory)})(_r||(_r={}));var _r;(function(e){function a(v){var O=v.createImportTypeNode,h=v.updateImportTypeNode;v.createImportTypeNode=e.buildOverload("createImportTypeNode").overload({0:function(B,re,z,p,m){return O(B,re,z,p,m)},1:function(B,re,z,p){return O(B,void 0,re,z,p)}}).bind({0:function(B){var re=B[1],z=B[2],p=B[3],m=B[4];return(re===void 0||e.isImportTypeAssertionContainer(re))&&(z===void 0||!e.isArray(z))&&(p===void 0||e.isArray(p))&&(m===void 0||typeof m=="boolean")},1:function(B){var re=B[1],z=B[2],p=B[3],m=B[4];return m===void 0&&(re===void 0||e.isEntityName(re))&&(z===void 0||e.isArray(z))&&(p===void 0||typeof p=="boolean")}}).deprecate({1:{since:"4.6",warnAfter:"4.7",message:"Use the overload that accepts 'assertions'"}}).finish(),v.updateImportTypeNode=e.buildOverload("updateImportTypeNode").overload({0:function(B,re,z,p,m,fe){return h(B,re,z,p,m,fe)},1:function(B,re,z,p,m){return h(B,re,B.assertions,z,p,m)}}).bind({0:function(B){var re=B[2],z=B[3],p=B[4],m=B[5];return(re===void 0||e.isImportTypeAssertionContainer(re))&&(z===void 0||!e.isArray(z))&&(p===void 0||e.isArray(p))&&(m===void 0||typeof m=="boolean")},1:function(B){var re=B[2],z=B[3],p=B[4],m=B[5];return m===void 0&&(re===void 0||e.isEntityName(re))&&(z===void 0||e.isArray(z))&&(p===void 0||typeof p=="boolean")}}).deprecate({1:{since:"4.6",warnAfter:"4.7",message:"Use the overload that accepts 'assertions'"}}).finish()}n(a,"patchNodeFactory");var y=e.createNodeFactory;e.createNodeFactory=function(v,O){var h=y(v,O);return a(h),h},a(e.factory)})(_r||(_r={}));var _r;(function(e){function a(v){var O=v.createTypeParameterDeclaration,h=v.updateTypeParameterDeclaration;v.createTypeParameterDeclaration=e.buildOverload("createTypeParameterDeclaration").overload({0:function(B,re,z,p){return O(B,re,z,p)},1:function(B,re,z){return O(void 0,B,re,z)}}).bind({0:function(B){var re=B[0];return re===void 0||e.isArray(re)},1:function(B){var re=B[0];return re!==void 0&&!e.isArray(re)}}).deprecate({1:{since:"4.7",warnAfter:"4.8",message:"Use the overload that accepts 'modifiers'"}}).finish(),v.updateTypeParameterDeclaration=e.buildOverload("updateTypeParameterDeclaration").overload({0:function(B,re,z,p,m){return h(B,re,z,p,m)},1:function(B,re,z,p){return h(B,B.modifiers,re,z,p)}}).bind({0:function(B){var re=B[1];return re===void 0||e.isArray(re)},1:function(B){var re=B[1];return re!==void 0&&!e.isArray(re)}}).deprecate({1:{since:"4.7",warnAfter:"4.8",message:"Use the overload that accepts 'modifiers'"}}).finish()}n(a,"patchNodeFactory");var y=e.createNodeFactory;e.createNodeFactory=function(v,O){var h=y(v,O);return a(h),h},a(e.factory)})(_r||(_r={}));var _r;(function(e){var a={since:"4.8",warnAfter:"4.9.0-0",message:"Decorators have been combined with modifiers. Callers should switch to an overload that does not accept a 'decorators' parameter."},y={since:"4.8",warnAfter:"4.9.0-0",message:"Decorators are no longer supported for this function. Callers should switch to an overload that does not accept a 'decorators' parameter."},v={since:"4.8",warnAfter:"4.9.0-0",message:"Decorators and modifiers are no longer supported for this function. Callers should switch to an overload that does not accept the 'decorators' and 'modifiers' parameters."};function O(B){var re=B.createParameterDeclaration,z=B.updateParameterDeclaration,p=B.createPropertyDeclaration,m=B.updatePropertyDeclaration,fe=B.createMethodDeclaration,le=B.updateMethodDeclaration,se=B.createConstructorDeclaration,ce=B.updateConstructorDeclaration,ue=B.createGetAccessorDeclaration,F=B.updateGetAccessorDeclaration,L=B.createSetAccessorDeclaration,_=B.updateSetAccessorDeclaration,b=B.createIndexSignature,x=B.updateIndexSignature,E=B.createClassStaticBlockDeclaration,P=B.updateClassStaticBlockDeclaration,A=B.createClassExpression,ve=B.updateClassExpression,be=B.createFunctionDeclaration,Z=B.updateFunctionDeclaration,J=B.createClassDeclaration,$=B.updateClassDeclaration,Y=B.createInterfaceDeclaration,C=B.updateInterfaceDeclaration,j=B.createTypeAliasDeclaration,ae=B.updateTypeAliasDeclaration,U=B.createEnumDeclaration,M=B.updateEnumDeclaration,w=B.createModuleDeclaration,G=B.updateModuleDeclaration,X=B.createImportEqualsDeclaration,ee=B.updateImportEqualsDeclaration,De=B.createImportDeclaration,T=B.updateImportDeclaration,k=B.createExportAssignment,N=B.updateExportAssignment,ie=B.createExportDeclaration,V=B.updateExportDeclaration;B.createParameterDeclaration=e.buildOverload("createParameterDeclaration").overload({0:function(l,I,R,K,H,me){return re(l,I,R,K,H,me)},1:function(l,I,R,K,H,me,ge){return re(e.concatenate(l,I),R,K,H,me,ge)}}).bind({0:function(l){var I=l[1],R=l[2],K=l[3],H=l[4],me=l[5],ge=l[6];return ge===void 0&&(I===void 0||!e.isArray(I))&&(R===void 0||typeof R=="string"||e.isBindingName(R))&&(K===void 0||typeof K=="object"&&e.isQuestionToken(K))&&(H===void 0||e.isTypeNode(H))&&(me===void 0||e.isExpression(me))},1:function(l){var I=l[1],R=l[2],K=l[3],H=l[4],me=l[5],ge=l[6];return(I===void 0||e.isArray(I))&&(R===void 0||typeof R=="object"&&e.isDotDotDotToken(R))&&(K===void 0||typeof K=="string"||e.isBindingName(K))&&(H===void 0||e.isQuestionToken(H))&&(me===void 0||e.isTypeNode(me))&&(ge===void 0||e.isExpression(ge))}}).deprecate({1:a}).finish(),B.updateParameterDeclaration=e.buildOverload("updateParameterDeclaration").overload({0:function(l,I,R,K,H,me,ge){return z(l,I,R,K,H,me,ge)},1:function(l,I,R,K,H,me,ge,Ke){return z(l,e.concatenate(I,R),K,H,me,ge,Ke)}}).bind({0:function(l){var I=l[2],R=l[3],K=l[4],H=l[5],me=l[6],ge=l[7];return ge===void 0&&(I===void 0||!e.isArray(I))&&(R===void 0||typeof R=="string"||e.isBindingName(R))&&(K===void 0||typeof K=="object"&&e.isQuestionToken(K))&&(H===void 0||e.isTypeNode(H))&&(me===void 0||e.isExpression(me))},1:function(l){var I=l[2],R=l[3],K=l[4],H=l[5],me=l[6],ge=l[7];return(I===void 0||e.isArray(I))&&(R===void 0||typeof R=="object"&&e.isDotDotDotToken(R))&&(K===void 0||typeof K=="string"||e.isBindingName(K))&&(H===void 0||e.isQuestionToken(H))&&(me===void 0||e.isTypeNode(me))&&(ge===void 0||e.isExpression(ge))}}).deprecate({1:a}).finish(),B.createPropertyDeclaration=e.buildOverload("createPropertyDeclaration").overload({0:function(l,I,R,K,H){return p(l,I,R,K,H)},1:function(l,I,R,K,H,me){return p(e.concatenate(l,I),R,K,H,me)}}).bind({0:function(l){var I=l[1],R=l[2],K=l[3],H=l[4],me=l[5];return me===void 0&&(I===void 0||!e.isArray(I))&&(R===void 0||typeof R=="object"&&e.isQuestionOrExclamationToken(R))&&(K===void 0||e.isTypeNode(K))&&(H===void 0||e.isExpression(H))},1:function(l){var I=l[1],R=l[2],K=l[3],H=l[4],me=l[5];return(I===void 0||e.isArray(I))&&(R===void 0||typeof R=="string"||e.isPropertyName(R))&&(K===void 0||e.isQuestionOrExclamationToken(K))&&(H===void 0||e.isTypeNode(H))&&(me===void 0||e.isExpression(me))}}).deprecate({1:a}).finish(),B.updatePropertyDeclaration=e.buildOverload("updatePropertyDeclaration").overload({0:function(l,I,R,K,H,me){return m(l,I,R,K,H,me)},1:function(l,I,R,K,H,me,ge){return m(l,e.concatenate(I,R),K,H,me,ge)}}).bind({0:function(l){var I=l[2],R=l[3],K=l[4],H=l[5],me=l[6];return me===void 0&&(I===void 0||!e.isArray(I))&&(R===void 0||typeof R=="object"&&e.isQuestionOrExclamationToken(R))&&(K===void 0||e.isTypeNode(K))&&(H===void 0||e.isExpression(H))},1:function(l){var I=l[2],R=l[3],K=l[4],H=l[5],me=l[6];return(I===void 0||e.isArray(I))&&(R===void 0||typeof R=="string"||e.isPropertyName(R))&&(K===void 0||e.isQuestionOrExclamationToken(K))&&(H===void 0||e.isTypeNode(H))&&(me===void 0||e.isExpression(me))}}).deprecate({1:a}).finish(),B.createMethodDeclaration=e.buildOverload("createMethodDeclaration").overload({0:function(l,I,R,K,H,me,ge,Ke){return fe(l,I,R,K,H,me,ge,Ke)},1:function(l,I,R,K,H,me,ge,Ke,je){return fe(e.concatenate(l,I),R,K,H,me,ge,Ke,je)}}).bind({0:function(l){var I=l[1],R=l[2],K=l[3],H=l[4],me=l[5],ge=l[6],Ke=l[7],je=l[8];return je===void 0&&(I===void 0||!e.isArray(I))&&(R===void 0||typeof R=="string"||e.isPropertyName(R))&&(K===void 0||typeof K=="object"&&e.isQuestionToken(K))&&(H===void 0||e.isArray(H))&&(me===void 0||!e.some(me,e.isTypeParameterDeclaration))&&(ge===void 0||!e.isArray(ge))&&(Ke===void 0||e.isBlock(Ke))},1:function(l){var I=l[1],R=l[2],K=l[3],H=l[4],me=l[5],ge=l[6],Ke=l[7],je=l[8];return(I===void 0||e.isArray(I))&&(R===void 0||typeof R=="object"&&e.isAsteriskToken(R))&&(K===void 0||typeof K=="string"||e.isPropertyName(K))&&(H===void 0||!e.isArray(H))&&(me===void 0||!e.some(me,e.isParameter))&&(ge===void 0||e.isArray(ge))&&(Ke===void 0||e.isTypeNode(Ke))&&(je===void 0||e.isBlock(je))}}).deprecate({1:a}).finish(),B.updateMethodDeclaration=e.buildOverload("updateMethodDeclaration").overload({0:function(l,I,R,K,H,me,ge,Ke,je){return le(l,I,R,K,H,me,ge,Ke,je)},1:function(l,I,R,K,H,me,ge,Ke,je,Le){return le(l,e.concatenate(I,R),K,H,me,ge,Ke,je,Le)}}).bind({0:function(l){var I=l[2],R=l[3],K=l[4],H=l[5],me=l[6],ge=l[7],Ke=l[8],je=l[9];return je===void 0&&(I===void 0||!e.isArray(I))&&(R===void 0||typeof R=="string"||e.isPropertyName(R))&&(K===void 0||typeof K=="object"&&e.isQuestionToken(K))&&(H===void 0||e.isArray(H))&&(me===void 0||!e.some(me,e.isTypeParameterDeclaration))&&(ge===void 0||!e.isArray(ge))&&(Ke===void 0||e.isBlock(Ke))},1:function(l){var I=l[2],R=l[3],K=l[4],H=l[5],me=l[6],ge=l[7],Ke=l[8],je=l[9];return(I===void 0||e.isArray(I))&&(R===void 0||typeof R=="object"&&e.isAsteriskToken(R))&&(K===void 0||typeof K=="string"||e.isPropertyName(K))&&(H===void 0||!e.isArray(H))&&(me===void 0||!e.some(me,e.isParameter))&&(ge===void 0||e.isArray(ge))&&(Ke===void 0||e.isTypeNode(Ke))&&(je===void 0||e.isBlock(je))}}).deprecate({1:a}).finish(),B.createConstructorDeclaration=e.buildOverload("createConstructorDeclaration").overload({0:function(l,I,R){return se(l,I,R)},1:function(l,I,R,K){return se(I,R,K)}}).bind({0:function(l){var I=l[0],R=l[1],K=l[2],H=l[3];return H===void 0&&(I===void 0||!e.some(I,e.isDecorator))&&(R===void 0||!e.some(R,e.isModifier))&&(K===void 0||!e.isArray(K))},1:function(l){var I=l[0],R=l[1],K=l[2],H=l[3];return(I===void 0||!e.some(I,e.isModifier))&&(R===void 0||!e.some(R,e.isParameter))&&(K===void 0||e.isArray(K))&&(H===void 0||e.isBlock(H))}}).deprecate({1:y}).finish(),B.updateConstructorDeclaration=e.buildOverload("updateConstructorDeclaration").overload({0:function(l,I,R,K){return ce(l,I,R,K)},1:function(l,I,R,K,H){return ce(l,R,K,H)}}).bind({0:function(l){var I=l[1],R=l[2],K=l[3],H=l[4];return H===void 0&&(I===void 0||!e.some(I,e.isDecorator))&&(R===void 0||!e.some(R,e.isModifier))&&(K===void 0||!e.isArray(K))},1:function(l){var I=l[1],R=l[2],K=l[3],H=l[4];return(I===void 0||!e.some(I,e.isModifier))&&(R===void 0||!e.some(R,e.isParameter))&&(K===void 0||e.isArray(K))&&(H===void 0||e.isBlock(H))}}).deprecate({1:y}).finish(),B.createGetAccessorDeclaration=e.buildOverload("createGetAccessorDeclaration").overload({0:function(l,I,R,K,H){return ue(l,I,R,K,H)},1:function(l,I,R,K,H,me){return ue(e.concatenate(l,I),R,K,H,me)}}).bind({0:function(l){var I=l[1],R=l[2],K=l[3],H=l[4],me=l[5];return me===void 0&&(I===void 0||!e.isArray(I))&&(R===void 0||e.isArray(R))&&(K===void 0||!e.isArray(K))&&(H===void 0||e.isBlock(H))},1:function(l){var I=l[1],R=l[2],K=l[3],H=l[4],me=l[5];return(I===void 0||e.isArray(I))&&(R===void 0||!e.isArray(R))&&(K===void 0||e.isArray(K))&&(H===void 0||e.isTypeNode(H))&&(me===void 0||e.isBlock(me))}}).deprecate({1:a}).finish(),B.updateGetAccessorDeclaration=e.buildOverload("updateGetAccessorDeclaration").overload({0:function(l,I,R,K,H,me){return F(l,I,R,K,H,me)},1:function(l,I,R,K,H,me,ge){return F(l,e.concatenate(I,R),K,H,me,ge)}}).bind({0:function(l){var I=l[2],R=l[3],K=l[4],H=l[5],me=l[6];return me===void 0&&(I===void 0||!e.isArray(I))&&(R===void 0||e.isArray(R))&&(K===void 0||!e.isArray(K))&&(H===void 0||e.isBlock(H))},1:function(l){var I=l[2],R=l[3],K=l[4],H=l[5],me=l[6];return(I===void 0||e.isArray(I))&&(R===void 0||!e.isArray(R))&&(K===void 0||e.isArray(K))&&(H===void 0||e.isTypeNode(H))&&(me===void 0||e.isBlock(me))}}).deprecate({1:a}).finish(),B.createSetAccessorDeclaration=e.buildOverload("createSetAccessorDeclaration").overload({0:function(l,I,R,K){return L(l,I,R,K)},1:function(l,I,R,K,H){return L(e.concatenate(l,I),R,K,H)}}).bind({0:function(l){var I=l[1],R=l[2],K=l[3],H=l[4];return H===void 0&&(I===void 0||!e.isArray(I))&&(R===void 0||e.isArray(R))&&(K===void 0||!e.isArray(K))},1:function(l){var I=l[1],R=l[2],K=l[3],H=l[4];return(I===void 0||e.isArray(I))&&(R===void 0||!e.isArray(R))&&(K===void 0||e.isArray(K))&&(H===void 0||e.isBlock(H))}}).deprecate({1:a}).finish(),B.updateSetAccessorDeclaration=e.buildOverload("updateSetAccessorDeclaration").overload({0:function(l,I,R,K,H){return _(l,I,R,K,H)},1:function(l,I,R,K,H,me){return _(l,e.concatenate(I,R),K,H,me)}}).bind({0:function(l){var I=l[2],R=l[3],K=l[4],H=l[5];return H===void 0&&(I===void 0||!e.isArray(I))&&(R===void 0||e.isArray(R))&&(K===void 0||!e.isArray(K))},1:function(l){var I=l[2],R=l[3],K=l[4],H=l[5];return(I===void 0||e.isArray(I))&&(R===void 0||!e.isArray(R))&&(K===void 0||e.isArray(K))&&(H===void 0||e.isBlock(H))}}).deprecate({1:a}).finish(),B.createIndexSignature=e.buildOverload("createIndexSignature").overload({0:function(l,I,R){return b(l,I,R)},1:function(l,I,R,K){return b(I,R,K)}}).bind({0:function(l){var I=l[0],R=l[1],K=l[2],H=l[3];return H===void 0&&(I===void 0||e.every(I,e.isModifier))&&(R===void 0||e.every(R,e.isParameter))&&(K===void 0||!e.isArray(K))},1:function(l){var I=l[0],R=l[1],K=l[2],H=l[3];return(I===void 0||e.every(I,e.isDecorator))&&(R===void 0||e.every(R,e.isModifier))&&(K===void 0||e.isArray(K))&&(H===void 0||e.isTypeNode(H))}}).deprecate({1:y}).finish(),B.updateIndexSignature=e.buildOverload("updateIndexSignature").overload({0:function(l,I,R,K){return x(l,I,R,K)},1:function(l,I,R,K,H){return x(l,R,K,H)}}).bind({0:function(l){var I=l[1],R=l[2],K=l[3],H=l[4];return H===void 0&&(I===void 0||e.every(I,e.isModifier))&&(R===void 0||e.every(R,e.isParameter))&&(K===void 0||!e.isArray(K))},1:function(l){var I=l[1],R=l[2],K=l[3],H=l[4];return(I===void 0||e.every(I,e.isDecorator))&&(R===void 0||e.every(R,e.isModifier))&&(K===void 0||e.isArray(K))&&(H===void 0||e.isTypeNode(H))}}).deprecate({1:y}).finish(),B.createClassStaticBlockDeclaration=e.buildOverload("createClassStaticBlockDeclaration").overload({0:function(l){return E(l)},1:function(l,I,R){return E(R)}}).bind({0:function(l){var I=l[0],R=l[1],K=l[2];return R===void 0&&K===void 0&&(I===void 0||!e.isArray(I))},1:function(l){var I=l[0],R=l[1],K=l[2];return(I===void 0||e.isArray(I))&&(R===void 0||e.isArray(I))&&(K===void 0||e.isBlock(K))}}).deprecate({1:v}).finish(),B.updateClassStaticBlockDeclaration=e.buildOverload("updateClassStaticBlockDeclaration").overload({0:function(l,I){return P(l,I)},1:function(l,I,R,K){return P(l,K)}}).bind({0:function(l){var I=l[1],R=l[2],K=l[3];return R===void 0&&K===void 0&&(I===void 0||!e.isArray(I))},1:function(l){var I=l[1],R=l[2],K=l[3];return(I===void 0||e.isArray(I))&&(R===void 0||e.isArray(I))&&(K===void 0||e.isBlock(K))}}).deprecate({1:v}).finish(),B.createClassExpression=e.buildOverload("createClassExpression").overload({0:function(l,I,R,K,H){return A(l,I,R,K,H)},1:function(l,I,R,K,H,me){return A(e.concatenate(l,I),R,K,H,me)}}).bind({0:function(l){var I=l[1],R=l[2],K=l[3],H=l[4],me=l[5];return me===void 0&&(I===void 0||!e.isArray(I))&&(R===void 0||e.isArray(R))&&(K===void 0||e.every(K,e.isHeritageClause))&&(H===void 0||e.every(H,e.isClassElement))},1:function(l){var I=l[1],R=l[2],K=l[3],H=l[4],me=l[5];return(I===void 0||e.isArray(I))&&(R===void 0||!e.isArray(R))&&(K===void 0||e.every(K,e.isTypeParameterDeclaration))&&(H===void 0||e.every(H,e.isHeritageClause))&&(me===void 0||e.isArray(me))}}).deprecate({1:y}).finish(),B.updateClassExpression=e.buildOverload("updateClassExpression").overload({0:function(l,I,R,K,H,me){return ve(l,I,R,K,H,me)},1:function(l,I,R,K,H,me,ge){return ve(l,e.concatenate(I,R),K,H,me,ge)}}).bind({0:function(l){var I=l[2],R=l[3],K=l[4],H=l[5],me=l[6];return me===void 0&&(I===void 0||!e.isArray(I))&&(R===void 0||e.isArray(R))&&(K===void 0||e.every(K,e.isHeritageClause))&&(H===void 0||e.every(H,e.isClassElement))},1:function(l){var I=l[2],R=l[3],K=l[4],H=l[5],me=l[6];return(I===void 0||e.isArray(I))&&(R===void 0||!e.isArray(R))&&(K===void 0||e.every(K,e.isTypeParameterDeclaration))&&(H===void 0||e.every(H,e.isHeritageClause))&&(me===void 0||e.isArray(me))}}).deprecate({1:y}).finish(),B.createFunctionDeclaration=e.buildOverload("createFunctionDeclaration").overload({0:function(l,I,R,K,H,me,ge){return be(l,I,R,K,H,me,ge)},1:function(l,I,R,K,H,me,ge,Ke){return be(I,R,K,H,me,ge,Ke)}}).bind({0:function(l){var I=l[1],R=l[2],K=l[3],H=l[4],me=l[5],ge=l[6],Ke=l[7];return Ke===void 0&&(I===void 0||!e.isArray(I))&&(R===void 0||typeof R=="string"||e.isIdentifier(R))&&(K===void 0||e.isArray(K))&&(H===void 0||e.every(H,e.isParameter))&&(me===void 0||!e.isArray(me))&&(ge===void 0||e.isBlock(ge))},1:function(l){var I=l[1],R=l[2],K=l[3],H=l[4],me=l[5],ge=l[6],Ke=l[7];return(I===void 0||e.isArray(I))&&(R===void 0||typeof R!="string"&&e.isAsteriskToken(R))&&(K===void 0||!e.isArray(K))&&(H===void 0||e.every(H,e.isTypeParameterDeclaration))&&(me===void 0||e.isArray(me))&&(ge===void 0||e.isTypeNode(ge))&&(Ke===void 0||e.isBlock(Ke))}}).deprecate({1:y}).finish(),B.updateFunctionDeclaration=e.buildOverload("updateFunctionDeclaration").overload({0:function(l,I,R,K,H,me,ge,Ke){return Z(l,I,R,K,H,me,ge,Ke)},1:function(l,I,R,K,H,me,ge,Ke,je){return Z(l,R,K,H,me,ge,Ke,je)}}).bind({0:function(l){var I=l[2],R=l[3],K=l[4],H=l[5],me=l[6],ge=l[7],Ke=l[8];return Ke===void 0&&(I===void 0||!e.isArray(I))&&(R===void 0||e.isIdentifier(R))&&(K===void 0||e.isArray(K))&&(H===void 0||e.every(H,e.isParameter))&&(me===void 0||!e.isArray(me))&&(ge===void 0||e.isBlock(ge))},1:function(l){var I=l[2],R=l[3],K=l[4],H=l[5],me=l[6],ge=l[7],Ke=l[8];return(I===void 0||e.isArray(I))&&(R===void 0||typeof R!="string"&&e.isAsteriskToken(R))&&(K===void 0||!e.isArray(K))&&(H===void 0||e.every(H,e.isTypeParameterDeclaration))&&(me===void 0||e.isArray(me))&&(ge===void 0||e.isTypeNode(ge))&&(Ke===void 0||e.isBlock(Ke))}}).deprecate({1:y}).finish(),B.createClassDeclaration=e.buildOverload("createClassDeclaration").overload({0:function(l,I,R,K,H){return J(l,I,R,K,H)},1:function(l,I,R,K,H,me){return J(e.concatenate(l,I),R,K,H,me)}}).bind({0:function(l){var I=l[1],R=l[2],K=l[3],H=l[4],me=l[5];return me===void 0&&(I===void 0||!e.isArray(I))&&(R===void 0||e.isArray(R))&&(K===void 0||e.every(K,e.isHeritageClause))&&(H===void 0||e.every(H,e.isClassElement))},1:function(){return!0}}).deprecate({1:a}).finish(),B.updateClassDeclaration=e.buildOverload("updateClassDeclaration").overload({0:function(l,I,R,K,H,me){return $(l,I,R,K,H,me)},1:function(l,I,R,K,H,me,ge){return $(l,e.concatenate(I,R),K,H,me,ge)}}).bind({0:function(l){var I=l[2],R=l[3],K=l[4],H=l[5],me=l[6];return me===void 0&&(I===void 0||!e.isArray(I))&&(R===void 0||e.isArray(R))&&(K===void 0||e.every(K,e.isHeritageClause))&&(H===void 0||e.every(H,e.isClassElement))},1:function(l){var I=l[2],R=l[3],K=l[4],H=l[5],me=l[6];return(I===void 0||e.isArray(I))&&(R===void 0||!e.isArray(R))&&(K===void 0||e.every(K,e.isTypeParameterDeclaration))&&(H===void 0||e.every(H,e.isHeritageClause))&&(me===void 0||e.isArray(me))}}).deprecate({1:a}).finish(),B.createInterfaceDeclaration=e.buildOverload("createInterfaceDeclaration").overload({0:function(l,I,R,K,H){return Y(l,I,R,K,H)},1:function(l,I,R,K,H,me){return Y(I,R,K,H,me)}}).bind({0:function(l){var I=l[0],R=l[1],K=l[2],H=l[3],me=l[4],ge=l[5];return ge===void 0&&(I===void 0||e.every(I,e.isModifier))&&(R===void 0||!e.isArray(R))&&(K===void 0||e.isArray(K))&&(H===void 0||e.every(H,e.isHeritageClause))&&(me===void 0||e.every(me,e.isTypeElement))},1:function(l){var I=l[0],R=l[1],K=l[2],H=l[3],me=l[4],ge=l[5];return(I===void 0||e.every(I,e.isDecorator))&&(R===void 0||e.isArray(R))&&(K===void 0||!e.isArray(K))&&(H===void 0||e.every(H,e.isTypeParameterDeclaration))&&(me===void 0||e.every(me,e.isHeritageClause))&&(ge===void 0||e.every(ge,e.isTypeElement))}}).deprecate({1:y}).finish(),B.updateInterfaceDeclaration=e.buildOverload("updateInterfaceDeclaration").overload({0:function(l,I,R,K,H,me){return C(l,I,R,K,H,me)},1:function(l,I,R,K,H,me,ge){return C(l,R,K,H,me,ge)}}).bind({0:function(l){var I=l[1],R=l[2],K=l[3],H=l[4],me=l[5],ge=l[6];return ge===void 0&&(I===void 0||e.every(I,e.isModifier))&&(R===void 0||!e.isArray(R))&&(K===void 0||e.isArray(K))&&(H===void 0||e.every(H,e.isHeritageClause))&&(me===void 0||e.every(me,e.isTypeElement))},1:function(l){var I=l[1],R=l[2],K=l[3],H=l[4],me=l[5],ge=l[6];return(I===void 0||e.every(I,e.isDecorator))&&(R===void 0||e.isArray(R))&&(K===void 0||!e.isArray(K))&&(H===void 0||e.every(H,e.isTypeParameterDeclaration))&&(me===void 0||e.every(me,e.isHeritageClause))&&(ge===void 0||e.every(ge,e.isTypeElement))}}).deprecate({1:y}).finish(),B.createTypeAliasDeclaration=e.buildOverload("createTypeAliasDeclaration").overload({0:function(l,I,R,K){return j(l,I,R,K)},1:function(l,I,R,K,H){return j(I,R,K,H)}}).bind({0:function(l){var I=l[0],R=l[1],K=l[2],H=l[3],me=l[4];return me===void 0&&(I===void 0||e.every(I,e.isModifier))&&(R===void 0||!e.isArray(R))&&(K===void 0||e.isArray(K))&&(H===void 0||!e.isArray(H))},1:function(l){var I=l[0],R=l[1],K=l[2],H=l[3],me=l[4];return(I===void 0||e.every(I,e.isDecorator))&&(R===void 0||e.isArray(R))&&(K===void 0||!e.isArray(K))&&(H===void 0||e.isArray(H))&&(me===void 0||e.isTypeNode(me))}}).deprecate({1:y}).finish(),B.updateTypeAliasDeclaration=e.buildOverload("updateTypeAliasDeclaration").overload({0:function(l,I,R,K,H){return ae(l,I,R,K,H)},1:function(l,I,R,K,H,me){return ae(l,R,K,H,me)}}).bind({0:function(l){var I=l[1],R=l[2],K=l[3],H=l[4],me=l[5];return me===void 0&&(I===void 0||e.every(I,e.isModifier))&&(R===void 0||!e.isArray(R))&&(K===void 0||e.isArray(K))&&(H===void 0||!e.isArray(H))},1:function(l){var I=l[1],R=l[2],K=l[3],H=l[4],me=l[5];return(I===void 0||e.every(I,e.isDecorator))&&(R===void 0||e.isArray(R))&&(K===void 0||!e.isArray(K))&&(H===void 0||e.isArray(H))&&(me===void 0||e.isTypeNode(me))}}).deprecate({1:y}).finish(),B.createEnumDeclaration=e.buildOverload("createEnumDeclaration").overload({0:function(l,I,R){return U(l,I,R)},1:function(l,I,R,K){return U(I,R,K)}}).bind({0:function(l){var I=l[0],R=l[1],K=l[2],H=l[3];return H===void 0&&(I===void 0||e.every(I,e.isModifier))&&(R===void 0||!e.isArray(R))&&(K===void 0||e.isArray(K))},1:function(l){var I=l[0],R=l[1],K=l[2],H=l[3];return(I===void 0||e.every(I,e.isDecorator))&&(R===void 0||e.isArray(R))&&(K===void 0||!e.isArray(K))&&(H===void 0||e.isArray(H))}}).deprecate({1:y}).finish(),B.updateEnumDeclaration=e.buildOverload("updateEnumDeclaration").overload({0:function(l,I,R,K){return M(l,I,R,K)},1:function(l,I,R,K,H){return M(l,R,K,H)}}).bind({0:function(l){var I=l[1],R=l[2],K=l[3],H=l[4];return H===void 0&&(I===void 0||e.every(I,e.isModifier))&&(R===void 0||!e.isArray(R))&&(K===void 0||e.isArray(K))},1:function(l){var I=l[1],R=l[2],K=l[3],H=l[4];return(I===void 0||e.every(I,e.isDecorator))&&(R===void 0||e.isArray(R))&&(K===void 0||!e.isArray(K))&&(H===void 0||e.isArray(H))}}).deprecate({1:y}).finish(),B.createModuleDeclaration=e.buildOverload("createModuleDeclaration").overload({0:function(l,I,R,K){return w(l,I,R,K)},1:function(l,I,R,K,H){return w(I,R,K,H)}}).bind({0:function(l){var I=l[0],R=l[1],K=l[2],H=l[3],me=l[4];return me===void 0&&(I===void 0||e.every(I,e.isModifier))&&R!==void 0&&!e.isArray(R)&&(K===void 0||e.isModuleBody(K))&&(H===void 0||typeof H=="number")},1:function(l){var I=l[0],R=l[1],K=l[2],H=l[3],me=l[4];return(I===void 0||e.every(I,e.isDecorator))&&(R===void 0||e.isArray(R))&&K!==void 0&&e.isModuleName(K)&&(H===void 0||typeof H=="object")&&(me===void 0||typeof me=="number")}}).deprecate({1:y}).finish(),B.updateModuleDeclaration=e.buildOverload("updateModuleDeclaration").overload({0:function(l,I,R,K){return G(l,I,R,K)},1:function(l,I,R,K,H){return G(l,R,K,H)}}).bind({0:function(l){var I=l[1],R=l[2],K=l[3],H=l[4];return H===void 0&&(I===void 0||e.every(I,e.isModifier))&&(R===void 0||!e.isArray(R))&&(K===void 0||e.isModuleBody(K))},1:function(l){var I=l[1],R=l[2],K=l[3],H=l[4];return(I===void 0||e.every(I,e.isDecorator))&&(R===void 0||e.isArray(R))&&K!==void 0&&e.isModuleName(K)&&(H===void 0||e.isModuleBody(H))}}).deprecate({1:y}).finish(),B.createImportEqualsDeclaration=e.buildOverload("createImportEqualsDeclaration").overload({0:function(l,I,R,K){return X(l,I,R,K)},1:function(l,I,R,K,H){return X(I,R,K,H)}}).bind({0:function(l){var I=l[0],R=l[1],K=l[2],H=l[3],me=l[4];return me===void 0&&(I===void 0||e.every(I,e.isModifier))&&(R===void 0||typeof R=="boolean")&&typeof K!="boolean"&&typeof H!="string"},1:function(l){var I=l[0],R=l[1],K=l[2],H=l[3],me=l[4];return(I===void 0||e.every(I,e.isDecorator))&&(R===void 0||e.isArray(R))&&(K===void 0||typeof K=="boolean")&&(typeof H=="string"||e.isIdentifier(H))&&me!==void 0&&e.isModuleReference(me)}}).deprecate({1:y}).finish(),B.updateImportEqualsDeclaration=e.buildOverload("updateImportEqualsDeclaration").overload({0:function(l,I,R,K,H){return ee(l,I,R,K,H)},1:function(l,I,R,K,H,me){return ee(l,R,K,H,me)}}).bind({0:function(l){var I=l[1],R=l[2],K=l[3],H=l[4],me=l[5];return me===void 0&&(I===void 0||e.every(I,e.isModifier))&&(R===void 0||typeof R=="boolean")&&typeof K!="boolean"&&typeof H!="string"},1:function(l){var I=l[1],R=l[2],K=l[3],H=l[4],me=l[5];return(I===void 0||e.every(I,e.isDecorator))&&(R===void 0||e.isArray(R))&&(K===void 0||typeof K=="boolean")&&(typeof H=="string"||e.isIdentifier(H))&&me!==void 0&&e.isModuleReference(me)}}).deprecate({1:y}).finish(),B.createImportDeclaration=e.buildOverload("createImportDeclaration").overload({0:function(l,I,R,K){return De(l,I,R,K)},1:function(l,I,R,K,H){return De(I,R,K,H)}}).bind({0:function(l){var I=l[0],R=l[1],K=l[2],H=l[3],me=l[4];return me===void 0&&(I===void 0||e.every(I,e.isModifier))&&(R===void 0||!e.isArray(R))&&K!==void 0&&e.isExpression(K)&&(H===void 0||e.isAssertClause(H))},1:function(l){var I=l[0],R=l[1],K=l[2],H=l[3],me=l[4];return(I===void 0||e.every(I,e.isDecorator))&&(R===void 0||e.isArray(R))&&(K===void 0||e.isImportClause(K))&&H!==void 0&&e.isExpression(H)&&(me===void 0||e.isAssertClause(me))}}).deprecate({1:y}).finish(),B.updateImportDeclaration=e.buildOverload("updateImportDeclaration").overload({0:function(l,I,R,K,H){return T(l,I,R,K,H)},1:function(l,I,R,K,H,me){return T(l,R,K,H,me)}}).bind({0:function(l){var I=l[1],R=l[2],K=l[3],H=l[4],me=l[5];return me===void 0&&(I===void 0||e.every(I,e.isModifier))&&(R===void 0||!e.isArray(R))&&(K===void 0||e.isExpression(K))&&(H===void 0||e.isAssertClause(H))},1:function(l){var I=l[1],R=l[2],K=l[3],H=l[4],me=l[5];return(I===void 0||e.every(I,e.isDecorator))&&(R===void 0||e.isArray(R))&&(K===void 0||e.isImportClause(K))&&H!==void 0&&e.isExpression(H)&&(me===void 0||e.isAssertClause(me))}}).deprecate({1:y}).finish(),B.createExportAssignment=e.buildOverload("createExportAssignment").overload({0:function(l,I,R){return k(l,I,R)},1:function(l,I,R,K){return k(I,R,K)}}).bind({0:function(l){var I=l[0],R=l[1],K=l[2],H=l[3];return H===void 0&&(I===void 0||e.every(I,e.isModifier))&&(R===void 0||typeof R=="boolean")&&typeof K=="object"},1:function(l){var I=l[0],R=l[1],K=l[2],H=l[3];return(I===void 0||e.every(I,e.isDecorator))&&(R===void 0||e.isArray(R))&&(K===void 0||typeof K=="boolean")&&H!==void 0&&e.isExpression(H)}}).deprecate({1:y}).finish(),B.updateExportAssignment=e.buildOverload("updateExportAssignment").overload({0:function(l,I,R){return N(l,I,R)},1:function(l,I,R,K){return N(l,R,K)}}).bind({0:function(l){var I=l[1],R=l[2],K=l[3];return K===void 0&&(I===void 0||e.every(I,e.isModifier))&&R!==void 0&&!e.isArray(R)},1:function(l){var I=l[1],R=l[2],K=l[3];return(I===void 0||e.every(I,e.isDecorator))&&(R===void 0||e.isArray(R))&&K!==void 0&&e.isExpression(K)}}).deprecate({1:y}).finish(),B.createExportDeclaration=e.buildOverload("createExportDeclaration").overload({0:function(l,I,R,K,H){return ie(l,I,R,K,H)},1:function(l,I,R,K,H,me){return ie(I,R,K,H,me)}}).bind({0:function(l){var I=l[0],R=l[1],K=l[2],H=l[3],me=l[4],ge=l[5];return ge===void 0&&(I===void 0||e.every(I,e.isModifier))&&typeof R=="boolean"&&typeof K!="boolean"&&(H===void 0||e.isExpression(H))&&(me===void 0||e.isAssertClause(me))},1:function(l){var I=l[0],R=l[1],K=l[2],H=l[3],me=l[4],ge=l[5];return(I===void 0||e.every(I,e.isDecorator))&&(R===void 0||e.isArray(R))&&typeof K=="boolean"&&(H===void 0||e.isNamedExportBindings(H))&&(me===void 0||e.isExpression(me))&&(ge===void 0||e.isAssertClause(ge))}}).deprecate({1:y}).finish(),B.updateExportDeclaration=e.buildOverload("updateExportDeclaration").overload({0:function(l,I,R,K,H,me){return V(l,I,R,K,H,me)},1:function(l,I,R,K,H,me,ge){return V(l,R,K,H,me,ge)}}).bind({0:function(l){var I=l[1],R=l[2],K=l[3],H=l[4],me=l[5],ge=l[6];return ge===void 0&&(I===void 0||e.every(I,e.isModifier))&&typeof R=="boolean"&&typeof K!="boolean"&&(H===void 0||e.isExpression(H))&&(me===void 0||e.isAssertClause(me))},1:function(l){var I=l[1],R=l[2],K=l[3],H=l[4],me=l[5],ge=l[6];return(I===void 0||e.every(I,e.isDecorator))&&(R===void 0||e.isArray(R))&&typeof K=="boolean"&&(H===void 0||e.isNamedExportBindings(H))&&(me===void 0||e.isExpression(me))&&(ge===void 0||e.isAssertClause(ge))}}).deprecate({1:y}).finish()}n(O,"patchNodeFactory");var h=e.createNodeFactory;e.createNodeFactory=function(B,re){var z=h(B,re);return O(z),z},O(e.factory)})(_r||(_r={}));var _r;(function(e){typeof console<"u"&&(e.Debug.loggingHost={log:function(a,y){switch(a){case e.LogLevel.Error:return console.error(y);case e.LogLevel.Warning:return console.warn(y);case e.LogLevel.Info:return console.log(y);case e.LogLevel.Verbose:return console.log(y)}}})})(_r||(_r={}))});var YF={};tF(YF,{RunMode:()=>Gv,getChecksumConfig:()=>yS,getLogin:()=>R1,init:()=>XF});module.exports=aF(YF);var bh=(v=>(v[v.Element=0]="Element",v[v.VisibleElement=1]="VisibleElement",v[v.AtPointElement=2]="AtPointElement",v))(bh||{});var A6=require("path");var Gv=(v=>(v.Normal="normal",v.Heal="heal",v.Refactor="refactor",v))(Gv||{});var I1=(z=>(z.Locator="locator",z.GetByRole="getByRole",z.GetByText="getByText",z.GetByLabel="getByLabel",z.GetByPlaceholder="getByPlaceholder",z.GetByAltText="getByAltText",z.GetByTitle="getByTitle",z.GetByTestId="getByTestId",z))(I1||{}),w1=(h=>(h.First="first",h.Last="last",h.Nth="nth",h.Filter="filter",h.Or="or",h))(w1||{});var Yp=P1(require("path")),Th=require("fs");var Sh=n(e=>new Promise(a=>setTimeout(a,e)),"awaitSleep"),_S=n(async(e,a=1e3,y="action hang guard timed out")=>{let v="guard-timed-out",O=n(async()=>(await Sh(a+1e3),v),"guard"),h=await Promise.race([e,O()]);if(typeof h=="string"&&h===v)throw new Error(y);return h},"guardReturn");function Ch(e=5,a="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"){let y="";for(let v=e;v>0;--v)y+=a[Math.floor(Math.random()*a.length)];return y}n(Ch,"randomString");async function F1(e,a){let y=pS(e,a),{ungzip:v}=dS();if(!(0,Th.existsSync)(y))throw new Error(`Could not find ESRA file for test ${a}`);let O=await v((0,Th.readFileSync)(y));return JSON.parse(O)}n(F1,"getESRAMapForTestId");function Ym(e){return Yp.join(Yp.dirname(e),"..")}n(Ym,"getTestBaseDir");function pS(e,a){return Yp.join(oF(e),`${a}.checksum.esra`)}n(pS,"getESRAFilePath");function oF(e){return Yp.join(mS(e),"esra")}n(oF,"getESRAFolderPath");function gS(e,a){return Yp.join(mS(e),"har",a)}n(gS,"getHARFolderPath");function C6(e,a){return Yp.join(mS(e),"trace",`${a}.playwright-trace.zip`)}n(C6,"getTraceFilePath");function mS(e){return Yp.join(e,"test-data")}n(mS,"getTestDataPath");function sF(){return{uploadAgentHOST:"localhost",uploadAgentPort:3e3}}n(sF,"getUploadAgentDefaultConfig");var O1=n(async e=>{try{await _S(e,5e3)}catch{}},"guardAwait"),vS=n(e=>{let a=/\/\/.*/,y=/\/\*[\s\S]*?\*\//g;return e.replace(a,"").replace(y,"")},"stripJavascriptComments");async function M1(e,a){wc("Fetching selection data..");let v=n(async h=>a.evaluate(async B=>await window.checksum.testRunner.getSelectionDataForSelector(B),h),"getSelectionDataForSelector"),O=await v(e);if(O||(wc("Failed, waiting for network idle..."),await O1(a.waitForLoadState("networkidle")),O=await v(e),O)||(wc("Failed, waiting for element to be visible..."),await O1(a.locator(e).waitFor({state:"visible"})),O=await v(e),O)||(wc("Failed, will wait 5000ms..."),await Sh(5e3),O=await v(e),O))return O}n(M1,"selectionDataForSelector");async function L1(e,a,y,v=6e4){return a in e?_S(e[a](...y),v,"Execution timeout"):e}n(L1,"executePlaywrightMethodWithTimeout");var x6=!1;function T6(e){x6=e}n(T6,"setLogToConsole");function wc(...e){x6&&console.log(...e)}n(wc,"log");function xh(){return Yp.join(__dirname,"..","..","..","checksum")}n(xh,"checksumFolder");function R1(e){try{let a=require(`${xh()}/login.ts`).default;return async y=>{await a(y,e)}}catch(a){throw console.warn("Could not find checksum login file. Please set login.ts file in your checksum folder"),a}}n(R1,"getLogin");var Hv;function E6(){if(Hv)return Hv;let e;try{let a=(0,Th.existsSync)(`${xh()}/checksum.config.tmp.ts`)?"checksum.config.tmp.ts":"checksum.config.ts";e=require(`${xh()}/${a}`).default}catch{console.warn("Could not find checksum config file, will run with defaults"),e=yS()}return e}n(E6,"loadChecksumConfig");function yS(e={}){return Hv={...{apiKey:void 0,runMode:"normal",baseURL:void 0,apiURL:void 0,username:void 0,password:void 0,options:{useChecksumSelectors:!0,useChecksumAI:!1,newAssertionsEnabled:!0,useMockData:!1,printLogs:!1},...sF()},...e},(!Hv.username||!Hv.password)&&console.warn("Username and/or password missing in config file"),Hv}n(yS,"getChecksumConfig");var Tg=class{constructor(a,y,v={generateSelectionData:!1}){this.page=a;this.phaseSetter=y;this.options=v;this.page=a,this.phaseSetter=y}addMetadata(a){}async execute(a,y,v){return L1(a,y,v)}async executeWithSelectors(a,y,v,O=void 0,h={}){for(let{selector:B,tag:re}of a){this.phaseSetter({phase:O,payload:{selector:B,...h}});let z=this.page.locator(B);this.log(`Running with selector=${B})`);let p=!1;["check","uncheck"].includes(y)&&re!=="input"&&(p=!0);let m=this.generateSelectionDataForSelector(B);if(await this.execute(z,p?"click":y,v)===!1){this.log("Fallback selector timeout");continue}return m}}async generateSelectionDataForSelector(a){let{generateSelectionData:y}=this.options;if(!y)return{selector:a,generatedLocator:void 0,esraMetadata:void 0};try{let v=await M1(a,this.page);if(!v)throw new Error(`[generateSelectionDataForSelector] Failed to generate selection data for selector ${a}`);return v}catch(v){throw this.log(v.message),v}}log(...a){wc(...a)}};n(Tg,"AbstractFallback");var B1=require("path");var Kv=class extends Tg{constructor(){super(...arguments);this.locatorTypeEnumToFieldMap={[0]:"element",[1]:"visibleElement",[2]:"atPointElement"}}init(y){return this.esraData={...this.esraData,minSelectionScore:.5,...y},this}async resolve(y){try{let{method:v,args:O}=y,{checksumId:h}=this.esraData,B=await this.getActionIdToESRAMap();if(!(h in B)){let m=`No ESRA metadata found for id ${h}`;throw new Error(m)}let re=await this.getTestIdsForLocator(B[h]),{elementDataMap:z}=await this.getSelectors(re),p=await this.executeWithSelectors(Object.values(z),v,O,"esra-action");if(p)return[p];throw new Error("Exhausted ESRA selectors")}catch(v){this.log(v.message);return}}async getActionIdToESRAMap(){try{this.actionIdToESRAMap||(this.actionIdToESRAMap=await F1((0,B1.join)((0,B1.dirname)(this.esraData.fileName),".."),this.esraData.testId))}catch(y){return super.log("Could not read ESRA metadata file, ",y),{}}return this.actionIdToESRAMap}async getSelectors(y){let v=[],O={};if(!y)return{selectors:v,elementDataMap:O};for(let h in Object.keys(bh)){let B=y.testIds[this.locatorTypeEnumToFieldMap[h]];if(!B)continue;let re=`[data-checksum-testid="${B}"]`;v.push(re),O[re]={...y.elementData[this.locatorTypeEnumToFieldMap[h]],selector:y.selectors[this.locatorTypeEnumToFieldMap[h]]}}for(let h in Object.keys(bh)){let B=y.selectors[this.locatorTypeEnumToFieldMap[h]];B&&(v.push(B),O[B]={...y.elementData[this.locatorTypeEnumToFieldMap[h]],selector:B})}return this.log("Selectors for ESRA metadata:",v),{selectors:v,elementDataMap:O}}async getTestIdsForLocator(y,v={}){let{cachedSelector:O=void 0,retriesLeft:h=3,retryMaxTimeout:B=3e3,staticMetadata:re}=v;this.phaseSetter({phase:"esra-search"});let z=await this.page.evaluate(async({esraMetadata:p,cachedSelector:m,staticMetadata:fe,minSelectionScore:le})=>await window.checksum.testRunner.getMatchingElementSelectionData(p,{minSelectionScore:le,cachedSelector:m,staticMetadata:fe}),{esraMetadata:y,cachedSelector:O,staticMetadata:re,minSelectionScore:this.esraData.minSelectionScore});if(!z){if(h>0)return this.log("[getTestIdsForLocator] no match found, waiting and retrying..."),await Sh(B/h),this.getTestIdsForLocator(y,{...v,retriesLeft:h-1});this.log("[getTestIdsForLocator] failed to locate")}return z}toString(){return`Checksum Selector (${this.esraData.checksumId})`}};n(Kv,"ESRAfallback");var Qv=class extends Tg{init(){return this}async resolve(a){try{let{locator:y,method:v,args:O}=a;if(!["check","uncheck"].includes(v))return;this.phaseSetter({phase:"force"});let h=!1;for(let re of Array.from(O))if(typeof re=="object"){re.force=!0,h=!0;break}if(h||(O=Array.from(O),O.push({force:!0})),await this.execute(y,v,O)!==!1)return[{selector:y._selector,generatedLocator:void 0,esraMetadata:void 0}];this.log("Locator timed out, ")}catch(y){this.log("initiateFallbackSequence exception, ",y);return}}toString(){return null}};n(Qv,"ForceFallback");var Gf=class extends Tg{constructor(){super(...arguments);this.config={llm:{persistChecksumIds:!1}};this.runningChecksumIdIndex=[0];this.steps=[];this.selectionData=[];this.finish=!1;this.actionsCounter=1;this.mockServer=!1}init(y){let{goal:v,apiKey:O,apiURL:h}=y;return Gf.goal=v,Gf.apiKey=O,h&&(Gf.API_BASE_URL=`${h.replace(/\/$/,"")}/client-api/runtime/ai-fallback`),this}async resolve(){try{if(await this.initSession(),!await this.iterate()){this.log("[AIFallback] AIFallback failed");return}return this.selectionData}catch(y){this.log("[AIFallback] Error resolving",y);return}}async iterate(){let y=!1,v=Gf.CLIENT_MAX_ITERATIONS;do{let{reducedHTML:O,flashingHTML:h,elementsForNodeInterpretation:B}=await this.page.evaluate(async([z])=>window.checksum.testGenerator.reduceHTML({overrideInteractableElementsSelectors:z}),[[void 0]]),re=await this.getNextAction({reducedHTML:O,flashingHTML:h,elementsForNodeInterpretation:B,hasPreviousActionFailed:y});if(re.thought==="finish")return this.log("[AIFallback] Received finish step"),this.steps.length>0;if(["failed","fail"].includes(re.thought))return this.log("[AIFallback] Received failed signal, will quit"),!1;re={...re,...await this.getPlaywrightLocatorForChecksumId(re.action.checksumid)};try{let z=await this.executeWithSelectors([{...re,tag:null}],re.action.type,["fill","navigate"].includes(re.action.type)?[re.action.value]:[],"llm-action",{thought:re.thought});if(z)y=!1,this.selectionData.push({...z,method:{name:re.action.type,args:["fill","navigate"].includes(re.action.type)?[re.action.value]:[]},comment:re.thought});else throw new Error("Action failed")}catch(z){this.log("[AIFallback] Error while executing selector",z.message),y=!0;continue}if(this.steps.push(re),--v<=0){this.log("[AIFallback] Maximum repeatition reached");break}}while(!0);return!1}async getNextAction({reducedHTML:y,flashingHTML:v,hasPreviousActionFailed:O,elementsForNodeInterpretation:h}){let{apiKey:B}=Gf;if(this.mockServer)return this.finish?{thought:"finish"}:(--this.actionsCounter===0&&(this.finish=!0),{thought:"mock-thought",action:{type:"click",checksumid:"10"}});let re={reduction:{reducedHTML:y,flashingHTML:v,elementsForNodeInterpretation:h},currentURL:this.page.url()};try{let p=await(await fetch(`${Gf.API_BASE_URL}/iterate`,{method:"POST",headers:{"Content-Type":"application/json",ChecksumAppCode:Gf.apiKey},body:JSON.stringify({appName:B,sessionId:this.sessionId,iterationData:re,hasPreviousActionFailed:O})})).json();return this.log("[AIFallback] Received next action",p),p}catch(z){throw this.log("[AIFallback] Error calling iterate",z),z}}async initSession(){let{apiKey:y,goal:v,thoughts:O}=Gf;if(this.log("[AIFallback] Calling init session...",{appName:y,goal:v,thoughts:O}),this.mockServer){this.sessionId="mock-session-id";return}let h={storyTitle:v,thoughtsAndActions:{previous:O.slice(0,Math.max(O.length-1,0)).map(B=>({thought:B})),failing:{thought:O[O.length-1]},next:[]}};this.phaseSetter({phase:"llm-prompt",payload:{thought:h.thoughtsAndActions.failing.thought}});try{let B=await fetch(`${Gf.API_BASE_URL}/init`,{method:"POST",headers:{"Content-Type":"application/json",ChecksumAppCode:Gf.apiKey},body:JSON.stringify({appName:y,data:h})});this.sessionId=await B.text(),this.log("[AIFallback] Session ID",this.sessionId)}catch(B){throw this.log("[AIFallback] Error calling init session",B),B}}addMetadata(y){Gf.thoughts.push(y.thought)}async getPlaywrightLocatorForChecksumId(y){return!y||isNaN(Number(y))?(this.log(`[getPlaywrightSelectorForChecksumId] Detected invalid checksum id : ${y},,,`),{selector:y}):(!this.config.llm.persistChecksumIds&&this.runningChecksumIdIndex.length>1&&Number(y)<this.runningChecksumIdIndex[this.runningChecksumIdIndex.length-2]&&this.log(`[getPlaywrightSelectorForChecksumId] Detected invalid checksum id, possibly from previous prompt: ${y},
270
- current running checksum id index: ${this.runningChecksumIdIndex[this.runningChecksumIdIndex.length-1]}`),await this.page.evaluate(async O=>window.checksum.testGenerator.getSelectorForChecksumId(O),y))}getFailedThought(){return Gf.thoughts[Gf.thoughts.length-1]}toString(){return`Checksum AI Selector ${this.getFailedThought()}`}},hp=Gf;n(hp,"AIFallback"),hp.API_BASE_URL="https://api.checksum.ai/client-api/runtime/ai-fallback",hp.CLIENT_MAX_ITERATIONS=10,hp.thoughts=[];var DS=P1(require("path")),bS=require("fs");var cF="checksum-playwright-runtime.js",uF=__dirname+"/checksumlib.js";var $p=class{constructor(a,y="normal",v,O,h,B,re,z,p){this.page=a;this.runMode=y;this.testIdSelector=v;this.codeMirror=O;this.monitorBridge=h;this.testInfo=B;this.options=re;this.apiKey=z;this.apiURL=p;this.locatorTypeEnumToFieldMap={[0]:"element",[1]:"visibleElement",[2]:"atPointElement"};this.minSelectionScore=.5;this.phasePayload=void 0;this.locatorStack=[];this.fallbacks=[];this.checksumStepStack=[];this.isTracingActive=!1;this.hasRuntimeStartedTrace=!1;this.didFail=!1;this.didHeal=!1;this.phaseMap={};this.setPhase=a=>{let{phase:y,payload:v,clear:O}=a;O&&(this.phase=void 0,this.phasePayload=void 0),y&&(this.phase=y),v&&(this.phasePayload=v)};T6(re.printLogs),this.proxy=new Proxy(this,{get:n(function(fe,le){return fe.getPageMethod(le)},"get")}),this.registerPageEvents(),this.resetFallbacks(),this.setupStepInterceptors(),this.phase="script"}async prepareAPIMock(){let a={GET:0,POST:0,PUT:0,DELETE:0},y=DS.join(gS(Ym(this.testInfo.file),this.checksumTestId),"test.har");if(!(0,bS.existsSync)(y)){wc("Could not find har file for test, will not use mock");return}await this.page.routeFromHAR(y,{url:"*/**",notFound:"fallback",update:!1});let v=this.page._routes[0].handler;await this.page.route("**/*",O=>{let h=O.request().headers(),B=O.request().method();h["Checksum-Id"]=(++a[B]).toString(),O.request()._applyFallbackOverrides({headers:h}),v(O)})}getPlaywrightConfig(){let a=DS.join(xh(),"playwright.config.ts");if((0,bS.existsSync)(a))return require(a).default}registerPageEvents(){var O;this.page.on("framenavigated",async h=>{h===this.page.mainFrame()&&(this.navigationPromise=new Promise((B,re)=>this.loadScript().then(B).catch(re)))});let y=(O=this.getPlaywrightConfig().use)==null?void 0:O.trace;!y||y==="off"||(this.isTracingActive=!0)}getPageMethod(a){return this.phase=void 0,typeof this[a]=="function"?this[a].bind(this):!Object.values(I1).includes(a)||!this.testInfo?this.page[a]:(this.locatorStack.length===0&&(this.pageInitialCallInTestFile=this.getFirstStackTraceFromTestFile()),this.pushToLocatorStack([{type:a,base:this.page,line:this.pageInitialCallInTestFile.line}]),n(function(v,O){try{return this.executeLocator(v,O)}catch(h){throw this.popLocatorChain(),h}},"Page").bind(this))}static async init(a,y,v,O,{runMode:h="normal",testIdSelector:B=void 0,apiKey:re,apiURL:z,options:p={}}){let m=new $p(a,h,B,y,v,O,{useChecksumSelectors:!0,useChecksumAI:!0,newAssertionsEnabled:!0,useMockData:!1,printLogs:!1,...p},re,z);return v.addTestInfo(m.getChecksumTestId(),O.testId),await m.asyncInit(),m.proxy}popLocatorChain(){return this.locatorStack.pop()}async asyncInit(){await this.page.addInitScript(()=>{window.sessionStorage.setItem("checksumai:disable","true")})}async onTestComplete(){await this.sendTestArtifacts(),this.monitorBridge.addSingleTestStats(!this.didFail,this.didHeal&&!this.didFail)}async sendTestArtifacts(){this.runMode!=="normal"&&(await this.codeMirror.write()).forEach(a=>this.monitorBridge.addAsset(a))}async getTraceFilePath(){if(this.isTracingActive)return this.hasRuntimeStartedTrace?C6(Ym(this.testInfo.file),this.checksumTestId).replace(".zip",".original.zip"):this.testInfo.outputPath("trace.zip")}didTestFail(){return this.didFail}async testId(a){a||(console.warn(`Checksum test id was not defined for test, will auto-generate. Please add one -
271
- test(defineChecksumTest("<title>", "<checksum test id>"), async ({ page }) => {...`),a=Ch(5)),this.checksumTestId=a,(this.options.useMockData||this.runMode==="refactor")&&await this.prepareAPIMock();let y=await this.getTraceFilePath();if(y&&this.monitorBridge.addAsset({type:"trace",path:y,testId:this.checksumTestId}),!1){let O=gS(Ym(this.testInfo.file),this.checksumTestId);this.monitorBridge.addAsset({type:"har",path:O,testId:this.checksumTestId})}}getChecksumTestId(){return this.checksumTestId}checksumSelector(a){return this.options.useChecksumSelectors&&(this.fallbacks.push(this.constructFallback(Kv).init({checksumId:a,fileName:this.testInfo.file,testId:this.checksumTestId})),this.sortFallbacks()),this.checksumStepId=a,this.proxy}checksumAI(...a){if(a.length===0)throw new Error("checksumAI missing arguments");if(!this.options.useChecksumAI)return this.proxy;let{apiKey:y,apiURL:v}=this;if(this.fallbacks.push(this.constructFallback(hp).init({goal:this.testInfo.title,apiKey:y,apiURL:v})),this.sortFallbacks(),this.fallbacks.filter(O=>O instanceof hp).forEach(O=>O.addMetadata({thought:a[0]})),this.checksumStepInitialCallInTestFile=this.getFirstStackTraceFromTestFile(),a.length===1)return this.proxy;if(typeof a[1]!="function")throw new Error("Second argument for withChecksumStep must be a function");this.checksumStepStack.push(a[0]);try{console.log("=== running test function");let O=this;return n(async function(){await a[1](),console.log("==== done running test function"),O.checksumStepStack.pop()},"Page")()}catch(O){console.log(O),this.checksumStepStack.pop()}}async loadScript(){try{return this.navigationPromise&&await this.navigationPromise,await this.page.addScriptTag({path:uF}),await this.page.evaluate(async({initModules:a,ESRAselectionRules:y})=>{window.checksum.testRunner.init(y,[],a)},{ESRAselectionRules:{testIdSelector:this.testIdSelector},initModules:{assertionGenerator:!0}}),wc(`[init] init script loaded for ${this.page.url()}`),!0}catch{return!1}}pushToLocatorStack(a){this.locatorStack.push(a)}getCurrentLocatorChain(){if(this.locatorStack.length)return this.locatorStack[this.locatorStack.length-1]}getCurrentLocatorInChain(){let a=this.getCurrentLocatorChain();return a==null?void 0:a[a.length-1]}getMessage(a,{initialSelector:y,selector:v,thought:O}={}){switch(a){case"script":return"Firing up checksum";case"initial":return`${y} failed, trying some checksum magic...`;case"force":return"check/uncheck methods failed, falling back to click action";case"esra-search":return"Checksum is looking for potential alternatives to resolve the issue...";case"esra-action":return`AI: use selector ${v}`;case"llm-prompt":return`Checksum is trying to achieve step "${O}" using AI...`;case"llm-action":return`AI: "${O}" using selector "${v}"`;case"fail":return`Checksum couldn't resolve the issue executing ${y}`}}onFallbackSuccess(){let a=this.testInfo._steps[this.testInfo._steps.length-1];a&&!a.endWallTime&&a.complete({error:{message:`Failed to resolve ${this.initialLocatorTitle}`,stack:""}})}setupStepInterceptors(){let a=["checksum-page.ts","checksum-test-extension.ts","checksum-playwright-runtime.js","code-mirror.ts","utils.ts","fallback/esra-fallback.ts","fallback/force-fallback.ts","fallback/llm-fallback.ts","index.js"].map(B=>(0,A6.join)(__dirname,B)),y={},v=n(B=>{var z,p,m,fe;return y[B.stepId]!==void 0?y[B.stepId]:B.location&&!a.includes(B.location.file)?!1:!!(B.stepId.includes(".evaluate@")||B.stepId.includes(".addScriptTag@")||(z=B.title)!=null&&z.includes("evaluate")||(p=B.title)!=null&&p.includes("addScriptTag")||(m=B.title)!=null&&m.includes("waitForLoadState")||B.category==="fixture"||(fe=B.title)!=null&&fe.includes("tracing.stop"))},"shouldFilterStep"),O=this.testInfo._onStepBegin;this.testInfo._onStepBegin=B=>{if(!this.phase&&v(B)){y[B.stepId]=!0;return}return y[B.stepId]=!1,this.phase==="initial"&&(this.initialLocatorTitle=B.title,B.location=this.pageInitialCallInTestFile),B.title.startsWith("proxy.")&&(B.title=B.title.replace("proxy.","page.")),this.phase&&this.phase!=="initial"&&(this.phaseMap[B.stepId]={phase:this.phase,payload:this.phasePayload,initialLocatorTitle:this.initialLocatorTitle},B.location=void 0,B.title=this.getMessage(this.phase,{initialSelector:this.initialLocatorTitle,...this.phasePayload})),this.phase=void 0,this.phasePayload=void 0,O(B)};let h=this.testInfo._onStepEnd;this.testInfo._onStepEnd=B=>{if(!y[B.stepId]){if(this.phaseMap[B.stepId]){let{phase:re,initialLocatorTitle:z,payload:p}=this.phaseMap[B.stepId];re==="fail"&&(B.error={message:`Failed to resolve ${z}`,stack:""})}return h(B)}}}getFirstStackTraceFromTestFile(){let a=this.getTestFileStackTrace()[0];if(!a)throw new Error(`Could not find test file location from stack trace ${$p.getStackTrace()}`);let v=[/\((.*):(\d+):(\d+)\)$/,/.*at (.*):(\d+):(\d+)$/].map(re=>re.exec(a)).find(re=>re!==null);if(!v)throw new Error(`Could not find test file location from stack trace ${a}`);let[,O,h,B]=v;return{file:O,line:parseInt(h),column:parseInt(B)}}getTestFileStackTrace(){return $p.getStackTrace().filter(y=>y.includes(this.testInfo.file))}isCalledDirectlyFromTestFunction(){let a=this.getTestFileStackTrace();if(a.length!==1+this.checksumStepStack.length)return!1;let y=a[0],v=/.*at (.*):(\d+):(\d+)$/;return this.checksumStepStack.length===0&&!v.exec(y)?!1:!this.isCalledThroughMethodInAnotherFile(y)}isCalledThroughMethodInAnotherFile(a){let y=$p.getStackTrace(),v=["node:internal","/node_modules/@playwright"],O=y.indexOf(a)-1;for(;O>=0&&v.some(B=>y[O].includes(B));)O--;let h=y[O];return!h.includes("checksum-page.ts")&&!h.includes(cF)}static getStackTrace(){return new Error().stack.split(`
270
+ current running checksum id index: ${this.runningChecksumIdIndex[this.runningChecksumIdIndex.length-1]}`),await this.page.evaluate(async O=>window.checksum.testGenerator.getSelectorForChecksumId(O),y))}getFailedThought(){return Gf.thoughts[Gf.thoughts.length-1]}toString(){return`Checksum AI Selector ${this.getFailedThought()}`}},hp=Gf;n(hp,"AIFallback"),hp.API_BASE_URL="https://api.checksum.ai/client-api/runtime/ai-fallback",hp.CLIENT_MAX_ITERATIONS=10,hp.thoughts=[];var DS=P1(require("path")),bS=require("fs");var cF="checksum-playwright-runtime.js",uF=__dirname+"/checksumlib.js";var $p=class{constructor(a,y="normal",v,O,h,B,re,z,p){this.page=a;this.runMode=y;this.testIdSelector=v;this.codeMirror=O;this.monitorBridge=h;this.testInfo=B;this.options=re;this.apiKey=z;this.apiURL=p;this.locatorTypeEnumToFieldMap={[0]:"element",[1]:"visibleElement",[2]:"atPointElement"};this.minSelectionScore=.5;this.phasePayload=void 0;this.locatorStack=[];this.fallbacks=[];this.checksumStepStack=[];this.isTracingActive=!1;this.hasRuntimeStartedTrace=!1;this.didFail=!1;this.didHeal=!1;this.phaseMap={};this.setPhase=a=>{let{phase:y,payload:v,clear:O}=a;O&&(this.phase=void 0,this.phasePayload=void 0),y&&(this.phase=y),v&&(this.phasePayload=v)};T6(re.printLogs),this.proxy=new Proxy(this,{get:n(function(fe,le){return fe.getPageMethod(le)},"get")}),this.registerPageEvents(),this.resetFallbacks(),this.setupStepInterceptors(),this.phase="script"}async prepareAPIMock(){let a={GET:0,POST:0,PUT:0,DELETE:0},y=DS.join(gS(Ym(this.testInfo.file),this.checksumTestId),"test.har");if(!(0,bS.existsSync)(y)){wc("Could not find har file for test, will not use mock");return}await this.page.routeFromHAR(y,{url:"*/**",notFound:"fallback",update:!1});let v=this.page._routes[0].handler;await this.page.route("**/*",O=>{let h=O.request().headers(),B=O.request().method();h["Checksum-Id"]=(++a[B]).toString(),O.request()._applyFallbackOverrides({headers:h}),v(O)})}getPlaywrightConfig(){let a=DS.join(xh(),"playwright.config.ts");if((0,bS.existsSync)(a))return require(a).default}registerPageEvents(){var O;this.page.on("framenavigated",async h=>{h===this.page.mainFrame()&&(this.navigationPromise=new Promise((B,re)=>this.loadScript().then(B).catch(re)))});let y=(O=this.getPlaywrightConfig().use)==null?void 0:O.trace;!y||y==="off"||(this.isTracingActive=!0)}getPageMethod(a){return this.phase=void 0,typeof this[a]=="function"?this[a].bind(this):!Object.values(I1).includes(a)||!this.testInfo?this.page[a]:(this.locatorStack.length===0&&(this.pageInitialCallInTestFile=this.getFirstStackTraceFromTestFile()),this.pushToLocatorStack([{type:a,base:this.page,line:this.pageInitialCallInTestFile.line}]),n(function(v,O){try{return this.executeLocator(v,O)}catch(h){throw this.popLocatorChain(),h}},"Page").bind(this))}static async init(a,y,v,O,{runMode:h="normal",testIdSelector:B=void 0,apiKey:re,apiURL:z,options:p={}}){let m=new $p(a,h,B,y,v,O,{useChecksumSelectors:!0,useChecksumAI:!0,newAssertionsEnabled:!0,useMockData:!1,printLogs:!1,...p},re,z);return v.addTestInfo(m.getChecksumTestId(),O.testId),await m.asyncInit(),m.proxy}popLocatorChain(){return this.locatorStack.pop()}async asyncInit(){await this.page.addInitScript(()=>{window.sessionStorage.setItem("checksumai:disable","true")})}async onTestComplete(){await this.sendTestArtifacts(),this.monitorBridge.addSingleTestStats(!this.didFail,this.didHeal&&!this.didFail)}async sendTestArtifacts(){this.runMode!=="normal"&&(await this.codeMirror.write()).forEach(a=>this.monitorBridge.addAsset(a))}async getTraceFilePath(){if(this.isTracingActive)return this.hasRuntimeStartedTrace?C6(Ym(this.testInfo.file),this.checksumTestId).replace(".zip",".original.zip"):this.testInfo.outputPath("trace.zip")}didTestFail(){return this.didFail}async testId(a){a||(a=Ch(5),console.warn(`Checksum test id was not defined for test, will auto-generate. Please replace - "${this.testInfo.title}" with -
271
+ test(defineChecksumTest("${this.testInfo.title}", "${a}"), async ({ page }) => {...`)),this.checksumTestId=a,(this.options.useMockData||this.runMode==="refactor")&&await this.prepareAPIMock();let y=await this.getTraceFilePath();if(y&&this.monitorBridge.addAsset({type:"trace",path:y,testId:this.checksumTestId}),!1){let O=gS(Ym(this.testInfo.file),this.checksumTestId);this.monitorBridge.addAsset({type:"har",path:O,testId:this.checksumTestId})}}getChecksumTestId(){return this.checksumTestId}checksumSelector(a){return this.options.useChecksumSelectors&&(this.fallbacks.push(this.constructFallback(Kv).init({checksumId:a,fileName:this.testInfo.file,testId:this.checksumTestId})),this.sortFallbacks()),this.checksumStepId=a,this.proxy}checksumAI(...a){if(a.length===0)throw new Error("checksumAI missing arguments");if(!this.options.useChecksumAI)return this.proxy;let{apiKey:y,apiURL:v}=this;if(this.fallbacks.push(this.constructFallback(hp).init({goal:this.testInfo.title,apiKey:y,apiURL:v})),this.sortFallbacks(),this.fallbacks.filter(O=>O instanceof hp).forEach(O=>O.addMetadata({thought:a[0]})),this.checksumStepInitialCallInTestFile=this.getFirstStackTraceFromTestFile(),a.length===1)return this.proxy;if(typeof a[1]!="function")throw new Error("Second argument for withChecksumStep must be a function");this.checksumStepStack.push(a[0]);try{console.log("=== running test function");let O=this;return n(async function(){await a[1](),console.log("==== done running test function"),O.checksumStepStack.pop()},"Page")()}catch(O){console.log(O),this.checksumStepStack.pop()}}async loadScript(){try{return this.navigationPromise&&await this.navigationPromise,await this.page.addScriptTag({path:uF}),await this.page.evaluate(async({initModules:a,ESRAselectionRules:y})=>{window.checksum.testRunner.init(y,[],a)},{ESRAselectionRules:{testIdSelector:this.testIdSelector},initModules:{assertionGenerator:!0}}),wc(`[init] init script loaded for ${this.page.url()}`),!0}catch{return!1}}pushToLocatorStack(a){this.locatorStack.push(a)}getCurrentLocatorChain(){if(this.locatorStack.length)return this.locatorStack[this.locatorStack.length-1]}getCurrentLocatorInChain(){let a=this.getCurrentLocatorChain();return a==null?void 0:a[a.length-1]}getMessage(a,{initialSelector:y,selector:v,thought:O}={}){switch(a){case"script":return"Firing up checksum";case"initial":return`${y} failed, trying some checksum magic...`;case"force":return"check/uncheck methods failed, falling back to click action";case"esra-search":return"Checksum is looking for potential alternatives to resolve the issue...";case"esra-action":return`AI: use selector ${v}`;case"llm-prompt":return`Checksum is trying to achieve step "${O}" using AI...`;case"llm-action":return`AI: "${O}" using selector "${v}"`;case"fail":return`Checksum couldn't resolve the issue executing ${y}`}}onFallbackSuccess(){let a=this.testInfo._steps[this.testInfo._steps.length-1];a&&!a.endWallTime&&a.complete({error:{message:`Failed to resolve ${this.initialLocatorTitle}`,stack:""}})}setupStepInterceptors(){let a=["checksum-page.ts","checksum-test-extension.ts","checksum-playwright-runtime.js","code-mirror.ts","utils.ts","fallback/esra-fallback.ts","fallback/force-fallback.ts","fallback/llm-fallback.ts","index.js"].map(B=>(0,A6.join)(__dirname,B)),y={},v=n(B=>{var z,p,m,fe;return y[B.stepId]!==void 0?y[B.stepId]:B.location&&!a.includes(B.location.file)?!1:!!(B.stepId.includes(".evaluate@")||B.stepId.includes(".addScriptTag@")||(z=B.title)!=null&&z.includes("evaluate")||(p=B.title)!=null&&p.includes("addScriptTag")||(m=B.title)!=null&&m.includes("waitForLoadState")||B.category==="fixture"||(fe=B.title)!=null&&fe.includes("tracing.stop"))},"shouldFilterStep"),O=this.testInfo._onStepBegin;this.testInfo._onStepBegin=B=>{if(!this.phase&&v(B)){y[B.stepId]=!0;return}return y[B.stepId]=!1,this.phase==="initial"&&(this.initialLocatorTitle=B.title,B.location=this.pageInitialCallInTestFile),B.title.startsWith("proxy.")&&(B.title=B.title.replace("proxy.","page.")),this.phase&&this.phase!=="initial"&&(this.phaseMap[B.stepId]={phase:this.phase,payload:this.phasePayload,initialLocatorTitle:this.initialLocatorTitle},B.location=void 0,B.title=this.getMessage(this.phase,{initialSelector:this.initialLocatorTitle,...this.phasePayload})),this.phase=void 0,this.phasePayload=void 0,O(B)};let h=this.testInfo._onStepEnd;this.testInfo._onStepEnd=B=>{if(!y[B.stepId]){if(this.phaseMap[B.stepId]){let{phase:re,initialLocatorTitle:z,payload:p}=this.phaseMap[B.stepId];re==="fail"&&(B.error={message:`Failed to resolve ${z}`,stack:""})}return h(B)}}}getFirstStackTraceFromTestFile(){let a=this.getTestFileStackTrace()[0];if(!a)throw new Error(`Could not find test file location from stack trace ${$p.getStackTrace()}`);let v=[/\((.*):(\d+):(\d+)\)$/,/.*at (.*):(\d+):(\d+)$/].map(re=>re.exec(a)).find(re=>re!==null);if(!v)throw new Error(`Could not find test file location from stack trace ${a}`);let[,O,h,B]=v;return{file:O,line:parseInt(h),column:parseInt(B)}}getTestFileStackTrace(){return $p.getStackTrace().filter(y=>y.includes(this.testInfo.file))}isCalledDirectlyFromTestFunction(){let a=this.getTestFileStackTrace();if(a.length!==1+this.checksumStepStack.length)return!1;let y=a[0],v=/.*at (.*):(\d+):(\d+)$/;return this.checksumStepStack.length===0&&!v.exec(y)?!1:!this.isCalledThroughMethodInAnotherFile(y)}isCalledThroughMethodInAnotherFile(a){let y=$p.getStackTrace(),v=["node:internal","/node_modules/@playwright"],O=y.indexOf(a)-1;for(;O>=0&&v.some(B=>y[O].includes(B));)O--;let h=y[O];return!h.includes("checksum-page.ts")&&!h.includes(cF)}static getStackTrace(){return new Error().stack.split(`
272
272
  `)}getLocator(a,y){let v=this.getCurrentLocatorInChain();return v.base[v.type](a,y)}executeLocator(a,y){try{wc(`
273
273
  Executing locator ${this.getCurrentLocatorInChain().type} with ${typeof a=="string"?`selector ${a}`:"locator"}`);let v=this.getLocator(a,y);return new Proxy(v,{get:n(function(h,B){return this.getLocatorMethod(v,h,B)},"get").bind(this)})}catch(v){wc("Failed to locate",v)}}getLocatorMethod(a,y,v){return v==="constructor"?n(function(...h){return this.popLocatorChain(),y.constructor(...h)},"Locator"):v in y&&typeof y[v]!="function"||v===Symbol.toPrimitive||v in Object?(this.popLocatorChain(),y[v]):[...Object.values(I1),...Object.values(w1)].includes(v)?v==="or"?(wc("'Or' locator not supported, will execute normally"),this.popLocatorChain(),y[v]):(this.getCurrentLocatorChain().push({type:v,base:a}),n(function(...h){return this.executeLocator(...h)},"Locator").bind(this)):n(async function(...h){let B=await this.executeLocatorAction(a,v,h);return this.popLocatorChain(),B},"Locator").bind(this)}async executeLocatorAction(a,y,v){this.selector=a._selector;let O=this.getChecksumStepId();wc("Executing",y,this.selector);let h=y==="_expect";try{wc("Running initial locator..."),await this.navigationPromise,await this.page.evaluate(()=>!!window.checksum)||wc("[loadScript] checksum libs missing, marking as failed"),await this.stepWillExecute(h),this.phase="initial";let re=await L1(a,y,v,this.getTimeout(y,v));if(h&&(re==null?void 0:re.timedOut)===!0)return wc("Expect timeout"),this.didFail=!0,re;if(re!==!1)return await this.onStepSuccess(O,y==="_expect"),re;await this.onStepFailure()}catch(B){wc("Failed initial execution. Exception:",B.message)}return this.initiateFallbackSequence(O,a,y,v)}getChecksumStepId(){let a=this.checksumStepId;return this.checksumStepId=void 0,a}async stepWillExecute(a){this.selectionData=void 0,this.runMode==="refactor"&&(wc(`stepWillExecute called for line ${this.pageInitialCallInTestFile.line}`),this.isCalledDirectlyFromTestFunction()&&(await this.evaluateWithChecksum(async()=>await window.checksum.testRunner.startMonitoringForAssertions()),this.selectionData=[await M1(this.selector,this.page)].filter(y=>y),Object.values(this.selectionData).length===0?wc(`Failed fetching selection data ${a?"- maybe because it is not visible and running inside expect":""}`):wc("Successfully fetched selection data")))}async onStepSuccess(a,y,v=!1){var B,re,z,p;let O=(B=this.fallbacks.find(m=>m instanceof hp))==null?void 0:B.getFailedThought();if(this.resetFallbacks(),this.runMode==="normal"||this.runMode==="heal"&&!v||!this.codeMirror||!this.getCurrentLocatorChain())return;if(!this.isCalledDirectlyFromTestFunction()){wc("<!> Step called from helper function, will not refactor step");return}if(this.runMode==="refactor"&&!this.selectionData.length){wc("Failed fetching selection data, will not refactor step");return}wc("Will update in-memory code"+(this.selectionData&&this.selectionData.length>0?`
274
274
  locators:
@@ -303,7 +303,7 @@ ${O}`,y(h,O))return v}return v}addESRA(a,y){if(!this.esraMetadataMap)return"";if
303
303
  \\s]*(?:(?!\\1)[\\s\\S]))*\\1(?:[\r
304
304
  \\s]*,\\s*({[\\s\\S]*?}))?[\r
305
305
  \\s]*\\)`)}}};n(pm,"CodeMirror");var wh=class{constructor(a){this.hasMonitor=!1;a.options.hostReports&&(this.monitorAgentHost="http://localhost",this.monitorAgentPort=process.env.CHECKSUM_UPLOAD_AGENT_PORT,this.monitorAgentPort?this.hasMonitor=!0:wc("CHECKSUM_UPLOAD_AGENT_PORT is not defined"))}addAsset(a){this.signalUpload(a,["trace","har"].includes(a.type))}addTestInfo(a,y){this.sendMessage({type:"testInfo",payload:{checksumTestId:a,pwTestId:y}})}addSingleTestStats(a,y){this.sendMessage({type:"testStats",payload:{passed:a,healed:y}})}sendMessage(a){if(this.hasMonitor)return fetch(`${this.monitorAgentHost}:${this.monitorAgentPort}`,{method:"POST",body:JSON.stringify(a)}).catch(y=>{wc("Failed to send message to test run monitor",a,y)})}signalUpload(a,y=!1){return this.sendMessage({type:"asset",payload:a,watch:y})}};n(wh,"TestRunMonitorBridge");var GS={},_A=n((e,a,y={})=>{let{baseURL:v,runMode:O,apiKey:h,apiURL:B}=a,re=e.extend({codeMirror:[async({},z)=>{let p=await pm.init(O);await z(p)},{scope:"worker"}],monitorBridge:[async({},z)=>{let p=new wh(a);await z(p)},{scope:"worker"}],page:async({page:z,codeMirror:p,monitorBridge:m},fe,le)=>{let se=await $p.init(z,p,m,le,{runMode:O,apiKey:h,apiURL:B,options:y}),ce=QF(le);await se.testId(ce),await fe(se),await se.onTestComplete()}});return re.use({launchOptions:{args:["--remote-debugging-port=9222",...y!=null&&y.useMockData?["--disable-web-security"]:[]]},baseURL:v,bypassCSP:!0}),{test:re,defineChecksumTest:KF}},"createChecksumTestExtension"),KF=n((e,a)=>{let v=new Error().stack.split(`
306
- `).filter(O=>O.includes(".checksum.spec.ts"))[0];if(!v)throw new Error("Could not locate test location. Make sure test is run from valid checksum test file");return GS[v]=a,`${e} (checksumId: ${a})`},"defineChecksumTest");function QF(e){var O;let{file:a,line:y}=e,v=Object.keys(GS).filter(h=>h.trim().includes(a.trim()));if(v.length){for(let h=0;h<4;h++)for(let B of v)if(parseInt((O=B.split(":"))==null?void 0:O[1])-h===parseInt(y))return GS[B]}}n(QF,"getCurrentTestIdFromMapping");function XF(e){let a=E6(),{baseURL:y,runMode:v,options:O,apiKey:h,apiURL:B}=a;if(!y)throw new Error("baseURL is required - please set it in the config file");if(!h)throw new Error("apiKey is required - please set it in the config file - checksum.config.ts");return{..._A(e,a,O),login:R1(a)}}n(XF,"init");0&&(module.exports={RunMode,getChecksumConfig,getLogin,init});
306
+ `).filter(O=>O.includes(".checksum.spec.ts"))[0];if(!v)throw new Error("Could not locate test location. Make sure test is run from valid checksum test file");return GS[v]=a,e},"defineChecksumTest");function QF(e){var O;let{file:a,line:y}=e,v=Object.keys(GS).filter(h=>h.trim().includes(a.trim()));if(v.length){for(let h=0;h<4;h++)for(let B of v)if(parseInt((O=B.split(":"))==null?void 0:O[1])-h===parseInt(y))return GS[B]}}n(QF,"getCurrentTestIdFromMapping");function XF(e){let a=E6(),{baseURL:y,runMode:v,options:O,apiKey:h,apiURL:B}=a;if(!y)throw new Error("baseURL is required - please set it in the config file");if(!h)throw new Error("apiKey is required - please set it in the config file - checksum.config.ts");return{..._A(e,a,O),login:R1(a)}}n(XF,"init");0&&(module.exports={RunMode,getChecksumConfig,getLogin,init});
307
307
  /*! Bundled license information:
308
308
 
309
309
  typescript/lib/typescript.js:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checksum-ai/runtime",
3
- "version": "1.0.27",
3
+ "version": "1.0.29",
4
4
  "description": "Checksum.ai test runtime",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -5,5 +5,5 @@ GFS4: `),console.error(e)},"debug"));H[se]||(In=global[se]||[],Pn(H,In),H.close=
5
5
  see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001"),Op.checkPaths(e,a,"copy",p,(i,d)=>{if(i)return t(i);let{srcStat:n,destStat:l}=d;Op.checkParentPaths(e,n,a,"copy",s=>{if(s)return t(s);Qn(e,a,p,(m,o)=>{if(m)return t(m);if(!o)return t();Uo(l,e,a,p,t)})})})}r(qo,"copy");function Uo(e,a,p,t,i){let d=Fp.dirname(p);Po(d,(n,l)=>{if(n)return i(n);if(l)return hd(e,a,p,t,i);Bo(d,s=>s?i(s):hd(e,a,p,t,i))})}r(Uo,"checkParentDir");function Qn(e,a,p,t){if(!p.filter)return t(null,!0);Promise.resolve(p.filter(e,a)).then(i=>t(null,i),i=>t(i))}r(Qn,"runFilter");function hd(e,a,p,t,i){(t.dereference?xe.stat:xe.lstat)(a,(n,l)=>n?i(n):l.isDirectory()?$o(l,e,a,p,t,i):l.isFile()||l.isCharacterDevice()||l.isBlockDevice()?Mo(l,e,a,p,t,i):l.isSymbolicLink()?Ko(e,a,p,t,i):l.isSocket()?i(new Error(`Cannot copy a socket file: ${a}`)):l.isFIFO()?i(new Error(`Cannot copy a FIFO pipe: ${a}`)):i(new Error(`Unknown file: ${a}`)))}r(hd,"getStats");function Mo(e,a,p,t,i,d){return a?zo(e,p,t,i,d):e3(e,p,t,i,d)}r(Mo,"onFile");function zo(e,a,p,t,i){if(t.overwrite)xe.unlink(p,d=>d?i(d):e3(e,a,p,t,i));else return t.errorOnExist?i(new Error(`'${p}' already exists`)):i()}r(zo,"mayCopyFile");function e3(e,a,p,t,i){xe.copyFile(a,p,d=>d?i(d):t.preserveTimestamps?jo(e.mode,a,p,i):Zt(p,e.mode,i))}r(e3,"copyFile");function jo(e,a,p,t){return Zo(e)?Wo(p,e,i=>i?t(i):Xn(e,a,p,t)):Xn(e,a,p,t)}r(jo,"handleTimestampsAndMode");function Zo(e){return(e&128)===0}r(Zo,"fileIsNotWritable");function Wo(e,a,p){return Zt(e,a|128,p)}r(Wo,"makeFileWritable");function Xn(e,a,p,t){Ho(a,p,i=>i?t(i):Zt(p,e,t))}r(Xn,"setDestTimestampsAndMode");function Zt(e,a,p){return xe.chmod(e,a,p)}r(Zt,"setDestMode");function Ho(e,a,p){xe.stat(e,(t,i)=>t?p(t):Lo(a,i.atime,i.mtime,p))}r(Ho,"setDestTimestamps");function $o(e,a,p,t,i,d){return a?a3(p,t,i,d):Go(e.mode,p,t,i,d)}r($o,"onDir");function Go(e,a,p,t,i){xe.mkdir(p,d=>{if(d)return i(d);a3(a,p,t,n=>n?i(n):Zt(p,e,i))})}r(Go,"mkDirAndCopy");function a3(e,a,p,t){xe.readdir(e,(i,d)=>i?t(i):cd(d,e,a,p,t))}r(a3,"copyDir");function cd(e,a,p,t,i){let d=e.pop();return d?Jo(e,d,a,p,t,i):i()}r(cd,"copyDirItems");function Jo(e,a,p,t,i,d){let n=Fp.join(p,a),l=Fp.join(t,a);Qn(n,l,i,(s,m)=>{if(s)return d(s);if(!m)return cd(e,p,t,i,d);Op.checkPaths(n,l,"copy",i,(o,c)=>{if(o)return d(o);let{destStat:f}=c;hd(f,n,l,i,u=>u?d(u):cd(e,p,t,i,d))})})}r(Jo,"copyDirItem");function Ko(e,a,p,t,i){xe.readlink(a,(d,n)=>{if(d)return i(d);if(t.dereference&&(n=Fp.resolve(process.cwd(),n)),e)xe.readlink(p,(l,s)=>l?l.code==="EINVAL"||l.code==="UNKNOWN"?xe.symlink(n,p,i):i(l):(t.dereference&&(s=Fp.resolve(process.cwd(),s)),Op.isSrcSubdir(n,s)?i(new Error(`Cannot copy '${n}' to a subdirectory of itself, '${s}'.`)):Op.isSrcSubdir(s,n)?i(new Error(`Cannot overwrite '${s}' with '${n}'.`)):Yo(n,p,i)));else return xe.symlink(n,p,i)})}r(Ko,"onLink");function Yo(e,a,p){xe.unlink(a,t=>t?p(t):xe.symlink(e,a,p))}r(Yo,"copyLink");p3.exports=qo});var l3=v((Pc,n3)=>{"use strict";var _e=be(),Rp=require("path"),Xo=ze().mkdirsSync,Qo=ud().utimesMillisSync,Vp=ea();function em(e,a,p){typeof p=="function"&&(p={filter:p}),p=p||{},p.clobber="clobber"in p?!!p.clobber:!0,p.overwrite="overwrite"in p?!!p.overwrite:p.clobber,p.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
6
6
 
7
7
  see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");let{srcStat:t,destStat:i}=Vp.checkPathsSync(e,a,"copy",p);if(Vp.checkParentPathsSync(e,t,a,"copy"),p.filter&&!p.filter(e,a))return;let d=Rp.dirname(a);return _e.existsSync(d)||Xo(d),i3(i,e,a,p)}r(em,"copySync");function i3(e,a,p,t){let d=(t.dereference?_e.statSync:_e.lstatSync)(a);if(d.isDirectory())return nm(d,e,a,p,t);if(d.isFile()||d.isCharacterDevice()||d.isBlockDevice())return am(d,e,a,p,t);if(d.isSymbolicLink())return om(e,a,p,t);throw d.isSocket()?new Error(`Cannot copy a socket file: ${a}`):d.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${a}`):new Error(`Unknown file: ${a}`)}r(i3,"getStats");function am(e,a,p,t,i){return a?pm(e,p,t,i):d3(e,p,t,i)}r(am,"onFile");function pm(e,a,p,t){if(t.overwrite)return _e.unlinkSync(p),d3(e,a,p,t);if(t.errorOnExist)throw new Error(`'${p}' already exists`)}r(pm,"mayCopyFile");function d3(e,a,p,t){return _e.copyFileSync(a,p),t.preserveTimestamps&&tm(e.mode,a,p),vd(p,e.mode)}r(d3,"copyFile");function tm(e,a,p){return im(e)&&dm(p,e),rm(a,p)}r(tm,"handleTimestamps");function im(e){return(e&128)===0}r(im,"fileIsNotWritable");function dm(e,a){return vd(e,a|128)}r(dm,"makeFileWritable");function vd(e,a){return _e.chmodSync(e,a)}r(vd,"setDestMode");function rm(e,a){let p=_e.statSync(e);return Qo(a,p.atime,p.mtime)}r(rm,"setDestTimestamps");function nm(e,a,p,t,i){return a?r3(p,t,i):lm(e.mode,p,t,i)}r(nm,"onDir");function lm(e,a,p,t){return _e.mkdirSync(p),r3(a,p,t),vd(p,e)}r(lm,"mkDirAndCopy");function r3(e,a,p){_e.readdirSync(e).forEach(t=>sm(t,e,a,p))}r(r3,"copyDir");function sm(e,a,p,t){let i=Rp.join(a,e),d=Rp.join(p,e);if(t.filter&&!t.filter(i,d))return;let{destStat:n}=Vp.checkPathsSync(i,d,"copy",t);return i3(n,i,d,t)}r(sm,"copyDirItem");function om(e,a,p,t){let i=_e.readlinkSync(a);if(t.dereference&&(i=Rp.resolve(process.cwd(),i)),e){let d;try{d=_e.readlinkSync(p)}catch(n){if(n.code==="EINVAL"||n.code==="UNKNOWN")return _e.symlinkSync(i,p);throw n}if(t.dereference&&(d=Rp.resolve(process.cwd(),d)),Vp.isSrcSubdir(i,d))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${d}'.`);if(Vp.isSrcSubdir(d,i))throw new Error(`Cannot overwrite '${d}' with '${i}'.`);return mm(i,p)}else return _e.symlinkSync(i,p)}r(om,"onLink");function mm(e,a){return _e.unlinkSync(a),_e.symlinkSync(e,a)}r(mm,"copyLink");n3.exports=em});var Wt=v((qc,s3)=>{"use strict";var um=Se().fromCallback;s3.exports={copy:um(t3()),copySync:l3()}});var Ip=v((Uc,m3)=>{"use strict";var o3=be(),fm=Se().fromCallback;function hm(e,a){o3.rm(e,{recursive:!0,force:!0},a)}r(hm,"remove");function cm(e){o3.rmSync(e,{recursive:!0,force:!0})}r(cm,"removeSync");m3.exports={remove:fm(hm),removeSync:cm}});var g3=v((zc,_3)=>{"use strict";var vm=Se().fromPromise,h3=Q1(),c3=require("path"),v3=ze(),w3=Ip(),u3=vm(r(async function(a){let p;try{p=await h3.readdir(a)}catch{return v3.mkdirs(a)}return Promise.all(p.map(t=>w3.remove(c3.join(a,t))))},"emptyDir"));function f3(e){let a;try{a=h3.readdirSync(e)}catch{return v3.mkdirsSync(e)}a.forEach(p=>{p=c3.join(e,p),w3.removeSync(p)})}r(f3,"emptyDirSync");_3.exports={emptyDirSync:f3,emptydirSync:f3,emptyDir:u3,emptydir:u3}});var x3=v((Zc,b3)=>{"use strict";var wm=Se().fromCallback,y3=require("path"),O1=be(),S3=ze();function _m(e,a){function p(){O1.writeFile(e,"",t=>{if(t)return a(t);a()})}r(p,"makeFile"),O1.stat(e,(t,i)=>{if(!t&&i.isFile())return a();let d=y3.dirname(e);O1.stat(d,(n,l)=>{if(n)return n.code==="ENOENT"?S3.mkdirs(d,s=>{if(s)return a(s);p()}):a(n);l.isDirectory()?p():O1.readdir(d,s=>{if(s)return a(s)})})})}r(_m,"createFile");function gm(e){let a;try{a=O1.statSync(e)}catch{}if(a&&a.isFile())return;let p=y3.dirname(e);try{O1.statSync(p).isDirectory()||O1.readdirSync(p)}catch(t){if(t&&t.code==="ENOENT")S3.mkdirsSync(p);else throw t}O1.writeFileSync(e,"")}r(gm,"createFileSync");b3.exports={createFile:wm(_m),createFileSync:gm}});var k3=v((Hc,E3)=>{"use strict";var ym=Se().fromCallback,T3=require("path"),R1=be(),N3=ze(),Sm=F1().pathExists,{areIdentical:D3}=ea();function bm(e,a,p){function t(i,d){R1.link(i,d,n=>{if(n)return p(n);p(null)})}r(t,"makeLink"),R1.lstat(a,(i,d)=>{R1.lstat(e,(n,l)=>{if(n)return n.message=n.message.replace("lstat","ensureLink"),p(n);if(d&&D3(l,d))return p(null);let s=T3.dirname(a);Sm(s,(m,o)=>{if(m)return p(m);if(o)return t(e,a);N3.mkdirs(s,c=>{if(c)return p(c);t(e,a)})})})})}r(bm,"createLink");function xm(e,a){let p;try{p=R1.lstatSync(a)}catch{}try{let d=R1.lstatSync(e);if(p&&D3(d,p))return}catch(d){throw d.message=d.message.replace("lstat","ensureLink"),d}let t=T3.dirname(a);return R1.existsSync(t)||N3.mkdirsSync(t),R1.linkSync(e,a)}r(xm,"createLinkSync");E3.exports={createLink:ym(bm),createLinkSync:xm}});var C3=v((Gc,A3)=>{"use strict";var V1=require("path"),Bp=be(),Tm=F1().pathExists;function Nm(e,a,p){if(V1.isAbsolute(e))return Bp.lstat(e,t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),p(t)):p(null,{toCwd:e,toDst:e}));{let t=V1.dirname(a),i=V1.join(t,e);return Tm(i,(d,n)=>d?p(d):n?p(null,{toCwd:i,toDst:e}):Bp.lstat(e,l=>l?(l.message=l.message.replace("lstat","ensureSymlink"),p(l)):p(null,{toCwd:e,toDst:V1.relative(t,e)})))}}r(Nm,"symlinkPaths");function Dm(e,a){let p;if(V1.isAbsolute(e)){if(p=Bp.existsSync(e),!p)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}else{let t=V1.dirname(a),i=V1.join(t,e);if(p=Bp.existsSync(i),p)return{toCwd:i,toDst:e};if(p=Bp.existsSync(e),!p)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:V1.relative(t,e)}}}r(Dm,"symlinkPathsSync");A3.exports={symlinkPaths:Nm,symlinkPathsSync:Dm}});var R3=v((Kc,O3)=>{"use strict";var F3=be();function Em(e,a,p){if(p=typeof a=="function"?a:p,a=typeof a=="function"?!1:a,a)return p(null,a);F3.lstat(e,(t,i)=>{if(t)return p(null,"file");a=i&&i.isDirectory()?"dir":"file",p(null,a)})}r(Em,"symlinkType");function km(e,a){let p;if(a)return a;try{p=F3.lstatSync(e)}catch{return"file"}return p&&p.isDirectory()?"dir":"file"}r(km,"symlinkTypeSync");O3.exports={symlinkType:Em,symlinkTypeSync:km}});var M3=v((Xc,U3)=>{"use strict";var Am=Se().fromCallback,I3=require("path"),je=Q1(),B3=ze(),Cm=B3.mkdirs,Fm=B3.mkdirsSync,P3=C3(),Om=P3.symlinkPaths,Rm=P3.symlinkPathsSync,L3=R3(),Vm=L3.symlinkType,Im=L3.symlinkTypeSync,Bm=F1().pathExists,{areIdentical:q3}=ea();function Pm(e,a,p,t){t=typeof p=="function"?p:t,p=typeof p=="function"?!1:p,je.lstat(a,(i,d)=>{!i&&d.isSymbolicLink()?Promise.all([je.stat(e),je.stat(a)]).then(([n,l])=>{if(q3(n,l))return t(null);V3(e,a,p,t)}):V3(e,a,p,t)})}r(Pm,"createSymlink");function V3(e,a,p,t){Om(e,a,(i,d)=>{if(i)return t(i);e=d.toDst,Vm(d.toCwd,p,(n,l)=>{if(n)return t(n);let s=I3.dirname(a);Bm(s,(m,o)=>{if(m)return t(m);if(o)return je.symlink(e,a,l,t);Cm(s,c=>{if(c)return t(c);je.symlink(e,a,l,t)})})})})}r(V3,"_createSymlink");function Lm(e,a,p){let t;try{t=je.lstatSync(a)}catch{}if(t&&t.isSymbolicLink()){let l=je.statSync(e),s=je.statSync(a);if(q3(l,s))return}let i=Rm(e,a);e=i.toDst,p=Im(i.toCwd,p);let d=I3.dirname(a);return je.existsSync(d)||Fm(d),je.symlinkSync(e,a,p)}r(Lm,"createSymlinkSync");U3.exports={createSymlink:Am(Pm),createSymlinkSync:Lm}});var J3=v((ev,G3)=>{"use strict";var{createFile:z3,createFileSync:j3}=x3(),{createLink:Z3,createLinkSync:W3}=k3(),{createSymlink:H3,createSymlinkSync:$3}=M3();G3.exports={createFile:z3,createFileSync:j3,ensureFile:z3,ensureFileSync:j3,createLink:Z3,createLinkSync:W3,ensureLink:Z3,ensureLinkSync:W3,createSymlink:H3,createSymlinkSync:$3,ensureSymlink:H3,ensureSymlinkSync:$3}});var Ht=v((av,K3)=>{function qm(e,{EOL:a=`
8
- `,finalEOL:p=!0,replacer:t=null,spaces:i}={}){let d=p?a:"";return JSON.stringify(e,t,i).replace(/\n/g,a)+d}r(qm,"stringify");function Um(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e.replace(/^\uFEFF/,"")}r(Um,"stripBom");K3.exports={stringify:qm,stripBom:Um}});var e9=v((tv,Q3)=>{var qa;try{qa=be()}catch{qa=require("fs")}var $t=Se(),{stringify:Y3,stripBom:X3}=Ht();async function Mm(e,a={}){typeof a=="string"&&(a={encoding:a});let p=a.fs||qa,t="throws"in a?a.throws:!0,i=await $t.fromCallback(p.readFile)(e,a);i=X3(i);let d;try{d=JSON.parse(i,a?a.reviver:null)}catch(n){if(t)throw n.message=`${e}: ${n.message}`,n;return null}return d}r(Mm,"_readFile");var zm=$t.fromPromise(Mm);function jm(e,a={}){typeof a=="string"&&(a={encoding:a});let p=a.fs||qa,t="throws"in a?a.throws:!0;try{let i=p.readFileSync(e,a);return i=X3(i),JSON.parse(i,a.reviver)}catch(i){if(t)throw i.message=`${e}: ${i.message}`,i;return null}}r(jm,"readFileSync");async function Zm(e,a,p={}){let t=p.fs||qa,i=Y3(a,p);await $t.fromCallback(t.writeFile)(e,i,p)}r(Zm,"_writeFile");var Wm=$t.fromPromise(Zm);function Hm(e,a,p={}){let t=p.fs||qa,i=Y3(a,p);return t.writeFileSync(e,i,p)}r(Hm,"writeFileSync");var $m={readFile:zm,readFileSync:jm,writeFile:Wm,writeFileSync:Hm};Q3.exports=$m});var p9=v((dv,a9)=>{"use strict";var Gt=e9();a9.exports={readJson:Gt.readFile,readJsonSync:Gt.readFileSync,writeJson:Gt.writeFile,writeJsonSync:Gt.writeFileSync}});var Jt=v((rv,d9)=>{"use strict";var Gm=Se().fromCallback,Pp=be(),t9=require("path"),i9=ze(),Jm=F1().pathExists;function Km(e,a,p,t){typeof p=="function"&&(t=p,p="utf8");let i=t9.dirname(e);Jm(i,(d,n)=>{if(d)return t(d);if(n)return Pp.writeFile(e,a,p,t);i9.mkdirs(i,l=>{if(l)return t(l);Pp.writeFile(e,a,p,t)})})}r(Km,"outputFile");function Ym(e,...a){let p=t9.dirname(e);if(Pp.existsSync(p))return Pp.writeFileSync(e,...a);i9.mkdirsSync(p),Pp.writeFileSync(e,...a)}r(Ym,"outputFileSync");d9.exports={outputFile:Gm(Km),outputFileSync:Ym}});var n9=v((lv,r9)=>{"use strict";var{stringify:Xm}=Ht(),{outputFile:Qm}=Jt();async function eu(e,a,p={}){let t=Xm(a,p);await Qm(e,t,p)}r(eu,"outputJson");r9.exports=eu});var s9=v((ov,l9)=>{"use strict";var{stringify:au}=Ht(),{outputFileSync:pu}=Jt();function tu(e,a,p){let t=au(a,p);pu(e,t,p)}r(tu,"outputJsonSync");l9.exports=tu});var m9=v((uv,o9)=>{"use strict";var iu=Se().fromPromise,ge=p9();ge.outputJson=iu(n9());ge.outputJsonSync=s9();ge.outputJSON=ge.outputJson;ge.outputJSONSync=ge.outputJsonSync;ge.writeJSON=ge.writeJson;ge.writeJSONSync=ge.writeJsonSync;ge.readJSON=ge.readJson;ge.readJSONSync=ge.readJsonSync;o9.exports=ge});var v9=v((fv,c9)=>{"use strict";var du=be(),_d=require("path"),ru=Wt().copy,h9=Ip().remove,nu=ze().mkdirp,lu=F1().pathExists,u9=ea();function su(e,a,p,t){typeof p=="function"&&(t=p,p={}),p=p||{};let i=p.overwrite||p.clobber||!1;u9.checkPaths(e,a,"move",p,(d,n)=>{if(d)return t(d);let{srcStat:l,isChangingCase:s=!1}=n;u9.checkParentPaths(e,l,a,"move",m=>{if(m)return t(m);if(ou(a))return f9(e,a,i,s,t);nu(_d.dirname(a),o=>o?t(o):f9(e,a,i,s,t))})})}r(su,"move");function ou(e){let a=_d.dirname(e);return _d.parse(a).root===a}r(ou,"isParentRoot");function f9(e,a,p,t,i){if(t)return wd(e,a,p,i);if(p)return h9(a,d=>d?i(d):wd(e,a,p,i));lu(a,(d,n)=>d?i(d):n?i(new Error("dest already exists.")):wd(e,a,p,i))}r(f9,"doRename");function wd(e,a,p,t){du.rename(e,a,i=>i?i.code!=="EXDEV"?t(i):mu(e,a,p,t):t())}r(wd,"rename");function mu(e,a,p,t){ru(e,a,{overwrite:p,errorOnExist:!0},d=>d?t(d):h9(e,t))}r(mu,"moveAcrossDevice");c9.exports=su});var S9=v((cv,y9)=>{"use strict";var _9=be(),yd=require("path"),uu=Wt().copySync,g9=Ip().removeSync,fu=ze().mkdirpSync,w9=ea();function hu(e,a,p){p=p||{};let t=p.overwrite||p.clobber||!1,{srcStat:i,isChangingCase:d=!1}=w9.checkPathsSync(e,a,"move",p);return w9.checkParentPathsSync(e,i,a,"move"),cu(a)||fu(yd.dirname(a)),vu(e,a,t,d)}r(hu,"moveSync");function cu(e){let a=yd.dirname(e);return yd.parse(a).root===a}r(cu,"isParentRoot");function vu(e,a,p,t){if(t)return gd(e,a,p);if(p)return g9(a),gd(e,a,p);if(_9.existsSync(a))throw new Error("dest already exists.");return gd(e,a,p)}r(vu,"doRename");function gd(e,a,p){try{_9.renameSync(e,a)}catch(t){if(t.code!=="EXDEV")throw t;return wu(e,a,p)}}r(gd,"rename");function wu(e,a,p){return uu(e,a,{overwrite:p,errorOnExist:!0}),g9(e)}r(wu,"moveAcrossDevice");y9.exports=hu});var x9=v((wv,b9)=>{"use strict";var _u=Se().fromCallback;b9.exports={move:_u(v9()),moveSync:S9()}});var N9=v((_v,T9)=>{"use strict";T9.exports={...Q1(),...Wt(),...g3(),...J3(),...m9(),...ze(),...x9(),...Jt(),...F1(),...Ip()}});var gu={};L9(gu,{TestRunMonitor:()=>qp});module.exports=q9(gu);var F9=I1(require("net")),Ua=require("fs"),Sd=I1(nr());var na=r(e=>new Promise(a=>setTimeout(a,e)),"awaitSleep"),lr=r(async(e,a=1e3,p="action hang guard timed out")=>{let t="guard-timed-out",i=r(async()=>(await na(a+1e3),t),"guard"),d=await Promise.race([e,i()]);if(typeof d=="string"&&d===t)throw new Error(p);return d},"guardReturn");var Xt=require("path");var Tn=require("fs"),Nn=require("jsdom"),Dn=require("fs/promises"),En=I1(Lt());var kp=class{constructor(a,p,t,i="https://api.checksum.ai/cdn/test-runs"){this.reportHTMLFilePath=a;this.testRunUUID=p;this.pwTestIdToChecksumTestId=t;this.assetsBaseURL=i}async process(){await this.initializeDOM(),this.makeLightModeOnly(),await this.editZipFile(),await this.writeFile()}async initializeDOM(){return this.dom=await Nn.JSDOM.fromFile(this.reportHTMLFilePath,{resources:"usable",runScripts:"dangerously"}),new Promise(a=>this.dom.window.addEventListener("load",a))}async writeFile(){let a=this.dom.serialize();a=a.replace(/window.playwrightReportBase64 = ".*";/,`window.playwrightReportBase64 = "${this.newBase64Zip}";`),await(0,Dn.cp)(this.reportHTMLFilePath,this.reportHTMLFilePath.replace(".html",".backup.html")),(0,Tn.writeFileSync)(this.reportHTMLFilePath,a)}makeLightModeOnly(){this.dom.window.document.querySelector('meta[name="color-scheme"]').setAttribute("content","light");let p=this.dom.window.document.querySelector("head style"),t=p.innerHTML,i=/@media\s*\(prefers-color-scheme:\s*dark\)\s*{[^}]*}/g,d=t.replace(i,"");p.innerHTML=d}async editZipFile(){let a=this.dom.window.playwrightReportBase64.replace("data:application/zip;base64,",""),p=await(0,En.loadAsync)(a,{base64:!0});for(let i of Object.keys(p.files)){let d=p.file(i);if(d){let n=await d.async("string"),l=JSON.parse(n);i.startsWith("report")?this.handleReportJSON(l):this.handleFileReportJSON(l),p.file(i,JSON.stringify(l))}}let t=await p.generateAsync({type:"base64"});this.newBase64Zip=`data:application/zip;base64,${t}`}getCloudPath(a){return`${this.assetsBaseURL}/${this.testRunUUID}/${this.pwTestIdToChecksumTestId[a]}`}handleReportJSON(a){a.files.forEach(p=>p.tests.forEach(t=>{t.results.forEach(i=>{i.attachments.forEach(d=>{this.handleAttachment(d,t.testId)})})}))}handleFileReportJSON(a){var p;(p=a.tests)==null||p.forEach(t=>{var i;(i=t.results)==null||i.forEach(d=>{var n;(n=d.attachments)==null||n.forEach(l=>this.handleAttachment(l,t.testId))})})}handleAttachment(a,p){["trace","video"].includes(a.name)&&(a.path=`${this.getCloudPath(p)}/${a.name}`)}};r(kp,"PlaywrightReportProcessor");var O9=require("http");var ue=require("fs"),pd=I1(Lt()),td=require("readline/promises");var Ap=class{constructor(a,p,t,i){this.mode=a;this.inputZipFilePath=p;this.outputZipFilePath=t;this.frontendLogPrefix=i;this.originalTraceFileNames=[];this.remainingTraceFileNames=[];this.wallTimesToBeRemoved={};this.callIdsRemovals={};this.consoleLogGUIDs=[];this.numberOfLinesPerFile={};this.generationAllowedAPIName=["page.goto","page.waitForNavigation","locator.fill","locator.click","locator.hover","locator.check","locator.uncheck"]}async process(){await this.unzipAndWriteTraceFiles();for(let a of this.originalTraceFileNames)await this.preprocessFile(a);for(this.remainingTraceFileNames=[...this.originalTraceFileNames];this.remainingTraceFileNames.length>0;)for(let a of this.remainingTraceFileNames)await this.processFile(a);await this.reZip()}getBackupZipFilePath(){return this.inputZipFilePath.replace(".zip",".trace-files-backup.zip")}async unzipAndWriteTraceFiles(){let a=(0,ue.readFileSync)(this.inputZipFilePath);this.zipped=await(0,pd.loadAsync)(a),this.originalTraceFileNames=Object.keys(this.zipped.files).filter(i=>i.endsWith(".trace"));let p=await(0,pd.loadAsync)("UEsFBgAAAAAAAAAAAAAAAAAAAAAAAA==",{base64:!0});for(let i of this.originalTraceFileNames){let d=await this.zipped.file(i).async("string");(0,ue.writeFileSync)(i,d),p.file(i,d)}let t=await p.generateAsync({type:"nodebuffer"});(0,ue.writeFileSync)(this.getBackupZipFilePath(),t)}async reZip(){for(let p of this.originalTraceFileNames){let t=(0,ue.readFileSync)(p);this.zipped.remove(p),this.zipped.file(p,t)}let a=await this.zipped.generateAsync({type:"nodebuffer"});(0,ue.existsSync)(this.outputZipFilePath)&&(0,ue.rmSync)(this.outputZipFilePath),(0,ue.writeFileSync)(this.outputZipFilePath,a);for(let p of this.originalTraceFileNames)(0,ue.rmSync)(p)}async preprocessFile(a){this.callIdsRemovals[a]={callIdsToBeRemoved:{},arrayOfCallIdsToBeRemoved:new Set};let p=(0,ue.createReadStream)(a),t=(0,td.createInterface)({input:p,crlfDelay:1/0}),i=0;for await(let d of t){i++;let n=JSON.parse(d);this.shouldLineBeRemoved(n)&&(n.wallTime&&(this.wallTimesToBeRemoved[n.wallTime]=!0),n.callId&&(this.callIdsRemovals[a].callIdsToBeRemoved[n.callId]=!0,this.callIdsRemovals[a].arrayOfCallIdsToBeRemoved.add(n.callId)))}this.numberOfLinesPerFile[a]=i}async processFile(a){var n,l;let p=[],t=(0,ue.createReadStream)(a),i=(0,td.createInterface)({input:t,crlfDelay:1/0}),d=a;for await(let s of i){let m=JSON.parse(s),o=!1;if(this.frontendLogPrefix){if(this.isChecksumConsoleLog(m)){this.consoleLogGUIDs.push(m.guid);continue}if(this.isConsoleLogMetadata(m)&&this.consoleLogGUIDs.includes((l=(n=m.params)==null?void 0:n.message)==null?void 0:l.guid))continue}if(this.lineCanBeRemoved(m)&&(this.wallTimesToBeRemoved[m.wallTime]||this.callIdsRemovals[d].callIdsToBeRemoved[m.callId]||Array.from(this.callIdsRemovals[d].arrayOfCallIdsToBeRemoved).some(c=>s.includes(`"${c}"`)))&&(o=!0),o){m.callId&&(this.callIdsRemovals[d].callIdsToBeRemoved[m.callId]=!0,this.callIdsRemovals[d].arrayOfCallIdsToBeRemoved.add(m.callId));continue}p.push(s)}if(p.length===this.numberOfLinesPerFile[d]){let s=this.remainingTraceFileNames.indexOf(d);s>-1&&this.remainingTraceFileNames.splice(s,1)}else this.numberOfLinesPerFile[d]=p.length,(0,ue.writeFileSync)(a,p.join(`
8
+ `,finalEOL:p=!0,replacer:t=null,spaces:i}={}){let d=p?a:"";return JSON.stringify(e,t,i).replace(/\n/g,a)+d}r(qm,"stringify");function Um(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e.replace(/^\uFEFF/,"")}r(Um,"stripBom");K3.exports={stringify:qm,stripBom:Um}});var e9=v((tv,Q3)=>{var qa;try{qa=be()}catch{qa=require("fs")}var $t=Se(),{stringify:Y3,stripBom:X3}=Ht();async function Mm(e,a={}){typeof a=="string"&&(a={encoding:a});let p=a.fs||qa,t="throws"in a?a.throws:!0,i=await $t.fromCallback(p.readFile)(e,a);i=X3(i);let d;try{d=JSON.parse(i,a?a.reviver:null)}catch(n){if(t)throw n.message=`${e}: ${n.message}`,n;return null}return d}r(Mm,"_readFile");var zm=$t.fromPromise(Mm);function jm(e,a={}){typeof a=="string"&&(a={encoding:a});let p=a.fs||qa,t="throws"in a?a.throws:!0;try{let i=p.readFileSync(e,a);return i=X3(i),JSON.parse(i,a.reviver)}catch(i){if(t)throw i.message=`${e}: ${i.message}`,i;return null}}r(jm,"readFileSync");async function Zm(e,a,p={}){let t=p.fs||qa,i=Y3(a,p);await $t.fromCallback(t.writeFile)(e,i,p)}r(Zm,"_writeFile");var Wm=$t.fromPromise(Zm);function Hm(e,a,p={}){let t=p.fs||qa,i=Y3(a,p);return t.writeFileSync(e,i,p)}r(Hm,"writeFileSync");var $m={readFile:zm,readFileSync:jm,writeFile:Wm,writeFileSync:Hm};Q3.exports=$m});var p9=v((dv,a9)=>{"use strict";var Gt=e9();a9.exports={readJson:Gt.readFile,readJsonSync:Gt.readFileSync,writeJson:Gt.writeFile,writeJsonSync:Gt.writeFileSync}});var Jt=v((rv,d9)=>{"use strict";var Gm=Se().fromCallback,Pp=be(),t9=require("path"),i9=ze(),Jm=F1().pathExists;function Km(e,a,p,t){typeof p=="function"&&(t=p,p="utf8");let i=t9.dirname(e);Jm(i,(d,n)=>{if(d)return t(d);if(n)return Pp.writeFile(e,a,p,t);i9.mkdirs(i,l=>{if(l)return t(l);Pp.writeFile(e,a,p,t)})})}r(Km,"outputFile");function Ym(e,...a){let p=t9.dirname(e);if(Pp.existsSync(p))return Pp.writeFileSync(e,...a);i9.mkdirsSync(p),Pp.writeFileSync(e,...a)}r(Ym,"outputFileSync");d9.exports={outputFile:Gm(Km),outputFileSync:Ym}});var n9=v((lv,r9)=>{"use strict";var{stringify:Xm}=Ht(),{outputFile:Qm}=Jt();async function eu(e,a,p={}){let t=Xm(a,p);await Qm(e,t,p)}r(eu,"outputJson");r9.exports=eu});var s9=v((ov,l9)=>{"use strict";var{stringify:au}=Ht(),{outputFileSync:pu}=Jt();function tu(e,a,p){let t=au(a,p);pu(e,t,p)}r(tu,"outputJsonSync");l9.exports=tu});var m9=v((uv,o9)=>{"use strict";var iu=Se().fromPromise,ge=p9();ge.outputJson=iu(n9());ge.outputJsonSync=s9();ge.outputJSON=ge.outputJson;ge.outputJSONSync=ge.outputJsonSync;ge.writeJSON=ge.writeJson;ge.writeJSONSync=ge.writeJsonSync;ge.readJSON=ge.readJson;ge.readJSONSync=ge.readJsonSync;o9.exports=ge});var v9=v((fv,c9)=>{"use strict";var du=be(),_d=require("path"),ru=Wt().copy,h9=Ip().remove,nu=ze().mkdirp,lu=F1().pathExists,u9=ea();function su(e,a,p,t){typeof p=="function"&&(t=p,p={}),p=p||{};let i=p.overwrite||p.clobber||!1;u9.checkPaths(e,a,"move",p,(d,n)=>{if(d)return t(d);let{srcStat:l,isChangingCase:s=!1}=n;u9.checkParentPaths(e,l,a,"move",m=>{if(m)return t(m);if(ou(a))return f9(e,a,i,s,t);nu(_d.dirname(a),o=>o?t(o):f9(e,a,i,s,t))})})}r(su,"move");function ou(e){let a=_d.dirname(e);return _d.parse(a).root===a}r(ou,"isParentRoot");function f9(e,a,p,t,i){if(t)return wd(e,a,p,i);if(p)return h9(a,d=>d?i(d):wd(e,a,p,i));lu(a,(d,n)=>d?i(d):n?i(new Error("dest already exists.")):wd(e,a,p,i))}r(f9,"doRename");function wd(e,a,p,t){du.rename(e,a,i=>i?i.code!=="EXDEV"?t(i):mu(e,a,p,t):t())}r(wd,"rename");function mu(e,a,p,t){ru(e,a,{overwrite:p,errorOnExist:!0},d=>d?t(d):h9(e,t))}r(mu,"moveAcrossDevice");c9.exports=su});var S9=v((cv,y9)=>{"use strict";var _9=be(),yd=require("path"),uu=Wt().copySync,g9=Ip().removeSync,fu=ze().mkdirpSync,w9=ea();function hu(e,a,p){p=p||{};let t=p.overwrite||p.clobber||!1,{srcStat:i,isChangingCase:d=!1}=w9.checkPathsSync(e,a,"move",p);return w9.checkParentPathsSync(e,i,a,"move"),cu(a)||fu(yd.dirname(a)),vu(e,a,t,d)}r(hu,"moveSync");function cu(e){let a=yd.dirname(e);return yd.parse(a).root===a}r(cu,"isParentRoot");function vu(e,a,p,t){if(t)return gd(e,a,p);if(p)return g9(a),gd(e,a,p);if(_9.existsSync(a))throw new Error("dest already exists.");return gd(e,a,p)}r(vu,"doRename");function gd(e,a,p){try{_9.renameSync(e,a)}catch(t){if(t.code!=="EXDEV")throw t;return wu(e,a,p)}}r(gd,"rename");function wu(e,a,p){return uu(e,a,{overwrite:p,errorOnExist:!0}),g9(e)}r(wu,"moveAcrossDevice");y9.exports=hu});var x9=v((wv,b9)=>{"use strict";var _u=Se().fromCallback;b9.exports={move:_u(v9()),moveSync:S9()}});var N9=v((_v,T9)=>{"use strict";T9.exports={...Q1(),...Wt(),...g3(),...J3(),...m9(),...ze(),...x9(),...Jt(),...F1(),...Ip()}});var gu={};L9(gu,{TestRunMonitor:()=>qp});module.exports=q9(gu);var F9=I1(require("net")),Ua=require("fs"),Sd=I1(nr());var na=r(e=>new Promise(a=>setTimeout(a,e)),"awaitSleep"),lr=r(async(e,a=1e3,p="action hang guard timed out")=>{let t="guard-timed-out",i=r(async()=>(await na(a+1e3),t),"guard"),d=await Promise.race([e,i()]);if(typeof d=="string"&&d===t)throw new Error(p);return d},"guardReturn");var Xt=require("path");var Tn=require("fs"),Nn=require("jsdom"),Dn=require("fs/promises"),En=I1(Lt());var kp=class{constructor(a,p,t,i="https://api.checksum.ai/api/test-runs"){this.reportHTMLFilePath=a;this.testRunUUID=p;this.pwTestIdToChecksumTestId=t;this.assetsBaseURL=i;this.supportVideo=!1}async process(){await this.initializeDOM(),this.makeLightModeOnly(),await this.editZipFile(),await this.writeFile()}async initializeDOM(){return this.dom=await Nn.JSDOM.fromFile(this.reportHTMLFilePath,{resources:"usable",runScripts:"dangerously"}),new Promise(a=>this.dom.window.addEventListener("load",a))}async writeFile(){let a=this.dom.serialize();a=a.replace(/window.playwrightReportBase64 = ".*";/,`window.playwrightReportBase64 = "${this.newBase64Zip}";`),await(0,Dn.cp)(this.reportHTMLFilePath,this.reportHTMLFilePath.replace(".html",".backup.html")),(0,Tn.writeFileSync)(this.reportHTMLFilePath,a)}makeLightModeOnly(){this.dom.window.document.querySelector('meta[name="color-scheme"]').setAttribute("content","light");let p=this.dom.window.document.querySelector("head style"),t=p.innerHTML,i=/@media\s*\(prefers-color-scheme:\s*dark\)\s*{[^}]*}/g,d=t.replace(i,"");p.innerHTML=d}async editZipFile(){let a=this.dom.window.playwrightReportBase64.replace("data:application/zip;base64,",""),p=await(0,En.loadAsync)(a,{base64:!0});for(let i of Object.keys(p.files)){let d=p.file(i);if(d){let n=await d.async("string"),l=JSON.parse(n);i.startsWith("report")?this.handleReportJSON(l):this.handleFileReportJSON(l),p.file(i,JSON.stringify(l))}}let t=await p.generateAsync({type:"base64"});this.newBase64Zip=`data:application/zip;base64,${t}`}getCloudPath(a){return`${this.assetsBaseURL}/${this.testRunUUID}/${this.pwTestIdToChecksumTestId[a]}`}handleReportJSON(a){a.files.forEach(p=>p.tests.forEach(t=>{t.results.forEach(i=>{this.processAttachments(i.attachments,t.testId)})}))}handleFileReportJSON(a){var p;(p=a.tests)==null||p.forEach(t=>{var i;(i=t.results)==null||i.forEach(d=>{this.processAttachments(d.attachments,t.testId)})})}processAttachments(a,p){if(a.forEach(t=>this.updateAttachment(t,p)),!this.supportVideo){let t=a.findIndex(i=>i.name==="video");t!==-1&&a.splice(t,1)}}updateAttachment(a,p){["trace","video"].includes(a.name)&&(a.path=`${this.getCloudPath(p)}/${a.name}`)}};r(kp,"PlaywrightReportProcessor");var O9=require("http");var ue=require("fs"),pd=I1(Lt()),td=require("readline/promises");var Ap=class{constructor(a,p,t,i){this.mode=a;this.inputZipFilePath=p;this.outputZipFilePath=t;this.frontendLogPrefix=i;this.originalTraceFileNames=[];this.remainingTraceFileNames=[];this.wallTimesToBeRemoved={};this.callIdsRemovals={};this.consoleLogGUIDs=[];this.numberOfLinesPerFile={};this.generationAllowedAPIName=["page.goto","page.waitForNavigation","locator.fill","locator.click","locator.hover","locator.check","locator.uncheck"]}async process(){await this.unzipAndWriteTraceFiles();for(let a of this.originalTraceFileNames)await this.preprocessFile(a);for(this.remainingTraceFileNames=[...this.originalTraceFileNames];this.remainingTraceFileNames.length>0;)for(let a of this.remainingTraceFileNames)await this.processFile(a);await this.reZip()}getBackupZipFilePath(){return this.inputZipFilePath.replace(".zip",".trace-files-backup.zip")}async unzipAndWriteTraceFiles(){let a=(0,ue.readFileSync)(this.inputZipFilePath);this.zipped=await(0,pd.loadAsync)(a),this.originalTraceFileNames=Object.keys(this.zipped.files).filter(i=>i.endsWith(".trace"));let p=await(0,pd.loadAsync)("UEsFBgAAAAAAAAAAAAAAAAAAAAAAAA==",{base64:!0});for(let i of this.originalTraceFileNames){let d=await this.zipped.file(i).async("string");(0,ue.writeFileSync)(i,d),p.file(i,d)}let t=await p.generateAsync({type:"nodebuffer"});(0,ue.writeFileSync)(this.getBackupZipFilePath(),t)}async reZip(){for(let p of this.originalTraceFileNames){let t=(0,ue.readFileSync)(p);this.zipped.remove(p),this.zipped.file(p,t)}let a=await this.zipped.generateAsync({type:"nodebuffer"});(0,ue.existsSync)(this.outputZipFilePath)&&(0,ue.rmSync)(this.outputZipFilePath),(0,ue.writeFileSync)(this.outputZipFilePath,a);for(let p of this.originalTraceFileNames)(0,ue.rmSync)(p)}async preprocessFile(a){this.callIdsRemovals[a]={callIdsToBeRemoved:{},arrayOfCallIdsToBeRemoved:new Set};let p=(0,ue.createReadStream)(a),t=(0,td.createInterface)({input:p,crlfDelay:1/0}),i=0;for await(let d of t){i++;let n=JSON.parse(d);this.shouldLineBeRemoved(n)&&(n.wallTime&&(this.wallTimesToBeRemoved[n.wallTime]=!0),n.callId&&(this.callIdsRemovals[a].callIdsToBeRemoved[n.callId]=!0,this.callIdsRemovals[a].arrayOfCallIdsToBeRemoved.add(n.callId)))}this.numberOfLinesPerFile[a]=i}async processFile(a){var n,l;let p=[],t=(0,ue.createReadStream)(a),i=(0,td.createInterface)({input:t,crlfDelay:1/0}),d=a;for await(let s of i){let m=JSON.parse(s),o=!1;if(this.frontendLogPrefix){if(this.isChecksumConsoleLog(m)){this.consoleLogGUIDs.push(m.guid);continue}if(this.isConsoleLogMetadata(m)&&this.consoleLogGUIDs.includes((l=(n=m.params)==null?void 0:n.message)==null?void 0:l.guid))continue}if(this.lineCanBeRemoved(m)&&(this.wallTimesToBeRemoved[m.wallTime]||this.callIdsRemovals[d].callIdsToBeRemoved[m.callId]||Array.from(this.callIdsRemovals[d].arrayOfCallIdsToBeRemoved).some(c=>s.includes(`"${c}"`)))&&(o=!0),o){m.callId&&(this.callIdsRemovals[d].callIdsToBeRemoved[m.callId]=!0,this.callIdsRemovals[d].arrayOfCallIdsToBeRemoved.add(m.callId));continue}p.push(s)}if(p.length===this.numberOfLinesPerFile[d]){let s=this.remainingTraceFileNames.indexOf(d);s>-1&&this.remainingTraceFileNames.splice(s,1)}else this.numberOfLinesPerFile[d]=p.length,(0,ue.writeFileSync)(a,p.join(`
9
9
  `))}isChecksumConsoleLog(a){var p,t;return a.class==="ConsoleMessage"&&((t=(p=a.initializer)==null?void 0:p.text)==null?void 0:t.startsWith(this.frontendLogPrefix))}isConsoleLogMetadata(a){return a.class==="BrowserContext"&&a.method==="console"}lineCanBeRemoved(a){return!["frame-snapshot"].includes(a.type)}shouldLineBeRemoved(a){switch(this.mode){case"runtime":return this.shouldLineBeRemoved_runtime(a);case"generation":return this.shouldLineBeRemoved_generation(a)}return!1}shouldLineBeRemoved_runtime(a){var p;return(p=a.stack)==null?void 0:p.find(t=>!t.file.endsWith("spec.ts")&&!["executePlaywrightMethodWithTimeout"].includes(t.function))}shouldLineBeRemoved_generation(a){return!!a.apiName&&!this.generationAllowedAPIName.includes(a.apiName)}};r(Ap,"PlaywrightTraceProcessor");var D9=I1(Lt()),Kt=I1(N9()),Yt=I1(require("path")),E9=require("fs");async function k9(e,a){let p=await Kt.default.readdir(a);await Promise.all(p.map(async t=>{let i=Yt.default.join(a,t);if((await Kt.default.stat(i)).isDirectory()){let n=e.folder(t);await k9(n,i)}else{let n=await Kt.default.readFile(i);e.file(t,n)}}))}r(k9,"addFolderToZip");async function A9(e){let a=new D9.default;try{await k9(a,e);let p=await a.generateAsync({type:"nodebuffer"}),t=`${(0,Yt.basename)(e)}.zip`;return(0,E9.writeFileSync)(t,p),t}catch(p){return console.error("Error creating zip:",p),null}}r(A9,"zipFolder");var qp=class{constructor(a,p=!1){this.config=a;this.mock=p;this.MAX_UPLOADS=5;this.MONITOR_INTERVAL=5e3;this.UPLOAD_TIMEOUT=6e5;this.assets=[];this.stats={passed:0,failed:0,healed:0};this.reportComplete=!1;this.pwTestIdToChecksumTestId={};setInterval(this.monitorUploads.bind(this),this.MONITOR_INTERVAL),this.listenForMessages(),this.startServer()}listenForMessages(){process.stdin.on("data",async a=>{let p=a.toString().trim();if(!p.startsWith("cli:"))return;let[t,i]=p.substring(4).split("=");switch(t){case"report":await this.handleReport(i),this.monitorUploadsCompletion();break;case"shutdown":this.shutdown();break}})}sendMessage(a){console.log(`${"monitor"}:${a}`)}async handleReport(a){return this.reportAsset=this.initAsset({type:"report",path:a}),await new kp(a,this.config.sessionId,this.pwTestIdToChecksumTestId).process(),this.uploadAsset(this.reportAsset)}shutdown(){console.log("Received shutdown message from CLI"),this.server.close(),process.exit(0)}async monitorUploadsCompletion(){if(!this.reportComplete&&this.reportAsset&&this.reportAsset.complete){this.reportComplete=!0;let a="{}";try{a=JSON.stringify(this.stats)}catch(p){console.log("Error stringifying stats",p)}this.sendMessage(`report-uploaded=${a}`)}if(this.reportComplete&&this.assets.filter(a=>a.complete||a.error).length===this.assets.length){await na(100),this.sendMessage("complete");return}await na(1e3),this.monitorUploadsCompletion()}async startServer(){let a=await this.acquirePortNumber();this.sendMessage(`port=${a}`),this.server=(0,O9.createServer)((p,t)=>{let i=r(n=>{t.writeHead(400,{"Content-Type":"text/plain"}),t.end(n)},"returnErrorWithMessage");if(p.method!=="POST"){t.writeHead(404,{"Content-Type":"text/plain"}),t.end("Method not allowed");return}let d="";p.on("data",n=>{d+=n.toString()}),p.on("end",()=>{let n;try{n=JSON.parse(d)}catch{return i("Invalid body")}let{type:l,payload:s,watch:m}=n;switch(l){case"asset":if(!s.path||!s.type)return i("Missing arguments");m?this.watchAsset(s):this.processAsset(s);break;case"testInfo":if(!s.pwTestId||!s.checksumTestId)return i("Missing arguments");this.pwTestIdToChecksumTestId[s.pwTestId]=s.checksumTestId;break;case"testStats":this.stats[s.passed?"passed":"failed"]++,s.healed&&this.stats.healed++;break;default:return i("Invalid message type")}t.writeHead(200,{"Content-Type":"text/plain"}),t.end("OK")})}),this.server.listen(a)}monitorUploads(){let a=r(()=>this.assets.filter(t=>t.response&&!t.complete&&!t.error),"getActiveUploads"),p=this.assets.filter(t=>!t.response);if(p.length!==0&&!(a().length>=this.MAX_UPLOADS))for(;p.length>0&&a().length<this.MAX_UPLOADS;){let t=p.pop();this.uploadAsset(t)}}async uploadAsset(a){let{path:p}=a.info;if(console.log("uploading asset",p),this.mock){a.response=new Promise((l,s)=>{setTimeout(()=>{a.complete=!0,console.log("Asset uploaded successfully",p),l(new Response)},Math.random()*100)});return}if(await this.getSignedURLForUpload(a),!a.uploadURL){console.log("Error getting signed URL for asset",p),a.error=!0;return}let i=(0,Ua.statSync)(p).size,d=(0,Ua.createReadStream)(p),n=lr((0,Sd.default)(a.uploadURL,{method:"PUT",headers:{"Content-length":i.toString()},body:d}),this.UPLOAD_TIMEOUT);n.then(l=>{if(!l.ok)throw l.json().then(s=>{console.log(s)}),new Error("Upload failed");console.log("Asset uploaded successfully",p),a.complete=!0}).catch(l=>{console.log("Error uploading asset",p,l),a.error=!0}),a.response=n}async getSignedURLForUpload(a){try{let{apiKey:p,sessionId:t,checksumApiURL:i}=this.config,d=a.info,n=await(0,Sd.default)(`${i}/client-api/test-runs/${t}/get-upload-url`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",ChecksumAppCode:p},body:JSON.stringify(d)}),{url:l}=await n.json();a.uploadURL=l}catch(p){return console.error("Error getting signed URL for artifact",p),null}}watchAsset(a){let p=(0,Xt.dirname)(a.path),t=(0,Xt.basename)(a.path),i=(0,Ua.watch)(p,(d,n)=>{n===t&&(this.processAsset(a),i.close())})}processAsset(a){switch(a.type){case"trace":return this.processTrace(a.path,a.testId);case"har":return this.processHar(a.path,a.testId);case"esra":case"test-files":return this.addAsset(a)}}async processHar(a,p){await na(1e3);let t=await A9(a);if(console.log("processed har, sending for upload"),t)return this.addAsset({type:"har",path:t,testId:p})}async processTrace(a,p){await na(1e3);let t=a.replace(".zip",".processed.zip");await new Ap("runtime",a,t,"$checksum").process(),console.log("processed trace files, sending for upload"),this.addAsset({type:"trace",path:t,testId:p}),this.addAsset({type:"trace-backup-file",path:a,testId:p})}addAsset(a){console.log("adding asset",a.path);let p=this.initAsset(a);return this.assets.push(p),p}initAsset(a){return{complete:!1,error:!1,response:void 0,info:a}}async acquirePortNumber(){return await new Promise((a,p)=>{let t=F9.createServer();t.unref(),t.on("error",p),t.listen(0,()=>{let i=t.address().port;t.close(()=>{a(i)})})})}};r(qp,"TestRunMonitor");var Lp;try{if(Lp=JSON.parse(process.argv[2]),!Lp.sessionId||!Lp.apiKey||!Lp.checksumApiURL)throw new Error("Invalid config")}catch(e){console.log("Error starting test run monitor",e),process.exit(1)}var C9;new qp(Lp,((C9=process.argv)==null?void 0:C9[3])==="mock");0&&(module.exports={TestRunMonitor});