"use strict";var _a,_b;Object.defineProperty(exports,"__esModule",{value:!0}),exports.MatchResult=exports.Matcher=void 0;const jsiiDeprecationWarnings=require("../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");class Matcher{static isMatcher(x){return x&&x instanceof Matcher}}exports.Matcher=Matcher,_a=JSII_RTTI_SYMBOL_1,Matcher[_a]={fqn:"aws-cdk-lib.assertions.Matcher",version:"2.46.0"};class MatchResult{constructor(target){this.failures=[],this.captures=new Map,this.finalized=!1,this.target=target}push(matcher,path,message){try{jsiiDeprecationWarnings.print("aws-cdk-lib.assertions.MatchResult#push","use recordFailure()"),jsiiDeprecationWarnings.aws_cdk_lib_assertions_Matcher(matcher)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.push),error}return this.recordFailure({matcher,path,message})}recordFailure(failure){try{jsiiDeprecationWarnings.aws_cdk_lib_assertions_MatchFailure(failure)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.recordFailure),error}return this.failures.push(failure),this}hasFailed(){return this.failures.length!==0}get failCount(){return this.failures.length}compose(id,inner){try{jsiiDeprecationWarnings.aws_cdk_lib_assertions_MatchResult(inner)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.compose),error}const innerF=inner.failures;return this.failures.push(...innerF.map(f=>({path:[id,...f.path],message:f.message,matcher:f.matcher}))),inner.captures.forEach((vals,capture)=>{vals.forEach(value=>this.recordCapture({capture,value}))}),this}finished(){return this.finalized?this:(this.failCount===0&&this.captures.forEach((vals,cap)=>cap._captured.push(...vals)),this.finalized=!0,this)}toHumanStrings(){return this.failures.map(r=>{const loc=r.path.length===0?"":` at ${r.path.join("")}`;return""+r.message+loc+` (using ${r.matcher.name} matcher)`})}recordCapture(options){try{jsiiDeprecationWarnings.aws_cdk_lib_assertions_MatchCapture(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.recordCapture),error}let values=this.captures.get(options.capture);values===void 0&&(values=[]),values.push(options.value),this.captures.set(options.capture,values)}}exports.MatchResult=MatchResult,_b=JSII_RTTI_SYMBOL_1,MatchResult[_b]={fqn:"aws-cdk-lib.assertions.MatchResult",version:"2.46.0"};
//# sourceMappingURL=matcher.js.map
