text: !function o(r,i,s){function c(t,e){if(!i[t]){if(!r[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(a)return a(t,!0);throw(n=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",n}n=i[t]={exports:{}},r[t][0].call(n.exports,function(e){return c(r[t][1][e]||e)},n,n.exports,o,r,i,s)}return i[t].exports}for(var a="function"==typeof require&&require,e=0;e<s.length;e++)c(s[e]);return c}({1:[function(e,t,n){t.exports={version:"2.0",metadata:{apiVersion:"2014-06-30",endpointPrefix:"cognito-identity",jsonVersion:"1.1",protocol:"json",serviceFullName:"Amazon Cognito Identity",serviceId:"Cognito Identity",signatureVersion:"v4",targetPrefix:"AWSCognitoIdentityService",uid:"cognito-identity-2014-06-30"},operations:{CreateIdentityPool:{input:{type:"structure",required:["IdentityPoolName","AllowUnauthenticatedIdentities"],members:{IdentityPoolName:{},AllowUnauthenticatedIdentities:{type:"boolean"},SupportedLoginProviders:{shape:"S4"},DeveloperProviderName:{},OpenIdConnectProviderARNs:{shape:"S8"},CognitoIdentityProviders:{shape:"Sa"},SamlProviderARNs:{shape:"Sf"},IdentityPoolTags:{shape:"Sg"}}},output:{shape:"Sj"}},DeleteIdentities:{input:{type:"structure",required:["IdentityIdsToDelete"],members:{IdentityIdsToDelete:{type:"list",member:{}}}},output:{type:"structure",members:{UnprocessedIdentityIds:{type:"list",member:{type:"structure",members:{IdentityId:{},ErrorCode:{}}}}}}},DeleteIdentityPool:{input:{type:"structure",required:["IdentityPoolId"],members:{IdentityPoolId:{}}}},DescribeIdentity:{input:{type:"structure",required:["IdentityId"],members:{IdentityId:{}}},output:{shape:"Su"}},DescribeIdentityPool:{input:{type:"structure",required:["IdentityPoolId"],members:{IdentityPoolId:{}}},output:{shape:"Sj"}},GetCredentialsForIdentity:{input:{type:"structure",required:["IdentityId"],members:{IdentityId:{},Logins:{shape:"Sz"},CustomRoleArn:{}}},output:{type:"structure",members:{IdentityId:{},Credentials:{type:"structure",members:{AccessKeyId:{},SecretKey:{},SessionToken:{},Expiration:{type:"timestamp"}}}}}},GetId:{input:{type:"structure",required:["IdentityPoolId"],members:{AccountId:{},IdentityPoolId:{},Logins:{shape:"Sz"}}},output:{type:"structure",members:{IdentityId:{}}}},GetIdentityPoolRoles:{input:{type:"structure",required:["IdentityPoolId"],members:{IdentityPoolId:{}}},output:{type:"structure",members:{IdentityPoolId:{},Roles:{shape:"S1b"},RoleMappings:{shape:"S1d"}}}},GetOpenIdToken:{input:{type:"structure",required:["IdentityId"],members:{IdentityId:{},Logins:{shape:"Sz"}}},output:{type:"structure",members:{IdentityId:{},Token:{}}}},GetOpenIdTokenForDeveloperIdentity:{input:{type:"structure",required:["IdentityPoolId","Logins"],members:{IdentityPoolId:{},IdentityId:{},Logins:{shape:"Sz"},TokenDuration:{type:"long"}}},output:{type:"structure",members:{IdentityId:{},Token:{}}}},ListIdentities:{input:{type:"structure",required:["IdentityPoolId","MaxResults"],members:{IdentityPoolId:{},MaxResults:{type:"integer"},NextToken:{},HideDisabled:{type:"boolean"}}},output:{type:"structure",members:{IdentityPoolId:{},Identities:{type:"list",member:{shape:"Su"}},NextToken:{}}}},ListIdentityPools:{input:{type:"structure",required:["MaxResults"],members:{MaxResults:{type:"integer"},NextToken:{}}},output:{type:"structure",members:{IdentityPools:{type:"list",member:{type:"structure",members:{IdentityPoolId:{},IdentityPoolName:{}}}},NextToken:{}}}},ListTagsForResource:{input:{type:"structure",required:["ResourceArn"],members:{ResourceArn:{}}},output:{type:"structure",members:{Tags:{shape:"Sg"}}}},LookupDeveloperIdentity:{input:{type:"structure",required:["IdentityPoolId"],members:{IdentityPoolId:{},IdentityId:{},DeveloperUserIdentifier:{},MaxResults:{type:"integer"},NextToken:{}}},output:{type:"structure",members:{IdentityId:{},DeveloperUserIdentifierList:{type:"list",member:{}},NextToken:{}}}},MergeDeveloperIdentities:{input:{type:"structure",required:["SourceUserIdentifier","DestinationUserIdentifier","DeveloperProviderName","IdentityPoolId"],members:{SourceUserIdentifier:{},DestinationUserIdentifier:{},DeveloperProviderName:{},IdentityPoolId:{}}},output:{type:"structure",members:{IdentityId:{}}}},SetIdentityPoolRoles:{input:{type:"structure",required:["IdentityPoolId","Roles"],members:{IdentityPoolId:{},Roles:{shape:"S1b"},RoleMappings:{shape:"S1d"}}}},TagResource:{input:{type:"structure",required:["ResourceArn"],members:{ResourceArn:{},Tags:{shape:"Sg"}}},output:{type:"structure",members:{}}},UnlinkDeveloperIdentity:{input:{type:"structure",required:["IdentityId","IdentityPoolId","DeveloperProviderName","DeveloperUserIdentifier"],members:{IdentityId:{},IdentityPoolId:{},DeveloperProviderName:{},DeveloperUserIdentifier:{}}}},UnlinkIdentity:{input:{type:"structure",required:["IdentityId","Logins","LoginsToRemove"],members:{IdentityId:{},Logins:{shape:"Sz"},LoginsToRemove:{shape:"Sv"}}}},UntagResource:{input:{type:"structure",required:["ResourceArn"],members:{ResourceArn:{},TagKeys:{type:"list",member:{}}}},output:{type:"structure",members:{}}},UpdateIdentityPool:{input:{shape:"Sj"},output:{shape:"Sj"}}},shapes:{S4:{type:"map",key:{},value:{}},S8:{type:"list",member:{}},Sa:{type:"list",member:{type:"structure",members:{ProviderName:{},ClientId:{},ServerSideTokenCheck:{type:"boolean"}}}},Sf:{type:"list",member:{}},Sg:{type:"map",key:{},value:{}},Sj:{type:"structure",required:["IdentityPoolId","IdentityPoolName","AllowUnauthenticatedIdentities"],members:{IdentityPoolId:{},IdentityPoolName:{},AllowUnauthenticatedIdentities:{type:"boolean"},SupportedLoginProviders:{shape:"S4"},DeveloperProviderName:{},OpenIdConnectProviderARNs:{shape:"S8"},CognitoIdentityProviders:{shape:"Sa"},SamlProviderARNs:{shape:"Sf"},IdentityPoolTags:{shape:"Sg"}}},Su:{type:"structure",members:{IdentityId:{},Logins:{shape:"Sv"},CreationDate:{type:"timestamp"},LastModifiedDate:{type:"timestamp"}}},Sv:{type:"list",member:{}},Sz:{type:"map",key:{},value:{}},S1b:{type:"map",key:{},value:{}},S1d:{type:"map",key:{},value:{type:"structure",required:["Type"],members:{Type:{},AmbiguousRoleResolution:{},RulesConfiguration:{type:"structure",required:["Rules"],members:{Rules:{type:"list",member:{type:"structure",required:["Claim","MatchType","Value","RoleARN"],members:{Claim:{},MatchType:{},Value:{},RoleARN:{}}}}}}}}}}}},{}],2:[function(e,t,n){t.exports={pagination:{}}},{}],3:[function(e,t,n){t.exports={version:"2.0",metadata:{apiVersion:"2017-02-15",endpointPrefix:"connect",jsonVersion:"1.0",protocol:"json",serviceAbbreviation:"Connect",serviceFullName:"AmazonConnectCTIService",signatureVersion:"",targetPrefix:"AmazonConnectCTIService",uid:"connect-2017-02-15"},operations:{AcceptContact:{input:{type:"structure",required:["authentication","contactId"],members:{authentication:{shape:"S2"},contactId:{}}},output:{type:"structure",members:{}}},ClearContact:{input:{type:"structure",required:["contactId"],members:{contactId:{}}},output:{type:"structure",members:{}}},CompleteContact:{input:{type:"structure",required:["contactId"],members:{contactId:{}}},output:{type:"structure",members:{}}},ConferenceConnections:{input:{type:"structure",required:["authentication","contactId"],members:{authentication:{shape:"S2"},contactId:{}}},output:{type:"structure",members:{}}},CreateAdditionalConnection:{input:{type:"structure",required:["authentication","contactId","endpoint"],members:{authentication:{shape:"S2"},contactId:{},endpoint:{shape:"Se"}}},output:{type:"structure",members:{}}},CreateOutboundContact:{input:{type:"structure",required:["authentication","endpoint"],members:{authentication:{shape:"S2"},endpoint:{shape:"Se"},queueARN:{}}},output:{type:"structure",members:{}}},CreateTaskContact:{input:{type:"structure",required:["endpoint","name"],members:{endpoint:{shape:"Se"},previousContactId:{},name:{},description:{},references:{shape:"Sr"},idempotencyToken:{}}},output:{type:"structure",members:{contactId:{}}}},CreateTransport:{input:{type:"structure",required:["transportType","authentication"],members:{transportType:{},participantId:{},contactId:{},softphoneClientId:{},authentication:{shape:"S2"}}},output:{type:"structure",members:{webSocketTransport:{type:"structure",required:["url","transportLifeTimeInSeconds"],members:{url:{},transportLifeTimeInSeconds:{type:"long"},expiry:{}}},chatTokenTransport:{type:"structure",required:["participantToken","expiry"],members:{participantToken:{},expiry:{}}},softphoneTransport:{type:"structure",required:["softphoneMediaConnections"],members:{softphoneMediaConnections:{type:"list",member:{type:"structure",required:["username","credential","urls"],members:{username:{},credential:{},urls:{type:"list",member:{}}}}}}}}}},DestroyConnection:{input:{type:"structure",required:["authentication","contactId","connectionId"],members:{authentication:{shape:"S2"},contactId:{},connectionId:{}}},output:{type:"structure",members:{}}},GetAgentConfiguration:{input:{type:"structure",required:["authentication"],members:{authentication:{shape:"S2"}}},output:{type:"structure",required:["configuration"],members:{configuration:{shape:"S1h"}}}},GetAgentPermissions:{input:{type:"structure",required:["authentication"],members:{authentication:{shape:"S2"},nextToken:{},maxResults:{type:"integer"}}},output:{type:"structure",required:["permissions"],members:{permissions:{type:"list",member:{}},nextToken:{}}}},GetAgentSnapshot:{input:{type:"structure",required:["authentication"],members:{authentication:{shape:"S2"},nextToken:{},timeout:{type:"long"}}},output:{type:"structure",required:["snapshot","nextToken"],members:{snapshot:{type:"structure",required:["state","contacts","snapshotTimestamp"],members:{state:{shape:"S1z"},nextState:{shape:"S1z"},agentAvailabilityState:{type:"structure",members:{state:{},timeStamp:{type:"timestamp"}}},contacts:{type:"list",member:{type:"structure",required:["contactId","type","state","connections","attributes"],members:{contactId:{},initialContactId:{},contactFeatures:{type:"structure",members:{attachmentsEnabled:{type:"boolean"}}},type:{},state:{type:"structure",required:["type","timestamp"],members:{type:{},timestamp:{type:"timestamp"}}},queue:{shape:"Sk"},queueTimestamp:{type:"timestamp"},connections:{type:"list",member:{type:"structure",required:["connectionId","state","type","initial"],members:{connectionId:{},endpoint:{shape:"Se"},state:{type:"structure",required:["type","timestamp"],members:{type:{},timestamp:{type:"timestamp"}}},type:{},initial:{type:"boolean"},softphoneMediaInfo:{type:"structure",members:{callType:{},autoAccept:{type:"boolean"},mediaLegContextToken:{},callContextToken:{},callConfigJson:{}}},chatMediaInfo:{type:"structure",members:{chatAutoAccept:{type:"boolean"},connectionData:{},customerName:{}}},monitoringInfo:{type:"structure",members:{agent:{type:"structure",members:{agentName:{}}},joinTimeStamp:{type:"timestamp"}}}}}},attributes:{type:"map",key:{},value:{type:"structure",required:["name"],members:{name:{},value:{}}}},contactDuration:{},name:{},description:{},references:{shape:"Sr"},initiationMethod:{}}}},snapshotTimestamp:{type:"timestamp"}}},nextToken:{}}}},GetAgentStates:{input:{type:"structure",required:["authentication"],members:{authentication:{shape:"S2"},nextToken:{},maxResults:{type:"integer"}}},output:{type:"structure",required:["states"],members:{states:{type:"list",member:{shape:"S1z"}},nextToken:{}}}},GetDialableCountryCodes:{input:{type:"structure",required:["authentication"],members:{authentication:{shape:"S2"},nextToken:{},maxResults:{type:"integer"}}},output:{type:"structure",required:["countryCodes"],members:{countryCodes:{type:"list",member:{}},nextToken:{}}}},GetEndpoints:{input:{type:"structure",required:["authentication","queueARNs"],members:{authentication:{shape:"S2"},queueARNs:{type:"list",member:{}},nextToken:{},maxResults:{type:"integer"}}},output:{type:"structure",members:{endpoints:{type:"list",member:{shape:"Se"}},nextToken:{}}}},GetNewAuthToken:{input:{type:"structure",required:["authentication","refreshToken"],members:{authentication:{shape:"S2"},refreshToken:{}}},output:{type:"structure",members:{newAuthToken:{},expirationDateTime:{type:"timestamp"}}}},GetRoutingProfileQueues:{input:{type:"structure",required:["authentication","routingProfileARN"],members:{authentication:{shape:"S2"},routingProfileARN:{},nextToken:{},maxResults:{type:"integer"}}},output:{type:"structure",required:["queues"],members:{queues:{type:"list",member:{shape:"Sk"}},nextToken:{}}}},HoldConnection:{input:{type:"structure",required:["authentication","contactId","connectionId"],members:{authentication:{shape:"S2"},contactId:{},connectionId:{}}},output:{type:"structure",members:{}}},NotifyContactIssue:{input:{type:"structure",required:["authentication","contactId"],members:{authentication:{shape:"S2"},contactId:{},issueCode:{},description:{},clientLogs:{}}},output:{type:"structure",members:{}}},PutAgentState:{input:{type:"structure",required:["authentication","state"],members:{authentication:{shape:"S2"},state:{shape:"S1z"},enqueueNextState:{type:"boolean"}}},output:{type:"structure",members:{}}},RejectContact:{input:{type:"structure",required:["contactId"],members:{contactId:{}}},output:{type:"structure",members:{}}},ResumeConnection:{input:{type:"structure",required:["authentication","contactId","connectionId"],members:{authentication:{shape:"S2"},contactId:{},connectionId:{}}},output:{type:"structure",members:{}}},SendClientLogs:{input:{type:"structure",required:["authentication","logEvents"],members:{authentication:{shape:"S2"},logEvents:{type:"list",member:{type:"structure",members:{timestamp:{type:"timestamp"},component:{},message:{}}}}}},output:{type:"structure",members:{}}},SendDigits:{input:{type:"structure",required:["authentication","contactId","connectionId","digits"],members:{authentication:{shape:"S2"},contactId:{},connectionId:{},digits:{}}},output:{type:"structure",members:{}}},SendSoftphoneCallMetrics:{input:{type:"structure",required:["authentication","contactId","softphoneStreamStatistics"],members:{authentication:{shape:"S2"},contactId:{},ccpVersion:{},softphoneStreamStatistics:{shape:"S3n"}}},output:{type:"structure",members:{}}},SendSoftphoneCallReport:{input:{type:"structure",required:["authentication","contactId","report"],members:{authentication:{shape:"S2"},contactId:{},ccpVersion:{},report:{type:"structure",members:{callStartTime:{type:"timestamp"},callEndTime:{type:"timestamp"},softphoneStreamStatistics:{shape:"S3n"},gumTimeMillis:{type:"long"},initializationTimeMillis:{type:"long"},iceCollectionTimeMillis:{type:"long"},signallingConnectTimeMillis:{type:"long"},handshakeTimeMillis:{type:"long"},preTalkTimeMillis:{type:"long"},talkTimeMillis:{type:"long"},cleanupTimeMillis:{type:"long"},iceCollectionFailure:{type:"boolean"},signallingConnectionFailure:{type:"boolean"},handshakeFailure:{type:"boolean"},gumOtherFailure:{type:"boolean"},gumTimeoutFailure:{type:"boolean"},createOfferFailure:{type:"boolean"},setLocalDescriptionFailure:{type:"boolean"},userBusyFailure:{type:"boolean"},invalidRemoteSDPFailure:{type:"boolean"},noRemoteIceCandidateFailure:{type:"boolean"},setRemoteDescriptionFailure:{type:"boolean"}}}}},output:{type:"structure",members:{}}},ToggleActiveConnections:{input:{type:"structure",required:["authentication","contactId","connectionId"],members:{authentication:{shape:"S2"},contactId:{},connectionId:{}}},output:{type:"structure",members:{}}},UpdateAgentConfiguration:{input:{type:"structure",required:["authentication","configuration"],members:{authentication:{shape:"S2"},configuration:{shape:"S1h"}}},output:{type:"structure",members:{}}}},shapes:{S2:{type:"structure",members:{agentARN:{},authToken:{}}},Se:{type:"structure",required:["type"],members:{endpointARN:{},type:{},name:{},phoneNumber:{},agentLogin:{},queue:{shape:"Sk"}}},Sk:{type:"structure",members:{queueARN:{},name:{}}},Sr:{type:"map",key:{},value:{type:"structure",required:["value","type"],members:{value:{},type:{}}}},S1h:{type:"structure",required:["name","softphoneEnabled","softphoneAutoAccept","extension","routingProfile"],members:{name:{},username:{},softphoneEnabled:{type:"boolean"},softphoneAutoAccept:{type:"boolean"},extension:{},routingProfile:{type:"structure",members:{name:{},routingProfileARN:{},defaultOutboundQueue:{shape:"Sk"},channelConcurrencyMap:{type:"map",key:{},value:{type:"long"}}}},agentPreferences:{type:"map",key:{},value:{}}}},S1z:{type:"structure",required:["type","name"],members:{agentStateARN:{},type:{},name:{},startTimestamp:{type:"timestamp"}}},S3n:{type:"list",member:{type:"structure",members:{timestamp:{type:"timestamp"},softphoneStreamType:{},packetCount:{type:"long"},packetsLost:{type:"long"},audioLevel:{type:"double"},jitterBufferMillis:{type:"long"},roundTripTimeMillis:{type:"long"}}}}}}},{}],4:[function(e,t,n){t.exports={acm:{name:"ACM",cors:!0},apigateway:{name:"APIGateway",cors:!0},applicationautoscaling:{prefix:"application-autoscaling",name:"ApplicationAutoScaling",cors:!0},appstream:{name:"AppStream"},autoscaling:{name:"AutoScaling",cors:!0},batch:{name:"Batch"},budgets:{name:"Budgets"},clouddirectory:{name:"CloudDirectory",versions:["2016-05-10*"]},cloudformation:{name:"CloudFormation",cors:!0},cloudfront:{name:"CloudFront",versions:["2013-05-12*","2013-11-11*","2014-05-31*","2014-10-21*","2014-11-06*","2015-04-17*","2015-07-27*","2015-09-17*","2016-01-13*","2016-01-28*","2016-08-01*","2016-08-20*","2016-09-07*","2016-09-29*","2016-11-25*","2017-03-25*","2017-10-30*","2018-06-18*","2018-11-05*"],cors:!0},cloudhsm:{name:"CloudHSM",cors:!0},cloudsearch:{name:"CloudSearch"},cloudsearchdomain:{name:"CloudSearchDomain"},cloudtrail:{name:"CloudTrail",cors:!0},cloudwatch:{prefix:"monitoring",name:"CloudWatch",cors:!0},cloudwatchevents:{prefix:"events",name:"CloudWatchEvents",versions:["2014-02-03*"],cors:!0},cloudwatchlogs:{prefix:"logs",name:"CloudWatchLogs",cors:!0},codebuild:{name:"CodeBuild",cors:!0},codecommit:{name:"CodeCommit",cors:!0},codedeploy:{name:"CodeDeploy",cors:!0},codepipeline:{name:"CodePipeline",cors:!0},cognitoidentity:{prefix:"cognito-identity",name:"CognitoIdentity",cors:!0},cognitoidentityserviceprovider:{prefix:"cognito-idp",name:"CognitoIdentityServiceProvider",cors:!0},cognitosync:{prefix:"cognito-sync",name:"CognitoSync",cors:!0},configservice:{prefix:"config",name:"ConfigService",cors:!0},cur:{name:"CUR",cors:!0},datapipeline:{name:"DataPipeline"},devicefarm:{name:"DeviceFarm",cors:!0},directconnect:{name:"DirectConnect",cors:!0},directoryservice:{prefix:"ds",name:"DirectoryService"},discovery:{name:"Discovery"},dms:{name:"DMS"},dynamodb:{name:"DynamoDB",cors:!0},dynamodbstreams:{prefix:"streams.dynamodb",name:"DynamoDBStreams",cors:!0},ec2:{name:"EC2",versions:["2013-06-15*","2013-10-15*","2014-02-01*","2014-05-01*","2014-06-15*","2014-09-01*","2014-10-01*","2015-03-01*","2015-04-15*","2015-10-01*","2016-04-01*","2016-09-15*"],cors:!0},ecr:{name:"ECR",cors:!0},ecs:{name:"ECS",cors:!0},efs:{prefix:"elasticfilesystem",name:"EFS",cors:!0},elasticache:{name:"ElastiCache",versions:["2012-11-15*","2014-03-24*","2014-07-15*","2014-09-30*"],cors:!0},elasticbeanstalk:{name:"ElasticBeanstalk",cors:!0},elb:{prefix:"elasticloadbalancing",name:"ELB",cors:!0},elbv2:{prefix:"elasticloadbalancingv2",name:"ELBv2",cors:!0},emr:{prefix:"elasticmapreduce",name:"EMR",cors:!0},es:{name:"ES"},elastictranscoder:{name:"ElasticTranscoder",cors:!0},firehose:{name:"Firehose",cors:!0},gamelift:{name:"GameLift",cors:!0},glacier:{name:"Glacier"},health:{name:"Health"},iam:{name:"IAM",cors:!0},importexport:{name:"ImportExport"},inspector:{name:"Inspector",versions:["2015-08-18*"],cors:!0},iot:{name:"Iot",cors:!0},iotdata:{prefix:"iot-data",name:"IotData",cors:!0},kinesis:{name:"Kinesis",cors:!0},kinesisanalytics:{name:"KinesisAnalytics"},kms:{name:"KMS",cors:!0},lambda:{name:"Lambda",cors:!0},lexruntime:{prefix:"runtime.lex",name:"LexRuntime",cors:!0},lightsail:{name:"Lightsail"},machinelearning:{name:"MachineLearning",cors:!0},marketplacecommerceanalytics:{name:"MarketplaceCommerceAnalytics",cors:!0},marketplacemetering:{prefix:"meteringmarketplace",name:"MarketplaceMetering"},mturk:{prefix:"mturk-requester",name:"MTurk",cors:!0},mobileanalytics:{name:"MobileAnalytics",cors:!0},opsworks:{name:"OpsWorks",cors:!0},opsworkscm:{name:"OpsWorksCM"},organizations:{name:"Organizations"},pinpoint:{name:"Pinpoint"},polly:{name:"Polly",cors:!0},rds:{name:"RDS",versions:["2014-09-01*"],cors:!0},redshift:{name:"Redshift",cors:!0},rekognition:{name:"Rekognition",cors:!0},resourcegroupstaggingapi:{name:"ResourceGroupsTaggingAPI"},route53:{name:"Route53",cors:!0},route53domains:{name:"Route53Domains",cors:!0},s3:{name:"S3",dualstackAvailable:!0,cors:!0},s3control:{name:"S3Control",dualstackAvailable:!0},servicecatalog:{name:"ServiceCatalog",cors:!0},ses:{prefix:"email",name:"SES",cors:!0},shield:{name:"Shield"},simpledb:{prefix:"sdb",name:"SimpleDB"},sms:{name:"SMS"},snowball:{name:"Snowball"},sns:{name:"SNS",cors:!0},sqs:{name:"SQS",cors:!0},ssm:{name:"SSM",cors:!0},storagegateway:{name:"StorageGateway",cors:!0},stepfunctions:{prefix:"states",name:"StepFunctions"},sts:{name:"STS",cors:!0},support:{name:"Support"},swf:{name:"SWF"},xray:{name:"XRay",cors:!0},waf:{name:"WAF",cors:!0},wafregional:{prefix:"waf-regional",name:"WAFRegional"},workdocs:{name:"WorkDocs",cors:!0},workspaces:{name:"WorkSpaces"},codestar:{name:"CodeStar"},lexmodelbuildingservice:{prefix:"lex-models",name:"LexModelBuildingService",cors:!0},marketplaceentitlementservice:{prefix:"entitlement.marketplace",name:"MarketplaceEntitlementService"},athena:{name:"Athena"},greengrass:{name:"Greengrass"},dax:{name:"DAX"},migrationhub:{prefix:"AWSMigrationHub",name:"MigrationHub"},cloudhsmv2:{name:"CloudHSMV2"},glue:{name:"Glue"},mobile:{name:"Mobile"},pricing:{name:"Pricing",cors:!0},costexplorer:{prefix:"ce",name:"CostExplorer",cors:!0},mediaconvert:{name:"MediaConvert"},medialive:{name:"MediaLive"},mediapackage:{name:"MediaPackage"},mediastore:{name:"MediaStore"},mediastoredata:{prefix:"mediastore-data",name:"MediaStoreData",cors:!0},appsync:{name:"AppSync"},guardduty:{name:"GuardDuty"},mq:{name:"MQ"},comprehend:{name:"Comprehend",cors:!0},iotjobsdataplane:{prefix:"iot-jobs-data",name:"IoTJobsDataPlane"},kinesisvideoarchivedmedia:{prefix:"kinesis-video-archived-media",name:"KinesisVideoArchivedMedia",cors:!0},kinesisvideomedia:{prefix:"kinesis-video-media",name:"KinesisVideoMedia",cors:!0},kinesisvideo:{name:"KinesisVideo",cors:!0},sagemakerruntime:{prefix:"runtime.sagemaker",name:"SageMakerRuntime"},sagemaker:{name:"SageMaker"},translate:{name:"Translate",cors:!0},resourcegroups:{prefix:"resource-groups",name:"ResourceGroups",cors:!0},alexaforbusiness:{name:"AlexaForBusiness"},cloud9:{name:"Cloud9"},serverlessapplicationrepository:{prefix:"serverlessrepo",name:"ServerlessApplicationRepository"},servicediscovery:{name:"ServiceDiscovery"},workmail:{name:"WorkMail"},autoscalingplans:{prefix:"autoscaling-plans",name:"AutoScalingPlans"},transcribeservice:{prefix:"transcribe",name:"TranscribeService"},connect:{name:"Connect",cors:!0},acmpca:{prefix:"acm-pca",name:"ACMPCA"},fms:{name:"FMS"},secretsmanager:{name:"SecretsManager",cors:!0},iotanalytics:{name:"IoTAnalytics",cors:!0},iot1clickdevicesservice:{prefix:"iot1click-devices",name:"IoT1ClickDevicesService"},iot1clickprojects:{prefix:"iot1click-projects",name:"IoT1ClickProjects"},pi:{name:"PI"},neptune:{name:"Neptune"},mediatailor:{name:"MediaTailor"},eks:{name:"EKS"},macie:{name:"Macie"},dlm:{name:"DLM"},signer:{name:"Signer"},chime:{name:"Chime"},pinpointemail:{prefix:"pinpoint-email",name:"PinpointEmail"},ram:{name:"RAM"},route53resolver:{name:"Route53Resolver"},pinpointsmsvoice:{prefix:"sms-voice",name:"PinpointSMSVoice"},quicksight:{name:"QuickSight"},rdsdataservice:{prefix:"rds-data",name:"RDSDataService"},amplify:{name:"Amplify"},datasync:{name:"DataSync"},robomaker:{name:"RoboMaker"},transfer:{name:"Transfer"},globalaccelerator:{name:"GlobalAccelerator"},comprehendmedical:{name:"ComprehendMedical",cors:!0},kinesisanalyticsv2:{name:"KinesisAnalyticsV2"},mediaconnect:{name:"MediaConnect"},fsx:{name:"FSx"},securityhub:{name:"SecurityHub"},appmesh:{name:"AppMesh",versions:["2018-10-01*"]},licensemanager:{prefix:"license-manager",name:"LicenseManager"},kafka:{name:"Kafka"},apigatewaymanagementapi:{name:"ApiGatewayManagementApi"},apigatewayv2:{name:"ApiGatewayV2"},docdb:{name:"DocDB"},backup:{name:"Backup"},worklink:{name:"WorkLink"},textract:{name:"Textract"},managedblockchain:{name:"ManagedBlockchain"},mediapackagevod:{prefix:"mediapackage-vod",name:"MediaPackageVod"},groundstation:{name:"GroundStation"},iotthingsgraph:{name:"IoTThingsGraph"},iotevents:{name:"IoTEvents"},ioteventsdata:{prefix:"iotevents-data",name:"IoTEventsData"},personalize:{name:"Personalize",cors:!0},personalizeevents:{prefix:"personalize-events",name:"PersonalizeEvents",cors:!0},personalizeruntime:{prefix:"personalize-runtime",name:"PersonalizeRuntime",cors:!0},applicationinsights:{prefix:"application-insights",name:"ApplicationInsights"},servicequotas:{prefix:"service-quotas",name:"ServiceQuotas"},ec2instanceconnect:{prefix:"ec2-instance-connect",name:"EC2InstanceConnect"},eventbridge:{name:"EventBridge"},lakeformation:{name:"LakeFormation"},forecastservice:{prefix:"forecast",name:"ForecastService",cors:!0},forecastqueryservice:{prefix:"forecastquery",name:"ForecastQueryService",cors:!0},qldb:{name:"QLDB"},qldbsession:{prefix:"qldb-session",name:"QLDBSession"},workmailmessageflow:{name:"WorkMailMessageFlow"}}},{}],5:[function(e,t,n){t.exports={version:"2.0",metadata:{apiVersion:"2011-06-15",endpointPrefix:"sts",globalEndpoint:"sts.amazonaws.com",protocol:"query",serviceAbbreviation:"AWS STS",serviceFullName:"AWS Security Token Service",serviceId:"STS",signatureVersion:"v4",uid:"sts-2011-06-15",xmlNamespace:"https://sts.amazonaws.com/doc/2011-06-15/"},operations:{AssumeRole:{input:{type:"structure",required:["RoleArn","RoleSessionName"],members:{RoleArn:{},RoleSessionName:{},PolicyArns:{shape:"S4"},Policy:{},DurationSeconds:{type:"integer"},ExternalId:{},SerialNumber:{},TokenCode:{}}},output:{resultWrapper:"AssumeRoleResult",type:"structure",members:{Credentials:{shape:"Sc"},AssumedRoleUser:{shape:"Sh"},PackedPolicySize:{type:"integer"}}}},AssumeRoleWithSAML:{input:{type:"structure",required:["RoleArn","PrincipalArn","SAMLAssertion"],members:{RoleArn:{},PrincipalArn:{},SAMLAssertion:{},PolicyArns:{shape:"S4"},Policy:{},DurationSeconds:{type:"integer"}}},output:{resultWrapper:"AssumeRoleWithSAMLResult",type:"structure",members:{Credentials:{shape:"Sc"},AssumedRoleUser:{shape:"Sh"},PackedPolicySize:{type:"integer"},Subject:{},SubjectType:{},Issuer:{},Audience:{},NameQualifier:{}}}},AssumeRoleWithWebIdentity:{input:{type:"structure",required:["RoleArn","RoleSessionName","WebIdentityToken"],members:{RoleArn:{},RoleSessionName:{},WebIdentityToken:{},ProviderId:{},PolicyArns:{shape:"S4"},Policy:{},DurationSeconds:{type:"integer"}}},output:{resultWrapper:"AssumeRoleWithWebIdentityResult",type:"structure",members:{Credentials:{shape:"Sc"},SubjectFromWebIdentityToken:{},AssumedRoleUser:{shape:"Sh"},PackedPolicySize:{type:"integer"},Provider:{},Audience:{}}}},DecodeAuthorizationMessage:{input:{type:"structure",required:["EncodedMessage"],members:{EncodedMessage:{}}},output:{resultWrapper:"DecodeAuthorizationMessageResult",type:"structure",members:{DecodedMessage:{}}}},GetAccessKeyInfo:{input:{type:"structure",required:["AccessKeyId"],members:{AccessKeyId:{}}},output:{resultWrapper:"GetAccessKeyInfoResult",type:"structure",members:{Account:{}}}},GetCallerIdentity:{input:{type:"structure",members:{}},output:{resultWrapper:"GetCallerIdentityResult",type:"structure",members:{UserId:{},Account:{},Arn:{}}}},GetFederationToken:{input:{type:"structure",required:["Name"],members:{Name:{},Policy:{},PolicyArns:{shape:"S4"},DurationSeconds:{type:"integer"}}},output:{resultWrapper:"GetFederationTokenResult",type:"structure",members:{Credentials:{shape:"Sc"},FederatedUser:{type:"structure",required:["FederatedUserId","Arn"],members:{FederatedUserId:{},Arn:{}}},PackedPolicySize:{type:"integer"}}}},GetSessionToken:{input:{type:"structure",members:{DurationSeconds:{type:"integer"},SerialNumber:{},TokenCode:{}}},output:{resultWrapper:"GetSessionTokenResult",type:"structure",members:{Credentials:{shape:"Sc"}}}}},shapes:{S4:{type:"list",member:{type:"structure",members:{arn:{}}}},Sc:{type:"structure",required:["AccessKeyId","SecretAccessKey","SessionToken","Expiration"],members:{AccessKeyId:{},SecretAccessKey:{},SessionToken:{},Expiration:{type:"timestamp"}}},Sh:{type:"structure",required:["AssumedRoleId","Arn"],members:{AssumedRoleId:{},Arn:{}}}}}},{}],6:[function(e,t,n){arguments[4][2][0].apply(n,arguments)},{dup:2}],7:[function(t,e,n){t("../lib/node_loader");var o=t("../lib/core"),r=o.Service,i=o.apiLoader;i.services.cognitoidentity={},o.CognitoIdentity=r.defineService("cognitoidentity",["2014-06-30"]),t("../lib/services/cognitoidentity"),Object.defineProperty(i.services.cognitoidentity,"2014-06-30",{get:function(){var e=t("../apis/cognito-identity-2014-06-30.min.json");return e.paginators=t("../apis/cognito-identity-2014-06-30.paginators.json").pagination,e},enumerable:!0,configurable:!0}),e.exports=o.CognitoIdentity},{"../apis/cognito-identity-2014-06-30.min.json":1,"../apis/cognito-identity-2014-06-30.paginators.json":2,"../lib/core":18,"../lib/node_loader":16,"../lib/services/cognitoidentity":60}],8:[function(t,e,n){t("../lib/node_loader");var o=t("../lib/core"),r=o.Service,i=o.apiLoader;i.services.sts={},o.STS=r.defineService("sts",["2011-06-15"]),t("../lib/services/sts"),Object.defineProperty(i.services.sts,"2011-06-15",{get:function(){var e=t("../apis/sts-2011-06-15.min.json");return e.paginators=t("../apis/sts-2011-06-15.paginators.json").pagination,e},enumerable:!0,configurable:!0}),e.exports=o.STS},{"../apis/sts-2011-06-15.min.json":5,"../apis/sts-2011-06-15.paginators.json":6,"../lib/core":18,"../lib/node_loader":16,"../lib/services/sts":61}],9:[function(e,t,n){function o(e,t){if(!o.services.hasOwnProperty(e))throw new Error("InvalidService: Failed to load api for "+e);return o.services[e][t]}o.services={},t.exports=o},{}],10:[function(e,t,n){var o=e("./browserHmac"),r=e("./browserMd5"),i=e("./browserSha1"),s=e("./browserSha256");t.exports={createHash:function(e){if("md5"===(e=e.toLowerCase()))return new r;if("sha256"===e)return new s;if("sha1"===e)return new i;throw new Error("Hash algorithm "+e+" is not supported in the browser SDK")},createHmac:function(e,t){if("md5"===(e=e.toLowerCase()))return new o(r,t);if("sha256"===e)return new o(s,t);if("sha1"===e)return new o(i,t);throw new Error("HMAC algorithm "+e+" is not supported in the browser SDK")},createSign:function(){throw new Error("createSign is not implemented in the browser")}}},{"./browserHmac":12,"./browserMd5":13,"./browserSha1":14,"./browserSha256":15}],11:[function(e,t,n){var o=e("buffer/").Buffer;"undefined"!=typeof ArrayBuffer&&void 0===ArrayBuffer.isView&&(ArrayBuffer.isView=function(e){return-1<r.indexOf(Object.prototype.toString.call(e))});var r=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]","[object DataView]"];t.exports={isEmptyData:function(e){return"string"==typeof e?0===e.length:0===e.byteLength},convertToBuffer:function(e){return"string"==typeof e&&(e=new o(e,"utf8")),ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}}},{"buffer/":80}],12:[function(e,t,n){var i=e("./browserHashUtils");function o(e,t){this.hash=new e,this.outer=new e;var n=function(e,t){var n=i.convertToBuffer(t);n.byteLength>e.BLOCK_SIZE&&((t=new e).update(n),n=t.digest());e=new Uint8Array(e.BLOCK_SIZE);return e.set(n),e}(e,t),o=new Uint8Array(e.BLOCK_SIZE);o.set(n);for(var r=0;r<e.BLOCK_SIZE;r++)n[r]^=54,o[r]^=92;this.hash.update(n),this.outer.update(o);for(r=0;r<n.byteLength;r++)n[r]=0}(t.exports=o).prototype.update=function(e){if(i.isEmptyData(e)||this.error)return this;try{this.hash.update(i.convertToBuffer(e))}catch(e){this.error=e}return this},o.prototype.digest=function(e){return this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest(e)}},{"./browserHashUtils":11}],13:[function(e,t,n){var r=e("./browserHashUtils"),s=e("buffer/").Buffer;function o(){this.state=[1732584193,4023233417,2562383102,271733878],this.buffer=new DataView(new ArrayBuffer(64)),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}function c(e,t,n,o,r,i){return((t=(t+e&4294967295)+(o+i&4294967295)&4294967295)<<r|t>>>32-r)+n&4294967295}function a(e,t,n,o,r,i,s){return c(t&n|~t&o,e,t,r,i,s)}function u(e,t,n,o,r,i,s){return c(t&o|n&~o,e,t,r,i,s)}function l(e,t,n,o,r,i,s){return c(t^n^o,e,t,r,i,s)}function p(e,t,n,o,r,i,s){return c(n^(t|~o),e,t,r,i,s)}(t.exports=o).BLOCK_SIZE=64,o.prototype.update=function(e){if(r.isEmptyData(e))return this;if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=r.convertToBuffer(e),n=0,o=t.byteLength;for(this.bytesHashed+=o;0<o;)this.buffer.setUint8(this.bufferLength++,t[n++]),o--,64===this.bufferLength&&(this.hashBuffer(),this.bufferLength=0);return this},o.prototype.digest=function(e){if(!this.finished){var t=this.buffer,n=this.bufferLength,o=8*this.bytesHashed;if(t.setUint8(this.bufferLength++,128),56<=n%64){for(var r=this.bufferLength;r<64;r++)t.setUint8(r,0);this.hashBuffer(),this.bufferLength=0}for(r=this.bufferLength;r<56;r++)t.setUint8(r,0);t.setUint32(56,o>>>0,!0),t.setUint32(60,Math.floor(o/4294967296),!0),this.hashBuffer(),this.finished=!0}for(var i=new DataView(new ArrayBuffer(16)),r=0;r<4;r++)i.setUint32(4*r,this.state[r],!0);o=new s(i.buffer,i.byteOffset,i.byteLength);return e?o.toString(e):o},o.prototype.hashBuffer=function(){var e=this.buffer,t=this.state,n=a(n=t[0],i=t[1],r=t[2],o=t[3],e.getUint32(0,!0),7,3614090360),o=a(o,n,i,r,e.getUint32(4,!0),12,3905402710),r=a(r,o,n,i,e.getUint32(8,!0),17,606105819),i=a(i,r,o,n,e.getUint32(12,!0),22,3250441966);n=a(n,i,r,o,e.getUint32(16,!0),7,4118548399),o=a(o,n,i,r,e.getUint32(20,!0),12,1200080426),r=a(r,o,n,i,e.getUint32(24,!0),17,2821735955),i=a(i,r,o,n,e.getUint32(28,!0),22,4249261313),n=a(n,i,r,o,e.getUint32(32,!0),7,1770035416),o=a(o,n,i,r,e.getUint32(36,!0),12,2336552879),r=a(r,o,n,i,e.getUint32(40,!0),17,4294925233),i=a(i,r,o,n,e.getUint32(44,!0),22,2304563134),n=a(n,i,r,o,e.getUint32(48,!0),7,1804603682),o=a(o,n,i,r,e.getUint32(52,!0),12,4254626195),r=a(r,o,n,i,e.getUint32(56,!0),17,2792965006),n=u(n,i=a(i,r,o,n,e.getUint32(60,!0),22,1236535329),r,o,e.getUint32(4,!0),5,4129170786),o=u(o,n,i,r,e.getUint32(24,!0),9,3225465664),r=u(r,o,n,i,e.getUint32(44,!0),14,643717713),i=u(i,r,o,n,e.getUint32(0,!0),20,3921069994),n=u(n,i,r,o,e.getUint32(20,!0),5,3593408605),o=u(o,n,i,r,e.getUint32(40,!0),9,38016083),r=u(r,o,n,i,e.getUint32(60,!0),14,3634488961),i=u(i,r,o,n,e.getUint32(16,!0),20,3889429448),n=u(n,i,r,o,e.getUint32(36,!0),5,568446438),o=u(o,n,i,r,e.getUint32(56,!0),9,3275163606),r=u(r,o,n,i,e.getUint32(12,!0),14,4107603335),i=u(i,r,o,n,e.getUint32(32,!0),20,1163531501),n=u(n,i,r,o,e.getUint32(52,!0),5,2850285829),o=u(o,n,i,r,e.getUint32(8,!0),9,4243563512),r=u(r,o,n,i,e.getUint32(28,!0),14,1735328473),n=l(n,i=u(i,r,o,n,e.getUint32(48,!0),20,2368359562),r,o,e.getUint32(20,!0),4,4294588738),o=l(o,n,i,r,e.getUint32(32,!0),11,2272392833),r=l(r,o,n,i,e.getUint32(44,!0),16,1839030562),i=l(i,r,o,n,e.getUint32(56,!0),23,4259657740),n=l(n,i,r,o,e.getUint32(4,!0),4,2763975236),o=l(o,n,i,r,e.getUint32(16,!0),11,1272893353),r=l(r,o,n,i,e.getUint32(28,!0),16,4139469664),i=l(i,r,o,n,e.getUint32(40,!0),23,3200236656),n=l(n,i,r,o,e.getUint32(52,!0),4,681279174),o=l(o,n,i,r,e.getUint32(0,!0),11,3936430074),r=l(r,o,n,i,e.getUint32(12,!0),16,3572445317),i=l(i,r,o,n,e.getUint32(24,!0),23,76029189),n=l(n,i,r,o,e.getUint32(36,!0),4,3654602809),o=l(o,n,i,r,e.getUint32(48,!0),11,3873151461),r=l(r,o,n,i,e.getUint32(60,!0),16,530742520),n=p(n,i=l(i,r,o,n,e.getUint32(8,!0),23,3299628645),r,o,e.getUint32(0,!0),6,4096336452),o=p(o,n,i,r,e.getUint32(28,!0),10,1126891415),r=p(r,o,n,i,e.getUint32(56,!0),15,2878612391),i=p(i,r,o,n,e.getUint32(20,!0),21,4237533241),n=p(n,i,r,o,e.getUint32(48,!0),6,1700485571),o=p(o,n,i,r,e.getUint32(12,!0),10,2399980690),r=p(r,o,n,i,e.getUint32(40,!0),15,4293915773),i=p(i,r,o,n,e.getUint32(4,!0),21,2240044497),n=p(n,i,r,o,e.getUint32(32,!0),6,1873313359),o=p(o,n,i,r,e.getUint32(60,!0),10,4264355552),r=p(r,o,n,i,e.getUint32(24,!0),15,2734768916),i=p(i,r,o,n,e.getUint32(52,!0),21,1309151649),n=p(n,i,r,o,e.getUint32(16,!0),6,4149444226),o=p(o,n,i,r,e.getUint32(44,!0),10,3174756917),r=p(r,o,n,i,e.getUint32(8,!0),15,718787259),i=p(i,r,o,n,e.getUint32(36,!0),21,3951481745),t[0]=n+t[0]&4294967295,t[1]=i+t[1]&4294967295,t[2]=r+t[2]&4294967295,t[3]=o+t[3]&4294967295}},{"./browserHashUtils":11,"buffer/":80}],14:[function(e,t,n){var r=e("buffer/").Buffer,o=e("./browserHashUtils");new Uint32Array([1518500249,1859775393,-1894007588,-899497514]),Math.pow(2,53);function i(){this.h0=1732584193,this.h1=4023233417,this.h2=2562383102,this.h3=271733878,this.h4=3285377520,this.block=new Uint32Array(80),this.offset=0,this.shift=24,this.totalLength=0}(t.exports=i).BLOCK_SIZE=64,i.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");if(o.isEmptyData(e))return this;var t=(e=o.convertToBuffer(e)).length;this.totalLength+=8*t;for(var n=0;n<t;n++)this.write(e[n]);return this},i.prototype.write=function(e){this.block[this.offset]|=(255&e)<<this.shift,this.shift?this.shift-=8:(this.offset++,this.shift=24),16===this.offset&&this.processBlock()},i.prototype.digest=function(e){this.write(128),(14<this.offset||14===this.offset&&this.shift<24)&&this.processBlock(),this.offset=14,this.shift=24,this.write(0),this.write(0),this.write(0xffffffffff<this.totalLength?this.totalLength/1099511627776:0),this.write(4294967295<this.totalLength?this.totalLength/4294967296:0);for(var t=24;0<=t;t-=8)this.write(this.totalLength>>t);var n=new r(20),o=new DataView(n.buffer);return o.setUint32(0,this.h0,!1),o.setUint32(4,this.h1,!1),o.setUint32(8,this.h2,!1),o.setUint32(12,this.h3,!1),o.setUint32(16,this.h4,!1),e?n.toString(e):n},i.prototype.processBlock=function(){for(var e=16;e<80;e++){var t=this.block[e-3]^this.block[e-8]^this.block[e-14]^this.block[e-16];this.block[e]=t<<1|t>>>31}for(var n,o=this.h0,r=this.h1,i=this.h2,s=this.h3,c=this.h4,e=0;e<80;e++){a=e<20?(n=s^r&(i^s),1518500249):e<40?(n=r^i^s,1859775393):e<60?(n=r&i|s&(r|i),2400959708):(n=r^i^s,3395469782);var a=(o<<5|o>>>27)+n+c+a+(0|this.block[e]),c=s,s=i,i=r<<30|r>>>2,r=o,o=a}for(this.h0=this.h0+o|0,this.h1=this.h1+r|0,this.h2=this.h2+i|0,this.h3=this.h3+s|0,this.h4=this.h4+c|0,e=this.offset=0;e<16;e++)this.block[e]=0}},{"./browserHashUtils":11,"buffer/":80}],15:[function(e,t,n){var s=e("buffer/").Buffer,o=e("./browserHashUtils"),d=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),r=Math.pow(2,53)-1;function i(){this.state=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}(t.exports=i).BLOCK_SIZE=64,i.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");if(o.isEmptyData(e))return this;var t=0,n=(e=o.convertToBuffer(e)).byteLength;if(this.bytesHashed+=n,8*this.bytesHashed>r)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;0<n;)this.buffer[this.bufferLength++]=e[t++],n--,64===this.bufferLength&&(this.hashBuffer(),this.bufferLength=0);return this},i.prototype.digest=function(e){if(!this.finished){var t=8*this.bytesHashed,n=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),o=this.bufferLength;if(n.setUint8(this.bufferLength++,128),56<=o%64){for(var r=this.bufferLength;r<64;r++)n.setUint8(r,0);this.hashBuffer(),this.bufferLength=0}for(r=this.bufferLength;r<56;r++)n.setUint8(r,0);n.setUint32(56,Math.floor(t/4294967296),!0),n.setUint32(60,t),this.hashBuffer(),this.finished=!0}for(var i=new s(32),r=0;r<8;r++)i[4*r]=this.state[r]>>>24&255,i[4*r+1]=this.state[r]>>>16&255,i[4*r+2]=this.state[r]>>>8&255,i[4*r+3]=this.state[r]>>>0&255;return e?i.toString(e):i},i.prototype.hashBuffer=function(){for(var e=this.buffer,t=this.state,n=t[0],o=t[1],r=t[2],i=t[3],s=t[4],c=t[5],a=t[6],u=t[7],l=0;l<64;l++){l<16?this.temp[l]=(255&e[4*l])<<24|(255&e[4*l+1])<<16|(255&e[4*l+2])<<8|255&e[4*l+3]:(p=((h=this.temp[l-2])>>>17|h<<15)^(h>>>19|h<<13)^h>>>10,h=((h=this.temp[l-15])>>>7|h<<25)^(h>>>18|h<<14)^h>>>3,this.temp[l]=(p+this.temp[l-7]|0)+(h+this.temp[l-16]|0));var p=(((s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7))+(s&c^~s&a)|0)+(u+(d[l]+this.temp[l]|0)|0)|0,h=((n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10))+(n&o^n&r^o&r)|0,u=a,a=c,c=s,s=i+p|0,i=r,r=o,o=n,n=p+h|0}t[0]+=n,t[1]+=o,t[2]+=r,t[3]+=i,t[4]+=s,t[5]+=c,t[6]+=a,t[7]+=u}},{"./browserHashUtils":11,"buffer/":80}],16:[function(n,o,e){(function(e){var t=n("./util");t.crypto.lib=n("./browserCryptoLib"),t.Buffer=n("buffer/").Buffer,t.url=n("url/"),t.querystring=n("querystring/"),t.realClock=n("./realclock/browserClock"),t.environment="js",t.createEventStream=n("./event-stream/buffered-create-event-stream").createEventStream,t.isBrowser=function(){return!0},t.isNode=function(){return!1};t=n("./core");o.exports=t,n("./credentials"),n("./credentials/credential_provider_chain"),n("./credentials/temporary_credentials"),n("./credentials/chainable_temporary_credentials"),n("./credentials/web_identity_credentials"),n("./credentials/cognito_identity_credentials"),n("./credentials/saml_credentials"),t.XML.Parser=n("./xml/browser_parser"),n("./http/xhr"),void 0===e&&(e={browser:!0})}).call(this,n("_process"))},{"./browserCryptoLib":10,"./core":18,"./credentials":19,"./credentials/chainable_temporary_credentials":20,"./credentials/cognito_identity_credentials":21,"./credentials/credential_provider_chain":22,"./credentials/saml_credentials":23,"./credentials/temporary_credentials":24,"./credentials/web_identity_credentials":25,"./event-stream/buffered-create-event-stream":27,"./http/xhr":35,"./realclock/browserClock":52,"./util":71,"./xml/browser_parser":72,_process:85,"buffer/":80,"querystring/":92,"url/":94}],17:[function(e,t,n){var o,i=e("./core");e("./credentials"),e("./credentials/credential_provider_chain"),i.Config=i.util.inherit({constructor:function(n){void 0===n&&(n={}),n=this.extractCredentials(n),i.util.each.call(this,this.keys,function(e,t){this.set(e,n[e],t)})},getCredentials:function(t){var e,n=this;function o(e){t(e,e?null:n.credentials)}function r(e,t){return new i.util.error(t||new Error,{code:"CredentialsError",message:e,name:"CredentialsError"})}n.credentials?"function"==typeof n.credentials.get?n.credentials.get(function(e){o(e=e&&r("Could not load credentials from "+n.credentials.constructor.name,e))}):(e=null,n.credentials.accessKeyId&&n.credentials.secretAccessKey||(e=r("Missing credentials")),o(e)):n.credentialProvider?n.credentialProvider.resolve(function(e,t){e=e&&r("Could not load credentials from any providers",e),n.credentials=t,o(e)}):o(r("No credentials to load"))},update:function(e,n){n=n||!1,e=this.extractCredentials(e),i.util.each.call(this,e,function(e,t){(n||Object.prototype.hasOwnProperty.call(this.keys,e)||i.Service.hasService(e))&&this.set(e,t)})},loadFromPath:function(e){this.clear();var n=JSON.parse(i.util.readFileSync(e)),t=new i.FileSystemCredentials(e),e=new i.CredentialProviderChain;return e.providers.unshift(t),e.resolve(function(e,t){if(e)throw e;n.credentials=t}),this.constructor(n),this},clear:function(){i.util.each.call(this,this.keys,function(e){delete this[e]}),this.set("credentials",void 0),this.set("credentialProvider",void 0)},set:function(e,t,n){void 0===t?(void 0===n&&(n=this.keys[e]),this[e]="function"==typeof n?n.call(this):n):"httpOptions"===e&&this[e]?this[e]=i.util.merge(this[e],t):this[e]=t},keys:{credentials:null,credentialProvider:null,region:null,logger:null,apiVersions:{},apiVersion:null,endpoint:void 0,httpOptions:{timeout:12e4},maxRetries:void 0,maxRedirects:10,paramValidation:!0,sslEnabled:!0,s3ForcePathStyle:!1,s3BucketEndpoint:!1,s3DisableBodySigning:!0,computeChecksums:!0,convertResponseTypes:!0,correctClockSkew:!1,customUserAgent:null,dynamoDbCrc32:!0,systemClockOffset:0,signatureVersion:null,signatureCache:!0,retryDelayOptions:{},useAccelerateEndpoint:!1,clientSideMonitoring:!1,endpointDiscoveryEnabled:!1,endpointCacheSize:1e3,hostPrefixEnabled:!0,stsRegionalEndpoints:null},extractCredentials:function(e){return e.accessKeyId&&e.secretAccessKey&&((e=i.util.copy(e)).credentials=new i.Credentials(e)),e},setPromisesDependency:function(e){null===(o=e)&&"function"==typeof Promise&&(o=Promise);e=[i.Request,i.Credentials,i.CredentialProviderChain];i.S3&&(e.push(i.S3),i.S3.ManagedUpload&&e.push(i.S3.ManagedUpload)),i.util.addPromises(e,o)},getPromisesDependency:function(){return o}}),i.config=new i.Config},{"./core":18,"./credentials":19,"./credentials/credential_provider_chain":22}],18:[function(e,t,n){var o={util:e("./util")};({}).toString(),(t.exports=o).util.update(o,{VERSION:"2.553.0",Signers:{},Protocol:{Json:e("./protocol/json"),Query:e("./protocol/query"),Rest:e("./protocol/rest"),RestJson:e("./protocol/rest_json"),RestXml:e("./protocol/rest_xml")},XML:{Builder:e("./xml/builder"),Parser:null},JSON:{Builder:e("./json/builder"),Parser:e("./json/parser")},Model:{Api:e("./model/api"),Operation:e("./model/operation"),Shape:e("./model/shape"),Paginator:e("./model/paginator"),ResourceWaiter:e("./model/resource_waiter")},apiLoader:e("./api_loader"),EndpointCache:e("../vendor/endpoint-cache").EndpointCache}),e("./sequential_executor"),e("./service"),e("./config"),e("./http"),e("./event_listeners"),e("./request"),e("./response"),e("./resource_waiter"),e("./signers/request_signer"),e("./param_validator"),o.events=new o.SequentialExecutor,o.util.memoizedProperty(o,"endpointCache",function(){return new o.EndpointCache(o.config.endpointCacheSize)},!0)},{"../vendor/endpoint-cache":103,"./api_loader":9,"./config":17,"./event_listeners":33,"./http":34,"./json/builder":36,"./json/parser":37,"./model/api":38,"./model/operation":40,"./model/paginator":41,"./model/resource_waiter":42,"./model/shape":43,"./param_validator":44,"./protocol/json":46,"./protocol/query":47,"./protocol/rest":48,"./protocol/rest_json":49,"./protocol/rest_xml":50,"./request":55,"./resource_waiter":56,"./response":57,"./sequential_executor":58,"./service":59,"./signers/request_signer":63,"./util":71,"./xml/builder":73}],19:[function(e,t,n){var r=e("./core");r.Credentials=r.util.inherit({constructor:function(e,t,n){var o;r.util.hideProperties(this,["secretAccessKey"]),this.expired=!1,this.expireTime=null,this.refreshCallbacks=[],1===arguments.length&&"object"==typeof e?(o=e.credentials||e,this.accessKeyId=o.accessKeyId,this.secretAccessKey=o.secretAccessKey,this.sessionToken=o.sessionToken):(this.accessKeyId=e,this.secretAccessKey=t,this.sessionToken=n)},expiryWindow:15,needsRefresh:function(){var e=r.util.date.getDate().getTime(),e=new Date(e+1e3*this.expiryWindow);return!!(this.expireTime&&e>this.expireTime)||(this.expired||!this.accessKeyId||!this.secretAccessKey)},get:function(t){var n=this;this.needsRefresh()?this.refresh(function(e){e||(n.expired=!1),t&&t(e)}):t&&t()},refresh:function(e){this.expired=!1,e()},coalesceRefresh:function(e,n){var o=this;1===o.refreshCallbacks.push(e)&&o.load(function(t){r.util.arrayEach(o.refreshCallbacks,function(e){n?e(t):r.util.defer(function(){e(t)})}),o.refreshCallbacks.length=0})},load:function(e){e()}}),r.Credentials.addPromisesToClass=function(e){this.prototype.getPromise=r.util.promisifyMethod("get",e),this.prototype.refreshPromise=r.util.promisifyMethod("refresh",e)},r.Credentials.deletePromisesFromClass=function(){delete this.prototype.getPromise,delete this.prototype.refreshPromise},r.util.addPromises(r.Credentials)},{"./core":18}],20:[function(e,t,n){var i=e("../core"),o=e("../../clients/sts");i.ChainableTemporaryCredentials=i.util.inherit(i.Credentials,{constructor:function(e){i.Credentials.call(this),e=e||{},this.errorCode="ChainableTemporaryCredentialsProviderFailure",this.expired=!0,this.tokenCodeFn=null;var t=i.util.copy(e.params)||{};if(t.RoleArn&&(t.RoleSessionName=t.RoleSessionName||"temporary-credentials"),t.SerialNumber){if(!e.tokenCodeFn||"function"!=typeof e.tokenCodeFn)throw new i.util.error(new Error("tokenCodeFn must be a function when params.SerialNumber is given"),{code:this.errorCode});this.tokenCodeFn=e.tokenCodeFn}e=i.util.merge({params:t,credentials:e.masterCredentials||i.config.credentials},e.stsConfig||{});this.service=new o(e)},refresh:function(e){this.coalesceRefresh(e||i.util.fn.callback)},load:function(o){var r=this,i=r.service.config.params.RoleArn?"assumeRole":"getSessionToken";this.getTokenCode(function(e,t){var n={};e?o(e):(t&&(n.TokenCode=t),r.service[i](n,function(e,t){e||r.service.credentialsFrom(t,r),o(e)}))})},getTokenCode:function(o){var r=this;this.tokenCodeFn?this.tokenCodeFn(this.service.config.params.SerialNumber,function(e,t){if(e){var n=e;return e instanceof Error&&(n=e.message),void o(i.util.error(new Error("Error fetching MFA token: "+n),{code:r.errorCode}))}o(null,t)}):o(null)}})},{"../../clients/sts":8,"../core":18}],21:[function(e,t,n){var o=e("../core"),r=e("../../clients/cognitoidentity"),i=e("../../clients/sts");o.CognitoIdentityCredentials=o.util.inherit(o.Credentials,{localStorageKey:{id:"aws.cognito.identity-id.",providers:"aws.cognito.identity-providers."},constructor:function(e,t){o.Credentials.call(this),this.expired=!0,this.params=e,this.data=null,this._identityId=null,this._clientConfig=o.util.copy(t||{}),this.loadCachedId();var n=this;Object.defineProperty(this,"identityId",{get:function(){return n.loadCachedId(),n._identityId||n.params.IdentityId},set:function(e){n._identityId=e}})},refresh:function(e){this.coalesceRefresh(e||o.util.fn.callback)},load:function(t){var n=this;n.createClients(),n.data=null,n._identityId=null,n.getId(function(e){e?(n.clearIdOnNotAuthorized(e),t(e)):n.params.RoleArn?n.getCredentialsFromSTS(t):n.getCredentialsForIdentity(t)})},clearCachedId:function(){this._identityId=null,delete this.params.IdentityId;var e=this.params.IdentityPoolId,t=this.params.LoginId||"";delete this.storage[this.localStorageKey.id+e+t],delete this.storage[this.localStorageKey.providers+e+t]},clearIdOnNotAuthorized:function(e){"NotAuthorizedException"==e.code&&this.clearCachedId()},getId:function(n){var o=this;if("string"==typeof o.params.IdentityId)return n(null,o.params.IdentityId);o.cognito.getId(function(e,t){!e&&t.IdentityId?(o.params.IdentityId=t.IdentityId,n(null,t.IdentityId)):n(e)})},loadCredentials:function(e,t){e&&t&&(t.expired=!1,t.accessKeyId=e.Credentials.AccessKeyId,t.secretAccessKey=e.Credentials.SecretKey,t.sessionToken=e.Credentials.SessionToken,t.expireTime=e.Credentials.Expiration)},getCredentialsForIdentity:function(n){var o=this;o.cognito.getCredentialsForIdentity(function(e,t){e?o.clearIdOnNotAuthorized(e):(o.cacheId(t),o.data=t,o.loadCredentials(o.data,o)),n(e)})},getCredentialsFromSTS:function(n){var o=this;o.cognito.getOpenIdToken(function(e,t){e?(o.clearIdOnNotAuthorized(e),n(e)):(o.cacheId(t),o.params.WebIdentityToken=t.Token,o.webIdentityCredentials.refresh(function(e){e||(o.data=o.webIdentityCredentials.data,o.sts.credentialsFrom(o.data,o)),n(e)}))})},loadCachedId:function(){var e,t,n=this;o.util.isBrowser()&&!n.params.IdentityId&&((e=n.getStorage("id"))&&n.params.Logins?(t=Object.keys(n.params.Logins),0!==(n.getStorage("providers")||"").split(",").filter(function(e){return-1!==t.indexOf(e)}).length&&(n.params.IdentityId=e)):e&&(n.params.IdentityId=e))},createClients:function(){var e,t=this._clientConfig;this.webIdentityCredentials=this.webIdentityCredentials||new o.WebIdentityCredentials(this.params,t),this.cognito||((e=o.util.merge({},t)).params=this.params,this.cognito=new r(e)),this.sts=this.sts||new i(t)},cacheId:function(e){this._identityId=e.IdentityId,this.params.IdentityId=this._identityId,o.util.isBrowser()&&(this.setStorage("id",e.IdentityId),this.params.Logins&&this.setStorage("providers",Object.keys(this.params.Logins).join(",")))},getStorage:function(e){return this.storage[this.localStorageKey[e]+this.params.IdentityPoolId+(this.params.LoginId||"")]},setStorage:function(e,t){try{this.storage[this.localStorageKey[e]+this.params.IdentityPoolId+(this.params.LoginId||"")]=t}catch(e){}},storage:function(){try{var e=o.util.isBrowser()&&null!==window.localStorage&&"object"==typeof window.localStorage?window.localStorage:{};return e["aws.test-storage"]="foobar",delete e["aws.test-storage"],e}catch(e){return{}}}()})},{"../../clients/cognitoidentity":7,"../../clients/sts":8,"../core":18}],22:[function(e,t,n){var c=e("../core");c.CredentialProviderChain=c.util.inherit(c.Credentials,{constructor:function(e){this.providers=e||c.CredentialProviderChain.defaultProviders.slice(0),this.resolveCallbacks=[]},resolve:function(e){var r,i,s=this;return 0===s.providers.length?e(new Error("No providers")):1===s.resolveCallbacks.push(e)&&(r=0,i=s.providers.slice(0),function t(n,o){if(!n&&o||r===i.length)return c.util.arrayEach(s.resolveCallbacks,function(e){e(n,o)}),void(s.resolveCallbacks.length=0);var e=i[r++];(o="function"==typeof e?e.call():e).get?o.get(function(e){t(e,e?null:o)}):t(null,o)}()),s}}),c.CredentialProviderChain.defaultProviders=[],c.CredentialProviderChain.addPromisesToClass=function(e){this.prototype.resolvePromise=c.util.promisifyMethod("resolve",e)},c.CredentialProviderChain.deletePromisesFromClass=function(){delete this.prototype.resolvePromise},c.util.addPromises(c.CredentialProviderChain)},{"../core":18}],23:[function(e,t,n){var o=e("../core"),r=e("../../clients/sts");o.SAMLCredentials=o.util.inherit(o.Credentials,{constructor:function(e){o.Credentials.call(this),this.expired=!0,this.params=e},refresh:function(e){this.coalesceRefresh(e||o.util.fn.callback)},load:function(n){var o=this;o.createClients(),o.service.assumeRoleWithSAML(function(e,t){e||o.service.credentialsFrom(t,o),n(e)})},createClients:function(){this.service=this.service||new r({params:this.params})}})},{"../../clients/sts":8,"../core":18}],24:[function(e,t,n){var o=e("../core"),r=e("../../clients/sts");o.TemporaryCredentials=o.util.inherit(o.Credentials,{constructor:function(e,t){o.Credentials.call(this),this.loadMasterCredentials(t),this.expired=!0,this.params=e||{},this.params.RoleArn&&(this.params.RoleSessionName=this.params.RoleSessionName||"temporary-credentials")},refresh:function(e){this.coalesceRefresh(e||o.util.fn.callback)},load:function(n){var o=this;o.createClients(),o.masterCredentials.get(function(){o.service.config.credentials=o.masterCredentials,(o.params.RoleArn?o.service.assumeRole:o.service.getSessionToken).call(o.service,function(e,t){e||o.service.credentialsFrom(t,o),n(e)})})},loadMasterCredentials:function(e){for(this.masterCredentials=e||o.config.credentials;this.masterCredentials.masterCredentials;)this.masterCredentials=this.masterCredentials.masterCredentials;"function"!=typeof this.masterCredentials.get&&(this.masterCredentials=new o.Credentials(this.masterCredentials))},createClients:function(){this.service=this.service||new r({params:this.params})}})},{"../../clients/sts":8,"../core":18}],25:[function(e,t,n){var o=e("../core"),r=e("../../clients/sts");o.WebIdentityCredentials=o.util.inherit(o.Credentials,{constructor:function(e,t){o.Credentials.call(this),this.expired=!0,this.params=e,this.params.RoleSessionName=this.params.RoleSessionName||"web-identity",this.data=null,this._clientConfig=o.util.copy(t||{})},refresh:function(e){this.coalesceRefresh(e||o.util.fn.callback)},load:function(n){var o=this;o.createClients(),o.service.assumeRoleWithWebIdentity(function(e,t){o.data=null,e||(o.data=t,o.service.credentialsFrom(t,o)),n(e)})},createClients:function(){var e;this.service||((e=o.util.merge({},this._clientConfig)).params=this.params,this.service=new r(e))}})},{"../../clients/sts":8,"../core":18}],26:[function(e,t,n){(function(r){var u=e("./core"),l=e("./util"),i=["AWS_ENABLE_ENDPOINT_DISCOVERY","AWS_ENDPOINT_DISCOVERY_ENABLED"];function p(e){var t=e.service,n=t.api||{},e={};return t.config.region&&(e.region=t.config.region),n.serviceId&&(e.serviceId=n.serviceId),t.config.credentials.accessKeyId&&(e.accessKeyId=t.config.credentials.accessKeyId),e}function h(e,t){var n={};return function o(r,i,s){s&&null!=i&&"structure"===s.type&&s.required&&0<s.required.length&&l.arrayEach(s.required,function(e){var t,n=s.members[e];!0===n.endpointDiscoveryId?(t=n.isLocationName?n.name:e,r[t]=String(i[e])):o(r,i[e],n)})}(n,e.params,t),n}function o(e){var t=e.service,n=t.api,o=n.operations?n.operations[e.operation]:void 0,r=h(e,o?o.input:void 0),i=p(e);0<Object.keys(r).length&&(i=l.update(i,r),o&&(i.operation=o.name));var s=u.endpointCache.get(i);s&&1===s.length&&""===s[0].Address||(s&&0<s.length?e.httpRequest.updateEndpoint(s[0].Address):(f(r=t.makeRequest(n.endpointOperation,{Operation:o.name,Identifiers:r})),r.removeListener("validate",u.EventListeners.Core.VALIDATE_PARAMETERS),r.removeListener("retry",u.EventListeners.Core.RETRY_CHECK),u.endpointCache.put(i,[{Address:"",CachePeriodInMinutes:1}]),r.send(function(e,t){t&&t.Endpoints?u.endpointCache.put(i,t.Endpoints):e&&u.endpointCache.put(i,[{Address:"",CachePeriodInMinutes:1}])})))}var d={};function s(r,i){var e=r.service,t=e.api,n=t.operations?t.operations[r.operation]:void 0,o=n?n.input:void 0,s=h(r,o),c=p(r);0<Object.keys(s).length&&(c=l.update(c,s),n&&(c.operation=n.name));var a=u.EndpointCache.getKeyString(c),o=u.endpointCache.get(a);o&&1===o.length&&""===o[0].Address?(d[a]||(d[a]=[]),d[a].push({request:r,callback:i})):o&&0<o.length?(r.httpRequest.updateEndpoint(o[0].Address),i()):((s=e.makeRequest(t.endpointOperation,{Operation:n.name,Identifiers:s})).removeListener("validate",u.EventListeners.Core.VALIDATE_PARAMETERS),f(s),u.endpointCache.put(a,[{Address:"",CachePeriodInMinutes:60}]),s.send(function(t,n){var o,e;t?(o={code:"EndpointDiscoveryException",message:"Request cannot be fulfilled without specifying an endpoint",retryable:!1},r.response.error=l.error(t,o),u.endpointCache.remove(c),d[a]&&(e=d[a],l.arrayEach(e,function(e){e.request.response.error=l.error(t,o),e.callback()}),delete d[a])):n&&(u.endpointCache.put(a,n.Endpoints),r.httpRequest.updateEndpoint(n.Endpoints[0].Address),d[a]&&(e=d[a],l.arrayEach(e,function(e){e.request.httpRequest.updateEndpoint(n.Endpoints[0].Address),e.callback()}),delete d[a])),i()}))}function f(e){var t=e.service.api.apiVersion;t&&!e.httpRequest.headers["x-amz-api-version"]&&(e.httpRequest.headers["x-amz-api-version"]=t)}function c(e){var t,n=e.error,o=e.httpResponse;!n||"InvalidEndpointException"!==n.code&&421!==o.statusCode||(o=h(t=e.request,(n=t.service.api.operations||{})[t.operation]?n[t.operation].input:void 0),e=p(t),0<Object.keys(o).length&&(e=l.update(e,o),n[t.operation]&&(e.operation=n[t.operation].name)),u.endpointCache.remove(e))}function a(e){return 0<=["false","0"].indexOf(e)}t.exports={discoverEndpoint:function(e,t){var n=e.service||{};if(function(e){if(e._originalConfig&&e._originalConfig.endpoint&&!0===e._originalConfig.endpointDiscoveryEnabled)throw l.error(new Error,{code:"ConfigurationException",message:"Custom endpoint is supplied; endpointDiscoveryEnabled must not be true."});var t=u.config[e.serviceIdentifier]||{};return Boolean(u.config.endpoint||t.endpoint||e._originalConfig&&e._originalConfig.endpoint)}(n)||e.isPresigned())return t();if(!function(e){if(!0===(e.service||{}).config.endpointDiscoveryEnabled)return 1;if(!l.isBrowser()){for(var t=0;t<i.length;t++){var n=i[t];if(Object.prototype.hasOwnProperty.call(r.env,n)){if(""===r.env[n]||void 0===r.env[n])throw l.error(new Error,{code:"ConfigurationException",message:"environmental variable "+n+" cannot be set to nothing"});if(!a(r.env[n]))return 1}}var o={};try{o=u.util.iniLoader?u.util.iniLoader.loadFrom({isConfig:!0,filename:r.env[u.util.sharedConfigFileEnv]}):{}}catch(e){}e=o[r.env.AWS_PROFILE||u.util.defaultProfile]||{};if(Object.prototype.hasOwnProperty.call(e,"endpoint_discovery_enabled")){if(void 0===e.endpoint_discovery_enabled)throw l.error(new Error,{code:"ConfigurationException",message:"config file entry 'endpoint_discovery_enabled' cannot be set to nothing"});if(!a(e.endpoint_discovery_enabled))return 1}}}(e))return t();switch(e.httpRequest.appendToUserAgent("endpoint-discovery"),(n=(n.api.operations||{})[e.operation])?n.endpointDiscoveryRequired:"NULL"){case"OPTIONAL":o(e),e.addNamedListener("INVALIDATE_CACHED_ENDPOINTS","extractError",c),t();break;case"REQUIRED":e.addNamedListener("INVALIDATE_CACHED_ENDPOINTS","extractError",c),s(e,t);break;case"NULL":default:t()}},requiredDiscoverEndpoint:s,optionalDiscoverEndpoint:o,marshallCustomIdentifiers:h,getCacheKey:p,invalidateCachedEndpoint:c}}).call(this,e("_process"))},{"./core":18,"./util":71,_process:85}],27:[function(e,t,n){var s=e("../event-stream/event-message-chunker").eventMessageChunker,c=e("./parse-event").parseEvent;t.exports={createEventStream:function(e,t,n){for(var o=s(e),r=[],i=0;i<o.length;i++)r.push(c(t,o[i],n));return r}}},{"../event-stream/event-message-chunker":28,"./parse-event":30}],28:[function(e,t,n){t.exports={eventMessageChunker:function(e){for(var t=[],n=0;n<e.length;){var o=e.readInt32BE(n),r=e.slice(n,o+n);n+=o,t.push(r)}return t}}},{}],29:[function(e,t,n){var o=e("../core").util,r=o.buffer.toBuffer;function i(e){if(8!==e.length)throw new Error("Int64 buffers must be exactly 8 bytes");o.Buffer.isBuffer(e)||(e=r(e)),this.bytes=e}function s(e){for(var t=0;t<8;t++)e[t]^=255;for(t=7;-1<t&&(e[t]++,0===e[t]);t--);}i.fromNumber=function(e){if(0x8000000000000000<e||e<-0x8000000000000000)throw new Error(e+" is too large (or, if negative, too small) to represent as an Int64");for(var t=new Uint8Array(8),n=7,o=Math.abs(Math.round(e));-1<n&&0<o;n--,o/=256)t[n]=o;return e<0&&s(t),new i(t)},i.prototype.valueOf=function(){var e=this.bytes.slice(0),t=128&e[0];return t&&s(e),parseInt(e.toString("hex"),16)*(t?-1:1)},i.prototype.toString=function(){return String(this.valueOf())},t.exports={Int64:i}},{"../core":18}],30:[function(e,t,n){var h=e("./parse-message").parseMessage;t.exports={parseEvent:function(e,t,n){var o,r=h(t);if(i=r.headers[":message-type"]){if("error"===i.value)throw t=(o=r).headers[":error-code"],o=o.headers[":error-message"],(o=new Error(o.value||o)).code=o.name=t.value||t,o;if("event"!==i.value)return}var i=r.headers[":event-type"],s=n.members[i.value];if(s){var c={},n=s.eventPayloadMemberName;n&&("binary"===(p=s.members[n]).type?c[n]=r.body:c[n]=e.parse(r.body.toString(),p));for(var a=s.eventHeaderMemberNames,u=0;u<a.length;u++){var l=a[u];r.headers[l]&&(c[l]=s.members[l].toType(r.headers[l].value))}var p={};return p[i.value]=c,p}}}},{"./parse-message":31}],31:[function(e,t,n){var c=e("./int64").Int64,o=e("./split-message").splitMessage,a="boolean",u="byte",l="short",p="integer",h="long",d="binary",f="string",g="timestamp",m="uuid";t.exports={parseMessage:function(e){return{headers:function(e){for(var t={},n=0;n<e.length;){var o=e.readUInt8(n++),r=e.slice(n,n+o).toString();switch(n+=o,e.readUInt8(n++)){case 0:t[r]={type:a,value:!0};break;case 1:t[r]={type:a,value:!1};break;case 2:t[r]={type:u,value:e.readInt8(n++)};break;case 3:t[r]={type:l,value:e.readInt16BE(n)},n+=2;break;case 4:t[r]={type:p,value:e.readInt32BE(n)},n+=4;break;case 5:t[r]={type:h,value:new c(e.slice(n,n+8))},n+=8;break;case 6:var i=e.readUInt16BE(n);n+=2,t[r]={type:d,value:e.slice(n,n+i)},n+=i;break;case 7:var s=e.readUInt16BE(n);n+=2,t[r]={type:f,value:e.slice(n,n+s).toString()},n+=s;break;case 8:t[r]={type:g,value:new Date(new c(e.slice(n,n+8)).valueOf())},n+=8;break;case 9:s=e.slice(n,n+16).toString("hex");n+=16,t[r]={type:m,value:s.substr(0,8)+"-"+s.substr(8,4)+"-"+s.substr(12,4)+"-"+s.substr(16,4)+"-"+s.substr(20)};break;default:throw new Error("Unrecognized header type tag")}}return t}((e=o(e)).headers),body:e.body}}}},{"./int64":29,"./split-message":32}],32:[function(e,t,n){var o=e("../core").util,r=o.buffer.toBuffer;t.exports={splitMessage:function(e){if(o.Buffer.isBuffer(e)||(e=r(e)),e.length<16)throw new Error("Provided message too short to accommodate event stream message overhead");if(e.length!==e.readUInt32BE(0))throw new Error("Reported message length does not match received message length");var t=e.readUInt32BE(8);if(t!==o.crypto.crc32(e.slice(0,8)))throw new Error("The prelude checksum specified in the message ("+t+") does not match the calculated CRC32 checksum.");if((t=e.readUInt32BE(e.length-4))!==o.crypto.crc32(e.slice(0,e.length-4)))throw new Error("The message checksum did not match the expected value of "+t);return t=12+e.readUInt32BE(4),{headers:e.slice(12,t),body:e.slice(t,e.length-4)}}}},{"../core":18}],33:[function(a,e,t){var u=a("./core"),n=a("./sequential_executor"),o=a("./discover_endpoint").discoverEndpoint;u.EventListeners={Core:{}},u.EventListeners={Core:(new n).addNamedListeners(function(e,t){t("VALIDATE_CREDENTIALS","validate",function(t,n){return t.service.api.signatureVersion||t.service.config.signatureVersion?void t.service.config.getCredentials(function(e){e&&(t.response.error=u.util.error(e,{code:"CredentialsError",message:"Missing credentials in config"})),n()}):n()}),e("VALIDATE_REGION","validate",function(e){e.service.config.region||e.service.isGlobalEndpoint||(e.response.error=u.util.error(new Error,{code:"ConfigError",message:"Missing region in config"}))}),e("BUILD_IDEMPOTENCY_TOKENS","validate",function(e){if(e.service.api.operations){var t=e.service.api.operations[e.operation];if(t){var n=t.idempotentMembers;if(n.length){for(var o=u.util.copy(e.params),r=0,i=n.length;r<i;r++)o[n[r]]||(o[n[r]]=u.util.uuid.v4());e.params=o}}}}),e("VALIDATE_PARAMETERS","validate",function(e){var t,n;e.service.api.operations&&(t=e.service.api.operations[e.operation].input,n=e.service.config.paramValidation,new u.ParamValidator(n).validate(t,e.params))}),t("COMPUTE_SHA256","afterBuild",function(n,o){if(n.haltHandlersOnError(),n.service.api.operations){var e=n.service.api.operations[n.operation],t=e?e.authtype:"";if(!n.service.api.signatureVersion&&!t&&!n.service.config.signatureVersion)return o();if(n.service.getSignerClass(n)===u.Signers.V4){e=n.httpRequest.body||"";if(0<=t.indexOf("unsigned-body"))return n.httpRequest.headers["X-Amz-Content-Sha256"]="UNSIGNED-PAYLOAD",o();u.util.computeSha256(e,function(e,t){e?o(e):(n.httpRequest.headers["X-Amz-Content-Sha256"]=t,o())})}else o()}}),e("SET_CONTENT_LENGTH","afterBuild",function(t){var n=(o=t).service.api.operations&&(o=o.service.api.operations[o.operation])?o.authtype:"",o=u.util.getRequestPayloadShape(t);if(void 0===t.httpRequest.headers["Content-Length"])try{var e=u.util.string.byteLength(t.httpRequest.body);t.httpRequest.headers["Content-Length"]=e}catch(e){if(o&&o.isStreaming){if(o.requiresLength)throw e;if(0<=n.indexOf("unsigned-body"))return void(t.httpRequest.headers["Transfer-Encoding"]="chunked");throw e}throw e}}),e("SET_HTTP_HOST","afterBuild",function(e){e.httpRequest.headers.Host=e.httpRequest.endpoint.host}),e("RESTART","restart",function(){var e=this.response.error;e&&e.retryable&&(this.httpRequest=new u.HttpRequest(this.service.endpoint,this.service.region),this.response.retryCount<this.service.config.maxRetries?this.response.retryCount++:this.response.error=null)});t("DISCOVER_ENDPOINT","sign",o,!0),t("SIGN","sign",function(r,i){var s=r.service,c=(r.service.api.operations||{})[r.operation],e=c?c.authtype:"";if(!s.api.signatureVersion&&!e&&!s.config.signatureVersion)return i();s.config.getCredentials(function(e,t){if(e)return r.response.error=e,i();try{var n=s.getSkewCorrectedDate(),o=new(s.getSignerClass(r))(r.httpRequest,s.api.signingName||s.api.endpointPrefix,{signatureCache:s.config.signatureCache,operation:c,signatureVersion:s.api.signatureVersion});o.setServiceClientId(s._clientId),delete r.httpRequest.headers.Authorization,delete r.httpRequest.headers.Date,delete r.httpRequest.headers["X-Amz-Date"],o.addAuthorization(t,n),r.signedAt=n}catch(e){r.response.error=e}i()})}),e("VALIDATE_RESPONSE","validateResponse",function(e){this.service.successfulResponse(e,this)?(e.data={},e.error=null):(e.data=null,e.error=u.util.error(new Error,{code:"UnknownError",message:"An unknown error occurred."}))}),t("SEND","send",function(s,c){function o(o){s.httpResponse.stream=o;var e=s.request.httpRequest.stream,r=s.request.service,t=r.api,n=s.request.operation,i=t.operations[n]||{};o.on("headers",function(e,t,n){if(s.request.emit("httpHeaders",[e,t,s,n]),!s.httpResponse.streaming)if(2===u.HttpClient.streamsApiVersion){if(i.hasEventOutput&&r.successfulResponse(s))return s.request.emit("httpDone"),void c();o.on("readable",function(){var e=o.read();null!==e&&s.request.emit("httpData",[e,s])})}else o.on("data",function(e){s.request.emit("httpData",[e,s])})}),o.on("end",function(){e&&e.didCallback||2===u.HttpClient.streamsApiVersion&&i.hasEventOutput&&r.successfulResponse(s)||(s.request.emit("httpDone"),c())})}function r(e){var t;"RequestAbortedError"!==e.code&&(t="TimeoutError"===e.code?e.code:"NetworkingError",e=u.util.error(e,{code:t,region:s.request.httpRequest.region,hostname:s.request.httpRequest.endpoint.hostname,retryable:!0})),s.error=e,s.request.emit("httpError",[s.error,s],function(){c()})}function t(){var e=u.HttpClient.getInstance(),t=s.request.service.config.httpOptions||{};try{var n=e.handleRequest(s.request.httpRequest,t,o,r);(n=n).on("sendProgress",function(e){s.request.emit("httpUploadProgress",[e,s])}),n.on("receiveProgress",function(e){s.request.emit("httpDownloadProgress",[e,s])})}catch(e){r(e)}}s.httpResponse._abortCallback=c,s.error=null,s.data=null,600<=(s.request.service.getSkewCorrectedDate()-this.signedAt)/1e3?this.emit("sign",[this],function(e){e?c(e):t()}):t()}),e("HTTP_HEADERS","httpHeaders",function(e,t,n,o){n.httpResponse.statusCode=e,n.httpResponse.statusMessage=o,n.httpResponse.headers=t,n.httpResponse.body=u.util.buffer.toBuffer(""),n.httpResponse.buffers=[],n.httpResponse.numBytes=0;t=t.date||t.Date,n=n.request.service;t&&(t=Date.parse(t),n.config.correctClockSkew&&n.isClockSkewed(t)&&n.applyClockOffset(t))}),e("HTTP_DATA","httpData",function(e,t){var n;e&&(u.util.isNode()&&(t.httpResponse.numBytes+=e.length,n=t.httpResponse.headers["content-length"],n={loaded:t.httpResponse.numBytes,total:n},t.request.emit("httpDownloadProgress",[n,t])),t.httpResponse.buffers.push(u.util.buffer.toBuffer(e)))}),e("HTTP_DONE","httpDone",function(e){var t;e.httpResponse.buffers&&0<e.httpResponse.buffers.length&&(t=u.util.buffer.concat(e.httpResponse.buffers),e.httpResponse.body=t),delete e.httpResponse.numBytes,delete e.httpResponse.buffers}),e("FINALIZE_ERROR","retry",function(e){e.httpResponse.statusCode&&(e.error.statusCode=e.httpResponse.statusCode,void 0===e.error.retryable&&(e.error.retryable=this.service.retryableError(e.error,this)))}),e("INVALIDATE_CREDENTIALS","retry",function(e){if(e.error)switch(e.error.code){case"RequestExpired":case"ExpiredTokenException":case"ExpiredToken":e.error.retryable=!0,e.request.service.config.credentials.expired=!0}}),e("EXPIRED_SIGNATURE","retry",function(e){var t=e.error;t&&"string"==typeof t.code&&"string"==typeof t.message&&t.code.match(/Signature/)&&t.message.match(/expired/)&&(e.error.retryable=!0)}),e("CLOCK_SKEWED","retry",function(e){e.error&&this.service.clockSkewError(e.error)&&this.service.config.correctClockSkew&&(e.error.retryable=!0)}),e("REDIRECT","retry",function(e){e.error&&300<=e.error.statusCode&&e.error.statusCode<400&&e.httpResponse.headers.location&&(this.httpRequest.endpoint=new u.Endpoint(e.httpResponse.headers.location),this.httpRequest.headers.Host=this.httpRequest.endpoint.host,e.error.redirect=!0,e.error.retryable=!0)}),e("RETRY_CHECK","retry",function(e){e.error&&(e.error.redirect&&e.redirectCount<e.maxRedirects?e.error.retryDelay=0:e.retryCount<e.maxRetries&&(e.error.retryDelay=this.service.retryDelays(e.retryCount)||0))}),t("RESET_RETRY_STATE","afterRetry",function(e,t){var n,o=!1;e.error&&(n=e.error.retryDelay||0,e.error.retryable&&e.retryCount<e.maxRetries?(e.retryCount++,o=!0):e.error.redirect&&e.redirectCount<e.maxRedirects&&(e.redirectCount++,o=!0)),o?(e.error=null,setTimeout(t,n)):t()})}),CorePost:(new n).addNamedListeners(function(e){e("EXTRACT_REQUEST_ID","extractData",u.util.extractRequestId),e("EXTRACT_REQUEST_ID","extractError",u.util.extractRequestId),e("ENOTFOUND_ERROR","httpError",function(e){var t;"NetworkingError"===e.code&&"ENOTFOUND"===e.errno&&(t="Inaccessible host: `"+e.hostname+"'. This service may not be available in the `"+e.region+"' region.",this.response.error=u.util.error(new Error(t),{code:"UnknownEndpoint",region:e.region,hostname:e.hostname,retryable:!0,originalError:e}))})}),Logger:(new n).addNamedListeners(function(e){e("LOG_REQUEST","complete",function(i){var e,s=i.request,c=s.service.config.logger;c&&(e=function(){var e=(i.request.service.getSkewCorrectedDate().getTime()-s.startTime.getTime())/1e3,t=!!c.isTTY,n=i.httpResponse.statusCode,o=s.params;s.service.api.operations&&s.service.api.operations[s.operation]&&s.service.api.operations[s.operation].input&&(o=function n(o,e){if(!e)return e;switch(o.type){case"structure":var r={};return u.util.each(e,function(e,t){Object.prototype.hasOwnProperty.call(o.members,e)?r[e]=n(o.members[e],t):r[e]=t}),r;case"list":var i=[];return u.util.arrayEach(e,function(e,t){i.push(n(o.member,e))}),i;case"map":var s={};return u.util.each(e,function(e,t){s[e]=n(o.value,t)}),s;default:return o.isSensitive?"***SensitiveInformation***":e}}(s.service.api.operations[s.operation].input,s.params));var r=a("util").inspect(o,!0,null),o="";return t&&(o+="[33m"),o+="[AWS "+s.service.serviceIdentifier+" "+n,o+=" "+e.toString()+"s "+i.retryCount+" retries]",t&&(o+="[0;1m"),o+=" "+u.util.string.lowerFirst(s.operation),o+="("+r+")",t&&(o+="[0m"),o}(),"function"==typeof c.log?c.log(e):"function"==typeof c.write&&c.write(e+"\n"))})}),Json:(new n).addNamedListeners(function(e){var t=a("./protocol/json");e("BUILD","build",t.buildRequest),e("EXTRACT_DATA","extractData",t.extractData),e("EXTRACT_ERROR","extractError",t.extractError)}),Rest:(new n).addNamedListeners(function(e){var t=a("./protocol/rest");e("BUILD","build",t.buildRequest),e("EXTRACT_DATA","extractData",t.extractData),e("EXTRACT_ERROR","extractError",t.extractError)}),RestJson:(new n).addNamedListeners(function(e){var t=a("./protocol/rest_json");e("BUILD","build",t.buildRequest),e("EXTRACT_DATA","extractData",t.extractData),e("EXTRACT_ERROR","extractError",t.extractError)}),RestXml:(new n).addNamedListeners(function(e){var t=a("./protocol/rest_xml");e("BUILD","build",t.buildRequest),e("EXTRACT_DATA","extractData",t.extractData),e("EXTRACT_ERROR","extractError",t.extractError)}),Query:(new n).addNamedListeners(function(e){var t=a("./protocol/query");e("BUILD","build",t.buildRequest),e("EXTRACT_DATA","extractData",t.extractData),e("EXTRACT_ERROR","extractError",t.extractError)})}},{"./core":18,"./discover_endpoint":26,"./protocol/json":46,"./protocol/query":47,"./protocol/rest":48,"./protocol/rest_json":49,"./protocol/rest_xml":50,"./sequential_executor":58,util:97}],34:[function(e,t,n){var o=e("./core"),e=o.util.inherit;o.Endpoint=e({constructor:function(e,t){if(o.util.hideProperties(this,["slashes","auth","hash","search","query"]),null==e)throw new Error("Invalid endpoint: "+e);if("string"!=typeof e)return o.util.copy(e);e.match(/^http/)||(e=((t&&void 0!==t.sslEnabled?t:o.config).sslEnabled?"https":"http")+"://"+e),o.util.update(this,o.util.urlParse(e)),this.port?this.port=parseInt(this.port,10):this.port="https:"===this.protocol?443:80}}),o.HttpRequest=e({constructor:function(e,t){e=new o.Endpoint(e),this.method="POST",this.path=e.path||"/",this.headers={},this.body="",this.endpoint=e,this.region=t,this._userAgent="",this.setUserAgent()},setUserAgent:function(){this._userAgent=this.headers[this.getUserAgentHeaderName()]=o.util.userAgent()},getUserAgentHeaderName:function(){return(o.util.isBrowser()?"X-Amz-":"")+"User-Agent"},appendToUserAgent:function(e){"string"==typeof e&&e&&(this._userAgent+=" "+e),this.headers[this.getUserAgentHeaderName()]=this._userAgent},getUserAgent:function(){return this._userAgent},pathname:function(){return this.path.split("?",1)[0]},search:function(){var e=this.path.split("?",2)[1];return e?(e=o.util.queryStringParse(e),o.util.queryParamsToString(e)):""},updateEndpoint:function(e){e=new o.Endpoint(e);this.endpoint=e,this.path=e.path||"/"}}),o.HttpResponse=e({constructor:function(){this.statusCode=void 0,this.headers={},this.body=void 0,this.streaming=!1,this.stream=null},createUnbufferedStream:function(){return this.streaming=!0,this.stream}}),o.HttpClient=e({}),o.HttpClient.getInstance=function(){return void 0===this.singleton&&(this.singleton=new this),this.singleton}},{"./core":18}],35:[function(e,t,n){var l=e("../core"),p=e("events").EventEmitter;e("../http"),l.XHRClient=l.util.inherit({handleRequest:function(t,e,n,o){var r=this,i=t.endpoint,s=new p,c=i.protocol+"//"+i.hostname;80!==i.port&&443!==i.port&&(c+=":"+i.port),c+=t.path;var a=new XMLHttpRequest,u=!1;(t.stream=a).addEventListener("readystatechange",function(){try{if(0===a.status)return}catch(e){return}this.readyState>=this.HEADERS_RECEIVED&&!u&&(s.statusCode=a.status,s.headers=r.parseHeaders(a.getAllResponseHeaders()),s.emit("headers",s.statusCode,s.headers,a.statusText),u=!0),this.readyState===this.DONE&&r.finishRequest(a,s)},!1),a.upload.addEventListener("progress",function(e){s.emit("sendProgress",e)}),a.addEventListener("progress",function(e){s.emit("receiveProgress",e)},!1),a.addEventListener("timeout",function(){o(l.util.error(new Error("Timeout"),{code:"TimeoutError"}))},!1),a.addEventListener("error",function(){o(l.util.error(new Error("Network Failure"),{code:"NetworkingError"}))},!1),a.addEventListener("abort",function(){o(l.util.error(new Error("Request aborted"),{code:"RequestAbortedError"}))},!1),n(s),a.open(t.method,c,!1!==e.xhrAsync),l.util.each(t.headers,function(e,t){"Content-Length"!==e&&"User-Agent"!==e&&"Host"!==e&&a.setRequestHeader(e,t)}),e.timeout&&!1!==e.xhrAsync&&(a.timeout=e.timeout),e.xhrWithCredentials&&(a.withCredentials=!0);try{a.responseType="arraybuffer"}catch(e){}try{t.body?a.send(t.body):a.send()}catch(e){if(!t.body||"object"!=typeof t.body.buffer)throw e;a.send(t.body.buffer)}return s},parseHeaders:function(e){var n={};return l.util.arrayEach(e.split(/\r?\n/),function(e){var t=e.split(":",1)[0],e=e.substring(t.length+2);0<t.length&&(n[t.toLowerCase()]=e)}),n},finishRequest:function(e,t){if("arraybuffer"===e.responseType&&e.response)for(var n=e.response,o=new l.util.Buffer(n.byteLength),r=new Uint8Array(n),i=0;i<o.length;++i)o[i]=r[i];try{o||"string"!=typeof e.responseText||(o=new l.util.Buffer(e.responseText))}catch(e){}o&&t.emit("data",o),t.emit("end")}}),l.HttpClient.prototype=l.XHRClient.prototype,l.HttpClient.streamsApiVersion=1},{"../core":18,"../http":34,events:81}],36:[function(e,t,n){var l=e("../util");function o(){}function p(e,t){var n,o,r,i,s,c,a,u;if(t&&null!=e)switch(t.type){case"structure":return c=e,a=t,u={},l.each(c,function(e,t){var n=a.members[e];n&&"body"===n.location&&(e=n.isLocationName?n.name:e,void 0!==(n=p(t,n))&&(u[e]=n))}),u;case"map":return c=e,i=t,s={},l.each(c,function(e,t){t=p(t,i.value);void 0!==t&&(s[e]=t)}),s;case"list":return n=e,o=t,r=[],l.arrayEach(n,function(e){e=p(e,o.member);void 0!==e&&r.push(e)}),r;default:return n=e,t.toWireFormat(n)}}o.prototype.build=function(e,t){return JSON.stringify(p(e,t))},t.exports=o},{"../util":71}],37:[function(e,t,n){var i=e("../util");function o(){}function s(e,t){var n;if(t&&void 0!==e)switch(t.type){case"structure":return function(o,e){if(null==o)return;var r={},e=e.members;return i.each(e,function(e,t){var n=t.isLocationName?t.name:e;!Object.prototype.hasOwnProperty.call(o,n)||void 0!==(t=s(o[n],t))&&(r[e]=t)}),r}(e,t);case"map":return function(e,n){if(null==e)return;var o={};return i.each(e,function(e,t){t=s(t,n.value);o[e]=void 0===t?null:t}),o}(e,t);case"list":return function(e,t){if(null==e)return;var n=[];return i.arrayEach(e,function(e){e=s(e,t.member);void 0===e?n.push(null):n.push(e)}),n}(e,t);default:return n=e,t.toType(n)}}o.prototype.parse=function(e,t){return s(JSON.parse(e),t)},t.exports=o},{"../util":71}],38:[function(e,t,n){var r=e("./collection"),i=e("./operation"),s=e("./shape"),c=e("./paginator"),a=e("./resource_waiter"),u=e("../util"),l=u.property,p=u.memoizedProperty;t.exports=function(t,n){var o=this;t=t||{},(n=n||{}).api=this,t.metadata=t.metadata||{},l(this,"isApi",!0,!1),l(this,"apiVersion",t.metadata.apiVersion),l(this,"endpointPrefix",t.metadata.endpointPrefix),l(this,"signingName",t.metadata.signingName),l(this,"globalEndpoint",t.metadata.globalEndpoint),l(this,"signatureVersion",t.metadata.signatureVersion),l(this,"jsonVersion",t.metadata.jsonVersion),l(this,"targetPrefix",t.metadata.targetPrefix),l(this,"protocol",t.metadata.protocol),l(this,"timestampFormat",t.metadata.timestampFormat),l(this,"xmlNamespaceUri",t.metadata.xmlNamespace),l(this,"abbreviation",t.metadata.serviceAbbreviation),l(this,"fullName",t.metadata.serviceFullName),l(this,"serviceId",t.metadata.serviceId),p(this,"className",function(){var e=t.metadata.serviceAbbreviation||t.metadata.serviceFullName;return e?("ElasticLoadBalancing"===(e=e.replace(/^Amazon|AWS\s*|\(.*|\s+|\W+/g,""))&&(e="ELB"),e):null}),l(this,"operations",new r(t.operations,n,function(e,t){return new i(e,t,n)},u.string.lowerFirst,function(e,t){!0===t.endpointoperation&&l(o,"endpointOperation",u.string.lowerFirst(e))})),l(this,"shapes",new r(t.shapes,n,function(e,t){return s.create(t,n)})),l(this,"paginators",new r(t.paginators,n,function(e,t){return new c(e,t,n)})),l(this,"waiters",new r(t.waiters,n,function(e,t){return new a(e,t,n)},u.string.lowerFirst)),n.documentation&&(l(this,"documentation",t.documentation),l(this,"documentationUrl",t.documentationUrl))}},{"../util":71,"./collection":39,"./operation":40,"./paginator":41,"./resource_waiter":42,"./shape":43}],39:[function(e,t,n){var r=e("../util").memoizedProperty;function s(e,t,n,o){r(this,o(e),function(){return n(e,t)})}t.exports=function(e,t,n,o,r){for(var i in o=o||String,e)Object.prototype.hasOwnProperty.call(e,i)&&(s.call(this,i,e[i],n,o),r&&r(i,e[i]))}},{"../util":71}],40:[function(e,t,n){var i=e("./shape"),e=e("../util"),s=e.property,c=e.memoizedProperty;t.exports=function(e,n,o){var r=this;o=o||{},s(this,"name",n.name||e),s(this,"api",o.api,!1),n.http=n.http||{},s(this,"endpoint",n.endpoint),s(this,"httpMethod",n.http.method||"POST"),s(this,"httpPath",n.http.requestUri||"/"),s(this,"authtype",n.authtype||""),s(this,"endpointDiscoveryRequired",n.endpointdiscovery?n.endpointdiscovery.required?"REQUIRED":"OPTIONAL":"NULL"),c(this,"input",function(){return n.input?i.create(n.input,o):new i.create({type:"structure"},o)}),c(this,"output",function(){return n.output?i.create(n.output,o):new i.create({type:"structure"},o)}),c(this,"errors",function(){var e=[];if(!n.errors)return null;for(var t=0;t<n.errors.length;t++)e.push(i.create(n.errors[t],o));return e}),c(this,"paginator",function(){return o.api.paginators[e]}),o.documentation&&(s(this,"documentation",n.documentation),s(this,"documentationUrl",n.documentationUrl)),c(this,"idempotentMembers",function(){var e,t=[],n=r.input,o=n.members;if(!n.members)return t;for(e in o)o.hasOwnProperty(e)&&!0===o[e].isIdempotent&&t.push(e);return t}),c(this,"hasEventOutput",function(){return function(e){var t,n=e.members,o=e.payload;if(!e.members)return!1;if(o)return n[o].isEventStream;for(t in n)if(!n.hasOwnProperty(t)&&!0===n[t].isEventStream)return!0;return!1}(r.output)})}},{"../util":71,"./shape":43}],41:[function(e,t,n){var o=e("../util").property;t.exports=function(e,t){o(this,"inputToken",t.input_token),o(this,"limitKey",t.limit_key),o(this,"moreResults",t.more_results),o(this,"outputToken",t.output_token),o(this,"resultKey",t.result_key)}},{"../util":71}],42:[function(e,t,n){var r=e("../util"),i=r.property;t.exports=function(e,n,t){t=t||{},i(this,"name",e),i(this,"api",t.api,!1),n.operation&&i(this,"operation",r.string.lowerFirst(n.operation));var o=this;["type","description","delay","maxAttempts","acceptors"].forEach(function(e){var t=n[e];t&&i(o,e,t)})}},{"../util":71}],43:[function(e,t,n){var s=e("./collection"),o=e("../util");function c(e,t,n){null!=n&&o.property.apply(this,arguments)}function a(e,t){e.constructor.prototype[t]||o.memoizedProperty.apply(this,arguments)}function u(e,t,n){t=t||{},c(this,"shape",e.shape),c(this,"api",t.api,!1),c(this,"type",e.type),c(this,"enum",e.enum),c(this,"min",e.min),c(this,"max",e.max),c(this,"pattern",e.pattern),c(this,"location",e.location||this.location||"body"),c(this,"name",this.name||e.xmlName||e.queryName||e.locationName||n),c(this,"isStreaming",e.streaming||this.isStreaming||!1),c(this,"requiresLength",e.requiresLength,!1),c(this,"isComposite",e.isComposite||!1),c(this,"isShape",!0,!1),c(this,"isQueryName",Boolean(e.queryName),!1),c(this,"isLocationName",Boolean(e.locationName),!1),c(this,"isIdempotent",!0===e.idempotencyToken),c(this,"isJsonValue",!0===e.jsonvalue),c(this,"isSensitive",!0===e.sensitive||e.prototype&&!0===e.prototype.sensitive),c(this,"isEventStream",Boolean(e.eventstream),!1),c(this,"isEvent",Boolean(e.event),!1),c(this,"isEventPayload",Boolean(e.eventpayload),!1),c(this,"isEventHeader",Boolean(e.eventheader),!1),c(this,"isTimestampFormatSet",Boolean(e.timestampFormat)||e.prototype&&!0===e.prototype.isTimestampFormatSet,!1),c(this,"endpointDiscoveryId",Boolean(e.endpointdiscoveryid),!1),c(this,"hostLabel",Boolean(e.hostLabel),!1),t.documentation&&(c(this,"documentation",e.documentation),c(this,"documentationUrl",e.documentationUrl)),e.xmlAttribute&&c(this,"isXmlAttribute",e.xmlAttribute||!1),c(this,"defaultValue",null),this.toWireFormat=function(e){return null==e?"":e},this.toType=function(e){return e}}function l(e){u.apply(this,arguments),c(this,"isComposite",!0),e.flattened&&c(this,"flattened",e.flattened||!1)}function r(n,o){var i=this,r=null,e=!this.isShape;l.apply(this,arguments),e&&(c(this,"defaultValue",function(){return{}}),c(this,"members",{}),c(this,"memberNames",[]),c(this,"required",[]),c(this,"isRequired",function(){return!1})),n.members&&(c(this,"members",new s(n.members,o,function(e,t){return u.create(t,o,e)})),a(this,"memberNames",function(){return n.xmlOrder||Object.keys(n.members)}),n.event&&(a(this,"eventPayloadMemberName",function(){for(var e=i.members,t=i.memberNames,n=0,o=t.length;n<o;n++)if(e[t[n]].isEventPayload)return t[n]}),a(this,"eventHeaderMemberNames",function(){for(var e=i.members,t=i.memberNames,n=[],o=0,r=t.length;o<r;o++)e[t[o]].isEventHeader&&n.push(t[o]);return n}))),n.required&&(c(this,"required",n.required),c(this,"isRequired",function(e){if(!r){r={};for(var t=0;t<n.required.length;t++)r[n.required[t]]=!0}return r[e]},!1,!0)),c(this,"resultWrapper",n.resultWrapper||null),n.payload&&c(this,"payload",n.payload),"string"==typeof n.xmlNamespace?c(this,"xmlNamespaceUri",n.xmlNamespace):"object"==typeof n.xmlNamespace&&(c(this,"xmlNamespacePrefix",n.xmlNamespace.prefix),c(this,"xmlNamespaceUri",n.xmlNamespace.uri))}function i(e,t){var n,o=this,r=!this.isShape;l.apply(this,arguments),r&&c(this,"defaultValue",function(){return[]}),e.member&&a(this,"member",function(){return u.create(e.member,t)}),this.flattened&&(n=this.name,a(this,"name",function(){return o.member.name||n}))}function p(e,t){var n=!this.isShape;l.apply(this,arguments),n&&(c(this,"defaultValue",function(){return{}}),c(this,"key",u.create({type:"string"},t)),c(this,"value",u.create({type:"string"},t))),e.key&&a(this,"key",function(){return u.create(e.key,t)}),e.value&&a(this,"value",function(){return u.create(e.value,t)})}function h(){u.apply(this,arguments);var t=["rest-xml","query","ec2"];this.toType=function(e){return e=this.api&&-1<t.indexOf(this.api.protocol)?e||"":e,this.isJsonValue?JSON.parse(e):e&&"function"==typeof e.toString?e.toString():e},this.toWireFormat=function(e){return this.isJsonValue?JSON.stringify(e):e}}function d(){u.apply(this,arguments),this.toType=function(e){var t=o.base64.decode(e);return this.isSensitive&&o.isNode()&&"function"==typeof o.Buffer.alloc&&(e=o.Buffer.alloc(t.length,t),t.fill(0),t=e),t},this.toWireFormat=o.base64.encode}function f(){d.apply(this,arguments)}function g(){u.apply(this,arguments),this.toType=function(e){return"boolean"==typeof e?e:null==e?null:"true"===e}}u.normalizedTypes={character:"string",double:"float",long:"integer",short:"integer",biginteger:"integer",bigdecimal:"float",blob:"binary"},u.types={structure:r,list:i,map:p,boolean:g,timestamp:function(e){var t=this;if(u.apply(this,arguments),e.timestampFormat)c(this,"timestampFormat",e.timestampFormat);else if(t.isTimestampFormatSet&&this.timestampFormat)c(this,"timestampFormat",this.timestampFormat);else if("header"===this.location)c(this,"timestampFormat","rfc822");else if("querystring"===this.location)c(this,"timestampFormat","iso8601");else if(this.api)switch(this.api.protocol){case"json":case"rest-json":c(this,"timestampFormat","unixTimestamp");break;case"rest-xml":case"query":case"ec2":c(this,"timestampFormat","iso8601")}this.toType=function(e){return null==e?null:"function"==typeof e.toUTCString?e:"string"==typeof e||"number"==typeof e?o.date.parseTimestamp(e):null},this.toWireFormat=function(e){return o.date.format(e,t.timestampFormat)}},float:function(){u.apply(this,arguments),this.toType=function(e){return null==e?null:parseFloat(e)},this.toWireFormat=this.toType},integer:function(){u.apply(this,arguments),this.toType=function(e){return null==e?null:parseInt(e,10)},this.toWireFormat=this.toType},string:h,base64:f,binary:d},u.resolve=function(e,t){if(e.shape){t=t.api.shapes[e.shape];if(!t)throw new Error("Cannot find shape reference: "+e.shape);return t}return null},u.create=function(e,t,n){if(e.isShape)return e;var o=u.resolve(e,t);if(o){var r=Object.keys(e);t.documentation||(r=r.filter(function(e){return!e.match(/documentation/)}));r=function(){o.constructor.call(this,e,t,n)};return r.prototype=o,new r}e.type||(e.members?e.type="structure":e.member?e.type="list":e.key?e.type="map":e.type="string");r=e.type;if(u.normalizedTypes[e.type]&&(e.type=u.normalizedTypes[e.type]),u.types[e.type])return new u.types[e.type](e,t,n);throw new Error("Unrecognized shape type: "+r)},u.shapes={StructureShape:r,ListShape:i,MapShape:p,StringShape:h,BooleanShape:g,Base64Shape:f},t.exports=u},{"../util":71,"./collection":39}],44:[function(e,t,n){var a=e("./core");a.ParamValidator=a.util.inherit({constructor:function(e){!0!==e&&void 0!==e||(e={min:!0}),this.validation=e},validate:function(e,t,n){if(this.errors=[],this.validateMember(e,t||{},n||"params"),1<this.errors.length){n=this.errors.join("\n* "),n="There were "+this.errors.length+" validation errors:\n* "+n;throw a.util.error(new Error(n),{code:"MultipleValidationErrors",errors:this.errors})}if(1===this.errors.length)throw this.errors[0];return!0},fail:function(e,t){this.errors.push(a.util.error(new Error(t),{code:e}))},validateStructure:function(e,t,n){this.validateType(t,n,["object"],"structure");for(var o,r,i,s=0;e.required&&s<e.required.length;s++){var c=t[a=e.required[s]];null==c&&this.fail("MissingRequiredParameter","Missing required key '"+a+"' in "+n)}for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(o=t[a],void 0!==(r=e.members[a])?(i=[n,a].join("."),this.validateMember(r,o,i)):this.fail("UnexpectedParameter","Unexpected key '"+a+"' found in "+n));return!0},validateMember:function(e,t,n){switch(e.type){case"structure":return this.validateStructure(e,t,n);case"list":return this.validateList(e,t,n);case"map":return this.validateMap(e,t,n);default:return this.validateScalar(e,t,n)}},validateList:function(e,t,n){if(this.validateType(t,n,[Array])){this.validateRange(e,t.length,n,"list member count");for(var o=0;o<t.length;o++)this.validateMember(e.member,t[o],n+"["+o+"]")}},validateMap:function(e,t,n){if(this.validateType(t,n,["object"],"map")){var o,r=0;for(o in t)Object.prototype.hasOwnProperty.call(t,o)&&(this.validateMember(e.key,o,n+"[key='"+o+"']"),this.validateMember(e.value,t[o],n+"['"+o+"']"),r++);this.validateRange(e,r,n,"map member count")}},validateScalar:function(e,t,n){switch(e.type){case null:case void 0:case"string":return this.validateString(e,t,n);case"base64":case"binary":return this.validatePayload(t,n);case"integer":case"float":return this.validateNumber(e,t,n);case"boolean":return this.validateType(t,n,["boolean"]);case"timestamp":return this.validateType(t,n,[Date,/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?Z$/,"number"],"Date object, ISO-8601 string, or a UNIX timestamp");default:return this.fail("UnkownType","Unhandled type "+e.type+" for "+n)}},validateString:function(e,t,n){var o=["string"];e.isJsonValue&&(o=o.concat(["number","object","boolean"])),null!==t&&this.validateType(t,n,o)&&(this.validateEnum(e,t,n),this.validateRange(e,t.length,n,"string length"),this.validatePattern(e,t,n),this.validateUri(e,t,n))},validateUri:function(e,t,n){"uri"===e.location&&0===t.length&&this.fail("UriParameterError",'Expected uri parameter to have length >= 1, but found "'+t+'" for '+n)},validatePattern:function(e,t,n){this.validation.pattern&&void 0!==e.pattern&&(new RegExp(e.pattern).test(t)||this.fail("PatternMatchError",'Provided value "'+t+'" does not match regex pattern /'+e.pattern+"/ for "+n))},validateRange:function(e,t,n,o){this.validation.min&&void 0!==e.min&&t<e.min&&this.fail("MinRangeError","Expected "+o+" >= "+e.min+", but found "+t+" for "+n),this.validation.max&&void 0!==e.max&&t>e.max&&this.fail("MaxRangeError","Expected "+o+" <= "+e.max+", but found "+t+" for "+n)},validateEnum:function(e,t,n){this.validation.enum&&void 0!==e.enum&&-1===e.enum.indexOf(t)&&this.fail("EnumError","Found string value of "+t+", but expected "+e.enum.join("|")+" for "+n)},validateType:function(e,t,n,o){if(null==e)return!1;for(var r=!1,i=0;i<n.length;i++){if("string"==typeof n[i]){if(typeof e===n[i])return!0}else if(n[i]instanceof RegExp){if((e||"").toString().match(n[i]))return!0}else{if(e instanceof n[i])return!0;if(a.util.isType(e,n[i]))return!0;o||r||(n=n.slice()),n[i]=a.util.typeName(n[i])}r=!0}var s=o,c=(s=s||n.join(", ").replace(/,([^,]+)$/,", or$1")).match(/^[aeiou]/i)?"n":"";return this.fail("InvalidParameterType","Expected "+t+" to be a"+c+" "+s),!1},validateNumber:function(e,t,n){var o;null!=t&&("string"!=typeof t||(o=parseFloat(t)).toString()===t&&(t=o),this.validateType(t,n,["number"])&&this.validateRange(e,t,n,"numeric value"))},validatePayload:function(e,t){if(null!=e&&"string"!=typeof e&&(!e||"number"!=typeof e.byteLength)){if(a.util.isNode()){var n=a.util.stream.Stream;if(a.util.Buffer.isBuffer(e)||e instanceof n)return}else if(e instanceof Blob)return;var o=["Buffer","Stream","File","Blob","ArrayBuffer","DataView"];if(e)for(var r=0;r<o.length;r++){if(a.util.isType(e,o[r]))return;if(a.util.typeName(e.constructor)===o[r])return}this.fail("InvalidParameterType","Expected "+t+" to be a string, Buffer, Stream, Blob, or typed array object")}}})},{"./core":18}],45:[function(e,t,n){var c=e("../util"),a=e("../core");t.exports={populateHostPrefix:function(e){if(!e.service.config.hostPrefixEnabled)return e;var t,n,o,r,i,s=e.service.api.operations[e.operation];return t=(i=(t=e).service.api).operations[t.operation],i=i.endpointOperation&&i.endpointOperation===c.string.lowerFirst(t.name),"NULL"!==t.endpointDiscoveryRequired||!0===i||s.endpoint&&s.endpoint.hostPrefix&&(i=s.endpoint.hostPrefix,o=i,r=e.params,i=s.input,c.each(i.members,function(e,t){if(!0===t.hostLabel){if("string"!=typeof r[e]||""===r[e])throw c.error(new Error,{message:"Parameter "+e+" should be a non-empty string.",code:"InvalidParameter"});t=new RegExp("\\{"+e+"\\}","g");o=o.replace(t,r[e])}}),s=o,i=e.httpRequest.endpoint,s=s,i.host&&(i.host=s+i.host),i.hostname&&(i.hostname=s+i.hostname),i=(i=e.httpRequest.endpoint.hostname).split("."),n=/^[a-zA-Z0-9]{1}$|^[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9]$/,c.arrayEach(i,function(e){if(!e.length||e.length<1||63<e.length)throw c.error(new Error,{code:"ValidationError",message:"Hostname label length should be between 1 to 63 characters, inclusive."});if(!n.test(e))throw a.util.error(new Error,{code:"ValidationError",message:e+" is not hostname compatible."})})),e}}},{"../core":18,"../util":71}],46:[function(e,t,n){var r=e("../util"),s=e("../json/builder"),i=e("../json/parser"),c=e("./helpers").populateHostPrefix;t.exports={buildRequest:function(e){var t=e.httpRequest,n=(i=e.service.api).targetPrefix+"."+i.operations[e.operation].name,o=i.jsonVersion||"1.0",r=i.operations[e.operation].input,i=new s;1===o&&(o="1.0"),t.body=i.build(e.params||{},r),t.headers["Content-Type"]="application/x-amz-json-"+o,t.headers["X-Amz-Target"]=n,c(e)},extractError:function(e){var t={},n=e.httpResponse;if(t.code=n.headers["x-amzn-errortype"]||"UnknownError","string"==typeof t.code&&(t.code=t.code.split(":")[0]),0<n.body.length)try{var o=JSON.parse(n.body.toString());(o.__type||o.code)&&(t.code=(o.__type||o.code).split("#").pop()),"RequestEntityTooLarge"===t.code?t.message="Request body must be less than 1 MB":t.message=o.message||o.Message||null}catch(o){t.statusCode=n.statusCode,t.message=n.statusMessage}else t.statusCode=n.statusCode,t.message=n.statusCode.toString();e.error=r.error(new Error,t)},extractData:function(e){var t,n,o=e.httpResponse.body.toString()||"{}";!1===e.request.service.config.convertResponseTypes?e.data=JSON.parse(o):(t=e.request.service.api.operations[e.request.operation].output||{},n=new i,e.data=n.parse(o,t))}}},{"../json/builder":36,"../json/parser":37,"../util":71,"./helpers":45}],47:[function(e,t,n){var i=e("../core"),s=e("../util"),o=e("../query/query_param_serializer"),c=e("../model/shape"),r=e("./helpers").populateHostPrefix;t.exports={buildRequest:function(e){var t=e.service.api.operations[e.operation],n=e.httpRequest;n.headers["Content-Type"]="application/x-www-form-urlencoded; charset=utf-8",n.params={Version:e.service.api.apiVersion,Action:t.name},(new o).serialize(e.params,t.input,function(e,t){n.params[e]=t}),n.body=s.queryParamsToString(n.params),r(e)},extractError:function(t){var n,e=t.httpResponse.body.toString();if(e.match("<UnknownOperationException"))n={Code:"UnknownOperation",Message:"Unknown operation "+t.request.operation};else try{n=(new i.XML.Parser).parse(e)}catch(e){n={Code:t.httpResponse.statusCode,Message:t.httpResponse.statusMessage}}n.requestId&&!t.requestId&&(t.requestId=n.requestId),n.Errors&&(n=n.Errors),n.Error&&(n=n.Error),n.Code?t.error=s.error(new Error,{code:n.Code,message:n.Message}):t.error=s.error(new Error,{code:t.httpResponse.statusCode,message:null})},extractData:function(e){var t=(r=e.request).service.api.operations[r.operation].output||{},n=t;n.resultWrapper&&((o=c.create({type:"structure"})).members[n.resultWrapper]=t,o.memberNames=[n.resultWrapper],s.property(t,"name",t.resultWrapper),t=o);var o,r=new i.XML.Parser;t&&t.members&&!t.members._XAMZRequestId&&(o=c.create({type:"string"},{api:{protocol:"query"}},"requestId"),t.members._XAMZRequestId=o),t=r.parse(e.httpResponse.body.toString(),t),e.requestId=t._XAMZRequestId||t.requestId,t._XAMZRequestId&&delete t._XAMZRequestId,n.resultWrapper&&t[n.resultWrapper]&&(s.update(t,t[n.resultWrapper]),delete t[n.resultWrapper]),e.data=t}}},{"../core":18,"../model/shape":43,"../query/query_param_serializer":51,"../util":71,"./helpers":45}],48:[function(e,t,n){var a=e("../util"),i=e("./helpers").populateHostPrefix;function s(e,t,n,o){var r,i=(i=[e,t].join("/")).replace(/\/+/g,"/"),s={},c=!1;return a.each(n.members,function(e,t){var n=o[e];null!=n&&("uri"===t.location?(e=new RegExp("\\{"+t.name+"(\\+)?\\}"),i=i.replace(e,function(e,t){return(t?a.uriEscapePath:a.uriEscape)(String(n))})):"querystring"===t.location&&(c=!0,"list"===t.type?s[t.name]=n.map(function(e){return a.uriEscape(t.member.toWireFormat(e).toString())}):"map"===t.type?a.each(n,function(e,t){Array.isArray(t)?s[e]=t.map(function(e){return a.uriEscape(String(e))}):s[e]=a.uriEscape(String(t))}):s[t.name]=a.uriEscape(t.toWireFormat(n).toString())))}),c&&(i+=0<=i.indexOf("?")?"&":"?",r=[],a.arrayEach(Object.keys(s).sort(),function(e){Array.isArray(s[e])||(s[e]=[s[e]]);for(var t=0;t<s[e].length;t++)r.push(a.uriEscape(String(e))+"="+s[e][t])}),i+=r.join("&")),i}t.exports={buildRequest:function(e){var t,n,o,r;(r=e).httpRequest.method=r.service.api.operations[r.operation].httpMethod,n=(t=e).service.api.operations[t.operation],r=n.input,r=s(t.httpRequest.endpoint.path,n.httpPath,r,t.params),t.httpRequest.path=r,r=(o=e).service.api.operations[o.operation],a.each(r.input.members,function(e,n){e=o.params[e];null!=e&&("headers"===n.location&&"map"===n.type?a.each(e,function(e,t){o.httpRequest.headers[n.name+e]=t}):"header"===n.location&&(e=n.toWireFormat(e).toString(),n.isJsonValue&&(e=a.base64.encode(e)),o.httpRequest.headers[n.name]=e))}),i(e)},extractError:function(){},extractData:function(e){var t=e.request,i={},s=e.httpResponse,t=t.service.api.operations[t.operation].output,c={};a.each(s.headers,function(e,t){c[e.toLowerCase()]=t}),a.each(t.members,function(n,e){var t,o,r=(e.name||n).toLowerCase();"headers"===e.location&&"map"===e.type?(i[n]={},t=e.isLocationName?e.name:"",o=new RegExp("^"+t+"(.+)","i"),a.each(s.headers,function(e,t){e=e.match(o);null!==e&&(i[n][e[1]]=t)})):"header"===e.location?void 0!==c[r]&&(r=e.isJsonValue?a.base64.decode(c[r]):c[r],i[n]=e.toType(r)):"statusCode"===e.location&&(i[n]=parseInt(s.statusCode,10))}),e.data=i},generateURI:s}},{"../util":71,"./helpers":45}],49:[function(e,t,n){var i=e("../util"),s=e("./rest"),c=e("./json"),a=e("../json/builder"),u=e("../json/parser");function l(e,t){e.service.api.operations[e.operation].input;e.httpRequest.headers["Content-Type"]||(t=t?"binary/octet-stream":"application/json",e.httpRequest.headers["Content-Type"]=t)}t.exports={buildRequest:function(e){var t,n,o,r;s.buildRequest(e),["HEAD","DELETE"].indexOf(e.httpRequest.method)<0&&(t=e,o=new a,(r=t.service.api.operations[t.operation].input).payload?(n={},e=r.members[r.payload],void 0!==(n=t.params[r.payload])&&("structure"===e.type?(t.httpRequest.body=o.build(n,e),l(t)):(t.httpRequest.body=n,"binary"!==e.type&&!e.isStreaming||l(t,!0)))):("{}"===(r=o.build(t.params,r))&&"GET"===t.httpRequest.method||(t.httpRequest.body=r),l(t)))},extractError:function(e){c.extractError(e)},extractData:function(e){s.extractData(e);var t,n,o=(r=e.request).service.api.operations[r.operation],r=r.service.api.operations[r.operation].output||{};o.hasEventOutput,r.payload?(o=r.members[r.payload],n=e.httpResponse.body,o.isEventStream?(t=new u,e.data[payload]=i.createEventStream(2===AWS.HttpClient.streamsApiVersion?e.httpResponse.stream:n,t,o)):"structure"===o.type||"list"===o.type?(t=new u,e.data[r.payload]=t.parse(n,o)):"binary"===o.type||o.isStreaming?e.data[r.payload]=n:e.data[r.payload]=o.toType(n)):(n=e.data,c.extractData(e),e.data=i.merge(n,e.data))}}},{"../json/builder":36,"../json/parser":37,"../util":71,"./json":46,"./rest":48}],50:[function(e,t,n){var s=e("../core"),c=e("../util"),a=e("./rest");t.exports={buildRequest:function(e){var t,n,o,r,i;a.buildRequest(e),["GET","HEAD"].indexOf(e.httpRequest.method)<0&&(n=(t=e).service.api.operations[t.operation].input,o=new s.XML.Builder,r=t.params,(i=n.payload)?(e=n.members[i],void 0!==(r=r[i])&&("structure"===e.type?(i=e.name,t.httpRequest.body=o.toXML(r,e,i,!0)):t.httpRequest.body=r)):t.httpRequest.body=o.toXML(r,n,n.name||n.shape||c.string.upperFirst(t.operation)+"Request"))},extractError:function(t){var n;a.extractError(t);try{n=(new s.XML.Parser).parse(t.httpResponse.body.toString())}catch(e){n={Code:t.httpResponse.statusCode,Message:t.httpResponse.statusMessage}}n.Errors&&(n=n.Errors),n.Error&&(n=n.Error),n.Code?t.error=c.error(new Error,{code:n.Code,message:n.Message}):t.error=c.error(new Error,{code:t.httpResponse.statusCode,message:null})},extractData:function(e){var t;a.extractData(e);var n=e.request,o=e.httpResponse.body,r=n.service.api.operations[n.operation],i=r.output;(n=(r.hasEventOutput,i.payload))?(r=i.members[n]).isEventStream?(t=new s.XML.Parser,e.data[n]=c.createEventStream(2===s.HttpClient.streamsApiVersion?e.httpResponse.stream:e.httpResponse.body,t,r)):"structure"===r.type?(t=new s.XML.Parser,e.data[n]=t.parse(o.toString(),r)):"binary"===r.type||r.isStreaming?e.data[n]=o:e.data[n]=r.toType(o):0<o.length&&(i=(t=new s.XML.Parser).parse(o.toString(),i),c.update(e.data,i))}}},{"../core":18,"../util":71,"./rest":48}],51:[function(e,t,n){var u=e("../util");function o(){}function l(e){return e.isQueryName||"ec2"!==e.api.protocol?e.name:e.name[0].toUpperCase()+e.name.substr(1)}function p(o,r,e,i){u.each(e.members,function(e,t){var n=r[e];null!=n&&(e=l(t),h(e=o?o+"."+e:e,n,t,i))})}function h(e,t,n,o){var r,i,s,c,a;null!=t&&("structure"===n.type?p(e,t,n,o):"list"===n.type?function(o,e,r,i){var s=r.member||{};0!==e.length?u.arrayEach(e,function(e,t){var n="."+(t+1);"ec2"===r.api.protocol?n+="":r.flattened?s.name&&((t=o.split(".")).pop(),t.push(l(s)),o=t.join(".")):n="."+(s.name||"member")+n,h(o+n,e,s,i)}):i.call(this,o,null)}(e,t,n,o):"map"===n.type?(r=e,i=t,s=n,c=o,a=1,u.each(i,function(e,t){var n=(s.flattened?".":".entry.")+a+++".",o=n+(s.key.name||"key"),n=n+(s.value.name||"value");h(r+o,e,s.key,c),h(r+n,t,s.value,c)})):o(e,n.toWireFormat(t).toString()))}o.prototype.serialize=function(e,t,n){p("",e,t,n)},t.exports=o},{"../util":71}],52:[function(e,t,n){t.exports={now:function(){return("undefined"!=typeof performance&&"function"==typeof performance.now?performance:Date).now()}}},{}],53:[function(e,t,n){var a=e("./util"),u=e("./region_config_data.json");t.exports=function(e){for(var t,n,o,r=(n=(t=e).config.region,o=!(o=n)||(o=o.split("-")).length<3?null:o.slice(0,o.length-2).join("-")+"-*",t=t.api.endpointPrefix,[[n,t],[o,t],[n,"*"],[o,"*"],["*",t],["*","*"]].map(function(e){return e[0]&&e[1]?e.join("/"):null})),i=0;i<r.length;i++){var s=r[i];if(s&&Object.prototype.hasOwnProperty.call(u.rules,s)){var c=u.rules[s];return"string"==typeof c&&(c=u.patterns[c]),e.config.useDualstack&&a.isDualstackAvailable(e)&&((c=a.copy(c)).endpoint="{service}.dualstack.{region}.amazonaws.com"),e.isGlobalEndpoint=!!c.globalEndpoint,c.signatureVersion||(c.signatureVersion="v4"),void function(n){a.each(c,function(e,t){"globalEndpoint"!==e&&(void 0!==n.config[e]&&null!==n.config[e]||(n.config[e]=t))})}(e)}}}},{"./region_config_data.json":54,"./util":71}],54:[function(e,t,n){t.exports={rules:{"*/*":{endpoint:"{service}.{region}.amazonaws.com"},"cn-*/*":{endpoint:"{service}.{region}.amazonaws.com.cn"},"*/budgets":"globalSSL","*/cloudfront":"globalSSL","*/iam":"globalSSL","*/sts":"globalSSL","*/importexport":{endpoint:"{service}.amazonaws.com",signatureVersion:"v2",globalEndpoint:!0},"*/route53":{endpoint:"https://{service}.amazonaws.com",signatureVersion:"v3https",globalEndpoint:!0},"*/waf":"globalSSL","us-gov-*/iam":"globalGovCloud","us-gov-*/sts":{endpoint:"{service}.{region}.amazonaws.com"},"us-gov-west-1/s3":"s3signature","us-west-1/s3":"s3signature","us-west-2/s3":"s3signature","eu-west-1/s3":"s3signature","ap-southeast-1/s3":"s3signature","ap-southeast-2/s3":"s3signature","ap-northeast-1/s3":"s3signature","sa-east-1/s3":"s3signature","us-east-1/s3":{endpoint:"{service}.amazonaws.com",signatureVersion:"s3"},"us-east-1/sdb":{endpoint:"{service}.amazonaws.com",signatureVersion:"v2"},"*/sdb":{endpoint:"{service}.{region}.amazonaws.com",signatureVersion:"v2"}},patterns:{globalSSL:{endpoint:"https://{service}.amazonaws.com",globalEndpoint:!0},globalGovCloud:{endpoint:"{service}.us-gov.amazonaws.com"},s3signature:{endpoint:"{service}.{region}.amazonaws.com",signatureVersion:"s3"}}}},{}],55:[function(n,e,t){(function(t){var p=n("./core"),s=n("./state_machine"),e=p.util.inherit,c=p.util.domain,i=n("jmespath"),r={success:1,error:1,complete:1};var a=new s;a.setupStates=function(){function e(e,n){var o=this;o._haltHandlersOnError=!1,o.emit(o._asm.currentState,function(e){if(e)if(t=o,Object.prototype.hasOwnProperty.call(r,t._asm.currentState)){if(!(c&&o.domain instanceof c.Domain))throw e;e.domainEmitter=o,e.domain=o.domain,e.domainThrown=!1,o.domain.emit("error",e)}else o.response.error=e,n(e);else n(o.response.error);var t})}this.addState("validate","build","error",e),this.addState("build","afterBuild","restart",e),this.addState("afterBuild","sign","restart",e),this.addState("sign","send","retry",e),this.addState("retry","afterRetry","afterRetry",e),this.addState("afterRetry","sign","error",e),this.addState("send","validateResponse","retry",e),this.addState("validateResponse","extractData","extractError",e),this.addState("extractError","extractData","retry",e),this.addState("extractData","success","retry",e),this.addState("restart","build","error",e),this.addState("success","complete","complete",e),this.addState("error","complete","complete",e),this.addState("complete",null,null,e)},a.setupStates(),p.Request=e({constructor:function(e,t,n){var o=e.endpoint,r=e.config.region,i=e.config.customUserAgent;e.isGlobalEndpoint&&(r="us-east-1"),this.domain=c&&c.active,this.service=e,this.operation=t,this.params=n||{},this.httpRequest=new p.HttpRequest(o,r),this.httpRequest.appendToUserAgent(i),this.startTime=e.getSkewCorrectedDate(),this.response=new p.Response(this),this._asm=new s(a.states,"validate"),this._haltHandlersOnError=!1,p.SequentialExecutor.call(this),this.emit=this.emitEvent},send:function(t){return t&&(this.httpRequest.appendToUserAgent("callback"),this.on("complete",function(e){t.call(e,e.error,e.data)})),this.runTo(),this.response},build:function(e){return this.runTo("send",e)},runTo:function(e,t){return this._asm.runTo(e,t,this),this},abort:function(){return this.removeAllListeners("validateResponse"),this.removeAllListeners("extractError"),this.on("validateResponse",function(e){e.error=p.util.error(new Error("Request aborted by user"),{code:"RequestAbortedError",retryable:!1})}),this.httpRequest.stream&&!this.httpRequest.stream.didCallback&&(this.httpRequest.stream.abort(),this.httpRequest._abortCallback?this.httpRequest._abortCallback():this.removeAllListeners("send")),this},eachPage:function(o){o=p.util.fn.makeAsync(o,3),this.on("complete",function t(n){o.call(n,n.error,n.data,function(e){!1!==e&&(n.hasNextPage()?n.nextPage().on("complete",t).send():o.call(n,null,null,p.util.fn.noop))})}).send()},eachItem:function(o){var r=this;this.eachPage(function(e,t){if(e)return o(e,null);if(null===t)return o(null,null);e=r.service.paginationConfig(r.operation).resultKey,Array.isArray(e)&&(e=e[0]);var e=i.search(t,e),n=!0;return p.util.arrayEach(e,function(e){if(!1===(n=o(null,e)))return p.util.abort}),n})},isPageable:function(){return!!this.service.paginationConfig(this.operation)},createReadStream:function(){var a=p.util.stream,u=this,l=null;return 2===p.HttpClient.streamsApiVersion?(l=new a.PassThrough,t.nextTick(function(){u.send()})):((l=new a.Stream).readable=!0,l.sent=!1,l.on("newListener",function(e){l.sent||"data"!==e||(l.sent=!0,t.nextTick(function(){u.send()}))})),this.on("error",function(e){l.emit("error",e)}),this.on("httpHeaders",function(e,t,n){var o,r,i,s,c;e<300&&(u.removeListener("httpData",p.EventListeners.Core.HTTP_DATA),u.removeListener("httpError",p.EventListeners.Core.HTTP_ERROR),u.on("httpError",function(e){n.error=e,n.error.retryable=!1}),o=!1,"HEAD"!==u.httpRequest.method&&(r=parseInt(t["content-length"],10)),void 0!==r&&!isNaN(r)&&0<=r&&(o=!0,i=0),t=function(){o&&i!==r?l.emit("error",p.util.error(new Error("Stream content length mismatch. Received "+i+" of "+r+" bytes."),{code:"StreamContentLengthMismatch"})):2===p.HttpClient.streamsApiVersion?l.end():l.emit("end")},s=n.httpResponse.createUnbufferedStream(),2===p.HttpClient.streamsApiVersion?o?((c=new a.PassThrough)._write=function(e){return e&&e.length&&(i+=e.length),a.PassThrough.prototype._write.apply(this,arguments)},c.on("end",t),l.on("error",function(e){o=!1,s.unpipe(c),c.emit("end"),c.end()}),s.pipe(c).pipe(l,{end:!1})):s.pipe(l):(o&&s.on("data",function(e){e&&e.length&&(i+=e.length)}),s.on("data",function(e){l.emit("data",e)}),s.on("end",t)),s.on("error",function(e){o=!1,l.emit("error",e)}))}),l},emitEvent:function(e,t,n){"function"==typeof t&&(n=t,t=null),n=n||function(){},t=t||this.eventParameters(e,this.response),p.SequentialExecutor.prototype.emit.call(this,e,t,function(e){e&&(this.response.error=e),n.call(this,e)})},eventParameters:function(e){switch(e){case"restart":case"validate":case"sign":case"build":case"afterValidate":case"afterBuild":return[this];case"error":return[this.response.error,this.response];default:return[this.response]}},presign:function(e,t){return t||"function"!=typeof e||(t=e,e=null),(new p.Signers.Presign).sign(this.toGet(),e,t)},isPresigned:function(){return Object.prototype.hasOwnProperty.call(this.httpRequest.headers,"presigned-expires")},toUnauthenticated:function(){return this._unAuthenticated=!0,this.removeListener("validate",p.EventListeners.Core.VALIDATE_CREDENTIALS),this.removeListener("sign",p.EventListeners.Core.SIGN),this},toGet:function(){return"query"!==this.service.api.protocol&&"ec2"!==this.service.api.protocol||(this.removeListener("build",this.buildAsGet),this.addListener("build",this.buildAsGet)),this},buildAsGet:function(e){e.httpRequest.method="GET",e.httpRequest.path=e.service.endpoint.path+"?"+e.httpRequest.body,e.httpRequest.body="",delete e.httpRequest.headers["Content-Length"],delete e.httpRequest.headers["Content-Type"]},haltHandlersOnError:function(){this._haltHandlersOnError=!0}}),p.Request.addPromisesToClass=function(t){this.prototype.promise=function(){var e=this;return this.httpRequest.appendToUserAgent("promise"),new t(function(t,n){e.on("complete",function(e){e.error?n(e.error):t(Object.defineProperty(e.data||{},"$response",{value:e}))}),e.runTo()})}},p.Request.deletePromisesFromClass=function(){delete this.prototype.promise},p.util.addPromises(p.Request),p.util.mixin(p.Request,p.SequentialExecutor)}).call(this,n("_process"))},{"./core":18,"./state_machine":70,_process:85,jmespath:84}],56:[function(e,t,n){var o=e("./core"),r=o.util.inherit,s=e("jmespath");function i(n){var o=n.request._waiter,e=o.config.acceptors,r=!1,i="retry";e.forEach(function(e){var t;r||(t=o.matchers[e.matcher])&&t(n,e.expected,e.argument)&&(r=!0,i=e.state)}),!r&&n.error&&(i="failure"),"success"===i?o.setSuccess(n):o.setError(n,"retry"===i)}o.ResourceWaiter=r({constructor:function(e,t){this.service=e,this.state=t,this.loadWaiterConfig(this.state)},service:null,state:null,config:null,matchers:{path:function(e,t,n){try{var o=s.search(e.data,n)}catch(e){return!1}return s.strictDeepEqual(o,t)},pathAll:function(e,t,n){try{var o=s.search(e.data,n)}catch(e){return!1}Array.isArray(o)||(o=[o]);var r=o.length;if(!r)return!1;for(var i=0;i<r;i++)if(!s.strictDeepEqual(o[i],t))return!1;return!0},pathAny:function(e,t,n){try{var o=s.search(e.data,n)}catch(e){return!1}Array.isArray(o)||(o=[o]);for(var r=o.length,i=0;i<r;i++)if(s.strictDeepEqual(o[i],t))return!0;return!1},status:function(e,t){e=e.httpResponse.statusCode;return"number"==typeof e&&e===t},error:function(e,t){return"string"==typeof t&&e.error?t===e.error.code:t===!!e.error}},listeners:(new o.SequentialExecutor).addNamedListeners(function(e){e("RETRY_CHECK","retry",function(e){var t=e.request._waiter;e.error&&"ResourceNotReady"===e.error.code&&(e.error.retryDelay=1e3*(t.config.delay||0))}),e("CHECK_OUTPUT","extractData",i),e("CHECK_ERROR","extractError",i)}),wait:function(e,t){"function"==typeof e&&(t=e,e=void 0),e&&e.$waiter&&("number"==typeof(e=o.util.copy(e)).$waiter.delay&&(this.config.delay=e.$waiter.delay),"number"==typeof e.$waiter.maxAttempts&&(this.config.maxAttempts=e.$waiter.maxAttempts),delete e.$waiter);e=this.service.makeRequest(this.config.operation,e);return e._waiter=this,e.response.maxRetries=this.config.maxAttempts,e.addListeners(this.listeners),t&&e.send(t),e},setSuccess:function(e){e.error=null,e.data=e.data||{},e.request.removeAllListeners("extractData")},setError:function(e,t){e.data=null,e.error=o.util.error(e.error||new Error,{code:"ResourceNotReady",message:"Resource is not in the state "+this.state,retryable:t})},loadWaiterConfig:function(e){if(!this.service.api.waiters[e])throw new o.util.error(new Error,{code:"StateNotFoundError",message:"State "+e+" not found."});this.config=o.util.copy(this.service.api.waiters[e])}})},{"./core":18,jmespath:84}],57:[function(e,t,n){var c=e("./core"),o=c.util.inherit,r=e("jmespath");c.Response=o({constructor:function(e){this.request=e,this.data=null,this.error=null,this.retryCount=0,this.redirectCount=0,this.httpResponse=new c.HttpResponse,e&&(this.maxRetries=e.service.numRetries(),this.maxRedirects=e.service.config.maxRedirects)},nextPage:function(e){var t,n=this.request.service,o=this.request.operation;try{t=n.paginationConfig(o,!0)}catch(e){this.error=e}if(!this.hasNextPage()){if(e)e(this.error,null);else if(this.error)throw this.error;return null}var r=c.util.copy(this.request.params);if(this.nextPageTokens){var i=t.inputToken;"string"==typeof i&&(i=[i]);for(var s=0;s<i.length;s++)r[i[s]]=this.nextPageTokens[s];return n.makeRequest(this.request.operation,r,e)}return e?e(null,null):null},hasNextPage:function(){return this.cacheNextPageTokens(),!!this.nextPageTokens||void 0===this.nextPageTokens&&void 0},cacheNextPageTokens:function(){if(Object.prototype.hasOwnProperty.call(this,"nextPageTokens"))return this.nextPageTokens;this.nextPageTokens=void 0;var e=this.request.service.paginationConfig(this.request.operation);if(!e)return this.nextPageTokens;if(this.nextPageTokens=null,e.moreResults&&!r.search(this.data,e.moreResults))return this.nextPageTokens;e=e.outputToken;return"string"==typeof e&&(e=[e]),c.util.arrayEach.call(this,e,function(e){e=r.search(this.data,e);e&&(this.nextPageTokens=this.nextPageTokens||[],this.nextPageTokens.push(e))}),this.nextPageTokens}})},{"./core":18,jmespath:84}],58:[function(e,t,n){var a=e("./core");a.SequentialExecutor=a.util.inherit({constructor:function(){this._events={}},listeners:function(e){return this._events[e]?this._events[e].slice(0):[]},on:function(e,t,n){return this._events[e]?n?this._events[e].unshift(t):this._events[e].push(t):this._events[e]=[t],this},onAsync:function(e,t,n){return t._isAsync=!0,this.on(e,t,n)},removeListener:function(e,t){var n=this._events[e];if(n){for(var o=n.length,r=-1,i=0;i<o;++i)n[i]===t&&(r=i);-1<r&&n.splice(r,1)}return this},removeAllListeners:function(e){return e?delete this._events[e]:this._events={},this},emit:function(e,t,n){n=n||function(){};var o=this.listeners(e),e=o.length;return this.callListeners(o,t,n),0<e},callListeners:function(t,n,o,e){var r=this,i=e||null;function s(e){if(e&&(i=a.util.error(i||new Error,e),r._haltHandlersOnError))return o.call(r,i);r.callListeners(t,n,o,i)}for(;0<t.length;){var c=t.shift();if(c._isAsync)return void c.apply(r,n.concat([s]));try{c.apply(r,n)}catch(e){i=a.util.error(i||new Error,e)}if(i&&r._haltHandlersOnError)return void o.call(r,i)}o.call(r,i)},addListeners:function(e){var n=this;return e._events&&(e=e._events),a.util.each(e,function(t,e){"function"==typeof e&&(e=[e]),a.util.arrayEach(e,function(e){n.on(t,e)})}),n},addNamedListener:function(e,t,n,o){return this[e]=n,this.addListener(t,n,o),this},addNamedAsyncListener:function(e,t,n,o){return n._isAsync=!0,this.addNamedListener(e,t,n,o)},addNamedListeners:function(e){var t=this;return e(function(){t.addNamedListener.apply(t,arguments)},function(){t.addNamedAsyncListener.apply(t,arguments)}),this}}),a.SequentialExecutor.prototype.addListener=a.SequentialExecutor.prototype.on,t.exports=a.SequentialExecutor},{"./core":18}],59:[function(e,t,n){(function(o){var l=e("./core"),i=e("./model/api"),r=e("./region_config"),s=l.util.inherit,c=0;l.Service=s({constructor:function(e){if(!this.loadServiceClass)throw l.util.error(new Error,"Service must be constructed with `new' operator");var t=this.loadServiceClass(e||{});if(t){var n=l.util.copy(e),t=new t(e);return Object.defineProperty(t,"_originalConfig",{get:function(){return n},enumerable:!1,configurable:!0}),t._clientId=++c,t}this.initialize(e)},initialize:function(e){var t,n=l.config[this.serviceIdentifier];this.config=new l.Config(l.config),n&&this.config.update(n,!0),e&&this.config.update(e,!0),this.validateService(),this.config.endpoint||r(this),this.config.endpoint=this.endpointFromTemplate(this.config.endpoint),this.setEndpoint(this.config.endpoint),l.SequentialExecutor.call(this),l.Service.addDefaultMonitoringListeners(this),(this.config.clientSideMonitoring||l.Service._clientSideMonitoring)&&this.publisher&&(t=this.publisher,this.addNamedListener("PUBLISH_API_CALL","apiCall",function(e){o.nextTick(function(){t.eventHandler(e)})}),this.addNamedListener("PUBLISH_API_ATTEMPT","apiCallAttempt",function(e){o.nextTick(function(){t.eventHandler(e)})}))},validateService:function(){},loadServiceClass:function(e){var t=e;if(l.util.isEmpty(this.api)){if(t.apiConfig)return l.Service.defineServiceApi(this.constructor,t.apiConfig);if(this.constructor.services){(t=new l.Config(l.config)).update(e,!0);e=(e=t.apiVersions[this.constructor.serviceIdentifier])||t.apiVersion;return this.getLatestServiceClass(e)}return null}return null},getLatestServiceClass:function(e){return e=this.getLatestServiceVersion(e),null===this.constructor.services[e]&&l.Service.defineServiceApi(this.constructor,e),this.constructor.services[e]},getLatestServiceVersion:function(e){if(!this.constructor.services||0===this.constructor.services.length)throw new Error("No services defined on "+this.constructor.serviceIdentifier);if(e?l.util.isType(e,Date)&&(e=l.util.date.iso8601(e).split("T")[0]):e="latest",Object.hasOwnProperty(this.constructor.services,e))return e;for(var t=Object.keys(this.constructor.services).sort(),n=null,o=t.length-1;0<=o;o--)if("*"!==t[o][t[o].length-1]&&(n=t[o]),t[o].substr(0,10)<=e)return n;throw new Error("Could not find "+this.constructor.serviceIdentifier+" API to satisfy version constraint `"+e+"'")},api:{},defaultRetryCount:3,customizeRequests:function(e){if(e){if("function"!=typeof e)throw new Error("Invalid callback type '"+typeof e+"' provided in customizeRequests");this.customRequestHandler=e}else this.customRequestHandler=null},makeRequest:function(e,n,t){var o;"function"==typeof n&&(t=n,n=null),n=n||{},!this.config.params||(o=this.api.operations[e])&&(n=l.util.copy(n),l.util.each(this.config.params,function(e,t){o.input.members[e]&&(void 0!==n[e]&&null!==n[e]||(n[e]=t))}));e=new l.Request(this,e,n);return this.addAllRequestListeners(e),this.attachMonitoringEmitter(e),t&&e.send(t),e},makeUnauthenticatedRequest:function(e,t,n){"function"==typeof t&&(n=t,t={});t=this.makeRequest(e,t).toUnauthenticated();return n?t.send(n):t},waitFor:function(e,t,n){return new l.ResourceWaiter(this,e).wait(t,n)},addAllRequestListeners:function(e){for(var t=[l.events,l.EventListeners.Core,this.serviceInterface(),l.EventListeners.CorePost],n=0;n<t.length;n++)t[n]&&e.addListeners(t[n]);this.config.paramValidation||e.removeListener("validate",l.EventListeners.Core.VALIDATE_PARAMETERS),this.config.logger&&e.addListeners(l.EventListeners.Logger),this.setupRequestListeners(e),"function"==typeof this.constructor.prototype.customRequestHandler&&this.constructor.prototype.customRequestHandler(e),Object.prototype.hasOwnProperty.call(this,"customRequestHandler")&&"function"==typeof this.customRequestHandler&&this.customRequestHandler(e)},apiCallEvent:function(e){var t=e.service.api.operations[e.operation],n={Type:"ApiCall",Api:t?t.name:e.operation,Version:1,Service:e.service.api.serviceId||e.service.api.endpointPrefix,Region:e.httpRequest.region,MaxRetriesExceeded:0,UserAgent:e.httpRequest.getUserAgent()},t=e.response;return t.httpResponse.statusCode&&(n.FinalHttpStatusCode=t.httpResponse.statusCode),t.error&&(e=t.error,299<t.httpResponse.statusCode?(e.code&&(n.FinalAwsException=e.code),e.message&&(n.FinalAwsExceptionMessage=e.message)):((e.code||e.name)&&(n.FinalSdkException=e.code||e.name),e.message&&(n.FinalSdkExceptionMessage=e.message))),n},apiAttemptEvent:function(e){var t=e.service.api.operations[e.operation],n={Type:"ApiCallAttempt",Api:t?t.name:e.operation,Version:1,Service:e.service.api.serviceId||e.service.api.endpointPrefix,Fqdn:e.httpRequest.endpoint.hostname,UserAgent:e.httpRequest.getUserAgent()},t=e.response;return t.httpResponse.statusCode&&(n.HttpStatusCode=t.httpResponse.statusCode),!e._unAuthenticated&&e.service.config.credentials&&e.service.config.credentials.accessKeyId&&(n.AccessKey=e.service.config.credentials.accessKeyId),t.httpResponse.headers&&(e.httpRequest.headers["x-amz-security-token"]&&(n.SessionToken=e.httpRequest.headers["x-amz-security-token"]),t.httpResponse.headers["x-amzn-requestid"]&&(n.XAmznRequestId=t.httpResponse.headers["x-amzn-requestid"]),t.httpResponse.headers["x-amz-request-id"]&&(n.XAmzRequestId=t.httpResponse.headers["x-amz-request-id"]),t.httpResponse.headers["x-amz-id-2"]&&(n.XAmzId2=t.httpResponse.headers["x-amz-id-2"])),n},attemptFailEvent:function(e){var t=this.apiAttemptEvent(e),n=e.response,e=n.error;return 299<n.httpResponse.statusCode?(e.code&&(t.AwsException=e.code),e.message&&(t.AwsExceptionMessage=e.message)):((e.code||e.name)&&(t.SdkException=e.code||e.name),e.message&&(t.SdkExceptionMessage=e.message)),t},attachMonitoringEmitter:function(n){var t,o,r,i,s,c,a=0,u=this;n.on("validate",function(){i=l.util.realClock.now(),c=Date.now()},!0),n.on("sign",function(){o=l.util.realClock.now(),t=Date.now(),s=n.httpRequest.region,a++},!0),n.on("validateResponse",function(){r=Math.round(l.util.realClock.now()-o)}),n.addNamedListener("API_CALL_ATTEMPT","success",function(){var e=u.apiAttemptEvent(n);e.Timestamp=t,e.AttemptLatency=0<=r?r:0,e.Region=s,u.emit("apiCallAttempt",[e])}),n.addNamedListener("API_CALL_ATTEMPT_RETRY","retry",function(){var e=u.attemptFailEvent(n);e.Timestamp=t,r=r||Math.round(l.util.realClock.now()-o),e.AttemptLatency=0<=r?r:0,e.Region=s,u.emit("apiCallAttempt",[e])}),n.addNamedListener("API_CALL","complete",function(){var e,t=u.apiCallEvent(n);t.AttemptCount=a,t.AttemptCount<=0||(t.Timestamp=c,e=Math.round(l.util.realClock.now()-i),t.Latency=0<=e?e:0,"number"==typeof(e=n.response).retryCount&&"number"==typeof e.maxRetries&&e.retryCount>=e.maxRetries&&(t.MaxRetriesExceeded=1),u.emit("apiCall",[t]))})},setupRequestListeners:function(){},getSignerClass:function(e){var t=null,n="";return e&&(n=(t=(e.service.api.operations||{})[e.operation]||null)?t.authtype:""),n=this.config.signatureVersion||("v4"===n||"v4-unsigned-body"===n?"v4":this.api.signatureVersion),l.Signers.RequestSigner.getVersion(n)},serviceInterface:function(){switch(this.api.protocol){case"ec2":case"query":return l.EventListeners.Query;case"json":return l.EventListeners.Json;case"rest-json":return l.EventListeners.RestJson;case"rest-xml":return l.EventListeners.RestXml}if(this.api.protocol)throw new Error("Invalid service `protocol' "+this.api.protocol+" in API config")},successfulResponse:function(e){return e.httpResponse.statusCode<300},numRetries:function(){return void 0!==this.config.maxRetries?this.config.maxRetries:this.defaultRetryCount},retryDelays:function(e){return l.util.calculateRetryDelay(e,this.config.retryDelayOptions)},retryableError:function(e){return!!this.timeoutError(e)||(!!this.networkingError(e)||(!!this.expiredCredentialsError(e)||(!!this.throttledError(e)||500<=e.statusCode)))},networkingError:function(e){return"NetworkingError"===e.code},timeoutError:function(e){return"TimeoutError"===e.code},expiredCredentialsError:function(e){return"ExpiredTokenException"===e.code},clockSkewError:function(e){switch(e.code){case"RequestTimeTooSkewed":case"RequestExpired":case"InvalidSignatureException":case"SignatureDoesNotMatch":case"AuthFailure":case"RequestInTheFuture":return!0;default:return!1}},getSkewCorrectedDate:function(){return new Date(Date.now()+this.config.systemClockOffset)},applyClockOffset:function(e){e&&(this.config.systemClockOffset=e-Date.now())},isClockSkewed:function(e){if(e)return 3e4<=Math.abs(this.getSkewCorrectedDate().getTime()-e)},throttledError:function(e){if(429===e.statusCode)return!0;switch(e.code){case"ProvisionedThroughputExceededException":case"Throttling":case"ThrottlingException":case"RequestLimitExceeded":case"RequestThrottled":case"RequestThrottledException":case"TooManyRequestsException":case"TransactionInProgressException":return!0;default:return!1}},endpointFromTemplate:function(e){if("string"!=typeof e)return e;return e=(e=(e=e.replace(/\{service\}/g,this.api.endpointPrefix)).replace(/\{region\}/g,this.config.region)).replace(/\{scheme\}/g,this.config.sslEnabled?"https":"http")},setEndpoint:function(e){this.endpoint=new l.Endpoint(e,this.config)},paginationConfig:function(e,t){var n=this.api.operations[e].paginator;if(n)return n;if(t){t=new Error;throw l.util.error(t,"No pagination configuration for "+e)}return null}}),l.util.update(l.Service,{defineMethods:function(e){l.util.each(e.prototype.api.operations,function(n){e.prototype[n]||("none"===e.prototype.api.operations[n].authtype?e.prototype[n]=function(e,t){return this.makeUnauthenticatedRequest(n,e,t)}:e.prototype[n]=function(e,t){return this.makeRequest(n,e,t)})})},defineService:function(e,t,n){l.Service._serviceMap[e]=!0,Array.isArray(t)||(n=t,t=[]);var o,n=s(l.Service,n||{});return"string"==typeof e?(l.Service.addVersions(n,t),o=n.serviceIdentifier||e,n.serviceIdentifier=o):(n.prototype.api=e,l.Service.defineMethods(n)),l.SequentialExecutor.call(this.prototype),!this.prototype.publisher&&l.util.clientSideMonitoring&&(o=l.util.clientSideMonitoring.Publisher,e=(0,l.util.clientSideMonitoring.configProvider)(),this.prototype.publisher=new o(e),e.enabled&&(l.Service._clientSideMonitoring=!0)),l.SequentialExecutor.call(n.prototype),l.Service.addDefaultMonitoringListeners(n.prototype),n},addVersions:function(e,t){Array.isArray(t)||(t=[t]),e.services=e.services||{};for(var n=0;n<t.length;n++)void 0===e.services[t[n]]&&(e.services[t[n]]=null);e.apiVersions=Object.keys(e.services).sort()},defineServiceApi:function(t,n,e){var o=s(t,{serviceIdentifier:t.serviceIdentifier});function r(e){e.isApi?o.prototype.api=e:o.prototype.api=new i(e)}if("string"==typeof n){if(e)r(e);else try{r(l.apiLoader(t.serviceIdentifier,n))}catch(e){throw l.util.error(e,{message:"Could not find API configuration "+t.serviceIdentifier+"-"+n})}Object.prototype.hasOwnProperty.call(t.services,n)||(t.apiVersions=t.apiVersions.concat(n).sort()),t.services[n]=o}else r(n);return l.Service.defineMethods(o),o},hasService:function(e){return Object.prototype.hasOwnProperty.call(l.Service._serviceMap,e)},addDefaultMonitoringListeners:function(n){n.addNamedListener("MONITOR_EVENTS_BUBBLE","apiCallAttempt",function(e){var t=Object.getPrototypeOf(n);t._events&&t.emit("apiCallAttempt",[e])}),n.addNamedListener("CALL_EVENTS_BUBBLE","apiCall",function(e){var t=Object.getPrototypeOf(n);t._events&&t.emit("apiCall",[e])})},_serviceMap:{}}),l.util.mixin(l.Service,l.SequentialExecutor),t.exports=l.Service}).call(this,e("_process"))},{"./core":18,"./model/api":38,"./region_config":53,_process:85}],60:[function(e,t,n){e=e("../core");e.util.update(e.CognitoIdentity.prototype,{getOpenIdToken:function(e,t){return this.makeUnauthenticatedRequest("getOpenIdToken",e,t)},getId:function(e,t){return this.makeUnauthenticatedRequest("getId",e,t)},getCredentialsForIdentity:function(e,t){return this.makeUnauthenticatedRequest("getCredentialsForIdentity",e,t)}})},{"../core":18}],61:[function(e,t,n){(function(o){var r=e("../core"),n=e("../region_config"),i="AWS_STS_REGIONAL_ENDPOINTS",s="sts_regional_endpoints";r.util.update(r.STS.prototype,{credentialsFrom:function(e,t){return e?((t=t||new r.TemporaryCredentials).expired=!1,t.accessKeyId=e.Credentials.AccessKeyId,t.secretAccessKey=e.Credentials.SecretAccessKey,t.sessionToken=e.Credentials.SessionToken,t.expireTime=e.Credentials.Expiration,t):null},assumeRoleWithWebIdentity:function(e,t){return this.makeUnauthenticatedRequest("assumeRoleWithWebIdentity",e,t)},assumeRoleWithSAML:function(e,t){return this.makeUnauthenticatedRequest("assumeRoleWithSAML",e,t)},validateRegionalEndpointsFlagValue:function(e,t){if(!("string"==typeof e&&0<=["legacy","regional"].indexOf(e.toLowerCase())))throw r.util.error(new Error,t);this.config.stsRegionalEndpoints=e.toLowerCase()},validateRegionalEndpointsFlag:function(){var e=this.config;if(e.stsRegionalEndpoints&&this.validateRegionalEndpointsFlagValue(e.stsRegionalEndpoints,{code:"InvalidConfiguration",message:'invalid "stsRegionalEndpoints" configuration. Expect "legacy"  or "regional". Got "'+e.stsRegionalEndpoints+'".'}),r.util.isNode()){Object.prototype.hasOwnProperty.call(o.env,i)&&(t=o.env[i],this.validateRegionalEndpointsFlagValue(t,{code:"InvalidEnvironmentalVariable",message:"invalid "+i+' environmental variable. Expect "legacy"  or "regional". Got "'+o.env[i]+'".'}));var t,n={};try{n=r.util.getProfilesFromSharedConfig(r.util.iniLoader)[o.env.AWS_PROFILE||r.util.defaultProfile]}catch(e){}n&&Object.prototype.hasOwnProperty.call(n,s)&&(t=n[s],this.validateRegionalEndpointsFlagValue(t,{code:"InvalidConfiguration",message:"invalid "+s+' profile config. Expect "legacy"  or "regional". Got "'+n[s]+'".'}))}},optInRegionalEndpoint:function(){this.validateRegionalEndpointsFlag();var e=this.config;if("regional"===e.stsRegionalEndpoints&&(n(this),this.isGlobalEndpoint)){if(this.isGlobalEndpoint=!1,!e.region)throw r.util.error(new Error,{code:"ConfigError",message:"Missing region in config"});var t=e.endpoint.indexOf(".amazonaws.com");e.endpoint=e.endpoint.substring(0,t)+"."+e.region+e.endpoint.substring(t)}},validateService:function(){this.optInRegionalEndpoint()}})}).call(this,e("_process"))},{"../core":18,"../region_config":53,_process:85}],62:[function(e,t,n){var i=e("../core"),e=i.util.inherit,s="presigned-expires";function o(e){var t=e.httpRequest.headers[s],n=e.service.getSignerClass(e);if(delete e.httpRequest.headers["User-Agent"],delete e.httpRequest.headers["X-Amz-User-Agent"],n===i.Signers.V4){if(604800<t)throw i.util.error(new Error,{code:"InvalidExpiryTime",message:"Presigning does not support expiry time greater than a week with SigV4 signing.",retryable:!1});e.httpRequest.headers[s]=t}else{if(n!==i.Signers.S3)throw i.util.error(new Error,{message:"Presigning only supports S3 or SigV4 signing.",code:"UnsupportedSigner",retryable:!1});n=e.service?e.service.getSkewCorrectedDate():i.util.date.getDate();e.httpRequest.headers[s]=parseInt(i.util.date.unixTimestamp(n)+t,10).toString()}}function r(e){var t=e.httpRequest.endpoint,n=i.util.urlParse(e.httpRequest.path),o={};n.search&&(o=i.util.queryStringParse(n.search.substr(1)));var r=e.httpRequest.headers.Authorization.split(" ");"AWS"===r[0]?(r=r[1].split(":"),o.AWSAccessKeyId=r[0],o.Signature=r[1],i.util.each(e.httpRequest.headers,function(e,t){e===s&&(e="Expires"),0===e.indexOf("x-amz-meta-")&&(delete o[e],e=e.toLowerCase()),o[e]=t}),delete e.httpRequest.headers[s],delete o.Authorization,delete o.Host):"AWS4-HMAC-SHA256"===r[0]&&(r.shift(),r=r.join(" ").match(/Signature=(.*?)(?:,|\s|\r?\n|$)/)[1],o["X-Amz-Signature"]=r,delete o.Expires),t.pathname=n.pathname,t.search=i.util.queryParamsToString(o)}i.Signers.Presign=e({sign:function(e,t,n){if(e.httpRequest.headers[s]=t||3600,e.on("build",o),e.on("sign",r),e.removeListener("afterBuild",i.EventListeners.Core.SET_CONTENT_LENGTH),e.removeListener("afterBuild",i.EventListeners.Core.COMPUTE_SHA256),e.emit("beforePresign",[e]),!n){if(e.build(),e.response.error)throw e.response.error;return i.util.urlFormat(e.httpRequest.endpoint)}e.build(function(){this.response.error?n(this.response.error):n(null,i.util.urlFormat(e.httpRequest.endpoint))})}}),t.exports=i.Signers.Presign},{"../core":18}],63:[function(e,t,n){var o=e("../core"),r=o.util.inherit;o.Signers.RequestSigner=r({constructor:function(e){this.request=e},setServiceClientId:function(e){this.serviceClientId=e},getServiceClientId:function(){return this.serviceClientId}}),o.Signers.RequestSigner.getVersion=function(e){switch(e){case"v2":return o.Signers.V2;case"v3":return o.Signers.V3;case"s3v4":case"v4":return o.Signers.V4;case"s3":return o.Signers.S3;case"v3https":return o.Signers.V3Https}throw new Error("Unknown signing version "+e)},e("./v2"),e("./v3"),e("./v3https"),e("./v4"),e("./s3"),e("./presign")},{"../core":18,"./presign":62,"./s3":64,"./v2":65,"./v3":66,"./v3https":67,"./v4":68}],64:[function(e,t,n){var i=e("../core"),e=i.util.inherit;i.Signers.S3=e(i.Signers.RequestSigner,{subResources:{acl:1,accelerate:1,analytics:1,cors:1,lifecycle:1,delete:1,inventory:1,location:1,logging:1,metrics:1,notification:1,partNumber:1,policy:1,requestPayment:1,replication:1,restore:1,tagging:1,torrent:1,uploadId:1,uploads:1,versionId:1,versioning:1,versions:1,website:1},responseHeaders:{"response-content-type":1,"response-content-language":1,"response-expires":1,"response-cache-control":1,"response-content-disposition":1,"response-content-encoding":1},addAuthorization:function(e,t){this.request.headers["presigned-expires"]||(this.request.headers["X-Amz-Date"]=i.util.date.rfc822(t)),e.sessionToken&&(this.request.headers["x-amz-security-token"]=e.sessionToken);t=this.sign(e.secretAccessKey,this.stringToSign()),t="AWS "+e.accessKeyId+":"+t;this.request.headers.Authorization=t},stringToSign:function(){var e=this.request,t=[];t.push(e.method),t.push(e.headers["Content-MD5"]||""),t.push(e.headers["Content-Type"]||""),t.push(e.headers["presigned-expires"]||"");e=this.canonicalizedAmzHeaders();return e&&t.push(e),t.push(this.canonicalizedResource()),t.join("\n")},canonicalizedAmzHeaders:function(){var t=[];i.util.each(this.request.headers,function(e){e.match(/^x-amz-/i)&&t.push(e)}),t.sort(function(e,t){return e.toLowerCase()<t.toLowerCase()?-1:1});var n=[];return i.util.arrayEach.call(this,t,function(e){n.push(e.toLowerCase()+":"+String(this.request.headers[e]))}),n.join("\n")},canonicalizedResource:function(){var o,e=this.request,t=e.path.split("?"),n=t[0],r=t[1],t="";return e.virtualHostedBucket&&(t+="/"+e.virtualHostedBucket),t+=n,r&&(o=[],i.util.arrayEach.call(this,r.split("&"),function(e){var t=e.split("=")[0],n=e.split("=")[1];(this.subResources[t]||this.responseHeaders[t])&&(e={name:t},void 0!==n&&(this.subResources[t]?e.value=n:e.value=decodeURIComponent(n)),o.push(e))}),o.sort(function(e,t){return e.name<t.name?-1:1}),o.length&&(r=[],i.util.arrayEach(o,function(e){void 0===e.value?r.push(e.name):r.push(e.name+"="+e.value)}),t+="?"+r.join("&"))),t},sign:function(e,t){return i.util.crypto.hmac(e,t,"base64","sha1")}}),t.exports=i.Signers.S3},{"../core":18}],65:[function(e,t,n){var o=e("../core"),e=o.util.inherit;o.Signers.V2=e(o.Signers.RequestSigner,{addAuthorization:function(e,t){t=t||o.util.date.getDate();var n=this.request;n.params.Timestamp=o.util.date.iso8601(t),n.params.SignatureVersion="2",n.params.SignatureMethod="HmacSHA256",n.params.AWSAccessKeyId=e.accessKeyId,e.sessionToken&&(n.params.SecurityToken=e.sessionToken),delete n.params.Signature,n.params.Signature=this.signature(e),n.body=o.util.queryParamsToString(n.params),n.headers["Content-Length"]=n.body.length},signature:function(e){return o.util.crypto.hmac(e.secretAccessKey,this.stringToSign(),"base64")},stringToSign:function(){var e=[];return e.push(this.request.method),e.push(this.request.endpoint.host.toLowerCase()),e.push(this.request.pathname()),e.push(o.util.queryParamsToString(this.request.params)),e.join("\n")}}),t.exports=o.Signers.V2},{"../core":18}],66:[function(e,t,n){var o=e("../core"),e=o.util.inherit;o.Signers.V3=e(o.Signers.RequestSigner,{addAuthorization:function(e,t){t=o.util.date.rfc822(t);this.request.headers["X-Amz-Date"]=t,e.sessionToken&&(this.request.headers["x-amz-security-token"]=e.sessionToken),this.request.headers["X-Amzn-Authorization"]=this.authorization(e,t)},authorization:function(e){return"AWS3 AWSAccessKeyId="+e.accessKeyId+",Algorithm=HmacSHA256,SignedHeaders="+this.signedHeaders()+",Signature="+this.signature(e)},signedHeaders:function(){var t=[];return o.util.arrayEach(this.headersToSign(),function(e){t.push(e.toLowerCase())}),t.sort().join(";")},canonicalHeaders:function(){var t=this.request.headers,n=[];return o.util.arrayEach(this.headersToSign(),function(e){n.push(e.toLowerCase().trim()+":"+String(t[e]).trim())}),n.sort().join("\n")+"\n"},headersToSign:function(){var t=[];return o.util.each(this.request.headers,function(e){"Host"!==e&&"Content-Encoding"!==e&&!e.match(/^X-Amz/i)||t.push(e)}),t},signature:function(e){return o.util.crypto.hmac(e.secretAccessKey,this.stringToSign(),"base64")},stringToSign:function(){var e=[];return e.push(this.request.method),e.push("/"),e.push(""),e.push(this.canonicalHeaders()),e.push(this.request.body),o.util.crypto.sha256(e.join("\n"))}}),t.exports=o.Signers.V3},{"../core":18}],67:[function(e,t,n){var o=e("../core"),r=o.util.inherit;e("./v3"),o.Signers.V3Https=r(o.Signers.V3,{authorization:function(e){return"AWS3-HTTPS AWSAccessKeyId="+e.accessKeyId+",Algorithm=HmacSHA256,Signature="+this.signature(e)},stringToSign:function(){return this.request.headers["X-Amz-Date"]}}),t.exports=o.Signers.V3Https},{"../core":18,"./v3":66}],68:[function(e,t,n){var r=e("../core"),o=e("./v4_credentials"),e=r.util.inherit,i="presigned-expires";r.Signers.V4=e(r.Signers.RequestSigner,{constructor:function(e,t,n){r.Signers.RequestSigner.call(this,e),this.serviceName=t,n=n||{},this.signatureCache="boolean"!=typeof n.signatureCache||n.signatureCache,this.operation=n.operation,this.signatureVersion=n.signatureVersion},algorithm:"AWS4-HMAC-SHA256",addAuthorization:function(e,t){t=r.util.date.iso8601(t).replace(/[:\-]|\.\d{3}/g,"");this.isPresigned()?this.updateForPresigned(e,t):this.addHeaders(e,t),this.request.headers.Authorization=this.authorization(e,t)},addHeaders:function(e,t){this.request.headers["X-Amz-Date"]=t,e.sessionToken&&(this.request.headers["x-amz-security-token"]=e.sessionToken)},updateForPresigned:function(e,t){var n=this.credentialString(t),o={"X-Amz-Date":t,"X-Amz-Algorithm":this.algorithm,"X-Amz-Credential":e.accessKeyId+"/"+n,"X-Amz-Expires":this.request.headers[i],"X-Amz-SignedHeaders":this.signedHeaders()};e.sessionToken&&(o["X-Amz-Security-Token"]=e.sessionToken),this.request.headers["Content-Type"]&&(o["Content-Type"]=this.request.headers["Content-Type"]),this.request.headers["Content-MD5"]&&(o["Content-MD5"]=this.request.headers["Content-MD5"]),this.request.headers["Cache-Control"]&&(o["Cache-Control"]=this.request.headers["Cache-Control"]),r.util.each.call(this,this.request.headers,function(e,t){var n;e!==i&&this.isSignableHeader(e)&&(0===(n=e.toLowerCase()).indexOf("x-amz-meta-")?o[n]=t:0===n.indexOf("x-amz-")&&(o[e]=t))});e=0<=this.request.path.indexOf("?")?"&":"?";this.request.path+=e+r.util.queryParamsToString(o)},authorization:function(e,t){var n=[],o=this.credentialString(t);return n.push(this.algorithm+" Credential="+e.accessKeyId+"/"+o),n.push("SignedHeaders="+this.signedHeaders()),n.push("Signature="+this.signature(e,t)),n.join(", ")},signature:function(e,t){e=o.getSigningKey(e,t.substr(0,8),this.request.region,this.serviceName,this.signatureCache);return r.util.crypto.hmac(e,this.stringToSign(t),"hex")},stringToSign:function(e){var t=[];return t.push("AWS4-HMAC-SHA256"),t.push(e),t.push(this.credentialString(e)),t.push(this.hexEncodedHash(this.canonicalString())),t.join("\n")},canonicalString:function(){var e=[],t=this.request.pathname();return"s3"!==this.serviceName&&"s3v4"!==this.signatureVersion&&(t=r.util.uriEscapePath(t)),e.push(this.request.method),e.push(t),e.push(this.request.search()),e.push(this.canonicalHeaders()+"\n"),e.push(this.signedHeaders()),e.push(this.hexEncodedBodyHash()),e.join("\n")},canonicalHeaders:function(){var n=[];r.util.each.call(this,this.request.headers,function(e,t){n.push([e,t])}),n.sort(function(e,t){return e[0].toLowerCase()<t[0].toLowerCase()?-1:1});var o=[];return r.util.arrayEach.call(this,n,function(e){var t=e[0].toLowerCase();if(this.isSignableHeader(t)){e=e[1];if(null==e||"function"!=typeof e.toString)throw r.util.error(new Error("Header "+t+" contains invalid value"),{code:"InvalidHeader"});o.push(t+":"+this.canonicalHeaderValues(e.toString()))}}),o.join("\n")},canonicalHeaderValues:function(e){return e.replace(/\s+/g," ").replace(/^\s+|\s+$/g,"")},signedHeaders:function(){var t=[];return r.util.each.call(this,this.request.headers,function(e){e=e.toLowerCase(),this.isSignableHeader(e)&&t.push(e)}),t.sort().join(";")},credentialString:function(e){return o.createScope(e.substr(0,8),this.request.region,this.serviceName)},hexEncodedHash:function(e){return r.util.crypto.sha256(e,"hex")},hexEncodedBodyHash:function(){var e=this.request;return this.isPresigned()&&"s3"===this.serviceName&&!e.body?"UNSIGNED-PAYLOAD":e.headers["X-Amz-Content-Sha256"]||this.hexEncodedHash(this.request.body||"")},unsignableHeaders:["authorization","content-type","content-length","user-agent",i,"expect","x-amzn-trace-id"],isSignableHeader:function(e){return 0===e.toLowerCase().indexOf("x-amz-")||this.unsignableHeaders.indexOf(e)<0},isPresigned:function(){return!!this.request.headers[i]}}),t.exports=r.Signers.V4},{"../core":18,"./v4_credentials":69}],69:[function(e,t,n){var s=e("../core"),c={},a=[],u="aws4_request";t.exports={createScope:function(e,t,n){return[e.substr(0,8),t,n,u].join("/")},getSigningKey:function(e,t,n,o,r){var i=[s.util.crypto.hmac(e.secretAccessKey,e.accessKeyId,"base64"),t,n,o].join("_");if((r=!1!==r)&&i in c)return c[i];t=s.util.crypto.hmac("AWS4"+e.secretAccessKey,t,"buffer"),n=s.util.crypto.hmac(t,n,"buffer"),o=s.util.crypto.hmac(n,o,"buffer"),o=s.util.crypto.hmac(o,u,"buffer");return r&&(c[i]=o,a.push(i),50<a.length&&delete c[a.shift()]),o},emptyCache:function(){c={},a=[]}}},{"../core":18}],70:[function(e,t,n){function o(e,t){this.currentState=t||null,this.states=e||{}}o.prototype.runTo=function(t,n,o,e){"function"==typeof t&&(e=o,o=n,n=t,t=null);var r=this,i=r.states[r.currentState];i.fn.call(o||r,e,function(e){if(e){if(!i.fail)return n?n.call(o,e):null;r.currentState=i.fail}else{if(!i.accept)return n?n.call(o):null;r.currentState=i.accept}if(r.currentState===t)return n?n.call(o,e):null;r.runTo(t,n,o,e)})},o.prototype.addState=function(e,t,n,o){return"function"==typeof t?(o=t,n=t=null):"function"==typeof n&&(o=n,n=null),this.currentState||(this.currentState=e),this.states[e]={accept:t,fail:n,fn:o},this},t.exports=o},{}],71:[function(r,e,t){(function(c,t){var a,u={environment:"nodejs",engine:function(){if(u.isBrowser()&&"undefined"!=typeof navigator)return navigator.userAgent;var e=c.platform+"/"+c.version;return c.env.AWS_EXECUTION_ENV&&(e+=" exec-env/"+c.env.AWS_EXECUTION_ENV),e},userAgent:function(){var e=u.environment,t="aws-sdk-"+e+"/"+r("./core").VERSION;return"nodejs"===e&&(t+=" "+u.engine()),t},uriEscape:function(e){e=encodeURIComponent(e);return e=(e=e.replace(/[^A-Za-z0-9_.~\-%]+/g,escape)).replace(/[*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})},uriEscapePath:function(e){var t=[];return u.arrayEach(e.split("/"),function(e){t.push(u.uriEscape(e))}),t.join("/")},urlParse:function(e){return u.url.parse(e)},urlFormat:function(e){return u.url.format(e)},queryStringParse:function(e){return u.querystring.parse(e)},queryParamsToString:function(r){var i=[],s=u.uriEscape,e=Object.keys(r).sort();return u.arrayEach(e,function(e){var t,n=r[e],o=s(e),e=o+"=";Array.isArray(n)?(t=[],u.arrayEach(n,function(e){t.push(s(e))}),e=o+"="+t.sort().join("&"+o+"=")):null!=n&&(e=o+"="+s(n)),i.push(e)}),i.join("&")},readFileSync:function(e){return u.isBrowser()?null:r("fs").readFileSync(e,"utf-8")},base64:{encode:function(e){if("number"==typeof e)throw u.error(new Error("Cannot base64 encode number "+e));return null==e?e:u.buffer.toBuffer(e).toString("base64")},decode:function(e){if("number"==typeof e)throw u.error(new Error("Cannot base64 decode number "+e));return null==e?e:u.buffer.toBuffer(e,"base64")}},buffer:{toBuffer:function(e,t){return"function"==typeof u.Buffer.from&&u.Buffer.from!==Uint8Array.from?u.Buffer.from(e,t):new u.Buffer(e,t)},alloc:function(e,t,n){if("number"!=typeof e)throw new Error("size passed to alloc must be a number.");if("function"==typeof u.Buffer.alloc)return u.Buffer.alloc(e,t,n);e=new u.Buffer(e);return void 0!==t&&"function"==typeof e.fill&&e.fill(t,void 0,void 0,n),e},toStream:function(t){u.Buffer.isBuffer(t)||(t=u.buffer.toBuffer(t));var n=new u.stream.Readable,o=0;return n._read=function(e){if(o>=t.length)return n.push(null);e=o+e;e>t.length&&(e=t.length),n.push(t.slice(o,e)),o=e},n},concat:function(e){for(var t,n=0,o=0,r=0;r<e.length;r++)n+=e[r].length;for(t=u.buffer.alloc(n),r=0;r<e.length;r++)e[r].copy(t,o),o+=e[r].length;return t}},string:{byteLength:function(e){if(null==e)return 0;if("string"==typeof e&&(e=u.buffer.toBuffer(e)),"number"==typeof e.byteLength)return e.byteLength;if("number"==typeof e.length)return e.length;if("number"==typeof e.size)return e.size;if("string"==typeof e.path)return r("fs").lstatSync(e.path).size;throw u.error(new Error("Cannot determine length of "+e),{object:e})},upperFirst:function(e){return e[0].toUpperCase()+e.substr(1)},lowerFirst:function(e){return e[0].toLowerCase()+e.substr(1)}},ini:{parse:function(e){var n,o={};return u.arrayEach(e.split(/\r?\n/),function(e){var t=(e=e.split(/(^|\s)[;#]/)[0]).match(/^\s*\[([^\[\]]+)\]\s*$/);t?n=t[1]:!n||(e=e.match(/^\s*(.+?)\s*=\s*(.+?)\s*$/))&&(o[n]=o[n]||{},o[n][e[1]]=e[2])}),o}},fn:{noop:function(){},callback:function(e){if(e)throw e},makeAsync:function(t,e){return e&&e<=t.length?t:function(){var e=Array.prototype.slice.call(arguments,0);e.pop()(t.apply(null,e))}}},date:{getDate:function(){return(a=a||r("./core")).config.systemClockOffset?new Date((new Date).getTime()+a.config.systemClockOffset):new Date},iso8601:function(e){return void 0===e&&(e=u.date.getDate()),e.toISOString().replace(/\.\d{3}Z$/,"Z")},rfc822:function(e){return void 0===e&&(e=u.date.getDate()),e.toUTCString()},unixTimestamp:function(e){return void 0===e&&(e=u.date.getDate()),e.getTime()/1e3},from:function(e){return"number"==typeof e?new Date(1e3*e):new Date(e)},format:function(e,t){return t=t||"iso8601",u.date[t](u.date.from(e))},parseTimestamp:function(e){if("number"==typeof e)return new Date(1e3*e);if(e.match(/^\d+$/))return new Date(1e3*e);if(e.match(/^\d{4}/))return new Date(e);if(e.match(/^\w{3},/))return new Date(e);throw u.error(new Error("unhandled timestamp format: "+e),{code:"TimestampParserError"})}},crypto:{crc32Table:[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],crc32:function(e){var t=u.crypto.crc32Table,n=-1;"string"==typeof e&&(e=u.buffer.toBuffer(e));for(var o=0;o<e.length;o++)n=n>>>8^t[255&(n^e.readUInt8(o))];return(-1^n)>>>0},hmac:function(e,t,n,o){return"buffer"===(n=n||"binary")&&(n=void 0),o=o||"sha256","string"==typeof t&&(t=u.buffer.toBuffer(t)),u.crypto.lib.createHmac(o,e).update(t).digest(n)},md5:function(e,t,n){return u.crypto.hash("md5",e,t,n)},sha256:function(e,t,n){return u.crypto.hash("sha256",e,t,n)},hash:function(e,t,n,o){var r=u.crypto.createHash(e);"buffer"===(n=n||"binary")&&(n=void 0),"string"==typeof t&&(t=u.buffer.toBuffer(t));var i=u.arraySliceFn(t),e=u.Buffer.isBuffer(t);if(u.isBrowser()&&"undefined"!=typeof ArrayBuffer&&t&&t.buffer instanceof ArrayBuffer&&(e=!0),o&&"object"==typeof t&&"function"==typeof t.on&&!e)t.on("data",function(e){r.update(e)}),t.on("error",function(e){o(e)}),t.on("end",function(){o(null,r.digest(n))});else{if(!o||!i||e||"undefined"==typeof FileReader){u.isBrowser()&&"object"==typeof t&&!e&&(t=new u.Buffer(new Uint8Array(t)));e=r.update(t).digest(n);return o&&o(null,e),e}var s=0,c=new FileReader;c.onerror=function(){o(new Error("Failed to read data."))},c.onload=function(){var e=new u.Buffer(new Uint8Array(c.result));r.update(e),s+=e.length,c._continueReading()},c._continueReading=function(){var e;s>=t.size?o(null,r.digest(n)):((e=s+524288)>t.size&&(e=t.size),c.readAsArrayBuffer(i.call(t,s,e)))},c._continueReading()}},toHex:function(e){for(var t=[],n=0;n<e.length;n++)t.push(("0"+e.charCodeAt(n).toString(16)).substr(-2,2));return t.join("")},createHash:function(e){return u.crypto.lib.createHash(e)}},abort:{},each:function(e,t){for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n))if(t.call(this,n,e[n])===u.abort)break},arrayEach:function(e,t){for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n))if(t.call(this,e[n],parseInt(n,10))===u.abort)break},update:function(n,e){return u.each(e,function(e,t){n[e]=t}),n},merge:function(e,t){return u.update(u.copy(e),t)},copy:function(e){if(null==e)return e;var t,n={};for(t in e)n[t]=e[t];return n},isEmpty:function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0},arraySliceFn:function(e){e=e.slice||e.webkitSlice||e.mozSlice;return"function"==typeof e?e:null},isType:function(e,t){return"function"==typeof t&&(t=u.typeName(t)),Object.prototype.toString.call(e)==="[object "+t+"]"},typeName:function(e){if(Object.prototype.hasOwnProperty.call(e,"name"))return e.name;var t=e.toString(),e=t.match(/^\s*function (.+)\(/);return e?e[1]:t},error:function(e,t){var n=null;return"string"==typeof e.message&&""!==e.message&&("string"==typeof t||t&&t.message)&&((n=u.copy(e)).message=e.message),e.message=e.message||null,"string"==typeof t?e.message=t:"object"==typeof t&&null!==t&&(u.update(e,t),t.message&&(e.message=t.message),(t.code||t.name)&&(e.code=t.code||t.name),t.stack&&(e.stack=t.stack)),"function"==typeof Object.defineProperty&&(Object.defineProperty(e,"name",{writable:!0,enumerable:!1}),Object.defineProperty(e,"message",{enumerable:!0})),e.name=t&&t.name||e.name||e.code||"Error",e.time=new Date,n&&(e.originalError=n),e},inherit:function(e,t){var n,o=null,o=void 0===t?(t=e,e=Object,{}):((n=function(){}).prototype=e.prototype,new n);return t.constructor===Object&&(t.constructor=function(){if(e!==Object)return e.apply(this,arguments)}),t.constructor.prototype=o,u.update(t.constructor.prototype,t),t.constructor.__super__=e,t.constructor},mixin:function(e){for(var t=e,n=1;n<arguments.length;n++)for(var o in arguments[n].prototype){var r=arguments[n].prototype[o];"constructor"!==o&&(t.prototype[o]=r)}return t},hideProperties:function(t,e){"function"==typeof Object.defineProperty&&u.arrayEach(e,function(e){Object.defineProperty(t,e,{enumerable:!1,writable:!0,configurable:!0})})},property:function(e,t,n,o,r){o={configurable:!0,enumerable:void 0===o||o};"function"!=typeof n||r?(o.value=n,o.writable=!0):o.get=n,Object.defineProperty(e,t,o)},memoizedProperty:function(e,t,n,o){var r=null;u.property(e,t,function(){return null===r&&(r=n()),r},o)},hoistPayloadMember:function(n){var e=n.request,t=e.operation,e=e.service.api.operations[t],t=e.output;t.payload&&!e.hasEventOutput&&(e=t.members[t.payload],t=n.data[t.payload],"structure"===e.type&&u.each(t,function(e,t){u.property(n.data,e,t,!1)}))},computeSha256:function(e,n){if(u.isNode()){var t=u.stream.Stream,o=r("fs");if("function"==typeof t&&e instanceof t){if("string"!=typeof e.path)return n(new Error("Non-file stream objects are not supported with SigV4"));t={};"number"==typeof e.start&&(t.start=e.start),"number"==typeof e.end&&(t.end=e.end),e=o.createReadStream(e.path,t)}}u.crypto.sha256(e,"hex",function(e,t){e?n(e):n(null,t)})},isClockSkewed:function(e){if(e)return u.property(a.config,"isClockSkewed",3e5<=Math.abs((new Date).getTime()-e),!1),a.config.isClockSkewed},applyClockOffset:function(e){e&&(a.config.systemClockOffset=e-(new Date).getTime())},extractRequestId:function(e){var t=e.httpResponse.headers["x-amz-request-id"]||e.httpResponse.headers["x-amzn-requestid"];!t&&e.data&&e.data.ResponseMetadata&&(t=e.data.ResponseMetadata.RequestId),t&&(e.requestId=t),e.error&&(e.error.requestId=t)},addPromises:function(e,t){var n=!1;void 0===t&&a&&a.config&&(t=a.config.getPromisesDependency()),void 0===t&&"undefined"!=typeof Promise&&(t=Promise),"function"!=typeof t&&(n=!0),Array.isArray(e)||(e=[e]);for(var o=0;o<e.length;o++){var r=e[o];n?r.deletePromisesFromClass&&r.deletePromisesFromClass():r.addPromisesToClass&&r.addPromisesToClass(t)}},promisifyMethod:function(r,n){return function(){var e=this,t=Array.prototype.slice.call(arguments);return new n(function(n,o){t.push(function(e,t){e?o(e):n(t)}),e[r].apply(e,t)})}},isDualstackAvailable:function(e){if(!e)return!1;var t=r("../apis/metadata.json");return"string"!=typeof e&&(e=e.serviceIdentifier),!("string"!=typeof e||!t.hasOwnProperty(e))&&!!t[e].dualstackAvailable},calculateRetryDelay:function(e,t){var n=(t=t||{}).customBackoff||null;if("function"==typeof n)return n(e);t="number"==typeof t.base?t.base:100;return Math.random()*(Math.pow(2,e)*t)},handleRequestWithRetries:function(e,n,r){n=n||{};function i(e){var t=n.maxRetries||0;e&&"TimeoutError"===e.code&&(e.retryable=!0),e&&e.retryable&&o<t?(o++,t=u.calculateRetryDelay(o,n.retryDelayOptions),setTimeout(c,t+(e.retryAfter||0))):r(e)}var t=a.HttpClient.getInstance(),s=n.httpOptions||{},o=0,c=function(){var o="";t.handleRequest(e,s,function(n){n.on("data",function(e){o+=e.toString()}),n.on("end",function(){var e,t=n.statusCode;t<300?r(null,o):(e=1e3*parseInt(n.headers["retry-after"],10)||0,t=u.error(new Error,{retryable:500<=t||429===t}),e&&t.retryable&&(t.retryAfter=e),i(t))})},i)};a.util.defer(c)},uuid:{v4:function(){return r("uuid").v4()}},convertPayloadToString:function(e){var t=e.request,n=t.operation,n=t.service.api.operations[n].output||{};n.payload&&e.data[n.payload]&&(e.data[n.payload]=e.data[n.payload].toString())},defer:function(e){"object"==typeof c&&"function"==typeof c.nextTick?c.nextTick(e):"function"==typeof t?t(e):setTimeout(e,0)},getRequestPayloadShape:function(e){var t=e.service.api.operations;if(t){e=(t||{})[e.operation];if(e&&e.input&&e.input.payload)return e.input.members[e.input.payload]}},getProfilesFromSharedConfig:function(e,t){var n={},o={};c.env[u.configOptInEnv]&&(o=e.loadFrom({isConfig:!0,filename:c.env[u.sharedConfigFileEnv]}));for(var r=e.loadFrom({filename:t||c.env[u.configOptInEnv]&&c.env[u.sharedCredentialsFileEnv]}),i=0,s=Object.keys(o);i<s.length;i++)n[s[i]]=o[s[i]];for(i=0,s=Object.keys(r);i<s.length;i++)n[s[i]]=r[s[i]];return n},defaultProfile:"default",configOptInEnv:"AWS_SDK_LOAD_CONFIG",sharedCredentialsFileEnv:"AWS_SHARED_CREDENTIALS_FILE",sharedConfigFileEnv:"AWS_CONFIG_FILE",imdsDisabledEnv:"AWS_EC2_METADATA_DISABLED"};e.exports=u}).call(this,r("_process"),r("timers").setImmediate)},{"../apis/metadata.json":4,"./core":18,_process:85,fs:79,timers:93,uuid:98}],72:[function(e,t,n){var s=e("../util"),o=e("../model/shape");function r(){}function u(e,t){for(var n=e.getElementsByTagName(t),o=0,r=n.length;o<r;o++)if(n[o].parentNode===e)return n[o]}function l(e,t){switch((t=t||{}).type){case"structure":return i(e,t);case"map":return function(e,t){var n={},o=t.key.name||"key",r=t.value.name||"value",i=t.flattened?t.name:"entry",s=e.firstElementChild;for(;s;){var c,a;s.nodeName===i&&(c=u(s,o).textContent,a=u(s,r),n[c]=l(a,t.value)),s=s.nextElementSibling}return n}(e,t);case"list":return function(e,t){var n=[],o=t.flattened?t.name:t.member.name||"member",r=e.firstElementChild;for(;r;)r.nodeName===o&&n.push(l(r,t.member)),r=r.nextElementSibling;return n}(e,t);case void 0:case null:return function(e){if(null==e)return"";if(!e.firstElementChild)return null===e.parentNode.parentNode?{}:0===e.childNodes.length?"":e.textContent;var t={type:"structure",members:{}},n=e.firstElementChild;for(;n;){var o=n.nodeName;Object.prototype.hasOwnProperty.call(t.members,o)?t.members[o].type="list":t.members[o]={name:o},n=n.nextElementSibling}return i(e,t)}(e);default:return function(e,t){{var n;!e.getAttribute||"base64"===(n=e.getAttribute("encoding"))&&(t=new o.create({type:n}))}e=e.textContent;""===e&&(e=null);return"function"==typeof t.toType?t.toType(e):e}(e,t)}}function i(o,e){var r={};return null===o||s.each(e.members,function(e,t){var n;t.isXmlAttribute?Object.prototype.hasOwnProperty.call(o.attributes,t.name)&&(n=o.attributes[t.name].value,r[e]=l({textContent:n},t)):(n=t.flattened?o:u(o,t.name))?r[e]=l(n,t):t.flattened||"list"!==t.type||(r[e]=t.defaultValue)}),r}r.prototype.parse=function(e,t){if(""===e.replace(/^\s+/,""))return{};var n;try{if(window.DOMParser){try{var o=(new DOMParser).parseFromString(e,"text/xml")}catch(e){throw s.error(new Error("Parse error in document"),{originalError:e,code:"XMLParserError",retryable:!0})}if(null===o.documentElement)throw s.error(new Error("Cannot parse empty document."),{code:"XMLParserError",retryable:!0});var r=o.getElementsByTagName("parsererror")[0];if(r&&(r.parentNode===o||"body"===r.parentNode.nodeName||r.parentNode.parentNode===o||"body"===r.parentNode.parentNode.nodeName)){r=r.getElementsByTagName("div")[0]||r;throw s.error(new Error(r.textContent||"Parser error in document"),{code:"XMLParserError",retryable:!0})}}else{if(!window.ActiveXObject)throw new Error("Cannot load XML parser");if((o=new window.ActiveXObject("Microsoft.XMLDOM")).async=!1,!o.loadXML(e))throw s.error(new Error("Parse error in document"),{code:"XMLParserError",retryable:!0})}}catch(e){n=e}if(o&&o.documentElement&&!n){var i=l(o.documentElement,t),t=u(o.documentElement,"ResponseMetadata");return t&&(i.ResponseMetadata=l(t,{})),i}if(n)throw s.error(n||new Error,{code:"XMLParserError",retryable:!0});return{}},t.exports=r},{"../model/shape":43,"../util":71}],73:[function(e,t,n){var f=e("../util"),g=e("./xml-node").XmlNode,m=e("./xml-text").XmlText;function o(){}function y(e,t,n){switch(n.type){case"structure":return p=e,h=t,d=n,f.arrayEach(d.memberNames,function(e){var t,n=d.members[e];"body"===n.location&&(t=h[e],e=n.name,null!=t&&(n.isXmlAttribute?p.addAttribute(e,t):n.flattened?y(p,t,n):(e=new g(e),p.addChildNode(e),v(e,n),y(e,t,n))))}),0;case"map":return s=e,c=t,u=(a=n).key.name||"key",l=a.value.name||"value",f.each(c,function(e,t){var n=new g(a.flattened?a.name:"entry");s.addChildNode(n);var o=new g(u),r=new g(l);n.addChildNode(o),n.addChildNode(r),y(o,e,a.key),y(r,t,a.value)}),0;case"list":return o=e,r=t,(i=n).flattened?f.arrayEach(r,function(e){var t=i.member.name||i.name,t=new g(t);o.addChildNode(t),y(t,e,i.member)}):f.arrayEach(r,function(e){var t=i.member.name||"member",t=new g(t);o.addChildNode(t),y(t,e,i.member)}),0;default:return c=t,r=n,e.addChildNode(new m(r.toWireFormat(c))),0}var o,r,i,s,c,a,u,l,p,h,d}function v(e,t,n){var o,r="xmlns";t.xmlNamespaceUri?(o=t.xmlNamespaceUri,t.xmlNamespacePrefix&&(r+=":"+t.xmlNamespacePrefix)):n&&t.api.xmlNamespaceUri&&(o=t.api.xmlNamespaceUri),o&&e.addAttribute(r,o)}o.prototype.toXML=function(e,t,n,o){n=new g(n);return v(n,t,!0),y(n,e,t),0<n.children.length||o?n.toString():""},t.exports=o},{"../util":71,"./xml-node":76,"./xml-text":77}],74:[function(e,t,n){t.exports={escapeAttribute:function(e){return e.replace(/&/g,"&amp;").replace(/'/g,"&apos;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}}},{}],75:[function(e,t,n){t.exports={escapeElement:function(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}}},{}],76:[function(e,t,n){var c=e("./escape-attribute").escapeAttribute;function o(e,t){void 0===t&&(t=[]),this.name=e,this.children=t,this.attributes={}}o.prototype.addAttribute=function(e,t){return this.attributes[e]=t,this},o.prototype.addChildNode=function(e){return this.children.push(e),this},o.prototype.removeAttribute=function(e){return delete this.attributes[e],this},o.prototype.toString=function(){for(var e=Boolean(this.children.length),t="<"+this.name,n=this.attributes,o=0,r=Object.keys(n);o<r.length;o++){var i=r[o],s=n[i];null!=s&&(t+=" "+i+'="'+c(""+s)+'"')}return t+(e?">"+this.children.map(function(e){return e.toString()}).join("")+"</"+this.name+">":"/>")},t.exports={XmlNode:o}},{"./escape-attribute":74}],77:[function(e,t,n){var o=e("./escape-element").escapeElement;function r(e){this.value=e}r.prototype.toString=function(){return o(""+this.value)},t.exports={XmlText:r}},{"./escape-element":75}],78:[function(e,t,n){"use strict";n.byteLength=function(e){var t=l(e),e=t[0],t=t[1];return 3*(e+t)/4-t},n.toByteArray=function(e){var t,n,o=l(e),r=o[0],o=o[1],i=new u(function(e,t){return 3*(e+t)/4-t}(r,o)),s=0,c=0<o?r-4:r;for(n=0;n<c;n+=4)t=a[e.charCodeAt(n)]<<18|a[e.charCodeAt(n+1)]<<12|a[e.charCodeAt(n+2)]<<6|a[e.charCodeAt(n+3)],i[s++]=t>>16&255,i[s++]=t>>8&255,i[s++]=255&t;2===o&&(t=a[e.charCodeAt(n)]<<2|a[e.charCodeAt(n+1)]>>4,i[s++]=255&t);1===o&&(t=a[e.charCodeAt(n)]<<10|a[e.charCodeAt(n+1)]<<4|a[e.charCodeAt(n+2)]>>2,i[s++]=t>>8&255,i[s++]=255&t);return i},n.fromByteArray=function(e){for(var t,n=e.length,o=n%3,r=[],i=0,s=n-o;i<s;i+=16383)r.push(function(e,t,n){for(var o,r=[],i=t;i<n;i+=3)o=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(255&e[i+2]),r.push(function(e){return c[e>>18&63]+c[e>>12&63]+c[e>>6&63]+c[63&e]}(o));return r.join("")}(e,i,s<i+16383?s:i+16383));1==o?(t=e[n-1],r.push(c[t>>2]+c[t<<4&63]+"==")):2==o&&(t=(e[n-2]<<8)+e[n-1],r.push(c[t>>10]+c[t>>4&63]+c[t<<2&63]+"="));return r.join("")};for(var c=[],a=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,i=o.length;r<i;++r)c[r]=o[r],a[o.charCodeAt(r)]=r;function l(e){var t=e.length;if(0<t%4)throw new Error("Invalid string. Length must be a multiple of 4");e=e.indexOf("=");return-1===e&&(e=t),[e,e===t?0:4-e%4]}a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63},{}],79:[function(e,t,n){},{}],80:[function(L,e,x){(function(e,p){"use strict";var c=L("base64-js"),i=L("ieee754"),s=L("isarray");function n(){return p.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function r(e,t){if(n()<t)throw new RangeError("Invalid typed array length");return p.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=p.prototype:(null===e&&(e=new p(t)),e.length=t),e}function p(e,t,n){if(!(p.TYPED_ARRAY_SUPPORT||this instanceof p))return new p(e,t,n);if("number"!=typeof e)return o(this,e,t,n);if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return u(this,e)}function o(e,t,n,o){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,o){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(o||0))throw new RangeError("'length' is out of bounds");t=void 0===n&&void 0===o?new Uint8Array(t):void 0===o?new Uint8Array(t,n):new Uint8Array(t,n,o);p.TYPED_ARRAY_SUPPORT?(e=t).__proto__=p.prototype:e=l(e,t);return e}(e,t,n,o):"string"==typeof t?function(e,t,n){"string"==typeof n&&""!==n||(n="utf8");if(!p.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var o=0|d(t,n),n=(e=r(e,o)).write(t,n);n!==o&&(e=e.slice(0,n));return e}(e,t,n):function(e,t){if(p.isBuffer(t)){var n=0|h(t.length);return 0===(e=r(e,n)).length?e:(t.copy(e,0,0,n),e)}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||function(e){return e!=e}(t.length)?r(e,0):l(e,t);if("Buffer"===t.type&&s(t.data))return l(e,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function a(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function u(e,t){if(a(t),e=r(e,t<0?0:0|h(t)),!p.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function l(e,t){var n=t.length<0?0:0|h(t.length);e=r(e,n);for(var o=0;o<n;o+=1)e[o]=255&t[o];return e}function h(e){if(e>=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|e}function d(e,t){if(p.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var o=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return k(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return N(e).length;default:if(o)return k(e).length;t=(""+t).toLowerCase(),o=!0}}function t(e,t,n){var o,r,i,s=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":return function(e,t,n){var o=e.length;(!t||t<0)&&(t=0);(!n||n<0||o<n)&&(n=o);for(var r="",i=t;i<n;++i)r+=function(e){return e<16?"0"+e.toString(16):e.toString(16)}(e[i]);return r}(this,t,n);case"utf8":case"utf-8":return E(this,t,n);case"ascii":return function(e,t,n){var o="";n=Math.min(e.length,n);for(var r=t;r<n;++r)o+=String.fromCharCode(127&e[r]);return o}(this,t,n);case"latin1":case"binary":return function(e,t,n){var o="";n=Math.min(e.length,n);for(var r=t;r<n;++r)o+=String.fromCharCode(e[r]);return o}(this,t,n);case"base64":return o=this,i=n,0===(r=t)&&i===o.length?c.fromByteArray(o):c.fromByteArray(o.slice(r,i));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,n){for(var o=e.slice(t,n),r="",i=0;i<o.length;i+=2)r+=String.fromCharCode(o[i]+256*o[i+1]);return r}(this,t,n);default:if(s)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),s=!0}}function f(e,t,n){var o=e[t];e[t]=e[n],e[n]=o}function g(e,t,n,o,r){if(0===e.length)return-1;if("string"==typeof n?(o=n,n=0):2147483647<n?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=r?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(r)return-1;n=e.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof t&&(t=p.from(t,o)),p.isBuffer(t))return 0===t.length?-1:m(e,t,n,o,r);if("number"==typeof t)return t&=255,p.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?(r?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,n):m(e,[t],n,o,r);throw new TypeError("val must be string, number or Buffer")}function m(e,t,n,o,r){var i=1,s=e.length,c=t.length;if(void 0!==o&&("ucs2"===(o=String(o).toLowerCase())||"ucs-2"===o||"utf16le"===o||"utf-16le"===o)){if(e.length<2||t.length<2)return-1;s/=i=2,c/=2,n/=2}function a(e,t){return 1===i?e[t]:e.readUInt16BE(t*i)}if(r)for(var u=-1,l=n;l<s;l++)if(a(e,l)===a(t,-1===u?0:l-u)){if(-1===u&&(u=l),l-u+1===c)return u*i}else-1!==u&&(l-=l-u),u=-1;else for(s<n+c&&(n=s-c),l=n;0<=l;l--){for(var p=!0,h=0;h<c;h++)if(a(e,l+h)!==a(t,h)){p=!1;break}if(p)return l}return-1}function y(e,t,n,o){return O(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,o)}function v(e,t,n,o){return O(function(e,t){for(var n,o,r=[],i=0;i<e.length&&!((t-=2)<0);++i)o=e.charCodeAt(i),n=o>>8,o=o%256,r.push(o),r.push(n);return r}(t,e.length-n),e,n,o)}function E(e,t,n){n=Math.min(e.length,n);for(var o=[],r=t;r<n;){var i,s,c,a,u=e[r],l=null,p=239<u?4:223<u?3:191<u?2:1;if(r+p<=n)switch(p){case 1:u<128&&(l=u);break;case 2:128==(192&(i=e[r+1]))&&127<(a=(31&u)<<6|63&i)&&(l=a);break;case 3:i=e[r+1],s=e[r+2],128==(192&i)&&128==(192&s)&&2047<(a=(15&u)<<12|(63&i)<<6|63&s)&&(a<55296||57343<a)&&(l=a);break;case 4:i=e[r+1],s=e[r+2],c=e[r+3],128==(192&i)&&128==(192&s)&&128==(192&c)&&65535<(a=(15&u)<<18|(63&i)<<12|(63&s)<<6|63&c)&&a<1114112&&(l=a)}null===l?(l=65533,p=1):65535<l&&(l-=65536,o.push(l>>>10&1023|55296),l=56320|1023&l),o.push(l),r+=p}return function(e){var t=e.length;if(t<=b)return String.fromCharCode.apply(String,e);var n="",o=0;for(;o<t;)n+=String.fromCharCode.apply(String,e.slice(o,o+=b));return n}(o)}x.Buffer=p,x.SlowBuffer=function(e){+e!=e&&(e=0);return p.alloc(+e)},x.INSPECT_MAX_BYTES=50,p.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),x.kMaxLength=n(),p.poolSize=8192,p._augment=function(e){return e.__proto__=p.prototype,e},p.from=function(e,t,n){return o(null,e,t,n)},p.TYPED_ARRAY_SUPPORT&&(p.prototype.__proto__=Uint8Array.prototype,p.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&p[Symbol.species]===p&&Object.defineProperty(p,Symbol.species,{value:null,configurable:!0})),p.alloc=function(e,t,n){return o=null,t=t,n=n,a(e=e),!(e<=0)&&void 0!==t?"string"==typeof n?r(o,e).fill(t,n):r(o,e).fill(t):r(o,e);var o},p.allocUnsafe=function(e){return u(null,e)},p.allocUnsafeSlow=function(e){return u(null,e)},p.isBuffer=function(e){return!(null==e||!e._isBuffer)},p.compare=function(e,t){if(!p.isBuffer(e)||!p.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,o=t.length,r=0,i=Math.min(n,o);r<i;++r)if(e[r]!==t[r]){n=e[r],o=t[r];break}return n<o?-1:o<n?1:0},p.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},p.concat=function(e,t){if(!s(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return p.alloc(0);if(void 0===t)for(r=t=0;r<e.length;++r)t+=e[r].length;for(var n=p.allocUnsafe(t),o=0,r=0;r<e.length;++r){var i=e[r];if(!p.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,o),o+=i.length}return n},p.byteLength=d,p.prototype._isBuffer=!0,p.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)f(this,t,t+1);return this},p.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)f(this,t,t+3),f(this,t+1,t+2);return this},p.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)f(this,t,t+7),f(this,t+1,t+6),f(this,t+2,t+5),f(this,t+3,t+4);return this},p.prototype.toString=function(){var e=0|this.length;return 0==e?"":0===arguments.length?E(this,0,e):t.apply(this,arguments)},p.prototype.equals=function(e){if(!p.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===p.compare(this,e)},p.prototype.inspect=function(){var e="",t=x.INSPECT_MAX_BYTES;return 0<this.length&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),"<Buffer "+e+">"},p.prototype.compare=function(e,t,n,o,r){if(!p.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===o&&(o=0),void 0===r&&(r=this.length),t<0||n>e.length||o<0||r>this.length)throw new RangeError("out of range index");if(r<=o&&n<=t)return 0;if(r<=o)return-1;if(n<=t)return 1;if(this===e)return 0;for(var i=(r>>>=0)-(o>>>=0),s=(n>>>=0)-(t>>>=0),c=Math.min(i,s),a=this.slice(o,r),u=e.slice(t,n),l=0;l<c;++l)if(a[l]!==u[l]){i=a[l],s=u[l];break}return i<s?-1:s<i?1:0},p.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},p.prototype.indexOf=function(e,t,n){return g(this,e,t,n,!0)},p.prototype.lastIndexOf=function(e,t,n){return g(this,e,t,n,!1)},p.prototype.write=function(e,t,n,o){if(void 0===t)o="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)o=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===o&&(o="utf8")):(o=n,n=void 0)}var r=this.length-t;if((void 0===n||r<n)&&(n=r),0<e.length&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");o=o||"utf8";for(var i,s,c,a=!1;;)switch(o){case"hex":return function(e,t,n,o){n=Number(n)||0;var r=e.length-n;if((!o||r<(o=Number(o)))&&(o=r),(r=t.length)%2!=0)throw new TypeError("Invalid hex string");r/2<o&&(o=r/2);for(var i=0;i<o;++i){var s=parseInt(t.substr(2*i,2),16);if(isNaN(s))return i;e[n+i]=s}return i}(this,e,t,n);case"utf8":case"utf-8":return s=t,c=n,O(k(e,(i=this).length-s),i,s,c);case"ascii":return y(this,e,t,n);case"latin1":case"binary":return y(this,e,t,n);case"base64":return i=this,s=t,c=n,O(N(e),i,s,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return v(this,e,t,n);default:if(a)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),a=!0}},p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var b=4096;function S(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(n<e+t)throw new RangeError("Trying to access beyond buffer length")}function C(e,t,n,o,r,i){if(!p.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(r<t||t<i)throw new RangeError('"value" argument is out of bounds');if(n+o>e.length)throw new RangeError("Index out of range")}function T(e,t,n,o){t<0&&(t=65535+t+1);for(var r=0,i=Math.min(e.length-n,2);r<i;++r)e[n+r]=(t&255<<8*(o?r:1-r))>>>8*(o?r:1-r)}function I(e,t,n,o){t<0&&(t=4294967295+t+1);for(var r=0,i=Math.min(e.length-n,4);r<i;++r)e[n+r]=t>>>8*(o?r:3-r)&255}function A(e,t,n,o){if(n+o>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function _(e,t,n,o,r){return r||A(e,0,n,4),i.write(e,t,n,o,23,4),n+4}function w(e,t,n,o,r){return r||A(e,0,n,8),i.write(e,t,n,o,52,8),n+8}p.prototype.slice=function(e,t){var n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):n<e&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):n<t&&(t=n),t<e&&(t=e),p.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=p.prototype;else for(var o=t-e,r=new p(o,void 0),i=0;i<o;++i)r[i]=this[i+e];return r},p.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||S(e,t,this.length);for(var o=this[e],r=1,i=0;++i<t&&(r*=256);)o+=this[e+i]*r;return o},p.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||S(e,t,this.length);for(var o=this[e+--t],r=1;0<t&&(r*=256);)o+=this[e+--t]*r;return o},p.prototype.readUInt8=function(e,t){return t||S(e,1,this.length),this[e]},p.prototype.readUInt16LE=function(e,t){return t||S(e,2,this.length),this[e]|this[e+1]<<8},p.prototype.readUInt16BE=function(e,t){return t||S(e,2,this.length),this[e]<<8|this[e+1]},p.prototype.readUInt32LE=function(e,t){return t||S(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},p.prototype.readUInt32BE=function(e,t){return t||S(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},p.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||S(e,t,this.length);for(var o=this[e],r=1,i=0;++i<t&&(r*=256);)o+=this[e+i]*r;return(r*=128)<=o&&(o-=Math.pow(2,8*t)),o},p.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||S(e,t,this.length);for(var o=t,r=1,i=this[e+--o];0<o&&(r*=256);)i+=this[e+--o]*r;return(r*=128)<=i&&(i-=Math.pow(2,8*t)),i},p.prototype.readInt8=function(e,t){return t||S(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},p.prototype.readInt16LE=function(e,t){t||S(e,2,this.length);e=this[e]|this[e+1]<<8;return 32768&e?4294901760|e:e},p.prototype.readInt16BE=function(e,t){t||S(e,2,this.length);e=this[e+1]|this[e]<<8;return 32768&e?4294901760|e:e},p.prototype.readInt32LE=function(e,t){return t||S(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},p.prototype.readInt32BE=function(e,t){return t||S(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},p.prototype.readFloatLE=function(e,t){return t||S(e,4,this.length),i.read(this,e,!0,23,4)},p.prototype.readFloatBE=function(e,t){return t||S(e,4,this.length),i.read(this,e,!1,23,4)},p.prototype.readDoubleLE=function(e,t){return t||S(e,8,this.length),i.read(this,e,!0,52,8)},p.prototype.readDoubleBE=function(e,t){return t||S(e,8,this.length),i.read(this,e,!1,52,8)},p.prototype.writeUIntLE=function(e,t,n,o){e=+e,t|=0,n|=0,o||C(this,e,t,n,Math.pow(2,8*n)-1,0);var r=1,i=0;for(this[t]=255&e;++i<n&&(r*=256);)this[t+i]=e/r&255;return t+n},p.prototype.writeUIntBE=function(e,t,n,o){e=+e,t|=0,n|=0,o||C(this,e,t,n,Math.pow(2,8*n)-1,0);var r=n-1,i=1;for(this[t+r]=255&e;0<=--r&&(i*=256);)this[t+r]=e/i&255;return t+n},p.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,1,255,0),p.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},p.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,2,65535,0),p.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):T(this,e,t,!0),t+2},p.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,2,65535,0),p.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):T(this,e,t,!1),t+2},p.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,4,4294967295,0),p.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):I(this,e,t,!0),t+4},p.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,4,4294967295,0),p.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):I(this,e,t,!1),t+4},p.prototype.writeIntLE=function(e,t,n,o){e=+e,t|=0,o||C(this,e,t,n,(o=Math.pow(2,8*n-1))-1,-o);var r=0,i=1,s=0;for(this[t]=255&e;++r<n&&(i*=256);)e<0&&0===s&&0!==this[t+r-1]&&(s=1),this[t+r]=(e/i>>0)-s&255;return t+n},p.prototype.writeIntBE=function(e,t,n,o){e=+e,t|=0,o||C(this,e,t,n,(o=Math.pow(2,8*n-1))-1,-o);var r=n-1,i=1,s=0;for(this[t+r]=255&e;0<=--r&&(i*=256);)e<0&&0===s&&0!==this[t+r+1]&&(s=1),this[t+r]=(e/i>>0)-s&255;return t+n},p.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,1,127,-128),p.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},p.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,2,32767,-32768),p.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):T(this,e,t,!0),t+2},p.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,2,32767,-32768),p.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):T(this,e,t,!1),t+2},p.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,4,2147483647,-2147483648),p.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):I(this,e,t,!0),t+4},p.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||C(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),p.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):I(this,e,t,!1),t+4},p.prototype.writeFloatLE=function(e,t,n){return _(this,e,t,!0,n)},p.prototype.writeFloatBE=function(e,t,n){return _(this,e,t,!1,n)},p.prototype.writeDoubleLE=function(e,t,n){return w(this,e,t,!0,n)},p.prototype.writeDoubleBE=function(e,t,n){return w(this,e,t,!1,n)},p.prototype.copy=function(e,t,n,o){if(n=n||0,o||0===o||(o=this.length),t>=e.length&&(t=e.length),t=t||0,0<o&&o<n&&(o=n),o===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),e.length-t<o-n&&(o=e.length-t+n);var r,i=o-n;if(this===e&&n<t&&t<o)for(r=i-1;0<=r;--r)e[r+t]=this[r+n];else if(i<1e3||!p.TYPED_ARRAY_SUPPORT)for(r=0;r<i;++r)e[r+t]=this[r+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+i),t);return i},p.prototype.fill=function(e,t,n,o){if("string"==typeof e){var r;if("string"==typeof t?(o=t,t=0,n=this.length):"string"==typeof n&&(o=n,n=this.length),1!==e.length||(r=e.charCodeAt(0))<256&&(e=r),void 0!==o&&"string"!=typeof o)throw new TypeError("encoding must be a string");if("string"==typeof o&&!p.isEncoding(o))throw new TypeError("Unknown encoding: "+o)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;if(t>>>=0,n=void 0===n?this.length:n>>>0,"number"==typeof(e=e||0))for(c=t;c<n;++c)this[c]=e;else for(var i=p.isBuffer(e)?e:k(new p(e,o).toString()),s=i.length,c=0;c<n-t;++c)this[c+t]=i[c%s];return this};var R=/[^+\/0-9A-Za-z-_]/g;function k(e,t){var n;t=t||1/0;for(var o=e.length,r=null,i=[],s=0;s<o;++s){if(55295<(n=e.charCodeAt(s))&&n<57344){if(!r){if(56319<n){-1<(t-=3)&&i.push(239,191,189);continue}if(s+1===o){-1<(t-=3)&&i.push(239,191,189);continue}r=n;continue}if(n<56320){-1<(t-=3)&&i.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&-1<(t-=3)&&i.push(239,191,189);if(r=null,n<128){if(--t<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function N(e){return c.toByteArray(function(e){var t;if((e=((t=e).trim?t.trim():t.replace(/^\s+|\s+$/g,"")).replace(R,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function O(e,t,n,o){for(var r=0;r<o&&!(r+n>=t.length||r>=e.length);++r)t[r+n]=e[r];return r}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},L("buffer").Buffer)},{"base64-js":78,buffer:80,ieee754:82,isarray:83}],81:[function(e,t,n){function o(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function a(e){return"function"==typeof e}function u(e){return"object"==typeof e&&null!==e}function l(e){return void 0===e}((t.exports=o).EventEmitter=o).prototype._events=void 0,o.prototype._maxListeners=void 0,o.defaultMaxListeners=10,o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},o.prototype.emit=function(e){var t,n,o,r,i,s;if(this._events||(this._events={}),"error"===e&&(!this._events.error||u(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(l(n=this._events[e]))return!1;if(a(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:r=Array.prototype.slice.call(arguments,1),n.apply(this,r)}else if(u(n))for(r=Array.prototype.slice.call(arguments,1),o=(s=n.slice()).length,i=0;i<o;i++)s[i].apply(this,r);return!0},o.prototype.on=o.prototype.addListener=function(e,t){var n;if(!a(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,a(t.listener)?t.listener:t),this._events[e]?u(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,u(this._events[e])&&!this._events[e].warned&&(n=l(this._maxListeners)?o.defaultMaxListeners:this._maxListeners)&&0<n&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},o.prototype.once=function(e,t){if(!a(t))throw TypeError("listener must be a function");var n=!1;function o(){this.removeListener(e,o),n||(n=!0,t.apply(this,arguments))}return o.listener=t,this.on(e,o),this},o.prototype.removeListener=function(e,t){var n,o,r,i;if(!a(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=(n=this._events[e]).length,o=-1,n===t||a(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(u(n)){for(i=r;0<i--;)if(n[i]===t||n[i].listener&&n[i].listener===t){o=i;break}if(o<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(o,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},o.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(a(n=this._events[e]))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},o.prototype.listeners=function(e){e=this._events&&this._events[e]?a(this._events[e])?[this._events[e]]:this._events[e].slice():[];return e},o.prototype.listenerCount=function(e){if(this._events){e=this._events[e];if(a(e))return 1;if(e)return e.length}return 0},o.listenerCount=function(e,t){return e.listenerCount(t)}},{}],82:[function(e,t,n){n.read=function(e,t,n,o,r){var i,s,c=8*r-o-1,a=(1<<c)-1,u=a>>1,l=-7,p=n?r-1:0,h=n?-1:1,n=e[t+p];for(p+=h,i=n&(1<<-l)-1,n>>=-l,l+=c;0<l;i=256*i+e[t+p],p+=h,l-=8);for(s=i&(1<<-l)-1,i>>=-l,l+=o;0<l;s=256*s+e[t+p],p+=h,l-=8);if(0===i)i=1-u;else{if(i===a)return s?NaN:1/0*(n?-1:1);s+=Math.pow(2,o),i-=u}return(n?-1:1)*s*Math.pow(2,i-o)},n.write=function(e,t,n,o,r,i){var s,c,a=8*i-r-1,u=(1<<a)-1,l=u>>1,p=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,h=o?0:i-1,d=o?1:-1,i=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(c=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(o=Math.pow(2,-s))<1&&(s--,o*=2),2<=(t+=1<=s+l?p/o:p*Math.pow(2,1-l))*o&&(s++,o/=2),u<=s+l?(c=0,s=u):1<=s+l?(c=(t*o-1)*Math.pow(2,r),s+=l):(c=t*Math.pow(2,l-1)*Math.pow(2,r),s=0));8<=r;e[n+h]=255&c,h+=d,c/=256,r-=8);for(s=s<<r|c,a+=r;0<a;e[n+h]=255&s,h+=d,s/=256,a-=8);e[n+h-d]|=128*i}},{}],83:[function(e,t,n){var o={}.toString;t.exports=Array.isArray||function(e){return"[object Array]"==o.call(e)}},{}],84:[function(e,t,n){!function(e){"use strict";function T(e){return null!==e&&"[object Array]"===Object.prototype.toString.call(e)}function I(e){return null!==e&&"[object Object]"===Object.prototype.toString.call(e)}function A(e,t){if(e===t)return!0;if(Object.prototype.toString.call(e)!==Object.prototype.toString.call(t))return!1;if(!0===T(e)){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!1===A(e[n],t[n]))return!1;return!0}if(!0!==I(e))return!1;var o,r,i={};for(o in e)if(hasOwnProperty.call(e,o)){if(!1===A(e[o],t[o]))return!1;i[o]=!0}for(r in t)if(hasOwnProperty.call(t,r)&&!0!==i[r])return!1;return!0}function _(e){if(""===e||!1===e||null===e)return!0;if(T(e)&&0===e.length)return!0;if(I(e)){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}return!1}var r="function"==typeof String.prototype.trimLeft?function(e){return e.trimLeft()}:function(e){return e.match(/^\s*(.*)/)[1]},u=0,i=1,l=2,s=3,t=4,n=6,c=8,a=9,p="UnquotedIdentifier",h="QuotedIdentifier",d="Rbracket",f="Rparen",g="Comma",m="Colon",o="Rbrace",y="Number",w="Current",R="Expref",k="Pipe",N="GTE",O="LTE",L="Flatten",v="Star",E="Filter",b="Dot",S="Lbrace",C="Lbracket",x="Lparen",D="Literal",P={".":b,"*":v,",":g,":":m,"{":S,"}":o,"]":d,"(":x,")":f,"@":w},M={"<":!0,">":!0,"=":!0,"!":!0},U={" ":!0,"\t":!0,"\n":!0};function q(e){return"0"<=e&&e<="9"||"-"===e}function F(){}F.prototype={tokenize:function(e){var t,n,o,r,i=[];for(this._current=0;this._current<e.length;)if("a"<=(r=e[this._current])&&r<="z"||"A"<=r&&r<="Z"||"_"===r)t=this._current,n=this._consumeUnquotedIdentifier(e),i.push({type:p,value:n,start:t});else if(void 0!==P[e[this._current]])i.push({type:P[e[this._current]],value:e[this._current],start:this._current}),this._current++;else if(q(e[this._current]))o=this._consumeNumber(e),i.push(o);else if("["===e[this._current])o=this._consumeLBracket(e),i.push(o);else if('"'===e[this._current])t=this._current,n=this._consumeQuotedIdentifier(e),i.push({type:h,value:n,start:t});else if("'"===e[this._current])t=this._current,n=this._consumeRawStringLiteral(e),i.push({type:D,value:n,start:t});else if("`"===e[this._current]){t=this._current;var s=this._consumeLiteral(e);i.push({type:D,value:s,start:t})}else if(void 0!==M[e[this._current]])i.push(this._consumeOperator(e));else if(void 0!==U[e[this._current]])this._current++;else if("&"===e[this._current])t=this._current,this._current++,"&"===e[this._current]?(this._current++,i.push({type:"And",value:"&&",start:t})):i.push({type:R,value:"&",start:t});else{if("|"!==e[this._current]){s=new Error("Unknown character:"+e[this._current]);throw s.name="LexerError",s}t=this._current,this._current++,"|"===e[this._current]?(this._current++,i.push({type:"Or",value:"||",start:t})):i.push({type:k,value:"|",start:t})}return i},_consumeUnquotedIdentifier:function(e){var t,n=this._current;for(this._current++;this._current<e.length&&("a"<=(t=e[this._current])&&t<="z"||"A"<=t&&t<="Z"||"0"<=t&&t<="9"||"_"===t);)this._current++;return e.slice(n,this._current)},_consumeQuotedIdentifier:function(e){var t=this._current;this._current++;for(var n=e.length;'"'!==e[this._current]&&this._current<n;){var o=this._current;"\\"!==e[o]||"\\"!==e[o+1]&&'"'!==e[o+1]?o++:o+=2,this._current=o}return this._current++,JSON.parse(e.slice(t,this._current))},_consumeRawStringLiteral:function(e){var t=this._current;this._current++;for(var n=e.length;"'"!==e[this._current]&&this._current<n;){var o=this._current;"\\"!==e[o]||"\\"!==e[o+1]&&"'"!==e[o+1]?o++:o+=2,this._current=o}return this._current++,e.slice(t+1,this._current-1).replace("\\'","'")},_consumeNumber:function(e){var t=this._current;this._current++;for(var n=e.length;q(e[this._current])&&this._current<n;)this._current++;var o=parseInt(e.slice(t,this._current));return{type:y,value:o,start:t}},_consumeLBracket:function(e){var t=this._current;return this._current++,"?"===e[this._current]?(this._current++,{type:E,value:"[?",start:t}):"]"===e[this._current]?(this._current++,{type:L,value:"[]",start:t}):{type:C,value:"[",start:t}},_consumeOperator:function(e){var t=this._current,n=e[t];return this._current++,"!"===n?"="===e[this._current]?(this._current++,{type:"NE",value:"!=",start:t}):{type:"Not",value:"!",start:t}:"<"===n?"="===e[this._current]?(this._current++,{type:O,value:"<=",start:t}):{type:"LT",value:"<",start:t}:">"===n?"="===e[this._current]?(this._current++,{type:N,value:">=",start:t}):{type:"GT",value:">",start:t}:"="===n&&"="===e[this._current]?(this._current++,{type:"EQ",value:"==",start:t}):void 0},_consumeLiteral:function(e){this._current++;for(var t=this._current,n=e.length;"`"!==e[this._current]&&this._current<n;){var o=this._current;"\\"!==e[o]||"\\"!==e[o+1]&&"`"!==e[o+1]?o++:o+=2,this._current=o}var t=(t=r(e.slice(t,this._current))).replace("\\`","`"),t=this._looksLikeJSON(t)?JSON.parse(t):JSON.parse('"'+t+'"');return this._current++,t},_looksLikeJSON:function(e){if(""===e)return!1;if(0<='[{"'.indexOf(e[0]))return!0;if(0<=["true","false","null"].indexOf(e))return!0;if(!(0<="-0123456789".indexOf(e[0])))return!1;try{return JSON.parse(e),!0}catch(e){return!1}}};var B={};function j(){}function H(e){this.runtime=e}function V(e){this._interpreter=e,this.functionTable={abs:{_func:this._functionAbs,_signature:[{types:[u]}]},avg:{_func:this._functionAvg,_signature:[{types:[c]}]},ceil:{_func:this._functionCeil,_signature:[{types:[u]}]},contains:{_func:this._functionContains,_signature:[{types:[l,s]},{types:[i]}]},ends_with:{_func:this._functionEndsWith,_signature:[{types:[l]},{types:[l]}]},floor:{_func:this._functionFloor,_signature:[{types:[u]}]},length:{_func:this._functionLength,_signature:[{types:[l,s,t]}]},map:{_func:this._functionMap,_signature:[{types:[n]},{types:[s]}]},max:{_func:this._functionMax,_signature:[{types:[c,a]}]},merge:{_func:this._functionMerge,_signature:[{types:[t],variadic:!0}]},max_by:{_func:this._functionMaxBy,_signature:[{types:[s]},{types:[n]}]},sum:{_func:this._functionSum,_signature:[{types:[c]}]},starts_with:{_func:this._functionStartsWith,_signature:[{types:[l]},{types:[l]}]},min:{_func:this._functionMin,_signature:[{types:[c,a]}]},min_by:{_func:this._functionMinBy,_signature:[{types:[s]},{types:[n]}]},type:{_func:this._functionType,_signature:[{types:[i]}]},keys:{_func:this._functionKeys,_signature:[{types:[t]}]},values:{_func:this._functionValues,_signature:[{types:[t]}]},sort:{_func:this._functionSort,_signature:[{types:[a,c]}]},sort_by:{_func:this._functionSortBy,_signature:[{types:[s]},{types:[n]}]},join:{_func:this._functionJoin,_signature:[{types:[l]},{types:[a]}]},reverse:{_func:this._functionReverse,_signature:[{types:[l,s]}]},to_array:{_func:this._functionToArray,_signature:[{types:[i]}]},to_string:{_func:this._functionToString,_signature:[{types:[i]}]},to_number:{_func:this._functionToNumber,_signature:[{types:[i]}]},not_null:{_func:this._functionNotNull,_signature:[{types:[i],variadic:!0}]}}}B.EOF=0,B[p]=0,B[h]=0,B[d]=0,B[f]=0,B[g]=0,B[o]=0,B[y]=0,B[w]=0,B[R]=0,B[k]=1,B.Or=2,B.And=3,B.EQ=5,B.GT=5,B.LT=5,B.GTE=5,B.LTE=5,B.NE=5,B[L]=9,B[v]=20,B[E]=21,B.Dot=40,B.Not=45,B[S]=50,B[C]=55,B[x]=60,j.prototype={parse:function(e){this._loadTokens(e),this.index=0;e=this.expression(0);if("EOF"===this._lookahead(0))return e;e=this._lookaheadToken(0),e=new Error("Unexpected token type: "+e.type+", value: "+e.value);throw e.name="ParserError",e},_loadTokens:function(e){var t=(new F).tokenize(e);t.push({type:"EOF",value:"",start:e.length}),this.tokens=t},expression:function(e){var t=this._lookaheadToken(0);this._advance();for(var n=this.nud(t),o=this._lookahead(0);e<B[o];)this._advance(),n=this.led(o,n),o=this._lookahead(0);return n},_lookahead:function(e){return this.tokens[this.index+e].type},_lookaheadToken:function(e){return this.tokens[this.index+e]},_advance:function(){this.index++},nud:function(e){var t,n;switch(e.type){case D:return{type:"Literal",value:e.value};case p:return{type:"Field",name:e.value};case h:var o={type:"Field",name:e.value};if(this._lookahead(0)===x)throw new Error("Quoted identifier not allowed for function names.");return o;case"Not":return{type:"NotExpression",children:[t=this.expression(B.Not)]};case v:return t=null,{type:"ValueProjection",children:[{type:"Identity"},t=this._lookahead(0)===d?{type:"Identity"}:this._parseProjectionRHS(B.Star)]};case E:return this.led(e.type,{type:"Identity"});case S:return this._parseMultiselectHash();case L:return{type:"Projection",children:[{type:L,children:[{type:"Identity"}]},t=this._parseProjectionRHS(B.Flatten)]};case C:return this._lookahead(0)===y||this._lookahead(0)===m?(t=this._parseIndexExpression(),this._projectIfSlice({type:"Identity"},t)):this._lookahead(0)===v&&this._lookahead(1)===d?(this._advance(),this._advance(),{type:"Projection",children:[{type:"Identity"},t=this._parseProjectionRHS(B.Star)]}):this._parseMultiselectList();case w:return{type:w};case R:return{type:"ExpressionReference",children:[n=this.expression(B.Expref)]};case x:for(var r=[];this._lookahead(0)!==f;)this._lookahead(0)===w?(n={type:w},this._advance()):n=this.expression(0),r.push(n);return this._match(f),r[0];default:this._errorToken(e)}},led:function(e,t){var n;switch(e){case b:var o=B.Dot;return this._lookahead(0)!==v?{type:"Subexpression",children:[t,n=this._parseDotRHS(o)]}:(this._advance(),{type:"ValueProjection",children:[t,n=this._parseProjectionRHS(o)]});case k:return n=this.expression(B.Pipe),{type:k,children:[t,n]};case"Or":return{type:"OrExpression",children:[t,n=this.expression(B.Or)]};case"And":return{type:"AndExpression",children:[t,n=this.expression(B.And)]};case x:for(var r,o=t.name,i=[];this._lookahead(0)!==f;)this._lookahead(0)===w?(r={type:w},this._advance()):r=this.expression(0),this._lookahead(0)===g&&this._match(g),i.push(r);return this._match(f),{type:"Function",name:o,children:i};case E:var s=this.expression(0);return this._match(d),{type:"FilterProjection",children:[t,n=this._lookahead(0)===L?{type:"Identity"}:this._parseProjectionRHS(B.Filter),s]};case L:return{type:"Projection",children:[{type:L,children:[t]},this._parseProjectionRHS(B.Flatten)]};case"EQ":case"NE":case"GT":case N:case"LT":case O:return this._parseComparator(t,e);case C:s=this._lookaheadToken(0);return s.type===y||s.type===m?(n=this._parseIndexExpression(),this._projectIfSlice(t,n)):(this._match(v),this._match(d),{type:"Projection",children:[t,n=this._parseProjectionRHS(B.Star)]});default:this._errorToken(this._lookaheadToken(0))}},_match:function(e){if(this._lookahead(0)!==e){var t=this._lookaheadToken(0),t=new Error("Expected "+e+", got: "+t.type);throw t.name="ParserError",t}this._advance()},_errorToken:function(e){e=new Error("Invalid token ("+e.type+'): "'+e.value+'"');throw e.name="ParserError",e},_parseIndexExpression:function(){if(this._lookahead(0)===m||this._lookahead(1)===m)return this._parseSliceExpression();var e={type:"Index",value:this._lookaheadToken(0).value};return this._advance(),this._match(d),e},_projectIfSlice:function(e,t){e={type:"IndexExpression",children:[e,t]};return"Slice"===t.type?{type:"Projection",children:[e,this._parseProjectionRHS(B.Star)]}:e},_parseSliceExpression:function(){for(var e=[null,null,null],t=0,n=this._lookahead(0);n!==d&&t<3;){if(n===m)t++,this._advance();else{if(n!==y){var o=this._lookahead(0),o=new Error("Syntax error, unexpected token: "+o.value+"("+o.type+")");throw o.name="Parsererror",o}e[t]=this._lookaheadToken(0).value,this._advance()}n=this._lookahead(0)}return this._match(d),{type:"Slice",children:e}},_parseComparator:function(e,t){return{type:"Comparator",name:t,children:[e,this.expression(B[t])]}},_parseDotRHS:function(e){var t=this._lookahead(0);return 0<=[p,h,v].indexOf(t)?this.expression(e):t===C?(this._match(C),this._parseMultiselectList()):t===S?(this._match(S),this._parseMultiselectHash()):void 0},_parseProjectionRHS:function(e){var t;if(B[this._lookahead(0)]<10)t={type:"Identity"};else if(this._lookahead(0)===C)t=this.expression(e);else if(this._lookahead(0)===E)t=this.expression(e);else{if(this._lookahead(0)!==b){var n=this._lookaheadToken(0),n=new Error("Sytanx error, unexpected token: "+n.value+"("+n.type+")");throw n.name="ParserError",n}this._match(b),t=this._parseDotRHS(e)}return t},_parseMultiselectList:function(){for(var e=[];this._lookahead(0)!==d;){var t=this.expression(0);if(e.push(t),this._lookahead(0)===g&&(this._match(g),this._lookahead(0)===d))throw new Error("Unexpected token Rbracket")}return this._match(d),{type:"MultiSelectList",children:e}},_parseMultiselectHash:function(){for(var e,t=[],n=[p,h];;){if(e=this._lookaheadToken(0),n.indexOf(e.type)<0)throw new Error("Expecting an identifier token, got: "+e.type);if(e=e.value,this._advance(),this._match(m),e={type:"KeyValuePair",name:e,value:this.expression(0)},t.push(e),this._lookahead(0)===g)this._match(g);else if(this._lookahead(0)===o){this._match(o);break}}return{type:"MultiSelectHash",children:t}}},H.prototype={search:function(e,t){return this.visit(e,t)},visit:function(e,t){var n,o,r,i;switch(e.type){case"Field":return null===t||!I(t)||void 0===(c=t[e.name])?null:c;case"Subexpression":for(l=this.visit(e.children[0],t),d=1;d<e.children.length;d++)if(null===(l=this.visit(e.children[1],l)))return null;return l;case"IndexExpression":return C=this.visit(e.children[0],t),this.visit(e.children[1],C);case"Index":if(!T(t))return null;var s=e.value;return s<0&&(s=t.length+s),void 0===(l=t[s])&&(l=null),l;case"Slice":if(!T(t))return null;var c=e.children.slice(0),s=this.computeSliceParams(t.length,c),c=s[0],a=s[1],u=s[2],l=[];if(0<u)for(d=c;d<a;d+=u)l.push(t[d]);else for(d=c;a<d;d+=u)l.push(t[d]);return l;case"Projection":var p=this.visit(e.children[0],t);if(!T(p))return null;for(b=[],d=0;d<p.length;d++)null!==(o=this.visit(e.children[1],p[d]))&&b.push(o);return b;case"ValueProjection":if(!I(p=this.visit(e.children[0],t)))return null;b=[];for(var h=function(e){for(var t=Object.keys(e),n=[],o=0;o<t.length;o++)n.push(e[t[o]]);return n}(p),d=0;d<h.length;d++)null!==(o=this.visit(e.children[1],h[d]))&&b.push(o);return b;case"FilterProjection":if(!T(p=this.visit(e.children[0],t)))return null;var f=[],g=[];for(d=0;d<p.length;d++)_(n=this.visit(e.children[2],p[d]))||f.push(p[d]);for(var m=0;m<f.length;m++)null!==(o=this.visit(e.children[1],f[m]))&&g.push(o);return g;case"Comparator":switch(r=this.visit(e.children[0],t),i=this.visit(e.children[1],t),e.name){case"EQ":l=A(r,i);break;case"NE":l=!A(r,i);break;case"GT":l=i<r;break;case N:l=i<=r;break;case"LT":l=r<i;break;case O:l=r<=i;break;default:throw new Error("Unknown comparator: "+e.name)}return l;case L:var y=this.visit(e.children[0],t);if(!T(y))return null;var v=[];for(d=0;d<y.length;d++)T(o=y[d])?v.push.apply(v,o):v.push(o);return v;case"Identity":return t;case"MultiSelectList":if(null===t)return null;for(b=[],d=0;d<e.children.length;d++)b.push(this.visit(e.children[d],t));return b;case"MultiSelectHash":if(null===t)return null;var E,b={};for(d=0;d<e.children.length;d++)b[(E=e.children[d]).name]=this.visit(E.value,t);return b;case"OrExpression":return _(n=this.visit(e.children[0],t))&&(n=this.visit(e.children[1],t)),n;case"AndExpression":return!0===_(r=this.visit(e.children[0],t))?r:this.visit(e.children[1],t);case"NotExpression":return _(r=this.visit(e.children[0],t));case"Literal":return e.value;case k:return C=this.visit(e.children[0],t),this.visit(e.children[1],C);case w:return t;case"Function":var S=[];for(d=0;d<e.children.length;d++)S.push(this.visit(e.children[d],t));return this.runtime.callFunction(e.name,S);case"ExpressionReference":var C=e.children[0];return C.jmespathType=R,C;default:throw new Error("Unknown node type: "+e.type)}},computeSliceParams:function(e,t){var n=t[0],o=t[1],r=t[2],t=[null,null,null];if(null===r)r=1;else if(0===r){var i=new Error("Invalid slice, step cannot be 0");throw i.name="RuntimeError",i}i=r<0,n=null===n?i?e-1:0:this.capSliceRange(e,n,r),o=null===o?i?-1:e:this.capSliceRange(e,o,r);return t[0]=n,t[1]=o,t[2]=r,t},capSliceRange:function(e,t,n){return t<0?(t+=e)<0&&(t=n<0?-1:0):e<=t&&(t=n<0?e-1:e),t}},V.prototype={callFunction:function(e,t){var n=this.functionTable[e];if(void 0===n)throw new Error("Unknown function: "+e+"()");return this._validateArgs(e,t,n._signature),n._func.call(this,t)},_validateArgs:function(e,t,n){var o,r,i,s;if(n[n.length-1].variadic){if(t.length<n.length)throw o=1===n.length?" argument":" arguments",new Error("ArgumentError: "+e+"() takes at least"+n.length+o+" but received "+t.length)}else if(t.length!==n.length)throw o=1===n.length?" argument":" arguments",new Error("ArgumentError: "+e+"() takes "+n.length+o+" but received "+t.length);for(var c=0;c<n.length;c++){s=!1,r=n[c].types,i=this._getTypeName(t[c]);for(var a=0;a<r.length;a++)if(this._typeMatches(i,r[a],t[c])){s=!0;break}if(!s)throw new Error("TypeError: "+e+"() expected argument "+(c+1)+" to be type "+r+" but received type "+i+" instead.")}},_typeMatches:function(e,t,n){if(t===i)return!0;if(t!==a&&t!==c&&t!==s)return e===t;if(t===s)return e===s;if(e===s){var o;t===c?o=u:t===a&&(o=l);for(var r=0;r<n.length;r++)if(!this._typeMatches(this._getTypeName(n[r]),o,n[r]))return!1;return!0}},_getTypeName:function(e){switch(Object.prototype.toString.call(e)){case"[object String]":return l;case"[object Number]":return u;case"[object Array]":return s;case"[object Boolean]":return 5;case"[object Null]":return 7;case"[object Object]":return e.jmespathType===R?n:t}},_functionStartsWith:function(e){return 0===e[0].lastIndexOf(e[1])},_functionEndsWith:function(e){var t=e[0],e=e[1];return-1!==t.indexOf(e,t.length-e.length)},_functionReverse:function(e){if(this._getTypeName(e[0])===l){for(var t=e[0],n="",o=t.length-1;0<=o;o--)n+=t[o];return n}e=e[0].slice(0);return e.reverse(),e},_functionAbs:function(e){return Math.abs(e[0])},_functionCeil:function(e){return Math.ceil(e[0])},_functionAvg:function(e){for(var t=0,n=e[0],o=0;o<n.length;o++)t+=n[o];return t/n.length},_functionContains:function(e){return 0<=e[0].indexOf(e[1])},_functionFloor:function(e){return Math.floor(e[0])},_functionLength:function(e){return(I(e[0])?Object.keys(e[0]):e[0]).length},_functionMap:function(e){for(var t=[],n=this._interpreter,o=e[0],r=e[1],i=0;i<r.length;i++)t.push(n.visit(o,r[i]));return t},_functionMerge:function(e){for(var t={},n=0;n<e.length;n++){var o,r=e[n];for(o in r)t[o]=r[o]}return t},_functionMax:function(e){if(0<e[0].length){if(this._getTypeName(e[0][0])===u)return Math.max.apply(Math,e[0]);for(var t=e[0],n=t[0],o=1;o<t.length;o++)n.localeCompare(t[o])<0&&(n=t[o]);return n}return null},_functionMin:function(e){if(0<e[0].length){if(this._getTypeName(e[0][0])===u)return Math.min.apply(Math,e[0]);for(var t=e[0],n=t[0],o=1;o<t.length;o++)t[o].localeCompare(n)<0&&(n=t[o]);return n}return null},_functionSum:function(e){for(var t=0,n=e[0],o=0;o<n.length;o++)t+=n[o];return t},_functionType:function(e){switch(this._getTypeName(e[0])){case u:return"number";case l:return"string";case s:return"array";case t:return"object";case 5:return"boolean";case n:return"expref";case 7:return"null"}},_functionKeys:function(e){return Object.keys(e[0])},_functionValues:function(e){for(var t=e[0],n=Object.keys(t),o=[],r=0;r<n.length;r++)o.push(t[n[r]]);return o},_functionJoin:function(e){var t=e[0];return e[1].join(t)},_functionToArray:function(e){return this._getTypeName(e[0])===s?e[0]:[e[0]]},_functionToString:function(e){return this._getTypeName(e[0])===l?e[0]:JSON.stringify(e[0])},_functionToNumber:function(e){var t,n=this._getTypeName(e[0]);return n===u?e[0]:n!==l||(t=+e[0],isNaN(t))?null:t},_functionNotNull:function(e){for(var t=0;t<e.length;t++)if(7!==this._getTypeName(e[t]))return e[t];return null},_functionSort:function(e){e=e[0].slice(0);return e.sort(),e},_functionSortBy:function(e){var t=e[0].slice(0);if(0===t.length)return t;var r=this._interpreter,i=e[1],s=this._getTypeName(r.visit(i,t[0]));if([u,l].indexOf(s)<0)throw new Error("TypeError");for(var c=this,n=[],o=0;o<t.length;o++)n.push([o,t[o]]);n.sort(function(e,t){var n=r.visit(i,e[1]),o=r.visit(i,t[1]);if(c._getTypeName(n)!==s)throw new Error("TypeError: expected "+s+", received "+c._getTypeName(n));if(c._getTypeName(o)!==s)throw new Error("TypeError: expected "+s+", received "+c._getTypeName(o));return o<n?1:n<o?-1:e[0]-t[0]});for(var a=0;a<n.length;a++)t[a]=n[a][1];return t},_functionMaxBy:function(e){for(var t,n,o=e[1],r=e[0],i=this.createKeyFunction(o,[u,l]),s=-1/0,c=0;c<r.length;c++)s<(n=i(r[c]))&&(s=n,t=r[c]);return t},_functionMinBy:function(e){for(var t,n,o=e[1],r=e[0],i=this.createKeyFunction(o,[u,l]),s=1/0,c=0;c<r.length;c++)(n=i(r[c]))<s&&(s=n,t=r[c]);return t},createKeyFunction:function(n,o){var r=this,i=this._interpreter;return function(e){var t=i.visit(n,e);if(o.indexOf(r._getTypeName(t))<0){e="TypeError: expected one of "+o+", received "+r._getTypeName(t);throw new Error(e)}return t}}},e.tokenize=function(e){return(new F).tokenize(e)},e.compile=function(e){return(new j).parse(e)},e.search=function(e,t){var n=new j,o=new V,r=new H(o);return o._interpreter=r,t=n.parse(t),r.search(t,e)},e.strictDeepEqual=A}(void 0===n?this.jmespath={}:n)},{}],85:[function(e,t,n){var o,r,t=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function c(t){if(o===setTimeout)return setTimeout(t,0);if((o===i||!o)&&setTimeout)return o=setTimeout,setTimeout(t,0);try{return o(t,0)}catch(e){try{return o.call(null,t,0)}catch(e){return o.call(this,t,0)}}}!function(){try{o="function"==typeof setTimeout?setTimeout:i}catch(e){o=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var a,u=[],l=!1,p=-1;function h(){l&&a&&(l=!1,a.length?u=a.concat(u):p=-1,u.length&&d())}function d(){if(!l){var e=c(h);l=!0;for(var t=u.length;t;){for(a=u,u=[];++p<t;)a&&a[p].run();p=-1,t=u.length}a=null,l=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function g(){}t.nextTick=function(e){var t=new Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new f(e,t)),1!==u.length||l||c(d)},f.prototype.run=function(){this.fun.apply(null,this.array)},t.title="browser",t.browser=!0,t.env={},t.argv=[],t.version="",t.versions={},t.on=g,t.addListener=g,t.once=g,t.off=g,t.removeListener=g,t.removeAllListeners=g,t.emit=g,t.prependListener=g,t.prependOnceListener=g,t.listeners=function(e){return[]},t.binding=function(e){throw new Error("process.binding is not supported")},t.cwd=function(){return"/"},t.chdir=function(e){throw new Error("process.chdir is not supported")},t.umask=function(){return 0}},{}],86:[function(e,L,x){(function(O){!function(e){var t="object"==typeof x&&x&&!x.nodeType&&x,n="object"==typeof L&&L&&!L.nodeType&&L,o="object"==typeof O&&O;o.global!==o&&o.window!==o&&o.self!==o||(e=o);var r,i,y=2147483647,v=36,E=1,b=26,s=38,c=700,S=72,C=128,T="-",a=/^xn--/,u=/[^\x20-\x7E]/,l=/[\x2E\u3002\uFF0E\uFF61]/g,p={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},h=v-E,I=Math.floor,A=String.fromCharCode;function _(e){throw RangeError(p[e])}function d(e,t){for(var n=e.length,o=[];n--;)o[n]=t(e[n]);return o}function f(e,t){var n=e.split("@"),o="";return 1<n.length&&(o=n[0]+"@",e=n[1]),o+d((e=e.replace(l,".")).split("."),t).join(".")}function w(e){for(var t,n,o=[],r=0,i=e.length;r<i;)55296<=(t=e.charCodeAt(r++))&&t<=56319&&r<i?56320==(64512&(n=e.charCodeAt(r++)))?o.push(((1023&t)<<10)+(1023&n)+65536):(o.push(t),r--):o.push(t);return o}function g(e){return d(e,function(e){var t="";return 65535<e&&(t+=A((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=A(e)}).join("")}function R(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function k(e,t,n){var o=0;for(e=n?I(e/c):e>>1,e+=I(e/t);h*b>>1<e;o+=v)e=I(e/h);return I(o+(h+1)*e/(e+s))}function m(e){var t,n,o,r,i,s,c,a=[],u=e.length,l=0,p=C,h=S,d=e.lastIndexOf(T);for(d<0&&(d=0),n=0;n<d;++n)128<=e.charCodeAt(n)&&_("not-basic"),a.push(e.charCodeAt(n));for(o=0<d?d+1:0;o<u;){for(r=l,i=1,s=v;u<=o&&_("invalid-input"),c=e.charCodeAt(o++),(v<=(c=c-48<10?c-22:c-65<26?c-65:c-97<26?c-97:v)||c>I((y-l)/i))&&_("overflow"),l+=c*i,!(c<(c=s<=h?E:h+b<=s?b:s-h));s+=v)i>I(y/(c=v-c))&&_("overflow"),i*=c;h=k(l-r,t=a.length+1,0==r),I(l/t)>y-p&&_("overflow"),p+=I(l/t),l%=t,a.splice(l++,0,p)}return g(a)}function N(e){for(var t,n,o,r,i,s,c,a,u,l,p,h=[],d=(e=w(e)).length,f=C,g=S,m=t=0;m<d;++m)(a=e[m])<128&&h.push(A(a));for(n=o=h.length,o&&h.push(T);n<d;){for(r=y,m=0;m<d;++m)f<=(a=e[m])&&a<r&&(r=a);for(r-f>I((y-t)/(u=n+1))&&_("overflow"),t+=(r-f)*u,f=r,m=0;m<d;++m)if((a=e[m])<f&&++t>y&&_("overflow"),a==f){for(i=t,s=v;!(i<(c=s<=g?E:g+b<=s?b:s-g));s+=v)p=i-c,l=v-c,h.push(A(R(c+p%l,0))),i=I(p/l);h.push(A(R(i,0))),g=k(t,u,n==o),t=0,++n}++t,++f}return h.join("")}if(r={version:"1.3.2",ucs2:{decode:w,encode:g},decode:m,encode:N,toASCII:function(e){return f(e,function(e){return u.test(e)?"xn--"+N(e):e})},toUnicode:function(e){return f(e,function(e){return a.test(e)?m(e.slice(4).toLowerCase()):e})}},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return r});else if(t&&n)if(L.exports==t)n.exports=r;else for(i in r)r.hasOwnProperty(i)&&(t[i]=r[i]);else e.punycode=r}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],87:[function(e,t,n){"use strict";t.exports=function(e,t,n,o){t=t||"&",n=n||"=";var r={};if("string"!=typeof e||0===e.length)return r;var i=/\+/g;e=e.split(t);t=1e3;o&&"number"==typeof o.maxKeys&&(t=o.maxKeys);var s=e.length;0<t&&t<s&&(s=t);for(var c=0;c<s;++c){var a,u=e[c].replace(i,"%20"),l=u.indexOf(n),p=0<=l?(a=u.substr(0,l),u.substr(l+1)):(a=u,""),h=decodeURIComponent(a),l=decodeURIComponent(p);u=r,p=h,Object.prototype.hasOwnProperty.call(u,p)?d(r[h])?r[h].push(l):r[h]=[r[h],l]:r[h]=l}return r};var d=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],88:[function(e,t,n){"use strict";function i(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}}t.exports=function(n,o,r,e){return o=o||"&",r=r||"=",null===n&&(n=void 0),"object"==typeof n?c(a(n),function(e){var t=encodeURIComponent(i(e))+r;return s(n[e])?c(n[e],function(e){return t+encodeURIComponent(i(e))}).join(o):t+encodeURIComponent(i(n[e]))}).join(o):e?encodeURIComponent(i(e))+r+encodeURIComponent(i(n)):""};var s=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function c(e,t){if(e.map)return e.map(t);for(var n=[],o=0;o<e.length;o++)n.push(t(e[o],o));return n}var a=Object.keys||function(e){var t,n=[];for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.push(t);return n}},{}],89:[function(e,t,n){"use strict";n.decode=n.parse=e("./decode"),n.encode=n.stringify=e("./encode")},{"./decode":87,"./encode":88}],90:[function(e,t,n){"use strict";t.exports=function(e,t,n,o){t=t||"&",n=n||"=";var r={};if("string"!=typeof e||0===e.length)return r;var i=/\+/g;e=e.split(t);t=1e3;o&&"number"==typeof o.maxKeys&&(t=o.maxKeys);var s=e.length;0<t&&t<s&&(s=t);for(var c=0;c<s;++c){var a,u=e[c].replace(i,"%20"),l=u.indexOf(n),p=0<=l?(a=u.substr(0,l),u.substr(l+1)):(a=u,""),h=decodeURIComponent(a),l=decodeURIComponent(p);u=r,p=h,Object.prototype.hasOwnProperty.call(u,p)?Array.isArray(r[h])?r[h].push(l):r[h]=[r[h],l]:r[h]=l}return r}},{}],91:[function(e,t,n){"use strict";function i(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}}t.exports=function(n,o,r,e){return o=o||"&",r=r||"=",null===n&&(n=void 0),"object"==typeof n?Object.keys(n).map(function(e){var t=encodeURIComponent(i(e))+r;return Array.isArray(n[e])?n[e].map(function(e){return t+encodeURIComponent(i(e))}).join(o):t+encodeURIComponent(i(n[e]))}).join(o):e?encodeURIComponent(i(e))+r+encodeURIComponent(i(n)):""}},{}],92:[function(e,t,n){arguments[4][89][0].apply(n,arguments)},{"./decode":90,"./encode":91,dup:89}],93:[function(a,e,u){(function(e,t){var o=a("process/browser.js").nextTick,n=Function.prototype.apply,r=Array.prototype.slice,i={},s=0;function c(e,t){this._id=e,this._clearFn=t}u.setTimeout=function(){return new c(n.call(setTimeout,window,arguments),clearTimeout)},u.setInterval=function(){return new c(n.call(setInterval,window,arguments),clearInterval)},u.clearTimeout=u.clearInterval=function(e){e.close()},c.prototype.unref=c.prototype.ref=function(){},c.prototype.close=function(){this._clearFn.call(window,this._id)},u.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},u.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},u._unrefActive=u.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;0<=t&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},u.setImmediate="function"==typeof e?e:function(e){var t=s++,n=!(arguments.length<2)&&r.call(arguments,1);return i[t]=!0,o(function(){i[t]&&(n?e.apply(null,n):e.call(null),u.clearImmediate(t))}),t},u.clearImmediate="function"==typeof t?t:function(e){delete i[e]}}).call(this,a("timers").setImmediate,a("timers").clearImmediate)},{"process/browser.js":85,timers:93}],94:[function(e,t,n){var _=e("punycode");function h(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}n.parse=r,n.resolve=function(e,t){return r(e,!1,!0).resolve(t)},n.resolveObject=function(e,t){return e?r(e,!1,!0).resolveObject(t):t},n.format=function(e){U(e)&&(e=r(e));return e instanceof h?e.format():h.prototype.format.call(e)},n.Url=h;var w=/^([a-z0-9.+-]+:)/i,o=/:[0-9]*$/,n=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),R=["'"].concat(n),k=["%","/","?",";","#"].concat(R),N=["/","?","#"],O=/^[a-z0-9A-Z_-]{0,63}$/,L=/^([a-z0-9A-Z_-]{0,63})(.*)$/,x={javascript:!0,"javascript:":!0},D={javascript:!0,"javascript:":!0},P={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},M=e("querystring");function r(e,t,n){if(e&&s(e)&&e instanceof h)return e;var o=new h;return o.parse(e,t,n),o}function U(e){return"string"==typeof e}function s(e){return"object"==typeof e&&null!==e}function d(e){return null===e}h.prototype.parse=function(e,t,n){if(!U(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var o,r,i=(i=e).trim(),e=w.exec(i);if(e&&(o=(e=e[0]).toLowerCase(),this.protocol=o,i=i.substr(e.length)),(n||e||i.match(/^\/\/[^@\/]+@[^@\/]+/))&&(!(r="//"===i.substr(0,2))||e&&D[e]||(i=i.substr(2),this.slashes=!0)),!D[e]&&(r||e&&!P[e])){for(var s=-1,c=0;c<N.length;c++)-1!==(a=i.indexOf(N[c]))&&(-1===s||a<s)&&(s=a);-1!==(C=-1===s?i.lastIndexOf("@"):i.lastIndexOf("@",s))&&(T=i.slice(0,C),i=i.slice(C+1),this.auth=decodeURIComponent(T)),s=-1;for(var a,c=0;c<k.length;c++)-1!==(a=i.indexOf(k[c]))&&(-1===s||a<s)&&(s=a);-1===s&&(s=i.length),this.host=i.slice(0,s),i=i.slice(s),this.parseHost(),this.hostname=this.hostname||"";var u="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!u)for(var l=this.hostname.split(/\./),c=0,p=l.length;c<p;c++){var h=l[c];if(h&&!h.match(O)){for(var d="",f=0,g=h.length;f<g;f++)127<h.charCodeAt(f)?d+="x":d+=h[f];if(!d.match(O)){var m=l.slice(0,c),y=l.slice(c+1),v=h.match(L);v&&(m.push(v[1]),y.unshift(v[2])),y.length&&(i="/"+y.join(".")+i),this.hostname=m.join(".");break}}}if(255<this.hostname.length?this.hostname="":this.hostname=this.hostname.toLowerCase(),!u){for(var E=this.hostname.split("."),b=[],c=0;c<E.length;++c){var S=E[c];b.push(S.match(/[^A-Za-z0-9_-]/)?"xn--"+_.encode(S):S)}this.hostname=b.join(".")}var C=this.port?":"+this.port:"",T=this.hostname||"";this.host=T+C,this.href+=this.host,u&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==i[0]&&(i="/"+i))}if(!x[o])for(c=0,p=R.length;c<p;c++){var I=R[c],A=encodeURIComponent(I);A===I&&(A=escape(I)),i=i.split(I).join(A)}u=i.indexOf("#");-1!==u&&(this.hash=i.substr(u),i=i.slice(0,u));u=i.indexOf("?");return-1!==u?(this.search=i.substr(u),this.query=i.substr(u+1),t&&(this.query=M.parse(this.query)),i=i.slice(0,u)):t&&(this.search="",this.query={}),i&&(this.pathname=i),P[o]&&this.hostname&&!this.pathname&&(this.pathname="/"),(this.pathname||this.search)&&(C=this.pathname||"",S=this.search||"",this.path=C+S),this.href=this.format(),this},h.prototype.format=function(){var e=this.auth||"";e&&(e=(e=encodeURIComponent(e)).replace(/%3A/i,":"),e+="@");var t=this.protocol||"",n=this.pathname||"",o=this.hash||"",r=!1,i="";this.host?r=e+this.host:this.hostname&&(r=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(r+=":"+this.port)),this.query&&s(this.query)&&Object.keys(this.query).length&&(i=M.stringify(this.query));i=this.search||i&&"?"+i||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||P[t])&&!1!==r?(r="//"+(r||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):r=r||"",o&&"#"!==o.charAt(0)&&(o="#"+o),i&&"?"!==i.charAt(0)&&(i="?"+i),t+r+(n=n.replace(/[?#]/g,function(e){return encodeURIComponent(e)}))+(i=i.replace("#","%23"))+o},h.prototype.resolve=function(e){return this.resolveObject(r(e,!1,!0)).format()},h.prototype.resolveObject=function(t){U(t)&&((r=new h).parse(t,!1,!0),t=r);var n=new h;if(Object.keys(this).forEach(function(e){n[e]=this[e]},this),n.hash=t.hash,""===t.href)return n.href=n.format(),n;if(t.slashes&&!t.protocol)return Object.keys(t).forEach(function(e){"protocol"!==e&&(n[e]=t[e])}),P[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n;if(t.protocol&&t.protocol!==n.protocol){if(!P[t.protocol])return Object.keys(t).forEach(function(e){n[e]=t[e]}),n.href=n.format(),n;if(n.protocol=t.protocol,t.host||D[t.protocol])n.pathname=t.pathname;else{for(var e=(t.pathname||"").split("/");e.length&&!(t.host=e.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==e[0]&&e.unshift(""),e.length<2&&e.unshift(""),n.pathname=e.join("/")}return n.search=t.search,n.query=t.query,n.host=t.host||"",n.auth=t.auth,n.hostname=t.hostname||t.host,n.port=t.port,(n.pathname||n.search)&&(i=n.pathname||"",s=n.search||"",n.path=i+s),n.slashes=n.slashes||t.slashes,n.href=n.format(),n}var o=n.pathname&&"/"===n.pathname.charAt(0),r=t.host||t.pathname&&"/"===t.pathname.charAt(0),i=r||o||n.host&&t.pathname,s=i,c=n.pathname&&n.pathname.split("/")||[],e=t.pathname&&t.pathname.split("/")||[],o=n.protocol&&!P[n.protocol];if(o&&(n.hostname="",n.port=null,n.host&&(""===c[0]?c[0]=n.host:c.unshift(n.host)),n.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===e[0]?e[0]=t.host:e.unshift(t.host)),t.host=null),i=i&&(""===e[0]||""===c[0])),r)n.host=(t.host||""===t.host?t:n).host,n.hostname=(t.hostname||""===t.hostname?t:n).hostname,n.search=t.search,n.query=t.query,c=e;else if(e.length)(c=c||[]).pop(),c=c.concat(e),n.search=t.search,n.query=t.query;else if(null!=t.search)return o&&(n.hostname=n.host=c.shift(),(p=!!(n.host&&0<n.host.indexOf("@"))&&n.host.split("@"))&&(n.auth=p.shift(),n.host=n.hostname=p.shift())),n.search=t.search,n.query=t.query,d(n.pathname)&&d(n.search)||(n.path=(n.pathname||"")+(n.search||"")),n.href=n.format(),n;if(!c.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var a=c.slice(-1)[0],r=(n.host||t.host)&&("."===a||".."===a)||""===a,u=0,l=c.length;0<=l;l--)"."==(a=c[l])?c.splice(l,1):".."===a?(c.splice(l,1),u++):u&&(c.splice(l,1),u--);if(!i&&!s)for(;u--;)c.unshift("..");!i||""===c[0]||c[0]&&"/"===c[0].charAt(0)||c.unshift(""),r&&"/"!==c.join("/").substr(-1)&&c.push("");var p,r=""===c[0]||c[0]&&"/"===c[0].charAt(0);return o&&(n.hostname=n.host=!r&&c.length?c.shift():"",(p=!!(n.host&&0<n.host.indexOf("@"))&&n.host.split("@"))&&(n.auth=p.shift(),n.host=n.hostname=p.shift())),(i=i||n.host&&c.length)&&!r&&c.unshift(""),c.length?n.pathname=c.join("/"):(n.pathname=null,n.path=null),d(n.pathname)&&d(n.search)||(n.path=(n.pathname||"")+(n.search||"")),n.auth=t.auth||n.auth,n.slashes=n.slashes||t.slashes,n.href=n.format(),n},h.prototype.parseHost=function(){var e=this.host,t=o.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},{punycode:86,querystring:89}],95:[function(e,t,n){"function"==typeof Object.create?t.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(e,t){e.super_=t;function n(){}n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},{}],96:[function(e,t,n){t.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],97:[function(_,e,w){(function(o,r){var c=/%[sdj%]/g;w.format=function(e){if(!y(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(a(arguments[n]));return t.join(" ")}for(var n=1,o=arguments,r=o.length,i=String(e).replace(c,function(e){if("%%"===e)return"%";if(r<=n)return e;switch(e){case"%s":return String(o[n++]);case"%d":return Number(o[n++]);case"%j":try{return JSON.stringify(o[n++])}catch(e){return"[Circular]"}default:return e}}),s=o[n];n<r;s=o[++n])g(s)||!b(s)?i+=" "+s:i+=" "+a(s);return i},w.deprecate=function(e,t){if(v(r.process))return function(){return w.deprecate(e,t).apply(this,arguments)};if(!0===o.noDeprecation)return e;var n=!1;return function(){if(!n){if(o.throwDeprecation)throw new Error(t);o.traceDeprecation?console.trace(t):console.error(t),n=!0}return e.apply(this,arguments)}};var e,i={};function a(e,t){var n={seen:[],stylize:u};return 3<=arguments.length&&(n.depth=arguments[2]),4<=arguments.length&&(n.colors=arguments[3]),f(t)?n.showHidden=t:t&&w._extend(n,t),v(n.showHidden)&&(n.showHidden=!1),v(n.depth)&&(n.depth=2),v(n.colors)&&(n.colors=!1),v(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=s),l(n,e,n.depth)}function s(e,t){t=a.styles[t];return t?"["+a.colors[t][0]+"m"+e+"["+a.colors[t][1]+"m":e}function u(e,t){return e}function l(t,n,o){if(t.customInspect&&n&&T(n.inspect)&&n.inspect!==w.inspect&&(!n.constructor||n.constructor.prototype!==n)){var e=n.inspect(o,t);return y(e)||(e=l(t,e,o)),e}var r=function(e,t){if(v(t))return e.stylize("undefined","undefined");if(y(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(m(t))return e.stylize(""+t,"number");if(f(t))return e.stylize(""+t,"boolean");if(g(t))return e.stylize("null","null")}(t,n);if(r)return r;var i,e=Object.keys(n),s=(i={},e.forEach(function(e,t){i[e]=!0}),i);if(t.showHidden&&(e=Object.getOwnPropertyNames(n)),C(n)&&(0<=e.indexOf("message")||0<=e.indexOf("description")))return p(n);if(0===e.length){if(T(n)){var c=n.name?": "+n.name:"";return t.stylize("[Function"+c+"]","special")}if(E(n))return t.stylize(RegExp.prototype.toString.call(n),"regexp");if(S(n))return t.stylize(Date.prototype.toString.call(n),"date");if(C(n))return p(n)}var r="",a=!1,c=["{","}"];return d(n)&&(a=!0,c=["[","]"]),T(n)&&(r=" [Function"+(n.name?": "+n.name:"")+"]"),E(n)&&(r=" "+RegExp.prototype.toString.call(n)),S(n)&&(r=" "+Date.prototype.toUTCString.call(n)),C(n)&&(r=" "+p(n)),0!==e.length||a&&0!=n.length?o<0?E(n)?t.stylize(RegExp.prototype.toString.call(n),"regexp"):t.stylize("[Object]","special"):(t.seen.push(n),e=a?function(t,n,o,r,e){for(var i=[],s=0,c=n.length;s<c;++s)A(n,String(s))?i.push(h(t,n,o,r,String(s),!0)):i.push("");return e.forEach(function(e){e.match(/^\d+$/)||i.push(h(t,n,o,r,e,!0))}),i}(t,n,o,s,e):e.map(function(e){return h(t,n,o,s,e,a)}),t.seen.pop(),function(e,t,n){if(60<e.reduce(function(e,t){return 0<=t.indexOf("\n")&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0))return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n  ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(e,r,c)):c[0]+r+c[1]}function p(e){return"["+Error.prototype.toString.call(e)+"]"}function h(e,t,n,o,r,i){var s,c,t=Object.getOwnPropertyDescriptor(t,r)||{value:t[r]};if(t.get?c=t.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):t.set&&(c=e.stylize("[Setter]","special")),A(o,r)||(s="["+r+"]"),c||(e.seen.indexOf(t.value)<0?-1<(c=g(n)?l(e,t.value,null):l(e,t.value,n-1)).indexOf("\n")&&(c=i?c.split("\n").map(function(e){return"  "+e}).join("\n").substr(2):"\n"+c.split("\n").map(function(e){return"   "+e}).join("\n")):c=e.stylize("[Circular]","special")),v(s)){if(i&&r.match(/^\d+$/))return c;s=(s=JSON.stringify(""+r)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),e.stylize(s,"string"))}return s+": "+c}function d(e){return Array.isArray(e)}function f(e){return"boolean"==typeof e}function g(e){return null===e}function m(e){return"number"==typeof e}function y(e){return"string"==typeof e}function v(e){return void 0===e}function E(e){return b(e)&&"[object RegExp]"===t(e)}function b(e){return"object"==typeof e&&null!==e}function S(e){return b(e)&&"[object Date]"===t(e)}function C(e){return b(e)&&("[object Error]"===t(e)||e instanceof Error)}function T(e){return"function"==typeof e}function t(e){return Object.prototype.toString.call(e)}function n(e){return e<10?"0"+e.toString(10):e.toString(10)}w.debuglog=function(t){var n;return v(e)&&(e=o.env.NODE_DEBUG||""),t=t.toUpperCase(),i[t]||(new RegExp("\\b"+t+"\\b","i").test(e)?(n=o.pid,i[t]=function(){var e=w.format.apply(w,arguments);console.error("%s %d: %s",t,n,e)}):i[t]=function(){}),i[t]},(w.inspect=a).colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},w.isArray=d,w.isBoolean=f,w.isNull=g,w.isNullOrUndefined=function(e){return null==e},w.isNumber=m,w.isString=y,w.isSymbol=function(e){return"symbol"==typeof e},w.isUndefined=v,w.isRegExp=E,w.isObject=b,w.isDate=S,w.isError=C,w.isFunction=T,w.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},w.isBuffer=_("./support/isBuffer");var I=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function A(e,t){return Object.prototype.hasOwnProperty.call(e,t)}w.log=function(){var e,t;console.log("%s - %s",(e=new Date,t=[n(e.getHours()),n(e.getMinutes()),n(e.getSeconds())].join(":"),[e.getDate(),I[e.getMonth()],t].join(" ")),w.format.apply(w,arguments))},w.inherits=_("inherits"),w._extend=function(e,t){if(!t||!b(t))return e;for(var n=Object.keys(t),o=n.length;o--;)e[n[o]]=t[n[o]];return e}}).call(this,_("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":96,_process:85,inherits:95}],98:[function(e,t,n){var o=e("./v1"),r=e("./v4"),e=r;e.v1=o,e.v4=r,t.exports=e},{"./v1":101,"./v4":102}],99:[function(e,t,n){for(var o=[],r=0;r<256;++r)o[r]=(r+256).toString(16).substr(1);t.exports=function(e,t){return t=t||0,[o[e[t++]],o[e[t++]],o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],"-",o[e[t++]],o[e[t++]],o[e[t++]],o[e[t++]],o[e[t++]],o[e[t++]]].join("")}},{}],100:[function(e,t,n){var o,r,i="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);i?(o=new Uint8Array(16),t.exports=function(){return i(o),o}):(r=new Array(16),t.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),r[t]=e>>>((3&t)<<3)&255;return r})},{}],101:[function(e,t,n){var l,p,h=e("./lib/rng"),d=e("./lib/bytesToUuid"),f=0,g=0;t.exports=function(e,t,n){var o=t&&n||0,r=t||[],i=(e=e||{}).node||l,s=void 0!==e.clockseq?e.clockseq:p;null!=i&&null!=s||(a=h(),null==i&&(i=l=[1|a[0],a[1],a[2],a[3],a[4],a[5]]),null==s&&(s=p=16383&(a[6]<<8|a[7])));var c=void 0!==e.msecs?e.msecs:(new Date).getTime(),n=void 0!==e.nsecs?e.nsecs:g+1,a=c-f+(n-g)/1e4;if(a<0&&void 0===e.clockseq&&(s=s+1&16383),(a<0||f<c)&&void 0===e.nsecs&&(n=0),1e4<=n)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");f=c,p=s,n=(1e4*(268435455&(c+=122192928e5))+(g=n))%4294967296,r[o++]=n>>>24&255,r[o++]=n>>>16&255,r[o++]=n>>>8&255,r[o++]=255&n,c=c/4294967296*1e4&268435455,r[o++]=c>>>8&255,r[o++]=255&c,r[o++]=c>>>24&15|16,r[o++]=c>>>16&255,r[o++]=s>>>8|128,r[o++]=255&s;for(var u=0;u<6;++u)r[o+u]=i[u];return t||d(r)}},{"./lib/bytesToUuid":99,"./lib/rng":100}],102:[function(e,t,n){var s=e("./lib/rng"),c=e("./lib/bytesToUuid");t.exports=function(e,t,n){var o=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var r=(e=e||{}).random||(e.rng||s)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t)for(var i=0;i<16;++i)t[o+i]=r[i];return t||c(r)}},{"./lib/bytesToUuid":99,"./lib/rng":100}],103:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var o=e("./utils/LRU"),e=(Object.defineProperty(i.prototype,"size",{get:function(){return this.cache.length},enumerable:!0,configurable:!0}),i.prototype.put=function(e,t){e="string"!=typeof e?i.getKeyString(e):e,t=this.populateValue(t);this.cache.put(e,t)},i.prototype.get=function(e){var t="string"!=typeof e?i.getKeyString(e):e,n=Date.now(),o=this.cache.get(t);if(o)for(var r=0;r<o.length;r++)if(o[r].Expire<n)return void this.cache.remove(t);return o},i.getKeyString=function(e){for(var t=[],n=Object.keys(e).sort(),o=0;o<n.length;o++){var r=n[o];void 0!==e[r]&&t.push(e[r])}return t.join(" ")},i.prototype.populateValue=function(e){var t=Date.now();return e.map(function(e){return{Address:e.Address||"",Expire:t+60*(e.CachePeriodInMinutes||1)*1e3}})},i.prototype.empty=function(){this.cache.empty()},i.prototype.remove=function(e){e="string"!=typeof e?i.getKeyString(e):e;this.cache.remove(e)},i);function i(e){void 0===e&&(e=1e3),this.maxSize=e,this.cache=new o.LRUCache(e)}n.EndpointCache=e},{"./utils/LRU":104}],104:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var o=function(e,t){this.key=e,this.value=t},r=(Object.defineProperty(i.prototype,"length",{get:function(){return this.size},enumerable:!0,configurable:!0}),i.prototype.prependToList=function(e){this.headerNode?(this.headerNode.prev=e).next=this.headerNode:this.tailNode=e,this.headerNode=e,this.size++},i.prototype.removeFromTail=function(){if(this.tailNode){var e=this.tailNode,t=e.prev;return t&&(t.next=void 0),e.prev=void 0,this.tailNode=t,this.size--,e}},i.prototype.detachFromList=function(e){this.headerNode===e&&(this.headerNode=e.next),this.tailNode===e&&(this.tailNode=e.prev),e.prev&&(e.prev.next=e.next),e.next&&(e.next.prev=e.prev),e.next=void 0,e.prev=void 0,this.size--},i.prototype.get=function(e){if(this.nodeMap[e]){e=this.nodeMap[e];return this.detachFromList(e),this.prependToList(e),e.value}},i.prototype.remove=function(e){var t;this.nodeMap[e]&&(t=this.nodeMap[e],this.detachFromList(t),delete this.nodeMap[e])},i.prototype.put=function(e,t){var n;this.nodeMap[e]?this.remove(e):this.size===this.sizeLimit&&(n=this.removeFromTail().key,delete this.nodeMap[n]);t=new o(e,t);this.nodeMap[e]=t,this.prependToList(t)},i.prototype.empty=function(){for(var e=Object.keys(this.nodeMap),t=0;t<e.length;t++){var n=e[t],o=this.nodeMap[n];this.detachFromList(o),delete this.nodeMap[n]}},i);function i(e){if(this.nodeMap={},this.size=0,"number"!=typeof e||e<1)throw new Error("Cache size can only be positive number");this.sizeLimit=e}n.LRUCache=r},{}],105:[function(e,t,n){e("./browser_loader");var o=e("./core");"undefined"!=typeof window&&(window.AWS=o),void 0!==t&&(t.exports=o),"undefined"!=typeof self&&(self.AWS=o),Object.prototype.hasOwnProperty.call(o,"Connect")||(o.apiLoader.services.connect={},o.Connect=o.Service.defineService("connect",["2017-02-15"])),o.apiLoader.services.connect["2017-02-15"]=e("../apis/connect-2017-02-15.min"),Object.prototype.hasOwnProperty.call(o,"STS")||(o.apiLoader.services.sts={},o.STS=o.Service.defineService("sts",["2011-06-15"]),e("./services/sts")),o.apiLoader.services.sts["2011-06-15"]=e("../apis/sts-2011-06-15.min")},{"../apis/connect-2017-02-15.min":3,"../apis/sts-2011-06-15.min":5,"./browser_loader":16,"./core":18,"./services/sts":61}]},{},[105]),function(){var h=function(){return h.cache.hasOwnProperty(arguments[0])||(h.cache[arguments[0]]=h.parse(arguments[0])),h.format.call(null,h.cache[arguments[0]],arguments)};function d(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}h.format=function(e,t){for(var n,o,r,i,s,c,a=1,u=e.length,l=[],p=0;p<u;p++)if("string"===(n=d(e[p])))l.push(e[p]);else if("array"===n){if((i=e[p])[2])for(o=t[a],r=0;r<i[2].length;r++){if(!o.hasOwnProperty(i[2][r]))throw h('[sprintf] property "%s" does not exist',i[2][r]);o=o[i[2][r]]}else o=i[1]?t[i[1]]:t[a++];if(/[^s]/.test(i[8])&&"number"!=d(o))throw h("[sprintf] expecting number but found %s",d(o));switch(i[8]){case"b":o=o.toString(2);break;case"c":o=String.fromCharCode(o);break;case"d":o=parseInt(o,10);break;case"e":o=i[7]?o.toExponential(i[7]):o.toExponential();break;case"f":o=i[7]?parseFloat(o).toFixed(i[7]):parseFloat(o);break;case"o":o=o.toString(8);break;case"s":o=(o=String(o))&&i[7]?o.substring(0,i[7]):o;break;case"u":o>>>=0;break;case"x":o=o.toString(16);break;case"X":o=o.toString(16).toUpperCase()}o=/[def]/.test(i[8])&&i[3]&&0<=o?"+"+o:o,s=i[4]?"0"==i[4]?"0":i[4].charAt(1):" ",c=i[6]-String(o).length,c=i[6]?function(e,t){for(var n=[];0<t;n[--t]=e);return n.join("")}(s,c):"",l.push(i[5]?o+c:c+o)}return l.join("")},h.cache={},h.parse=function(e){for(var t=e,n=[],o=[],r=0;t;){if(null!==(n=/^[^\x25]+/.exec(t)))o.push(n[0]);else if(null!==(n=/^\x25{2}/.exec(t)))o.push("%");else{if(null===(n=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(t)))throw"[sprintf] huh?";if(n[2]){r|=1;var i=[],s=n[2],c=[];if(null===(c=/^([a-z_][a-z_\d]*)/i.exec(s)))throw"[sprintf] huh?";for(i.push(c[1]);""!==(s=s.substring(c[0].length));)if(null!==(c=/^\.([a-z_][a-z_\d]*)/i.exec(s)))i.push(c[1]);else{if(null===(c=/^\[(\d+)\]/.exec(s)))throw"[sprintf] huh?";i.push(c[1])}n[2]=i}else r|=2;if(3===r)throw"[sprintf] mixing positional and named placeholders is not (yet) supported";o.push(n)}t=t.substring(n[0].length)}return o},this.sprintf=h,this.vsprintf=function(e,t,n){return(n=t.slice(0)).splice(0,0,e),h.apply(null,n)}}(),function(){var r=this;function t(e){var t,n,o=Array.prototype.slice.call(e,0),r=o.shift();return e=r,-1!==Object.values(i).indexOf(e)?(n=r,t=o.shift()):(t=r,n=i.CCP),{format:t,component:n,args:o}}function o(e,t,n,o){this.component=e,this.level=t,this.text=n,this.time=new Date,this.exception=null,this.objects=[],this.line=0,this.loggerId=o}connect=r.connect||{},r.connect=connect,r.lily=connect;var n={TEST:"TEST",TRACE:"TRACE",DEBUG:"DEBUG",INFO:"INFO",LOG:"LOG",WARN:"WARN",ERROR:"ERROR",CRITICAL:"CRITICAL"},i={CCP:"ccp",SOFTPHONE:"softphone",CHAT:"chat",TASK:"task"},s={TEST:0,TRACE:10,DEBUG:20,INFO:30,LOG:40,WARN:50,ERROR:100,CRITICAL:200},c={TRACE:function(e){console.info(e)},DEBUG:function(e){console.info(e)},INFO:function(e){console.info(e)},LOG:function(e){console.log(e)},TEST:function(e){console.log(e)},WARN:function(e){console.warn(e)},ERROR:function(e){console.error(e)},CRITICAL:function(e){console.error(e)}};function a(e){this.type=e instanceof Error?e.name:e.code||Object.prototype.toString.call(e),this.message=e.message,this.stack=e.stack?e.stack.split("\n"):[]}function u(){this._logs=[],this._rolledLogs=[],this._logsToPush=[],this._serverBoundInternalLogs=[],this._echoLevel=s.INFO,this._logLevel=s.INFO,this._lineCount=0,this._logRollInterval=0,this._logRollTimer=null,this._loggerId=(new Date).getTime()+"-"+Math.random().toString(36).slice(2),this.setLogRollInterval(18e5)}o.fromObject=function(e){var t=new o(i.CCP,e.level,e.text,e.loggerId);return"[object Date]"===Object.prototype.toString.call(e.time)?t.time=new Date(e.time.getTime()):"number"==typeof e.time?t.time=new Date(e.time):"string"==typeof e.time?t.time=Date.parse(e.time):t.time=new Date,t.exception=e.exception,t.objects=e.objects,t},o.prototype.toString=function(){return connect.sprintf("[%s] [%s]: %s",this.getTime()&&this.getTime().toISOString?this.getTime().toISOString():"???",this.getLevel(),this.getText())},o.prototype.getTime=function(){return this.time},o.prototype.getLevel=function(){return this.level},o.prototype.getText=function(){return this.text},o.prototype.getComponent=function(){return this.component},o.prototype.withException=function(e){return this.exception=new a(e),this},o.prototype.withObject=function(e){return this.objects.push(connect.deepcopy(e)),this},o.prototype.sendInternalLogToServer=function(){return connect.getLog()._serverBoundInternalLogs.push(this),this},u.prototype.setLogRollInterval=function(e){var t=this;this._logRollTimer&&e===this._logRollInterval?this.warn("Logger is already set to the given interval: %d",this._logRollInterval):(this._logRollTimer&&r.clearInterval(this._logRollTimer),this._logRollInterval=e,this._logRollTimer=r.setInterval(function(){this._rolledLogs=this._logs,this._logs=[],t.info("Log roll interval occurred.")},this._logRollInterval))},u.prototype.setLogLevel=function(e){if(!(e in s))throw new Error("Unknown logging level: "+e);this._logLevel=s[e]},u.prototype.setEchoLevel=function(e){if(!(e in s))throw new Error("Unknown logging level: "+e);this._echoLevel=s[e]},u.prototype.write=function(e,t,n){n=new o(e,t,n,this.getLoggerId());return this.addLogEntry(n),n},u.prototype.addLogEntry=function(e){this._logs.push(e),i.SOFTPHONE===e.component&&this._logsToPush.push(e),e.level in s&&s[e.level]>=this._logLevel&&(s[e.level]>=this._echoLevel&&c[e.getLevel()](e.toString()),e.line=this._lineCount++)},u.prototype.sendInternalLogEntryToServer=function(e){this._serverBoundInternalLogs.push(e),e.level in s&&s[e.level]>=this._logLevel&&(s[e.level]>=this._echoLevel&&c[e.getLevel()](e.toString()),e.line=this._lineCount++)},u.prototype.clearObjects=function(){for(var e=0;e<this._logs.length;e++)this._logs[e].objects&&delete this._logs[e].objects},u.prototype.clearExceptions=function(){for(var e=0;e<this._logs.length;e++)this._logs[e].exception&&delete this._logs[e].exception},u.prototype.trace=function(){var e=t(arguments);return this.write(e.component,n.TRACE,connect.vsprintf(e.format,e.args))},u.prototype.debug=function(){var e=t(arguments);return this.write(e.component,n.DEBUG,connect.vsprintf(e.format,e.args))},u.prototype.info=function(){var e=t(arguments);return this.write(e.component,n.INFO,connect.vsprintf(e.format,e.args))},u.prototype.log=function(){var e=t(arguments);return this.write(e.component,n.LOG,connect.vsprintf(e.format,e.args))},u.prototype.test=function(){var e=t(arguments);return this.write(e.component,n.TEST,connect.vsprintf(e.format,e.args))},u.prototype.warn=function(){var e=t(arguments);return this.write(e.component,n.WARN,connect.vsprintf(e.format,e.args))},u.prototype.error=function(){var e=t(arguments);return this.write(e.component,n.ERROR,connect.vsprintf(e.format,e.args))},u.prototype.critical=function(){var e=t(arguments);return this.write(e.component,n.ERROR,connect.vsprintf(e.format,e.args))},u.prototype.toString=function(){for(var e=[],t=0;t<this._logs.length;t++)e.push(this._logs[t].toString());return e.join("\n")},u.prototype.download=function(e){var t="agent-log",n=!1;"object"==typeof e?(t=e.logName||t,n=e.filterByLogLevel||n):"string"==typeof e&&(t=e||t);var o=this,e=this._rolledLogs.concat(this._logs);n&&(e=e.filter(function(e){return s[e.level]>=o._logLevel}));n=new r.Blob([JSON.stringify(e,void 0,4)],["text/plain"]),e=document.createElement("a"),t=t||"agent-log";e.href=r.URL.createObjectURL(n),e.download=t+".txt",document.body.appendChild(e),e.click(),document.body.removeChild(e)},u.prototype.scheduleUpstreamLogPush=function(e){connect.upstreamLogPushScheduled||(connect.upstreamLogPushScheduled=!0,r.setInterval(connect.hitch(this,this.reportMasterLogsUpStream,e),5e3))},u.prototype.reportMasterLogsUpStream=function(e){var t=this._logsToPush.slice();this._logsToPush=[],connect.ifMaster(connect.MasterTopics.SEND_LOGS,function(){0<t.length&&e.sendUpstream(connect.EventType.SEND_LOGS,t)})},u.prototype.getLoggerId=function(){return this._loggerId},u.prototype.scheduleDownstreamClientSideLogsPush=function(){r.setInterval(connect.hitch(this,this.pushClientSideLogsDownstream),5e3)},u.prototype.pushClientSideLogsDownstream=function(){var e=[];this._serverBoundInternalLogs.length<50||(500<this._serverBoundInternalLogs.length?e=this._serverBoundInternalLogs.splice(0,500):(e=this._serverBoundInternalLogs,this._serverBoundInternalLogs=[]),connect.publishClientSideLogs(e))};var l=function(e){u.call(this),this.conduit=e,r.setInterval(connect.hitch(this,this._pushLogsDownstream),l.LOG_PUSH_INTERVAL),r.clearInterval(this._logRollTimer),this._logRollTimer=null};l.LOG_PUSH_INTERVAL=1e3,l.prototype=Object.create(u.prototype),(l.prototype.constructor=l).prototype.pushLogsDownstream=function(e){var t=this;e.forEach(function(e){t.conduit.sendDownstream(connect.EventType.LOG,e)})},l.prototype._pushLogsDownstream=function(){var t=this;this._logs.forEach(function(e){t.conduit.sendDownstream(connect.EventType.LOG,e)}),this._logs=[];for(var e=0;e<this._serverBoundInternalLogs.length;e++)this.conduit.sendDownstream(connect.EventType.SERVER_BOUND_INTERNAL_LOG,this._serverBoundInternalLogs[e]);this._serverBoundInternalLogs=[]},connect.rootLogger=new u,connect=connect||{},connect.getLog=function(){return connect.rootLogger},connect.LogEntry=o,connect.Logger=u,connect.LogLevel=n,connect.LogComponent=i,connect.DownstreamConduitLogger=l}(),function(){var a=this;connect=a.connect||{},a.connect=connect,a.lily=connect;var t=navigator.userAgent;connect.sprintf=a.sprintf,connect.vsprintf=a.vsprintf,delete a.sprintf,delete a.vsprintf,connect.HTTP_STATUS_CODES={SUCCESS:200,TOO_MANY_REQUESTS:429,INTERNAL_SERVER_ERROR:500},connect.TRANSPORT_TYPES={CHAT_TOKEN:"chat_token",WEB_SOCKET:"web_socket"},connect.hitch=function(){var t=Array.prototype.slice.call(arguments),n=t.shift(),o=t.shift();return connect.assertNotNull(n,"scope"),connect.assertNotNull(o,"method"),connect.assertTrue(connect.isFunction(o),"method must be a function"),function(){var e=Array.prototype.slice.call(arguments);return o.apply(n,t.concat(e))}},connect.isFunction=function(e){return!!(e&&e.constructor&&e.call&&e.apply)},connect.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},connect.keys=function(e){var t,n=[];for(t in connect.assertNotNull(e,"map"),e)n.push(t);return n},connect.values=function(e){var t,n=[];for(t in connect.assertNotNull(e,"map"),e)n.push(e[t]);return n},connect.entries=function(e){var t,n=[];for(t in e)n.push({key:t,value:e[t]});return n},connect.merge=function(){var e=Array.prototype.slice.call(arguments,0),t={};return e.forEach(function(e){connect.entries(e).forEach(function(e){t[e.key]=e.value})}),t},connect.now=function(){return(new Date).getTime()},connect.find=function(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n];return null},connect.contains=function(e,t){return e instanceof Array?null!=connect.find(e,function(e){return e===t}):t in e},connect.containsValue=function(e,t){return e instanceof Array?null!=connect.find(e,function(e){return e===t}):null!=connect.find(connect.values(e),function(e){return e===t})},connect.randomId=function(){return connect.sprintf("%s-%s",connect.now(),Math.random().toString(36).slice(2))},connect.makeEnum=function(e){var n={};return e.forEach(function(e){var t=e.replace(/\.?([a-z]+)_?/g,function(e,t){return t.toUpperCase()+"_"}).replace(/_$/,"");n[t]=e}),n},connect.makeNamespacedEnum=function(t,e){var n=connect.makeEnum(e);return connect.keys(n).forEach(function(e){n[e]=connect.sprintf("%s::%s",t,n[e])}),n},connect.makeGenericNamespacedEnum=function(t,e,n){var o=connect.makeEnum(e);return connect.keys(o).forEach(function(e){o[e]=connect.sprintf("%s"+n+"%s",t,o[e])}),o},connect.isChromeBrowser=function(){return-1!==t.indexOf("Chrome")},connect.isFirefoxBrowser=function(){return-1!==t.indexOf("Firefox")},connect.isOperaBrowser=function(){return-1!==t.indexOf("Opera")},connect.getChromeBrowserVersion=function(){var e=t.substring(t.indexOf("Chrome")+7);return e?parseFloat(e):-1},connect.getFirefoxBrowserVersion=function(){var e=t.substring(t.indexOf("Firefox")+8);return e?parseFloat(e):-1},connect.getOperaBrowserVersion=function(){var e=t.indexOf("Opera"),e=-1!==t.indexOf("Version")?t.substring(e+8):t.substring(e+6);return e?parseFloat(e):-1},connect.index=function(e,t){var n={};return e.forEach(function(e){n[t(e)]=e}),n},connect.set=function(e){var t={};return e.forEach(function(e){t[e]=1}),t},connect.relativeComplement=function(t,n){var o={};return connect.keys(n).forEach(function(e){e in t||(o[e]=n[e])}),o},connect.assertTrue=function(e,t){if(!e)throw new connect.ValueError(t)},connect.assertNotNull=function(e,t){return connect.assertTrue(null!=e&&!0,connect.sprintf("%s must be provided",t||"A value")),e},connect.deepcopy=function(e){return JSON.parse(JSON.stringify(e))},connect.getBaseUrl=function(){var e=a.location;return connect.sprintf("%s//%s:%s",e.protocol,e.hostname,e.port)},connect.getUrlWithProtocol=function(e){var t=a.location.protocol;return e.substr(0,t.length)!==t?connect.sprintf("%s//%s",t,e):e},connect.isFramed=function(){try{return window.self!==window.top}catch(e){return!0}},connect.fetch=function(e,i,s,t){return t=t||5,s=s||1e3,i=i||{},new Promise(function(o,r){!function t(n){fetch(e,i).then(function(e){e.status===connect.HTTP_STATUS_CODES.SUCCESS?o(e.json()):1!==n&&(e.status>=connect.HTTP_STATUS_CODES.INTERNAL_SERVER_ERROR||e.status===connect.HTTP_STATUS_CODES.TOO_MANY_REQUESTS)?setTimeout(function(){t(--n)},s):r(e)}).catch(function(e){r(e)})}(t)})},connect.backoff=function(o,r,i,s){connect.assertTrue(connect.isFunction(o),"func must be a Function");var c=this;o({success:function(e){s&&s.success&&s.success(e)},failure:function(e,t){var n;0<i?(n=2*r*Math.random(),a.setTimeout(function(){c.backoff(o,2*n,--i,s)},n)):s&&s.failure&&s.failure(e,t)}})},connect.publishMetric=function(e){connect.core.getEventBus().trigger(connect.EventType.CLIENT_METRIC,e)},connect.publishSoftphoneStats=function(e){connect.core.getEventBus().trigger(connect.EventType.SOFTPHONE_STATS,e)},connect.publishSoftphoneReport=function(e){connect.core.getEventBus().trigger(connect.EventType.SOFTPHONE_REPORT,e)},connect.publishClientSideLogs=function(e){connect.core.getEventBus().trigger(connect.EventType.CLIENT_SIDE_LOGS,e)},connect.PopupManager=function(){},connect.PopupManager.prototype.open=function(e,t,n){var o,r,i=this._getLastOpenedTimestamp(t),s=(new Date).getTime(),c=null;return 864e5<s-i&&(n?(o=n.height||578,r=n.width||433,i=n.top||0,n=n.left||0,(c=window.open("",t,"width="+r+", height="+o+", top="+i+", left="+n)).location!==e&&(c=window.open(e,t,"width="+r+", height="+o+", top="+i+", left="+n))):(c=window.open("",t)).location!==e&&(c=window.open(e,t)),this._setLastOpenedTimestamp(t,s)),c},connect.PopupManager.prototype.clear=function(e){e=this._getLocalStorageKey(e);a.localStorage.removeItem(e)},connect.PopupManager.prototype._getLastOpenedTimestamp=function(e){e=this._getLocalStorageKey(e),e=a.localStorage.getItem(e);return e?parseInt(e,10):0},connect.PopupManager.prototype._setLastOpenedTimestamp=function(e,t){e=this._getLocalStorageKey(e);a.localStorage.setItem(e,""+t)},connect.PopupManager.prototype._getLocalStorageKey=function(e){return"connectPopupManager::"+e};var n=connect.makeEnum(["granted","denied","default"]);connect.NotificationManager=function(){this.queue=[],this.permission=n.DEFAULT},connect.NotificationManager.prototype.requestPermission=function(){var t=this;"Notification"in a?a.Notification.permission===n.DENIED?(connect.getLog().warn("The user has requested to not receive notifications.").sendInternalLogToServer(),this.permission=n.DENIED):this.permission!==n.GRANTED&&a.Notification.requestPermission().then(function(e){(t.permission=e)===n.GRANTED?t._showQueued():t.queue=[]}):(connect.getLog().warn("This browser doesn't support notifications.").sendInternalLogToServer(),this.permission=n.DENIED)},connect.NotificationManager.prototype.show=function(e,t){if(this.permission===n.GRANTED)return this._showImpl({title:e,options:t});this.permission===n.DENIED?connect.getLog().warn("Unable to show notification.").sendInternalLogToServer().withObject({title:e,options:t}):(t={title:e,options:t},connect.getLog().warn("Deferring notification until user decides to allow or deny.").withObject(t).sendInternalLogToServer(),this.queue.push(t))},connect.NotificationManager.prototype._showQueued=function(){var t=this,e=this.queue.map(function(e){return t._showImpl(e)});return this.queue=[],e},connect.NotificationManager.prototype._showImpl=function(e){var t=new a.Notification(e.title,e.options);return e.options.clicked&&(t.onclick=function(){e.options.clicked.call(t)}),t},connect.BaseError=function(e,t){a.Error.call(this,connect.vsprintf(e,t))},connect.BaseError.prototype=Object.create(Error.prototype),connect.BaseError.prototype.constructor=connect.BaseError,connect.ValueError=function(){var e=Array.prototype.slice.call(arguments,0),t=e.shift();connect.BaseError.call(this,t,e)},connect.ValueError.prototype=Object.create(connect.BaseError.prototype),connect.ValueError.prototype.constructor=connect.ValueError,connect.NotImplementedError=function(){var e=Array.prototype.slice.call(arguments,0),t=e.shift();connect.BaseError.call(this,t,e)},connect.NotImplementedError.prototype=Object.create(connect.BaseError.prototype),connect.NotImplementedError.prototype.constructor=connect.NotImplementedError,connect.StateError=function(){var e=Array.prototype.slice.call(arguments,0),t=e.shift();connect.BaseError.call(this,t,e)},connect.StateError.prototype=Object.create(connect.BaseError.prototype),connect.StateError.prototype.constructor=connect.StateError,connect.VoiceIdError=function(e,t,n){var o={};return o.type=e,o.message=t,o.stack=Error(t),o.err=n,o}}(),function(){function e(){}connect=this.connect||{},this.connect=connect;var t=connect.makeEnum(["acknowledge","ack_timeout","api_request","api_response","auth_fail","access_denied","close","configure","log","master_request","master_response","synchronize","terminate","terminated","send_logs","reload_agent_configuration","broadcast","api_metric","client_metric","softphone_stats","softphone_report","client_side_logs","server_bound_internal_log","mute","iframe_style"]),n=connect.makeNamespacedEnum("connect",["loginPopup","sendLogs","softphone","ringtone","metrics"]),o=connect.makeNamespacedEnum("agent",["init","update","refresh","routable","not_routable","pending","contact_pending","offline","error","softphone_error","websocket_connection_lost","websocket_connection_gained","state_change","acw","mute_toggle","local_media_stream_created"]),r=connect.makeNamespacedEnum("webSocket",["init_failure","connection_open","connection_close","connection_error","connection_gain","connection_lost","subscription_update","subscription_failure","all_message","send","subscribe"]),i=connect.makeNamespacedEnum("contact",["init","refresh","destroyed","incoming","pending","connecting","connected","missed","acw","view","ended","error","accepted"]),s=connect.makeNamespacedEnum("connection",["session_init"]),c=connect.makeNamespacedEnum("configuration",["configure","set_speaker_device","set_microphone_device","set_ringer_device","speaker_device_changed","microphone_device_changed","ringer_device_changed"]);function a(e,t,n){this.subMap=e,this.id=connect.randomId(),this.eventName=t,this.f=n}function u(){this.subIdMap={},this.subEventNameMap={}}function l(e){e=e||{},this.subMap=new u,this.logEvents=e.logEvents||!1}e.createRequest=function(e,t,n){return{event:e,requestId:connect.randomId(),method:t,params:n}},e.createResponse=function(e,t,n,o){return{event:e,requestId:t.requestId,data:n,err:o||null}},a.prototype.unsubscribe=function(){this.subMap.unsubscribe(this.eventName,this.id)},u.prototype.subscribe=function(e,t){var n=new a(this,e,t);this.subIdMap[n.id]=n;t=this.subEventNameMap[e]||[];return t.push(n),this.subEventNameMap[e]=t,n},u.prototype.unsubscribe=function(e,t){connect.contains(this.subEventNameMap,e)&&(this.subEventNameMap[e]=this.subEventNameMap[e].filter(function(e){return e.id!==t}),this.subEventNameMap[e].length<1&&delete this.subEventNameMap[e]),connect.contains(this.subIdMap,t)&&delete this.subIdMap[t]},u.prototype.getAllSubscriptions=function(){return connect.values(this.subEventNameMap).reduce(function(e,t){return e.concat(t)},[])},u.prototype.getSubscriptions=function(e){return this.subEventNameMap[e]||[]},l.prototype.subscribe=function(e,t){return connect.assertNotNull(e,"eventName"),connect.assertNotNull(t,"f"),connect.assertTrue(connect.isFunction(t),"f must be a function"),this.subMap.subscribe(e,t)},l.prototype.subscribeAll=function(e){return connect.assertNotNull(e,"f"),connect.assertTrue(connect.isFunction(e),"f must be a function"),this.subMap.subscribe("<<all>>",e)},l.prototype.getSubscriptions=function(e){return this.subMap.getSubscriptions(e)},l.prototype.trigger=function(t,n){connect.assertNotNull(t,"eventName");var o=this,e=this.subMap.getSubscriptions("<<all>>"),r=this.subMap.getSubscriptions(t);this.logEvents&&t!==connect.EventType.LOG&&t!==connect.EventType.MASTER_RESPONSE&&t!==connect.EventType.API_METRIC&&t!==connect.EventType.SERVER_BOUND_INTERNAL_LOG&&connect.getLog().trace("Publishing event: %s",t).sendInternalLogToServer(),!t.startsWith(connect.ContactEvents.ACCEPTED)||!n.contactId||n instanceof connect.Contact||(n=new connect.Contact(n.contactId)),e.concat(r).forEach(function(e){try{e.f(n||null,t,o)}catch(e){connect.getLog().error("'%s' event handler failed.",t).withException(e).sendInternalLogToServer()}})},l.prototype.bridge=function(){var n=this;return function(e,t){n.trigger(t,e)}},l.prototype.unsubscribeAll=function(){this.subMap.getAllSubscriptions().forEach(function(e){e.unsubscribe()})},connect.EventBus=l,connect.EventFactory=e,connect.EventType=t,connect.AgentEvents=o,connect.ConfigurationEvents=c,connect.ConnnectionEvents=s,connect.ContactEvents=i,connect.WebSocketEvents=r,connect.MasterTopics=n}(),function(){function o(){}function r(){o.call(this)}function e(e,t){o.call(this),this.window=e,this.domain=t||"*"}function i(e,t,n){o.call(this),this.input=e,this.output=t,this.domain=n||"*"}function t(e){o.call(this),this.port=e,this.id=connect.randomId()}function n(e){o.call(this),this.streamMap=e?connect.index(e,function(e){return e.getId()}):{},this.messageListeners=[]}function s(e,t,n){this.name=e,this.upstream=t||new r,this.downstream=n||new r,this.downstreamBus=new connect.EventBus,this.upstreamBus=new connect.EventBus,this.upstream.onMessage(connect.hitch(this,this._dispatchEvent,this.upstreamBus)),this.downstream.onMessage(connect.hitch(this,this._dispatchEvent,this.downstreamBus))}function c(e,t,n,o){s.call(this,e,new i(t,n.contentWindow,o||"*"),null)}connect=this.connect||{},this.connect=connect,this.lily=connect,o.prototype.send=function(e){throw new connect.NotImplementedError},o.prototype.onMessage=function(e){throw new connect.NotImplementedError},((r.prototype=Object.create(o.prototype)).constructor=r).prototype.onMessage=function(e){},r.prototype.send=function(e){},((e.prototype=Object.create(o.prototype)).constructor=e).prototype.send=function(e){this.window.postMessage(e,this.domain)},e.prototype.onMessage=function(e){this.window.addEventListener("message",e)},((i.prototype=Object.create(o.prototype)).constructor=i).prototype.send=function(e){this.output.postMessage(e,this.domain)},i.prototype.onMessage=function(e){this.input.addEventListener("message",e)},((t.prototype=Object.create(o.prototype)).constructor=t).prototype.send=function(e){this.port.postMessage(e)},t.prototype.onMessage=function(e){this.port.addEventListener("message",e)},t.prototype.getId=function(){return this.id},((n.prototype=Object.create(o.prototype)).constructor=n).prototype.send=function(t){this.getStreams().forEach(function(e){try{e.send(t)}catch(e){}})},n.prototype.onMessage=function(t){this.messageListeners.push(t),this.getStreams().forEach(function(e){e.onMessage(t)})},n.prototype.addStream=function(t){this.streamMap[t.getId()]=t,this.messageListeners.forEach(function(e){t.onMessage(e)})},n.prototype.removeStream=function(e){delete this.streamMap[e.getId()]},n.prototype.getStreams=function(e){return connect.values(this.streamMap)},n.prototype.getStreamForPort=function(t){return connect.find(this.getStreams(),function(e){return e.port===t})},s.prototype.onUpstream=function(e,t){return connect.assertNotNull(e,"eventName"),connect.assertNotNull(t,"f"),connect.assertTrue(connect.isFunction(t),"f must be a function"),this.upstreamBus.subscribe(e,t)},s.prototype.onAllUpstream=function(e){return connect.assertNotNull(e,"f"),connect.assertTrue(connect.isFunction(e),"f must be a function"),this.upstreamBus.subscribeAll(e)},s.prototype.onDownstream=function(e,t){return connect.assertNotNull(e,"eventName"),connect.assertNotNull(t,"f"),connect.assertTrue(connect.isFunction(t),"f must be a function"),this.downstreamBus.subscribe(e,t)},s.prototype.onAllDownstream=function(e){return connect.assertNotNull(e,"f"),connect.assertTrue(connect.isFunction(e),"f must be a function"),this.downstreamBus.subscribeAll(e)},s.prototype.sendUpstream=function(e,t){connect.assertNotNull(e,"eventName"),this.upstream.send({event:e,data:t})},s.prototype.sendDownstream=function(e,t){connect.assertNotNull(e,"eventName"),this.downstream.send({event:e,data:t})},s.prototype._dispatchEvent=function(e,t){t=t.data;t.event&&e.trigger(t.event,t.data)},s.prototype.passUpstream=function(){var n=this;return function(e,t){n.upstream.send({event:t,data:e})}},s.prototype.passDownstream=function(){var n=this;return function(e,t){n.downstream.send({event:t,data:e})}},s.prototype.shutdown=function(){this.upstreamBus.unsubscribeAll(),this.downstreamBus.unsubscribeAll()},(c.prototype=Object.create(s.prototype)).constructor=c,connect.Stream=o,connect.NullStream=r,connect.WindowStream=e,connect.WindowIOStream=i,connect.PortStream=t,connect.StreamMultiplexer=n,connect.Conduit=s,connect.IFrameConduit=c}(),function(){function o(){}function e(){o.call(this)}function t(e,t,n){o.call(this),this.conduit=e,this.requestEvent=t,this.responseEvent=n,this._requestIdCallbacksMap={},this.conduit.onUpstream(n,connect.hitch(this,this._handleResponse))}function n(e){t.call(this,e,connect.EventType.API_REQUEST,connect.EventType.API_RESPONSE)}function r(e){t.call(this,e,connect.EventType.MASTER_REQUEST,connect.EventType.MASTER_RESPONSE)}function i(e,t,n){connect.assertNotNull(e,"authCookieName"),connect.assertNotNull(t,"authToken"),connect.assertNotNull(n,"endpoint"),o.call(this),this.endpointUrl=connect.getUrlWithProtocol(n),this.authToken=t,this.authCookieName=e}function s(e,t,n){connect.assertNotNull(e,"authToken"),connect.assertNotNull(t,"region"),o.call(this),AWS.config.credentials=new AWS.Credentials({}),AWS.config.region=t,this.authToken=e,e=connect.getBaseUrl(),e=n||(e.includes(".awsapps.com")?e+"/connect/api":e+"/api"),e=new AWS.Endpoint(e),this.client=new AWS.Connect({endpoint:e})}connect=this.connect||{},this.connect=connect,this.lily=connect,connect.ClientMethods=connect.makeEnum(["getAgentSnapshot","putAgentState","getAgentStates","getDialableCountryCodes","getRoutingProfileQueues","getAgentPermissions","getAgentConfiguration","updateAgentConfiguration","acceptContact","createOutboundContact","createTaskContact","clearContact","completeContact","destroyContact","rejectContact","notifyContactIssue","updateContactAttributes","createAdditionalConnection","destroyConnection","holdConnection","resumeConnection","toggleActiveConnections","conferenceConnections","sendClientLogs","sendDigits","sendSoftphoneCallReport","sendSoftphoneCallMetrics","getEndpoints","getNewAuthToken","createTransport"]),connect.AgentAppClientMethods={GET_SPEAKER_ID:"AgentAppService.Lcms.getContact",ENROLL_SPEAKER_IN_VOICEID:"AgentAppService.VoiceId.enrollBySession",EVALUATE_SPEAKER_WITH_VOICEID:"AgentAppService.VoiceId.evaluateSession",GET_SPEAKER_STATUS:"AgentAppService.VoiceId.describeSpeaker",OPT_OUT_VOICEID_SPEAKER:"AgentAppService.VoiceId.optOutSpeaker",DESCRIBE_VOICEID_SESSION:"AgentAppService.VoiceId.describeSession",UPDATE_VOICEID_SESSION:"AgentAppService.VoiceId.updateSession",START_VOICEID_SESSION:"AgentAppService.Nasa.startVoiceIdSession"},connect.MasterMethods=connect.makeEnum(["becomeMaster","checkMaster"]),o.EMPTY_CALLBACKS={success:function(){},failure:function(){}},o.prototype.call=function(e,t,n){connect.assertNotNull(e,"method");t=t||{},n=n||o.EMPTY_CALLBACKS;this._callImpl(e,t,n)},o.prototype._callImpl=function(e,t,n){throw new connect.NotImplementedError},((e.prototype=Object.create(o.prototype)).constructor=e).prototype._callImpl=function(e,t,n){n&&n.failure&&(e=connect.sprintf("No such method exists on NULL client: %s",e),n.failure(new connect.ValueError(e),{message:e}))},((t.prototype=Object.create(o.prototype)).constructor=t).prototype._callImpl=function(e,t,n){t=connect.EventFactory.createRequest(this.requestEvent,e,t);this._requestIdCallbacksMap[t.requestId]=n,this.conduit.sendUpstream(t.event,t)},t.prototype._getCallbacksForRequest=function(e){var t=this._requestIdCallbacksMap[e]||null;return null!=t&&delete this._requestIdCallbacksMap[e],t},t.prototype._handleResponse=function(e){var t=this._getCallbacksForRequest(e.requestId);null!=t&&(e.err&&t.failure?t.failure(e.err,e.data):t.success&&t.success(e.data))},(n.prototype=Object.create(t.prototype)).constructor=n,(r.prototype=Object.create(t.prototype)).constructor=r,((i.prototype=Object.create(o.prototype)).constructor=i).prototype._callImpl=function(e,t,n){var o={};o[this.authCookieName]=this.authToken;o={method:"post",body:JSON.stringify(t||{}),headers:{Accept:"application/json","Content-Type":"application/json","X-Amz-target":e,"X-Amz-Bearer":JSON.stringify(o)}};connect.fetch(this.endpointUrl,o).then(function(e){n.success(e)}).catch(function(e){n.failure(e)})},((s.prototype=Object.create(o.prototype)).constructor=s).prototype._callImpl=function(o,e,r){var t=this,i=connect.getLog();connect.contains(this.client,o)?(e=this._translateParams(o,e),i.trace("AWSClient: --\x3e Calling operation '%s'",o).sendInternalLogToServer(),this.client[o](e).on("build",function(e){e.httpRequest.headers["X-Amz-Bearer"]=t.authToken}).send(function(e,t){try{var n;e?(e.code===connect.CTIExceptions.UNAUTHORIZED_EXCEPTION?r.authFailure():!r.accessDenied||e.code!==connect.CTIExceptions.ACCESS_DENIED_EXCEPTION&&403!==e.statusCode?((n={}).type=e.code,n.message=e.message,n.stack=e.stack?e.stack.split("\n"):[],r.failure(n,t)):r.accessDenied(),i.trace("AWSClient: <-- Operation '%s' failed: %s",o,JSON.stringify(e)).sendInternalLogToServer()):(i.trace("AWSClient: <-- Operation '%s' succeeded.",o).withObject(t).sendInternalLogToServer(),r.success(t))}catch(e){connect.getLog().error("Failed to handle AWS API request for method %s",o).withException(e).sendInternalLogToServer()}})):(e=connect.sprintf("No such method exists on AWS client: %s",o),r.failure(new connect.ValueError(e),{message:e}))},s.prototype._requiresAuthenticationParam=function(e){return e!==connect.ClientMethods.COMPLETE_CONTACT&&e!==connect.ClientMethods.CLEAR_CONTACT&&e!==connect.ClientMethods.REJECT_CONTACT&&e!==connect.ClientMethods.CREATE_TASK_CONTACT},s.prototype._translateParams=function(e,t){switch(e){case connect.ClientMethods.UPDATE_AGENT_CONFIGURATION:t.configuration=this._translateAgentConfiguration(t.configuration);break;case connect.ClientMethods.SEND_SOFTPHONE_CALL_METRICS:t.softphoneStreamStatistics=this._translateSoftphoneStreamStatistics(t.softphoneStreamStatistics);break;case connect.ClientMethods.SEND_SOFTPHONE_CALL_REPORT:t.report=this._translateSoftphoneCallReport(t.report)}return this._requiresAuthenticationParam(e)&&(t.authentication={authToken:this.authToken}),t},s.prototype._translateAgentConfiguration=function(e){return{name:e.name,softphoneEnabled:e.softphoneEnabled,softphoneAutoAccept:e.softphoneAutoAccept,extension:e.extension,routingProfile:this._translateRoutingProfile(e.routingProfile),agentPreferences:e.agentPreferences}},s.prototype._translateRoutingProfile=function(e){return{name:e.name,routingProfileARN:e.routingProfileARN,defaultOutboundQueue:this._translateQueue(e.defaultOutboundQueue)}},s.prototype._translateQueue=function(e){return{queueARN:e.queueARN,name:e.name}},s.prototype._translateSoftphoneStreamStatistics=function(e){return e.forEach(function(e){"packetsCount"in e&&(e.packetCount=e.packetsCount,delete e.packetsCount)}),e},s.prototype._translateSoftphoneCallReport=function(e){return"handshakingTimeMillis"in e&&(e.handshakeTimeMillis=e.handshakingTimeMillis,delete e.handshakingTimeMillis),"preTalkingTimeMillis"in e&&(e.preTalkTimeMillis=e.preTalkingTimeMillis,delete e.preTalkingTimeMillis),"handshakingFailure"in e&&(e.handshakeFailure=e.handshakingFailure,delete e.handshakingFailure),"talkingTimeMillis"in e&&(e.talkTimeMillis=e.talkingTimeMillis,delete e.talkingTimeMillis),e.softphoneStreamStatistics=this._translateSoftphoneStreamStatistics(e.softphoneStreamStatistics),e},connect.ClientBase=o,connect.NullClient=e,connect.UpstreamConduitClient=n,connect.UpstreamConduitMasterClient=r,connect.AWSClient=s,connect.AgentAppClient=i}(),function(){function o(e,t){connect.assertNotNull(e,"fromState"),connect.assertNotNull(t,"toState"),this.fromState=e,this.toState=t}function e(e,t,n){connect.assertNotNull(e,"fromState"),connect.assertNotNull(t,"toState"),connect.assertNotNull(n,"associations"),o.call(this,e,t),this.associations=n}function i(e,t,n){connect.assertNotNull(e,"fromState"),connect.assertNotNull(t,"toState"),connect.assertNotNull(n,"closure"),connect.assertTrue(connect.isFunction(n),"closure must be a function"),o.call(this,e,t),this.closure=n}function s(){this.fromMap={}}connect=this.connect||{},this.connect=connect,this.lily=connect,o.prototype.getAssociations=function(e){throw connect.NotImplementedError()},o.prototype.getFromState=function(){return this.fromState},o.prototype.getToState=function(){return this.toState},((e.prototype=Object.create(o.prototype)).constructor=e).prototype.getAssociations=function(e){return this.associations},((i.prototype=Object.create(o.prototype)).constructor=i).prototype.getAssociations=function(e){return this.closure(e,this.getFromState(),this.getToState())},s.ANY="<<any>>",s.prototype.assoc=function(t,n,o){var r=this;if(!t)throw new Error("fromStateObj is not defined.");if(!n)throw new Error("toStateObj is not defined.");if(!o)throw new Error("assocObj is not defined.");return t instanceof Array?t.forEach(function(e){r.assoc(e,n,o)}):n instanceof Array?n.forEach(function(e){r.assoc(t,e,o)}):"function"==typeof o?this._addAssociation(new i(t,n,o)):o instanceof Array?this._addAssociation(new e(t,n,o)):this._addAssociation(new e(t,n,[o])),this},s.prototype.getAssociations=function(e,t,n){connect.assertNotNull(t,"fromState"),connect.assertNotNull(n,"toState");var o=[],r=this.fromMap[s.ANY]||{},i=this.fromMap[t]||{};return o=(o=o.concat(this._getAssociationsFromMap(r,e,t,n))).concat(this._getAssociationsFromMap(i,e,t,n))},s.prototype._addAssociation=function(e){var t=this.fromMap[e.getFromState()];((t=t||(this.fromMap[e.getFromState()]={}))[e.getToState()]||(t[e.getToState()]=[])).push(e)},s.prototype._getAssociationsFromMap=function(e,n,t,o){return(e[s.ANY]||[]).concat(e[o]||[]).reduce(function(e,t){return e.concat(t.getAssociations(n))},[])},connect.EventGraph=s}(),function(){var n=this;function e(){if(!connect.agent.initialized)throw new connect.StateError("The agent is not yet initialized!")}function t(e){connect.Agent.call(this),this.agentData=e}function o(e){this.contactId=e}function r(e){connect.Contact.call(this,e.contactId),this.contactData=e}function i(e,t){this.contactId=e,this.connectionId=t,this._initMediaController()}function s(e){this.contactId=e}function c(e,t){this._speakerAuthenticator=new s(e),i.call(this,e,t)}function a(e,t){i.call(this,e,t)}function u(e,t){i.call(this,e,t)}function l(e){connect.Connection.call(this,e.contactId,e.connectionId),this.connectionData=e}function p(e){e=e||{},this.endpointARN=e.endpointId||e.endpointARN||null,this.endpointId=this.endpointARN,this.type=e.type||null,this.name=e.name||null,this.phoneNumber=e.phoneNumber||null,this.agentLogin=e.agentLogin||null,this.queue=e.queue||null}function h(e,t,n){this.errorType=e,this.errorMessage=t,this.endPointUrl=n}connect=n.connect||{},n.connect=connect,n.lily=connect,connect.AgentStateType=connect.makeEnum(["init","routable","not_routable","offline"]),connect.AgentStatusType=connect.AgentStateType,connect.AgentAvailStates=connect.makeEnum(["Init","Busy","AfterCallWork","CallingCustomer","Dialing","Joining","PendingAvailable","PendingBusy"]),connect.AgentErrorStates=connect.makeEnum(["Error","AgentHungUp","BadAddressAgent","BadAddressCustomer","Default","FailedConnectAgent","FailedConnectCustomer","LineEngagedAgent","LineEngagedCustomer","MissedCallAgent","MissedCallCustomer","MultipleCcpWindows","RealtimeCommunicationError"]),connect.EndpointType=connect.makeEnum(["phone_number","agent","queue"]),connect.AddressType=connect.EndpointType,connect.ConnectionType=connect.makeEnum(["agent","inbound","outbound","monitoring"]),connect.ConnectionStateType=connect.makeEnum(["init","connecting","connected","hold","disconnected"]),connect.ConnectionStatusType=connect.ConnectionStateType,connect.CONNECTION_ACTIVE_STATES=connect.set([connect.ConnectionStateType.CONNECTING,connect.ConnectionStateType.CONNECTED,connect.ConnectionStateType.HOLD]),connect.ContactStateType=connect.makeEnum(["init","incoming","pending","connecting","connected","missed","error","ended"]),connect.ContactStatusType=connect.ContactStateType,connect.CONTACT_ACTIVE_STATES=connect.makeEnum(["incoming","pending","connecting","connected"]),connect.ContactType=connect.makeEnum(["voice","queue_callback","chat","task"]),connect.ContactInitiationMethod=connect.makeEnum(["inbound","outbound","transfer","queue_transfer","callback","api","disconnect"]),connect.ChannelType=connect.makeEnum(["VOICE","CHAT","TASK"]),connect.MediaType=connect.makeEnum(["softphone","chat","task"]),connect.SoftphoneCallType=connect.makeEnum(["audio_video","video_only","audio_only","none"]),connect.SoftphoneErrorTypes=connect.makeEnum(["unsupported_browser","microphone_not_shared","signalling_handshake_failure","signalling_connection_failure","ice_collection_timeout","user_busy_error","webrtc_error","realtime_communication_error","other"]),connect.VoiceIdErrorTypes=connect.makeEnum(["no_speaker_id_found","get_speaker_id_failed","get_speaker_status_failed","opt_out_speaker_failed","start_session_failed","evaluate_speaker_failed","describe_session_failed","enroll_speaker_failed","update_speaker_id_failed","not_supported_on_conference_calls","timeout"]),connect.CTIExceptions=connect.makeEnum(["AccessDeniedException","InvalidStateException","BadEndpointException","InvalidAgentARNException","InvalidConfigurationException","InvalidContactTypeException","PaginationException","RefreshTokenExpiredException","SendDataFailedException","UnauthorizedException","QuotaExceededException"]),connect.VoiceIdStreamingStatus=connect.makeEnum(["ONGOING","ENDED"]),connect.VoiceIdAuthenticationDecision=connect.makeEnum(["ACCEPT","REJECT","NOT_ENOUGH_SPEECH","SPEAKER_NOT_ENROLLED","SPEAKER_OPTED_OUT","SPEAKER_ID_NOT_PROVIDED"]),connect.ContactFlowAuthenticationDecision=connect.makeEnum(["Authenticated","NotAuthenticated","Inconclusive","NotEnrolled","OptedOut","Error"]),connect.VoiceIdEnrollmentRequestStatus=connect.makeEnum(["NOT_ENOUGH_SPEECH","IN_PROGRESS","COMPLETED","FAILED"]),e.prototype._getData=function(){return connect.core.getAgentDataProvider().getAgentData()},e.prototype._createContactAPI=function(e){return new connect.Contact(e.contactId)},e.prototype.onContactPending=function(e){connect.core.getEventBus().subscribe(connect.AgentEvents.CONTACT_PENDING,e)},e.prototype.onRefresh=function(e){connect.core.getEventBus().subscribe(connect.AgentEvents.REFRESH,e)},e.prototype.onRoutable=function(e){connect.core.getEventBus().subscribe(connect.AgentEvents.ROUTABLE,e)},e.prototype.onNotRoutable=function(e){connect.core.getEventBus().subscribe(connect.AgentEvents.NOT_ROUTABLE,e)},e.prototype.onOffline=function(e){connect.core.getEventBus().subscribe(connect.AgentEvents.OFFLINE,e)},e.prototype.onError=function(e){connect.core.getEventBus().subscribe(connect.AgentEvents.ERROR,e)},e.prototype.onSoftphoneError=function(e){connect.core.getEventBus().subscribe(connect.AgentEvents.SOFTPHONE_ERROR,e)},e.prototype.onWebSocketConnectionLost=function(e){connect.core.getEventBus().subscribe(connect.AgentEvents.WEBSOCKET_CONNECTION_LOST,e)},e.prototype.onWebSocketConnectionGained=function(e){connect.core.getEventBus().subscribe(connect.AgentEvents.WEBSOCKET_CONNECTION_GAINED,e)},e.prototype.onAfterCallWork=function(e){connect.core.getEventBus().subscribe(connect.AgentEvents.ACW,e)},e.prototype.onStateChange=function(e){connect.core.getEventBus().subscribe(connect.AgentEvents.STATE_CHANGE,e)},e.prototype.onMuteToggle=function(e){connect.core.getUpstream().onUpstream(connect.AgentEvents.MUTE_TOGGLE,e)},e.prototype.onLocalMediaStreamCreated=function(e){connect.core.getUpstream().onUpstream(connect.AgentEvents.LOCAL_MEDIA_STREAM_CREATED,e)},e.prototype.onSpeakerDeviceChanged=function(e){connect.core.getUpstream().onUpstream(connect.AgentEvents.SPEAKER_DEVICE_CHANGED,e)},e.prototype.onMicrophoneDeviceChanged=function(e){connect.core.getUpstream().onUpstream(connect.AgentEvents.MICROPHONE_DEVICE_CHANGED,e)},e.prototype.onRingerDeviceChanged=function(e){connect.core.getUpstream().onUpstream(connect.AgentEvents.RINGER_DEVICE_CHANGED,e)},e.prototype.mute=function(){connect.core.getUpstream().sendUpstream(connect.EventType.BROADCAST,{event:connect.EventType.MUTE,data:{mute:!0}})},e.prototype.unmute=function(){connect.core.getUpstream().sendUpstream(connect.EventType.BROADCAST,{event:connect.EventType.MUTE,data:{mute:!1}})},e.prototype.setSpeakerDevice=function(e){connect.core.getUpstream().sendUpstream(connect.EventType.BROADCAST,{event:connect.AgentEvents.SET_SPEAKER_DEVICE,data:{deviceId:e}})},e.prototype.setMicrophoneDevice=function(e){connect.core.getUpstream().sendUpstream(connect.EventType.BROADCAST,{event:connect.AgentEvents.SET_MICROPHONE_DEVICE,data:{deviceId:e}})},e.prototype.setRingerDevice=function(e){connect.core.getUpstream().sendUpstream(connect.EventType.BROADCAST,{event:connect.AgentEvents.SET_RINGER_DEVICE,data:{deviceId:e}})},e.prototype.getState=function(){return this._getData().snapshot.state},e.prototype.getAvailabilityState=function(){return this._getData().snapshot.agentAvailabilityState},e.prototype.getStatus=e.prototype.getState,e.prototype.getStatusDuration=e.prototype.getStateDuration=function(){return connect.now()-this._getData().snapshot.state.startTimestamp.getTime()+connect.core.getSkew()},e.prototype.getPermissions=function(){return this.getConfiguration().permissions},e.prototype.getContacts=function(t){var n=this;return this._getData().snapshot.contacts.map(function(e){return n._createContactAPI(e)}).filter(function(e){return!t||e.getType()===t})},e.prototype.getConfiguration=function(){return this._getData().configuration},e.prototype.getAgentStates=function(){return this.getConfiguration().agentStates},e.prototype.getRoutingProfile=function(){return this.getConfiguration().routingProfile},e.prototype.getChannelConcurrency=function(e){var t=(t=this.getRoutingProfile().channelConcurrencyMap)||Object.keys(connect.ChannelType).reduce(function(e,t){return"TASK"!==t&&(e[connect.ChannelType[t]]=1),e},{});return e?t[e]||0:t},e.prototype.getName=function(){return this.getConfiguration().name},e.prototype.getExtension=function(){return this.getConfiguration().extension},e.prototype.getDialableCountries=function(){return this.getConfiguration().dialableCountries},e.prototype.isSoftphoneEnabled=function(){return this.getConfiguration().softphoneEnabled},e.prototype.setConfiguration=function(e,t){connect.core.getClient().call(connect.ClientMethods.UPDATE_AGENT_CONFIGURATION,{configuration:connect.assertNotNull(e,"configuration")},{success:function(e){connect.core.getUpstream().sendUpstream(connect.EventType.RELOAD_AGENT_CONFIGURATION),t.success&&t.success(e)},failure:t&&t.failure})},e.prototype.setStatus=e.prototype.setState=function(e,t){connect.core.getClient().call(connect.ClientMethods.PUT_AGENT_STATE,{state:connect.assertNotNull(e,"state")},t)},e.prototype.connect=function(e,t){var n=connect.core.getClient(),e=new connect.Endpoint(e);delete e.endpointId,n.call(connect.ClientMethods.CREATE_OUTBOUND_CONTACT,{endpoint:connect.assertNotNull(e,"endpoint"),queueARN:t&&(t.queueARN||t.queueId)||this.getRoutingProfile().defaultOutboundQueue.queueARN},t&&{success:t.success,failure:t.failure})},e.prototype.getAllQueueARNs=function(){return this.getConfiguration().routingProfile.queues.map(function(e){return e.queueARN})},e.prototype.getAddresses=e.prototype.getEndpoints=function(t,n,e){var o=this,r=connect.core.getClient();connect.assertNotNull(n,"callbacks"),connect.assertNotNull(n.success,"callbacks.success");var i=e||{};i.endpoints=i.endpoints||[],i.maxResults=i.maxResults||connect.DEFAULT_BATCH_SIZE,connect.isArray(t)||(t=[t]),r.call(connect.ClientMethods.GET_ENDPOINTS,{queueARNs:t,nextToken:i.nextToken||null,maxResults:i.maxResults},{success:function(e){e.nextToken?o.getEndpoints(t,n,{nextToken:e.nextToken,maxResults:i.maxResults,endpoints:i.endpoints.concat(e.endpoints)}):(i.endpoints=i.endpoints.concat(e.endpoints),e=i.endpoints.map(function(e){return new connect.Endpoint(e)}),n.success({endpoints:e,addresses:e}))},failure:n.failure})},e.prototype.toSnapshot=function(){return new connect.AgentSnapshot(this._getData())},((t.prototype=Object.create(e.prototype)).constructor=t).prototype._getData=function(){return this.agentData},t.prototype._createContactAPI=function(e){return new connect.ContactSnapshot(e)},o.prototype._getData=function(){return connect.core.getAgentDataProvider().getContactData(this.getContactId())},o.prototype._createConnectionAPI=function(e){return new(this.getType()===connect.ContactType.CHAT?connect.ChatConnection:this.getType()===connect.ContactType.TASK?connect.TaskConnection:connect.VoiceConnection)(this.contactId,e.connectionId)},o.prototype.getEventName=function(e){return connect.core.getContactEventName(e,this.getContactId())},o.prototype.onRefresh=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.REFRESH),e)},o.prototype.onIncoming=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.INCOMING),e)},o.prototype.onConnecting=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.CONNECTING),e)},o.prototype.onPending=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.PENDING),e)},o.prototype.onAccepted=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.ACCEPTED),e)},o.prototype.onMissed=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.MISSED),e)},o.prototype.onEnded=function(e){var t=connect.core.getEventBus();t.subscribe(this.getEventName(connect.ContactEvents.ENDED),e),t.subscribe(this.getEventName(connect.ContactEvents.DESTROYED),e)},o.prototype.onDestroy=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.DESTROYED),e)},o.prototype.onACW=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.ACW),e)},o.prototype.onConnected=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.CONNECTED),e)},o.prototype.onError=function(e){connect.core.getEventBus().subscribe(this.getEventName(connect.ContactEvents.ERROR),e)},o.prototype.getContactId=function(){return this.contactId},o.prototype.getInitialContactId=o.prototype.getOriginalContactId=function(){return this._getData().initialContactId},o.prototype.getType=function(){return this._getData().type},o.prototype.getContactDuration=function(){return this._getData().contactDuration},o.prototype.getStatus=o.prototype.getState=function(){return this._getData().state},o.prototype.getStatusDuration=o.prototype.getStateDuration=function(){return connect.now()-this._getData().state.timestamp.getTime()+connect.core.getSkew()},o.prototype.getQueue=function(){return this._getData().queue},o.prototype.getQueueTimestamp=function(){return this._getData().queueTimestamp},o.prototype.getConnections=function(){var t=this;return this._getData().connections.map(function(e){return new(t.getType()===connect.ContactType.CHAT?connect.ChatConnection:t.getType()===connect.ContactType.TASK?connect.TaskConnection:connect.VoiceConnection)(t.contactId,e.connectionId)})},o.prototype.getInitialConnection=function(){return connect.find(this.getConnections(),function(e){return e.isInitialConnection()})||null},o.prototype.getActiveInitialConnection=function(){var e=this.getInitialConnection();return null!=e&&e.isActive()?e:null},o.prototype.getThirdPartyConnections=function(){return this.getConnections().filter(function(e){return!e.isInitialConnection()&&e.getType()!==connect.ConnectionType.AGENT})},o.prototype.getSingleActiveThirdPartyConnection=function(){return this.getThirdPartyConnections().filter(function(e){return e.isActive()})[0]||null},o.prototype.getAgentConnection=function(){return connect.find(this.getConnections(),function(e){e=e.getType();return e===connect.ConnectionType.AGENT||e===connect.ConnectionType.MONITORING})},o.prototype.getName=function(){return this._getData().name},o.prototype.getContactMetadata=function(){return this._getData().contactMetadata},o.prototype.getDescription=function(){return this._getData().description},o.prototype.getReferences=function(){return this._getData().references},o.prototype.getAttributes=function(){return this._getData().attributes},o.prototype.getContactFeatures=function(){return this._getData().contactFeatures},o.prototype.isSoftphoneCall=function(){return null!=connect.find(this.getConnections(),function(e){return null!=e.getSoftphoneMediaInfo()})},o.prototype._isInbound=function(){return this._getData().initiationMethod!==connect.ContactInitiationMethod.OUTBOUND},o.prototype.isInbound=function(){var e=this.getInitialConnection();return e.getMediaType()===connect.MediaType.TASK?this._isInbound():!!e&&e.getType()===connect.ConnectionType.INBOUND},o.prototype.isConnected=function(){return this.getStatus().type===connect.ContactStateType.CONNECTED},o.prototype.accept=function(n){var e=connect.core.getClient(),o=this,r=this.getContactId();e.call(connect.ClientMethods.ACCEPT_CONTACT,{contactId:r},{success:function(e){var t=connect.core.getUpstream();t.sendUpstream(connect.EventType.BROADCAST,{event:connect.ContactEvents.ACCEPTED,data:new connect.Contact(r)}),t.sendUpstream(connect.EventType.BROADCAST,{event:connect.core.getContactEventName(connect.ContactEvents.ACCEPTED,o.getContactId()),data:new connect.Contact(r)}),n&&n.success&&n.success(e)},failure:n?n.failure:null})},o.prototype.destroy=function(){connect.getLog().warn("contact.destroy() has been deprecated.")},o.prototype.reject=function(e){connect.core.getClient().call(connect.ClientMethods.REJECT_CONTACT,{contactId:this.getContactId()},e)},o.prototype.complete=function(e){connect.core.getClient().call(connect.ClientMethods.COMPLETE_CONTACT,{contactId:this.getContactId()},e)},o.prototype.clear=function(e){connect.core.getClient().call(connect.ClientMethods.CLEAR_CONTACT,{contactId:this.getContactId()},e)},o.prototype.notifyIssue=function(e,t,n){connect.core.getClient().call(connect.ClientMethods.NOTIFY_CONTACT_ISSUE,{contactId:this.getContactId(),issueCode:e,description:t},n)},o.prototype.addConnection=function(e,t){var n=connect.core.getClient(),e=new connect.Endpoint(e);delete e.endpointId,n.call(connect.ClientMethods.CREATE_ADDITIONAL_CONNECTION,{contactId:this.getContactId(),endpoint:e},t)},o.prototype.toggleActiveConnections=function(e){var t=connect.core.getClient(),n=null,o=connect.find(this.getConnections(),function(e){return e.getStatus().type===connect.ConnectionStateType.HOLD});null!=o?n=o.getConnectionId():0<(o=this.getConnections().filter(function(e){return e.isActive()})).length&&(n=o[0].getConnectionId()),t.call(connect.ClientMethods.TOGGLE_ACTIVE_CONNECTIONS,{contactId:this.getContactId(),connectionId:n},e)},o.prototype.sendSoftphoneMetrics=function(e,t){connect.core.getClient().call(connect.ClientMethods.SEND_SOFTPHONE_CALL_METRICS,{contactId:this.getContactId(),ccpVersion:n.ccpVersion,softphoneStreamStatistics:e},t),connect.publishSoftphoneStats({contactId:this.getContactId(),ccpVersion:n.ccpVersion,stats:e})},o.prototype.sendSoftphoneReport=function(e,t){connect.core.getClient().call(connect.ClientMethods.SEND_SOFTPHONE_CALL_REPORT,{contactId:this.getContactId(),ccpVersion:n.ccpVersion,report:e},t),connect.publishSoftphoneReport({contactId:this.getContactId(),ccpVersion:n.ccpVersion,report:e})},o.prototype.conferenceConnections=function(e){connect.core.getClient().call(connect.ClientMethods.CONFERENCE_CONNECTIONS,{contactId:this.getContactId()},e)},o.prototype.toSnapshot=function(){return new connect.ContactSnapshot(this._getData())},((r.prototype=Object.create(o.prototype)).constructor=r).prototype._getData=function(){return this.contactData},r.prototype._createConnectionAPI=function(e){return new connect.ConnectionSnapshot(e)},i.prototype._getData=function(){return connect.core.getAgentDataProvider().getConnectionData(this.getContactId(),this.getConnectionId())},i.prototype.getContactId=function(){return this.contactId},i.prototype.getConnectionId=function(){return this.connectionId},i.prototype.getAddress=i.prototype.getEndpoint=function(){return new connect.Endpoint(this._getData().endpoint)},i.prototype.getStatus=i.prototype.getState=function(){return this._getData().state},i.prototype.getStatusDuration=i.prototype.getStateDuration=function(){return connect.now()-this._getData().state.timestamp.getTime()+connect.core.getSkew()},i.prototype.getType=function(){return this._getData().type},i.prototype.isInitialConnection=function(){return this._getData().initial},i.prototype.isActive=function(){return connect.contains(connect.CONNECTION_ACTIVE_STATES,this.getStatus().type)},i.prototype.isConnected=function(){return this.getStatus().type===connect.ConnectionStateType.CONNECTED},i.prototype.isConnecting=function(){return this.getStatus().type===connect.ConnectionStateType.CONNECTING},i.prototype.isOnHold=function(){return this.getStatus().type===connect.ConnectionStateType.HOLD},i.prototype.getSoftphoneMediaInfo=function(){return this._getData().softphoneMediaInfo},i.prototype.getMonitorInfo=function(){return this._getData().monitoringInfo},i.prototype.destroy=function(e){connect.core.getClient().call(connect.ClientMethods.DESTROY_CONNECTION,{contactId:this.getContactId(),connectionId:this.getConnectionId()},e)},i.prototype.sendDigits=function(e,t){connect.core.getClient().call(connect.ClientMethods.SEND_DIGITS,{contactId:this.getContactId(),connectionId:this.getConnectionId(),digits:e},t)},i.prototype.hold=function(e){connect.core.getClient().call(connect.ClientMethods.HOLD_CONNECTION,{contactId:this.getContactId(),connectionId:this.getConnectionId()},e)},i.prototype.resume=function(e){connect.core.getClient().call(connect.ClientMethods.RESUME_CONNECTION,{contactId:this.getContactId(),connectionId:this.getConnectionId()},e)},i.prototype.toSnapshot=function(){return new connect.ConnectionSnapshot(this._getData())},i.prototype._initMediaController=function(){this.getMediaInfo()&&connect.core.mediaFactory.get(this).catch(function(){})},i.prototype._isAgentConnectionType=function(){var e=this.getType();return e===connect.ConnectionType.AGENT||e===connect.ConnectionType.MONITORING},i.prototype._isAgentConnectionType=function(){var e=this.getType();return e===connect.ConnectionType.AGENT||e===connect.ConnectionType.MONITORING},s.prototype.getSpeakerId=function(){var e=this;e.checkConferenceCall();var t=connect.core.getClient();return new Promise(function(n,o){t.call(connect.AgentAppClientMethods.GET_SPEAKER_ID,{contactId:e.contactId,instanceId:connect.core.getAgentDataProvider().getInstanceId(),awsAccountId:connect.core.getAgentDataProvider().getAWSAccountId()},{success:function(e){var t;e.contactData.customerId?(t={speakerId:e.contactData.customerId},n(t)):(t=connect.VoiceIdError(connect.VoiceIdErrorTypes.NO_SPEAKER_ID_FOUND,"No speakerId assotiated with this call",err),o(t))},failure:function(e){connect.getLog().error("Get SpeakerId failed").withObject({err:e});e=connect.VoiceIdError(connect.VoiceIdErrorTypes.GET_SPEAKER_ID_FAILED,"Get SpeakerId failed",e);o(e)}})})},s.prototype.getSpeakerStatus=function(){var e=this;e.checkConferenceCall();var o=connect.core.getClient();return new Promise(function(t,n){e.getSpeakerId().then(function(e){o.call(connect.AgentAppClientMethods.GET_SPEAKER_STATUS,{SpeakerId:connect.assertNotNull(e.speakerId,"speakerId"),DomainId:"ConnectDefaultDomainId"},{success:function(e){t(e)},failure:function(e){connect.getLog().error("getSpeakerStatus failed").withObject({err:e});e=connect.VoiceIdError(connect.VoiceIdErrorTypes.GET_SPEAKER_STATUS_FAILED,"Get SpeakerStatus failed",e);n(e)}})}).catch(function(e){n(e)})})},s.prototype.optOutSpeaker=function(){var e=this;e.checkConferenceCall();var o=connect.core.getClient();return new Promise(function(t,n){e.getSpeakerId().then(function(e){o.call(connect.AgentAppClientMethods.OPT_OUT_VOICEID_SPEAKER,{SpeakerId:connect.assertNotNull(e.speakerId,"speakerId"),DomainId:"ConnectDefaultDomainId"},{success:function(e){connect.getLog().info("optOutSpeaker succeeded"),t(e)},failure:function(e){connect.getLog().error("optOutSpeaker failed").withObject({err:e});e=connect.VoiceIdError(connect.VoiceIdErrorTypes.OPT_OUT_SPEAKER_FAILED,"optOutSpeaker failed.",e);n(e)}})}).catch(function(e){n(e)})})},s.prototype.startSession=function(){var e=this;e.checkConferenceCall();var o=connect.core.getClient();return new Promise(function(t,n){o.call(connect.AgentAppClientMethods.START_VOICEID_SESSION,{contactId:e.contactId,instanceId:connect.core.getAgentDataProvider().getInstanceId(),customerAccountId:connect.core.getAgentDataProvider().getAWSAccountId(),clientToken:AWS.util.uuid.v4()},{success:function(e){e.sessionId?t(e):n(Error("No contact id is returned from start session api."))},failure:function(e){connect.getLog().error("startVoiceIdSession failed").withObject({err:e});e=connect.VoiceIdError(connect.VoiceIdErrorTypes.START_SESSION_FAILED,"startVoiceIdSession failed",e);n(e)}})})},s.prototype.evaluateSpeaker=function(e){var t=this;t.checkConferenceCall();var i=connect.core.getClient(),s=connect.core.getAgentDataProvider().getContactData(this.contactId),c=120;return new Promise(function(n,o){function r(){i.call(connect.AgentAppClientMethods.EVALUATE_SPEAKER_WITH_VOICEID,{SessionNameOrId:s.initialContactId||this.contactId},{success:function(e){if(1!=c--)if(e.StreamingStatus===connect.VoiceIdStreamingStatus.ENDED&&e.AuthenticationResult.Decision===connect.VoiceIdAuthenticationDecision.NOT_ENOUGH_SPEECH)e.AuthenticationResult.Decision=connect.ContactFlowAuthenticationDecision.INCONCLUSIVE,n(e);else if(e.AuthenticationResult.Decision!==connect.VoiceIdAuthenticationDecision.NOT_ENOUGH_SPEECH){switch(e.AuthenticationResult.Decision){case connect.VoiceIdAuthenticationDecision.ACCEPT:e.AuthenticationResult.Decision=connect.ContactFlowAuthenticationDecision.AUTHENTICATED;break;case connect.VoiceIdAuthenticationDecision.REJECT:e.AuthenticationResult.Decision=connect.ContactFlowAuthenticationDecision.NOT_AUTHENTICATED;break;case connect.VoiceIdAuthenticationDecision.SPEAKER_OPTED_OUT:e.AuthenticationResult.Decision=connect.ContactFlowAuthenticationDecision.OPT_OUT;break;case connect.VoiceIdAuthenticationDecision.SPEAKER_NOT_ENROLLED:e.AuthenticationResult.Decision=connect.ContactFlowAuthenticationDecision.NOT_ENROLLED;break;default:e.AuthenticationResult.Decision=connect.ContactFlowAuthenticationDecision.ERROR}n(e)}else setTimeout(function(){r()},1e3);else{connect.getLog().error("evaluateSpeaker timeout");var t=connect.VoiceIdError(connect.VoiceIdErrorTypes.TIMEOUT,"evaluateSpeaker timeout");o(t)}},failure:function(e){connect.getLog().error("evaluateSpeaker failed").withObject({err:e});e=connect.VoiceIdError(connect.VoiceIdErrorTypes.EVALUATE_SPEAKER_FAILED,"evaluateSpeaker failed",e);o(e)}})}e?t.startSession().then(function(e){r()}).catch(function(e){o(e)}):r()})},s.prototype.describeSession=function(){var r=this;r.checkConferenceCall();var e=connect.core.getClient(),i=connect.core.getAgentDataProvider().getContactData(this.contactId),s=120;return new Promise(function(n,o){!function t(){e.call(connect.AgentAppClientMethods.DESCRIBE_VOICEID_SESSION,{SessionNameOrId:i.initialContactId||this.contactId},{success:function(e){1!=s--?e.Session.EnrollmentRequestDetails.Status===connect.VoiceIdEnrollmentRequestStatus.COMPLETED?n(e):e.Session.EnrollmentRequestDetails.Status===connect.VoiceIdEnrollmentRequestStatus.IN_PROGRESS?setTimeout(function(){t()},5e3):e.Session.EnrollmentRequestDetails.Status===connect.VoiceIdEnrollmentRequestStatus.NOT_ENOUGH_SPEECH?e.Session.StreamingStatus===connect.VoiceIdStreamingStatus.ENDED?r.startSession().then(function(e){t()}).catch(function(e,t){o(e)}):setTimeout(function(){t()},5e3):o(Error(e.Session.EnrollmentRequestDetails.Status)):(connect.getLog().error("describeSession timeout"),e=connect.VoiceIdError(connect.VoiceIdErrorTypes.TIMEOUT,"describeSession timeout"),o(e))},failure:function(e){connect.getLog().error("describeSession failed").withObject({err:e}),e=connect.VoiceIdError(connect.VoiceIdErrorTypes.DESCRIBE_SESSION_FAILED,"describeSession failed",e),o(e)}})}()})},s.prototype.enrollSpeaker=function(){var o=this;o.checkConferenceCall();var e=connect.core.getClient(),r=connect.core.getAgentDataProvider().getContactData(this.contactId);return new Promise(function(t,n){e.call(connect.AgentAppClientMethods.ENROLL_SPEAKER_IN_VOICEID,{SessionNameOrId:r.initialContactId||this.contactId},{success:function(e){e.Status===connect.VoiceIdEnrollmentRequestStatus.COMPLETED?t(e):o.describeSession().then(function(e){t(e)}).catch(function(e){n(e)})},failure:function(e){connect.getLog().error("enrollSpeaker failed").withObject({err:e});e=connect.VoiceIdError(connect.VoiceIdErrorTypes.ENROLL_SPEAKER_FAILED,"enrollSpeaker failed",e);n(e)}})})},s.prototype.updateSpeakerId=function(e){this.checkConferenceCall();var o=connect.core.getClient(),r=connect.core.getAgentDataProvider().getContactData(this.contactId);return new Promise(function(t,n){o.call(connect.AgentAppClientMethods.UPDATE_VOICEID_SESSION,{SessionNameOrId:r.initialContactId||this.contactId,SpeakerId:connect.assertNotNull(e,"speakerId")},{success:function(e){t(e)},failure:function(e){connect.getLog().error("updateSpeakerId failed").withObject({err:e});e=connect.VoiceIdError(connect.VoiceIdErrorTypes.UPDATE_SPEAKER_ID_FAILED,"updateSpeakerId failed",e);n(e)}})})},s.prototype.checkConferenceCall=function(){if(2<connect.core.getAgentDataProvider().getContactData(this.contactId).connections.filter(function(e){return connect.contains(connect.CONNECTION_ACTIVE_STATES,e.state.type)}).length)throw new connect.NotImplementedError("VoiceId is not supported for conference calls")},((c.prototype=Object.create(i.prototype)).constructor=c).prototype.getSoftphoneMediaInfo=function(){return this._getData().softphoneMediaInfo},c.prototype.getMediaInfo=function(){return this._getData().softphoneMediaInfo},c.prototype.getMediaType=function(){return connect.MediaType.SOFTPHONE},c.prototype.getMediaController=function(){return connect.core.mediaFactory.get(this)},c.prototype.getVoiceIdSpeakerId=function(){return this._speakerAuthenticator.getSpeakerId()},c.prototype.getVoiceIdSpeakerStatus=function(){return this._speakerAuthenticator.getSpeakerStatus()},c.prototype.optOutVoiceIdSpeaker=function(){return this._speakerAuthenticator.optOutSpeaker()},c.prototype.evaluateSpeakerWithVoiceId=function(e){return this._speakerAuthenticator.evaluateSpeaker(e)},c.prototype.enrollSpeakerInVoiceId=function(){return this._speakerAuthenticator.enrollSpeaker()},c.prototype.updateVoiceIdSpeakerId=function(e){return this._speakerAuthenticator.updateSpeakerId(e)},((a.prototype=Object.create(i.prototype)).constructor=a).prototype.getMediaInfo=function(){var t=this._getData().chatMediaInfo;if(t){var e=connect.core.getAgentDataProvider().getContactData(this.contactId),n={contactId:this.contactId,initialContactId:e.initialContactId||this.contactId,participantId:this.connectionId,getConnectionToken:connect.hitch(this,this.getConnectionToken)};if(t.connectionData)try{n.participantToken=JSON.parse(t.connectionData).ConnectionAuthenticationToken}catch(e){connect.getLog().error(connect.LogComponent.CHAT,"Connection data is invalid").withObject(t).withException(e).sendInternalLogToServer(),n.participantToken=null}return n.participantToken=n.participantToken||null,n.originalInfo=this._getData().chatMediaInfo,n}return null},a.prototype.getConnectionToken=function(){client=connect.core.getClient();var e=connect.core.getAgentDataProvider().getContactData(this.contactId),o={transportType:connect.TRANSPORT_TYPES.CHAT_TOKEN,participantId:this.connectionId,contactId:e.initialContactId||this.contactId};return new Promise(function(t,n){client.call(connect.ClientMethods.CREATE_TRANSPORT,o,{success:function(e){connect.getLog().info("getConnectionToken succeeded").sendInternalLogToServer(),t(e)},failure:function(e,t){connect.getLog().error("getConnectionToken failed").sendInternalLogToServer().withObject({err:e,data:t}),n(Error("getConnectionToken failed"))}})})},a.prototype.getMediaType=function(){return connect.MediaType.CHAT},a.prototype.getMediaController=function(){return connect.core.mediaFactory.get(this)},a.prototype._initMediaController=function(){this._isAgentConnectionType()&&connect.core.mediaFactory.get(this).catch(function(){})},((u.prototype=Object.create(i.prototype)).constructor=u).prototype.getMediaType=function(){return connect.MediaType.TASK},u.prototype.getMediaInfo=function(){var e=connect.core.getAgentDataProvider().getContactData(this.contactId);return{contactId:this.contactId,initialContactId:e.initialContactId||this.contactId}},u.prototype.getMediaController=function(){return connect.core.mediaFactory.get(this)},((l.prototype=Object.create(i.prototype)).constructor=l).prototype._getData=function(){return this.connectionData},l.prototype._initMediaController=function(){},p.prototype.stripPhoneNumber=function(){return this.phoneNumber?this.phoneNumber.replace(/sip:([^@]*)@.*/,"$1"):""},p.byPhoneNumber=function(e,t){return new p({type:connect.EndpointType.PHONE_NUMBER,phoneNumber:e,name:t||null})},h.prototype.getErrorType=function(){return this.errorType},h.prototype.getErrorMessage=function(){return this.errorMessage},h.prototype.getEndPointUrl=function(){return this.endPointUrl},connect.agent=function(e){var t=connect.core.getEventBus().subscribe(connect.AgentEvents.INIT,e);return connect.agent.initialized&&e(new connect.Agent),t},connect.agent.initialized=!1,connect.contact=function(e){return connect.core.getEventBus().subscribe(connect.ContactEvents.INIT,e)},connect.onWebsocketInitFailure=function(e){var t=connect.core.getEventBus().subscribe(connect.WebSocketEvents.INIT_FAILURE,e);return connect.webSocketInitFailed&&e(),t},connect.ifMaster=function(e,t,n){if(connect.assertNotNull(e,"A topic must be provided."),connect.assertNotNull(t,"A true callback must be provided."),!connect.core.masterClient)return connect.getLog().warn("We can't be the master for topic '%s' because there is no master client!",e).sendInternalLogToServer(),void(n&&n());connect.core.getMasterClient().call(connect.MasterMethods.CHECK_MASTER,{topic:e},{success:function(e){e.isMaster?t():n&&n()}})},connect.becomeMaster=function(e){connect.assertNotNull(e,"A topic must be provided."),connect.core.getMasterClient().call(connect.MasterMethods.BECOME_MASTER,{topic:e})},connect.Agent=e,connect.AgentSnapshot=t,connect.Contact=o,connect.ContactSnapshot=r,connect.Connection=c,connect.BaseConnection=i,connect.VoiceConnection=c,connect.ChatConnection=a,connect.TaskConnection=u,connect.ConnectionSnapshot=l,connect.Endpoint=p,connect.Address=p,connect.SoftphoneError=h}(),function(n){var o={};function r(e){if(o[e])return o[e].exports;var t=o[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,r),t.l=!0,t.exports}r.m=n,r.c=o,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=2)}([function(e,t,n){"use strict";var o=n(1);function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var i={assertTrue:function(e,t){if(!e)throw new Error(t)},assertNotNull:function(e,t){return i.assertTrue(null!==e&&void 0!==r(e),Object(o.sprintf)("%s must be provided",t||"A value")),e},isNonEmptyString:function(e){return"string"==typeof e&&0<e.length},assertIsList:function(e,t){if(!Array.isArray(e))throw new Error(t+" is not an array")},isFunction:function(e){return!!(e&&e.constructor&&e.call&&e.apply)},isObject:function(e){return!("object"!==r(e)||null===e)},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e}},s=new RegExp("^(wss://)\\w*");i.validWSUrl=function(e){return s.test(e)},i.getSubscriptionResponse=function(e,t,n){return{topic:e,content:{status:t?"success":"failure",topics:n}}},i.assertIsObject=function(e,t){if(!i.isObject(e))throw new Error(t+" is not an object!")},i.addJitter=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,t=Math.min(t,1),n=.5<Math.random()?1:-1;return Math.floor(e+n*e*Math.random()*t)},i.isNetworkOnline=function(){return navigator.onLine};var U=i,q="aws/subscribe",F="aws/heartbeat",B="disconnected";function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function h(e,t,n){return t&&p(e.prototype,t),n&&p(e,n),e}var d=(h(C,[{key:"debug",value:function(e){}},{key:"info",value:function(e){}},{key:"warn",value:function(e){}},{key:"error",value:function(e){}}]),C),f={DEBUG:10,INFO:20,WARN:30,ERROR:40},g=(h(S,[{key:"writeToClientLogger",value:function(e,t){if(this.hasClientLogger())switch(e){case f.DEBUG:return this._clientLogger.debug(t);case f.INFO:return this._clientLogger.info(t);case f.WARN:return this._clientLogger.warn(t);case f.ERROR:return this._clientLogger.error(t)}}},{key:"isLevelEnabled",value:function(e){return e>=this._level}},{key:"hasClientLogger",value:function(){return null!==this._clientLogger}},{key:"getLogger",value:function(e){e=e.prefix||"";return"DEBUG"===this._logsDestination?this.consoleLoggerWrapper:new y(e)}},{key:"updateLoggerConfig",value:function(e){e=e||{};this._level=e.level||f.DEBUG,this._clientLogger=e.logger||null,this._logsDestination="NULL",e.debug&&(this._logsDestination="DEBUG"),e.logger&&(this._logsDestination="CLIENT_LOGGER")}}]),S),m=(h(b,[{key:"debug",value:function(){}},{key:"info",value:function(){}},{key:"warn",value:function(){}},{key:"error",value:function(){}}]),b),y=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}(E,m),h(E,[{key:"debug",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this._log(f.DEBUG,t)}},{key:"info",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this._log(f.INFO,t)}},{key:"warn",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this._log(f.WARN,t)}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this._log(f.ERROR,t)}},{key:"_shouldLog",value:function(e){return j.hasClientLogger()&&j.isLevelEnabled(e)}},{key:"_writeToClientLogger",value:function(e,t){return j.writeToClientLogger(e,t)}},{key:"_log",value:function(e,t){if(this._shouldLog(e)){t=this._convertToSingleStatement(t);return this._writeToClientLogger(e,t)}}},{key:"_convertToSingleStatement",value:function(e){var t="";this.prefix&&(t+=this.prefix+" ");for(var n=0;n<e.length;n++){var o=e[n];t+=this._convertToString(o)+" "}return t}},{key:"_convertToString",value:function(e){try{if(!e)return"";if(U.isString(e))return e;if(U.isObject(e)&&U.isFunction(e.toString)){var t=e.toString();if("[object Object]"!==t)return t}return JSON.stringify(e)}catch(t){return console.error("Error while converting argument to string",e,t),""}}}]),E),v=function(){var e=new m;return e.debug=console.debug,e.info=console.info,e.warn=console.warn,e.error=console.error,e},j=new g;function E(e){var t,n;return l(this,E),t=this,(n=!(n=a(E).call(this))||"object"!==c(n)&&"function"!=typeof n?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(t):n).prefix=e||"",n}function b(){l(this,b)}function S(){l(this,S),this.updateLoggerConfig(),this.consoleLoggerWrapper=v()}function C(){l(this,C)}n.d(t,"a",function(){return I});function T(){function o(e,t){e.forEach(function(e){try{e(t)}catch(e){M(m.error("Error executing callback",e))}})}function n(e){if(null===e)return"NULL";switch(e.readyState){case WebSocket.CONNECTING:return"CONNECTING";case WebSocket.OPEN:return"OPEN";case WebSocket.CLOSING:return"CLOSING";case WebSocket.CLOSED:return"CLOSED";default:return"UNDEFINED"}}function r(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"";M(m.debug("["+e+"] Primary WebSocket: "+n(v.primary)+" | Secondary WebSocket: "+n(v.secondary)))}function i(e){return R(e,WebSocket.OPEN)}function s(e){return null===e||void 0===e.readyState||R(e,WebSocket.CLOSED)}function c(){return i(k())}function a(){if(S.pendingResponse)return M(m.warn("Heartbeat response not received")),clearInterval(S.intervalHandle),S.pendingResponse=!1,void x();c()?(M(m.debug("Sending heartbeat")),k().send(L(F)),S.pendingResponse=!0):(M(m.warn("Failed to send heartbeat since WebSocket is not open")),r("sendHeartBeat"),x())}function u(){E.exponentialBackOffTime=1e3,S.pendingResponse=!1,E.reconnectWebSocket=!0,clearTimeout(E.lifeTimeTimeoutHandle),clearInterval(S.intervalHandle),clearTimeout(E.exponentialTimeoutHandle),clearTimeout(E.webSocketInitCheckerTimeoutId)}function t(){A.consecutiveFailedSubscribeAttempts=0,A.consecutiveNoResponseRequest=0,clearInterval(A.responseCheckIntervalId),clearInterval(A.reSubscribeIntervalId)}function l(){b.connectWebSocketRetryCount=0,b.connectionAttemptStartTime=null,b.noOpenConnectionsTimestamp=null}function e(){try{M(m.info("WebSocket connection established!")),r("webSocketOnOpen"),null!==E.connState&&E.connState!==B||o(C.connectionGain),E.connState="connected";var e=Date.now();o(C.connectionOpen,{connectWebSocketRetryCount:b.connectWebSocketRetryCount,connectionAttemptStartTime:b.connectionAttemptStartTime,noOpenConnectionsTimestamp:b.noOpenConnectionsTimestamp,connectionEstablishedTime:e,timeToConnect:e-b.connectionAttemptStartTime,timeWithoutConnection:b.noOpenConnectionsTimestamp?e-b.noOpenConnectionsTimestamp:null}),l(),u(),k().openTimestamp=Date.now(),0===I.subscribed.size&&i(v.secondary)&&O(v.primary,"[Primary WebSocket] Closing WebSocket"),(0<I.subscribed.size||0<I.pending.size)&&(i(v.secondary)&&M(m.info("Subscribing secondary websocket to topics of primary websocket")),I.subscribed.forEach(function(e){I.subscriptionHistory.add(e),I.pending.add(e)}),I.subscribed.clear(),N()),a(),S.intervalHandle=setInterval(a,1e4);var t=Math.min(U.addJitter(3e6,.1),1e3*T.connConfig.webSocketTransport.transportLifeTimeInSeconds);M(m.debug("Scheduling WebSocket manager reconnection, after delay "+t+" ms")),E.lifeTimeTimeoutHandle=setTimeout(function(){M(m.debug("Starting scheduled WebSocket manager reconnection")),x()},t)}catch(e){M(m.error("Error after establishing WebSocket connection",e))}}function p(e){r("webSocketOnError"),M(m.error("WebSocketManager Error, error_event: ",JSON.stringify(e))),x()}function h(e){var t=JSON.parse(e.data);switch(t.topic){case q:if(M(m.debug("Subscription Message received from webSocket server",e.data)),A.requestCompleted=!0,A.consecutiveNoResponseRequest=0,"success"===t.content.status)A.consecutiveFailedSubscribeAttempts=0,t.content.topics.forEach(function(e){I.subscriptionHistory.delete(e),I.pending.delete(e),I.subscribed.add(e)}),0===I.subscriptionHistory.size?i(v.secondary)&&(M(m.info("Successfully subscribed secondary websocket to all topics of primary websocket")),O(v.primary,"[Primary WebSocket] Closing WebSocket")):N(),o(C.subscriptionUpdate,t);else{if(clearInterval(A.reSubscribeIntervalId),++A.consecutiveFailedSubscribeAttempts,5===A.consecutiveFailedSubscribeAttempts)return o(C.subscriptionFailure,t),void(A.consecutiveFailedSubscribeAttempts=0);A.reSubscribeIntervalId=setInterval(function(){N()},500)}break;case F:M(m.debug("Heartbeat response received")),S.pendingResponse=!1;break;default:if(t.topic){if(M(m.debug("Message received for topic "+t.topic)),i(v.primary)&&i(v.secondary)&&0===I.subscriptionHistory.size&&this===v.primary)return void M(m.warn("Ignoring Message for Topic "+t.topic+", to avoid duplicates"));if(0===C.allMessage.size&&0===C.topic.size)return void M(m.warn("No registered callback listener for Topic",t.topic));o(C.allMessage,t),C.topic.has(t.topic)&&o(C.topic.get(t.topic),t)}else t.message?M(m.warn("WebSocketManager Message Error",t)):M(m.warn("Invalid incoming message",t))}}function d(e){O(v.primary,"[Primary] WebSocket "+e),O(v.secondary,"[Secondary] WebSocket "+e)}function f(e){u(),t(),M(m.error("WebSocket Initialization failed")),E.websocketInitFailed=!0,d("Terminating WebSocket Manager"),clearInterval(w),o(C.initFailure,{connectWebSocketRetryCount:b.connectWebSocketRetryCount,connectionAttemptStartTime:b.connectionAttemptStartTime,reason:e}),l()}function g(e){return!!(U.isObject(e)&&U.isObject(e.webSocketTransport)&&U.isNonEmptyString(e.webSocketTransport.url)&&U.validWSUrl(e.webSocketTransport.url)&&3e5<=1e3*e.webSocketTransport.transportLifeTimeInSeconds)||(M(m.error("Invalid WebSocket Connection Configuration",e)),!1)}var m=j.getLogger({}),y=U.isNetworkOnline(),v={primary:null,secondary:null},E={reconnectWebSocket:!0,websocketInitFailed:!1,exponentialBackOffTime:1e3,exponentialTimeoutHandle:null,lifeTimeTimeoutHandle:null,webSocketInitCheckerTimeoutId:null,connState:null},b={connectWebSocketRetryCount:0,connectionAttemptStartTime:null,noOpenConnectionsTimestamp:null},S={pendingResponse:!1,intervalHandle:null},C={initFailure:new Set,getWebSocketTransport:null,subscriptionUpdate:new Set,subscriptionFailure:new Set,topic:new Map,allMessage:new Set,connectionGain:new Set,connectionLost:new Set,connectionOpen:new Set,connectionClose:new Set},T={connConfig:null,promiseHandle:null,promiseCompleted:!0},I={subscribed:new Set,pending:new Set,subscriptionHistory:new Set},A={responseCheckIntervalId:null,requestCompleted:!0,reSubscribeIntervalId:null,consecutiveFailedSubscribeAttempts:0,consecutiveNoResponseRequest:0},_=new Set([q,"aws/unsubscribe",F]),w=setInterval(function(){var e;y!==U.isNetworkOnline()&&((y=U.isNetworkOnline())?(e=k(),y&&(!e||R(e,WebSocket.CLOSING)||R(e,WebSocket.CLOSED))&&(M(m.info("Network online, connecting to WebSocket server")),x())):M(m.info("Network offline")))},250),R=function(e,t){return e&&e.readyState===t},k=function(){return null!==v.secondary?v.secondary:v.primary},N=function e(){if(3<A.consecutiveNoResponseRequest)return M(m.warn("Ignoring subscribePendingTopics since we have exhausted max subscription retries with no response")),void o(C.subscriptionFailure,U.getSubscriptionResponse(q,!1,Array.from(I.pending)));c()?(clearInterval(A.responseCheckIntervalId),k().send(L(q,{topics:Array.from(I.pending)})),A.requestCompleted=!1,A.responseCheckIntervalId=setInterval(function(){A.requestCompleted||(++A.consecutiveNoResponseRequest,e())},1e3)):M(m.warn("Ignoring subscribePendingTopics call since Default WebSocket is not open"))},O=function(e,t){R(e,WebSocket.CONNECTING)||R(e,WebSocket.OPEN)?e.close(1e3,t):M(m.warn("Ignoring WebSocket Close request, WebSocket State: "+n(e)))},L=function(e,t){return JSON.stringify({topic:e,content:t})},x=function(){if(U.isNetworkOnline())if(E.websocketInitFailed)M(m.debug("WebSocket Init had failed, ignoring this getWebSocketConnConfig request"));else{if(T.promiseCompleted)return u(),M(m.info("Fetching new WebSocket connection configuration")),b.connectionAttemptStartTime=b.connectionAttemptStartTime||Date.now(),T.promiseCompleted=!1,T.promiseHandle=C.getWebSocketTransport(),T.promiseHandle.then(function(e){return T.promiseCompleted=!0,M(m.debug("Successfully fetched webSocket connection configuration",e)),g(e)?(T.connConfig=e,T.connConfig.urlConnValidTime=Date.now()+85e3,D()):(f("Invalid WebSocket connection configuration: "+e),{webSocketConnectionFailed:!0})},function(e){return T.promiseCompleted=!0,M(m.error("Failed to fetch webSocket connection configuration",e)),{webSocketConnectionFailed:!0}});M(m.debug("There is an ongoing getWebSocketConnConfig request, this request will be ignored"))}else M(m.info("Network offline, ignoring this getWebSocketConnConfig request"))},D=function(){if(E.websocketInitFailed)return M(m.info("web-socket initializing had failed, aborting re-init")),{webSocketConnectionFailed:!0};if(!U.isNetworkOnline())return M(m.warn("System is offline aborting web-socket init")),{webSocketConnectionFailed:!0};M(m.info("Initializing Websocket Manager")),r("initWebSocket");try{if(g(T.connConfig)){var e=null,e=i(v.primary)?(M(m.debug("Primary Socket connection is already open")),R(v.secondary,WebSocket.CONNECTING)||(M(m.debug("Establishing a secondary web-socket connection")),v.secondary=P()),v.secondary):(R(v.primary,WebSocket.CONNECTING)||(M(m.debug("Establishing a primary web-socket connection")),v.primary=P()),v.primary);return E.webSocketInitCheckerTimeoutId=setTimeout(function(){i(e)||function(){b.connectWebSocketRetryCount++;var e=U.addJitter(E.exponentialBackOffTime,.3);Date.now()+e<=T.connConfig.urlConnValidTime?(M(m.debug("Scheduling WebSocket reinitialization, after delay "+e+" ms")),E.exponentialTimeoutHandle=setTimeout(function(){return D()},e),E.exponentialBackOffTime*=2):(M(m.warn("WebSocket URL cannot be used to establish connection")),x())}()},1e3),{webSocketConnectionFailed:!1}}}catch(e){return M(m.error("Error Initializing web-socket-manager",e)),f("Failed to initialize new WebSocket: "+e.message),{webSocketConnectionFailed:!0}}},P=function(){var n=new WebSocket(T.connConfig.webSocketTransport.url);return n.addEventListener("open",e),n.addEventListener("message",h),n.addEventListener("error",p),n.addEventListener("close",function(e){return t=e,e=n,M(m.info("Socket connection is closed",t)),r("webSocketOnClose before-cleanup"),o(C.connectionClose,{openTimestamp:e.openTimestamp,closeTimestamp:Date.now(),connectionDuration:Date.now()-e.openTimestamp,code:t.code,reason:t.reason}),s(v.primary)&&(v.primary=null),s(v.secondary)&&(v.secondary=null),void(E.reconnectWebSocket&&(i(v.primary)||i(v.secondary)?s(v.primary)&&i(v.secondary)&&(M(m.info("[Primary] WebSocket Cleanly Closed")),v.primary=v.secondary,v.secondary=null):(M(m.warn("Neither primary websocket and nor secondary websocket have open connections, attempting to re-establish connection")),E.connState===B?M(m.info("Ignoring connectionLost callback invocation")):(o(C.connectionLost,{openTimestamp:e.openTimestamp,closeTimestamp:Date.now(),connectionDuration:Date.now()-e.openTimestamp,code:t.code,reason:t.reason}),b.noOpenConnectionsTimestamp=Date.now()),E.connState=B,x()),r("webSocketOnClose after-cleanup")));var t}),n},M=function(e){return e&&"function"==typeof e.sendInternalLogToServer&&e.sendInternalLogToServer(),e};this.init=function(e){if(U.assertTrue(U.isFunction(e),"transportHandle must be a function"),null===C.getWebSocketTransport)return C.getWebSocketTransport=e,x();M(m.warn("Web Socket Manager was already initialized"))},this.onInitFailure=function(e){return U.assertTrue(U.isFunction(e),"cb must be a function"),C.initFailure.add(e),E.websocketInitFailed&&e(),function(){return C.initFailure.delete(e)}},this.onConnectionOpen=function(e){return U.assertTrue(U.isFunction(e),"cb must be a function"),C.connectionOpen.add(e),function(){return C.connectionOpen.delete(e)}},this.onConnectionClose=function(e){return U.assertTrue(U.isFunction(e),"cb must be a function"),C.connectionClose.add(e),function(){return C.connectionClose.delete(e)}},this.onConnectionGain=function(e){return U.assertTrue(U.isFunction(e),"cb must be a function"),C.connectionGain.add(e),c()&&e(),function(){return C.connectionGain.delete(e)}},this.onConnectionLost=function(e){return U.assertTrue(U.isFunction(e),"cb must be a function"),C.connectionLost.add(e),E.connState===B&&e(),function(){return C.connectionLost.delete(e)}},this.onSubscriptionUpdate=function(e){return U.assertTrue(U.isFunction(e),"cb must be a function"),C.subscriptionUpdate.add(e),function(){return C.subscriptionUpdate.delete(e)}},this.onSubscriptionFailure=function(e){return U.assertTrue(U.isFunction(e),"cb must be a function"),C.subscriptionFailure.add(e),function(){return C.subscriptionFailure.delete(e)}},this.onMessage=function(e,t){return U.assertNotNull(e,"topicName"),U.assertTrue(U.isFunction(t),"cb must be a function"),C.topic.has(e)?C.topic.get(e).add(t):C.topic.set(e,new Set([t])),function(){return C.topic.get(e).delete(t)}},this.onAllMessage=function(e){return U.assertTrue(U.isFunction(e),"cb must be a function"),C.allMessage.add(e),function(){return C.allMessage.delete(e)}},this.subscribeTopics=function(e){U.assertNotNull(e,"topics"),U.assertIsList(e),e.forEach(function(e){I.subscribed.has(e)||I.pending.add(e)}),A.consecutiveNoResponseRequest=0,N()},this.sendMessage=function(t){if(U.assertIsObject(t,"payload"),void 0===t.topic||_.has(t.topic))M(m.warn("Cannot send message, Invalid topic",t));else{try{t=JSON.stringify(t)}catch(e){return void M(m.warn("Error stringify message",t))}c()?k().send(t):M(m.warn("Cannot send message, web socket connection is not open"))}},this.closeWebSocket=function(){u(),t(),E.reconnectWebSocket=!1,clearInterval(w),d("User request to close WebSocket")},this.terminateWebSocketManager=f}var I={create:function(){return new T},setGlobalConfig:function(e){e=e.loggerConfig;j.updateLoggerConfig(e)},LogLevel:f,Logger:d}},function(t,n,o){var r;!function(){"use strict";var d={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function f(e){return function(e,t){for(var n,o,r,i,s,c,a,u=1,l=e.length,p="",h=0;h<l;h++)if("string"==typeof e[h])p+=e[h];else if("object"==typeof e[h]){if((r=e[h]).keys)for(n=t[u],o=0;o<r.keys.length;o++){if(null==n)throw new Error(f('[sprintf] Cannot access property "%s" of undefined value "%s"',r.keys[o],r.keys[o-1]));n=n[r.keys[o]]}else n=r.param_no?t[r.param_no]:t[u++];if(d.not_type.test(r.type)&&d.not_primitive.test(r.type)&&n instanceof Function&&(n=n()),d.numeric_arg.test(r.type)&&"number"!=typeof n&&isNaN(n))throw new TypeError(f("[sprintf] expecting number but found %T",n));switch(d.number.test(r.type)&&(c=0<=n),r.type){case"b":n=parseInt(n,10).toString(2);break;case"c":n=String.fromCharCode(parseInt(n,10));break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,r.width?parseInt(r.width):0);break;case"e":n=r.precision?parseFloat(n).toExponential(r.precision):parseFloat(n).toExponential();break;case"f":n=r.precision?parseFloat(n).toFixed(r.precision):parseFloat(n);break;case"g":n=r.precision?String(Number(n.toPrecision(r.precision))):parseFloat(n);break;case"o":n=(parseInt(n,10)>>>0).toString(8);break;case"s":n=String(n),n=r.precision?n.substring(0,r.precision):n;break;case"t":n=String(!!n),n=r.precision?n.substring(0,r.precision):n;break;case"T":n=Object.prototype.toString.call(n).slice(8,-1).toLowerCase(),n=r.precision?n.substring(0,r.precision):n;break;case"u":n=parseInt(n,10)>>>0;break;case"v":n=n.valueOf(),n=r.precision?n.substring(0,r.precision):n;break;case"x":n=(parseInt(n,10)>>>0).toString(16);break;case"X":n=(parseInt(n,10)>>>0).toString(16).toUpperCase()}d.json.test(r.type)?p+=n:(!d.number.test(r.type)||c&&!r.sign?a="":(a=c?"+":"-",n=n.toString().replace(d.sign,"")),i=r.pad_char?"0"===r.pad_char?"0":r.pad_char.charAt(1):" ",s=r.width-(a+n).length,s=r.width&&0<s?i.repeat(s):"",p+=r.align?a+n+s:"0"===i?a+s+n:s+a+n)}return p}(function(e){if(a[e])return a[e];for(var t,n=e,o=[],r=0;n;){if(null!==(t=d.text.exec(n)))o.push(t[0]);else if(null!==(t=d.modulo.exec(n)))o.push("%");else{if(null===(t=d.placeholder.exec(n)))throw new SyntaxError("[sprintf] unexpected placeholder");if(t[2]){r|=1;var i=[],s=t[2],c=[];if(null===(c=d.key.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(i.push(c[1]);""!==(s=s.substring(c[0].length));)if(null!==(c=d.key_access.exec(s)))i.push(c[1]);else{if(null===(c=d.index_access.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");i.push(c[1])}t[2]=i}else r|=2;if(3===r)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");o.push({placeholder:t[0],param_no:t[1],keys:t[2],sign:t[3],pad_char:t[4],align:t[5],width:t[6],precision:t[7],type:t[8]})}n=n.substring(t[0].length)}return a[e]=o}(e),arguments)}function e(e,t){return f.apply(null,[e].concat(t||[]))}var a=Object.create(null);n.sprintf=f,n.vsprintf=e,"undefined"!=typeof window&&(window.sprintf=f,window.vsprintf=e,void 0===(r=function(){return{sprintf:f,vsprintf:e}}.call(n,o,n,t))||(t.exports=r))}()},function(e,o,r){"use strict";r.r(o),function(e){r.d(o,"WebSocketManager",function(){return n});var t=r(0);e.connect=e.connect||{},connect.WebSocketManager=t.a;var n=t.a}.call(this,r(3))},function(e,t){var n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n}]),function(){var h=this;connect=h.connect||{},h.connect=connect,h.lily=connect,connect.core={},connect.core.initialized=!1,connect.version="1.6.3",connect.DEFAULT_BATCH_SIZE=500;var s="https://{alias}.awsapps.com/auth/?client_id={client_id}&redirect_uri={redirect}",c="06919f4fd8ed324e",d="/auth/authorize",f="/connect/auth/authorize";function o(e){e=e.match(/^(?:https?:\/\/)?(?:[^@\n]+@)?(?:www\.)?([^:\/\n?]+)/gi);return e.length?e[0]:""}function i(e,t){var n=e.getAgentStates().find(function(e){return e.type===connect.AgentStateType.OFFLINE});e.setState(n,t)}function n(e){connect.getLog().info("[Disaster Recovery] Signal sharedworker to set contacts suppressor to %s for instance %s.",e,connect.core.region).sendInternalLogToServer(),connect.core.getUpstream().sendUpstream(connect.DisasterRecoveryEvents.SUPPRESS,{suppress:e})}function a(e){connect.getLog().info("[DISASTER RECOVERY] Signal sharedworker to set forceOffline to %s for instance %s.",e,connect.core.region).sendInternalLogToServer(),connect.core.getUpstream().sendUpstream(connect.DisasterRecoveryEvents.FORCE_OFFLINE,{offline:e})}function r(){var r=connect.getLog();r.info("[Disaster Recovery] Attempting to force instance %s offline",connect.core.region).sendInternalLogToServer(),connect.agent(function(t){var n=0,o=t.getContacts();o.length?o.forEach(function(e){e.getAgentConnection().destroy({success:function(){++n===o.length&&(a(!1),i(t),r.info("[Disaster Recovery] Instance %s is now offline",connect.core.region).sendInternalLogToServer())},failure:function(e){r.warn("[Disaster Recovery] An error occured while attempting to force this instance to offline in region %s",connect.core.region).sendInternalLogToServer(),r.warn(e).sendInternalLogToServer(),a(!0)}})}):(a(!1),i(t),r.info("[Disaster Recovery] Instance %s is now offline",connect.core.region).sendInternalLogToServer())})}connect.core.checkNotInitialized=function(){connect.core.initialized&&connect.getLog().warn("Connect core already initialized, only needs to be initialized once.").sendInternalLogToServer()},connect.core.initDisasterRecovery=function(e){var t=connect.getLog();connect.core.region=e.region,connect.core.suppressContacts=n,connect.core.forceOffline=r,connect.core.getUpstream().onDownstream(connect.DisasterRecoveryEvents.SET_OFFLINE,function(){connect.core.forceOffline()}),connect.core.getUpstream().onUpstream(connect.DisasterRecoveryEvents.FORCE_OFFLINE,function(){connect.core.forceOffline()}),connect.ifMaster(connect.MasterTopics.SOFTPHONE,function(){t.info("[Disaster Recovery] Initializing region %s as part of a Disaster Recovery fleet",connect.core.region).sendInternalLogToServer()},function(){t.info("[Disaster Recovery] %s already part of a Disaster Recovery fleet",connect.core.region).sendInternalLogToServer()}),e.isPrimary?(connect.core.suppressContacts(!1),t.info("[Disaster Recovery] %s instance is set to primary",connect.core.region).sendInternalLogToServer()):(connect.core.suppressContacts(!0),connect.core.forceOffline(),t.info("[Disaster Recovery] %s instance is set to stand-by",connect.core.region).sendInternalLogToServer())},connect.core.init=function(e){connect.core.eventBus=new connect.EventBus,connect.core.agentDataProvider=new m(connect.core.getEventBus()),connect.core.initClient(e),connect.core.initAgentAppClient(e),connect.core.initialized=!0},connect.core.initClient=function(e){connect.assertNotNull(e,"params");var t=connect.assertNotNull(e.authToken,"params.authToken"),n=connect.assertNotNull(e.region,"params.region"),e=e.endpoint||null;connect.core.client=new connect.AWSClient(t,n,e)},connect.core.initAgentAppClient=function(e){connect.assertNotNull(e,"params");var t=connect.assertNotNull(e.authToken,"params.authToken"),n=connect.assertNotNull(e.authCookieName,"params.authCookieName"),e=connect.assertNotNull(e.agentAppEndpoint,"params.agentAppEndpoint");connect.core.agentAppClient=new connect.AgentAppClient(n,t,e)},connect.core.terminate=function(){connect.core.client=new connect.NullClient,connect.core.agentAppClient=new connect.NullClient,connect.core.masterClient=new connect.NullClient;var e=connect.core.getEventBus();e&&e.unsubscribeAll(),connect.core.bus=new connect.EventBus,connect.core.agentDataProvider=null,connect.core.softphoneManager=null,connect.core.upstream=null,connect.core.keepaliveManager=null,connect.agent.initialized=!1,connect.core.initialized=!1},connect.core.softphoneUserMediaStream=null,connect.core.getSoftphoneUserMediaStream=function(){return connect.core.softphoneUserMediaStream},connect.core.setSoftphoneUserMediaStream=function(e){connect.core.softphoneUserMediaStream=e},connect.core.initRingtoneEngines=function(t){connect.assertNotNull(t,"params");function n(t){connect.assertNotNull(t,"ringtoneSettings"),connect.assertNotNull(t.voice,"ringtoneSettings.voice"),connect.assertTrue(t.voice.ringtoneUrl||t.voice.disabled,"ringtoneSettings.voice.ringtoneUrl must be provided or ringtoneSettings.voice.disabled must be true"),connect.assertNotNull(t.queue_callback,"ringtoneSettings.queue_callback"),connect.assertTrue(t.queue_callback.ringtoneUrl||t.queue_callback.disabled,"ringtoneSettings.voice.ringtoneUrl must be provided or ringtoneSettings.queue_callback.disabled must be true"),connect.core.ringtoneEngines={},connect.agent(function(e){e.onRefresh(function(){connect.ifMaster(connect.MasterTopics.RINGTONE,function(){t.voice.disabled||connect.core.ringtoneEngines.voice||(connect.core.ringtoneEngines.voice=new connect.VoiceRingtoneEngine(t.voice),connect.getLog().info("VoiceRingtoneEngine initialized.").sendInternalLogToServer()),t.chat.disabled||connect.core.ringtoneEngines.chat||(connect.core.ringtoneEngines.chat=new connect.ChatRingtoneEngine(t.chat),connect.getLog().info("ChatRingtoneEngine initialized.").sendInternalLogToServer()),t.task.disabled||connect.core.ringtoneEngines.task||(connect.core.ringtoneEngines.task=new connect.TaskRingtoneEngine(t.task),connect.getLog().info("TaskRingtoneEngine initialized.").sendInternalLogToServer()),t.queue_callback.disabled||connect.core.ringtoneEngines.queue_callback||(connect.core.ringtoneEngines.queue_callback=new connect.QueueCallbackRingtoneEngine(t.queue_callback),connect.getLog().info("QueueCallbackRingtoneEngine initialized.").sendInternalLogToServer())})})}),e()}function o(e,t){e.ringtone=e.ringtone||{},e.ringtone.voice=e.ringtone.voice||{},e.ringtone.queue_callback=e.ringtone.queue_callback||{},e.ringtone.chat=e.ringtone.chat||{disabled:!0},e.ringtone.task=e.ringtone.task||{disabled:!0},t.softphone&&(t.softphone.disableRingtone&&(e.ringtone.voice.disabled=!0,e.ringtone.queue_callback.disabled=!0),t.softphone.ringtoneUrl&&(e.ringtone.voice.ringtoneUrl=t.softphone.ringtoneUrl,e.ringtone.queue_callback.ringtoneUrl=t.softphone.ringtoneUrl)),t.chat&&(t.chat.disableRingtone&&(e.ringtone.chat.disabled=!0),t.chat.ringtoneUrl&&(e.ringtone.chat.ringtoneUrl=t.chat.ringtoneUrl)),t.ringtone&&(e.ringtone.voice=connect.merge(e.ringtone.voice,t.ringtone.voice||{}),e.ringtone.queue_callback=connect.merge(e.ringtone.queue_callback,t.ringtone.voice||{}),e.ringtone.chat=connect.merge(e.ringtone.chat,t.ringtone.chat||{}))}o(t,t),connect.isFramed()?connect.core.getEventBus().subscribe(connect.EventType.CONFIGURE,function(e){this.unsubscribe(),o(t,e),n(t.ringtone)}):n(t.ringtone)};var e=function(){connect.core.getEventBus().subscribe(connect.ConfigurationEvents.SET_RINGER_DEVICE,t)},t=function(e){if(0!==connect.keys(connect.core.ringtoneEngines).length&&e&&e.deviceId){var t,n=e.deviceId;for(t in connect.core.ringtoneEngines)connect.core.ringtoneEngines[t].setOutputDevice(n);connect.core.getUpstream().sendUpstream(connect.EventType.BROADCAST,{event:connect.ConfigurationEvents.RINGER_DEVICE_CHANGED,data:{deviceId:n}})}};connect.core.initSoftphoneManager=function(e){function t(e){var n=connect.merge(o.softphone||{},e);connect.agent(function(t){t.getChannelConcurrency(connect.ChannelType.VOICE)&&t.onRefresh(function(){var e=this;connect.ifMaster(connect.MasterTopics.SOFTPHONE,function(){!connect.core.softphoneManager&&t.isSoftphoneEnabled()&&(connect.becomeMaster(connect.MasterTopics.SEND_LOGS),connect.core.softphoneManager=new connect.SoftphoneManager(n),e.unsubscribe())})})})}var o=e||{};connect.isFramed()&&!o.allowFramedSoftphone?connect.core.getEventBus().subscribe(connect.EventType.CONFIGURE,function(e){e.softphone&&e.softphone.allowFramedSoftphone&&(this.unsubscribe(),t(e.softphone))}):t(o),connect.agent(function(e){e.isSoftphoneEnabled()&&e.getChannelConcurrency(connect.ChannelType.VOICE)&&connect.core.getUpstream().sendUpstream(connect.EventType.BROADCAST,{event:connect.EventType.MUTE})})},connect.core.initPageOptions=function(e){connect.assertNotNull(e,"params"),connect.isFramed()&&connect.core.getEventBus().subscribe(connect.EventType.CONFIGURE,function(e){connect.core.getUpstream().sendUpstream(connect.EventType.BROADCAST,{event:connect.ConfigurationEvents.CONFIGURE,data:e})})},connect.core.authorize=function(e){e=e||(connect.core.isLegacyDomain()?f:d);return connect.fetch(e,{credentials:"include"},2e3,5)},connect.core.verifyDomainAccess=function(e,t){if(connect.getLog().warn("This API will be deprecated in the next major version release"),!connect.isFramed())return Promise.resolve();var n={headers:{"X-Amz-Bearer":e}},e=null,e=t||(connect.core.isLegacyDomain()?"/connect/whitelisted-origins":"/whitelisted-origins");return connect.fetch(e,n,2e3,5).then(function(e){var t=o(window.document.referrer);return e.whitelistedOrigins.some(function(e){return t===o(e)})?Promise.resolve():Promise.reject()})},connect.core.isLegacyDomain=function(e){return(e=e||window.location.href).includes(".awsapps.com")},connect.core.initSharedWorker=function(e){if(connect.core.checkNotInitialized(),!connect.core.initialized){connect.assertNotNull(e,"params");var t=connect.assertNotNull(e.sharedWorkerUrl,"params.sharedWorkerUrl"),n=connect.assertNotNull(e.authToken,"params.authToken"),o=connect.assertNotNull(e.refreshToken,"params.refreshToken"),r=connect.assertNotNull(e.authTokenExpiration,"params.authTokenExpiration"),i=connect.assertNotNull(e.region,"params.region"),s=e.endpoint||null,c=(c=e.authorizeEndpoint)||(connect.core.isLegacyDomain()?f:d),a=e.agentAppEndpoint||null,u=e.authCookieName||null;try{connect.core.eventBus=new connect.EventBus({logEvents:!0}),connect.core.agentDataProvider=new m(connect.core.getEventBus()),connect.core.mediaFactory=new connect.MediaFactory(e);var l=new SharedWorker(t,"ConnectSharedWorker"),p=new connect.Conduit("ConnectSharedWorkerConduit",new connect.PortStream(l.port),new connect.WindowIOStream(window,parent));connect.core.upstream=p,connect.core.webSocketProvider=new g,h.onunload=function(){p.sendUpstream(connect.EventType.CLOSE),l.port.close()},connect.getLog().scheduleUpstreamLogPush(p),connect.getLog().scheduleDownstreamClientSideLogsPush(),p.onAllUpstream(connect.core.getEventBus().bridge()),p.onAllDownstream(connect.core.getEventBus().bridge()),p.onAllUpstream(p.passDownstream()),p.onAllDownstream(p.passUpstream()),p.sendUpstream(connect.EventType.CONFIGURE,{authToken:n,authTokenExpiration:r,endpoint:s,refreshToken:o,region:i,authorizeEndpoint:c,agentAppEndpoint:a,authCookieName:u}),p.onUpstream(connect.EventType.ACKNOWLEDGE,function(){connect.getLog().info("Acknowledged by the ConnectSharedWorker!").sendInternalLogToServer(),connect.core.initialized=!0,this.unsubscribe()}),p.onUpstream(connect.EventType.LOG,function(e){e.loggerId!==connect.getLog().getLoggerId()&&connect.getLog().addLogEntry(connect.LogEntry.fromObject(e))}),p.onUpstream(connect.EventType.SERVER_BOUND_INTERNAL_LOG,function(e){e.loggerId!==connect.getLog().getLoggerId()&&connect.getLog().sendInternalLogEntryToServer(connect.LogEntry.fromObject(e))}),p.onUpstream(connect.EventType.AUTH_FAIL,function(e){location.reload()}),connect.core.client=new connect.UpstreamConduitClient(p),connect.core.masterClient=new connect.UpstreamConduitMasterClient(p),connect.core.getEventBus().subscribe(connect.EventType.TERMINATE,p.passUpstream()),connect.core.getEventBus().subscribe(connect.EventType.TERMINATED,function(){window.location.reload(!0)}),l.port.start(),connect.core.getNotificationManager().requestPermission(),p.onDownstream(connect.DisasterRecoveryEvents.INIT_DISASTER_RECOVERY,function(e){connect.core.initDisasterRecovery(e)})}catch(e){connect.getLog().error("Failed to initialize the API shared worker, we're dead!").withException(e).sendInternalLogToServer()}}},connect.core.initCCP=function(e,t){var o,r,i;connect.core.checkNotInitialized(),connect.core.initialized||(o={},"string"==typeof t?o.ccpUrl=t:o=t,connect.assertNotNull(e,"containerDiv"),connect.assertNotNull(o.ccpUrl,"params.ccpUrl"),(r=document.createElement("iframe")).src=o.ccpUrl,r.allow="microphone; autoplay",r.style="width: 100%; height: 100%",e.appendChild(r),connect.core.eventBus=new connect.EventBus({logEvents:!1}),connect.core.agentDataProvider=new m(connect.core.getEventBus()),connect.core.mediaFactory=new connect.MediaFactory(o),i=new connect.IFrameConduit(o.ccpUrl,window,r),r.onload=setTimeout(function(){var e={display:window.getComputedStyle(r,null).display,offsetWidth:r.offsetWidth,offsetHeight:r.offsetHeight,clientRectsLength:r.getClientRects().length};i.sendUpstream(connect.EventType.IFRAME_STYLE,e)},1e4),connect.core.upstream=i,connect.core.webSocketProvider=new g,i.onAllUpstream(connect.core.getEventBus().bridge()),connect.core.keepaliveManager=new u(i,connect.core.getEventBus(),o.ccpSynTimeout||1e3,o.ccpAckTimeout||3e3),connect.core.iframeRefreshInterval=null,connect.core.ccpLoadTimeoutInstance=h.setTimeout(function(){connect.core.ccpLoadTimeoutInstance=null,connect.core.getEventBus().trigger(connect.EventType.ACK_TIMEOUT)},o.ccpLoadTimeout||3e3),i.onUpstream(connect.EventType.ACKNOWLEDGE,function(){connect.getLog().info("Acknowledged by the CCP!").sendInternalLogToServer(),connect.core.client=new connect.UpstreamConduitClient(i),connect.core.masterClient=new connect.UpstreamConduitMasterClient(i),connect.core.initialized=!0,(o.softphone||o.chat||o.pageOptions)&&i.sendUpstream(connect.EventType.CONFIGURE,{softphone:o.softphone,chat:o.chat,pageOptions:o.pageOptions}),o.disasterRecoveryOn&&(connect.core.region=o.region,connect.core.suppressContacts=n,connect.core.forceOffline=function(){i.sendUpstream(connect.DisasterRecoveryEvents.SET_OFFLINE)},i.sendUpstream(connect.DisasterRecoveryEvents.INIT_DISASTER_RECOVERY,o)),connect.core.ccpLoadTimeoutInstance&&(h.clearTimeout(connect.core.ccpLoadTimeoutInstance),connect.core.ccpLoadTimeoutInstance=null),connect.core.keepaliveManager.start(),this.unsubscribe()}),i.onUpstream(connect.EventType.LOG,function(e){e.loggerId!==connect.getLog().getLoggerId()&&connect.getLog().addLogEntry(connect.LogEntry.fromObject(e))}),i.onUpstream(connect.EventType.SERVER_BOUND_INTERNAL_LOG,function(e){e.loggerId!==connect.getLog().getLoggerId()&&connect.getLog().sendInternalLogEntryToServer(connect.LogEntry.fromObject(e))}),connect.core.getEventBus().subscribe(connect.EventType.ACK_TIMEOUT,function(){if(!1!==o.loginPopup)try{e=(e=o,t="https://lily.us-east-1.amazonaws.com/taw/auth/code",connect.assertNotNull(t),e.loginUrl||(e.alias?(log.warn("The `alias` param is deprecated and should not be expected to function properly. Please use `ccpUrl` or `loginUrl`. See https://github.com/amazon-connect/amazon-connect-streams/blob/master/README.md#connectcoreinitccp for valid parameters."),s.replace("{alias}",e.alias).replace("{client_id}",c).replace("{redirect}",h.encodeURIComponent(t))):e.ccpUrl));connect.getLog().warn("ACK_TIMEOUT occurred, attempting to pop the login page if not already open.").sendInternalLogToServer(),o.loginUrl&&connect.core.getPopupManager().clear(connect.MasterTopics.LOGIN_POPUP),connect.core.loginWindow=connect.core.getPopupManager().open(e,connect.MasterTopics.LOGIN_POPUP)}catch(e){connect.getLog().error("ACK_TIMEOUT occurred but we are unable to open the login popup.").withException(e).sendInternalLogToServer()}var e,t,n;null==connect.core.iframeRefreshInterval&&(n=o.disasterRecoveryOn?1e4:5e3,connect.core.iframeRefreshInterval=window.setInterval(function(){r.src=o.disasterRecoveryOn?o.loginUrl:o.ccpUrl},n),i.onUpstream(connect.EventType.ACKNOWLEDGE,function(){this.unsubscribe(),h.clearInterval(connect.core.iframeRefreshInterval),connect.core.iframeRefreshInterval=null,connect.core.getPopupManager().clear(connect.MasterTopics.LOGIN_POPUP),o.loginPopupAutoClose&&connect.core.loginWindow&&(connect.core.loginWindow.close(),connect.core.loginWindow=null)}))}),o.onViewContact&&connect.core.onViewContact(o.onViewContact))};var u=function(e,t,n,o){this.conduit=e,this.eventBus=t,this.synTimeout=n,this.ackTimeout=o,this.ackTimer=null,this.synTimer=null,this.ackSub=null};u.prototype.start=function(){var e=this;this.conduit.sendUpstream(connect.EventType.SYNCHRONIZE),this.ackSub=this.conduit.onUpstream(connect.EventType.ACKNOWLEDGE,function(){this.unsubscribe(),h.clearTimeout(e.ackTimer),e.deferStart()}),this.ackTimer=h.setTimeout(function(){e.ackSub.unsubscribe(),e.eventBus.trigger(connect.EventType.ACK_TIMEOUT),e.deferStart()},this.ackTimeout)},u.prototype.deferStart=function(){null==this.synTimer&&(this.synTimer=h.setTimeout(connect.hitch(this,this.start),this.synTimeout))};var g=function(){function t(e,t){e.forEach(function(e){e(t)})}var n={initFailure:new Set,subscriptionUpdate:new Set,subscriptionFailure:new Set,topic:new Map,allMessage:new Set,connectionGain:new Set,connectionLost:new Set,connectionOpen:new Set,connectionClose:new Set};connect.core.getUpstream().onUpstream(connect.WebSocketEvents.INIT_FAILURE,function(){t(n.initFailure)}),connect.core.getUpstream().onUpstream(connect.WebSocketEvents.CONNECTION_OPEN,function(e){t(n.connectionOpen,e)}),connect.core.getUpstream().onUpstream(connect.WebSocketEvents.CONNECTION_CLOSE,function(e){t(n.connectionClose,e)}),connect.core.getUpstream().onUpstream(connect.WebSocketEvents.CONNECTION_GAIN,function(){t(n.connectionGain)}),connect.core.getUpstream().onUpstream(connect.WebSocketEvents.CONNECTION_LOST,function(e){t(n.connectionLost,e)}),connect.core.getUpstream().onUpstream(connect.WebSocketEvents.SUBSCRIPTION_UPDATE,function(e){t(n.subscriptionUpdate,e)}),connect.core.getUpstream().onUpstream(connect.WebSocketEvents.SUBSCRIPTION_FAILURE,function(e){t(n.subscriptionFailure,e)}),connect.core.getUpstream().onUpstream(connect.WebSocketEvents.ALL_MESSAGE,function(e){t(n.allMessage,e),n.topic.has(e.topic)&&t(n.topic.get(e.topic),e)}),this.sendMessage=function(e){connect.core.getUpstream().sendUpstream(connect.WebSocketEvents.SEND,e)},this.onInitFailure=function(e){return connect.assertTrue(connect.isFunction(e),"method must be a function"),n.initFailure.add(e),function(){return n.initFailure.delete(e)}},this.onConnectionOpen=function(e){return connect.assertTrue(connect.isFunction(e),"method must be a function"),n.connectionOpen.add(e),function(){return n.connectionOpen.delete(e)}},this.onConnectionClose=function(e){return connect.assertTrue(connect.isFunction(e),"method must be a function"),n.connectionClose.add(e),function(){return n.connectionClose.delete(e)}},this.onConnectionGain=function(e){return connect.assertTrue(connect.isFunction(e),"method must be a function"),n.connectionGain.add(e),function(){return n.connectionGain.delete(e)}},this.onConnectionLost=function(e){return connect.assertTrue(connect.isFunction(e),"method must be a function"),n.connectionLost.add(e),function(){return n.connectionLost.delete(e)}},this.onSubscriptionUpdate=function(e){return connect.assertTrue(connect.isFunction(e),"method must be a function"),n.subscriptionUpdate.add(e),function(){return n.subscriptionUpdate.delete(e)}},this.onSubscriptionFailure=function(e){return connect.assertTrue(connect.isFunction(e),"method must be a function"),n.subscriptionFailure.add(e),function(){return n.subscriptionFailure.delete(e)}},this.subscribeTopics=function(e){connect.assertNotNull(e,"topics"),connect.assertTrue(connect.isArray(e),"topics must be a array"),connect.core.getUpstream().sendUpstream(connect.WebSocketEvents.SUBSCRIBE,e)},this.onMessage=function(e,t){return connect.assertNotNull(e,"topicName"),connect.assertTrue(connect.isFunction(t),"method must be a function"),n.topic.has(e)?n.topic.get(e).add(t):n.topic.set(e,new Set([t])),function(){return n.topic.get(e).delete(t)}},this.onAllMessage=function(e){return connect.assertTrue(connect.isFunction(e),"method must be a function"),n.allMessage.add(e),function(){return n.allMessage.delete(e)}}},m=function(e){this.bus=e,this.bus.subscribe(connect.AgentEvents.UPDATE,connect.hitch(this,this.updateAgentData))};m.prototype.updateAgentData=function(e){var t=this.agentData;this.agentData=e,null==t&&(connect.agent.initialized=!0,this.bus.trigger(connect.AgentEvents.INIT,new connect.Agent)),this.bus.trigger(connect.AgentEvents.REFRESH,new connect.Agent),this._fireAgentUpdateEvents(t)},m.prototype.getAgentData=function(){if(null==this.agentData)throw new connect.StateError("No agent data is available yet!");return this.agentData},m.prototype.getContactData=function(t){var e=this.getAgentData(),e=connect.find(e.snapshot.contacts,function(e){return e.contactId===t});if(null==e)throw new connect.StateError("Contact %s no longer exists.",t);return e},m.prototype.getConnectionData=function(e,t){var n=this.getContactData(e),n=connect.find(n.connections,function(e){return e.connectionId===t});if(null==n)throw new connect.StateError("Connection %s for contact %s no longer exists.",t,e);return n},m.prototype.getInstanceId=function(){return this.getAgentData().configuration.routingProfile.routingProfileId.match(/instance\/([0-9a-fA-F|-]+)\//)[1]},m.prototype.getAWSAccountId=function(){return this.getAgentData().configuration.routingProfile.routingProfileId.match(/:([0-9]+):instance/)[1]},m.prototype._diffContacts=function(e){var t={added:{},removed:{},common:{},oldMap:connect.index(null==e?[]:e.snapshot.contacts,function(e){return e.contactId}),newMap:connect.index(this.agentData.snapshot.contacts,function(e){return e.contactId})};return connect.keys(t.oldMap).forEach(function(e){connect.contains(t.newMap,e)?t.common[e]=t.newMap[e]:t.removed[e]=t.oldMap[e]}),connect.keys(t.newMap).forEach(function(e){connect.contains(t.oldMap,e)||(t.added[e]=t.newMap[e])}),t},m.prototype._fireAgentUpdateEvents=function(e){var t=this,n=null,o=null==e?connect.AgentAvailStates.INIT:e.snapshot.state.name,r=this.agentData.snapshot.state.name,i=null==e?connect.AgentStateType.INIT:e.snapshot.state.type,s=this.agentData.snapshot.state.type;i!==s&&connect.core.getAgentRoutingEventGraph().getAssociations(this,i,s).forEach(function(e){t.bus.trigger(e,new connect.Agent)}),o!==r&&(this.bus.trigger(connect.AgentEvents.STATE_CHANGE,{agent:new connect.Agent,oldState:o,newState:r}),connect.core.getAgentStateEventGraph().getAssociations(this,o,r).forEach(function(e){t.bus.trigger(e,new connect.Agent)})),n=null!==e?this._diffContacts(e):{added:connect.index(this.agentData.snapshot.contacts,function(e){return e.contactId}),removed:{},common:{},oldMap:{},newMap:connect.index(this.agentData.snapshot.contacts,function(e){return e.contactId})},connect.values(n.added).forEach(function(e){t.bus.trigger(connect.ContactEvents.INIT,new connect.Contact(e.contactId)),t._fireContactUpdateEvents(e.contactId,connect.ContactStateType.INIT,e.state.type)}),connect.values(n.removed).forEach(function(e){t.bus.trigger(connect.ContactEvents.DESTROYED,new connect.ContactSnapshot(e)),t.bus.trigger(connect.core.getContactEventName(connect.ContactEvents.DESTROYED,e.contactId),new connect.ContactSnapshot(e)),t._unsubAllContactEventsForContact(e.contactId)}),connect.keys(n.common).forEach(function(e){t._fireContactUpdateEvents(e,n.oldMap[e].state.type,n.newMap[e].state.type)})},m.prototype._fireContactUpdateEvents=function(t,e,n){var o=this;e!==n&&connect.core.getContactEventGraph().getAssociations(this,e,n).forEach(function(e){o.bus.trigger(e,new connect.Contact(t)),o.bus.trigger(connect.core.getContactEventName(e,t),new connect.Contact(t))}),o.bus.trigger(connect.ContactEvents.REFRESH,new connect.Contact(t)),o.bus.trigger(connect.core.getContactEventName(connect.ContactEvents.REFRESH,t),new connect.Contact(t))},m.prototype._unsubAllContactEventsForContact=function(t){var n=this;connect.values(connect.ContactEvents).forEach(function(e){n.bus.getSubscriptions(connect.core.getContactEventName(e,t)).map(function(e){e.unsubscribe()})})},connect.core.onViewContact=function(e){connect.core.getUpstream().onUpstream(connect.ContactEvents.VIEW,e)},connect.core.viewContact=function(e){connect.core.getUpstream().sendUpstream(connect.EventType.BROADCAST,{event:connect.ContactEvents.VIEW,data:{contactId:e}})},connect.core.onAccessDenied=function(e){connect.core.getUpstream().onUpstream(connect.EventType.ACCESS_DENIED,e)},connect.core.onAuthFail=function(e){connect.core.getUpstream().onUpstream(connect.EventType.AUTH_FAIL,e)},connect.core.onSoftphoneSessionInit=function(e){connect.core.getUpstream().onUpstream(connect.ConnnectionEvents.SESSION_INIT,e)},connect.core.onConfigure=function(e){connect.core.getUpstream().onUpstream(connect.ConfigurationEvents.CONFIGURE,e)},connect.core.getContactEventName=function(e,t){if(connect.assertNotNull(e,"eventName"),connect.assertNotNull(t,"contactId"),!connect.contains(connect.values(connect.ContactEvents),e))throw new connect.ValueError("%s is not a valid contact event.",e);return connect.sprintf("%s::%s",e,t)},connect.core.getEventBus=function(){return connect.core.eventBus},connect.core.getWebSocketManager=function(){return connect.core.webSocketProvider},connect.core.getAgentDataProvider=function(){return connect.core.agentDataProvider},connect.core.getLocalTimestamp=function(){return connect.core.getAgentDataProvider().getAgentData().snapshot.localTimestamp},connect.core.getSkew=function(){return connect.core.getAgentDataProvider().getAgentData().snapshot.skew},connect.core.getAgentRoutingEventGraph=function(){return connect.core.agentRoutingEventGraph},connect.core.agentRoutingEventGraph=(new connect.EventGraph).assoc(connect.EventGraph.ANY,connect.AgentStateType.ROUTABLE,connect.AgentEvents.ROUTABLE).assoc(connect.EventGraph.ANY,connect.AgentStateType.NOT_ROUTABLE,connect.AgentEvents.NOT_ROUTABLE).assoc(connect.EventGraph.ANY,connect.AgentStateType.OFFLINE,connect.AgentEvents.OFFLINE),connect.core.getAgentStateEventGraph=function(){return connect.core.agentStateEventGraph},connect.core.agentStateEventGraph=(new connect.EventGraph).assoc(connect.EventGraph.ANY,connect.values(connect.AgentErrorStates),connect.AgentEvents.ERROR).assoc(connect.EventGraph.ANY,connect.AgentAvailStates.AFTER_CALL_WORK,connect.AgentEvents.ACW),connect.core.getContactEventGraph=function(){return connect.core.contactEventGraph},connect.core.contactEventGraph=(new connect.EventGraph).assoc(connect.EventGraph.ANY,connect.ContactStateType.INCOMING,connect.ContactEvents.INCOMING).assoc(connect.EventGraph.ANY,connect.ContactStateType.PENDING,connect.ContactEvents.PENDING).assoc(connect.EventGraph.ANY,connect.ContactStateType.CONNECTING,connect.ContactEvents.CONNECTING).assoc(connect.EventGraph.ANY,connect.ContactStateType.CONNECTED,connect.ContactEvents.CONNECTED).assoc(connect.ContactStateType.CONNECTING,connect.ContactStateType.ERROR,connect.ContactEvents.MISSED).assoc(connect.ContactStateType.INCOMING,connect.ContactStateType.ERROR,connect.ContactEvents.MISSED).assoc(connect.EventGraph.ANY,connect.ContactStateType.ENDED,connect.ContactEvents.ACW).assoc(connect.values(connect.CONTACT_ACTIVE_STATES),connect.values(connect.relativeComplement(connect.CONTACT_ACTIVE_STATES,connect.ContactStateType)),connect.ContactEvents.ENDED).assoc(connect.EventGraph.ANY,connect.values(connect.AgentErrorStates),connect.ContactEvents.ERROR).assoc(connect.ContactStateType.CONNECTING,connect.ContactStateType.MISSED,connect.ContactEvents.MISSED),connect.core.getClient=function(){if(!connect.core.client)throw new connect.StateError("The connect core has not been initialized!");return connect.core.client},connect.core.client=null,connect.core.getAgentAppClient=function(){if(!connect.core.agentAppClient)throw new connect.StateError("The connect AgentApp Client has not been initialized!");return connect.core.agentAppClient},connect.core.agentAppClient=null,connect.core.getMasterClient=function(){if(!connect.core.masterClient)throw new connect.StateError("The connect master client has not been initialized!");return connect.core.masterClient},connect.core.masterClient=null,connect.core.getSoftphoneManager=function(){return connect.core.softphoneManager},connect.core.softphoneManager=null,connect.core.getNotificationManager=function(){return connect.core.notificationManager||(connect.core.notificationManager=new connect.NotificationManager),connect.core.notificationManager},connect.core.notificationManager=null,connect.core.getPopupManager=function(){return connect.core.popupManager},connect.core.popupManager=new connect.PopupManager,connect.core.getUpstream=function(){if(!connect.core.upstream)throw new connect.StateError("There is no upstream conduit!");return connect.core.upstream},connect.core.upstream=null,connect.core.AgentDataProvider=m}(),function(){var r=this,i=r.connect||{};function t(n){var o=this;if(this._prevContactId=null,i.assertNotNull(n,"ringtoneConfig"),!n.ringtoneUrl)throw new Error("ringtoneUrl is required!");r.Audio&&void 0!==r.Promise?this._playableAudioPromise=new Promise(function(e,t){o._audio=new Audio(n.ringtoneUrl),o._audio.loop=!0,o._audio.addEventListener("canplay",function(){o._audioPlayable=!0,e(o._audio)})}):(this._audio=null,i.getLog().error("Unable to provide a ringtone.").sendInternalLogToServer()),o._driveRingtone()}function e(e){t.call(this,e)}function n(e){t.call(this,e)}function o(e){t.call(this,e)}function s(e){t.call(this,e)}r.connect=i,r.lily=i,t.prototype._driveRingtone=function(){throw new Error("Not implemented.")},t.prototype._startRingtone=function(t){this._audio&&(this._audio.play().catch(function(e){this._publishTelemetryEvent("Ringtone Playback Failure",t)}),this._publishTelemetryEvent("Ringtone Start",t))},t.prototype._stopRingtone=function(e){this._audio&&(this._audio.pause(),this._audio.currentTime=0,this._publishTelemetryEvent("Ringtone Stop",e))},t.prototype.stopRingtone=function(){this._stopRingtone()},t.prototype._ringtoneSetup=function(e){var t=this;i.ifMaster(i.MasterTopics.RINGTONE,function(){t._startRingtone(e),t._prevContactId=e.getContactId(),e.onConnected(lily.hitch(t,t._stopRingtone)),e.onAccepted(lily.hitch(t,t._stopRingtone)),e.onEnded(lily.hitch(t,t._stopRingtone)),e.onRefresh(function(e){e.getStatus().type!==i.ContactStatusType.CONNECTING&&e.getStatus().type!==i.ContactStatusType.INCOMING&&t._stopRingtone()})})},t.prototype._publishTelemetryEvent=function(e,t){t&&t.getContactId()&&i.publishMetric({name:e,contactId:t.getContactId()})},t.prototype.setOutputDevice=function(t){return this._playableAudioPromise?Promise.race([this._playableAudioPromise,new Promise(function(e,t){r.setTimeout(function(){t("Timed out waiting for playable audio")},3e3)})]).then(function(e){return e.setSinkId?Promise.resolve(e.setSinkId(t)):Promise.reject("Not supported")}):r.Promise?Promise.reject("Not eligible ringtone owner"):void 0},((e.prototype=Object.create(t.prototype)).constructor=e).prototype._driveRingtone=function(){function t(e){e.getType()===lily.ContactType.VOICE&&e.isSoftphoneCall()&&e.isInbound()&&(n._ringtoneSetup(e),n._publishTelemetryEvent("Ringtone Connecting",e))}var n=this;i.contact(function(e){e.onConnecting(t)}),(new i.Agent).getContacts().forEach(function(e){e.getStatus().type===i.ContactStatusType.CONNECTING&&t(e)})},((n.prototype=Object.create(t.prototype)).constructor=n).prototype._driveRingtone=function(){function t(e){e.getType()===lily.ContactType.CHAT&&e.isInbound()&&(n._ringtoneSetup(e),n._publishTelemetryEvent("Chat Ringtone Connecting",e))}var n=this;i.contact(function(e){e.onConnecting(t)})},((o.prototype=Object.create(t.prototype)).constructor=o).prototype._driveRingtone=function(){function t(e){e.getType()===lily.ContactType.TASK&&e.isInbound()&&(n._ringtoneSetup(e),n._publishTelemetryEvent("Task Ringtone Connecting",e))}var n=this;i.contact(function(e){e.onConnecting(t)})},((s.prototype=Object.create(t.prototype)).constructor=s).prototype._driveRingtone=function(){var t=this;i.contact(function(e){e.onIncoming(function(){e.getType()===lily.ContactType.QUEUE_CALLBACK&&(t._ringtoneSetup(e),t._publishTelemetryEvent("Callback Ringtone Connecting",e))})})},i.VoiceRingtoneEngine=e,i.ChatRingtoneEngine=n,i.TaskRingtoneEngine=o,i.QueueCallbackRingtoneEngine=s}(),function(){connect=this.connect||{},this.connect=connect,this.lily=connect,this.ccpVersion="V2";var e={};e[connect.SoftphoneCallType.AUDIO_ONLY]="Audio",e[connect.SoftphoneCallType.VIDEO_ONLY]="Video",e[connect.SoftphoneCallType.AUDIO_VIDEO]="AudioVideo",e[connect.SoftphoneCallType.NONE]="None";var i="audio_input",s="audio_output";function t(e){return new Promise(function(t,n){connect.core.getClient().call(connect.ClientMethods.CREATE_TRANSPORT,e,{success:function(e){t(e.softphoneTransport.softphoneMediaConnections)},failure:function(e){e.message&&e.message.includes("SoftphoneConnectionLimitBreachedException")&&_("multiple_softphone_active_sessions","Number of active sessions are more then allowed limit.",""),n(Error("requestIceAccess failed"))},authFailure:function(){n(Error("Authentication failed while requestIceAccess"))},accessDenied:function(){n(Error("Access Denied while requestIceAccess"))}})})}function n(e){var t=r.slice();r=[],0<t.length&&e.sendSoftphoneMetrics(t,{success:function(){p.info("sendSoftphoneMetrics success"+JSON.stringify(t)).sendInternalLogToServer()},failure:function(e){p.error("sendSoftphoneMetrics failed.").withObject(e).sendInternalLogToServer()}})}function o(e){return null!==e&&window.clearInterval(e),null}({})[connect.ContactType.VOICE]="Voice";var r=[],c={},a={},u=null,l=null,p=null,h=connect.SoftphoneErrorTypes,d={},f=connect.randomId(),g=function(e){var t=connect.core.getUpstream(),n=e.getAgentConnection();n?(n=n.getSoftphoneMediaInfo())?!0===n.autoAccept?(p.info("Auto-accept is enabled, sending out Accepted event to stop ringtone..").sendInternalLogToServer(),t.sendUpstream(connect.EventType.BROADCAST,{event:connect.ContactEvents.ACCEPTED,data:new connect.Contact(e.contactId)}),t.sendUpstream(connect.EventType.BROADCAST,{event:connect.core.getContactEventName(connect.ContactEvents.ACCEPTED,e.contactId),data:new connect.Contact(e.contactId)})):p.info("Auto-accept is disabled, ringtone will be stopped by user action.").sendInternalLogToServer():p.info("Not able to retrieve the auto-accept setting from null SoftphoneMediaInfo, ignoring event publish..").sendInternalLogToServer():p.info("Not able to retrieve the auto-accept setting from null AgentConnection, ignoring event publish..").sendInternalLogToServer()},m=function(){connect.core.getEventBus().subscribe(connect.EventType.MUTE,b)},y=function(){connect.core.getEventBus().subscribe(connect.ConfigurationEvents.SET_SPEAKER_DEVICE,S)},v=function(){connect.core.getEventBus().subscribe(connect.ConfigurationEvents.SET_MICROPHONE_DEVICE,C)},E=function(e){delete d[e],connect.core.getUpstream().sendUpstream(connect.EventType.BROADCAST,{event:connect.AgentEvents.MUTE_TOGGLE,data:{muted:!1}})},b=function(e){var t,n;if(0!==connect.keys(d).length){for(var o in e&&void 0!==e.mute&&(t=e.mute),d)!d.hasOwnProperty(o)||(n=d[o].stream)&&(n=n.getAudioTracks()[0],void 0!==t?(n.enabled=!t,((d[o].muted=t)?p.info("Agent has muted the contact, connectionId -  "+o):p.info("Agent has unmuted the contact, connectionId - "+o)).sendInternalLogToServer()):t=d[o].muted||!1);connect.core.getUpstream().sendUpstream(connect.EventType.BROADCAST,{event:connect.AgentEvents.MUTE_TOGGLE,data:{muted:t}})}},S=function(e){if(0!==connect.keys(d).length&&e&&e.deviceId){var t=e.deviceId,n=document.getElementById("remote-audio");try{p.info("Trying to set speaker to device "+t),n&&"function"==typeof n.setSinkId&&n.setSinkId(t)}catch(e){p.error("Failed to set speaker to device "+t)}connect.core.getUpstream().sendUpstream(connect.EventType.BROADCAST,{event:connect.ConfigurationEvents.SPEAKER_DEVICE_CHANGED,data:{deviceId:t}})}},C=function(e){if(0!==connect.keys(d).length&&e&&e.deviceId){var t=e.deviceId,o=connect.core.getSoftphoneManager();try{navigator.mediaDevices.getUserMedia({audio:{deviceId:{exact:t}}}).then(function(e){var t,n=e.getAudioTracks()[0];for(t in d)d.hasOwnProperty(t)&&(d[t].stream,o.getSession(t)._pc.getSenders()[0].replaceTrack(n).then(function(){o.replaceLocalMediaTrack(t,n)}))})}catch(e){p.error("Failed to set microphone device "+t)}connect.core.getUpstream().sendUpstream(connect.EventType.BROADCAST,{event:connect.ConfigurationEvents.MICROPHONE_DEVICE_CHANGED,data:{deviceId:t}})}},T=function(e,t){if(t===connect.RTCErrors.ICE_COLLECTION_TIMEOUT){for(var n="\n",o=0;o<e._iceServers.length;o++)for(var r=0;r<e._iceServers[o].urls.length;r++)n=n+e._iceServers[o].urls[r]+"\n";_(h.ICE_COLLECTION_TIMEOUT,"Ice collection timedout. ",n)}else t===connect.RTCErrors.USER_BUSY?_(h.USER_BUSY_ERROR,"Softphone call UserBusy error. ",""):t===connect.RTCErrors.SIGNALLING_HANDSHAKE_FAILURE?_(h.SIGNALLING_HANDSHAKE_FAILURE,"Handshaking with Signalling Server "+e._signalingUri+" failed. ",e._signalingUri):t===connect.RTCErrors.GUM_TIMEOUT_FAILURE||t===connect.RTCErrors.GUM_OTHER_FAILURE?_(h.MICROPHONE_NOT_SHARED,"Your microphone is not enabled in your browser. ",""):t===connect.RTCErrors.SIGNALLING_CONNECTION_FAILURE?_(h.SIGNALLING_CONNECTION_FAILURE,"URL "+e._signalingUri+" cannot be reached. ",e._signalingUri):t===connect.RTCErrors.CALL_NOT_FOUND?p.error("Softphone call failed due to CallNotFoundException.").sendInternalLogToServer():_(h.WEBRTC_ERROR,"webrtc system error. ","")},I=function(e){e=e.replace(/&quot;/g,'"');return JSON.parse(e)},A=function(e){var n=e||{};n.success=n.success||function(){},n.failure=n.failure||function(){};var o={audio:!0},e=null;if("function"==typeof Promise){if("object"==typeof navigator.mediaDevices&&"function"==typeof navigator.mediaDevices.getUserMedia)e=navigator.mediaDevices.getUserMedia(o);else{if("function"!=typeof navigator.webkitGetUserMedia)return void n.failure(h.UNSUPPORTED_BROWSER);e=new Promise(function(e,t){navigator.webkitGetUserMedia(o,e,t)})}return e.then(function(e){var t=e.getAudioTracks();t&&0<t.length?n.success(e):n.failure(h.MICROPHONE_NOT_SHARED)},function(e){n.failure(h.MICROPHONE_NOT_SHARED)}),e}n.failure(h.UNSUPPORTED_BROWSER)},_=function(e,t,n){p.error("Softphone error occurred : ",e,t||"").sendInternalLogToServer(),connect.core.getUpstream().sendUpstream(connect.EventType.BROADCAST,{event:connect.AgentEvents.SOFTPHONE_ERROR,data:new connect.SoftphoneError(e,t,n)})},w=function(e,t){R("Softphone Session Failed",e,{failedReason:t})},R=function(e,t,n){t&&connect.publishMetric({name:e,contactId:t,data:n})},k=function(e,t,n){R(e,t,[{name:"AgentConnectionId",value:n}]),p.info("Publish multiple session error metrics",e,"contactId "+t,"agent connectionId "+n).sendInternalLogToServer()},N=function(){return!!(connect.isOperaBrowser()&&17<connect.getOperaBrowserVersion())||(!!(connect.isChromeBrowser()&&22<connect.getChromeBrowserVersion())||!!(connect.isFirefoxBrowser()&&21<connect.getFirefoxBrowserVersion()))},O=function(e){u=window.setInterval(function(){e.getUserAudioStats().then(function(e){var t=c;c=e,r.push(D(c,t,i))},function(e){p.debug("Failed to get user audio stats.",e).sendInternalLogToServer()}),e.getRemoteAudioStats().then(function(e){var t=a;a=e,r.push(D(a,t,s))},function(e){p.debug("Failed to get remote audio stats.",e).sendInternalLogToServer()})},1e3)},L=function(e){l=window.setInterval(function(){n(e)},3e4)},x=function(){r=[],l=u=a=c=null},D=function(e,t,n){if(t&&e){var o=e.packetsLost>t.packetsLost?e.packetsLost-t.packetsLost:0,t=e.packetsCount>t.packetsCount?e.packetsCount-t.packetsCount:0;return new M(e.timestamp,o,t,n,e.audioLevel,e.jbMilliseconds,e.rttMilliseconds)}return new M(e.timestamp,e.packetsLost,e.packetsCount,n,e.audioLevel,e.jbMilliseconds,e.rttMilliseconds)},P=function(e,t){u=o(u),l=o(l),function(e,t,n,o){t.streamStats=[U(n,i),U(o,s)];var r={callStartTime:t.sessionStartTime,callEndTime:t.sessionEndTime,gumTimeMillis:t.gumTimeMillis,initializationTimeMillis:t.initializationTimeMillis,iceCollectionTimeMillis:t.iceCollectionTimeMillis,signallingConnectTimeMillis:t.signallingConnectTimeMillis,handshakingTimeMillis:t.handshakingTimeMillis,preTalkingTimeMillis:t.preTalkingTimeMillis,talkingTimeMillis:t.talkingTimeMillis,cleanupTimeMillis:t.cleanupTimeMillis,iceCollectionFailure:t.iceCollectionFailure,signallingConnectionFailure:t.signallingConnectionFailure,handshakingFailure:t.handshakingFailure,gumOtherFailure:t.gumOtherFailure,gumTimeoutFailure:t.gumTimeoutFailure,createOfferFailure:t.createOfferFailure,setLocalDescriptionFailure:t.setLocalDescriptionFailure,userBusyFailure:t.userBusyFailure,invalidRemoteSDPFailure:t.invalidRemoteSDPFailure,noRemoteIceCandidateFailure:t.noRemoteIceCandidateFailure,setRemoteDescriptionFailure:t.setRemoteDescriptionFailure,softphoneStreamStatistics:t.streamStats};e.sendSoftphoneReport(r,{success:function(){p.info("sendSoftphoneReport success"+JSON.stringify(r)).sendInternalLogToServer()},failure:function(e){p.error("sendSoftphoneReport failed.").withObject(e).sendInternalLogToServer()}})}(e,t,U(c,i),U(a,s)),n(e)},M=function(e,t,n,o,r,i,s){this.softphoneStreamType=o,this.timestamp=e,this.packetsLost=t,this.packetsCount=n,this.audioLevel=r,this.jitterBufferMillis=i,this.roundTripTimeMillis=s},U=function(e,t){return new M((e=e||{}).timestamp,e.packetsLost,e.packetsCount,t,e.audioLevel)},q=function(e){this._originalLogger=e;var o=this;this._tee=function(e,n){return function(){var e=Array.prototype.slice.call(arguments[0]),t="";return e.forEach(function(){t+=" %s"}),n.apply(o._originalLogger,[connect.LogComponent.SOFTPHONE,t].concat(e))}}};q.prototype.debug=function(){return this._tee(1,this._originalLogger.debug)(arguments)},q.prototype.info=function(){return this._tee(2,this._originalLogger.info)(arguments)},q.prototype.log=function(){return this._tee(3,this._originalLogger.log)(arguments)},q.prototype.warn=function(){return this._tee(4,this._originalLogger.warn)(arguments)},q.prototype.error=function(){return this._tee(5,this._originalLogger.error)(arguments)},connect.SoftphoneManager=function(e){var i;p=new q(connect.getLog()),connect.RtcPeerConnectionFactory&&(i=new connect.RtcPeerConnectionFactory(p,connect.core.getWebSocketManager(),f,connect.hitch(this,t,{transportType:"softphone",softphoneClientId:f}),connect.hitch(this,_))),N()||_(h.UNSUPPORTED_BROWSER,"Connect does not support this browser. Some functionality may not work. ","");A({success:function(e){connect.isFirefoxBrowser()&&connect.core.setSoftphoneUserMediaStream(e)},failure:function(e){_(e,"Your microphone is not enabled in your browser. ","")}});m(),y(),v(),this.ringtoneEngine=null;var s={},c={};this.getSession=function(e){return s[e]},this.replaceLocalMediaTrack=function(e,t){var n=d[e].stream;n&&((e=n.getAudioTracks()[0]).enabled=!1,n.removeTrack(e),n.addTrack(t))};function a(n){var o;s.hasOwnProperty(n)&&(o=s[n],new Promise(function(e,t){delete s[n],delete c[n],o.hangup()}).catch(function(e){lily.getLog().warn("Clean up the session locally "+n,e.message).sendInternalLogToServer()}))}function n(n,o){var e,t,r;!s[o]||(t=n).getStatus().type!==connect.ContactStatusType.ENDED&&t.getStatus().type!==connect.ContactStatusType.ERROR&&t.getStatus().type!==connect.ContactStatusType.MISSED||a(o),!n.isSoftphoneCall()||c[o]||n.getStatus().type!==connect.ContactStatusType.CONNECTING&&n.getStatus().type!==connect.ContactStatusType.INCOMING||(c[o]=!0,p.info("Softphone call detected:","contactId "+n.getContactId(),"agent connectionId "+o).sendInternalLogToServer(),function(e){if(0<Object.keys(e).length){for(var t in e)e.hasOwnProperty(t)&&(k("MultiSessionHangUp",e[t].callId,t),a(t));throw new Error("duplicate session detected, refusing to setup new connection")}}(s),n.getStatus().type===connect.ContactStatusType.CONNECTING&&R("Softphone Connecting",n.getContactId()),x(),e=n.getAgentConnection().getSoftphoneMediaInfo(),(t=I(e.callConfigJson)).useWebSocketProvider&&(r=connect.core.getWebSocketManager()),r=new connect.RTCSession(t.signalingEndpoint,t.iceServers,e.callContextToken,p,n.getContactId(),o,r),s[o]=r,connect.core.getSoftphoneUserMediaStream()&&(r.mediaStream=connect.core.getSoftphoneUserMediaStream()),connect.core.getUpstream().sendUpstream(connect.EventType.BROADCAST,{event:connect.ConnnectionEvents.SESSION_INIT,data:{connectionId:o}}),r.onSessionFailed=function(e,t){delete s[o],delete c[o],T(e,t),w(n.getContactId(),t),P(n,e.sessionReport)},r.onSessionConnected=function(e){R("Softphone Session Connected",n.getContactId()),connect.becomeMaster(connect.MasterTopics.SEND_LOGS),O(e),L(n),g(n)},r.onSessionCompleted=function(e){R("Softphone Session Completed",n.getContactId()),delete s[o],delete c[o],P(n,e.sessionReport),E(o)},r.onLocalStreamAdded=function(e,t){d[o]={stream:t},connect.core.getUpstream().sendUpstream(connect.EventType.BROADCAST,{event:connect.AgentEvents.LOCAL_MEDIA_STREAM_CREATED,data:{connectionId:o}})},r.remoteAudioElement=document.getElementById("remote-audio"),i?r.connect(i.get(t.iceServers)):r.connect())}function o(e){var t=e.getAgentConnection().connectionId;p.info("Contact detected:","contactId "+e.getContactId(),"agent connectionId "+t).sendInternalLogToServer(),c[t]||e.onRefresh(function(){n(e,t)})}connect.contact(o),(new connect.Agent).getContacts().forEach(function(e){var t=e.getAgentConnection().connectionId;p.info("Contact exist in the snapshot. Reinitiate the Contact and RTC session creation for contactId"+e.getContactId(),"agent connectionId "+t).sendInternalLogToServer(),o(e),n(e,t)})}}(),function(){var r=this;function e(){this.topicMasterMap={}}function o(e){connect.ClientBase.call(this),this.conduit=e}function t(){var n=this;this.multiplexer=new connect.StreamMultiplexer,this.conduit=new connect.Conduit("AmazonConnectSharedWorker",null,this.multiplexer),this.client=new o(this.conduit),this.timeout=null,this.agent=null,this.nextToken=null,this.initData={},this.portConduitMap={},this.masterCoord=new e,this.logsBuffer=[];var t=null;connect.rootLogger=new connect.DownstreamConduitLogger(this.conduit),this.conduit.onDownstream(connect.EventType.SEND_LOGS,function(e){connect.getLog().pushLogsDownstream(e),n.logsBuffer=n.logsBuffer.concat(e),400<n.logsBuffer.length&&n.handleSendLogsRequest(n.logsBuffer)}),this.conduit.onDownstream(connect.EventType.CONFIGURE,function(e){e.authToken&&e.authToken!==n.initData.authToken&&(n.initData=e,connect.core.init(e),t?connect.getLog().info("Not Initializing a new WebsocketManager instance, since one already exists").sendInternalLogToServer():(connect.getLog().info("Creating a new Websocket connection for CCP").sendInternalLogToServer(),connect.WebSocketManager.setGlobalConfig({loggerConfig:{logger:connect.getLog()}}),(t=connect.WebSocketManager.create()).onInitFailure(function(){n.conduit.sendDownstream(connect.WebSocketEvents.INIT_FAILURE)}),t.onConnectionOpen(function(e){n.conduit.sendDownstream(connect.WebSocketEvents.CONNECTION_OPEN,e)}),t.onConnectionClose(function(e){n.conduit.sendDownstream(connect.WebSocketEvents.CONNECTION_CLOSE,e)}),t.onConnectionGain(function(){n.conduit.sendDownstream(connect.AgentEvents.WEBSOCKET_CONNECTION_GAINED),n.conduit.sendDownstream(connect.WebSocketEvents.CONNECTION_GAIN)}),t.onConnectionLost(function(e){n.conduit.sendDownstream(connect.AgentEvents.WEBSOCKET_CONNECTION_LOST,e),n.conduit.sendDownstream(connect.WebSocketEvents.CONNECTION_LOST,e)}),t.onSubscriptionUpdate(function(e){n.conduit.sendDownstream(connect.WebSocketEvents.SUBSCRIPTION_UPDATE,e)}),t.onSubscriptionFailure(function(e){n.conduit.sendDownstream(connect.WebSocketEvents.SUBSCRIPTION_FAILURE,e)}),t.onAllMessage(function(e){n.conduit.sendDownstream(connect.WebSocketEvents.ALL_MESSAGE,e)}),n.conduit.onDownstream(connect.WebSocketEvents.SEND,function(e){t.sendMessage(e)}),n.conduit.onDownstream(connect.WebSocketEvents.SUBSCRIBE,function(e){t.subscribeTopics(e)}),t.init(connect.hitch(n,n.getWebSocketUrl)).then(function(e){e&&!e.webSocketConnectionFailed?(connect.getLog().info("Kicking off agent polling").sendInternalLogToServer(),n.pollForAgent(),connect.getLog().info("Kicking off config polling").sendInternalLogToServer(),n.pollForAgentConfiguration({repeatForever:!0}),connect.getLog().info("Kicking off auth token polling").sendInternalLogToServer(),r.setInterval(connect.hitch(n,n.checkAuthToken),3e5)):connect.webSocketInitFailed||(n.conduit.sendDownstream(connect.WebSocketEvents.INIT_FAILURE),connect.webSocketInitFailed=!0)})))}),this.conduit.onDownstream(connect.EventType.TERMINATE,function(){n.handleSendLogsRequest(n.logsBuffer),connect.core.terminate(),n.conduit.sendDownstream(connect.EventType.TERMINATED)}),this.conduit.onDownstream(connect.EventType.SYNCHRONIZE,function(){n.conduit.sendDownstream(connect.EventType.ACKNOWLEDGE)}),this.conduit.onDownstream(connect.EventType.BROADCAST,function(e){n.conduit.sendDownstream(e.event,e.data)}),r.onconnect=function(e){var e=e.ports[0],t=new connect.PortStream(e);n.multiplexer.addStream(t),e.start();e=new connect.Conduit(t.getId(),null,t);e.sendDownstream(connect.EventType.ACKNOWLEDGE,{id:t.getId()}),n.portConduitMap[t.getId()]=e,null!==n.agent&&n.updateAgent(),e.onDownstream(connect.EventType.API_REQUEST,connect.hitch(n,n.handleAPIRequest,e)),e.onDownstream(connect.EventType.MASTER_REQUEST,connect.hitch(n,n.handleMasterRequest,e,t.getId())),e.onDownstream(connect.EventType.RELOAD_AGENT_CONFIGURATION,connect.hitch(n,n.pollForAgentConfiguration)),e.onDownstream(connect.EventType.CLOSE,function(){n.multiplexer.removeStream(t),delete n.portConduitMap[t.getId()],n.masterCoord.removeMaster(t.getId())})}}connect=r.connect||{},r.connect=connect,r.lily=connect,connect.worker={},e.prototype.getMaster=function(e){return connect.assertNotNull(e,"topic"),this.topicMasterMap[e]||null},e.prototype.setMaster=function(e,t){connect.assertNotNull(e,"topic"),connect.assertNotNull(t,"id"),this.topicMasterMap[e]=t},e.prototype.removeMaster=function(t){connect.assertNotNull(t,"id");var n=this;connect.entries(this.topicMasterMap).filter(function(e){return e.value===t}).forEach(function(e){delete n.topicMasterMap[e.key]})},((o.prototype=Object.create(connect.ClientBase.prototype)).constructor=o).prototype._callImpl=function(n,e,o){var r=this,i=(new Date).getTime();connect.containsValue(connect.AgentAppClientMethods,n)?connect.core.getAgentAppClient()._callImpl(n,e,{success:function(e){r._recordAPILatency(n,i),o.success(e)},failure:function(e,t){r._recordAPILatency(n,i,e),o.failure(e,t)}}):connect.core.getClient()._callImpl(n,e,{success:function(e){r._recordAPILatency(n,i),o.success(e)},failure:function(e,t){r._recordAPILatency(n,i,e),o.failure(e,t)},authFailure:function(){r._recordAPILatency(n,i),o.authFailure()},accessDenied:function(){o.accessDenied&&o.accessDenied()}})},o.prototype._recordAPILatency=function(e,t,n){t=(new Date).getTime()-t;this._sendAPIMetrics(e,t,n)},o.prototype._sendAPIMetrics=function(e,t,n){this.conduit.sendDownstream(connect.EventType.API_METRIC,{name:e,time:t,dimensions:[{name:"Category",value:"API"}],error:n})},t.prototype.pollForAgent=function(){var n=this,e=connect.hitch(n,n.handleAuthFail);this.client.call(connect.ClientMethods.GET_AGENT_SNAPSHOT,{nextToken:n.nextToken,timeout:3e4},{success:function(t){try{n.agent=n.agent||{},n.agent.snapshot=t.snapshot,n.agent.snapshot.localTimestamp=connect.now(),n.agent.snapshot.skew=n.agent.snapshot.snapshotTimestamp-n.agent.snapshot.localTimestamp,n.nextToken=t.nextToken,connect.getLog().trace("GET_AGENT_SNAPSHOT succeeded.").withObject(t).sendInternalLogToServer(),n.updateAgent()}catch(e){connect.getLog().error("Long poll failed to update agent.").withObject(t).withException(e).sendInternalLogToServer()}finally{r.setTimeout(connect.hitch(n,n.pollForAgent),100)}},failure:function(e,t){try{connect.getLog().error("Failed to get agent data.").sendInternalLogToServer().withObject({err:e,data:t})}finally{r.setTimeout(connect.hitch(n,n.pollForAgent),5e3)}},authFailure:function(){e()},accessDenied:connect.hitch(n,n.handleAccessDenied)})},t.prototype.pollForAgentConfiguration=function(e){var n=this,o=e||{},t=connect.hitch(n,n.handleAuthFail);this.client.call(connect.ClientMethods.GET_AGENT_CONFIGURATION,{},{success:function(e){e=e.configuration;n.pollForAgentPermissions(e),n.pollForAgentStates(e),n.pollForDialableCountryCodes(e),n.pollForRoutingProfileQueues(e),o.repeatForever&&r.setTimeout(connect.hitch(n,n.pollForAgentConfiguration,o),3e4)},failure:function(e,t){try{connect.getLog().error("Failed to fetch agent configuration data.").sendInternalLogToServer().withObject({err:e,data:t})}finally{o.repeatForever&&r.setTimeout(connect.hitch(n,n.pollForAgentConfiguration),3e4,o)}},authFailure:function(){t()},accessDenied:connect.hitch(n,n.handleAccessDenied)})},t.prototype.pollForAgentStates=function(t,e){var n=this,o=e||{};o.maxResults=o.maxResults||connect.DEFAULT_BATCH_SIZE,this.client.call(connect.ClientMethods.GET_AGENT_STATES,{nextToken:o.nextToken||null,maxResults:o.maxResults},{success:function(e){e.nextToken?n.pollForAgentStates(t,{states:(o.states||[]).concat(e.states),nextToken:e.nextToken,maxResults:o.maxResults}):(t.agentStates=(o.states||[]).concat(e.states),n.updateAgentConfiguration(t))},failure:function(e,t){connect.getLog().error("Failed to fetch agent states list.").sendInternalLogToServer().withObject({err:e,data:t})},authFailure:connect.hitch(n,n.handleAuthFail),accessDenied:connect.hitch(n,n.handleAccessDenied)})},t.prototype.pollForAgentPermissions=function(t,e){var n=this,o=e||{};o.maxResults=o.maxResults||connect.DEFAULT_BATCH_SIZE,this.client.call(connect.ClientMethods.GET_AGENT_PERMISSIONS,{nextToken:o.nextToken||null,maxResults:o.maxResults},{success:function(e){e.nextToken?n.pollForAgentPermissions(t,{permissions:(o.permissions||[]).concat(e.permissions),nextToken:e.nextToken,maxResults:o.maxResults}):(t.permissions=(o.permissions||[]).concat(e.permissions),n.updateAgentConfiguration(t))},failure:function(e,t){connect.getLog().error("Failed to fetch agent permissions list.").sendInternalLogToServer().withObject({err:e,data:t})},authFailure:connect.hitch(n,n.handleAuthFail),accessDenied:connect.hitch(n,n.handleAccessDenied)})},t.prototype.pollForDialableCountryCodes=function(t,e){var n=this,o=e||{};o.maxResults=o.maxResults||connect.DEFAULT_BATCH_SIZE,this.client.call(connect.ClientMethods.GET_DIALABLE_COUNTRY_CODES,{nextToken:o.nextToken||null,maxResults:o.maxResults},{success:function(e){e.nextToken?n.pollForDialableCountryCodes(t,{countryCodes:(o.countryCodes||[]).concat(e.countryCodes),nextToken:e.nextToken,maxResults:o.maxResults}):(t.dialableCountries=(o.countryCodes||[]).concat(e.countryCodes),n.updateAgentConfiguration(t))},failure:function(e,t){connect.getLog().error("Failed to fetch dialable country codes list.").sendInternalLogToServer().withObject({err:e,data:t})},authFailure:connect.hitch(n,n.handleAuthFail),accessDenied:connect.hitch(n,n.handleAccessDenied)})},t.prototype.pollForRoutingProfileQueues=function(t,e){var n=this,o=e||{};o.maxResults=o.maxResults||connect.DEFAULT_BATCH_SIZE,this.client.call(connect.ClientMethods.GET_ROUTING_PROFILE_QUEUES,{routingProfileARN:t.routingProfile.routingProfileARN,nextToken:o.nextToken||null,maxResults:o.maxResults},{success:function(e){e.nextToken?n.pollForRoutingProfileQueues(t,{countryCodes:(o.queues||[]).concat(e.queues),nextToken:e.nextToken,maxResults:o.maxResults}):(t.routingProfile.queues=(o.queues||[]).concat(e.queues),n.updateAgentConfiguration(t))},failure:function(e,t){connect.getLog().error("Failed to fetch routing profile queues list.").sendInternalLogToServer().withObject({err:e,data:t})},authFailure:connect.hitch(n,n.handleAuthFail),accessDenied:connect.hitch(n,n.handleAccessDenied)})},t.prototype.handleAPIRequest=function(n,o){var r=this;this.client.call(o.method,o.params,{success:function(e){e=connect.EventFactory.createResponse(connect.EventType.API_RESPONSE,o,e);n.sendDownstream(e.event,e)},failure:function(e,t){t=connect.EventFactory.createResponse(connect.EventType.API_RESPONSE,o,t,JSON.stringify(e));n.sendDownstream(t.event,t),connect.getLog().error("'%s' API request failed",o.method).withObject({request:r.filterAuthToken(o),response:t}).withException(e).sendInternalLogToServer()},authFailure:connect.hitch(r,r.handleAuthFail)})},t.prototype.handleMasterRequest=function(e,t,n){var o=null;switch(n.method){case connect.MasterMethods.BECOME_MASTER:this.masterCoord.setMaster(n.params.topic,t),o=connect.EventFactory.createResponse(connect.EventType.MASTER_RESPONSE,n,{masterId:t,isMaster:!0,topic:n.params.topic});break;case connect.MasterMethods.CHECK_MASTER:var r=this.masterCoord.getMaster(n.params.topic);r||(this.masterCoord.setMaster(n.params.topic,t),r=t),o=connect.EventFactory.createResponse(connect.EventType.MASTER_RESPONSE,n,{masterId:r,isMaster:t===r,topic:n.params.topic});break;default:throw new Error("Unknown master method: "+n.method)}e.sendDownstream(o.event,o)},t.prototype.updateAgentConfiguration=function(e){e.permissions&&e.dialableCountries&&e.agentStates&&e.routingProfile.queues?(this.agent=this.agent||{},this.agent.configuration=e,this.updateAgent()):connect.getLog().trace("Waiting to update agent configuration until all config data has been fetched.").sendInternalLogToServer()},t.prototype.updateAgent=function(){this.agent?this.agent.snapshot?this.agent.configuration?(this.agent.snapshot.status=this.agent.state,this.agent.snapshot.contacts&&1<this.agent.snapshot.contacts.length&&this.agent.snapshot.contacts.sort(function(e,t){return e.state.timestamp.getTime()-t.state.timestamp.getTime()}),this.agent.snapshot.contacts.forEach(function(e){e.status=e.state,e.connections.forEach(function(e){e.address=e.endpoint})}),this.agent.configuration.routingProfile.defaultOutboundQueue.queueId=this.agent.configuration.routingProfile.defaultOutboundQueue.queueARN,this.agent.configuration.routingProfile.queues.forEach(function(e){e.queueId=e.queueARN}),this.agent.snapshot.contacts.forEach(function(e){void 0!==e.queue&&(e.queue.queueId=e.queue.queueARN)}),this.agent.configuration.routingProfile.routingProfileId=this.agent.configuration.routingProfile.routingProfileARN,this.conduit.sendDownstream(connect.AgentEvents.UPDATE,this.agent)):connect.getLog().trace("Waiting to update agent until the agent configuration is available.").sendInternalLogToServer():connect.getLog().trace("Waiting to update agent until the agent snapshot is available.").sendInternalLogToServer():connect.getLog().trace("Waiting to update agent until the agent has been fully constructed.").sendInternalLogToServer()},t.prototype.getWebSocketUrl=function(){var e=connect.core.getClient(),o=connect.hitch(this,this.handleAuthFail),r=connect.hitch(this,this.handleAccessDenied);return new Promise(function(t,n){e.call(connect.ClientMethods.CREATE_TRANSPORT,{transportType:connect.TRANSPORT_TYPES.WEB_SOCKET},{success:function(e){connect.getLog().info("getWebSocketUrl succeeded").sendInternalLogToServer(),t(e)},failure:function(e,t){connect.getLog().error("getWebSocketUrl failed").sendInternalLogToServer().withObject({err:e,data:t}),n(Error("getWebSocketUrl failed"))},authFailure:function(){connect.getLog().error("getWebSocketUrl Auth Failure").sendInternalLogToServer(),n(Error("Authentication failed while getting getWebSocketUrl")),o()},accessDenied:function(){connect.getLog().error("getWebSocketUrl Access Denied Failure").sendInternalLogToServer(),n(Error("Access Denied Failure while getting getWebSocketUrl")),r()}})})},t.prototype.handleSendLogsRequest=function(){var t=[],e=this.logsBuffer.slice();this.logsBuffer=[],e.forEach(function(e){t.push({timestamp:e.time,component:e.component,message:e.text})}),this.client.call(connect.ClientMethods.SEND_CLIENT_LOGS,{logEvents:t},{success:function(e){connect.getLog().info("SendLogs request succeeded.").sendInternalLogToServer()},failure:function(e,t){connect.getLog().error("SendLogs request failed.").withObject(t).withException(e).sendInternalLogToServer()},authFailure:connect.hitch(this,this.handleAuthFail)})},t.prototype.handleAuthFail=function(){this.conduit.sendDownstream(connect.EventType.AUTH_FAIL)},t.prototype.handleAccessDenied=function(){this.conduit.sendDownstream(connect.EventType.ACCESS_DENIED)},t.prototype.checkAuthToken=function(){var e=new Date(this.initData.authTokenExpiration),t=(new Date).getTime();e.getTime()<t+18e5&&(connect.getLog().info("Auth token expires at "+e+" Start refreshing token with retry.").sendInternalLogToServer(),connect.backoff(connect.hitch(this,this.authorize),1e4,4))},t.prototype.authorize=function(n){var o=this;connect.core.authorize(this.initData.authorizeEndpoint).then(function(e){var t=new Date(e.expiration);connect.getLog().info("Authorization succeeded and the token expires at %s",t).sendInternalLogToServer(),o.initData.authToken=e.accessToken,o.initData.authTokenExpiration=t,connect.core.initClient(o.initData),connect.core.initAgentAppClient(o.initData),n.success()}).catch(function(e){connect.getLog().error("Authorization failed with code %s",e.status).sendInternalLogToServer(),401===e.status?o.handleAuthFail():n.failure()})},t.prototype.filterAuthToken=function(e){var t,n={};for(t in e)if("params"===t){var o,r={};for(o in e.params)"authentication"!==o&&(r[o]=e.params[o]);n.params=r}else n[t]=e[t];return n},connect.worker.main=function(){connect.worker.clientEngine=new t}}(),function(){connect=this.connect||{},this.connect=connect,connect.ChatMediaController=function(n,e){var o=connect.getLog(),r=connect.LogComponent.CHAT,i=function(e,t){connect.publishMetric({name:e,contactId:n.contactId,data:t||n})},s=function(e){e.onConnectionBroken(function(e){o.error(r,"Chat Session connection broken").withException(e).sendInternalLogToServer(),i("Chat Session connection broken",e)}),e.onConnectionEstablished(function(e){o.info(r,"Chat Session connection established").withObject(e).sendInternalLogToServer(),i("Chat Session connection established",e)})};return{get:function(){i("Chat media controller init",n.contactId),o.info(r,"Chat media controller init").withObject(n).sendInternalLogToServer(),connect.ChatSession.setGlobalConfig({loggerConfig:{logger:o},region:e.region});var t=connect.ChatSession.create({chatDetails:n,type:"AGENT",websocketManager:connect.core.getWebSocketManager()});return s(t),t.connect().then(function(e){return o.info(r,"Chat Session Successfully established for contactId %s",n.contactId).sendInternalLogToServer(),i("Chat Session Successfully established",n.contactId),t}).catch(function(e){throw o.error(r,"Chat Session establishement failed for contact %s",n.contactId).withException(e).sendInternalLogToServer(),i("Chat Session establishement failed",n.contactId,e),e})}}}}(),function(){connect=this.connect||{},this.connect=connect,connect.MediaFactory=function(e){var n={},t=new Set,o=connect.getLog(),r=connect.LogComponent.CHAT,i=connect.merge({},e)||{};i.region=i.region||"us-west-2";var s=function(e){n[e]&&!t.has(e)&&(o.info(r,"Destroying mediaController for %s",e),t.add(e),n[e].then(function(){"function"==typeof controller.cleanUp&&controller.cleanUp(),delete n[e],t.delete(e)}).catch(function(){delete n[e],t.delete(e)}))};return{get:function(e){return e.isActive()?function(e){var t=e.getConnectionId();if(!e.getMediaInfo())return o.error(r,"Media info does not exists for a media type %s").withObject(e).sendInternalLogToServer(),Promise.reject("Media info does not exists for this connection");if(n[t])return n[t];switch(o.info(r,"media controller of type %s init",e.getMediaType()).withObject(e).sendInternalLogToServer(),e.getMediaType()){case connect.MediaType.CHAT:return n[t]=new connect.ChatMediaController(e.getMediaInfo(),i).get();case connect.MediaType.SOFTPHONE:return n[t]=new connect.SoftphoneMediaController(e.getMediaInfo()).get();case connect.MediaType.TASK:return n[t]=new connect.TaskMediaController(e.getMediaInfo()).get();default:return o.error(r,"Unrecognized media type %s ",e.getMediaType()).sendInternalLogToServer(),Promise.reject()}}(e):(s(e.getConnectionId()),Promise.reject("Media Controller is no longer available for this connection"))},destroy:s}}}(),function(){connect=this.connect||{},this.connect=connect,connect.SoftphoneMediaController=function(e){return{get:function(){return Promise.resolve(e)}}}}(),function(){connect=this.connect||{},this.connect=connect,connect.TaskMediaController=function(n){var t=connect.getLog(),o=connect.LogComponent.TASK,r=function(e,t){connect.publishMetric({name:e,contactId:n.contactId,data:t||n})},i=function(e){e.onConnectionBroken(function(e){t.error(o,"Task Session connection broken").withException(e),r("Task Session connection broken",e)}),e.onConnectionEstablished(function(e){t.info(o,"Task Session connection established").withObject(e),r("Task Session connection established",e)})};return{get:function(){r("Task media controller init",n.contactId),t.info(o,"Task media controller init").withObject(n);var e=connect.TaskSession.create({contactId:n.contactId,initialContactId:n.initialContactId,websocketManager:connect.core.getWebSocketManager()});return i(e),e.connect().then(function(){return t.info(o,"Task Session Successfully established for contactId %s",n.contactId),r("Task Session Successfully established",n.contactId),e}).catch(function(e){throw t.error(o,"Task Session establishement failed for contact %s",n.contactId).withException(e),r("Chat Session establishement failed",n.contactId,e),e})}}}}(),function(){var s=this;connect=s.connect||{},s.connect=connect,s.lily=connect,connect.agentApp={};var i="ccp";function c(e){var t=e.indexOf("ccp-v2");return e.slice(0,t-1)}connect.agentApp.initCCP=connect.core.initCCP,connect.agentApp.isInitialized=function(e){},connect.agentApp.initAppCommunication=function(e,t){var n=document.getElementById(e),o=new connect.IFrameConduit(t,window,n),r=[connect.AgentEvents.UPDATE,connect.ContactEvents.VIEW,connect.EventType.ACKNOWLEDGE,connect.EventType.TERMINATED];n.addEventListener("load",function(e){r.forEach(function(t){connect.core.getUpstream().onUpstream(t,function(e){o.sendUpstream(t,e)})})});var i=window.setInterval(function(){n.src+=""},5e3);connect.core.getUpstream().onUpstream(connect.EventType.ACKNOWLEDGE,function(){s.clearInterval(i)})},connect.agentApp.initApp=function(o,e,t,r){r=r||{};t={endpoint:t.endsWith("/")?t:t+"/",style:r.style};connect.agentApp.AppRegistry.register(o,t,document.getElementById(e)),connect.agentApp.AppRegistry.start(o,function(e){var n=e.endpoint,t=e.containerDOM;return{init:function(){return o===i?function(e,t,n){e={ccpUrl:e,ccpLoadTimeout:1e4,loginPopup:!0,loginUrl:c(e)+"/login",softphone:{allowFramedSoftphone:!0,disableRingtone:!1}},n=connect.merge(e,n.ccpParams);connect.core.initCCP(t,n)}(n,t,r):connect.agentApp.initAppCommunication(o,n)},destroy:function(){return o===i?(t=c(n)+"/logout",connect.fetch(t,{credentials:"include"}).then(function(){return connect.core.getEventBus().trigger(connect.EventType.TERMINATE),!0}).catch(function(e){return connect.getLog().error("An error occured on logout."+e).withException(e),window.location.href=t,!1})):null;var t}}})},connect.agentApp.stopApp=function(e){return connect.agentApp.AppRegistry.stop(e)}}(),function(){connect=this.connect||{},this.connect=connect;var c,a={CCP:"ccp"};this.connect.agentApp.AppRegistry=(c={},{register:function(e,t,n){c[e]={containerDOM:n,endpoint:t.endpoint,style:t.style,instance:void 0}},start:function(e,t){if(c[e]){var n,o,r=c[e].containerDOM,i=c[e].endpoint,s=c[e].style;return e!==a.CCP&&(n=e,o=i,i=s,(s=document.createElement("iframe")).src=o,s.style=i||"width: 100%; height:100%;",s.id=n,s["aria-label"]=n,s=s,r.appendChild(s)),c[e].instance=t(c[e]),c[e].instance.init()}},stop:function(e){if(c[e]){var t,n=c[e],e=n.containerDOM.querySelector("iframe");return n.containerDOM.removeChild(e),n.instance&&(t=n.instance.destroy(),delete n.instance),t}}})}();