{"version":3,"file":"microsoft-BXNttAzp.js","sources":["../../node_modules/@microsoft/applicationinsights-shims/dist-es5/Constants.js","../../node_modules/@nevware21/ts-utils/dist/es5/mod/ts-utils.js","../../node_modules/@microsoft/applicationinsights-shims/dist-es5/TsLibShims.js","../../node_modules/@microsoft/dynamicproto-js/dist-es5/DynamicProto.js","../../node_modules/@microsoft/applicationinsights-core-js/dist-es5/__DynamicConstants.js","../../node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/AggregationError.js","../../node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/InternalConstants.js","../../node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/HelperFuncs.js","../../node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/EnvUtils.js","../../node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/RandomHelper.js","../../node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/DataCacheHelper.js","../../node_modules/@microsoft/applicationinsights-core-js/dist-es5/Config/ConfigDefaults.js","../../node_modules/@microsoft/applicationinsights-core-js/dist-es5/Config/DynamicSupport.js","../../node_modules/@microsoft/applicationinsights-core-js/dist-es5/Config/DynamicProperty.js","../../node_modules/@microsoft/applicationinsights-core-js/dist-es5/Config/DynamicState.js","../../node_modules/@microsoft/applicationinsights-core-js/dist-es5/Config/DynamicConfig.js","../../node_modules/@microsoft/applicationinsights-core-js/dist-es5/Config/ConfigDefaultHelpers.js","../../node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/DbgExtensionUtils.js","../../node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/DiagnosticLogger.js","../../node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/CookieMgr.js","../../node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/PerfManager.js","../../node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/TelemetryHelpers.js","../../node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/ProcessTelemetryContext.js","../../node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/UnloadHandlerContainer.js","../../node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/UnloadHookContainer.js","../../node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/BaseTelemetryPlugin.js","../../node_modules/@microsoft/applicationinsights-common/dist-es5/applicationinsights-common.js","../../node_modules/@microsoft/applicationinsights-react-js/dist-esm/ReactPlugin.js","../../node_modules/@microsoft/signalr/dist/esm/Errors.js","../../node_modules/@microsoft/signalr/dist/esm/HttpClient.js","../../node_modules/@microsoft/signalr/dist/esm/ILogger.js","../../node_modules/@microsoft/signalr/dist/esm/Loggers.js","../../node_modules/@microsoft/signalr/dist/esm/Utils.js","../../node_modules/@microsoft/signalr/dist/esm/FetchHttpClient.js","../../node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js","../../node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js","../../node_modules/@microsoft/signalr/dist/esm/TextMessageFormat.js","../../node_modules/@microsoft/signalr/dist/esm/HandshakeProtocol.js","../../node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js","../../node_modules/@microsoft/signalr/dist/esm/Subject.js","../../node_modules/@microsoft/signalr/dist/esm/MessageBuffer.js","../../node_modules/@microsoft/signalr/dist/esm/HubConnection.js","../../node_modules/@microsoft/signalr/dist/esm/DefaultReconnectPolicy.js","../../node_modules/@microsoft/signalr/dist/esm/HeaderNames.js","../../node_modules/@microsoft/signalr/dist/esm/AccessTokenHttpClient.js","../../node_modules/@microsoft/signalr/dist/esm/ITransport.js","../../node_modules/@microsoft/signalr/dist/esm/AbortController.js","../../node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js","../../node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js","../../node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js","../../node_modules/@microsoft/signalr/dist/esm/HttpConnection.js","../../node_modules/@microsoft/signalr/dist/esm/JsonHubProtocol.js","../../node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nexport var strShimFunction = \"function\";\r\nexport var strShimObject = \"object\";\r\nexport var strShimUndefined = \"undefined\";\r\nexport var strShimPrototype = \"prototype\";\r\nexport var strDefault = \"default\";\r\nexport var ObjClass = Object;\r\nexport var ObjProto = ObjClass[strShimPrototype];\r\n//# sourceMappingURL=Constants.js.map","/*! https://github.com/nevware21/ts-utils v0.11.8 */\n/*\n * Copyright (c) NevWare21 Solutions LLC and contributors. All rights reserved.\n * Licensed under the MIT license.\n */\n/*#__NO_SIDE_EFFECTS__*/\nfunction _pureAssign(func1, func2) {\n return func1 || func2;\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction _pureRef(value, name) {\n return value[name];\n}\n\nvar UNDEF_VALUE = undefined;\nvar NULL_VALUE = null;\nvar EMPTY = \"\";\nvar FUNCTION = \"function\";\nvar OBJECT = \"object\";\nvar PROTOTYPE = \"prototype\";\nvar __PROTO__ = \"__proto__\";\nvar UNDEFINED = \"undefined\";\nvar CONSTRUCTOR = \"constructor\";\nvar SYMBOL = \"Symbol\";\nvar POLYFILL_TAG = \"_polyfill\";\nvar LENGTH = \"length\";\nvar NAME = \"name\";\nvar CALL = \"call\";\nvar TO_STRING = \"toString\";\nvar ObjClass = ( /*#__PURE__*/_pureAssign(Object));\nvar ObjProto = ( /*#__PURE__*/_pureRef(ObjClass, PROTOTYPE));\nvar StrCls = ( /*#__PURE__*/_pureAssign(String));\nvar StrProto = ( /*#__PURE__*/_pureRef(StrCls, PROTOTYPE));\nvar MathCls = ( /*#__PURE__*/_pureAssign(Math));\nvar ArrCls = ( /*#__PURE__*/_pureAssign(Array));\nvar ArrProto = ( /*#__PURE__*/_pureRef(ArrCls, PROTOTYPE));\nvar ArrSlice = ( /*#__PURE__*/_pureRef(ArrProto, \"slice\"));\n\nfunction safe(func, argArray) {\n try {\n return {\n v: func.apply(this, argArray)\n };\n }\n catch (e) {\n return { e: e };\n }\n}\n\n/*#__NO_SIDE_EFFECTS__*/\nfunction safeGet(cb, defValue) {\n var result = safe(cb);\n return result.e ? defValue : result.v;\n}\n\nvar _primitiveTypes;\n/*#__NO_SIDE_EFFECTS__*/\nfunction _createIs(theType) {\n return function (value) {\n return typeof value === theType;\n };\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction _createObjIs(theName) {\n var theType = \"[object \" + theName + \"]\";\n return function (value) {\n return !!(value && objToString(value) === theType);\n };\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction objToString(value) {\n return ObjProto[TO_STRING].call(value);\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction isTypeof(value, theType) {\n return typeof value === theType;\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction isUndefined(value) {\n return typeof value === UNDEFINED || value === UNDEFINED;\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction isStrictUndefined(arg) {\n return !isDefined(arg);\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction isNullOrUndefined(value) {\n return value === NULL_VALUE || isUndefined(value);\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction isStrictNullOrUndefined(value) {\n return value === NULL_VALUE || !isDefined(value);\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction isDefined(arg) {\n return !!arg || arg !== UNDEF_VALUE;\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction isPrimitive(value) {\n return value === NULL_VALUE || isPrimitiveType(typeof value);\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction isPrimitiveType(theType) {\n !_primitiveTypes && (_primitiveTypes = [\"string\", \"number\", \"boolean\", UNDEFINED, \"symbol\", \"bigint\"]);\n return !!(theType !== OBJECT && _primitiveTypes.indexOf(theType) !== -1);\n}\nvar isString = ( /*#__PURE__*/_createIs(\"string\"));\nvar isFunction = ( /*#__PURE__*/_createIs(FUNCTION));\n/*#__NO_SIDE_EFFECTS__*/\nfunction isObject(value) {\n if (!value && isNullOrUndefined(value)) {\n return false;\n }\n return !!value && typeof value === OBJECT;\n}\nvar isArray = ( /* #__PURE__*/_pureRef(ArrCls, \"isArray\"));\nvar isDate = ( /*#__PURE__*/_createObjIs(\"Date\"));\nvar isNumber = ( /*#__PURE__*/_createIs(\"number\"));\nvar isBoolean = ( /*#__PURE__*/_createIs(\"boolean\"));\nvar isRegExp = ( /*#__PURE__*/_createObjIs(\"RegExp\"));\nvar isFile = ( /*#__PURE__*/_createObjIs(\"File\"));\nvar isFormData = ( /*#__PURE__*/_createObjIs(\"FormData\"));\nvar isBlob = ( /*#__PURE__*/_createObjIs(\"Blob\"));\nvar isArrayBuffer = ( /*#__PURE__*/_createObjIs(\"ArrayBuffer\"));\nvar isError = ( /*#__PURE__*/_createObjIs(\"Error\"));\n/*#__NO_SIDE_EFFECTS__*/\nfunction isPromiseLike(value) {\n return !!(value && value.then && isFunction(value.then));\n}\nvar isThenable = isPromiseLike;\n/*#__NO_SIDE_EFFECTS__*/\nfunction isPromise(value) {\n return !!(value && value.then && value.catch && isFunction(value.then) && isFunction(value.catch));\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction isNotTruthy(value) {\n return !value || !isTruthy(value);\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction isTruthy(value) {\n return !(!value || safeGet(function () { return !(value && (0 + value)); }, !value));\n}\n\nvar objGetOwnPropertyDescriptor = ( /* #__PURE__ */_pureRef(ObjClass, \"getOwnPropertyDescriptor\"));\n\n/*#__NO_SIDE_EFFECTS__*/\nfunction objHasOwnProperty(obj, prop) {\n return !!obj && ObjProto.hasOwnProperty[CALL](obj, prop);\n}\n\nvar objHasOwn = ( /*#__PURE__*/_pureAssign(( /* #__PURE__ */_pureRef(ObjClass, \"hasOwn\")), polyObjHasOwn));\n/*#__NO_SIDE_EFFECTS__*/\nfunction polyObjHasOwn(obj, prop) {\n return objHasOwnProperty(obj, prop) || !!objGetOwnPropertyDescriptor(obj, prop);\n}\n\nfunction objForEachKey(theObject, callbackfn, thisArg) {\n if (theObject && isObject(theObject)) {\n for (var prop in theObject) {\n if (objHasOwn(theObject, prop)) {\n if (callbackfn[CALL](thisArg || theObject, prop, theObject[prop]) === -1) {\n break;\n }\n }\n }\n }\n}\n\nvar propMap = {\n e: \"enumerable\",\n c: \"configurable\",\n v: \"value\",\n w: \"writable\",\n g: \"get\",\n s: \"set\"\n};\n/*#__NO_SIDE_EFFECTS__*/\nfunction _createProp(value) {\n var prop = {};\n prop[propMap[\"c\"]] = true;\n prop[propMap[\"e\"]] = true;\n if (value.l) {\n prop.get = function () { return value.l.v; };\n var desc = objGetOwnPropertyDescriptor(value.l, \"v\");\n if (desc && desc.set) {\n prop.set = function (newValue) {\n value.l.v = newValue;\n };\n }\n }\n objForEachKey(value, function (key, value) {\n prop[propMap[key]] = isStrictUndefined(value) ? prop[propMap[key]] : value;\n });\n return prop;\n}\nvar objDefineProp = ( /*#__PURE__*/_pureRef(ObjClass, \"defineProperty\"));\nvar objDefineProperties = ( /*#__PURE__*/_pureRef(ObjClass, \"defineProperties\"));\nfunction objDefineGet(target, key, value, configurable, enumerable) {\n var _a;\n return objDefineProp(target, key, _createProp((_a = {\n e: enumerable,\n c: configurable\n },\n _a[isFunction(value) ? \"g\" : \"v\"] = value,\n _a)));\n}\nfunction objDefineAccessors(target, prop, getProp, setProp, configurable, enumerable) {\n var desc = {\n e: enumerable,\n c: configurable\n };\n if (getProp) {\n desc.g = getProp;\n }\n if (setProp) {\n desc.s = setProp;\n }\n return objDefineProp(target, prop, _createProp(desc));\n}\nfunction objDefine(target, key, propDesc) {\n return objDefineProp(target, key, _createProp(propDesc));\n}\nfunction objDefineProps(target, propDescMap) {\n var props = {};\n objForEachKey(propDescMap, function (key, value) {\n props[key] = _createProp(value);\n });\n return objDefineProperties(target, props);\n}\n\n/*#__NO_SIDE_EFFECTS__*/\nfunction _createKeyValueMap(values, keyType, valueType, completeFn, writable) {\n var theMap = {};\n objForEachKey(values, function (key, value) {\n _assignMapValue(theMap, key, keyType ? value : key);\n _assignMapValue(theMap, value, valueType ? value : key);\n });\n return completeFn ? completeFn(theMap) : theMap;\n}\nfunction _assignMapValue(theMap, key, value, writable) {\n objDefineProp(theMap, key, {\n value: value,\n enumerable: true,\n writable: false\n });\n}\n\nvar asString = ( /* #__PURE__ */_pureAssign(StrCls));\n\nvar ERROR_TYPE = \"[object Error]\";\n/*#__NO_SIDE_EFFECTS__*/\nfunction dumpObj(object, format) {\n var propertyValueDump = EMPTY;\n var objType = ObjProto[TO_STRING][CALL](object);\n if (objType === ERROR_TYPE) {\n object = { stack: asString(object.stack), message: asString(object.message), name: asString(object.name) };\n }\n try {\n propertyValueDump = JSON.stringify(object, NULL_VALUE, format ? ((typeof format === \"number\") ? format : 4) : UNDEF_VALUE);\n propertyValueDump = (propertyValueDump ? propertyValueDump.replace(/\"(\\w+)\"\\s*:\\s{0,1}/g, \"$1: \") : NULL_VALUE) || asString(object);\n }\n catch (e) {\n propertyValueDump = \" - \" + dumpObj(e, format);\n }\n return objType + \": \" + propertyValueDump;\n}\n\nfunction throwError(message) {\n throw new Error(message);\n}\nfunction throwTypeError(message) {\n throw new TypeError(message);\n}\nfunction throwRangeError(message) {\n throw new RangeError(message);\n}\n\n/*#__NO_SIDE_EFFECTS__*/\nfunction polyObjKeys(obj) {\n if (!isObject(obj) || obj === NULL_VALUE) {\n throwTypeError(\"non-object \" + dumpObj(obj));\n }\n var result = [];\n for (var prop in obj) {\n if (objHasOwn(obj, prop)) {\n result.push(prop);\n }\n }\n return result;\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction polyObjEntries(value) {\n var result = [];\n objForEachKey(value, function (key, value) {\n result.push([key, value]);\n });\n return result;\n}\n\nvar _objFreeze = ( /* #__PURE__ */_pureRef(ObjClass, \"freeze\"));\nfunction _doNothing(value) {\n return value;\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction _getProto(value) {\n return value[__PROTO__] || NULL_VALUE;\n}\nvar objAssign = ( /*#__PURE__*/_pureRef(ObjClass, \"assign\"));\nvar objKeys = ( /*#__PURE__*/_pureRef(ObjClass, \"keys\"));\nfunction objDeepFreeze(value) {\n if (_objFreeze) {\n objForEachKey(value, function (key, value) {\n if (isArray(value) || isObject(value)) {\n objDeepFreeze(value);\n }\n });\n }\n return objFreeze(value);\n}\nvar objFreeze = ( /* #__PURE__*/_pureAssign(_objFreeze, _doNothing));\nvar objSeal = ( /* #__PURE__*/_pureAssign(( /* #__PURE__*/_pureRef(ObjClass, \"seal\")), _doNothing));\nvar objGetPrototypeOf = ( /* #__PURE__*/_pureAssign(( /* #__PURE__*/_pureRef(ObjClass, \"getPrototypeOf\")), _getProto));\nvar objEntries = ( /* #__PURE__*/_pureAssign(( /* #__PURE__*/_pureRef(ObjClass, \"entries\")), polyObjEntries));\n\n/*#__NO_SIDE_EFFECTS__*/\nfunction createEnum(values) {\n return _createKeyValueMap(values, 1 , 0 , objFreeze);\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction createEnumKeyMap(values) {\n return _createKeyValueMap(values, 0 , 0 , objFreeze);\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction createEnumValueMap(values) {\n return _createKeyValueMap(values, 1 , 1 , objFreeze);\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction createSimpleMap(values) {\n var mapClass = {};\n objForEachKey(values, function (key, value) {\n _assignMapValue(mapClass, key, value[1]);\n _assignMapValue(mapClass, value[0], value[1]);\n });\n return objFreeze(mapClass);\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction createTypeMap(values) {\n return createSimpleMap(values);\n}\n\nvar _wellKnownSymbolMap = /*#__PURE__*/ createEnumKeyMap({\n asyncIterator: 0 ,\n hasInstance: 1 ,\n isConcatSpreadable: 2 ,\n iterator: 3 ,\n match: 4 ,\n matchAll: 5 ,\n replace: 6 ,\n search: 7 ,\n species: 8 ,\n split: 9 ,\n toPrimitive: 10 ,\n toStringTag: 11 ,\n unscopables: 12\n});\n\nvar GLOBAL_CONFIG_KEY = \"__tsUtils$gblCfg\";\nvar _globalCfg;\n/*#__NO_SIDE_EFFECTS__*/\nfunction _getGlobalValue() {\n var result;\n if (typeof globalThis !== UNDEFINED) {\n result = globalThis;\n }\n if (!result && typeof self !== UNDEFINED) {\n result = self;\n }\n if (!result && typeof window !== UNDEFINED) {\n result = window;\n }\n if (!result && typeof global !== UNDEFINED) {\n result = global;\n }\n return result;\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction _getGlobalConfig() {\n if (!_globalCfg) {\n var gbl = safe(_getGlobalValue).v || {};\n _globalCfg = gbl[GLOBAL_CONFIG_KEY] = gbl[GLOBAL_CONFIG_KEY] || {};\n }\n return _globalCfg;\n}\n\nvar _unwrapFunction = ( _unwrapFunctionWithPoly);\n/*#__NO_SIDE_EFFECTS__*/\nfunction _unwrapFunctionWithPoly(funcName, clsProto, polyFunc) {\n var clsFn = clsProto ? clsProto[funcName] : NULL_VALUE;\n return function (thisArg) {\n var theFunc = (thisArg ? thisArg[funcName] : NULL_VALUE) || clsFn;\n if (theFunc || polyFunc) {\n var theArgs = arguments;\n return (theFunc || polyFunc).apply(thisArg, theFunc ? ArrSlice[CALL](theArgs, 1) : theArgs);\n }\n throwTypeError(\"\\\"\" + asString(funcName) + \"\\\" not defined for \" + dumpObj(thisArg));\n };\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction _unwrapProp(propName) {\n return function (thisArg) {\n return thisArg[propName];\n };\n}\n\nvar mathMin = ( /*#__PURE__*/_pureRef(MathCls, \"min\"));\nvar mathMax = ( /*#__PURE__*/_pureRef(MathCls, \"max\"));\n\nvar strSlice = ( /*#__PURE__*/_unwrapFunction(\"slice\", StrProto));\n\nvar strSubstring = ( /*#__PURE__*/_unwrapFunction(\"substring\", StrProto));\nvar strSubstr = ( /*#__PURE__*/_unwrapFunctionWithPoly(\"substr\", StrProto, polyStrSubstr));\n/*#__NO_SIDE_EFFECTS__*/\nfunction polyStrSubstr(value, start, length) {\n if (isNullOrUndefined(value)) {\n throwTypeError(\"Invalid \" + dumpObj(value));\n }\n if (length < 0) {\n return EMPTY;\n }\n start = start || 0;\n if (start < 0) {\n start = mathMax(start + value[LENGTH], 0);\n }\n if (isUndefined(length)) {\n return strSlice(value, start);\n }\n return strSlice(value, start, start + length);\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction strLeft(value, count) {\n return strSubstring(value, 0, count);\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction strRight(value, count) {\n return count <= 0 ? EMPTY : (value[LENGTH] > count ? strSlice(value, -count) : value);\n}\n\nvar UNIQUE_REGISTRY_ID = \"_urid\";\nvar _polySymbols;\n/*#__NO_SIDE_EFFECTS__*/\nfunction _globalSymbolRegistry() {\n if (!_polySymbols) {\n var gblCfg = _getGlobalConfig();\n _polySymbols = gblCfg.gblSym = gblCfg.gblSym || { k: {}, s: {} };\n }\n return _polySymbols;\n}\nvar _wellKnownSymbolCache;\n/*#__NO_SIDE_EFFECTS__*/\nfunction polyNewSymbol(description) {\n var theSymbol = {\n description: asString(description),\n toString: function () { return SYMBOL + \"(\" + description + \")\"; }\n };\n theSymbol[POLYFILL_TAG] = true;\n return theSymbol;\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction polySymbolFor(key) {\n var registry = _globalSymbolRegistry();\n if (!objHasOwn(registry.k, key)) {\n var newSymbol_1 = polyNewSymbol(key);\n var regId_1 = objKeys(registry.s).length;\n newSymbol_1[UNIQUE_REGISTRY_ID] = function () { return regId_1 + \"_\" + newSymbol_1[TO_STRING](); };\n registry.k[key] = newSymbol_1;\n registry.s[newSymbol_1[UNIQUE_REGISTRY_ID]()] = asString(key);\n }\n return registry.k[key];\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction polySymbolKeyFor(sym) {\n if (!sym || !sym[TO_STRING] || strSubstring(sym[TO_STRING](), 0, 6) != SYMBOL) {\n throwTypeError(sym + \" is not a symbol\");\n }\n var regId = sym[POLYFILL_TAG] && sym[UNIQUE_REGISTRY_ID] && sym[UNIQUE_REGISTRY_ID]();\n return regId ? _globalSymbolRegistry().s[regId] : undefined;\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction polyGetKnownSymbol(name) {\n !_wellKnownSymbolCache && (_wellKnownSymbolCache = {});\n var result;\n var knownName = _wellKnownSymbolMap[name];\n if (knownName) {\n result = _wellKnownSymbolCache[knownName] = _wellKnownSymbolCache[knownName] || polyNewSymbol(SYMBOL + \".\" + knownName);\n }\n return result;\n}\n\nvar _globalLazyTestHooks;\nfunction _initTestHooks() {\n _globalLazyTestHooks = _getGlobalConfig();\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction getLazy(cb) {\n var lazyValue = {};\n !_globalLazyTestHooks && _initTestHooks();\n lazyValue.b = _globalLazyTestHooks.lzy;\n objDefineProp(lazyValue, \"v\", {\n configurable: true,\n get: function () {\n var result = cb();\n if (!_globalLazyTestHooks.lzy) {\n objDefineProp(lazyValue, \"v\", {\n value: result\n });\n }\n lazyValue.b = _globalLazyTestHooks.lzy;\n return result;\n }\n });\n return lazyValue;\n}\nfunction setBypassLazyCache(newValue) {\n !_globalLazyTestHooks && _initTestHooks();\n _globalLazyTestHooks.lzy = newValue;\n}\nfunction getWritableLazy(cb) {\n var lazyValue = {};\n !_globalLazyTestHooks && _initTestHooks();\n lazyValue.b = _globalLazyTestHooks.lzy;\n var _setValue = function (newValue) {\n objDefineProp(lazyValue, \"v\", {\n value: newValue,\n writable: true\n });\n if (lazyValue.b) {\n delete lazyValue.b;\n }\n };\n objDefineProp(lazyValue, \"v\", {\n configurable: true,\n get: function () {\n var result = cb();\n if (!_globalLazyTestHooks.lzy) {\n _setValue(result);\n }\n if (_globalLazyTestHooks.lzy && lazyValue.b !== _globalLazyTestHooks.lzy) {\n lazyValue.b = _globalLazyTestHooks.lzy;\n }\n return result;\n },\n set: _setValue\n });\n return lazyValue;\n}\n\n/*#__NO_SIDE_EFFECTS__*/\nfunction createCachedValue(value) {\n return objDefineProp({\n toJSON: function () { return value; }\n }, \"v\", { value: value });\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction createDeferredCachedValue(cb) {\n var theValue = {\n toJSON: function () { return theValue.v; }\n };\n return objDefineProp(theValue, \"v\", {\n get: function () {\n var result = cb();\n cb = NULL_VALUE;\n objDefineProp(theValue, \"v\", { value: result });\n return result;\n },\n configurable: true\n });\n}\n\nvar WINDOW = \"window\";\nvar _cachedGlobal;\nfunction _getGlobalInstFn(getFn, theArgs) {\n var cachedValue;\n return function () {\n !_globalLazyTestHooks && _initTestHooks();\n if (!cachedValue || _globalLazyTestHooks.lzy) {\n cachedValue = createCachedValue(safe(getFn, theArgs).v);\n }\n return cachedValue.v;\n };\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction lazySafeGetInst(name) {\n return getLazy(function () { return safe((getInst), [name]).v || UNDEF_VALUE; });\n}\nfunction getGlobal(useCached) {\n !_globalLazyTestHooks && _initTestHooks();\n if (!_cachedGlobal || useCached === false || _globalLazyTestHooks.lzy) {\n _cachedGlobal = createCachedValue(safe(_getGlobalValue).v || NULL_VALUE);\n }\n return _cachedGlobal.v;\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction getInst(name, useCached) {\n var gbl;\n if (!_cachedGlobal || useCached === false) {\n gbl = getGlobal(useCached);\n }\n else {\n gbl = _cachedGlobal.v;\n }\n if (gbl && gbl[name]) {\n return gbl[name];\n }\n if (name === WINDOW) {\n try {\n return window;\n }\n catch (e) {\n }\n }\n return NULL_VALUE;\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction hasDocument() {\n return !!( /*#__PURE__*/getDocument());\n}\nvar getDocument = ( /*#__PURE__*/_getGlobalInstFn(getInst, [\"document\"]));\n/*#__NO_SIDE_EFFECTS__*/\nfunction hasWindow() {\n return !!( /*#__PURE__*/getWindow());\n}\nvar getWindow = ( /*#__PURE__*/_getGlobalInstFn(getInst, [WINDOW]));\n/*#__NO_SIDE_EFFECTS__*/\nfunction hasNavigator() {\n return !!( /*#__PURE__*/getNavigator());\n}\nvar getNavigator = ( /*#__PURE__*/_getGlobalInstFn(getInst, [\"navigator\"]));\n/*#__NO_SIDE_EFFECTS__*/\nfunction hasHistory() {\n return !!( /*#__PURE__*/getHistory());\n}\nvar getHistory = ( /*#__PURE__*/_getGlobalInstFn(getInst, [\"history\"]));\nvar isNode = ( /*#__PURE__*/_getGlobalInstFn(function () {\n return !!( /*#__PURE__*/safe(function () { return (process && (process.versions || {}).node); }).v);\n}));\nvar isWebWorker = ( /*#__PURE__*/_getGlobalInstFn(function () {\n return !!( /*#__PURE__*/safe(function () { return self && self instanceof WorkerGlobalScope; }).v);\n}));\n\nvar _symbol;\nvar _symbolFor;\nvar _symbolKeyFor;\n/*#__NO_SIDE_EFFECTS__*/\nfunction _initSymbol() {\n _symbol = ( /*#__PURE__*/createCachedValue(safe((getInst), [SYMBOL]).v));\n return _symbol;\n}\nfunction _getSymbolKey(key) {\n var gblSym = ((!_globalLazyTestHooks.lzy ? _symbol : 0) || _initSymbol());\n return (gblSym.v ? gblSym.v[key] : UNDEF_VALUE);\n}\nvar isSymbol = ( /*#__PURE__*/_createIs(\"symbol\"));\n/*#__NO_SIDE_EFFECTS__*/\nfunction hasSymbol() {\n return !!( /*#__PURE__*/getSymbol());\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction getSymbol() {\n !_globalLazyTestHooks && _initTestHooks();\n return ((!_globalLazyTestHooks.lzy ? _symbol : 0) || _initSymbol()).v;\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction getKnownSymbol(name, noPoly) {\n var knownName = _wellKnownSymbolMap[name];\n !_globalLazyTestHooks && _initTestHooks();\n var sym = ((!_globalLazyTestHooks.lzy ? _symbol : 0) || _initSymbol());\n return sym.v ? sym.v[knownName || name] : (!noPoly ? polyGetKnownSymbol(name) : UNDEF_VALUE);\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction newSymbol(description, noPoly) {\n !_globalLazyTestHooks && _initTestHooks();\n var sym = ((!_globalLazyTestHooks.lzy ? _symbol : 0) || _initSymbol());\n return sym.v ? sym.v(description) : (!noPoly ? polyNewSymbol(description) : NULL_VALUE);\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction symbolFor(key) {\n !_globalLazyTestHooks && _initTestHooks();\n _symbolFor = ((!_globalLazyTestHooks.lzy ? _symbolFor : 0) || ( /*#__PURE__*/createCachedValue(safe((_getSymbolKey), [\"for\"]).v)));\n return (_symbolFor.v || polySymbolFor)(key);\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction symbolKeyFor(sym) {\n !_globalLazyTestHooks && _initTestHooks();\n _symbolKeyFor = ((!_globalLazyTestHooks.lzy ? _symbolKeyFor : 0) || ( /*#__PURE__*/createCachedValue(safe((_getSymbolKey), [\"keyFor\"]).v)));\n return (_symbolKeyFor.v || polySymbolKeyFor)(sym);\n}\n\n/*#__NO_SIDE_EFFECTS__*/\nfunction isIterator(value) {\n return !!value && isFunction(value.next);\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction isIterable(value) {\n return !isStrictNullOrUndefined(value) && isFunction(value[getKnownSymbol(3 )]);\n}\n\nvar _iterSymbol$1;\nfunction iterForOf(iter, callbackfn, thisArg) {\n if (iter) {\n if (!isIterator(iter)) {\n !_iterSymbol$1 && (_iterSymbol$1 = createCachedValue(getKnownSymbol(3 )));\n iter = iter[_iterSymbol$1.v] ? iter[_iterSymbol$1.v]() : NULL_VALUE;\n }\n if (isIterator(iter)) {\n var err = UNDEF_VALUE;\n var iterResult = UNDEF_VALUE;\n try {\n var count = 0;\n while (!(iterResult = iter.next()).done) {\n if (callbackfn[CALL](thisArg || iter, iterResult.value, count, iter) === -1) {\n break;\n }\n count++;\n }\n }\n catch (failed) {\n err = { e: failed };\n if (iter.throw) {\n iterResult = NULL_VALUE;\n iter.throw(err);\n }\n }\n finally {\n try {\n if (iterResult && !iterResult.done) {\n iter.return && iter.return(iterResult);\n }\n }\n finally {\n if (err) {\n // eslint-disable-next-line no-unsafe-finally\n throw err.e;\n }\n }\n }\n }\n }\n}\n\nfunction fnApply(fn, thisArg, argArray) {\n return fn.apply(thisArg, argArray);\n}\nfunction fnCall(fn, thisArg) {\n return fn.apply(thisArg, ArrSlice[CALL](arguments, 2));\n}\nfunction fnBind(fn, thisArg) {\n return fn.bind.apply(fn, ArrSlice[CALL](arguments, 1));\n}\n\nfunction arrAppend(target, elms) {\n if (!isUndefined(elms) && target) {\n if (isArray(elms)) {\n fnApply(target.push, target, elms);\n }\n else if (isIterator(elms) || isIterable(elms)) {\n iterForOf(elms, function (elm) {\n target.push(elm);\n });\n }\n else {\n target.push(elms);\n }\n }\n return target;\n}\n\nvar arrEvery = /*#__PURE__*/ _unwrapFunction(\"every\", ArrProto);\nvar arrFilter = /*#__PURE__*/ _unwrapFunction(\"filter\", ArrProto);\n\nfunction arrForEach(theArray, callbackfn, thisArg) {\n if (theArray) {\n var len = theArray[LENGTH] >>> 0;\n for (var idx = 0; idx < len; idx++) {\n if (idx in theArray) {\n if (callbackfn[CALL](thisArg || theArray, theArray[idx], idx, theArray) === -1) {\n break;\n }\n }\n }\n }\n}\n\nvar arrIndexOf = ( /*#__PURE__*/_unwrapFunction(\"indexOf\", ArrProto));\nvar arrLastIndexOf = ( /*#__PURE__*/_unwrapFunction(\"lastIndexOf\", ArrProto));\n\nvar arrMap = ( /*#__PURE__*/_unwrapFunction(\"map\", ArrProto));\n\nfunction arrSlice(theArray, start, end) {\n return ((theArray ? theArray[\"slice\"] : NULL_VALUE) || ArrSlice).apply(theArray, ArrSlice[CALL](arguments, 1));\n}\n\n/*#__NO_SIDE_EFFECTS__*/\nfunction polyIsArray(value) {\n if (isNullOrUndefined(value)) {\n return false;\n }\n return objToString(value) === \"[object Array]\";\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction polyArrIncludes(theArray, searchElement, fromIndex) {\n return arrIndexOf(theArray, searchElement, fromIndex) !== -1;\n}\nfunction polyArrFind(theArray, callbackFn, thisArg) {\n var result;\n var idx = polyArrFindIndex(theArray, callbackFn, thisArg);\n return idx !== -1 ? theArray[idx] : result;\n}\nfunction polyArrFindIndex(theArray, callbackFn, thisArg) {\n var result = -1;\n arrForEach(theArray, function (value, index) {\n if (callbackFn[CALL](thisArg | theArray, value, index, theArray)) {\n result = index;\n return -1;\n }\n });\n return result;\n}\nfunction polyArrFindLast(theArray, callbackFn, thisArg) {\n var result;\n var idx = polyArrFindLastIndex(theArray, callbackFn, thisArg);\n return idx !== -1 ? theArray[idx] : result;\n}\nfunction polyArrFindLastIndex(theArray, callbackFn, thisArg) {\n var result = -1;\n var len = theArray[LENGTH] >>> 0;\n for (var idx = len - 1; idx >= 0; idx--) {\n if (idx in theArray && callbackFn[CALL](thisArg | theArray, theArray[idx], idx, theArray)) {\n result = idx;\n break;\n }\n }\n return result;\n}\nfunction polyArrFrom(theValue, mapFn, thisArg) {\n if (isArray(theValue)) {\n var result_1 = arrSlice(theValue);\n return mapFn ? arrMap(result_1, mapFn, thisArg) : result_1;\n }\n var result = [];\n iterForOf(theValue, function (value, cnt) {\n return result.push(mapFn ? mapFn[CALL](thisArg, value, cnt) : value);\n });\n return result;\n}\n\nvar arrFind = /*#__PURE__*/ _unwrapFunctionWithPoly(\"find\", ArrProto, polyArrFind);\nvar arrFindIndex = /*#__PURE__*/ _unwrapFunctionWithPoly(\"findIndex\", ArrProto, polyArrFindIndex);\nvar arrFindLast = /*#__PURE__*/ _unwrapFunctionWithPoly(\"findLast\", ArrProto, polyArrFindLast);\nvar arrFindLastIndex = /*#__PURE__*/ _unwrapFunctionWithPoly(\"findLastIndex\", ArrProto, polyArrFindLastIndex);\n\nvar arrFrom = ( /* #__PURE__*/_pureAssign(( /* #__PURE__*/_pureRef(ArrCls, \"from\")), polyArrFrom));\n\nvar arrIncludes = ( /*#__PURE__*/_unwrapFunctionWithPoly(\"includes\", ArrProto, polyArrIncludes));\nvar arrContains = arrIncludes;\n\nvar arrReduce = ( /*#__PURE__*/_unwrapFunction(\"reduce\", ArrProto));\n\nvar arrSome = ( /*#__PURE__*/_unwrapFunction(\"some\", ArrProto));\n\n/*#__NO_SIDE_EFFECTS__*/\nfunction createFnDeferredProxy(hostFn, funcName) {\n return function () {\n var theArgs = ArrSlice[CALL](arguments);\n var theHost = hostFn();\n return fnApply(theHost[funcName], theHost, theArgs);\n };\n}\nfunction createProxyFuncs(target, host, funcDefs) {\n if (target && host && isArray(funcDefs)) {\n var isDeferred_1 = isFunction(host);\n arrForEach(funcDefs, function (funcDef) {\n var targetName = (funcDef.as || funcDef.n);\n if (funcDef.rp === false && target[targetName]) {\n return;\n }\n target[targetName] = isDeferred_1 ?\n createFnDeferredProxy(host, funcDef.n) :\n fnBind(host[funcDef.n], host);\n });\n }\n return target;\n}\n\nvar _iterSymbol;\n/*#__NO_SIDE_EFFECTS__*/\nfunction readArgs(theArgs, start, end) {\n if (!objHasOwn(theArgs, LENGTH)) {\n !_iterSymbol && (_iterSymbol = createCachedValue(hasSymbol() && getKnownSymbol(3 )));\n var iterFn = void 0;\n if (_iterSymbol.v) {\n iterFn = theArgs[_iterSymbol.v];\n }\n if (iterFn) {\n var values_1 = [];\n var from_1 = (start === UNDEF_VALUE || start < 0) ? 0 : start;\n var to_1 = end < 0 || start < 0 ? UNDEF_VALUE : end;\n iterForOf(iterFn[CALL](theArgs), function (value, cnt) {\n if (to_1 !== UNDEF_VALUE && cnt >= to_1) {\n return -1;\n }\n if (cnt >= from_1) {\n values_1.push(value);\n }\n });\n if ((start === UNDEF_VALUE || start >= 0) && (end === UNDEF_VALUE || end >= 0)) {\n return values_1;\n }\n theArgs = values_1;\n }\n }\n return arrSlice(theArgs, start, end);\n}\n\nvar objCreate = ( /* #__PURE__*/_pureAssign(( /* #__PURE__*/_pureRef(ObjClass, \"create\")), polyObjCreate));\n/*#__NO_SIDE_EFFECTS__*/\nfunction polyObjCreate(obj) {\n if (!obj) {\n return {};\n }\n var type = typeof obj;\n if (type !== OBJECT && type !== FUNCTION) {\n throwTypeError(\"Prototype must be an Object or function: \" + dumpObj(obj));\n }\n function tempFunc() { }\n tempFunc[PROTOTYPE] = obj;\n return new tempFunc();\n}\n\nvar _isProtoArray;\nfunction objSetPrototypeOf(obj, proto) {\n var fn = ObjClass[\"setPrototypeOf\"] ||\n function (d, b) {\n var _a;\n !_isProtoArray && (_isProtoArray = createCachedValue((_a = {}, _a[__PROTO__] = [], _a) instanceof Array));\n _isProtoArray.v ? d[__PROTO__] = b : objForEachKey(b, function (key, value) { return d[key] = value; });\n };\n return fn(obj, proto);\n}\n\n/*#__NO_SIDE_EFFECTS__*/\nfunction _createCustomError(name, d, b) {\n safe(objDefine, [d, NAME, { v: name, c: true, e: false }]);\n d = objSetPrototypeOf(d, b);\n function __() {\n this[CONSTRUCTOR] = d;\n safe(objDefine, [this, NAME, { v: name, c: true, e: false }]);\n }\n d[PROTOTYPE] = b === NULL_VALUE ? objCreate(b) : (__[PROTOTYPE] = b[PROTOTYPE], new __());\n return d;\n}\nfunction _setName(baseClass, name) {\n name && (baseClass[NAME] = name);\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction createCustomError(name, constructCb, errorBase) {\n var theBaseClass = errorBase || Error;\n var orgName = theBaseClass[PROTOTYPE][NAME];\n var captureFn = Error.captureStackTrace;\n return _createCustomError(name, function () {\n var _this = this;\n var theArgs = arguments;\n try {\n safe(_setName, [theBaseClass, name]);\n var _self = fnApply(theBaseClass, _this, ArrSlice[CALL](theArgs)) || _this;\n if (_self !== _this) {\n var orgProto = objGetPrototypeOf(_this);\n if (orgProto !== objGetPrototypeOf(_self)) {\n objSetPrototypeOf(_self, orgProto);\n }\n }\n captureFn && captureFn(_self, _this[CONSTRUCTOR]);\n constructCb && constructCb(_self, theArgs);\n return _self;\n }\n finally {\n safe(_setName, [theBaseClass, orgName]);\n }\n }, theBaseClass);\n}\nvar _unsupportedError;\nfunction throwUnsupported(message) {\n if (!_unsupportedError) {\n _unsupportedError = createCustomError(\"UnsupportedError\");\n }\n throw new _unsupportedError(message);\n}\n\n/*#__NO_SIDE_EFFECTS__*/\nfunction utcNow() {\n return (Date.now || polyUtcNow)();\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction polyUtcNow() {\n return new Date().getTime();\n}\n\n/*#__NO_SIDE_EFFECTS__*/\nfunction _createTrimFn(exp) {\n return function _doTrim(value) {\n if (isNullOrUndefined(value)) {\n throwTypeError(\"strTrim called [\" + dumpObj(value) + \"]\");\n }\n if (value && value.replace) {\n value = value.replace(exp, EMPTY);\n }\n return value;\n };\n}\nvar polyStrTrim = ( /*#__PURE__*/_createTrimFn(/^\\s+|(?=\\s)\\s+$/g));\nvar polyStrTrimStart = ( /*#__PURE__*/_createTrimFn(/^\\s+/g));\nvar polyStrTrimEnd = ( /*#__PURE__*/_createTrimFn(/(?=\\s)\\s+$/g));\n\nvar strTrim = ( /*#__PURE__*/_unwrapFunctionWithPoly(\"trim\", StrProto, polyStrTrim));\nvar strTrimStart = ( /*#__PURE__*/_unwrapFunctionWithPoly(\"trimStart\", StrProto, polyStrTrimStart));\nvar strTrimLeft = ( /*#__PURE__*/_pureAssign(strTrimStart));\nvar strTrimEnd = ( /*#__PURE__*/_unwrapFunctionWithPoly(\"trimEnd\", StrProto, polyStrTrimEnd));\nvar strTrimRight = ( /*#__PURE__*/_pureAssign(strTrimEnd));\n\nvar strUpper = ( /*#__PURE__*/_unwrapFunction(\"toUpperCase\", StrProto));\nvar strLower = ( /*#__PURE__*/_unwrapFunction(\"toLowerCase\", StrProto));\n\n/*#__NO_SIDE_EFFECTS__*/\nfunction _convertCase(value, newPrefix, upperWord) {\n return strTrim(asString(value)).replace(/((_|\\W)+(\\w){0,1}|([a-z])([A-Z]))/g, function (_match, _g1, _g2, wordStart, upperPrefix, upperLetter) {\n var convertMatch = wordStart || upperLetter || EMPTY;\n if (upperWord) {\n convertMatch = strUpper(convertMatch);\n }\n return (upperPrefix || EMPTY) + newPrefix + convertMatch;\n });\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction strLetterCase(value) {\n return asString(value).replace(/(_|\\b)\\w/g, strUpper);\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction strCamelCase(value, upperFirst) {\n var result = _convertCase(value, \"\", true);\n return result.replace(/^\\w/, upperFirst ? strUpper : strLower);\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction strKebabCase(value, scream) {\n var result = _convertCase(value, \"-\");\n return (scream ? strUpper : strLower)(result);\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction strSnakeCase(value, scream) {\n var result = _convertCase(value, \"_\");\n return (scream ? strUpper : strLower)(result);\n}\n\nvar mathFloor = ( /*#__PURE__*/_pureRef(MathCls, \"floor\"));\nvar mathCeil = ( /*#__PURE__*/_pureRef(MathCls, \"ceil\"));\n\nvar mathTrunc = ( /* #__PURE__*/_pureAssign(( /* #__PURE__*/_pureRef(MathCls, \"trunc\")), polyMathTrunc));\n/*#__NO_SIDE_EFFECTS__*/\nfunction polyMathTrunc(value) {\n var theValue = +value;\n return (theValue > 0 ? mathFloor : mathCeil)(theValue);\n}\n\n/*#__NO_SIDE_EFFECTS__*/\nfunction mathToInt(value, throwInfinity) {\n var result = +value;\n if (result == Infinity && throwInfinity) {\n throwRangeError(\"invalid value [\" + dumpObj(value) + \"]\");\n }\n return result !== result || result === 0 ? 0 : mathTrunc(result);\n}\n\nvar strRepeat = ( /*#__PURE__*/_unwrapFunctionWithPoly(\"repeat\", StrProto, polyStrRepeat));\n/*#__NO_SIDE_EFFECTS__*/\nfunction polyStrRepeat(value, count) {\n if (isNullOrUndefined(value)) {\n throwTypeError(\"can't convert [\" + dumpObj(value) + \"]\");\n }\n count = mathToInt(count, true);\n if (count < 0) {\n throwRangeError(\"invalid count must be >= 0 && < Infinity\");\n }\n var pad = isString(value) ? value : asString(value);\n var result = EMPTY;\n for (; count > 0; (count >>>= 1) && (pad += pad)) {\n if (count & 1) {\n result += pad;\n }\n }\n return result;\n}\n\n/*#__NO_SIDE_EFFECTS__*/\nfunction _padValue(value, targetLength, padString) {\n var result = EMPTY;\n targetLength = mathToInt(targetLength, true);\n targetLength >>= 0;\n var len = value[LENGTH];\n if (len < targetLength) {\n result = isNullOrUndefined(padString) ? \" \" : asString(padString);\n targetLength = targetLength - len;\n if (targetLength > result[LENGTH]) {\n result = strRepeat(result, mathCeil(targetLength / result[LENGTH]));\n }\n if (result[LENGTH] > targetLength) {\n result = strSubstring(result, 0, targetLength);\n }\n }\n return result;\n}\nvar strPadStart = ( /*#__PURE__*/_unwrapFunctionWithPoly(\"padStart\", StrProto, polyStrPadStart));\nvar strPadEnd = ( /*#__PURE__*/_unwrapFunctionWithPoly(\"padEnd\", StrProto, polyStrPadEnd));\n/*#__NO_SIDE_EFFECTS__*/\nfunction polyStrPadStart(value, targetLength, padString) {\n return _padValue(value, targetLength, padString) + value;\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction polyStrPadEnd(value, targetLength, padString) {\n return value + _padValue(value, targetLength, padString);\n}\n\nvar DBL_QUOTE = \"\\\"\";\nvar INVALID_JS_NAME = /([^\\w\\d_$])/g;\nvar _htmlEntityCache;\n/*#__NO_SIDE_EFFECTS__*/\nfunction normalizeJsName(jsName, camelCase) {\n var result = asString(jsName).replace(INVALID_JS_NAME, \"_\");\n return !isUndefined(camelCase) ? strCamelCase(result, !camelCase) : result;\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction encodeAsJson(value, format) {\n var result;\n if (isString(value)) {\n result = DBL_QUOTE + value.replace(/[^\\w .,\\-!@#$%\\^&*\\(\\)_+={}\\[\\]:;|<>?]/g, function (match) {\n if (match === DBL_QUOTE || match === \"\\\\\") {\n return \"\\\\\" + match;\n }\n var hex = match.charCodeAt(0)[TO_STRING](16);\n return \"\\\\u\" + strPadStart(strUpper(hex), 4, \"0\");\n }) + DBL_QUOTE;\n }\n else {\n try {\n result = JSON.stringify(value, NULL_VALUE, format ? (isNumber(format) ? format : 4) : UNDEF_VALUE);\n }\n catch (e) {\n result = DBL_QUOTE + dumpObj(e) + DBL_QUOTE;\n }\n }\n return result;\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction encodeAsHtml(value) {\n !_htmlEntityCache && (_htmlEntityCache = {\n \"&\": \"amp\",\n \"<\": \"lt\",\n \">\": \"gt\",\n \"\\\"\": \"quot\",\n \"'\": \"#39\"\n });\n return asString(value).replace(/[&<>\"']/g, function (match) { return \"&\" + _htmlEntityCache[match] + \";\"; });\n}\n\nvar _fnToString;\nvar _objCtrFnString;\nvar _gblWindow;\n/*#__NO_SIDE_EFFECTS__*/\nfunction isPlainObject(value) {\n if (!value || typeof value !== OBJECT) {\n return false;\n }\n if (!_gblWindow) {\n _gblWindow = hasWindow() ? getWindow() : true;\n }\n var result = false;\n if (value !== _gblWindow) {\n if (!_objCtrFnString) {\n _fnToString = Function[PROTOTYPE][TO_STRING];\n _objCtrFnString = _fnToString[CALL](ObjClass);\n }\n try {\n var proto = objGetPrototypeOf(value);\n result = !proto;\n if (!result) {\n if (objHasOwnProperty(proto, CONSTRUCTOR)) {\n proto = proto[CONSTRUCTOR];\n }\n result = !!(proto && typeof proto === FUNCTION && _fnToString[CALL](proto) === _objCtrFnString);\n }\n }\n catch (ex) {\n }\n }\n return result;\n}\n\n/*#__NO_SIDE_EFFECTS__*/\nfunction _defaultDeepCopyHandler(details) {\n details.value && plainObjDeepCopyHandler(details);\n return true;\n}\nvar defaultDeepCopyHandlers = [\n arrayDeepCopyHandler,\n plainObjDeepCopyHandler,\n functionDeepCopyHandler,\n dateDeepCopyHandler\n];\n/*#__NO_SIDE_EFFECTS__*/\nfunction _getSetVisited(visitMap, source, newPath, cb) {\n var theEntry;\n arrForEach(visitMap, function (entry) {\n if (entry.k === source) {\n theEntry = entry;\n return -1;\n }\n });\n if (!theEntry) {\n theEntry = { k: source, v: source };\n visitMap.push(theEntry);\n cb(theEntry);\n }\n return theEntry.v;\n}\nfunction _deepCopy(visitMap, value, ctx, key) {\n var userHandler = ctx.handler;\n var newPath = ctx.path ? (key ? ctx.path.concat(key) : ctx.path) : [];\n var newCtx = {\n handler: ctx.handler,\n src: ctx.src,\n path: newPath\n };\n var theType = typeof value;\n var isPlain = false;\n var isPrim = value === NULL_VALUE;\n if (!isPrim) {\n if (value && theType === OBJECT) {\n isPlain = isPlainObject(value);\n }\n else {\n isPrim = isPrimitiveType(theType);\n }\n }\n var details = {\n type: theType,\n isPrim: isPrim,\n isPlain: isPlain,\n value: value,\n result: value,\n path: newPath,\n origin: ctx.src,\n copy: function (source, newKey) {\n return _deepCopy(visitMap, source, newKey ? newCtx : ctx, newKey);\n },\n copyTo: function (target, source) {\n return _copyProps(visitMap, target, source, newCtx);\n }\n };\n if (!details.isPrim) {\n return _getSetVisited(visitMap, value, newPath, function (newEntry) {\n objDefine(details, \"result\", {\n g: function () {\n return newEntry.v;\n },\n s: function (newValue) {\n newEntry.v = newValue;\n }\n });\n var idx = 0;\n var handler = userHandler;\n while (!(handler || (idx < defaultDeepCopyHandlers.length ? defaultDeepCopyHandlers[idx++] : _defaultDeepCopyHandler))[CALL](ctx, details)) {\n handler = NULL_VALUE;\n }\n });\n }\n if (userHandler && userHandler[CALL](ctx, details)) {\n return details.result;\n }\n return value;\n}\nfunction _copyProps(visitMap, target, source, ctx) {\n if (!isNullOrUndefined(source)) {\n for (var key in source) {\n target[key] = _deepCopy(visitMap, source[key], ctx, key);\n }\n }\n return target;\n}\nfunction objCopyProps(target, source, handler) {\n var ctx = {\n handler: handler,\n src: source,\n path: []\n };\n return _copyProps([], target, source, ctx);\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction objDeepCopy(source, handler) {\n var ctx = {\n handler: handler,\n src: source\n };\n return _deepCopy([], source, ctx);\n}\nfunction arrayDeepCopyHandler(details) {\n var value = details.value;\n if (isArray(value)) {\n var target = details.result = [];\n target.length = value.length;\n details.copyTo(target, value);\n return true;\n }\n return false;\n}\nfunction dateDeepCopyHandler(details) {\n var value = details.value;\n if (isDate(value)) {\n details.result = new Date(value.getTime());\n return true;\n }\n return false;\n}\nfunction functionDeepCopyHandler(details) {\n if (details.type === FUNCTION) {\n return true;\n }\n return false;\n}\nfunction plainObjDeepCopyHandler(details) {\n var value = details.value;\n if (value && details.isPlain) {\n var target = details.result = {};\n details.copyTo(target, value);\n return true;\n }\n return false;\n}\n\nfunction _doExtend(target, theArgs) {\n arrForEach(theArgs, function (theArg) {\n objCopyProps(target, theArg);\n });\n return target;\n}\nfunction deepExtend(target, obj1, obj2, obj3, obj4, obj5, obj6) {\n return _doExtend(objDeepCopy(target) || {}, ArrSlice[CALL](arguments));\n}\nfunction objExtend(target, obj1, obj2, obj3, obj4, obj5, obj6) {\n return _doExtend(target || {}, ArrSlice[CALL](arguments));\n}\n\nvar getLength = ( /*#__PURE__*/_unwrapProp(LENGTH));\n\n/*#__NO_SIDE_EFFECTS__*/\nfunction getIntValue(value, defValue) {\n if (!isNullOrUndefined(value)) {\n if (isNumber(value)) {\n return value;\n }\n var theValue = parseInt(value, 10);\n return isNaN(theValue) ? defValue : theValue;\n }\n return defValue;\n}\n\nvar _perf;\n/*#__NO_SIDE_EFFECTS__*/\nfunction hasPerformance() {\n return !!getPerformance();\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction getPerformance() {\n !_globalLazyTestHooks && _initTestHooks();\n if (!_perf || _globalLazyTestHooks.lzy) {\n _perf = createCachedValue(safe((getInst), [\"performance\"]).v);\n }\n return _perf.v;\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction perfNow() {\n var perf = getPerformance();\n if (perf && perf.now) {\n return perf.now();\n }\n return utcNow();\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction elapsedTime(startTime) {\n return perfNow() - startTime;\n}\n\nvar MATCH_ANY = \"(.*)\";\nvar MATCH_SINGLE = \"(.)\";\nfunction _createRegExp(value, escapeRgx, replaceFn, ignoreCase, fullMatch) {\n // eslint-disable-next-line security/detect-non-literal-regexp\n return new RegExp((fullMatch ? \"^\" : EMPTY) + replaceFn(value.replace(escapeRgx, \"\\\\$1\")) + (fullMatch ? \"$\" : EMPTY), ignoreCase ? \"i\" : \"\");\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction createWildcardRegex(value, ignoreCase, fullMatch) {\n return _createRegExp(asString(value), /([-+|^$#.\\?{}()\\[\\]\\\\/\\\"\\'])/g, function (value) {\n return value.replace(/\\*/g, MATCH_ANY);\n }, !!ignoreCase, fullMatch);\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction createFilenameRegex(value, ignoreCase, fullMatch) {\n return _createRegExp(asString(value), /([-+|^$#.{}()\\\\\\/\\[\\]\\\"\\'])/g, function (value) {\n return value.replace(/(\\\\\\\\|\\\\\\/|\\*|\\?)/g, function (_all, g1) {\n if (g1 == \"\\\\/\" || g1 == \"\\\\\\\\\") {\n return \"[\\\\\\\\\\\\/]{1}\";\n }\n return g1 == \"*\" ? MATCH_ANY : MATCH_SINGLE;\n });\n }, !!ignoreCase, fullMatch);\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction makeGlobRegex(value, ignoreCase, fullMatch) {\n return _createRegExp(asString(value), /([-+|^$#.{}()\\\\\\/\\[\\]\\\"\\'])/g, function (value) {\n return value.replace(/(\\*\\*\\\\[\\\\\\/]|\\\\\\\\|\\\\\\/|\\*\\*|\\*|\\?)/g, function (_all, g1) {\n if (g1 == \"**\\\\/\" || g1 == \"**\\\\\\\\\") {\n return \"(.*[\\\\\\\\\\\\/])*\";\n }\n if (g1 === \"\\\\/\" || g1 == \"\\\\\\\\\") {\n return \"[\\\\\\\\\\\\/]{1}\";\n }\n if (g1 === \"**\") {\n return MATCH_ANY;\n }\n return g1 === \"*\" ? \"([^\\\\\\\\\\\\/]*)\" : \"([^\\\\\\\\\\\\/]{1})\";\n });\n }, !!ignoreCase, fullMatch);\n}\n\n/*#__NO_SIDE_EFFECTS__*/\nfunction safeGetLazy(cb, defValue) {\n return getLazy(function () {\n var result = safe(cb);\n return result.e ? defValue : result.v;\n });\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction safeGetWritableLazy(cb, defValue) {\n return getWritableLazy(function () {\n var result = safe(cb);\n return result.e ? defValue : result.v;\n });\n}\n\n/*#__NO_SIDE_EFFECTS__*/\nfunction _checkLength(value, props) {\n var result;\n arrForEach(props, function (prop) {\n if (prop in value) {\n var propValue = value[prop];\n result = (isFunction(propValue) ? propValue() : propValue) > 0;\n return -1;\n }\n });\n return result;\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction _hasValue(value, depth) {\n var result = value === false || value === 0;\n if (!result && !isNullOrUndefined(value)) {\n if (isArray(value)) {\n result = value[LENGTH] > 0;\n }\n else if (isDate(value)) {\n result = !isNaN(value.getTime());\n }\n else if (isBoolean(value)) {\n return true;\n }\n else if (isObject(value)) {\n try {\n var chkValue = _checkLength(value, [LENGTH, \"byteLength\", \"size\", \"count\"]);\n if (isBoolean(chkValue)) {\n return chkValue;\n }\n if (isFunction(value.valueOf) && depth < 5) {\n return _hasValue(value.valueOf(), ++depth);\n }\n }\n catch (e) {\n }\n return !!objKeys(value)[LENGTH];\n }\n else {\n result = isTruthy(value);\n }\n }\n return result;\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction hasValue(value) {\n return _hasValue(value, 0);\n}\n\n/*#__NO_SIDE_EFFECTS__*/\nfunction createIterable(ctx) {\n return makeIterable({}, ctx);\n}\nfunction makeIterable(target, ctx) {\n var itSymbol = getKnownSymbol(3 );\n function _createIterator() {\n return createIterator(ctx);\n }\n target[itSymbol] = _createIterator;\n return target;\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction createIterator(ctx) {\n var isDone = false;\n function _value() {\n return ctx.v;\n }\n function _next() {\n if (!isDone) {\n isDone = (ctx.n ? ctx.n(arguments) : true);\n }\n var result = {\n done: isDone\n };\n if (!isDone) {\n objDefine(result, \"value\", { g: _value });\n }\n return result;\n }\n function _return(value) {\n isDone = true;\n return {\n done: true,\n value: ctx.r && ctx.r(value)\n };\n }\n function _throw(e) {\n isDone = true;\n return {\n done: true,\n value: ctx.t && ctx.t(e)\n };\n }\n var theIterator = {\n next: _next\n };\n if (ctx.r) {\n theIterator.return = _return;\n }\n if (ctx.t) {\n theIterator.throw = _throw;\n }\n return theIterator;\n}\n\n/*#__NO_SIDE_EFFECTS__*/\nfunction createArrayIterator(values) {\n var idx = -1;\n var theValues = values ? values.slice() : [];\n var len = theValues[LENGTH];\n function _value() {\n if (idx >= 0 && idx < len) {\n return theValues[idx];\n }\n }\n function _getNext() {\n idx++;\n return idx >= len;\n }\n var ctx = {\n n: _getNext\n };\n objDefine(ctx, \"v\", { g: _value });\n return createIterator(ctx);\n}\n\n/*#__NO_SIDE_EFFECTS__*/\nfunction createRangeIterator(start, end, step) {\n var nextValue = start;\n var theValue = UNDEF_VALUE;\n if (isNullOrUndefined(end)) {\n end = start;\n }\n var theStep = step;\n if (!theStep) {\n theStep = (start <= end) ? 1 : -1;\n }\n function _value() {\n return theValue;\n }\n function _getNext() {\n var isDone = (theStep > 0) ? (nextValue > end) : (nextValue < end);\n if (!isDone) {\n theValue = nextValue;\n nextValue += theStep;\n }\n return isDone;\n }\n return createIterator(objDefine({\n n: _getNext\n }, \"v\", { g: _value }));\n}\n\nvar mathRound = ( /*#__PURE__*/_pureRef(MathCls, \"round\"));\n\n/*#__NO_SIDE_EFFECTS__*/\nfunction polyStrSymSplit(value, splitter, limit) {\n var splitFn = splitter ? splitter[getKnownSymbol(9 )] : UNDEF_VALUE;\n return splitFn ? splitFn(value, limit) : [value];\n}\n\nvar strSplit = ( /*#__PURE__*/_unwrapFunction(\"split\", StrProto));\nvar strSymSplit = ( /*#__PURE__*/_unwrapFunctionWithPoly(\"split\", StrProto, !hasSymbol() ? polyStrSymSplit : NULL_VALUE));\n\n/*#__NO_SIDE_EFFECTS__*/\nfunction getValueByKey(target, path, defValue) {\n if (!path || !target) {\n return defValue;\n }\n var parts = strSplit(path, \".\");\n var cnt = parts.length;\n for (var lp = 0; lp < cnt && !isNullOrUndefined(target); lp++) {\n target = target[parts[lp]];\n }\n return (!isNullOrUndefined(target) ? target : defValue);\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction getValueByIter(target, iter, defValue) {\n if (!iter || !target) {\n return defValue;\n }\n iterForOf(iter, function (value) {\n if (isNullOrUndefined(target)) {\n return -1;\n }\n target = target[value];\n });\n return (!isNullOrUndefined(target) ? target : defValue);\n}\nfunction setValueByKey(target, path, value) {\n if (target && path) {\n var parts = strSplit(path, \".\");\n var lastKey = parts.pop();\n arrForEach(parts, function (key) {\n if (isNullOrUndefined(target[key])) {\n target[key] = {};\n }\n target = target[key];\n });\n target[lastKey] = value;\n }\n}\nfunction setValueByIter(target, iter, value) {\n if (target && iter) {\n var lastKey_1;\n iterForOf(iter, function (key) {\n if (lastKey_1) {\n if (isNullOrUndefined(target[lastKey_1])) {\n target[lastKey_1] = {};\n }\n target = target[lastKey_1];\n }\n lastKey_1 = key;\n });\n target[lastKey_1] = value;\n }\n}\n\nvar strEndsWith = ( /*#__PURE__*/_unwrapFunctionWithPoly(\"endsWith\", StrProto, polyStrEndsWith));\n/*#__NO_SIDE_EFFECTS__*/\nfunction polyStrEndsWith(value, searchString, length) {\n if (!isString(value)) {\n throwTypeError(\"'\" + dumpObj(value) + \"' is not a string\");\n }\n var searchValue = isString(searchString) ? searchString : asString(searchString);\n var end = (!isUndefined(length) && length < value[LENGTH]) ? length : value[LENGTH];\n return strSubstring(value, end - searchValue[LENGTH], end) === searchValue;\n}\n\nvar strIndexOf = ( /*#__PURE__*/_unwrapFunction(\"indexOf\", StrProto));\nvar strLastIndexOf = ( /*#__PURE__*/_unwrapFunction(\"lastIndexOf\", StrProto));\n\nvar strIncludes = ( /*#__PURE__*/_unwrapFunctionWithPoly(\"includes\", StrProto, polyStrIncludes));\nvar strContains = ( /*#__PURE__*/_pureAssign(strIncludes));\n/*#__NO_SIDE_EFFECTS__*/\nfunction polyStrIncludes(value, searchString, position) {\n if (isRegExp(searchString)) {\n throwTypeError(\"'searchString' must not be a regular expression\" + dumpObj(searchString));\n }\n return strIndexOf(value, asString(searchString), position) !== -1;\n}\n\n/*#__NO_SIDE_EFFECTS__*/\nfunction strIsNullOrWhiteSpace(value) {\n if (isString(value)) {\n return value.replace(/[\\s\\t\\r\\n\\f]+/g, EMPTY) === EMPTY;\n }\n return isNullOrUndefined(value);\n}\n/*#__NO_SIDE_EFFECTS__*/\nfunction strIsNullOrEmpty(value) {\n if (isString(value)) {\n return value === EMPTY;\n }\n return isNullOrUndefined(value);\n}\n\nvar strStartsWith = ( /*#__PURE__*/_unwrapFunctionWithPoly(\"startsWith\", StrProto, polyStrStartsWith));\n/*#__NO_SIDE_EFFECTS__*/\nfunction polyStrStartsWith(value, searchString, position) {\n if (!isString(value)) {\n throwTypeError(\"'\" + dumpObj(value) + \"' is not a string\");\n }\n var searchValue = isString(searchString) ? searchString : asString(searchString);\n var pos = position > 0 ? position : 0;\n return strSubstring(value, pos, pos + searchValue[LENGTH]) === searchValue;\n}\n\nvar REF = \"ref\";\nvar UNREF = \"unref\";\nvar HAS_REF = \"hasRef\";\nvar ENABLED = \"enabled\";\n/*#__NO_SIDE_EFFECTS__*/\nfunction _createTimerHandler(startTimer, refreshFn, cancelFn) {\n var ref = true;\n var timerId = startTimer ? refreshFn(NULL_VALUE) : NULL_VALUE;\n var theTimerHandler;\n function _unref() {\n ref = false;\n timerId && timerId[UNREF] && timerId[UNREF]();\n return theTimerHandler;\n }\n function _cancel() {\n timerId && cancelFn(timerId);\n timerId = NULL_VALUE;\n }\n function _refresh() {\n timerId = refreshFn(timerId);\n if (!ref) {\n _unref();\n }\n return theTimerHandler;\n }\n function _setEnabled(value) {\n !value && timerId && _cancel();\n value && !timerId && _refresh();\n }\n theTimerHandler = {\n cancel: _cancel,\n refresh: _refresh\n };\n theTimerHandler[HAS_REF] = function () {\n if (timerId && timerId[HAS_REF]) {\n return timerId[HAS_REF]();\n }\n return ref;\n };\n theTimerHandler[REF] = function () {\n ref = true;\n timerId && timerId[REF] && timerId[REF]();\n return theTimerHandler;\n };\n theTimerHandler[UNREF] = _unref;\n theTimerHandler = objDefineProp(theTimerHandler, ENABLED, {\n get: function () { return !!timerId; },\n set: _setEnabled\n });\n return {\n h: theTimerHandler,\n dn: function () {\n timerId = NULL_VALUE;\n }\n };\n}\n\nfunction _createTimeoutWith(startTimer, overrideFn, theArgs) {\n var isArr = isArray(overrideFn);\n var len = isArr ? overrideFn.length : 0;\n var setFn = (len > 0 ? overrideFn[0] : (!isArr ? overrideFn : UNDEF_VALUE)) || setTimeout;\n var clearFn = (len > 1 ? overrideFn[1] : UNDEF_VALUE) || clearTimeout;\n var timerFn = theArgs[0];\n theArgs[0] = function () {\n handler.dn();\n fnApply(timerFn, UNDEF_VALUE, ArrSlice[CALL](arguments));\n };\n var handler = _createTimerHandler(startTimer, function (timerId) {\n if (timerId) {\n if (timerId.refresh) {\n timerId.refresh();\n return timerId;\n }\n fnApply(clearFn, UNDEF_VALUE, [timerId]);\n }\n return fnApply(setFn, UNDEF_VALUE, theArgs);\n }, function (timerId) {\n fnApply(clearFn, UNDEF_VALUE, [timerId]);\n });\n return handler.h;\n}\nfunction scheduleTimeout(callback, timeout) {\n return _createTimeoutWith(true, UNDEF_VALUE, ArrSlice[CALL](arguments));\n}\nfunction scheduleTimeoutWith(overrideFn, callback, timeout) {\n return _createTimeoutWith(true, overrideFn, ArrSlice[CALL](arguments, 1));\n}\nfunction createTimeout(callback, timeout) {\n return _createTimeoutWith(false, UNDEF_VALUE, ArrSlice[CALL](arguments));\n}\nfunction createTimeoutWith(overrideFn, callback, timeout) {\n return _createTimeoutWith(false, overrideFn, ArrSlice[CALL](arguments, 1));\n}\n\nvar _defaultIdleTimeout = 100;\nvar _maxExecutionTime = 50;\n/*#__NO_SIDE_EFFECTS__*/\nfunction hasIdleCallback() {\n return !!( /*#__PURE__*/getIdleCallback());\n}\nvar getIdleCallback = ( /*#__PURE__*/_getGlobalInstFn(getInst, [\"requestIdleCallback\"]));\nvar getCancelIdleCallback = ( /*#__PURE__*/_getGlobalInstFn(getInst, [\"cancelIdleCallback\"]));\nfunction setDefaultIdleTimeout(timeout) {\n _defaultIdleTimeout = timeout;\n}\nfunction setDefaultMaxExecutionTime(maxTime) {\n _maxExecutionTime = maxTime;\n}\nfunction scheduleIdleCallback(callback, options) {\n function _createDeadline(timedOut) {\n var startTime = perfNow();\n return {\n didTimeout: timedOut,\n timeRemaining: function () {\n return _maxExecutionTime - elapsedTime(startTime);\n }\n };\n }\n if (hasIdleCallback()) {\n var handler_1 = _createTimerHandler(true, function (idleId) {\n idleId && getCancelIdleCallback()(idleId);\n return getIdleCallback()(function (deadline) {\n handler_1.dn();\n callback(deadline || _createDeadline(false));\n }, options);\n }, function (idleId) {\n getCancelIdleCallback()(idleId);\n });\n return handler_1.h;\n }\n var timeout = (options || {}).timeout;\n if (isUndefined(timeout)) {\n timeout = _defaultIdleTimeout;\n }\n return scheduleTimeout(function () {\n callback(_createDeadline(true));\n }, timeout);\n}\n\nfunction scheduleInterval(callback, timeout) {\n var theArguments = ArrSlice[CALL](arguments);\n var handler = _createTimerHandler(true, function (intervalId) {\n intervalId && clearInterval(intervalId);\n return fnApply(setInterval, UNDEF_VALUE, theArguments);\n }, function (intervalId) {\n fnApply(clearInterval, UNDEF_VALUE, [intervalId]);\n });\n return handler.h;\n}\n\nexport { arrAppend, arrContains, arrEvery, arrFilter, arrFind, arrFindIndex, arrFindLast, arrFindLastIndex, arrForEach, arrFrom, arrIncludes, arrIndexOf, arrLastIndexOf, arrMap, arrReduce, arrSlice, arrSome, arrayDeepCopyHandler, asString, createArrayIterator, createCachedValue, createCustomError, createDeferredCachedValue, createEnum, createEnumKeyMap, createEnumValueMap, createFilenameRegex, createFnDeferredProxy, createIterable, createIterator, createProxyFuncs, createRangeIterator, createSimpleMap, createTimeout, createTimeoutWith, createTypeMap, createWildcardRegex, dateDeepCopyHandler, deepExtend, dumpObj, elapsedTime, encodeAsHtml, encodeAsJson, fnApply, fnBind, fnCall, functionDeepCopyHandler, getCancelIdleCallback, getDocument, getGlobal, getHistory, getIdleCallback, getInst, getIntValue, getKnownSymbol, getLazy, getLength, getNavigator, getPerformance, getSymbol, getValueByIter, getValueByKey, getWindow, getWritableLazy, hasDocument, hasHistory, hasIdleCallback, hasNavigator, hasPerformance, hasSymbol, hasValue, hasWindow, isArray, isArrayBuffer, isBlob, isBoolean, isDate, isDefined, isError, isFile, isFormData, isFunction, isIterable, isIterator, isNode, isNotTruthy, isNullOrUndefined, isNumber, isObject, isPlainObject, isPrimitive, isPrimitiveType, isPromise, isPromiseLike, isRegExp, isStrictNullOrUndefined, isStrictUndefined, isString, isSymbol, isThenable, isTruthy, isTypeof, isUndefined, isWebWorker, iterForOf, lazySafeGetInst, makeGlobRegex, makeIterable, mathCeil, mathFloor, mathMax, mathMin, mathRound, mathToInt, mathTrunc, newSymbol, normalizeJsName, objAssign, objCopyProps, objCreate, objDeepCopy, objDeepFreeze, objDefine, objDefineAccessors, objDefineGet, objDefineProp, objDefineProperties, objDefineProps, objEntries, objExtend, objForEachKey, objFreeze, objGetOwnPropertyDescriptor, objGetPrototypeOf, objHasOwn, objHasOwnProperty, objKeys, objSeal, objSetPrototypeOf, objToString, perfNow, plainObjDeepCopyHandler, polyArrFind, polyArrFindIndex, polyArrFindLast, polyArrFindLastIndex, polyArrFrom, polyArrIncludes, polyGetKnownSymbol, polyIsArray, polyNewSymbol, polyObjEntries, polyObjHasOwn, polyObjKeys, polyStrIncludes, polyStrSubstr, polyStrSymSplit, polyStrTrim, polyStrTrimEnd, polyStrTrimStart, polySymbolFor, polySymbolKeyFor, polyUtcNow, readArgs, safe, safeGet, safeGetLazy, safeGetWritableLazy, scheduleIdleCallback, scheduleInterval, scheduleTimeout, scheduleTimeoutWith, setBypassLazyCache, setDefaultIdleTimeout, setDefaultMaxExecutionTime, setValueByIter, setValueByKey, strCamelCase, strContains, strEndsWith, strIncludes, strIndexOf, strIsNullOrEmpty, strIsNullOrWhiteSpace, strKebabCase, strLastIndexOf, strLeft, strLetterCase, strLower, strPadEnd, strPadStart, strRepeat, strRight, strSlice, strSnakeCase, strSplit, strStartsWith, strSubstr, strSubstring, strSymSplit, strTrim, strTrimEnd, strTrimLeft, strTrimRight, strTrimStart, strUpper, symbolFor, symbolKeyFor, throwError, throwRangeError, throwTypeError, throwUnsupported, utcNow };\n//# sourceMappingURL=ts-utils.js.map\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { getGlobal, objAssign, objCreate, objDefineProp, objHasOwnProperty, throwTypeError } from \"@nevware21/ts-utils\";\r\nimport { ObjClass, ObjProto, strDefault, strShimFunction, strShimPrototype } from \"./Constants\";\r\n// Most of these functions have been directly shamelessly \"lifted\" from the https://github.com/@microsoft/tslib and\r\n// modified to be ES5 compatible and applying several minification and tree-shaking techniques so that Application Insights\r\n// can successfully use TypeScript \"importHelpers\" which imports tslib during compilation but it will use these at runtime\r\n// Which is also why all of the functions have not been included as Application Insights currently doesn't use or require\r\n// them.\r\nexport var SymbolObj = (getGlobal() || {})[\"Symbol\"];\r\nexport var ReflectObj = (getGlobal() || {})[\"Reflect\"];\r\nexport var __hasReflect = !!ReflectObj;\r\nvar strDecorate = \"decorate\";\r\nvar strMetadata = \"metadata\";\r\nvar strGetOwnPropertySymbols = \"getOwnPropertySymbols\";\r\nvar strIterator = \"iterator\";\r\nvar strHasOwnProperty = \"hasOwnProperty\";\r\nexport var __objAssignFnImpl = function (t) {\r\n // tslint:disable-next-line: ban-comma-operator\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) {\r\n if (ObjProto[strHasOwnProperty].call(s, p)) {\r\n t[p] = s[p];\r\n }\r\n }\r\n }\r\n return t;\r\n};\r\nexport var __assignFn = objAssign || __objAssignFnImpl;\r\n// tslint:disable-next-line: only-arrow-functions\r\nvar extendStaticsFn = function (d, b) {\r\n extendStaticsFn = ObjClass[\"setPrototypeOf\"] ||\r\n // tslint:disable-next-line: only-arrow-functions\r\n ({ __proto__: [] } instanceof Array && function (d, b) {\r\n d.__proto__ = b;\r\n }) ||\r\n // tslint:disable-next-line: only-arrow-functions\r\n function (d, b) {\r\n for (var p in b) {\r\n if (b[strHasOwnProperty](p)) {\r\n d[p] = b[p];\r\n }\r\n }\r\n };\r\n return extendStaticsFn(d, b);\r\n};\r\nexport function __extendsFn(d, b) {\r\n if (typeof b !== strShimFunction && b !== null) {\r\n throwTypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n }\r\n extendStaticsFn(d, b);\r\n function __() {\r\n this.constructor = d;\r\n }\r\n // tslint:disable-next-line: ban-comma-operator\r\n d[strShimPrototype] = b === null ? objCreate(b) : (__[strShimPrototype] = b[strShimPrototype], new __());\r\n}\r\nexport function __restFn(s, e) {\r\n var t = {};\r\n for (var k in s) {\r\n if (objHasOwnProperty(s, k) && e.indexOf(k) < 0) {\r\n t[k] = s[k];\r\n }\r\n }\r\n if (s != null && typeof ObjClass[strGetOwnPropertySymbols] === strShimFunction) {\r\n for (var i = 0, p = ObjClass[strGetOwnPropertySymbols](s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && ObjProto[\"propertyIsEnumerable\"].call(s, p[i])) {\r\n t[p[i]] = s[p[i]];\r\n }\r\n }\r\n }\r\n return t;\r\n}\r\nexport function __decorateFn(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = ObjClass[\"getOwnPropertyDescriptor\"](target, key) : desc, d;\r\n if (__hasReflect && typeof ReflectObj[strDecorate] === strShimFunction) {\r\n r = ReflectObj[strDecorate](decorators, target, key, desc);\r\n }\r\n else {\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n // eslint-disable-next-line no-cond-assign\r\n if (d = decorators[i]) {\r\n r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n }\r\n }\r\n }\r\n // tslint:disable-next-line:ban-comma-operator\r\n return c > 3 && r && objDefineProp(target, key, r), r;\r\n}\r\nexport function __paramFn(paramIndex, decorator) {\r\n return function (target, key) {\r\n decorator(target, key, paramIndex);\r\n };\r\n}\r\nexport function __metadataFn(metadataKey, metadataValue) {\r\n if (__hasReflect && ReflectObj[strMetadata] === strShimFunction) {\r\n return ReflectObj[strMetadata](metadataKey, metadataValue);\r\n }\r\n}\r\nexport function __exportStarFn(m, o) {\r\n for (var p in m) {\r\n if (p !== strDefault && !objHasOwnProperty(o, p)) {\r\n __createBindingFn(o, m, p);\r\n }\r\n }\r\n}\r\nexport function __createBindingFn(o, m, k, k2) {\r\n if (k2 === undefined) {\r\n k2 = k;\r\n }\r\n if (!!objDefineProp) {\r\n objDefineProp(o, k2, {\r\n enumerable: true,\r\n get: function () {\r\n return m[k];\r\n }\r\n });\r\n }\r\n else {\r\n o[k2] = m[k];\r\n }\r\n}\r\nexport function __valuesFn(o) {\r\n var s = typeof SymbolObj === strShimFunction && SymbolObj[strIterator], m = s && o[s], i = 0;\r\n if (m) {\r\n return m.call(o);\r\n }\r\n if (o && typeof o.length === \"number\") {\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) {\r\n o = void 0;\r\n }\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n }\r\n throwTypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\nexport function __readFn(o, n) {\r\n var m = typeof SymbolObj === strShimFunction && o[SymbolObj[strIterator]];\r\n if (!m) {\r\n return o;\r\n }\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {\r\n ar.push(r.value);\r\n }\r\n }\r\n catch (error) {\r\n e = {\r\n error: error\r\n };\r\n }\r\n finally {\r\n try {\r\n // tslint:disable-next-line:no-conditional-assignment\r\n if (r && !r.done && (m = i[\"return\"])) {\r\n m.call(i);\r\n }\r\n }\r\n finally {\r\n if (e) {\r\n // eslint-disable-next-line no-unsafe-finally\r\n throw e.error;\r\n }\r\n }\r\n }\r\n return ar;\r\n}\r\n/** @deprecated */\r\nexport function __spreadArraysFn() {\r\n var theArgs = arguments;\r\n // Calculate new total size\r\n for (var s = 0, i = 0, il = theArgs.length; i < il; i++) {\r\n s += theArgs[i].length;\r\n }\r\n // Create new full array\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++) {\r\n for (var a = theArgs[i], j = 0, jl = a.length; j < jl; j++, k++) {\r\n r[k] = a[j];\r\n }\r\n }\r\n return r;\r\n}\r\nexport function __spreadArrayFn(to, from) {\r\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) {\r\n to[j] = from[i];\r\n }\r\n return to;\r\n}\r\nexport function __makeTemplateObjectFn(cooked, raw) {\r\n if (objDefineProp) {\r\n objDefineProp(cooked, \"raw\", { value: raw });\r\n }\r\n else {\r\n cooked.raw = raw;\r\n }\r\n return cooked;\r\n}\r\nexport function __importStarFn(mod) {\r\n if (mod && mod.__esModule) {\r\n return mod;\r\n }\r\n var result = {};\r\n if (mod != null) {\r\n for (var k in mod) {\r\n if (k !== strDefault && Object.prototype.hasOwnProperty.call(mod, k)) {\r\n __createBindingFn(result, mod, k);\r\n }\r\n }\r\n }\r\n // Set default module\r\n if (!!objDefineProp) {\r\n objDefineProp(result, strDefault, { enumerable: true, value: mod });\r\n }\r\n else {\r\n result[strDefault] = mod;\r\n }\r\n return result;\r\n}\r\nexport function __importDefaultFn(mod) {\r\n return (mod && mod.__esModule) ? mod : { strDefault: mod };\r\n}\r\n//# sourceMappingURL=TsLibShims.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nvar _a;\r\nimport { getGlobal, objCreate, objHasOwnProperty, throwTypeError } from \"@nevware21/ts-utils\";\r\n;\r\nvar UNDEFINED = \"undefined\";\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar Constructor = 'constructor';\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar Prototype = 'prototype';\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar strFunction = 'function';\r\n/**\r\n * Used to define the name of the instance function lookup table\r\n * @ignore\r\n */\r\nvar DynInstFuncTable = '_dynInstFuncs';\r\n/**\r\n * Name used to tag the dynamic prototype function\r\n * @ignore\r\n */\r\nvar DynProxyTag = '_isDynProxy';\r\n/**\r\n * Name added to a prototype to define the dynamic prototype \"class\" name used to lookup the function table\r\n * @ignore\r\n */\r\nvar DynClassName = '_dynClass';\r\n/**\r\n * Prefix added to the classname to avoid any name clashes with other instance level properties\r\n * @ignore\r\n */\r\nvar DynClassNamePrefix = '_dynCls$';\r\n/**\r\n * A tag which is used to check if we have already to attempted to set the instance function if one is not present\r\n * @ignore\r\n */\r\nvar DynInstChkTag = '_dynInstChk';\r\n/**\r\n * A tag which is used to check if we are allows to try and set an instance function is one is not present. Using the same\r\n * tag name as the function level but a different const name for readability only.\r\n */\r\nvar DynAllowInstChkTag = DynInstChkTag;\r\n/**\r\n * The global (imported) instances where the global performance options are stored\r\n */\r\nvar DynProtoDefaultOptions = '_dfOpts';\r\n/**\r\n * Value used as the name of a class when it cannot be determined\r\n * @ignore\r\n */\r\nvar UnknownValue = '_unknown_';\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar str__Proto = \"__proto__\";\r\n/**\r\n * The polyfill version of __proto__ so that it doesn't cause issues for anyone not expecting it to exist\r\n */\r\nvar DynProtoBaseProto = \"_dyn\" + str__Proto;\r\n/**\r\n * Runtime Global holder for dynamicProto settings\r\n */\r\nvar DynProtoGlobalSettings = \"__dynProto$Gbl\";\r\n/**\r\n * Track the current prototype for IE8 as you can't look back to get the prototype\r\n */\r\nvar DynProtoCurrent = \"_dynInstProto\";\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar strUseBaseInst = 'useBaseInst';\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar strSetInstFuncs = 'setInstFuncs';\r\nvar Obj = Object;\r\n/**\r\n * Pre-lookup to check if we are running on a modern browser (i.e. not IE8)\r\n * @ignore\r\n */\r\nvar _objGetPrototypeOf = Obj[\"getPrototypeOf\"];\r\n/**\r\n * Pre-lookup to check for the existence of this function\r\n */\r\nvar _objGetOwnProps = Obj[\"getOwnPropertyNames\"];\r\n// Since 1.1.7 moving these to the runtime global to work around mixed version and module issues\r\n// See Issue https://github.com/microsoft/DynamicProto-JS/issues/57 for details\r\nvar _gbl = getGlobal();\r\nvar _gblInst = _gbl[DynProtoGlobalSettings] || (_gbl[DynProtoGlobalSettings] = {\r\n o: (_a = {},\r\n _a[strSetInstFuncs] = true,\r\n _a[strUseBaseInst] = true,\r\n _a),\r\n n: 1000 // Start new global index @ 1000 so we \"fix\" some cases when mixed with 1.1.6 or earlier\r\n});\r\n/**\r\n * Helper used to check whether the target is an Object prototype or Array prototype\r\n * @ignore\r\n */\r\nfunction _isObjectOrArrayPrototype(target) {\r\n return target && (target === Obj[Prototype] || target === Array[Prototype]);\r\n}\r\n/**\r\n * Helper used to check whether the target is an Object prototype, Array prototype or Function prototype\r\n * @ignore\r\n */\r\nfunction _isObjectArrayOrFunctionPrototype(target) {\r\n return _isObjectOrArrayPrototype(target) || target === Function[Prototype];\r\n}\r\n/**\r\n * Helper used to get the prototype of the target object as getPrototypeOf is not available in an ES3 environment.\r\n * @ignore\r\n */\r\nfunction _getObjProto(target) {\r\n var newProto;\r\n if (target) {\r\n // This method doesn't exist in older browsers (e.g. IE8)\r\n if (_objGetPrototypeOf) {\r\n return _objGetPrototypeOf(target);\r\n }\r\n var curProto = target[str__Proto] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);\r\n // Using the pre-calculated value as IE8 doesn't support looking up the prototype of a prototype and thus fails for more than 1 base class\r\n newProto = target[DynProtoBaseProto] || curProto;\r\n if (!objHasOwnProperty(target, DynProtoBaseProto)) {\r\n // As this prototype doesn't have this property then this is from an inherited class so newProto is the base to return so save it\r\n // so we can look it up value (which for a multiple hierarchy dynamicProto will be the base class)\r\n delete target[DynProtoCurrent]; // Delete any current value allocated to this instance so we pick up the value from prototype hierarchy\r\n newProto = target[DynProtoBaseProto] = target[DynProtoCurrent] || target[DynProtoBaseProto];\r\n target[DynProtoCurrent] = curProto;\r\n }\r\n }\r\n return newProto;\r\n}\r\n/**\r\n * Helper to get the properties of an object, including none enumerable ones as functions on a prototype in ES6\r\n * are not enumerable.\r\n * @param target\r\n */\r\nfunction _forEachProp(target, func) {\r\n var props = [];\r\n if (_objGetOwnProps) {\r\n props = _objGetOwnProps(target);\r\n }\r\n else {\r\n for (var name_1 in target) {\r\n if (typeof name_1 === \"string\" && objHasOwnProperty(target, name_1)) {\r\n props.push(name_1);\r\n }\r\n }\r\n }\r\n if (props && props.length > 0) {\r\n for (var lp = 0; lp < props.length; lp++) {\r\n func(props[lp]);\r\n }\r\n }\r\n}\r\n/**\r\n * Helper function to check whether the provided function name is a potential candidate for dynamic\r\n * callback and prototype generation.\r\n * @param target The target object, may be a prototype or class object\r\n * @param funcName The function name\r\n * @param skipOwn Skips the check for own property\r\n * @ignore\r\n */\r\nfunction _isDynamicCandidate(target, funcName, skipOwn) {\r\n return (funcName !== Constructor && typeof target[funcName] === strFunction && (skipOwn || objHasOwnProperty(target, funcName)) && funcName !== str__Proto && funcName !== Prototype);\r\n}\r\n/**\r\n * Helper to throw a TypeError exception\r\n * @param message the message\r\n * @ignore\r\n */\r\nfunction _throwTypeError(message) {\r\n throwTypeError(\"DynamicProto: \" + message);\r\n}\r\n/**\r\n * Returns a collection of the instance functions that are defined directly on the thisTarget object, it does\r\n * not return any inherited functions\r\n * @param thisTarget The object to get the instance functions from\r\n * @ignore\r\n */\r\nfunction _getInstanceFuncs(thisTarget) {\r\n // Get the base proto\r\n var instFuncs = objCreate(null);\r\n // Save any existing instance functions\r\n _forEachProp(thisTarget, function (name) {\r\n // Don't include any dynamic prototype instances - as we only want the real functions\r\n if (!instFuncs[name] && _isDynamicCandidate(thisTarget, name, false)) {\r\n // Create an instance callback for passing the base function to the caller\r\n instFuncs[name] = thisTarget[name];\r\n }\r\n });\r\n return instFuncs;\r\n}\r\n/**\r\n * Returns whether the value is included in the array\r\n * @param values The array of values\r\n * @param value The value\r\n */\r\nfunction _hasVisited(values, value) {\r\n for (var lp = values.length - 1; lp >= 0; lp--) {\r\n if (values[lp] === value) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\n/**\r\n * Returns an object that contains callback functions for all \"base/super\" functions, this is used to \"save\"\r\n * enabling calling super.xxx() functions without requiring that the base \"class\" has defined a prototype references\r\n * @param target The current instance\r\n * @ignore\r\n */\r\nfunction _getBaseFuncs(classProto, thisTarget, instFuncs, useBaseInst) {\r\n function _instFuncProxy(target, funcHost, funcName) {\r\n var theFunc = funcHost[funcName];\r\n if (theFunc[DynProxyTag] && useBaseInst) {\r\n // grab and reuse the hosted looking function (if available) otherwise the original passed function\r\n var instFuncTable = target[DynInstFuncTable] || {};\r\n if (instFuncTable[DynAllowInstChkTag] !== false) {\r\n theFunc = (instFuncTable[funcHost[DynClassName]] || {})[funcName] || theFunc;\r\n }\r\n }\r\n return function () {\r\n // eslint-disable-next-line prefer-rest-params\r\n return theFunc.apply(target, arguments);\r\n };\r\n }\r\n // Start creating a new baseFuncs by creating proxies for the instance functions (as they may get replaced)\r\n var baseFuncs = objCreate(null);\r\n _forEachProp(instFuncs, function (name) {\r\n // Create an instance callback for passing the base function to the caller\r\n baseFuncs[name] = _instFuncProxy(thisTarget, instFuncs, name);\r\n });\r\n // Get the base prototype functions\r\n var baseProto = _getObjProto(classProto);\r\n var visited = [];\r\n // Don't include base object functions for Object, Array or Function\r\n while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) {\r\n // look for prototype functions\r\n _forEachProp(baseProto, function (name) {\r\n // Don't include any dynamic prototype instances - as we only want the real functions\r\n // For IE 7/8 the prototype lookup doesn't provide the full chain so we need to bypass the \r\n // hasOwnProperty check we get all of the methods, main difference is that IE7/8 doesn't return\r\n // the Object prototype methods while bypassing the check\r\n if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf)) {\r\n // Create an instance callback for passing the base function to the caller\r\n baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name);\r\n }\r\n });\r\n // We need to find all possible functions that might be overloaded by walking the entire prototype chain\r\n // This avoids the caller from needing to check whether it's direct base class implements the function or not\r\n // by walking the entire chain it simplifies the usage and issues from upgrading any of the base classes.\r\n visited.push(baseProto);\r\n baseProto = _getObjProto(baseProto);\r\n }\r\n return baseFuncs;\r\n}\r\nfunction _getInstFunc(target, funcName, proto, currentDynProtoProxy) {\r\n var instFunc = null;\r\n // We need to check whether the class name is defined directly on this prototype otherwise\r\n // it will walk the proto chain and return any parent proto classname.\r\n if (target && objHasOwnProperty(proto, DynClassName)) {\r\n var instFuncTable = target[DynInstFuncTable] || objCreate(null);\r\n instFunc = (instFuncTable[proto[DynClassName]] || objCreate(null))[funcName];\r\n if (!instFunc) {\r\n // Avoid stack overflow from recursive calling the same function\r\n _throwTypeError(\"Missing [\" + funcName + \"] \" + strFunction);\r\n }\r\n // We have the instance function, lets check it we can speed up further calls\r\n // by adding the instance function back directly on the instance (avoiding the dynamic func lookup)\r\n if (!instFunc[DynInstChkTag] && instFuncTable[DynAllowInstChkTag] !== false) {\r\n // If the instance already has an instance function we can't replace it\r\n var canAddInst = !objHasOwnProperty(target, funcName);\r\n // Get current prototype\r\n var objProto = _getObjProto(target);\r\n var visited = [];\r\n // Lookup the function starting at the top (instance level prototype) and traverse down, if the first matching function\r\n // if nothing is found or if the first hit is a dynamic proto instance then we can safely add an instance shortcut\r\n while (canAddInst && objProto && !_isObjectArrayOrFunctionPrototype(objProto) && !_hasVisited(visited, objProto)) {\r\n var protoFunc = objProto[funcName];\r\n if (protoFunc) {\r\n canAddInst = (protoFunc === currentDynProtoProxy);\r\n break;\r\n }\r\n // We need to find all possible initial functions to ensure that we don't bypass a valid override function\r\n visited.push(objProto);\r\n objProto = _getObjProto(objProto);\r\n }\r\n try {\r\n if (canAddInst) {\r\n // This instance doesn't have an instance func and the class hierarchy does have a higher level prototype version\r\n // so it's safe to directly assign for any subsequent calls (for better performance)\r\n target[funcName] = instFunc;\r\n }\r\n // Block further attempts to set the instance function for any\r\n instFunc[DynInstChkTag] = 1;\r\n }\r\n catch (e) {\r\n // Don't crash if the object is readonly or the runtime doesn't allow changing this\r\n // And set a flag so we don't try again for any function\r\n instFuncTable[DynAllowInstChkTag] = false;\r\n }\r\n }\r\n }\r\n return instFunc;\r\n}\r\nfunction _getProtoFunc(funcName, proto, currentDynProtoProxy) {\r\n var protoFunc = proto[funcName];\r\n // Check that the prototype function is not a self reference -- try to avoid stack overflow!\r\n if (protoFunc === currentDynProtoProxy) {\r\n // It is so lookup the base prototype\r\n protoFunc = _getObjProto(proto)[funcName];\r\n }\r\n if (typeof protoFunc !== strFunction) {\r\n _throwTypeError(\"[\" + funcName + \"] is not a \" + strFunction);\r\n }\r\n return protoFunc;\r\n}\r\n/**\r\n * Add the required dynamic prototype methods to the the class prototype\r\n * @param proto - The class prototype\r\n * @param className - The instance classname\r\n * @param target - The target instance\r\n * @param baseInstFuncs - The base instance functions\r\n * @param setInstanceFunc - Flag to allow prototype function to reset the instance function if one does not exist\r\n * @ignore\r\n */\r\nfunction _populatePrototype(proto, className, target, baseInstFuncs, setInstanceFunc) {\r\n function _createDynamicPrototype(proto, funcName) {\r\n var dynProtoProxy = function () {\r\n // Use the instance or prototype function\r\n var instFunc = _getInstFunc(this, funcName, proto, dynProtoProxy) || _getProtoFunc(funcName, proto, dynProtoProxy);\r\n // eslint-disable-next-line prefer-rest-params\r\n return instFunc.apply(this, arguments);\r\n };\r\n // Tag this function as a proxy to support replacing dynamic proxy elements (primary use case is for unit testing\r\n // via which can dynamically replace the prototype function reference)\r\n dynProtoProxy[DynProxyTag] = 1;\r\n return dynProtoProxy;\r\n }\r\n if (!_isObjectOrArrayPrototype(proto)) {\r\n var instFuncTable = target[DynInstFuncTable] = target[DynInstFuncTable] || objCreate(null);\r\n if (!_isObjectOrArrayPrototype(instFuncTable)) {\r\n var instFuncs_1 = instFuncTable[className] = (instFuncTable[className] || objCreate(null)); // fetch and assign if as it may not exist yet\r\n // Set whether we are allow to lookup instances, if someone has set to false then do not re-enable\r\n if (instFuncTable[DynAllowInstChkTag] !== false) {\r\n instFuncTable[DynAllowInstChkTag] = !!setInstanceFunc;\r\n }\r\n if (!_isObjectOrArrayPrototype(instFuncs_1)) {\r\n _forEachProp(target, function (name) {\r\n // Only add overridden functions\r\n if (_isDynamicCandidate(target, name, false) && target[name] !== baseInstFuncs[name]) {\r\n // Save the instance Function to the lookup table and remove it from the instance as it's not a dynamic proto function\r\n instFuncs_1[name] = target[name];\r\n delete target[name];\r\n // Add a dynamic proto if one doesn't exist or if a prototype function exists and it's not a dynamic one\r\n if (!objHasOwnProperty(proto, name) || (proto[name] && !proto[name][DynProxyTag])) {\r\n proto[name] = _createDynamicPrototype(proto, name);\r\n }\r\n }\r\n });\r\n }\r\n }\r\n }\r\n}\r\n/**\r\n * Checks whether the passed prototype object appears to be correct by walking the prototype hierarchy of the instance\r\n * @param classProto The class prototype instance\r\n * @param thisTarget The current instance that will be checked whether the passed prototype instance is in the hierarchy\r\n * @ignore\r\n */\r\nfunction _checkPrototype(classProto, thisTarget) {\r\n // This method doesn't existing in older browsers (e.g. IE8)\r\n if (_objGetPrototypeOf) {\r\n // As this is primarily a coding time check, don't bother checking if running in IE8 or lower\r\n var visited = [];\r\n var thisProto = _getObjProto(thisTarget);\r\n while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {\r\n if (thisProto === classProto) {\r\n return true;\r\n }\r\n // This avoids the caller from needing to check whether it's direct base class implements the function or not\r\n // by walking the entire chain it simplifies the usage and issues from upgrading any of the base classes.\r\n visited.push(thisProto);\r\n thisProto = _getObjProto(thisProto);\r\n }\r\n return false;\r\n }\r\n // If objGetPrototypeOf doesn't exist then just assume everything is ok.\r\n return true;\r\n}\r\n/**\r\n * Gets the current prototype name using the ES6 name if available otherwise falling back to a use unknown as the name.\r\n * It's not critical for this to return a name, it's used to decorate the generated unique name for easier debugging only.\r\n * @param target\r\n * @param unknownValue\r\n * @ignore\r\n */\r\nfunction _getObjName(target, unknownValue) {\r\n if (objHasOwnProperty(target, Prototype)) {\r\n // Look like a prototype\r\n return target.name || unknownValue || UnknownValue;\r\n }\r\n return (((target || {})[Constructor]) || {}).name || unknownValue || UnknownValue;\r\n}\r\n/**\r\n * Helper function when creating dynamic (inline) functions for classes, this helper performs the following tasks :-\r\n * - Saves references to all defined base class functions\r\n * - Calls the delegateFunc with the current target (this) and a base object reference that can be used to call all \"super\" functions.\r\n * - Will populate the class prototype for all overridden functions to support class extension that call the prototype instance.\r\n * Callers should use this helper when declaring all function within the constructor of a class, as mentioned above the delegateFunc is\r\n * passed both the target \"this\" and an object that can be used to call any base (super) functions, using this based object in place of\r\n * super.XXX() (which gets expanded to _super.prototype.XXX()) provides a better minification outcome and also ensures the correct \"this\"\r\n * context is maintained as TypeScript creates incorrect references using super.XXXX() for dynamically defined functions i.e. Functions\r\n * defined in the constructor or some other function (rather than declared as complete typescript functions).\r\n * ### Usage\r\n * ```typescript\r\n * import dynamicProto from \"@microsoft/dynamicproto-js\";\r\n * class ExampleClass extends BaseClass {\r\n * constructor() {\r\n * dynamicProto(ExampleClass, this, (_self, base) => {\r\n * // This will define a function that will be converted to a prototype function\r\n * _self.newFunc = () => {\r\n * // Access any \"this\" instance property\r\n * if (_self.someProperty) {\r\n * ...\r\n * }\r\n * }\r\n * // This will define a function that will be converted to a prototype function\r\n * _self.myFunction = () => {\r\n * // Access any \"this\" instance property\r\n * if (_self.someProperty) {\r\n * // Call the base version of the function that we are overriding\r\n * base.myFunction();\r\n * }\r\n * ...\r\n * }\r\n * _self.initialize = () => {\r\n * ...\r\n * }\r\n * // Warnings: While the following will work as _self is simply a reference to\r\n * // this, if anyone overrides myFunction() the overridden will be called first\r\n * // as the normal JavaScript method resolution will occur and the defined\r\n * // _self.initialize() function is actually gets removed from the instance and\r\n * // a proxy prototype version is created to reference the created method.\r\n * _self.initialize();\r\n * });\r\n * }\r\n * }\r\n * ```\r\n * @typeparam DPType This is the generic type of the class, used to keep intellisense valid\r\n * @typeparam DPCls The type that contains the prototype of the current class\r\n * @param theClass - This is the current class instance which contains the prototype for the current class\r\n * @param target - The current \"this\" (target) reference, when the class has been extended this.prototype will not be the 'theClass' value.\r\n * @param delegateFunc - The callback function (closure) that will create the dynamic function\r\n * @param options - Additional options to configure how the dynamic prototype operates\r\n */\r\nexport default function dynamicProto(theClass, target, delegateFunc, options) {\r\n // Make sure that the passed theClass argument looks correct\r\n if (!objHasOwnProperty(theClass, Prototype)) {\r\n _throwTypeError(\"theClass is an invalid class definition.\");\r\n }\r\n // Quick check to make sure that the passed theClass argument looks correct (this is a common copy/paste error)\r\n var classProto = theClass[Prototype];\r\n if (!_checkPrototype(classProto, target)) {\r\n _throwTypeError(\"[\" + _getObjName(theClass) + \"] not in hierarchy of [\" + _getObjName(target) + \"]\");\r\n }\r\n var className = null;\r\n if (objHasOwnProperty(classProto, DynClassName)) {\r\n // Only grab the class name if it's defined on this prototype (i.e. don't walk the prototype chain)\r\n className = classProto[DynClassName];\r\n }\r\n else {\r\n // As not all browser support name on the prototype creating a unique dynamic one if we have not already\r\n // assigned one, so we can use a simple string as the lookup rather than an object for the dynamic instance\r\n // function table lookup.\r\n className = DynClassNamePrefix + _getObjName(theClass, \"_\") + \"$\" + _gblInst.n;\r\n _gblInst.n++;\r\n classProto[DynClassName] = className;\r\n }\r\n var perfOptions = dynamicProto[DynProtoDefaultOptions];\r\n var useBaseInst = !!perfOptions[strUseBaseInst];\r\n if (useBaseInst && options && options[strUseBaseInst] !== undefined) {\r\n useBaseInst = !!options[strUseBaseInst];\r\n }\r\n // Get the current instance functions\r\n var instFuncs = _getInstanceFuncs(target);\r\n // Get all of the functions for any base instance (before they are potentially overridden)\r\n var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);\r\n // Execute the delegate passing in both the current target \"this\" and \"base\" function references\r\n // Note casting the same type as we don't actually have the base class here and this will provide some intellisense support\r\n delegateFunc(target, baseFuncs);\r\n // Don't allow setting instance functions for older IE instances\r\n var setInstanceFunc = !!_objGetPrototypeOf && !!perfOptions[strSetInstFuncs];\r\n if (setInstanceFunc && options) {\r\n setInstanceFunc = !!options[strSetInstFuncs];\r\n }\r\n // Populate the Prototype for any overridden instance functions\r\n _populatePrototype(classProto, className, target, instFuncs, setInstanceFunc !== false);\r\n}\r\n/**\r\n * Exposes the default global options to allow global configuration, if the global values are disabled these will override\r\n * any passed values. This is primarily exposed to support unit-testing without the need for individual classes to expose\r\n * their internal usage of dynamic proto.\r\n */\r\ndynamicProto[DynProtoDefaultOptions] = _gblInst.o;\r\n//# sourceMappingURL=DynamicProto.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.3.6\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\n// @skip-file-minify\r\n// ##############################################################\r\n// AUTO GENERATED FILE: This file is Auto Generated during build.\r\n// ##############################################################\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n// Note: DON'T Export these const from the package as we are still targeting ES5 which can result in a mutable variables that someone could change!!!\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\nexport var _DYN_TO_LOWER_CASE = \"toLowerCase\"; // Count: 11\r\nexport var _DYN_LENGTH = \"length\"; // Count: 55\r\nexport var _DYN_WARN_TO_CONSOLE = \"warnToConsole\"; // Count: 4\r\nexport var _DYN_THROW_INTERNAL = \"throwInternal\"; // Count: 5\r\nexport var _DYN_WATCH = \"watch\"; // Count: 7\r\nexport var _DYN_APPLY = \"apply\"; // Count: 7\r\nexport var _DYN_PUSH = \"push\"; // Count: 35\r\nexport var _DYN_SPLICE = \"splice\"; // Count: 8\r\nexport var _DYN_LOGGER = \"logger\"; // Count: 20\r\nexport var _DYN_CANCEL = \"cancel\"; // Count: 6\r\nexport var _DYN_INITIALIZE = \"initialize\"; // Count: 5\r\nexport var _DYN_IDENTIFIER = \"identifier\"; // Count: 8\r\nexport var _DYN_REMOVE_NOTIFICATION_0 = \"removeNotificationListener\"; // Count: 4\r\nexport var _DYN_ADD_NOTIFICATION_LIS1 = \"addNotificationListener\"; // Count: 4\r\nexport var _DYN_IS_INITIALIZED = \"isInitialized\"; // Count: 10\r\nexport var _DYN_VALUE = \"value\"; // Count: 5\r\nexport var _DYN_GET_NOTIFY_MGR = \"getNotifyMgr\"; // Count: 5\r\nexport var _DYN_GET_PLUGIN = \"getPlugin\"; // Count: 5\r\nexport var _DYN_NAME = \"name\"; // Count: 9\r\nexport var _DYN_PROCESS_NEXT = \"processNext\"; // Count: 15\r\nexport var _DYN_GET_PROCESS_TEL_CONT2 = \"getProcessTelContext\"; // Count: 2\r\nexport var _DYN_ENABLED = \"enabled\"; // Count: 6\r\nexport var _DYN_STOP_POLLING_INTERNA3 = \"stopPollingInternalLogs\"; // Count: 2\r\nexport var _DYN_UNLOAD = \"unload\"; // Count: 7\r\nexport var _DYN_ON_COMPLETE = \"onComplete\"; // Count: 4\r\nexport var _DYN_VERSION = \"version\"; // Count: 4\r\nexport var _DYN_LOGGING_LEVEL_CONSOL4 = \"loggingLevelConsole\"; // Count: 2\r\nexport var _DYN_CREATE_NEW = \"createNew\"; // Count: 7\r\nexport var _DYN_TEARDOWN = \"teardown\"; // Count: 9\r\nexport var _DYN_MESSAGE_ID = \"messageId\"; // Count: 4\r\nexport var _DYN_MESSAGE = \"message\"; // Count: 7\r\nexport var _DYN_DIAG_LOG = \"diagLog\"; // Count: 9\r\nexport var _DYN__DO_TEARDOWN = \"_doTeardown\"; // Count: 5\r\nexport var _DYN_UPDATE = \"update\"; // Count: 5\r\nexport var _DYN_GET_NEXT = \"getNext\"; // Count: 10\r\nexport var _DYN_SET_NEXT_PLUGIN = \"setNextPlugin\"; // Count: 5\r\nexport var _DYN_USER_AGENT = \"userAgent\"; // Count: 5\r\nexport var _DYN_SPLIT = \"split\"; // Count: 7\r\nexport var _DYN_REPLACE = \"replace\"; // Count: 9\r\nexport var _DYN_TYPE = \"type\"; // Count: 13\r\nexport var _DYN_EVT_NAME = \"evtName\"; // Count: 4\r\nexport var _DYN_STATUS = \"status\"; // Count: 5\r\nexport var _DYN_GET_ALL_RESPONSE_HEA5 = \"getAllResponseHeaders\"; // Count: 2\r\nexport var _DYN_IS_CHILD_EVT = \"isChildEvt\"; // Count: 3\r\nexport var _DYN_DATA = \"data\"; // Count: 6\r\nexport var _DYN_GET_CTX = \"getCtx\"; // Count: 6\r\nexport var _DYN_SET_CTX = \"setCtx\"; // Count: 10\r\nexport var _DYN_ITEMS_RECEIVED = \"itemsReceived\"; // Count: 3\r\nexport var _DYN_URL_STRING = \"urlString\"; // Count: 5\r\nexport var _DYN_HEADERS = \"headers\"; // Count: 5\r\nexport var _DYN_TIMEOUT = \"timeout\"; // Count: 6\r\nexport var _DYN_TRACE_FLAGS = \"traceFlags\"; // Count: 5\r\nexport var _DYN_GET_ATTRIBUTE = \"getAttribute\"; // Count: 3\r\n//# sourceMappingURL=__DynamicConstants.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.3.6\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { arrForEach, createCustomError, dumpObj } from \"@nevware21/ts-utils\";\r\nimport { _DYN_LENGTH } from \"../__DynamicConstants\";\r\nvar aggregationErrorType;\r\n/**\r\n * Throws an Aggregation Error which includes all of the errors that led to this error occurring\r\n * @param message - The message describing the aggregation error (the sourceError details are added to this)\r\n * @param sourceErrors - An array of the errors that caused this situation\r\n */\r\nexport function throwAggregationError(message, sourceErrors) {\r\n if (!aggregationErrorType) {\r\n aggregationErrorType = createCustomError(\"AggregationError\", function (self, args) {\r\n if (args[_DYN_LENGTH /* @min:%2elength */] > 1) {\r\n // Save the provided errors\r\n self.errors = args[1];\r\n }\r\n });\r\n }\r\n var theMessage = message || \"One or more errors occurred.\";\r\n arrForEach(sourceErrors, function (srcError, idx) {\r\n theMessage += \"\\n\".concat(idx, \" > \").concat(dumpObj(srcError));\r\n });\r\n throw new aggregationErrorType(theMessage, sourceErrors || []);\r\n}\r\n//# sourceMappingURL=AggregationError.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.3.6\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\n// ###################################################################################################################################################\r\n// Note: DON'T Export these const from the package as we are still targeting IE/ES5 this will export a mutable variables that someone could change ###\r\n// ###################################################################################################################################################\r\nexport var UNDEFINED_VALUE = undefined;\r\nexport var STR_EMPTY = \"\";\r\nexport var STR_CHANNELS = \"channels\";\r\nexport var STR_CORE = \"core\";\r\nexport var STR_CREATE_PERF_MGR = \"createPerfMgr\";\r\nexport var STR_DISABLED = \"disabled\";\r\nexport var STR_EXTENSION_CONFIG = \"extensionConfig\";\r\nexport var STR_EXTENSIONS = \"extensions\";\r\nexport var STR_PROCESS_TELEMETRY = \"processTelemetry\";\r\nexport var STR_PRIORITY = \"priority\";\r\nexport var STR_EVENTS_SENT = \"eventsSent\";\r\nexport var STR_EVENTS_DISCARDED = \"eventsDiscarded\";\r\nexport var STR_EVENTS_SEND_REQUEST = \"eventsSendRequest\";\r\nexport var STR_PERF_EVENT = \"perfEvent\";\r\nexport var STR_OFFLINE_STORE = \"offlineEventsStored\";\r\nexport var STR_OFFLINE_SENT = \"offlineBatchSent\";\r\nexport var STR_OFFLINE_DROP = \"offlineBatchDrop\";\r\nexport var STR_GET_PERF_MGR = \"getPerfMgr\";\r\nexport var STR_DOMAIN = \"domain\";\r\nexport var STR_PATH = \"path\";\r\nexport var STR_NOT_DYNAMIC_ERROR = \"Not dynamic - \";\r\n//# sourceMappingURL=InternalConstants.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.3.6\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { ObjAssign, ObjClass } from \"@microsoft/applicationinsights-shims\";\r\nimport { arrForEach, asString as asString21, isArray, isBoolean, isError, isFunction, isNullOrUndefined, isNumber, isObject, isPlainObject, isString, isUndefined, objDeepFreeze, objDefine, objForEachKey, objHasOwn, strIndexOf, strTrim } from \"@nevware21/ts-utils\";\r\nimport { _DYN_APPLY, _DYN_GET_ALL_RESPONSE_HEA5, _DYN_LENGTH, _DYN_NAME, _DYN_REPLACE, _DYN_SPLIT, _DYN_STATUS, _DYN_TO_LOWER_CASE } from \"../__DynamicConstants\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\n// RESTRICT and AVOID circular dependencies you should not import other contained modules or export the contents of this file directly\r\n// Added to help with minification\r\nvar strGetPrototypeOf = \"getPrototypeOf\";\r\nvar rCamelCase = /-([a-z])/g;\r\nvar rNormalizeInvalid = /([^\\w\\d_$])/g;\r\nvar rLeadingNumeric = /^(\\d+[\\w\\d_$])/;\r\nexport var _getObjProto = Object[strGetPrototypeOf];\r\nexport function isNotUndefined(value) {\r\n return !isUndefined(value);\r\n}\r\nexport function isNotNullOrUndefined(value) {\r\n return !isNullOrUndefined(value);\r\n}\r\n/**\r\n * Validates that the string name conforms to the JS IdentifierName specification and if not\r\n * normalizes the name so that it would. This method does not identify or change any keywords\r\n * meaning that if you pass in a known keyword the same value will be returned.\r\n * This is a simplified version\r\n * @param name - The name to validate\r\n */\r\nexport function normalizeJsName(name) {\r\n var value = name;\r\n if (value && isString(value)) {\r\n // CamelCase everything after the \"-\" and remove the dash\r\n value = value[_DYN_REPLACE /* @min:%2ereplace */](rCamelCase, function (_all, letter) {\r\n return letter.toUpperCase();\r\n });\r\n value = value[_DYN_REPLACE /* @min:%2ereplace */](rNormalizeInvalid, \"_\");\r\n value = value[_DYN_REPLACE /* @min:%2ereplace */](rLeadingNumeric, function (_all, match) {\r\n return \"_\" + match;\r\n });\r\n }\r\n return value;\r\n}\r\n/**\r\n * A simple wrapper (for minification support) to check if the value contains the search string.\r\n * @param value - The string value to check for the existence of the search value\r\n * @param search - The value search within the value\r\n */\r\nexport function strContains(value, search) {\r\n if (value && search) {\r\n return strIndexOf(value, search) !== -1;\r\n }\r\n return false;\r\n}\r\n/**\r\n * Convert a date to I.S.O. format in IE8\r\n */\r\nexport function toISOString(date) {\r\n return date && date.toISOString() || \"\";\r\n}\r\nexport var deepFreeze = objDeepFreeze;\r\n/**\r\n * Returns the name of object if it's an Error. Otherwise, returns empty string.\r\n */\r\nexport function getExceptionName(object) {\r\n if (isError(object)) {\r\n return object[_DYN_NAME /* @min:%2ename */];\r\n }\r\n return STR_EMPTY;\r\n}\r\n/**\r\n * Sets the provided value on the target instance using the field name when the provided chk function returns true, the chk\r\n * function will only be called if the new value is no equal to the original value.\r\n * @param target - The target object\r\n * @param field - The key of the target\r\n * @param value - The value to set\r\n * @param valChk - [Optional] Callback to check the value that if supplied will be called check if the new value can be set\r\n * @param srcChk - [Optional] Callback to check to original value that if supplied will be called if the new value should be set (if allowed)\r\n * @returns The existing or new value, depending what was set\r\n */\r\nexport function setValue(target, field, value, valChk, srcChk) {\r\n var theValue = value;\r\n if (target) {\r\n theValue = target[field];\r\n if (theValue !== value && (!srcChk || srcChk(theValue)) && (!valChk || valChk(value))) {\r\n theValue = value;\r\n target[field] = theValue;\r\n }\r\n }\r\n return theValue;\r\n}\r\n/**\r\n * Returns the current value from the target object if not null or undefined otherwise sets the new value and returns it\r\n * @param target - The target object to return or set the default value\r\n * @param field - The key for the field to set on the target\r\n * @param defValue - [Optional] The value to set if not already present, when not provided a empty object will be added\r\n */\r\nexport function getSetValue(target, field, defValue) {\r\n var theValue;\r\n if (target) {\r\n theValue = target[field];\r\n if (!theValue && isNullOrUndefined(theValue)) {\r\n // Supports having the default as null\r\n theValue = !isUndefined(defValue) ? defValue : {};\r\n target[field] = theValue;\r\n }\r\n }\r\n else {\r\n // Expanded for performance so we only check defValue if required\r\n theValue = !isUndefined(defValue) ? defValue : {};\r\n }\r\n return theValue;\r\n}\r\nfunction _createProxyFunction(source, funcName) {\r\n var srcFunc = null;\r\n var src = null;\r\n if (isFunction(source)) {\r\n srcFunc = source;\r\n }\r\n else {\r\n src = source;\r\n }\r\n return function () {\r\n // Capture the original arguments passed to the method\r\n var originalArguments = arguments;\r\n if (srcFunc) {\r\n src = srcFunc();\r\n }\r\n if (src) {\r\n return src[funcName][_DYN_APPLY /* @min:%2eapply */](src, originalArguments);\r\n }\r\n };\r\n}\r\n/**\r\n * Effectively assigns all enumerable properties (not just own properties) and functions (including inherited prototype) from\r\n * the source object to the target, it attempts to use proxy getters / setters (if possible) and proxy functions to avoid potential\r\n * implementation issues by assigning prototype functions as instance ones\r\n *\r\n * This method is the primary method used to \"update\" the snippet proxy with the ultimate implementations.\r\n *\r\n * Special ES3 Notes:\r\n * Updates (setting) of direct property values on the target or indirectly on the source object WILL NOT WORK PROPERLY, updates to the\r\n * properties of \"referenced\" object will work (target.context.newValue = 10 =\\> will be reflected in the source.context as it's the\r\n * same object). ES3 Failures: assigning target.myProp = 3 -\\> Won't change source.myProp = 3, likewise the reverse would also fail.\r\n * @param target - The target object to be assigned with the source properties and functions\r\n * @param source - The source object which will be assigned / called by setting / calling the targets proxies\r\n * @param chkSet - An optional callback to determine whether a specific property/function should be proxied\r\n */\r\nexport function proxyAssign(target, source, chkSet) {\r\n if (target && source && isObject(target) && isObject(source)) {\r\n var _loop_1 = function (field) {\r\n if (isString(field)) {\r\n var value = source[field];\r\n if (isFunction(value)) {\r\n if (!chkSet || chkSet(field, true, source, target)) {\r\n // Create a proxy function rather than just copying the (possible) prototype to the new object as an instance function\r\n target[field] = _createProxyFunction(source, field);\r\n }\r\n }\r\n else if (!chkSet || chkSet(field, false, source, target)) {\r\n if (objHasOwn(target, field)) {\r\n // Remove any previous instance property\r\n delete target[field];\r\n }\r\n objDefine(target, field, {\r\n g: function () {\r\n return source[field];\r\n },\r\n s: function (theValue) {\r\n source[field] = theValue;\r\n }\r\n });\r\n }\r\n }\r\n };\r\n // effectively apply/proxy full source to the target instance\r\n for (var field in source) {\r\n _loop_1(field);\r\n }\r\n }\r\n return target;\r\n}\r\n/**\r\n * Creates a proxy function on the target which internally will call the source version with all arguments passed to the target method.\r\n *\r\n * @param target - The target object to be assigned with the source properties and functions\r\n * @param name - The function name that will be added on the target\r\n * @param source - The source object which will be assigned / called by setting / calling the targets proxies\r\n * @param theFunc - The function name on the source that will be proxied on the target\r\n * @param overwriteTarget - If `false` this will not replace any pre-existing name otherwise (the default) it will overwrite any existing name\r\n */\r\nexport function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {\r\n if (target && name && source) {\r\n if (overwriteTarget !== false || isUndefined(target[name])) {\r\n target[name] = _createProxyFunction(source, theFunc);\r\n }\r\n }\r\n}\r\n/**\r\n * Creates proxy functions on the target which internally will call the source version with all arguments passed to the target method.\r\n *\r\n * @param target - The target object to be assigned with the source properties and functions\r\n * @param source - The source object which will be assigned / called by setting / calling the targets proxies\r\n * @param functionsToProxy - An array of function names that will be proxied on the target\r\n * @param overwriteTarget - If false this will not replace any pre-existing name otherwise (the default) it will overwrite any existing name\r\n */\r\nexport function proxyFunctions(target, source, functionsToProxy, overwriteTarget) {\r\n if (target && source && isObject(target) && isArray(functionsToProxy)) {\r\n arrForEach(functionsToProxy, function (theFuncName) {\r\n if (isString(theFuncName)) {\r\n proxyFunctionAs(target, theFuncName, source, theFuncName, overwriteTarget);\r\n }\r\n });\r\n }\r\n return target;\r\n}\r\n/**\r\n * Simpler helper to create a dynamic class that implements the interface and populates the values with the defaults.\r\n * Only instance properties (hasOwnProperty) values are copied from the defaults to the new instance\r\n * @param defaults - Simple helper\r\n */\r\nexport function createClassFromInterface(defaults) {\r\n return /** @class */ (function () {\r\n function class_1() {\r\n var _this = this;\r\n if (defaults) {\r\n objForEachKey(defaults, function (field, value) {\r\n _this[field] = value;\r\n });\r\n }\r\n }\r\n return class_1;\r\n }());\r\n}\r\n/**\r\n * A helper function to assist with JIT performance for objects that have properties added / removed dynamically\r\n * this is primarily for chromium based browsers and has limited effects on Firefox and none of IE. Only call this\r\n * function after you have finished \"updating\" the object, calling this within loops reduces or defeats the benefits.\r\n * This helps when iterating using for..in, objKeys() and objForEach()\r\n * @param theObject - The object to be optimized if possible\r\n */\r\nexport function optimizeObject(theObject) {\r\n // V8 Optimization to cause the JIT compiler to create a new optimized object for looking up the own properties\r\n // primarily for object with <= 19 properties for >= 20 the effect is reduced or non-existent\r\n if (theObject && ObjAssign) {\r\n theObject = ObjClass(ObjAssign({}, theObject));\r\n }\r\n return theObject;\r\n}\r\nexport function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) {\r\n // Variables\r\n var theArgs = arguments;\r\n var extended = theArgs[0] || {};\r\n var argLen = theArgs[_DYN_LENGTH /* @min:%2elength */];\r\n var deep = false;\r\n var idx = 1;\r\n // Check for \"Deep\" flag\r\n if (argLen > 0 && isBoolean(extended)) {\r\n deep = extended;\r\n extended = theArgs[idx] || {};\r\n idx++;\r\n }\r\n // Handle case when target is a string or something (possible in deep copy)\r\n if (!isObject(extended)) {\r\n extended = {};\r\n }\r\n // Loop through each remaining object and conduct a merge\r\n for (; idx < argLen; idx++) {\r\n var arg = theArgs[idx];\r\n var isArgArray = isArray(arg);\r\n var isArgObj = isObject(arg);\r\n for (var prop in arg) {\r\n var propOk = (isArgArray && (prop in arg)) || (isArgObj && objHasOwn(arg, prop));\r\n if (!propOk) {\r\n continue;\r\n }\r\n var newValue = arg[prop];\r\n var isNewArray = void 0;\r\n // If deep merge and property is an object, merge properties\r\n if (deep && newValue && ((isNewArray = isArray(newValue)) || isPlainObject(newValue))) {\r\n // Grab the current value of the extended object\r\n var clone = extended[prop];\r\n if (isNewArray) {\r\n if (!isArray(clone)) {\r\n // We can't \"merge\" an array with a non-array so overwrite the original\r\n clone = [];\r\n }\r\n }\r\n else if (!isPlainObject(clone)) {\r\n // We can't \"merge\" an object with a non-object\r\n clone = {};\r\n }\r\n // Never move the original objects always clone them\r\n newValue = objExtend(deep, clone, newValue);\r\n }\r\n // Assign the new (or previous) value (unless undefined)\r\n if (newValue !== undefined) {\r\n extended[prop] = newValue;\r\n }\r\n }\r\n }\r\n return extended;\r\n}\r\nexport var asString = asString21;\r\nexport function isFeatureEnabled(feature, cfg) {\r\n var rlt = false;\r\n var ft = cfg && cfg.featureOptIn && cfg.featureOptIn[feature];\r\n if (feature && ft) {\r\n var mode = ft.mode;\r\n // NOTE: None will be considered as true\r\n rlt = (mode == 3 /* FeatureOptInMode.enable */) || (mode == 1 /* FeatureOptInMode.none */);\r\n }\r\n return rlt;\r\n}\r\nexport function getResponseText(xhr) {\r\n try {\r\n return xhr.responseText;\r\n }\r\n catch (e) {\r\n // Best effort, as XHR may throw while XDR wont so just ignore\r\n }\r\n return null;\r\n}\r\nexport function formatErrorMessageXdr(xdr, message) {\r\n if (xdr) {\r\n return \"XDomainRequest,Response:\" + getResponseText(xdr) || \"\";\r\n }\r\n return message;\r\n}\r\nexport function formatErrorMessageXhr(xhr, message) {\r\n if (xhr) {\r\n return \"XMLHttpRequest,Status:\" + xhr[_DYN_STATUS /* @min:%2estatus */] + \",Response:\" + getResponseText(xhr) || xhr.response || \"\";\r\n }\r\n return message;\r\n}\r\nexport function prependTransports(theTransports, newTransports) {\r\n if (newTransports) {\r\n if (isNumber(newTransports)) {\r\n theTransports = [newTransports].concat(theTransports);\r\n }\r\n else if (isArray(newTransports)) {\r\n theTransports = newTransports.concat(theTransports);\r\n }\r\n }\r\n return theTransports;\r\n}\r\nvar strDisabledPropertyName = \"Microsoft_ApplicationInsights_BypassAjaxInstrumentation\";\r\nvar strWithCredentials = \"withCredentials\";\r\nvar strTimeout = \"timeout\";\r\n/**\r\n * Create and open an XMLHttpRequest object\r\n * @param method - The request method\r\n * @param urlString - The url\r\n * @param withCredentials - Option flag indicating that credentials should be sent\r\n * @param disabled - Optional flag indicating that the XHR object should be marked as disabled and not tracked (default is false)\r\n * @param isSync - Optional flag indicating if the instance should be a synchronous request (defaults to false)\r\n * @param timeout - Optional value identifying the timeout value that should be assigned to the XHR request\r\n * @returns A new opened XHR request\r\n */\r\nexport function openXhr(method, urlString, withCredentials, disabled, isSync, timeout) {\r\n if (disabled === void 0) { disabled = false; }\r\n if (isSync === void 0) { isSync = false; }\r\n function _wrapSetXhrProp(xhr, prop, value) {\r\n try {\r\n xhr[prop] = value;\r\n }\r\n catch (e) {\r\n // - Wrapping as depending on the environment setting the property may fail (non-terminally)\r\n }\r\n }\r\n var xhr = new XMLHttpRequest();\r\n if (disabled) {\r\n // Tag the instance so it's not tracked (trackDependency)\r\n // If the environment has locked down the XMLHttpRequest (preventExtensions and/or freeze), this would\r\n // cause the request to fail and we no telemetry would be sent\r\n _wrapSetXhrProp(xhr, strDisabledPropertyName, disabled);\r\n }\r\n if (withCredentials) {\r\n // Some libraries require that the withCredentials flag is set \"before\" open and\r\n // - Wrapping as IE 10 has started throwing when setting before open\r\n _wrapSetXhrProp(xhr, strWithCredentials, withCredentials);\r\n }\r\n xhr.open(method, urlString, !isSync);\r\n if (withCredentials) {\r\n // withCredentials should be set AFTER open (https://xhr.spec.whatwg.org/#the-withcredentials-attribute)\r\n // And older firefox instances from 11+ will throw for sync events (current versions don't) which happens during unload processing\r\n _wrapSetXhrProp(xhr, strWithCredentials, withCredentials);\r\n }\r\n // Only set the timeout for asynchronous requests as\r\n // \"Timeout shouldn't be used for synchronous XMLHttpRequests requests used in a document environment or it will throw an InvalidAccessError exception.\"\"\r\n // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/timeout\r\n if (!isSync && timeout) {\r\n _wrapSetXhrProp(xhr, strTimeout, timeout);\r\n }\r\n return xhr;\r\n}\r\n/**\r\n* Converts the XHR getAllResponseHeaders to a map containing the header key and value.\r\n* @internal\r\n*/\r\n// tslint:disable-next-line: align\r\nexport function convertAllHeadersToMap(headersString) {\r\n var headers = {};\r\n if (isString(headersString)) {\r\n var headersArray = strTrim(headersString)[_DYN_SPLIT /* @min:%2esplit */](/[\\r\\n]+/);\r\n arrForEach(headersArray, function (headerEntry) {\r\n if (headerEntry) {\r\n var idx = headerEntry.indexOf(\": \");\r\n if (idx !== -1) {\r\n // The new spec has the headers returning all as lowercase -- but not all browsers do this yet\r\n var header = strTrim(headerEntry.substring(0, idx))[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]();\r\n var value = strTrim(headerEntry.substring(idx + 1));\r\n headers[header] = value;\r\n }\r\n else {\r\n headers[strTrim(headerEntry)] = 1;\r\n }\r\n }\r\n });\r\n }\r\n return headers;\r\n}\r\n/**\r\n* append the XHR headers.\r\n* @internal\r\n*/\r\nexport function _appendHeader(theHeaders, xhr, name) {\r\n if (!theHeaders[name] && xhr && xhr.getResponseHeader) {\r\n var value = xhr.getResponseHeader(name);\r\n if (value) {\r\n theHeaders[name] = strTrim(value);\r\n }\r\n }\r\n return theHeaders;\r\n}\r\nvar STR_KILL_DURATION_HEADER = \"kill-duration\";\r\nvar STR_KILL_DURATION_SECONDS_HEADER = \"kill-duration-seconds\";\r\nvar STR_TIME_DELTA_HEADER = \"time-delta-millis\";\r\n/**\r\n* get the XHR getAllResponseHeaders.\r\n* @internal\r\n*/\r\nexport function _getAllResponseHeaders(xhr, isOneDs) {\r\n var theHeaders = {};\r\n if (!xhr[_DYN_GET_ALL_RESPONSE_HEA5 /* @min:%2egetAllResponseHeaders */]) {\r\n // Firefox 2-63 doesn't have getAllResponseHeaders function but it does have getResponseHeader\r\n // Only call these if getAllResponseHeaders doesn't exist, otherwise we can get invalid response errors\r\n // as collector is not currently returning the correct header to allow JS to access these headers\r\n if (!!isOneDs) {\r\n theHeaders = _appendHeader(theHeaders, xhr, STR_TIME_DELTA_HEADER);\r\n theHeaders = _appendHeader(theHeaders, xhr, STR_KILL_DURATION_HEADER);\r\n theHeaders = _appendHeader(theHeaders, xhr, STR_KILL_DURATION_SECONDS_HEADER);\r\n }\r\n }\r\n else {\r\n theHeaders = convertAllHeadersToMap(xhr[_DYN_GET_ALL_RESPONSE_HEA5 /* @min:%2egetAllResponseHeaders */]());\r\n }\r\n return theHeaders;\r\n}\r\n//# sourceMappingURL=HelperFuncs.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.3.6\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\n\"use strict\";\r\nimport { getGlobal, strShimObject, strShimPrototype, strShimUndefined } from \"@microsoft/applicationinsights-shims\";\r\nimport { getDocument, getInst, getNavigator, getPerformance, hasNavigator, isFunction, isString, isUndefined, mathMax, strIndexOf } from \"@nevware21/ts-utils\";\r\nimport { _DYN_LENGTH, _DYN_NAME, _DYN_SPLIT, _DYN_TO_LOWER_CASE, _DYN_USER_AGENT } from \"../__DynamicConstants\";\r\nimport { strContains } from \"./HelperFuncs\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\n/**\r\n * This file exists to hold environment utilities that are required to check and\r\n * validate the current operating environment. Unless otherwise required, please\r\n * only use defined methods (functions) in this class so that users of these\r\n * functions/properties only need to include those that are used within their own modules.\r\n */\r\nvar strDocumentMode = \"documentMode\";\r\nvar strLocation = \"location\";\r\nvar strConsole = \"console\";\r\nvar strJSON = \"JSON\";\r\nvar strCrypto = \"crypto\";\r\nvar strMsCrypto = \"msCrypto\";\r\nvar strReactNative = \"ReactNative\";\r\nvar strMsie = \"msie\";\r\nvar strTrident = \"trident/\";\r\nvar strXMLHttpRequest = \"XMLHttpRequest\";\r\nvar _isTrident = null;\r\nvar _navUserAgentCheck = null;\r\nvar _enableMocks = false;\r\nvar _useXDomainRequest = null;\r\nvar _beaconsSupported = null;\r\nfunction _hasProperty(theClass, property) {\r\n var supported = false;\r\n if (theClass) {\r\n try {\r\n supported = property in theClass;\r\n if (!supported) {\r\n var proto = theClass[strShimPrototype];\r\n if (proto) {\r\n supported = property in proto;\r\n }\r\n }\r\n }\r\n catch (e) {\r\n // Do Nothing\r\n }\r\n if (!supported) {\r\n try {\r\n var tmp = new theClass();\r\n supported = !isUndefined(tmp[property]);\r\n }\r\n catch (e) {\r\n // Do Nothing\r\n }\r\n }\r\n }\r\n return supported;\r\n}\r\n/**\r\n * Enable the lookup of test mock objects if requested\r\n * @param enabled - A flag to enable or disable the mock\r\n */\r\nexport function setEnableEnvMocks(enabled) {\r\n _enableMocks = enabled;\r\n}\r\n/**\r\n * Returns the global location object if it is present otherwise null.\r\n * This helper is used to access the location object without causing an exception\r\n * \"Uncaught ReferenceError: location is not defined\"\r\n */\r\nexport function getLocation(checkForMock) {\r\n if (checkForMock && _enableMocks) {\r\n var mockLocation = getInst(\"__mockLocation\");\r\n if (mockLocation) {\r\n return mockLocation;\r\n }\r\n }\r\n if (typeof location === strShimObject && location) {\r\n return location;\r\n }\r\n return getInst(strLocation);\r\n}\r\n/**\r\n * Returns the global console object\r\n */\r\nexport function getConsole() {\r\n if (typeof console !== strShimUndefined) {\r\n return console;\r\n }\r\n return getInst(strConsole);\r\n}\r\n/**\r\n * Checks if JSON object is available, this is required as we support the API running without a\r\n * window /document (eg. Node server, electron webworkers) and if we attempt to assign a history\r\n * object to a local variable or pass as an argument an \"Uncaught ReferenceError: JSON is not defined\"\r\n * exception will be thrown.\r\n * Defined as a function to support lazy / late binding environments.\r\n */\r\nexport function hasJSON() {\r\n return Boolean((typeof JSON === strShimObject && JSON) || getInst(strJSON) !== null);\r\n}\r\n/**\r\n * Returns the global JSON object if it is present otherwise null.\r\n * This helper is used to access the JSON object without causing an exception\r\n * \"Uncaught ReferenceError: JSON is not defined\"\r\n */\r\nexport function getJSON() {\r\n if (hasJSON()) {\r\n return JSON || getInst(strJSON);\r\n }\r\n return null;\r\n}\r\n/**\r\n * Returns the crypto object if it is present otherwise null.\r\n * This helper is used to access the crypto object from the current\r\n * global instance which could be window or globalThis for a web worker\r\n */\r\nexport function getCrypto() {\r\n return getInst(strCrypto);\r\n}\r\n/**\r\n * Returns the crypto object if it is present otherwise null.\r\n * This helper is used to access the crypto object from the current\r\n * global instance which could be window or globalThis for a web worker\r\n */\r\nexport function getMsCrypto() {\r\n return getInst(strMsCrypto);\r\n}\r\n/**\r\n * Returns whether the environment is reporting that we are running in a React Native Environment\r\n */\r\nexport function isReactNative() {\r\n // If running in React Native, navigator.product will be populated\r\n var nav = getNavigator();\r\n if (nav && nav.product) {\r\n return nav.product === strReactNative;\r\n }\r\n return false;\r\n}\r\n/**\r\n * Identifies whether the current environment appears to be IE\r\n */\r\nexport function isIE() {\r\n var nav = getNavigator();\r\n if (nav && (nav[_DYN_USER_AGENT /* @min:%2euserAgent */] !== _navUserAgentCheck || _isTrident === null)) {\r\n // Added to support test mocking of the user agent\r\n _navUserAgentCheck = nav[_DYN_USER_AGENT /* @min:%2euserAgent */];\r\n var userAgent = (_navUserAgentCheck || STR_EMPTY)[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]();\r\n _isTrident = (strContains(userAgent, strMsie) || strContains(userAgent, strTrident));\r\n }\r\n return _isTrident;\r\n}\r\n/**\r\n * Gets IE version returning the document emulation mode if we are running on IE, or null otherwise\r\n */\r\nexport function getIEVersion(userAgentStr) {\r\n if (userAgentStr === void 0) { userAgentStr = null; }\r\n if (!userAgentStr) {\r\n var navigator_1 = getNavigator() || {};\r\n userAgentStr = navigator_1 ? (navigator_1.userAgent || STR_EMPTY)[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]() : STR_EMPTY;\r\n }\r\n var ua = (userAgentStr || STR_EMPTY)[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]();\r\n // Also check for documentMode in case X-UA-Compatible meta tag was included in HTML.\r\n if (strContains(ua, strMsie)) {\r\n var doc = getDocument() || {};\r\n return mathMax(parseInt(ua[_DYN_SPLIT /* @min:%2esplit */](strMsie)[1]), (doc[strDocumentMode] || 0));\r\n }\r\n else if (strContains(ua, strTrident)) {\r\n var tridentVer = parseInt(ua[_DYN_SPLIT /* @min:%2esplit */](strTrident)[1]);\r\n if (tridentVer) {\r\n return tridentVer + 4;\r\n }\r\n }\r\n return null;\r\n}\r\nexport function isSafari(userAgentStr) {\r\n if (!userAgentStr || !isString(userAgentStr)) {\r\n var navigator_2 = getNavigator() || {};\r\n userAgentStr = navigator_2 ? (navigator_2.userAgent || STR_EMPTY)[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]() : STR_EMPTY;\r\n }\r\n var ua = (userAgentStr || STR_EMPTY)[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]();\r\n return (strIndexOf(ua, \"safari\") >= 0);\r\n}\r\n/**\r\n * Checks if HTML5 Beacons are supported in the current environment.\r\n * @param useCached - [Optional] used for testing to bypass the cached lookup, when `true` this will\r\n * cause the cached global to be reset.\r\n * @returns True if supported, false otherwise.\r\n */\r\nexport function isBeaconsSupported(useCached) {\r\n if (_beaconsSupported === null || useCached === false) {\r\n _beaconsSupported = hasNavigator() && Boolean(getNavigator().sendBeacon);\r\n }\r\n return _beaconsSupported;\r\n}\r\n/**\r\n * Checks if the Fetch API is supported in the current environment.\r\n * @param withKeepAlive - [Optional] If True, check if fetch is available and it supports the keepalive feature, otherwise only check if fetch is supported\r\n * @returns True if supported, otherwise false\r\n */\r\nexport function isFetchSupported(withKeepAlive) {\r\n var isSupported = false;\r\n try {\r\n isSupported = !!getInst(\"fetch\");\r\n var request = getInst(\"Request\");\r\n if (isSupported && withKeepAlive && request) {\r\n isSupported = _hasProperty(request, \"keepalive\");\r\n }\r\n }\r\n catch (e) {\r\n // Just Swallow any failure during availability checks\r\n }\r\n return isSupported;\r\n}\r\nexport function useXDomainRequest() {\r\n if (_useXDomainRequest === null) {\r\n _useXDomainRequest = (typeof XDomainRequest !== strShimUndefined);\r\n if (_useXDomainRequest && isXhrSupported()) {\r\n _useXDomainRequest = _useXDomainRequest && !_hasProperty(getInst(strXMLHttpRequest), \"withCredentials\");\r\n }\r\n }\r\n return _useXDomainRequest;\r\n}\r\n/**\r\n * Checks if XMLHttpRequest is supported\r\n * @returns True if supported, otherwise false\r\n */\r\nexport function isXhrSupported() {\r\n var isSupported = false;\r\n try {\r\n var xmlHttpRequest = getInst(strXMLHttpRequest);\r\n isSupported = !!xmlHttpRequest;\r\n }\r\n catch (e) {\r\n // Just Swallow any failure during availability checks\r\n }\r\n return isSupported;\r\n}\r\nfunction _getNamedValue(values, name) {\r\n if (values) {\r\n for (var i = 0; i < values[_DYN_LENGTH /* @min:%2elength */]; i++) {\r\n var value = values[i];\r\n if (value[_DYN_NAME /* @min:%2ename */]) {\r\n if (value[_DYN_NAME /* @min:%2ename */] === name) {\r\n return value;\r\n }\r\n }\r\n }\r\n }\r\n return {};\r\n}\r\n/**\r\n * Helper function to fetch the named meta-tag from the page.\r\n * @param name - The name of the meta-tag to find.\r\n */\r\nexport function findMetaTag(name) {\r\n var doc = getDocument();\r\n if (doc && name) {\r\n // Look for a meta-tag\r\n return _getNamedValue(doc.querySelectorAll(\"meta\"), name).content;\r\n }\r\n return null;\r\n}\r\n/**\r\n * Helper function to fetch the named server timing value from the page response (first navigation event).\r\n * @param name - The name of the server timing value to find.\r\n */\r\nexport function findNamedServerTiming(name) {\r\n var value;\r\n var perf = getPerformance();\r\n if (perf) {\r\n // Try looking for a server-timing header\r\n var navPerf = perf.getEntriesByType(\"navigation\") || [];\r\n value = _getNamedValue((navPerf[_DYN_LENGTH /* @min:%2elength */] > 0 ? navPerf[0] : {}).serverTiming, name).description;\r\n }\r\n return value;\r\n}\r\n// TODO: should reuse this method for analytics plugin\r\nexport function dispatchEvent(target, evnt) {\r\n if (target && target.dispatchEvent && evnt) {\r\n target.dispatchEvent(evnt);\r\n return true;\r\n }\r\n return false;\r\n}\r\nexport function createCustomDomEvent(eventName, details) {\r\n var event = null;\r\n var detail = { detail: details || null };\r\n if (isFunction(CustomEvent)) { // Use CustomEvent constructor when available\r\n event = new CustomEvent(eventName, detail);\r\n }\r\n else { // CustomEvent has no constructor in IE\r\n var doc = getDocument();\r\n if (doc && doc.createEvent) {\r\n event = doc.createEvent(\"CustomEvent\");\r\n event.initCustomEvent(eventName, true, true, detail);\r\n }\r\n }\r\n return event;\r\n}\r\nexport function sendCustomEvent(evtName, cfg, customDetails) {\r\n var global = getGlobal();\r\n if (global && global.CustomEvent) {\r\n try {\r\n var details = { cfg: cfg || null, customDetails: customDetails || null };\r\n return dispatchEvent(global, createCustomDomEvent(evtName, details));\r\n }\r\n catch (e) {\r\n // eslint-disable-next-line no-empty\r\n }\r\n }\r\n return false;\r\n}\r\n//# sourceMappingURL=EnvUtils.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.3.6\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { mathFloor, utcNow } from \"@nevware21/ts-utils\";\r\nimport { _DYN_LENGTH } from \"../__DynamicConstants\";\r\nimport { getCrypto, getMsCrypto, isIE } from \"./EnvUtils\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\nvar UInt32Mask = 0x100000000;\r\nvar MaxUInt32 = 0xffffffff;\r\nvar SEED1 = 123456789;\r\nvar SEED2 = 987654321;\r\n// MWC based Random generator (for IE)\r\nvar _mwcSeeded = false;\r\nvar _mwcW = SEED1;\r\nvar _mwcZ = SEED2;\r\n// Takes any integer\r\nfunction _mwcSeed(seedValue) {\r\n if (seedValue < 0) {\r\n // Make sure we end up with a positive number and not -ve one.\r\n seedValue >>>= 0;\r\n }\r\n _mwcW = (SEED1 + seedValue) & MaxUInt32;\r\n _mwcZ = (SEED2 - seedValue) & MaxUInt32;\r\n _mwcSeeded = true;\r\n}\r\nfunction _autoSeedMwc() {\r\n // Simple initialization using default Math.random() - So we inherit any entropy from the browser\r\n // and bitwise XOR with the current milliseconds\r\n try {\r\n var now = utcNow() & 0x7fffffff;\r\n _mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);\r\n }\r\n catch (e) {\r\n // Don't crash if something goes wrong\r\n }\r\n}\r\n/**\r\n * Generate a random value between 0 and maxValue, max value should be limited to a 32-bit maximum.\r\n * So maxValue(16) will produce a number from 0..16 (range of 17)\r\n * @param maxValue - The max value for the range\r\n */\r\nexport function randomValue(maxValue) {\r\n if (maxValue > 0) {\r\n return mathFloor((random32() / MaxUInt32) * (maxValue + 1)) >>> 0;\r\n }\r\n return 0;\r\n}\r\n/**\r\n * generate a random 32-bit number (0x000000..0xFFFFFFFF) or (-0x80000000..0x7FFFFFFF), defaults un-unsigned.\r\n * @param signed - True to return a signed 32-bit number (-0x80000000..0x7FFFFFFF) otherwise an unsigned one (0x000000..0xFFFFFFFF)\r\n */\r\nexport function random32(signed) {\r\n var value = 0;\r\n var c = getCrypto() || getMsCrypto();\r\n if (c && c.getRandomValues) {\r\n // Make sure the number is converted into the specified range (-0x80000000..0x7FFFFFFF)\r\n value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;\r\n }\r\n if (value === 0 && isIE()) {\r\n // For IE 6, 7, 8 (especially on XP) Math.random is not very random\r\n if (!_mwcSeeded) {\r\n // Set the seed for the Mwc algorithm\r\n _autoSeedMwc();\r\n }\r\n // Don't use Math.random for IE\r\n // Make sure the number is converted into the specified range (-0x80000000..0x7FFFFFFF)\r\n value = mwcRandom32() & MaxUInt32;\r\n }\r\n if (value === 0) {\r\n // Make sure the number is converted into the specified range (-0x80000000..0x7FFFFFFF)\r\n value = mathFloor((UInt32Mask * Math.random()) | 0);\r\n }\r\n if (!signed) {\r\n // Make sure we end up with a positive number and not -ve one.\r\n value >>>= 0;\r\n }\r\n return value;\r\n}\r\n/**\r\n * Seed the MWC random number generator with the specified seed or a random value\r\n * @param value - optional the number to used as the seed, if undefined, null or zero a random value will be chosen\r\n */\r\nexport function mwcRandomSeed(value) {\r\n if (!value) {\r\n _autoSeedMwc();\r\n }\r\n else {\r\n _mwcSeed(value);\r\n }\r\n}\r\n/**\r\n * Generate a random 32-bit number between (0x000000..0xFFFFFFFF) or (-0x80000000..0x7FFFFFFF), using MWC (Multiply with carry)\r\n * instead of Math.random() defaults to un-signed.\r\n * Used as a replacement random generator for IE to avoid issues with older IE instances.\r\n * @param signed - True to return a signed 32-bit number (-0x80000000..0x7FFFFFFF) otherwise an unsigned one (0x000000..0xFFFFFFFF)\r\n */\r\nexport function mwcRandom32(signed) {\r\n _mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;\r\n _mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;\r\n var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;\r\n if (!signed) {\r\n // Make sure we end up with a positive number and not -ve one.\r\n value >>>= 0;\r\n }\r\n return value;\r\n}\r\n/**\r\n * Generate random base64 id string.\r\n * The default length is 22 which is 132-bits so almost the same as a GUID but as base64 (the previous default was 5)\r\n * @param maxLength - Optional value to specify the length of the id to be generated, defaults to 22\r\n */\r\nexport function newId(maxLength) {\r\n if (maxLength === void 0) { maxLength = 22; }\r\n var base64chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\r\n // Start with an initial random number, consuming the value in reverse byte order\r\n var number = random32() >>> 0; // Make sure it's a +ve number\r\n var chars = 0;\r\n var result = STR_EMPTY;\r\n while (result[_DYN_LENGTH /* @min:%2elength */] < maxLength) {\r\n chars++;\r\n result += base64chars.charAt(number & 0x3F);\r\n number >>>= 6; // Zero fill with right shift\r\n if (chars === 5) {\r\n // 5 base64 characters === 30 bits so we don't have enough bits for another base64 char\r\n // So add on another 30 bits and make sure it's +ve\r\n number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;\r\n chars = 0; // We need to reset the number every 5 chars (30 bits)\r\n }\r\n }\r\n return result;\r\n}\r\n//# sourceMappingURL=RandomHelper.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.3.6\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { objDefine } from \"@nevware21/ts-utils\";\r\nimport { normalizeJsName } from \"./HelperFuncs\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\nimport { newId } from \"./RandomHelper\";\r\nvar version = '3.3.6';\r\nvar instanceName = \".\" + newId(6);\r\nvar _dataUid = 0;\r\n// Accepts only:\r\n// - Node\r\n// - Node.ELEMENT_NODE\r\n// - Node.DOCUMENT_NODE\r\n// - Object\r\n// - Any\r\nfunction _canAcceptData(target) {\r\n return target.nodeType === 1 || target.nodeType === 9 || !(+target.nodeType);\r\n}\r\nfunction _getCache(data, target) {\r\n var theCache = target[data.id];\r\n if (!theCache) {\r\n theCache = {};\r\n try {\r\n if (_canAcceptData(target)) {\r\n objDefine(target, data.id, {\r\n e: false,\r\n v: theCache\r\n });\r\n }\r\n }\r\n catch (e) {\r\n // Not all environments allow extending all objects, so just ignore the cache in those cases\r\n }\r\n }\r\n return theCache;\r\n}\r\nexport function createUniqueNamespace(name, includeVersion) {\r\n if (includeVersion === void 0) { includeVersion = false; }\r\n return normalizeJsName(name + (_dataUid++) + (includeVersion ? \".\" + version : STR_EMPTY) + instanceName);\r\n}\r\nexport function createElmNodeData(name) {\r\n var data = {\r\n id: createUniqueNamespace(\"_aiData-\" + (name || STR_EMPTY) + \".\" + version),\r\n accept: function (target) {\r\n return _canAcceptData(target);\r\n },\r\n get: function (target, name, defValue, addDefault) {\r\n var theCache = target[data.id];\r\n if (!theCache) {\r\n if (addDefault) {\r\n // Side effect is adds the cache\r\n theCache = _getCache(data, target);\r\n theCache[normalizeJsName(name)] = defValue;\r\n }\r\n return defValue;\r\n }\r\n return theCache[normalizeJsName(name)];\r\n },\r\n kill: function (target, name) {\r\n if (target && target[name]) {\r\n try {\r\n delete target[name];\r\n }\r\n catch (e) {\r\n // Just cleaning up, so if this fails -- ignore\r\n }\r\n }\r\n }\r\n };\r\n return data;\r\n}\r\n//# sourceMappingURL=DataCacheHelper.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.3.6\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { asString, isArray, isDefined, isNullOrUndefined, isObject, isPlainObject, isUndefined, objForEachKey, objHasOwn } from \"@nevware21/ts-utils\";\r\nimport { _DYN_LENGTH } from \"../__DynamicConstants\";\r\nfunction _isConfigDefaults(value) {\r\n return (value && isObject(value) && (value.isVal || value.fb || objHasOwn(value, \"v\") || objHasOwn(value, \"mrg\") || objHasOwn(value, \"ref\") || value.set));\r\n}\r\nfunction _getDefault(dynamicHandler, theConfig, cfgDefaults) {\r\n var defValue;\r\n var isDefaultValid = cfgDefaults.dfVal || isDefined;\r\n // There is a fallback config key so try and grab that first\r\n if (theConfig && cfgDefaults.fb) {\r\n var fallbacks = cfgDefaults.fb;\r\n if (!isArray(fallbacks)) {\r\n fallbacks = [fallbacks];\r\n }\r\n for (var lp = 0; lp < fallbacks[_DYN_LENGTH /* @min:%2elength */]; lp++) {\r\n var fallback = fallbacks[lp];\r\n var fbValue = theConfig[fallback];\r\n if (isDefaultValid(fbValue)) {\r\n defValue = fbValue;\r\n }\r\n else if (dynamicHandler) {\r\n // Needed to ensure that the fallback value (and potentially) new field is also dynamic even if null/undefined\r\n fbValue = dynamicHandler.cfg[fallback];\r\n if (isDefaultValid(fbValue)) {\r\n defValue = fbValue;\r\n }\r\n // Needed to ensure that the fallback value (and potentially) new field is also dynamic even if null/undefined\r\n dynamicHandler.set(dynamicHandler.cfg, asString(fallback), fbValue);\r\n }\r\n if (isDefaultValid(defValue)) {\r\n // We have a valid default so break out of the look\r\n break;\r\n }\r\n }\r\n }\r\n // If the value is still not defined and we have a default value then use that\r\n if (!isDefaultValid(defValue) && isDefaultValid(cfgDefaults.v)) {\r\n defValue = cfgDefaults.v;\r\n }\r\n return defValue;\r\n}\r\n/**\r\n * Recursively resolve the default value\r\n * @param dynamicHandler\r\n * @param theConfig\r\n * @param cfgDefaults\r\n * @returns\r\n */\r\nfunction _resolveDefaultValue(dynamicHandler, theConfig, cfgDefaults) {\r\n var theValue = cfgDefaults;\r\n if (cfgDefaults && _isConfigDefaults(cfgDefaults)) {\r\n theValue = _getDefault(dynamicHandler, theConfig, cfgDefaults);\r\n }\r\n if (theValue) {\r\n if (_isConfigDefaults(theValue)) {\r\n theValue = _resolveDefaultValue(dynamicHandler, theConfig, theValue);\r\n }\r\n var newValue_1;\r\n if (isArray(theValue)) {\r\n newValue_1 = [];\r\n newValue_1[_DYN_LENGTH /* @min:%2elength */] = theValue[_DYN_LENGTH /* @min:%2elength */];\r\n }\r\n else if (isPlainObject(theValue)) {\r\n newValue_1 = {};\r\n }\r\n if (newValue_1) {\r\n objForEachKey(theValue, function (key, value) {\r\n if (value && _isConfigDefaults(value)) {\r\n value = _resolveDefaultValue(dynamicHandler, theConfig, value);\r\n }\r\n newValue_1[key] = value;\r\n });\r\n theValue = newValue_1;\r\n }\r\n }\r\n return theValue;\r\n}\r\n/**\r\n * Applies the default value on the config property and makes sure that it's dynamic\r\n * @param theConfig\r\n * @param name\r\n * @param defaultValue\r\n */\r\nexport function _applyDefaultValue(dynamicHandler, theConfig, name, defaultValue) {\r\n // Resolve the initial config value from the provided value or use the defined default\r\n var isValid;\r\n var setFn;\r\n var defValue;\r\n var cfgDefaults = defaultValue;\r\n var mergeDf;\r\n var reference;\r\n var readOnly;\r\n var blkDynamicValue;\r\n if (_isConfigDefaults(cfgDefaults)) {\r\n // looks like a IConfigDefault\r\n isValid = cfgDefaults.isVal;\r\n setFn = cfgDefaults.set;\r\n readOnly = cfgDefaults.rdOnly;\r\n blkDynamicValue = cfgDefaults.blkVal;\r\n mergeDf = cfgDefaults.mrg;\r\n reference = cfgDefaults.ref;\r\n if (!reference && isUndefined(reference)) {\r\n reference = !!mergeDf;\r\n }\r\n defValue = _getDefault(dynamicHandler, theConfig, cfgDefaults);\r\n }\r\n else {\r\n defValue = defaultValue;\r\n }\r\n if (blkDynamicValue) {\r\n // Mark the property so that any value assigned will be blocked from conversion, we need to do this\r\n // before assigning or fetching the value to ensure it's not converted\r\n dynamicHandler.blkVal(theConfig, name);\r\n }\r\n // Set the value to the default value;\r\n var theValue;\r\n var usingDefault = true;\r\n var cfgValue = theConfig[name];\r\n // try and get and user provided values\r\n if (cfgValue || !isNullOrUndefined(cfgValue)) {\r\n // Use the defined theConfig[name] value\r\n theValue = cfgValue;\r\n usingDefault = false;\r\n // The values are different and we have a special default value check, which is used to\r\n // override config values like empty strings to continue using the default\r\n if (isValid && theValue !== defValue && !isValid(theValue)) {\r\n theValue = defValue;\r\n usingDefault = true;\r\n }\r\n if (setFn) {\r\n theValue = setFn(theValue, defValue, theConfig);\r\n usingDefault = theValue === defValue;\r\n }\r\n }\r\n if (!usingDefault) {\r\n if (isPlainObject(theValue) || isArray(defValue)) {\r\n // we are using the user supplied value and it's an object\r\n if (mergeDf && defValue && (isPlainObject(defValue) || isArray(defValue))) {\r\n // Resolve/apply the defaults\r\n objForEachKey(defValue, function (dfName, dfValue) {\r\n // Sets the value and makes it dynamic (if it doesn't already exist)\r\n _applyDefaultValue(dynamicHandler, theValue, dfName, dfValue);\r\n });\r\n }\r\n }\r\n }\r\n else if (defValue) {\r\n // Just resolve the default\r\n theValue = _resolveDefaultValue(dynamicHandler, theConfig, defValue);\r\n }\r\n else {\r\n theValue = defValue;\r\n }\r\n // if (theValue && usingDefault && (isPlainObject(theValue) || isArray(theValue))) {\r\n // theValue = _cfgDeepCopy(theValue);\r\n // }\r\n // Needed to ensure that the (potentially) new field is dynamic even if null/undefined\r\n dynamicHandler.set(theConfig, name, theValue);\r\n if (reference) {\r\n dynamicHandler.ref(theConfig, name);\r\n }\r\n if (readOnly) {\r\n dynamicHandler.rdOnly(theConfig, name);\r\n }\r\n}\r\n//# sourceMappingURL=ConfigDefaults.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.3.6\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { isArray, isPlainObject, objForEachKey, symbolFor, throwTypeError } from \"@nevware21/ts-utils\";\r\nimport { _DYN_LENGTH } from \"../__DynamicConstants\";\r\n// Using Symbol.for so that if the same symbol was already created it would be returned\r\n// To handle multiple instances using potentially different versions we are not using\r\n// createUniqueNamespace()\r\nexport var CFG_HANDLER_LINK = symbolFor(\"[[ai_dynCfg_1]]\");\r\n/**\r\n * @internal\r\n * @ignore\r\n * The symbol to tag objects / arrays with if they should not be converted\r\n */\r\nvar BLOCK_DYNAMIC = symbolFor(\"[[ai_blkDynCfg_1]]\");\r\n/**\r\n * @internal\r\n * @ignore\r\n * The symbol to tag objects to indicate that when included into the configuration that\r\n * they should be converted into a trackable dynamic object.\r\n */\r\nvar FORCE_DYNAMIC = symbolFor(\"[[ai_frcDynCfg_1]]\");\r\nexport function _cfgDeepCopy(source) {\r\n if (source) {\r\n var target_1;\r\n if (isArray(source)) {\r\n target_1 = [];\r\n target_1[_DYN_LENGTH /* @min:%2elength */] = source[_DYN_LENGTH /* @min:%2elength */];\r\n }\r\n else if (isPlainObject(source)) {\r\n target_1 = {};\r\n }\r\n if (target_1) {\r\n // Copying index values by property name as the extensionConfig can be an array or object\r\n objForEachKey(source, function (key, value) {\r\n // Perform a deep copy of the object\r\n target_1[key] = _cfgDeepCopy(value);\r\n });\r\n return target_1;\r\n }\r\n }\r\n return source;\r\n}\r\n/**\r\n * @internal\r\n * Get the dynamic config handler if the value is already dynamic\r\n * @returns\r\n */\r\nexport function getDynamicConfigHandler(value) {\r\n if (value) {\r\n var handler = value[CFG_HANDLER_LINK] || value;\r\n if (handler.cfg && (handler.cfg === value || handler.cfg[CFG_HANDLER_LINK] === handler)) {\r\n return handler;\r\n }\r\n }\r\n return null;\r\n}\r\n/**\r\n * Mark the provided value so that if it's included into the configuration it will NOT have\r\n * its properties converted into a dynamic (reactive) object. If the object is not a plain object\r\n * or an array (ie. a class) this function has not affect as only Objects and Arrays are converted\r\n * into dynamic objects in the dynamic configuration.\r\n *\r\n * When you have tagged a value as both {@link forceDynamicConversion} and blocked force will take precedence.\r\n *\r\n * You should only need to use this function, if you are creating dynamic \"classes\" from objects\r\n * which confirm to the require interface. A common case for this is during unit testing where it's\r\n * easier to create mock extensions.\r\n *\r\n * If `value` is falsy (null / undefined / 0 / empty string etc) it will not be tagged and\r\n * if there is an exception adding the property to the value (because its frozen etc) the\r\n * exception will be swallowed\r\n *\r\n * @example\r\n * ```ts\r\n * // This is a valid \"extension\", but it is technically an object\r\n * // So when included in the config.extensions it WILL be cloned and then\r\n * // converted into a dynamic object, where all of its properties will become\r\n * // get/set object properties and will be tracked. While this WILL still\r\n * // function, when attempt to use a mocking framework on top of this the\r\n * // functions are now technically get accessors which return a function\r\n * // and this can cause some mocking frameworks to fail.\r\n * let mockChannel = {\r\n * pause: () => { },\r\n* resume: () => { },\r\n* teardown: () => { },\r\n* flush: (async: any, callBack: any) => { },\r\n* processTelemetry: (env: any) => { },\r\n* setNextPlugin: (next: any) => { },\r\n* initialize: (config: any, core: any, extensions: any) => { },\r\n* identifier: \"testChannel\",\r\n* priority: 1003\r\n* };\r\n * ```\r\n * @param value - The object that you want to block from being converted into a\r\n * trackable dynamic object\r\n * @returns The original value\r\n */\r\nexport function blockDynamicConversion(value) {\r\n if (value && (isPlainObject(value) || isArray(value))) {\r\n try {\r\n value[BLOCK_DYNAMIC] = true;\r\n }\r\n catch (e) {\r\n // Don't throw for this case as it's an ask only\r\n }\r\n }\r\n return value;\r\n}\r\n/**\r\n * This is the reverse case of {@link blockDynamicConversion} in that this will tag an\r\n * object to indicate that it should always be converted into a dynamic trackable object\r\n * even when not an object or array. So all properties of this object will become\r\n * get / set accessor functions.\r\n *\r\n * When you have tagged a value as both {@link forceDynamicConversion} and blocked force will take precedence.\r\n *\r\n * If `value` is falsy (null / undefined / 0 / empty string etc) it will not be tagged and\r\n * if there is an exception adding the property to the value (because its frozen etc) the\r\n * exception will be swallowed.\r\n * @param value - The object that should be tagged and converted if included into a dynamic\r\n * configuration.\r\n * @returns The original value\r\n */\r\nexport function forceDynamicConversion(value) {\r\n if (value) {\r\n try {\r\n value[FORCE_DYNAMIC] = true;\r\n }\r\n catch (e) {\r\n // Don't throw for this case as it's an ask only\r\n }\r\n }\r\n return value;\r\n}\r\n/**\r\n * @internal\r\n * @ignore\r\n * Helper function to check whether an object can or should be converted into a dynamic\r\n * object.\r\n * @param value - The object to check whether it should be converted\r\n * @returns `true` if the value should be converted otherwise `false`.\r\n */\r\nexport function _canMakeDynamic(getFunc, state, value) {\r\n var result = false;\r\n // Object must exist and be truthy\r\n if (value && !getFunc[state.blkVal]) {\r\n // Tagged as always convert\r\n result = value[FORCE_DYNAMIC];\r\n // Check that it's not explicitly tagged as blocked\r\n if (!result && !value[BLOCK_DYNAMIC]) {\r\n // Only convert plain objects or arrays by default\r\n result = isPlainObject(value) || isArray(value);\r\n }\r\n }\r\n return result;\r\n}\r\n/**\r\n * Throws an invalid access exception\r\n * @param message - The message to include in the exception\r\n */\r\nexport function throwInvalidAccess(message) {\r\n throwTypeError(\"InvalidAccess:\" + message);\r\n}\r\n//# sourceMappingURL=DynamicSupport.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.3.6\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { arrForEach, arrIndexOf, dumpObj, isArray, objDefine, objDefineProp, objForEachKey, objGetOwnPropertyDescriptor } from \"@nevware21/ts-utils\";\r\nimport { UNDEFINED_VALUE } from \"../JavaScriptSDK/InternalConstants\";\r\nimport { _DYN_APPLY, _DYN_LOGGER, _DYN_PUSH, _DYN_SPLICE, _DYN_THROW_INTERNAL } from \"../__DynamicConstants\";\r\nimport { CFG_HANDLER_LINK, _canMakeDynamic, blockDynamicConversion, throwInvalidAccess } from \"./DynamicSupport\";\r\nvar arrayMethodsToPatch = [\r\n \"push\",\r\n \"pop\",\r\n \"shift\",\r\n \"unshift\",\r\n \"splice\"\r\n];\r\nexport var _throwDynamicError = function (logger, name, desc, e) {\r\n logger && logger[_DYN_THROW_INTERNAL /* @min:%2ethrowInternal */](3 /* eLoggingSeverity.DEBUG */, 108 /* _eInternalMessageId.DynamicConfigException */, \"\".concat(desc, \" [\").concat(name, \"] failed - \") + dumpObj(e));\r\n};\r\nfunction _patchArray(state, target, name) {\r\n if (isArray(target)) {\r\n // Monkey Patch the methods that might change the array\r\n arrForEach(arrayMethodsToPatch, function (method) {\r\n var orgMethod = target[method];\r\n target[method] = function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n var result = orgMethod[_DYN_APPLY /* @min:%2eapply */](this, args);\r\n // items may be added, removed or moved so need to make some new dynamic properties\r\n _makeDynamicObject(state, target, name, \"Patching\");\r\n return result;\r\n };\r\n });\r\n }\r\n}\r\nfunction _getOwnPropGetter(target, name) {\r\n var propDesc = objGetOwnPropertyDescriptor(target, name);\r\n return propDesc && propDesc.get;\r\n}\r\nfunction _createDynamicProperty(state, theConfig, name, value) {\r\n // Does not appear to be dynamic so lets make it so\r\n var detail = {\r\n n: name,\r\n h: [],\r\n trk: function (handler) {\r\n if (handler && handler.fn) {\r\n if (arrIndexOf(detail.h, handler) === -1) {\r\n // Add this handler to the collection that should be notified when the value changes\r\n detail.h[_DYN_PUSH /* @min:%2epush */](handler);\r\n }\r\n state.trk(handler, detail);\r\n }\r\n },\r\n clr: function (handler) {\r\n var idx = arrIndexOf(detail.h, handler);\r\n if (idx !== -1) {\r\n detail.h[_DYN_SPLICE /* @min:%2esplice */](idx, 1);\r\n }\r\n }\r\n };\r\n // Flag to optimize lookup response time by avoiding additional function calls\r\n var checkDynamic = true;\r\n var isObjectOrArray = false;\r\n function _getProperty() {\r\n if (checkDynamic) {\r\n isObjectOrArray = isObjectOrArray || _canMakeDynamic(_getProperty, state, value);\r\n // Make sure that if it's an object that we make it dynamic\r\n if (value && !value[CFG_HANDLER_LINK] && isObjectOrArray) {\r\n // It doesn't look like it's already dynamic so lets make sure it's converted the object into a dynamic Config as well\r\n value = _makeDynamicObject(state, value, name, \"Converting\");\r\n }\r\n // If it needed to be converted it now has been\r\n checkDynamic = false;\r\n }\r\n // If there is an active handler then add it to the tracking set of handlers\r\n var activeHandler = state.act;\r\n if (activeHandler) {\r\n detail.trk(activeHandler);\r\n }\r\n return value;\r\n }\r\n // Tag this getter as our dynamic property and provide shortcut for notifying a change\r\n _getProperty[state.prop] = {\r\n chng: function () {\r\n state.add(detail);\r\n }\r\n };\r\n function _setProperty(newValue) {\r\n if (value !== newValue) {\r\n if (!!_getProperty[state.ro] && !state.upd) {\r\n // field is marked as readonly so return false\r\n throwInvalidAccess(\"[\" + name + \"] is read-only:\" + dumpObj(theConfig));\r\n }\r\n if (checkDynamic) {\r\n isObjectOrArray = isObjectOrArray || _canMakeDynamic(_getProperty, state, value);\r\n checkDynamic = false;\r\n }\r\n // The value must be a plain object or an array to enforce the reference (in-place updates)\r\n var isReferenced = isObjectOrArray && _getProperty[state.rf];\r\n if (isObjectOrArray) {\r\n // We are about to replace a plain object or an array\r\n if (isReferenced) {\r\n // Reassign the properties from the current value to the same properties from the newValue\r\n // This will set properties not in the newValue to undefined\r\n objForEachKey(value, function (key) {\r\n value[key] = newValue ? newValue[key] : UNDEFINED_VALUE;\r\n });\r\n // Now assign / re-assign value with all of the keys from newValue\r\n try {\r\n objForEachKey(newValue, function (key, theValue) {\r\n _setDynamicProperty(state, value, key, theValue);\r\n });\r\n // Now drop newValue so when we assign value later it keeps the existing reference\r\n newValue = value;\r\n }\r\n catch (e) {\r\n // Unable to convert to dynamic property so just leave as non-dynamic\r\n _throwDynamicError((state.hdlr || {})[_DYN_LOGGER /* @min:%2elogger */], name, \"Assigning\", e);\r\n // Mark as not an object or array so we don't try and do this again\r\n isObjectOrArray = false;\r\n }\r\n }\r\n else if (value && value[CFG_HANDLER_LINK]) {\r\n // As we are replacing the value, if it's already dynamic then we need to notify the listeners\r\n // for every property it has already\r\n objForEachKey(value, function (key) {\r\n // Check if the value is dynamic\r\n var getter = _getOwnPropGetter(value, key);\r\n if (getter) {\r\n // And if it is tell it's listeners that the value has changed\r\n var valueState = getter[state.prop];\r\n valueState && valueState.chng();\r\n }\r\n });\r\n }\r\n }\r\n if (newValue !== value) {\r\n var newIsObjectOrArray = newValue && _canMakeDynamic(_getProperty, state, newValue);\r\n if (!isReferenced && newIsObjectOrArray) {\r\n // As the newValue is an object/array lets preemptively make it dynamic\r\n newValue = _makeDynamicObject(state, newValue, name, \"Converting\");\r\n }\r\n // Now assign the internal \"value\" to the newValue\r\n value = newValue;\r\n isObjectOrArray = newIsObjectOrArray;\r\n }\r\n // Cause any listeners to be scheduled for notification\r\n state.add(detail);\r\n }\r\n }\r\n objDefine(theConfig, detail.n, { g: _getProperty, s: _setProperty });\r\n}\r\nexport function _setDynamicProperty(state, target, name, value) {\r\n if (target) {\r\n // To be a dynamic property it needs to have a get function\r\n var getter = _getOwnPropGetter(target, name);\r\n var isDynamic = getter && !!getter[state.prop];\r\n if (!isDynamic) {\r\n _createDynamicProperty(state, target, name, value);\r\n }\r\n else {\r\n // Looks like it's already dynamic just assign the new value\r\n target[name] = value;\r\n }\r\n }\r\n return target;\r\n}\r\nexport function _setDynamicPropertyState(state, target, name, flags) {\r\n if (target) {\r\n // To be a dynamic property it needs to have a get function\r\n var getter = _getOwnPropGetter(target, name);\r\n var isDynamic = getter && !!getter[state.prop];\r\n var inPlace = flags && flags[0 /* _eSetDynamicPropertyFlags.inPlace */];\r\n var rdOnly = flags && flags[1 /* _eSetDynamicPropertyFlags.readOnly */];\r\n var blkProp = flags && flags[2 /* _eSetDynamicPropertyFlags.blockDynamicProperty */];\r\n if (!isDynamic) {\r\n if (blkProp) {\r\n try {\r\n // Attempt to mark the target as blocked from conversion\r\n blockDynamicConversion(target);\r\n }\r\n catch (e) {\r\n _throwDynamicError((state.hdlr || {})[_DYN_LOGGER /* @min:%2elogger */], name, \"Blocking\", e);\r\n }\r\n }\r\n try {\r\n // Make sure it's dynamic so that we can tag the property as per the state\r\n _setDynamicProperty(state, target, name, target[name]);\r\n getter = _getOwnPropGetter(target, name);\r\n }\r\n catch (e) {\r\n // Unable to convert to dynamic property so just leave as non-dynamic\r\n _throwDynamicError((state.hdlr || {})[_DYN_LOGGER /* @min:%2elogger */], name, \"State\", e);\r\n }\r\n }\r\n // Assign the optional flags if true\r\n if (inPlace) {\r\n getter[state.rf] = inPlace;\r\n }\r\n if (rdOnly) {\r\n getter[state.ro] = rdOnly;\r\n }\r\n if (blkProp) {\r\n getter[state.blkVal] = true;\r\n }\r\n }\r\n return target;\r\n}\r\nexport function _makeDynamicObject(state, target, name, desc) {\r\n try {\r\n // Assign target with new value properties (converting into dynamic properties in the process)\r\n objForEachKey(target, function (key, value) {\r\n // Assign and/or make the property dynamic\r\n _setDynamicProperty(state, target, key, value);\r\n });\r\n if (!target[CFG_HANDLER_LINK]) {\r\n // Link the config back to the dynamic config details\r\n objDefineProp(target, CFG_HANDLER_LINK, {\r\n get: function () {\r\n return state.hdlr;\r\n }\r\n });\r\n _patchArray(state, target, name);\r\n }\r\n }\r\n catch (e) {\r\n // Unable to convert to dynamic property so just leave as non-dynamic\r\n _throwDynamicError((state.hdlr || {})[_DYN_LOGGER /* @min:%2elogger */], name, desc, e);\r\n }\r\n return target;\r\n}\r\n//# sourceMappingURL=DynamicProperty.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.3.6\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { arrForEach, arrIndexOf, dumpObj, newSymbol, scheduleTimeout } from \"@nevware21/ts-utils\";\r\nimport { throwAggregationError } from \"../JavaScriptSDK/AggregationError\";\r\nimport { _DYN_CANCEL, _DYN_LENGTH, _DYN_LOGGER, _DYN_PUSH, _DYN_THROW_INTERNAL } from \"../__DynamicConstants\";\r\nvar symPrefix = \"[[ai_\";\r\nvar symPostfix = \"]]\";\r\nexport function _createState(cfgHandler) {\r\n var dynamicPropertySymbol = newSymbol(symPrefix + \"get\" + cfgHandler.uid + symPostfix);\r\n var dynamicPropertyReadOnly = newSymbol(symPrefix + \"ro\" + cfgHandler.uid + symPostfix);\r\n var dynamicPropertyReferenced = newSymbol(symPrefix + \"rf\" + cfgHandler.uid + symPostfix);\r\n var dynamicPropertyBlockValue = newSymbol(symPrefix + \"blkVal\" + cfgHandler.uid + symPostfix);\r\n var dynamicPropertyDetail = newSymbol(symPrefix + \"dtl\" + cfgHandler.uid + symPostfix);\r\n var _waitingHandlers = null;\r\n var _watcherTimer = null;\r\n var theState;\r\n function _useHandler(activeHandler, callback) {\r\n var prevWatcher = theState.act;\r\n try {\r\n theState.act = activeHandler;\r\n if (activeHandler && activeHandler[dynamicPropertyDetail]) {\r\n // Clear out the previously tracked details for this handler, so that access are re-evaluated\r\n arrForEach(activeHandler[dynamicPropertyDetail], function (detail) {\r\n detail.clr(activeHandler);\r\n });\r\n activeHandler[dynamicPropertyDetail] = [];\r\n }\r\n callback({\r\n cfg: cfgHandler.cfg,\r\n set: cfgHandler.set.bind(cfgHandler),\r\n setDf: cfgHandler.setDf.bind(cfgHandler),\r\n ref: cfgHandler.ref.bind(cfgHandler),\r\n rdOnly: cfgHandler.rdOnly.bind(cfgHandler)\r\n });\r\n }\r\n catch (e) {\r\n var logger = cfgHandler[_DYN_LOGGER /* @min:%2elogger */];\r\n if (logger) {\r\n // Don't let one individual failure break everyone\r\n logger[_DYN_THROW_INTERNAL /* @min:%2ethrowInternal */](1 /* eLoggingSeverity.CRITICAL */, 107 /* _eInternalMessageId.ConfigWatcherException */, dumpObj(e));\r\n }\r\n // Re-throw the exception so that any true \"error\" is reported back to the called\r\n throw e;\r\n }\r\n finally {\r\n theState.act = prevWatcher || null;\r\n }\r\n }\r\n function _notifyWatchers() {\r\n if (_waitingHandlers) {\r\n var notifyHandlers = _waitingHandlers;\r\n _waitingHandlers = null;\r\n // Stop any timer as we are running them now anyway\r\n _watcherTimer && _watcherTimer[_DYN_CANCEL /* @min:%2ecancel */]();\r\n _watcherTimer = null;\r\n var watcherFailures_1 = [];\r\n // Now run the handlers\r\n arrForEach(notifyHandlers, function (handler) {\r\n if (handler) {\r\n if (handler[dynamicPropertyDetail]) {\r\n arrForEach(handler[dynamicPropertyDetail], function (detail) {\r\n // Clear out this handler from previously tracked details, so that access are re-evaluated\r\n detail.clr(handler);\r\n });\r\n handler[dynamicPropertyDetail] = null;\r\n }\r\n // The handler may have self removed as part of another handler so re-check\r\n if (handler.fn) {\r\n try {\r\n _useHandler(handler, handler.fn);\r\n }\r\n catch (e) {\r\n // Don't let a single failing watcher cause other watches to fail\r\n watcherFailures_1[_DYN_PUSH /* @min:%2epush */](e);\r\n }\r\n }\r\n }\r\n });\r\n // During notification we may have had additional updates -- so notify those updates as well\r\n if (_waitingHandlers) {\r\n try {\r\n _notifyWatchers();\r\n }\r\n catch (e) {\r\n watcherFailures_1[_DYN_PUSH /* @min:%2epush */](e);\r\n }\r\n }\r\n if (watcherFailures_1[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n throwAggregationError(\"Watcher error(s): \", watcherFailures_1);\r\n }\r\n }\r\n }\r\n function _addWatcher(detail) {\r\n if (detail && detail.h[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n if (!_waitingHandlers) {\r\n _waitingHandlers = [];\r\n }\r\n if (!_watcherTimer) {\r\n _watcherTimer = scheduleTimeout(function () {\r\n _watcherTimer = null;\r\n _notifyWatchers();\r\n }, 0);\r\n }\r\n // Add all of the handlers for this detail (if not already present) - using normal for-loop for performance\r\n for (var idx = 0; idx < detail.h[_DYN_LENGTH /* @min:%2elength */]; idx++) {\r\n var handler = detail.h[idx];\r\n // Add this handler to the collection of handlers to re-execute\r\n if (handler && arrIndexOf(_waitingHandlers, handler) === -1) {\r\n _waitingHandlers[_DYN_PUSH /* @min:%2epush */](handler);\r\n }\r\n }\r\n }\r\n }\r\n function _trackHandler(handler, detail) {\r\n if (handler) {\r\n var details = handler[dynamicPropertyDetail] = handler[dynamicPropertyDetail] || [];\r\n if (arrIndexOf(details, detail) === -1) {\r\n // If this detail is not already listed as tracked then add it so that we re-evaluate it's usage\r\n details[_DYN_PUSH /* @min:%2epush */](detail);\r\n }\r\n }\r\n }\r\n theState = {\r\n prop: dynamicPropertySymbol,\r\n ro: dynamicPropertyReadOnly,\r\n rf: dynamicPropertyReferenced,\r\n blkVal: dynamicPropertyBlockValue,\r\n hdlr: cfgHandler,\r\n add: _addWatcher,\r\n notify: _notifyWatchers,\r\n use: _useHandler,\r\n trk: _trackHandler\r\n };\r\n return theState;\r\n}\r\n//# sourceMappingURL=DynamicState.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.3.6\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { dumpObj, isUndefined, objDefine, objForEachKey } from \"@nevware21/ts-utils\";\r\nimport { createUniqueNamespace } from \"../JavaScriptSDK/DataCacheHelper\";\r\nimport { STR_NOT_DYNAMIC_ERROR } from \"../JavaScriptSDK/InternalConstants\";\r\nimport { _DYN_THROW_INTERNAL, _DYN_WARN_TO_CONSOLE, _DYN_WATCH } from \"../__DynamicConstants\";\r\nimport { _applyDefaultValue } from \"./ConfigDefaults\";\r\nimport { _makeDynamicObject, _setDynamicProperty, _setDynamicPropertyState, _throwDynamicError } from \"./DynamicProperty\";\r\nimport { _createState } from \"./DynamicState\";\r\nimport { CFG_HANDLER_LINK, _cfgDeepCopy, getDynamicConfigHandler, throwInvalidAccess } from \"./DynamicSupport\";\r\n/**\r\n * Identifies a function which will be re-called whenever any of it's accessed configuration values\r\n * change.\r\n * @param configHandler - The callback that will be called for the initial request and then whenever any\r\n * accessed configuration changes are identified.\r\n */\r\nfunction _createAndUseHandler(state, configHandler) {\r\n var handler = {\r\n fn: configHandler,\r\n rm: function () {\r\n // Clear all references to the handler so it can be garbage collected\r\n // This will also cause this handler to never get called and eventually removed\r\n handler.fn = null;\r\n state = null;\r\n configHandler = null;\r\n }\r\n };\r\n objDefine(handler, \"toJSON\", { v: function () { return \"WatcherHandler\" + (handler.fn ? \"\" : \"[X]\"); } });\r\n state.use(handler, configHandler);\r\n return handler;\r\n}\r\n/**\r\n * Creates the dynamic config handler and associates with the target config as the root object\r\n * @param target - The config that you want to be root of the dynamic config\r\n * @param inPlace - Should the passed config be converted in-place or a new proxy returned\r\n * @returns The existing dynamic handler or a new instance with the provided config values\r\n */\r\nfunction _createDynamicHandler(logger, target, inPlace) {\r\n var dynamicHandler = getDynamicConfigHandler(target);\r\n if (dynamicHandler) {\r\n // The passed config is already dynamic so return it's tracker\r\n return dynamicHandler;\r\n }\r\n var uid = createUniqueNamespace(\"dyncfg\", true);\r\n var newTarget = (target && inPlace !== false) ? target : _cfgDeepCopy(target);\r\n var theState;\r\n function _notifyWatchers() {\r\n theState.notify();\r\n }\r\n function _setValue(target, name, value) {\r\n try {\r\n target = _setDynamicProperty(theState, target, name, value);\r\n }\r\n catch (e) {\r\n // Unable to convert to dynamic property so just leave as non-dynamic\r\n _throwDynamicError(logger, name, \"Setting value\", e);\r\n }\r\n return target[name];\r\n }\r\n function _watch(configHandler) {\r\n return _createAndUseHandler(theState, configHandler);\r\n }\r\n function _block(configHandler, allowUpdate) {\r\n theState.use(null, function (details) {\r\n var prevUpd = theState.upd;\r\n try {\r\n if (!isUndefined(allowUpdate)) {\r\n theState.upd = allowUpdate;\r\n }\r\n configHandler(details);\r\n }\r\n finally {\r\n theState.upd = prevUpd;\r\n }\r\n });\r\n }\r\n function _ref(target, name) {\r\n var _a;\r\n // Make sure it's dynamic and mark as referenced with it's current value\r\n return _setDynamicPropertyState(theState, target, name, (_a = {}, _a[0 /* _eSetDynamicPropertyFlags.inPlace */] = true, _a))[name];\r\n }\r\n function _rdOnly(target, name) {\r\n var _a;\r\n // Make sure it's dynamic and mark as readonly with it's current value\r\n return _setDynamicPropertyState(theState, target, name, (_a = {}, _a[1 /* _eSetDynamicPropertyFlags.readOnly */] = true, _a))[name];\r\n }\r\n function _blkPropValue(target, name) {\r\n var _a;\r\n // Make sure it's dynamic and mark as readonly with it's current value\r\n return _setDynamicPropertyState(theState, target, name, (_a = {}, _a[2 /* _eSetDynamicPropertyFlags.blockDynamicProperty */] = true, _a))[name];\r\n }\r\n function _applyDefaults(theConfig, defaultValues) {\r\n if (defaultValues) {\r\n // Resolve/apply the defaults\r\n objForEachKey(defaultValues, function (name, value) {\r\n // Sets the value and makes it dynamic (if it doesn't already exist)\r\n _applyDefaultValue(cfgHandler, theConfig, name, value);\r\n });\r\n }\r\n return theConfig;\r\n }\r\n var cfgHandler = {\r\n uid: null,\r\n cfg: newTarget,\r\n logger: logger,\r\n notify: _notifyWatchers,\r\n set: _setValue,\r\n setDf: _applyDefaults,\r\n watch: _watch,\r\n ref: _ref,\r\n rdOnly: _rdOnly,\r\n blkVal: _blkPropValue,\r\n _block: _block\r\n };\r\n objDefine(cfgHandler, \"uid\", {\r\n c: false,\r\n e: false,\r\n w: false,\r\n v: uid\r\n });\r\n theState = _createState(cfgHandler);\r\n // Setup tracking for all defined default keys\r\n _makeDynamicObject(theState, newTarget, \"config\", \"Creating\");\r\n return cfgHandler;\r\n}\r\n/**\r\n * Log an invalid access message to the console\r\n */\r\nfunction _logInvalidAccess(logger, message) {\r\n if (logger) {\r\n logger[_DYN_WARN_TO_CONSOLE /* @min:%2ewarnToConsole */](message);\r\n logger[_DYN_THROW_INTERNAL /* @min:%2ethrowInternal */](2 /* eLoggingSeverity.WARNING */, 108 /* _eInternalMessageId.DynamicConfigException */, message);\r\n }\r\n else {\r\n // We don't have a logger so just throw an exception\r\n throwInvalidAccess(message);\r\n }\r\n}\r\n/**\r\n * Create or return a dynamic version of the passed config, if it is not already dynamic\r\n * @param config - The config to be converted into a dynamic config\r\n * @param defaultConfig - The default values to apply on the config if the properties don't already exist\r\n * @param inPlace - Should the config be converted in-place into a dynamic config or a new instance returned, defaults to true\r\n * @returns The dynamic config handler for the config (whether new or existing)\r\n */\r\nexport function createDynamicConfig(config, defaultConfig, logger, inPlace) {\r\n var dynamicHandler = _createDynamicHandler(logger, config || {}, inPlace);\r\n if (defaultConfig) {\r\n dynamicHandler.setDf(dynamicHandler.cfg, defaultConfig);\r\n }\r\n return dynamicHandler;\r\n}\r\n/**\r\n * Watch and track changes for accesses to the current config, the provided config MUST already be\r\n * a dynamic config or a child accessed via the dynamic config\r\n * @param logger - The logger instance to use if there is no existing handler\r\n * @returns A watcher handler instance that can be used to remove itself when being unloaded\r\n * @throws TypeError if the provided config is not a dynamic config instance\r\n */\r\nexport function onConfigChange(config, configHandler, logger) {\r\n var handler = config[CFG_HANDLER_LINK] || config;\r\n if (handler.cfg && (handler.cfg === config || handler.cfg[CFG_HANDLER_LINK] === handler)) {\r\n return handler[_DYN_WATCH /* @min:%2ewatch */](configHandler);\r\n }\r\n _logInvalidAccess(logger, STR_NOT_DYNAMIC_ERROR + dumpObj(config));\r\n return createDynamicConfig(config, null, logger)[_DYN_WATCH /* @min:%2ewatch */](configHandler);\r\n}\r\n//# sourceMappingURL=DynamicConfig.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.3.6\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { asString, isBoolean, isFunction, isNullOrUndefined, isString } from \"@nevware21/ts-utils\";\r\nimport { STR_EMPTY } from \"../JavaScriptSDK/InternalConstants\";\r\nimport { _DYN_TO_LOWER_CASE } from \"../__DynamicConstants\";\r\n/**\r\n * @internal\r\n * @ignore\r\n * @param str\r\n * @param defaultValue\r\n * @returns\r\n */\r\nfunction _stringToBoolOrDefault(theValue, defaultValue, theConfig) {\r\n if (!theValue && isNullOrUndefined(theValue)) {\r\n return defaultValue;\r\n }\r\n if (isBoolean(theValue)) {\r\n return theValue;\r\n }\r\n return asString(theValue)[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]() === \"true\";\r\n}\r\n/**\r\n * Helper which returns an IConfigDefaultCheck instance with the field defined as an object\r\n * that should be merged\r\n * @param defaultValue - The default value to apply it not provided or it's not valid\r\n * @returns a new IConfigDefaultCheck structure\r\n */\r\nexport function cfgDfMerge(defaultValue) {\r\n return {\r\n mrg: true,\r\n v: defaultValue\r\n };\r\n}\r\n/**\r\n * Helper which returns an IConfigDefaultCheck instance with the provided field set function\r\n * @param setter - The IConfigCheckFn function to validate the user provided value\r\n * @param defaultValue - The default value to apply it not provided or it's not valid\r\n * @returns a new IConfigDefaultCheck structure\r\n */\r\nexport function cfgDfSet(setter, defaultValue) {\r\n return {\r\n set: setter,\r\n v: defaultValue\r\n };\r\n}\r\n/**\r\n * Helper which returns an IConfigDefaultCheck instance with the provided field validator\r\n * @param validator - The IConfigCheckFn function to validate the user provided value\r\n * @param defaultValue - The default value to apply it not provided or it's not valid\r\n * @param fallBackName - The fallback configuration name if the current value is not available\r\n * @returns a new IConfigDefaultCheck structure\r\n */\r\nexport function cfgDfValidate(validator, defaultValue, fallBackName) {\r\n return {\r\n fb: fallBackName,\r\n isVal: validator,\r\n v: defaultValue\r\n };\r\n}\r\n/**\r\n * Helper which returns an IConfigDefaultCheck instance that will validate and convert the user\r\n * provided value to a boolean from a string or boolean value\r\n * @param defaultValue - The default value to apply it not provided or it's not valid\r\n * @param fallBackName - The fallback configuration name if the current value is not available\r\n * @returns a new IConfigDefaultCheck structure\r\n */\r\nexport function cfgDfBoolean(defaultValue, fallBackName) {\r\n return {\r\n fb: fallBackName,\r\n set: _stringToBoolOrDefault,\r\n v: !!defaultValue\r\n };\r\n}\r\n/**\r\n * Helper which returns an IConfigDefaultCheck instance that will validate that the user\r\n * provided value is a function.\r\n * @param defaultValue - The default value to apply it not provided or it's not valid\r\n * @returns a new IConfigDefaultCheck structure\r\n */\r\nexport function cfgDfFunc(defaultValue) {\r\n return {\r\n isVal: isFunction,\r\n v: defaultValue || null\r\n };\r\n}\r\n/**\r\n * Helper which returns an IConfigDefaultCheck instance that will validate that the user\r\n * provided value is a function.\r\n * @param defaultValue - The default string value to apply it not provided or it's not valid, defaults to an empty string\r\n * @returns a new IConfigDefaultCheck structure\r\n */\r\nexport function cfgDfString(defaultValue) {\r\n return {\r\n isVal: isString,\r\n v: asString(defaultValue || STR_EMPTY)\r\n };\r\n}\r\n/**\r\n * Helper which returns an IConfigDefaultCheck instance identifying that value associated with this property\r\n * should not have it's properties converted into a dynamic config properties.\r\n * @param defaultValue - The default value to apply it not provided or it's not valid\r\n * @returns a new IConfigDefaultCheck structure\r\n */\r\nexport function cfgDfBlockPropValue(defaultValue) {\r\n return {\r\n blkVal: true,\r\n v: defaultValue\r\n };\r\n}\r\n//# sourceMappingURL=ConfigDefaultHelpers.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.3.6\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { getInst } from \"@nevware21/ts-utils\";\r\nimport { _DYN_APPLY, _DYN_LENGTH } from \"../__DynamicConstants\";\r\nimport { STR_EVENTS_DISCARDED, STR_EVENTS_SEND_REQUEST, STR_EVENTS_SENT, STR_PERF_EVENT } from \"./InternalConstants\";\r\nvar listenerFuncs = [STR_EVENTS_SENT, STR_EVENTS_DISCARDED, STR_EVENTS_SEND_REQUEST, STR_PERF_EVENT];\r\nvar _aiNamespace = null;\r\nvar _debugListener;\r\nfunction _listenerProxyFunc(name, config) {\r\n return function () {\r\n var args = arguments;\r\n var dbgExt = getDebugExt(config);\r\n if (dbgExt) {\r\n var listener = dbgExt.listener;\r\n if (listener && listener[name]) {\r\n listener[name][_DYN_APPLY /* @min:%2eapply */](listener, args);\r\n }\r\n }\r\n };\r\n}\r\nfunction _getExtensionNamespace() {\r\n // Cache the lookup of the global namespace object\r\n var target = getInst(\"Microsoft\");\r\n if (target) {\r\n _aiNamespace = target[\"ApplicationInsights\"];\r\n }\r\n return _aiNamespace;\r\n}\r\nexport function getDebugExt(config) {\r\n var ns = _aiNamespace;\r\n if (!ns && config.disableDbgExt !== true) {\r\n ns = _aiNamespace || _getExtensionNamespace();\r\n }\r\n return ns ? ns[\"ChromeDbgExt\"] : null;\r\n}\r\nexport function getDebugListener(config) {\r\n if (!_debugListener) {\r\n _debugListener = {};\r\n for (var lp = 0; lp < listenerFuncs[_DYN_LENGTH /* @min:%2elength */]; lp++) {\r\n _debugListener[listenerFuncs[lp]] = _listenerProxyFunc(listenerFuncs[lp], config);\r\n }\r\n }\r\n return _debugListener;\r\n}\r\n//# sourceMappingURL=DbgExtensionUtils.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.3.6\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\n\"use strict\";\r\nvar _a;\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { dumpObj, isFunction, isUndefined } from \"@nevware21/ts-utils\";\r\nimport { createDynamicConfig, onConfigChange } from \"../Config/DynamicConfig\";\r\nimport { _DYN_DIAG_LOG, _DYN_LOGGER, _DYN_LOGGING_LEVEL_CONSOL4, _DYN_MESSAGE, _DYN_MESSAGE_ID, _DYN_PUSH, _DYN_REPLACE, _DYN_THROW_INTERNAL, _DYN_UNLOAD, _DYN_WARN_TO_CONSOLE } from \"../__DynamicConstants\";\r\nimport { getDebugExt } from \"./DbgExtensionUtils\";\r\nimport { getConsole, getJSON, hasJSON } from \"./EnvUtils\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\nvar STR_WARN_TO_CONSOLE = \"warnToConsole\";\r\n/**\r\n * For user non actionable traces use AI Internal prefix.\r\n */\r\nvar AiNonUserActionablePrefix = \"AI (Internal): \";\r\n/**\r\n * Prefix of the traces in portal.\r\n */\r\nvar AiUserActionablePrefix = \"AI: \";\r\n/**\r\n * Session storage key for the prefix for the key indicating message type already logged\r\n */\r\nvar AIInternalMessagePrefix = \"AITR_\";\r\nvar defaultValues = {\r\n loggingLevelConsole: 0,\r\n loggingLevelTelemetry: 1,\r\n maxMessageLimit: 25,\r\n enableDebug: false\r\n};\r\nvar _logFuncs = (_a = {},\r\n _a[0 /* eLoggingSeverity.DISABLED */] = null,\r\n _a[1 /* eLoggingSeverity.CRITICAL */] = \"errorToConsole\",\r\n _a[2 /* eLoggingSeverity.WARNING */] = STR_WARN_TO_CONSOLE,\r\n _a[3 /* eLoggingSeverity.DEBUG */] = \"debugToConsole\",\r\n _a);\r\nfunction _sanitizeDiagnosticText(text) {\r\n if (text) {\r\n return \"\\\"\" + text[_DYN_REPLACE /* @min:%2ereplace */](/\\\"/g, STR_EMPTY) + \"\\\"\";\r\n }\r\n return STR_EMPTY;\r\n}\r\nfunction _logToConsole(func, message) {\r\n var theConsole = getConsole();\r\n if (!!theConsole) {\r\n var logFunc = \"log\";\r\n if (theConsole[func]) {\r\n logFunc = func;\r\n }\r\n if (isFunction(theConsole[logFunc])) {\r\n theConsole[logFunc](message);\r\n }\r\n }\r\n}\r\nvar _InternalLogMessage = /** @class */ (function () {\r\n function _InternalLogMessage(msgId, msg, isUserAct, properties) {\r\n if (isUserAct === void 0) { isUserAct = false; }\r\n var _self = this;\r\n _self[_DYN_MESSAGE_ID /* @min:%2emessageId */] = msgId;\r\n _self[_DYN_MESSAGE /* @min:%2emessage */] =\r\n (isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +\r\n msgId;\r\n var strProps = STR_EMPTY;\r\n if (hasJSON()) {\r\n strProps = getJSON().stringify(properties);\r\n }\r\n var diagnosticText = (msg ? \" message:\" + _sanitizeDiagnosticText(msg) : STR_EMPTY) +\r\n (properties ? \" props:\" + _sanitizeDiagnosticText(strProps) : STR_EMPTY);\r\n _self[_DYN_MESSAGE /* @min:%2emessage */] += diagnosticText;\r\n }\r\n _InternalLogMessage.dataType = \"MessageData\";\r\n return _InternalLogMessage;\r\n}());\r\nexport { _InternalLogMessage };\r\nexport function safeGetLogger(core, config) {\r\n return (core || {})[_DYN_LOGGER /* @min:%2elogger */] || new DiagnosticLogger(config);\r\n}\r\nvar DiagnosticLogger = /** @class */ (function () {\r\n function DiagnosticLogger(config) {\r\n this.identifier = \"DiagnosticLogger\";\r\n /**\r\n * The internal logging queue\r\n */\r\n this.queue = [];\r\n /**\r\n * Count of internal messages sent\r\n */\r\n var _messageCount = 0;\r\n /**\r\n * Holds information about what message types were already logged to console or sent to server.\r\n */\r\n var _messageLogged = {};\r\n var _loggingLevelConsole;\r\n var _loggingLevelTelemetry;\r\n var _maxInternalMessageLimit;\r\n var _enableDebug;\r\n var _unloadHandler;\r\n dynamicProto(DiagnosticLogger, this, function (_self) {\r\n _unloadHandler = _setDefaultsFromConfig(config || {});\r\n _self.consoleLoggingLevel = function () { return _loggingLevelConsole; };\r\n /**\r\n * This method will throw exceptions in debug mode or attempt to log the error as a console warning.\r\n * @param severity - The severity of the log message\r\n * @param message - The log message.\r\n */\r\n _self[_DYN_THROW_INTERNAL /* @min:%2ethrowInternal */] = function (severity, msgId, msg, properties, isUserAct) {\r\n if (isUserAct === void 0) { isUserAct = false; }\r\n var message = new _InternalLogMessage(msgId, msg, isUserAct, properties);\r\n if (_enableDebug) {\r\n throw dumpObj(message);\r\n }\r\n else {\r\n // Get the logging function and fallback to warnToConsole of for some reason errorToConsole doesn't exist\r\n var logFunc = _logFuncs[severity] || STR_WARN_TO_CONSOLE;\r\n if (!isUndefined(message[_DYN_MESSAGE /* @min:%2emessage */])) {\r\n if (isUserAct) {\r\n // check if this message type was already logged to console for this page view and if so, don't log it again\r\n var messageKey = +message[_DYN_MESSAGE_ID /* @min:%2emessageId */];\r\n if (!_messageLogged[messageKey] && _loggingLevelConsole >= severity) {\r\n _self[logFunc](message[_DYN_MESSAGE /* @min:%2emessage */]);\r\n _messageLogged[messageKey] = true;\r\n }\r\n }\r\n else {\r\n // Only log traces if the console Logging Level is >= the throwInternal severity level\r\n if (_loggingLevelConsole >= severity) {\r\n _self[logFunc](message[_DYN_MESSAGE /* @min:%2emessage */]);\r\n }\r\n }\r\n _logInternalMessage(severity, message);\r\n }\r\n else {\r\n _debugExtMsg(\"throw\" + (severity === 1 /* eLoggingSeverity.CRITICAL */ ? \"Critical\" : \"Warning\"), message);\r\n }\r\n }\r\n };\r\n _self.debugToConsole = function (message) {\r\n _logToConsole(\"debug\", message);\r\n _debugExtMsg(\"warning\", message);\r\n };\r\n _self[_DYN_WARN_TO_CONSOLE /* @min:%2ewarnToConsole */] = function (message) {\r\n _logToConsole(\"warn\", message);\r\n _debugExtMsg(\"warning\", message);\r\n };\r\n _self.errorToConsole = function (message) {\r\n _logToConsole(\"error\", message);\r\n _debugExtMsg(\"error\", message);\r\n };\r\n _self.resetInternalMessageCount = function () {\r\n _messageCount = 0;\r\n _messageLogged = {};\r\n };\r\n _self.logInternalMessage = _logInternalMessage;\r\n _self[_DYN_UNLOAD /* @min:%2eunload */] = function (isAsync) {\r\n _unloadHandler && _unloadHandler.rm();\r\n _unloadHandler = null;\r\n };\r\n function _logInternalMessage(severity, message) {\r\n if (_areInternalMessagesThrottled()) {\r\n return;\r\n }\r\n // check if this message type was already logged for this session and if so, don't log it again\r\n var logMessage = true;\r\n var messageKey = AIInternalMessagePrefix + message[_DYN_MESSAGE_ID /* @min:%2emessageId */];\r\n // if the session storage is not available, limit to only one message type per page view\r\n if (_messageLogged[messageKey]) {\r\n logMessage = false;\r\n }\r\n else {\r\n _messageLogged[messageKey] = true;\r\n }\r\n if (logMessage) {\r\n // Push the event in the internal queue\r\n if (severity <= _loggingLevelTelemetry) {\r\n _self.queue[_DYN_PUSH /* @min:%2epush */](message);\r\n _messageCount++;\r\n _debugExtMsg((severity === 1 /* eLoggingSeverity.CRITICAL */ ? \"error\" : \"warn\"), message);\r\n }\r\n // When throttle limit reached, send a special event\r\n if (_messageCount === _maxInternalMessageLimit) {\r\n var throttleLimitMessage = \"Internal events throttle limit per PageView reached for this app.\";\r\n var throttleMessage = new _InternalLogMessage(23 /* _eInternalMessageId.MessageLimitPerPVExceeded */, throttleLimitMessage, false);\r\n _self.queue[_DYN_PUSH /* @min:%2epush */](throttleMessage);\r\n if (severity === 1 /* eLoggingSeverity.CRITICAL */) {\r\n _self.errorToConsole(throttleLimitMessage);\r\n }\r\n else {\r\n _self[_DYN_WARN_TO_CONSOLE /* @min:%2ewarnToConsole */](throttleLimitMessage);\r\n }\r\n }\r\n }\r\n }\r\n function _setDefaultsFromConfig(config) {\r\n // make sure the config is dynamic\r\n return onConfigChange(createDynamicConfig(config, defaultValues, _self).cfg, function (details) {\r\n var config = details.cfg;\r\n _loggingLevelConsole = config[_DYN_LOGGING_LEVEL_CONSOL4 /* @min:%2eloggingLevelConsole */];\r\n _loggingLevelTelemetry = config.loggingLevelTelemetry;\r\n _maxInternalMessageLimit = config.maxMessageLimit;\r\n _enableDebug = config.enableDebug;\r\n });\r\n }\r\n function _areInternalMessagesThrottled() {\r\n return _messageCount >= _maxInternalMessageLimit;\r\n }\r\n function _debugExtMsg(name, data) {\r\n var dbgExt = getDebugExt(config || {});\r\n if (dbgExt && dbgExt[_DYN_DIAG_LOG /* @min:%2ediagLog */]) {\r\n dbgExt[_DYN_DIAG_LOG /* @min:%2ediagLog */](name, data);\r\n }\r\n }\r\n });\r\n }\r\n// Removed Stub for DiagnosticLogger.prototype.consoleLoggingLevel.\r\n// Removed Stub for DiagnosticLogger.prototype.throwInternal.\r\n// Removed Stub for DiagnosticLogger.prototype.debugToConsole.\r\n// Removed Stub for DiagnosticLogger.prototype.warnToConsole.\r\n// Removed Stub for DiagnosticLogger.prototype.errorToConsole.\r\n// Removed Stub for DiagnosticLogger.prototype.resetInternalMessageCount.\r\n// Removed Stub for DiagnosticLogger.prototype.logInternalMessage.\r\n// Removed Stub for DiagnosticLogger.prototype.unload.\r\n // This is a workaround for an IE bug when using dynamicProto() with classes that don't have any\n // non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.\n DiagnosticLogger.__ieDyn=1;\n\n return DiagnosticLogger;\r\n}());\r\nexport { DiagnosticLogger };\r\nfunction _getLogger(logger) {\r\n return (logger || new DiagnosticLogger());\r\n}\r\n/**\r\n * This is a helper method which will call throwInternal on the passed logger, will throw exceptions in\r\n * debug mode or attempt to log the error as a console warning. This helper is provided mostly to better\r\n * support minification as logger.throwInternal() will not compress the publish \"throwInternal\" used throughout\r\n * the code.\r\n * @param logger - The Diagnostic Logger instance to use.\r\n * @param severity - The severity of the log message\r\n * @param message - The log message.\r\n */\r\nexport function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {\r\n if (isUserAct === void 0) { isUserAct = false; }\r\n _getLogger(logger)[_DYN_THROW_INTERNAL /* @min:%2ethrowInternal */](severity, msgId, msg, properties, isUserAct);\r\n}\r\n/**\r\n * This is a helper method which will call warnToConsole on the passed logger with the provided message.\r\n * @param logger - The Diagnostic Logger instance to use.\r\n * @param message - The log message.\r\n */\r\nexport function _warnToConsole(logger, message) {\r\n _getLogger(logger)[_DYN_WARN_TO_CONSOLE /* @min:%2ewarnToConsole */](message);\r\n}\r\n/**\r\n * Logs a message to the internal queue.\r\n * @param logger - The Diagnostic Logger instance to use.\r\n * @param severity - The severity of the log message\r\n * @param message - The message to log.\r\n */\r\nexport function _logInternalMessage(logger, severity, message) {\r\n _getLogger(logger).logInternalMessage(severity, message);\r\n}\r\n//# sourceMappingURL=DiagnosticLogger.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.3.6\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\nvar _a, _b;\r\nimport { arrForEach, arrIndexOf, dumpObj, getDocument, getLazy, getNavigator, isArray, isFunction, isNullOrUndefined, isString, isTruthy, isUndefined, objForEachKey, strEndsWith, strIndexOf, strLeft, strSubstring, strTrim, utcNow } from \"@nevware21/ts-utils\";\r\nimport { cfgDfMerge } from \"../Config/ConfigDefaultHelpers\";\r\nimport { createDynamicConfig, onConfigChange } from \"../Config/DynamicConfig\";\r\nimport { _DYN_ENABLED, _DYN_LENGTH, _DYN_LOGGER, _DYN_SPLIT, _DYN_USER_AGENT } from \"../__DynamicConstants\";\r\nimport { _throwInternal } from \"./DiagnosticLogger\";\r\nimport { getLocation, isIE } from \"./EnvUtils\";\r\nimport { getExceptionName, isNotNullOrUndefined, setValue, strContains } from \"./HelperFuncs\";\r\nimport { STR_DOMAIN, STR_EMPTY, STR_PATH, UNDEFINED_VALUE } from \"./InternalConstants\";\r\nvar strToGMTString = \"toGMTString\";\r\nvar strToUTCString = \"toUTCString\";\r\nvar strCookie = \"cookie\";\r\nvar strExpires = \"expires\";\r\nvar strIsCookieUseDisabled = \"isCookieUseDisabled\";\r\nvar strDisableCookiesUsage = \"disableCookiesUsage\";\r\nvar strConfigCookieMgr = \"_ckMgr\";\r\nvar _supportsCookies = null;\r\nvar _allowUaSameSite = null;\r\nvar _parsedCookieValue = null;\r\nvar _doc;\r\nvar _cookieCache = {};\r\nvar _globalCookieConfig = {};\r\n// // `isCookieUseDisabled` is deprecated, so explicitly casting as a key of IConfiguration to avoid typing error\r\n// // when both isCookieUseDisabled and disableCookiesUsage are used disableCookiesUsage will take precedent, which is\r\n// // why its listed first\r\n/**\r\n * Set the supported dynamic config values as undefined (or an empty object) so that\r\n * any listeners will be informed of any changes.\r\n * Explicitly NOT including the deprecated `isCookieUseDisabled` as we don't want to support\r\n * the v1 deprecated field as dynamic for updates\r\n */\r\nvar rootDefaultConfig = (_a = {\r\n cookieCfg: cfgDfMerge((_b = {},\r\n _b[STR_DOMAIN] = { fb: \"cookieDomain\", dfVal: isNotNullOrUndefined },\r\n _b.path = { fb: \"cookiePath\", dfVal: isNotNullOrUndefined },\r\n _b.enabled = UNDEFINED_VALUE,\r\n _b.ignoreCookies = UNDEFINED_VALUE,\r\n _b.blockedCookies = UNDEFINED_VALUE,\r\n _b)),\r\n cookieDomain: UNDEFINED_VALUE,\r\n cookiePath: UNDEFINED_VALUE\r\n },\r\n _a[strDisableCookiesUsage] = UNDEFINED_VALUE,\r\n _a);\r\nfunction _getDoc() {\r\n !_doc && (_doc = getLazy(function () { return getDocument(); }));\r\n}\r\n/**\r\n * @ignore\r\n * DO NOT USE or export from the module, this is exposed as public to support backward compatibility of previous static utility methods only.\r\n * If you want to manager cookies either use the ICookieMgr available from the core instance via getCookieMgr() or create\r\n * your own instance of the CookieMgr and use that.\r\n * Using this directly for enabling / disabling cookie handling will not only affect your usage but EVERY user of cookies.\r\n * Example, if you are using a shared component that is also using Application Insights you will affect their cookie handling.\r\n * @param logger - The DiagnosticLogger to use for reporting errors.\r\n */\r\nfunction _gblCookieMgr(config, logger) {\r\n // Stash the global instance against the BaseCookieMgr class\r\n var inst = createCookieMgr[strConfigCookieMgr] || _globalCookieConfig[strConfigCookieMgr];\r\n if (!inst) {\r\n // Note: not using the getSetValue() helper as that would require always creating a temporary cookieMgr\r\n // that ultimately is never used\r\n inst = createCookieMgr[strConfigCookieMgr] = createCookieMgr(config, logger);\r\n _globalCookieConfig[strConfigCookieMgr] = inst;\r\n }\r\n return inst;\r\n}\r\nfunction _isMgrEnabled(cookieMgr) {\r\n if (cookieMgr) {\r\n return cookieMgr.isEnabled();\r\n }\r\n return true;\r\n}\r\nfunction _isIgnoredCookie(cookieMgrCfg, name) {\r\n if (name && cookieMgrCfg && isArray(cookieMgrCfg.ignoreCookies)) {\r\n return arrIndexOf(cookieMgrCfg.ignoreCookies, name) !== -1;\r\n }\r\n return false;\r\n}\r\nfunction _isBlockedCookie(cookieMgrCfg, name) {\r\n if (name && cookieMgrCfg && isArray(cookieMgrCfg.blockedCookies)) {\r\n if (arrIndexOf(cookieMgrCfg.blockedCookies, name) !== -1) {\r\n return true;\r\n }\r\n }\r\n return _isIgnoredCookie(cookieMgrCfg, name);\r\n}\r\nfunction _isCfgEnabled(rootConfig, cookieMgrConfig) {\r\n var isCfgEnabled = cookieMgrConfig[_DYN_ENABLED /* @min:%2eenabled */];\r\n if (isNullOrUndefined(isCfgEnabled)) {\r\n // Set the enabled from the provided setting or the legacy root values\r\n var cookieEnabled = void 0;\r\n // This field is deprecated and dynamic updates will not be fully supported\r\n if (!isUndefined(rootConfig[strIsCookieUseDisabled])) {\r\n cookieEnabled = !rootConfig[strIsCookieUseDisabled];\r\n }\r\n // If this value is defined it takes precedent over the above\r\n if (!isUndefined(rootConfig[strDisableCookiesUsage])) {\r\n cookieEnabled = !rootConfig[strDisableCookiesUsage];\r\n }\r\n // Not setting the cookieMgrConfig.enabled as that will update (set) the global dynamic config\r\n // So future \"updates\" then may not be as expected\r\n isCfgEnabled = cookieEnabled;\r\n }\r\n return isCfgEnabled;\r\n}\r\n/**\r\n * Helper to return the ICookieMgr from the core (if not null/undefined) or a default implementation\r\n * associated with the configuration or a legacy default.\r\n * @param core - The AppInsightsCore instance to get the cookie manager from\r\n * @param config - The config to use if the core is not available\r\n * @returns\r\n */\r\nexport function safeGetCookieMgr(core, config) {\r\n var cookieMgr;\r\n if (core) {\r\n // Always returns an instance\r\n cookieMgr = core.getCookieMgr();\r\n }\r\n else if (config) {\r\n var cookieCfg = config.cookieCfg;\r\n if (cookieCfg && cookieCfg[strConfigCookieMgr]) {\r\n cookieMgr = cookieCfg[strConfigCookieMgr];\r\n }\r\n else {\r\n cookieMgr = createCookieMgr(config);\r\n }\r\n }\r\n if (!cookieMgr) {\r\n // Get or initialize the default global (legacy) cookie manager if we couldn't find one\r\n cookieMgr = _gblCookieMgr(config, (core || {})[_DYN_LOGGER /* @min:%2elogger */]);\r\n }\r\n return cookieMgr;\r\n}\r\nexport function createCookieMgr(rootConfig, logger) {\r\n var cookieMgrConfig;\r\n var _path;\r\n var _domain;\r\n var unloadHandler;\r\n // Explicitly checking against false, so that setting to undefined will === true\r\n var _enabled;\r\n var _getCookieFn;\r\n var _setCookieFn;\r\n var _delCookieFn;\r\n // Make sure the root config is dynamic as it may be the global config\r\n rootConfig = createDynamicConfig(rootConfig || _globalCookieConfig, null, logger).cfg;\r\n // Will get recalled if the referenced configuration is changed\r\n unloadHandler = onConfigChange(rootConfig, function (details) {\r\n // Make sure the root config has all of the the defaults to the root config to ensure they are dynamic\r\n details.setDf(details.cfg, rootDefaultConfig);\r\n // Create and apply the defaults to the cookieCfg element\r\n cookieMgrConfig = details.ref(details.cfg, \"cookieCfg\"); // details.setDf(details.cfg.cookieCfg, defaultConfig);\r\n _path = cookieMgrConfig[STR_PATH /* @min:%2epath */] || \"/\";\r\n _domain = cookieMgrConfig[STR_DOMAIN /* @min:%2edomain */];\r\n // Explicitly checking against false, so that setting to undefined will === true\r\n _enabled = _isCfgEnabled(rootConfig, cookieMgrConfig) !== false;\r\n _getCookieFn = cookieMgrConfig.getCookie || _getCookieValue;\r\n _setCookieFn = cookieMgrConfig.setCookie || _setCookieValue;\r\n _delCookieFn = cookieMgrConfig.delCookie || _setCookieValue;\r\n }, logger);\r\n var cookieMgr = {\r\n isEnabled: function () {\r\n var enabled = _isCfgEnabled(rootConfig, cookieMgrConfig) !== false && _enabled && areCookiesSupported(logger);\r\n // Using an indirect lookup for any global cookie manager to support tree shaking for SDK's\r\n // that don't use the \"applicationinsights-core\" version of the default cookie function\r\n var gblManager = _globalCookieConfig[strConfigCookieMgr];\r\n if (enabled && gblManager && cookieMgr !== gblManager) {\r\n // Make sure the GlobalCookie Manager instance (if not this instance) is also enabled.\r\n // As the global (deprecated) functions may have been called (for backward compatibility)\r\n enabled = _isMgrEnabled(gblManager);\r\n }\r\n return enabled;\r\n },\r\n setEnabled: function (value) {\r\n // Explicitly checking against false, so that setting to undefined will === true\r\n _enabled = value !== false;\r\n cookieMgrConfig[_DYN_ENABLED /* @min:%2eenabled */] = value;\r\n },\r\n set: function (name, value, maxAgeSec, domain, path) {\r\n var result = false;\r\n if (_isMgrEnabled(cookieMgr) && !_isBlockedCookie(cookieMgrConfig, name)) {\r\n var values = {};\r\n var theValue = strTrim(value || STR_EMPTY);\r\n var idx = strIndexOf(theValue, \";\");\r\n if (idx !== -1) {\r\n theValue = strTrim(strLeft(value, idx));\r\n values = _extractParts(strSubstring(value, idx + 1));\r\n }\r\n // Only update domain if not already present (isUndefined) and the value is truthy (not null, undefined or empty string)\r\n setValue(values, STR_DOMAIN, domain || _domain, isTruthy, isUndefined);\r\n if (!isNullOrUndefined(maxAgeSec)) {\r\n var _isIE = isIE();\r\n if (isUndefined(values[strExpires])) {\r\n var nowMs = utcNow();\r\n // Only add expires if not already present\r\n var expireMs = nowMs + (maxAgeSec * 1000);\r\n // Sanity check, if zero or -ve then ignore\r\n if (expireMs > 0) {\r\n var expiry = new Date();\r\n expiry.setTime(expireMs);\r\n setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || STR_EMPTY, isTruthy);\r\n }\r\n }\r\n if (!_isIE) {\r\n // Only replace if not already present\r\n setValue(values, \"max-age\", STR_EMPTY + maxAgeSec, null, isUndefined);\r\n }\r\n }\r\n var location_1 = getLocation();\r\n if (location_1 && location_1.protocol === \"https:\") {\r\n setValue(values, \"secure\", null, null, isUndefined);\r\n // Only set same site if not also secure\r\n if (_allowUaSameSite === null) {\r\n _allowUaSameSite = !uaDisallowsSameSiteNone((getNavigator() || {})[_DYN_USER_AGENT /* @min:%2euserAgent */]);\r\n }\r\n if (_allowUaSameSite) {\r\n setValue(values, \"SameSite\", \"None\", null, isUndefined);\r\n }\r\n }\r\n setValue(values, STR_PATH, path || _path, null, isUndefined);\r\n //let setCookieFn = cookieMgrConfig.setCookie || _setCookieValue;\r\n _setCookieFn(name, _formatCookieValue(theValue, values));\r\n result = true;\r\n }\r\n return result;\r\n },\r\n get: function (name) {\r\n var value = STR_EMPTY;\r\n if (_isMgrEnabled(cookieMgr) && !_isIgnoredCookie(cookieMgrConfig, name)) {\r\n value = _getCookieFn(name);\r\n }\r\n return value;\r\n },\r\n del: function (name, path) {\r\n var result = false;\r\n if (_isMgrEnabled(cookieMgr)) {\r\n // Only remove the cookie if the manager and cookie support has not been disabled\r\n result = cookieMgr.purge(name, path);\r\n }\r\n return result;\r\n },\r\n purge: function (name, path) {\r\n var _a;\r\n var result = false;\r\n if (areCookiesSupported(logger)) {\r\n // Setting the expiration date in the past immediately removes the cookie\r\n var values = (_a = {},\r\n _a[STR_PATH] = path ? path : \"/\",\r\n _a[strExpires] = \"Thu, 01 Jan 1970 00:00:01 GMT\",\r\n _a);\r\n if (!isIE()) {\r\n // Set max age to expire now\r\n values[\"max-age\"] = \"0\";\r\n }\r\n // let delCookie = cookieMgrConfig.delCookie || _setCookieValue;\r\n _delCookieFn(name, _formatCookieValue(STR_EMPTY, values));\r\n result = true;\r\n }\r\n return result;\r\n },\r\n unload: function (isAsync) {\r\n unloadHandler && unloadHandler.rm();\r\n unloadHandler = null;\r\n }\r\n };\r\n // Associated this cookie manager with the config\r\n cookieMgr[strConfigCookieMgr] = cookieMgr;\r\n return cookieMgr;\r\n}\r\n/*\r\n* Helper method to tell if document.cookie object is supported by the runtime\r\n*/\r\nexport function areCookiesSupported(logger) {\r\n if (_supportsCookies === null) {\r\n _supportsCookies = false;\r\n !_doc && _getDoc();\r\n try {\r\n var doc = _doc.v || {};\r\n _supportsCookies = doc[strCookie] !== undefined;\r\n }\r\n catch (e) {\r\n _throwInternal(logger, 2 /* eLoggingSeverity.WARNING */, 68 /* _eInternalMessageId.CannotAccessCookie */, \"Cannot access document.cookie - \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n }\r\n return _supportsCookies;\r\n}\r\nfunction _extractParts(theValue) {\r\n var values = {};\r\n if (theValue && theValue[_DYN_LENGTH /* @min:%2elength */]) {\r\n var parts = strTrim(theValue)[_DYN_SPLIT /* @min:%2esplit */](\";\");\r\n arrForEach(parts, function (thePart) {\r\n thePart = strTrim(thePart || STR_EMPTY);\r\n if (thePart) {\r\n var idx = strIndexOf(thePart, \"=\");\r\n if (idx === -1) {\r\n values[thePart] = null;\r\n }\r\n else {\r\n values[strTrim(strLeft(thePart, idx))] = strTrim(strSubstring(thePart, idx + 1));\r\n }\r\n }\r\n });\r\n }\r\n return values;\r\n}\r\nfunction _formatDate(theDate, func) {\r\n if (isFunction(theDate[func])) {\r\n return theDate[func]();\r\n }\r\n return null;\r\n}\r\nfunction _formatCookieValue(value, values) {\r\n var cookieValue = value || STR_EMPTY;\r\n objForEachKey(values, function (name, theValue) {\r\n cookieValue += \"; \" + name + (!isNullOrUndefined(theValue) ? \"=\" + theValue : STR_EMPTY);\r\n });\r\n return cookieValue;\r\n}\r\nfunction _getCookieValue(name) {\r\n var cookieValue = STR_EMPTY;\r\n !_doc && _getDoc();\r\n if (_doc.v) {\r\n var theCookie = _doc.v[strCookie] || STR_EMPTY;\r\n if (_parsedCookieValue !== theCookie) {\r\n _cookieCache = _extractParts(theCookie);\r\n _parsedCookieValue = theCookie;\r\n }\r\n cookieValue = strTrim(_cookieCache[name] || STR_EMPTY);\r\n }\r\n return cookieValue;\r\n}\r\nfunction _setCookieValue(name, cookieValue) {\r\n !_doc && _getDoc();\r\n if (_doc.v) {\r\n _doc.v[strCookie] = name + \"=\" + cookieValue;\r\n }\r\n}\r\nexport function uaDisallowsSameSiteNone(userAgent) {\r\n if (!isString(userAgent)) {\r\n return false;\r\n }\r\n // Cover all iOS based browsers here. This includes:\r\n // - Safari on iOS 12 for iPhone, iPod Touch, iPad\r\n // - WkWebview on iOS 12 for iPhone, iPod Touch, iPad\r\n // - Chrome on iOS 12 for iPhone, iPod Touch, iPad\r\n // All of which are broken by SameSite=None, because they use the iOS networking stack\r\n if (strContains(userAgent, \"CPU iPhone OS 12\") || strContains(userAgent, \"iPad; CPU OS 12\")) {\r\n return true;\r\n }\r\n // Cover Mac OS X based browsers that use the Mac OS networking stack. This includes:\r\n // - Safari on Mac OS X\r\n // This does not include:\r\n // - Internal browser on Mac OS X\r\n // - Chrome on Mac OS X\r\n // - Chromium on Mac OS X\r\n // Because they do not use the Mac OS networking stack.\r\n if (strContains(userAgent, \"Macintosh; Intel Mac OS X 10_14\") && strContains(userAgent, \"Version/\") && strContains(userAgent, \"Safari\")) {\r\n return true;\r\n }\r\n // Cover Mac OS X internal browsers that use the Mac OS networking stack. This includes:\r\n // - Internal browser on Mac OS X\r\n // This does not include:\r\n // - Safari on Mac OS X\r\n // - Chrome on Mac OS X\r\n // - Chromium on Mac OS X\r\n // Because they do not use the Mac OS networking stack.\r\n if (strContains(userAgent, \"Macintosh; Intel Mac OS X 10_14\") && strEndsWith(userAgent, \"AppleWebKit/605.1.15 (KHTML, like Gecko)\")) {\r\n return true;\r\n }\r\n // Cover Chrome 50-69, because some versions are broken by SameSite=None, and none in this range require it.\r\n // Note: this covers some pre-Chromium Edge versions, but pre-Chromim Edge does not require SameSite=None, so this is fine.\r\n // Note: this regex applies to Windows, Mac OS X, and Linux, deliberately.\r\n if (strContains(userAgent, \"Chrome/5\") || strContains(userAgent, \"Chrome/6\")) {\r\n return true;\r\n }\r\n // Unreal Engine runs Chromium 59, but does not advertise as Chrome until 4.23. Treat versions of Unreal\r\n // that don't specify their Chrome version as lacking support for SameSite=None.\r\n if (strContains(userAgent, \"UnrealEngine\") && !strContains(userAgent, \"Chrome\")) {\r\n return true;\r\n }\r\n // UCBrowser < 12.13.2 ignores Set-Cookie headers with SameSite=None\r\n // NB: this rule isn't complete - you need regex to make a complete rule.\r\n // See: https://www.chromium.org/updates/same-site/incompatible-clients\r\n if (strContains(userAgent, \"UCBrowser/12\") || strContains(userAgent, \"UCBrowser/11\")) {\r\n return true;\r\n }\r\n return false;\r\n}\r\n//# sourceMappingURL=CookieMgr.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.3.6\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { isArray, isFunction, objDefine, utcNow } from \"@nevware21/ts-utils\";\r\nimport { _DYN_GET_CTX, _DYN_IS_CHILD_EVT, _DYN_LENGTH, _DYN_NAME, _DYN_PUSH, _DYN_SET_CTX } from \"../__DynamicConstants\";\r\nimport { STR_GET_PERF_MGR, STR_PERF_EVENT } from \"./InternalConstants\";\r\nvar strExecutionContextKey = \"ctx\";\r\nvar strParentContextKey = \"ParentContextKey\";\r\nvar strChildrenContextKey = \"ChildrenContextKey\";\r\nvar _defaultPerfManager = null;\r\nvar PerfEvent = /** @class */ (function () {\r\n function PerfEvent(name, payloadDetails, isAsync) {\r\n var _self = this;\r\n _self.start = utcNow();\r\n _self[_DYN_NAME /* @min:%2ename */] = name;\r\n _self.isAsync = isAsync;\r\n _self[_DYN_IS_CHILD_EVT /* @min:%2eisChildEvt */] = function () { return false; };\r\n if (isFunction(payloadDetails)) {\r\n // Create an accessor to minimize the potential performance impact of executing the payloadDetails callback\r\n var theDetails_1;\r\n objDefine(_self, \"payload\", {\r\n g: function () {\r\n // Delay the execution of the payloadDetails until needed\r\n if (!theDetails_1 && isFunction(payloadDetails)) {\r\n theDetails_1 = payloadDetails();\r\n // clear it out now so the referenced objects can be garbage collected\r\n payloadDetails = null;\r\n }\r\n return theDetails_1;\r\n }\r\n });\r\n }\r\n _self[_DYN_GET_CTX /* @min:%2egetCtx */] = function (key) {\r\n if (key) {\r\n // The parent and child links are located directly on the object (for better viewing in the DebugPlugin)\r\n if (key === PerfEvent[strParentContextKey] || key === PerfEvent[strChildrenContextKey]) {\r\n return _self[key];\r\n }\r\n return (_self[strExecutionContextKey] || {})[key];\r\n }\r\n return null;\r\n };\r\n _self[_DYN_SET_CTX /* @min:%2esetCtx */] = function (key, value) {\r\n if (key) {\r\n // Put the parent and child links directly on the object (for better viewing in the DebugPlugin)\r\n if (key === PerfEvent[strParentContextKey]) {\r\n // Simple assumption, if we are setting a parent then we must be a child\r\n if (!_self[key]) {\r\n _self[_DYN_IS_CHILD_EVT /* @min:%2eisChildEvt */] = function () { return true; };\r\n }\r\n _self[key] = value;\r\n }\r\n else if (key === PerfEvent[strChildrenContextKey]) {\r\n _self[key] = value;\r\n }\r\n else {\r\n var ctx = _self[strExecutionContextKey] = _self[strExecutionContextKey] || {};\r\n ctx[key] = value;\r\n }\r\n }\r\n };\r\n _self.complete = function () {\r\n var childTime = 0;\r\n var childEvts = _self[_DYN_GET_CTX /* @min:%2egetCtx */](PerfEvent[strChildrenContextKey]);\r\n if (isArray(childEvts)) {\r\n for (var lp = 0; lp < childEvts[_DYN_LENGTH /* @min:%2elength */]; lp++) {\r\n var childEvt = childEvts[lp];\r\n if (childEvt) {\r\n childTime += childEvt.time;\r\n }\r\n }\r\n }\r\n _self.time = utcNow() - _self.start;\r\n _self.exTime = _self.time - childTime;\r\n _self.complete = function () { };\r\n };\r\n }\r\n PerfEvent.ParentContextKey = \"parent\";\r\n PerfEvent.ChildrenContextKey = \"childEvts\";\r\n return PerfEvent;\r\n}());\r\nexport { PerfEvent };\r\nvar PerfManager = /** @class */ (function () {\r\n function PerfManager(manager) {\r\n /**\r\n * General bucket used for execution context set and retrieved via setCtx() and getCtx.\r\n * Defined as private so it can be visualized via the DebugPlugin\r\n */\r\n this.ctx = {};\r\n dynamicProto(PerfManager, this, function (_self) {\r\n _self.create = function (src, payloadDetails, isAsync) {\r\n // TODO (@MSNev): at some point we will want to add additional configuration to \"select\" which events to instrument\r\n // for now this is just a simple do everything.\r\n return new PerfEvent(src, payloadDetails, isAsync);\r\n };\r\n _self.fire = function (perfEvent) {\r\n if (perfEvent) {\r\n perfEvent.complete();\r\n if (manager && isFunction(manager[STR_PERF_EVENT /* @min:%2eperfEvent */])) {\r\n manager[STR_PERF_EVENT /* @min:%2eperfEvent */](perfEvent);\r\n }\r\n }\r\n };\r\n _self[_DYN_SET_CTX /* @min:%2esetCtx */] = function (key, value) {\r\n if (key) {\r\n var ctx = _self[strExecutionContextKey] = _self[strExecutionContextKey] || {};\r\n ctx[key] = value;\r\n }\r\n };\r\n _self[_DYN_GET_CTX /* @min:%2egetCtx */] = function (key) {\r\n return (_self[strExecutionContextKey] || {})[key];\r\n };\r\n });\r\n }\r\n// Removed Stub for PerfManager.prototype.create.\r\n// Removed Stub for PerfManager.prototype.fire.\r\n// Removed Stub for PerfManager.prototype.setCtx.\r\n// Removed Stub for PerfManager.prototype.getCtx.\r\n // This is a workaround for an IE bug when using dynamicProto() with classes that don't have any\n // non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.\n PerfManager.__ieDyn=1;\n\n return PerfManager;\r\n}());\r\nexport { PerfManager };\r\nvar doPerfActiveKey = \"CoreUtils.doPerf\";\r\n/**\r\n * Helper function to wrap a function with a perf event\r\n * @param mgrSource - The Performance Manager or a Performance provider source (may be null)\r\n * @param getSource - The callback to create the source name for the event (if perf monitoring is enabled)\r\n * @param func - The function to call and measure\r\n * @param details - A function to return the payload details\r\n * @param isAsync - Is the event / function being call asynchronously or synchronously\r\n */\r\nexport function doPerf(mgrSource, getSource, func, details, isAsync) {\r\n if (mgrSource) {\r\n var perfMgr = mgrSource;\r\n if (perfMgr[STR_GET_PERF_MGR]) {\r\n // Looks like a perf manager provider object\r\n perfMgr = perfMgr[STR_GET_PERF_MGR]();\r\n }\r\n if (perfMgr) {\r\n var perfEvt = void 0;\r\n var currentActive = perfMgr[_DYN_GET_CTX /* @min:%2egetCtx */](doPerfActiveKey);\r\n try {\r\n perfEvt = perfMgr.create(getSource(), details, isAsync);\r\n if (perfEvt) {\r\n if (currentActive && perfEvt[_DYN_SET_CTX /* @min:%2esetCtx */]) {\r\n perfEvt[_DYN_SET_CTX /* @min:%2esetCtx */](PerfEvent[strParentContextKey], currentActive);\r\n if (currentActive[_DYN_GET_CTX /* @min:%2egetCtx */] && currentActive[_DYN_SET_CTX /* @min:%2esetCtx */]) {\r\n var children = currentActive[_DYN_GET_CTX /* @min:%2egetCtx */](PerfEvent[strChildrenContextKey]);\r\n if (!children) {\r\n children = [];\r\n currentActive[_DYN_SET_CTX /* @min:%2esetCtx */](PerfEvent[strChildrenContextKey], children);\r\n }\r\n children[_DYN_PUSH /* @min:%2epush */](perfEvt);\r\n }\r\n }\r\n // Set this event as the active event now\r\n perfMgr[_DYN_SET_CTX /* @min:%2esetCtx */](doPerfActiveKey, perfEvt);\r\n return func(perfEvt);\r\n }\r\n }\r\n catch (ex) {\r\n if (perfEvt && perfEvt[_DYN_SET_CTX /* @min:%2esetCtx */]) {\r\n perfEvt[_DYN_SET_CTX /* @min:%2esetCtx */](\"exception\", ex);\r\n }\r\n }\r\n finally {\r\n // fire the perf event\r\n if (perfEvt) {\r\n perfMgr.fire(perfEvt);\r\n }\r\n // Reset the active event to the previous value\r\n perfMgr[_DYN_SET_CTX /* @min:%2esetCtx */](doPerfActiveKey, currentActive);\r\n }\r\n }\r\n }\r\n return func();\r\n}\r\n/**\r\n * Set the global performance manager to use when there is no core instance or it has not been initialized yet.\r\n * @param perfManager - The IPerfManager instance to use when no performance manager is supplied.\r\n */\r\nexport function setGblPerfMgr(perfManager) {\r\n _defaultPerfManager = perfManager;\r\n}\r\n/**\r\n * Get the current global performance manager that will be used with no performance manager is supplied.\r\n * @returns - The current default manager\r\n */\r\nexport function getGblPerfMgr() {\r\n return _defaultPerfManager;\r\n}\r\n//# sourceMappingURL=PerfManager.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.3.6\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\n\"use strict\";\r\nimport { arrForEach, isFunction } from \"@nevware21/ts-utils\";\r\nimport { _DYN_GET_NEXT, _DYN_GET_PLUGIN, _DYN_INITIALIZE, _DYN_IS_INITIALIZED, _DYN_LENGTH, _DYN_NAME, _DYN_PUSH, _DYN_SET_NEXT_PLUGIN, _DYN_TEARDOWN, _DYN_TRACE_FLAGS, _DYN__DO_TEARDOWN } from \"../__DynamicConstants\";\r\nimport { createElmNodeData } from \"./DataCacheHelper\";\r\nimport { STR_CORE, STR_PRIORITY, STR_PROCESS_TELEMETRY } from \"./InternalConstants\";\r\nimport { isValidSpanId, isValidTraceId } from \"./W3cTraceParent\";\r\nvar pluginStateData = createElmNodeData(\"plugin\");\r\nexport function _getPluginState(plugin) {\r\n return pluginStateData.get(plugin, \"state\", {}, true);\r\n}\r\n/**\r\n * Initialize the queue of plugins\r\n * @param plugins - The array of plugins to initialize and setting of the next plugin\r\n * @param config - The current config for the instance\r\n * @param core - THe current core instance\r\n * @param extensions - The extensions\r\n */\r\nexport function initializePlugins(processContext, extensions) {\r\n // Set the next plugin and identified the uninitialized plugins\r\n var initPlugins = [];\r\n var lastPlugin = null;\r\n var proxy = processContext[_DYN_GET_NEXT /* @min:%2egetNext */]();\r\n var pluginState;\r\n while (proxy) {\r\n var thePlugin = proxy[_DYN_GET_PLUGIN /* @min:%2egetPlugin */]();\r\n if (thePlugin) {\r\n if (lastPlugin && lastPlugin[_DYN_SET_NEXT_PLUGIN /* @min:%2esetNextPlugin */] && thePlugin[STR_PROCESS_TELEMETRY /* @min:%2eprocessTelemetry */]) {\r\n // Set this plugin as the next for the previous one\r\n lastPlugin[_DYN_SET_NEXT_PLUGIN /* @min:%2esetNextPlugin */](thePlugin);\r\n }\r\n pluginState = _getPluginState(thePlugin);\r\n var isInitialized = !!pluginState[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */];\r\n if (thePlugin[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */]) {\r\n isInitialized = thePlugin[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */]();\r\n }\r\n if (!isInitialized) {\r\n initPlugins[_DYN_PUSH /* @min:%2epush */](thePlugin);\r\n }\r\n lastPlugin = thePlugin;\r\n proxy = proxy[_DYN_GET_NEXT /* @min:%2egetNext */]();\r\n }\r\n }\r\n // Now initialize the plugins\r\n arrForEach(initPlugins, function (thePlugin) {\r\n var core = processContext[STR_CORE /* @min:%2ecore */]();\r\n thePlugin[_DYN_INITIALIZE /* @min:%2einitialize */](processContext.getCfg(), core, extensions, processContext[_DYN_GET_NEXT /* @min:%2egetNext */]());\r\n pluginState = _getPluginState(thePlugin);\r\n // Only add the core to the state if the plugin didn't set it (doesn't extend from BaseTelemetryPlugin)\r\n if (!thePlugin[STR_CORE] && !pluginState[STR_CORE]) {\r\n pluginState[STR_CORE] = core;\r\n }\r\n pluginState[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */] = true;\r\n delete pluginState[_DYN_TEARDOWN /* @min:%2eteardown */];\r\n });\r\n}\r\nexport function sortPlugins(plugins) {\r\n // Sort by priority\r\n return plugins.sort(function (extA, extB) {\r\n var result = 0;\r\n if (extB) {\r\n var bHasProcess = extB[STR_PROCESS_TELEMETRY];\r\n if (extA[STR_PROCESS_TELEMETRY]) {\r\n result = bHasProcess ? extA[STR_PRIORITY] - extB[STR_PRIORITY] : 1;\r\n }\r\n else if (bHasProcess) {\r\n result = -1;\r\n }\r\n }\r\n else {\r\n result = extA ? 1 : -1;\r\n }\r\n return result;\r\n });\r\n // sort complete\r\n}\r\n/**\r\n * Teardown / Unload helper to perform teardown/unloading operations for the provided components synchronously or asynchronously, this will call any\r\n * _doTeardown() or _doUnload() functions on the provided components to allow them to finish removal.\r\n * @param components - The components you want to unload\r\n * @param unloadCtx - This is the context that should be used during unloading.\r\n * @param unloadState - The details / state of the unload process, it holds details like whether it should be unloaded synchronously or asynchronously and the reason for the unload.\r\n * @param asyncCallback - An optional callback that the plugin must call if it returns true to inform the caller that it has completed any async unload/teardown operations.\r\n * @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.\r\n */\r\nexport function unloadComponents(components, unloadCtx, unloadState, asyncCallback) {\r\n var idx = 0;\r\n function _doUnload() {\r\n while (idx < components[_DYN_LENGTH /* @min:%2elength */]) {\r\n var component = components[idx++];\r\n if (component) {\r\n var func = component._doUnload || component[_DYN__DO_TEARDOWN /* @min:%2e_doTeardown */];\r\n if (isFunction(func)) {\r\n if (func.call(component, unloadCtx, unloadState, _doUnload) === true) {\r\n return true;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return _doUnload();\r\n}\r\n/**\r\n * Creates a IDistributedTraceContext which optionally also \"sets\" the value on a parent\r\n * @param parentCtx - An optional parent distributed trace instance\r\n * @returns A new IDistributedTraceContext instance that uses an internal temporary object\r\n */\r\nexport function createDistributedTraceContext(parentCtx) {\r\n var trace = {};\r\n return {\r\n getName: function () {\r\n return trace[_DYN_NAME /* @min:%2ename */];\r\n },\r\n setName: function (newValue) {\r\n parentCtx && parentCtx.setName(newValue);\r\n trace[_DYN_NAME /* @min:%2ename */] = newValue;\r\n },\r\n getTraceId: function () {\r\n return trace.traceId;\r\n },\r\n setTraceId: function (newValue) {\r\n parentCtx && parentCtx.setTraceId(newValue);\r\n if (isValidTraceId(newValue)) {\r\n trace.traceId = newValue;\r\n }\r\n },\r\n getSpanId: function () {\r\n return trace.spanId;\r\n },\r\n setSpanId: function (newValue) {\r\n parentCtx && parentCtx.setSpanId(newValue);\r\n if (isValidSpanId(newValue)) {\r\n trace.spanId = newValue;\r\n }\r\n },\r\n getTraceFlags: function () {\r\n return trace[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */];\r\n },\r\n setTraceFlags: function (newTraceFlags) {\r\n parentCtx && parentCtx.setTraceFlags(newTraceFlags);\r\n trace[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */] = newTraceFlags;\r\n }\r\n };\r\n}\r\n//# sourceMappingURL=TelemetryHelpers.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.3.6\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\n\"use strict\";\r\nimport { arrForEach, dumpObj, isArray, isFunction, isNullOrUndefined, isUndefined, objForEachKey, objFreeze, objKeys } from \"@nevware21/ts-utils\";\r\nimport { _applyDefaultValue } from \"../Config/ConfigDefaults\";\r\nimport { createDynamicConfig } from \"../Config/DynamicConfig\";\r\nimport { _DYN_CREATE_NEW, _DYN_DIAG_LOG, _DYN_GET_NEXT, _DYN_GET_PLUGIN, _DYN_IDENTIFIER, _DYN_IS_INITIALIZED, _DYN_LENGTH, _DYN_LOGGER, _DYN_PROCESS_NEXT, _DYN_PUSH, _DYN_SET_NEXT_PLUGIN, _DYN_TEARDOWN, _DYN_UNLOAD, _DYN_UPDATE } from \"../__DynamicConstants\";\r\nimport { _throwInternal, safeGetLogger } from \"./DiagnosticLogger\";\r\nimport { proxyFunctions } from \"./HelperFuncs\";\r\nimport { STR_CORE, STR_DISABLED, STR_EMPTY, STR_EXTENSION_CONFIG, STR_PRIORITY, STR_PROCESS_TELEMETRY } from \"./InternalConstants\";\r\nimport { doPerf } from \"./PerfManager\";\r\nimport { _getPluginState } from \"./TelemetryHelpers\";\r\nvar strTelemetryPluginChain = \"TelemetryPluginChain\";\r\nvar strHasRunFlags = \"_hasRun\";\r\nvar strGetTelCtx = \"_getTelCtx\";\r\nvar _chainId = 0;\r\nfunction _getNextProxyStart(proxy, core, startAt) {\r\n while (proxy) {\r\n if (proxy[_DYN_GET_PLUGIN /* @min:%2egetPlugin */]() === startAt) {\r\n return proxy;\r\n }\r\n proxy = proxy[_DYN_GET_NEXT /* @min:%2egetNext */]();\r\n }\r\n // This wasn't found in the existing chain so create an isolated one with just this plugin\r\n return createTelemetryProxyChain([startAt], core.config || {}, core);\r\n}\r\n/**\r\n * @ignore\r\n * @param telemetryChain\r\n * @param dynamicHandler\r\n * @param core\r\n * @param startAt - Identifies the next plugin to execute, if null there is no \"next\" plugin and if undefined it should assume the start of the chain\r\n * @returns\r\n */\r\nfunction _createInternalContext(telemetryChain, dynamicHandler, core, startAt) {\r\n // We have a special case where we want to start execution from this specific plugin\r\n // or we simply reuse the existing telemetry plugin chain (normal execution case)\r\n var _nextProxy = null; // By Default set as no next plugin\r\n var _onComplete = [];\r\n if (!dynamicHandler) {\r\n dynamicHandler = createDynamicConfig({}, null, core[_DYN_LOGGER /* @min:%2elogger */]);\r\n }\r\n if (startAt !== null) {\r\n // There is no next element (null) vs not defined (undefined) so use the full chain\r\n _nextProxy = startAt ? _getNextProxyStart(telemetryChain, core, startAt) : telemetryChain;\r\n }\r\n var context = {\r\n _next: _moveNext,\r\n ctx: {\r\n core: function () {\r\n return core;\r\n },\r\n diagLog: function () {\r\n return safeGetLogger(core, dynamicHandler.cfg);\r\n },\r\n getCfg: function () {\r\n return dynamicHandler.cfg;\r\n },\r\n getExtCfg: _resolveExtCfg,\r\n getConfig: _getConfig,\r\n hasNext: function () {\r\n return !!_nextProxy;\r\n },\r\n getNext: function () {\r\n return _nextProxy;\r\n },\r\n setNext: function (nextPlugin) {\r\n _nextProxy = nextPlugin;\r\n },\r\n iterate: _iterateChain,\r\n onComplete: _addOnComplete\r\n }\r\n };\r\n function _addOnComplete(onComplete, that) {\r\n var args = [];\r\n for (var _i = 2; _i < arguments.length; _i++) {\r\n args[_i - 2] = arguments[_i];\r\n }\r\n if (onComplete) {\r\n _onComplete[_DYN_PUSH /* @min:%2epush */]({\r\n func: onComplete,\r\n self: !isUndefined(that) ? that : context.ctx,\r\n args: args\r\n });\r\n }\r\n }\r\n function _moveNext() {\r\n var nextProxy = _nextProxy;\r\n // Automatically move to the next plugin\r\n _nextProxy = nextProxy ? nextProxy[_DYN_GET_NEXT /* @min:%2egetNext */]() : null;\r\n if (!nextProxy) {\r\n var onComplete = _onComplete;\r\n if (onComplete && onComplete[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n arrForEach(onComplete, function (completeDetails) {\r\n try {\r\n completeDetails.func.call(completeDetails.self, completeDetails.args);\r\n }\r\n catch (e) {\r\n _throwInternal(core[_DYN_LOGGER /* @min:%2elogger */], 2 /* eLoggingSeverity.WARNING */, 73 /* _eInternalMessageId.PluginException */, \"Unexpected Exception during onComplete - \" + dumpObj(e));\r\n }\r\n });\r\n _onComplete = [];\r\n }\r\n }\r\n return nextProxy;\r\n }\r\n function _getExtCfg(identifier, createIfMissing) {\r\n var idCfg = null;\r\n var cfg = dynamicHandler.cfg;\r\n if (cfg && identifier) {\r\n var extCfg = cfg[STR_EXTENSION_CONFIG /* @min:%2eextensionConfig */];\r\n if (!extCfg && createIfMissing) {\r\n extCfg = {};\r\n }\r\n // Always set the value so that the property always exists\r\n cfg[STR_EXTENSION_CONFIG] = extCfg; // Note: it is valid for the \"value\" to be undefined\r\n // Calling `ref()` has a side effect of causing the referenced property to become dynamic (if not already)\r\n extCfg = dynamicHandler.ref(cfg, STR_EXTENSION_CONFIG);\r\n if (extCfg) {\r\n idCfg = extCfg[identifier];\r\n if (!idCfg && createIfMissing) {\r\n idCfg = {};\r\n }\r\n // Always set the value so that the property always exists\r\n extCfg[identifier] = idCfg; // Note: it is valid for the \"value\" to be undefined\r\n // Calling `ref()` has a side effect of causing the referenced property to become dynamic (if not already)\r\n idCfg = dynamicHandler.ref(extCfg, identifier);\r\n }\r\n }\r\n return idCfg;\r\n }\r\n function _resolveExtCfg(identifier, defaultValues) {\r\n var newConfig = _getExtCfg(identifier, true);\r\n if (defaultValues) {\r\n // Enumerate over the defaultValues and if not already populated attempt to\r\n // find a value from the root config or use the default value\r\n objForEachKey(defaultValues, function (field, defaultValue) {\r\n // for each unspecified field, set the default value\r\n if (isNullOrUndefined(newConfig[field])) {\r\n var cfgValue = dynamicHandler.cfg[field];\r\n if (cfgValue || !isNullOrUndefined(cfgValue)) {\r\n newConfig[field] = cfgValue;\r\n }\r\n }\r\n _applyDefaultValue(dynamicHandler, newConfig, field, defaultValue);\r\n });\r\n }\r\n return dynamicHandler.setDf(newConfig, defaultValues);\r\n }\r\n function _getConfig(identifier, field, defaultValue) {\r\n if (defaultValue === void 0) { defaultValue = false; }\r\n var theValue;\r\n var extConfig = _getExtCfg(identifier, false);\r\n var rootConfig = dynamicHandler.cfg;\r\n if (extConfig && (extConfig[field] || !isNullOrUndefined(extConfig[field]))) {\r\n theValue = extConfig[field];\r\n }\r\n else if (rootConfig[field] || !isNullOrUndefined(rootConfig[field])) {\r\n theValue = rootConfig[field];\r\n }\r\n return (theValue || !isNullOrUndefined(theValue)) ? theValue : defaultValue;\r\n }\r\n function _iterateChain(cb) {\r\n // Keep processing until we reach the end of the chain\r\n var nextPlugin;\r\n while (!!(nextPlugin = context._next())) {\r\n var plugin = nextPlugin[_DYN_GET_PLUGIN /* @min:%2egetPlugin */]();\r\n if (plugin) {\r\n // callback with the current on\r\n cb(plugin);\r\n }\r\n }\r\n }\r\n return context;\r\n}\r\n/**\r\n * Creates a new Telemetry Item context with the current config, core and plugin execution chain\r\n * @param plugins - The plugin instances that will be executed\r\n * @param config - The current config\r\n * @param core - The current core instance\r\n * @param startAt - Identifies the next plugin to execute, if null there is no \"next\" plugin and if undefined it should assume the start of the chain\r\n */\r\nexport function createProcessTelemetryContext(telemetryChain, cfg, core, startAt) {\r\n var config = createDynamicConfig(cfg);\r\n var internalContext = _createInternalContext(telemetryChain, config, core, startAt);\r\n var context = internalContext.ctx;\r\n function _processNext(env) {\r\n var nextPlugin = internalContext._next();\r\n if (nextPlugin) {\r\n // Run the next plugin which will call \"processNext()\"\r\n nextPlugin[STR_PROCESS_TELEMETRY /* @min:%2eprocessTelemetry */](env, context);\r\n }\r\n return !nextPlugin;\r\n }\r\n function _createNew(plugins, startAt) {\r\n if (plugins === void 0) { plugins = null; }\r\n if (isArray(plugins)) {\r\n plugins = createTelemetryProxyChain(plugins, config.cfg, core, startAt);\r\n }\r\n return createProcessTelemetryContext(plugins || context[_DYN_GET_NEXT /* @min:%2egetNext */](), config.cfg, core, startAt);\r\n }\r\n context[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */] = _processNext;\r\n context[_DYN_CREATE_NEW /* @min:%2ecreateNew */] = _createNew;\r\n return context;\r\n}\r\n/**\r\n * Creates a new Telemetry Item context with the current config, core and plugin execution chain for handling the unloading of the chain\r\n * @param plugins - The plugin instances that will be executed\r\n * @param config - The current config\r\n * @param core - The current core instance\r\n * @param startAt - Identifies the next plugin to execute, if null there is no \"next\" plugin and if undefined it should assume the start of the chain\r\n */\r\nexport function createProcessTelemetryUnloadContext(telemetryChain, core, startAt) {\r\n var config = createDynamicConfig(core.config);\r\n var internalContext = _createInternalContext(telemetryChain, config, core, startAt);\r\n var context = internalContext.ctx;\r\n function _processNext(unloadState) {\r\n var nextPlugin = internalContext._next();\r\n nextPlugin && nextPlugin[_DYN_UNLOAD /* @min:%2eunload */](context, unloadState);\r\n return !nextPlugin;\r\n }\r\n function _createNew(plugins, startAt) {\r\n if (plugins === void 0) { plugins = null; }\r\n if (isArray(plugins)) {\r\n plugins = createTelemetryProxyChain(plugins, config.cfg, core, startAt);\r\n }\r\n return createProcessTelemetryUnloadContext(plugins || context[_DYN_GET_NEXT /* @min:%2egetNext */](), core, startAt);\r\n }\r\n context[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */] = _processNext;\r\n context[_DYN_CREATE_NEW /* @min:%2ecreateNew */] = _createNew;\r\n return context;\r\n}\r\n/**\r\n * Creates a new Telemetry Item context with the current config, core and plugin execution chain for updating the configuration\r\n * @param plugins - The plugin instances that will be executed\r\n * @param config - The current config\r\n * @param core - The current core instance\r\n * @param startAt - Identifies the next plugin to execute, if null there is no \"next\" plugin and if undefined it should assume the start of the chain\r\n */\r\nexport function createProcessTelemetryUpdateContext(telemetryChain, core, startAt) {\r\n var config = createDynamicConfig(core.config);\r\n var internalContext = _createInternalContext(telemetryChain, config, core, startAt);\r\n var context = internalContext.ctx;\r\n function _processNext(updateState) {\r\n return context.iterate(function (plugin) {\r\n if (isFunction(plugin[_DYN_UPDATE /* @min:%2eupdate */])) {\r\n plugin[_DYN_UPDATE /* @min:%2eupdate */](context, updateState);\r\n }\r\n });\r\n }\r\n function _createNew(plugins, startAt) {\r\n if (plugins === void 0) { plugins = null; }\r\n if (isArray(plugins)) {\r\n plugins = createTelemetryProxyChain(plugins, config.cfg, core, startAt);\r\n }\r\n return createProcessTelemetryUpdateContext(plugins || context[_DYN_GET_NEXT /* @min:%2egetNext */](), core, startAt);\r\n }\r\n context[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */] = _processNext;\r\n context[_DYN_CREATE_NEW /* @min:%2ecreateNew */] = _createNew;\r\n return context;\r\n}\r\n/**\r\n * Creates an execution chain from the array of plugins\r\n * @param plugins - The array of plugins that will be executed in this order\r\n * @param defItemCtx - The default execution context to use when no telemetry context is passed to processTelemetry(), this\r\n * should be for legacy plugins only. Currently, only used for passing the current core instance and to provide better error\r\n * reporting (hasRun) when errors occur.\r\n */\r\nexport function createTelemetryProxyChain(plugins, config, core, startAt) {\r\n var firstProxy = null;\r\n var add = startAt ? false : true;\r\n if (isArray(plugins) && plugins[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n // Create the proxies and wire up the next plugin chain\r\n var lastProxy_1 = null;\r\n arrForEach(plugins, function (thePlugin) {\r\n if (!add && startAt === thePlugin) {\r\n add = true;\r\n }\r\n if (add && thePlugin && isFunction(thePlugin[STR_PROCESS_TELEMETRY /* @min:%2eprocessTelemetry */])) {\r\n // Only add plugins that are processors\r\n var newProxy = createTelemetryPluginProxy(thePlugin, config, core);\r\n if (!firstProxy) {\r\n firstProxy = newProxy;\r\n }\r\n if (lastProxy_1) {\r\n // Set this new proxy as the next for the previous one\r\n lastProxy_1._setNext(newProxy);\r\n }\r\n lastProxy_1 = newProxy;\r\n }\r\n });\r\n }\r\n if (startAt && !firstProxy) {\r\n // Special case where the \"startAt\" was not in the original list of plugins\r\n return createTelemetryProxyChain([startAt], config, core);\r\n }\r\n return firstProxy;\r\n}\r\n/**\r\n * Create the processing telemetry proxy instance, the proxy is used to abstract the current plugin to allow monitoring and\r\n * execution plugins while passing around the dynamic execution state (IProcessTelemetryContext), the proxy instance no longer\r\n * contains any execution state and can be reused between requests (this was not the case for 2.7.2 and earlier with the\r\n * TelemetryPluginChain class).\r\n * @param plugin - The plugin instance to proxy\r\n * @param config - The default execution context to use when no telemetry context is passed to processTelemetry(), this\r\n * should be for legacy plugins only. Currently, only used for passing the current core instance and to provide better error\r\n * reporting (hasRun) when errors occur.\r\n * @returns\r\n */\r\nexport function createTelemetryPluginProxy(plugin, config, core) {\r\n var nextProxy = null;\r\n var hasProcessTelemetry = isFunction(plugin[STR_PROCESS_TELEMETRY /* @min:%2eprocessTelemetry */]);\r\n var hasSetNext = isFunction(plugin[_DYN_SET_NEXT_PLUGIN /* @min:%2esetNextPlugin */]);\r\n var chainId;\r\n if (plugin) {\r\n chainId = plugin[_DYN_IDENTIFIER /* @min:%2eidentifier */] + \"-\" + plugin[STR_PRIORITY /* @min:%2epriority */] + \"-\" + _chainId++;\r\n }\r\n else {\r\n chainId = \"Unknown-0-\" + _chainId++;\r\n }\r\n var proxyChain = {\r\n getPlugin: function () {\r\n return plugin;\r\n },\r\n getNext: function () {\r\n return nextProxy;\r\n },\r\n processTelemetry: _processTelemetry,\r\n unload: _unloadPlugin,\r\n update: _updatePlugin,\r\n _id: chainId,\r\n _setNext: function (nextPlugin) {\r\n nextProxy = nextPlugin;\r\n }\r\n };\r\n function _getTelCtx() {\r\n var itemCtx;\r\n // Looks like a plugin didn't pass the (optional) context, so create a new one\r\n if (plugin && isFunction(plugin[strGetTelCtx])) {\r\n // This plugin extends from the BaseTelemetryPlugin so lets use it\r\n itemCtx = plugin[strGetTelCtx]();\r\n }\r\n if (!itemCtx) {\r\n // Create a temporary one\r\n itemCtx = createProcessTelemetryContext(proxyChain, config, core);\r\n }\r\n return itemCtx;\r\n }\r\n function _processChain(itemCtx, processPluginFn, name, details, isAsync) {\r\n var hasRun = false;\r\n var identifier = plugin ? plugin[_DYN_IDENTIFIER /* @min:%2eidentifier */] : strTelemetryPluginChain;\r\n var hasRunContext = itemCtx[strHasRunFlags];\r\n if (!hasRunContext) {\r\n // Assign and populate\r\n hasRunContext = itemCtx[strHasRunFlags] = {};\r\n }\r\n // Ensure that we keep the context in sync\r\n itemCtx.setNext(nextProxy);\r\n if (plugin) {\r\n doPerf(itemCtx[STR_CORE /* @min:%2ecore */](), function () { return identifier + \":\" + name; }, function () {\r\n // Mark this component as having run\r\n hasRunContext[chainId] = true;\r\n try {\r\n // Set a flag on the next plugin so we know if it was attempted to be executed\r\n var nextId = nextProxy ? nextProxy._id : STR_EMPTY;\r\n if (nextId) {\r\n hasRunContext[nextId] = false;\r\n }\r\n hasRun = processPluginFn(itemCtx);\r\n }\r\n catch (error) {\r\n var hasNextRun = nextProxy ? hasRunContext[nextProxy._id] : true;\r\n if (hasNextRun) {\r\n // The next plugin after us has already run so set this one as complete\r\n hasRun = true;\r\n }\r\n if (!nextProxy || !hasNextRun) {\r\n // Either we have no next plugin or the current one did not attempt to call the next plugin\r\n // Which means the current one is the root of the failure so log/report this failure\r\n _throwInternal(itemCtx[_DYN_DIAG_LOG /* @min:%2ediagLog */](), 1 /* eLoggingSeverity.CRITICAL */, 73 /* _eInternalMessageId.PluginException */, \"Plugin [\" + identifier + \"] failed during \" + name + \" - \" + dumpObj(error) + \", run flags: \" + dumpObj(hasRunContext));\r\n }\r\n }\r\n }, details, isAsync);\r\n }\r\n return hasRun;\r\n }\r\n function _processTelemetry(env, itemCtx) {\r\n itemCtx = itemCtx || _getTelCtx();\r\n function _callProcessTelemetry(itemCtx) {\r\n if (!plugin || !hasProcessTelemetry) {\r\n return false;\r\n }\r\n var pluginState = _getPluginState(plugin);\r\n if (pluginState[_DYN_TEARDOWN /* @min:%2eteardown */] || pluginState[STR_DISABLED]) {\r\n return false;\r\n }\r\n // Ensure that we keep the context in sync (for processNext()), just in case a plugin\r\n // doesn't calls processTelemetry() instead of itemContext.processNext() or some\r\n // other form of error occurred\r\n if (hasSetNext) {\r\n // Backward compatibility setting the next plugin on the instance\r\n plugin[_DYN_SET_NEXT_PLUGIN /* @min:%2esetNextPlugin */](nextProxy);\r\n }\r\n plugin[STR_PROCESS_TELEMETRY /* @min:%2eprocessTelemetry */](env, itemCtx);\r\n // Process Telemetry is expected to call itemCtx.processNext() or nextPlugin.processTelemetry()\r\n return true;\r\n }\r\n if (!_processChain(itemCtx, _callProcessTelemetry, \"processTelemetry\", function () { return ({ item: env }); }, !(env.sync))) {\r\n // The underlying plugin is either not defined, not enabled or does not have a processTelemetry implementation\r\n // so we still want the next plugin to be executed.\r\n itemCtx[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](env);\r\n }\r\n }\r\n function _unloadPlugin(unloadCtx, unloadState) {\r\n function _callTeardown() {\r\n // Setting default of hasRun as false so the proxyProcessFn() is called as teardown() doesn't have to exist or call unloadNext().\r\n var hasRun = false;\r\n if (plugin) {\r\n var pluginState = _getPluginState(plugin);\r\n var pluginCore = plugin[STR_CORE] || pluginState[STR_CORE /* @min:%2ecore */];\r\n // Only teardown the plugin if it was initialized by the current core (i.e. It's not a shared plugin)\r\n if (plugin && (!pluginCore || pluginCore === unloadCtx.core()) && !pluginState[_DYN_TEARDOWN /* @min:%2eteardown */]) {\r\n // Handle plugins that don't extend from the BaseTelemetryPlugin\r\n pluginState[STR_CORE /* @min:%2ecore */] = null;\r\n pluginState[_DYN_TEARDOWN /* @min:%2eteardown */] = true;\r\n pluginState[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */] = false;\r\n if (plugin[_DYN_TEARDOWN /* @min:%2eteardown */] && plugin[_DYN_TEARDOWN /* @min:%2eteardown */](unloadCtx, unloadState) === true) {\r\n // plugin told us that it was going to (or has) call unloadCtx.processNext()\r\n hasRun = true;\r\n }\r\n }\r\n }\r\n return hasRun;\r\n }\r\n if (!_processChain(unloadCtx, _callTeardown, \"unload\", function () { }, unloadState.isAsync)) {\r\n // Only called if we hasRun was not true\r\n unloadCtx[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](unloadState);\r\n }\r\n }\r\n function _updatePlugin(updateCtx, updateState) {\r\n function _callUpdate() {\r\n // Setting default of hasRun as false so the proxyProcessFn() is called as teardown() doesn't have to exist or call unloadNext().\r\n var hasRun = false;\r\n if (plugin) {\r\n var pluginState = _getPluginState(plugin);\r\n var pluginCore = plugin[STR_CORE] || pluginState[STR_CORE /* @min:%2ecore */];\r\n // Only update the plugin if it was initialized by the current core (i.e. It's not a shared plugin)\r\n if (plugin && (!pluginCore || pluginCore === updateCtx.core()) && !pluginState[_DYN_TEARDOWN /* @min:%2eteardown */]) {\r\n if (plugin[_DYN_UPDATE /* @min:%2eupdate */] && plugin[_DYN_UPDATE /* @min:%2eupdate */](updateCtx, updateState) === true) {\r\n // plugin told us that it was going to (or has) call unloadCtx.processNext()\r\n hasRun = true;\r\n }\r\n }\r\n }\r\n return hasRun;\r\n }\r\n if (!_processChain(updateCtx, _callUpdate, \"update\", function () { }, false)) {\r\n // Only called if we hasRun was not true\r\n updateCtx[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](updateState);\r\n }\r\n }\r\n return objFreeze(proxyChain);\r\n}\r\n/**\r\n * This class will be removed!\r\n * @deprecated use createProcessTelemetryContext() instead\r\n */\r\nvar ProcessTelemetryContext = /** @class */ (function () {\r\n /**\r\n * Creates a new Telemetry Item context with the current config, core and plugin execution chain\r\n * @param plugins - The plugin instances that will be executed\r\n * @param config - The current config\r\n * @param core - The current core instance\r\n */\r\n function ProcessTelemetryContext(pluginChain, config, core, startAt) {\r\n var _self = this;\r\n var context = createProcessTelemetryContext(pluginChain, config, core, startAt);\r\n // Proxy all functions of the context to this object\r\n proxyFunctions(_self, context, objKeys(context));\r\n }\r\n return ProcessTelemetryContext;\r\n}());\r\nexport { ProcessTelemetryContext };\r\n//# sourceMappingURL=ProcessTelemetryContext.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.3.6\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { arrForEach, dumpObj } from \"@nevware21/ts-utils\";\r\nimport { _DYN_DIAG_LOG, _DYN_PUSH } from \"../__DynamicConstants\";\r\nimport { _throwInternal } from \"./DiagnosticLogger\";\r\nexport function createUnloadHandlerContainer() {\r\n var handlers = [];\r\n function _addHandler(handler) {\r\n if (handler) {\r\n handlers[_DYN_PUSH /* @min:%2epush */](handler);\r\n }\r\n }\r\n function _runHandlers(unloadCtx, unloadState) {\r\n arrForEach(handlers, function (handler) {\r\n try {\r\n handler(unloadCtx, unloadState);\r\n }\r\n catch (e) {\r\n _throwInternal(unloadCtx[_DYN_DIAG_LOG /* @min:%2ediagLog */](), 2 /* eLoggingSeverity.WARNING */, 73 /* _eInternalMessageId.PluginException */, \"Unexpected error calling unload handler - \" + dumpObj(e));\r\n }\r\n });\r\n handlers = [];\r\n }\r\n return {\r\n add: _addHandler,\r\n run: _runHandlers\r\n };\r\n}\r\n//# sourceMappingURL=UnloadHandlerContainer.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.3.6\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { arrAppend, arrForEach, dumpObj } from \"@nevware21/ts-utils\";\r\nimport { _DYN_LENGTH } from \"../__DynamicConstants\";\r\nimport { _throwInternal } from \"./DiagnosticLogger\";\r\nvar _maxHooks;\r\nvar _hookAddMonitor;\r\n/**\r\n * Test hook for setting the maximum number of unload hooks and calling a monitor function when the hooks are added or removed\r\n * This allows for automatic test failure when the maximum number of unload hooks is exceeded\r\n * @param maxHooks - The maximum number of unload hooks\r\n * @param addMonitor - The monitor function to call when hooks are added or removed\r\n */\r\nexport function _testHookMaxUnloadHooksCb(maxHooks, addMonitor) {\r\n _maxHooks = maxHooks;\r\n _hookAddMonitor = addMonitor;\r\n}\r\n/**\r\n * Create a IUnloadHookContainer which can be used to remember unload hook functions to be executed during the component unloading\r\n * process.\r\n * @returns A new IUnloadHookContainer instance\r\n */\r\nexport function createUnloadHookContainer() {\r\n var _hooks = [];\r\n function _doUnload(logger) {\r\n var oldHooks = _hooks;\r\n _hooks = [];\r\n // Remove all registered unload hooks\r\n arrForEach(oldHooks, function (fn) {\r\n // allow either rm or remove callback function\r\n try {\r\n (fn.rm || fn.remove).call(fn);\r\n }\r\n catch (e) {\r\n _throwInternal(logger, 2 /* eLoggingSeverity.WARNING */, 73 /* _eInternalMessageId.PluginException */, \"Unloading:\" + dumpObj(e));\r\n }\r\n });\r\n if (_maxHooks && oldHooks[_DYN_LENGTH /* @min:%2elength */] > _maxHooks) {\r\n _hookAddMonitor ? _hookAddMonitor(\"doUnload\", oldHooks) : _throwInternal(null, 1 /* eLoggingSeverity.CRITICAL */, 48 /* _eInternalMessageId.MaxUnloadHookExceeded */, \"Max unload hooks exceeded. An excessive number of unload hooks has been detected.\");\r\n }\r\n }\r\n function _addHook(hooks) {\r\n if (hooks) {\r\n arrAppend(_hooks, hooks);\r\n if (_maxHooks && _hooks[_DYN_LENGTH /* @min:%2elength */] > _maxHooks) {\r\n _hookAddMonitor ? _hookAddMonitor(\"Add\", _hooks) : _throwInternal(null, 1 /* eLoggingSeverity.CRITICAL */, 48 /* _eInternalMessageId.MaxUnloadHookExceeded */, \"Max unload hooks exceeded. An excessive number of unload hooks has been detected.\");\r\n }\r\n }\r\n }\r\n return {\r\n run: _doUnload,\r\n add: _addHook\r\n };\r\n}\r\n//# sourceMappingURL=UnloadHookContainer.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.3.6\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\n\"use strict\";\r\nvar _a;\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { isFunction, objDefine } from \"@nevware21/ts-utils\";\r\nimport { createDynamicConfig } from \"../Config/DynamicConfig\";\r\nimport { _DYN_CREATE_NEW, _DYN_DIAG_LOG, _DYN_GET_NEXT, _DYN_GET_PROCESS_TEL_CONT2, _DYN_INITIALIZE, _DYN_IS_INITIALIZED, _DYN_PROCESS_NEXT, _DYN_SET_NEXT_PLUGIN, _DYN_TEARDOWN, _DYN_UPDATE, _DYN__DO_TEARDOWN } from \"../__DynamicConstants\";\r\nimport { safeGetLogger } from \"./DiagnosticLogger\";\r\nimport { isNotNullOrUndefined, proxyFunctionAs } from \"./HelperFuncs\";\r\nimport { STR_CORE, STR_EXTENSION_CONFIG, STR_PROCESS_TELEMETRY } from \"./InternalConstants\";\r\nimport { createProcessTelemetryContext, createProcessTelemetryUnloadContext, createProcessTelemetryUpdateContext } from \"./ProcessTelemetryContext\";\r\nimport { createUnloadHandlerContainer } from \"./UnloadHandlerContainer\";\r\nimport { createUnloadHookContainer } from \"./UnloadHookContainer\";\r\nvar strGetPlugin = \"getPlugin\";\r\nvar defaultValues = (_a = {},\r\n _a[STR_EXTENSION_CONFIG] = { isVal: isNotNullOrUndefined, v: {} },\r\n _a);\r\n/**\r\n * BaseTelemetryPlugin provides a basic implementation of the ITelemetryPlugin interface so that plugins\r\n * can avoid implementation the same set of boiler plate code as well as provide a base\r\n * implementation so that new default implementations can be added without breaking all plugins.\r\n */\r\nvar BaseTelemetryPlugin = /** @class */ (function () {\r\n function BaseTelemetryPlugin() {\r\n var _self = this; // Setting _self here as it's used outside of the dynamicProto as well\r\n // NOTE!: DON'T set default values here, instead set them in the _initDefaults() function as it is also called during teardown()\r\n var _isinitialized;\r\n var _rootCtx; // Used as the root context, holding the current config and initialized core\r\n var _nextPlugin; // Used for backward compatibility where plugins don't call the main pipeline\r\n var _unloadHandlerContainer;\r\n var _hookContainer;\r\n _initDefaults();\r\n dynamicProto(BaseTelemetryPlugin, _self, function (_self) {\r\n _self[_DYN_INITIALIZE /* @min:%2einitialize */] = function (config, core, extensions, pluginChain) {\r\n _setDefaults(config, core, pluginChain);\r\n _isinitialized = true;\r\n };\r\n _self[_DYN_TEARDOWN /* @min:%2eteardown */] = function (unloadCtx, unloadState) {\r\n // If this plugin has already been torn down (not operational) or is not initialized (core is not set)\r\n // or the core being used for unload was not the same core used for initialization.\r\n var core = _self[STR_CORE /* @min:%2ecore */];\r\n if (!core || (unloadCtx && core !== unloadCtx[STR_CORE /* @min:%2ecore */]())) {\r\n // Do Nothing as either the plugin is not initialized or was not initialized by the current core\r\n return;\r\n }\r\n var result;\r\n var unloadDone = false;\r\n var theUnloadCtx = unloadCtx || createProcessTelemetryUnloadContext(null, core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);\r\n var theUnloadState = unloadState || {\r\n reason: 0 /* TelemetryUnloadReason.ManualTeardown */,\r\n isAsync: false\r\n };\r\n function _unloadCallback() {\r\n if (!unloadDone) {\r\n unloadDone = true;\r\n _unloadHandlerContainer.run(theUnloadCtx, unloadState);\r\n _hookContainer.run(theUnloadCtx[_DYN_DIAG_LOG /* @min:%2ediagLog */]());\r\n if (result === true) {\r\n theUnloadCtx[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](theUnloadState);\r\n }\r\n _initDefaults();\r\n }\r\n }\r\n if (!_self[_DYN__DO_TEARDOWN /* @min:%2e_doTeardown */] || _self[_DYN__DO_TEARDOWN /* @min:%2e_doTeardown */](theUnloadCtx, theUnloadState, _unloadCallback) !== true) {\r\n _unloadCallback();\r\n }\r\n else {\r\n // Tell the caller that we will be calling processNext()\r\n result = true;\r\n }\r\n return result;\r\n };\r\n _self[_DYN_UPDATE /* @min:%2eupdate */] = function (updateCtx, updateState) {\r\n // If this plugin has already been torn down (not operational) or is not initialized (core is not set)\r\n // or the core being used for unload was not the same core used for initialization.\r\n var core = _self[STR_CORE /* @min:%2ecore */];\r\n if (!core || (updateCtx && core !== updateCtx[STR_CORE /* @min:%2ecore */]())) {\r\n // Do Nothing\r\n return;\r\n }\r\n var result;\r\n var updateDone = false;\r\n var theUpdateCtx = updateCtx || createProcessTelemetryUpdateContext(null, core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);\r\n var theUpdateState = updateState || {\r\n reason: 0 /* TelemetryUpdateReason.Unknown */\r\n };\r\n function _updateCallback() {\r\n if (!updateDone) {\r\n updateDone = true;\r\n _setDefaults(theUpdateCtx.getCfg(), theUpdateCtx.core(), theUpdateCtx[_DYN_GET_NEXT /* @min:%2egetNext */]());\r\n }\r\n }\r\n if (!_self._doUpdate || _self._doUpdate(theUpdateCtx, theUpdateState, _updateCallback) !== true) {\r\n _updateCallback();\r\n }\r\n else {\r\n result = true;\r\n }\r\n return result;\r\n };\r\n proxyFunctionAs(_self, \"_addUnloadCb\", function () { return _unloadHandlerContainer; }, \"add\");\r\n proxyFunctionAs(_self, \"_addHook\", function () { return _hookContainer; }, \"add\");\r\n objDefine(_self, \"_unloadHooks\", { g: function () { return _hookContainer; } });\r\n });\r\n // These are added after the dynamicProto so that are not moved to the prototype\r\n _self[_DYN_DIAG_LOG /* @min:%2ediagLog */] = function (itemCtx) {\r\n return _getTelCtx(itemCtx)[_DYN_DIAG_LOG /* @min:%2ediagLog */]();\r\n };\r\n _self[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */] = function () {\r\n return _isinitialized;\r\n };\r\n _self.setInitialized = function (isInitialized) {\r\n _isinitialized = isInitialized;\r\n };\r\n // _self.getNextPlugin = () => DO NOT IMPLEMENT\r\n // Sub-classes of this base class *should* not be relying on this value and instead\r\n // should use processNext() function. If you require access to the plugin use the\r\n // IProcessTelemetryContext.getNext().getPlugin() while in the pipeline, Note getNext() may return null.\r\n _self[_DYN_SET_NEXT_PLUGIN /* @min:%2esetNextPlugin */] = function (next) {\r\n _nextPlugin = next;\r\n };\r\n _self[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */] = function (env, itemCtx) {\r\n if (itemCtx) {\r\n // Normal core execution sequence\r\n itemCtx[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](env);\r\n }\r\n else if (_nextPlugin && isFunction(_nextPlugin[STR_PROCESS_TELEMETRY /* @min:%2eprocessTelemetry */])) {\r\n // Looks like backward compatibility or out of band processing. And as it looks\r\n // like a ITelemetryPlugin or ITelemetryPluginChain, just call processTelemetry\r\n _nextPlugin[STR_PROCESS_TELEMETRY /* @min:%2eprocessTelemetry */](env, null);\r\n }\r\n };\r\n _self._getTelCtx = _getTelCtx;\r\n function _getTelCtx(currentCtx) {\r\n if (currentCtx === void 0) { currentCtx = null; }\r\n var itemCtx = currentCtx;\r\n if (!itemCtx) {\r\n var rootCtx = _rootCtx || createProcessTelemetryContext(null, {}, _self[STR_CORE /* @min:%2ecore */]);\r\n // tslint:disable-next-line: prefer-conditional-expression\r\n if (_nextPlugin && _nextPlugin[strGetPlugin]) {\r\n // Looks like a chain object\r\n itemCtx = rootCtx[_DYN_CREATE_NEW /* @min:%2ecreateNew */](null, _nextPlugin[strGetPlugin]);\r\n }\r\n else {\r\n itemCtx = rootCtx[_DYN_CREATE_NEW /* @min:%2ecreateNew */](null, _nextPlugin);\r\n }\r\n }\r\n return itemCtx;\r\n }\r\n function _setDefaults(config, core, pluginChain) {\r\n // Make sure the extensionConfig exists and the config is dynamic\r\n createDynamicConfig(config, defaultValues, safeGetLogger(core));\r\n if (!pluginChain && core) {\r\n // Get the first plugin from the core\r\n pluginChain = core[_DYN_GET_PROCESS_TEL_CONT2 /* @min:%2egetProcessTelContext */]()[_DYN_GET_NEXT /* @min:%2egetNext */]();\r\n }\r\n var nextPlugin = _nextPlugin;\r\n if (_nextPlugin && _nextPlugin[strGetPlugin]) {\r\n // If it looks like a proxy/chain then get the plugin\r\n nextPlugin = _nextPlugin[strGetPlugin]();\r\n }\r\n // Support legacy plugins where core was defined as a property\r\n _self[STR_CORE /* @min:%2ecore */] = core;\r\n _rootCtx = createProcessTelemetryContext(pluginChain, config, core, nextPlugin);\r\n }\r\n function _initDefaults() {\r\n _isinitialized = false;\r\n _self[STR_CORE /* @min:%2ecore */] = null;\r\n _rootCtx = null;\r\n _nextPlugin = null;\r\n _hookContainer = createUnloadHookContainer();\r\n _unloadHandlerContainer = createUnloadHandlerContainer();\r\n }\r\n }\r\n// Removed Stub for BaseTelemetryPlugin.prototype.initialize.\r\n// Removed Stub for BaseTelemetryPlugin.prototype.teardown.\r\n// Removed Stub for BaseTelemetryPlugin.prototype.update.\r\n// Removed Stub for BaseTelemetryPlugin.prototype._addUnloadCb.\r\n// Removed Stub for BaseTelemetryPlugin.prototype._addHook.\r\n // This is a workaround for an IE bug when using dynamicProto() with classes that don't have any\n // non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.\n BaseTelemetryPlugin.__ieDyn=1;\n\n return BaseTelemetryPlugin;\r\n}());\r\nexport { BaseTelemetryPlugin };\r\n//# sourceMappingURL=BaseTelemetryPlugin.js.map","/*\n * Application Insights JavaScript SDK - Common, 3.3.6\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n// Licensed under the\r\nexport { correlationIdSetPrefix, correlationIdGetPrefix, correlationIdCanIncludeCorrelationHeader, correlationIdGetCorrelationContext, correlationIdGetCorrelationContextValue, dateTimeUtilsNow, dateTimeUtilsDuration, isInternalApplicationInsightsEndpoint, createDistributedTraceContextFromTrace } from \"./Util\";\r\nexport { ThrottleMgr } from \"./ThrottleMgr\";\r\nexport { parseConnectionString, ConnectionStringParser } from \"./ConnectionStringParser\";\r\nexport { RequestHeaders } from \"./RequestResponseHeaders\";\r\nexport { DisabledPropertyName, ProcessLegacy, SampleRate, HttpMethod, DEFAULT_BREEZE_ENDPOINT, DEFAULT_BREEZE_PATH, strNotSpecified } from \"./Constants\";\r\nexport { Envelope } from \"./Telemetry/Common/Envelope\";\r\nexport { Event } from \"./Telemetry/Event\";\r\nexport { Exception } from \"./Telemetry/Exception\";\r\nexport { Metric } from \"./Telemetry/Metric\";\r\nexport { PageView } from \"./Telemetry/PageView\";\r\nexport { RemoteDependencyData } from \"./Telemetry/RemoteDependencyData\";\r\nexport { Trace } from \"./Telemetry/Trace\";\r\nexport { PageViewPerformance } from \"./Telemetry/PageViewPerformance\";\r\nexport { Data } from \"./Telemetry/Common/Data\";\r\nexport { SeverityLevel } from \"./Interfaces/Contracts/SeverityLevel\";\r\nexport { ConfigurationManager } from \"./Interfaces/IConfig\";\r\nexport { ContextTagKeys } from \"./Interfaces/Contracts/ContextTagKeys\";\r\nexport { dataSanitizeKeyAndAddUniqueness, dataSanitizeKey, dataSanitizeString, dataSanitizeUrl, dataSanitizeMessage, dataSanitizeException, dataSanitizeProperties, dataSanitizeMeasurements, dataSanitizeId, dataSanitizeInput, dsPadNumber } from \"./Telemetry/Common/DataSanitizer\";\r\nexport { TelemetryItemCreator, createTelemetryItem } from \"./TelemetryItemCreator\";\r\nexport { CtxTagKeys, Extensions } from \"./Interfaces/PartAExtensions\";\r\nexport { DistributedTracingModes, EventPersistence } from \"./Enums\";\r\nexport { stringToBoolOrDefault, msToTimeSpan, getExtensionByName, isCrossOriginError } from \"./HelperFuncs\";\r\nexport { isBeaconsSupported as isBeaconApiSupported, createTraceParent, parseTraceParent, isValidTraceId, isValidSpanId, isValidTraceParent, isSampledFlag, formatTraceParent, findW3cTraceParent, findAllScripts } from \"@microsoft/applicationinsights-core-js\";\r\nexport { createDomEvent } from \"./DomHelperFuncs\";\r\nexport { utlDisableStorage, utlEnableStorage, utlCanUseLocalStorage, utlGetLocalStorage, utlSetLocalStorage, utlRemoveStorage, utlCanUseSessionStorage, utlGetSessionStorageKeys, utlGetSessionStorage, utlSetSessionStorage, utlRemoveSessionStorage, utlSetStoragePrefix } from \"./StorageHelperFuncs\";\r\nexport { urlParseUrl, urlGetAbsoluteUrl, urlGetPathName, urlGetCompleteUrl, urlParseHost, urlParseFullHost } from \"./UrlHelperFuncs\";\r\nexport { createOfflineListener } from \"./Offline\";\r\nexport var PropertiesPluginIdentifier = \"AppInsightsPropertiesPlugin\";\r\nexport var BreezeChannelIdentifier = \"AppInsightsChannelPlugin\";\r\nexport var AnalyticsPluginIdentifier = \"ApplicationInsightsAnalytics\";\r\n//# sourceMappingURL=applicationinsights-common.js.map","/*\n * Application Insights JavaScript SDK - React Plugin, 17.3.5\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n/**\r\n* ReactPlugin.ts\r\n* @copyright Microsoft 2019\r\n*/\r\nimport { __extendsFn as __extends } from \"@microsoft/applicationinsights-shims\";\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { AnalyticsPluginIdentifier } from \"@microsoft/applicationinsights-common\";\r\nimport { BaseTelemetryPlugin, _throwInternal, isFunction, proxyFunctions, safeGetCookieMgr, onConfigChange, objDefineAccessors } from \"@microsoft/applicationinsights-core-js\";\r\nimport { objDeepFreeze } from \"@nevware21/ts-utils\";\r\nvar defaultReactExtensionConfig = objDeepFreeze({\r\n history: { blkVal: true, v: undefined }\r\n});\r\nvar ReactPlugin = /** @class */ (function (_super) {\r\n __extends(ReactPlugin, _super);\r\n function ReactPlugin() {\r\n var _this = _super.call(this) || this;\r\n _this.priority = 185;\r\n _this.identifier = 'ReactPlugin';\r\n var _analyticsPlugin;\r\n var _extensionConfig;\r\n var _unlisten;\r\n var _pageViewTimer;\r\n var _pageViewTracked;\r\n dynamicProto(ReactPlugin, _this, function (_self, _base) {\r\n _initDefaults();\r\n _self.initialize = function (config, core, extensions, pluginChain) {\r\n _super.prototype.initialize.call(_this, config, core, extensions, pluginChain);\r\n _self._addHook(onConfigChange(config, function (details) {\r\n var _a;\r\n var ctx = _self._getTelCtx();\r\n _extensionConfig = ctx.getExtCfg(_this.identifier, defaultReactExtensionConfig);\r\n _analyticsPlugin = (_a = core.getPlugin(AnalyticsPluginIdentifier)) === null || _a === void 0 ? void 0 : _a.plugin;\r\n if (isFunction(_unlisten)) {\r\n _unlisten();\r\n _unlisten = null;\r\n }\r\n if (_extensionConfig.history) {\r\n _addHistoryListener(_extensionConfig.history);\r\n if (!_pageViewTracked) {\r\n var pageViewTelemetry = {\r\n uri: _extensionConfig.history.location.pathname\r\n };\r\n _self.trackPageView(pageViewTelemetry);\r\n _pageViewTracked = true;\r\n }\r\n }\r\n }));\r\n };\r\n _self.getCookieMgr = function () {\r\n return safeGetCookieMgr(_self.core);\r\n };\r\n _self.getAppInsights = _getAnalytics;\r\n _self.processTelemetry = function (event, itemCtx) {\r\n _self.processNext(event, itemCtx);\r\n };\r\n _self._doTeardown = function (unloadCtx, unloadState, asyncCallback) {\r\n if (isFunction(_unlisten)) {\r\n _unlisten();\r\n }\r\n if (_pageViewTimer) {\r\n clearTimeout(_pageViewTimer);\r\n }\r\n _initDefaults();\r\n };\r\n // Proxy the analytics functions\r\n proxyFunctions(_self, _getAnalytics, [\r\n \"trackMetric\",\r\n \"trackPageView\",\r\n \"trackEvent\",\r\n \"trackException\",\r\n \"trackTrace\",\r\n ]);\r\n function _initDefaults() {\r\n _analyticsPlugin = null;\r\n _extensionConfig = null;\r\n _unlisten = null;\r\n _pageViewTimer = null;\r\n _pageViewTracked = false;\r\n }\r\n function _getAnalytics() {\r\n if (!_analyticsPlugin) {\r\n _throwInternal(_self.diagLog(), 1 /* eLoggingSeverity.CRITICAL */, 64 /* _eInternalMessageId.TelemetryInitializerFailed */, \"Analytics plugin is not available, React plugin telemetry will not be sent: \");\r\n }\r\n return _analyticsPlugin;\r\n }\r\n function _addHistoryListener(history) {\r\n var locationListener = function (arg) {\r\n // v4 of the history API passes \"location\" as the first argument, while v5 passes an object that contains location and action \r\n var locn = null;\r\n if (\"location\" in arg) {\r\n // Looks like v5\r\n locn = arg[\"location\"];\r\n }\r\n else {\r\n locn = arg;\r\n }\r\n // Timeout to ensure any changes to the DOM made by route changes get included in pageView telemetry\r\n _pageViewTimer = setTimeout(function () {\r\n _pageViewTimer = null;\r\n var pageViewTelemetry = { uri: locn.pathname };\r\n _self.trackPageView(pageViewTelemetry);\r\n }, 500);\r\n };\r\n _unlisten = history.listen(locationListener);\r\n }\r\n objDefineAccessors(_self, \"_extensionConfig\", function () { return _extensionConfig; });\r\n });\r\n return _this;\r\n }\r\n// Removed Stub for ReactPlugin.prototype.initialize.\r\n// Removed Stub for ReactPlugin.prototype.getCookieMgr.\r\n// Removed Stub for ReactPlugin.prototype.getAppInsights.\r\n// Removed Stub for ReactPlugin.prototype.processTelemetry.\r\n// Removed Stub for ReactPlugin.prototype.trackMetric.\r\n// Removed Stub for ReactPlugin.prototype.trackPageView.\r\n// Removed Stub for ReactPlugin.prototype.trackEvent.\r\n// Removed Stub for ReactPlugin.prototype.trackException.\r\n// Removed Stub for ReactPlugin.prototype.trackTrace.\r\n // This is a workaround for an IE8 bug when using dynamicProto() with classes that don't have any\n // non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.\n // this will be removed when ES3 support is dropped.\n ReactPlugin.__ieDyn=1;\n\n return ReactPlugin;\r\n}(BaseTelemetryPlugin));\r\nexport default ReactPlugin;\r\n//# sourceMappingURL=ReactPlugin.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n/** Error thrown when an HTTP request fails. */\r\nexport class HttpError extends Error {\r\n /** Constructs a new instance of {@link @microsoft/signalr.HttpError}.\r\n *\r\n * @param {string} errorMessage A descriptive error message.\r\n * @param {number} statusCode The HTTP status code represented by this error.\r\n */\r\n constructor(errorMessage, statusCode) {\r\n const trueProto = new.target.prototype;\r\n super(`${errorMessage}: Status code '${statusCode}'`);\r\n this.statusCode = statusCode;\r\n // Workaround issue in Typescript compiler\r\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\r\n this.__proto__ = trueProto;\r\n }\r\n}\r\n/** Error thrown when a timeout elapses. */\r\nexport class TimeoutError extends Error {\r\n /** Constructs a new instance of {@link @microsoft/signalr.TimeoutError}.\r\n *\r\n * @param {string} errorMessage A descriptive error message.\r\n */\r\n constructor(errorMessage = \"A timeout occurred.\") {\r\n const trueProto = new.target.prototype;\r\n super(errorMessage);\r\n // Workaround issue in Typescript compiler\r\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\r\n this.__proto__ = trueProto;\r\n }\r\n}\r\n/** Error thrown when an action is aborted. */\r\nexport class AbortError extends Error {\r\n /** Constructs a new instance of {@link AbortError}.\r\n *\r\n * @param {string} errorMessage A descriptive error message.\r\n */\r\n constructor(errorMessage = \"An abort occurred.\") {\r\n const trueProto = new.target.prototype;\r\n super(errorMessage);\r\n // Workaround issue in Typescript compiler\r\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\r\n this.__proto__ = trueProto;\r\n }\r\n}\r\n/** Error thrown when the selected transport is unsupported by the browser. */\r\n/** @private */\r\nexport class UnsupportedTransportError extends Error {\r\n /** Constructs a new instance of {@link @microsoft/signalr.UnsupportedTransportError}.\r\n *\r\n * @param {string} message A descriptive error message.\r\n * @param {HttpTransportType} transport The {@link @microsoft/signalr.HttpTransportType} this error occurred on.\r\n */\r\n constructor(message, transport) {\r\n const trueProto = new.target.prototype;\r\n super(message);\r\n this.transport = transport;\r\n this.errorType = 'UnsupportedTransportError';\r\n // Workaround issue in Typescript compiler\r\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\r\n this.__proto__ = trueProto;\r\n }\r\n}\r\n/** Error thrown when the selected transport is disabled by the browser. */\r\n/** @private */\r\nexport class DisabledTransportError extends Error {\r\n /** Constructs a new instance of {@link @microsoft/signalr.DisabledTransportError}.\r\n *\r\n * @param {string} message A descriptive error message.\r\n * @param {HttpTransportType} transport The {@link @microsoft/signalr.HttpTransportType} this error occurred on.\r\n */\r\n constructor(message, transport) {\r\n const trueProto = new.target.prototype;\r\n super(message);\r\n this.transport = transport;\r\n this.errorType = 'DisabledTransportError';\r\n // Workaround issue in Typescript compiler\r\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\r\n this.__proto__ = trueProto;\r\n }\r\n}\r\n/** Error thrown when the selected transport cannot be started. */\r\n/** @private */\r\nexport class FailedToStartTransportError extends Error {\r\n /** Constructs a new instance of {@link @microsoft/signalr.FailedToStartTransportError}.\r\n *\r\n * @param {string} message A descriptive error message.\r\n * @param {HttpTransportType} transport The {@link @microsoft/signalr.HttpTransportType} this error occurred on.\r\n */\r\n constructor(message, transport) {\r\n const trueProto = new.target.prototype;\r\n super(message);\r\n this.transport = transport;\r\n this.errorType = 'FailedToStartTransportError';\r\n // Workaround issue in Typescript compiler\r\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\r\n this.__proto__ = trueProto;\r\n }\r\n}\r\n/** Error thrown when the negotiation with the server failed to complete. */\r\n/** @private */\r\nexport class FailedToNegotiateWithServerError extends Error {\r\n /** Constructs a new instance of {@link @microsoft/signalr.FailedToNegotiateWithServerError}.\r\n *\r\n * @param {string} message A descriptive error message.\r\n */\r\n constructor(message) {\r\n const trueProto = new.target.prototype;\r\n super(message);\r\n this.errorType = 'FailedToNegotiateWithServerError';\r\n // Workaround issue in Typescript compiler\r\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\r\n this.__proto__ = trueProto;\r\n }\r\n}\r\n/** Error thrown when multiple errors have occurred. */\r\n/** @private */\r\nexport class AggregateErrors extends Error {\r\n /** Constructs a new instance of {@link @microsoft/signalr.AggregateErrors}.\r\n *\r\n * @param {string} message A descriptive error message.\r\n * @param {Error[]} innerErrors The collection of errors this error is aggregating.\r\n */\r\n constructor(message, innerErrors) {\r\n const trueProto = new.target.prototype;\r\n super(message);\r\n this.innerErrors = innerErrors;\r\n // Workaround issue in Typescript compiler\r\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\r\n this.__proto__ = trueProto;\r\n }\r\n}\r\n//# sourceMappingURL=Errors.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n/** Represents an HTTP response. */\r\nexport class HttpResponse {\r\n constructor(statusCode, statusText, content) {\r\n this.statusCode = statusCode;\r\n this.statusText = statusText;\r\n this.content = content;\r\n }\r\n}\r\n/** Abstraction over an HTTP client.\r\n *\r\n * This class provides an abstraction over an HTTP client so that a different implementation can be provided on different platforms.\r\n */\r\nexport class HttpClient {\r\n get(url, options) {\r\n return this.send({\r\n ...options,\r\n method: \"GET\",\r\n url,\r\n });\r\n }\r\n post(url, options) {\r\n return this.send({\r\n ...options,\r\n method: \"POST\",\r\n url,\r\n });\r\n }\r\n delete(url, options) {\r\n return this.send({\r\n ...options,\r\n method: \"DELETE\",\r\n url,\r\n });\r\n }\r\n /** Gets all cookies that apply to the specified URL.\r\n *\r\n * @param url The URL that the cookies are valid for.\r\n * @returns {string} A string containing all the key-value cookie pairs for the specified URL.\r\n */\r\n // @ts-ignore\r\n getCookieString(url) {\r\n return \"\";\r\n }\r\n}\r\n//# sourceMappingURL=HttpClient.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n// These values are designed to match the ASP.NET Log Levels since that's the pattern we're emulating here.\r\n/** Indicates the severity of a log message.\r\n *\r\n * Log Levels are ordered in increasing severity. So `Debug` is more severe than `Trace`, etc.\r\n */\r\nexport var LogLevel;\r\n(function (LogLevel) {\r\n /** Log level for very low severity diagnostic messages. */\r\n LogLevel[LogLevel[\"Trace\"] = 0] = \"Trace\";\r\n /** Log level for low severity diagnostic messages. */\r\n LogLevel[LogLevel[\"Debug\"] = 1] = \"Debug\";\r\n /** Log level for informational diagnostic messages. */\r\n LogLevel[LogLevel[\"Information\"] = 2] = \"Information\";\r\n /** Log level for diagnostic messages that indicate a non-fatal problem. */\r\n LogLevel[LogLevel[\"Warning\"] = 3] = \"Warning\";\r\n /** Log level for diagnostic messages that indicate a failure in the current operation. */\r\n LogLevel[LogLevel[\"Error\"] = 4] = \"Error\";\r\n /** Log level for diagnostic messages that indicate a failure that will terminate the entire application. */\r\n LogLevel[LogLevel[\"Critical\"] = 5] = \"Critical\";\r\n /** The highest possible log level. Used when configuring logging to indicate that no log messages should be emitted. */\r\n LogLevel[LogLevel[\"None\"] = 6] = \"None\";\r\n})(LogLevel || (LogLevel = {}));\r\n//# sourceMappingURL=ILogger.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n/** A logger that does nothing when log messages are sent to it. */\r\nexport class NullLogger {\r\n constructor() { }\r\n /** @inheritDoc */\r\n // eslint-disable-next-line\r\n log(_logLevel, _message) {\r\n }\r\n}\r\n/** The singleton instance of the {@link @microsoft/signalr.NullLogger}. */\r\nNullLogger.instance = new NullLogger();\r\n//# sourceMappingURL=Loggers.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { LogLevel } from \"./ILogger\";\r\nimport { NullLogger } from \"./Loggers\";\r\n// Version token that will be replaced by the prepack command\r\n/** The version of the SignalR client. */\r\nexport const VERSION = \"8.0.7\";\r\n/** @private */\r\nexport class Arg {\r\n static isRequired(val, name) {\r\n if (val === null || val === undefined) {\r\n throw new Error(`The '${name}' argument is required.`);\r\n }\r\n }\r\n static isNotEmpty(val, name) {\r\n if (!val || val.match(/^\\s*$/)) {\r\n throw new Error(`The '${name}' argument should not be empty.`);\r\n }\r\n }\r\n static isIn(val, values, name) {\r\n // TypeScript enums have keys for **both** the name and the value of each enum member on the type itself.\r\n if (!(val in values)) {\r\n throw new Error(`Unknown ${name} value: ${val}.`);\r\n }\r\n }\r\n}\r\n/** @private */\r\nexport class Platform {\r\n // react-native has a window but no document so we should check both\r\n static get isBrowser() {\r\n return !Platform.isNode && typeof window === \"object\" && typeof window.document === \"object\";\r\n }\r\n // WebWorkers don't have a window object so the isBrowser check would fail\r\n static get isWebWorker() {\r\n return !Platform.isNode && typeof self === \"object\" && \"importScripts\" in self;\r\n }\r\n // react-native has a window but no document\r\n static get isReactNative() {\r\n return !Platform.isNode && typeof window === \"object\" && typeof window.document === \"undefined\";\r\n }\r\n // Node apps shouldn't have a window object, but WebWorkers don't either\r\n // so we need to check for both WebWorker and window\r\n static get isNode() {\r\n return typeof process !== \"undefined\" && process.release && process.release.name === \"node\";\r\n }\r\n}\r\n/** @private */\r\nexport function getDataDetail(data, includeContent) {\r\n let detail = \"\";\r\n if (isArrayBuffer(data)) {\r\n detail = `Binary data of length ${data.byteLength}`;\r\n if (includeContent) {\r\n detail += `. Content: '${formatArrayBuffer(data)}'`;\r\n }\r\n }\r\n else if (typeof data === \"string\") {\r\n detail = `String data of length ${data.length}`;\r\n if (includeContent) {\r\n detail += `. Content: '${data}'`;\r\n }\r\n }\r\n return detail;\r\n}\r\n/** @private */\r\nexport function formatArrayBuffer(data) {\r\n const view = new Uint8Array(data);\r\n // Uint8Array.map only supports returning another Uint8Array?\r\n let str = \"\";\r\n view.forEach((num) => {\r\n const pad = num < 16 ? \"0\" : \"\";\r\n str += `0x${pad}${num.toString(16)} `;\r\n });\r\n // Trim of trailing space.\r\n return str.substr(0, str.length - 1);\r\n}\r\n// Also in signalr-protocol-msgpack/Utils.ts\r\n/** @private */\r\nexport function isArrayBuffer(val) {\r\n return val && typeof ArrayBuffer !== \"undefined\" &&\r\n (val instanceof ArrayBuffer ||\r\n // Sometimes we get an ArrayBuffer that doesn't satisfy instanceof\r\n (val.constructor && val.constructor.name === \"ArrayBuffer\"));\r\n}\r\n/** @private */\r\nexport async function sendMessage(logger, transportName, httpClient, url, content, options) {\r\n const headers = {};\r\n const [name, value] = getUserAgentHeader();\r\n headers[name] = value;\r\n logger.log(LogLevel.Trace, `(${transportName} transport) sending data. ${getDataDetail(content, options.logMessageContent)}.`);\r\n const responseType = isArrayBuffer(content) ? \"arraybuffer\" : \"text\";\r\n const response = await httpClient.post(url, {\r\n content,\r\n headers: { ...headers, ...options.headers },\r\n responseType,\r\n timeout: options.timeout,\r\n withCredentials: options.withCredentials,\r\n });\r\n logger.log(LogLevel.Trace, `(${transportName} transport) request complete. Response status: ${response.statusCode}.`);\r\n}\r\n/** @private */\r\nexport function createLogger(logger) {\r\n if (logger === undefined) {\r\n return new ConsoleLogger(LogLevel.Information);\r\n }\r\n if (logger === null) {\r\n return NullLogger.instance;\r\n }\r\n if (logger.log !== undefined) {\r\n return logger;\r\n }\r\n return new ConsoleLogger(logger);\r\n}\r\n/** @private */\r\nexport class SubjectSubscription {\r\n constructor(subject, observer) {\r\n this._subject = subject;\r\n this._observer = observer;\r\n }\r\n dispose() {\r\n const index = this._subject.observers.indexOf(this._observer);\r\n if (index > -1) {\r\n this._subject.observers.splice(index, 1);\r\n }\r\n if (this._subject.observers.length === 0 && this._subject.cancelCallback) {\r\n this._subject.cancelCallback().catch((_) => { });\r\n }\r\n }\r\n}\r\n/** @private */\r\nexport class ConsoleLogger {\r\n constructor(minimumLogLevel) {\r\n this._minLevel = minimumLogLevel;\r\n this.out = console;\r\n }\r\n log(logLevel, message) {\r\n if (logLevel >= this._minLevel) {\r\n const msg = `[${new Date().toISOString()}] ${LogLevel[logLevel]}: ${message}`;\r\n switch (logLevel) {\r\n case LogLevel.Critical:\r\n case LogLevel.Error:\r\n this.out.error(msg);\r\n break;\r\n case LogLevel.Warning:\r\n this.out.warn(msg);\r\n break;\r\n case LogLevel.Information:\r\n this.out.info(msg);\r\n break;\r\n default:\r\n // console.debug only goes to attached debuggers in Node, so we use console.log for Trace and Debug\r\n this.out.log(msg);\r\n break;\r\n }\r\n }\r\n }\r\n}\r\n/** @private */\r\nexport function getUserAgentHeader() {\r\n let userAgentHeaderName = \"X-SignalR-User-Agent\";\r\n if (Platform.isNode) {\r\n userAgentHeaderName = \"User-Agent\";\r\n }\r\n return [userAgentHeaderName, constructUserAgent(VERSION, getOsName(), getRuntime(), getRuntimeVersion())];\r\n}\r\n/** @private */\r\nexport function constructUserAgent(version, os, runtime, runtimeVersion) {\r\n // Microsoft SignalR/[Version] ([Detailed Version]; [Operating System]; [Runtime]; [Runtime Version])\r\n let userAgent = \"Microsoft SignalR/\";\r\n const majorAndMinor = version.split(\".\");\r\n userAgent += `${majorAndMinor[0]}.${majorAndMinor[1]}`;\r\n userAgent += ` (${version}; `;\r\n if (os && os !== \"\") {\r\n userAgent += `${os}; `;\r\n }\r\n else {\r\n userAgent += \"Unknown OS; \";\r\n }\r\n userAgent += `${runtime}`;\r\n if (runtimeVersion) {\r\n userAgent += `; ${runtimeVersion}`;\r\n }\r\n else {\r\n userAgent += \"; Unknown Runtime Version\";\r\n }\r\n userAgent += \")\";\r\n return userAgent;\r\n}\r\n// eslint-disable-next-line spaced-comment\r\n/*#__PURE__*/ function getOsName() {\r\n if (Platform.isNode) {\r\n switch (process.platform) {\r\n case \"win32\":\r\n return \"Windows NT\";\r\n case \"darwin\":\r\n return \"macOS\";\r\n case \"linux\":\r\n return \"Linux\";\r\n default:\r\n return process.platform;\r\n }\r\n }\r\n else {\r\n return \"\";\r\n }\r\n}\r\n// eslint-disable-next-line spaced-comment\r\n/*#__PURE__*/ function getRuntimeVersion() {\r\n if (Platform.isNode) {\r\n return process.versions.node;\r\n }\r\n return undefined;\r\n}\r\nfunction getRuntime() {\r\n if (Platform.isNode) {\r\n return \"NodeJS\";\r\n }\r\n else {\r\n return \"Browser\";\r\n }\r\n}\r\n/** @private */\r\nexport function getErrorString(e) {\r\n if (e.stack) {\r\n return e.stack;\r\n }\r\n else if (e.message) {\r\n return e.message;\r\n }\r\n return `${e}`;\r\n}\r\n/** @private */\r\nexport function getGlobalThis() {\r\n // globalThis is semi-new and not available in Node until v12\r\n if (typeof globalThis !== \"undefined\") {\r\n return globalThis;\r\n }\r\n if (typeof self !== \"undefined\") {\r\n return self;\r\n }\r\n if (typeof window !== \"undefined\") {\r\n return window;\r\n }\r\n if (typeof global !== \"undefined\") {\r\n return global;\r\n }\r\n throw new Error(\"could not find global\");\r\n}\r\n//# sourceMappingURL=Utils.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { AbortError, HttpError, TimeoutError } from \"./Errors\";\r\nimport { HttpClient, HttpResponse } from \"./HttpClient\";\r\nimport { LogLevel } from \"./ILogger\";\r\nimport { Platform, getGlobalThis, isArrayBuffer } from \"./Utils\";\r\nexport class FetchHttpClient extends HttpClient {\r\n constructor(logger) {\r\n super();\r\n this._logger = logger;\r\n // Node added a fetch implementation to the global scope starting in v18.\r\n // We need to add a cookie jar in node to be able to share cookies with WebSocket\r\n if (typeof fetch === \"undefined\" || Platform.isNode) {\r\n // In order to ignore the dynamic require in webpack builds we need to do this magic\r\n // @ts-ignore: TS doesn't know about these names\r\n const requireFunc = typeof __webpack_require__ === \"function\" ? __non_webpack_require__ : require;\r\n // Cookies aren't automatically handled in Node so we need to add a CookieJar to preserve cookies across requests\r\n this._jar = new (requireFunc(\"tough-cookie\")).CookieJar();\r\n if (typeof fetch === \"undefined\") {\r\n this._fetchType = requireFunc(\"node-fetch\");\r\n }\r\n else {\r\n // Use fetch from Node if available\r\n this._fetchType = fetch;\r\n }\r\n // node-fetch doesn't have a nice API for getting and setting cookies\r\n // fetch-cookie will wrap a fetch implementation with a default CookieJar or a provided one\r\n this._fetchType = requireFunc(\"fetch-cookie\")(this._fetchType, this._jar);\r\n }\r\n else {\r\n this._fetchType = fetch.bind(getGlobalThis());\r\n }\r\n if (typeof AbortController === \"undefined\") {\r\n // In order to ignore the dynamic require in webpack builds we need to do this magic\r\n // @ts-ignore: TS doesn't know about these names\r\n const requireFunc = typeof __webpack_require__ === \"function\" ? __non_webpack_require__ : require;\r\n // Node needs EventListener methods on AbortController which our custom polyfill doesn't provide\r\n this._abortControllerType = requireFunc(\"abort-controller\");\r\n }\r\n else {\r\n this._abortControllerType = AbortController;\r\n }\r\n }\r\n /** @inheritDoc */\r\n async send(request) {\r\n // Check that abort was not signaled before calling send\r\n if (request.abortSignal && request.abortSignal.aborted) {\r\n throw new AbortError();\r\n }\r\n if (!request.method) {\r\n throw new Error(\"No method defined.\");\r\n }\r\n if (!request.url) {\r\n throw new Error(\"No url defined.\");\r\n }\r\n const abortController = new this._abortControllerType();\r\n let error;\r\n // Hook our abortSignal into the abort controller\r\n if (request.abortSignal) {\r\n request.abortSignal.onabort = () => {\r\n abortController.abort();\r\n error = new AbortError();\r\n };\r\n }\r\n // If a timeout has been passed in, setup a timeout to call abort\r\n // Type needs to be any to fit window.setTimeout and NodeJS.setTimeout\r\n let timeoutId = null;\r\n if (request.timeout) {\r\n const msTimeout = request.timeout;\r\n timeoutId = setTimeout(() => {\r\n abortController.abort();\r\n this._logger.log(LogLevel.Warning, `Timeout from HTTP request.`);\r\n error = new TimeoutError();\r\n }, msTimeout);\r\n }\r\n if (request.content === \"\") {\r\n request.content = undefined;\r\n }\r\n if (request.content) {\r\n // Explicitly setting the Content-Type header for React Native on Android platform.\r\n request.headers = request.headers || {};\r\n if (isArrayBuffer(request.content)) {\r\n request.headers[\"Content-Type\"] = \"application/octet-stream\";\r\n }\r\n else {\r\n request.headers[\"Content-Type\"] = \"text/plain;charset=UTF-8\";\r\n }\r\n }\r\n let response;\r\n try {\r\n response = await this._fetchType(request.url, {\r\n body: request.content,\r\n cache: \"no-cache\",\r\n credentials: request.withCredentials === true ? \"include\" : \"same-origin\",\r\n headers: {\r\n \"X-Requested-With\": \"XMLHttpRequest\",\r\n ...request.headers,\r\n },\r\n method: request.method,\r\n mode: \"cors\",\r\n redirect: \"follow\",\r\n signal: abortController.signal,\r\n });\r\n }\r\n catch (e) {\r\n if (error) {\r\n throw error;\r\n }\r\n this._logger.log(LogLevel.Warning, `Error from HTTP request. ${e}.`);\r\n throw e;\r\n }\r\n finally {\r\n if (timeoutId) {\r\n clearTimeout(timeoutId);\r\n }\r\n if (request.abortSignal) {\r\n request.abortSignal.onabort = null;\r\n }\r\n }\r\n if (!response.ok) {\r\n const errorMessage = await deserializeContent(response, \"text\");\r\n throw new HttpError(errorMessage || response.statusText, response.status);\r\n }\r\n const content = deserializeContent(response, request.responseType);\r\n const payload = await content;\r\n return new HttpResponse(response.status, response.statusText, payload);\r\n }\r\n getCookieString(url) {\r\n let cookies = \"\";\r\n if (Platform.isNode && this._jar) {\r\n // @ts-ignore: unused variable\r\n this._jar.getCookies(url, (e, c) => cookies = c.join(\"; \"));\r\n }\r\n return cookies;\r\n }\r\n}\r\nfunction deserializeContent(response, responseType) {\r\n let content;\r\n switch (responseType) {\r\n case \"arraybuffer\":\r\n content = response.arrayBuffer();\r\n break;\r\n case \"text\":\r\n content = response.text();\r\n break;\r\n case \"blob\":\r\n case \"document\":\r\n case \"json\":\r\n throw new Error(`${responseType} is not supported.`);\r\n default:\r\n content = response.text();\r\n break;\r\n }\r\n return content;\r\n}\r\n//# sourceMappingURL=FetchHttpClient.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { AbortError, HttpError, TimeoutError } from \"./Errors\";\r\nimport { HttpClient, HttpResponse } from \"./HttpClient\";\r\nimport { LogLevel } from \"./ILogger\";\r\nimport { isArrayBuffer } from \"./Utils\";\r\nexport class XhrHttpClient extends HttpClient {\r\n constructor(logger) {\r\n super();\r\n this._logger = logger;\r\n }\r\n /** @inheritDoc */\r\n send(request) {\r\n // Check that abort was not signaled before calling send\r\n if (request.abortSignal && request.abortSignal.aborted) {\r\n return Promise.reject(new AbortError());\r\n }\r\n if (!request.method) {\r\n return Promise.reject(new Error(\"No method defined.\"));\r\n }\r\n if (!request.url) {\r\n return Promise.reject(new Error(\"No url defined.\"));\r\n }\r\n return new Promise((resolve, reject) => {\r\n const xhr = new XMLHttpRequest();\r\n xhr.open(request.method, request.url, true);\r\n xhr.withCredentials = request.withCredentials === undefined ? true : request.withCredentials;\r\n xhr.setRequestHeader(\"X-Requested-With\", \"XMLHttpRequest\");\r\n if (request.content === \"\") {\r\n request.content = undefined;\r\n }\r\n if (request.content) {\r\n // Explicitly setting the Content-Type header for React Native on Android platform.\r\n if (isArrayBuffer(request.content)) {\r\n xhr.setRequestHeader(\"Content-Type\", \"application/octet-stream\");\r\n }\r\n else {\r\n xhr.setRequestHeader(\"Content-Type\", \"text/plain;charset=UTF-8\");\r\n }\r\n }\r\n const headers = request.headers;\r\n if (headers) {\r\n Object.keys(headers)\r\n .forEach((header) => {\r\n xhr.setRequestHeader(header, headers[header]);\r\n });\r\n }\r\n if (request.responseType) {\r\n xhr.responseType = request.responseType;\r\n }\r\n if (request.abortSignal) {\r\n request.abortSignal.onabort = () => {\r\n xhr.abort();\r\n reject(new AbortError());\r\n };\r\n }\r\n if (request.timeout) {\r\n xhr.timeout = request.timeout;\r\n }\r\n xhr.onload = () => {\r\n if (request.abortSignal) {\r\n request.abortSignal.onabort = null;\r\n }\r\n if (xhr.status >= 200 && xhr.status < 300) {\r\n resolve(new HttpResponse(xhr.status, xhr.statusText, xhr.response || xhr.responseText));\r\n }\r\n else {\r\n reject(new HttpError(xhr.response || xhr.responseText || xhr.statusText, xhr.status));\r\n }\r\n };\r\n xhr.onerror = () => {\r\n this._logger.log(LogLevel.Warning, `Error from HTTP request. ${xhr.status}: ${xhr.statusText}.`);\r\n reject(new HttpError(xhr.statusText, xhr.status));\r\n };\r\n xhr.ontimeout = () => {\r\n this._logger.log(LogLevel.Warning, `Timeout from HTTP request.`);\r\n reject(new TimeoutError());\r\n };\r\n xhr.send(request.content);\r\n });\r\n }\r\n}\r\n//# sourceMappingURL=XhrHttpClient.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { AbortError } from \"./Errors\";\r\nimport { FetchHttpClient } from \"./FetchHttpClient\";\r\nimport { HttpClient } from \"./HttpClient\";\r\nimport { Platform } from \"./Utils\";\r\nimport { XhrHttpClient } from \"./XhrHttpClient\";\r\n/** Default implementation of {@link @microsoft/signalr.HttpClient}. */\r\nexport class DefaultHttpClient extends HttpClient {\r\n /** Creates a new instance of the {@link @microsoft/signalr.DefaultHttpClient}, using the provided {@link @microsoft/signalr.ILogger} to log messages. */\r\n constructor(logger) {\r\n super();\r\n if (typeof fetch !== \"undefined\" || Platform.isNode) {\r\n this._httpClient = new FetchHttpClient(logger);\r\n }\r\n else if (typeof XMLHttpRequest !== \"undefined\") {\r\n this._httpClient = new XhrHttpClient(logger);\r\n }\r\n else {\r\n throw new Error(\"No usable HttpClient found.\");\r\n }\r\n }\r\n /** @inheritDoc */\r\n send(request) {\r\n // Check that abort was not signaled before calling send\r\n if (request.abortSignal && request.abortSignal.aborted) {\r\n return Promise.reject(new AbortError());\r\n }\r\n if (!request.method) {\r\n return Promise.reject(new Error(\"No method defined.\"));\r\n }\r\n if (!request.url) {\r\n return Promise.reject(new Error(\"No url defined.\"));\r\n }\r\n return this._httpClient.send(request);\r\n }\r\n getCookieString(url) {\r\n return this._httpClient.getCookieString(url);\r\n }\r\n}\r\n//# sourceMappingURL=DefaultHttpClient.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n// Not exported from index\r\n/** @private */\r\nexport class TextMessageFormat {\r\n static write(output) {\r\n return `${output}${TextMessageFormat.RecordSeparator}`;\r\n }\r\n static parse(input) {\r\n if (input[input.length - 1] !== TextMessageFormat.RecordSeparator) {\r\n throw new Error(\"Message is incomplete.\");\r\n }\r\n const messages = input.split(TextMessageFormat.RecordSeparator);\r\n messages.pop();\r\n return messages;\r\n }\r\n}\r\nTextMessageFormat.RecordSeparatorCode = 0x1e;\r\nTextMessageFormat.RecordSeparator = String.fromCharCode(TextMessageFormat.RecordSeparatorCode);\r\n//# sourceMappingURL=TextMessageFormat.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { TextMessageFormat } from \"./TextMessageFormat\";\r\nimport { isArrayBuffer } from \"./Utils\";\r\n/** @private */\r\nexport class HandshakeProtocol {\r\n // Handshake request is always JSON\r\n writeHandshakeRequest(handshakeRequest) {\r\n return TextMessageFormat.write(JSON.stringify(handshakeRequest));\r\n }\r\n parseHandshakeResponse(data) {\r\n let messageData;\r\n let remainingData;\r\n if (isArrayBuffer(data)) {\r\n // Format is binary but still need to read JSON text from handshake response\r\n const binaryData = new Uint8Array(data);\r\n const separatorIndex = binaryData.indexOf(TextMessageFormat.RecordSeparatorCode);\r\n if (separatorIndex === -1) {\r\n throw new Error(\"Message is incomplete.\");\r\n }\r\n // content before separator is handshake response\r\n // optional content after is additional messages\r\n const responseLength = separatorIndex + 1;\r\n messageData = String.fromCharCode.apply(null, Array.prototype.slice.call(binaryData.slice(0, responseLength)));\r\n remainingData = (binaryData.byteLength > responseLength) ? binaryData.slice(responseLength).buffer : null;\r\n }\r\n else {\r\n const textData = data;\r\n const separatorIndex = textData.indexOf(TextMessageFormat.RecordSeparator);\r\n if (separatorIndex === -1) {\r\n throw new Error(\"Message is incomplete.\");\r\n }\r\n // content before separator is handshake response\r\n // optional content after is additional messages\r\n const responseLength = separatorIndex + 1;\r\n messageData = textData.substring(0, responseLength);\r\n remainingData = (textData.length > responseLength) ? textData.substring(responseLength) : null;\r\n }\r\n // At this point we should have just the single handshake message\r\n const messages = TextMessageFormat.parse(messageData);\r\n const response = JSON.parse(messages[0]);\r\n if (response.type) {\r\n throw new Error(\"Expected a handshake response from the server.\");\r\n }\r\n const responseMessage = response;\r\n // multiple messages could have arrived with handshake\r\n // return additional data to be parsed as usual, or null if all parsed\r\n return [remainingData, responseMessage];\r\n }\r\n}\r\n//# sourceMappingURL=HandshakeProtocol.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n/** Defines the type of a Hub Message. */\r\nexport var MessageType;\r\n(function (MessageType) {\r\n /** Indicates the message is an Invocation message and implements the {@link @microsoft/signalr.InvocationMessage} interface. */\r\n MessageType[MessageType[\"Invocation\"] = 1] = \"Invocation\";\r\n /** Indicates the message is a StreamItem message and implements the {@link @microsoft/signalr.StreamItemMessage} interface. */\r\n MessageType[MessageType[\"StreamItem\"] = 2] = \"StreamItem\";\r\n /** Indicates the message is a Completion message and implements the {@link @microsoft/signalr.CompletionMessage} interface. */\r\n MessageType[MessageType[\"Completion\"] = 3] = \"Completion\";\r\n /** Indicates the message is a Stream Invocation message and implements the {@link @microsoft/signalr.StreamInvocationMessage} interface. */\r\n MessageType[MessageType[\"StreamInvocation\"] = 4] = \"StreamInvocation\";\r\n /** Indicates the message is a Cancel Invocation message and implements the {@link @microsoft/signalr.CancelInvocationMessage} interface. */\r\n MessageType[MessageType[\"CancelInvocation\"] = 5] = \"CancelInvocation\";\r\n /** Indicates the message is a Ping message and implements the {@link @microsoft/signalr.PingMessage} interface. */\r\n MessageType[MessageType[\"Ping\"] = 6] = \"Ping\";\r\n /** Indicates the message is a Close message and implements the {@link @microsoft/signalr.CloseMessage} interface. */\r\n MessageType[MessageType[\"Close\"] = 7] = \"Close\";\r\n MessageType[MessageType[\"Ack\"] = 8] = \"Ack\";\r\n MessageType[MessageType[\"Sequence\"] = 9] = \"Sequence\";\r\n})(MessageType || (MessageType = {}));\r\n//# sourceMappingURL=IHubProtocol.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { SubjectSubscription } from \"./Utils\";\r\n/** Stream implementation to stream items to the server. */\r\nexport class Subject {\r\n constructor() {\r\n this.observers = [];\r\n }\r\n next(item) {\r\n for (const observer of this.observers) {\r\n observer.next(item);\r\n }\r\n }\r\n error(err) {\r\n for (const observer of this.observers) {\r\n if (observer.error) {\r\n observer.error(err);\r\n }\r\n }\r\n }\r\n complete() {\r\n for (const observer of this.observers) {\r\n if (observer.complete) {\r\n observer.complete();\r\n }\r\n }\r\n }\r\n subscribe(observer) {\r\n this.observers.push(observer);\r\n return new SubjectSubscription(this, observer);\r\n }\r\n}\r\n//# sourceMappingURL=Subject.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { MessageType } from \"./IHubProtocol\";\r\nimport { isArrayBuffer } from \"./Utils\";\r\n/** @private */\r\nexport class MessageBuffer {\r\n constructor(protocol, connection, bufferSize) {\r\n this._bufferSize = 100000;\r\n this._messages = [];\r\n this._totalMessageCount = 0;\r\n this._waitForSequenceMessage = false;\r\n // Message IDs start at 1 and always increment by 1\r\n this._nextReceivingSequenceId = 1;\r\n this._latestReceivedSequenceId = 0;\r\n this._bufferedByteCount = 0;\r\n this._reconnectInProgress = false;\r\n this._protocol = protocol;\r\n this._connection = connection;\r\n this._bufferSize = bufferSize;\r\n }\r\n async _send(message) {\r\n const serializedMessage = this._protocol.writeMessage(message);\r\n let backpressurePromise = Promise.resolve();\r\n // Only count invocation messages. Acks, pings, etc. don't need to be resent on reconnect\r\n if (this._isInvocationMessage(message)) {\r\n this._totalMessageCount++;\r\n let backpressurePromiseResolver = () => { };\r\n let backpressurePromiseRejector = () => { };\r\n if (isArrayBuffer(serializedMessage)) {\r\n this._bufferedByteCount += serializedMessage.byteLength;\r\n }\r\n else {\r\n this._bufferedByteCount += serializedMessage.length;\r\n }\r\n if (this._bufferedByteCount >= this._bufferSize) {\r\n backpressurePromise = new Promise((resolve, reject) => {\r\n backpressurePromiseResolver = resolve;\r\n backpressurePromiseRejector = reject;\r\n });\r\n }\r\n this._messages.push(new BufferedItem(serializedMessage, this._totalMessageCount, backpressurePromiseResolver, backpressurePromiseRejector));\r\n }\r\n try {\r\n // If this is set it means we are reconnecting or resending\r\n // We don't want to send on a disconnected connection\r\n // And we don't want to send if resend is running since that would mean sending\r\n // this message twice\r\n if (!this._reconnectInProgress) {\r\n await this._connection.send(serializedMessage);\r\n }\r\n }\r\n catch {\r\n this._disconnected();\r\n }\r\n await backpressurePromise;\r\n }\r\n _ack(ackMessage) {\r\n let newestAckedMessage = -1;\r\n // Find index of newest message being acked\r\n for (let index = 0; index < this._messages.length; index++) {\r\n const element = this._messages[index];\r\n if (element._id <= ackMessage.sequenceId) {\r\n newestAckedMessage = index;\r\n if (isArrayBuffer(element._message)) {\r\n this._bufferedByteCount -= element._message.byteLength;\r\n }\r\n else {\r\n this._bufferedByteCount -= element._message.length;\r\n }\r\n // resolve items that have already been sent and acked\r\n element._resolver();\r\n }\r\n else if (this._bufferedByteCount < this._bufferSize) {\r\n // resolve items that now fall under the buffer limit but haven't been acked\r\n element._resolver();\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n if (newestAckedMessage !== -1) {\r\n // We're removing everything including the message pointed to, so add 1\r\n this._messages = this._messages.slice(newestAckedMessage + 1);\r\n }\r\n }\r\n _shouldProcessMessage(message) {\r\n if (this._waitForSequenceMessage) {\r\n if (message.type !== MessageType.Sequence) {\r\n return false;\r\n }\r\n else {\r\n this._waitForSequenceMessage = false;\r\n return true;\r\n }\r\n }\r\n // No special processing for acks, pings, etc.\r\n if (!this._isInvocationMessage(message)) {\r\n return true;\r\n }\r\n const currentId = this._nextReceivingSequenceId;\r\n this._nextReceivingSequenceId++;\r\n if (currentId <= this._latestReceivedSequenceId) {\r\n if (currentId === this._latestReceivedSequenceId) {\r\n // Should only hit this if we just reconnected and the server is sending\r\n // Messages it has buffered, which would mean it hasn't seen an Ack for these messages\r\n this._ackTimer();\r\n }\r\n // Ignore, this is a duplicate message\r\n return false;\r\n }\r\n this._latestReceivedSequenceId = currentId;\r\n // Only start the timer for sending an Ack message when we have a message to ack. This also conveniently solves\r\n // timer throttling by not having a recursive timer, and by starting the timer via a network call (recv)\r\n this._ackTimer();\r\n return true;\r\n }\r\n _resetSequence(message) {\r\n if (message.sequenceId > this._nextReceivingSequenceId) {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this._connection.stop(new Error(\"Sequence ID greater than amount of messages we've received.\"));\r\n return;\r\n }\r\n this._nextReceivingSequenceId = message.sequenceId;\r\n }\r\n _disconnected() {\r\n this._reconnectInProgress = true;\r\n this._waitForSequenceMessage = true;\r\n }\r\n async _resend() {\r\n const sequenceId = this._messages.length !== 0\r\n ? this._messages[0]._id\r\n : this._totalMessageCount + 1;\r\n await this._connection.send(this._protocol.writeMessage({ type: MessageType.Sequence, sequenceId }));\r\n // Get a local variable to the _messages, just in case messages are acked while resending\r\n // Which would slice the _messages array (which creates a new copy)\r\n const messages = this._messages;\r\n for (const element of messages) {\r\n await this._connection.send(element._message);\r\n }\r\n this._reconnectInProgress = false;\r\n }\r\n _dispose(error) {\r\n error !== null && error !== void 0 ? error : (error = new Error(\"Unable to reconnect to server.\"));\r\n // Unblock backpressure if any\r\n for (const element of this._messages) {\r\n element._rejector(error);\r\n }\r\n }\r\n _isInvocationMessage(message) {\r\n // There is no way to check if something implements an interface.\r\n // So we individually check the messages in a switch statement.\r\n // To make sure we don't miss any message types we rely on the compiler\r\n // seeing the function returns a value and it will do the\r\n // exhaustive check for us on the switch statement, since we don't use 'case default'\r\n switch (message.type) {\r\n case MessageType.Invocation:\r\n case MessageType.StreamItem:\r\n case MessageType.Completion:\r\n case MessageType.StreamInvocation:\r\n case MessageType.CancelInvocation:\r\n return true;\r\n case MessageType.Close:\r\n case MessageType.Sequence:\r\n case MessageType.Ping:\r\n case MessageType.Ack:\r\n return false;\r\n }\r\n }\r\n _ackTimer() {\r\n if (this._ackTimerHandle === undefined) {\r\n this._ackTimerHandle = setTimeout(async () => {\r\n try {\r\n if (!this._reconnectInProgress) {\r\n await this._connection.send(this._protocol.writeMessage({ type: MessageType.Ack, sequenceId: this._latestReceivedSequenceId }));\r\n }\r\n // Ignore errors, that means the connection is closed and we don't care about the Ack message anymore.\r\n }\r\n catch { }\r\n clearTimeout(this._ackTimerHandle);\r\n this._ackTimerHandle = undefined;\r\n // 1 second delay so we don't spam Ack messages if there are many messages being received at once.\r\n }, 1000);\r\n }\r\n }\r\n}\r\nclass BufferedItem {\r\n constructor(message, id, resolver, rejector) {\r\n this._message = message;\r\n this._id = id;\r\n this._resolver = resolver;\r\n this._rejector = rejector;\r\n }\r\n}\r\n//# sourceMappingURL=MessageBuffer.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { HandshakeProtocol } from \"./HandshakeProtocol\";\r\nimport { AbortError } from \"./Errors\";\r\nimport { MessageType } from \"./IHubProtocol\";\r\nimport { LogLevel } from \"./ILogger\";\r\nimport { Subject } from \"./Subject\";\r\nimport { Arg, getErrorString, Platform } from \"./Utils\";\r\nimport { MessageBuffer } from \"./MessageBuffer\";\r\nconst DEFAULT_TIMEOUT_IN_MS = 30 * 1000;\r\nconst DEFAULT_PING_INTERVAL_IN_MS = 15 * 1000;\r\nconst DEFAULT_STATEFUL_RECONNECT_BUFFER_SIZE = 100000;\r\n/** Describes the current state of the {@link HubConnection} to the server. */\r\nexport var HubConnectionState;\r\n(function (HubConnectionState) {\r\n /** The hub connection is disconnected. */\r\n HubConnectionState[\"Disconnected\"] = \"Disconnected\";\r\n /** The hub connection is connecting. */\r\n HubConnectionState[\"Connecting\"] = \"Connecting\";\r\n /** The hub connection is connected. */\r\n HubConnectionState[\"Connected\"] = \"Connected\";\r\n /** The hub connection is disconnecting. */\r\n HubConnectionState[\"Disconnecting\"] = \"Disconnecting\";\r\n /** The hub connection is reconnecting. */\r\n HubConnectionState[\"Reconnecting\"] = \"Reconnecting\";\r\n})(HubConnectionState || (HubConnectionState = {}));\r\n/** Represents a connection to a SignalR Hub. */\r\nexport class HubConnection {\r\n /** @internal */\r\n // Using a public static factory method means we can have a private constructor and an _internal_\r\n // create method that can be used by HubConnectionBuilder. An \"internal\" constructor would just\r\n // be stripped away and the '.d.ts' file would have no constructor, which is interpreted as a\r\n // public parameter-less constructor.\r\n static create(connection, logger, protocol, reconnectPolicy, serverTimeoutInMilliseconds, keepAliveIntervalInMilliseconds, statefulReconnectBufferSize) {\r\n return new HubConnection(connection, logger, protocol, reconnectPolicy, serverTimeoutInMilliseconds, keepAliveIntervalInMilliseconds, statefulReconnectBufferSize);\r\n }\r\n constructor(connection, logger, protocol, reconnectPolicy, serverTimeoutInMilliseconds, keepAliveIntervalInMilliseconds, statefulReconnectBufferSize) {\r\n this._nextKeepAlive = 0;\r\n this._freezeEventListener = () => {\r\n this._logger.log(LogLevel.Warning, \"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep\");\r\n };\r\n Arg.isRequired(connection, \"connection\");\r\n Arg.isRequired(logger, \"logger\");\r\n Arg.isRequired(protocol, \"protocol\");\r\n this.serverTimeoutInMilliseconds = serverTimeoutInMilliseconds !== null && serverTimeoutInMilliseconds !== void 0 ? serverTimeoutInMilliseconds : DEFAULT_TIMEOUT_IN_MS;\r\n this.keepAliveIntervalInMilliseconds = keepAliveIntervalInMilliseconds !== null && keepAliveIntervalInMilliseconds !== void 0 ? keepAliveIntervalInMilliseconds : DEFAULT_PING_INTERVAL_IN_MS;\r\n this._statefulReconnectBufferSize = statefulReconnectBufferSize !== null && statefulReconnectBufferSize !== void 0 ? statefulReconnectBufferSize : DEFAULT_STATEFUL_RECONNECT_BUFFER_SIZE;\r\n this._logger = logger;\r\n this._protocol = protocol;\r\n this.connection = connection;\r\n this._reconnectPolicy = reconnectPolicy;\r\n this._handshakeProtocol = new HandshakeProtocol();\r\n this.connection.onreceive = (data) => this._processIncomingData(data);\r\n this.connection.onclose = (error) => this._connectionClosed(error);\r\n this._callbacks = {};\r\n this._methods = {};\r\n this._closedCallbacks = [];\r\n this._reconnectingCallbacks = [];\r\n this._reconnectedCallbacks = [];\r\n this._invocationId = 0;\r\n this._receivedHandshakeResponse = false;\r\n this._connectionState = HubConnectionState.Disconnected;\r\n this._connectionStarted = false;\r\n this._cachedPingMessage = this._protocol.writeMessage({ type: MessageType.Ping });\r\n }\r\n /** Indicates the state of the {@link HubConnection} to the server. */\r\n get state() {\r\n return this._connectionState;\r\n }\r\n /** Represents the connection id of the {@link HubConnection} on the server. The connection id will be null when the connection is either\r\n * in the disconnected state or if the negotiation step was skipped.\r\n */\r\n get connectionId() {\r\n return this.connection ? (this.connection.connectionId || null) : null;\r\n }\r\n /** Indicates the url of the {@link HubConnection} to the server. */\r\n get baseUrl() {\r\n return this.connection.baseUrl || \"\";\r\n }\r\n /**\r\n * Sets a new url for the HubConnection. Note that the url can only be changed when the connection is in either the Disconnected or\r\n * Reconnecting states.\r\n * @param {string} url The url to connect to.\r\n */\r\n set baseUrl(url) {\r\n if (this._connectionState !== HubConnectionState.Disconnected && this._connectionState !== HubConnectionState.Reconnecting) {\r\n throw new Error(\"The HubConnection must be in the Disconnected or Reconnecting state to change the url.\");\r\n }\r\n if (!url) {\r\n throw new Error(\"The HubConnection url must be a valid url.\");\r\n }\r\n this.connection.baseUrl = url;\r\n }\r\n /** Starts the connection.\r\n *\r\n * @returns {Promise} A Promise that resolves when the connection has been successfully established, or rejects with an error.\r\n */\r\n start() {\r\n this._startPromise = this._startWithStateTransitions();\r\n return this._startPromise;\r\n }\r\n async _startWithStateTransitions() {\r\n if (this._connectionState !== HubConnectionState.Disconnected) {\r\n return Promise.reject(new Error(\"Cannot start a HubConnection that is not in the 'Disconnected' state.\"));\r\n }\r\n this._connectionState = HubConnectionState.Connecting;\r\n this._logger.log(LogLevel.Debug, \"Starting HubConnection.\");\r\n try {\r\n await this._startInternal();\r\n if (Platform.isBrowser) {\r\n // Log when the browser freezes the tab so users know why their connection unexpectedly stopped working\r\n window.document.addEventListener(\"freeze\", this._freezeEventListener);\r\n }\r\n this._connectionState = HubConnectionState.Connected;\r\n this._connectionStarted = true;\r\n this._logger.log(LogLevel.Debug, \"HubConnection connected successfully.\");\r\n }\r\n catch (e) {\r\n this._connectionState = HubConnectionState.Disconnected;\r\n this._logger.log(LogLevel.Debug, `HubConnection failed to start successfully because of error '${e}'.`);\r\n return Promise.reject(e);\r\n }\r\n }\r\n async _startInternal() {\r\n this._stopDuringStartError = undefined;\r\n this._receivedHandshakeResponse = false;\r\n // Set up the promise before any connection is (re)started otherwise it could race with received messages\r\n const handshakePromise = new Promise((resolve, reject) => {\r\n this._handshakeResolver = resolve;\r\n this._handshakeRejecter = reject;\r\n });\r\n await this.connection.start(this._protocol.transferFormat);\r\n try {\r\n let version = this._protocol.version;\r\n if (!this.connection.features.reconnect) {\r\n // Stateful Reconnect starts with HubProtocol version 2, newer clients connecting to older servers will fail to connect due to\r\n // the handshake only supporting version 1, so we will try to send version 1 during the handshake to keep old servers working.\r\n version = 1;\r\n }\r\n const handshakeRequest = {\r\n protocol: this._protocol.name,\r\n version,\r\n };\r\n this._logger.log(LogLevel.Debug, \"Sending handshake request.\");\r\n await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(handshakeRequest));\r\n this._logger.log(LogLevel.Information, `Using HubProtocol '${this._protocol.name}'.`);\r\n // defensively cleanup timeout in case we receive a message from the server before we finish start\r\n this._cleanupTimeout();\r\n this._resetTimeoutPeriod();\r\n this._resetKeepAliveInterval();\r\n await handshakePromise;\r\n // It's important to check the stopDuringStartError instead of just relying on the handshakePromise\r\n // being rejected on close, because this continuation can run after both the handshake completed successfully\r\n // and the connection was closed.\r\n if (this._stopDuringStartError) {\r\n // It's important to throw instead of returning a rejected promise, because we don't want to allow any state\r\n // transitions to occur between now and the calling code observing the exceptions. Returning a rejected promise\r\n // will cause the calling continuation to get scheduled to run later.\r\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\r\n throw this._stopDuringStartError;\r\n }\r\n const useStatefulReconnect = this.connection.features.reconnect || false;\r\n if (useStatefulReconnect) {\r\n this._messageBuffer = new MessageBuffer(this._protocol, this.connection, this._statefulReconnectBufferSize);\r\n this.connection.features.disconnected = this._messageBuffer._disconnected.bind(this._messageBuffer);\r\n this.connection.features.resend = () => {\r\n if (this._messageBuffer) {\r\n return this._messageBuffer._resend();\r\n }\r\n };\r\n }\r\n if (!this.connection.features.inherentKeepAlive) {\r\n await this._sendMessage(this._cachedPingMessage);\r\n }\r\n }\r\n catch (e) {\r\n this._logger.log(LogLevel.Debug, `Hub handshake failed with error '${e}' during start(). Stopping HubConnection.`);\r\n this._cleanupTimeout();\r\n this._cleanupPingTimer();\r\n // HttpConnection.stop() should not complete until after the onclose callback is invoked.\r\n // This will transition the HubConnection to the disconnected state before HttpConnection.stop() completes.\r\n await this.connection.stop(e);\r\n throw e;\r\n }\r\n }\r\n /** Stops the connection.\r\n *\r\n * @returns {Promise} A Promise that resolves when the connection has been successfully terminated, or rejects with an error.\r\n */\r\n async stop() {\r\n // Capture the start promise before the connection might be restarted in an onclose callback.\r\n const startPromise = this._startPromise;\r\n this.connection.features.reconnect = false;\r\n this._stopPromise = this._stopInternal();\r\n await this._stopPromise;\r\n try {\r\n // Awaiting undefined continues immediately\r\n await startPromise;\r\n }\r\n catch (e) {\r\n // This exception is returned to the user as a rejected Promise from the start method.\r\n }\r\n }\r\n _stopInternal(error) {\r\n if (this._connectionState === HubConnectionState.Disconnected) {\r\n this._logger.log(LogLevel.Debug, `Call to HubConnection.stop(${error}) ignored because it is already in the disconnected state.`);\r\n return Promise.resolve();\r\n }\r\n if (this._connectionState === HubConnectionState.Disconnecting) {\r\n this._logger.log(LogLevel.Debug, `Call to HttpConnection.stop(${error}) ignored because the connection is already in the disconnecting state.`);\r\n return this._stopPromise;\r\n }\r\n const state = this._connectionState;\r\n this._connectionState = HubConnectionState.Disconnecting;\r\n this._logger.log(LogLevel.Debug, \"Stopping HubConnection.\");\r\n if (this._reconnectDelayHandle) {\r\n // We're in a reconnect delay which means the underlying connection is currently already stopped.\r\n // Just clear the handle to stop the reconnect loop (which no one is waiting on thankfully) and\r\n // fire the onclose callbacks.\r\n this._logger.log(LogLevel.Debug, \"Connection stopped during reconnect delay. Done reconnecting.\");\r\n clearTimeout(this._reconnectDelayHandle);\r\n this._reconnectDelayHandle = undefined;\r\n this._completeClose();\r\n return Promise.resolve();\r\n }\r\n if (state === HubConnectionState.Connected) {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this._sendCloseMessage();\r\n }\r\n this._cleanupTimeout();\r\n this._cleanupPingTimer();\r\n this._stopDuringStartError = error || new AbortError(\"The connection was stopped before the hub handshake could complete.\");\r\n // HttpConnection.stop() should not complete until after either HttpConnection.start() fails\r\n // or the onclose callback is invoked. The onclose callback will transition the HubConnection\r\n // to the disconnected state if need be before HttpConnection.stop() completes.\r\n return this.connection.stop(error);\r\n }\r\n async _sendCloseMessage() {\r\n try {\r\n await this._sendWithProtocol(this._createCloseMessage());\r\n }\r\n catch {\r\n // Ignore, this is a best effort attempt to let the server know the client closed gracefully.\r\n }\r\n }\r\n /** Invokes a streaming hub method on the server using the specified name and arguments.\r\n *\r\n * @typeparam T The type of the items returned by the server.\r\n * @param {string} methodName The name of the server method to invoke.\r\n * @param {any[]} args The arguments used to invoke the server method.\r\n * @returns {IStreamResult} An object that yields results from the server as they are received.\r\n */\r\n stream(methodName, ...args) {\r\n const [streams, streamIds] = this._replaceStreamingParams(args);\r\n const invocationDescriptor = this._createStreamInvocation(methodName, args, streamIds);\r\n // eslint-disable-next-line prefer-const\r\n let promiseQueue;\r\n const subject = new Subject();\r\n subject.cancelCallback = () => {\r\n const cancelInvocation = this._createCancelInvocation(invocationDescriptor.invocationId);\r\n delete this._callbacks[invocationDescriptor.invocationId];\r\n return promiseQueue.then(() => {\r\n return this._sendWithProtocol(cancelInvocation);\r\n });\r\n };\r\n this._callbacks[invocationDescriptor.invocationId] = (invocationEvent, error) => {\r\n if (error) {\r\n subject.error(error);\r\n return;\r\n }\r\n else if (invocationEvent) {\r\n // invocationEvent will not be null when an error is not passed to the callback\r\n if (invocationEvent.type === MessageType.Completion) {\r\n if (invocationEvent.error) {\r\n subject.error(new Error(invocationEvent.error));\r\n }\r\n else {\r\n subject.complete();\r\n }\r\n }\r\n else {\r\n subject.next((invocationEvent.item));\r\n }\r\n }\r\n };\r\n promiseQueue = this._sendWithProtocol(invocationDescriptor)\r\n .catch((e) => {\r\n subject.error(e);\r\n delete this._callbacks[invocationDescriptor.invocationId];\r\n });\r\n this._launchStreams(streams, promiseQueue);\r\n return subject;\r\n }\r\n _sendMessage(message) {\r\n this._resetKeepAliveInterval();\r\n return this.connection.send(message);\r\n }\r\n /**\r\n * Sends a js object to the server.\r\n * @param message The js object to serialize and send.\r\n */\r\n _sendWithProtocol(message) {\r\n if (this._messageBuffer) {\r\n return this._messageBuffer._send(message);\r\n }\r\n else {\r\n return this._sendMessage(this._protocol.writeMessage(message));\r\n }\r\n }\r\n /** Invokes a hub method on the server using the specified name and arguments. Does not wait for a response from the receiver.\r\n *\r\n * The Promise returned by this method resolves when the client has sent the invocation to the server. The server may still\r\n * be processing the invocation.\r\n *\r\n * @param {string} methodName The name of the server method to invoke.\r\n * @param {any[]} args The arguments used to invoke the server method.\r\n * @returns {Promise} A Promise that resolves when the invocation has been successfully sent, or rejects with an error.\r\n */\r\n send(methodName, ...args) {\r\n const [streams, streamIds] = this._replaceStreamingParams(args);\r\n const sendPromise = this._sendWithProtocol(this._createInvocation(methodName, args, true, streamIds));\r\n this._launchStreams(streams, sendPromise);\r\n return sendPromise;\r\n }\r\n /** Invokes a hub method on the server using the specified name and arguments.\r\n *\r\n * The Promise returned by this method resolves when the server indicates it has finished invoking the method. When the promise\r\n * resolves, the server has finished invoking the method. If the server method returns a result, it is produced as the result of\r\n * resolving the Promise.\r\n *\r\n * @typeparam T The expected return type.\r\n * @param {string} methodName The name of the server method to invoke.\r\n * @param {any[]} args The arguments used to invoke the server method.\r\n * @returns {Promise} A Promise that resolves with the result of the server method (if any), or rejects with an error.\r\n */\r\n invoke(methodName, ...args) {\r\n const [streams, streamIds] = this._replaceStreamingParams(args);\r\n const invocationDescriptor = this._createInvocation(methodName, args, false, streamIds);\r\n const p = new Promise((resolve, reject) => {\r\n // invocationId will always have a value for a non-blocking invocation\r\n this._callbacks[invocationDescriptor.invocationId] = (invocationEvent, error) => {\r\n if (error) {\r\n reject(error);\r\n return;\r\n }\r\n else if (invocationEvent) {\r\n // invocationEvent will not be null when an error is not passed to the callback\r\n if (invocationEvent.type === MessageType.Completion) {\r\n if (invocationEvent.error) {\r\n reject(new Error(invocationEvent.error));\r\n }\r\n else {\r\n resolve(invocationEvent.result);\r\n }\r\n }\r\n else {\r\n reject(new Error(`Unexpected message type: ${invocationEvent.type}`));\r\n }\r\n }\r\n };\r\n const promiseQueue = this._sendWithProtocol(invocationDescriptor)\r\n .catch((e) => {\r\n reject(e);\r\n // invocationId will always have a value for a non-blocking invocation\r\n delete this._callbacks[invocationDescriptor.invocationId];\r\n });\r\n this._launchStreams(streams, promiseQueue);\r\n });\r\n return p;\r\n }\r\n on(methodName, newMethod) {\r\n if (!methodName || !newMethod) {\r\n return;\r\n }\r\n methodName = methodName.toLowerCase();\r\n if (!this._methods[methodName]) {\r\n this._methods[methodName] = [];\r\n }\r\n // Preventing adding the same handler multiple times.\r\n if (this._methods[methodName].indexOf(newMethod) !== -1) {\r\n return;\r\n }\r\n this._methods[methodName].push(newMethod);\r\n }\r\n off(methodName, method) {\r\n if (!methodName) {\r\n return;\r\n }\r\n methodName = methodName.toLowerCase();\r\n const handlers = this._methods[methodName];\r\n if (!handlers) {\r\n return;\r\n }\r\n if (method) {\r\n const removeIdx = handlers.indexOf(method);\r\n if (removeIdx !== -1) {\r\n handlers.splice(removeIdx, 1);\r\n if (handlers.length === 0) {\r\n delete this._methods[methodName];\r\n }\r\n }\r\n }\r\n else {\r\n delete this._methods[methodName];\r\n }\r\n }\r\n /** Registers a handler that will be invoked when the connection is closed.\r\n *\r\n * @param {Function} callback The handler that will be invoked when the connection is closed. Optionally receives a single argument containing the error that caused the connection to close (if any).\r\n */\r\n onclose(callback) {\r\n if (callback) {\r\n this._closedCallbacks.push(callback);\r\n }\r\n }\r\n /** Registers a handler that will be invoked when the connection starts reconnecting.\r\n *\r\n * @param {Function} callback The handler that will be invoked when the connection starts reconnecting. Optionally receives a single argument containing the error that caused the connection to start reconnecting (if any).\r\n */\r\n onreconnecting(callback) {\r\n if (callback) {\r\n this._reconnectingCallbacks.push(callback);\r\n }\r\n }\r\n /** Registers a handler that will be invoked when the connection successfully reconnects.\r\n *\r\n * @param {Function} callback The handler that will be invoked when the connection successfully reconnects.\r\n */\r\n onreconnected(callback) {\r\n if (callback) {\r\n this._reconnectedCallbacks.push(callback);\r\n }\r\n }\r\n _processIncomingData(data) {\r\n this._cleanupTimeout();\r\n if (!this._receivedHandshakeResponse) {\r\n data = this._processHandshakeResponse(data);\r\n this._receivedHandshakeResponse = true;\r\n }\r\n // Data may have all been read when processing handshake response\r\n if (data) {\r\n // Parse the messages\r\n const messages = this._protocol.parseMessages(data, this._logger);\r\n for (const message of messages) {\r\n if (this._messageBuffer && !this._messageBuffer._shouldProcessMessage(message)) {\r\n // Don't process the message, we are either waiting for a SequenceMessage or received a duplicate message\r\n continue;\r\n }\r\n switch (message.type) {\r\n case MessageType.Invocation:\r\n this._invokeClientMethod(message)\r\n .catch((e) => {\r\n this._logger.log(LogLevel.Error, `Invoke client method threw error: ${getErrorString(e)}`);\r\n });\r\n break;\r\n case MessageType.StreamItem:\r\n case MessageType.Completion: {\r\n const callback = this._callbacks[message.invocationId];\r\n if (callback) {\r\n if (message.type === MessageType.Completion) {\r\n delete this._callbacks[message.invocationId];\r\n }\r\n try {\r\n callback(message);\r\n }\r\n catch (e) {\r\n this._logger.log(LogLevel.Error, `Stream callback threw error: ${getErrorString(e)}`);\r\n }\r\n }\r\n break;\r\n }\r\n case MessageType.Ping:\r\n // Don't care about pings\r\n break;\r\n case MessageType.Close: {\r\n this._logger.log(LogLevel.Information, \"Close message received from server.\");\r\n const error = message.error ? new Error(\"Server returned an error on close: \" + message.error) : undefined;\r\n if (message.allowReconnect === true) {\r\n // It feels wrong not to await connection.stop() here, but processIncomingData is called as part of an onreceive callback which is not async,\r\n // this is already the behavior for serverTimeout(), and HttpConnection.Stop() should catch and log all possible exceptions.\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.connection.stop(error);\r\n }\r\n else {\r\n // We cannot await stopInternal() here, but subsequent calls to stop() will await this if stopInternal() is still ongoing.\r\n this._stopPromise = this._stopInternal(error);\r\n }\r\n break;\r\n }\r\n case MessageType.Ack:\r\n if (this._messageBuffer) {\r\n this._messageBuffer._ack(message);\r\n }\r\n break;\r\n case MessageType.Sequence:\r\n if (this._messageBuffer) {\r\n this._messageBuffer._resetSequence(message);\r\n }\r\n break;\r\n default:\r\n this._logger.log(LogLevel.Warning, `Invalid message type: ${message.type}.`);\r\n break;\r\n }\r\n }\r\n }\r\n this._resetTimeoutPeriod();\r\n }\r\n _processHandshakeResponse(data) {\r\n let responseMessage;\r\n let remainingData;\r\n try {\r\n [remainingData, responseMessage] = this._handshakeProtocol.parseHandshakeResponse(data);\r\n }\r\n catch (e) {\r\n const message = \"Error parsing handshake response: \" + e;\r\n this._logger.log(LogLevel.Error, message);\r\n const error = new Error(message);\r\n this._handshakeRejecter(error);\r\n throw error;\r\n }\r\n if (responseMessage.error) {\r\n const message = \"Server returned handshake error: \" + responseMessage.error;\r\n this._logger.log(LogLevel.Error, message);\r\n const error = new Error(message);\r\n this._handshakeRejecter(error);\r\n throw error;\r\n }\r\n else {\r\n this._logger.log(LogLevel.Debug, \"Server handshake complete.\");\r\n }\r\n this._handshakeResolver();\r\n return remainingData;\r\n }\r\n _resetKeepAliveInterval() {\r\n if (this.connection.features.inherentKeepAlive) {\r\n return;\r\n }\r\n // Set the time we want the next keep alive to be sent\r\n // Timer will be setup on next message receive\r\n this._nextKeepAlive = new Date().getTime() + this.keepAliveIntervalInMilliseconds;\r\n this._cleanupPingTimer();\r\n }\r\n _resetTimeoutPeriod() {\r\n if (!this.connection.features || !this.connection.features.inherentKeepAlive) {\r\n // Set the timeout timer\r\n this._timeoutHandle = setTimeout(() => this.serverTimeout(), this.serverTimeoutInMilliseconds);\r\n // Set keepAlive timer if there isn't one\r\n if (this._pingServerHandle === undefined) {\r\n let nextPing = this._nextKeepAlive - new Date().getTime();\r\n if (nextPing < 0) {\r\n nextPing = 0;\r\n }\r\n // The timer needs to be set from a networking callback to avoid Chrome timer throttling from causing timers to run once a minute\r\n this._pingServerHandle = setTimeout(async () => {\r\n if (this._connectionState === HubConnectionState.Connected) {\r\n try {\r\n await this._sendMessage(this._cachedPingMessage);\r\n }\r\n catch {\r\n // We don't care about the error. It should be seen elsewhere in the client.\r\n // The connection is probably in a bad or closed state now, cleanup the timer so it stops triggering\r\n this._cleanupPingTimer();\r\n }\r\n }\r\n }, nextPing);\r\n }\r\n }\r\n }\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n serverTimeout() {\r\n // The server hasn't talked to us in a while. It doesn't like us anymore ... :(\r\n // Terminate the connection, but we don't need to wait on the promise. This could trigger reconnecting.\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.connection.stop(new Error(\"Server timeout elapsed without receiving a message from the server.\"));\r\n }\r\n async _invokeClientMethod(invocationMessage) {\r\n const methodName = invocationMessage.target.toLowerCase();\r\n const methods = this._methods[methodName];\r\n if (!methods) {\r\n this._logger.log(LogLevel.Warning, `No client method with the name '${methodName}' found.`);\r\n // No handlers provided by client but the server is expecting a response still, so we send an error\r\n if (invocationMessage.invocationId) {\r\n this._logger.log(LogLevel.Warning, `No result given for '${methodName}' method and invocation ID '${invocationMessage.invocationId}'.`);\r\n await this._sendWithProtocol(this._createCompletionMessage(invocationMessage.invocationId, \"Client didn't provide a result.\", null));\r\n }\r\n return;\r\n }\r\n // Avoid issues with handlers removing themselves thus modifying the list while iterating through it\r\n const methodsCopy = methods.slice();\r\n // Server expects a response\r\n const expectsResponse = invocationMessage.invocationId ? true : false;\r\n // We preserve the last result or exception but still call all handlers\r\n let res;\r\n let exception;\r\n let completionMessage;\r\n for (const m of methodsCopy) {\r\n try {\r\n const prevRes = res;\r\n res = await m.apply(this, invocationMessage.arguments);\r\n if (expectsResponse && res && prevRes) {\r\n this._logger.log(LogLevel.Error, `Multiple results provided for '${methodName}'. Sending error to server.`);\r\n completionMessage = this._createCompletionMessage(invocationMessage.invocationId, `Client provided multiple results.`, null);\r\n }\r\n // Ignore exception if we got a result after, the exception will be logged\r\n exception = undefined;\r\n }\r\n catch (e) {\r\n exception = e;\r\n this._logger.log(LogLevel.Error, `A callback for the method '${methodName}' threw error '${e}'.`);\r\n }\r\n }\r\n if (completionMessage) {\r\n await this._sendWithProtocol(completionMessage);\r\n }\r\n else if (expectsResponse) {\r\n // If there is an exception that means either no result was given or a handler after a result threw\r\n if (exception) {\r\n completionMessage = this._createCompletionMessage(invocationMessage.invocationId, `${exception}`, null);\r\n }\r\n else if (res !== undefined) {\r\n completionMessage = this._createCompletionMessage(invocationMessage.invocationId, null, res);\r\n }\r\n else {\r\n this._logger.log(LogLevel.Warning, `No result given for '${methodName}' method and invocation ID '${invocationMessage.invocationId}'.`);\r\n // Client didn't provide a result or throw from a handler, server expects a response so we send an error\r\n completionMessage = this._createCompletionMessage(invocationMessage.invocationId, \"Client didn't provide a result.\", null);\r\n }\r\n await this._sendWithProtocol(completionMessage);\r\n }\r\n else {\r\n if (res) {\r\n this._logger.log(LogLevel.Error, `Result given for '${methodName}' method but server is not expecting a result.`);\r\n }\r\n }\r\n }\r\n _connectionClosed(error) {\r\n this._logger.log(LogLevel.Debug, `HubConnection.connectionClosed(${error}) called while in state ${this._connectionState}.`);\r\n // Triggering this.handshakeRejecter is insufficient because it could already be resolved without the continuation having run yet.\r\n this._stopDuringStartError = this._stopDuringStartError || error || new AbortError(\"The underlying connection was closed before the hub handshake could complete.\");\r\n // If the handshake is in progress, start will be waiting for the handshake promise, so we complete it.\r\n // If it has already completed, this should just noop.\r\n if (this._handshakeResolver) {\r\n this._handshakeResolver();\r\n }\r\n this._cancelCallbacksWithError(error || new Error(\"Invocation canceled due to the underlying connection being closed.\"));\r\n this._cleanupTimeout();\r\n this._cleanupPingTimer();\r\n if (this._connectionState === HubConnectionState.Disconnecting) {\r\n this._completeClose(error);\r\n }\r\n else if (this._connectionState === HubConnectionState.Connected && this._reconnectPolicy) {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this._reconnect(error);\r\n }\r\n else if (this._connectionState === HubConnectionState.Connected) {\r\n this._completeClose(error);\r\n }\r\n // If none of the above if conditions were true were called the HubConnection must be in either:\r\n // 1. The Connecting state in which case the handshakeResolver will complete it and stopDuringStartError will fail it.\r\n // 2. The Reconnecting state in which case the handshakeResolver will complete it and stopDuringStartError will fail the current reconnect attempt\r\n // and potentially continue the reconnect() loop.\r\n // 3. The Disconnected state in which case we're already done.\r\n }\r\n _completeClose(error) {\r\n if (this._connectionStarted) {\r\n this._connectionState = HubConnectionState.Disconnected;\r\n this._connectionStarted = false;\r\n if (this._messageBuffer) {\r\n this._messageBuffer._dispose(error !== null && error !== void 0 ? error : new Error(\"Connection closed.\"));\r\n this._messageBuffer = undefined;\r\n }\r\n if (Platform.isBrowser) {\r\n window.document.removeEventListener(\"freeze\", this._freezeEventListener);\r\n }\r\n try {\r\n this._closedCallbacks.forEach((c) => c.apply(this, [error]));\r\n }\r\n catch (e) {\r\n this._logger.log(LogLevel.Error, `An onclose callback called with error '${error}' threw error '${e}'.`);\r\n }\r\n }\r\n }\r\n async _reconnect(error) {\r\n const reconnectStartTime = Date.now();\r\n let previousReconnectAttempts = 0;\r\n let retryError = error !== undefined ? error : new Error(\"Attempting to reconnect due to a unknown error.\");\r\n let nextRetryDelay = this._getNextRetryDelay(previousReconnectAttempts++, 0, retryError);\r\n if (nextRetryDelay === null) {\r\n this._logger.log(LogLevel.Debug, \"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt.\");\r\n this._completeClose(error);\r\n return;\r\n }\r\n this._connectionState = HubConnectionState.Reconnecting;\r\n if (error) {\r\n this._logger.log(LogLevel.Information, `Connection reconnecting because of error '${error}'.`);\r\n }\r\n else {\r\n this._logger.log(LogLevel.Information, \"Connection reconnecting.\");\r\n }\r\n if (this._reconnectingCallbacks.length !== 0) {\r\n try {\r\n this._reconnectingCallbacks.forEach((c) => c.apply(this, [error]));\r\n }\r\n catch (e) {\r\n this._logger.log(LogLevel.Error, `An onreconnecting callback called with error '${error}' threw error '${e}'.`);\r\n }\r\n // Exit early if an onreconnecting callback called connection.stop().\r\n if (this._connectionState !== HubConnectionState.Reconnecting) {\r\n this._logger.log(LogLevel.Debug, \"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.\");\r\n return;\r\n }\r\n }\r\n while (nextRetryDelay !== null) {\r\n this._logger.log(LogLevel.Information, `Reconnect attempt number ${previousReconnectAttempts} will start in ${nextRetryDelay} ms.`);\r\n await new Promise((resolve) => {\r\n this._reconnectDelayHandle = setTimeout(resolve, nextRetryDelay);\r\n });\r\n this._reconnectDelayHandle = undefined;\r\n if (this._connectionState !== HubConnectionState.Reconnecting) {\r\n this._logger.log(LogLevel.Debug, \"Connection left the reconnecting state during reconnect delay. Done reconnecting.\");\r\n return;\r\n }\r\n try {\r\n await this._startInternal();\r\n this._connectionState = HubConnectionState.Connected;\r\n this._logger.log(LogLevel.Information, \"HubConnection reconnected successfully.\");\r\n if (this._reconnectedCallbacks.length !== 0) {\r\n try {\r\n this._reconnectedCallbacks.forEach((c) => c.apply(this, [this.connection.connectionId]));\r\n }\r\n catch (e) {\r\n this._logger.log(LogLevel.Error, `An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${e}'.`);\r\n }\r\n }\r\n return;\r\n }\r\n catch (e) {\r\n this._logger.log(LogLevel.Information, `Reconnect attempt failed because of error '${e}'.`);\r\n if (this._connectionState !== HubConnectionState.Reconnecting) {\r\n this._logger.log(LogLevel.Debug, `Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`);\r\n // The TypeScript compiler thinks that connectionState must be Connected here. The TypeScript compiler is wrong.\r\n if (this._connectionState === HubConnectionState.Disconnecting) {\r\n this._completeClose();\r\n }\r\n return;\r\n }\r\n retryError = e instanceof Error ? e : new Error(e.toString());\r\n nextRetryDelay = this._getNextRetryDelay(previousReconnectAttempts++, Date.now() - reconnectStartTime, retryError);\r\n }\r\n }\r\n this._logger.log(LogLevel.Information, `Reconnect retries have been exhausted after ${Date.now() - reconnectStartTime} ms and ${previousReconnectAttempts} failed attempts. Connection disconnecting.`);\r\n this._completeClose();\r\n }\r\n _getNextRetryDelay(previousRetryCount, elapsedMilliseconds, retryReason) {\r\n try {\r\n return this._reconnectPolicy.nextRetryDelayInMilliseconds({\r\n elapsedMilliseconds,\r\n previousRetryCount,\r\n retryReason,\r\n });\r\n }\r\n catch (e) {\r\n this._logger.log(LogLevel.Error, `IRetryPolicy.nextRetryDelayInMilliseconds(${previousRetryCount}, ${elapsedMilliseconds}) threw error '${e}'.`);\r\n return null;\r\n }\r\n }\r\n _cancelCallbacksWithError(error) {\r\n const callbacks = this._callbacks;\r\n this._callbacks = {};\r\n Object.keys(callbacks)\r\n .forEach((key) => {\r\n const callback = callbacks[key];\r\n try {\r\n callback(null, error);\r\n }\r\n catch (e) {\r\n this._logger.log(LogLevel.Error, `Stream 'error' callback called with '${error}' threw error: ${getErrorString(e)}`);\r\n }\r\n });\r\n }\r\n _cleanupPingTimer() {\r\n if (this._pingServerHandle) {\r\n clearTimeout(this._pingServerHandle);\r\n this._pingServerHandle = undefined;\r\n }\r\n }\r\n _cleanupTimeout() {\r\n if (this._timeoutHandle) {\r\n clearTimeout(this._timeoutHandle);\r\n }\r\n }\r\n _createInvocation(methodName, args, nonblocking, streamIds) {\r\n if (nonblocking) {\r\n if (streamIds.length !== 0) {\r\n return {\r\n arguments: args,\r\n streamIds,\r\n target: methodName,\r\n type: MessageType.Invocation,\r\n };\r\n }\r\n else {\r\n return {\r\n arguments: args,\r\n target: methodName,\r\n type: MessageType.Invocation,\r\n };\r\n }\r\n }\r\n else {\r\n const invocationId = this._invocationId;\r\n this._invocationId++;\r\n if (streamIds.length !== 0) {\r\n return {\r\n arguments: args,\r\n invocationId: invocationId.toString(),\r\n streamIds,\r\n target: methodName,\r\n type: MessageType.Invocation,\r\n };\r\n }\r\n else {\r\n return {\r\n arguments: args,\r\n invocationId: invocationId.toString(),\r\n target: methodName,\r\n type: MessageType.Invocation,\r\n };\r\n }\r\n }\r\n }\r\n _launchStreams(streams, promiseQueue) {\r\n if (streams.length === 0) {\r\n return;\r\n }\r\n // Synchronize stream data so they arrive in-order on the server\r\n if (!promiseQueue) {\r\n promiseQueue = Promise.resolve();\r\n }\r\n // We want to iterate over the keys, since the keys are the stream ids\r\n // eslint-disable-next-line guard-for-in\r\n for (const streamId in streams) {\r\n streams[streamId].subscribe({\r\n complete: () => {\r\n promiseQueue = promiseQueue.then(() => this._sendWithProtocol(this._createCompletionMessage(streamId)));\r\n },\r\n error: (err) => {\r\n let message;\r\n if (err instanceof Error) {\r\n message = err.message;\r\n }\r\n else if (err && err.toString) {\r\n message = err.toString();\r\n }\r\n else {\r\n message = \"Unknown error\";\r\n }\r\n promiseQueue = promiseQueue.then(() => this._sendWithProtocol(this._createCompletionMessage(streamId, message)));\r\n },\r\n next: (item) => {\r\n promiseQueue = promiseQueue.then(() => this._sendWithProtocol(this._createStreamItemMessage(streamId, item)));\r\n },\r\n });\r\n }\r\n }\r\n _replaceStreamingParams(args) {\r\n const streams = [];\r\n const streamIds = [];\r\n for (let i = 0; i < args.length; i++) {\r\n const argument = args[i];\r\n if (this._isObservable(argument)) {\r\n const streamId = this._invocationId;\r\n this._invocationId++;\r\n // Store the stream for later use\r\n streams[streamId] = argument;\r\n streamIds.push(streamId.toString());\r\n // remove stream from args\r\n args.splice(i, 1);\r\n }\r\n }\r\n return [streams, streamIds];\r\n }\r\n _isObservable(arg) {\r\n // This allows other stream implementations to just work (like rxjs)\r\n return arg && arg.subscribe && typeof arg.subscribe === \"function\";\r\n }\r\n _createStreamInvocation(methodName, args, streamIds) {\r\n const invocationId = this._invocationId;\r\n this._invocationId++;\r\n if (streamIds.length !== 0) {\r\n return {\r\n arguments: args,\r\n invocationId: invocationId.toString(),\r\n streamIds,\r\n target: methodName,\r\n type: MessageType.StreamInvocation,\r\n };\r\n }\r\n else {\r\n return {\r\n arguments: args,\r\n invocationId: invocationId.toString(),\r\n target: methodName,\r\n type: MessageType.StreamInvocation,\r\n };\r\n }\r\n }\r\n _createCancelInvocation(id) {\r\n return {\r\n invocationId: id,\r\n type: MessageType.CancelInvocation,\r\n };\r\n }\r\n _createStreamItemMessage(id, item) {\r\n return {\r\n invocationId: id,\r\n item,\r\n type: MessageType.StreamItem,\r\n };\r\n }\r\n _createCompletionMessage(id, error, result) {\r\n if (error) {\r\n return {\r\n error,\r\n invocationId: id,\r\n type: MessageType.Completion,\r\n };\r\n }\r\n return {\r\n invocationId: id,\r\n result,\r\n type: MessageType.Completion,\r\n };\r\n }\r\n _createCloseMessage() {\r\n return { type: MessageType.Close };\r\n }\r\n}\r\n//# sourceMappingURL=HubConnection.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n// 0, 2, 10, 30 second delays before reconnect attempts.\r\nconst DEFAULT_RETRY_DELAYS_IN_MILLISECONDS = [0, 2000, 10000, 30000, null];\r\n/** @private */\r\nexport class DefaultReconnectPolicy {\r\n constructor(retryDelays) {\r\n this._retryDelays = retryDelays !== undefined ? [...retryDelays, null] : DEFAULT_RETRY_DELAYS_IN_MILLISECONDS;\r\n }\r\n nextRetryDelayInMilliseconds(retryContext) {\r\n return this._retryDelays[retryContext.previousRetryCount];\r\n }\r\n}\r\n//# sourceMappingURL=DefaultReconnectPolicy.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nexport class HeaderNames {\r\n}\r\nHeaderNames.Authorization = \"Authorization\";\r\nHeaderNames.Cookie = \"Cookie\";\r\n//# sourceMappingURL=HeaderNames.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { HeaderNames } from \"./HeaderNames\";\r\nimport { HttpClient } from \"./HttpClient\";\r\n/** @private */\r\nexport class AccessTokenHttpClient extends HttpClient {\r\n constructor(innerClient, accessTokenFactory) {\r\n super();\r\n this._innerClient = innerClient;\r\n this._accessTokenFactory = accessTokenFactory;\r\n }\r\n async send(request) {\r\n let allowRetry = true;\r\n if (this._accessTokenFactory && (!this._accessToken || (request.url && request.url.indexOf(\"/negotiate?\") > 0))) {\r\n // don't retry if the request is a negotiate or if we just got a potentially new token from the access token factory\r\n allowRetry = false;\r\n this._accessToken = await this._accessTokenFactory();\r\n }\r\n this._setAuthorizationHeader(request);\r\n const response = await this._innerClient.send(request);\r\n if (allowRetry && response.statusCode === 401 && this._accessTokenFactory) {\r\n this._accessToken = await this._accessTokenFactory();\r\n this._setAuthorizationHeader(request);\r\n return await this._innerClient.send(request);\r\n }\r\n return response;\r\n }\r\n _setAuthorizationHeader(request) {\r\n if (!request.headers) {\r\n request.headers = {};\r\n }\r\n if (this._accessToken) {\r\n request.headers[HeaderNames.Authorization] = `Bearer ${this._accessToken}`;\r\n }\r\n // don't remove the header if there isn't an access token factory, the user manually added the header in this case\r\n else if (this._accessTokenFactory) {\r\n if (request.headers[HeaderNames.Authorization]) {\r\n delete request.headers[HeaderNames.Authorization];\r\n }\r\n }\r\n }\r\n getCookieString(url) {\r\n return this._innerClient.getCookieString(url);\r\n }\r\n}\r\n//# sourceMappingURL=AccessTokenHttpClient.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n// This will be treated as a bit flag in the future, so we keep it using power-of-two values.\r\n/** Specifies a specific HTTP transport type. */\r\nexport var HttpTransportType;\r\n(function (HttpTransportType) {\r\n /** Specifies no transport preference. */\r\n HttpTransportType[HttpTransportType[\"None\"] = 0] = \"None\";\r\n /** Specifies the WebSockets transport. */\r\n HttpTransportType[HttpTransportType[\"WebSockets\"] = 1] = \"WebSockets\";\r\n /** Specifies the Server-Sent Events transport. */\r\n HttpTransportType[HttpTransportType[\"ServerSentEvents\"] = 2] = \"ServerSentEvents\";\r\n /** Specifies the Long Polling transport. */\r\n HttpTransportType[HttpTransportType[\"LongPolling\"] = 4] = \"LongPolling\";\r\n})(HttpTransportType || (HttpTransportType = {}));\r\n/** Specifies the transfer format for a connection. */\r\nexport var TransferFormat;\r\n(function (TransferFormat) {\r\n /** Specifies that only text data will be transmitted over the connection. */\r\n TransferFormat[TransferFormat[\"Text\"] = 1] = \"Text\";\r\n /** Specifies that binary data will be transmitted over the connection. */\r\n TransferFormat[TransferFormat[\"Binary\"] = 2] = \"Binary\";\r\n})(TransferFormat || (TransferFormat = {}));\r\n//# sourceMappingURL=ITransport.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n// Rough polyfill of https://developer.mozilla.org/en-US/docs/Web/API/AbortController\r\n// We don't actually ever use the API being polyfilled, we always use the polyfill because\r\n// it's a very new API right now.\r\n// Not exported from index.\r\n/** @private */\r\nexport class AbortController {\r\n constructor() {\r\n this._isAborted = false;\r\n this.onabort = null;\r\n }\r\n abort() {\r\n if (!this._isAborted) {\r\n this._isAborted = true;\r\n if (this.onabort) {\r\n this.onabort();\r\n }\r\n }\r\n }\r\n get signal() {\r\n return this;\r\n }\r\n get aborted() {\r\n return this._isAborted;\r\n }\r\n}\r\n//# sourceMappingURL=AbortController.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { AbortController } from \"./AbortController\";\r\nimport { HttpError, TimeoutError } from \"./Errors\";\r\nimport { LogLevel } from \"./ILogger\";\r\nimport { TransferFormat } from \"./ITransport\";\r\nimport { Arg, getDataDetail, getUserAgentHeader, sendMessage } from \"./Utils\";\r\n// Not exported from 'index', this type is internal.\r\n/** @private */\r\nexport class LongPollingTransport {\r\n // This is an internal type, not exported from 'index' so this is really just internal.\r\n get pollAborted() {\r\n return this._pollAbort.aborted;\r\n }\r\n constructor(httpClient, logger, options) {\r\n this._httpClient = httpClient;\r\n this._logger = logger;\r\n this._pollAbort = new AbortController();\r\n this._options = options;\r\n this._running = false;\r\n this.onreceive = null;\r\n this.onclose = null;\r\n }\r\n async connect(url, transferFormat) {\r\n Arg.isRequired(url, \"url\");\r\n Arg.isRequired(transferFormat, \"transferFormat\");\r\n Arg.isIn(transferFormat, TransferFormat, \"transferFormat\");\r\n this._url = url;\r\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Connecting.\");\r\n // Allow binary format on Node and Browsers that support binary content (indicated by the presence of responseType property)\r\n if (transferFormat === TransferFormat.Binary &&\r\n (typeof XMLHttpRequest !== \"undefined\" && typeof new XMLHttpRequest().responseType !== \"string\")) {\r\n throw new Error(\"Binary protocols over XmlHttpRequest not implementing advanced features are not supported.\");\r\n }\r\n const [name, value] = getUserAgentHeader();\r\n const headers = { [name]: value, ...this._options.headers };\r\n const pollOptions = {\r\n abortSignal: this._pollAbort.signal,\r\n headers,\r\n timeout: 100000,\r\n withCredentials: this._options.withCredentials,\r\n };\r\n if (transferFormat === TransferFormat.Binary) {\r\n pollOptions.responseType = \"arraybuffer\";\r\n }\r\n // Make initial long polling request\r\n // Server uses first long polling request to finish initializing connection and it returns without data\r\n const pollUrl = `${url}&_=${Date.now()}`;\r\n this._logger.log(LogLevel.Trace, `(LongPolling transport) polling: ${pollUrl}.`);\r\n const response = await this._httpClient.get(pollUrl, pollOptions);\r\n if (response.statusCode !== 200) {\r\n this._logger.log(LogLevel.Error, `(LongPolling transport) Unexpected response code: ${response.statusCode}.`);\r\n // Mark running as false so that the poll immediately ends and runs the close logic\r\n this._closeError = new HttpError(response.statusText || \"\", response.statusCode);\r\n this._running = false;\r\n }\r\n else {\r\n this._running = true;\r\n }\r\n this._receiving = this._poll(this._url, pollOptions);\r\n }\r\n async _poll(url, pollOptions) {\r\n try {\r\n while (this._running) {\r\n try {\r\n const pollUrl = `${url}&_=${Date.now()}`;\r\n this._logger.log(LogLevel.Trace, `(LongPolling transport) polling: ${pollUrl}.`);\r\n const response = await this._httpClient.get(pollUrl, pollOptions);\r\n if (response.statusCode === 204) {\r\n this._logger.log(LogLevel.Information, \"(LongPolling transport) Poll terminated by server.\");\r\n this._running = false;\r\n }\r\n else if (response.statusCode !== 200) {\r\n this._logger.log(LogLevel.Error, `(LongPolling transport) Unexpected response code: ${response.statusCode}.`);\r\n // Unexpected status code\r\n this._closeError = new HttpError(response.statusText || \"\", response.statusCode);\r\n this._running = false;\r\n }\r\n else {\r\n // Process the response\r\n if (response.content) {\r\n this._logger.log(LogLevel.Trace, `(LongPolling transport) data received. ${getDataDetail(response.content, this._options.logMessageContent)}.`);\r\n if (this.onreceive) {\r\n this.onreceive(response.content);\r\n }\r\n }\r\n else {\r\n // This is another way timeout manifest.\r\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Poll timed out, reissuing.\");\r\n }\r\n }\r\n }\r\n catch (e) {\r\n if (!this._running) {\r\n // Log but disregard errors that occur after stopping\r\n this._logger.log(LogLevel.Trace, `(LongPolling transport) Poll errored after shutdown: ${e.message}`);\r\n }\r\n else {\r\n if (e instanceof TimeoutError) {\r\n // Ignore timeouts and reissue the poll.\r\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Poll timed out, reissuing.\");\r\n }\r\n else {\r\n // Close the connection with the error as the result.\r\n this._closeError = e;\r\n this._running = false;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n finally {\r\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Polling complete.\");\r\n // We will reach here with pollAborted==false when the server returned a response causing the transport to stop.\r\n // If pollAborted==true then client initiated the stop and the stop method will raise the close event after DELETE is sent.\r\n if (!this.pollAborted) {\r\n this._raiseOnClose();\r\n }\r\n }\r\n }\r\n async send(data) {\r\n if (!this._running) {\r\n return Promise.reject(new Error(\"Cannot send until the transport is connected\"));\r\n }\r\n return sendMessage(this._logger, \"LongPolling\", this._httpClient, this._url, data, this._options);\r\n }\r\n async stop() {\r\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Stopping polling.\");\r\n // Tell receiving loop to stop, abort any current request, and then wait for it to finish\r\n this._running = false;\r\n this._pollAbort.abort();\r\n try {\r\n await this._receiving;\r\n // Send DELETE to clean up long polling on the server\r\n this._logger.log(LogLevel.Trace, `(LongPolling transport) sending DELETE request to ${this._url}.`);\r\n const headers = {};\r\n const [name, value] = getUserAgentHeader();\r\n headers[name] = value;\r\n const deleteOptions = {\r\n headers: { ...headers, ...this._options.headers },\r\n timeout: this._options.timeout,\r\n withCredentials: this._options.withCredentials,\r\n };\r\n let error;\r\n try {\r\n await this._httpClient.delete(this._url, deleteOptions);\r\n }\r\n catch (err) {\r\n error = err;\r\n }\r\n if (error) {\r\n if (error instanceof HttpError) {\r\n if (error.statusCode === 404) {\r\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) A 404 response was returned from sending a DELETE request.\");\r\n }\r\n else {\r\n this._logger.log(LogLevel.Trace, `(LongPolling transport) Error sending a DELETE request: ${error}`);\r\n }\r\n }\r\n }\r\n else {\r\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) DELETE request accepted.\");\r\n }\r\n }\r\n finally {\r\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Stop finished.\");\r\n // Raise close event here instead of in polling\r\n // It needs to happen after the DELETE request is sent\r\n this._raiseOnClose();\r\n }\r\n }\r\n _raiseOnClose() {\r\n if (this.onclose) {\r\n let logMessage = \"(LongPolling transport) Firing onclose event.\";\r\n if (this._closeError) {\r\n logMessage += \" Error: \" + this._closeError;\r\n }\r\n this._logger.log(LogLevel.Trace, logMessage);\r\n this.onclose(this._closeError);\r\n }\r\n }\r\n}\r\n//# sourceMappingURL=LongPollingTransport.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { LogLevel } from \"./ILogger\";\r\nimport { TransferFormat } from \"./ITransport\";\r\nimport { Arg, getDataDetail, getUserAgentHeader, Platform, sendMessage } from \"./Utils\";\r\n/** @private */\r\nexport class ServerSentEventsTransport {\r\n constructor(httpClient, accessToken, logger, options) {\r\n this._httpClient = httpClient;\r\n this._accessToken = accessToken;\r\n this._logger = logger;\r\n this._options = options;\r\n this.onreceive = null;\r\n this.onclose = null;\r\n }\r\n async connect(url, transferFormat) {\r\n Arg.isRequired(url, \"url\");\r\n Arg.isRequired(transferFormat, \"transferFormat\");\r\n Arg.isIn(transferFormat, TransferFormat, \"transferFormat\");\r\n this._logger.log(LogLevel.Trace, \"(SSE transport) Connecting.\");\r\n // set url before accessTokenFactory because this._url is only for send and we set the auth header instead of the query string for send\r\n this._url = url;\r\n if (this._accessToken) {\r\n url += (url.indexOf(\"?\") < 0 ? \"?\" : \"&\") + `access_token=${encodeURIComponent(this._accessToken)}`;\r\n }\r\n return new Promise((resolve, reject) => {\r\n let opened = false;\r\n if (transferFormat !== TransferFormat.Text) {\r\n reject(new Error(\"The Server-Sent Events transport only supports the 'Text' transfer format\"));\r\n return;\r\n }\r\n let eventSource;\r\n if (Platform.isBrowser || Platform.isWebWorker) {\r\n eventSource = new this._options.EventSource(url, { withCredentials: this._options.withCredentials });\r\n }\r\n else {\r\n // Non-browser passes cookies via the dictionary\r\n const cookies = this._httpClient.getCookieString(url);\r\n const headers = {};\r\n headers.Cookie = cookies;\r\n const [name, value] = getUserAgentHeader();\r\n headers[name] = value;\r\n eventSource = new this._options.EventSource(url, { withCredentials: this._options.withCredentials, headers: { ...headers, ...this._options.headers } });\r\n }\r\n try {\r\n eventSource.onmessage = (e) => {\r\n if (this.onreceive) {\r\n try {\r\n this._logger.log(LogLevel.Trace, `(SSE transport) data received. ${getDataDetail(e.data, this._options.logMessageContent)}.`);\r\n this.onreceive(e.data);\r\n }\r\n catch (error) {\r\n this._close(error);\r\n return;\r\n }\r\n }\r\n };\r\n // @ts-ignore: not using event on purpose\r\n eventSource.onerror = (e) => {\r\n // EventSource doesn't give any useful information about server side closes.\r\n if (opened) {\r\n this._close();\r\n }\r\n else {\r\n reject(new Error(\"EventSource failed to connect. The connection could not be found on the server,\"\r\n + \" either the connection ID is not present on the server, or a proxy is refusing/buffering the connection.\"\r\n + \" If you have multiple servers check that sticky sessions are enabled.\"));\r\n }\r\n };\r\n eventSource.onopen = () => {\r\n this._logger.log(LogLevel.Information, `SSE connected to ${this._url}`);\r\n this._eventSource = eventSource;\r\n opened = true;\r\n resolve();\r\n };\r\n }\r\n catch (e) {\r\n reject(e);\r\n return;\r\n }\r\n });\r\n }\r\n async send(data) {\r\n if (!this._eventSource) {\r\n return Promise.reject(new Error(\"Cannot send until the transport is connected\"));\r\n }\r\n return sendMessage(this._logger, \"SSE\", this._httpClient, this._url, data, this._options);\r\n }\r\n stop() {\r\n this._close();\r\n return Promise.resolve();\r\n }\r\n _close(e) {\r\n if (this._eventSource) {\r\n this._eventSource.close();\r\n this._eventSource = undefined;\r\n if (this.onclose) {\r\n this.onclose(e);\r\n }\r\n }\r\n }\r\n}\r\n//# sourceMappingURL=ServerSentEventsTransport.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { HeaderNames } from \"./HeaderNames\";\r\nimport { LogLevel } from \"./ILogger\";\r\nimport { TransferFormat } from \"./ITransport\";\r\nimport { Arg, getDataDetail, getUserAgentHeader, Platform } from \"./Utils\";\r\n/** @private */\r\nexport class WebSocketTransport {\r\n constructor(httpClient, accessTokenFactory, logger, logMessageContent, webSocketConstructor, headers) {\r\n this._logger = logger;\r\n this._accessTokenFactory = accessTokenFactory;\r\n this._logMessageContent = logMessageContent;\r\n this._webSocketConstructor = webSocketConstructor;\r\n this._httpClient = httpClient;\r\n this.onreceive = null;\r\n this.onclose = null;\r\n this._headers = headers;\r\n }\r\n async connect(url, transferFormat) {\r\n Arg.isRequired(url, \"url\");\r\n Arg.isRequired(transferFormat, \"transferFormat\");\r\n Arg.isIn(transferFormat, TransferFormat, \"transferFormat\");\r\n this._logger.log(LogLevel.Trace, \"(WebSockets transport) Connecting.\");\r\n let token;\r\n if (this._accessTokenFactory) {\r\n token = await this._accessTokenFactory();\r\n }\r\n return new Promise((resolve, reject) => {\r\n url = url.replace(/^http/, \"ws\");\r\n let webSocket;\r\n const cookies = this._httpClient.getCookieString(url);\r\n let opened = false;\r\n if (Platform.isNode || Platform.isReactNative) {\r\n const headers = {};\r\n const [name, value] = getUserAgentHeader();\r\n headers[name] = value;\r\n if (token) {\r\n headers[HeaderNames.Authorization] = `Bearer ${token}`;\r\n }\r\n if (cookies) {\r\n headers[HeaderNames.Cookie] = cookies;\r\n }\r\n // Only pass headers when in non-browser environments\r\n webSocket = new this._webSocketConstructor(url, undefined, {\r\n headers: { ...headers, ...this._headers },\r\n });\r\n }\r\n else {\r\n if (token) {\r\n url += (url.indexOf(\"?\") < 0 ? \"?\" : \"&\") + `access_token=${encodeURIComponent(token)}`;\r\n }\r\n }\r\n if (!webSocket) {\r\n // Chrome is not happy with passing 'undefined' as protocol\r\n webSocket = new this._webSocketConstructor(url);\r\n }\r\n if (transferFormat === TransferFormat.Binary) {\r\n webSocket.binaryType = \"arraybuffer\";\r\n }\r\n webSocket.onopen = (_event) => {\r\n this._logger.log(LogLevel.Information, `WebSocket connected to ${url}.`);\r\n this._webSocket = webSocket;\r\n opened = true;\r\n resolve();\r\n };\r\n webSocket.onerror = (event) => {\r\n let error = null;\r\n // ErrorEvent is a browser only type we need to check if the type exists before using it\r\n if (typeof ErrorEvent !== \"undefined\" && event instanceof ErrorEvent) {\r\n error = event.error;\r\n }\r\n else {\r\n error = \"There was an error with the transport\";\r\n }\r\n this._logger.log(LogLevel.Information, `(WebSockets transport) ${error}.`);\r\n };\r\n webSocket.onmessage = (message) => {\r\n this._logger.log(LogLevel.Trace, `(WebSockets transport) data received. ${getDataDetail(message.data, this._logMessageContent)}.`);\r\n if (this.onreceive) {\r\n try {\r\n this.onreceive(message.data);\r\n }\r\n catch (error) {\r\n this._close(error);\r\n return;\r\n }\r\n }\r\n };\r\n webSocket.onclose = (event) => {\r\n // Don't call close handler if connection was never established\r\n // We'll reject the connect call instead\r\n if (opened) {\r\n this._close(event);\r\n }\r\n else {\r\n let error = null;\r\n // ErrorEvent is a browser only type we need to check if the type exists before using it\r\n if (typeof ErrorEvent !== \"undefined\" && event instanceof ErrorEvent) {\r\n error = event.error;\r\n }\r\n else {\r\n error = \"WebSocket failed to connect. The connection could not be found on the server,\"\r\n + \" either the endpoint may not be a SignalR endpoint,\"\r\n + \" the connection ID is not present on the server, or there is a proxy blocking WebSockets.\"\r\n + \" If you have multiple servers check that sticky sessions are enabled.\";\r\n }\r\n reject(new Error(error));\r\n }\r\n };\r\n });\r\n }\r\n send(data) {\r\n if (this._webSocket && this._webSocket.readyState === this._webSocketConstructor.OPEN) {\r\n this._logger.log(LogLevel.Trace, `(WebSockets transport) sending data. ${getDataDetail(data, this._logMessageContent)}.`);\r\n this._webSocket.send(data);\r\n return Promise.resolve();\r\n }\r\n return Promise.reject(\"WebSocket is not in the OPEN state\");\r\n }\r\n stop() {\r\n if (this._webSocket) {\r\n // Manually invoke onclose callback inline so we know the HttpConnection was closed properly before returning\r\n // This also solves an issue where websocket.onclose could take 18+ seconds to trigger during network disconnects\r\n this._close(undefined);\r\n }\r\n return Promise.resolve();\r\n }\r\n _close(event) {\r\n // webSocket will be null if the transport did not start successfully\r\n if (this._webSocket) {\r\n // Clear websocket handlers because we are considering the socket closed now\r\n this._webSocket.onclose = () => { };\r\n this._webSocket.onmessage = () => { };\r\n this._webSocket.onerror = () => { };\r\n this._webSocket.close();\r\n this._webSocket = undefined;\r\n }\r\n this._logger.log(LogLevel.Trace, \"(WebSockets transport) socket closed.\");\r\n if (this.onclose) {\r\n if (this._isCloseEvent(event) && (event.wasClean === false || event.code !== 1000)) {\r\n this.onclose(new Error(`WebSocket closed with status code: ${event.code} (${event.reason || \"no reason given\"}).`));\r\n }\r\n else if (event instanceof Error) {\r\n this.onclose(event);\r\n }\r\n else {\r\n this.onclose();\r\n }\r\n }\r\n }\r\n _isCloseEvent(event) {\r\n return event && typeof event.wasClean === \"boolean\" && typeof event.code === \"number\";\r\n }\r\n}\r\n//# sourceMappingURL=WebSocketTransport.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { AccessTokenHttpClient } from \"./AccessTokenHttpClient\";\r\nimport { DefaultHttpClient } from \"./DefaultHttpClient\";\r\nimport { AggregateErrors, DisabledTransportError, FailedToNegotiateWithServerError, FailedToStartTransportError, HttpError, UnsupportedTransportError, AbortError } from \"./Errors\";\r\nimport { LogLevel } from \"./ILogger\";\r\nimport { HttpTransportType, TransferFormat } from \"./ITransport\";\r\nimport { LongPollingTransport } from \"./LongPollingTransport\";\r\nimport { ServerSentEventsTransport } from \"./ServerSentEventsTransport\";\r\nimport { Arg, createLogger, getUserAgentHeader, Platform } from \"./Utils\";\r\nimport { WebSocketTransport } from \"./WebSocketTransport\";\r\nconst MAX_REDIRECTS = 100;\r\n/** @private */\r\nexport class HttpConnection {\r\n constructor(url, options = {}) {\r\n this._stopPromiseResolver = () => { };\r\n this.features = {};\r\n this._negotiateVersion = 1;\r\n Arg.isRequired(url, \"url\");\r\n this._logger = createLogger(options.logger);\r\n this.baseUrl = this._resolveUrl(url);\r\n options = options || {};\r\n options.logMessageContent = options.logMessageContent === undefined ? false : options.logMessageContent;\r\n if (typeof options.withCredentials === \"boolean\" || options.withCredentials === undefined) {\r\n options.withCredentials = options.withCredentials === undefined ? true : options.withCredentials;\r\n }\r\n else {\r\n throw new Error(\"withCredentials option was not a 'boolean' or 'undefined' value\");\r\n }\r\n options.timeout = options.timeout === undefined ? 100 * 1000 : options.timeout;\r\n let webSocketModule = null;\r\n let eventSourceModule = null;\r\n if (Platform.isNode && typeof require !== \"undefined\") {\r\n // In order to ignore the dynamic require in webpack builds we need to do this magic\r\n // @ts-ignore: TS doesn't know about these names\r\n const requireFunc = typeof __webpack_require__ === \"function\" ? __non_webpack_require__ : require;\r\n webSocketModule = requireFunc(\"ws\");\r\n eventSourceModule = requireFunc(\"eventsource\");\r\n }\r\n if (!Platform.isNode && typeof WebSocket !== \"undefined\" && !options.WebSocket) {\r\n options.WebSocket = WebSocket;\r\n }\r\n else if (Platform.isNode && !options.WebSocket) {\r\n if (webSocketModule) {\r\n options.WebSocket = webSocketModule;\r\n }\r\n }\r\n if (!Platform.isNode && typeof EventSource !== \"undefined\" && !options.EventSource) {\r\n options.EventSource = EventSource;\r\n }\r\n else if (Platform.isNode && !options.EventSource) {\r\n if (typeof eventSourceModule !== \"undefined\") {\r\n options.EventSource = eventSourceModule;\r\n }\r\n }\r\n this._httpClient = new AccessTokenHttpClient(options.httpClient || new DefaultHttpClient(this._logger), options.accessTokenFactory);\r\n this._connectionState = \"Disconnected\" /* ConnectionState.Disconnected */;\r\n this._connectionStarted = false;\r\n this._options = options;\r\n this.onreceive = null;\r\n this.onclose = null;\r\n }\r\n async start(transferFormat) {\r\n transferFormat = transferFormat || TransferFormat.Binary;\r\n Arg.isIn(transferFormat, TransferFormat, \"transferFormat\");\r\n this._logger.log(LogLevel.Debug, `Starting connection with transfer format '${TransferFormat[transferFormat]}'.`);\r\n if (this._connectionState !== \"Disconnected\" /* ConnectionState.Disconnected */) {\r\n return Promise.reject(new Error(\"Cannot start an HttpConnection that is not in the 'Disconnected' state.\"));\r\n }\r\n this._connectionState = \"Connecting\" /* ConnectionState.Connecting */;\r\n this._startInternalPromise = this._startInternal(transferFormat);\r\n await this._startInternalPromise;\r\n // The TypeScript compiler thinks that connectionState must be Connecting here. The TypeScript compiler is wrong.\r\n if (this._connectionState === \"Disconnecting\" /* ConnectionState.Disconnecting */) {\r\n // stop() was called and transitioned the client into the Disconnecting state.\r\n const message = \"Failed to start the HttpConnection before stop() was called.\";\r\n this._logger.log(LogLevel.Error, message);\r\n // We cannot await stopPromise inside startInternal since stopInternal awaits the startInternalPromise.\r\n await this._stopPromise;\r\n return Promise.reject(new AbortError(message));\r\n }\r\n else if (this._connectionState !== \"Connected\" /* ConnectionState.Connected */) {\r\n // stop() was called and transitioned the client into the Disconnecting state.\r\n const message = \"HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!\";\r\n this._logger.log(LogLevel.Error, message);\r\n return Promise.reject(new AbortError(message));\r\n }\r\n this._connectionStarted = true;\r\n }\r\n send(data) {\r\n if (this._connectionState !== \"Connected\" /* ConnectionState.Connected */) {\r\n return Promise.reject(new Error(\"Cannot send data if the connection is not in the 'Connected' State.\"));\r\n }\r\n if (!this._sendQueue) {\r\n this._sendQueue = new TransportSendQueue(this.transport);\r\n }\r\n // Transport will not be null if state is connected\r\n return this._sendQueue.send(data);\r\n }\r\n async stop(error) {\r\n if (this._connectionState === \"Disconnected\" /* ConnectionState.Disconnected */) {\r\n this._logger.log(LogLevel.Debug, `Call to HttpConnection.stop(${error}) ignored because the connection is already in the disconnected state.`);\r\n return Promise.resolve();\r\n }\r\n if (this._connectionState === \"Disconnecting\" /* ConnectionState.Disconnecting */) {\r\n this._logger.log(LogLevel.Debug, `Call to HttpConnection.stop(${error}) ignored because the connection is already in the disconnecting state.`);\r\n return this._stopPromise;\r\n }\r\n this._connectionState = \"Disconnecting\" /* ConnectionState.Disconnecting */;\r\n this._stopPromise = new Promise((resolve) => {\r\n // Don't complete stop() until stopConnection() completes.\r\n this._stopPromiseResolver = resolve;\r\n });\r\n // stopInternal should never throw so just observe it.\r\n await this._stopInternal(error);\r\n await this._stopPromise;\r\n }\r\n async _stopInternal(error) {\r\n // Set error as soon as possible otherwise there is a race between\r\n // the transport closing and providing an error and the error from a close message\r\n // We would prefer the close message error.\r\n this._stopError = error;\r\n try {\r\n await this._startInternalPromise;\r\n }\r\n catch (e) {\r\n // This exception is returned to the user as a rejected Promise from the start method.\r\n }\r\n // The transport's onclose will trigger stopConnection which will run our onclose event.\r\n // The transport should always be set if currently connected. If it wasn't set, it's likely because\r\n // stop was called during start() and start() failed.\r\n if (this.transport) {\r\n try {\r\n await this.transport.stop();\r\n }\r\n catch (e) {\r\n this._logger.log(LogLevel.Error, `HttpConnection.transport.stop() threw error '${e}'.`);\r\n this._stopConnection();\r\n }\r\n this.transport = undefined;\r\n }\r\n else {\r\n this._logger.log(LogLevel.Debug, \"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.\");\r\n }\r\n }\r\n async _startInternal(transferFormat) {\r\n // Store the original base url and the access token factory since they may change\r\n // as part of negotiating\r\n let url = this.baseUrl;\r\n this._accessTokenFactory = this._options.accessTokenFactory;\r\n this._httpClient._accessTokenFactory = this._accessTokenFactory;\r\n try {\r\n if (this._options.skipNegotiation) {\r\n if (this._options.transport === HttpTransportType.WebSockets) {\r\n // No need to add a connection ID in this case\r\n this.transport = this._constructTransport(HttpTransportType.WebSockets);\r\n // We should just call connect directly in this case.\r\n // No fallback or negotiate in this case.\r\n await this._startTransport(url, transferFormat);\r\n }\r\n else {\r\n throw new Error(\"Negotiation can only be skipped when using the WebSocket transport directly.\");\r\n }\r\n }\r\n else {\r\n let negotiateResponse = null;\r\n let redirects = 0;\r\n do {\r\n negotiateResponse = await this._getNegotiationResponse(url);\r\n // the user tries to stop the connection when it is being started\r\n if (this._connectionState === \"Disconnecting\" /* ConnectionState.Disconnecting */ || this._connectionState === \"Disconnected\" /* ConnectionState.Disconnected */) {\r\n throw new AbortError(\"The connection was stopped during negotiation.\");\r\n }\r\n if (negotiateResponse.error) {\r\n throw new Error(negotiateResponse.error);\r\n }\r\n if (negotiateResponse.ProtocolVersion) {\r\n throw new Error(\"Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.\");\r\n }\r\n if (negotiateResponse.url) {\r\n url = negotiateResponse.url;\r\n }\r\n if (negotiateResponse.accessToken) {\r\n // Replace the current access token factory with one that uses\r\n // the returned access token\r\n const accessToken = negotiateResponse.accessToken;\r\n this._accessTokenFactory = () => accessToken;\r\n // set the factory to undefined so the AccessTokenHttpClient won't retry with the same token, since we know it won't change until a connection restart\r\n this._httpClient._accessToken = accessToken;\r\n this._httpClient._accessTokenFactory = undefined;\r\n }\r\n redirects++;\r\n } while (negotiateResponse.url && redirects < MAX_REDIRECTS);\r\n if (redirects === MAX_REDIRECTS && negotiateResponse.url) {\r\n throw new Error(\"Negotiate redirection limit exceeded.\");\r\n }\r\n await this._createTransport(url, this._options.transport, negotiateResponse, transferFormat);\r\n }\r\n if (this.transport instanceof LongPollingTransport) {\r\n this.features.inherentKeepAlive = true;\r\n }\r\n if (this._connectionState === \"Connecting\" /* ConnectionState.Connecting */) {\r\n // Ensure the connection transitions to the connected state prior to completing this.startInternalPromise.\r\n // start() will handle the case when stop was called and startInternal exits still in the disconnecting state.\r\n this._logger.log(LogLevel.Debug, \"The HttpConnection connected successfully.\");\r\n this._connectionState = \"Connected\" /* ConnectionState.Connected */;\r\n }\r\n // stop() is waiting on us via this.startInternalPromise so keep this.transport around so it can clean up.\r\n // This is the only case startInternal can exit in neither the connected nor disconnected state because stopConnection()\r\n // will transition to the disconnected state. start() will wait for the transition using the stopPromise.\r\n }\r\n catch (e) {\r\n this._logger.log(LogLevel.Error, \"Failed to start the connection: \" + e);\r\n this._connectionState = \"Disconnected\" /* ConnectionState.Disconnected */;\r\n this.transport = undefined;\r\n // if start fails, any active calls to stop assume that start will complete the stop promise\r\n this._stopPromiseResolver();\r\n return Promise.reject(e);\r\n }\r\n }\r\n async _getNegotiationResponse(url) {\r\n const headers = {};\r\n const [name, value] = getUserAgentHeader();\r\n headers[name] = value;\r\n const negotiateUrl = this._resolveNegotiateUrl(url);\r\n this._logger.log(LogLevel.Debug, `Sending negotiation request: ${negotiateUrl}.`);\r\n try {\r\n const response = await this._httpClient.post(negotiateUrl, {\r\n content: \"\",\r\n headers: { ...headers, ...this._options.headers },\r\n timeout: this._options.timeout,\r\n withCredentials: this._options.withCredentials,\r\n });\r\n if (response.statusCode !== 200) {\r\n return Promise.reject(new Error(`Unexpected status code returned from negotiate '${response.statusCode}'`));\r\n }\r\n const negotiateResponse = JSON.parse(response.content);\r\n if (!negotiateResponse.negotiateVersion || negotiateResponse.negotiateVersion < 1) {\r\n // Negotiate version 0 doesn't use connectionToken\r\n // So we set it equal to connectionId so all our logic can use connectionToken without being aware of the negotiate version\r\n negotiateResponse.connectionToken = negotiateResponse.connectionId;\r\n }\r\n if (negotiateResponse.useStatefulReconnect && this._options._useStatefulReconnect !== true) {\r\n return Promise.reject(new FailedToNegotiateWithServerError(\"Client didn't negotiate Stateful Reconnect but the server did.\"));\r\n }\r\n return negotiateResponse;\r\n }\r\n catch (e) {\r\n let errorMessage = \"Failed to complete negotiation with the server: \" + e;\r\n if (e instanceof HttpError) {\r\n if (e.statusCode === 404) {\r\n errorMessage = errorMessage + \" Either this is not a SignalR endpoint or there is a proxy blocking the connection.\";\r\n }\r\n }\r\n this._logger.log(LogLevel.Error, errorMessage);\r\n return Promise.reject(new FailedToNegotiateWithServerError(errorMessage));\r\n }\r\n }\r\n _createConnectUrl(url, connectionToken) {\r\n if (!connectionToken) {\r\n return url;\r\n }\r\n return url + (url.indexOf(\"?\") === -1 ? \"?\" : \"&\") + `id=${connectionToken}`;\r\n }\r\n async _createTransport(url, requestedTransport, negotiateResponse, requestedTransferFormat) {\r\n let connectUrl = this._createConnectUrl(url, negotiateResponse.connectionToken);\r\n if (this._isITransport(requestedTransport)) {\r\n this._logger.log(LogLevel.Debug, \"Connection was provided an instance of ITransport, using that directly.\");\r\n this.transport = requestedTransport;\r\n await this._startTransport(connectUrl, requestedTransferFormat);\r\n this.connectionId = negotiateResponse.connectionId;\r\n return;\r\n }\r\n const transportExceptions = [];\r\n const transports = negotiateResponse.availableTransports || [];\r\n let negotiate = negotiateResponse;\r\n for (const endpoint of transports) {\r\n const transportOrError = this._resolveTransportOrError(endpoint, requestedTransport, requestedTransferFormat, (negotiate === null || negotiate === void 0 ? void 0 : negotiate.useStatefulReconnect) === true);\r\n if (transportOrError instanceof Error) {\r\n // Store the error and continue, we don't want to cause a re-negotiate in these cases\r\n transportExceptions.push(`${endpoint.transport} failed:`);\r\n transportExceptions.push(transportOrError);\r\n }\r\n else if (this._isITransport(transportOrError)) {\r\n this.transport = transportOrError;\r\n if (!negotiate) {\r\n try {\r\n negotiate = await this._getNegotiationResponse(url);\r\n }\r\n catch (ex) {\r\n return Promise.reject(ex);\r\n }\r\n connectUrl = this._createConnectUrl(url, negotiate.connectionToken);\r\n }\r\n try {\r\n await this._startTransport(connectUrl, requestedTransferFormat);\r\n this.connectionId = negotiate.connectionId;\r\n return;\r\n }\r\n catch (ex) {\r\n this._logger.log(LogLevel.Error, `Failed to start the transport '${endpoint.transport}': ${ex}`);\r\n negotiate = undefined;\r\n transportExceptions.push(new FailedToStartTransportError(`${endpoint.transport} failed: ${ex}`, HttpTransportType[endpoint.transport]));\r\n if (this._connectionState !== \"Connecting\" /* ConnectionState.Connecting */) {\r\n const message = \"Failed to select transport before stop() was called.\";\r\n this._logger.log(LogLevel.Debug, message);\r\n return Promise.reject(new AbortError(message));\r\n }\r\n }\r\n }\r\n }\r\n if (transportExceptions.length > 0) {\r\n return Promise.reject(new AggregateErrors(`Unable to connect to the server with any of the available transports. ${transportExceptions.join(\" \")}`, transportExceptions));\r\n }\r\n return Promise.reject(new Error(\"None of the transports supported by the client are supported by the server.\"));\r\n }\r\n _constructTransport(transport) {\r\n switch (transport) {\r\n case HttpTransportType.WebSockets:\r\n if (!this._options.WebSocket) {\r\n throw new Error(\"'WebSocket' is not supported in your environment.\");\r\n }\r\n return new WebSocketTransport(this._httpClient, this._accessTokenFactory, this._logger, this._options.logMessageContent, this._options.WebSocket, this._options.headers || {});\r\n case HttpTransportType.ServerSentEvents:\r\n if (!this._options.EventSource) {\r\n throw new Error(\"'EventSource' is not supported in your environment.\");\r\n }\r\n return new ServerSentEventsTransport(this._httpClient, this._httpClient._accessToken, this._logger, this._options);\r\n case HttpTransportType.LongPolling:\r\n return new LongPollingTransport(this._httpClient, this._logger, this._options);\r\n default:\r\n throw new Error(`Unknown transport: ${transport}.`);\r\n }\r\n }\r\n _startTransport(url, transferFormat) {\r\n this.transport.onreceive = this.onreceive;\r\n if (this.features.reconnect) {\r\n this.transport.onclose = async (e) => {\r\n let callStop = false;\r\n if (this.features.reconnect) {\r\n try {\r\n this.features.disconnected();\r\n await this.transport.connect(url, transferFormat);\r\n await this.features.resend();\r\n }\r\n catch {\r\n callStop = true;\r\n }\r\n }\r\n else {\r\n this._stopConnection(e);\r\n return;\r\n }\r\n if (callStop) {\r\n this._stopConnection(e);\r\n }\r\n };\r\n }\r\n else {\r\n this.transport.onclose = (e) => this._stopConnection(e);\r\n }\r\n return this.transport.connect(url, transferFormat);\r\n }\r\n _resolveTransportOrError(endpoint, requestedTransport, requestedTransferFormat, useStatefulReconnect) {\r\n const transport = HttpTransportType[endpoint.transport];\r\n if (transport === null || transport === undefined) {\r\n this._logger.log(LogLevel.Debug, `Skipping transport '${endpoint.transport}' because it is not supported by this client.`);\r\n return new Error(`Skipping transport '${endpoint.transport}' because it is not supported by this client.`);\r\n }\r\n else {\r\n if (transportMatches(requestedTransport, transport)) {\r\n const transferFormats = endpoint.transferFormats.map((s) => TransferFormat[s]);\r\n if (transferFormats.indexOf(requestedTransferFormat) >= 0) {\r\n if ((transport === HttpTransportType.WebSockets && !this._options.WebSocket) ||\r\n (transport === HttpTransportType.ServerSentEvents && !this._options.EventSource)) {\r\n this._logger.log(LogLevel.Debug, `Skipping transport '${HttpTransportType[transport]}' because it is not supported in your environment.'`);\r\n return new UnsupportedTransportError(`'${HttpTransportType[transport]}' is not supported in your environment.`, transport);\r\n }\r\n else {\r\n this._logger.log(LogLevel.Debug, `Selecting transport '${HttpTransportType[transport]}'.`);\r\n try {\r\n this.features.reconnect = transport === HttpTransportType.WebSockets ? useStatefulReconnect : undefined;\r\n return this._constructTransport(transport);\r\n }\r\n catch (ex) {\r\n return ex;\r\n }\r\n }\r\n }\r\n else {\r\n this._logger.log(LogLevel.Debug, `Skipping transport '${HttpTransportType[transport]}' because it does not support the requested transfer format '${TransferFormat[requestedTransferFormat]}'.`);\r\n return new Error(`'${HttpTransportType[transport]}' does not support ${TransferFormat[requestedTransferFormat]}.`);\r\n }\r\n }\r\n else {\r\n this._logger.log(LogLevel.Debug, `Skipping transport '${HttpTransportType[transport]}' because it was disabled by the client.`);\r\n return new DisabledTransportError(`'${HttpTransportType[transport]}' is disabled by the client.`, transport);\r\n }\r\n }\r\n }\r\n _isITransport(transport) {\r\n return transport && typeof (transport) === \"object\" && \"connect\" in transport;\r\n }\r\n _stopConnection(error) {\r\n this._logger.log(LogLevel.Debug, `HttpConnection.stopConnection(${error}) called while in state ${this._connectionState}.`);\r\n this.transport = undefined;\r\n // If we have a stopError, it takes precedence over the error from the transport\r\n error = this._stopError || error;\r\n this._stopError = undefined;\r\n if (this._connectionState === \"Disconnected\" /* ConnectionState.Disconnected */) {\r\n this._logger.log(LogLevel.Debug, `Call to HttpConnection.stopConnection(${error}) was ignored because the connection is already in the disconnected state.`);\r\n return;\r\n }\r\n if (this._connectionState === \"Connecting\" /* ConnectionState.Connecting */) {\r\n this._logger.log(LogLevel.Warning, `Call to HttpConnection.stopConnection(${error}) was ignored because the connection is still in the connecting state.`);\r\n throw new Error(`HttpConnection.stopConnection(${error}) was called while the connection is still in the connecting state.`);\r\n }\r\n if (this._connectionState === \"Disconnecting\" /* ConnectionState.Disconnecting */) {\r\n // A call to stop() induced this call to stopConnection and needs to be completed.\r\n // Any stop() awaiters will be scheduled to continue after the onclose callback fires.\r\n this._stopPromiseResolver();\r\n }\r\n if (error) {\r\n this._logger.log(LogLevel.Error, `Connection disconnected with error '${error}'.`);\r\n }\r\n else {\r\n this._logger.log(LogLevel.Information, \"Connection disconnected.\");\r\n }\r\n if (this._sendQueue) {\r\n this._sendQueue.stop().catch((e) => {\r\n this._logger.log(LogLevel.Error, `TransportSendQueue.stop() threw error '${e}'.`);\r\n });\r\n this._sendQueue = undefined;\r\n }\r\n this.connectionId = undefined;\r\n this._connectionState = \"Disconnected\" /* ConnectionState.Disconnected */;\r\n if (this._connectionStarted) {\r\n this._connectionStarted = false;\r\n try {\r\n if (this.onclose) {\r\n this.onclose(error);\r\n }\r\n }\r\n catch (e) {\r\n this._logger.log(LogLevel.Error, `HttpConnection.onclose(${error}) threw error '${e}'.`);\r\n }\r\n }\r\n }\r\n _resolveUrl(url) {\r\n // startsWith is not supported in IE\r\n if (url.lastIndexOf(\"https://\", 0) === 0 || url.lastIndexOf(\"http://\", 0) === 0) {\r\n return url;\r\n }\r\n if (!Platform.isBrowser) {\r\n throw new Error(`Cannot resolve '${url}'.`);\r\n }\r\n // Setting the url to the href propery of an anchor tag handles normalization\r\n // for us. There are 3 main cases.\r\n // 1. Relative path normalization e.g \"b\" -> \"http://localhost:5000/a/b\"\r\n // 2. Absolute path normalization e.g \"/a/b\" -> \"http://localhost:5000/a/b\"\r\n // 3. Networkpath reference normalization e.g \"//localhost:5000/a/b\" -> \"http://localhost:5000/a/b\"\r\n const aTag = window.document.createElement(\"a\");\r\n aTag.href = url;\r\n this._logger.log(LogLevel.Information, `Normalizing '${url}' to '${aTag.href}'.`);\r\n return aTag.href;\r\n }\r\n _resolveNegotiateUrl(url) {\r\n const negotiateUrl = new URL(url);\r\n if (negotiateUrl.pathname.endsWith('/')) {\r\n negotiateUrl.pathname += \"negotiate\";\r\n }\r\n else {\r\n negotiateUrl.pathname += \"/negotiate\";\r\n }\r\n const searchParams = new URLSearchParams(negotiateUrl.searchParams);\r\n if (!searchParams.has(\"negotiateVersion\")) {\r\n searchParams.append(\"negotiateVersion\", this._negotiateVersion.toString());\r\n }\r\n if (searchParams.has(\"useStatefulReconnect\")) {\r\n if (searchParams.get(\"useStatefulReconnect\") === \"true\") {\r\n this._options._useStatefulReconnect = true;\r\n }\r\n }\r\n else if (this._options._useStatefulReconnect === true) {\r\n searchParams.append(\"useStatefulReconnect\", \"true\");\r\n }\r\n negotiateUrl.search = searchParams.toString();\r\n return negotiateUrl.toString();\r\n }\r\n}\r\nfunction transportMatches(requestedTransport, actualTransport) {\r\n return !requestedTransport || ((actualTransport & requestedTransport) !== 0);\r\n}\r\n/** @private */\r\nexport class TransportSendQueue {\r\n constructor(_transport) {\r\n this._transport = _transport;\r\n this._buffer = [];\r\n this._executing = true;\r\n this._sendBufferedData = new PromiseSource();\r\n this._transportResult = new PromiseSource();\r\n this._sendLoopPromise = this._sendLoop();\r\n }\r\n send(data) {\r\n this._bufferData(data);\r\n if (!this._transportResult) {\r\n this._transportResult = new PromiseSource();\r\n }\r\n return this._transportResult.promise;\r\n }\r\n stop() {\r\n this._executing = false;\r\n this._sendBufferedData.resolve();\r\n return this._sendLoopPromise;\r\n }\r\n _bufferData(data) {\r\n if (this._buffer.length && typeof (this._buffer[0]) !== typeof (data)) {\r\n throw new Error(`Expected data to be of type ${typeof (this._buffer)} but was of type ${typeof (data)}`);\r\n }\r\n this._buffer.push(data);\r\n this._sendBufferedData.resolve();\r\n }\r\n async _sendLoop() {\r\n while (true) {\r\n await this._sendBufferedData.promise;\r\n if (!this._executing) {\r\n if (this._transportResult) {\r\n this._transportResult.reject(\"Connection stopped.\");\r\n }\r\n break;\r\n }\r\n this._sendBufferedData = new PromiseSource();\r\n const transportResult = this._transportResult;\r\n this._transportResult = undefined;\r\n const data = typeof (this._buffer[0]) === \"string\" ?\r\n this._buffer.join(\"\") :\r\n TransportSendQueue._concatBuffers(this._buffer);\r\n this._buffer.length = 0;\r\n try {\r\n await this._transport.send(data);\r\n transportResult.resolve();\r\n }\r\n catch (error) {\r\n transportResult.reject(error);\r\n }\r\n }\r\n }\r\n static _concatBuffers(arrayBuffers) {\r\n const totalLength = arrayBuffers.map((b) => b.byteLength).reduce((a, b) => a + b);\r\n const result = new Uint8Array(totalLength);\r\n let offset = 0;\r\n for (const item of arrayBuffers) {\r\n result.set(new Uint8Array(item), offset);\r\n offset += item.byteLength;\r\n }\r\n return result.buffer;\r\n }\r\n}\r\nclass PromiseSource {\r\n constructor() {\r\n this.promise = new Promise((resolve, reject) => [this._resolver, this._rejecter] = [resolve, reject]);\r\n }\r\n resolve() {\r\n this._resolver();\r\n }\r\n reject(reason) {\r\n this._rejecter(reason);\r\n }\r\n}\r\n//# sourceMappingURL=HttpConnection.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { MessageType } from \"./IHubProtocol\";\r\nimport { LogLevel } from \"./ILogger\";\r\nimport { TransferFormat } from \"./ITransport\";\r\nimport { NullLogger } from \"./Loggers\";\r\nimport { TextMessageFormat } from \"./TextMessageFormat\";\r\nconst JSON_HUB_PROTOCOL_NAME = \"json\";\r\n/** Implements the JSON Hub Protocol. */\r\nexport class JsonHubProtocol {\r\n constructor() {\r\n /** @inheritDoc */\r\n this.name = JSON_HUB_PROTOCOL_NAME;\r\n /** @inheritDoc */\r\n this.version = 2;\r\n /** @inheritDoc */\r\n this.transferFormat = TransferFormat.Text;\r\n }\r\n /** Creates an array of {@link @microsoft/signalr.HubMessage} objects from the specified serialized representation.\r\n *\r\n * @param {string} input A string containing the serialized representation.\r\n * @param {ILogger} logger A logger that will be used to log messages that occur during parsing.\r\n */\r\n parseMessages(input, logger) {\r\n // The interface does allow \"ArrayBuffer\" to be passed in, but this implementation does not. So let's throw a useful error.\r\n if (typeof input !== \"string\") {\r\n throw new Error(\"Invalid input for JSON hub protocol. Expected a string.\");\r\n }\r\n if (!input) {\r\n return [];\r\n }\r\n if (logger === null) {\r\n logger = NullLogger.instance;\r\n }\r\n // Parse the messages\r\n const messages = TextMessageFormat.parse(input);\r\n const hubMessages = [];\r\n for (const message of messages) {\r\n const parsedMessage = JSON.parse(message);\r\n if (typeof parsedMessage.type !== \"number\") {\r\n throw new Error(\"Invalid payload.\");\r\n }\r\n switch (parsedMessage.type) {\r\n case MessageType.Invocation:\r\n this._isInvocationMessage(parsedMessage);\r\n break;\r\n case MessageType.StreamItem:\r\n this._isStreamItemMessage(parsedMessage);\r\n break;\r\n case MessageType.Completion:\r\n this._isCompletionMessage(parsedMessage);\r\n break;\r\n case MessageType.Ping:\r\n // Single value, no need to validate\r\n break;\r\n case MessageType.Close:\r\n // All optional values, no need to validate\r\n break;\r\n case MessageType.Ack:\r\n this._isAckMessage(parsedMessage);\r\n break;\r\n case MessageType.Sequence:\r\n this._isSequenceMessage(parsedMessage);\r\n break;\r\n default:\r\n // Future protocol changes can add message types, old clients can ignore them\r\n logger.log(LogLevel.Information, \"Unknown message type '\" + parsedMessage.type + \"' ignored.\");\r\n continue;\r\n }\r\n hubMessages.push(parsedMessage);\r\n }\r\n return hubMessages;\r\n }\r\n /** Writes the specified {@link @microsoft/signalr.HubMessage} to a string and returns it.\r\n *\r\n * @param {HubMessage} message The message to write.\r\n * @returns {string} A string containing the serialized representation of the message.\r\n */\r\n writeMessage(message) {\r\n return TextMessageFormat.write(JSON.stringify(message));\r\n }\r\n _isInvocationMessage(message) {\r\n this._assertNotEmptyString(message.target, \"Invalid payload for Invocation message.\");\r\n if (message.invocationId !== undefined) {\r\n this._assertNotEmptyString(message.invocationId, \"Invalid payload for Invocation message.\");\r\n }\r\n }\r\n _isStreamItemMessage(message) {\r\n this._assertNotEmptyString(message.invocationId, \"Invalid payload for StreamItem message.\");\r\n if (message.item === undefined) {\r\n throw new Error(\"Invalid payload for StreamItem message.\");\r\n }\r\n }\r\n _isCompletionMessage(message) {\r\n if (message.result && message.error) {\r\n throw new Error(\"Invalid payload for Completion message.\");\r\n }\r\n if (!message.result && message.error) {\r\n this._assertNotEmptyString(message.error, \"Invalid payload for Completion message.\");\r\n }\r\n this._assertNotEmptyString(message.invocationId, \"Invalid payload for Completion message.\");\r\n }\r\n _isAckMessage(message) {\r\n if (typeof message.sequenceId !== 'number') {\r\n throw new Error(\"Invalid SequenceId for Ack message.\");\r\n }\r\n }\r\n _isSequenceMessage(message) {\r\n if (typeof message.sequenceId !== 'number') {\r\n throw new Error(\"Invalid SequenceId for Sequence message.\");\r\n }\r\n }\r\n _assertNotEmptyString(value, errorMessage) {\r\n if (typeof value !== \"string\" || value === \"\") {\r\n throw new Error(errorMessage);\r\n }\r\n }\r\n}\r\n//# sourceMappingURL=JsonHubProtocol.js.map","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\nimport { DefaultReconnectPolicy } from \"./DefaultReconnectPolicy\";\r\nimport { HttpConnection } from \"./HttpConnection\";\r\nimport { HubConnection } from \"./HubConnection\";\r\nimport { LogLevel } from \"./ILogger\";\r\nimport { JsonHubProtocol } from \"./JsonHubProtocol\";\r\nimport { NullLogger } from \"./Loggers\";\r\nimport { Arg, ConsoleLogger } from \"./Utils\";\r\nconst LogLevelNameMapping = {\r\n trace: LogLevel.Trace,\r\n debug: LogLevel.Debug,\r\n info: LogLevel.Information,\r\n information: LogLevel.Information,\r\n warn: LogLevel.Warning,\r\n warning: LogLevel.Warning,\r\n error: LogLevel.Error,\r\n critical: LogLevel.Critical,\r\n none: LogLevel.None,\r\n};\r\nfunction parseLogLevel(name) {\r\n // Case-insensitive matching via lower-casing\r\n // Yes, I know case-folding is a complicated problem in Unicode, but we only support\r\n // the ASCII strings defined in LogLevelNameMapping anyway, so it's fine -anurse.\r\n const mapping = LogLevelNameMapping[name.toLowerCase()];\r\n if (typeof mapping !== \"undefined\") {\r\n return mapping;\r\n }\r\n else {\r\n throw new Error(`Unknown log level: ${name}`);\r\n }\r\n}\r\n/** A builder for configuring {@link @microsoft/signalr.HubConnection} instances. */\r\nexport class HubConnectionBuilder {\r\n configureLogging(logging) {\r\n Arg.isRequired(logging, \"logging\");\r\n if (isLogger(logging)) {\r\n this.logger = logging;\r\n }\r\n else if (typeof logging === \"string\") {\r\n const logLevel = parseLogLevel(logging);\r\n this.logger = new ConsoleLogger(logLevel);\r\n }\r\n else {\r\n this.logger = new ConsoleLogger(logging);\r\n }\r\n return this;\r\n }\r\n withUrl(url, transportTypeOrOptions) {\r\n Arg.isRequired(url, \"url\");\r\n Arg.isNotEmpty(url, \"url\");\r\n this.url = url;\r\n // Flow-typing knows where it's at. Since HttpTransportType is a number and IHttpConnectionOptions is guaranteed\r\n // to be an object, we know (as does TypeScript) this comparison is all we need to figure out which overload was called.\r\n if (typeof transportTypeOrOptions === \"object\") {\r\n this.httpConnectionOptions = { ...this.httpConnectionOptions, ...transportTypeOrOptions };\r\n }\r\n else {\r\n this.httpConnectionOptions = {\r\n ...this.httpConnectionOptions,\r\n transport: transportTypeOrOptions,\r\n };\r\n }\r\n return this;\r\n }\r\n /** Configures the {@link @microsoft/signalr.HubConnection} to use the specified Hub Protocol.\r\n *\r\n * @param {IHubProtocol} protocol The {@link @microsoft/signalr.IHubProtocol} implementation to use.\r\n */\r\n withHubProtocol(protocol) {\r\n Arg.isRequired(protocol, \"protocol\");\r\n this.protocol = protocol;\r\n return this;\r\n }\r\n withAutomaticReconnect(retryDelaysOrReconnectPolicy) {\r\n if (this.reconnectPolicy) {\r\n throw new Error(\"A reconnectPolicy has already been set.\");\r\n }\r\n if (!retryDelaysOrReconnectPolicy) {\r\n this.reconnectPolicy = new DefaultReconnectPolicy();\r\n }\r\n else if (Array.isArray(retryDelaysOrReconnectPolicy)) {\r\n this.reconnectPolicy = new DefaultReconnectPolicy(retryDelaysOrReconnectPolicy);\r\n }\r\n else {\r\n this.reconnectPolicy = retryDelaysOrReconnectPolicy;\r\n }\r\n return this;\r\n }\r\n /** Configures {@link @microsoft/signalr.HubConnection.serverTimeoutInMilliseconds} for the {@link @microsoft/signalr.HubConnection}.\r\n *\r\n * @returns The {@link @microsoft/signalr.HubConnectionBuilder} instance, for chaining.\r\n */\r\n withServerTimeout(milliseconds) {\r\n Arg.isRequired(milliseconds, \"milliseconds\");\r\n this._serverTimeoutInMilliseconds = milliseconds;\r\n return this;\r\n }\r\n /** Configures {@link @microsoft/signalr.HubConnection.keepAliveIntervalInMilliseconds} for the {@link @microsoft/signalr.HubConnection}.\r\n *\r\n * @returns The {@link @microsoft/signalr.HubConnectionBuilder} instance, for chaining.\r\n */\r\n withKeepAliveInterval(milliseconds) {\r\n Arg.isRequired(milliseconds, \"milliseconds\");\r\n this._keepAliveIntervalInMilliseconds = milliseconds;\r\n return this;\r\n }\r\n /** Enables and configures options for the Stateful Reconnect feature.\r\n *\r\n * @returns The {@link @microsoft/signalr.HubConnectionBuilder} instance, for chaining.\r\n */\r\n withStatefulReconnect(options) {\r\n if (this.httpConnectionOptions === undefined) {\r\n this.httpConnectionOptions = {};\r\n }\r\n this.httpConnectionOptions._useStatefulReconnect = true;\r\n this._statefulReconnectBufferSize = options === null || options === void 0 ? void 0 : options.bufferSize;\r\n return this;\r\n }\r\n /** Creates a {@link @microsoft/signalr.HubConnection} from the configuration options specified in this builder.\r\n *\r\n * @returns {HubConnection} The configured {@link @microsoft/signalr.HubConnection}.\r\n */\r\n build() {\r\n // If httpConnectionOptions has a logger, use it. Otherwise, override it with the one\r\n // provided to configureLogger\r\n const httpConnectionOptions = this.httpConnectionOptions || {};\r\n // If it's 'null', the user **explicitly** asked for null, don't mess with it.\r\n if (httpConnectionOptions.logger === undefined) {\r\n // If our logger is undefined or null, that's OK, the HttpConnection constructor will handle it.\r\n httpConnectionOptions.logger = this.logger;\r\n }\r\n // Now create the connection\r\n if (!this.url) {\r\n throw new Error(\"The 'HubConnectionBuilder.withUrl' method must be called before building the connection.\");\r\n }\r\n const connection = new HttpConnection(this.url, httpConnectionOptions);\r\n return HubConnection.create(connection, this.logger || NullLogger.instance, this.protocol || new JsonHubProtocol(), this.reconnectPolicy, this._serverTimeoutInMilliseconds, this._keepAliveIntervalInMilliseconds, this._statefulReconnectBufferSize);\r\n }\r\n}\r\nfunction isLogger(logger) {\r\n return logger.log !== undefined;\r\n}\r\n//# sourceMappingURL=HubConnectionBuilder.js.map"],"names":["strShimFunction","strShimObject","strShimUndefined","strShimPrototype","ObjClass","_pureAssign","func1","func2","_pureRef","value","name","UNDEF_VALUE","NULL_VALUE","EMPTY","FUNCTION","OBJECT","PROTOTYPE","__PROTO__","UNDEFINED","CONSTRUCTOR","SYMBOL","POLYFILL_TAG","LENGTH","NAME","CALL","TO_STRING","ObjProto","StrCls","StrProto","MathCls","ArrCls","ArrProto","ArrSlice","safe","func","argArray","e","safeGet","cb","defValue","result","_createIs","theType","_createObjIs","theName","objToString","isUndefined","isStrictUndefined","arg","isDefined","isNullOrUndefined","isStrictNullOrUndefined","isString","isFunction","isObject","isArray","isError","isTruthy","objGetOwnPropertyDescriptor","objHasOwnProperty","obj","prop","objHasOwn","polyObjHasOwn","objForEachKey","theObject","callbackfn","thisArg","propMap","_createProp","desc","newValue","key","objDefineProp","objDefineAccessors","target","getProp","setProp","configurable","enumerable","objDefine","propDesc","_createKeyValueMap","values","keyType","valueType","completeFn","writable","theMap","_assignMapValue","asString","ERROR_TYPE","dumpObj","object","format","propertyValueDump","objType","throwTypeError","message","_objFreeze","_doNothing","_getProto","objKeys","objDeepFreeze","objFreeze","objGetPrototypeOf","createEnumKeyMap","_wellKnownSymbolMap","GLOBAL_CONFIG_KEY","_globalCfg","_getGlobalValue","_getGlobalConfig","gbl","_unwrapFunction","_unwrapFunctionWithPoly","funcName","clsProto","polyFunc","clsFn","theFunc","theArgs","strSubstring","strLeft","count","UNIQUE_REGISTRY_ID","_polySymbols","_globalSymbolRegistry","gblCfg","_wellKnownSymbolCache","polyNewSymbol","description","theSymbol","polySymbolFor","registry","newSymbol_1","regId_1","polyGetKnownSymbol","knownName","_globalLazyTestHooks","_initTestHooks","getLazy","lazyValue","createCachedValue","WINDOW","_cachedGlobal","_getGlobalInstFn","getFn","cachedValue","getGlobal","useCached","getInst","getDocument","hasWindow","getWindow","getNavigator","_symbol","_symbolFor","_initSymbol","_getSymbolKey","gblSym","getKnownSymbol","noPoly","sym","newSymbol","symbolFor","isIterator","isIterable","_iterSymbol$1","iterForOf","iter","err","iterResult","failed","fnApply","fn","arrAppend","elms","elm","arrForEach","theArray","len","idx","arrIndexOf","objCreate","polyObjCreate","type","tempFunc","_isProtoArray","objSetPrototypeOf","proto","d","b","_a","_createCustomError","__","_setName","baseClass","createCustomError","constructCb","errorBase","theBaseClass","orgName","captureFn","_this","_self","orgProto","utcNow","polyUtcNow","_createTrimFn","exp","polyStrTrim","strTrim","mathFloor","_fnToString","_objCtrFnString","_gblWindow","isPlainObject","strEndsWith","polyStrEndsWith","searchString","length","searchValue","end","strIndexOf","REF","UNREF","HAS_REF","ENABLED","_createTimerHandler","startTimer","refreshFn","cancelFn","ref","timerId","theTimerHandler","_unref","_cancel","_refresh","_setEnabled","_createTimeoutWith","overrideFn","isArr","setFn","clearFn","timerFn","handler","scheduleTimeout","callback","timeout","strHasOwnProperty","extendStaticsFn","p","__extendsFn","Constructor","Prototype","strFunction","DynInstFuncTable","DynProxyTag","DynClassName","DynClassNamePrefix","DynInstChkTag","DynAllowInstChkTag","DynProtoDefaultOptions","UnknownValue","str__Proto","DynProtoBaseProto","DynProtoGlobalSettings","DynProtoCurrent","strUseBaseInst","strSetInstFuncs","Obj","_objGetPrototypeOf","_objGetOwnProps","_gbl","_gblInst","_isObjectOrArrayPrototype","_isObjectArrayOrFunctionPrototype","_getObjProto","newProto","curProto","_forEachProp","props","name_1","lp","_isDynamicCandidate","skipOwn","_throwTypeError","_getInstanceFuncs","thisTarget","instFuncs","_hasVisited","_getBaseFuncs","classProto","useBaseInst","_instFuncProxy","funcHost","instFuncTable","baseFuncs","baseProto","visited","_getInstFunc","currentDynProtoProxy","instFunc","canAddInst","objProto","protoFunc","_getProtoFunc","_populatePrototype","className","baseInstFuncs","setInstanceFunc","_createDynamicPrototype","dynProtoProxy","instFuncs_1","_checkPrototype","thisProto","_getObjName","unknownValue","dynamicProto","theClass","delegateFunc","options","perfOptions","_DYN_TO_LOWER_CASE","_DYN_LENGTH","_DYN_WARN_TO_CONSOLE","_DYN_THROW_INTERNAL","_DYN_WATCH","_DYN_APPLY","_DYN_PUSH","_DYN_SPLICE","_DYN_LOGGER","_DYN_CANCEL","_DYN_INITIALIZE","_DYN_IDENTIFIER","_DYN_IS_INITIALIZED","_DYN_GET_PLUGIN","_DYN_NAME","_DYN_PROCESS_NEXT","_DYN_GET_PROCESS_TEL_CONT2","_DYN_ENABLED","_DYN_UNLOAD","_DYN_LOGGING_LEVEL_CONSOL4","_DYN_CREATE_NEW","_DYN_TEARDOWN","_DYN_MESSAGE_ID","_DYN_MESSAGE","_DYN_DIAG_LOG","_DYN__DO_TEARDOWN","_DYN_UPDATE","_DYN_GET_NEXT","_DYN_SET_NEXT_PLUGIN","_DYN_USER_AGENT","_DYN_SPLIT","_DYN_REPLACE","_DYN_IS_CHILD_EVT","_DYN_GET_CTX","_DYN_SET_CTX","aggregationErrorType","throwAggregationError","sourceErrors","self","args","theMessage","srcError","UNDEFINED_VALUE","STR_EMPTY","STR_CORE","STR_DISABLED","STR_EXTENSION_CONFIG","STR_PROCESS_TELEMETRY","STR_PRIORITY","STR_GET_PERF_MGR","STR_DOMAIN","STR_PATH","STR_NOT_DYNAMIC_ERROR","rCamelCase","rNormalizeInvalid","rLeadingNumeric","isNotNullOrUndefined","normalizeJsName","_all","letter","match","strContains","search","getExceptionName","setValue","field","valChk","srcChk","theValue","_createProxyFunction","source","srcFunc","src","originalArguments","proxyFunctionAs","overwriteTarget","proxyFunctions","functionsToProxy","theFuncName","strLocation","strConsole","strJSON","strCrypto","strMsCrypto","strMsie","strTrident","_isTrident","_navUserAgentCheck","getLocation","checkForMock","getConsole","hasJSON","getJSON","getCrypto","getMsCrypto","isIE","nav","userAgent","UInt32Mask","MaxUInt32","SEED1","SEED2","_mwcSeeded","_mwcW","_mwcZ","_mwcSeed","seedValue","_autoSeedMwc","now","random32","signed","c","mwcRandom32","newId","maxLength","base64chars","number","chars","version","instanceName","_dataUid","_canAcceptData","_getCache","data","theCache","createUniqueNamespace","includeVersion","createElmNodeData","addDefault","_isConfigDefaults","_getDefault","dynamicHandler","theConfig","cfgDefaults","isDefaultValid","fallbacks","fallback","fbValue","_resolveDefaultValue","newValue_1","_applyDefaultValue","defaultValue","isValid","mergeDf","reference","readOnly","blkDynamicValue","usingDefault","cfgValue","dfName","dfValue","CFG_HANDLER_LINK","BLOCK_DYNAMIC","FORCE_DYNAMIC","_cfgDeepCopy","target_1","getDynamicConfigHandler","blockDynamicConversion","_canMakeDynamic","getFunc","state","throwInvalidAccess","arrayMethodsToPatch","_throwDynamicError","logger","_patchArray","method","orgMethod","_i","_makeDynamicObject","_getOwnPropGetter","_createDynamicProperty","detail","checkDynamic","isObjectOrArray","_getProperty","activeHandler","_setProperty","isReferenced","_setDynamicProperty","getter","valueState","newIsObjectOrArray","isDynamic","_setDynamicPropertyState","flags","inPlace","rdOnly","blkProp","symPrefix","symPostfix","_createState","cfgHandler","dynamicPropertySymbol","dynamicPropertyReadOnly","dynamicPropertyReferenced","dynamicPropertyBlockValue","dynamicPropertyDetail","_waitingHandlers","_watcherTimer","theState","_useHandler","prevWatcher","_notifyWatchers","notifyHandlers","watcherFailures_1","_addWatcher","_trackHandler","details","_createAndUseHandler","configHandler","_createDynamicHandler","uid","newTarget","_setValue","_watch","_block","allowUpdate","prevUpd","_ref","_rdOnly","_blkPropValue","_applyDefaults","defaultValues","_logInvalidAccess","createDynamicConfig","config","defaultConfig","onConfigChange","cfgDfMerge","_aiNamespace","_getExtensionNamespace","getDebugExt","ns","STR_WARN_TO_CONSOLE","AiNonUserActionablePrefix","AiUserActionablePrefix","AIInternalMessagePrefix","_logFuncs","_sanitizeDiagnosticText","text","_logToConsole","theConsole","logFunc","_InternalLogMessage","msgId","msg","isUserAct","properties","strProps","diagnosticText","safeGetLogger","core","DiagnosticLogger","_messageCount","_messageLogged","_loggingLevelConsole","_loggingLevelTelemetry","_maxInternalMessageLimit","_enableDebug","_unloadHandler","_setDefaultsFromConfig","severity","_debugExtMsg","messageKey","_logInternalMessage","isAsync","_areInternalMessagesThrottled","logMessage","throttleLimitMessage","throttleMessage","dbgExt","_getLogger","_throwInternal","_b","strToGMTString","strToUTCString","strCookie","strExpires","strIsCookieUseDisabled","strDisableCookiesUsage","strConfigCookieMgr","_supportsCookies","_allowUaSameSite","_parsedCookieValue","_doc","_cookieCache","_globalCookieConfig","rootDefaultConfig","_getDoc","_gblCookieMgr","inst","createCookieMgr","_isMgrEnabled","cookieMgr","_isIgnoredCookie","cookieMgrCfg","_isBlockedCookie","_isCfgEnabled","rootConfig","cookieMgrConfig","isCfgEnabled","cookieEnabled","safeGetCookieMgr","_path","_domain","unloadHandler","_enabled","_getCookieFn","_setCookieFn","_delCookieFn","_getCookieValue","_setCookieValue","enabled","areCookiesSupported","gblManager","maxAgeSec","domain","path","_extractParts","_isIE","nowMs","expireMs","expiry","_formatDate","location_1","uaDisallowsSameSiteNone","_formatCookieValue","doc","parts","thePart","theDate","cookieValue","theCookie","strExecutionContextKey","strParentContextKey","strChildrenContextKey","PerfEvent","payloadDetails","theDetails_1","ctx","childTime","childEvts","childEvt","doPerfActiveKey","doPerf","mgrSource","getSource","perfMgr","perfEvt","currentActive","children","ex","pluginStateData","_getPluginState","plugin","strTelemetryPluginChain","strHasRunFlags","strGetTelCtx","_chainId","_getNextProxyStart","proxy","startAt","createTelemetryProxyChain","_createInternalContext","telemetryChain","_nextProxy","_onComplete","context","_moveNext","_resolveExtCfg","_getConfig","nextPlugin","_iterateChain","_addOnComplete","onComplete","that","nextProxy","completeDetails","_getExtCfg","identifier","createIfMissing","idCfg","cfg","extCfg","newConfig","extConfig","createProcessTelemetryContext","internalContext","_processNext","env","_createNew","plugins","createProcessTelemetryUnloadContext","unloadState","createProcessTelemetryUpdateContext","updateState","firstProxy","add","lastProxy_1","thePlugin","newProxy","createTelemetryPluginProxy","hasProcessTelemetry","hasSetNext","chainId","proxyChain","_processTelemetry","_unloadPlugin","_updatePlugin","_getTelCtx","itemCtx","_processChain","processPluginFn","hasRun","hasRunContext","nextId","error","hasNextRun","_callProcessTelemetry","pluginState","unloadCtx","_callTeardown","pluginCore","updateCtx","_callUpdate","createUnloadHandlerContainer","handlers","_addHandler","_runHandlers","createUnloadHookContainer","_hooks","_doUnload","oldHooks","_addHook","hooks","strGetPlugin","BaseTelemetryPlugin","_isinitialized","_rootCtx","_nextPlugin","_unloadHandlerContainer","_hookContainer","_initDefaults","extensions","pluginChain","_setDefaults","unloadDone","theUnloadCtx","theUnloadState","_unloadCallback","updateDone","theUpdateCtx","theUpdateState","_updateCallback","isInitialized","next","currentCtx","rootCtx","AnalyticsPluginIdentifier","defaultReactExtensionConfig","ReactPlugin","_super","__extends","_analyticsPlugin","_extensionConfig","_unlisten","_pageViewTimer","_pageViewTracked","_base","_addHistoryListener","pageViewTelemetry","_getAnalytics","event","asyncCallback","history","locationListener","locn","HttpError","errorMessage","statusCode","trueProto","TimeoutError","AbortError","UnsupportedTransportError","transport","DisabledTransportError","FailedToStartTransportError","FailedToNegotiateWithServerError","AggregateErrors","innerErrors","HttpResponse","statusText","content","HttpClient","url","LogLevel","NullLogger","_logLevel","_message","VERSION","Arg","val","Platform","getDataDetail","includeContent","isArrayBuffer","formatArrayBuffer","view","str","num","pad","sendMessage","transportName","httpClient","headers","getUserAgentHeader","responseType","response","createLogger","ConsoleLogger","SubjectSubscription","subject","observer","index","_","minimumLogLevel","logLevel","userAgentHeaderName","constructUserAgent","getOsName","getRuntime","getRuntimeVersion","os","runtime","runtimeVersion","majorAndMinor","getErrorString","getGlobalThis","FetchHttpClient","requireFunc","request","abortController","timeoutId","msTimeout","deserializeContent","payload","cookies","XhrHttpClient","resolve","reject","xhr","header","DefaultHttpClient","TextMessageFormat","output","input","messages","HandshakeProtocol","handshakeRequest","messageData","remainingData","binaryData","separatorIndex","responseLength","textData","MessageType","Subject","item","MessageBuffer","protocol","connection","bufferSize","serializedMessage","backpressurePromise","backpressurePromiseResolver","backpressurePromiseRejector","BufferedItem","ackMessage","newestAckedMessage","element","currentId","sequenceId","id","resolver","rejector","DEFAULT_TIMEOUT_IN_MS","DEFAULT_PING_INTERVAL_IN_MS","DEFAULT_STATEFUL_RECONNECT_BUFFER_SIZE","HubConnectionState","HubConnection","reconnectPolicy","serverTimeoutInMilliseconds","keepAliveIntervalInMilliseconds","statefulReconnectBufferSize","handshakePromise","startPromise","methodName","streams","streamIds","invocationDescriptor","promiseQueue","cancelInvocation","invocationEvent","sendPromise","newMethod","removeIdx","responseMessage","nextPing","invocationMessage","methods","methodsCopy","expectsResponse","res","exception","completionMessage","m","prevRes","reconnectStartTime","previousReconnectAttempts","retryError","nextRetryDelay","previousRetryCount","elapsedMilliseconds","retryReason","callbacks","nonblocking","invocationId","streamId","i","argument","DEFAULT_RETRY_DELAYS_IN_MILLISECONDS","DefaultReconnectPolicy","retryDelays","retryContext","HeaderNames","AccessTokenHttpClient","innerClient","accessTokenFactory","allowRetry","HttpTransportType","TransferFormat","AbortController$1","LongPollingTransport","AbortController","transferFormat","pollOptions","pollUrl","deleteOptions","ServerSentEventsTransport","accessToken","opened","eventSource","WebSocketTransport","logMessageContent","webSocketConstructor","token","webSocket","_event","MAX_REDIRECTS","HttpConnection","webSocketModule","eventSourceModule","TransportSendQueue","negotiateResponse","redirects","negotiateUrl","connectionToken","requestedTransport","requestedTransferFormat","connectUrl","transportExceptions","transports","negotiate","endpoint","transportOrError","callStop","useStatefulReconnect","transportMatches","s","aTag","searchParams","actualTransport","_transport","PromiseSource","transportResult","arrayBuffers","totalLength","a","offset","reason","JSON_HUB_PROTOCOL_NAME","JsonHubProtocol","hubMessages","parsedMessage","LogLevelNameMapping","parseLogLevel","mapping","HubConnectionBuilder","logging","isLogger","transportTypeOrOptions","retryDelaysOrReconnectPolicy","milliseconds","httpConnectionOptions"],"mappings":"4BAEO,IAAIA,GAAkB,WAClBC,GAAgB,SAChBC,GAAmB,YACnBC,GAAmB,YAEnBC,GAAW,OCPtB,oDAMA,SAASC,GAAYC,EAAOC,EAAO,CAC/B,OAAOD,GAASC,CACpB,CAEA,SAASC,EAASC,EAAOC,EAAM,CAC3B,OAAOD,EAAMC,CAAI,CACrB,CAEA,IAAIC,EAAc,OACdC,EAAa,KACbC,GAAQ,GACRC,GAAW,WACXC,GAAS,SACTC,GAAY,YACZC,GAAY,YACZC,GAAY,YACZC,GAAc,cACdC,GAAS,SACTC,GAAe,YACfC,GAAS,SACTC,GAAO,OACPC,EAAO,OACPC,GAAY,WACZrB,EAA0BC,GAAY,MAAM,EAC5CqB,GAA0BlB,EAASJ,EAAUY,EAAS,EACtDW,GAAwBtB,GAAY,MAAM,EAC1CuB,GAA0BpB,EAASmB,GAAQX,EAAS,EACpDa,GAAyBxB,GAAY,IAAI,EACzCyB,GAAwBzB,GAAY,KAAK,EACzC0B,GAA0BvB,EAASsB,GAAQd,EAAS,EACpDgB,GAA0BxB,EAASuB,GAAU,OAAO,EAExD,SAASE,EAAKC,EAAMC,EAAU,CAC1B,GAAI,CACA,MAAO,CACH,EAAGD,EAAK,MAAM,KAAMC,CAAQ,CAC/B,CACT,OACWC,EAAG,CACN,MAAO,CAAE,EAAGA,CAAG,CACvB,CACA,C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