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Qh8C,EAAK27B,GACpE,IACE,IAAI0d,EAAOyC,EAAI97C,GAAK27B,GAChB/9B,EAAQy7C,EAAKz7C,MACjB,MAAO0H,GAEP,YADAga,EAAOha,GAIL+zC,EAAK15B,KACPN,EAAQzhB,GAERwhB,QAAQC,QAAQzhB,GAAOgiB,KAAKm8B,EAAOC,GAIxB,SAASC,EAAkBv7C,GACxC,OAAO,WACL,IAAImyC,EAAOluC,KACP2O,EAAO3S,UACX,OAAO,IAAIye,SAAQ,SAAUC,EAASC,GACpC,IAAIw8B,EAAMp7C,EAAG0C,MAAMyvC,EAAMv/B,GAEzB,SAASyoC,EAAMn+C,GACbi+C,EAAmBC,EAAKz8B,EAASC,EAAQy8B,EAAOC,EAAQ,OAAQp+C,GAGlE,SAASo+C,EAAOz0B,GACds0B,EAAmBC,EAAKz8B,EAASC,EAAQy8B,EAAOC,EAAQ,QAASz0B,GAGnEw0B,OAAM1+C,O","sources":["webpack://ace-industrial-academy/./node_modules/@babel/runtime/regenerator/index.js","webpack://ace-industrial-academy/./node_modules/@aws-amplify/api-graphql/node_modules/graphql/jsutils/nodejsCustomInspectSymbol.mjs","webpack://ace-industrial-academy/./node_modules/@aws-amplify/api-graphql/node_modules/graphql/jsutils/inspect.mjs","webpack://ace-industrial-academy/./node_modules/@aws-amplify/api-graphql/node_modules/graphql/jsutils/devAssert.mjs","webpack://ace-industrial-academy/./node_modules/@aws-amplify/api-graphql/node_modules/graphql/jsutils/defineToJSON.mjs","webpack://ace-industrial-academy/./node_modules/@aws-amplify/api-graphql/node_modules/graphql/jsutils/isObjectLike.mjs","webpack://ace-industrial-academy/./node_modules/@aws-amplify/api-graphql/node_modules/graphql/language/location.mjs","webpack://ace-industrial-academy/./node_modules/@aws-amplify/api-graphql/node_modules/graphql/language/printLocation.mjs","webpack://ace-industrial-academy/./node_modules/@aws-amplify/api-graphql/node_modules/graphql/error/GraphQLError.mjs","webpack://ace-industrial-academy/./node_modules/@aws-amplify/api-graphql/node_modules/graphql/error/syntaxError.mjs","webpack://ace-industrial-academy/./node_modules/@aws-amplify/api-graphql/node_modules/graphql/language/kinds.mjs","webpack://ace-industrial-academy/./node_modules/@aws-amplify/api-graphql/node_modules/graphql/language/source.mjs","webpack://ace-industrial-academy/./node_modules/@aws-amplify/api-graphql/node_modules/graphql/jsutils/defineToStringTag.mjs","webpack://ace-industrial-academy/./node_modules/@aws-amplify/api-graphql/node_modules/graphql/language/blockString.mjs","webpack://ace-industrial-academy/./node_modules/@aws-amplify/api-graphql/node_modules/graphql/language/tokenKind.mjs","webpack://ace-industrial-academy/./node_modules/@aws-amplify/api-graphql/node_modules/graphql/language/lexer.mjs","webpack://ace-industrial-academy/./node_modules/@aws-amplify/api-graphql/node_modules/graphql/language/directiveLocation.mjs","webpack://ace-industrial-academy/./node_modules/@aws-amplify/api-graphql/node_modules/graphql/language/parser.mjs","webpack://ace-industrial-academy/./node_modules/@aws-amplify/api-graphql/node_modules/graphql/language/visitor.mjs","webpack://ace-industrial-academy/./node_modules/@aws-amplify/api-graphql/node_modules/graphql/language/printer.mjs","webpack://ace-industrial-academy/./node_modules/@aws-amplify/pubsub/lib-esm/Providers/MqttOverWSProvider.js","webpack://ace-industrial-academy/./node_modules/@aws-amplify/core/lib-esm/index.js","webpack://ace-industrial-academy/./node_modules/@aws-amplify/core/lib-esm/constants.js","webpack://ace-industrial-academy/./node_modules/zen-observable-ts/lib/bundle.esm.js","webpack://ace-industrial-academy/./node_modules/@aws-amplify/pubsub/lib-esm/Providers/PubSubProvider.js","webpack://ace-industrial-academy/./node_modules/@aws-amplify/pubsub/lib-esm/Providers/AWSAppSyncProvider.js","webpack://ace-industrial-academy/./node_modules/@aws-amplify/pubsub/node_modules/graphql/language/location.mjs","webpack://ace-industrial-academy/./node_modules/@aws-amplify/pubsub/node_modules/graphql/error/printError.mjs","webpack://ace-industrial-academy/./node_modules/@aws-amplify/pubsub/node_modules/graphql/error/GraphQLError.mjs","webpack://ace-industrial-academy/./node_modules/@aws-amplify/pubsub/lib-esm/Providers/AWSAppSyncRealTimeProvider.js","webpack://ace-industrial-academy/./node_modules/@aws-amplify/pubsub/lib-esm/index.js","webpack://ace-industrial-academy/./node_modules/@aws-amplify/pubsub/lib-esm/PubSub.js","webpack://ace-industrial-academy/./node_modules/@aws-amplify/api-graphql/lib-esm/types/index.js","webpack://ace-industrial-academy/./node_modules/@aws-amplify/api-graphql/lib-esm/GraphQLAPI.js","webpack://ace-industrial-academy/./node_modules/@aws-amplify/api-rest/lib-esm/RestClient.js","webpack://ace-industrial-academy/./node_modules/@aws-amplify/api-rest/lib-esm/RestAPI.js","webpack://ace-industrial-academy/./node_modules/@aws-amplify/api/lib-esm/API.js","webpack://ace-industrial-academy/./node_modules/@aws-amplify/auth/lib-esm/index.js","webpack://ace-industrial-academy/./node_modules/@aws-amplify/core/lib-esm/I18n/I18n.js","webpack://ace-industrial-academy/./node_modules/@aws-amplify/core/lib-esm/I18n/index.js","webpack://ace-industrial-academy/./node_modules/@aws-amplify/core/lib-esm/Signer.js","webpack://ace-industrial-academy/./node_modules/@aws-amplify/core/lib-esm/Util/DateUtils.js","webpack://ace-industrial-academy/./node_modules/@aws-amplify/core/node_modules/@aws-crypto/sha256-js/build/RawSha256.js","webpack://ace-industrial-academy/./node_modules/@aws-amplify/core/node_modules/@aws-crypto/sha256-js/build/constants.js","webpack://ace-industrial-academy/./node_modules/@aws-amplify/core/node_modules/@aws-crypto/sha256-js/build/index.js","webpack://ace-industrial-academy/./node_modules/@aws-amplify/core/node_modules/@aws-crypto/sha256-js/build/jsSha256.js","webpack://ace-industrial-academy/./node_modules/@aws-amplify/core/node_modules/@aws-sdk/util-utf8-browser/dist/es/index.js","webpack://ace-industrial-academy/./node_modules/@aws-amplify/core/node_modules/@aws-sdk/util-utf8-browser/dist/es/whatwgEncodingApi.js","webpack://ace-industrial-academy/./node_modules/@aws-amplify/core/node_modules/@aws-sdk/util-utf8-browser/dist/es/pureJs.js","webpack://ace-industrial-academy/./node_modules/paho-mqtt/paho-mqtt.js","webpack://ace-industrial-academy/./node_modules/zen-observable-ts/node_modules/zen-observable/index.js","webpack://ace-industrial-academy/./node_modules/zen-observable-ts/node_modules/zen-observable/lib/Observable.js","webpack://ace-industrial-academy/./node_modules/regenerator-runtime/runtime.js","webpack://ace-industrial-academy/./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js"],"sourcesContent":["module.exports = require(\"regenerator-runtime\");\n","var nodejsCustomInspectSymbol = typeof Symbol === 'function' && typeof Symbol.for === 'function' ? Symbol.for('nodejs.util.inspect.custom') : undefined;\nexport default nodejsCustomInspectSymbol;","function _typeof(obj) {\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nimport nodejsCustomInspectSymbol from './nodejsCustomInspectSymbol';\nvar MAX_ARRAY_LENGTH = 10;\nvar MAX_RECURSIVE_DEPTH = 2;\n/**\n * Used to print values in error messages.\n */\n\nexport default function inspect(value) {\n return formatValue(value, []);\n}\n\nfunction formatValue(value, seenValues) {\n switch (_typeof(value)) {\n case 'string':\n return JSON.stringify(value);\n\n case 'function':\n return value.name ? \"[function \".concat(value.name, \"]\") : '[function]';\n\n case 'object':\n if (value === null) {\n return 'null';\n }\n\n return formatObjectValue(value, seenValues);\n\n default:\n return String(value);\n }\n}\n\nfunction formatObjectValue(value, previouslySeenValues) {\n if (previouslySeenValues.indexOf(value) !== -1) {\n return '[Circular]';\n }\n\n var seenValues = [].concat(previouslySeenValues, [value]);\n var customInspectFn = getCustomFn(value);\n\n if (customInspectFn !== undefined) {\n // $FlowFixMe(>=0.90.0)\n var customValue = customInspectFn.call(value); // check for infinite recursion\n\n if (customValue !== value) {\n return typeof customValue === 'string' ? customValue : formatValue(customValue, seenValues);\n }\n } else if (Array.isArray(value)) {\n return formatArray(value, seenValues);\n }\n\n return formatObject(value, seenValues);\n}\n\nfunction formatObject(object, seenValues) {\n var keys = Object.keys(object);\n\n if (keys.length === 0) {\n return '{}';\n }\n\n if (seenValues.length > MAX_RECURSIVE_DEPTH) {\n return '[' + getObjectTag(object) + ']';\n }\n\n var properties = keys.map(function (key) {\n var value = formatValue(object[key], seenValues);\n return key + ': ' + value;\n });\n return '{ ' + properties.join(', ') + ' }';\n}\n\nfunction formatArray(array, seenValues) {\n if (array.length === 0) {\n return '[]';\n }\n\n if (seenValues.length > MAX_RECURSIVE_DEPTH) {\n return '[Array]';\n }\n\n var len = Math.min(MAX_ARRAY_LENGTH, array.length);\n var remaining = array.length - len;\n var items = [];\n\n for (var i = 0; i < len; ++i) {\n items.push(formatValue(array[i], seenValues));\n }\n\n if (remaining === 1) {\n items.push('... 1 more item');\n } else if (remaining > 1) {\n items.push(\"... \".concat(remaining, \" more items\"));\n }\n\n return '[' + items.join(', ') + ']';\n}\n\nfunction getCustomFn(object) {\n var customInspectFn = object[String(nodejsCustomInspectSymbol)];\n\n if (typeof customInspectFn === 'function') {\n return customInspectFn;\n }\n\n if (typeof object.inspect === 'function') {\n return object.inspect;\n }\n}\n\nfunction getObjectTag(object) {\n var tag = Object.prototype.toString.call(object).replace(/^\\[object /, '').replace(/]$/, '');\n\n if (tag === 'Object' && typeof object.constructor === 'function') {\n var name = object.constructor.name;\n\n if (typeof name === 'string' && name !== '') {\n return name;\n }\n }\n\n return tag;\n}","export default function devAssert(condition, message) {\n var booleanCondition = Boolean(condition);\n\n if (!booleanCondition) {\n throw new Error(message);\n }\n}","import nodejsCustomInspectSymbol from './nodejsCustomInspectSymbol';\n/**\n * The `defineToJSON()` function defines toJSON() and inspect() prototype\n * methods, if no function provided they become aliases for toString().\n */\n\nexport default function defineToJSON(classObject) {\n var fn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : classObject.prototype.toString;\n classObject.prototype.toJSON = fn;\n classObject.prototype.inspect = fn;\n\n if (nodejsCustomInspectSymbol) {\n classObject.prototype[nodejsCustomInspectSymbol] = fn;\n }\n}","function _typeof(obj) {\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n/**\n * Return true if `value` is object-like. A value is object-like if it's not\n * `null` and has a `typeof` result of \"object\".\n */\n\n\nexport default function isObjectLike(value) {\n return _typeof(value) == 'object' && value !== null;\n}","/**\n * Represents a location in a Source.\n */\n\n/**\n * Takes a Source and a UTF-8 character offset, and returns the corresponding\n * line and column as a SourceLocation.\n */\nexport function getLocation(source, position) {\n var lineRegexp = /\\r\\n|[\\n\\r]/g;\n var line = 1;\n var column = position + 1;\n var match;\n\n while ((match = lineRegexp.exec(source.body)) && match.index < position) {\n line += 1;\n column = position + 1 - (match.index + match[0].length);\n }\n\n return {\n line: line,\n column: column\n };\n}","import { getLocation } from '../language/location';\n/**\n * Render a helpful description of the location in the GraphQL Source document.\n */\n\nexport function printLocation(location) {\n return printSourceLocation(location.source, getLocation(location.source, location.start));\n}\n/**\n * Render a helpful description of the location in the GraphQL Source document.\n */\n\nexport function printSourceLocation(source, sourceLocation) {\n var firstLineColumnOffset = source.locationOffset.column - 1;\n var body = whitespace(firstLineColumnOffset) + source.body;\n var lineIndex = sourceLocation.line - 1;\n var lineOffset = source.locationOffset.line - 1;\n var lineNum = sourceLocation.line + lineOffset;\n var columnOffset = sourceLocation.line === 1 ? firstLineColumnOffset : 0;\n var columnNum = sourceLocation.column + columnOffset;\n var locationStr = \"\".concat(source.name, \":\").concat(lineNum, \":\").concat(columnNum, \"\\n\");\n var lines = body.split(/\\r\\n|[\\n\\r]/g);\n var locationLine = lines[lineIndex]; // Special case for minified documents\n\n if (locationLine.length > 120) {\n var sublineIndex = Math.floor(columnNum / 80);\n var sublineColumnNum = columnNum % 80;\n var sublines = [];\n\n for (var i = 0; i < locationLine.length; i += 80) {\n sublines.push(locationLine.slice(i, i + 80));\n }\n\n return locationStr + printPrefixedLines([[\"\".concat(lineNum), sublines[0]]].concat(sublines.slice(1, sublineIndex + 1).map(function (subline) {\n return ['', subline];\n }), [[' ', whitespace(sublineColumnNum - 1) + '^'], ['', sublines[sublineIndex + 1]]]));\n }\n\n return locationStr + printPrefixedLines([// Lines specified like this: [\"prefix\", \"string\"],\n [\"\".concat(lineNum - 1), lines[lineIndex - 1]], [\"\".concat(lineNum), locationLine], ['', whitespace(columnNum - 1) + '^'], [\"\".concat(lineNum + 1), lines[lineIndex + 1]]]);\n}\n\nfunction printPrefixedLines(lines) {\n var existingLines = lines.filter(function (_ref) {\n var _ = _ref[0],\n line = _ref[1];\n return line !== undefined;\n });\n var padLen = Math.max.apply(Math, existingLines.map(function (_ref2) {\n var prefix = _ref2[0];\n return prefix.length;\n }));\n return existingLines.map(function (_ref3) {\n var prefix = _ref3[0],\n line = _ref3[1];\n return lpad(padLen, prefix) + ' | ' + line;\n }).join('\\n');\n}\n\nfunction whitespace(len) {\n return Array(len + 1).join(' ');\n}\n\nfunction lpad(len, str) {\n return whitespace(len - str.length) + str;\n}","import isObjectLike from '../jsutils/isObjectLike';\nimport { getLocation } from '../language/location';\nimport { printLocation, printSourceLocation } from '../language/printLocation';\n/**\n * A GraphQLError describes an Error found during the parse, validate, or\n * execute phases of performing a GraphQL operation. In addition to a message\n * and stack trace, it also includes information about the locations in a\n * GraphQL document and/or execution result that correspond to the Error.\n */\n\nexport function GraphQLError( // eslint-disable-line no-redeclare\nmessage, nodes, source, positions, path, originalError, extensions) {\n // Compute list of blame nodes.\n var _nodes = Array.isArray(nodes) ? nodes.length !== 0 ? nodes : undefined : nodes ? [nodes] : undefined; // Compute locations in the source for the given nodes/positions.\n\n\n var _source = source;\n\n if (!_source && _nodes) {\n var node = _nodes[0];\n _source = node && node.loc && node.loc.source;\n }\n\n var _positions = positions;\n\n if (!_positions && _nodes) {\n _positions = _nodes.reduce(function (list, node) {\n if (node.loc) {\n list.push(node.loc.start);\n }\n\n return list;\n }, []);\n }\n\n if (_positions && _positions.length === 0) {\n _positions = undefined;\n }\n\n var _locations;\n\n if (positions && source) {\n _locations = positions.map(function (pos) {\n return getLocation(source, pos);\n });\n } else if (_nodes) {\n _locations = _nodes.reduce(function (list, node) {\n if (node.loc) {\n list.push(getLocation(node.loc.source, node.loc.start));\n }\n\n return list;\n }, []);\n }\n\n var _extensions = extensions;\n\n if (_extensions == null && originalError != null) {\n var originalExtensions = originalError.extensions;\n\n if (isObjectLike(originalExtensions)) {\n _extensions = originalExtensions;\n }\n }\n\n Object.defineProperties(this, {\n message: {\n value: message,\n // By being enumerable, JSON.stringify will include `message` in the\n // resulting output. This ensures that the simplest possible GraphQL\n // service adheres to the spec.\n enumerable: true,\n writable: true\n },\n locations: {\n // Coercing falsey values to undefined ensures they will not be included\n // in JSON.stringify() when not provided.\n value: _locations || undefined,\n // By being enumerable, JSON.stringify will include `locations` in the\n // resulting output. This ensures that the simplest possible GraphQL\n // service adheres to the spec.\n enumerable: Boolean(_locations)\n },\n path: {\n // Coercing falsey values to undefined ensures they will not be included\n // in JSON.stringify() when not provided.\n value: path || undefined,\n // By being enumerable, JSON.stringify will include `path` in the\n // resulting output. This ensures that the simplest possible GraphQL\n // service adheres to the spec.\n enumerable: Boolean(path)\n },\n nodes: {\n value: _nodes || undefined\n },\n source: {\n value: _source || undefined\n },\n positions: {\n value: _positions || undefined\n },\n originalError: {\n value: originalError\n },\n extensions: {\n // Coercing falsey values to undefined ensures they will not be included\n // in JSON.stringify() when not provided.\n value: _extensions || undefined,\n // By being enumerable, JSON.stringify will include `path` in the\n // resulting output. This ensures that the simplest possible GraphQL\n // service adheres to the spec.\n enumerable: Boolean(_extensions)\n }\n }); // Include (non-enumerable) stack trace.\n\n if (originalError && originalError.stack) {\n Object.defineProperty(this, 'stack', {\n value: originalError.stack,\n writable: true,\n configurable: true\n });\n } else if (Error.captureStackTrace) {\n Error.captureStackTrace(this, GraphQLError);\n } else {\n Object.defineProperty(this, 'stack', {\n value: Error().stack,\n writable: true,\n configurable: true\n });\n }\n}\nGraphQLError.prototype = Object.create(Error.prototype, {\n constructor: {\n value: GraphQLError\n },\n name: {\n value: 'GraphQLError'\n },\n toString: {\n value: function toString() {\n return printError(this);\n }\n }\n});\n/**\n * Prints a GraphQLError to a string, representing useful location information\n * about the error's position in the source.\n */\n\nexport function printError(error) {\n var output = error.message;\n\n if (error.nodes) {\n for (var _i2 = 0, _error$nodes2 = error.nodes; _i2 < _error$nodes2.length; _i2++) {\n var node = _error$nodes2[_i2];\n\n if (node.loc) {\n output += '\\n\\n' + printLocation(node.loc);\n }\n }\n } else if (error.source && error.locations) {\n for (var _i4 = 0, _error$locations2 = error.locations; _i4 < _error$locations2.length; _i4++) {\n var location = _error$locations2[_i4];\n output += '\\n\\n' + printSourceLocation(error.source, location);\n }\n }\n\n return output;\n}","import { GraphQLError } from './GraphQLError';\n/**\n * Produces a GraphQLError representing a syntax error, containing useful\n * descriptive information about the syntax error's position in the source.\n */\n\nexport function syntaxError(source, position, description) {\n return new GraphQLError(\"Syntax Error: \".concat(description), undefined, source, [position]);\n}","/**\n * The set of allowed kind values for AST nodes.\n */\nexport var Kind = Object.freeze({\n // Name\n NAME: 'Name',\n // Document\n DOCUMENT: 'Document',\n OPERATION_DEFINITION: 'OperationDefinition',\n VARIABLE_DEFINITION: 'VariableDefinition',\n SELECTION_SET: 'SelectionSet',\n FIELD: 'Field',\n ARGUMENT: 'Argument',\n // Fragments\n FRAGMENT_SPREAD: 'FragmentSpread',\n INLINE_FRAGMENT: 'InlineFragment',\n FRAGMENT_DEFINITION: 'FragmentDefinition',\n // Values\n VARIABLE: 'Variable',\n INT: 'IntValue',\n FLOAT: 'FloatValue',\n STRING: 'StringValue',\n BOOLEAN: 'BooleanValue',\n NULL: 'NullValue',\n ENUM: 'EnumValue',\n LIST: 'ListValue',\n OBJECT: 'ObjectValue',\n OBJECT_FIELD: 'ObjectField',\n // Directives\n DIRECTIVE: 'Directive',\n // Types\n NAMED_TYPE: 'NamedType',\n LIST_TYPE: 'ListType',\n NON_NULL_TYPE: 'NonNullType',\n // Type System Definitions\n SCHEMA_DEFINITION: 'SchemaDefinition',\n OPERATION_TYPE_DEFINITION: 'OperationTypeDefinition',\n // Type Definitions\n SCALAR_TYPE_DEFINITION: 'ScalarTypeDefinition',\n OBJECT_TYPE_DEFINITION: 'ObjectTypeDefinition',\n FIELD_DEFINITION: 'FieldDefinition',\n INPUT_VALUE_DEFINITION: 'InputValueDefinition',\n INTERFACE_TYPE_DEFINITION: 'InterfaceTypeDefinition',\n UNION_TYPE_DEFINITION: 'UnionTypeDefinition',\n ENUM_TYPE_DEFINITION: 'EnumTypeDefinition',\n ENUM_VALUE_DEFINITION: 'EnumValueDefinition',\n INPUT_OBJECT_TYPE_DEFINITION: 'InputObjectTypeDefinition',\n // Directive Definitions\n DIRECTIVE_DEFINITION: 'DirectiveDefinition',\n // Type System Extensions\n SCHEMA_EXTENSION: 'SchemaExtension',\n // Type Extensions\n SCALAR_TYPE_EXTENSION: 'ScalarTypeExtension',\n OBJECT_TYPE_EXTENSION: 'ObjectTypeExtension',\n INTERFACE_TYPE_EXTENSION: 'InterfaceTypeExtension',\n UNION_TYPE_EXTENSION: 'UnionTypeExtension',\n ENUM_TYPE_EXTENSION: 'EnumTypeExtension',\n INPUT_OBJECT_TYPE_EXTENSION: 'InputObjectTypeExtension'\n});\n/**\n * The enum type representing the possible kind values of AST nodes.\n */","import devAssert from '../jsutils/devAssert';\nimport defineToStringTag from '../jsutils/defineToStringTag';\n/**\n * A representation of source input to GraphQL.\n * `name` and `locationOffset` are optional. They are useful for clients who\n * store GraphQL documents in source files; for example, if the GraphQL input\n * starts at line 40 in a file named Foo.graphql, it might be useful for name to\n * be \"Foo.graphql\" and location to be `{ line: 40, column: 0 }`.\n * line and column in locationOffset are 1-indexed\n */\n\nexport var Source = function Source(body, name, locationOffset) {\n this.body = body;\n this.name = name || 'GraphQL request';\n this.locationOffset = locationOffset || {\n line: 1,\n column: 1\n };\n this.locationOffset.line > 0 || devAssert(0, 'line in locationOffset is 1-indexed and must be positive');\n this.locationOffset.column > 0 || devAssert(0, 'column in locationOffset is 1-indexed and must be positive');\n}; // Conditionally apply `[Symbol.toStringTag]` if `Symbol`s are supported\n\ndefineToStringTag(Source);","/**\n * The `defineToStringTag()` function checks first to see if the runtime\n * supports the `Symbol` class and then if the `Symbol.toStringTag` constant\n * is defined as a `Symbol` instance. If both conditions are met, the\n * Symbol.toStringTag property is defined as a getter that returns the\n * supplied class constructor's name.\n *\n * @method defineToStringTag\n *\n * @param {Class} classObject a class such as Object, String, Number but\n * typically one of your own creation through the class keyword; `class A {}`,\n * for example.\n */\nexport default function defineToStringTag(classObject) {\n if (typeof Symbol === 'function' && Symbol.toStringTag) {\n Object.defineProperty(classObject.prototype, Symbol.toStringTag, {\n get: function get() {\n return this.constructor.name;\n }\n });\n }\n}","/**\n * Produces the value of a block string from its parsed raw value, similar to\n * CoffeeScript's block string, Python's docstring trim or Ruby's strip_heredoc.\n *\n * This implements the GraphQL spec's BlockStringValue() static algorithm.\n */\nexport function dedentBlockStringValue(rawString) {\n // Expand a block string's raw value into independent lines.\n var lines = rawString.split(/\\r\\n|[\\n\\r]/g); // Remove common indentation from all lines but first.\n\n var commonIndent = getBlockStringIndentation(lines);\n\n if (commonIndent !== 0) {\n for (var i = 1; i < lines.length; i++) {\n lines[i] = lines[i].slice(commonIndent);\n }\n } // Remove leading and trailing blank lines.\n\n\n while (lines.length > 0 && isBlank(lines[0])) {\n lines.shift();\n }\n\n while (lines.length > 0 && isBlank(lines[lines.length - 1])) {\n lines.pop();\n } // Return a string of the lines joined with U+000A.\n\n\n return lines.join('\\n');\n} // @internal\n\nexport function getBlockStringIndentation(lines) {\n var commonIndent = null;\n\n for (var i = 1; i < lines.length; i++) {\n var line = lines[i];\n var indent = leadingWhitespace(line);\n\n if (indent === line.length) {\n continue; // skip empty lines\n }\n\n if (commonIndent === null || indent < commonIndent) {\n commonIndent = indent;\n\n if (commonIndent === 0) {\n break;\n }\n }\n }\n\n return commonIndent === null ? 0 : commonIndent;\n}\n\nfunction leadingWhitespace(str) {\n var i = 0;\n\n while (i < str.length && (str[i] === ' ' || str[i] === '\\t')) {\n i++;\n }\n\n return i;\n}\n\nfunction isBlank(str) {\n return leadingWhitespace(str) === str.length;\n}\n/**\n * Print a block string in the indented block form by adding a leading and\n * trailing blank line. However, if a block string starts with whitespace and is\n * a single-line, adding a leading blank line would strip that whitespace.\n */\n\n\nexport function printBlockString(value) {\n var indentation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n var preferMultipleLines = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n var isSingleLine = value.indexOf('\\n') === -1;\n var hasLeadingSpace = value[0] === ' ' || value[0] === '\\t';\n var hasTrailingQuote = value[value.length - 1] === '\"';\n var printAsMultipleLines = !isSingleLine || hasTrailingQuote || preferMultipleLines;\n var result = ''; // Format a multi-line block quote to account for leading space.\n\n if (printAsMultipleLines && !(isSingleLine && hasLeadingSpace)) {\n result += '\\n' + indentation;\n }\n\n result += indentation ? value.replace(/\\n/g, '\\n' + indentation) : value;\n\n if (printAsMultipleLines) {\n result += '\\n';\n }\n\n return '\"\"\"' + result.replace(/\"\"\"/g, '\\\\\"\"\"') + '\"\"\"';\n}","/**\n * An exported enum describing the different kinds of tokens that the\n * lexer emits.\n */\nexport var TokenKind = Object.freeze({\n SOF: '',\n EOF: '',\n BANG: '!',\n DOLLAR: '$',\n AMP: '&',\n PAREN_L: '(',\n PAREN_R: ')',\n SPREAD: '...',\n COLON: ':',\n EQUALS: '=',\n AT: '@',\n BRACKET_L: '[',\n BRACKET_R: ']',\n BRACE_L: '{',\n PIPE: '|',\n BRACE_R: '}',\n NAME: 'Name',\n INT: 'Int',\n FLOAT: 'Float',\n STRING: 'String',\n BLOCK_STRING: 'BlockString',\n COMMENT: 'Comment'\n});\n/**\n * The enum type representing the token kinds values.\n */","import defineToJSON from '../jsutils/defineToJSON';\nimport { syntaxError } from '../error/syntaxError';\nimport { dedentBlockStringValue } from './blockString';\nimport { TokenKind } from './tokenKind';\n/**\n * Given a Source object, this returns a Lexer for that source.\n * A Lexer is a stateful stream generator in that every time\n * it is advanced, it returns the next token in the Source. Assuming the\n * source lexes, the final Token emitted by the lexer will be of kind\n * EOF, after which the lexer will repeatedly return the same EOF token\n * whenever called.\n */\n\nexport function createLexer(source, options) {\n var startOfFileToken = new Tok(TokenKind.SOF, 0, 0, 0, 0, null);\n var lexer = {\n source: source,\n options: options,\n lastToken: startOfFileToken,\n token: startOfFileToken,\n line: 1,\n lineStart: 0,\n advance: advanceLexer,\n lookahead: lookahead\n };\n return lexer;\n}\n\nfunction advanceLexer() {\n this.lastToken = this.token;\n var token = this.token = this.lookahead();\n return token;\n}\n\nfunction lookahead() {\n var token = this.token;\n\n if (token.kind !== TokenKind.EOF) {\n do {\n // Note: next is only mutable during parsing, so we cast to allow this.\n token = token.next || (token.next = readToken(this, token));\n } while (token.kind === TokenKind.COMMENT);\n }\n\n return token;\n}\n/**\n * The return type of createLexer.\n */\n// @internal\n\n\nexport function isPunctuatorToken(token) {\n var kind = token.kind;\n return kind === TokenKind.BANG || kind === TokenKind.DOLLAR || kind === TokenKind.AMP || kind === TokenKind.PAREN_L || kind === TokenKind.PAREN_R || kind === TokenKind.SPREAD || kind === TokenKind.COLON || kind === TokenKind.EQUALS || kind === TokenKind.AT || kind === TokenKind.BRACKET_L || kind === TokenKind.BRACKET_R || kind === TokenKind.BRACE_L || kind === TokenKind.PIPE || kind === TokenKind.BRACE_R;\n}\n/**\n * Helper function for constructing the Token object.\n */\n\nfunction Tok(kind, start, end, line, column, prev, value) {\n this.kind = kind;\n this.start = start;\n this.end = end;\n this.line = line;\n this.column = column;\n this.value = value;\n this.prev = prev;\n this.next = null;\n} // Print a simplified form when appearing in JSON/util.inspect.\n\n\ndefineToJSON(Tok, function () {\n return {\n kind: this.kind,\n value: this.value,\n line: this.line,\n column: this.column\n };\n});\n\nfunction printCharCode(code) {\n return (// NaN/undefined represents access beyond the end of the file.\n isNaN(code) ? TokenKind.EOF : // Trust JSON for ASCII.\n code < 0x007f ? JSON.stringify(String.fromCharCode(code)) : // Otherwise print the escaped form.\n \"\\\"\\\\u\".concat(('00' + code.toString(16).toUpperCase()).slice(-4), \"\\\"\")\n );\n}\n/**\n * Gets the next token from the source starting at the given position.\n *\n * This skips over whitespace until it finds the next lexable token, then lexes\n * punctuators immediately or calls the appropriate helper function for more\n * complicated tokens.\n */\n\n\nfunction readToken(lexer, prev) {\n var source = lexer.source;\n var body = source.body;\n var bodyLength = body.length;\n var pos = positionAfterWhitespace(body, prev.end, lexer);\n var line = lexer.line;\n var col = 1 + pos - lexer.lineStart;\n\n if (pos >= bodyLength) {\n return new Tok(TokenKind.EOF, bodyLength, bodyLength, line, col, prev);\n }\n\n var code = body.charCodeAt(pos); // SourceCharacter\n\n switch (code) {\n // !\n case 33:\n return new Tok(TokenKind.BANG, pos, pos + 1, line, col, prev);\n // #\n\n case 35:\n return readComment(source, pos, line, col, prev);\n // $\n\n case 36:\n return new Tok(TokenKind.DOLLAR, pos, pos + 1, line, col, prev);\n // &\n\n case 38:\n return new Tok(TokenKind.AMP, pos, pos + 1, line, col, prev);\n // (\n\n case 40:\n return new Tok(TokenKind.PAREN_L, pos, pos + 1, line, col, prev);\n // )\n\n case 41:\n return new Tok(TokenKind.PAREN_R, pos, pos + 1, line, col, prev);\n // .\n\n case 46:\n if (body.charCodeAt(pos + 1) === 46 && body.charCodeAt(pos + 2) === 46) {\n return new Tok(TokenKind.SPREAD, pos, pos + 3, line, col, prev);\n }\n\n break;\n // :\n\n case 58:\n return new Tok(TokenKind.COLON, pos, pos + 1, line, col, prev);\n // =\n\n case 61:\n return new Tok(TokenKind.EQUALS, pos, pos + 1, line, col, prev);\n // @\n\n case 64:\n return new Tok(TokenKind.AT, pos, pos + 1, line, col, prev);\n // [\n\n case 91:\n return new Tok(TokenKind.BRACKET_L, pos, pos + 1, line, col, prev);\n // ]\n\n case 93:\n return new Tok(TokenKind.BRACKET_R, pos, pos + 1, line, col, prev);\n // {\n\n case 123:\n return new Tok(TokenKind.BRACE_L, pos, pos + 1, line, col, prev);\n // |\n\n case 124:\n return new Tok(TokenKind.PIPE, pos, pos + 1, line, col, prev);\n // }\n\n case 125:\n return new Tok(TokenKind.BRACE_R, pos, pos + 1, line, col, prev);\n // A-Z _ a-z\n\n case 65:\n case 66:\n case 67:\n case 68:\n case 69:\n case 70:\n case 71:\n case 72:\n case 73:\n case 74:\n case 75:\n case 76:\n case 77:\n case 78:\n case 79:\n case 80:\n case 81:\n case 82:\n case 83:\n case 84:\n case 85:\n case 86:\n case 87:\n case 88:\n case 89:\n case 90:\n case 95:\n case 97:\n case 98:\n case 99:\n case 100:\n case 101:\n case 102:\n case 103:\n case 104:\n case 105:\n case 106:\n case 107:\n case 108:\n case 109:\n case 110:\n case 111:\n case 112:\n case 113:\n case 114:\n case 115:\n case 116:\n case 117:\n case 118:\n case 119:\n case 120:\n case 121:\n case 122:\n return readName(source, pos, line, col, prev);\n // - 0-9\n\n case 45:\n case 48:\n case 49:\n case 50:\n case 51:\n case 52:\n case 53:\n case 54:\n case 55:\n case 56:\n case 57:\n return readNumber(source, pos, code, line, col, prev);\n // \"\n\n case 34:\n if (body.charCodeAt(pos + 1) === 34 && body.charCodeAt(pos + 2) === 34) {\n return readBlockString(source, pos, line, col, prev, lexer);\n }\n\n return readString(source, pos, line, col, prev);\n }\n\n throw syntaxError(source, pos, unexpectedCharacterMessage(code));\n}\n/**\n * Report a message that an unexpected character was encountered.\n */\n\n\nfunction unexpectedCharacterMessage(code) {\n if (code < 0x0020 && code !== 0x0009 && code !== 0x000a && code !== 0x000d) {\n return \"Cannot contain the invalid character \".concat(printCharCode(code), \".\");\n }\n\n if (code === 39) {\n // '\n return 'Unexpected single quote character (\\'), did you mean to use a double quote (\")?';\n }\n\n return \"Cannot parse the unexpected character \".concat(printCharCode(code), \".\");\n}\n/**\n * Reads from body starting at startPosition until it finds a non-whitespace\n * character, then returns the position of that character for lexing.\n */\n\n\nfunction positionAfterWhitespace(body, startPosition, lexer) {\n var bodyLength = body.length;\n var position = startPosition;\n\n while (position < bodyLength) {\n var code = body.charCodeAt(position); // tab | space | comma | BOM\n\n if (code === 9 || code === 32 || code === 44 || code === 0xfeff) {\n ++position;\n } else if (code === 10) {\n // new line\n ++position;\n ++lexer.line;\n lexer.lineStart = position;\n } else if (code === 13) {\n // carriage return\n if (body.charCodeAt(position + 1) === 10) {\n position += 2;\n } else {\n ++position;\n }\n\n ++lexer.line;\n lexer.lineStart = position;\n } else {\n break;\n }\n }\n\n return position;\n}\n/**\n * Reads a comment token from the source file.\n *\n * #[\\u0009\\u0020-\\uFFFF]*\n */\n\n\nfunction readComment(source, start, line, col, prev) {\n var body = source.body;\n var code;\n var position = start;\n\n do {\n code = body.charCodeAt(++position);\n } while (!isNaN(code) && ( // SourceCharacter but not LineTerminator\n code > 0x001f || code === 0x0009));\n\n return new Tok(TokenKind.COMMENT, start, position, line, col, prev, body.slice(start + 1, position));\n}\n/**\n * Reads a number token from the source file, either a float\n * or an int depending on whether a decimal point appears.\n *\n * Int: -?(0|[1-9][0-9]*)\n * Float: -?(0|[1-9][0-9]*)(\\.[0-9]+)?((E|e)(+|-)?[0-9]+)?\n */\n\n\nfunction readNumber(source, start, firstCode, line, col, prev) {\n var body = source.body;\n var code = firstCode;\n var position = start;\n var isFloat = false;\n\n if (code === 45) {\n // -\n code = body.charCodeAt(++position);\n }\n\n if (code === 48) {\n // 0\n code = body.charCodeAt(++position);\n\n if (code >= 48 && code <= 57) {\n throw syntaxError(source, position, \"Invalid number, unexpected digit after 0: \".concat(printCharCode(code), \".\"));\n }\n } else {\n position = readDigits(source, position, code);\n code = body.charCodeAt(position);\n }\n\n if (code === 46) {\n // .\n isFloat = true;\n code = body.charCodeAt(++position);\n position = readDigits(source, position, code);\n code = body.charCodeAt(position);\n }\n\n if (code === 69 || code === 101) {\n // E e\n isFloat = true;\n code = body.charCodeAt(++position);\n\n if (code === 43 || code === 45) {\n // + -\n code = body.charCodeAt(++position);\n }\n\n position = readDigits(source, position, code);\n }\n\n return new Tok(isFloat ? TokenKind.FLOAT : TokenKind.INT, start, position, line, col, prev, body.slice(start, position));\n}\n/**\n * Returns the new position in the source after reading digits.\n */\n\n\nfunction readDigits(source, start, firstCode) {\n var body = source.body;\n var position = start;\n var code = firstCode;\n\n if (code >= 48 && code <= 57) {\n // 0 - 9\n do {\n code = body.charCodeAt(++position);\n } while (code >= 48 && code <= 57); // 0 - 9\n\n\n return position;\n }\n\n throw syntaxError(source, position, \"Invalid number, expected digit but got: \".concat(printCharCode(code), \".\"));\n}\n/**\n * Reads a string token from the source file.\n *\n * \"([^\"\\\\\\u000A\\u000D]|(\\\\(u[0-9a-fA-F]{4}|[\"\\\\/bfnrt])))*\"\n */\n\n\nfunction readString(source, start, line, col, prev) {\n var body = source.body;\n var position = start + 1;\n var chunkStart = position;\n var code = 0;\n var value = '';\n\n while (position < body.length && !isNaN(code = body.charCodeAt(position)) && // not LineTerminator\n code !== 0x000a && code !== 0x000d) {\n // Closing Quote (\")\n if (code === 34) {\n value += body.slice(chunkStart, position);\n return new Tok(TokenKind.STRING, start, position + 1, line, col, prev, value);\n } // SourceCharacter\n\n\n if (code < 0x0020 && code !== 0x0009) {\n throw syntaxError(source, position, \"Invalid character within String: \".concat(printCharCode(code), \".\"));\n }\n\n ++position;\n\n if (code === 92) {\n // \\\n value += body.slice(chunkStart, position - 1);\n code = body.charCodeAt(position);\n\n switch (code) {\n case 34:\n value += '\"';\n break;\n\n case 47:\n value += '/';\n break;\n\n case 92:\n value += '\\\\';\n break;\n\n case 98:\n value += '\\b';\n break;\n\n case 102:\n value += '\\f';\n break;\n\n case 110:\n value += '\\n';\n break;\n\n case 114:\n value += '\\r';\n break;\n\n case 116:\n value += '\\t';\n break;\n\n case 117:\n {\n // uXXXX\n var charCode = uniCharCode(body.charCodeAt(position + 1), body.charCodeAt(position + 2), body.charCodeAt(position + 3), body.charCodeAt(position + 4));\n\n if (charCode < 0) {\n var invalidSequence = body.slice(position + 1, position + 5);\n throw syntaxError(source, position, \"Invalid character escape sequence: \\\\u\".concat(invalidSequence, \".\"));\n }\n\n value += String.fromCharCode(charCode);\n position += 4;\n break;\n }\n\n default:\n throw syntaxError(source, position, \"Invalid character escape sequence: \\\\\".concat(String.fromCharCode(code), \".\"));\n }\n\n ++position;\n chunkStart = position;\n }\n }\n\n throw syntaxError(source, position, 'Unterminated string.');\n}\n/**\n * Reads a block string token from the source file.\n *\n * \"\"\"(\"?\"?(\\\\\"\"\"|\\\\(?!=\"\"\")|[^\"\\\\]))*\"\"\"\n */\n\n\nfunction readBlockString(source, start, line, col, prev, lexer) {\n var body = source.body;\n var position = start + 3;\n var chunkStart = position;\n var code = 0;\n var rawValue = '';\n\n while (position < body.length && !isNaN(code = body.charCodeAt(position))) {\n // Closing Triple-Quote (\"\"\")\n if (code === 34 && body.charCodeAt(position + 1) === 34 && body.charCodeAt(position + 2) === 34) {\n rawValue += body.slice(chunkStart, position);\n return new Tok(TokenKind.BLOCK_STRING, start, position + 3, line, col, prev, dedentBlockStringValue(rawValue));\n } // SourceCharacter\n\n\n if (code < 0x0020 && code !== 0x0009 && code !== 0x000a && code !== 0x000d) {\n throw syntaxError(source, position, \"Invalid character within String: \".concat(printCharCode(code), \".\"));\n }\n\n if (code === 10) {\n // new line\n ++position;\n ++lexer.line;\n lexer.lineStart = position;\n } else if (code === 13) {\n // carriage return\n if (body.charCodeAt(position + 1) === 10) {\n position += 2;\n } else {\n ++position;\n }\n\n ++lexer.line;\n lexer.lineStart = position;\n } else if ( // Escape Triple-Quote (\\\"\"\")\n code === 92 && body.charCodeAt(position + 1) === 34 && body.charCodeAt(position + 2) === 34 && body.charCodeAt(position + 3) === 34) {\n rawValue += body.slice(chunkStart, position) + '\"\"\"';\n position += 4;\n chunkStart = position;\n } else {\n ++position;\n }\n }\n\n throw syntaxError(source, position, 'Unterminated string.');\n}\n/**\n * Converts four hexadecimal chars to the integer that the\n * string represents. For example, uniCharCode('0','0','0','f')\n * will return 15, and uniCharCode('0','0','f','f') returns 255.\n *\n * Returns a negative number on error, if a char was invalid.\n *\n * This is implemented by noting that char2hex() returns -1 on error,\n * which means the result of ORing the char2hex() will also be negative.\n */\n\n\nfunction uniCharCode(a, b, c, d) {\n return char2hex(a) << 12 | char2hex(b) << 8 | char2hex(c) << 4 | char2hex(d);\n}\n/**\n * Converts a hex character to its integer value.\n * '0' becomes 0, '9' becomes 9\n * 'A' becomes 10, 'F' becomes 15\n * 'a' becomes 10, 'f' becomes 15\n *\n * Returns -1 on error.\n */\n\n\nfunction char2hex(a) {\n return a >= 48 && a <= 57 ? a - 48 // 0-9\n : a >= 65 && a <= 70 ? a - 55 // A-F\n : a >= 97 && a <= 102 ? a - 87 // a-f\n : -1;\n}\n/**\n * Reads an alphanumeric + underscore name from the source.\n *\n * [_A-Za-z][_0-9A-Za-z]*\n */\n\n\nfunction readName(source, start, line, col, prev) {\n var body = source.body;\n var bodyLength = body.length;\n var position = start + 1;\n var code = 0;\n\n while (position !== bodyLength && !isNaN(code = body.charCodeAt(position)) && (code === 95 || // _\n code >= 48 && code <= 57 || // 0-9\n code >= 65 && code <= 90 || // A-Z\n code >= 97 && code <= 122) // a-z\n ) {\n ++position;\n }\n\n return new Tok(TokenKind.NAME, start, position, line, col, prev, body.slice(start, position));\n}","/**\n * The set of allowed directive location values.\n */\nexport var DirectiveLocation = Object.freeze({\n // Request Definitions\n QUERY: 'QUERY',\n MUTATION: 'MUTATION',\n SUBSCRIPTION: 'SUBSCRIPTION',\n FIELD: 'FIELD',\n FRAGMENT_DEFINITION: 'FRAGMENT_DEFINITION',\n FRAGMENT_SPREAD: 'FRAGMENT_SPREAD',\n INLINE_FRAGMENT: 'INLINE_FRAGMENT',\n VARIABLE_DEFINITION: 'VARIABLE_DEFINITION',\n // Type System Definitions\n SCHEMA: 'SCHEMA',\n SCALAR: 'SCALAR',\n OBJECT: 'OBJECT',\n FIELD_DEFINITION: 'FIELD_DEFINITION',\n ARGUMENT_DEFINITION: 'ARGUMENT_DEFINITION',\n INTERFACE: 'INTERFACE',\n UNION: 'UNION',\n ENUM: 'ENUM',\n ENUM_VALUE: 'ENUM_VALUE',\n INPUT_OBJECT: 'INPUT_OBJECT',\n INPUT_FIELD_DEFINITION: 'INPUT_FIELD_DEFINITION'\n});\n/**\n * The enum type representing the directive location values.\n */","import inspect from '../jsutils/inspect';\nimport devAssert from '../jsutils/devAssert';\nimport defineToJSON from '../jsutils/defineToJSON';\nimport { syntaxError } from '../error/syntaxError';\nimport { Kind } from './kinds';\nimport { Source } from './source';\nimport { createLexer } from './lexer';\nimport { DirectiveLocation } from './directiveLocation';\nimport { TokenKind } from './tokenKind';\n/**\n * Given a GraphQL source, parses it into a Document.\n * Throws GraphQLError if a syntax error is encountered.\n */\n\nexport function parse(source, options) {\n var parser = new Parser(source, options);\n return parser.parseDocument();\n}\n/**\n * Given a string containing a GraphQL value (ex. `[42]`), parse the AST for\n * that value.\n * Throws GraphQLError if a syntax error is encountered.\n *\n * This is useful within tools that operate upon GraphQL Values directly and\n * in isolation of complete GraphQL documents.\n *\n * Consider providing the results to the utility function: valueFromAST().\n */\n\nexport function parseValue(source, options) {\n var parser = new Parser(source, options);\n parser.expectToken(TokenKind.SOF);\n var value = parser.parseValueLiteral(false);\n parser.expectToken(TokenKind.EOF);\n return value;\n}\n/**\n * Given a string containing a GraphQL Type (ex. `[Int!]`), parse the AST for\n * that type.\n * Throws GraphQLError if a syntax error is encountered.\n *\n * This is useful within tools that operate upon GraphQL Types directly and\n * in isolation of complete GraphQL documents.\n *\n * Consider providing the results to the utility function: typeFromAST().\n */\n\nexport function parseType(source, options) {\n var parser = new Parser(source, options);\n parser.expectToken(TokenKind.SOF);\n var type = parser.parseTypeReference();\n parser.expectToken(TokenKind.EOF);\n return type;\n}\n\nvar Parser = /*#__PURE__*/function () {\n function Parser(source, options) {\n var sourceObj = typeof source === 'string' ? new Source(source) : source;\n sourceObj instanceof Source || devAssert(0, \"Must provide Source. Received: \".concat(inspect(sourceObj)));\n this._lexer = createLexer(sourceObj);\n this._options = options || {};\n }\n /**\n * Converts a name lex token into a name parse node.\n */\n\n\n var _proto = Parser.prototype;\n\n _proto.parseName = function parseName() {\n var token = this.expectToken(TokenKind.NAME);\n return {\n kind: Kind.NAME,\n value: token.value,\n loc: this.loc(token)\n };\n } // Implements the parsing rules in the Document section.\n\n /**\n * Document : Definition+\n */\n ;\n\n _proto.parseDocument = function parseDocument() {\n var start = this._lexer.token;\n return {\n kind: Kind.DOCUMENT,\n definitions: this.many(TokenKind.SOF, this.parseDefinition, TokenKind.EOF),\n loc: this.loc(start)\n };\n }\n /**\n * Definition :\n * - ExecutableDefinition\n * - TypeSystemDefinition\n * - TypeSystemExtension\n *\n * ExecutableDefinition :\n * - OperationDefinition\n * - FragmentDefinition\n */\n ;\n\n _proto.parseDefinition = function parseDefinition() {\n if (this.peek(TokenKind.NAME)) {\n switch (this._lexer.token.value) {\n case 'query':\n case 'mutation':\n case 'subscription':\n return this.parseOperationDefinition();\n\n case 'fragment':\n return this.parseFragmentDefinition();\n\n case 'schema':\n case 'scalar':\n case 'type':\n case 'interface':\n case 'union':\n case 'enum':\n case 'input':\n case 'directive':\n return this.parseTypeSystemDefinition();\n\n case 'extend':\n return this.parseTypeSystemExtension();\n }\n } else if (this.peek(TokenKind.BRACE_L)) {\n return this.parseOperationDefinition();\n } else if (this.peekDescription()) {\n return this.parseTypeSystemDefinition();\n }\n\n throw this.unexpected();\n } // Implements the parsing rules in the Operations section.\n\n /**\n * OperationDefinition :\n * - SelectionSet\n * - OperationType Name? VariableDefinitions? Directives? SelectionSet\n */\n ;\n\n _proto.parseOperationDefinition = function parseOperationDefinition() {\n var start = this._lexer.token;\n\n if (this.peek(TokenKind.BRACE_L)) {\n return {\n kind: Kind.OPERATION_DEFINITION,\n operation: 'query',\n name: undefined,\n variableDefinitions: [],\n directives: [],\n selectionSet: this.parseSelectionSet(),\n loc: this.loc(start)\n };\n }\n\n var operation = this.parseOperationType();\n var name;\n\n if (this.peek(TokenKind.NAME)) {\n name = this.parseName();\n }\n\n return {\n kind: Kind.OPERATION_DEFINITION,\n operation: operation,\n name: name,\n variableDefinitions: this.parseVariableDefinitions(),\n directives: this.parseDirectives(false),\n selectionSet: this.parseSelectionSet(),\n loc: this.loc(start)\n };\n }\n /**\n * OperationType : one of query mutation subscription\n */\n ;\n\n _proto.parseOperationType = function parseOperationType() {\n var operationToken = this.expectToken(TokenKind.NAME);\n\n switch (operationToken.value) {\n case 'query':\n return 'query';\n\n case 'mutation':\n return 'mutation';\n\n case 'subscription':\n return 'subscription';\n }\n\n throw this.unexpected(operationToken);\n }\n /**\n * VariableDefinitions : ( VariableDefinition+ )\n */\n ;\n\n _proto.parseVariableDefinitions = function parseVariableDefinitions() {\n return this.optionalMany(TokenKind.PAREN_L, this.parseVariableDefinition, TokenKind.PAREN_R);\n }\n /**\n * VariableDefinition : Variable : Type DefaultValue? Directives[Const]?\n */\n ;\n\n _proto.parseVariableDefinition = function parseVariableDefinition() {\n var start = this._lexer.token;\n return {\n kind: Kind.VARIABLE_DEFINITION,\n variable: this.parseVariable(),\n type: (this.expectToken(TokenKind.COLON), this.parseTypeReference()),\n defaultValue: this.expectOptionalToken(TokenKind.EQUALS) ? this.parseValueLiteral(true) : undefined,\n directives: this.parseDirectives(true),\n loc: this.loc(start)\n };\n }\n /**\n * Variable : $ Name\n */\n ;\n\n _proto.parseVariable = function parseVariable() {\n var start = this._lexer.token;\n this.expectToken(TokenKind.DOLLAR);\n return {\n kind: Kind.VARIABLE,\n name: this.parseName(),\n loc: this.loc(start)\n };\n }\n /**\n * SelectionSet : { Selection+ }\n */\n ;\n\n _proto.parseSelectionSet = function parseSelectionSet() {\n var start = this._lexer.token;\n return {\n kind: Kind.SELECTION_SET,\n selections: this.many(TokenKind.BRACE_L, this.parseSelection, TokenKind.BRACE_R),\n loc: this.loc(start)\n };\n }\n /**\n * Selection :\n * - Field\n * - FragmentSpread\n * - InlineFragment\n */\n ;\n\n _proto.parseSelection = function parseSelection() {\n return this.peek(TokenKind.SPREAD) ? this.parseFragment() : this.parseField();\n }\n /**\n * Field : Alias? Name Arguments? Directives? SelectionSet?\n *\n * Alias : Name :\n */\n ;\n\n _proto.parseField = function parseField() {\n var start = this._lexer.token;\n var nameOrAlias = this.parseName();\n var alias;\n var name;\n\n if (this.expectOptionalToken(TokenKind.COLON)) {\n alias = nameOrAlias;\n name = this.parseName();\n } else {\n name = nameOrAlias;\n }\n\n return {\n kind: Kind.FIELD,\n alias: alias,\n name: name,\n arguments: this.parseArguments(false),\n directives: this.parseDirectives(false),\n selectionSet: this.peek(TokenKind.BRACE_L) ? this.parseSelectionSet() : undefined,\n loc: this.loc(start)\n };\n }\n /**\n * Arguments[Const] : ( Argument[?Const]+ )\n */\n ;\n\n _proto.parseArguments = function parseArguments(isConst) {\n var item = isConst ? this.parseConstArgument : this.parseArgument;\n return this.optionalMany(TokenKind.PAREN_L, item, TokenKind.PAREN_R);\n }\n /**\n * Argument[Const] : Name : Value[?Const]\n */\n ;\n\n _proto.parseArgument = function parseArgument() {\n var start = this._lexer.token;\n var name = this.parseName();\n this.expectToken(TokenKind.COLON);\n return {\n kind: Kind.ARGUMENT,\n name: name,\n value: this.parseValueLiteral(false),\n loc: this.loc(start)\n };\n };\n\n _proto.parseConstArgument = function parseConstArgument() {\n var start = this._lexer.token;\n return {\n kind: Kind.ARGUMENT,\n name: this.parseName(),\n value: (this.expectToken(TokenKind.COLON), this.parseValueLiteral(true)),\n loc: this.loc(start)\n };\n } // Implements the parsing rules in the Fragments section.\n\n /**\n * Corresponds to both FragmentSpread and InlineFragment in the spec.\n *\n * FragmentSpread : ... FragmentName Directives?\n *\n * InlineFragment : ... TypeCondition? Directives? SelectionSet\n */\n ;\n\n _proto.parseFragment = function parseFragment() {\n var start = this._lexer.token;\n this.expectToken(TokenKind.SPREAD);\n var hasTypeCondition = this.expectOptionalKeyword('on');\n\n if (!hasTypeCondition && this.peek(TokenKind.NAME)) {\n return {\n kind: Kind.FRAGMENT_SPREAD,\n name: this.parseFragmentName(),\n directives: this.parseDirectives(false),\n loc: this.loc(start)\n };\n }\n\n return {\n kind: Kind.INLINE_FRAGMENT,\n typeCondition: hasTypeCondition ? this.parseNamedType() : undefined,\n directives: this.parseDirectives(false),\n selectionSet: this.parseSelectionSet(),\n loc: this.loc(start)\n };\n }\n /**\n * FragmentDefinition :\n * - fragment FragmentName on TypeCondition Directives? SelectionSet\n *\n * TypeCondition : NamedType\n */\n ;\n\n _proto.parseFragmentDefinition = function parseFragmentDefinition() {\n var start = this._lexer.token;\n this.expectKeyword('fragment'); // Experimental support for defining variables within fragments changes\n // the grammar of FragmentDefinition:\n // - fragment FragmentName VariableDefinitions? on TypeCondition Directives? SelectionSet\n\n if (this._options.experimentalFragmentVariables) {\n return {\n kind: Kind.FRAGMENT_DEFINITION,\n name: this.parseFragmentName(),\n variableDefinitions: this.parseVariableDefinitions(),\n typeCondition: (this.expectKeyword('on'), this.parseNamedType()),\n directives: this.parseDirectives(false),\n selectionSet: this.parseSelectionSet(),\n loc: this.loc(start)\n };\n }\n\n return {\n kind: Kind.FRAGMENT_DEFINITION,\n name: this.parseFragmentName(),\n typeCondition: (this.expectKeyword('on'), this.parseNamedType()),\n directives: this.parseDirectives(false),\n selectionSet: this.parseSelectionSet(),\n loc: this.loc(start)\n };\n }\n /**\n * FragmentName : Name but not `on`\n */\n ;\n\n _proto.parseFragmentName = function parseFragmentName() {\n if (this._lexer.token.value === 'on') {\n throw this.unexpected();\n }\n\n return this.parseName();\n } // Implements the parsing rules in the Values section.\n\n /**\n * Value[Const] :\n * - [~Const] Variable\n * - IntValue\n * - FloatValue\n * - StringValue\n * - BooleanValue\n * - NullValue\n * - EnumValue\n * - ListValue[?Const]\n * - ObjectValue[?Const]\n *\n * BooleanValue : one of `true` `false`\n *\n * NullValue : `null`\n *\n * EnumValue : Name but not `true`, `false` or `null`\n */\n ;\n\n _proto.parseValueLiteral = function parseValueLiteral(isConst) {\n var token = this._lexer.token;\n\n switch (token.kind) {\n case TokenKind.BRACKET_L:\n return this.parseList(isConst);\n\n case TokenKind.BRACE_L:\n return this.parseObject(isConst);\n\n case TokenKind.INT:\n this._lexer.advance();\n\n return {\n kind: Kind.INT,\n value: token.value,\n loc: this.loc(token)\n };\n\n case TokenKind.FLOAT:\n this._lexer.advance();\n\n return {\n kind: Kind.FLOAT,\n value: token.value,\n loc: this.loc(token)\n };\n\n case TokenKind.STRING:\n case TokenKind.BLOCK_STRING:\n return this.parseStringLiteral();\n\n case TokenKind.NAME:\n if (token.value === 'true' || token.value === 'false') {\n this._lexer.advance();\n\n return {\n kind: Kind.BOOLEAN,\n value: token.value === 'true',\n loc: this.loc(token)\n };\n } else if (token.value === 'null') {\n this._lexer.advance();\n\n return {\n kind: Kind.NULL,\n loc: this.loc(token)\n };\n }\n\n this._lexer.advance();\n\n return {\n kind: Kind.ENUM,\n value: token.value,\n loc: this.loc(token)\n };\n\n case TokenKind.DOLLAR:\n if (!isConst) {\n return this.parseVariable();\n }\n\n break;\n }\n\n throw this.unexpected();\n };\n\n _proto.parseStringLiteral = function parseStringLiteral() {\n var token = this._lexer.token;\n\n this._lexer.advance();\n\n return {\n kind: Kind.STRING,\n value: token.value,\n block: token.kind === TokenKind.BLOCK_STRING,\n loc: this.loc(token)\n };\n }\n /**\n * ListValue[Const] :\n * - [ ]\n * - [ Value[?Const]+ ]\n */\n ;\n\n _proto.parseList = function parseList(isConst) {\n var _this = this;\n\n var start = this._lexer.token;\n\n var item = function item() {\n return _this.parseValueLiteral(isConst);\n };\n\n return {\n kind: Kind.LIST,\n values: this.any(TokenKind.BRACKET_L, item, TokenKind.BRACKET_R),\n loc: this.loc(start)\n };\n }\n /**\n * ObjectValue[Const] :\n * - { }\n * - { ObjectField[?Const]+ }\n */\n ;\n\n _proto.parseObject = function parseObject(isConst) {\n var _this2 = this;\n\n var start = this._lexer.token;\n\n var item = function item() {\n return _this2.parseObjectField(isConst);\n };\n\n return {\n kind: Kind.OBJECT,\n fields: this.any(TokenKind.BRACE_L, item, TokenKind.BRACE_R),\n loc: this.loc(start)\n };\n }\n /**\n * ObjectField[Const] : Name : Value[?Const]\n */\n ;\n\n _proto.parseObjectField = function parseObjectField(isConst) {\n var start = this._lexer.token;\n var name = this.parseName();\n this.expectToken(TokenKind.COLON);\n return {\n kind: Kind.OBJECT_FIELD,\n name: name,\n value: this.parseValueLiteral(isConst),\n loc: this.loc(start)\n };\n } // Implements the parsing rules in the Directives section.\n\n /**\n * Directives[Const] : Directive[?Const]+\n */\n ;\n\n _proto.parseDirectives = function parseDirectives(isConst) {\n var directives = [];\n\n while (this.peek(TokenKind.AT)) {\n directives.push(this.parseDirective(isConst));\n }\n\n return directives;\n }\n /**\n * Directive[Const] : @ Name Arguments[?Const]?\n */\n ;\n\n _proto.parseDirective = function parseDirective(isConst) {\n var start = this._lexer.token;\n this.expectToken(TokenKind.AT);\n return {\n kind: Kind.DIRECTIVE,\n name: this.parseName(),\n arguments: this.parseArguments(isConst),\n loc: this.loc(start)\n };\n } // Implements the parsing rules in the Types section.\n\n /**\n * Type :\n * - NamedType\n * - ListType\n * - NonNullType\n */\n ;\n\n _proto.parseTypeReference = function parseTypeReference() {\n var start = this._lexer.token;\n var type;\n\n if (this.expectOptionalToken(TokenKind.BRACKET_L)) {\n type = this.parseTypeReference();\n this.expectToken(TokenKind.BRACKET_R);\n type = {\n kind: Kind.LIST_TYPE,\n type: type,\n loc: this.loc(start)\n };\n } else {\n type = this.parseNamedType();\n }\n\n if (this.expectOptionalToken(TokenKind.BANG)) {\n return {\n kind: Kind.NON_NULL_TYPE,\n type: type,\n loc: this.loc(start)\n };\n }\n\n return type;\n }\n /**\n * NamedType : Name\n */\n ;\n\n _proto.parseNamedType = function parseNamedType() {\n var start = this._lexer.token;\n return {\n kind: Kind.NAMED_TYPE,\n name: this.parseName(),\n loc: this.loc(start)\n };\n } // Implements the parsing rules in the Type Definition section.\n\n /**\n * TypeSystemDefinition :\n * - SchemaDefinition\n * - TypeDefinition\n * - DirectiveDefinition\n *\n * TypeDefinition :\n * - ScalarTypeDefinition\n * - ObjectTypeDefinition\n * - InterfaceTypeDefinition\n * - UnionTypeDefinition\n * - EnumTypeDefinition\n * - InputObjectTypeDefinition\n */\n ;\n\n _proto.parseTypeSystemDefinition = function parseTypeSystemDefinition() {\n // Many definitions begin with a description and require a lookahead.\n var keywordToken = this.peekDescription() ? this._lexer.lookahead() : this._lexer.token;\n\n if (keywordToken.kind === TokenKind.NAME) {\n switch (keywordToken.value) {\n case 'schema':\n return this.parseSchemaDefinition();\n\n case 'scalar':\n return this.parseScalarTypeDefinition();\n\n case 'type':\n return this.parseObjectTypeDefinition();\n\n case 'interface':\n return this.parseInterfaceTypeDefinition();\n\n case 'union':\n return this.parseUnionTypeDefinition();\n\n case 'enum':\n return this.parseEnumTypeDefinition();\n\n case 'input':\n return this.parseInputObjectTypeDefinition();\n\n case 'directive':\n return this.parseDirectiveDefinition();\n }\n }\n\n throw this.unexpected(keywordToken);\n };\n\n _proto.peekDescription = function peekDescription() {\n return this.peek(TokenKind.STRING) || this.peek(TokenKind.BLOCK_STRING);\n }\n /**\n * Description : StringValue\n */\n ;\n\n _proto.parseDescription = function parseDescription() {\n if (this.peekDescription()) {\n return this.parseStringLiteral();\n }\n }\n /**\n * SchemaDefinition : schema Directives[Const]? { OperationTypeDefinition+ }\n */\n ;\n\n _proto.parseSchemaDefinition = function parseSchemaDefinition() {\n var start = this._lexer.token;\n this.expectKeyword('schema');\n var directives = this.parseDirectives(true);\n var operationTypes = this.many(TokenKind.BRACE_L, this.parseOperationTypeDefinition, TokenKind.BRACE_R);\n return {\n kind: Kind.SCHEMA_DEFINITION,\n directives: directives,\n operationTypes: operationTypes,\n loc: this.loc(start)\n };\n }\n /**\n * OperationTypeDefinition : OperationType : NamedType\n */\n ;\n\n _proto.parseOperationTypeDefinition = function parseOperationTypeDefinition() {\n var start = this._lexer.token;\n var operation = this.parseOperationType();\n this.expectToken(TokenKind.COLON);\n var type = this.parseNamedType();\n return {\n kind: Kind.OPERATION_TYPE_DEFINITION,\n operation: operation,\n type: type,\n loc: this.loc(start)\n };\n }\n /**\n * ScalarTypeDefinition : Description? scalar Name Directives[Const]?\n */\n ;\n\n _proto.parseScalarTypeDefinition = function parseScalarTypeDefinition() {\n var start = this._lexer.token;\n var description = this.parseDescription();\n this.expectKeyword('scalar');\n var name = this.parseName();\n var directives = this.parseDirectives(true);\n return {\n kind: Kind.SCALAR_TYPE_DEFINITION,\n description: description,\n name: name,\n directives: directives,\n loc: this.loc(start)\n };\n }\n /**\n * ObjectTypeDefinition :\n * Description?\n * type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition?\n */\n ;\n\n _proto.parseObjectTypeDefinition = function parseObjectTypeDefinition() {\n var start = this._lexer.token;\n var description = this.parseDescription();\n this.expectKeyword('type');\n var name = this.parseName();\n var interfaces = this.parseImplementsInterfaces();\n var directives = this.parseDirectives(true);\n var fields = this.parseFieldsDefinition();\n return {\n kind: Kind.OBJECT_TYPE_DEFINITION,\n description: description,\n name: name,\n interfaces: interfaces,\n directives: directives,\n fields: fields,\n loc: this.loc(start)\n };\n }\n /**\n * ImplementsInterfaces :\n * - implements `&`? NamedType\n * - ImplementsInterfaces & NamedType\n */\n ;\n\n _proto.parseImplementsInterfaces = function parseImplementsInterfaces() {\n var types = [];\n\n if (this.expectOptionalKeyword('implements')) {\n // Optional leading ampersand\n this.expectOptionalToken(TokenKind.AMP);\n\n do {\n types.push(this.parseNamedType());\n } while (this.expectOptionalToken(TokenKind.AMP) || // Legacy support for the SDL?\n this._options.allowLegacySDLImplementsInterfaces && this.peek(TokenKind.NAME));\n }\n\n return types;\n }\n /**\n * FieldsDefinition : { FieldDefinition+ }\n */\n ;\n\n _proto.parseFieldsDefinition = function parseFieldsDefinition() {\n // Legacy support for the SDL?\n if (this._options.allowLegacySDLEmptyFields && this.peek(TokenKind.BRACE_L) && this._lexer.lookahead().kind === TokenKind.BRACE_R) {\n this._lexer.advance();\n\n this._lexer.advance();\n\n return [];\n }\n\n return this.optionalMany(TokenKind.BRACE_L, this.parseFieldDefinition, TokenKind.BRACE_R);\n }\n /**\n * FieldDefinition :\n * - Description? Name ArgumentsDefinition? : Type Directives[Const]?\n */\n ;\n\n _proto.parseFieldDefinition = function parseFieldDefinition() {\n var start = this._lexer.token;\n var description = this.parseDescription();\n var name = this.parseName();\n var args = this.parseArgumentDefs();\n this.expectToken(TokenKind.COLON);\n var type = this.parseTypeReference();\n var directives = this.parseDirectives(true);\n return {\n kind: Kind.FIELD_DEFINITION,\n description: description,\n name: name,\n arguments: args,\n type: type,\n directives: directives,\n loc: this.loc(start)\n };\n }\n /**\n * ArgumentsDefinition : ( InputValueDefinition+ )\n */\n ;\n\n _proto.parseArgumentDefs = function parseArgumentDefs() {\n return this.optionalMany(TokenKind.PAREN_L, this.parseInputValueDef, TokenKind.PAREN_R);\n }\n /**\n * InputValueDefinition :\n * - Description? Name : Type DefaultValue? Directives[Const]?\n */\n ;\n\n _proto.parseInputValueDef = function parseInputValueDef() {\n var start = this._lexer.token;\n var description = this.parseDescription();\n var name = this.parseName();\n this.expectToken(TokenKind.COLON);\n var type = this.parseTypeReference();\n var defaultValue;\n\n if (this.expectOptionalToken(TokenKind.EQUALS)) {\n defaultValue = this.parseValueLiteral(true);\n }\n\n var directives = this.parseDirectives(true);\n return {\n kind: Kind.INPUT_VALUE_DEFINITION,\n description: description,\n name: name,\n type: type,\n defaultValue: defaultValue,\n directives: directives,\n loc: this.loc(start)\n };\n }\n /**\n * InterfaceTypeDefinition :\n * - Description? interface Name Directives[Const]? FieldsDefinition?\n */\n ;\n\n _proto.parseInterfaceTypeDefinition = function parseInterfaceTypeDefinition() {\n var start = this._lexer.token;\n var description = this.parseDescription();\n this.expectKeyword('interface');\n var name = this.parseName();\n var directives = this.parseDirectives(true);\n var fields = this.parseFieldsDefinition();\n return {\n kind: Kind.INTERFACE_TYPE_DEFINITION,\n description: description,\n name: name,\n directives: directives,\n fields: fields,\n loc: this.loc(start)\n };\n }\n /**\n * UnionTypeDefinition :\n * - Description? union Name Directives[Const]? UnionMemberTypes?\n */\n ;\n\n _proto.parseUnionTypeDefinition = function parseUnionTypeDefinition() {\n var start = this._lexer.token;\n var description = this.parseDescription();\n this.expectKeyword('union');\n var name = this.parseName();\n var directives = this.parseDirectives(true);\n var types = this.parseUnionMemberTypes();\n return {\n kind: Kind.UNION_TYPE_DEFINITION,\n description: description,\n name: name,\n directives: directives,\n types: types,\n loc: this.loc(start)\n };\n }\n /**\n * UnionMemberTypes :\n * - = `|`? NamedType\n * - UnionMemberTypes | NamedType\n */\n ;\n\n _proto.parseUnionMemberTypes = function parseUnionMemberTypes() {\n var types = [];\n\n if (this.expectOptionalToken(TokenKind.EQUALS)) {\n // Optional leading pipe\n this.expectOptionalToken(TokenKind.PIPE);\n\n do {\n types.push(this.parseNamedType());\n } while (this.expectOptionalToken(TokenKind.PIPE));\n }\n\n return types;\n }\n /**\n * EnumTypeDefinition :\n * - Description? enum Name Directives[Const]? EnumValuesDefinition?\n */\n ;\n\n _proto.parseEnumTypeDefinition = function parseEnumTypeDefinition() {\n var start = this._lexer.token;\n var description = this.parseDescription();\n this.expectKeyword('enum');\n var name = this.parseName();\n var directives = this.parseDirectives(true);\n var values = this.parseEnumValuesDefinition();\n return {\n kind: Kind.ENUM_TYPE_DEFINITION,\n description: description,\n name: name,\n directives: directives,\n values: values,\n loc: this.loc(start)\n };\n }\n /**\n * EnumValuesDefinition : { EnumValueDefinition+ }\n */\n ;\n\n _proto.parseEnumValuesDefinition = function parseEnumValuesDefinition() {\n return this.optionalMany(TokenKind.BRACE_L, this.parseEnumValueDefinition, TokenKind.BRACE_R);\n }\n /**\n * EnumValueDefinition : Description? EnumValue Directives[Const]?\n *\n * EnumValue : Name\n */\n ;\n\n _proto.parseEnumValueDefinition = function parseEnumValueDefinition() {\n var start = this._lexer.token;\n var description = this.parseDescription();\n var name = this.parseName();\n var directives = this.parseDirectives(true);\n return {\n kind: Kind.ENUM_VALUE_DEFINITION,\n description: description,\n name: name,\n directives: directives,\n loc: this.loc(start)\n };\n }\n /**\n * InputObjectTypeDefinition :\n * - Description? input Name Directives[Const]? InputFieldsDefinition?\n */\n ;\n\n _proto.parseInputObjectTypeDefinition = function parseInputObjectTypeDefinition() {\n var start = this._lexer.token;\n var description = this.parseDescription();\n this.expectKeyword('input');\n var name = this.parseName();\n var directives = this.parseDirectives(true);\n var fields = this.parseInputFieldsDefinition();\n return {\n kind: Kind.INPUT_OBJECT_TYPE_DEFINITION,\n description: description,\n name: name,\n directives: directives,\n fields: fields,\n loc: this.loc(start)\n };\n }\n /**\n * InputFieldsDefinition : { InputValueDefinition+ }\n */\n ;\n\n _proto.parseInputFieldsDefinition = function parseInputFieldsDefinition() {\n return this.optionalMany(TokenKind.BRACE_L, this.parseInputValueDef, TokenKind.BRACE_R);\n }\n /**\n * TypeSystemExtension :\n * - SchemaExtension\n * - TypeExtension\n *\n * TypeExtension :\n * - ScalarTypeExtension\n * - ObjectTypeExtension\n * - InterfaceTypeExtension\n * - UnionTypeExtension\n * - EnumTypeExtension\n * - InputObjectTypeDefinition\n */\n ;\n\n _proto.parseTypeSystemExtension = function parseTypeSystemExtension() {\n var keywordToken = this._lexer.lookahead();\n\n if (keywordToken.kind === TokenKind.NAME) {\n switch (keywordToken.value) {\n case 'schema':\n return this.parseSchemaExtension();\n\n case 'scalar':\n return this.parseScalarTypeExtension();\n\n case 'type':\n return this.parseObjectTypeExtension();\n\n case 'interface':\n return this.parseInterfaceTypeExtension();\n\n case 'union':\n return this.parseUnionTypeExtension();\n\n case 'enum':\n return this.parseEnumTypeExtension();\n\n case 'input':\n return this.parseInputObjectTypeExtension();\n }\n }\n\n throw this.unexpected(keywordToken);\n }\n /**\n * SchemaExtension :\n * - extend schema Directives[Const]? { OperationTypeDefinition+ }\n * - extend schema Directives[Const]\n */\n ;\n\n _proto.parseSchemaExtension = function parseSchemaExtension() {\n var start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('schema');\n var directives = this.parseDirectives(true);\n var operationTypes = this.optionalMany(TokenKind.BRACE_L, this.parseOperationTypeDefinition, TokenKind.BRACE_R);\n\n if (directives.length === 0 && operationTypes.length === 0) {\n throw this.unexpected();\n }\n\n return {\n kind: Kind.SCHEMA_EXTENSION,\n directives: directives,\n operationTypes: operationTypes,\n loc: this.loc(start)\n };\n }\n /**\n * ScalarTypeExtension :\n * - extend scalar Name Directives[Const]\n */\n ;\n\n _proto.parseScalarTypeExtension = function parseScalarTypeExtension() {\n var start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('scalar');\n var name = this.parseName();\n var directives = this.parseDirectives(true);\n\n if (directives.length === 0) {\n throw this.unexpected();\n }\n\n return {\n kind: Kind.SCALAR_TYPE_EXTENSION,\n name: name,\n directives: directives,\n loc: this.loc(start)\n };\n }\n /**\n * ObjectTypeExtension :\n * - extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition\n * - extend type Name ImplementsInterfaces? Directives[Const]\n * - extend type Name ImplementsInterfaces\n */\n ;\n\n _proto.parseObjectTypeExtension = function parseObjectTypeExtension() {\n var start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('type');\n var name = this.parseName();\n var interfaces = this.parseImplementsInterfaces();\n var directives = this.parseDirectives(true);\n var fields = this.parseFieldsDefinition();\n\n if (interfaces.length === 0 && directives.length === 0 && fields.length === 0) {\n throw this.unexpected();\n }\n\n return {\n kind: Kind.OBJECT_TYPE_EXTENSION,\n name: name,\n interfaces: interfaces,\n directives: directives,\n fields: fields,\n loc: this.loc(start)\n };\n }\n /**\n * InterfaceTypeExtension :\n * - extend interface Name Directives[Const]? FieldsDefinition\n * - extend interface Name Directives[Const]\n */\n ;\n\n _proto.parseInterfaceTypeExtension = function parseInterfaceTypeExtension() {\n var start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('interface');\n var name = this.parseName();\n var directives = this.parseDirectives(true);\n var fields = this.parseFieldsDefinition();\n\n if (directives.length === 0 && fields.length === 0) {\n throw this.unexpected();\n }\n\n return {\n kind: Kind.INTERFACE_TYPE_EXTENSION,\n name: name,\n directives: directives,\n fields: fields,\n loc: this.loc(start)\n };\n }\n /**\n * UnionTypeExtension :\n * - extend union Name Directives[Const]? UnionMemberTypes\n * - extend union Name Directives[Const]\n */\n ;\n\n _proto.parseUnionTypeExtension = function parseUnionTypeExtension() {\n var start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('union');\n var name = this.parseName();\n var directives = this.parseDirectives(true);\n var types = this.parseUnionMemberTypes();\n\n if (directives.length === 0 && types.length === 0) {\n throw this.unexpected();\n }\n\n return {\n kind: Kind.UNION_TYPE_EXTENSION,\n name: name,\n directives: directives,\n types: types,\n loc: this.loc(start)\n };\n }\n /**\n * EnumTypeExtension :\n * - extend enum Name Directives[Const]? EnumValuesDefinition\n * - extend enum Name Directives[Const]\n */\n ;\n\n _proto.parseEnumTypeExtension = function parseEnumTypeExtension() {\n var start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('enum');\n var name = this.parseName();\n var directives = this.parseDirectives(true);\n var values = this.parseEnumValuesDefinition();\n\n if (directives.length === 0 && values.length === 0) {\n throw this.unexpected();\n }\n\n return {\n kind: Kind.ENUM_TYPE_EXTENSION,\n name: name,\n directives: directives,\n values: values,\n loc: this.loc(start)\n };\n }\n /**\n * InputObjectTypeExtension :\n * - extend input Name Directives[Const]? InputFieldsDefinition\n * - extend input Name Directives[Const]\n */\n ;\n\n _proto.parseInputObjectTypeExtension = function parseInputObjectTypeExtension() {\n var start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('input');\n var name = this.parseName();\n var directives = this.parseDirectives(true);\n var fields = this.parseInputFieldsDefinition();\n\n if (directives.length === 0 && fields.length === 0) {\n throw this.unexpected();\n }\n\n return {\n kind: Kind.INPUT_OBJECT_TYPE_EXTENSION,\n name: name,\n directives: directives,\n fields: fields,\n loc: this.loc(start)\n };\n }\n /**\n * DirectiveDefinition :\n * - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations\n */\n ;\n\n _proto.parseDirectiveDefinition = function parseDirectiveDefinition() {\n var start = this._lexer.token;\n var description = this.parseDescription();\n this.expectKeyword('directive');\n this.expectToken(TokenKind.AT);\n var name = this.parseName();\n var args = this.parseArgumentDefs();\n var repeatable = this.expectOptionalKeyword('repeatable');\n this.expectKeyword('on');\n var locations = this.parseDirectiveLocations();\n return {\n kind: Kind.DIRECTIVE_DEFINITION,\n description: description,\n name: name,\n arguments: args,\n repeatable: repeatable,\n locations: locations,\n loc: this.loc(start)\n };\n }\n /**\n * DirectiveLocations :\n * - `|`? DirectiveLocation\n * - DirectiveLocations | DirectiveLocation\n */\n ;\n\n _proto.parseDirectiveLocations = function parseDirectiveLocations() {\n // Optional leading pipe\n this.expectOptionalToken(TokenKind.PIPE);\n var locations = [];\n\n do {\n locations.push(this.parseDirectiveLocation());\n } while (this.expectOptionalToken(TokenKind.PIPE));\n\n return locations;\n }\n /*\n * DirectiveLocation :\n * - ExecutableDirectiveLocation\n * - TypeSystemDirectiveLocation\n *\n * ExecutableDirectiveLocation : one of\n * `QUERY`\n * `MUTATION`\n * `SUBSCRIPTION`\n * `FIELD`\n * `FRAGMENT_DEFINITION`\n * `FRAGMENT_SPREAD`\n * `INLINE_FRAGMENT`\n *\n * TypeSystemDirectiveLocation : one of\n * `SCHEMA`\n * `SCALAR`\n * `OBJECT`\n * `FIELD_DEFINITION`\n * `ARGUMENT_DEFINITION`\n * `INTERFACE`\n * `UNION`\n * `ENUM`\n * `ENUM_VALUE`\n * `INPUT_OBJECT`\n * `INPUT_FIELD_DEFINITION`\n */\n ;\n\n _proto.parseDirectiveLocation = function parseDirectiveLocation() {\n var start = this._lexer.token;\n var name = this.parseName();\n\n if (DirectiveLocation[name.value] !== undefined) {\n return name;\n }\n\n throw this.unexpected(start);\n } // Core parsing utility functions\n\n /**\n * Returns a location object, used to identify the place in\n * the source that created a given parsed object.\n */\n ;\n\n _proto.loc = function loc(startToken) {\n if (!this._options.noLocation) {\n return new Loc(startToken, this._lexer.lastToken, this._lexer.source);\n }\n }\n /**\n * Determines if the next token is of a given kind\n */\n ;\n\n _proto.peek = function peek(kind) {\n return this._lexer.token.kind === kind;\n }\n /**\n * If the next token is of the given kind, return that token after advancing\n * the lexer. Otherwise, do not change the parser state and throw an error.\n */\n ;\n\n _proto.expectToken = function expectToken(kind) {\n var token = this._lexer.token;\n\n if (token.kind === kind) {\n this._lexer.advance();\n\n return token;\n }\n\n throw syntaxError(this._lexer.source, token.start, \"Expected \".concat(kind, \", found \").concat(getTokenDesc(token)));\n }\n /**\n * If the next token is of the given kind, return that token after advancing\n * the lexer. Otherwise, do not change the parser state and return undefined.\n */\n ;\n\n _proto.expectOptionalToken = function expectOptionalToken(kind) {\n var token = this._lexer.token;\n\n if (token.kind === kind) {\n this._lexer.advance();\n\n return token;\n }\n\n return undefined;\n }\n /**\n * If the next token is a given keyword, advance the lexer.\n * Otherwise, do not change the parser state and throw an error.\n */\n ;\n\n _proto.expectKeyword = function expectKeyword(value) {\n var token = this._lexer.token;\n\n if (token.kind === TokenKind.NAME && token.value === value) {\n this._lexer.advance();\n } else {\n throw syntaxError(this._lexer.source, token.start, \"Expected \\\"\".concat(value, \"\\\", found \").concat(getTokenDesc(token)));\n }\n }\n /**\n * If the next token is a given keyword, return \"true\" after advancing\n * the lexer. Otherwise, do not change the parser state and return \"false\".\n */\n ;\n\n _proto.expectOptionalKeyword = function expectOptionalKeyword(value) {\n var token = this._lexer.token;\n\n if (token.kind === TokenKind.NAME && token.value === value) {\n this._lexer.advance();\n\n return true;\n }\n\n return false;\n }\n /**\n * Helper function for creating an error when an unexpected lexed token\n * is encountered.\n */\n ;\n\n _proto.unexpected = function unexpected(atToken) {\n var token = atToken || this._lexer.token;\n return syntaxError(this._lexer.source, token.start, \"Unexpected \".concat(getTokenDesc(token)));\n }\n /**\n * Returns a possibly empty list of parse nodes, determined by\n * the parseFn. This list begins with a lex token of openKind\n * and ends with a lex token of closeKind. Advances the parser\n * to the next lex token after the closing token.\n */\n ;\n\n _proto.any = function any(openKind, parseFn, closeKind) {\n this.expectToken(openKind);\n var nodes = [];\n\n while (!this.expectOptionalToken(closeKind)) {\n nodes.push(parseFn.call(this));\n }\n\n return nodes;\n }\n /**\n * Returns a list of parse nodes, determined by the parseFn.\n * It can be empty only if open token is missing otherwise it will always\n * return non-empty list that begins with a lex token of openKind and ends\n * with a lex token of closeKind. Advances the parser to the next lex token\n * after the closing token.\n */\n ;\n\n _proto.optionalMany = function optionalMany(openKind, parseFn, closeKind) {\n if (this.expectOptionalToken(openKind)) {\n var nodes = [];\n\n do {\n nodes.push(parseFn.call(this));\n } while (!this.expectOptionalToken(closeKind));\n\n return nodes;\n }\n\n return [];\n }\n /**\n * Returns a non-empty list of parse nodes, determined by\n * the parseFn. This list begins with a lex token of openKind\n * and ends with a lex token of closeKind. Advances the parser\n * to the next lex token after the closing token.\n */\n ;\n\n _proto.many = function many(openKind, parseFn, closeKind) {\n this.expectToken(openKind);\n var nodes = [];\n\n do {\n nodes.push(parseFn.call(this));\n } while (!this.expectOptionalToken(closeKind));\n\n return nodes;\n };\n\n return Parser;\n}();\n\nfunction Loc(startToken, endToken, source) {\n this.start = startToken.start;\n this.end = endToken.end;\n this.startToken = startToken;\n this.endToken = endToken;\n this.source = source;\n} // Print a simplified form when appearing in JSON/util.inspect.\n\n\ndefineToJSON(Loc, function () {\n return {\n start: this.start,\n end: this.end\n };\n});\n/**\n * A helper function to describe a token as a string for debugging\n */\n\nfunction getTokenDesc(token) {\n var value = token.value;\n return value ? \"\".concat(token.kind, \" \\\"\").concat(value, \"\\\"\") : token.kind;\n}","import inspect from '../jsutils/inspect';\nexport var QueryDocumentKeys = {\n Name: [],\n Document: ['definitions'],\n OperationDefinition: ['name', 'variableDefinitions', 'directives', 'selectionSet'],\n VariableDefinition: ['variable', 'type', 'defaultValue', 'directives'],\n Variable: ['name'],\n SelectionSet: ['selections'],\n Field: ['alias', 'name', 'arguments', 'directives', 'selectionSet'],\n Argument: ['name', 'value'],\n FragmentSpread: ['name', 'directives'],\n InlineFragment: ['typeCondition', 'directives', 'selectionSet'],\n FragmentDefinition: ['name', // Note: fragment variable definitions are experimental and may be changed\n // or removed in the future.\n 'variableDefinitions', 'typeCondition', 'directives', 'selectionSet'],\n IntValue: [],\n FloatValue: [],\n StringValue: [],\n BooleanValue: [],\n NullValue: [],\n EnumValue: [],\n ListValue: ['values'],\n ObjectValue: ['fields'],\n ObjectField: ['name', 'value'],\n Directive: ['name', 'arguments'],\n NamedType: ['name'],\n ListType: ['type'],\n NonNullType: ['type'],\n SchemaDefinition: ['directives', 'operationTypes'],\n OperationTypeDefinition: ['type'],\n ScalarTypeDefinition: ['description', 'name', 'directives'],\n ObjectTypeDefinition: ['description', 'name', 'interfaces', 'directives', 'fields'],\n FieldDefinition: ['description', 'name', 'arguments', 'type', 'directives'],\n InputValueDefinition: ['description', 'name', 'type', 'defaultValue', 'directives'],\n InterfaceTypeDefinition: ['description', 'name', 'directives', 'fields'],\n UnionTypeDefinition: ['description', 'name', 'directives', 'types'],\n EnumTypeDefinition: ['description', 'name', 'directives', 'values'],\n EnumValueDefinition: ['description', 'name', 'directives'],\n InputObjectTypeDefinition: ['description', 'name', 'directives', 'fields'],\n DirectiveDefinition: ['description', 'name', 'arguments', 'locations'],\n SchemaExtension: ['directives', 'operationTypes'],\n ScalarTypeExtension: ['name', 'directives'],\n ObjectTypeExtension: ['name', 'interfaces', 'directives', 'fields'],\n InterfaceTypeExtension: ['name', 'directives', 'fields'],\n UnionTypeExtension: ['name', 'directives', 'types'],\n EnumTypeExtension: ['name', 'directives', 'values'],\n InputObjectTypeExtension: ['name', 'directives', 'fields']\n};\nexport var BREAK = Object.freeze({});\n/**\n * visit() will walk through an AST using a depth first traversal, calling\n * the visitor's enter function at each node in the traversal, and calling the\n * leave function after visiting that node and all of its child nodes.\n *\n * By returning different values from the enter and leave functions, the\n * behavior of the visitor can be altered, including skipping over a sub-tree of\n * the AST (by returning false), editing the AST by returning a value or null\n * to remove the value, or to stop the whole traversal by returning BREAK.\n *\n * When using visit() to edit an AST, the original AST will not be modified, and\n * a new version of the AST with the changes applied will be returned from the\n * visit function.\n *\n * const editedAST = visit(ast, {\n * enter(node, key, parent, path, ancestors) {\n * // @return\n * // undefined: no action\n * // false: skip visiting this node\n * // visitor.BREAK: stop visiting altogether\n * // null: delete this node\n * // any value: replace this node with the returned value\n * },\n * leave(node, key, parent, path, ancestors) {\n * // @return\n * // undefined: no action\n * // false: no action\n * // visitor.BREAK: stop visiting altogether\n * // null: delete this node\n * // any value: replace this node with the returned value\n * }\n * });\n *\n * Alternatively to providing enter() and leave() functions, a visitor can\n * instead provide functions named the same as the kinds of AST nodes, or\n * enter/leave visitors at a named key, leading to four permutations of\n * visitor API:\n *\n * 1) Named visitors triggered when entering a node a specific kind.\n *\n * visit(ast, {\n * Kind(node) {\n * // enter the \"Kind\" node\n * }\n * })\n *\n * 2) Named visitors that trigger upon entering and leaving a node of\n * a specific kind.\n *\n * visit(ast, {\n * Kind: {\n * enter(node) {\n * // enter the \"Kind\" node\n * }\n * leave(node) {\n * // leave the \"Kind\" node\n * }\n * }\n * })\n *\n * 3) Generic visitors that trigger upon entering and leaving any node.\n *\n * visit(ast, {\n * enter(node) {\n * // enter any node\n * },\n * leave(node) {\n * // leave any node\n * }\n * })\n *\n * 4) Parallel visitors for entering and leaving nodes of a specific kind.\n *\n * visit(ast, {\n * enter: {\n * Kind(node) {\n * // enter the \"Kind\" node\n * }\n * },\n * leave: {\n * Kind(node) {\n * // leave the \"Kind\" node\n * }\n * }\n * })\n */\n\nexport function visit(root, visitor) {\n var visitorKeys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : QueryDocumentKeys;\n /* eslint-disable no-undef-init */\n\n var stack = undefined;\n var inArray = Array.isArray(root);\n var keys = [root];\n var index = -1;\n var edits = [];\n var node = undefined;\n var key = undefined;\n var parent = undefined;\n var path = [];\n var ancestors = [];\n var newRoot = root;\n /* eslint-enable no-undef-init */\n\n do {\n index++;\n var isLeaving = index === keys.length;\n var isEdited = isLeaving && edits.length !== 0;\n\n if (isLeaving) {\n key = ancestors.length === 0 ? undefined : path[path.length - 1];\n node = parent;\n parent = ancestors.pop();\n\n if (isEdited) {\n if (inArray) {\n node = node.slice();\n } else {\n var clone = {};\n\n for (var _i2 = 0, _Object$keys2 = Object.keys(node); _i2 < _Object$keys2.length; _i2++) {\n var k = _Object$keys2[_i2];\n clone[k] = node[k];\n }\n\n node = clone;\n }\n\n var editOffset = 0;\n\n for (var ii = 0; ii < edits.length; ii++) {\n var editKey = edits[ii][0];\n var editValue = edits[ii][1];\n\n if (inArray) {\n editKey -= editOffset;\n }\n\n if (inArray && editValue === null) {\n node.splice(editKey, 1);\n editOffset++;\n } else {\n node[editKey] = editValue;\n }\n }\n }\n\n index = stack.index;\n keys = stack.keys;\n edits = stack.edits;\n inArray = stack.inArray;\n stack = stack.prev;\n } else {\n key = parent ? inArray ? index : keys[index] : undefined;\n node = parent ? parent[key] : newRoot;\n\n if (node === null || node === undefined) {\n continue;\n }\n\n if (parent) {\n path.push(key);\n }\n }\n\n var result = void 0;\n\n if (!Array.isArray(node)) {\n if (!isNode(node)) {\n throw new Error('Invalid AST Node: ' + inspect(node));\n }\n\n var visitFn = getVisitFn(visitor, node.kind, isLeaving);\n\n if (visitFn) {\n result = visitFn.call(visitor, node, key, parent, path, ancestors);\n\n if (result === BREAK) {\n break;\n }\n\n if (result === false) {\n if (!isLeaving) {\n path.pop();\n continue;\n }\n } else if (result !== undefined) {\n edits.push([key, result]);\n\n if (!isLeaving) {\n if (isNode(result)) {\n node = result;\n } else {\n path.pop();\n continue;\n }\n }\n }\n }\n }\n\n if (result === undefined && isEdited) {\n edits.push([key, node]);\n }\n\n if (isLeaving) {\n path.pop();\n } else {\n stack = {\n inArray: inArray,\n index: index,\n keys: keys,\n edits: edits,\n prev: stack\n };\n inArray = Array.isArray(node);\n keys = inArray ? node : visitorKeys[node.kind] || [];\n index = -1;\n edits = [];\n\n if (parent) {\n ancestors.push(parent);\n }\n\n parent = node;\n }\n } while (stack !== undefined);\n\n if (edits.length !== 0) {\n newRoot = edits[edits.length - 1][1];\n }\n\n return newRoot;\n}\n\nfunction isNode(maybeNode) {\n return Boolean(maybeNode && typeof maybeNode.kind === 'string');\n}\n/**\n * Creates a new visitor instance which delegates to many visitors to run in\n * parallel. Each visitor will be visited for each node before moving on.\n *\n * If a prior visitor edits a node, no following visitors will see that node.\n */\n\n\nexport function visitInParallel(visitors) {\n var skipping = new Array(visitors.length);\n return {\n enter: function enter(node) {\n for (var i = 0; i < visitors.length; i++) {\n if (!skipping[i]) {\n var fn = getVisitFn(visitors[i], node.kind,\n /* isLeaving */\n false);\n\n if (fn) {\n var result = fn.apply(visitors[i], arguments);\n\n if (result === false) {\n skipping[i] = node;\n } else if (result === BREAK) {\n skipping[i] = BREAK;\n } else if (result !== undefined) {\n return result;\n }\n }\n }\n }\n },\n leave: function leave(node) {\n for (var i = 0; i < visitors.length; i++) {\n if (!skipping[i]) {\n var fn = getVisitFn(visitors[i], node.kind,\n /* isLeaving */\n true);\n\n if (fn) {\n var result = fn.apply(visitors[i], arguments);\n\n if (result === BREAK) {\n skipping[i] = BREAK;\n } else if (result !== undefined && result !== false) {\n return result;\n }\n }\n } else if (skipping[i] === node) {\n skipping[i] = null;\n }\n }\n }\n };\n}\n/**\n * Creates a new visitor instance which maintains a provided TypeInfo instance\n * along with visiting visitor.\n */\n\nexport function visitWithTypeInfo(typeInfo, visitor) {\n return {\n enter: function enter(node) {\n typeInfo.enter(node);\n var fn = getVisitFn(visitor, node.kind,\n /* isLeaving */\n false);\n\n if (fn) {\n var result = fn.apply(visitor, arguments);\n\n if (result !== undefined) {\n typeInfo.leave(node);\n\n if (isNode(result)) {\n typeInfo.enter(result);\n }\n }\n\n return result;\n }\n },\n leave: function leave(node) {\n var fn = getVisitFn(visitor, node.kind,\n /* isLeaving */\n true);\n var result;\n\n if (fn) {\n result = fn.apply(visitor, arguments);\n }\n\n typeInfo.leave(node);\n return result;\n }\n };\n}\n/**\n * Given a visitor instance, if it is leaving or not, and a node kind, return\n * the function the visitor runtime should call.\n */\n\nexport function getVisitFn(visitor, kind, isLeaving) {\n var kindVisitor = visitor[kind];\n\n if (kindVisitor) {\n if (!isLeaving && typeof kindVisitor === 'function') {\n // { Kind() {} }\n return kindVisitor;\n }\n\n var kindSpecificVisitor = isLeaving ? kindVisitor.leave : kindVisitor.enter;\n\n if (typeof kindSpecificVisitor === 'function') {\n // { Kind: { enter() {}, leave() {} } }\n return kindSpecificVisitor;\n }\n } else {\n var specificVisitor = isLeaving ? visitor.leave : visitor.enter;\n\n if (specificVisitor) {\n if (typeof specificVisitor === 'function') {\n // { enter() {}, leave() {} }\n return specificVisitor;\n }\n\n var specificKindVisitor = specificVisitor[kind];\n\n if (typeof specificKindVisitor === 'function') {\n // { enter: { Kind() {} }, leave: { Kind() {} } }\n return specificKindVisitor;\n }\n }\n }\n}","import { visit } from './visitor';\nimport { printBlockString } from './blockString';\n/**\n * Converts an AST into a string, using one set of reasonable\n * formatting rules.\n */\n\nexport function print(ast) {\n return visit(ast, {\n leave: printDocASTReducer\n });\n} // TODO: provide better type coverage in future\n\nvar printDocASTReducer = {\n Name: function Name(node) {\n return node.value;\n },\n Variable: function Variable(node) {\n return '$' + node.name;\n },\n // Document\n Document: function Document(node) {\n return join(node.definitions, '\\n\\n') + '\\n';\n },\n OperationDefinition: function OperationDefinition(node) {\n var op = node.operation;\n var name = node.name;\n var varDefs = wrap('(', join(node.variableDefinitions, ', '), ')');\n var directives = join(node.directives, ' ');\n var selectionSet = node.selectionSet; // Anonymous queries with no directives or variable definitions can use\n // the query short form.\n\n return !name && !directives && !varDefs && op === 'query' ? selectionSet : join([op, join([name, varDefs]), directives, selectionSet], ' ');\n },\n VariableDefinition: function VariableDefinition(_ref) {\n var variable = _ref.variable,\n type = _ref.type,\n defaultValue = _ref.defaultValue,\n directives = _ref.directives;\n return variable + ': ' + type + wrap(' = ', defaultValue) + wrap(' ', join(directives, ' '));\n },\n SelectionSet: function SelectionSet(_ref2) {\n var selections = _ref2.selections;\n return block(selections);\n },\n Field: function Field(_ref3) {\n var alias = _ref3.alias,\n name = _ref3.name,\n args = _ref3.arguments,\n directives = _ref3.directives,\n selectionSet = _ref3.selectionSet;\n return join([wrap('', alias, ': ') + name + wrap('(', join(args, ', '), ')'), join(directives, ' '), selectionSet], ' ');\n },\n Argument: function Argument(_ref4) {\n var name = _ref4.name,\n value = _ref4.value;\n return name + ': ' + value;\n },\n // Fragments\n FragmentSpread: function FragmentSpread(_ref5) {\n var name = _ref5.name,\n directives = _ref5.directives;\n return '...' + name + wrap(' ', join(directives, ' '));\n },\n InlineFragment: function InlineFragment(_ref6) {\n var typeCondition = _ref6.typeCondition,\n directives = _ref6.directives,\n selectionSet = _ref6.selectionSet;\n return join(['...', wrap('on ', typeCondition), join(directives, ' '), selectionSet], ' ');\n },\n FragmentDefinition: function FragmentDefinition(_ref7) {\n var name = _ref7.name,\n typeCondition = _ref7.typeCondition,\n variableDefinitions = _ref7.variableDefinitions,\n directives = _ref7.directives,\n selectionSet = _ref7.selectionSet;\n return (// Note: fragment variable definitions are experimental and may be changed\n // or removed in the future.\n \"fragment \".concat(name).concat(wrap('(', join(variableDefinitions, ', '), ')'), \" \") + \"on \".concat(typeCondition, \" \").concat(wrap('', join(directives, ' '), ' ')) + selectionSet\n );\n },\n // Value\n IntValue: function IntValue(_ref8) {\n var value = _ref8.value;\n return value;\n },\n FloatValue: function FloatValue(_ref9) {\n var value = _ref9.value;\n return value;\n },\n StringValue: function StringValue(_ref10, key) {\n var value = _ref10.value,\n isBlockString = _ref10.block;\n return isBlockString ? printBlockString(value, key === 'description' ? '' : ' ') : JSON.stringify(value);\n },\n BooleanValue: function BooleanValue(_ref11) {\n var value = _ref11.value;\n return value ? 'true' : 'false';\n },\n NullValue: function NullValue() {\n return 'null';\n },\n EnumValue: function EnumValue(_ref12) {\n var value = _ref12.value;\n return value;\n },\n ListValue: function ListValue(_ref13) {\n var values = _ref13.values;\n return '[' + join(values, ', ') + ']';\n },\n ObjectValue: function ObjectValue(_ref14) {\n var fields = _ref14.fields;\n return '{' + join(fields, ', ') + '}';\n },\n ObjectField: function ObjectField(_ref15) {\n var name = _ref15.name,\n value = _ref15.value;\n return name + ': ' + value;\n },\n // Directive\n Directive: function Directive(_ref16) {\n var name = _ref16.name,\n args = _ref16.arguments;\n return '@' + name + wrap('(', join(args, ', '), ')');\n },\n // Type\n NamedType: function NamedType(_ref17) {\n var name = _ref17.name;\n return name;\n },\n ListType: function ListType(_ref18) {\n var type = _ref18.type;\n return '[' + type + ']';\n },\n NonNullType: function NonNullType(_ref19) {\n var type = _ref19.type;\n return type + '!';\n },\n // Type System Definitions\n SchemaDefinition: function SchemaDefinition(_ref20) {\n var directives = _ref20.directives,\n operationTypes = _ref20.operationTypes;\n return join(['schema', join(directives, ' '), block(operationTypes)], ' ');\n },\n OperationTypeDefinition: function OperationTypeDefinition(_ref21) {\n var operation = _ref21.operation,\n type = _ref21.type;\n return operation + ': ' + type;\n },\n ScalarTypeDefinition: addDescription(function (_ref22) {\n var name = _ref22.name,\n directives = _ref22.directives;\n return join(['scalar', name, join(directives, ' ')], ' ');\n }),\n ObjectTypeDefinition: addDescription(function (_ref23) {\n var name = _ref23.name,\n interfaces = _ref23.interfaces,\n directives = _ref23.directives,\n fields = _ref23.fields;\n return join(['type', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' ');\n }),\n FieldDefinition: addDescription(function (_ref24) {\n var name = _ref24.name,\n args = _ref24.arguments,\n type = _ref24.type,\n directives = _ref24.directives;\n return name + (hasMultilineItems(args) ? wrap('(\\n', indent(join(args, '\\n')), '\\n)') : wrap('(', join(args, ', '), ')')) + ': ' + type + wrap(' ', join(directives, ' '));\n }),\n InputValueDefinition: addDescription(function (_ref25) {\n var name = _ref25.name,\n type = _ref25.type,\n defaultValue = _ref25.defaultValue,\n directives = _ref25.directives;\n return join([name + ': ' + type, wrap('= ', defaultValue), join(directives, ' ')], ' ');\n }),\n InterfaceTypeDefinition: addDescription(function (_ref26) {\n var name = _ref26.name,\n directives = _ref26.directives,\n fields = _ref26.fields;\n return join(['interface', name, join(directives, ' '), block(fields)], ' ');\n }),\n UnionTypeDefinition: addDescription(function (_ref27) {\n var name = _ref27.name,\n directives = _ref27.directives,\n types = _ref27.types;\n return join(['union', name, join(directives, ' '), types && types.length !== 0 ? '= ' + join(types, ' | ') : ''], ' ');\n }),\n EnumTypeDefinition: addDescription(function (_ref28) {\n var name = _ref28.name,\n directives = _ref28.directives,\n values = _ref28.values;\n return join(['enum', name, join(directives, ' '), block(values)], ' ');\n }),\n EnumValueDefinition: addDescription(function (_ref29) {\n var name = _ref29.name,\n directives = _ref29.directives;\n return join([name, join(directives, ' ')], ' ');\n }),\n InputObjectTypeDefinition: addDescription(function (_ref30) {\n var name = _ref30.name,\n directives = _ref30.directives,\n fields = _ref30.fields;\n return join(['input', name, join(directives, ' '), block(fields)], ' ');\n }),\n DirectiveDefinition: addDescription(function (_ref31) {\n var name = _ref31.name,\n args = _ref31.arguments,\n repeatable = _ref31.repeatable,\n locations = _ref31.locations;\n return 'directive @' + name + (hasMultilineItems(args) ? wrap('(\\n', indent(join(args, '\\n')), '\\n)') : wrap('(', join(args, ', '), ')')) + (repeatable ? ' repeatable' : '') + ' on ' + join(locations, ' | ');\n }),\n SchemaExtension: function SchemaExtension(_ref32) {\n var directives = _ref32.directives,\n operationTypes = _ref32.operationTypes;\n return join(['extend schema', join(directives, ' '), block(operationTypes)], ' ');\n },\n ScalarTypeExtension: function ScalarTypeExtension(_ref33) {\n var name = _ref33.name,\n directives = _ref33.directives;\n return join(['extend scalar', name, join(directives, ' ')], ' ');\n },\n ObjectTypeExtension: function ObjectTypeExtension(_ref34) {\n var name = _ref34.name,\n interfaces = _ref34.interfaces,\n directives = _ref34.directives,\n fields = _ref34.fields;\n return join(['extend type', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' ');\n },\n InterfaceTypeExtension: function InterfaceTypeExtension(_ref35) {\n var name = _ref35.name,\n directives = _ref35.directives,\n fields = _ref35.fields;\n return join(['extend interface', name, join(directives, ' '), block(fields)], ' ');\n },\n UnionTypeExtension: function UnionTypeExtension(_ref36) {\n var name = _ref36.name,\n directives = _ref36.directives,\n types = _ref36.types;\n return join(['extend union', name, join(directives, ' '), types && types.length !== 0 ? '= ' + join(types, ' | ') : ''], ' ');\n },\n EnumTypeExtension: function EnumTypeExtension(_ref37) {\n var name = _ref37.name,\n directives = _ref37.directives,\n values = _ref37.values;\n return join(['extend enum', name, join(directives, ' '), block(values)], ' ');\n },\n InputObjectTypeExtension: function InputObjectTypeExtension(_ref38) {\n var name = _ref38.name,\n directives = _ref38.directives,\n fields = _ref38.fields;\n return join(['extend input', name, join(directives, ' '), block(fields)], ' ');\n }\n};\n\nfunction addDescription(cb) {\n return function (node) {\n return join([node.description, cb(node)], '\\n');\n };\n}\n/**\n * Given maybeArray, print an empty string if it is null or empty, otherwise\n * print all items together separated by separator if provided\n */\n\n\nfunction join(maybeArray, separator) {\n return maybeArray ? maybeArray.filter(function (x) {\n return x;\n }).join(separator || '') : '';\n}\n/**\n * Given array, print each item on its own line, wrapped in an\n * indented \"{ }\" block.\n */\n\n\nfunction block(array) {\n return array && array.length !== 0 ? '{\\n' + indent(join(array, '\\n')) + '\\n}' : '';\n}\n/**\n * If maybeString is not null or empty, then wrap with start and end, otherwise\n * print an empty string.\n */\n\n\nfunction wrap(start, maybeString, end) {\n return maybeString ? start + maybeString + (end || '') : '';\n}\n\nfunction indent(maybeString) {\n return maybeString && ' ' + maybeString.replace(/\\n/g, '\\n ');\n}\n\nfunction isMultiline(string) {\n return string.indexOf('\\n') !== -1;\n}\n\nfunction hasMultilineItems(maybeArray) {\n return maybeArray && maybeArray.some(isMultiline);\n}","var __extends = this && this.__extends || function () {\n var _extendStatics = function extendStatics(d, b) {\n _extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) {\n if (b.hasOwnProperty(p)) d[p] = b[p];\n }\n };\n\n return _extendStatics(d, b);\n };\n\n return function (d, b) {\n _extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n}();\n\nvar __assign = this && this.__assign || function () {\n __assign = Object.assign || function (t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n }\n\n return t;\n };\n\n return __assign.apply(this, arguments);\n};\n\nvar __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function (resolve) {\n resolve(value);\n });\n }\n\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n\n function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\n\nvar __generator = this && this.__generator || function (thisArg, body) {\n var _ = {\n label: 0,\n sent: function sent() {\n if (t[0] & 1) throw t[1];\n return t[1];\n },\n trys: [],\n ops: []\n },\n f,\n y,\n t,\n g;\n return g = {\n next: verb(0),\n \"throw\": verb(1),\n \"return\": verb(2)\n }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function () {\n return this;\n }), g;\n\n function verb(n) {\n return function (v) {\n return step([n, v]);\n };\n }\n\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n\n while (_) {\n try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n\n case 4:\n _.label++;\n return {\n value: op[1],\n done: false\n };\n\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n\n case 7:\n op = _.ops.pop();\n\n _.trys.pop();\n\n continue;\n\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n\n if (t && _.label < t[2]) {\n _.label = t[2];\n\n _.ops.push(op);\n\n break;\n }\n\n if (t[2]) _.ops.pop();\n\n _.trys.pop();\n\n continue;\n }\n\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\n }\n }\n\n if (op[0] & 5) throw op[1];\n return {\n value: op[0] ? op[1] : void 0,\n done: true\n };\n }\n};\n\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n }\n\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\n/*\n * Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\n\n\nimport * as Paho from 'paho-mqtt';\nimport { v4 as uuid } from 'uuid';\nimport Observable from 'zen-observable-ts';\nimport { AbstractPubSubProvider } from './PubSubProvider';\nimport { ConsoleLogger as Logger } from '@aws-amplify/core';\nvar logger = new Logger('MqttOverWSProvider');\nexport function mqttTopicMatch(filter, topic) {\n var filterArray = filter.split('/');\n var length = filterArray.length;\n var topicArray = topic.split('/');\n\n for (var i = 0; i < length; ++i) {\n var left = filterArray[i];\n var right = topicArray[i];\n if (left === '#') return topicArray.length >= length;\n if (left !== '+' && left !== right) return false;\n }\n\n return length === topicArray.length;\n}\n\nvar ClientsQueue =\n/** @class */\nfunction () {\n function ClientsQueue() {\n this.promises = new Map();\n }\n\n ClientsQueue.prototype.get = function (clientId, clientFactory) {\n return __awaiter(this, void 0, void 0, function () {\n var promise;\n return __generator(this, function (_a) {\n promise = this.promises.get(clientId);\n\n if (promise) {\n return [2\n /*return*/\n , promise];\n }\n\n promise = clientFactory(clientId);\n this.promises.set(clientId, promise);\n return [2\n /*return*/\n , promise];\n });\n });\n };\n\n Object.defineProperty(ClientsQueue.prototype, \"allClients\", {\n get: function get() {\n return Array.from(this.promises.keys());\n },\n enumerable: true,\n configurable: true\n });\n\n ClientsQueue.prototype.remove = function (clientId) {\n this.promises.delete(clientId);\n };\n\n return ClientsQueue;\n}();\n\nvar topicSymbol = typeof Symbol !== 'undefined' ? Symbol('topic') : '@@topic';\n\nvar MqttOverWSProvider =\n/** @class */\nfunction (_super) {\n __extends(MqttOverWSProvider, _super);\n\n function MqttOverWSProvider(options) {\n if (options === void 0) {\n options = {};\n }\n\n var _this = _super.call(this, __assign(__assign({}, options), {\n clientId: options.clientId || uuid()\n })) || this;\n\n _this._clientsQueue = new ClientsQueue();\n _this._topicObservers = new Map();\n _this._clientIdObservers = new Map();\n return _this;\n }\n\n Object.defineProperty(MqttOverWSProvider.prototype, \"clientId\", {\n get: function get() {\n return this.options.clientId;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MqttOverWSProvider.prototype, \"endpoint\", {\n get: function get() {\n return this.options.aws_pubsub_endpoint;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MqttOverWSProvider.prototype, \"clientsQueue\", {\n get: function get() {\n return this._clientsQueue;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(MqttOverWSProvider.prototype, \"isSSLEnabled\", {\n get: function get() {\n return !this.options.aws_appsync_dangerously_connect_to_http_endpoint_for_testing;\n },\n enumerable: true,\n configurable: true\n });\n\n MqttOverWSProvider.prototype.getTopicForValue = function (value) {\n return typeof value === 'object' && value[topicSymbol];\n };\n\n MqttOverWSProvider.prototype.getProviderName = function () {\n return 'MqttOverWSProvider';\n };\n\n MqttOverWSProvider.prototype.onDisconnect = function (_a) {\n var _this = this;\n\n var clientId = _a.clientId,\n errorCode = _a.errorCode,\n args = __rest(_a, [\"clientId\", \"errorCode\"]);\n\n if (errorCode !== 0) {\n logger.warn(clientId, JSON.stringify(__assign({\n errorCode: errorCode\n }, args), null, 2));\n var topicsToDelete_1 = [];\n\n var clientIdObservers = this._clientIdObservers.get(clientId);\n\n if (!clientIdObservers) {\n return;\n }\n\n clientIdObservers.forEach(function (observer) {\n observer.error('Disconnected, error code: ' + errorCode); // removing observers for disconnected clientId\n\n _this._topicObservers.forEach(function (observerForTopic, observerTopic) {\n observerForTopic.delete(observer);\n\n if (observerForTopic.size === 0) {\n topicsToDelete_1.push(observerTopic);\n }\n });\n }); // forgiving any trace of clientId\n\n this._clientIdObservers.delete(clientId); // Removing topics that are not listen by an observer\n\n\n topicsToDelete_1.forEach(function (topic) {\n _this._topicObservers.delete(topic);\n });\n }\n };\n\n MqttOverWSProvider.prototype.newClient = function (_a) {\n var url = _a.url,\n clientId = _a.clientId;\n return __awaiter(this, void 0, void 0, function () {\n var client;\n\n var _this = this;\n\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n logger.debug('Creating new MQTT client', clientId);\n client = new Paho.Client(url, clientId); // client.trace = (args) => logger.debug(clientId, JSON.stringify(args, null, 2));\n\n client.onMessageArrived = function (_a) {\n var topic = _a.destinationName,\n msg = _a.payloadString;\n\n _this._onMessage(topic, msg);\n };\n\n client.onConnectionLost = function (_a) {\n var errorCode = _a.errorCode,\n args = __rest(_a, [\"errorCode\"]);\n\n _this.onDisconnect(__assign({\n clientId: clientId,\n errorCode: errorCode\n }, args));\n };\n\n return [4\n /*yield*/\n , new Promise(function (resolve, reject) {\n client.connect({\n useSSL: _this.isSSLEnabled,\n mqttVersion: 3,\n onSuccess: function onSuccess() {\n return resolve(client);\n },\n onFailure: reject\n });\n })];\n\n case 1:\n _b.sent();\n\n return [2\n /*return*/\n , client];\n }\n });\n });\n };\n\n MqttOverWSProvider.prototype.connect = function (clientId, options) {\n if (options === void 0) {\n options = {};\n }\n\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [4\n /*yield*/\n , this.clientsQueue.get(clientId, function (clientId) {\n return _this.newClient(__assign(__assign({}, options), {\n clientId: clientId\n }));\n })];\n\n case 1:\n return [2\n /*return*/\n , _a.sent()];\n }\n });\n });\n };\n\n MqttOverWSProvider.prototype.disconnect = function (clientId) {\n return __awaiter(this, void 0, void 0, function () {\n var client;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [4\n /*yield*/\n , this.clientsQueue.get(clientId, function () {\n return null;\n })];\n\n case 1:\n client = _a.sent();\n\n if (client && client.isConnected()) {\n client.disconnect();\n }\n\n this.clientsQueue.remove(clientId);\n return [2\n /*return*/\n ];\n }\n });\n });\n };\n\n MqttOverWSProvider.prototype.publish = function (topics, msg) {\n return __awaiter(this, void 0, void 0, function () {\n var targetTopics, message, url, client;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n targetTopics = [].concat(topics);\n message = JSON.stringify(msg);\n return [4\n /*yield*/\n , this.endpoint];\n\n case 1:\n url = _a.sent();\n return [4\n /*yield*/\n , this.connect(this.clientId, {\n url: url\n })];\n\n case 2:\n client = _a.sent();\n logger.debug('Publishing to topic(s)', targetTopics.join(','), message);\n targetTopics.forEach(function (topic) {\n return client.send(topic, message);\n });\n return [2\n /*return*/\n ];\n }\n });\n });\n };\n\n MqttOverWSProvider.prototype._onMessage = function (topic, msg) {\n try {\n var matchedTopicObservers_1 = [];\n\n this._topicObservers.forEach(function (observerForTopic, observerTopic) {\n if (mqttTopicMatch(observerTopic, topic)) {\n matchedTopicObservers_1.push(observerForTopic);\n }\n });\n\n var parsedMessage_1 = JSON.parse(msg);\n\n if (typeof parsedMessage_1 === 'object') {\n parsedMessage_1[topicSymbol] = topic;\n }\n\n matchedTopicObservers_1.forEach(function (observersForTopic) {\n observersForTopic.forEach(function (observer) {\n return observer.next(parsedMessage_1);\n });\n });\n } catch (error) {\n logger.warn('Error handling message', error, msg);\n }\n };\n\n MqttOverWSProvider.prototype.subscribe = function (topics, options) {\n var _this = this;\n\n if (options === void 0) {\n options = {};\n }\n\n var targetTopics = [].concat(topics);\n logger.debug('Subscribing to topic(s)', targetTopics.join(','));\n return new Observable(function (observer) {\n targetTopics.forEach(function (topic) {\n // this._topicObservers is used to notify the observers according to the topic received on the message\n var observersForTopic = _this._topicObservers.get(topic);\n\n if (!observersForTopic) {\n observersForTopic = new Set();\n\n _this._topicObservers.set(topic, observersForTopic);\n }\n\n observersForTopic.add(observer);\n }); // @ts-ignore\n\n var client;\n var _a = options.clientId,\n clientId = _a === void 0 ? _this.clientId : _a; // this._clientIdObservers is used to close observers when client gets disconnected\n\n var observersForClientId = _this._clientIdObservers.get(clientId);\n\n if (!observersForClientId) {\n observersForClientId = new Set();\n }\n\n observersForClientId.add(observer);\n\n _this._clientIdObservers.set(clientId, observersForClientId);\n\n (function () {\n return __awaiter(_this, void 0, void 0, function () {\n var _a, url, _b, e_1;\n\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n _a = options.url;\n if (!(_a === void 0)) return [3\n /*break*/\n , 2];\n return [4\n /*yield*/\n , this.endpoint];\n\n case 1:\n _b = _c.sent();\n return [3\n /*break*/\n , 3];\n\n case 2:\n _b = _a;\n _c.label = 3;\n\n case 3:\n url = _b;\n _c.label = 4;\n\n case 4:\n _c.trys.push([4, 6,, 7]);\n\n return [4\n /*yield*/\n , this.connect(clientId, {\n url: url\n })];\n\n case 5:\n client = _c.sent();\n targetTopics.forEach(function (topic) {\n client.subscribe(topic);\n });\n return [3\n /*break*/\n , 7];\n\n case 6:\n e_1 = _c.sent();\n observer.error(e_1);\n return [3\n /*break*/\n , 7];\n\n case 7:\n return [2\n /*return*/\n ];\n }\n });\n });\n })();\n\n return function () {\n logger.debug('Unsubscribing from topic(s)', targetTopics.join(','));\n\n if (client) {\n _this._clientIdObservers.get(clientId).delete(observer); // No more observers per client => client not needed anymore\n\n\n if (_this._clientIdObservers.get(clientId).size === 0) {\n _this.disconnect(clientId);\n\n _this._clientIdObservers.delete(clientId);\n }\n\n targetTopics.forEach(function (topic) {\n var observersForTopic = _this._topicObservers.get(topic) || new Set();\n observersForTopic.delete(observer); // if no observers exists for the topic, topic should be removed\n\n if (observersForTopic.size === 0) {\n _this._topicObservers.delete(topic);\n\n if (client.isConnected()) {\n client.unsubscribe(topic);\n }\n }\n });\n }\n\n return null;\n };\n });\n };\n\n return MqttOverWSProvider;\n}(AbstractPubSubProvider);\n\nexport { MqttOverWSProvider };","/*\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nimport { Amplify } from './Amplify';\nimport { Platform } from './Platform';\nexport { AmplifyClass } from './Amplify';\nexport { ClientDevice } from './ClientDevice';\nexport { ConsoleLogger, ConsoleLogger as Logger } from './Logger';\nexport * from './Errors';\nexport { Hub } from './Hub';\nexport { I18n } from './I18n';\nexport * from './JS';\nexport { Signer } from './Signer';\nexport * from './Parser';\nexport * from './Providers';\nexport { FacebookOAuth, GoogleOAuth } from './OAuthHelper';\nexport * from './RNComponents';\nexport { Credentials, CredentialsClass } from './Credentials';\nexport { ServiceWorker } from './ServiceWorker';\nexport { StorageHelper, MemoryStorage } from './StorageHelper';\nexport { UniversalStorage } from './UniversalStorage';\nexport { Platform, getAmplifyUserAgent } from './Platform';\nexport * from './constants';\nexport var Constants = {\n userAgent: Platform.userAgent\n};\nexport * from './constants';\nexport * from './Util';\nexport { Amplify };\n/**\n * @deprecated use named import\n */\n\nexport default Amplify;","/*\n * Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\n\n/**\n * This Symbol is used to reference an internal-only PubSub provider that\n * is used for AppSync/GraphQL subscriptions in the API category.\n */\nvar hasSymbol = typeof Symbol !== 'undefined' && typeof Symbol.for === 'function';\nexport var INTERNAL_AWS_APPSYNC_PUBSUB_PROVIDER = hasSymbol ? Symbol.for('INTERNAL_AWS_APPSYNC_PUBSUB_PROVIDER') : '@@INTERNAL_AWS_APPSYNC_PUBSUB_PROVIDER';\nexport var INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER = hasSymbol ? Symbol.for('INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER') : '@@INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER';\nexport var USER_AGENT_HEADER = 'x-amz-user-agent';","import zenObservable from 'zen-observable';\nvar Observable = zenObservable;\nexport default Observable;\nexport { Observable };","var __assign = this && this.__assign || function () {\n __assign = Object.assign || function (t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n }\n\n return t;\n };\n\n return __assign.apply(this, arguments);\n};\n\nimport { ConsoleLogger as Logger } from '@aws-amplify/core';\nvar logger = new Logger('AbstractPubSubProvider');\n\nvar AbstractPubSubProvider =\n/** @class */\nfunction () {\n function AbstractPubSubProvider(options) {\n if (options === void 0) {\n options = {};\n }\n\n this._config = options;\n }\n\n AbstractPubSubProvider.prototype.configure = function (config) {\n if (config === void 0) {\n config = {};\n }\n\n this._config = __assign(__assign({}, config), this._config);\n logger.debug(\"configure \" + this.getProviderName(), this._config);\n return this.options;\n };\n\n AbstractPubSubProvider.prototype.getCategory = function () {\n return 'PubSub';\n };\n\n Object.defineProperty(AbstractPubSubProvider.prototype, \"options\", {\n get: function get() {\n return __assign({}, this._config);\n },\n enumerable: true,\n configurable: true\n });\n return AbstractPubSubProvider;\n}();\n\nexport { AbstractPubSubProvider };","var __extends = this && this.__extends || function () {\n var _extendStatics = function extendStatics(d, b) {\n _extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) {\n if (b.hasOwnProperty(p)) d[p] = b[p];\n }\n };\n\n return _extendStatics(d, b);\n };\n\n return function (d, b) {\n _extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n}();\n\nvar __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function (resolve) {\n resolve(value);\n });\n }\n\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n\n function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\n\nvar __generator = this && this.__generator || function (thisArg, body) {\n var _ = {\n label: 0,\n sent: function sent() {\n if (t[0] & 1) throw t[1];\n return t[1];\n },\n trys: [],\n ops: []\n },\n f,\n y,\n t,\n g;\n return g = {\n next: verb(0),\n \"throw\": verb(1),\n \"return\": verb(2)\n }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function () {\n return this;\n }), g;\n\n function verb(n) {\n return function (v) {\n return step([n, v]);\n };\n }\n\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n\n while (_) {\n try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n\n case 4:\n _.label++;\n return {\n value: op[1],\n done: false\n };\n\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n\n case 7:\n op = _.ops.pop();\n\n _.trys.pop();\n\n continue;\n\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n\n if (t && _.label < t[2]) {\n _.label = t[2];\n\n _.ops.push(op);\n\n break;\n }\n\n if (t[2]) _.ops.pop();\n\n _.trys.pop();\n\n continue;\n }\n\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\n }\n }\n\n if (op[0] & 5) throw op[1];\n return {\n value: op[0] ? op[1] : void 0,\n done: true\n };\n }\n};\n\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n }\n\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\n\nvar __read = this && this.__read || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o),\n r,\n ar = [],\n e;\n\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {\n ar.push(r.value);\n }\n } catch (error) {\n e = {\n error: error\n };\n } finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n\n return ar;\n};\n\nvar __spread = this && this.__spread || function () {\n for (var ar = [], i = 0; i < arguments.length; i++) {\n ar = ar.concat(__read(arguments[i]));\n }\n\n return ar;\n};\n\nimport Observable from 'zen-observable-ts';\nimport { ConsoleLogger as Logger } from '@aws-amplify/core';\nimport { MqttOverWSProvider } from './MqttOverWSProvider';\nvar logger = new Logger('AWSAppSyncProvider');\n\nvar AWSAppSyncProvider =\n/** @class */\nfunction (_super) {\n __extends(AWSAppSyncProvider, _super);\n\n function AWSAppSyncProvider() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this._topicClient = new Map();\n _this._topicAlias = new Map();\n return _this;\n }\n\n Object.defineProperty(AWSAppSyncProvider.prototype, \"endpoint\", {\n get: function get() {\n throw new Error('Not supported');\n },\n enumerable: true,\n configurable: true\n });\n\n AWSAppSyncProvider.prototype.getProviderName = function () {\n return 'AWSAppSyncProvider';\n };\n\n AWSAppSyncProvider.prototype.publish = function (topics, msg, options) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n throw new Error('Operation not supported');\n });\n });\n };\n\n AWSAppSyncProvider.prototype._cleanUp = function (clientId) {\n var _this = this;\n\n var topicsForClient = Array.from(this._topicClient.entries()).filter(function (_a) {\n var _b = __read(_a, 2),\n c = _b[1];\n\n return c.clientId === clientId;\n }).map(function (_a) {\n var _b = __read(_a, 1),\n t = _b[0];\n\n return t;\n });\n topicsForClient.forEach(function (t) {\n return _this._cleanUpForTopic(t);\n });\n };\n\n AWSAppSyncProvider.prototype._cleanUpForTopic = function (topic) {\n this._topicClient.delete(topic);\n\n this._topicAlias.delete(topic);\n };\n\n AWSAppSyncProvider.prototype.onDisconnect = function (_a) {\n var _this = this;\n\n var clientId = _a.clientId,\n errorCode = _a.errorCode,\n args = __rest(_a, [\"clientId\", \"errorCode\"]);\n\n if (errorCode !== 0) {\n var topicsForClient = Array.from(this._topicClient.entries()).filter(function (_a) {\n var _b = __read(_a, 2),\n c = _b[1];\n\n return c.clientId === clientId;\n }).map(function (_a) {\n var _b = __read(_a, 1),\n t = _b[0];\n\n return t;\n });\n topicsForClient.forEach(function (topic) {\n if (_this._topicObservers.has(topic)) {\n _this._topicObservers.get(topic).forEach(function (obs) {\n if (!obs.closed) {\n obs.error(args);\n }\n });\n\n _this._topicObservers.delete(topic);\n }\n });\n\n this._cleanUp(clientId);\n }\n };\n\n AWSAppSyncProvider.prototype.disconnect = function (clientId) {\n return __awaiter(this, void 0, void 0, function () {\n var client;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [4\n /*yield*/\n , this.clientsQueue.get(clientId, function () {\n return null;\n })];\n\n case 1:\n client = _a.sent();\n return [4\n /*yield*/\n , _super.prototype.disconnect.call(this, clientId)];\n\n case 2:\n _a.sent();\n\n this._cleanUp(clientId);\n\n return [2\n /*return*/\n ];\n }\n });\n });\n };\n\n AWSAppSyncProvider.prototype.subscribe = function (topics, options) {\n var _this = this;\n\n if (options === void 0) {\n options = {};\n }\n\n var result = new Observable(function (observer) {\n var targetTopics = [].concat(topics);\n logger.debug('Subscribing to topic(s)', targetTopics.join(','));\n\n (function () {\n return __awaiter(_this, void 0, void 0, function () {\n var _a, mqttConnections, newSubscriptions, newAliases, map;\n\n var _this = this;\n\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n // Add these topics to map\n targetTopics.forEach(function (t) {\n if (!_this._topicObservers.has(t)) {\n _this._topicObservers.set(t, new Set());\n }\n\n _this._topicObservers.get(t).add(observer);\n });\n _a = options.mqttConnections, mqttConnections = _a === void 0 ? [] : _a, newSubscriptions = options.newSubscriptions;\n newAliases = Object.entries(newSubscriptions).map(function (_a) {\n var _b = __read(_a, 2),\n alias = _b[0],\n v = _b[1];\n\n return [v.topic, alias];\n }); // Merge new aliases with old ones\n\n this._topicAlias = new Map(__spread(Array.from(this._topicAlias.entries()), newAliases));\n map = Object.entries(targetTopics.reduce(function (acc, elem) {\n var connectionInfoForTopic = mqttConnections.find(function (c) {\n return c.topics.indexOf(elem) > -1;\n });\n\n if (connectionInfoForTopic) {\n var clientId = connectionInfoForTopic.client,\n url = connectionInfoForTopic.url;\n\n if (!acc[clientId]) {\n acc[clientId] = {\n url: url,\n topics: new Set()\n };\n }\n\n acc[clientId].topics.add(elem);\n }\n\n return acc;\n }, {})); // reconnect everything we have in the map\n\n return [4\n /*yield*/\n , Promise.all(map.map(function (_a) {\n var _b = __read(_a, 2),\n clientId = _b[0],\n _c = _b[1],\n url = _c.url,\n topics = _c.topics;\n\n return __awaiter(_this, void 0, void 0, function () {\n var client, err_1;\n\n var _this = this;\n\n return __generator(this, function (_d) {\n switch (_d.label) {\n case 0:\n client = null;\n _d.label = 1;\n\n case 1:\n _d.trys.push([1, 3,, 4]);\n\n return [4\n /*yield*/\n , this.connect(clientId, {\n clientId: clientId,\n url: url\n })];\n\n case 2:\n client = _d.sent();\n return [3\n /*break*/\n , 4];\n\n case 3:\n err_1 = _d.sent();\n observer.error({\n message: 'Failed to connect',\n error: err_1\n });\n observer.complete();\n return [2\n /*return*/\n , undefined];\n\n case 4:\n // subscribe to all topics for this client\n // store topic-client mapping\n topics.forEach(function (topic) {\n if (client.isConnected()) {\n client.subscribe(topic);\n\n _this._topicClient.set(topic, client);\n }\n });\n return [2\n /*return*/\n , client];\n }\n });\n });\n }))];\n\n case 1:\n // reconnect everything we have in the map\n _b.sent();\n\n return [2\n /*return*/\n ];\n }\n });\n });\n })();\n\n return function () {\n logger.debug('Unsubscribing from topic(s)', targetTopics.join(','));\n targetTopics.forEach(function (t) {\n var client = _this._topicClient.get(t);\n\n if (client && client.isConnected()) {\n client.unsubscribe(t);\n\n _this._topicClient.delete(t);\n\n if (!Array.from(_this._topicClient.values()).some(function (c) {\n return c === client;\n })) {\n _this.disconnect(client.clientId);\n }\n }\n\n _this._topicObservers.delete(t);\n });\n };\n });\n return Observable.from(result).map(function (value) {\n var topic = _this.getTopicForValue(value);\n\n var alias = _this._topicAlias.get(topic);\n\n value.data = Object.entries(value.data).reduce(function (obj, _a) {\n var _b = __read(_a, 2),\n origKey = _b[0],\n val = _b[1];\n\n return obj[alias || origKey] = val, obj;\n }, {});\n return value;\n });\n };\n\n return AWSAppSyncProvider;\n}(MqttOverWSProvider);\n\nexport { AWSAppSyncProvider };","/**\n * Copyright (c) 2015-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * strict\n */\n\n/**\n * Represents a location in a Source.\n */\n\n/**\n * Takes a Source and a UTF-8 character offset, and returns the corresponding\n * line and column as a SourceLocation.\n */\nexport function getLocation(source, position) {\n var lineRegexp = /\\r\\n|[\\n\\r]/g;\n var line = 1;\n var column = position + 1;\n var match;\n\n while ((match = lineRegexp.exec(source.body)) && match.index < position) {\n line += 1;\n column = position + 1 - (match.index + match[0].length);\n }\n\n return {\n line: line,\n column: column\n };\n}","/**\n * Copyright (c) 2015-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * strict\n */\nimport { getLocation } from '../language/location';\n/**\n * Prints a GraphQLError to a string, representing useful location information\n * about the error's position in the source.\n */\n\nexport function printError(error) {\n var printedLocations = [];\n\n if (error.nodes) {\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = error.nodes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var node = _step.value;\n\n if (node.loc) {\n printedLocations.push(highlightSourceAtLocation(node.loc.source, getLocation(node.loc.source, node.loc.start)));\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n } else if (error.source && error.locations) {\n var source = error.source;\n var _iteratorNormalCompletion2 = true;\n var _didIteratorError2 = false;\n var _iteratorError2 = undefined;\n\n try {\n for (var _iterator2 = error.locations[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n var location = _step2.value;\n printedLocations.push(highlightSourceAtLocation(source, location));\n }\n } catch (err) {\n _didIteratorError2 = true;\n _iteratorError2 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion2 && _iterator2.return != null) {\n _iterator2.return();\n }\n } finally {\n if (_didIteratorError2) {\n throw _iteratorError2;\n }\n }\n }\n }\n\n return printedLocations.length === 0 ? error.message : [error.message].concat(printedLocations).join('\\n\\n') + '\\n';\n}\n/**\n * Render a helpful description of the location of the error in the GraphQL\n * Source document.\n */\n\nfunction highlightSourceAtLocation(source, location) {\n var firstLineColumnOffset = source.locationOffset.column - 1;\n var body = whitespace(firstLineColumnOffset) + source.body;\n var lineIndex = location.line - 1;\n var lineOffset = source.locationOffset.line - 1;\n var lineNum = location.line + lineOffset;\n var columnOffset = location.line === 1 ? firstLineColumnOffset : 0;\n var columnNum = location.column + columnOffset;\n var lines = body.split(/\\r\\n|[\\n\\r]/g);\n return \"\".concat(source.name, \" (\").concat(lineNum, \":\").concat(columnNum, \")\\n\") + printPrefixedLines([// Lines specified like this: [\"prefix\", \"string\"],\n [\"\".concat(lineNum - 1, \": \"), lines[lineIndex - 1]], [\"\".concat(lineNum, \": \"), lines[lineIndex]], ['', whitespace(columnNum - 1) + '^'], [\"\".concat(lineNum + 1, \": \"), lines[lineIndex + 1]]]);\n}\n\nfunction printPrefixedLines(lines) {\n var existingLines = lines.filter(function (_ref) {\n var _ = _ref[0],\n line = _ref[1];\n return line !== undefined;\n });\n var padLen = 0;\n var _iteratorNormalCompletion3 = true;\n var _didIteratorError3 = false;\n var _iteratorError3 = undefined;\n\n try {\n for (var _iterator3 = existingLines[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {\n var _ref4 = _step3.value;\n var prefix = _ref4[0];\n padLen = Math.max(padLen, prefix.length);\n }\n } catch (err) {\n _didIteratorError3 = true;\n _iteratorError3 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion3 && _iterator3.return != null) {\n _iterator3.return();\n }\n } finally {\n if (_didIteratorError3) {\n throw _iteratorError3;\n }\n }\n }\n\n return existingLines.map(function (_ref3) {\n var prefix = _ref3[0],\n line = _ref3[1];\n return lpad(padLen, prefix) + line;\n }).join('\\n');\n}\n\nfunction whitespace(len) {\n return Array(len + 1).join(' ');\n}\n\nfunction lpad(len, str) {\n return whitespace(len - str.length) + str;\n}","/**\n * Copyright (c) 2015-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * strict\n */\nimport { printError } from './printError';\nimport { getLocation } from '../language/location';\nexport function GraphQLError( // eslint-disable-line no-redeclare\nmessage, nodes, source, positions, path, originalError, extensions) {\n // Compute list of blame nodes.\n var _nodes = Array.isArray(nodes) ? nodes.length !== 0 ? nodes : undefined : nodes ? [nodes] : undefined; // Compute locations in the source for the given nodes/positions.\n\n\n var _source = source;\n\n if (!_source && _nodes) {\n var node = _nodes[0];\n _source = node && node.loc && node.loc.source;\n }\n\n var _positions = positions;\n\n if (!_positions && _nodes) {\n _positions = _nodes.reduce(function (list, node) {\n if (node.loc) {\n list.push(node.loc.start);\n }\n\n return list;\n }, []);\n }\n\n if (_positions && _positions.length === 0) {\n _positions = undefined;\n }\n\n var _locations;\n\n if (positions && source) {\n _locations = positions.map(function (pos) {\n return getLocation(source, pos);\n });\n } else if (_nodes) {\n _locations = _nodes.reduce(function (list, node) {\n if (node.loc) {\n list.push(getLocation(node.loc.source, node.loc.start));\n }\n\n return list;\n }, []);\n }\n\n var _extensions = extensions || originalError && originalError.extensions;\n\n Object.defineProperties(this, {\n message: {\n value: message,\n // By being enumerable, JSON.stringify will include `message` in the\n // resulting output. This ensures that the simplest possible GraphQL\n // service adheres to the spec.\n enumerable: true,\n writable: true\n },\n locations: {\n // Coercing falsey values to undefined ensures they will not be included\n // in JSON.stringify() when not provided.\n value: _locations || undefined,\n // By being enumerable, JSON.stringify will include `locations` in the\n // resulting output. This ensures that the simplest possible GraphQL\n // service adheres to the spec.\n enumerable: Boolean(_locations)\n },\n path: {\n // Coercing falsey values to undefined ensures they will not be included\n // in JSON.stringify() when not provided.\n value: path || undefined,\n // By being enumerable, JSON.stringify will include `path` in the\n // resulting output. This ensures that the simplest possible GraphQL\n // service adheres to the spec.\n enumerable: Boolean(path)\n },\n nodes: {\n value: _nodes || undefined\n },\n source: {\n value: _source || undefined\n },\n positions: {\n value: _positions || undefined\n },\n originalError: {\n value: originalError\n },\n extensions: {\n // Coercing falsey values to undefined ensures they will not be included\n // in JSON.stringify() when not provided.\n value: _extensions || undefined,\n // By being enumerable, JSON.stringify will include `path` in the\n // resulting output. This ensures that the simplest possible GraphQL\n // service adheres to the spec.\n enumerable: Boolean(_extensions)\n }\n }); // Include (non-enumerable) stack trace.\n\n if (originalError && originalError.stack) {\n Object.defineProperty(this, 'stack', {\n value: originalError.stack,\n writable: true,\n configurable: true\n });\n } else if (Error.captureStackTrace) {\n Error.captureStackTrace(this, GraphQLError);\n } else {\n Object.defineProperty(this, 'stack', {\n value: Error().stack,\n writable: true,\n configurable: true\n });\n }\n}\nGraphQLError.prototype = Object.create(Error.prototype, {\n constructor: {\n value: GraphQLError\n },\n name: {\n value: 'GraphQLError'\n },\n toString: {\n value: function toString() {\n return printError(this);\n }\n }\n});","var __extends = this && this.__extends || function () {\n var _extendStatics = function extendStatics(d, b) {\n _extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) {\n if (b.hasOwnProperty(p)) d[p] = b[p];\n }\n };\n\n return _extendStatics(d, b);\n };\n\n return function (d, b) {\n _extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n}();\n\nvar __assign = this && this.__assign || function () {\n __assign = Object.assign || function (t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n }\n\n return t;\n };\n\n return __assign.apply(this, arguments);\n};\n\nvar __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function (resolve) {\n resolve(value);\n });\n }\n\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n\n function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\n\nvar __generator = this && this.__generator || function (thisArg, body) {\n var _ = {\n label: 0,\n sent: function sent() {\n if (t[0] & 1) throw t[1];\n return t[1];\n },\n trys: [],\n ops: []\n },\n f,\n y,\n t,\n g;\n return g = {\n next: verb(0),\n \"throw\": verb(1),\n \"return\": verb(2)\n }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function () {\n return this;\n }), g;\n\n function verb(n) {\n return function (v) {\n return step([n, v]);\n };\n }\n\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n\n while (_) {\n try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n\n case 4:\n _.label++;\n return {\n value: op[1],\n done: false\n };\n\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n\n case 7:\n op = _.ops.pop();\n\n _.trys.pop();\n\n continue;\n\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n\n if (t && _.label < t[2]) {\n _.label = t[2];\n\n _.ops.push(op);\n\n break;\n }\n\n if (t[2]) _.ops.pop();\n\n _.trys.pop();\n\n continue;\n }\n\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\n }\n }\n\n if (op[0] & 5) throw op[1];\n return {\n value: op[0] ? op[1] : void 0,\n done: true\n };\n }\n};\n\nvar __read = this && this.__read || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o),\n r,\n ar = [],\n e;\n\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {\n ar.push(r.value);\n }\n } catch (error) {\n e = {\n error: error\n };\n } finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n\n return ar;\n};\n/*\n * Copyright 2017-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\n\n\nimport Observable from 'zen-observable-ts';\nimport { GraphQLError } from 'graphql';\nimport * as url from 'url';\nimport { v4 as uuid } from 'uuid';\nimport { Buffer } from 'buffer';\nimport { Logger, Credentials, Signer, Hub, Constants, USER_AGENT_HEADER, jitteredExponentialRetry, NonRetryableError } from '@aws-amplify/core';\nimport Cache from '@aws-amplify/cache';\nimport Auth from '@aws-amplify/auth';\nimport { AbstractPubSubProvider } from './PubSubProvider';\nimport { CONTROL_MSG } from '../index';\nvar logger = new Logger('AWSAppSyncRealTimeProvider');\nvar AMPLIFY_SYMBOL = typeof Symbol !== 'undefined' && typeof Symbol.for === 'function' ? Symbol.for('amplify_default') : '@@amplify_default';\n\nvar dispatchApiEvent = function dispatchApiEvent(event, data, message) {\n Hub.dispatch('api', {\n event: event,\n data: data,\n message: message\n }, 'PubSub', AMPLIFY_SYMBOL);\n};\n\nvar MAX_DELAY_MS = 5000;\nvar NON_RETRYABLE_CODES = [400, 401, 403];\nvar MESSAGE_TYPES;\n\n(function (MESSAGE_TYPES) {\n /**\n * Client -> Server message.\n * This message type is the first message after handshake and this will initialize AWS AppSync RealTime communication\n */\n MESSAGE_TYPES[\"GQL_CONNECTION_INIT\"] = \"connection_init\";\n /**\n * Server -> Client message\n * This message type is in case there is an issue with AWS AppSync RealTime when establishing connection\n */\n\n MESSAGE_TYPES[\"GQL_CONNECTION_ERROR\"] = \"connection_error\";\n /**\n * Server -> Client message.\n * This message type is for the ack response from AWS AppSync RealTime for GQL_CONNECTION_INIT message\n */\n\n MESSAGE_TYPES[\"GQL_CONNECTION_ACK\"] = \"connection_ack\";\n /**\n * Client -> Server message.\n * This message type is for register subscriptions with AWS AppSync RealTime\n */\n\n MESSAGE_TYPES[\"GQL_START\"] = \"start\";\n /**\n * Server -> Client message.\n * This message type is for the ack response from AWS AppSync RealTime for GQL_START message\n */\n\n MESSAGE_TYPES[\"GQL_START_ACK\"] = \"start_ack\";\n /**\n * Server -> Client message.\n * This message type is for subscription message from AWS AppSync RealTime\n */\n\n MESSAGE_TYPES[\"GQL_DATA\"] = \"data\";\n /**\n * Server -> Client message.\n * This message type helps the client to know is still receiving messages from AWS AppSync RealTime\n */\n\n MESSAGE_TYPES[\"GQL_CONNECTION_KEEP_ALIVE\"] = \"ka\";\n /**\n * Client -> Server message.\n * This message type is for unregister subscriptions with AWS AppSync RealTime\n */\n\n MESSAGE_TYPES[\"GQL_STOP\"] = \"stop\";\n /**\n * Server -> Client message.\n * This message type is for the ack response from AWS AppSync RealTime for GQL_STOP message\n */\n\n MESSAGE_TYPES[\"GQL_COMPLETE\"] = \"complete\";\n /**\n * Server -> Client message.\n * This message type is for sending error messages from AWS AppSync RealTime to the client\n */\n\n MESSAGE_TYPES[\"GQL_ERROR\"] = \"error\";\n})(MESSAGE_TYPES || (MESSAGE_TYPES = {}));\n\nvar SUBSCRIPTION_STATUS;\n\n(function (SUBSCRIPTION_STATUS) {\n SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS[\"PENDING\"] = 0] = \"PENDING\";\n SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS[\"CONNECTED\"] = 1] = \"CONNECTED\";\n SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS[\"FAILED\"] = 2] = \"FAILED\";\n})(SUBSCRIPTION_STATUS || (SUBSCRIPTION_STATUS = {}));\n\nvar SOCKET_STATUS;\n\n(function (SOCKET_STATUS) {\n SOCKET_STATUS[SOCKET_STATUS[\"CLOSED\"] = 0] = \"CLOSED\";\n SOCKET_STATUS[SOCKET_STATUS[\"READY\"] = 1] = \"READY\";\n SOCKET_STATUS[SOCKET_STATUS[\"CONNECTING\"] = 2] = \"CONNECTING\";\n})(SOCKET_STATUS || (SOCKET_STATUS = {}));\n\nvar AWS_APPSYNC_REALTIME_HEADERS = {\n accept: 'application/json, text/javascript',\n 'content-encoding': 'amz-1.0',\n 'content-type': 'application/json; charset=UTF-8'\n};\n/**\n * Time in milleseconds to wait for GQL_CONNECTION_INIT message\n */\n\nvar CONNECTION_INIT_TIMEOUT = 15000;\n/**\n * Time in milleseconds to wait for GQL_START_ACK message\n */\n\nvar START_ACK_TIMEOUT = 15000;\n/**\n * Default Time in milleseconds to wait for GQL_CONNECTION_KEEP_ALIVE message\n */\n\nvar DEFAULT_KEEP_ALIVE_TIMEOUT = 5 * 60 * 1000;\nvar standardDomainPattern = /^https:\\/\\/\\w{26}\\.appsync\\-api\\.\\w{2}(?:(?:\\-\\w{2,})+)\\-\\d\\.amazonaws.com\\/graphql$/i;\nvar customDomainPath = '/realtime';\n\nvar AWSAppSyncRealTimeProvider =\n/** @class */\nfunction (_super) {\n __extends(AWSAppSyncRealTimeProvider, _super);\n\n function AWSAppSyncRealTimeProvider() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n\n _this.socketStatus = SOCKET_STATUS.CLOSED;\n _this.keepAliveTimeout = DEFAULT_KEEP_ALIVE_TIMEOUT;\n _this.subscriptionObserverMap = new Map();\n _this.promiseArray = [];\n return _this;\n }\n\n AWSAppSyncRealTimeProvider.prototype.getProviderName = function () {\n return 'AWSAppSyncRealTimeProvider';\n };\n\n AWSAppSyncRealTimeProvider.prototype.newClient = function () {\n throw new Error('Not used here');\n };\n\n AWSAppSyncRealTimeProvider.prototype.publish = function (_topics, _msg, _options) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n throw new Error('Operation not supported');\n });\n });\n }; // Check if url matches standard domain pattern\n\n\n AWSAppSyncRealTimeProvider.prototype.isCustomDomain = function (url) {\n return url.match(standardDomainPattern) === null;\n };\n\n AWSAppSyncRealTimeProvider.prototype.subscribe = function (_topics, options) {\n var _this = this;\n\n var appSyncGraphqlEndpoint = options.appSyncGraphqlEndpoint;\n return new Observable(function (observer) {\n if (!appSyncGraphqlEndpoint) {\n observer.error({\n errors: [__assign({}, new GraphQLError(\"Subscribe only available for AWS AppSync endpoint\"))]\n });\n observer.complete();\n } else {\n var subscriptionId_1 = uuid();\n\n _this._startSubscriptionWithAWSAppSyncRealTime({\n options: options,\n observer: observer,\n subscriptionId: subscriptionId_1\n }).catch(function (err) {\n observer.error({\n errors: [__assign({}, new GraphQLError(CONTROL_MSG.REALTIME_SUBSCRIPTION_INIT_ERROR + \": \" + err))]\n });\n observer.complete();\n });\n\n return function () {\n return __awaiter(_this, void 0, void 0, function () {\n var subscriptionState, err_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 2, 3, 4]); // Waiting that subscription has been connected before trying to unsubscribe\n\n\n return [4\n /*yield*/\n , this._waitForSubscriptionToBeConnected(subscriptionId_1)];\n\n case 1:\n // Waiting that subscription has been connected before trying to unsubscribe\n _a.sent();\n\n subscriptionState = (this.subscriptionObserverMap.get(subscriptionId_1) || {}).subscriptionState;\n\n if (!subscriptionState) {\n // subscription already unsubscribed\n return [2\n /*return*/\n ];\n }\n\n if (subscriptionState === SUBSCRIPTION_STATUS.CONNECTED) {\n this._sendUnsubscriptionMessage(subscriptionId_1);\n } else {\n throw new Error('Subscription never connected');\n }\n\n return [3\n /*break*/\n , 4];\n\n case 2:\n err_1 = _a.sent();\n logger.debug(\"Error while unsubscribing \" + err_1);\n return [3\n /*break*/\n , 4];\n\n case 3:\n this._removeSubscriptionObserver(subscriptionId_1);\n\n return [7\n /*endfinally*/\n ];\n\n case 4:\n return [2\n /*return*/\n ];\n }\n });\n });\n };\n }\n });\n };\n\n Object.defineProperty(AWSAppSyncRealTimeProvider.prototype, \"isSSLEnabled\", {\n get: function get() {\n return !this.options.aws_appsync_dangerously_connect_to_http_endpoint_for_testing;\n },\n enumerable: true,\n configurable: true\n });\n\n AWSAppSyncRealTimeProvider.prototype._startSubscriptionWithAWSAppSyncRealTime = function (_a) {\n var options = _a.options,\n observer = _a.observer,\n subscriptionId = _a.subscriptionId;\n return __awaiter(this, void 0, void 0, function () {\n var appSyncGraphqlEndpoint, authenticationType, query, variables, apiKey, region, _b, graphql_headers, _c, additionalHeaders, subscriptionState, data, dataString, headerObj, _d, _e, subscriptionMessage, stringToAWSRealTime, err_2, _f, message, subscriptionFailedCallback_1, _g, subscriptionFailedCallback, subscriptionReadyCallback;\n\n var _h;\n\n var _this = this;\n\n return __generator(this, function (_j) {\n switch (_j.label) {\n case 0:\n appSyncGraphqlEndpoint = options.appSyncGraphqlEndpoint, authenticationType = options.authenticationType, query = options.query, variables = options.variables, apiKey = options.apiKey, region = options.region, _b = options.graphql_headers, graphql_headers = _b === void 0 ? function () {\n return {};\n } : _b, _c = options.additionalHeaders, additionalHeaders = _c === void 0 ? {} : _c;\n subscriptionState = SUBSCRIPTION_STATUS.PENDING;\n data = {\n query: query,\n variables: variables\n }; // Having a subscription id map will make it simple to forward messages received\n\n this.subscriptionObserverMap.set(subscriptionId, {\n observer: observer,\n query: query,\n variables: variables,\n subscriptionState: subscriptionState,\n startAckTimeoutId: null\n });\n dataString = JSON.stringify(data);\n _d = [{}];\n return [4\n /*yield*/\n , this._awsRealTimeHeaderBasedAuth({\n apiKey: apiKey,\n appSyncGraphqlEndpoint: appSyncGraphqlEndpoint,\n authenticationType: authenticationType,\n payload: dataString,\n canonicalUri: '',\n region: region,\n additionalHeaders: additionalHeaders\n })];\n\n case 1:\n _e = [__assign.apply(void 0, _d.concat([_j.sent()]))];\n return [4\n /*yield*/\n , graphql_headers()];\n\n case 2:\n headerObj = __assign.apply(void 0, [__assign.apply(void 0, [__assign.apply(void 0, _e.concat([_j.sent()])), additionalHeaders]), (_h = {}, _h[USER_AGENT_HEADER] = Constants.userAgent, _h)]);\n subscriptionMessage = {\n id: subscriptionId,\n payload: {\n data: dataString,\n extensions: {\n authorization: __assign({}, headerObj)\n }\n },\n type: MESSAGE_TYPES.GQL_START\n };\n stringToAWSRealTime = JSON.stringify(subscriptionMessage);\n _j.label = 3;\n\n case 3:\n _j.trys.push([3, 5,, 6]);\n\n return [4\n /*yield*/\n , this._initializeWebSocketConnection({\n apiKey: apiKey,\n appSyncGraphqlEndpoint: appSyncGraphqlEndpoint,\n authenticationType: authenticationType,\n region: region,\n additionalHeaders: additionalHeaders\n })];\n\n case 4:\n _j.sent();\n\n return [3\n /*break*/\n , 6];\n\n case 5:\n err_2 = _j.sent();\n logger.debug({\n err: err_2\n });\n _f = err_2.message, message = _f === void 0 ? '' : _f;\n observer.error({\n errors: [__assign({}, new GraphQLError(CONTROL_MSG.CONNECTION_FAILED + \": \" + message))]\n });\n observer.complete();\n subscriptionFailedCallback_1 = (this.subscriptionObserverMap.get(subscriptionId) || {}).subscriptionFailedCallback; // Notify concurrent unsubscription\n\n if (typeof subscriptionFailedCallback_1 === 'function') {\n subscriptionFailedCallback_1();\n }\n\n return [2\n /*return*/\n ];\n\n case 6:\n _g = this.subscriptionObserverMap.get(subscriptionId), subscriptionFailedCallback = _g.subscriptionFailedCallback, subscriptionReadyCallback = _g.subscriptionReadyCallback; // This must be done before sending the message in order to be listening immediately\n\n this.subscriptionObserverMap.set(subscriptionId, {\n observer: observer,\n subscriptionState: subscriptionState,\n variables: variables,\n query: query,\n subscriptionReadyCallback: subscriptionReadyCallback,\n subscriptionFailedCallback: subscriptionFailedCallback,\n startAckTimeoutId: setTimeout(function () {\n _this._timeoutStartSubscriptionAck.call(_this, subscriptionId);\n }, START_ACK_TIMEOUT)\n });\n\n if (this.awsRealTimeSocket) {\n this.awsRealTimeSocket.send(stringToAWSRealTime);\n }\n\n return [2\n /*return*/\n ];\n }\n });\n });\n }; // Waiting that subscription has been connected before trying to unsubscribe\n\n\n AWSAppSyncRealTimeProvider.prototype._waitForSubscriptionToBeConnected = function (subscriptionId) {\n return __awaiter(this, void 0, void 0, function () {\n var subscriptionState;\n\n var _this = this;\n\n return __generator(this, function (_a) {\n subscriptionState = this.subscriptionObserverMap.get(subscriptionId).subscriptionState; // This in case unsubscribe is invoked before sending start subscription message\n\n if (subscriptionState === SUBSCRIPTION_STATUS.PENDING) {\n return [2\n /*return*/\n , new Promise(function (res, rej) {\n var _a = _this.subscriptionObserverMap.get(subscriptionId),\n observer = _a.observer,\n subscriptionState = _a.subscriptionState,\n variables = _a.variables,\n query = _a.query;\n\n _this.subscriptionObserverMap.set(subscriptionId, {\n observer: observer,\n subscriptionState: subscriptionState,\n variables: variables,\n query: query,\n subscriptionReadyCallback: res,\n subscriptionFailedCallback: rej\n });\n })];\n }\n\n return [2\n /*return*/\n ];\n });\n });\n };\n\n AWSAppSyncRealTimeProvider.prototype._sendUnsubscriptionMessage = function (subscriptionId) {\n try {\n if (this.awsRealTimeSocket && this.awsRealTimeSocket.readyState === WebSocket.OPEN && this.socketStatus === SOCKET_STATUS.READY) {\n // Preparing unsubscribe message to stop receiving messages for that subscription\n var unsubscribeMessage = {\n id: subscriptionId,\n type: MESSAGE_TYPES.GQL_STOP\n };\n var stringToAWSRealTime = JSON.stringify(unsubscribeMessage);\n this.awsRealTimeSocket.send(stringToAWSRealTime);\n }\n } catch (err) {\n // If GQL_STOP is not sent because of disconnection issue, then there is nothing the client can do\n logger.debug({\n err: err\n });\n }\n };\n\n AWSAppSyncRealTimeProvider.prototype._removeSubscriptionObserver = function (subscriptionId) {\n this.subscriptionObserverMap.delete(subscriptionId); // Verifying 1000ms after removing subscription in case there are new subscription unmount/mount\n\n setTimeout(this._closeSocketIfRequired.bind(this), 1000);\n };\n\n AWSAppSyncRealTimeProvider.prototype._closeSocketIfRequired = function () {\n if (this.subscriptionObserverMap.size > 0) {\n // Active subscriptions on the WebSocket\n return;\n }\n\n if (!this.awsRealTimeSocket) {\n this.socketStatus = SOCKET_STATUS.CLOSED;\n return;\n }\n\n if (this.awsRealTimeSocket.bufferedAmount > 0) {\n // Still data on the WebSocket\n setTimeout(this._closeSocketIfRequired.bind(this), 1000);\n } else {\n logger.debug('closing WebSocket...');\n clearTimeout(this.keepAliveTimeoutId);\n var tempSocket = this.awsRealTimeSocket; // Cleaning callbacks to avoid race condition, socket still exists\n\n tempSocket.onclose = undefined;\n tempSocket.onerror = undefined;\n tempSocket.close(1000);\n this.awsRealTimeSocket = null;\n this.socketStatus = SOCKET_STATUS.CLOSED;\n }\n };\n\n AWSAppSyncRealTimeProvider.prototype._handleIncomingSubscriptionMessage = function (message) {\n logger.debug(\"subscription message from AWS AppSync RealTime: \" + message.data);\n\n var _a = JSON.parse(message.data),\n _b = _a.id,\n id = _b === void 0 ? '' : _b,\n payload = _a.payload,\n type = _a.type;\n\n var _c = this.subscriptionObserverMap.get(id) || {},\n _d = _c.observer,\n observer = _d === void 0 ? null : _d,\n _e = _c.query,\n query = _e === void 0 ? '' : _e,\n _f = _c.variables,\n variables = _f === void 0 ? {} : _f,\n startAckTimeoutId = _c.startAckTimeoutId,\n subscriptionReadyCallback = _c.subscriptionReadyCallback,\n subscriptionFailedCallback = _c.subscriptionFailedCallback;\n\n logger.debug({\n id: id,\n observer: observer,\n query: query,\n variables: variables\n });\n\n if (type === MESSAGE_TYPES.GQL_DATA && payload && payload.data) {\n if (observer) {\n observer.next(payload);\n } else {\n logger.debug(\"observer not found for id: \" + id);\n }\n\n return;\n }\n\n if (type === MESSAGE_TYPES.GQL_START_ACK) {\n logger.debug(\"subscription ready for \" + JSON.stringify({\n query: query,\n variables: variables\n }));\n\n if (typeof subscriptionReadyCallback === 'function') {\n subscriptionReadyCallback();\n }\n\n clearTimeout(startAckTimeoutId);\n dispatchApiEvent(CONTROL_MSG.SUBSCRIPTION_ACK, {\n query: query,\n variables: variables\n }, 'Connection established for subscription');\n var subscriptionState = SUBSCRIPTION_STATUS.CONNECTED;\n this.subscriptionObserverMap.set(id, {\n observer: observer,\n query: query,\n variables: variables,\n startAckTimeoutId: null,\n subscriptionState: subscriptionState,\n subscriptionReadyCallback: subscriptionReadyCallback,\n subscriptionFailedCallback: subscriptionFailedCallback\n }); // TODO: emit event on hub but it requires to store the id first\n\n return;\n }\n\n if (type === MESSAGE_TYPES.GQL_CONNECTION_KEEP_ALIVE) {\n clearTimeout(this.keepAliveTimeoutId);\n this.keepAliveTimeoutId = setTimeout(this._errorDisconnect.bind(this, CONTROL_MSG.TIMEOUT_DISCONNECT), this.keepAliveTimeout);\n return;\n }\n\n if (type === MESSAGE_TYPES.GQL_ERROR) {\n var subscriptionState = SUBSCRIPTION_STATUS.FAILED;\n this.subscriptionObserverMap.set(id, {\n observer: observer,\n query: query,\n variables: variables,\n startAckTimeoutId: startAckTimeoutId,\n subscriptionReadyCallback: subscriptionReadyCallback,\n subscriptionFailedCallback: subscriptionFailedCallback,\n subscriptionState: subscriptionState\n });\n observer.error({\n errors: [__assign({}, new GraphQLError(CONTROL_MSG.CONNECTION_FAILED + \": \" + JSON.stringify(payload)))]\n });\n clearTimeout(startAckTimeoutId);\n observer.complete();\n\n if (typeof subscriptionFailedCallback === 'function') {\n subscriptionFailedCallback();\n }\n }\n };\n\n AWSAppSyncRealTimeProvider.prototype._errorDisconnect = function (msg) {\n logger.debug(\"Disconnect error: \" + msg);\n this.subscriptionObserverMap.forEach(function (_a) {\n var observer = _a.observer;\n\n if (observer && !observer.closed) {\n observer.error({\n errors: [__assign({}, new GraphQLError(msg))]\n });\n }\n });\n this.subscriptionObserverMap.clear();\n\n if (this.awsRealTimeSocket) {\n this.awsRealTimeSocket.close();\n }\n\n this.socketStatus = SOCKET_STATUS.CLOSED;\n };\n\n AWSAppSyncRealTimeProvider.prototype._timeoutStartSubscriptionAck = function (subscriptionId) {\n var _a = this.subscriptionObserverMap.get(subscriptionId) || {},\n observer = _a.observer,\n query = _a.query,\n variables = _a.variables;\n\n if (!observer) {\n return;\n }\n\n this.subscriptionObserverMap.set(subscriptionId, {\n observer: observer,\n query: query,\n variables: variables,\n subscriptionState: SUBSCRIPTION_STATUS.FAILED\n });\n\n if (observer && !observer.closed) {\n observer.error({\n errors: [__assign({}, new GraphQLError(\"Subscription timeout \" + JSON.stringify({\n query: query,\n variables: variables\n })))]\n }); // Cleanup will be automatically executed\n\n observer.complete();\n }\n\n logger.debug('timeoutStartSubscription', JSON.stringify({\n query: query,\n variables: variables\n }));\n };\n\n AWSAppSyncRealTimeProvider.prototype._initializeWebSocketConnection = function (_a) {\n var _this = this;\n\n var appSyncGraphqlEndpoint = _a.appSyncGraphqlEndpoint,\n authenticationType = _a.authenticationType,\n apiKey = _a.apiKey,\n region = _a.region,\n additionalHeaders = _a.additionalHeaders;\n\n if (this.socketStatus === SOCKET_STATUS.READY) {\n return;\n }\n\n return new Promise(function (res, rej) {\n return __awaiter(_this, void 0, void 0, function () {\n var payloadString, headerString, _a, _b, headerQs, payloadQs, discoverableEndpoint, protocol, awsRealTimeUrl, err_3;\n\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n this.promiseArray.push({\n res: res,\n rej: rej\n });\n if (!(this.socketStatus === SOCKET_STATUS.CLOSED)) return [3\n /*break*/\n , 5];\n _c.label = 1;\n\n case 1:\n _c.trys.push([1, 4,, 5]);\n\n this.socketStatus = SOCKET_STATUS.CONNECTING;\n payloadString = '{}';\n _b = (_a = JSON).stringify;\n return [4\n /*yield*/\n , this._awsRealTimeHeaderBasedAuth({\n authenticationType: authenticationType,\n payload: payloadString,\n canonicalUri: '/connect',\n apiKey: apiKey,\n appSyncGraphqlEndpoint: appSyncGraphqlEndpoint,\n region: region,\n additionalHeaders: additionalHeaders\n })];\n\n case 2:\n headerString = _b.apply(_a, [_c.sent()]);\n headerQs = Buffer.from(headerString).toString('base64');\n payloadQs = Buffer.from(payloadString).toString('base64');\n discoverableEndpoint = appSyncGraphqlEndpoint;\n\n if (this.isCustomDomain(discoverableEndpoint)) {\n discoverableEndpoint = discoverableEndpoint.concat(customDomainPath);\n } else {\n discoverableEndpoint = discoverableEndpoint.replace('appsync-api', 'appsync-realtime-api').replace('gogi-beta', 'grt-beta');\n }\n\n protocol = this.isSSLEnabled ? 'wss://' : 'ws://';\n discoverableEndpoint = discoverableEndpoint.replace('https://', protocol).replace('http://', protocol);\n awsRealTimeUrl = discoverableEndpoint + \"?header=\" + headerQs + \"&payload=\" + payloadQs;\n return [4\n /*yield*/\n , this._initializeRetryableHandshake({\n awsRealTimeUrl: awsRealTimeUrl\n })];\n\n case 3:\n _c.sent();\n\n this.promiseArray.forEach(function (_a) {\n var res = _a.res;\n logger.debug('Notifying connection successful');\n res();\n });\n this.socketStatus = SOCKET_STATUS.READY;\n this.promiseArray = [];\n return [3\n /*break*/\n , 5];\n\n case 4:\n err_3 = _c.sent();\n this.promiseArray.forEach(function (_a) {\n var rej = _a.rej;\n return rej(err_3);\n });\n this.promiseArray = [];\n\n if (this.awsRealTimeSocket && this.awsRealTimeSocket.readyState === WebSocket.OPEN) {\n this.awsRealTimeSocket.close(3001);\n }\n\n this.awsRealTimeSocket = null;\n this.socketStatus = SOCKET_STATUS.CLOSED;\n return [3\n /*break*/\n , 5];\n\n case 5:\n return [2\n /*return*/\n ];\n }\n });\n });\n });\n };\n\n AWSAppSyncRealTimeProvider.prototype._initializeRetryableHandshake = function (_a) {\n var awsRealTimeUrl = _a.awsRealTimeUrl;\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n logger.debug(\"Initializaling retryable Handshake\");\n return [4\n /*yield*/\n , jitteredExponentialRetry(this._initializeHandshake.bind(this), [{\n awsRealTimeUrl: awsRealTimeUrl\n }], MAX_DELAY_MS)];\n\n case 1:\n _b.sent();\n\n return [2\n /*return*/\n ];\n }\n });\n });\n };\n\n AWSAppSyncRealTimeProvider.prototype._initializeHandshake = function (_a) {\n var awsRealTimeUrl = _a.awsRealTimeUrl;\n return __awaiter(this, void 0, void 0, function () {\n var err_4, errorType, errorCode;\n\n var _this = this;\n\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n logger.debug(\"Initializing handshake \" + awsRealTimeUrl);\n _b.label = 1;\n\n case 1:\n _b.trys.push([1, 4,, 5]);\n\n return [4\n /*yield*/\n , function () {\n return new Promise(function (res, rej) {\n var newSocket = new WebSocket(awsRealTimeUrl, 'graphql-ws');\n\n newSocket.onerror = function () {\n logger.debug(\"WebSocket connection error\");\n };\n\n newSocket.onclose = function () {\n rej(new Error('Connection handshake error'));\n };\n\n newSocket.onopen = function () {\n _this.awsRealTimeSocket = newSocket;\n return res();\n };\n });\n }()];\n\n case 2:\n _b.sent(); // Step 2: wait for ack from AWS AppSyncReaTime after sending init\n\n\n return [4\n /*yield*/\n , function () {\n return new Promise(function (res, rej) {\n var ackOk = false;\n\n _this.awsRealTimeSocket.onerror = function (error) {\n logger.debug(\"WebSocket error \" + JSON.stringify(error));\n };\n\n _this.awsRealTimeSocket.onclose = function (event) {\n logger.debug(\"WebSocket closed \" + event.reason);\n rej(new Error(JSON.stringify(event)));\n };\n\n _this.awsRealTimeSocket.onmessage = function (message) {\n logger.debug(\"subscription message from AWS AppSyncRealTime: \" + message.data + \" \");\n var data = JSON.parse(message.data);\n var type = data.type,\n _a = data.payload,\n _b = (_a === void 0 ? {} : _a).connectionTimeoutMs,\n connectionTimeoutMs = _b === void 0 ? DEFAULT_KEEP_ALIVE_TIMEOUT : _b;\n\n if (type === MESSAGE_TYPES.GQL_CONNECTION_ACK) {\n ackOk = true;\n _this.keepAliveTimeout = connectionTimeoutMs;\n _this.awsRealTimeSocket.onmessage = _this._handleIncomingSubscriptionMessage.bind(_this);\n\n _this.awsRealTimeSocket.onerror = function (err) {\n logger.debug(err);\n\n _this._errorDisconnect(CONTROL_MSG.CONNECTION_CLOSED);\n };\n\n _this.awsRealTimeSocket.onclose = function (event) {\n logger.debug(\"WebSocket closed \" + event.reason);\n\n _this._errorDisconnect(CONTROL_MSG.CONNECTION_CLOSED);\n };\n\n res('Cool, connected to AWS AppSyncRealTime');\n return;\n }\n\n if (type === MESSAGE_TYPES.GQL_CONNECTION_ERROR) {\n var _c = data.payload,\n _d = (_c === void 0 ? {} : _c).errors,\n _e = __read(_d === void 0 ? [] : _d, 1),\n _f = _e[0],\n _g = _f === void 0 ? {} : _f,\n _h = _g.errorType,\n errorType = _h === void 0 ? '' : _h,\n _j = _g.errorCode,\n errorCode = _j === void 0 ? 0 : _j;\n\n rej({\n errorType: errorType,\n errorCode: errorCode\n });\n }\n };\n\n var gqlInit = {\n type: MESSAGE_TYPES.GQL_CONNECTION_INIT\n };\n\n _this.awsRealTimeSocket.send(JSON.stringify(gqlInit));\n\n function checkAckOk() {\n if (!ackOk) {\n rej(new Error(\"Connection timeout: ack from AWSRealTime was not received on \" + CONNECTION_INIT_TIMEOUT + \" ms\"));\n }\n }\n\n setTimeout(checkAckOk.bind(_this), CONNECTION_INIT_TIMEOUT);\n });\n }()];\n\n case 3:\n // Step 2: wait for ack from AWS AppSyncReaTime after sending init\n _b.sent();\n\n return [3\n /*break*/\n , 5];\n\n case 4:\n err_4 = _b.sent();\n errorType = err_4.errorType, errorCode = err_4.errorCode;\n\n if (NON_RETRYABLE_CODES.includes(errorCode)) {\n throw new NonRetryableError(errorType);\n } else if (errorType) {\n throw new Error(errorType);\n } else {\n throw err_4;\n }\n\n return [3\n /*break*/\n , 5];\n\n case 5:\n return [2\n /*return*/\n ];\n }\n });\n });\n };\n\n AWSAppSyncRealTimeProvider.prototype._awsRealTimeHeaderBasedAuth = function (_a) {\n var authenticationType = _a.authenticationType,\n payload = _a.payload,\n canonicalUri = _a.canonicalUri,\n appSyncGraphqlEndpoint = _a.appSyncGraphqlEndpoint,\n apiKey = _a.apiKey,\n region = _a.region,\n additionalHeaders = _a.additionalHeaders;\n return __awaiter(this, void 0, void 0, function () {\n var headerHandler, handler, host, result;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n headerHandler = {\n API_KEY: this._awsRealTimeApiKeyHeader.bind(this),\n AWS_IAM: this._awsRealTimeIAMHeader.bind(this),\n OPENID_CONNECT: this._awsRealTimeOPENIDHeader.bind(this),\n AMAZON_COGNITO_USER_POOLS: this._awsRealTimeCUPHeader.bind(this),\n AWS_LAMBDA: this._customAuthHeader\n };\n handler = headerHandler[authenticationType];\n\n if (typeof handler !== 'function') {\n logger.debug(\"Authentication type \" + authenticationType + \" not supported\");\n return [2\n /*return*/\n , ''];\n }\n\n host = url.parse(appSyncGraphqlEndpoint).host;\n return [4\n /*yield*/\n , handler({\n payload: payload,\n canonicalUri: canonicalUri,\n appSyncGraphqlEndpoint: appSyncGraphqlEndpoint,\n apiKey: apiKey,\n region: region,\n host: host,\n additionalHeaders: additionalHeaders\n })];\n\n case 1:\n result = _b.sent();\n return [2\n /*return*/\n , result];\n }\n });\n });\n };\n\n AWSAppSyncRealTimeProvider.prototype._awsRealTimeCUPHeader = function (_a) {\n var host = _a.host;\n return __awaiter(this, void 0, void 0, function () {\n var session;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n return [4\n /*yield*/\n , Auth.currentSession()];\n\n case 1:\n session = _b.sent();\n return [2\n /*return*/\n , {\n Authorization: session.getAccessToken().getJwtToken(),\n host: host\n }];\n }\n });\n });\n };\n\n AWSAppSyncRealTimeProvider.prototype._awsRealTimeOPENIDHeader = function (_a) {\n var host = _a.host;\n return __awaiter(this, void 0, void 0, function () {\n var token, federatedInfo, currentUser;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n return [4\n /*yield*/\n , Cache.getItem('federatedInfo')];\n\n case 1:\n federatedInfo = _b.sent();\n if (!federatedInfo) return [3\n /*break*/\n , 2];\n token = federatedInfo.token;\n return [3\n /*break*/\n , 4];\n\n case 2:\n return [4\n /*yield*/\n , Auth.currentAuthenticatedUser()];\n\n case 3:\n currentUser = _b.sent();\n\n if (currentUser) {\n token = currentUser.token;\n }\n\n _b.label = 4;\n\n case 4:\n if (!token) {\n throw new Error('No federated jwt');\n }\n\n return [2\n /*return*/\n , {\n Authorization: token,\n host: host\n }];\n }\n });\n });\n };\n\n AWSAppSyncRealTimeProvider.prototype._awsRealTimeApiKeyHeader = function (_a) {\n var apiKey = _a.apiKey,\n host = _a.host;\n return __awaiter(this, void 0, void 0, function () {\n var dt, dtStr;\n return __generator(this, function (_b) {\n dt = new Date();\n dtStr = dt.toISOString().replace(/[:\\-]|\\.\\d{3}/g, '');\n return [2\n /*return*/\n , {\n host: host,\n 'x-amz-date': dtStr,\n 'x-api-key': apiKey\n }];\n });\n });\n };\n\n AWSAppSyncRealTimeProvider.prototype._awsRealTimeIAMHeader = function (_a) {\n var payload = _a.payload,\n canonicalUri = _a.canonicalUri,\n appSyncGraphqlEndpoint = _a.appSyncGraphqlEndpoint,\n region = _a.region;\n return __awaiter(this, void 0, void 0, function () {\n var endpointInfo, credentialsOK, creds, request, signed_params;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n endpointInfo = {\n region: region,\n service: 'appsync'\n };\n return [4\n /*yield*/\n , this._ensureCredentials()];\n\n case 1:\n credentialsOK = _b.sent();\n\n if (!credentialsOK) {\n throw new Error('No credentials');\n }\n\n return [4\n /*yield*/\n , Credentials.get().then(function (credentials) {\n return {\n secret_key: credentials.secretAccessKey,\n access_key: credentials.accessKeyId,\n session_token: credentials.sessionToken\n };\n })];\n\n case 2:\n creds = _b.sent();\n request = {\n url: \"\" + appSyncGraphqlEndpoint + canonicalUri,\n data: payload,\n method: 'POST',\n headers: __assign({}, AWS_APPSYNC_REALTIME_HEADERS)\n };\n signed_params = Signer.sign(request, creds, endpointInfo);\n return [2\n /*return*/\n , signed_params.headers];\n }\n });\n });\n };\n\n AWSAppSyncRealTimeProvider.prototype._customAuthHeader = function (_a) {\n var host = _a.host,\n additionalHeaders = _a.additionalHeaders;\n\n if (!additionalHeaders.Authorization) {\n throw new Error('No auth token specified');\n }\n\n return {\n Authorization: additionalHeaders.Authorization,\n host: host\n };\n };\n /**\n * @private\n */\n\n\n AWSAppSyncRealTimeProvider.prototype._ensureCredentials = function () {\n return Credentials.get().then(function (credentials) {\n if (!credentials) return false;\n var cred = Credentials.shear(credentials);\n logger.debug('set credentials for AWSAppSyncRealTimeProvider', cred);\n return true;\n }).catch(function (err) {\n logger.warn('ensure credentials error', err);\n return false;\n });\n };\n\n return AWSAppSyncRealTimeProvider;\n}(AbstractPubSubProvider);\n\nexport { AWSAppSyncRealTimeProvider };","/*\n * Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nimport { PubSub } from './PubSub';\nexport * from './Providers';\nvar CONTROL_MSG;\n\n(function (CONTROL_MSG) {\n CONTROL_MSG[\"CONNECTION_CLOSED\"] = \"Connection closed\";\n CONTROL_MSG[\"CONNECTION_FAILED\"] = \"Connection failed\";\n CONTROL_MSG[\"REALTIME_SUBSCRIPTION_INIT_ERROR\"] = \"AppSync Realtime subscription init error\";\n CONTROL_MSG[\"SUBSCRIPTION_ACK\"] = \"Subscription ack\";\n CONTROL_MSG[\"TIMEOUT_DISCONNECT\"] = \"Timeout disconnect\";\n})(CONTROL_MSG || (CONTROL_MSG = {}));\n\nexport { PubSub, CONTROL_MSG };\n/**\n * @deprecated use named import\n */\n\nexport default PubSub;","var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function (resolve) {\n resolve(value);\n });\n }\n\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n\n function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\n\nvar __generator = this && this.__generator || function (thisArg, body) {\n var _ = {\n label: 0,\n sent: function sent() {\n if (t[0] & 1) throw t[1];\n return t[1];\n },\n trys: [],\n ops: []\n },\n f,\n y,\n t,\n g;\n return g = {\n next: verb(0),\n \"throw\": verb(1),\n \"return\": verb(2)\n }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function () {\n return this;\n }), g;\n\n function verb(n) {\n return function (v) {\n return step([n, v]);\n };\n }\n\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n\n while (_) {\n try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n\n case 4:\n _.label++;\n return {\n value: op[1],\n done: false\n };\n\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n\n case 7:\n op = _.ops.pop();\n\n _.trys.pop();\n\n continue;\n\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n\n if (t && _.label < t[2]) {\n _.label = t[2];\n\n _.ops.push(op);\n\n break;\n }\n\n if (t[2]) _.ops.pop();\n\n _.trys.pop();\n\n continue;\n }\n\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\n }\n }\n\n if (op[0] & 5) throw op[1];\n return {\n value: op[0] ? op[1] : void 0,\n done: true\n };\n }\n};\n/*\n * Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\n// import '../Common/Polyfills';\n\n\nimport Observable from 'zen-observable-ts';\nimport { Amplify, browserOrNode, ConsoleLogger as Logger, INTERNAL_AWS_APPSYNC_PUBSUB_PROVIDER, INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER } from '@aws-amplify/core';\nimport { AWSAppSyncProvider, AWSAppSyncRealTimeProvider } from './Providers';\nvar isNode = browserOrNode().isNode;\nvar logger = new Logger('PubSub');\n\nvar PubSubClass =\n/** @class */\nfunction () {\n /**\n * Initialize PubSub with AWS configurations\n *\n * @param {PubSubOptions} options - Configuration object for PubSub\n */\n function PubSubClass(options) {\n this._options = options;\n logger.debug('PubSub Options', this._options);\n this._pluggables = [];\n this.subscribe = this.subscribe.bind(this);\n }\n\n Object.defineProperty(PubSubClass.prototype, \"awsAppSyncProvider\", {\n /**\n * Lazy instantiate AWSAppSyncProvider when it is required by the API category\n */\n get: function get() {\n if (!this._awsAppSyncProvider) {\n this._awsAppSyncProvider = new AWSAppSyncProvider(this._options);\n }\n\n return this._awsAppSyncProvider;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(PubSubClass.prototype, \"awsAppSyncRealTimeProvider\", {\n /**\n * Lazy instantiate AWSAppSyncRealTimeProvider when it is required by the API category\n */\n get: function get() {\n if (!this._awsAppSyncRealTimeProvider) {\n this._awsAppSyncRealTimeProvider = new AWSAppSyncRealTimeProvider(this._options);\n }\n\n return this._awsAppSyncRealTimeProvider;\n },\n enumerable: true,\n configurable: true\n });\n\n PubSubClass.prototype.getModuleName = function () {\n return 'PubSub';\n };\n /**\n * Configure PubSub part with configurations\n *\n * @param {PubSubOptions} config - Configuration for PubSub\n * @return {Object} - The current configuration\n */\n\n\n PubSubClass.prototype.configure = function (options) {\n var _this = this;\n\n var opt = options ? options.PubSub || options : {};\n logger.debug('configure PubSub', {\n opt: opt\n });\n this._options = Object.assign({}, this._options, opt);\n\n this._pluggables.map(function (pluggable) {\n return pluggable.configure(_this._options);\n });\n\n return this._options;\n };\n /**\n * add plugin into Analytics category\n * @param {Object} pluggable - an instance of the plugin\n */\n\n\n PubSubClass.prototype.addPluggable = function (pluggable) {\n return __awaiter(this, void 0, void 0, function () {\n var config;\n return __generator(this, function (_a) {\n if (pluggable && pluggable.getCategory() === 'PubSub') {\n this._pluggables.push(pluggable);\n\n config = pluggable.configure(this._options);\n return [2\n /*return*/\n , config];\n }\n\n return [2\n /*return*/\n ];\n });\n });\n };\n /**\n * remove plugin from PubSub category\n * @param providerName - the name of the plugin\n */\n\n\n PubSubClass.prototype.removePluggable = function (providerName) {\n this._pluggables = this._pluggables.filter(function (pluggable) {\n return pluggable.getProviderName() !== providerName;\n });\n };\n\n PubSubClass.prototype.getProviderByName = function (providerName) {\n if (providerName === INTERNAL_AWS_APPSYNC_PUBSUB_PROVIDER) {\n return this.awsAppSyncProvider;\n }\n\n if (providerName === INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER) {\n return this.awsAppSyncRealTimeProvider;\n }\n\n return this._pluggables.find(function (pluggable) {\n return pluggable.getProviderName() === providerName;\n });\n };\n\n PubSubClass.prototype.getProviders = function (options) {\n if (options === void 0) {\n options = {};\n }\n\n var providerName = options.provider;\n\n if (!providerName) {\n return this._pluggables;\n }\n\n var provider = this.getProviderByName(providerName);\n\n if (!provider) {\n throw new Error(\"Could not find provider named \" + providerName);\n }\n\n return [provider];\n };\n\n PubSubClass.prototype.publish = function (topics, msg, options) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2\n /*return*/\n , Promise.all(this.getProviders(options).map(function (provider) {\n return provider.publish(topics, msg, options);\n }))];\n });\n });\n };\n\n PubSubClass.prototype.subscribe = function (topics, options) {\n if (isNode && this._options && this._options.ssr) {\n throw new Error('Subscriptions are not supported for Server-Side Rendering (SSR)');\n }\n\n logger.debug('subscribe options', options);\n var providers = this.getProviders(options);\n return new Observable(function (observer) {\n var observables = providers.map(function (provider) {\n return {\n provider: provider,\n observable: provider.subscribe(topics, options)\n };\n });\n var subscriptions = observables.map(function (_a) {\n var provider = _a.provider,\n observable = _a.observable;\n return observable.subscribe({\n start: console.error,\n next: function next(value) {\n return observer.next({\n provider: provider,\n value: value\n });\n },\n error: function error(_error) {\n return observer.error({\n provider: provider,\n error: _error\n });\n }\n });\n });\n return function () {\n return subscriptions.forEach(function (subscription) {\n return subscription.unsubscribe();\n });\n };\n });\n };\n\n return PubSubClass;\n}();\n\nexport { PubSubClass };\nexport var PubSub = new PubSubClass(null);\nAmplify.register(PubSub);","export var GRAPHQL_AUTH_MODE;\n\n(function (GRAPHQL_AUTH_MODE) {\n GRAPHQL_AUTH_MODE[\"API_KEY\"] = \"API_KEY\";\n GRAPHQL_AUTH_MODE[\"AWS_IAM\"] = \"AWS_IAM\";\n GRAPHQL_AUTH_MODE[\"OPENID_CONNECT\"] = \"OPENID_CONNECT\";\n GRAPHQL_AUTH_MODE[\"AMAZON_COGNITO_USER_POOLS\"] = \"AMAZON_COGNITO_USER_POOLS\";\n GRAPHQL_AUTH_MODE[\"AWS_LAMBDA\"] = \"AWS_LAMBDA\";\n})(GRAPHQL_AUTH_MODE || (GRAPHQL_AUTH_MODE = {}));\n\nexport var GraphQLAuthError;\n\n(function (GraphQLAuthError) {\n GraphQLAuthError[\"NO_API_KEY\"] = \"No api-key configured\";\n GraphQLAuthError[\"NO_CURRENT_USER\"] = \"No current user\";\n GraphQLAuthError[\"NO_CREDENTIALS\"] = \"No credentials\";\n GraphQLAuthError[\"NO_FEDERATED_JWT\"] = \"No federated jwt\";\n GraphQLAuthError[\"NO_AUTH_TOKEN\"] = \"No auth token specified\";\n})(GraphQLAuthError || (GraphQLAuthError = {}));","var __assign = this && this.__assign || function () {\n __assign = Object.assign || function (t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n }\n\n return t;\n };\n\n return __assign.apply(this, arguments);\n};\n\nvar __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function (resolve) {\n resolve(value);\n });\n }\n\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n\n function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\n\nvar __generator = this && this.__generator || function (thisArg, body) {\n var _ = {\n label: 0,\n sent: function sent() {\n if (t[0] & 1) throw t[1];\n return t[1];\n },\n trys: [],\n ops: []\n },\n f,\n y,\n t,\n g;\n return g = {\n next: verb(0),\n \"throw\": verb(1),\n \"return\": verb(2)\n }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function () {\n return this;\n }), g;\n\n function verb(n) {\n return function (v) {\n return step([n, v]);\n };\n }\n\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n\n while (_) {\n try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n\n case 4:\n _.label++;\n return {\n value: op[1],\n done: false\n };\n\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n\n case 7:\n op = _.ops.pop();\n\n _.trys.pop();\n\n continue;\n\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n\n if (t && _.label < t[2]) {\n _.label = t[2];\n\n _.ops.push(op);\n\n break;\n }\n\n if (t[2]) _.ops.pop();\n\n _.trys.pop();\n\n continue;\n }\n\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\n }\n }\n\n if (op[0] & 5) throw op[1];\n return {\n value: op[0] ? op[1] : void 0,\n done: true\n };\n }\n};\n\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n }\n\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\n\nvar __read = this && this.__read || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o),\n r,\n ar = [],\n e;\n\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {\n ar.push(r.value);\n }\n } catch (error) {\n e = {\n error: error\n };\n } finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n\n return ar;\n};\n/*\n * Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\n\n\nimport { print, parse, GraphQLError } from 'graphql';\nimport { Amplify, ConsoleLogger as Logger, Constants, Credentials, INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER } from '@aws-amplify/core';\nimport PubSub from '@aws-amplify/pubsub';\nimport Auth from '@aws-amplify/auth';\nimport Cache from '@aws-amplify/cache';\nimport { GraphQLAuthError } from './types';\nimport { RestClient } from '@aws-amplify/api-rest';\nvar USER_AGENT_HEADER = 'x-amz-user-agent';\nvar logger = new Logger('GraphQLAPI');\nexport var graphqlOperation = function graphqlOperation(query, variables, authToken) {\n if (variables === void 0) {\n variables = {};\n }\n\n return {\n query: query,\n variables: variables,\n authToken: authToken\n };\n};\n/**\n * Export Cloud Logic APIs\n */\n\nvar GraphQLAPIClass =\n/** @class */\nfunction () {\n /**\n * Initialize GraphQL API with AWS configuration\n * @param {Object} options - Configuration object for API\n */\n function GraphQLAPIClass(options) {\n this._api = null;\n this.Auth = Auth;\n this.Cache = Cache;\n this.Credentials = Credentials;\n this._options = options;\n logger.debug('API Options', this._options);\n }\n\n GraphQLAPIClass.prototype.getModuleName = function () {\n return 'GraphQLAPI';\n };\n /**\n * Configure API\n * @param {Object} config - Configuration of the API\n * @return {Object} - The current configuration\n */\n\n\n GraphQLAPIClass.prototype.configure = function (options) {\n var _a = options || {},\n _b = _a.API,\n API = _b === void 0 ? {} : _b,\n otherOptions = __rest(_a, [\"API\"]);\n\n var opt = __assign(__assign({}, otherOptions), API);\n\n logger.debug('configure GraphQL API', {\n opt: opt\n });\n\n if (opt['aws_project_region']) {\n opt = Object.assign({}, opt, {\n region: opt['aws_project_region'],\n header: {}\n });\n }\n\n if (typeof opt.graphql_headers !== 'undefined' && typeof opt.graphql_headers !== 'function') {\n logger.warn('graphql_headers should be a function');\n opt.graphql_headers = undefined;\n }\n\n this._options = Object.assign({}, this._options, opt);\n this.createInstance();\n return this._options;\n };\n /**\n * Create an instance of API for the library\n * @return - A promise of true if Success\n */\n\n\n GraphQLAPIClass.prototype.createInstance = function () {\n logger.debug('create Rest instance');\n\n if (this._options) {\n this._api = new RestClient(this._options); // Share instance Credentials with client for SSR\n\n this._api.Credentials = this.Credentials;\n return true;\n } else {\n return Promise.reject('API not configured');\n }\n };\n\n GraphQLAPIClass.prototype._headerBasedAuth = function (defaultAuthenticationType, additionalHeaders) {\n if (additionalHeaders === void 0) {\n additionalHeaders = {};\n }\n\n return __awaiter(this, void 0, void 0, function () {\n var _a, aws_appsync_authenticationType, apiKey, authenticationType, headers, _b, credentialsOK, token, federatedInfo, currentUser, e_1, session, e_2;\n\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n _a = this._options, aws_appsync_authenticationType = _a.aws_appsync_authenticationType, apiKey = _a.aws_appsync_apiKey;\n authenticationType = defaultAuthenticationType || aws_appsync_authenticationType || 'AWS_IAM';\n headers = {};\n _b = authenticationType;\n\n switch (_b) {\n case 'API_KEY':\n return [3\n /*break*/\n , 1];\n\n case 'AWS_IAM':\n return [3\n /*break*/\n , 2];\n\n case 'OPENID_CONNECT':\n return [3\n /*break*/\n , 4];\n\n case 'AMAZON_COGNITO_USER_POOLS':\n return [3\n /*break*/\n , 11];\n\n case 'AWS_LAMBDA':\n return [3\n /*break*/\n , 15];\n }\n\n return [3\n /*break*/\n , 16];\n\n case 1:\n if (!apiKey) {\n throw new Error(GraphQLAuthError.NO_API_KEY);\n }\n\n headers = {\n Authorization: null,\n 'X-Api-Key': apiKey\n };\n return [3\n /*break*/\n , 17];\n\n case 2:\n return [4\n /*yield*/\n , this._ensureCredentials()];\n\n case 3:\n credentialsOK = _c.sent();\n\n if (!credentialsOK) {\n throw new Error(GraphQLAuthError.NO_CREDENTIALS);\n }\n\n return [3\n /*break*/\n , 17];\n\n case 4:\n _c.trys.push([4, 9,, 10]);\n\n token = void 0;\n return [4\n /*yield*/\n , Cache.getItem('federatedInfo')];\n\n case 5:\n federatedInfo = _c.sent();\n if (!federatedInfo) return [3\n /*break*/\n , 6];\n token = federatedInfo.token;\n return [3\n /*break*/\n , 8];\n\n case 6:\n return [4\n /*yield*/\n , Auth.currentAuthenticatedUser()];\n\n case 7:\n currentUser = _c.sent();\n\n if (currentUser) {\n token = currentUser.token;\n }\n\n _c.label = 8;\n\n case 8:\n if (!token) {\n throw new Error(GraphQLAuthError.NO_FEDERATED_JWT);\n }\n\n headers = {\n Authorization: token\n };\n return [3\n /*break*/\n , 10];\n\n case 9:\n e_1 = _c.sent();\n throw new Error(GraphQLAuthError.NO_CURRENT_USER);\n\n case 10:\n return [3\n /*break*/\n , 17];\n\n case 11:\n _c.trys.push([11, 13,, 14]);\n\n return [4\n /*yield*/\n , this.Auth.currentSession()];\n\n case 12:\n session = _c.sent();\n headers = {\n Authorization: session.getAccessToken().getJwtToken()\n };\n return [3\n /*break*/\n , 14];\n\n case 13:\n e_2 = _c.sent();\n throw new Error(GraphQLAuthError.NO_CURRENT_USER);\n\n case 14:\n return [3\n /*break*/\n , 17];\n\n case 15:\n if (!additionalHeaders.Authorization) {\n throw new Error(GraphQLAuthError.NO_AUTH_TOKEN);\n }\n\n headers = {\n Authorization: additionalHeaders.Authorization\n };\n return [3\n /*break*/\n , 17];\n\n case 16:\n headers = {\n Authorization: null\n };\n return [3\n /*break*/\n , 17];\n\n case 17:\n return [2\n /*return*/\n , headers];\n }\n });\n });\n };\n /**\n * to get the operation type\n * @param operation\n */\n\n\n GraphQLAPIClass.prototype.getGraphqlOperationType = function (operation) {\n var doc = parse(operation);\n var definitions = doc.definitions;\n\n var _a = __read(definitions, 1),\n operationType = _a[0].operation;\n\n return operationType;\n };\n /**\n * Executes a GraphQL operation\n *\n * @param {GraphQLOptions} GraphQL Options\n * @param {object} additionalHeaders headers to merge in after any `graphql_headers` set in the config\n * @returns {Promise | Observable}\n */\n\n\n GraphQLAPIClass.prototype.graphql = function (_a, additionalHeaders) {\n var paramQuery = _a.query,\n _b = _a.variables,\n variables = _b === void 0 ? {} : _b,\n authMode = _a.authMode,\n authToken = _a.authToken;\n var query = typeof paramQuery === 'string' ? parse(paramQuery) : parse(print(paramQuery));\n\n var _c = __read(query.definitions.filter(function (def) {\n return def.kind === 'OperationDefinition';\n }), 1),\n _d = _c[0],\n operationDef = _d === void 0 ? {} : _d;\n\n var operationType = operationDef.operation;\n var headers = additionalHeaders || {}; // if an authorization header is set, have the explicit authToken take precedence\n\n if (authToken) {\n headers.Authorization = authToken;\n }\n\n switch (operationType) {\n case 'query':\n case 'mutation':\n var cancellableToken = this._api.getCancellableToken();\n\n var initParams = {\n cancellableToken: cancellableToken\n };\n\n var responsePromise = this._graphql({\n query: query,\n variables: variables,\n authMode: authMode\n }, headers, initParams);\n\n this._api.updateRequestToBeCancellable(responsePromise, cancellableToken);\n\n return responsePromise;\n\n case 'subscription':\n return this._graphqlSubscribe({\n query: query,\n variables: variables,\n authMode: authMode\n }, headers);\n }\n\n throw new Error(\"invalid operation type: \" + operationType);\n };\n\n GraphQLAPIClass.prototype._graphql = function (_a, additionalHeaders, initParams) {\n var query = _a.query,\n variables = _a.variables,\n authMode = _a.authMode;\n\n if (additionalHeaders === void 0) {\n additionalHeaders = {};\n }\n\n if (initParams === void 0) {\n initParams = {};\n }\n\n return __awaiter(this, void 0, void 0, function () {\n var _b, region, appSyncGraphqlEndpoint, _c, graphql_headers, customGraphqlEndpoint, customEndpointRegion, headers, _d, _e, _f, _g, _h, _j, body, init, endpoint, error, response, err_1, errors;\n\n var _k;\n\n return __generator(this, function (_l) {\n switch (_l.label) {\n case 0:\n if (!!this._api) return [3\n /*break*/\n , 2];\n return [4\n /*yield*/\n , this.createInstance()];\n\n case 1:\n _l.sent();\n\n _l.label = 2;\n\n case 2:\n _b = this._options, region = _b.aws_appsync_region, appSyncGraphqlEndpoint = _b.aws_appsync_graphqlEndpoint, _c = _b.graphql_headers, graphql_headers = _c === void 0 ? function () {\n return {};\n } : _c, customGraphqlEndpoint = _b.graphql_endpoint, customEndpointRegion = _b.graphql_endpoint_iam_region;\n _d = [{}];\n _e = !customGraphqlEndpoint;\n if (!_e) return [3\n /*break*/\n , 4];\n return [4\n /*yield*/\n , this._headerBasedAuth(authMode, additionalHeaders)];\n\n case 3:\n _e = _l.sent();\n _l.label = 4;\n\n case 4:\n _f = [__assign.apply(void 0, _d.concat([_e]))];\n _g = customGraphqlEndpoint;\n if (!_g) return [3\n /*break*/\n , 8];\n if (!customEndpointRegion) return [3\n /*break*/\n , 6];\n return [4\n /*yield*/\n , this._headerBasedAuth(authMode, additionalHeaders)];\n\n case 5:\n _h = _l.sent();\n return [3\n /*break*/\n , 7];\n\n case 6:\n _h = {\n Authorization: null\n };\n _l.label = 7;\n\n case 7:\n _g = _h;\n _l.label = 8;\n\n case 8:\n _j = [__assign.apply(void 0, _f.concat([_g]))];\n return [4\n /*yield*/\n , graphql_headers({\n query: query,\n variables: variables\n })];\n\n case 9:\n headers = __assign.apply(void 0, [__assign.apply(void 0, [__assign.apply(void 0, _j.concat([_l.sent()])), additionalHeaders]), !customGraphqlEndpoint && (_k = {}, _k[USER_AGENT_HEADER] = Constants.userAgent, _k)]);\n body = {\n query: print(query),\n variables: variables\n };\n init = Object.assign({\n headers: headers,\n body: body,\n signerServiceInfo: {\n service: !customGraphqlEndpoint ? 'appsync' : 'execute-api',\n region: !customGraphqlEndpoint ? region : customEndpointRegion\n }\n }, initParams);\n endpoint = customGraphqlEndpoint || appSyncGraphqlEndpoint;\n\n if (!endpoint) {\n error = new GraphQLError('No graphql endpoint provided.');\n throw {\n data: {},\n errors: [error]\n };\n }\n\n _l.label = 10;\n\n case 10:\n _l.trys.push([10, 12,, 13]);\n\n return [4\n /*yield*/\n , this._api.post(endpoint, init)];\n\n case 11:\n response = _l.sent();\n return [3\n /*break*/\n , 13];\n\n case 12:\n err_1 = _l.sent(); // If the exception is because user intentionally\n // cancelled the request, do not modify the exception\n // so that clients can identify the exception correctly.\n\n if (this._api.isCancel(err_1)) {\n throw err_1;\n }\n\n response = {\n data: {},\n errors: [new GraphQLError(err_1.message, null, null, null, null, err_1)]\n };\n return [3\n /*break*/\n , 13];\n\n case 13:\n errors = response.errors;\n\n if (errors && errors.length) {\n throw response;\n }\n\n return [2\n /*return*/\n , response];\n }\n });\n });\n };\n /**\n * Checks to see if an error thrown is from an api request cancellation\n * @param {any} error - Any error\n * @return {boolean} - A boolean indicating if the error was from an api request cancellation\n */\n\n\n GraphQLAPIClass.prototype.isCancel = function (error) {\n return this._api.isCancel(error);\n };\n /**\n * Cancels an inflight request. Only applicable for graphql queries and mutations\n * @param {any} request - request to cancel\n * @return {boolean} - A boolean indicating if the request was cancelled\n */\n\n\n GraphQLAPIClass.prototype.cancel = function (request, message) {\n return this._api.cancel(request, message);\n };\n\n GraphQLAPIClass.prototype._graphqlSubscribe = function (_a, additionalHeaders) {\n var query = _a.query,\n variables = _a.variables,\n defaultAuthenticationType = _a.authMode,\n authToken = _a.authToken;\n\n if (additionalHeaders === void 0) {\n additionalHeaders = {};\n }\n\n var _b = this._options,\n region = _b.aws_appsync_region,\n appSyncGraphqlEndpoint = _b.aws_appsync_graphqlEndpoint,\n aws_appsync_authenticationType = _b.aws_appsync_authenticationType,\n apiKey = _b.aws_appsync_apiKey,\n _c = _b.graphql_headers,\n graphql_headers = _c === void 0 ? function () {\n return {};\n } : _c;\n var authenticationType = defaultAuthenticationType || aws_appsync_authenticationType || 'AWS_IAM';\n\n if (PubSub && typeof PubSub.subscribe === 'function') {\n return PubSub.subscribe('', {\n provider: INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER,\n appSyncGraphqlEndpoint: appSyncGraphqlEndpoint,\n authenticationType: authenticationType,\n apiKey: apiKey,\n query: print(query),\n region: region,\n variables: variables,\n graphql_headers: graphql_headers,\n additionalHeaders: additionalHeaders,\n authToken: authToken\n });\n } else {\n logger.debug('No pubsub module applied for subscription');\n throw new Error('No pubsub module applied for subscription');\n }\n };\n /**\n * @private\n */\n\n\n GraphQLAPIClass.prototype._ensureCredentials = function () {\n var _this = this;\n\n return this.Credentials.get().then(function (credentials) {\n if (!credentials) return false;\n\n var cred = _this.Credentials.shear(credentials);\n\n logger.debug('set credentials for api', cred);\n return true;\n }).catch(function (err) {\n logger.warn('ensure credentials error', err);\n return false;\n });\n };\n\n return GraphQLAPIClass;\n}();\n\nexport { GraphQLAPIClass };\nexport var GraphQLAPI = new GraphQLAPIClass(null);\nAmplify.register(GraphQLAPI);","/*\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nvar __assign = this && this.__assign || function () {\n __assign = Object.assign || function (t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n }\n\n return t;\n };\n\n return __assign.apply(this, arguments);\n};\n\nvar __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function (resolve) {\n resolve(value);\n });\n }\n\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n\n function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\n\nvar __generator = this && this.__generator || function (thisArg, body) {\n var _ = {\n label: 0,\n sent: function sent() {\n if (t[0] & 1) throw t[1];\n return t[1];\n },\n trys: [],\n ops: []\n },\n f,\n y,\n t,\n g;\n return g = {\n next: verb(0),\n \"throw\": verb(1),\n \"return\": verb(2)\n }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function () {\n return this;\n }), g;\n\n function verb(n) {\n return function (v) {\n return step([n, v]);\n };\n }\n\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n\n while (_) {\n try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n\n case 4:\n _.label++;\n return {\n value: op[1],\n done: false\n };\n\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n\n case 7:\n op = _.ops.pop();\n\n _.trys.pop();\n\n continue;\n\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n\n if (t && _.label < t[2]) {\n _.label = t[2];\n\n _.ops.push(op);\n\n break;\n }\n\n if (t[2]) _.ops.pop();\n\n _.trys.pop();\n\n continue;\n }\n\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\n }\n }\n\n if (op[0] & 5) throw op[1];\n return {\n value: op[0] ? op[1] : void 0,\n done: true\n };\n }\n};\n\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n }\n\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\n\nimport { ConsoleLogger as Logger, Credentials, DateUtils, Signer, Platform } from '@aws-amplify/core';\nimport axios from 'axios';\nimport { parse, format } from 'url';\nvar logger = new Logger('RestClient');\n/**\n* HTTP Client for REST requests. Send and receive JSON data.\n* Sign request with AWS credentials if available\n* Usage:\n
\nconst restClient = new RestClient();\nrestClient.get('...')\n    .then(function(data) {\n        console.log(data);\n    })\n    .catch(err => console.log(err));\n
\n*/\n\nvar RestClient =\n/** @class */\nfunction () {\n /**\n * @param {RestClientOptions} [options] - Instance options\n */\n function RestClient(options) {\n this._region = 'us-east-1'; // this will be updated by endpoint function\n\n this._service = 'execute-api'; // this can be updated by endpoint function\n\n this._custom_header = undefined; // this can be updated by endpoint function\n\n /**\n * This weak map provides functionality to let clients cancel\n * in-flight axios requests. https://github.com/axios/axios#cancellation\n *\n * 1. For every axios request, a unique cancel token is generated and added in the request.\n * 2. Promise for fulfilling the request is then mapped to that unique cancel token.\n * 3. The promise is returned to the client.\n * 4. Clients can either wait for the promise to fulfill or call `API.cancel(promise)` to cancel the request.\n * 5. If `API.cancel(promise)` is called, then the corresponding cancel token is retrieved from the map below.\n * 6. Promise returned to the client will be in rejected state with the error provided during cancel.\n * 7. Clients can check if the error is because of cancelling by calling `API.isCancel(error)`.\n *\n * For more details, see https://github.com/aws-amplify/amplify-js/pull/3769#issuecomment-552660025\n */\n\n this._cancelTokenMap = null;\n this.Credentials = Credentials;\n this._options = options;\n logger.debug('API Options', this._options);\n\n if (this._cancelTokenMap == null) {\n this._cancelTokenMap = new WeakMap();\n }\n }\n /**\n * Update AWS credentials\n * @param {AWSCredentials} credentials - AWS credentials\n *\n updateCredentials(credentials: AWSCredentials) {\n this.options.credentials = credentials;\n }\n */\n\n /**\n * Basic HTTP request. Customizable\n * @param {string | ApiInfo } urlOrApiInfo - Full request URL or Api information\n * @param {string} method - Request HTTP method\n * @param {json} [init] - Request extra params\n * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.\n */\n\n\n RestClient.prototype.ajax = function (urlOrApiInfo, method, init) {\n return __awaiter(this, void 0, void 0, function () {\n var parsed_url, url, region, service, custom_header, params, libraryHeaders, userAgent, initParams, isAllResponse, custom_header_obj, _a, _b, search, parsedUrl;\n\n var _this = this;\n\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n logger.debug(method, urlOrApiInfo);\n region = 'us-east-1';\n service = 'execute-api';\n custom_header = undefined;\n\n if (typeof urlOrApiInfo === 'string') {\n parsed_url = this._parseUrl(urlOrApiInfo);\n url = urlOrApiInfo;\n } else {\n url = urlOrApiInfo.endpoint, custom_header = urlOrApiInfo.custom_header, region = urlOrApiInfo.region, service = urlOrApiInfo.service;\n parsed_url = this._parseUrl(urlOrApiInfo.endpoint);\n }\n\n params = {\n method: method,\n url: url,\n host: parsed_url.host,\n path: parsed_url.path,\n headers: {},\n data: null,\n responseType: 'json',\n timeout: 0,\n cancelToken: null\n };\n libraryHeaders = {};\n\n if (Platform.isReactNative) {\n userAgent = Platform.userAgent || 'aws-amplify/0.1.x';\n libraryHeaders = {\n 'User-Agent': userAgent\n };\n }\n\n initParams = Object.assign({}, init);\n isAllResponse = initParams.response;\n\n if (initParams.body) {\n if (typeof FormData === 'function' && initParams.body instanceof FormData) {\n libraryHeaders['Content-Type'] = 'multipart/form-data';\n params.data = initParams.body;\n } else {\n libraryHeaders['Content-Type'] = 'application/json; charset=UTF-8';\n params.data = JSON.stringify(initParams.body);\n }\n }\n\n if (initParams.responseType) {\n params.responseType = initParams.responseType;\n }\n\n if (initParams.withCredentials) {\n params['withCredentials'] = initParams.withCredentials;\n }\n\n if (initParams.timeout) {\n params.timeout = initParams.timeout;\n }\n\n if (initParams.cancellableToken) {\n params.cancelToken = initParams.cancellableToken.token;\n }\n\n params['signerServiceInfo'] = initParams.signerServiceInfo;\n if (!(typeof custom_header === 'function')) return [3\n /*break*/\n , 2];\n return [4\n /*yield*/\n , custom_header()];\n\n case 1:\n _a = _c.sent();\n return [3\n /*break*/\n , 3];\n\n case 2:\n _a = undefined;\n _c.label = 3;\n\n case 3:\n custom_header_obj = _a;\n params.headers = __assign(__assign(__assign({}, libraryHeaders), custom_header_obj), initParams.headers);\n _b = parse(url, true, true), search = _b.search, parsedUrl = __rest(_b, [\"search\"]);\n params.url = format(__assign(__assign({}, parsedUrl), {\n query: __assign(__assign({}, parsedUrl.query), initParams.queryStringParameters || {})\n })); // Do not sign the request if client has added 'Authorization' header,\n // which means custom authorizer.\n\n if (typeof params.headers['Authorization'] !== 'undefined') {\n params.headers = Object.keys(params.headers).reduce(function (acc, k) {\n if (params.headers[k]) {\n acc[k] = params.headers[k];\n }\n\n return acc; // tslint:disable-next-line:align\n }, {});\n return [2\n /*return*/\n , this._request(params, isAllResponse)];\n } // Signing the request in case there credentials are available\n\n\n return [2\n /*return*/\n , this.Credentials.get().then(function (credentials) {\n return _this._signed(__assign({}, params), credentials, isAllResponse, {\n region: region,\n service: service\n }).catch(function (error) {\n if (DateUtils.isClockSkewError(error)) {\n var headers = error.response.headers;\n var dateHeader = headers && (headers.date || headers.Date);\n var responseDate = new Date(dateHeader);\n var requestDate = DateUtils.getDateFromHeaderString(params.headers['x-amz-date']); // Compare local clock to the server clock\n\n if (DateUtils.isClockSkewed(responseDate)) {\n DateUtils.setClockOffset(responseDate.getTime() - requestDate.getTime());\n return _this.ajax(urlOrApiInfo, method, init);\n }\n }\n\n throw error;\n });\n }, function (err) {\n logger.debug('No credentials available, the request will be unsigned');\n return _this._request(params, isAllResponse);\n })];\n }\n });\n });\n };\n /**\n * GET HTTP request\n * @param {string | ApiInfo } urlOrApiInfo - Full request URL or Api information\n * @param {JSON} init - Request extra params\n * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.\n */\n\n\n RestClient.prototype.get = function (urlOrApiInfo, init) {\n return this.ajax(urlOrApiInfo, 'GET', init);\n };\n /**\n * PUT HTTP request\n * @param {string | ApiInfo } urlOrApiInfo - Full request URL or Api information\n * @param {json} init - Request extra params\n * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.\n */\n\n\n RestClient.prototype.put = function (urlOrApiInfo, init) {\n return this.ajax(urlOrApiInfo, 'PUT', init);\n };\n /**\n * PATCH HTTP request\n * @param {string | ApiInfo } urlOrApiInfo - Full request URL or Api information\n * @param {json} init - Request extra params\n * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.\n */\n\n\n RestClient.prototype.patch = function (urlOrApiInfo, init) {\n return this.ajax(urlOrApiInfo, 'PATCH', init);\n };\n /**\n * POST HTTP request\n * @param {string | ApiInfo } urlOrApiInfo - Full request URL or Api information\n * @param {json} init - Request extra params\n * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.\n */\n\n\n RestClient.prototype.post = function (urlOrApiInfo, init) {\n return this.ajax(urlOrApiInfo, 'POST', init);\n };\n /**\n * DELETE HTTP request\n * @param {string | ApiInfo } urlOrApiInfo - Full request URL or Api information\n * @param {json} init - Request extra params\n * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.\n */\n\n\n RestClient.prototype.del = function (urlOrApiInfo, init) {\n return this.ajax(urlOrApiInfo, 'DELETE', init);\n };\n /**\n * HEAD HTTP request\n * @param {string | ApiInfo } urlOrApiInfo - Full request URL or Api information\n * @param {json} init - Request extra params\n * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.\n */\n\n\n RestClient.prototype.head = function (urlOrApiInfo, init) {\n return this.ajax(urlOrApiInfo, 'HEAD', init);\n };\n /**\n * Cancel an inflight API request\n * @param {Promise} request - The request promise to cancel\n * @param {string} [message] - A message to include in the cancelation exception\n */\n\n\n RestClient.prototype.cancel = function (request, message) {\n var source = this._cancelTokenMap.get(request);\n\n if (source) {\n source.cancel(message);\n }\n\n return true;\n };\n /**\n * Checks to see if an error thrown is from an api request cancellation\n * @param {any} error - Any error\n * @return {boolean} - A boolean indicating if the error was from an api request cancellation\n */\n\n\n RestClient.prototype.isCancel = function (error) {\n return axios.isCancel(error);\n };\n /**\n * Retrieves a new and unique cancel token which can be\n * provided in an axios request to be cancelled later.\n */\n\n\n RestClient.prototype.getCancellableToken = function () {\n return axios.CancelToken.source();\n };\n /**\n * Updates the weakmap with a response promise and its\n * cancel token such that the cancel token can be easily\n * retrieved (and used for cancelling the request)\n */\n\n\n RestClient.prototype.updateRequestToBeCancellable = function (promise, cancelTokenSource) {\n this._cancelTokenMap.set(promise, cancelTokenSource);\n };\n /**\n * Getting endpoint for API\n * @param {string} apiName - The name of the api\n * @return {string} - The endpoint of the api\n */\n\n\n RestClient.prototype.endpoint = function (apiName) {\n var _this = this;\n\n var cloud_logic_array = this._options.endpoints;\n var response = '';\n\n if (!Array.isArray(cloud_logic_array)) {\n return response;\n }\n\n cloud_logic_array.forEach(function (v) {\n if (v.name === apiName) {\n response = v.endpoint;\n\n if (typeof v.region === 'string') {\n _this._region = v.region;\n } else if (typeof _this._options.region === 'string') {\n _this._region = _this._options.region;\n }\n\n if (typeof v.service === 'string') {\n _this._service = v.service || 'execute-api';\n } else {\n _this._service = 'execute-api';\n }\n\n if (typeof v.custom_header === 'function') {\n _this._custom_header = v.custom_header;\n } else {\n _this._custom_header = undefined;\n }\n }\n });\n return response;\n };\n /** private methods **/\n\n\n RestClient.prototype._signed = function (params, credentials, isAllResponse, _a) {\n var service = _a.service,\n region = _a.region;\n\n var signerServiceInfoParams = params.signerServiceInfo,\n otherParams = __rest(params, [\"signerServiceInfo\"]);\n\n var endpoint_region = region || this._region || this._options.region;\n var endpoint_service = service || this._service || this._options.service;\n var creds = {\n secret_key: credentials.secretAccessKey,\n access_key: credentials.accessKeyId,\n session_token: credentials.sessionToken\n };\n var endpointInfo = {\n region: endpoint_region,\n service: endpoint_service\n };\n var signerServiceInfo = Object.assign(endpointInfo, signerServiceInfoParams);\n var signed_params = Signer.sign(otherParams, creds, signerServiceInfo);\n\n if (signed_params.data) {\n signed_params.body = signed_params.data;\n }\n\n logger.debug('Signed Request: ', signed_params);\n delete signed_params.headers['host'];\n return axios(signed_params).then(function (response) {\n return isAllResponse ? response : response.data;\n }).catch(function (error) {\n logger.debug(error);\n throw error;\n });\n };\n\n RestClient.prototype._request = function (params, isAllResponse) {\n if (isAllResponse === void 0) {\n isAllResponse = false;\n }\n\n return axios(params).then(function (response) {\n return isAllResponse ? response : response.data;\n }).catch(function (error) {\n logger.debug(error);\n throw error;\n });\n };\n\n RestClient.prototype._parseUrl = function (url) {\n var parts = url.split('/');\n return {\n host: parts[2],\n path: '/' + parts.slice(3).join('/')\n };\n };\n\n return RestClient;\n}();\n\nexport { RestClient };","var __assign = this && this.__assign || function () {\n __assign = Object.assign || function (t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n }\n\n return t;\n };\n\n return __assign.apply(this, arguments);\n};\n\nvar __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function (resolve) {\n resolve(value);\n });\n }\n\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n\n function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\n\nvar __generator = this && this.__generator || function (thisArg, body) {\n var _ = {\n label: 0,\n sent: function sent() {\n if (t[0] & 1) throw t[1];\n return t[1];\n },\n trys: [],\n ops: []\n },\n f,\n y,\n t,\n g;\n return g = {\n next: verb(0),\n \"throw\": verb(1),\n \"return\": verb(2)\n }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function () {\n return this;\n }), g;\n\n function verb(n) {\n return function (v) {\n return step([n, v]);\n };\n }\n\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n\n while (_) {\n try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n\n case 4:\n _.label++;\n return {\n value: op[1],\n done: false\n };\n\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n\n case 7:\n op = _.ops.pop();\n\n _.trys.pop();\n\n continue;\n\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n\n if (t && _.label < t[2]) {\n _.label = t[2];\n\n _.ops.push(op);\n\n break;\n }\n\n if (t[2]) _.ops.pop();\n\n _.trys.pop();\n\n continue;\n }\n\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\n }\n }\n\n if (op[0] & 5) throw op[1];\n return {\n value: op[0] ? op[1] : void 0,\n done: true\n };\n }\n};\n\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n }\n\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\n/*\n * Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\n\n\nimport { RestClient } from './RestClient';\nimport { Amplify, ConsoleLogger as Logger, Credentials } from '@aws-amplify/core';\nvar logger = new Logger('RestAPI');\n/**\n * Export Cloud Logic APIs\n */\n\nvar RestAPIClass =\n/** @class */\nfunction () {\n /**\n * Initialize Rest API with AWS configuration\n * @param {Object} options - Configuration object for API\n */\n function RestAPIClass(options) {\n this._api = null;\n this.Credentials = Credentials;\n this._options = options;\n logger.debug('API Options', this._options);\n }\n\n RestAPIClass.prototype.getModuleName = function () {\n return 'RestAPI';\n };\n /**\n * Configure API part with aws configurations\n * @param {Object} config - Configuration of the API\n * @return {Object} - The current configuration\n */\n\n\n RestAPIClass.prototype.configure = function (options) {\n var _a = options || {},\n _b = _a.API,\n API = _b === void 0 ? {} : _b,\n otherOptions = __rest(_a, [\"API\"]);\n\n var opt = __assign(__assign({}, otherOptions), API);\n\n logger.debug('configure Rest API', {\n opt: opt\n });\n\n if (opt['aws_project_region']) {\n if (opt['aws_cloud_logic_custom']) {\n var custom = opt['aws_cloud_logic_custom'];\n opt.endpoints = typeof custom === 'string' ? JSON.parse(custom) : custom;\n }\n\n opt = Object.assign({}, opt, {\n region: opt['aws_project_region'],\n header: {}\n });\n }\n\n if (Array.isArray(opt.endpoints)) {\n // Check if endpoints has custom_headers and validate if is a function\n opt.endpoints.forEach(function (endpoint) {\n if (typeof endpoint.custom_header !== 'undefined' && typeof endpoint.custom_header !== 'function') {\n logger.warn('Rest API ' + endpoint.name + ', custom_header should be a function');\n endpoint.custom_header = undefined;\n }\n });\n } else if (this._options && Array.isArray(this._options.endpoints)) {\n opt.endpoints = this._options.endpoints;\n } else {\n opt.endpoints = [];\n }\n\n this._options = Object.assign({}, this._options, opt);\n this.createInstance();\n return this._options;\n };\n /**\n * Create an instance of API for the library\n * @return - A promise of true if Success\n */\n\n\n RestAPIClass.prototype.createInstance = function () {\n logger.debug('create Rest API instance');\n this._api = new RestClient(this._options); // Share Amplify instance with client for SSR\n\n this._api.Credentials = this.Credentials;\n return true;\n };\n /**\n * Make a GET request\n * @param {string} apiName - The api name of the request\n * @param {string} path - The path of the request\n * @param {json} [init] - Request extra params\n * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.\n */\n\n\n RestAPIClass.prototype.get = function (apiName, path, init) {\n try {\n var apiInfo = this.getEndpointInfo(apiName, path);\n\n var cancellableToken = this._api.getCancellableToken();\n\n var initParams = Object.assign({}, init);\n initParams.cancellableToken = cancellableToken;\n\n var responsePromise = this._api.get(apiInfo, initParams);\n\n this._api.updateRequestToBeCancellable(responsePromise, cancellableToken);\n\n return responsePromise;\n } catch (err) {\n return Promise.reject(err.message);\n }\n };\n /**\n * Make a POST request\n * @param {string} apiName - The api name of the request\n * @param {string} path - The path of the request\n * @param {json} [init] - Request extra params\n * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.\n */\n\n\n RestAPIClass.prototype.post = function (apiName, path, init) {\n try {\n var apiInfo = this.getEndpointInfo(apiName, path);\n\n var cancellableToken = this._api.getCancellableToken();\n\n var initParams = Object.assign({}, init);\n initParams.cancellableToken = cancellableToken;\n\n var responsePromise = this._api.post(apiInfo, initParams);\n\n this._api.updateRequestToBeCancellable(responsePromise, cancellableToken);\n\n return responsePromise;\n } catch (err) {\n return Promise.reject(err.message);\n }\n };\n /**\n * Make a PUT request\n * @param {string} apiName - The api name of the request\n * @param {string} path - The path of the request\n * @param {json} [init] - Request extra params\n * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.\n */\n\n\n RestAPIClass.prototype.put = function (apiName, path, init) {\n try {\n var apiInfo = this.getEndpointInfo(apiName, path);\n\n var cancellableToken = this._api.getCancellableToken();\n\n var initParams = Object.assign({}, init);\n initParams.cancellableToken = cancellableToken;\n\n var responsePromise = this._api.put(apiInfo, initParams);\n\n this._api.updateRequestToBeCancellable(responsePromise, cancellableToken);\n\n return responsePromise;\n } catch (err) {\n return Promise.reject(err.message);\n }\n };\n /**\n * Make a PATCH request\n * @param {string} apiName - The api name of the request\n * @param {string} path - The path of the request\n * @param {json} [init] - Request extra params\n * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.\n */\n\n\n RestAPIClass.prototype.patch = function (apiName, path, init) {\n try {\n var apiInfo = this.getEndpointInfo(apiName, path);\n\n var cancellableToken = this._api.getCancellableToken();\n\n var initParams = Object.assign({}, init);\n initParams.cancellableToken = cancellableToken;\n\n var responsePromise = this._api.patch(apiInfo, initParams);\n\n this._api.updateRequestToBeCancellable(responsePromise, cancellableToken);\n\n return responsePromise;\n } catch (err) {\n return Promise.reject(err.message);\n }\n };\n /**\n * Make a DEL request\n * @param {string} apiName - The api name of the request\n * @param {string} path - The path of the request\n * @param {json} [init] - Request extra params\n * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.\n */\n\n\n RestAPIClass.prototype.del = function (apiName, path, init) {\n try {\n var apiInfo = this.getEndpointInfo(apiName, path);\n\n var cancellableToken = this._api.getCancellableToken();\n\n var initParams = Object.assign({}, init);\n initParams.cancellableToken = cancellableToken;\n\n var responsePromise = this._api.del(apiInfo, initParams);\n\n this._api.updateRequestToBeCancellable(responsePromise, cancellableToken);\n\n return responsePromise;\n } catch (err) {\n return Promise.reject(err.message);\n }\n };\n /**\n * Make a HEAD request\n * @param {string} apiName - The api name of the request\n * @param {string} path - The path of the request\n * @param {json} [init] - Request extra params\n * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.\n */\n\n\n RestAPIClass.prototype.head = function (apiName, path, init) {\n try {\n var apiInfo = this.getEndpointInfo(apiName, path);\n\n var cancellableToken = this._api.getCancellableToken();\n\n var initParams = Object.assign({}, init);\n initParams.cancellableToken = cancellableToken;\n\n var responsePromise = this._api.head(apiInfo, initParams);\n\n this._api.updateRequestToBeCancellable(responsePromise, cancellableToken);\n\n return responsePromise;\n } catch (err) {\n return Promise.reject(err.message);\n }\n };\n /**\n * Checks to see if an error thrown is from an api request cancellation\n * @param {any} error - Any error\n * @return {boolean} - A boolean indicating if the error was from an api request cancellation\n */\n\n\n RestAPIClass.prototype.isCancel = function (error) {\n return this._api.isCancel(error);\n };\n /**\n * Cancels an inflight request\n * @param {any} request - request to cancel\n * @return {boolean} - A boolean indicating if the request was cancelled\n */\n\n\n RestAPIClass.prototype.cancel = function (request, message) {\n return this._api.cancel(request, message);\n };\n /**\n * Getting endpoint for API\n * @param {string} apiName - The name of the api\n * @return {string} - The endpoint of the api\n */\n\n\n RestAPIClass.prototype.endpoint = function (apiName) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2\n /*return*/\n , this._api.endpoint(apiName)];\n });\n });\n };\n /**\n * Getting endpoint info for API\n * @param {string} apiName - The name of the api\n * @param {string} path - The path of the api that is going to accessed\n * @return {ApiInfo} - The endpoint information for that api-name\n */\n\n\n RestAPIClass.prototype.getEndpointInfo = function (apiName, path) {\n var cloud_logic_array = this._options.endpoints;\n\n if (!Array.isArray(cloud_logic_array)) {\n throw new Error(\"API category not configured\");\n }\n\n var apiConfig = cloud_logic_array.find(function (api) {\n return api.name === apiName;\n });\n\n if (!apiConfig) {\n throw new Error(\"API \" + apiName + \" does not exist\");\n }\n\n var response = {\n endpoint: apiConfig.endpoint + path\n };\n\n if (typeof apiConfig.region === 'string') {\n response.region = apiConfig.region;\n } else if (typeof this._options.region === 'string') {\n response.region = this._options.region;\n }\n\n if (typeof apiConfig.service === 'string') {\n response.service = apiConfig.service || 'execute-api';\n } else {\n response.service = 'execute-api';\n }\n\n if (typeof apiConfig.custom_header === 'function') {\n response.custom_header = apiConfig.custom_header;\n } else {\n response.custom_header = undefined;\n }\n\n return response;\n };\n\n return RestAPIClass;\n}();\n\nexport { RestAPIClass };\nexport var RestAPI = new RestAPIClass(null);\nAmplify.register(RestAPI);","var __assign = this && this.__assign || function () {\n __assign = Object.assign || function (t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n }\n\n return t;\n };\n\n return __assign.apply(this, arguments);\n};\n\nvar __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function (resolve) {\n resolve(value);\n });\n }\n\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n\n function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\n\nvar __generator = this && this.__generator || function (thisArg, body) {\n var _ = {\n label: 0,\n sent: function sent() {\n if (t[0] & 1) throw t[1];\n return t[1];\n },\n trys: [],\n ops: []\n },\n f,\n y,\n t,\n g;\n return g = {\n next: verb(0),\n \"throw\": verb(1),\n \"return\": verb(2)\n }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function () {\n return this;\n }), g;\n\n function verb(n) {\n return function (v) {\n return step([n, v]);\n };\n }\n\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n\n while (_) {\n try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n\n case 4:\n _.label++;\n return {\n value: op[1],\n done: false\n };\n\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n\n case 7:\n op = _.ops.pop();\n\n _.trys.pop();\n\n continue;\n\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n\n if (t && _.label < t[2]) {\n _.label = t[2];\n\n _.ops.push(op);\n\n break;\n }\n\n if (t[2]) _.ops.pop();\n\n _.trys.pop();\n\n continue;\n }\n\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\n }\n }\n\n if (op[0] & 5) throw op[1];\n return {\n value: op[0] ? op[1] : void 0,\n done: true\n };\n }\n};\n/*\n * Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\n\n\nimport { Auth } from '@aws-amplify/auth';\nimport Cache from '@aws-amplify/cache';\nimport { RestAPIClass } from '@aws-amplify/api-rest';\nimport { GraphQLAPIClass } from '@aws-amplify/api-graphql';\nimport { Amplify, ConsoleLogger as Logger, Credentials } from '@aws-amplify/core';\nvar logger = new Logger('API');\n/**\n * @deprecated\n * Use RestApi or GraphQLAPI to reduce your application bundle size\n * Export Cloud Logic APIs\n */\n\nvar APIClass =\n/** @class */\nfunction () {\n /**\n * Initialize API with AWS configuration\n * @param {Object} options - Configuration object for API\n */\n function APIClass(options) {\n this.Auth = Auth;\n this.Cache = Cache;\n this.Credentials = Credentials;\n this._options = options;\n this._restApi = new RestAPIClass(options);\n this._graphqlApi = new GraphQLAPIClass(options);\n logger.debug('API Options', this._options);\n }\n\n APIClass.prototype.getModuleName = function () {\n return 'API';\n };\n /**\n * Configure API part with aws configurations\n * @param {Object} config - Configuration of the API\n * @return {Object} - The current configuration\n */\n\n\n APIClass.prototype.configure = function (options) {\n this._options = Object.assign({}, this._options, options); // Share Amplify instance with client for SSR\n\n this._restApi.Credentials = this.Credentials;\n this._graphqlApi.Auth = this.Auth;\n this._graphqlApi.Cache = this.Cache;\n this._graphqlApi.Credentials = this.Credentials;\n\n var restAPIConfig = this._restApi.configure(this._options);\n\n var graphQLAPIConfig = this._graphqlApi.configure(this._options);\n\n return __assign(__assign({}, restAPIConfig), graphQLAPIConfig);\n };\n /**\n * Make a GET request\n * @param {string} apiName - The api name of the request\n * @param {string} path - The path of the request\n * @param {json} [init] - Request extra params\n * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.\n */\n\n\n APIClass.prototype.get = function (apiName, path, init) {\n return this._restApi.get(apiName, path, init);\n };\n /**\n * Make a POST request\n * @param {string} apiName - The api name of the request\n * @param {string} path - The path of the request\n * @param {json} [init] - Request extra params\n * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.\n */\n\n\n APIClass.prototype.post = function (apiName, path, init) {\n return this._restApi.post(apiName, path, init);\n };\n /**\n * Make a PUT request\n * @param {string} apiName - The api name of the request\n * @param {string} path - The path of the request\n * @param {json} [init] - Request extra params\n * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.\n */\n\n\n APIClass.prototype.put = function (apiName, path, init) {\n return this._restApi.put(apiName, path, init);\n };\n /**\n * Make a PATCH request\n * @param {string} apiName - The api name of the request\n * @param {string} path - The path of the request\n * @param {json} [init] - Request extra params\n * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.\n */\n\n\n APIClass.prototype.patch = function (apiName, path, init) {\n return this._restApi.patch(apiName, path, init);\n };\n /**\n * Make a DEL request\n * @param {string} apiName - The api name of the request\n * @param {string} path - The path of the request\n * @param {json} [init] - Request extra params\n * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.\n */\n\n\n APIClass.prototype.del = function (apiName, path, init) {\n return this._restApi.del(apiName, path, init);\n };\n /**\n * Make a HEAD request\n * @param {string} apiName - The api name of the request\n * @param {string} path - The path of the request\n * @param {json} [init] - Request extra params\n * @return {Promise} - A promise that resolves to an object with response status and JSON data, if successful.\n */\n\n\n APIClass.prototype.head = function (apiName, path, init) {\n return this._restApi.head(apiName, path, init);\n };\n /**\n * Checks to see if an error thrown is from an api request cancellation\n * @param {any} error - Any error\n * @return {boolean} - A boolean indicating if the error was from an api request cancellation\n */\n\n\n APIClass.prototype.isCancel = function (error) {\n return this._restApi.isCancel(error);\n };\n /**\n * Cancels an inflight request\n * @param {any} request - request to cancel\n * @return {boolean} - A boolean indicating if the request was cancelled\n */\n\n\n APIClass.prototype.cancel = function (request, message) {\n return this._restApi.cancel(request, message);\n };\n /**\n * Getting endpoint for API\n * @param {string} apiName - The name of the api\n * @return {string} - The endpoint of the api\n */\n\n\n APIClass.prototype.endpoint = function (apiName) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2\n /*return*/\n , this._restApi.endpoint(apiName)];\n });\n });\n };\n /**\n * to get the operation type\n * @param operation\n */\n\n\n APIClass.prototype.getGraphqlOperationType = function (operation) {\n return this._graphqlApi.getGraphqlOperationType(operation);\n };\n /**\n * Executes a GraphQL operation\n *\n * @param {GraphQLOptions} GraphQL Options\n * @param {object} additionalHeaders headers to merge in after any `graphql_headers` set in the config\n * @returns {Promise | Observable}\n */\n\n\n APIClass.prototype.graphql = function (options, additionalHeaders) {\n return this._graphqlApi.graphql(options, additionalHeaders);\n };\n\n return APIClass;\n}();\n\nexport { APIClass };\nexport var API = new APIClass(null);\nAmplify.register(API);","/*\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nimport { Auth } from './Auth';\nimport { CognitoHostedUIIdentityProvider } from './types/Auth';\nimport { CognitoUser, CookieStorage, appendToCognitoUserAgent } from 'amazon-cognito-identity-js';\nimport { AuthErrorStrings } from './common/AuthErrorStrings';\n/**\n * @deprecated use named import\n */\n\nexport default Auth;\nexport { Auth, CognitoUser, CookieStorage, CognitoHostedUIIdentityProvider, appendToCognitoUserAgent, AuthErrorStrings };","/*\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nimport { ConsoleLogger as Logger } from '../Logger';\nvar logger = new Logger('I18n');\n/**\n * Language transition class\n */\n\nvar I18n =\n/** @class */\nfunction () {\n /**\n * @constructor\n * Initialize with configurations\n * @param {Object} options\n */\n function I18n(options) {\n /**\n * @private\n */\n this._options = null;\n /**\n * @private\n */\n\n this._lang = null;\n /**\n * @private\n */\n\n this._dict = {};\n this._options = Object.assign({}, options);\n this._lang = this._options.language;\n\n if (!this._lang && typeof window !== 'undefined' && window && window.navigator) {\n this._lang = window.navigator.language;\n }\n\n logger.debug(this._lang);\n }\n /**\n * @method\n * Explicitly setting language\n * @param {String} lang\n */\n\n\n I18n.prototype.setLanguage = function (lang) {\n this._lang = lang;\n };\n /**\n * @method\n * Get value\n * @param {String} key\n * @param {String} defVal - Default value\n */\n\n\n I18n.prototype.get = function (key, defVal) {\n if (defVal === void 0) {\n defVal = undefined;\n }\n\n if (!this._lang) {\n return typeof defVal !== 'undefined' ? defVal : key;\n }\n\n var lang = this._lang;\n var val = this.getByLanguage(key, lang);\n\n if (val) {\n return val;\n }\n\n if (lang.indexOf('-') > 0) {\n val = this.getByLanguage(key, lang.split('-')[0]);\n }\n\n if (val) {\n return val;\n }\n\n return typeof defVal !== 'undefined' ? defVal : key;\n };\n /**\n * @method\n * Get value according to specified language\n * @param {String} key\n * @param {String} language - Specified langurage to be used\n * @param {String} defVal - Default value\n */\n\n\n I18n.prototype.getByLanguage = function (key, language, defVal) {\n if (defVal === void 0) {\n defVal = null;\n }\n\n if (!language) {\n return defVal;\n }\n\n var lang_dict = this._dict[language];\n\n if (!lang_dict) {\n return defVal;\n }\n\n return lang_dict[key];\n };\n /**\n * @method\n * Add vocabularies for one language\n * @param {String} language - Language of the dictionary\n * @param {Object} vocabularies - Object that has key-value as dictionary entry\n */\n\n\n I18n.prototype.putVocabulariesForLanguage = function (language, vocabularies) {\n var lang_dict = this._dict[language];\n\n if (!lang_dict) {\n lang_dict = this._dict[language] = {};\n }\n\n Object.assign(lang_dict, vocabularies);\n };\n /**\n * @method\n * Add vocabularies for one language\n * @param {Object} vocabularies - Object that has language as key,\n * vocabularies of each language as value\n */\n\n\n I18n.prototype.putVocabularies = function (vocabularies) {\n var _this = this;\n\n Object.keys(vocabularies).map(function (key) {\n _this.putVocabulariesForLanguage(key, vocabularies[key]);\n });\n };\n\n return I18n;\n}();\n\nexport { I18n };","/*\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nimport { I18n as I18nClass } from './I18n';\nimport { ConsoleLogger as Logger } from '../Logger';\nimport { Amplify } from '../Amplify';\nvar logger = new Logger('I18n');\nvar _config = null;\nvar _i18n = null;\n/**\n * Export I18n APIs\n */\n\nvar I18n =\n/** @class */\nfunction () {\n function I18n() {}\n /**\n * @static\n * @method\n * Configure I18n part\n * @param {Object} config - Configuration of the I18n\n */\n\n\n I18n.configure = function (config) {\n logger.debug('configure I18n');\n\n if (!config) {\n return _config;\n }\n\n _config = Object.assign({}, _config, config.I18n || config);\n I18n.createInstance();\n return _config;\n };\n\n I18n.getModuleName = function () {\n return 'I18n';\n };\n /**\n * @static\n * @method\n * Create an instance of I18n for the library\n */\n\n\n I18n.createInstance = function () {\n logger.debug('create I18n instance');\n\n if (_i18n) {\n return;\n }\n\n _i18n = new I18nClass(_config);\n };\n /**\n * @static @method\n * Explicitly setting language\n * @param {String} lang\n */\n\n\n I18n.setLanguage = function (lang) {\n I18n.checkConfig();\n return _i18n.setLanguage(lang);\n };\n /**\n * @static @method\n * Get value\n * @param {String} key\n * @param {String} defVal - Default value\n */\n\n\n I18n.get = function (key, defVal) {\n if (!I18n.checkConfig()) {\n return typeof defVal === 'undefined' ? key : defVal;\n }\n\n return _i18n.get(key, defVal);\n };\n /**\n * @static\n * @method\n * Add vocabularies for one language\n * @param {String} langurage - Language of the dictionary\n * @param {Object} vocabularies - Object that has key-value as dictionary entry\n */\n\n\n I18n.putVocabulariesForLanguage = function (language, vocabularies) {\n I18n.checkConfig();\n return _i18n.putVocabulariesForLanguage(language, vocabularies);\n };\n /**\n * @static\n * @method\n * Add vocabularies for one language\n * @param {Object} vocabularies - Object that has language as key,\n * vocabularies of each language as value\n */\n\n\n I18n.putVocabularies = function (vocabularies) {\n I18n.checkConfig();\n return _i18n.putVocabularies(vocabularies);\n };\n\n I18n.checkConfig = function () {\n if (!_i18n) {\n _i18n = new I18nClass(_config);\n }\n\n return true;\n };\n\n return I18n;\n}();\n\nexport { I18n };\nAmplify.register(I18n);\n/**\n * @deprecated use named import\n */\n\nexport default I18n;","/*\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nvar __assign = this && this.__assign || function () {\n __assign = Object.assign || function (t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n }\n\n return t;\n };\n\n return __assign.apply(this, arguments);\n};\n\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n }\n\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\n\nimport { ConsoleLogger as Logger } from './Logger';\nimport { Sha256 as jsSha256 } from '@aws-crypto/sha256-js';\nimport { toHex } from '@aws-sdk/util-hex-encoding';\nimport { parse, format } from 'url';\nimport { DateUtils } from './Util';\nvar logger = new Logger('Signer');\nvar DEFAULT_ALGORITHM = 'AWS4-HMAC-SHA256';\nvar IOT_SERVICE_NAME = 'iotdevicegateway';\n\nvar encrypt = function encrypt(key, src) {\n var hash = new jsSha256(key);\n hash.update(src);\n return hash.digestSync();\n};\n\nvar hash = function hash(src) {\n var arg = src || '';\n var hash = new jsSha256();\n hash.update(arg);\n return toHex(hash.digestSync());\n};\n/**\n * @private\n * RFC 3986 compliant version of encodeURIComponent\n */\n\n\nvar escape_RFC3986 = function escape_RFC3986(component) {\n return component.replace(/[!'()*]/g, function (c) {\n return '%' + c.charCodeAt(0).toString(16).toUpperCase();\n });\n};\n/**\n * @private\n * Create canonical query string\n *\n */\n\n\nvar canonical_query = function canonical_query(query) {\n if (!query || query.length === 0) {\n return '';\n }\n\n return query.split('&').map(function (e) {\n var key_val = e.split('=');\n\n if (key_val.length === 1) {\n return e;\n } else {\n var reencoded_val = escape_RFC3986(key_val[1]);\n return key_val[0] + '=' + reencoded_val;\n }\n }).sort(function (a, b) {\n var key_a = a.split('=')[0];\n var key_b = b.split('=')[0];\n\n if (key_a === key_b) {\n return a < b ? -1 : 1;\n } else {\n return key_a < key_b ? -1 : 1;\n }\n }).join('&');\n};\n/**\n* @private\n* Create canonical headers\n*\n
\nCanonicalHeaders =\n    CanonicalHeadersEntry0 + CanonicalHeadersEntry1 + ... + CanonicalHeadersEntryN\nCanonicalHeadersEntry =\n    Lowercase(HeaderName) + ':' + Trimall(HeaderValue) + '\\n'\n
\n*/\n\n\nvar canonical_headers = function canonical_headers(headers) {\n if (!headers || Object.keys(headers).length === 0) {\n return '';\n }\n\n return Object.keys(headers).map(function (key) {\n return {\n key: key.toLowerCase(),\n value: headers[key] ? headers[key].trim().replace(/\\s+/g, ' ') : ''\n };\n }).sort(function (a, b) {\n return a.key < b.key ? -1 : 1;\n }).map(function (item) {\n return item.key + ':' + item.value;\n }).join('\\n') + '\\n';\n};\n/**\n * List of header keys included in the canonical headers.\n * @access private\n */\n\n\nvar signed_headers = function signed_headers(headers) {\n return Object.keys(headers).map(function (key) {\n return key.toLowerCase();\n }).sort().join(';');\n};\n/**\n* @private\n* Create canonical request\n* Refer to\n* {@link http://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html|Create a Canonical Request}\n*\n
\nCanonicalRequest =\n    HTTPRequestMethod + '\\n' +\n    CanonicalURI + '\\n' +\n    CanonicalQueryString + '\\n' +\n    CanonicalHeaders + '\\n' +\n    SignedHeaders + '\\n' +\n    HexEncode(Hash(RequestPayload))\n
\n*/\n\n\nvar canonical_request = function canonical_request(request) {\n var url_info = parse(request.url);\n return [request.method || '/', encodeURIComponent(url_info.pathname).replace(/%2F/gi, '/'), canonical_query(url_info.query), canonical_headers(request.headers), signed_headers(request.headers), hash(request.data)].join('\\n');\n};\n\nvar parse_service_info = function parse_service_info(request) {\n var url_info = parse(request.url),\n host = url_info.host;\n var matched = host.match(/([^\\.]+)\\.(?:([^\\.]*)\\.)?amazonaws\\.com$/);\n var parsed = (matched || []).slice(1, 3);\n\n if (parsed[1] === 'es') {\n // Elastic Search\n parsed = parsed.reverse();\n }\n\n return {\n service: request.service || parsed[0],\n region: request.region || parsed[1]\n };\n};\n\nvar credential_scope = function credential_scope(d_str, region, service) {\n return [d_str, region, service, 'aws4_request'].join('/');\n};\n/**\n* @private\n* Create a string to sign\n* Refer to\n* {@link http://docs.aws.amazon.com/general/latest/gr/sigv4-create-string-to-sign.html|Create String to Sign}\n*\n
\nStringToSign =\n    Algorithm + \\n +\n    RequestDateTime + \\n +\n    CredentialScope + \\n +\n    HashedCanonicalRequest\n
\n*/\n\n\nvar string_to_sign = function string_to_sign(algorithm, canonical_request, dt_str, scope) {\n return [algorithm, dt_str, scope, hash(canonical_request)].join('\\n');\n};\n/**\n* @private\n* Create signing key\n* Refer to\n* {@link http://docs.aws.amazon.com/general/latest/gr/sigv4-calculate-signature.html|Calculate Signature}\n*\n
\nkSecret = your secret access key\nkDate = HMAC(\"AWS4\" + kSecret, Date)\nkRegion = HMAC(kDate, Region)\nkService = HMAC(kRegion, Service)\nkSigning = HMAC(kService, \"aws4_request\")\n
\n*/\n\n\nvar get_signing_key = function get_signing_key(secret_key, d_str, service_info) {\n logger.debug(service_info);\n var k = 'AWS4' + secret_key,\n k_date = encrypt(k, d_str),\n k_region = encrypt(k_date, service_info.region),\n k_service = encrypt(k_region, service_info.service),\n k_signing = encrypt(k_service, 'aws4_request');\n return k_signing;\n};\n\nvar get_signature = function get_signature(signing_key, str_to_sign) {\n return toHex(encrypt(signing_key, str_to_sign));\n};\n/**\n * @private\n * Create authorization header\n * Refer to\n * {@link http://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html|Add the Signing Information}\n */\n\n\nvar get_authorization_header = function get_authorization_header(algorithm, access_key, scope, signed_headers, signature) {\n return [algorithm + ' ' + 'Credential=' + access_key + '/' + scope, 'SignedHeaders=' + signed_headers, 'Signature=' + signature].join(', ');\n};\n\nvar Signer =\n/** @class */\nfunction () {\n function Signer() {}\n /**\n * Sign a HTTP request, add 'Authorization' header to request param\n * @method sign\n * @memberof Signer\n * @static\n *\n * @param {object} request - HTTP request object\n
\n  request: {\n      method: GET | POST | PUT ...\n      url: ...,\n      headers: {\n          header1: ...\n      },\n      data: data\n  }\n  
\n * @param {object} access_info - AWS access credential info\n
\n  access_info: {\n      access_key: ...,\n      secret_key: ...,\n      session_token: ...\n  }\n  
\n * @param {object} [service_info] - AWS service type and region, optional,\n * if not provided then parse out from url\n
\n  service_info: {\n      service: ...,\n      region: ...\n  }\n  
\n *\n * @returns {object} Signed HTTP request\n */\n\n\n Signer.sign = function (request, access_info, service_info) {\n if (service_info === void 0) {\n service_info = null;\n }\n\n request.headers = request.headers || {}; // datetime string and date string\n\n var dt = DateUtils.getDateWithClockOffset(),\n dt_str = dt.toISOString().replace(/[:\\-]|\\.\\d{3}/g, ''),\n d_str = dt_str.substr(0, 8);\n var url_info = parse(request.url);\n request.headers['host'] = url_info.host;\n request.headers['x-amz-date'] = dt_str;\n\n if (access_info.session_token) {\n request.headers['X-Amz-Security-Token'] = access_info.session_token;\n } // Task 1: Create a Canonical Request\n\n\n var request_str = canonical_request(request);\n logger.debug(request_str); // Task 2: Create a String to Sign\n\n var serviceInfo = service_info || parse_service_info(request),\n scope = credential_scope(d_str, serviceInfo.region, serviceInfo.service),\n str_to_sign = string_to_sign(DEFAULT_ALGORITHM, request_str, dt_str, scope); // Task 3: Calculate the Signature\n\n var signing_key = get_signing_key(access_info.secret_key, d_str, serviceInfo),\n signature = get_signature(signing_key, str_to_sign); // Task 4: Adding the Signing information to the Request\n\n var authorization_header = get_authorization_header(DEFAULT_ALGORITHM, access_info.access_key, scope, signed_headers(request.headers), signature);\n request.headers['Authorization'] = authorization_header;\n return request;\n };\n\n Signer.signUrl = function (urlOrRequest, accessInfo, serviceInfo, expiration) {\n var urlToSign = typeof urlOrRequest === 'object' ? urlOrRequest.url : urlOrRequest;\n var method = typeof urlOrRequest === 'object' ? urlOrRequest.method : 'GET';\n var body = typeof urlOrRequest === 'object' ? urlOrRequest.body : undefined;\n var now = DateUtils.getDateWithClockOffset().toISOString().replace(/[:\\-]|\\.\\d{3}/g, '');\n var today = now.substr(0, 8); // Intentionally discarding search\n\n var _a = parse(urlToSign, true, true),\n search = _a.search,\n parsedUrl = __rest(_a, [\"search\"]);\n\n var host = parsedUrl.host;\n var signedHeaders = {\n host: host\n };\n\n var _b = serviceInfo || parse_service_info({\n url: format(parsedUrl)\n }),\n region = _b.region,\n service = _b.service;\n\n var credentialScope = credential_scope(today, region, service); // IoT service does not allow the session token in the canonical request\n // https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n\n var sessionTokenRequired = accessInfo.session_token && service !== IOT_SERVICE_NAME;\n\n var queryParams = __assign(__assign(__assign({\n 'X-Amz-Algorithm': DEFAULT_ALGORITHM,\n 'X-Amz-Credential': [accessInfo.access_key, credentialScope].join('/'),\n 'X-Amz-Date': now.substr(0, 16)\n }, sessionTokenRequired ? {\n 'X-Amz-Security-Token': \"\" + accessInfo.session_token\n } : {}), expiration ? {\n 'X-Amz-Expires': \"\" + expiration\n } : {}), {\n 'X-Amz-SignedHeaders': Object.keys(signedHeaders).join(',')\n });\n\n var canonicalRequest = canonical_request({\n method: method,\n url: format(__assign(__assign({}, parsedUrl), {\n query: __assign(__assign({}, parsedUrl.query), queryParams)\n })),\n headers: signedHeaders,\n data: body\n });\n var stringToSign = string_to_sign(DEFAULT_ALGORITHM, canonicalRequest, now, credentialScope);\n var signing_key = get_signing_key(accessInfo.secret_key, today, {\n region: region,\n service: service\n });\n var signature = get_signature(signing_key, stringToSign);\n\n var additionalQueryParams = __assign({\n 'X-Amz-Signature': signature\n }, accessInfo.session_token && {\n 'X-Amz-Security-Token': accessInfo.session_token\n });\n\n var result = format({\n protocol: parsedUrl.protocol,\n slashes: true,\n hostname: parsedUrl.hostname,\n port: parsedUrl.port,\n pathname: parsedUrl.pathname,\n query: __assign(__assign(__assign({}, parsedUrl.query), queryParams), additionalQueryParams)\n });\n return result;\n };\n\n return Signer;\n}();\n\nexport { Signer };\n/**\n * @deprecated use per-function import\n */\n\nexport default Signer;","/**\n * Date & time utility functions to abstract the `aws-sdk` away from users.\n * (v2 => v3 modularization is a breaking change)\n *\n * @see https://github.com/aws/aws-sdk-js/blob/6edf586dcc1de7fe8fbfbbd9a0d2b1847921e6e1/lib/util.js#L262\n */\nvar __read = this && this.__read || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o),\n r,\n ar = [],\n e;\n\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {\n ar.push(r.value);\n }\n } catch (error) {\n e = {\n error: error\n };\n } finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n\n return ar;\n}; // Comment - TODO: remove\n\n\nvar FIVE_MINUTES_IN_MS = 1000 * 60 * 5;\nexport var DateUtils = {\n /**\n * Milliseconds to offset the date to compensate for clock skew between device & services\n */\n clockOffset: 0,\n getDateWithClockOffset: function getDateWithClockOffset() {\n if (DateUtils.clockOffset) {\n return new Date(new Date().getTime() + DateUtils.clockOffset);\n } else {\n return new Date();\n }\n },\n\n /**\n * @returns {number} Clock offset in milliseconds\n */\n getClockOffset: function getClockOffset() {\n return DateUtils.clockOffset;\n },\n getHeaderStringFromDate: function getHeaderStringFromDate(date) {\n if (date === void 0) {\n date = DateUtils.getDateWithClockOffset();\n }\n\n return date.toISOString().replace(/[:\\-]|\\.\\d{3}/g, '');\n },\n getDateFromHeaderString: function getDateFromHeaderString(header) {\n var _a = __read(header.match(/^(\\d{4})(\\d{2})(\\d{2})T(\\d{2})(\\d{2})(\\d{2}).+/), 7),\n year = _a[1],\n month = _a[2],\n day = _a[3],\n hour = _a[4],\n minute = _a[5],\n second = _a[6];\n\n return new Date(Date.UTC(Number(year), Number(month) - 1, Number(day), Number(hour), Number(minute), Number(second)));\n },\n isClockSkewed: function isClockSkewed(serverDate) {\n // API gateway permits client calls that are off by no more than ±5 minutes\n return Math.abs(serverDate.getTime() - DateUtils.getDateWithClockOffset().getTime()) >= FIVE_MINUTES_IN_MS;\n },\n isClockSkewError: function isClockSkewError(error) {\n if (!error.response || !error.response.headers) {\n return false;\n }\n\n var headers = error.response.headers;\n return Boolean(['BadRequestException', 'InvalidSignatureException'].includes(headers['x-amzn-errortype']) && (headers.date || headers.Date));\n },\n\n /**\n * @param {number} offset Clock offset in milliseconds\n */\n setClockOffset: function setClockOffset(offset) {\n DateUtils.clockOffset = offset;\n }\n};","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar constants_1 = require(\"./constants\");\n/**\n * @internal\n */\n\n\nvar RawSha256 =\n/** @class */\nfunction () {\n function RawSha256() {\n this.state = Int32Array.from(constants_1.INIT);\n this.temp = new Int32Array(64);\n this.buffer = new Uint8Array(64);\n this.bufferLength = 0;\n this.bytesHashed = 0;\n /**\n * @internal\n */\n\n this.finished = false;\n }\n\n RawSha256.prototype.update = function (data) {\n if (this.finished) {\n throw new Error(\"Attempted to update an already finished hash.\");\n }\n\n var position = 0;\n var byteLength = data.byteLength;\n this.bytesHashed += byteLength;\n\n if (this.bytesHashed * 8 > constants_1.MAX_HASHABLE_LENGTH) {\n throw new Error(\"Cannot hash more than 2^53 - 1 bits\");\n }\n\n while (byteLength > 0) {\n this.buffer[this.bufferLength++] = data[position++];\n byteLength--;\n\n if (this.bufferLength === constants_1.BLOCK_SIZE) {\n this.hashBuffer();\n this.bufferLength = 0;\n }\n }\n };\n\n RawSha256.prototype.digest = function () {\n if (!this.finished) {\n var bitsHashed = this.bytesHashed * 8;\n var bufferView = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);\n var undecoratedLength = this.bufferLength;\n bufferView.setUint8(this.bufferLength++, 0x80); // Ensure the final block has enough room for the hashed length\n\n if (undecoratedLength % constants_1.BLOCK_SIZE >= constants_1.BLOCK_SIZE - 8) {\n for (var i = this.bufferLength; i < constants_1.BLOCK_SIZE; i++) {\n bufferView.setUint8(i, 0);\n }\n\n this.hashBuffer();\n this.bufferLength = 0;\n }\n\n for (var i = this.bufferLength; i < constants_1.BLOCK_SIZE - 8; i++) {\n bufferView.setUint8(i, 0);\n }\n\n bufferView.setUint32(constants_1.BLOCK_SIZE - 8, Math.floor(bitsHashed / 0x100000000), true);\n bufferView.setUint32(constants_1.BLOCK_SIZE - 4, bitsHashed);\n this.hashBuffer();\n this.finished = true;\n } // The value in state is little-endian rather than big-endian, so flip\n // each word into a new Uint8Array\n\n\n var out = new Uint8Array(constants_1.DIGEST_LENGTH);\n\n for (var i = 0; i < 8; i++) {\n out[i * 4] = this.state[i] >>> 24 & 0xff;\n out[i * 4 + 1] = this.state[i] >>> 16 & 0xff;\n out[i * 4 + 2] = this.state[i] >>> 8 & 0xff;\n out[i * 4 + 3] = this.state[i] >>> 0 & 0xff;\n }\n\n return out;\n };\n\n RawSha256.prototype.hashBuffer = function () {\n var _a = this,\n buffer = _a.buffer,\n state = _a.state;\n\n var state0 = state[0],\n state1 = state[1],\n state2 = state[2],\n state3 = state[3],\n state4 = state[4],\n state5 = state[5],\n state6 = state[6],\n state7 = state[7];\n\n for (var i = 0; i < constants_1.BLOCK_SIZE; i++) {\n if (i < 16) {\n this.temp[i] = (buffer[i * 4] & 0xff) << 24 | (buffer[i * 4 + 1] & 0xff) << 16 | (buffer[i * 4 + 2] & 0xff) << 8 | buffer[i * 4 + 3] & 0xff;\n } else {\n var u = this.temp[i - 2];\n var t1_1 = (u >>> 17 | u << 15) ^ (u >>> 19 | u << 13) ^ u >>> 10;\n u = this.temp[i - 15];\n var t2_1 = (u >>> 7 | u << 25) ^ (u >>> 18 | u << 14) ^ u >>> 3;\n this.temp[i] = (t1_1 + this.temp[i - 7] | 0) + (t2_1 + this.temp[i - 16] | 0);\n }\n\n var t1 = (((state4 >>> 6 | state4 << 26) ^ (state4 >>> 11 | state4 << 21) ^ (state4 >>> 25 | state4 << 7)) + (state4 & state5 ^ ~state4 & state6) | 0) + (state7 + (constants_1.KEY[i] + this.temp[i] | 0) | 0) | 0;\n var t2 = ((state0 >>> 2 | state0 << 30) ^ (state0 >>> 13 | state0 << 19) ^ (state0 >>> 22 | state0 << 10)) + (state0 & state1 ^ state0 & state2 ^ state1 & state2) | 0;\n state7 = state6;\n state6 = state5;\n state5 = state4;\n state4 = state3 + t1 | 0;\n state3 = state2;\n state2 = state1;\n state1 = state0;\n state0 = t1 + t2 | 0;\n }\n\n state[0] += state0;\n state[1] += state1;\n state[2] += state2;\n state[3] += state3;\n state[4] += state4;\n state[5] += state5;\n state[6] += state6;\n state[7] += state7;\n };\n\n return RawSha256;\n}();\n\nexports.RawSha256 = RawSha256;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n/**\n * @internal\n */\n\nexports.BLOCK_SIZE = 64;\n/**\n * @internal\n */\n\nexports.DIGEST_LENGTH = 32;\n/**\n * @internal\n */\n\nexports.KEY = new Uint32Array([0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2]);\n/**\n * @internal\n */\n\nexports.INIT = [0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19];\n/**\n * @internal\n */\n\nexports.MAX_HASHABLE_LENGTH = Math.pow(2, 53) - 1;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar tslib_1 = require(\"tslib\");\n\ntslib_1.__exportStar(require(\"./jsSha256\"), exports);","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar tslib_1 = require(\"tslib\");\n\nvar constants_1 = require(\"./constants\");\n\nvar RawSha256_1 = require(\"./RawSha256\");\n\nvar util_utf8_browser_1 = require(\"@aws-sdk/util-utf8-browser\");\n\nvar Sha256 =\n/** @class */\nfunction () {\n function Sha256(secret) {\n this.hash = new RawSha256_1.RawSha256();\n\n if (secret) {\n this.outer = new RawSha256_1.RawSha256();\n var inner = bufferFromSecret(secret);\n var outer = new Uint8Array(constants_1.BLOCK_SIZE);\n outer.set(inner);\n\n for (var i = 0; i < constants_1.BLOCK_SIZE; i++) {\n inner[i] ^= 0x36;\n outer[i] ^= 0x5c;\n }\n\n this.hash.update(inner);\n this.outer.update(outer); // overwrite the copied key in memory\n\n for (var i = 0; i < inner.byteLength; i++) {\n inner[i] = 0;\n }\n }\n }\n\n Sha256.prototype.update = function (toHash) {\n if (isEmptyData(toHash) || this.error) {\n return;\n }\n\n try {\n this.hash.update(convertToBuffer(toHash));\n } catch (e) {\n this.error = e;\n }\n };\n /* This synchronous method keeps compatibility\n * with the v2 aws-sdk.\n */\n\n\n Sha256.prototype.digestSync = function () {\n if (this.error) {\n throw this.error;\n }\n\n if (this.outer) {\n if (!this.outer.finished) {\n this.outer.update(this.hash.digest());\n }\n\n return this.outer.digest();\n }\n\n return this.hash.digest();\n };\n /* The underlying digest method here is synchronous.\n * To keep the same interface with the other hash functions\n * the default is to expose this as an async method.\n * However, it can sometimes be useful to have a sync method.\n */\n\n\n Sha256.prototype.digest = function () {\n return tslib_1.__awaiter(this, void 0, void 0, function () {\n return tslib_1.__generator(this, function (_a) {\n return [2\n /*return*/\n , this.digestSync()];\n });\n });\n };\n\n return Sha256;\n}();\n\nexports.Sha256 = Sha256;\n\nfunction bufferFromSecret(secret) {\n var input = convertToBuffer(secret);\n\n if (input.byteLength > constants_1.BLOCK_SIZE) {\n var bufferHash = new RawSha256_1.RawSha256();\n bufferHash.update(input);\n input = bufferHash.digest();\n }\n\n var buffer = new Uint8Array(constants_1.BLOCK_SIZE);\n buffer.set(input);\n return buffer;\n}\n\nfunction isEmptyData(data) {\n if (typeof data === \"string\") {\n return data.length === 0;\n }\n\n return data.byteLength === 0;\n}\n\nfunction convertToBuffer(data) {\n if (typeof data === \"string\") {\n return util_utf8_browser_1.fromUtf8(data);\n }\n\n if (ArrayBuffer.isView(data)) {\n return new Uint8Array(data.buffer, data.byteOffset, data.byteLength / Uint8Array.BYTES_PER_ELEMENT);\n }\n\n return new Uint8Array(data);\n}","import { fromUtf8 as jsFromUtf8, toUtf8 as jsToUtf8 } from \"./pureJs\";\nimport { fromUtf8 as textEncoderFromUtf8, toUtf8 as textEncoderToUtf8 } from \"./whatwgEncodingApi\";\nexport var fromUtf8 = function fromUtf8(input) {\n return typeof TextEncoder === \"function\" ? textEncoderFromUtf8(input) : jsFromUtf8(input);\n};\nexport var toUtf8 = function toUtf8(input) {\n return typeof TextDecoder === \"function\" ? textEncoderToUtf8(input) : jsToUtf8(input);\n};","export function fromUtf8(input) {\n return new TextEncoder().encode(input);\n}\nexport function toUtf8(input) {\n return new TextDecoder(\"utf-8\").decode(input);\n}","/**\n * Converts a JS string from its native UCS-2/UTF-16 representation into a\n * Uint8Array of the bytes used to represent the equivalent characters in UTF-8.\n *\n * Cribbed from the `goog.crypt.stringToUtf8ByteArray` function in the Google\n * Closure library, though updated to use typed arrays.\n */\nexport var fromUtf8 = function fromUtf8(input) {\n var bytes = [];\n\n for (var i = 0, len = input.length; i < len; i++) {\n var value = input.charCodeAt(i);\n\n if (value < 0x80) {\n bytes.push(value);\n } else if (value < 0x800) {\n bytes.push(value >> 6 | 192, value & 63 | 128);\n } else if (i + 1 < input.length && (value & 0xfc00) === 0xd800 && (input.charCodeAt(i + 1) & 0xfc00) === 0xdc00) {\n var surrogatePair = 0x10000 + ((value & 1023) << 10) + (input.charCodeAt(++i) & 1023);\n bytes.push(surrogatePair >> 18 | 240, surrogatePair >> 12 & 63 | 128, surrogatePair >> 6 & 63 | 128, surrogatePair & 63 | 128);\n } else {\n bytes.push(value >> 12 | 224, value >> 6 & 63 | 128, value & 63 | 128);\n }\n }\n\n return Uint8Array.from(bytes);\n};\n/**\n * Converts a typed array of bytes containing UTF-8 data into a native JS\n * string.\n *\n * Partly cribbed from the `goog.crypt.utf8ByteArrayToString` function in the\n * Google Closure library, though updated to use typed arrays and to better\n * handle astral plane code points.\n */\n\nexport var toUtf8 = function toUtf8(input) {\n var decoded = \"\";\n\n for (var i = 0, len = input.length; i < len; i++) {\n var byte = input[i];\n\n if (byte < 0x80) {\n decoded += String.fromCharCode(byte);\n } else if (192 <= byte && byte < 224) {\n var nextByte = input[++i];\n decoded += String.fromCharCode((byte & 31) << 6 | nextByte & 63);\n } else if (240 <= byte && byte < 365) {\n var surrogatePair = [byte, input[++i], input[++i], input[++i]];\n var encoded = \"%\" + surrogatePair.map(function (byteValue) {\n return byteValue.toString(16);\n }).join(\"%\");\n decoded += decodeURIComponent(encoded);\n } else {\n decoded += String.fromCharCode((byte & 15) << 12 | (input[++i] & 63) << 6 | input[++i] & 63);\n }\n }\n\n return decoded;\n};","/*******************************************************************************\n * Copyright (c) 2013 IBM Corp.\n *\n * All rights reserved. This program and the accompanying materials\n * are made available under the terms of the Eclipse Public License v1.0\n * and Eclipse Distribution License v1.0 which accompany this distribution.\n *\n * The Eclipse Public License is available at\n * http://www.eclipse.org/legal/epl-v10.html\n * and the Eclipse Distribution License is available at\n * http://www.eclipse.org/org/documents/edl-v10.php.\n *\n * Contributors:\n * Andrew Banks - initial API and implementation and initial documentation\n *******************************************************************************/\n// Only expose a single object name in the global namespace.\n// Everything must go through this module. Global Paho module\n// only has a single public function, client, which returns\n// a Paho client object given connection details.\n\n/**\n * Send and receive messages using web browsers.\n *

\n * This programming interface lets a JavaScript client application use the MQTT V3.1 or\n * V3.1.1 protocol to connect to an MQTT-supporting messaging server.\n *\n * The function supported includes:\n *

    \n *
  1. Connecting to and disconnecting from a server. The server is identified by its host name and port number.\n *
  2. Specifying options that relate to the communications link with the server,\n * for example the frequency of keep-alive heartbeats, and whether SSL/TLS is required.\n *
  3. Subscribing to and receiving messages from MQTT Topics.\n *
  4. Publishing messages to MQTT Topics.\n *
\n *

\n * The API consists of two main objects:\n *

\n *
{@link Paho.Client}
\n *
This contains methods that provide the functionality of the API,\n * including provision of callbacks that notify the application when a message\n * arrives from or is delivered to the messaging server,\n * or when the status of its connection to the messaging server changes.
\n *
{@link Paho.Message}
\n *
This encapsulates the payload of the message along with various attributes\n * associated with its delivery, in particular the destination to which it has\n * been (or is about to be) sent.
\n *
\n *

\n * The programming interface validates parameters passed to it, and will throw\n * an Error containing an error message intended for developer use, if it detects\n * an error with any parameter.\n *

\n * Example:\n *\n *

\nvar client = new Paho.MQTT.Client(location.hostname, Number(location.port), \"clientId\");\nclient.onConnectionLost = onConnectionLost;\nclient.onMessageArrived = onMessageArrived;\nclient.connect({onSuccess:onConnect});\n\nfunction onConnect() {\n  // Once a connection has been made, make a subscription and send a message.\n  console.log(\"onConnect\");\n  client.subscribe(\"/World\");\n  var message = new Paho.MQTT.Message(\"Hello\");\n  message.destinationName = \"/World\";\n  client.send(message);\n};\nfunction onConnectionLost(responseObject) {\n  if (responseObject.errorCode !== 0)\n\tconsole.log(\"onConnectionLost:\"+responseObject.errorMessage);\n};\nfunction onMessageArrived(message) {\n  console.log(\"onMessageArrived:\"+message.payloadString);\n  client.disconnect();\n};\n * 
\n * @namespace Paho\n */\n\n/* jshint shadow:true */\n(function ExportLibrary(root, factory) {\n if (typeof exports === \"object\" && typeof module === \"object\") {\n module.exports = factory();\n } else if (typeof define === \"function\" && define.amd) {\n define(factory);\n } else if (typeof exports === \"object\") {\n exports = factory();\n } else {\n //if (typeof root.Paho === \"undefined\"){\n //\troot.Paho = {};\n //}\n root.Paho = factory();\n }\n})(this, function LibraryFactory() {\n var PahoMQTT = function (global) {\n // Private variables below, these are only visible inside the function closure\n // which is used to define the module.\n var version = \"@VERSION@-@BUILDLEVEL@\";\n /**\n * @private\n */\n\n var localStorage = global.localStorage || function () {\n var data = {};\n return {\n setItem: function setItem(key, item) {\n data[key] = item;\n },\n getItem: function getItem(key) {\n return data[key];\n },\n removeItem: function removeItem(key) {\n delete data[key];\n }\n };\n }();\n /**\n * Unique message type identifiers, with associated\n * associated integer values.\n * @private\n */\n\n\n var MESSAGE_TYPE = {\n CONNECT: 1,\n CONNACK: 2,\n PUBLISH: 3,\n PUBACK: 4,\n PUBREC: 5,\n PUBREL: 6,\n PUBCOMP: 7,\n SUBSCRIBE: 8,\n SUBACK: 9,\n UNSUBSCRIBE: 10,\n UNSUBACK: 11,\n PINGREQ: 12,\n PINGRESP: 13,\n DISCONNECT: 14\n }; // Collection of utility methods used to simplify module code\n // and promote the DRY pattern.\n\n /**\n * Validate an object's parameter names to ensure they\n * match a list of expected variables name for this option\n * type. Used to ensure option object passed into the API don't\n * contain erroneous parameters.\n * @param {Object} obj - User options object\n * @param {Object} keys - valid keys and types that may exist in obj.\n * @throws {Error} Invalid option parameter found.\n * @private\n */\n\n var validate = function validate(obj, keys) {\n for (var key in obj) {\n if (obj.hasOwnProperty(key)) {\n if (keys.hasOwnProperty(key)) {\n if (typeof obj[key] !== keys[key]) throw new Error(format(ERROR.INVALID_TYPE, [typeof obj[key], key]));\n } else {\n var errorStr = \"Unknown property, \" + key + \". Valid properties are:\";\n\n for (var validKey in keys) {\n if (keys.hasOwnProperty(validKey)) errorStr = errorStr + \" \" + validKey;\n }\n\n throw new Error(errorStr);\n }\n }\n }\n };\n /**\n * Return a new function which runs the user function bound\n * to a fixed scope.\n * @param {function} User function\n * @param {object} Function scope\n * @return {function} User function bound to another scope\n * @private\n */\n\n\n var scope = function scope(f, _scope) {\n return function () {\n return f.apply(_scope, arguments);\n };\n };\n /**\n * Unique message type identifiers, with associated\n * associated integer values.\n * @private\n */\n\n\n var ERROR = {\n OK: {\n code: 0,\n text: \"AMQJSC0000I OK.\"\n },\n CONNECT_TIMEOUT: {\n code: 1,\n text: \"AMQJSC0001E Connect timed out.\"\n },\n SUBSCRIBE_TIMEOUT: {\n code: 2,\n text: \"AMQJS0002E Subscribe timed out.\"\n },\n UNSUBSCRIBE_TIMEOUT: {\n code: 3,\n text: \"AMQJS0003E Unsubscribe timed out.\"\n },\n PING_TIMEOUT: {\n code: 4,\n text: \"AMQJS0004E Ping timed out.\"\n },\n INTERNAL_ERROR: {\n code: 5,\n text: \"AMQJS0005E Internal error. Error Message: {0}, Stack trace: {1}\"\n },\n CONNACK_RETURNCODE: {\n code: 6,\n text: \"AMQJS0006E Bad Connack return code:{0} {1}.\"\n },\n SOCKET_ERROR: {\n code: 7,\n text: \"AMQJS0007E Socket error:{0}.\"\n },\n SOCKET_CLOSE: {\n code: 8,\n text: \"AMQJS0008I Socket closed.\"\n },\n MALFORMED_UTF: {\n code: 9,\n text: \"AMQJS0009E Malformed UTF data:{0} {1} {2}.\"\n },\n UNSUPPORTED: {\n code: 10,\n text: \"AMQJS0010E {0} is not supported by this browser.\"\n },\n INVALID_STATE: {\n code: 11,\n text: \"AMQJS0011E Invalid state {0}.\"\n },\n INVALID_TYPE: {\n code: 12,\n text: \"AMQJS0012E Invalid type {0} for {1}.\"\n },\n INVALID_ARGUMENT: {\n code: 13,\n text: \"AMQJS0013E Invalid argument {0} for {1}.\"\n },\n UNSUPPORTED_OPERATION: {\n code: 14,\n text: \"AMQJS0014E Unsupported operation.\"\n },\n INVALID_STORED_DATA: {\n code: 15,\n text: \"AMQJS0015E Invalid data in local storage key={0} value={1}.\"\n },\n INVALID_MQTT_MESSAGE_TYPE: {\n code: 16,\n text: \"AMQJS0016E Invalid MQTT message type {0}.\"\n },\n MALFORMED_UNICODE: {\n code: 17,\n text: \"AMQJS0017E Malformed Unicode string:{0} {1}.\"\n },\n BUFFER_FULL: {\n code: 18,\n text: \"AMQJS0018E Message buffer is full, maximum buffer size: {0}.\"\n }\n };\n /** CONNACK RC Meaning. */\n\n var CONNACK_RC = {\n 0: \"Connection Accepted\",\n 1: \"Connection Refused: unacceptable protocol version\",\n 2: \"Connection Refused: identifier rejected\",\n 3: \"Connection Refused: server unavailable\",\n 4: \"Connection Refused: bad user name or password\",\n 5: \"Connection Refused: not authorized\"\n };\n /**\n * Format an error message text.\n * @private\n * @param {error} ERROR value above.\n * @param {substitutions} [array] substituted into the text.\n * @return the text with the substitutions made.\n */\n\n var format = function format(error, substitutions) {\n var text = error.text;\n\n if (substitutions) {\n var field, start;\n\n for (var i = 0; i < substitutions.length; i++) {\n field = \"{\" + i + \"}\";\n start = text.indexOf(field);\n\n if (start > 0) {\n var part1 = text.substring(0, start);\n var part2 = text.substring(start + field.length);\n text = part1 + substitutions[i] + part2;\n }\n }\n }\n\n return text;\n }; //MQTT protocol and version 6 M Q I s d p 3\n\n\n var MqttProtoIdentifierv3 = [0x00, 0x06, 0x4d, 0x51, 0x49, 0x73, 0x64, 0x70, 0x03]; //MQTT proto/version for 311 4 M Q T T 4\n\n var MqttProtoIdentifierv4 = [0x00, 0x04, 0x4d, 0x51, 0x54, 0x54, 0x04];\n /**\n * Construct an MQTT wire protocol message.\n * @param type MQTT packet type.\n * @param options optional wire message attributes.\n *\n * Optional properties\n *\n * messageIdentifier: message ID in the range [0..65535]\n * payloadMessage:\tApplication Message - PUBLISH only\n * connectStrings:\tarray of 0 or more Strings to be put into the CONNECT payload\n * topics:\t\t\tarray of strings (SUBSCRIBE, UNSUBSCRIBE)\n * requestQoS:\t\tarray of QoS values [0..2]\n *\n * \"Flag\" properties\n * cleanSession:\ttrue if present / false if absent (CONNECT)\n * willMessage: \ttrue if present / false if absent (CONNECT)\n * isRetained:\t\ttrue if present / false if absent (CONNECT)\n * userName:\t\ttrue if present / false if absent (CONNECT)\n * password:\t\ttrue if present / false if absent (CONNECT)\n * keepAliveInterval:\tinteger [0..65535] (CONNECT)\n *\n * @private\n * @ignore\n */\n\n var WireMessage = function WireMessage(type, options) {\n this.type = type;\n\n for (var name in options) {\n if (options.hasOwnProperty(name)) {\n this[name] = options[name];\n }\n }\n };\n\n WireMessage.prototype.encode = function () {\n // Compute the first byte of the fixed header\n var first = (this.type & 0x0f) << 4;\n /*\n * Now calculate the length of the variable header + payload by adding up the lengths\n * of all the component parts\n */\n\n var remLength = 0;\n var topicStrLength = [];\n var destinationNameLength = 0;\n var willMessagePayloadBytes; // if the message contains a messageIdentifier then we need two bytes for that\n\n if (this.messageIdentifier !== undefined) remLength += 2;\n\n switch (this.type) {\n // If this a Connect then we need to include 12 bytes for its header\n case MESSAGE_TYPE.CONNECT:\n switch (this.mqttVersion) {\n case 3:\n remLength += MqttProtoIdentifierv3.length + 3;\n break;\n\n case 4:\n remLength += MqttProtoIdentifierv4.length + 3;\n break;\n }\n\n remLength += UTF8Length(this.clientId) + 2;\n\n if (this.willMessage !== undefined) {\n remLength += UTF8Length(this.willMessage.destinationName) + 2; // Will message is always a string, sent as UTF-8 characters with a preceding length.\n\n willMessagePayloadBytes = this.willMessage.payloadBytes;\n if (!(willMessagePayloadBytes instanceof Uint8Array)) willMessagePayloadBytes = new Uint8Array(payloadBytes);\n remLength += willMessagePayloadBytes.byteLength + 2;\n }\n\n if (this.userName !== undefined) remLength += UTF8Length(this.userName) + 2;\n if (this.password !== undefined) remLength += UTF8Length(this.password) + 2;\n break;\n // Subscribe, Unsubscribe can both contain topic strings\n\n case MESSAGE_TYPE.SUBSCRIBE:\n first |= 0x02; // Qos = 1;\n\n for (var i = 0; i < this.topics.length; i++) {\n topicStrLength[i] = UTF8Length(this.topics[i]);\n remLength += topicStrLength[i] + 2;\n }\n\n remLength += this.requestedQos.length; // 1 byte for each topic's Qos\n // QoS on Subscribe only\n\n break;\n\n case MESSAGE_TYPE.UNSUBSCRIBE:\n first |= 0x02; // Qos = 1;\n\n for (var i = 0; i < this.topics.length; i++) {\n topicStrLength[i] = UTF8Length(this.topics[i]);\n remLength += topicStrLength[i] + 2;\n }\n\n break;\n\n case MESSAGE_TYPE.PUBREL:\n first |= 0x02; // Qos = 1;\n\n break;\n\n case MESSAGE_TYPE.PUBLISH:\n if (this.payloadMessage.duplicate) first |= 0x08;\n first = first |= this.payloadMessage.qos << 1;\n if (this.payloadMessage.retained) first |= 0x01;\n destinationNameLength = UTF8Length(this.payloadMessage.destinationName);\n remLength += destinationNameLength + 2;\n var payloadBytes = this.payloadMessage.payloadBytes;\n remLength += payloadBytes.byteLength;\n if (payloadBytes instanceof ArrayBuffer) payloadBytes = new Uint8Array(payloadBytes);else if (!(payloadBytes instanceof Uint8Array)) payloadBytes = new Uint8Array(payloadBytes.buffer);\n break;\n\n case MESSAGE_TYPE.DISCONNECT:\n break;\n\n default:\n break;\n } // Now we can allocate a buffer for the message\n\n\n var mbi = encodeMBI(remLength); // Convert the length to MQTT MBI format\n\n var pos = mbi.length + 1; // Offset of start of variable header\n\n var buffer = new ArrayBuffer(remLength + pos);\n var byteStream = new Uint8Array(buffer); // view it as a sequence of bytes\n //Write the fixed header into the buffer\n\n byteStream[0] = first;\n byteStream.set(mbi, 1); // If this is a PUBLISH then the variable header starts with a topic\n\n if (this.type == MESSAGE_TYPE.PUBLISH) pos = writeString(this.payloadMessage.destinationName, destinationNameLength, byteStream, pos); // If this is a CONNECT then the variable header contains the protocol name/version, flags and keepalive time\n else if (this.type == MESSAGE_TYPE.CONNECT) {\n switch (this.mqttVersion) {\n case 3:\n byteStream.set(MqttProtoIdentifierv3, pos);\n pos += MqttProtoIdentifierv3.length;\n break;\n\n case 4:\n byteStream.set(MqttProtoIdentifierv4, pos);\n pos += MqttProtoIdentifierv4.length;\n break;\n }\n\n var connectFlags = 0;\n if (this.cleanSession) connectFlags = 0x02;\n\n if (this.willMessage !== undefined) {\n connectFlags |= 0x04;\n connectFlags |= this.willMessage.qos << 3;\n\n if (this.willMessage.retained) {\n connectFlags |= 0x20;\n }\n }\n\n if (this.userName !== undefined) connectFlags |= 0x80;\n if (this.password !== undefined) connectFlags |= 0x40;\n byteStream[pos++] = connectFlags;\n pos = writeUint16(this.keepAliveInterval, byteStream, pos);\n } // Output the messageIdentifier - if there is one\n\n if (this.messageIdentifier !== undefined) pos = writeUint16(this.messageIdentifier, byteStream, pos);\n\n switch (this.type) {\n case MESSAGE_TYPE.CONNECT:\n pos = writeString(this.clientId, UTF8Length(this.clientId), byteStream, pos);\n\n if (this.willMessage !== undefined) {\n pos = writeString(this.willMessage.destinationName, UTF8Length(this.willMessage.destinationName), byteStream, pos);\n pos = writeUint16(willMessagePayloadBytes.byteLength, byteStream, pos);\n byteStream.set(willMessagePayloadBytes, pos);\n pos += willMessagePayloadBytes.byteLength;\n }\n\n if (this.userName !== undefined) pos = writeString(this.userName, UTF8Length(this.userName), byteStream, pos);\n if (this.password !== undefined) pos = writeString(this.password, UTF8Length(this.password), byteStream, pos);\n break;\n\n case MESSAGE_TYPE.PUBLISH:\n // PUBLISH has a text or binary payload, if text do not add a 2 byte length field, just the UTF characters.\n byteStream.set(payloadBytes, pos);\n break;\n // \t case MESSAGE_TYPE.PUBREC:\n // \t case MESSAGE_TYPE.PUBREL:\n // \t case MESSAGE_TYPE.PUBCOMP:\n // \t \tbreak;\n\n case MESSAGE_TYPE.SUBSCRIBE:\n // SUBSCRIBE has a list of topic strings and request QoS\n for (var i = 0; i < this.topics.length; i++) {\n pos = writeString(this.topics[i], topicStrLength[i], byteStream, pos);\n byteStream[pos++] = this.requestedQos[i];\n }\n\n break;\n\n case MESSAGE_TYPE.UNSUBSCRIBE:\n // UNSUBSCRIBE has a list of topic strings\n for (var i = 0; i < this.topics.length; i++) {\n pos = writeString(this.topics[i], topicStrLength[i], byteStream, pos);\n }\n\n break;\n\n default: // Do nothing.\n\n }\n\n return buffer;\n };\n\n function decodeMessage(input, pos) {\n var startingPos = pos;\n var first = input[pos];\n var type = first >> 4;\n var messageInfo = first &= 0x0f;\n pos += 1; // Decode the remaining length (MBI format)\n\n var digit;\n var remLength = 0;\n var multiplier = 1;\n\n do {\n if (pos == input.length) {\n return [null, startingPos];\n }\n\n digit = input[pos++];\n remLength += (digit & 0x7F) * multiplier;\n multiplier *= 128;\n } while ((digit & 0x80) !== 0);\n\n var endPos = pos + remLength;\n\n if (endPos > input.length) {\n return [null, startingPos];\n }\n\n var wireMessage = new WireMessage(type);\n\n switch (type) {\n case MESSAGE_TYPE.CONNACK:\n var connectAcknowledgeFlags = input[pos++];\n if (connectAcknowledgeFlags & 0x01) wireMessage.sessionPresent = true;\n wireMessage.returnCode = input[pos++];\n break;\n\n case MESSAGE_TYPE.PUBLISH:\n var qos = messageInfo >> 1 & 0x03;\n var len = readUint16(input, pos);\n pos += 2;\n var topicName = parseUTF8(input, pos, len);\n pos += len; // If QoS 1 or 2 there will be a messageIdentifier\n\n if (qos > 0) {\n wireMessage.messageIdentifier = readUint16(input, pos);\n pos += 2;\n }\n\n var message = new Message(input.subarray(pos, endPos));\n if ((messageInfo & 0x01) == 0x01) message.retained = true;\n if ((messageInfo & 0x08) == 0x08) message.duplicate = true;\n message.qos = qos;\n message.destinationName = topicName;\n wireMessage.payloadMessage = message;\n break;\n\n case MESSAGE_TYPE.PUBACK:\n case MESSAGE_TYPE.PUBREC:\n case MESSAGE_TYPE.PUBREL:\n case MESSAGE_TYPE.PUBCOMP:\n case MESSAGE_TYPE.UNSUBACK:\n wireMessage.messageIdentifier = readUint16(input, pos);\n break;\n\n case MESSAGE_TYPE.SUBACK:\n wireMessage.messageIdentifier = readUint16(input, pos);\n pos += 2;\n wireMessage.returnCode = input.subarray(pos, endPos);\n break;\n\n default:\n break;\n }\n\n return [wireMessage, endPos];\n }\n\n function writeUint16(input, buffer, offset) {\n buffer[offset++] = input >> 8; //MSB\n\n buffer[offset++] = input % 256; //LSB\n\n return offset;\n }\n\n function writeString(input, utf8Length, buffer, offset) {\n offset = writeUint16(utf8Length, buffer, offset);\n stringToUTF8(input, buffer, offset);\n return offset + utf8Length;\n }\n\n function readUint16(buffer, offset) {\n return 256 * buffer[offset] + buffer[offset + 1];\n }\n /**\n * Encodes an MQTT Multi-Byte Integer\n * @private\n */\n\n\n function encodeMBI(number) {\n var output = new Array(1);\n var numBytes = 0;\n\n do {\n var digit = number % 128;\n number = number >> 7;\n\n if (number > 0) {\n digit |= 0x80;\n }\n\n output[numBytes++] = digit;\n } while (number > 0 && numBytes < 4);\n\n return output;\n }\n /**\n * Takes a String and calculates its length in bytes when encoded in UTF8.\n * @private\n */\n\n\n function UTF8Length(input) {\n var output = 0;\n\n for (var i = 0; i < input.length; i++) {\n var charCode = input.charCodeAt(i);\n\n if (charCode > 0x7FF) {\n // Surrogate pair means its a 4 byte character\n if (0xD800 <= charCode && charCode <= 0xDBFF) {\n i++;\n output++;\n }\n\n output += 3;\n } else if (charCode > 0x7F) output += 2;else output++;\n }\n\n return output;\n }\n /**\n * Takes a String and writes it into an array as UTF8 encoded bytes.\n * @private\n */\n\n\n function stringToUTF8(input, output, start) {\n var pos = start;\n\n for (var i = 0; i < input.length; i++) {\n var charCode = input.charCodeAt(i); // Check for a surrogate pair.\n\n if (0xD800 <= charCode && charCode <= 0xDBFF) {\n var lowCharCode = input.charCodeAt(++i);\n\n if (isNaN(lowCharCode)) {\n throw new Error(format(ERROR.MALFORMED_UNICODE, [charCode, lowCharCode]));\n }\n\n charCode = (charCode - 0xD800 << 10) + (lowCharCode - 0xDC00) + 0x10000;\n }\n\n if (charCode <= 0x7F) {\n output[pos++] = charCode;\n } else if (charCode <= 0x7FF) {\n output[pos++] = charCode >> 6 & 0x1F | 0xC0;\n output[pos++] = charCode & 0x3F | 0x80;\n } else if (charCode <= 0xFFFF) {\n output[pos++] = charCode >> 12 & 0x0F | 0xE0;\n output[pos++] = charCode >> 6 & 0x3F | 0x80;\n output[pos++] = charCode & 0x3F | 0x80;\n } else {\n output[pos++] = charCode >> 18 & 0x07 | 0xF0;\n output[pos++] = charCode >> 12 & 0x3F | 0x80;\n output[pos++] = charCode >> 6 & 0x3F | 0x80;\n output[pos++] = charCode & 0x3F | 0x80;\n }\n }\n\n return output;\n }\n\n function parseUTF8(input, offset, length) {\n var output = \"\";\n var utf16;\n var pos = offset;\n\n while (pos < offset + length) {\n var byte1 = input[pos++];\n if (byte1 < 128) utf16 = byte1;else {\n var byte2 = input[pos++] - 128;\n if (byte2 < 0) throw new Error(format(ERROR.MALFORMED_UTF, [byte1.toString(16), byte2.toString(16), \"\"]));\n if (byte1 < 0xE0) // 2 byte character\n utf16 = 64 * (byte1 - 0xC0) + byte2;else {\n var byte3 = input[pos++] - 128;\n if (byte3 < 0) throw new Error(format(ERROR.MALFORMED_UTF, [byte1.toString(16), byte2.toString(16), byte3.toString(16)]));\n if (byte1 < 0xF0) // 3 byte character\n utf16 = 4096 * (byte1 - 0xE0) + 64 * byte2 + byte3;else {\n var byte4 = input[pos++] - 128;\n if (byte4 < 0) throw new Error(format(ERROR.MALFORMED_UTF, [byte1.toString(16), byte2.toString(16), byte3.toString(16), byte4.toString(16)]));\n if (byte1 < 0xF8) // 4 byte character\n utf16 = 262144 * (byte1 - 0xF0) + 4096 * byte2 + 64 * byte3 + byte4;else // longer encodings are not supported\n throw new Error(format(ERROR.MALFORMED_UTF, [byte1.toString(16), byte2.toString(16), byte3.toString(16), byte4.toString(16)]));\n }\n }\n }\n\n if (utf16 > 0xFFFF) // 4 byte character - express as a surrogate pair\n {\n utf16 -= 0x10000;\n output += String.fromCharCode(0xD800 + (utf16 >> 10)); // lead character\n\n utf16 = 0xDC00 + (utf16 & 0x3FF); // trail character\n }\n\n output += String.fromCharCode(utf16);\n }\n\n return output;\n }\n /**\n * Repeat keepalive requests, monitor responses.\n * @ignore\n */\n\n\n var Pinger = function Pinger(client, keepAliveInterval) {\n this._client = client;\n this._keepAliveInterval = keepAliveInterval * 1000;\n this.isReset = false;\n var pingReq = new WireMessage(MESSAGE_TYPE.PINGREQ).encode();\n\n var doTimeout = function doTimeout(pinger) {\n return function () {\n return doPing.apply(pinger);\n };\n };\n /** @ignore */\n\n\n var doPing = function doPing() {\n if (!this.isReset) {\n this._client._trace(\"Pinger.doPing\", \"Timed out\");\n\n this._client._disconnected(ERROR.PING_TIMEOUT.code, format(ERROR.PING_TIMEOUT));\n } else {\n this.isReset = false;\n\n this._client._trace(\"Pinger.doPing\", \"send PINGREQ\");\n\n this._client.socket.send(pingReq);\n\n this.timeout = setTimeout(doTimeout(this), this._keepAliveInterval);\n }\n };\n\n this.reset = function () {\n this.isReset = true;\n clearTimeout(this.timeout);\n if (this._keepAliveInterval > 0) this.timeout = setTimeout(doTimeout(this), this._keepAliveInterval);\n };\n\n this.cancel = function () {\n clearTimeout(this.timeout);\n };\n };\n /**\n * Monitor request completion.\n * @ignore\n */\n\n\n var Timeout = function Timeout(client, timeoutSeconds, action, args) {\n if (!timeoutSeconds) timeoutSeconds = 30;\n\n var doTimeout = function doTimeout(action, client, args) {\n return function () {\n return action.apply(client, args);\n };\n };\n\n this.timeout = setTimeout(doTimeout(action, client, args), timeoutSeconds * 1000);\n\n this.cancel = function () {\n clearTimeout(this.timeout);\n };\n };\n /**\n * Internal implementation of the Websockets MQTT V3.1 client.\n *\n * @name Paho.ClientImpl @constructor\n * @param {String} host the DNS nameof the webSocket host.\n * @param {Number} port the port number for that host.\n * @param {String} clientId the MQ client identifier.\n */\n\n\n var ClientImpl = function ClientImpl(uri, host, port, path, clientId) {\n // Check dependencies are satisfied in this browser.\n if (!(\"WebSocket\" in global && global.WebSocket !== null)) {\n throw new Error(format(ERROR.UNSUPPORTED, [\"WebSocket\"]));\n }\n\n if (!(\"ArrayBuffer\" in global && global.ArrayBuffer !== null)) {\n throw new Error(format(ERROR.UNSUPPORTED, [\"ArrayBuffer\"]));\n }\n\n this._trace(\"Paho.Client\", uri, host, port, path, clientId);\n\n this.host = host;\n this.port = port;\n this.path = path;\n this.uri = uri;\n this.clientId = clientId;\n this._wsuri = null; // Local storagekeys are qualified with the following string.\n // The conditional inclusion of path in the key is for backward\n // compatibility to when the path was not configurable and assumed to\n // be /mqtt\n\n this._localKey = host + \":\" + port + (path != \"/mqtt\" ? \":\" + path : \"\") + \":\" + clientId + \":\"; // Create private instance-only message queue\n // Internal queue of messages to be sent, in sending order.\n\n this._msg_queue = [];\n this._buffered_msg_queue = []; // Messages we have sent and are expecting a response for, indexed by their respective message ids.\n\n this._sentMessages = {}; // Messages we have received and acknowleged and are expecting a confirm message for\n // indexed by their respective message ids.\n\n this._receivedMessages = {}; // Internal list of callbacks to be executed when messages\n // have been successfully sent over web socket, e.g. disconnect\n // when it doesn't have to wait for ACK, just message is dispatched.\n\n this._notify_msg_sent = {}; // Unique identifier for SEND messages, incrementing\n // counter as messages are sent.\n\n this._message_identifier = 1; // Used to determine the transmission sequence of stored sent messages.\n\n this._sequence = 0; // Load the local state, if any, from the saved version, only restore state relevant to this client.\n\n for (var key in localStorage) {\n if (key.indexOf(\"Sent:\" + this._localKey) === 0 || key.indexOf(\"Received:\" + this._localKey) === 0) this.restore(key);\n }\n }; // Messaging Client public instance members.\n\n\n ClientImpl.prototype.host = null;\n ClientImpl.prototype.port = null;\n ClientImpl.prototype.path = null;\n ClientImpl.prototype.uri = null;\n ClientImpl.prototype.clientId = null; // Messaging Client private instance members.\n\n ClientImpl.prototype.socket = null;\n /* true once we have received an acknowledgement to a CONNECT packet. */\n\n ClientImpl.prototype.connected = false;\n /* The largest message identifier allowed, may not be larger than 2**16 but\n * if set smaller reduces the maximum number of outbound messages allowed.\n */\n\n ClientImpl.prototype.maxMessageIdentifier = 65536;\n ClientImpl.prototype.connectOptions = null;\n ClientImpl.prototype.hostIndex = null;\n ClientImpl.prototype.onConnected = null;\n ClientImpl.prototype.onConnectionLost = null;\n ClientImpl.prototype.onMessageDelivered = null;\n ClientImpl.prototype.onMessageArrived = null;\n ClientImpl.prototype.traceFunction = null;\n ClientImpl.prototype._msg_queue = null;\n ClientImpl.prototype._buffered_msg_queue = null;\n ClientImpl.prototype._connectTimeout = null;\n /* The sendPinger monitors how long we allow before we send data to prove to the server that we are alive. */\n\n ClientImpl.prototype.sendPinger = null;\n /* The receivePinger monitors how long we allow before we require evidence that the server is alive. */\n\n ClientImpl.prototype.receivePinger = null;\n ClientImpl.prototype._reconnectInterval = 1; // Reconnect Delay, starts at 1 second\n\n ClientImpl.prototype._reconnecting = false;\n ClientImpl.prototype._reconnectTimeout = null;\n ClientImpl.prototype.disconnectedPublishing = false;\n ClientImpl.prototype.disconnectedBufferSize = 5000;\n ClientImpl.prototype.receiveBuffer = null;\n ClientImpl.prototype._traceBuffer = null;\n ClientImpl.prototype._MAX_TRACE_ENTRIES = 100;\n\n ClientImpl.prototype.connect = function (connectOptions) {\n var connectOptionsMasked = this._traceMask(connectOptions, \"password\");\n\n this._trace(\"Client.connect\", connectOptionsMasked, this.socket, this.connected);\n\n if (this.connected) throw new Error(format(ERROR.INVALID_STATE, [\"already connected\"]));\n if (this.socket) throw new Error(format(ERROR.INVALID_STATE, [\"already connected\"]));\n\n if (this._reconnecting) {\n // connect() function is called while reconnect is in progress.\n // Terminate the auto reconnect process to use new connect options.\n this._reconnectTimeout.cancel();\n\n this._reconnectTimeout = null;\n this._reconnecting = false;\n }\n\n this.connectOptions = connectOptions;\n this._reconnectInterval = 1;\n this._reconnecting = false;\n\n if (connectOptions.uris) {\n this.hostIndex = 0;\n\n this._doConnect(connectOptions.uris[0]);\n } else {\n this._doConnect(this.uri);\n }\n };\n\n ClientImpl.prototype.subscribe = function (filter, subscribeOptions) {\n this._trace(\"Client.subscribe\", filter, subscribeOptions);\n\n if (!this.connected) throw new Error(format(ERROR.INVALID_STATE, [\"not connected\"]));\n var wireMessage = new WireMessage(MESSAGE_TYPE.SUBSCRIBE);\n wireMessage.topics = filter.constructor === Array ? filter : [filter];\n if (subscribeOptions.qos === undefined) subscribeOptions.qos = 0;\n wireMessage.requestedQos = [];\n\n for (var i = 0; i < wireMessage.topics.length; i++) {\n wireMessage.requestedQos[i] = subscribeOptions.qos;\n }\n\n if (subscribeOptions.onSuccess) {\n wireMessage.onSuccess = function (grantedQos) {\n subscribeOptions.onSuccess({\n invocationContext: subscribeOptions.invocationContext,\n grantedQos: grantedQos\n });\n };\n }\n\n if (subscribeOptions.onFailure) {\n wireMessage.onFailure = function (errorCode) {\n subscribeOptions.onFailure({\n invocationContext: subscribeOptions.invocationContext,\n errorCode: errorCode,\n errorMessage: format(errorCode)\n });\n };\n }\n\n if (subscribeOptions.timeout) {\n wireMessage.timeOut = new Timeout(this, subscribeOptions.timeout, subscribeOptions.onFailure, [{\n invocationContext: subscribeOptions.invocationContext,\n errorCode: ERROR.SUBSCRIBE_TIMEOUT.code,\n errorMessage: format(ERROR.SUBSCRIBE_TIMEOUT)\n }]);\n } // All subscriptions return a SUBACK.\n\n\n this._requires_ack(wireMessage);\n\n this._schedule_message(wireMessage);\n };\n /** @ignore */\n\n\n ClientImpl.prototype.unsubscribe = function (filter, unsubscribeOptions) {\n this._trace(\"Client.unsubscribe\", filter, unsubscribeOptions);\n\n if (!this.connected) throw new Error(format(ERROR.INVALID_STATE, [\"not connected\"]));\n var wireMessage = new WireMessage(MESSAGE_TYPE.UNSUBSCRIBE);\n wireMessage.topics = filter.constructor === Array ? filter : [filter];\n\n if (unsubscribeOptions.onSuccess) {\n wireMessage.callback = function () {\n unsubscribeOptions.onSuccess({\n invocationContext: unsubscribeOptions.invocationContext\n });\n };\n }\n\n if (unsubscribeOptions.timeout) {\n wireMessage.timeOut = new Timeout(this, unsubscribeOptions.timeout, unsubscribeOptions.onFailure, [{\n invocationContext: unsubscribeOptions.invocationContext,\n errorCode: ERROR.UNSUBSCRIBE_TIMEOUT.code,\n errorMessage: format(ERROR.UNSUBSCRIBE_TIMEOUT)\n }]);\n } // All unsubscribes return a SUBACK.\n\n\n this._requires_ack(wireMessage);\n\n this._schedule_message(wireMessage);\n };\n\n ClientImpl.prototype.send = function (message) {\n this._trace(\"Client.send\", message);\n\n var wireMessage = new WireMessage(MESSAGE_TYPE.PUBLISH);\n wireMessage.payloadMessage = message;\n\n if (this.connected) {\n // Mark qos 1 & 2 message as \"ACK required\"\n // For qos 0 message, invoke onMessageDelivered callback if there is one.\n // Then schedule the message.\n if (message.qos > 0) {\n this._requires_ack(wireMessage);\n } else if (this.onMessageDelivered) {\n this._notify_msg_sent[wireMessage] = this.onMessageDelivered(wireMessage.payloadMessage);\n }\n\n this._schedule_message(wireMessage);\n } else {\n // Currently disconnected, will not schedule this message\n // Check if reconnecting is in progress and disconnected publish is enabled.\n if (this._reconnecting && this.disconnectedPublishing) {\n // Check the limit which include the \"required ACK\" messages\n var messageCount = Object.keys(this._sentMessages).length + this._buffered_msg_queue.length;\n\n if (messageCount > this.disconnectedBufferSize) {\n throw new Error(format(ERROR.BUFFER_FULL, [this.disconnectedBufferSize]));\n } else {\n if (message.qos > 0) {\n // Mark this message as \"ACK required\"\n this._requires_ack(wireMessage);\n } else {\n wireMessage.sequence = ++this._sequence; // Add messages in fifo order to array, by adding to start\n\n this._buffered_msg_queue.unshift(wireMessage);\n }\n }\n } else {\n throw new Error(format(ERROR.INVALID_STATE, [\"not connected\"]));\n }\n }\n };\n\n ClientImpl.prototype.disconnect = function () {\n this._trace(\"Client.disconnect\");\n\n if (this._reconnecting) {\n // disconnect() function is called while reconnect is in progress.\n // Terminate the auto reconnect process.\n this._reconnectTimeout.cancel();\n\n this._reconnectTimeout = null;\n this._reconnecting = false;\n }\n\n if (!this.socket) throw new Error(format(ERROR.INVALID_STATE, [\"not connecting or connected\"]));\n var wireMessage = new WireMessage(MESSAGE_TYPE.DISCONNECT); // Run the disconnected call back as soon as the message has been sent,\n // in case of a failure later on in the disconnect processing.\n // as a consequence, the _disconected call back may be run several times.\n\n this._notify_msg_sent[wireMessage] = scope(this._disconnected, this);\n\n this._schedule_message(wireMessage);\n };\n\n ClientImpl.prototype.getTraceLog = function () {\n if (this._traceBuffer !== null) {\n this._trace(\"Client.getTraceLog\", new Date());\n\n this._trace(\"Client.getTraceLog in flight messages\", this._sentMessages.length);\n\n for (var key in this._sentMessages) {\n this._trace(\"_sentMessages \", key, this._sentMessages[key]);\n }\n\n for (var key in this._receivedMessages) {\n this._trace(\"_receivedMessages \", key, this._receivedMessages[key]);\n }\n\n return this._traceBuffer;\n }\n };\n\n ClientImpl.prototype.startTrace = function () {\n if (this._traceBuffer === null) {\n this._traceBuffer = [];\n }\n\n this._trace(\"Client.startTrace\", new Date(), version);\n };\n\n ClientImpl.prototype.stopTrace = function () {\n delete this._traceBuffer;\n };\n\n ClientImpl.prototype._doConnect = function (wsurl) {\n // When the socket is open, this client will send the CONNECT WireMessage using the saved parameters.\n if (this.connectOptions.useSSL) {\n var uriParts = wsurl.split(\":\");\n uriParts[0] = \"wss\";\n wsurl = uriParts.join(\":\");\n }\n\n this._wsuri = wsurl;\n this.connected = false;\n\n if (this.connectOptions.mqttVersion < 4) {\n this.socket = new WebSocket(wsurl, [\"mqttv3.1\"]);\n } else {\n this.socket = new WebSocket(wsurl, [\"mqtt\"]);\n }\n\n this.socket.binaryType = \"arraybuffer\";\n this.socket.onopen = scope(this._on_socket_open, this);\n this.socket.onmessage = scope(this._on_socket_message, this);\n this.socket.onerror = scope(this._on_socket_error, this);\n this.socket.onclose = scope(this._on_socket_close, this);\n this.sendPinger = new Pinger(this, this.connectOptions.keepAliveInterval);\n this.receivePinger = new Pinger(this, this.connectOptions.keepAliveInterval);\n\n if (this._connectTimeout) {\n this._connectTimeout.cancel();\n\n this._connectTimeout = null;\n }\n\n this._connectTimeout = new Timeout(this, this.connectOptions.timeout, this._disconnected, [ERROR.CONNECT_TIMEOUT.code, format(ERROR.CONNECT_TIMEOUT)]);\n }; // Schedule a new message to be sent over the WebSockets\n // connection. CONNECT messages cause WebSocket connection\n // to be started. All other messages are queued internally\n // until this has happened. When WS connection starts, process\n // all outstanding messages.\n\n\n ClientImpl.prototype._schedule_message = function (message) {\n // Add messages in fifo order to array, by adding to start\n this._msg_queue.unshift(message); // Process outstanding messages in the queue if we have an open socket, and have received CONNACK.\n\n\n if (this.connected) {\n this._process_queue();\n }\n };\n\n ClientImpl.prototype.store = function (prefix, wireMessage) {\n var storedMessage = {\n type: wireMessage.type,\n messageIdentifier: wireMessage.messageIdentifier,\n version: 1\n };\n\n switch (wireMessage.type) {\n case MESSAGE_TYPE.PUBLISH:\n if (wireMessage.pubRecReceived) storedMessage.pubRecReceived = true; // Convert the payload to a hex string.\n\n storedMessage.payloadMessage = {};\n var hex = \"\";\n var messageBytes = wireMessage.payloadMessage.payloadBytes;\n\n for (var i = 0; i < messageBytes.length; i++) {\n if (messageBytes[i] <= 0xF) hex = hex + \"0\" + messageBytes[i].toString(16);else hex = hex + messageBytes[i].toString(16);\n }\n\n storedMessage.payloadMessage.payloadHex = hex;\n storedMessage.payloadMessage.qos = wireMessage.payloadMessage.qos;\n storedMessage.payloadMessage.destinationName = wireMessage.payloadMessage.destinationName;\n if (wireMessage.payloadMessage.duplicate) storedMessage.payloadMessage.duplicate = true;\n if (wireMessage.payloadMessage.retained) storedMessage.payloadMessage.retained = true; // Add a sequence number to sent messages.\n\n if (prefix.indexOf(\"Sent:\") === 0) {\n if (wireMessage.sequence === undefined) wireMessage.sequence = ++this._sequence;\n storedMessage.sequence = wireMessage.sequence;\n }\n\n break;\n\n default:\n throw Error(format(ERROR.INVALID_STORED_DATA, [prefix + this._localKey + wireMessage.messageIdentifier, storedMessage]));\n }\n\n localStorage.setItem(prefix + this._localKey + wireMessage.messageIdentifier, JSON.stringify(storedMessage));\n };\n\n ClientImpl.prototype.restore = function (key) {\n var value = localStorage.getItem(key);\n var storedMessage = JSON.parse(value);\n var wireMessage = new WireMessage(storedMessage.type, storedMessage);\n\n switch (storedMessage.type) {\n case MESSAGE_TYPE.PUBLISH:\n // Replace the payload message with a Message object.\n var hex = storedMessage.payloadMessage.payloadHex;\n var buffer = new ArrayBuffer(hex.length / 2);\n var byteStream = new Uint8Array(buffer);\n var i = 0;\n\n while (hex.length >= 2) {\n var x = parseInt(hex.substring(0, 2), 16);\n hex = hex.substring(2, hex.length);\n byteStream[i++] = x;\n }\n\n var payloadMessage = new Message(byteStream);\n payloadMessage.qos = storedMessage.payloadMessage.qos;\n payloadMessage.destinationName = storedMessage.payloadMessage.destinationName;\n if (storedMessage.payloadMessage.duplicate) payloadMessage.duplicate = true;\n if (storedMessage.payloadMessage.retained) payloadMessage.retained = true;\n wireMessage.payloadMessage = payloadMessage;\n break;\n\n default:\n throw Error(format(ERROR.INVALID_STORED_DATA, [key, value]));\n }\n\n if (key.indexOf(\"Sent:\" + this._localKey) === 0) {\n wireMessage.payloadMessage.duplicate = true;\n this._sentMessages[wireMessage.messageIdentifier] = wireMessage;\n } else if (key.indexOf(\"Received:\" + this._localKey) === 0) {\n this._receivedMessages[wireMessage.messageIdentifier] = wireMessage;\n }\n };\n\n ClientImpl.prototype._process_queue = function () {\n var message = null; // Send all queued messages down socket connection\n\n while (message = this._msg_queue.pop()) {\n this._socket_send(message); // Notify listeners that message was successfully sent\n\n\n if (this._notify_msg_sent[message]) {\n this._notify_msg_sent[message]();\n\n delete this._notify_msg_sent[message];\n }\n }\n };\n /**\n * Expect an ACK response for this message. Add message to the set of in progress\n * messages and set an unused identifier in this message.\n * @ignore\n */\n\n\n ClientImpl.prototype._requires_ack = function (wireMessage) {\n var messageCount = Object.keys(this._sentMessages).length;\n if (messageCount > this.maxMessageIdentifier) throw Error(\"Too many messages:\" + messageCount);\n\n while (this._sentMessages[this._message_identifier] !== undefined) {\n this._message_identifier++;\n }\n\n wireMessage.messageIdentifier = this._message_identifier;\n this._sentMessages[wireMessage.messageIdentifier] = wireMessage;\n\n if (wireMessage.type === MESSAGE_TYPE.PUBLISH) {\n this.store(\"Sent:\", wireMessage);\n }\n\n if (this._message_identifier === this.maxMessageIdentifier) {\n this._message_identifier = 1;\n }\n };\n /**\n * Called when the underlying websocket has been opened.\n * @ignore\n */\n\n\n ClientImpl.prototype._on_socket_open = function () {\n // Create the CONNECT message object.\n var wireMessage = new WireMessage(MESSAGE_TYPE.CONNECT, this.connectOptions);\n wireMessage.clientId = this.clientId;\n\n this._socket_send(wireMessage);\n };\n /**\n * Called when the underlying websocket has received a complete packet.\n * @ignore\n */\n\n\n ClientImpl.prototype._on_socket_message = function (event) {\n this._trace(\"Client._on_socket_message\", event.data);\n\n var messages = this._deframeMessages(event.data);\n\n for (var i = 0; i < messages.length; i += 1) {\n this._handleMessage(messages[i]);\n }\n };\n\n ClientImpl.prototype._deframeMessages = function (data) {\n var byteArray = new Uint8Array(data);\n var messages = [];\n\n if (this.receiveBuffer) {\n var newData = new Uint8Array(this.receiveBuffer.length + byteArray.length);\n newData.set(this.receiveBuffer);\n newData.set(byteArray, this.receiveBuffer.length);\n byteArray = newData;\n delete this.receiveBuffer;\n }\n\n try {\n var offset = 0;\n\n while (offset < byteArray.length) {\n var result = decodeMessage(byteArray, offset);\n var wireMessage = result[0];\n offset = result[1];\n\n if (wireMessage !== null) {\n messages.push(wireMessage);\n } else {\n break;\n }\n }\n\n if (offset < byteArray.length) {\n this.receiveBuffer = byteArray.subarray(offset);\n }\n } catch (error) {\n var errorStack = error.hasOwnProperty(\"stack\") == \"undefined\" ? error.stack.toString() : \"No Error Stack Available\";\n\n this._disconnected(ERROR.INTERNAL_ERROR.code, format(ERROR.INTERNAL_ERROR, [error.message, errorStack]));\n\n return;\n }\n\n return messages;\n };\n\n ClientImpl.prototype._handleMessage = function (wireMessage) {\n this._trace(\"Client._handleMessage\", wireMessage);\n\n try {\n switch (wireMessage.type) {\n case MESSAGE_TYPE.CONNACK:\n this._connectTimeout.cancel();\n\n if (this._reconnectTimeout) this._reconnectTimeout.cancel(); // If we have started using clean session then clear up the local state.\n\n if (this.connectOptions.cleanSession) {\n for (var key in this._sentMessages) {\n var sentMessage = this._sentMessages[key];\n localStorage.removeItem(\"Sent:\" + this._localKey + sentMessage.messageIdentifier);\n }\n\n this._sentMessages = {};\n\n for (var key in this._receivedMessages) {\n var receivedMessage = this._receivedMessages[key];\n localStorage.removeItem(\"Received:\" + this._localKey + receivedMessage.messageIdentifier);\n }\n\n this._receivedMessages = {};\n } // Client connected and ready for business.\n\n\n if (wireMessage.returnCode === 0) {\n this.connected = true; // Jump to the end of the list of uris and stop looking for a good host.\n\n if (this.connectOptions.uris) this.hostIndex = this.connectOptions.uris.length;\n } else {\n this._disconnected(ERROR.CONNACK_RETURNCODE.code, format(ERROR.CONNACK_RETURNCODE, [wireMessage.returnCode, CONNACK_RC[wireMessage.returnCode]]));\n\n break;\n } // Resend messages.\n\n\n var sequencedMessages = [];\n\n for (var msgId in this._sentMessages) {\n if (this._sentMessages.hasOwnProperty(msgId)) sequencedMessages.push(this._sentMessages[msgId]);\n } // Also schedule qos 0 buffered messages if any\n\n\n if (this._buffered_msg_queue.length > 0) {\n var msg = null;\n\n while (msg = this._buffered_msg_queue.pop()) {\n sequencedMessages.push(msg);\n if (this.onMessageDelivered) this._notify_msg_sent[msg] = this.onMessageDelivered(msg.payloadMessage);\n }\n } // Sort sentMessages into the original sent order.\n\n\n var sequencedMessages = sequencedMessages.sort(function (a, b) {\n return a.sequence - b.sequence;\n });\n\n for (var i = 0, len = sequencedMessages.length; i < len; i++) {\n var sentMessage = sequencedMessages[i];\n\n if (sentMessage.type == MESSAGE_TYPE.PUBLISH && sentMessage.pubRecReceived) {\n var pubRelMessage = new WireMessage(MESSAGE_TYPE.PUBREL, {\n messageIdentifier: sentMessage.messageIdentifier\n });\n\n this._schedule_message(pubRelMessage);\n } else {\n this._schedule_message(sentMessage);\n }\n } // Execute the connectOptions.onSuccess callback if there is one.\n // Will also now return if this connection was the result of an automatic\n // reconnect and which URI was successfully connected to.\n\n\n if (this.connectOptions.onSuccess) {\n this.connectOptions.onSuccess({\n invocationContext: this.connectOptions.invocationContext\n });\n }\n\n var reconnected = false;\n\n if (this._reconnecting) {\n reconnected = true;\n this._reconnectInterval = 1;\n this._reconnecting = false;\n } // Execute the onConnected callback if there is one.\n\n\n this._connected(reconnected, this._wsuri); // Process all queued messages now that the connection is established.\n\n\n this._process_queue();\n\n break;\n\n case MESSAGE_TYPE.PUBLISH:\n this._receivePublish(wireMessage);\n\n break;\n\n case MESSAGE_TYPE.PUBACK:\n var sentMessage = this._sentMessages[wireMessage.messageIdentifier]; // If this is a re flow of a PUBACK after we have restarted receivedMessage will not exist.\n\n if (sentMessage) {\n delete this._sentMessages[wireMessage.messageIdentifier];\n localStorage.removeItem(\"Sent:\" + this._localKey + wireMessage.messageIdentifier);\n if (this.onMessageDelivered) this.onMessageDelivered(sentMessage.payloadMessage);\n }\n\n break;\n\n case MESSAGE_TYPE.PUBREC:\n var sentMessage = this._sentMessages[wireMessage.messageIdentifier]; // If this is a re flow of a PUBREC after we have restarted receivedMessage will not exist.\n\n if (sentMessage) {\n sentMessage.pubRecReceived = true;\n var pubRelMessage = new WireMessage(MESSAGE_TYPE.PUBREL, {\n messageIdentifier: wireMessage.messageIdentifier\n });\n this.store(\"Sent:\", sentMessage);\n\n this._schedule_message(pubRelMessage);\n }\n\n break;\n\n case MESSAGE_TYPE.PUBREL:\n var receivedMessage = this._receivedMessages[wireMessage.messageIdentifier];\n localStorage.removeItem(\"Received:\" + this._localKey + wireMessage.messageIdentifier); // If this is a re flow of a PUBREL after we have restarted receivedMessage will not exist.\n\n if (receivedMessage) {\n this._receiveMessage(receivedMessage);\n\n delete this._receivedMessages[wireMessage.messageIdentifier];\n } // Always flow PubComp, we may have previously flowed PubComp but the server lost it and restarted.\n\n\n var pubCompMessage = new WireMessage(MESSAGE_TYPE.PUBCOMP, {\n messageIdentifier: wireMessage.messageIdentifier\n });\n\n this._schedule_message(pubCompMessage);\n\n break;\n\n case MESSAGE_TYPE.PUBCOMP:\n var sentMessage = this._sentMessages[wireMessage.messageIdentifier];\n delete this._sentMessages[wireMessage.messageIdentifier];\n localStorage.removeItem(\"Sent:\" + this._localKey + wireMessage.messageIdentifier);\n if (this.onMessageDelivered) this.onMessageDelivered(sentMessage.payloadMessage);\n break;\n\n case MESSAGE_TYPE.SUBACK:\n var sentMessage = this._sentMessages[wireMessage.messageIdentifier];\n\n if (sentMessage) {\n if (sentMessage.timeOut) sentMessage.timeOut.cancel(); // This will need to be fixed when we add multiple topic support\n\n if (wireMessage.returnCode[0] === 0x80) {\n if (sentMessage.onFailure) {\n sentMessage.onFailure(wireMessage.returnCode);\n }\n } else if (sentMessage.onSuccess) {\n sentMessage.onSuccess(wireMessage.returnCode);\n }\n\n delete this._sentMessages[wireMessage.messageIdentifier];\n }\n\n break;\n\n case MESSAGE_TYPE.UNSUBACK:\n var sentMessage = this._sentMessages[wireMessage.messageIdentifier];\n\n if (sentMessage) {\n if (sentMessage.timeOut) sentMessage.timeOut.cancel();\n\n if (sentMessage.callback) {\n sentMessage.callback();\n }\n\n delete this._sentMessages[wireMessage.messageIdentifier];\n }\n\n break;\n\n case MESSAGE_TYPE.PINGRESP:\n /* The sendPinger or receivePinger may have sent a ping, the receivePinger has already been reset. */\n this.sendPinger.reset();\n break;\n\n case MESSAGE_TYPE.DISCONNECT:\n // Clients do not expect to receive disconnect packets.\n this._disconnected(ERROR.INVALID_MQTT_MESSAGE_TYPE.code, format(ERROR.INVALID_MQTT_MESSAGE_TYPE, [wireMessage.type]));\n\n break;\n\n default:\n this._disconnected(ERROR.INVALID_MQTT_MESSAGE_TYPE.code, format(ERROR.INVALID_MQTT_MESSAGE_TYPE, [wireMessage.type]));\n\n }\n } catch (error) {\n var errorStack = error.hasOwnProperty(\"stack\") == \"undefined\" ? error.stack.toString() : \"No Error Stack Available\";\n\n this._disconnected(ERROR.INTERNAL_ERROR.code, format(ERROR.INTERNAL_ERROR, [error.message, errorStack]));\n\n return;\n }\n };\n /** @ignore */\n\n\n ClientImpl.prototype._on_socket_error = function (error) {\n if (!this._reconnecting) {\n this._disconnected(ERROR.SOCKET_ERROR.code, format(ERROR.SOCKET_ERROR, [error.data]));\n }\n };\n /** @ignore */\n\n\n ClientImpl.prototype._on_socket_close = function () {\n if (!this._reconnecting) {\n this._disconnected(ERROR.SOCKET_CLOSE.code, format(ERROR.SOCKET_CLOSE));\n }\n };\n /** @ignore */\n\n\n ClientImpl.prototype._socket_send = function (wireMessage) {\n if (wireMessage.type == 1) {\n var wireMessageMasked = this._traceMask(wireMessage, \"password\");\n\n this._trace(\"Client._socket_send\", wireMessageMasked);\n } else this._trace(\"Client._socket_send\", wireMessage);\n\n this.socket.send(wireMessage.encode());\n /* We have proved to the server we are alive. */\n\n this.sendPinger.reset();\n };\n /** @ignore */\n\n\n ClientImpl.prototype._receivePublish = function (wireMessage) {\n switch (wireMessage.payloadMessage.qos) {\n case \"undefined\":\n case 0:\n this._receiveMessage(wireMessage);\n\n break;\n\n case 1:\n var pubAckMessage = new WireMessage(MESSAGE_TYPE.PUBACK, {\n messageIdentifier: wireMessage.messageIdentifier\n });\n\n this._schedule_message(pubAckMessage);\n\n this._receiveMessage(wireMessage);\n\n break;\n\n case 2:\n this._receivedMessages[wireMessage.messageIdentifier] = wireMessage;\n this.store(\"Received:\", wireMessage);\n var pubRecMessage = new WireMessage(MESSAGE_TYPE.PUBREC, {\n messageIdentifier: wireMessage.messageIdentifier\n });\n\n this._schedule_message(pubRecMessage);\n\n break;\n\n default:\n throw Error(\"Invaild qos=\" + wireMessage.payloadMessage.qos);\n }\n };\n /** @ignore */\n\n\n ClientImpl.prototype._receiveMessage = function (wireMessage) {\n if (this.onMessageArrived) {\n this.onMessageArrived(wireMessage.payloadMessage);\n }\n };\n /**\n * Client has connected.\n * @param {reconnect} [boolean] indicate if this was a result of reconnect operation.\n * @param {uri} [string] fully qualified WebSocket URI of the server.\n */\n\n\n ClientImpl.prototype._connected = function (reconnect, uri) {\n // Execute the onConnected callback if there is one.\n if (this.onConnected) this.onConnected(reconnect, uri);\n };\n /**\n * Attempts to reconnect the client to the server.\n * For each reconnect attempt, will double the reconnect interval\n * up to 128 seconds.\n */\n\n\n ClientImpl.prototype._reconnect = function () {\n this._trace(\"Client._reconnect\");\n\n if (!this.connected) {\n this._reconnecting = true;\n this.sendPinger.cancel();\n this.receivePinger.cancel();\n if (this._reconnectInterval < 128) this._reconnectInterval = this._reconnectInterval * 2;\n\n if (this.connectOptions.uris) {\n this.hostIndex = 0;\n\n this._doConnect(this.connectOptions.uris[0]);\n } else {\n this._doConnect(this.uri);\n }\n }\n };\n /**\n * Client has disconnected either at its own request or because the server\n * or network disconnected it. Remove all non-durable state.\n * @param {errorCode} [number] the error number.\n * @param {errorText} [string] the error text.\n * @ignore\n */\n\n\n ClientImpl.prototype._disconnected = function (errorCode, errorText) {\n this._trace(\"Client._disconnected\", errorCode, errorText);\n\n if (errorCode !== undefined && this._reconnecting) {\n //Continue automatic reconnect process\n this._reconnectTimeout = new Timeout(this, this._reconnectInterval, this._reconnect);\n return;\n }\n\n this.sendPinger.cancel();\n this.receivePinger.cancel();\n\n if (this._connectTimeout) {\n this._connectTimeout.cancel();\n\n this._connectTimeout = null;\n } // Clear message buffers.\n\n\n this._msg_queue = [];\n this._buffered_msg_queue = [];\n this._notify_msg_sent = {};\n\n if (this.socket) {\n // Cancel all socket callbacks so that they cannot be driven again by this socket.\n this.socket.onopen = null;\n this.socket.onmessage = null;\n this.socket.onerror = null;\n this.socket.onclose = null;\n if (this.socket.readyState === 1) this.socket.close();\n delete this.socket;\n }\n\n if (this.connectOptions.uris && this.hostIndex < this.connectOptions.uris.length - 1) {\n // Try the next host.\n this.hostIndex++;\n\n this._doConnect(this.connectOptions.uris[this.hostIndex]);\n } else {\n if (errorCode === undefined) {\n errorCode = ERROR.OK.code;\n errorText = format(ERROR.OK);\n } // Run any application callbacks last as they may attempt to reconnect and hence create a new socket.\n\n\n if (this.connected) {\n this.connected = false; // Execute the connectionLostCallback if there is one, and we were connected.\n\n if (this.onConnectionLost) {\n this.onConnectionLost({\n errorCode: errorCode,\n errorMessage: errorText,\n reconnect: this.connectOptions.reconnect,\n uri: this._wsuri\n });\n }\n\n if (errorCode !== ERROR.OK.code && this.connectOptions.reconnect) {\n // Start automatic reconnect process for the very first time since last successful connect.\n this._reconnectInterval = 1;\n\n this._reconnect();\n\n return;\n }\n } else {\n // Otherwise we never had a connection, so indicate that the connect has failed.\n if (this.connectOptions.mqttVersion === 4 && this.connectOptions.mqttVersionExplicit === false) {\n this._trace(\"Failed to connect V4, dropping back to V3\");\n\n this.connectOptions.mqttVersion = 3;\n\n if (this.connectOptions.uris) {\n this.hostIndex = 0;\n\n this._doConnect(this.connectOptions.uris[0]);\n } else {\n this._doConnect(this.uri);\n }\n } else if (this.connectOptions.onFailure) {\n this.connectOptions.onFailure({\n invocationContext: this.connectOptions.invocationContext,\n errorCode: errorCode,\n errorMessage: errorText\n });\n }\n }\n }\n };\n /** @ignore */\n\n\n ClientImpl.prototype._trace = function () {\n // Pass trace message back to client's callback function\n if (this.traceFunction) {\n var args = Array.prototype.slice.call(arguments);\n\n for (var i in args) {\n if (typeof args[i] !== \"undefined\") args.splice(i, 1, JSON.stringify(args[i]));\n }\n\n var record = args.join(\"\");\n this.traceFunction({\n severity: \"Debug\",\n message: record\n });\n } //buffer style trace\n\n\n if (this._traceBuffer !== null) {\n for (var i = 0, max = arguments.length; i < max; i++) {\n if (this._traceBuffer.length == this._MAX_TRACE_ENTRIES) {\n this._traceBuffer.shift();\n }\n\n if (i === 0) this._traceBuffer.push(arguments[i]);else if (typeof arguments[i] === \"undefined\") this._traceBuffer.push(arguments[i]);else this._traceBuffer.push(\" \" + JSON.stringify(arguments[i]));\n }\n }\n };\n /** @ignore */\n\n\n ClientImpl.prototype._traceMask = function (traceObject, masked) {\n var traceObjectMasked = {};\n\n for (var attr in traceObject) {\n if (traceObject.hasOwnProperty(attr)) {\n if (attr == masked) traceObjectMasked[attr] = \"******\";else traceObjectMasked[attr] = traceObject[attr];\n }\n }\n\n return traceObjectMasked;\n }; // ------------------------------------------------------------------------\n // Public Programming interface.\n // ------------------------------------------------------------------------\n\n /**\n * The JavaScript application communicates to the server using a {@link Paho.Client} object.\n *

\n * Most applications will create just one Client object and then call its connect() method,\n * however applications can create more than one Client object if they wish.\n * In this case the combination of host, port and clientId attributes must be different for each Client object.\n *

\n * The send, subscribe and unsubscribe methods are implemented as asynchronous JavaScript methods\n * (even though the underlying protocol exchange might be synchronous in nature).\n * This means they signal their completion by calling back to the application,\n * via Success or Failure callback functions provided by the application on the method in question.\n * Such callbacks are called at most once per method invocation and do not persist beyond the lifetime\n * of the script that made the invocation.\n *

\n * In contrast there are some callback functions, most notably onMessageArrived,\n * that are defined on the {@link Paho.Client} object.\n * These may get called multiple times, and aren't directly related to specific method invocations made by the client.\n *\n * @name Paho.Client\n *\n * @constructor\n *\n * @param {string} host - the address of the messaging server, as a fully qualified WebSocket URI, as a DNS name or dotted decimal IP address.\n * @param {number} port - the port number to connect to - only required if host is not a URI\n * @param {string} path - the path on the host to connect to - only used if host is not a URI. Default: '/mqtt'.\n * @param {string} clientId - the Messaging client identifier, between 1 and 23 characters in length.\n *\n * @property {string} host - read only the server's DNS hostname or dotted decimal IP address.\n * @property {number} port - read only the server's port.\n * @property {string} path - read only the server's path.\n * @property {string} clientId - read only used when connecting to the server.\n * @property {function} onConnectionLost - called when a connection has been lost.\n * after a connect() method has succeeded.\n * Establish the call back used when a connection has been lost. The connection may be\n * lost because the client initiates a disconnect or because the server or network\n * cause the client to be disconnected. The disconnect call back may be called without\n * the connectionComplete call back being invoked if, for example the client fails to\n * connect.\n * A single response object parameter is passed to the onConnectionLost callback containing the following fields:\n *

    \n *
  1. errorCode\n *
  2. errorMessage\n *
\n * @property {function} onMessageDelivered - called when a message has been delivered.\n * All processing that this Client will ever do has been completed. So, for example,\n * in the case of a Qos=2 message sent by this client, the PubComp flow has been received from the server\n * and the message has been removed from persistent storage before this callback is invoked.\n * Parameters passed to the onMessageDelivered callback are:\n *
    \n *
  1. {@link Paho.Message} that was delivered.\n *
\n * @property {function} onMessageArrived - called when a message has arrived in this Paho.client.\n * Parameters passed to the onMessageArrived callback are:\n *
    \n *
  1. {@link Paho.Message} that has arrived.\n *
\n * @property {function} onConnected - called when a connection is successfully made to the server.\n * after a connect() method.\n * Parameters passed to the onConnected callback are:\n *
    \n *
  1. reconnect (boolean) - If true, the connection was the result of a reconnect.
  2. \n *
  3. URI (string) - The URI used to connect to the server.
  4. \n *
\n * @property {boolean} disconnectedPublishing - if set, will enable disconnected publishing in\n * in the event that the connection to the server is lost.\n * @property {number} disconnectedBufferSize - Used to set the maximum number of messages that the disconnected\n * buffer will hold before rejecting new messages. Default size: 5000 messages\n * @property {function} trace - called whenever trace is called. TODO\n */\n\n\n var Client = function Client(host, port, path, clientId) {\n var uri;\n if (typeof host !== \"string\") throw new Error(format(ERROR.INVALID_TYPE, [typeof host, \"host\"]));\n\n if (arguments.length == 2) {\n // host: must be full ws:// uri\n // port: clientId\n clientId = port;\n uri = host;\n var match = uri.match(/^(wss?):\\/\\/((\\[(.+)\\])|([^\\/]+?))(:(\\d+))?(\\/.*)$/);\n\n if (match) {\n host = match[4] || match[2];\n port = parseInt(match[7]);\n path = match[8];\n } else {\n throw new Error(format(ERROR.INVALID_ARGUMENT, [host, \"host\"]));\n }\n } else {\n if (arguments.length == 3) {\n clientId = path;\n path = \"/mqtt\";\n }\n\n if (typeof port !== \"number\" || port < 0) throw new Error(format(ERROR.INVALID_TYPE, [typeof port, \"port\"]));\n if (typeof path !== \"string\") throw new Error(format(ERROR.INVALID_TYPE, [typeof path, \"path\"]));\n var ipv6AddSBracket = host.indexOf(\":\") !== -1 && host.slice(0, 1) !== \"[\" && host.slice(-1) !== \"]\";\n uri = \"ws://\" + (ipv6AddSBracket ? \"[\" + host + \"]\" : host) + \":\" + port + path;\n }\n\n var clientIdLength = 0;\n\n for (var i = 0; i < clientId.length; i++) {\n var charCode = clientId.charCodeAt(i);\n\n if (0xD800 <= charCode && charCode <= 0xDBFF) {\n i++; // Surrogate pair.\n }\n\n clientIdLength++;\n }\n\n if (typeof clientId !== \"string\" || clientIdLength > 65535) throw new Error(format(ERROR.INVALID_ARGUMENT, [clientId, \"clientId\"]));\n var client = new ClientImpl(uri, host, port, path, clientId); //Public Properties\n\n Object.defineProperties(this, {\n \"host\": {\n get: function get() {\n return host;\n },\n set: function set() {\n throw new Error(format(ERROR.UNSUPPORTED_OPERATION));\n }\n },\n \"port\": {\n get: function get() {\n return port;\n },\n set: function set() {\n throw new Error(format(ERROR.UNSUPPORTED_OPERATION));\n }\n },\n \"path\": {\n get: function get() {\n return path;\n },\n set: function set() {\n throw new Error(format(ERROR.UNSUPPORTED_OPERATION));\n }\n },\n \"uri\": {\n get: function get() {\n return uri;\n },\n set: function set() {\n throw new Error(format(ERROR.UNSUPPORTED_OPERATION));\n }\n },\n \"clientId\": {\n get: function get() {\n return client.clientId;\n },\n set: function set() {\n throw new Error(format(ERROR.UNSUPPORTED_OPERATION));\n }\n },\n \"onConnected\": {\n get: function get() {\n return client.onConnected;\n },\n set: function set(newOnConnected) {\n if (typeof newOnConnected === \"function\") client.onConnected = newOnConnected;else throw new Error(format(ERROR.INVALID_TYPE, [typeof newOnConnected, \"onConnected\"]));\n }\n },\n \"disconnectedPublishing\": {\n get: function get() {\n return client.disconnectedPublishing;\n },\n set: function set(newDisconnectedPublishing) {\n client.disconnectedPublishing = newDisconnectedPublishing;\n }\n },\n \"disconnectedBufferSize\": {\n get: function get() {\n return client.disconnectedBufferSize;\n },\n set: function set(newDisconnectedBufferSize) {\n client.disconnectedBufferSize = newDisconnectedBufferSize;\n }\n },\n \"onConnectionLost\": {\n get: function get() {\n return client.onConnectionLost;\n },\n set: function set(newOnConnectionLost) {\n if (typeof newOnConnectionLost === \"function\") client.onConnectionLost = newOnConnectionLost;else throw new Error(format(ERROR.INVALID_TYPE, [typeof newOnConnectionLost, \"onConnectionLost\"]));\n }\n },\n \"onMessageDelivered\": {\n get: function get() {\n return client.onMessageDelivered;\n },\n set: function set(newOnMessageDelivered) {\n if (typeof newOnMessageDelivered === \"function\") client.onMessageDelivered = newOnMessageDelivered;else throw new Error(format(ERROR.INVALID_TYPE, [typeof newOnMessageDelivered, \"onMessageDelivered\"]));\n }\n },\n \"onMessageArrived\": {\n get: function get() {\n return client.onMessageArrived;\n },\n set: function set(newOnMessageArrived) {\n if (typeof newOnMessageArrived === \"function\") client.onMessageArrived = newOnMessageArrived;else throw new Error(format(ERROR.INVALID_TYPE, [typeof newOnMessageArrived, \"onMessageArrived\"]));\n }\n },\n \"trace\": {\n get: function get() {\n return client.traceFunction;\n },\n set: function set(trace) {\n if (typeof trace === \"function\") {\n client.traceFunction = trace;\n } else {\n throw new Error(format(ERROR.INVALID_TYPE, [typeof trace, \"onTrace\"]));\n }\n }\n }\n });\n /**\n * Connect this Messaging client to its server.\n *\n * @name Paho.Client#connect\n * @function\n * @param {object} connectOptions - Attributes used with the connection.\n * @param {number} connectOptions.timeout - If the connect has not succeeded within this\n * number of seconds, it is deemed to have failed.\n * The default is 30 seconds.\n * @param {string} connectOptions.userName - Authentication username for this connection.\n * @param {string} connectOptions.password - Authentication password for this connection.\n * @param {Paho.Message} connectOptions.willMessage - sent by the server when the client\n * disconnects abnormally.\n * @param {number} connectOptions.keepAliveInterval - the server disconnects this client if\n * there is no activity for this number of seconds.\n * The default value of 60 seconds is assumed if not set.\n * @param {boolean} connectOptions.cleanSession - if true(default) the client and server\n * persistent state is deleted on successful connect.\n * @param {boolean} connectOptions.useSSL - if present and true, use an SSL Websocket connection.\n * @param {object} connectOptions.invocationContext - passed to the onSuccess callback or onFailure callback.\n * @param {function} connectOptions.onSuccess - called when the connect acknowledgement\n * has been received from the server.\n * A single response object parameter is passed to the onSuccess callback containing the following fields:\n *
    \n *
  1. invocationContext as passed in to the onSuccess method in the connectOptions.\n *
\n * @param {function} connectOptions.onFailure - called when the connect request has failed or timed out.\n * A single response object parameter is passed to the onFailure callback containing the following fields:\n *
    \n *
  1. invocationContext as passed in to the onFailure method in the connectOptions.\n *
  2. errorCode a number indicating the nature of the error.\n *
  3. errorMessage text describing the error.\n *
\n * @param {array} connectOptions.hosts - If present this contains either a set of hostnames or fully qualified\n * WebSocket URIs (ws://iot.eclipse.org:80/ws), that are tried in order in place\n * of the host and port paramater on the construtor. The hosts are tried one at at time in order until\n * one of then succeeds.\n * @param {array} connectOptions.ports - If present the set of ports matching the hosts. If hosts contains URIs, this property\n * is not used.\n * @param {boolean} connectOptions.reconnect - Sets whether the client will automatically attempt to reconnect\n * to the server if the connection is lost.\n *
    \n *
  • If set to false, the client will not attempt to automatically reconnect to the server in the event that the\n * connection is lost.
  • \n *
  • If set to true, in the event that the connection is lost, the client will attempt to reconnect to the server.\n * It will initially wait 1 second before it attempts to reconnect, for every failed reconnect attempt, the delay\n * will double until it is at 2 minutes at which point the delay will stay at 2 minutes.
  • \n *
\n * @param {number} connectOptions.mqttVersion - The version of MQTT to use to connect to the MQTT Broker.\n *
    \n *
  • 3 - MQTT V3.1
  • \n *
  • 4 - MQTT V3.1.1
  • \n *
\n * @param {boolean} connectOptions.mqttVersionExplicit - If set to true, will force the connection to use the\n * selected MQTT Version or will fail to connect.\n * @param {array} connectOptions.uris - If present, should contain a list of fully qualified WebSocket uris\n * (e.g. ws://iot.eclipse.org:80/ws), that are tried in order in place of the host and port parameter of the construtor.\n * The uris are tried one at a time in order until one of them succeeds. Do not use this in conjunction with hosts as\n * the hosts array will be converted to uris and will overwrite this property.\n * @throws {InvalidState} If the client is not in disconnected state. The client must have received connectionLost\n * or disconnected before calling connect for a second or subsequent time.\n */\n\n this.connect = function (connectOptions) {\n connectOptions = connectOptions || {};\n validate(connectOptions, {\n timeout: \"number\",\n userName: \"string\",\n password: \"string\",\n willMessage: \"object\",\n keepAliveInterval: \"number\",\n cleanSession: \"boolean\",\n useSSL: \"boolean\",\n invocationContext: \"object\",\n onSuccess: \"function\",\n onFailure: \"function\",\n hosts: \"object\",\n ports: \"object\",\n reconnect: \"boolean\",\n mqttVersion: \"number\",\n mqttVersionExplicit: \"boolean\",\n uris: \"object\"\n }); // If no keep alive interval is set, assume 60 seconds.\n\n if (connectOptions.keepAliveInterval === undefined) connectOptions.keepAliveInterval = 60;\n\n if (connectOptions.mqttVersion > 4 || connectOptions.mqttVersion < 3) {\n throw new Error(format(ERROR.INVALID_ARGUMENT, [connectOptions.mqttVersion, \"connectOptions.mqttVersion\"]));\n }\n\n if (connectOptions.mqttVersion === undefined) {\n connectOptions.mqttVersionExplicit = false;\n connectOptions.mqttVersion = 4;\n } else {\n connectOptions.mqttVersionExplicit = true;\n } //Check that if password is set, so is username\n\n\n if (connectOptions.password !== undefined && connectOptions.userName === undefined) throw new Error(format(ERROR.INVALID_ARGUMENT, [connectOptions.password, \"connectOptions.password\"]));\n\n if (connectOptions.willMessage) {\n if (!(connectOptions.willMessage instanceof Message)) throw new Error(format(ERROR.INVALID_TYPE, [connectOptions.willMessage, \"connectOptions.willMessage\"])); // The will message must have a payload that can be represented as a string.\n // Cause the willMessage to throw an exception if this is not the case.\n\n connectOptions.willMessage.stringPayload = null;\n if (typeof connectOptions.willMessage.destinationName === \"undefined\") throw new Error(format(ERROR.INVALID_TYPE, [typeof connectOptions.willMessage.destinationName, \"connectOptions.willMessage.destinationName\"]));\n }\n\n if (typeof connectOptions.cleanSession === \"undefined\") connectOptions.cleanSession = true;\n\n if (connectOptions.hosts) {\n if (!(connectOptions.hosts instanceof Array)) throw new Error(format(ERROR.INVALID_ARGUMENT, [connectOptions.hosts, \"connectOptions.hosts\"]));\n if (connectOptions.hosts.length < 1) throw new Error(format(ERROR.INVALID_ARGUMENT, [connectOptions.hosts, \"connectOptions.hosts\"]));\n var usingURIs = false;\n\n for (var i = 0; i < connectOptions.hosts.length; i++) {\n if (typeof connectOptions.hosts[i] !== \"string\") throw new Error(format(ERROR.INVALID_TYPE, [typeof connectOptions.hosts[i], \"connectOptions.hosts[\" + i + \"]\"]));\n\n if (/^(wss?):\\/\\/((\\[(.+)\\])|([^\\/]+?))(:(\\d+))?(\\/.*)$/.test(connectOptions.hosts[i])) {\n if (i === 0) {\n usingURIs = true;\n } else if (!usingURIs) {\n throw new Error(format(ERROR.INVALID_ARGUMENT, [connectOptions.hosts[i], \"connectOptions.hosts[\" + i + \"]\"]));\n }\n } else if (usingURIs) {\n throw new Error(format(ERROR.INVALID_ARGUMENT, [connectOptions.hosts[i], \"connectOptions.hosts[\" + i + \"]\"]));\n }\n }\n\n if (!usingURIs) {\n if (!connectOptions.ports) throw new Error(format(ERROR.INVALID_ARGUMENT, [connectOptions.ports, \"connectOptions.ports\"]));\n if (!(connectOptions.ports instanceof Array)) throw new Error(format(ERROR.INVALID_ARGUMENT, [connectOptions.ports, \"connectOptions.ports\"]));\n if (connectOptions.hosts.length !== connectOptions.ports.length) throw new Error(format(ERROR.INVALID_ARGUMENT, [connectOptions.ports, \"connectOptions.ports\"]));\n connectOptions.uris = [];\n\n for (var i = 0; i < connectOptions.hosts.length; i++) {\n if (typeof connectOptions.ports[i] !== \"number\" || connectOptions.ports[i] < 0) throw new Error(format(ERROR.INVALID_TYPE, [typeof connectOptions.ports[i], \"connectOptions.ports[\" + i + \"]\"]));\n var host = connectOptions.hosts[i];\n var port = connectOptions.ports[i];\n var ipv6 = host.indexOf(\":\") !== -1;\n uri = \"ws://\" + (ipv6 ? \"[\" + host + \"]\" : host) + \":\" + port + path;\n connectOptions.uris.push(uri);\n }\n } else {\n connectOptions.uris = connectOptions.hosts;\n }\n }\n\n client.connect(connectOptions);\n };\n /**\n * Subscribe for messages, request receipt of a copy of messages sent to the destinations described by the filter.\n *\n * @name Paho.Client#subscribe\n * @function\n * @param {string} filter describing the destinations to receive messages from.\n *
\n * @param {object} subscribeOptions - used to control the subscription\n *\n * @param {number} subscribeOptions.qos - the maximum qos of any publications sent\n * as a result of making this subscription.\n * @param {object} subscribeOptions.invocationContext - passed to the onSuccess callback\n * or onFailure callback.\n * @param {function} subscribeOptions.onSuccess - called when the subscribe acknowledgement\n * has been received from the server.\n * A single response object parameter is passed to the onSuccess callback containing the following fields:\n *
    \n *
  1. invocationContext if set in the subscribeOptions.\n *
\n * @param {function} subscribeOptions.onFailure - called when the subscribe request has failed or timed out.\n * A single response object parameter is passed to the onFailure callback containing the following fields:\n *
    \n *
  1. invocationContext - if set in the subscribeOptions.\n *
  2. errorCode - a number indicating the nature of the error.\n *
  3. errorMessage - text describing the error.\n *
\n * @param {number} subscribeOptions.timeout - which, if present, determines the number of\n * seconds after which the onFailure calback is called.\n * The presence of a timeout does not prevent the onSuccess\n * callback from being called when the subscribe completes.\n * @throws {InvalidState} if the client is not in connected state.\n */\n\n\n this.subscribe = function (filter, subscribeOptions) {\n if (typeof filter !== \"string\" && filter.constructor !== Array) throw new Error(\"Invalid argument:\" + filter);\n subscribeOptions = subscribeOptions || {};\n validate(subscribeOptions, {\n qos: \"number\",\n invocationContext: \"object\",\n onSuccess: \"function\",\n onFailure: \"function\",\n timeout: \"number\"\n });\n if (subscribeOptions.timeout && !subscribeOptions.onFailure) throw new Error(\"subscribeOptions.timeout specified with no onFailure callback.\");\n if (typeof subscribeOptions.qos !== \"undefined\" && !(subscribeOptions.qos === 0 || subscribeOptions.qos === 1 || subscribeOptions.qos === 2)) throw new Error(format(ERROR.INVALID_ARGUMENT, [subscribeOptions.qos, \"subscribeOptions.qos\"]));\n client.subscribe(filter, subscribeOptions);\n };\n /**\n * Unsubscribe for messages, stop receiving messages sent to destinations described by the filter.\n *\n * @name Paho.Client#unsubscribe\n * @function\n * @param {string} filter - describing the destinations to receive messages from.\n * @param {object} unsubscribeOptions - used to control the subscription\n * @param {object} unsubscribeOptions.invocationContext - passed to the onSuccess callback\n \t\t\t\t\t\t\t\t\t or onFailure callback.\n * @param {function} unsubscribeOptions.onSuccess - called when the unsubscribe acknowledgement has been received from the server.\n * A single response object parameter is passed to the\n * onSuccess callback containing the following fields:\n *
    \n *
  1. invocationContext - if set in the unsubscribeOptions.\n *
\n * @param {function} unsubscribeOptions.onFailure called when the unsubscribe request has failed or timed out.\n * A single response object parameter is passed to the onFailure callback containing the following fields:\n *
    \n *
  1. invocationContext - if set in the unsubscribeOptions.\n *
  2. errorCode - a number indicating the nature of the error.\n *
  3. errorMessage - text describing the error.\n *
\n * @param {number} unsubscribeOptions.timeout - which, if present, determines the number of seconds\n * after which the onFailure callback is called. The presence of\n * a timeout does not prevent the onSuccess callback from being\n * called when the unsubscribe completes\n * @throws {InvalidState} if the client is not in connected state.\n */\n\n\n this.unsubscribe = function (filter, unsubscribeOptions) {\n if (typeof filter !== \"string\" && filter.constructor !== Array) throw new Error(\"Invalid argument:\" + filter);\n unsubscribeOptions = unsubscribeOptions || {};\n validate(unsubscribeOptions, {\n invocationContext: \"object\",\n onSuccess: \"function\",\n onFailure: \"function\",\n timeout: \"number\"\n });\n if (unsubscribeOptions.timeout && !unsubscribeOptions.onFailure) throw new Error(\"unsubscribeOptions.timeout specified with no onFailure callback.\");\n client.unsubscribe(filter, unsubscribeOptions);\n };\n /**\n * Send a message to the consumers of the destination in the Message.\n *\n * @name Paho.Client#send\n * @function\n * @param {string|Paho.Message} topic - mandatory The name of the destination to which the message is to be sent.\n * \t\t\t\t\t - If it is the only parameter, used as Paho.Message object.\n * @param {String|ArrayBuffer} payload - The message data to be sent.\n * @param {number} qos The Quality of Service used to deliver the message.\n * \t\t
\n * \t\t\t
0 Best effort (default).\n * \t\t\t
1 At least once.\n * \t\t\t
2 Exactly once.\n * \t\t
\n * @param {Boolean} retained If true, the message is to be retained by the server and delivered\n * to both current and future subscriptions.\n * If false the server only delivers the message to current subscribers, this is the default for new Messages.\n * A received message has the retained boolean set to true if the message was published\n * with the retained boolean set to true\n * and the subscrption was made after the message has been published.\n * @throws {InvalidState} if the client is not connected.\n */\n\n\n this.send = function (topic, payload, qos, retained) {\n var message;\n\n if (arguments.length === 0) {\n throw new Error(\"Invalid argument.\" + \"length\");\n } else if (arguments.length == 1) {\n if (!(topic instanceof Message) && typeof topic !== \"string\") throw new Error(\"Invalid argument:\" + typeof topic);\n message = topic;\n if (typeof message.destinationName === \"undefined\") throw new Error(format(ERROR.INVALID_ARGUMENT, [message.destinationName, \"Message.destinationName\"]));\n client.send(message);\n } else {\n //parameter checking in Message object\n message = new Message(payload);\n message.destinationName = topic;\n if (arguments.length >= 3) message.qos = qos;\n if (arguments.length >= 4) message.retained = retained;\n client.send(message);\n }\n };\n /**\n * Publish a message to the consumers of the destination in the Message.\n * Synonym for Paho.Mqtt.Client#send\n *\n * @name Paho.Client#publish\n * @function\n * @param {string|Paho.Message} topic - mandatory The name of the topic to which the message is to be published.\n * \t\t\t\t\t - If it is the only parameter, used as Paho.Message object.\n * @param {String|ArrayBuffer} payload - The message data to be published.\n * @param {number} qos The Quality of Service used to deliver the message.\n * \t\t
\n * \t\t\t
0 Best effort (default).\n * \t\t\t
1 At least once.\n * \t\t\t
2 Exactly once.\n * \t\t
\n * @param {Boolean} retained If true, the message is to be retained by the server and delivered\n * to both current and future subscriptions.\n * If false the server only delivers the message to current subscribers, this is the default for new Messages.\n * A received message has the retained boolean set to true if the message was published\n * with the retained boolean set to true\n * and the subscrption was made after the message has been published.\n * @throws {InvalidState} if the client is not connected.\n */\n\n\n this.publish = function (topic, payload, qos, retained) {\n var message;\n\n if (arguments.length === 0) {\n throw new Error(\"Invalid argument.\" + \"length\");\n } else if (arguments.length == 1) {\n if (!(topic instanceof Message) && typeof topic !== \"string\") throw new Error(\"Invalid argument:\" + typeof topic);\n message = topic;\n if (typeof message.destinationName === \"undefined\") throw new Error(format(ERROR.INVALID_ARGUMENT, [message.destinationName, \"Message.destinationName\"]));\n client.send(message);\n } else {\n //parameter checking in Message object\n message = new Message(payload);\n message.destinationName = topic;\n if (arguments.length >= 3) message.qos = qos;\n if (arguments.length >= 4) message.retained = retained;\n client.send(message);\n }\n };\n /**\n * Normal disconnect of this Messaging client from its server.\n *\n * @name Paho.Client#disconnect\n * @function\n * @throws {InvalidState} if the client is already disconnected.\n */\n\n\n this.disconnect = function () {\n client.disconnect();\n };\n /**\n * Get the contents of the trace log.\n *\n * @name Paho.Client#getTraceLog\n * @function\n * @return {Object[]} tracebuffer containing the time ordered trace records.\n */\n\n\n this.getTraceLog = function () {\n return client.getTraceLog();\n };\n /**\n * Start tracing.\n *\n * @name Paho.Client#startTrace\n * @function\n */\n\n\n this.startTrace = function () {\n client.startTrace();\n };\n /**\n * Stop tracing.\n *\n * @name Paho.Client#stopTrace\n * @function\n */\n\n\n this.stopTrace = function () {\n client.stopTrace();\n };\n\n this.isConnected = function () {\n return client.connected;\n };\n };\n /**\n * An application message, sent or received.\n *

\n * All attributes may be null, which implies the default values.\n *\n * @name Paho.Message\n * @constructor\n * @param {String|ArrayBuffer} payload The message data to be sent.\n *

\n * @property {string} payloadString read only The payload as a string if the payload consists of valid UTF-8 characters.\n * @property {ArrayBuffer} payloadBytes read only The payload as an ArrayBuffer.\n *

\n * @property {string} destinationName mandatory The name of the destination to which the message is to be sent\n * (for messages about to be sent) or the name of the destination from which the message has been received.\n * (for messages received by the onMessage function).\n *

\n * @property {number} qos The Quality of Service used to deliver the message.\n *

\n *
0 Best effort (default).\n *
1 At least once.\n *
2 Exactly once.\n *
\n *

\n * @property {Boolean} retained If true, the message is to be retained by the server and delivered\n * to both current and future subscriptions.\n * If false the server only delivers the message to current subscribers, this is the default for new Messages.\n * A received message has the retained boolean set to true if the message was published\n * with the retained boolean set to true\n * and the subscrption was made after the message has been published.\n *

\n * @property {Boolean} duplicate read only If true, this message might be a duplicate of one which has already been received.\n * This is only set on messages received from the server.\n *\n */\n\n\n var Message = function Message(newPayload) {\n var payload;\n\n if (typeof newPayload === \"string\" || newPayload instanceof ArrayBuffer || ArrayBuffer.isView(newPayload) && !(newPayload instanceof DataView)) {\n payload = newPayload;\n } else {\n throw format(ERROR.INVALID_ARGUMENT, [newPayload, \"newPayload\"]);\n }\n\n var destinationName;\n var qos = 0;\n var retained = false;\n var duplicate = false;\n Object.defineProperties(this, {\n \"payloadString\": {\n enumerable: true,\n get: function get() {\n if (typeof payload === \"string\") return payload;else return parseUTF8(payload, 0, payload.length);\n }\n },\n \"payloadBytes\": {\n enumerable: true,\n get: function get() {\n if (typeof payload === \"string\") {\n var buffer = new ArrayBuffer(UTF8Length(payload));\n var byteStream = new Uint8Array(buffer);\n stringToUTF8(payload, byteStream, 0);\n return byteStream;\n } else {\n return payload;\n }\n }\n },\n \"destinationName\": {\n enumerable: true,\n get: function get() {\n return destinationName;\n },\n set: function set(newDestinationName) {\n if (typeof newDestinationName === \"string\") destinationName = newDestinationName;else throw new Error(format(ERROR.INVALID_ARGUMENT, [newDestinationName, \"newDestinationName\"]));\n }\n },\n \"qos\": {\n enumerable: true,\n get: function get() {\n return qos;\n },\n set: function set(newQos) {\n if (newQos === 0 || newQos === 1 || newQos === 2) qos = newQos;else throw new Error(\"Invalid argument:\" + newQos);\n }\n },\n \"retained\": {\n enumerable: true,\n get: function get() {\n return retained;\n },\n set: function set(newRetained) {\n if (typeof newRetained === \"boolean\") retained = newRetained;else throw new Error(format(ERROR.INVALID_ARGUMENT, [newRetained, \"newRetained\"]));\n }\n },\n \"topic\": {\n enumerable: true,\n get: function get() {\n return destinationName;\n },\n set: function set(newTopic) {\n destinationName = newTopic;\n }\n },\n \"duplicate\": {\n enumerable: true,\n get: function get() {\n return duplicate;\n },\n set: function set(newDuplicate) {\n duplicate = newDuplicate;\n }\n }\n });\n }; // Module contents.\n\n\n return {\n Client: Client,\n Message: Message\n }; // eslint-disable-next-line no-nested-ternary\n }(typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {});\n\n return PahoMQTT;\n});","module.exports = require('./lib/Observable.js').Observable;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.Observable = void 0;\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n} // === Symbol Support ===\n\n\nvar hasSymbols = function hasSymbols() {\n return typeof Symbol === 'function';\n};\n\nvar hasSymbol = function hasSymbol(name) {\n return hasSymbols() && Boolean(Symbol[name]);\n};\n\nvar getSymbol = function getSymbol(name) {\n return hasSymbol(name) ? Symbol[name] : '@@' + name;\n};\n\nif (hasSymbols() && !hasSymbol('observable')) {\n Symbol.observable = Symbol('observable');\n}\n\nvar SymbolIterator = getSymbol('iterator');\nvar SymbolObservable = getSymbol('observable');\nvar SymbolSpecies = getSymbol('species'); // === Abstract Operations ===\n\nfunction getMethod(obj, key) {\n var value = obj[key];\n if (value == null) return undefined;\n if (typeof value !== 'function') throw new TypeError(value + ' is not a function');\n return value;\n}\n\nfunction getSpecies(obj) {\n var ctor = obj.constructor;\n\n if (ctor !== undefined) {\n ctor = ctor[SymbolSpecies];\n\n if (ctor === null) {\n ctor = undefined;\n }\n }\n\n return ctor !== undefined ? ctor : Observable;\n}\n\nfunction isObservable(x) {\n return x instanceof Observable; // SPEC: Brand check\n}\n\nfunction hostReportError(e) {\n if (hostReportError.log) {\n hostReportError.log(e);\n } else {\n setTimeout(function () {\n throw e;\n });\n }\n}\n\nfunction enqueue(fn) {\n Promise.resolve().then(function () {\n try {\n fn();\n } catch (e) {\n hostReportError(e);\n }\n });\n}\n\nfunction cleanupSubscription(subscription) {\n var cleanup = subscription._cleanup;\n if (cleanup === undefined) return;\n subscription._cleanup = undefined;\n\n if (!cleanup) {\n return;\n }\n\n try {\n if (typeof cleanup === 'function') {\n cleanup();\n } else {\n var unsubscribe = getMethod(cleanup, 'unsubscribe');\n\n if (unsubscribe) {\n unsubscribe.call(cleanup);\n }\n }\n } catch (e) {\n hostReportError(e);\n }\n}\n\nfunction closeSubscription(subscription) {\n subscription._observer = undefined;\n subscription._queue = undefined;\n subscription._state = 'closed';\n}\n\nfunction flushSubscription(subscription) {\n var queue = subscription._queue;\n\n if (!queue) {\n return;\n }\n\n subscription._queue = undefined;\n subscription._state = 'ready';\n\n for (var i = 0; i < queue.length; ++i) {\n notifySubscription(subscription, queue[i].type, queue[i].value);\n if (subscription._state === 'closed') break;\n }\n}\n\nfunction notifySubscription(subscription, type, value) {\n subscription._state = 'running';\n var observer = subscription._observer;\n\n try {\n var m = getMethod(observer, type);\n\n switch (type) {\n case 'next':\n if (m) m.call(observer, value);\n break;\n\n case 'error':\n closeSubscription(subscription);\n if (m) m.call(observer, value);else throw value;\n break;\n\n case 'complete':\n closeSubscription(subscription);\n if (m) m.call(observer);\n break;\n }\n } catch (e) {\n hostReportError(e);\n }\n\n if (subscription._state === 'closed') cleanupSubscription(subscription);else if (subscription._state === 'running') subscription._state = 'ready';\n}\n\nfunction onNotify(subscription, type, value) {\n if (subscription._state === 'closed') return;\n\n if (subscription._state === 'buffering') {\n subscription._queue.push({\n type: type,\n value: value\n });\n\n return;\n }\n\n if (subscription._state !== 'ready') {\n subscription._state = 'buffering';\n subscription._queue = [{\n type: type,\n value: value\n }];\n enqueue(function () {\n return flushSubscription(subscription);\n });\n return;\n }\n\n notifySubscription(subscription, type, value);\n}\n\nvar Subscription = /*#__PURE__*/function () {\n function Subscription(observer, subscriber) {\n _classCallCheck(this, Subscription); // ASSERT: observer is an object\n // ASSERT: subscriber is callable\n\n\n this._cleanup = undefined;\n this._observer = observer;\n this._queue = undefined;\n this._state = 'initializing';\n var subscriptionObserver = new SubscriptionObserver(this);\n\n try {\n this._cleanup = subscriber.call(undefined, subscriptionObserver);\n } catch (e) {\n subscriptionObserver.error(e);\n }\n\n if (this._state === 'initializing') this._state = 'ready';\n }\n\n _createClass(Subscription, [{\n key: \"unsubscribe\",\n value: function unsubscribe() {\n if (this._state !== 'closed') {\n closeSubscription(this);\n cleanupSubscription(this);\n }\n }\n }, {\n key: \"closed\",\n get: function get() {\n return this._state === 'closed';\n }\n }]);\n\n return Subscription;\n}();\n\nvar SubscriptionObserver = /*#__PURE__*/function () {\n function SubscriptionObserver(subscription) {\n _classCallCheck(this, SubscriptionObserver);\n\n this._subscription = subscription;\n }\n\n _createClass(SubscriptionObserver, [{\n key: \"next\",\n value: function next(value) {\n onNotify(this._subscription, 'next', value);\n }\n }, {\n key: \"error\",\n value: function error(value) {\n onNotify(this._subscription, 'error', value);\n }\n }, {\n key: \"complete\",\n value: function complete() {\n onNotify(this._subscription, 'complete');\n }\n }, {\n key: \"closed\",\n get: function get() {\n return this._subscription._state === 'closed';\n }\n }]);\n\n return SubscriptionObserver;\n}();\n\nvar Observable = /*#__PURE__*/function () {\n function Observable(subscriber) {\n _classCallCheck(this, Observable);\n\n if (!(this instanceof Observable)) throw new TypeError('Observable cannot be called as a function');\n if (typeof subscriber !== 'function') throw new TypeError('Observable initializer must be a function');\n this._subscriber = subscriber;\n }\n\n _createClass(Observable, [{\n key: \"subscribe\",\n value: function subscribe(observer) {\n if (typeof observer !== 'object' || observer === null) {\n observer = {\n next: observer,\n error: arguments[1],\n complete: arguments[2]\n };\n }\n\n return new Subscription(observer, this._subscriber);\n }\n }, {\n key: \"forEach\",\n value: function forEach(fn) {\n var _this = this;\n\n return new Promise(function (resolve, reject) {\n if (typeof fn !== 'function') {\n reject(new TypeError(fn + ' is not a function'));\n return;\n }\n\n function done() {\n subscription.unsubscribe();\n resolve();\n }\n\n var subscription = _this.subscribe({\n next: function next(value) {\n try {\n fn(value, done);\n } catch (e) {\n reject(e);\n subscription.unsubscribe();\n }\n },\n error: reject,\n complete: resolve\n });\n });\n }\n }, {\n key: \"map\",\n value: function map(fn) {\n var _this2 = this;\n\n if (typeof fn !== 'function') throw new TypeError(fn + ' is not a function');\n var C = getSpecies(this);\n return new C(function (observer) {\n return _this2.subscribe({\n next: function next(value) {\n try {\n value = fn(value);\n } catch (e) {\n return observer.error(e);\n }\n\n observer.next(value);\n },\n error: function error(e) {\n observer.error(e);\n },\n complete: function complete() {\n observer.complete();\n }\n });\n });\n }\n }, {\n key: \"filter\",\n value: function filter(fn) {\n var _this3 = this;\n\n if (typeof fn !== 'function') throw new TypeError(fn + ' is not a function');\n var C = getSpecies(this);\n return new C(function (observer) {\n return _this3.subscribe({\n next: function next(value) {\n try {\n if (!fn(value)) return;\n } catch (e) {\n return observer.error(e);\n }\n\n observer.next(value);\n },\n error: function error(e) {\n observer.error(e);\n },\n complete: function complete() {\n observer.complete();\n }\n });\n });\n }\n }, {\n key: \"reduce\",\n value: function reduce(fn) {\n var _this4 = this;\n\n if (typeof fn !== 'function') throw new TypeError(fn + ' is not a function');\n var C = getSpecies(this);\n var hasSeed = arguments.length > 1;\n var hasValue = false;\n var seed = arguments[1];\n var acc = seed;\n return new C(function (observer) {\n return _this4.subscribe({\n next: function next(value) {\n var first = !hasValue;\n hasValue = true;\n\n if (!first || hasSeed) {\n try {\n acc = fn(acc, value);\n } catch (e) {\n return observer.error(e);\n }\n } else {\n acc = value;\n }\n },\n error: function error(e) {\n observer.error(e);\n },\n complete: function complete() {\n if (!hasValue && !hasSeed) return observer.error(new TypeError('Cannot reduce an empty sequence'));\n observer.next(acc);\n observer.complete();\n }\n });\n });\n }\n }, {\n key: \"concat\",\n value: function concat() {\n var _this5 = this;\n\n for (var _len = arguments.length, sources = new Array(_len), _key = 0; _key < _len; _key++) {\n sources[_key] = arguments[_key];\n }\n\n var C = getSpecies(this);\n return new C(function (observer) {\n var subscription;\n var index = 0;\n\n function startNext(next) {\n subscription = next.subscribe({\n next: function next(v) {\n observer.next(v);\n },\n error: function error(e) {\n observer.error(e);\n },\n complete: function complete() {\n if (index === sources.length) {\n subscription = undefined;\n observer.complete();\n } else {\n startNext(C.from(sources[index++]));\n }\n }\n });\n }\n\n startNext(_this5);\n return function () {\n if (subscription) {\n subscription.unsubscribe();\n subscription = undefined;\n }\n };\n });\n }\n }, {\n key: \"flatMap\",\n value: function flatMap(fn) {\n var _this6 = this;\n\n if (typeof fn !== 'function') throw new TypeError(fn + ' is not a function');\n var C = getSpecies(this);\n return new C(function (observer) {\n var subscriptions = [];\n\n var outer = _this6.subscribe({\n next: function next(value) {\n if (fn) {\n try {\n value = fn(value);\n } catch (e) {\n return observer.error(e);\n }\n }\n\n var inner = C.from(value).subscribe({\n next: function next(value) {\n observer.next(value);\n },\n error: function error(e) {\n observer.error(e);\n },\n complete: function complete() {\n var i = subscriptions.indexOf(inner);\n if (i >= 0) subscriptions.splice(i, 1);\n completeIfDone();\n }\n });\n subscriptions.push(inner);\n },\n error: function error(e) {\n observer.error(e);\n },\n complete: function complete() {\n completeIfDone();\n }\n });\n\n function completeIfDone() {\n if (outer.closed && subscriptions.length === 0) observer.complete();\n }\n\n return function () {\n subscriptions.forEach(function (s) {\n return s.unsubscribe();\n });\n outer.unsubscribe();\n };\n });\n }\n }, {\n key: SymbolObservable,\n value: function value() {\n return this;\n }\n }], [{\n key: \"from\",\n value: function from(x) {\n var C = typeof this === 'function' ? this : Observable;\n if (x == null) throw new TypeError(x + ' is not an object');\n var method = getMethod(x, SymbolObservable);\n\n if (method) {\n var observable = method.call(x);\n if (Object(observable) !== observable) throw new TypeError(observable + ' is not an object');\n if (isObservable(observable) && observable.constructor === C) return observable;\n return new C(function (observer) {\n return observable.subscribe(observer);\n });\n }\n\n if (hasSymbol('iterator')) {\n method = getMethod(x, SymbolIterator);\n\n if (method) {\n return new C(function (observer) {\n enqueue(function () {\n if (observer.closed) return;\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = method.call(x)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var _item = _step.value;\n observer.next(_item);\n if (observer.closed) return;\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n observer.complete();\n });\n });\n }\n }\n\n if (Array.isArray(x)) {\n return new C(function (observer) {\n enqueue(function () {\n if (observer.closed) return;\n\n for (var i = 0; i < x.length; ++i) {\n observer.next(x[i]);\n if (observer.closed) return;\n }\n\n observer.complete();\n });\n });\n }\n\n throw new TypeError(x + ' is not observable');\n }\n }, {\n key: \"of\",\n value: function of() {\n for (var _len2 = arguments.length, items = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n items[_key2] = arguments[_key2];\n }\n\n var C = typeof this === 'function' ? this : Observable;\n return new C(function (observer) {\n enqueue(function () {\n if (observer.closed) return;\n\n for (var i = 0; i < items.length; ++i) {\n observer.next(items[i]);\n if (observer.closed) return;\n }\n\n observer.complete();\n });\n });\n }\n }, {\n key: SymbolSpecies,\n get: function get() {\n return this;\n }\n }]);\n\n return Observable;\n}();\n\nexports.Observable = Observable;\n\nif (hasSymbols()) {\n Object.defineProperty(Observable, Symbol('extensions'), {\n value: {\n symbol: SymbolObservable,\n hostReportError: hostReportError\n },\n configurable: true\n });\n}","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function define(obj, key, value) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n return obj[key];\n }\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\");\n } catch (err) {\n define = function(obj, key, value) {\n return obj[key] = value;\n };\n }\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n define(IteratorPrototype, iteratorSymbol, function () {\n return this;\n });\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = GeneratorFunctionPrototype;\n define(Gp, \"constructor\", GeneratorFunctionPrototype);\n define(GeneratorFunctionPrototype, \"constructor\", GeneratorFunction);\n GeneratorFunction.displayName = define(\n GeneratorFunctionPrototype,\n toStringTagSymbol,\n \"GeneratorFunction\"\n );\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n define(prototype, method, function(arg) {\n return this._invoke(method, arg);\n });\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n define(genFun, toStringTagSymbol, \"GeneratorFunction\");\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n define(AsyncIterator.prototype, asyncIteratorSymbol, function () {\n return this;\n });\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n define(Gp, toStringTagSymbol, \"Generator\");\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n define(Gp, iteratorSymbol, function() {\n return this;\n });\n\n define(Gp, \"toString\", function() {\n return \"[object Generator]\";\n });\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, in modern engines\n // we can explicitly access globalThis. In older engines we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n if (typeof globalThis === \"object\") {\n globalThis.regeneratorRuntime = runtime;\n } else {\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n }\n}\n","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\n\nexport default function _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n}"],"names":["module","exports","Symbol","for","undefined","_typeof","obj","iterator","constructor","prototype","inspect","value","formatValue","seenValues","JSON","stringify","name","concat","previouslySeenValues","indexOf","customInspectFn","object","String","getCustomFn","customValue","call","Array","isArray","array","length","len","Math","min","remaining","items","i","push","join","formatArray","keys","Object","tag","toString","replace","getObjectTag","properties","map","key","formatObject","formatObjectValue","devAssert","condition","message","Boolean","Error","defineToJSON","classObject","fn","arguments","toJSON","getLocation","source","position","match","lineRegexp","line","column","exec","body","index","printLocation","location","printSourceLocation","start","sourceLocation","firstLineColumnOffset","locationOffset","whitespace","lineIndex","lineOffset","lineNum","columnOffset","columnNum","locationStr","lines","split","locationLine","sublineIndex","floor","sublineColumnNum","sublines","slice","printPrefixedLines","subline","existingLines","filter","_ref","padLen","max","apply","_ref2","_ref3","str","prefix","GraphQLError","nodes","positions","path","originalError","extensions","_nodes","_source","node","loc","_locations","_positions","reduce","list","pos","_extensions","originalExtensions","defineProperties","this","enumerable","writable","locations","stack","defineProperty","configurable","captureStackTrace","syntaxError","description","create","error","output","_i2","_error$nodes2","_i4","_error$locations2","printError","Kind","freeze","NAME","DOCUMENT","OPERATION_DEFINITION","VARIABLE_DEFINITION","SELECTION_SET","FIELD","ARGUMENT","FRAGMENT_SPREAD","INLINE_FRAGMENT","FRAGMENT_DEFINITION","VARIABLE","INT","FLOAT","STRING","BOOLEAN","NULL","ENUM","LIST","OBJECT","OBJECT_FIELD","DIRECTIVE","NAMED_TYPE","LIST_TYPE","NON_NULL_TYPE","SCHEMA_DEFINITION","OPERATION_TYPE_DEFINITION","SCALAR_TYPE_DEFINITION","OBJECT_TYPE_DEFINITION","FIELD_DEFINITION","INPUT_VALUE_DEFINITION","INTERFACE_TYPE_DEFINITION","UNION_TYPE_DEFINITION","ENUM_TYPE_DEFINITION","ENUM_VALUE_DEFINITION","INPUT_OBJECT_TYPE_DEFINITION","DIRECTIVE_DEFINITION","SCHEMA_EXTENSION","SCALAR_TYPE_EXTENSION","OBJECT_TYPE_EXTENSION","INTERFACE_TYPE_EXTENSION","UNION_TYPE_EXTENSION","ENUM_TYPE_EXTENSION","INPUT_OBJECT_TYPE_EXTENSION","Source","dedentBlockStringValue","rawString","commonIndent","indent","leadingWhitespace","getBlockStringIndentation","isBlank","shift","pop","toStringTag","get","SOF","EOF","BANG","DOLLAR","AMP","PAREN_L","PAREN_R","SPREAD","COLON","EQUALS","AT","BRACKET_L","BRACKET_R","BRACE_L","PIPE","BRACE_R","BLOCK_STRING","COMMENT","advanceLexer","lastToken","token","lookahead","kind","next","readToken","Tok","end","prev","printCharCode","code","isNaN","fromCharCode","toUpperCase","lexer","bodyLength","startPosition","charCodeAt","lineStart","positionAfterWhitespace","col","readComment","readName","firstCode","isFloat","readDigits","readNumber","chunkStart","rawValue","readBlockString","charCode","uniCharCode","invalidSequence","readString","unexpectedCharacterMessage","a","b","c","d","char2hex","DirectiveLocation","QUERY","MUTATION","SUBSCRIPTION","SCHEMA","SCALAR","ARGUMENT_DEFINITION","INTERFACE","UNION","ENUM_VALUE","INPUT_OBJECT","INPUT_FIELD_DEFINITION","parse","options","Parser","parseDocument","sourceObj","_lexer","startOfFileToken","advance","createLexer","_options","_proto","parseName","expectToken","definitions","many","parseDefinition","peek","parseOperationDefinition","parseFragmentDefinition","parseTypeSystemDefinition","parseTypeSystemExtension","peekDescription","unexpected","operation","variableDefinitions","directives","selectionSet","parseSelectionSet","parseOperationType","parseVariableDefinitions","parseDirectives","operationToken","optionalMany","parseVariableDefinition","variable","parseVariable","type","parseTypeReference","defaultValue","expectOptionalToken","parseValueLiteral","selections","parseSelection","parseFragment","parseField","alias","nameOrAlias","parseArguments","isConst","item","parseConstArgument","parseArgument","hasTypeCondition","expectOptionalKeyword","parseFragmentName","typeCondition","parseNamedType","expectKeyword","experimentalFragmentVariables","parseList","parseObject","parseStringLiteral","block","_this","values","any","_this2","fields","parseObjectField","parseDirective","keywordToken","parseSchemaDefinition","parseScalarTypeDefinition","parseObjectTypeDefinition","parseInterfaceTypeDefinition","parseUnionTypeDefinition","parseEnumTypeDefinition","parseInputObjectTypeDefinition","parseDirectiveDefinition","parseDescription","operationTypes","parseOperationTypeDefinition","interfaces","parseImplementsInterfaces","parseFieldsDefinition","types","allowLegacySDLImplementsInterfaces","allowLegacySDLEmptyFields","parseFieldDefinition","args","parseArgumentDefs","parseInputValueDef","parseUnionMemberTypes","parseEnumValuesDefinition","parseEnumValueDefinition","parseInputFieldsDefinition","parseSchemaExtension","parseScalarTypeExtension","parseObjectTypeExtension","parseInterfaceTypeExtension","parseUnionTypeExtension","parseEnumTypeExtension","parseInputObjectTypeExtension","repeatable","parseDirectiveLocations","parseDirectiveLocation","startToken","noLocation","Loc","getTokenDesc","atToken","openKind","parseFn","closeKind","endToken","QueryDocumentKeys","Name","Document","OperationDefinition","VariableDefinition","Variable","SelectionSet","Field","Argument","FragmentSpread","InlineFragment","FragmentDefinition","IntValue","FloatValue","StringValue","BooleanValue","NullValue","EnumValue","ListValue","ObjectValue","ObjectField","Directive","NamedType","ListType","NonNullType","SchemaDefinition","OperationTypeDefinition","ScalarTypeDefinition","ObjectTypeDefinition","FieldDefinition","InputValueDefinition","InterfaceTypeDefinition","UnionTypeDefinition","EnumTypeDefinition","EnumValueDefinition","InputObjectTypeDefinition","DirectiveDefinition","SchemaExtension","ScalarTypeExtension","ObjectTypeExtension","InterfaceTypeExtension","UnionTypeExtension","EnumTypeExtension","InputObjectTypeExtension","BREAK","isNode","maybeNode","getVisitFn","visitor","isLeaving","kindVisitor","kindSpecificVisitor","leave","enter","specificVisitor","specificKindVisitor","print","ast","root","visitorKeys","inArray","edits","parent","ancestors","newRoot","isEdited","clone","_Object$keys2","k","editOffset","ii","editKey","editValue","splice","result","visitFn","visit","printDocASTReducer","op","varDefs","wrap","_ref4","_ref5","_ref6","_ref7","_ref8","_ref9","_ref10","indentation","preferMultipleLines","isSingleLine","hasLeadingSpace","hasTrailingQuote","printAsMultipleLines","printBlockString","_ref11","_ref12","_ref13","_ref14","_ref15","_ref16","_ref17","_ref18","_ref19","_ref20","_ref21","addDescription","_ref22","_ref23","_ref24","hasMultilineItems","_ref25","_ref26","_ref27","_ref28","_ref29","_ref30","_ref31","_ref32","_ref33","_ref34","_ref35","_ref36","_ref37","_ref38","cb","maybeArray","separator","x","maybeString","isMultiline","string","some","_extendStatics","Constants","userAgent","Platform","hasSymbol","INTERNAL_AWS_APPSYNC_PUBSUB_PROVIDER","INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER","__assign","assign","t","s","n","p","hasOwnProperty","logger","AbstractPubSubProvider","_config","configure","config","debug","getProviderName","getCategory","__extends","setPrototypeOf","__proto__","__","__awaiter","thisArg","_arguments","P","generator","Promise","resolve","reject","fulfilled","step","e","rejected","done","then","__generator","f","y","g","_","label","sent","trys","ops","verb","v","TypeError","__rest","getOwnPropertySymbols","propertyIsEnumerable","ClientsQueue","promises","Map","clientId","clientFactory","promise","_a","set","from","remove","delete","topicSymbol","MqttOverWSProvider","_super","uuid","_clientsQueue","_topicObservers","_clientIdObservers","aws_pubsub_endpoint","aws_appsync_dangerously_connect_to_http_endpoint_for_testing","getTopicForValue","onDisconnect","errorCode","warn","topicsToDelete_1","clientIdObservers","forEach","observer","observerForTopic","observerTopic","size","topic","newClient","url","client","_b","onMessageArrived","destinationName","msg","payloadString","_onMessage","onConnectionLost","connect","useSSL","isSSLEnabled","mqttVersion","onSuccess","onFailure","clientsQueue","disconnect","isConnected","publish","topics","targetTopics","endpoint","send","matchedTopicObservers_1","filterArray","topicArray","left","right","mqttTopicMatch","parsedMessage_1","observersForTopic","subscribe","Set","add","observersForClientId","e_1","_c","unsubscribe","__read","o","m","r","ar","__spread","AWSAppSyncProvider","_topicClient","_topicAlias","_cleanUp","entries","_cleanUpForTopic","topicsForClient","has","obs","closed","mqttConnections","newSubscriptions","newAliases","acc","elem","connectionInfoForTopic","find","all","err_1","_d","complete","data","origKey","val","highlightSourceAtLocation","_iteratorNormalCompletion3","_didIteratorError3","_iteratorError3","_step3","_iterator3","err","return","printedLocations","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_step","_iterator","_iteratorNormalCompletion2","_didIteratorError2","_iteratorError2","_step2","_iterator2","MESSAGE_TYPES","SUBSCRIPTION_STATUS","SOCKET_STATUS","AMPLIFY_SYMBOL","NON_RETRYABLE_CODES","CONTROL_MSG","AWS_APPSYNC_REALTIME_HEADERS","accept","DEFAULT_KEEP_ALIVE_TIMEOUT","standardDomainPattern","AWSAppSyncRealTimeProvider","socketStatus","CLOSED","keepAliveTimeout","subscriptionObserverMap","promiseArray","_topics","_msg","isCustomDomain","appSyncGraphqlEndpoint","subscriptionId_1","_startSubscriptionWithAWSAppSyncRealTime","subscriptionId","catch","errors","REALTIME_SUBSCRIPTION_INIT_ERROR","subscriptionState","_waitForSubscriptionToBeConnected","CONNECTED","_sendUnsubscriptionMessage","_removeSubscriptionObserver","authenticationType","query","variables","apiKey","region","graphql_headers","additionalHeaders","dataString","headerObj","_e","subscriptionMessage","stringToAWSRealTime","err_2","_f","subscriptionFailedCallback_1","_g","subscriptionFailedCallback","subscriptionReadyCallback","_h","_j","PENDING","startAckTimeoutId","_awsRealTimeHeaderBasedAuth","payload","canonicalUri","id","authorization","GQL_START","_initializeWebSocketConnection","CONNECTION_FAILED","setTimeout","_timeoutStartSubscriptionAck","awsRealTimeSocket","res","rej","readyState","WebSocket","OPEN","READY","unsubscribeMessage","GQL_STOP","_closeSocketIfRequired","bind","bufferedAmount","clearTimeout","keepAliveTimeoutId","tempSocket","onclose","onerror","close","_handleIncomingSubscriptionMessage","GQL_DATA","GQL_START_ACK","GQL_CONNECTION_KEEP_ALIVE","_errorDisconnect","TIMEOUT_DISCONNECT","GQL_ERROR","FAILED","event","Hub","dispatchApiEvent","SUBSCRIPTION_ACK","clear","headerString","headerQs","payloadQs","discoverableEndpoint","protocol","awsRealTimeUrl","err_3","CONNECTING","_initializeRetryableHandshake","_initializeHandshake","err_4","errorType","newSocket","onopen","ackOk","reason","onmessage","connectionTimeoutMs","GQL_CONNECTION_ACK","CONNECTION_CLOSED","GQL_CONNECTION_ERROR","gqlInit","GQL_CONNECTION_INIT","includes","headerHandler","handler","host","API_KEY","_awsRealTimeApiKeyHeader","AWS_IAM","_awsRealTimeIAMHeader","OPENID_CONNECT","_awsRealTimeOPENIDHeader","AMAZON_COGNITO_USER_POOLS","_awsRealTimeCUPHeader","AWS_LAMBDA","_customAuthHeader","Authorization","getAccessToken","getJwtToken","federatedInfo","currentUser","dt","dtStr","Date","toISOString","endpointInfo","creds","request","service","_ensureCredentials","Credentials","credentials","secret_key","secretAccessKey","access_key","accessKeyId","session_token","sessionToken","method","headers","Signer","cred","PubSub","PubSubClass","_pluggables","_awsAppSyncProvider","_awsAppSyncRealTimeProvider","getModuleName","opt","pluggable","addPluggable","removePluggable","providerName","getProviderByName","awsAppSyncProvider","awsAppSyncRealTimeProvider","getProviders","provider","ssr","providers","subscriptions","observable","console","_error","subscription","GRAPHQL_AUTH_MODE","GraphQLAuthError","graphqlOperation","authToken","GraphQLAPIClass","_api","Auth","Cache","API","otherOptions","header","createInstance","RestClient","_headerBasedAuth","defaultAuthenticationType","aws_appsync_authenticationType","session","aws_appsync_apiKey","NO_API_KEY","NO_CREDENTIALS","NO_FEDERATED_JWT","NO_CURRENT_USER","currentSession","NO_AUTH_TOKEN","getGraphqlOperationType","graphql","paramQuery","authMode","def","operationType","cancellableToken","getCancellableToken","initParams","responsePromise","_graphql","updateRequestToBeCancellable","_graphqlSubscribe","customGraphqlEndpoint","customEndpointRegion","init","response","_k","_l","aws_appsync_region","aws_appsync_graphqlEndpoint","graphql_endpoint","graphql_endpoint_iam_region","signerServiceInfo","post","isCancel","cancel","shear","GraphQLAPI","_region","_service","_custom_header","_cancelTokenMap","WeakMap","ajax","urlOrApiInfo","parsed_url","custom_header","params","libraryHeaders","isAllResponse","custom_header_obj","parsedUrl","_parseUrl","responseType","timeout","cancelToken","FormData","withCredentials","search","queryStringParameters","_request","_signed","dateHeader","date","responseDate","requestDate","getTime","put","patch","del","head","cancelTokenSource","apiName","cloud_logic_array","endpoints","signerServiceInfoParams","otherParams","endpoint_region","endpoint_service","signed_params","parts","RestAPIClass","custom","apiInfo","getEndpointInfo","apiConfig","api","RestAPI","Amplify","APIClass","_restApi","_graphqlApi","restAPIConfig","graphQLAPIConfig","I18n","_lang","_dict","language","window","navigator","setLanguage","lang","defVal","getByLanguage","lang_dict","putVocabulariesForLanguage","vocabularies","putVocabularies","_i18n","checkConfig","DEFAULT_ALGORITHM","encrypt","src","hash","update","digestSync","arg","signed_headers","toLowerCase","sort","canonical_request","url_info","encodeURIComponent","pathname","key_val","reencoded_val","key_a","key_b","trim","parse_service_info","parsed","reverse","credential_scope","d_str","string_to_sign","algorithm","dt_str","scope","get_signing_key","service_info","k_date","k_region","k_service","get_signature","signing_key","str_to_sign","sign","access_info","substr","request_str","serviceInfo","signature","authorization_header","get_authorization_header","signUrl","urlOrRequest","accessInfo","expiration","urlToSign","now","today","signedHeaders","credentialScope","sessionTokenRequired","queryParams","canonicalRequest","stringToSign","additionalQueryParams","slashes","hostname","port","DateUtils","clockOffset","getDateWithClockOffset","getClockOffset","getHeaderStringFromDate","getDateFromHeaderString","year","month","day","hour","minute","second","UTC","Number","isClockSkewed","serverDate","abs","isClockSkewError","setClockOffset","offset","constants_1","RawSha256","state","Int32Array","INIT","temp","buffer","Uint8Array","bufferLength","bytesHashed","finished","byteLength","MAX_HASHABLE_LENGTH","BLOCK_SIZE","hashBuffer","digest","bitsHashed","bufferView","DataView","byteOffset","undecoratedLength","setUint8","setUint32","out","DIGEST_LENGTH","state0","state1","state2","state3","state4","state5","state6","state7","u","t1_1","t2_1","t1","KEY","t2","Uint32Array","pow","__exportStar","tslib_1","RawSha256_1","util_utf8_browser_1","Sha256","secret","outer","inner","input","convertToBuffer","bufferHash","bufferFromSecret","toHash","isEmptyData","fromUtf8","ArrayBuffer","isView","BYTES_PER_ELEMENT","TextEncoder","encode","bytes","surrogatePair","toUtf8","TextDecoder","decode","decoded","byte","nextByte","encoded","byteValue","decodeURIComponent","factory","PahoMQTT","global","localStorage","setItem","getItem","removeItem","MESSAGE_TYPE","validate","errorStr","validKey","format","ERROR","INVALID_TYPE","_scope","OK","text","CONNECT_TIMEOUT","SUBSCRIBE_TIMEOUT","UNSUBSCRIBE_TIMEOUT","PING_TIMEOUT","INTERNAL_ERROR","CONNACK_RETURNCODE","SOCKET_ERROR","SOCKET_CLOSE","MALFORMED_UTF","UNSUPPORTED","INVALID_STATE","INVALID_ARGUMENT","UNSUPPORTED_OPERATION","INVALID_STORED_DATA","INVALID_MQTT_MESSAGE_TYPE","MALFORMED_UNICODE","BUFFER_FULL","CONNACK_RC","substitutions","field","part1","substring","part2","MqttProtoIdentifierv3","MqttProtoIdentifierv4","WireMessage","decodeMessage","digit","startingPos","first","messageInfo","remLength","multiplier","endPos","wireMessage","sessionPresent","returnCode","qos","readUint16","topicName","parseUTF8","messageIdentifier","Message","subarray","retained","duplicate","payloadMessage","writeUint16","writeString","utf8Length","stringToUTF8","UTF8Length","lowCharCode","utf16","byte1","byte2","byte3","byte4","willMessagePayloadBytes","topicStrLength","destinationNameLength","willMessage","payloadBytes","userName","password","requestedQos","mbi","number","numBytes","encodeMBI","byteStream","connectFlags","cleanSession","keepAliveInterval","Pinger","_client","_keepAliveInterval","isReset","pingReq","doTimeout","pinger","doPing","_trace","socket","_disconnected","reset","Timeout","timeoutSeconds","action","ClientImpl","uri","_wsuri","_localKey","_msg_queue","_buffered_msg_queue","_sentMessages","_receivedMessages","_notify_msg_sent","_message_identifier","_sequence","restore","connected","maxMessageIdentifier","connectOptions","hostIndex","onConnected","onMessageDelivered","traceFunction","_connectTimeout","sendPinger","receivePinger","_reconnectInterval","_reconnecting","_reconnectTimeout","disconnectedPublishing","disconnectedBufferSize","receiveBuffer","_traceBuffer","_MAX_TRACE_ENTRIES","connectOptionsMasked","_traceMask","uris","_doConnect","subscribeOptions","grantedQos","invocationContext","errorMessage","timeOut","_requires_ack","_schedule_message","unsubscribeOptions","callback","sequence","unshift","getTraceLog","startTrace","stopTrace","wsurl","uriParts","binaryType","_on_socket_open","_on_socket_message","_on_socket_error","_on_socket_close","_process_queue","store","storedMessage","version","pubRecReceived","hex","messageBytes","payloadHex","parseInt","_socket_send","messageCount","messages","_deframeMessages","_handleMessage","byteArray","newData","errorStack","sentMessage","receivedMessage","sequencedMessages","msgId","pubRelMessage","reconnected","_connected","_receivePublish","_receiveMessage","pubCompMessage","wireMessageMasked","pubAckMessage","pubRecMessage","reconnect","_reconnect","errorText","mqttVersionExplicit","record","severity","traceObject","masked","traceObjectMasked","attr","newPayload","newDestinationName","newQos","newRetained","newTopic","newDuplicate","Client","ipv6AddSBracket","clientIdLength","newOnConnected","newDisconnectedPublishing","newDisconnectedBufferSize","newOnConnectionLost","newOnMessageDelivered","newOnMessageArrived","trace","hosts","ports","stringPayload","usingURIs","test","ipv6","self","_classCallCheck","instance","Constructor","_defineProperties","target","props","descriptor","_createClass","protoProps","staticProps","Observable","hasSymbols","getSymbol","SymbolIterator","SymbolObservable","SymbolSpecies","getMethod","getSpecies","ctor","isObservable","hostReportError","log","enqueue","cleanupSubscription","cleanup","_cleanup","closeSubscription","_observer","_queue","_state","notifySubscription","onNotify","queue","flushSubscription","Subscription","subscriber","subscriptionObserver","SubscriptionObserver","_subscription","_subscriber","_this3","_this4","C","hasSeed","hasValue","seed","_this5","_len","sources","_key","startNext","_this6","completeIfDone","_item","_len2","_key2","symbol","runtime","Op","hasOwn","$Symbol","iteratorSymbol","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","define","innerFn","outerFn","tryLocsList","protoGenerator","Generator","context","Context","_invoke","GenStateSuspendedStart","GenStateExecuting","GenStateCompleted","doneResult","delegate","delegateResult","maybeInvokeDelegate","ContinueSentinel","_sent","dispatchException","abrupt","tryCatch","GenStateSuspendedYield","makeInvokeMethod","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","getProto","getPrototypeOf","NativeIteratorPrototype","Gp","defineIteratorMethods","AsyncIterator","PromiseImpl","invoke","__await","unwrapped","previousPromise","callInvokeWithMethodAndArg","info","resultName","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","resetTryEntry","completion","iterable","iteratorMethod","displayName","isGeneratorFunction","genFun","mark","awrap","async","iter","skipTempReset","charAt","stop","rootRecord","rval","exception","handle","caught","hasCatch","hasFinally","finallyEntry","finish","thrown","delegateYield","regeneratorRuntime","accidentalStrictMode","globalThis","Function","asyncGeneratorStep","gen","_next","_throw","_asyncToGenerator"],"sourceRoot":""}