"use strict";var _a,_b;Object.defineProperty(exports,"__esModule",{value:!0}),exports.CodePipelineFileSet=exports.ArtifactMap=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var crypto=()=>{var tmp=require("crypto");return crypto=()=>tmp,tmp},cp=()=>{var tmp=require("../../../aws-codepipeline");return cp=()=>tmp,tmp},blueprint_1=()=>{var tmp=require("../blueprint");return blueprint_1=()=>tmp,tmp},helpers_internal_1=()=>{var tmp=require("../helpers-internal");return helpers_internal_1=()=>tmp,tmp};class ArtifactMap{constructor(){this.artifacts=new Map,this.usedNames=new Set}toCodePipeline(x){try{jsiiDeprecationWarnings().aws_cdk_lib_pipelines_FileSet(x)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.toCodePipeline),error}if(x instanceof CodePipelineFileSet)return x._artifact;let ret=this.artifacts.get(x);if(!ret){const artifactName=this.makeUniqueName(`${x.producer.id}.${x.id}`);this.usedNames.add(artifactName),this.artifacts.set(x,ret=new(cp()).Artifact(artifactName))}return ret}makeUniqueName(baseName){let i=1;baseName=sanitizeArtifactName(baseName);let name=baseName;for(;this.usedNames.has(name);)name=`${baseName}${++i}`;return name}}exports.ArtifactMap=ArtifactMap,_a=JSII_RTTI_SYMBOL_1,ArtifactMap[_a]={fqn:"aws-cdk-lib.pipelines.ArtifactMap",version:"2.148.1"};function sanitizeArtifactName(x){let sani=x.replace(/[^A-Za-z0-9_]/g,"_");const maxLength=100;if(sani.length>maxLength){const fingerprint=crypto().createHash("sha256").update(sani).digest("hex").slice(0,8);sani=sani.slice(0,maxLength-fingerprint.length)+fingerprint}return sani}class CodePipelineFileSet extends blueprint_1().FileSet{static fromArtifact(artifact){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_codepipeline_Artifact(artifact)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.fromArtifact),error}return new CodePipelineFileSet(artifact)}constructor(artifact){super(artifact.artifactName??"Imported",helpers_internal_1().PipelineGraph.NO_STEP),this._artifact=artifact}}exports.CodePipelineFileSet=CodePipelineFileSet,_b=JSII_RTTI_SYMBOL_1,CodePipelineFileSet[_b]={fqn:"aws-cdk-lib.pipelines.CodePipelineFileSet",version:"2.148.1"};
