{"version":3,"file":"vendors-2501b78c.f584a1446b2fc034d810.bundle.js","mappings":"AAGA","sources":["webpack://lernplattform-admin-frontend/./node_modules/amazon-chime-sdk-js/build/sdp/VideoCodecCapability.js","webpack://lernplattform-admin-frontend/./node_modules/amazon-chime-sdk-js/build/sdp/ZLIBTextCompressor.js","webpack://lernplattform-admin-frontend/./node_modules/amazon-chime-sdk-js/build/sessionstatecontroller/DefaultSessionStateController.js","webpack://lernplattform-admin-frontend/./node_modules/amazon-chime-sdk-js/build/sessionstatecontroller/SessionStateControllerAction.js","webpack://lernplattform-admin-frontend/./node_modules/amazon-chime-sdk-js/build/sessionstatecontroller/SessionStateControllerDeferPriority.js","webpack://lernplattform-admin-frontend/./node_modules/amazon-chime-sdk-js/build/sessionstatecontroller/SessionStateControllerState.js","webpack://lernplattform-admin-frontend/./node_modules/amazon-chime-sdk-js/build/sessionstatecontroller/SessionStateControllerTransitionResult.js","webpack://lernplattform-admin-frontend/./node_modules/amazon-chime-sdk-js/build/signalingclient/DefaultSignalingClient.js","webpack://lernplattform-admin-frontend/./node_modules/amazon-chime-sdk-js/build/signalingclient/ServerSideNetworkAdaption.js","webpack://lernplattform-admin-frontend/./node_modules/amazon-chime-sdk-js/build/signalingclient/SignalingClientConnectionRequest.js","webpack://lernplattform-admin-frontend/./node_modules/amazon-chime-sdk-js/build/signalingclient/SignalingClientEvent.js","webpack://lernplattform-admin-frontend/./node_modules/amazon-chime-sdk-js/build/signalingclient/SignalingClientEventType.js","webpack://lernplattform-admin-frontend/./node_modules/amazon-chime-sdk-js/build/signalingclient/SignalingClientJoin.js","webpack://lernplattform-admin-frontend/./node_modules/amazon-chime-sdk-js/build/signalingclient/SignalingClientSubscribe.js","webpack://lernplattform-admin-frontend/./node_modules/amazon-chime-sdk-js/build/signalingclient/SignalingClientVideoSubscriptionConfiguration.js","webpack://lernplattform-admin-frontend/./node_modules/amazon-chime-sdk-js/build/sigv4/DefaultSigV4.js"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst SignalingProtocol_1 = require(\"../signalingprotocol/SignalingProtocol\");\n/**\n * `VideoCodecCapability` represents a higher level type to wrap `RTCRtpCodecCapability`\n * and the codec name used in the SDP, while also namespacing static create functions\n * for codecs supported in the SDK.\n *\n * Note that `codecName` is different then `codecCapability.mimeType`\n */\nclass VideoCodecCapability {\n    constructor(codecName, codecCapability) {\n        this.codecName = codecName;\n        this.codecCapability = codecCapability;\n    }\n    equals(other) {\n        if (other === undefined) {\n            return false;\n        }\n        if (this.codecName !== other.codecName ||\n            this.codecCapability.mimeType !== other.codecCapability.mimeType ||\n            this.codecCapability.clockRate !== other.codecCapability.clockRate) {\n            return false;\n        }\n        const thisFmtpLine = this.codecCapability.sdpFmtpLine\n            ? this.cleanupFmtpLine(this.codecCapability.sdpFmtpLine, this.codecName)\n            : '';\n        const otherFmtpLine = other.codecCapability.sdpFmtpLine\n            ? this.cleanupFmtpLine(other.codecCapability.sdpFmtpLine, other.codecName)\n            : '';\n        return thisFmtpLine === otherFmtpLine;\n    }\n    /**\n     * Returns whether the codec capability fmtp line matches. This will not\n     * attempt to match H.264 profile levels (e.g. 5.2, 3.1), see internal comments for\n     * more detailed information. This function takes care of checking for an\n     * expected payload type as well.\n     *\n     * This function is meant to only be used internally.\n     */\n    fmtpLineMatches(line, expectedPayloadType) {\n        const codecCapabilityFmtpLine = this.codecCapability.sdpFmtpLine;\n        if (!codecCapabilityFmtpLine) {\n            return false;\n        }\n        const prefix = `a=fmtp:${expectedPayloadType} `;\n        if (!line.startsWith(prefix)) {\n            return false;\n        }\n        const fmtpLineFromSdp = line.substring(prefix.length);\n        return (this.cleanupFmtpLine(fmtpLineFromSdp, this.codecName) ===\n            this.cleanupFmtpLine(codecCapabilityFmtpLine, this.codecName));\n    }\n    /**\n     * Helper function to clean up the FMTP line by removing unnecessary parameters\n     * and normalizing certain codec-specific attributes.\n     */\n    cleanupFmtpLine(fmtpLine, codecName) {\n        // Remove starting bitrate parameter which isn't relevant to matching.\n        const bitrateRegex = /;x-google-start-bitrate=\\d+/g;\n        let cleanedLine = fmtpLine.replace(bitrateRegex, '');\n        if (codecName === 'H264') {\n            // Given that most H.264 decoders for the past decade can support level 5.2, we do not bother checking the Profile Level\n            // with regards to canonically defined, meeting wide, H.264 profile options (i.e. we intentionally do not split up `h264HighProfile`\n            // into `h264HighProfileLevel52, `h264HighProfileLevel31`, etc.).\n            //\n            // Additionally, Chrome bundles FFmpeg software decoders which while advertised as 3.1, will happily decode any bitrate/resolution.\n            //\n            // If maximum compatability with H.264 is desired by a builder they should stick to H.264 Constrained Baseline Profile.\n            const profileLevelIdRegex = /profile-level-id=([0-9a-f]{4})[0-9a-f]{2}/i;\n            cleanedLine = cleanedLine.replace(profileLevelIdRegex, 'profile-level-id=$1');\n        }\n        return cleanedLine;\n    }\n    /**\n     * Returns the configuration of VP8 supported by the SDK\n     */\n    static vp8() {\n        return new VideoCodecCapability('VP8', {\n            clockRate: 90000,\n            mimeType: 'video/VP8',\n        });\n    }\n    /**\n     * Returns the configuration of H.264 Baseline Profile supported by the SDK.\n     *\n     * This profile is more likely to use hardware for encode on most browsers\n     * then constrained baseline profile.\n     */\n    static h264BaselineProfile() {\n        return new VideoCodecCapability('H264', {\n            clockRate: 90000,\n            mimeType: 'video/H264',\n            sdpFmtpLine: 'level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f',\n        });\n    }\n    /**\n     * Returns the configuration of H.264 CBP supported by the SDK.\n     *\n     * This profile is required in all WebRTC implementations and typically\n     * uses software for the encode for stability. Hardware decode is common.\n     */\n    static h264ConstrainedBaselineProfile() {\n        return new VideoCodecCapability('H264', {\n            clockRate: 90000,\n            mimeType: 'video/H264',\n            sdpFmtpLine: 'level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f',\n        });\n    }\n    /**\n     * Returns the configuration of H.264 Main Profile supported by the SDK\n     *\n     * This profile is more likely to use hardware for encode on most browsers\n     * then constrained baseline profile. It may have modest quality/bitrate improvements\n     * over baseline/constrained baseline profile.\n     */\n    static h264MainProfile() {\n        return new VideoCodecCapability('H264', {\n            clockRate: 90000,\n            mimeType: 'video/H264',\n            sdpFmtpLine: 'level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=4d001f',\n        });\n    }\n    /**\n     * Returns the configuration of H.264 High Profile supported by the SDK.\n     *\n     * Currently most browsers do not have software fallback for high profile\n     * which may impact stability. Its usage should be done with caution.\n     *\n     * On MacOS, until https://bugs.chromium.org/p/chromium/issues/detail?id=1520287 is\n     * resolved, receivers will fail to allocate the decoder for this profile if the sender switches away and back\n     * to this codec (e.g. fallback for a Firefox receiver, and then recovery when the Firefox\n     * receiver leaves).\n     *\n     * If you expect a decent amount of iOS safari traffic, you should include `h264ConstrainedHighProfile` in your\n     * preferences as well. It will be forwarded as High profile to receivers that negotiated High but not Constrained\n     * High\n     */\n    static h264HighProfile() {\n        return new VideoCodecCapability('H264', {\n            clockRate: 90000,\n            mimeType: 'video/H264',\n            sdpFmtpLine: 'level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=64001f',\n        });\n    }\n    /**\n     * Returns the configuration of H.264 Constrained High Profile supported by the SDK\n     *\n     * This is currently only used on Safari. The same notes on H.264 High Profile apply to this\n     * codec.\n     */\n    static h264ConstrainedHighProfile() {\n        return new VideoCodecCapability('H264', {\n            clockRate: 90000,\n            mimeType: 'video/H264',\n            sdpFmtpLine: 'level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=640c1f',\n        });\n    }\n    /**\n     * Returns the configuration of H.264 recommended by the SDK for maximum compatability.\n     */\n    static h264() {\n        return VideoCodecCapability.h264ConstrainedBaselineProfile();\n    }\n    /**\n     * Returns the configuration of VP9 profile 0 supported by the SDK.\n     * Profile 0 is for use with 8-bit source content.\n     */\n    static vp9Profile0() {\n        return new VideoCodecCapability('VP9', {\n            clockRate: 90000,\n            mimeType: 'video/VP9',\n            sdpFmtpLine: 'profile-id=0',\n        });\n    }\n    /**\n     * Returns the configuration of AV1 recommended by the SDK\n     */\n    static vp9() {\n        return VideoCodecCapability.vp9Profile0();\n    }\n    /**\n     * Returns the configuration of AV1 main profile used by the SDK\n     */\n    static av1Main() {\n        return new VideoCodecCapability('AV1', {\n            clockRate: 90000,\n            mimeType: 'video/AV1',\n        });\n    }\n    /**\n     * Returns the configuration of AV1 recommended by the SDK\n     */\n    static av1() {\n        return VideoCodecCapability.av1Main();\n    }\n    /**\n     * Returns the configuration of codec corresponding to the signaled capability\n     */\n    static fromSignaled(capability) {\n        switch (capability) {\n            case SignalingProtocol_1.SdkVideoCodecCapability.VP8:\n                return VideoCodecCapability.vp8();\n            case SignalingProtocol_1.SdkVideoCodecCapability.H264_BASELINE_PROFILE:\n                return VideoCodecCapability.h264BaselineProfile();\n            case SignalingProtocol_1.SdkVideoCodecCapability.H264_CONSTRAINED_BASELINE_PROFILE:\n                return VideoCodecCapability.h264ConstrainedBaselineProfile();\n            case SignalingProtocol_1.SdkVideoCodecCapability.H264_MAIN_PROFILE:\n                return VideoCodecCapability.h264MainProfile();\n            case SignalingProtocol_1.SdkVideoCodecCapability.H264_HIGH_PROFILE:\n                return VideoCodecCapability.h264HighProfile();\n            case SignalingProtocol_1.SdkVideoCodecCapability.H264_CONSTRAINED_HIGH_PROFILE:\n                return VideoCodecCapability.h264ConstrainedHighProfile();\n            case SignalingProtocol_1.SdkVideoCodecCapability.VP9_PROFILE_0:\n                return VideoCodecCapability.vp9Profile0();\n            case SignalingProtocol_1.SdkVideoCodecCapability.AV1_MAIN_PROFILE:\n                return VideoCodecCapability.av1Main();\n            default:\n                return undefined;\n        }\n    }\n}\nexports.default = VideoCodecCapability;\n//# sourceMappingURL=VideoCodecCapability.js.map","\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst pako = require('pako');\n/**\n * [[ZLIBTextCompressor]] Performs the text compression and decompression using zlib\n */\nclass ZLIBTextCompressor {\n    /**\n     * Constructs an instance of [[ZLIBTextCompressor]]\n     * @param logger\n     */\n    constructor(logger) {\n        this.logger = logger;\n    }\n    /**\n     * Compresses the given text.\n     *\n     * Note: The dictionary used during compression should be the same as\n     * that being used during decompression.\n     *\n     * @param text - the text that needs to be compressed\n     * @param dictionary - that will be used to seed the compression\n     *      library to improve compression's performance\n     * @returns a compressed text\n     */\n    compress(text, dictionary) {\n        if (dictionary.length > 0) {\n            const dictionarySize = Math.min(dictionary.length, ZLIBTextCompressor.MAX_DICTIONARY_SIZE);\n            dictionary = dictionary.slice(0, dictionarySize);\n        }\n        const options = {\n            memLevel: ZLIBTextCompressor.Z_MEM_LEVEL,\n            dictionary: dictionary,\n        };\n        const compressedText = pako.deflateRaw(text, options);\n        return compressedText;\n    }\n    /**\n     * Decompresses the given text and returns the original text.\n     *\n     * Note: The dictionary used during compression should be the same as\n     * that being used during decompression.\n     *\n     * @param compressedText that will be decompressed\n     * @param dictionary that will be used to seed the compression library to improve\n     *      decompression's performance\n     * @returns decompressed string\n     */\n    decompress(compressedText, dictionary) {\n        if (dictionary.length > 0) {\n            const dictionarySize = Math.min(dictionary.length, ZLIBTextCompressor.MAX_DICTIONARY_SIZE);\n            dictionary = dictionary.slice(0, dictionarySize);\n        }\n        const options = {\n            to: 'string',\n            dictionary: dictionary,\n            chunkSize: 4096,\n        };\n        let decompressedText = '';\n        try {\n            decompressedText = pako.inflateRaw(compressedText, options);\n        }\n        catch (ex) {\n            this.logger.error(`failed to decompress the string with error: [${ex}]`);\n        }\n        return decompressedText;\n    }\n}\nexports.default = ZLIBTextCompressor;\n// The memory Level parameter specifies how much memory to use for the internal state.\n// Smaller values use less memory but are slower, while higher values use more memory\n// to gain compression speed.\n// Range is between 1 to 9\nZLIBTextCompressor.Z_MEM_LEVEL = 9;\n// 32kB is the maximum dictionary size supported by the zlib format.\nZLIBTextCompressor.MAX_DICTIONARY_SIZE = 31744; // 31 KB\n//# sourceMappingURL=ZLIBTextCompressor.js.map","\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst SessionStateControllerAction_1 = require(\"./SessionStateControllerAction\");\nconst SessionStateControllerDeferPriority_1 = require(\"./SessionStateControllerDeferPriority\");\nconst SessionStateControllerState_1 = require(\"./SessionStateControllerState\");\nconst SessionStateControllerTransitionResult_1 = require(\"./SessionStateControllerTransitionResult\");\nclass DefaultSessionStateController {\n    constructor(logger) {\n        this.logger = logger;\n        this.currentState = SessionStateControllerState_1.SessionStateControllerState.NotConnected;\n        this.deferredAction = null;\n        this.deferredWork = null;\n    }\n    perform(action, work) {\n        const state = this.currentState;\n        if (state === SessionStateControllerState_1.SessionStateControllerState.NotConnected &&\n            action === SessionStateControllerAction_1.SessionStateControllerAction.Connect) {\n            this.transition(SessionStateControllerState_1.SessionStateControllerState.Connecting, action);\n        }\n        else if (state === SessionStateControllerState_1.SessionStateControllerState.Connecting &&\n            action === SessionStateControllerAction_1.SessionStateControllerAction.Fail) {\n            this.transition(SessionStateControllerState_1.SessionStateControllerState.Disconnecting, action);\n        }\n        else if (state === SessionStateControllerState_1.SessionStateControllerState.Connecting &&\n            action === SessionStateControllerAction_1.SessionStateControllerAction.FinishConnecting) {\n            this.transition(SessionStateControllerState_1.SessionStateControllerState.Connected, action);\n        }\n        else if (state === SessionStateControllerState_1.SessionStateControllerState.Connected &&\n            action === SessionStateControllerAction_1.SessionStateControllerAction.Disconnect) {\n            this.transition(SessionStateControllerState_1.SessionStateControllerState.Disconnecting, action);\n        }\n        else if (state === SessionStateControllerState_1.SessionStateControllerState.Connected &&\n            action === SessionStateControllerAction_1.SessionStateControllerAction.Reconnect) {\n            this.transition(SessionStateControllerState_1.SessionStateControllerState.Connecting, action);\n        }\n        else if (state === SessionStateControllerState_1.SessionStateControllerState.Connected &&\n            action === SessionStateControllerAction_1.SessionStateControllerAction.Fail) {\n            this.transition(SessionStateControllerState_1.SessionStateControllerState.Disconnecting, action);\n        }\n        else if (state === SessionStateControllerState_1.SessionStateControllerState.Connected &&\n            action === SessionStateControllerAction_1.SessionStateControllerAction.Update) {\n            this.transition(SessionStateControllerState_1.SessionStateControllerState.Updating, action);\n        }\n        else if (state === SessionStateControllerState_1.SessionStateControllerState.Updating &&\n            action === SessionStateControllerAction_1.SessionStateControllerAction.Fail) {\n            this.transition(SessionStateControllerState_1.SessionStateControllerState.Disconnecting, action);\n        }\n        else if (state === SessionStateControllerState_1.SessionStateControllerState.Updating &&\n            action === SessionStateControllerAction_1.SessionStateControllerAction.FinishUpdating) {\n            this.transition(SessionStateControllerState_1.SessionStateControllerState.Connected, action);\n        }\n        else if (state === SessionStateControllerState_1.SessionStateControllerState.Disconnecting &&\n            action === SessionStateControllerAction_1.SessionStateControllerAction.FinishDisconnecting) {\n            this.transition(SessionStateControllerState_1.SessionStateControllerState.NotConnected, action);\n        }\n        else if (this.canDefer(action)) {\n            this.logger.info(`deferring transition from ${SessionStateControllerState_1.SessionStateControllerState[this.currentState]} with ${SessionStateControllerAction_1.SessionStateControllerAction[action]}`);\n            this.deferAction(action, work);\n            return SessionStateControllerTransitionResult_1.SessionStateControllerTransitionResult.DeferredTransition;\n        }\n        else {\n            this.logger.warn(`no transition found from ${SessionStateControllerState_1.SessionStateControllerState[this.currentState]} with ${SessionStateControllerAction_1.SessionStateControllerAction[action]}`);\n            return SessionStateControllerTransitionResult_1.SessionStateControllerTransitionResult.NoTransitionAvailable;\n        }\n        try {\n            work();\n        }\n        catch (e) {\n            this.logger.error(`error during state ${SessionStateControllerState_1.SessionStateControllerState[this.currentState]} with action ${SessionStateControllerAction_1.SessionStateControllerAction[action]}: ${e}`);\n            this.logger.info(`rolling back transition to ${SessionStateControllerState_1.SessionStateControllerState[state]}`);\n            this.currentState = state;\n            return SessionStateControllerTransitionResult_1.SessionStateControllerTransitionResult.TransitionFailed;\n        }\n        this.performDeferredAction();\n        return SessionStateControllerTransitionResult_1.SessionStateControllerTransitionResult.Transitioned;\n    }\n    state() {\n        return this.currentState;\n    }\n    transition(newState, action) {\n        this.logger.info(`transitioning from ${SessionStateControllerState_1.SessionStateControllerState[this.currentState]} to ${SessionStateControllerState_1.SessionStateControllerState[newState]} with ${SessionStateControllerAction_1.SessionStateControllerAction[action]}`);\n        this.currentState = newState;\n    }\n    deferPriority(action) {\n        switch (action) {\n            case SessionStateControllerAction_1.SessionStateControllerAction.Disconnect:\n                return SessionStateControllerDeferPriority_1.SessionStateControllerDeferPriority.VeryHigh;\n            case SessionStateControllerAction_1.SessionStateControllerAction.Fail:\n                return SessionStateControllerDeferPriority_1.SessionStateControllerDeferPriority.High;\n            case SessionStateControllerAction_1.SessionStateControllerAction.Reconnect:\n                return SessionStateControllerDeferPriority_1.SessionStateControllerDeferPriority.Medium;\n            case SessionStateControllerAction_1.SessionStateControllerAction.Update:\n                return SessionStateControllerDeferPriority_1.SessionStateControllerDeferPriority.Low;\n            default:\n                return SessionStateControllerDeferPriority_1.SessionStateControllerDeferPriority.DoNotDefer;\n        }\n    }\n    deferAction(action, work) {\n        if (this.deferredAction !== null &&\n            this.deferPriority(this.deferredAction) > this.deferPriority(action)) {\n            return;\n        }\n        this.deferredAction = action;\n        this.deferredWork = work;\n    }\n    canDefer(action) {\n        return (this.deferPriority(action) !== SessionStateControllerDeferPriority_1.SessionStateControllerDeferPriority.DoNotDefer &&\n            (this.currentState === SessionStateControllerState_1.SessionStateControllerState.Connecting ||\n                this.currentState === SessionStateControllerState_1.SessionStateControllerState.Updating));\n    }\n    performDeferredAction() {\n        if (!this.deferredAction) {\n            return;\n        }\n        const deferredAction = this.deferredAction;\n        const deferredWork = this.deferredWork;\n        this.deferredAction = null;\n        this.deferredWork = null;\n        this.logger.info(`performing deferred action ${SessionStateControllerAction_1.SessionStateControllerAction[deferredAction]}`);\n        if (this.perform(deferredAction, deferredWork) !==\n            SessionStateControllerTransitionResult_1.SessionStateControllerTransitionResult.Transitioned) {\n            this.logger.info(`unable to perform deferred action ${SessionStateControllerAction_1.SessionStateControllerAction[deferredAction]} in state ${SessionStateControllerState_1.SessionStateControllerState[this.currentState]}`);\n        }\n    }\n}\nexports.default = DefaultSessionStateController;\n//# sourceMappingURL=DefaultSessionStateController.js.map","\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.SessionStateControllerAction = void 0;\n/**\n * [[SessionStateControllerAction]] is a state-changing action to perform.\n */\nvar SessionStateControllerAction;\n(function (SessionStateControllerAction) {\n    SessionStateControllerAction[SessionStateControllerAction[\"Connect\"] = 0] = \"Connect\";\n    SessionStateControllerAction[SessionStateControllerAction[\"FinishConnecting\"] = 1] = \"FinishConnecting\";\n    SessionStateControllerAction[SessionStateControllerAction[\"Update\"] = 2] = \"Update\";\n    SessionStateControllerAction[SessionStateControllerAction[\"FinishUpdating\"] = 3] = \"FinishUpdating\";\n    SessionStateControllerAction[SessionStateControllerAction[\"Reconnect\"] = 4] = \"Reconnect\";\n    SessionStateControllerAction[SessionStateControllerAction[\"Disconnect\"] = 5] = \"Disconnect\";\n    SessionStateControllerAction[SessionStateControllerAction[\"Fail\"] = 6] = \"Fail\";\n    SessionStateControllerAction[SessionStateControllerAction[\"FinishDisconnecting\"] = 7] = \"FinishDisconnecting\";\n})(SessionStateControllerAction = exports.SessionStateControllerAction || (exports.SessionStateControllerAction = {}));\nexports.default = SessionStateControllerAction;\n//# sourceMappingURL=SessionStateControllerAction.js.map","\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.SessionStateControllerDeferPriority = void 0;\n/**\n * [[SessionStateControllerDeferPriority]] indicates the priority level of the action\n * being deferred. For example, stop is more important than update so if forced\n * to pick between the two stop should be chosen.\n */\nvar SessionStateControllerDeferPriority;\n(function (SessionStateControllerDeferPriority) {\n    SessionStateControllerDeferPriority[SessionStateControllerDeferPriority[\"DoNotDefer\"] = 0] = \"DoNotDefer\";\n    SessionStateControllerDeferPriority[SessionStateControllerDeferPriority[\"Low\"] = 1] = \"Low\";\n    SessionStateControllerDeferPriority[SessionStateControllerDeferPriority[\"Medium\"] = 2] = \"Medium\";\n    SessionStateControllerDeferPriority[SessionStateControllerDeferPriority[\"High\"] = 3] = \"High\";\n    SessionStateControllerDeferPriority[SessionStateControllerDeferPriority[\"VeryHigh\"] = 4] = \"VeryHigh\";\n})(SessionStateControllerDeferPriority = exports.SessionStateControllerDeferPriority || (exports.SessionStateControllerDeferPriority = {}));\nexports.default = SessionStateControllerDeferPriority;\n//# sourceMappingURL=SessionStateControllerDeferPriority.js.map","\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.SessionStateControllerState = void 0;\n/**\n * [[SessionStateControllerState]] reflects the current connection state of the session.\n */\nvar SessionStateControllerState;\n(function (SessionStateControllerState) {\n    SessionStateControllerState[SessionStateControllerState[\"NotConnected\"] = 0] = \"NotConnected\";\n    SessionStateControllerState[SessionStateControllerState[\"Connecting\"] = 1] = \"Connecting\";\n    SessionStateControllerState[SessionStateControllerState[\"Connected\"] = 2] = \"Connected\";\n    SessionStateControllerState[SessionStateControllerState[\"Updating\"] = 3] = \"Updating\";\n    SessionStateControllerState[SessionStateControllerState[\"Disconnecting\"] = 4] = \"Disconnecting\";\n})(SessionStateControllerState = exports.SessionStateControllerState || (exports.SessionStateControllerState = {}));\nexports.default = SessionStateControllerState;\n//# sourceMappingURL=SessionStateControllerState.js.map","\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.SessionStateControllerTransitionResult = void 0;\n/**\n * Indicates the result of an attempted state transition.\n */\nvar SessionStateControllerTransitionResult;\n(function (SessionStateControllerTransitionResult) {\n    /**\n     * The transition was successful.\n     */\n    SessionStateControllerTransitionResult[SessionStateControllerTransitionResult[\"Transitioned\"] = 0] = \"Transitioned\";\n    /**\n     * No transition is available from the current state using that action.\n     */\n    SessionStateControllerTransitionResult[SessionStateControllerTransitionResult[\"NoTransitionAvailable\"] = 1] = \"NoTransitionAvailable\";\n    /**\n     * The transition will be tried on the next state.\n     */\n    SessionStateControllerTransitionResult[SessionStateControllerTransitionResult[\"DeferredTransition\"] = 2] = \"DeferredTransition\";\n    /**\n     * An unexpected error occurred while transitioning to the next state.\n     */\n    SessionStateControllerTransitionResult[SessionStateControllerTransitionResult[\"TransitionFailed\"] = 3] = \"TransitionFailed\";\n})(SessionStateControllerTransitionResult = exports.SessionStateControllerTransitionResult || (exports.SessionStateControllerTransitionResult = {}));\nexports.default = SessionStateControllerTransitionResult;\n//# sourceMappingURL=SessionStateControllerTransitionResult.js.map","\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n    return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst DefaultBrowserBehavior_1 = __importDefault(require(\"../browserbehavior/DefaultBrowserBehavior\"));\nconst TimeoutScheduler_1 = __importDefault(require(\"../scheduler/TimeoutScheduler\"));\nconst SignalingProtocol_js_1 = require(\"../signalingprotocol/SignalingProtocol.js\");\nconst Utils_1 = require(\"../utils/Utils\");\nconst Versioning_1 = __importDefault(require(\"../versioning/Versioning\"));\nconst VideoQualityAdaptationPreference_1 = __importDefault(require(\"../videodownlinkbandwidthpolicy/VideoQualityAdaptationPreference\"));\nconst WebSocketReadyState_1 = __importDefault(require(\"../websocketadapter/WebSocketReadyState\"));\nconst ServerSideNetworkAdaption_1 = require(\"./ServerSideNetworkAdaption\");\nconst SignalingClientEvent_1 = __importDefault(require(\"./SignalingClientEvent\"));\nconst SignalingClientEventType_1 = __importDefault(require(\"./SignalingClientEventType\"));\n/**\n * [[DefaultSignalingClient]] implements the SignalingClient interface.\n */\nclass DefaultSignalingClient {\n    constructor(webSocket, logger) {\n        this.webSocket = webSocket;\n        this.logger = logger;\n        this.unloadHandler = null;\n        this.closeEventHandler = (event) => {\n            this.deactivatePageUnloadHandler();\n            this.resetConnection();\n            this.sendEvent(new SignalingClientEvent_1.default(this, SignalingClientEventType_1.default.WebSocketClosed, null, event.code, event.reason));\n            this.serviceConnectionRequestQueue();\n        };\n        this.observerQueue = new Set();\n        this.connectionRequestQueue = [];\n        this.resetConnection();\n        this.logger.debug(() => 'signaling client init');\n        this.audioSessionId = this.generateNewAudioSessionId();\n    }\n    registerObserver(observer) {\n        this.logger.debug(() => 'registering signaling client observer');\n        this.observerQueue.add(observer);\n    }\n    removeObserver(observer) {\n        this.logger.debug(() => 'removing signaling client observer');\n        this.observerQueue.delete(observer);\n    }\n    openConnection(request) {\n        this.logger.info('adding connection request to queue: ' + request.url());\n        this.connectionRequestQueue.push(request);\n        this.closeConnection();\n    }\n    pingPong(pingPongFrame) {\n        this.logger.debug(() => 'sending ping');\n        const message = SignalingProtocol_js_1.SdkSignalFrame.create();\n        message.type = SignalingProtocol_js_1.SdkSignalFrame.Type.PING_PONG;\n        message.pingPong = pingPongFrame;\n        this.sendMessage(message);\n        return message.timestampMs;\n    }\n    join(settings) {\n        this.logger.info('sending join');\n        const joinFrame = SignalingProtocol_js_1.SdkJoinFrame.create();\n        joinFrame.protocolVersion = 2;\n        joinFrame.flags = SignalingProtocol_js_1.SdkJoinFlags.HAS_STREAM_UPDATE;\n        const browserBehavior = new DefaultBrowserBehavior_1.default();\n        const sdkClientDetails = {\n            platformName: browserBehavior.name(),\n            platformVersion: browserBehavior.version(),\n            clientSource: Versioning_1.default.sdkName,\n            chimeSdkVersion: Versioning_1.default.sdkVersion,\n            clientUtcOffset: Utils_1.getFormattedOffset(new Date().getTimezoneOffset()),\n        };\n        if (settings.applicationMetadata) {\n            const { appName, appVersion } = settings.applicationMetadata;\n            sdkClientDetails.appName = appName;\n            sdkClientDetails.appVersion = appVersion;\n        }\n        joinFrame.clientDetails = SignalingProtocol_js_1.SdkClientDetails.create(sdkClientDetails);\n        joinFrame.audioSessionId = this.audioSessionId;\n        joinFrame.wantsCompressedSdp = DefaultSignalingClient.CLIENT_SUPPORTS_COMPRESSION;\n        joinFrame.disablePeriodicKeyframeRequestOnContentSender =\n            settings.disablePeriodicKeyframeRequestOnContentSender;\n        joinFrame.serverSideNetworkAdaption = ServerSideNetworkAdaption_1.convertServerSideNetworkAdaptionEnumToSignaled(settings.serverSideNetworkAdaption);\n        joinFrame.supportedServerSideNetworkAdaptions = settings.supportedServerSideNetworkAdaptions.map(ServerSideNetworkAdaption_1.convertServerSideNetworkAdaptionEnumToSignaled);\n        joinFrame.wantsAllTemporalLayersInIndex = settings.wantsAllTemporalLayersInIndex;\n        const message = SignalingProtocol_js_1.SdkSignalFrame.create();\n        message.type = SignalingProtocol_js_1.SdkSignalFrame.Type.JOIN;\n        message.join = joinFrame;\n        this.sendMessage(message);\n    }\n    subscribe(settings) {\n        const subscribeFrame = SignalingProtocol_js_1.SdkSubscribeFrame.create();\n        subscribeFrame.sendStreams = [];\n        subscribeFrame.sdpOffer = settings.sdpOffer;\n        if (settings.connectionTypeHasVideo) {\n            subscribeFrame.receiveStreamIds = settings.receiveStreamIds;\n        }\n        if (settings.audioHost) {\n            subscribeFrame.audioCheckin = settings.audioCheckin;\n            subscribeFrame.audioHost = settings.audioHost;\n            subscribeFrame.audioMuted = settings.audioMuted;\n            if (!settings.audioCheckin) {\n                const audioStream = SignalingProtocol_js_1.SdkStreamDescriptor.create();\n                audioStream.mediaType = SignalingProtocol_js_1.SdkStreamMediaType.AUDIO;\n                audioStream.trackLabel = 'AmazonChimeExpressAudio';\n                audioStream.attendeeId = settings.attendeeId;\n                audioStream.streamId = 1;\n                audioStream.groupId = 1;\n                audioStream.framerate = 15;\n                audioStream.maxBitrateKbps = 600;\n                audioStream.avgBitrateBps = 400000;\n                subscribeFrame.sendStreams.push(audioStream);\n            }\n        }\n        subscribeFrame.compressedSdpOffer = settings.compressedSdpOffer;\n        subscribeFrame.duplex = SignalingProtocol_js_1.SdkStreamServiceType.RX;\n        if (settings.localVideoEnabled) {\n            subscribeFrame.duplex = SignalingProtocol_js_1.SdkStreamServiceType.DUPLEX;\n            for (let i = 0; i < settings.videoStreamDescriptions.length; i++) {\n                // Non-simulcast use DefaultVideoStreamIndex.localStreamDescriptions\n                // which is the exact old behavior\n                const streamDescription = settings.videoStreamDescriptions[i].clone();\n                streamDescription.attendeeId = settings.attendeeId;\n                subscribeFrame.sendStreams.push(streamDescription.toStreamDescriptor());\n            }\n        }\n        if (settings.videoSubscriptionConfiguration.length > 0) {\n            subscribeFrame.videoSubscriptionConfiguration = settings.videoSubscriptionConfiguration.map(this.convertSignalingClientVideoSubscriptionConfiguration);\n        }\n        const message = SignalingProtocol_js_1.SdkSignalFrame.create();\n        message.type = SignalingProtocol_js_1.SdkSignalFrame.Type.SUBSCRIBE;\n        message.sub = subscribeFrame;\n        this.sendMessage(message);\n    }\n    remoteVideoUpdate(addedOrUpdated, removed) {\n        const remoteVideoUpdate = SignalingProtocol_js_1.SdkRemoteVideoUpdateFrame.create();\n        remoteVideoUpdate.addedOrUpdatedVideoSubscriptions = addedOrUpdated.map(this.convertSignalingClientVideoSubscriptionConfiguration);\n        remoteVideoUpdate.removedVideoSubscriptionMids = removed;\n        const message = SignalingProtocol_js_1.SdkSignalFrame.create();\n        message.type = SignalingProtocol_js_1.SdkSignalFrame.Type.REMOTE_VIDEO_UPDATE;\n        message.remoteVideoUpdate = remoteVideoUpdate;\n        this.sendMessage(message);\n    }\n    convertSignalingClientVideoSubscriptionConfiguration(config) {\n        const signalConfig = new SignalingProtocol_js_1.SdkVideoSubscriptionConfiguration();\n        signalConfig.mid = config.mid;\n        signalConfig.attendeeId = config.attendeeId;\n        signalConfig.streamId = config.streamId;\n        signalConfig.groupId = config.groupId;\n        signalConfig.priority = config.priority;\n        signalConfig.targetBitrateKbps = config.targetBitrateKbps;\n        switch (config.qualityAdaptationPreference) {\n            case VideoQualityAdaptationPreference_1.default.Balanced:\n                signalConfig.qualityAdaptationPreference = SignalingProtocol_js_1.SdkVideoQualityAdaptationPreference.BALANCED;\n                break;\n            case VideoQualityAdaptationPreference_1.default.MaintainFramerate:\n                signalConfig.qualityAdaptationPreference =\n                    SignalingProtocol_js_1.SdkVideoQualityAdaptationPreference.MAINTAIN_FRAMERATE;\n                break;\n            case VideoQualityAdaptationPreference_1.default.MaintainResolution:\n                signalConfig.qualityAdaptationPreference =\n                    SignalingProtocol_js_1.SdkVideoQualityAdaptationPreference.MAINTAIN_RESOLUTION;\n                break;\n            default:\n                signalConfig.qualityAdaptationPreference = SignalingProtocol_js_1.SdkVideoQualityAdaptationPreference.BALANCED;\n        }\n        return signalConfig;\n    }\n    leave() {\n        const message = SignalingProtocol_js_1.SdkSignalFrame.create();\n        message.type = SignalingProtocol_js_1.SdkSignalFrame.Type.LEAVE;\n        message.leave = SignalingProtocol_js_1.SdkLeaveFrame.create();\n        this.sendMessage(message);\n        this.logger.debug(() => {\n            return 'sent leave';\n        });\n    }\n    sendClientMetrics(clientMetricFrame) {\n        const message = SignalingProtocol_js_1.SdkSignalFrame.create();\n        message.type = SignalingProtocol_js_1.SdkSignalFrame.Type.CLIENT_METRIC;\n        message.clientMetric = clientMetricFrame;\n        this.sendMessage(message);\n    }\n    sendDataMessage(messageFrame) {\n        const message = SignalingProtocol_js_1.SdkSignalFrame.create();\n        message.type = SignalingProtocol_js_1.SdkSignalFrame.Type.DATA_MESSAGE;\n        message.dataMessage = messageFrame;\n        this.sendMessage(message);\n    }\n    closeConnection() {\n        var _a, _b;\n        if (this.webSocket.readyState() !== WebSocketReadyState_1.default.None &&\n            this.webSocket.readyState() !== WebSocketReadyState_1.default.Closed) {\n            this.isClosing = true;\n            this.sendEvent(new SignalingClientEvent_1.default(this, SignalingClientEventType_1.default.WebSocketClosing, null));\n            // Continue resetting the connection even if SDK does not receive the \"close\" event.\n            const scheduler = new TimeoutScheduler_1.default(DefaultSignalingClient.CLOSE_EVENT_TIMEOUT_MS);\n            const handler = (event) => {\n                var _a, _b;\n                /* istanbul ignore next */\n                (_b = (_a = this.webSocket).removeEventListener) === null || _b === void 0 ? void 0 : _b.call(_a, 'close', handler);\n                scheduler.stop();\n                this.closeEventHandler(event);\n            };\n            // Remove the existing close handler to prevent SDK from opening a new connection.\n            /* istanbul ignore next */\n            (_b = (_a = this.webSocket).removeEventListener) === null || _b === void 0 ? void 0 : _b.call(_a, 'close', this.closeEventHandler);\n            this.webSocket.addEventListener('close', handler);\n            scheduler.start(() => {\n                // SDK has not received the \"close\" event on WebSocket for two seconds.\n                //\n                // We report it as a graceful close with no message as there should be no end-user\n                // impact of this timeout, and we do not want to trigger any non-graceful disconnection handling\n                // like reconnection.\n                handler(new CloseEvent('close', { wasClean: false, code: 1005, reason: '', bubbles: false }));\n            });\n            this.webSocket.close();\n            this.deactivatePageUnloadHandler();\n        }\n        else {\n            this.logger.info('no existing signaling client connection needs closing');\n            this.serviceConnectionRequestQueue();\n        }\n    }\n    ready() {\n        return (this.webSocket.readyState() === WebSocketReadyState_1.default.Open && !this.isClosing && this.wasOpened);\n    }\n    mute(muted) {\n        const message = SignalingProtocol_js_1.SdkSignalFrame.create();\n        message.type = SignalingProtocol_js_1.SdkSignalFrame.Type.AUDIO_CONTROL;\n        const audioControl = SignalingProtocol_js_1.SdkAudioControlFrame.create();\n        audioControl.muted = muted;\n        message.audioControl = audioControl;\n        this.sendMessage(message);\n    }\n    pause(streamIds) {\n        const message = SignalingProtocol_js_1.SdkSignalFrame.create();\n        message.type = SignalingProtocol_js_1.SdkSignalFrame.Type.PAUSE;\n        message.pause = SignalingProtocol_js_1.SdkPauseResumeFrame.create();\n        message.pause.streamIds = streamIds;\n        this.sendMessage(message);\n    }\n    resume(streamIds) {\n        const message = SignalingProtocol_js_1.SdkSignalFrame.create();\n        message.type = SignalingProtocol_js_1.SdkSignalFrame.Type.RESUME;\n        message.pause = SignalingProtocol_js_1.SdkPauseResumeFrame.create();\n        message.pause.streamIds = streamIds;\n        this.sendMessage(message);\n    }\n    resetConnection() {\n        this.webSocket.destroy();\n        this.wasOpened = false;\n    }\n    sendMessage(message) {\n        message.timestampMs = Date.now();\n        this.logger.debug(() => `sending: ${JSON.stringify(message)}`);\n        const buffer = this.prependWithFrameTypeRTC(SignalingProtocol_js_1.SdkSignalFrame.encode(message).finish());\n        if (this.ready()) {\n            if (!this.webSocket.send(buffer)) {\n                this.sendEvent(new SignalingClientEvent_1.default(this, SignalingClientEventType_1.default.WebSocketSendMessageFailure, null));\n                return;\n            }\n            this.sendEvent(new SignalingClientEvent_1.default(this, SignalingClientEventType_1.default.WebSocketSentMessage, null));\n        }\n        else {\n            this.sendEvent(new SignalingClientEvent_1.default(this, SignalingClientEventType_1.default.WebSocketSkippedMessage, null));\n        }\n    }\n    receiveMessage(inBuffer) {\n        let message;\n        try {\n            message = SignalingProtocol_js_1.SdkSignalFrame.decode(inBuffer);\n        }\n        catch (e) {\n            this.logger.info(`failed to decode: ${inBuffer}`);\n            this.sendEvent(new SignalingClientEvent_1.default(this, SignalingClientEventType_1.default.ProtocolDecodeFailure, null));\n            return;\n        }\n        this.logger.debug(() => `received: ${JSON.stringify(message)}`);\n        if (this.webSocket.readyState() === WebSocketReadyState_1.default.Open) {\n            this.sendEvent(new SignalingClientEvent_1.default(this, SignalingClientEventType_1.default.ReceivedSignalFrame, message));\n        }\n        else {\n            this.logger.info(`skipping notification of message since WebSocket is not open: ${JSON.stringify(message)}`);\n        }\n    }\n    stripFrameTypeRTC(inBuffer) {\n        const frameType = inBuffer[0];\n        // TODO: change server frame type to send 0x05\n        if (frameType !== DefaultSignalingClient.FRAME_TYPE_RTC && frameType !== 0x02) {\n            this.logger.warn(`expected FrameTypeRTC for message but got ${frameType}`);\n        }\n        return inBuffer.slice(1);\n    }\n    prependWithFrameTypeRTC(inBuffer) {\n        const outBuffer = new Uint8Array(inBuffer.length + 1);\n        outBuffer[0] = DefaultSignalingClient.FRAME_TYPE_RTC;\n        outBuffer.set(inBuffer, 1);\n        return outBuffer;\n    }\n    serviceConnectionRequestQueue() {\n        if (this.connectionRequestQueue.length === 0) {\n            this.logger.info('no connection requests to service');\n            return;\n        }\n        const request = this.connectionRequestQueue.shift();\n        this.logger.info(`opening connection to ${request.url()}`);\n        this.isClosing = false;\n        this.webSocket.create(request.url(), request.protocols());\n        this.setUpEventListeners();\n        this.sendEvent(new SignalingClientEvent_1.default(this, SignalingClientEventType_1.default.WebSocketConnecting, null));\n    }\n    sendEvent(event) {\n        switch (event.type) {\n            case SignalingClientEventType_1.default.WebSocketMessage:\n            case SignalingClientEventType_1.default.ReceivedSignalFrame:\n            case SignalingClientEventType_1.default.WebSocketSentMessage:\n                this.logger.debug(() => `notifying event: ${SignalingClientEventType_1.default[event.type]}`);\n                break;\n            case SignalingClientEventType_1.default.WebSocketSkippedMessage:\n                this.logger.debug(() => `notifying event: ${SignalingClientEventType_1.default[event.type]}, websocket state=${WebSocketReadyState_1.default[this.webSocket.readyState()]}`);\n                break;\n            case SignalingClientEventType_1.default.WebSocketClosed:\n                this.logger.info(`notifying event: ${SignalingClientEventType_1.default[event.type]}, \n              code: ${event.closeCode} reason: ${event.closeReason}`);\n                break;\n            default:\n                this.logger.info(`notifying event: ${SignalingClientEventType_1.default[event.type]}`);\n                break;\n        }\n        for (const observer of this.observerQueue) {\n            observer.handleSignalingClientEvent(event);\n        }\n    }\n    setUpEventListeners() {\n        this.webSocket.addEventListener('open', () => {\n            this.activatePageUnloadHandler();\n            this.wasOpened = true;\n            this.sendEvent(new SignalingClientEvent_1.default(this, SignalingClientEventType_1.default.WebSocketOpen, null));\n        });\n        this.webSocket.addEventListener('message', (event) => {\n            this.sendEvent(new SignalingClientEvent_1.default(this, SignalingClientEventType_1.default.WebSocketMessage, null));\n            this.receiveMessage(this.stripFrameTypeRTC(new Uint8Array(event.data)));\n        });\n        this.webSocket.addEventListener('close', this.closeEventHandler);\n        this.webSocket.addEventListener('error', () => {\n            if (this.isClosing && !this.wasOpened) {\n                this.logger.info('Signaling WebSocket ignoring error closing while connecting');\n                return;\n            }\n            if (this.wasOpened) {\n                this.logger.error('Signaling WebSocket received error while connected');\n                this.sendEvent(new SignalingClientEvent_1.default(this, SignalingClientEventType_1.default.WebSocketError, null));\n            }\n            else {\n                this.logger.error('Signaling WebSocket received error while connecting');\n                this.sendEvent(new SignalingClientEvent_1.default(this, SignalingClientEventType_1.default.WebSocketFailed, null));\n            }\n        });\n    }\n    activatePageUnloadHandler() {\n        this.unloadHandler = () => {\n            this.leave();\n        };\n        // eslint-disable-next-line @typescript-eslint/no-explicit-any\n        const GlobalAny = global;\n        GlobalAny['window'] &&\n            GlobalAny['window']['addEventListener'] &&\n            window.addEventListener('unload', this.unloadHandler);\n    }\n    deactivatePageUnloadHandler() {\n        // eslint-disable-next-line @typescript-eslint/no-explicit-any\n        const GlobalAny = global;\n        GlobalAny['window'] &&\n            GlobalAny['window']['removeEventListener'] &&\n            window.removeEventListener('unload', this.unloadHandler);\n        this.unloadHandler = null;\n    }\n    generateNewAudioSessionId() {\n        const num = new Uint32Array(1);\n        Utils_1.getRandomValues(num);\n        return num[0];\n    }\n    promoteToPrimaryMeeting(credentials) {\n        const signaledCredentials = SignalingProtocol_js_1.SdkMeetingSessionCredentials.create();\n        signaledCredentials.attendeeId = credentials.attendeeId;\n        signaledCredentials.externalUserId = credentials.externalUserId;\n        signaledCredentials.joinToken = credentials.joinToken;\n        const primaryMeetingJoin = SignalingProtocol_js_1.SdkPrimaryMeetingJoinFrame.create();\n        primaryMeetingJoin.credentials = signaledCredentials;\n        const message = SignalingProtocol_js_1.SdkSignalFrame.create();\n        message.type = SignalingProtocol_js_1.SdkSignalFrame.Type.PRIMARY_MEETING_JOIN;\n        message.primaryMeetingJoin = primaryMeetingJoin;\n        this.sendMessage(message);\n    }\n    demoteFromPrimaryMeeting() {\n        const primaryMeetingLeave = SignalingProtocol_js_1.SdkPrimaryMeetingLeaveFrame.create();\n        const message = SignalingProtocol_js_1.SdkSignalFrame.create();\n        message.type = SignalingProtocol_js_1.SdkSignalFrame.Type.PRIMARY_MEETING_LEAVE;\n        message.primaryMeetingLeave = primaryMeetingLeave;\n        this.sendMessage(message);\n    }\n}\nexports.default = DefaultSignalingClient;\nDefaultSignalingClient.FRAME_TYPE_RTC = 0x5;\nDefaultSignalingClient.CLOSE_EVENT_TIMEOUT_MS = 2000;\nDefaultSignalingClient.CLIENT_SUPPORTS_COMPRESSION = true;\n//# sourceMappingURL=DefaultSignalingClient.js.map","\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.convertServerSideNetworkAdaptionEnumToSignaled = exports.convertServerSideNetworkAdaptionEnumFromSignaled = exports.serverSideNetworkAdaptionIsNoneOrDefault = exports.ServerSideNetworkAdaption = void 0;\nconst SignalingProtocol_1 = require(\"../signalingprotocol/SignalingProtocol\");\n/**\n * [[ServerSideNetworkAdaption]] represents additional server side features that can be enabled for network adaption.\n */\nvar ServerSideNetworkAdaption;\n(function (ServerSideNetworkAdaption) {\n    /**\n     * This value will currently be overwritten to `BandwidthProbingAndRemoteVideoQualityAdaption`\n     */\n    ServerSideNetworkAdaption[ServerSideNetworkAdaption[\"Default\"] = 0] = \"Default\";\n    /**\n     * @deprecated: Please switch to 'BandwidthProbingAndRemoteVideoQualityAdaption'\n     */\n    ServerSideNetworkAdaption[ServerSideNetworkAdaption[\"None\"] = 1] = \"None\";\n    /**\n     * @deprecated: Please switch to 'BandwidthProbingAndRemoteVideoQualityAdaption'.\n     */\n    ServerSideNetworkAdaption[ServerSideNetworkAdaption[\"BandwidthProbing\"] = 2] = \"BandwidthProbing\";\n    /**\n     * Disable internal policy behavior and proxy priorities to server to automatically\n     * switch, pause, or resume streams based on server calculated network constraints. This will\n     * significantly improve response times when network constraints occur. This will also support the\n     * features covered in `BandwidthProbing` though possibly with different implementation details.\n     *\n     * End users should overall see reduced video freezes, reduced broken audio, and reduced packet loss.\n     * The value impacts response to network events and may lead to remote video pauses/downgrades\n     * that did not occur before.\n     */\n    ServerSideNetworkAdaption[ServerSideNetworkAdaption[\"BandwidthProbingAndRemoteVideoQualityAdaption\"] = 3] = \"BandwidthProbingAndRemoteVideoQualityAdaption\";\n})(ServerSideNetworkAdaption = exports.ServerSideNetworkAdaption || (exports.ServerSideNetworkAdaption = {}));\nexports.default = ServerSideNetworkAdaption;\nfunction serverSideNetworkAdaptionIsNoneOrDefault(adaption) {\n    return (adaption === ServerSideNetworkAdaption.None || adaption === ServerSideNetworkAdaption.Default);\n}\nexports.serverSideNetworkAdaptionIsNoneOrDefault = serverSideNetworkAdaptionIsNoneOrDefault;\nfunction convertServerSideNetworkAdaptionEnumFromSignaled(adaption) {\n    switch (adaption) {\n        case SignalingProtocol_1.SdkServerSideNetworkAdaption.DEFAULT:\n            return ServerSideNetworkAdaption.Default;\n        case SignalingProtocol_1.SdkServerSideNetworkAdaption.NONE:\n            return ServerSideNetworkAdaption.None;\n        case SignalingProtocol_1.SdkServerSideNetworkAdaption.BANDWIDTH_PROBING:\n            return ServerSideNetworkAdaption.BandwidthProbing;\n        case SignalingProtocol_1.SdkServerSideNetworkAdaption.BANDWIDTH_PROBING_AND_VIDEO_QUALITY_ADAPTION:\n            return ServerSideNetworkAdaption.BandwidthProbingAndRemoteVideoQualityAdaption;\n    }\n}\nexports.convertServerSideNetworkAdaptionEnumFromSignaled = convertServerSideNetworkAdaptionEnumFromSignaled;\nfunction convertServerSideNetworkAdaptionEnumToSignaled(adaption) {\n    switch (adaption) {\n        case ServerSideNetworkAdaption.Default:\n            return SignalingProtocol_1.SdkServerSideNetworkAdaption.DEFAULT;\n        case ServerSideNetworkAdaption.None:\n            return SignalingProtocol_1.SdkServerSideNetworkAdaption.NONE;\n        case ServerSideNetworkAdaption.BandwidthProbing:\n            return SignalingProtocol_1.SdkServerSideNetworkAdaption.BANDWIDTH_PROBING;\n        case ServerSideNetworkAdaption.BandwidthProbingAndRemoteVideoQualityAdaption:\n            return SignalingProtocol_1.SdkServerSideNetworkAdaption.BANDWIDTH_PROBING_AND_VIDEO_QUALITY_ADAPTION;\n    }\n}\nexports.convertServerSideNetworkAdaptionEnumToSignaled = convertServerSideNetworkAdaptionEnumToSignaled;\n//# sourceMappingURL=ServerSideNetworkAdaption.js.map","\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/*\n * [[SignalingClientConnectionRequest]] represents an connection request.\n */\nclass SignalingClientConnectionRequest {\n    /** Creates a request with the given URL, conference id, and join token.\n     *\n     * @param signalingURL The URL of the signaling proxy.\n     * @param joinToken The join token that will authenticate the connection.\n     */\n    constructor(signalingURL, joinToken) {\n        this.signalingURL = signalingURL;\n        this.joinToken = joinToken;\n    }\n    /** Gets the signaling URL representing this request.*/\n    url() {\n        return (this.signalingURL + '?X-Chime-Control-Protocol-Version=3&X-Amzn-Chime-Send-Close-On-Error=1');\n    }\n    /** Gets the protocols associated with this request.*/\n    protocols() {\n        return ['_aws_wt_session', this.joinToken];\n    }\n}\nexports.default = SignalingClientConnectionRequest;\n//# sourceMappingURL=SignalingClientConnectionRequest.js.map","\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n    return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst SignalingClientEventType_1 = __importDefault(require(\"./SignalingClientEventType\"));\n/*\n * [[SignalingClientEvent]] stores an event that can be sent to observers of the SignalingClient.\n */\nclass SignalingClientEvent {\n    /** Initializes a SignalingClientEvent with the given SignalingClientEventType.\n     *\n     * @param client Indicates the SignalingClient associated with the event.\n     * @param type Indicates the kind of event.\n     * @param message SdkSignalFrame if type is ReceivedSignalFrame\n     */\n    constructor(client, type, message, closeCode, closeReason) {\n        this.client = client;\n        this.type = type;\n        this.message = message;\n        this.closeCode = closeCode;\n        this.closeReason = closeReason;\n        this.timestampMs = Date.now();\n    }\n    isConnectionTerminated() {\n        switch (this.type) {\n            case SignalingClientEventType_1.default.WebSocketFailed:\n            case SignalingClientEventType_1.default.WebSocketError:\n            case SignalingClientEventType_1.default.WebSocketClosing:\n            case SignalingClientEventType_1.default.WebSocketClosed:\n                return true;\n            default:\n                return false;\n        }\n    }\n}\nexports.default = SignalingClientEvent;\n//# sourceMappingURL=SignalingClientEvent.js.map","\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.SignalingClientEventType = void 0;\n/** Defines the event types generated by SignalingClient and the underlying WebSocket connection. */\nvar SignalingClientEventType;\n(function (SignalingClientEventType) {\n    SignalingClientEventType[SignalingClientEventType[\"WebSocketConnecting\"] = 0] = \"WebSocketConnecting\";\n    SignalingClientEventType[SignalingClientEventType[\"WebSocketOpen\"] = 1] = \"WebSocketOpen\";\n    SignalingClientEventType[SignalingClientEventType[\"WebSocketError\"] = 2] = \"WebSocketError\";\n    SignalingClientEventType[SignalingClientEventType[\"WebSocketClosing\"] = 3] = \"WebSocketClosing\";\n    SignalingClientEventType[SignalingClientEventType[\"WebSocketClosed\"] = 4] = \"WebSocketClosed\";\n    SignalingClientEventType[SignalingClientEventType[\"WebSocketFailed\"] = 5] = \"WebSocketFailed\";\n    SignalingClientEventType[SignalingClientEventType[\"WebSocketMessage\"] = 6] = \"WebSocketMessage\";\n    SignalingClientEventType[SignalingClientEventType[\"WebSocketSendMessageFailure\"] = 7] = \"WebSocketSendMessageFailure\";\n    SignalingClientEventType[SignalingClientEventType[\"WebSocketSentMessage\"] = 8] = \"WebSocketSentMessage\";\n    SignalingClientEventType[SignalingClientEventType[\"ProtocolDecodeFailure\"] = 9] = \"ProtocolDecodeFailure\";\n    SignalingClientEventType[SignalingClientEventType[\"ReceivedSignalFrame\"] = 10] = \"ReceivedSignalFrame\";\n    SignalingClientEventType[SignalingClientEventType[\"WebSocketSkippedMessage\"] = 11] = \"WebSocketSkippedMessage\";\n})(SignalingClientEventType = exports.SignalingClientEventType || (exports.SignalingClientEventType = {}));\nexports.default = SignalingClientEventType;\n//# sourceMappingURL=SignalingClientEventType.js.map","\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n    return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst ServerSideNetworkAdaption_1 = __importDefault(require(\"./ServerSideNetworkAdaption\"));\n/**\n * [[SignalingClientJoin]] contains settings for the Join SignalFrame.\n */\nclass SignalingClientJoin {\n    /**\n     * Initializes a SignalingClientJoin with the given properties.\n     * @param applicationMetadata [[ApplicationMetadata]].\n     */\n    constructor(applicationMetadata) {\n        this.applicationMetadata = applicationMetadata;\n        this.serverSideNetworkAdaption = ServerSideNetworkAdaption_1.default.Default;\n        this.supportedServerSideNetworkAdaptions = [];\n        this.wantsAllTemporalLayersInIndex = false;\n        this.disablePeriodicKeyframeRequestOnContentSender = false;\n    }\n}\nexports.default = SignalingClientJoin;\n//# sourceMappingURL=SignalingClientJoin.js.map","\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/**\n * [[SignalingClientSubscribe]] contains settings for the Subscribe SignalFrame.\n */\nclass SignalingClientSubscribe {\n    /** Initializes a SignalingClientSubscribe with the given properties.\n     *\n     * @param attendeeId Attendee ID of the client\n     * @param sdpOffer SDP offer created by WebRTC\n     * @param audioHost host\n     * @param audioMuted Whether audio from client is muted\n     * @param audioCheckin Whether audio is in checked-in state\n     * @param receiveStreamIds Which video streams to receive\n     * @param localVideoEnabled Whether to send a video stream for the local camera\n     * @param array of local video stream description\n     * @param connectionTypeHasVideo Whether connection type has video\n     * @param compressedSdpOffer Compressed version of the SDP offer which was created by WebRTC\n     */\n    constructor(attendeeId, sdpOffer, audioHost, audioMuted, audioCheckin, receiveStreamIds, localVideoEnabled, videoStreamDescriptions, connectionTypeHasVideo, compressedSdpOffer) {\n        this.attendeeId = attendeeId;\n        this.sdpOffer = sdpOffer;\n        this.audioHost = audioHost;\n        this.audioMuted = audioMuted;\n        this.audioCheckin = audioCheckin;\n        this.receiveStreamIds = receiveStreamIds;\n        this.localVideoEnabled = localVideoEnabled;\n        this.videoStreamDescriptions = videoStreamDescriptions;\n        this.connectionTypeHasVideo = connectionTypeHasVideo;\n        this.compressedSdpOffer = compressedSdpOffer;\n        this.videoSubscriptionConfiguration = [];\n    }\n}\nexports.default = SignalingClientSubscribe;\n//# sourceMappingURL=SignalingClientSubscribe.js.map","\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/**\n * [[SignalingClientVideoSubscriptionConfiguration]] is an internal representation of\n * `SignalingProtocol.videoSubscriptionConfiguration`\n */\nclass SignalingClientVideoSubscriptionConfiguration {\n    equals(other) {\n        return (other !== undefined &&\n            this.mid === other.mid &&\n            this.attendeeId === other.attendeeId &&\n            this.streamId === other.streamId &&\n            this.groupId === other.groupId &&\n            this.priority === other.priority &&\n            this.targetBitrateKbps === other.targetBitrateKbps &&\n            this.qualityAdaptationPreference === other.qualityAdaptationPreference);\n    }\n}\nexports.default = SignalingClientVideoSubscriptionConfiguration;\n//# sourceMappingURL=SignalingClientVideoSubscriptionConfiguration.js.map","\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n    return new (P || (P = Promise))(function (resolve, reject) {\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\n    });\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n    return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst sha256_js_1 = require(\"@aws-crypto/sha256-js\");\nconst util_hex_encoding_1 = require(\"@aws-sdk/util-hex-encoding\");\nconst Versioning_1 = __importDefault(require(\"../versioning/Versioning\"));\nclass DefaultSigV4 {\n    // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n    constructor(chimeClient) {\n        this.chimeClient = chimeClient;\n    }\n    makeTwoDigits(n) {\n        /* istanbul ignore if */\n        /* istanbul ignore else */\n        if (n > 9) {\n            return n.toString();\n        }\n        else {\n            return '0' + n.toString();\n        }\n    }\n    hmac(data, secret) {\n        const hash = new sha256_js_1.Sha256(secret);\n        hash.update(data);\n        return hash.digest();\n    }\n    getDateTimeString() {\n        const d = new Date();\n        return (d.getUTCFullYear() +\n            this.makeTwoDigits(d.getUTCMonth() + 1) +\n            this.makeTwoDigits(d.getUTCDate()) +\n            'T' +\n            this.makeTwoDigits(d.getUTCHours()) +\n            this.makeTwoDigits(d.getUTCMinutes()) +\n            this.makeTwoDigits(d.getUTCSeconds()) +\n            'Z');\n    }\n    getDateString(dateTimeString) {\n        return dateTimeString.substring(0, dateTimeString.indexOf('T'));\n    }\n    getSignatureKey(key, date, regionName, serviceName) {\n        return __awaiter(this, void 0, void 0, function* () {\n            const kDate = yield this.hmac(date, 'AWS4' + key);\n            const kRegion = yield this.hmac(regionName, kDate);\n            const kService = yield this.hmac(serviceName, kRegion);\n            const kSigning = yield this.hmac('aws4_request', kService);\n            return kSigning;\n        });\n    }\n    signURL(method, scheme, serviceName, hostname, path, payload, queryParams) {\n        return __awaiter(this, void 0, void 0, function* () {\n            const now = this.getDateTimeString();\n            const today = this.getDateString(now);\n            const algorithm = 'AWS4-HMAC-SHA256';\n            let region = '';\n            // in AWS SDK v3 region is a function\n            if (this.chimeClient.config.region instanceof Function) {\n                region = yield this.chimeClient.config.region();\n            }\n            else {\n                region = this.chimeClient.config.region;\n            }\n            const signedHeaders = 'host';\n            const canonicalHeaders = 'host:' + hostname.toLowerCase() + '\\n';\n            const credentialScope = today + '/' + region + '/' + serviceName + '/' + 'aws4_request';\n            let credentials = undefined;\n            // in AWS SDK v3 credentials is a function\n            if (this.chimeClient.config.credentials instanceof Function) {\n                credentials = yield this.chimeClient.config.credentials();\n            }\n            else {\n                credentials = this.chimeClient.config.credentials;\n            }\n            let params = new Map();\n            params.set('X-Amz-Algorithm', [algorithm]);\n            params.set('X-Amz-Credential', [\n                encodeURIComponent(credentials.accessKeyId + '/' + credentialScope),\n            ]);\n            params.set('X-Amz-Date', [now]);\n            params.set('X-Amz-Expires', ['10']);\n            params.set('X-Amz-SignedHeaders', ['host']);\n            if (credentials.sessionToken) {\n                params.set('X-Amz-Security-Token', [encodeURIComponent(credentials.sessionToken)]);\n            }\n            params.set(Versioning_1.default.X_AMZN_VERSION, [encodeURIComponent(Versioning_1.default.sdkVersion)]);\n            params.set(Versioning_1.default.X_AMZN_USER_AGENT, [\n                encodeURIComponent(Versioning_1.default.sdkUserAgentLowResolution),\n            ]);\n            queryParams === null || queryParams === void 0 ? void 0 : queryParams.forEach((values, key) => {\n                const encodedKey = encodeURIComponent(key);\n                values.sort().forEach((value) => {\n                    if (!params.has(encodedKey)) {\n                        params.set(encodedKey, []);\n                    }\n                    params.get(encodedKey).push(encodeURIComponent(value));\n                });\n            });\n            let canonicalQuerystring = '';\n            params = new Map([...params.entries()].sort());\n            params.forEach((values, key) => {\n                values.forEach(value => {\n                    if (canonicalQuerystring.length) {\n                        canonicalQuerystring += '&';\n                    }\n                    canonicalQuerystring += key + '=' + value;\n                });\n            });\n            const canonicalRequest = method +\n                '\\n' +\n                path +\n                '\\n' +\n                canonicalQuerystring +\n                '\\n' +\n                canonicalHeaders +\n                '\\n' +\n                signedHeaders +\n                '\\n' +\n                util_hex_encoding_1.toHex(yield this.hmac(payload));\n            const hashedCanonicalRequest = util_hex_encoding_1.toHex(yield this.hmac(canonicalRequest));\n            const stringToSign = 'AWS4-HMAC-SHA256\\n' +\n                now +\n                '\\n' +\n                today +\n                '/' +\n                region +\n                '/' +\n                serviceName +\n                '/aws4_request\\n' +\n                hashedCanonicalRequest;\n            const signingKey = yield this.getSignatureKey(credentials.secretAccessKey, today, region, serviceName);\n            const signature = util_hex_encoding_1.toHex(yield this.hmac(stringToSign, signingKey));\n            const finalParams = canonicalQuerystring + '&X-Amz-Signature=' + signature;\n            return scheme + '://' + hostname + path + '?' + finalParams;\n        });\n    }\n}\nexports.default = DefaultSigV4;\n//# sourceMappingURL=DefaultSigV4.js.map"],"names":[],"sourceRoot":""}