"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.BucketWebsiteTarget=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp},errors_1=()=>{var tmp=require("../../core/lib/errors");return errors_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp},region_info_1=()=>{var tmp=require("../../region-info");return region_info_1=()=>tmp,tmp};class BucketWebsiteTarget{bucket;props;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_route53_targets.BucketWebsiteTarget",version:"2.256.1"};constructor(bucket,props){this.bucket=bucket,this.props=props;try{jsiiDeprecationWarnings().aws_cdk_lib_aws_s3_IBucket(bucket),jsiiDeprecationWarnings().aws_cdk_lib_aws_route53_targets_IAliasRecordTargetProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,BucketWebsiteTarget),error}}bind(record,_zone){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_route53_IRecordSet(record),jsiiDeprecationWarnings().aws_cdk_lib_aws_route53_IHostedZone(_zone)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.bind),error}const{region}=core_1().Stack.of(this.bucket.stack);if(core_1().Token.isUnresolved(region))throw new(errors_1()).ValidationError((0,literal_string_1().lit)`RegionAgnosticStackNotSupported`,["Cannot use an S3 record alias in region-agnostic stacks.","You must specify a specific region when you define the stack","(see https://docs.aws.amazon.com/cdk/latest/guide/environments.html)"].join(" "),record);const{s3StaticWebsiteHostedZoneId:hostedZoneId,s3StaticWebsiteEndpoint:dnsName}=region_info_1().RegionInfo.get(region);if(!hostedZoneId||!dnsName)throw new(errors_1()).ValidationError((0,literal_string_1().lit)`BucketWebsiteTargetSupported`,`Bucket website target is not supported for the "${region}" region`,record);return{hostedZoneId,dnsName,evaluateTargetHealth:this.props?.evaluateTargetHealth}}}exports.BucketWebsiteTarget=BucketWebsiteTarget;
