"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GeoRestriction=void 0;const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp};class GeoRestriction{restrictionType;locations;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_cloudfront.GeoRestriction",version:"2.256.1"};static allowlist(...locations){return new GeoRestriction("whitelist",GeoRestriction.validateLocations(locations))}static denylist(...locations){return new GeoRestriction("blacklist",GeoRestriction.validateLocations(locations))}static whitelist(...locations){return GeoRestriction.allowlist(...locations)}static blacklist(...locations){return GeoRestriction.denylist(...locations)}static LOCATION_REGEX=/^[A-Z]{2}$/;static validateLocations(locations){if(locations.length===0)throw new(core_1()).UnscopedValidationError((0,literal_string_1().lit)`ShouldProvideAtLeastOneLocation`,"Should provide at least 1 location");return locations.forEach(location=>{if(!GeoRestriction.LOCATION_REGEX.test(location))throw new(core_1()).UnscopedValidationError((0,literal_string_1().lit)`InvalidLocationFormat`,`Invalid location format for location: ${location}, location should be two-letter and uppercase country ISO 3166-1-alpha-2 code`)}),locations}constructor(restrictionType,locations){this.restrictionType=restrictionType,this.locations=locations}}exports.GeoRestriction=GeoRestriction;
