"use strict";var _a,_b,_c;Object.defineProperty(exports,"__esModule",{value:!0}),exports.RemoveTag=exports.Tags=exports.Tag=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var annotations_1=()=>{var tmp=require("./annotations");return annotations_1=()=>tmp,tmp},aspect_1=()=>{var tmp=require("./aspect");return aspect_1=()=>tmp,tmp},tag_manager_1=()=>{var tmp=require("./tag-manager");return tag_manager_1=()=>tmp,tmp};class TagBase{constructor(key,props={}){this.key=key,this.props=props}visit(construct){tag_manager_1().TagManager.isTaggableV2(construct)?this.applyTagV2(construct):tag_manager_1().TagManager.isTaggable(construct)&&this.applyTag(construct)}}class Tag extends TagBase{static add(scope,key,value,props={}){annotations_1().Annotations.of(scope).addDeprecation("@aws-cdk/core.Tag.add(scope,k,v)",'Use "Tags.of(scope).add(k,v)" instead'),Tags.of(scope).add(key,value,props)}static remove(scope,key,props={}){annotations_1().Annotations.of(scope).addDeprecation("@aws-cdk/core.Tag.remove(scope,k,v)",'Use "Tags.of(scope).remove(k,v)" instead'),Tags.of(scope).remove(key,props)}constructor(key,value,props={}){super(key,props),this.defaultPriority=100;try{jsiiDeprecationWarnings().aws_cdk_lib_TagProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,Tag),error}if(value===void 0)throw new Error("Tag must have a value");this.value=value}applyTag(resource){try{jsiiDeprecationWarnings().aws_cdk_lib_ITaggable(resource)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.applyTag),error}this.applyManager(resource.tags)}applyTagV2(resource){try{jsiiDeprecationWarnings().aws_cdk_lib_ITaggableV2(resource)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.applyTagV2),error}this.applyManager(resource.cdkTagManager)}applyManager(mgr){mgr.applyTagAspectHere(this.props.includeResourceTypes,this.props.excludeResourceTypes)&&mgr.setTag(this.key,this.value,this.props.priority??this.defaultPriority,this.props.applyToLaunchedInstances!==!1)}}exports.Tag=Tag,_a=JSII_RTTI_SYMBOL_1,Tag[_a]={fqn:"aws-cdk-lib.Tag",version:"2.159.0"};class Tags{static of(scope){return new Tags(scope)}constructor(scope){this.scope=scope}add(key,value,props={}){try{jsiiDeprecationWarnings().aws_cdk_lib_TagProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.add),error}aspect_1().Aspects.of(this.scope).add(new Tag(key,value,props))}remove(key,props={}){try{jsiiDeprecationWarnings().aws_cdk_lib_TagProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.remove),error}aspect_1().Aspects.of(this.scope).add(new RemoveTag(key,props))}}exports.Tags=Tags,_b=JSII_RTTI_SYMBOL_1,Tags[_b]={fqn:"aws-cdk-lib.Tags",version:"2.159.0"};class RemoveTag extends TagBase{constructor(key,props={}){super(key,props),this.defaultPriority=200;try{jsiiDeprecationWarnings().aws_cdk_lib_TagProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,RemoveTag),error}}applyTag(resource){try{jsiiDeprecationWarnings().aws_cdk_lib_ITaggable(resource)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.applyTag),error}this.applyManager(resource.tags)}applyTagV2(resource){try{jsiiDeprecationWarnings().aws_cdk_lib_ITaggableV2(resource)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.applyTagV2),error}this.applyManager(resource.cdkTagManager)}applyManager(mgr){mgr.applyTagAspectHere(this.props.includeResourceTypes,this.props.excludeResourceTypes)&&mgr.removeTag(this.key,this.props.priority??this.defaultPriority)}}exports.RemoveTag=RemoveTag,_c=JSII_RTTI_SYMBOL_1,RemoveTag[_c]={fqn:"aws-cdk-lib.RemoveTag",version:"2.159.0"};
