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9B,EAEI0gM,EAAqB74L,KAA0B,oBAAIA,KAA0B,qBAAK,GACtF64L,EAAmB10L,QAAQu0L,EAAqBl2L,KAAK,KAAM,IAC3Dq2L,EAAmBj7L,KAAO86L,EAAqBl2L,KAAK,KAAMq2L,EAAmBj7L,KAAK4E,KAAKq2L,OCpFvF,IAAIC,EAAsBrC,EAAoBI,OAAExhM,EAAW,CAAC,MAAM,WAAa,OAAOohM,EAAoB,MAAQ,IAClHqC,EAAsBrC,EAAoBI,EAAEiC","sources":["webpack://epiphan/webpack/runtime/chunk loaded","webpack://epiphan/webpack/runtime/create fake namespace object","webpack://epiphan/webpack/runtime/load script","webpack://epiphan/./node_modules/@aws-crypto/ie11-detection/build/CryptoOperation.js","webpack://epiphan/./node_modules/@aws-crypto/ie11-detection/build/Key.js","webpack://epiphan/./node_modules/@aws-crypto/ie11-detection/build/KeyOperation.js","webpack://epiphan/./node_modules/@aws-crypto/ie11-detection/build/MsSubtleCrypto.js","webpack://epiphan/./node_modules/@aws-crypto/ie11-detection/build/MsWindow.js","webpack://epiphan/./node_modules/@aws-crypto/ie11-detection/build/index.js","webpack://epiphan/./node_modules/@aws-crypto/sha256-browser/build/constants.js","webpack://epiphan/./node_modules/@aws-crypto/sha256-browser/build/crossPlatformSha256.js","webpack://epiphan/./node_modules/@aws-crypto/sha256-browser/build/ie11Sha256.js","webpack://epiphan/./node_modules/@aws-crypto/sha256-browser/build/index.js","webpack://epiphan/./node_modules/@aws-crypto/sha256-browser/build/isEmptyData.js","webpack://epiphan/./node_modules/@aws-crypto/sha256-browser/build/webCryptoSha256.js","webpack://epiphan/./node_modules/@aws-crypto/sha256-browser/node_modules/@aws-crypto/sha256-js/build/RawSha256.js","webpack://epiphan/./node_modules/@aws-crypto/sha256-browser/node_modules/@aws-crypto/sha256-js/build/constants.js","webpack://epiphan/./node_modules/@aws-crypto/sha256-browser/node_modules/@aws-crypto/sha256-js/build/index.js","webpack://epiphan/./node_modules/@aws-crypto/sha256-browser/node_modules/@aws-crypto/sha256-js/build/jsSha256.js","webpack://epiphan/./node_modules/@aws-crypto/supports-web-crypto/build/index.js","webpack://epiphan/./node_modules/@aws-crypto/supports-web-crypto/build/supportsWebCrypto.js","webpack://epiphan/./node_modules/@aws-crypto/util/build/convertToBuffer.js","webpack://epiphan/./node_modules/@aws-crypto/util/build/index.js","webpack://epiphan/./node_modules/@aws-crypto/util/build/isEmptyData.js","webpack://epiphan/./node_modules/@aws-crypto/util/build/numToUint8.js","webpack://epiphan/./node_modules/@aws-crypto/util/build/uint32ArrayFrom.js","webpack://epiphan/./node_modules/@aws-crypto/util/node_modules/@aws-sdk/util-utf8-browser/dist-es/index.js","webpack://epiphan/./node_modules/@aws-crypto/util/node_modules/@aws-sdk/util-utf8-browser/dist-es/whatwgEncodingApi.js","webpack://epiphan/./node_modules/@aws-crypto/util/node_modules/@aws-sdk/util-utf8-browser/dist-es/pureJs.js","webpack://epiphan/./node_modules/@aws-sdk/util-locate-window/dist-es/index.js","webpack://epiphan/./node_modules/@aws-sdk/util-utf8-browser/dist/es/index.js","webpack://epiphan/./node_modules/@aws-sdk/util-utf8-browser/dist/es/whatwgEncodingApi.js","webpack://epiphan/./node_modules/@aws-sdk/util-utf8-browser/dist/es/pureJs.js","webpack://epiphan/./node_modules/base64-js/index.js","webpack://epiphan/./node_modules/bowser/es5.js","webpack://epiphan/./node_modules/buffer/index.js","webpack://epiphan/./node_modules/crypto-js/core.js","webpack://epiphan/./node_modules/crypto-js/enc-base64.js","webpack://epiphan/./node_modules/crypto-js/hmac-sha256.js","webpack://epiphan/./node_modules/crypto-js/hmac.js","webpack://epiphan/./node_modules/crypto-js/lib-typedarrays.js","webpack://epiphan/./node_modules/crypto-js/sha256.js","webpack://epiphan/./node_modules/ieee754/index.js","webpack://epiphan/./node_modules/isarray/index.js","webpack://epiphan/./node_modules/isomorphic-unfetch/browser.js","webpack://epiphan/./node_modules/js-cookie/src/js.cookie.js","webpack://epiphan/./node_modules/querystring/decode.js","webpack://epiphan/./node_modules/querystring/encode.js","webpack://epiphan/./node_modules/querystring/index.js","webpack://epiphan/./node_modules/@aws-amplify/auth/lib-esm/types/Auth.js","webpack://epiphan/./node_modules/@aws-amplify/core/lib-esm/Util/Constants.js","webpack://epiphan/./node_modules/@aws-amplify/core/lib-esm/Logger/ConsoleLogger.js","webpack://epiphan/./node_modules/@aws-amplify/core/lib-esm/Hub.js","webpack://epiphan/./node_modules/@aws-amplify/core/lib-esm/StorageHelper/index.js","webpack://epiphan/./node_modules/@aws-amplify/core/lib-esm/JS.js","webpack://epiphan/./node_modules/@aws-amplify/core/lib-esm/Util/Retry.js","webpack://epiphan/./node_modules/@aws-amplify/core/lib-esm/OAuthHelper/GoogleOAuth.js","webpack://epiphan/./node_modules/@aws-amplify/core/lib-esm/OAuthHelper/FacebookOAuth.js","webpack://epiphan/./node_modules/@aws-amplify/core/lib-esm/OAuthHelper/index.js","webpack://epiphan/./node_modules/@aws-amplify/core/lib-esm/Platform/index.js","webpack://epiphan/./node_modules/@aws-amplify/core/lib-esm/Amplify.js","webpack://epiphan/./node_modules/@aws-sdk/client-cognito-identity/node_modules/tslib/tslib.es6.js","webpack://epiphan/./node_modules/@aws-sdk/client-cognito-identity/dist/es/models/models_0.js","webpack://epiphan/./node_modules/@aws-sdk/protocol-http/dist/es/httpResponse.js","webpack://epiphan/./node_modules/@aws-sdk/protocol-http/dist/es/httpRequest.js","webpack://epiphan/./node_modules/@aws-sdk/client-cognito-identity/dist/es/protocols/Aws_json1_1.js","webpack://epiphan/./node_modules/@aws-sdk/middleware-serde/dist/es/serdePlugin.js","webpack://epiphan/./node_modules/@aws-sdk/middleware-serde/dist/es/deserializerMiddleware.js","webpack://epiphan/./node_modules/@aws-sdk/middleware-serde/dist/es/serializerMiddleware.js","webpack://epiphan/./node_modules/@aws-sdk/middleware-stack/dist/es/MiddlewareStack.js","webpack://epiphan/./node_modules/@aws-sdk/smithy-client/dist/es/client.js","webpack://epiphan/./node_modules/@aws-sdk/smithy-client/dist/es/command.js","webpack://epiphan/./node_modules/@aws-sdk/smithy-client/dist/es/lazy-json.js","webpack://epiphan/./node_modules/@aws-sdk/client-cognito-identity/dist/es/commands/GetCredentialsForIdentityCommand.js","webpack://epiphan/./node_modules/@aws-sdk/property-provider/dist/es/ProviderError.js","webpack://epiphan/./node_modules/@aws-sdk/credential-provider-cognito-identity/dist/es/resolveLogins.js","webpack://epiphan/./node_modules/@aws-sdk/credential-provider-cognito-identity/dist/es/fromCognitoIdentity.js","webpack://epiphan/./node_modules/@aws-sdk/client-cognito-identity/dist/es/commands/GetIdCommand.js","webpack://epiphan/./node_modules/@aws-sdk/credential-provider-cognito-identity/dist/es/IndexedDbStorage.js","webpack://epiphan/./node_modules/@aws-sdk/credential-provider-cognito-identity/dist/es/localStorage.js","webpack://epiphan/./node_modules/@aws-sdk/credential-provider-cognito-identity/dist/es/InMemoryStorage.js","webpack://epiphan/./node_modules/@aws-sdk/credential-provider-cognito-identity/dist/es/fromCognitoIdentityPool.js","webpack://epiphan/./node_modules/@aws-sdk/util-uri-escape/dist/es/escape-uri.js","webpack://epiphan/./node_modules/@aws-sdk/util-base64-browser/dist/es/index.js","webpack://epiphan/./node_modules/@aws-sdk/fetch-http-handler/dist/es/fetch-http-handler.js","webpack://epiphan/./node_modules/@aws-sdk/querystring-builder/dist/es/index.js","webpack://epiphan/./node_modules/@aws-sdk/fetch-http-handler/dist/es/request-timeout.js","webpack://epiphan/./node_modules/@aws-sdk/fetch-http-handler/dist/es/stream-collector.js","webpack://epiphan/./node_modules/@aws-sdk/invalid-dependency/dist/es/invalidProvider.js","webpack://epiphan/./node_modules/@aws-sdk/middleware-retry/dist/es/retryMiddleware.js","webpack://epiphan/./node_modules/@aws-sdk/service-error-classification/dist/es/constants.js","webpack://epiphan/./node_modules/@aws-sdk/service-error-classification/dist/es/index.js","webpack://epiphan/./node_modules/@aws-sdk/middleware-retry/dist/es/delayDecider.js","webpack://epiphan/./node_modules/@aws-sdk/middleware-retry/dist/es/constants.js","webpack://epiphan/./node_modules/@aws-sdk/middleware-retry/dist/es/retryDecider.js","webpack://epiphan/./node_modules/@aws-sdk/middleware-retry/dist/es/defaultStrategy.js","webpack://epiphan/./node_modules/@aws-sdk/middleware-retry/dist/es/defaultRetryQuota.js","webpack://epiphan/./node_modules/@aws-sdk/middleware-retry/dist/es/configurations.js","webpack://epiphan/./node_modules/@aws-sdk/client-cognito-identity/node_modules/@aws-sdk/util-utf8-browser/dist/es/index.js","webpack://epiphan/./node_modules/@aws-sdk/client-cognito-identity/dist/es/endpoints.js","webpack://epiphan/./node_modules/@aws-sdk/url-parser/dist/es/index.js","webpack://epiphan/./node_modules/@aws-sdk/util-user-agent-browser/dist/es/index.js","webpack://epiphan/./node_modules/@aws-sdk/client-cognito-identity/dist/es/runtimeConfig.shared.js","webpack://epiphan/./node_modules/@aws-sdk/querystring-parser/dist/es/index.js","webpack://epiphan/./node_modules/@aws-sdk/client-cognito-identity/dist/es/runtimeConfig.browser.js","webpack://epiphan/./node_modules/@aws-sdk/util-body-length-browser/dist/es/index.js","webpack://epiphan/./node_modules/@aws-sdk/client-cognito-identity/node_modules/@aws-sdk/util-utf8-browser/dist/es/whatwgEncodingApi.js","webpack://epiphan/./node_modules/@aws-sdk/client-cognito-identity/node_modules/@aws-sdk/util-utf8-browser/dist/es/pureJs.js","webpack://epiphan/./node_modules/@aws-sdk/config-resolver/dist/es/EndpointsConfig.js","webpack://epiphan/./node_modules/@aws-sdk/config-resolver/dist/es/RegionConfig.js","webpack://epiphan/./node_modules/@aws-sdk/middleware-content-length/dist/es/index.js","webpack://epiphan/./node_modules/@aws-sdk/util-hex-encoding/dist/es/index.js","webpack://epiphan/./node_modules/@aws-sdk/middleware-host-header/dist/es/index.js","webpack://epiphan/./node_modules/@aws-sdk/middleware-logger/dist/es/loggerMiddleware.js","webpack://epiphan/./node_modules/@aws-sdk/signature-v4/dist/es/constants.js","webpack://epiphan/./node_modules/@aws-sdk/signature-v4/dist/es/credentialDerivation.js","webpack://epiphan/./node_modules/@aws-sdk/signature-v4/dist/es/getCanonicalHeaders.js","webpack://epiphan/./node_modules/@aws-sdk/signature-v4/dist/es/getPayloadHash.js","webpack://epiphan/./node_modules/@aws-sdk/is-array-buffer/dist/es/index.js","webpack://epiphan/./node_modules/@aws-sdk/signature-v4/dist/es/cloneRequest.js","webpack://epiphan/./node_modules/@aws-sdk/signature-v4/dist/es/prepareRequest.js","webpack://epiphan/./node_modules/@aws-sdk/signature-v4/dist/es/utilDate.js","webpack://epiphan/./node_modules/@aws-sdk/signature-v4/dist/es/SignatureV4.js","webpack://epiphan/./node_modules/@aws-sdk/signature-v4/dist/es/moveHeadersToQuery.js","webpack://epiphan/./node_modules/@aws-sdk/signature-v4/dist/es/hasHeader.js","webpack://epiphan/./node_modules/@aws-sdk/signature-v4/dist/es/getCanonicalQuery.js","webpack://epiphan/./node_modules/@aws-sdk/middleware-signing/dist/es/configurations.js","webpack://epiphan/./node_modules/@aws-sdk/middleware-user-agent/dist/es/constants.js","webpack://epiphan/./node_modules/@aws-sdk/middleware-user-agent/dist/es/user-agent-middleware.js","webpack://epiphan/./node_modules/@aws-sdk/client-cognito-identity/dist/es/CognitoIdentityClient.js","webpack://epiphan/./node_modules/@aws-sdk/middleware-user-agent/dist/es/configurations.js","webpack://epiphan/./node_modules/@aws-amplify/core/lib-esm/Credentials.js","webpack://epiphan/./node_modules/@aws-amplify/core/lib-esm/Parser.js","webpack://epiphan/./node_modules/universal-cookie/es6/utils.js","webpack://epiphan/./node_modules/universal-cookie/es6/Cookies.js","webpack://epiphan/./node_modules/universal-cookie/es6/index.js","webpack://epiphan/./node_modules/@aws-amplify/core/lib-esm/UniversalStorage/index.js","webpack://epiphan/./node_modules/amazon-cognito-identity-js/es/AuthenticationDetails.js","webpack://epiphan/./node_modules/amazon-cognito-identity-js/es/utils/cryptoSecureRandomInt.js","webpack://epiphan/./node_modules/amazon-cognito-identity-js/es/utils/WordArray.js","webpack://epiphan/./node_modules/amazon-cognito-identity-js/es/BigInteger.js","webpack://epiphan/./node_modules/amazon-cognito-identity-js/es/AuthenticationHelper.js","webpack://epiphan/./node_modules/amazon-cognito-identity-js/es/CognitoJwtToken.js","webpack://epiphan/./node_modules/amazon-cognito-identity-js/es/CognitoAccessToken.js","webpack://epiphan/./node_modules/amazon-cognito-identity-js/es/CognitoIdToken.js","webpack://epiphan/./node_modules/amazon-cognito-identity-js/es/CognitoRefreshToken.js","webpack://epiphan/./node_modules/amazon-cognito-identity-js/es/CognitoUserSession.js","webpack://epiphan/./node_modules/amazon-cognito-identity-js/es/DateHelper.js","webpack://epiphan/./node_modules/amazon-cognito-identity-js/es/CognitoUserAttribute.js","webpack://epiphan/./node_modules/amazon-cognito-identity-js/es/StorageHelper.js","webpack://epiphan/./node_modules/amazon-cognito-identity-js/es/CognitoUser.js","webpack://epiphan/./node_modules/amazon-cognito-identity-js/es/Platform/index.js","webpack://epiphan/./node_modules/amazon-cognito-identity-js/es/UserAgent.js","webpack://epiphan/./node_modules/amazon-cognito-identity-js/es/Client.js","webpack://epiphan/./node_modules/amazon-cognito-identity-js/es/CognitoUserPool.js","webpack://epiphan/./node_modules/@aws-amplify/auth/lib-esm/common/AuthErrorStrings.js","webpack://epiphan/./node_modules/amazon-cognito-identity-js/es/CookieStorage.js","webpack://epiphan/./node_modules/@aws-amplify/auth/lib-esm/OAuth/urlOpener.js","webpack://epiphan/./node_modules/@aws-amplify/auth/lib-esm/OAuth/OAuth.js","webpack://epiphan/./node_modules/@aws-amplify/core/lib-esm/Util/StringUtils.js","webpack://epiphan/./node_modules/@aws-amplify/auth/lib-esm/OAuth/oauthStorage.js","webpack://epiphan/./node_modules/@aws-amplify/auth/lib-esm/Errors.js","webpack://epiphan/./node_modules/@aws-amplify/auth/lib-esm/Auth.js","webpack://epiphan/./node_modules/@aws-amplify/auth/lib-esm/urlListener.js","webpack://epiphan/./node_modules/@aws-amplify/auth/lib-esm/index.js","webpack://epiphan/./src/components/Login/LoginForm/constants.ts","webpack://epiphan/./src/components/Login/LoginForm/Title.tsx","webpack://epiphan/./src/constants/index.ts","webpack://epiphan/./src/hooks/useComponentDidMount.ts","webpack://epiphan/./src/components/sharedReactComponents/Tooltip/index.tsx","webpack://epiphan/./src/util/typeGuards.ts","webpack://epiphan/./src/util/isNil.ts","webpack://epiphan/./src/components/sharedReactComponents/Button/index.tsx","webpack://epiphan/./assets/img/streaming-service-icons/facebook.svg","webpack://epiphan/./assets/img/streaming-service-icons/facebook-small.svg","webpack://epiphan/./assets/img/streaming-service-icons/youtube.svg","webpack://epiphan/./assets/img/streaming-service-icons/youtube-small.svg","webpack://epiphan/./assets/img/streaming-service-icons/twitch.svg","webpack://epiphan/./assets/img/streaming-service-icons/twitch-small.svg","webpack://epiphan/./assets/img/streaming-service-icons/rtmp.svg","webpack://epiphan/./assets/img/streaming-service-icons/rtmp-small.svg","webpack://epiphan/./assets/img/upgrade-to-pro-icons/batch-for-streaming.svg","webpack://epiphan/./assets/img/upgrade-to-pro-icons/device-grouping.svg","webpack://epiphan/./assets/img/upgrade-to-pro-icons/high-definition-video.svg","webpack://epiphan/./assets/img/device-preset-sections/afu.svg","webpack://epiphan/./assets/img/device-preset-sections/epiphan_cloud.svg","webpack://epiphan/./assets/img/device-preset-sections/channels.svg","webpack://epiphan/./assets/img/device-preset-sections/cms.svg","webpack://epiphan/./assets/img/device-preset-sections/displays.svg","webpack://epiphan/./assets/img/device-preset-sections/edid.svg","webpack://epiphan/./assets/img/device-preset-sections/frontscreen.svg","webpack://epiphan/./assets/img/device-preset-sections/network.svg","webpack://epiphan/./assets/img/device-preset-sections/sources.svg","webpack://epiphan/./assets/img/device-preset-sections/system.svg","webpack://epiphan/./assets/img/team-presets-free-plan-placeholder/file.svg","webpack://epiphan/./assets/img/virtual-device-icons/guide-icon.svg","webpack://epiphan/./assets/img/virtual-device-icons/virtual-device-icon.svg","webpack://epiphan/./src/util/icons.ts","webpack://epiphan/./src/components/sharedReactComponents/LoadingWrapper/LoadingSpinner.tsx","webpack://epiphan/./src/components/sharedReactComponents/LoadingWrapper/index.tsx","webpack://epiphan/./src/util/isPromise.ts","webpack://epiphan/./src/hooks/useIsMounted.ts","webpack://epiphan/./src/components/sharedReactComponents/ProgressButton/index.tsx","webpack://epiphan/./src/components/sharedReactComponents/FormHelperText/index.tsx","webpack://epiphan/./src/components/sharedReactComponents/FormControlLabel/index.tsx","webpack://epiphan/./src/components/sharedReactComponents/LongNameWrapper/index.tsx","webpack://epiphan/./src/util/noop.ts","webpack://epiphan/./src/components/sharedReactComponents/Dropdown/index.tsx","webpack://epiphan/./src/components/sharedReactComponents/OverflowTooltip/OverflowTooltip.tsx","webpack://epiphan/./src/constants/waiAriaRole.ts","webpack://epiphan/./src/components/sharedReactComponents/SelectMenuOption/index.tsx","webpack://epiphan/./src/components/sharedReactComponents/DropdownSelect/DropdownSelectOption.tsx","webpack://epiphan/./src/components/sharedReactComponents/DropdownSelect/DropdownSelectSeparator.tsx","webpack://epiphan/./src/components/sharedReactComponents/DropdownSelect/DropdownSelectNoOptionsMessage.tsx","webpack://epiphan/./src/components/sharedReactComponents/DropdownSelect/DropdownSelectGroupOption.tsx","webpack://epiphan/./src/components/sharedReactComponents/DropdownSelect/utils.ts","webpack://epiphan/./src/components/sharedReactComponents/DropdownSelect/constants.ts","webpack://epiphan/./src/components/sharedReactComponents/Caret/index.tsx","webpack://epiphan/./src/components/sharedReactComponents/DropdownSelect/DropdownSelectButton.tsx","webpack://epiphan/./src/components/sharedReactComponents/DropdownSelect/index.tsx","webpack://epiphan/./src/components/sharedReactComponents/TextareaInput/index.tsx","webpack://epiphan/./src/components/sharedReactComponents/ColorInput/index.tsx","webpack://epiphan/./src/components/sharedReactComponents/BaseTextInput/index.tsx","webpack://epiphan/./src/components/sharedReactComponents/NumberInput/index.tsx","webpack://epiphan/./src/components/sharedReactComponents/Checkbox/CheckboxBase.tsx","webpack://epiphan/./src/components/sharedReactComponents/Checkbox/index.tsx","webpack://epiphan/./src/components/sharedReactComponents/Switcher/index.tsx","webpack://epiphan/./src/components/sharedReactComponents/FormControl/constants.ts","webpack://epiphan/./src/components/sharedReactComponents/FormControl/index.tsx","webpack://epiphan/./src/components/Login/LoginForm/Form.tsx","webpack://epiphan/./src/components/Login/LoginForm/Separator.tsx","webpack://epiphan/./src/constants/formControlAutocomplete.ts","webpack://epiphan/./src/hooks/useComponentWillUnmount.ts","webpack://epiphan/./src/components/Login/LoginForm/ResendConfirmationEmailButton.tsx","webpack://epiphan/./src/components/Login/LoginForm/UserNotConfirmedExceptionMessage.tsx","webpack://epiphan/./src/components/sharedReactComponents/PseudoLink/index.tsx","webpack://epiphan/./src/components/Login/LoginForm/SignIn.tsx","webpack://epiphan/./src/components/Login/LoginForm/SignUp.tsx","webpack://epiphan/./src/components/Login/LoginForm/ConfirmSignUp.tsx","webpack://epiphan/./src/components/Authorization/Google.ts","webpack://epiphan/./src/components/Login/LoginForm/SignInButton/GoogleButton.tsx","webpack://epiphan/./src/components/Login/LoginForm/AuthButtons.tsx","webpack://epiphan/./src/components/Login/LoginForm/ForgotPassword.tsx","webpack://epiphan/./src/components/Login/LoginForm/ResetPassword.tsx","webpack://epiphan/./src/components/Login/LoginForm/Footer.tsx","webpack://epiphan/./src/components/Login/LoginForm/index.tsx","webpack://epiphan/./src/api/util/Url.ts","webpack://epiphan/./src/api/util/queryStringSorted.ts","webpack://epiphan/./src/api/constants.ts","webpack://epiphan/./src/api/Chain.ts","webpack://epiphan/./src/api/Service.ts","webpack://epiphan/./src/util/timeConverter.ts","webpack://epiphan/./src/util/Cache.ts","webpack://epiphan/./src/data/Status.ts","webpack://epiphan/./src/data/Dispatcher.ts","webpack://epiphan/./src/api/CirrusApi.ts","webpack://epiphan/./src/api/Api.ts","webpack://epiphan/./src/components/sharedReactComponents/Modal/ModalComponent.tsx","webpack://epiphan/./src/constants/portalElementId.ts","webpack://epiphan/./src/components/sharedReactComponents/Modal/Modal.tsx","webpack://epiphan/./src/components/sharedReactComponents/Modal/ModalNotification/index.tsx","webpack://epiphan/./src/components/libs/dialogs/InvitedModalNotification/index.tsx","webpack://epiphan/./src/components/libs/dialogs/LoggingErrorModalNotification/index.ts","webpack://epiphan/./src/router/Location.ts","webpack://epiphan/./src/router/Router.ts","webpack://epiphan/./src/router/login.ts","webpack://epiphan/./src/components/Login/utils.ts","webpack://epiphan/./src/router/main.ts","webpack://epiphan/./src/util/packSx/packSx.ts","webpack://epiphan/./src/components/entities/maintenance/api/MaintenanceApi.ts","webpack://epiphan/./src/components/entities/maintenance/mapper/index.ts","webpack://epiphan/./src/components/entities/maintenance/mapper/maintenance.mapper.ts","webpack://epiphan/./src/components/Footer/index.tsx","webpack://epiphan/./src/components/entities/maintenance/hooks/useVersionQuery.ts","webpack://epiphan/./src/components/Login/index.tsx","webpack://epiphan/./src/components/Authorization/utils.ts","webpack://epiphan/./src/util/AnalyticsTracker.ts","webpack://epiphan/./src/components/sharedReactComponents/PageHeader/GoBackButton.tsx","webpack://epiphan/./src/components/sharedReactComponents/PageHeader/index.tsx","webpack://epiphan/./src/components/DeviceDetails/constants.ts","webpack://epiphan/./src/services/deviceModel/DeviceModelService.ts","webpack://epiphan/./src/components/sharedReactComponents/RadioGroup/RadioGroupContext.ts","webpack://epiphan/./src/components/sharedReactComponents/RadioGroup/index.tsx","webpack://epiphan/./src/components/sharedReactComponents/RadioGroup/useRadioGroup.ts","webpack://epiphan/./src/util/stopPropagation.ts","webpack://epiphan/./src/components/sharedReactComponents/Radio/index.tsx","webpack://epiphan/./src/components/sharedReactComponents/FilterSelector/types.ts","webpack://epiphan/./src/components/sharedReactComponents/FilterSelector/FilterSelectorSearch.tsx","webpack://epiphan/./src/components/FleetManager/utils.ts","webpack://epiphan/./src/components/sharedReactComponents/FilterSelector/FilterSelectorGroup.tsx","webpack://epiphan/./src/components/sharedReactComponents/FilterSelector/useFilterSelectorGroupSearch.ts","webpack://epiphan/./src/components/sharedReactComponents/FilterSelector/FilterSelectorList.tsx","webpack://epiphan/./src/components/sharedReactComponents/FilterSelector/index.tsx","webpack://epiphan/./src/components/sharedReactComponents/EmptyFilterMessage/EmptyFilterMessage.tsx","webpack://epiphan/./src/components/FleetManager/useFilterSwitches.ts","webpack://epiphan/./src/components/Settings/Alerts/AlertSettings/hooks/useFilterSwitches.ts","webpack://epiphan/./src/api/WebSocket/constants.ts","webpack://epiphan/./src/api/WebSocket/utils.ts","webpack://epiphan/./src/components/DeviceDetails/utils.ts","webpack://epiphan/./src/api/WebSocket/WS.ts","webpack://epiphan/./src/models/Device/Settings/constants.ts","webpack://epiphan/./src/models/Device/Settings/BaseDeviceSettingModel.ts","webpack://epiphan/./src/models/Device/Settings/EnumDeviceSettingModel.ts","webpack://epiphan/./src/models/Device/Settings/GroupDeviceSettingModel.ts","webpack://epiphan/./src/models/Device/Settings/VideoBitrateDeviceSettingModel.ts","webpack://epiphan/./src/models/Device/Settings/DeviceSettingsCollection.ts","webpack://epiphan/./src/models/Device/Settings/Fabric.ts","webpack://epiphan/./src/services/capability/DeviceCapabilityService.ts","webpack://epiphan/./src/util/CommandDispatcher.ts","webpack://epiphan/./src/services/command/CommandService.ts","webpack://epiphan/./src/components/Notifications/index.ts","webpack://epiphan/./src/util/time.ts","webpack://epiphan/./src/constants/deviceWarningSeverity.ts","webpack://epiphan/./src/components/DeviceDetails/TranscriberDevice/Tabs/Transcription/TranscriptionConfiguration.ts","webpack://epiphan/./src/services/api/transcribier/TranscriberApiService.ts","webpack://epiphan/./src/models/Device/Publisher/constants.ts","webpack://epiphan/./src/store/models/device/utils.ts","webpack://epiphan/./src/services/api/device/DeviceApiService.ts","webpack://epiphan/./src/components/features/edge/dialogs/UpgradeFirmwareDialog/UpgradeFirmwareDialog.tsx","webpack://epiphan/./src/components/features/edge/ui/FirmwareState/FirmwareState.tsx","webpack://epiphan/./src/components/features/edge/hooks/useFirmwareQuery.ts","webpack://epiphan/./src/models/Capabilities/BaseCapabilities.ts","webpack://epiphan/./src/models/Capabilities/DeviceCapabilities.ts","webpack://epiphan/./src/components/StreamingServices/constants.ts","webpack://epiphan/./src/models/Device/Publisher/DevicePublisherModel.ts","webpack://epiphan/./src/components/DeviceDetails/Models/utils.ts","webpack://epiphan/./src/util/mappers/CloudMapper/CloudMapper.ts","webpack://epiphan/./src/components/entities/hardware/mapper/index.ts","webpack://epiphan/./src/components/entities/hardware/mapper/hardware.mapper.ts","webpack://epiphan/./src/components/DeviceDetails/Models/DeviceModel.ts","webpack://epiphan/./src/util/isEmptyObject.ts","webpack://epiphan/./src/store/models/utils.ts","webpack://epiphan/./src/models/Device/Publisher/Fabric.ts","webpack://epiphan/./src/components/DeviceDetails/Models/LiveScryptDeviceModel.ts","webpack://epiphan/./src/components/shared/api/ApiClient.ts","webpack://epiphan/./src/components/features/cloud/hooks/useCloud.ts","webpack://epiphan/./src/components/Dashboard/ListSearchFilter/index.tsx","webpack://epiphan/./src/components/Dashboard/DashboardListHeader/Buttons.tsx","webpack://epiphan/./src/components/Dashboard/DashboardListHeader/index.tsx","webpack://epiphan/./src/components/libs/buttons/PairDeviceButton.tsx","webpack://epiphan/./src/components/helpers/commonHelpers.ts","webpack://epiphan/./src/components/FleetManager/Header.tsx","webpack://epiphan/./src/components/sharedReactComponents/IndeterminateProgressBar/index.tsx","webpack://epiphan/./src/components/FleetManager/constants.ts","webpack://epiphan/./src/components/sharedReactComponents/DeviceStatusIcons/index.tsx","webpack://epiphan/./src/components/FleetManager/DeviceCard/StatusList/DeviceStatusIndicator/useActiveItems.tsx","webpack://epiphan/./src/components/DeviceDetails/DeviceStatusText/UnitStatus/UnitStatus.tsx","webpack://epiphan/./src/components/DeviceDetails/DeviceStatusText/UnifyConnectionStatus/UnifyConnectionStatus.tsx","webpack://epiphan/./src/components/DeviceDetails/DeviceStatusText/DeviceStatusText.tsx","webpack://epiphan/./src/components/FleetManager/DeviceCard/StatusList/DeviceStatusIndicator/index.tsx","webpack://epiphan/./src/components/sharedReactComponents/UpgradeToEdgePremium/UpgradeToEdgePremium.tsx","webpack://epiphan/./src/components/sharedReactComponents/RemoteLogin/index.tsx","webpack://epiphan/./src/util/bytes.ts","webpack://epiphan/./src/util/decimal.ts","webpack://epiphan/./src/components/sharedReactComponents/Tooltip/TooltipMultipleMessages.tsx","webpack://epiphan/./src/components/sharedReactComponents/LoadingPlaceholder/index.tsx","webpack://epiphan/./src/components/sharedReactComponents/DeviceHealthIndicator/DeviceHealthIndicator.tsx","webpack://epiphan/./src/components/sharedReactComponents/ItemsEnumeration/index.tsx","webpack://epiphan/./src/components/dialogs/ProjectsSwitcherDialog/ProjectsSwitcherDialog.tsx","webpack://epiphan/./src/components/sharedReactComponents/UnifySwitcher/UnifySwitcher.tsx","webpack://epiphan/./src/components/FleetManager/cells.tsx","webpack://epiphan/./src/components/FleetManager/helpers.ts","webpack://epiphan/./src/data/ActionTypes.ts","webpack://epiphan/./src/themes/styles.ts","webpack://epiphan/./src/themes/app.tsx","webpack://epiphan/./src/services/api/preset/PresetApiService.ts","webpack://epiphan/./src/services/api/deviceGroup/DeviceGroupApiService.ts","webpack://epiphan/./src/components/dialogs/CreateGroupDialog/CreateGroupDialog.tsx","webpack://epiphan/./src/services/api/schedule/ScheduleApiService.ts","webpack://epiphan/./src/util/mappers/edge/EdgeMapper.ts","webpack://epiphan/./src/util/RepeatedCall.ts","webpack://epiphan/./src/services/api/stream/StreamApiService.ts","webpack://epiphan/./src/components/StreamingServices/BaseStreamingService.ts","webpack://epiphan/./src/components/StreamingServices/StreamingDestinations/BaseStreamingDestinationModel.ts","webpack://epiphan/./src/components/StreamingServices/StreamingDestinations/OAuth2StreamingDestinationModel.ts","webpack://epiphan/./src/components/StreamingServices/StreamingDestinations/FacebookStreamingDestinationModel.ts","webpack://epiphan/./src/util/OAuthProvider/OAuthCallback.ts","webpack://epiphan/./src/util/OAuthProvider/utils.ts","webpack://epiphan/./src/util/OAuthProvider/ModalWindow.ts","webpack://epiphan/./src/util/OAuthProvider/BaseProvider.ts","webpack://epiphan/./src/util/OAuthProvider/FacebookProvider.ts","webpack://epiphan/./src/components/StreamingServices/FacebookStreamingService.ts","webpack://epiphan/./src/components/StreamingServices/StreamingDestinations/YoutubeStreamingDestinationModel.ts","webpack://epiphan/./src/util/OAuthProvider/YoutubeProvider.ts","webpack://epiphan/./src/components/StreamingServices/YoutubeStreamingService.ts","webpack://epiphan/./src/util/OAuthProvider/TwitchProvider.ts","webpack://epiphan/./src/components/StreamingServices/TwitchStreamingService.ts","webpack://epiphan/./src/components/libs/dialogs/CreateRTMPStreamingDestinationPrompt/Form.tsx","webpack://epiphan/./src/util/getApiErrorMessage.ts","webpack://epiphan/./src/components/libs/dialogs/CreateRTMPStreamingDestinationPrompt/index.tsx","webpack://epiphan/./src/components/StreamingServices/StreamingDestinations/RTMPStreamingDestinationModel.ts","webpack://epiphan/./src/components/StreamingServices/RTMPStreamingService.ts","webpack://epiphan/./src/components/StreamingServices/index.ts","webpack://epiphan/./src/hooks/Device/useGetDeviceById.ts","webpack://epiphan/./src/components/features/edge/EdgeDevice/StatusIndicator/EdgeDeviceStatus/EdgeDeviceStatus.tsx","webpack://epiphan/./src/components/features/edge/EdgeDevice/StatusIndicator/StatusIndicator.tsx","webpack://epiphan/./src/components/features/edge/EdgeDevice/indicators/indicators.types.ts","webpack://epiphan/./src/components/features/edge/EdgeDevice/PerformanceIndicator/DevicePerformance/DevicePerformance.tsx","webpack://epiphan/./src/components/DeviceDetails/DeviceInfoTab/SystemInformation/useSystemInfo.ts","webpack://epiphan/./src/components/features/edge/EdgeDevice/PerformanceIndicator/PerformanceIndicator.tsx","webpack://epiphan/./src/domain/schedule/utils.ts","webpack://epiphan/./src/components/sharedReactComponents/Events/shared/EventTitle/EventTitle.tsx","webpack://epiphan/./src/components/sharedReactComponents/Events/shared/EventCountdown/utils.ts","webpack://epiphan/./src/components/sharedReactComponents/Countdown/utils.ts","webpack://epiphan/./src/components/sharedReactComponents/Countdown/index.tsx","webpack://epiphan/./src/components/sharedReactComponents/Events/shared/EventCountdown/EventCountdown.tsx","webpack://epiphan/./src/router/admin.ts","webpack://epiphan/./src/components/sharedReactComponents/Events/shared/EventIcon/EventIcon.tsx","webpack://epiphan/./src/components/sharedReactComponents/Events/shared/PausedBadge/PausedBadge.tsx","webpack://epiphan/./src/components/sharedReactComponents/Events/constants.ts","webpack://epiphan/./src/components/sharedReactComponents/Events/utils.ts","webpack://epiphan/./src/components/sharedReactComponents/Events/shared/EventInfo/EventInfo.tsx","webpack://epiphan/./src/components/features/edge/EdgeDevice/StorageIndicator/DeviceStorage/DeviceStorage.tsx","webpack://epiphan/./src/components/DeviceDetails/DeviceInfoTab/SystemInformation/useStorageInfo.tsx","webpack://epiphan/./src/components/features/edge/EdgeDevice/StorageIndicator/StorageIndicator.tsx","webpack://epiphan/./src/components/features/edge/EdgeDevice/UploadingIndicator/DeviceUploading/DeviceUploading.tsx","webpack://epiphan/./src/components/entities/afu/api/AfuApi.ts","webpack://epiphan/./src/components/entities/afu/hooks/useUnitAfu.ts","webpack://epiphan/./src/components/entities/afu/hooks/useUnitAfuQuery.ts","webpack://epiphan/./src/components/features/edge/EdgeDevice/UploadingIndicator/UploadingIndicator.tsx","webpack://epiphan/./src/hooks/Device/Preview/types.ts","webpack://epiphan/./src/hooks/Device/useDeviceId.tsx","webpack://epiphan/./src/components/sharedReactComponents/StatusImage/utils.ts","webpack://epiphan/./src/hooks/Device/useDeviceStatusStartCommand.ts","webpack://epiphan/./src/hooks/Device/Preview/useUpdatePreviewByInterval.ts","webpack://epiphan/./src/components/sharedReactComponents/StatusImage/types.ts","webpack://epiphan/./src/components/sharedReactComponents/Preview/utils.ts","webpack://epiphan/./src/components/sharedReactComponents/Preview/ChannelPreview/useChannelPreview.ts","webpack://epiphan/./src/hooks/Device/Preview/useUpdatePreviewByWebsocket.ts","webpack://epiphan/./src/components/sharedReactComponents/Preview/ChannelPreview/ChannelPreview.tsx","webpack://epiphan/./src/components/sharedReactComponents/StatusImage/StatusImageLoading.tsx","webpack://epiphan/./src/components/sharedReactComponents/Preview/DevicePreview/DevicePreview.tsx","webpack://epiphan/./src/components/sharedReactComponents/Preview/Preview.tsx","webpack://epiphan/./src/components/sharedReactComponents/Preview/Thumbnail/Thumbnail.tsx","webpack://epiphan/./src/components/sharedReactComponents/DeviceAudioMeter/useDeviceAudioLevels.ts","webpack://epiphan/./src/components/sharedReactComponents/DeviceAudioMeter/AudioMeter/utils.ts","webpack://epiphan/./src/components/sharedReactComponents/DeviceAudioMeter/AudioMeter/useDimensions.ts","webpack://epiphan/./src/hooks/useResizeObserver.ts","webpack://epiphan/./src/components/sharedReactComponents/Canvas/index.tsx","webpack://epiphan/./src/components/sharedReactComponents/Canvas/utils.ts","webpack://epiphan/./src/components/sharedReactComponents/DeviceAudioMeter/AudioMeter/AudioMeter.tsx","webpack://epiphan/./src/components/sharedReactComponents/DeviceAudioMeter/AudioMeterStereo/AudioMeterStereo.tsx","webpack://epiphan/./src/components/sharedReactComponents/DeviceAudioMeter/AudioMeterMono/AudioMeterMono.tsx","webpack://epiphan/./src/components/sharedReactComponents/DeviceAudioMeter/DeviceAudioMeter.tsx","webpack://epiphan/./src/components/sharedReactComponents/Stack/index.tsx","webpack://epiphan/./src/components/sharedReactComponents/Separator/index.tsx","webpack://epiphan/./src/components/sharedReactComponents/ActionButtons/ActionButtonsSeparator.tsx","webpack://epiphan/./src/components/sharedReactComponents/ActionButtons/StartStopButton/constants.ts","webpack://epiphan/./src/components/sharedReactComponents/DurationTimer/Duration.tsx","webpack://epiphan/./src/components/sharedReactComponents/DurationTimer/DurationTimerComponent.tsx","webpack://epiphan/./src/components/sharedReactComponents/DurationTimer/index.tsx","webpack://epiphan/./src/components/sharedReactComponents/ActionButtons/StartStopButton/index.tsx","webpack://epiphan/./src/components/sharedReactComponents/ActionButtons/StartStopButton/RecordingStartStopButton/index.tsx","webpack://epiphan/./src/components/sharedReactComponents/ActionButtons/RecordingButton.tsx","webpack://epiphan/./src/components/sharedReactComponents/ActionButtons/StartStopButton/TranscribingStartStopButton/index.tsx","webpack://epiphan/./src/components/sharedReactComponents/ActionButtons/TranscribingButton.tsx","webpack://epiphan/./src/components/sharedReactComponents/TranscribeDuration/useDeviceTranscriptionTime.ts","webpack://epiphan/./src/components/sharedReactComponents/ActionButtons/StreamingDestinationsSelector/StreamingDestinationsSelectorButton.tsx","webpack://epiphan/./src/components/sharedReactComponents/SelectMenuOption/SelectMenuOptionWithRadio.tsx","webpack://epiphan/./src/components/StreamingServices/StreamingServiceIcon/index.ts","webpack://epiphan/./src/components/sharedReactComponents/ActionButtons/StreamingDestinationsSelector/AlreadyUsedByDevice.tsx","webpack://epiphan/./src/components/sharedReactComponents/ActionButtons/StreamingDestinationsSelector/StreamingFromDeviceNote.tsx","webpack://epiphan/./src/components/sharedReactComponents/ActionButtons/StreamingDestinationsSelector/AlreadySelectedOnDeviceNote.tsx","webpack://epiphan/./src/components/sharedReactComponents/ActionButtons/StreamingDestinationsSelector/StreamingDestinationsSelectorMenuItem.tsx","webpack://epiphan/./src/components/sharedReactComponents/SelectMenuOption/SelectMenuOptionWithCheckbox.tsx","webpack://epiphan/./src/components/sharedReactComponents/LegacyIcon/LegacyIcon.tsx","webpack://epiphan/./src/components/sharedReactComponents/StreamingDestinationListTitle/index.tsx","webpack://epiphan/./src/components/DeviceDetails/ChannelDetailsTab/DeviceStreamingPanel/DeviceStreamingDestinationList/ListItem.tsx","webpack://epiphan/./src/components/DeviceDetails/ChannelDetailsTab/DeviceStreamingPanel/DeviceStreamingDestinationList/SelectInput.tsx","webpack://epiphan/./src/components/sharedReactComponents/EditableNameText/index.tsx","webpack://epiphan/./src/util/validators/BaseValidator.ts","webpack://epiphan/./src/util/validators/NameValidator.ts","webpack://epiphan/./src/util/validators/EmptyStringValidator.ts","webpack://epiphan/./src/util/validators/EmailValidator.ts","webpack://epiphan/./src/util/validators/DevicePresetNameValidator.ts","webpack://epiphan/./src/util/validators/index.ts","webpack://epiphan/./src/util/validators/DevicePresetSectionsValidator.ts","webpack://epiphan/./src/components/sharedReactComponents/DetailsToggler/index.tsx","webpack://epiphan/./src/components/sharedReactComponents/ScrollToAnchor/ScrollToAnchorController.ts","webpack://epiphan/./src/components/sharedReactComponents/ActionButtons/StartStopButton/StreamingStartStopButton/index.tsx","webpack://epiphan/./src/components/sharedReactComponents/ActionButtons/StreamingButton.tsx","webpack://epiphan/./src/components/DeviceDetails/ChannelDetailsTab/DeviceStreamingPanel/DeviceStreamingDestinationList/DevicePublisherList.tsx","webpack://epiphan/./src/components/sharedReactComponents/ActionButtons/StreamingDestinationsSelector/StreamingDestinationsSelectorMenu.tsx","webpack://epiphan/./src/components/sharedReactComponents/ActionButtons/StreamingDestinationsSelector/index.tsx","webpack://epiphan/./src/components/sharedReactComponents/ActionButtons/DeviceStreamingButton.tsx","webpack://epiphan/./src/components/sharedReactComponents/ActionButtons/useDevicePublisherSelection.ts","webpack://epiphan/./src/util/intersectionOfSets.ts","webpack://epiphan/./src/components/sharedReactComponents/ActionButtons/useDeviceStreamingDestinationSelection.ts","webpack://epiphan/./src/util/isSetsEquals.ts","webpack://epiphan/./src/components/sharedReactComponents/ActionButtons/StreamingDestinationControl.tsx","webpack://epiphan/./src/components/sharedReactComponents/ActionButtons/useDeviceWarnings.ts","webpack://epiphan/./src/components/sharedReactComponents/ActionButtons/ActionButtons.tsx","webpack://epiphan/./src/components/features/edge/EdgeDevice/EdgeCheckbox/EdgeCheckbox.tsx","webpack://epiphan/./src/components/features/edge/EdgeDevice/body/body.styles.ts","webpack://epiphan/./src/components/features/edge/EdgeDevice/body/DeviceChannels/DeviceChannel/DeviceChannel.tsx","webpack://epiphan/./src/components/features/edge/EdgeDevice/body/DeviceChannels/DeviceChannels.tsx","webpack://epiphan/./src/constants/devicePresetSection.ts","webpack://epiphan/./src/components/sharedReactComponents/DevicePresetCard/PresetSections/PresetSections.tsx","webpack://epiphan/./src/components/sharedReactComponents/DevicePresetCard/SelectPresetCard/SelectPresetCard.tsx","webpack://epiphan/./src/components/dialogs/ApplyPresetToDevicesDialog/ApplyPresetToDevicesDialog.tsx","webpack://epiphan/./src/components/dialogs/RebootDevicesDialog/RebootDevicesDialog.tsx","webpack://epiphan/./src/components/dialogs/DeleteDevicesDialog/DeleteDevicesDialog.tsx","webpack://epiphan/./src/components/dialogs/MoveToGroupDialog/MoveToGroup.tsx","webpack://epiphan/./src/components/dialogs/MoveToGroupDialog/MoveToGroupDialog.tsx","webpack://epiphan/./src/components/features/edge/EdgeDevice/DeviceMenu/DeviceMenu.tsx","webpack://epiphan/./src/components/features/edge/styles/card.styles.ts","webpack://epiphan/./src/components/sharedReactComponents/DeviceAudioMeter/utils.ts","webpack://epiphan/./src/components/features/edge/EdgeDevice/body/LivescryptDetails/LivescryptDetails.tsx","webpack://epiphan/./src/components/features/edge/EdgeDevice/body/WebcasterDetails/WebcasterDetails.tsx","webpack://epiphan/./src/components/features/edge/EdgeDevice/FirmwareIndicator/FirmwareIndicator.tsx","webpack://epiphan/./src/components/features/edge/shared/CopyButton/CopyButton.tsx","webpack://epiphan/./src/components/features/edge/EdgeDevice/EdgeDevice.tsx","webpack://epiphan/./src/components/sharedReactComponents/OnlineIndicator/index.tsx","webpack://epiphan/./src/components/dialogs/DeleteGroupsDialog/DeleteGroupsDialog.tsx","webpack://epiphan/./src/components/dialogs/RenameGroupDialog/RenameGroupDialog.tsx","webpack://epiphan/./src/components/features/edge/BatchDevices/SelectionSummary/SelectionSummary.tsx","webpack://epiphan/./src/components/FleetManager/BatchActionsPanel/BatchActionControl.tsx","webpack://epiphan/./src/components/features/edge/BatchDevices/MultimediaControls/useBatchMultimedia.tsx","webpack://epiphan/./src/components/features/edge/BatchDevices/MultimediaControls/MultimediaControls.tsx","webpack://epiphan/./src/components/features/edge/BatchDevices/hooks/useBatchFirmware.ts","webpack://epiphan/./src/components/FleetManager/BatchActionsPanel/BatchActionButton.tsx","webpack://epiphan/./src/components/FleetManager/BatchActionsPanel/dialogs/BatchFirmwareDialog/BatchFirmwareDialog.tsx","webpack://epiphan/./src/components/features/edge/BatchDevices/BatchFirmware/BatchFirmware.tsx","webpack://epiphan/./src/components/dialogs/RemoveFromGroupDialog/RemoveFromGroup.tsx","webpack://epiphan/./src/components/dialogs/RemoveFromGroupDialog/RemoveFromGroupDialog.tsx","webpack://epiphan/./src/components/features/edge/BatchDevices/BatchGroups/BatchGroups.tsx","webpack://epiphan/./src/components/features/edge/BatchDevices/BatchActions/BatchActions.tsx","webpack://epiphan/./src/components/features/edge/BatchDevices/BatchDevices.tsx","webpack://epiphan/./src/components/features/edge/BatchDevices/hooks/useCountBatched.ts","webpack://epiphan/./src/hooks/useToggle.ts","webpack://epiphan/./src/util/Sort.ts","webpack://epiphan/./src/components/Presets/usePresetsFilterSwitches.ts","webpack://epiphan/./src/components/sharedReactComponents/PresetUploader/PresetUploader/PresetUploader.tsx","webpack://epiphan/./src/components/sharedReactComponents/DevicePicture/DevicePicture.tsx","webpack://epiphan/./src/components/Presets/PresetsPage.tsx","webpack://epiphan/./src/components/sharedReactComponents/DialogClose/DialogClose.tsx","webpack://epiphan/./src/services/api/team/TeamApiService.ts","webpack://epiphan/./src/components/Teams/UsersPanel/InviteUserForm/index.tsx","webpack://epiphan/./src/components/BillingManager/context.ts","webpack://epiphan/./src/components/sharedReactComponents/CopyButton/index.tsx","webpack://epiphan/./src/components/Settings/ApiTokens/TokensPanel/index.tsx","webpack://epiphan/./src/components/PairDevice/PairDevicePageCloseButton/PairDevicePageCloseButton.tsx","webpack://epiphan/./src/util/comparators/valueComparator.ts","webpack://epiphan/./src/util/comparators/booleanComparator.ts","webpack://epiphan/./src/util/comparators/numberComparator.ts","webpack://epiphan/./src/components/Settings/StreamingDestinations/NewStreamingDestinationTypeSelector/DisabledButtonWrapper.tsx","webpack://epiphan/./src/components/Settings/StreamingDestinations/NewStreamingDestinationTypeSelector/List/ListItem.tsx","webpack://epiphan/./src/components/Settings/StreamingDestinations/NewStreamingDestinationTypeSelector/List/index.tsx","webpack://epiphan/./src/components/Settings/StreamingDestinations/NewStreamingDestinationTypeSelector/Tiles/TileItem.tsx","webpack://epiphan/./src/components/Settings/StreamingDestinations/NewStreamingDestinationTypeSelector/Tiles/index.tsx","webpack://epiphan/./src/components/Settings/StreamingDestinations/NewStreamingDestinationTypeSelector/constants.ts","webpack://epiphan/./src/util/comparators/streamingServiceComparator.ts","webpack://epiphan/./src/components/Settings/StreamingDestinations/NewStreamingDestinationTypeSelector/index.tsx","webpack://epiphan/./src/components/sharedReactComponents/StreamingDestinationSettings/FacebookStreamingDestinationSettings.tsx","webpack://epiphan/./src/components/Settings/StreamingDestinations/index.tsx","webpack://epiphan/./src/components/Dashboard/Devices/TableView/TableHeaderCell.tsx","webpack://epiphan/./src/components/Dashboard/Devices/TableView/TableHeader.tsx","webpack://epiphan/./src/components/Dashboard/Devices/TableView/TableRowCell.tsx","webpack://epiphan/./src/components/Dashboard/Devices/TableView/TableRow.tsx","webpack://epiphan/./src/components/Dashboard/Devices/TableView/TableBody.tsx","webpack://epiphan/./src/util/Store.ts","webpack://epiphan/./src/components/Dashboard/Devices/TableView/ColumnManager/ColumnActiveManager.ts","webpack://epiphan/./src/components/FleetManager/ColumnsHeader/ColumnsSelector.tsx","webpack://epiphan/./src/components/Dashboard/Devices/TableView/Table.tsx","webpack://epiphan/./src/components/DeviceDetails/DeviceInfoTab/DeviceDetailsNavigation/DeviceDetailsNavigation.tsx","webpack://epiphan/./src/components/DeviceDetails/TranscriberDevice/Text/TranscribingText.tsx","webpack://epiphan/./src/components/sharedReactComponents/QRCode/constants.ts","webpack://epiphan/./src/components/sharedReactComponents/Tabs/TabPanels.tsx","webpack://epiphan/./src/components/sharedReactComponents/Tabs/TabPanel.tsx","webpack://epiphan/./src/components/sharedReactComponents/SettingsList/constants.ts","webpack://epiphan/./src/components/sharedReactComponents/DevicePresetForm/DevicePresetForm.tsx","webpack://epiphan/./src/components/DeviceDetails/ChannelDetailsTab/ChannelDetailsStatusList.tsx","webpack://epiphan/./src/components/sharedReactComponents/PropsList/PropsListItem.tsx","webpack://epiphan/./src/components/sharedReactComponents/PropsList/PropsListLabel.tsx","webpack://epiphan/./src/components/sharedReactComponents/PropsList/PropsListValue.tsx","webpack://epiphan/./src/components/sharedReactComponents/PropsList/PropsListItemNote.tsx","webpack://epiphan/./src/components/sharedReactComponents/PropsList/index.tsx","webpack://epiphan/./src/components/DeviceDetails/ChannelDetailsTab/constants.ts","webpack://epiphan/./src/components/DeviceDetails/ChannelDetailsTab/DeviceStatusPreview/FrameRate.tsx","webpack://epiphan/./src/components/DeviceDetails/ChannelDetailsTab/DeviceStatusPreview/VideoHlsController.ts","webpack://epiphan/./src/components/DeviceDetails/ChannelDetailsTab/DeviceStatusPreview/VideoStreamController.ts","webpack://epiphan/./src/components/sharedReactComponents/Panel/index.tsx","webpack://epiphan/./src/components/sharedReactComponents/ContextMenu/index.tsx","webpack://epiphan/./src/components/DeviceDetails/ChannelsTab/constants.ts","webpack://epiphan/./src/components/sharedReactComponents/Modal/ModalPrompt/index.tsx","webpack://epiphan/./src/components/libs/dialogs/UpdateDeviceFirmwarePrompt/index.tsx","webpack://epiphan/./src/store/models/features/firmware/FirmwareFeature.ts","webpack://epiphan/./src/components/sharedReactComponents/Meter/index.tsx","webpack://epiphan/./src/components/DeviceDetails/TranscriberDevice/Tabs/Archive/Archive.tsx","webpack://epiphan/./src/components/sharedReactComponents/Events/dialogs/StartEventDialog/StartEventDialog.tsx","webpack://epiphan/./src/components/sharedReactComponents/Events/List/EventCard/EventActions/ScheduledControl.tsx","webpack://epiphan/./src/components/sharedReactComponents/Events/dialogs/StopEventDialog/StopEventDialog.tsx","webpack://epiphan/./src/components/sharedReactComponents/Events/List/EventCard/EventActions/OngoingControls.tsx","webpack://epiphan/./src/components/entities/schedule/ui/ConfirmEventDialog/ConfirmEventDialog.tsx","webpack://epiphan/./src/components/sharedReactComponents/Events/List/EventCard/EventActions/ConfirmControls.tsx","webpack://epiphan/./src/components/sharedReactComponents/Events/List/EventCard/EventActions/EventActions.tsx","webpack://epiphan/./src/components/sharedReactComponents/Events/shared/EventMediaIcon/EventMediaIcon.tsx","webpack://epiphan/./src/components/sharedReactComponents/Events/List/EventCard/EventChannel/EventChannel.tsx","webpack://epiphan/./src/components/sharedReactComponents/Events/List/EventCard/EventDevice/EventDevice.tsx","webpack://epiphan/./src/components/sharedReactComponents/Events/List/EventCard/DeviceLink/DeviceLink.tsx","webpack://epiphan/./src/components/sharedReactComponents/Events/dialogs/DeleteEventDialog/DeleteEventDialog.tsx","webpack://epiphan/./src/components/sharedReactComponents/Events/List/EventCard/hooks/useEventMenuOptions.tsx","webpack://epiphan/./src/components/sharedReactComponents/DeviceIndicators/DeviceIndicators.tsx","webpack://epiphan/./src/components/sharedReactComponents/Events/List/EventCard/EventMedia/EventMedia.tsx","webpack://epiphan/./src/components/sharedReactComponents/Events/List/EventCard/hooks/useEventIndicators.ts","webpack://epiphan/./src/components/sharedReactComponents/Events/styles.ts","webpack://epiphan/./src/components/sharedReactComponents/Events/shared/EventStatus/EventStatus.tsx","webpack://epiphan/./src/components/sharedReactComponents/Events/List/EventCard/EventCard.tsx","webpack://epiphan/./src/components/sharedReactComponents/Events/List/EventsList/EventsList.tsx","webpack://epiphan/./src/components/sharedReactComponents/Events/Calendar/utils.ts","webpack://epiphan/./src/components/sharedReactComponents/Events/Calendar/shared/EventDefinition/EventDefinition.tsx","webpack://epiphan/./src/components/sharedReactComponents/Events/Calendar/EventsSchedule/DayEvents/EventDetails/EventDetails.tsx","webpack://epiphan/./src/components/sharedReactComponents/Events/Calendar/shared/EventPopper/EventPopper.tsx","webpack://epiphan/./src/components/sharedReactComponents/Events/Calendar/EventsSchedule/DayEvents/CalendarEvent/CalendarEvent.tsx","webpack://epiphan/./src/components/sharedReactComponents/Events/Calendar/EventsSchedule/DayEvents/CalendarGroup/GroupDetails/GroupDetails.tsx","webpack://epiphan/./src/components/sharedReactComponents/Events/shared/EventsCount/EventsCount.tsx","webpack://epiphan/./src/components/sharedReactComponents/Events/Calendar/shared/CategoryCount/CategoryCount.tsx","webpack://epiphan/./src/components/sharedReactComponents/Events/Calendar/EventsSchedule/DayEvents/CalendarGroup/CalendarGroup.tsx","webpack://epiphan/./src/components/sharedReactComponents/Events/Calendar/EventsSchedule/DayEvents/useDayEvents.ts","webpack://epiphan/./src/components/sharedReactComponents/Events/Calendar/EventsSchedule/DayEvents/DayEvents.tsx","webpack://epiphan/./src/components/sharedReactComponents/Events/Calendar/HoursToView/HoursToView.tsx","webpack://epiphan/./src/components/sharedReactComponents/DateTimePicker/renderDesktopDateTimeView.tsx","webpack://epiphan/./src/components/sharedReactComponents/Events/Editor/EventForm/scheme.ts","webpack://epiphan/./src/components/sharedReactComponents/Events/Editor/EventForm/EventForm.tsx","webpack://epiphan/./src/components/sharedReactComponents/Events/hooks/useSchedulePeriod.ts","webpack://epiphan/./src/components/sharedReactComponents/Events/shared/PeriodSwitcher/PeriodSwitcher.tsx","webpack://epiphan/./src/components/entities/files/api/FilesApi.ts","webpack://epiphan/./src/components/entities/files/ui/DeleteRecordingsDialog/DeleteRecordingsDialog.tsx","webpack://epiphan/./src/components/entities/files/ui/DownloadRecordingsDialog/DownloadRecordingsDialog.tsx","webpack://epiphan/./src/components/entities/files/ui/RevokeSharingDialog/RevokeSharingDialog.tsx","webpack://epiphan/./src/components/entities/files/ui/DatesPickerDialog/DatesPickerDialog.tsx","webpack://epiphan/./src/components/features/files/ui/RecordingName/RecordingName.tsx","webpack://epiphan/./src/components/features/files/ui/RecordingCard/RecordingCard.tsx","webpack://epiphan/./src/components/features/files/ui/TotalAndSize/TotalAndSize.tsx","webpack://epiphan/./src/components/features/files/ui/BatchRecordings/BatchRecordings.tsx","webpack://epiphan/./src/components/widgets/files/ui/UnitFiles/UnitFiles.tsx","webpack://epiphan/./src/components/entities/app/ui/FeaturesContext/FeaturesContext.tsx","webpack://epiphan/./src/components/PairDevice/PairDeviceForm/index.tsx","webpack://epiphan/./src/components/UploadLocations/constants.ts","webpack://epiphan/./src/components/UploadLocations/Models/FTPLocationModel.ts","webpack://epiphan/./src/components/UploadLocations/Models/SFTPLocationModel.ts","webpack://epiphan/./src/components/Settings/BillingAndUsage/cards/ProductCard/ProductCard.tsx","webpack://epiphan/./src/components/Settings/BillingAndUsage/UsageAndInvoices/shared/InvoiceCard/InvoiceCard.tsx","webpack://epiphan/./src/components/Settings/BillingAndUsage/UsageAndInvoices/shared/InvoiceCell/InvoiceCell.tsx","webpack://epiphan/./src/components/features/billing/files/ui/FilesInvoice/FilesInvoice.tsx","webpack://epiphan/./src/components/features/billing/files/ui/FilesCard/FilesCard.tsx","webpack://epiphan/./src/components/sharedReactComponents/Events/hooks/useTeamSchedule.ts","webpack://epiphan/./src/components/pages/Events/EventsPage.tsx","webpack://epiphan/./src/store/StoreContext.ts","webpack://epiphan/./src/components/sharedReactComponents/SummaryButton/SummaryButton.tsx","webpack://epiphan/./src/components/FleetManager/UpgradeToProTooltip.tsx","webpack://epiphan/./src/components/FleetManager/DeviceCard/SelectCheckbox/index.tsx","webpack://epiphan/./src/components/FleetManager/DeviceCard/StatusList/index.tsx","webpack://epiphan/./src/components/dialogs/DeleteProjectsDialog/DeleteProjectsDialog.tsx","webpack://epiphan/./src/components/FleetManager/DeviceCard/ContextMenu/index.tsx","webpack://epiphan/./src/components/sharedReactComponents/AvailableForProPlanTooltip/constants.ts","webpack://epiphan/./src/components/FleetManager/DeviceCard/ChildCard/Container/index.tsx","webpack://epiphan/./src/components/FleetManager/DeviceCard/ChildCard/TranscribeDeviceDetails/index.tsx","webpack://epiphan/./src/components/FleetManager/DeviceCard/ChildCard/ChannelCard/index.tsx","webpack://epiphan/./src/components/FleetManager/DeviceCard/Channels/index.tsx","webpack://epiphan/./src/components/FleetManager/DeviceCard/ChildCard/WebcasterDeviceDetails/index.tsx","webpack://epiphan/./src/components/FleetManager/DeviceCard/ChildCard/DemoDeviceDetails/index.tsx","webpack://epiphan/./src/components/FleetManager/DeviceCard/DeviceDetails/DeviceDetails.tsx","webpack://epiphan/./src/components/FleetManager/DeviceCard/DeviceCard.tsx","webpack://epiphan/./src/components/FleetManager/ColumnsHeader/index.tsx","webpack://epiphan/./src/components/UnifyProjects/hooks/useUnifyManagerColumns.tsx","webpack://epiphan/./src/components/FleetManager/BatchActionsPanel/BatchActionContextMenu.tsx","webpack://epiphan/./src/components/dialogs/CreateProjectDialog/CreateProjectDialog.tsx","webpack://epiphan/./src/services/api/meetings/MeetingsApiService.ts","webpack://epiphan/./src/util/arrayToMap.ts","webpack://epiphan/./src/store/models/connect/Meeting/Meeting.ts","webpack://epiphan/./src/store/models/connect/Participant/Participant.ts","webpack://epiphan/./src/store/models/connect/SrtStream/SrtStream.ts","webpack://epiphan/./src/store/models/connect/ReturnFeed/ReturnFeed.ts","webpack://epiphan/./src/util/mappers/ConnectMapper/ConnectMapper.ts","webpack://epiphan/./src/contracts/connect/utils.ts","webpack://epiphan/./src/hooks/useTenantsQuery.ts","webpack://epiphan/./src/components/sharedReactComponents/Pairing/NoPairingPermission/NoPairingPermission.tsx","webpack://epiphan/./src/components/MeetingsManager/modals/NotTenantAdminPrompt/NotTenantAdminPrompt.tsx","webpack://epiphan/./src/components/sharedReactComponents/Pairing/UnexpectedError/UnexpectedError.tsx","webpack://epiphan/./src/components/MeetingsManager/modals/UnexpectedErrorPrompt/UnexpectedErrorPrompt.tsx","webpack://epiphan/./src/hooks/Meeting/useTeamsConnectionUrlHandlers.ts","webpack://epiphan/./src/components/sharedReactComponents/Tabs/Tabs.tsx","webpack://epiphan/./src/components/sharedReactComponents/Tabs/Tab.tsx","webpack://epiphan/./src/hooks/useZoomAccounts.ts","webpack://epiphan/./src/components/dialogs/GeneratePairingLinkDialog/GeneratePairingLinkDialog.tsx","webpack://epiphan/./src/components/dialogs/PairActionSelectorDialog/PairActionSelectorDialog.tsx","webpack://epiphan/./src/components/ConnectPlatformsIntegration/ConnectPlatformsIntegration.tsx","webpack://epiphan/./src/components/sharedReactComponents/TabPanel/TabPanel.tsx","webpack://epiphan/./src/components/dialogs/TeamsConnectDialog/TeamsConnect/CreateTeamsCall/CreateTeamsCall.tsx","webpack://epiphan/./src/components/dialogs/TeamsConnectDialog/TeamsConnect/ConnectToTeamsCall/ConnectForm/ConnectForm.tsx","webpack://epiphan/./src/components/dialogs/TeamsConnectDialog/TeamsConnect/ConnectToTeamsCall/TenantMessage/TenantMessage.tsx","webpack://epiphan/./src/components/dialogs/TeamsConnectDialog/TeamsConnect/ConnectToTeamsCall/ConnectToTeamsCall.tsx","webpack://epiphan/./src/components/dialogs/TeamsConnectDialog/TeamsConnect/TeamsConnect.tsx","webpack://epiphan/./src/components/dialogs/TeamsConnectDialog/TeamsConnectDialog.tsx","webpack://epiphan/./src/components/dialogs/ConnectToHostedDialog/ConnectToHosted.tsx","webpack://epiphan/./src/components/dialogs/ConnectToHostedDialog/ConnectToHostedDialog.tsx","webpack://epiphan/./src/api/types.ts","webpack://epiphan/./src/components/dialogs/ZoomConnectDialog/ZoomConnection.tsx","webpack://epiphan/./src/components/dialogs/ZoomConnectDialog/ZoomConnectDialog.tsx","webpack://epiphan/./src/components/dialogs/ZoomPasscodeDialog/ZoomPasscode.tsx","webpack://epiphan/./src/components/dialogs/ZoomPasscodeDialog/ZoomPasscodeDialog.tsx","webpack://epiphan/./src/util/UserTeamStore.ts","webpack://epiphan/./src/util/LocalStorage/CustomerStorage.ts","webpack://epiphan/./src/components/pages/MeetingDetails/ParticipantsList/useStorageValue.ts","webpack://epiphan/./src/components/dialogs/StartingZoomMeetingDialog/StartingZoomMeetingDialog.tsx","webpack://epiphan/./src/components/MeetingsManager/dialogs/ZoomIdentityDialog/ZoomIdentity/ZoomIdentity.tsx","webpack://epiphan/./src/components/MeetingsManager/dialogs/ZoomIdentityDialog/ZoomIdentityDialog.tsx","webpack://epiphan/./src/components/MeetingsManager/dialogs/DeleteCallDialog/DeleteCallDialog.tsx","webpack://epiphan/./src/components/MeetingsManager/ConnectManager.tsx","webpack://epiphan/./src/components/MeetingsManager/MeetingsHeader/PlatformAccount/PlatformAccount.tsx","webpack://epiphan/./src/components/MeetingsManager/MeetingsHeader/MeetingsHeader.tsx","webpack://epiphan/./src/components/MeetingsManager/styles.ts","webpack://epiphan/./src/components/MeetingsManager/MeetingCardHeader/MeetingCardHeader.tsx","webpack://epiphan/./src/components/MeetingsManager/buttons/index.tsx","webpack://epiphan/./src/components/MeetingsManager/cards/EntityCard/EntityMenu/EntityMenu.tsx","webpack://epiphan/./src/components/MeetingsManager/cards/EntityCard/EntityCard.tsx","webpack://epiphan/./src/components/MeetingsManager/cards/EntityCard/EntityName/EntityName.tsx","webpack://epiphan/./src/components/MeetingsManager/cards/CallCard/CallCard.tsx","webpack://epiphan/./src/components/sharedReactComponents/Progress/index.tsx","webpack://epiphan/./src/components/MeetingsManager/cards/MeetingCard/columns/MeetingStatusColumn/ConnectionProgress/ConnectionProgress.tsx","webpack://epiphan/./src/components/MeetingsManager/cards/MeetingCard/columns/MeetingStatusColumn/PermissionStatus/PermissionStatus.tsx","webpack://epiphan/./src/components/MeetingsManager/cards/MeetingCard/columns/MeetingStatusColumn/MeetingStatus.tsx","webpack://epiphan/./src/components/sharedReactComponents/MeetingParticipantsCount/MeetingParticipantsCount.tsx","webpack://epiphan/./src/hooks/useSrtCount.ts","webpack://epiphan/./src/components/sharedReactComponents/MeetingSrtSummary/SrtSummary/SrtSummary.tsx","webpack://epiphan/./src/components/sharedReactComponents/MeetingSrtSummary/MeetingSrtSummary.tsx","webpack://epiphan/./src/components/MeetingsManager/cards/MeetingCard/columns/MeetingCountColumn/MeetingCountColumn.tsx","webpack://epiphan/./src/components/MeetingsManager/modals/DisconnectMeetingPrompt/DisconnectMeetingPrompt.tsx","webpack://epiphan/./src/components/libs/dialogs/DeleteMeetingPrompt/index.tsx","webpack://epiphan/./src/components/MeetingsManager/cards/MeetingCard/MeetingCard.tsx","webpack://epiphan/./src/components/MeetingsManager/MeetingsList/MeetingsList.tsx","webpack://epiphan/./src/components/MeetingsManager/MoreDetails/MoreDetails.tsx","webpack://epiphan/./src/components/MeetingsManager/MeetingsWelcome/MeetingsWelcome.tsx","webpack://epiphan/./src/store/hooks.ts","webpack://epiphan/./src/hooks/Meeting/useSocketHandlers.ts","webpack://epiphan/./src/components/MeetingsManager/hooks/useMeetingsQuery.ts","webpack://epiphan/./src/components/MeetingsManager/hooks/useMeetings.ts","webpack://epiphan/./src/hooks/Meeting/useMeetingsSocket.ts","webpack://epiphan/./src/components/MeetingsManager/ReadyToConnect/ReadyToConnect.tsx","webpack://epiphan/./src/components/MeetingsManager/hooks/useFilter.ts","webpack://epiphan/./src/components/MeetingsManager/SecureMessage/SecureMessage.tsx","webpack://epiphan/./src/components/widgets/connect/ui/ConnectGuide/ConnectGuide.tsx","webpack://epiphan/./src/components/entities/billing/base/utils/utils.ts","webpack://epiphan/./src/components/MeetingsManager/MeetingsManager.tsx","webpack://epiphan/./src/components/DeviceDetails/hooks/useSearch.tsx","webpack://epiphan/./src/components/BillingManager/hooks/useTeamBilling.ts","webpack://epiphan/./src/components/pages/MeetingDetails/hooks/useMeeting.ts","webpack://epiphan/./src/components/pages/MeetingDetails/MeetingDetailsHeader/MeetingDetailsInfo/MeetingUpTime.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/MeetingDetailsHeader/MeetingDetailsInfo/MeetingAudioMode.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/MeetingDetailsHeader/MeetingDetailsInfo/index.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/MeetingDetailsHeader/MeetingDetailsHeader.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/hooks/usePermissionIssue.ts","webpack://epiphan/./src/components/pages/MeetingDetails/MeetingLayout/PermissionNote.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/MeetingLayout/LocalRecordGuide/LocalRecordGuide.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/MeetingLayout/LocalRecordIssue/LocalRecordIssue.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/MeetingLayout/DeniedAccessIssue/DeniedAccessIssue.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/MeetingLayout/MediaActionIssue/MediaActionIssue.tsx","webpack://epiphan/./src/components/sharedReactComponents/FilterSelector/utils.ts","webpack://epiphan/./src/components/pages/MeetingDetails/ParticipantsList/useParticipants.ts","webpack://epiphan/./src/components/pages/MeetingDetails/shared/ParticipantAvatar/ParticipantAvatar.tsx","webpack://epiphan/./src/types/guards/connect.ts","webpack://epiphan/./src/components/pages/MeetingDetails/ParticipantCard/ParticipantStream/SrtDestination/SrtDestination.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/ParticipantCard/ParticipantStream/ParticipantStream.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/shared/ParticipantInput/ParticipantInput.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/shared/ParticipantMessage/ParticipantMessage.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/shared/DisconnectedLabel/DisconnectedLabel.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/StreamSettings/SrtSettingsForm.ts","webpack://epiphan/./src/components/pages/MeetingDetails/StreamSettings/common/StreamSetting/StreamSetting.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/StreamSettings/StreamVideoSettings/BitrateInput/BitrateInput.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/StreamSettings/StreamVideoSettings/FramerateInput/FramerateInput.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/StreamSettings/utils.ts","webpack://epiphan/./src/components/pages/MeetingDetails/StreamSettings/StreamVideoSettings/StreamVideoSettings.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/StreamSettings/SrtSettingsFormContext.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/shared/IsolatedAudioLabel/NoAudioLabel.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/shared/StreamButtons/StreamButtons.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/StreamSettings/StreamGeneralSettings/StreamGeneralSettings.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/StreamSettings/CollapsiblePanel/CollapsiblePanel.tsx","webpack://epiphan/./src/components/sharedReactComponents/TextInput/TextInput.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/shared/CopyText/CopyText.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/StreamSettings/StreamConnectionSettings/CustomSrtConnection/CustomSrtConnection.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/StreamSettings/StreamConnectionSettings/CloudSrtConnection/SrtEntitySelector/SrtEntitySelector.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/StreamSettings/StreamConnectionSettings/CloudSrtConnection/SrtSourceSelector/SrtSourceSelector.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/StreamSettings/StreamConnectionSettings/CloudSrtConnection/CloudSrtConnection.tsx","webpack://epiphan/./src/services/api/meetings/SrtApiService.ts","webpack://epiphan/./src/components/pages/MeetingDetails/StreamSettings/StreamConnectionSettings/StreamConnectionSettings.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/StreamSettings/StreamAdvancedSettings/StreamAdvancedSettings.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/StreamSettings/StreamAudioSettings/StreamAudioSettings.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/StreamSettings/EncryptionMessage/EncryptionMessage.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/StreamSettings/StreamSettings.tsx","webpack://epiphan/./src/components/MeetingsManager/modals/StopSrtPrompt/StopSrtPrompt.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/shared/ParticipantActions/ParticipantActions.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/StreamConnectionStatus/SrtConnectionState/SrtConnectionState.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/StreamConnectionStatus/SrtConnectionPoint/SrtConnectionPoint.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/StreamConnectionStatus/StreamConnectionStatus.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/StreamStatus/StreamStatusActions/StreamStatusActions.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/StreamStatus/StreamStatusHeader/StreamStatusHeader.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/StreamStatus/StreamStatusDetails/StreamStatusContainer/StreamStatusContainer.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/StreamStatus/StreamStatusDetails/StreamingParameters/StreamingParameters.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/StreamStatus/StreamStatusDetails/StreamStatusTable/StreamStatusTable.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/StreamStatus/StreamStatusDetails/StreamStatusDetails.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/StreamStatus/StreamStatus.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/StreamStatus/useStreamStatus.ts","webpack://epiphan/./src/components/pages/MeetingDetails/ParticipantCard/ParticipantCard.tsx","webpack://epiphan/./src/components/FleetManager/FilterStoreManager.ts","webpack://epiphan/./src/hooks/useFilterFeature.ts","webpack://epiphan/./src/util/toggleInSet.ts","webpack://epiphan/./src/components/FleetManager/SubHeader/ActiveFilters/index.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/ReturnFeedOwner/ReturnFeedOwner.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/ParticipantsList/ParticipantsList.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/MeetingLayout/MeetingLayout.tsx","webpack://epiphan/./src/components/pages/MeetingDetails/MeetingDetailsPage.tsx","webpack://epiphan/./src/components/ErrorBoundary/ErrorSection.tsx","webpack://epiphan/./src/components/ErrorBoundary/ErrorBoundary.tsx","webpack://epiphan/./src/components/sharedReactComponents/PaymentForm/PaymentForm.tsx","webpack://epiphan/./src/components/BillingManager/dialogs/CloudTiersDialog/CloudFeatures/CloudFeatures.tsx","webpack://epiphan/./src/components/BillingManager/dialogs/CloudTiersDialog/TierCard/TierCard.tsx","webpack://epiphan/./src/util/DriftComTracker/DriftComScripts.js","webpack://epiphan/./src/util/DriftComTracker/DriftComTracker.ts","webpack://epiphan/./src/components/Navigation/shared/NavText.tsx","webpack://epiphan/./src/components/Navigation/shared/SectionButton/SectionButton.tsx","webpack://epiphan/./src/components/Navigation/EdgeNav/EdgeNav.tsx","webpack://epiphan/./src/components/Navigation/shared/NavButton.tsx","webpack://epiphan/./src/components/Navigation/TeamSelector/TeamList.tsx","webpack://epiphan/./src/components/Navigation/TeamSelector/TeamSelector.tsx","webpack://epiphan/./src/components/features/notifications/ui/OwnershipNotification/OwnershipNotification.tsx","webpack://epiphan/./src/components/widgets/notifications/ui/UserNotifications/UserNotifications.tsx","webpack://epiphan/./src/themes/MainTheme.tsx","webpack://epiphan/./src/components/Root/app.tsx","webpack://epiphan/./src/components/Root/login.tsx","webpack://epiphan/./src/login.ts","webpack://epiphan/./node_modules/tslib/tslib.es6.js","webpack://epiphan/./node_modules/unfetch/dist/unfetch.module.js","webpack://epiphan/./node_modules/universal-cookie/node_modules/cookie/index.js","webpack://epiphan/./node_modules/url/node_modules/punycode/punycode.js","webpack://epiphan/./node_modules/url/url.js","webpack://epiphan/./node_modules/url/util.js","webpack://epiphan/./node_modules/uuid/index.js","webpack://epiphan/./node_modules/uuid/lib/bytesToUuid.js","webpack://epiphan/./node_modules/uuid/lib/rng-browser.js","webpack://epiphan/./node_modules/uuid/v1.js","webpack://epiphan/./node_modules/uuid/v4.js","webpack://epiphan/webpack/bootstrap","webpack://epiphan/webpack/runtime/compat get default export","webpack://epiphan/webpack/runtime/define property getters","webpack://epiphan/webpack/runtime/ensure chunk","webpack://epiphan/webpack/runtime/get javascript chunk filename","webpack://epiphan/webpack/runtime/global","webpack://epiphan/webpack/runtime/hasOwnProperty shorthand","webpack://epiphan/webpack/runtime/make namespace object","webpack://epiphan/webpack/runtime/node module decorator","webpack://epiphan/webpack/runtime/runtimeId","webpack://epiphan/webpack/runtime/publicPath","webpack://epiphan/webpack/runtime/jsonp chunk loading","webpack://epiphan/webpack/startup"],"sourcesContent":["var deferred = [];\n__webpack_require__.O = function(result, chunkIds, fn, priority) {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar chunkIds = deferred[i][0];\n\t\tvar fn = deferred[i][1];\n\t\tvar priority = deferred[i][2];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every(function(key) { return __webpack_require__.O[key](chunkIds[j]); })) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","var getProto = Object.getPrototypeOf ? function(obj) { return Object.getPrototypeOf(obj); } : function(obj) { return obj.__proto__; };\nvar leafPrototypes;\n// create a fake namespace object\n// mode & 1: value is a module id, require it\n// mode & 2: merge all properties of value into the ns\n// mode & 4: return value when already ns object\n// mode & 16: return value when it's Promise-like\n// mode & 8|1: behave like require\n__webpack_require__.t = function(value, mode) {\n\tif(mode & 1) value = this(value);\n\tif(mode & 8) return value;\n\tif(typeof value === 'object' && value) {\n\t\tif((mode & 4) && value.__esModule) return value;\n\t\tif((mode & 16) && typeof value.then === 'function') return value;\n\t}\n\tvar ns = Object.create(null);\n\t__webpack_require__.r(ns);\n\tvar def = {};\n\tleafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];\n\tfor(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) {\n\t\tObject.getOwnPropertyNames(current).forEach(function(key) { def[key] = function() { return value[key]; }; });\n\t}\n\tdef['default'] = function() { return value; };\n\t__webpack_require__.d(ns, def);\n\treturn ns;\n};","var inProgress = {};\nvar dataWebpackPrefix = \"epiphan:\";\n// loadScript function to load a script via script tag\n__webpack_require__.l = function(url, done, key, chunkId) {\n\tif(inProgress[url]) { inProgress[url].push(done); return; }\n\tvar script, needAttach;\n\tif(key !== undefined) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tfor(var i = 0; i < scripts.length; i++) {\n\t\t\tvar s = scripts[i];\n\t\t\tif(s.getAttribute(\"src\") == url || s.getAttribute(\"data-webpack\") == dataWebpackPrefix + key) { script = s; break; }\n\t\t}\n\t}\n\tif(!script) {\n\t\tneedAttach = true;\n\t\tscript = document.createElement('script');\n\n\t\tscript.charset = 'utf-8';\n\t\tscript.timeout = 120;\n\t\tif (__webpack_require__.nc) {\n\t\t\tscript.setAttribute(\"nonce\", __webpack_require__.nc);\n\t\t}\n\t\tscript.setAttribute(\"data-webpack\", dataWebpackPrefix + key);\n\t\tscript.src = url;\n\t}\n\tinProgress[url] = [done];\n\tvar onScriptComplete = function(prev, event) {\n\t\t// avoid mem leaks in IE.\n\t\tscript.onerror = script.onload = null;\n\t\tclearTimeout(timeout);\n\t\tvar doneFns = inProgress[url];\n\t\tdelete inProgress[url];\n\t\tscript.parentNode && script.parentNode.removeChild(script);\n\t\tdoneFns && doneFns.forEach(function(fn) { return fn(event); });\n\t\tif(prev) return prev(event);\n\t}\n\t;\n\tvar timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);\n\tscript.onerror = onScriptComplete.bind(null, script.onerror);\n\tscript.onload = onScriptComplete.bind(null, script.onload);\n\tneedAttach && document.head.appendChild(script);\n};","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n//# sourceMappingURL=CryptoOperation.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n//# sourceMappingURL=Key.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n//# sourceMappingURL=KeyOperation.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n//# sourceMappingURL=MsSubtleCrypto.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isMsWindow = void 0;\nvar msSubtleCryptoMethods = [\n \"decrypt\",\n \"digest\",\n \"encrypt\",\n \"exportKey\",\n \"generateKey\",\n \"importKey\",\n \"sign\",\n \"verify\"\n];\nfunction quacksLikeAnMsWindow(window) {\n return \"MSInputMethodContext\" in window && \"msCrypto\" in window;\n}\n/**\n * Determines if the provided window is (or is like) the window object one would\n * expect to encounter in Internet Explorer 11.\n */\nfunction isMsWindow(window) {\n if (quacksLikeAnMsWindow(window) && window.msCrypto.subtle !== undefined) {\n var _a = window.msCrypto, getRandomValues = _a.getRandomValues, subtle_1 = _a.subtle;\n return msSubtleCryptoMethods\n .map(function (methodName) { return subtle_1[methodName]; })\n .concat(getRandomValues)\n .every(function (method) { return typeof method === \"function\"; });\n }\n return false;\n}\nexports.isMsWindow = isMsWindow;\n//# sourceMappingURL=MsWindow.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = require(\"tslib\");\ntslib_1.__exportStar(require(\"./CryptoOperation\"), exports);\ntslib_1.__exportStar(require(\"./Key\"), exports);\ntslib_1.__exportStar(require(\"./KeyOperation\"), exports);\ntslib_1.__exportStar(require(\"./MsSubtleCrypto\"), exports);\ntslib_1.__exportStar(require(\"./MsWindow\"), exports);\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.EMPTY_DATA_SHA_256 = exports.SHA_256_HMAC_ALGO = exports.SHA_256_HASH = void 0;\nexports.SHA_256_HASH = { name: \"SHA-256\" };\nexports.SHA_256_HMAC_ALGO = {\n name: \"HMAC\",\n hash: exports.SHA_256_HASH\n};\nexports.EMPTY_DATA_SHA_256 = new Uint8Array([\n 227,\n 176,\n 196,\n 66,\n 152,\n 252,\n 28,\n 20,\n 154,\n 251,\n 244,\n 200,\n 153,\n 111,\n 185,\n 36,\n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H07XG5cbmV4cG9ydCBjb25zdCBTSEFfMjU2X0hNQUNfQUxHTzogeyBuYW1lOiBcIkhNQUNcIjsgaGFzaDogeyBuYW1lOiBcIlNIQS0yNTZcIiB9IH0gPSB7XG4gIG5hbWU6IFwiSE1BQ1wiLFxuICBoYXNoOiBTSEFfMjU2X0hBU0hcbn07XG5cbmV4cG9ydCBjb25zdCBFTVBUWV9EQVRBX1NIQV8yNTYgPSBuZXcgVWludDhBcnJheShbXG4gIDIyNyxcbiAgMTc2LFxuICAxOTYsXG4gIDY2LFxuICAxNTIsXG4gIDI1MixcbiAgMjgsXG4gIDIwLFxuICAxNTQsXG4gIDI1MSxcbiAgMjQ0LFxuICAyMDAsXG4gIDE1MyxcbiAgMTExLFxuICAxODUsXG4gIDM2LFxuICAzOSxcbiAgMTc0LFxuICA2NSxcbiAgMjI4LFxuICAxMDAsXG4gIDE1NSxcbiAgMTQ3LFxuICA3NixcbiAgMTY0LFxuICAxNDksXG4gIDE1MyxcbiAgMjcsXG4gIDEyMCxcbiAgODIsXG4gIDE4NCxcbiAgODVcbl0pO1xuIl19","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Sha256 = void 0;\nvar ie11Sha256_1 = require(\"./ie11Sha256\");\nvar webCryptoSha256_1 = require(\"./webCryptoSha256\");\nvar sha256_js_1 = require(\"@aws-crypto/sha256-js\");\nvar supports_web_crypto_1 = require(\"@aws-crypto/supports-web-crypto\");\nvar ie11_detection_1 = require(\"@aws-crypto/ie11-detection\");\nvar util_locate_window_1 = require(\"@aws-sdk/util-locate-window\");\nvar Sha256 = /** @class */ (function () {\n function Sha256(secret) {\n if ((0, supports_web_crypto_1.supportsWebCrypto)((0, util_locate_window_1.locateWindow)())) {\n this.hash = new webCryptoSha256_1.Sha256(secret);\n }\n else if ((0, ie11_detection_1.isMsWindow)((0, util_locate_window_1.locateWindow)())) {\n this.hash = new ie11Sha256_1.Sha256(secret);\n }\n else {\n this.hash = new sha256_js_1.Sha256(secret);\n }\n }\n Sha256.prototype.update = function (data, encoding) {\n this.hash.update(data, encoding);\n };\n Sha256.prototype.digest = function () {\n return this.hash.digest();\n };\n return Sha256;\n}());\nexports.Sha256 = Sha256;\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3Jvc3NQbGF0Zm9ybVNoYTI1Ni5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9jcm9zc1BsYXRmb3JtU2hhMjU2LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLDJDQUFvRDtBQUNwRCxxREFBOEQ7QUFDOUQsbURBQTJEO0FBRTNELHVFQUFvRTtBQUNwRSw2REFBd0Q7QUFDeEQsa0VBQTJEO0FBRTNEO0lBR0UsZ0JBQVksTUFBbUI7UUFDN0IsSUFBSSxJQUFBLHVDQUFpQixFQUFDLElBQUEsaUNBQVksR0FBRSxDQUFDLEVBQUU7WUFDckMsSUFBSSxDQUFDLElBQUksR0FBRyxJQUFJLHdCQUFlLENBQUMsTUFBTSxDQUFDLENBQUM7U0FDekM7YUFBTSxJQUFJLElBQUEsMkJBQVUsRUFBQyxJQUFBLGlDQUFZLEdBQUUsQ0FBQyxFQUFFO1lBQ3JDLElBQUksQ0FBQyxJQUFJLEdBQUcsSUFBSSxtQkFBVSxDQUFDLE1BQU0sQ0FBQyxDQUFDO1NBQ3BDO2FBQU07WUFDTCxJQUFJLENBQUMsSUFBSSxHQUFHLElBQUksa0JBQVEsQ0FBQyxNQUFNLENBQUMsQ0FBQztTQUNsQztJQUNILENBQUM7SUFFRCx1QkFBTSxHQUFOLFVBQU8sSUFBZ0IsRUFBRSxRQUFzQztRQUM3RCxJQUFJLENBQUMsSUFBSSxDQUFDLE1BQU0sQ0FBQyxJQUFJLEVBQUUsUUFBUSxDQUFDLENBQUM7SUFDbkMsQ0FBQztJQUVELHVCQUFNLEdBQU47UUFDRSxPQUFPLElBQUksQ0FBQy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hpcy5oYXNoID0gbmV3IEllMTFTaGEyNTYoc2VjcmV0KTtcbiAgICB9IGVsc2Uge1xuICAgICAgdGhpcy5oYXNoID0gbmV3IEpzU2hhMjU2KHNlY3JldCk7XG4gICAgfVxuICB9XG5cbiAgdXBkYXRlKGRhdGE6IFNvdXJjZURhdGEsIGVuY29kaW5nPzogXCJ1dGY4XCIgfCBcImFzY2lpXCIgfCBcImxhdGluMVwiKTogdm9pZCB7XG4gICAgdGhpcy5oYXNoLnVwZGF0ZShkYXRhLCBlbmNvZGluZyk7XG4gIH1cblxuICBkaWdlc3QoKTogUHJvbWlzZTxVaW50OEFycmF5PiB7XG4gICAgcmV0dXJuIHRoaXMuaGFzaC5kaWdlc3QoKTtcbiAgfVxufVxuIl19","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Sha256 = void 0;\nvar isEmptyData_1 = require(\"./isEmptyData\");\nvar constants_1 = require(\"./constants\");\nvar util_utf8_browser_1 = require(\"@aws-sdk/util-utf8-browser\");\nvar util_locate_window_1 = require(\"@aws-sdk/util-locate-window\");\nvar Sha256 = /** @class */ (function () {\n function Sha256(secret) {\n if (secret) {\n this.operation = getKeyPromise(secret).then(function (keyData) {\n return (0, util_locate_window_1.locateWindow)().msCrypto.subtle.sign(constants_1.SHA_256_HMAC_ALGO, keyData);\n });\n this.operation.catch(function () { });\n }\n else {\n this.operation = Promise.resolve((0, util_locate_window_1.locateWindow)().msCrypto.subtle.digest(\"SHA-256\"));\n }\n }\n Sha256.prototype.update = function (toHash) {\n var _this = this;\n if ((0, isEmptyData_1.isEmptyData)(toHash)) {\n return;\n }\n this.operation = this.operation.then(function (operation) {\n operation.onerror = function () {\n _this.operation = Promise.reject(new Error(\"Error encountered updating hash\"));\n };\n operation.process(toArrayBufferView(toHash));\n return operation;\n });\n this.operation.catch(function () { });\n };\n Sha256.prototype.digest = function () {\n return this.operation.then(function (operation) {\n return new Promise(function (resolve, reject) {\n operation.onerror = function () {\n reject(new Error(\"Error encountered finalizing hash\"));\n };\n operation.oncomplete = function () {\n if (operation.result) {\n resolve(new Uint8Array(operation.result));\n }\n reject(new Error(\"Error encountered finalizing hash\"));\n };\n operation.finish();\n });\n });\n };\n return Sha256;\n}());\nexports.Sha256 = Sha256;\nfunction getKeyPromise(secret) {\n return new Promise(function (resolve, reject) {\n var keyOperation = (0, util_locate_window_1.locateWindow)().msCrypto.subtle.importKey(\"raw\", toArrayBufferView(secret), constants_1.SHA_256_HMAC_ALGO, false, [\"sign\"]);\n keyOperation.oncomplete = function () {\n if (keyOperation.result) {\n resolve(keyOperation.result);\n }\n reject(new Error(\"ImportKey completed without importing key.\"));\n };\n keyOperation.onerror = function () {\n reject(new Error(\"ImportKey failed to import key.\"));\n };\n });\n}\nfunction toArrayBufferView(data) {\n if (typeof data === \"string\") {\n return (0, util_utf8_browser_1.fromUtf8)(data);\n }\n if (ArrayBuffer.isView(data)) {\n return new Uint8Array(data.buffer, data.byteOffset, data.byteLength / Uint8Array.BYTES_PER_ELEMENT);\n }\n return new Uint8Array(data);\n}\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaWUxMVNoYTI1Ni5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9pZTExU2hhMjU2LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLDZDQUE0QztBQUM1Qyx5Q0FBZ0Q7QUFFaEQsZ0VBQXNEO0FBRXRELGtFQUEyRDtBQUUzRDtJQUdFLGdCQUFZLE1BQW1CO1FBQzdCLElBQUksTUFBTSxFQUFFO1lBQ1YsSUFBSSxDQUFDLFNBQVMsR0FBRyxhQUFhLENBQUMsTUFBTSxDQUFDLENBQUMsSUFBSSxDQUFDLFVBQUEsT0FBTztnQkFDakQsT0FBQyxJQUFBLGlDQUFZLEdBQWUsQ0FBQyxRQUFRLENBQUMsTUFBTSxDQUFDLElBQUksQ0FDL0MsNkJBQWlCL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XJhdGlvbiA9IFByb21pc2UucmVqZWN0KFxuICAgICAgICAgIG5ldyBFcnJvcihcIkVycm9yIGVuY291bnRlcmVkIHVwZGF0aW5nIGhhc2hcIilcbiAgICAgICAgKTtcbiAgICAgIH07XG4gICAgICBvcGVyYXRpb24ucHJvY2Vzcyh0b0FycmF5QnVmZmVyVmlldyh0b0hhc2gpKTtcblxuICAgICAgcmV0dXJuIG9wZXJhdGlvbjtcbiAgICB9KTtcbiAgICB0aGlzLm9wZXJhdGlvbi5jYXRjaCgoKSA9PiB7fSk7XG4gIH1cblxuICBkaWdlc3QoKTogUHJvbWlzZTxVaW50OEFycmF5PiB7XG4gICAgcmV0dXJuIHRoaXMub3BlcmF0aW9uLnRoZW48VWludDhBcnJheT4oXG4gICAgICBvcGVyYXRpb24gPT5cbiAgICAgICAgbmV3IFByb21pc2UoKHJlc29sdmUsIHJlamVjdCkgPT4ge1xuICAgICAgICAgIG9wZXJhdGlvbi5vbmVycm9yID0gKCkgPT4ge1xuICAgICAgICAgICAgcmVqZWN0KG5ldyBFcnJvcihcIkVycm9yIGVuY291bnRlcmVkIGZpbmFsaXppbmcgaGFzaFwiKSk7XG4gICAgICAgICAgfTtcbiAgICAgICAgICBvcGVyYXRpb24ub25jb21wbGV0ZSA9ICgpID0+IHtcbiAgICAgICAgICAgIGlmIChvcGVyYXRpb24ucmVzdWx0KSB7XG4gICAgICAgICAgICAgIHJlc29sdmUobmV3IFVpbnQ4QXJyYXkob3BlcmF0aW9uLnJlc3VsdCkpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmVqZWN0KG5ldyBFcnJvcihcIkVycm9yIGVuY291bnRlcmVkIGZpbmFsaXppbmcgaGFzaFwiKSk7XG4gICAgICAgICAgfTtcblxuICAgICAgICAgIG9wZXJhdGlvbi5maW5pc2goKTtcbiAgICAgICAgfSlcbiAgICApO1xuICB9XG59XG5cbmZ1bmN0aW9uIGdldEtleVByb21pc2Uoc2VjcmV0OiBTb3VyY2VEYXRhK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XQsXG4gICAgICBkYXRhLmJ5dGVMZW5ndGggLyBVaW50OEFycmF5LkJZVEVTX1BFUl9FTEVNRU5UXG4gICAgKTtcbiAgfVxuXG4gIHJldHVybiBuZXcgVWludDhBcnJheShkYXRhKTtcbn1cbiJdfQ==","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.WebCryptoSha256 = exports.Ie11Sha256 = void 0;\nvar tslib_1 = require(\"tslib\");\n(0, tslib_1.__exportStar)(require(\"./crossPlatformSha256\"), exports);\nvar ie11Sha256_1 = require(\"./ie11Sha256\");\nObject.defineProperty(exports, \"Ie11Sha256\", { enumerable: true, get: function () { return ie11Sha256_1.Sha256; } });\nvar webCryptoSha256_1 = require(\"./webCryptoSha256\");\nObject.defineProperty(exports, \"WebCryptoSha256\", { enumerable: true, get: function () { return webCryptoSha256_1.Sha256; } });\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztBQUFBLHFFQUFzQztBQUN0QywyQ0FBb0Q7QUFBM0Msd0dBQUEsTUFBTSxPQUFjO0FBQzdCLHFEQUE4RDtBQUFyRCxrSEFBQSxNQUFNLE9BQW1CIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0ICogZnJvbSBcIi4vY3Jvc3NQbGF0Zm9ybVNoYTI1NlwiO1xuZXhwb3J0IHsgU2hhMjU2IGFzIEllMTFTaGEyNTYgfSBmcm9tIFwiLi9pZTExU2hhMjU2XCI7XG5leHBvcnQgeyBTaGEyNTYgYXMgV2ViQ3J5cHRvU2hhMjU2IH0gZnJvbSBcIi4vd2ViQ3J5cHRvU2hhMjU2XCI7XG4iXX0=","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isEmptyData = void 0;\nfunction isEmptyData(data) {\n if (typeof data === \"string\") {\n return data.length === 0;\n }\n return data.byteLength === 0;\n}\nexports.isEmptyData = isEmptyData;\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaXNFbXB0eURhdGEuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaXNFbXB0eURhdGEudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBRUEsU0FBZ0IsV0FBVyxDQUFDLElBQWdCO0lBQzFDLElBQUksT0FBTyxJQUFJLEtBQUssUUFBUSxFQUFFO1FBQzVCLE9BQU8sSUFBSSxDQUFDLE1BQU0sS0FBSyxDQUFDLENBQUM7S0FDMUI7SUFFRCxPQUFPLElBQUksQ0FBQyxVQUFVLEtBQUssQ0FBQyxDQUFDO0FBQy9CLENBQUM7QUFORCxrQ0FNQyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IFNvdXJjZURhdGEgfSBmcm9tIFwiQGF3cy1zZGsvdHlwZXNcIjtcblxuZXhwb3J0IGZ1bmN0aW9uIGlzRW1wdHlEYXRhKGRhdGE6IFNvdXJjZURhdGEpOiBib29sZWFuIHtcbiAgaWYgKHR5cGVvZiBkYXRhID09PSBcInN0cmluZ1wiKSB7XG4gICAgcmV0dXJuIGRhdGEubGVuZ3RoID09PSAwO1xuICB9XG5cbiAgcmV0dXJuIGRhdGEuYnl0ZUxlbmd0aCA9PT0gMDtcbn1cbiJdfQ==","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Sha256 = void 0;\nvar util_1 = require(\"@aws-crypto/util\");\nvar constants_1 = require(\"./constants\");\nvar util_locate_window_1 = require(\"@aws-sdk/util-locate-window\");\nvar Sha256 = /** @class */ (function () {\n function Sha256(secret) {\n this.toHash = new Uint8Array(0);\n if (secret !== void 0) {\n this.key = new Promise(function (resolve, reject) {\n (0, util_locate_window_1.locateWindow)()\n .crypto.subtle.importKey(\"raw\", (0, util_1.convertToBuffer)(secret), constants_1.SHA_256_HMAC_ALGO, false, [\"sign\"])\n .then(resolve, reject);\n });\n this.key.catch(function () { });\n }\n }\n Sha256.prototype.update = function (data) {\n if ((0, util_1.isEmptyData)(data)) {\n return;\n }\n var update = (0, util_1.convertToBuffer)(data);\n var typedArray = new Uint8Array(this.toHash.byteLength + update.byteLength);\n typedArray.set(this.toHash, 0);\n typedArray.set(update, this.toHash.byteLength);\n this.toHash = typedArray;\n };\n Sha256.prototype.digest = function () {\n var _this = this;\n if (this.key) {\n return this.key.then(function (key) {\n return (0, util_locate_window_1.locateWindow)()\n .crypto.subtle.sign(constants_1.SHA_256_HMAC_ALGO, key, _this.toHash)\n .then(function (data) { return new Uint8Array(data); });\n });\n }\n if ((0, util_1.isEmptyData)(this.toHash)) {\n return Promise.resolve(constants_1.EMPTY_DATA_SHA_256);\n }\n return Promise.resolve()\n .then(function () {\n return (0, util_locate_window_1.locateWindow)().crypto.subtle.digest(constants_1.SHA_256_HASH, _this.toHash);\n })\n .then(function (data) { return Promise.resolve(new Uint8Array(data)); });\n };\n return Sha256;\n}());\nexports.Sha256 = Sha256;\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2ViQ3J5cHRvU2hhMjU2LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL3dlYkNyeXB0b1NoYTI1Ni50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFDQSx5Q0FBZ0U7QUFDaEUseUNBSXFCO0FBQ3JCLGtFQUEyRDtBQUUzRDtJQUlFLGdCQUFZLE1BQW1CO1FBRnZCLFdBQU0sR0FBZSxJQUFJLFVBQVUsQ0FBQyxDQUFDLENBQUMsQ0FBQztRQUc3QyxJQUFJLE1BQU0sS0FBSyxLQUFLLENBQUMsRUFBRTtZQUNyQixJQUFJLENBQUMsR0FBRyxHQUFHLElBQUksT0FBTyxDQUFDLFVBQUMsT0FBTyxFQUFFLE1BQU07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__esModule\", { value: true });\nexports.RawSha256 = void 0;\nvar constants_1 = require(\"./constants\");\n/**\n * @internal\n */\nvar RawSha256 = /** @class */ (function () {\n function RawSha256() {\n this.state = Int32Array.from(constants_1.INIT);\n this.temp = new Int32Array(64);\n this.buffer = new Uint8Array(64);\n this.bufferLength = 0;\n this.bytesHashed = 0;\n /**\n * @internal\n */\n this.finished = false;\n }\n RawSha256.prototype.update = function (data) {\n if (this.finished) {\n throw new Error(\"Attempted to update an already finished hash.\");\n }\n var position = 0;\n var byteLength = data.byteLength;\n this.bytesHashed += byteLength;\n if (this.bytesHashed * 8 > constants_1.MAX_HASHABLE_LENGTH) {\n throw new Error(\"Cannot hash more than 2^53 - 1 bits\");\n }\n while (byteLength > 0) {\n this.buffer[this.bufferLength++] = data[position++];\n byteLength--;\n if (this.bufferLength === constants_1.BLOCK_SIZE) {\n this.hashBuffer();\n this.bufferLength = 0;\n }\n }\n };\n RawSha256.prototype.digest = function () {\n if (!this.finished) {\n var bitsHashed = this.bytesHashed * 8;\n var bufferView = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);\n var undecoratedLength = this.bufferLength;\n bufferView.setUint8(this.bufferLength++, 0x80);\n // Ensure the final block has enough room for the hashed length\n if (undecoratedLength % constants_1.BLOCK_SIZE >= constants_1.BLOCK_SIZE - 8) {\n for (var i = this.bufferLength; i < constants_1.BLOCK_SIZE; i++) {\n bufferView.setUint8(i, 0);\n }\n this.hashBuffer();\n this.bufferLength = 0;\n }\n for (var i = this.bufferLength; i < constants_1.BLOCK_SIZE - 8; i++) {\n bufferView.setUint8(i, 0);\n }\n bufferView.setUint32(constants_1.BLOCK_SIZE - 8, Math.floor(bitsHashed / 0x100000000), true);\n bufferView.setUint32(constants_1.BLOCK_SIZE - 4, bitsHashed);\n this.hashBuffer();\n this.finished = true;\n }\n // The value in state is little-endian rather than big-endian, so flip\n // each word into a new Uint8Array\n var out = new Uint8Array(constants_1.DIGEST_LENGTH);\n for (var i = 0; i < 8; i++) {\n out[i * 4] = (this.state[i] >>> 24) & 0xff;\n out[i * 4 + 1] = (this.state[i] >>> 16) & 0xff;\n out[i * 4 + 2] = (this.state[i] >>> 8) & 0xff;\n out[i * 4 + 3] = (this.state[i] >>> 0) & 0xff;\n }\n return out;\n };\n RawSha256.prototype.hashBuffer = function () {\n var _a = this, buffer = _a.buffer, state = _a.state;\n var state0 = state[0], state1 = state[1], state2 = state[2], state3 = state[3], state4 = state[4], state5 = state[5], state6 = state[6], state7 = state[7];\n for (var i = 0; i < constants_1.BLOCK_SIZE; i++) {\n if (i < 16) {\n this.temp[i] =\n ((buffer[i * 4] & 0xff) << 24) |\n ((buffer[i * 4 + 1] & 0xff) << 16) |\n ((buffer[i * 4 + 2] & 0xff) << 8) |\n (buffer[i * 4 + 3] & 0xff);\n }\n else {\n var u = this.temp[i - 2];\n var t1_1 = ((u >>> 17) | (u << 15)) ^ ((u >>> 19) | (u << 13)) ^ (u >>> 10);\n u = this.temp[i - 15];\n var t2_1 = ((u >>> 7) | (u << 25)) ^ ((u >>> 18) | (u << 14)) ^ (u >>> 3);\n this.temp[i] =\n ((t1_1 + this.temp[i - 7]) | 0) + ((t2_1 + this.temp[i - 16]) | 0);\n }\n var t1 = ((((((state4 >>> 6) | (state4 << 26)) ^\n ((state4 >>> 11) | (state4 << 21)) ^\n ((state4 >>> 25) | (state4 << 7))) +\n ((state4 & state5) ^ (~state4 & state6))) |\n 0) +\n ((state7 + ((constants_1.KEY[i] + this.temp[i]) | 0)) | 0)) |\n 0;\n var t2 = ((((state0 >>> 2) | (state0 << 30)) ^\n ((state0 >>> 13) | (state0 << 19)) ^\n ((state0 >>> 22) | (state0 << 10))) +\n ((state0 & state1) ^ (state0 & state2) ^ (state1 & state2))) |\n 0;\n state7 = state6;\n state6 = state5;\n state5 = state4;\n state4 = (state3 + t1) | 0;\n state3 = state2;\n state2 = state1;\n state1 = state0;\n state0 = (t1 + t2) | 0;\n }\n state[0] += state0;\n state[1] += state1;\n state[2] += state2;\n state[3] += state3;\n state[4] += state4;\n state[5] += state5;\n state[6] += state6;\n state[7] += state7;\n };\n return RawSha256;\n}());\nexports.RawSha256 = RawSha256;\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUmF3U2hhMjU2LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL1Jhd1NoYTI1Ni50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSx5Q0FNcUI7QUFFckI7O0dBRUc7QUFDSDtJQUFBO1FBQ1UsVUFBSyxHQUFlLFVBQVUsQ0FBQyxJQUFJLENBQUMsZ0JBQUksQ0FBQyxDQUFDO1FBQzFDLFNBQUksR0FBZSxJQUFJLFVBQVUsQ0FBQyxFQUFFLENBQUMsQ0FBQztRQUN0QyxXQUFNLEdBQWUsSUFBSSxVQUFVLENBQUMsRUFBRSxDQUFDLENBQUM7UUFDeEMsaUJBQVksR0FBVyxDQUFDLENBQUM7UUFDekIsZ0JBQVcsR0FBVyxDQUFDLENBQUM7UUFFaEM7O1dBRUc7UUFDSCxhQUFRLEdBQVksS0FBSyxDQUFDO0lBOEk1QixDQUFDO0lBNUlDLDBCQUFNLEdBQU4sVUFBTyxJQUFnQjtRQUNyQixJQUFJLElBQUksQ0FBQyxRQUFRLEVBQUU7WUFDakIsTUFBTSxJQUFJLEtBQUssQ0FBQywrQ0FBK0MsQ0FBQyxDQUFDO1NBQ2xFO1FBRUQsSUFBSSxRQUFRLEdBQUcsQ0FBQyxDQUFDO1FBQ1gsSUFBQSxVQUFVLEdBQUssSUFBSSxXQUFULENBQVU7UUFDMUIsSUFBSSxDQUFDLFdBQVcsSUFBSSxVQUFVLENBQUM7UUFFL0IsSUFBSSxJQUFJLENBQUMsV0FBVyxHQUFHLENBQUMsR0FBRywrQkFBbUIsRUFBRTtZQUM5QyxNQUFNLElBQUksS0FBSyxDQUFDLHFDQUFxQyxDQUFDLENBQUM7U0FDe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ty(exports, \"__esModule\", { value: true });\nexports.MAX_HASHABLE_LENGTH = exports.INIT = exports.KEY = exports.DIGEST_LENGTH = exports.BLOCK_SIZE = void 0;\n/**\n * @internal\n */\nexports.BLOCK_SIZE = 64;\n/**\n * @internal\n */\nexports.DIGEST_LENGTH = 32;\n/**\n * @internal\n */\nexports.KEY = new Uint32Array([\n 0x428a2f98,\n 0x71374491,\n 0xb5c0fbcf,\n 0xe9b5dba5,\n 0x3956c25b,\n 0x59f111f1,\n 0x923f82a4,\n 0xab1c5ed5,\n 0xd807aa98,\n 0x12835b01,\n 0x243185be,\n 0x550c7dc3,\n 0x72be5d74,\n 0x80deb1fe,\n 0x9bdc06a7,\n 0xc19bf174,\n 0xe49b69c1,\n 0xefbe4786,\n 0x0fc19dc6,\n 0x240ca1cc,\n 0x2de92c6f,\n 0x4a7484aa,\n 0x5cb0a9dc,\n 0x76f988da,\n 0x983e5152,\n 0xa831c66d,\n 0xb00327c8,\n 0xbf597fc7,\n 0xc6e00bf3,\n 0xd5a79147,\n 0x06ca6351,\n 0x14292967,\n 0x27b70a85,\n 0x2e1b2138,\n 0x4d2c6dfc,\n 0x53380d13,\n 0x650a7354,\n 0x766a0abb,\n 0x81c2c92e,\n 0x92722c85,\n 0xa2bfe8a1,\n 0xa81a664b,\n 0xc24b8b70,\n 0xc76c51a3,\n 0xd192e819,\n 0xd6990624,\n 0xf40e3585,\n 0x106aa070,\n 0x19a4c116,\n 0x1e376c08,\n 0x2748774c,\n 0x34b0bcb5,\n 0x391c0cb3,\n 0x4ed8aa4a,\n 0x5b9cca4f,\n 0x682e6ff3,\n 0x748f82ee,\n 0x78a5636f,\n 0x84c87814,\n 0x8cc70208,\n 0x90befffa,\n 0xa4506ceb,\n 0xbef9a3f7,\n 0xc67178f2\n]);\n/**\n * @internal\n */\nexports.INIT = [\n 0x6a09e667,\n 0xbb67ae85,\n 0x3c6ef372,\n 0xa54ff53a,\n 0x510e527f,\n 0x9b05688c,\n 0x1f83d9ab,\n 0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MTc4ZjJcbl0pO1xuXG4vKipcbiAqIEBpbnRlcm5hbFxuICovXG5leHBvcnQgY29uc3QgSU5JVCA9IFtcbiAgMHg2YTA5ZTY2NyxcbiAgMHhiYjY3YWU4NSxcbiAgMHgzYzZlZjM3MixcbiAgMHhhNTRmZjUzYSxcbiAgMHg1MTBlNTI3ZixcbiAgMHg5YjA1Njg4YyxcbiAgMHgxZjgzZDlhYixcbiAgMHg1YmUwY2QxOVxuXTtcblxuLyoqXG4gKiBAaW50ZXJuYWxcbiAqL1xuZXhwb3J0IGNvbnN0IE1BWF9IQVNIQUJMRV9MRU5HVEggPSAyICoqIDUzIC0gMTtcbiJdfQ==","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = require(\"tslib\");\n(0, tslib_1.__exportStar)(require(\"./jsSha256\"), exports);\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsMERBQTJCIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0ICogZnJvbSBcIi4vanNTaGEyNTZcIjtcbiJdfQ==","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Sha256 = void 0;\nvar tslib_1 = require(\"tslib\");\nvar constants_1 = require(\"./constants\");\nvar RawSha256_1 = require(\"./RawSha256\");\nvar util_1 = require(\"@aws-crypto/util\");\nvar Sha256 = /** @class */ (function () {\n function Sha256(secret) {\n this.hash = new RawSha256_1.RawSha256();\n if (secret) {\n this.outer = new RawSha256_1.RawSha256();\n var inner = bufferFromSecret(secret);\n var outer = new Uint8Array(constants_1.BLOCK_SIZE);\n outer.set(inner);\n for (var i = 0; i < constants_1.BLOCK_SIZE; i++) {\n inner[i] ^= 0x36;\n outer[i] ^= 0x5c;\n }\n this.hash.update(inner);\n this.outer.update(outer);\n // overwrite the copied key in memory\n for (var i = 0; i < inner.byteLength; i++) {\n inner[i] = 0;\n }\n }\n }\n Sha256.prototype.update = function (toHash) {\n if ((0, util_1.isEmptyData)(toHash) || this.error) {\n return;\n }\n try {\n this.hash.update((0, util_1.convertToBuffer)(toHash));\n }\n catch (e) {\n this.error = e;\n }\n };\n /* This synchronous method keeps compatibility\n * with the v2 aws-sdk.\n */\n Sha256.prototype.digestSync = function () {\n if (this.error) {\n throw this.error;\n }\n if (this.outer) {\n if (!this.outer.finished) {\n this.outer.update(this.hash.digest());\n }\n return this.outer.digest();\n }\n return this.hash.digest();\n };\n /* The underlying digest method here is synchronous.\n * To keep the same interface with the other hash functions\n * the default is to expose this as an async method.\n * However, it can sometimes be useful to have a sync method.\n */\n Sha256.prototype.digest = function () {\n return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {\n return (0, tslib_1.__generator)(this, function (_a) {\n return [2 /*return*/, this.digestSync()];\n });\n });\n };\n return Sha256;\n}());\nexports.Sha256 = Sha256;\nfunction bufferFromSecret(secret) {\n var input = (0, util_1.convertToBuffer)(secret);\n if (input.byteLength > constants_1.BLOCK_SIZE) {\n var bufferHash = new RawSha256_1.RawSha256();\n bufferHash.update(input);\n input = bufferHash.digest();\n }\n var buffer = new Uint8Array(constants_1.BLOCK_SIZE);\n buffer.set(input);\n return buffer;\n}\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoianNTaGEyNTYuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvanNTaGEyNTYudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztBQUFBLHlDQUF5QztBQUN6Qyx5Q0FBd0M7QUFFeEMseUNBQWdFO0FBRWhFO0lBS0UsZ0JBQVksTUFBbUI7UUFKZCxTQUFJLEdBQUcsSUFBSSxxQkFBUyxFQUFFLENBQUM7UUFLdEMsSUFBSSxNQUFNLEVBQUU7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gICAgcmV0dXJuIHRoaXMuaGFzaC5kaWdlc3QoKTtcbiAgfVxuXG4gIC8qIFRoZSB1bmRlcmx5aW5nIGRpZ2VzdCBtZXRob2QgaGVyZSBpcyBzeW5jaHJvbm91cy5cbiAgICogVG8ga2VlcCB0aGUgc2FtZSBpbnRlcmZhY2Ugd2l0aCB0aGUgb3RoZXIgaGFzaCBmdW5jdGlvbnNcbiAgICogdGhlIGRlZmF1bHQgaXMgdG8gZXhwb3NlIHRoaXMgYXMgYW4gYXN5bmMgbWV0aG9kLlxuICAgKiBIb3dldmVyLCBpdCBjYW4gc29tZXRpbWVzIGJlIHVzZWZ1bCB0byBoYXZlIGEgc3luYyBtZXRob2QuXG4gICAqL1xuICBhc3luYyBkaWdlc3QoKTogUHJvbWlzZTxVaW50OEFycmF5PiB7XG4gICAgcmV0dXJuIHRoaXMuZGlnZXN0U3luYygpO1xuICB9XG59XG5cbmZ1bmN0aW9uIGJ1ZmZlckZyb21TZWNyZXQoc2VjcmV0OiBTb3VyY2VEYXRhKTogVWludDhBcnJheSB7XG4gIGxldCBpbnB1dCA9IGNvbnZlcnRUb0J1ZmZlcihzZWNyZXQpO1xuXG4gIGlmIChpbnB1dC5ieXRlTGVuZ3RoID4gQkxPQ0tfU0laRSkge1xuICAgIGNvbnN0IGJ1ZmZlckhhc2ggPSBuZXcgUmF3U2hhMjU2KCk7XG4gICAgYnVmZmVySGFzaC51cGRhdGUoaW5wdXQpO1xuICAgIGlucHV0ID0gYnVmZmVySGFzaC5kaWdlc3QoKTtcbiAgfVxuXG4gIGNvbnN0IGJ1ZmZlciA9IG5ldyBVaW50OEFycmF5KEJMT0NLX1NJWkUpO1xuICBidWZmZXIuc2V0KGlucHV0KTtcbiAgcmV0dXJuIGJ1ZmZlcjtcbn1cbiJdfQ==","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = require(\"tslib\");\ntslib_1.__exportStar(require(\"./supportsWebCrypto\"), exports);\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsOERBQW9DIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0ICogZnJvbSBcIi4vc3VwcG9ydHNXZWJDcnlwdG9cIjtcbiJdfQ==","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.supportsZeroByteGCM = exports.supportsSubtleCrypto = exports.supportsSecureRandom = exports.supportsWebCrypto = void 0;\nvar tslib_1 = require(\"tslib\");\nvar subtleCryptoMethods = [\n \"decrypt\",\n \"digest\",\n \"encrypt\",\n \"exportKey\",\n \"generateKey\",\n \"importKey\",\n \"sign\",\n \"verify\"\n];\nfunction supportsWebCrypto(window) {\n if (supportsSecureRandom(window) &&\n typeof window.crypto.subtle === \"object\") {\n var subtle = window.crypto.subtle;\n return supportsSubtleCrypto(subtle);\n }\n return false;\n}\nexports.supportsWebCrypto = supportsWebCrypto;\nfunction supportsSecureRandom(window) {\n if (typeof window === \"object\" && typeof window.crypto === \"object\") {\n var getRandomValues = window.crypto.getRandomValues;\n return typeof getRandomValues === \"function\";\n }\n return false;\n}\nexports.supportsSecureRandom = supportsSecureRandom;\nfunction supportsSubtleCrypto(subtle) {\n return (subtle &&\n subtleCryptoMethods.every(function (methodName) { return typeof subtle[methodName] === \"function\"; }));\n}\nexports.supportsSubtleCrypto = supportsSubtleCrypto;\nfunction supportsZeroByteGCM(subtle) {\n return tslib_1.__awaiter(this, void 0, void 0, function () {\n var key, zeroByteAuthTag, _a;\n return tslib_1.__generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (!supportsSubtleCrypto(subtle))\n return [2 /*return*/, false];\n _b.label = 1;\n case 1:\n _b.trys.push([1, 4, , 5]);\n return [4 /*yield*/, subtle.generateKey({ name: \"AES-GCM\", length: 128 }, false, [\"encrypt\"])];\n case 2:\n key = _b.sent();\n return [4 /*yield*/, subtle.encrypt({\n name: \"AES-GCM\",\n iv: new Uint8Array(Array(12)),\n additionalData: new Uint8Array(Array(16)),\n tagLength: 128\n }, key, new Uint8Array(0))];\n case 3:\n zeroByteAuthTag = _b.sent();\n return [2 /*return*/, zeroByteAuthTag.byteLength === 16];\n case 4:\n _a = _b.sent();\n return [2 /*return*/, false];\n case 5: return [2 /*return*/];\n }\n });\n });\n}\nexports.supportsZeroByteGCM = supportsZeroByteGCM;\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3VwcG9ydHNXZWJDcnlwdG8uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvc3VwcG9ydHNXZWJDcnlwdG8udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztBQVVBLElBQU0sbUJBQW1CLEdBQThCO0lBQ3JELFNBQVM7SUFDVCxRQUFRO0lBQ1IsU0FBUztJQUNULFdBQVc7SUFDWCxhQUFhO0lBQ2IsV0FBVztJQUNYLE1BQU07SUFDTixRQUFRO0NBQ1QsQ0FBQztBQUVGLFNBQWdCLGlCQUFpQixDQUFDLE1BQWM7SUFDOUMsSUFDRSxvQkFBb0IsQ0FBQyxNQUFNLENBQUM7UUFDNUIsT0FBTyxNQUFNLENBQUMsTUFBTSxDQUFDLE1BQU0sS0FBSyxRQUFRLEVBQ3hDO1FBQ1EsSUFBQSxNQUFNLEdBQUssTUFBTSxDQUFDLE1BQU0sT0FBbEIsQ0FBbUI7UUFFakMsT0FBTyxvQkFBb0IsQ0FBQyxNQUFNLENBQUMsQ0FBQztLQUNyQztJQUVELE9BQU8sS0FBSyxDQUFDO0FBQ2YsQ0FBQztBQVhELDhDQVdDO0FBRUQsU0FBZ0Isb0JBQW9CLENBQUMsTUFBYztJQUNqRCxJQUFJLE9BQU8sTUFBTSxLQUFLLFFBQVEsSUFBSSxPQUFPLE1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ICAgICAge1xuICAgICAgICBuYW1lOiBcIkFFUy1HQ01cIixcbiAgICAgICAgaXY6IG5ldyBVaW50OEFycmF5KEFycmF5KDEyKSksXG4gICAgICAgIGFkZGl0aW9uYWxEYXRhOiBuZXcgVWludDhBcnJheShBcnJheSgxNikpLFxuICAgICAgICB0YWdMZW5ndGg6IDEyOFxuICAgICAgfSxcbiAgICAgIGtleSxcbiAgICAgIG5ldyBVaW50OEFycmF5KDApXG4gICAgKTtcbiAgICByZXR1cm4gemVyb0J5dGVBdXRoVGFnLmJ5dGVMZW5ndGggPT09IDE2O1xuICB9IGNhdGNoIHtcbiAgICByZXR1cm4gZmFsc2U7XG4gIH1cbn1cbiJdfQ==","\"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.convertToBuffer = void 0;\nvar util_utf8_browser_1 = require(\"@aws-sdk/util-utf8-browser\");\n// Quick polyfill\nvar fromUtf8 = typeof Buffer !== \"undefined\" && Buffer.from\n ? function (input) { return Buffer.from(input, \"utf8\"); }\n : util_utf8_browser_1.fromUtf8;\nfunction convertToBuffer(data) {\n // Already a Uint8, do nothing\n if (data instanceof Uint8Array)\n return data;\n if (typeof data === \"string\") {\n return fromUtf8(data);\n }\n if (ArrayBuffer.isView(data)) {\n return new Uint8Array(data.buffer, data.byteOffset, data.byteLength / Uint8Array.BYTES_PER_ELEMENT);\n }\n return new Uint8Array(data);\n}\nexports.convertToBuffer = convertToBuffer;\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udmVydFRvQnVmZmVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2NvbnZlcnRUb0J1ZmZlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsb0VBQW9FO0FBQ3BFLHNDQUFzQzs7O0FBR3RDLGdFQUF5RT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cm93c2VyIH0gZnJvbSBcIkBhd3Mtc2RrL3V0aWwtdXRmOC1icm93c2VyXCI7XG5cbi8vIFF1aWNrIHBvbHlmaWxsXG5jb25zdCBmcm9tVXRmOCA9XG4gIHR5cGVvZiBCdWZmZXIgIT09IFwidW5kZWZpbmVkXCIgJiYgQnVmZmVyLmZyb21cbiAgICA/IChpbnB1dDogc3RyaW5nKSA9PiBCdWZmZXIuZnJvbShpbnB1dCwgXCJ1dGY4XCIpXG4gICAgOiBmcm9tVXRmOEJyb3dzZXI7XG5cbmV4cG9ydCBmdW5jdGlvbiBjb252ZXJ0VG9CdWZmZXIoZGF0YTogU291cmNlRGF0YSk6IFVpbnQ4QXJyYXkge1xuICAvLyBBbHJlYWR5IGEgVWludDgsIGRvIG5vdGhpbmdcbiAgaWYgKGRhdGEgaW5zdGFuY2VvZiBVaW50OEFycmF5KSByZXR1cm4gZGF0YTtcblxuICBpZiAodHlwZW9mIGRhdGEgPT09IFwic3RyaW5nXCIpIHtcbiAgICByZXR1cm4gZnJvbVV0ZjgoZGF0YSk7XG4gIH1cblxuICBpZiAoQXJyYXlCdWZmZXIuaXNWaWV3KGRhdGEpKSB7XG4gICAgcmV0dXJuIG5ldyBVaW50OEFycmF5KFxuICAgICAgZGF0YS5idWZmZXIsXG4gICAgICBkYXRhLmJ5dGVPZmZzZXQsXG4gICAgICBkYXRhLmJ5dGVMZW5ndGggLyBVaW50OEFycmF5LkJZVEVTX1BFUl9FTEVNRU5UXG4gICAgKTtcbiAgfVxuXG4gIHJldHVybiBuZXcgVWludDhBcnJheShkYXRhKTtcbn1cbiJdfQ==","\"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.uint32ArrayFrom = exports.numToUint8 = exports.isEmptyData = exports.convertToBuffer = void 0;\nvar convertToBuffer_1 = require(\"./convertToBuffer\");\nObject.defineProperty(exports, \"convertToBuffer\", { enumerable: true, get: function () { return convertToBuffer_1.convertToBuffer; } });\nvar isEmptyData_1 = require(\"./isEmptyData\");\nObject.defineProperty(exports, \"isEmptyData\", { enumerable: true, get: function () { return isEmptyData_1.isEmptyData; } });\nvar numToUint8_1 = require(\"./numToUint8\");\nObject.defineProperty(exports, \"numToUint8\", { enumerable: true, get: function () { return numToUint8_1.numToUint8; } });\nvar uint32ArrayFrom_1 = require(\"./uint32ArrayFrom\");\nObject.defineProperty(exports, \"uint32ArrayFrom\", { enumerable: true, get: function () { return uint32ArrayFrom_1.uint32ArrayFrom; } });\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLG9FQUFvRTtBQUNwRSxzQ0FBc0M7OztBQUV0QyxxREFBb0Q7QUFBM0Msa0hBQUEsZUFBZSxPQUFBO0FBQ3hCLDZDQUE0QztBQUFuQywwR0FBQSxXQUFXLE9BQUE7QUFDcEIsMkNBQTBDO0FBQWpDLHdHQUFBLFVBQVUsT0FBQTtBQUNuQixxREFBa0Q7QUFBMUMsa0hBQUEsZUFBZSxPQUFBIiwic291cmNlc0NvbnRlbnQiOlsiLy8gQ29weXJpZ2h0IEFtYXpvbi5jb20gSW5jLiBvciBpdHMgYWZmaWxpYXRlcy4gQWxsIFJpZ2h0cyBSZXNlcnZlZC5cbi8vIFNQRFgtTGljZW5zZS1JZGVudGlmaWVyOiBBcGFjaGUtMi4wXG5cbmV4cG9ydCB7IGNvbnZlcnRUb0J1ZmZlciB9IGZyb20gXCIuL2NvbnZlcnRUb0J1ZmZlclwiO1xuZXhwb3J0IHsgaXNFbXB0eURhdGEgfSBmcm9tIFwiLi9pc0VtcHR5RGF0YVwiO1xuZXhwb3J0IHsgbnVtVG9VaW50OCB9IGZyb20gXCIuL251bVRvVWludDhcIjtcbmV4cG9ydCB7dWludDMyQXJyYXlGcm9tfSBmcm9tICcuL3VpbnQzMkFycmF5RnJvbSc7XG4iXX0=","\"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.isEmptyData = void 0;\nfunction isEmptyData(data) {\n if (typeof data === \"string\") {\n return data.length === 0;\n }\n return data.byteLength === 0;\n}\nexports.isEmptyData = isEmptyData;\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaXNFbXB0eURhdGEuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaXNFbXB0eURhdGEudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLG9FQUFvRTtBQUNwRSxzQ0FBc0M7OztBQUl0QyxTQUFnQixXQUFXLENBQUMsSUFBZ0I7SUFDMUMsSUFBSSxPQUFPLElBQUksS0FBSyxRQUFRLEVBQUU7UUFDNUIsT0FBTyxJQUFJLENBQUMsTUFBTSxLQUFLLENBQUMsQ0FBQztLQUMxQjtJQUVELE9BQU8sSUFBSSxDQUFDLFVBQVUsS0FBSyxDQUFDLENBQUM7QUFDL0IsQ0FBQztBQU5ELGtDQU1DIiwic291cmNlc0NvbnRlbnQiOlsiLy8gQ29weXJpZ2h0IEFtYXpvbi5jb20gSW5jLiBvciBpdHMgYWZmaWxpYXRlcy4gQWxsIFJpZ2h0cyBSZXNlcnZlZC5cbi8vIFNQRFgtTGljZW5zZS1JZGVudGlmaWVyOiBBcGFjaGUtMi4wXG5cbmltcG9ydCB7IFNvdXJjZURhdGEgfSBmcm9tIFwiQGF3cy1zZGsvdHlwZXNcIjtcblxuZXhwb3J0IGZ1bmN0aW9uIGlzRW1wdHlEYXRhKGRhdGE6IFNvdXJjZURhdGEpOiBib29sZWFuIHtcbiAgaWYgKHR5cGVvZiBkYXRhID09PSBcInN0cmluZ1wiKSB7XG4gICAgcmV0dXJuIGRhdGEubGVuZ3RoID09PSAwO1xuICB9XG5cbiAgcmV0dXJuIGRhdGEuYnl0ZUxlbmd0aCA9PT0gMDtcbn1cbiJdfQ==","\"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.numToUint8 = void 0;\nfunction numToUint8(num) {\n return new Uint8Array([\n (num & 0xff000000) >> 24,\n (num & 0x00ff0000) >> 16,\n (num & 0x0000ff00) >> 8,\n num & 0x000000ff,\n ]);\n}\nexports.numToUint8 = numToUint8;\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnVtVG9VaW50OC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9udW1Ub1VpbnQ4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxvRUFBb0U7QUFDcEUsc0NBQXNDOzs7QUFFdEMsU0FBZ0IsVUFBVSxDQUFDLEdBQVc7SUFDcEMsT0FBTyxJQUFJLFVBQVUsQ0FBQztRQUNwQixDQUFDLEdBQUcsR0FBRyxVQUFVLENBQUMsSUFBSSxFQUFFO1FBQ3hCLENBQUMsR0FBRyxHQUFHLFVBQVUsQ0FBQyxJQUFJLEVBQUU7UUFDeEIsQ0FBQyxHQUFHLEdBQUcsVUFBVSxDQUFDLElBQUksQ0FBQztRQUN2QixHQUFHLEdBQUcsVUFBVTtLQUNqQixDQUFDLENBQUM7QUFDTCxDQUFDO0FBUEQsZ0NBT0MiLCJzb3VyY2VzQ29udGVudCI6WyIvLyBDb3B5cmlnaHQgQW1hem9uLmNvbSBJbmMuIG9yIGl0cyBhZmZpbGlhdGVzLiBBbGwgUmlnaHRzIFJlc2VydmVkLlxuLy8gU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IEFwYWNoZS0yLjBcblxuZXhwb3J0IGZ1bmN0aW9uIG51bVRvVWludDgobnVtOiBudW1iZXIpIHtcbiAgcmV0dXJuIG5ldyBVaW50OEFycmF5KFtcbiAgICAobnVtICYgMHhmZjAwMDAwMCkgPj4gMjQsXG4gICAgKG51bSAmIDB4MDBmZjAwMDApID4+IDE2LFxuICAgIChudW0gJiAweDAwMDBmZjAwKSA+PiA4LFxuICAgIG51bSAmIDB4MDAwMDAwZmYsXG4gIF0pO1xufVxuIl19","\"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.uint32ArrayFrom = void 0;\n// IE 11 does not support Array.from, so we do it manually\nfunction uint32ArrayFrom(a_lookUpTable) {\n if (!Array.from) {\n var return_array = new Uint32Array(a_lookUpTable.length);\n var a_index = 0;\n while (a_index < a_lookUpTable.length) {\n return_array[a_index] = a_lookUpTable[a_index];\n }\n return return_array;\n }\n return Uint32Array.from(a_lookUpTable);\n}\nexports.uint32ArrayFrom = uint32ArrayFrom;\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidWludDMyQXJyYXlGcm9tLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL3VpbnQzMkFycmF5RnJvbS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsb0VBQW9FO0FBQ3BFLHNDQUFzQzs7O0FBRXRDLDBEQUEwRDtBQUMxRCxTQUFnQixlQUFlLENBQUMsYUFBNEI7SUFDMUQsSUFBSSxDQUFDLEtBQUssQ0FBQyxJQUFJLEVBQUU7UUFDZixJQUFNLFlBQVksR0FBRyxJQUFJLFdBQVcsQ0FBQyxhQUFhLENBQUMsTUFBTSxDQUFDLENBQUE7UUFDMUQsSUFBSSxPQUFPLEdBQUcsQ0FBQyxDQUFBO1FBQ2YsT0FBTyxPQUFPLEdBQUcsYUFBYSxDQUFDLE1BQU0sRUFBRTtZQUNyQyxZQUFZLENBQUMsT0FBTyxDQUFDLEdBQUcsYUFBYSxDQUFDLE9BQU8sQ0FBQyxDQUFBO1NBQy9DO1FBQ0QsT0FBTyxZQUFZLENBQUE7S0FDcEI7SUFDRCxPQUFPLFdBQVcsQ0FBQyxJQUFJLENBQUMsYUFBYSxDQUFDLENBQUE7QUFDeEMsQ0FBQztBQVZELDBDQVVDIiwic291cmNlc0NvbnRlbnQiOlsiLy8gQ29weXJpZ2h0IEFtYXpvbi5jb20gSW5jLiBvciBpdHMgYWZmaWxpYXRlcy4gQWxsIFJpZ2h0cyBSZXNlcnZlZC5cbi8vIFNQRFgtTGljZW5zZS1JZGVudGlmaWVyOiBBcGFjaGUtMi4wXG5cbi8vIElFIDExIGRvZXMgbm90IHN1cHBvcnQgQXJyYXkuZnJvbSwgc28gd2UgZG8gaXQgbWFudWFsbHlcbmV4cG9ydCBmdW5jdGlvbiB1aW50MzJBcnJheUZyb20oYV9sb29rVXBUYWJsZTogQXJyYXk8bnVtYmVyPik6IFVpbnQzMkFycmF5IHtcbiAgaWYgKCFBcnJheS5mcm9tKSB7XG4gICAgY29uc3QgcmV0dXJuX2FycmF5ID0gbmV3IFVpbnQzMkFycmF5KGFfbG9va1VwVGFibGUubGVuZ3RoKVxuICAgIGxldCBhX2luZGV4ID0gMFxuICAgIHdoaWxlIChhX2luZGV4IDwgYV9sb29rVXBUYWJsZS5sZW5ndGgpIHtcbiAgICAgIHJldHVybl9hcnJheVthX2luZGV4XSA9IGFfbG9va1VwVGFibGVbYV9pbmRleF1cbiAgICB9XG4gICAgcmV0dXJuIHJldHVybl9hcnJheVxuICB9XG4gIHJldHVybiBVaW50MzJBcnJheS5mcm9tKGFfbG9va1VwVGFibGUpXG59XG4iXX0=","import { fromUtf8 as jsFromUtf8, toUtf8 as jsToUtf8 } from \"./pureJs\";\nimport { fromUtf8 as textEncoderFromUtf8, toUtf8 as textEncoderToUtf8 } from \"./whatwgEncodingApi\";\nexport var fromUtf8 = function (input) {\n return typeof TextEncoder === \"function\" ? textEncoderFromUtf8(input) : jsFromUtf8(input);\n};\nexport var toUtf8 = function (input) {\n return typeof TextDecoder === \"function\" ? textEncoderToUtf8(input) : jsToUtf8(input);\n};\n","export function fromUtf8(input) {\n return new TextEncoder().encode(input);\n}\nexport function toUtf8(input) {\n return new TextDecoder(\"utf-8\").decode(input);\n}\n","export var fromUtf8 = function (input) {\n var bytes = [];\n for (var i = 0, len = input.length; i < len; i++) {\n var value = input.charCodeAt(i);\n if (value < 0x80) {\n bytes.push(value);\n }\n else if (value < 0x800) {\n bytes.push((value >> 6) | 192, (value & 63) | 128);\n }\n else if (i + 1 < input.length && (value & 0xfc00) === 0xd800 && (input.charCodeAt(i + 1) & 0xfc00) === 0xdc00) {\n var surrogatePair = 0x10000 + ((value & 1023) << 10) + (input.charCodeAt(++i) & 1023);\n bytes.push((surrogatePair >> 18) | 240, ((surrogatePair >> 12) & 63) | 128, ((surrogatePair >> 6) & 63) | 128, (surrogatePair & 63) | 128);\n }\n else {\n bytes.push((value >> 12) | 224, ((value >> 6) & 63) | 128, (value & 63) | 128);\n }\n }\n return Uint8Array.from(bytes);\n};\nexport var toUtf8 = function (input) {\n var decoded = \"\";\n for (var i = 0, len = input.length; i < len; i++) {\n var byte = input[i];\n if (byte < 0x80) {\n decoded += String.fromCharCode(byte);\n }\n else if (192 <= byte && byte < 224) {\n var nextByte = input[++i];\n decoded += String.fromCharCode(((byte & 31) << 6) | (nextByte & 63));\n }\n else if (240 <= byte && byte < 365) {\n var surrogatePair = [byte, input[++i], input[++i], input[++i]];\n var encoded = \"%\" + surrogatePair.map(function (byteValue) { return byteValue.toString(16); }).join(\"%\");\n decoded += decodeURIComponent(encoded);\n }\n else {\n decoded += String.fromCharCode(((byte & 15) << 12) | ((input[++i] & 63) << 6) | (input[++i] & 63));\n }\n }\n return decoded;\n};\n","var fallbackWindow = {};\nexport function locateWindow() {\n if (typeof window !== \"undefined\") {\n return window;\n }\n else if (typeof self !== \"undefined\") {\n return self;\n }\n return fallbackWindow;\n}\n","import { fromUtf8 as jsFromUtf8, toUtf8 as jsToUtf8 } from \"./pureJs\";\nimport { fromUtf8 as textEncoderFromUtf8, toUtf8 as textEncoderToUtf8 } from \"./whatwgEncodingApi\";\nexport var fromUtf8 = function (input) {\n return typeof TextEncoder === \"function\" ? textEncoderFromUtf8(input) : jsFromUtf8(input);\n};\nexport var toUtf8 = function (input) {\n return typeof TextDecoder === \"function\" ? textEncoderToUtf8(input) : jsToUtf8(input);\n};\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFFBQVEsSUFBSSxVQUFVLEVBQUUsTUFBTSxJQUFJLFFBQVEsRUFBRSxNQUFNLFVBQVUsQ0FBQztBQUN0RSxPQUFPLEVBQUUsUUFBUSxJQUFJLG1CQUFtQixFQUFFLE1BQU0sSUFBSSxpQkFBaUIsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBS25HLE1BQU0sQ0FBQyxJQUFNLFFBQVEsR0FBRyxVQUFDLEtBQWE7SUFDcEMsT0FBQSxPQUFPLFdBQVcsS0FBSyxVQUFVLENBQUMsQ0FBQyxDQUFDLG1CQUFtQixDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUMsQ0FBQyxVQUFVLENBQUMsS0FBSyxDQUFDO0FBQWxGLENBQWtGLENBQUM7QUFFckYsTUFBTSxDQUFDLElBQU0sTUFBTSxHQUFHLFVBQUMsS0FBaUI7SUFDdEMsT0FBQSxPQUFPLFdBQVcsS0FBSyxVQUFVLENBQUMsQ0FBQyxDQUFDLGlCQUFpQixDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUMsQ0FBQyxRQUFRLENBQUMsS0FBSyxDQUFDO0FBQTlFLENBQThFLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBmcm9tVXRmOCBhcyBqc0Zyb21VdGY4LCB0b1V0ZjggYXMganNUb1V0ZjggfSBmcm9tIFwiLi9wdXJlSnNcIjtcbmltcG9ydCB7IGZyb21VdGY4IGFzIHRleHRFbmNvZGVyRnJvbVV0ZjgsIHRvVXRmOCBhcyB0ZXh0RW5jb2RlclRvVXRmOCB9IGZyb20gXCIuL3doYXR3Z0VuY29kaW5nQXBpXCI7XG5cbmRlY2xhcmUgY29uc3QgVGV4dERlY29kZXI6IEZ1bmN0aW9uIHwgdW5kZWZpbmVkO1xuZGVjbGFyZSBjb25zdCBUZXh0RW5jb2RlcjogRnVuY3Rpb24gfCB1bmRlZmluZWQ7XG5cbmV4cG9ydCBjb25zdCBmcm9tVXRmOCA9IChpbnB1dDogc3RyaW5nKTogVWludDhBcnJheSA9PlxuICB0eXBlb2YgVGV4dEVuY29kZXIgPT09IFwiZnVuY3Rpb25cIiA/IHRleHRFbmNvZGVyRnJvbVV0ZjgoaW5wdXQpIDoganNGcm9tVXRmOChpbnB1dCk7XG5cbmV4cG9ydCBjb25zdCB0b1V0ZjggPSAoaW5wdXQ6IFVpbnQ4QXJyYXkpOiBzdHJpbmcgPT5cbiAgdHlwZW9mIFRleHREZWNvZGVyID09PSBcImZ1bmN0aW9uXCIgPyB0ZXh0RW5jb2RlclRvVXRmOChpbnB1dCkgOiBqc1RvVXRmOChpbnB1dCk7XG4iXX0=","export function fromUtf8(input) {\n return new TextEncoder().encode(input);\n}\nexport function toUtf8(input) {\n return new TextDecoder(\"utf-8\").decode(input);\n}\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2hhdHdnRW5jb2RpbmdBcGkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvd2hhdHdnRW5jb2RpbmdBcGkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5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gfVxuXG4gIGV4cG9ydCBpbnRlcmZhY2UgVGV4dERlY29kZXJDb25zdHJ1Y3RvciB7XG4gICAgbmV3IChsYWJlbD86IHN0cmluZywgb3B0aW9ucz86IFRleHREZWNvZGVyT3B0aW9ucyk6IFRleHREZWNvZGVyO1xuICB9XG5cbiAgaW50ZXJmYWNlIFRleHRFbmNvZGVyIHtcbiAgICByZWFkb25seSBlbmNvZGluZzogXCJ1dGYtOFwiO1xuICAgIGVuY29kZShpbnB1dD86IHN0cmluZyk6IFVpbnQ4QXJyYXk7XG4gIH1cblxuICBleHBvcnQgaW50ZXJmYWNlIFRleHRFbmNvZGVyQ29uc3RydWN0b3Ige1xuICAgIG5ldyAoKTogVGV4dEVuY29kZXI7XG4gIH1cbn1cblxuZGVjbGFyZSBjb25zdCBUZXh0RGVjb2RlcjogRW5jb2RpbmcuVGV4dERlY29kZXJDb25zdHJ1Y3RvcjtcblxuZGVjbGFyZSBjb25zdCBUZXh0RW5jb2RlcjogRW5jb2RpbmcuVGV4dEVuY29kZXJDb25zdHJ1Y3RvcjtcblxuZXhwb3J0IGZ1bmN0aW9uIGZyb21VdGY4KGlucHV0OiBzdHJpbmcpOiBVaW50OEFycmF5IHtcbiAgcmV0dXJuIG5ldyBUZXh0RW5jb2RlcigpLmVuY29kZShpbnB1dCk7XG59XG5cbmV4cG9ydCBmdW5jdGlvbiB0b1V0ZjgoaW5wdXQ6IFVpbnQ4QXJyYXkpOiBzdHJpbmcge1xuICByZXR1cm4gbmV3IFRleHREZWNvZGVyKFwidXRmLThcIikuZGVjb2RlKGlucHV0KTtcbn1cbiJdfQ==","/**\n * Converts a JS string from its native UCS-2/UTF-16 representation into a\n * Uint8Array of the bytes used to represent the equivalent characters in UTF-8.\n *\n * Cribbed from the `goog.crypt.stringToUtf8ByteArray` function in the Google\n * Closure library, though updated to use typed arrays.\n */\nexport var fromUtf8 = function (input) {\n var bytes = [];\n for (var i = 0, len = input.length; i < len; i++) {\n var value = input.charCodeAt(i);\n if (value < 0x80) {\n bytes.push(value);\n }\n else if (value < 0x800) {\n bytes.push((value >> 6) | 192, (value & 63) | 128);\n }\n else if (i + 1 < input.length && (value & 0xfc00) === 0xd800 && (input.charCodeAt(i + 1) & 0xfc00) === 0xdc00) {\n var surrogatePair = 0x10000 + ((value & 1023) << 10) + (input.charCodeAt(++i) & 1023);\n bytes.push((surrogatePair >> 18) | 240, ((surrogatePair >> 12) & 63) | 128, ((surrogatePair >> 6) & 63) | 128, (surrogatePair & 63) | 128);\n }\n else {\n bytes.push((value >> 12) | 224, ((value >> 6) & 63) | 128, (value & 63) | 128);\n }\n }\n return Uint8Array.from(bytes);\n};\n/**\n * Converts a typed array of bytes containing UTF-8 data into a native JS\n * string.\n *\n * Partly cribbed from the `goog.crypt.utf8ByteArrayToString` function in the\n * Google Closure library, though updated to use typed arrays and to better\n * handle astral plane code points.\n */\nexport var toUtf8 = function (input) {\n var decoded = \"\";\n for (var i = 0, len = input.length; i < len; i++) {\n var byte = input[i];\n if (byte < 0x80) {\n decoded += String.fromCharCode(byte);\n }\n else if (192 <= byte && byte < 224) {\n var nextByte = input[++i];\n decoded += String.fromCharCode(((byte & 31) << 6) | (nextByte & 63));\n }\n else if (240 <= byte && byte < 365) {\n var surrogatePair = [byte, input[++i], input[++i], input[++i]];\n var encoded = \"%\" + surrogatePair.map(function (byteValue) { return byteValue.toString(16); }).join(\"%\");\n decoded += decodeURIComponent(encoded);\n }\n else {\n decoded += String.fromCharCode(((byte & 15) << 12) | ((input[++i] & 63) << 6) | (input[++i] & 63));\n }\n }\n return decoded;\n};\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVyZUpzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3B1cmVKcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7QUFDSCxNQUFNLENBQUMsSUFBTSxRQUFRLEdBQUc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cuZnJvbUNoYXJDb2RlKFxuICAgICAgICAoKGJ5dGUgJiAwYjExMTEpIDw8IDEyKSB8ICgoaW5wdXRbKytpXSAmIDBiMTExMTExKSA8PCA2KSB8IChpbnB1dFsrK2ldICYgMGIxMTExMTEpXG4gICAgICApO1xuICAgIH1cbiAgfVxuXG4gIHJldHVybiBkZWNvZGVkO1xufTtcbiJdfQ==","'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n","!function(e,t){\"object\"==typeof exports&&\"object\"==typeof module?module.exports=t():\"function\"==typeof define&&define.amd?define([],t):\"object\"==typeof exports?exports.bowser=t():e.bowser=t()}(this,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){\"undefined\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(e,\"__esModule\",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&\"object\"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,\"default\",{enumerable:!0,value:e}),2&t&&\"string\"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,\"a\",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p=\"\",r(r.s=90)}({17:function(e,t,r){\"use strict\";t.__esModule=!0,t.default=void 0;var n=r(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var r=t.match(e);return r&&r.length>0&&r[1]||\"\"},e.getSecondMatch=function(e,t){var r=t.match(e);return r&&r.length>1&&r[2]||\"\"},e.matchAndReturnConst=function(e,t,r){if(e.test(t))return r},e.getWindowsVersionName=function(e){switch(e){case\"NT\":return\"NT\";case\"XP\":return\"XP\";case\"NT 5.0\":return\"2000\";case\"NT 5.1\":return\"XP\";case\"NT 5.2\":return\"2003\";case\"NT 6.0\":return\"Vista\";case\"NT 6.1\":return\"7\";case\"NT 6.2\":return\"8\";case\"NT 6.3\":return\"8.1\";case\"NT 10.0\":return\"10\";default:return}},e.getMacOSVersionName=function(e){var t=e.split(\".\").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return\"Leopard\";case 6:return\"Snow Leopard\";case 7:return\"Lion\";case 8:return\"Mountain Lion\";case 9:return\"Mavericks\";case 10:return\"Yosemite\";case 11:return\"El Capitan\";case 12:return\"Sierra\";case 13:return\"High Sierra\";case 14:return\"Mojave\";case 15:return\"Catalina\";default:return}},e.getAndroidVersionName=function(e){var t=e.split(\".\").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?\"Cupcake\":1===t[0]&&t[1]>=6?\"Donut\":2===t[0]&&t[1]<2?\"Eclair\":2===t[0]&&2===t[1]?\"Froyo\":2===t[0]&&t[1]>2?\"Gingerbread\":3===t[0]?\"Honeycomb\":4===t[0]&&t[1]<1?\"Ice Cream Sandwich\":4===t[0]&&t[1]<4?\"Jelly Bean\":4===t[0]&&t[1]>=4?\"KitKat\":5===t[0]?\"Lollipop\":6===t[0]?\"Marshmallow\":7===t[0]?\"Nougat\":8===t[0]?\"Oreo\":9===t[0]?\"Pie\":void 0},e.getVersionPrecision=function(e){return e.split(\".\").length},e.compareVersions=function(t,r,n){void 0===n&&(n=!1);var i=e.getVersionPrecision(t),s=e.getVersionPrecision(r),a=Math.max(i,s),o=0,u=e.map([t,r],(function(t){var r=a-e.getVersionPrecision(t),n=t+new Array(r+1).join(\".0\");return e.map(n.split(\".\"),(function(e){return new Array(20-e.length).join(\"0\")+e})).reverse()}));for(n&&(o=a-Math.min(i,s)),a-=1;a>=o;){if(u[0][a]>u[1][a])return 1;if(u[0][a]===u[1][a]){if(a===o)return 0;a-=1}else if(u[0][a]1?i-1:0),a=1;a0){var a=Object.keys(r),u=o.default.find(a,(function(e){return t.isOS(e)}));if(u){var d=this.satisfies(r[u]);if(void 0!==d)return d}var c=o.default.find(a,(function(e){return t.isPlatform(e)}));if(c){var f=this.satisfies(r[c]);if(void 0!==f)return f}}if(s>0){var l=Object.keys(i),h=o.default.find(l,(function(e){return t.isBrowser(e,!0)}));if(void 0!==h)return this.compareVersion(i[h])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var r=this.getBrowserName().toLowerCase(),n=e.toLowerCase(),i=o.default.getBrowserTypeByAlias(n);return t&&i&&(n=i.toLowerCase()),n===r},t.compareVersion=function(e){var t=[0],r=e,n=!1,i=this.getBrowserVersion();if(\"string\"==typeof i)return\">\"===e[0]||\"<\"===e[0]?(r=e.substr(1),\"=\"===e[1]?(n=!0,r=e.substr(2)):t=[],\">\"===e[0]?t.push(1):t.push(-1)):\"=\"===e[0]?r=e.substr(1):\"~\"===e[0]&&(n=!0,r=e.substr(1)),t.indexOf(o.default.compareVersions(i,r,n))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=d,e.exports=t.default},92:function(e,t,r){\"use strict\";t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n};var s=/version\\/(\\d+(\\.?_?\\d+)+)/i,a=[{test:[/googlebot/i],describe:function(e){var t={name:\"Googlebot\"},r=i.default.getFirstMatch(/googlebot\\/(\\d+(\\.\\d+))/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/opera/i],describe:function(e){var t={name:\"Opera\"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:opera)[\\s/](\\d+(\\.?_?\\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opr\\/|opios/i],describe:function(e){var t={name:\"Opera\"},r=i.default.getFirstMatch(/(?:opr|opios)[\\s/](\\S+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:\"Samsung Internet for Android\"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\\s/](\\d+(\\.?_?\\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Whale/i],describe:function(e){var t={name:\"NAVER Whale Browser\"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:whale)[\\s/](\\d+(?:\\.\\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:\"MZ Browser\"},r=i.default.getFirstMatch(/(?:MZBrowser)[\\s/](\\d+(?:\\.\\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/focus/i],describe:function(e){var t={name:\"Focus\"},r=i.default.getFirstMatch(/(?:focus)[\\s/](\\d+(?:\\.\\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/swing/i],describe:function(e){var t={name:\"Swing\"},r=i.default.getFirstMatch(/(?:swing)[\\s/](\\d+(?:\\.\\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/coast/i],describe:function(e){var t={name:\"Opera Coast\"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:coast)[\\s/](\\d+(\\.?_?\\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opt\\/\\d+(?:.?_?\\d+)+/i],describe:function(e){var t={name:\"Opera Touch\"},r=i.default.getFirstMatch(/(?:opt)[\\s/](\\d+(\\.?_?\\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/yabrowser/i],describe:function(e){var t={name:\"Yandex Browser\"},r=i.default.getFirstMatch(/(?:yabrowser)[\\s/](\\d+(\\.?_?\\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:\"UC Browser\"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:ucbrowser)[\\s/](\\d+(\\.?_?\\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:\"Maxthon\"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\\s/](\\d+(\\.?_?\\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/epiphany/i],describe:function(e){var t={name:\"Epiphany\"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:epiphany)[\\s/](\\d+(\\.?_?\\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/puffin/i],describe:function(e){var t={name:\"Puffin\"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:puffin)[\\s/](\\d+(\\.?_?\\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sleipnir/i],describe:function(e){var t={name:\"Sleipnir\"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:sleipnir)[\\s/](\\d+(\\.?_?\\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/k-meleon/i],describe:function(e){var t={name:\"K-Meleon\"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/(?:k-meleon)[\\s/](\\d+(\\.?_?\\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/micromessenger/i],describe:function(e){var t={name:\"WeChat\"},r=i.default.getFirstMatch(/(?:micromessenger)[\\s/](\\d+(\\.?_?\\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?\"QQ Browser Lite\":\"QQ Browser\"},r=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\\d+(\\.?_?\\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/msie|trident/i],describe:function(e){var t={name:\"Internet Explorer\"},r=i.default.getFirstMatch(/(?:msie |rv:)(\\d+(\\.?_?\\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/\\sedg\\//i],describe:function(e){var t={name:\"Microsoft Edge\"},r=i.default.getFirstMatch(/\\sedg\\/(\\d+(\\.?_?\\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:\"Microsoft Edge\"},r=i.default.getSecondMatch(/edg([ea]|ios)\\/(\\d+(\\.?_?\\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/vivaldi/i],describe:function(e){var t={name:\"Vivaldi\"},r=i.default.getFirstMatch(/vivaldi\\/(\\d+(\\.?_?\\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/seamonkey/i],describe:function(e){var t={name:\"SeaMonkey\"},r=i.default.getFirstMatch(/seamonkey\\/(\\d+(\\.?_?\\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sailfish/i],describe:function(e){var t={name:\"Sailfish\"},r=i.default.getFirstMatch(/sailfish\\s?browser\\/(\\d+(\\.\\d+)?)/i,e);return r&&(t.version=r),t}},{test:[/silk/i],describe:function(e){var t={name:\"Amazon Silk\"},r=i.default.getFirstMatch(/silk\\/(\\d+(\\.?_?\\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/phantom/i],describe:function(e){var t={name:\"PhantomJS\"},r=i.default.getFirstMatch(/phantomjs\\/(\\d+(\\.?_?\\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/slimerjs/i],describe:function(e){var t={name:\"SlimerJS\"},r=i.default.getFirstMatch(/slimerjs\\/(\\d+(\\.?_?\\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/blackberry|\\bbb\\d+/i,/rim\\stablet/i],describe:function(e){var t={name:\"BlackBerry\"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/blackberry[\\d]+\\/(\\d+(\\.?_?\\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:\"WebOS Browser\"},r=i.default.getFirstMatch(s,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\\/(\\d+(\\.?_?\\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/bada/i],describe:function(e){var t={name:\"Bada\"},r=i.default.getFirstMatch(/dolfin\\/(\\d+(\\.?_?\\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/tizen/i],describe:function(e){var t={name:\"Tizen\"},r=i.default.getFirstMatch(/(?:tizen\\s?)?browser\\/(\\d+(\\.?_?\\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/qupzilla/i],describe:function(e){var t={name:\"QupZilla\"},r=i.default.getFirstMatch(/(?:qupzilla)[\\s/](\\d+(\\.?_?\\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:\"Firefox\"},r=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\\s/](\\d+(\\.?_?\\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/electron/i],describe:function(e){var t={name:\"Electron\"},r=i.default.getFirstMatch(/(?:electron)\\/(\\d+(\\.?_?\\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:\"Miui\"},r=i.default.getFirstMatch(/(?:MiuiBrowser)[\\s/](\\d+(\\.?_?\\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/chromium/i],describe:function(e){var t={name:\"Chromium\"},r=i.default.getFirstMatch(/(?:chromium)[\\s/](\\d+(\\.?_?\\d+)+)/i,e)||i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:\"Chrome\"},r=i.default.getFirstMatch(/(?:chrome|crios|crmo)\\/(\\d+(\\.?_?\\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/GSA/i],describe:function(e){var t={name:\"Google Search\"},r=i.default.getFirstMatch(/(?:GSA)\\/(\\d+(\\.?_?\\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t={name:\"Android Browser\"},r=i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/playstation 4/i],describe:function(e){var t={name:\"PlayStation 4\"},r=i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:\"Safari\"},r=i.default.getFirstMatch(s,e);return r&&(t.version=r),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search(\"\\\\(\")?/^(.*)\\/(.*)[ \\t]\\((.*)/:/^(.*)\\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=a,e.exports=t.default},93:function(e,t,r){\"use strict\";t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},s=r(18);var a=[{test:[/Roku\\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\\/DVP-(\\d+\\.\\d+)/i,e);return{name:s.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\\s?(\\d+(\\.\\d+)*)/i,e);return{name:s.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \\d\\d?.\\d)?)/i,e),r=i.default.getWindowsVersionName(t);return{name:s.OS_MAP.Windows,version:t,versionName:r}}},{test:[/Macintosh(.*?) FxiOS(.*?)\\//],describe:function(e){var t={name:s.OS_MAP.iOS},r=i.default.getSecondMatch(/(Version\\/)(\\d[\\d.]+)/,e);return r&&(t.version=r),t}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\\d+(\\.?_?\\d+)+)/i,e).replace(/[_\\s]/g,\".\"),r=i.default.getMacOSVersionName(t),n={name:s.OS_MAP.MacOS,version:t};return r&&(n.versionName=r),n}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\\d+([_\\s]\\d+)*) like mac os x/i,e).replace(/[_\\s]/g,\".\");return{name:s.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t=i.default.getFirstMatch(/android[\\s/-](\\d+(\\.\\d+)*)/i,e),r=i.default.getAndroidVersionName(t),n={name:s.OS_MAP.Android,version:t};return r&&(n.versionName=r),n}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\\/(\\d+(\\.\\d+)*)/i,e),r={name:s.OS_MAP.WebOS};return t&&t.length&&(r.version=t),r}},{test:[/blackberry|\\bbb\\d+/i,/rim\\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\\stablet\\sos\\s(\\d+(\\.\\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\\d+\\/(\\d+([_\\s]\\d+)*)/i,e)||i.default.getFirstMatch(/\\bbb(\\d+)/i,e);return{name:s.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\\/(\\d+(\\.\\d+)*)/i,e);return{name:s.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\\s](\\d+(\\.\\d+)*)/i,e);return{name:s.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:s.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:s.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\\s](\\d+(\\.\\d+)*)/i,e);return{name:s.OS_MAP.PlayStation4,version:t}}}];t.default=a,e.exports=t.default},94:function(e,t,r){\"use strict\";t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},s=r(18);var a=[{test:[/googlebot/i],describe:function(){return{type:\"bot\",vendor:\"Google\"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&\"Nova\",r={type:s.PLATFORMS_MAP.mobile,vendor:\"Huawei\"};return t&&(r.model=t),r}},{test:[/nexus\\s*(?:7|8|9|10).*/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:\"Nexus\"}}},{test:[/ipad/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:\"Apple\",model:\"iPad\"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\\//],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:\"Apple\",model:\"iPad\"}}},{test:[/kftt build/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:\"Amazon\",model:\"Kindle Fire HD 7\"}}},{test:[/silk/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:\"Amazon\"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),r=e.test(/like (ipod|iphone)/i);return t&&!r},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:s.PLATFORMS_MAP.mobile,vendor:\"Apple\",model:t}}},{test:[/nexus\\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:s.PLATFORMS_MAP.mobile,vendor:\"Nexus\"}}},{test:[/[^-]mobi/i],describe:function(){return{type:s.PLATFORMS_MAP.mobile}}},{test:function(e){return\"blackberry\"===e.getBrowserName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.mobile,vendor:\"BlackBerry\"}}},{test:function(e){return\"bada\"===e.getBrowserName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.mobile}}},{test:function(e){return\"windows phone\"===e.getBrowserName()},describe:function(){return{type:s.PLATFORMS_MAP.mobile,vendor:\"Microsoft\"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(\".\")[0]);return\"android\"===e.getOSName(!0)&&t>=3},describe:function(){return{type:s.PLATFORMS_MAP.tablet}}},{test:function(e){return\"android\"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.mobile}}},{test:function(e){return\"macos\"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.desktop,vendor:\"Apple\"}}},{test:function(e){return\"windows\"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.desktop}}},{test:function(e){return\"linux\"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.desktop}}},{test:function(e){return\"playstation 4\"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.tv}}},{test:function(e){return\"roku\"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.tv}}}];t.default=a,e.exports=t.default},95:function(e,t,r){\"use strict\";t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},s=r(18);var a=[{test:function(e){return\"microsoft edge\"===e.getBrowserName(!0)},describe:function(e){if(/\\sedg\\//i.test(e))return{name:s.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\\/(\\d+(\\.?_?\\d+)+)/i,e);return{name:s.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:s.ENGINE_MAP.Trident},r=i.default.getFirstMatch(/trident\\/(\\d+(\\.?_?\\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:s.ENGINE_MAP.Presto},r=i.default.getFirstMatch(/presto\\/(\\d+(\\.?_?\\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=e.test(/gecko/i),r=e.test(/like gecko/i);return t&&!r},describe:function(e){var t={name:s.ENGINE_MAP.Gecko},r=i.default.getFirstMatch(/gecko\\/(\\d+(\\.?_?\\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(apple)?webkit\\/537\\.36/i],describe:function(){return{name:s.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:s.ENGINE_MAP.WebKit},r=i.default.getFirstMatch(/webkit\\/(\\d+(\\.?_?\\d+)+)/i,e);return r&&(t.version=r),t}}];t.default=a,e.exports=t.default}})}));","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\nvar isArray = require('isarray')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number')\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n assertSize(size)\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n var length = byteLength(string, encoding) | 0\n that = createBuffer(that, length)\n\n var actual = that.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual)\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n that = createBuffer(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array)\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset)\n } else {\n array = new Uint8Array(array, byteOffset, length)\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array)\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n that = createBuffer(that, len)\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len)\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== 'undefined' &&\n obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n string = '' + string\n }\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer')\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start]\n }\n }\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if (code < 256) {\n val = code\n }\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString())\n var len = bytes.length\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n",";(function (root, factory) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory();\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\troot.CryptoJS = factory();\n\t}\n}(this, function () {\n\n\t/*globals window, global, require*/\n\n\t/**\n\t * CryptoJS core components.\n\t */\n\tvar CryptoJS = CryptoJS || (function (Math, undefined) {\n\n\t var crypto;\n\n\t // Native crypto from window (Browser)\n\t if (typeof window !== 'undefined' && window.crypto) {\n\t crypto = window.crypto;\n\t }\n\n\t // Native crypto in web worker (Browser)\n\t if (typeof self !== 'undefined' && self.crypto) {\n\t crypto = self.crypto;\n\t }\n\n\t // Native crypto from worker\n\t if (typeof globalThis !== 'undefined' && globalThis.crypto) {\n\t crypto = globalThis.crypto;\n\t }\n\n\t // Native (experimental IE 11) crypto from window (Browser)\n\t if (!crypto && typeof window !== 'undefined' && window.msCrypto) {\n\t crypto = window.msCrypto;\n\t }\n\n\t // Native crypto from global (NodeJS)\n\t if (!crypto && typeof global !== 'undefined' && global.crypto) {\n\t crypto = global.crypto;\n\t }\n\n\t // Native crypto import via require (NodeJS)\n\t if (!crypto && typeof require === 'function') {\n\t try {\n\t crypto = require('crypto');\n\t } catch (err) {}\n\t }\n\n\t /*\n\t * Cryptographically secure pseudorandom number generator\n\t *\n\t * As Math.random() is cryptographically not safe to use\n\t */\n\t var cryptoSecureRandomInt = function () {\n\t if (crypto) {\n\t // Use getRandomValues method (Browser)\n\t if (typeof crypto.getRandomValues === 'function') {\n\t try {\n\t return crypto.getRandomValues(new Uint32Array(1))[0];\n\t } catch (err) {}\n\t }\n\n\t // Use randomBytes method (NodeJS)\n\t if (typeof crypto.randomBytes === 'function') {\n\t try {\n\t return crypto.randomBytes(4).readInt32LE();\n\t } catch (err) {}\n\t }\n\t }\n\n\t throw new Error('Native crypto module could not be used to get secure random number.');\n\t };\n\n\t /*\n\t * Local polyfill of Object.create\n\n\t */\n\t var create = Object.create || (function () {\n\t function F() {}\n\n\t return function (obj) {\n\t var subtype;\n\n\t F.prototype = obj;\n\n\t subtype = new F();\n\n\t F.prototype = null;\n\n\t return subtype;\n\t };\n\t }());\n\n\t /**\n\t * CryptoJS namespace.\n\t */\n\t var C = {};\n\n\t /**\n\t * Library namespace.\n\t */\n\t var C_lib = C.lib = {};\n\n\t /**\n\t * Base object for prototypal inheritance.\n\t */\n\t var Base = C_lib.Base = (function () {\n\n\n\t return {\n\t /**\n\t * Creates a new object that inherits from this object.\n\t *\n\t * @param {Object} overrides Properties to copy into the new object.\n\t *\n\t * @return {Object} The new object.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var MyType = CryptoJS.lib.Base.extend({\n\t * field: 'value',\n\t *\n\t * method: function () {\n\t * }\n\t * });\n\t */\n\t extend: function (overrides) {\n\t // Spawn\n\t var subtype = create(this);\n\n\t // Augment\n\t if (overrides) {\n\t subtype.mixIn(overrides);\n\t }\n\n\t // Create default initializer\n\t if (!subtype.hasOwnProperty('init') || this.init === subtype.init) {\n\t subtype.init = function () {\n\t subtype.$super.init.apply(this, arguments);\n\t };\n\t }\n\n\t // Initializer's prototype is the subtype object\n\t subtype.init.prototype = subtype;\n\n\t // Reference supertype\n\t subtype.$super = this;\n\n\t return subtype;\n\t },\n\n\t /**\n\t * Extends this object and runs the init method.\n\t * Arguments to create() will be passed to init().\n\t *\n\t * @return {Object} The new object.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var instance = MyType.create();\n\t */\n\t create: function () {\n\t var instance = this.extend();\n\t instance.init.apply(instance, arguments);\n\n\t return instance;\n\t },\n\n\t /**\n\t * Initializes a newly created object.\n\t * Override this method to add some logic when your objects are created.\n\t *\n\t * @example\n\t *\n\t * var MyType = CryptoJS.lib.Base.extend({\n\t * init: function () {\n\t * // ...\n\t * }\n\t * });\n\t */\n\t init: function () {\n\t },\n\n\t /**\n\t * Copies properties into this object.\n\t *\n\t * @param {Object} properties The properties to mix in.\n\t *\n\t * @example\n\t *\n\t * MyType.mixIn({\n\t * field: 'value'\n\t * });\n\t */\n\t mixIn: function (properties) {\n\t for (var propertyName in properties) {\n\t if (properties.hasOwnProperty(propertyName)) {\n\t this[propertyName] = properties[propertyName];\n\t }\n\t }\n\n\t // IE won't copy toString using the loop above\n\t if (properties.hasOwnProperty('toString')) {\n\t this.toString = properties.toString;\n\t }\n\t },\n\n\t /**\n\t * Creates a copy of this object.\n\t *\n\t * @return {Object} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = instance.clone();\n\t */\n\t clone: function () {\n\t return this.init.prototype.extend(this);\n\t }\n\t };\n\t }());\n\n\t /**\n\t * An array of 32-bit words.\n\t *\n\t * @property {Array} words The array of 32-bit words.\n\t * @property {number} sigBytes The number of significant bytes in this word array.\n\t */\n\t var WordArray = C_lib.WordArray = Base.extend({\n\t /**\n\t * Initializes a newly created word array.\n\t *\n\t * @param {Array} words (Optional) An array of 32-bit words.\n\t * @param {number} sigBytes (Optional) The number of significant bytes in the words.\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.lib.WordArray.create();\n\t * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);\n\t * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);\n\t */\n\t init: function (words, sigBytes) {\n\t words = this.words = words || [];\n\n\t if (sigBytes != undefined) {\n\t this.sigBytes = sigBytes;\n\t } else {\n\t this.sigBytes = words.length * 4;\n\t }\n\t },\n\n\t /**\n\t * Converts this word array to a string.\n\t *\n\t * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex\n\t *\n\t * @return {string} The stringified word array.\n\t *\n\t * @example\n\t *\n\t * var string = wordArray + '';\n\t * var string = wordArray.toString();\n\t * var string = wordArray.toString(CryptoJS.enc.Utf8);\n\t */\n\t toString: function (encoder) {\n\t return (encoder || Hex).stringify(this);\n\t },\n\n\t /**\n\t * Concatenates a word array to this word array.\n\t *\n\t * @param {WordArray} wordArray The word array to append.\n\t *\n\t * @return {WordArray} This word array.\n\t *\n\t * @example\n\t *\n\t * wordArray1.concat(wordArray2);\n\t */\n\t concat: function (wordArray) {\n\t // Shortcuts\n\t var thisWords = this.words;\n\t var thatWords = wordArray.words;\n\t var thisSigBytes = this.sigBytes;\n\t var thatSigBytes = wordArray.sigBytes;\n\n\t // Clamp excess bits\n\t this.clamp();\n\n\t // Concat\n\t if (thisSigBytes % 4) {\n\t // Copy one byte at a time\n\t for (var i = 0; i < thatSigBytes; i++) {\n\t var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);\n\t }\n\t } else {\n\t // Copy one word at a time\n\t for (var j = 0; j < thatSigBytes; j += 4) {\n\t thisWords[(thisSigBytes + j) >>> 2] = thatWords[j >>> 2];\n\t }\n\t }\n\t this.sigBytes += thatSigBytes;\n\n\t // Chainable\n\t return this;\n\t },\n\n\t /**\n\t * Removes insignificant bits.\n\t *\n\t * @example\n\t *\n\t * wordArray.clamp();\n\t */\n\t clamp: function () {\n\t // Shortcuts\n\t var words = this.words;\n\t var sigBytes = this.sigBytes;\n\n\t // Clamp\n\t words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);\n\t words.length = Math.ceil(sigBytes / 4);\n\t },\n\n\t /**\n\t * Creates a copy of this word array.\n\t *\n\t * @return {WordArray} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = wordArray.clone();\n\t */\n\t clone: function () {\n\t var clone = Base.clone.call(this);\n\t clone.words = this.words.slice(0);\n\n\t return clone;\n\t },\n\n\t /**\n\t * Creates a word array filled with random bytes.\n\t *\n\t * @param {number} nBytes The number of random bytes to generate.\n\t *\n\t * @return {WordArray} The random word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.lib.WordArray.random(16);\n\t */\n\t random: function (nBytes) {\n\t var words = [];\n\n\t for (var i = 0; i < nBytes; i += 4) {\n\t words.push(cryptoSecureRandomInt());\n\t }\n\n\t return new WordArray.init(words, nBytes);\n\t }\n\t });\n\n\t /**\n\t * Encoder namespace.\n\t */\n\t var C_enc = C.enc = {};\n\n\t /**\n\t * Hex encoding strategy.\n\t */\n\t var Hex = C_enc.Hex = {\n\t /**\n\t * Converts a word array to a hex string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The hex string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hexString = CryptoJS.enc.Hex.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t // Shortcuts\n\t var words = wordArray.words;\n\t var sigBytes = wordArray.sigBytes;\n\n\t // Convert\n\t var hexChars = [];\n\t for (var i = 0; i < sigBytes; i++) {\n\t var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t hexChars.push((bite >>> 4).toString(16));\n\t hexChars.push((bite & 0x0f).toString(16));\n\t }\n\n\t return hexChars.join('');\n\t },\n\n\t /**\n\t * Converts a hex string to a word array.\n\t *\n\t * @param {string} hexStr The hex string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Hex.parse(hexString);\n\t */\n\t parse: function (hexStr) {\n\t // Shortcut\n\t var hexStrLength = hexStr.length;\n\n\t // Convert\n\t var words = [];\n\t for (var i = 0; i < hexStrLength; i += 2) {\n\t words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);\n\t }\n\n\t return new WordArray.init(words, hexStrLength / 2);\n\t }\n\t };\n\n\t /**\n\t * Latin1 encoding strategy.\n\t */\n\t var Latin1 = C_enc.Latin1 = {\n\t /**\n\t * Converts a word array to a Latin1 string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The Latin1 string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t // Shortcuts\n\t var words = wordArray.words;\n\t var sigBytes = wordArray.sigBytes;\n\n\t // Convert\n\t var latin1Chars = [];\n\t for (var i = 0; i < sigBytes; i++) {\n\t var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t latin1Chars.push(String.fromCharCode(bite));\n\t }\n\n\t return latin1Chars.join('');\n\t },\n\n\t /**\n\t * Converts a Latin1 string to a word array.\n\t *\n\t * @param {string} latin1Str The Latin1 string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Latin1.parse(latin1String);\n\t */\n\t parse: function (latin1Str) {\n\t // Shortcut\n\t var latin1StrLength = latin1Str.length;\n\n\t // Convert\n\t var words = [];\n\t for (var i = 0; i < latin1StrLength; i++) {\n\t words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);\n\t }\n\n\t return new WordArray.init(words, latin1StrLength);\n\t }\n\t };\n\n\t /**\n\t * UTF-8 encoding strategy.\n\t */\n\t var Utf8 = C_enc.Utf8 = {\n\t /**\n\t * Converts a word array to a UTF-8 string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The UTF-8 string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t try {\n\t return decodeURIComponent(escape(Latin1.stringify(wordArray)));\n\t } catch (e) {\n\t throw new Error('Malformed UTF-8 data');\n\t }\n\t },\n\n\t /**\n\t * Converts a UTF-8 string to a word array.\n\t *\n\t * @param {string} utf8Str The UTF-8 string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);\n\t */\n\t parse: function (utf8Str) {\n\t return Latin1.parse(unescape(encodeURIComponent(utf8Str)));\n\t }\n\t };\n\n\t /**\n\t * Abstract buffered block algorithm template.\n\t *\n\t * The property blockSize must be implemented in a concrete subtype.\n\t *\n\t * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0\n\t */\n\t var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({\n\t /**\n\t * Resets this block algorithm's data buffer to its initial state.\n\t *\n\t * @example\n\t *\n\t * bufferedBlockAlgorithm.reset();\n\t */\n\t reset: function () {\n\t // Initial values\n\t this._data = new WordArray.init();\n\t this._nDataBytes = 0;\n\t },\n\n\t /**\n\t * Adds new data to this block algorithm's buffer.\n\t *\n\t * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.\n\t *\n\t * @example\n\t *\n\t * bufferedBlockAlgorithm._append('data');\n\t * bufferedBlockAlgorithm._append(wordArray);\n\t */\n\t _append: function (data) {\n\t // Convert string to WordArray, else assume WordArray already\n\t if (typeof data == 'string') {\n\t data = Utf8.parse(data);\n\t }\n\n\t // Append\n\t this._data.concat(data);\n\t this._nDataBytes += data.sigBytes;\n\t },\n\n\t /**\n\t * Processes available data blocks.\n\t *\n\t * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.\n\t *\n\t * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.\n\t *\n\t * @return {WordArray} The processed data.\n\t *\n\t * @example\n\t *\n\t * var processedData = bufferedBlockAlgorithm._process();\n\t * var processedData = bufferedBlockAlgorithm._process(!!'flush');\n\t */\n\t _process: function (doFlush) {\n\t var processedWords;\n\n\t // Shortcuts\n\t var data = this._data;\n\t var dataWords = data.words;\n\t var dataSigBytes = data.sigBytes;\n\t var blockSize = this.blockSize;\n\t var blockSizeBytes = blockSize * 4;\n\n\t // Count blocks ready\n\t var nBlocksReady = dataSigBytes / blockSizeBytes;\n\t if (doFlush) {\n\t // Round up to include partial blocks\n\t nBlocksReady = Math.ceil(nBlocksReady);\n\t } else {\n\t // Round down to include only full blocks,\n\t // less the number of blocks that must remain in the buffer\n\t nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);\n\t }\n\n\t // Count words ready\n\t var nWordsReady = nBlocksReady * blockSize;\n\n\t // Count bytes ready\n\t var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);\n\n\t // Process blocks\n\t if (nWordsReady) {\n\t for (var offset = 0; offset < nWordsReady; offset += blockSize) {\n\t // Perform concrete-algorithm logic\n\t this._doProcessBlock(dataWords, offset);\n\t }\n\n\t // Remove processed words\n\t processedWords = dataWords.splice(0, nWordsReady);\n\t data.sigBytes -= nBytesReady;\n\t }\n\n\t // Return processed words\n\t return new WordArray.init(processedWords, nBytesReady);\n\t },\n\n\t /**\n\t * Creates a copy of this object.\n\t *\n\t * @return {Object} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = bufferedBlockAlgorithm.clone();\n\t */\n\t clone: function () {\n\t var clone = Base.clone.call(this);\n\t clone._data = this._data.clone();\n\n\t return clone;\n\t },\n\n\t _minBufferSize: 0\n\t });\n\n\t /**\n\t * Abstract hasher template.\n\t *\n\t * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)\n\t */\n\t var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({\n\t /**\n\t * Configuration options.\n\t */\n\t cfg: Base.extend(),\n\n\t /**\n\t * Initializes a newly created hasher.\n\t *\n\t * @param {Object} cfg (Optional) The configuration options to use for this hash computation.\n\t *\n\t * @example\n\t *\n\t * var hasher = CryptoJS.algo.SHA256.create();\n\t */\n\t init: function (cfg) {\n\t // Apply config defaults\n\t this.cfg = this.cfg.extend(cfg);\n\n\t // Set initial values\n\t this.reset();\n\t },\n\n\t /**\n\t * Resets this hasher to its initial state.\n\t *\n\t * @example\n\t *\n\t * hasher.reset();\n\t */\n\t reset: function () {\n\t // Reset data buffer\n\t BufferedBlockAlgorithm.reset.call(this);\n\n\t // Perform concrete-hasher logic\n\t this._doReset();\n\t },\n\n\t /**\n\t * Updates this hasher with a message.\n\t *\n\t * @param {WordArray|string} messageUpdate The message to append.\n\t *\n\t * @return {Hasher} This hasher.\n\t *\n\t * @example\n\t *\n\t * hasher.update('message');\n\t * hasher.update(wordArray);\n\t */\n\t update: function (messageUpdate) {\n\t // Append\n\t this._append(messageUpdate);\n\n\t // Update the hash\n\t this._process();\n\n\t // Chainable\n\t return this;\n\t },\n\n\t /**\n\t * Finalizes the hash computation.\n\t * Note that the finalize operation is effectively a destructive, read-once operation.\n\t *\n\t * @param {WordArray|string} messageUpdate (Optional) A final message update.\n\t *\n\t * @return {WordArray} The hash.\n\t *\n\t * @example\n\t *\n\t * var hash = hasher.finalize();\n\t * var hash = hasher.finalize('message');\n\t * var hash = hasher.finalize(wordArray);\n\t */\n\t finalize: function (messageUpdate) {\n\t // Final message update\n\t if (messageUpdate) {\n\t this._append(messageUpdate);\n\t }\n\n\t // Perform concrete-hasher logic\n\t var hash = this._doFinalize();\n\n\t return hash;\n\t },\n\n\t blockSize: 512/32,\n\n\t /**\n\t * Creates a shortcut function to a hasher's object interface.\n\t *\n\t * @param {Hasher} hasher The hasher to create a helper for.\n\t *\n\t * @return {Function} The shortcut function.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);\n\t */\n\t _createHelper: function (hasher) {\n\t return function (message, cfg) {\n\t return new hasher.init(cfg).finalize(message);\n\t };\n\t },\n\n\t /**\n\t * Creates a shortcut function to the HMAC's object interface.\n\t *\n\t * @param {Hasher} hasher The hasher to use in this HMAC helper.\n\t *\n\t * @return {Function} The shortcut function.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);\n\t */\n\t _createHmacHelper: function (hasher) {\n\t return function (message, key) {\n\t return new C_algo.HMAC.init(hasher, key).finalize(message);\n\t };\n\t }\n\t });\n\n\t /**\n\t * Algorithm namespace.\n\t */\n\t var C_algo = C.algo = {};\n\n\t return C;\n\t}(Math));\n\n\n\treturn CryptoJS;\n\n}));",";(function (root, factory) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(require(\"./core\"));\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([\"./core\"], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\tfactory(root.CryptoJS);\n\t}\n}(this, function (CryptoJS) {\n\n\t(function () {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var WordArray = C_lib.WordArray;\n\t var C_enc = C.enc;\n\n\t /**\n\t * Base64 encoding strategy.\n\t */\n\t var Base64 = C_enc.Base64 = {\n\t /**\n\t * Converts a word array to a Base64 string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The Base64 string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var base64String = CryptoJS.enc.Base64.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t // Shortcuts\n\t var words = wordArray.words;\n\t var sigBytes = wordArray.sigBytes;\n\t var map = this._map;\n\n\t // Clamp excess bits\n\t wordArray.clamp();\n\n\t // Convert\n\t var base64Chars = [];\n\t for (var i = 0; i < sigBytes; i += 3) {\n\t var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff;\n\t var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff;\n\n\t var triplet = (byte1 << 16) | (byte2 << 8) | byte3;\n\n\t for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) {\n\t base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));\n\t }\n\t }\n\n\t // Add padding\n\t var paddingChar = map.charAt(64);\n\t if (paddingChar) {\n\t while (base64Chars.length % 4) {\n\t base64Chars.push(paddingChar);\n\t }\n\t }\n\n\t return base64Chars.join('');\n\t },\n\n\t /**\n\t * Converts a Base64 string to a word array.\n\t *\n\t * @param {string} base64Str The Base64 string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Base64.parse(base64String);\n\t */\n\t parse: function (base64Str) {\n\t // Shortcuts\n\t var base64StrLength = base64Str.length;\n\t var map = this._map;\n\t var reverseMap = this._reverseMap;\n\n\t if (!reverseMap) {\n\t reverseMap = this._reverseMap = [];\n\t for (var j = 0; j < map.length; j++) {\n\t reverseMap[map.charCodeAt(j)] = j;\n\t }\n\t }\n\n\t // Ignore padding\n\t var paddingChar = map.charAt(64);\n\t if (paddingChar) {\n\t var paddingIndex = base64Str.indexOf(paddingChar);\n\t if (paddingIndex !== -1) {\n\t base64StrLength = paddingIndex;\n\t }\n\t }\n\n\t // Convert\n\t return parseLoop(base64Str, base64StrLength, reverseMap);\n\n\t },\n\n\t _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='\n\t };\n\n\t function parseLoop(base64Str, base64StrLength, reverseMap) {\n\t var words = [];\n\t var nBytes = 0;\n\t for (var i = 0; i < base64StrLength; i++) {\n\t if (i % 4) {\n\t var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2);\n\t var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2);\n\t var bitsCombined = bits1 | bits2;\n\t words[nBytes >>> 2] |= bitsCombined << (24 - (nBytes % 4) * 8);\n\t nBytes++;\n\t }\n\t }\n\t return WordArray.create(words, nBytes);\n\t }\n\t}());\n\n\n\treturn CryptoJS.enc.Base64;\n\n}));",";(function (root, factory, undef) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(require(\"./core\"), require(\"./sha256\"), require(\"./hmac\"));\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([\"./core\", \"./sha256\", \"./hmac\"], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\tfactory(root.CryptoJS);\n\t}\n}(this, function (CryptoJS) {\n\n\treturn CryptoJS.HmacSHA256;\n\n}));",";(function (root, factory) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(require(\"./core\"));\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([\"./core\"], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\tfactory(root.CryptoJS);\n\t}\n}(this, function (CryptoJS) {\n\n\t(function () {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var Base = C_lib.Base;\n\t var C_enc = C.enc;\n\t var Utf8 = C_enc.Utf8;\n\t var C_algo = C.algo;\n\n\t /**\n\t * HMAC algorithm.\n\t */\n\t var HMAC = C_algo.HMAC = Base.extend({\n\t /**\n\t * Initializes a newly created HMAC.\n\t *\n\t * @param {Hasher} hasher The hash algorithm to use.\n\t * @param {WordArray|string} key The secret key.\n\t *\n\t * @example\n\t *\n\t * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key);\n\t */\n\t init: function (hasher, key) {\n\t // Init hasher\n\t hasher = this._hasher = new hasher.init();\n\n\t // Convert string to WordArray, else assume WordArray already\n\t if (typeof key == 'string') {\n\t key = Utf8.parse(key);\n\t }\n\n\t // Shortcuts\n\t var hasherBlockSize = hasher.blockSize;\n\t var hasherBlockSizeBytes = hasherBlockSize * 4;\n\n\t // Allow arbitrary length keys\n\t if (key.sigBytes > hasherBlockSizeBytes) {\n\t key = hasher.finalize(key);\n\t }\n\n\t // Clamp excess bits\n\t key.clamp();\n\n\t // Clone key for inner and outer pads\n\t var oKey = this._oKey = key.clone();\n\t var iKey = this._iKey = key.clone();\n\n\t // Shortcuts\n\t var oKeyWords = oKey.words;\n\t var iKeyWords = iKey.words;\n\n\t // XOR keys with pad constants\n\t for (var i = 0; i < hasherBlockSize; i++) {\n\t oKeyWords[i] ^= 0x5c5c5c5c;\n\t iKeyWords[i] ^= 0x36363636;\n\t }\n\t oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes;\n\n\t // Set initial values\n\t this.reset();\n\t },\n\n\t /**\n\t * Resets this HMAC to its initial state.\n\t *\n\t * @example\n\t *\n\t * hmacHasher.reset();\n\t */\n\t reset: function () {\n\t // Shortcut\n\t var hasher = this._hasher;\n\n\t // Reset\n\t hasher.reset();\n\t hasher.update(this._iKey);\n\t },\n\n\t /**\n\t * Updates this HMAC with a message.\n\t *\n\t * @param {WordArray|string} messageUpdate The message to append.\n\t *\n\t * @return {HMAC} This HMAC instance.\n\t *\n\t * @example\n\t *\n\t * hmacHasher.update('message');\n\t * hmacHasher.update(wordArray);\n\t */\n\t update: function (messageUpdate) {\n\t this._hasher.update(messageUpdate);\n\n\t // Chainable\n\t return this;\n\t },\n\n\t /**\n\t * Finalizes the HMAC computation.\n\t * Note that the finalize operation is effectively a destructive, read-once operation.\n\t *\n\t * @param {WordArray|string} messageUpdate (Optional) A final message update.\n\t *\n\t * @return {WordArray} The HMAC.\n\t *\n\t * @example\n\t *\n\t * var hmac = hmacHasher.finalize();\n\t * var hmac = hmacHasher.finalize('message');\n\t * var hmac = hmacHasher.finalize(wordArray);\n\t */\n\t finalize: function (messageUpdate) {\n\t // Shortcut\n\t var hasher = this._hasher;\n\n\t // Compute HMAC\n\t var innerHash = hasher.finalize(messageUpdate);\n\t hasher.reset();\n\t var hmac = hasher.finalize(this._oKey.clone().concat(innerHash));\n\n\t return hmac;\n\t }\n\t });\n\t}());\n\n\n}));",";(function (root, factory) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(require(\"./core\"));\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([\"./core\"], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\tfactory(root.CryptoJS);\n\t}\n}(this, function (CryptoJS) {\n\n\t(function () {\n\t // Check if typed arrays are supported\n\t if (typeof ArrayBuffer != 'function') {\n\t return;\n\t }\n\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var WordArray = C_lib.WordArray;\n\n\t // Reference original init\n\t var superInit = WordArray.init;\n\n\t // Augment WordArray.init to handle typed arrays\n\t var subInit = WordArray.init = function (typedArray) {\n\t // Convert buffers to uint8\n\t if (typedArray instanceof ArrayBuffer) {\n\t typedArray = new Uint8Array(typedArray);\n\t }\n\n\t // Convert other array views to uint8\n\t if (\n\t typedArray instanceof Int8Array ||\n\t (typeof Uint8ClampedArray !== \"undefined\" && typedArray instanceof Uint8ClampedArray) ||\n\t typedArray instanceof Int16Array ||\n\t typedArray instanceof Uint16Array ||\n\t typedArray instanceof Int32Array ||\n\t typedArray instanceof Uint32Array ||\n\t typedArray instanceof Float32Array ||\n\t typedArray instanceof Float64Array\n\t ) {\n\t typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength);\n\t }\n\n\t // Handle Uint8Array\n\t if (typedArray instanceof Uint8Array) {\n\t // Shortcut\n\t var typedArrayByteLength = typedArray.byteLength;\n\n\t // Extract bytes\n\t var words = [];\n\t for (var i = 0; i < typedArrayByteLength; i++) {\n\t words[i >>> 2] |= typedArray[i] << (24 - (i % 4) * 8);\n\t }\n\n\t // Initialize this word array\n\t superInit.call(this, words, typedArrayByteLength);\n\t } else {\n\t // Else call normal init\n\t superInit.apply(this, arguments);\n\t }\n\t };\n\n\t subInit.prototype = WordArray;\n\t}());\n\n\n\treturn CryptoJS.lib.WordArray;\n\n}));",";(function (root, factory) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(require(\"./core\"));\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([\"./core\"], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\tfactory(root.CryptoJS);\n\t}\n}(this, function (CryptoJS) {\n\n\t(function (Math) {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var WordArray = C_lib.WordArray;\n\t var Hasher = C_lib.Hasher;\n\t var C_algo = C.algo;\n\n\t // Initialization and round constants tables\n\t var H = [];\n\t var K = [];\n\n\t // Compute constants\n\t (function () {\n\t function isPrime(n) {\n\t var sqrtN = Math.sqrt(n);\n\t for (var factor = 2; factor <= sqrtN; factor++) {\n\t if (!(n % factor)) {\n\t return false;\n\t }\n\t }\n\n\t return true;\n\t }\n\n\t function getFractionalBits(n) {\n\t return ((n - (n | 0)) * 0x100000000) | 0;\n\t }\n\n\t var n = 2;\n\t var nPrime = 0;\n\t while (nPrime < 64) {\n\t if (isPrime(n)) {\n\t if (nPrime < 8) {\n\t H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2));\n\t }\n\t K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3));\n\n\t nPrime++;\n\t }\n\n\t n++;\n\t }\n\t }());\n\n\t // Reusable object\n\t var W = [];\n\n\t /**\n\t * SHA-256 hash algorithm.\n\t */\n\t var SHA256 = C_algo.SHA256 = Hasher.extend({\n\t _doReset: function () {\n\t this._hash = new WordArray.init(H.slice(0));\n\t },\n\n\t _doProcessBlock: function (M, offset) {\n\t // Shortcut\n\t var H = this._hash.words;\n\n\t // Working variables\n\t var a = H[0];\n\t var b = H[1];\n\t var c = H[2];\n\t var d = H[3];\n\t var e = H[4];\n\t var f = H[5];\n\t var g = H[6];\n\t var h = H[7];\n\n\t // Computation\n\t for (var i = 0; i < 64; i++) {\n\t if (i < 16) {\n\t W[i] = M[offset + i] | 0;\n\t } else {\n\t var gamma0x = W[i - 15];\n\t var gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^\n\t ((gamma0x << 14) | (gamma0x >>> 18)) ^\n\t (gamma0x >>> 3);\n\n\t var gamma1x = W[i - 2];\n\t var gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^\n\t ((gamma1x << 13) | (gamma1x >>> 19)) ^\n\t (gamma1x >>> 10);\n\n\t W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16];\n\t }\n\n\t var ch = (e & f) ^ (~e & g);\n\t var maj = (a & b) ^ (a & c) ^ (b & c);\n\n\t var sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22));\n\t var sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7) | (e >>> 25));\n\n\t var t1 = h + sigma1 + ch + K[i] + W[i];\n\t var t2 = sigma0 + maj;\n\n\t h = g;\n\t g = f;\n\t f = e;\n\t e = (d + t1) | 0;\n\t d = c;\n\t c = b;\n\t b = a;\n\t a = (t1 + t2) | 0;\n\t }\n\n\t // Intermediate hash value\n\t H[0] = (H[0] + a) | 0;\n\t H[1] = (H[1] + b) | 0;\n\t H[2] = (H[2] + c) | 0;\n\t H[3] = (H[3] + d) | 0;\n\t H[4] = (H[4] + e) | 0;\n\t H[5] = (H[5] + f) | 0;\n\t H[6] = (H[6] + g) | 0;\n\t H[7] = (H[7] + h) | 0;\n\t },\n\n\t _doFinalize: function () {\n\t // Shortcuts\n\t var data = this._data;\n\t var dataWords = data.words;\n\n\t var nBitsTotal = this._nDataBytes * 8;\n\t var nBitsLeft = data.sigBytes * 8;\n\n\t // Add padding\n\t dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);\n\t dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);\n\t dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;\n\t data.sigBytes = dataWords.length * 4;\n\n\t // Hash final blocks\n\t this._process();\n\n\t // Return final computed hash\n\t return this._hash;\n\t },\n\n\t clone: function () {\n\t var clone = Hasher.clone.call(this);\n\t clone._hash = this._hash.clone();\n\n\t return clone;\n\t }\n\t });\n\n\t /**\n\t * Shortcut function to the hasher's object interface.\n\t *\n\t * @param {WordArray|string} message The message to hash.\n\t *\n\t * @return {WordArray} The hash.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hash = CryptoJS.SHA256('message');\n\t * var hash = CryptoJS.SHA256(wordArray);\n\t */\n\t C.SHA256 = Hasher._createHelper(SHA256);\n\n\t /**\n\t * Shortcut function to the HMAC's object interface.\n\t *\n\t * @param {WordArray|string} message The message to hash.\n\t * @param {WordArray|string} key The secret key.\n\t *\n\t * @return {WordArray} The HMAC.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hmac = CryptoJS.HmacSHA256(message, key);\n\t */\n\t C.HmacSHA256 = Hasher._createHmacHelper(SHA256);\n\t}(Math));\n\n\n\treturn CryptoJS.SHA256;\n\n}));","/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n","module.exports = self.fetch || (self.fetch = require('unfetch').default || require('unfetch'));\n","/*!\n * JavaScript Cookie v2.2.1\n * https://github.com/js-cookie/js-cookie\n *\n * Copyright 2006, 2015 Klaus Hartl & Fagner Brack\n * Released under the MIT license\n */\n;(function (factory) {\n\tvar registeredInModuleLoader;\n\tif (typeof define === 'function' && define.amd) {\n\t\tdefine(factory);\n\t\tregisteredInModuleLoader = true;\n\t}\n\tif (typeof exports === 'object') {\n\t\tmodule.exports = factory();\n\t\tregisteredInModuleLoader = true;\n\t}\n\tif (!registeredInModuleLoader) {\n\t\tvar OldCookies = window.Cookies;\n\t\tvar api = window.Cookies = factory();\n\t\tapi.noConflict = function () {\n\t\t\twindow.Cookies = OldCookies;\n\t\t\treturn api;\n\t\t};\n\t}\n}(function () {\n\tfunction extend () {\n\t\tvar i = 0;\n\t\tvar result = {};\n\t\tfor (; i < arguments.length; i++) {\n\t\t\tvar attributes = arguments[ i ];\n\t\t\tfor (var key in attributes) {\n\t\t\t\tresult[key] = attributes[key];\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\tfunction decode (s) {\n\t\treturn s.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent);\n\t}\n\n\tfunction init (converter) {\n\t\tfunction api() {}\n\n\t\tfunction set (key, value, attributes) {\n\t\t\tif (typeof document === 'undefined') {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tattributes = extend({\n\t\t\t\tpath: '/'\n\t\t\t}, api.defaults, attributes);\n\n\t\t\tif (typeof attributes.expires === 'number') {\n\t\t\t\tattributes.expires = new Date(new Date() * 1 + attributes.expires * 864e+5);\n\t\t\t}\n\n\t\t\t// We're using \"expires\" because \"max-age\" is not supported by IE\n\t\t\tattributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';\n\n\t\t\ttry {\n\t\t\t\tvar result = JSON.stringify(value);\n\t\t\t\tif (/^[\\{\\[]/.test(result)) {\n\t\t\t\t\tvalue = result;\n\t\t\t\t}\n\t\t\t} catch (e) {}\n\n\t\t\tvalue = converter.write ?\n\t\t\t\tconverter.write(value, key) :\n\t\t\t\tencodeURIComponent(String(value))\n\t\t\t\t\t.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);\n\n\t\t\tkey = encodeURIComponent(String(key))\n\t\t\t\t.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent)\n\t\t\t\t.replace(/[\\(\\)]/g, escape);\n\n\t\t\tvar stringifiedAttributes = '';\n\t\t\tfor (var attributeName in attributes) {\n\t\t\t\tif (!attributes[attributeName]) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tstringifiedAttributes += '; ' + attributeName;\n\t\t\t\tif (attributes[attributeName] === true) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Considers RFC 6265 section 5.2:\n\t\t\t\t// ...\n\t\t\t\t// 3. If the remaining unparsed-attributes contains a %x3B (\";\")\n\t\t\t\t// character:\n\t\t\t\t// Consume the characters of the unparsed-attributes up to,\n\t\t\t\t// not including, the first %x3B (\";\") character.\n\t\t\t\t// ...\n\t\t\t\tstringifiedAttributes += '=' + attributes[attributeName].split(';')[0];\n\t\t\t}\n\n\t\t\treturn (document.cookie = key + '=' + value + stringifiedAttributes);\n\t\t}\n\n\t\tfunction get (key, json) {\n\t\t\tif (typeof document === 'undefined') {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar jar = {};\n\t\t\t// To prevent the for loop in the first place assign an empty array\n\t\t\t// in case there are no cookies at all.\n\t\t\tvar cookies = document.cookie ? document.cookie.split('; ') : [];\n\t\t\tvar i = 0;\n\n\t\t\tfor (; i < cookies.length; i++) {\n\t\t\t\tvar parts = cookies[i].split('=');\n\t\t\t\tvar cookie = parts.slice(1).join('=');\n\n\t\t\t\tif (!json && cookie.charAt(0) === '\"') {\n\t\t\t\t\tcookie = cookie.slice(1, -1);\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tvar name = decode(parts[0]);\n\t\t\t\t\tcookie = (converter.read || converter)(cookie, name) ||\n\t\t\t\t\t\tdecode(cookie);\n\n\t\t\t\t\tif (json) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tcookie = JSON.parse(cookie);\n\t\t\t\t\t\t} catch (e) {}\n\t\t\t\t\t}\n\n\t\t\t\t\tjar[name] = cookie;\n\n\t\t\t\t\tif (key === name) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} catch (e) {}\n\t\t\t}\n\n\t\t\treturn key ? jar[key] : jar;\n\t\t}\n\n\t\tapi.set = set;\n\t\tapi.get = function (key) {\n\t\t\treturn get(key, false /* read as raw */);\n\t\t};\n\t\tapi.getJSON = function (key) {\n\t\t\treturn get(key, true /* read as json */);\n\t\t};\n\t\tapi.remove = function (key, attributes) {\n\t\t\tset(key, '', extend(attributes, {\n\t\t\t\texpires: -1\n\t\t\t}));\n\t\t};\n\n\t\tapi.defaults = {};\n\n\t\tapi.withConverter = init;\n\n\t\treturn api;\n\t}\n\n\treturn init(function () {});\n}));\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\n// If obj.hasOwnProperty has been overridden, then calling\n// obj.hasOwnProperty(prop) will break.\n// See: https://github.com/joyent/node/issues/1707\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nmodule.exports = function(qs, sep, eq, options) {\n sep = sep || '&';\n eq = eq || '=';\n var obj = {};\n\n if (typeof qs !== 'string' || qs.length === 0) {\n return obj;\n }\n\n var regexp = /\\+/g;\n qs = qs.split(sep);\n\n var maxKeys = 1000;\n if (options && typeof options.maxKeys === 'number') {\n maxKeys = options.maxKeys;\n }\n\n var len = qs.length;\n // maxKeys <= 0 means that we should not limit keys count\n if (maxKeys > 0 && len > maxKeys) {\n len = maxKeys;\n }\n\n for (var i = 0; i < len; ++i) {\n var x = qs[i].replace(regexp, '%20'),\n idx = x.indexOf(eq),\n kstr, vstr, k, v;\n\n if (idx >= 0) {\n kstr = x.substr(0, idx);\n vstr = x.substr(idx + 1);\n } else {\n kstr = x;\n vstr = '';\n }\n\n k = decodeURIComponent(kstr);\n v = decodeURIComponent(vstr);\n\n if (!hasOwnProperty(obj, k)) {\n obj[k] = v;\n } else if (Array.isArray(obj[k])) {\n obj[k].push(v);\n } else {\n obj[k] = [obj[k], v];\n }\n }\n\n return obj;\n};\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar stringifyPrimitive = function(v) {\n switch (typeof v) {\n case 'string':\n return v;\n\n case 'boolean':\n return v ? 'true' : 'false';\n\n case 'number':\n return isFinite(v) ? v : '';\n\n default:\n return '';\n }\n};\n\nmodule.exports = function(obj, sep, eq, name) {\n sep = sep || '&';\n eq = eq || '=';\n if (obj === null) {\n obj = undefined;\n }\n\n if (typeof obj === 'object') {\n return Object.keys(obj).map(function(k) {\n var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;\n if (Array.isArray(obj[k])) {\n return obj[k].map(function(v) {\n return ks + encodeURIComponent(stringifyPrimitive(v));\n }).join(sep);\n } else {\n return ks + encodeURIComponent(stringifyPrimitive(obj[k]));\n }\n }).join(sep);\n\n }\n\n if (!name) return '';\n return encodeURIComponent(stringifyPrimitive(name)) + eq +\n encodeURIComponent(stringifyPrimitive(obj));\n};\n","'use strict';\n\nexports.decode = exports.parse = require('./decode');\nexports.encode = exports.stringify = require('./encode');\n","/*\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nexport var CognitoHostedUIIdentityProvider;\n(function (CognitoHostedUIIdentityProvider) {\n CognitoHostedUIIdentityProvider[\"Cognito\"] = \"COGNITO\";\n CognitoHostedUIIdentityProvider[\"Google\"] = \"Google\";\n CognitoHostedUIIdentityProvider[\"Facebook\"] = \"Facebook\";\n CognitoHostedUIIdentityProvider[\"Amazon\"] = \"LoginWithAmazon\";\n CognitoHostedUIIdentityProvider[\"Apple\"] = \"SignInWithApple\";\n})(CognitoHostedUIIdentityProvider || (CognitoHostedUIIdentityProvider = {}));\nexport function isFederatedSignInOptions(obj) {\n var keys = ['provider'];\n return obj && !!keys.find(function (k) { return obj.hasOwnProperty(k); });\n}\nexport function isFederatedSignInOptionsCustom(obj) {\n var keys = ['customProvider'];\n return obj && !!keys.find(function (k) { return obj.hasOwnProperty(k); });\n}\nexport function hasCustomState(obj) {\n var keys = ['customState'];\n return obj && !!keys.find(function (k) { return obj.hasOwnProperty(k); });\n}\nexport function isCognitoHostedOpts(oauth) {\n return oauth.redirectSignIn !== undefined;\n}\nexport var AuthErrorTypes;\n(function (AuthErrorTypes) {\n AuthErrorTypes[\"NoConfig\"] = \"noConfig\";\n AuthErrorTypes[\"MissingAuthConfig\"] = \"missingAuthConfig\";\n AuthErrorTypes[\"EmptyUsername\"] = \"emptyUsername\";\n AuthErrorTypes[\"InvalidUsername\"] = \"invalidUsername\";\n AuthErrorTypes[\"EmptyPassword\"] = \"emptyPassword\";\n AuthErrorTypes[\"EmptyCode\"] = \"emptyCode\";\n AuthErrorTypes[\"SignUpError\"] = \"signUpError\";\n AuthErrorTypes[\"NoMFA\"] = \"noMFA\";\n AuthErrorTypes[\"InvalidMFA\"] = \"invalidMFA\";\n AuthErrorTypes[\"EmptyChallengeResponse\"] = \"emptyChallengeResponse\";\n AuthErrorTypes[\"NoUserSession\"] = \"noUserSession\";\n AuthErrorTypes[\"Default\"] = \"default\";\n AuthErrorTypes[\"DeviceConfig\"] = \"deviceConfig\";\n AuthErrorTypes[\"NetworkError\"] = \"networkError\";\n})(AuthErrorTypes || (AuthErrorTypes = {}));\nexport function isUsernamePasswordOpts(obj) {\n return !!obj.username;\n}\nexport var GRAPHQL_AUTH_MODE;\n(function (GRAPHQL_AUTH_MODE) {\n GRAPHQL_AUTH_MODE[\"API_KEY\"] = \"API_KEY\";\n GRAPHQL_AUTH_MODE[\"AWS_IAM\"] = \"AWS_IAM\";\n GRAPHQL_AUTH_MODE[\"OPENID_CONNECT\"] = \"OPENID_CONNECT\";\n GRAPHQL_AUTH_MODE[\"AMAZON_COGNITO_USER_POOLS\"] = \"AMAZON_COGNITO_USER_POOLS\";\n GRAPHQL_AUTH_MODE[\"AWS_LAMBDA\"] = \"AWS_LAMBDA\";\n})(GRAPHQL_AUTH_MODE || (GRAPHQL_AUTH_MODE = {}));\n//# sourceMappingURL=Auth.js.map","/*\n * Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\n// Logging constants\nvar AWS_CLOUDWATCH_BASE_BUFFER_SIZE = 26;\nvar AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE = 1048576;\nvar AWS_CLOUDWATCH_MAX_EVENT_SIZE = 256000;\nvar AWS_CLOUDWATCH_CATEGORY = 'Logging';\nvar AWS_CLOUDWATCH_PROVIDER_NAME = 'AWSCloudWatch';\nvar NO_CREDS_ERROR_STRING = 'No credentials';\nvar RETRY_ERROR_CODES = [\n 'ResourceNotFoundException',\n 'InvalidSequenceTokenException',\n];\nexport { AWS_CLOUDWATCH_BASE_BUFFER_SIZE, AWS_CLOUDWATCH_CATEGORY, AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE, AWS_CLOUDWATCH_MAX_EVENT_SIZE, AWS_CLOUDWATCH_PROVIDER_NAME, NO_CREDS_ERROR_STRING, RETRY_ERROR_CODES, };\n//# sourceMappingURL=Constants.js.map","/*\n * Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nvar __values = (this && this.__values) || function(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n};\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spread = (this && this.__spread) || function () {\n for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));\n return ar;\n};\nimport { AWS_CLOUDWATCH_CATEGORY } from '../Util/Constants';\nvar LOG_LEVELS = {\n VERBOSE: 1,\n DEBUG: 2,\n INFO: 3,\n WARN: 4,\n ERROR: 5,\n};\nexport var LOG_TYPE;\n(function (LOG_TYPE) {\n LOG_TYPE[\"DEBUG\"] = \"DEBUG\";\n LOG_TYPE[\"ERROR\"] = \"ERROR\";\n LOG_TYPE[\"INFO\"] = \"INFO\";\n LOG_TYPE[\"WARN\"] = \"WARN\";\n LOG_TYPE[\"VERBOSE\"] = \"VERBOSE\";\n})(LOG_TYPE || (LOG_TYPE = {}));\n/**\n * Write logs\n * @class Logger\n */\nvar ConsoleLogger = /** @class */ (function () {\n /**\n * @constructor\n * @param {string} name - Name of the logger\n */\n function ConsoleLogger(name, level) {\n if (level === void 0) { level = LOG_TYPE.WARN; }\n this.name = name;\n this.level = level;\n this._pluggables = [];\n }\n ConsoleLogger.prototype._padding = function (n) {\n return n < 10 ? '0' + n : '' + n;\n };\n ConsoleLogger.prototype._ts = function () {\n var dt = new Date();\n return ([this._padding(dt.getMinutes()), this._padding(dt.getSeconds())].join(':') +\n '.' +\n dt.getMilliseconds());\n };\n ConsoleLogger.prototype.configure = function (config) {\n if (!config)\n return this._config;\n this._config = config;\n return this._config;\n };\n /**\n * Write log\n * @method\n * @memeberof Logger\n * @param {LOG_TYPE|string} type - log type, default INFO\n * @param {string|object} msg - Logging message or object\n */\n ConsoleLogger.prototype._log = function (type) {\n var e_1, _a;\n var msg = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n msg[_i - 1] = arguments[_i];\n }\n var logger_level_name = this.level;\n if (ConsoleLogger.LOG_LEVEL) {\n logger_level_name = ConsoleLogger.LOG_LEVEL;\n }\n if (typeof window !== 'undefined' && window.LOG_LEVEL) {\n logger_level_name = window.LOG_LEVEL;\n }\n var logger_level = LOG_LEVELS[logger_level_name];\n var type_level = LOG_LEVELS[type];\n if (!(type_level >= logger_level)) {\n // Do nothing if type is not greater than or equal to logger level (handle undefined)\n return;\n }\n var log = console.log.bind(console);\n if (type === LOG_TYPE.ERROR && console.error) {\n log = console.error.bind(console);\n }\n if (type === LOG_TYPE.WARN && console.warn) {\n log = console.warn.bind(console);\n }\n var prefix = \"[\" + type + \"] \" + this._ts() + \" \" + this.name;\n var message = '';\n if (msg.length === 1 && typeof msg[0] === 'string') {\n message = prefix + \" - \" + msg[0];\n log(message);\n }\n else if (msg.length === 1) {\n message = prefix + \" \" + msg[0];\n log(prefix, msg[0]);\n }\n else if (typeof msg[0] === 'string') {\n var obj = msg.slice(1);\n if (obj.length === 1) {\n obj = obj[0];\n }\n message = prefix + \" - \" + msg[0] + \" \" + obj;\n log(prefix + \" - \" + msg[0], obj);\n }\n else {\n message = prefix + \" \" + msg;\n log(prefix, msg);\n }\n try {\n for (var _b = __values(this._pluggables), _c = _b.next(); !_c.done; _c = _b.next()) {\n var plugin = _c.value;\n var logEvent = { message: message, timestamp: Date.now() };\n plugin.pushLogs([logEvent]);\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n };\n /**\n * Write General log. Default to INFO\n * @method\n * @memeberof Logger\n * @param {string|object} msg - Logging message or object\n */\n ConsoleLogger.prototype.log = function () {\n var msg = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n msg[_i] = arguments[_i];\n }\n this._log.apply(this, __spread([LOG_TYPE.INFO], msg));\n };\n /**\n * Write INFO log\n * @method\n * @memeberof Logger\n * @param {string|object} msg - Logging message or object\n */\n ConsoleLogger.prototype.info = function () {\n var msg = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n msg[_i] = arguments[_i];\n }\n this._log.apply(this, __spread([LOG_TYPE.INFO], msg));\n };\n /**\n * Write WARN log\n * @method\n * @memeberof Logger\n * @param {string|object} msg - Logging message or object\n */\n ConsoleLogger.prototype.warn = function () {\n var msg = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n msg[_i] = arguments[_i];\n }\n this._log.apply(this, __spread([LOG_TYPE.WARN], msg));\n };\n /**\n * Write ERROR log\n * @method\n * @memeberof Logger\n * @param {string|object} msg - Logging message or object\n */\n ConsoleLogger.prototype.error = function () {\n var msg = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n msg[_i] = arguments[_i];\n }\n this._log.apply(this, __spread([LOG_TYPE.ERROR], msg));\n };\n /**\n * Write DEBUG log\n * @method\n * @memeberof Logger\n * @param {string|object} msg - Logging message or object\n */\n ConsoleLogger.prototype.debug = function () {\n var msg = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n msg[_i] = arguments[_i];\n }\n this._log.apply(this, __spread([LOG_TYPE.DEBUG], msg));\n };\n /**\n * Write VERBOSE log\n * @method\n * @memeberof Logger\n * @param {string|object} msg - Logging message or object\n */\n ConsoleLogger.prototype.verbose = function () {\n var msg = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n msg[_i] = arguments[_i];\n }\n this._log.apply(this, __spread([LOG_TYPE.VERBOSE], msg));\n };\n ConsoleLogger.prototype.addPluggable = function (pluggable) {\n if (pluggable && pluggable.getCategoryName() === AWS_CLOUDWATCH_CATEGORY) {\n this._pluggables.push(pluggable);\n pluggable.configure(this._config);\n }\n };\n ConsoleLogger.prototype.listPluggables = function () {\n return this._pluggables;\n };\n ConsoleLogger.LOG_LEVEL = null;\n return ConsoleLogger;\n}());\nexport { ConsoleLogger };\n//# sourceMappingURL=ConsoleLogger.js.map","/*\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spread = (this && this.__spread) || function () {\n for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));\n return ar;\n};\nimport { ConsoleLogger as Logger } from './Logger';\nvar logger = new Logger('Hub');\nvar AMPLIFY_SYMBOL = (typeof Symbol !== 'undefined' &&\n typeof Symbol.for === 'function'\n ? Symbol.for('amplify_default')\n : '@@amplify_default');\nfunction isLegacyCallback(callback) {\n return callback.onHubCapsule !== undefined;\n}\nvar HubClass = /** @class */ (function () {\n function HubClass(name) {\n this.listeners = [];\n this.patterns = [];\n this.protectedChannels = [\n 'core',\n 'auth',\n 'api',\n 'analytics',\n 'interactions',\n 'pubsub',\n 'storage',\n 'ui',\n 'xr',\n ];\n this.name = name;\n }\n // Note - Need to pass channel as a reference for removal to work and not anonymous function\n HubClass.prototype.remove = function (channel, listener) {\n if (channel instanceof RegExp) {\n var pattern_1 = this.patterns.find(function (_a) {\n var pattern = _a.pattern;\n return pattern.source === channel.source;\n });\n if (!pattern_1) {\n logger.warn(\"No listeners for \" + channel);\n return;\n }\n this.patterns = __spread(this.patterns.filter(function (x) { return x !== pattern_1; }));\n }\n else {\n var holder = this.listeners[channel];\n if (!holder) {\n logger.warn(\"No listeners for \" + channel);\n return;\n }\n this.listeners[channel] = __spread(holder.filter(function (_a) {\n var callback = _a.callback;\n return callback !== listener;\n }));\n }\n };\n HubClass.prototype.dispatch = function (channel, payload, source, ampSymbol) {\n if (source === void 0) { source = ''; }\n if (this.protectedChannels.indexOf(channel) > -1) {\n var hasAccess = ampSymbol === AMPLIFY_SYMBOL;\n if (!hasAccess) {\n logger.warn(\"WARNING: \" + channel + \" is protected and dispatching on it can have unintended consequences\");\n }\n }\n var capsule = {\n channel: channel,\n payload: __assign({}, payload),\n source: source,\n patternInfo: [],\n };\n try {\n this._toListeners(capsule);\n }\n catch (e) {\n logger.error(e);\n }\n };\n HubClass.prototype.listen = function (channel, callback, listenerName) {\n var _this = this;\n if (listenerName === void 0) { listenerName = 'noname'; }\n var cb;\n // Check for legacy onHubCapsule callback for backwards compatability\n if (isLegacyCallback(callback)) {\n logger.warn(\"WARNING onHubCapsule is Deprecated. Please pass in a callback.\");\n cb = callback.onHubCapsule.bind(callback);\n }\n else if (typeof callback !== 'function') {\n throw new Error('No callback supplied to Hub');\n }\n else {\n cb = callback;\n }\n if (channel instanceof RegExp) {\n this.patterns.push({\n pattern: channel,\n callback: cb,\n });\n }\n else {\n var holder = this.listeners[channel];\n if (!holder) {\n holder = [];\n this.listeners[channel] = holder;\n }\n holder.push({\n name: listenerName,\n callback: cb,\n });\n }\n return function () {\n _this.remove(channel, cb);\n };\n };\n HubClass.prototype._toListeners = function (capsule) {\n var channel = capsule.channel, payload = capsule.payload;\n var holder = this.listeners[channel];\n if (holder) {\n holder.forEach(function (listener) {\n logger.debug(\"Dispatching to \" + channel + \" with \", payload);\n try {\n listener.callback(capsule);\n }\n catch (e) {\n logger.error(e);\n }\n });\n }\n if (this.patterns.length > 0) {\n if (!payload.message) {\n logger.warn(\"Cannot perform pattern matching without a message key\");\n return;\n }\n var payloadStr_1 = payload.message;\n this.patterns.forEach(function (pattern) {\n var match = payloadStr_1.match(pattern.pattern);\n if (match) {\n var _a = __read(match), groups = _a.slice(1);\n var dispatchingCapsule = __assign(__assign({}, capsule), { patternInfo: groups });\n try {\n pattern.callback(dispatchingCapsule);\n }\n catch (e) {\n logger.error(e);\n }\n }\n });\n }\n };\n return HubClass;\n}());\nexport { HubClass };\n/*We export a __default__ instance of HubClass to use it as a\npseudo Singleton for the main messaging bus, however you can still create\nyour own instance of HubClass() for a separate \"private bus\" of events.*/\nexport var Hub = new HubClass('__default__');\n/**\n * @deprecated use named import\n */\nexport default Hub;\n//# sourceMappingURL=Hub.js.map","/*\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nvar dataMemory = {};\n/** @class */\nvar MemoryStorage = /** @class */ (function () {\n function MemoryStorage() {\n }\n /**\n * This is used to set a specific item in storage\n * @param {string} key - the key for the item\n * @param {object} value - the value\n * @returns {string} value that was set\n */\n MemoryStorage.setItem = function (key, value) {\n dataMemory[key] = value;\n return dataMemory[key];\n };\n /**\n * This is used to get a specific key from storage\n * @param {string} key - the key for the item\n * This is used to clear the storage\n * @returns {string} the data item\n */\n MemoryStorage.getItem = function (key) {\n return Object.prototype.hasOwnProperty.call(dataMemory, key)\n ? dataMemory[key]\n : undefined;\n };\n /**\n * This is used to remove an item from storage\n * @param {string} key - the key being set\n * @returns {string} value - value that was deleted\n */\n MemoryStorage.removeItem = function (key) {\n return delete dataMemory[key];\n };\n /**\n * This is used to clear the storage\n * @returns {string} nothing\n */\n MemoryStorage.clear = function () {\n dataMemory = {};\n return dataMemory;\n };\n return MemoryStorage;\n}());\nexport { MemoryStorage };\nvar StorageHelper = /** @class */ (function () {\n /**\n * This is used to get a storage object\n * @returns {object} the storage\n */\n function StorageHelper() {\n try {\n this.storageWindow = window.localStorage;\n this.storageWindow.setItem('aws.amplify.test-ls', 1);\n this.storageWindow.removeItem('aws.amplify.test-ls');\n }\n catch (exception) {\n this.storageWindow = MemoryStorage;\n }\n }\n /**\n * This is used to return the storage\n * @returns {object} the storage\n */\n StorageHelper.prototype.getStorage = function () {\n return this.storageWindow;\n };\n return StorageHelper;\n}());\nexport { StorageHelper };\n/**\n * @deprecated use named import\n */\nexport default StorageHelper;\n//# sourceMappingURL=index.js.map","/*\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nvar MIME_MAP = [\n { type: 'text/plain', ext: 'txt' },\n { type: 'text/html', ext: 'html' },\n { type: 'text/javascript', ext: 'js' },\n { type: 'text/css', ext: 'css' },\n { type: 'text/csv', ext: 'csv' },\n { type: 'text/yaml', ext: 'yml' },\n { type: 'text/yaml', ext: 'yaml' },\n { type: 'text/calendar', ext: 'ics' },\n { type: 'text/calendar', ext: 'ical' },\n { type: 'image/apng', ext: 'apng' },\n { type: 'image/bmp', ext: 'bmp' },\n { type: 'image/gif', ext: 'gif' },\n { type: 'image/x-icon', ext: 'ico' },\n { type: 'image/x-icon', ext: 'cur' },\n { type: 'image/jpeg', ext: 'jpg' },\n { type: 'image/jpeg', ext: 'jpeg' },\n { type: 'image/jpeg', ext: 'jfif' },\n { type: 'image/jpeg', ext: 'pjp' },\n { type: 'image/jpeg', ext: 'pjpeg' },\n { type: 'image/png', ext: 'png' },\n { type: 'image/svg+xml', ext: 'svg' },\n { type: 'image/tiff', ext: 'tif' },\n { type: 'image/tiff', ext: 'tiff' },\n { type: 'image/webp', ext: 'webp' },\n { type: 'application/json', ext: 'json' },\n { type: 'application/xml', ext: 'xml' },\n { type: 'application/x-sh', ext: 'sh' },\n { type: 'application/zip', ext: 'zip' },\n { type: 'application/x-rar-compressed', ext: 'rar' },\n { type: 'application/x-tar', ext: 'tar' },\n { type: 'application/x-bzip', ext: 'bz' },\n { type: 'application/x-bzip2', ext: 'bz2' },\n { type: 'application/pdf', ext: 'pdf' },\n { type: 'application/java-archive', ext: 'jar' },\n { type: 'application/msword', ext: 'doc' },\n { type: 'application/vnd.ms-excel', ext: 'xls' },\n { type: 'application/vnd.ms-excel', ext: 'xlsx' },\n { type: 'message/rfc822', ext: 'eml' },\n];\nexport var isEmpty = function (obj) {\n if (obj === void 0) { obj = {}; }\n return Object.keys(obj).length === 0;\n};\nexport var sortByField = function (list, field, dir) {\n if (!list || !list.sort) {\n return false;\n }\n var dirX = dir && dir === 'desc' ? -1 : 1;\n list.sort(function (a, b) {\n var a_val = a[field];\n var b_val = b[field];\n if (typeof b_val === 'undefined') {\n return typeof a_val === 'undefined' ? 0 : 1 * dirX;\n }\n if (typeof a_val === 'undefined') {\n return -1 * dirX;\n }\n if (a_val < b_val) {\n return -1 * dirX;\n }\n if (a_val > b_val) {\n return 1 * dirX;\n }\n return 0;\n });\n return true;\n};\nexport var objectLessAttributes = function (obj, less) {\n var ret = Object.assign({}, obj);\n if (less) {\n if (typeof less === 'string') {\n delete ret[less];\n }\n else {\n less.forEach(function (attr) {\n delete ret[attr];\n });\n }\n }\n return ret;\n};\nexport var filenameToContentType = function (filename, defVal) {\n if (defVal === void 0) { defVal = 'application/octet-stream'; }\n var name = filename.toLowerCase();\n var filtered = MIME_MAP.filter(function (mime) { return name.endsWith('.' + mime.ext); });\n return filtered.length > 0 ? filtered[0].type : defVal;\n};\nexport var isTextFile = function (contentType) {\n var type = contentType.toLowerCase();\n if (type.startsWith('text/')) {\n return true;\n }\n return ('application/json' === type ||\n 'application/xml' === type ||\n 'application/sh' === type);\n};\nexport var generateRandomString = function () {\n var result = '';\n var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';\n for (var i = 32; i > 0; i -= 1) {\n result += chars[Math.floor(Math.random() * chars.length)];\n }\n return result;\n};\nexport var makeQuerablePromise = function (promise) {\n if (promise.isResolved)\n return promise;\n var isPending = true;\n var isRejected = false;\n var isFullfilled = false;\n var result = promise.then(function (data) {\n isFullfilled = true;\n isPending = false;\n return data;\n }, function (e) {\n isRejected = true;\n isPending = false;\n throw e;\n });\n result.isFullfilled = function () { return isFullfilled; };\n result.isPending = function () { return isPending; };\n result.isRejected = function () { return isRejected; };\n return result;\n};\nexport var isWebWorker = function () {\n if (typeof self === 'undefined') {\n return false;\n }\n var selfContext = self;\n return typeof selfContext.WorkerGlobalScope !== 'undefined' &&\n self instanceof selfContext.WorkerGlobalScope;\n};\nexport var browserOrNode = function () {\n var isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';\n var isNode = typeof process !== 'undefined' &&\n process.versions != null &&\n process.versions.node != null;\n return {\n isBrowser: isBrowser,\n isNode: isNode,\n };\n};\n/**\n * transfer the first letter of the keys to lowercase\n * @param {Object} obj - the object need to be transferred\n * @param {Array} whiteListForItself - whitelist itself from being transferred\n * @param {Array} whiteListForChildren - whitelist its children keys from being transferred\n */\nexport var transferKeyToLowerCase = function (obj, whiteListForItself, whiteListForChildren) {\n if (whiteListForItself === void 0) { whiteListForItself = []; }\n if (whiteListForChildren === void 0) { whiteListForChildren = []; }\n if (!isStrictObject(obj))\n return obj;\n var ret = {};\n for (var key in obj) {\n if (obj.hasOwnProperty(key)) {\n var transferedKey = whiteListForItself.includes(key)\n ? key\n : key[0].toLowerCase() + key.slice(1);\n ret[transferedKey] = whiteListForChildren.includes(key)\n ? obj[key]\n : transferKeyToLowerCase(obj[key], whiteListForItself, whiteListForChildren);\n }\n }\n return ret;\n};\n/**\n * transfer the first letter of the keys to lowercase\n * @param {Object} obj - the object need to be transferred\n * @param {Array} whiteListForItself - whitelist itself from being transferred\n * @param {Array} whiteListForChildren - whitelist its children keys from being transferred\n */\nexport var transferKeyToUpperCase = function (obj, whiteListForItself, whiteListForChildren) {\n if (whiteListForItself === void 0) { whiteListForItself = []; }\n if (whiteListForChildren === void 0) { whiteListForChildren = []; }\n if (!isStrictObject(obj))\n return obj;\n var ret = {};\n for (var key in obj) {\n if (obj.hasOwnProperty(key)) {\n var transferredKey = whiteListForItself.includes(key)\n ? key\n : key[0].toUpperCase() + key.slice(1);\n ret[transferredKey] = whiteListForChildren.includes(key)\n ? obj[key]\n : transferKeyToUpperCase(obj[key], whiteListForItself, whiteListForChildren);\n }\n }\n return ret;\n};\n/**\n * Return true if the object is a strict object\n * which means it's not Array, Function, Number, String, Boolean or Null\n * @param obj the Object\n */\nexport var isStrictObject = function (obj) {\n return (obj instanceof Object &&\n !(obj instanceof Array) &&\n !(obj instanceof Function) &&\n !(obj instanceof Number) &&\n !(obj instanceof String) &&\n !(obj instanceof Boolean));\n};\n/**\n * @deprecated use per-function imports\n */\nvar JS = /** @class */ (function () {\n function JS() {\n }\n JS.isEmpty = isEmpty;\n JS.sortByField = sortByField;\n JS.objectLessAttributes = objectLessAttributes;\n JS.filenameToContentType = filenameToContentType;\n JS.isTextFile = isTextFile;\n JS.generateRandomString = generateRandomString;\n JS.makeQuerablePromise = makeQuerablePromise;\n JS.isWebWorker = isWebWorker;\n JS.browserOrNode = browserOrNode;\n JS.transferKeyToLowerCase = transferKeyToLowerCase;\n JS.transferKeyToUpperCase = transferKeyToUpperCase;\n JS.isStrictObject = isStrictObject;\n return JS;\n}());\nexport { JS };\n/**\n * @deprecated use per-function imports\n */\nexport default JS;\n//# sourceMappingURL=JS.js.map","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\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 __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spread = (this && this.__spread) || function () {\n for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));\n return ar;\n};\nimport { ConsoleLogger as Logger } from '../Logger/ConsoleLogger';\nvar logger = new Logger('Util');\nvar NonRetryableError = /** @class */ (function (_super) {\n __extends(NonRetryableError, _super);\n function NonRetryableError(message) {\n var _this = _super.call(this, message) || this;\n _this.nonRetryable = true;\n return _this;\n }\n return NonRetryableError;\n}(Error));\nexport { NonRetryableError };\nvar isNonRetryableError = function (obj) {\n var key = 'nonRetryable';\n return obj && obj[key];\n};\n/**\n * @private\n * Internal use of Amplify only\n */\nexport function retry(functionToRetry, args, delayFn, attempt) {\n if (attempt === void 0) { attempt = 1; }\n return __awaiter(this, void 0, void 0, function () {\n var err_1, retryIn_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (typeof functionToRetry !== 'function') {\n throw Error('functionToRetry must be a function');\n }\n logger.debug(functionToRetry.name + \" attempt #\" + attempt + \" with this vars: \" + JSON.stringify(args));\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 8]);\n return [4 /*yield*/, functionToRetry.apply(void 0, __spread(args))];\n case 2: return [2 /*return*/, _a.sent()];\n case 3:\n err_1 = _a.sent();\n logger.debug(\"error on \" + functionToRetry.name, err_1);\n if (isNonRetryableError(err_1)) {\n logger.debug(functionToRetry.name + \" non retryable error\", err_1);\n throw err_1;\n }\n retryIn_1 = delayFn(attempt, args, err_1);\n logger.debug(functionToRetry.name + \" retrying in \" + retryIn_1 + \" ms\");\n if (!(retryIn_1 !== false)) return [3 /*break*/, 6];\n return [4 /*yield*/, new Promise(function (res) { return setTimeout(res, retryIn_1); })];\n case 4:\n _a.sent();\n return [4 /*yield*/, retry(functionToRetry, args, delayFn, attempt + 1)];\n case 5: return [2 /*return*/, _a.sent()];\n case 6: throw err_1;\n case 7: return [3 /*break*/, 8];\n case 8: return [2 /*return*/];\n }\n });\n });\n}\nvar MAX_DELAY_MS = 5 * 60 * 1000;\n/**\n * @private\n * Internal use of Amplify only\n */\nexport function jitteredBackoff(maxDelayMs) {\n if (maxDelayMs === void 0) { maxDelayMs = MAX_DELAY_MS; }\n var BASE_TIME_MS = 100;\n var JITTER_FACTOR = 100;\n return function (attempt) {\n var delay = Math.pow(2, attempt) * BASE_TIME_MS + JITTER_FACTOR * Math.random();\n return delay > maxDelayMs ? false : delay;\n };\n}\n/**\n * @private\n * Internal use of Amplify only\n */\nexport var jitteredExponentialRetry = function (functionToRetry, args, maxDelayMs) {\n if (maxDelayMs === void 0) { maxDelayMs = MAX_DELAY_MS; }\n return retry(functionToRetry, args, jitteredBackoff(maxDelayMs));\n};\n//# sourceMappingURL=Retry.js.map","var __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 __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\n/*\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nimport { ConsoleLogger as Logger } from '../Logger';\nimport { browserOrNode } from '../JS';\nimport { NonRetryableError } from '../Util';\nvar logger = new Logger('CognitoCredentials');\nvar waitForInit = new Promise(function (res, rej) {\n if (!browserOrNode().isBrowser) {\n logger.debug('not in the browser, directly resolved');\n return res();\n }\n var ga = window['gapi'] && window['gapi'].auth2 ? window['gapi'].auth2 : null;\n if (ga) {\n logger.debug('google api already loaded');\n return res();\n }\n else {\n setTimeout(function () {\n return res();\n }, 2000);\n }\n});\nvar GoogleOAuth = /** @class */ (function () {\n function GoogleOAuth() {\n this.initialized = false;\n this.refreshGoogleToken = this.refreshGoogleToken.bind(this);\n this._refreshGoogleTokenImpl = this._refreshGoogleTokenImpl.bind(this);\n }\n GoogleOAuth.prototype.refreshGoogleToken = function () {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!!this.initialized) return [3 /*break*/, 2];\n logger.debug('need to wait for the Google SDK loaded');\n return [4 /*yield*/, waitForInit];\n case 1:\n _a.sent();\n this.initialized = true;\n logger.debug('finish waiting');\n _a.label = 2;\n case 2: return [2 /*return*/, this._refreshGoogleTokenImpl()];\n }\n });\n });\n };\n GoogleOAuth.prototype._refreshGoogleTokenImpl = function () {\n var ga = null;\n if (browserOrNode().isBrowser)\n ga = window['gapi'] && window['gapi'].auth2 ? window['gapi'].auth2 : null;\n if (!ga) {\n logger.debug('no gapi auth2 available');\n return Promise.reject('no gapi auth2 available');\n }\n return new Promise(function (res, rej) {\n ga.getAuthInstance()\n .then(function (googleAuth) {\n if (!googleAuth) {\n logger.debug('google Auth undefined');\n rej(new NonRetryableError('google Auth undefined'));\n }\n var googleUser = googleAuth.currentUser.get();\n // refresh the token\n if (googleUser.isSignedIn()) {\n logger.debug('refreshing the google access token');\n googleUser\n .reloadAuthResponse()\n .then(function (authResponse) {\n var id_token = authResponse.id_token, expires_at = authResponse.expires_at;\n res({ token: id_token, expires_at: expires_at });\n })\n .catch(function (err) {\n if (err && err.error === 'network_error') {\n // Not using NonRetryableError so handler will be retried\n rej('Network error reloading google auth response');\n }\n else {\n rej(new NonRetryableError('Failed to reload google auth response'));\n }\n });\n }\n else {\n rej(new NonRetryableError('User is not signed in with Google'));\n }\n })\n .catch(function (err) {\n logger.debug('Failed to refresh google token', err);\n rej(new NonRetryableError('Failed to refresh google token'));\n });\n });\n };\n return GoogleOAuth;\n}());\nexport { GoogleOAuth };\n/**\n * @deprecated use named import\n */\nexport default GoogleOAuth;\n//# sourceMappingURL=GoogleOAuth.js.map","var __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 __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\n/*\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nimport { ConsoleLogger as Logger } from '../Logger';\nimport { browserOrNode } from '../JS';\nimport { NonRetryableError } from '../Util';\nvar logger = new Logger('CognitoCredentials');\nvar waitForInit = new Promise(function (res, rej) {\n if (!browserOrNode().isBrowser) {\n logger.debug('not in the browser, directly resolved');\n return res();\n }\n var fb = window['FB'];\n if (fb) {\n logger.debug('FB SDK already loaded');\n return res();\n }\n else {\n setTimeout(function () {\n return res();\n }, 2000);\n }\n});\nvar FacebookOAuth = /** @class */ (function () {\n function FacebookOAuth() {\n this.initialized = false;\n this.refreshFacebookToken = this.refreshFacebookToken.bind(this);\n this._refreshFacebookTokenImpl = this._refreshFacebookTokenImpl.bind(this);\n }\n FacebookOAuth.prototype.refreshFacebookToken = function () {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!!this.initialized) return [3 /*break*/, 2];\n logger.debug('need to wait for the Facebook SDK loaded');\n return [4 /*yield*/, waitForInit];\n case 1:\n _a.sent();\n this.initialized = true;\n logger.debug('finish waiting');\n _a.label = 2;\n case 2: return [2 /*return*/, this._refreshFacebookTokenImpl()];\n }\n });\n });\n };\n FacebookOAuth.prototype._refreshFacebookTokenImpl = function () {\n var fb = null;\n if (browserOrNode().isBrowser)\n fb = window['FB'];\n if (!fb) {\n var errorMessage = 'no fb sdk available';\n logger.debug(errorMessage);\n return Promise.reject(new NonRetryableError(errorMessage));\n }\n return new Promise(function (res, rej) {\n fb.getLoginStatus(function (fbResponse) {\n if (!fbResponse || !fbResponse.authResponse) {\n var errorMessage = 'no response from facebook when refreshing the jwt token';\n logger.debug(errorMessage);\n // There is no definitive indication for a network error in\n // fbResponse, so we are treating it as an invalid token.\n rej(new NonRetryableError(errorMessage));\n }\n else {\n var response = fbResponse.authResponse;\n var accessToken = response.accessToken, expiresIn = response.expiresIn;\n var date = new Date();\n var expires_at = expiresIn * 1000 + date.getTime();\n if (!accessToken) {\n var errorMessage = 'the jwtToken is undefined';\n logger.debug(errorMessage);\n rej(new NonRetryableError(errorMessage));\n }\n res({\n token: accessToken,\n expires_at: expires_at,\n });\n }\n }, { scope: 'public_profile,email' });\n });\n };\n return FacebookOAuth;\n}());\nexport { FacebookOAuth };\n/**\n * @deprecated use named import\n */\nexport default FacebookOAuth;\n//# sourceMappingURL=FacebookOAuth.js.map","/*\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nimport { GoogleOAuth as GoogleOAuthClass } from './GoogleOAuth';\nimport { FacebookOAuth as FacebookOAuthClass } from './FacebookOAuth';\nexport var GoogleOAuth = new GoogleOAuthClass();\nexport var FacebookOAuth = new FacebookOAuthClass();\n//# sourceMappingURL=index.js.map","/*\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nimport { version } from './version';\nvar BASE_USER_AGENT = \"aws-amplify/\" + version;\nexport var Platform = {\n userAgent: BASE_USER_AGENT + \" js\",\n product: '',\n navigator: null,\n isReactNative: false,\n};\nif (typeof navigator !== 'undefined' && navigator.product) {\n Platform.product = navigator.product || '';\n Platform.navigator = navigator || null;\n switch (navigator.product) {\n case 'ReactNative':\n Platform.userAgent = BASE_USER_AGENT + \" react-native\";\n Platform.isReactNative = true;\n break;\n default:\n Platform.userAgent = BASE_USER_AGENT + \" js\";\n Platform.isReactNative = false;\n break;\n }\n}\nexport var getAmplifyUserAgent = function () {\n return Platform.userAgent;\n};\n/**\n * @deprecated use named import\n */\nexport default Platform;\n//# sourceMappingURL=index.js.map","var __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nimport { ConsoleLogger as LoggerClass } from './Logger';\nvar logger = new LoggerClass('Amplify');\nvar AmplifyClass = /** @class */ (function () {\n function AmplifyClass() {\n // Everything that is `register`ed is tracked here\n this._components = [];\n this._config = {};\n // All modules (with `getModuleName()`) are stored here for dependency injection\n this._modules = {};\n // for backward compatibility to avoid breaking change\n // if someone is using like Amplify.Auth\n this.Auth = null;\n this.Analytics = null;\n this.API = null;\n this.Credentials = null;\n this.Storage = null;\n this.I18n = null;\n this.Cache = null;\n this.PubSub = null;\n this.Interactions = null;\n this.Pushnotification = null;\n this.UI = null;\n this.XR = null;\n this.Predictions = null;\n this.DataStore = null;\n this.Geo = null;\n this.Logger = LoggerClass;\n this.ServiceWorker = null;\n }\n AmplifyClass.prototype.register = function (comp) {\n logger.debug('component registered in amplify', comp);\n this._components.push(comp);\n if (typeof comp.getModuleName === 'function') {\n this._modules[comp.getModuleName()] = comp;\n this[comp.getModuleName()] = comp;\n }\n else {\n logger.debug('no getModuleName method for component', comp);\n }\n // Finally configure this new component(category) loaded\n // With the new modularization changes in Amplify V3, all the Amplify\n // component are not loaded/registered right away but when they are\n // imported (and hence instantiated) in the client's app. This ensures\n // that all new components imported get correctly configured with the\n // configuration that Amplify.configure() was called with.\n comp.configure(this._config);\n };\n AmplifyClass.prototype.configure = function (config) {\n var _this = this;\n if (!config)\n return this._config;\n this._config = Object.assign(this._config, config);\n logger.debug('amplify config', this._config);\n // Dependency Injection via property-setting.\n // This avoids introducing a public method/interface/setter that's difficult to remove later.\n // Plus, it reduces `if` statements within the `constructor` and `configure` of each module\n Object.entries(this._modules).forEach(function (_a) {\n var _b = __read(_a, 2), Name = _b[0], comp = _b[1];\n // e.g. Auth.*\n Object.keys(comp).forEach(function (property) {\n // e.g. Auth[\"Credentials\"] = this._modules[\"Credentials\"] when set\n if (_this._modules[property]) {\n comp[property] = _this._modules[property];\n }\n });\n });\n this._components.map(function (comp) {\n comp.configure(_this._config);\n });\n return this._config;\n };\n AmplifyClass.prototype.addPluggable = function (pluggable) {\n if (pluggable &&\n pluggable['getCategory'] &&\n typeof pluggable['getCategory'] === 'function') {\n this._components.map(function (comp) {\n if (comp['addPluggable'] &&\n typeof comp['addPluggable'] === 'function') {\n comp.addPluggable(pluggable);\n }\n });\n }\n };\n return AmplifyClass;\n}());\nexport { AmplifyClass };\nexport var Amplify = new AmplifyClass();\n/**\n * @deprecated use named import\n */\nexport default Amplify;\n//# sourceMappingURL=Amplify.js.map","/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\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) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\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) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n","import { __assign } from \"tslib\";\nexport var AmbiguousRoleResolutionType;\n(function (AmbiguousRoleResolutionType) {\n AmbiguousRoleResolutionType[\"AUTHENTICATED_ROLE\"] = \"AuthenticatedRole\";\n AmbiguousRoleResolutionType[\"DENY\"] = \"Deny\";\n})(AmbiguousRoleResolutionType || (AmbiguousRoleResolutionType = {}));\nexport var CognitoIdentityProvider;\n(function (CognitoIdentityProvider) {\n CognitoIdentityProvider.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(CognitoIdentityProvider || (CognitoIdentityProvider = {}));\nexport var CreateIdentityPoolInput;\n(function (CreateIdentityPoolInput) {\n CreateIdentityPoolInput.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(CreateIdentityPoolInput || (CreateIdentityPoolInput = {}));\nexport var IdentityPool;\n(function (IdentityPool) {\n IdentityPool.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(IdentityPool || (IdentityPool = {}));\nexport var InternalErrorException;\n(function (InternalErrorException) {\n InternalErrorException.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(InternalErrorException || (InternalErrorException = {}));\nexport var InvalidParameterException;\n(function (InvalidParameterException) {\n InvalidParameterException.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(InvalidParameterException || (InvalidParameterException = {}));\nexport var LimitExceededException;\n(function (LimitExceededException) {\n LimitExceededException.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(LimitExceededException || (LimitExceededException = {}));\nexport var NotAuthorizedException;\n(function (NotAuthorizedException) {\n NotAuthorizedException.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(NotAuthorizedException || (NotAuthorizedException = {}));\nexport var ResourceConflictException;\n(function (ResourceConflictException) {\n ResourceConflictException.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(ResourceConflictException || (ResourceConflictException = {}));\nexport var TooManyRequestsException;\n(function (TooManyRequestsException) {\n TooManyRequestsException.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(TooManyRequestsException || (TooManyRequestsException = {}));\nexport var DeleteIdentitiesInput;\n(function (DeleteIdentitiesInput) {\n DeleteIdentitiesInput.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(DeleteIdentitiesInput || (DeleteIdentitiesInput = {}));\nexport var ErrorCode;\n(function (ErrorCode) {\n ErrorCode[\"ACCESS_DENIED\"] = \"AccessDenied\";\n ErrorCode[\"INTERNAL_SERVER_ERROR\"] = \"InternalServerError\";\n})(ErrorCode || (ErrorCode = {}));\nexport var UnprocessedIdentityId;\n(function (UnprocessedIdentityId) {\n UnprocessedIdentityId.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(UnprocessedIdentityId || (UnprocessedIdentityId = {}));\nexport var DeleteIdentitiesResponse;\n(function (DeleteIdentitiesResponse) {\n DeleteIdentitiesResponse.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(DeleteIdentitiesResponse || (DeleteIdentitiesResponse = {}));\nexport var DeleteIdentityPoolInput;\n(function (DeleteIdentityPoolInput) {\n DeleteIdentityPoolInput.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(DeleteIdentityPoolInput || (DeleteIdentityPoolInput = {}));\nexport var ResourceNotFoundException;\n(function (ResourceNotFoundException) {\n ResourceNotFoundException.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(ResourceNotFoundException || (ResourceNotFoundException = {}));\nexport var DescribeIdentityInput;\n(function (DescribeIdentityInput) {\n DescribeIdentityInput.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(DescribeIdentityInput || (DescribeIdentityInput = {}));\nexport var IdentityDescription;\n(function (IdentityDescription) {\n IdentityDescription.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(IdentityDescription || (IdentityDescription = {}));\nexport var DescribeIdentityPoolInput;\n(function (DescribeIdentityPoolInput) {\n DescribeIdentityPoolInput.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(DescribeIdentityPoolInput || (DescribeIdentityPoolInput = {}));\nexport var ExternalServiceException;\n(function (ExternalServiceException) {\n ExternalServiceException.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(ExternalServiceException || (ExternalServiceException = {}));\nexport var GetCredentialsForIdentityInput;\n(function (GetCredentialsForIdentityInput) {\n GetCredentialsForIdentityInput.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(GetCredentialsForIdentityInput || (GetCredentialsForIdentityInput = {}));\nexport var Credentials;\n(function (Credentials) {\n Credentials.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(Credentials || (Credentials = {}));\nexport var GetCredentialsForIdentityResponse;\n(function (GetCredentialsForIdentityResponse) {\n GetCredentialsForIdentityResponse.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(GetCredentialsForIdentityResponse || (GetCredentialsForIdentityResponse = {}));\nexport var InvalidIdentityPoolConfigurationException;\n(function (InvalidIdentityPoolConfigurationException) {\n InvalidIdentityPoolConfigurationException.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(InvalidIdentityPoolConfigurationException || (InvalidIdentityPoolConfigurationException = {}));\nexport var GetIdInput;\n(function (GetIdInput) {\n GetIdInput.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(GetIdInput || (GetIdInput = {}));\nexport var GetIdResponse;\n(function (GetIdResponse) {\n GetIdResponse.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(GetIdResponse || (GetIdResponse = {}));\nexport var GetIdentityPoolRolesInput;\n(function (GetIdentityPoolRolesInput) {\n GetIdentityPoolRolesInput.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(GetIdentityPoolRolesInput || (GetIdentityPoolRolesInput = {}));\nexport var MappingRuleMatchType;\n(function (MappingRuleMatchType) {\n MappingRuleMatchType[\"CONTAINS\"] = \"Contains\";\n MappingRuleMatchType[\"EQUALS\"] = \"Equals\";\n MappingRuleMatchType[\"NOT_EQUAL\"] = \"NotEqual\";\n MappingRuleMatchType[\"STARTS_WITH\"] = \"StartsWith\";\n})(MappingRuleMatchType || (MappingRuleMatchType = {}));\nexport var MappingRule;\n(function (MappingRule) {\n MappingRule.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(MappingRule || (MappingRule = {}));\nexport var RulesConfigurationType;\n(function (RulesConfigurationType) {\n RulesConfigurationType.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(RulesConfigurationType || (RulesConfigurationType = {}));\nexport var RoleMappingType;\n(function (RoleMappingType) {\n RoleMappingType[\"RULES\"] = \"Rules\";\n RoleMappingType[\"TOKEN\"] = \"Token\";\n})(RoleMappingType || (RoleMappingType = {}));\nexport var RoleMapping;\n(function (RoleMapping) {\n RoleMapping.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(RoleMapping || (RoleMapping = {}));\nexport var GetIdentityPoolRolesResponse;\n(function (GetIdentityPoolRolesResponse) {\n GetIdentityPoolRolesResponse.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(GetIdentityPoolRolesResponse || (GetIdentityPoolRolesResponse = {}));\nexport var GetOpenIdTokenInput;\n(function (GetOpenIdTokenInput) {\n GetOpenIdTokenInput.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(GetOpenIdTokenInput || (GetOpenIdTokenInput = {}));\nexport var GetOpenIdTokenResponse;\n(function (GetOpenIdTokenResponse) {\n GetOpenIdTokenResponse.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(GetOpenIdTokenResponse || (GetOpenIdTokenResponse = {}));\nexport var DeveloperUserAlreadyRegisteredException;\n(function (DeveloperUserAlreadyRegisteredException) {\n DeveloperUserAlreadyRegisteredException.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(DeveloperUserAlreadyRegisteredException || (DeveloperUserAlreadyRegisteredException = {}));\nexport var GetOpenIdTokenForDeveloperIdentityInput;\n(function (GetOpenIdTokenForDeveloperIdentityInput) {\n GetOpenIdTokenForDeveloperIdentityInput.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(GetOpenIdTokenForDeveloperIdentityInput || (GetOpenIdTokenForDeveloperIdentityInput = {}));\nexport var GetOpenIdTokenForDeveloperIdentityResponse;\n(function (GetOpenIdTokenForDeveloperIdentityResponse) {\n GetOpenIdTokenForDeveloperIdentityResponse.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(GetOpenIdTokenForDeveloperIdentityResponse || (GetOpenIdTokenForDeveloperIdentityResponse = {}));\nexport var ListIdentitiesInput;\n(function (ListIdentitiesInput) {\n ListIdentitiesInput.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(ListIdentitiesInput || (ListIdentitiesInput = {}));\nexport var ListIdentitiesResponse;\n(function (ListIdentitiesResponse) {\n ListIdentitiesResponse.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(ListIdentitiesResponse || (ListIdentitiesResponse = {}));\nexport var ListIdentityPoolsInput;\n(function (ListIdentityPoolsInput) {\n ListIdentityPoolsInput.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(ListIdentityPoolsInput || (ListIdentityPoolsInput = {}));\nexport var IdentityPoolShortDescription;\n(function (IdentityPoolShortDescription) {\n IdentityPoolShortDescription.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(IdentityPoolShortDescription || (IdentityPoolShortDescription = {}));\nexport var ListIdentityPoolsResponse;\n(function (ListIdentityPoolsResponse) {\n ListIdentityPoolsResponse.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(ListIdentityPoolsResponse || (ListIdentityPoolsResponse = {}));\nexport var ListTagsForResourceInput;\n(function (ListTagsForResourceInput) {\n ListTagsForResourceInput.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(ListTagsForResourceInput || (ListTagsForResourceInput = {}));\nexport var ListTagsForResourceResponse;\n(function (ListTagsForResourceResponse) {\n ListTagsForResourceResponse.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(ListTagsForResourceResponse || (ListTagsForResourceResponse = {}));\nexport var LookupDeveloperIdentityInput;\n(function (LookupDeveloperIdentityInput) {\n LookupDeveloperIdentityInput.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(LookupDeveloperIdentityInput || (LookupDeveloperIdentityInput = {}));\nexport var LookupDeveloperIdentityResponse;\n(function (LookupDeveloperIdentityResponse) {\n LookupDeveloperIdentityResponse.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(LookupDeveloperIdentityResponse || (LookupDeveloperIdentityResponse = {}));\nexport var MergeDeveloperIdentitiesInput;\n(function (MergeDeveloperIdentitiesInput) {\n MergeDeveloperIdentitiesInput.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(MergeDeveloperIdentitiesInput || (MergeDeveloperIdentitiesInput = {}));\nexport var MergeDeveloperIdentitiesResponse;\n(function (MergeDeveloperIdentitiesResponse) {\n MergeDeveloperIdentitiesResponse.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(MergeDeveloperIdentitiesResponse || (MergeDeveloperIdentitiesResponse = {}));\nexport var ConcurrentModificationException;\n(function (ConcurrentModificationException) {\n ConcurrentModificationException.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(ConcurrentModificationException || (ConcurrentModificationException = {}));\nexport var SetIdentityPoolRolesInput;\n(function (SetIdentityPoolRolesInput) {\n SetIdentityPoolRolesInput.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(SetIdentityPoolRolesInput || (SetIdentityPoolRolesInput = {}));\nexport var TagResourceInput;\n(function (TagResourceInput) {\n TagResourceInput.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(TagResourceInput || (TagResourceInput = {}));\nexport var TagResourceResponse;\n(function (TagResourceResponse) {\n TagResourceResponse.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(TagResourceResponse || (TagResourceResponse = {}));\nexport var UnlinkDeveloperIdentityInput;\n(function (UnlinkDeveloperIdentityInput) {\n UnlinkDeveloperIdentityInput.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(UnlinkDeveloperIdentityInput || (UnlinkDeveloperIdentityInput = {}));\nexport var UnlinkIdentityInput;\n(function (UnlinkIdentityInput) {\n UnlinkIdentityInput.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(UnlinkIdentityInput || (UnlinkIdentityInput = {}));\nexport var UntagResourceInput;\n(function (UntagResourceInput) {\n UntagResourceInput.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(UntagResourceInput || (UntagResourceInput = {}));\nexport var UntagResourceResponse;\n(function (UntagResourceResponse) {\n UntagResourceResponse.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };\n})(UntagResourceResponse || (UntagResourceResponse = {}));\n//# sourceMappingURL=models_0.js.map","var HttpResponse = /** @class */ (function () {\n function HttpResponse(options) {\n this.statusCode = options.statusCode;\n this.headers = options.headers || {};\n this.body = options.body;\n }\n HttpResponse.isInstance = function (response) {\n //determine if response is a valid HttpResponse\n if (!response)\n return false;\n var resp = response;\n return typeof resp.statusCode === \"number\" && typeof resp.headers === \"object\";\n };\n return HttpResponse;\n}());\nexport { HttpResponse };\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaHR0cFJlc3BvbnNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2h0dHBSZXNwb25zZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFRQTtJQUtFLHNCQUFZLE9BQTRCO1FBQ3RDLElBQUksQ0FBQyxVQUFVLEdBQUcsT0FBTyxDQUFDLFVBQVUsQ0FBQztRQUNyQyxJQUFJLENBQUMsT0FBTyxHQUFHLE9BQU8sQ0FBQyxPQUFPLElBQUksRUFBRSxDQUFDO1FBQ3JDLElBQUksQ0FBQyxJQUFJLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQztJQUMzQixDQUFDO0lBRU0sdUJBQVUsR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Jlc3BvbnNlIGlzIEh0dHBSZXNwb25zZSB7XG4gICAgLy9kZXRlcm1pbmUgaWYgcmVzcG9uc2UgaXMgYSB2YWxpZCBIdHRwUmVzcG9uc2VcbiAgICBpZiAoIXJlc3BvbnNlKSByZXR1cm4gZmFsc2U7XG4gICAgY29uc3QgcmVzcCA9IHJlc3BvbnNlIGFzIGFueTtcbiAgICByZXR1cm4gdHlwZW9mIHJlc3Auc3RhdHVzQ29kZSA9PT0gXCJudW1iZXJcIiAmJiB0eXBlb2YgcmVzcC5oZWFkZXJzID09PSBcIm9iamVjdFwiO1xuICB9XG59XG4iXX0=","import { __assign, __read, __spread } from \"tslib\";\nvar HttpRequest = /** @class */ (function () {\n function HttpRequest(options) {\n this.method = options.method || \"GET\";\n this.hostname = options.hostname || \"localhost\";\n this.port = options.port;\n this.query = options.query || {};\n this.headers = options.headers || {};\n this.body = options.body;\n this.protocol = options.protocol\n ? options.protocol.substr(-1) !== \":\"\n ? options.protocol + \":\"\n : options.protocol\n : \"https:\";\n this.path = options.path ? (options.path.charAt(0) !== \"/\" ? \"/\" + options.path : options.path) : \"/\";\n }\n HttpRequest.isInstance = function (request) {\n //determine if request is a valid httpRequest\n if (!request)\n return false;\n var req = request;\n return (\"method\" in req &&\n \"protocol\" in req &&\n \"hostname\" in req &&\n \"path\" in req &&\n typeof req[\"query\"] === \"object\" &&\n typeof req[\"headers\"] === \"object\");\n };\n HttpRequest.prototype.clone = function () {\n var cloned = new HttpRequest(__assign(__assign({}, this), { headers: __assign({}, this.headers) }));\n if (cloned.query)\n cloned.query = cloneQuery(cloned.query);\n return cloned;\n };\n return HttpRequest;\n}());\nexport { HttpRequest };\nfunction cloneQuery(query) {\n return Object.keys(query).reduce(function (carry, paramName) {\n var _a;\n var param = query[paramName];\n return __assign(__assign({}, carry), (_a = {}, _a[paramName] = Array.isArray(param) ? __spread(param) : param, _a));\n }, {});\n}\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlI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gcmVxW1wicXVlcnlcIl0gPT09IFwib2JqZWN0XCIgJiZcbiAgICAgIHR5cGVvZiByZXFbXCJoZWFkZXJzXCJdID09PSBcIm9iamVjdFwiXG4gICAgKTtcbiAgfVxuXG4gIGNsb25lKCk6IEh0dHBSZXF1ZXN0IHtcbiAgICBjb25zdCBjbG9uZWQgPSBuZXcgSHR0cFJlcXVlc3Qoe1xuICAgICAgLi4udGhpcyxcbiAgICAgIGhlYWRlcnM6IHsgLi4udGhpcy5oZWFkZXJzIH0sXG4gICAgfSk7XG4gICAgaWYgKGNsb25lZC5xdWVyeSkgY2xvbmVkLnF1ZXJ5ID0gY2xvbmVRdWVyeShjbG9uZWQucXVlcnkpO1xuICAgIHJldHVybiBjbG9uZWQ7XG4gIH1cbn1cblxuZnVuY3Rpb24gY2xvbmVRdWVyeShxdWVyeTogUXVlcnlQYXJhbWV0ZXJCYWcpOiBRdWVyeVBhcmFtZXRlckJhZyB7XG4gIHJldHVybiBPYmplY3Qua2V5cyhxdWVyeSkucmVkdWNlKChjYXJyeTogUXVlcnlQYXJhbWV0ZXJCYWcsIHBhcmFtTmFtZTogc3RyaW5nKSA9PiB7XG4gICAgY29uc3QgcGFyYW0gPSBxdWVyeVtwYXJhbU5hbWVdO1xuICAgIHJldHVybiB7XG4gICAgICAuLi5jYXJyeSxcbiAgICAgIFtwYXJhbU5hbWVdOiBBcnJheS5pc0FycmF5KHBhcmFtKSA/IFsuLi5wYXJhbV0gOiBwYXJhbSxcbiAgICB9O1xuICB9LCB7fSk7XG59XG4iXX0=","import { __assign, __awaiter, __generator, __read } from \"tslib\";\nimport { HttpRequest as __HttpRequest } from \"@aws-sdk/protocol-http\";\nexport var serializeAws_json1_1CreateIdentityPoolCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {\n var headers, body;\n return __generator(this, function (_a) {\n headers = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.CreateIdentityPool\",\n };\n body = JSON.stringify(serializeAws_json1_1CreateIdentityPoolInput(input, context));\n return [2 /*return*/, buildHttpRpcRequest(context, headers, \"/\", undefined, body)];\n });\n}); };\nexport var serializeAws_json1_1DeleteIdentitiesCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {\n var headers, body;\n return __generator(this, function (_a) {\n headers = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.DeleteIdentities\",\n };\n body = JSON.stringify(serializeAws_json1_1DeleteIdentitiesInput(input, context));\n return [2 /*return*/, buildHttpRpcRequest(context, headers, \"/\", undefined, body)];\n });\n}); };\nexport var serializeAws_json1_1DeleteIdentityPoolCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {\n var headers, body;\n return __generator(this, function (_a) {\n headers = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.DeleteIdentityPool\",\n };\n body = JSON.stringify(serializeAws_json1_1DeleteIdentityPoolInput(input, context));\n return [2 /*return*/, buildHttpRpcRequest(context, headers, \"/\", undefined, body)];\n });\n}); };\nexport var serializeAws_json1_1DescribeIdentityCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {\n var headers, body;\n return __generator(this, function (_a) {\n headers = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.DescribeIdentity\",\n };\n body = JSON.stringify(serializeAws_json1_1DescribeIdentityInput(input, context));\n return [2 /*return*/, buildHttpRpcRequest(context, headers, \"/\", undefined, body)];\n });\n}); };\nexport var serializeAws_json1_1DescribeIdentityPoolCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {\n var headers, body;\n return __generator(this, function (_a) {\n headers = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.DescribeIdentityPool\",\n };\n body = JSON.stringify(serializeAws_json1_1DescribeIdentityPoolInput(input, context));\n return [2 /*return*/, buildHttpRpcRequest(context, headers, \"/\", undefined, body)];\n });\n}); };\nexport var serializeAws_json1_1GetCredentialsForIdentityCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {\n var headers, body;\n return __generator(this, function (_a) {\n headers = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.GetCredentialsForIdentity\",\n };\n body = JSON.stringify(serializeAws_json1_1GetCredentialsForIdentityInput(input, context));\n return [2 /*return*/, buildHttpRpcRequest(context, headers, \"/\", undefined, body)];\n });\n}); };\nexport var serializeAws_json1_1GetIdCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {\n var headers, body;\n return __generator(this, function (_a) {\n headers = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.GetId\",\n };\n body = JSON.stringify(serializeAws_json1_1GetIdInput(input, context));\n return [2 /*return*/, buildHttpRpcRequest(context, headers, \"/\", undefined, body)];\n });\n}); };\nexport var serializeAws_json1_1GetIdentityPoolRolesCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {\n var headers, body;\n return __generator(this, function (_a) {\n headers = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.GetIdentityPoolRoles\",\n };\n body = JSON.stringify(serializeAws_json1_1GetIdentityPoolRolesInput(input, context));\n return [2 /*return*/, buildHttpRpcRequest(context, headers, \"/\", undefined, body)];\n });\n}); };\nexport var serializeAws_json1_1GetOpenIdTokenCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {\n var headers, body;\n return __generator(this, function (_a) {\n headers = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.GetOpenIdToken\",\n };\n body = JSON.stringify(serializeAws_json1_1GetOpenIdTokenInput(input, context));\n return [2 /*return*/, buildHttpRpcRequest(context, headers, \"/\", undefined, body)];\n });\n}); };\nexport var serializeAws_json1_1GetOpenIdTokenForDeveloperIdentityCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {\n var headers, body;\n return __generator(this, function (_a) {\n headers = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.GetOpenIdTokenForDeveloperIdentity\",\n };\n body = JSON.stringify(serializeAws_json1_1GetOpenIdTokenForDeveloperIdentityInput(input, context));\n return [2 /*return*/, buildHttpRpcRequest(context, headers, \"/\", undefined, body)];\n });\n}); };\nexport var serializeAws_json1_1ListIdentitiesCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {\n var headers, body;\n return __generator(this, function (_a) {\n headers = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.ListIdentities\",\n };\n body = JSON.stringify(serializeAws_json1_1ListIdentitiesInput(input, context));\n return [2 /*return*/, buildHttpRpcRequest(context, headers, \"/\", undefined, body)];\n });\n}); };\nexport var serializeAws_json1_1ListIdentityPoolsCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {\n var headers, body;\n return __generator(this, function (_a) {\n headers = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.ListIdentityPools\",\n };\n body = JSON.stringify(serializeAws_json1_1ListIdentityPoolsInput(input, context));\n return [2 /*return*/, buildHttpRpcRequest(context, headers, \"/\", undefined, body)];\n });\n}); };\nexport var serializeAws_json1_1ListTagsForResourceCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {\n var headers, body;\n return __generator(this, function (_a) {\n headers = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.ListTagsForResource\",\n };\n body = JSON.stringify(serializeAws_json1_1ListTagsForResourceInput(input, context));\n return [2 /*return*/, buildHttpRpcRequest(context, headers, \"/\", undefined, body)];\n });\n}); };\nexport var serializeAws_json1_1LookupDeveloperIdentityCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {\n var headers, body;\n return __generator(this, function (_a) {\n headers = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.LookupDeveloperIdentity\",\n };\n body = JSON.stringify(serializeAws_json1_1LookupDeveloperIdentityInput(input, context));\n return [2 /*return*/, buildHttpRpcRequest(context, headers, \"/\", undefined, body)];\n });\n}); };\nexport var serializeAws_json1_1MergeDeveloperIdentitiesCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {\n var headers, body;\n return __generator(this, function (_a) {\n headers = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.MergeDeveloperIdentities\",\n };\n body = JSON.stringify(serializeAws_json1_1MergeDeveloperIdentitiesInput(input, context));\n return [2 /*return*/, buildHttpRpcRequest(context, headers, \"/\", undefined, body)];\n });\n}); };\nexport var serializeAws_json1_1SetIdentityPoolRolesCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {\n var headers, body;\n return __generator(this, function (_a) {\n headers = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.SetIdentityPoolRoles\",\n };\n body = JSON.stringify(serializeAws_json1_1SetIdentityPoolRolesInput(input, context));\n return [2 /*return*/, buildHttpRpcRequest(context, headers, \"/\", undefined, body)];\n });\n}); };\nexport var serializeAws_json1_1TagResourceCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {\n var headers, body;\n return __generator(this, function (_a) {\n headers = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.TagResource\",\n };\n body = JSON.stringify(serializeAws_json1_1TagResourceInput(input, context));\n return [2 /*return*/, buildHttpRpcRequest(context, headers, \"/\", undefined, body)];\n });\n}); };\nexport var serializeAws_json1_1UnlinkDeveloperIdentityCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {\n var headers, body;\n return __generator(this, function (_a) {\n headers = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.UnlinkDeveloperIdentity\",\n };\n body = JSON.stringify(serializeAws_json1_1UnlinkDeveloperIdentityInput(input, context));\n return [2 /*return*/, buildHttpRpcRequest(context, headers, \"/\", undefined, body)];\n });\n}); };\nexport var serializeAws_json1_1UnlinkIdentityCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {\n var headers, body;\n return __generator(this, function (_a) {\n headers = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.UnlinkIdentity\",\n };\n body = JSON.stringify(serializeAws_json1_1UnlinkIdentityInput(input, context));\n return [2 /*return*/, buildHttpRpcRequest(context, headers, \"/\", undefined, body)];\n });\n}); };\nexport var serializeAws_json1_1UntagResourceCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {\n var headers, body;\n return __generator(this, function (_a) {\n headers = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.UntagResource\",\n };\n body = JSON.stringify(serializeAws_json1_1UntagResourceInput(input, context));\n return [2 /*return*/, buildHttpRpcRequest(context, headers, \"/\", undefined, body)];\n });\n}); };\nexport var serializeAws_json1_1UpdateIdentityPoolCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {\n var headers, body;\n return __generator(this, function (_a) {\n headers = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.UpdateIdentityPool\",\n };\n body = JSON.stringify(serializeAws_json1_1IdentityPool(input, context));\n return [2 /*return*/, buildHttpRpcRequest(context, headers, \"/\", undefined, body)];\n });\n}); };\nexport var deserializeAws_json1_1CreateIdentityPoolCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var data, contents, response;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (output.statusCode >= 300) {\n return [2 /*return*/, deserializeAws_json1_1CreateIdentityPoolCommandError(output, context)];\n }\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n data = _a.sent();\n contents = {};\n contents = deserializeAws_json1_1IdentityPool(data, context);\n response = __assign({ $metadata: deserializeMetadata(output) }, contents);\n return [2 /*return*/, Promise.resolve(response)];\n }\n });\n}); };\nvar deserializeAws_json1_1CreateIdentityPoolCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, _g, _h, parsedBody, message;\n var _j;\n return __generator(this, function (_k) {\n switch (_k.label) {\n case 0:\n _a = [__assign({}, output)];\n _j = {};\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n parsedOutput = __assign.apply(void 0, _a.concat([(_j.body = _k.sent(), _j)]));\n errorCode = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n _b = errorCode;\n switch (_b) {\n case \"InternalErrorException\": return [3 /*break*/, 2];\n case \"com.amazonaws.cognitoidentity#InternalErrorException\": return [3 /*break*/, 2];\n case \"InvalidParameterException\": return [3 /*break*/, 4];\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\": return [3 /*break*/, 4];\n case \"LimitExceededException\": return [3 /*break*/, 6];\n case \"com.amazonaws.cognitoidentity#LimitExceededException\": return [3 /*break*/, 6];\n case \"NotAuthorizedException\": return [3 /*break*/, 8];\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\": return [3 /*break*/, 8];\n case \"ResourceConflictException\": return [3 /*break*/, 10];\n case \"com.amazonaws.cognitoidentity#ResourceConflictException\": return [3 /*break*/, 10];\n case \"TooManyRequestsException\": return [3 /*break*/, 12];\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\": return [3 /*break*/, 12];\n }\n return [3 /*break*/, 14];\n case 2:\n _c = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)];\n case 3:\n response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 15];\n case 4:\n _d = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];\n case 5:\n response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 15];\n case 6:\n _e = [{}];\n return [4 /*yield*/, deserializeAws_json1_1LimitExceededExceptionResponse(parsedOutput, context)];\n case 7:\n response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 15];\n case 8:\n _f = [{}];\n return [4 /*yield*/, deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)];\n case 9:\n response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 15];\n case 10:\n _g = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ResourceConflictExceptionResponse(parsedOutput, context)];\n case 11:\n response = __assign.apply(void 0, [__assign.apply(void 0, _g.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 15];\n case 12:\n _h = [{}];\n return [4 /*yield*/, deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)];\n case 13:\n response = __assign.apply(void 0, [__assign.apply(void 0, _h.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 15];\n case 14:\n parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = __assign(__assign({}, parsedBody), { name: \"\" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: \"client\", $metadata: deserializeMetadata(output) });\n _k.label = 15;\n case 15:\n message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];\n }\n });\n}); };\nexport var deserializeAws_json1_1DeleteIdentitiesCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var data, contents, response;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (output.statusCode >= 300) {\n return [2 /*return*/, deserializeAws_json1_1DeleteIdentitiesCommandError(output, context)];\n }\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n data = _a.sent();\n contents = {};\n contents = deserializeAws_json1_1DeleteIdentitiesResponse(data, context);\n response = __assign({ $metadata: deserializeMetadata(output) }, contents);\n return [2 /*return*/, Promise.resolve(response)];\n }\n });\n}); };\nvar deserializeAws_json1_1DeleteIdentitiesCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, parsedBody, message;\n var _f;\n return __generator(this, function (_g) {\n switch (_g.label) {\n case 0:\n _a = [__assign({}, output)];\n _f = {};\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n parsedOutput = __assign.apply(void 0, _a.concat([(_f.body = _g.sent(), _f)]));\n errorCode = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n _b = errorCode;\n switch (_b) {\n case \"InternalErrorException\": return [3 /*break*/, 2];\n case \"com.amazonaws.cognitoidentity#InternalErrorException\": return [3 /*break*/, 2];\n case \"InvalidParameterException\": return [3 /*break*/, 4];\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\": return [3 /*break*/, 4];\n case \"TooManyRequestsException\": return [3 /*break*/, 6];\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\": return [3 /*break*/, 6];\n }\n return [3 /*break*/, 8];\n case 2:\n _c = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)];\n case 3:\n response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 9];\n case 4:\n _d = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];\n case 5:\n response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 9];\n case 6:\n _e = [{}];\n return [4 /*yield*/, deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)];\n case 7:\n response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 9];\n case 8:\n parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = __assign(__assign({}, parsedBody), { name: \"\" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: \"client\", $metadata: deserializeMetadata(output) });\n _g.label = 9;\n case 9:\n message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];\n }\n });\n}); };\nexport var deserializeAws_json1_1DeleteIdentityPoolCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var response;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (output.statusCode >= 300) {\n return [2 /*return*/, deserializeAws_json1_1DeleteIdentityPoolCommandError(output, context)];\n }\n return [4 /*yield*/, collectBody(output.body, context)];\n case 1:\n _a.sent();\n response = {\n $metadata: deserializeMetadata(output),\n };\n return [2 /*return*/, Promise.resolve(response)];\n }\n });\n}); };\nvar deserializeAws_json1_1DeleteIdentityPoolCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, _g, parsedBody, message;\n var _h;\n return __generator(this, function (_j) {\n switch (_j.label) {\n case 0:\n _a = [__assign({}, output)];\n _h = {};\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n parsedOutput = __assign.apply(void 0, _a.concat([(_h.body = _j.sent(), _h)]));\n errorCode = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n _b = errorCode;\n switch (_b) {\n case \"InternalErrorException\": return [3 /*break*/, 2];\n case \"com.amazonaws.cognitoidentity#InternalErrorException\": return [3 /*break*/, 2];\n case \"InvalidParameterException\": return [3 /*break*/, 4];\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\": return [3 /*break*/, 4];\n case \"NotAuthorizedException\": return [3 /*break*/, 6];\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\": return [3 /*break*/, 6];\n case \"ResourceNotFoundException\": return [3 /*break*/, 8];\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\": return [3 /*break*/, 8];\n case \"TooManyRequestsException\": return [3 /*break*/, 10];\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\": return [3 /*break*/, 10];\n }\n return [3 /*break*/, 12];\n case 2:\n _c = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)];\n case 3:\n response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 4:\n _d = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];\n case 5:\n response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 6:\n _e = [{}];\n return [4 /*yield*/, deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)];\n case 7:\n response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 8:\n _f = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)];\n case 9:\n response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 10:\n _g = [{}];\n return [4 /*yield*/, deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)];\n case 11:\n response = __assign.apply(void 0, [__assign.apply(void 0, _g.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 12:\n parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = __assign(__assign({}, parsedBody), { name: \"\" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: \"client\", $metadata: deserializeMetadata(output) });\n _j.label = 13;\n case 13:\n message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];\n }\n });\n}); };\nexport var deserializeAws_json1_1DescribeIdentityCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var data, contents, response;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (output.statusCode >= 300) {\n return [2 /*return*/, deserializeAws_json1_1DescribeIdentityCommandError(output, context)];\n }\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n data = _a.sent();\n contents = {};\n contents = deserializeAws_json1_1IdentityDescription(data, context);\n response = __assign({ $metadata: deserializeMetadata(output) }, contents);\n return [2 /*return*/, Promise.resolve(response)];\n }\n });\n}); };\nvar deserializeAws_json1_1DescribeIdentityCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, _g, parsedBody, message;\n var _h;\n return __generator(this, function (_j) {\n switch (_j.label) {\n case 0:\n _a = [__assign({}, output)];\n _h = {};\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n parsedOutput = __assign.apply(void 0, _a.concat([(_h.body = _j.sent(), _h)]));\n errorCode = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n _b = errorCode;\n switch (_b) {\n case \"InternalErrorException\": return [3 /*break*/, 2];\n case \"com.amazonaws.cognitoidentity#InternalErrorException\": return [3 /*break*/, 2];\n case \"InvalidParameterException\": return [3 /*break*/, 4];\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\": return [3 /*break*/, 4];\n case \"NotAuthorizedException\": return [3 /*break*/, 6];\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\": return [3 /*break*/, 6];\n case \"ResourceNotFoundException\": return [3 /*break*/, 8];\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\": return [3 /*break*/, 8];\n case \"TooManyRequestsException\": return [3 /*break*/, 10];\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\": return [3 /*break*/, 10];\n }\n return [3 /*break*/, 12];\n case 2:\n _c = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)];\n case 3:\n response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 4:\n _d = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];\n case 5:\n response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 6:\n _e = [{}];\n return [4 /*yield*/, deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)];\n case 7:\n response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 8:\n _f = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)];\n case 9:\n response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 10:\n _g = [{}];\n return [4 /*yield*/, deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)];\n case 11:\n response = __assign.apply(void 0, [__assign.apply(void 0, _g.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 12:\n parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = __assign(__assign({}, parsedBody), { name: \"\" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: \"client\", $metadata: deserializeMetadata(output) });\n _j.label = 13;\n case 13:\n message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];\n }\n });\n}); };\nexport var deserializeAws_json1_1DescribeIdentityPoolCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var data, contents, response;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (output.statusCode >= 300) {\n return [2 /*return*/, deserializeAws_json1_1DescribeIdentityPoolCommandError(output, context)];\n }\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n data = _a.sent();\n contents = {};\n contents = deserializeAws_json1_1IdentityPool(data, context);\n response = __assign({ $metadata: deserializeMetadata(output) }, contents);\n return [2 /*return*/, Promise.resolve(response)];\n }\n });\n}); };\nvar deserializeAws_json1_1DescribeIdentityPoolCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, _g, parsedBody, message;\n var _h;\n return __generator(this, function (_j) {\n switch (_j.label) {\n case 0:\n _a = [__assign({}, output)];\n _h = {};\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n parsedOutput = __assign.apply(void 0, _a.concat([(_h.body = _j.sent(), _h)]));\n errorCode = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n _b = errorCode;\n switch (_b) {\n case \"InternalErrorException\": return [3 /*break*/, 2];\n case \"com.amazonaws.cognitoidentity#InternalErrorException\": return [3 /*break*/, 2];\n case \"InvalidParameterException\": return [3 /*break*/, 4];\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\": return [3 /*break*/, 4];\n case \"NotAuthorizedException\": return [3 /*break*/, 6];\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\": return [3 /*break*/, 6];\n case \"ResourceNotFoundException\": return [3 /*break*/, 8];\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\": return [3 /*break*/, 8];\n case \"TooManyRequestsException\": return [3 /*break*/, 10];\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\": return [3 /*break*/, 10];\n }\n return [3 /*break*/, 12];\n case 2:\n _c = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)];\n case 3:\n response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 4:\n _d = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];\n case 5:\n response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 6:\n _e = [{}];\n return [4 /*yield*/, deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)];\n case 7:\n response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 8:\n _f = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)];\n case 9:\n response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 10:\n _g = [{}];\n return [4 /*yield*/, deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)];\n case 11:\n response = __assign.apply(void 0, [__assign.apply(void 0, _g.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 12:\n parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = __assign(__assign({}, parsedBody), { name: \"\" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: \"client\", $metadata: deserializeMetadata(output) });\n _j.label = 13;\n case 13:\n message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];\n }\n });\n}); };\nexport var deserializeAws_json1_1GetCredentialsForIdentityCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var data, contents, response;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (output.statusCode >= 300) {\n return [2 /*return*/, deserializeAws_json1_1GetCredentialsForIdentityCommandError(output, context)];\n }\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n data = _a.sent();\n contents = {};\n contents = deserializeAws_json1_1GetCredentialsForIdentityResponse(data, context);\n response = __assign({ $metadata: deserializeMetadata(output) }, contents);\n return [2 /*return*/, Promise.resolve(response)];\n }\n });\n}); };\nvar deserializeAws_json1_1GetCredentialsForIdentityCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, _g, _h, _j, _k, parsedBody, message;\n var _l;\n return __generator(this, function (_m) {\n switch (_m.label) {\n case 0:\n _a = [__assign({}, output)];\n _l = {};\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n parsedOutput = __assign.apply(void 0, _a.concat([(_l.body = _m.sent(), _l)]));\n errorCode = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n _b = errorCode;\n switch (_b) {\n case \"ExternalServiceException\": return [3 /*break*/, 2];\n case \"com.amazonaws.cognitoidentity#ExternalServiceException\": return [3 /*break*/, 2];\n case \"InternalErrorException\": return [3 /*break*/, 4];\n case \"com.amazonaws.cognitoidentity#InternalErrorException\": return [3 /*break*/, 4];\n case \"InvalidIdentityPoolConfigurationException\": return [3 /*break*/, 6];\n case \"com.amazonaws.cognitoidentity#InvalidIdentityPoolConfigurationException\": return [3 /*break*/, 6];\n case \"InvalidParameterException\": return [3 /*break*/, 8];\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\": return [3 /*break*/, 8];\n case \"NotAuthorizedException\": return [3 /*break*/, 10];\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\": return [3 /*break*/, 10];\n case \"ResourceConflictException\": return [3 /*break*/, 12];\n case \"com.amazonaws.cognitoidentity#ResourceConflictException\": return [3 /*break*/, 12];\n case \"ResourceNotFoundException\": return [3 /*break*/, 14];\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\": return [3 /*break*/, 14];\n case \"TooManyRequestsException\": return [3 /*break*/, 16];\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\": return [3 /*break*/, 16];\n }\n return [3 /*break*/, 18];\n case 2:\n _c = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ExternalServiceExceptionResponse(parsedOutput, context)];\n case 3:\n response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_m.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 19];\n case 4:\n _d = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)];\n case 5:\n response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_m.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 19];\n case 6:\n _e = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InvalidIdentityPoolConfigurationExceptionResponse(parsedOutput, context)];\n case 7:\n response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_m.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 19];\n case 8:\n _f = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];\n case 9:\n response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_m.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 19];\n case 10:\n _g = [{}];\n return [4 /*yield*/, deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)];\n case 11:\n response = __assign.apply(void 0, [__assign.apply(void 0, _g.concat([(_m.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 19];\n case 12:\n _h = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ResourceConflictExceptionResponse(parsedOutput, context)];\n case 13:\n response = __assign.apply(void 0, [__assign.apply(void 0, _h.concat([(_m.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 19];\n case 14:\n _j = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)];\n case 15:\n response = __assign.apply(void 0, [__assign.apply(void 0, _j.concat([(_m.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 19];\n case 16:\n _k = [{}];\n return [4 /*yield*/, deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)];\n case 17:\n response = __assign.apply(void 0, [__assign.apply(void 0, _k.concat([(_m.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 19];\n case 18:\n parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = __assign(__assign({}, parsedBody), { name: \"\" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: \"client\", $metadata: deserializeMetadata(output) });\n _m.label = 19;\n case 19:\n message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];\n }\n });\n}); };\nexport var deserializeAws_json1_1GetIdCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var data, contents, response;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (output.statusCode >= 300) {\n return [2 /*return*/, deserializeAws_json1_1GetIdCommandError(output, context)];\n }\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n data = _a.sent();\n contents = {};\n contents = deserializeAws_json1_1GetIdResponse(data, context);\n response = __assign({ $metadata: deserializeMetadata(output) }, contents);\n return [2 /*return*/, Promise.resolve(response)];\n }\n });\n}); };\nvar deserializeAws_json1_1GetIdCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, _g, _h, _j, _k, parsedBody, message;\n var _l;\n return __generator(this, function (_m) {\n switch (_m.label) {\n case 0:\n _a = [__assign({}, output)];\n _l = {};\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n parsedOutput = __assign.apply(void 0, _a.concat([(_l.body = _m.sent(), _l)]));\n errorCode = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n _b = errorCode;\n switch (_b) {\n case \"ExternalServiceException\": return [3 /*break*/, 2];\n case \"com.amazonaws.cognitoidentity#ExternalServiceException\": return [3 /*break*/, 2];\n case \"InternalErrorException\": return [3 /*break*/, 4];\n case \"com.amazonaws.cognitoidentity#InternalErrorException\": return [3 /*break*/, 4];\n case \"InvalidParameterException\": return [3 /*break*/, 6];\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\": return [3 /*break*/, 6];\n case \"LimitExceededException\": return [3 /*break*/, 8];\n case \"com.amazonaws.cognitoidentity#LimitExceededException\": return [3 /*break*/, 8];\n case \"NotAuthorizedException\": return [3 /*break*/, 10];\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\": return [3 /*break*/, 10];\n case \"ResourceConflictException\": return [3 /*break*/, 12];\n case \"com.amazonaws.cognitoidentity#ResourceConflictException\": return [3 /*break*/, 12];\n case \"ResourceNotFoundException\": return [3 /*break*/, 14];\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\": return [3 /*break*/, 14];\n case \"TooManyRequestsException\": return [3 /*break*/, 16];\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\": return [3 /*break*/, 16];\n }\n return [3 /*break*/, 18];\n case 2:\n _c = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ExternalServiceExceptionResponse(parsedOutput, context)];\n case 3:\n response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_m.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 19];\n case 4:\n _d = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)];\n case 5:\n response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_m.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 19];\n case 6:\n _e = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];\n case 7:\n response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_m.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 19];\n case 8:\n _f = [{}];\n return [4 /*yield*/, deserializeAws_json1_1LimitExceededExceptionResponse(parsedOutput, context)];\n case 9:\n response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_m.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 19];\n case 10:\n _g = [{}];\n return [4 /*yield*/, deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)];\n case 11:\n response = __assign.apply(void 0, [__assign.apply(void 0, _g.concat([(_m.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 19];\n case 12:\n _h = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ResourceConflictExceptionResponse(parsedOutput, context)];\n case 13:\n response = __assign.apply(void 0, [__assign.apply(void 0, _h.concat([(_m.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 19];\n case 14:\n _j = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)];\n case 15:\n response = __assign.apply(void 0, [__assign.apply(void 0, _j.concat([(_m.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 19];\n case 16:\n _k = [{}];\n return [4 /*yield*/, deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)];\n case 17:\n response = __assign.apply(void 0, [__assign.apply(void 0, _k.concat([(_m.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 19];\n case 18:\n parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = __assign(__assign({}, parsedBody), { name: \"\" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: \"client\", $metadata: deserializeMetadata(output) });\n _m.label = 19;\n case 19:\n message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];\n }\n });\n}); };\nexport var deserializeAws_json1_1GetIdentityPoolRolesCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var data, contents, response;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (output.statusCode >= 300) {\n return [2 /*return*/, deserializeAws_json1_1GetIdentityPoolRolesCommandError(output, context)];\n }\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n data = _a.sent();\n contents = {};\n contents = deserializeAws_json1_1GetIdentityPoolRolesResponse(data, context);\n response = __assign({ $metadata: deserializeMetadata(output) }, contents);\n return [2 /*return*/, Promise.resolve(response)];\n }\n });\n}); };\nvar deserializeAws_json1_1GetIdentityPoolRolesCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, _g, _h, parsedBody, message;\n var _j;\n return __generator(this, function (_k) {\n switch (_k.label) {\n case 0:\n _a = [__assign({}, output)];\n _j = {};\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n parsedOutput = __assign.apply(void 0, _a.concat([(_j.body = _k.sent(), _j)]));\n errorCode = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n _b = errorCode;\n switch (_b) {\n case \"InternalErrorException\": return [3 /*break*/, 2];\n case \"com.amazonaws.cognitoidentity#InternalErrorException\": return [3 /*break*/, 2];\n case \"InvalidParameterException\": return [3 /*break*/, 4];\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\": return [3 /*break*/, 4];\n case \"NotAuthorizedException\": return [3 /*break*/, 6];\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\": return [3 /*break*/, 6];\n case \"ResourceConflictException\": return [3 /*break*/, 8];\n case \"com.amazonaws.cognitoidentity#ResourceConflictException\": return [3 /*break*/, 8];\n case \"ResourceNotFoundException\": return [3 /*break*/, 10];\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\": return [3 /*break*/, 10];\n case \"TooManyRequestsException\": return [3 /*break*/, 12];\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\": return [3 /*break*/, 12];\n }\n return [3 /*break*/, 14];\n case 2:\n _c = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)];\n case 3:\n response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 15];\n case 4:\n _d = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];\n case 5:\n response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 15];\n case 6:\n _e = [{}];\n return [4 /*yield*/, deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)];\n case 7:\n response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 15];\n case 8:\n _f = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ResourceConflictExceptionResponse(parsedOutput, context)];\n case 9:\n response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 15];\n case 10:\n _g = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)];\n case 11:\n response = __assign.apply(void 0, [__assign.apply(void 0, _g.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 15];\n case 12:\n _h = [{}];\n return [4 /*yield*/, deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)];\n case 13:\n response = __assign.apply(void 0, [__assign.apply(void 0, _h.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 15];\n case 14:\n parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = __assign(__assign({}, parsedBody), { name: \"\" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: \"client\", $metadata: deserializeMetadata(output) });\n _k.label = 15;\n case 15:\n message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];\n }\n });\n}); };\nexport var deserializeAws_json1_1GetOpenIdTokenCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var data, contents, response;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (output.statusCode >= 300) {\n return [2 /*return*/, deserializeAws_json1_1GetOpenIdTokenCommandError(output, context)];\n }\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n data = _a.sent();\n contents = {};\n contents = deserializeAws_json1_1GetOpenIdTokenResponse(data, context);\n response = __assign({ $metadata: deserializeMetadata(output) }, contents);\n return [2 /*return*/, Promise.resolve(response)];\n }\n });\n}); };\nvar deserializeAws_json1_1GetOpenIdTokenCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, _g, _h, _j, parsedBody, message;\n var _k;\n return __generator(this, function (_l) {\n switch (_l.label) {\n case 0:\n _a = [__assign({}, output)];\n _k = {};\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n parsedOutput = __assign.apply(void 0, _a.concat([(_k.body = _l.sent(), _k)]));\n errorCode = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n _b = errorCode;\n switch (_b) {\n case \"ExternalServiceException\": return [3 /*break*/, 2];\n case \"com.amazonaws.cognitoidentity#ExternalServiceException\": return [3 /*break*/, 2];\n case \"InternalErrorException\": return [3 /*break*/, 4];\n case \"com.amazonaws.cognitoidentity#InternalErrorException\": return [3 /*break*/, 4];\n case \"InvalidParameterException\": return [3 /*break*/, 6];\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\": return [3 /*break*/, 6];\n case \"NotAuthorizedException\": return [3 /*break*/, 8];\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\": return [3 /*break*/, 8];\n case \"ResourceConflictException\": return [3 /*break*/, 10];\n case \"com.amazonaws.cognitoidentity#ResourceConflictException\": return [3 /*break*/, 10];\n case \"ResourceNotFoundException\": return [3 /*break*/, 12];\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\": return [3 /*break*/, 12];\n case \"TooManyRequestsException\": return [3 /*break*/, 14];\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\": return [3 /*break*/, 14];\n }\n return [3 /*break*/, 16];\n case 2:\n _c = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ExternalServiceExceptionResponse(parsedOutput, context)];\n case 3:\n response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 17];\n case 4:\n _d = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)];\n case 5:\n response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 17];\n case 6:\n _e = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];\n case 7:\n response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 17];\n case 8:\n _f = [{}];\n return [4 /*yield*/, deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)];\n case 9:\n response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 17];\n case 10:\n _g = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ResourceConflictExceptionResponse(parsedOutput, context)];\n case 11:\n response = __assign.apply(void 0, [__assign.apply(void 0, _g.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 17];\n case 12:\n _h = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)];\n case 13:\n response = __assign.apply(void 0, [__assign.apply(void 0, _h.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 17];\n case 14:\n _j = [{}];\n return [4 /*yield*/, deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)];\n case 15:\n response = __assign.apply(void 0, [__assign.apply(void 0, _j.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 17];\n case 16:\n parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = __assign(__assign({}, parsedBody), { name: \"\" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: \"client\", $metadata: deserializeMetadata(output) });\n _l.label = 17;\n case 17:\n message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];\n }\n });\n}); };\nexport var deserializeAws_json1_1GetOpenIdTokenForDeveloperIdentityCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var data, contents, response;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (output.statusCode >= 300) {\n return [2 /*return*/, deserializeAws_json1_1GetOpenIdTokenForDeveloperIdentityCommandError(output, context)];\n }\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n data = _a.sent();\n contents = {};\n contents = deserializeAws_json1_1GetOpenIdTokenForDeveloperIdentityResponse(data, context);\n response = __assign({ $metadata: deserializeMetadata(output) }, contents);\n return [2 /*return*/, Promise.resolve(response)];\n }\n });\n}); };\nvar deserializeAws_json1_1GetOpenIdTokenForDeveloperIdentityCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, _g, _h, _j, parsedBody, message;\n var _k;\n return __generator(this, function (_l) {\n switch (_l.label) {\n case 0:\n _a = [__assign({}, output)];\n _k = {};\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n parsedOutput = __assign.apply(void 0, _a.concat([(_k.body = _l.sent(), _k)]));\n errorCode = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n _b = errorCode;\n switch (_b) {\n case \"DeveloperUserAlreadyRegisteredException\": return [3 /*break*/, 2];\n case \"com.amazonaws.cognitoidentity#DeveloperUserAlreadyRegisteredException\": return [3 /*break*/, 2];\n case \"InternalErrorException\": return [3 /*break*/, 4];\n case \"com.amazonaws.cognitoidentity#InternalErrorException\": return [3 /*break*/, 4];\n case \"InvalidParameterException\": return [3 /*break*/, 6];\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\": return [3 /*break*/, 6];\n case \"NotAuthorizedException\": return [3 /*break*/, 8];\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\": return [3 /*break*/, 8];\n case \"ResourceConflictException\": return [3 /*break*/, 10];\n case \"com.amazonaws.cognitoidentity#ResourceConflictException\": return [3 /*break*/, 10];\n case \"ResourceNotFoundException\": return [3 /*break*/, 12];\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\": return [3 /*break*/, 12];\n case \"TooManyRequestsException\": return [3 /*break*/, 14];\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\": return [3 /*break*/, 14];\n }\n return [3 /*break*/, 16];\n case 2:\n _c = [{}];\n return [4 /*yield*/, deserializeAws_json1_1DeveloperUserAlreadyRegisteredExceptionResponse(parsedOutput, context)];\n case 3:\n response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 17];\n case 4:\n _d = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)];\n case 5:\n response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 17];\n case 6:\n _e = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];\n case 7:\n response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 17];\n case 8:\n _f = [{}];\n return [4 /*yield*/, deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)];\n case 9:\n response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 17];\n case 10:\n _g = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ResourceConflictExceptionResponse(parsedOutput, context)];\n case 11:\n response = __assign.apply(void 0, [__assign.apply(void 0, _g.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 17];\n case 12:\n _h = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)];\n case 13:\n response = __assign.apply(void 0, [__assign.apply(void 0, _h.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 17];\n case 14:\n _j = [{}];\n return [4 /*yield*/, deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)];\n case 15:\n response = __assign.apply(void 0, [__assign.apply(void 0, _j.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 17];\n case 16:\n parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = __assign(__assign({}, parsedBody), { name: \"\" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: \"client\", $metadata: deserializeMetadata(output) });\n _l.label = 17;\n case 17:\n message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];\n }\n });\n}); };\nexport var deserializeAws_json1_1ListIdentitiesCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var data, contents, response;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (output.statusCode >= 300) {\n return [2 /*return*/, deserializeAws_json1_1ListIdentitiesCommandError(output, context)];\n }\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n data = _a.sent();\n contents = {};\n contents = deserializeAws_json1_1ListIdentitiesResponse(data, context);\n response = __assign({ $metadata: deserializeMetadata(output) }, contents);\n return [2 /*return*/, Promise.resolve(response)];\n }\n });\n}); };\nvar deserializeAws_json1_1ListIdentitiesCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, _g, parsedBody, message;\n var _h;\n return __generator(this, function (_j) {\n switch (_j.label) {\n case 0:\n _a = [__assign({}, output)];\n _h = {};\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n parsedOutput = __assign.apply(void 0, _a.concat([(_h.body = _j.sent(), _h)]));\n errorCode = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n _b = errorCode;\n switch (_b) {\n case \"InternalErrorException\": return [3 /*break*/, 2];\n case \"com.amazonaws.cognitoidentity#InternalErrorException\": return [3 /*break*/, 2];\n case \"InvalidParameterException\": return [3 /*break*/, 4];\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\": return [3 /*break*/, 4];\n case \"NotAuthorizedException\": return [3 /*break*/, 6];\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\": return [3 /*break*/, 6];\n case \"ResourceNotFoundException\": return [3 /*break*/, 8];\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\": return [3 /*break*/, 8];\n case \"TooManyRequestsException\": return [3 /*break*/, 10];\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\": return [3 /*break*/, 10];\n }\n return [3 /*break*/, 12];\n case 2:\n _c = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)];\n case 3:\n response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 4:\n _d = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];\n case 5:\n response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 6:\n _e = [{}];\n return [4 /*yield*/, deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)];\n case 7:\n response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 8:\n _f = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)];\n case 9:\n response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 10:\n _g = [{}];\n return [4 /*yield*/, deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)];\n case 11:\n response = __assign.apply(void 0, [__assign.apply(void 0, _g.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 12:\n parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = __assign(__assign({}, parsedBody), { name: \"\" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: \"client\", $metadata: deserializeMetadata(output) });\n _j.label = 13;\n case 13:\n message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];\n }\n });\n}); };\nexport var deserializeAws_json1_1ListIdentityPoolsCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var data, contents, response;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (output.statusCode >= 300) {\n return [2 /*return*/, deserializeAws_json1_1ListIdentityPoolsCommandError(output, context)];\n }\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n data = _a.sent();\n contents = {};\n contents = deserializeAws_json1_1ListIdentityPoolsResponse(data, context);\n response = __assign({ $metadata: deserializeMetadata(output) }, contents);\n return [2 /*return*/, Promise.resolve(response)];\n }\n });\n}); };\nvar deserializeAws_json1_1ListIdentityPoolsCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, _g, parsedBody, message;\n var _h;\n return __generator(this, function (_j) {\n switch (_j.label) {\n case 0:\n _a = [__assign({}, output)];\n _h = {};\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n parsedOutput = __assign.apply(void 0, _a.concat([(_h.body = _j.sent(), _h)]));\n errorCode = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n _b = errorCode;\n switch (_b) {\n case \"InternalErrorException\": return [3 /*break*/, 2];\n case \"com.amazonaws.cognitoidentity#InternalErrorException\": return [3 /*break*/, 2];\n case \"InvalidParameterException\": return [3 /*break*/, 4];\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\": return [3 /*break*/, 4];\n case \"NotAuthorizedException\": return [3 /*break*/, 6];\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\": return [3 /*break*/, 6];\n case \"ResourceNotFoundException\": return [3 /*break*/, 8];\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\": return [3 /*break*/, 8];\n case \"TooManyRequestsException\": return [3 /*break*/, 10];\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\": return [3 /*break*/, 10];\n }\n return [3 /*break*/, 12];\n case 2:\n _c = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)];\n case 3:\n response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 4:\n _d = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];\n case 5:\n response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 6:\n _e = [{}];\n return [4 /*yield*/, deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)];\n case 7:\n response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 8:\n _f = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)];\n case 9:\n response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 10:\n _g = [{}];\n return [4 /*yield*/, deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)];\n case 11:\n response = __assign.apply(void 0, [__assign.apply(void 0, _g.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 12:\n parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = __assign(__assign({}, parsedBody), { name: \"\" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: \"client\", $metadata: deserializeMetadata(output) });\n _j.label = 13;\n case 13:\n message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];\n }\n });\n}); };\nexport var deserializeAws_json1_1ListTagsForResourceCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var data, contents, response;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (output.statusCode >= 300) {\n return [2 /*return*/, deserializeAws_json1_1ListTagsForResourceCommandError(output, context)];\n }\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n data = _a.sent();\n contents = {};\n contents = deserializeAws_json1_1ListTagsForResourceResponse(data, context);\n response = __assign({ $metadata: deserializeMetadata(output) }, contents);\n return [2 /*return*/, Promise.resolve(response)];\n }\n });\n}); };\nvar deserializeAws_json1_1ListTagsForResourceCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, _g, parsedBody, message;\n var _h;\n return __generator(this, function (_j) {\n switch (_j.label) {\n case 0:\n _a = [__assign({}, output)];\n _h = {};\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n parsedOutput = __assign.apply(void 0, _a.concat([(_h.body = _j.sent(), _h)]));\n errorCode = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n _b = errorCode;\n switch (_b) {\n case \"InternalErrorException\": return [3 /*break*/, 2];\n case \"com.amazonaws.cognitoidentity#InternalErrorException\": return [3 /*break*/, 2];\n case \"InvalidParameterException\": return [3 /*break*/, 4];\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\": return [3 /*break*/, 4];\n case \"NotAuthorizedException\": return [3 /*break*/, 6];\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\": return [3 /*break*/, 6];\n case \"ResourceNotFoundException\": return [3 /*break*/, 8];\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\": return [3 /*break*/, 8];\n case \"TooManyRequestsException\": return [3 /*break*/, 10];\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\": return [3 /*break*/, 10];\n }\n return [3 /*break*/, 12];\n case 2:\n _c = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)];\n case 3:\n response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 4:\n _d = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];\n case 5:\n response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 6:\n _e = [{}];\n return [4 /*yield*/, deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)];\n case 7:\n response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 8:\n _f = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)];\n case 9:\n response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 10:\n _g = [{}];\n return [4 /*yield*/, deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)];\n case 11:\n response = __assign.apply(void 0, [__assign.apply(void 0, _g.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 12:\n parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = __assign(__assign({}, parsedBody), { name: \"\" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: \"client\", $metadata: deserializeMetadata(output) });\n _j.label = 13;\n case 13:\n message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];\n }\n });\n}); };\nexport var deserializeAws_json1_1LookupDeveloperIdentityCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var data, contents, response;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (output.statusCode >= 300) {\n return [2 /*return*/, deserializeAws_json1_1LookupDeveloperIdentityCommandError(output, context)];\n }\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n data = _a.sent();\n contents = {};\n contents = deserializeAws_json1_1LookupDeveloperIdentityResponse(data, context);\n response = __assign({ $metadata: deserializeMetadata(output) }, contents);\n return [2 /*return*/, Promise.resolve(response)];\n }\n });\n}); };\nvar deserializeAws_json1_1LookupDeveloperIdentityCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, _g, _h, parsedBody, message;\n var _j;\n return __generator(this, function (_k) {\n switch (_k.label) {\n case 0:\n _a = [__assign({}, output)];\n _j = {};\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n parsedOutput = __assign.apply(void 0, _a.concat([(_j.body = _k.sent(), _j)]));\n errorCode = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n _b = errorCode;\n switch (_b) {\n case \"InternalErrorException\": return [3 /*break*/, 2];\n case \"com.amazonaws.cognitoidentity#InternalErrorException\": return [3 /*break*/, 2];\n case \"InvalidParameterException\": return [3 /*break*/, 4];\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\": return [3 /*break*/, 4];\n case \"NotAuthorizedException\": return [3 /*break*/, 6];\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\": return [3 /*break*/, 6];\n case \"ResourceConflictException\": return [3 /*break*/, 8];\n case \"com.amazonaws.cognitoidentity#ResourceConflictException\": return [3 /*break*/, 8];\n case \"ResourceNotFoundException\": return [3 /*break*/, 10];\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\": return [3 /*break*/, 10];\n case \"TooManyRequestsException\": return [3 /*break*/, 12];\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\": return [3 /*break*/, 12];\n }\n return [3 /*break*/, 14];\n case 2:\n _c = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)];\n case 3:\n response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 15];\n case 4:\n _d = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];\n case 5:\n response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 15];\n case 6:\n _e = [{}];\n return [4 /*yield*/, deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)];\n case 7:\n response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 15];\n case 8:\n _f = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ResourceConflictExceptionResponse(parsedOutput, context)];\n case 9:\n response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 15];\n case 10:\n _g = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)];\n case 11:\n response = __assign.apply(void 0, [__assign.apply(void 0, _g.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 15];\n case 12:\n _h = [{}];\n return [4 /*yield*/, deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)];\n case 13:\n response = __assign.apply(void 0, [__assign.apply(void 0, _h.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 15];\n case 14:\n parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = __assign(__assign({}, parsedBody), { name: \"\" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: \"client\", $metadata: deserializeMetadata(output) });\n _k.label = 15;\n case 15:\n message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];\n }\n });\n}); };\nexport var deserializeAws_json1_1MergeDeveloperIdentitiesCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var data, contents, response;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (output.statusCode >= 300) {\n return [2 /*return*/, deserializeAws_json1_1MergeDeveloperIdentitiesCommandError(output, context)];\n }\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n data = _a.sent();\n contents = {};\n contents = deserializeAws_json1_1MergeDeveloperIdentitiesResponse(data, context);\n response = __assign({ $metadata: deserializeMetadata(output) }, contents);\n return [2 /*return*/, Promise.resolve(response)];\n }\n });\n}); };\nvar deserializeAws_json1_1MergeDeveloperIdentitiesCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, _g, _h, parsedBody, message;\n var _j;\n return __generator(this, function (_k) {\n switch (_k.label) {\n case 0:\n _a = [__assign({}, output)];\n _j = {};\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n parsedOutput = __assign.apply(void 0, _a.concat([(_j.body = _k.sent(), _j)]));\n errorCode = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n _b = errorCode;\n switch (_b) {\n case \"InternalErrorException\": return [3 /*break*/, 2];\n case \"com.amazonaws.cognitoidentity#InternalErrorException\": return [3 /*break*/, 2];\n case \"InvalidParameterException\": return [3 /*break*/, 4];\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\": return [3 /*break*/, 4];\n case \"NotAuthorizedException\": return [3 /*break*/, 6];\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\": return [3 /*break*/, 6];\n case \"ResourceConflictException\": return [3 /*break*/, 8];\n case \"com.amazonaws.cognitoidentity#ResourceConflictException\": return [3 /*break*/, 8];\n case \"ResourceNotFoundException\": return [3 /*break*/, 10];\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\": return [3 /*break*/, 10];\n case \"TooManyRequestsException\": return [3 /*break*/, 12];\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\": return [3 /*break*/, 12];\n }\n return [3 /*break*/, 14];\n case 2:\n _c = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)];\n case 3:\n response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 15];\n case 4:\n _d = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];\n case 5:\n response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 15];\n case 6:\n _e = [{}];\n return [4 /*yield*/, deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)];\n case 7:\n response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 15];\n case 8:\n _f = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ResourceConflictExceptionResponse(parsedOutput, context)];\n case 9:\n response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 15];\n case 10:\n _g = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)];\n case 11:\n response = __assign.apply(void 0, [__assign.apply(void 0, _g.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 15];\n case 12:\n _h = [{}];\n return [4 /*yield*/, deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)];\n case 13:\n response = __assign.apply(void 0, [__assign.apply(void 0, _h.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 15];\n case 14:\n parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = __assign(__assign({}, parsedBody), { name: \"\" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: \"client\", $metadata: deserializeMetadata(output) });\n _k.label = 15;\n case 15:\n message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];\n }\n });\n}); };\nexport var deserializeAws_json1_1SetIdentityPoolRolesCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var response;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (output.statusCode >= 300) {\n return [2 /*return*/, deserializeAws_json1_1SetIdentityPoolRolesCommandError(output, context)];\n }\n return [4 /*yield*/, collectBody(output.body, context)];\n case 1:\n _a.sent();\n response = {\n $metadata: deserializeMetadata(output),\n };\n return [2 /*return*/, Promise.resolve(response)];\n }\n });\n}); };\nvar deserializeAws_json1_1SetIdentityPoolRolesCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, _g, _h, _j, parsedBody, message;\n var _k;\n return __generator(this, function (_l) {\n switch (_l.label) {\n case 0:\n _a = [__assign({}, output)];\n _k = {};\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n parsedOutput = __assign.apply(void 0, _a.concat([(_k.body = _l.sent(), _k)]));\n errorCode = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n _b = errorCode;\n switch (_b) {\n case \"ConcurrentModificationException\": return [3 /*break*/, 2];\n case \"com.amazonaws.cognitoidentity#ConcurrentModificationException\": return [3 /*break*/, 2];\n case \"InternalErrorException\": return [3 /*break*/, 4];\n case \"com.amazonaws.cognitoidentity#InternalErrorException\": return [3 /*break*/, 4];\n case \"InvalidParameterException\": return [3 /*break*/, 6];\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\": return [3 /*break*/, 6];\n case \"NotAuthorizedException\": return [3 /*break*/, 8];\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\": return [3 /*break*/, 8];\n case \"ResourceConflictException\": return [3 /*break*/, 10];\n case \"com.amazonaws.cognitoidentity#ResourceConflictException\": return [3 /*break*/, 10];\n case \"ResourceNotFoundException\": return [3 /*break*/, 12];\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\": return [3 /*break*/, 12];\n case \"TooManyRequestsException\": return [3 /*break*/, 14];\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\": return [3 /*break*/, 14];\n }\n return [3 /*break*/, 16];\n case 2:\n _c = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ConcurrentModificationExceptionResponse(parsedOutput, context)];\n case 3:\n response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 17];\n case 4:\n _d = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)];\n case 5:\n response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 17];\n case 6:\n _e = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];\n case 7:\n response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 17];\n case 8:\n _f = [{}];\n return [4 /*yield*/, deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)];\n case 9:\n response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 17];\n case 10:\n _g = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ResourceConflictExceptionResponse(parsedOutput, context)];\n case 11:\n response = __assign.apply(void 0, [__assign.apply(void 0, _g.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 17];\n case 12:\n _h = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)];\n case 13:\n response = __assign.apply(void 0, [__assign.apply(void 0, _h.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 17];\n case 14:\n _j = [{}];\n return [4 /*yield*/, deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)];\n case 15:\n response = __assign.apply(void 0, [__assign.apply(void 0, _j.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 17];\n case 16:\n parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = __assign(__assign({}, parsedBody), { name: \"\" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: \"client\", $metadata: deserializeMetadata(output) });\n _l.label = 17;\n case 17:\n message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];\n }\n });\n}); };\nexport var deserializeAws_json1_1TagResourceCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var data, contents, response;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (output.statusCode >= 300) {\n return [2 /*return*/, deserializeAws_json1_1TagResourceCommandError(output, context)];\n }\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n data = _a.sent();\n contents = {};\n contents = deserializeAws_json1_1TagResourceResponse(data, context);\n response = __assign({ $metadata: deserializeMetadata(output) }, contents);\n return [2 /*return*/, Promise.resolve(response)];\n }\n });\n}); };\nvar deserializeAws_json1_1TagResourceCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, _g, parsedBody, message;\n var _h;\n return __generator(this, function (_j) {\n switch (_j.label) {\n case 0:\n _a = [__assign({}, output)];\n _h = {};\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n parsedOutput = __assign.apply(void 0, _a.concat([(_h.body = _j.sent(), _h)]));\n errorCode = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n _b = errorCode;\n switch (_b) {\n case \"InternalErrorException\": return [3 /*break*/, 2];\n case \"com.amazonaws.cognitoidentity#InternalErrorException\": return [3 /*break*/, 2];\n case \"InvalidParameterException\": return [3 /*break*/, 4];\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\": return [3 /*break*/, 4];\n case \"NotAuthorizedException\": return [3 /*break*/, 6];\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\": return [3 /*break*/, 6];\n case \"ResourceNotFoundException\": return [3 /*break*/, 8];\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\": return [3 /*break*/, 8];\n case \"TooManyRequestsException\": return [3 /*break*/, 10];\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\": return [3 /*break*/, 10];\n }\n return [3 /*break*/, 12];\n case 2:\n _c = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)];\n case 3:\n response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 4:\n _d = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];\n case 5:\n response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 6:\n _e = [{}];\n return [4 /*yield*/, deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)];\n case 7:\n response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 8:\n _f = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)];\n case 9:\n response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 10:\n _g = [{}];\n return [4 /*yield*/, deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)];\n case 11:\n response = __assign.apply(void 0, [__assign.apply(void 0, _g.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 12:\n parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = __assign(__assign({}, parsedBody), { name: \"\" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: \"client\", $metadata: deserializeMetadata(output) });\n _j.label = 13;\n case 13:\n message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];\n }\n });\n}); };\nexport var deserializeAws_json1_1UnlinkDeveloperIdentityCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var response;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (output.statusCode >= 300) {\n return [2 /*return*/, deserializeAws_json1_1UnlinkDeveloperIdentityCommandError(output, context)];\n }\n return [4 /*yield*/, collectBody(output.body, context)];\n case 1:\n _a.sent();\n response = {\n $metadata: deserializeMetadata(output),\n };\n return [2 /*return*/, Promise.resolve(response)];\n }\n });\n}); };\nvar deserializeAws_json1_1UnlinkDeveloperIdentityCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, _g, _h, parsedBody, message;\n var _j;\n return __generator(this, function (_k) {\n switch (_k.label) {\n case 0:\n _a = [__assign({}, output)];\n _j = {};\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n parsedOutput = __assign.apply(void 0, _a.concat([(_j.body = _k.sent(), _j)]));\n errorCode = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n _b = errorCode;\n switch (_b) {\n case \"InternalErrorException\": return [3 /*break*/, 2];\n case \"com.amazonaws.cognitoidentity#InternalErrorException\": return [3 /*break*/, 2];\n case \"InvalidParameterException\": return [3 /*break*/, 4];\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\": return [3 /*break*/, 4];\n case \"NotAuthorizedException\": return [3 /*break*/, 6];\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\": return [3 /*break*/, 6];\n case \"ResourceConflictException\": return [3 /*break*/, 8];\n case \"com.amazonaws.cognitoidentity#ResourceConflictException\": return [3 /*break*/, 8];\n case \"ResourceNotFoundException\": return [3 /*break*/, 10];\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\": return [3 /*break*/, 10];\n case \"TooManyRequestsException\": return [3 /*break*/, 12];\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\": return [3 /*break*/, 12];\n }\n return [3 /*break*/, 14];\n case 2:\n _c = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)];\n case 3:\n response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 15];\n case 4:\n _d = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];\n case 5:\n response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 15];\n case 6:\n _e = [{}];\n return [4 /*yield*/, deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)];\n case 7:\n response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 15];\n case 8:\n _f = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ResourceConflictExceptionResponse(parsedOutput, context)];\n case 9:\n response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 15];\n case 10:\n _g = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)];\n case 11:\n response = __assign.apply(void 0, [__assign.apply(void 0, _g.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 15];\n case 12:\n _h = [{}];\n return [4 /*yield*/, deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)];\n case 13:\n response = __assign.apply(void 0, [__assign.apply(void 0, _h.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 15];\n case 14:\n parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = __assign(__assign({}, parsedBody), { name: \"\" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: \"client\", $metadata: deserializeMetadata(output) });\n _k.label = 15;\n case 15:\n message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];\n }\n });\n}); };\nexport var deserializeAws_json1_1UnlinkIdentityCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var response;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (output.statusCode >= 300) {\n return [2 /*return*/, deserializeAws_json1_1UnlinkIdentityCommandError(output, context)];\n }\n return [4 /*yield*/, collectBody(output.body, context)];\n case 1:\n _a.sent();\n response = {\n $metadata: deserializeMetadata(output),\n };\n return [2 /*return*/, Promise.resolve(response)];\n }\n });\n}); };\nvar deserializeAws_json1_1UnlinkIdentityCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, _g, _h, _j, parsedBody, message;\n var _k;\n return __generator(this, function (_l) {\n switch (_l.label) {\n case 0:\n _a = [__assign({}, output)];\n _k = {};\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n parsedOutput = __assign.apply(void 0, _a.concat([(_k.body = _l.sent(), _k)]));\n errorCode = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n _b = errorCode;\n switch (_b) {\n case \"ExternalServiceException\": return [3 /*break*/, 2];\n case \"com.amazonaws.cognitoidentity#ExternalServiceException\": return [3 /*break*/, 2];\n case \"InternalErrorException\": return [3 /*break*/, 4];\n case \"com.amazonaws.cognitoidentity#InternalErrorException\": return [3 /*break*/, 4];\n case \"InvalidParameterException\": return [3 /*break*/, 6];\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\": return [3 /*break*/, 6];\n case \"NotAuthorizedException\": return [3 /*break*/, 8];\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\": return [3 /*break*/, 8];\n case \"ResourceConflictException\": return [3 /*break*/, 10];\n case \"com.amazonaws.cognitoidentity#ResourceConflictException\": return [3 /*break*/, 10];\n case \"ResourceNotFoundException\": return [3 /*break*/, 12];\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\": return [3 /*break*/, 12];\n case \"TooManyRequestsException\": return [3 /*break*/, 14];\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\": return [3 /*break*/, 14];\n }\n return [3 /*break*/, 16];\n case 2:\n _c = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ExternalServiceExceptionResponse(parsedOutput, context)];\n case 3:\n response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 17];\n case 4:\n _d = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)];\n case 5:\n response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 17];\n case 6:\n _e = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];\n case 7:\n response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 17];\n case 8:\n _f = [{}];\n return [4 /*yield*/, deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)];\n case 9:\n response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 17];\n case 10:\n _g = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ResourceConflictExceptionResponse(parsedOutput, context)];\n case 11:\n response = __assign.apply(void 0, [__assign.apply(void 0, _g.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 17];\n case 12:\n _h = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)];\n case 13:\n response = __assign.apply(void 0, [__assign.apply(void 0, _h.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 17];\n case 14:\n _j = [{}];\n return [4 /*yield*/, deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)];\n case 15:\n response = __assign.apply(void 0, [__assign.apply(void 0, _j.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 17];\n case 16:\n parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = __assign(__assign({}, parsedBody), { name: \"\" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: \"client\", $metadata: deserializeMetadata(output) });\n _l.label = 17;\n case 17:\n message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];\n }\n });\n}); };\nexport var deserializeAws_json1_1UntagResourceCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var data, contents, response;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (output.statusCode >= 300) {\n return [2 /*return*/, deserializeAws_json1_1UntagResourceCommandError(output, context)];\n }\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n data = _a.sent();\n contents = {};\n contents = deserializeAws_json1_1UntagResourceResponse(data, context);\n response = __assign({ $metadata: deserializeMetadata(output) }, contents);\n return [2 /*return*/, Promise.resolve(response)];\n }\n });\n}); };\nvar deserializeAws_json1_1UntagResourceCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, _g, parsedBody, message;\n var _h;\n return __generator(this, function (_j) {\n switch (_j.label) {\n case 0:\n _a = [__assign({}, output)];\n _h = {};\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n parsedOutput = __assign.apply(void 0, _a.concat([(_h.body = _j.sent(), _h)]));\n errorCode = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n _b = errorCode;\n switch (_b) {\n case \"InternalErrorException\": return [3 /*break*/, 2];\n case \"com.amazonaws.cognitoidentity#InternalErrorException\": return [3 /*break*/, 2];\n case \"InvalidParameterException\": return [3 /*break*/, 4];\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\": return [3 /*break*/, 4];\n case \"NotAuthorizedException\": return [3 /*break*/, 6];\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\": return [3 /*break*/, 6];\n case \"ResourceNotFoundException\": return [3 /*break*/, 8];\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\": return [3 /*break*/, 8];\n case \"TooManyRequestsException\": return [3 /*break*/, 10];\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\": return [3 /*break*/, 10];\n }\n return [3 /*break*/, 12];\n case 2:\n _c = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)];\n case 3:\n response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 4:\n _d = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];\n case 5:\n response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 6:\n _e = [{}];\n return [4 /*yield*/, deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)];\n case 7:\n response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 8:\n _f = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)];\n case 9:\n response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 10:\n _g = [{}];\n return [4 /*yield*/, deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)];\n case 11:\n response = __assign.apply(void 0, [__assign.apply(void 0, _g.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 13];\n case 12:\n parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = __assign(__assign({}, parsedBody), { name: \"\" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: \"client\", $metadata: deserializeMetadata(output) });\n _j.label = 13;\n case 13:\n message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];\n }\n });\n}); };\nexport var deserializeAws_json1_1UpdateIdentityPoolCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var data, contents, response;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (output.statusCode >= 300) {\n return [2 /*return*/, deserializeAws_json1_1UpdateIdentityPoolCommandError(output, context)];\n }\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n data = _a.sent();\n contents = {};\n contents = deserializeAws_json1_1IdentityPool(data, context);\n response = __assign({ $metadata: deserializeMetadata(output) }, contents);\n return [2 /*return*/, Promise.resolve(response)];\n }\n });\n}); };\nvar deserializeAws_json1_1UpdateIdentityPoolCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {\n var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, _g, _h, _j, _k, parsedBody, message;\n var _l;\n return __generator(this, function (_m) {\n switch (_m.label) {\n case 0:\n _a = [__assign({}, output)];\n _l = {};\n return [4 /*yield*/, parseBody(output.body, context)];\n case 1:\n parsedOutput = __assign.apply(void 0, _a.concat([(_l.body = _m.sent(), _l)]));\n errorCode = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n _b = errorCode;\n switch (_b) {\n case \"ConcurrentModificationException\": return [3 /*break*/, 2];\n case \"com.amazonaws.cognitoidentity#ConcurrentModificationException\": return [3 /*break*/, 2];\n case \"InternalErrorException\": return [3 /*break*/, 4];\n case \"com.amazonaws.cognitoidentity#InternalErrorException\": return [3 /*break*/, 4];\n case \"InvalidParameterException\": return [3 /*break*/, 6];\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\": return [3 /*break*/, 6];\n case \"LimitExceededException\": return [3 /*break*/, 8];\n case \"com.amazonaws.cognitoidentity#LimitExceededException\": return [3 /*break*/, 8];\n case \"NotAuthorizedException\": return [3 /*break*/, 10];\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\": return [3 /*break*/, 10];\n case \"ResourceConflictException\": return [3 /*break*/, 12];\n case \"com.amazonaws.cognitoidentity#ResourceConflictException\": return [3 /*break*/, 12];\n case \"ResourceNotFoundException\": return [3 /*break*/, 14];\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\": return [3 /*break*/, 14];\n case \"TooManyRequestsException\": return [3 /*break*/, 16];\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\": return [3 /*break*/, 16];\n }\n return [3 /*break*/, 18];\n case 2:\n _c = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ConcurrentModificationExceptionResponse(parsedOutput, context)];\n case 3:\n response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_m.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 19];\n case 4:\n _d = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)];\n case 5:\n response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_m.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 19];\n case 6:\n _e = [{}];\n return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];\n case 7:\n response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_m.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 19];\n case 8:\n _f = [{}];\n return [4 /*yield*/, deserializeAws_json1_1LimitExceededExceptionResponse(parsedOutput, context)];\n case 9:\n response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_m.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 19];\n case 10:\n _g = [{}];\n return [4 /*yield*/, deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)];\n case 11:\n response = __assign.apply(void 0, [__assign.apply(void 0, _g.concat([(_m.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 19];\n case 12:\n _h = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ResourceConflictExceptionResponse(parsedOutput, context)];\n case 13:\n response = __assign.apply(void 0, [__assign.apply(void 0, _h.concat([(_m.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 19];\n case 14:\n _j = [{}];\n return [4 /*yield*/, deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)];\n case 15:\n response = __assign.apply(void 0, [__assign.apply(void 0, _j.concat([(_m.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 19];\n case 16:\n _k = [{}];\n return [4 /*yield*/, deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)];\n case 17:\n response = __assign.apply(void 0, [__assign.apply(void 0, _k.concat([(_m.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);\n return [3 /*break*/, 19];\n case 18:\n parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = __assign(__assign({}, parsedBody), { name: \"\" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: \"client\", $metadata: deserializeMetadata(output) });\n _m.label = 19;\n case 19:\n message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];\n }\n });\n}); };\nvar deserializeAws_json1_1ConcurrentModificationExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {\n var body, deserialized, contents;\n return __generator(this, function (_a) {\n body = parsedOutput.body;\n deserialized = deserializeAws_json1_1ConcurrentModificationException(body, context);\n contents = __assign({ name: \"ConcurrentModificationException\", $fault: \"client\", $metadata: deserializeMetadata(parsedOutput) }, deserialized);\n return [2 /*return*/, contents];\n });\n}); };\nvar deserializeAws_json1_1DeveloperUserAlreadyRegisteredExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {\n var body, deserialized, contents;\n return __generator(this, function (_a) {\n body = parsedOutput.body;\n deserialized = deserializeAws_json1_1DeveloperUserAlreadyRegisteredException(body, context);\n contents = __assign({ name: \"DeveloperUserAlreadyRegisteredException\", $fault: \"client\", $metadata: deserializeMetadata(parsedOutput) }, deserialized);\n return [2 /*return*/, contents];\n });\n}); };\nvar deserializeAws_json1_1ExternalServiceExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {\n var body, deserialized, contents;\n return __generator(this, function (_a) {\n body = parsedOutput.body;\n deserialized = deserializeAws_json1_1ExternalServiceException(body, context);\n contents = __assign({ name: \"ExternalServiceException\", $fault: \"client\", $metadata: deserializeMetadata(parsedOutput) }, deserialized);\n return [2 /*return*/, contents];\n });\n}); };\nvar deserializeAws_json1_1InternalErrorExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {\n var body, deserialized, contents;\n return __generator(this, function (_a) {\n body = parsedOutput.body;\n deserialized = deserializeAws_json1_1InternalErrorException(body, context);\n contents = __assign({ name: \"InternalErrorException\", $fault: \"server\", $metadata: deserializeMetadata(parsedOutput) }, deserialized);\n return [2 /*return*/, contents];\n });\n}); };\nvar deserializeAws_json1_1InvalidIdentityPoolConfigurationExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {\n var body, deserialized, contents;\n return __generator(this, function (_a) {\n body = parsedOutput.body;\n deserialized = deserializeAws_json1_1InvalidIdentityPoolConfigurationException(body, context);\n contents = __assign({ name: \"InvalidIdentityPoolConfigurationException\", $fault: \"client\", $metadata: deserializeMetadata(parsedOutput) }, deserialized);\n return [2 /*return*/, contents];\n });\n}); };\nvar deserializeAws_json1_1InvalidParameterExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {\n var body, deserialized, contents;\n return __generator(this, function (_a) {\n body = parsedOutput.body;\n deserialized = deserializeAws_json1_1InvalidParameterException(body, context);\n contents = __assign({ name: \"InvalidParameterException\", $fault: \"client\", $metadata: deserializeMetadata(parsedOutput) }, deserialized);\n return [2 /*return*/, contents];\n });\n}); };\nvar deserializeAws_json1_1LimitExceededExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {\n var body, deserialized, contents;\n return __generator(this, function (_a) {\n body = parsedOutput.body;\n deserialized = deserializeAws_json1_1LimitExceededException(body, context);\n contents = __assign({ name: \"LimitExceededException\", $fault: \"client\", $metadata: deserializeMetadata(parsedOutput) }, deserialized);\n return [2 /*return*/, contents];\n });\n}); };\nvar deserializeAws_json1_1NotAuthorizedExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {\n var body, deserialized, contents;\n return __generator(this, function (_a) {\n body = parsedOutput.body;\n deserialized = deserializeAws_json1_1NotAuthorizedException(body, context);\n contents = __assign({ name: \"NotAuthorizedException\", $fault: \"client\", $metadata: deserializeMetadata(parsedOutput) }, deserialized);\n return [2 /*return*/, contents];\n });\n}); };\nvar deserializeAws_json1_1ResourceConflictExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {\n var body, deserialized, contents;\n return __generator(this, function (_a) {\n body = parsedOutput.body;\n deserialized = deserializeAws_json1_1ResourceConflictException(body, context);\n contents = __assign({ name: \"ResourceConflictException\", $fault: \"client\", $metadata: deserializeMetadata(parsedOutput) }, deserialized);\n return [2 /*return*/, contents];\n });\n}); };\nvar deserializeAws_json1_1ResourceNotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {\n var body, deserialized, contents;\n return __generator(this, function (_a) {\n body = parsedOutput.body;\n deserialized = deserializeAws_json1_1ResourceNotFoundException(body, context);\n contents = __assign({ name: \"ResourceNotFoundException\", $fault: \"client\", $metadata: deserializeMetadata(parsedOutput) }, deserialized);\n return [2 /*return*/, contents];\n });\n}); };\nvar deserializeAws_json1_1TooManyRequestsExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {\n var body, deserialized, contents;\n return __generator(this, function (_a) {\n body = parsedOutput.body;\n deserialized = deserializeAws_json1_1TooManyRequestsException(body, context);\n contents = __assign({ name: \"TooManyRequestsException\", $fault: \"client\", $metadata: deserializeMetadata(parsedOutput) }, deserialized);\n return [2 /*return*/, contents];\n });\n}); };\nvar serializeAws_json1_1CognitoIdentityProvider = function (input, context) {\n return __assign(__assign(__assign({}, (input.ClientId !== undefined && input.ClientId !== null && { ClientId: input.ClientId })), (input.ProviderName !== undefined && input.ProviderName !== null && { ProviderName: input.ProviderName })), (input.ServerSideTokenCheck !== undefined &&\n input.ServerSideTokenCheck !== null && { ServerSideTokenCheck: input.ServerSideTokenCheck }));\n};\nvar serializeAws_json1_1CognitoIdentityProviderList = function (input, context) {\n return input\n .filter(function (e) { return e != null; })\n .map(function (entry) {\n if (entry === null) {\n return null;\n }\n return serializeAws_json1_1CognitoIdentityProvider(entry, context);\n });\n};\nvar serializeAws_json1_1CreateIdentityPoolInput = function (input, context) {\n return __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, (input.AllowClassicFlow !== undefined &&\n input.AllowClassicFlow !== null && { AllowClassicFlow: input.AllowClassicFlow })), (input.AllowUnauthenticatedIdentities !== undefined &&\n input.AllowUnauthenticatedIdentities !== null && {\n AllowUnauthenticatedIdentities: input.AllowUnauthenticatedIdentities,\n })), (input.CognitoIdentityProviders !== undefined &&\n input.CognitoIdentityProviders !== null && {\n CognitoIdentityProviders: serializeAws_json1_1CognitoIdentityProviderList(input.CognitoIdentityProviders, context),\n })), (input.DeveloperProviderName !== undefined &&\n input.DeveloperProviderName !== null && { DeveloperProviderName: input.DeveloperProviderName })), (input.IdentityPoolName !== undefined &&\n input.IdentityPoolName !== null && { IdentityPoolName: input.IdentityPoolName })), (input.IdentityPoolTags !== undefined &&\n input.IdentityPoolTags !== null && {\n IdentityPoolTags: serializeAws_json1_1IdentityPoolTagsType(input.IdentityPoolTags, context),\n })), (input.OpenIdConnectProviderARNs !== undefined &&\n input.OpenIdConnectProviderARNs !== null && {\n OpenIdConnectProviderARNs: serializeAws_json1_1OIDCProviderList(input.OpenIdConnectProviderARNs, context),\n })), (input.SamlProviderARNs !== undefined &&\n input.SamlProviderARNs !== null && {\n SamlProviderARNs: serializeAws_json1_1SAMLProviderList(input.SamlProviderARNs, context),\n })), (input.SupportedLoginProviders !== undefined &&\n input.SupportedLoginProviders !== null && {\n SupportedLoginProviders: serializeAws_json1_1IdentityProviders(input.SupportedLoginProviders, context),\n }));\n};\nvar serializeAws_json1_1DeleteIdentitiesInput = function (input, context) {\n return __assign({}, (input.IdentityIdsToDelete !== undefined &&\n input.IdentityIdsToDelete !== null && {\n IdentityIdsToDelete: serializeAws_json1_1IdentityIdList(input.IdentityIdsToDelete, context),\n }));\n};\nvar serializeAws_json1_1DeleteIdentityPoolInput = function (input, context) {\n return __assign({}, (input.IdentityPoolId !== undefined &&\n input.IdentityPoolId !== null && { IdentityPoolId: input.IdentityPoolId }));\n};\nvar serializeAws_json1_1DescribeIdentityInput = function (input, context) {\n return __assign({}, (input.IdentityId !== undefined && input.IdentityId !== null && { IdentityId: input.IdentityId }));\n};\nvar serializeAws_json1_1DescribeIdentityPoolInput = function (input, context) {\n return __assign({}, (input.IdentityPoolId !== undefined &&\n input.IdentityPoolId !== null && { IdentityPoolId: input.IdentityPoolId }));\n};\nvar serializeAws_json1_1GetCredentialsForIdentityInput = function (input, context) {\n return __assign(__assign(__assign({}, (input.CustomRoleArn !== undefined && input.CustomRoleArn !== null && { CustomRoleArn: input.CustomRoleArn })), (input.IdentityId !== undefined && input.IdentityId !== null && { IdentityId: input.IdentityId })), (input.Logins !== undefined &&\n input.Logins !== null && { Logins: serializeAws_json1_1LoginsMap(input.Logins, context) }));\n};\nvar serializeAws_json1_1GetIdentityPoolRolesInput = function (input, context) {\n return __assign({}, (input.IdentityPoolId !== undefined &&\n input.IdentityPoolId !== null && { IdentityPoolId: input.IdentityPoolId }));\n};\nvar serializeAws_json1_1GetIdInput = function (input, context) {\n return __assign(__assign(__assign({}, (input.AccountId !== undefined && input.AccountId !== null && { AccountId: input.AccountId })), (input.IdentityPoolId !== undefined &&\n input.IdentityPoolId !== null && { IdentityPoolId: input.IdentityPoolId })), (input.Logins !== undefined &&\n input.Logins !== null && { Logins: serializeAws_json1_1LoginsMap(input.Logins, context) }));\n};\nvar serializeAws_json1_1GetOpenIdTokenForDeveloperIdentityInput = function (input, context) {\n return __assign(__assign(__assign(__assign({}, (input.IdentityId !== undefined && input.IdentityId !== null && { IdentityId: input.IdentityId })), (input.IdentityPoolId !== undefined &&\n input.IdentityPoolId !== null && { IdentityPoolId: input.IdentityPoolId })), (input.Logins !== undefined &&\n input.Logins !== null && { Logins: serializeAws_json1_1LoginsMap(input.Logins, context) })), (input.TokenDuration !== undefined && input.TokenDuration !== null && { TokenDuration: input.TokenDuration }));\n};\nvar serializeAws_json1_1GetOpenIdTokenInput = function (input, context) {\n return __assign(__assign({}, (input.IdentityId !== undefined && input.IdentityId !== null && { IdentityId: input.IdentityId })), (input.Logins !== undefined &&\n input.Logins !== null && { Logins: serializeAws_json1_1LoginsMap(input.Logins, context) }));\n};\nvar serializeAws_json1_1IdentityIdList = function (input, context) {\n return input\n .filter(function (e) { return e != null; })\n .map(function (entry) {\n if (entry === null) {\n return null;\n }\n return entry;\n });\n};\nvar serializeAws_json1_1IdentityPool = function (input, context) {\n return __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, (input.AllowClassicFlow !== undefined &&\n input.AllowClassicFlow !== null && { AllowClassicFlow: input.AllowClassicFlow })), (input.AllowUnauthenticatedIdentities !== undefined &&\n input.AllowUnauthenticatedIdentities !== null && {\n AllowUnauthenticatedIdentities: input.AllowUnauthenticatedIdentities,\n })), (input.CognitoIdentityProviders !== undefined &&\n input.CognitoIdentityProviders !== null && {\n CognitoIdentityProviders: serializeAws_json1_1CognitoIdentityProviderList(input.CognitoIdentityProviders, context),\n })), (input.DeveloperProviderName !== undefined &&\n input.DeveloperProviderName !== null && { DeveloperProviderName: input.DeveloperProviderName })), (input.IdentityPoolId !== undefined &&\n input.IdentityPoolId !== null && { IdentityPoolId: input.IdentityPoolId })), (input.IdentityPoolName !== undefined &&\n input.IdentityPoolName !== null && { IdentityPoolName: input.IdentityPoolName })), (input.IdentityPoolTags !== undefined &&\n input.IdentityPoolTags !== null && {\n IdentityPoolTags: serializeAws_json1_1IdentityPoolTagsType(input.IdentityPoolTags, context),\n })), (input.OpenIdConnectProviderARNs !== undefined &&\n input.OpenIdConnectProviderARNs !== null && {\n OpenIdConnectProviderARNs: serializeAws_json1_1OIDCProviderList(input.OpenIdConnectProviderARNs, context),\n })), (input.SamlProviderARNs !== undefined &&\n input.SamlProviderARNs !== null && {\n SamlProviderARNs: serializeAws_json1_1SAMLProviderList(input.SamlProviderARNs, context),\n })), (input.SupportedLoginProviders !== undefined &&\n input.SupportedLoginProviders !== null && {\n SupportedLoginProviders: serializeAws_json1_1IdentityProviders(input.SupportedLoginProviders, context),\n }));\n};\nvar serializeAws_json1_1IdentityPoolTagsListType = function (input, context) {\n return input\n .filter(function (e) { return e != null; })\n .map(function (entry) {\n if (entry === null) {\n return null;\n }\n return entry;\n });\n};\nvar serializeAws_json1_1IdentityPoolTagsType = function (input, context) {\n return Object.entries(input).reduce(function (acc, _a) {\n var _b;\n var _c = __read(_a, 2), key = _c[0], value = _c[1];\n if (value === null) {\n return acc;\n }\n return __assign(__assign({}, acc), (_b = {}, _b[key] = value, _b));\n }, {});\n};\nvar serializeAws_json1_1IdentityProviders = function (input, context) {\n return Object.entries(input).reduce(function (acc, _a) {\n var _b;\n var _c = __read(_a, 2), key = _c[0], value = _c[1];\n if (value === null) {\n return acc;\n }\n return __assign(__assign({}, acc), (_b = {}, _b[key] = value, _b));\n }, {});\n};\nvar serializeAws_json1_1ListIdentitiesInput = function (input, context) {\n return __assign(__assign(__assign(__assign({}, (input.HideDisabled !== undefined && input.HideDisabled !== null && { HideDisabled: input.HideDisabled })), (input.IdentityPoolId !== undefined &&\n input.IdentityPoolId !== null && { IdentityPoolId: input.IdentityPoolId })), (input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults })), (input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }));\n};\nvar serializeAws_json1_1ListIdentityPoolsInput = function (input, context) {\n return __assign(__assign({}, (input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults })), (input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }));\n};\nvar serializeAws_json1_1ListTagsForResourceInput = function (input, context) {\n return __assign({}, (input.ResourceArn !== undefined && input.ResourceArn !== null && { ResourceArn: input.ResourceArn }));\n};\nvar serializeAws_json1_1LoginsList = function (input, context) {\n return input\n .filter(function (e) { return e != null; })\n .map(function (entry) {\n if (entry === null) {\n return null;\n }\n return entry;\n });\n};\nvar serializeAws_json1_1LoginsMap = function (input, context) {\n return Object.entries(input).reduce(function (acc, _a) {\n var _b;\n var _c = __read(_a, 2), key = _c[0], value = _c[1];\n if (value === null) {\n return acc;\n }\n return __assign(__assign({}, acc), (_b = {}, _b[key] = value, _b));\n }, {});\n};\nvar serializeAws_json1_1LookupDeveloperIdentityInput = function (input, context) {\n return __assign(__assign(__assign(__assign(__assign({}, (input.DeveloperUserIdentifier !== undefined &&\n input.DeveloperUserIdentifier !== null && { DeveloperUserIdentifier: input.DeveloperUserIdentifier })), (input.IdentityId !== undefined && input.IdentityId !== null && { IdentityId: input.IdentityId })), (input.IdentityPoolId !== undefined &&\n input.IdentityPoolId !== null && { IdentityPoolId: input.IdentityPoolId })), (input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults })), (input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }));\n};\nvar serializeAws_json1_1MappingRule = function (input, context) {\n return __assign(__assign(__assign(__assign({}, (input.Claim !== undefined && input.Claim !== null && { Claim: input.Claim })), (input.MatchType !== undefined && input.MatchType !== null && { MatchType: input.MatchType })), (input.RoleARN !== undefined && input.RoleARN !== null && { RoleARN: input.RoleARN })), (input.Value !== undefined && input.Value !== null && { Value: input.Value }));\n};\nvar serializeAws_json1_1MappingRulesList = function (input, context) {\n return input\n .filter(function (e) { return e != null; })\n .map(function (entry) {\n if (entry === null) {\n return null;\n }\n return serializeAws_json1_1MappingRule(entry, context);\n });\n};\nvar serializeAws_json1_1MergeDeveloperIdentitiesInput = function (input, context) {\n return __assign(__assign(__assign(__assign({}, (input.DestinationUserIdentifier !== undefined &&\n input.DestinationUserIdentifier !== null && { DestinationUserIdentifier: input.DestinationUserIdentifier })), (input.DeveloperProviderName !== undefined &&\n input.DeveloperProviderName !== null && { DeveloperProviderName: input.DeveloperProviderName })), (input.IdentityPoolId !== undefined &&\n input.IdentityPoolId !== null && { IdentityPoolId: input.IdentityPoolId })), (input.SourceUserIdentifier !== undefined &&\n input.SourceUserIdentifier !== null && { SourceUserIdentifier: input.SourceUserIdentifier }));\n};\nvar serializeAws_json1_1OIDCProviderList = function (input, context) {\n return input\n .filter(function (e) { return e != null; })\n .map(function (entry) {\n if (entry === null) {\n return null;\n }\n return entry;\n });\n};\nvar serializeAws_json1_1RoleMapping = function (input, context) {\n return __assign(__assign(__assign({}, (input.AmbiguousRoleResolution !== undefined &&\n input.AmbiguousRoleResolution !== null && { AmbiguousRoleResolution: input.AmbiguousRoleResolution })), (input.RulesConfiguration !== undefined &&\n input.RulesConfiguration !== null && {\n RulesConfiguration: serializeAws_json1_1RulesConfigurationType(input.RulesConfiguration, context),\n })), (input.Type !== undefined && input.Type !== null && { Type: input.Type }));\n};\nvar serializeAws_json1_1RoleMappingMap = function (input, context) {\n return Object.entries(input).reduce(function (acc, _a) {\n var _b;\n var _c = __read(_a, 2), key = _c[0], value = _c[1];\n if (value === null) {\n return acc;\n }\n return __assign(__assign({}, acc), (_b = {}, _b[key] = serializeAws_json1_1RoleMapping(value, context), _b));\n }, {});\n};\nvar serializeAws_json1_1RolesMap = function (input, context) {\n return Object.entries(input).reduce(function (acc, _a) {\n var _b;\n var _c = __read(_a, 2), key = _c[0], value = _c[1];\n if (value === null) {\n return acc;\n }\n return __assign(__assign({}, acc), (_b = {}, _b[key] = value, _b));\n }, {});\n};\nvar serializeAws_json1_1RulesConfigurationType = function (input, context) {\n return __assign({}, (input.Rules !== undefined &&\n input.Rules !== null && { Rules: serializeAws_json1_1MappingRulesList(input.Rules, context) }));\n};\nvar serializeAws_json1_1SAMLProviderList = function (input, context) {\n return input\n .filter(function (e) { return e != null; })\n .map(function (entry) {\n if (entry === null) {\n return null;\n }\n return entry;\n });\n};\nvar serializeAws_json1_1SetIdentityPoolRolesInput = function (input, context) {\n return __assign(__assign(__assign({}, (input.IdentityPoolId !== undefined &&\n input.IdentityPoolId !== null && { IdentityPoolId: input.IdentityPoolId })), (input.RoleMappings !== undefined &&\n input.RoleMappings !== null && { RoleMappings: serializeAws_json1_1RoleMappingMap(input.RoleMappings, context) })), (input.Roles !== undefined &&\n input.Roles !== null && { Roles: serializeAws_json1_1RolesMap(input.Roles, context) }));\n};\nvar serializeAws_json1_1TagResourceInput = function (input, context) {\n return __assign(__assign({}, (input.ResourceArn !== undefined && input.ResourceArn !== null && { ResourceArn: input.ResourceArn })), (input.Tags !== undefined &&\n input.Tags !== null && { Tags: serializeAws_json1_1IdentityPoolTagsType(input.Tags, context) }));\n};\nvar serializeAws_json1_1UnlinkDeveloperIdentityInput = function (input, context) {\n return __assign(__assign(__assign(__assign({}, (input.DeveloperProviderName !== undefined &&\n input.DeveloperProviderName !== null && { DeveloperProviderName: input.DeveloperProviderName })), (input.DeveloperUserIdentifier !== undefined &&\n input.DeveloperUserIdentifier !== null && { DeveloperUserIdentifier: input.DeveloperUserIdentifier })), (input.IdentityId !== undefined && input.IdentityId !== null && { IdentityId: input.IdentityId })), (input.IdentityPoolId !== undefined &&\n input.IdentityPoolId !== null && { IdentityPoolId: input.IdentityPoolId }));\n};\nvar serializeAws_json1_1UnlinkIdentityInput = function (input, context) {\n return __assign(__assign(__assign({}, (input.IdentityId !== undefined && input.IdentityId !== null && { IdentityId: input.IdentityId })), (input.Logins !== undefined &&\n input.Logins !== null && { Logins: serializeAws_json1_1LoginsMap(input.Logins, context) })), (input.LoginsToRemove !== undefined &&\n input.LoginsToRemove !== null && {\n LoginsToRemove: serializeAws_json1_1LoginsList(input.LoginsToRemove, context),\n }));\n};\nvar serializeAws_json1_1UntagResourceInput = function (input, context) {\n return __assign(__assign({}, (input.ResourceArn !== undefined && input.ResourceArn !== null && { ResourceArn: input.ResourceArn })), (input.TagKeys !== undefined &&\n input.TagKeys !== null && { TagKeys: serializeAws_json1_1IdentityPoolTagsListType(input.TagKeys, context) }));\n};\nvar deserializeAws_json1_1CognitoIdentityProvider = function (output, context) {\n return {\n ClientId: output.ClientId !== undefined && output.ClientId !== null ? output.ClientId : undefined,\n ProviderName: output.ProviderName !== undefined && output.ProviderName !== null ? output.ProviderName : undefined,\n ServerSideTokenCheck: output.ServerSideTokenCheck !== undefined && output.ServerSideTokenCheck !== null\n ? output.ServerSideTokenCheck\n : undefined,\n };\n};\nvar deserializeAws_json1_1CognitoIdentityProviderList = function (output, context) {\n return (output || [])\n .filter(function (e) { return e != null; })\n .map(function (entry) {\n if (entry === null) {\n return null;\n }\n return deserializeAws_json1_1CognitoIdentityProvider(entry, context);\n });\n};\nvar deserializeAws_json1_1ConcurrentModificationException = function (output, context) {\n return {\n message: output.message !== undefined && output.message !== null ? output.message : undefined,\n };\n};\nvar deserializeAws_json1_1Credentials = function (output, context) {\n return {\n AccessKeyId: output.AccessKeyId !== undefined && output.AccessKeyId !== null ? output.AccessKeyId : undefined,\n Expiration: output.Expiration !== undefined && output.Expiration !== null\n ? new Date(Math.round(output.Expiration * 1000))\n : undefined,\n SecretKey: output.SecretKey !== undefined && output.SecretKey !== null ? output.SecretKey : undefined,\n SessionToken: output.SessionToken !== undefined && output.SessionToken !== null ? output.SessionToken : undefined,\n };\n};\nvar deserializeAws_json1_1DeleteIdentitiesResponse = function (output, context) {\n return {\n UnprocessedIdentityIds: output.UnprocessedIdentityIds !== undefined && output.UnprocessedIdentityIds !== null\n ? deserializeAws_json1_1UnprocessedIdentityIdList(output.UnprocessedIdentityIds, context)\n : undefined,\n };\n};\nvar deserializeAws_json1_1DeveloperUserAlreadyRegisteredException = function (output, context) {\n return {\n message: output.message !== undefined && output.message !== null ? output.message : undefined,\n };\n};\nvar deserializeAws_json1_1DeveloperUserIdentifierList = function (output, context) {\n return (output || [])\n .filter(function (e) { return e != null; })\n .map(function (entry) {\n if (entry === null) {\n return null;\n }\n return entry;\n });\n};\nvar deserializeAws_json1_1ExternalServiceException = function (output, context) {\n return {\n message: output.message !== undefined && output.message !== null ? output.message : undefined,\n };\n};\nvar deserializeAws_json1_1GetCredentialsForIdentityResponse = function (output, context) {\n return {\n Credentials: output.Credentials !== undefined && output.Credentials !== null\n ? deserializeAws_json1_1Credentials(output.Credentials, context)\n : undefined,\n IdentityId: output.IdentityId !== undefined && output.IdentityId !== null ? output.IdentityId : undefined,\n };\n};\nvar deserializeAws_json1_1GetIdentityPoolRolesResponse = function (output, context) {\n return {\n IdentityPoolId: output.IdentityPoolId !== undefined && output.IdentityPoolId !== null ? output.IdentityPoolId : undefined,\n RoleMappings: output.RoleMappings !== undefined && output.RoleMappings !== null\n ? deserializeAws_json1_1RoleMappingMap(output.RoleMappings, context)\n : undefined,\n Roles: output.Roles !== undefined && output.Roles !== null\n ? deserializeAws_json1_1RolesMap(output.Roles, context)\n : undefined,\n };\n};\nvar deserializeAws_json1_1GetIdResponse = function (output, context) {\n return {\n IdentityId: output.IdentityId !== undefined && output.IdentityId !== null ? output.IdentityId : undefined,\n };\n};\nvar deserializeAws_json1_1GetOpenIdTokenForDeveloperIdentityResponse = function (output, context) {\n return {\n IdentityId: output.IdentityId !== undefined && output.IdentityId !== null ? output.IdentityId : undefined,\n Token: output.Token !== undefined && output.Token !== null ? output.Token : undefined,\n };\n};\nvar deserializeAws_json1_1GetOpenIdTokenResponse = function (output, context) {\n return {\n IdentityId: output.IdentityId !== undefined && output.IdentityId !== null ? output.IdentityId : undefined,\n Token: output.Token !== undefined && output.Token !== null ? output.Token : undefined,\n };\n};\nvar deserializeAws_json1_1IdentitiesList = function (output, context) {\n return (output || [])\n .filter(function (e) { return e != null; })\n .map(function (entry) {\n if (entry === null) {\n return null;\n }\n return deserializeAws_json1_1IdentityDescription(entry, context);\n });\n};\nvar deserializeAws_json1_1IdentityDescription = function (output, context) {\n return {\n CreationDate: output.CreationDate !== undefined && output.CreationDate !== null\n ? new Date(Math.round(output.CreationDate * 1000))\n : undefined,\n IdentityId: output.IdentityId !== undefined && output.IdentityId !== null ? output.IdentityId : undefined,\n LastModifiedDate: output.LastModifiedDate !== undefined && output.LastModifiedDate !== null\n ? new Date(Math.round(output.LastModifiedDate * 1000))\n : undefined,\n Logins: output.Logins !== undefined && output.Logins !== null\n ? deserializeAws_json1_1LoginsList(output.Logins, context)\n : undefined,\n };\n};\nvar deserializeAws_json1_1IdentityPool = function (output, context) {\n return {\n AllowClassicFlow: output.AllowClassicFlow !== undefined && output.AllowClassicFlow !== null ? output.AllowClassicFlow : undefined,\n AllowUnauthenticatedIdentities: output.AllowUnauthenticatedIdentities !== undefined && output.AllowUnauthenticatedIdentities !== null\n ? output.AllowUnauthenticatedIdentities\n : undefined,\n CognitoIdentityProviders: output.CognitoIdentityProviders !== undefined && output.CognitoIdentityProviders !== null\n ? deserializeAws_json1_1CognitoIdentityProviderList(output.CognitoIdentityProviders, context)\n : undefined,\n DeveloperProviderName: output.DeveloperProviderName !== undefined && output.DeveloperProviderName !== null\n ? output.DeveloperProviderName\n : undefined,\n IdentityPoolId: output.IdentityPoolId !== undefined && output.IdentityPoolId !== null ? output.IdentityPoolId : undefined,\n IdentityPoolName: output.IdentityPoolName !== undefined && output.IdentityPoolName !== null ? output.IdentityPoolName : undefined,\n IdentityPoolTags: output.IdentityPoolTags !== undefined && output.IdentityPoolTags !== null\n ? deserializeAws_json1_1IdentityPoolTagsType(output.IdentityPoolTags, context)\n : undefined,\n OpenIdConnectProviderARNs: output.OpenIdConnectProviderARNs !== undefined && output.OpenIdConnectProviderARNs !== null\n ? deserializeAws_json1_1OIDCProviderList(output.OpenIdConnectProviderARNs, context)\n : undefined,\n SamlProviderARNs: output.SamlProviderARNs !== undefined && output.SamlProviderARNs !== null\n ? deserializeAws_json1_1SAMLProviderList(output.SamlProviderARNs, context)\n : undefined,\n SupportedLoginProviders: output.SupportedLoginProviders !== undefined && output.SupportedLoginProviders !== null\n ? deserializeAws_json1_1IdentityProviders(output.SupportedLoginProviders, context)\n : undefined,\n };\n};\nvar deserializeAws_json1_1IdentityPoolShortDescription = function (output, context) {\n return {\n IdentityPoolId: output.IdentityPoolId !== undefined && output.IdentityPoolId !== null ? output.IdentityPoolId : undefined,\n IdentityPoolName: output.IdentityPoolName !== undefined && output.IdentityPoolName !== null ? output.IdentityPoolName : undefined,\n };\n};\nvar deserializeAws_json1_1IdentityPoolsList = function (output, context) {\n return (output || [])\n .filter(function (e) { return e != null; })\n .map(function (entry) {\n if (entry === null) {\n return null;\n }\n return deserializeAws_json1_1IdentityPoolShortDescription(entry, context);\n });\n};\nvar deserializeAws_json1_1IdentityPoolTagsType = function (output, context) {\n return Object.entries(output).reduce(function (acc, _a) {\n var _b;\n var _c = __read(_a, 2), key = _c[0], value = _c[1];\n if (value === null) {\n return acc;\n }\n return __assign(__assign({}, acc), (_b = {}, _b[key] = value, _b));\n }, {});\n};\nvar deserializeAws_json1_1IdentityProviders = function (output, context) {\n return Object.entries(output).reduce(function (acc, _a) {\n var _b;\n var _c = __read(_a, 2), key = _c[0], value = _c[1];\n if (value === null) {\n return acc;\n }\n return __assign(__assign({}, acc), (_b = {}, _b[key] = value, _b));\n }, {});\n};\nvar deserializeAws_json1_1InternalErrorException = function (output, context) {\n return {\n message: output.message !== undefined && output.message !== null ? output.message : undefined,\n };\n};\nvar deserializeAws_json1_1InvalidIdentityPoolConfigurationException = function (output, context) {\n return {\n message: output.message !== undefined && output.message !== null ? output.message : undefined,\n };\n};\nvar deserializeAws_json1_1InvalidParameterException = function (output, context) {\n return {\n message: output.message !== undefined && output.message !== null ? output.message : undefined,\n };\n};\nvar deserializeAws_json1_1LimitExceededException = function (output, context) {\n return {\n message: output.message !== undefined && output.message !== null ? output.message : undefined,\n };\n};\nvar deserializeAws_json1_1ListIdentitiesResponse = function (output, context) {\n return {\n Identities: output.Identities !== undefined && output.Identities !== null\n ? deserializeAws_json1_1IdentitiesList(output.Identities, context)\n : undefined,\n IdentityPoolId: output.IdentityPoolId !== undefined && output.IdentityPoolId !== null ? output.IdentityPoolId : undefined,\n NextToken: output.NextToken !== undefined && output.NextToken !== null ? output.NextToken : undefined,\n };\n};\nvar deserializeAws_json1_1ListIdentityPoolsResponse = function (output, context) {\n return {\n IdentityPools: output.IdentityPools !== undefined && output.IdentityPools !== null\n ? deserializeAws_json1_1IdentityPoolsList(output.IdentityPools, context)\n : undefined,\n NextToken: output.NextToken !== undefined && output.NextToken !== null ? output.NextToken : undefined,\n };\n};\nvar deserializeAws_json1_1ListTagsForResourceResponse = function (output, context) {\n return {\n Tags: output.Tags !== undefined && output.Tags !== null\n ? deserializeAws_json1_1IdentityPoolTagsType(output.Tags, context)\n : undefined,\n };\n};\nvar deserializeAws_json1_1LoginsList = function (output, context) {\n return (output || [])\n .filter(function (e) { return e != null; })\n .map(function (entry) {\n if (entry === null) {\n return null;\n }\n return entry;\n });\n};\nvar deserializeAws_json1_1LookupDeveloperIdentityResponse = function (output, context) {\n return {\n DeveloperUserIdentifierList: output.DeveloperUserIdentifierList !== undefined && output.DeveloperUserIdentifierList !== null\n ? deserializeAws_json1_1DeveloperUserIdentifierList(output.DeveloperUserIdentifierList, context)\n : undefined,\n IdentityId: output.IdentityId !== undefined && output.IdentityId !== null ? output.IdentityId : undefined,\n NextToken: output.NextToken !== undefined && output.NextToken !== null ? output.NextToken : undefined,\n };\n};\nvar deserializeAws_json1_1MappingRule = function (output, context) {\n return {\n Claim: output.Claim !== undefined && output.Claim !== null ? output.Claim : undefined,\n MatchType: output.MatchType !== undefined && output.MatchType !== null ? output.MatchType : undefined,\n RoleARN: output.RoleARN !== undefined && output.RoleARN !== null ? output.RoleARN : undefined,\n Value: output.Value !== undefined && output.Value !== null ? output.Value : undefined,\n };\n};\nvar deserializeAws_json1_1MappingRulesList = function (output, context) {\n return (output || [])\n .filter(function (e) { return e != null; })\n .map(function (entry) {\n if (entry === null) {\n return null;\n }\n return deserializeAws_json1_1MappingRule(entry, context);\n });\n};\nvar deserializeAws_json1_1MergeDeveloperIdentitiesResponse = function (output, context) {\n return {\n IdentityId: output.IdentityId !== undefined && output.IdentityId !== null ? output.IdentityId : undefined,\n };\n};\nvar deserializeAws_json1_1NotAuthorizedException = function (output, context) {\n return {\n message: output.message !== undefined && output.message !== null ? output.message : undefined,\n };\n};\nvar deserializeAws_json1_1OIDCProviderList = function (output, context) {\n return (output || [])\n .filter(function (e) { return e != null; })\n .map(function (entry) {\n if (entry === null) {\n return null;\n }\n return entry;\n });\n};\nvar deserializeAws_json1_1ResourceConflictException = function (output, context) {\n return {\n message: output.message !== undefined && output.message !== null ? output.message : undefined,\n };\n};\nvar deserializeAws_json1_1ResourceNotFoundException = function (output, context) {\n return {\n message: output.message !== undefined && output.message !== null ? output.message : undefined,\n };\n};\nvar deserializeAws_json1_1RoleMapping = function (output, context) {\n return {\n AmbiguousRoleResolution: output.AmbiguousRoleResolution !== undefined && output.AmbiguousRoleResolution !== null\n ? output.AmbiguousRoleResolution\n : undefined,\n RulesConfiguration: output.RulesConfiguration !== undefined && output.RulesConfiguration !== null\n ? deserializeAws_json1_1RulesConfigurationType(output.RulesConfiguration, context)\n : undefined,\n Type: output.Type !== undefined && output.Type !== null ? output.Type : undefined,\n };\n};\nvar deserializeAws_json1_1RoleMappingMap = function (output, context) {\n return Object.entries(output).reduce(function (acc, _a) {\n var _b;\n var _c = __read(_a, 2), key = _c[0], value = _c[1];\n if (value === null) {\n return acc;\n }\n return __assign(__assign({}, acc), (_b = {}, _b[key] = deserializeAws_json1_1RoleMapping(value, context), _b));\n }, {});\n};\nvar deserializeAws_json1_1RolesMap = function (output, context) {\n return Object.entries(output).reduce(function (acc, _a) {\n var _b;\n var _c = __read(_a, 2), key = _c[0], value = _c[1];\n if (value === null) {\n return acc;\n }\n return __assign(__assign({}, acc), (_b = {}, _b[key] = value, _b));\n }, {});\n};\nvar deserializeAws_json1_1RulesConfigurationType = function (output, context) {\n return {\n Rules: output.Rules !== undefined && output.Rules !== null\n ? deserializeAws_json1_1MappingRulesList(output.Rules, context)\n : undefined,\n };\n};\nvar deserializeAws_json1_1SAMLProviderList = function (output, context) {\n return (output || [])\n .filter(function (e) { return e != null; })\n .map(function (entry) {\n if (entry === null) {\n return null;\n }\n return entry;\n });\n};\nvar deserializeAws_json1_1TagResourceResponse = function (output, context) {\n return {};\n};\nvar deserializeAws_json1_1TooManyRequestsException = function (output, context) {\n return {\n message: output.message !== undefined && output.message !== null ? output.message : undefined,\n };\n};\nvar deserializeAws_json1_1UnprocessedIdentityId = function (output, context) {\n return {\n ErrorCode: output.ErrorCode !== undefined && output.ErrorCode !== null ? output.ErrorCode : undefined,\n IdentityId: output.IdentityId !== undefined && output.IdentityId !== null ? output.IdentityId : undefined,\n };\n};\nvar deserializeAws_json1_1UnprocessedIdentityIdList = function (output, context) {\n return (output || [])\n .filter(function (e) { return e != null; })\n .map(function (entry) {\n if (entry === null) {\n return null;\n }\n return deserializeAws_json1_1UnprocessedIdentityId(entry, context);\n });\n};\nvar deserializeAws_json1_1UntagResourceResponse = function (output, context) {\n return {};\n};\nvar deserializeMetadata = function (output) {\n var _a;\n return ({\n httpStatusCode: output.statusCode,\n requestId: (_a = output.headers[\"x-amzn-requestid\"]) !== null && _a !== void 0 ? _a : output.headers[\"x-amzn-request-id\"],\n extendedRequestId: output.headers[\"x-amz-id-2\"],\n cfId: output.headers[\"x-amz-cf-id\"],\n });\n};\n// Collect low-level response body stream to Uint8Array.\nvar collectBody = function (streamBody, context) {\n if (streamBody === void 0) { streamBody = new Uint8Array(); }\n if (streamBody instanceof Uint8Array) {\n return Promise.resolve(streamBody);\n }\n return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());\n};\n// Encode Uint8Array data into string with utf-8.\nvar collectBodyString = function (streamBody, context) {\n return collectBody(streamBody, context).then(function (body) { return context.utf8Encoder(body); });\n};\nvar buildHttpRpcRequest = function (context, headers, path, resolvedHostname, body) { return __awaiter(void 0, void 0, void 0, function () {\n var _a, hostname, _b, protocol, port, contents;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0: return [4 /*yield*/, context.endpoint()];\n case 1:\n _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? \"https\" : _b, port = _a.port;\n contents = {\n protocol: protocol,\n hostname: hostname,\n port: port,\n method: \"POST\",\n path: path,\n headers: headers,\n };\n if (resolvedHostname !== undefined) {\n contents.hostname = resolvedHostname;\n }\n if (body !== undefined) {\n contents.body = body;\n }\n return [2 /*return*/, new __HttpRequest(contents)];\n }\n });\n}); };\nvar parseBody = function (streamBody, context) {\n return collectBodyString(streamBody, context).then(function (encoded) {\n if (encoded.length) {\n return JSON.parse(encoded);\n }\n return {};\n });\n};\n/**\n * Load an error code for the aws.rest-json-1.1 protocol.\n */\nvar loadRestJsonErrorCode = function (output, data) {\n var findKey = function (object, key) { return Object.keys(object).find(function (k) { return k.toLowerCase() === key.toLowerCase(); }); };\n var sanitizeErrorCode = function (rawValue) {\n var cleanValue = rawValue;\n if (cleanValue.indexOf(\":\") >= 0) {\n cleanValue = cleanValue.split(\":\")[0];\n }\n if (cleanValue.indexOf(\"#\") >= 0) {\n cleanValue = cleanValue.split(\"#\")[1];\n }\n return cleanValue;\n };\n var headerKey = findKey(output.headers, \"x-amzn-errortype\");\n if (headerKey !== undefined) {\n return sanitizeErrorCode(output.headers[headerKey]);\n }\n if (data.code !== undefined) {\n return sanitizeErrorCode(data.code);\n }\n if (data[\"__type\"] !== undefined) {\n return sanitizeErrorCode(data[\"__type\"]);\n }\n return \"\";\n};\n//# sourceMappingURL=Aws_json1_1.js.map","import { deserializerMiddleware } from \"./deserializerMiddleware\";\nimport { serializerMiddleware } from \"./serializerMiddleware\";\nexport var deserializerMiddlewareOption = {\n name: \"deserializerMiddleware\",\n step: \"deserialize\",\n tags: [\"DESERIALIZER\"],\n override: true,\n};\nexport var serializerMiddlewareOption = {\n name: \"serializerMiddleware\",\n step: \"serialize\",\n tags: [\"SERIALIZER\"],\n override: true,\n};\nexport function getSerdePlugin(config, serializer, deserializer) {\n return {\n applyToStack: function (commandStack) {\n commandStack.add(deserializerMiddleware(config, deserializer), deserializerMiddlewareOption);\n commandStack.add(serializerMiddleware(config, serializer), serializerMiddlewareOption);\n },\n };\n}\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VyZGVQbHVnaW4uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvc2VyZGVQbHVnaW4udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkF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SwgU2VyRGVDb250ZXh0PixcbiAgZGVzZXJpYWxpemVyOiBSZXNwb25zZURlc2VyaWFsaXplcjxPdXRwdXRUeXBlLCBhbnksIFNlckRlQ29udGV4dD5cbik6IFBsdWdnYWJsZTxJbnB1dFR5cGUsIE91dHB1dFR5cGU+IHtcbiAgcmV0dXJuIHtcbiAgICBhcHBseVRvU3RhY2s6IChjb21tYW5kU3RhY2s6IE1pZGRsZXdhcmVTdGFjazxJbnB1dFR5cGUsIE91dHB1dFR5cGU+KSA9PiB7XG4gICAgICBjb21tYW5kU3RhY2suYWRkKGRlc2VyaWFsaXplck1pZGRsZXdhcmUoY29uZmlnLCBkZXNlcmlhbGl6ZXIpLCBkZXNlcmlhbGl6ZXJNaWRkbGV3YXJlT3B0aW9uKTtcbiAgICAgIGNvbW1hbmRTdGFjay5hZGQoc2VyaWFsaXplck1pZGRsZXdhcmUoY29uZmlnLCBzZXJpYWxpemVyKSwgc2VyaWFsaXplck1pZGRsZXdhcmVPcHRpb24pO1xuICAgIH0sXG4gIH07XG59XG4iXX0=","import { __awaiter, __generator } from \"tslib\";\nexport var deserializerMiddleware = function (options, deserializer) { return function (next, context) { return function (args) { return __awaiter(void 0, void 0, void 0, function () {\n var response, parsed;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, next(args)];\n case 1:\n response = (_a.sent()).response;\n return [4 /*yield*/, deserializer(response, options)];\n case 2:\n parsed = _a.sent();\n return [2 /*return*/, {\n response: response,\n output: parsed,\n }];\n }\n });\n}); }; }; };\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVzZXJpYWxpemVyTWlkZGxld2FyZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kZXNlcmlhbGl6ZXJNaWRkbGV3YXJlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFTQSxNQUFNLENBQUMsSUFBTSxzQk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PiA9PiAoXG4gIG5leHQ6IERlc2VyaWFsaXplSGFuZGxlcjxJbnB1dCwgT3V0cHV0PixcbiAgY29udGV4dDogSGFuZGxlckV4ZWN1dGlvbkNvbnRleHRcbik6IERlc2VyaWFsaXplSGFuZGxlcjxJbnB1dCwgT3V0cHV0PiA9PiBhc3luYyAoXG4gIGFyZ3M6IERlc2VyaWFsaXplSGFuZGxlckFyZ3VtZW50czxJbnB1dD5cbik6IFByb21pc2U8RGVzZXJpYWxpemVIYW5kbGVyT3V0cHV0PE91dHB1dD4+ID0+IHtcbiAgY29uc3QgeyByZXNwb25zZSB9ID0gYXdhaXQgbmV4dChhcmdzKTtcbiAgY29uc3QgcGFyc2VkID0gYXdhaXQgZGVzZXJpYWxpemVyKHJlc3BvbnNlLCBvcHRpb25zKTtcbiAgcmV0dXJuIHtcbiAgICByZXNwb25zZSxcbiAgICBvdXRwdXQ6IHBhcnNlZCBhcyBPdXRwdXQsXG4gIH07XG59O1xuIl19","import { __assign, __awaiter, __generator } from \"tslib\";\nexport var serializerMiddleware = function (options, serializer) { return function (next, context) { return function (args) { return __awaiter(void 0, void 0, void 0, function () {\n var request;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, serializer(args.input, options)];\n case 1:\n request = _a.sent();\n return [2 /*return*/, next(__assign(__assign({}, args), { request: request }))];\n }\n });\n}); }; }; };\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VyaWFsaXplck1pZGRsZXdhcmUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvc2VyaWFsaXplck1pZGRsZXdhcmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQVVBLE1BQU0sQ0FBQyxJQUFNLG9CQUFvQixHQUFHLFVBQ2xDLE9BQXFCLEVBQ3JCLFVBQWdELElBQ1QsT0FBQSxVQUN2QyxJQUFxQyxFQUNyQyxPQUFnQyxJQUNJ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dzOiBTZXJpYWxpemVIYW5kbGVyQXJndW1lbnRzPElucHV0PlxuKTogUHJvbWlzZTxTZXJpYWxpemVIYW5kbGVyT3V0cHV0PE91dHB1dD4+ID0+IHtcbiAgY29uc3QgcmVxdWVzdCA9IGF3YWl0IHNlcmlhbGl6ZXIoYXJncy5pbnB1dCwgb3B0aW9ucyk7XG4gIHJldHVybiBuZXh0KHtcbiAgICAuLi5hcmdzLFxuICAgIHJlcXVlc3QsXG4gIH0pO1xufTtcbiJdfQ==","import { __assign, __read, __spread, __values } from \"tslib\";\nexport var constructStack = function () {\n var absoluteEntries = [];\n var relativeEntries = [];\n var entriesNameSet = new Set();\n var sort = function (entries) {\n return entries.sort(function (a, b) {\n return stepWeights[b.step] - stepWeights[a.step] ||\n priorityWeights[b.priority || \"normal\"] - priorityWeights[a.priority || \"normal\"];\n });\n };\n var removeByName = function (toRemove) {\n var isRemoved = false;\n var filterCb = function (entry) {\n if (entry.name && entry.name === toRemove) {\n isRemoved = true;\n entriesNameSet.delete(toRemove);\n return false;\n }\n return true;\n };\n absoluteEntries = absoluteEntries.filter(filterCb);\n relativeEntries = relativeEntries.filter(filterCb);\n return isRemoved;\n };\n var removeByReference = function (toRemove) {\n var isRemoved = false;\n var filterCb = function (entry) {\n if (entry.middleware === toRemove) {\n isRemoved = true;\n if (entry.name)\n entriesNameSet.delete(entry.name);\n return false;\n }\n return true;\n };\n absoluteEntries = absoluteEntries.filter(filterCb);\n relativeEntries = relativeEntries.filter(filterCb);\n return isRemoved;\n };\n var cloneTo = function (toStack) {\n absoluteEntries.forEach(function (entry) {\n //@ts-ignore\n toStack.add(entry.middleware, __assign({}, entry));\n });\n relativeEntries.forEach(function (entry) {\n //@ts-ignore\n toStack.addRelativeTo(entry.middleware, __assign({}, entry));\n });\n return toStack;\n };\n var expandRelativeMiddlewareList = function (from) {\n var expandedMiddlewareList = [];\n from.before.forEach(function (entry) {\n if (entry.before.length === 0 && entry.after.length === 0) {\n expandedMiddlewareList.push(entry);\n }\n else {\n expandedMiddlewareList.push.apply(expandedMiddlewareList, __spread(expandRelativeMiddlewareList(entry)));\n }\n });\n expandedMiddlewareList.push(from);\n from.after.reverse().forEach(function (entry) {\n if (entry.before.length === 0 && entry.after.length === 0) {\n expandedMiddlewareList.push(entry);\n }\n else {\n expandedMiddlewareList.push.apply(expandedMiddlewareList, __spread(expandRelativeMiddlewareList(entry)));\n }\n });\n return expandedMiddlewareList;\n };\n /**\n * Get a final list of middleware in the order of being executed in the resolved handler.\n */\n var getMiddlewareList = function () {\n var normalizedAbsoluteEntries = [];\n var normalizedRelativeEntries = [];\n var normalizedEntriesNameMap = {};\n absoluteEntries.forEach(function (entry) {\n var normalizedEntry = __assign(__assign({}, entry), { before: [], after: [] });\n if (normalizedEntry.name)\n normalizedEntriesNameMap[normalizedEntry.name] = normalizedEntry;\n normalizedAbsoluteEntries.push(normalizedEntry);\n });\n relativeEntries.forEach(function (entry) {\n var normalizedEntry = __assign(__assign({}, entry), { before: [], after: [] });\n if (normalizedEntry.name)\n normalizedEntriesNameMap[normalizedEntry.name] = normalizedEntry;\n normalizedRelativeEntries.push(normalizedEntry);\n });\n normalizedRelativeEntries.forEach(function (entry) {\n if (entry.toMiddleware) {\n var toMiddleware = normalizedEntriesNameMap[entry.toMiddleware];\n if (toMiddleware === undefined) {\n throw new Error(entry.toMiddleware + \" is not found when adding \" + (entry.name || \"anonymous\") + \" middleware \" + entry.relation + \" \" + entry.toMiddleware);\n }\n if (entry.relation === \"after\") {\n toMiddleware.after.push(entry);\n }\n if (entry.relation === \"before\") {\n toMiddleware.before.push(entry);\n }\n }\n });\n var mainChain = sort(normalizedAbsoluteEntries)\n .map(expandRelativeMiddlewareList)\n .reduce(function (wholeList, expendedMiddlewareList) {\n // TODO: Replace it with Array.flat();\n wholeList.push.apply(wholeList, __spread(expendedMiddlewareList));\n return wholeList;\n }, []);\n return mainChain.map(function (entry) { return entry.middleware; });\n };\n var stack = {\n add: function (middleware, options) {\n if (options === void 0) { options = {}; }\n var name = options.name, override = options.override;\n var entry = __assign({ step: \"initialize\", priority: \"normal\", middleware: middleware }, options);\n if (name) {\n if (entriesNameSet.has(name)) {\n if (!override)\n throw new Error(\"Duplicate middleware name '\" + name + \"'\");\n var toOverrideIndex = absoluteEntries.findIndex(function (entry) { return entry.name === name; });\n var toOverride = absoluteEntries[toOverrideIndex];\n if (toOverride.step !== entry.step || toOverride.priority !== entry.priority) {\n throw new Error(\"\\\"\" + name + \"\\\" middleware with \" + toOverride.priority + \" priority in \" + toOverride.step + \" step cannot be \" +\n (\"overridden by same-name middleware with \" + entry.priority + \" priority in \" + entry.step + \" step.\"));\n }\n absoluteEntries.splice(toOverrideIndex, 1);\n }\n entriesNameSet.add(name);\n }\n absoluteEntries.push(entry);\n },\n addRelativeTo: function (middleware, options) {\n var name = options.name, override = options.override;\n var entry = __assign({ middleware: middleware }, options);\n if (name) {\n if (entriesNameSet.has(name)) {\n if (!override)\n throw new Error(\"Duplicate middleware name '\" + name + \"'\");\n var toOverrideIndex = relativeEntries.findIndex(function (entry) { return entry.name === name; });\n var toOverride = relativeEntries[toOverrideIndex];\n if (toOverride.toMiddleware !== entry.toMiddleware || toOverride.relation !== entry.relation) {\n throw new Error(\"\\\"\" + name + \"\\\" middleware \" + toOverride.relation + \" \\\"\" + toOverride.toMiddleware + \"\\\" middleware cannot be overridden \" +\n (\"by same-name middleware \" + entry.relation + \" \\\"\" + entry.toMiddleware + \"\\\" middleware.\"));\n }\n relativeEntries.splice(toOverrideIndex, 1);\n }\n entriesNameSet.add(name);\n }\n relativeEntries.push(entry);\n },\n clone: function () { return cloneTo(constructStack()); },\n use: function (plugin) {\n plugin.applyToStack(stack);\n },\n remove: function (toRemove) {\n if (typeof toRemove === \"string\")\n return removeByName(toRemove);\n else\n return removeByReference(toRemove);\n },\n removeByTag: function (toRemove) {\n var isRemoved = false;\n var filterCb = function (entry) {\n var tags = entry.tags, name = entry.name;\n if (tags && tags.includes(toRemove)) {\n if (name)\n entriesNameSet.delete(name);\n isRemoved = true;\n return false;\n }\n return true;\n };\n absoluteEntries = absoluteEntries.filter(filterCb);\n relativeEntries = relativeEntries.filter(filterCb);\n return isRemoved;\n },\n concat: function (from) {\n var cloned = cloneTo(constructStack());\n cloned.use(from);\n return cloned;\n },\n applyToStack: cloneTo,\n resolve: function (handler, context) {\n var e_1, _a;\n try {\n for (var _b = __values(getMiddlewareList().reverse()), _c = _b.next(); !_c.done; _c = _b.next()) {\n var middleware = _c.value;\n handler = middleware(handler, context);\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n return handler;\n },\n };\n return stack;\n};\nvar stepWeights = {\n initialize: 5,\n serialize: 4,\n build: 3,\n finalizeRequest: 2,\n deserialize: 1,\n};\nvar priorityWeights = {\n high: 3,\n normal: 2,\n low: 1,\n};\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTWlkZGxld2FyZVN0YWNrLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL01pZGRsZXdhcmVTdGFjay50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBZ0JBLE1BQU0sQ0FBQyxJQUFNLGNBQWMsR0FBRztJQUM1QixJQUFJLGVBQWUsR0FBNkMsRUFBRSxDQUFDO0lBQ25FLElBQUksZUFBZSxHQUE2QyxFQUFFLENBQUM7SUFDbkUsSUFBTSxjQUFjLEdBQWdCLElBQUksR0FBRyxFQUFFLENBQUM7SUFFOUMsSUFBTSxJQUFJLEdBQUcsVUFBbUQsT0FBWTtRQUMxRSxPQUFBLE9BQU8sQ0FBQyxJQUFJLENBQ1YsVUFBQyxDQUFDLEVBQUUsQ0FBQztZQUNILE9BQUEsV0FBVyxDQUFDLENBQUMsQ0FBQyxJQUFJLENBQUMsR0FBRyxXQUFXLENBQUMsQ0FBQ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RNaWRkbGV3YXJlTGlzdCgpLnJldmVyc2UoKSkge1xuICAgICAgICBoYW5kbGVyID0gbWlkZGxld2FyZShoYW5kbGVyIGFzIEhhbmRsZXI8SW5wdXQsIE91dHB1dFR5cGU+LCBjb250ZXh0KSBhcyBhbnk7XG4gICAgICB9XG4gICAgICByZXR1cm4gaGFuZGxlciBhcyBIYW5kbGVyPElucHV0VHlwZSwgT3V0cHV0VHlwZT47XG4gICAgfSxcbiAgfTtcbiAgcmV0dXJuIHN0YWNrO1xufTtcblxuY29uc3Qgc3RlcFdlaWdodHM6IHsgW2tleSBpbiBTdGVwXTogbnVtYmVyIH0gPSB7XG4gIGluaXRpYWxpemU6IDUsXG4gIHNlcmlhbGl6ZTogNCxcbiAgYnVpbGQ6IDMsXG4gIGZpbmFsaXplUmVxdWVzdDogMixcbiAgZGVzZXJpYWxpemU6IDEsXG59O1xuXG5jb25zdCBwcmlvcml0eVdlaWdodHM6IHsgW2tleSBpbiBQcmlvcml0eV06IG51bWJlciB9ID0ge1xuICBoaWdoOiAzLFxuICBub3JtYWw6IDIsXG4gIGxvdzogMSxcbn07XG4iXX0=","import { constructStack } from \"@aws-sdk/middleware-stack\";\nvar Client = /** @class */ (function () {\n function Client(config) {\n this.middlewareStack = constructStack();\n this.config = config;\n }\n Client.prototype.send = function (command, optionsOrCb, cb) {\n var options = typeof optionsOrCb !== \"function\" ? optionsOrCb : undefined;\n var callback = typeof optionsOrCb === \"function\" ? optionsOrCb : cb;\n var handler = command.resolveMiddleware(this.middlewareStack, this.config, options);\n if (callback) {\n handler(command)\n .then(function (result) { return callback(null, result.output); }, function (err) { return callback(err); })\n .catch(\n // prevent any errors thrown in the callback from triggering an\n // unhandled promise rejection\n function () { });\n }\n else {\n return handler(command).then(function (result) { return result.output; });\n }\n };\n Client.prototype.destroy = function () {\n if (this.config.requestHandler.destroy)\n this.config.requestHandler.destroy();\n };\n return Client;\n}());\nexport { Client };\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJza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MuY29uZmlnLnJlcXVlc3RIYW5kbGVyLmRlc3Ryb3koKTtcbiAgfVxufVxuIl19","import { constructStack } from \"@aws-sdk/middleware-stack\";\nvar Command = /** @class */ (function () {\n function Command() {\n this.middlewareStack = constructStack();\n }\n return Command;\n}());\nexport { Command };\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbWFuZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb21tYW5kLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxjQUFjLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUczRDtJQUFBO1FBUVcsb0JBQWUsR0FBb0MsY0FBYyxFQUFpQixDQUFDO0lBTTlGLENBQUM7SUFBRCxjQUFDO0FBQUQsQ0FBQyxBQWRELElBY0MiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBjb25zdHJ1Y3RTdGFjayB9IGZyb20gXCJAYXdzLXNkay9taWRkbGV3YXJlLXN0YWNrXCI7XG5pbXBvcnQgeyBDb21tYW5kIGFzIElDb21tYW5kLCBIYW5kbGVyLCBNZXRhZGF0YUJlYXJlciwgTWlkZGxld2FyZVN0YWNrIGFzIElNaWRkbGV3YXJlU3RhY2sgfSBmcm9tIFwiQGF3cy1zZGsvdHlwZXNcIjtcblxuZXhwb3J0IGFic3RyYWN0IGNsYXNzIENvbW1hbmQ8XG4gIElucHV0IGV4dGVuZHMgQ2xpZW50SW5wdXQsXG4gIE91dHB1dCBleHRlbmRzIENsaWVudE91dHB1dCxcbiAgUmVzb2x2ZWRDbGllbnRDb25maWd1cmF0aW9uLFxuICBDbGllbnRJbnB1dCBleHRlbmRzIG9iamVjdCA9IGFueSxcbiAgQ2xpZW50T3V0cHV0IGV4dGVuZHMgTWV0YWRhdGFCZWFyZXIgPSBhbnlcbj4gaW1wbGVtZW50cyBJQ29tbWFuZDxDbGllbnRJbnB1dCwgSW5wdXQsIENsaWVudE91dHB1dCwgT3V0cHV0LCBSZXNvbHZlZENsaWVudENvbmZpZ3VyYXRpb24+IHtcbiAgYWJzdHJhY3QgaW5wdXQ6IElucHV0O1xuICByZWFkb25seSBtaWRkbGV3YXJlU3RhY2s6IElNaWRkbGV3YXJlU3RhY2s8SW5wdXQsIE91dHB1dD4gPSBjb25zdHJ1Y3RTdGFjazxJbnB1dCwgT3V0cHV0PigpO1xuICBhYnN0cmFjdCByZXNvbHZlTWlkZGxld2FyZShcbiAgICBzdGFjazogSU1pZGRsZXdhcmVTdGFjazxDbGllbnRJbnB1dCwgQ2xpZW50T3V0cHV0PixcbiAgICBjb25maWd1cmF0aW9uOiBSZXNvbHZlZENsaWVudENvbmZpZ3VyYXRpb24sXG4gICAgb3B0aW9uczogYW55XG4gICk6IEhhbmRsZXI8SW5wdXQsIE91dHB1dD47XG59XG4iXX0=","/**\n * Lazy String holder for JSON typed contents.\n */\nimport { __extends, __read, __spread } from \"tslib\";\n/**\n * Because of https://github.com/microsoft/tslib/issues/95,\n * TS 'extends' shim doesn't support extending native types like String.\n * So here we create StringWrapper that duplicate everything from String\n * class including its prototype chain. So we can extend from here.\n */\n// @ts-ignore StringWrapper implementation is not a simple constructor\nexport var StringWrapper = function () {\n //@ts-ignore 'this' cannot be assigned to any, but Object.getPrototypeOf accepts any\n var Class = Object.getPrototypeOf(this).constructor;\n var Constructor = Function.bind.apply(String, __spread([null], arguments));\n //@ts-ignore Call wrapped String constructor directly, don't bother typing it.\n var instance = new Constructor();\n Object.setPrototypeOf(instance, Class.prototype);\n return instance;\n};\nStringWrapper.prototype = Object.create(String.prototype, {\n constructor: {\n value: StringWrapper,\n enumerable: false,\n writable: true,\n configurable: true,\n },\n});\nObject.setPrototypeOf(StringWrapper, String);\nvar LazyJsonString = /** @class */ (function (_super) {\n __extends(LazyJsonString, _super);\n function LazyJsonString() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n LazyJsonString.prototype.deserializeJSON = function () {\n return JSON.parse(_super.prototype.toString.call(this));\n };\n LazyJsonString.prototype.toJSON = function () {\n return _super.prototype.toString.call(this);\n };\n LazyJsonString.fromObject = function (object) {\n if (object instanceof LazyJsonString) {\n return object;\n }\n else if (object instanceof String || typeof object === \"string\") {\n return new LazyJsonString(object);\n }\n return new LazyJsonString(JSON.stringify(object));\n };\n return LazyJsonString;\n}(StringWrapper));\nexport { LazyJsonString };\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF6eS1qc29uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2xhenktanNvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRzs7QUFNSDs7Ozs7R0FLRztBQUNILHNFQUFzRTtBQUN0RSxNQUFNLENBQUMsSUFBTSxhQUFhLEdBQWtCO0lBQzFDLG9GQUFvRjtJQUNwRixJQUFNLEtBQUssR0FBRyxNQUFNLENBQUMsY0FBYyxDQUFDLElBQUksQ0FBQyxDQUFDLFdBQVcsQ0FBQztJQUN0RCxJQUFNLFdBQVcsR0FBRyxRQUFRLENBQUMsSUFBSSxDQUFDLEtBQUssQ0FBQyxNQUFNLFlBQUcsSUFBVyxHQUFLLFNBQVMsRUFBRSxDQUFDO0lBQzdFLDhFQUE4RTtJQUM5RSxJQUFNLFFBQVEsR0FBRyxJQUFJLFdBQVcsRUFBRSxDQUFDO0lBQ25DLE1BQU0sQ0FBQyxjQUFjLENBQUMsUUFBUSxFQUFFLEtBQUssQ0FBQyxTQUFTLENBQUMsQ0FBQztJQUNqRCxPQUFPLFFBQWtCLENBQUM7QUFDNUIsQ0FBQyxDQUFDO0FBQ0YsYUFBYSxDQUFDLFNBQVMsR0FBRyxNQUFNLENBQUMsTUFBTSxDQUFDLE1BQU0sQ0FBQyxTQUFTLEVBQUU7SUFDeEQsV0FBVyxFQUFFO1FBQ1gsS0FBSyx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m4gaW5zdGFuY2UgYXMgU3RyaW5nO1xufTtcblN0cmluZ1dyYXBwZXIucHJvdG90eXBlID0gT2JqZWN0LmNyZWF0ZShTdHJpbmcucHJvdG90eXBlLCB7XG4gIGNvbnN0cnVjdG9yOiB7XG4gICAgdmFsdWU6IFN0cmluZ1dyYXBwZXIsXG4gICAgZW51bWVyYWJsZTogZmFsc2UsXG4gICAgd3JpdGFibGU6IHRydWUsXG4gICAgY29uZmlndXJhYmxlOiB0cnVlLFxuICB9LFxufSk7XG5PYmplY3Quc2V0UHJvdG90eXBlT2YoU3RyaW5nV3JhcHBlciwgU3RyaW5nKTtcblxuZXhwb3J0IGNsYXNzIExhenlKc29uU3RyaW5nIGV4dGVuZHMgU3RyaW5nV3JhcHBlciB7XG4gIGRlc2VyaWFsaXplSlNPTigpOiBhbnkge1xuICAgIHJldHVybiBKU09OLnBhcnNlKHN1cGVyLnRvU3RyaW5nKCkpO1xuICB9XG5cbiAgdG9KU09OKCk6IHN0cmluZyB7XG4gICAgcmV0dXJuIHN1cGVyLnRvU3RyaW5nKCk7XG4gIH1cblxuICBzdGF0aWMgZnJvbU9iamVjdChvYmplY3Q6IGFueSk6IExhenlKc29uU3RyaW5nIHtcbiAgICBpZiAob2JqZWN0IGluc3RhbmNlb2YgTGF6eUpzb25TdHJpbmcpIHtcbiAgICAgIHJldHVybiBvYmplY3Q7XG4gICAgfSBlbHNlIGlmIChvYmplY3QgaW5zdGFuY2VvZiBTdHJpbmcgfHwgdHlwZW9mIG9iamVjdCA9PT0gXCJzdHJpbmdcIikge1xuICAgICAgcmV0dXJuIG5ldyBMYXp5SnNvblN0cmluZyhvYmplY3QpO1xuICAgIH1cbiAgICByZXR1cm4gbmV3IExhenlKc29uU3RyaW5nKEpTT04uc3RyaW5naWZ5KG9iamVjdCkpO1xuICB9XG59XG4iXX0=","import { __extends } from \"tslib\";\nimport { GetCredentialsForIdentityInput, GetCredentialsForIdentityResponse } from \"../models/models_0\";\nimport { deserializeAws_json1_1GetCredentialsForIdentityCommand, serializeAws_json1_1GetCredentialsForIdentityCommand, } from \"../protocols/Aws_json1_1\";\nimport { getSerdePlugin } from \"@aws-sdk/middleware-serde\";\nimport { Command as $Command } from \"@aws-sdk/smithy-client\";\n/**\n *

Returns credentials for the provided identity ID. Any provided logins will be\n * validated against supported login providers. If the token is for\n * cognito-identity.amazonaws.com, it will be passed through to AWS Security Token Service\n * with the appropriate role for the token.

\n *

This is a public API. You do not need any credentials to call this API.

\n */\nvar GetCredentialsForIdentityCommand = /** @class */ (function (_super) {\n __extends(GetCredentialsForIdentityCommand, _super);\n // Start section: command_properties\n // End section: command_properties\n function GetCredentialsForIdentityCommand(input) {\n var _this = \n // Start section: command_constructor\n _super.call(this) || this;\n _this.input = input;\n return _this;\n // End section: command_constructor\n }\n /**\n * @internal\n */\n GetCredentialsForIdentityCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {\n this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));\n var stack = clientStack.concat(this.middlewareStack);\n var logger = configuration.logger;\n var clientName = \"CognitoIdentityClient\";\n var commandName = \"GetCredentialsForIdentityCommand\";\n var handlerExecutionContext = {\n logger: logger,\n clientName: clientName,\n commandName: commandName,\n inputFilterSensitiveLog: GetCredentialsForIdentityInput.filterSensitiveLog,\n outputFilterSensitiveLog: GetCredentialsForIdentityResponse.filterSensitiveLog,\n };\n var requestHandler = configuration.requestHandler;\n return stack.resolve(function (request) {\n return requestHandler.handle(request.request, options || {});\n }, handlerExecutionContext);\n };\n GetCredentialsForIdentityCommand.prototype.serialize = function (input, context) {\n return serializeAws_json1_1GetCredentialsForIdentityCommand(input, context);\n };\n GetCredentialsForIdentityCommand.prototype.deserialize = function (output, context) {\n return deserializeAws_json1_1GetCredentialsForIdentityCommand(output, context);\n };\n return GetCredentialsForIdentityCommand;\n}($Command));\nexport { GetCredentialsForIdentityCommand };\n//# sourceMappingURL=GetCredentialsForIdentityCommand.js.map","import { __extends } from \"tslib\";\n/**\n * An error representing a failure of an individual credential provider.\n *\n * This error class has special meaning to the {@link chain} method. If a\n * provider in the chain is rejected with an error, the chain will only proceed\n * to the next provider if the value of the `tryNextLink` property on the error\n * is truthy. This allows individual providers to halt the chain and also\n * ensures the chain will stop if an entirely unexpected error is encountered.\n */\nvar ProviderError = /** @class */ (function (_super) {\n __extends(ProviderError, _super);\n function ProviderError(message, tryNextLink) {\n if (tryNextLink === void 0) { tryNextLink = true; }\n var _this = _super.call(this, message) || this;\n _this.tryNextLink = tryNextLink;\n return _this;\n }\n return ProviderError;\n}(Error));\nexport { ProviderError };\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUHJvdmlkZXJFcnJvci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9Qcm92aWRlckVycm9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7Ozs7Ozs7R0FRRztBQUNIO0lBQW1DLGlDQUFLO0lBQ3RDLHVCQUFZLE9BQWUsRUFBa0IsV0FBMkI7UUFBM0IsNEJBQUEsRUFBQSxrQkFBMkI7UUFBeEUsWUFDRSxrQkFBTSxPQUFPLENBQUMsU0FDZjtRQUY0QyxpQkFBVyxHQUFYLFdBQVcsQ0FBZ0I7O0lBRXhFLENBQUM7SUFDSCxvQkFBQztBQUFELENBQUMsQUFKRCxDQUFtQyxLQUFLLEdBSXZDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBBbiBlcnJvciByZXByZXNlbnRpbmcgYSBmYWlsdXJlIG9mIGFuIGluZGl2aWR1YWwgY3JlZGVudGlhbCBwcm92aWRlci5cbiAqXG4gKiBUaGlzIGVycm9yIGNsYXNzIGhhcyBzcGVjaWFsIG1lYW5pbmcgdG8gdGhlIHtAbGluayBjaGFpbn0gbWV0aG9kLiBJZiBhXG4gKiBwcm92aWRlciBpbiB0aGUgY2hhaW4gaXMgcmVqZWN0ZWQgd2l0aCBhbiBlcnJvciwgdGhlIGNoYWluIHdpbGwgb25seSBwcm9jZWVkXG4gKiB0byB0aGUgbmV4dCBwcm92aWRlciBpZiB0aGUgdmFsdWUgb2YgdGhlIGB0cnlOZXh0TGlua2AgcHJvcGVydHkgb24gdGhlIGVycm9yXG4gKiBpcyB0cnV0aHkuIFRoaXMgYWxsb3dzIGluZGl2aWR1YWwgcHJvdmlkZXJzIHRvIGhhbHQgdGhlIGNoYWluIGFuZCBhbHNvXG4gKiBlbnN1cmVzIHRoZSBjaGFpbiB3aWxsIHN0b3AgaWYgYW4gZW50aXJlbHkgdW5leHBlY3RlZCBlcnJvciBpcyBlbmNvdW50ZXJlZC5cbiAqL1xuZXhwb3J0IGNsYXNzIFByb3ZpZGVyRXJyb3IgZXh0ZW5kcyBFcnJvciB7XG4gIGNvbnN0cnVjdG9yKG1lc3NhZ2U6IHN0cmluZywgcHVibGljIHJlYWRvbmx5IHRyeU5leHRMaW5rOiBib29sZWFuID0gdHJ1ZSkge1xuICAgIHN1cGVyKG1lc3NhZ2UpO1xuICB9XG59XG4iXX0=","import { __read } from \"tslib\";\n/**\n * @internal\n */\nexport function resolveLogins(logins) {\n return Promise.all(Object.keys(logins).reduce(function (arr, name) {\n var tokenOrProvider = logins[name];\n if (typeof tokenOrProvider === \"string\") {\n arr.push([name, tokenOrProvider]);\n }\n else {\n arr.push(tokenOrProvider().then(function (token) { return [name, token]; }));\n }\n return arr;\n }, [])).then(function (resolvedPairs) {\n return resolvedPairs.reduce(function (logins, _a) {\n var _b = __read(_a, 2), key = _b[0], value = _b[1];\n logins[key] = value;\n return logins;\n }, {});\n });\n}\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVzb2x2ZUxvZ2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9yZXNvbHZlTG9naW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUF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TG9naW5zXCI7XG5cbi8qKlxuICogQGludGVybmFsXG4gKi9cbmV4cG9ydCBmdW5jdGlvbiByZXNvbHZlTG9naW5zKGxvZ2luczogTG9naW5zKTogUHJvbWlzZTxSZXNvbHZlZExvZ2lucz4ge1xuICByZXR1cm4gUHJvbWlzZS5hbGwoXG4gICAgT2JqZWN0LmtleXMobG9naW5zKS5yZWR1Y2UoKGFycjogQXJyYXk8W3N0cmluZywgc3RyaW5nXSB8IFByb21pc2U8W3N0cmluZywgc3RyaW5nXT4+LCBuYW1lOiBzdHJpbmcpID0+IHtcbiAgICAgIGNvbnN0IHRva2VuT3JQcm92aWRlciA9IGxvZ2luc1tuYW1lXTtcbiAgICAgIGlmICh0eXBlb2YgdG9rZW5PclByb3ZpZGVyID09PSBcInN0cmluZ1wiKSB7XG4gICAgICAgIGFyci5wdXNoKFtuYW1lLCB0b2tlbk9yUHJvdmlkZXJdIGFzIFtzdHJpbmcsIHN0cmluZ10pO1xuICAgICAgfSBlbHNlIHtcbiAgICAgICAgYXJyLnB1c2godG9rZW5PclByb3ZpZGVyKCkudGhlbigodG9rZW4pID0+IFtuYW1lLCB0b2tlbl0gYXMgW3N0cmluZywgc3RyaW5nXSkpO1xuICAgICAgfVxuICAgICAgcmV0dXJuIGFycjtcbiAgICB9LCBbXSBhcyBBcnJheTxQcm9taXNlPFtzdHJpbmcsIHN0cmluZ10+PilcbiAgKS50aGVuKChyZXNvbHZlZFBhaXJzKSA9PlxuICAgIHJlc29sdmVkUGFpcnMucmVkdWNlKChsb2dpbnM6IFJlc29sdmVkTG9naW5zLCBba2V5LCB2YWx1ZV0pID0+IHtcbiAgICAgIGxvZ2luc1trZXldID0gdmFsdWU7XG4gICAgICByZXR1cm4gbG9naW5zO1xuICAgIH0sIHt9IGFzIFJlc29sdmVkTG9naW5zKVxuICApO1xufVxuIl19","import { __awaiter, __generator } from \"tslib\";\nimport { GetCredentialsForIdentityCommand } from \"@aws-sdk/client-cognito-identity\";\nimport { ProviderError } from \"@aws-sdk/property-provider\";\nimport { resolveLogins } from \"./resolveLogins\";\n/**\n * Retrieves temporary AWS credentials using Amazon Cognito's\n * `GetCredentialsForIdentity` operation.\n *\n * Results from this function call are not cached internally.\n */\nexport function fromCognitoIdentity(parameters) {\n var _this = this;\n return function () { return __awaiter(_this, void 0, void 0, function () {\n var _a, _b, _c, AccessKeyId, Expiration, _d, SecretKey, SessionToken, _e, _f, _g, _h;\n var _j;\n return __generator(this, function (_k) {\n switch (_k.label) {\n case 0:\n _f = (_e = parameters.client).send;\n _g = GetCredentialsForIdentityCommand.bind;\n _j = {\n CustomRoleArn: parameters.customRoleArn,\n IdentityId: parameters.identityId\n };\n if (!parameters.logins) return [3 /*break*/, 2];\n return [4 /*yield*/, resolveLogins(parameters.logins)];\n case 1:\n _h = _k.sent();\n return [3 /*break*/, 3];\n case 2:\n _h = undefined;\n _k.label = 3;\n case 3: return [4 /*yield*/, _f.apply(_e, [new (_g.apply(GetCredentialsForIdentityCommand, [void 0, (_j.Logins = _h,\n _j)]))()])];\n case 4:\n _a = (_k.sent()).Credentials, _b = _a === void 0 ? throwOnMissingCredentials() : _a, _c = _b.AccessKeyId, AccessKeyId = _c === void 0 ? throwOnMissingAccessKeyId() : _c, Expiration = _b.Expiration, _d = _b.SecretKey, SecretKey = _d === void 0 ? throwOnMissingSecretKey() : _d, SessionToken = _b.SessionToken;\n return [2 /*return*/, {\n identityId: parameters.identityId,\n accessKeyId: AccessKeyId,\n secretAccessKey: SecretKey,\n sessionToken: SessionToken,\n expiration: Expiration,\n }];\n }\n });\n }); };\n}\nfunction throwOnMissingAccessKeyId() {\n throw new ProviderError(\"Response from Amazon Cognito contained no access key ID\");\n}\nfunction throwOnMissingCredentials() {\n throw new ProviderError(\"Response from Amazon Cognito contained no credentials\");\n}\nfunction throwOnMissingSecretKey() {\n throw new ProviderError(\"Response from Amazon Cognito contained no secret key\");\n}\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoi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gdGhyb3dPbk1pc3NpbmdDcmVkZW50aWFscygpOiBuZXZlciB7XG4gIHRocm93IG5ldyBQcm92aWRlckVycm9yKFwiUmVzcG9uc2UgZnJvbSBBbWF6b24gQ29nbml0byBjb250YWluZWQgbm8gY3JlZGVudGlhbHNcIik7XG59XG5cbmZ1bmN0aW9uIHRocm93T25NaXNzaW5nU2VjcmV0S2V5KCk6IG5ldmVyIHtcbiAgdGhyb3cgbmV3IFByb3ZpZGVyRXJyb3IoXCJSZXNwb25zZSBmcm9tIEFtYXpvbiBDb2duaXRvIGNvbnRhaW5lZCBubyBzZWNyZXQga2V5XCIpO1xufVxuIl19","import { __extends } from \"tslib\";\nimport { GetIdInput, GetIdResponse } from \"../models/models_0\";\nimport { deserializeAws_json1_1GetIdCommand, serializeAws_json1_1GetIdCommand } from \"../protocols/Aws_json1_1\";\nimport { getSerdePlugin } from \"@aws-sdk/middleware-serde\";\nimport { Command as $Command } from \"@aws-sdk/smithy-client\";\n/**\n *

Generates (or retrieves) a Cognito ID. Supplying multiple logins will create an\n * implicit linked account.

\n *

This is a public API. You do not need any credentials to call this API.

\n */\nvar GetIdCommand = /** @class */ (function (_super) {\n __extends(GetIdCommand, _super);\n // Start section: command_properties\n // End section: command_properties\n function GetIdCommand(input) {\n var _this = \n // Start section: command_constructor\n _super.call(this) || this;\n _this.input = input;\n return _this;\n // End section: command_constructor\n }\n /**\n * @internal\n */\n GetIdCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {\n this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));\n var stack = clientStack.concat(this.middlewareStack);\n var logger = configuration.logger;\n var clientName = \"CognitoIdentityClient\";\n var commandName = \"GetIdCommand\";\n var handlerExecutionContext = {\n logger: logger,\n clientName: clientName,\n commandName: commandName,\n inputFilterSensitiveLog: GetIdInput.filterSensitiveLog,\n outputFilterSensitiveLog: GetIdResponse.filterSensitiveLog,\n };\n var requestHandler = configuration.requestHandler;\n return stack.resolve(function (request) {\n return requestHandler.handle(request.request, options || {});\n }, handlerExecutionContext);\n };\n GetIdCommand.prototype.serialize = function (input, context) {\n return serializeAws_json1_1GetIdCommand(input, context);\n };\n GetIdCommand.prototype.deserialize = function (output, context) {\n return deserializeAws_json1_1GetIdCommand(output, context);\n };\n return GetIdCommand;\n}($Command));\nexport { GetIdCommand };\n//# sourceMappingURL=GetIdCommand.js.map","var STORE_NAME = \"IdentityIds\";\nvar IndexedDbStorage = /** @class */ (function () {\n function IndexedDbStorage(dbName) {\n if (dbName === void 0) { dbName = \"aws:cognito-identity-ids\"; }\n this.dbName = dbName;\n }\n IndexedDbStorage.prototype.getItem = function (key) {\n return this.withObjectStore(\"readonly\", function (store) {\n var req = store.get(key);\n return new Promise(function (resolve) {\n req.onerror = function () { return resolve(null); };\n req.onsuccess = function () { return resolve(req.result ? req.result.value : null); };\n });\n }).catch(function () { return null; });\n };\n IndexedDbStorage.prototype.removeItem = function (key) {\n return this.withObjectStore(\"readwrite\", function (store) {\n var req = store.delete(key);\n return new Promise(function (resolve, reject) {\n req.onerror = function () { return reject(req.error); };\n req.onsuccess = function () { return resolve(); };\n });\n });\n };\n IndexedDbStorage.prototype.setItem = function (id, value) {\n return this.withObjectStore(\"readwrite\", function (store) {\n var req = store.put({ id: id, value: value });\n return new Promise(function (resolve, reject) {\n req.onerror = function () { return reject(req.error); };\n req.onsuccess = function () { return resolve(); };\n });\n });\n };\n IndexedDbStorage.prototype.getDb = function () {\n var openDbRequest = self.indexedDB.open(this.dbName, 1);\n return new Promise(function (resolve, reject) {\n openDbRequest.onsuccess = function () {\n resolve(openDbRequest.result);\n };\n openDbRequest.onerror = function () {\n reject(openDbRequest.error);\n };\n openDbRequest.onblocked = function () {\n reject(new Error(\"Unable to access DB\"));\n };\n openDbRequest.onupgradeneeded = function () {\n var db = openDbRequest.result;\n db.onerror = function () {\n reject(new Error(\"Failed to create object store\"));\n };\n db.createObjectStore(STORE_NAME, { keyPath: \"id\" });\n };\n });\n };\n IndexedDbStorage.prototype.withObjectStore = function (mode, action) {\n return this.getDb().then(function (db) {\n var tx = db.transaction(STORE_NAME, mode);\n tx.oncomplete = function () { return db.close(); };\n return new Promise(function (resolve, reject) {\n tx.onerror = function () { return reject(tx.error); };\n resolve(action(tx.objectStore(STORE_NAME)));\n }).catch(function (err) {\n db.close();\n throw err;\n });\n });\n };\n return IndexedDbStorage;\n}());\nexport { IndexedDbStorage };\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiSW5kZXhlZERiU3RvcmFnZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9JbmRleGVkRGJTdG9yYWdlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLElBQU0sVUFBVSxHQUFHLGFBQWEsQ0FBQztBQUVqQztJQUNFLDBCQUE2QixNQUEyQztRQUEzQyx1QkFBQSxFQUFBLG1DQUEyQztRQUEzQyxXQUFNLEdBQU4sTUFBTSxDQUFxQztJQUFHLENBQUM7SUFFNUUsa0NBQU8sR0FBUCxVQUFRLEdBQVc7UUFDakIsT0FBTyxJQUFJLENBQUMsZUFBZSxDQUFDLFVBQVUsRUFBRSxVQUFDLEtBQUs7WUFDNUMsSUFBTSxHQUFHLEdBQUcsS0FBSyxDQUFDLEdBQUcsQ0FBQyxHQUFHLENBQUMsQ0FBQztZQUUzQixPQUFPLElBQUksT0FBTyxDQUFnQixVQUFDLE9BQU87Z0JBQ3hDLEdBQUcsQ0FBQyxPQUFPLEdBQUcsY0FBTSxPQUFBLE9BQU8sQ0FBQyxJQUFJLENBQUMsRUFBYixDQUFhLENBQUM7Z0JBRWxDLEdBQUcsQ0FBQyxTQUFTLEdBQUcsY0FBTSxPQUFBLE9BQU8sQ0FBQyxHQUFHLENBQUMsTUFBTSxDQUFDLENBQUMsQ0FBQyxHQUFHLENBQUMsTUFBTSxDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUMsSUFBSSxDQU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ICAgY29uc3QgZGIgPSBvcGVuRGJSZXF1ZXN0LnJlc3VsdDtcbiAgICAgICAgZGIub25lcnJvciA9ICgpID0+IHtcbiAgICAgICAgICByZWplY3QobmV3IEVycm9yKFwiRmFpbGVkIHRvIGNyZWF0ZSBvYmplY3Qgc3RvcmVcIikpO1xuICAgICAgICB9O1xuXG4gICAgICAgIGRiLmNyZWF0ZU9iamVjdFN0b3JlKFNUT1JFX05BTUUsIHsga2V5UGF0aDogXCJpZFwiIH0pO1xuICAgICAgfTtcbiAgICB9KTtcbiAgfVxuXG4gIHByaXZhdGUgd2l0aE9iamVjdFN0b3JlPFI+KG1vZGU6IElEQlRyYW5zYWN0aW9uTW9kZSwgYWN0aW9uOiAoc3RvcmU6IElEQk9iamVjdFN0b3JlKSA9PiBQcm9taXNlPFI+KTogUHJvbWlzZTxSPiB7XG4gICAgcmV0dXJuIHRoaXMuZ2V0RGIoKS50aGVuKChkYikgPT4ge1xuICAgICAgY29uc3QgdHggPSBkYi50cmFuc2FjdGlvbihTVE9SRV9OQU1FLCBtb2RlKTtcbiAgICAgIHR4Lm9uY29tcGxldGUgPSAoKSA9PiBkYi5jbG9zZSgpO1xuXG4gICAgICByZXR1cm4gbmV3IFByb21pc2U8Uj4oKHJlc29sdmUsIHJlamVjdCkgPT4ge1xuICAgICAgICB0eC5vbmVycm9yID0gKCkgPT4gcmVqZWN0KHR4LmVycm9yKTtcblxuICAgICAgICByZXNvbHZlKGFjdGlvbih0eC5vYmplY3RTdG9yZShTVE9SRV9OQU1FKSkpO1xuICAgICAgfSkuY2F0Y2goKGVycikgPT4ge1xuICAgICAgICBkYi5jbG9zZSgpO1xuICAgICAgICB0aHJvdyBlcnI7XG4gICAgICB9KTtcbiAgICB9KTtcbiAgfVxufVxuIl19","import { IndexedDbStorage } from \"./IndexedDbStorage\";\nimport { InMemoryStorage } from \"./InMemoryStorage\";\nvar inMemoryStorage = new InMemoryStorage();\nexport function localStorage() {\n if (typeof self === \"object\" && self.indexedDB) {\n return new IndexedDbStorage();\n }\n if (typeof window === \"object\" && window.localStorage) {\n return window.localStorage;\n }\n return inMemoryStorage;\n}\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9jYWxTdG9yYWdlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2xvY2FsU3RvcmFnZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUN0RCxPQUFPLEVBQUUsZUFBZSxFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFHcEQsSUFBTSxlQUFlLEdBQUcsSUFBSSxlQUFlLEVBQUUsQ0FBQztBQUU5QyxNQUFNLFVBQVUsWUFBWTtJQUMxQixJQUFJLE9BQU8sSUFBSSxLQUFLLFFBQVEsSUFBSSxJQUFJLENBQUMsU0FBUyxFQUFFO1FBQzlDLE9BQU8sSUFBSSxnQkFBZ0IsRUFBRSxDQUFDO0tBQy9CO0lBRUQsSUFBSSxPQUFPLE1BQU0sS0FBSyxRQUFRLElBQUksTUFBTSxDQUFDLFlBQVksRUFBRTtRQUNyRCxPQUFPLE1BQU0sQ0FBQyxZQUFZLENBQUM7S0FDNUI7SUFFRCxPQUFPLGVBQWUsQ0FBQztBQUN6QixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgSW5kZXhlZERiU3RvcmFnZSB9IGZyb20gXCIuL0luZGV4ZWREYlN0b3JhZ2VcIjtcbmltcG9ydCB7IEluTWVtb3J5U3RvcmFnZSB9IGZyb20gXCIuL0luTWVtb3J5U3RvcmFnZVwiO1xuaW1wb3J0IHsgU3RvcmFnZSB9IGZyb20gXCIuL1N0b3JhZ2VcIjtcblxuY29uc3QgaW5NZW1vcnlTdG9yYWdlID0gbmV3IEluTWVtb3J5U3RvcmFnZSgpO1xuXG5leHBvcnQgZnVuY3Rpb24gbG9jYWxTdG9yYWdlKCk6IFN0b3JhZ2Uge1xuICBpZiAodHlwZW9mIHNlbGYgPT09IFwib2JqZWN0XCIgJiYgc2VsZi5pbmRleGVkREIpIHtcbiAgICByZXR1cm4gbmV3IEluZGV4ZWREYlN0b3JhZ2UoKTtcbiAgfVxuXG4gIGlmICh0eXBlb2Ygd2luZG93ID09PSBcIm9iamVjdFwiICYmIHdpbmRvdy5sb2NhbFN0b3JhZ2UpIHtcbiAgICByZXR1cm4gd2luZG93LmxvY2FsU3RvcmFnZTtcbiAgfVxuXG4gIHJldHVybiBpbk1lbW9yeVN0b3JhZ2U7XG59XG4iXX0=","var InMemoryStorage = /** @class */ (function () {\n function InMemoryStorage(store) {\n if (store === void 0) { store = {}; }\n this.store = store;\n }\n InMemoryStorage.prototype.getItem = function (key) {\n if (key in this.store) {\n return this.store[key];\n }\n return null;\n };\n InMemoryStorage.prototype.removeItem = function (key) {\n delete this.store[key];\n };\n InMemoryStorage.prototype.setItem = function (key, value) {\n this.store[key] = value;\n };\n return InMemoryStorage;\n}());\nexport { InMemoryStorage };\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiSW5NZW1vcnlTdG9yYWdlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL0luTWVtb3J5U3RvcmFnZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFQTtJQUNFLHlCQUFvQixLQUFxQztRQUFyQyxzQkFBQSxFQUFBLFVBQXFDO1FBQXJDLFVBQUssR0FBTCxLQUFLLENBQWdDO0lBQUcsQ0FBQztJQUU3RCxpQ0FBTyxHQUFQLFVBQVEsR0FBVztRQUNqQixJQUFJLEdBQUcsSUFBSSxJQUFJLENBQUMsS0FBSyxFQUFFO1lBQ3JCLE9BQU8sSUFBSSxDQUFDLEtBQUssQ0FBQyxHQUFHLENBQUMsQ0FBQztTQUN4QjtRQUVELE9BQU8sSUFBSSxDQUFDO0lBQ2QsQ0FBQztJQUVELG9DQUFVLEdBQVYsVUFBVyxHQUFXO1FBQ3BCLE9BQU8sSUFBSSxDQUFDLEtBQUssQ0FBQyxHQUFHLENBQUMsQ0FBQztJQUN6QixDQUFDO0lBRUQsaUNBQU8sR0FBUCxVQUFRLEdBQVcsRUFBRSxLQUFhO1FBQ2hDLElBQUksQ0FBQyxLQUFLLENBQUMsR0FBRyxDQUFDLEdBQUcsS0FBSyxDQUFDO0lBQzFCLENBQUM7SUFDSCxzQkFBQztBQUFELENBQUMsQUFsQkQsSUFrQkMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBTdG9yYWdlIH0gZnJvbSBcIi4vU3RvcmFnZVwiO1xuXG5leHBvcnQgY2xhc3MgSW5NZW1vcnlTdG9yYWdlIGltcGxlbWVudHMgU3RvcmFnZSB7XG4gIGNvbnN0cnVjdG9yKHByaXZhdGUgc3RvcmU6IHsgW2tleTogc3RyaW5nXTogc3RyaW5nIH0gPSB7fSkge31cblxuICBnZXRJdGVtKGtleTogc3RyaW5nKTogc3RyaW5nIHwgbnVsbCB7XG4gICAgaWYgKGtleSBpbiB0aGlzLnN0b3JlKSB7XG4gICAgICByZXR1cm4gdGhpcy5zdG9yZVtrZXldO1xuICAgIH1cblxuICAgIHJldHVybiBudWxsO1xuICB9XG5cbiAgcmVtb3ZlSXRlbShrZXk6IHN0cmluZyk6IHZvaWQge1xuICAgIGRlbGV0ZSB0aGlzLnN0b3JlW2tleV07XG4gIH1cblxuICBzZXRJdGVtKGtleTogc3RyaW5nLCB2YWx1ZTogc3RyaW5nKTogdm9pZCB7XG4gICAgdGhpcy5zdG9yZVtrZXldID0gdmFsdWU7XG4gIH1cbn1cbiJdfQ==","import { __awaiter, __generator } from \"tslib\";\nimport { GetIdCommand } from \"@aws-sdk/client-cognito-identity\";\nimport { ProviderError } from \"@aws-sdk/property-provider\";\nimport { fromCognitoIdentity } from \"./fromCognitoIdentity\";\nimport { localStorage } from \"./localStorage\";\nimport { resolveLogins } from \"./resolveLogins\";\n/**\n * Retrieves or generates a unique identifier using Amazon Cognito's `GetId`\n * operation, then generates temporary AWS credentials using Amazon Cognito's\n * `GetCredentialsForIdentity` operation.\n *\n * Results from `GetId` are cached internally, but results from\n * `GetCredentialsForIdentity` are not.\n */\nexport function fromCognitoIdentityPool(_a) {\n var _this = this;\n var accountId = _a.accountId, _b = _a.cache, cache = _b === void 0 ? localStorage() : _b, client = _a.client, customRoleArn = _a.customRoleArn, identityPoolId = _a.identityPoolId, logins = _a.logins, _c = _a.userIdentifier, userIdentifier = _c === void 0 ? !logins || Object.keys(logins).length === 0 ? \"ANONYMOUS\" : undefined : _c;\n var cacheKey = userIdentifier ? \"aws:cognito-identity-credentials:\" + identityPoolId + \":\" + userIdentifier : undefined;\n var provider = function () { return __awaiter(_this, void 0, void 0, function () {\n var identityId, _a, _b, IdentityId, _c, _d, _e, _f;\n var _g;\n return __generator(this, function (_h) {\n switch (_h.label) {\n case 0:\n _a = cacheKey;\n if (!_a) return [3 /*break*/, 2];\n return [4 /*yield*/, cache.getItem(cacheKey)];\n case 1:\n _a = (_h.sent());\n _h.label = 2;\n case 2:\n identityId = _a;\n if (!!identityId) return [3 /*break*/, 7];\n _d = (_c = client).send;\n _e = GetIdCommand.bind;\n _g = {\n AccountId: accountId,\n IdentityPoolId: identityPoolId\n };\n if (!logins) return [3 /*break*/, 4];\n return [4 /*yield*/, resolveLogins(logins)];\n case 3:\n _f = _h.sent();\n return [3 /*break*/, 5];\n case 4:\n _f = undefined;\n _h.label = 5;\n case 5: return [4 /*yield*/, _d.apply(_c, [new (_e.apply(GetIdCommand, [void 0, (_g.Logins = _f,\n _g)]))()])];\n case 6:\n _b = (_h.sent()).IdentityId, IdentityId = _b === void 0 ? throwOnMissingId() : _b;\n identityId = IdentityId;\n if (cacheKey) {\n Promise.resolve(cache.setItem(cacheKey, identityId)).catch(function () { });\n }\n _h.label = 7;\n case 7:\n provider = fromCognitoIdentity({\n client: client,\n customRoleArn: customRoleArn,\n logins: logins,\n identityId: identityId,\n });\n return [2 /*return*/, provider()];\n }\n });\n }); };\n return function () {\n return provider().catch(function (err) { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n if (cacheKey) {\n Promise.resolve(cache.removeItem(cacheKey)).catch(function () { });\n }\n throw err;\n });\n }); });\n };\n}\nfunction throwOnMissingId() {\n throw new ProviderError(\"Response from Amazon Cognito contained no identity ID\");\n}\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZnJvbUNvZ25pdG9JZGVudGl0eVBvb2wuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZnJvbUNvZ25pdG9JZGVudGl0eVBvb2wudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSxrQ0FBa0MsQ0FBQztBQUNoRSxPQUFPLEVBQUUsYUFBYSxFQUFFLE1BQU0sNEJBQTRCLENBQUM7QUFJM0QsT0FBTyxFQUFFLG1CQUFtQixFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFDNUQsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBQzlDLE9BQU8sRUFBRSxhQUFhLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQztBQUdoRDs7Ozs7OztHQU9HO0FBQ0gsTUFBTSxVQUFVLHVCQUF1QixDQUFDLEVBUUo7SUFScEMsaUJBNkNDO1FBNUNDLFNBQVMsZUFBQSxFQUNULGFBQXNCLEVBQXRCLEtBQUssbUJBQUcsWUFBWSxFQUFFLEtBQUEsRUFDdEIsTUFBTSxZQUFBLEVBQ04sYUFBYSxtQkFBQSxFQUNiLGNBQWMsb0JBQUEsRUFDZCxNQUFNLFlBQUEsRUFDTixzQkFBc0YsRUFBdEYsY0FBYyxtQkFBRyxDQUFDLE1BQU0sSUFB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GEgc2hhcmluZyBiZXR3ZWVuIHRvcC1sZXZlbFxuICAgKiBicm93c2luZyBjb250ZXh0cyBhbmQgd2ViIHdvcmtlcnMuXG4gICAqXG4gICAqIFRoZSBwcm92aWRlciB3aWxsIG5vdCBjYWNoZSBJZGVudGl0eUlkcyBvZiBhdXRoZW50aWNhdGVkIHVzZXJzIHVubGVzcyBhXG4gICAqIHNlcGFyYXRlIGB1c2VySWRlbnRpdGlmZXJgIHBhcmFtZXRlciBpcyBzdXBwbGllZC5cbiAgICovXG4gIGNhY2hlPzogU3RvcmFnZTtcblxuICAvKipcbiAgICogVGhlIHVuaXF1ZSBpZGVudGlmaWVyIGZvciB0aGUgaWRlbnRpdHkgcG9vbCBmcm9tIHdoaWNoIGFuIGlkZW50aXR5IHNob3VsZFxuICAgKiBiZSByZXRyaWV2ZWQgb3IgZ2VuZXJhdGVkLlxuICAgKi9cbiAgaWRlbnRpdHlQb29sSWQ6IHN0cmluZztcblxuICAvKipcbiAgICogQSB1bmlxdWUgaWRlbnRpZmllciBmb3IgdGhlIHVzZXIuIFRoaXMgaXMgZGlzdGluY3QgZnJvbSBhIENvZ25pdG9cbiAgICogSWRlbnRpdHlJZCBhbmQgc2hvdWxkIGluc3RlYWQgYmUgYW4gaWRlbnRpZmllciBtZWFuaW5nZnVsIHRvIHlvdXJcbiAgICogYXBwbGljYXRpb24uIFVzZWQgdG8gY2FjaGUgQ29nbml0byBJZGVudGl0eUlkcyBvbiBhIHBlci11c2VyIGJhc2lzLlxuICAgKi9cbiAgdXNlcklkZW50aWZpZXI/OiBzdHJpbmc7XG59XG5cbmZ1bmN0aW9uIHRocm93T25NaXNzaW5nSWQoKTogbmV2ZXIge1xuICB0aHJvdyBuZXcgUHJvdmlkZXJFcnJvcihcIlJlc3BvbnNlIGZyb20gQW1hem9uIENvZ25pdG8gY29udGFpbmVkIG5vIGlkZW50aXR5IElEXCIpO1xufVxuIl19","export var escapeUri = function (uri) {\n // AWS percent-encodes some extra non-standard characters in a URI\n return encodeURIComponent(uri).replace(/[!'()*]/g, hexEncode);\n};\nvar hexEncode = function (c) { return \"%\" + c.charCodeAt(0).toString(16).toUpperCase(); };\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXNjYXBlLXVyaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9lc2NhcGUtdXJpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE1BQU0sQ0FBQyxJQUFNLFNBQVMsR0FBRyxVQUFDLEdBQVc7SUFDbkMsa0VBQWtFO0lBQ2xFLE9BQUEsa0JBQWtCLENBQUMsR0FBRyxDQUFDLENBQUMsT0FBTyxDQUFDLFVBQVUsRUFBRSxTQUFTLENBQUM7QUFBdEQsQ0FBc0QsQ0FBQztBQUV6RCxJQUFNLFNBQVMsR0FBRyxVQUFDLENBQVMsSUFBSyxPQUFBLE1BQUksQ0FBQyxDQUFDLFVBQVUsQ0FBQyxDQUFDLENBQUMsQ0FBQyxRQUFRLENBQUMsRUFBRSxDQUFDLENBQUMsV0FBVyxFQUFJLEVBQWhELENBQWdELENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgY29uc3QgZXNjYXBlVXJpID0gKHVyaTogc3RyaW5nKTogc3RyaW5nID0+XG4gIC8vIEFXUyBwZXJjZW50LWVuY29kZXMgc29tZSBleHRyYSBub24tc3RhbmRhcmQgY2hhcmFjdGVycyBpbiBhIFVSSVxuICBlbmNvZGVVUklDb21wb25lbnQodXJpKS5yZXBsYWNlKC9bIScoKSpdL2csIGhleEVuY29kZSk7XG5cbmNvbnN0IGhleEVuY29kZSA9IChjOiBzdHJpbmcpID0+IGAlJHtjLmNoYXJDb2RlQXQoMCkudG9TdHJpbmcoMTYpLnRvVXBwZXJDYXNlKCl9YDtcbiJdfQ==","var alphabetByEncoding = {};\nvar alphabetByValue = new Array(64);\nfor (var i = 0, start = \"A\".charCodeAt(0), limit = \"Z\".charCodeAt(0); i + start <= limit; i++) {\n var char = String.fromCharCode(i + start);\n alphabetByEncoding[char] = i;\n alphabetByValue[i] = char;\n}\nfor (var i = 0, start = \"a\".charCodeAt(0), limit = \"z\".charCodeAt(0); i + start <= limit; i++) {\n var char = String.fromCharCode(i + start);\n var index = i + 26;\n alphabetByEncoding[char] = index;\n alphabetByValue[index] = char;\n}\nfor (var i = 0; i < 10; i++) {\n alphabetByEncoding[i.toString(10)] = i + 52;\n var char = i.toString(10);\n var index = i + 52;\n alphabetByEncoding[char] = index;\n alphabetByValue[index] = char;\n}\nalphabetByEncoding[\"+\"] = 62;\nalphabetByValue[62] = \"+\";\nalphabetByEncoding[\"/\"] = 63;\nalphabetByValue[63] = \"/\";\nvar bitsPerLetter = 6;\nvar bitsPerByte = 8;\nvar maxLetterValue = 63;\n/**\n * Converts a base-64 encoded string to a Uint8Array of bytes.\n *\n * @param input The base-64 encoded string\n *\n * @see https://tools.ietf.org/html/rfc4648#section-4\n */\nexport function fromBase64(input) {\n var totalByteLength = (input.length / 4) * 3;\n if (input.substr(-2) === \"==\") {\n totalByteLength -= 2;\n }\n else if (input.substr(-1) === \"=\") {\n totalByteLength--;\n }\n var out = new ArrayBuffer(totalByteLength);\n var dataView = new DataView(out);\n for (var i = 0; i < input.length; i += 4) {\n var bits = 0;\n var bitLength = 0;\n for (var j = i, limit = i + 3; j <= limit; j++) {\n if (input[j] !== \"=\") {\n bits |= alphabetByEncoding[input[j]] << ((limit - j) * bitsPerLetter);\n bitLength += bitsPerLetter;\n }\n else {\n bits >>= bitsPerLetter;\n }\n }\n var chunkOffset = (i / 4) * 3;\n bits >>= bitLength % bitsPerByte;\n var byteLength = Math.floor(bitLength / bitsPerByte);\n for (var k = 0; k < byteLength; k++) {\n var offset = (byteLength - k - 1) * bitsPerByte;\n dataView.setUint8(chunkOffset + k, (bits & (255 << offset)) >> offset);\n }\n }\n return new Uint8Array(out);\n}\n/**\n * Converts a Uint8Array of binary data to a base-64 encoded string.\n *\n * @param input The binary data to encode\n *\n * @see https://tools.ietf.org/html/rfc4648#section-4\n */\nexport function toBase64(input) {\n var str = \"\";\n for (var i = 0; i < input.length; i += 3) {\n var bits = 0;\n var bitLength = 0;\n for (var j = i, limit = Math.min(i + 3, input.length); j < limit; j++) {\n bits |= input[j] << ((limit - j - 1) * bitsPerByte);\n bitLength += bitsPerByte;\n }\n var bitClusterCount = Math.ceil(bitLength / bitsPerLetter);\n bits <<= bitClusterCount * bitsPerLetter - bitLength;\n for (var k = 1; k <= bitClusterCount; k++) {\n var offset = (bitClusterCount - k) * bitsPerLetter;\n str += alphabetByValue[(bits & (maxLetterValue << offset)) >> offset];\n }\n str += \"==\".slice(0, 4 - bitClusterCount);\n }\n return str;\n}\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsSUFBTSxrQkFBa0IsR0FBOEIsRUFBRSxDQUFDO0FBQ3pELElBQU0sZUFBZSxHQUFrQixJQUFJLEtBQUssQ0FBQyxFQUFFLENBQUMsQ0FBQztBQUVyRCxLQUFLLElBQUksQ0FBQyxHQUFHLENBQUMsRUFBRSxLQUFLLEdBQUcsR0FBRyxDQUFDLFVBQVUsQ0FBQyxDQUFDLENBQUMsRUFBRSxLQUFLLEdBQUcsR0FBRyxDQUFDLFVBQVUsQ0FBQyxDQUFDLENBQUMsRUFBRSxDQUFDLEdBQUcsS0FBSyxJQUFJLEtBQUssRUFBRSxDQUFDLEVBQUUsRUFBRTtJQUM3RixJQUFNLElBQUksR0FBRyxNQUFNLENBQUMsWUFBWSxDQUFDLENBQUMsR0FBRyxLQUFLLENBQUMsQ0FBQztJQUM1QyxrQkFBa0IsQ0FBQyxJQUFJLENBQUMsR0FBRyxDQUFDLENBQUM7SUFDN0Is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ZzZXQpKSA+PiBvZmZzZXRdO1xuICAgIH1cblxuICAgIHN0ciArPSBcIj09XCIuc2xpY2UoMCwgNCAtIGJpdENsdXN0ZXJDb3VudCk7XG4gIH1cblxuICByZXR1cm4gc3RyO1xufVxuIl19","import { __values } from \"tslib\";\nimport { HttpResponse } from \"@aws-sdk/protocol-http\";\nimport { buildQueryString } from \"@aws-sdk/querystring-builder\";\nimport { requestTimeout } from \"./request-timeout\";\nvar FetchHttpHandler = /** @class */ (function () {\n function FetchHttpHandler(_a) {\n var _b = _a === void 0 ? {} : _a, requestTimeout = _b.requestTimeout;\n this.requestTimeout = requestTimeout;\n }\n FetchHttpHandler.prototype.destroy = function () {\n // Do nothing. TLS and HTTP/2 connection pooling is handled by the browser.\n };\n FetchHttpHandler.prototype.handle = function (request, _a) {\n var _b = _a === void 0 ? {} : _a, abortSignal = _b.abortSignal;\n var requestTimeoutInMs = this.requestTimeout;\n // if the request was already aborted, prevent doing extra work\n if (abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.aborted) {\n var abortError = new Error(\"Request aborted\");\n abortError.name = \"AbortError\";\n return Promise.reject(abortError);\n }\n var path = request.path;\n if (request.query) {\n var queryString = buildQueryString(request.query);\n if (queryString) {\n path += \"?\" + queryString;\n }\n }\n var port = request.port, method = request.method;\n var url = request.protocol + \"//\" + request.hostname + (port ? \":\" + port : \"\") + path;\n // Request constructor doesn't allow GET/HEAD request with body\n // ref: https://github.com/whatwg/fetch/issues/551\n var body = method === \"GET\" || method === \"HEAD\" ? undefined : request.body;\n var requestOptions = {\n body: body,\n headers: new Headers(request.headers),\n method: method,\n };\n // some browsers support abort signal\n if (typeof AbortController !== \"undefined\") {\n requestOptions[\"signal\"] = abortSignal;\n }\n var fetchRequest = new Request(url, requestOptions);\n var raceOfPromises = [\n fetch(fetchRequest).then(function (response) {\n var e_1, _a;\n var fetchHeaders = response.headers;\n var transformedHeaders = {};\n try {\n for (var _b = __values(fetchHeaders.entries()), _c = _b.next(); !_c.done; _c = _b.next()) {\n var pair = _c.value;\n transformedHeaders[pair[0]] = pair[1];\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n var hasReadableStream = response.body !== undefined;\n // Return the response with buffered body\n if (!hasReadableStream) {\n return response.blob().then(function (body) { return ({\n response: new HttpResponse({\n headers: transformedHeaders,\n statusCode: response.status,\n body: body,\n }),\n }); });\n }\n // Return the response with streaming body\n return {\n response: new HttpResponse({\n headers: transformedHeaders,\n statusCode: response.status,\n body: response.body,\n }),\n };\n }),\n requestTimeout(requestTimeoutInMs),\n ];\n if (abortSignal) {\n raceOfPromises.push(new Promise(function (resolve, reject) {\n abortSignal.onabort = function () {\n var abortError = new Error(\"Request aborted\");\n abortError.name = \"AbortError\";\n reject(abortError);\n };\n }));\n }\n return Promise.race(raceOfPromises);\n };\n return FetchHttpHandler;\n}());\nexport { FetchHttpHandler };\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmV0Y2gtaHR0cC1oYW5kbGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2ZldGNoLWh0dHAtaGFuZGxlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsT0FBTyxFQUE0QixZQUFZLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUNoRixPQUFPLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSw4QkFBOEIsQ0FBQztBQUdoRSxPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFlbkQ7SUFHRSwwQkFBWSxFQUFnRDtZQUFoRCxxQkFBOEMsRUFBRSxLQUFBLEVBQTlDLGNBQWMsb0JBQUE7UUFDMUIsSUFBSSxDQUFDLGNBQWMsR0FBRyxjQUFjLENBQUM7SUFDdkMsQ0F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fSksXG4gICAgICAgIH07XG4gICAgICB9KSxcbiAgICAgIHJlcXVlc3RUaW1lb3V0KHJlcXVlc3RUaW1lb3V0SW5NcyksXG4gICAgXTtcbiAgICBpZiAoYWJvcnRTaWduYWwpIHtcbiAgICAgIHJhY2VPZlByb21pc2VzLnB1c2goXG4gICAgICAgIG5ldyBQcm9taXNlPG5ldmVyPigocmVzb2x2ZSwgcmVqZWN0KSA9PiB7XG4gICAgICAgICAgYWJvcnRTaWduYWwub25hYm9ydCA9ICgpID0+IHtcbiAgICAgICAgICAgIGNvbnN0IGFib3J0RXJyb3IgPSBuZXcgRXJyb3IoXCJSZXF1ZXN0IGFib3J0ZWRcIik7XG4gICAgICAgICAgICBhYm9ydEVycm9yLm5hbWUgPSBcIkFib3J0RXJyb3JcIjtcbiAgICAgICAgICAgIHJlamVjdChhYm9ydEVycm9yKTtcbiAgICAgICAgICB9O1xuICAgICAgICB9KVxuICAgICAgKTtcbiAgICB9XG4gICAgcmV0dXJuIFByb21pc2UucmFjZShyYWNlT2ZQcm9taXNlcyk7XG4gIH1cbn1cbiJdfQ==","import { __values } from \"tslib\";\nimport { escapeUri } from \"@aws-sdk/util-uri-escape\";\nexport function buildQueryString(query) {\n var e_1, _a;\n var parts = [];\n try {\n for (var _b = __values(Object.keys(query).sort()), _c = _b.next(); !_c.done; _c = _b.next()) {\n var key = _c.value;\n var value = query[key];\n key = escapeUri(key);\n if (Array.isArray(value)) {\n for (var i = 0, iLen = value.length; i < iLen; i++) {\n parts.push(key + \"=\" + escapeUri(value[i]));\n }\n }\n else {\n var qsEntry = key;\n if (value || typeof value === \"string\") {\n qsEntry += \"=\" + escapeUri(value);\n }\n parts.push(qsEntry);\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n return parts.join(\"&\");\n}\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW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AgfVxuXG4gIHJldHVybiBwYXJ0cy5qb2luKFwiJlwiKTtcbn1cbiJdfQ==","export function requestTimeout(timeoutInMs) {\n if (timeoutInMs === void 0) { timeoutInMs = 0; }\n return new Promise(function (resolve, reject) {\n if (timeoutInMs) {\n setTimeout(function () {\n var timeoutError = new Error(\"Request did not complete within \" + timeoutInMs + \" ms\");\n timeoutError.name = \"TimeoutError\";\n reject(timeoutError);\n }, timeoutInMs);\n }\n });\n}\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVxdWVzdC10aW1lb3V0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3JlcXVlc3QtdGltZW91dC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxNQUFNLFVBQVUsY0FBYyxDQUFDLFdBQWU7SUFBZiw0QkFBQSxFQUFBLGVBQWU7SUFDNUMsT0FBTyxJQUFJLE9BQU8sQ0FBQyxVQUFDLE9BQU8sRUFBRSxNQUFNO1FBQ2pDLElBQUksV0FBVyxFQUFFO1lBQ2YsVUFBVSxDQUFDO2dCQUNULElBQU0sWUFBWSxHQUFHLElBQUksS0FBSyxDQUFDLHFDQUFtQyxXQUFXLFFBQUssQ0FBQyxDQUFDO2dCQUNwRixZQUFZLENBQUMsSUFBSSxHQUFHLGNBQWMsQ0FBQztnQkFDbkMsTUFBTSxDQUFDLFlBQVksQ0FBQyxDQUFDO1lBQ3ZCLENBQUMsRUFBRSxXQUFXLENBQUMsQ0FBQztTQUNqQjtJQUNILENBQUMsQ0FBQyxDQUFDO0FBQ0wsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBmdW5jdGlvbiByZXF1ZXN0VGltZW91dCh0aW1lb3V0SW5NcyA9IDApOiBQcm9taXNlPG5ldmVyPiB7XG4gIHJldHVybiBuZXcgUHJvbWlzZSgocmVzb2x2ZSwgcmVqZWN0KSA9PiB7XG4gICAgaWYgKHRpbWVvdXRJbk1zKSB7XG4gICAgICBzZXRUaW1lb3V0KCgpID0+IHtcbiAgICAgICAgY29uc3QgdGltZW91dEVycm9yID0gbmV3IEVycm9yKGBSZXF1ZXN0IGRpZCBub3QgY29tcGxldGUgd2l0aGluICR7dGltZW91dEluTXN9IG1zYCk7XG4gICAgICAgIHRpbWVvdXRFcnJvci5uYW1lID0gXCJUaW1lb3V0RXJyb3JcIjtcbiAgICAgICAgcmVqZWN0KHRpbWVvdXRFcnJvcik7XG4gICAgICB9LCB0aW1lb3V0SW5Ncyk7XG4gICAgfVxuICB9KTtcbn1cbiJdfQ==","import { __awaiter, __generator } from \"tslib\";\nimport { fromBase64 } from \"@aws-sdk/util-base64-browser\";\n//reference: https://snack.expo.io/r1JCSWRGU\nexport var streamCollector = function (stream) {\n if (typeof Blob === \"function\" && stream instanceof Blob) {\n return collectBlob(stream);\n }\n return collectStream(stream);\n};\nfunction collectBlob(blob) {\n return __awaiter(this, void 0, void 0, function () {\n var base64, arrayBuffer;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, readToBase64(blob)];\n case 1:\n base64 = _a.sent();\n arrayBuffer = fromBase64(base64);\n return [2 /*return*/, new Uint8Array(arrayBuffer)];\n }\n });\n });\n}\nfunction collectStream(stream) {\n return __awaiter(this, void 0, void 0, function () {\n var res, reader, isDone, _a, done, value, prior;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n res = new Uint8Array(0);\n reader = stream.getReader();\n isDone = false;\n _b.label = 1;\n case 1:\n if (!!isDone) return [3 /*break*/, 3];\n return [4 /*yield*/, reader.read()];\n case 2:\n _a = _b.sent(), done = _a.done, value = _a.value;\n if (value) {\n prior = res;\n res = new Uint8Array(prior.length + value.length);\n res.set(prior);\n res.set(value, prior.length);\n }\n isDone = done;\n return [3 /*break*/, 1];\n case 3: return [2 /*return*/, res];\n }\n });\n });\n}\nfunction readToBase64(blob) {\n return new Promise(function (resolve, reject) {\n var reader = new FileReader();\n reader.onloadend = function () {\n var _a;\n // reference: https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsDataURL\n // response from readAsDataURL is always prepended with \"data:*/*;base64,\"\n if (reader.readyState !== 2) {\n return reject(new Error(\"Reader aborted too early\"));\n }\n var result = ((_a = reader.result) !== null && _a !== void 0 ? _a : \"\");\n // Response can include only 'data:' for empty blob, return empty string in this case.\n // Otherwise, return the string after ','\n var commaIndex = result.indexOf(\",\");\n var dataOffset = commaIndex > -1 ? commaIndex + 1 : result.length;\n resolve(result.substring(dataOffset));\n };\n reader.onabort = function () { return reject(new Error(\"Read aborted\")); };\n reader.onerror = function () { return reject(reader.error); };\n // reader.readAsArrayBuffer is not always available\n reader.readAsDataURL(blob);\n });\n}\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RyZWFtLWNvbGxlY3Rvci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zdHJlYW0tY29sbGVjdG9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFDQSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sOEJBQThCLENBQUM7QUFFMUQsNENBQTRDO0FBQzVDLE1BQU0sQ0FBQyxJQUFNLGVBQWUsR0FBb0IsVUFBQyxNQUE2QjtJQUM1RSxJQUFJLE9BQU8sSUFBSSxLQUFLLFVBQVUsSUFBSSxNQUFNLFlBQVksSUFBSSxFQUFFO1FBQ3hELE9BQU8sV0FBVyxDQUFDLE1BQU0sQ0FBQyxDQUFDO0tBQzVCO0lBRUQsT0FBTyxhQUFhLENBQUMsTUFBd0IsQ0FBQyxDQUFDO0FBQ2pELENBQUMsQ0FBQztBQUVGLFNBQWUsV0FBVyxDQUFDLElBQVU7Ozs7O3dCQUNwQixxQkFBTSxZQUFZLENBQUMsSUFBSSxDQUFDLEVBQUE7O29CQUFqQyxNQUFNLEdBQUcsU0FBd0I7b0JBQ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jYXNlLlxuICAgICAgLy8gT3RoZXJ3aXNlLCByZXR1cm4gdGhlIHN0cmluZyBhZnRlciAnLCdcbiAgICAgIGNvbnN0IGNvbW1hSW5kZXggPSByZXN1bHQuaW5kZXhPZihcIixcIik7XG4gICAgICBjb25zdCBkYXRhT2Zmc2V0ID0gY29tbWFJbmRleCA+IC0xID8gY29tbWFJbmRleCArIDEgOiByZXN1bHQubGVuZ3RoO1xuICAgICAgcmVzb2x2ZShyZXN1bHQuc3Vic3RyaW5nKGRhdGFPZmZzZXQpKTtcbiAgICB9O1xuICAgIHJlYWRlci5vbmFib3J0ID0gKCkgPT4gcmVqZWN0KG5ldyBFcnJvcihcIlJlYWQgYWJvcnRlZFwiKSk7XG4gICAgcmVhZGVyLm9uZXJyb3IgPSAoKSA9PiByZWplY3QocmVhZGVyLmVycm9yKTtcbiAgICAvLyByZWFkZXIucmVhZEFzQXJyYXlCdWZmZXIgaXMgbm90IGFsd2F5cyBhdmFpbGFibGVcbiAgICByZWFkZXIucmVhZEFzRGF0YVVSTChibG9iKTtcbiAgfSk7XG59XG4iXX0=","export var invalidProvider = function (message) { return function () { return Promise.reject(message); }; };\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW52YWxpZFByb3ZpZGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2ludmFsaWRQcm92aWRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxNQUFNLENBQUMsSUFBTSxlQUFlLEdBQXVDLFVBQUMsT0FBZSxJQUFLLE9BQUEsY0FBTSxPQUFBLE9BQU8sQ0FBQyxNQUFNLENBQUMsT0FBTyxDQUFDLEVBQXZCLENBQXVCLEVBQTdCLENBQTZCLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBQcm92aWRlciB9IGZyb20gXCJAYXdzLXNkay90eXBlc1wiO1xuZXhwb3J0IGNvbnN0IGludmFsaWRQcm92aWRlcjogKG1lc3NhZ2U6IHN0cmluZykgPT4gUHJvdmlkZXI8YW55PiA9IChtZXNzYWdlOiBzdHJpbmcpID0+ICgpID0+IFByb21pc2UucmVqZWN0KG1lc3NhZ2UpO1xuIl19","import { __awaiter, __generator, __read, __spread } from \"tslib\";\nexport var retryMiddleware = function (options) { return function (next, context) { return function (args) { return __awaiter(void 0, void 0, void 0, function () {\n var _a;\n return __generator(this, function (_b) {\n if ((_a = options === null || options === void 0 ? void 0 : options.retryStrategy) === null || _a === void 0 ? void 0 : _a.mode)\n context.userAgent = __spread((context.userAgent || []), [[\"cfg/retry-mode\", options.retryStrategy.mode]]);\n return [2 /*return*/, options.retryStrategy.retry(next, args)];\n });\n}); }; }; };\nexport var retryMiddlewareOptions = {\n name: \"retryMiddleware\",\n tags: [\"RETRY\"],\n step: \"finalizeRequest\",\n priority: \"high\",\n override: true,\n};\nexport var getRetryPlugin = function (options) { return ({\n applyToStack: function (clientStack) {\n clientStack.add(retryMiddleware(options), retryMiddlewareOptions);\n },\n}); };\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmV0cnlNaWRkbGV3YXJlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3JldHJ5TWlkZGxld2FyZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBYUEsTUFBTSxDQUFDLElBQU0sZUFBZSxHQUFHLFVBQUMsT0FBNEIsSUFBSyxPQUFBLFVBQy9ELElBQWtDLEVBQ2xDLE9BQWdDLElBQ0MsT0FBQSxVQUNqQyxJQUFtQzs7O1FBRW5DLFVBQUksT0FBTyxhQUFQLE9BQU8sdUJBQVAsT0FBTyxDQUFFLGFBQWEsMENBQUUsSUFBSTtZQUM5QixPQUFPLENBQUMsU0FBUyxZQUFPLENBQUMsT0FBTyxDQUFDLFNBQVMsSUFBSSxFQUFFLENBQUMsR0FBRSxDQUFD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4gPSAob3B0aW9uczogUmV0cnlSZXNvbHZlZENvbmZpZyk6IFBsdWdnYWJsZTxhbnksIGFueT4gPT4gKHtcbiAgYXBwbHlUb1N0YWNrOiAoY2xpZW50U3RhY2spID0+IHtcbiAgICBjbGllbnRTdGFjay5hZGQocmV0cnlNaWRkbGV3YXJlKG9wdGlvbnMpLCByZXRyeU1pZGRsZXdhcmVPcHRpb25zKTtcbiAgfSxcbn0pO1xuIl19","/**\n * Errors encountered when the client clock and server clock cannot agree on the\n * current time.\n *\n * These errors are retryable, assuming the SDK has enabled clock skew\n * correction.\n */\nexport var CLOCK_SKEW_ERROR_CODES = [\n \"AuthFailure\",\n \"InvalidSignatureException\",\n \"RequestExpired\",\n \"RequestInTheFuture\",\n \"RequestTimeTooSkewed\",\n \"SignatureDoesNotMatch\",\n];\n/**\n * Errors that indicate the SDK is being throttled.\n *\n * These errors are always retryable.\n */\nexport var THROTTLING_ERROR_CODES = [\n \"BandwidthLimitExceeded\",\n \"EC2ThrottledException\",\n \"LimitExceededException\",\n \"PriorRequestNotComplete\",\n \"ProvisionedThroughputExceededException\",\n \"RequestLimitExceeded\",\n \"RequestThrottled\",\n \"RequestThrottledException\",\n \"SlowDown\",\n \"ThrottledException\",\n \"Throttling\",\n \"ThrottlingException\",\n \"TooManyRequestsException\",\n \"TransactionInProgressException\",\n];\n/**\n * Error codes that indicate transient issues\n */\nexport var TRANSIENT_ERROR_CODES = [\"AbortError\", \"TimeoutError\", \"RequestTimeout\", \"RequestTimeoutException\"];\n/**\n * Error codes that indicate transient issues\n */\nexport var TRANSIENT_ERROR_STATUS_CODES = [500, 502, 503, 504];\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbnN0YW50cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7Q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lcyB0aGF0IGluZGljYXRlIHRyYW5zaWVudCBpc3N1ZXNcbiAqL1xuZXhwb3J0IGNvbnN0IFRSQU5TSUVOVF9FUlJPUl9DT0RFUyA9IFtcIkFib3J0RXJyb3JcIiwgXCJUaW1lb3V0RXJyb3JcIiwgXCJSZXF1ZXN0VGltZW91dFwiLCBcIlJlcXVlc3RUaW1lb3V0RXhjZXB0aW9uXCJdO1xuXG4vKipcbiAqIEVycm9yIGNvZGVzIHRoYXQgaW5kaWNhdGUgdHJhbnNpZW50IGlzc3Vlc1xuICovXG5leHBvcnQgY29uc3QgVFJBTlNJRU5UX0VSUk9SX1NUQVRVU19DT0RFUyA9IFs1MDAsIDUwMiwgNTAzLCA1MDRdO1xuIl19","import { CLOCK_SKEW_ERROR_CODES, THROTTLING_ERROR_CODES, TRANSIENT_ERROR_CODES, TRANSIENT_ERROR_STATUS_CODES, } from \"./constants\";\nexport var isRetryableByTrait = function (error) { return error.$retryable !== undefined; };\nexport var isClockSkewError = function (error) { return CLOCK_SKEW_ERROR_CODES.includes(error.name); };\nexport var isThrottlingError = function (error) {\n var _a, _b;\n return ((_a = error.$metadata) === null || _a === void 0 ? void 0 : _a.httpStatusCode) === 429 ||\n THROTTLING_ERROR_CODES.includes(error.name) ||\n ((_b = error.$retryable) === null || _b === void 0 ? void 0 : _b.throttling) == true;\n};\nexport var isTransientError = function (error) {\n var _a;\n return TRANSIENT_ERROR_CODES.includes(error.name) ||\n TRANSIENT_ERROR_STATUS_CODES.includes(((_a = error.$metadata) === null || _a === void 0 ? void 0 : _a.httpStatusCode) || 0);\n};\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxFQUNMLHNCQUFzQixFQUN0QixzQkFBc0IsRUFDdEIscUJBQX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JST1JfQ09ERVMsXG4gIFRSQU5TSUVOVF9FUlJPUl9TVEFUVVNfQ09ERVMsXG59IGZyb20gXCIuL2NvbnN0YW50c1wiO1xuXG5leHBvcnQgY29uc3QgaXNSZXRyeWFibGVCeVRyYWl0ID0gKGVycm9yOiBTZGtFcnJvcikgPT4gZXJyb3IuJHJldHJ5YWJsZSAhPT0gdW5kZWZpbmVkO1xuXG5leHBvcnQgY29uc3QgaXNDbG9ja1NrZXdFcnJvciA9IChlcnJvcjogU2RrRXJyb3IpID0+IENMT0NLX1NLRVdfRVJST1JfQ09ERVMuaW5jbHVkZXMoZXJyb3IubmFtZSk7XG5cbmV4cG9ydCBjb25zdCBpc1Rocm90dGxpbmdFcnJvciA9IChlcnJvcjogU2RrRXJyb3IpID0+XG4gIGVycm9yLiRtZXRhZGF0YT8uaHR0cFN0YXR1c0NvZGUgPT09IDQyOSB8fFxuICBUSFJPVFRMSU5HX0VSUk9SX0NPREVTLmluY2x1ZGVzKGVycm9yLm5hbWUpIHx8XG4gIGVycm9yLiRyZXRyeWFibGU/LnRocm90dGxpbmcgPT0gdHJ1ZTtcblxuZXhwb3J0IGNvbnN0IGlzVHJhbnNpZW50RXJyb3IgPSAoZXJyb3I6IFNka0Vycm9yKSA9PlxuICBUUkFOU0lFTlRfRVJST1JfQ09ERVMuaW5jbHVkZXMoZXJyb3IubmFtZSkgfHxcbiAgVFJBTlNJRU5UX0VSUk9SX1NUQVRVU19DT0RFUy5pbmNsdWRlcyhlcnJvci4kbWV0YWRhdGE/Lmh0dHBTdGF0dXNDb2RlIHx8IDApO1xuIl19","import { MAXIMUM_RETRY_DELAY } from \"./constants\";\n/**\n * Calculate a capped, fully-jittered exponential backoff time.\n */\nexport var defaultDelayDecider = function (delayBase, attempts) {\n return Math.floor(Math.min(MAXIMUM_RETRY_DELAY, Math.random() * Math.pow(2, attempts) * delayBase));\n};\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVsYXlEZWNpZGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2RlbGF5RGVjaWRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsbUJBQW1CLEVBQUUsTUFBTSxhQUFhLENBQUM7QUFFbEQ7O0dBRUc7QUFDSCxNQUFNLENBQUMsSUFBTSxtQkFBbUIsR0FBRyxVQUFDLFNBQWlCLEVBQUUsUUFBZ0I7SUFDckUsT0FBQSxJQUFJLENBQUMsS0FBSyxDQUFDLElBQUksQ0FBQyxHQUFHLENBQUMsbUJBQW1CLEVBQUUsSUFBSSxDQUFDLE1BQU0sRUFBRSxHQUFHLFNBQUEsQ0FBQyxFQUFJLFFBQVEsQ0FBQSxHQUFHLFNBQVMsQ0FBQyxDQUFDO0FBQXBGLENBQW9GLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBNQVhJTVVNX1JFVFJZX0RFTEFZIH0gZnJvbSBcIi4vY29uc3RhbnRzXCI7XG5cbi8qKlxuICogQ2FsY3VsYXRlIGEgY2FwcGVkLCBmdWxseS1qaXR0ZXJlZCBleHBvbmVudGlhbCBiYWNrb2ZmIHRpbWUuXG4gKi9cbmV4cG9ydCBjb25zdCBkZWZhdWx0RGVsYXlEZWNpZGVyID0gKGRlbGF5QmFzZTogbnVtYmVyLCBhdHRlbXB0czogbnVtYmVyKSA9PlxuICBNYXRoLmZsb29yKE1hdGgubWluKE1BWElNVU1fUkVUUllfREVMQVksIE1hdGgucmFuZG9tKCkgKiAyICoqIGF0dGVtcHRzICogZGVsYXlCYXNlKSk7XG4iXX0=","/**\n * The base number of milliseconds to use in calculating a suitable cool-down\n * time when a retryable error is encountered.\n */\nexport var DEFAULT_RETRY_DELAY_BASE = 100;\n/**\n * The maximum amount of time (in milliseconds) that will be used as a delay\n * between retry attempts.\n */\nexport var MAXIMUM_RETRY_DELAY = 20 * 1000;\n/**\n * The retry delay base (in milliseconds) to use when a throttling error is\n * encountered.\n */\nexport var THROTTLING_RETRY_DELAY_BASE = 500;\n/**\n * Initial number of retry tokens in Retry Quota\n */\nexport var INITIAL_RETRY_TOKENS = 500;\n/**\n * The total amount of retry tokens to be decremented from retry token balance.\n */\nexport var RETRY_COST = 5;\n/**\n * The total amount of retry tokens to be decremented from retry token balance\n * when a throttling error is encountered.\n */\nexport var TIMEOUT_RETRY_COST = 10;\n/**\n * The total amount of retry token to be incremented from retry token balance\n * if an SDK operation invocation succeeds without requiring a retry request.\n */\nexport var NO_RETRY_INCREMENT = 1;\n/**\n * Header name for SDK invocation ID\n */\nexport var INVOCATION_ID_HEADER = \"amz-sdk-invocation-id\";\n/**\n * Header name for request retry information.\n */\nexport var REQUEST_HEADER = \"amz-sdk-request\";\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbnN0YW50cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7O0dBR0c7QUFDSCxNQUFNLENBQUMsSUFBTSx3QkFBd0IsR0FBRyxHQUFHLENBQUM7QUFFNUM7OztHQUdHO0FBQ0gsTUFBTSxDQUFDLElBQU0sbUJBQW1CLEdBQUcsRUFBRSxHQUFHLElBQUksQ0FBQztBQUU3Qzs7O0dBR0c7QUFDSCxNQUFNLENBQUMsSUFBTSwyQkFBMkIsR0FBRyxHQUFHLENBQUM7QUFFL0M7O0dBRUc7QUFDSCxNQUFNLENBQUMsSUFBTSxvQkFBb0IsR0FBRyxHQUFHLENBQUM7QUFFeEM7O0dBRUc7QUFDSCxNQUFNLENBQUMsSUFBTSxVQUFVLEdBQUcsQ0FBQyxDQUFDO0FBRTVCOzs7R0FHRztBQUNILE1BQU0sQ0FBQyxJQUFNLGtCQUFrQixHQUFHLEVBQUUsQ0FBQztBQUVyQzs7O0dBR0c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CBvZiByZXRyeSB0b2tlbnMgdG8gYmUgZGVjcmVtZW50ZWQgZnJvbSByZXRyeSB0b2tlbiBiYWxhbmNlLlxuICovXG5leHBvcnQgY29uc3QgUkVUUllfQ09TVCA9IDU7XG5cbi8qKlxuICogVGhlIHRvdGFsIGFtb3VudCBvZiByZXRyeSB0b2tlbnMgdG8gYmUgZGVjcmVtZW50ZWQgZnJvbSByZXRyeSB0b2tlbiBiYWxhbmNlXG4gKiB3aGVuIGEgdGhyb3R0bGluZyBlcnJvciBpcyBlbmNvdW50ZXJlZC5cbiAqL1xuZXhwb3J0IGNvbnN0IFRJTUVPVVRfUkVUUllfQ09TVCA9IDEwO1xuXG4vKipcbiAqIFRoZSB0b3RhbCBhbW91bnQgb2YgcmV0cnkgdG9rZW4gdG8gYmUgaW5jcmVtZW50ZWQgZnJvbSByZXRyeSB0b2tlbiBiYWxhbmNlXG4gKiBpZiBhbiBTREsgb3BlcmF0aW9uIGludm9jYXRpb24gc3VjY2VlZHMgd2l0aG91dCByZXF1aXJpbmcgYSByZXRyeSByZXF1ZXN0LlxuICovXG5leHBvcnQgY29uc3QgTk9fUkVUUllfSU5DUkVNRU5UID0gMTtcblxuLyoqXG4gKiBIZWFkZXIgbmFtZSBmb3IgU0RLIGludm9jYXRpb24gSURcbiAqL1xuZXhwb3J0IGNvbnN0IElOVk9DQVRJT05fSURfSEVBREVSID0gXCJhbXotc2RrLWludm9jYXRpb24taWRcIjtcblxuLyoqXG4gKiBIZWFkZXIgbmFtZSBmb3IgcmVxdWVzdCByZXRyeSBpbmZvcm1hdGlvbi5cbiAqL1xuZXhwb3J0IGNvbnN0IFJFUVVFU1RfSEVBREVSID0gXCJhbXotc2RrLXJlcXVlc3RcIjtcbiJdfQ==","import { isClockSkewError, isRetryableByTrait, isThrottlingError, isTransientError, } from \"@aws-sdk/service-error-classification\";\nexport var defaultRetryDecider = function (error) {\n if (!error) {\n return false;\n }\n return isRetryableByTrait(error) || isClockSkewError(error) || isThrottlingError(error)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5YWJsZUJ5VHJhaXQoZXJyb3IpIHx8IGlzQ2xvY2tTa2V3RXJyb3IoZXJyb3IpIHx8IGlzVGhyb3R0bGluZ0Vycm9yKGVycm9yKSB8fCBpc1RyYW5zaWVudEVycm9yKGVycm9yKTtcbn07XG4iXX0=","import { __awaiter, __generator } from \"tslib\";\nimport { HttpRequest } from \"@aws-sdk/protocol-http\";\nimport { isThrottlingError } from \"@aws-sdk/service-error-classification\";\nimport { v4 } from \"uuid\";\nimport { DEFAULT_RETRY_DELAY_BASE, INITIAL_RETRY_TOKENS, INVOCATION_ID_HEADER, REQUEST_HEADER, THROTTLING_RETRY_DELAY_BASE, } from \"./constants\";\nimport { getDefaultRetryQuota } from \"./defaultRetryQuota\";\nimport { defaultDelayDecider } from \"./delayDecider\";\nimport { defaultRetryDecider } from \"./retryDecider\";\n/**\n * The default value for how many HTTP requests an SDK should make for a\n * single SDK operation invocation before giving up\n */\nexport var DEFAULT_MAX_ATTEMPTS = 3;\n/**\n * The default retry algorithm to use.\n */\nexport var DEFAULT_RETRY_MODE = \"standard\";\nvar StandardRetryStrategy = /** @class */ (function () {\n function StandardRetryStrategy(maxAttemptsProvider, options) {\n var _a, _b, _c;\n this.maxAttemptsProvider = maxAttemptsProvider;\n this.mode = DEFAULT_RETRY_MODE;\n this.retryDecider = (_a = options === null || options === void 0 ? void 0 : options.retryDecider) !== null && _a !== void 0 ? _a : defaultRetryDecider;\n this.delayDecider = (_b = options === null || options === void 0 ? void 0 : options.delayDecider) !== null && _b !== void 0 ? _b : defaultDelayDecider;\n this.retryQuota = (_c = options === null || options === void 0 ? void 0 : options.retryQuota) !== null && _c !== void 0 ? _c : getDefaultRetryQuota(INITIAL_RETRY_TOKENS);\n }\n StandardRetryStrategy.prototype.shouldRetry = function (error, attempts, maxAttempts) {\n return attempts < maxAttempts && this.retryDecider(error) && this.retryQuota.hasRetryTokens(error);\n };\n StandardRetryStrategy.prototype.getMaxAttempts = function () {\n return __awaiter(this, void 0, void 0, function () {\n var maxAttempts, error_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 2, , 3]);\n return [4 /*yield*/, this.maxAttemptsProvider()];\n case 1:\n maxAttempts = _a.sent();\n return [3 /*break*/, 3];\n case 2:\n error_1 = _a.sent();\n maxAttempts = DEFAULT_MAX_ATTEMPTS;\n return [3 /*break*/, 3];\n case 3: return [2 /*return*/, maxAttempts];\n }\n });\n });\n };\n StandardRetryStrategy.prototype.retry = function (next, args) {\n return __awaiter(this, void 0, void 0, function () {\n var retryTokenAmount, attempts, totalDelay, maxAttempts, request, _loop_1, this_1, state_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n attempts = 0;\n totalDelay = 0;\n return [4 /*yield*/, this.getMaxAttempts()];\n case 1:\n maxAttempts = _a.sent();\n request = args.request;\n if (HttpRequest.isInstance(request)) {\n request.headers[INVOCATION_ID_HEADER] = v4();\n }\n _loop_1 = function () {\n var _a, response, output, err_1, delay_1;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n _b.trys.push([0, 2, , 5]);\n if (HttpRequest.isInstance(request)) {\n request.headers[REQUEST_HEADER] = \"attempt=\" + (attempts + 1) + \"; max=\" + maxAttempts;\n }\n return [4 /*yield*/, next(args)];\n case 1:\n _a = _b.sent(), response = _a.response, output = _a.output;\n this_1.retryQuota.releaseRetryTokens(retryTokenAmount);\n output.$metadata.attempts = attempts + 1;\n output.$metadata.totalRetryDelay = totalDelay;\n return [2 /*return*/, { value: { response: response, output: output } }];\n case 2:\n err_1 = _b.sent();\n attempts++;\n if (!this_1.shouldRetry(err_1, attempts, maxAttempts)) return [3 /*break*/, 4];\n retryTokenAmount = this_1.retryQuota.retrieveRetryTokens(err_1);\n delay_1 = this_1.delayDecider(isThrottlingError(err_1) ? THROTTLING_RETRY_DELAY_BASE : DEFAULT_RETRY_DELAY_BASE, attempts);\n totalDelay += delay_1;\n return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, delay_1); })];\n case 3:\n _b.sent();\n return [2 /*return*/, \"continue\"];\n case 4:\n if (!err_1.$metadata) {\n err_1.$metadata = {};\n }\n err_1.$metadata.attempts = attempts;\n err_1.$metadata.totalRetryDelay = totalDelay;\n throw err_1;\n case 5: return [2 /*return*/];\n }\n });\n };\n this_1 = this;\n _a.label = 2;\n case 2:\n if (!true) return [3 /*break*/, 4];\n return [5 /*yield**/, _loop_1()];\n case 3:\n state_1 = _a.sent();\n if (typeof state_1 === \"object\")\n return [2 /*return*/, state_1.value];\n return [3 /*break*/, 2];\n case 4: return [2 /*return*/];\n }\n });\n });\n };\n return StandardRetryStrategy;\n}());\nexport { StandardRetryStrategy };\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVmYXVsdFN0cmF0ZWd5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2RlZmF1bHRTdHJhdGVneS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQ3JELE9BQU8sRUFBRSxpQkFBaUIsRUFBRSxNQUFNLHVDQUF1QyxDQUFDO0FBRzFFLE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSxNQUFNLENBQUM7QUFFMUIsT0FBTyxFQUNMLHdCQUF3QixFQUN4QixvQkFBb0IsRUFDcEIsb0JBQW9CLEVBQ3BCLGNBQWMsRUFDZCwyQkFBMkIsR0FDNUIsTUFBTSxhQUFhLENBQUM7QUFDckIsT0FBTyxFQUFFLG9CQUFvQixFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFDM0QsT0FBTyxFQUFFLG1CQUFtQixFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFDckQsT0FBTyxFQUFFLG1CQUFtQixFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFFckQ7OztHQUdHO0FBQ0gsTUFBTSxDQ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B0b3RhbERlbGF5O1xuXG4gICAgICAgIHJldHVybiB7IHJlc3BvbnNlLCBvdXRwdXQgfTtcbiAgICAgIH0gY2F0Y2ggKGVycikge1xuICAgICAgICBhdHRlbXB0cysrO1xuICAgICAgICBpZiAodGhpcy5zaG91bGRSZXRyeShlcnIgYXMgU2RrRXJyb3IsIGF0dGVtcHRzLCBtYXhBdHRlbXB0cykpIHtcbiAgICAgICAgICByZXRyeVRva2VuQW1vdW50ID0gdGhpcy5yZXRyeVF1b3RhLnJldHJpZXZlUmV0cnlUb2tlbnMoZXJyKTtcbiAgICAgICAgICBjb25zdCBkZWxheSA9IHRoaXMuZGVsYXlEZWNpZGVyKFxuICAgICAgICAgICAgaXNUaHJvdHRsaW5nRXJyb3IoZXJyKSA/IFRIUk9UVExJTkdfUkVUUllfREVMQVlfQkFTRSA6IERFRkFVTFRfUkVUUllfREVMQVlfQkFTRSxcbiAgICAgICAgICAgIGF0dGVtcHRzXG4gICAgICAgICAgKTtcbiAgICAgICAgICB0b3RhbERlbGF5ICs9IGRlbGF5O1xuXG4gICAgICAgICAgYXdhaXQgbmV3IFByb21pc2UoKHJlc29sdmUpID0+IHNldFRpbWVvdXQocmVzb2x2ZSwgZGVsYXkpKTtcbiAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmICghZXJyLiRtZXRhZGF0YSkge1xuICAgICAgICAgIGVyci4kbWV0YWRhdGEgPSB7fTtcbiAgICAgICAgfVxuXG4gICAgICAgIGVyci4kbWV0YWRhdGEuYXR0ZW1wdHMgPSBhdHRlbXB0cztcbiAgICAgICAgZXJyLiRtZXRhZGF0YS50b3RhbFJldHJ5RGVsYXkgPSB0b3RhbERlbGF5O1xuICAgICAgICB0aHJvdyBlcnI7XG4gICAgICB9XG4gICAgfVxuICB9XG59XG4iXX0=","import { NO_RETRY_INCREMENT, RETRY_COST, TIMEOUT_RETRY_COST } from \"./constants\";\nexport var getDefaultRetryQuota = function (initialRetryTokens) {\n var MAX_CAPACITY = initialRetryTokens;\n var availableCapacity = initialRetryTokens;\n var getCapacityAmount = function (error) { return (error.name === \"TimeoutError\" ? TIMEOUT_RETRY_COST : RETRY_COST); };\n var hasRetryTokens = function (error) { return getCapacityAmount(error) <= availableCapacity; };\n var retrieveRetryTokens = function (error) {\n if (!hasRetryTokens(error)) {\n // retryStrategy should stop retrying, and return last error\n throw new Error(\"No retry token available\");\n }\n var capacityAmount = getCapacityAmount(error);\n availableCapacity -= capacityAmount;\n return capacityAmount;\n };\n var releaseRetryTokens = function (capacityReleaseAmount) {\n availableCapacity += capacityReleaseAmount !== null && capacityReleaseAmount !== void 0 ? capacityReleaseAmount : NO_RETRY_INCREMENT;\n availableCapacity = Math.min(availableCapacity, MAX_CAPACITY);\n };\n return Object.freeze({\n hasRetryTokens: hasRetryTokens,\n retrieveRetryTokens: retrieveRetryTokens,\n releaseRetryTokens: releaseRetryTokens,\n });\n};\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVmYXVsdFJldHJ5UXVvdGEuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZGVmYXVsdFJldHJ5UXVvdGEudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxFQUFFLGtCQUFrQixFQUFFLFVBQVUsRUFBRSxrQkFBa0IsRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUdqRixNQUFNLENBQUMsSUFBTSxvQkFBb0IsR0FBRyxVQUFDLGtCQUEwQjtJQUM3RCxJQUFNLFlBQVksR0FBRyxrQkFBa0IsQ0FBQztJQUN4QyxJQUFJLGlCQUFpQixHQUFHLGtCQUFrQixDQUFDO0lBRTNDLElBQU0saUJBQWlCLEdBQUcsVUFBQyxLQUFlLElBQUssT0FBQSxDQUFDLEtBQUssQ0FBQyxJQUFJLEtBQUssY0FBYyxDQUFDLENBQUMsQ0FBQyxrQkFBa0IsQ0FBQyxDQUF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GFjaXR5QW1vdW50O1xuICB9O1xuXG4gIGNvbnN0IHJlbGVhc2VSZXRyeVRva2VucyA9IChjYXBhY2l0eVJlbGVhc2VBbW91bnQ/OiBudW1iZXIpID0+IHtcbiAgICBhdmFpbGFibGVDYXBhY2l0eSArPSBjYXBhY2l0eVJlbGVhc2VBbW91bnQgPz8gTk9fUkVUUllfSU5DUkVNRU5UO1xuICAgIGF2YWlsYWJsZUNhcGFjaXR5ID0gTWF0aC5taW4oYXZhaWxhYmxlQ2FwYWNpdHksIE1BWF9DQVBBQ0lUWSk7XG4gIH07XG5cbiAgcmV0dXJuIE9iamVjdC5mcmVlemUoe1xuICAgIGhhc1JldHJ5VG9rZW5zLFxuICAgIHJldHJpZXZlUmV0cnlUb2tlbnMsXG4gICAgcmVsZWFzZVJldHJ5VG9rZW5zLFxuICB9KTtcbn07XG4iXX0=","import { __assign } from \"tslib\";\nimport { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE, StandardRetryStrategy } from \"./defaultStrategy\";\nexport var ENV_MAX_ATTEMPTS = \"AWS_MAX_ATTEMPTS\";\nexport var CONFIG_MAX_ATTEMPTS = \"max_attempts\";\nexport var NODE_MAX_ATTEMPT_CONFIG_OPTIONS = {\n environmentVariableSelector: function (env) {\n var value = env[ENV_MAX_ATTEMPTS];\n if (!value)\n return undefined;\n var maxAttempt = parseInt(value);\n if (Number.isNaN(maxAttempt)) {\n throw new Error(\"Environment variable \" + ENV_MAX_ATTEMPTS + \" mast be a number, got \\\"\" + value + \"\\\"\");\n }\n return maxAttempt;\n },\n configFileSelector: function (profile) {\n var value = profile[CONFIG_MAX_ATTEMPTS];\n if (!value)\n return undefined;\n var maxAttempt = parseInt(value);\n if (Number.isNaN(maxAttempt)) {\n throw new Error(\"Shared config file entry \" + CONFIG_MAX_ATTEMPTS + \" mast be a number, got \\\"\" + value + \"\\\"\");\n }\n return maxAttempt;\n },\n default: DEFAULT_MAX_ATTEMPTS,\n};\nexport var resolveRetryConfig = function (input) {\n var maxAttempts = normalizeMaxAttempts(input.maxAttempts);\n return __assign(__assign({}, input), { maxAttempts: maxAttempts, retryStrategy: input.retryStrategy || new StandardRetryStrategy(maxAttempts) });\n};\nvar normalizeMaxAttempts = function (maxAttempts) {\n if (maxAttempts === void 0) { maxAttempts = DEFAULT_MAX_ATTEMPTS; }\n if (typeof maxAttempts === \"number\") {\n var promisified_1 = Promise.resolve(maxAttempts);\n return function () { return promisified_1; };\n }\n return maxAttempts;\n};\nexport var ENV_RETRY_MODE = \"AWS_RETRY_MODE\";\nexport var CONFIG_RETRY_MODE = \"retry_mode\";\nexport var NODE_RETRY_MODE_CONFIG_OPTIONS = {\n environmentVariableSelector: function (env) { return env[ENV_RETRY_MODE]; },\n configFileSelector: function (profile) { return profile[CONFIG_RETRY_MODE]; },\n default: DEFAULT_RETRY_MODE,\n};\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlndXJhdGlvbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29uZmlndXJhdGlvbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUdBLE9BQU8sRUFBRSxvQkFBb0IsRUFBRSxrQkFBa0IsRUFBRSxxQkFBcUIsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBRXBHLE1BQU0sQ0FBQyxJQUFNLGdCQUFnQixHQUFHLGtCQUFrQixDQUFDO0FBQ25ELE1BQU0sQ0FBQyxJQUFNLG1CQUFtQixHQUFHLGNBQWMsQ0FBQztBQUVsRCxNQUFNLENBQUMsSUFBTSwrQkFBK0IsR0FBa0M7SUFDNUUsMkJBQTJCLEVBQUUsVUFBQyxHQUFHO1FBQy9CLElBQU0sS0FBSyxHQUFHLEdBQUcsQ0FBQyxnQkFBZ0IsQ0FBQyxDQUFDO1FBQ3BDLElBQUksQ0FBQyxLQUFLO1lBQUUsT0FBTyxTQUFTLENBQUM7UUFDN0I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0ZWd5OiBpbnB1dC5yZXRyeVN0cmF0ZWd5IHx8IG5ldyBTdGFuZGFyZFJldHJ5U3RyYXRlZ3kobWF4QXR0ZW1wdHMpLFxuICB9O1xufTtcblxuY29uc3Qgbm9ybWFsaXplTWF4QXR0ZW1wdHMgPSAobWF4QXR0ZW1wdHM6IG51bWJlciB8IFByb3ZpZGVyPG51bWJlcj4gPSBERUZBVUxUX01BWF9BVFRFTVBUUyk6IFByb3ZpZGVyPG51bWJlcj4gPT4ge1xuICBpZiAodHlwZW9mIG1heEF0dGVtcHRzID09PSBcIm51bWJlclwiKSB7XG4gICAgY29uc3QgcHJvbWlzaWZpZWQgPSBQcm9taXNlLnJlc29sdmUobWF4QXR0ZW1wdHMpO1xuICAgIHJldHVybiAoKSA9PiBwcm9taXNpZmllZDtcbiAgfVxuICByZXR1cm4gbWF4QXR0ZW1wdHM7XG59O1xuXG5leHBvcnQgY29uc3QgRU5WX1JFVFJZX01PREUgPSBcIkFXU19SRVRSWV9NT0RFXCI7XG5leHBvcnQgY29uc3QgQ09ORklHX1JFVFJZX01PREUgPSBcInJldHJ5X21vZGVcIjtcblxuZXhwb3J0IGNvbnN0IE5PREVfUkVUUllfTU9ERV9DT05GSUdfT1BUSU9OUzogTG9hZGVkQ29uZmlnU2VsZWN0b3JzPHN0cmluZz4gPSB7XG4gIGVudmlyb25tZW50VmFyaWFibGVTZWxlY3RvcjogKGVudikgPT4gZW52W0VOVl9SRVRSWV9NT0RFXSxcbiAgY29uZmlnRmlsZVNlbGVjdG9yOiAocHJvZmlsZSkgPT4gcHJvZmlsZVtDT05GSUdfUkVUUllfTU9ERV0sXG4gIGRlZmF1bHQ6IERFRkFVTFRfUkVUUllfTU9ERSxcbn07XG4iXX0=","import { fromUtf8 as jsFromUtf8, toUtf8 as jsToUtf8 } from \"./pureJs\";\nimport { fromUtf8 as textEncoderFromUtf8, toUtf8 as textEncoderToUtf8 } from \"./whatwgEncodingApi\";\nexport var fromUtf8 = function (input) {\n return typeof TextEncoder === \"function\" ? textEncoderFromUtf8(input) : jsFromUtf8(input);\n};\nexport var toUtf8 = function (input) {\n return typeof TextDecoder === \"function\" ? textEncoderToUtf8(input) : jsToUtf8(input);\n};\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFFBQVEsSUFBSSxVQUFVLEVBQUUsTUFBTSxJQUFJLFFBQVEsRUFBRSxNQUFNLFVBQVUsQ0FBQztBQUN0RSxPQUFPLEVBQUUsUUFBUSxJQUFJLG1CQUFtQixFQUFFLE1BQU0sSUFBSSxpQkFBaUIsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBS25HLE1BQU0sQ0FBQyxJQUFNLFFBQVEsR0FBRyxVQUFDLEtBQWE7SUFDcEMsT0FBQSxPQUFPLFdBQVcsS0FBSyxVQUFVLENBQUMsQ0FBQyxDQUFDLG1CQUFtQixDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUMsQ0FBQyxVQUFVLENBQUMsS0FBSyxDQUFDO0FBQWxGLENBQWtGLENBQUM7QUFFckYsTUFBTSxDQUFDLElBQU0sTUFBTSxHQUFHLFVBQUMsS0FBaUI7SUFDdEMsT0FBQSxPQUFPLFdBQVcsS0FBSyxVQUFVLENBQUMsQ0FBQyxDQUFDLGlCQUFpQixDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUMsQ0FBQyxRQUFRLENBQUMsS0FBSyxDQUFDO0FBQTlFLENBQThFLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBmcm9tVXRmOCBhcyBqc0Zyb21VdGY4LCB0b1V0ZjggYXMganNUb1V0ZjggfSBmcm9tIFwiLi9wdXJlSnNcIjtcbmltcG9ydCB7IGZyb21VdGY4IGFzIHRleHRFbmNvZGVyRnJvbVV0ZjgsIHRvVXRmOCBhcyB0ZXh0RW5jb2RlclRvVXRmOCB9IGZyb20gXCIuL3doYXR3Z0VuY29kaW5nQXBpXCI7XG5cbmRlY2xhcmUgY29uc3QgVGV4dERlY29kZXI6IEZ1bmN0aW9uIHwgdW5kZWZpbmVkO1xuZGVjbGFyZSBjb25zdCBUZXh0RW5jb2RlcjogRnVuY3Rpb24gfCB1bmRlZmluZWQ7XG5cbmV4cG9ydCBjb25zdCBmcm9tVXRmOCA9IChpbnB1dDogc3RyaW5nKTogVWludDhBcnJheSA9PlxuICB0eXBlb2YgVGV4dEVuY29kZXIgPT09IFwiZnVuY3Rpb25cIiA/IHRleHRFbmNvZGVyRnJvbVV0ZjgoaW5wdXQpIDoganNGcm9tVXRmOChpbnB1dCk7XG5cbmV4cG9ydCBjb25zdCB0b1V0ZjggPSAoaW5wdXQ6IFVpbnQ4QXJyYXkpOiBzdHJpbmcgPT5cbiAgdHlwZW9mIFRleHREZWNvZGVyID09PSBcImZ1bmN0aW9uXCIgPyB0ZXh0RW5jb2RlclRvVXRmOChpbnB1dCkgOiBqc1RvVXRmOChpbnB1dCk7XG4iXX0=","import { __assign } from \"tslib\";\n// Partition default templates\nvar AWS_TEMPLATE = \"cognito-identity.{region}.amazonaws.com\";\nvar AWS_CN_TEMPLATE = \"cognito-identity.{region}.amazonaws.com.cn\";\nvar AWS_ISO_TEMPLATE = \"cognito-identity.{region}.c2s.ic.gov\";\nvar AWS_ISO_B_TEMPLATE = \"cognito-identity.{region}.sc2s.sgov.gov\";\nvar AWS_US_GOV_TEMPLATE = \"cognito-identity.{region}.amazonaws.com\";\n// Partition regions\nvar AWS_REGIONS = new Set([\n \"af-south-1\",\n \"ap-east-1\",\n \"ap-northeast-1\",\n \"ap-northeast-2\",\n \"ap-south-1\",\n \"ap-southeast-1\",\n \"ap-southeast-2\",\n \"ca-central-1\",\n \"eu-central-1\",\n \"eu-north-1\",\n \"eu-south-1\",\n \"eu-west-1\",\n \"eu-west-2\",\n \"eu-west-3\",\n \"me-south-1\",\n \"sa-east-1\",\n \"us-east-1\",\n \"us-east-2\",\n \"us-west-1\",\n \"us-west-2\",\n]);\nvar AWS_CN_REGIONS = new Set([\"cn-north-1\", \"cn-northwest-1\"]);\nvar AWS_ISO_REGIONS = new Set([\"us-iso-east-1\"]);\nvar AWS_ISO_B_REGIONS = new Set([\"us-isob-east-1\"]);\nvar AWS_US_GOV_REGIONS = new Set([\"us-gov-east-1\", \"us-gov-west-1\"]);\nexport var defaultRegionInfoProvider = function (region, options) {\n var regionInfo = undefined;\n switch (region) {\n // First, try to match exact region names.\n case \"ap-northeast-1\":\n regionInfo = {\n hostname: \"cognito-identity.ap-northeast-1.amazonaws.com\",\n partition: \"aws\",\n };\n break;\n case \"ap-northeast-2\":\n regionInfo = {\n hostname: \"cognito-identity.ap-northeast-2.amazonaws.com\",\n partition: \"aws\",\n };\n break;\n case \"ap-south-1\":\n regionInfo = {\n hostname: \"cognito-identity.ap-south-1.amazonaws.com\",\n partition: \"aws\",\n };\n break;\n case \"ap-southeast-1\":\n regionInfo = {\n hostname: \"cognito-identity.ap-southeast-1.amazonaws.com\",\n partition: \"aws\",\n };\n break;\n case \"ap-southeast-2\":\n regionInfo = {\n hostname: \"cognito-identity.ap-southeast-2.amazonaws.com\",\n partition: \"aws\",\n };\n break;\n case \"ca-central-1\":\n regionInfo = {\n hostname: \"cognito-identity.ca-central-1.amazonaws.com\",\n partition: \"aws\",\n };\n break;\n case \"cn-north-1\":\n regionInfo = {\n hostname: \"cognito-identity.cn-north-1.amazonaws.com.cn\",\n partition: \"aws-cn\",\n };\n break;\n case \"eu-central-1\":\n regionInfo = {\n hostname: \"cognito-identity.eu-central-1.amazonaws.com\",\n partition: \"aws\",\n };\n break;\n case \"eu-north-1\":\n regionInfo = {\n hostname: \"cognito-identity.eu-north-1.amazonaws.com\",\n partition: \"aws\",\n };\n break;\n case \"eu-west-1\":\n regionInfo = {\n hostname: \"cognito-identity.eu-west-1.amazonaws.com\",\n partition: \"aws\",\n };\n break;\n case \"eu-west-2\":\n regionInfo = {\n hostname: \"cognito-identity.eu-west-2.amazonaws.com\",\n partition: \"aws\",\n };\n break;\n case \"eu-west-3\":\n regionInfo = {\n hostname: \"cognito-identity.eu-west-3.amazonaws.com\",\n partition: \"aws\",\n };\n break;\n case \"fips-us-east-1\":\n regionInfo = {\n hostname: \"cognito-identity-fips.us-east-1.amazonaws.com\",\n partition: \"aws\",\n signingRegion: \"us-east-1\",\n };\n break;\n case \"fips-us-east-2\":\n regionInfo = {\n hostname: \"cognito-identity-fips.us-east-2.amazonaws.com\",\n partition: \"aws\",\n signingRegion: \"us-east-2\",\n };\n break;\n case \"fips-us-gov-west-1\":\n regionInfo = {\n hostname: \"cognito-identity-fips.us-gov-west-1.amazonaws.com\",\n partition: \"aws-us-gov\",\n signingRegion: \"us-gov-west-1\",\n };\n break;\n case \"fips-us-west-2\":\n regionInfo = {\n hostname: \"cognito-identity-fips.us-west-2.amazonaws.com\",\n partition: \"aws\",\n signingRegion: \"us-west-2\",\n };\n break;\n case \"sa-east-1\":\n regionInfo = {\n hostname: \"cognito-identity.sa-east-1.amazonaws.com\",\n partition: \"aws\",\n };\n break;\n case \"us-east-1\":\n regionInfo = {\n hostname: \"cognito-identity.us-east-1.amazonaws.com\",\n partition: \"aws\",\n };\n break;\n case \"us-east-2\":\n regionInfo = {\n hostname: \"cognito-identity.us-east-2.amazonaws.com\",\n partition: \"aws\",\n };\n break;\n case \"us-gov-west-1\":\n regionInfo = {\n hostname: \"cognito-identity.us-gov-west-1.amazonaws.com\",\n partition: \"aws-us-gov\",\n };\n break;\n case \"us-west-1\":\n regionInfo = {\n hostname: \"cognito-identity.us-west-1.amazonaws.com\",\n partition: \"aws\",\n };\n break;\n case \"us-west-2\":\n regionInfo = {\n hostname: \"cognito-identity.us-west-2.amazonaws.com\",\n partition: \"aws\",\n };\n break;\n // Next, try to match partition endpoints.\n default:\n if (AWS_REGIONS.has(region)) {\n regionInfo = {\n hostname: AWS_TEMPLATE.replace(\"{region}\", region),\n partition: \"aws\",\n };\n }\n if (AWS_CN_REGIONS.has(region)) {\n regionInfo = {\n hostname: AWS_CN_TEMPLATE.replace(\"{region}\", region),\n partition: \"aws-cn\",\n };\n }\n if (AWS_ISO_REGIONS.has(region)) {\n regionInfo = {\n hostname: AWS_ISO_TEMPLATE.replace(\"{region}\", region),\n partition: \"aws-iso\",\n };\n }\n if (AWS_ISO_B_REGIONS.has(region)) {\n regionInfo = {\n hostname: AWS_ISO_B_TEMPLATE.replace(\"{region}\", region),\n partition: \"aws-iso-b\",\n };\n }\n if (AWS_US_GOV_REGIONS.has(region)) {\n regionInfo = {\n hostname: AWS_US_GOV_TEMPLATE.replace(\"{region}\", region),\n partition: \"aws-us-gov\",\n };\n }\n // Finally, assume it's an AWS partition endpoint.\n if (regionInfo === undefined) {\n regionInfo = {\n hostname: AWS_TEMPLATE.replace(\"{region}\", region),\n partition: \"aws\",\n };\n }\n }\n return Promise.resolve(__assign({ signingService: \"cognito-identity\" }, regionInfo));\n};\n//# sourceMappingURL=endpoints.js.map","import { parseQueryString } from \"@aws-sdk/querystring-parser\";\nexport var parseUrl = function (url) {\n var _a = new URL(url), hostname = _a.hostname, pathname = _a.pathname, port = _a.port, protocol = _a.protocol, search = _a.search;\n var query;\n if (search) {\n query = parseQueryString(search);\n }\n return {\n hostname: hostname,\n port: port ? parseInt(port) : undefined,\n protocol: protocol,\n path: pathname,\n query: query,\n };\n};\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFHL0QsTUFBTSxDQUFDLElBQU0sUUFBUSxHQUFjLFVBQUMsR0FBVzt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VyeVN0cmluZyhzZWFyY2gpO1xuICB9XG5cbiAgcmV0dXJuIHtcbiAgICBob3N0bmFtZSxcbiAgICBwb3J0OiBwb3J0ID8gcGFyc2VJbnQocG9ydCkgOiB1bmRlZmluZWQsXG4gICAgcHJvdG9jb2wsXG4gICAgcGF0aDogcGF0aG5hbWUsXG4gICAgcXVlcnksXG4gIH07XG59O1xuIl19","import { __awaiter, __generator } from \"tslib\";\nimport bowser from \"bowser\";\n/**\n * Default provider to the user agent in browsers. It's a best effort to infer\n * the device information. It uses bowser library to detect the browser and virsion\n */\nexport var defaultUserAgent = function (_a) {\n var serviceId = _a.serviceId, clientVersion = _a.clientVersion;\n return function () { return __awaiter(void 0, void 0, void 0, function () {\n var parsedUA, sections;\n var _a, _b, _c, _d, _e, _f, _g;\n return __generator(this, function (_h) {\n parsedUA = ((_a = window === null || window === void 0 ? void 0 : window.navigator) === null || _a === void 0 ? void 0 : _a.userAgent) ? bowser.parse(window.navigator.userAgent) : undefined;\n sections = [\n // sdk-metadata\n [\"aws-sdk-js\", clientVersion],\n // os-metadata\n [\"os/\" + (((_b = parsedUA === null || parsedUA === void 0 ? void 0 : parsedUA.os) === null || _b === void 0 ? void 0 : _b.name) || \"other\"), (_c = parsedUA === null || parsedUA === void 0 ? void 0 : parsedUA.os) === null || _c === void 0 ? void 0 : _c.version],\n // language-metadata\n // ECMAScript edition doesn't matter in JS.\n [\"lang/js\"],\n // browser vendor and version.\n [\"md/browser\", ((_e = (_d = parsedUA === null || parsedUA === void 0 ? void 0 : parsedUA.browser) === null || _d === void 0 ? void 0 : _d.name) !== null && _e !== void 0 ? _e : \"unknown\") + \"_\" + ((_g = (_f = parsedUA === null || parsedUA === void 0 ? void 0 : parsedUA.browser) === null || _f === void 0 ? void 0 : _f.version) !== null && _g !== void 0 ? _g : \"unknown\")],\n ];\n if (serviceId) {\n // api-metadata\n // service Id may not appear in non-AWS clients\n sections.push([\"api/\" + serviceId, clientVersion]);\n }\n return [2 /*return*/, sections];\n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WdhdG9yLnVzZXJBZ2VudCkgOiB1bmRlZmluZWQ7XG4gIGNvbnN0IHNlY3Rpb25zOiBVc2VyQWdlbnQgPSBbXG4gICAgLy8gc2RrLW1ldGFkYXRhXG4gICAgW1wiYXdzLXNkay1qc1wiLCBjbGllbnRWZXJzaW9uXSxcbiAgICAvLyBvcy1tZXRhZGF0YVxuICAgIFtgb3MvJHtwYXJzZWRVQT8ub3M/Lm5hbWUgfHwgXCJvdGhlclwifWAsIHBhcnNlZFVBPy5vcz8udmVyc2lvbl0sXG4gICAgLy8gbGFuZ3VhZ2UtbWV0YWRhdGFcbiAgICAvLyBFQ01BU2NyaXB0IGVkaXRpb24gZG9lc24ndCBtYXR0ZXIgaW4gSlMuXG4gICAgW1wibGFuZy9qc1wiXSxcbiAgICAvLyBicm93c2VyIHZlbmRvciBhbmQgdmVyc2lvbi5cbiAgICBbXCJtZC9icm93c2VyXCIsIGAke3BhcnNlZFVBPy5icm93c2VyPy5uYW1lID8/IFwidW5rbm93blwifV8ke3BhcnNlZFVBPy5icm93c2VyPy52ZXJzaW9uID8/IFwidW5rbm93blwifWBdLFxuICBdO1xuXG4gIGlmIChzZXJ2aWNlSWQpIHtcbiAgICAvLyBhcGktbWV0YWRhdGFcbiAgICAvLyBzZXJ2aWNlIElkIG1heSBub3QgYXBwZWFyIGluIG5vbi1BV1MgY2xpZW50c1xuICAgIHNlY3Rpb25zLnB1c2goW2BhcGkvJHtzZXJ2aWNlSWR9YCwgY2xpZW50VmVyc2lvbl0pO1xuICB9XG5cbiAgcmV0dXJuIHNlY3Rpb25zO1xufTtcbiJdfQ==","import { defaultRegionInfoProvider } from \"./endpoints\";\nimport { parseUrl } from \"@aws-sdk/url-parser\";\n/**\n * @internal\n */\nexport var ClientSharedValues = {\n apiVersion: \"2014-06-30\",\n disableHostPrefix: false,\n logger: {},\n regionInfoProvider: defaultRegionInfoProvider,\n serviceId: \"Cognito Identity\",\n urlParser: parseUrl,\n};\n//# sourceMappingURL=runtimeConfig.shared.js.map","import { __read, __values } from \"tslib\";\nexport function parseQueryString(querystring) {\n var e_1, _a;\n var query = {};\n querystring = querystring.replace(/^\\?/, \"\");\n if (querystring) {\n try {\n for (var _b = __values(querystring.split(\"&\")), _c = _b.next(); !_c.done; _c = _b.next()) {\n var pair = _c.value;\n var _d = __read(pair.split(\"=\"), 2), key = _d[0], _e = _d[1], value = _e === void 0 ? null : _e;\n key = decodeURIComponent(key);\n if (value) {\n value = decodeURIComponent(value);\n }\n if (!(key in query)) {\n query[key] = value;\n }\n else if (Array.isArray(query[key])) {\n query[key].push(value);\n }\n else {\n query[key] = [query[key], value];\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n }\n return query;\n}\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUVBLE1BQU0sVUFBVSxnQkFBZ0IsQ0FBQyxXQUFtQjs7SUFDbEQsSUFBTSxLQUFLLEdBQXNCLEVBQUUsQ0FBQztJQUNwQyxXQUFXLEdBQUcsV0FBVyxDQUFDLE9BQU8sQ0FBQyxLQUFLLEVBQUUsRUFBRSxDQUFDLENBQUM7SUFFN0MsSUFBSSxXQUFXLEVBQUU7O1lBQ2YsS0FBbUIsSUFBQSxLQUFBLFNBQUEsV0FBVyxDQUFDLEtBQUssQ0FBQyxHQUFHLENBQUMsQ0FBQSxnQkFBQSw0QkFBRTtnQkFBdEMsSUFBTSxJQUFJLFdBQUE7Z0JBQ1QsSUFBQSxLQUFBLE9BQXNCLElBQUksQ0FBQyxLQUFLLENBQUMsR0FBRyxDQUFDLElBQUEsRUFBcEMsR0FBRyxRQUFBLEVBQUUsVUFBW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oY29uc3QgcGFpciBvZiBxdWVyeXN0cmluZy5zcGxpdChcIiZcIikpIHtcbiAgICAgIGxldCBba2V5LCB2YWx1ZSA9IG51bGxdID0gcGFpci5zcGxpdChcIj1cIik7XG4gICAgICBrZXkgPSBkZWNvZGVVUklDb21wb25lbnQoa2V5KTtcbiAgICAgIGlmICh2YWx1ZSkge1xuICAgICAgICB2YWx1ZSA9IGRlY29kZVVSSUNvbXBvbmVudCh2YWx1ZSk7XG4gICAgICB9XG4gICAgICBpZiAoIShrZXkgaW4gcXVlcnkpKSB7XG4gICAgICAgIHF1ZXJ5W2tleV0gPSB2YWx1ZTtcbiAgICAgIH0gZWxzZSBpZiAoQXJyYXkuaXNBcnJheShxdWVyeVtrZXldKSkge1xuICAgICAgICAocXVlcnlba2V5XSBhcyBBcnJheTxzdHJpbmc+KS5wdXNoKHZhbHVlIGFzIHN0cmluZyk7XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBxdWVyeVtrZXldID0gW3F1ZXJ5W2tleV0gYXMgc3RyaW5nLCB2YWx1ZSBhcyBzdHJpbmddO1xuICAgICAgfVxuICAgIH1cbiAgfVxuXG4gIHJldHVybiBxdWVyeTtcbn1cbiJdfQ==","import { __assign } from \"tslib\";\nimport packageInfo from \"./package.json\";\nimport { Sha256 } from \"@aws-crypto/sha256-browser\";\nimport { FetchHttpHandler, streamCollector } from \"@aws-sdk/fetch-http-handler\";\nimport { invalidProvider } from \"@aws-sdk/invalid-dependency\";\nimport { DEFAULT_MAX_ATTEMPTS } from \"@aws-sdk/middleware-retry\";\nimport { fromBase64, toBase64 } from \"@aws-sdk/util-base64-browser\";\nimport { calculateBodyLength } from \"@aws-sdk/util-body-length-browser\";\nimport { defaultUserAgent } from \"@aws-sdk/util-user-agent-browser\";\nimport { fromUtf8, toUtf8 } from \"@aws-sdk/util-utf8-browser\";\nimport { ClientSharedValues } from \"./runtimeConfig.shared\";\n/**\n * @internal\n */\nexport var ClientDefaultValues = __assign(__assign({}, ClientSharedValues), { runtime: \"browser\", base64Decoder: fromBase64, base64Encoder: toBase64, bodyLengthChecker: calculateBodyLength, credentialDefaultProvider: function (_) { return function () { return Promise.reject(new Error(\"Credential is missing\")); }; }, defaultUserAgentProvider: defaultUserAgent({\n serviceId: ClientSharedValues.serviceId,\n clientVersion: packageInfo.version,\n }), maxAttempts: DEFAULT_MAX_ATTEMPTS, region: invalidProvider(\"Region is missing\"), requestHandler: new FetchHttpHandler(), sha256: Sha256, streamCollector: streamCollector, utf8Decoder: fromUtf8, utf8Encoder: toUtf8 });\n//# sourceMappingURL=runtimeConfig.browser.js.map","export function calculateBodyLength(body) {\n if (typeof body === \"string\") {\n var len = body.length;\n for (var i = len - 1; i >= 0; i--) {\n var code = body.charCodeAt(i);\n if (code > 0x7f && code <= 0x7ff)\n len++;\n else if (code > 0x7ff && code <= 0xffff)\n len += 2;\n }\n return len;\n }\n else if (typeof body.byteLength === \"number\") {\n // handles Uint8Array, ArrayBuffer, Buffer, and ArrayBufferView\n return body.byteLength;\n }\n else if (typeof body.size === \"number\") {\n // handles browser File object\n return body.size;\n }\n}\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsTUFBTSxVQUFVLG1CQUFtQixDQUFDLElBQVM7SUFDM0MsSUFBSSxPQUFPLElBQUksS0FBSyxRQUFRLEVBQUU7UUFDNUIsSUFBSSxHQUFHLEdBQUcsSUFBSSxDQUFDLE1BQU0sQ0FBQztRQUV0QixLQUFLLElBQUksQ0FBQyxHQUFHLEdBQUcsR0FBRyxDQUFDLEVBQUUsQ0FBQyxJQUFJLENBQUMsRUFBRSxDQUFDLEVBQUUsRUFBRTtZQUNqQyxJQUFNLElBQUksR0FBRyxJQUFJLENBQUMsVUFBVSxDQUFDLENBQUMsQ0FBQyx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gVWludDhBcnJheSwgQXJyYXlCdWZmZXIsIEJ1ZmZlciwgYW5kIEFycmF5QnVmZmVyVmlld1xuICAgIHJldHVybiBib2R5LmJ5dGVMZW5ndGg7XG4gIH0gZWxzZSBpZiAodHlwZW9mIGJvZHkuc2l6ZSA9PT0gXCJudW1iZXJcIikge1xuICAgIC8vIGhhbmRsZXMgYnJvd3NlciBGaWxlIG9iamVjdFxuICAgIHJldHVybiBib2R5LnNpemU7XG4gIH1cbn1cbiJdfQ==","export function fromUtf8(input) {\n return new TextEncoder().encode(input);\n}\nexport function toUtf8(input) {\n return new TextDecoder(\"utf-8\").decode(input);\n}\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2hhdHdnRW5jb2RpbmdBcGkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvd2hhdHdnRW5jb2RpbmdBcGkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBeUNBLE1BQU0sVUFBVSxRQUFRLENBQUMsS0FBYTtJQUNwQyxPQUFPLElBQUksV0FBVyxFQUFFLENBQUMsTUFBTSxDQUFDLEtBQUssQ0FBQyxDQUFDO0FBQ3pDLENBQUM7QUFFRCxNQUFNLFVBQVUsTUFBTSxDQUFDLEtBQWlCO0lBQ3RDLE9BQU8sSUFBSSxXQUFXLENBQUMsT0FBTyxDQUFDLENBQUMsTUFBTSxDQUFDLEtBQUssQ0FBQyxDQUFDO0FBQ2hELENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEEgZGVjbGFyYXRpb24gb2YgdGhlIGdsb2JhbCBUZXh0RW5jb2RlciBhbmQgVGV4dERlY29kZXIgY29uc3RydWN0b3JzLlxuICpcbiAqIEBzZWUgaHR0cHM6Ly9lbmNvZGluZy5zcGVjLndoYXR3Zy5vcmcvXG4gKi9cbi8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBAdHlwZXNjcmlwdC1lc2x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GV4dEVuY29kZXJDb25zdHJ1Y3RvcjtcblxuZXhwb3J0IGZ1bmN0aW9uIGZyb21VdGY4KGlucHV0OiBzdHJpbmcpOiBVaW50OEFycmF5IHtcbiAgcmV0dXJuIG5ldyBUZXh0RW5jb2RlcigpLmVuY29kZShpbnB1dCk7XG59XG5cbmV4cG9ydCBmdW5jdGlvbiB0b1V0ZjgoaW5wdXQ6IFVpbnQ4QXJyYXkpOiBzdHJpbmcge1xuICByZXR1cm4gbmV3IFRleHREZWNvZGVyKFwidXRmLThcIikuZGVjb2RlKGlucHV0KTtcbn1cbiJdfQ==","/**\n * Converts a JS string from its native UCS-2/UTF-16 representation into a\n * Uint8Array of the bytes used to represent the equivalent characters in UTF-8.\n *\n * Cribbed from the `goog.crypt.stringToUtf8ByteArray` function in the Google\n * Closure library, though updated to use typed arrays.\n */\nexport var fromUtf8 = function (input) {\n var bytes = [];\n for (var i = 0, len = input.length; i < len; i++) {\n var value = input.charCodeAt(i);\n if (value < 0x80) {\n bytes.push(value);\n }\n else if (value < 0x800) {\n bytes.push((value >> 6) | 192, (value & 63) | 128);\n }\n else if (i + 1 < input.length && (value & 0xfc00) === 0xd800 && (input.charCodeAt(i + 1) & 0xfc00) === 0xdc00) {\n var surrogatePair = 0x10000 + ((value & 1023) << 10) + (input.charCodeAt(++i) & 1023);\n bytes.push((surrogatePair >> 18) | 240, ((surrogatePair >> 12) & 63) | 128, ((surrogatePair >> 6) & 63) | 128, (surrogatePair & 63) | 128);\n }\n else {\n bytes.push((value >> 12) | 224, ((value >> 6) & 63) | 128, (value & 63) | 128);\n }\n }\n return Uint8Array.from(bytes);\n};\n/**\n * Converts a typed array of bytes containing UTF-8 data into a native JS\n * string.\n *\n * Partly cribbed from the `goog.crypt.utf8ByteArrayToString` function in the\n * Google Closure library, though updated to use typed arrays and to better\n * handle astral plane code points.\n */\nexport var toUtf8 = function (input) {\n var decoded = \"\";\n for (var i = 0, len = input.length; i < len; i++) {\n var byte = input[i];\n if (byte < 0x80) {\n decoded += String.fromCharCode(byte);\n }\n else if (192 <= byte && byte < 224) {\n var nextByte = input[++i];\n decoded += String.fromCharCode(((byte & 31) << 6) | (nextByte & 63));\n }\n else if (240 <= byte && byte < 365) {\n var surrogatePair = [byte, input[++i], input[++i], input[++i]];\n var encoded = \"%\" + surrogatePair.map(function (byteValue) { return byteValue.toString(16); }).join(\"%\");\n decoded += decodeURIComponent(encoded);\n }\n else {\n decoded += String.fromCharCode(((byte & 15) << 12) | ((input[++i] & 63) << 6) | (input[++i] & 63));\n }\n }\n return decoded;\n};\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVyZUpzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3B1cmVKcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7QUFDSCxNQUFNLENBQUMsSUFBTSxRQUFRLEdBQUcsVUFBQyxLQUFhO0lBQ3BDLElBQU0sS0FBSyxHQUFrQixFQUFFLENBQUM7SUFDaEMsS0FBSyxJQUFJLENBQUMsR0FBRyxDQUFDLEVBQUUsR0FBRyxHQUFHLEtBQUssQ0FBQyxNQUFNLEVBQUUsQ0FBQyxHQUFHLEdBQUcsRUFBRSxDQUFDLEVBQUUsRUFBRTtRQUNoRCxJQUFNLEtBQUssR0FBRyxLQUFLLENBQUMsVUFBVSxDQUFDLENBQUMsQ0FBQyxDQUFDO1FBQ2xDLElBQUksS0FBSyxHQUFHLElBQUksRUFBRTtZQUNoQixLQUFLLENBQUMsSUFBSSxDQUFDLEtBQUssQ0FBQyxDQUFDO1NBQ25CO2FBQU0sSUFBSSxLQUFLLEdBQUcsS0FBSyxFQUFFO1lBQ3hCLEtBQUssQ0FBQyxJQUFJLENBQUMsQ0FBQyxLQUFLLElBQUksQ0FBQyxDQUFDLEdBQUcsR0FBVSxFQUFFLENBQUMsS0FBSyxHQUFHLEVBQVEsQ0FB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ICAgIGRlY29kZWQgKz0gU3RyaW5nLmZyb21DaGFyQ29kZSgoKGJ5dGUgJiAwYjExMTExKSA8PCA2KSB8IChuZXh0Qnl0ZSAmIDBiMTExMTExKSk7XG4gICAgfSBlbHNlIGlmICgwYjExMTEwMDAwIDw9IGJ5dGUgJiYgYnl0ZSA8IDBiMTAxMTAxMTAxKSB7XG4gICAgICBjb25zdCBzdXJyb2dhdGVQYWlyID0gW2J5dGUsIGlucHV0WysraV0sIGlucHV0WysraV0sIGlucHV0WysraV1dO1xuICAgICAgY29uc3QgZW5jb2RlZCA9IFwiJVwiICsgc3Vycm9nYXRlUGFpci5tYXAoKGJ5dGVWYWx1ZSkgPT4gYnl0ZVZhbHVlLnRvU3RyaW5nKDE2KSkuam9pbihcIiVcIik7XG4gICAgICBkZWNvZGVkICs9IGRlY29kZVVSSUNvbXBvbmVudChlbmNvZGVkKTtcbiAgICB9IGVsc2Uge1xuICAgICAgZGVjb2RlZCArPSBTdHJpbmcuZnJvbUNoYXJDb2RlKFxuICAgICAgICAoKGJ5dGUgJiAwYjExMTEpIDw8IDEyKSB8ICgoaW5wdXRbKytpXSAmIDBiMTExMTExKSA8PCA2KSB8IChpbnB1dFsrK2ldICYgMGIxMTExMTEpXG4gICAgICApO1xuICAgIH1cbiAgfVxuXG4gIHJldHVybiBkZWNvZGVkO1xufTtcbiJdfQ==","import { __assign, __awaiter, __generator } from \"tslib\";\nexport var resolveEndpointsConfig = function (input) {\n var _a;\n return (__assign(__assign({}, input), { tls: (_a = input.tls) !== null && _a !== void 0 ? _a : true, endpoint: input.endpoint ? normalizeEndpoint(input) : function () { return getEndPointFromRegion(input); }, isCustomEndpoint: input.endpoint ? true : false }));\n};\nvar normalizeEndpoint = function (input) {\n var endpoint = input.endpoint, urlParser = input.urlParser;\n if (typeof endpoint === \"string\") {\n var promisified_1 = Promise.resolve(urlParser(endpoint));\n return function () { return promisified_1; };\n }\n else if (typeof endpoint === \"object\") {\n var promisified_2 = Promise.resolve(endpoint);\n return function () { return promisified_2; };\n }\n return endpoint;\n};\nvar getEndPointFromRegion = function (input) { return __awaiter(void 0, void 0, void 0, function () {\n var _a, tls, region, dnsHostRegex, hostname;\n var _b;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n _a = input.tls, tls = _a === void 0 ? true : _a;\n return [4 /*yield*/, input.region()];\n case 1:\n region = _c.sent();\n dnsHostRegex = new RegExp(/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$/);\n if (!dnsHostRegex.test(region)) {\n throw new Error(\"Invalid region in client config\");\n }\n return [4 /*yield*/, input.regionInfoProvider(region)];\n case 2:\n hostname = ((_b = (_c.sent())) !== null && _b !== void 0 ? _b : {}).hostname;\n if (!hostname) {\n throw new Error(\"Cannot resolve hostname from client config\");\n }\n return [2 /*return*/, input.urlParser((tls ? \"https:\" : \"http:\") + \"//\" + hostname)];\n }\n });\n}); };\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRW5kcG9pbnRzQ29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL0VuZHBvaW50c0NvbmZpZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBeUJBLE1BQU0sQ0FBQyxJQUFNLHNCQUFzQixHQUFHLFVBQ3BDLEtBQW9EOztJQUNwQixPQUFBLHVCQUM3QixLQUFLLEtBQ1IsR0FBRyxRQUFFLEtBQUssQ0FBQyxHQUFHLG1DQUFJLElBQUksRUFDdEIsUUFBUSxFQUFFLEtBQUssQ0FBQyxRQUFRLENBQUMsQ0FBQyxDQUFDLGlCQUFpQixDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUMsQ0FBQyxjQUFNLE9BQUEscUJBQXFCLENBQUMsS0FBSyxDQUFDLEVBQTVCLENBQTRCLEVBQ3hGLGdCQUFnQixFQUFFLEtBQUssQ0FBQyxRQUFRLENBQU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uIl19","import { __assign } from \"tslib\";\nexport var REGION_ENV_NAME = \"AWS_REGION\";\nexport var REGION_INI_NAME = \"region\";\nexport var NODE_REGION_CONFIG_OPTIONS = {\n environmentVariableSelector: function (env) { return env[REGION_ENV_NAME]; },\n configFileSelector: function (profile) { return profile[REGION_INI_NAME]; },\n default: function () {\n throw new Error(\"Region is missing\");\n },\n};\nexport var NODE_REGION_CONFIG_FILE_OPTIONS = {\n preferredFile: \"credentials\",\n};\nexport var resolveRegionConfig = function (input) {\n if (!input.region) {\n throw new Error(\"Region is missing\");\n }\n return __assign(__assign({}, input), { region: normalizeRegion(input.region) });\n};\nvar normalizeRegion = function (region) {\n if (typeof region === \"string\") {\n var promisified_1 = Promise.resolve(region);\n return function () { return promisified_1; };\n }\n return region;\n};\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUmVnaW9uQ29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL1JlZ2lvbkNvbmZpZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBR0EsTUFBTSxDQUFDLElBQU0sZUFBZSxHQUFHLFlBQVksQ0FBQztBQUM1QyxNQUFNLENBQUMsSUFBTSxlQUFlLEdBQUcsUUFBUSxDQUFDO0FBRXhDLE1BQU0sQ0FBQyxJQUFNLDBCQUEwQixHQUFrQztJQUN2RSwyQkFBMkIsRUFBRSxVQUFDLEdBQUcsSUFBSyxPQUFBLEdBQUcsQ0FBQyxlQUFlLENBQUMsRUFBcEIsQ0FBb0I7SUFDMUQsa0JBQWtCLEVBQUUsVUFBQyxPQUFPLElBQUssT0FBQSxPQUFPLENBQUMsZUFBZSxDQUFDLEVBQXhCLENBQXdCO0lBQ3pELE9BQU8sRUFBRTtRQUNQLE1BQU0sSUFBSSxLQUFLLENBQUMsbUJBQW1CLENBQUMsQ0FBQztJQUN2QyxDQUFDO0NBQ0YsQ0FBQztBQUVGLE1BQ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9uOiBub3JtYWxpemVSZWdpb24oaW5wdXQucmVnaW9uISksXG4gIH07XG59O1xuXG5jb25zdCBub3JtYWxpemVSZWdpb24gPSAocmVnaW9uOiBzdHJpbmcgfCBQcm92aWRlcjxzdHJpbmc+KTogUHJvdmlkZXI8c3RyaW5nPiA9PiB7XG4gIGlmICh0eXBlb2YgcmVnaW9uID09PSBcInN0cmluZ1wiKSB7XG4gICAgY29uc3QgcHJvbWlzaWZpZWQgPSBQcm9taXNlLnJlc29sdmUocmVnaW9uKTtcbiAgICByZXR1cm4gKCkgPT4gcHJvbWlzaWZpZWQ7XG4gIH1cbiAgcmV0dXJuIHJlZ2lvbiBhcyBQcm92aWRlcjxzdHJpbmc+O1xufTtcbiJdfQ==","import { __assign, __awaiter, __generator } from \"tslib\";\nimport { HttpRequest } from \"@aws-sdk/protocol-http\";\nvar CONTENT_LENGTH_HEADER = \"content-length\";\nexport function contentLengthMiddleware(bodyLengthChecker) {\n var _this = this;\n return function (next) { return function (args) { return __awaiter(_this, void 0, void 0, function () {\n var request, body, headers, length;\n var _a;\n return __generator(this, function (_b) {\n request = args.request;\n if (HttpRequest.isInstance(request)) {\n body = request.body, headers = request.headers;\n if (body &&\n Object.keys(headers)\n .map(function (str) { return str.toLowerCase(); })\n .indexOf(CONTENT_LENGTH_HEADER) === -1) {\n length = bodyLengthChecker(body);\n if (length !== undefined) {\n request.headers = __assign(__assign({}, request.headers), (_a = {}, _a[CONTENT_LENGTH_HEADER] = String(length), _a));\n }\n }\n }\n return [2 /*return*/, next(__assign(__assign({}, args), { request: request }))];\n });\n }); }; };\n}\nexport var contentLengthMiddlewareOptions = {\n step: \"build\",\n tags: [\"SET_CONTENT_LENGTH\", \"CONTENT_LENGTH\"],\n name: \"contentLengthMiddleware\",\n override: true,\n};\nexport var getContentLengthPlugin = function (options) { return ({\n applyToStack: function (clientStack) {\n clientStack.add(contentLengthMiddleware(options.bodyLengthChecker), contentLengthMiddlewareOptions);\n },\n}); };\n//# sourceMappingURL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gfVxuICAgIH1cblxuICAgIHJldHVybiBuZXh0KHtcbiAgICAgIC4uLmFyZ3MsXG4gICAgICByZXF1ZXN0LFxuICAgIH0pO1xuICB9O1xufVxuXG5leHBvcnQgY29uc3QgY29udGVudExlbmd0aE1pZGRsZXdhcmVPcHRpb25zOiBCdWlsZEhhbmRsZXJPcHRpb25zID0ge1xuICBzdGVwOiBcImJ1aWxkXCIsXG4gIHRhZ3M6IFtcIlNFVF9DT05URU5UX0xFTkdUSFwiLCBcIkNPTlRFTlRfTEVOR1RIXCJdLFxuICBuYW1lOiBcImNvbnRlbnRMZW5ndGhNaWRkbGV3YXJlXCIsXG4gIG92ZXJyaWRlOiB0cnVlLFxufTtcblxuZXhwb3J0IGNvbnN0IGdldENvbnRlbnRMZW5ndGhQbHVnaW4gPSAob3B0aW9uczogeyBib2R5TGVuZ3RoQ2hlY2tlcjogQm9keUxlbmd0aENhbGN1bGF0b3IgfSk6IFBsdWdnYWJsZTxhbnksIGFueT4gPT4gKHtcbiAgYXBwbHlUb1N0YWNrOiAoY2xpZW50U3RhY2spID0+IHtcbiAgICBjbGllbnRTdGFjay5hZGQoY29udGVudExlbmd0aE1pZGRsZXdhcmUob3B0aW9ucy5ib2R5TGVuZ3RoQ2hlY2tlciksIGNvbnRlbnRMZW5ndGhNaWRkbGV3YXJlT3B0aW9ucyk7XG4gIH0sXG59KTtcbiJdfQ==","var SHORT_TO_HEX = {};\nvar HEX_TO_SHORT = {};\nfor (var i = 0; i < 256; i++) {\n var encodedByte = i.toString(16).toLowerCase();\n if (encodedByte.length === 1) {\n encodedByte = \"0\" + encodedByte;\n }\n SHORT_TO_HEX[i] = encodedByte;\n HEX_TO_SHORT[encodedByte] = i;\n}\n/**\n * Converts a hexadecimal encoded string to a Uint8Array of bytes.\n *\n * @param encoded The hexadecimal encoded string\n */\nexport function fromHex(encoded) {\n if (encoded.length % 2 !== 0) {\n throw new Error(\"Hex encoded strings must have an even number length\");\n }\n var out = new Uint8Array(encoded.length / 2);\n for (var i = 0; i < encoded.length; i += 2) {\n var encodedByte = encoded.substr(i, 2).toLowerCase();\n if (encodedByte in HEX_TO_SHORT) {\n out[i / 2] = HEX_TO_SHORT[encodedByte];\n }\n else {\n throw new Error(\"Cannot decode unrecognized sequence \" + encodedByte + \" as hexadecimal\");\n }\n }\n return out;\n}\n/**\n * Converts a Uint8Array of binary data to a hexadecimal encoded string.\n *\n * @param bytes The binary data to encode\n */\nexport function toHex(bytes) {\n var out = \"\";\n for (var i = 0; i < bytes.byteLength; i++) {\n out += SHORT_TO_HEX[bytes[i]];\n }\n return out;\n}\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsSUFBTSxZQUFZLEdBQThCLEVBQUUsQ0FBQztBQUNuRCxJQUFNLFlBQVksR0FBOEIsRUFBRSxDQUFDO0FBRW5ELEtBQUssSUFBSSxDQUFDLEdBQUcsQ0FBQyxFQUFFLENBQUMsR0FBRyxHQUFHLEVBQUUsQ0FBQyxFQUFFLEVBQUU7SUFDNUIsSUFBSSxXQUFXLEdBQUcsQ0FBQyxDQUFDLFFBQVEsQ0FBQyxFQUFFLENBQUMsQ0FBQyxXQUFXLEVBQUUsQ0FBQztJQUMvQyxJQUFJLFdBQVcsQ0FBQyxNQUFNLEtBQUssQ0FBQyxFQUFFO1FBQzVCLFdBQVcsR0FBRyxNQUFJLFdBQWEsQ0FBQztLQUNqQztJQUVELFlBQVksQ0FBQyxDQUFDLENBQUMsR0FBRyxXQUFXLENBQUM7SUFDOUIsWUFBWSxDQUFDLFdBQVcsQ0FBQyxHQUFHLENBQUMsQ0FBQztDQUMvQjtBQUVEOzs7O0dBSUc7QUFDSCxNQUFNLFVBQVUsT0FBTyxDQUFDLE9BQWU7SUFDckMsSUFBSSxPQUFPLEN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IpLnRvTG93ZXJDYXNlKCk7XG4gICAgaWYgKGVuY29kZWRCeXRlIGluIEhFWF9UT19TSE9SVCkge1xuICAgICAgb3V0W2kgLyAyXSA9IEhFWF9UT19TSE9SVFtlbmNvZGVkQnl0ZV07XG4gICAgfSBlbHNlIHtcbiAgICAgIHRocm93IG5ldyBFcnJvcihgQ2Fubm90IGRlY29kZSB1bnJlY29nbml6ZWQgc2VxdWVuY2UgJHtlbmNvZGVkQnl0ZX0gYXMgaGV4YWRlY2ltYWxgKTtcbiAgICB9XG4gIH1cblxuICByZXR1cm4gb3V0O1xufVxuXG4vKipcbiAqIENvbnZlcnRzIGEgVWludDhBcnJheSBvZiBiaW5hcnkgZGF0YSB0byBhIGhleGFkZWNpbWFsIGVuY29kZWQgc3RyaW5nLlxuICpcbiAqIEBwYXJhbSBieXRlcyBUaGUgYmluYXJ5IGRhdGEgdG8gZW5jb2RlXG4gKi9cbmV4cG9ydCBmdW5jdGlvbiB0b0hleChieXRlczogVWludDhBcnJheSk6IHN0cmluZyB7XG4gIGxldCBvdXQgPSBcIlwiO1xuICBmb3IgKGxldCBpID0gMDsgaSA8IGJ5dGVzLmJ5dGVMZW5ndGg7IGkrKykge1xuICAgIG91dCArPSBTSE9SVF9UT19IRVhbYnl0ZXNbaV1dO1xuICB9XG5cbiAgcmV0dXJuIG91dDtcbn1cbiJdfQ==","import { __awaiter, __generator } from \"tslib\";\nimport { HttpRequest } from \"@aws-sdk/protocol-http\";\nexport function resolveHostHeaderConfig(input) {\n return input;\n}\nexport var hostHeaderMiddleware = function (options) { return function (next) { return function (args) { return __awaiter(void 0, void 0, void 0, function () {\n var request, _a, handlerProtocol;\n return __generator(this, function (_b) {\n if (!HttpRequest.isInstance(args.request))\n return [2 /*return*/, next(args)];\n request = args.request;\n _a = (options.requestHandler.metadata || {}).handlerProtocol, handlerProtocol = _a === void 0 ? \"\" : _a;\n //For H2 request, remove 'host' header and use ':authority' header instead\n //reference: https://nodejs.org/dist/latest-v13.x/docs/api/errors.html#ERR_HTTP2_INVALID_CONNECTION_HEADERS\n if (handlerProtocol.indexOf(\"h2\") >= 0 && !request.headers[\":authority\"]) {\n delete request.headers[\"host\"];\n request.headers[\":authority\"] = \"\";\n //non-H2 request and 'host' header is not set, set the 'host' header to request's hostname.\n }\n else if (!request.headers[\"host\"]) {\n request.headers[\"host\"] = request.hostname;\n }\n return [2 /*return*/, next(args)];\n });\n}); }; }; };\nexport var hostHeaderMiddlewareOptions = {\n name: \"hostHeaderMiddleware\",\n step: \"build\",\n priority: \"low\",\n tags: [\"HOST\"],\n override: true,\n};\nexport var getHostHeaderPlugin = function (options) { return ({\n applyToStack: function (clientStack) {\n clientStack.add(hostHeaderMiddleware(options), hostHeaderMiddlewareOptions);\n },\n}); };\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQVVyRCxNQUFNLFVBQVUsdUJBQXVCLENBQ3JDLEtBQXFEO0lBRXJELE9BQU8sS0FBSyxDQUFDO0FBQ2YsQ0FBQztBQUVELE1BQU0sQ0FBQyxJQUFNLG9CQUFvQixHQUFHLFVBQ2xDLE9BQWlDLElBQ0UsT0FBQSxVQUFDLElBQUksSUFBSyxPQUFBLFVBQU8sSUFBSTs7O1FBQ3hELElBQUksQ0FBQyxXQUFXLENBQUMsVUFBVSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUM7WUFBRSxzQkFBTyxJQUFJLENBQUMsSUFBSSxDQUFDLEVBQUM7UUFDckQsT0FBTyxHQUFLLElBQUksUUFBVCxDQUFVO1FBQ2pCLEtBQXlCLENBQUEsT0FBTyxDQUFDLGNBQWMsQ0FBQyxRQUFRLElBQUksRUFBRSx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PcHRpb25zICYgQWJzb2x1dGVMb2NhdGlvbiA9IHtcbiAgbmFtZTogXCJob3N0SGVhZGVyTWlkZGxld2FyZVwiLFxuICBzdGVwOiBcImJ1aWxkXCIsXG4gIHByaW9yaXR5OiBcImxvd1wiLFxuICB0YWdzOiBbXCJIT1NUXCJdLFxuICBvdmVycmlkZTogdHJ1ZSxcbn07XG5cbmV4cG9ydCBjb25zdCBnZXRIb3N0SGVhZGVyUGx1Z2luID0gKG9wdGlvbnM6IEhvc3RIZWFkZXJSZXNvbHZlZENvbmZpZyk6IFBsdWdnYWJsZTxhbnksIGFueT4gPT4gKHtcbiAgYXBwbHlUb1N0YWNrOiAoY2xpZW50U3RhY2spID0+IHtcbiAgICBjbGllbnRTdGFjay5hZGQoaG9zdEhlYWRlck1pZGRsZXdhcmUob3B0aW9ucyksIGhvc3RIZWFkZXJNaWRkbGV3YXJlT3B0aW9ucyk7XG4gIH0sXG59KTtcbiJdfQ==","import { __awaiter, __generator, __rest } from \"tslib\";\nexport var loggerMiddleware = function () { return function (next, context) { return function (args) { return __awaiter(void 0, void 0, void 0, function () {\n var clientName, commandName, inputFilterSensitiveLog, logger, outputFilterSensitiveLog, response, _a, $metadata, outputWithoutMetadata;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n clientName = context.clientName, commandName = context.commandName, inputFilterSensitiveLog = context.inputFilterSensitiveLog, logger = context.logger, outputFilterSensitiveLog = context.outputFilterSensitiveLog;\n return [4 /*yield*/, next(args)];\n case 1:\n response = _b.sent();\n if (!logger) {\n return [2 /*return*/, response];\n }\n if (typeof logger.info === \"function\") {\n _a = response.output, $metadata = _a.$metadata, outputWithoutMetadata = __rest(_a, [\"$metadata\"]);\n logger.info({\n clientName: clientName,\n commandName: commandName,\n input: inputFilterSensitiveLog(args.input),\n output: outputFilterSensitiveLog(outputWithoutMetadata),\n metadata: $metadata,\n });\n }\n return [2 /*return*/, response];\n }\n });\n}); }; }; };\nexport var loggerMiddlewareOptions = {\n name: \"loggerMiddleware\",\n tags: [\"LOGGER\"],\n step: \"initialize\",\n override: true,\n};\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport var getLoggerPlugin = function (options) { return ({\n applyToStack: function (clientStack) {\n clientStack.add(loggerMiddleware(), loggerMiddlewareOptions);\n },\n}); };\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9nZ2VyTWlkZGxld2FyZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9sb2dnZXJNaWRkbGV3YXJlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFZQSxNQUFNLENBQUMsSUFBTSxnQkFBZ0IsR0FBRyxjQUFNLE9BQUEsVUFDcEMsSUFBb0MsRUFDcEMsT0FBZ0MsSUFDRyxPQUFBLFVBQ25DLElBQXFDOzs7OztnQkFFN0IsVUFBVSxHQUE2RSxPQUFPLFdBQXBGLEVBQUUsV0FBVyxHQUFnRSxPQUFPLFlBQXZFLEVBQUUsdUJBQXVCLEdBQXVDLE9BQU8sd0JBQTlDLEVBQUUsTUFBTSxHQUErQixPQUFPLE9BQXRDLEVBQUUsd0JBQXdCLEdBQUssT0FBTyx5QkFBWixDQUFhO2dCQUV0RixxQkFBTSxJQUFJLENBQUMsSUFBSSxDQUFDLEVBQUE7O2dCQUEzQixRQUFRLEdBQUcsU0FBZ0I7Z0JBRWpDLElBQUksQ0FBQyxNQUFNLEVBQUU7b0JBQ1gsc0JBQU8sUUFBUSxFQUFDO2lCQUNqQjtnQkFFRCxJQUFJLE9BQU8sTUFBTSxDQUFDLElBQUksS0FBSyxVQUFVLEVBQUU7b0JBQy9CLEtBQTBDLFFBQVEsQ0FBQyxNQUFNLEVBQXZELFNBQVMsZUFBQSxFQUFLLHFCQUFxQixjQUFyQyxhQUF1QyxDQUFGLENBQXFCO29CQUNoRSxNQUFNLENBQUMsSUFBSSxDQUFDO3dCQUNWLFVBQVUsWU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BvdXRwdXRGaWx0ZXJTZW5zaXRpdmVMb2cob3V0cHV0V2l0aG91dE1ldGFkYXRhKSxcbiAgICAgIG1ldGFkYXRhOiAkbWV0YWRhdGEsXG4gICAgfSk7XG4gIH1cblxuICByZXR1cm4gcmVzcG9uc2U7XG59O1xuXG5leHBvcnQgY29uc3QgbG9nZ2VyTWlkZGxld2FyZU9wdGlvbnM6IEluaXRpYWxpemVIYW5kbGVyT3B0aW9ucyAmIEFic29sdXRlTG9jYXRpb24gPSB7XG4gIG5hbWU6IFwibG9nZ2VyTWlkZGxld2FyZVwiLFxuICB0YWdzOiBbXCJMT0dHRVJcIl0sXG4gIHN0ZXA6IFwiaW5pdGlhbGl6ZVwiLFxuICBvdmVycmlkZTogdHJ1ZSxcbn07XG5cbi8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBAdHlwZXNjcmlwdC1lc2xpbnQvbm8tdW51c2VkLXZhcnNcbmV4cG9ydCBjb25zdCBnZXRMb2dnZXJQbHVnaW4gPSAob3B0aW9uczogYW55KTogUGx1Z2dhYmxlPGFueSwgYW55PiA9PiAoe1xuICBhcHBseVRvU3RhY2s6IChjbGllbnRTdGFjaykgPT4ge1xuICAgIGNsaWVudFN0YWNrLmFkZChsb2dnZXJNaWRkbGV3YXJlKCksIGxvZ2dlck1pZGRsZXdhcmVPcHRpb25zKTtcbiAgfSxcbn0pO1xuIl19","export var ALGORITHM_QUERY_PARAM = \"X-Amz-Algorithm\";\nexport var CREDENTIAL_QUERY_PARAM = \"X-Amz-Credential\";\nexport var AMZ_DATE_QUERY_PARAM = \"X-Amz-Date\";\nexport var SIGNED_HEADERS_QUERY_PARAM = \"X-Amz-SignedHeaders\";\nexport var EXPIRES_QUERY_PARAM = \"X-Amz-Expires\";\nexport var SIGNATURE_QUERY_PARAM = \"X-Amz-Signature\";\nexport var TOKEN_QUERY_PARAM = \"X-Amz-Security-Token\";\nexport var AUTH_HEADER = \"authorization\";\nexport var AMZ_DATE_HEADER = AMZ_DATE_QUERY_PARAM.toLowerCase();\nexport var DATE_HEADER = \"date\";\nexport var GENERATED_HEADERS = [AUTH_HEADER, AMZ_DATE_HEADER, DATE_HEADER];\nexport var SIGNATURE_HEADER = SIGNATURE_QUERY_PARAM.toLowerCase();\nexport var SHA256_HEADER = \"x-amz-content-sha256\";\nexport var TOKEN_HEADER = TOKEN_QUERY_PARAM.toLowerCase();\nexport var HOST_HEADER = \"host\";\nexport var ALWAYS_UNSIGNABLE_HEADERS = {\n authorization: true,\n \"cache-control\": true,\n connection: true,\n expect: true,\n from: true,\n \"keep-alive\": true,\n \"max-forwards\": true,\n pragma: true,\n referer: true,\n te: true,\n trailer: true,\n \"transfer-encoding\": true,\n upgrade: true,\n \"user-agent\": true,\n \"x-amzn-trace-id\": true,\n};\nexport var PROXY_HEADER_PATTERN = /^proxy-/;\nexport var SEC_HEADER_PATTERN = /^sec-/;\nexport var UNSIGNABLE_PATTERNS = [/^proxy-/i, /^sec-/i];\nexport var ALGORITHM_IDENTIFIER = \"AWS4-HMAC-SHA256\";\nexport var EVENT_ALGORITHM_IDENTIFIER = \"AWS4-HMAC-SHA256-PAYLOAD\";\nexport var UNSIGNED_PAYLOAD = \"UNSIGNED-PAYLOAD\";\nexport var MAX_CACHE_SIZE = 50;\nexport var KEY_TYPE_IDENTIFIER = \"aws4_request\";\nexport var MAX_PRESIGNED_TTL = 60 * 60 * 24 * 7;\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbnN0YW50cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxNQUFNLENBQUMsSUFBTSxxQkFBcUIsR0FBRyxpQkFBaUIsQ0FBQztBQUN2RCxNQUFNLENBQUMsSUFBTSxzQkFBc0IsR0FBRyxrQkFBa0IsQ0FBQztBQUN6RCxNQUFNLENBQUMsSUFBTS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Y29udHJvbFwiOiB0cnVlLFxuICBjb25uZWN0aW9uOiB0cnVlLFxuICBleHBlY3Q6IHRydWUsXG4gIGZyb206IHRydWUsXG4gIFwia2VlcC1hbGl2ZVwiOiB0cnVlLFxuICBcIm1heC1mb3J3YXJkc1wiOiB0cnVlLFxuICBwcmFnbWE6IHRydWUsXG4gIHJlZmVyZXI6IHRydWUsXG4gIHRlOiB0cnVlLFxuICB0cmFpbGVyOiB0cnVlLFxuICBcInRyYW5zZmVyLWVuY29kaW5nXCI6IHRydWUsXG4gIHVwZ3JhZGU6IHRydWUsXG4gIFwidXNlci1hZ2VudFwiOiB0cnVlLFxuICBcIngtYW16bi10cmFjZS1pZFwiOiB0cnVlLFxufTtcblxuZXhwb3J0IGNvbnN0IFBST1hZX0hFQURFUl9QQVRURVJOID0gL15wcm94eS0vO1xuXG5leHBvcnQgY29uc3QgU0VDX0hFQURFUl9QQVRURVJOID0gL15zZWMtLztcblxuZXhwb3J0IGNvbnN0IFVOU0lHTkFCTEVfUEFUVEVSTlMgPSBbL15wcm94eS0vaSwgL15zZWMtL2ldO1xuXG5leHBvcnQgY29uc3QgQUxHT1JJVEhNX0lERU5USUZJRVIgPSBcIkFXUzQtSE1BQy1TSEEyNTZcIjtcblxuZXhwb3J0IGNvbnN0IEVWRU5UX0FMR09SSVRITV9JREVOVElGSUVSID0gXCJBV1M0LUhNQUMtU0hBMjU2LVBBWUxPQURcIjtcblxuZXhwb3J0IGNvbnN0IFVOU0lHTkVEX1BBWUxPQUQgPSBcIlVOU0lHTkVELVBBWUxPQURcIjtcblxuZXhwb3J0IGNvbnN0IE1BWF9DQUNIRV9TSVpFID0gNTA7XG5leHBvcnQgY29uc3QgS0VZX1RZUEVfSURFTlRJRklFUiA9IFwiYXdzNF9yZXF1ZXN0XCI7XG5cbmV4cG9ydCBjb25zdCBNQVhfUFJFU0lHTkVEX1RUTCA9IDYwICogNjAgKiAyNCAqIDc7XG4iXX0=","import { __awaiter, __generator, __values } from \"tslib\";\nimport { toHex } from \"@aws-sdk/util-hex-encoding\";\nimport { KEY_TYPE_IDENTIFIER, MAX_CACHE_SIZE } from \"./constants\";\nvar signingKeyCache = {};\nvar cacheQueue = [];\n/**\n * Create a string describing the scope of credentials used to sign a request.\n *\n * @param shortDate The current calendar date in the form YYYYMMDD.\n * @param region The AWS region in which the service resides.\n * @param service The service to which the signed request is being sent.\n */\nexport function createScope(shortDate, region, service) {\n return shortDate + \"/\" + region + \"/\" + service + \"/\" + KEY_TYPE_IDENTIFIER;\n}\n/**\n * Derive a signing key from its composite parts\n *\n * @param sha256Constructor A constructor function that can instantiate SHA-256\n * hash objects.\n * @param credentials The credentials with which the request will be\n * signed.\n * @param shortDate The current calendar date in the form YYYYMMDD.\n * @param region The AWS region in which the service resides.\n * @param service The service to which the signed request is being\n * sent.\n */\nexport var getSigningKey = function (sha256Constructor, credentials, shortDate, region, service) { return __awaiter(void 0, void 0, void 0, function () {\n var credsHash, cacheKey, key, _a, _b, signable, e_1_1;\n var e_1, _c;\n return __generator(this, function (_d) {\n switch (_d.label) {\n case 0: return [4 /*yield*/, hmac(sha256Constructor, credentials.secretAccessKey, credentials.accessKeyId)];\n case 1:\n credsHash = _d.sent();\n cacheKey = shortDate + \":\" + region + \":\" + service + \":\" + toHex(credsHash) + \":\" + credentials.sessionToken;\n if (cacheKey in signingKeyCache) {\n return [2 /*return*/, signingKeyCache[cacheKey]];\n }\n cacheQueue.push(cacheKey);\n while (cacheQueue.length > MAX_CACHE_SIZE) {\n delete signingKeyCache[cacheQueue.shift()];\n }\n key = \"AWS4\" + credentials.secretAccessKey;\n _d.label = 2;\n case 2:\n _d.trys.push([2, 7, 8, 9]);\n _a = __values([shortDate, region, service, KEY_TYPE_IDENTIFIER]), _b = _a.next();\n _d.label = 3;\n case 3:\n if (!!_b.done) return [3 /*break*/, 6];\n signable = _b.value;\n return [4 /*yield*/, hmac(sha256Constructor, key, signable)];\n case 4:\n key = _d.sent();\n _d.label = 5;\n case 5:\n _b = _a.next();\n return [3 /*break*/, 3];\n case 6: return [3 /*break*/, 9];\n case 7:\n e_1_1 = _d.sent();\n e_1 = { error: e_1_1 };\n return [3 /*break*/, 9];\n case 8:\n try {\n if (_b && !_b.done && (_c = _a.return)) _c.call(_a);\n }\n finally { if (e_1) throw e_1.error; }\n return [7 /*endfinally*/];\n case 9: return [2 /*return*/, (signingKeyCache[cacheKey] = key)];\n }\n });\n}); };\n/**\n * @internal\n */\nexport function clearCredentialCache() {\n cacheQueue.length = 0;\n Object.keys(signingKeyCache).forEach(function (cacheKey) {\n delete signingKeyCache[cacheKey];\n });\n}\nfunction hmac(ctor, secret, data) {\n var hash = new ctor(secret);\n hash.update(data);\n return hash.digest();\n}\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3JlZGVudGlhbERlcml2YXRpb24uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY3JlZGVudGlhbERlcml2YXRpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUNBLE9BQU8sRUFBRSxLQUFLLEVBQUUsTUFBTSw0QkFBNEIsQ0FBQztBQUVuRCxPQUFPLEVBQUUsbUJBQW1CLEVBQUUsY0FBYyxFQUFFLE1BQU0sYUFBYSxDQUFDO0FBRWxFLElBQU0sZUFBZSxHQUFrQyxFQUFFLENBQUM7QUFDMUQsSUFBTSxVQUFVLEdBQWtCLEVBQUUsQ0FBQztBQUVyQzs7Ozs7O0dBTUc7QUFDSCxNQUFNLFVBQVUsV0FBVyxDQUFDLFNBQWlCLEVBQUUsTUFBYyxFQUFFLE9BQWU7SUFDNUUsT0FBVSxTQUFTLFNBQUksTUFBTSxTQUFJLE9BQU8sU0FBSSxtQkFBcUIsQ0FBQztBQUNwRSxDQUFDO0FBRUQ7Ozs7Ozs7Ozs7O0dBV0c7QUFDSCxNQUFNLENBQUMsSUFBTSxhQUFhLEdBQUcsVUFDM0IsaUJBQWtDLEVBQ2x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bnN0IHNpZ25hYmxlIG9mIFtzaG9ydERhdGUsIHJlZ2lvbiwgc2VydmljZSwgS0VZX1RZUEVfSURFTlRJRklFUl0pIHtcbiAgICBrZXkgPSBhd2FpdCBobWFjKHNoYTI1NkNvbnN0cnVjdG9yLCBrZXksIHNpZ25hYmxlKTtcbiAgfVxuICByZXR1cm4gKHNpZ25pbmdLZXlDYWNoZVtjYWNoZUtleV0gPSBrZXkgYXMgVWludDhBcnJheSk7XG59O1xuXG4vKipcbiAqIEBpbnRlcm5hbFxuICovXG5leHBvcnQgZnVuY3Rpb24gY2xlYXJDcmVkZW50aWFsQ2FjaGUoKTogdm9pZCB7XG4gIGNhY2hlUXVldWUubGVuZ3RoID0gMDtcbiAgT2JqZWN0LmtleXMoc2lnbmluZ0tleUNhY2hlKS5mb3JFYWNoKChjYWNoZUtleSkgPT4ge1xuICAgIGRlbGV0ZSBzaWduaW5nS2V5Q2FjaGVbY2FjaGVLZXldO1xuICB9KTtcbn1cblxuZnVuY3Rpb24gaG1hYyhjdG9yOiBIYXNoQ29uc3RydWN0b3IsIHNlY3JldDogU291cmNlRGF0YSwgZGF0YTogU291cmNlRGF0YSk6IFByb21pc2U8VWludDhBcnJheT4ge1xuICBjb25zdCBoYXNoID0gbmV3IGN0b3Ioc2VjcmV0KTtcbiAgaGFzaC51cGRhdGUoZGF0YSk7XG4gIHJldHVybiBoYXNoLmRpZ2VzdCgpO1xufVxuIl19","import { __values } from \"tslib\";\nimport { ALWAYS_UNSIGNABLE_HEADERS, PROXY_HEADER_PATTERN, SEC_HEADER_PATTERN } from \"./constants\";\n/**\n * @internal\n */\nexport function getCanonicalHeaders(_a, unsignableHeaders, signableHeaders) {\n var e_1, _b;\n var headers = _a.headers;\n var canonical = {};\n try {\n for (var _c = __values(Object.keys(headers).sort()), _d = _c.next(); !_d.done; _d = _c.next()) {\n var headerName = _d.value;\n var canonicalHeaderName = headerName.toLowerCase();\n if (canonicalHeaderName in ALWAYS_UNSIGNABLE_HEADERS || (unsignableHeaders === null || unsignableHeaders === void 0 ? void 0 : unsignableHeaders.has(canonicalHeaderName)) ||\n PROXY_HEADER_PATTERN.test(canonicalHeaderName) ||\n SEC_HEADER_PATTERN.test(canonicalHeaderName)) {\n if (!signableHeaders || (signableHeaders && !signableHeaders.has(canonicalHeaderName))) {\n continue;\n }\n }\n canonical[canonicalHeaderName] = headers[headerName].trim().replace(/\\s+/g, \" \");\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_d && !_d.done && (_b = _c.return)) _b.call(_c);\n }\n finally { if (e_1) throw e_1.error; }\n }\n return canonical;\n}\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0Q2Fub25pY2FsSGVhZGVycy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9nZXRDYW5vbmljYWxIZWFkZXJzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFFQSxPQUFPLEVBQUUseUJBQXlCLEVBQUUsb0JBQW9CLEVBQUUsa0JBQWtCLEVBQUUsTUFBTSxhQUFhLENBQUM7QUFFbEc7O0dBRUc7QUFDSCxNQUFNLFVBQVUsbUJBQW1CLENBQ2pDLEVBQXdCLEVBQ3hCLGlCQUErQixFQUMvQixlQUE2Qjs7UUFGM0IsT0FBTyxhQUFBO0lBSVQsSUFBTSxTQUFTLEdBQWMsRUFBRSxDQUFDOztRQUNoQyxLQUF5QixJQUFBLEtBQUEsU0FBQSxNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxDQUFDLElBQUksRUFBRSxDQUFBLGdCQUFBLDRCQUFFO1lBQWpELElBQU0sVUFBVSxXQUFBO1lBQ25CLElBQU0sbUJBQW1CLEdBQUcsVUFBVSxDQUFDLFdBQVcsRUFBRSxDQUFDO1lBQ3JELElBQ0UsbUJBQW1CLElBQUkseUJBQXlCLEtBQ2hELGlCQUFpQixh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WcgPSB7fTtcbiAgZm9yIChjb25zdCBoZWFkZXJOYW1lIG9mIE9iamVjdC5rZXlzKGhlYWRlcnMpLnNvcnQoKSkge1xuICAgIGNvbnN0IGNhbm9uaWNhbEhlYWRlck5hbWUgPSBoZWFkZXJOYW1lLnRvTG93ZXJDYXNlKCk7XG4gICAgaWYgKFxuICAgICAgY2Fub25pY2FsSGVhZGVyTmFtZSBpbiBBTFdBWVNfVU5TSUdOQUJMRV9IRUFERVJTIHx8XG4gICAgICB1bnNpZ25hYmxlSGVhZGVycz8uaGFzKGNhbm9uaWNhbEhlYWRlck5hbWUpIHx8XG4gICAgICBQUk9YWV9IRUFERVJfUEFUVEVSTi50ZXN0KGNhbm9uaWNhbEhlYWRlck5hbWUpIHx8XG4gICAgICBTRUNfSEVBREVSX1BBVFRFUk4udGVzdChjYW5vbmljYWxIZWFkZXJOYW1lKVxuICAgICkge1xuICAgICAgaWYgKCFzaWduYWJsZUhlYWRlcnMgfHwgKHNpZ25hYmxlSGVhZGVycyAmJiAhc2lnbmFibGVIZWFkZXJzLmhhcyhjYW5vbmljYWxIZWFkZXJOYW1lKSkpIHtcbiAgICAgICAgY29udGludWU7XG4gICAgICB9XG4gICAgfVxuXG4gICAgY2Fub25pY2FsW2Nhbm9uaWNhbEhlYWRlck5hbWVdID0gaGVhZGVyc1toZWFkZXJOYW1lXS50cmltKCkucmVwbGFjZSgvXFxzKy9nLCBcIiBcIik7XG4gIH1cblxuICByZXR1cm4gY2Fub25pY2FsO1xufVxuIl19","import { __awaiter, __generator, __values } from \"tslib\";\nimport { isArrayBuffer } from \"@aws-sdk/is-array-buffer\";\nimport { toHex } from \"@aws-sdk/util-hex-encoding\";\nimport { SHA256_HEADER, UNSIGNED_PAYLOAD } from \"./constants\";\n/**\n * @internal\n */\nexport function getPayloadHash(_a, hashConstructor) {\n var headers = _a.headers, body = _a.body;\n return __awaiter(this, void 0, void 0, function () {\n var _b, _c, headerName, hashCtor, _d;\n var e_1, _e;\n return __generator(this, function (_f) {\n switch (_f.label) {\n case 0:\n try {\n for (_b = __values(Object.keys(headers)), _c = _b.next(); !_c.done; _c = _b.next()) {\n headerName = _c.value;\n if (headerName.toLowerCase() === SHA256_HEADER) {\n return [2 /*return*/, headers[headerName]];\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_e = _b.return)) _e.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n if (!(body == undefined)) return [3 /*break*/, 1];\n return [2 /*return*/, \"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\"];\n case 1:\n if (!(typeof body === \"string\" || ArrayBuffer.isView(body) || isArrayBuffer(body))) return [3 /*break*/, 3];\n hashCtor = new hashConstructor();\n hashCtor.update(body);\n _d = toHex;\n return [4 /*yield*/, hashCtor.digest()];\n case 2: return [2 /*return*/, _d.apply(void 0, [_f.sent()])];\n case 3: \n // As any defined body that is not a string or binary data is a stream, this\n // body is unsignable. Attempt to send the request with an unsigned payload,\n // which may or may not be accepted by the service.\n return [2 /*return*/, UNSIGNED_PAYLOAD];\n }\n });\n });\n}\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0UGF5bG9hZEhhc2guanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZ2V0UGF5bG9hZEhhc2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE9BQU8sRUFBRSxhQUFhLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQztBQUV6RCxPQUFPLEVBQUUsS0FBSyxFQUFFLE1BQU0sNEJBQTRCLENBQUM7QUFFbkQsT0FBTyxFQUFFLGFBQWEsRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUU5RDs7R0FFRztBQUNILE1BQU0sVUFBZ0IsY0FBYyxDQUNsQyxFQUE4QixFQUM5QixlQUFnQztRQU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IHRoYXQgaXMgbm90IGEgc3RyaW5nIG9yIGJpbmFyeSBkYXRhIGlzIGEgc3RyZWFtLCB0aGlzXG4gIC8vIGJvZHkgaXMgdW5zaWduYWJsZS4gQXR0ZW1wdCB0byBzZW5kIHRoZSByZXF1ZXN0IHdpdGggYW4gdW5zaWduZWQgcGF5bG9hZCxcbiAgLy8gd2hpY2ggbWF5IG9yIG1heSBub3QgYmUgYWNjZXB0ZWQgYnkgdGhlIHNlcnZpY2UuXG4gIHJldHVybiBVTlNJR05FRF9QQVlMT0FEO1xufVxuIl19","export var isArrayBuffer = function (arg) {\n return (typeof ArrayBuffer === \"function\" && arg instanceof ArrayBuffer) ||\n Object.prototype.toString.call(arg) === \"[object ArrayBuffer]\";\n};\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsTUFBTSxDQUFDLElBQU0sYUFBYSxHQUFHLFVBQUMsR0FBUTtJQUNwQyxPQUFBLENBQUMsT0FBTyxXQUFXLEtBQUssVUFBVSxJQUFJLEdBQUcsWUFBWSxXQUFXLENBQUM7UUFDakUsTUFBTSxDQUFDLFNBQVMsQ0FBQyxRQUFRLENBQUMsSUFBSSxDQUFDLEdBQUcsQ0FBQyxLQUFLLHNCQUFzQjtBQUQ5RCxDQUM4RCxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGNvbnN0IGlzQXJyYXlCdWZmZXIgPSAoYXJnOiBhbnkpOiBhcmcgaXMgQXJyYXlCdWZmZXIgPT5cbiAgKHR5cGVvZiBBcnJheUJ1ZmZlciA9PT0gXCJmdW5jdGlvblwiICYmIGFyZyBpbnN0YW5jZW9mIEFycmF5QnVmZmVyKSB8fFxuICBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nLmNhbGwoYXJnKSA9PT0gXCJbb2JqZWN0IEFycmF5QnVmZmVyXVwiO1xuIl19","import { __assign, __read, __rest, __spread } from \"tslib\";\n/**\n * @internal\n */\nexport function cloneRequest(_a) {\n var headers = _a.headers, query = _a.query, rest = __rest(_a, [\"headers\", \"query\"]);\n return __assign(__assign({}, rest), { headers: __assign({}, headers), query: query ? cloneQuery(query) : undefined });\n}\nfunction cloneQuery(query) {\n return Object.keys(query).reduce(function (carry, paramName) {\n var _a;\n var param = query[paramName];\n return __assign(__assign({}, carry), (_a = {}, _a[paramName] = Array.isArray(param) ? __spread(param) : param, _a));\n }, {});\n}\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xvbmVSZXF1ZXN0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2Nsb25lUmVxdWVzdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBRUE7O0dBRUc7QUFDSCxNQUFNLFVBQVUsWUFBWSxDQUFDLEVBQXdDO0lBQXRDLElBQUEsT0FBTyxhQUFBLEVBQUUsS0FBSyxXQUFBLEVBQUssSUFBSSxjQUF6QixvQkFBMkIsQ0FBRjtJQUNwRCw2QkFDSyxJQUFJLEtBQ1AsT0FBTyxlQUFPLE9BQU8sR0FDckIsS0FBSyxFQUFFLEtBQUssQ0FBQyxDQUFDLENBQUMsVUFBVSxDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUMsQ0FBQyxTQUFTLElBQzVDO0FBQ0osQ0FBQztBQUVELFNBQVMsVUFBVSxDQUFDLEtBQXdCO0lBQzFDLE9BQU8sTUFBTSxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUMsQ0FBQyxNQUFNLENBQUMsVUFBQyxLQUF3QixFQUFFLFNBQWlCOztRQUMzRSxJQUFNLEtBQUssR0FBRyxLQUFLLENBQUMsU0FBUyxDQUFDLENBQUM7UUFDL0IsNkJBQ0ssS0FBSyxnQkF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ED_HEADERS } from \"./constants\";\n/**\n * @internal\n */\nexport function prepareRequest(request) {\n var e_1, _a;\n // Create a clone of the request object that does not clone the body\n request = typeof request.clone === \"function\" ? request.clone() : cloneRequest(request);\n try {\n for (var _b = __values(Object.keys(request.headers)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var headerName = _c.value;\n if (GENERATED_HEADERS.indexOf(headerName.toLowerCase()) > -1) {\n delete request.headers[headerName];\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n return request;\n}\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJlcGFyZVJlcXVlc3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvcHJlcGFyZVJlcXVlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUVBLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQztBQUM5QyxPQUFPLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSxhQUFhLENBQUM7QUFFaEQ7O0dBRUc7QUFDSCxNQUFNLFVBQVUsY0FBYyxDQUFDLE9BQW9COztJQUNqRCxvRUFBb0U7SUFDcEUsT0FBTyxHQUFHLE9BQVEsT0FBZSxDQUFDLEtBQUssS0FBSyxVQUFVLENBQUMsQ0FBQyxDQUFFLE9BQWUsQ0FBQyxLQUFLLEVBQUUsQ0FBQyxDQUFDLENBQUMsWUFBWSxDQUFDLE9BQU8sQ0FBQyxDQUFDOztRQUUxRyxLQUF5QixJQUFBLEtBQUEsU0FBQSxNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxPQUFPLENBQUMsQ0FBQSxnQkFBQSw0QkFBRTtZQUFsRCxJQUFNLFVBQVUsV0FBQTtZQUNuQixJQUFJLGlCQUFpQixDQ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9XG5cbiAgcmV0dXJuIHJlcXVlc3Q7XG59XG4iXX0=","export function iso8601(time) {\n return toDate(time)\n .toISOString()\n .replace(/\\.\\d{3}Z$/, \"Z\");\n}\nexport function toDate(time) {\n if (typeof time === \"number\") {\n return new Date(time * 1000);\n }\n if (typeof time === \"string\") {\n if (Number(time)) {\n return new Date(Number(time) * 1000);\n }\n return new Date(time);\n }\n return time;\n}\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbERhdGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbERhdGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsTUFBTSxVQUFVLE9BQU8sQ0FBQyxJQUE0QjtJQUNsRCxPQUFPLE1BQU0sQ0FBQyxJQUFJLENBQUM7U0FDaEIsV0FBVyxFQUFFO1NBQ2IsT0FBTyxDQUFDLFdBQVcsRUFBRSxHQUFHLENBQUMsQ0FBQztBQUMvQixDQUFDO0FBRUQsTUFBTSxVQUFVLE1BQU0sQ0FBQyxJQUE0QjtJQUNqRCxJQUFJLE9BQU8sSUFBSSxLQUFLLFFBQVEsRUFBRTtRQUM1QixPQUFPLElBQUksSUFBSSxDQUFDLElBQUksR0FBRyxJQUFJLENBQUMsQ0FBQztLQUM5QjtJQUVELElBQUksT0FBTyxJQUFJLEtBQUssUUFBUSxFQUFFO1FBQzVCLElBQUksTUFBTSxDQUFDLElBQUksQ0FBQyxFQUFFO1lBQ2hCLE9BQU8sSUFBSSxJQUFJLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxHQUFHLElBQUksQ0FBQyxDQUFDO1NBQ3RDO1FBQ0QsT0FBTyxJQUFJLElBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQztLQUN2QjtJQUVELE9BQU8sSUFBSSxDQUFDO0FBQ2QsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBmdW5jdGlvbiBpc284NjAxKHRpbWU6IG51bWJlciB8IHN0cmluZyB8IERhdGUpOiBzdHJpbmcge1xuICByZXR1cm4gdG9EYXRlKHRpbWUpXG4gICAgLnRvSVNPU3RyaW5nKClcbiAgICAucmVwbGFjZSgvXFwuXFxkezN9WiQvLCBcIlpcIik7XG59XG5cbmV4cG9ydCBmdW5jdGlvbiB0b0RhdGUodGltZTogbnVtYmVyIHwgc3RyaW5nIHwgRGF0ZSk6IERhdGUge1xuICBpZiAodHlwZW9mIHRpbWUgPT09IFwibnVtYmVyXCIpIHtcbiAgICByZXR1cm4gbmV3IERhdGUodGltZSAqIDEwMDApO1xuICB9XG5cbiAgaWYgKHR5cGVvZiB0aW1lID09PSBcInN0cmluZ1wiKSB7XG4gICAgaWYgKE51bWJlcih0aW1lKSkge1xuICAgICAgcmV0dXJuIG5ldyBEYXRlKE51bWJlcih0aW1lKSAqIDEwMDApO1xuICAgIH1cbiAgICByZXR1cm4gbmV3IERhdGUodGltZSk7XG4gIH1cblxuICByZXR1cm4gdGltZTtcbn1cbiJdfQ==","import { __awaiter, __generator } from \"tslib\";\nimport { toHex } from \"@aws-sdk/util-hex-encoding\";\nimport { ALGORITHM_IDENTIFIER, ALGORITHM_QUERY_PARAM, AMZ_DATE_HEADER, AMZ_DATE_QUERY_PARAM, AUTH_HEADER, CREDENTIAL_QUERY_PARAM, EVENT_ALGORITHM_IDENTIFIER, EXPIRES_QUERY_PARAM, MAX_PRESIGNED_TTL, SHA256_HEADER, SIGNATURE_QUERY_PARAM, SIGNED_HEADERS_QUERY_PARAM, TOKEN_HEADER, TOKEN_QUERY_PARAM, } from \"./constants\";\nimport { createScope, getSigningKey } from \"./credentialDerivation\";\nimport { getCanonicalHeaders } from \"./getCanonicalHeaders\";\nimport { getCanonicalQuery } from \"./getCanonicalQuery\";\nimport { getPayloadHash } from \"./getPayloadHash\";\nimport { hasHeader } from \"./hasHeader\";\nimport { moveHeadersToQuery } from \"./moveHeadersToQuery\";\nimport { prepareRequest } from \"./prepareRequest\";\nimport { iso8601 } from \"./utilDate\";\nvar SignatureV4 = /** @class */ (function () {\n function SignatureV4(_a) {\n var applyChecksum = _a.applyChecksum, credentials = _a.credentials, region = _a.region, service = _a.service, sha256 = _a.sha256, _b = _a.uriEscapePath, uriEscapePath = _b === void 0 ? true : _b;\n this.service = service;\n this.sha256 = sha256;\n this.uriEscapePath = uriEscapePath;\n // default to true if applyChecksum isn't set\n this.applyChecksum = typeof applyChecksum === \"boolean\" ? applyChecksum : true;\n this.regionProvider = normalizeRegionProvider(region);\n this.credentialProvider = normalizeCredentialsProvider(credentials);\n }\n SignatureV4.prototype.presign = function (originalRequest, options) {\n if (options === void 0) { options = {}; }\n return __awaiter(this, void 0, void 0, function () {\n var _a, signingDate, _b, expiresIn, unsignableHeaders, unhoistableHeaders, signableHeaders, signingRegion, signingService, credentials, region, _c, _d, longDate, shortDate, scope, request, canonicalHeaders, _e, _f, _g, _h, _j, _k;\n return __generator(this, function (_l) {\n switch (_l.label) {\n case 0:\n _a = options.signingDate, signingDate = _a === void 0 ? new Date() : _a, _b = options.expiresIn, expiresIn = _b === void 0 ? 3600 : _b, unsignableHeaders = options.unsignableHeaders, unhoistableHeaders = options.unhoistableHeaders, signableHeaders = options.signableHeaders, signingRegion = options.signingRegion, signingService = options.signingService;\n return [4 /*yield*/, this.credentialProvider()];\n case 1:\n credentials = _l.sent();\n if (!(signingRegion !== null && signingRegion !== void 0)) return [3 /*break*/, 2];\n _c = signingRegion;\n return [3 /*break*/, 4];\n case 2: return [4 /*yield*/, this.regionProvider()];\n case 3:\n _c = (_l.sent());\n _l.label = 4;\n case 4:\n region = _c;\n _d = formatDate(signingDate), longDate = _d.longDate, shortDate = _d.shortDate;\n if (expiresIn > MAX_PRESIGNED_TTL) {\n return [2 /*return*/, Promise.reject(\"Signature version 4 presigned URLs\" + \" must have an expiration date less than one week in\" + \" the future\")];\n }\n scope = createScope(shortDate, region, signingService !== null && signingService !== void 0 ? signingService : this.service);\n request = moveHeadersToQuery(prepareRequest(originalRequest), { unhoistableHeaders: unhoistableHeaders });\n if (credentials.sessionToken) {\n request.query[TOKEN_QUERY_PARAM] = credentials.sessionToken;\n }\n request.query[ALGORITHM_QUERY_PARAM] = ALGORITHM_IDENTIFIER;\n request.query[CREDENTIAL_QUERY_PARAM] = credentials.accessKeyId + \"/\" + scope;\n request.query[AMZ_DATE_QUERY_PARAM] = longDate;\n request.query[EXPIRES_QUERY_PARAM] = expiresIn.toString(10);\n canonicalHeaders = getCanonicalHeaders(request, unsignableHeaders, signableHeaders);\n request.query[SIGNED_HEADERS_QUERY_PARAM] = getCanonicalHeaderList(canonicalHeaders);\n _e = request.query;\n _f = SIGNATURE_QUERY_PARAM;\n _g = this.getSignature;\n _h = [longDate,\n scope,\n this.getSigningKey(credentials, region, shortDate, signingService)];\n _j = this.createCanonicalRequest;\n _k = [request, canonicalHeaders];\n return [4 /*yield*/, getPayloadHash(originalRequest, this.sha256)];\n case 5: return [4 /*yield*/, _g.apply(this, _h.concat([_j.apply(this, _k.concat([_l.sent()]))]))];\n case 6:\n _e[_f] = _l.sent();\n return [2 /*return*/, request];\n }\n });\n });\n };\n SignatureV4.prototype.sign = function (toSign, options) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n if (typeof toSign === \"string\") {\n return [2 /*return*/, this.signString(toSign, options)];\n }\n else if (toSign.headers && toSign.payload) {\n return [2 /*return*/, this.signEvent(toSign, options)];\n }\n else {\n return [2 /*return*/, this.signRequest(toSign, options)];\n }\n return [2 /*return*/];\n });\n });\n };\n SignatureV4.prototype.signEvent = function (_a, _b) {\n var headers = _a.headers, payload = _a.payload;\n var _c = _b.signingDate, signingDate = _c === void 0 ? new Date() : _c, priorSignature = _b.priorSignature, signingRegion = _b.signingRegion, signingService = _b.signingService;\n return __awaiter(this, void 0, void 0, function () {\n var region, _d, _e, shortDate, longDate, scope, hashedPayload, hash, hashedHeaders, _f, stringToSign;\n return __generator(this, function (_g) {\n switch (_g.label) {\n case 0:\n if (!(signingRegion !== null && signingRegion !== void 0)) return [3 /*break*/, 1];\n _d = signingRegion;\n return [3 /*break*/, 3];\n case 1: return [4 /*yield*/, this.regionProvider()];\n case 2:\n _d = (_g.sent());\n _g.label = 3;\n case 3:\n region = _d;\n _e = formatDate(signingDate), shortDate = _e.shortDate, longDate = _e.longDate;\n scope = createScope(shortDate, region, signingService !== null && signingService !== void 0 ? signingService : this.service);\n return [4 /*yield*/, getPayloadHash({ headers: {}, body: payload }, this.sha256)];\n case 4:\n hashedPayload = _g.sent();\n hash = new this.sha256();\n hash.update(headers);\n _f = toHex;\n return [4 /*yield*/, hash.digest()];\n case 5:\n hashedHeaders = _f.apply(void 0, [_g.sent()]);\n stringToSign = [\n EVENT_ALGORITHM_IDENTIFIER,\n longDate,\n scope,\n priorSignature,\n hashedHeaders,\n hashedPayload,\n ].join(\"\\n\");\n return [2 /*return*/, this.signString(stringToSign, { signingDate: signingDate, signingRegion: region, signingService: signingService })];\n }\n });\n });\n };\n SignatureV4.prototype.signString = function (stringToSign, _a) {\n var _b = _a === void 0 ? {} : _a, _c = _b.signingDate, signingDate = _c === void 0 ? new Date() : _c, signingRegion = _b.signingRegion, signingService = _b.signingService;\n return __awaiter(this, void 0, void 0, function () {\n var credentials, region, _d, shortDate, hash, _e, _f, _g;\n return __generator(this, function (_h) {\n switch (_h.label) {\n case 0: return [4 /*yield*/, this.credentialProvider()];\n case 1:\n credentials = _h.sent();\n if (!(signingRegion !== null && signingRegion !== void 0)) return [3 /*break*/, 2];\n _d = signingRegion;\n return [3 /*break*/, 4];\n case 2: return [4 /*yield*/, this.regionProvider()];\n case 3:\n _d = (_h.sent());\n _h.label = 4;\n case 4:\n region = _d;\n shortDate = formatDate(signingDate).shortDate;\n _f = (_e = this.sha256).bind;\n return [4 /*yield*/, this.getSigningKey(credentials, region, shortDate, signingService)];\n case 5:\n hash = new (_f.apply(_e, [void 0, _h.sent()]))();\n hash.update(stringToSign);\n _g = toHex;\n return [4 /*yield*/, hash.digest()];\n case 6: return [2 /*return*/, _g.apply(void 0, [_h.sent()])];\n }\n });\n });\n };\n SignatureV4.prototype.signRequest = function (requestToSign, _a) {\n var _b = _a === void 0 ? {} : _a, _c = _b.signingDate, signingDate = _c === void 0 ? new Date() : _c, signableHeaders = _b.signableHeaders, unsignableHeaders = _b.unsignableHeaders, signingRegion = _b.signingRegion, signingService = _b.signingService;\n return __awaiter(this, void 0, void 0, function () {\n var credentials, region, _d, request, _e, longDate, shortDate, scope, payloadHash, canonicalHeaders, signature;\n return __generator(this, function (_f) {\n switch (_f.label) {\n case 0: return [4 /*yield*/, this.credentialProvider()];\n case 1:\n credentials = _f.sent();\n if (!(signingRegion !== null && signingRegion !== void 0)) return [3 /*break*/, 2];\n _d = signingRegion;\n return [3 /*break*/, 4];\n case 2: return [4 /*yield*/, this.regionProvider()];\n case 3:\n _d = (_f.sent());\n _f.label = 4;\n case 4:\n region = _d;\n request = prepareRequest(requestToSign);\n _e = formatDate(signingDate), longDate = _e.longDate, shortDate = _e.shortDate;\n scope = createScope(shortDate, region, signingService !== null && signingService !== void 0 ? signingService : this.service);\n request.headers[AMZ_DATE_HEADER] = longDate;\n if (credentials.sessionToken) {\n request.headers[TOKEN_HEADER] = credentials.sessionToken;\n }\n return [4 /*yield*/, getPayloadHash(request, this.sha256)];\n case 5:\n payloadHash = _f.sent();\n if (!hasHeader(SHA256_HEADER, request.headers) && this.applyChecksum) {\n request.headers[SHA256_HEADER] = payloadHash;\n }\n canonicalHeaders = getCanonicalHeaders(request, unsignableHeaders, signableHeaders);\n return [4 /*yield*/, this.getSignature(longDate, scope, this.getSigningKey(credentials, region, shortDate, signingService), this.createCanonicalRequest(request, canonicalHeaders, payloadHash))];\n case 6:\n signature = _f.sent();\n request.headers[AUTH_HEADER] =\n ALGORITHM_IDENTIFIER + \" \" +\n (\"Credential=\" + credentials.accessKeyId + \"/\" + scope + \", \") +\n (\"SignedHeaders=\" + getCanonicalHeaderList(canonicalHeaders) + \", \") +\n (\"Signature=\" + signature);\n return [2 /*return*/, request];\n }\n });\n });\n };\n SignatureV4.prototype.createCanonicalRequest = function (request, canonicalHeaders, payloadHash) {\n var sortedHeaders = Object.keys(canonicalHeaders).sort();\n return request.method + \"\\n\" + this.getCanonicalPath(request) + \"\\n\" + getCanonicalQuery(request) + \"\\n\" + sortedHeaders.map(function (name) { return name + \":\" + canonicalHeaders[name]; }).join(\"\\n\") + \"\\n\\n\" + sortedHeaders.join(\";\") + \"\\n\" + payloadHash;\n };\n SignatureV4.prototype.createStringToSign = function (longDate, credentialScope, canonicalRequest) {\n return __awaiter(this, void 0, void 0, function () {\n var hash, hashedRequest;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n hash = new this.sha256();\n hash.update(canonicalRequest);\n return [4 /*yield*/, hash.digest()];\n case 1:\n hashedRequest = _a.sent();\n return [2 /*return*/, ALGORITHM_IDENTIFIER + \"\\n\" + longDate + \"\\n\" + credentialScope + \"\\n\" + toHex(hashedRequest)];\n }\n });\n });\n };\n SignatureV4.prototype.getCanonicalPath = function (_a) {\n var path = _a.path;\n if (this.uriEscapePath) {\n var doubleEncoded = encodeURIComponent(path.replace(/^\\//, \"\"));\n return \"/\" + doubleEncoded.replace(/%2F/g, \"/\");\n }\n return path;\n };\n SignatureV4.prototype.getSignature = function (longDate, credentialScope, keyPromise, canonicalRequest) {\n return __awaiter(this, void 0, void 0, function () {\n var stringToSign, hash, _a, _b, _c;\n return __generator(this, function (_d) {\n switch (_d.label) {\n case 0: return [4 /*yield*/, this.createStringToSign(longDate, credentialScope, canonicalRequest)];\n case 1:\n stringToSign = _d.sent();\n _b = (_a = this.sha256).bind;\n return [4 /*yield*/, keyPromise];\n case 2:\n hash = new (_b.apply(_a, [void 0, _d.sent()]))();\n hash.update(stringToSign);\n _c = toHex;\n return [4 /*yield*/, hash.digest()];\n case 3: return [2 /*return*/, _c.apply(void 0, [_d.sent()])];\n }\n });\n });\n };\n SignatureV4.prototype.getSigningKey = function (credentials, region, shortDate, service) {\n return getSigningKey(this.sha256, credentials, shortDate, region, service || this.service);\n };\n return SignatureV4;\n}());\nexport { SignatureV4 };\nvar formatDate = function (now) {\n var longDate = iso8601(now).replace(/[\\-:]/g, \"\");\n return {\n longDate: longDate,\n shortDate: longDate.substr(0, 8),\n };\n};\nvar getCanonicalHeaderList = function (headers) { return Object.keys(headers).sort().join(\";\"); };\nvar normalizeRegionProvider = function (region) {\n if (typeof region === \"string\") {\n var promisified_1 = Promise.resolve(region);\n return function () { return promisified_1; };\n }\n else {\n return region;\n }\n};\nvar normalizeCredentialsProvider = function (credentials) {\n if (typeof credentials === \"object\") {\n var promisified_2 = Promise.resolve(credentials);\n return function () { return promisified_2; };\n }\n else {\n return credentials;\n }\n};\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiU2lnbmF0dXJlVjQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvU2lnbmF0dXJlVjQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQWlCQSxPQUFPLEVBQUUsS0FBSyxFQUFFLE1BQU0sNEJBQTRCLENBQUM7QUFFbkQsT0FBTyxFQUNMLG9CQUFvQixFQUNwQixxQkFBcUIsRUFDckIsZUFBZSxFQUNmLG9CQUFvQixFQUNwQixXQUFXLEVBQ1gsc0JBQXNCLEVBQ3RCLDBCQUEwQixFQUMxQixtQkFBbUIsRUFDbkIsaUJBQWlCLEVBQ2pCLGFBQWEsRUFDYixxQkFBcUIsRUFDckIsMEJBQTBCLEVBQzFCLFlBQVksRUFDWixpQkFBaUIsR0FDbEIsTUFBTSxhQUFhLENBQUM7QUFDckIsT0FBTyxFQUFFLFdBQVcsRUFBRSxhQUFhLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUNwRSxPQUFPLEVBQUUsbUJBQW1CLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUM1RCxPQUFPLEVBQUUsaUJBQWlCL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3JlZGVudGlhbHM7XG4gIH1cbn07XG4iXX0=","import { __assign, __values } from \"tslib\";\nimport { cloneRequest } from \"./cloneRequest\";\n/**\n * @internal\n */\nexport function moveHeadersToQuery(request, options) {\n var e_1, _a;\n var _b;\n if (options === void 0) { options = {}; }\n var _c = typeof request.clone === \"function\" ? request.clone() : cloneRequest(request), headers = _c.headers, _d = _c.query, query = _d === void 0 ? {} : _d;\n try {\n for (var _e = __values(Object.keys(headers)), _f = _e.next(); !_f.done; _f = _e.next()) {\n var name = _f.value;\n var lname = name.toLowerCase();\n if (lname.substr(0, 6) === \"x-amz-\" && !((_b = options.unhoistableHeaders) === null || _b === void 0 ? void 0 : _b.has(lname))) {\n query[name] = headers[name];\n delete headers[name];\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_f && !_f.done && (_a = _e.return)) _a.call(_e);\n }\n finally { if (e_1) throw e_1.error; }\n }\n return __assign(__assign({}, request), { headers: headers,\n query: query });\n}\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW92ZUhlYWRlcnNUb1F1ZXJ5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL21vdmVIZWFkZXJzVG9RdWVyeS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBRUEsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBRTlDOztHQUVHO0FBQ0gsTUFBTSxVQUFVLGtCQUFrQixDQUNoQyxPQUFvQixFQUNwQixPQUFrRDs7O0lBQWxELHdCQUFBLEVBQUEsWUFBa0Q7SUFFNUMsSUFBQSxLQUNKLE9BQVEsT0FBZSxDQUFDLEtBQUssS0FBSyxVQUFVLENBQUMsQ0FBQyxDQUFFLE9BQWUsQ0FBQyxLQUFLLEVBQUUsQ0FBQyxDQUFDLENBQUMsWUFBWSxDQUFDLE9BQU8sQ0FBQyxFQU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AmIHsgcXVlcnk6IFF1ZXJ5UGFyYW1ldGVyQmFnIH0ge1xuICBjb25zdCB7IGhlYWRlcnMsIHF1ZXJ5ID0ge30gYXMgUXVlcnlQYXJhbWV0ZXJCYWcgfSA9XG4gICAgdHlwZW9mIChyZXF1ZXN0IGFzIGFueSkuY2xvbmUgPT09IFwiZnVuY3Rpb25cIiA/IChyZXF1ZXN0IGFzIGFueSkuY2xvbmUoKSA6IGNsb25lUmVxdWVzdChyZXF1ZXN0KTtcbiAgZm9yIChjb25zdCBuYW1lIG9mIE9iamVjdC5rZXlzKGhlYWRlcnMpKSB7XG4gICAgY29uc3QgbG5hbWUgPSBuYW1lLnRvTG93ZXJDYXNlKCk7XG4gICAgaWYgKGxuYW1lLnN1YnN0cigwLCA2KSA9PT0gXCJ4LWFtei1cIiAmJiAhb3B0aW9ucy51bmhvaXN0YWJsZUhlYWRlcnM/LmhhcyhsbmFtZSkpIHtcbiAgICAgIHF1ZXJ5W25hbWVdID0gaGVhZGVyc1tuYW1lXTtcbiAgICAgIGRlbGV0ZSBoZWFkZXJzW25hbWVdO1xuICAgIH1cbiAgfVxuXG4gIHJldHVybiB7XG4gICAgLi4ucmVxdWVzdCxcbiAgICBoZWFkZXJzLFxuICAgIHF1ZXJ5LFxuICB9O1xufVxuIl19","import { __values } from \"tslib\";\nexport function hasHeader(soughtHeader, headers) {\n var e_1, _a;\n soughtHeader = soughtHeader.toLowerCase();\n try {\n for (var _b = __values(Object.keys(headers)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var headerName = _c.value;\n if (soughtHeader === headerName.toLowerCase()) {\n return true;\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n return false;\n}\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaGFzSGVhZGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2hhc0hlYWRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBRUEsTUFBTSxVQUFVLFNBQVMsQ0FBQyxZQUFvQixFQUFFLE9BQWtCOztJQUNoRSxZQUFZLEdBQUcsWUFBWSxDQUFDLFdBQVcsRUFBRSxDQUFDOztRQUMxQyxLQUF5QixJQUFBLEtBQUEsU0FBQSxNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxDQUFBLGdCQUFBLDRCQUFFO1lBQTFDLElBQU0sVUFBVSxXQUFBO1lBQ25CLElBQUksWUFBWSxLQUFLLFVBQVUsQ0FBQyxXQUFXLEVBQUUsRUFBRTtnQkFDN0MsT0FBTyxJQUFJLENBQUM7YUFDYjtTQUNGOzs7Ozs7Ozs7SUFFRCxPQUFPLEtBQUssQ0FBQztBQUNmLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBIZWFkZXJCYWcgfSBmcm9tIFwiQGF3cy1zZGsvdHlwZXNcIjtcblxuZXhwb3J0IGZ1bmN0aW9uIGhhc0hlYWRlcihzb3VnaHRIZWFkZXI6IHN0cmluZywgaGVhZGVyczogSGVhZGVyQmFnKTogYm9vbGVhbiB7XG4gIHNvdWdodEhlYWRlciA9IHNvdWdodEhlYWRlci50b0xvd2VyQ2FzZSgpO1xuICBmb3IgKGNvbnN0IGhlYWRlck5hbWUgb2YgT2JqZWN0LmtleXMoaGVhZGVycykpIHtcbiAgICBpZiAoc291Z2h0SGVhZGVyID09PSBoZWFkZXJOYW1lLnRvTG93ZXJDYXNlKCkpIHtcbiAgICAgIHJldHVybiB0cnVlO1xuICAgIH1cbiAgfVxuXG4gIHJldHVybiBmYWxzZTtcbn1cbiJdfQ==","import { __values } from \"tslib\";\nimport { escapeUri } from \"@aws-sdk/util-uri-escape\";\nimport { SIGNATURE_HEADER } from \"./constants\";\n/**\n * @internal\n */\nexport function getCanonicalQuery(_a) {\n var e_1, _b;\n var _c = _a.query, query = _c === void 0 ? {} : _c;\n var keys = [];\n var serialized = {};\n var _loop_1 = function (key) {\n if (key.toLowerCase() === SIGNATURE_HEADER) {\n return \"continue\";\n }\n keys.push(key);\n var value = query[key];\n if (typeof value === \"string\") {\n serialized[key] = escapeUri(key) + \"=\" + escapeUri(value);\n }\n else if (Array.isArray(value)) {\n serialized[key] = value\n .slice(0)\n .sort()\n .reduce(function (encoded, value) { return encoded.concat([escapeUri(key) + \"=\" + escapeUri(value)]); }, [])\n .join(\"&\");\n }\n };\n try {\n for (var _d = __values(Object.keys(query).sort()), _e = _d.next(); !_e.done; _e = _d.next()) {\n var key = _e.value;\n _loop_1(key);\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_e && !_e.done && (_b = _d.return)) _b.call(_d);\n }\n finally { if (e_1) throw e_1.error; }\n }\n return keys\n .map(function (key) { return serialized[key]; })\n .filter(function (serialized) { return serialized; }) // omit any falsy values\n .join(\"&\");\n}\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0Q2Fub25pY2FsUXVlcnkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZ2V0Q2Fub25pY2FsUXVlcnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUNBLE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQztBQUVyRCxPQUFPLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxhQUFhLENBQUM7QUFFL0M7O0dBRUc7QUFDSCxNQUFNLFVBQVUsaUJBQWlCLENBQUMsRUFBMkI7O1FBQXpCLGFBQVUsRUFBVixLQUFLLG1CQUFHLEVBQUUsS0FBQTtJQUM1QyxJQUFNLElBQUksR0FBa0IsRUFBRSxDQUFDO0lBQy9CLElBQU0sVUFBVSxHQUE4QixFQUFFLENBQUM7NEJBQ3RDL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JyYXkuaXNBcnJheSh2YWx1ZSkpIHtcbiAgICAgIHNlcmlhbGl6ZWRba2V5XSA9IHZhbHVlXG4gICAgICAgIC5zbGljZSgwKVxuICAgICAgICAuc29ydCgpXG4gICAgICAgIC5yZWR1Y2UoXG4gICAgICAgICAgKGVuY29kZWQ6IEFycmF5PHN0cmluZz4sIHZhbHVlOiBzdHJpbmcpID0+IGVuY29kZWQuY29uY2F0KFtgJHtlc2NhcGVVcmkoa2V5KX09JHtlc2NhcGVVcmkodmFsdWUpfWBdKSxcbiAgICAgICAgICBbXVxuICAgICAgICApXG4gICAgICAgIC5qb2luKFwiJlwiKTtcbiAgICB9XG4gIH1cblxuICByZXR1cm4ga2V5c1xuICAgIC5tYXAoKGtleSkgPT4gc2VyaWFsaXplZFtrZXldKVxuICAgIC5maWx0ZXIoKHNlcmlhbGl6ZWQpID0+IHNlcmlhbGl6ZWQpIC8vIG9taXQgYW55IGZhbHN5IHZhbHVlc1xuICAgIC5qb2luKFwiJlwiKTtcbn1cbiJdfQ==","import { __assign, __awaiter, __generator, __read } from \"tslib\";\nimport { SignatureV4 } from \"@aws-sdk/signature-v4\";\nexport function resolveAwsAuthConfig(input) {\n var _this = this;\n var credentials = input.credentials || input.credentialDefaultProvider(input);\n var normalizedCreds = normalizeProvider(credentials);\n var _a = input.signingEscapePath, signingEscapePath = _a === void 0 ? true : _a, _b = input.systemClockOffset, systemClockOffset = _b === void 0 ? input.systemClockOffset || 0 : _b, sha256 = input.sha256;\n var signer;\n if (input.signer) {\n //if signer is supplied by user, normalize it to a function returning a promise for signer.\n signer = normalizeProvider(input.signer);\n }\n else {\n //construct a provider inferring signing from region.\n signer = function () {\n return normalizeProvider(input.region)()\n .then(function (region) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, input.regionInfoProvider(region)];\n case 1: return [2 /*return*/, [(_a.sent()) || {}, region]];\n }\n }); }); })\n .then(function (_a) {\n var _b = __read(_a, 2), regionInfo = _b[0], region = _b[1];\n var signingRegion = regionInfo.signingRegion, signingService = regionInfo.signingService;\n //update client's singing region and signing service config if they are resolved.\n //signing region resolving order: user supplied signingRegion -> endpoints.json inferred region -> client region\n input.signingRegion = input.signingRegion || signingRegion || region;\n //signing name resolving order:\n //user supplied signingName -> endpoints.json inferred (credential scope -> model arnNamespace) -> model service id\n input.signingName = input.signingName || signingService || input.serviceId;\n return new SignatureV4({\n credentials: normalizedCreds,\n region: input.signingRegion,\n service: input.signingName,\n sha256: sha256,\n uriEscapePath: signingEscapePath,\n });\n });\n };\n }\n return __assign(__assign({}, input), { systemClockOffset: systemClockOffset,\n signingEscapePath: signingEscapePath, credentials: normalizedCreds, signer: signer });\n}\nfunction normalizeProvider(input) {\n if (typeof input === \"object\") {\n var promisified_1 = Promise.resolve(input);\n return function () { return promisified_1; };\n }\n return input;\n}\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlndXJhdGlvbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29uZmlndXJhdGlvbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQTRDcEQsTUFBTSxVQUFVLG9CQUFvQixDQUFJLEtBQWtEO0lBQTFGLGlCQXVDQztJQXRDQyxJQUFNLFdBQVcsR0FBRyxLQUFLLENBQUMsV0FBVyxJQUFJLEtBQUssQ0FBQyx5QkFBeUIsQ0FBQyxLQUFZLENBQUMsQ0FBQztJQUN2RixJQUFNLGVBQWUsR0FBRyxpQkFBaUIsQ0FBQyxXQUFXLENBQUMsQ0FBQztJQUMvQyxJQUFBLEtBQXVGLEtBQUssa0JBQXBFLEVBQXhCLGlCQUFpQixtQkFBRyxJQUFJLEtBQUEsRUFBRSxLQUE2RCxLQUFLLGtCQUFsQixFQUFoRCxpQk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W5nTmFtZSA9IGlucHV0LnNpZ25pbmdOYW1lIHx8IHNpZ25pbmdTZXJ2aWNlIHx8IGlucHV0LnNlcnZpY2VJZDtcblxuICAgICAgICAgIHJldHVybiBuZXcgU2lnbmF0dXJlVjQoe1xuICAgICAgICAgICAgY3JlZGVudGlhbHM6IG5vcm1hbGl6ZWRDcmVkcyxcbiAgICAgICAgICAgIHJlZ2lvbjogaW5wdXQuc2lnbmluZ1JlZ2lvbixcbiAgICAgICAgICAgIHNlcnZpY2U6IGlucHV0LnNpZ25pbmdOYW1lLFxuICAgICAgICAgICAgc2hhMjU2LFxuICAgICAgICAgICAgdXJpRXNjYXBlUGF0aDogc2lnbmluZ0VzY2FwZVBhdGgsXG4gICAgICAgICAgfSk7XG4gICAgICAgIH0pO1xuICB9XG5cbiAgcmV0dXJuIHtcbiAgICAuLi5pbnB1dCxcbiAgICBzeXN0ZW1DbG9ja09mZnNldCxcbiAgICBzaWduaW5nRXNjYXBlUGF0aCxcbiAgICBjcmVkZW50aWFsczogbm9ybWFsaXplZENyZWRzLFxuICAgIHNpZ25lcixcbiAgfTtcbn1cblxuZnVuY3Rpb24gbm9ybWFsaXplUHJvdmlkZXI8VD4oaW5wdXQ6IFQgfCBQcm92aWRlcjxUPik6IFByb3ZpZGVyPFQ+IHtcbiAgaWYgKHR5cGVvZiBpbnB1dCA9PT0gXCJvYmplY3RcIikge1xuICAgIGNvbnN0IHByb21pc2lmaWVkID0gUHJvbWlzZS5yZXNvbHZlKGlucHV0KTtcbiAgICByZXR1cm4gKCkgPT4gcHJvbWlzaWZpZWQ7XG4gIH1cbiAgcmV0dXJuIGlucHV0IGFzIFByb3ZpZGVyPFQ+O1xufVxuIl19","export var USER_AGENT = \"user-agent\";\nexport var X_AMZ_USER_AGENT = \"x-amz-user-agent\";\nexport var SPACE = \" \";\nexport var UA_ESCAPE_REGEX = /[^\\!\\#\\$\\%\\&\\'\\*\\+\\-\\.\\^\\_\\`\\|\\~\\d\\w]/g;\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbnN0YW50cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxNQUFNLENBQUMsSUFBTSxVQUFVLEdBQUcsWUFBWSxDQUFDO0FBRXZDLE1BQU0sQ0FBQyxJQUFNLGdCQUFnQixHQUFHLGtCQUFrQixDQUFDO0FBRW5ELE1BQU0sQ0FBQyxJQUFNLEtBQUssR0FBRyxHQUFHLENBQUM7QUFFekIsTUFBTSxDQUFDLElBQU0sZUFBZSxHQUFHLHdDQUF3QyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGNvbnN0IFVTRVJfQUdFTlQgPSBcInVzZXItYWdlbnRcIjtcblxuZXhwb3J0IGNvbnN0IFhfQU1aX1VTRVJfQUdFTlQgPSBcIngtYW16LXVzZXItYWdlbnRcIjtcblxuZXhwb3J0IGNvbnN0IFNQQUNFID0gXCIgXCI7XG5cbmV4cG9ydCBjb25zdCBVQV9FU0NBUEVfUkVHRVggPSAvW15cXCFcXCNcXCRcXCVcXCZcXCdcXCpcXCtcXC1cXC5cXF5cXF9cXGBcXHxcXH5cXGRcXHddL2c7XG4iXX0=","import { __assign, __awaiter, __generator, __read, __spread } from \"tslib\";\nimport { HttpRequest } from \"@aws-sdk/protocol-http\";\nimport { SPACE, UA_ESCAPE_REGEX, USER_AGENT, X_AMZ_USER_AGENT } from \"./constants\";\n/**\n * Build user agent header sections from:\n * 1. runtime-specific default user agent provider;\n * 2. custom user agent from `customUserAgent` client config;\n * 3. handler execution context set by internal SDK components;\n * The built user agent will be set to `x-amz-user-agent` header for ALL the\n * runtimes.\n * Please note that any override to the `user-agent` or `x-amz-user-agent` header\n * in the HTTP request is discouraged. Please use `customUserAgent` client\n * config or middleware setting the `userAgent` context to generate desired user\n * agent.\n */\nexport var userAgentMiddleware = function (options) { return function (next, context) { return function (args) { return __awaiter(void 0, void 0, void 0, function () {\n var request, headers, userAgent, defaultUserAgent, customUserAgent, normalUAValue;\n var _a, _b;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n request = args.request;\n if (!HttpRequest.isInstance(request))\n return [2 /*return*/, next(args)];\n headers = request.headers;\n userAgent = ((_a = context === null || context === void 0 ? void 0 : context.userAgent) === null || _a === void 0 ? void 0 : _a.map(escapeUserAgent)) || [];\n return [4 /*yield*/, options.defaultUserAgentProvider()];\n case 1:\n defaultUserAgent = (_c.sent()).map(escapeUserAgent);\n customUserAgent = ((_b = options === null || options === void 0 ? void 0 : options.customUserAgent) === null || _b === void 0 ? void 0 : _b.map(escapeUserAgent)) || [];\n // Set value to AWS-specific user agent header\n headers[X_AMZ_USER_AGENT] = __spread(defaultUserAgent, userAgent, customUserAgent).join(SPACE);\n normalUAValue = __spread(defaultUserAgent.filter(function (section) { return section.startsWith(\"aws-sdk-\"); }), customUserAgent).join(SPACE);\n if (options.runtime !== \"browser\" && normalUAValue) {\n headers[USER_AGENT] = headers[USER_AGENT] ? headers[USER_AGENT] + \" \" + normalUAValue : normalUAValue;\n }\n return [2 /*return*/, next(__assign(__assign({}, args), { request: request }))];\n }\n });\n}); }; }; };\n/**\n * Escape the each pair according to https://tools.ietf.org/html/rfc5234 and join the pair with pattern `name/version`.\n * User agent name may include prefix like `md/`, `api/`, `os/` etc., we should not escape the `/` after the prefix.\n * @private\n */\nvar escapeUserAgent = function (_a) {\n var _b = __read(_a, 2), name = _b[0], version = _b[1];\n var prefixSeparatorIndex = name.indexOf(\"/\");\n var prefix = name.substring(0, prefixSeparatorIndex); // If no prefix, prefix is just \"\"\n var uaName = name.substring(prefixSeparatorIndex + 1);\n if (prefix === \"api\") {\n uaName = uaName.toLowerCase();\n }\n return [prefix, uaName, version]\n .filter(function (item) { return item && item.length > 0; })\n .map(function (item) { return item === null || item === void 0 ? void 0 : item.replace(UA_ESCAPE_REGEX, \"_\"); })\n .join(\"/\");\n};\nexport var getUserAgentMiddlewareOptions = {\n name: \"getUserAgentMiddleware\",\n step: \"build\",\n priority: \"low\",\n tags: [\"SET_USER_AGENT\", \"USER_AGENT\"],\n override: true,\n};\nexport var getUserAgentPlugin = function (config) { return ({\n applyToStack: function (clientStack) {\n clientStack.add(userAgentMiddleware(config), getUserAgentMiddlewareOptions);\n },\n}); };\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlci1hZ2VudC1taWRkbGV3YXJlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3VzZXItYWdlbnQtbWlkZGxld2FyZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBY3JELE9BQU8sRUFBRSxLQUFLLEVBQUUsZUFBZSxFQUFFLFVBQVUsRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUVuRjs7Ozs7Ozs7Ozs7R0FXRztBQUNILE1BQU0sQ0FBQyxJQUFNLG1CQUFtQixHQUFHLFVBQUMsT0FBZ0MsSUFBSyxPQUFBLFVBQ3ZFLElBQTRCLEVBQzVCLE9BQWdDLElBQ0wsT0FBQSxVQUFPLElBQWdDOzs7Ozs7Z0JBQzFELE9BQU8sR0FBSyxJQUFJLFFBQVQsQ0FBVTtnQkFDekIsSUFBSSxDQUFDLFdBQVcsQ0FBQyxVQUFVLENBQUMsT0FBTyxDQUFDO29CQUFFLHNCQUFPLElBQUksQ0FBQyxJQUFJLENBQUMsRUFBQztnQkFDaEQsT0FBTyxHQUFLLE9BQU8sUUFBWixDQUFhO2dCQUN0QixTQUFTLEdBQUcsT0FBQSxPQUFPLGFBQVAsT0FBTyx1QkFBUCxPQUFPLENBQUUsU0FBUywwQ0FBRSxHQUFHLENBQUMsZUFBZSxNQUFLLEV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V9FU0NBUEVfUkVHRVgsIFwiX1wiKSlcbiAgICAuam9pbihcIi9cIik7XG59O1xuXG5leHBvcnQgY29uc3QgZ2V0VXNlckFnZW50TWlkZGxld2FyZU9wdGlvbnM6IEJ1aWxkSGFuZGxlck9wdGlvbnMgJiBBYnNvbHV0ZUxvY2F0aW9uID0ge1xuICBuYW1lOiBcImdldFVzZXJBZ2VudE1pZGRsZXdhcmVcIixcbiAgc3RlcDogXCJidWlsZFwiLFxuICBwcmlvcml0eTogXCJsb3dcIixcbiAgdGFnczogW1wiU0VUX1VTRVJfQUdFTlRcIiwgXCJVU0VSX0FHRU5UXCJdLFxuICBvdmVycmlkZTogdHJ1ZSxcbn07XG5cbmV4cG9ydCBjb25zdCBnZXRVc2VyQWdlbnRQbHVnaW4gPSAoY29uZmlnOiBVc2VyQWdlbnRSZXNvbHZlZENvbmZpZyk6IFBsdWdnYWJsZTxhbnksIGFueT4gPT4gKHtcbiAgYXBwbHlUb1N0YWNrOiAoY2xpZW50U3RhY2spID0+IHtcbiAgICBjbGllbnRTdGFjay5hZGQodXNlckFnZW50TWlkZGxld2FyZShjb25maWcpLCBnZXRVc2VyQWdlbnRNaWRkbGV3YXJlT3B0aW9ucyk7XG4gIH0sXG59KTtcbiJdfQ==","import { __assign, __extends } from \"tslib\";\nimport { ClientDefaultValues as __ClientDefaultValues } from \"./runtimeConfig\";\nimport { resolveEndpointsConfig, resolveRegionConfig, } from \"@aws-sdk/config-resolver\";\nimport { getContentLengthPlugin } from \"@aws-sdk/middleware-content-length\";\nimport { getHostHeaderPlugin, resolveHostHeaderConfig, } from \"@aws-sdk/middleware-host-header\";\nimport { getLoggerPlugin } from \"@aws-sdk/middleware-logger\";\nimport { getRetryPlugin, resolveRetryConfig } from \"@aws-sdk/middleware-retry\";\nimport { resolveAwsAuthConfig } from \"@aws-sdk/middleware-signing\";\nimport { getUserAgentPlugin, resolveUserAgentConfig, } from \"@aws-sdk/middleware-user-agent\";\nimport { Client as __Client, } from \"@aws-sdk/smithy-client\";\n/**\n * Amazon Cognito Federated Identities\n *

Amazon Cognito Federated Identities is a web service that delivers scoped temporary\n * credentials to mobile devices and other untrusted environments. It uniquely identifies a\n * device and supplies the user with a consistent identity over the lifetime of an\n * application.

\n *

Using Amazon Cognito Federated Identities, you can enable authentication with one or\n * more third-party identity providers (Facebook, Google, or Login with Amazon) or an Amazon\n * Cognito user pool, and you can also choose to support unauthenticated access from your app.\n * Cognito delivers a unique identifier for each user and acts as an OpenID token provider\n * trusted by AWS Security Token Service (STS) to access temporary, limited-privilege AWS\n * credentials.

\n *

For a description of the authentication flow from the Amazon Cognito Developer Guide\n * see Authentication Flow.

\n *

For more information see Amazon Cognito Federated Identities.

\n */\nvar CognitoIdentityClient = /** @class */ (function (_super) {\n __extends(CognitoIdentityClient, _super);\n function CognitoIdentityClient(configuration) {\n var _this = this;\n var _config_0 = __assign(__assign({}, __ClientDefaultValues), configuration);\n var _config_1 = resolveRegionConfig(_config_0);\n var _config_2 = resolveEndpointsConfig(_config_1);\n var _config_3 = resolveAwsAuthConfig(_config_2);\n var _config_4 = resolveRetryConfig(_config_3);\n var _config_5 = resolveHostHeaderConfig(_config_4);\n var _config_6 = resolveUserAgentConfig(_config_5);\n _this = _super.call(this, _config_6) || this;\n _this.config = _config_6;\n _this.middlewareStack.use(getRetryPlugin(_this.config));\n _this.middlewareStack.use(getContentLengthPlugin(_this.config));\n _this.middlewareStack.use(getHostHeaderPlugin(_this.config));\n _this.middlewareStack.use(getLoggerPlugin(_this.config));\n _this.middlewareStack.use(getUserAgentPlugin(_this.config));\n return _this;\n }\n CognitoIdentityClient.prototype.destroy = function () {\n _super.prototype.destroy.call(this);\n };\n return CognitoIdentityClient;\n}(__Client));\nexport { CognitoIdentityClient };\n//# sourceMappingURL=CognitoIdentityClient.js.map","import { __assign } from \"tslib\";\nexport function resolveUserAgentConfig(input) {\n return __assign(__assign({}, input), { customUserAgent: typeof input.customUserAgent === \"string\" ? [[input.customUserAgent]] : input.customUserAgent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50O1xuICBydW50aW1lOiBzdHJpbmc7XG59XG5leHBvcnQgZnVuY3Rpb24gcmVzb2x2ZVVzZXJBZ2VudENvbmZpZzxUPihcbiAgaW5wdXQ6IFQgJiBQcmV2aW91c2x5UmVzb2x2ZWQgJiBVc2VyQWdlbnRJbnB1dENvbmZpZ1xuKTogVCAmIFVzZXJBZ2VudFJlc29sdmVkQ29uZmlnIHtcbiAgcmV0dXJuIHtcbiAgICAuLi5pbnB1dCxcbiAgICBjdXN0b21Vc2VyQWdlbnQ6IHR5cGVvZiBpbnB1dC5jdXN0b21Vc2VyQWdlbnQgPT09IFwic3RyaW5nXCIgPyBbW2lucHV0LmN1c3RvbVVzZXJBZ2VudF1dIDogaW5wdXQuY3VzdG9tVXNlckFnZW50LFxuICB9O1xufVxuIl19","var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\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 __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nimport { ConsoleLogger as Logger } from './Logger';\nimport { StorageHelper } from './StorageHelper';\nimport { makeQuerablePromise } from './JS';\nimport { FacebookOAuth, GoogleOAuth } from './OAuthHelper';\nimport { jitteredExponentialRetry } from './Util';\nimport { getAmplifyUserAgent } from './Platform';\nimport { Amplify } from './Amplify';\nimport { fromCognitoIdentity, fromCognitoIdentityPool, } from '@aws-sdk/credential-provider-cognito-identity';\nimport { CognitoIdentityClient, GetIdCommand, GetCredentialsForIdentityCommand, } from '@aws-sdk/client-cognito-identity';\nvar logger = new Logger('Credentials');\nvar CREDENTIALS_TTL = 50 * 60 * 1000; // 50 min, can be modified on config if required in the future\nvar COGNITO_IDENTITY_KEY_PREFIX = 'CognitoIdentityId-';\nvar CredentialsClass = /** @class */ (function () {\n function CredentialsClass(config) {\n this._gettingCredPromise = null;\n this._refreshHandlers = {};\n // Allow `Auth` to be injected for SSR, but Auth isn't a required dependency for Credentials\n this.Auth = undefined;\n this.configure(config);\n this._refreshHandlers['google'] = GoogleOAuth.refreshGoogleToken;\n this._refreshHandlers['facebook'] = FacebookOAuth.refreshFacebookToken;\n }\n CredentialsClass.prototype.getModuleName = function () {\n return 'Credentials';\n };\n CredentialsClass.prototype.getCredSource = function () {\n return this._credentials_source;\n };\n CredentialsClass.prototype.configure = function (config) {\n if (!config)\n return this._config || {};\n this._config = Object.assign({}, this._config, config);\n var refreshHandlers = this._config.refreshHandlers;\n // If the developer has provided an object of refresh handlers,\n // then we can merge the provided handlers with the current handlers.\n if (refreshHandlers) {\n this._refreshHandlers = __assign(__assign({}, this._refreshHandlers), refreshHandlers);\n }\n this._storage = this._config.storage;\n if (!this._storage) {\n this._storage = new StorageHelper().getStorage();\n }\n this._storageSync = Promise.resolve();\n if (typeof this._storage['sync'] === 'function') {\n this._storageSync = this._storage['sync']();\n }\n return this._config;\n };\n CredentialsClass.prototype.get = function () {\n logger.debug('getting credentials');\n return this._pickupCredentials();\n };\n // currently we only store the guest identity in local storage\n CredentialsClass.prototype._getCognitoIdentityIdStorageKey = function (identityPoolId) {\n return \"\" + COGNITO_IDENTITY_KEY_PREFIX + identityPoolId;\n };\n CredentialsClass.prototype._pickupCredentials = function () {\n logger.debug('picking up credentials');\n if (!this._gettingCredPromise || !this._gettingCredPromise.isPending()) {\n logger.debug('getting new cred promise');\n this._gettingCredPromise = makeQuerablePromise(this._keepAlive());\n }\n else {\n logger.debug('getting old cred promise');\n }\n return this._gettingCredPromise;\n };\n CredentialsClass.prototype._keepAlive = function () {\n return __awaiter(this, void 0, void 0, function () {\n var cred, _a, Auth, user_1, session, refreshToken_1, refreshRequest, err_1;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n logger.debug('checking if credentials exists and not expired');\n cred = this._credentials;\n if (cred && !this._isExpired(cred) && !this._isPastTTL()) {\n logger.debug('credentials not changed and not expired, directly return');\n return [2 /*return*/, Promise.resolve(cred)];\n }\n logger.debug('need to get a new credential or refresh the existing one');\n _a = this.Auth, Auth = _a === void 0 ? Amplify.Auth : _a;\n if (!Auth || typeof Auth.currentUserCredentials !== 'function') {\n return [2 /*return*/, Promise.reject('No Auth module registered in Amplify')];\n }\n if (!(!this._isExpired(cred) && this._isPastTTL())) return [3 /*break*/, 6];\n logger.debug('ttl has passed but token is not yet expired');\n _b.label = 1;\n case 1:\n _b.trys.push([1, 5, , 6]);\n return [4 /*yield*/, Auth.currentUserPoolUser()];\n case 2:\n user_1 = _b.sent();\n return [4 /*yield*/, Auth.currentSession()];\n case 3:\n session = _b.sent();\n refreshToken_1 = session.refreshToken;\n refreshRequest = new Promise(function (res, rej) {\n user_1.refreshSession(refreshToken_1, function (err, data) {\n return err ? rej(err) : res(data);\n });\n });\n return [4 /*yield*/, refreshRequest];\n case 4:\n _b.sent(); // note that rejections will be caught and handled in the catch block.\n return [3 /*break*/, 6];\n case 5:\n err_1 = _b.sent();\n // should not throw because user might just be on guest access or is authenticated through federation\n logger.debug('Error attempting to refreshing the session', err_1);\n return [3 /*break*/, 6];\n case 6: return [2 /*return*/, Auth.currentUserCredentials()];\n }\n });\n });\n };\n CredentialsClass.prototype.refreshFederatedToken = function (federatedInfo) {\n logger.debug('Getting federated credentials');\n var provider = federatedInfo.provider, user = federatedInfo.user, token = federatedInfo.token, identity_id = federatedInfo.identity_id;\n var expires_at = federatedInfo.expires_at;\n // Make sure expires_at is in millis\n expires_at =\n new Date(expires_at).getFullYear() === 1970\n ? expires_at * 1000\n : expires_at;\n var that = this;\n logger.debug('checking if federated jwt token expired');\n if (expires_at > new Date().getTime()) {\n // if not expired\n logger.debug('token not expired');\n return this._setCredentialsFromFederation({\n provider: provider,\n token: token,\n user: user,\n identity_id: identity_id,\n expires_at: expires_at,\n });\n }\n else {\n // if refresh handler exists\n if (that._refreshHandlers[provider] &&\n typeof that._refreshHandlers[provider] === 'function') {\n logger.debug('getting refreshed jwt token from federation provider');\n return this._providerRefreshWithRetry({\n refreshHandler: that._refreshHandlers[provider],\n provider: provider,\n user: user,\n });\n }\n else {\n logger.debug('no refresh handler for provider:', provider);\n this.clear();\n return Promise.reject('no refresh handler for provider');\n }\n }\n };\n CredentialsClass.prototype._providerRefreshWithRetry = function (_a) {\n var _this = this;\n var refreshHandler = _a.refreshHandler, provider = _a.provider, user = _a.user;\n var MAX_DELAY_MS = 10 * 1000;\n // refreshHandler will retry network errors, otherwise it will\n // return NonRetryableError to break out of jitteredExponentialRetry\n return jitteredExponentialRetry(refreshHandler, [], MAX_DELAY_MS)\n .then(function (data) {\n logger.debug('refresh federated token sucessfully', data);\n return _this._setCredentialsFromFederation({\n provider: provider,\n token: data.token,\n user: user,\n identity_id: data.identity_id,\n expires_at: data.expires_at,\n });\n })\n .catch(function (e) {\n var isNetworkError = typeof e === 'string' &&\n e.toLowerCase().lastIndexOf('network error', e.length) === 0;\n if (!isNetworkError) {\n _this.clear();\n }\n logger.debug('refresh federated token failed', e);\n return Promise.reject('refreshing federation token failed: ' + e);\n });\n };\n CredentialsClass.prototype._isExpired = function (credentials) {\n if (!credentials) {\n logger.debug('no credentials for expiration check');\n return true;\n }\n logger.debug('are these credentials expired?', credentials);\n var ts = Date.now();\n /* returns date object.\n https://github.com/aws/aws-sdk-js-v3/blob/v1.0.0-beta.1/packages/types/src/credentials.ts#L26\n */\n var expiration = credentials.expiration;\n return expiration.getTime() <= ts;\n };\n CredentialsClass.prototype._isPastTTL = function () {\n return this._nextCredentialsRefresh <= Date.now();\n };\n CredentialsClass.prototype._setCredentialsForGuest = function () {\n return __awaiter(this, void 0, void 0, function () {\n var _a, identityPoolId, region, mandatorySignIn, identityId, _b, cognitoClient, credentials, cognitoIdentityParams, credentialsProvider;\n var _this = this;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n logger.debug('setting credentials for guest');\n _a = this._config, identityPoolId = _a.identityPoolId, region = _a.region, mandatorySignIn = _a.mandatorySignIn;\n if (mandatorySignIn) {\n return [2 /*return*/, Promise.reject('cannot get guest credentials when mandatory signin enabled')];\n }\n if (!identityPoolId) {\n logger.debug('No Cognito Identity pool provided for unauthenticated access');\n return [2 /*return*/, Promise.reject('No Cognito Identity pool provided for unauthenticated access')];\n }\n if (!region) {\n logger.debug('region is not configured for getting the credentials');\n return [2 /*return*/, Promise.reject('region is not configured for getting the credentials')];\n }\n _b = this;\n return [4 /*yield*/, this._getGuestIdentityId()];\n case 1:\n identityId = _b._identityId = _c.sent();\n cognitoClient = new CognitoIdentityClient({\n region: region,\n customUserAgent: getAmplifyUserAgent(),\n });\n credentials = undefined;\n if (identityId) {\n cognitoIdentityParams = {\n identityId: identityId,\n client: cognitoClient,\n };\n credentials = fromCognitoIdentity(cognitoIdentityParams)();\n }\n else {\n credentialsProvider = function () { return __awaiter(_this, void 0, void 0, function () {\n var IdentityId, cognitoIdentityParams, credentialsFromCognitoIdentity;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, cognitoClient.send(new GetIdCommand({\n IdentityPoolId: identityPoolId,\n }))];\n case 1:\n IdentityId = (_a.sent()).IdentityId;\n this._identityId = IdentityId;\n cognitoIdentityParams = {\n client: cognitoClient,\n identityId: IdentityId,\n };\n credentialsFromCognitoIdentity = fromCognitoIdentity(cognitoIdentityParams);\n return [2 /*return*/, credentialsFromCognitoIdentity()];\n }\n });\n }); };\n credentials = credentialsProvider().catch(function (err) { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n throw err;\n });\n }); });\n }\n return [2 /*return*/, this._loadCredentials(credentials, 'guest', false, null)\n .then(function (res) {\n return res;\n })\n .catch(function (e) { return __awaiter(_this, void 0, void 0, function () {\n var credentialsProvider;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!(e.name === 'ResourceNotFoundException' &&\n e.message === \"Identity '\" + identityId + \"' not found.\")) return [3 /*break*/, 2];\n logger.debug('Failed to load guest credentials');\n return [4 /*yield*/, this._removeGuestIdentityId()];\n case 1:\n _a.sent();\n credentialsProvider = function () { return __awaiter(_this, void 0, void 0, function () {\n var IdentityId, cognitoIdentityParams, credentialsFromCognitoIdentity;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, cognitoClient.send(new GetIdCommand({\n IdentityPoolId: identityPoolId,\n }))];\n case 1:\n IdentityId = (_a.sent()).IdentityId;\n this._identityId = IdentityId;\n cognitoIdentityParams = {\n client: cognitoClient,\n identityId: IdentityId,\n };\n credentialsFromCognitoIdentity = fromCognitoIdentity(cognitoIdentityParams);\n return [2 /*return*/, credentialsFromCognitoIdentity()];\n }\n });\n }); };\n credentials = credentialsProvider().catch(function (err) { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n throw err;\n });\n }); });\n return [2 /*return*/, this._loadCredentials(credentials, 'guest', false, null)];\n case 2: return [2 /*return*/, e];\n }\n });\n }); })];\n }\n });\n });\n };\n CredentialsClass.prototype._setCredentialsFromFederation = function (params) {\n var provider = params.provider, token = params.token, identity_id = params.identity_id;\n var domains = {\n google: 'accounts.google.com',\n facebook: 'graph.facebook.com',\n amazon: 'www.amazon.com',\n developer: 'cognito-identity.amazonaws.com',\n };\n // Use custom provider url instead of the predefined ones\n var domain = domains[provider] || provider;\n if (!domain) {\n return Promise.reject('You must specify a federated provider');\n }\n var logins = {};\n logins[domain] = token;\n var _a = this._config, identityPoolId = _a.identityPoolId, region = _a.region;\n if (!identityPoolId) {\n logger.debug('No Cognito Federated Identity pool provided');\n return Promise.reject('No Cognito Federated Identity pool provided');\n }\n if (!region) {\n logger.debug('region is not configured for getting the credentials');\n return Promise.reject('region is not configured for getting the credentials');\n }\n var cognitoClient = new CognitoIdentityClient({\n region: region,\n customUserAgent: getAmplifyUserAgent(),\n });\n var credentials = undefined;\n if (identity_id) {\n var cognitoIdentityParams = {\n identityId: identity_id,\n logins: logins,\n client: cognitoClient,\n };\n credentials = fromCognitoIdentity(cognitoIdentityParams)();\n }\n else {\n var cognitoIdentityParams = {\n logins: logins,\n identityPoolId: identityPoolId,\n client: cognitoClient,\n };\n credentials = fromCognitoIdentityPool(cognitoIdentityParams)();\n }\n return this._loadCredentials(credentials, 'federated', true, params);\n };\n CredentialsClass.prototype._setCredentialsFromSession = function (session) {\n var _this = this;\n logger.debug('set credentials from session');\n var idToken = session.getIdToken().getJwtToken();\n var _a = this._config, region = _a.region, userPoolId = _a.userPoolId, identityPoolId = _a.identityPoolId;\n if (!identityPoolId) {\n logger.debug('No Cognito Federated Identity pool provided');\n return Promise.reject('No Cognito Federated Identity pool provided');\n }\n if (!region) {\n logger.debug('region is not configured for getting the credentials');\n return Promise.reject('region is not configured for getting the credentials');\n }\n var key = 'cognito-idp.' + region + '.amazonaws.com/' + userPoolId;\n var logins = {};\n logins[key] = idToken;\n var cognitoClient = new CognitoIdentityClient({\n region: region,\n customUserAgent: getAmplifyUserAgent(),\n });\n /*\n Retreiving identityId with GetIdCommand to mimic the behavior in the following code in aws-sdk-v3:\n https://git.io/JeDxU\n\n Note: Retreive identityId from CredentialsProvider once aws-sdk-js v3 supports this.\n */\n var credentialsProvider = function () { return __awaiter(_this, void 0, void 0, function () {\n var guestIdentityId, generatedOrRetrievedIdentityId, IdentityId, _a, _b, AccessKeyId, Expiration, SecretKey, SessionToken, primaryIdentityId;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0: return [4 /*yield*/, this._getGuestIdentityId()];\n case 1:\n guestIdentityId = _c.sent();\n if (!!guestIdentityId) return [3 /*break*/, 3];\n return [4 /*yield*/, cognitoClient.send(new GetIdCommand({\n IdentityPoolId: identityPoolId,\n Logins: logins,\n }))];\n case 2:\n IdentityId = (_c.sent()).IdentityId;\n generatedOrRetrievedIdentityId = IdentityId;\n _c.label = 3;\n case 3: return [4 /*yield*/, cognitoClient.send(new GetCredentialsForIdentityCommand({\n IdentityId: guestIdentityId || generatedOrRetrievedIdentityId,\n Logins: logins,\n }))];\n case 4:\n _a = _c.sent(), _b = _a.Credentials, AccessKeyId = _b.AccessKeyId, Expiration = _b.Expiration, SecretKey = _b.SecretKey, SessionToken = _b.SessionToken, primaryIdentityId = _a.IdentityId;\n this._identityId = primaryIdentityId;\n if (!guestIdentityId) return [3 /*break*/, 6];\n // if guestIdentity is found and used by GetCredentialsForIdentity\n // it will be linked to the logins provided, and disqualified as an unauth identity\n logger.debug(\"The guest identity \" + guestIdentityId + \" has been successfully linked to the logins\");\n if (guestIdentityId === primaryIdentityId) {\n logger.debug(\"The guest identity \" + guestIdentityId + \" has become the primary identity\");\n }\n // remove it from local storage to avoid being used as a guest Identity by _setCredentialsForGuest\n return [4 /*yield*/, this._removeGuestIdentityId()];\n case 5:\n // remove it from local storage to avoid being used as a guest Identity by _setCredentialsForGuest\n _c.sent();\n _c.label = 6;\n case 6: \n // https://github.com/aws/aws-sdk-js-v3/blob/main/packages/credential-provider-cognito-identity/src/fromCognitoIdentity.ts#L40\n return [2 /*return*/, {\n accessKeyId: AccessKeyId,\n secretAccessKey: SecretKey,\n sessionToken: SessionToken,\n expiration: Expiration,\n identityId: primaryIdentityId,\n }];\n }\n });\n }); };\n var credentials = credentialsProvider().catch(function (err) { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n throw err;\n });\n }); });\n return this._loadCredentials(credentials, 'userPool', true, null);\n };\n CredentialsClass.prototype._loadCredentials = function (credentials, source, authenticated, info) {\n var _this = this;\n var that = this;\n return new Promise(function (res, rej) {\n credentials\n .then(function (credentials) { return __awaiter(_this, void 0, void 0, function () {\n var user, provider, token, expires_at, identity_id;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n logger.debug('Load credentials successfully', credentials);\n if (this._identityId && !credentials.identityId) {\n credentials['identityId'] = this._identityId;\n }\n that._credentials = credentials;\n that._credentials.authenticated = authenticated;\n that._credentials_source = source;\n that._nextCredentialsRefresh = new Date().getTime() + CREDENTIALS_TTL;\n if (source === 'federated') {\n user = Object.assign({ id: this._credentials.identityId }, info.user);\n provider = info.provider, token = info.token, expires_at = info.expires_at, identity_id = info.identity_id;\n try {\n this._storage.setItem('aws-amplify-federatedInfo', JSON.stringify({\n provider: provider,\n token: token,\n user: user,\n expires_at: expires_at,\n identity_id: identity_id,\n }));\n }\n catch (e) {\n logger.debug('Failed to put federated info into auth storage', e);\n }\n }\n if (!(source === 'guest')) return [3 /*break*/, 2];\n return [4 /*yield*/, this._setGuestIdentityId(credentials.identityId)];\n case 1:\n _a.sent();\n _a.label = 2;\n case 2:\n res(that._credentials);\n return [2 /*return*/];\n }\n });\n }); })\n .catch(function (err) {\n if (err) {\n logger.debug('Failed to load credentials', credentials);\n logger.debug('Error loading credentials', err);\n rej(err);\n return;\n }\n });\n });\n };\n CredentialsClass.prototype.set = function (params, source) {\n if (source === 'session') {\n return this._setCredentialsFromSession(params);\n }\n else if (source === 'federation') {\n return this._setCredentialsFromFederation(params);\n }\n else if (source === 'guest') {\n return this._setCredentialsForGuest();\n }\n else {\n logger.debug('no source specified for setting credentials');\n return Promise.reject('invalid source');\n }\n };\n CredentialsClass.prototype.clear = function () {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n this._credentials = null;\n this._credentials_source = null;\n logger.debug('removing aws-amplify-federatedInfo from storage');\n this._storage.removeItem('aws-amplify-federatedInfo');\n return [2 /*return*/];\n });\n });\n };\n /* operations on local stored guest identity */\n CredentialsClass.prototype._getGuestIdentityId = function () {\n return __awaiter(this, void 0, void 0, function () {\n var identityPoolId, e_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n identityPoolId = this._config.identityPoolId;\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, this._storageSync];\n case 2:\n _a.sent();\n return [2 /*return*/, this._storage.getItem(this._getCognitoIdentityIdStorageKey(identityPoolId))];\n case 3:\n e_1 = _a.sent();\n logger.debug('Failed to get the cached guest identityId', e_1);\n return [3 /*break*/, 4];\n case 4: return [2 /*return*/];\n }\n });\n });\n };\n CredentialsClass.prototype._setGuestIdentityId = function (identityId) {\n return __awaiter(this, void 0, void 0, function () {\n var identityPoolId, e_2;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n identityPoolId = this._config.identityPoolId;\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, this._storageSync];\n case 2:\n _a.sent();\n this._storage.setItem(this._getCognitoIdentityIdStorageKey(identityPoolId), identityId);\n return [3 /*break*/, 4];\n case 3:\n e_2 = _a.sent();\n logger.debug('Failed to cache guest identityId', e_2);\n return [3 /*break*/, 4];\n case 4: return [2 /*return*/];\n }\n });\n });\n };\n CredentialsClass.prototype._removeGuestIdentityId = function () {\n return __awaiter(this, void 0, void 0, function () {\n var identityPoolId;\n return __generator(this, function (_a) {\n identityPoolId = this._config.identityPoolId;\n logger.debug(\"removing \" + this._getCognitoIdentityIdStorageKey(identityPoolId) + \" from storage\");\n this._storage.removeItem(this._getCognitoIdentityIdStorageKey(identityPoolId));\n return [2 /*return*/];\n });\n });\n };\n /**\n * Compact version of credentials\n * @param {Object} credentials\n * @return {Object} - Credentials\n */\n CredentialsClass.prototype.shear = function (credentials) {\n return {\n accessKeyId: credentials.accessKeyId,\n sessionToken: credentials.sessionToken,\n secretAccessKey: credentials.secretAccessKey,\n identityId: credentials.identityId,\n authenticated: credentials.authenticated,\n };\n };\n return CredentialsClass;\n}());\nexport { CredentialsClass };\nexport var Credentials = new CredentialsClass(null);\nAmplify.register(Credentials);\n/**\n * @deprecated use named import\n */\nexport default Credentials;\n//# sourceMappingURL=Credentials.js.map","var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nimport { ConsoleLogger as Logger } from './Logger';\nvar logger = new Logger('Parser');\nexport var parseMobileHubConfig = function (config) {\n var amplifyConfig = {};\n // Analytics\n if (config['aws_mobile_analytics_app_id']) {\n var Analytics = {\n AWSPinpoint: {\n appId: config['aws_mobile_analytics_app_id'],\n region: config['aws_mobile_analytics_app_region'],\n },\n };\n amplifyConfig.Analytics = Analytics;\n }\n // Auth\n if (config['aws_cognito_identity_pool_id'] || config['aws_user_pools_id']) {\n amplifyConfig.Auth = {\n userPoolId: config['aws_user_pools_id'],\n userPoolWebClientId: config['aws_user_pools_web_client_id'],\n region: config['aws_cognito_region'],\n identityPoolId: config['aws_cognito_identity_pool_id'],\n identityPoolRegion: config['aws_cognito_region'],\n mandatorySignIn: config['aws_mandatory_sign_in'] === 'enable',\n };\n }\n // Storage\n var storageConfig;\n if (config['aws_user_files_s3_bucket']) {\n storageConfig = {\n AWSS3: {\n bucket: config['aws_user_files_s3_bucket'],\n region: config['aws_user_files_s3_bucket_region'],\n dangerouslyConnectToHttpEndpointForTesting: config['aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing'],\n },\n };\n }\n else {\n storageConfig = config ? config.Storage || config : {};\n }\n // Logging\n if (config['Logging']) {\n amplifyConfig.Logging = __assign(__assign({}, config['Logging']), { region: config['aws_project_region'] });\n }\n // Geo\n if (config['geo']) {\n amplifyConfig.Geo = Object.assign({}, config.geo);\n if (config.geo['amazon_location_service']) {\n amplifyConfig.Geo = {\n AmazonLocationService: config.geo['amazon_location_service'],\n };\n }\n }\n amplifyConfig.Analytics = Object.assign({}, amplifyConfig.Analytics, config.Analytics);\n amplifyConfig.Auth = Object.assign({}, amplifyConfig.Auth, config.Auth);\n amplifyConfig.Storage = Object.assign({}, storageConfig);\n amplifyConfig.Logging = Object.assign({}, amplifyConfig.Logging, config.Logging);\n logger.debug('parse config', config, 'to amplifyconfig', amplifyConfig);\n return amplifyConfig;\n};\n/**\n * @deprecated use per-function export\n */\nvar Parser = /** @class */ (function () {\n function Parser() {\n }\n Parser.parseMobilehubConfig = parseMobileHubConfig;\n return Parser;\n}());\nexport { Parser };\n/**\n * @deprecated use per-function export\n */\nexport default Parser;\n//# sourceMappingURL=Parser.js.map","import * as cookie from 'cookie';\r\nexport function hasDocumentCookie() {\r\n // Can we get/set cookies on document.cookie?\r\n return typeof document === 'object' && typeof document.cookie === 'string';\r\n}\r\nexport function cleanCookies() {\r\n document.cookie.split(';').forEach(function (c) {\r\n document.cookie = c\r\n .replace(/^ +/, '')\r\n .replace(/=.*/, '=;expires=' + new Date().toUTCString() + ';path=/');\r\n });\r\n}\r\nexport function parseCookies(cookies, options) {\r\n if (typeof cookies === 'string') {\r\n return cookie.parse(cookies, options);\r\n }\r\n else if (typeof cookies === 'object' && cookies !== null) {\r\n return cookies;\r\n }\r\n else {\r\n return {};\r\n }\r\n}\r\nexport function isParsingCookie(value, doNotParse) {\r\n if (typeof doNotParse === 'undefined') {\r\n // We guess if the cookie start with { or [, it has been serialized\r\n doNotParse =\r\n !value || (value[0] !== '{' && value[0] !== '[' && value[0] !== '\"');\r\n }\r\n return !doNotParse;\r\n}\r\nexport function readCookie(value, options) {\r\n if (options === void 0) { options = {}; }\r\n var cleanValue = cleanupCookieValue(value);\r\n if (isParsingCookie(cleanValue, options.doNotParse)) {\r\n try {\r\n return JSON.parse(cleanValue);\r\n }\r\n catch (e) {\r\n // At least we tried\r\n }\r\n }\r\n // Ignore clean value if we failed the deserialization\r\n // It is not relevant anymore to trim those values\r\n return value;\r\n}\r\nfunction cleanupCookieValue(value) {\r\n // express prepend j: before serializing a cookie\r\n if (value && value[0] === 'j' && value[1] === ':') {\r\n return value.substr(2);\r\n }\r\n return value;\r\n}\r\n","var __assign = (this && this.__assign) || function () {\r\n __assign = Object.assign || function(t) {\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) if (Object.prototype.hasOwnProperty.call(s, p))\r\n t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return __assign.apply(this, arguments);\r\n};\r\nimport * as cookie from 'cookie';\r\nimport { hasDocumentCookie, parseCookies, readCookie } from './utils';\r\nvar Cookies = /** @class */ (function () {\r\n function Cookies(cookies, options) {\r\n var _this = this;\r\n this.changeListeners = [];\r\n this.HAS_DOCUMENT_COOKIE = false;\r\n this.cookies = parseCookies(cookies, options);\r\n new Promise(function () {\r\n _this.HAS_DOCUMENT_COOKIE = hasDocumentCookie();\r\n }).catch(function () { });\r\n }\r\n Cookies.prototype._updateBrowserValues = function (parseOptions) {\r\n if (!this.HAS_DOCUMENT_COOKIE) {\r\n return;\r\n }\r\n this.cookies = cookie.parse(document.cookie, parseOptions);\r\n };\r\n Cookies.prototype._emitChange = function (params) {\r\n for (var i = 0; i < this.changeListeners.length; ++i) {\r\n this.changeListeners[i](params);\r\n }\r\n };\r\n Cookies.prototype.get = function (name, options, parseOptions) {\r\n if (options === void 0) { options = {}; }\r\n this._updateBrowserValues(parseOptions);\r\n return readCookie(this.cookies[name], options);\r\n };\r\n Cookies.prototype.getAll = function (options, parseOptions) {\r\n if (options === void 0) { options = {}; }\r\n this._updateBrowserValues(parseOptions);\r\n var result = {};\r\n for (var name_1 in this.cookies) {\r\n result[name_1] = readCookie(this.cookies[name_1], options);\r\n }\r\n return result;\r\n };\r\n Cookies.prototype.set = function (name, value, options) {\r\n var _a;\r\n if (typeof value === 'object') {\r\n value = JSON.stringify(value);\r\n }\r\n this.cookies = __assign(__assign({}, this.cookies), (_a = {}, _a[name] = value, _a));\r\n if (this.HAS_DOCUMENT_COOKIE) {\r\n document.cookie = cookie.serialize(name, value, options);\r\n }\r\n this._emitChange({ name: name, value: value, options: options });\r\n };\r\n Cookies.prototype.remove = function (name, options) {\r\n var finalOptions = (options = __assign(__assign({}, options), { expires: new Date(1970, 1, 1, 0, 0, 1), maxAge: 0 }));\r\n this.cookies = __assign({}, this.cookies);\r\n delete this.cookies[name];\r\n if (this.HAS_DOCUMENT_COOKIE) {\r\n document.cookie = cookie.serialize(name, '', finalOptions);\r\n }\r\n this._emitChange({ name: name, value: undefined, options: options });\r\n };\r\n Cookies.prototype.addChangeListener = function (callback) {\r\n this.changeListeners.push(callback);\r\n };\r\n Cookies.prototype.removeChangeListener = function (callback) {\r\n var idx = this.changeListeners.indexOf(callback);\r\n if (idx >= 0) {\r\n this.changeListeners.splice(idx, 1);\r\n }\r\n };\r\n return Cookies;\r\n}());\r\nexport default Cookies;\r\n","import Cookies from './Cookies';\r\nexport default Cookies;\r\n","import Cookies from 'universal-cookie';\nimport { browserOrNode } from '../JS';\nvar isBrowser = browserOrNode().isBrowser;\nvar UniversalStorage = /** @class */ (function () {\n function UniversalStorage(context) {\n if (context === void 0) { context = {}; }\n this.cookies = new Cookies();\n this.store = isBrowser ? window.localStorage : Object.create(null);\n this.cookies = context.req\n ? new Cookies(context.req.headers.cookie)\n : new Cookies();\n Object.assign(this.store, this.cookies.getAll());\n }\n Object.defineProperty(UniversalStorage.prototype, \"length\", {\n get: function () {\n return Object.entries(this.store).length;\n },\n enumerable: true,\n configurable: true\n });\n UniversalStorage.prototype.clear = function () {\n var _this = this;\n Array.from(new Array(this.length))\n .map(function (_, i) { return _this.key(i); })\n .forEach(function (key) { return _this.removeItem(key); });\n };\n UniversalStorage.prototype.getItem = function (key) {\n return this.getLocalItem(key);\n };\n UniversalStorage.prototype.getLocalItem = function (key) {\n return Object.prototype.hasOwnProperty.call(this.store, key)\n ? this.store[key]\n : null;\n };\n UniversalStorage.prototype.getUniversalItem = function (key) {\n return this.cookies.get(key);\n };\n UniversalStorage.prototype.key = function (index) {\n return Object.keys(this.store)[index];\n };\n UniversalStorage.prototype.removeItem = function (key) {\n this.removeLocalItem(key);\n this.removeUniversalItem(key);\n };\n UniversalStorage.prototype.removeLocalItem = function (key) {\n delete this.store[key];\n };\n UniversalStorage.prototype.removeUniversalItem = function (key) {\n this.cookies.remove(key, {\n path: '/',\n });\n };\n UniversalStorage.prototype.setItem = function (key, value) {\n this.setLocalItem(key, value);\n // keys take the shape:\n // 1. `${ProviderPrefix}.${userPoolClientId}.${username}.${tokenType}\n // 2. `${ProviderPrefix}.${userPoolClientId}.LastAuthUser\n var tokenType = key.split('.').pop();\n switch (tokenType) {\n // LastAuthUser is needed for computing other key names\n case 'LastAuthUser':\n // accessToken is required for CognitoUserSession\n case 'accessToken':\n // refreshToken originates on the client, but SSR pages won't fail when this expires\n // Note: the new `accessToken` will also be refreshed on the client (since Amplify doesn't set server-side cookies)\n case 'refreshToken':\n // Required for CognitoUserSession\n case 'idToken':\n isBrowser\n ? this.setUniversalItem(key, value)\n : this.setLocalItem(key, value);\n // userData is used when `Auth.currentAuthenticatedUser({ bypassCache: false })`.\n // Can be persisted to speed up calls to `Auth.currentAuthenticatedUser()`\n // case 'userData':\n // Ignoring clockDrift on the server for now, but needs testing\n // case 'clockDrift':\n }\n };\n UniversalStorage.prototype.setLocalItem = function (key, value) {\n this.store[key] = value;\n };\n UniversalStorage.prototype.setUniversalItem = function (key, value) {\n this.cookies.set(key, value, {\n path: '/',\n // `httpOnly` cannot be set via JavaScript: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#JavaScript_access_using_Document.cookie\n sameSite: true,\n // Allow unsecure requests to http://localhost:3000/ when in development.\n secure: window.location.hostname === 'localhost' ? false : true,\n });\n };\n return UniversalStorage;\n}());\nexport { UniversalStorage };\n//# sourceMappingURL=index.js.map","/*!\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/** @class */\nvar AuthenticationDetails = /*#__PURE__*/function () {\n /**\n * Constructs a new AuthenticationDetails object\n * @param {object=} data Creation options.\n * @param {string} data.Username User being authenticated.\n * @param {string} data.Password Plain-text password to authenticate with.\n * @param {(AttributeArg[])?} data.ValidationData Application extra metadata.\n * @param {(AttributeArg[])?} data.AuthParamaters Authentication paramaters for custom auth.\n */\n function AuthenticationDetails(data) {\n var _ref = data || {},\n ValidationData = _ref.ValidationData,\n Username = _ref.Username,\n Password = _ref.Password,\n AuthParameters = _ref.AuthParameters,\n ClientMetadata = _ref.ClientMetadata;\n\n this.validationData = ValidationData || {};\n this.authParameters = AuthParameters || {};\n this.clientMetadata = ClientMetadata || {};\n this.username = Username;\n this.password = Password;\n }\n /**\n * @returns {string} the record's username\n */\n\n\n var _proto = AuthenticationDetails.prototype;\n\n _proto.getUsername = function getUsername() {\n return this.username;\n }\n /**\n * @returns {string} the record's password\n */\n ;\n\n _proto.getPassword = function getPassword() {\n return this.password;\n }\n /**\n * @returns {Array} the record's validationData\n */\n ;\n\n _proto.getValidationData = function getValidationData() {\n return this.validationData;\n }\n /**\n * @returns {Array} the record's authParameters\n */\n ;\n\n _proto.getAuthParameters = function getAuthParameters() {\n return this.authParameters;\n }\n /**\n * @returns {ClientMetadata} the clientMetadata for a Lambda trigger\n */\n ;\n\n _proto.getClientMetadata = function getClientMetadata() {\n return this.clientMetadata;\n };\n\n return AuthenticationDetails;\n}();\n\nexport { AuthenticationDetails as default };","var crypto; // Native crypto from window (Browser)\n\nif (typeof window !== 'undefined' && window.crypto) {\n crypto = window.crypto;\n} // Native (experimental IE 11) crypto from window (Browser)\n\n\nif (!crypto && typeof window !== 'undefined' && window.msCrypto) {\n crypto = window.msCrypto;\n} // Native crypto from global (NodeJS)\n\n\nif (!crypto && typeof global !== 'undefined' && global.crypto) {\n crypto = global.crypto;\n} // Native crypto import via require (NodeJS)\n\n\nif (!crypto && typeof require === 'function') {\n try {\n crypto = require('crypto');\n } catch (err) {}\n}\n/*\n * Cryptographically secure pseudorandom number generator\n * As Math.random() is cryptographically not safe to use\n */\n\n\nexport default function cryptoSecureRandomInt() {\n if (crypto) {\n // Use getRandomValues method (Browser)\n if (typeof crypto.getRandomValues === 'function') {\n try {\n return crypto.getRandomValues(new Uint32Array(1))[0];\n } catch (err) {}\n } // Use randomBytes method (NodeJS)\n\n\n if (typeof crypto.randomBytes === 'function') {\n try {\n return crypto.randomBytes(4).readInt32LE();\n } catch (err) {}\n }\n }\n\n throw new Error('Native crypto module could not be used to get secure random number.');\n}","import cryptoSecureRandomInt from './cryptoSecureRandomInt';\n/**\n * Hex encoding strategy.\n * Converts a word array to a hex string.\n * @param {WordArray} wordArray The word array.\n * @return {string} The hex string.\n * @static\n */\n\nfunction hexStringify(wordArray) {\n // Shortcuts\n var words = wordArray.words;\n var sigBytes = wordArray.sigBytes; // Convert\n\n var hexChars = [];\n\n for (var i = 0; i < sigBytes; i++) {\n var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff;\n hexChars.push((bite >>> 4).toString(16));\n hexChars.push((bite & 0x0f).toString(16));\n }\n\n return hexChars.join('');\n}\n\nvar WordArray = /*#__PURE__*/function () {\n function WordArray(words, sigBytes) {\n words = this.words = words || [];\n\n if (sigBytes != undefined) {\n this.sigBytes = sigBytes;\n } else {\n this.sigBytes = words.length * 4;\n }\n }\n\n var _proto = WordArray.prototype;\n\n _proto.random = function random(nBytes) {\n var words = [];\n\n for (var i = 0; i < nBytes; i += 4) {\n words.push(cryptoSecureRandomInt());\n }\n\n return new WordArray(words, nBytes);\n };\n\n _proto.toString = function toString() {\n return hexStringify(this);\n };\n\n return WordArray;\n}();\n\nexport { WordArray as default };","// A small implementation of BigInteger based on http://www-cs-students.stanford.edu/~tjw/jsbn/\n//\n// All public methods have been removed except the following:\n// new BigInteger(a, b) (only radix 2, 4, 8, 16 and 32 supported)\n// toString (only radix 2, 4, 8, 16 and 32 supported)\n// negate\n// abs\n// compareTo\n// bitLength\n// mod\n// equals\n// add\n// subtract\n// multiply\n// divide\n// modPow\nexport default BigInteger;\n/*\n * Copyright (c) 2003-2005 Tom Wu\n * All Rights Reserved.\n *\n * Permission is hereby granted, free of charge, to any person obtaining\n * a copy of this software and associated documentation files (the\n * \"Software\"), to deal in the Software without restriction, including\n * without limitation the rights to use, copy, modify, merge, publish,\n * distribute, sublicense, and/or sell copies of the Software, and to\n * permit persons to whom the Software is furnished to do so, subject to\n * the following conditions:\n *\n * The above copyright notice and this permission notice shall be\n * included in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND,\n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY\n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.\n *\n * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL,\n * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER\n * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF\n * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT\n * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n *\n * In addition, the following condition applies:\n *\n * All redistributions must retain an intact copy of this copyright notice\n * and disclaimer.\n */\n// (public) Constructor\n\nfunction BigInteger(a, b) {\n if (a != null) this.fromString(a, b);\n} // return new, unset BigInteger\n\n\nfunction nbi() {\n return new BigInteger(null);\n} // Bits per digit\n\n\nvar dbits; // JavaScript engine analysis\n\nvar canary = 0xdeadbeefcafe;\nvar j_lm = (canary & 0xffffff) == 0xefcafe; // am: Compute w_j += (x*this_i), propagate carries,\n// c is initial carry, returns final carry.\n// c < 3*dvalue, x < 2*dvalue, this_i < dvalue\n// We need to select the fastest one that works in this environment.\n// am1: use a single mult and divide to get the high bits,\n// max digit bits should be 26 because\n// max internal value = 2*dvalue^2-2*dvalue (< 2^53)\n\nfunction am1(i, x, w, j, c, n) {\n while (--n >= 0) {\n var v = x * this[i++] + w[j] + c;\n c = Math.floor(v / 0x4000000);\n w[j++] = v & 0x3ffffff;\n }\n\n return c;\n} // am2 avoids a big mult-and-extract completely.\n// Max digit bits should be <= 30 because we do bitwise ops\n// on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)\n\n\nfunction am2(i, x, w, j, c, n) {\n var xl = x & 0x7fff,\n xh = x >> 15;\n\n while (--n >= 0) {\n var l = this[i] & 0x7fff;\n var h = this[i++] >> 15;\n var m = xh * l + h * xl;\n l = xl * l + ((m & 0x7fff) << 15) + w[j] + (c & 0x3fffffff);\n c = (l >>> 30) + (m >>> 15) + xh * h + (c >>> 30);\n w[j++] = l & 0x3fffffff;\n }\n\n return c;\n} // Alternately, set max digit bits to 28 since some\n// browsers slow down when dealing with 32-bit numbers.\n\n\nfunction am3(i, x, w, j, c, n) {\n var xl = x & 0x3fff,\n xh = x >> 14;\n\n while (--n >= 0) {\n var l = this[i] & 0x3fff;\n var h = this[i++] >> 14;\n var m = xh * l + h * xl;\n l = xl * l + ((m & 0x3fff) << 14) + w[j] + c;\n c = (l >> 28) + (m >> 14) + xh * h;\n w[j++] = l & 0xfffffff;\n }\n\n return c;\n}\n\nvar inBrowser = typeof navigator !== 'undefined';\n\nif (inBrowser && j_lm && navigator.appName == 'Microsoft Internet Explorer') {\n BigInteger.prototype.am = am2;\n dbits = 30;\n} else if (inBrowser && j_lm && navigator.appName != 'Netscape') {\n BigInteger.prototype.am = am1;\n dbits = 26;\n} else {\n // Mozilla/Netscape seems to prefer am3\n BigInteger.prototype.am = am3;\n dbits = 28;\n}\n\nBigInteger.prototype.DB = dbits;\nBigInteger.prototype.DM = (1 << dbits) - 1;\nBigInteger.prototype.DV = 1 << dbits;\nvar BI_FP = 52;\nBigInteger.prototype.FV = Math.pow(2, BI_FP);\nBigInteger.prototype.F1 = BI_FP - dbits;\nBigInteger.prototype.F2 = 2 * dbits - BI_FP; // Digit conversions\n\nvar BI_RM = '0123456789abcdefghijklmnopqrstuvwxyz';\nvar BI_RC = new Array();\nvar rr, vv;\nrr = '0'.charCodeAt(0);\n\nfor (vv = 0; vv <= 9; ++vv) {\n BI_RC[rr++] = vv;\n}\n\nrr = 'a'.charCodeAt(0);\n\nfor (vv = 10; vv < 36; ++vv) {\n BI_RC[rr++] = vv;\n}\n\nrr = 'A'.charCodeAt(0);\n\nfor (vv = 10; vv < 36; ++vv) {\n BI_RC[rr++] = vv;\n}\n\nfunction int2char(n) {\n return BI_RM.charAt(n);\n}\n\nfunction intAt(s, i) {\n var c = BI_RC[s.charCodeAt(i)];\n return c == null ? -1 : c;\n} // (protected) copy this to r\n\n\nfunction bnpCopyTo(r) {\n for (var i = this.t - 1; i >= 0; --i) {\n r[i] = this[i];\n }\n\n r.t = this.t;\n r.s = this.s;\n} // (protected) set from integer value x, -DV <= x < DV\n\n\nfunction bnpFromInt(x) {\n this.t = 1;\n this.s = x < 0 ? -1 : 0;\n if (x > 0) this[0] = x;else if (x < -1) this[0] = x + this.DV;else this.t = 0;\n} // return bigint initialized to value\n\n\nfunction nbv(i) {\n var r = nbi();\n r.fromInt(i);\n return r;\n} // (protected) set from string and radix\n\n\nfunction bnpFromString(s, b) {\n var k;\n if (b == 16) k = 4;else if (b == 8) k = 3;else if (b == 2) k = 1;else if (b == 32) k = 5;else if (b == 4) k = 2;else throw new Error('Only radix 2, 4, 8, 16, 32 are supported');\n this.t = 0;\n this.s = 0;\n var i = s.length,\n mi = false,\n sh = 0;\n\n while (--i >= 0) {\n var x = intAt(s, i);\n\n if (x < 0) {\n if (s.charAt(i) == '-') mi = true;\n continue;\n }\n\n mi = false;\n if (sh == 0) this[this.t++] = x;else if (sh + k > this.DB) {\n this[this.t - 1] |= (x & (1 << this.DB - sh) - 1) << sh;\n this[this.t++] = x >> this.DB - sh;\n } else this[this.t - 1] |= x << sh;\n sh += k;\n if (sh >= this.DB) sh -= this.DB;\n }\n\n this.clamp();\n if (mi) BigInteger.ZERO.subTo(this, this);\n} // (protected) clamp off excess high words\n\n\nfunction bnpClamp() {\n var c = this.s & this.DM;\n\n while (this.t > 0 && this[this.t - 1] == c) {\n --this.t;\n }\n} // (public) return string representation in given radix\n\n\nfunction bnToString(b) {\n if (this.s < 0) return '-' + this.negate().toString(b);\n var k;\n if (b == 16) k = 4;else if (b == 8) k = 3;else if (b == 2) k = 1;else if (b == 32) k = 5;else if (b == 4) k = 2;else throw new Error('Only radix 2, 4, 8, 16, 32 are supported');\n var km = (1 << k) - 1,\n d,\n m = false,\n r = '',\n i = this.t;\n var p = this.DB - i * this.DB % k;\n\n if (i-- > 0) {\n if (p < this.DB && (d = this[i] >> p) > 0) {\n m = true;\n r = int2char(d);\n }\n\n while (i >= 0) {\n if (p < k) {\n d = (this[i] & (1 << p) - 1) << k - p;\n d |= this[--i] >> (p += this.DB - k);\n } else {\n d = this[i] >> (p -= k) & km;\n\n if (p <= 0) {\n p += this.DB;\n --i;\n }\n }\n\n if (d > 0) m = true;\n if (m) r += int2char(d);\n }\n }\n\n return m ? r : '0';\n} // (public) -this\n\n\nfunction bnNegate() {\n var r = nbi();\n BigInteger.ZERO.subTo(this, r);\n return r;\n} // (public) |this|\n\n\nfunction bnAbs() {\n return this.s < 0 ? this.negate() : this;\n} // (public) return + if this > a, - if this < a, 0 if equal\n\n\nfunction bnCompareTo(a) {\n var r = this.s - a.s;\n if (r != 0) return r;\n var i = this.t;\n r = i - a.t;\n if (r != 0) return this.s < 0 ? -r : r;\n\n while (--i >= 0) {\n if ((r = this[i] - a[i]) != 0) return r;\n }\n\n return 0;\n} // returns bit length of the integer x\n\n\nfunction nbits(x) {\n var r = 1,\n t;\n\n if ((t = x >>> 16) != 0) {\n x = t;\n r += 16;\n }\n\n if ((t = x >> 8) != 0) {\n x = t;\n r += 8;\n }\n\n if ((t = x >> 4) != 0) {\n x = t;\n r += 4;\n }\n\n if ((t = x >> 2) != 0) {\n x = t;\n r += 2;\n }\n\n if ((t = x >> 1) != 0) {\n x = t;\n r += 1;\n }\n\n return r;\n} // (public) return the number of bits in \"this\"\n\n\nfunction bnBitLength() {\n if (this.t <= 0) return 0;\n return this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ this.s & this.DM);\n} // (protected) r = this << n*DB\n\n\nfunction bnpDLShiftTo(n, r) {\n var i;\n\n for (i = this.t - 1; i >= 0; --i) {\n r[i + n] = this[i];\n }\n\n for (i = n - 1; i >= 0; --i) {\n r[i] = 0;\n }\n\n r.t = this.t + n;\n r.s = this.s;\n} // (protected) r = this >> n*DB\n\n\nfunction bnpDRShiftTo(n, r) {\n for (var i = n; i < this.t; ++i) {\n r[i - n] = this[i];\n }\n\n r.t = Math.max(this.t - n, 0);\n r.s = this.s;\n} // (protected) r = this << n\n\n\nfunction bnpLShiftTo(n, r) {\n var bs = n % this.DB;\n var cbs = this.DB - bs;\n var bm = (1 << cbs) - 1;\n var ds = Math.floor(n / this.DB),\n c = this.s << bs & this.DM,\n i;\n\n for (i = this.t - 1; i >= 0; --i) {\n r[i + ds + 1] = this[i] >> cbs | c;\n c = (this[i] & bm) << bs;\n }\n\n for (i = ds - 1; i >= 0; --i) {\n r[i] = 0;\n }\n\n r[ds] = c;\n r.t = this.t + ds + 1;\n r.s = this.s;\n r.clamp();\n} // (protected) r = this >> n\n\n\nfunction bnpRShiftTo(n, r) {\n r.s = this.s;\n var ds = Math.floor(n / this.DB);\n\n if (ds >= this.t) {\n r.t = 0;\n return;\n }\n\n var bs = n % this.DB;\n var cbs = this.DB - bs;\n var bm = (1 << bs) - 1;\n r[0] = this[ds] >> bs;\n\n for (var i = ds + 1; i < this.t; ++i) {\n r[i - ds - 1] |= (this[i] & bm) << cbs;\n r[i - ds] = this[i] >> bs;\n }\n\n if (bs > 0) r[this.t - ds - 1] |= (this.s & bm) << cbs;\n r.t = this.t - ds;\n r.clamp();\n} // (protected) r = this - a\n\n\nfunction bnpSubTo(a, r) {\n var i = 0,\n c = 0,\n m = Math.min(a.t, this.t);\n\n while (i < m) {\n c += this[i] - a[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n\n if (a.t < this.t) {\n c -= a.s;\n\n while (i < this.t) {\n c += this[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n\n c += this.s;\n } else {\n c += this.s;\n\n while (i < a.t) {\n c -= a[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n\n c -= a.s;\n }\n\n r.s = c < 0 ? -1 : 0;\n if (c < -1) r[i++] = this.DV + c;else if (c > 0) r[i++] = c;\n r.t = i;\n r.clamp();\n} // (protected) r = this * a, r != this,a (HAC 14.12)\n// \"this\" should be the larger one if appropriate.\n\n\nfunction bnpMultiplyTo(a, r) {\n var x = this.abs(),\n y = a.abs();\n var i = x.t;\n r.t = i + y.t;\n\n while (--i >= 0) {\n r[i] = 0;\n }\n\n for (i = 0; i < y.t; ++i) {\n r[i + x.t] = x.am(0, y[i], r, i, 0, x.t);\n }\n\n r.s = 0;\n r.clamp();\n if (this.s != a.s) BigInteger.ZERO.subTo(r, r);\n} // (protected) r = this^2, r != this (HAC 14.16)\n\n\nfunction bnpSquareTo(r) {\n var x = this.abs();\n var i = r.t = 2 * x.t;\n\n while (--i >= 0) {\n r[i] = 0;\n }\n\n for (i = 0; i < x.t - 1; ++i) {\n var c = x.am(i, x[i], r, 2 * i, 0, 1);\n\n if ((r[i + x.t] += x.am(i + 1, 2 * x[i], r, 2 * i + 1, c, x.t - i - 1)) >= x.DV) {\n r[i + x.t] -= x.DV;\n r[i + x.t + 1] = 1;\n }\n }\n\n if (r.t > 0) r[r.t - 1] += x.am(i, x[i], r, 2 * i, 0, 1);\n r.s = 0;\n r.clamp();\n} // (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)\n// r != q, this != m. q or r may be null.\n\n\nfunction bnpDivRemTo(m, q, r) {\n var pm = m.abs();\n if (pm.t <= 0) return;\n var pt = this.abs();\n\n if (pt.t < pm.t) {\n if (q != null) q.fromInt(0);\n if (r != null) this.copyTo(r);\n return;\n }\n\n if (r == null) r = nbi();\n var y = nbi(),\n ts = this.s,\n ms = m.s;\n var nsh = this.DB - nbits(pm[pm.t - 1]); // normalize modulus\n\n if (nsh > 0) {\n pm.lShiftTo(nsh, y);\n pt.lShiftTo(nsh, r);\n } else {\n pm.copyTo(y);\n pt.copyTo(r);\n }\n\n var ys = y.t;\n var y0 = y[ys - 1];\n if (y0 == 0) return;\n var yt = y0 * (1 << this.F1) + (ys > 1 ? y[ys - 2] >> this.F2 : 0);\n var d1 = this.FV / yt,\n d2 = (1 << this.F1) / yt,\n e = 1 << this.F2;\n var i = r.t,\n j = i - ys,\n t = q == null ? nbi() : q;\n y.dlShiftTo(j, t);\n\n if (r.compareTo(t) >= 0) {\n r[r.t++] = 1;\n r.subTo(t, r);\n }\n\n BigInteger.ONE.dlShiftTo(ys, t);\n t.subTo(y, y); // \"negative\" y so we can replace sub with am later\n\n while (y.t < ys) {\n y[y.t++] = 0;\n }\n\n while (--j >= 0) {\n // Estimate quotient digit\n var qd = r[--i] == y0 ? this.DM : Math.floor(r[i] * d1 + (r[i - 1] + e) * d2);\n\n if ((r[i] += y.am(0, qd, r, j, 0, ys)) < qd) {\n // Try it out\n y.dlShiftTo(j, t);\n r.subTo(t, r);\n\n while (r[i] < --qd) {\n r.subTo(t, r);\n }\n }\n }\n\n if (q != null) {\n r.drShiftTo(ys, q);\n if (ts != ms) BigInteger.ZERO.subTo(q, q);\n }\n\n r.t = ys;\n r.clamp();\n if (nsh > 0) r.rShiftTo(nsh, r); // Denormalize remainder\n\n if (ts < 0) BigInteger.ZERO.subTo(r, r);\n} // (public) this mod a\n\n\nfunction bnMod(a) {\n var r = nbi();\n this.abs().divRemTo(a, null, r);\n if (this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r, r);\n return r;\n} // (protected) return \"-1/this % 2^DB\"; useful for Mont. reduction\n// justification:\n// xy == 1 (mod m)\n// xy = 1+km\n// xy(2-xy) = (1+km)(1-km)\n// x[y(2-xy)] = 1-k^2m^2\n// x[y(2-xy)] == 1 (mod m^2)\n// if y is 1/x mod m, then y(2-xy) is 1/x mod m^2\n// should reduce x and y(2-xy) by m^2 at each step to keep size bounded.\n// JS multiply \"overflows\" differently from C/C++, so care is needed here.\n\n\nfunction bnpInvDigit() {\n if (this.t < 1) return 0;\n var x = this[0];\n if ((x & 1) == 0) return 0;\n var y = x & 3; // y == 1/x mod 2^2\n\n y = y * (2 - (x & 0xf) * y) & 0xf; // y == 1/x mod 2^4\n\n y = y * (2 - (x & 0xff) * y) & 0xff; // y == 1/x mod 2^8\n\n y = y * (2 - ((x & 0xffff) * y & 0xffff)) & 0xffff; // y == 1/x mod 2^16\n // last step - calculate inverse mod DV directly;\n // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints\n\n y = y * (2 - x * y % this.DV) % this.DV; // y == 1/x mod 2^dbits\n // we really want the negative inverse, and -DV < y < DV\n\n return y > 0 ? this.DV - y : -y;\n}\n\nfunction bnEquals(a) {\n return this.compareTo(a) == 0;\n} // (protected) r = this + a\n\n\nfunction bnpAddTo(a, r) {\n var i = 0,\n c = 0,\n m = Math.min(a.t, this.t);\n\n while (i < m) {\n c += this[i] + a[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n\n if (a.t < this.t) {\n c += a.s;\n\n while (i < this.t) {\n c += this[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n\n c += this.s;\n } else {\n c += this.s;\n\n while (i < a.t) {\n c += a[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n\n c += a.s;\n }\n\n r.s = c < 0 ? -1 : 0;\n if (c > 0) r[i++] = c;else if (c < -1) r[i++] = this.DV + c;\n r.t = i;\n r.clamp();\n} // (public) this + a\n\n\nfunction bnAdd(a) {\n var r = nbi();\n this.addTo(a, r);\n return r;\n} // (public) this - a\n\n\nfunction bnSubtract(a) {\n var r = nbi();\n this.subTo(a, r);\n return r;\n} // (public) this * a\n\n\nfunction bnMultiply(a) {\n var r = nbi();\n this.multiplyTo(a, r);\n return r;\n} // (public) this / a\n\n\nfunction bnDivide(a) {\n var r = nbi();\n this.divRemTo(a, r, null);\n return r;\n} // Montgomery reduction\n\n\nfunction Montgomery(m) {\n this.m = m;\n this.mp = m.invDigit();\n this.mpl = this.mp & 0x7fff;\n this.mph = this.mp >> 15;\n this.um = (1 << m.DB - 15) - 1;\n this.mt2 = 2 * m.t;\n} // xR mod m\n\n\nfunction montConvert(x) {\n var r = nbi();\n x.abs().dlShiftTo(this.m.t, r);\n r.divRemTo(this.m, null, r);\n if (x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r, r);\n return r;\n} // x/R mod m\n\n\nfunction montRevert(x) {\n var r = nbi();\n x.copyTo(r);\n this.reduce(r);\n return r;\n} // x = x/R mod m (HAC 14.32)\n\n\nfunction montReduce(x) {\n while (x.t <= this.mt2) {\n // pad x so am has enough room later\n x[x.t++] = 0;\n }\n\n for (var i = 0; i < this.m.t; ++i) {\n // faster way of calculating u0 = x[i]*mp mod DV\n var j = x[i] & 0x7fff;\n var u0 = j * this.mpl + ((j * this.mph + (x[i] >> 15) * this.mpl & this.um) << 15) & x.DM; // use am to combine the multiply-shift-add into one call\n\n j = i + this.m.t;\n x[j] += this.m.am(0, u0, x, i, 0, this.m.t); // propagate carry\n\n while (x[j] >= x.DV) {\n x[j] -= x.DV;\n x[++j]++;\n }\n }\n\n x.clamp();\n x.drShiftTo(this.m.t, x);\n if (x.compareTo(this.m) >= 0) x.subTo(this.m, x);\n} // r = \"x^2/R mod m\"; x != r\n\n\nfunction montSqrTo(x, r) {\n x.squareTo(r);\n this.reduce(r);\n} // r = \"xy/R mod m\"; x,y != r\n\n\nfunction montMulTo(x, y, r) {\n x.multiplyTo(y, r);\n this.reduce(r);\n}\n\nMontgomery.prototype.convert = montConvert;\nMontgomery.prototype.revert = montRevert;\nMontgomery.prototype.reduce = montReduce;\nMontgomery.prototype.mulTo = montMulTo;\nMontgomery.prototype.sqrTo = montSqrTo; // (public) this^e % m (HAC 14.85)\n\nfunction bnModPow(e, m, callback) {\n var i = e.bitLength(),\n k,\n r = nbv(1),\n z = new Montgomery(m);\n if (i <= 0) return r;else if (i < 18) k = 1;else if (i < 48) k = 3;else if (i < 144) k = 4;else if (i < 768) k = 5;else k = 6; // precomputation\n\n var g = new Array(),\n n = 3,\n k1 = k - 1,\n km = (1 << k) - 1;\n g[1] = z.convert(this);\n\n if (k > 1) {\n var g2 = nbi();\n z.sqrTo(g[1], g2);\n\n while (n <= km) {\n g[n] = nbi();\n z.mulTo(g2, g[n - 2], g[n]);\n n += 2;\n }\n }\n\n var j = e.t - 1,\n w,\n is1 = true,\n r2 = nbi(),\n t;\n i = nbits(e[j]) - 1;\n\n while (j >= 0) {\n if (i >= k1) w = e[j] >> i - k1 & km;else {\n w = (e[j] & (1 << i + 1) - 1) << k1 - i;\n if (j > 0) w |= e[j - 1] >> this.DB + i - k1;\n }\n n = k;\n\n while ((w & 1) == 0) {\n w >>= 1;\n --n;\n }\n\n if ((i -= n) < 0) {\n i += this.DB;\n --j;\n }\n\n if (is1) {\n // ret == 1, don't bother squaring or multiplying it\n g[w].copyTo(r);\n is1 = false;\n } else {\n while (n > 1) {\n z.sqrTo(r, r2);\n z.sqrTo(r2, r);\n n -= 2;\n }\n\n if (n > 0) z.sqrTo(r, r2);else {\n t = r;\n r = r2;\n r2 = t;\n }\n z.mulTo(r2, g[w], r);\n }\n\n while (j >= 0 && (e[j] & 1 << i) == 0) {\n z.sqrTo(r, r2);\n t = r;\n r = r2;\n r2 = t;\n\n if (--i < 0) {\n i = this.DB - 1;\n --j;\n }\n }\n }\n\n var result = z.revert(r);\n callback(null, result);\n return result;\n} // protected\n\n\nBigInteger.prototype.copyTo = bnpCopyTo;\nBigInteger.prototype.fromInt = bnpFromInt;\nBigInteger.prototype.fromString = bnpFromString;\nBigInteger.prototype.clamp = bnpClamp;\nBigInteger.prototype.dlShiftTo = bnpDLShiftTo;\nBigInteger.prototype.drShiftTo = bnpDRShiftTo;\nBigInteger.prototype.lShiftTo = bnpLShiftTo;\nBigInteger.prototype.rShiftTo = bnpRShiftTo;\nBigInteger.prototype.subTo = bnpSubTo;\nBigInteger.prototype.multiplyTo = bnpMultiplyTo;\nBigInteger.prototype.squareTo = bnpSquareTo;\nBigInteger.prototype.divRemTo = bnpDivRemTo;\nBigInteger.prototype.invDigit = bnpInvDigit;\nBigInteger.prototype.addTo = bnpAddTo; // public\n\nBigInteger.prototype.toString = bnToString;\nBigInteger.prototype.negate = bnNegate;\nBigInteger.prototype.abs = bnAbs;\nBigInteger.prototype.compareTo = bnCompareTo;\nBigInteger.prototype.bitLength = bnBitLength;\nBigInteger.prototype.mod = bnMod;\nBigInteger.prototype.equals = bnEquals;\nBigInteger.prototype.add = bnAdd;\nBigInteger.prototype.subtract = bnSubtract;\nBigInteger.prototype.multiply = bnMultiply;\nBigInteger.prototype.divide = bnDivide;\nBigInteger.prototype.modPow = bnModPow; // \"constants\"\n\nBigInteger.ZERO = nbv(0);\nBigInteger.ONE = nbv(1);","/*!\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { Buffer } from 'buffer';\nimport CryptoJS from 'crypto-js/core';\nimport 'crypto-js/lib-typedarrays'; // necessary for crypto js\n\nimport SHA256 from 'crypto-js/sha256';\nimport HmacSHA256 from 'crypto-js/hmac-sha256';\nimport WordArray from './utils/WordArray';\n/**\n * Returns a Buffer with a sequence of random nBytes\n *\n * @param {number} nBytes\n * @returns {Buffer} fixed-length sequence of random bytes\n */\n\nfunction randomBytes(nBytes) {\n return Buffer.from(new WordArray().random(nBytes).toString(), 'hex');\n}\n\nimport BigInteger from './BigInteger';\n/**\n * Tests if a hex string has it most significant bit set (case-insensitive regex)\n */\n\nvar HEX_MSB_REGEX = /^[89a-f]/i;\nvar initN = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1' + '29024E088A67CC74020BBEA63B139B22514A08798E3404DD' + 'EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245' + 'E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED' + 'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D' + 'C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F' + '83655D23DCA3AD961C62F356208552BB9ED529077096966D' + '670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B' + 'E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9' + 'DE2BCBF6955817183995497CEA956AE515D2261898FA0510' + '15728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64' + 'ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7' + 'ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6B' + 'F12FFA06D98A0864D87602733EC86A64521F2B18177B200C' + 'BBE117577A615D6C770988C0BAD946E208E24FA074E5AB31' + '43DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF';\nvar newPasswordRequiredChallengeUserAttributePrefix = 'userAttributes.';\n/** @class */\n\nvar AuthenticationHelper = /*#__PURE__*/function () {\n /**\n * Constructs a new AuthenticationHelper object\n * @param {string} PoolName Cognito user pool name.\n */\n function AuthenticationHelper(PoolName) {\n this.N = new BigInteger(initN, 16);\n this.g = new BigInteger('2', 16);\n this.k = new BigInteger(this.hexHash(\"\" + this.padHex(this.N) + this.padHex(this.g)), 16);\n this.smallAValue = this.generateRandomSmallA();\n this.getLargeAValue(function () {});\n this.infoBits = Buffer.from('Caldera Derived Key', 'utf8');\n this.poolName = PoolName;\n }\n /**\n * @returns {BigInteger} small A, a random number\n */\n\n\n var _proto = AuthenticationHelper.prototype;\n\n _proto.getSmallAValue = function getSmallAValue() {\n return this.smallAValue;\n }\n /**\n * @param {nodeCallback} callback Called with (err, largeAValue)\n * @returns {void}\n */\n ;\n\n _proto.getLargeAValue = function getLargeAValue(callback) {\n var _this = this;\n\n if (this.largeAValue) {\n callback(null, this.largeAValue);\n } else {\n this.calculateA(this.smallAValue, function (err, largeAValue) {\n if (err) {\n callback(err, null);\n }\n\n _this.largeAValue = largeAValue;\n callback(null, _this.largeAValue);\n });\n }\n }\n /**\n * helper function to generate a random big integer\n * @returns {BigInteger} a random value.\n * @private\n */\n ;\n\n _proto.generateRandomSmallA = function generateRandomSmallA() {\n // This will be interpreted as a postive 128-bit integer\n var hexRandom = randomBytes(128).toString('hex');\n var randomBigInt = new BigInteger(hexRandom, 16); // There is no need to do randomBigInt.mod(this.N - 1) as N (3072-bit) is > 128 bytes (1024-bit)\n\n return randomBigInt;\n }\n /**\n * helper function to generate a random string\n * @returns {string} a random value.\n * @private\n */\n ;\n\n _proto.generateRandomString = function generateRandomString() {\n return randomBytes(40).toString('base64');\n }\n /**\n * @returns {string} Generated random value included in password hash.\n */\n ;\n\n _proto.getRandomPassword = function getRandomPassword() {\n return this.randomPassword;\n }\n /**\n * @returns {string} Generated random value included in devices hash.\n */\n ;\n\n _proto.getSaltDevices = function getSaltDevices() {\n return this.SaltToHashDevices;\n }\n /**\n * @returns {string} Value used to verify devices.\n */\n ;\n\n _proto.getVerifierDevices = function getVerifierDevices() {\n return this.verifierDevices;\n }\n /**\n * Generate salts and compute verifier.\n * @param {string} deviceGroupKey Devices to generate verifier for.\n * @param {string} username User to generate verifier for.\n * @param {nodeCallback} callback Called with (err, null)\n * @returns {void}\n */\n ;\n\n _proto.generateHashDevice = function generateHashDevice(deviceGroupKey, username, callback) {\n var _this2 = this;\n\n this.randomPassword = this.generateRandomString();\n var combinedString = \"\" + deviceGroupKey + username + \":\" + this.randomPassword;\n var hashedString = this.hash(combinedString);\n var hexRandom = randomBytes(16).toString('hex'); // The random hex will be unambiguously represented as a postive integer\n\n this.SaltToHashDevices = this.padHex(new BigInteger(hexRandom, 16));\n this.g.modPow(new BigInteger(this.hexHash(this.SaltToHashDevices + hashedString), 16), this.N, function (err, verifierDevicesNotPadded) {\n if (err) {\n callback(err, null);\n }\n\n _this2.verifierDevices = _this2.padHex(verifierDevicesNotPadded);\n callback(null, null);\n });\n }\n /**\n * Calculate the client's public value A = g^a%N\n * with the generated random number a\n * @param {BigInteger} a Randomly generated small A.\n * @param {nodeCallback} callback Called with (err, largeAValue)\n * @returns {void}\n * @private\n */\n ;\n\n _proto.calculateA = function calculateA(a, callback) {\n var _this3 = this;\n\n this.g.modPow(a, this.N, function (err, A) {\n if (err) {\n callback(err, null);\n }\n\n if (A.mod(_this3.N).equals(BigInteger.ZERO)) {\n callback(new Error('Illegal paramater. A mod N cannot be 0.'), null);\n }\n\n callback(null, A);\n });\n }\n /**\n * Calculate the client's value U which is the hash of A and B\n * @param {BigInteger} A Large A value.\n * @param {BigInteger} B Server B value.\n * @returns {BigInteger} Computed U value.\n * @private\n */\n ;\n\n _proto.calculateU = function calculateU(A, B) {\n this.UHexHash = this.hexHash(this.padHex(A) + this.padHex(B));\n var finalU = new BigInteger(this.UHexHash, 16);\n return finalU;\n }\n /**\n * Calculate a hash from a bitArray\n * @param {Buffer} buf Value to hash.\n * @returns {String} Hex-encoded hash.\n * @private\n */\n ;\n\n _proto.hash = function hash(buf) {\n var str = buf instanceof Buffer ? CryptoJS.lib.WordArray.create(buf) : buf;\n var hashHex = SHA256(str).toString();\n return new Array(64 - hashHex.length).join('0') + hashHex;\n }\n /**\n * Calculate a hash from a hex string\n * @param {String} hexStr Value to hash.\n * @returns {String} Hex-encoded hash.\n * @private\n */\n ;\n\n _proto.hexHash = function hexHash(hexStr) {\n return this.hash(Buffer.from(hexStr, 'hex'));\n }\n /**\n * Standard hkdf algorithm\n * @param {Buffer} ikm Input key material.\n * @param {Buffer} salt Salt value.\n * @returns {Buffer} Strong key material.\n * @private\n */\n ;\n\n _proto.computehkdf = function computehkdf(ikm, salt) {\n var infoBitsWordArray = CryptoJS.lib.WordArray.create(Buffer.concat([this.infoBits, Buffer.from(String.fromCharCode(1), 'utf8')]));\n var ikmWordArray = ikm instanceof Buffer ? CryptoJS.lib.WordArray.create(ikm) : ikm;\n var saltWordArray = salt instanceof Buffer ? CryptoJS.lib.WordArray.create(salt) : salt;\n var prk = HmacSHA256(ikmWordArray, saltWordArray);\n var hmac = HmacSHA256(infoBitsWordArray, prk);\n return Buffer.from(hmac.toString(), 'hex').slice(0, 16);\n }\n /**\n * Calculates the final hkdf based on computed S value, and computed U value and the key\n * @param {String} username Username.\n * @param {String} password Password.\n * @param {BigInteger} serverBValue Server B value.\n * @param {BigInteger} salt Generated salt.\n * @param {nodeCallback} callback Called with (err, hkdfValue)\n * @returns {void}\n */\n ;\n\n _proto.getPasswordAuthenticationKey = function getPasswordAuthenticationKey(username, password, serverBValue, salt, callback) {\n var _this4 = this;\n\n if (serverBValue.mod(this.N).equals(BigInteger.ZERO)) {\n throw new Error('B cannot be zero.');\n }\n\n this.UValue = this.calculateU(this.largeAValue, serverBValue);\n\n if (this.UValue.equals(BigInteger.ZERO)) {\n throw new Error('U cannot be zero.');\n }\n\n var usernamePassword = \"\" + this.poolName + username + \":\" + password;\n var usernamePasswordHash = this.hash(usernamePassword);\n var xValue = new BigInteger(this.hexHash(this.padHex(salt) + usernamePasswordHash), 16);\n this.calculateS(xValue, serverBValue, function (err, sValue) {\n if (err) {\n callback(err, null);\n }\n\n var hkdf = _this4.computehkdf(Buffer.from(_this4.padHex(sValue), 'hex'), Buffer.from(_this4.padHex(_this4.UValue), 'hex'));\n\n callback(null, hkdf);\n });\n }\n /**\n * Calculates the S value used in getPasswordAuthenticationKey\n * @param {BigInteger} xValue Salted password hash value.\n * @param {BigInteger} serverBValue Server B value.\n * @param {nodeCallback} callback Called on success or error.\n * @returns {void}\n */\n ;\n\n _proto.calculateS = function calculateS(xValue, serverBValue, callback) {\n var _this5 = this;\n\n this.g.modPow(xValue, this.N, function (err, gModPowXN) {\n if (err) {\n callback(err, null);\n }\n\n var intValue2 = serverBValue.subtract(_this5.k.multiply(gModPowXN));\n intValue2.modPow(_this5.smallAValue.add(_this5.UValue.multiply(xValue)), _this5.N, function (err2, result) {\n if (err2) {\n callback(err2, null);\n }\n\n callback(null, result.mod(_this5.N));\n });\n });\n }\n /**\n * Return constant newPasswordRequiredChallengeUserAttributePrefix\n * @return {newPasswordRequiredChallengeUserAttributePrefix} constant prefix value\n */\n ;\n\n _proto.getNewPasswordRequiredChallengeUserAttributePrefix = function getNewPasswordRequiredChallengeUserAttributePrefix() {\n return newPasswordRequiredChallengeUserAttributePrefix;\n }\n /**\n * Returns an unambiguous, even-length hex string of the two's complement encoding of an integer.\n *\n * It is compatible with the hex encoding of Java's BigInteger's toByteArray(), wich returns a\n * byte array containing the two's-complement representation of a BigInteger. The array contains\n * the minimum number of bytes required to represent the BigInteger, including at least one sign bit.\n *\n * Examples showing how ambiguity is avoided by left padding with:\n * \t\"00\" (for positive values where the most-significant-bit is set)\n * \"FF\" (for negative values where the most-significant-bit is set)\n *\n * padHex(bigInteger.fromInt(-236)) === \"FF14\"\n * padHex(bigInteger.fromInt(20)) === \"14\"\n *\n * padHex(bigInteger.fromInt(-200)) === \"FF38\"\n * padHex(bigInteger.fromInt(56)) === \"38\"\n *\n * padHex(bigInteger.fromInt(-20)) === \"EC\"\n * padHex(bigInteger.fromInt(236)) === \"00EC\"\n *\n * padHex(bigInteger.fromInt(-56)) === \"C8\"\n * padHex(bigInteger.fromInt(200)) === \"00C8\"\n *\n * @param {BigInteger} bigInt Number to encode.\n * @returns {String} even-length hex string of the two's complement encoding.\n */\n ;\n\n _proto.padHex = function padHex(bigInt) {\n if (!(bigInt instanceof BigInteger)) {\n throw new Error('Not a BigInteger');\n }\n\n var isNegative = bigInt.compareTo(BigInteger.ZERO) < 0;\n /* Get a hex string for abs(bigInt) */\n\n var hexStr = bigInt.abs().toString(16);\n /* Pad hex to even length if needed */\n\n hexStr = hexStr.length % 2 !== 0 ? \"0\" + hexStr : hexStr;\n /* Prepend \"00\" if the most significant bit is set */\n\n hexStr = HEX_MSB_REGEX.test(hexStr) ? \"00\" + hexStr : hexStr;\n\n if (isNegative) {\n /* Flip the bits of the representation */\n var invertedNibbles = hexStr.split('').map(function (x) {\n var invertedNibble = ~parseInt(x, 16) & 0xf;\n return '0123456789ABCDEF'.charAt(invertedNibble);\n }).join('');\n /* After flipping the bits, add one to get the 2's complement representation */\n\n var flippedBitsBI = new BigInteger(invertedNibbles, 16).add(BigInteger.ONE);\n hexStr = flippedBitsBI.toString(16);\n /*\n For hex strings starting with 'FF8', 'FF' can be dropped, e.g. 0xFFFF80=0xFF80=0x80=-128\n \t\tAny sequence of '1' bits on the left can always be substituted with a single '1' bit\n without changing the represented value.\n \t\tThis only happens in the case when the input is 80...00\n */\n\n if (hexStr.toUpperCase().startsWith('FF8')) {\n hexStr = hexStr.substring(2);\n }\n }\n\n return hexStr;\n };\n\n return AuthenticationHelper;\n}();\n\nexport { AuthenticationHelper as default };","/*!\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { Buffer } from 'buffer';\n/** @class */\n\nvar CognitoJwtToken = /*#__PURE__*/function () {\n /**\n * Constructs a new CognitoJwtToken object\n * @param {string=} token The JWT token.\n */\n function CognitoJwtToken(token) {\n // Assign object\n this.jwtToken = token || '';\n this.payload = this.decodePayload();\n }\n /**\n * @returns {string} the record's token.\n */\n\n\n var _proto = CognitoJwtToken.prototype;\n\n _proto.getJwtToken = function getJwtToken() {\n return this.jwtToken;\n }\n /**\n * @returns {int} the token's expiration (exp member).\n */\n ;\n\n _proto.getExpiration = function getExpiration() {\n return this.payload.exp;\n }\n /**\n * @returns {int} the token's \"issued at\" (iat member).\n */\n ;\n\n _proto.getIssuedAt = function getIssuedAt() {\n return this.payload.iat;\n }\n /**\n * @returns {object} the token's payload.\n */\n ;\n\n _proto.decodePayload = function decodePayload() {\n var payload = this.jwtToken.split('.')[1];\n\n try {\n return JSON.parse(Buffer.from(payload, 'base64').toString('utf8'));\n } catch (err) {\n return {};\n }\n };\n\n return CognitoJwtToken;\n}();\n\nexport { CognitoJwtToken as default };","function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\n/*!\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport CognitoJwtToken from './CognitoJwtToken';\n/** @class */\n\nvar CognitoAccessToken = /*#__PURE__*/function (_CognitoJwtToken) {\n _inheritsLoose(CognitoAccessToken, _CognitoJwtToken);\n\n /**\n * Constructs a new CognitoAccessToken object\n * @param {string=} AccessToken The JWT access token.\n */\n function CognitoAccessToken(_temp) {\n var _ref = _temp === void 0 ? {} : _temp,\n AccessToken = _ref.AccessToken;\n\n return _CognitoJwtToken.call(this, AccessToken || '') || this;\n }\n\n return CognitoAccessToken;\n}(CognitoJwtToken);\n\nexport { CognitoAccessToken as default };","function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\n/*!\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport CognitoJwtToken from './CognitoJwtToken';\n/** @class */\n\nvar CognitoIdToken = /*#__PURE__*/function (_CognitoJwtToken) {\n _inheritsLoose(CognitoIdToken, _CognitoJwtToken);\n\n /**\n * Constructs a new CognitoIdToken object\n * @param {string=} IdToken The JWT Id token\n */\n function CognitoIdToken(_temp) {\n var _ref = _temp === void 0 ? {} : _temp,\n IdToken = _ref.IdToken;\n\n return _CognitoJwtToken.call(this, IdToken || '') || this;\n }\n\n return CognitoIdToken;\n}(CognitoJwtToken);\n\nexport { CognitoIdToken as default };","/*!\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/** @class */\nvar CognitoRefreshToken = /*#__PURE__*/function () {\n /**\n * Constructs a new CognitoRefreshToken object\n * @param {string=} RefreshToken The JWT refresh token.\n */\n function CognitoRefreshToken(_temp) {\n var _ref = _temp === void 0 ? {} : _temp,\n RefreshToken = _ref.RefreshToken;\n\n // Assign object\n this.token = RefreshToken || '';\n }\n /**\n * @returns {string} the record's token.\n */\n\n\n var _proto = CognitoRefreshToken.prototype;\n\n _proto.getToken = function getToken() {\n return this.token;\n };\n\n return CognitoRefreshToken;\n}();\n\nexport { CognitoRefreshToken as default };","/*!\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/** @class */\nvar CognitoUserSession = /*#__PURE__*/function () {\n /**\n * Constructs a new CognitoUserSession object\n * @param {CognitoIdToken} IdToken The session's Id token.\n * @param {CognitoRefreshToken=} RefreshToken The session's refresh token.\n * @param {CognitoAccessToken} AccessToken The session's access token.\n * @param {int} ClockDrift The saved computer's clock drift or undefined to force calculation.\n */\n function CognitoUserSession(_temp) {\n var _ref = _temp === void 0 ? {} : _temp,\n IdToken = _ref.IdToken,\n RefreshToken = _ref.RefreshToken,\n AccessToken = _ref.AccessToken,\n ClockDrift = _ref.ClockDrift;\n\n if (AccessToken == null || IdToken == null) {\n throw new Error('Id token and Access Token must be present.');\n }\n\n this.idToken = IdToken;\n this.refreshToken = RefreshToken;\n this.accessToken = AccessToken;\n this.clockDrift = ClockDrift === undefined ? this.calculateClockDrift() : ClockDrift;\n }\n /**\n * @returns {CognitoIdToken} the session's Id token\n */\n\n\n var _proto = CognitoUserSession.prototype;\n\n _proto.getIdToken = function getIdToken() {\n return this.idToken;\n }\n /**\n * @returns {CognitoRefreshToken} the session's refresh token\n */\n ;\n\n _proto.getRefreshToken = function getRefreshToken() {\n return this.refreshToken;\n }\n /**\n * @returns {CognitoAccessToken} the session's access token\n */\n ;\n\n _proto.getAccessToken = function getAccessToken() {\n return this.accessToken;\n }\n /**\n * @returns {int} the session's clock drift\n */\n ;\n\n _proto.getClockDrift = function getClockDrift() {\n return this.clockDrift;\n }\n /**\n * @returns {int} the computer's clock drift\n */\n ;\n\n _proto.calculateClockDrift = function calculateClockDrift() {\n var now = Math.floor(new Date() / 1000);\n var iat = Math.min(this.accessToken.getIssuedAt(), this.idToken.getIssuedAt());\n return now - iat;\n }\n /**\n * Checks to see if the session is still valid based on session expiry information found\n * in tokens and the current time (adjusted with clock drift)\n * @returns {boolean} if the session is still valid\n */\n ;\n\n _proto.isValid = function isValid() {\n var now = Math.floor(new Date() / 1000);\n var adjusted = now - this.clockDrift;\n return adjusted < this.accessToken.getExpiration() && adjusted < this.idToken.getExpiration();\n };\n\n return CognitoUserSession;\n}();\n\nexport { CognitoUserSession as default };","/*!\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nvar monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];\nvar weekNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];\n/** @class */\n\nvar DateHelper = /*#__PURE__*/function () {\n function DateHelper() {}\n\n var _proto = DateHelper.prototype;\n\n /**\n * @returns {string} The current time in \"ddd MMM D HH:mm:ss UTC YYYY\" format.\n */\n _proto.getNowString = function getNowString() {\n var now = new Date();\n var weekDay = weekNames[now.getUTCDay()];\n var month = monthNames[now.getUTCMonth()];\n var day = now.getUTCDate();\n var hours = now.getUTCHours();\n\n if (hours < 10) {\n hours = \"0\" + hours;\n }\n\n var minutes = now.getUTCMinutes();\n\n if (minutes < 10) {\n minutes = \"0\" + minutes;\n }\n\n var seconds = now.getUTCSeconds();\n\n if (seconds < 10) {\n seconds = \"0\" + seconds;\n }\n\n var year = now.getUTCFullYear(); // ddd MMM D HH:mm:ss UTC YYYY\n\n var dateNow = weekDay + \" \" + month + \" \" + day + \" \" + hours + \":\" + minutes + \":\" + seconds + \" UTC \" + year;\n return dateNow;\n };\n\n return DateHelper;\n}();\n\nexport { DateHelper as default };","/*!\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/** @class */\nvar CognitoUserAttribute = /*#__PURE__*/function () {\n /**\n * Constructs a new CognitoUserAttribute object\n * @param {string=} Name The record's name\n * @param {string=} Value The record's value\n */\n function CognitoUserAttribute(_temp) {\n var _ref = _temp === void 0 ? {} : _temp,\n Name = _ref.Name,\n Value = _ref.Value;\n\n this.Name = Name || '';\n this.Value = Value || '';\n }\n /**\n * @returns {string} the record's value.\n */\n\n\n var _proto = CognitoUserAttribute.prototype;\n\n _proto.getValue = function getValue() {\n return this.Value;\n }\n /**\n * Sets the record's value.\n * @param {string} value The new value.\n * @returns {CognitoUserAttribute} The record for method chaining.\n */\n ;\n\n _proto.setValue = function setValue(value) {\n this.Value = value;\n return this;\n }\n /**\n * @returns {string} the record's name.\n */\n ;\n\n _proto.getName = function getName() {\n return this.Name;\n }\n /**\n * Sets the record's name\n * @param {string} name The new name.\n * @returns {CognitoUserAttribute} The record for method chaining.\n */\n ;\n\n _proto.setName = function setName(name) {\n this.Name = name;\n return this;\n }\n /**\n * @returns {string} a string representation of the record.\n */\n ;\n\n _proto.toString = function toString() {\n return JSON.stringify(this);\n }\n /**\n * @returns {object} a flat object representing the record.\n */\n ;\n\n _proto.toJSON = function toJSON() {\n return {\n Name: this.Name,\n Value: this.Value\n };\n };\n\n return CognitoUserAttribute;\n}();\n\nexport { CognitoUserAttribute as default };","/*!\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nvar dataMemory = {};\n/** @class */\n\nexport var MemoryStorage = /*#__PURE__*/function () {\n function MemoryStorage() {}\n\n /**\n * This is used to set a specific item in storage\n * @param {string} key - the key for the item\n * @param {object} value - the value\n * @returns {string} value that was set\n */\n MemoryStorage.setItem = function setItem(key, value) {\n dataMemory[key] = value;\n return dataMemory[key];\n }\n /**\n * This is used to get a specific key from storage\n * @param {string} key - the key for the item\n * This is used to clear the storage\n * @returns {string} the data item\n */\n ;\n\n MemoryStorage.getItem = function getItem(key) {\n return Object.prototype.hasOwnProperty.call(dataMemory, key) ? dataMemory[key] : undefined;\n }\n /**\n * This is used to remove an item from storage\n * @param {string} key - the key being set\n * @returns {boolean} return true\n */\n ;\n\n MemoryStorage.removeItem = function removeItem(key) {\n return delete dataMemory[key];\n }\n /**\n * This is used to clear the storage\n * @returns {string} nothing\n */\n ;\n\n MemoryStorage.clear = function clear() {\n dataMemory = {};\n return dataMemory;\n };\n\n return MemoryStorage;\n}();\n/** @class */\n\nvar StorageHelper = /*#__PURE__*/function () {\n /**\n * This is used to get a storage object\n * @returns {object} the storage\n */\n function StorageHelper() {\n try {\n this.storageWindow = window.localStorage;\n this.storageWindow.setItem('aws.cognito.test-ls', 1);\n this.storageWindow.removeItem('aws.cognito.test-ls');\n } catch (exception) {\n this.storageWindow = MemoryStorage;\n }\n }\n /**\n * This is used to return the storage\n * @returns {object} the storage\n */\n\n\n var _proto = StorageHelper.prototype;\n\n _proto.getStorage = function getStorage() {\n return this.storageWindow;\n };\n\n return StorageHelper;\n}();\n\nexport { StorageHelper as default };","/*!\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { Buffer } from 'buffer';\nimport CryptoJS from 'crypto-js/core';\nimport TypedArrays from 'crypto-js/lib-typedarrays'; // necessary for crypto js\n\nimport Base64 from 'crypto-js/enc-base64';\nimport HmacSHA256 from 'crypto-js/hmac-sha256';\nimport BigInteger from './BigInteger';\nimport AuthenticationHelper from './AuthenticationHelper';\nimport CognitoAccessToken from './CognitoAccessToken';\nimport CognitoIdToken from './CognitoIdToken';\nimport CognitoRefreshToken from './CognitoRefreshToken';\nimport CognitoUserSession from './CognitoUserSession';\nimport DateHelper from './DateHelper';\nimport CognitoUserAttribute from './CognitoUserAttribute';\nimport StorageHelper from './StorageHelper';\n/**\n * @callback nodeCallback\n * @template T result\n * @param {*} err The operation failure reason, or null.\n * @param {T} result The operation result.\n */\n\n/**\n * @callback onFailure\n * @param {*} err Failure reason.\n */\n\n/**\n * @callback onSuccess\n * @template T result\n * @param {T} result The operation result.\n */\n\n/**\n * @callback mfaRequired\n * @param {*} details MFA challenge details.\n */\n\n/**\n * @callback customChallenge\n * @param {*} details Custom challenge details.\n */\n\n/**\n * @callback inputVerificationCode\n * @param {*} data Server response.\n */\n\n/**\n * @callback authSuccess\n * @param {CognitoUserSession} session The new session.\n * @param {bool=} userConfirmationNecessary User must be confirmed.\n */\n\nvar isBrowser = typeof navigator !== 'undefined';\nvar userAgent = isBrowser ? navigator.userAgent : 'nodejs';\n/** @class */\n\nvar CognitoUser = /*#__PURE__*/function () {\n /**\n * Constructs a new CognitoUser object\n * @param {object} data Creation options\n * @param {string} data.Username The user's username.\n * @param {CognitoUserPool} data.Pool Pool containing the user.\n * @param {object} data.Storage Optional storage object.\n */\n function CognitoUser(data) {\n if (data == null || data.Username == null || data.Pool == null) {\n throw new Error('Username and Pool information are required.');\n }\n\n this.username = data.Username || '';\n this.pool = data.Pool;\n this.Session = null;\n this.client = data.Pool.client;\n this.signInUserSession = null;\n this.authenticationFlowType = 'USER_SRP_AUTH';\n this.storage = data.Storage || new StorageHelper().getStorage();\n this.keyPrefix = \"CognitoIdentityServiceProvider.\" + this.pool.getClientId();\n this.userDataKey = this.keyPrefix + \".\" + this.username + \".userData\";\n }\n /**\n * Sets the session for this user\n * @param {CognitoUserSession} signInUserSession the session\n * @returns {void}\n */\n\n\n var _proto = CognitoUser.prototype;\n\n _proto.setSignInUserSession = function setSignInUserSession(signInUserSession) {\n this.clearCachedUserData();\n this.signInUserSession = signInUserSession;\n this.cacheTokens();\n }\n /**\n * @returns {CognitoUserSession} the current session for this user\n */\n ;\n\n _proto.getSignInUserSession = function getSignInUserSession() {\n return this.signInUserSession;\n }\n /**\n * @returns {string} the user's username\n */\n ;\n\n _proto.getUsername = function getUsername() {\n return this.username;\n }\n /**\n * @returns {String} the authentication flow type\n */\n ;\n\n _proto.getAuthenticationFlowType = function getAuthenticationFlowType() {\n return this.authenticationFlowType;\n }\n /**\n * sets authentication flow type\n * @param {string} authenticationFlowType New value.\n * @returns {void}\n */\n ;\n\n _proto.setAuthenticationFlowType = function setAuthenticationFlowType(authenticationFlowType) {\n this.authenticationFlowType = authenticationFlowType;\n }\n /**\n * This is used for authenticating the user through the custom authentication flow.\n * @param {AuthenticationDetails} authDetails Contains the authentication data\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {customChallenge} callback.customChallenge Custom challenge\n * response required to continue.\n * @param {authSuccess} callback.onSuccess Called on success with the new session.\n * @returns {void}\n */\n ;\n\n _proto.initiateAuth = function initiateAuth(authDetails, callback) {\n var _this = this;\n\n var authParameters = authDetails.getAuthParameters();\n authParameters.USERNAME = this.username;\n var clientMetaData = Object.keys(authDetails.getValidationData()).length !== 0 ? authDetails.getValidationData() : authDetails.getClientMetadata();\n var jsonReq = {\n AuthFlow: 'CUSTOM_AUTH',\n ClientId: this.pool.getClientId(),\n AuthParameters: authParameters,\n ClientMetadata: clientMetaData\n };\n\n if (this.getUserContextData()) {\n jsonReq.UserContextData = this.getUserContextData();\n }\n\n this.client.request('InitiateAuth', jsonReq, function (err, data) {\n if (err) {\n return callback.onFailure(err);\n }\n\n var challengeName = data.ChallengeName;\n var challengeParameters = data.ChallengeParameters;\n\n if (challengeName === 'CUSTOM_CHALLENGE') {\n _this.Session = data.Session;\n return callback.customChallenge(challengeParameters);\n }\n\n _this.signInUserSession = _this.getCognitoUserSession(data.AuthenticationResult);\n\n _this.cacheTokens();\n\n return callback.onSuccess(_this.signInUserSession);\n });\n }\n /**\n * This is used for authenticating the user.\n * stuff\n * @param {AuthenticationDetails} authDetails Contains the authentication data\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {newPasswordRequired} callback.newPasswordRequired new\n * password and any required attributes are required to continue\n * @param {mfaRequired} callback.mfaRequired MFA code\n * required to continue.\n * @param {customChallenge} callback.customChallenge Custom challenge\n * response required to continue.\n * @param {authSuccess} callback.onSuccess Called on success with the new session.\n * @returns {void}\n */\n ;\n\n _proto.authenticateUser = function authenticateUser(authDetails, callback) {\n if (this.authenticationFlowType === 'USER_PASSWORD_AUTH') {\n return this.authenticateUserPlainUsernamePassword(authDetails, callback);\n } else if (this.authenticationFlowType === 'USER_SRP_AUTH' || this.authenticationFlowType === 'CUSTOM_AUTH') {\n return this.authenticateUserDefaultAuth(authDetails, callback);\n }\n\n return callback.onFailure(new Error('Authentication flow type is invalid.'));\n }\n /**\n * PRIVATE ONLY: This is an internal only method and should not\n * be directly called by the consumers.\n * It calls the AuthenticationHelper for SRP related\n * stuff\n * @param {AuthenticationDetails} authDetails Contains the authentication data\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {newPasswordRequired} callback.newPasswordRequired new\n * password and any required attributes are required to continue\n * @param {mfaRequired} callback.mfaRequired MFA code\n * required to continue.\n * @param {customChallenge} callback.customChallenge Custom challenge\n * response required to continue.\n * @param {authSuccess} callback.onSuccess Called on success with the new session.\n * @returns {void}\n */\n ;\n\n _proto.authenticateUserDefaultAuth = function authenticateUserDefaultAuth(authDetails, callback) {\n var _this2 = this;\n\n var authenticationHelper = new AuthenticationHelper(this.pool.getUserPoolId().split('_')[1]);\n var dateHelper = new DateHelper();\n var serverBValue;\n var salt;\n var authParameters = {};\n\n if (this.deviceKey != null) {\n authParameters.DEVICE_KEY = this.deviceKey;\n }\n\n authParameters.USERNAME = this.username;\n authenticationHelper.getLargeAValue(function (errOnAValue, aValue) {\n // getLargeAValue callback start\n if (errOnAValue) {\n callback.onFailure(errOnAValue);\n }\n\n authParameters.SRP_A = aValue.toString(16);\n\n if (_this2.authenticationFlowType === 'CUSTOM_AUTH') {\n authParameters.CHALLENGE_NAME = 'SRP_A';\n }\n\n var clientMetaData = Object.keys(authDetails.getValidationData()).length !== 0 ? authDetails.getValidationData() : authDetails.getClientMetadata();\n var jsonReq = {\n AuthFlow: _this2.authenticationFlowType,\n ClientId: _this2.pool.getClientId(),\n AuthParameters: authParameters,\n ClientMetadata: clientMetaData\n };\n\n if (_this2.getUserContextData(_this2.username)) {\n jsonReq.UserContextData = _this2.getUserContextData(_this2.username);\n }\n\n _this2.client.request('InitiateAuth', jsonReq, function (err, data) {\n if (err) {\n return callback.onFailure(err);\n }\n\n var challengeParameters = data.ChallengeParameters;\n _this2.username = challengeParameters.USER_ID_FOR_SRP;\n _this2.userDataKey = _this2.keyPrefix + \".\" + _this2.username + \".userData\";\n serverBValue = new BigInteger(challengeParameters.SRP_B, 16);\n salt = new BigInteger(challengeParameters.SALT, 16);\n\n _this2.getCachedDeviceKeyAndPassword();\n\n authenticationHelper.getPasswordAuthenticationKey(_this2.username, authDetails.getPassword(), serverBValue, salt, function (errOnHkdf, hkdf) {\n // getPasswordAuthenticationKey callback start\n if (errOnHkdf) {\n callback.onFailure(errOnHkdf);\n }\n\n var dateNow = dateHelper.getNowString();\n var message = CryptoJS.lib.WordArray.create(Buffer.concat([Buffer.from(_this2.pool.getUserPoolId().split('_')[1], 'utf8'), Buffer.from(_this2.username, 'utf8'), Buffer.from(challengeParameters.SECRET_BLOCK, 'base64'), Buffer.from(dateNow, 'utf8')]));\n var key = CryptoJS.lib.WordArray.create(hkdf);\n var signatureString = Base64.stringify(HmacSHA256(message, key));\n var challengeResponses = {};\n challengeResponses.USERNAME = _this2.username;\n challengeResponses.PASSWORD_CLAIM_SECRET_BLOCK = challengeParameters.SECRET_BLOCK;\n challengeResponses.TIMESTAMP = dateNow;\n challengeResponses.PASSWORD_CLAIM_SIGNATURE = signatureString;\n\n if (_this2.deviceKey != null) {\n challengeResponses.DEVICE_KEY = _this2.deviceKey;\n }\n\n var respondToAuthChallenge = function respondToAuthChallenge(challenge, challengeCallback) {\n return _this2.client.request('RespondToAuthChallenge', challenge, function (errChallenge, dataChallenge) {\n if (errChallenge && errChallenge.code === 'ResourceNotFoundException' && errChallenge.message.toLowerCase().indexOf('device') !== -1) {\n challengeResponses.DEVICE_KEY = null;\n _this2.deviceKey = null;\n _this2.randomPassword = null;\n _this2.deviceGroupKey = null;\n\n _this2.clearCachedDeviceKeyAndPassword();\n\n return respondToAuthChallenge(challenge, challengeCallback);\n }\n\n return challengeCallback(errChallenge, dataChallenge);\n });\n };\n\n var jsonReqResp = {\n ChallengeName: 'PASSWORD_VERIFIER',\n ClientId: _this2.pool.getClientId(),\n ChallengeResponses: challengeResponses,\n Session: data.Session,\n ClientMetadata: clientMetaData\n };\n\n if (_this2.getUserContextData()) {\n jsonReqResp.UserContextData = _this2.getUserContextData();\n }\n\n respondToAuthChallenge(jsonReqResp, function (errAuthenticate, dataAuthenticate) {\n if (errAuthenticate) {\n return callback.onFailure(errAuthenticate);\n }\n\n return _this2.authenticateUserInternal(dataAuthenticate, authenticationHelper, callback);\n });\n return undefined; // getPasswordAuthenticationKey callback end\n });\n return undefined;\n }); // getLargeAValue callback end\n\n });\n }\n /**\n * PRIVATE ONLY: This is an internal only method and should not\n * be directly called by the consumers.\n * @param {AuthenticationDetails} authDetails Contains the authentication data.\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {mfaRequired} callback.mfaRequired MFA code\n * required to continue.\n * @param {authSuccess} callback.onSuccess Called on success with the new session.\n * @returns {void}\n */\n ;\n\n _proto.authenticateUserPlainUsernamePassword = function authenticateUserPlainUsernamePassword(authDetails, callback) {\n var _this3 = this;\n\n var authParameters = {};\n authParameters.USERNAME = this.username;\n authParameters.PASSWORD = authDetails.getPassword();\n\n if (!authParameters.PASSWORD) {\n callback.onFailure(new Error('PASSWORD parameter is required'));\n return;\n }\n\n var authenticationHelper = new AuthenticationHelper(this.pool.getUserPoolId().split('_')[1]);\n this.getCachedDeviceKeyAndPassword();\n\n if (this.deviceKey != null) {\n authParameters.DEVICE_KEY = this.deviceKey;\n }\n\n var clientMetaData = Object.keys(authDetails.getValidationData()).length !== 0 ? authDetails.getValidationData() : authDetails.getClientMetadata();\n var jsonReq = {\n AuthFlow: 'USER_PASSWORD_AUTH',\n ClientId: this.pool.getClientId(),\n AuthParameters: authParameters,\n ClientMetadata: clientMetaData\n };\n\n if (this.getUserContextData(this.username)) {\n jsonReq.UserContextData = this.getUserContextData(this.username);\n } // USER_PASSWORD_AUTH happens in a single round-trip: client sends userName and password,\n // Cognito UserPools verifies password and returns tokens.\n\n\n this.client.request('InitiateAuth', jsonReq, function (err, authResult) {\n if (err) {\n return callback.onFailure(err);\n }\n\n return _this3.authenticateUserInternal(authResult, authenticationHelper, callback);\n });\n }\n /**\n * PRIVATE ONLY: This is an internal only method and should not\n * be directly called by the consumers.\n * @param {object} dataAuthenticate authentication data\n * @param {object} authenticationHelper helper created\n * @param {callback} callback passed on from caller\n * @returns {void}\n */\n ;\n\n _proto.authenticateUserInternal = function authenticateUserInternal(dataAuthenticate, authenticationHelper, callback) {\n var _this4 = this;\n\n var challengeName = dataAuthenticate.ChallengeName;\n var challengeParameters = dataAuthenticate.ChallengeParameters;\n\n if (challengeName === 'SMS_MFA') {\n this.Session = dataAuthenticate.Session;\n return callback.mfaRequired(challengeName, challengeParameters);\n }\n\n if (challengeName === 'SELECT_MFA_TYPE') {\n this.Session = dataAuthenticate.Session;\n return callback.selectMFAType(challengeName, challengeParameters);\n }\n\n if (challengeName === 'MFA_SETUP') {\n this.Session = dataAuthenticate.Session;\n return callback.mfaSetup(challengeName, challengeParameters);\n }\n\n if (challengeName === 'SOFTWARE_TOKEN_MFA') {\n this.Session = dataAuthenticate.Session;\n return callback.totpRequired(challengeName, challengeParameters);\n }\n\n if (challengeName === 'CUSTOM_CHALLENGE') {\n this.Session = dataAuthenticate.Session;\n return callback.customChallenge(challengeParameters);\n }\n\n if (challengeName === 'NEW_PASSWORD_REQUIRED') {\n this.Session = dataAuthenticate.Session;\n var userAttributes = null;\n var rawRequiredAttributes = null;\n var requiredAttributes = [];\n var userAttributesPrefix = authenticationHelper.getNewPasswordRequiredChallengeUserAttributePrefix();\n\n if (challengeParameters) {\n userAttributes = JSON.parse(dataAuthenticate.ChallengeParameters.userAttributes);\n rawRequiredAttributes = JSON.parse(dataAuthenticate.ChallengeParameters.requiredAttributes);\n }\n\n if (rawRequiredAttributes) {\n for (var i = 0; i < rawRequiredAttributes.length; i++) {\n requiredAttributes[i] = rawRequiredAttributes[i].substr(userAttributesPrefix.length);\n }\n }\n\n return callback.newPasswordRequired(userAttributes, requiredAttributes);\n }\n\n if (challengeName === 'DEVICE_SRP_AUTH') {\n this.Session = dataAuthenticate.Session;\n this.getDeviceResponse(callback);\n return undefined;\n }\n\n this.signInUserSession = this.getCognitoUserSession(dataAuthenticate.AuthenticationResult);\n this.challengeName = challengeName;\n this.cacheTokens();\n var newDeviceMetadata = dataAuthenticate.AuthenticationResult.NewDeviceMetadata;\n\n if (newDeviceMetadata == null) {\n return callback.onSuccess(this.signInUserSession);\n }\n\n authenticationHelper.generateHashDevice(dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey, dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey, function (errGenHash) {\n if (errGenHash) {\n return callback.onFailure(errGenHash);\n }\n\n var deviceSecretVerifierConfig = {\n Salt: Buffer.from(authenticationHelper.getSaltDevices(), 'hex').toString('base64'),\n PasswordVerifier: Buffer.from(authenticationHelper.getVerifierDevices(), 'hex').toString('base64')\n };\n _this4.verifierDevices = deviceSecretVerifierConfig.PasswordVerifier;\n _this4.deviceGroupKey = newDeviceMetadata.DeviceGroupKey;\n _this4.randomPassword = authenticationHelper.getRandomPassword();\n\n _this4.client.request('ConfirmDevice', {\n DeviceKey: newDeviceMetadata.DeviceKey,\n AccessToken: _this4.signInUserSession.getAccessToken().getJwtToken(),\n DeviceSecretVerifierConfig: deviceSecretVerifierConfig,\n DeviceName: userAgent\n }, function (errConfirm, dataConfirm) {\n if (errConfirm) {\n return callback.onFailure(errConfirm);\n }\n\n _this4.deviceKey = dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey;\n\n _this4.cacheDeviceKeyAndPassword();\n\n if (dataConfirm.UserConfirmationNecessary === true) {\n return callback.onSuccess(_this4.signInUserSession, dataConfirm.UserConfirmationNecessary);\n }\n\n return callback.onSuccess(_this4.signInUserSession);\n });\n\n return undefined;\n });\n return undefined;\n }\n /**\n * This method is user to complete the NEW_PASSWORD_REQUIRED challenge.\n * Pass the new password with any new user attributes to be updated.\n * User attribute keys must be of format userAttributes..\n * @param {string} newPassword new password for this user\n * @param {object} requiredAttributeData map with values for all required attributes\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {mfaRequired} callback.mfaRequired MFA code required to continue.\n * @param {customChallenge} callback.customChallenge Custom challenge\n * response required to continue.\n * @param {authSuccess} callback.onSuccess Called on success with the new session.\n * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n * @returns {void}\n */\n ;\n\n _proto.completeNewPasswordChallenge = function completeNewPasswordChallenge(newPassword, requiredAttributeData, callback, clientMetadata) {\n var _this5 = this;\n\n if (!newPassword) {\n return callback.onFailure(new Error('New password is required.'));\n }\n\n var authenticationHelper = new AuthenticationHelper(this.pool.getUserPoolId().split('_')[1]);\n var userAttributesPrefix = authenticationHelper.getNewPasswordRequiredChallengeUserAttributePrefix();\n var finalUserAttributes = {};\n\n if (requiredAttributeData) {\n Object.keys(requiredAttributeData).forEach(function (key) {\n finalUserAttributes[userAttributesPrefix + key] = requiredAttributeData[key];\n });\n }\n\n finalUserAttributes.NEW_PASSWORD = newPassword;\n finalUserAttributes.USERNAME = this.username;\n var jsonReq = {\n ChallengeName: 'NEW_PASSWORD_REQUIRED',\n ClientId: this.pool.getClientId(),\n ChallengeResponses: finalUserAttributes,\n Session: this.Session,\n ClientMetadata: clientMetadata\n };\n\n if (this.getUserContextData()) {\n jsonReq.UserContextData = this.getUserContextData();\n }\n\n this.client.request('RespondToAuthChallenge', jsonReq, function (errAuthenticate, dataAuthenticate) {\n if (errAuthenticate) {\n return callback.onFailure(errAuthenticate);\n }\n\n return _this5.authenticateUserInternal(dataAuthenticate, authenticationHelper, callback);\n });\n return undefined;\n }\n /**\n * This is used to get a session using device authentication. It is called at the end of user\n * authentication\n *\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {authSuccess} callback.onSuccess Called on success with the new session.\n * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n * @returns {void}\n * @private\n */\n ;\n\n _proto.getDeviceResponse = function getDeviceResponse(callback, clientMetadata) {\n var _this6 = this;\n\n var authenticationHelper = new AuthenticationHelper(this.deviceGroupKey);\n var dateHelper = new DateHelper();\n var authParameters = {};\n authParameters.USERNAME = this.username;\n authParameters.DEVICE_KEY = this.deviceKey;\n authenticationHelper.getLargeAValue(function (errAValue, aValue) {\n // getLargeAValue callback start\n if (errAValue) {\n callback.onFailure(errAValue);\n }\n\n authParameters.SRP_A = aValue.toString(16);\n var jsonReq = {\n ChallengeName: 'DEVICE_SRP_AUTH',\n ClientId: _this6.pool.getClientId(),\n ChallengeResponses: authParameters,\n ClientMetadata: clientMetadata,\n Session: _this6.Session\n };\n\n if (_this6.getUserContextData()) {\n jsonReq.UserContextData = _this6.getUserContextData();\n }\n\n _this6.client.request('RespondToAuthChallenge', jsonReq, function (err, data) {\n if (err) {\n return callback.onFailure(err);\n }\n\n var challengeParameters = data.ChallengeParameters;\n var serverBValue = new BigInteger(challengeParameters.SRP_B, 16);\n var salt = new BigInteger(challengeParameters.SALT, 16);\n authenticationHelper.getPasswordAuthenticationKey(_this6.deviceKey, _this6.randomPassword, serverBValue, salt, function (errHkdf, hkdf) {\n // getPasswordAuthenticationKey callback start\n if (errHkdf) {\n return callback.onFailure(errHkdf);\n }\n\n var dateNow = dateHelper.getNowString();\n var message = CryptoJS.lib.WordArray.create(Buffer.concat([Buffer.from(_this6.deviceGroupKey, 'utf8'), Buffer.from(_this6.deviceKey, 'utf8'), Buffer.from(challengeParameters.SECRET_BLOCK, 'base64'), Buffer.from(dateNow, 'utf8')]));\n var key = CryptoJS.lib.WordArray.create(hkdf);\n var signatureString = Base64.stringify(HmacSHA256(message, key));\n var challengeResponses = {};\n challengeResponses.USERNAME = _this6.username;\n challengeResponses.PASSWORD_CLAIM_SECRET_BLOCK = challengeParameters.SECRET_BLOCK;\n challengeResponses.TIMESTAMP = dateNow;\n challengeResponses.PASSWORD_CLAIM_SIGNATURE = signatureString;\n challengeResponses.DEVICE_KEY = _this6.deviceKey;\n var jsonReqResp = {\n ChallengeName: 'DEVICE_PASSWORD_VERIFIER',\n ClientId: _this6.pool.getClientId(),\n ChallengeResponses: challengeResponses,\n Session: data.Session\n };\n\n if (_this6.getUserContextData()) {\n jsonReqResp.UserContextData = _this6.getUserContextData();\n }\n\n _this6.client.request('RespondToAuthChallenge', jsonReqResp, function (errAuthenticate, dataAuthenticate) {\n if (errAuthenticate) {\n return callback.onFailure(errAuthenticate);\n }\n\n _this6.signInUserSession = _this6.getCognitoUserSession(dataAuthenticate.AuthenticationResult);\n\n _this6.cacheTokens();\n\n return callback.onSuccess(_this6.signInUserSession);\n });\n\n return undefined; // getPasswordAuthenticationKey callback end\n });\n return undefined;\n }); // getLargeAValue callback end\n\n });\n }\n /**\n * This is used for a certain user to confirm the registration by using a confirmation code\n * @param {string} confirmationCode Code entered by user.\n * @param {bool} forceAliasCreation Allow migrating from an existing email / phone number.\n * @param {nodeCallback} callback Called on success or error.\n * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n * @returns {void}\n */\n ;\n\n _proto.confirmRegistration = function confirmRegistration(confirmationCode, forceAliasCreation, callback, clientMetadata) {\n var jsonReq = {\n ClientId: this.pool.getClientId(),\n ConfirmationCode: confirmationCode,\n Username: this.username,\n ForceAliasCreation: forceAliasCreation,\n ClientMetadata: clientMetadata\n };\n\n if (this.getUserContextData()) {\n jsonReq.UserContextData = this.getUserContextData();\n }\n\n this.client.request('ConfirmSignUp', jsonReq, function (err) {\n if (err) {\n return callback(err, null);\n }\n\n return callback(null, 'SUCCESS');\n });\n }\n /**\n * This is used by the user once he has the responses to a custom challenge\n * @param {string} answerChallenge The custom challenge answer.\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {customChallenge} callback.customChallenge\n * Custom challenge response required to continue.\n * @param {authSuccess} callback.onSuccess Called on success with the new session.\n * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n * @returns {void}\n */\n ;\n\n _proto.sendCustomChallengeAnswer = function sendCustomChallengeAnswer(answerChallenge, callback, clientMetadata) {\n var _this7 = this;\n\n var challengeResponses = {};\n challengeResponses.USERNAME = this.username;\n challengeResponses.ANSWER = answerChallenge;\n var authenticationHelper = new AuthenticationHelper(this.pool.getUserPoolId().split('_')[1]);\n this.getCachedDeviceKeyAndPassword();\n\n if (this.deviceKey != null) {\n challengeResponses.DEVICE_KEY = this.deviceKey;\n }\n\n var jsonReq = {\n ChallengeName: 'CUSTOM_CHALLENGE',\n ChallengeResponses: challengeResponses,\n ClientId: this.pool.getClientId(),\n Session: this.Session,\n ClientMetadata: clientMetadata\n };\n\n if (this.getUserContextData()) {\n jsonReq.UserContextData = this.getUserContextData();\n }\n\n this.client.request('RespondToAuthChallenge', jsonReq, function (err, data) {\n if (err) {\n return callback.onFailure(err);\n }\n\n return _this7.authenticateUserInternal(data, authenticationHelper, callback);\n });\n }\n /**\n * This is used by the user once he has an MFA code\n * @param {string} confirmationCode The MFA code entered by the user.\n * @param {object} callback Result callback map.\n * @param {string} mfaType The mfa we are replying to.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {authSuccess} callback.onSuccess Called on success with the new session.\n * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n * @returns {void}\n */\n ;\n\n _proto.sendMFACode = function sendMFACode(confirmationCode, callback, mfaType, clientMetadata) {\n var _this8 = this;\n\n var challengeResponses = {};\n challengeResponses.USERNAME = this.username;\n challengeResponses.SMS_MFA_CODE = confirmationCode;\n var mfaTypeSelection = mfaType || 'SMS_MFA';\n\n if (mfaTypeSelection === 'SOFTWARE_TOKEN_MFA') {\n challengeResponses.SOFTWARE_TOKEN_MFA_CODE = confirmationCode;\n }\n\n if (this.deviceKey != null) {\n challengeResponses.DEVICE_KEY = this.deviceKey;\n }\n\n var jsonReq = {\n ChallengeName: mfaTypeSelection,\n ChallengeResponses: challengeResponses,\n ClientId: this.pool.getClientId(),\n Session: this.Session,\n ClientMetadata: clientMetadata\n };\n\n if (this.getUserContextData()) {\n jsonReq.UserContextData = this.getUserContextData();\n }\n\n this.client.request('RespondToAuthChallenge', jsonReq, function (err, dataAuthenticate) {\n if (err) {\n return callback.onFailure(err);\n }\n\n var challengeName = dataAuthenticate.ChallengeName;\n\n if (challengeName === 'DEVICE_SRP_AUTH') {\n _this8.getDeviceResponse(callback);\n\n return undefined;\n }\n\n _this8.signInUserSession = _this8.getCognitoUserSession(dataAuthenticate.AuthenticationResult);\n\n _this8.cacheTokens();\n\n if (dataAuthenticate.AuthenticationResult.NewDeviceMetadata == null) {\n return callback.onSuccess(_this8.signInUserSession);\n }\n\n var authenticationHelper = new AuthenticationHelper(_this8.pool.getUserPoolId().split('_')[1]);\n authenticationHelper.generateHashDevice(dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey, dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey, function (errGenHash) {\n if (errGenHash) {\n return callback.onFailure(errGenHash);\n }\n\n var deviceSecretVerifierConfig = {\n Salt: Buffer.from(authenticationHelper.getSaltDevices(), 'hex').toString('base64'),\n PasswordVerifier: Buffer.from(authenticationHelper.getVerifierDevices(), 'hex').toString('base64')\n };\n _this8.verifierDevices = deviceSecretVerifierConfig.PasswordVerifier;\n _this8.deviceGroupKey = dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey;\n _this8.randomPassword = authenticationHelper.getRandomPassword();\n\n _this8.client.request('ConfirmDevice', {\n DeviceKey: dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey,\n AccessToken: _this8.signInUserSession.getAccessToken().getJwtToken(),\n DeviceSecretVerifierConfig: deviceSecretVerifierConfig,\n DeviceName: userAgent\n }, function (errConfirm, dataConfirm) {\n if (errConfirm) {\n return callback.onFailure(errConfirm);\n }\n\n _this8.deviceKey = dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey;\n\n _this8.cacheDeviceKeyAndPassword();\n\n if (dataConfirm.UserConfirmationNecessary === true) {\n return callback.onSuccess(_this8.signInUserSession, dataConfirm.UserConfirmationNecessary);\n }\n\n return callback.onSuccess(_this8.signInUserSession);\n });\n\n return undefined;\n });\n return undefined;\n });\n }\n /**\n * This is used by an authenticated user to change the current password\n * @param {string} oldUserPassword The current password.\n * @param {string} newUserPassword The requested new password.\n * @param {nodeCallback} callback Called on success or error.\n * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n * @returns {void}\n */\n ;\n\n _proto.changePassword = function changePassword(oldUserPassword, newUserPassword, callback, clientMetadata) {\n if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n return callback(new Error('User is not authenticated'), null);\n }\n\n this.client.request('ChangePassword', {\n PreviousPassword: oldUserPassword,\n ProposedPassword: newUserPassword,\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n ClientMetadata: clientMetadata\n }, function (err) {\n if (err) {\n return callback(err, null);\n }\n\n return callback(null, 'SUCCESS');\n });\n return undefined;\n }\n /**\n * This is used by an authenticated user to enable MFA for itself\n * @deprecated\n * @param {nodeCallback} callback Called on success or error.\n * @returns {void}\n */\n ;\n\n _proto.enableMFA = function enableMFA(callback) {\n if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n return callback(new Error('User is not authenticated'), null);\n }\n\n var mfaOptions = [];\n var mfaEnabled = {\n DeliveryMedium: 'SMS',\n AttributeName: 'phone_number'\n };\n mfaOptions.push(mfaEnabled);\n this.client.request('SetUserSettings', {\n MFAOptions: mfaOptions,\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n }, function (err) {\n if (err) {\n return callback(err, null);\n }\n\n return callback(null, 'SUCCESS');\n });\n return undefined;\n }\n /**\n * This is used by an authenticated user to enable MFA for itself\n * @param {IMfaSettings} smsMfaSettings the sms mfa settings\n * @param {IMFASettings} softwareTokenMfaSettings the software token mfa settings\n * @param {nodeCallback} callback Called on success or error.\n * @returns {void}\n */\n ;\n\n _proto.setUserMfaPreference = function setUserMfaPreference(smsMfaSettings, softwareTokenMfaSettings, callback) {\n if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n return callback(new Error('User is not authenticated'), null);\n }\n\n this.client.request('SetUserMFAPreference', {\n SMSMfaSettings: smsMfaSettings,\n SoftwareTokenMfaSettings: softwareTokenMfaSettings,\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n }, function (err) {\n if (err) {\n return callback(err, null);\n }\n\n return callback(null, 'SUCCESS');\n });\n return undefined;\n }\n /**\n * This is used by an authenticated user to disable MFA for itself\n * @deprecated\n * @param {nodeCallback} callback Called on success or error.\n * @returns {void}\n */\n ;\n\n _proto.disableMFA = function disableMFA(callback) {\n if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n return callback(new Error('User is not authenticated'), null);\n }\n\n var mfaOptions = [];\n this.client.request('SetUserSettings', {\n MFAOptions: mfaOptions,\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n }, function (err) {\n if (err) {\n return callback(err, null);\n }\n\n return callback(null, 'SUCCESS');\n });\n return undefined;\n }\n /**\n * This is used by an authenticated user to delete itself\n * @param {nodeCallback} callback Called on success or error.\n * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n * @returns {void}\n */\n ;\n\n _proto.deleteUser = function deleteUser(callback, clientMetadata) {\n var _this9 = this;\n\n if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n return callback(new Error('User is not authenticated'), null);\n }\n\n this.client.request('DeleteUser', {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n ClientMetadata: clientMetadata\n }, function (err) {\n if (err) {\n return callback(err, null);\n }\n\n _this9.clearCachedUser();\n\n return callback(null, 'SUCCESS');\n });\n return undefined;\n }\n /**\n * @typedef {CognitoUserAttribute | { Name:string, Value:string }} AttributeArg\n */\n\n /**\n * This is used by an authenticated user to change a list of attributes\n * @param {AttributeArg[]} attributes A list of the new user attributes.\n * @param {nodeCallback} callback Called on success or error.\n * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n * @returns {void}\n */\n ;\n\n _proto.updateAttributes = function updateAttributes(attributes, callback, clientMetadata) {\n var _this10 = this;\n\n if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n return callback(new Error('User is not authenticated'), null);\n }\n\n this.client.request('UpdateUserAttributes', {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n UserAttributes: attributes,\n ClientMetadata: clientMetadata\n }, function (err) {\n if (err) {\n return callback(err, null);\n } // update cached user\n\n\n return _this10.getUserData(function () {\n return callback(null, 'SUCCESS');\n }, {\n bypassCache: true\n });\n });\n return undefined;\n }\n /**\n * This is used by an authenticated user to get a list of attributes\n * @param {nodeCallback} callback Called on success or error.\n * @returns {void}\n */\n ;\n\n _proto.getUserAttributes = function getUserAttributes(callback) {\n if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n return callback(new Error('User is not authenticated'), null);\n }\n\n this.client.request('GetUser', {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n }, function (err, userData) {\n if (err) {\n return callback(err, null);\n }\n\n var attributeList = [];\n\n for (var i = 0; i < userData.UserAttributes.length; i++) {\n var attribute = {\n Name: userData.UserAttributes[i].Name,\n Value: userData.UserAttributes[i].Value\n };\n var userAttribute = new CognitoUserAttribute(attribute);\n attributeList.push(userAttribute);\n }\n\n return callback(null, attributeList);\n });\n return undefined;\n }\n /**\n * This was previously used by an authenticated user to get MFAOptions,\n * but no longer returns a meaningful response. Refer to the documentation for\n * how to setup and use MFA: https://docs.amplify.aws/lib/auth/mfa/q/platform/js\n * @deprecated\n * @param {nodeCallback} callback Called on success or error.\n * @returns {void}\n */\n ;\n\n _proto.getMFAOptions = function getMFAOptions(callback) {\n if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n return callback(new Error('User is not authenticated'), null);\n }\n\n this.client.request('GetUser', {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n }, function (err, userData) {\n if (err) {\n return callback(err, null);\n }\n\n return callback(null, userData.MFAOptions);\n });\n return undefined;\n }\n /**\n * PRIVATE ONLY: This is an internal only method and should not\n * be directly called by the consumers.\n */\n ;\n\n _proto.createGetUserRequest = function createGetUserRequest() {\n return this.client.promisifyRequest('GetUser', {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n });\n }\n /**\n * PRIVATE ONLY: This is an internal only method and should not\n * be directly called by the consumers.\n */\n ;\n\n _proto.refreshSessionIfPossible = function refreshSessionIfPossible(options) {\n var _this11 = this;\n\n if (options === void 0) {\n options = {};\n }\n\n // best effort, if not possible\n return new Promise(function (resolve) {\n var refresh = _this11.signInUserSession.getRefreshToken();\n\n if (refresh && refresh.getToken()) {\n _this11.refreshSession(refresh, resolve, options.clientMetadata);\n } else {\n resolve();\n }\n });\n }\n /**\n * @typedef {Object} GetUserDataOptions\n * @property {boolean} bypassCache - force getting data from Cognito service\n * @property {Record} clientMetadata - clientMetadata for getSession\n */\n\n /**\n * This is used by an authenticated users to get the userData\n * @param {nodeCallback} callback Called on success or error.\n * @param {GetUserDataOptions} params\n * @returns {void}\n */\n ;\n\n _proto.getUserData = function getUserData(callback, params) {\n var _this12 = this;\n\n if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n this.clearCachedUserData();\n return callback(new Error('User is not authenticated'), null);\n }\n\n var userData = this.getUserDataFromCache();\n\n if (!userData) {\n this.fetchUserData().then(function (data) {\n callback(null, data);\n })[\"catch\"](callback);\n return;\n }\n\n if (this.isFetchUserDataAndTokenRequired(params)) {\n this.fetchUserData().then(function (data) {\n return _this12.refreshSessionIfPossible(params).then(function () {\n return data;\n });\n }).then(function (data) {\n return callback(null, data);\n })[\"catch\"](callback);\n return;\n }\n\n try {\n callback(null, JSON.parse(userData));\n return;\n } catch (err) {\n this.clearCachedUserData();\n callback(err, null);\n return;\n }\n }\n /**\n *\n * PRIVATE ONLY: This is an internal only method and should not\n * be directly called by the consumers.\n */\n ;\n\n _proto.getUserDataFromCache = function getUserDataFromCache() {\n var userData = this.storage.getItem(this.userDataKey);\n return userData;\n }\n /**\n *\n * PRIVATE ONLY: This is an internal only method and should not\n * be directly called by the consumers.\n */\n ;\n\n _proto.isFetchUserDataAndTokenRequired = function isFetchUserDataAndTokenRequired(params) {\n var _ref = params || {},\n _ref$bypassCache = _ref.bypassCache,\n bypassCache = _ref$bypassCache === void 0 ? false : _ref$bypassCache;\n\n return bypassCache;\n }\n /**\n *\n * PRIVATE ONLY: This is an internal only method and should not\n * be directly called by the consumers.\n */\n ;\n\n _proto.fetchUserData = function fetchUserData() {\n var _this13 = this;\n\n return this.createGetUserRequest().then(function (data) {\n _this13.cacheUserData(data);\n\n return data;\n });\n }\n /**\n * This is used by an authenticated user to delete a list of attributes\n * @param {string[]} attributeList Names of the attributes to delete.\n * @param {nodeCallback} callback Called on success or error.\n * @returns {void}\n */\n ;\n\n _proto.deleteAttributes = function deleteAttributes(attributeList, callback) {\n var _this14 = this;\n\n if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n return callback(new Error('User is not authenticated'), null);\n }\n\n this.client.request('DeleteUserAttributes', {\n UserAttributeNames: attributeList,\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n }, function (err) {\n if (err) {\n return callback(err, null);\n } // update cached user\n\n\n return _this14.getUserData(function () {\n return callback(null, 'SUCCESS');\n }, {\n bypassCache: true\n });\n });\n return undefined;\n }\n /**\n * This is used by a user to resend a confirmation code\n * @param {nodeCallback} callback Called on success or error.\n * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n * @returns {void}\n */\n ;\n\n _proto.resendConfirmationCode = function resendConfirmationCode(callback, clientMetadata) {\n var jsonReq = {\n ClientId: this.pool.getClientId(),\n Username: this.username,\n ClientMetadata: clientMetadata\n };\n this.client.request('ResendConfirmationCode', jsonReq, function (err, result) {\n if (err) {\n return callback(err, null);\n }\n\n return callback(null, result);\n });\n }\n /**\n * @typedef {Object} GetSessionOptions\n * @property {Record} clientMetadata - clientMetadata for getSession\n */\n\n /**\n * This is used to get a session, either from the session object\n * or from the local storage, or by using a refresh token\n *\n * @param {nodeCallback} callback Called on success or error.\n * @param {GetSessionOptions} options\n * @returns {void}\n */\n ;\n\n _proto.getSession = function getSession(callback, options) {\n if (options === void 0) {\n options = {};\n }\n\n if (this.username == null) {\n return callback(new Error('Username is null. Cannot retrieve a new session'), null);\n }\n\n if (this.signInUserSession != null && this.signInUserSession.isValid()) {\n return callback(null, this.signInUserSession);\n }\n\n var keyPrefix = \"CognitoIdentityServiceProvider.\" + this.pool.getClientId() + \".\" + this.username;\n var idTokenKey = keyPrefix + \".idToken\";\n var accessTokenKey = keyPrefix + \".accessToken\";\n var refreshTokenKey = keyPrefix + \".refreshToken\";\n var clockDriftKey = keyPrefix + \".clockDrift\";\n\n if (this.storage.getItem(idTokenKey)) {\n var idToken = new CognitoIdToken({\n IdToken: this.storage.getItem(idTokenKey)\n });\n var accessToken = new CognitoAccessToken({\n AccessToken: this.storage.getItem(accessTokenKey)\n });\n var refreshToken = new CognitoRefreshToken({\n RefreshToken: this.storage.getItem(refreshTokenKey)\n });\n var clockDrift = parseInt(this.storage.getItem(clockDriftKey), 0) || 0;\n var sessionData = {\n IdToken: idToken,\n AccessToken: accessToken,\n RefreshToken: refreshToken,\n ClockDrift: clockDrift\n };\n var cachedSession = new CognitoUserSession(sessionData);\n\n if (cachedSession.isValid()) {\n this.signInUserSession = cachedSession;\n return callback(null, this.signInUserSession);\n }\n\n if (!refreshToken.getToken()) {\n return callback(new Error('Cannot retrieve a new session. Please authenticate.'), null);\n }\n\n this.refreshSession(refreshToken, callback, options.clientMetadata);\n } else {\n callback(new Error('Local storage is missing an ID Token, Please authenticate'), null);\n }\n\n return undefined;\n }\n /**\n * This uses the refreshToken to retrieve a new session\n * @param {CognitoRefreshToken} refreshToken A previous session's refresh token.\n * @param {nodeCallback} callback Called on success or error.\n * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n * @returns {void}\n */\n ;\n\n _proto.refreshSession = function refreshSession(refreshToken, callback, clientMetadata) {\n var _this15 = this;\n\n var wrappedCallback = this.pool.wrapRefreshSessionCallback ? this.pool.wrapRefreshSessionCallback(callback) : callback;\n var authParameters = {};\n authParameters.REFRESH_TOKEN = refreshToken.getToken();\n var keyPrefix = \"CognitoIdentityServiceProvider.\" + this.pool.getClientId();\n var lastUserKey = keyPrefix + \".LastAuthUser\";\n\n if (this.storage.getItem(lastUserKey)) {\n this.username = this.storage.getItem(lastUserKey);\n var deviceKeyKey = keyPrefix + \".\" + this.username + \".deviceKey\";\n this.deviceKey = this.storage.getItem(deviceKeyKey);\n authParameters.DEVICE_KEY = this.deviceKey;\n }\n\n var jsonReq = {\n ClientId: this.pool.getClientId(),\n AuthFlow: 'REFRESH_TOKEN_AUTH',\n AuthParameters: authParameters,\n ClientMetadata: clientMetadata\n };\n\n if (this.getUserContextData()) {\n jsonReq.UserContextData = this.getUserContextData();\n }\n\n this.client.request('InitiateAuth', jsonReq, function (err, authResult) {\n if (err) {\n if (err.code === 'NotAuthorizedException') {\n _this15.clearCachedUser();\n }\n\n return wrappedCallback(err, null);\n }\n\n if (authResult) {\n var authenticationResult = authResult.AuthenticationResult;\n\n if (!Object.prototype.hasOwnProperty.call(authenticationResult, 'RefreshToken')) {\n authenticationResult.RefreshToken = refreshToken.getToken();\n }\n\n _this15.signInUserSession = _this15.getCognitoUserSession(authenticationResult);\n\n _this15.cacheTokens();\n\n return wrappedCallback(null, _this15.signInUserSession);\n }\n\n return undefined;\n });\n }\n /**\n * This is used to save the session tokens to local storage\n * @returns {void}\n */\n ;\n\n _proto.cacheTokens = function cacheTokens() {\n var keyPrefix = \"CognitoIdentityServiceProvider.\" + this.pool.getClientId();\n var idTokenKey = keyPrefix + \".\" + this.username + \".idToken\";\n var accessTokenKey = keyPrefix + \".\" + this.username + \".accessToken\";\n var refreshTokenKey = keyPrefix + \".\" + this.username + \".refreshToken\";\n var clockDriftKey = keyPrefix + \".\" + this.username + \".clockDrift\";\n var lastUserKey = keyPrefix + \".LastAuthUser\";\n this.storage.setItem(idTokenKey, this.signInUserSession.getIdToken().getJwtToken());\n this.storage.setItem(accessTokenKey, this.signInUserSession.getAccessToken().getJwtToken());\n this.storage.setItem(refreshTokenKey, this.signInUserSession.getRefreshToken().getToken());\n this.storage.setItem(clockDriftKey, \"\" + this.signInUserSession.getClockDrift());\n this.storage.setItem(lastUserKey, this.username);\n }\n /**\n * This is to cache user data\n */\n ;\n\n _proto.cacheUserData = function cacheUserData(userData) {\n this.storage.setItem(this.userDataKey, JSON.stringify(userData));\n }\n /**\n * This is to remove cached user data\n */\n ;\n\n _proto.clearCachedUserData = function clearCachedUserData() {\n this.storage.removeItem(this.userDataKey);\n };\n\n _proto.clearCachedUser = function clearCachedUser() {\n this.clearCachedTokens();\n this.clearCachedUserData();\n }\n /**\n * This is used to cache the device key and device group and device password\n * @returns {void}\n */\n ;\n\n _proto.cacheDeviceKeyAndPassword = function cacheDeviceKeyAndPassword() {\n var keyPrefix = \"CognitoIdentityServiceProvider.\" + this.pool.getClientId() + \".\" + this.username;\n var deviceKeyKey = keyPrefix + \".deviceKey\";\n var randomPasswordKey = keyPrefix + \".randomPasswordKey\";\n var deviceGroupKeyKey = keyPrefix + \".deviceGroupKey\";\n this.storage.setItem(deviceKeyKey, this.deviceKey);\n this.storage.setItem(randomPasswordKey, this.randomPassword);\n this.storage.setItem(deviceGroupKeyKey, this.deviceGroupKey);\n }\n /**\n * This is used to get current device key and device group and device password\n * @returns {void}\n */\n ;\n\n _proto.getCachedDeviceKeyAndPassword = function getCachedDeviceKeyAndPassword() {\n var keyPrefix = \"CognitoIdentityServiceProvider.\" + this.pool.getClientId() + \".\" + this.username;\n var deviceKeyKey = keyPrefix + \".deviceKey\";\n var randomPasswordKey = keyPrefix + \".randomPasswordKey\";\n var deviceGroupKeyKey = keyPrefix + \".deviceGroupKey\";\n\n if (this.storage.getItem(deviceKeyKey)) {\n this.deviceKey = this.storage.getItem(deviceKeyKey);\n this.randomPassword = this.storage.getItem(randomPasswordKey);\n this.deviceGroupKey = this.storage.getItem(deviceGroupKeyKey);\n }\n }\n /**\n * This is used to clear the device key info from local storage\n * @returns {void}\n */\n ;\n\n _proto.clearCachedDeviceKeyAndPassword = function clearCachedDeviceKeyAndPassword() {\n var keyPrefix = \"CognitoIdentityServiceProvider.\" + this.pool.getClientId() + \".\" + this.username;\n var deviceKeyKey = keyPrefix + \".deviceKey\";\n var randomPasswordKey = keyPrefix + \".randomPasswordKey\";\n var deviceGroupKeyKey = keyPrefix + \".deviceGroupKey\";\n this.storage.removeItem(deviceKeyKey);\n this.storage.removeItem(randomPasswordKey);\n this.storage.removeItem(deviceGroupKeyKey);\n }\n /**\n * This is used to clear the session tokens from local storage\n * @returns {void}\n */\n ;\n\n _proto.clearCachedTokens = function clearCachedTokens() {\n var keyPrefix = \"CognitoIdentityServiceProvider.\" + this.pool.getClientId();\n var idTokenKey = keyPrefix + \".\" + this.username + \".idToken\";\n var accessTokenKey = keyPrefix + \".\" + this.username + \".accessToken\";\n var refreshTokenKey = keyPrefix + \".\" + this.username + \".refreshToken\";\n var lastUserKey = keyPrefix + \".LastAuthUser\";\n var clockDriftKey = keyPrefix + \".\" + this.username + \".clockDrift\";\n this.storage.removeItem(idTokenKey);\n this.storage.removeItem(accessTokenKey);\n this.storage.removeItem(refreshTokenKey);\n this.storage.removeItem(lastUserKey);\n this.storage.removeItem(clockDriftKey);\n }\n /**\n * This is used to build a user session from tokens retrieved in the authentication result\n * @param {object} authResult Successful auth response from server.\n * @returns {CognitoUserSession} The new user session.\n * @private\n */\n ;\n\n _proto.getCognitoUserSession = function getCognitoUserSession(authResult) {\n var idToken = new CognitoIdToken(authResult);\n var accessToken = new CognitoAccessToken(authResult);\n var refreshToken = new CognitoRefreshToken(authResult);\n var sessionData = {\n IdToken: idToken,\n AccessToken: accessToken,\n RefreshToken: refreshToken\n };\n return new CognitoUserSession(sessionData);\n }\n /**\n * This is used to initiate a forgot password request\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {inputVerificationCode?} callback.inputVerificationCode\n * Optional callback raised instead of onSuccess with response data.\n * @param {onSuccess} callback.onSuccess Called on success.\n * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n * @returns {void}\n */\n ;\n\n _proto.forgotPassword = function forgotPassword(callback, clientMetadata) {\n var jsonReq = {\n ClientId: this.pool.getClientId(),\n Username: this.username,\n ClientMetadata: clientMetadata\n };\n\n if (this.getUserContextData()) {\n jsonReq.UserContextData = this.getUserContextData();\n }\n\n this.client.request('ForgotPassword', jsonReq, function (err, data) {\n if (err) {\n return callback.onFailure(err);\n }\n\n if (typeof callback.inputVerificationCode === 'function') {\n return callback.inputVerificationCode(data);\n }\n\n return callback.onSuccess(data);\n });\n }\n /**\n * This is used to confirm a new password using a confirmationCode\n * @param {string} confirmationCode Code entered by user.\n * @param {string} newPassword Confirm new password.\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {onSuccess} callback.onSuccess Called on success.\n * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n * @returns {void}\n */\n ;\n\n _proto.confirmPassword = function confirmPassword(confirmationCode, newPassword, callback, clientMetadata) {\n var jsonReq = {\n ClientId: this.pool.getClientId(),\n Username: this.username,\n ConfirmationCode: confirmationCode,\n Password: newPassword,\n ClientMetadata: clientMetadata\n };\n\n if (this.getUserContextData()) {\n jsonReq.UserContextData = this.getUserContextData();\n }\n\n this.client.request('ConfirmForgotPassword', jsonReq, function (err) {\n if (err) {\n return callback.onFailure(err);\n }\n\n return callback.onSuccess('SUCCESS');\n });\n }\n /**\n * This is used to initiate an attribute confirmation request\n * @param {string} attributeName User attribute that needs confirmation.\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {inputVerificationCode} callback.inputVerificationCode Called on success.\n * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n * @returns {void}\n */\n ;\n\n _proto.getAttributeVerificationCode = function getAttributeVerificationCode(attributeName, callback, clientMetadata) {\n if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n return callback.onFailure(new Error('User is not authenticated'));\n }\n\n this.client.request('GetUserAttributeVerificationCode', {\n AttributeName: attributeName,\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n ClientMetadata: clientMetadata\n }, function (err, data) {\n if (err) {\n return callback.onFailure(err);\n }\n\n if (typeof callback.inputVerificationCode === 'function') {\n return callback.inputVerificationCode(data);\n }\n\n return callback.onSuccess('SUCCESS');\n });\n return undefined;\n }\n /**\n * This is used to confirm an attribute using a confirmation code\n * @param {string} attributeName Attribute being confirmed.\n * @param {string} confirmationCode Code entered by user.\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {onSuccess} callback.onSuccess Called on success.\n * @returns {void}\n */\n ;\n\n _proto.verifyAttribute = function verifyAttribute(attributeName, confirmationCode, callback) {\n if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n return callback.onFailure(new Error('User is not authenticated'));\n }\n\n this.client.request('VerifyUserAttribute', {\n AttributeName: attributeName,\n Code: confirmationCode,\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n }, function (err) {\n if (err) {\n return callback.onFailure(err);\n }\n\n return callback.onSuccess('SUCCESS');\n });\n return undefined;\n }\n /**\n * This is used to get the device information using the current device key\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {onSuccess<*>} callback.onSuccess Called on success with device data.\n * @returns {void}\n */\n ;\n\n _proto.getDevice = function getDevice(callback) {\n if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n return callback.onFailure(new Error('User is not authenticated'));\n }\n\n this.client.request('GetDevice', {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n DeviceKey: this.deviceKey\n }, function (err, data) {\n if (err) {\n return callback.onFailure(err);\n }\n\n return callback.onSuccess(data);\n });\n return undefined;\n }\n /**\n * This is used to forget a specific device\n * @param {string} deviceKey Device key.\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {onSuccess} callback.onSuccess Called on success.\n * @returns {void}\n */\n ;\n\n _proto.forgetSpecificDevice = function forgetSpecificDevice(deviceKey, callback) {\n if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n return callback.onFailure(new Error('User is not authenticated'));\n }\n\n this.client.request('ForgetDevice', {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n DeviceKey: deviceKey\n }, function (err) {\n if (err) {\n return callback.onFailure(err);\n }\n\n return callback.onSuccess('SUCCESS');\n });\n return undefined;\n }\n /**\n * This is used to forget the current device\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {onSuccess} callback.onSuccess Called on success.\n * @returns {void}\n */\n ;\n\n _proto.forgetDevice = function forgetDevice(callback) {\n var _this16 = this;\n\n this.forgetSpecificDevice(this.deviceKey, {\n onFailure: callback.onFailure,\n onSuccess: function onSuccess(result) {\n _this16.deviceKey = null;\n _this16.deviceGroupKey = null;\n _this16.randomPassword = null;\n\n _this16.clearCachedDeviceKeyAndPassword();\n\n return callback.onSuccess(result);\n }\n });\n }\n /**\n * This is used to set the device status as remembered\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {onSuccess} callback.onSuccess Called on success.\n * @returns {void}\n */\n ;\n\n _proto.setDeviceStatusRemembered = function setDeviceStatusRemembered(callback) {\n if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n return callback.onFailure(new Error('User is not authenticated'));\n }\n\n this.client.request('UpdateDeviceStatus', {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n DeviceKey: this.deviceKey,\n DeviceRememberedStatus: 'remembered'\n }, function (err) {\n if (err) {\n return callback.onFailure(err);\n }\n\n return callback.onSuccess('SUCCESS');\n });\n return undefined;\n }\n /**\n * This is used to set the device status as not remembered\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {onSuccess} callback.onSuccess Called on success.\n * @returns {void}\n */\n ;\n\n _proto.setDeviceStatusNotRemembered = function setDeviceStatusNotRemembered(callback) {\n if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n return callback.onFailure(new Error('User is not authenticated'));\n }\n\n this.client.request('UpdateDeviceStatus', {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n DeviceKey: this.deviceKey,\n DeviceRememberedStatus: 'not_remembered'\n }, function (err) {\n if (err) {\n return callback.onFailure(err);\n }\n\n return callback.onSuccess('SUCCESS');\n });\n return undefined;\n }\n /**\n * This is used to list all devices for a user\n *\n * @param {int} limit the number of devices returned in a call\n * @param {string | null} paginationToken the pagination token in case any was returned before\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {onSuccess<*>} callback.onSuccess Called on success with device list.\n * @returns {void}\n */\n ;\n\n _proto.listDevices = function listDevices(limit, paginationToken, callback) {\n if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n return callback.onFailure(new Error('User is not authenticated'));\n }\n\n var requestParams = {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n Limit: limit\n };\n\n if (paginationToken) {\n requestParams.PaginationToken = paginationToken;\n }\n\n this.client.request('ListDevices', requestParams, function (err, data) {\n if (err) {\n return callback.onFailure(err);\n }\n\n return callback.onSuccess(data);\n });\n return undefined;\n }\n /**\n * This is used to globally revoke all tokens issued to a user\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {onSuccess} callback.onSuccess Called on success.\n * @returns {void}\n */\n ;\n\n _proto.globalSignOut = function globalSignOut(callback) {\n var _this17 = this;\n\n if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n return callback.onFailure(new Error('User is not authenticated'));\n }\n\n this.client.request('GlobalSignOut', {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n }, function (err) {\n if (err) {\n return callback.onFailure(err);\n }\n\n _this17.clearCachedUser();\n\n return callback.onSuccess('SUCCESS');\n });\n return undefined;\n }\n /**\n * This is used for the user to signOut of the application and clear the cached tokens.\n * @returns {void}\n */\n ;\n\n _proto.signOut = function signOut(revokeTokenCallback) {\n var _this18 = this;\n\n // If tokens won't be revoked, we just clean the client data.\n if (!revokeTokenCallback || typeof revokeTokenCallback !== 'function') {\n this.cleanClientData();\n return;\n }\n\n this.getSession(function (error, _session) {\n if (error) {\n return revokeTokenCallback(error);\n }\n\n _this18.revokeTokens(function (err) {\n _this18.cleanClientData();\n\n revokeTokenCallback(err);\n });\n });\n };\n\n _proto.revokeTokens = function revokeTokens(revokeTokenCallback) {\n if (revokeTokenCallback === void 0) {\n revokeTokenCallback = function revokeTokenCallback() {};\n }\n\n if (typeof revokeTokenCallback !== 'function') {\n throw new Error('Invalid revokeTokenCallback. It should be a function.');\n }\n\n var tokensToBeRevoked = [];\n\n if (!this.signInUserSession) {\n var error = new Error('User is not authenticated');\n return revokeTokenCallback(error);\n }\n\n if (!this.signInUserSession.getAccessToken()) {\n var _error = new Error('No Access token available');\n\n return revokeTokenCallback(_error);\n }\n\n var refreshToken = this.signInUserSession.getRefreshToken().getToken();\n var accessToken = this.signInUserSession.getAccessToken();\n\n if (this.isSessionRevocable(accessToken)) {\n if (refreshToken) {\n return this.revokeToken({\n token: refreshToken,\n callback: revokeTokenCallback\n });\n }\n }\n\n revokeTokenCallback();\n };\n\n _proto.isSessionRevocable = function isSessionRevocable(token) {\n if (token && typeof token.decodePayload === 'function') {\n try {\n var _token$decodePayload = token.decodePayload(),\n origin_jti = _token$decodePayload.origin_jti;\n\n return !!origin_jti;\n } catch (err) {// Nothing to do, token doesnt have origin_jti claim\n }\n }\n\n return false;\n };\n\n _proto.cleanClientData = function cleanClientData() {\n this.signInUserSession = null;\n this.clearCachedUser();\n };\n\n _proto.revokeToken = function revokeToken(_ref2) {\n var token = _ref2.token,\n callback = _ref2.callback;\n this.client.requestWithRetry('RevokeToken', {\n Token: token,\n ClientId: this.pool.getClientId()\n }, function (err) {\n if (err) {\n return callback(err);\n }\n\n callback();\n });\n }\n /**\n * This is used by a user trying to select a given MFA\n * @param {string} answerChallenge the mfa the user wants\n * @param {nodeCallback} callback Called on success or error.\n * @returns {void}\n */\n ;\n\n _proto.sendMFASelectionAnswer = function sendMFASelectionAnswer(answerChallenge, callback) {\n var _this19 = this;\n\n var challengeResponses = {};\n challengeResponses.USERNAME = this.username;\n challengeResponses.ANSWER = answerChallenge;\n var jsonReq = {\n ChallengeName: 'SELECT_MFA_TYPE',\n ChallengeResponses: challengeResponses,\n ClientId: this.pool.getClientId(),\n Session: this.Session\n };\n\n if (this.getUserContextData()) {\n jsonReq.UserContextData = this.getUserContextData();\n }\n\n this.client.request('RespondToAuthChallenge', jsonReq, function (err, data) {\n if (err) {\n return callback.onFailure(err);\n }\n\n _this19.Session = data.Session;\n\n if (answerChallenge === 'SMS_MFA') {\n return callback.mfaRequired(data.ChallengeName, data.ChallengeParameters);\n }\n\n if (answerChallenge === 'SOFTWARE_TOKEN_MFA') {\n return callback.totpRequired(data.ChallengeName, data.ChallengeParameters);\n }\n\n return undefined;\n });\n }\n /**\n * This returns the user context data for advanced security feature.\n * @returns {string} the user context data from CognitoUserPool\n */\n ;\n\n _proto.getUserContextData = function getUserContextData() {\n var pool = this.pool;\n return pool.getUserContextData(this.username);\n }\n /**\n * This is used by an authenticated or a user trying to authenticate to associate a TOTP MFA\n * @param {nodeCallback} callback Called on success or error.\n * @returns {void}\n */\n ;\n\n _proto.associateSoftwareToken = function associateSoftwareToken(callback) {\n var _this20 = this;\n\n if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n this.client.request('AssociateSoftwareToken', {\n Session: this.Session\n }, function (err, data) {\n if (err) {\n return callback.onFailure(err);\n }\n\n _this20.Session = data.Session;\n return callback.associateSecretCode(data.SecretCode);\n });\n } else {\n this.client.request('AssociateSoftwareToken', {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n }, function (err, data) {\n if (err) {\n return callback.onFailure(err);\n }\n\n return callback.associateSecretCode(data.SecretCode);\n });\n }\n }\n /**\n * This is used by an authenticated or a user trying to authenticate to verify a TOTP MFA\n * @param {string} totpCode The MFA code entered by the user.\n * @param {string} friendlyDeviceName The device name we are assigning to the device.\n * @param {nodeCallback} callback Called on success or error.\n * @returns {void}\n */\n ;\n\n _proto.verifySoftwareToken = function verifySoftwareToken(totpCode, friendlyDeviceName, callback) {\n var _this21 = this;\n\n if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n this.client.request('VerifySoftwareToken', {\n Session: this.Session,\n UserCode: totpCode,\n FriendlyDeviceName: friendlyDeviceName\n }, function (err, data) {\n if (err) {\n return callback.onFailure(err);\n }\n\n _this21.Session = data.Session;\n var challengeResponses = {};\n challengeResponses.USERNAME = _this21.username;\n var jsonReq = {\n ChallengeName: 'MFA_SETUP',\n ClientId: _this21.pool.getClientId(),\n ChallengeResponses: challengeResponses,\n Session: _this21.Session\n };\n\n if (_this21.getUserContextData()) {\n jsonReq.UserContextData = _this21.getUserContextData();\n }\n\n _this21.client.request('RespondToAuthChallenge', jsonReq, function (errRespond, dataRespond) {\n if (errRespond) {\n return callback.onFailure(errRespond);\n }\n\n _this21.signInUserSession = _this21.getCognitoUserSession(dataRespond.AuthenticationResult);\n\n _this21.cacheTokens();\n\n return callback.onSuccess(_this21.signInUserSession);\n });\n\n return undefined;\n });\n } else {\n this.client.request('VerifySoftwareToken', {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n UserCode: totpCode,\n FriendlyDeviceName: friendlyDeviceName\n }, function (err, data) {\n if (err) {\n return callback.onFailure(err);\n }\n\n return callback.onSuccess(data);\n });\n }\n };\n\n return CognitoUser;\n}();\n\nexport { CognitoUser as default };","/*!\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { version } from './version';\nvar BASE_USER_AGENT = \"aws-amplify/\" + version;\nexport var Platform = {\n userAgent: BASE_USER_AGENT + \" js\",\n product: '',\n navigator: null,\n isReactNative: false\n};\n\nif (typeof navigator !== 'undefined' && navigator.product) {\n Platform.product = navigator.product || '';\n Platform.navigator = navigator || null;\n\n switch (navigator.product) {\n case 'ReactNative':\n Platform.userAgent = BASE_USER_AGENT + \" react-native\";\n Platform.isReactNative = true;\n break;\n\n default:\n Platform.userAgent = BASE_USER_AGENT + \" js\";\n Platform.isReactNative = false;\n break;\n }\n}\n\nexport var getUserAgent = function getUserAgent() {\n return Platform.userAgent;\n};\n/**\n * @deprecated use named import\n */\n\nexport default Platform;","import { getUserAgent } from \"./Platform\"; // constructor\n\nfunction UserAgent() {} // public\n\n\nUserAgent.prototype.userAgent = getUserAgent();\nexport var appendToCognitoUserAgent = function appendToCognitoUserAgent(content) {\n if (!content) {\n return;\n }\n\n if (UserAgent.prototype.userAgent && !UserAgent.prototype.userAgent.includes(content)) {\n UserAgent.prototype.userAgent = UserAgent.prototype.userAgent.concat(' ', content);\n }\n\n if (!UserAgent.prototype.userAgent || UserAgent.prototype.userAgent === '') {\n UserAgent.prototype.userAgent = content;\n }\n}; // class for defining the amzn user-agent\n\nexport default UserAgent;","function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }\n\nfunction _wrapNativeSuper(Class) { var _cache = typeof Map === \"function\" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== \"function\") { throw new TypeError(\"Super expression must either be null or a function\"); } if (typeof _cache !== \"undefined\") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }\n\nfunction _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _isNativeFunction(fn) { return Function.toString.call(fn).indexOf(\"[native code]\") !== -1; }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nimport 'isomorphic-unfetch';\nimport UserAgent from './UserAgent';\n\nvar CognitoError = /*#__PURE__*/function (_Error) {\n _inheritsLoose(CognitoError, _Error);\n\n function CognitoError(message, code, name, statusCode) {\n var _this;\n\n _this = _Error.call(this, message) || this;\n _this.code = code;\n _this.name = name;\n _this.statusCode = statusCode;\n return _this;\n }\n\n return CognitoError;\n}( /*#__PURE__*/_wrapNativeSuper(Error));\n/** @class */\n\n\nvar Client = /*#__PURE__*/function () {\n /**\n * Constructs a new AWS Cognito Identity Provider client object\n * @param {string} region AWS region\n * @param {string} endpoint endpoint\n * @param {object} fetchOptions options for fetch API (only credentials is supported)\n */\n function Client(region, endpoint, fetchOptions) {\n this.endpoint = endpoint || \"https://cognito-idp.\" + region + \".amazonaws.com/\";\n\n var _ref = fetchOptions || {},\n credentials = _ref.credentials;\n\n this.fetchOptions = credentials ? {\n credentials: credentials\n } : {};\n }\n /**\n * Makes an unauthenticated request on AWS Cognito Identity Provider API\n * using fetch\n * @param {string} operation API operation\n * @param {object} params Input parameters\n * @returns Promise\n */\n\n\n var _proto = Client.prototype;\n\n _proto.promisifyRequest = function promisifyRequest(operation, params) {\n var _this2 = this;\n\n return new Promise(function (resolve, reject) {\n _this2.request(operation, params, function (err, data) {\n if (err) {\n reject(new CognitoError(err.message, err.code, err.name, err.statusCode));\n } else {\n resolve(data);\n }\n });\n });\n };\n\n _proto.requestWithRetry = function requestWithRetry(operation, params, callback) {\n var _this3 = this;\n\n var MAX_DELAY_IN_MILLIS = 5 * 1000;\n jitteredExponentialRetry(function (p) {\n return new Promise(function (res, rej) {\n _this3.request(operation, p, function (error, result) {\n if (error) {\n rej(error);\n } else {\n res(result);\n }\n });\n });\n }, [params], MAX_DELAY_IN_MILLIS).then(function (result) {\n return callback(null, result);\n })[\"catch\"](function (error) {\n return callback(error);\n });\n }\n /**\n * Makes an unauthenticated request on AWS Cognito Identity Provider API\n * using fetch\n * @param {string} operation API operation\n * @param {object} params Input parameters\n * @param {function} callback Callback called when a response is returned\n * @returns {void}\n */\n ;\n\n _proto.request = function request(operation, params, callback) {\n var headers = {\n 'Content-Type': 'application/x-amz-json-1.1',\n 'X-Amz-Target': \"AWSCognitoIdentityProviderService.\" + operation,\n 'X-Amz-User-Agent': UserAgent.prototype.userAgent\n };\n var options = Object.assign({}, this.fetchOptions, {\n headers: headers,\n method: 'POST',\n mode: 'cors',\n cache: 'no-cache',\n body: JSON.stringify(params)\n });\n var response;\n var responseJsonData;\n fetch(this.endpoint, options).then(function (resp) {\n response = resp;\n return resp;\n }, function (err) {\n // If error happens here, the request failed\n // if it is TypeError throw network error\n if (err instanceof TypeError) {\n throw new Error('Network error');\n }\n\n throw err;\n }).then(function (resp) {\n return resp.json()[\"catch\"](function () {\n return {};\n });\n }).then(function (data) {\n // return parsed body stream\n if (response.ok) return callback(null, data);\n responseJsonData = data; // Taken from aws-sdk-js/lib/protocol/json.js\n // eslint-disable-next-line no-underscore-dangle\n\n var code = (data.__type || data.code).split('#').pop();\n var error = new Error(data.message || data.Message || null);\n error.name = code;\n error.code = code;\n return callback(error);\n })[\"catch\"](function (err) {\n // first check if we have a service error\n if (response && response.headers && response.headers.get('x-amzn-errortype')) {\n try {\n var code = response.headers.get('x-amzn-errortype').split(':')[0];\n var error = new Error(response.status ? response.status.toString() : null);\n error.code = code;\n error.name = code;\n error.statusCode = response.status;\n return callback(error);\n } catch (ex) {\n return callback(err);\n } // otherwise check if error is Network error\n\n } else if (err instanceof Error && err.message === 'Network error') {\n err.code = 'NetworkError';\n }\n\n return callback(err);\n });\n };\n\n return Client;\n}();\n\nexport { Client as default };\nvar logger = {\n debug: function debug() {// Intentionally blank. This package doesn't have logging\n }\n};\n/**\n * For now, all errors are retryable.\n */\n\nvar NonRetryableError = /*#__PURE__*/function (_Error2) {\n _inheritsLoose(NonRetryableError, _Error2);\n\n function NonRetryableError(message) {\n var _this4;\n\n _this4 = _Error2.call(this, message) || this;\n _this4.nonRetryable = true;\n return _this4;\n }\n\n return NonRetryableError;\n}( /*#__PURE__*/_wrapNativeSuper(Error));\n\nvar isNonRetryableError = function isNonRetryableError(obj) {\n var key = 'nonRetryable';\n return obj && obj[key];\n};\n\nfunction retry(functionToRetry, args, delayFn, attempt) {\n if (attempt === void 0) {\n attempt = 1;\n }\n\n if (typeof functionToRetry !== 'function') {\n throw Error('functionToRetry must be a function');\n }\n\n logger.debug(functionToRetry.name + \" attempt #\" + attempt + \" with args: \" + JSON.stringify(args));\n return functionToRetry.apply(void 0, args)[\"catch\"](function (err) {\n logger.debug(\"error on \" + functionToRetry.name, err);\n\n if (isNonRetryableError(err)) {\n logger.debug(functionToRetry.name + \" non retryable error\", err);\n throw err;\n }\n\n var retryIn = delayFn(attempt, args, err);\n logger.debug(functionToRetry.name + \" retrying in \" + retryIn + \" ms\");\n\n if (retryIn !== false) {\n return new Promise(function (res) {\n return setTimeout(res, retryIn);\n }).then(function () {\n return retry(functionToRetry, args, delayFn, attempt + 1);\n });\n } else {\n throw err;\n }\n });\n}\n\nfunction jitteredBackoff(maxDelayMs) {\n var BASE_TIME_MS = 100;\n var JITTER_FACTOR = 100;\n return function (attempt) {\n var delay = Math.pow(2, attempt) * BASE_TIME_MS + JITTER_FACTOR * Math.random();\n return delay > maxDelayMs ? false : delay;\n };\n}\n\nvar MAX_DELAY_MS = 5 * 60 * 1000;\n\nfunction jitteredExponentialRetry(functionToRetry, args, maxDelayMs) {\n if (maxDelayMs === void 0) {\n maxDelayMs = MAX_DELAY_MS;\n }\n\n return retry(functionToRetry, args, jitteredBackoff(maxDelayMs));\n}\n\n;","/*!\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport Client from './Client';\nimport CognitoUser from './CognitoUser';\nimport StorageHelper from './StorageHelper';\nvar USER_POOL_ID_MAX_LENGTH = 55;\n/** @class */\n\nvar CognitoUserPool = /*#__PURE__*/function () {\n /**\n * Constructs a new CognitoUserPool object\n * @param {object} data Creation options.\n * @param {string} data.UserPoolId Cognito user pool id.\n * @param {string} data.ClientId User pool application client id.\n * @param {string} data.endpoint Optional custom service endpoint.\n * @param {object} data.fetchOptions Optional options for fetch API.\n * (only credentials option is supported)\n * @param {object} data.Storage Optional storage object.\n * @param {boolean} data.AdvancedSecurityDataCollectionFlag Optional:\n * boolean flag indicating if the data collection is enabled\n * to support cognito advanced security features. By default, this\n * flag is set to true.\n */\n function CognitoUserPool(data, wrapRefreshSessionCallback) {\n var _ref = data || {},\n UserPoolId = _ref.UserPoolId,\n ClientId = _ref.ClientId,\n endpoint = _ref.endpoint,\n fetchOptions = _ref.fetchOptions,\n AdvancedSecurityDataCollectionFlag = _ref.AdvancedSecurityDataCollectionFlag;\n\n if (!UserPoolId || !ClientId) {\n throw new Error('Both UserPoolId and ClientId are required.');\n }\n\n if (UserPoolId.length > USER_POOL_ID_MAX_LENGTH || !/^[\\w-]+_[0-9a-zA-Z]+$/.test(UserPoolId)) {\n throw new Error('Invalid UserPoolId format.');\n }\n\n var region = UserPoolId.split('_')[0];\n this.userPoolId = UserPoolId;\n this.clientId = ClientId;\n this.client = new Client(region, endpoint, fetchOptions);\n /**\n * By default, AdvancedSecurityDataCollectionFlag is set to true,\n * if no input value is provided.\n */\n\n this.advancedSecurityDataCollectionFlag = AdvancedSecurityDataCollectionFlag !== false;\n this.storage = data.Storage || new StorageHelper().getStorage();\n\n if (wrapRefreshSessionCallback) {\n this.wrapRefreshSessionCallback = wrapRefreshSessionCallback;\n }\n }\n /**\n * @returns {string} the user pool id\n */\n\n\n var _proto = CognitoUserPool.prototype;\n\n _proto.getUserPoolId = function getUserPoolId() {\n return this.userPoolId;\n }\n /**\n * @returns {string} the client id\n */\n ;\n\n _proto.getClientId = function getClientId() {\n return this.clientId;\n }\n /**\n * @typedef {object} SignUpResult\n * @property {CognitoUser} user New user.\n * @property {bool} userConfirmed If the user is already confirmed.\n */\n\n /**\n * method for signing up a user\n * @param {string} username User's username.\n * @param {string} password Plain-text initial password entered by user.\n * @param {(AttributeArg[])=} userAttributes New user attributes.\n * @param {(AttributeArg[])=} validationData Application metadata.\n * @param {(AttributeArg[])=} clientMetadata Client metadata.\n * @param {nodeCallback} callback Called on error or with the new user.\n * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n * @returns {void}\n */\n ;\n\n _proto.signUp = function signUp(username, password, userAttributes, validationData, callback, clientMetadata) {\n var _this = this;\n\n var jsonReq = {\n ClientId: this.clientId,\n Username: username,\n Password: password,\n UserAttributes: userAttributes,\n ValidationData: validationData,\n ClientMetadata: clientMetadata\n };\n\n if (this.getUserContextData(username)) {\n jsonReq.UserContextData = this.getUserContextData(username);\n }\n\n this.client.request('SignUp', jsonReq, function (err, data) {\n if (err) {\n return callback(err, null);\n }\n\n var cognitoUser = {\n Username: username,\n Pool: _this,\n Storage: _this.storage\n };\n var returnData = {\n user: new CognitoUser(cognitoUser),\n userConfirmed: data.UserConfirmed,\n userSub: data.UserSub,\n codeDeliveryDetails: data.CodeDeliveryDetails\n };\n return callback(null, returnData);\n });\n }\n /**\n * method for getting the current user of the application from the local storage\n *\n * @returns {CognitoUser} the user retrieved from storage\n */\n ;\n\n _proto.getCurrentUser = function getCurrentUser() {\n var lastUserKey = \"CognitoIdentityServiceProvider.\" + this.clientId + \".LastAuthUser\";\n var lastAuthUser = this.storage.getItem(lastUserKey);\n\n if (lastAuthUser) {\n var cognitoUser = {\n Username: lastAuthUser,\n Pool: this,\n Storage: this.storage\n };\n return new CognitoUser(cognitoUser);\n }\n\n return null;\n }\n /**\n * This method returns the encoded data string used for cognito advanced security feature.\n * This would be generated only when developer has included the JS used for collecting the\n * data on their client. Please refer to documentation to know more about using AdvancedSecurity\n * features\n * @param {string} username the username for the context data\n * @returns {string} the user context data\n **/\n ;\n\n _proto.getUserContextData = function getUserContextData(username) {\n if (typeof AmazonCognitoAdvancedSecurityData === 'undefined') {\n return undefined;\n }\n /* eslint-disable */\n\n\n var amazonCognitoAdvancedSecurityDataConst = AmazonCognitoAdvancedSecurityData;\n /* eslint-enable */\n\n if (this.advancedSecurityDataCollectionFlag) {\n var advancedSecurityData = amazonCognitoAdvancedSecurityDataConst.getData(username, this.userPoolId, this.clientId);\n\n if (advancedSecurityData) {\n var userContextData = {\n EncodedData: advancedSecurityData\n };\n return userContextData;\n }\n }\n\n return {};\n };\n\n return CognitoUserPool;\n}();\n\nexport { CognitoUserPool as default };","export var AuthErrorStrings;\n(function (AuthErrorStrings) {\n AuthErrorStrings[\"DEFAULT_MSG\"] = \"Authentication Error\";\n AuthErrorStrings[\"EMPTY_EMAIL\"] = \"Email cannot be empty\";\n AuthErrorStrings[\"EMPTY_PHONE\"] = \"Phone number cannot be empty\";\n AuthErrorStrings[\"EMPTY_USERNAME\"] = \"Username cannot be empty\";\n AuthErrorStrings[\"INVALID_USERNAME\"] = \"The username should either be a string or one of the sign in types\";\n AuthErrorStrings[\"EMPTY_PASSWORD\"] = \"Password cannot be empty\";\n AuthErrorStrings[\"EMPTY_CODE\"] = \"Confirmation code cannot be empty\";\n AuthErrorStrings[\"SIGN_UP_ERROR\"] = \"Error creating account\";\n AuthErrorStrings[\"NO_MFA\"] = \"No valid MFA method provided\";\n AuthErrorStrings[\"INVALID_MFA\"] = \"Invalid MFA type\";\n AuthErrorStrings[\"EMPTY_CHALLENGE\"] = \"Challenge response cannot be empty\";\n AuthErrorStrings[\"NO_USER_SESSION\"] = \"Failed to get the session because the user is empty\";\n AuthErrorStrings[\"NETWORK_ERROR\"] = \"Network Error\";\n AuthErrorStrings[\"DEVICE_CONFIG\"] = \"Device tracking has not been configured in this User Pool\";\n})(AuthErrorStrings || (AuthErrorStrings = {}));\n//# sourceMappingURL=AuthErrorStrings.js.map","import * as Cookies from 'js-cookie';\n/** @class */\n\nvar CookieStorage = /*#__PURE__*/function () {\n /**\n * Constructs a new CookieStorage object\n * @param {object} data Creation options.\n * @param {string} data.domain Cookies domain (mandatory).\n * @param {string} data.path Cookies path (default: '/')\n * @param {integer} data.expires Cookie expiration (in days, default: 365)\n * @param {boolean} data.secure Cookie secure flag (default: true)\n * @param {string} data.sameSite Cookie request behaviour (default: null)\n */\n function CookieStorage(data) {\n if (data.domain) {\n this.domain = data.domain;\n } else {\n throw new Error('The domain of cookieStorage can not be undefined.');\n }\n\n if (data.path) {\n this.path = data.path;\n } else {\n this.path = '/';\n }\n\n if (Object.prototype.hasOwnProperty.call(data, 'expires')) {\n this.expires = data.expires;\n } else {\n this.expires = 365;\n }\n\n if (Object.prototype.hasOwnProperty.call(data, 'secure')) {\n this.secure = data.secure;\n } else {\n this.secure = true;\n }\n\n if (Object.prototype.hasOwnProperty.call(data, 'sameSite')) {\n if (!['strict', 'lax', 'none'].includes(data.sameSite)) {\n throw new Error('The sameSite value of cookieStorage must be \"lax\", \"strict\" or \"none\".');\n }\n\n if (data.sameSite === 'none' && !this.secure) {\n throw new Error('sameSite = None requires the Secure attribute in latest browser versions.');\n }\n\n this.sameSite = data.sameSite;\n } else {\n this.sameSite = null;\n }\n }\n /**\n * This is used to set a specific item in storage\n * @param {string} key - the key for the item\n * @param {object} value - the value\n * @returns {string} value that was set\n */\n\n\n var _proto = CookieStorage.prototype;\n\n _proto.setItem = function setItem(key, value) {\n var options = {\n path: this.path,\n expires: this.expires,\n domain: this.domain,\n secure: this.secure\n };\n\n if (this.sameSite) {\n options.sameSite = this.sameSite;\n }\n\n Cookies.set(key, value, options);\n return Cookies.get(key);\n }\n /**\n * This is used to get a specific key from storage\n * @param {string} key - the key for the item\n * This is used to clear the storage\n * @returns {string} the data item\n */\n ;\n\n _proto.getItem = function getItem(key) {\n return Cookies.get(key);\n }\n /**\n * This is used to remove an item from storage\n * @param {string} key - the key being set\n * @returns {string} value - value that was deleted\n */\n ;\n\n _proto.removeItem = function removeItem(key) {\n var options = {\n path: this.path,\n expires: this.expires,\n domain: this.domain,\n secure: this.secure\n };\n\n if (this.sameSite) {\n options.sameSite = this.sameSite;\n }\n\n return Cookies.remove(key, options);\n }\n /**\n * This is used to clear the storage of optional\n * items that were previously set\n * @returns {} an empty object\n */\n ;\n\n _proto.clear = function clear() {\n var cookies = Cookies.get();\n var numKeys = Object.keys(cookies).length;\n\n for (var index = 0; index < numKeys; ++index) {\n this.removeItem(Object.keys(cookies)[index]);\n }\n\n return {};\n };\n\n return CookieStorage;\n}();\n\nexport { CookieStorage as default };","/*\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nvar SELF = '_self';\nexport var launchUri = function (url) {\n var windowProxy = window.open(url, SELF);\n if (windowProxy) {\n return Promise.resolve(windowProxy);\n }\n else {\n return Promise.reject();\n }\n};\n//# sourceMappingURL=urlOpener.js.map","/*\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\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 __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nimport { parse } from 'url'; // Used for OAuth parsing of Cognito Hosted UI\nimport { launchUri } from './urlOpener';\nimport * as oAuthStorage from './oauthStorage';\nimport { isCognitoHostedOpts, CognitoHostedUIIdentityProvider, } from '../types/Auth';\nimport { ConsoleLogger as Logger, Hub, urlSafeEncode } from '@aws-amplify/core';\nimport sha256 from 'crypto-js/sha256';\nimport Base64 from 'crypto-js/enc-base64';\nvar AMPLIFY_SYMBOL = (typeof Symbol !== 'undefined' &&\n typeof Symbol.for === 'function'\n ? Symbol.for('amplify_default')\n : '@@amplify_default');\nvar dispatchAuthEvent = function (event, data, message) {\n Hub.dispatch('auth', { event: event, data: data, message: message }, 'Auth', AMPLIFY_SYMBOL);\n};\nvar logger = new Logger('OAuth');\nvar OAuth = /** @class */ (function () {\n function OAuth(_a) {\n var config = _a.config, cognitoClientId = _a.cognitoClientId, _b = _a.scopes, scopes = _b === void 0 ? [] : _b;\n this._urlOpener = config.urlOpener || launchUri;\n this._config = config;\n this._cognitoClientId = cognitoClientId;\n if (!this.isValidScopes(scopes))\n throw Error('scopes must be a String Array');\n this._scopes = scopes;\n }\n OAuth.prototype.isValidScopes = function (scopes) {\n return (Array.isArray(scopes) && scopes.every(function (scope) { return typeof scope === 'string'; }));\n };\n OAuth.prototype.oauthSignIn = function (responseType, domain, redirectSignIn, clientId, provider, customState) {\n if (responseType === void 0) { responseType = 'code'; }\n if (provider === void 0) { provider = CognitoHostedUIIdentityProvider.Cognito; }\n var generatedState = this._generateState(32);\n /* encodeURIComponent is not URL safe, use urlSafeEncode instead. Cognito\n single-encodes/decodes url on first sign in and double-encodes/decodes url\n when user already signed in. Using encodeURIComponent, Base32, Base64 add\n characters % or = which on further encoding becomes unsafe. '=' create issue\n for parsing query params.\n Refer: https://github.com/aws-amplify/amplify-js/issues/5218 */\n var state = customState\n ? generatedState + \"-\" + urlSafeEncode(customState)\n : generatedState;\n oAuthStorage.setState(state);\n var pkce_key = this._generateRandom(128);\n oAuthStorage.setPKCE(pkce_key);\n var code_challenge = this._generateChallenge(pkce_key);\n var code_challenge_method = 'S256';\n var scopesString = this._scopes.join(' ');\n var queryString = Object.entries(__assign(__assign({ redirect_uri: redirectSignIn, response_type: responseType, client_id: clientId, identity_provider: provider, scope: scopesString, state: state }, (responseType === 'code' ? { code_challenge: code_challenge } : {})), (responseType === 'code' ? { code_challenge_method: code_challenge_method } : {})))\n .map(function (_a) {\n var _b = __read(_a, 2), k = _b[0], v = _b[1];\n return encodeURIComponent(k) + \"=\" + encodeURIComponent(v);\n })\n .join('&');\n var URL = \"https://\" + domain + \"/oauth2/authorize?\" + queryString;\n logger.debug(\"Redirecting to \" + URL);\n this._urlOpener(URL, redirectSignIn);\n };\n OAuth.prototype._handleCodeFlow = function (currentUrl) {\n return __awaiter(this, void 0, void 0, function () {\n var code, currentUrlPathname, redirectSignInPathname, oAuthTokenEndpoint, client_id, redirect_uri, code_verifier, oAuthTokenBody, body, _a, access_token, refresh_token, id_token, error;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n code = (parse(currentUrl).query || '')\n .split('&')\n .map(function (pairings) { return pairings.split('='); })\n .reduce(function (accum, _a) {\n var _b;\n var _c = __read(_a, 2), k = _c[0], v = _c[1];\n return (__assign(__assign({}, accum), (_b = {}, _b[k] = v, _b)));\n }, { code: undefined }).code;\n currentUrlPathname = parse(currentUrl).pathname || '/';\n redirectSignInPathname = parse(this._config.redirectSignIn).pathname || '/';\n if (!code || currentUrlPathname !== redirectSignInPathname) {\n return [2 /*return*/];\n }\n oAuthTokenEndpoint = 'https://' + this._config.domain + '/oauth2/token';\n dispatchAuthEvent('codeFlow', {}, \"Retrieving tokens from \" + oAuthTokenEndpoint);\n client_id = isCognitoHostedOpts(this._config)\n ? this._cognitoClientId\n : this._config.clientID;\n redirect_uri = isCognitoHostedOpts(this._config)\n ? this._config.redirectSignIn\n : this._config.redirectUri;\n code_verifier = oAuthStorage.getPKCE();\n oAuthTokenBody = __assign({ grant_type: 'authorization_code', code: code,\n client_id: client_id,\n redirect_uri: redirect_uri }, (code_verifier ? { code_verifier: code_verifier } : {}));\n logger.debug(\"Calling token endpoint: \" + oAuthTokenEndpoint + \" with\", oAuthTokenBody);\n body = Object.entries(oAuthTokenBody)\n .map(function (_a) {\n var _b = __read(_a, 2), k = _b[0], v = _b[1];\n return encodeURIComponent(k) + \"=\" + encodeURIComponent(v);\n })\n .join('&');\n return [4 /*yield*/, fetch(oAuthTokenEndpoint, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n body: body,\n })];\n case 1: return [4 /*yield*/, (_b.sent()).json()];\n case 2:\n _a = _b.sent(), access_token = _a.access_token, refresh_token = _a.refresh_token, id_token = _a.id_token, error = _a.error;\n if (error) {\n throw new Error(error);\n }\n return [2 /*return*/, {\n accessToken: access_token,\n refreshToken: refresh_token,\n idToken: id_token,\n }];\n }\n });\n });\n };\n OAuth.prototype._handleImplicitFlow = function (currentUrl) {\n return __awaiter(this, void 0, void 0, function () {\n var _a, id_token, access_token;\n return __generator(this, function (_b) {\n _a = (parse(currentUrl).hash || '#')\n .substr(1) // Remove # from returned code\n .split('&')\n .map(function (pairings) { return pairings.split('='); })\n .reduce(function (accum, _a) {\n var _b;\n var _c = __read(_a, 2), k = _c[0], v = _c[1];\n return (__assign(__assign({}, accum), (_b = {}, _b[k] = v, _b)));\n }, {\n id_token: undefined,\n access_token: undefined,\n }), id_token = _a.id_token, access_token = _a.access_token;\n dispatchAuthEvent('implicitFlow', {}, \"Got tokens from \" + currentUrl);\n logger.debug(\"Retrieving implicit tokens from \" + currentUrl + \" with\");\n return [2 /*return*/, {\n accessToken: access_token,\n idToken: id_token,\n refreshToken: null,\n }];\n });\n });\n };\n OAuth.prototype.handleAuthResponse = function (currentUrl) {\n return __awaiter(this, void 0, void 0, function () {\n var urlParams, error, error_description, state, _a, _b, e_1;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n _c.trys.push([0, 5, , 6]);\n urlParams = currentUrl\n ? __assign(__assign({}, (parse(currentUrl).hash || '#')\n .substr(1)\n .split('&')\n .map(function (entry) { return entry.split('='); })\n .reduce(function (acc, _a) {\n var _b = __read(_a, 2), k = _b[0], v = _b[1];\n return ((acc[k] = v), acc);\n }, {})), (parse(currentUrl).query || '')\n .split('&')\n .map(function (entry) { return entry.split('='); })\n .reduce(function (acc, _a) {\n var _b = __read(_a, 2), k = _b[0], v = _b[1];\n return ((acc[k] = v), acc);\n }, {}))\n : {};\n error = urlParams.error, error_description = urlParams.error_description;\n if (error) {\n throw new Error(error_description);\n }\n state = this._validateState(urlParams);\n logger.debug(\"Starting \" + this._config.responseType + \" flow with \" + currentUrl);\n if (!(this._config.responseType === 'code')) return [3 /*break*/, 2];\n _a = [{}];\n return [4 /*yield*/, this._handleCodeFlow(currentUrl)];\n case 1: return [2 /*return*/, __assign.apply(void 0, [__assign.apply(void 0, _a.concat([(_c.sent())])), { state: state }])];\n case 2:\n _b = [{}];\n return [4 /*yield*/, this._handleImplicitFlow(currentUrl)];\n case 3: return [2 /*return*/, __assign.apply(void 0, [__assign.apply(void 0, _b.concat([(_c.sent())])), { state: state }])];\n case 4: return [3 /*break*/, 6];\n case 5:\n e_1 = _c.sent();\n logger.error(\"Error handling auth response.\", e_1);\n throw e_1;\n case 6: return [2 /*return*/];\n }\n });\n });\n };\n OAuth.prototype._validateState = function (urlParams) {\n if (!urlParams) {\n return;\n }\n var savedState = oAuthStorage.getState();\n var returnedState = urlParams.state;\n // This is because savedState only exists if the flow was initiated by Amplify\n if (savedState && savedState !== returnedState) {\n throw new Error('Invalid state in OAuth flow');\n }\n return returnedState;\n };\n OAuth.prototype.signOut = function () {\n return __awaiter(this, void 0, void 0, function () {\n var oAuthLogoutEndpoint, client_id, signout_uri;\n return __generator(this, function (_a) {\n oAuthLogoutEndpoint = 'https://' + this._config.domain + '/logout?';\n client_id = isCognitoHostedOpts(this._config)\n ? this._cognitoClientId\n : this._config.oauth.clientID;\n signout_uri = isCognitoHostedOpts(this._config)\n ? this._config.redirectSignOut\n : this._config.returnTo;\n oAuthLogoutEndpoint += Object.entries({\n client_id: client_id,\n logout_uri: encodeURIComponent(signout_uri),\n })\n .map(function (_a) {\n var _b = __read(_a, 2), k = _b[0], v = _b[1];\n return k + \"=\" + v;\n })\n .join('&');\n dispatchAuthEvent('oAuthSignOut', { oAuth: 'signOut' }, \"Signing out from \" + oAuthLogoutEndpoint);\n logger.debug(\"Signing out from \" + oAuthLogoutEndpoint);\n return [2 /*return*/, this._urlOpener(oAuthLogoutEndpoint, signout_uri)];\n });\n });\n };\n OAuth.prototype._generateState = function (length) {\n var result = '';\n var i = length;\n var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';\n for (; i > 0; --i)\n result += chars[Math.round(Math.random() * (chars.length - 1))];\n return result;\n };\n OAuth.prototype._generateChallenge = function (code) {\n return this._base64URL(sha256(code));\n };\n OAuth.prototype._base64URL = function (string) {\n return string\n .toString(Base64)\n .replace(/=/g, '')\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_');\n };\n OAuth.prototype._generateRandom = function (size) {\n var CHARSET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~';\n var buffer = new Uint8Array(size);\n if (typeof window !== 'undefined' && !!window.crypto) {\n window.crypto.getRandomValues(buffer);\n }\n else {\n for (var i = 0; i < size; i += 1) {\n buffer[i] = (Math.random() * CHARSET.length) | 0;\n }\n }\n return this._bufferToString(buffer);\n };\n OAuth.prototype._bufferToString = function (buffer) {\n var CHARSET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n var state = [];\n for (var i = 0; i < buffer.byteLength; i += 1) {\n var index = buffer[i] % CHARSET.length;\n state.push(CHARSET[index]);\n }\n return state.join('');\n };\n return OAuth;\n}());\nexport default OAuth;\n//# sourceMappingURL=OAuth.js.map","export function urlSafeEncode(str) {\n return str\n .split('')\n .map(function (char) {\n return char\n .charCodeAt(0)\n .toString(16)\n .padStart(2, '0');\n })\n .join('');\n}\nexport function urlSafeDecode(hex) {\n return hex\n .match(/.{2}/g)\n .map(function (char) { return String.fromCharCode(parseInt(char, 16)); })\n .join('');\n}\n//# sourceMappingURL=StringUtils.js.map","/*\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nexport var setState = function (state) {\n window.sessionStorage.setItem('oauth_state', state);\n};\nexport var getState = function () {\n var oauth_state = window.sessionStorage.getItem('oauth_state');\n window.sessionStorage.removeItem('oauth_state');\n return oauth_state;\n};\nexport var setPKCE = function (private_key) {\n window.sessionStorage.setItem('ouath_pkce_key', private_key);\n};\nexport var getPKCE = function () {\n var ouath_pkce_key = window.sessionStorage.getItem('ouath_pkce_key');\n window.sessionStorage.removeItem('ouath_pkce_key');\n return ouath_pkce_key;\n};\nexport var clearAll = function () {\n window.sessionStorage.removeItem('ouath_pkce_key');\n window.sessionStorage.removeItem('oauth_state');\n};\n//# sourceMappingURL=oauthStorage.js.map","/*\n * Copyright 2019-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nimport { ConsoleLogger as Logger } from '@aws-amplify/core';\nimport { AuthErrorStrings } from './common/AuthErrorStrings';\nvar logger = new Logger('AuthError');\nvar AuthError = /** @class */ (function (_super) {\n __extends(AuthError, _super);\n function AuthError(type) {\n var _this = this;\n var _a = authErrorMessages[type], message = _a.message, log = _a.log;\n _this = _super.call(this, message) || this;\n // Hack for making the custom error class work when transpiled to es5\n // TODO: Delete the following 2 lines after we change the build target to >= es2015\n _this.constructor = AuthError;\n Object.setPrototypeOf(_this, AuthError.prototype);\n _this.name = 'AuthError';\n _this.log = log || message;\n logger.error(_this.log);\n return _this;\n }\n return AuthError;\n}(Error));\nexport { AuthError };\nvar NoUserPoolError = /** @class */ (function (_super) {\n __extends(NoUserPoolError, _super);\n function NoUserPoolError(type) {\n var _this = _super.call(this, type) || this;\n // Hack for making the custom error class work when transpiled to es5\n // TODO: Delete the following 2 lines after we change the build target to >= es2015\n _this.constructor = NoUserPoolError;\n Object.setPrototypeOf(_this, NoUserPoolError.prototype);\n _this.name = 'NoUserPoolError';\n return _this;\n }\n return NoUserPoolError;\n}(AuthError));\nexport { NoUserPoolError };\nexport var authErrorMessages = {\n noConfig: {\n message: AuthErrorStrings.DEFAULT_MSG,\n log: \"\\n Error: Amplify has not been configured correctly.\\n This error is typically caused by one of the following scenarios:\\n\\n 1. Make sure you're passing the awsconfig object to Amplify.configure() in your app's entry point\\n See https://aws-amplify.github.io/docs/js/authentication#configure-your-app for more information\\n \\n 2. There might be multiple conflicting versions of amplify packages in your node_modules.\\n\\t\\t\\t\\tRefer to our docs site for help upgrading Amplify packages (https://docs.amplify.aws/lib/troubleshooting/upgrading/q/platform/js)\\n \",\n },\n missingAuthConfig: {\n message: AuthErrorStrings.DEFAULT_MSG,\n log: \"\\n Error: Amplify has not been configured correctly. \\n The configuration object is missing required auth properties.\\n This error is typically caused by one of the following scenarios:\\n\\n 1. Did you run `amplify push` after adding auth via `amplify add auth`?\\n See https://aws-amplify.github.io/docs/js/authentication#amplify-project-setup for more information\\n\\n 2. This could also be caused by multiple conflicting versions of amplify packages, see (https://docs.amplify.aws/lib/troubleshooting/upgrading/q/platform/js) for help upgrading Amplify packages.\\n \",\n },\n emptyUsername: {\n message: AuthErrorStrings.EMPTY_USERNAME,\n },\n // TODO: should include a list of valid sign-in types\n invalidUsername: {\n message: AuthErrorStrings.INVALID_USERNAME,\n },\n emptyPassword: {\n message: AuthErrorStrings.EMPTY_PASSWORD,\n },\n emptyCode: {\n message: AuthErrorStrings.EMPTY_CODE,\n },\n signUpError: {\n message: AuthErrorStrings.SIGN_UP_ERROR,\n log: 'The first parameter should either be non-null string or object',\n },\n noMFA: {\n message: AuthErrorStrings.NO_MFA,\n },\n invalidMFA: {\n message: AuthErrorStrings.INVALID_MFA,\n },\n emptyChallengeResponse: {\n message: AuthErrorStrings.EMPTY_CHALLENGE,\n },\n noUserSession: {\n message: AuthErrorStrings.NO_USER_SESSION,\n },\n deviceConfig: {\n message: AuthErrorStrings.DEVICE_CONFIG,\n },\n networkError: {\n message: AuthErrorStrings.NETWORK_ERROR,\n },\n default: {\n message: AuthErrorStrings.DEFAULT_MSG,\n },\n};\n//# sourceMappingURL=Errors.js.map","/*\n * Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n *\t http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\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 __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nimport { isUsernamePasswordOpts, isCognitoHostedOpts, isFederatedSignInOptions, isFederatedSignInOptionsCustom, hasCustomState, } from './types';\nimport { Amplify, ConsoleLogger as Logger, Credentials, Hub, StorageHelper, Parser, JS, UniversalStorage, urlSafeDecode, } from '@aws-amplify/core';\nimport { CookieStorage, CognitoUserPool, AuthenticationDetails, CognitoUser, CognitoUserSession, CognitoUserAttribute, CognitoIdToken, CognitoRefreshToken, CognitoAccessToken, } from 'amazon-cognito-identity-js';\nimport { parse } from 'url';\nimport OAuth from './OAuth/OAuth';\nimport { default as urlListener } from './urlListener';\nimport { AuthError, NoUserPoolError } from './Errors';\nimport { AuthErrorTypes, CognitoHostedUIIdentityProvider, } from './types/Auth';\nvar logger = new Logger('AuthClass');\nvar USER_ADMIN_SCOPE = 'aws.cognito.signin.user.admin';\n// 10 sec, following this guide https://www.nngroup.com/articles/response-times-3-important-limits/\nvar OAUTH_FLOW_MS_TIMEOUT = 10 * 1000;\nvar AMPLIFY_SYMBOL = (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function'\n ? Symbol.for('amplify_default')\n : '@@amplify_default');\nvar dispatchAuthEvent = function (event, data, message) {\n Hub.dispatch('auth', { event: event, data: data, message: message }, 'Auth', AMPLIFY_SYMBOL);\n};\n// Cognito Documentation for max device\n// tslint:disable-next-line:max-line-length\n// https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_ListDevices.html#API_ListDevices_RequestSyntax\nvar MAX_DEVICES = 60;\n/**\n * Provide authentication steps\n */\nvar AuthClass = /** @class */ (function () {\n /**\n * Initialize Auth with AWS configurations\n * @param {Object} config - Configuration of the Auth\n */\n function AuthClass(config) {\n var _this = this;\n this.userPool = null;\n this.user = null;\n this.oAuthFlowInProgress = false;\n this.Credentials = Credentials;\n this.wrapRefreshSessionCallback = function (callback) {\n var wrapped = function (error, data) {\n if (data) {\n dispatchAuthEvent('tokenRefresh', undefined, \"New token retrieved\");\n }\n else {\n dispatchAuthEvent('tokenRefresh_failure', error, \"Failed to retrieve new token\");\n }\n return callback(error, data);\n };\n return wrapped;\n }; // prettier-ignore\n this.configure(config);\n this.currentCredentials = this.currentCredentials.bind(this);\n this.currentUserCredentials = this.currentUserCredentials.bind(this);\n Hub.listen('auth', function (_a) {\n var payload = _a.payload;\n var event = payload.event;\n switch (event) {\n case 'signIn':\n _this._storage.setItem('amplify-signin-with-hostedUI', 'false');\n break;\n case 'signOut':\n _this._storage.removeItem('amplify-signin-with-hostedUI');\n break;\n case 'cognitoHostedUI':\n _this._storage.setItem('amplify-signin-with-hostedUI', 'true');\n break;\n }\n });\n }\n AuthClass.prototype.getModuleName = function () {\n return 'Auth';\n };\n AuthClass.prototype.configure = function (config) {\n var _this = this;\n if (!config)\n return this._config || {};\n logger.debug('configure Auth');\n var conf = Object.assign({}, this._config, Parser.parseMobilehubConfig(config).Auth, config);\n this._config = conf;\n var _a = this._config, userPoolId = _a.userPoolId, userPoolWebClientId = _a.userPoolWebClientId, cookieStorage = _a.cookieStorage, oauth = _a.oauth, region = _a.region, identityPoolId = _a.identityPoolId, mandatorySignIn = _a.mandatorySignIn, refreshHandlers = _a.refreshHandlers, identityPoolRegion = _a.identityPoolRegion, clientMetadata = _a.clientMetadata, endpoint = _a.endpoint;\n if (!this._config.storage) {\n // backward compatability\n if (cookieStorage)\n this._storage = new CookieStorage(cookieStorage);\n else {\n this._storage = config.ssr\n ? new UniversalStorage()\n : new StorageHelper().getStorage();\n }\n }\n else {\n if (!this._isValidAuthStorage(this._config.storage)) {\n logger.error('The storage in the Auth config is not valid!');\n throw new Error('Empty storage object');\n }\n this._storage = this._config.storage;\n }\n this._storageSync = Promise.resolve();\n if (typeof this._storage['sync'] === 'function') {\n this._storageSync = this._storage['sync']();\n }\n if (userPoolId) {\n var userPoolData = {\n UserPoolId: userPoolId,\n ClientId: userPoolWebClientId,\n endpoint: endpoint,\n };\n userPoolData.Storage = this._storage;\n this.userPool = new CognitoUserPool(userPoolData, this.wrapRefreshSessionCallback);\n }\n this.Credentials.configure({\n mandatorySignIn: mandatorySignIn,\n region: identityPoolRegion || region,\n userPoolId: userPoolId,\n identityPoolId: identityPoolId,\n refreshHandlers: refreshHandlers,\n storage: this._storage,\n });\n // initialize cognitoauth client if hosted ui options provided\n // to keep backward compatibility:\n var cognitoHostedUIConfig = oauth\n ? isCognitoHostedOpts(this._config.oauth)\n ? oauth\n : oauth.awsCognito\n : undefined;\n if (cognitoHostedUIConfig) {\n var cognitoAuthParams = Object.assign({\n cognitoClientId: userPoolWebClientId,\n UserPoolId: userPoolId,\n domain: cognitoHostedUIConfig['domain'],\n scopes: cognitoHostedUIConfig['scope'],\n redirectSignIn: cognitoHostedUIConfig['redirectSignIn'],\n redirectSignOut: cognitoHostedUIConfig['redirectSignOut'],\n responseType: cognitoHostedUIConfig['responseType'],\n Storage: this._storage,\n urlOpener: cognitoHostedUIConfig['urlOpener'],\n clientMetadata: clientMetadata,\n }, cognitoHostedUIConfig['options']);\n this._oAuthHandler = new OAuth({\n scopes: cognitoAuthParams.scopes,\n config: cognitoAuthParams,\n cognitoClientId: cognitoAuthParams.cognitoClientId,\n });\n // **NOTE** - Remove this in a future major release as it is a breaking change\n // Prevents _handleAuthResponse from being called multiple times in Expo\n // See https://github.com/aws-amplify/amplify-js/issues/4388\n var usedResponseUrls_1 = {};\n urlListener(function (_a) {\n var url = _a.url;\n if (usedResponseUrls_1[url]) {\n return;\n }\n usedResponseUrls_1[url] = true;\n _this._handleAuthResponse(url);\n });\n }\n dispatchAuthEvent('configured', null, \"The Auth category has been configured successfully\");\n return this._config;\n };\n /**\n * Sign up with username, password and other attributes like phone, email\n * @param {String | object} params - The user attributes used for signin\n * @param {String[]} restOfAttrs - for the backward compatability\n * @return - A promise resolves callback data if success\n */\n AuthClass.prototype.signUp = function (params) {\n var _this = this;\n var restOfAttrs = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n restOfAttrs[_i - 1] = arguments[_i];\n }\n if (!this.userPool) {\n return this.rejectNoUserPool();\n }\n var username = null;\n var password = null;\n var attributes = [];\n var validationData = null;\n var clientMetadata;\n if (params && typeof params === 'string') {\n username = params;\n password = restOfAttrs ? restOfAttrs[0] : null;\n var email = restOfAttrs ? restOfAttrs[1] : null;\n var phone_number = restOfAttrs ? restOfAttrs[2] : null;\n if (email)\n attributes.push(new CognitoUserAttribute({ Name: 'email', Value: email }));\n if (phone_number)\n attributes.push(new CognitoUserAttribute({\n Name: 'phone_number',\n Value: phone_number,\n }));\n }\n else if (params && typeof params === 'object') {\n username = params['username'];\n password = params['password'];\n if (params && params.clientMetadata) {\n clientMetadata = params.clientMetadata;\n }\n else if (this._config.clientMetadata) {\n clientMetadata = this._config.clientMetadata;\n }\n var attrs_1 = params['attributes'];\n if (attrs_1) {\n Object.keys(attrs_1).map(function (key) {\n attributes.push(new CognitoUserAttribute({ Name: key, Value: attrs_1[key] }));\n });\n }\n var validationDataObject_1 = params['validationData'];\n if (validationDataObject_1) {\n validationData = [];\n Object.keys(validationDataObject_1).map(function (key) {\n validationData.push(new CognitoUserAttribute({\n Name: key,\n Value: validationDataObject_1[key],\n }));\n });\n }\n }\n else {\n return this.rejectAuthError(AuthErrorTypes.SignUpError);\n }\n if (!username) {\n return this.rejectAuthError(AuthErrorTypes.EmptyUsername);\n }\n if (!password) {\n return this.rejectAuthError(AuthErrorTypes.EmptyPassword);\n }\n logger.debug('signUp attrs:', attributes);\n logger.debug('signUp validation data:', validationData);\n return new Promise(function (resolve, reject) {\n _this.userPool.signUp(username, password, attributes, validationData, function (err, data) {\n if (err) {\n dispatchAuthEvent('signUp_failure', err, username + \" failed to signup\");\n reject(err);\n }\n else {\n dispatchAuthEvent('signUp', data, username + \" has signed up successfully\");\n resolve(data);\n }\n }, clientMetadata);\n });\n };\n /**\n * Send the verification code to confirm sign up\n * @param {String} username - The username to be confirmed\n * @param {String} code - The verification code\n * @param {ConfirmSignUpOptions} options - other options for confirm signup\n * @return - A promise resolves callback data if success\n */\n AuthClass.prototype.confirmSignUp = function (username, code, options) {\n if (!this.userPool) {\n return this.rejectNoUserPool();\n }\n if (!username) {\n return this.rejectAuthError(AuthErrorTypes.EmptyUsername);\n }\n if (!code) {\n return this.rejectAuthError(AuthErrorTypes.EmptyCode);\n }\n var user = this.createCognitoUser(username);\n var forceAliasCreation = options && typeof options.forceAliasCreation === 'boolean'\n ? options.forceAliasCreation\n : true;\n var clientMetadata;\n if (options && options.clientMetadata) {\n clientMetadata = options.clientMetadata;\n }\n else if (this._config.clientMetadata) {\n clientMetadata = this._config.clientMetadata;\n }\n return new Promise(function (resolve, reject) {\n user.confirmRegistration(code, forceAliasCreation, function (err, data) {\n if (err) {\n reject(err);\n }\n else {\n resolve(data);\n }\n }, clientMetadata);\n });\n };\n /**\n * Resend the verification code\n * @param {String} username - The username to be confirmed\n * @param {ClientMetadata} clientMetadata - Metadata to be passed to Cognito Lambda triggers\n * @return - A promise resolves code delivery details if successful\n */\n AuthClass.prototype.resendSignUp = function (username, clientMetadata) {\n if (clientMetadata === void 0) { clientMetadata = this._config.clientMetadata; }\n if (!this.userPool) {\n return this.rejectNoUserPool();\n }\n if (!username) {\n return this.rejectAuthError(AuthErrorTypes.EmptyUsername);\n }\n var user = this.createCognitoUser(username);\n return new Promise(function (resolve, reject) {\n user.resendConfirmationCode(function (err, data) {\n if (err) {\n reject(err);\n }\n else {\n resolve(data);\n }\n }, clientMetadata);\n });\n };\n /**\n * Sign in\n * @param {String | SignInOpts} usernameOrSignInOpts - The username to be signed in or the sign in options\n * @param {String} password - The password of the username\n * @return - A promise resolves the CognitoUser\n */\n AuthClass.prototype.signIn = function (usernameOrSignInOpts, pw, clientMetadata) {\n if (clientMetadata === void 0) { clientMetadata = this._config.clientMetadata; }\n if (!this.userPool) {\n return this.rejectNoUserPool();\n }\n var username = null;\n var password = null;\n var validationData = {};\n // for backward compatibility\n if (typeof usernameOrSignInOpts === 'string') {\n username = usernameOrSignInOpts;\n password = pw;\n }\n else if (isUsernamePasswordOpts(usernameOrSignInOpts)) {\n if (typeof pw !== 'undefined') {\n logger.warn('The password should be defined under the first parameter object!');\n }\n username = usernameOrSignInOpts.username;\n password = usernameOrSignInOpts.password;\n validationData = usernameOrSignInOpts.validationData;\n }\n else {\n return this.rejectAuthError(AuthErrorTypes.InvalidUsername);\n }\n if (!username) {\n return this.rejectAuthError(AuthErrorTypes.EmptyUsername);\n }\n var authDetails = new AuthenticationDetails({\n Username: username,\n Password: password,\n ValidationData: validationData,\n ClientMetadata: clientMetadata,\n });\n if (password) {\n return this.signInWithPassword(authDetails);\n }\n else {\n return this.signInWithoutPassword(authDetails);\n }\n };\n /**\n * Return an object with the authentication callbacks\n * @param {CognitoUser} user - the cognito user object\n * @param {} resolve - function called when resolving the current step\n * @param {} reject - function called when rejecting the current step\n * @return - an object with the callback methods for user authentication\n */\n AuthClass.prototype.authCallbacks = function (user, resolve, reject) {\n var _this = this;\n var that = this;\n return {\n onSuccess: function (session) { return __awaiter(_this, void 0, void 0, function () {\n var cred, e_1, currentUser, e_2;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n logger.debug(session);\n delete user['challengeName'];\n delete user['challengeParam'];\n _a.label = 1;\n case 1:\n _a.trys.push([1, 4, 5, 9]);\n return [4 /*yield*/, this.Credentials.clear()];\n case 2:\n _a.sent();\n return [4 /*yield*/, this.Credentials.set(session, 'session')];\n case 3:\n cred = _a.sent();\n logger.debug('succeed to get cognito credentials', cred);\n return [3 /*break*/, 9];\n case 4:\n e_1 = _a.sent();\n logger.debug('cannot get cognito credentials', e_1);\n return [3 /*break*/, 9];\n case 5:\n _a.trys.push([5, 7, , 8]);\n return [4 /*yield*/, this.currentUserPoolUser()];\n case 6:\n currentUser = _a.sent();\n that.user = currentUser;\n dispatchAuthEvent('signIn', currentUser, \"A user \" + user.getUsername() + \" has been signed in\");\n resolve(currentUser);\n return [3 /*break*/, 8];\n case 7:\n e_2 = _a.sent();\n logger.error('Failed to get the signed in user', e_2);\n reject(e_2);\n return [3 /*break*/, 8];\n case 8: return [7 /*endfinally*/];\n case 9: return [2 /*return*/];\n }\n });\n }); },\n onFailure: function (err) {\n logger.debug('signIn failure', err);\n dispatchAuthEvent('signIn_failure', err, user.getUsername() + \" failed to signin\");\n reject(err);\n },\n customChallenge: function (challengeParam) {\n logger.debug('signIn custom challenge answer required');\n user['challengeName'] = 'CUSTOM_CHALLENGE';\n user['challengeParam'] = challengeParam;\n resolve(user);\n },\n mfaRequired: function (challengeName, challengeParam) {\n logger.debug('signIn MFA required');\n user['challengeName'] = challengeName;\n user['challengeParam'] = challengeParam;\n resolve(user);\n },\n mfaSetup: function (challengeName, challengeParam) {\n logger.debug('signIn mfa setup', challengeName);\n user['challengeName'] = challengeName;\n user['challengeParam'] = challengeParam;\n resolve(user);\n },\n newPasswordRequired: function (userAttributes, requiredAttributes) {\n logger.debug('signIn new password');\n user['challengeName'] = 'NEW_PASSWORD_REQUIRED';\n user['challengeParam'] = {\n userAttributes: userAttributes,\n requiredAttributes: requiredAttributes,\n };\n resolve(user);\n },\n totpRequired: function (challengeName, challengeParam) {\n logger.debug('signIn totpRequired');\n user['challengeName'] = challengeName;\n user['challengeParam'] = challengeParam;\n resolve(user);\n },\n selectMFAType: function (challengeName, challengeParam) {\n logger.debug('signIn selectMFAType', challengeName);\n user['challengeName'] = challengeName;\n user['challengeParam'] = challengeParam;\n resolve(user);\n },\n };\n };\n /**\n * Sign in with a password\n * @private\n * @param {AuthenticationDetails} authDetails - the user sign in data\n * @return - A promise resolves the CognitoUser object if success or mfa required\n */\n AuthClass.prototype.signInWithPassword = function (authDetails) {\n var _this = this;\n if (this.pendingSignIn) {\n throw new Error('Pending sign-in attempt already in progress');\n }\n var user = this.createCognitoUser(authDetails.getUsername());\n this.pendingSignIn = new Promise(function (resolve, reject) {\n user.authenticateUser(authDetails, _this.authCallbacks(user, function (value) {\n _this.pendingSignIn = null;\n resolve(value);\n }, function (error) {\n _this.pendingSignIn = null;\n reject(error);\n }));\n });\n return this.pendingSignIn;\n };\n /**\n * Sign in without a password\n * @private\n * @param {AuthenticationDetails} authDetails - the user sign in data\n * @return - A promise resolves the CognitoUser object if success or mfa required\n */\n AuthClass.prototype.signInWithoutPassword = function (authDetails) {\n var _this = this;\n var user = this.createCognitoUser(authDetails.getUsername());\n user.setAuthenticationFlowType('CUSTOM_AUTH');\n return new Promise(function (resolve, reject) {\n user.initiateAuth(authDetails, _this.authCallbacks(user, resolve, reject));\n });\n };\n /**\n * This was previously used by an authenticated user to get MFAOptions,\n * but no longer returns a meaningful response. Refer to the documentation for\n * how to setup and use MFA: https://docs.amplify.aws/lib/auth/mfa/q/platform/js\n * @deprecated\n * @param {CognitoUser} user - the current user\n * @return - A promise resolves the current preferred mfa option if success\n */\n AuthClass.prototype.getMFAOptions = function (user) {\n return new Promise(function (res, rej) {\n user.getMFAOptions(function (err, mfaOptions) {\n if (err) {\n logger.debug('get MFA Options failed', err);\n rej(err);\n return;\n }\n logger.debug('get MFA options success', mfaOptions);\n res(mfaOptions);\n return;\n });\n });\n };\n /**\n * get preferred mfa method\n * @param {CognitoUser} user - the current cognito user\n * @param {GetPreferredMFAOpts} params - options for getting the current user preferred MFA\n */\n AuthClass.prototype.getPreferredMFA = function (user, params) {\n var _this = this;\n var that = this;\n return new Promise(function (res, rej) {\n var clientMetadata = _this._config.clientMetadata; // TODO: verify behavior if this is override during signIn\n var bypassCache = params ? params.bypassCache : false;\n user.getUserData(function (err, data) { return __awaiter(_this, void 0, void 0, function () {\n var cleanUpError_1, mfaType;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!err) return [3 /*break*/, 5];\n logger.debug('getting preferred mfa failed', err);\n if (!this.isSessionInvalid(err)) return [3 /*break*/, 4];\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, this.cleanUpInvalidSession(user)];\n case 2:\n _a.sent();\n return [3 /*break*/, 4];\n case 3:\n cleanUpError_1 = _a.sent();\n rej(new Error(\"Session is invalid due to: \" + err.message + \" and failed to clean up invalid session: \" + cleanUpError_1.message));\n return [2 /*return*/];\n case 4:\n rej(err);\n return [2 /*return*/];\n case 5:\n mfaType = that._getMfaTypeFromUserData(data);\n if (!mfaType) {\n rej('invalid MFA Type');\n return [2 /*return*/];\n }\n else {\n res(mfaType);\n return [2 /*return*/];\n }\n return [2 /*return*/];\n }\n });\n }); }, { bypassCache: bypassCache, clientMetadata: clientMetadata });\n });\n };\n AuthClass.prototype._getMfaTypeFromUserData = function (data) {\n var ret = null;\n var preferredMFA = data.PreferredMfaSetting;\n // if the user has used Auth.setPreferredMFA() to setup the mfa type\n // then the \"PreferredMfaSetting\" would exist in the response\n if (preferredMFA) {\n ret = preferredMFA;\n }\n else {\n // if mfaList exists but empty, then its noMFA\n var mfaList = data.UserMFASettingList;\n if (!mfaList) {\n // if SMS was enabled by using Auth.enableSMS(),\n // the response would contain MFAOptions\n // as for now Cognito only supports for SMS, so we will say it is 'SMS_MFA'\n // if it does not exist, then it should be NOMFA\n var MFAOptions = data.MFAOptions;\n if (MFAOptions) {\n ret = 'SMS_MFA';\n }\n else {\n ret = 'NOMFA';\n }\n }\n else if (mfaList.length === 0) {\n ret = 'NOMFA';\n }\n else {\n logger.debug('invalid case for getPreferredMFA', data);\n }\n }\n return ret;\n };\n AuthClass.prototype._getUserData = function (user, params) {\n var _this = this;\n return new Promise(function (res, rej) {\n user.getUserData(function (err, data) { return __awaiter(_this, void 0, void 0, function () {\n var cleanUpError_2;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!err) return [3 /*break*/, 5];\n logger.debug('getting user data failed', err);\n if (!this.isSessionInvalid(err)) return [3 /*break*/, 4];\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, this.cleanUpInvalidSession(user)];\n case 2:\n _a.sent();\n return [3 /*break*/, 4];\n case 3:\n cleanUpError_2 = _a.sent();\n rej(new Error(\"Session is invalid due to: \" + err.message + \" and failed to clean up invalid session: \" + cleanUpError_2.message));\n return [2 /*return*/];\n case 4:\n rej(err);\n return [2 /*return*/];\n case 5:\n res(data);\n _a.label = 6;\n case 6: return [2 /*return*/];\n }\n });\n }); }, params);\n });\n };\n /**\n * set preferred MFA method\n * @param {CognitoUser} user - the current Cognito user\n * @param {string} mfaMethod - preferred mfa method\n * @return - A promise resolve if success\n */\n AuthClass.prototype.setPreferredMFA = function (user, mfaMethod) {\n return __awaiter(this, void 0, void 0, function () {\n var clientMetadata, userData, smsMfaSettings, totpMfaSettings, _a, mfaList, currentMFAType, that;\n var _this = this;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n clientMetadata = this._config.clientMetadata;\n return [4 /*yield*/, this._getUserData(user, {\n bypassCache: true,\n clientMetadata: clientMetadata,\n })];\n case 1:\n userData = _b.sent();\n smsMfaSettings = null;\n totpMfaSettings = null;\n _a = mfaMethod;\n switch (_a) {\n case 'TOTP': return [3 /*break*/, 2];\n case 'SOFTWARE_TOKEN_MFA': return [3 /*break*/, 2];\n case 'SMS': return [3 /*break*/, 3];\n case 'SMS_MFA': return [3 /*break*/, 3];\n case 'NOMFA': return [3 /*break*/, 4];\n }\n return [3 /*break*/, 6];\n case 2:\n totpMfaSettings = {\n PreferredMfa: true,\n Enabled: true,\n };\n return [3 /*break*/, 7];\n case 3:\n smsMfaSettings = {\n PreferredMfa: true,\n Enabled: true,\n };\n return [3 /*break*/, 7];\n case 4:\n mfaList = userData['UserMFASettingList'];\n return [4 /*yield*/, this._getMfaTypeFromUserData(userData)];\n case 5:\n currentMFAType = _b.sent();\n if (currentMFAType === 'NOMFA') {\n return [2 /*return*/, Promise.resolve('No change for mfa type')];\n }\n else if (currentMFAType === 'SMS_MFA') {\n smsMfaSettings = {\n PreferredMfa: false,\n Enabled: false,\n };\n }\n else if (currentMFAType === 'SOFTWARE_TOKEN_MFA') {\n totpMfaSettings = {\n PreferredMfa: false,\n Enabled: false,\n };\n }\n else {\n return [2 /*return*/, this.rejectAuthError(AuthErrorTypes.InvalidMFA)];\n }\n // if there is a UserMFASettingList in the response\n // we need to disable every mfa type in that list\n if (mfaList && mfaList.length !== 0) {\n // to disable SMS or TOTP if exists in that list\n mfaList.forEach(function (mfaType) {\n if (mfaType === 'SMS_MFA') {\n smsMfaSettings = {\n PreferredMfa: false,\n Enabled: false,\n };\n }\n else if (mfaType === 'SOFTWARE_TOKEN_MFA') {\n totpMfaSettings = {\n PreferredMfa: false,\n Enabled: false,\n };\n }\n });\n }\n return [3 /*break*/, 7];\n case 6:\n logger.debug('no validmfa method provided');\n return [2 /*return*/, this.rejectAuthError(AuthErrorTypes.NoMFA)];\n case 7:\n that = this;\n return [2 /*return*/, new Promise(function (res, rej) {\n user.setUserMfaPreference(smsMfaSettings, totpMfaSettings, function (err, result) {\n if (err) {\n logger.debug('Set user mfa preference error', err);\n return rej(err);\n }\n logger.debug('Set user mfa success', result);\n logger.debug('Caching the latest user data into local');\n // cache the latest result into user data\n user.getUserData(function (err, data) { return __awaiter(_this, void 0, void 0, function () {\n var cleanUpError_3;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!err) return [3 /*break*/, 5];\n logger.debug('getting user data failed', err);\n if (!this.isSessionInvalid(err)) return [3 /*break*/, 4];\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, this.cleanUpInvalidSession(user)];\n case 2:\n _a.sent();\n return [3 /*break*/, 4];\n case 3:\n cleanUpError_3 = _a.sent();\n rej(new Error(\"Session is invalid due to: \" + err.message + \" and failed to clean up invalid session: \" + cleanUpError_3.message));\n return [2 /*return*/];\n case 4: return [2 /*return*/, rej(err)];\n case 5: return [2 /*return*/, res(result)];\n }\n });\n }); }, {\n bypassCache: true,\n clientMetadata: clientMetadata,\n });\n });\n })];\n }\n });\n });\n };\n /**\n * disable SMS\n * @deprecated\n * @param {CognitoUser} user - the current user\n * @return - A promise resolves is success\n */\n AuthClass.prototype.disableSMS = function (user) {\n return new Promise(function (res, rej) {\n user.disableMFA(function (err, data) {\n if (err) {\n logger.debug('disable mfa failed', err);\n rej(err);\n return;\n }\n logger.debug('disable mfa succeed', data);\n res(data);\n return;\n });\n });\n };\n /**\n * enable SMS\n * @deprecated\n * @param {CognitoUser} user - the current user\n * @return - A promise resolves is success\n */\n AuthClass.prototype.enableSMS = function (user) {\n return new Promise(function (res, rej) {\n user.enableMFA(function (err, data) {\n if (err) {\n logger.debug('enable mfa failed', err);\n rej(err);\n return;\n }\n logger.debug('enable mfa succeed', data);\n res(data);\n return;\n });\n });\n };\n /**\n * Setup TOTP\n * @param {CognitoUser} user - the current user\n * @return - A promise resolves with the secret code if success\n */\n AuthClass.prototype.setupTOTP = function (user) {\n return new Promise(function (res, rej) {\n user.associateSoftwareToken({\n onFailure: function (err) {\n logger.debug('associateSoftwareToken failed', err);\n rej(err);\n return;\n },\n associateSecretCode: function (secretCode) {\n logger.debug('associateSoftwareToken sucess', secretCode);\n res(secretCode);\n return;\n },\n });\n });\n };\n /**\n * verify TOTP setup\n * @param {CognitoUser} user - the current user\n * @param {string} challengeAnswer - challenge answer\n * @return - A promise resolves is success\n */\n AuthClass.prototype.verifyTotpToken = function (user, challengeAnswer) {\n logger.debug('verification totp token', user, challengeAnswer);\n return new Promise(function (res, rej) {\n user.verifySoftwareToken(challengeAnswer, 'My TOTP device', {\n onFailure: function (err) {\n logger.debug('verifyTotpToken failed', err);\n rej(err);\n return;\n },\n onSuccess: function (data) {\n dispatchAuthEvent('signIn', user, \"A user \" + user.getUsername() + \" has been signed in\");\n logger.debug('verifyTotpToken success', data);\n res(data);\n return;\n },\n });\n });\n };\n /**\n * Send MFA code to confirm sign in\n * @param {Object} user - The CognitoUser object\n * @param {String} code - The confirmation code\n */\n AuthClass.prototype.confirmSignIn = function (user, code, mfaType, clientMetadata) {\n var _this = this;\n if (clientMetadata === void 0) { clientMetadata = this._config.clientMetadata; }\n if (!code) {\n return this.rejectAuthError(AuthErrorTypes.EmptyCode);\n }\n var that = this;\n return new Promise(function (resolve, reject) {\n user.sendMFACode(code, {\n onSuccess: function (session) { return __awaiter(_this, void 0, void 0, function () {\n var cred, e_3;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n logger.debug(session);\n _a.label = 1;\n case 1:\n _a.trys.push([1, 4, 5, 6]);\n return [4 /*yield*/, this.Credentials.clear()];\n case 2:\n _a.sent();\n return [4 /*yield*/, this.Credentials.set(session, 'session')];\n case 3:\n cred = _a.sent();\n logger.debug('succeed to get cognito credentials', cred);\n return [3 /*break*/, 6];\n case 4:\n e_3 = _a.sent();\n logger.debug('cannot get cognito credentials', e_3);\n return [3 /*break*/, 6];\n case 5:\n that.user = user;\n dispatchAuthEvent('signIn', user, \"A user \" + user.getUsername() + \" has been signed in\");\n resolve(user);\n return [7 /*endfinally*/];\n case 6: return [2 /*return*/];\n }\n });\n }); },\n onFailure: function (err) {\n logger.debug('confirm signIn failure', err);\n reject(err);\n },\n }, mfaType, clientMetadata);\n });\n };\n AuthClass.prototype.completeNewPassword = function (user, password, requiredAttributes, clientMetadata) {\n var _this = this;\n if (requiredAttributes === void 0) { requiredAttributes = {}; }\n if (clientMetadata === void 0) { clientMetadata = this._config.clientMetadata; }\n if (!password) {\n return this.rejectAuthError(AuthErrorTypes.EmptyPassword);\n }\n var that = this;\n return new Promise(function (resolve, reject) {\n user.completeNewPasswordChallenge(password, requiredAttributes, {\n onSuccess: function (session) { return __awaiter(_this, void 0, void 0, function () {\n var cred, e_4;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n logger.debug(session);\n _a.label = 1;\n case 1:\n _a.trys.push([1, 4, 5, 6]);\n return [4 /*yield*/, this.Credentials.clear()];\n case 2:\n _a.sent();\n return [4 /*yield*/, this.Credentials.set(session, 'session')];\n case 3:\n cred = _a.sent();\n logger.debug('succeed to get cognito credentials', cred);\n return [3 /*break*/, 6];\n case 4:\n e_4 = _a.sent();\n logger.debug('cannot get cognito credentials', e_4);\n return [3 /*break*/, 6];\n case 5:\n that.user = user;\n dispatchAuthEvent('signIn', user, \"A user \" + user.getUsername() + \" has been signed in\");\n resolve(user);\n return [7 /*endfinally*/];\n case 6: return [2 /*return*/];\n }\n });\n }); },\n onFailure: function (err) {\n logger.debug('completeNewPassword failure', err);\n dispatchAuthEvent('completeNewPassword_failure', err, _this.user + \" failed to complete the new password flow\");\n reject(err);\n },\n mfaRequired: function (challengeName, challengeParam) {\n logger.debug('signIn MFA required');\n user['challengeName'] = challengeName;\n user['challengeParam'] = challengeParam;\n resolve(user);\n },\n mfaSetup: function (challengeName, challengeParam) {\n logger.debug('signIn mfa setup', challengeName);\n user['challengeName'] = challengeName;\n user['challengeParam'] = challengeParam;\n resolve(user);\n },\n totpRequired: function (challengeName, challengeParam) {\n logger.debug('signIn mfa setup', challengeName);\n user['challengeName'] = challengeName;\n user['challengeParam'] = challengeParam;\n resolve(user);\n },\n }, clientMetadata);\n });\n };\n /**\n * Send the answer to a custom challenge\n * @param {CognitoUser} user - The CognitoUser object\n * @param {String} challengeResponses - The confirmation code\n */\n AuthClass.prototype.sendCustomChallengeAnswer = function (user, challengeResponses, clientMetadata) {\n var _this = this;\n if (clientMetadata === void 0) { clientMetadata = this._config.clientMetadata; }\n if (!this.userPool) {\n return this.rejectNoUserPool();\n }\n if (!challengeResponses) {\n return this.rejectAuthError(AuthErrorTypes.EmptyChallengeResponse);\n }\n var that = this;\n return new Promise(function (resolve, reject) {\n user.sendCustomChallengeAnswer(challengeResponses, _this.authCallbacks(user, resolve, reject), clientMetadata);\n });\n };\n /**\n * Delete an authenticated users' attributes\n * @param {CognitoUser} - The currently logged in user object\n * @return {Promise}\n **/\n AuthClass.prototype.deleteUserAttributes = function (user, attributeNames) {\n var that = this;\n return new Promise(function (resolve, reject) {\n that.userSession(user).then(function (session) {\n user.deleteAttributes(attributeNames, function (err, result) {\n if (err) {\n return reject(err);\n }\n else {\n return resolve(result);\n }\n });\n });\n });\n };\n /**\n * Delete the current authenticated user\n * @return {Promise}\n **/\n // TODO: Check return type void\n AuthClass.prototype.deleteUser = function () {\n return __awaiter(this, void 0, void 0, function () {\n var e_5, isSignedInHostedUI;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 2, , 3]);\n return [4 /*yield*/, this._storageSync];\n case 1:\n _a.sent();\n return [3 /*break*/, 3];\n case 2:\n e_5 = _a.sent();\n logger.debug('Failed to sync cache info into memory', e_5);\n throw new Error(e_5);\n case 3:\n isSignedInHostedUI = this._oAuthHandler &&\n this._storage.getItem('amplify-signin-with-hostedUI') === 'true';\n return [2 /*return*/, new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {\n var user_1;\n var _this = this;\n return __generator(this, function (_a) {\n if (this.userPool) {\n user_1 = this.userPool.getCurrentUser();\n if (!user_1) {\n logger.debug('Failed to get user from user pool');\n return [2 /*return*/, rej(new Error('No current user.'))];\n }\n else {\n user_1.getSession(function (err, session) { return __awaiter(_this, void 0, void 0, function () {\n var cleanUpError_4;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!err) return [3 /*break*/, 5];\n logger.debug('Failed to get the user session', err);\n if (!this.isSessionInvalid(err)) return [3 /*break*/, 4];\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, this.cleanUpInvalidSession(user_1)];\n case 2:\n _a.sent();\n return [3 /*break*/, 4];\n case 3:\n cleanUpError_4 = _a.sent();\n rej(new Error(\"Session is invalid due to: \" + err.message + \" and failed to clean up invalid session: \" + cleanUpError_4.message));\n return [2 /*return*/];\n case 4: return [2 /*return*/, rej(err)];\n case 5:\n user_1.deleteUser(function (err, result) {\n if (err) {\n rej(err);\n }\n else {\n dispatchAuthEvent('userDeleted', result, 'The authenticated user has been deleted.');\n user_1.signOut();\n _this.user = null;\n try {\n _this.cleanCachedItems(); // clean aws credentials\n }\n catch (e) {\n // TODO: change to rejects in refactor\n logger.debug('failed to clear cached items');\n }\n if (isSignedInHostedUI) {\n _this.oAuthSignOutRedirect(res, rej);\n }\n else {\n dispatchAuthEvent('signOut', _this.user, \"A user has been signed out\");\n res(result);\n }\n }\n });\n _a.label = 6;\n case 6: return [2 /*return*/];\n }\n });\n }); });\n }\n }\n else {\n logger.debug('no Congito User pool');\n rej(new Error('Cognito User pool does not exist'));\n }\n return [2 /*return*/];\n });\n }); })];\n }\n });\n });\n };\n /**\n * Update an authenticated users' attributes\n * @param {CognitoUser} - The currently logged in user object\n * @return {Promise}\n **/\n AuthClass.prototype.updateUserAttributes = function (user, attributes, clientMetadata) {\n if (clientMetadata === void 0) { clientMetadata = this._config.clientMetadata; }\n var attributeList = [];\n var that = this;\n return new Promise(function (resolve, reject) {\n that.userSession(user).then(function (session) {\n for (var key in attributes) {\n if (key !== 'sub' && key.indexOf('_verified') < 0) {\n var attr = {\n Name: key,\n Value: attributes[key],\n };\n attributeList.push(attr);\n }\n }\n user.updateAttributes(attributeList, function (err, result) {\n if (err) {\n return reject(err);\n }\n else {\n return resolve(result);\n }\n }, clientMetadata);\n });\n });\n };\n /**\n * Return user attributes\n * @param {Object} user - The CognitoUser object\n * @return - A promise resolves to user attributes if success\n */\n AuthClass.prototype.userAttributes = function (user) {\n var _this = this;\n return new Promise(function (resolve, reject) {\n _this.userSession(user).then(function (session) {\n user.getUserAttributes(function (err, attributes) {\n if (err) {\n reject(err);\n }\n else {\n resolve(attributes);\n }\n });\n });\n });\n };\n AuthClass.prototype.verifiedContact = function (user) {\n var that = this;\n return this.userAttributes(user).then(function (attributes) {\n var attrs = that.attributesToObject(attributes);\n var unverified = {};\n var verified = {};\n if (attrs['email']) {\n if (attrs['email_verified']) {\n verified['email'] = attrs['email'];\n }\n else {\n unverified['email'] = attrs['email'];\n }\n }\n if (attrs['phone_number']) {\n if (attrs['phone_number_verified']) {\n verified['phone_number'] = attrs['phone_number'];\n }\n else {\n unverified['phone_number'] = attrs['phone_number'];\n }\n }\n return {\n verified: verified,\n unverified: unverified,\n };\n });\n };\n AuthClass.prototype.isErrorWithMessage = function (err) {\n return (typeof err === 'object' &&\n Object.prototype.hasOwnProperty.call(err, 'message'));\n };\n // Session revoked by another app\n AuthClass.prototype.isTokenRevokedError = function (err) {\n return (this.isErrorWithMessage(err) &&\n err.message === 'Access Token has been revoked');\n };\n AuthClass.prototype.isRefreshTokenRevokedError = function (err) {\n return (this.isErrorWithMessage(err) &&\n err.message === 'Refresh Token has been revoked');\n };\n AuthClass.prototype.isUserDisabledError = function (err) {\n return this.isErrorWithMessage(err) && err.message === 'User is disabled.';\n };\n AuthClass.prototype.isUserDoesNotExistError = function (err) {\n return (this.isErrorWithMessage(err) && err.message === 'User does not exist.');\n };\n AuthClass.prototype.isRefreshTokenExpiredError = function (err) {\n return (this.isErrorWithMessage(err) &&\n err.message === 'Refresh Token has expired');\n };\n AuthClass.prototype.isSignedInHostedUI = function () {\n return (this._oAuthHandler &&\n this._storage.getItem('amplify-signin-with-hostedUI') === 'true');\n };\n AuthClass.prototype.isSessionInvalid = function (err) {\n return (this.isUserDisabledError(err) ||\n this.isUserDoesNotExistError(err) ||\n this.isTokenRevokedError(err) ||\n this.isRefreshTokenRevokedError(err) ||\n this.isRefreshTokenExpiredError(err));\n };\n AuthClass.prototype.cleanUpInvalidSession = function (user) {\n return __awaiter(this, void 0, void 0, function () {\n var e_6;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n user.signOut();\n this.user = null;\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, this.cleanCachedItems()];\n case 2:\n _a.sent(); // clean aws credentials\n return [3 /*break*/, 4];\n case 3:\n e_6 = _a.sent();\n logger.debug('failed to clear cached items');\n return [3 /*break*/, 4];\n case 4:\n if (this.isSignedInHostedUI()) {\n return [2 /*return*/, new Promise(function (res, rej) {\n _this.oAuthSignOutRedirect(res, rej);\n })];\n }\n else {\n dispatchAuthEvent('signOut', this.user, \"A user has been signed out\");\n }\n return [2 /*return*/];\n }\n });\n });\n };\n /**\n * Get current authenticated user\n * @return - A promise resolves to current authenticated CognitoUser if success\n */\n AuthClass.prototype.currentUserPoolUser = function (params) {\n var _this = this;\n if (!this.userPool) {\n return this.rejectNoUserPool();\n }\n return new Promise(function (res, rej) {\n _this._storageSync\n .then(function () { return __awaiter(_this, void 0, void 0, function () {\n var user, clientMetadata;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!this.isOAuthInProgress()) return [3 /*break*/, 2];\n logger.debug('OAuth signIn in progress, waiting for resolution...');\n return [4 /*yield*/, new Promise(function (res) {\n var timeoutId = setTimeout(function () {\n logger.debug('OAuth signIn in progress timeout');\n Hub.remove('auth', hostedUISignCallback);\n res();\n }, OAUTH_FLOW_MS_TIMEOUT);\n Hub.listen('auth', hostedUISignCallback);\n function hostedUISignCallback(_a) {\n var payload = _a.payload;\n var event = payload.event;\n if (event === 'cognitoHostedUI' ||\n event === 'cognitoHostedUI_failure') {\n logger.debug(\"OAuth signIn resolved: \" + event);\n clearTimeout(timeoutId);\n Hub.remove('auth', hostedUISignCallback);\n res();\n }\n }\n })];\n case 1:\n _a.sent();\n _a.label = 2;\n case 2:\n user = this.userPool.getCurrentUser();\n if (!user) {\n logger.debug('Failed to get user from user pool');\n rej('No current user');\n return [2 /*return*/];\n }\n clientMetadata = this._config.clientMetadata;\n // refresh the session if the session expired.\n user.getSession(function (err, session) { return __awaiter(_this, void 0, void 0, function () {\n var cleanUpError_5, bypassCache, clientMetadata, _a, scope;\n var _this = this;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (!err) return [3 /*break*/, 5];\n logger.debug('Failed to get the user session', err);\n if (!this.isSessionInvalid(err)) return [3 /*break*/, 4];\n _b.label = 1;\n case 1:\n _b.trys.push([1, 3, , 4]);\n return [4 /*yield*/, this.cleanUpInvalidSession(user)];\n case 2:\n _b.sent();\n return [3 /*break*/, 4];\n case 3:\n cleanUpError_5 = _b.sent();\n rej(new Error(\"Session is invalid due to: \" + err.message + \" and failed to clean up invalid session: \" + cleanUpError_5.message));\n return [2 /*return*/];\n case 4:\n rej(err);\n return [2 /*return*/];\n case 5:\n bypassCache = params ? params.bypassCache : false;\n if (!bypassCache) return [3 /*break*/, 7];\n return [4 /*yield*/, this.Credentials.clear()];\n case 6:\n _b.sent();\n _b.label = 7;\n case 7:\n clientMetadata = this._config.clientMetadata;\n _a = session.getAccessToken().decodePayload().scope, scope = _a === void 0 ? '' : _a;\n if (scope.split(' ').includes(USER_ADMIN_SCOPE)) {\n user.getUserData(function (err, data) { return __awaiter(_this, void 0, void 0, function () {\n var cleanUpError_6, preferredMFA, attributeList, i, attribute, userAttribute, attributes;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!err) return [3 /*break*/, 7];\n logger.debug('getting user data failed', err);\n if (!this.isSessionInvalid(err)) return [3 /*break*/, 5];\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, this.cleanUpInvalidSession(user)];\n case 2:\n _a.sent();\n return [3 /*break*/, 4];\n case 3:\n cleanUpError_6 = _a.sent();\n rej(new Error(\"Session is invalid due to: \" + err.message + \" and failed to clean up invalid session: \" + cleanUpError_6.message));\n return [2 /*return*/];\n case 4:\n rej(err);\n return [3 /*break*/, 6];\n case 5:\n res(user);\n _a.label = 6;\n case 6: return [2 /*return*/];\n case 7:\n preferredMFA = data.PreferredMfaSetting || 'NOMFA';\n attributeList = [];\n for (i = 0; i < data.UserAttributes.length; i++) {\n attribute = {\n Name: data.UserAttributes[i].Name,\n Value: data.UserAttributes[i].Value,\n };\n userAttribute = new CognitoUserAttribute(attribute);\n attributeList.push(userAttribute);\n }\n attributes = this.attributesToObject(attributeList);\n Object.assign(user, { attributes: attributes, preferredMFA: preferredMFA });\n return [2 /*return*/, res(user)];\n }\n });\n }); }, { bypassCache: bypassCache, clientMetadata: clientMetadata });\n }\n else {\n logger.debug(\"Unable to get the user data because the \" + USER_ADMIN_SCOPE + \" \" +\n \"is not in the scopes of the access token\");\n return [2 /*return*/, res(user)];\n }\n return [2 /*return*/];\n }\n });\n }); }, { clientMetadata: clientMetadata });\n return [2 /*return*/];\n }\n });\n }); })\n .catch(function (e) {\n logger.debug('Failed to sync cache info into memory', e);\n return rej(e);\n });\n });\n };\n AuthClass.prototype.isOAuthInProgress = function () {\n return this.oAuthFlowInProgress;\n };\n /**\n * Get current authenticated user\n * @param {CurrentUserOpts} - options for getting the current user\n * @return - A promise resolves to current authenticated CognitoUser if success\n */\n AuthClass.prototype.currentAuthenticatedUser = function (params) {\n return __awaiter(this, void 0, void 0, function () {\n var federatedUser, e_7, federatedInfo, user, e_8;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n logger.debug('getting current authenticated user');\n federatedUser = null;\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, this._storageSync];\n case 2:\n _a.sent();\n return [3 /*break*/, 4];\n case 3:\n e_7 = _a.sent();\n logger.debug('Failed to sync cache info into memory', e_7);\n throw e_7;\n case 4:\n try {\n federatedInfo = JSON.parse(this._storage.getItem('aws-amplify-federatedInfo'));\n if (federatedInfo) {\n federatedUser = __assign(__assign({}, federatedInfo.user), { token: federatedInfo.token });\n }\n }\n catch (e) {\n logger.debug('cannot load federated user from auth storage');\n }\n if (!federatedUser) return [3 /*break*/, 5];\n this.user = federatedUser;\n logger.debug('get current authenticated federated user', this.user);\n return [2 /*return*/, this.user];\n case 5:\n logger.debug('get current authenticated userpool user');\n user = null;\n _a.label = 6;\n case 6:\n _a.trys.push([6, 8, , 9]);\n return [4 /*yield*/, this.currentUserPoolUser(params)];\n case 7:\n user = _a.sent();\n return [3 /*break*/, 9];\n case 8:\n e_8 = _a.sent();\n if (e_8 === 'No userPool') {\n logger.error('Cannot get the current user because the user pool is missing. ' +\n 'Please make sure the Auth module is configured with a valid Cognito User Pool ID');\n }\n logger.debug('The user is not authenticated by the error', e_8);\n return [2 /*return*/, Promise.reject('The user is not authenticated')];\n case 9:\n this.user = user;\n return [2 /*return*/, this.user];\n }\n });\n });\n };\n /**\n * Get current user's session\n * @return - A promise resolves to session object if success\n */\n AuthClass.prototype.currentSession = function () {\n var that = this;\n logger.debug('Getting current session');\n // Purposely not calling the reject method here because we don't need a console error\n if (!this.userPool) {\n return this.rejectNoUserPool();\n }\n return new Promise(function (res, rej) {\n that\n .currentUserPoolUser()\n .then(function (user) {\n that\n .userSession(user)\n .then(function (session) {\n res(session);\n return;\n })\n .catch(function (e) {\n logger.debug('Failed to get the current session', e);\n rej(e);\n return;\n });\n })\n .catch(function (e) {\n logger.debug('Failed to get the current user', e);\n rej(e);\n return;\n });\n });\n };\n /**\n * Get the corresponding user session\n * @param {Object} user - The CognitoUser object\n * @return - A promise resolves to the session\n */\n AuthClass.prototype.userSession = function (user) {\n var _this = this;\n if (!user) {\n logger.debug('the user is null');\n return this.rejectAuthError(AuthErrorTypes.NoUserSession);\n }\n var clientMetadata = this._config.clientMetadata; // TODO: verify behavior if this is override during signIn\n return new Promise(function (res, rej) {\n logger.debug('Getting the session from this user:', user);\n user.getSession(function (err, session) { return __awaiter(_this, void 0, void 0, function () {\n var cleanUpError_7;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!err) return [3 /*break*/, 5];\n logger.debug('Failed to get the session from user', user);\n if (!this.isSessionInvalid(err)) return [3 /*break*/, 4];\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, this.cleanUpInvalidSession(user)];\n case 2:\n _a.sent();\n return [3 /*break*/, 4];\n case 3:\n cleanUpError_7 = _a.sent();\n rej(new Error(\"Session is invalid due to: \" + err.message + \" and failed to clean up invalid session: \" + cleanUpError_7.message));\n return [2 /*return*/];\n case 4:\n rej(err);\n return [2 /*return*/];\n case 5:\n logger.debug('Succeed to get the user session', session);\n res(session);\n return [2 /*return*/];\n }\n });\n }); }, { clientMetadata: clientMetadata });\n });\n };\n /**\n * Get authenticated credentials of current user.\n * @return - A promise resolves to be current user's credentials\n */\n AuthClass.prototype.currentUserCredentials = function () {\n return __awaiter(this, void 0, void 0, function () {\n var e_9, federatedInfo;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n logger.debug('Getting current user credentials');\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, this._storageSync];\n case 2:\n _a.sent();\n return [3 /*break*/, 4];\n case 3:\n e_9 = _a.sent();\n logger.debug('Failed to sync cache info into memory', e_9);\n throw e_9;\n case 4:\n federatedInfo = null;\n try {\n federatedInfo = JSON.parse(this._storage.getItem('aws-amplify-federatedInfo'));\n }\n catch (e) {\n logger.debug('failed to get or parse item aws-amplify-federatedInfo', e);\n }\n if (federatedInfo) {\n // refresh the jwt token here if necessary\n return [2 /*return*/, this.Credentials.refreshFederatedToken(federatedInfo)];\n }\n else {\n return [2 /*return*/, this.currentSession()\n .then(function (session) {\n logger.debug('getting session success', session);\n return _this.Credentials.set(session, 'session');\n })\n .catch(function () {\n logger.debug('getting guest credentials');\n return _this.Credentials.set(null, 'guest');\n })];\n }\n return [2 /*return*/];\n }\n });\n });\n };\n AuthClass.prototype.currentCredentials = function () {\n logger.debug('getting current credentials');\n return this.Credentials.get();\n };\n /**\n * Initiate an attribute confirmation request\n * @param {Object} user - The CognitoUser\n * @param {Object} attr - The attributes to be verified\n * @return - A promise resolves to callback data if success\n */\n AuthClass.prototype.verifyUserAttribute = function (user, attr, clientMetadata) {\n if (clientMetadata === void 0) { clientMetadata = this._config.clientMetadata; }\n return new Promise(function (resolve, reject) {\n user.getAttributeVerificationCode(attr, {\n onSuccess: function (success) {\n return resolve(success);\n },\n onFailure: function (err) {\n return reject(err);\n },\n }, clientMetadata);\n });\n };\n /**\n * Confirm an attribute using a confirmation code\n * @param {Object} user - The CognitoUser\n * @param {Object} attr - The attribute to be verified\n * @param {String} code - The confirmation code\n * @return - A promise resolves to callback data if success\n */\n AuthClass.prototype.verifyUserAttributeSubmit = function (user, attr, code) {\n if (!code) {\n return this.rejectAuthError(AuthErrorTypes.EmptyCode);\n }\n return new Promise(function (resolve, reject) {\n user.verifyAttribute(attr, code, {\n onSuccess: function (data) {\n resolve(data);\n return;\n },\n onFailure: function (err) {\n reject(err);\n return;\n },\n });\n });\n };\n AuthClass.prototype.verifyCurrentUserAttribute = function (attr) {\n var that = this;\n return that\n .currentUserPoolUser()\n .then(function (user) { return that.verifyUserAttribute(user, attr); });\n };\n /**\n * Confirm current user's attribute using a confirmation code\n * @param {Object} attr - The attribute to be verified\n * @param {String} code - The confirmation code\n * @return - A promise resolves to callback data if success\n */\n AuthClass.prototype.verifyCurrentUserAttributeSubmit = function (attr, code) {\n var that = this;\n return that\n .currentUserPoolUser()\n .then(function (user) { return that.verifyUserAttributeSubmit(user, attr, code); });\n };\n AuthClass.prototype.cognitoIdentitySignOut = function (opts, user) {\n return __awaiter(this, void 0, void 0, function () {\n var e_10, isSignedInHostedUI;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 2, , 3]);\n return [4 /*yield*/, this._storageSync];\n case 1:\n _a.sent();\n return [3 /*break*/, 3];\n case 2:\n e_10 = _a.sent();\n logger.debug('Failed to sync cache info into memory', e_10);\n throw e_10;\n case 3:\n isSignedInHostedUI = this._oAuthHandler &&\n this._storage.getItem('amplify-signin-with-hostedUI') === 'true';\n return [2 /*return*/, new Promise(function (res, rej) {\n if (opts && opts.global) {\n logger.debug('user global sign out', user);\n // in order to use global signout\n // we must validate the user as an authenticated user by using getSession\n var clientMetadata = _this._config.clientMetadata; // TODO: verify behavior if this is override during signIn\n user.getSession(function (err, result) { return __awaiter(_this, void 0, void 0, function () {\n var cleanUpError_8;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!err) return [3 /*break*/, 5];\n logger.debug('failed to get the user session', err);\n if (!this.isSessionInvalid(err)) return [3 /*break*/, 4];\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, this.cleanUpInvalidSession(user)];\n case 2:\n _a.sent();\n return [3 /*break*/, 4];\n case 3:\n cleanUpError_8 = _a.sent();\n rej(new Error(\"Session is invalid due to: \" + err.message + \" and failed to clean up invalid session: \" + cleanUpError_8.message));\n return [2 /*return*/];\n case 4: return [2 /*return*/, rej(err)];\n case 5:\n user.globalSignOut({\n onSuccess: function (data) {\n logger.debug('global sign out success');\n if (isSignedInHostedUI) {\n _this.oAuthSignOutRedirect(res, rej);\n }\n else {\n return res();\n }\n },\n onFailure: function (err) {\n logger.debug('global sign out failed', err);\n return rej(err);\n },\n });\n return [2 /*return*/];\n }\n });\n }); }, { clientMetadata: clientMetadata });\n }\n else {\n logger.debug('user sign out', user);\n user.signOut(function () {\n if (isSignedInHostedUI) {\n _this.oAuthSignOutRedirect(res, rej);\n }\n else {\n return res();\n }\n });\n }\n })];\n }\n });\n });\n };\n AuthClass.prototype.oAuthSignOutRedirect = function (resolve, reject) {\n var isBrowser = JS.browserOrNode().isBrowser;\n if (isBrowser) {\n this.oAuthSignOutRedirectOrReject(reject);\n }\n else {\n this.oAuthSignOutAndResolve(resolve);\n }\n };\n AuthClass.prototype.oAuthSignOutAndResolve = function (resolve) {\n this._oAuthHandler.signOut();\n resolve();\n };\n AuthClass.prototype.oAuthSignOutRedirectOrReject = function (reject) {\n this._oAuthHandler.signOut(); // this method redirects url\n // App should be redirected to another url otherwise it will reject\n setTimeout(function () { return reject(Error('Signout timeout fail')); }, 3000);\n };\n /**\n * Sign out method\n * @\n * @return - A promise resolved if success\n */\n AuthClass.prototype.signOut = function (opts) {\n return __awaiter(this, void 0, void 0, function () {\n var e_11, user;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 2, , 3]);\n return [4 /*yield*/, this.cleanCachedItems()];\n case 1:\n _a.sent();\n return [3 /*break*/, 3];\n case 2:\n e_11 = _a.sent();\n logger.debug('failed to clear cached items');\n return [3 /*break*/, 3];\n case 3:\n if (!this.userPool) return [3 /*break*/, 7];\n user = this.userPool.getCurrentUser();\n if (!user) return [3 /*break*/, 5];\n return [4 /*yield*/, this.cognitoIdentitySignOut(opts, user)];\n case 4:\n _a.sent();\n return [3 /*break*/, 6];\n case 5:\n logger.debug('no current Cognito user');\n _a.label = 6;\n case 6: return [3 /*break*/, 8];\n case 7:\n logger.debug('no Cognito User pool');\n _a.label = 8;\n case 8:\n /**\n * Note for future refactor - no reliable way to get username with\n * Cognito User Pools vs Identity when federating with Social Providers\n * This is why we need a well structured session object that can be inspected\n * and information passed back in the message below for Hub dispatch\n */\n dispatchAuthEvent('signOut', this.user, \"A user has been signed out\");\n this.user = null;\n return [2 /*return*/];\n }\n });\n });\n };\n AuthClass.prototype.cleanCachedItems = function () {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: \n // clear cognito cached item\n return [4 /*yield*/, this.Credentials.clear()];\n case 1:\n // clear cognito cached item\n _a.sent();\n return [2 /*return*/];\n }\n });\n });\n };\n /**\n * Change a password for an authenticated user\n * @param {Object} user - The CognitoUser object\n * @param {String} oldPassword - the current password\n * @param {String} newPassword - the requested new password\n * @return - A promise resolves if success\n */\n AuthClass.prototype.changePassword = function (user, oldPassword, newPassword, clientMetadata) {\n var _this = this;\n if (clientMetadata === void 0) { clientMetadata = this._config.clientMetadata; }\n return new Promise(function (resolve, reject) {\n _this.userSession(user).then(function (session) {\n user.changePassword(oldPassword, newPassword, function (err, data) {\n if (err) {\n logger.debug('change password failure', err);\n return reject(err);\n }\n else {\n return resolve(data);\n }\n }, clientMetadata);\n });\n });\n };\n /**\n * Initiate a forgot password request\n * @param {String} username - the username to change password\n * @return - A promise resolves if success\n */\n AuthClass.prototype.forgotPassword = function (username, clientMetadata) {\n if (clientMetadata === void 0) { clientMetadata = this._config.clientMetadata; }\n if (!this.userPool) {\n return this.rejectNoUserPool();\n }\n if (!username) {\n return this.rejectAuthError(AuthErrorTypes.EmptyUsername);\n }\n var user = this.createCognitoUser(username);\n return new Promise(function (resolve, reject) {\n user.forgotPassword({\n onSuccess: function () {\n resolve();\n return;\n },\n onFailure: function (err) {\n logger.debug('forgot password failure', err);\n dispatchAuthEvent('forgotPassword_failure', err, username + \" forgotPassword failed\");\n reject(err);\n return;\n },\n inputVerificationCode: function (data) {\n dispatchAuthEvent('forgotPassword', user, username + \" has initiated forgot password flow\");\n resolve(data);\n return;\n },\n }, clientMetadata);\n });\n };\n /**\n * Confirm a new password using a confirmation Code\n * @param {String} username - The username\n * @param {String} code - The confirmation code\n * @param {String} password - The new password\n * @return - A promise that resolves if success\n */\n AuthClass.prototype.forgotPasswordSubmit = function (username, code, password, clientMetadata) {\n if (clientMetadata === void 0) { clientMetadata = this._config.clientMetadata; }\n if (!this.userPool) {\n return this.rejectNoUserPool();\n }\n if (!username) {\n return this.rejectAuthError(AuthErrorTypes.EmptyUsername);\n }\n if (!code) {\n return this.rejectAuthError(AuthErrorTypes.EmptyCode);\n }\n if (!password) {\n return this.rejectAuthError(AuthErrorTypes.EmptyPassword);\n }\n var user = this.createCognitoUser(username);\n return new Promise(function (resolve, reject) {\n user.confirmPassword(code, password, {\n onSuccess: function (success) {\n dispatchAuthEvent('forgotPasswordSubmit', user, username + \" forgotPasswordSubmit successful\");\n resolve(success);\n return;\n },\n onFailure: function (err) {\n dispatchAuthEvent('forgotPasswordSubmit_failure', err, username + \" forgotPasswordSubmit failed\");\n reject(err);\n return;\n },\n }, clientMetadata);\n });\n };\n /**\n * Get user information\n * @async\n * @return {Object }- current User's information\n */\n AuthClass.prototype.currentUserInfo = function () {\n return __awaiter(this, void 0, void 0, function () {\n var source, user, attributes, userAttrs, credentials, e_12, info, err_1, user;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n source = this.Credentials.getCredSource();\n if (!(!source || source === 'aws' || source === 'userPool')) return [3 /*break*/, 9];\n return [4 /*yield*/, this.currentUserPoolUser().catch(function (err) {\n return logger.error(err);\n })];\n case 1:\n user = _a.sent();\n if (!user) {\n return [2 /*return*/, null];\n }\n _a.label = 2;\n case 2:\n _a.trys.push([2, 8, , 9]);\n return [4 /*yield*/, this.userAttributes(user)];\n case 3:\n attributes = _a.sent();\n userAttrs = this.attributesToObject(attributes);\n credentials = null;\n _a.label = 4;\n case 4:\n _a.trys.push([4, 6, , 7]);\n return [4 /*yield*/, this.currentCredentials()];\n case 5:\n credentials = _a.sent();\n return [3 /*break*/, 7];\n case 6:\n e_12 = _a.sent();\n logger.debug('Failed to retrieve credentials while getting current user info', e_12);\n return [3 /*break*/, 7];\n case 7:\n info = {\n id: credentials ? credentials.identityId : undefined,\n username: user.getUsername(),\n attributes: userAttrs,\n };\n return [2 /*return*/, info];\n case 8:\n err_1 = _a.sent();\n logger.error('currentUserInfo error', err_1);\n return [2 /*return*/, {}];\n case 9:\n if (source === 'federated') {\n user = this.user;\n return [2 /*return*/, user ? user : {}];\n }\n return [2 /*return*/];\n }\n });\n });\n };\n AuthClass.prototype.federatedSignIn = function (providerOrOptions, response, user) {\n return __awaiter(this, void 0, void 0, function () {\n var options, provider, customState, client_id, redirect_uri, provider, loggedInUser, token, identity_id, expires_at, credentials, currentUser;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!this._config.identityPoolId && !this._config.userPoolId) {\n throw new Error(\"Federation requires either a User Pool or Identity Pool in config\");\n }\n // Ensure backwards compatability\n if (typeof providerOrOptions === 'undefined') {\n if (this._config.identityPoolId && !this._config.userPoolId) {\n throw new Error(\"Federation with Identity Pools requires tokens passed as arguments\");\n }\n }\n if (!(isFederatedSignInOptions(providerOrOptions) ||\n isFederatedSignInOptionsCustom(providerOrOptions) ||\n hasCustomState(providerOrOptions) ||\n typeof providerOrOptions === 'undefined')) return [3 /*break*/, 1];\n options = providerOrOptions || {\n provider: CognitoHostedUIIdentityProvider.Cognito,\n };\n provider = isFederatedSignInOptions(options)\n ? options.provider\n : options.customProvider;\n customState = isFederatedSignInOptions(options)\n ? options.customState\n : options.customState;\n if (this._config.userPoolId) {\n client_id = isCognitoHostedOpts(this._config.oauth)\n ? this._config.userPoolWebClientId\n : this._config.oauth.clientID;\n redirect_uri = isCognitoHostedOpts(this._config.oauth)\n ? this._config.oauth.redirectSignIn\n : this._config.oauth.redirectUri;\n this._oAuthHandler.oauthSignIn(this._config.oauth.responseType, this._config.oauth.domain, redirect_uri, client_id, provider, customState);\n }\n return [3 /*break*/, 4];\n case 1:\n provider = providerOrOptions;\n // To check if the user is already logged in\n try {\n loggedInUser = JSON.stringify(JSON.parse(this._storage.getItem('aws-amplify-federatedInfo')).user);\n if (loggedInUser) {\n logger.warn(\"There is already a signed in user: \" + loggedInUser + \" in your app.\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tYou should not call Auth.federatedSignIn method again as it may cause unexpected behavior.\");\n }\n }\n catch (e) { }\n token = response.token, identity_id = response.identity_id, expires_at = response.expires_at;\n return [4 /*yield*/, this.Credentials.set({ provider: provider, token: token, identity_id: identity_id, user: user, expires_at: expires_at }, 'federation')];\n case 2:\n credentials = _a.sent();\n return [4 /*yield*/, this.currentAuthenticatedUser()];\n case 3:\n currentUser = _a.sent();\n dispatchAuthEvent('signIn', currentUser, \"A user \" + currentUser.username + \" has been signed in\");\n logger.debug('federated sign in credentials', credentials);\n return [2 /*return*/, credentials];\n case 4: return [2 /*return*/];\n }\n });\n });\n };\n /**\n * Used to complete the OAuth flow with or without the Cognito Hosted UI\n * @param {String} URL - optional parameter for customers to pass in the response URL\n */\n AuthClass.prototype._handleAuthResponse = function (URL) {\n return __awaiter(this, void 0, void 0, function () {\n var currentUrl, hasCodeOrError, hasTokenOrError, _a, accessToken, idToken, refreshToken, state, session, credentials, isCustomStateIncluded, currentUser, customState, err_2;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (this.oAuthFlowInProgress) {\n logger.debug(\"Skipping URL \" + URL + \" current flow in progress\");\n return [2 /*return*/];\n }\n _b.label = 1;\n case 1:\n _b.trys.push([1, , 8, 9]);\n this.oAuthFlowInProgress = true;\n if (!this._config.userPoolId) {\n throw new Error(\"OAuth responses require a User Pool defined in config\");\n }\n dispatchAuthEvent('parsingCallbackUrl', { url: URL }, \"The callback url is being parsed\");\n currentUrl = URL || (JS.browserOrNode().isBrowser ? window.location.href : '');\n hasCodeOrError = !!(parse(currentUrl).query || '')\n .split('&')\n .map(function (entry) { return entry.split('='); })\n .find(function (_a) {\n var _b = __read(_a, 1), k = _b[0];\n return k === 'code' || k === 'error';\n });\n hasTokenOrError = !!(parse(currentUrl).hash || '#')\n .substr(1)\n .split('&')\n .map(function (entry) { return entry.split('='); })\n .find(function (_a) {\n var _b = __read(_a, 1), k = _b[0];\n return k === 'access_token' || k === 'error';\n });\n if (!(hasCodeOrError || hasTokenOrError)) return [3 /*break*/, 7];\n this._storage.setItem('amplify-redirected-from-hosted-ui', 'true');\n _b.label = 2;\n case 2:\n _b.trys.push([2, 6, , 7]);\n return [4 /*yield*/, this._oAuthHandler.handleAuthResponse(currentUrl)];\n case 3:\n _a = _b.sent(), accessToken = _a.accessToken, idToken = _a.idToken, refreshToken = _a.refreshToken, state = _a.state;\n session = new CognitoUserSession({\n IdToken: new CognitoIdToken({ IdToken: idToken }),\n RefreshToken: new CognitoRefreshToken({\n RefreshToken: refreshToken,\n }),\n AccessToken: new CognitoAccessToken({\n AccessToken: accessToken,\n }),\n });\n credentials = void 0;\n if (!this._config.identityPoolId) return [3 /*break*/, 5];\n return [4 /*yield*/, this.Credentials.set(session, 'session')];\n case 4:\n credentials = _b.sent();\n logger.debug('AWS credentials', credentials);\n _b.label = 5;\n case 5:\n isCustomStateIncluded = /-/.test(state);\n currentUser = this.createCognitoUser(session.getIdToken().decodePayload()['cognito:username']);\n // This calls cacheTokens() in Cognito SDK\n currentUser.setSignInUserSession(session);\n if (window && typeof window.history !== 'undefined') {\n window.history.replaceState({}, null, this._config.oauth.redirectSignIn);\n }\n dispatchAuthEvent('signIn', currentUser, \"A user \" + currentUser.getUsername() + \" has been signed in\");\n dispatchAuthEvent('cognitoHostedUI', currentUser, \"A user \" + currentUser.getUsername() + \" has been signed in via Cognito Hosted UI\");\n if (isCustomStateIncluded) {\n customState = state.split('-').splice(1).join('-');\n dispatchAuthEvent('customOAuthState', urlSafeDecode(customState), \"State for user \" + currentUser.getUsername());\n }\n //#endregion\n return [2 /*return*/, credentials];\n case 6:\n err_2 = _b.sent();\n logger.debug('Error in cognito hosted auth response', err_2);\n // Just like a successful handling of `?code`, replace the window history to \"dispose\" of the `code`.\n // Otherwise, reloading the page will throw errors as the `code` has already been spent.\n if (window && typeof window.history !== 'undefined') {\n window.history.replaceState({}, null, this._config.oauth.redirectSignIn);\n }\n dispatchAuthEvent('signIn_failure', err_2, \"The OAuth response flow failed\");\n dispatchAuthEvent('cognitoHostedUI_failure', err_2, \"A failure occurred when returning to the Cognito Hosted UI\");\n dispatchAuthEvent('customState_failure', err_2, \"A failure occurred when returning state\");\n return [3 /*break*/, 7];\n case 7: return [3 /*break*/, 9];\n case 8:\n this.oAuthFlowInProgress = false;\n return [7 /*endfinally*/];\n case 9: return [2 /*return*/];\n }\n });\n });\n };\n /**\n * Compact version of credentials\n * @param {Object} credentials\n * @return {Object} - Credentials\n */\n AuthClass.prototype.essentialCredentials = function (credentials) {\n return {\n accessKeyId: credentials.accessKeyId,\n sessionToken: credentials.sessionToken,\n secretAccessKey: credentials.secretAccessKey,\n identityId: credentials.identityId,\n authenticated: credentials.authenticated,\n };\n };\n AuthClass.prototype.attributesToObject = function (attributes) {\n var _this = this;\n var obj = {};\n if (attributes) {\n attributes.map(function (attribute) {\n if (attribute.Name === 'email_verified' ||\n attribute.Name === 'phone_number_verified') {\n obj[attribute.Name] =\n _this.isTruthyString(attribute.Value) || attribute.Value === true;\n }\n else {\n obj[attribute.Name] = attribute.Value;\n }\n });\n }\n return obj;\n };\n AuthClass.prototype.isTruthyString = function (value) {\n return (typeof value.toLowerCase === 'function' && value.toLowerCase() === 'true');\n };\n AuthClass.prototype.createCognitoUser = function (username) {\n var userData = {\n Username: username,\n Pool: this.userPool,\n };\n userData.Storage = this._storage;\n var authenticationFlowType = this._config.authenticationFlowType;\n var user = new CognitoUser(userData);\n if (authenticationFlowType) {\n user.setAuthenticationFlowType(authenticationFlowType);\n }\n return user;\n };\n AuthClass.prototype._isValidAuthStorage = function (obj) {\n // We need to check if the obj has the functions of Storage\n return (!!obj &&\n typeof obj.getItem === 'function' &&\n typeof obj.setItem === 'function' &&\n typeof obj.removeItem === 'function' &&\n typeof obj.clear === 'function');\n };\n AuthClass.prototype.noUserPoolErrorHandler = function (config) {\n if (config) {\n if (!config.userPoolId || !config.identityPoolId) {\n return AuthErrorTypes.MissingAuthConfig;\n }\n }\n return AuthErrorTypes.NoConfig;\n };\n AuthClass.prototype.rejectAuthError = function (type) {\n return Promise.reject(new AuthError(type));\n };\n AuthClass.prototype.rejectNoUserPool = function () {\n var type = this.noUserPoolErrorHandler(this._config);\n return Promise.reject(new NoUserPoolError(type));\n };\n AuthClass.prototype.rememberDevice = function () {\n return __awaiter(this, void 0, void 0, function () {\n var currUser, error_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 2, , 3]);\n return [4 /*yield*/, this.currentUserPoolUser()];\n case 1:\n currUser = _a.sent();\n return [3 /*break*/, 3];\n case 2:\n error_1 = _a.sent();\n logger.debug('The user is not authenticated by the error', error_1);\n return [2 /*return*/, Promise.reject('The user is not authenticated')];\n case 3:\n currUser.getCachedDeviceKeyAndPassword();\n return [2 /*return*/, new Promise(function (res, rej) {\n currUser.setDeviceStatusRemembered({\n onSuccess: function (data) {\n res(data);\n },\n onFailure: function (err) {\n if (err.code === 'InvalidParameterException') {\n rej(new AuthError(AuthErrorTypes.DeviceConfig));\n }\n else if (err.code === 'NetworkError') {\n rej(new AuthError(AuthErrorTypes.NetworkError));\n }\n else {\n rej(err);\n }\n },\n });\n })];\n }\n });\n });\n };\n AuthClass.prototype.forgetDevice = function () {\n return __awaiter(this, void 0, void 0, function () {\n var currUser, error_2;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 2, , 3]);\n return [4 /*yield*/, this.currentUserPoolUser()];\n case 1:\n currUser = _a.sent();\n return [3 /*break*/, 3];\n case 2:\n error_2 = _a.sent();\n logger.debug('The user is not authenticated by the error', error_2);\n return [2 /*return*/, Promise.reject('The user is not authenticated')];\n case 3:\n currUser.getCachedDeviceKeyAndPassword();\n return [2 /*return*/, new Promise(function (res, rej) {\n currUser.forgetDevice({\n onSuccess: function (data) {\n res(data);\n },\n onFailure: function (err) {\n if (err.code === 'InvalidParameterException') {\n rej(new AuthError(AuthErrorTypes.DeviceConfig));\n }\n else if (err.code === 'NetworkError') {\n rej(new AuthError(AuthErrorTypes.NetworkError));\n }\n else {\n rej(err);\n }\n },\n });\n })];\n }\n });\n });\n };\n AuthClass.prototype.fetchDevices = function () {\n return __awaiter(this, void 0, void 0, function () {\n var currUser, error_3;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 2, , 3]);\n return [4 /*yield*/, this.currentUserPoolUser()];\n case 1:\n currUser = _a.sent();\n return [3 /*break*/, 3];\n case 2:\n error_3 = _a.sent();\n logger.debug('The user is not authenticated by the error', error_3);\n throw new Error('The user is not authenticated');\n case 3:\n currUser.getCachedDeviceKeyAndPassword();\n return [2 /*return*/, new Promise(function (res, rej) {\n var cb = {\n onSuccess: function (data) {\n var deviceList = data.Devices.map(function (device) {\n var deviceName = device.DeviceAttributes.find(function (_a) {\n var Name = _a.Name;\n return Name === 'device_name';\n }) || {};\n var deviceInfo = {\n id: device.DeviceKey,\n name: deviceName.Value,\n };\n return deviceInfo;\n });\n res(deviceList);\n },\n onFailure: function (err) {\n if (err.code === 'InvalidParameterException') {\n rej(new AuthError(AuthErrorTypes.DeviceConfig));\n }\n else if (err.code === 'NetworkError') {\n rej(new AuthError(AuthErrorTypes.NetworkError));\n }\n else {\n rej(err);\n }\n },\n };\n currUser.listDevices(MAX_DEVICES, null, cb);\n })];\n }\n });\n });\n };\n return AuthClass;\n}());\nexport { AuthClass };\nexport var Auth = new AuthClass(null);\nAmplify.register(Auth);\n//# sourceMappingURL=Auth.js.map","/*\n * Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nimport { JS } from '@aws-amplify/core';\nexport default (function (callback) {\n if (JS.browserOrNode().isBrowser && window.location) {\n var url = window.location.href;\n callback({ url: url });\n }\n else if (JS.browserOrNode().isNode) {\n // continue building on ssr\n (function () { }); // noop\n }\n else {\n throw new Error('Not supported');\n }\n});\n//# sourceMappingURL=urlListener.js.map","/*\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nimport { Auth } from './Auth';\nimport { CognitoHostedUIIdentityProvider, GRAPHQL_AUTH_MODE, } from './types/Auth';\nimport { CognitoUser, CookieStorage, appendToCognitoUserAgent, } from 'amazon-cognito-identity-js';\nimport { AuthErrorStrings } from './common/AuthErrorStrings';\n/**\n * @deprecated use named import\n */\nexport default Auth;\nexport { Auth, CognitoUser, CookieStorage, CognitoHostedUIIdentityProvider, appendToCognitoUserAgent, AuthErrorStrings, GRAPHQL_AUTH_MODE, };\n//# sourceMappingURL=index.js.map","// rework\nenum AUTH_STATE {\n SIGN_IN = 'signIn',\n SIGN_UP = 'signUp',\n FORGOT_PASSWORD = 'forgotPassword',\n RESET_PASSWORD = 'resetPassword',\n CONFIRM_SIGN_UP = 'confirmSignUp',\n}\n\n// See: https://aws-amplify.github.io/docs/js/authentication#show-your-app-after-sign-in\nconst AWS_AUTH_STATE = {\n SIGN_IN: 'signIn',\n SIGN_UP: 'signUp',\n CONFIRM_SIGN_IN: 'confirmSignIn',\n CONFIRM_SIGN_UP: 'confirmSignUp',\n FORGOT_PASSWORD: 'forgotPassword',\n VERIFY_CONTACT: 'verifyContact',\n SIGNED_IN: 'signedIn',\n};\n\nconst DEFAULT_AUTH_STATE = AUTH_STATE.SIGN_IN;\n\nconst PASSWORD_MIN_LENGTH = 8;\n\nconst PASSWORD_REQUIREMENTS_MESSAGE =\n 'Password must include at least 1 number, ' +\n '1 special character and 1 uppercase letter. ' +\n `Minimum ${PASSWORD_MIN_LENGTH} characters.`;\n\nexport {\n AUTH_STATE,\n AWS_AUTH_STATE,\n DEFAULT_AUTH_STATE,\n PASSWORD_REQUIREMENTS_MESSAGE,\n PASSWORD_MIN_LENGTH,\n};\n","import React from 'react';\nimport {AUTH_STATE} from 'app/components/Login/LoginForm/constants';\n\nfunction getFormTitleText(authState) {\n switch (authState) {\n case AUTH_STATE.SIGN_IN:\n return 'Log in to Epiphan Cloud';\n case AUTH_STATE.SIGN_UP:\n return 'Sign up to Epiphan Cloud';\n case AUTH_STATE.CONFIRM_SIGN_UP:\n return 'Thanks for signing up!';\n case AUTH_STATE.FORGOT_PASSWORD:\n case AUTH_STATE.RESET_PASSWORD:\n return 'Reset your password';\n default:\n return null;\n }\n}\n\ninterface Props {\n authState: AUTH_STATE;\n}\n\nexport const Title = ({authState}: Props) => (\n
\n {getFormTitleText(authState)}\n
\n);\n","const DEFAULT_ASPECT_RATIO = {\n w: 16,\n h: 9,\n};\n\n/**\n * @readonly\n * @enum {string}\n */\nenum THEME {\n DEFAULT = 'default',\n PRIMARY = 'primary',\n SECONDARY = 'secondary',\n SUCCESS = 'success',\n INFO = 'info',\n WARNING = 'warning',\n DANGER = 'danger',\n WHITE = 'white',\n}\n\n/**\n * @readonly\n * @enum {string}\n */\nenum VARIANT {\n SOLID = 'solid',\n OUTLINE = 'outline',\n LINK = 'link',\n LINK_UNDERLINE = 'link-underline',\n TEXT = 'text',\n}\n\n/**\n * @readonly\n * @enum {string}\n */\nenum SIZE {\n XS = 'xs',\n S = 's',\n M = 'm',\n L = 'l',\n XL = 'xl',\n XXL = 'xxl',\n}\n\n/**\n * @readonly\n * @enum {string}\n */\nenum SORT_DIRECTION {\n /**\n * Sort items in ascending order.\n * This means arranging from the lowest value to the highest (e.g. a-z, 0-9).\n */\n ASC = 'ASC',\n\n /**\n * Sort items in descending order.\n * This means arranging from the highest value to the lowest (e.g. z-a, 9-0).\n */\n DESC = 'DESC',\n}\n\nenum UserRole {\n Master = 'master',\n Owner = 'owner',\n Operator = 'operator',\n Editor = 'editor',\n}\n\n/**\n * @readonly\n * @enum {string}\n */\nconst USER_ROLE_NAME_BY_TYPE = {\n [UserRole.Master]: 'Owner',\n [UserRole.Owner]: 'Admin',\n [UserRole.Operator]: 'Operator',\n [UserRole.Editor]: 'Editor',\n};\n\nenum UserLoginType {\n Facebook = 'fb',\n Google = 'google',\n Cognito = 'cognito',\n // Pending login type appears when you invite a new team member\n Pending = '',\n}\n\n/**\n * @readonly\n * @enum {string}\n */\nconst NODE_NAME = {\n INPUT: 'INPUT',\n};\n\n/**\n * KeyboardEvent.code\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code}\n */\nconst enum KeyboardCode {\n Enter = 'Enter',\n NumpadEnter = 'NumpadEnter',\n Tab = 'Tab',\n Escape = 'Escape',\n Space = 'Space',\n KeyA = 'KeyA',\n}\n\nexport {\n DEFAULT_ASPECT_RATIO,\n THEME,\n VARIANT,\n SIZE,\n SORT_DIRECTION,\n UserRole,\n USER_ROLE_NAME_BY_TYPE,\n UserLoginType,\n NODE_NAME,\n KeyboardCode,\n};\n","/* eslint-disable react-hooks/exhaustive-deps */\nimport {EffectCallback, useEffect} from 'react';\n\nexport function useComponentDidMount(fn: EffectCallback) {\n useEffect(fn, []);\n}\n","import React, {forwardRef, useCallback, useImperativeHandle, useRef} from 'react';\nimport classNames from 'classnames';\nimport Tippy from '@tippyjs/react';\nimport type {Instance} from 'tippy.js';\nimport {THEME} from 'app/constants';\nimport {isString} from 'app/util/typeGuards';\n\n/**\n * {@link https://atomiks.github.io/tippyjs/v6/all-props/#placement}\n * @enum {string}\n */\nexport enum TOOLTIP_PLACEMENT {\n TOP = 'top',\n TOP_END = 'top-end',\n TOP_START = 'top-start',\n RIGHT = 'right',\n LEFT = 'left',\n RIGHT_START = 'right-start',\n BOTTOM = 'bottom',\n BOTTOM_START = 'bottom-start',\n BOTTOM_END = 'bottom-end',\n}\n\ninterface Props {\n content?: React.ReactNode | React.ReactNode[];\n // Enable tooltip pointer events. Use with `trigger=\"click\"`\n interactive?: boolean;\n trigger?: string;\n children: any;\n\n // Show/Hide delay\n delay?: any;\n placement?: TOOLTIP_PLACEMENT;\n theme?: THEME;\n preformatted?: boolean;\n}\n\nexport const Tooltip = forwardRef(\n (\n {\n content,\n interactive = false,\n children,\n trigger = 'mouseenter focus',\n delay,\n placement = TOOLTIP_PLACEMENT.TOP,\n theme,\n preformatted = false,\n },\n ref,\n ) => {\n const tooltipRef = useRef();\n\n useImperativeHandle(ref, () => ({\n show() {\n if (tooltipRef.current) {\n tooltipRef.current.show();\n }\n },\n\n hide() {\n if (tooltipRef.current) {\n tooltipRef.current.hide();\n }\n },\n }));\n\n const handleTooltipCreate = useCallback((ref: Instance) => {\n tooltipRef.current = ref;\n }, []);\n\n if (!content) {\n return children;\n }\n\n return (\n \n {isString(children) ? {children} : children}\n \n );\n },\n);\n","function isString(value: any): value is string {\n return typeof value === 'string';\n}\n\nexport {\n isString\n};\n","type Nullish = undefined | null;\n\n/**\n * Value is `undefined` or `null`\n *\n * ```typescript\n * isNil(undefined); //=> true\n * isNil(null); //=> true\n * isNil(false); //=> false\n * isNil(0); //=> false\n * isNil(''); //=> false\n * ```\n */\nfunction isNil(value?: any): value is Nullish {\n return typeof value === 'undefined' || value === null;\n}\n\nexport {isNil};\n","import React, {\n forwardRef,\n KeyboardEvent,\n PropsWithChildren,\n ReactNode,\n useCallback,\n useRef,\n} from 'react';\nimport classNames from 'classnames';\nimport {KeyboardCode, SIZE, THEME, VARIANT} from 'app/constants';\nimport {WAI_ARIA_ROLE} from 'app/constants/waiAriaRole';\nimport {useComponentDidMount} from 'app/hooks/useComponentDidMount';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\nimport {isNil} from 'app/util/isNil';\nimport {Callback, ClassName, DataId} from 'app/types/common';\n\nexport enum BUTTON_TYPE {\n SUBMIT = 'submit',\n BUTTON = 'button',\n}\n\nconst defaultProps = {\n type: BUTTON_TYPE.BUTTON,\n tabIndex: 0,\n};\n\ninterface Props extends ClassName, DataId {\n theme?: THEME;\n variant?: VARIANT;\n size?: SIZE;\n name?: string;\n type?: BUTTON_TYPE;\n role?: WAI_ARIA_ROLE;\n title?: ReactNode;\n titlePreformatted?: boolean;\n autoFocus?: boolean;\n disabled?: boolean;\n buttonRef?: any;\n href?: string;\n target?: string;\n tabIndex?: number;\n onClick?: Callback;\n onMouseEnter?: Callback;\n onMouseOut?: Callback;\n}\n\nconst ButtonComponent: React.FC = ({\n className,\n theme,\n variant,\n size,\n children,\n name,\n type = BUTTON_TYPE.BUTTON,\n role,\n title,\n titlePreformatted,\n autoFocus,\n disabled,\n buttonRef,\n href,\n target,\n tabIndex = 0,\n dataId,\n onClick,\n onMouseEnter,\n onMouseOut,\n ...other\n}) => {\n const bRef = useRef();\n\n useComponentDidMount(() => {\n if (autoFocus === true) {\n bRef.current?.focus();\n }\n });\n\n const setRef = useCallback(\n (ref) => {\n bRef.current = ref;\n\n if (buttonRef) {\n if (typeof buttonRef === 'function') {\n buttonRef(ref);\n } else {\n buttonRef.current = ref;\n }\n }\n },\n [buttonRef],\n );\n\n const isButton = isNil(href);\n const Component = isButton ? 'button' : 'a';\n let props = {};\n\n if (isButton) {\n props = {\n ...props,\n name,\n type,\n disabled,\n };\n } else {\n props = {\n ...props,\n href,\n target,\n 'aria-disabled': disabled,\n };\n }\n\n const onKeyDown = (event: KeyboardEvent) => {\n if (!isButton && event.code === KeyboardCode.Space) {\n event.preventDefault();\n window.location.href = href;\n }\n };\n\n const {\n // @ts-expect-error\n fullWidth,\n // @ts-expect-error\n opened,\n ...elementProps\n } = other;\n\n return (\n \n \n {children}\n \n \n );\n};\n\nexport const Button = forwardRef>((props, ref) => {\n return ;\n});\n\nButton.displayName = 'Button';\n\nexport const SubmitButton = (props) => \n \n );\n },\n);\n","import React, {Component} from 'react';\nimport classNames from 'classnames';\nimport {ClassName} from 'app/types/common';\n\ninterface Props extends ClassName {\n error: boolean;\n}\nexport class FormHelperText extends Component {\n render() {\n const {\n className,\n children,\n error,\n } = this.props;\n\n return (\n \n {children}\n \n );\n }\n}\n","import React from 'react';\nimport classNames from 'classnames';\nimport {ClassName} from 'app/types/common';\n\ninterface Props extends ClassName {\n control: React.ReactNode;\n label: React.ReactNode;\n component?: React.ElementType;\n}\n\nexport const FormControlLabel: React.FC = ({\n className,\n label,\n control,\n component = 'label',\n}: Props) => {\n const LabelComponent = component;\n\n return (\n \n \n {label}\n \n\n {control}\n \n );\n};\n","import React, {forwardRef} from 'react';\nimport classNames from 'classnames';\nimport {ClassName} from 'app/types/common';\n\n/**\n * @readonly\n * @enum {string}\n */\nenum LONG_NAME_WRAPPER_TYPE {\n BREAK_ALL = 'break-all',\n BREAK_WORD = 'break-word',\n}\n\ninterface Props extends ClassName {\n type: LONG_NAME_WRAPPER_TYPE;\n children: any;\n}\n\nconst LongNameWrapper = forwardRef(({\n className,\n children,\n type,\n}, ref) => (\n \n {children}\n \n));\n\nLongNameWrapper.displayName = 'LongNameWrapper';\n\n// eslint-disable-next-line @typescript-eslint/ban-types\ntype ForwardProps = Omit;\n\nconst LongNameBreakAllWrapper = forwardRef((props, ref) => (\n \n));\n\nLongNameBreakAllWrapper.displayName = 'LongNameBreakAllWrapper';\n\nconst LongNameBreakWordWrapper = forwardRef((props, ref) => (\n \n));\n\nLongNameBreakWordWrapper.displayName = 'LongNameBreakWordWrapper';\n\nexport {\n LongNameBreakAllWrapper,\n LongNameBreakWordWrapper,\n};\n","// eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/no-unused-vars\nfunction noop(..._args: any[]): any {}\n\nexport {noop};\n","import React, {Component, createRef, ReactNode} from 'react';\nimport classNames from 'classnames';\nimport Tippy from '@tippyjs/react';\nimport {Instance} from 'tippy.js';\nimport maxSize from 'popper-max-size-modifier';\nimport {KeyboardCode} from 'app/constants';\nimport {noop} from 'app/util/noop';\nimport {TOOLTIP_PLACEMENT} from 'app/components/sharedReactComponents/Tooltip';\nimport {Callback} from 'app/types/common';\nimport {Options, ModifierArguments} from '@popperjs/core/lib/types';\nimport {Icons} from 'app/util/icons';\nimport {Button} from 'app/components/sharedReactComponents/Button';\n\nfunction createPopperOptions(maxHeight?: number) {\n const popperOptions: Partial = {\n modifiers: [\n maxSize,\n {\n name: 'applyMaxSize',\n enabled: true,\n phase: 'beforeWrite',\n requires: ['maxSize'],\n fn({state}: ModifierArguments) {\n const {height} = state.modifiersData.maxSize;\n if (state.styles.popper) {\n let resultHeight = height;\n if (typeof maxHeight === 'number' && maxHeight < height) {\n resultHeight = maxHeight;\n }\n\n state.elements.popper.style.setProperty('--popper-max-height', `${resultHeight}px`);\n state.styles.popper.display = 'flex';\n }\n },\n },\n ],\n };\n\n return popperOptions;\n}\n\ninterface Props {\n content?: any;\n children: any;\n buttonOpenedClassName?: string;\n trigger?: string;\n placement?: TOOLTIP_PLACEMENT;\n maxWidth?: number | 'none';\n maxHeight?: number;\n fullWidth?: boolean;\n disabled?: boolean;\n interactive?: boolean;\n appendToBody?: boolean;\n showClose?: boolean;\n onBlur?: Callback;\n onOpen?: Callback;\n}\n\ninterface State {\n opened: boolean;\n disabled: boolean;\n}\n\nexport class Dropdown extends Component {\n static defaultProps = {\n trigger: 'click',\n placement: TOOLTIP_PLACEMENT.TOP,\n maxWidth: 350,\n disabled: false,\n interactive: false,\n appendToBody: false,\n showClose: false,\n };\n\n public tooltipRef = createRef();\n public buttonRef = createRef();\n public forceClose = false;\n\n private readonly popperOptions;\n\n constructor(props: Props) {\n super(props);\n\n this.popperOptions = createPopperOptions(props.maxHeight);\n\n this.state = {\n opened: false,\n disabled: props.disabled === true,\n };\n }\n\n componentDidUpdate(prevProps) {\n const {disabled} = this.props;\n\n if (disabled !== prevProps.disabled) {\n if (disabled) {\n this.close(() => this.setState({disabled: true}));\n } else {\n this.setState({disabled: false});\n }\n }\n }\n\n componentWillUnmount() {\n this.forceClose = true;\n document.removeEventListener('keyup', this.handleKeyDown);\n }\n\n handleTooltipCreate = (ref: Instance) => {\n (this.tooltipRef as any).current = ref;\n };\n\n setAppendTo = (ref) => {\n const {appendToBody} = this.props;\n\n if (appendToBody) {\n return document.body;\n }\n\n return ref.parentNode;\n };\n\n /**\n * @public\n */\n open() {\n if (this.state.opened === false && this.tooltipRef.current) {\n this.tooltipRef.current.show();\n }\n }\n\n /**\n * @public\n */\n close(cb = noop) {\n if (this.state.opened && this.tooltipRef.current) {\n this.forceClose = true;\n this.tooltipRef.current.hide();\n this.setState({opened: false}, () => cb());\n } else {\n cb();\n }\n }\n\n /**\n * @public\n */\n focusButton() {\n this.buttonRef.current.focus();\n }\n\n clickButton() {\n this.buttonRef.current.click();\n }\n\n handleTooltipShown = () => {\n this.setState({opened: true});\n document.addEventListener('keyup', this.handleKeyDown);\n\n if (this.props.onOpen) {\n this.props.onOpen();\n }\n };\n\n // To support child dropdown\n handleTooltipHide = (tip) => {\n if (this.forceClose) {\n // After this callback will fired `handleTooltipHidden`\n return;\n }\n\n // `setTimeout` and `forceClose` because child tippy instance flags changes async\n setTimeout(() => {\n const anchors = tip.popper.querySelectorAll('[aria-haspopup=\"true\"]');\n let hasOpenedChildDropdown = false;\n\n for (const anchor of anchors) {\n if (anchor?._tippy?.state?.isVisible) {\n hasOpenedChildDropdown = true;\n break;\n }\n }\n\n if (!hasOpenedChildDropdown) {\n this.forceClose = true;\n this.tooltipRef.current?.hide();\n }\n }, 200);\n\n return false;\n };\n\n handleTooltipHidden = () => {\n this.forceClose = false;\n this.setState({opened: false});\n document.removeEventListener('keyup', this.handleKeyDown);\n\n if (this.props.onBlur) {\n this.props.onBlur();\n }\n };\n\n handleKeyDown = (e: KeyboardEvent) => {\n if (e.code === KeyboardCode.Escape) {\n if (!e.defaultPrevented) {\n this.tooltipRef.current?.hide();\n\n // Close opened menu and still focus on dropdown button\n this.buttonRef.current.focus();\n }\n } else if (e.code === KeyboardCode.Tab) {\n // Close opened menu on focus lost\n if (!this.tooltipRef.current?.popper.contains(e.target as Node)) {\n this.tooltipRef.current?.hide();\n }\n }\n };\n\n handleCloseClick = () => {\n this.tooltipRef.current?.hide();\n\n // Close opened menu and still focus on dropdown button\n this.buttonRef.current.focus();\n };\n\n renderButton() {\n const {children, buttonOpenedClassName, fullWidth} = this.props;\n const {opened} = this.state;\n\n const additionalProps = {\n ref: this.buttonRef,\n fullWidth,\n opened,\n };\n\n const ariaAttributes = {\n 'aria-haspopup': true,\n 'aria-expanded': opened,\n };\n\n if (typeof children === 'function') {\n return children({\n ...ariaAttributes,\n ...additionalProps,\n });\n }\n\n return React.cloneElement(children, {\n ...additionalProps,\n ...ariaAttributes,\n className: classNames(children.props?.className, opened && buttonOpenedClassName),\n });\n }\n\n contentWrapper(content: ReactNode) {\n return (\n
\n {content}\n\n \n
\n );\n }\n\n renderContent() {\n const {opened} = this.state;\n const {content, showClose} = this.props;\n\n if (opened) {\n const renderedContent = typeof content === 'function' ? content() : content;\n return showClose ? this.contentWrapper(renderedContent) : renderedContent;\n }\n\n return '';\n }\n\n render() {\n const {trigger, placement, maxWidth, interactive} = this.props;\n const {disabled} = this.state;\n\n return (\n \n {this.renderButton()}\n \n );\n }\n}\n","import React, {useEffect, useRef, useState} from 'react';\nimport classNames from 'classnames';\nimport {useIsMounted} from 'app/hooks/useIsMounted';\nimport {ClassName, DataId} from 'app/types/common';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\nimport {\n LongNameBreakAllWrapper,\n LongNameBreakWordWrapper,\n} from 'app/components/sharedReactComponents/LongNameWrapper';\n\ntype OverflowComponent = 'div' | 'span';\n\ninterface Props extends ClassName, DataId {\n component?: OverflowComponent;\n rowsNumber?: number;\n async?: boolean;\n wordBreak?: 'break-all' | 'break-word';\n}\n\nconst safeRowNumber = (value: number) => Math.trunc(Math.abs(value));\n\nexport function OverflowTooltip(props: React.PropsWithChildren) {\n const {\n component = 'div',\n async = false,\n rowsNumber = 1,\n wordBreak = 'break-all',\n className,\n dataId,\n children,\n } = props;\n\n const [overflow, setOverflow] = useState(false);\n const [overflowRows, setOverflowRows] = useState(safeRowNumber(rowsNumber));\n\n const isMounted = useIsMounted();\n const elementRef = useRef(null);\n\n useEffect(() => {\n const overflowCheck = () => {\n if (!elementRef.current) {\n return;\n }\n\n let calculated = false;\n\n // If difference more than `1px` (fix Microsoft Edge)\n if (overflowRows > 1) {\n calculated =\n Math.abs(elementRef.current.clientHeight - elementRef.current.scrollHeight) > 1;\n } else {\n calculated = Math.abs(elementRef.current.clientWidth - elementRef.current.scrollWidth) > 1;\n }\n\n if (isMounted.current) {\n setOverflow((prev) => (calculated === prev ? prev : calculated));\n }\n };\n\n if (async) {\n setTimeout(() => overflowCheck());\n } else {\n overflowCheck();\n }\n });\n\n useEffect(() => {\n setOverflowRows(safeRowNumber(rowsNumber));\n }, [rowsNumber]);\n\n const renderChildren = () => {\n if (overflowRows > 1) {\n const WordBreakWrapper =\n wordBreak === 'break-word' ? LongNameBreakWordWrapper : LongNameBreakAllWrapper;\n\n return {children};\n }\n\n return children;\n };\n\n const renderElement = () => {\n const classes = classNames(\n 'overflow-tooltip',\n {\n 'overflow-tooltip--multiple-rows': overflowRows > 1,\n },\n className,\n );\n\n const cssProperties: React.CSSProperties = {};\n cssProperties['--rows-number'] = overflowRows;\n\n const Tag = component;\n\n return (\n \n {renderChildren()}\n \n );\n };\n\n if (overflow) {\n return {renderElement()};\n }\n\n return renderElement();\n}\n","/**\n * WAI-ARIA Roles\n *\n * {@link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles}\n * @enum {string}\n */\nenum WAI_ARIA_ROLE {\n BUTTON = 'button',\n COLUMN_HEADER = 'columnheader',\n TABLE = 'table',\n CELL = 'cell',\n ROW = 'row',\n ROW_GROUP = 'rowgroup',\n MENU = 'menu',\n MENU_ITEM = 'menuitem',\n RADIO_GROUP = 'radiogroup',\n TAB = 'tab',\n TAB_LIST = 'tablist',\n TAB_PANEL = 'tabpanel',\n}\n\nexport {\n WAI_ARIA_ROLE,\n};\n","import React, {forwardRef, KeyboardEvent} from 'react';\nimport classNames from 'classnames';\nimport {isNil} from 'app/util/isNil';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\nimport {Icons} from 'app/util/icons';\nimport {WAI_ARIA_ROLE} from 'app/constants/waiAriaRole';\nimport {Callback, ClassName} from 'app/types/common';\nimport {KeyboardCode} from 'app/constants';\n\nexport interface SelectMenuOptionProps extends ClassName {\n children: React.ReactNode;\n icon?: React.ReactNode;\n onClick?: Callback;\n title?: string;\n controlComponent?: React.ReactNode;\n withIcon?: boolean;\n name?: string;\n active?: boolean;\n disabled?: boolean;\n disabledReasonMessage?: string;\n}\n\nexport const SelectMenuOption = forwardRef(({\n className,\n children,\n icon,\n title,\n name,\n controlComponent,\n withIcon,\n active,\n disabled,\n disabledReasonMessage,\n onClick,\n ...elementProps\n}, ref) => {\n withIcon = withIcon || isNil(icon) === false;\n const withControl = isNil(controlComponent) === false;\n\n const chooseOption = () => {\n if (disabled || typeof onClick !== 'function') {\n return;\n }\n\n onClick({\n target: {\n name,\n value: !active,\n }\n });\n };\n\n const handleClick = () => {\n chooseOption();\n };\n\n const handleKeyUp = (event: KeyboardEvent) => {\n if (event.code === KeyboardCode.Enter) {\n chooseOption();\n }\n };\n\n return (\n \n {withControl && (\n \n \n {controlComponent}\n \n \n )}\n\n {icon && (\n \n {icon}\n \n )}\n\n \n \n {children}\n \n \n\n {active && (\n \n {Icons.checkmark().reactComponent()}\n \n )}\n \n );\n});\n\nSelectMenuOption.displayName = 'SelectMenuOption';\n","import React, {Component} from 'react';\nimport {OverflowTooltip} from 'app/components/sharedReactComponents/OverflowTooltip/OverflowTooltip';\nimport {SelectMenuOption} from 'app/components/sharedReactComponents/SelectMenuOption';\nimport {Callback} from 'app/types/common';\n\nexport interface DropdownSelectOptionProps {\n label: number | string | React.ReactNode;\n value: number | string | boolean;\n icon?: React.ReactNode;\n title?: string;\n withIcon?: boolean;\n active?: boolean;\n disabled?: boolean;\n onClick: Callback;\n}\n\nexport class DropdownSelectOption extends Component {\n handleClick = () => {\n const {\n value,\n disabled,\n onClick,\n } = this.props;\n\n if (!disabled) {\n onClick(value);\n }\n };\n\n render() {\n const {\n label,\n icon,\n title,\n withIcon,\n active,\n disabled,\n } = this.props;\n\n const hasIcon = Boolean(icon);\n\n return (\n \n \n {label}\n \n \n );\n }\n}\n","import React from 'react';\n\nexport const DropdownSelectSeparator = () =>
  • ;\n","import React, {Component} from 'react';\n\nexport class DropdownSelectNoOptionsMessage extends Component {\n static defaultProps = {\n children: 'No options',\n };\n\n render() {\n const {\n children = 'No options',\n } = this.props;\n\n return (\n
    \n {children}\n
    \n );\n }\n}\n","import React from 'react';\n\nexport const DropdownSelectGroupOption: React.FC<{label: React.ReactNode}> = ({\n label,\n children,\n}) => (\n
  • \n
    \n {label}\n
    \n\n
      \n {children}\n
    \n
  • \n);\n","import {isNil} from 'app/util/isNil';\n\nconst defaultGetOptionLabel = option => option.label;\nconst defaultGetOptionValue = option => option.value;\nconst defaultGetOptionTitle = option => option.title;\nconst defaultGetOptionOptions = option => option.options;\n\nconst curriedProcessOption = ({\n getOptionLabel,\n getOptionValue,\n getOptionTitle,\n checkIcon,\n}) => (option) => {\n const processedOption: any = {\n label: getOptionLabel(option),\n value: getOptionValue(option),\n };\n\n if (option.icon) {\n checkIcon();\n processedOption.icon = option.icon;\n }\n\n const title = getOptionTitle(option);\n if (title) {\n processedOption.title = title;\n }\n\n if (typeof option.disabled === 'boolean') {\n processedOption.disabled = option.disabled;\n }\n\n if (typeof option.visible === 'boolean') {\n processedOption.visible = option.visible;\n }\n\n return processedOption;\n};\n\nconst curriedProcessGroupedOption = (processOption, getOptionOptions) => (option, processOptions) => {\n return {\n label: processOption(option).label,\n options: processOptions(getOptionOptions(option))\n };\n};\n\nconst curriedIsGroupedOption = (getOptionOptions) => (option) => Boolean(getOptionOptions(option));\n\nconst processOptionsList = (options, value, {\n getOptionLabel,\n getOptionValue,\n getOptionTitle,\n getOptionOptions,\n}) => {\n let withIcons = false;\n\n const checkIcon = () => {\n withIcons = true;\n };\n\n const processOption = curriedProcessOption({\n getOptionLabel,\n getOptionValue,\n getOptionTitle,\n checkIcon,\n });\n const isGroupedOption = curriedIsGroupedOption(getOptionOptions);\n const processGroupedOption = curriedProcessGroupedOption(processOption, getOptionOptions);\n\n let valueInOptions = false;\n let selectedOption: any = null;\n\n const processing = (options) => {\n const result: any = [];\n\n options.forEach((option) => {\n if (isGroupedOption(option)) {\n result.push(processGroupedOption(option, processing));\n } else {\n const processedOption = processOption(option);\n\n result.push(processedOption);\n\n if (String(value) === String(processedOption.value)) {\n valueInOptions = true;\n selectedOption = processedOption;\n }\n }\n });\n\n return result;\n };\n\n const processedOptions = processing(options);\n\n // Add current value to list if it does not exists in options list\n if (\n valueInOptions === false &&\n !isNil(value)\n ) {\n selectedOption = {\n label: value,\n value,\n };\n\n processedOptions.unshift(selectedOption);\n }\n\n return {\n withIcons,\n processedOptions,\n selectedOption,\n };\n};\n\nconst curriedProcessOptionsList = ({\n getOptionLabel,\n getOptionValue,\n getOptionTitle,\n getOptionOptions,\n}) => {\n return (options, value) => {\n return processOptionsList(options, value, {\n getOptionLabel,\n getOptionValue,\n getOptionTitle,\n getOptionOptions,\n });\n };\n};\n\nexport {\n processOptionsList,\n curriedProcessOptionsList,\n defaultGetOptionLabel,\n defaultGetOptionValue,\n defaultGetOptionTitle,\n defaultGetOptionOptions,\n};\n","enum DROPDOWN_SELECT_THEME {\n DEFAULT = 'default',\n TRANSPARENT = 'transparent',\n}\n\nexport {\n DROPDOWN_SELECT_THEME,\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport {Icons} from 'app/util/icons';\nimport {SIZE} from 'app/constants';\nimport {ClassName} from 'app/types/common';\n\nexport enum CARET_VARIANT {\n TRIANGLE = 'triangle',\n THIN = 'thin',\n}\n\nfunction getCaretIconByVariant(variant) {\n switch (variant) {\n case CARET_VARIANT.THIN:\n return Icons.caretThin();\n default:\n return Icons.caretTriangle();\n }\n}\n\ninterface Props extends ClassName {\n variant?: CARET_VARIANT;\n size?: SIZE;\n opened?: boolean;\n}\n\nexport const Caret: React.FC = ({\n className,\n variant = CARET_VARIANT.TRIANGLE,\n size,\n opened,\n ...elementProps\n}) => {\n return (\n \n {getCaretIconByVariant(variant).size(size).reactComponent()}\n \n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport {LoadingWrapper} from 'app/components/sharedReactComponents/LoadingWrapper';\nimport {DROPDOWN_SELECT_THEME} from 'app/components/sharedReactComponents/DropdownSelect/constants';\nimport {\n KeyboardCode,\n SIZE,\n} from 'app/constants';\nimport {WAI_ARIA_ROLE} from 'app/constants/waiAriaRole';\nimport {Icons} from 'app/util/icons';\nimport {Caret} from 'app/components/sharedReactComponents/Caret';\nimport {\n Callback,\n ClassName\n} from 'app/types/common';\n\nfunction handleKeyPress(e: React.KeyboardEvent) {\n if (\n e.code === KeyboardCode.Enter ||\n e.code === KeyboardCode.Space\n ) {\n e.preventDefault();\n e.target.dispatchEvent(new Event('click'));\n }\n}\n\ninterface Props extends ClassName {\n theme?: DROPDOWN_SELECT_THEME;\n size?: SIZE;\n fullWidth?: boolean;\n showClearButton?: boolean;\n opened?: boolean;\n disabled?: boolean;\n loading?: boolean;\n quietLoading?: boolean;\n adornment?: string;\n onClickClear?: Callback;\n children: React.ReactNode;\n}\n\nexport const DropdownSelectButton = React.forwardRef((props, ref) => {\n const {\n className,\n children,\n theme = DROPDOWN_SELECT_THEME.DEFAULT,\n size,\n fullWidth = true,\n showClearButton,\n opened,\n disabled,\n loading,\n quietLoading,\n onClickClear,\n adornment,\n ...rest\n } = props;\n\n const focusable = !disabled && !loading;\n\n return (\n // rework\n \n \n
    \n {children}\n
    \n\n {adornment && (\n \n {adornment}\n \n )}\n\n {showClearButton && !disabled && (\n \n {Icons.cross().reactComponent()}\n \n )}\n\n {quietLoading && !disabled && (\n \n {Icons.spinner().reactComponent()}\n \n )}\n\n {!disabled && (\n \n )}\n \n
    \n );\n});\n","/* eslint-disable react/default-props-match-prop-types */\nimport React, {Component, createRef, Fragment} from 'react';\nimport {Dropdown} from 'app/components/sharedReactComponents/Dropdown';\nimport {DropdownSelectOption} from 'app/components/sharedReactComponents/DropdownSelect/DropdownSelectOption';\nimport {DropdownSelectSeparator} from 'app/components/sharedReactComponents/DropdownSelect/DropdownSelectSeparator';\nimport {DropdownSelectNoOptionsMessage} from 'app/components/sharedReactComponents/DropdownSelect/DropdownSelectNoOptionsMessage';\nimport {DropdownSelectGroupOption} from 'app/components/sharedReactComponents/DropdownSelect/DropdownSelectGroupOption';\nimport {\n defaultGetOptionLabel,\n defaultGetOptionValue,\n defaultGetOptionTitle,\n defaultGetOptionOptions,\n curriedProcessOptionsList,\n} from 'app/components/sharedReactComponents/DropdownSelect/utils';\nimport {DropdownSelectButton} from 'app/components/sharedReactComponents/DropdownSelect/DropdownSelectButton';\nimport {OverflowTooltip} from 'app/components/sharedReactComponents/OverflowTooltip/OverflowTooltip';\nimport {DROPDOWN_SELECT_THEME} from 'app/components/sharedReactComponents/DropdownSelect/constants';\nimport {SIZE} from 'app/constants';\nimport {WAI_ARIA_ROLE} from 'app/constants/waiAriaRole';\nimport {isNil} from 'app/util/isNil';\nimport {Callback} from 'app/types/common';\nimport {TOOLTIP_PLACEMENT} from 'app/components/sharedReactComponents/Tooltip';\n\ntype Options = {\n label?: React.ReactNode;\n value?: number | string;\n icon?: React.ReactNode;\n title?: string;\n visible?: boolean;\n disabled?: boolean;\n options?: any[];\n};\n\nexport interface SelectProps {\n options: Array<(Options | Record)>;\n theme?: DROPDOWN_SELECT_THEME;\n appendToBody?: boolean;\n placement?: TOOLTIP_PLACEMENT;\n\n buttonComponent?: React.ReactNode;\n noOptionsMessage?: React.ReactNode;\n menuFooterComponent?: React.ReactNode;\n\n getOptionLabel?: Callback;\n getOptionValue?: Callback;\n getOptionTitle?: Callback;\n getOptionOptions?: Callback;\n}\n\ninterface Props extends SelectProps {\n name?: string;\n value?: number | string | boolean;\n placeholder: any;\n clearable: boolean;\n disabled?: boolean;\n onChange?: Callback;\n onBlur?: Callback;\n loading?: boolean;\n indeterminate?: boolean;\n closeOnItemClick: boolean;\n buttonComponentRenderer?: Callback;\n\n // rework - added default to avoid errors\n size: SIZE;\n // rework - have no default\n fullWidth?: boolean;\n quietLoading?: boolean;\n onOpen?: Callback;\n}\n\nexport class DropdownSelect extends Component {\n static defaultProps = {\n size: SIZE.M,\n placeholder: 'Select...',\n clearable: false,\n closeOnItemClick: true,\n options: [],\n getOptionLabel: defaultGetOptionLabel,\n getOptionValue: defaultGetOptionValue,\n getOptionTitle: defaultGetOptionTitle,\n getOptionOptions: defaultGetOptionOptions,\n };\n\n public dropdownRef = createRef();\n public processedOptions: any;\n public optionsListProcessor: any;\n\n constructor(props: Props) {\n super(props);\n\n this.processedOptions = {\n withIcons: false,\n processedOptions: null,\n selectedOption: null,\n };\n\n this.optionsListProcessor = null;\n this.updateOptionsListProcessor(props, true);\n }\n\n _needsToUpdateOptionsListProcessor(nextProps, currentProps) {\n const getterNames = [\n 'getOptionLabel',\n 'getOptionValue',\n 'getOptionTitle',\n 'getOptionOptions',\n ];\n\n for (const getterName of getterNames) {\n if (nextProps[getterName] !== currentProps[getterName]) {\n return true;\n }\n }\n\n return false;\n }\n\n updateOptionsListProcessor(nextProps, force = false) {\n if (!force) {\n if (this._needsToUpdateOptionsListProcessor(nextProps, this.props)) {\n return;\n }\n }\n\n const {\n getOptionLabel,\n getOptionValue,\n getOptionTitle,\n getOptionOptions,\n } = nextProps;\n\n this.optionsListProcessor = curriedProcessOptionsList({\n getOptionLabel,\n getOptionValue,\n getOptionTitle,\n getOptionOptions,\n });\n }\n\n componentDidUpdate() {\n this.updateOptionsListProcessor(this.props);\n }\n\n handleClickOption = (value) => {\n const {\n name,\n closeOnItemClick,\n onChange,\n } = this.props;\n\n if (closeOnItemClick) {\n this.dropdownRef.current?.clickButton();\n }\n\n onChange?.({target: {name, value}});\n };\n\n handleClickClearButton = (e) => {\n e.stopPropagation();\n\n const {\n name,\n onChange,\n } = this.props;\n\n onChange?.({target: {name, value: null}});\n };\n\n processOptionsList() {\n const {\n options,\n value,\n indeterminate,\n } = this.props;\n\n return this.optionsListProcessor(options, indeterminate ? null : value);\n }\n\n renderList(processedOptions: any[], selectedOptionValue, withIcons) {\n return processedOptions.reduce((acc, props, index) => {\n const {\n label,\n value,\n icon,\n options,\n title,\n separator,\n visible = true,\n disabled,\n } = props;\n\n if (visible === false) {\n return acc;\n }\n\n if (separator) {\n acc.push(\n \n );\n return acc;\n }\n\n if (options) {\n acc.push(\n \n {this.renderList(options, selectedOptionValue, withIcons)}\n \n );\n\n return acc;\n }\n\n acc.push(\n \n );\n\n return acc;\n }, []);\n }\n\n renderNoOptionsMessage() {\n return (\n \n {this.props.noOptionsMessage}\n \n );\n }\n\n renderDropdownMenu(processedOptions, selectedOptionValue, withIcons) {\n return (\n
    \n \n {this.renderList(processedOptions, selectedOptionValue, withIcons)}\n \n
    \n );\n }\n\n renderValueName(selectedOption): React.ReactNode {\n const {\n placeholder,\n indeterminate,\n } = this.props;\n\n if (indeterminate) {\n return (\n \n —\n \n );\n }\n\n if (selectedOption === null) {\n return (\n \n {placeholder}\n \n );\n }\n\n return (\n \n {selectedOption.icon && (\n \n {selectedOption.icon}\n \n )}\n\n \n {selectedOption.label}\n \n \n );\n }\n\n renderButton({\n ref,\n selectedOption,\n fullWidth,\n opened,\n ...renderProps\n }) {\n const {\n theme,\n size,\n clearable,\n disabled,\n loading,\n quietLoading,\n buttonComponentRenderer,\n ...rest\n } = this.props;\n\n if (buttonComponentRenderer) {\n return buttonComponentRenderer({\n ref,\n selectedOption,\n });\n }\n\n const {\n options,\n appendToBody,\n buttonComponent,\n noOptionsMessage,\n menuFooterComponent,\n getOptionLabel,\n getOptionValue,\n getOptionTitle,\n getOptionOptions,\n name,\n value,\n placeholder,\n onChange,\n onBlur,\n indeterminate,\n closeOnItemClick,\n onOpen,\n ...elementProps\n } = rest;\n\n return (\n \n {this.renderValueName(selectedOption)}\n \n );\n }\n\n // To prevent dropdown button lost focus on select menu item\n handleMenuMouseDown = (e) => {\n if (e.button !== 0) {\n return;\n }\n\n e.preventDefault();\n e.stopPropagation();\n };\n\n handleBlurButton = () => {\n const {\n name,\n value,\n onBlur,\n } = this.props;\n\n if (onBlur) {\n onBlur({target: {name, value}});\n }\n };\n\n renderMenu = () => {\n const {\n value,\n menuFooterComponent,\n } = this.props;\n\n const {\n withIcons,\n processedOptions,\n } = this.processedOptions;\n\n if (processedOptions.length === 0) {\n return this.renderNoOptionsMessage();\n }\n\n return (\n \n {this.renderDropdownMenu(processedOptions, value, withIcons)}\n\n {menuFooterComponent && (\n
    \n {menuFooterComponent}\n
    \n )}\n \n );\n };\n\n render() {\n const {\n fullWidth,\n disabled,\n loading,\n appendToBody,\n placement,\n onOpen,\n } = this.props;\n\n this.processedOptions = this.processOptionsList();\n\n const {\n selectedOption,\n } = this.processedOptions;\n\n return (\n \n {({\n ref,\n fullWidth,\n opened,\n ...rest\n }) => this.renderButton({\n ref,\n selectedOption,\n fullWidth,\n opened,\n ...rest\n })}\n
    \n );\n }\n}\n","import React from 'react';\nimport classNames from 'classnames';\nimport {Callback, ClassName, DataId} from 'app/types/common';\nimport {LoadingWrapper} from 'app/components/sharedReactComponents/LoadingWrapper';\n\nexport type TextareaResize = 'none' | 'both' | 'horizontal' | 'vertical';\n\nexport interface TextareaProps {\n rows?: number;\n resize?: TextareaResize;\n}\n\nexport interface Props extends ClassName, DataId, TextareaProps {\n inputRef?: any;\n value: string;\n name?: string;\n placeholder?: string;\n\n // Flags\n disabled?: boolean;\n readOnly?: boolean;\n required?: boolean;\n loading?: boolean;\n\n /**\n * If `true`, the input will be focused during the first mount.\n */\n autoFocus?: boolean;\n // Callbacks\n onChange?: Callback;\n onBlur?: Callback;\n onKeyDown?: Callback;\n onKeyUp?: Callback;\n}\n\nexport const TextareaInput: React.VFC = ({\n inputRef,\n dataId,\n className,\n name,\n placeholder,\n value,\n rows = 3,\n resize = 'vertical',\n\n autoFocus,\n disabled = false,\n readOnly = false,\n required = false,\n loading = false,\n\n onChange,\n onBlur,\n onKeyDown,\n onKeyUp,\n ...other\n}) => {\n return (\n \n \n \n );\n};\n","import React, {Component} from 'react';\nimport classNames from 'classnames';\nimport {SketchPicker} from 'react-color';\nimport tinycolor from 'tinycolor2';\nimport {Dropdown} from 'app/components/sharedReactComponents/Dropdown';\nimport {FormControl} from 'app/components/sharedReactComponents/FormControl';\nimport {KeyboardCode} from 'app/constants';\nimport {\n Callback,\n ClassName,\n} from 'app/types/common';\n\ninterface Props extends ClassName {\n value: string;\n name?: string;\n placeholder?: string;\n disabled: boolean;\n readOnly: boolean;\n loading?: boolean;\n onChange?: Callback;\n}\n\ninterface State {\n value: string;\n}\nexport class ColorInput extends Component {\n constructor(props: Props) {\n super(props);\n\n this.state = {\n value: props.value,\n };\n }\n\n componentDidUpdate(prevProps) {\n const {\n value,\n } = this.props;\n\n if (value !== prevProps.value) {\n this.setState({value});\n }\n }\n\n _createEventData(value) {\n return {\n target: {\n value,\n name: this.props.name,\n }\n };\n }\n\n handleColorPickerChange = (color) => {\n this.setState({\n value: color.hex,\n });\n };\n\n handleDropdownBlur = () => {\n this.saveValue();\n };\n\n saveValue() {\n const {\n value: prevValue,\n onChange,\n } = this.props;\n\n const color = tinycolor(this.state.value);\n\n if (color.isValid()) {\n const value = color.toString();\n\n if (value !== prevValue) {\n this.setState({value}, () => onChange?.(this._createEventData(value)));\n }\n } else {\n this.setState({value: prevValue});\n }\n }\n\n handleInputChange = ({target: {value}}) => {\n this.setState({value});\n };\n\n handleInputBlur = () => {\n this.saveValue();\n };\n\n handleInputKeyUp = (e: React.KeyboardEvent) => {\n if (e.code === KeyboardCode.Enter) {\n this.saveValue();\n }\n };\n\n render() {\n const {\n className,\n placeholder,\n disabled,\n readOnly,\n loading,\n name,\n value: valueProp,\n onChange,\n ...otherProps\n } = this.props;\n const {\n value,\n } = this.state;\n\n return (\n \n )}\n disabled={disabled || readOnly}\n interactive={true}\n appendToBody={true}\n onBlur={this.handleDropdownBlur}\n >\n \n \n )}\n loading={loading}\n disabled={disabled}\n readOnly={readOnly}\n onChange={this.handleInputChange}\n onBlur={this.handleInputBlur}\n onKeyUp={this.handleInputKeyUp}\n {...otherProps}\n />\n );\n }\n}\n","import React, {Component, ForwardedRef, forwardRef} from 'react';\nimport {KeyboardCode} from 'app/constants';\nimport {FORM_CONTROL_AUTOCOMPLETE} from 'app/constants/formControlAutocomplete';\nimport {FORM_CONTROL_TYPE} from 'app/components/sharedReactComponents/FormControl/constants';\nimport {Callback, ClassName, DataId} from 'app/types/common';\n\nexport type BaseTextInputType =\n | FORM_CONTROL_TYPE.URL\n | FORM_CONTROL_TYPE.EMAIL\n | FORM_CONTROL_TYPE.PASSWORD\n | FORM_CONTROL_TYPE.TEXT;\n\ninterface Props extends ClassName, DataId {\n inputRef?: ForwardedRef;\n type: BaseTextInputType;\n value: string | number;\n name?: string;\n placeholder?: string;\n minLength?: number;\n maxLength?: number;\n pattern?: string;\n\n // Flags\n disabled?: boolean;\n readOnly: boolean;\n required: boolean;\n\n // For type `text`\n /**\n * This property helps users to fill forms faster, especially on mobile devices.\n * The name can be confusing, as it's more like an autofill.\n * You can learn more about it here:\n * https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill\n */\n autoComplete?: FORM_CONTROL_AUTOCOMPLETE;\n /**\n * If `true`, the input will be focused during the first mount.\n */\n autoFocus?: boolean;\n\n // Callbacks\n onChange?: Callback;\n onFocus?: Callback;\n onBlur?: Callback;\n onKeyDown?: Callback;\n onKeyUp?: Callback;\n}\n\ninterface State {\n value: any;\n name: string;\n}\n\nclass ControlledTextInput extends Component {\n constructor(props: Props) {\n super(props);\n\n this.state = {\n value: props.value,\n name: '',\n };\n }\n\n componentDidUpdate(prevProps) {\n const {value} = this.props;\n\n if (value !== prevProps.value) {\n this.setState({value});\n }\n }\n\n handleChange = ({target: {value}}) => {\n this.setState({value});\n };\n\n handleBlur = (e) => {\n const {onBlur} = this.props;\n\n this.saveValue();\n\n if (onBlur) {\n e.persist();\n onBlur(e);\n }\n };\n\n handleKeyUp = (e: React.KeyboardEvent) => {\n const {onKeyUp} = this.props;\n\n if (e.code === KeyboardCode.Enter) {\n this.saveValue();\n }\n\n if (onKeyUp) {\n e.persist();\n onKeyUp(e);\n }\n };\n\n saveValue() {\n const {name, value} = this.state;\n const {value: valueProp, onChange} = this.props;\n\n if (value !== valueProp) {\n this.setState({value}, () => {\n onChange?.({\n target: {\n name,\n value,\n },\n });\n });\n }\n }\n\n render() {\n const {inputRef, dataId, ...otherProps} = this.props;\n\n return (\n \n );\n }\n}\n\ntype BaseTextProps = Props & {immediateChange?: boolean};\n\nexport const BaseTextInput = forwardRef((props, ref) => {\n const {immediateChange, dataId, ...otherProps} = props;\n\n if (immediateChange === false) {\n return ;\n }\n\n return ;\n});\n\nBaseTextInput.displayName = 'BaseTextInput';\n","import React, {useCallback, useEffect, useState} from 'react';\nimport classNames from 'classnames';\nimport {KeyboardCode} from 'app/constants';\nimport {LoadingWrapper} from 'app/components/sharedReactComponents/LoadingWrapper';\nimport {Callback, Component} from 'app/types/common';\n\nconst processValueToRender = (value: number | string | null): number | string =>\n value === null ? '' : value;\n\nexport interface NumberProps {\n min?: number;\n max?: number;\n step?: number;\n hideArrowButtons?: boolean;\n}\n\ninterface Props extends Component, NumberProps {\n name?: string;\n value: number;\n loading?: boolean;\n disabled?: boolean;\n placeholder?: string;\n onChange?: Callback;\n}\n\nexport const NumberInput = ({\n dataId,\n className,\n name,\n value,\n min,\n max,\n step,\n placeholder,\n loading,\n disabled,\n hideArrowButtons,\n onChange,\n ...otherProps\n}: Props) => {\n const [inputValue, setInputValue] = useState('');\n\n useEffect(() => {\n setInputValue(processValueToRender(value));\n }, [value]);\n\n const handleChange = useCallback((e) => {\n setInputValue(e.target.value);\n }, []);\n\n const handleBlur = () => {\n saveValue();\n };\n\n const handleKeyUp = (e: React.KeyboardEvent) => {\n if (e.code === KeyboardCode.Enter) {\n saveValue();\n }\n };\n\n function saveValue() {\n let newValue = inputValue;\n\n if (inputValue !== '') {\n newValue = Number(inputValue);\n\n if (min !== undefined && newValue < min) {\n newValue = min;\n }\n\n if (max !== undefined && newValue > max) {\n newValue = max;\n }\n }\n\n setInputValue(newValue);\n\n if (value !== newValue) {\n onChange?.({\n target: {\n name,\n value: newValue,\n },\n });\n }\n }\n\n return (\n \n \n \n );\n};\n","import React, {forwardRef, useCallback} from 'react';\nimport {noop} from 'app/util/noop';\nimport {Callback, ClassName, DataId} from 'app/types/common';\n\nfunction processEventData({target: {name, checked}}) {\n return {\n target: {\n value: checked,\n name,\n },\n };\n}\n\ninterface Props extends ClassName, DataId {\n name: string;\n value: boolean;\n tabIndex: number;\n autoFocus: boolean;\n disabled: boolean;\n onChange?: Callback;\n onBlur?: Callback;\n}\n// rework typing and default props\nexport const CheckboxBase = forwardRef(\n (\n {\n className,\n dataId,\n name,\n tabIndex,\n autoFocus,\n value,\n disabled,\n onChange,\n onBlur = noop,\n ...props\n }: Props,\n ref,\n ) => {\n const handleChange = useCallback(\n (e) => {\n onChange?.(processEventData(e));\n },\n [onChange],\n );\n\n const handleBlur = useCallback(\n (e) => {\n onBlur(processEventData(e));\n },\n [onBlur],\n );\n\n return (\n \n );\n },\n);\n","import React, {Component, createRef} from 'react';\nimport classNames from 'classnames';\nimport {LoadingWrapper} from 'app/components/sharedReactComponents/LoadingWrapper';\nimport {SIZE} from 'app/constants';\nimport {CheckboxBase} from 'app/components/sharedReactComponents/Checkbox/CheckboxBase';\nimport {Callback, ClassName, DataId} from 'app/types/common';\n\n/**\n * @readonly\n * @enum {string}\n */\nexport enum CHECKBOX_THEME {\n DEFAULT = 'default',\n BLACK = 'black',\n SILVER_SAND = 'silver-sand',\n}\n// rework\ninterface Props extends ClassName, DataId {\n name?: string;\n value?: boolean;\n autoFocus?: boolean;\n loading?: boolean;\n focusable?: boolean;\n disabled?: boolean;\n hovered?: boolean;\n indeterminate?: boolean;\n highlightOnHover?: boolean;\n theme?: CHECKBOX_THEME;\n size?: SIZE;\n label?: React.ReactNode;\n onChange?: Callback;\n onBlur?: Callback;\n onClick?: Callback;\n}\n\nexport class Checkbox extends Component {\n public inputRef = createRef();\n\n componentDidMount() {\n this._updateIndeterminateState();\n }\n\n componentDidUpdate(prevProps) {\n if (this.props.indeterminate !== prevProps.indeterminate) {\n this._updateIndeterminateState();\n }\n }\n\n _updateIndeterminateState() {\n this.inputRef.current.indeterminate = this.props.indeterminate;\n }\n\n render() {\n const {\n dataId,\n name,\n value,\n autoFocus,\n loading = false,\n focusable,\n disabled,\n hovered,\n indeterminate,\n className,\n theme,\n size,\n label,\n highlightOnHover,\n onClick,\n onChange,\n onBlur,\n ...elementProps\n } = this.props;\n\n // rework\n const tabIndex = focusable === false ? -1 : undefined;\n\n return (\n \n \n \n \n\n {label && {label}}\n \n \n );\n }\n}\n","import React, {useCallback} from 'react';\nimport classNames from 'classnames';\nimport {SIZE} from 'app/constants';\nimport {Callback, ClassName} from 'app/types/common';\n\nexport enum SWITCHER_THEME {\n DEFAULT = 'default',\n SILVER_SAND = 'silver-sand',\n}\n\ninterface Props extends ClassName {\n name?: string;\n value: boolean;\n showLabel?: boolean;\n labelOnText?: string;\n labelOffText?: string;\n autoFocus?: boolean;\n disabled?: boolean;\n size?: SIZE;\n theme?: SWITCHER_THEME;\n onChange?: Callback;\n}\n\nexport const Switcher: React.VFC = ({\n className,\n name,\n value,\n autoFocus,\n showLabel,\n labelOnText,\n labelOffText,\n disabled,\n size,\n theme,\n onChange,\n ...otherProps\n}) => {\n const handleChange = useCallback(({target: {name, checked}}) => {\n onChange?.({\n target: {\n name,\n value: checked,\n },\n });\n }, [onChange]);\n\n return (\n \n \n\n \n\n {showLabel && (\n \n {value ? labelOnText : labelOffText}\n \n )}\n \n );\n};\n","/**\n * @readonly\n * @enum {string}\n */\nenum FORM_CONTROL_TYPE {\n TEXT = 'text',\n PASSWORD = 'password',\n EMAIL = 'email',\n URL = 'url',\n TEXTAREA = 'textarea',\n CHECKBOX = 'checkbox',\n SELECT = 'select',\n SWITCHER = 'switcher',\n NUMBER = 'number',\n COLOR = 'color',\n}\n\nexport {\n FORM_CONTROL_TYPE,\n};\n","/* eslint-disable react/default-props-match-prop-types */\r\nimport React, {Component, forwardRef} from 'react';\r\nimport classNames from 'classnames';\r\nimport {FormHelperText} from 'app/components/sharedReactComponents/FormHelperText';\r\nimport {FormControlLabel} from 'app/components/sharedReactComponents/FormControlLabel';\r\nimport {Icons} from 'app/util/icons';\r\nimport {SIZE, THEME} from 'app/constants';\r\nimport {DropdownSelect, SelectProps} from 'app/components/sharedReactComponents/DropdownSelect';\r\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\r\nimport {TextareaInput, TextareaProps} from 'app/components/sharedReactComponents/TextareaInput';\r\nimport {ColorInput} from 'app/components/sharedReactComponents/ColorInput';\r\nimport {LoadingSpinner} from 'app/components/sharedReactComponents/LoadingWrapper/LoadingSpinner';\r\nimport {BaseTextInput, BaseTextInputType} from 'app/components/sharedReactComponents/BaseTextInput';\r\nimport {NumberInput, NumberProps} from 'app/components/sharedReactComponents/NumberInput';\r\nimport {Checkbox} from 'app/components/sharedReactComponents/Checkbox';\r\nimport {isNil} from 'app/util/isNil';\r\nimport {Switcher} from 'app/components/sharedReactComponents/Switcher';\r\nimport {FORM_CONTROL_TYPE} from 'app/components/sharedReactComponents/FormControl/constants';\r\nimport {FORM_CONTROL_AUTOCOMPLETE} from 'app/constants/formControlAutocomplete';\r\nimport {Callback, ClassName, DataId} from 'app/types/common';\r\n\r\nconst defaultProps = {\r\n type: FORM_CONTROL_TYPE.TEXT,\r\n fullWidth: false,\r\n disabled: false,\r\n readOnly: false,\r\n required: false,\r\n error: false,\r\n};\r\n\r\ntype DefaultProps = typeof defaultProps;\r\n// rework\r\ntype Props = ClassName &\r\n DataId &\r\n DefaultProps & {\r\n value?: string | number | boolean;\r\n name?: string;\r\n\r\n placeholder?: string;\r\n helperText?: React.ReactNode;\r\n\r\n size?: SIZE;\r\n\r\n minLength?: number;\r\n maxLength?: number;\r\n pattern?: string;\r\n\r\n inputRef?: any;\r\n containerRef?: any;\r\n\r\n label?: React.ReactNode;\r\n labelComponent?: React.ElementType;\r\n\r\n startAdornment?: React.ReactNode;\r\n endAdornment?: React.ReactNode;\r\n\r\n // Flags\r\n loading?: boolean;\r\n\r\n /**\r\n * For . Default is `true`\r\n */\r\n immediateChange?: boolean;\r\n\r\n // For type `text`\r\n /**\r\n * This property helps users to fill forms faster, especially on mobile devices.\r\n * The name can be confusing, as it's more like an autofill.\r\n * You can learn more about it here:\r\n * https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill\r\n */\r\n autoComplete?: FORM_CONTROL_AUTOCOMPLETE;\r\n /**\r\n * If `true`, the input will be focused during the first mount.\r\n */\r\n autoFocus?: boolean;\r\n\r\n // Now for type `select` but may be for other types in future\r\n clearable?: boolean;\r\n indeterminate?: boolean;\r\n\r\n // For type `select`\r\n selectComponentProps?: SelectProps;\r\n\r\n // For type `number`\r\n numberComponentProps?: NumberProps;\r\n\r\n textareaComponentProps?: TextareaProps;\r\n\r\n // Callbacks\r\n onChange?: Callback;\r\n onFocus?: Callback;\r\n onBlur?: Callback;\r\n onKeyDown?: Callback;\r\n onKeyUp?: Callback;\r\n };\r\n\r\ninterface State {\r\n focused: boolean;\r\n}\r\n\r\nclass FormControlComponent extends Component {\r\n static defaultProps = defaultProps;\r\n\r\n constructor(props: Props) {\r\n super(props);\r\n\r\n this.state = {\r\n focused: false,\r\n };\r\n }\r\n\r\n getControl() {\r\n const {type} = this.props;\r\n\r\n switch (type) {\r\n case FORM_CONTROL_TYPE.SELECT:\r\n return this.renderSelectInput();\r\n case FORM_CONTROL_TYPE.TEXTAREA:\r\n return this.renderTextareaInput();\r\n case FORM_CONTROL_TYPE.COLOR:\r\n return this.renderColorInput();\r\n case FORM_CONTROL_TYPE.NUMBER:\r\n return this.renderNumberInput();\r\n case FORM_CONTROL_TYPE.CHECKBOX:\r\n return this.renderCheckboxInput();\r\n case FORM_CONTROL_TYPE.SWITCHER:\r\n return this.renderSwitcherInput();\r\n default:\r\n return this.renderTextInput();\r\n }\r\n }\r\n\r\n renderSelectInput() {\r\n const {\r\n name,\r\n value,\r\n placeholder,\r\n size,\r\n\r\n clearable,\r\n indeterminate,\r\n disabled,\r\n loading,\r\n\r\n onChange,\r\n onBlur,\r\n\r\n selectComponentProps,\r\n ...rest\r\n } = this.props;\r\n\r\n const {\r\n className,\r\n type,\r\n fullWidth,\r\n readOnly,\r\n required,\r\n error,\r\n helperText,\r\n minLength,\r\n maxLength,\r\n pattern,\r\n inputRef,\r\n containerRef,\r\n label,\r\n labelComponent,\r\n startAdornment,\r\n endAdornment,\r\n immediateChange,\r\n autoComplete,\r\n autoFocus,\r\n numberComponentProps,\r\n onFocus,\r\n onKeyDown,\r\n onKeyUp,\r\n ...elementProps\r\n } = rest;\r\n\r\n return (\r\n \r\n );\r\n }\r\n\r\n renderTextareaInput() {\r\n const {\r\n dataId,\r\n inputRef,\r\n name,\r\n placeholder,\r\n value,\r\n\r\n autoFocus,\r\n disabled,\r\n readOnly,\r\n required,\r\n textareaComponentProps,\r\n\r\n onChange,\r\n onBlur,\r\n onKeyDown,\r\n onKeyUp,\r\n\r\n ...rest\r\n } = this.props;\r\n\r\n const {\r\n className,\r\n type,\r\n fullWidth,\r\n error,\r\n helperText,\r\n size,\r\n minLength,\r\n maxLength,\r\n pattern,\r\n containerRef,\r\n label,\r\n labelComponent,\r\n startAdornment,\r\n endAdornment,\r\n loading,\r\n immediateChange,\r\n autoComplete,\r\n clearable,\r\n indeterminate,\r\n selectComponentProps,\r\n numberComponentProps,\r\n onFocus,\r\n ...elementProps\r\n } = rest;\r\n\r\n return (\r\n \r\n );\r\n }\r\n\r\n renderNumberInput() {\r\n const {\r\n name,\r\n value,\r\n numberComponentProps,\r\n placeholder,\r\n\r\n disabled,\r\n loading,\r\n\r\n onChange,\r\n onBlur,\r\n ...rest\r\n } = this.props;\r\n\r\n const {\r\n className,\r\n type,\r\n fullWidth,\r\n readOnly,\r\n required,\r\n error,\r\n helperText,\r\n size,\r\n minLength,\r\n maxLength,\r\n pattern,\r\n inputRef,\r\n containerRef,\r\n label,\r\n labelComponent,\r\n startAdornment,\r\n endAdornment,\r\n immediateChange,\r\n autoComplete,\r\n autoFocus,\r\n clearable,\r\n indeterminate,\r\n selectComponentProps,\r\n onFocus,\r\n onKeyDown,\r\n onKeyUp,\r\n ...elementProps\r\n } = rest;\r\n\r\n return (\r\n \r\n );\r\n }\r\n\r\n renderCheckboxInput() {\r\n const {\r\n name,\r\n value,\r\n label,\r\n size,\r\n\r\n autoFocus,\r\n disabled,\r\n loading,\r\n indeterminate,\r\n\r\n onChange,\r\n onBlur,\r\n\r\n ...rest\r\n } = this.props;\r\n\r\n const {\r\n dataId,\r\n className,\r\n type,\r\n fullWidth,\r\n readOnly,\r\n required,\r\n error,\r\n placeholder,\r\n helperText,\r\n minLength,\r\n maxLength,\r\n pattern,\r\n inputRef,\r\n containerRef,\r\n labelComponent,\r\n startAdornment,\r\n endAdornment,\r\n immediateChange,\r\n autoComplete,\r\n clearable,\r\n selectComponentProps,\r\n numberComponentProps,\r\n onFocus,\r\n onKeyDown,\r\n onKeyUp,\r\n ...elementProps\r\n } = rest;\r\n\r\n return (\r\n \r\n );\r\n }\r\n\r\n renderSwitcherInput() {\r\n const {\r\n name,\r\n value,\r\n size,\r\n\r\n autoFocus,\r\n disabled,\r\n loading,\r\n\r\n onChange,\r\n\r\n ...rest\r\n } = this.props;\r\n\r\n const {\r\n className,\r\n type,\r\n fullWidth,\r\n readOnly,\r\n required,\r\n error,\r\n placeholder,\r\n helperText,\r\n minLength,\r\n maxLength,\r\n pattern,\r\n inputRef,\r\n containerRef,\r\n label,\r\n labelComponent,\r\n startAdornment,\r\n endAdornment,\r\n immediateChange,\r\n autoComplete,\r\n clearable,\r\n indeterminate,\r\n selectComponentProps,\r\n numberComponentProps,\r\n onFocus,\r\n onBlur,\r\n onKeyDown,\r\n onKeyUp,\r\n ...elementProps\r\n } = rest;\r\n\r\n return (\r\n \r\n );\r\n }\r\n\r\n renderTextInput() {\r\n const {\r\n dataId,\r\n name,\r\n placeholder,\r\n type,\r\n value,\r\n minLength,\r\n maxLength,\r\n pattern,\r\n inputRef,\r\n\r\n autoComplete,\r\n immediateChange,\r\n\r\n startAdornment,\r\n endAdornment,\r\n\r\n autoFocus,\r\n disabled,\r\n loading,\r\n readOnly,\r\n required,\r\n\r\n onChange,\r\n onKeyDown,\r\n onKeyUp,\r\n\r\n ...rest\r\n } = this.props;\r\n\r\n const {\r\n className,\r\n fullWidth,\r\n error,\r\n helperText,\r\n size,\r\n containerRef,\r\n label,\r\n labelComponent,\r\n clearable,\r\n indeterminate,\r\n selectComponentProps,\r\n numberComponentProps,\r\n onFocus,\r\n onBlur,\r\n ...elementProps\r\n } = rest;\r\n\r\n const showInputStartAdornment = Boolean(startAdornment);\r\n const showInputEndAdornment = Boolean(required) || Boolean(endAdornment);\r\n\r\n return (\r\n
    \r\n {showInputStartAdornment && (\r\n
    {startAdornment}
    \r\n )}\r\n\r\n \r\n\r\n {showInputEndAdornment && (\r\n
    \r\n {endAdornment}\r\n\r\n {required && !disabled && (\r\n \r\n {Icons.required().theme(THEME.SUCCESS).reactComponent()}\r\n \r\n )}\r\n
    \r\n )}\r\n\r\n {loading && }\r\n
    \r\n );\r\n }\r\n\r\n renderColorInput() {\r\n const {\r\n name,\r\n value,\r\n placeholder,\r\n\r\n disabled,\r\n readOnly,\r\n loading,\r\n\r\n onChange,\r\n // onBlur,\r\n\r\n ...rest\r\n } = this.props;\r\n\r\n const {\r\n className,\r\n type,\r\n fullWidth,\r\n required,\r\n error,\r\n helperText,\r\n size,\r\n minLength,\r\n pattern,\r\n inputRef,\r\n containerRef,\r\n label,\r\n labelComponent,\r\n startAdornment,\r\n endAdornment,\r\n immediateChange,\r\n autoComplete,\r\n autoFocus,\r\n clearable,\r\n indeterminate,\r\n selectComponentProps,\r\n numberComponentProps,\r\n onFocus,\r\n onBlur,\r\n onKeyDown,\r\n onKeyUp,\r\n ...elementProps\r\n } = rest;\r\n\r\n return (\r\n \r\n );\r\n }\r\n\r\n handleFocus = (e) => {\r\n this.setState((state) => (state.focused ? null : {focused: true}));\r\n\r\n if (this.props.onFocus) {\r\n this.props.onFocus(e);\r\n }\r\n };\r\n\r\n handleBlur = (e) => {\r\n this.setState((state) => (state.focused ? {focused: false} : null));\r\n\r\n if (this.props.onBlur) {\r\n this.props.onBlur(e);\r\n }\r\n };\r\n\r\n render() {\r\n const {\r\n className,\r\n helperText,\r\n label,\r\n type,\r\n containerRef,\r\n size,\r\n\r\n labelComponent,\r\n\r\n disabled,\r\n loading,\r\n readOnly,\r\n required,\r\n error,\r\n fullWidth,\r\n } = this.props;\r\n const {focused} = this.state;\r\n\r\n const control = this.getControl();\r\n const showLabel = isNil(label) === false && type !== FORM_CONTROL_TYPE.CHECKBOX;\r\n let component = labelComponent;\r\n\r\n if (!labelComponent) {\r\n if (type === FORM_CONTROL_TYPE.SELECT || type === FORM_CONTROL_TYPE.SWITCHER) {\r\n component = 'div';\r\n }\r\n }\r\n\r\n return (\r\n \r\n {showLabel ? (\r\n \r\n ) : (\r\n control\r\n )}\r\n\r\n {helperText && {helperText}}\r\n \r\n );\r\n }\r\n}\r\n\r\ntype ForwardedProps = Omit & Partial;\r\n\r\nexport const FormControl = forwardRef((props, ref) => (\r\n \r\n));\r\n\r\nFormControl.displayName = 'FormControl';\r\n","import React, {ReactNode, useEffect, useState} from 'react';\nimport classNames from 'classnames';\nimport {ProgressButton, BUTTON_TYPE} from 'app/components/sharedReactComponents/ProgressButton';\nimport {FormControl} from 'app/components/sharedReactComponents/FormControl';\nimport {\n THEME,\n VARIANT,\n} from 'app/constants';\nimport {mapObjIndexed} from 'ramda';\nimport {Callback, ClassName} from 'app/types/common';\n\nconst Row: React.FC = ({children}) => {\n return (\n
    \n {children}\n
    \n );\n};\n\nfunction trim(value) {\n return typeof value === 'string' ? value.trim() : value;\n}\n\nfunction getDefaultValues(fields) {\n return fields.reduce((acc, field) => {\n const {defaultValue} = field;\n\n if (defaultValue) {\n acc[field.name] = defaultValue;\n }\n\n return acc;\n }, {});\n}\n\n// rework\ninterface Props extends ClassName {\n fields: any [];\n buttonText: string;\n errorProcessor: Callback;\n submitAction: Callback>;\n onSubmit: Callback;\n error?: any;\n loading?: boolean;\n descriptionComponent?: ReactNode;\n hintComponent?: ReactNode;\n}\n\nexport const Form = ({\n className,\n fields,\n buttonText,\n errorProcessor,\n submitAction,\n onSubmit,\n error,\n loading,\n descriptionComponent,\n hintComponent,\n}: Props) => {\n const [errorState, setErrorState] = useState(null);\n const [loadingState, setLoadingState] = useState(false);\n const [formData, setFormData] = useState(getDefaultValues(fields));\n\n useEffect(() => {\n setErrorState(error);\n setFormData(getDefaultValues(fields));\n }, [error, fields]);\n\n const getFormData = () => {\n return mapObjIndexed(trim, formData);\n };\n\n const getValueByName = (name) => {\n return formData[name] || '';\n };\n\n const handleSubmit = (e) => {\n e.preventDefault();\n\n const formData = getFormData();\n\n if (submitAction) {\n setLoadingState(true);\n\n submitAction(formData)\n .catch(error => {\n setErrorState(errorProcessor(error, formData.username));\n })\n .finally(() => setLoadingState(false));\n } else {\n onSubmit(formData);\n }\n };\n\n const handleChange = ({target: {name, value}}) => {\n setErrorState(null);\n setFormData((formData) => ({\n ...formData,\n [name]: value,\n }));\n };\n\n const renderControl = (field, props) => {\n const hasError = errorState?.name === field.name;\n const formValue = getValueByName(field.name);\n\n return (\n \n );\n };\n\n let autoFocusUsed = false;\n const currentLoading = loading || loadingState;\n\n return (\n \n {descriptionComponent && (\n
    \n {descriptionComponent}\n
    \n )}\n\n {errorState && errorState.name === 'common' && (\n
    \n {errorState.message}\n
    \n )}\n\n
    \n {fields.map(field => {\n if (field.controls) {\n return (\n \n {field.controls.map(control => {\n let autoFocus = false;\n\n if (!autoFocusUsed && !control.disabled) {\n autoFocusUsed = true;\n autoFocus = true;\n }\n\n return renderControl(control, {\n key: control.name,\n autoFocus,\n });\n })}\n \n );\n }\n\n let autoFocus = false;\n\n if (!autoFocusUsed && !field.disabled) {\n autoFocusUsed = true;\n autoFocus = true;\n }\n\n return (\n \n {renderControl(field, {autoFocus})}\n \n );\n })}\n\n {hintComponent && (\n
    \n {hintComponent}\n
    \n )}\n
    \n\n
    \n \n {buttonText}\n \n
    \n \n );\n};\n","import React from 'react';\n\nexport function Separator() {\n return (\n
    \n );\n}\n","/**\n * {@link https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofilling-form-controls%3A-the-autocomplete-attribute}\n * @readonly\n * @enum {string}\n */\nenum FORM_CONTROL_AUTOCOMPLETE {\n ON = 'on',\n OFF = 'off',\n NAME = 'name',\n HONORIFIC_PREFIX = 'honorific-prefix',\n GIVEN_NAME = 'given-name',\n ADDITIONAL_NAME = 'additional-name',\n FAMILY_NAME = 'family-name',\n HONORIFIC_SUFFIX = 'honorific-suffix',\n NICKNAME = 'nickname',\n USERNAME = 'username',\n NEW_PASSWORD = 'new-password',\n CURRENT_PASSWORD = 'current-password',\n ONE_TIME_CODE = 'one-time-code',\n ORGANIZATION_TITLE = 'organization-title',\n ORGANIZATION = 'organization',\n STREET_ADDRESS = 'street-address',\n ADDRESS_LINE1 = 'address-line1',\n ADDRESS_LINE2 = 'address-line2',\n ADDRESS_LINE3 = 'address-line3',\n ADDRESS_LEVEL4 = 'address-level4',\n ADDRESS_LEVEL3 = 'address-level3',\n ADDRESS_LEVEL2 = 'address-level2',\n ADDRESS_LEVEL1 = 'address-level1',\n COUNTRY = 'country',\n COUNTRY_NAME = 'country-name',\n POSTAL_CODE = 'postal-code',\n CC_NAME = 'cc-name',\n CC_GIVEN_NAME = 'cc-given-name',\n CC_ADDITIONAL_NAME = 'cc-additional-name',\n CC_FAMILY_NAME = 'cc-family-name',\n CC_NUMBER = 'cc-number',\n CC_EXP = 'cc-exp',\n CC_EXP_MONTH = 'cc-exp-month',\n CC_EXP_YEAR = 'cc-exp-year',\n CC_CSC = 'cc-csc',\n CC_TYPE = 'cc-type',\n TRANSACTION_CURRENCY = 'transaction-currency',\n TRANSACTION_AMOUNT = 'transaction-amount',\n LANGUAGE = 'language',\n BDAY = 'bday',\n BDAY_DAY = 'bday-day',\n BDAY_MONTH = 'bday-month',\n BDAY_YEAR = 'bday-year',\n SEX = 'sex',\n URL = 'url',\n PHOTO = 'photo',\n}\n\nexport {\n FORM_CONTROL_AUTOCOMPLETE,\n};\n","import {useEffect} from 'react';\nimport {Callback} from 'app/types/common';\n\nexport function useComponentWillUnmount(fn: Callback) {\n useEffect(() => fn, []);\n}\n","import React, {useRef, useState} from 'react';\nimport {ProgressButton} from 'app/components/sharedReactComponents/ProgressButton';\nimport {VARIANT} from 'app/constants';\nimport Auth from '@aws-amplify/auth';\nimport {noop} from 'app/util/noop';\nimport {Callback} from 'app/types/common';\nimport {useComponentWillUnmount} from 'app/hooks/useComponentWillUnmount';\n\nconst LOCK_RESEND_BUTTON_TIMEOUT_MS = 5000;\n\nfunction errorProcessor(error) {\n switch (error.code) {\n case 'LimitExceededException':\n return {\n name: 'common',\n message: 'Attempt limit exceeded, please try after some time',\n };\n default:\n return {\n name: 'common',\n message: error.message,\n };\n }\n}\n\ninterface Props {\n username: string;\n onClick: Callback;\n onSuccess: Callback;\n onError: Callback;\n}\n\nexport const ResendConfirmationEmailButton = ({\n username,\n onClick = noop,\n onSuccess = noop,\n onError = noop,\n}: Props) => {\n const [loading, setLoading] = useState(false);\n const [locked, setLocked] = useState(false);\n const lockResendButtonTimeout = useRef(null);\n\n useComponentWillUnmount(() => clearTimeout(lockResendButtonTimeout.current));\n\n const handleClick = (): any => {\n setLoading(true);\n setLocked(true);\n\n onClick();\n\n Auth.resendSignUp(username)\n .then(() => {\n onSuccess();\n })\n .catch(error => {\n onError(errorProcessor(error));\n })\n .finally(() => {\n setLoading(false);\n\n lockResendButtonTimeout.current = setTimeout(() => {\n setLocked(false);\n }, LOCK_RESEND_BUTTON_TIMEOUT_MS);\n });\n };\n\n return (\n \n Resend it\n \n );\n};\n","import React, {useState} from 'react';\nimport {ResendConfirmationEmailButton} from 'app/components/Login/LoginForm/ResendConfirmationEmailButton';\n\ninterface Props {\n username: string;\n}\n\nexport const UserNotConfirmedExceptionMessage = ({username}: Props) => {\n const [sent, setSent] = useState(false);\n const [error, setError] = useState(null);\n\n const handleClick = () => {\n setError(null);\n };\n\n const handleSuccess = () => {\n setSent(true);\n };\n\n const handleError = (error) => {\n setError(error);\n setSent(false);\n };\n\n return (\n
    \n User is not confirmed.
    \n Didn't receive a confirmation email?\n\n \n\n {sent && !error && (\n
    \n Please check your email, follow the instructions to verify your email address\n
    \n )}\n\n {error?.message && (\n
    \n {error.message}\n
    \n )}\n
    \n );\n};\n","import React, {useCallback} from 'react';\nimport classNames from 'classnames';\nimport {Callback, ClassName, DataId} from 'app/types/common';\nimport {KeyboardCode} from 'app/constants';\n\ninterface Props extends ClassName, DataId {\n title?: string;\n underlined?: boolean;\n onClick?: Callback;\n}\n\nexport const PseudoLink: React.FC = ({\n className,\n dataId,\n title,\n underlined,\n children,\n onClick,\n ...elementProps\n}) => {\n const handleKeyUp = useCallback(\n (event: React.KeyboardEvent) => {\n if (onClick && event.code === KeyboardCode.Enter) {\n onClick();\n }\n },\n [onClick],\n );\n\n return (\n \n {children}\n \n );\n};\n","import React, {Fragment, useEffect, useState} from 'react';\nimport {Form} from 'app/components/Login/LoginForm/Form';\nimport Auth from '@aws-amplify/auth';\nimport {AUTH_STATE} from 'app/components/Login/LoginForm/constants';\nimport {Separator} from 'app/components/Login/LoginForm/Separator';\nimport {FORM_CONTROL_AUTOCOMPLETE} from 'app/constants/formControlAutocomplete';\nimport {UserNotConfirmedExceptionMessage} from 'app/components/Login/LoginForm/UserNotConfirmedExceptionMessage';\nimport {PseudoLink} from 'app/components/sharedReactComponents/PseudoLink';\nimport {Callback} from 'app/types/common';\n\nfunction errorProcessor(error, username) {\n switch (error.code) {\n case 'UserNotFoundException':\n // The error happens when the supplied username/email does not exist in the Cognito user pool\n return {\n name: 'username',\n message: 'User not found',\n };\n case 'UnexpectedLambdaException':\n case 'NotAuthorizedException':\n // The error happens when the incorrect password is provided\n return {\n name: 'common',\n message: 'Incorrect username or password',\n };\n case 'PasswordResetRequiredException':\n // The error happens when the password is reset in the Cognito console\n // In this case you need to call forgotPassword to reset the password\n // Please check the Forgot Password part.\n return {\n name: 'common',\n message: 'Password reset required for the user',\n };\n case 'UserNotConfirmedException':\n return {\n name: 'common',\n message: ,\n };\n default:\n return {\n name: 'common',\n message: error.message,\n };\n }\n}\n\nfunction getFields(authDataProp) {\n return [\n {\n name: 'username',\n label: 'Email',\n autoComplete: FORM_CONTROL_AUTOCOMPLETE.USERNAME,\n type: 'email',\n defaultValue: authDataProp.username,\n required: true,\n },\n {\n name: 'password',\n label: 'Password',\n autoComplete: FORM_CONTROL_AUTOCOMPLETE.OFF,\n type: 'password',\n required: true,\n },\n ];\n}\n\ninterface SignInArgs {\n AccessToken: string;\n IdToken: string;\n RefreshToken: string;\n state?: string;\n}\n\ninterface Props {\n authData: any;\n authState: AUTH_STATE;\n switchStateToForgotPassword: Callback;\n switchStateToResetPassword: Callback;\n // switchStateToSignUp: Callback;\n onSignIn: (args: SignInArgs) => Promise;\n}\n\nexport const SignIn = ({\n authState,\n authData,\n switchStateToResetPassword,\n switchStateToForgotPassword,\n onSignIn,\n}: Props) => {\n const [fields, setFields] = useState(getFields(authData));\n\n useEffect(() => {\n setFields(getFields(authData));\n }, [authData]);\n\n const submitLogin = async (data: any) => {\n try {\n const user = await Auth.signIn(data.username, data.password);\n const userSession = user.getSignInUserSession();\n\n await onSignIn({\n AccessToken: userSession.getAccessToken().getJwtToken(),\n IdToken: userSession.getIdToken().getJwtToken(),\n RefreshToken: userSession.getRefreshToken().getToken(),\n state: localStorage.getItem(`ue:${data.username}`) ?? undefined,\n });\n } catch (error) {\n if (error.code === 'UserNotConfirmedException') {\n // The error happens if the user didn't finish the confirmation step when signing up\n // In this case you need to resend the code and confirm the user\n // About how to resend the code and confirm the user, please check the signUp part\n } else if (error.code === 'PasswordResetRequiredException') {\n switchStateToResetPassword(data.username);\n } else {\n console.log(error);\n\n throw error;\n }\n }\n };\n\n if (authState !== AUTH_STATE.SIGN_IN) {\n return null;\n }\n\n return (\n \n \n\n \n Forgot password?\n \n }\n errorProcessor={errorProcessor}\n submitAction={submitLogin}\n // rework\n onSubmit={() => ({})}\n />\n \n );\n};\n","import React, {Fragment} from 'react';\nimport {Form} from 'app/components/Login/LoginForm/Form';\nimport Auth from '@aws-amplify/auth';\nimport {\n AUTH_STATE,\n PASSWORD_REQUIREMENTS_MESSAGE,\n PASSWORD_MIN_LENGTH,\n} from 'app/components/Login/LoginForm/constants';\nimport {Separator} from 'app/components/Login/LoginForm/Separator';\nimport {FORM_CONTROL_AUTOCOMPLETE} from 'app/constants/formControlAutocomplete';\nimport {Callback} from 'app/types/common';\n\nfunction errorProcessor(error) {\n if (typeof error === 'string') {\n return {\n name: 'common',\n message: error,\n };\n }\n\n switch (error.code) {\n case 'InvalidParameterException':\n if (/password/.test(error.message)) {\n return {\n name: 'password',\n };\n }\n\n return {\n name: 'username',\n };\n case 'InvalidPasswordException':\n return {\n name: 'password',\n };\n case 'UsernameExistsException':\n return {\n name: 'username',\n message: 'An account with the given email already exists',\n };\n default:\n return {\n name: 'common',\n message: error.message,\n };\n }\n}\n\ninterface Props {\n authState: AUTH_STATE;\n state?: string;\n switchStateToConfirmSignUp: Callback;\n}\n\nexport const SignUp = ({authState, state, switchStateToConfirmSignUp}: Props) => {\n const fields = [\n {\n name: '__name_group__',\n controls: [\n {\n name: 'name',\n label: 'First name',\n autoComplete: FORM_CONTROL_AUTOCOMPLETE.GIVEN_NAME,\n },\n {\n name: 'family_name',\n label: 'Last name',\n autoComplete: FORM_CONTROL_AUTOCOMPLETE.FAMILY_NAME,\n },\n ],\n },\n {\n name: 'username',\n label: 'Email',\n autoComplete: FORM_CONTROL_AUTOCOMPLETE.USERNAME,\n type: 'email',\n required: true,\n },\n {\n name: 'password',\n label: 'Password',\n autoComplete: FORM_CONTROL_AUTOCOMPLETE.NEW_PASSWORD,\n type: 'password',\n minLength: PASSWORD_MIN_LENGTH,\n helperText: PASSWORD_REQUIREMENTS_MESSAGE,\n required: true,\n },\n ];\n\n const submitAction = async (data: Record) => {\n const attributes: Record = {\n email: data.username,\n };\n\n if (data.name) {\n attributes.name = data.name;\n }\n\n if (data.family_name) {\n // eslint-disable-next-line camelcase\n attributes.family_name = data.family_name;\n }\n\n const result: any = await Auth.signUp({\n username: data.username,\n password: data.password,\n attributes,\n validationData: [],\n });\n\n switchStateToConfirmSignUp(result.user.username);\n\n if (state?.startsWith('uetoken')) {\n localStorage.setItem(`ue:${result.user.username}`, state);\n }\n };\n\n if (authState !== AUTH_STATE.SIGN_UP) {\n return null;\n }\n\n return (\n \n \n\n ({})}\n />\n \n );\n};\n","import React, {useState} from 'react';\nimport {AUTH_STATE} from 'app/components/Login/LoginForm/constants';\nimport {ResendConfirmationEmailButton} from 'app/components/Login/LoginForm/ResendConfirmationEmailButton';\n\ninterface Props {\n authData: any;\n authState: AUTH_STATE;\n}\n\nexport const ConfirmSignUp = ({\n authState,\n authData,\n}: Props) => {\n const [error, setError] = useState(null);\n\n const handleClick = () => {\n setError(null);\n };\n\n const handleSuccess = () => ({});\n\n const handleError = (error) => {\n setError(error);\n };\n\n if (authState !== AUTH_STATE.CONFIRM_SIGN_UP) {\n return null;\n }\n\n return (\n
    \n Please check your email for the confirmation link
    \n Didn't receive a confirmation email?\n\n \n\n {error?.message && (\n
    \n {error.message}\n
    \n )}\n
    \n );\n};\n","export class Google {\n constructor(public state: string, public next: string) {\n this.next = next;\n this.state = state;\n\n /**\n * {@link https://developers.google.com/identity/gsi/web/reference/js-reference#google.accounts.id.initialize}\n */\n window.google.accounts.id.initialize({\n client_id: CIRRUS_AUTH_GOOGLE_CLIENT_ID,\n ux_mode: 'redirect',\n login_uri: `${window.location.origin}/front/api/v1t/oauth/google`,\n });\n }\n\n renderButton(element: HTMLDivElement, signIn = false) {\n /**\n * {@link https://developers.google.com/identity/gsi/web/reference/js-reference#google.accounts.id.renderButton}\n */\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n window.google.accounts.id.renderButton(element, {\n type: 'standard',\n shape: 'rectangular',\n theme: 'filled_blue',\n text: signIn ? 'signin_with' : 'signup_with',\n size: 'large',\n logo_alignment: 'left',\n width: 352,\n state: this.state,\n } as any);\n }\n}\n","import React, {useEffect, useMemo, useRef} from 'react';\nimport classNames from 'classnames';\nimport {Google} from 'app/components/Authorization/Google';\nimport {AUTH_STATE} from 'app/components/Login/LoginForm/constants';\nimport {ClassName} from 'app/types/common';\n\ninterface Props extends ClassName {\n authState: AUTH_STATE;\n next: string;\n state: string;\n}\n\nexport function GoogleButton({className, next, state, authState}: Props) {\n const buttonRef = useRef(null);\n\n const provider = useMemo(() => {\n return new Google(state, next);\n }, [next, state]);\n\n useEffect(() => {\n if (buttonRef.current) {\n provider.renderButton(buttonRef.current, authState === AUTH_STATE.SIGN_IN);\n }\n }, [authState, provider]);\n\n return (\n \n );\n}\n","import React from 'react';\nimport {AUTH_STATE} from 'app/components/Login/LoginForm/constants';\nimport {GoogleButton} from 'app/components/Login/LoginForm/SignInButton/GoogleButton';\n\nconst showOn = [AUTH_STATE.SIGN_IN, AUTH_STATE.SIGN_UP];\n\ninterface Props {\n authState: AUTH_STATE;\n next: string;\n state: string;\n}\n\nexport function AuthButtons({authState, next, state}: Props) {\n if (!showOn.includes(authState)) {\n return null;\n }\n\n return (\n
    \n \n
    \n );\n}\n","import React from 'react';\nimport {Form} from 'app/components/Login/LoginForm/Form';\nimport {AUTH_STATE} from 'app/components/Login/LoginForm/constants';\nimport Auth from '@aws-amplify/auth';\nimport {Callback} from 'app/types/common';\nimport {noop} from 'app/util/noop';\n\nfunction errorProcessor(error) {\n switch (error.code) {\n case 'UserNotFoundException':\n return {\n name: 'email',\n message: 'User not found',\n };\n case 'LimitExceededException':\n return {\n name: 'common',\n message: 'Attempt limit exceeded, please try after some time'\n };\n default:\n return {\n name: 'common',\n message: error.message,\n };\n }\n}\n\ninterface Props {\n authState: AUTH_STATE;\n switchStateToResetPassword: Callback;\n}\n\n// rework\nexport const ForgotPassword = ({\n authState,\n switchStateToResetPassword,\n}: Props) => {\n const fields = [\n {\n name: 'email',\n label: 'Your email',\n type: 'email',\n required: true,\n },\n ];\n\n const submitAction = async (data) => {\n return Auth.forgotPassword(data.email)\n .then(() => {\n switchStateToResetPassword(data.email);\n });\n };\n\n if (authState !== AUTH_STATE.FORGOT_PASSWORD) {\n return null;\n }\n\n return (\n \n );\n};\n","import React, {useEffect, useState} from 'react';\nimport {Form} from 'app/components/Login/LoginForm/Form';\nimport {\n AUTH_STATE,\n PASSWORD_REQUIREMENTS_MESSAGE,\n PASSWORD_MIN_LENGTH,\n} from 'app/components/Login/LoginForm/constants';\nimport Auth from '@aws-amplify/auth';\nimport {FORM_CONTROL_AUTOCOMPLETE} from 'app/constants/formControlAutocomplete';\nimport {Callback} from 'app/types/common';\n\nfunction errorProcessor(error) {\n if (typeof error === 'string') {\n return {\n name: 'common',\n message: error,\n };\n }\n\n switch (error.code) {\n case 'InvalidParameterException':\n if (/password/.test(error.message)) {\n return {\n name: 'password',\n };\n }\n\n if (/confirmationCode/.test(error.message)) {\n return {\n name: 'code',\n message: 'Invalid verification code provided, please try again',\n };\n }\n\n return {\n name: 'username',\n };\n case 'InvalidPasswordException':\n return {\n name: 'password',\n };\n case 'CodeMismatchException':\n return {\n name: 'code',\n message: 'Invalid verification code provided, please try again',\n };\n default:\n return {\n name: 'common',\n message: error.message,\n };\n }\n}\n\ninterface Props {\n authState: AUTH_STATE;\n authData: any;\n switchStateToSignIn: Callback;\n}\n\nexport const ResetPassword = ({\n authState,\n authData,\n switchStateToSignIn,\n}: Props) => {\n const getFields = (authDataProp) => {\n return [\n {\n name: 'email',\n label: 'Your email',\n type: 'email',\n defaultValue: authDataProp.username,\n required: true,\n disabled: Boolean(authDataProp.username),\n },\n {\n name: 'code',\n label: 'Code',\n autoComplete: FORM_CONTROL_AUTOCOMPLETE.OFF,\n helperText: 'Paste code sent to your email',\n required: true,\n },\n {\n name: 'password',\n label: 'New password',\n autoComplete: FORM_CONTROL_AUTOCOMPLETE.NEW_PASSWORD,\n type: 'password',\n minLength: PASSWORD_MIN_LENGTH,\n helperText: PASSWORD_REQUIREMENTS_MESSAGE,\n required: true,\n },\n ];\n };\n\n const [fields, setFields] = useState(getFields(authData));\n\n useEffect(() => {\n setFields(getFields(authData));\n }, [authData]);\n\n const submitAction = async (data) => {\n return Auth.forgotPasswordSubmit(data.email, data.code, data.password)\n .then(() => {\n switchStateToSignIn(data.email);\n });\n };\n\n if (authState !== AUTH_STATE.RESET_PASSWORD) {\n return null;\n }\n\n return (\n ({})}\n />\n );\n};\n","import React from 'react';\nimport {AUTH_STATE} from 'app/components/Login/LoginForm/constants';\nimport {PseudoLink} from 'app/components/sharedReactComponents/PseudoLink';\nimport {Callback} from 'app/types/common';\n\ninterface Props {\n authState: AUTH_STATE;\n authData: any;\n switchStateToSignUp: Callback;\n switchStateToSignIn: Callback;\n}\n\nconst FooterMessage: React.FC = ({\n authState,\n authData,\n switchStateToSignUp,\n switchStateToSignIn,\n}) => {\n const {\n username,\n } = authData;\n\n switch (authState) {\n case AUTH_STATE.SIGN_IN:\n return (\n
    \n No account? \n switchStateToSignUp()}\n >\n Sign up for FREE\n \n
    \n );\n case AUTH_STATE.SIGN_UP:\n return (\n
    \n Already have an account? \n switchStateToSignIn()}\n >\n Log in\n \n
    \n );\n case AUTH_STATE.CONFIRM_SIGN_UP:\n case AUTH_STATE.FORGOT_PASSWORD:\n case AUTH_STATE.RESET_PASSWORD:\n return (\n
    \n switchStateToSignIn(username)}\n >\n Back to Sign In\n \n
    \n );\n default:\n return null;\n }\n};\n\nexport const Footer = (props: Props) => (\n
    \n \n
    \n);\n","import React, {ComponentProps, useEffect, useState} from 'react';\nimport Auth from '@aws-amplify/auth';\nimport {AUTH_STATE} from 'app/components/Login/LoginForm/constants';\nimport {Title} from 'app/components/Login/LoginForm/Title';\nimport {SignIn} from 'app/components/Login/LoginForm/SignIn';\nimport {SignUp} from 'app/components/Login/LoginForm/SignUp';\nimport {ConfirmSignUp} from 'app/components/Login/LoginForm/ConfirmSignUp';\nimport {AuthButtons} from 'app/components/Login/LoginForm/AuthButtons';\nimport {ForgotPassword} from 'app/components/Login/LoginForm/ForgotPassword';\nimport {ResetPassword} from 'app/components/Login/LoginForm/ResetPassword';\nimport {Footer} from 'app/components/Login/LoginForm/Footer';\nimport {Callback} from 'app/types/common';\n\ninterface ConfigUpdate {\n authState: AUTH_STATE;\n authData?: {\n username?: string;\n };\n}\n\ntype SignInFn = ComponentProps['onSignIn'];\n\ninterface Props {\n next: string;\n state: string;\n authState: AUTH_STATE;\n onSignedIn: SignInFn;\n onChangeState: Callback;\n}\n\nexport function LoginForm({next, state, authState, onSignedIn, onChangeState}: Props) {\n const [authStateComponent, setAuthStateComponent] = useState(authState);\n const [authData, setAuthData] = useState({});\n\n Auth.configure({\n Auth: {\n userPoolId: CIRRUS_AUTH_AWS_COGNITO_USER_POOL_ID,\n userPoolWebClientId: CIRRUS_AUTH_AWS_COGNITO_USER_POOL_WEB_CLIENT_ID,\n },\n });\n\n useEffect(() => {\n setAuthStateComponent(authState);\n }, [authState]);\n\n const updateAuthState = ({authState, authData}: ConfigUpdate) => {\n setAuthStateComponent(authState);\n\n if (authData) {\n setAuthData(authData);\n }\n\n onChangeState(authState);\n };\n\n const switchStateToForgotPassword = () => {\n updateAuthState({authState: AUTH_STATE.FORGOT_PASSWORD});\n };\n\n const switchStateToResetPassword = (username: string) => {\n updateAuthState({authState: AUTH_STATE.RESET_PASSWORD, authData: {username}});\n };\n\n const switchStateToSignUp = () => {\n updateAuthState({authState: AUTH_STATE.SIGN_UP, authData: {}});\n };\n\n const switchStateToSignIn = (username) => {\n updateAuthState({authState: AUTH_STATE.SIGN_IN, authData: {username}});\n };\n\n const switchStateToConfirmSignUp = (username) => {\n updateAuthState({authState: AUTH_STATE.CONFIRM_SIGN_UP, authData: {username}});\n };\n\n return (\n
    \n \n\n <AuthButtons authState={authStateComponent} next={next} state={state} />\n\n <SignIn\n authState={authStateComponent}\n authData={authData}\n switchStateToForgotPassword={switchStateToForgotPassword}\n switchStateToResetPassword={switchStateToResetPassword}\n onSignIn={onSignedIn}\n // rework\n // switchStateToSignUp={this.switchStateToSignUp}\n />\n\n <ForgotPassword\n authState={authStateComponent}\n // authData={authData} check that field\n switchStateToResetPassword={switchStateToResetPassword}\n />\n\n <ResetPassword\n authState={authStateComponent}\n authData={authData}\n switchStateToSignIn={switchStateToSignIn}\n />\n\n <SignUp\n authState={authStateComponent}\n state={state}\n switchStateToConfirmSignUp={switchStateToConfirmSignUp}\n />\n\n <ConfirmSignUp authState={authStateComponent} authData={authData} />\n\n <Footer\n authState={authStateComponent}\n authData={authData}\n switchStateToSignIn={switchStateToSignIn}\n switchStateToSignUp={switchStateToSignUp}\n />\n </div>\n );\n}\n","import {isNil} from 'app/util/isNil';\n\nconst DIVIDER = '/';\n\nfunction isDivider(character?: string): boolean {\n return character === DIVIDER;\n}\n\nfunction trimEndSlash(string: string): string {\n if (!isDivider(string[string.length - 1])) {\n return string;\n }\n\n return string.slice(0, -1);\n}\n\nfunction trimStartSlash(string: string): string {\n if (!isDivider(string[0])) {\n return string;\n }\n\n return string.substr(1);\n}\n\nfunction trimAllSlashes(string: string): string {\n return trimEndSlash(trimStartSlash(string));\n}\n\nfunction joinTwo(url1: string, url2: string): string {\n if (url1 === '') {\n return url2;\n }\n\n return trimEndSlash(url1) + '/' + trimAllSlashes(url2);\n}\n\nexport const Url = {\n join(...urls: any[]): string {\n if (urls.length === 1) {\n return urls[0];\n }\n\n return urls.reduce((acc, url) => {\n if (!isNil(url)) {\n return joinTwo(acc, String(url));\n }\n\n return acc;\n }, '');\n },\n};\n","import {\n join,\n pipe,\n prop,\n reduce,\n sortBy,\n toPairs,\n} from 'ramda';\n\n// ie ?,=,&,/ etc\nfunction containsEncodedComponents(string: string) {\n return decodeURI(string) !== decodeURIComponent(string);\n}\n\nfunction processValue(value: string) {\n if (containsEncodedComponents(value)) {\n return value;\n }\n\n return encodeURIComponent(value);\n}\n\nexport function queryStringSorted(json?: Record<string, any>): string {\n if (!json) {\n return '';\n }\n\n return pipe(\n toPairs,\n // @ts-expect-error\n sortBy(prop(0)),\n reduce((acc: string[], [key, value]) => {\n if (typeof value !== 'undefined') {\n acc.push(`${key}=${processValue(value)}`);\n }\n\n return acc;\n }, []),\n join('&'),\n )(json) as string;\n}\n","/**\n * {@link https://www.iana.org/assignments/media-types/media-types.xhtml}\n */\nenum MediaType {\n Json = 'application/json',\n FormData = 'multipart/form-data',\n XWwwFormUrlencoded = 'application/x-www-form-urlencoded',\n}\n\nexport {\n MediaType,\n};\n","/* eslint-disable max-classes-per-file */\n/* eslint-disable @typescript-eslint/member-ordering, @typescript-eslint/no-this-alias */\nimport axios from 'axios';\nimport {isEmpty, mergeRight, omit} from 'ramda';\nimport {Url} from 'app/api/util/Url';\nimport {queryStringSorted} from 'app/api/util/queryStringSorted';\nimport {MediaType} from 'app/api/constants';\nimport {Cache} from 'app/util/Cache';\nimport {Api} from 'app/api/Api';\nimport {AjaxErrorCallback, Endpoints, GetAbortCallback} from 'app/api/types';\nimport {isString} from 'app/util/typeGuards';\n\n/**\n * HTTP request methods\n * {@link https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods}\n */\nenum RequestMethod {\n Get = 'GET',\n Post = 'POST',\n Put = 'PUT',\n Patch = 'PATCH',\n Delete = 'DELETE',\n}\n\ntype ChainParams = {\n parent: Api | Chain;\n endpoints: Endpoints;\n cache?: Cache;\n onAjaxError?: AjaxErrorCallback;\n};\n\nexport class Chain {\n parent: Api | Chain | Endpoint;\n endpoints: Endpoints;\n cache?: Cache;\n protected readonly onAjaxError?: AjaxErrorCallback;\n\n constructor({parent, endpoints, cache, onAjaxError}: ChainParams) {\n this.parent = parent;\n this.endpoints = endpoints;\n this.cache = cache;\n this.onAjaxError = onAjaxError;\n\n this._generateEndpoints();\n }\n\n _generateEndpoints() {\n for (const [endpointName, endpointOptions] of Object.entries(this.endpoints)) {\n if (endpointName in this) {\n throw new Error(\n `Endpoint name \"${endpointName}\" conflicts with class method or property name`,\n );\n }\n\n this[endpointName] = (id, params) => {\n const childEndpoints = omit(['__url__'], endpointOptions);\n const customUrl = endpointOptions.__url__;\n const cache = endpointOptions.__nocache__ ? undefined : this.cache;\n const noTeam = endpointOptions.__noteam__ === true;\n const protocol = endpointOptions.__protocol__ as string;\n\n return new Endpoint({\n name: endpointName,\n id,\n params,\n endpoints: childEndpoints,\n parent: this,\n customUrl,\n cache,\n noTeam,\n protocol,\n onAjaxError: this.onAjaxError,\n });\n };\n }\n }\n\n traverseUp(fn) {\n let node: any = this;\n\n while (node) {\n fn(node);\n node = node.parent;\n }\n }\n}\n\ntype RequestData = Record<string, any> | string;\n\ntype RequestOptions = {\n contentType?: string | false;\n headers?: Record<string, any>;\n getAbort?: GetAbortCallback;\n};\n\ninterface EndpointParams {\n name: string;\n id: any;\n params: any;\n parent: any;\n endpoints: Endpoints;\n customUrl: any;\n cache?: Cache;\n noTeam?: boolean;\n protocol?: string;\n onAjaxError?: AjaxErrorCallback;\n}\n\nclass Endpoint extends Chain {\n name: string;\n customUrl: string;\n redrawAfterRequest: boolean;\n protocol?: string;\n noTeam?: boolean;\n\n _id: any;\n params: any;\n\n constructor({\n name,\n id,\n params,\n parent,\n endpoints,\n customUrl,\n cache,\n noTeam,\n protocol,\n onAjaxError,\n }: EndpointParams) {\n super({\n parent,\n endpoints,\n cache,\n onAjaxError,\n });\n\n this.name = name;\n this.customUrl = customUrl;\n this.noTeam = noTeam;\n this.protocol = protocol;\n\n if (id instanceof Object) {\n params = id;\n id = undefined;\n }\n\n this._id = id;\n this.params = params;\n\n this.redrawAfterRequest = true;\n\n this.get = this.get.bind(this);\n this.post = this.post.bind(this);\n this.put = this.put.bind(this);\n this.delete = this.delete.bind(this);\n }\n\n _getUrlPart(): string {\n return Url.join(this.customUrl || this.name, this._id);\n }\n\n url(): string {\n let url = '';\n let paramsAcc = {};\n\n this.traverseUp((node) => {\n url = Url.join(\n node._getUrlPart({\n noTeam: this.noTeam,\n protocol: this.protocol,\n }),\n url,\n );\n paramsAcc = mergeRight(paramsAcc, node.params || {});\n });\n\n if (!isEmpty(paramsAcc)) {\n const queryString = this.queryStringSorted(paramsAcc);\n if (queryString) {\n url += `?${queryString}`;\n }\n }\n\n return url;\n }\n\n private async fetchRequest(\n method: RequestMethod,\n data?: RequestData,\n options: RequestOptions = {},\n ): Promise<unknown> {\n const {contentType = MediaType.Json, headers = {}, getAbort} = options;\n\n let abortController;\n\n if (getAbort) {\n abortController = new AbortController();\n getAbort(() => {\n abortController.abort();\n\n if (method === RequestMethod.Get && this.cache) {\n // To prevent cache cancelled request\n this.cache.unset(`${this.url()}?${data as string}`);\n }\n });\n }\n\n let body;\n let url = this.url();\n if (method === RequestMethod.Get) {\n if (isString(data) && data !== '') {\n const joinSymbol = url.includes('?') ? '&' : '?';\n url = `${url}${joinSymbol}${data}`;\n }\n } else {\n body = isString(data) ? data : JSON.stringify(data);\n }\n\n return new Promise((resolve, reject) => {\n axios({\n method,\n url,\n data: body,\n headers: {\n ...headers,\n 'Content-Type': contentType === false ? undefined : contentType,\n } as any,\n signal: getAbort ? abortController.signal : undefined,\n })\n .then((response) => {\n resolve(response.data);\n })\n .catch((error) => {\n if (axios.isCancel(error)) {\n return;\n }\n\n try {\n this.onAjaxError?.(error.response);\n } catch (err: unknown) {\n console.error('onAjaxError', err);\n }\n\n reject(error.response);\n });\n });\n }\n\n async get(data?: RequestData, options?: RequestOptions): Promise<any> {\n const queryString = typeof data === 'string' ? data : this.queryStringSorted(data);\n\n const getResponse = async () => this.fetchRequest(RequestMethod.Get, queryString, options);\n\n if (this.cache) {\n return this.cache.getOrElse(`${this.url()}?${queryString}`, getResponse);\n }\n\n return getResponse();\n }\n\n async post(data?: RequestData, options?: RequestOptions): Promise<any> {\n return this.fetchRequest(RequestMethod.Post, data, options);\n }\n\n async put(data?: RequestData, options?: RequestOptions): Promise<any> {\n return this.fetchRequest(RequestMethod.Put, data, options);\n }\n\n async delete(data?: RequestData, options?: RequestOptions): Promise<any> {\n return this.fetchRequest(RequestMethod.Delete, data, options);\n }\n\n async postForm(data: Record<string, any>): Promise<any> {\n return this.post(this.queryStringSorted(data), {\n contentType: MediaType.XWwwFormUrlencoded,\n });\n }\n\n queryStringSorted(data?: Record<string, any>): string {\n return queryStringSorted(data);\n }\n}\n","import {Chain} from 'app/api/Chain';\nimport {Url} from 'app/api/util/Url';\nimport {Cache} from 'app/util/Cache';\nimport {Api} from 'app/api/Api';\nimport {AjaxErrorCallback} from 'app/api/types';\n\ninterface Params {\n name: string;\n version?: string;\n parent: Api;\n endpoints: Record<string, any>;\n cache?: Cache;\n onAjaxError?: AjaxErrorCallback;\n}\n\nexport class Service extends Chain {\n name: string;\n version?: string;\n\n constructor({\n name,\n version,\n parent,\n endpoints,\n cache,\n onAjaxError,\n }: Params) {\n super({\n parent,\n endpoints,\n cache,\n onAjaxError,\n });\n\n this.name = name;\n this.version = version;\n }\n\n _getUrlPart({noTeam}: {noTeam?: boolean} = {}) {\n let url;\n\n if (this.version) {\n url = Url.join(this.name, 'api', `v${this.version}`);\n } else {\n url = Url.join(this.name);\n }\n\n if (!noTeam && (this.parent as Api).getCurrentTeamId()) {\n url = Url.join(url, 'team', (this.parent as Api).getCurrentTeamId());\n }\n\n return url;\n }\n}\n","const HOURS_IN_DAY = 24;\nconst MINUTES_IN_HOUR = 60;\nconst SECONDS_IN_MINUTE = 60;\nconst MILLISECONDS_IN_SECOND = 1000;\n\n// Days\nconst daysToHours = (days: number): number => days * HOURS_IN_DAY;\n\nconst daysToSeconds = (days: number): number => minutesToSeconds(hoursToMinutes(daysToHours(days)));\n\n// Hours\nconst hoursToMinutes = (hours: number): number => hours * MINUTES_IN_HOUR;\n\nconst hoursToSeconds = (hours: number) => hoursToMinutes(hours) * SECONDS_IN_MINUTE;\n\n// Minutes\nconst minutesToHours = (minutes: number): number => minutes / MINUTES_IN_HOUR;\n\nconst minutesToSeconds = (minutes: number): number => minutes * SECONDS_IN_MINUTE;\n\nconst minutesToMilliseconds = (minutes: number): number => secondsToMilliseconds(minutesToSeconds(minutes));\n\n// Seconds\nconst secondsToHours = (seconds: number): number => minutesToHours(secondsToMinutes(seconds));\n\nconst secondsToMinutes = (seconds: number): number => seconds / SECONDS_IN_MINUTE;\n\nconst secondsToMilliseconds = (seconds: number): number => seconds * MILLISECONDS_IN_SECOND;\n\n// Milliseconds\nconst millisecondsToSeconds = (milliseconds: number): number => milliseconds / MILLISECONDS_IN_SECOND;\n\nexport {\n daysToHours,\n daysToSeconds,\n\n hoursToMinutes,\n hoursToSeconds,\n\n minutesToHours,\n minutesToSeconds,\n minutesToMilliseconds,\n\n secondsToHours,\n secondsToMinutes,\n secondsToMilliseconds,\n\n millisecondsToSeconds,\n};\n","import {minutesToMilliseconds} from 'app/util/timeConverter';\nimport {TimeStampMilliseconds} from 'app/types/common';\n\nconst DEFAULT_GARBAGE_COLLECTION_TIMEOUT = minutesToMilliseconds(5);\n\nexport class Cache {\n protected expireMs: number;\n protected garbageCollectionTimeout: number;\n protected storage: Map<string, any> = new Map();\n protected garbageCollectionTimeoutId: number;\n\n constructor(expireMs, garbageCollectionTimeout = DEFAULT_GARBAGE_COLLECTION_TIMEOUT) {\n this.expireMs = expireMs;\n this.garbageCollectionTimeout = garbageCollectionTimeout;\n\n this.garbageCollectionTimeoutId = window.setTimeout(() => {\n this.garbageCollection();\n }, this.garbageCollectionTimeout);\n }\n\n get(key: string): any {\n if (this.storage.get(key) && this.isExpired(Date.now(), key)) {\n this.unset(key);\n return undefined;\n }\n\n if (this.storage.get(key)) {\n return this.storage.get(key).value;\n }\n\n return undefined;\n }\n\n set(key: string, value: any) {\n this.storage.set(key, {\n time: Date.now(),\n value,\n });\n }\n\n unset(key: string) {\n this.storage.delete(key);\n }\n\n getOrElse(key: string, elseValue: () => any): any {\n if (!this.storage.has(key) || this.isExpired(Date.now(), key)) {\n this.set(key, elseValue());\n }\n\n return this.get(key);\n }\n\n length(): number {\n return this.storage.size;\n }\n\n destroy() {\n window.clearTimeout(this.garbageCollectionTimeoutId);\n }\n\n private isExpired(now: TimeStampMilliseconds, key: string): boolean {\n return (now - this.storage.get(key).time) > this.expireMs;\n }\n\n private removeOldValues() {\n const now = Date.now();\n\n for (const [key] of this.storage) {\n if (this.isExpired(now, key)) {\n this.unset(key);\n }\n }\n }\n\n private garbageCollection() {\n this.removeOldValues();\n this.garbageCollectionTimeoutId = window.setTimeout(() => {\n this.garbageCollection();\n }, this.garbageCollectionTimeout);\n }\n}\n","const enum ApiResponseStatus {\n Ok = 'ok',\n Error = 'error',\n}\n\n/**\n * {@link https://developer.mozilla.org/en-US/docs/Web/HTTP/Status}\n */\nconst enum ApiResponseNumeralStatus {\n Ok = 200,\n NoContent = 204,\n Unauthorized = 401,\n PaymentRequired = 402,\n Forbidden = 403,\n NotFound = 404,\n MethodNotAllowed = 405,\n Conflict = 409,\n PreconditionFailed = 412,\n}\n\nenum TeamMemberStatus {\n Pending = 'pending',\n Member = 'member',\n}\n\nexport {ApiResponseStatus, ApiResponseNumeralStatus, TeamMemberStatus};\n","import EventEmitter from 'eventemitter3';\n\nclass DispatcherClass {\n private readonly _impl = new EventEmitter();\n private _currentMaxListeners = 64;\n\n _verifyListenersCount() {\n const eventsListeners = this._impl.eventNames()\n .map(name => ({\n count: this._impl.listenerCount(name),\n name,\n }))\n .sort((a, b) => b.count - a.count);\n\n const eventWithMaxListeners = eventsListeners.find(({count}) => count >= this._currentMaxListeners);\n\n if (eventWithMaxListeners) {\n this._currentMaxListeners *= 2;\n console.warn(`\"${eventWithMaxListeners.name as string}\" event listeners exceeded configured limit (${eventWithMaxListeners.count})`);\n console.warn('Overall events stats:');\n console.warn(JSON.stringify(eventsListeners, null, 2));\n }\n }\n\n on(eventName: string, listener: EventEmitter.ListenerFn) {\n this._verifyListenersCount();\n this._impl.on(eventName, listener);\n }\n\n removeListener(eventName: string, listener: EventEmitter.ListenerFn) {\n this._verifyListenersCount();\n this._impl.removeListener(eventName, listener);\n }\n\n emit(eventName: string, payload?: any) {\n this._impl.emit(eventName, payload);\n }\n}\n\nconst Dispatcher = new DispatcherClass();\n\nexport {Dispatcher};\n","import {Api} from 'app/api/Api';\nimport {ApiResponseNumeralStatus} from 'app/data/Status';\n// import {queryStringSorted} from 'app/api/util/queryStringSorted';\nimport {Dispatcher} from 'app/data/Dispatcher';\n\n/*\n * Workaround for tests to work because their code built not in webpack\n * and uses env variables directly\n */\nfunction getBaseUrl() {\n if (typeof CIRRUS_API_BASE_URL !== 'undefined') {\n return CIRRUS_API_BASE_URL;\n }\n\n return process.env.CIRRUS_API_BASE_URL!;\n}\n\nconst cirrusApi = new Api({\n baseUrl: getBaseUrl(),\n});\n\ncirrusApi.addCachedService('front', '1t', {\n billing: {\n plan: {},\n plans: {},\n v2: {\n econnect: {\n plans: {\n __noteam__: true,\n },\n },\n unify: {\n prices: {\n __noteam__: true,\n },\n },\n files: {\n __url__: 'file-management',\n prices: {\n __noteam__: true,\n },\n },\n },\n },\n devices: {\n alerts: {\n dictionary: {},\n },\n devicenumbers: {},\n task: {\n live: {\n start: {},\n },\n },\n batch_task: {},\n commands: {},\n preview: {},\n hls: {\n playlist: {},\n },\n snapshot: {\n __url__: 'state.jpg',\n },\n source: {\n __url__: '/',\n preview: {},\n snapshot: {\n __url__: 'state.jpg',\n },\n },\n sources: {},\n state: {},\n storage: {},\n afu: {},\n network: {},\n stream: {},\n unpair: {},\n streams: {\n start: {},\n stop: {},\n },\n transcribe: {\n configuration: {},\n id: {},\n start: {},\n stop: {},\n pause: {},\n resume: {},\n },\n request: {\n channel_previews: {},\n source_previews: {},\n audio_levels: {},\n },\n presets: {\n cloud: {},\n local: {\n push: {},\n remove: {\n __url__: 'delete',\n },\n },\n },\n rename: {},\n settings: {},\n remote_login: {},\n vpearls: {},\n vpearl: {\n resume: {},\n stop: {},\n },\n update: {\n status: {},\n },\n system: {\n status: {},\n },\n ssrt: {\n inputs: {},\n },\n firmware: {\n update: {\n status: {},\n },\n },\n cms: {},\n pairing_stick: {},\n },\n presets: {},\n groups: {\n device: {\n __url__: '/',\n },\n devices: {\n move: {},\n },\n batch: {\n remove: {\n __url__: 'delete',\n },\n ungroup: {\n __url__: 'remove',\n },\n },\n },\n streams: {\n attach: {},\n test: {},\n start: {},\n stop: {},\n destinations: {},\n },\n transcribing: {\n configuration: {},\n result: {},\n sessions: {\n clear: {},\n srt: {},\n txt: {},\n },\n },\n oauth: {\n logout: {\n __noteam__: true,\n },\n google: {\n __noteam__: true,\n },\n internal_cognito: {\n __noteam__: true,\n },\n },\n users: {\n me: {\n device_alerts: {},\n team: {},\n notifications: {\n accept: {},\n decline: {},\n },\n alerts: {},\n all_device_alerts: {},\n unread_device_alerts: {},\n acknowledge_device_alerts: {},\n },\n agreement: {},\n policy: {},\n subscriptions: {},\n },\n\n teams: {\n users: {\n master: {},\n },\n billing: {\n plan: {},\n invoice: {},\n payment_info: {},\n coupon: {\n validate: {},\n activate: {},\n },\n switch_to_ibb: {},\n cancel_switch_to_ibb: {},\n v2: {\n econnect: {\n plan: {\n resume: {},\n },\n invoice: {\n history: {},\n },\n coupon: {},\n },\n edge: {\n invoice: {\n history: {},\n },\n },\n invoice: {\n pdf: {},\n },\n unify: {\n plan: {},\n subscribe: {},\n unsubscribe: {},\n },\n files: {\n __url__: 'file-management',\n plan: {},\n invoice: {\n history: {},\n },\n },\n },\n },\n tokens: {\n new: {},\n },\n },\n versions: {\n __noteam__: true,\n },\n connections: {\n connect: {\n box: {\n storage: {},\n },\n dropbox: {\n storage: {},\n },\n google: {\n storage: {},\n stream: {},\n },\n facebook: {\n stream: {},\n },\n twitch: {\n stream: {},\n },\n },\n },\n\n storage: {\n test: {},\n },\n\n team: {\n devices: {\n __noteam__: true,\n devicenumbers: {\n __noteam__: true,\n },\n vpearl: {\n __noteam__: true,\n },\n },\n groups: {\n __noteam__: true,\n device: {\n __url__: '/',\n __noteam__: true,\n },\n },\n },\n\n econnect: {\n pair: {\n ms: {\n tenant: {},\n },\n zoom: {\n user: {},\n },\n },\n\n shareable_link: {},\n\n meetings: {\n connect: {},\n disconnect: {},\n participants: {\n stream: {\n settings: {\n mute: {},\n },\n status: {},\n start: {},\n stop: {},\n },\n },\n injection: {\n stream: {\n settings: {\n mute: {},\n },\n status: {},\n start: {},\n stop: {},\n },\n },\n password: {},\n account: {\n __url__: 'set-account',\n },\n permissions: {},\n },\n\n calls: {\n __url__: 'hosted-calls',\n teams: {\n __url__: 'ms-teams',\n },\n },\n\n ms_tenants: {\n __url__: 'ms-tenants',\n health: {},\n },\n zoomAccounts: {\n __url__: 'zoom-accounts',\n share: {},\n },\n },\n\n ws: {\n __protocol__: 'wss',\n },\n\n /* cms integration part */\n cms: {\n v2: {\n schedule: {\n refresh: {},\n\n events: {\n action: {\n start: {},\n stop: {},\n pause: {},\n resume: {},\n extend: {},\n confirm: {},\n },\n confirm: {\n devices: {},\n },\n },\n\n devices: {\n events: {},\n refresh: {},\n current_event: {},\n },\n\n current_events: {},\n },\n },\n devices: {\n events: {\n control: {\n start: {},\n stop: {},\n pause: {},\n resume: {},\n extend: {},\n },\n },\n schedule: {\n refresh: {},\n },\n },\n schedule: {\n refresh: {},\n current: {},\n },\n eventrules: {},\n },\n\n filemanager: {\n v1: {\n files: {\n remove: {\n __url__: 'delete',\n },\n download: {},\n },\n devices: {\n files: {},\n },\n events: {\n files: {},\n },\n },\n },\n /* eslint-enable camelcase */\n});\n\ncirrusApi.addCachedService('maintenance', '1', {\n windows: {\n __noteam__: true,\n },\n});\n\nconst {front} = cirrusApi as any;\nconst {maintenance} = cirrusApi as any;\n\ncirrusApi.onAjaxError((error) => {\n switch (error.status) {\n case ApiResponseNumeralStatus.Unauthorized: {\n const params = new URLSearchParams();\n params.append('next', window.location.pathname + window.location.hash);\n\n const url = new URL(window.location.origin);\n url.pathname = '/login.html';\n url.hash = `/login?${params.toString()}`;\n window.location.assign(url);\n break;\n }\n\n case ApiResponseNumeralStatus.MethodNotAllowed:\n // TODO: WCX-1176: assuming application is in the root\n if (error?.data?.ErrorData?.NewTeam) {\n window.location.href = `${window.location.origin}/${error.data.ErrorData.NewTeam}`;\n } else {\n Dispatcher.emit('logout');\n front\n .oauth()\n .logout()\n .get()\n .finally(() => {\n window.location.assign('/login.html');\n });\n }\n\n break;\n default:\n console.log('Unhandled err', error);\n break;\n }\n});\n\nexport {cirrusApi, front, maintenance};\n","/* eslint-disable @typescript-eslint/member-ordering */\nimport EventEmitter from 'eventemitter3';\nimport {Service} from 'app/api/Service';\nimport {Cache} from 'app/util/Cache';\nimport {Url} from 'app/api/util/Url';\nimport {AjaxErrorCallback, Endpoints} from 'app/api/types';\n\ntype Params = {\n baseUrl: string;\n};\n\nexport class Api {\n baseUrl: string;\n _teamId: string;\n emitter: EventEmitter;\n\n private readonly ajaxErrorHandlers = new Set<AjaxErrorCallback>();\n\n constructor({baseUrl}: Params) {\n this.baseUrl = baseUrl;\n\n this._teamId = '';\n\n this.emitter = new EventEmitter();\n }\n\n /*\n * Adds new service configured as a js object. See CirrusApi.ts for example.\n * Each endpoint can be configured with following internal properties:\n * __url__ - use provided url part for endpoint instead of generating it from schema\n * __noteam__ - indicates that this endpoint doesn't need team id added to its url (see #setCurrentTeamId)\n */\n addService(name: string, version: string | undefined, endpoints: Endpoints) {\n this[name] = new Service({\n name,\n version,\n endpoints,\n parent: this,\n onAjaxError: (error) => {\n this.handleAjaxError(error);\n },\n });\n }\n\n /*\n * Same as #addService, but caches all queries results. Additional configuration:\n * __nocache__ - don't cache queries to this endpoint\n */\n addCachedService(\n name: string,\n version: string | undefined,\n endpoints: Endpoints,\n ) {\n this[name] = new Service({\n name,\n version,\n endpoints,\n parent: this,\n cache: new Cache(1000),\n onAjaxError: (error) => {\n this.handleAjaxError(error);\n },\n });\n }\n\n _getUrlPart({protocol}: {protocol?: string} = {}) {\n if (!protocol) {\n return Url.join(this.baseUrl);\n }\n\n if (this.baseUrl.includes('://')) {\n const [, host] = this.baseUrl.split('://');\n return Url.join(`${protocol}://${host}`);\n }\n\n if (this.baseUrl === '/') {\n return Url.join(`${protocol}://${window.location.host}${this.baseUrl}`);\n }\n\n // TODO: Throw error?\n return Url.join(this.baseUrl);\n }\n\n getCurrentTeamId() {\n return this._teamId;\n }\n\n /**\n * Cirrus API designed to have dynamic team id part in its url. Set\n * current team id here to make all queries contain this part.\n * @param {string} teamId\n */\n setCurrentTeamId(teamId: string) {\n this._teamId = teamId;\n }\n\n onAjaxError(listener: AjaxErrorCallback) {\n this.ajaxErrorHandlers.add(listener);\n }\n\n private handleAjaxError(error: any) {\n this.ajaxErrorHandlers.forEach((ajaxErrorHandler) =>\n ajaxErrorHandler(error),\n );\n }\n}\n","import React, {useCallback, useState} from 'react';\nimport classNames from 'classnames';\nimport ReactModal from 'react-modal';\nimport {Button} from 'app/components/sharedReactComponents/Button';\nimport {Icons} from 'app/util/icons';\nimport {SIZE, VARIANT} from 'app/constants';\nimport {Callback, ClassName} from 'app/types/common';\n\nenum ModalComponentScroll {\n Body = 'body',\n Paper = 'paper',\n}\n\nconst ModalCloseButton: React.VFC<{onClose: Callback}> = ({onClose}) => {\n return (\n <Button\n className=\"cr-modal-new__close-button\"\n dataId=\"modal_close_cross_button\"\n variant={VARIANT.TEXT}\n onClick={onClose}\n >\n {Icons.close().reactComponent()}\n </Button>\n );\n};\n\ninterface Props extends ClassName {\n fullWidth?: boolean;\n maxWidth?: SIZE;\n scroll?: ModalComponentScroll;\n showCloseButton?: boolean;\n shouldCloseOnEsc: boolean;\n shouldCloseOnOverlayClick: boolean;\n onClose: Callback;\n}\n\nconst ModalComponent: React.FC<Props> = ({\n className,\n children,\n scroll = ModalComponentScroll.Body,\n fullWidth = false,\n maxWidth = SIZE.M,\n showCloseButton = true,\n shouldCloseOnEsc,\n shouldCloseOnOverlayClick,\n onClose,\n}) => {\n const [opened, setOpened] = useState(true);\n\n const handleRequestClose = useCallback(() => {\n setOpened(false);\n }, []);\n\n return (\n <ReactModal\n className={classNames('cr-modal-new__content', className)}\n portalClassName={classNames(\n 'cr-modal-new',\n fullWidth && 'cr-modal-new--full-width',\n `cr-modal-new--max-width-${maxWidth}`,\n `cr-modal-new--scroll-${scroll}`\n )}\n overlayClassName=\"cr-modal-new__overlay\"\n bodyOpenClassName=\"cr-modal-new__body--opened\"\n data={{\n id: 'modal_content',\n }}\n isOpen={opened}\n shouldCloseOnEsc={shouldCloseOnEsc}\n shouldCloseOnOverlayClick={shouldCloseOnOverlayClick}\n ariaHideApp={false}\n onRequestClose={handleRequestClose}\n onAfterClose={onClose}\n >\n {children}\n\n {showCloseButton && (\n <ModalCloseButton onClose={handleRequestClose}/>\n )}\n </ReactModal>\n );\n};\n\nexport {\n ModalComponent,\n ModalComponentScroll,\n};\n","enum PORTAL_ELEMENT_ID {\n MODAL = 'modal-container',\n NAVBAR_DEVICE_GROUP_FILTER = 'device-groups-filter-portal',\n NAVBAR_SHORT_DEVICE_GROUP_FILTER = 'short-menu-device-groups-filter-portal',\n ASIDE = 'aside-container',\n}\n\nexport {PORTAL_ELEMENT_ID};\n","import {render, unmountComponentAtNode} from 'react-dom';\nimport React, {createElement, FC, ReactElement, ReactNode, VFC} from 'react';\nimport {ModalComponent, ModalComponentScroll} from 'app/components/sharedReactComponents/Modal/ModalComponent';\nimport {Button} from 'app/components/sharedReactComponents/Button';\nimport {\n SIZE,\n THEME,\n VARIANT,\n} from 'app/constants';\nimport {PORTAL_ELEMENT_ID} from 'app/constants/portalElementId';\nimport classNames from 'classnames';\nimport {Callback, ClassName} from 'app/types/common';\n\ntype ModalShowProps = {\n className?: string;\n children: ReactNode;\n fullWidth?: boolean;\n maxWidth?: SIZE;\n scroll?: ModalComponentScroll;\n showCloseButton?: boolean;\n shouldCloseOnEsc?: boolean;\n shouldCloseOnOverlayClick?: boolean;\n onClose?: Callback;\n};\n\nconst Modal = {\n show({\n className,\n children,\n fullWidth,\n maxWidth,\n scroll,\n showCloseButton,\n shouldCloseOnEsc = true,\n shouldCloseOnOverlayClick = true,\n onClose,\n }: ModalShowProps) {\n render(createElement(ModalComponent, {\n className,\n fullWidth,\n maxWidth,\n scroll,\n showCloseButton,\n shouldCloseOnEsc,\n shouldCloseOnOverlayClick,\n onClose: () => {\n if (onClose) {\n onClose();\n }\n\n Modal.hide();\n },\n }, children), document.querySelector(`#${PORTAL_ELEMENT_ID.MODAL}`));\n },\n\n hide() {\n const element = document.querySelector(`#${PORTAL_ELEMENT_ID.MODAL}`);\n if (element) {\n unmountComponentAtNode(element);\n }\n },\n};\n\nwindow.addEventListener('hashchange', Modal.hide);\n\nconst ModalContainer: FC<ClassName> = ({\n className,\n children,\n}) => {\n return (\n <div className={classNames('cr-modal-new__container', className)}>\n {children}\n </div>\n );\n};\n\ntype ModalTitleProps = ClassName & {\n icon?: ReactElement;\n};\n\nconst ModalTitle: FC<ModalTitleProps> = ({\n className,\n children,\n icon,\n}) => {\n return (\n <header className={classNames('cr-modal-new__title', className)}>\n {icon && (\n <div className=\"cr-modal-new__title-icon\">\n {icon}\n </div>\n )}\n {children}\n </header>\n );\n};\n\nconst ModalTitleHighlightedItem: FC = ({children}) => {\n return (\n <span className=\"cr-modal-new__title-highlighted-item\">\n {children}\n </span>\n );\n};\n\nconst ModalBody: FC<ClassName> = ({\n className,\n children,\n}) => {\n return (\n <div className={classNames('cr-modal-new__body', className)}>\n {children}\n </div>\n );\n};\n\nconst ModalScrollableContentWrapper: FC = ({children}) => {\n return (\n <div className=\"cr-modal-new__scrollable-content-wrapper\">\n {children}\n </div>\n );\n};\n\nconst ModalFooter: FC<ClassName> = ({\n className,\n children,\n}) => {\n return (\n <footer className={classNames('cr-modal-new__footer', className)}>\n {children}\n </footer>\n );\n};\n\ninterface ButtonProps {\n autoFocus?: boolean;\n disabled?: boolean;\n}\n\nconst ModalCancelButton: VFC<ButtonProps> = ({\n autoFocus,\n disabled,\n}) => {\n return (\n <Button\n dataId=\"modal_cancel_button\"\n theme={THEME.SECONDARY}\n variant={VARIANT.OUTLINE}\n autoFocus={autoFocus}\n disabled={disabled}\n onClick={Modal.hide}\n >\n Cancel\n </Button>\n );\n};\n\ninterface CloseButtonProps extends ButtonProps {\n theme?: THEME;\n variant?: VARIANT;\n}\n\nconst ModalCloseButton: VFC<CloseButtonProps> = ({\n autoFocus,\n disabled,\n theme = THEME.PRIMARY,\n variant = VARIANT.SOLID,\n}) => {\n return (\n <Button\n dataId=\"modal_close_button\"\n theme={theme}\n variant={variant}\n autoFocus={autoFocus}\n disabled={disabled}\n onClick={Modal.hide}\n >\n Close\n </Button>\n );\n};\n\nexport {\n Modal,\n ModalContainer,\n ModalTitle,\n ModalTitleHighlightedItem,\n ModalBody,\n ModalScrollableContentWrapper,\n ModalFooter,\n ModalCancelButton,\n ModalCloseButton,\n};\n","import React, {ReactNode} from 'react';\nimport {\n Modal,\n ModalContainer,\n} from 'app/components/sharedReactComponents/Modal/Modal';\nimport {SIZE} from 'app/constants';\n\nexport const ModalNotification = {\n show({\n message,\n }: {\n message: ReactNode;\n }) {\n Modal.show({\n className: 'modal-notification',\n showCloseButton: false,\n maxWidth: SIZE.XXL,\n children: (\n <ModalContainer>\n <div className=\"modal-notification__message\">\n {message}\n </div>\n </ModalContainer>\n )\n });\n }\n};\n","import React from 'react';\nimport {ModalNotification} from 'app/components/sharedReactComponents/Modal/ModalNotification';\nimport {ModalContainer} from 'app/components/sharedReactComponents/Modal/Modal';\n\nexport const InvitedModalNotification = {\n show(invited: boolean) {\n if (invited) {\n ModalNotification.show({\n message: (\n <ModalContainer>\n You've been invited to Epiphan Cloud web application.<br/>\n\n {' '}\n\n Please click anywhere to proceed to login.\n </ModalContainer>\n ),\n });\n }\n }\n};\n","import {ModalNotification} from 'app/components/sharedReactComponents/Modal/ModalNotification';\nimport {Icons} from 'app/util/icons';\nimport {SIZE, THEME} from 'app/constants';\n\nexport const LoggingErrorModalNotification = {\n show() {\n ModalNotification.show({\n message: Icons.exclamation()\n .label('There was an error while logging you in. Please try again.')\n .theme(THEME.DANGER)\n .size(SIZE.XL)\n .reactComponent()\n });\n }\n};\n","const Location = {\n assign(url: string) {\n window.location.assign(url);\n },\n\n replace(url: string) {\n window.location.replace(url);\n },\n\n getHash() {\n return window.location.hash;\n },\n\n getOrigin() {\n return window.location.origin;\n },\n\n getHostName() {\n return window.location.hostname;\n },\n\n getSearch() {\n return window.location.search;\n },\n\n onChange(callback: () => void) {\n window.addEventListener('hashchange', callback);\n },\n};\n\nexport {Location};\n","import {\n __,\n find,\n fromPairs,\n identity,\n lensIndex,\n map,\n over,\n partition,\n pipe,\n toPairs,\n zip,\n} from 'ramda';\nimport {isNil} from 'app/util/isNil';\nimport {Url} from 'app/api/util/Url';\nimport {queryStringSorted} from 'app/api/util/queryStringSorted';\nimport {Callback} from 'app/types/common';\nimport {RouterStateType} from 'app/router/types';\nimport {Location} from 'app/router/Location';\n\ntype RouterRouteType = {\n url: string;\n title: string;\n};\n\ntype RouterDefaultRouteType<T extends string> = {\n name: T;\n params: Record<string, any>;\n};\n\ninterface RouterOptions<T extends string> {\n routes: Record<T, RouterRouteType>;\n defaultRoute: RouterDefaultRouteType<T>;\n}\n\nexport class Router<T extends string> {\n routes: Record<T, RouterRouteType>;\n defaultRoute: RouterDefaultRouteType<T>;\n\n changeCallbacks: Set<Callback> = new Set();\n changeCurrentTeamCallbacks: Set<Callback> = new Set();\n\n state: RouterStateType<T>;\n\n protected onChangeCallback?: Callback;\n\n constructor({\n routes,\n defaultRoute,\n }: RouterOptions<T>) {\n this.routes = routes;\n this.defaultRoute = defaultRoute;\n\n this.state = {\n name: this.defaultRoute.name,\n params: this.defaultRoute.params,\n };\n\n this.updateState = this.updateState.bind(this);\n }\n\n /**\n * Callback fires on route change\n */\n init(onChange?: (state: RouterStateType<T>) => void) {\n this.onChangeCallback = onChange;\n\n Location.onChange(this.updateState);\n\n this.updateState();\n }\n\n updateState() {\n const {\n path,\n query,\n } = this.parseHash();\n const matchingRoute = this.findMatchingRoute(path);\n\n if (isNil(matchingRoute)) {\n this.state = {\n name: this.defaultRoute.name,\n params: this.defaultRoute.params,\n };\n this.go();\n\n return;\n }\n\n this.state = {\n ...matchingRoute,\n query,\n };\n\n this._fireChange();\n\n this.title(this.state.name);\n\n if (typeof this.onChangeCallback === 'function') {\n this.onChangeCallback(this.state);\n }\n\n return this.state;\n }\n\n onChange(callback: Callback) {\n this.changeCallbacks.add(callback);\n }\n\n offChange(callback: Callback) {\n this.changeCallbacks.delete(callback);\n }\n\n _fireChange() {\n this.changeCallbacks.forEach(callback => callback(this.state));\n }\n\n parseHash(): {path: string[]; query?: Record<string, any>} {\n // @ts-expect-error\n const [, pathStr, , queryStr] = /#?\\/?([^?]*)(\\?(.*))?/.exec(Location.getHash());\n\n const path = pathStr.split('/').filter(value => value);\n\n let query;\n if (!isNil(queryStr)) {\n query = queryStr.split('&').reduce((acc, param) => {\n const [key, value] = param.split('=');\n\n acc[key] = value;\n\n return acc;\n }, {});\n }\n\n return {\n path,\n query,\n };\n }\n\n // TODO: Refactor\n routeMatch(url: string, path: string[]) {\n const urlParts = url.split('/');\n\n if (urlParts.length !== path.length) {\n return null;\n }\n\n // @ts-expect-error\n const [paramsPairs, paths] = pipe(\n // @ts-expect-error\n zip(__, path),\n partition(([k]) => (isNil(k) ? null : k[0]) === ':'),\n )(urlParts);\n\n if (paths.some(([key, value]) => key !== value)) {\n return null;\n }\n\n return fromPairs(paramsPairs);\n }\n\n findMatchingRoute(path: string[]) {\n const matchingRoute = pipe(\n toPairs,\n // @ts-expect-error\n map(([name, {url}]) => [name, this.routeMatch(url, path)]),\n // @ts-expect-error\n find(([, v]) => identity(v)),\n )(this.routes);\n\n if (isNil(matchingRoute)) {\n return null;\n }\n\n // @ts-expect-error\n const [name, params] = over(\n // @ts-expect-error\n lensIndex(1),\n pipe(\n toPairs,\n // @ts-expect-error\n map(([k, v]) => [/:(.*)/.exec(k)[1], v]),\n // @ts-expect-error\n fromPairs,\n ),\n )(matchingRoute);\n\n return {\n name,\n params,\n };\n }\n\n title(name: string) {\n document.title = this.routes[name]?.title ?? '';\n }\n\n url(name?: T, params?: Record<string, any>, query?: Record<string, any>) {\n if (isNil(name)) {\n name = this.state.name;\n }\n\n if (isNil(params)) {\n params = this.state.params;\n }\n\n const path = this.routes[name].url\n .split('/')\n .map(part => {\n const partParts = /:(.+)/.exec(part);\n const paramName = partParts ? partParts[1] : null;\n\n if (paramName) {\n // @ts-expect-error\n return params[paramName];\n }\n\n return part;\n })\n .join('/');\n\n return `${Url.join('#', path)}${isNil(query) ? '' : `?${queryStringSorted(query)}`}`;\n }\n\n go(name?: T, params?: Record<string, any>, query?: Record<string, any>) {\n Location.assign(this.url(name, params, query));\n return {};\n }\n\n resetQuery() {\n Location.replace(this.url());\n }\n\n goToTeam(teamId: string, url?: string) {\n this.goToTeamRoute(teamId, url ?? this.url(this.defaultRoute.name));\n }\n\n urlToTeamRoute(teamId: string, url: string) {\n // TODO: WCX-1176: assuming application is in the root\n return Location.getOrigin() + '/' + teamId + url;\n }\n\n goToTeamRoute(teamId: string, url: string) {\n this.changeCurrentTeamCallbacks.forEach(callback => callback(teamId));\n Location.assign(this.urlToTeamRoute(teamId, url));\n }\n\n goToDefaultRoute() {\n this.go(this.defaultRoute.name, this.defaultRoute.params);\n }\n\n onChangeCurrentTeam(cb: Callback) {\n this.changeCurrentTeamCallbacks.add(cb);\n }\n\n offChangeCurrentTeam(cb: Callback) {\n this.changeCurrentTeamCallbacks.delete(cb);\n }\n\n is(name: T) {\n return this.state.name === name;\n }\n}\n","import {Router} from 'app/router/Router';\n\nconst ROUTE_NAME = {\n SIGN_UP: 'signUp',\n SIGN_IN: 'signIn',\n RESET_PASSWORD: 'resetPassword',\n} as const;\n\nconst routes = {\n [ROUTE_NAME.SIGN_UP]: {\n url: 'signup',\n title: 'Sign Up',\n },\n [ROUTE_NAME.SIGN_IN]: {\n url: 'login',\n title: 'Log In',\n },\n [ROUTE_NAME.RESET_PASSWORD]: {\n url: 'reset_password',\n title: 'Reset Password',\n },\n} as const;\n\nexport type LoginRoutes = keyof typeof routes;\n\nconst router = new Router<LoginRoutes>({\n routes,\n defaultRoute: {\n name: ROUTE_NAME.SIGN_IN,\n params: {},\n },\n});\n\nexport {\n router,\n ROUTE_NAME,\n};\n","import {ROUTE_NAME} from 'app/router/login';\nimport {AUTH_STATE, DEFAULT_AUTH_STATE} from 'app/components/Login/LoginForm/constants';\n\nfunction getAuthStateByRouteName(routeName: string) {\n switch (routeName) {\n case ROUTE_NAME.SIGN_UP:\n return AUTH_STATE.SIGN_UP;\n case ROUTE_NAME.SIGN_IN:\n return AUTH_STATE.SIGN_IN;\n case ROUTE_NAME.RESET_PASSWORD:\n return AUTH_STATE.FORGOT_PASSWORD;\n default:\n return DEFAULT_AUTH_STATE;\n }\n}\n\nfunction getRouteNameByAuthState(authState: string) {\n switch (authState) {\n case AUTH_STATE.SIGN_UP:\n case AUTH_STATE.CONFIRM_SIGN_UP:\n return ROUTE_NAME.SIGN_UP;\n case AUTH_STATE.SIGN_IN:\n return ROUTE_NAME.SIGN_IN;\n case AUTH_STATE.FORGOT_PASSWORD:\n case AUTH_STATE.RESET_PASSWORD:\n return ROUTE_NAME.RESET_PASSWORD;\n default:\n return ROUTE_NAME.SIGN_IN;\n }\n}\n\nexport {getAuthStateByRouteName, getRouteNameByAuthState};\n","import {Router} from 'app/router/Router';\n\nconst routes = {\n dashboard: {\n url: 'dashboard',\n title: 'Dashboard',\n },\n devices: {\n url: 'devices',\n title: 'All devices',\n },\n devicesAlerts: {\n url: 'devices/alerts',\n title: 'Alerts',\n },\n deviceDetails: {\n url: 'devices/:deviceId/details',\n title: 'Device info',\n },\n presets: {\n url: 'presets',\n title: 'Configuration presets',\n },\n welcome: {\n url: 'welcome',\n title: 'Pair device',\n },\n oneClickDevicePairing: {\n url: 'p',\n title: 'Pair device',\n },\n agreement: {\n url: 'agreement',\n title: 'Subscription Agreement',\n },\n acceptanceUsePolicy: {\n url: 'acceptance-use-policy',\n title: 'Epiphan Acceptable Use Policy',\n },\n\n team: {\n url: 'team',\n title: 'Team',\n },\n settings: {\n url: 'settings',\n title: 'Settings',\n },\n alerts: {\n url: 'settings/alerts',\n title: 'Manage alerts',\n },\n fileTransfer: {\n url: 'settings/file-transfer',\n title: 'File transfer locations',\n },\n streamingDestinations: {\n url: 'settings/streaming-destinations',\n title: 'Streaming destinations',\n },\n apiTokens: {\n url: 'settings/api-tokens',\n title: 'API tokens',\n },\n accountSettings: {\n url: 'settings/account',\n title: 'Account settings',\n },\n settingBillingUsage: {\n url: 'settings/billing-usage',\n title: 'Billing and Usage',\n },\n connectAccountSettings: {\n url: 'settings/connect',\n title: 'Epiphan Connect',\n },\n transcribeDevices: {\n url: 'livescrypt',\n title: 'LiveScrypt',\n },\n transcribeDeviceDetails: {\n url: 'livescrypt/:deviceId/details',\n title: 'LiveScrypt device details',\n },\n events: {\n url: 'events',\n title: 'Events',\n },\n projects: {\n url: 'unify/projects',\n title: 'Unify projects',\n },\n projectDetails: {\n url: 'unify/projects/:deviceId/details',\n title: 'Unify project details',\n },\n meetings: {\n url: 'connect/meetings',\n title: 'Meetings',\n },\n meetingDetails: {\n url: 'connect/meetings/:meetingId/details',\n title: 'Meeting Details',\n },\n recordings: {\n url: 'recordings',\n title: 'Recordings',\n },\n} as const;\n\nexport type MainRoutes = keyof typeof routes;\n\nconst router = new Router<MainRoutes>({\n routes,\n defaultRoute: {\n name: 'devices',\n params: {},\n },\n});\n\nexport {router};\n","/* eslint-disable no-restricted-syntax */\nimport {SxProps, Theme} from '@mui/material';\nimport {SxObj} from 'app/types/common';\n\ntype SxStyles<T extends Theme = Theme> = boolean | SxObj<T> | ((theme: T) => SxObj<T>);\n\nexport function composeSx<T extends Theme = Theme>(\n sx: SxProps<T> = [],\n): ReadonlyArray<SxStyles<T>> {\n return Array.isArray(sx) ? sx : [sx];\n}\n\ntype OnlySx<T extends Theme = Theme> = Exclude<SxProps<T>, ReadonlyArray<any>>;\ntype SxArray<T extends Theme = Theme> = Array<OnlySx<T>>;\n\nexport function packSx<T extends Theme = Theme>(\n ...styles: (SxProps<T> | false | undefined)[]\n): SxProps<T> {\n const result: SxArray<T> = [];\n\n for (const sx of styles) {\n if (sx) {\n if (Array.isArray(sx)) {\n for (const sub of sx as SxArray<T>) {\n result.push(sub);\n }\n } else {\n result.push(sx as OnlySx<T>);\n }\n }\n }\n return result;\n}\n","import {maintenance, front} from 'app/api/CirrusApi';\nimport {Maintenance, MaintenanceContracts} from 'app/components/entities/maintenance';\n\nexport class MaintenanceApi {\n static async getMaintenance(): Promise<Maintenance.Entity[]> {\n return maintenance.windows().get();\n }\n\n static async getVersion(): Promise<MaintenanceContracts.Version> {\n return front.versions().get();\n }\n}\n","import {mapVersion} from 'app/components/entities/maintenance/mapper/maintenance.mapper';\n\nexport const MaintenanceMapper = {mapVersion};\n","import {MaintenanceContracts} from 'app/components/entities/maintenance';\n\nexport function mapVersion(contract: MaintenanceContracts.Version): string {\n return contract.Release;\n}\n","import React, {ReactElement} from 'react';\nimport dayjs from 'dayjs';\nimport {Link, Stack, Typography, linkClasses} from '@mui/material';\nimport {grey} from '@mui/material/colors';\nimport {router} from 'app/router/main';\nimport {StyleSx, Sx} from 'app/types/common';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {useVersionQuery} from 'app/components/entities/maintenance';\n\nconst rootSx: StyleSx = {\n '&:after, &:before': {content: 'none'},\n [`& .${linkClasses.root}`]: {'&:hover, &:focus': {color: 'secondary.main'}},\n};\n\ntype Props = Sx & {\n align?: 'left' | 'center';\n loggedIn?: boolean;\n showVersion?: boolean;\n showTermsLink?: boolean;\n};\n\nexport function Footer({\n sx,\n align = 'center',\n loggedIn = true,\n showVersion = true,\n showTermsLink = true,\n}: Props) {\n const {data: version} = useVersionQuery(showVersion);\n\n const renderTermsLink = (): ReactElement =>\n loggedIn ? (\n <Link variant=\"body2\" color=\"secondary.main\" underline=\"none\" href={router.url('agreement')}>\n Terms\n </Link>\n ) : (\n <Link\n variant=\"body2\"\n color=\"secondary.main\"\n underline=\"none\"\n href=\"/agreement.html\"\n target=\"_blank\"\n rel=\"noopener\"\n >\n Terms\n </Link>\n );\n\n const year = dayjs().year();\n\n return (\n <Stack\n sx={packSx(rootSx, align === 'center' && {alignItems: 'center'}, sx)}\n component=\"footer\"\n bgcolor={grey[900]}\n >\n <Stack\n py={3}\n px={2}\n width={1032}\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n >\n <Typography variant=\"body2\" component=\"span\" color=\"text.disabled\">\n Epiphan Cloud\n {version && showVersion && (\n <Typography variant=\"inherit\" component=\"span\">\n {' '}\n version <span data-id=\"app-version\">{version}</span>\n </Typography>\n )}\n </Typography>\n\n <Typography variant=\"body2\" component=\"span\" color=\"text.disabled\">\n ™ and © {year} Epiphan Systems Inc. All Rights Reserved\n </Typography>\n\n {showTermsLink && renderTermsLink()}\n\n <Link\n data-id=\"cloud-link\"\n variant=\"body2\"\n color=\"secondary.main\"\n underline=\"none\"\n href=\"https://www.epiphan.com/cloud/\"\n target=\"_blank\"\n rel=\"noopener\"\n >\n About Epiphan Cloud\n </Link>\n\n <Link\n data-id=\"user-guide-link\"\n variant=\"body2\"\n color=\"secondary.main\"\n underline=\"none\"\n href=\"https://www.epiphan.com/userguides/epiphan-cloud/\"\n target=\"_blank\"\n rel=\"noopener\"\n >\n User Guide\n </Link>\n\n {loggedIn && (\n <Link\n data-id=\"acceptance-link\"\n variant=\"body2\"\n color=\"secondary.main\"\n underline=\"none\"\n href={router.url('acceptanceUsePolicy')}\n rel=\"noopener\"\n >\n Acceptable use\n </Link>\n )}\n </Stack>\n </Stack>\n );\n}\n","import {useQuery} from '@tanstack/react-query';\nimport {MaintenanceApi} from 'app/components/entities/maintenance/api/MaintenanceApi';\nimport {MaintenanceMapper} from 'app/components/entities/maintenance/mapper';\n\nexport function useVersionQuery(enabled: boolean) {\n return useQuery({\n queryKey: ['cloud-version'],\n queryFn: async () => {\n const res = await MaintenanceApi.getVersion();\n return MaintenanceMapper.mapVersion(res);\n },\n enabled,\n });\n}\n","import React, {useEffect} from 'react';\nimport {Box} from '@mui/material';\nimport {LoginForm} from 'app/components/Login/LoginForm';\nimport {front} from 'app/api/CirrusApi';\nimport {InvitedModalNotification} from 'app/components/libs/dialogs/InvitedModalNotification';\nimport {LoggingErrorModalNotification} from 'app/components/libs/dialogs/LoggingErrorModalNotification';\nimport {getAuthStateByRouteName} from 'app/components/Login/utils';\nimport {Footer} from 'app/components/Footer';\nimport {Callback} from 'app/types/common';\nimport {AuthResponseDto} from 'app/components/Authorization/types';\nimport {processAuthResponse} from 'app/components/Authorization/utils';\n\ninterface Props {\n invited: boolean;\n error: boolean;\n next: string;\n state: string;\n routeName: string;\n onClickLogo: Callback;\n onChangeAuthState: Callback;\n}\n\nexport const Login = ({\n invited,\n error,\n next,\n state,\n routeName,\n onClickLogo,\n onChangeAuthState,\n}: Props) => {\n useEffect(() => {\n if (error) {\n LoggingErrorModalNotification.show();\n } else {\n InvitedModalNotification.show(invited);\n }\n }, []);\n\n return (\n <div className=\"login-page\" id=\"login\">\n <div className=\"login-page__logo\">\n <Box\n component=\"img\"\n src=\"/assets/img/logo/logo-bigger.png\"\n alt=\"Epiphan Cloud\"\n data-id=\"logo\"\n onClick={onClickLogo}\n />\n </div>\n\n <div className=\"login-page__content login-content\">\n <LoginForm\n next={next}\n state={state}\n authState={getAuthStateByRouteName(routeName)}\n onSignedIn={async (args) => {\n const {state: argsState, ...restArgs} = args;\n\n const res: AuthResponseDto = await front\n .oauth()\n .internal_cognito({next, state: args.state ?? state})\n .postForm(restArgs);\n\n processAuthResponse(res);\n }}\n onChangeState={onChangeAuthState}\n />\n </div>\n\n <Footer loggedIn={false} />\n </div>\n );\n};\n","import {AuthResponseDto} from 'app/components/Authorization/types';\n\nfunction processAuthResponse(response: AuthResponseDto) {\n if (response.current_team_id) {\n window.location.assign('/' + response.current_team_id);\n } else {\n window.location.assign('/');\n }\n}\n\nexport {\n processAuthResponse,\n};\n","import {noop} from 'app/util/noop';\nimport {secondsToMilliseconds} from 'app/util/timeConverter';\n\n// Events: https://support.google.com/analytics/answer/1033068\n// Custom dimensions & metrics: https://support.google.com/analytics/answer/2709828\n// Field Reference: https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference\n\nconst GOOGLE_ANALYTICS_LOADED_CHECK_TIMEOUT = secondsToMilliseconds(10);\n\nconst getGoogleAnalyticsObjectName = () => window.GoogleAnalyticsObject || 'ga';\nconst getGoogleAnalyticsObject = () => window[getGoogleAnalyticsObjectName()];\n\nclass AnalyticsTracker {\n protected router;\n private path = null;\n\n constructor({router}) {\n this.router = router;\n\n this.handleRouterChange = this.handleRouterChange.bind(this);\n\n this.initialize();\n }\n\n private initialize() {\n // See: https://developers.google.com/analytics/devguides/collection/analyticsjs/tracking-snippet-reference\n // See: https://github.com/googleanalytics/autotrack\n const gaAlias = getGoogleAnalyticsObjectName();\n window[gaAlias] = window[gaAlias] || function (...args) {\n return (window[gaAlias].q = window[gaAlias].q || []).push(args);\n };\n\n this.router.onChange(this.handleRouterChange);\n this.trackCurrentPage();\n\n this.unmountIfDisabled();\n }\n\n // Stop tracking if Google Analytics is disabled (development environment for example)\n private unmountIfDisabled() {\n setTimeout(() => {\n if (getGoogleAnalyticsObject().loaded) {\n return;\n }\n\n this.router.offChange(this.handleRouterChange);\n\n this.viewPage = noop;\n }, GOOGLE_ANALYTICS_LOADED_CHECK_TIMEOUT);\n }\n\n private handleRouterChange() {\n this.trackCurrentPage();\n }\n\n private trackCurrentPage() {\n this.viewPage(this.router.state.name);\n }\n\n private viewPage(pageName) {\n if (pageName === this.path) {\n return;\n }\n\n this.path = pageName;\n\n getGoogleAnalyticsObject()('set', 'page', pageName);\n getGoogleAnalyticsObject()('send', 'pageview');\n }\n}\n\nexport {AnalyticsTracker};\n","import React from 'react';\nimport {Icons} from 'app/util/icons';\nimport {SIZE, THEME, VARIANT} from 'app/constants';\nimport {Button} from 'app/components/sharedReactComponents/Button';\n\ninterface Props {\n url: string;\n text: string;\n}\n\nexport const GoBackButton = ({\n url,\n text,\n}: Props) => {\n return (\n <Button\n className=\"cr-header__go-back-button\"\n dataId=\"go_back_button\"\n theme={THEME.SECONDARY}\n variant={VARIANT.LINK}\n href={url}\n >\n {Icons.urlGoBackArrow().size(SIZE.S).label(text).reactComponent()}\n </Button>\n );\n};\n","import React, {ReactNode} from 'react';\nimport classNames from 'classnames';\nimport {GoBackButton} from 'app/components/sharedReactComponents/PageHeader/GoBackButton';\nimport {ClassName} from 'app/types/common';\n\ninterface Props extends ClassName {\n backUrl?: string;\n backText?: string;\n title?: ReactNode;\n centerMessage?: ReactNode;\n buttons?: ReactNode;\n}\n\nexport function PageHeader({className, backUrl, backText, title, centerMessage, buttons}: Props) {\n return (\n <div className={classNames('cr-header', className)}>\n <div className=\"cr-header__container\">\n <div className=\"cr-header__content container\">\n {backUrl && backText && <GoBackButton url={backUrl} text={backText} />}\n\n <div className=\"cr-header__main\">\n <div className=\"cr-header__title\" data-id=\"header_title\">\n {title}\n </div>\n </div>\n\n {centerMessage && <div className=\"cr-header__center-message\">{centerMessage}</div>}\n\n <div className=\"cr-header__buttons\">{buttons}</div>\n </div>\n </div>\n </div>\n );\n}\n","const DEVICE_DETAILS_PAGE_TAB_NAME = {\n STATUS: 'status',\n CHANNELS: 'channels',\n INPUTS: 'inputs',\n ALERTS: 'alerts',\n PRESETS: 'presets',\n OUTPUT: 'output',\n AUDIO: 'audio',\n TRANSCRIPTION: 'transcription',\n SESSION: 'session',\n EVENTS: 'events',\n\n // Channel\n RECORDING_STREAMING: 'recording_streaming',\n ENCODING_SETTINGS: 'encoding_settings',\n};\n\nconst DEVICE_DETAILS_PAGE_DEFAULT_ACTIVE_TAB = DEVICE_DETAILS_PAGE_TAB_NAME.STATUS;\nconst TRANSCRIBE_DEVICE_DETAILS_PAGE_SETTINGS_TAB = DEVICE_DETAILS_PAGE_TAB_NAME.OUTPUT;\n\n// new enums\nenum DeviceCapability {\n AudioLevels = 'audio_levels',\n ChannelPreviews = 'channel_previews',\n Cms = 'cms',\n Presets = 'presets',\n Properties = 'properties',\n SourcePreviews = 'source_previews',\n WsApi = 'wsapi',\n /** Can handle `recording.start/stop` */\n Recording = 'recording',\n /** Can handle `afu.start/stop` */\n Uploading = 'uploading',\n /** Can handle `rtmp.start/stop` */\n Streaming = 'streaming',\n /** Supports `DesiredState` */\n States = 'states',\n StateAssetsInfo = 'state_assetsinfo',\n StateRecording = 'state_recording',\n StateScheduling = 'state_scheduling',\n StateStreaming = 'state_streaming',\n StateTeamInfo = 'state_teaminfo',\n StateTranscribing = 'state_transcribing',\n StateTranscribingConf = 'state_transcribing_conf',\n StateUploading = 'state_uploading',\n /** Has button that can be assigned to actions */\n HasActionButton1 = 'has_action_button1',\n /** Has remotely accessible web UI */\n RemoteLogin = 'remote_login',\n Reboot = 'reboot',\n ChronoCms = 'epiphan_cms',\n}\n\nenum DeviceCommand {\n Reboot = 'reboot',\n FootageClear = 'footage.clear',\n FirmwareUpdate = 'firmware.update',\n PublisherConfigure = 'publisher.configure',\n Recording = 'recording',\n Uploading = 'afu',\n PublisherStart = 'publisher.start',\n PublisherStop = 'publisher.stop',\n LevelsStart = 'levels.start',\n SourcePreviewsStart = 'source_previews.start',\n}\n/** @deprecated replace by Cloud.UnitModel */\nenum DeviceModel {\n Pearl2 = 'Pearl-2',\n PearlNano = 'Pearl Nano',\n PearlMini = 'Pearl Mini',\n PearlNexus = 'Pearl Nexus',\n PearlVirtual = 'Pearl Virtual',\n LiveScrypt = 'LiveScrypt',\n Unify = 'Epiphan Unify Project',\n Webcaster = 'Webcaster',\n Channel = 'Channel',\n Demo = 'Demo',\n}\n\n// TODO: rework after Vadim answered\nenum FirmwareUpdateStatus {\n Available = 'available',\n Downloading = 'downloading',\n Progress = 'progress',\n}\n\nenum DesiredStateType {\n Recording = 'recording',\n Streaming = 'streaming',\n Transcribing = 'transcribing',\n}\n\nenum DeviceWarningId {\n PublisherError = 'publisher_error',\n StorageFull = 'storage_full',\n StreamingDestinationError = 'streaming_destination_error',\n}\n\nenum HealthStatus {\n Good = 'good',\n Fair = 'fair',\n Bad = 'bad',\n}\n\n/**\n * @readonly\n * @enum {string}\n */\nconst DEVICE_HEALTH_STATUS_NAME = {\n [HealthStatus.Good]: 'Good',\n [HealthStatus.Fair]: 'Fair',\n [HealthStatus.Bad]: 'Bad',\n};\n\nenum TranscribingStatus {\n Started = 'started',\n Paused = 'paused',\n Stopped = 'stopped',\n}\n\nexport {\n DEVICE_HEALTH_STATUS_NAME,\n DEVICE_DETAILS_PAGE_TAB_NAME,\n DEVICE_DETAILS_PAGE_DEFAULT_ACTIVE_TAB,\n TRANSCRIBE_DEVICE_DETAILS_PAGE_SETTINGS_TAB,\n // new enums\n DeviceCapability,\n DeviceCommand,\n DeviceModel,\n FirmwareUpdateStatus,\n DesiredStateType,\n DeviceWarningId,\n HealthStatus,\n TranscribingStatus,\n};\n","import {DeviceModel} from 'app/components/DeviceDetails/constants';\nimport {Cloud} from 'app/domain/cloud';\n\nexport class ModelService {\n static isWebcaster(model: DeviceModel | Cloud.UnitModel): boolean {\n return model === DeviceModel.Webcaster;\n }\n\n static isLivescrypt(model: DeviceModel | Cloud.UnitModel): boolean {\n return model === DeviceModel.LiveScrypt;\n }\n\n static isChannel(model: DeviceModel | Cloud.UnitModel | string): boolean {\n return model === DeviceModel.Channel;\n }\n\n static isDemo(model: DeviceModel | Cloud.UnitModel | string): boolean {\n return model === DeviceModel.Demo;\n }\n\n static isReal(model: DeviceModel | Cloud.UnitModel | string): boolean {\n return !this.isDemo(model);\n }\n\n static isPearl2(model: DeviceModel | Cloud.UnitModel | string): boolean {\n return model === DeviceModel.Pearl2;\n }\n\n static isNano(model: DeviceModel | Cloud.UnitModel | string) {\n return model === DeviceModel.PearlNano;\n }\n\n static isMini(model: DeviceModel | Cloud.UnitModel | string): boolean {\n return model === DeviceModel.PearlMini;\n }\n\n static isVirtual(model: DeviceModel | Cloud.UnitModel | string): boolean {\n return model === DeviceModel.PearlVirtual;\n }\n\n static isNexus(model: DeviceModel | Cloud.UnitModel | string): boolean {\n return model === DeviceModel.PearlNexus;\n }\n\n static isUnify(model: DeviceModel | Cloud.UnitModel | string): boolean {\n return model === DeviceModel.Unify;\n }\n\n static isPearlFamily(model: DeviceModel | Cloud.UnitModel | string): boolean {\n return (\n ModelService.isPearl2(model) ||\n ModelService.isMini(model) ||\n ModelService.isNano(model) ||\n ModelService.isVirtual(model) ||\n ModelService.isNexus(model)\n );\n }\n static isMultiChannel(model: DeviceModel | Cloud.UnitModel | string): boolean {\n return ModelService.isUnify(model) || ModelService.isPearlFamily(model);\n }\n}\n","import {createContext} from 'react';\nimport {RadioGroupContextProps} from 'app/components/sharedReactComponents/RadioGroup';\n\nexport const RadioGroupContext = createContext<RadioGroupContextProps>({});\n","import React, {useCallback, useEffect, useState} from 'react';\nimport {RadioGroupContext} from 'app/components/sharedReactComponents/RadioGroup/RadioGroupContext';\nimport {WAI_ARIA_ROLE} from 'app/constants/waiAriaRole';\nimport {LoadingWrapper} from 'app/components/sharedReactComponents/LoadingWrapper';\nimport {Callback, ClassName, DataId} from 'app/types/common';\nimport {isPromise} from 'app/util/isPromise';\n\n// rework typing\ninterface Props extends ClassName, DataId {\n /**\n * The name used to reference the value of the control.\n * If you don't provide this prop, it falls back to a randomly generated name.\n */\n name?: string;\n /**\n * Value of the selected radio button. The DOM API casts this to a string.\n */\n value: any;\n uncheckable?: boolean;\n disabled?: boolean;\n loading?: boolean;\n // children: node;\n /**\n * Callback fired when a radio button is selected.\n *\n * @param {object} event The event source of the callback.\n * You can pull out the new value by accessing `event.target.value` (string).\n */\n onChange: Callback;\n}\n\nexport type RadioGroupContextProps = Partial<{\n name: string;\n value: any;\n uncheckable: boolean;\n disabled: boolean;\n loading: boolean;\n onChange: Callback;\n}>;\n\nexport const RadioGroup: React.FC<Props> = React.forwardRef<any, Props>(\n (\n {\n className,\n name,\n value,\n uncheckable,\n disabled,\n loading: loadingProp,\n children,\n dataId,\n onChange,\n },\n ref,\n ) => {\n const [loading, setLoading] = useState(loadingProp);\n\n const handleChange = useCallback(\n (event) => {\n const promise = onChange(event);\n\n if (isPromise(promise)) {\n setLoading(true);\n promise.finally(() => setLoading(false));\n }\n },\n [onChange],\n );\n\n useEffect(() => {\n setLoading(loadingProp);\n }, [loadingProp]);\n\n return (\n <RadioGroupContext.Provider\n // eslint-disable-next-line react/jsx-no-constructed-context-values\n value={{\n name,\n value,\n uncheckable,\n disabled,\n loading,\n onChange: handleChange,\n }}\n >\n <LoadingWrapper loading={loading}>\n <div ref={ref} className={className} role={WAI_ARIA_ROLE.RADIO_GROUP} data-id={dataId}>\n {children}\n </div>\n </LoadingWrapper>\n </RadioGroupContext.Provider>\n );\n },\n);\n","import {useContext} from 'react';\nimport {RadioGroupContext} from 'app/components/sharedReactComponents/RadioGroup/RadioGroupContext';\n\nexport function useRadioGroup() {\n return useContext(RadioGroupContext);\n}\n","interface Event {\n stopPropagation: () => void;\n}\n\nfunction stopPropagation(event: Event) {\n event.stopPropagation();\n}\n\nexport {\n stopPropagation,\n};\n","import React, {useCallback} from 'react';\nimport classNames from 'classnames';\nimport {KeyboardCode, SIZE} from 'app/constants';\nimport {useRadioGroup} from 'app/components/sharedReactComponents/RadioGroup/useRadioGroup';\nimport {isNil} from 'app/util/isNil';\nimport {stopPropagation} from 'app/util/stopPropagation';\nimport {noop} from 'app/util/noop';\nimport {LoadingWrapper} from 'app/components/sharedReactComponents/LoadingWrapper';\nimport {Callback, ClassName, DataId} from 'app/types/common';\n\nexport enum RADIO_THEME {\n DEFAULT = 'default',\n BLACK = 'black',\n}\n\nfunction processEventData({target: {name, value}}) {\n return {\n target: {\n value,\n name,\n },\n };\n}\n\n// rework typing\ninterface Props extends ClassName, DataId {\n name?: string;\n value: string;\n checked?: boolean;\n label?: React.ReactNode;\n helperText?: string;\n theme?: RADIO_THEME;\n size?: SIZE;\n focusable?: boolean;\n uncheckable?: boolean;\n disabled?: boolean;\n loading?: boolean;\n onChange?: Callback;\n onBlur?: Callback;\n onClick?: Callback;\n}\n\nexport const Radio: React.FC<Props> = ({\n className,\n name: nameProp,\n value,\n checked: checkedProp,\n label,\n helperText,\n theme,\n size,\n focusable,\n uncheckable: uncheckableProp,\n disabled: disabledProp,\n loading,\n onChange,\n onBlur,\n onClick,\n dataId,\n}) => {\n const radioGroup = useRadioGroup();\n\n let checked = checkedProp;\n let uncheckable = uncheckableProp;\n let name = nameProp;\n let disabled = disabledProp;\n\n if (radioGroup) {\n if (isNil(checked)) {\n checked = radioGroup.value === value;\n }\n\n if (isNil(uncheckable)) {\n uncheckable = radioGroup.uncheckable;\n }\n\n if (isNil(name)) {\n name = radioGroup.name;\n }\n\n if (disabled !== true) {\n disabled = radioGroup.disabled || radioGroup.loading;\n }\n }\n\n const handleClick = (e) => {\n if (disabled) {\n return;\n }\n\n if (onClick) {\n onClick(e);\n }\n\n if (checked && uncheckable !== true) {\n return;\n }\n\n if (onChange) {\n onChange(createChangeEvent());\n }\n\n if (radioGroup?.onChange) {\n radioGroup.onChange(createChangeEvent());\n }\n };\n\n const handleKeyUp = (e: React.KeyboardEvent) => {\n if (disabled) {\n return;\n }\n\n if (checked && uncheckable !== true) {\n return;\n }\n\n if (e.code === KeyboardCode.Space) {\n if (onChange) {\n onChange(createChangeEvent());\n }\n\n if (radioGroup?.onChange) {\n radioGroup.onChange(createChangeEvent());\n }\n }\n };\n\n const handleBlur = useCallback(\n (e) => {\n if (onBlur) {\n onBlur(processEventData(e));\n }\n },\n [onBlur],\n );\n\n function createChangeEvent() {\n return {\n target: {\n name,\n value: checked ? undefined : value,\n },\n };\n }\n\n const tabIndex = focusable === false ? -1 : undefined;\n\n return (\n <LoadingWrapper loading={loading}>\n <label\n data-id={dataId}\n className={classNames(\n 'radio',\n {\n 'radio--black': theme === RADIO_THEME.BLACK,\n [`radio--size-${size}`]: Boolean(size),\n 'radio--labeled': Boolean(label),\n },\n className,\n )}\n tabIndex={tabIndex}\n onClick={handleClick}\n onKeyUp={handleKeyUp}\n >\n <input\n type=\"radio\"\n name={name}\n checked={checked}\n value={value}\n tabIndex={tabIndex}\n disabled={disabled || loading}\n onChange={noop}\n onBlur={handleBlur}\n onClick={stopPropagation}\n />\n <span />\n\n {label && <span className=\"radio__label\">{label}</span>}\n\n {label && helperText && <div className=\"radio__helper\">{helperText}</div>}\n </label>\n </LoadingWrapper>\n );\n};\n","import {Callback} from 'app/types/common';\n\nexport interface FilterSwitch<Group = string> {\n id: string;\n group?: Group;\n label: string;\n disabled?: boolean;\n callback?: Callback<boolean>;\n callbackForGroup?: Callback<boolean>;\n isVisible?: Callback<boolean>;\n}\n\nexport enum FilterSwitchGroupType {\n Radio = 'radio',\n Checkbox = 'checkbox',\n}\n\nexport interface FilterSwitchGroup<T extends string = string> {\n id: T;\n label: string;\n type?: FilterSwitchGroupType;\n defaultValue?: string;\n}\n","import React, {useCallback} from 'react';\nimport classNames from 'classnames';\nimport {Callback, ClassName} from 'app/types/common';\nimport {FormControl} from 'app/components/sharedReactComponents/FormControl';\nimport {Icons} from 'app/util/icons';\nimport {SIZE} from 'app/constants';\n\ninterface ClearButtonProps {\n hidden: boolean;\n onClick: Callback;\n}\n\nconst ClearButton: React.VFC<ClearButtonProps> = ({\n hidden,\n onClick,\n}) => (\n <span\n className={classNames('filter-selector-search__clear-button', hidden && 'filter-selector-search__clear-button--hidden')}\n data-id=\"filter_group_search_clear\"\n aria-hidden={true}\n onClick={onClick}\n >\n {Icons.close().size(SIZE.S).reactComponent()}\n </span>\n);\n\ninterface Props extends ClassName {\n value: string;\n onChange: Callback;\n}\n\nconst FilterSelectorSearch: React.VFC<Props> = ({\n className,\n value,\n onChange,\n}) => {\n const handleClear = useCallback(() => {\n onChange({target: {value: ''}});\n }, [onChange]);\n\n return (\n <FormControl\n className={classNames('filter-selector-search', className)}\n value={value}\n name=\"filter_name\"\n placeholder=\"Find by name\"\n size={SIZE.S}\n fullWidth={true}\n endAdornment={(\n <ClearButton\n hidden={value === ''}\n onClick={handleClear}\n />\n )}\n onChange={onChange}\n />\n );\n};\n\nexport {FilterSelectorSearch};\n","import {Callback} from 'app/types/common';\nimport {FilterSwitch} from 'app/components/sharedReactComponents/FilterSelector/types';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {DeviceByGroupMap} from 'app/components/FleetManager/DeviceGroups/DeviceByGroupMap';\nimport {PearlMasterDeviceModel} from 'app/components/DeviceDetails/Models/PearlMasterDeviceModel';\nimport {filterItemsByFilterSwitches} from 'app/components/sharedReactComponents/FilterSelector/utils';\nimport {ModelService} from 'app/services/deviceModel/DeviceModelService';\nimport {Schedule} from 'app/domain/schedule';\nimport {isOngoing} from 'app/domain/schedule/utils';\nimport {Edge} from 'app/domain/edge';\n\nfunction filterDevices(\n devices: AnyDeviceModelType[],\n filters: FilterSwitch[],\n): AnyDeviceModelType[] {\n return filterItemsByFilterSwitches(devices, filters);\n}\n\nfunction filterDeviceGroups(deviceGroups: Edge.Group[], filters: FilterSwitch[]): Edge.Group[] {\n return filterItemsByFilterSwitches(deviceGroups, filters, (filter) => filter?.callbackForGroup);\n}\n\nfunction filterPresets(presets: Edge.TeamPreset[], filters: FilterSwitch[]): Edge.TeamPreset[] {\n return filterItemsByFilterSwitches(presets, filters);\n}\n\nfunction collectSelectedDevices(\n devices: AnyDeviceModelType[],\n checkIsDeviceSelected: (deviceId: string) => boolean,\n collection: any[] = [],\n): AnyDeviceModelType[] {\n devices.forEach((device) => {\n if (checkIsDeviceSelected(device.getId())) {\n collection.push(device);\n }\n\n if (ModelService.isMultiChannel(device.getModelName())) {\n return collectSelectedDevices(\n (device as PearlMasterDeviceModel).getChanelModels(),\n checkIsDeviceSelected,\n collection,\n );\n }\n });\n\n return collection;\n}\n\nfunction collectSelectedGroups(\n deviceGroups: Edge.Group[],\n checkIsDeviceGroupSelected: Callback,\n): Edge.Group[] {\n return deviceGroups.filter(({id}) => checkIsDeviceGroupSelected(id));\n}\n\nfunction getDeviceModelNames(devices: AnyDeviceModelType[]): string[] {\n const resultSet = new Set<string>(devices.map((device) => device.getModelName()));\n return Array.from(resultSet);\n}\n\nfunction containsSearchString(value: string, search: string): boolean {\n return value.toLowerCase().includes(search.toLowerCase());\n}\n\nfunction filterByIdOrSerialNumberOrName(device: AnyDeviceModelType, search: string) {\n const name = device.getName();\n const id = device.getId();\n const serial = device.getSerialNumber() ?? '';\n return (\n containsSearchString(name, search) ||\n containsSearchString(id, search) ||\n containsSearchString(serial, search)\n );\n}\n\nfunction collectDevicesAndChannelsIds(devices: AnyDeviceModelType[]): string[] {\n const deviceIds: any[] = [];\n\n devices.forEach((device) => {\n deviceIds.push(...collectDeviceAndChannelIds(device));\n });\n\n return deviceIds;\n}\n\nfunction collectDeviceAndChannelIds(device: AnyDeviceModelType): string[] {\n const deviceId = device.getId();\n\n if (ModelService.isMultiChannel(device.getModelName()) === false) {\n return [deviceId];\n }\n\n const channelDevices = (device as PearlMasterDeviceModel).getChanelModels();\n const channelDevicesIds = channelDevices.map((channelDevice) => channelDevice.getId());\n\n return [deviceId, ...channelDevicesIds];\n}\n\nfunction collectGroupsDevices(\n groupIds: string[],\n deviceByGroupMap: DeviceByGroupMap,\n): AnyDeviceModelType[] {\n const devices: AnyDeviceModelType[] = [];\n\n groupIds.forEach((groupId) => {\n devices.push(...collectGroupDevices(groupId, deviceByGroupMap));\n });\n\n return devices;\n}\n\nfunction collectGroupDevices(\n groupId: string,\n deviceByGroupMap: DeviceByGroupMap,\n): AnyDeviceModelType[] {\n return deviceByGroupMap.getDeviceGroupById(groupId);\n}\n\ninterface DeviceStats {\n online: number;\n offline: number;\n recording: number;\n streaming: number;\n active: number;\n}\n\nfunction collectDevicesStatisticsData(devices: AnyDeviceModelType[]): DeviceStats {\n let online = 0;\n let recording = 0;\n let streaming = 0;\n let active = 0;\n\n // eslint-disable-next-line no-restricted-syntax\n for (const device of devices) {\n if (device.isOnline()) {\n online += 1;\n }\n\n const deviceRecording = device.isRecording();\n if (deviceRecording) {\n recording += 1;\n }\n\n const deviceStreaming = device.isStreaming();\n if (deviceStreaming) {\n streaming += 1;\n }\n\n const deviceTranscribing = device.isTranscribing();\n\n if (deviceRecording || deviceStreaming || deviceTranscribing) {\n active += 1;\n }\n }\n\n const offline = devices.length - online;\n\n return {\n online,\n offline,\n recording,\n streaming,\n active,\n };\n}\n\nfunction getDevicesWithOngoingEvents(\n deviceIds: string[],\n actualEvents: Map<string, Schedule.Event>,\n): string[] {\n const devices = new Set(deviceIds);\n\n const result = Array.from(actualEvents.entries()).reduce<string[]>((acc, p) => {\n const [deviceId, event] = p;\n\n if (isOngoing(event.status) && devices.has(deviceId)) {\n return [...acc, deviceId];\n }\n\n return acc;\n }, []);\n\n return result;\n}\n\nexport {\n filterDevices,\n filterDeviceGroups,\n filterPresets,\n collectSelectedDevices,\n collectSelectedGroups as collectSelectedDeviceGroups,\n getDeviceModelNames,\n containsSearchString,\n collectDeviceAndChannelIds,\n collectDevicesAndChannelsIds,\n collectGroupDevices,\n collectGroupsDevices,\n collectDevicesStatisticsData,\n getDevicesWithOngoingEvents,\n filterByIdOrSerialNumberOrName,\n};\n","import React, {useCallback, KeyboardEvent} from 'react';\nimport {RadioGroup} from 'app/components/sharedReactComponents/RadioGroup';\nimport {Radio, RADIO_THEME} from 'app/components/sharedReactComponents/Radio';\nimport {Checkbox, CHECKBOX_THEME} from 'app/components/sharedReactComponents/Checkbox';\nimport {KeyboardCode, SIZE} from 'app/constants';\nimport {Callback} from 'app/types/common';\nimport {FilterSwitch, FilterSwitchGroup, FilterSwitchGroupType} from 'app/components/sharedReactComponents/FilterSelector/types';\nimport {Caret, CARET_VARIANT} from 'app/components/sharedReactComponents/Caret';\nimport classNames from 'classnames';\nimport {FilterSelectorSearch} from 'app/components/sharedReactComponents/FilterSelector/FilterSelectorSearch';\nimport {useFilterSelectorGroupSearch} from 'app/components/sharedReactComponents/FilterSelector/useFilterSelectorGroupSearch';\nimport {OverflowTooltip} from 'app/components/sharedReactComponents/OverflowTooltip/OverflowTooltip';\n\ninterface LabelProps {\n collapsible: boolean;\n collapsed: boolean;\n groupId: string;\n onClick: Callback;\n}\n\nconst Label: React.FC<LabelProps> = ({\n collapsible,\n collapsed,\n groupId,\n children,\n onClick,\n}) => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.code === KeyboardCode.Enter || event.code === KeyboardCode.Space) {\n event.preventDefault();\n onClick();\n }\n };\n\n return (\n <div\n className={classNames('filter-selector__menu-group-label', collapsible && 'filter-selector__menu-group-label--collapsable')}\n tabIndex={collapsible ? 0 : undefined}\n data-id={`toggler_${groupId}`}\n onClick={collapsible ? onClick : undefined}\n onKeyDown={collapsible ? handleKeyDown : undefined}\n >\n {children}\n\n {collapsible && (\n <Caret\n data-id=\"filter_selector_caret\"\n opened={collapsed === false}\n variant={CARET_VARIANT.THIN}\n size={SIZE.S}\n />\n )}\n </div>\n );\n};\n\nconst Option: React.FC = ({children}) => {\n return (\n <div className=\"filter-selector__option\">\n {children}\n </div>\n );\n};\n\ninterface Props {\n filterSwitchGroup: FilterSwitchGroup;\n filterSwitches: FilterSwitch[];\n collapsible: boolean;\n collapsed: boolean;\n searchable: boolean;\n activeFilterSwitches: Set<string>;\n onClickFilterSwitcher: Callback;\n onToggleFilterSwitchGroupCollapse: Callback;\n}\n\nexport const FilterSelectorGroup: React.FC<Props> = ({\n filterSwitchGroup,\n filterSwitches,\n collapsible,\n collapsed: collapsedProp,\n searchable,\n activeFilterSwitches,\n onClickFilterSwitcher,\n onToggleFilterSwitchGroupCollapse,\n}) => {\n const {\n searchText,\n searchedFilterSwitches,\n onSearch,\n } = useFilterSelectorGroupSearch({\n filterSwitches,\n searchable,\n });\n\n const filterSwitchGroupId = filterSwitchGroup.id;\n\n const collapsed = collapsible && collapsedProp;\n\n const handleClickItem = useCallback(({target: {name}}) => {\n onClickFilterSwitcher(name);\n }, [onClickFilterSwitcher]);\n\n const handleChangeGroup = useCallback(({target: {value}}) => {\n onClickFilterSwitcher(value);\n }, [onClickFilterSwitcher]);\n\n const handleClickLabel = useCallback(() => {\n onToggleFilterSwitchGroupCollapse(filterSwitchGroupId);\n }, [filterSwitchGroupId, onToggleFilterSwitchGroupCollapse]);\n\n if (filterSwitchGroup.type === FilterSwitchGroupType.Radio) {\n const activeOption = filterSwitches.find(filterSwitch => activeFilterSwitches.has(filterSwitch.id));\n const value = activeOption ? activeOption.id : filterSwitchGroup.defaultValue;\n\n return (\n <RadioGroup\n key={filterSwitchGroupId}\n className=\"filter-selector__menu-group\"\n dataId={`filter_selector_menu_group_${filterSwitchGroupId}`}\n name={filterSwitchGroupId}\n value={value}\n onChange={handleChangeGroup}\n >\n <Label\n collapsible={collapsible}\n collapsed={collapsed}\n groupId={filterSwitchGroupId}\n onClick={handleClickLabel}\n >\n {filterSwitchGroup.label}\n </Label>\n\n {!collapsed && (\n <>\n {searchable && (\n <div className=\"filter-selector__menu-group-search\">\n <FilterSelectorSearch\n value={searchText}\n onChange={onSearch}\n />\n </div>\n )}\n\n {searchedFilterSwitches.map(filterSwitch => (\n <Option key={filterSwitch.id}>\n <Radio\n value={filterSwitch.id}\n label={filterSwitch.label}\n theme={RADIO_THEME.BLACK}\n size={SIZE.S}\n />\n </Option>\n ))}\n </>\n )}\n </RadioGroup>\n );\n }\n\n return (\n <div\n key={filterSwitchGroupId}\n className=\"filter-selector__menu-group\"\n data-id={`filter_selector_menu_group_${filterSwitchGroupId}`}\n >\n <Label\n collapsible={collapsible}\n collapsed={collapsed}\n groupId={filterSwitchGroupId}\n onClick={handleClickLabel}\n >\n {filterSwitchGroup.label}\n </Label>\n\n {!collapsed && (\n <>\n {searchable && (\n <div className=\"filter-selector__menu-group-search\">\n <FilterSelectorSearch\n value={searchText}\n onChange={onSearch}\n />\n </div>\n )}\n\n {searchedFilterSwitches.map(filterSwitch => (\n <Option key={filterSwitch.id}>\n <Checkbox\n label={(\n <OverflowTooltip className=\"filter-selector__checkbox-label\">\n {filterSwitch.label}\n </OverflowTooltip>\n )}\n name={filterSwitch.id}\n value={activeFilterSwitches.has(filterSwitch.id)}\n theme={CHECKBOX_THEME.BLACK}\n size={SIZE.S}\n disabled={filterSwitch.disabled}\n onChange={handleClickItem}\n />\n </Option>\n ))}\n </>\n )}\n </div>\n );\n};\n","import {useCallback, useMemo, useState} from 'react';\nimport {containsSearchString} from 'app/components/FleetManager/utils';\nimport {FilterSwitch} from 'app/components/sharedReactComponents/FilterSelector/types';\n\ninterface Props {\n filterSwitches: FilterSwitch[];\n searchable: boolean;\n}\n\nfunction useFilterSelectorGroupSearch({\n filterSwitches,\n searchable,\n}: Props) {\n const [searchText, setSearchText] = useState('');\n\n const onSearch = useCallback(({target: {value}}) => {\n setSearchText(value);\n }, []);\n\n const searchedFilterSwitches = useMemo(() => {\n if (searchable !== true || searchText === '') {\n return filterSwitches;\n }\n\n return filterSwitches.filter(filterSwitch => containsSearchString(filterSwitch.label, searchText));\n }, [searchable, searchText, filterSwitches]);\n\n return {\n searchText,\n onSearch,\n searchedFilterSwitches,\n };\n}\n\nexport {\n useFilterSelectorGroupSearch,\n};\n","import React from 'react';\nimport {FilterSelectorGroup} from 'app/components/sharedReactComponents/FilterSelector/FilterSelectorGroup';\nimport {Callback} from 'app/types/common';\nimport {\n FilterSwitch,\n FilterSwitchGroup,\n} from 'app/components/sharedReactComponents/FilterSelector/types';\n\ninterface Props {\n filterSwitches: FilterSwitch[];\n filterSwitchGroups: FilterSwitchGroup[];\n activeFilterSwitches: Set<string>;\n collapsibleFilterSwitchGroups: Set<string>;\n collapsedFilterSwitchGroups: Set<string>;\n searchableFilterSwitchGroups: Set<string>;\n onClickFilterSwitcher: Callback;\n onToggleFilterSwitchGroupCollapse: Callback;\n}\n\ntype NonEmptyFilterSwitchGroup = {\n filterSwitchGroup: FilterSwitchGroup;\n filterSwitches: FilterSwitch[];\n};\n\nexport const FilterSelectorList: React.FC<Props> = ({\n filterSwitches,\n filterSwitchGroups,\n activeFilterSwitches,\n collapsibleFilterSwitchGroups,\n collapsedFilterSwitchGroups,\n searchableFilterSwitchGroups,\n onClickFilterSwitcher,\n onToggleFilterSwitchGroupCollapse,\n}) => {\n const filterSwitchesGroupedMap: Record<string, FilterSwitch[]> = filterSwitches.reduce((acc, filterSwitch) => {\n const {group} = filterSwitch;\n\n if (!group) {\n return acc;\n }\n\n const filterSwitchesGroup = acc[group];\n\n if (filterSwitchesGroup) {\n filterSwitchesGroup.push(filterSwitch);\n } else {\n acc[group] = [filterSwitch];\n }\n\n return acc;\n }, {});\n\n const nonEmptyFilterSwitchGroups: NonEmptyFilterSwitchGroup[] = [];\n\n for (const filterSwitchGroup of filterSwitchGroups) {\n const filterSwitches = filterSwitchesGroupedMap[filterSwitchGroup.id];\n if (filterSwitches) {\n nonEmptyFilterSwitchGroups.push({\n filterSwitchGroup,\n filterSwitches,\n });\n }\n }\n\n const singleGroup = nonEmptyFilterSwitchGroups.length === 1;\n\n return (\n <div className=\"filter-selector__menu\">\n {nonEmptyFilterSwitchGroups.map(({filterSwitchGroup, filterSwitches}) => (\n <FilterSelectorGroup\n key={filterSwitchGroup.id}\n filterSwitchGroup={filterSwitchGroup}\n filterSwitches={filterSwitches}\n activeFilterSwitches={activeFilterSwitches}\n collapsible={singleGroup ? false : collapsibleFilterSwitchGroups.has(filterSwitchGroup.id)}\n collapsed={collapsedFilterSwitchGroups.has(filterSwitchGroup.id)}\n searchable={searchableFilterSwitchGroups.has(filterSwitchGroup.id)}\n onClickFilterSwitcher={onClickFilterSwitcher}\n onToggleFilterSwitchGroupCollapse={onToggleFilterSwitchGroupCollapse}\n />\n ))}\n </div>\n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport {Dropdown} from 'app/components/sharedReactComponents/Dropdown';\nimport {DropdownSelectButton} from 'app/components/sharedReactComponents/DropdownSelect/DropdownSelectButton';\nimport {SIZE} from 'app/constants';\nimport {Icons} from 'app/util/icons';\nimport {FilterSelectorList} from 'app/components/sharedReactComponents/FilterSelector/FilterSelectorList';\nimport {Callback, ClassName} from 'app/types/common';\nimport {TOOLTIP_PLACEMENT} from 'app/components/sharedReactComponents/Tooltip';\nimport {\n FilterSwitch,\n FilterSwitchGroup,\n} from 'app/components/sharedReactComponents/FilterSelector/types';\nimport {noop} from 'app/util/noop';\n\ninterface Props extends ClassName {\n filterSwitches: FilterSwitch[];\n filterSwitchGroups: FilterSwitchGroup[];\n activeFilterSwitches: Set<string>;\n collapsibleFilterSwitchGroups?: Set<string>;\n collapsedFilterSwitchGroups?: Set<string>;\n searchableFilterSwitchGroups?: Set<string>;\n placement?: TOOLTIP_PLACEMENT;\n onClickFilterSwitcher: Callback;\n onToggleFilterSwitchGroupCollapse?: Callback;\n}\n\nexport const FilterSelector: React.FC<Props> = ({\n className,\n filterSwitches,\n filterSwitchGroups,\n activeFilterSwitches,\n collapsibleFilterSwitchGroups = new Set(),\n collapsedFilterSwitchGroups = new Set(),\n searchableFilterSwitchGroups = new Set(),\n placement = TOOLTIP_PLACEMENT.TOP_END,\n onClickFilterSwitcher,\n onToggleFilterSwitchGroupCollapse = noop,\n}) => {\n const availableFilterSwitches = filterSwitches.filter(filterSwitch => {\n if (typeof filterSwitch.isVisible === 'function') {\n return filterSwitch.isVisible();\n }\n\n return true;\n });\n\n if (availableFilterSwitches.length === 0) {\n return null;\n }\n\n return (\n <div className={classNames('filter-selector', className)}>\n <Dropdown\n content={(\n <FilterSelectorList\n filterSwitches={availableFilterSwitches}\n filterSwitchGroups={filterSwitchGroups}\n activeFilterSwitches={activeFilterSwitches}\n collapsibleFilterSwitchGroups={collapsibleFilterSwitchGroups}\n collapsedFilterSwitchGroups={collapsedFilterSwitchGroups}\n searchableFilterSwitchGroups={searchableFilterSwitchGroups}\n onClickFilterSwitcher={onClickFilterSwitcher}\n onToggleFilterSwitchGroupCollapse={onToggleFilterSwitchGroupCollapse}\n />\n )}\n buttonOpenedClassName=\"filter-selector__button--active\"\n placement={placement}\n interactive={true}\n >\n <DropdownSelectButton\n size={SIZE.S}\n fullWidth={false}\n data-id=\"filter_selector_button\"\n >\n {Icons.filter().label('Filters').size(SIZE.S).reactComponent()}\n </DropdownSelectButton>\n </Dropdown>\n </div>\n );\n};\n","import React from 'react';\nimport {Button, Stack, Typography} from '@mui/material';\nimport {Callback, Sx} from 'app/types/common';\n\nconst defaultMessage = 'Filter applied, but no result found';\nconst defaultButtonText = 'Reset filter';\n\ninterface Props extends Sx {\n message?: string;\n buttonText?: string;\n handleClear: Callback;\n}\n\nexport function EmptyFilterMessage({\n sx,\n message = defaultMessage,\n buttonText = defaultButtonText,\n handleClear,\n}: Props) {\n return (\n <Stack sx={sx} direction=\"row\" justifyContent=\"center\" alignItems=\"center\" gap={2}>\n <Typography>{message}</Typography>\n\n <Button data-id=\"clear-btn\" variant=\"outlined\" disableRipple={false} onClick={handleClear}>\n {buttonText}\n </Button>\n </Stack>\n );\n}\n","import {useCallback, useEffect, useRef, useState} from 'react';\nimport {FilterStoreManager} from 'app/components/FleetManager/FilterStoreManager';\nimport {HealthStatus, DEVICE_HEALTH_STATUS_NAME} from 'app/components/DeviceDetails/constants';\nimport {getDeviceModelNames} from 'app/components/FleetManager/utils';\nimport {stringComparator} from 'app/util/Sort';\nimport {toggleInSet} from 'app/util/toggleInSet';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {\n FilterSwitch,\n FilterSwitchGroup,\n FilterSwitchGroupType,\n} from 'app/components/sharedReactComponents/FilterSelector/types';\nimport {Edge} from 'app/domain/edge';\n\nconst STORE_KEY = 'FleetManagerPage.Filters.Active';\n\nenum FilterSwitchGroupId {\n View = 'view',\n Group = 'group',\n Status = 'status',\n Activity = 'activity',\n Model = 'model',\n Health = 'health',\n Schedule = 'schedule',\n CMS = 'cms',\n}\n\nconst viewAllFilter: FilterSwitch = {\n id: 'view_all',\n group: FilterSwitchGroupId.View,\n label: 'All',\n callback: () => true,\n};\n\nconst viewGroupsFilter: FilterSwitch = {\n id: 'view_groups',\n group: FilterSwitchGroupId.View,\n label: 'Groups only',\n callback: (device: AnyDeviceModelType) => device.getGroupId() !== '',\n callbackForGroup: () => true,\n};\n\nconst viewUngroupedFilter: FilterSwitch = {\n id: 'view_ungrouped',\n group: FilterSwitchGroupId.View,\n label: 'Ungrouped devices only',\n callback: (device: AnyDeviceModelType) => device.getGroupId() === '',\n callbackForGroup: () => false,\n};\n\nconst filterSwitchGroups: FilterSwitchGroup[] = [\n {\n id: FilterSwitchGroupId.Status,\n label: 'Device status',\n },\n {\n id: FilterSwitchGroupId.Activity,\n label: 'Device activity',\n },\n {\n id: FilterSwitchGroupId.Model,\n label: 'Device model',\n },\n {\n id: FilterSwitchGroupId.Health,\n label: 'Device health',\n },\n {\n id: FilterSwitchGroupId.Schedule,\n label: 'Scheduled events',\n },\n {\n id: FilterSwitchGroupId.CMS,\n label: 'CMS integration',\n },\n {\n id: FilterSwitchGroupId.View,\n label: 'View',\n type: FilterSwitchGroupType.Radio,\n defaultValue: viewAllFilter.id,\n },\n {\n id: FilterSwitchGroupId.Group,\n label: 'By Groups',\n },\n];\n\nfunction createDeviceStatusFilter(props: FilterSwitch): FilterSwitch {\n return {\n ...props,\n group: FilterSwitchGroupId.Status,\n };\n}\n\nfunction createDeviceActivityFilter(props: FilterSwitch): FilterSwitch {\n return {\n ...props,\n group: FilterSwitchGroupId.Activity,\n };\n}\n\nfunction createDeviceModelNameFilter(modelName: string): FilterSwitch {\n return {\n id: modelName,\n group: FilterSwitchGroupId.Model,\n label: modelName,\n callback: (device: AnyDeviceModelType) => device.getModelName() === modelName,\n };\n}\n\nfunction createDeviceGroupFilter(group: Edge.Group): FilterSwitch {\n const groupId = group.id;\n\n return {\n id: groupId,\n group: FilterSwitchGroupId.Group,\n label: group.name,\n callback: (device: AnyDeviceModelType) => device.getGroupId() === groupId,\n callbackForGroup: (group: FilterSwitchGroup) => group.id === groupId,\n };\n}\n\nfunction createDeviceHealthFilter(deviceHealthStatus: HealthStatus): FilterSwitch {\n return {\n id: deviceHealthStatus,\n group: FilterSwitchGroupId.Health,\n label: DEVICE_HEALTH_STATUS_NAME[deviceHealthStatus],\n callback: (device: AnyDeviceModelType) => device.getHealthStatus() === deviceHealthStatus,\n };\n}\n\ntype FilterSwitchesParams = {\n devices: AnyDeviceModelType[];\n deviceGroups: Edge.Group[];\n teamId: string;\n userId: string;\n};\n\ntype FilterSwitchesReturn = {\n activeFilterSwitches: Set<string>;\n toggleFilterSwitcher: (filterSwitchId: string) => void;\n filterSwitches: FilterSwitch[];\n clearActiveFilterSwitches: () => void;\n};\n\nfunction useFilterSwitches({\n devices,\n deviceGroups,\n teamId,\n userId,\n}: FilterSwitchesParams): FilterSwitchesReturn {\n const [activeFilterSwitches, setActiveFilterSwitches] = useState<Set<string>>(new Set());\n const [filterSwitches, setFilterSwitches] = useState<FilterSwitch[]>([]);\n const defaultValues = useRef<Set<string>>(new Set());\n\n const filterSwitchManager = useRef<FilterStoreManager>();\n\n // Load saved state\n useEffect(() => {\n filterSwitchManager.current = new FilterStoreManager({\n teamId,\n userId,\n storeKey: STORE_KEY,\n });\n const storedActiveFilterSwitches = filterSwitchManager.current.loadActiveFiltersSet();\n setActiveFilterSwitches(storedActiveFilterSwitches);\n }, [teamId, userId]);\n\n // Register filter switches\n useEffect(() => {\n const switches = [\n createDeviceStatusFilter({\n id: 'online',\n label: 'Online',\n callback: (device) => device.isOnline(),\n }),\n createDeviceStatusFilter({\n id: 'offline',\n label: 'Offline',\n callback: (device) => device.isOffline(),\n }),\n\n createDeviceActivityFilter({\n id: 'streaming',\n label: 'Streaming',\n callback: (device) => device.isStreaming(),\n }),\n createDeviceActivityFilter({\n id: 'recording',\n label: 'Recording',\n callback: (device) => device.isRecording(),\n }),\n createDeviceActivityFilter({\n id: 'transcribing',\n label: 'Transcribing',\n callback: (device) => device.isTranscribing(),\n }),\n createDeviceHealthFilter(HealthStatus.Good),\n createDeviceHealthFilter(HealthStatus.Fair),\n createDeviceHealthFilter(HealthStatus.Bad),\n ];\n\n const deviceModelNameFilters = getDeviceModelNames(devices)\n .filter((name) => name)\n .sort(stringComparator)\n .map((modelName) => createDeviceModelNameFilter(modelName));\n if (deviceModelNameFilters.length > 1) {\n switches.push(...deviceModelNameFilters);\n }\n\n if (deviceGroups.length > 0) {\n switches.push(...[viewAllFilter, viewGroupsFilter, viewUngroupedFilter]);\n }\n\n const deviceGroupFilters = deviceGroups.map((deviceGroup) =>\n createDeviceGroupFilter(deviceGroup),\n );\n\n if (deviceGroupFilters.length > 0) {\n switches.push(...deviceGroupFilters);\n }\n\n defaultValues.current = new Set();\n // eslint-disable-next-line no-restricted-syntax\n for (const {defaultValue} of filterSwitchGroups) {\n if (defaultValue) {\n defaultValues.current.add(defaultValue);\n }\n }\n\n setFilterSwitches(switches);\n }, [devices, deviceGroups]);\n\n useEffect(() => {\n filterSwitchManager.current?.saveActiveFiltersSet(activeFilterSwitches);\n }, [activeFilterSwitches]);\n\n const toggleFilterSwitcher = useCallback(\n (filterSwitchId: string) => {\n setActiveFilterSwitches((activeFilterSwitches) => {\n const nextActiveFilterSwitches = new Set(activeFilterSwitches);\n\n const filterSwitch = filterSwitches.find(({id}) => id === filterSwitchId);\n const groupId = filterSwitch?.group;\n\n if (groupId) {\n const group = filterSwitchGroups.find(({id}) => id === groupId);\n\n // Reset \"View\" to default value if click Group filter switch\n if (groupId === FilterSwitchGroupId.Group) {\n filterSwitches\n .filter(({group}) => group === FilterSwitchGroupId.View)\n .forEach(({id}) => nextActiveFilterSwitches.delete(id));\n } else if (groupId === FilterSwitchGroupId.View) {\n // Clear \"By Groups\" if change \"View\" filter switch\n filterSwitches\n .filter(({group}) => group === FilterSwitchGroupId.Group)\n .forEach(({id}) => nextActiveFilterSwitches.delete(id));\n }\n\n if (group?.type === FilterSwitchGroupType.Radio) {\n const currentlyActive = activeFilterSwitches.has(filterSwitchId);\n\n filterSwitches\n .filter(({group}) => group === groupId)\n .forEach(({id}) => nextActiveFilterSwitches.delete(id));\n\n // Don't activate default value to hide it from \"Filtering by\" list\n if (defaultValues.current.has(filterSwitchId) === false && currentlyActive === false) {\n nextActiveFilterSwitches.add(filterSwitchId);\n }\n\n return nextActiveFilterSwitches;\n }\n }\n\n return toggleInSet(nextActiveFilterSwitches, filterSwitchId);\n });\n },\n [filterSwitches],\n );\n\n const clearActiveFilterSwitches = useCallback(() => {\n setActiveFilterSwitches(new Set());\n }, []);\n\n return {\n filterSwitches,\n activeFilterSwitches,\n toggleFilterSwitcher,\n clearActiveFilterSwitches,\n };\n}\n\nexport {useFilterSwitches, FilterSwitchGroupId, filterSwitchGroups};\n","import {MutableRefObject, useCallback, useEffect, useRef, useState} from 'react';\nimport {FilterSwitchGroupId} from 'app/components/FleetManager/useFilterSwitches';\nimport {toggleInSet} from 'app/util/toggleInSet';\nimport {differenceOfSets} from 'app/util/differenceOfSets';\nimport {unionOfSets} from 'app/util/unionOfSets';\nimport {\n FilterSwitch,\n FilterSwitchGroup,\n FilterSwitchGroupType,\n} from 'app/components/sharedReactComponents/FilterSelector/types';\nimport {Edge} from 'app/domain/edge';\nimport {Alerts} from 'app/components/entities/alerts';\n\nconst filterSwitchGroups: FilterSwitchGroup[] = [\n {\n id: FilterSwitchGroupId.Group,\n label: 'By Groups',\n },\n];\n\nfunction createDeviceGroupFilter(deviceGroup: Edge.Group): FilterSwitch {\n const groupId = deviceGroup.id;\n\n return {\n id: groupId,\n group: FilterSwitchGroupId.Group,\n label: deviceGroup.name,\n callback: (s: Alerts.Settings) => s.deviceGroupId === groupId,\n };\n}\n\ninterface Props {\n deviceGroups: Edge.Group[];\n}\n\ninterface Return {\n activeFilterSwitches: Set<string>;\n toggleFilterSwitcher: (filterSwitchId: string) => void;\n filterSwitches: MutableRefObject<FilterSwitch[]>;\n clearFilterSwitches: () => void;\n}\n\nfunction useFilterSwitches({deviceGroups}: Props): Return {\n const [activeFilterSwitches, setActiveFilterSwitches] = useState<Set<string>>(new Set());\n const filterSwitches = useRef<FilterSwitch[]>([]);\n\n useEffect(() => {\n filterSwitches.current = [\n ...deviceGroups.map((deviceGroup) => createDeviceGroupFilter(deviceGroup)),\n ];\n }, [deviceGroups]);\n\n // TODO: This is duplicate of FleetManager/useFilterSwitcher logics\n const toggleFilterSwitcher = useCallback((filterSwitchId: string) => {\n setActiveFilterSwitches((activeFilterSwitches) => {\n const filterSwitch = filterSwitches.current.find(({id}) => id === filterSwitchId);\n const groupId = filterSwitch?.group;\n\n if (groupId) {\n const group = filterSwitchGroups.find(({id}) => id === groupId);\n\n if (group?.type === FilterSwitchGroupType.Radio) {\n const sameGroupFilterSwitchIds = filterSwitches.current\n .filter(({group}) => group === groupId)\n .map(({id}) => id);\n const idsWithoutGrouped = differenceOfSets(\n activeFilterSwitches,\n new Set(sameGroupFilterSwitchIds),\n );\n\n return unionOfSets(idsWithoutGrouped, new Set([filterSwitchId]));\n }\n }\n\n return toggleInSet(activeFilterSwitches, filterSwitchId);\n });\n }, []);\n\n const clearFilterSwitches = useCallback(() => {\n setActiveFilterSwitches(new Set());\n }, []);\n\n return {\n filterSwitches,\n activeFilterSwitches,\n toggleFilterSwitcher,\n clearFilterSwitches,\n };\n}\n\nexport {useFilterSwitches, filterSwitchGroups};\n","/**\n * {@link https://epiphan.atlassian.net/l/c/BhPFk1PH}\n */\nexport enum EVENT_TYPE {\n DEVICE_CHANNEL_IMAGE = 'DeviceChannelImage',\n DEVICE_SOURCE_IMAGE = 'DeviceSourceImage',\n DEVICE_ALS = 'DeviceALS',\n NOTIFICATIONS_UPDATED = 'NotificationsUpdated',\n TEAM_PRESET_CHANGED = 'TeamPresetChange',\n MEETING_CHANGED = 'MeetingChanged',\n PARTICIPANT_UPDATED = 'ParticipantUpdated',\n RETURN_FEED_UPDATED = 'InjectionUpdated',\n TEAMS_CALL_UPDATED = 'TeamsCallUpdated',\n EVENT_SCHEDULE_CHANGED = 'ScheduleChange',\n CHRONO_EVENT_CHANGED = 'ChronoEventStatus',\n DEVICE_CHANGE = 'DeviceChange',\n DEVICE_GROUP_CHANGE = 'DeviceGroupChange',\n ADD_DEVICE = 'DevicePatchPair',\n REMOVE_DEVICE = 'DevicePatchRemove',\n UNPAIR_DEVICE = 'DevicePatchUnpair',\n DEVICE_STATUS = 'DeviceOnlineStatus',\n DEVICE_DESIRED_STATE = 'DevicePatchDesiredState',\n DEVICE_PUBLISHERS = 'DevicePatchPublishers',\n DEVICE_WARNINGS = 'DevicePatchWarnings',\n DEVICE_RENAME = 'DevicePatchRename',\n LOCAL_PRESETS = 'DevicePatchPresets',\n FILE_ADDED = 'FileAdded',\n FILE_CHANGED = 'FileChanged',\n FILE_REMOVED = 'FileRemoved',\n USER_CHANGE = 'UserChange',\n TEAM_MEMBER_CHANGE = 'TeamMemberChange',\n AFU_CHANGE = 'DevicePatchAfu',\n TEAM_CHANGE = 'TeamChange',\n NETWORK_CHANGE = 'DevicePatchNetwork',\n USER_NOTIFICATION = 'UserNotification',\n}\n","import {EVENT_TYPE} from 'app/api/WebSocket/constants';\n\nconst eventTypeSet: Set<string> = new Set(Object.values(EVENT_TYPE));\nconst unregisteredEventTypeSet: Set<string> = new Set();\n\nfunction checkEventsRegister(type: string) {\n if (!eventTypeSet.has(type) && !unregisteredEventTypeSet.has(type)) {\n unregisteredEventTypeSet.add(type);\n console.warn('Unregistered WebSocket event', `\"${type}\"`);\n }\n}\n\nfunction createDeviceALSEventName(deviceId: string) {\n return `${EVENT_TYPE.DEVICE_ALS}.${deviceId}`;\n}\n\nfunction createDeviceChannelImageEventName(channelDeviceId: string) {\n return `${EVENT_TYPE.DEVICE_CHANNEL_IMAGE}.${channelDeviceId}`;\n}\n\nfunction createDeviceSourceImageEventName(deviceId: string, sourceId: string) {\n return `${EVENT_TYPE.DEVICE_SOURCE_IMAGE}.${deviceId}.${sourceId}`;\n}\n\nfunction createDeviceChangeEventName(deviceId: string) {\n return `${EVENT_TYPE.DEVICE_CHANGE}.${deviceId}`;\n}\n\nexport {\n checkEventsRegister,\n createDeviceALSEventName,\n createDeviceChannelImageEventName,\n createDeviceSourceImageEventName,\n createDeviceChangeEventName,\n};\n","import {TranscribingStatus} from 'app/components/DeviceDetails/constants';\n\nconst FULL_DEVICE_ID_REGEX = /(^[0-9a-f]+)-?(\\d+)?/;\n\n// Channel ID: `{MASTER ID}-{CHANNEL ID}`\nconst CHANNEL_DEVICE_ID_INDEX_REGEX = /^[0-9a-f]+-(\\d+)/;\n\n/**\n * @param {string} channelId\n * @returns {string}\n */\nconst parseChannelDeviceShortId = (channelId) => channelId.match(CHANNEL_DEVICE_ID_INDEX_REGEX)[1];\n\nexport type DeviceIdentifier = [master: string, channelIdx: string];\n\nconst parseMasterAndChannelIds = (id: string): DeviceIdentifier => {\n const matches = FULL_DEVICE_ID_REGEX.exec(id);\n return [matches?.[1] ?? '', matches?.[2] ?? ''];\n};\n\nfunction getTranscriberStatus(started: boolean, paused: boolean): TranscribingStatus {\n if (!started) {\n return TranscribingStatus.Stopped;\n }\n\n if (paused) {\n return TranscribingStatus.Paused;\n }\n\n return TranscribingStatus.Started;\n}\n\nexport {parseChannelDeviceShortId, parseMasterAndChannelIds, getTranscriberStatus};\n","import EventEmitter from 'eventemitter3';\nimport {front} from 'app/api/CirrusApi';\nimport {EVENT_TYPE} from 'app/api/WebSocket/constants';\nimport {\n checkEventsRegister,\n createDeviceALSEventName,\n createDeviceChannelImageEventName,\n createDeviceSourceImageEventName,\n createDeviceChangeEventName,\n} from 'app/api/WebSocket/utils';\nimport {secondsToMilliseconds} from 'app/util/timeConverter';\nimport {Callback} from 'app/types/common';\nimport {\n WSDeviceAlsDto,\n WSDeviceChangeDto,\n WSDeviceChannelImageDto,\n WSDeviceSourceImageDto,\n WSMeetingChangedDto,\n WSParticipantUpdated,\n WSReturnFeedUpdated,\n WSTeamPresetChangedDto,\n WSTeamsCallUpdated,\n} from 'app/api/WebSocket/types';\nimport {parseMasterAndChannelIds} from 'app/components/DeviceDetails/utils';\nimport {Ws} from 'app/contracts/ws';\n\n/**\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent#Status_codes}\n */\nenum WebsocketCloseCodeNumber {\n NormalClosure = 1000,\n}\n\n/**\n * {@link https://github.com/websockets/ws/wiki/Websocket-client-implementation-for-auto-reconnect}\n */\nclass WS {\n private ws: WebSocket | null = null;\n private readonly emitter: EventEmitter = new EventEmitter();\n\n private readonly reconnectInitialTimeoutMs: number = secondsToMilliseconds(1);\n private readonly reconnectMaxTimeoutMs: number = secondsToMilliseconds(5);\n private reconnectTimeoutMs: number = this.reconnectInitialTimeoutMs;\n\n private reconnectTimeout;\n\n constructor() {\n this.onDeviceChannelImage = this.onDeviceChannelImage.bind(this);\n this.offDeviceChannelImage = this.offDeviceChannelImage.bind(this);\n this.wsOnClose = this.wsOnClose.bind(this);\n }\n\n on(type: string, listener: Callback) {\n if (this.ws === null) {\n this.init();\n }\n\n this.emitter.on(type, listener);\n }\n\n off(type: string, listener: Callback) {\n this.emitter.removeListener(type, listener);\n\n if (this.emitter.eventNames().length === 0) {\n this.reset();\n }\n }\n\n onDeviceALS(listener: Callback<void, [WSDeviceAlsDto]>, deviceId: string) {\n this.on(createDeviceALSEventName(deviceId), listener);\n }\n\n offDeviceALS(listener: Callback<void, [WSDeviceAlsDto]>, deviceId: string) {\n this.off(createDeviceALSEventName(deviceId), listener);\n }\n\n onDeviceChannelImage(\n listener: Callback<void, [WSDeviceChannelImageDto]>,\n channelDeviceId: string,\n ) {\n this.on(createDeviceChannelImageEventName(channelDeviceId), listener);\n }\n\n offDeviceChannelImage(\n listener: Callback<void, [WSDeviceChannelImageDto]>,\n channelDeviceId: string,\n ) {\n this.off(createDeviceChannelImageEventName(channelDeviceId), listener);\n }\n\n onDeviceSourceImage(\n listener: Callback<void, [WSDeviceSourceImageDto]>,\n deviceId: string,\n sourceId: string,\n ) {\n this.on(createDeviceSourceImageEventName(deviceId, sourceId), listener);\n }\n\n offDeviceSourceImage(\n listener: Callback<void, [WSDeviceSourceImageDto]>,\n deviceId: string,\n sourceId: string,\n ) {\n this.off(createDeviceSourceImageEventName(deviceId, sourceId), listener);\n }\n\n onDeviceGroupChange(listener: (message: Ws.GroupChange) => void) {\n this.on(EVENT_TYPE.DEVICE_GROUP_CHANGE, listener);\n }\n\n offDeviceGroupChange(listener: (message: Ws.GroupChange) => void) {\n this.off(EVENT_TYPE.DEVICE_GROUP_CHANGE, listener);\n }\n\n onDeviceChange(listener: Callback<void, [WSDeviceChangeDto]>, deviceId: string) {\n this.on(createDeviceChangeEventName(deviceId), listener);\n }\n\n offDeviceChange(listener: Callback<void, [WSDeviceChangeDto]>, deviceId: string) {\n this.off(createDeviceChangeEventName(deviceId), listener);\n }\n\n onTeamPresetChange(listener: Callback<void, [WSTeamPresetChangedDto]>) {\n this.on(EVENT_TYPE.TEAM_PRESET_CHANGED, listener);\n }\n\n offTeamPresetChange(listener: Callback<void, [WSTeamPresetChangedDto]>) {\n this.off(EVENT_TYPE.TEAM_PRESET_CHANGED, listener);\n }\n\n onMeetingChange(listener: Callback<void, [WSMeetingChangedDto]>) {\n this.on(EVENT_TYPE.MEETING_CHANGED, listener);\n }\n\n offMeetingChange(listener: Callback<void, [WSMeetingChangedDto]>) {\n this.off(EVENT_TYPE.MEETING_CHANGED, listener);\n }\n\n onParticipantUpdate(listener: Callback<void, [WSParticipantUpdated]>) {\n this.on(EVENT_TYPE.PARTICIPANT_UPDATED, listener);\n }\n\n offParticipantUpdate(listener: Callback<void, [WSParticipantUpdated]>) {\n this.off(EVENT_TYPE.PARTICIPANT_UPDATED, listener);\n }\n\n onReturnFeedUpdate(listener: Callback<void, [WSReturnFeedUpdated]>) {\n this.on(EVENT_TYPE.RETURN_FEED_UPDATED, listener);\n }\n\n offReturnFeedUpdate(listener: Callback<void, [WSReturnFeedUpdated]>) {\n this.off(EVENT_TYPE.RETURN_FEED_UPDATED, listener);\n }\n\n onTeamsCallUpdate(listener: Callback<void, [WSTeamsCallUpdated]>) {\n this.on(EVENT_TYPE.TEAMS_CALL_UPDATED, listener);\n }\n\n offTeamsCallUpdate(listener: Callback<void, [WSTeamsCallUpdated]>) {\n this.off(EVENT_TYPE.TEAMS_CALL_UPDATED, listener);\n }\n\n reset() {\n if (this.ws === null) {\n return;\n }\n\n this.resetReconnectTimeout();\n this.emitter.removeAllListeners();\n this.ws.removeEventListener('close', this.wsOnClose);\n this.ws.close(WebsocketCloseCodeNumber.NormalClosure);\n this.ws = null;\n }\n\n private init() {\n this.ws = new WebSocket(front.ws().url());\n\n this.ws.addEventListener('message', (event) => {\n const data = JSON.parse(event.data);\n const eventType = data.Kind;\n\n checkEventsRegister(eventType);\n\n if (eventType === EVENT_TYPE.DEVICE_ALS) {\n this.emitter.emit(createDeviceALSEventName(data.Body.DeviceID), data);\n } else if (eventType === EVENT_TYPE.DEVICE_CHANNEL_IMAGE) {\n this.emitter.emit(createDeviceChannelImageEventName(data.Body.DeviceID), data);\n } else if (eventType === EVENT_TYPE.DEVICE_SOURCE_IMAGE) {\n this.emitter.emit(\n createDeviceSourceImageEventName(data.Body.DeviceID, data.Body.SourceID),\n data,\n );\n } else if (eventType === EVENT_TYPE.DEVICE_CHANGE) {\n const [masterId] = parseMasterAndChannelIds(data.Body.DeviceID);\n this.emitter.emit(createDeviceChangeEventName(masterId), data);\n this.emitter.emit(eventType, data);\n } else {\n this.emitter.emit(eventType, data);\n }\n\n this.resetReconnectTimeout();\n });\n\n this.ws.addEventListener('close', this.wsOnClose);\n }\n\n private wsOnClose() {\n // Always try to reconnect the websocket\n this.reconnect();\n }\n\n private reconnect() {\n if (this.emitter.eventNames().length === 0) {\n return;\n }\n\n this.reconnectTimeout = setTimeout(() => this.init(), this.reconnectTimeoutMs);\n this.increaseTimeout();\n }\n\n private increaseTimeout() {\n this.reconnectTimeoutMs = Math.min(this.reconnectMaxTimeoutMs, this.reconnectTimeoutMs * 2);\n }\n\n private resetReconnectTimeout() {\n this.reconnectTimeoutMs = this.reconnectInitialTimeoutMs;\n window.clearTimeout(this.reconnectTimeout);\n }\n}\n\nconst ws = new WS();\n\nexport {ws as WS};\n","enum DeviceSettingType {\n Enum = 'enum',\n Number = 'number',\n NullableNumber = 'nullable_number',\n String = 'string',\n Bool = 'bool',\n Group = 'group',\n Color = 'color',\n AudioSource = 'audio_source',\n StreamUrl = 'stream_url',\n}\n\nenum DeviceSettingId {\n Encoder = 'encoder',\n Resolution = 'resolution',\n VideoBitrate = 'vbitrate',\n VideoFramerate = 'framerate',\n VideoCodec = 'video_codec',\n AudioEnabled = 'audio_enabled',\n AudioPreset = 'audio_preset',\n AudioBitrate = 'audio_bitrate',\n AudioChannels = 'audio_channels',\n\n Recorder = 'recorder',\n FileFormat = 'file_format',\n TimeLimit = 'time_limit',\n SizeLimit = 'size_limit',\n AfuEnabled = 'afu_enabled',\n\n // LiveScrypt\n AudioSources = 'audio_sources',\n HdmiOutput = 'hdmi_output',\n FrontScreenOutput = 'front_screen',\n WebStreamOutput = 'web_stream_output',\n}\n\nexport {\n DeviceSettingType,\n DeviceSettingId,\n};\n","import {DeviceSetting} from 'app/components/DeviceDetails/Models/types';\nimport {isNil} from 'app/util/isNil';\nimport {DeviceSettingId} from 'app/models/Device/Settings/constants';\n\nexport class BaseDeviceSettingModel {\n _setting: DeviceSetting;\n _valueFormattedCache: Record<string, string | number | boolean | undefined>;\n\n constructor(setting: DeviceSetting) {\n this._setting = setting;\n\n this._valueFormattedCache = {};\n }\n\n getId(): DeviceSettingId {\n return this._setting.id;\n }\n\n getLabel(): string {\n return this._setting.title;\n }\n\n getValue() {\n return this._setting.value;\n }\n\n getValueFormatted() {\n const value = this.getValue();\n\n if (isNil(this._valueFormattedCache[value as string])) {\n this._valueFormattedCache = {\n [value as string]: this._formatValue()\n };\n }\n\n return this._valueFormattedCache[value as string];\n }\n\n _formatValue() {\n return this.getValue();\n }\n\n getTypeName() {\n return this._setting.type.name;\n }\n\n getOptions() {\n return this._setting.type.options;\n }\n\n toJSON() {\n return this._setting;\n }\n}\n","import {BaseDeviceSettingModel} from 'app/models/Device/Settings/BaseDeviceSettingModel';\nimport {isNil} from 'app/util/isNil';\nimport {EnumTypeOptions} from 'app/components/DeviceDetails/Models/types';\n\nexport class EnumDeviceSettingModel extends BaseDeviceSettingModel {\n _formatValue() {\n let valueFormatted = this.getValue();\n\n const activeOption = (this.getOptions() as EnumTypeOptions).items.find(({value}) => value === this.getValue());\n if (isNil(activeOption) === false) {\n const label = activeOption?.title;\n if (!isNil(label)) {\n valueFormatted = label;\n }\n }\n\n return valueFormatted;\n }\n}\n","import {BaseDeviceSettingModel} from 'app/models/Device/Settings/BaseDeviceSettingModel';\nimport {DeviceSettingsCollection} from 'app/models/Device/Settings/DeviceSettingsCollection';\nimport {DeviceSetting} from 'app/components/DeviceDetails/Models/types';\n\nexport class GroupDeviceSettingModel extends BaseDeviceSettingModel {\n #settingsCollection: DeviceSettingsCollection | null = null;\n\n _getSettings() {\n // rework as any cast\n return (this._setting as any).items || [];\n }\n\n hasSettings() {\n return this._getSettings().length > 0;\n }\n\n getSettings(): DeviceSetting[] {\n return this._getSettings();\n }\n\n /**\n * @param {string} id\n * @return {BaseDeviceSettingModel|undefined}\n */\n getSettingModelById(id) {\n if (this.#settingsCollection === null) {\n this.#settingsCollection = new DeviceSettingsCollection({settings: this.getSettings()});\n }\n\n return this.#settingsCollection.getSettingModelById(id);\n }\n}\n","import {NumberTypeOptions} from 'app/components/DeviceDetails/Models/types';\nimport {BaseDeviceSettingModel} from 'app/models/Device/Settings/BaseDeviceSettingModel';\n\nexport class VideoBitrateDeviceSettingModel extends BaseDeviceSettingModel {\n _formatValue() {\n const value = this.getValue();\n\n if (value === '' || value === 0) {\n const options = this.getOptions() as NumberTypeOptions;\n\n return options?.placeholder;\n }\n\n return `${value} kbps`;\n }\n}\n","import {createDeviceSettingModel} from 'app/models/Device/Settings/Fabric';\nimport {DeviceSettingId} from 'app/models/Device/Settings/constants';\nimport {DeviceSetting} from 'app/components/DeviceDetails/Models/types';\nimport {ValueOf} from 'app/types/common';\n\n/**\n * TODO: Move specified methods to another collection\n */\ninterface Params {\n settings: DeviceSetting[];\n}\n\nexport class DeviceSettingsCollection {\n #settings: DeviceSetting[];\n #settingsMap: Map<ValueOf<DeviceSettingId>, any>;\n\n constructor({settings}: Params) {\n this.#settings = settings;\n\n this.#settingsMap = new Map();\n this.#settings.forEach(setting => {\n this.#settingsMap.set(setting.id, createDeviceSettingModel(setting));\n });\n }\n\n /**\n * @param {string} id\n * @return {BaseDeviceSettingModel}\n */\n getSettingModelById(id: string): any {\n return this.#settingsMap.get(id);\n }\n\n getSettingsArray() {\n return this.#settings;\n }\n\n /**\n * @param {string} groupId\n * @param {string} id\n * @return {BaseDeviceSettingModel|undefined}\n */\n #getGroupSettingItemById = (groupId: string, id: string) => {\n const group = this.getSettingModelById(groupId);\n if (!group) {\n return;\n }\n\n return group.getSettingModelById(id);\n };\n\n /**\n * @param {string} id\n * @return {BaseDeviceSettingModel|undefined}\n */\n #getEncoderSettingById = (id: any) => {\n return this.#getGroupSettingItemById(DeviceSettingId.Encoder, id);\n };\n\n /**\n * @return {BaseDeviceSettingModel|undefined}\n */\n getVideoCodecSetting() {\n return this.#getEncoderSettingById(DeviceSettingId.VideoCodec);\n }\n\n /**\n * @return {BaseDeviceSettingModel|undefined}\n */\n getVideoResolutionSetting() {\n return this.#getEncoderSettingById(DeviceSettingId.Resolution);\n }\n\n /**\n * @return {VideoBitrateDeviceSettingModel|undefined}\n */\n getVideoBitrateSetting() {\n return this.#getEncoderSettingById(DeviceSettingId.VideoBitrate);\n }\n\n /**\n * @return {VideoBitrateDeviceSettingModel|undefined}\n */\n getVideoFramerateSetting() {\n return this.#getEncoderSettingById(DeviceSettingId.VideoFramerate);\n }\n\n /**\n * @return {BaseDeviceSettingModel|undefined}\n */\n getAudioEnabledSetting() {\n return this.#getEncoderSettingById(DeviceSettingId.AudioEnabled);\n }\n\n /**\n * @return {BaseDeviceSettingModel|undefined}\n */\n getAudioPresetSetting() {\n return this.#getEncoderSettingById(DeviceSettingId.AudioPreset);\n }\n\n /**\n * @return {BaseDeviceSettingModel|undefined}\n */\n getAudioChannelsSetting() {\n return this.#getEncoderSettingById(DeviceSettingId.AudioChannels);\n }\n\n /**\n * @return {BaseDeviceSettingModel|undefined}\n */\n getAudioBitrateSetting() {\n return this.#getEncoderSettingById(DeviceSettingId.AudioBitrate);\n }\n\n /**\n * @param {string} id\n * @return {BaseDeviceSettingModel|undefined}\n */\n #getRecorderSettingById = (id: any) => {\n return this.#getGroupSettingItemById(DeviceSettingId.Recorder, id);\n };\n\n /**\n * @return {BaseDeviceSettingModel|undefined}\n */\n getRecorderFileFormatSetting() {\n return this.#getRecorderSettingById(DeviceSettingId.FileFormat);\n }\n\n /**\n * @return {BaseDeviceSettingModel|undefined}\n */\n getRecorderTimeLimitSetting() {\n return this.#getRecorderSettingById(DeviceSettingId.TimeLimit);\n }\n\n /**\n * @return {BaseDeviceSettingModel|undefined}\n */\n getRecorderSizeLimitSetting() {\n return this.#getRecorderSettingById(DeviceSettingId.SizeLimit);\n }\n\n /**\n * @return {BaseDeviceSettingModel|undefined}\n */\n getRecorderAfuEnabledSetting() {\n return this.#getRecorderSettingById(DeviceSettingId.AfuEnabled);\n }\n\n /**\n * @return {GroupDeviceSettingModel|undefined}\n */\n getAudioSourcesSettings() {\n return this.getSettingModelById(DeviceSettingId.AudioSources);\n }\n\n /**\n * @return {GroupDeviceSettingModel|undefined}\n */\n getHDMIOutputSettings() {\n return this.getSettingModelById(DeviceSettingId.HdmiOutput);\n }\n\n /**\n * @return {GroupDeviceSettingModel|undefined}\n */\n getFrontScreenOutputSettings() {\n return this.getSettingModelById(DeviceSettingId.FrontScreenOutput);\n }\n\n /**\n * @return {GroupDeviceSettingModel|undefined}\n */\n getWebStreamOutputSettings() {\n return this.getSettingModelById(DeviceSettingId.WebStreamOutput);\n }\n}\n","import {\n DeviceSettingId,\n DeviceSettingType,\n} from 'app/models/Device/Settings/constants';\nimport {BaseDeviceSettingModel} from 'app/models/Device/Settings/BaseDeviceSettingModel';\nimport {EnumDeviceSettingModel} from 'app/models/Device/Settings/EnumDeviceSettingModel';\nimport {GroupDeviceSettingModel} from 'app/models/Device/Settings/GroupDeviceSettingModel';\nimport {VideoBitrateDeviceSettingModel} from 'app/models/Device/Settings/VideoBitrateDeviceSettingModel';\n\nfunction createDeviceSettingModel(json) {\n if (\n json.id === DeviceSettingId.VideoBitrate &&\n (\n json.type.name === DeviceSettingType.Number ||\n json.type.name === DeviceSettingType.NullableNumber\n )\n ) {\n return new VideoBitrateDeviceSettingModel(json);\n }\n\n switch (json.type.name) {\n case DeviceSettingType.Enum:\n return new EnumDeviceSettingModel(json);\n case DeviceSettingType.Group:\n return new GroupDeviceSettingModel(json);\n default:\n return new BaseDeviceSettingModel(json);\n }\n}\n\nexport {\n createDeviceSettingModel,\n};\n","import {DeviceCapability} from 'app/components/DeviceDetails/constants';\n\nclass DeviceCapabilityService {\n canRecording(capabilities: Set<DeviceCapability>) {\n return capabilities.has(DeviceCapability.Recording);\n }\n\n canRecordViaState(capabilities: Set<DeviceCapability>) {\n return capabilities.has(DeviceCapability.StateRecording);\n }\n\n canUploading(capabilities: Set<DeviceCapability>) {\n return capabilities.has(DeviceCapability.Uploading);\n }\n\n canStreaming(capabilities: Set<DeviceCapability>) {\n return capabilities.has(DeviceCapability.StateStreaming);\n }\n\n canScheduling(capabilities: Set<DeviceCapability>) {\n return capabilities.has(DeviceCapability.StateScheduling);\n }\n\n canTranscribing(capabilities: Set<DeviceCapability>) {\n return capabilities.has(DeviceCapability.StateTranscribing);\n }\n\n canRemoteLogin(capabilities: Set<DeviceCapability>) {\n return capabilities.has(DeviceCapability.RemoteLogin);\n }\n\n canRebooting(capabilities: Set<DeviceCapability>) {\n return capabilities.has(DeviceCapability.Reboot);\n }\n\n supportsPresets(capabilities: Set<DeviceCapability>) {\n return capabilities.has(DeviceCapability.Presets);\n }\n\n supportsAudioLevels(capabilities: Set<DeviceCapability>) {\n return capabilities.has(DeviceCapability.AudioLevels);\n }\n\n supportsChannelPreviews(capabilities: Set<DeviceCapability>) {\n return capabilities.has(DeviceCapability.ChannelPreviews);\n }\n\n supportsCms(capabilities: Set<DeviceCapability>) {\n return capabilities.has(DeviceCapability.Cms);\n }\n\n supportsSourcePreviews(capabilities: Set<DeviceCapability>) {\n return capabilities.has(DeviceCapability.SourcePreviews);\n }\n\n supportsWsApi(capabilities: Set<DeviceCapability>) {\n return capabilities.has(DeviceCapability.WsApi);\n }\n}\n\nexport const deviceCapabilityService = new DeviceCapabilityService();\n","import {front} from 'app/api/CirrusApi';\n\nconst THROTTLING_DELAY_MILLISECONDS = 300;\n\nclass CommandDispatcher {\n protected commands = new Map();\n\n // TODO: TS {DEVICE_COMMAND_NAME|string} command\n async sendCommand(deviceId: string, command: string): Promise<any> {\n return this._sendCommand(deviceId, command, ({command, deviceIds}) => {\n return front.devices().batch_task().post({\n Devices: deviceIds,\n Task: {\n cmd: command,\n },\n });\n });\n }\n\n async audioLevels(deviceId: string): Promise<any> {\n return this._sendCommand(deviceId, '__audio_levels__', ({deviceIds}) => {\n return front.devices().request().audio_levels().post({\n Devices: deviceIds,\n });\n });\n }\n\n async channelPreviews(deviceId: string): Promise<any> {\n return this._sendCommand(deviceId, '__channel_previews__', ({deviceIds}) => {\n return front.devices().request().channel_previews().post({\n Devices: deviceIds,\n });\n });\n }\n\n async sourcePreviews(deviceId: string): Promise<any> {\n return this._sendCommand(deviceId, '__source_previews__', ({deviceIds}) => {\n return front.devices().request().source_previews().post({\n Devices: deviceIds,\n });\n });\n }\n\n private async _sendCommand(deviceId: string, command: string, request: (arg0: any) => Promise<any>): Promise<any> {\n if (this.commands.has(command) === false) {\n this.commands.set(command, {\n deviceIds: new Set(),\n commandCall: new Promise((resolve, reject) => {\n setTimeout(() => {\n request({\n command,\n deviceIds: [...this.commands.get(command).deviceIds],\n })\n .then((result) => {\n resolve(result);\n })\n .catch(reject);\n\n this.commands.delete(command);\n }, THROTTLING_DELAY_MILLISECONDS);\n }),\n });\n }\n\n if (!this.commands.get(command).deviceIds.has(deviceId)) {\n this.commands.get(command).deviceIds.add(deviceId);\n }\n\n return this.commands.get(command).commandCall;\n }\n}\n\nconst DeviceCommandDispatcher = new CommandDispatcher();\n\nexport {\n DeviceCommandDispatcher,\n};\n","/* eslint-disable @typescript-eslint/member-ordering */\nimport {DeviceCommand} from 'app/components/DeviceDetails/constants';\nimport {CommandOptions} from 'app/components/DeviceDetails/Models/types';\nimport {DeviceCommandDispatcher} from 'app/util/CommandDispatcher';\nimport {deviceApiService} from 'app/services/api/device/DeviceApiService';\n\nclass CommandService {\n private readonly send = async (\n id: string,\n command: DeviceCommand | string,\n options: CommandOptions = {},\n ) => {\n try {\n const res = await deviceApiService.sendCommand(id, command, options);\n return res;\n } catch {\n return undefined;\n }\n };\n\n private readonly stop = async (\n id: string,\n command: DeviceCommand | string,\n ) => {\n const res = await this.send(id, `${command}.stop`);\n return res;\n };\n\n private readonly start = async (\n id: string,\n command: DeviceCommand | string,\n ) => {\n const res = await this.send(id, `${command}.start`);\n return res;\n };\n\n reboot = async (id: string) => {\n const res = await this.send(id, DeviceCommand.Reboot);\n return res;\n };\n\n clearFootage = async (id: string) => {\n const res = await this.send(id, DeviceCommand.FootageClear);\n return res;\n };\n\n updateFirmware = async (id: string) => {\n const res = await this.send(id, DeviceCommand.FirmwareUpdate);\n return res;\n };\n\n audioLevels = async (id: string) => {\n try {\n const res = await DeviceCommandDispatcher.audioLevels(id);\n return res;\n } catch {\n return undefined;\n }\n };\n\n sourcePreviews = async (id: string) => {\n try {\n const res = await DeviceCommandDispatcher.sourcePreviews(id);\n return res;\n } catch {\n return undefined;\n }\n };\n\n channelPreviews = async (id: string) => {\n try {\n const res = await DeviceCommandDispatcher.channelPreviews(id);\n return res;\n } catch {\n return undefined;\n }\n };\n\n startRecording = async (id: string) => {\n const res = await this.start(id, DeviceCommand.Recording);\n return res;\n };\n\n stopRecording = async (id: string) => {\n const res = await this.stop(id, DeviceCommand.Recording);\n return res;\n };\n\n startUploading = async (id: string) => {\n const res = await this.start(id, DeviceCommand.Uploading);\n return res;\n };\n\n stopUploading = async (id: string) => {\n const res = await this.stop(id, DeviceCommand.Uploading);\n return res;\n };\n\n selectPublisher = async (id: string, value: boolean) => {\n const options: CommandOptions = {\n params: {\n id,\n config: {\n 'single-touch': value,\n }\n }\n };\n\n const res = await this.send(id, DeviceCommand.PublisherConfigure, options);\n return res;\n };\n\n startPublishers = async (id: string, ids: string[]) => {\n const res = await this.send(id, DeviceCommand.PublisherStart, {\n params: {\n publisher_ids: ids,\n }\n });\n\n return res;\n };\n\n stopPublishers = async (id: string, ids: string[]) => {\n const res = await this.send(id, DeviceCommand.PublisherStop, {\n params: {\n publisher_ids: ids,\n }\n });\n\n return res;\n };\n}\n\nexport const commandService = new CommandService();\n","import {render} from 'react-dom';\nimport {createElement} from 'react';\nimport {\n ToastContainer,\n toast,\n ToastContent,\n ToastOptions,\n} from 'react-toastify';\n\nconst SHOW_NOTIFICATION_TIMEOUT = 5000;\n\nconst Model = {\n _initialize() {\n this._render();\n },\n\n _render() {\n document.addEventListener('DOMContentLoaded', () => {\n render(createElement(ToastContainer, {\n position: toast.POSITION.TOP_RIGHT,\n autoClose: SHOW_NOTIFICATION_TIMEOUT,\n theme: 'colored',\n icon: false,\n hideProgressBar: false,\n newestOnTop: false,\n closeOnClick: true,\n rtl: false,\n // pauseOnVisibilityChange: true,\n draggable: false,\n pauseOnHover: true,\n }), document.querySelector('#notification-container'));\n });\n },\n};\n\nModel._initialize();\n\nconst Notifications = {\n addNotification(content: ToastContent, {\n className,\n progressClassName,\n autoClose,\n closeOnClick = true,\n ...rest\n }: ToastOptions) {\n toast(content, {\n className,\n progressClassName,\n autoClose,\n closeOnClick,\n ...rest,\n });\n },\n\n addInfoNotification(content: ToastContent) {\n toast.info(content);\n },\n\n addSuccessNotification(content: ToastContent) {\n toast.success(content);\n },\n\n addWarningNotification(content: ToastContent) {\n toast.warning(content);\n },\n\n addErrorNotification(content: ToastContent) {\n toast.error(content, {\n autoClose: false,\n });\n },\n};\n\nexport {\n Notifications,\n};\n","import dayjs from 'dayjs';\nimport moment, {DurationFormatSettings, Moment} from 'moment';\nimport 'moment-duration-format';\nimport {TimeStampSeconds} from 'app/types/common';\nimport {secondsToMilliseconds} from 'app/util/timeConverter';\n\nenum PlayerTimeFormat {\n Minutes = 'mm:ss',\n Hours = 'H:mm:ss',\n Days = 'D H:mm:ss',\n}\n\nconst DATE_FORMAT = 'D-MMM-YYYY';\nconst FULL_DATE_FORMAT = 'h:mm:ss A, D-MMM-YYYY';\nconst STARTED_AT_DATE_FORMAT = 'h:mm A, D-MMM-YYYY';\n\nconst formatDuration = (\n seconds: number | moment.Duration,\n format: string,\n trim: false | string = 'left',\n): string => {\n return moment.duration(seconds, 'seconds').format(format, {\n trim,\n trunc: true,\n });\n};\n\nconst formatHHMM = (seconds: number, delimiter = ':'): string =>\n formatDuration(seconds, `HH${delimiter}mm`, false);\n\nconst formatHHMMSS = (seconds: number, delimiter = ':'): string =>\n formatDuration(seconds, `HH${delimiter}mm${delimiter}ss`, false);\n\nconst formatPlayback = (seconds: number): string => {\n const duration = moment.duration(seconds, 'seconds');\n let format = PlayerTimeFormat.Minutes;\n\n if (duration.asHours() >= 1) {\n format = PlayerTimeFormat.Hours;\n }\n\n if (duration.asDays() >= 1) {\n format = PlayerTimeFormat.Days;\n }\n\n return formatDuration(seconds, format, false);\n};\n\nconst formatMaintenanceNotification = (time: string): string => {\n const momentDate = moment(time);\n return momentDate.isValid() ? momentDate.format('LLL') : '';\n};\n\n/**\n * ```typescript\n * formatDate(1567437911.459); //=> \"2-Sep-2019\"\n * ```\n */\nconst formatDate = (seconds: number): string => moment.unix(seconds).format(DATE_FORMAT);\n\n/**\n * ```typescript\n * formatAbbreviatedDate(1629894677); //=> \"Aug 25\"\n * ```\n */\nconst formatAbbreviatedDate = (timestamp: TimeStampSeconds): string =>\n moment.unix(timestamp).format('MMM DD');\n\n/**\n * ```typescript\n * formatAbbreviatedDateWithYear(1629894677); //=> \"Aug 25, 2021\"\n * ```\n */\nconst formatAbbreviatedDateWithYear = (timestamp: TimeStampSeconds): string =>\n moment.unix(timestamp).format('MMM DD, YYYY');\n\nconst formatDateTime = (seconds: number, formatString: string): string =>\n moment.unix(seconds).format(formatString);\n\n/**\n * ```typescript\n * formatFullDate(1567437911.459); //=> \"6:25:11 PM, 2-Sep-2019\"\n * ```\n */\nconst formatFullDate = (seconds: number): string => moment.unix(seconds).format(FULL_DATE_FORMAT);\n\n/**\n * ```typescript\n * formatStartedAtDate(1567437911.459); //=> \"6:25 PM, 2-Sep-2019\"\n * ```\n */\nconst formatStartedAtDate = (seconds: number): string =>\n moment.unix(seconds).format(STARTED_AT_DATE_FORMAT);\n\n/**\n * ```typescript\n * formatTimeOfDay(1567437911.459); //=> \"06:25\"\n * ```\n */\nconst formatTimeOfDay = (seconds: number): string => moment.unix(seconds).format('hh:mm');\n\n/**\n * ```typescript\n * formatTwentyFourTimeOfDay(1567437911.459); //=> \"18:25\"\n * ```\n */\nconst formatTwentyFourTimeOfDay = (timestamp: TimeStampSeconds): string =>\n moment.unix(timestamp).format('HH:mm');\n\n/**\n * ```typescript\n * formatFullTimeOfDay(1567437911.459); //=> \"06:25 PM\"\n * ```\n */\nconst formatFullTimeOfDay = (seconds: number): string => moment.unix(seconds).format('hh:mm A');\n\n/**\n * ```typescript\n * formatYYYYMMDD(1567437911.459); //=> \"2019-09-02\"\n * ```\n */\nconst formatYYYYMMDD = (seconds: number): string => moment.unix(seconds).format('YYYY-MM-DD');\n\n/**\n * ```typescript\n * formatDatetimeSource(1567437911.459); //=> \"2019-09-02T06:25\"\n * ```\n */\nconst formatDatetimeSource = (seconds: number): string =>\n moment.unix(seconds).format('YYYY-MM-DDThh:mm');\n\nenum UptimeFormat {\n Seconds = 'ss [seconds]',\n Minutes = 'mm:ss',\n Hours = 'hh:mm:ss',\n Days = 'd[\\u00A0][days] hh:mm:ss',\n}\n\n/**\n * @param seconds start timestamp in seconds\n * @param currentSeconds current timestamp in seconds\n */\nconst formatUptime = (seconds: number, currentSeconds?: number): string => {\n const currentTimeStamp =\n typeof currentSeconds === 'number' ? moment.unix(currentSeconds) : moment();\n const duration = currentTimeStamp.diff(moment.unix(seconds));\n const durationSeconds = moment.duration(duration, 'milliseconds');\n\n let format = UptimeFormat.Seconds;\n\n if (durationSeconds.asMinutes() >= 1) {\n format = UptimeFormat.Minutes;\n }\n\n if (durationSeconds.asHours() >= 1) {\n format = UptimeFormat.Hours;\n }\n\n if (durationSeconds.asDays() >= 1) {\n format = UptimeFormat.Days;\n }\n\n return formatDuration(durationSeconds, format, false);\n};\n\n/**\n * ```typescript\n * timeFromDate(1629800177, 1629894677); //=> \"a day\"\n * ```\n */\nconst timeFromDate = (timestampStart: TimeStampSeconds, timestampEnd: TimeStampSeconds): string => {\n return moment(formatYYYYMMDD(timestampEnd)).from(formatYYYYMMDD(timestampStart), true);\n};\n\n/**\n * ```typescript\n * formatDayFromNow('2021-03-25'); //=> \"Today\"\n * formatDayFromNow('2021-03-24'); //=> \"Yesterday\"\n * formatDayFromNow('2021-03-23'); //=> \"2 days ago\"\n * ```\n */\nconst formatDayFromNow = (date: string): string => {\n const momentDate = moment(date);\n const today = moment().startOf('day');\n const yesterday = moment().add(-1, 'days').startOf('day');\n\n if (momentDate.isSame(today, 'day')) {\n return 'Today';\n }\n\n if (momentDate.isSame(yesterday, 'day')) {\n return 'Yesterday';\n }\n\n return momentDate.from(today);\n};\n\n/**\n * ```typescript\n * formatDateFromNow('2021-03-25'); //=> \"Today, Mar 25\"\n * formatDateFromNow('2021-03-24'); //=> \"Yesterday, Mar 24\"\n * formatDateFromNow('2021-03-23'); //=> \"2 days ago, Mar 23\"\n * ```\n */\nconst formatDateFromNow = (date: string): string =>\n `${formatDayFromNow(date)}, ${moment(date).format('MMM D')}`;\n\nexport function timestampFromNow(timestamp: number): string {\n const now = dayjs();\n const instance = dayjs.unix(timestamp);\n\n let day = instance.fromNow();\n\n if (now.isSame(instance, 'day')) {\n day = 'today';\n } else if (now.subtract(1, 'day').isSame(instance, 'day')) {\n day = 'yesterday';\n }\n\n return `${day}, ${instance.format('ll')}`;\n}\n\n/**\n * ```typescript\n * timeHHMMToMilliseconds('22:31'); //=> 81060000\n * ```\n */\nconst timeHHMMToMilliseconds = (time: string): number => moment.duration(time).asMilliseconds();\n\n/**\n * ```typescript\n * dateYYYYMMDDToMilliseconds('2017-09-03'); //=> 1504386000000\n * ```\n */\nconst dateYYYYMMDDToMilliseconds = (date: string): number =>\n secondsToMilliseconds(moment(date, 'YYYY-MM-DD', true).unix());\n\n/**\n * ```typescript\n * isValidYYYYMMDD('2017-09-03'); //=> true\n * ```\n */\nconst isValidYYYYMMDD = (date: string): boolean => moment(date, 'YYYY-MM-DD', true).isValid();\n\n/**\n * ```typescript\n * getTimeToDate(moment().add({m: 22, s: 13})) => 00:22:13\n * getTimeToDate(moment().add({h: 2, m: 22})) => 2 hours 22 mins\n * getTimeToDate(moment().add({h: 5, m: 22})) => 5 hours\n * getTimeToDate(moment().add({d: 3, h: 5, m: 22})) => 3 days 5 hours\n * ```\n */\nconst getTimeToDate = (\n timestamp: TimeStampSeconds,\n settings: DurationFormatSettings = {},\n): string => {\n const diff = moment.unix(timestamp).diff(moment());\n const duration = moment.duration(diff).abs();\n\n if (duration.asHours() < 1) {\n return duration.format('hh:mm:ss', {trim: false});\n }\n\n if (duration.asHours() < 4) {\n return duration.format('h [hours] m [mins]', {trunc: true});\n }\n\n if (duration.asHours() < 24) {\n return duration.format('h [hours]', {trunc: true});\n }\n\n return duration.format('d [days] h [hours]', {...settings, trunc: true});\n};\n\nexport function counterFormat(timestamp: TimeStampSeconds) {\n const diff = moment.unix(timestamp).diff(moment());\n const duration = moment.duration(diff).abs();\n\n return duration.format('hh:mm:ss', {trim: false});\n}\n\nconst isSameDay = (first: Moment, second: Moment): boolean => {\n return first.isSame(second, 'days');\n};\n\nconst isPassedTimestamp = (timestamp: TimeStampSeconds) => {\n return moment.unix(timestamp).isBefore(moment(), 'seconds');\n};\n\nconst isAfterDay = (timestampStart: TimeStampSeconds, timestampEnd: TimeStampSeconds): boolean => {\n return moment.unix(timestampEnd).isAfter(moment.unix(timestampStart), 'day');\n};\n\n/**\n * ```typescript\n * getCountdownToTimestamp((Date.now() / 1000) + 3600); //=> \"01:00:00\"\n * ```\n */\nconst getCountdownToTimestamp = (timestamp: TimeStampSeconds) => {\n const target = moment.unix(timestamp);\n return formatHHMMSS(target.diff(moment(), 'seconds'));\n};\n\n/**\n * ```typescript\n * dateTimeStampStringToSeconds(\"2021-12-02T20:40:51Z\"); //=> 1638477651\n * ```\n */\nconst dateTimeStampStringToSeconds = (date: string): TimeStampSeconds => moment(date).unix();\n\nexport {\n formatHHMM,\n formatHHMMSS,\n formatDate,\n formatDateTime,\n formatPlayback,\n formatFullDate,\n formatStartedAtDate,\n formatTimeOfDay,\n formatAbbreviatedDate,\n formatAbbreviatedDateWithYear,\n formatFullTimeOfDay,\n formatTwentyFourTimeOfDay,\n formatYYYYMMDD,\n formatDatetimeSource,\n formatUptime,\n timeFromDate,\n formatDayFromNow,\n formatDateFromNow,\n formatMaintenanceNotification,\n timeHHMMToMilliseconds,\n dateYYYYMMDDToMilliseconds,\n isValidYYYYMMDD,\n getTimeToDate,\n isSameDay,\n isPassedTimestamp,\n isAfterDay,\n getCountdownToTimestamp,\n dateTimeStampStringToSeconds,\n};\n","export enum WarningSeverity {\n Error = 'error',\n Warning = 'warning',\n}\n","/* eslint-disable @typescript-eslint/member-ordering */\nimport {front} from 'app/api/CirrusApi';\nimport {noop} from 'app/util/noop';\nimport {forEachObjIndexed} from 'ramda';\n\ntype BaseConfigurationItem = {\n id: string;\n title: string;\n description?: string;\n};\n\ntype ConfigurationItemEnum = BaseConfigurationItem & {\n value: string;\n type: {\n name: 'enum';\n options: {\n items: Array<{value: string; title: string}>;\n };\n };\n};\n\ntype ConfigurationItemBoolean = BaseConfigurationItem & {\n value: boolean;\n type: {\n name: 'bool';\n };\n};\n\ntype ConfigurationItemString = BaseConfigurationItem & {\n value: string;\n type: {\n name: 'string';\n };\n};\n\ntype ConfigurationItem = ConfigurationItemString | ConfigurationItemBoolean | ConfigurationItemEnum;\n\nclass TranscriptionConfigurationModel {\n private initialized = false;\n private configuration: ConfigurationItem[] = [];\n private readonly promise: Promise<unknown>;\n private resolve: any = noop;\n private reject: any = noop;\n\n constructor() {\n this.promise = new Promise((resolve, reject) => {\n this.resolve = resolve;\n this.reject = reject;\n });\n }\n\n private init() {\n this.initialized = true;\n\n return front.transcribing().configuration().get()\n .then((response: ConfigurationItem[]) => {\n this.configuration = [];\n\n forEachObjIndexed((option: any) => {\n delete option.config_key;\n this.configuration.push(option);\n })(response);\n\n this.resolve(this.configuration);\n })\n .catch(() => this.reject());\n }\n\n /**\n * @param {Object} configuration\n * @returns {Promise<Array>}\n */\n async processSettings(configuration: Record<string, any>) {\n if (this.initialized === false) {\n this.init();\n }\n\n return this.promise\n .then(() => {\n return this.configuration.map(option => {\n return {\n ...option,\n value: configuration[option.id],\n };\n });\n });\n }\n\n prepareSettings(settings) {\n return settings.reduce((acc, setting) => {\n acc[setting.id] = setting.value;\n return acc;\n }, {});\n }\n}\n\nexport const TranscriptionConfiguration = new TranscriptionConfigurationModel();\n","import {front} from 'app/api/CirrusApi';\nimport {TranscriberConfigDto} from 'app/store/dto/device/Device';\n\nclass TranscriberApiService {\n setUserDefinedUrl = async (\n id: string,\n url: string,\n ) => front.devices(id).transcribe().id().post({id: url});\n\n clearSession = async (\n id: string,\n session: string,\n ) => front.transcribing(id).sessions(session).clear().post();\n\n updateConfig = async (\n id: string,\n config: TranscriberConfigDto,\n ) => front.devices(id).transcribe().configuration().put(config);\n\n start = async (id: string) => front.devices(id).transcribe().start().post();\n\n stop = async (id: string) => front.devices(id).transcribe().stop().post();\n\n pause = async (id: string) => front.devices(id).transcribe().pause().post();\n\n resume = async (id: string) => front.devices(id).transcribe().resume().post();\n}\n\nexport const transcriberApiService = new TranscriberApiService();\n","enum DEVICE_PUBLISHER_TYPE {\n DASH = 'dash',\n HLS = 'hls',\n MPEGTS_RTP = 'mpegts-rtp',\n MPEGTS_UDP = 'mpegts-udp',\n NDI = 'ndi',\n RTMP = 'rtmp',\n RTP_UDP = 'rtp-udp',\n RTSP = 'rtsp',\n SRT = 'srt',\n}\n\nenum DEVICE_PUBLISHER_SETTING_ID {\n NAME = 'name',\n SINGLE_TOUCH = 'single-touch',\n}\n\nenum DEVICE_PUBLISHER_STATE {\n STARTED = 'started',\n STARTING = 'starting',\n STOPPED = 'stopped',\n ERROR = 'error',\n}\n\n/* new enums */\nenum PublisherType {\n Dash = 'dash',\n Hls = 'hls',\n MpegtsRtp = 'mpegts-rtp',\n MpegtsUdp = 'mpegts-udp',\n Ndi = 'ndi',\n Rtmp = 'rtmp',\n RtpUdp = 'rtp-udp',\n Rtsp = 'rtsp',\n Srt = 'srt',\n}\n\nenum PublisherState {\n Started = 'started',\n Starting = 'starting',\n Stopped = 'stopped',\n Error = 'error',\n}\n\nenum PublisherSettingId {\n Name = 'name',\n SingleTouch = 'single-touch',\n}\n\nexport {\n DEVICE_PUBLISHER_TYPE,\n DEVICE_PUBLISHER_SETTING_ID,\n DEVICE_PUBLISHER_STATE,\n /* new enums */\n PublisherType,\n PublisherState,\n PublisherSettingId,\n};\n","import {DeviceModel} from 'app/components/DeviceDetails/constants';\nimport {ChannelDto} from 'app/store/dto/channel/Channel';\nimport {\n CommonDeviceDto,\n DeviceDetailsDto,\n DeviceDto,\n WarningDto,\n} from 'app/store/dto/device/Device';\nimport {isCommonDeviceDto} from 'app/store/dto/device/typeGuards';\nimport {isNil} from 'app/util/isNil';\nimport {Channel} from 'app/store/models/channel/Channel';\nimport {DeviceGroupInfo, Warning} from 'app/store/models/types';\nimport {Device} from 'app/store/models/device/Device';\nimport {DeviceChannels} from 'app/store/models/device/types';\nimport {Device as DeviceType} from 'app/components/DeviceDetails/Models/types';\nimport {DeviceModelNameDto} from 'app/store/dto/common';\n\nexport function getDeviceModel(dto: CommonDeviceDto | DeviceDetailsDto | DeviceType): DeviceModel {\n return processDetectingDeviceModel(dto.Model);\n}\n\nexport function processDetectingDeviceModel(\n modelName: DeviceModelNameDto | undefined,\n): DeviceModel {\n if (!modelName) {\n return DeviceModel.Pearl2;\n }\n\n if (modelName.toLowerCase().startsWith('wcx2')) {\n return DeviceModel.Webcaster;\n }\n\n switch (modelName.toLowerCase()) {\n case 'demo':\n return DeviceModel.Demo;\n\n case 'webcaster':\n return DeviceModel.Webcaster;\n\n case 'pearl-livescrypt':\n return DeviceModel.LiveScrypt;\n\n case 'pearl-slot':\n return DeviceModel.Channel;\n\n case 'pearl-master':\n case 'pearl-2':\n return DeviceModel.Pearl2;\n\n case 'pearl virtual lite':\n case 'pearl virtual':\n return DeviceModel.PearlVirtual;\n\n case 'epiphan unify project':\n return DeviceModel.Unify;\n\n case 'pearl mini':\n return DeviceModel.PearlMini;\n\n case 'pearl nano es2':\n case 'pearl nano':\n return DeviceModel.PearlNano;\n\n case 'pearl nexus':\n return DeviceModel.PearlNexus;\n\n default:\n return DeviceModel.Pearl2;\n }\n}\n\nexport function getGroupInfo(dto: DeviceDto): DeviceGroupInfo | undefined {\n if (isCommonDeviceDto(dto)) {\n if (dto.group_id) {\n return {\n id: dto.group_id,\n };\n }\n\n return undefined;\n }\n\n const {id, name} = dto.Group;\n if (id) {\n return {id, name};\n }\n\n return undefined;\n}\n\nexport function mapChannelsDto(\n masterDevice: Device,\n dtos?: ChannelDto[],\n): DeviceChannels | undefined {\n if (!isNil(dtos)) {\n return dtos.reduce<DeviceChannels>((acc, dto) => {\n const channel = new Channel(masterDevice, dto);\n acc[channel.index] = channel;\n return acc;\n }, {});\n }\n}\n\nexport function mapDeviceWarnings(warnings: WarningDto[], channels?: DeviceChannels): Warning[] {\n const result: Warning[] = [];\n\n warnings.forEach((warning) => {\n const {channel_id} = warning;\n\n if (isNil(channel_id)) {\n const {channel_id, ...rest} = warning;\n result.push({...rest});\n } else {\n const {id, message} = warning;\n\n const channel = channels?.[channel_id];\n\n if (channel) {\n result.push({\n ...warning,\n id: `${id}_${channel_id}`,\n message: `Channel '${channel.name}': ${message}`,\n });\n }\n }\n });\n\n return result;\n}\n","import {isNil} from 'app/util/isNil';\nimport {front} from 'app/api/CirrusApi';\nimport {CommandOptions, Device, DeviceSetting} from 'app/components/DeviceDetails/Models/types';\nimport {CommonDeviceDto, DeviceDetailsDto} from 'app/store/dto/device/Device';\nimport {GetAbortCallback} from 'app/api/types';\nimport {ModelService} from 'app/services/deviceModel/DeviceModelService';\nimport {getDeviceModel} from 'app/store/models/device/utils';\nimport {Schedule} from 'app/domain/schedule';\nimport {EdgeContract} from 'app/contracts/edge';\nimport {CloudContract} from 'app/contracts/cloud';\nimport {Edge} from 'app/domain/edge';\n\nexport class DeviceApiService {\n rename = async (id: string, name: string) => front.devices(id).rename().post({Name: name});\n\n sendCommand = async (id: string, command: string, opt: CommandOptions) =>\n front\n .devices(id)\n .task()\n .post({cmd: command, ...opt});\n\n startStreaming = async (deviceId: string, destination: string) =>\n front.streams(destination).start().post({DeviceID: deviceId});\n\n stopStreaming = async (deviceId: string, destination: string) =>\n front.streams(destination).stop().post({DeviceID: deviceId});\n\n static async getSources(\n deviceId: string,\n getAbort?: GetAbortCallback,\n ): Promise<EdgeContract.Source[]> {\n const result = await front.devices(deviceId).sources().get(undefined, {getAbort});\n\n if (isNil(result) || !Array.isArray(result)) {\n return [];\n }\n return result;\n }\n\n static async getSystemStatus(\n deviceId: string,\n getAbort?: GetAbortCallback,\n ): Promise<EdgeContract.System | null> {\n return front.devices(deviceId).system().status().get(undefined, {getAbort});\n }\n\n static async getStorage(\n deviceId: string,\n getAbort?: GetAbortCallback,\n ): Promise<EdgeContract.Storage | null> {\n return front.devices(deviceId).storage().get(undefined, {getAbort});\n }\n\n deleteUnifyProject = async (projectId: string, teamId: string): Promise<void> =>\n front.team(teamId).devices().vpearl(projectId).delete();\n\n pairRealDevice = async (teamId: string, dto: Payloads.Cloud.PairDevice): Promise<{ID: string}> =>\n front.team(teamId).devices().post(dto);\n\n deleteDevice = async (deviceId: string): Promise<void> => front.devices(deviceId).delete();\n\n stopUnifyProject = async (deviceId: string): Promise<void> =>\n front.devices().vpearl(deviceId).stop().post();\n\n static async getUrlRemoteLogin(deviceId: string): Promise<EdgeContract.RemoteLogin> {\n return front.devices(deviceId).remote_login().get();\n }\n\n static async getProjects<T = CommonDeviceDto>(getAbort?: GetAbortCallback): Promise<T[]> {\n return front.devices().vpearls().get(undefined, {getAbort});\n }\n\n static async retrieveDevice(id: string): Promise<Device> {\n return front.devices(id).get(undefined);\n }\n\n static async getPairedSummary(): Promise<CloudContract.PairedSummary> {\n return front.devices().devicenumbers().get(undefined);\n }\n\n static async getTeamPairedCount(teamId: string): Promise<CloudContract.PairedSummary> {\n return front.team(teamId).devices().devicenumbers().get();\n }\n\n static async pairDevice(teamId: string, p: Payloads.Cloud.PairDevice): Promise<{ID: string}> {\n return front.team(teamId).devices().post(p);\n }\n\n static async getGroups(teamId: string): Promise<Edge.Group[]> {\n return front.team(teamId).groups().get();\n }\n\n static async createUnify(teamId: string, payload: {name: string}) {\n return front.team(teamId).devices().vpearl().post(payload);\n }\n\n static async getUnits(ids: string[] = []): Promise<Device[]> {\n return front.devices().get(ids.length ? `ids=${ids.join(',')}` : undefined);\n }\n\n static async getFirmware(\n deviceId: string,\n getAbort?: GetAbortCallback,\n ): Promise<Edge.Firmware | null> {\n return front.devices(deviceId).update().status().get(undefined, {getAbort});\n }\n\n static async getDevicesFirmware(ids: string[]): Promise<Record<string, Edge.Firmware>> {\n return front.devices().firmware().update().status().post({devices: ids});\n }\n\n async getDevices<T = CommonDeviceDto>(getAbort: GetAbortCallback): Promise<T[]> {\n const all = (await front.devices().get(undefined, {getAbort})) as T[];\n return all.filter((d) => !ModelService.isUnify(getDeviceModel(d as any)));\n }\n\n async getDevice<T = DeviceDetailsDto>(deviceId: string, getAbort?: GetAbortCallback): Promise<T> {\n return front.devices(deviceId).get(undefined, {getAbort});\n }\n\n async getDeviceSettings(deviceId: string, getAbort?: GetAbortCallback): Promise<DeviceSetting[]> {\n return front\n .devices(deviceId)\n .settings()\n .get(undefined, {getAbort})\n .then((settings: DeviceSetting[]) => {\n return settings ?? [];\n })\n .catch(() => {\n return [];\n });\n }\n\n static async batchTask(command: Payloads.Device.BatchCommand) {\n return front.devices().batch_task().post(command);\n }\n\n static async getDestinations(): Promise<CloudContract.StreamDestination[]> {\n return front.streams().get();\n }\n\n static getSnapshotUrl(id: string): string {\n return front.devices(id).preview().url();\n }\n\n static setDeviceCms(id: string, cms: Schedule.Cms | '') {\n return front.devices(id).cms().put({cms});\n }\n\n static getTranscriberSessions(\n deviceId: string,\n ): Promise<{data: EdgeContract.TranscribeSession[]} | null> {\n return front.transcribing(deviceId).sessions().get(undefined);\n }\n\n static getNexusPairingFile(): string {\n return front.devices().pairing_stick().url();\n }\n\n static getTranscriberSessionUrl(\n deviceId: string,\n sessionId: string,\n type: 'srt' | 'txt',\n ): string {\n const base = front.transcribing(deviceId).sessions(sessionId);\n\n if (type === 'srt') {\n return base.srt().url();\n }\n\n return base.txt().url();\n }\n\n static deleteTranscribeSession(deviceId: string, sessionId: string): Promise<void> {\n return front.transcribing(deviceId).sessions(sessionId).delete();\n }\n\n static async startProject(deviceId: string): Promise<void> {\n return front.devices().vpearl(deviceId).resume().post();\n }\n static async stopProject(deviceId: string): Promise<void> {\n return front.devices().vpearl(deviceId).stop().post();\n }\n\n static async deleteProject(projectId: string, teamId: string): Promise<void> {\n return front.team(teamId).devices().vpearl(projectId).delete();\n }\n\n static async deleteDevice(deviceId: string): Promise<void> {\n return front.devices(deviceId).delete();\n }\n\n static async sendBatchTask(\n command: string,\n devices: string[],\n ): Promise<EdgeContract.BatchResponse> {\n return front\n .devices()\n .batch_task()\n .post({\n Devices: devices,\n Task: {cmd: command},\n });\n }\n}\n\nexport const deviceApiService = new DeviceApiService();\n","import React, {useState} from 'react';\nimport {\n Box,\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n Typography,\n} from '@mui/material';\nimport {LoadingButton} from '@mui/lab';\nimport {useMounted} from 'app/hooks/useIsMounted';\nimport {Prompt} from 'app/types/common';\n\ntype Props = {\n loading: boolean;\n onUpgrade: () => Promise<void>;\n onClose: () => void;\n};\n\nfunction UpgradeFirmware({loading, onUpgrade, onClose}: Props) {\n return (\n <Box>\n <DialogTitle>Upgrade firmware</DialogTitle>\n\n <DialogContent>\n <Typography textAlign=\"center\">\n During update process, device will be offline. <br />\n Device will reboot automatically after the firmware has been downloaded.\n </Typography>\n </DialogContent>\n\n <DialogActions>\n <LoadingButton\n data-id=\"confirm-upgrade-btn\"\n sx={{minWidth: 70}}\n loading={loading}\n variant=\"contained\"\n color=\"secondary\"\n disableRipple={false}\n onClick={onUpgrade}\n >\n Upgrade\n </LoadingButton>\n\n <Button\n data-id=\"cancel-upgrade-btn\"\n sx={{minWidth: 70}}\n variant=\"outlined\"\n color=\"info\"\n disableRipple={false}\n onClick={onClose}\n >\n Cancel\n </Button>\n </DialogActions>\n </Box>\n );\n}\n\ntype PromptProps = Prompt & {\n onUpgrade: () => Promise<void>;\n};\n\nexport function UpgradeFirmwareDialog({open, onUpgrade, onClose}: PromptProps) {\n const [loading, setLoading] = useState(false);\n\n const mounted = useMounted();\n\n const handleUpgrade = async () => {\n try {\n setLoading(true);\n await onUpgrade();\n } finally {\n if (mounted()) {\n setLoading(false);\n }\n }\n };\n\n return (\n <Dialog open={open} onClose={onClose}>\n <UpgradeFirmware loading={loading} onUpgrade={handleUpgrade} onClose={onClose} />\n </Dialog>\n );\n}\n","import React, {useState} from 'react';\nimport {Box, Button, Stack, Typography} from '@mui/material';\nimport {useFirmwareQuery} from 'app/components/features/edge/hooks/useFirmwareQuery';\nimport {Sx} from 'app/types/common';\nimport {UpgradeFirmwareDialog} from 'app/components/features/edge/dialogs/UpgradeFirmwareDialog/UpgradeFirmwareDialog';\n\ninterface Props extends Sx {\n deviceId: string;\n onUpgrade: () => Promise<void>;\n}\n\nexport function FirmwareState({sx, deviceId, onUpgrade}: Props) {\n const [dialog, setDialog] = useState(false);\n const {data, isSuccess, refetch} = useFirmwareQuery({deviceId, enabled: true});\n\n const handleUpgrade = async () => {\n await onUpgrade();\n\n await refetch();\n };\n\n const renderContent = () => {\n if (!isSuccess) {\n return <Typography>Checking for updates</Typography>;\n }\n\n if (!data?.update) {\n return <Typography color=\"text.disabled\">No updates available</Typography>;\n }\n\n const {status} = data.update;\n\n if (status === 'downloading' || status === 'progress') {\n return (\n <Typography data-id=\"upgrade-status\" color=\"text.secondary\">\n Upgrading firmware\n </Typography>\n );\n }\n\n if (status === 'available' && data.available) {\n return (\n <Stack direction=\"row\" alignItems=\"center\" gap={2}>\n <Typography>\n New version <strong data-id=\"new-available-version\">{data.available}</strong> is\n available\n </Typography>\n\n <Button\n data-id=\"upgrade-btn\"\n variant=\"outlined\"\n size=\"small\"\n onClick={() => setDialog(true)}\n >\n Upgrade\n </Button>\n\n <UpgradeFirmwareDialog\n open={dialog}\n onUpgrade={handleUpgrade}\n onClose={() => setDialog(false)}\n />\n </Stack>\n );\n }\n };\n\n return <Box sx={sx}>{renderContent()}</Box>;\n}\n","import {useQuery} from '@tanstack/react-query';\nimport {DeviceApiService} from 'app/services/api/device/DeviceApiService';\n\ntype Args = {\n deviceId: string;\n enabled: boolean;\n refetchInterval?: number;\n};\n\nexport function useFirmwareQuery({deviceId, enabled, refetchInterval}: Args) {\n return useQuery({\n queryKey: ['device', 'firmware', deviceId],\n queryFn: async () => {\n const response = await DeviceApiService.getFirmware(deviceId);\n return response;\n },\n enabled,\n refetchInterval,\n });\n}\n","type Params = {\n capabilities?: string[];\n};\n\nclass BaseCapabilities {\n private readonly capabilities: Set<string>;\n\n constructor({\n capabilities = [],\n }: Params) {\n this.capabilities = new Set(capabilities);\n }\n\n protected check(capability: string) {\n return this.capabilities.has(capability);\n }\n}\n\nexport {BaseCapabilities};\n","import {BaseCapabilities} from 'app/models/Capabilities/BaseCapabilities';\nimport {DeviceCapability} from 'app/components/DeviceDetails/constants';\n\nclass DeviceCapabilities extends BaseCapabilities {\n supportsChannelPreviews() {\n return this.check(DeviceCapability.ChannelPreviews);\n }\n\n supportsSourcePreviews() {\n return this.check(DeviceCapability.SourcePreviews);\n }\n\n supportsWsApi() {\n return this.check(DeviceCapability.WsApi);\n }\n}\n\nexport {DeviceCapabilities};\n","/**\n * @readonly\n * @enum {string}\n */\nenum STREAMING_SERVICE_PROP_NAME {\n RTMP = 'RTMP',\n OAUTH2 = 'OAuth2',\n}\n\n/**\n * @readonly\n * @enum {string}\n */\nenum STREAMING_SERVICE_SETTINGS_PROP_NAME {\n FACEBOOK = 'FBSettings',\n YOUTUBE = 'YTSettings',\n}\n\n/**\n * @readonly\n * @enum {string}\n */\nenum STREAMING_SERVICE_TYPE {\n FACEBOOK = 'facebook',\n YOUTUBE = 'google',\n TWITCH = 'twitch',\n RTMP = 'rtmp',\n RTMPS = 'rtmps',\n}\n\n/**\n * @readonly\n * @enum {string}\n */\nenum FACEBOOK_STREAMING_DESTINATION {\n TIMELINE = 'timeline',\n PAGES = 'pages',\n GROUPS = 'groups',\n}\n\n/**\n * @readonly\n * @enum {string}\n */\nenum FACEBOOK_STREAMING_PRIVACY {\n ONLY_ME = 'SELF',\n FRIENDS = 'ALL_FRIENDS',\n PUBLIC = 'EVERYONE',\n}\n\n/**\n * @readonly\n * @enum {string}\n */\nenum YOUTUBE_STREAMING_DESTINATION {\n /**\n * @deprecated\n */\n STREAM_NOW = 'StreamNow',\n EVENTS = 'Events',\n}\n\n/**\n * @readonly\n * @enum {string}\n */\nenum YOUTUBE_STREAMING_PRIVACY {\n PRIVATE = 'Private',\n PUBLIC = 'Public',\n UNLISTED = 'Unlisted',\n}\n\nenum StreamingType {\n Facebook = 'facebook',\n Youtube = 'google',\n Twitch = 'twitch',\n Rtmp = 'rtmp',\n Rtmps = 'rtmps',\n}\n\nexport {\n STREAMING_SERVICE_PROP_NAME,\n STREAMING_SERVICE_SETTINGS_PROP_NAME,\n STREAMING_SERVICE_TYPE,\n FACEBOOK_STREAMING_DESTINATION,\n FACEBOOK_STREAMING_PRIVACY,\n YOUTUBE_STREAMING_DESTINATION,\n YOUTUBE_STREAMING_PRIVACY,\n /** new enums */\n StreamingType,\n};\n","import {Edge} from 'app/domain/edge';\nimport {\n DEVICE_PUBLISHER_SETTING_ID,\n DEVICE_PUBLISHER_STATE,\n} from 'app/models/Device/Publisher/constants';\nimport {Callback} from 'app/types/common';\n\n/**\n * @param {Object} setting\n * @param {*} setting.value\n * @param {*} defaultValue\n * @return {*}\n */\nfunction getSettingOrDefault(setting, defaultValue) {\n return setting ? setting.value : defaultValue;\n}\n\nexport interface PublisherOptions {\n startStreamingAction: Callback;\n stopStreamingAction: Callback;\n}\n\nexport class DevicePublisherModel {\n #data: Edge.Publisher;\n #startStreamingAction: Callback;\n #stopStreamingAction: Callback;\n\n constructor(json: Edge.Publisher, {startStreamingAction, stopStreamingAction}: PublisherOptions) {\n this.#data = json;\n this.#startStreamingAction = startStreamingAction;\n this.#stopStreamingAction = stopStreamingAction;\n }\n\n getId() {\n return this.#data.id;\n }\n\n getType() {\n return this.#data.type;\n }\n\n getName(): string {\n return getSettingOrDefault(this.#getSettingById(DEVICE_PUBLISHER_SETTING_ID.NAME), '');\n }\n\n isSelected() {\n return getSettingOrDefault(\n this.#getSettingById(DEVICE_PUBLISHER_SETTING_ID.SINGLE_TOUCH),\n false,\n );\n }\n\n isStreaming() {\n return this.isStarted() && this.#getState() === DEVICE_PUBLISHER_STATE.STARTED;\n }\n\n isStarted() {\n return this.#getStatus()?.started === true;\n }\n\n isFailed() {\n return this.#getState() === DEVICE_PUBLISHER_STATE.ERROR;\n }\n\n getStartTime() {\n if (this.isStreaming() === false) {\n return null;\n }\n\n return this.#getStatus()?.since ?? null;\n }\n\n getErrorMessage() {\n if (this.isFailed()) {\n return this.#getStatus()?.description ?? '';\n }\n\n return '';\n }\n\n startStreaming() {\n return this.#startStreamingAction(this.getId());\n }\n\n stopStreaming() {\n return this.#stopStreamingAction(this.getId());\n }\n\n #getStatus = (): Edge.PublisherStatus | undefined => {\n return this.#data.status;\n };\n\n #getState = () => {\n return this.#getStatus()?.state ?? null;\n };\n\n #getSettings = () => {\n return this.#data.settings || [];\n };\n\n /**\n * TODO: Refactor to Map\n * @param {string} id\n * @return {*|null}\n */\n #getSettingById = (id) => {\n return this.#getSettings().find((setting) => setting.id === id) ?? null;\n };\n}\n","/* eslint-disable no-restricted-syntax */\nimport {DeviceModel, HealthStatus} from 'app/components/DeviceDetails/constants';\nimport {WarningSeverity} from 'app/constants/deviceWarningSeverity';\nimport {ModelService} from 'app/services/deviceModel/DeviceModelService';\nimport {Edge} from 'app/domain/edge';\n\nfunction getHealthFromSeverity(severity: Edge.WarningSeverity): HealthStatus {\n switch (severity) {\n case WarningSeverity.Error:\n return HealthStatus.Bad;\n case WarningSeverity.Warning:\n return HealthStatus.Fair;\n default:\n return HealthStatus.Good;\n }\n}\n\nfunction getDeviceHealth(warnings: Edge.Warning[]): HealthStatus {\n let health = HealthStatus.Good;\n\n for (const warning of warnings) {\n if (warning.severity) {\n health = getHealthFromSeverity(warning.severity);\n }\n\n if (health === HealthStatus.Bad) {\n break;\n }\n }\n\n return health;\n}\n\nfunction isMultiChannelDevice(deviceData: Record<string, any>, modelName: DeviceModel): boolean {\n return Array.isArray(deviceData.Child) || ModelService.isMultiChannel(modelName);\n}\n\nexport {isMultiChannelDevice, getDeviceHealth};\n","import {CloudContract} from 'app/contracts/cloud';\nimport {Cloud} from 'app/domain/cloud';\nimport {Edge} from 'app/domain/edge';\n\nfunction mapRtmpDestination(c: CloudContract.RtmpDestination): Cloud.RtmpDestination {\n return {\n id: c.StreamID,\n name: c.Name,\n type: c.Type,\n active: c.CurrentlyStreaming,\n ownedBy: c.LockByDevice,\n deleted: c.IsDeleted,\n lastModified: c.LastModified,\n rtmp: {\n key: c.RTMP.StreamingKey,\n name: c.RTMP.DestName,\n url: c.RTMP.URL,\n },\n };\n}\n\nfunction mapGoogleDestination(c: CloudContract.GoogleDestination): Cloud.GoogleDestination {\n const auth = c.OAuth2;\n\n return {\n id: c.StreamID,\n name: c.Name,\n type: c.Type,\n active: c.CurrentlyStreaming,\n ownedBy: c.LockByDevice,\n deleted: c.IsDeleted,\n lastModified: c.LastModified,\n auth: {\n service: 'google',\n login: auth.Login,\n userName: auth.UserName,\n externalId: auth.ExternalID,\n error: auth.Error,\n errorTime: auth.ErrorTime,\n },\n };\n}\n\nfunction mapDestination(\n c: CloudContract.StreamDestination,\n): Cloud.StreamingDestination | undefined {\n if (c.Type === 'rtmp' || c.Type === 'rtmps') {\n return mapRtmpDestination(c);\n }\n\n if (c.Type === 'google') {\n return mapGoogleDestination(c);\n }\n\n return undefined;\n}\n\nfunction mapUnitCapabilities(c: CloudContract.UnitCapabilities): Cloud.UnitCapabilities {\n return {\n audioLevels: c.audio_levels?.enabled ?? false,\n batch: c.batch_selection?.enabled ?? false,\n epiphanCms: c.epiphan_cms?.enabled ?? false,\n files: c.file_management?.enabled ?? false,\n hls: c.start_hls_stream?.enabled ?? false,\n groups: c.use_groups?.enabled ?? false,\n login: c.remote_login?.enabled ?? false,\n presets: c.use_preset?.enabled ?? false,\n reboot: c.reboot?.enabled ?? false,\n recording: c.recording?.enabled ?? false,\n schedule: c.use_cms?.enabled ?? false,\n streaming: c.streaming?.enabled ?? false,\n transcribing: c.transcribing?.enabled ?? false,\n resume: c.resume?.enabled ?? false,\n };\n}\n\nfunction mapPairedSummary(c: CloudContract.PairedSummary): Edge.Paired {\n const {count, livescrypt, vpearl} = c;\n return {devices: count, lvs: livescrypt, projects: vpearl};\n}\n\nexport const CloudMapper = {mapDestination, mapUnitCapabilities, mapPairedSummary};\n","import {mapCapability} from './hardware.mapper';\n\nexport const HardwareMapper = {mapCapability};\n","import {Hardware, HardwareContract} from '../model';\n\nexport function mapCapability(contract: HardwareContract.Capability): Hardware.Capability {\n switch (contract) {\n case 'remote_login':\n return 'remote-login';\n\n case 'state_teaminfo':\n return 'state-team-info';\n\n case 'audio_levels':\n return 'audio-levels';\n\n case 'source_previews':\n return 'source-previews';\n\n case 'channel_previews':\n return 'channel-previews';\n\n case 'wsapi':\n return 'ws-api';\n\n case 'wsstates':\n return 'ws-states';\n\n case 'state_recording':\n return 'state-recording';\n\n case 'state_streaming':\n return 'state-streaming';\n\n case 'state_uploading':\n return 'state-uploading';\n\n case 'state_scheduling':\n return 'state-scheduling';\n\n case 'has_action_button1':\n return 'display-button';\n\n case 'state_transcribing':\n return 'state-transcribing';\n\n case 'configurable_srt':\n return 'configurable-srt';\n\n case 'epiphan_cms':\n return 'edge-cms';\n\n case 'state_transcribing_conf':\n return 'state-transcribing-conf';\n\n case 'file_management':\n return 'files';\n\n case 'state_channels':\n return 'state-channels';\n\n case 'nolp':\n return 'no-lp';\n\n case 'network_monitor':\n return 'network-monitor';\n\n default:\n return contract;\n }\n}\n","/* eslint-disable @typescript-eslint/member-ordering */\nimport {front} from 'app/api/CirrusApi';\nimport {formatUptime} from 'app/util/time';\nimport {\n DeviceCommand,\n DeviceModel as DeviceModelName,\n DeviceWarningId,\n HealthStatus,\n} from 'app/components/DeviceDetails/constants';\nimport {DeviceCapabilities} from 'app/models/Capabilities/DeviceCapabilities';\nimport {Notifications} from 'app/components/Notifications';\nimport {isEmptyObject} from 'app/util/isEmptyObject';\nimport {createDevicePublisherModel} from 'app/models/Device/Publisher/Fabric';\nimport {getDeviceHealth} from 'app/components/DeviceDetails/Models/utils';\nimport {DeviceSettingsCollection} from 'app/models/Device/Settings/DeviceSettingsCollection';\nimport {STREAMING_SERVICE_TYPE} from 'app/components/StreamingServices/constants';\nimport {DeviceCommandDispatcher} from 'app/util/CommandDispatcher';\nimport {WarningSeverity} from 'app/constants/deviceWarningSeverity';\nimport type {\n CommandOptions,\n Device,\n DeviceWarning,\n DeviceActiveStreamingInfo,\n} from 'app/components/DeviceDetails/Models/types';\nimport {DevicePublisherModel} from 'app/models/Device/Publisher/DevicePublisherModel';\nimport {TimeStampSeconds} from 'app/types/common';\nimport {createDeviceSettingsCollectionGetter} from 'app/store/models/utils';\nimport {DeviceStatus} from 'app/store/dto/device/Device';\nimport {getDeviceModel} from 'app/store/models/device/utils';\nimport {ModelService} from 'app/services/deviceModel/DeviceModelService';\nimport {Edge} from 'app/domain/edge';\nimport {isNil} from 'app/util/isNil';\nimport {EdgeContract} from 'app/contracts/edge';\nimport {CloudMapper} from 'app/util/mappers/CloudMapper/CloudMapper';\nimport {Cloud} from 'app/domain/cloud';\nimport {Hardware, HardwareMapper} from 'app/components/entities/hardware';\n\n// rework\nexport class DeviceModel {\n /**\n * @deprecated channelPublishers in Channel\n */\n private devicePublisherModels: DevicePublisherModel[] | undefined;\n\n /**\n * @deprecated obsolete\n */\n protected cachedDeviceName = '';\n /**\n * @deprecated obsolete\n */\n protected device: Device;\n\n /**\n * @deprecated deviceSettings in Device\n */\n protected deviceSettingsCollection?: DeviceSettingsCollection;\n\n private deviceSettingsCollectionGetter?: () => Promise<DeviceSettingsCollection>;\n\n /**\n * @deprecated obsolete\n */\n protected pendingStatusRequests: any = {};\n /**\n * @deprecated id in Device\n */\n protected deviceId: string;\n\n capabilities: Cloud.UnitCapabilities;\n\n hardware = new Set<Hardware.Capability>();\n\n groupId: string;\n groupName: string;\n\n constructor(props: Device) {\n this.device = props;\n this.deviceId = this.device.Id;\n\n this.groupId = props.GroupId ?? '';\n this.groupName = props.GroupName ?? '';\n\n this.capabilities = CloudMapper.mapUnitCapabilities(props.UnitCapabilities ?? {});\n\n const list = props.Capabilities?.map((c) => HardwareMapper.mapCapability(c)) ?? [];\n this.hardware = new Set(list);\n\n this.saveCachedName();\n }\n\n /**\n * @deprecated moved to CommandService\n */\n async sendCommand(command: string, options: CommandOptions = {}): Promise<any> {\n return front\n .devices(this.getId())\n .task()\n .post({cmd: command, ...options});\n }\n\n /**\n * @deprecated reboot in DeviceCommandsFeature\n */\n async sendRebootCommand(): Promise<any> {\n return this.sendCommand(DeviceCommand.Reboot);\n }\n\n /**\n * @deprecated audioLevels in DeviceCommandsFeature\n */\n async sendLevelsStartCommand(): Promise<any> {\n return DeviceCommandDispatcher.audioLevels(this.getId());\n }\n\n /**\n * @deprecated channelPreviews in DeviceCommandsFeature\n */\n async sendChannelPreviewsStartCommand(): Promise<any> {\n return DeviceCommandDispatcher.channelPreviews(this.getId());\n }\n\n /**\n * @deprecated sourcePreviews in DeviceCommandsFeature\n */\n async sendSourcePreviewsStartCommand(): Promise<any> {\n return DeviceCommandDispatcher.sourcePreviews(this.getId());\n }\n\n /**\n * @deprecated clearFootage in DeviceCommandsFeature\n */\n async sendClearFootageCommand(): Promise<any> {\n return this.sendCommand(DeviceCommand.FootageClear);\n }\n\n /**\n * @deprecated updateFirmware in DeviceCommandsFeature\n */\n async sendUpdateFirmwareCommand(): Promise<any> {\n return this.sendCommand(DeviceCommand.FirmwareUpdate);\n }\n\n /**\n * @deprecated obsolete\n */\n protected async sendPublisherConfigureCommand(options: CommandOptions): Promise<any> {\n return this.sendCommand(DeviceCommand.PublisherConfigure, options);\n }\n\n /**\n * @deprecated selectPublisher in ChannelCommandsFeature\n */\n async selectPublisher(publisherId: string, value: boolean): Promise<any> {\n return this.sendPublisherConfigureCommand({\n params: {\n id: publisherId,\n config: {\n 'single-touch': value,\n },\n },\n });\n }\n\n /**\n * @deprecated obsolete\n */\n async startStopCommand(commandName: DeviceCommand, started: boolean): Promise<any> {\n this.pendingStatus(commandName, true);\n\n return this.sendCommand(`${commandName}.${started ? 'stop' : 'start'}`);\n }\n\n /**\n * @deprecated startStop in RecordingFeature\n */\n async startStopRecordingCommand(): Promise<any> {\n return this.startStopCommand(DeviceCommand.Recording, this.isRecording()).finally(() => {\n this.showStorageFullWarningNotification();\n });\n }\n\n /**\n * @deprecated implemented in startStop in RecordingFeature\n */\n showStorageFullWarningNotification(): void {\n const storageFullWarning = this.getStorageFullWarning();\n\n if (storageFullWarning) {\n Notifications.addErrorNotification(\n `Device \"${this.getName()}\" recording fails: ${storageFullWarning.message}`,\n );\n }\n }\n\n /**\n * @deprecated obsolete\n */\n protected pendingStatus(command: string, status?: boolean | undefined) {\n if (arguments.length > 1) {\n this.pendingStatusRequests[command] = status;\n } else {\n return this.pendingStatusRequests[command];\n }\n }\n\n /**\n * @deprecated model in Device\n */\n getModelName(): DeviceModelName {\n return getDeviceModel(this.device);\n }\n\n /**\n * @deprecated online in Device\n */\n isOnline(): boolean {\n return this.device.Status === 'online';\n }\n\n /**\n * @deprecated offline in Device\n */\n isOffline(): boolean {\n return !this.isOnline();\n }\n\n getStatus(): DeviceStatus {\n return this.device.Status;\n }\n\n /**\n * @deprecated unpaired in Device\n */\n isUnpaired(): boolean {\n return this.device.IsUnpaired === true;\n }\n\n /**\n * @deprecated hasRecordingState in RecordingFeature\n */\n protected hasRecordingDesiredState(): boolean {\n const recordingDesiredState = this.getDesiredStateRecording();\n return !isNil(recordingDesiredState) && isEmptyObject(recordingDesiredState) === false;\n }\n\n /**\n * @deprecated desiredState.recording in Device\n */\n protected getDesiredStateRecording(): EdgeContract.RecordingState | undefined {\n return this.getDesiredState().find(\n (item): item is EdgeContract.RecordingState => item.Type === 'recording',\n );\n }\n\n /**\n * @deprecated active in RecordingFeature\n */\n isRecording(): boolean {\n if (this.isOffline()) {\n return false;\n }\n\n let stateRecording = false;\n\n if (this.hasRecordingDesiredState()) {\n const recordingParams = this.getDesiredStateRecording()?.Params;\n stateRecording = recordingParams?.Enabled ?? false;\n // stateRecording = recordingParams?.Enabled || recordingParams?.CMS?.EventID;\n }\n\n return Boolean(stateRecording);\n }\n\n /**\n * @deprecated startTime in RecordingFeature\n */\n getDeviceRecordingStartTime(): number | null {\n if (this.hasRecordingDesiredState()) {\n if (this.isRecording()) {\n return this.getDesiredStateRecording()?.StateTime ?? null;\n }\n }\n\n return null;\n }\n\n /**\n * @deprecated ip in Device\n */\n getIPAddress(): string | undefined {\n return this.device.IPAddress;\n }\n\n /**\n * @deprecated macAddress in Device\n */\n getMACAddress(): string | null {\n return this.device.MacAddress ?? null;\n }\n\n /**\n * @deprecated serialNumber in Device\n */\n getSerialNumber(): string {\n return this.device.SerialNumber ?? '';\n }\n\n getHostName(): string {\n if (ModelService.isUnify(this.getModelName())) {\n return this.device.PublicDNS ?? '';\n }\n\n return '';\n }\n\n /**\n * @deprecated uptime in Device\n */\n getUptimeFormatted(uptimeSince?: TimeStampSeconds): string {\n if (uptimeSince === undefined) {\n return '';\n }\n\n if (this.isOffline()) {\n return formatUptime(uptimeSince, this.getDeviceStateTime());\n }\n\n return formatUptime(uptimeSince);\n }\n\n /**\n * @deprecated stateTime in Device\n */\n getDeviceStateTime(): TimeStampSeconds | undefined {\n return this.device.StateTime;\n }\n\n /**\n * @deprecated version in FirmwareFeature\n */\n getFirmwareVersion(): string {\n return this.device.Firmware ?? '';\n }\n\n /**\n * @deprecated getSettingsCollection in Device\n */\n async getSettingsCollection(): Promise<DeviceSettingsCollection> {\n if (!this.deviceSettingsCollectionGetter) {\n this.deviceSettingsCollectionGetter = createDeviceSettingsCollectionGetter(this.getId());\n }\n\n return this.deviceSettingsCollectionGetter();\n }\n\n /**\n * @deprecated obsolete\n */\n private getWarningsRaw(): DeviceWarning[] {\n const warnings = this.device.Warnings;\n\n if (Array.isArray(warnings)) {\n return warnings;\n }\n\n return [];\n }\n\n /**\n * @deprecated warnings in WarningsFeature\n */\n getWarnings(): DeviceWarning[] {\n const warnings: DeviceWarning[] = [];\n\n this.getWarningsRaw().forEach((warning) => {\n if (warning.id === DeviceWarningId.PublisherError) {\n const streamId = warning.data?.stream_id;\n\n if (streamId) {\n warnings.push({\n ...warning,\n id: DeviceWarningId.StreamingDestinationError,\n });\n } else {\n warnings.push(warning);\n }\n } else {\n warnings.push(warning);\n }\n });\n\n return warnings;\n }\n\n /**\n * @deprecated obsolete\n */\n private getWarningById(warningId: string): DeviceWarning | undefined {\n return this.getWarnings().find((warning) => warning.id === warningId);\n }\n\n /**\n * @deprecated obsolete\n */\n private getWarningsById(warningId: DeviceWarningId | string): DeviceWarning[] {\n return this.getWarnings().filter((warning) => warning.id === warningId);\n }\n\n /**\n * @deprecated storageFull in WarningsFeature\n */\n getStorageFullWarning(): DeviceWarning | undefined {\n return this.getWarningById(DeviceWarningId.StorageFull);\n }\n\n /**\n * @deprecated publishers in WarningsFeature\n */\n private getPublisherWarnings(): DeviceWarning[] {\n return this.getWarningsById(DeviceWarningId.PublisherError);\n }\n\n /**\n * @deprecated selectedPublishers in WarningsFeature\n */\n getSelectedPublisherWarnings(): DeviceWarning[] {\n const selectedPublisherSet = new Set(this.getSelectedPublisherIds());\n\n return this.getPublisherWarnings().filter((warning) => {\n const publisherId = warning.data?.publisher_id;\n\n if (!publisherId) {\n return false;\n }\n\n return selectedPublisherSet.has(publisherId);\n });\n }\n\n /**\n * @deprecated streamingDestinations in WarningsFeature\n */\n getStreamingDestinationWarnings(): DeviceWarning[] {\n return this.getWarningsById(DeviceWarningId.StreamingDestinationError);\n }\n\n /**\n * @deprecated hasErrors in WarningsFeature\n */\n hasErrorWarnings(): boolean {\n return this.getWarnings().some((warning) => warning.severity === WarningSeverity.Error);\n }\n\n /**\n * @deprecated healthStatus in Device\n */\n getHealthStatus(): HealthStatus {\n return getDeviceHealth(this.getWarnings() as any);\n }\n\n /**\n * @deprecated name in Device\n */\n getName(): string {\n return this.device.Name;\n }\n\n /**\n * @deprecated name in Device\n */\n setName(name: string) {\n this.device.Name = name;\n }\n\n /**\n * @deprecated rename in Device\n */\n async rename(value: string): Promise<any> {\n const previousName = this.getName();\n\n this.setCachedName(value);\n this.setName(value);\n\n return (\n front\n .devices(this.getId())\n .rename()\n .post({Name: value})\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n .catch((_) => {\n this.setCachedName(previousName);\n this.setName(previousName);\n })\n );\n }\n\n /**\n * TODO: Save cached name in component\n * @deprecated obsolete\n */\n getCachedName(): string {\n return this.cachedDeviceName;\n }\n\n /**\n * @deprecated obsolete\n */\n saveCachedName() {\n this.setCachedName(this.getName());\n }\n\n /**\n * @deprecated obsolete\n */\n setCachedName(name: string) {\n this.cachedDeviceName = name;\n }\n\n /**\n * @deprecated id in Device\n */\n getId(): string {\n return this.deviceId;\n }\n\n /**\n * @deprecated groupId in Device\n */\n getGroupId(): string {\n return this.groupId;\n }\n\n /**\n * @deprecated desiredState in Device\n */\n protected getDesiredState(): EdgeContract.DesiredState[] {\n return this.device.DesiredState ?? [];\n }\n\n protected getStreamingState(): EdgeContract.StreamingState | undefined {\n return this.getDesiredState().find(\n (item): item is EdgeContract.StreamingState => item.Type === 'streaming',\n );\n }\n\n /**\n * @deprecated now in desiredState.streaming\n */\n getActiveStreamingInfo(): DeviceActiveStreamingInfo {\n const streaming = this.getStreamingState();\n const streamingParams = streaming?.Params;\n const active = streamingParams?.Enabled === true;\n\n return {\n id: streamingParams?.StreamID ?? null,\n url: streamingParams?.StreamAddr,\n startTime: active ? streaming?.StateTime ?? null : null,\n active,\n };\n }\n\n /**\n * @deprecated startTime in StreamingFeature\n */\n getStreamingStartTime(): number | null {\n if (this.isStreaming() === false) {\n return null;\n }\n\n const streamingInfo = this.getActiveStreamingInfo();\n let {startTime} = streamingInfo;\n\n this.getPublishers().forEach((publisher) => {\n const publisherStartTime = publisher.getStartTime();\n\n if (publisherStartTime === null) {\n return;\n }\n\n if (startTime === null || publisherStartTime < startTime) {\n startTime = publisherStartTime;\n }\n });\n\n return startTime;\n }\n\n /**\n * @deprecated selectedDestination in StreamingFeature\n */\n getSelectedStreamingDestinationId(): string | null {\n return this.getActiveStreamingInfo().id;\n }\n\n /**\n * @deprecated active in StreamingFeature\n */\n isStreaming(): boolean {\n return (\n this.isOnline() &&\n (this.isStreamingWithStreamingDestination() || this.isStreamingWithPublisher())\n );\n }\n\n hasStreamingError(): boolean {\n return this.isOnline() && this.hasFailedPublishers();\n }\n\n isStarting(): boolean {\n return this.device.Status === 'starting' || this.device.Status === 'resuming';\n }\n\n isStopping(): boolean {\n return this.device.Status === 'stopping';\n }\n\n isDown(): boolean {\n return this.device.Status === 'offline';\n }\n\n /**\n * @deprecated withDestination in StreamingFeature\n */\n private isStreamingWithStreamingDestination(): boolean {\n return this.getActiveStreamingInfo().active;\n }\n\n /**\n * @deprecated withStreamingPublisher in StreamingFeature\n */\n private isStreamingWithPublisher(): boolean {\n return this.getPublishers().some((publisher) => publisher.isStreaming());\n }\n\n /**\n * @deprecated started in StreamingFeature\n */\n isStreamingStarted(): boolean {\n return (\n this.isOnline() &&\n (this.isStreamingStartedWithStreamingDestination() || this.isStreamingStartedWithPublisher())\n );\n }\n\n /**\n * @deprecated withDestination in StreamingFeature\n */\n private isStreamingStartedWithStreamingDestination(): boolean {\n return this.isStreamingWithStreamingDestination();\n }\n\n /**\n * @deprecated withStartedPublisher in StreamingFeature\n */\n private isStreamingStartedWithPublisher(): boolean {\n return this.getPublishers().some((publisher) => publisher.isStarted());\n }\n\n /**\n * @deprecated activeCount in StreamingFeature\n * Device streaming destinations (publishers) and common streaming destinations in \"streaming\" state\n */\n getStreamingDestinationStreamingCount(): number {\n let result = 0;\n\n if (this.isOnline()) {\n if (this.isStreamingStartedWithStreamingDestination()) {\n result += 1;\n }\n\n result += this.getPublishers().filter((publisher) => publisher.isStreaming()).length;\n }\n\n return result;\n }\n\n /**\n * @deprecated start in StreamingFeature\n */\n async startStreaming(): Promise<any> {\n const requests: any[] = [];\n\n const selectedPublisherIds = this.getSelectedPublisherIds();\n\n if (selectedPublisherIds.length > 0) {\n requests.push(this.startPublishersStreaming(selectedPublisherIds));\n }\n\n const selectedStreamingDestinationId = this.getSelectedStreamingDestinationId();\n if (selectedStreamingDestinationId) {\n requests.push(\n front.streams(selectedStreamingDestinationId).start().post({DeviceID: this.getId()}),\n );\n }\n\n return Promise.all(requests);\n }\n\n /**\n * @deprecated stop in StreamingFeature\n */\n private async startPublisherStreaming(id: string): Promise<any> {\n return this.startPublishersStreaming([id]);\n }\n\n /**\n * @deprecated now in StreamingFeature\n */\n private async startPublishersStreaming(ids: string[]): Promise<any> {\n return this.sendCommand(DeviceCommand.PublisherStart, {\n params: {\n // eslint-disable-next-line camelcase\n publisher_ids: ids,\n },\n });\n }\n\n /**\n * @deprecated stop in StreamingFeature\n */\n async stopStreaming(): Promise<any> {\n const requests: any[] = [];\n\n const startedPublisherIds = this.getStartedPublisherIds();\n if (startedPublisherIds.length > 0) {\n requests.push(this.stopPublishersStreaming(startedPublisherIds));\n }\n\n const selectedStreamingDestinationId = this.getSelectedStreamingDestinationId();\n\n if (selectedStreamingDestinationId) {\n requests.push(\n front.streams(selectedStreamingDestinationId).stop().post({DeviceID: this.getId()}),\n );\n }\n\n return Promise.all(requests);\n }\n\n /**\n * @deprecated obsolete\n */\n private async stopPublisherStreaming(id: string): Promise<any> {\n return this.stopPublishersStreaming([id]);\n }\n\n /**\n * @deprecated obsolete\n */\n private async stopPublishersStreaming(ids: string[]): Promise<any> {\n return this.sendCommand(DeviceCommand.PublisherStop, {\n params: {\n // eslint-disable-next-line camelcase\n publisher_ids: ids,\n },\n });\n }\n\n /**\n * @deprecated publishers in DeviceChannel\n */\n getPublishers(): DevicePublisherModel[] {\n if (!this.devicePublisherModels) {\n this.devicePublisherModels = this.getPublishersRaw().map((json) => {\n return createDevicePublisherModel(json, {\n startStreamingAction: async (id: string): Promise<any> =>\n this.startPublisherStreaming(id),\n stopStreamingAction: async (id: string): Promise<any> => this.stopPublisherStreaming(id),\n });\n });\n }\n\n return this.devicePublisherModels;\n }\n\n hasFailedPublishers(): boolean {\n return this.getPublishers().some((publisher) => publisher.isFailed());\n }\n\n /**\n * @deprecated failedPublishersCount in StreamingFeature\n */\n getFailedPublishersCount(): number {\n return this.getPublishers().filter((publisher) => publisher.isFailed()).length;\n }\n\n /**\n * @deprecated obsolete\n */\n private getPublishersRaw(): Edge.Publisher[] {\n return this.device.Publishers ?? [];\n }\n\n /**\n * @deprecated selectedPublishers in StreamingFeature\n */\n private getSelectedPublishers(): DevicePublisherModel[] {\n return this.getPublishers().filter((publisher) => publisher.isSelected());\n }\n\n /**\n * @deprecated obsolete\n */\n getSelectedPublisherIds(): string[] {\n return this.getSelectedPublishers().map((publisher) => publisher.getId());\n }\n\n /**\n * @deprecated obsolete\n */\n private getStartedPublisherIds(): string[] {\n return this.getPublishers()\n .filter((publisher) => publisher.isStarted())\n .map((publisher) => publisher.getId());\n }\n\n /**\n * @deprecated active in TranscribingFeature\n */\n // eslint-disable-next-line class-methods-use-this\n isTranscribing(): boolean {\n return false;\n }\n\n /**\n * @deprecated capabilities in Device and DeviceChannel\n */\n getCapabilitiesRaw() {\n return this.device.Capabilities ?? [];\n }\n\n /**\n * @deprecated obsolete\n */\n getCapabilities(): DeviceCapabilities {\n return new DeviceCapabilities({capabilities: this.getCapabilitiesRaw()});\n }\n\n /**\n * @deprecated destinationIsAvailable in StreamingFeature\n */\n checkStreamingDestinationAvailableToUse(type: STREAMING_SERVICE_TYPE): boolean {\n if (ModelService.isWebcaster(this.getModelName()) === false) {\n return true;\n }\n\n return type !== STREAMING_SERVICE_TYPE.RTMP && type !== STREAMING_SERVICE_TYPE.RTMPS;\n }\n\n getInnerModel(): Device {\n return this.device;\n }\n}\n","/**\n * Object is empty or not\n *\n * {@link https://stackoverflow.com/a/34491966/1284255}\n *\n * ```typescript\n * isEmptyObject({}); //=> true\n * isEmptyObject({foo: 1}); //=> false\n * ```\n */\nexport function isEmptyObject(object: Record<any, any>): boolean {\n for (const key in object) {\n if (Object.prototype.hasOwnProperty.call(object, key)) {\n return false;\n }\n }\n\n return true;\n}\n","import {DeviceCapability} from 'app/components/DeviceDetails/constants';\nimport {getTranscriberStatus} from 'app/components/DeviceDetails/utils';\nimport {DeviceSettingsCollection} from 'app/models/Device/Settings/DeviceSettingsCollection';\nimport {\n DesiredState,\n StreamingState,\n RecordingState,\n TranscribingState,\n} from 'app/store/models/types';\nimport {\n DesiredStateDto,\n} from 'app/store/dto/common';\nimport {\n isDesiredStateCmsParams,\n isRecordingDesiredStateDto,\n isStreamingDesiredStateDto,\n isTranscribingDesiredStateDto,\n} from 'app/store/dto/typeGuards';\nimport {deviceApiService} from 'app/services/api/device/DeviceApiService';\n\nfunction getDeviceCapabilities(capabilities: DeviceCapability[]): Set<DeviceCapability> {\n return new Set([...capabilities]);\n}\n\nfunction mapDesiredState(array: DesiredStateDto[]): DesiredState {\n return array.reduce<DesiredState>((acc, dto) => {\n if (isStreamingDesiredStateDto(dto)) {\n const streamingState: StreamingState = {\n // type: dto.Type,\n time: dto.StateTime,\n active: dto.Params?.Enabled ?? false,\n streamId: dto.Params?.StreamID ?? '',\n url: dto.Params?.StreamAddr ?? '',\n };\n\n acc.streaming = streamingState;\n return acc;\n }\n\n if (isRecordingDesiredStateDto(dto)) {\n const param = dto.Params;\n const active = param ?\n isDesiredStateCmsParams(param) ?\n Boolean(param.CMS.EventID) :\n param.Enabled :\n false;\n\n const recodingState: RecordingState = {\n time: dto.StateTime,\n active,\n // type: dto.Type,\n };\n\n acc.recording = recodingState;\n return acc;\n }\n\n if (isTranscribingDesiredStateDto(dto)) {\n const {Params, StateTime} = dto;\n const [active, paused, url, sessionId] = [\n Params.Enabled, Params.Paused, Params.ShortURL, Params.SessionID\n ];\n\n const status = getTranscriberStatus(active, paused);\n\n const state: TranscribingState = {\n active,\n paused,\n url,\n status,\n sessionId,\n time: StateTime,\n };\n\n acc.transcribing = state;\n return acc;\n }\n\n return acc;\n }, {});\n}\n\nfunction createDeviceSettingsCollectionGetter(deviceId: string): () => Promise<DeviceSettingsCollection> {\n let promise: Promise<DeviceSettingsCollection> | undefined;\n\n return async (): Promise<DeviceSettingsCollection> => {\n if (!promise) {\n promise = deviceApiService.getDeviceSettings(deviceId)\n .then((settings) => {\n return new DeviceSettingsCollection({\n settings,\n });\n });\n }\n\n return promise;\n };\n}\n\nexport {\n getDeviceCapabilities,\n mapDesiredState,\n createDeviceSettingsCollectionGetter,\n};\n","import {Edge} from 'app/domain/edge';\nimport {\n DevicePublisherModel,\n PublisherOptions,\n} from 'app/models/Device/Publisher/DevicePublisherModel';\n\n/**\n * @param {object} json\n * @param {object} [options]\n * @return {DevicePublisherModel}\n */\nfunction createDevicePublisherModel(json: Edge.Publisher, options: PublisherOptions) {\n return new DevicePublisherModel(json, options);\n}\n\nexport {createDevicePublisherModel};\n","import {DeviceModel} from 'app/components/DeviceDetails/Models/DeviceModel';\nimport {front} from 'app/api/CirrusApi';\nimport {DeviceCapability, TranscribingStatus} from 'app/components/DeviceDetails/constants';\nimport {getTranscriberStatus} from 'app/components/DeviceDetails/utils';\nimport {TranscriptionConfiguration} from 'app/components/DeviceDetails/TranscriberDevice/Tabs/Transcription/TranscriptionConfiguration';\nimport {TranscribingInfo, TranscribingURL} from 'app/components/DeviceDetails/Models/types';\nimport {EdgeContract} from 'app/contracts/edge';\nimport {HardwareContract} from 'app/components/entities/hardware';\n\nexport class LiveScryptDeviceModel extends DeviceModel {\n /**\n * @deprecated in transcribing feature\n */\n async getTranscribingSettings(): Promise<Array<Record<string, any>>> {\n return TranscriptionConfiguration.processSettings(this.getTranscribingSettingsRaw() ?? {});\n }\n\n /**\n * @deprecated in transcribing feature\n */\n async updateTranscribingSetting(id: string, value: any): Promise<any> {\n const previousData = {...this.getTranscribingSettingsRaw()};\n const nextData = {\n ...previousData,\n [id]: value,\n };\n this.setTranscribingSettings(nextData as any);\n\n return (\n front\n .devices(this.getId())\n .transcribe()\n .configuration()\n .put(nextData)\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n .catch((_) => {\n this.setTranscribingSettings(previousData as any);\n })\n );\n }\n\n /**\n * @deprecated in transcribing feature\n */\n getTranscribingInfo(): TranscribingInfo {\n const transcribing = this.getTranscribingState();\n const transcribingParams = transcribing?.Params;\n const active = this.isOnline() && Boolean(transcribingParams?.Enabled);\n const paused = Boolean(transcribingParams?.Paused);\n const status = getTranscriberStatus(active, paused);\n const url = transcribingParams?.ShortURL ?? null;\n const sessionId = transcribingParams?.SessionID;\n\n return {\n url,\n sessionId,\n status,\n paused,\n active,\n };\n }\n\n /**\n * @deprecated in transcribing feature\n */\n isTranscribing(): boolean {\n return this.getTranscribingInfo().active;\n }\n\n /**\n * @deprecated in transcribing feature\n */\n getTranscribingStatus(): TranscribingStatus {\n return this.getTranscribingInfo().status;\n }\n\n /**\n * @deprecated in transcribing feature\n */\n getTranscribingURL(): TranscribingURL {\n const data = this.device.TranscriberURL;\n\n return {\n base: data?.Base,\n userDefined: data?.UserDefined,\n };\n }\n\n /**\n * @deprecated in transcribing feature\n */\n async setTranscribingURLUserDefined(userDefined: string): Promise<any> {\n return front.devices(this.getId()).transcribe().id().post({id: userDefined});\n }\n\n /**\n * @deprecated in transcribing feature\n */\n async startTranscribing(): Promise<any> {\n return front.devices(this.getId()).transcribe().start().post();\n }\n\n /**\n * @deprecated in transcribing feature\n */\n async stopTranscribing(): Promise<any> {\n return front.devices(this.getId()).transcribe().stop().post();\n }\n\n /**\n * @deprecated in transcribing feature\n */\n async pauseTranscribing(): Promise<any> {\n return front.devices(this.getId()).transcribe().pause().post();\n }\n\n /**\n * @deprecated in transcribing feature\n */\n async resumeTranscribing(): Promise<any> {\n return front.devices(this.getId()).transcribe().resume().post();\n }\n\n /**\n * @deprecated in transcribing feature\n */\n async clearCurrentTranscribingSession(): Promise<any> {\n const {sessionId} = this.getTranscribingInfo();\n\n return front.transcribing(this.getId()).sessions(sessionId).clear().post();\n }\n\n /**\n * @deprecated in device model capabilities getter\n */\n getCapabilitiesRaw(): HardwareContract.Capability[] {\n return [...super.getCapabilitiesRaw(), DeviceCapability.AudioLevels];\n }\n\n private getTranscribingState(): EdgeContract.TranscribingState | undefined {\n return this.getDesiredState().find(\n (item): item is EdgeContract.TranscribingState => item.Type === 'transcribing',\n );\n }\n\n private getTranscribingSettingsRaw(): EdgeContract.TranscribeConfig | undefined {\n return this.getTranscribingState()?.Params?.Config;\n }\n\n private setTranscribingSettings(settings: EdgeContract.TranscribeConfig) {\n this.device.DesiredState = this.device.DesiredState?.map((item) => {\n if (item.Type === 'transcribing') {\n return {...item, Params: {...item.Params, Config: settings}};\n }\n\n return item;\n });\n }\n}\n","/* eslint-disable max-classes-per-file */\nimport {isNil} from 'app/util/isNil';\nimport axios, {AxiosError, AxiosRequestConfig, AxiosResponse} from 'axios';\n\nexport type ErrorResponse = {\n Status: string;\n StatusCode: number;\n Error: string;\n ErrorData?: any;\n};\n\nexport class AbortError extends Error {}\n\nexport class ApiError extends Error {\n data: ErrorResponse;\n\n constructor(data: ErrorResponse) {\n super();\n this.data = data;\n }\n}\n\nexport class UnknownError extends Error {}\n\nfunction errorHandler(e: unknown): never {\n if (axios.isCancel(e)) {\n throw new AbortError();\n }\n\n if (axios.isAxiosError(e)) {\n const payload = e.response?.data;\n\n if (isErrorResponse(payload)) {\n throw new ApiError(payload);\n }\n }\n\n throw new UnknownError();\n}\n\nexport function isErrorResponse(e: unknown): e is ErrorResponse {\n const casted = e as ErrorResponse;\n return !isNil(casted.Status) && !isNil(casted.StatusCode) && !isNil(casted.Error);\n}\n\nexport function isApiError(e: unknown): e is ApiError {\n return e instanceof ApiError;\n}\n\nexport function isAjaxError(e: unknown): e is AxiosError {\n return axios.isAxiosError(e);\n}\n\nclass ApiClient {\n instance = axios.create({});\n\n private async request<Res, Data = any>(config: AxiosRequestConfig<Data>): Promise<Res> {\n try {\n const res = await this.instance.request<Res, AxiosResponse<Res>, Data>(config);\n return res.data;\n } catch (error) {\n console.log('req error', error);\n errorHandler(error);\n }\n }\n\n async get<Res>(url: string, config?: AxiosRequestConfig): Promise<Res> {\n return this.request<Res>({...config, url, method: 'GET'});\n }\n\n async post<Res, Data = any>(url: string, data?: Data, config?: AxiosRequestConfig): Promise<Res> {\n return this.request<Res, Data>({...config, url, data, method: 'POST'});\n }\n\n async put<Res, Data = any>(url: string, data?: Data, config?: AxiosRequestConfig): Promise<Res> {\n return this.request<Res, Data>({...config, url, data, method: 'PUT'});\n }\n\n async delete<Res>(url: string, config?: AxiosRequestConfig): Promise<Res> {\n return this.request<Res>({...config, url, method: 'DELETE'});\n }\n}\n\nexport const apiClient = new ApiClient();\n","import {useQuery} from '@tanstack/react-query';\nimport {Team} from 'app/components/entities/team';\nimport {User} from 'app/components/entities/user';\n\nexport function useCloud() {\n const teamQuery = useQuery<Team.TeamDetails>(['team']);\n const userQuery = useQuery<User.Profile>(['user']);\n\n if (!teamQuery.data || !userQuery.data) {\n throw new Error('No team or user');\n }\n\n return {team: teamQuery.data, user: userQuery.data};\n}\n","import React, {useCallback, useEffect, useMemo, useState} from 'react';\nimport classNames from 'classnames';\nimport {Icons} from 'app/util/icons';\nimport {debounce} from 'throttle-debounce';\nimport {Callback, ClassName} from 'app/types/common';\nimport {KeyboardCode} from 'app/constants';\n\ninterface Props extends ClassName {\n value: string;\n onChange: Callback;\n onClear: Callback;\n disabled?: boolean;\n placeholder?: string;\n}\n\nconst ListSearchFilter = ({\n className,\n value: valueProp,\n placeholder = 'Search',\n disabled,\n onChange,\n onClear,\n}: Props) => {\n const [value, setValue] = useState(valueProp);\n const [focused, setFocused] = useState(false);\n\n useEffect(() => {\n setValue(valueProp);\n }, [valueProp]);\n\n const onChangeDebounced = useMemo(() => debounce(350, onChange), [onChange]);\n\n const handleChange = useCallback(({target: {value}}: React.ChangeEvent<HTMLInputElement>) => {\n setValue(value);\n onChangeDebounced({target: {value}});\n }, [onChangeDebounced]);\n\n const handleInputKeyUp = useCallback((e: React.KeyboardEvent<HTMLInputElement>) => {\n if (e.code === KeyboardCode.Escape) {\n if ((e.target as HTMLInputElement).value !== '') {\n onClear();\n e.preventDefault();\n }\n }\n }, [onClear]);\n\n const handleInputFocus = useCallback(() => {\n setFocused(true);\n }, []);\n\n const handleInputBlur = useCallback(() => {\n setFocused(false);\n }, []);\n\n return (\n <label\n className={classNames('list-search-filter', className, {\n 'list-search-filter--focused': focused,\n })}\n data-id=\"search_filter\"\n >\n <div className=\"list-search-filter__search\">\n <div className=\"list-search-filter__icon\">\n {Icons.search().reactComponent()}\n </div>\n\n <input\n className=\"list-search-filter__input\"\n data-id=\"search_filter_input\"\n type=\"text\"\n value={value}\n placeholder={placeholder}\n autoCapitalize=\"none\"\n autoComplete=\"off\"\n autoCorrect=\"off\"\n spellCheck=\"false\"\n disabled={disabled}\n onChange={handleChange}\n onKeyUp={handleInputKeyUp}\n onFocus={handleInputFocus}\n onBlur={handleInputBlur}\n />\n </div>\n </label>\n );\n};\n\nexport {ListSearchFilter};\n","import React from 'react';\n\ninterface Props {\n buttonsComponent: React.ReactNode;\n}\n\nexport const Buttons: React.VFC<Props> = ({\n buttonsComponent,\n}) => {\n return (\n <div className=\"dashboard-list-header__buttons\">\n {buttonsComponent}\n </div>\n );\n};\n","import React, {useCallback} from 'react';\nimport classNames from 'classnames';\nimport {ListSearchFilter} from 'app/components/Dashboard/ListSearchFilter';\nimport {Buttons} from 'app/components/Dashboard/DashboardListHeader/Buttons';\nimport {Callback, ClassName} from 'app/types/common';\n\ninterface Props extends ClassName {\n filterValue: string;\n buttonsComponent: React.ReactNode;\n onFilter: Callback;\n showSearch: boolean;\n}\n\nexport function DashboardListHeader({\n className,\n filterValue,\n buttonsComponent,\n showSearch,\n onFilter,\n}: Props) {\n const handleFilterChange = useCallback(\n ({target: {value}}) => {\n onFilter(value);\n },\n [onFilter],\n );\n\n const handleFilterClear = useCallback(() => {\n onFilter('');\n }, [onFilter]);\n\n return (\n <div className={classNames('dashboard-list-header', className)}>\n <div className=\"dashboard-list-header__container\">\n <div className=\"dashboard-list-header__content container\">\n <div className=\"dashboard-list-header__filter\">\n {showSearch && (\n <ListSearchFilter\n value={filterValue}\n onChange={handleFilterChange}\n onClear={handleFilterClear}\n />\n )}\n </div>\n\n <Buttons buttonsComponent={buttonsComponent} />\n </div>\n </div>\n </div>\n );\n}\n","import React, {memo} from 'react';\nimport {Button} from 'app/components/sharedReactComponents/Button';\nimport {router} from 'app/router/main';\nimport {Icons} from 'app/util/icons';\nimport {THEME, VARIANT, SIZE} from 'app/constants';\n\ninterface Props {\n theme?: THEME;\n variant?: VARIANT;\n}\n\nexport const PairDeviceButton: React.FC<Props> = memo(({theme, variant = VARIANT.LINK}) => {\n return (\n <Button\n dataId=\"pair_device_links\"\n theme={theme}\n variant={variant}\n onClick={() => router.go('welcome')}\n >\n {Icons.chain().size(SIZE.S).label('Pair device').reactComponent()}\n </Button>\n );\n});\n\nPairDeviceButton.displayName = 'PairDeviceButton';\n","import classNames from 'classnames';\n\n/**\n * @deprecated use `classNames` instead\n * @param {object} classesObj\n * @return {string}\n */\nfunction classesConditional(classesObj: Record<string, any>) {\n return classNames(classesObj);\n}\n\n/**\n * To provide mapping between single and plural forms for cases when cannot simply append 's' character at the end\n * where `key` is a single form, `value` - plural\n * @readonly\n * @enum {string}\n */\nconst pluralizeMap = {\n this: 'these',\n box: 'boxes',\n goes: 'go',\n is: 'are',\n};\n\n/**\n * @param {string} name\n * @param {array} objects\n * @return {string}\n *\n * @example\n * pluralize('device', [{id: 1}, {id: 2}]); //=> \"devices\"\n */\nfunction pluralize(name: string, objects?: any[]): string {\n if (objects) {\n return pluralizeN(name, objects.length);\n }\n\n return name;\n}\n\n/**\n * @param {string} name\n * @param {number} length\n * @return {string}\n *\n * @example\n * pluralizeN('cat', 3); //=> \"cats\"\n * pluralizeN('cat', 1); //=> \"cat\"\n */\nfunction pluralizeN(name: string, length: number): string {\n if (length !== 1) {\n return pluralizeMap[name] ? pluralizeMap[name] : `${name}s`;\n }\n\n return name;\n}\n\n/**\n * @param {string} name\n * @return {string}\n *\n * @example\n * capitalize('foo'); //=> \"Foo\"\n */\nfunction capitalize(name: string) {\n return name.charAt(0).toUpperCase() + name.substr(1);\n}\n\nexport {\n classesConditional,\n pluralize,\n pluralizeN,\n capitalize,\n};\n","import React, {Fragment} from 'react';\nimport {DashboardListHeader} from 'app/components/Dashboard/DashboardListHeader';\nimport {PairDeviceButton} from 'app/components/libs/buttons/PairDeviceButton';\nimport {DevicesAlertsCounter} from 'app/components/DevicesAlerts/DevicesAlertsCounter';\nimport {Callback} from 'app/types/common';\n\nexport interface HeaderTools {\n pair: boolean;\n}\n\nconst defaultHeaderTools: HeaderTools = {\n pair: true,\n};\n\ninterface Props {\n searchValue: string;\n onSearch: Callback<void, [string]>;\n showSearch?: boolean;\n tools?: HeaderTools;\n}\n\nexport const Header: React.FC<Props> = ({\n searchValue,\n onSearch,\n showSearch = true,\n tools = defaultHeaderTools,\n}) => {\n return (\n <DashboardListHeader\n filterValue={searchValue}\n showSearch={showSearch}\n buttonsComponent={\n <Fragment>\n {tools.pair && <PairDeviceButton />}\n\n <DevicesAlertsCounter />\n </Fragment>\n }\n onFilter={onSearch}\n />\n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport {\n THEME,\n SIZE,\n} from 'app/constants';\n\ninterface Props {\n className?: string;\n size?: SIZE;\n theme?: THEME;\n}\n\nexport const IndeterminateProgressBar: React.VFC<Props> = ({\n className,\n size,\n theme = THEME.PRIMARY,\n}) => {\n return (\n <div\n className={classNames('cr-indeterminate-progress',\n theme && `cr-indeterminate-progress--${theme}`,\n size && `cr-indeterminate-progress--size-${size}`,\n className)}\n >\n <div className=\"cr-indeterminate-indicator\"/>\n </div>\n );\n};\n\n","const enum FleetManagerColumnId {\n Model = 'model',\n Status = 'status',\n IpAddress = 'ipAddress',\n SerialNumber = 'serialNumber',\n HostName = 'host',\n FirmwareVersion = 'firmwareVersion',\n SystemLoad = 'systemLoad',\n Temperature = 'temperature',\n Uptime = 'uptime',\n Storage = 'storage',\n TransferQueue = 'transferQueue',\n Health = 'health',\n Access = 'access',\n}\n\nconst FLEET_MANAGER_FIXED_COLUMNS = [\n FleetManagerColumnId.Model,\n FleetManagerColumnId.Access,\n];\n\nconst MAX_OPENED_DEVICE_CARDS = 50;\n\nexport {\n FleetManagerColumnId,\n FLEET_MANAGER_FIXED_COLUMNS,\n MAX_OPENED_DEVICE_CARDS,\n};\n\n","import React from 'react';\nimport classNames from 'classnames';\nimport {Icons} from 'app/util/icons';\nimport {SIZE} from 'app/constants';\nimport {ClassName} from 'app/types/common';\n\ninterface DeviceStatusIconProps extends ClassName {\n icon: any;\n label: string;\n labeled?: boolean;\n}\n\nconst DeviceStatusIcon: React.FC<DeviceStatusIconProps> = ({\n className,\n icon,\n label,\n labeled,\n ...elementProps\n}) => {\n return (\n <div className={classNames('device-status-icon', className)} {...elementProps}>\n <span className=\"device-status-icon__icon\">{icon.size(SIZE.S).reactComponent()}</span>\n\n {labeled && <span className=\"device-status-icon__label\">{label}</span>}\n </div>\n );\n};\n\ninterface Props extends ClassName {\n labeled?: boolean;\n}\n\nconst DeviceStatusStreamingIcon: React.FC<Props> = ({className, labeled}) => {\n return (\n <DeviceStatusIcon\n className={classNames('device-status-icon--streaming', className)}\n data-id=\"device_status_icon_streaming\"\n icon={Icons.streaming()}\n label=\"Streaming\"\n labeled={labeled}\n />\n );\n};\n\nconst DeviceStatusRecordingIcon: React.FC<Props> = ({className, labeled}) => {\n return (\n <DeviceStatusIcon\n className={classNames('device-status-icon--recording', className)}\n data-id=\"device_status_icon_recording\"\n icon={Icons.record()}\n label=\"Recording\"\n labeled={labeled}\n />\n );\n};\n\nconst DeviceStatusTranscribingIcon: React.FC<Props> = ({className, labeled}) => {\n return (\n <DeviceStatusIcon\n className={classNames('device-status-icon--transcribing', className)}\n data-id=\"device_status_icon_transcribing\"\n icon={Icons.liveScrypt()}\n label=\"Transcribing\"\n labeled={labeled}\n />\n );\n};\n\nexport {DeviceStatusStreamingIcon, DeviceStatusRecordingIcon, DeviceStatusTranscribingIcon};\n","/* eslint-disable no-restricted-syntax */\nimport React, {useEffect, useState} from 'react';\nimport {DeviceIndicatorItem} from 'app/components/FleetManager/DeviceCard/StatusList/DeviceStatusIndicator/types';\nimport {\n DeviceStatusRecordingIcon,\n DeviceStatusStreamingIcon,\n DeviceStatusTranscribingIcon,\n} from 'app/components/sharedReactComponents/DeviceStatusIcons';\n\ninterface Params {\n streaming?: boolean;\n recording?: boolean;\n transcribing?: boolean;\n}\n\nexport const deviceIndicators: DeviceIndicatorItem[] = [\n {\n id: 'streaming',\n label: 'Streaming',\n icon: <DeviceStatusStreamingIcon />,\n isActive: ({streaming}) => streaming,\n },\n {\n id: 'recording',\n label: 'Recording',\n icon: <DeviceStatusRecordingIcon />,\n isActive: ({recording}) => recording,\n },\n {\n id: 'transcribing',\n label: 'Transcribing',\n icon: <DeviceStatusTranscribingIcon />,\n isActive: ({transcribing}) => transcribing,\n },\n];\n\nexport function useActiveItems({\n recording,\n streaming,\n transcribing,\n}: Params): DeviceIndicatorItem[] {\n const [activeItems, setActiveItems] = useState<DeviceIndicatorItem[]>([]);\n\n useEffect(() => {\n setActiveItems(\n deviceIndicators.filter((item) => item.isActive({streaming, recording, transcribing})),\n );\n }, [streaming, recording, transcribing]);\n\n return activeItems;\n}\n","import React from 'react';\nimport {Typography} from '@mui/material';\nimport {DataId, StyleSx, Sx} from 'app/types/common';\nimport {packSx} from 'app/util/packSx/packSx';\n\ntype Variant = 'processing' | 'running' | 'error' | 'info' | 'disabled';\n\nfunction getRootSx(variant: Variant): StyleSx {\n return {\n color: getColor(variant),\n };\n}\n\nfunction getColor(variant: Variant): string {\n if (variant === 'running') return 'secondary.main';\n\n if (variant === 'error') return 'error.main';\n\n if (variant === 'processing') return 'primary.main';\n\n if (variant === 'info') return 'info.main';\n\n return 'text.disabled';\n}\n\ninterface Props extends DataId, Sx {\n variant: Variant;\n value: string;\n}\n\nexport const UnitStatus = React.forwardRef<HTMLElement, Props>(\n ({sx, value, dataId, variant}, ref) => {\n return (\n <Typography ref={ref} data-id={dataId} fontWeight={600} sx={packSx(getRootSx(variant), sx)}>\n {value}\n </Typography>\n );\n },\n);\n","import React from 'react';\nimport {DataId, Sx} from 'app/types/common';\nimport {UnitStatus} from 'app/components/DeviceDetails/DeviceStatusText/UnitStatus/UnitStatus';\n\ntype Variant = React.ComponentProps<typeof UnitStatus>['variant'];\ntype Mode = 'starting' | 'resuming';\n\ninterface Props extends Sx, DataId {\n progress: number;\n mode: Mode;\n}\n\nfunction useStatus(progress: number, mode: Mode): [value: string, variant: Variant] {\n if (progress >= 80) {\n return ['Taking longer than expected...', 'info'];\n }\n\n const value = mode === 'resuming' ? 'Resuming' : progress < 55 ? 'Initializing' : 'Starting';\n return [`${value}...`, 'processing'];\n}\n\nexport function UnifyConnectionStatus({sx, dataId, progress, mode}: Props) {\n const [value, variant] = useStatus(progress, mode);\n\n return <UnitStatus data-id={dataId} sx={sx} value={value} variant={variant} />;\n}\n","import React from 'react';\nimport {capitalize} from 'app/components/helpers/commonHelpers';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\nimport {ClassName, Sx} from 'app/types/common';\nimport {formatStartedAtDate} from 'app/util/time';\nimport {ModelService} from 'app/services/deviceModel/DeviceModelService';\nimport {UnitStatus} from 'app/components/DeviceDetails/DeviceStatusText/UnitStatus/UnitStatus';\nimport {UnifyConnectionStatus} from 'app/components/DeviceDetails/DeviceStatusText/UnifyConnectionStatus/UnifyConnectionStatus';\nimport {DeviceStatus} from 'app/store/dto/device/Device';\nimport {DeviceModel} from 'app/components/DeviceDetails/constants';\n\ninterface Props extends ClassName, Sx {\n model: DeviceModel;\n status: DeviceStatus;\n stateTime?: number;\n progress?: number;\n}\n\nexport function DeviceStatusText({sx, model, status, stateTime, progress = 0}: Props) {\n const dataId = `${status}_label`;\n\n const isUnify = ModelService.isUnify(model);\n const isStarting = status === 'starting';\n const isResuming = status === 'resuming';\n\n if (isUnify && (isStarting || isResuming)) {\n return (\n <UnifyConnectionStatus\n sx={sx}\n dataId=\"unify_progress_status\"\n progress={progress}\n mode={isStarting ? 'starting' : 'resuming'}\n />\n );\n }\n\n const tooltipText = getDeviceStatusTooltip(status, stateTime)\n const renderStatus = () => {\n switch (status) {\n case 'starting':\n case 'resuming':\n case 'rebooting':\n case 'upgrading':\n case 'stopping': {\n return (\n <UnitStatus sx={sx} dataId={dataId} variant=\"processing\" value={capitalize(status)} />\n );\n }\n\n case 'pairing': {\n return (\n <UnitStatus sx={sx} dataId={dataId} variant=\"disabled\" value={capitalize(status)} />\n );\n }\n\n case 'online': {\n return (\n <UnitStatus\n sx={sx}\n dataId={dataId}\n variant=\"running\"\n value={isUnify ? 'Running' : 'Online'}\n />\n );\n }\n\n case 'holding_legacy': {\n return (\n <UnitStatus sx={sx} dataId={dataId} variant=\"disabled\" value=\"Incompatible\" />\n );\n }\n\n default: {\n return (\n <UnitStatus\n sx={sx}\n dataId={dataId}\n variant=\"disabled\"\n value={isUnify ? 'Suspended' : 'Offline'}\n />\n );\n }\n }\n };\n\n return <Tooltip content={tooltipText}>{renderStatus()}</Tooltip>;\n}\n\n// DRY: Same method in components/features/edge/EdgeDevice/StatusIndicator. Please remove after new shared components\n// architecture is defined.\nfunction getDeviceStatusTooltip(status: DeviceStatus, stateTime?: number): string {\n switch (status) {\n case 'online':\n return '';\n case 'holding_legacy':\n return 'Incompatible firmware. Update your device firmware for Epiphan Edge compatibility.';\n default:\n return stateTime ? `Last time online: ${formatStartedAtDate(stateTime)}` : '';\n }\n}\n","import React, {useEffect, useState} from 'react';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\nimport {DataId, StyleSx, Sx} from 'app/types/common';\nimport {useActiveItems} from 'app/components/FleetManager/DeviceCard/StatusList/DeviceStatusIndicator/useActiveItems';\nimport {DeviceStatusText} from 'app/components/DeviceDetails/DeviceStatusText/DeviceStatusText';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {Box, Stack, Typography} from '@mui/material';\nimport {ModelService} from 'app/services/deviceModel/DeviceModelService';\n\ninterface StatusItem {\n id: string;\n icon: React.ReactNode;\n label: string;\n}\n\ninterface ListProps {\n items: StatusItem[];\n}\n\nexport function IndicatorList({items}: ListProps) {\n const [tooltipText, setTooltipText] = useState('');\n\n useEffect(() => {\n let text = '';\n\n if (items.length === 1) {\n text = items[0]?.label ?? '';\n } else {\n items.forEach((item, index, arr) => {\n if (index === 0) {\n text += item.label;\n } else if (index === arr.length - 1) {\n text += ` and\\n${item.label}`;\n } else {\n text += `, ${item.label}`;\n }\n });\n }\n\n setTooltipText(text);\n }, [items]);\n\n return (\n <Tooltip content={tooltipText} delay={250}>\n <Stack direction=\"row\" alignItems=\"center\" gap={0.5}>\n {items.map((item) => (\n <span key={item.id} className=\"device-status-indicator__status-list-item\">\n {item.icon}\n </span>\n ))}\n </Stack>\n </Tooltip>\n );\n}\n\nconst statusSx: StyleSx = {fontSize: 12, fontWeight: 600};\n\ninterface Props extends Sx, DataId {\n device: AnyDeviceModelType;\n progress?: number;\n}\n\nexport function DeviceStatusIndicator({sx, device, progress = 0}: Props) {\n const streaming = device.isStreaming();\n const recording = device.isRecording();\n const transcribing = device.isTranscribing();\n\n const showIndicators = streaming || recording || transcribing;\n\n const activeItems = useActiveItems({streaming, recording, transcribing});\n\n const model = device.getModelName();\n const status = device.getStatus();\n\n const isUnify = ModelService.isUnify(model);\n\n const resuming = status === 'resuming';\n const starting = status === 'starting';\n\n const showEstimate = isUnify && (starting || resuming) && progress < 80;\n\n return (\n <Stack sx={sx}>\n {showIndicators ? (\n <IndicatorList items={activeItems} />\n ) : (\n <Box>\n <DeviceStatusText\n sx={statusSx}\n model={model}\n status={status}\n progress={progress}\n stateTime={device.getDeviceStateTime()}\n />\n {showEstimate && (\n <Typography fontSize={12}>Est time: {resuming || progress < 55 ? 5 : 1} min</Typography>\n )}\n </Box>\n )}\n </Stack>\n );\n}\n","import React, {ReactNode} from 'react';\nimport {Button, Stack, Typography} from '@mui/material';\nimport AdsClickIcon from '@mui/icons-material/AdsClick';\nimport FolderCopyIcon from '@mui/icons-material/FolderCopy';\nimport BallotIcon from '@mui/icons-material/Ballot';\nimport HdIcon from '@mui/icons-material/Hd';\nimport {router} from 'app/router/main';\nimport {Sx} from 'app/types/common';\n\ntype Props = Sx & {\n billingAccess: boolean;\n};\n\nexport function UpgradeToEdgePremium({sx, billingAccess}: Props) {\n return (\n <Stack sx={sx} width={294} gap={2} className=\"upgrade-to-pro-tooltip\">\n <Typography variant=\"h6\" color=\"primary.main\" fontWeight={600}>\n Supercharge your experience and upgrade to Premium\n </Typography>\n\n <Feature\n icon={<AdsClickIcon fontSize=\"large\" />}\n description=\"Batch control streaming, recording and transcription, fleet maintenance, remote login and\n more.\"\n />\n\n <Feature\n icon={<FolderCopyIcon fontSize=\"large\" />}\n description=\"Device grouping to enhance your device organization during Live Events.\"\n />\n\n <Feature\n icon={<BallotIcon fontSize=\"large\" />}\n description=\"Configuration presets support.\"\n />\n\n <Feature icon={<HdIcon fontSize=\"large\" />} description=\"High-definition video playback.\" />\n\n {billingAccess && (\n <Button\n sx={{alignSelf: 'center'}}\n variant=\"contained\"\n color=\"secondary\"\n onClick={() => router.go('settingBillingUsage')}\n disableRipple={false}\n >\n <Typography>Upgrade to Premium</Typography>\n </Button>\n )}\n </Stack>\n );\n}\n\ntype FeatureProps = Sx & {\n icon: ReactNode;\n description: string;\n};\n\nfunction Feature({sx, icon, description}: FeatureProps) {\n return (\n <Stack sx={sx} direction=\"row\" alignItems=\"flex-start\" gap={1}>\n {icon}\n\n <Typography alignSelf=\"center\">{description}</Typography>\n </Stack>\n );\n}\n","import React, {useState} from 'react';\nimport {ButtonProps, Popover, Tooltip} from '@mui/material';\nimport {LoadingButton} from '@mui/lab';\nimport ScreenShareIcon from '@mui/icons-material/ScreenShare';\nimport ViewCompactAltIcon from '@mui/icons-material/ViewCompactAlt';\nimport {Sx} from 'app/types/common';\nimport {DeviceApiService} from 'app/services/api/device/DeviceApiService';\nimport {ApiResponseNumeralStatus} from 'app/data/Status';\nimport {Notifications} from 'app/components/Notifications';\nimport {UpgradeToEdgePremium} from 'app/components/sharedReactComponents/UpgradeToEdgePremium/UpgradeToEdgePremium';\n\ntype RemoteType = 'admin' | 'switcher';\n\ntype Props = Sx & {\n deviceId: string;\n type: RemoteType;\n premium: boolean;\n paymentAccess: boolean;\n showIcon?: boolean;\n labeled?: boolean;\n} & Pick<ButtonProps, 'size' | 'disabled'>;\n\nexport function RemoteLoginButton({\n sx,\n deviceId,\n type,\n size,\n premium,\n paymentAccess,\n disabled,\n labeled = true,\n showIcon = false,\n}: Props) {\n const [loading, setLoading] = useState(false);\n const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);\n\n const isSwitcher = type === 'switcher';\n\n const handleLogin = async (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n if (!premium) {\n setAnchorEl(e.currentTarget);\n return;\n }\n\n try {\n setLoading(true);\n const res = await DeviceApiService.getUrlRemoteLogin(deviceId);\n const url = isSwitcher ? res.URL.Switcher : res.URL.Admin;\n\n window.open(url, '_blank');\n } catch (e: unknown) {\n let errorMessage = 'Something went wrong. Try again later.';\n\n if ((e as any)?.status === ApiResponseNumeralStatus.PaymentRequired) {\n errorMessage = `Remote ${type} login is not available for free teams.`;\n }\n\n if ((e as any)?.status === ApiResponseNumeralStatus.NotFound) {\n errorMessage = 'Device is not connected to Remote login server.';\n }\n\n Notifications.addErrorNotification(errorMessage);\n } finally {\n setLoading(false);\n }\n };\n\n const label = isSwitcher ? 'Switcher' : 'Admin login';\n const icon = isSwitcher ? <ViewCompactAltIcon /> : <ScreenShareIcon />;\n\n return (\n <>\n <Tooltip title={!labeled ? label : undefined}>\n <LoadingButton\n data-id={isSwitcher ? 'switcher_button' : 'remote_login_button'}\n sx={sx}\n variant=\"outlined\"\n color={isSwitcher ? 'secondary' : 'primary'}\n loading={loading}\n disabled={disabled}\n disableRipple={false}\n size={size}\n onClick={handleLogin}\n >\n {showIcon && icon}\n {labeled && label}\n </LoadingButton>\n </Tooltip>\n\n <Popover\n anchorEl={anchorEl}\n open={Boolean(anchorEl)}\n slotProps={{paper: {sx: {p: 2}}}}\n anchorOrigin={{vertical: 'bottom', horizontal: 'center'}}\n transformOrigin={{vertical: 'top', horizontal: 'center'}}\n onClose={() => setAnchorEl(null)}\n >\n <UpgradeToEdgePremium billingAccess={paymentAccess} />\n </Popover>\n </>\n );\n}\n","export const UNITS = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n\nconst formatArray = (b: number, minThreshold: number, precision: number): [string, string] => {\n let unit;\n let bNext;\n\n for (unit of UNITS) {\n bNext = b / Math.pow(2, 10);\n\n if (bNext < minThreshold) {\n break;\n }\n\n b = bNext;\n }\n\n return [b.toFixed(precision), unit];\n};\n\nconst format = (b: number, minThreshold: number, precision: number) =>\n formatArray(b, minThreshold, precision).join(' ');\n\nexport const bytes = {\n formatArray,\n format,\n};\n","import {UNITS} from 'app/util/bytes';\n\nfunction toNumber(value: string): number {\n const result = parseFloat(value);\n\n return isFinite(result) ? result : 0;\n}\n\n/**\n * Rounds given decimal `value` to a given `precision` making sure the result contain `precision` number of digits\n */\nfunction withPrecision(value: number, precision = 1): string {\n if (Math.abs(value) >= 10) {\n precision++;\n }\n\n if (Math.abs(value) >= 100) {\n precision++;\n }\n\n return value.toPrecision(precision);\n}\n\n/**\n * Rounds given decimal `value` to a `precision` number of digits after delimiter\n */\nfunction roundTo(value: number, precision = 0): number {\n const precisionMultiplier = Math.pow(10, precision);\n\n return Math.round(value * precisionMultiplier) / precisionMultiplier;\n}\n\nfunction formatArray(\n value: number,\n minThreshold: number,\n precision: number,\n): [value: string, unit: string] {\n let current = value;\n let unit = '';\n\n for (let i = 0; i < UNITS.length; i += 1) {\n const nextUnit = UNITS[i];\n\n const next = current / 1000;\n\n if (nextUnit) {\n unit = nextUnit;\n }\n\n if (next < minThreshold) {\n break;\n }\n\n current = next;\n }\n\n return [current.toFixed(precision), unit];\n}\n\nfunction format(value: number, minThreshold: number, precision: number) {\n return formatArray(value, minThreshold, precision).join(' ');\n}\n\nexport {toNumber, withPrecision, roundTo, format};\n","import React from 'react';\nimport classNames from 'classnames';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\nimport {WarningBaseType} from 'app/types/common';\n\ninterface Props {\n messages: WarningBaseType[];\n}\n\nfunction Messages({messages}: Props) {\n return (\n <ul\n className={classNames(\n 'tooltip-multiple-messages__messages',\n messages.length > 1 && 'tooltip-multiple-messages__messages--multiple',\n )}\n >\n {messages.map((message, index) => (\n <li key={`${message.message}-${index}`} className=\"tooltip-multiple-messages__message\">\n {message.message}\n </li>\n ))}\n </ul>\n );\n}\n\nexport function TooltipMultipleMessages({\n messages,\n children,\n ...props\n}: Props & Record<string, any>) {\n let content: React.ReactChild = '';\n\n if (Array.isArray(messages) && messages.length > 0) {\n content = <Messages messages={messages} />;\n }\n\n return (\n <Tooltip content={content} {...props}>\n {children}\n </Tooltip>\n );\n}\n","import React from 'react';\nimport classNames from 'classnames';\nimport {Icons} from 'app/util/icons';\nimport {ClassName} from 'app/types/common';\n\ninterface Props extends ClassName {}\n\nexport const LoadingPlaceholder: React.VFC<Props> = ({\n className,\n}) => {\n return (\n <span className={classNames('loading-placeholder', className)}>\n {Icons.spinner().class('loading-placeholder__spinner').reactComponent()}\n </span>\n );\n};\n","import React from 'react';\nimport {Stack, Typography} from '@mui/material';\nimport CheckIcon from '@mui/icons-material/Check';\nimport ErrorIcon from '@mui/icons-material/Error';\nimport WarningIcon from '@mui/icons-material/Warning';\nimport {HealthStatus} from 'app/components/DeviceDetails/constants';\nimport {TooltipMultipleMessages} from 'app/components/sharedReactComponents/Tooltip/TooltipMultipleMessages';\nimport {getDeviceHealth} from 'app/components/DeviceDetails/Models/utils';\nimport {Sx} from 'app/types/common';\nimport {LoadingPlaceholder} from 'app/components/sharedReactComponents/LoadingPlaceholder';\nimport {Edge} from 'app/domain/edge';\n\ninterface Props extends Sx {\n warnings: Edge.Warning[];\n labeled?: boolean;\n offline: boolean;\n loading?: boolean;\n}\n\nexport function DeviceHealthIndicator({sx, warnings, labeled, offline, loading}: Props) {\n const count = warnings.length;\n const health = getDeviceHealth(warnings);\n const size = count > 0 ? 'small' : 'medium';\n\n const renderContent = () => {\n if (loading) {\n return <LoadingPlaceholder />;\n }\n\n return (\n <>\n {health === HealthStatus.Bad && <WarningIcon fontSize={size} color=\"inherit\" />}\n {health === HealthStatus.Fair && <ErrorIcon fontSize={size} color=\"inherit\" />}\n {health === HealthStatus.Good && <CheckIcon fontSize={size} color=\"inherit\" />}\n\n {count > 0 && (\n <Typography component=\"span\" fontWeight={600} variant=\"inherit\">\n {count}\n </Typography>\n )}\n </>\n );\n };\n\n return (\n <Stack sx={sx} direction=\"row\" alignItems=\"center\" gap={0.5}>\n <TooltipMultipleMessages messages={warnings}>\n <Stack\n direction=\"row\"\n justifyContent=\"center\"\n alignItems=\"center\"\n gap={0.5}\n px={0.5}\n height={25}\n minWidth={40}\n borderRadius={0.5}\n color={() => {\n if (offline) {\n return 'text.disabled';\n }\n\n switch (health) {\n case HealthStatus.Bad:\n return 'error.main';\n case HealthStatus.Fair:\n return 'warning.main';\n default:\n return 'secondary.main';\n }\n }}\n data-id=\"device_health_indicator_badge\"\n >\n {renderContent()}\n </Stack>\n </TooltipMultipleMessages>\n\n {labeled && (\n <Typography component=\"span\" color=\"text.secondary\" data-id=\"device_health_indicator_label\">\n {getLabel(health)}\n </Typography>\n )}\n </Stack>\n );\n}\n\nfunction getLabel(health: HealthStatus): string {\n switch (health) {\n case HealthStatus.Good:\n return 'Good';\n case HealthStatus.Bad:\n return 'Critical';\n case HealthStatus.Fair:\n default:\n return 'Fair';\n }\n}\n","import React, {Fragment} from 'react';\nimport classNames from 'classnames';\nimport {OverflowTooltip} from 'app/components/sharedReactComponents/OverflowTooltip/OverflowTooltip';\nimport {THEME} from 'app/constants';\nimport {Callback, ClassName, Sx} from 'app/types/common';\nimport {Typography, TypographyProps} from '@mui/material';\n\ninterface Item {\n getName: Callback<string, any>;\n}\n\nfunction hasNameGetter(item: any): item is Item {\n return 'getName' in item;\n}\n\nfunction defaultGetName(item: any) {\n if (hasNameGetter(item)) {\n return item.getName();\n }\n\n throw new Error(\n 'Default name getter cannot be applied due to item does not have \"getName\" method',\n );\n}\n\ninterface Props<T extends object> extends ClassName {\n items: T[];\n maxNameCount?: number;\n theme?: THEME;\n getName?: Callback<string, [item: T]>;\n}\n\nexport const ItemsEnumeration = <T extends object>({\n className,\n items,\n maxNameCount = 5,\n theme,\n getName = defaultGetName,\n}: Props<T>) => {\n const itemsCount = items.length;\n\n return (\n <span\n className={classNames(\n 'items-enumeration',\n theme && `items-enumeration--theme-${theme}`,\n className,\n )}\n >\n {itemsCount <= maxNameCount ? (\n items.map((item, index) => (\n <Fragment key={index}>\n <span className=\"items-enumeration__item\">\n <OverflowTooltip>{getName(item)}</OverflowTooltip>\n </span>\n\n {index < itemsCount - 1 && ', '}\n </Fragment>\n ))\n ) : (\n <span className=\"items-enumeration__count\">{itemsCount}</span>\n )}\n </span>\n );\n};\n\ntype Args = Sx & {\n names: string[];\n max?: number;\n variant?: TypographyProps['variant'];\n color?: TypographyProps['color'];\n};\n\nexport function NamesList({sx, names, max = 5, variant, color}: Args) {\n const count = names.length;\n const collapse = count > max;\n\n if (collapse) {\n return (\n <Typography sx={sx} component=\"span\" variant={variant} color={color}>\n {count}\n </Typography>\n );\n }\n\n return (\n <Typography sx={sx} component=\"span\" variant={variant}>\n {names.map((name, index) => (\n <Fragment key={name}>\n <Typography\n display=\"inline-block\"\n maxWidth=\"70%\"\n component=\"span\"\n variant=\"inherit\"\n color={color}\n >\n <OverflowTooltip>{name}</OverflowTooltip>\n </Typography>\n {index < count - 1 && ', '}\n </Fragment>\n ))}\n </Typography>\n );\n}\n","import React, {useState} from 'react';\nimport {\n Box,\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogProps,\n DialogTitle,\n Typography,\n} from '@mui/material';\nimport {LoadingButton} from '@mui/lab';\nimport {Prompt} from 'app/types/common';\nimport {useMounted} from 'app/hooks/useIsMounted';\nimport {NamesList} from 'app/components/sharedReactComponents/ItemsEnumeration';\nimport {pluralizeN} from 'app/components/helpers/commonHelpers';\n\ntype Action = 'start' | 'stop';\n\ntype Props = {\n loading: boolean;\n names: string[];\n action: Action;\n onSwitch: (action: Action) => Promise<void>;\n onClose: () => void;\n};\n\nfunction ProjectsSwitcher({loading, names, action, onSwitch, onClose}: Props) {\n const isStart = action === 'start';\n\n return (\n <Box>\n <DialogTitle>\n {isStart ? 'Start' : 'Stop'}{' '}\n <NamesList max={3} variant=\"inherit\" color=\"primary.main\" names={names} />{' '}\n {pluralizeN('project', names.length)}\n </DialogTitle>\n\n <DialogContent>\n {isStart ? (\n <Typography textAlign=\"center\">\n Starting your project may take several minutes.\n </Typography>\n ) : (\n <Typography textAlign=\"center\">\n This will terminate all active streaming and recording sessions.\n </Typography>\n )}\n </DialogContent>\n\n <DialogActions>\n <LoadingButton\n data-id=\"confirm-switch-btn\"\n sx={{minWidth: 70}}\n loading={loading}\n variant=\"contained\"\n color={isStart ? 'secondary' : 'error'}\n disableRipple={false}\n onClick={() => onSwitch(action)}\n >\n {isStart ? 'Start' : 'Stop'}\n </LoadingButton>\n\n <Button\n data-id=\"cancel-switch-btn\"\n sx={{minWidth: 70}}\n variant=\"outlined\"\n color=\"info\"\n disableRipple={false}\n onClick={onClose}\n >\n Cancel\n </Button>\n </DialogActions>\n </Box>\n );\n}\n\ntype PromptProps = Prompt &\n Omit<Props, 'loading'> &\n Pick<DialogProps, 'maxWidth' | 'fullWidth' | 'keepMounted'>;\n\nexport function ProjectsSwitcherDialog({\n open,\n names,\n action,\n onSwitch,\n onClose,\n ...props\n}: PromptProps) {\n const mounted = useMounted();\n const [loading, setLoading] = useState(false);\n\n const handleSwitch = async (type: Action) => {\n try {\n setLoading(true);\n await onSwitch(type);\n } finally {\n if (mounted()) {\n setLoading(false);\n }\n }\n };\n\n return (\n <Dialog {...props} open={open} onClose={onClose}>\n <ProjectsSwitcher\n names={names}\n loading={loading}\n action={action}\n onSwitch={handleSwitch}\n onClose={onClose}\n />\n </Dialog>\n );\n}\n","import React, {useState} from 'react';\nimport {ButtonProps} from '@mui/material';\nimport {LoadingButton} from '@mui/lab';\nimport {Sx} from 'app/types/common';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {ProjectsSwitcherDialog} from 'app/components/dialogs/ProjectsSwitcherDialog/ProjectsSwitcherDialog';\nimport {DeviceApiService} from 'app/services/api/device/DeviceApiService';\nimport {Notifications} from 'app/components/Notifications';\n\ntype SwitchAction = React.ComponentProps<typeof ProjectsSwitcherDialog>['action'];\n\ntype Props = Sx & {\n action: SwitchAction;\n project: AnyDeviceModelType;\n size?: ButtonProps['size'];\n disabled?: boolean;\n};\n\nexport function UnifySwitcher({sx, project, action, size, disabled}: Props) {\n const [dialog, setDialog] = useState(false);\n\n const isStart = action === 'start';\n\n const handleSwitch = async (action: SwitchAction) => {\n const projectId = project.getId();\n\n try {\n if (isStart) {\n await DeviceApiService.startProject(projectId);\n } else {\n await DeviceApiService.stopProject(projectId);\n }\n\n setDialog(false);\n } catch {\n Notifications.addErrorNotification(`Failed to ${action} Unify project`);\n }\n };\n\n return (\n <>\n <LoadingButton\n sx={sx}\n data-id=\"unify-switch-btn\"\n variant=\"contained\"\n color={isStart ? 'secondary' : 'primary'}\n size={size}\n disabled={disabled}\n onClick={() => setDialog(true)}\n >\n {isStart ? 'Start' : 'Stop'}\n </LoadingButton>\n\n <ProjectsSwitcherDialog\n open={dialog}\n names={[project.getName()]}\n action={action}\n onSwitch={handleSwitch}\n onClose={() => setDialog(false)}\n />\n </>\n );\n}\n","import React from 'react';\nimport {Stack} from '@mui/material';\nimport {DeviceStatusIndicator} from 'app/components/FleetManager/DeviceCard/StatusList/DeviceStatusIndicator';\nimport {FleetManagerColumnId} from 'app/components/FleetManager/constants';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\nimport {FleetManagerColumn} from 'app/components/FleetManager/types';\nimport {RemoteLoginButton} from 'app/components/sharedReactComponents/RemoteLogin';\nimport {ModelService} from 'app/services/deviceModel/DeviceModelService';\nimport {formatFullDate} from 'app/util/time';\nimport {format} from 'app/util/decimal';\nimport {isNil} from 'app/util/isNil';\nimport {DeviceHealthIndicator} from 'app/components/sharedReactComponents/DeviceHealthIndicator/DeviceHealthIndicator';\nimport {UnifySwitcher} from 'app/components/sharedReactComponents/UnifySwitcher/UnifySwitcher';\n\nconst modelCell = (): FleetManagerColumn => ({\n dataKey: FleetManagerColumnId.Model,\n width: 108,\n label: 'Model',\n cellRenderer: ({device}) => device.getModelName(),\n});\n\nconst statusCell = (props?: Partial<FleetManagerColumn>): FleetManagerColumn => ({\n dataKey: FleetManagerColumnId.Status,\n width: 82,\n label: 'Status',\n cellRenderer: ({device, progress}) => (\n <DeviceStatusIndicator device={device} progress={progress} />\n ),\n ...props,\n});\n\nconst ipAddressCell = (): FleetManagerColumn => ({\n dataKey: FleetManagerColumnId.IpAddress,\n width: 100,\n label: 'IP address',\n cellRenderer: ({device}) => device.getIPAddress(),\n});\n\nconst serialNumberCell = (): FleetManagerColumn => ({\n dataKey: FleetManagerColumnId.SerialNumber,\n width: 100,\n label: 'Serial number',\n cellRenderer: ({device}) => device.getSerialNumber(),\n});\n\nconst hostNameCell = (): FleetManagerColumn => ({\n dataKey: FleetManagerColumnId.HostName,\n width: 170,\n label: 'Host',\n detailedLabel: 'Host name',\n cellRenderer: ({device}) => device.getHostName(),\n});\n\nconst firmwareCell = (): FleetManagerColumn => ({\n dataKey: FleetManagerColumnId.FirmwareVersion,\n width: 100,\n label: 'Firmware',\n cellRenderer: ({device}) => device.getFirmwareVersion(),\n});\n\nconst systemLoadCell = (): FleetManagerColumn => ({\n dataKey: FleetManagerColumnId.SystemLoad,\n width: 62,\n label: 'Sys. load',\n detailedLabel: 'System load',\n cellRenderer: ({system}) => {\n return system?.load ? `${system.load}%` : '';\n },\n});\n\nconst temperatureCell = (): FleetManagerColumn => ({\n dataKey: FleetManagerColumnId.Temperature,\n width: 59,\n label: 'Temp.',\n detailedLabel: 'Temperature',\n cellRenderer: ({system}) => {\n return system?.temperature ? `${system.temperature}°C` : '';\n },\n});\n\nconst uptimeCell = (): FleetManagerColumn => ({\n dataKey: FleetManagerColumnId.Uptime,\n width: 68,\n label: 'Uptime',\n detailedLabel: 'Device uptime',\n cellRenderer: ({device, system}) => {\n const uptimeFormatted = device.getUptimeFormatted(system?.uptime);\n\n if (!uptimeFormatted) {\n return null;\n }\n\n return (\n <Tooltip\n content={system?.uptime ? `Since: ${formatFullDate(system.uptime)}` : null}\n delay={250}\n >\n {uptimeFormatted}\n </Tooltip>\n );\n },\n});\n\nconst storageCell = (): FleetManagerColumn => ({\n dataKey: FleetManagerColumnId.Storage,\n width: 89,\n label: 'Storage',\n detailedLabel: 'Storage: Free space',\n cellRenderer: ({storage}) => {\n if (storage) {\n return format(storage.free, 0.1, 1);\n }\n\n return null;\n },\n});\n\nconst transferQueueCell = (): FleetManagerColumn => ({\n dataKey: FleetManagerColumnId.TransferQueue,\n width: 89,\n label: 'Queue',\n detailedLabel: 'Transfer queue',\n cellRenderer: ({afu}) => {\n if (isNil(afu) || afu.state === 'disabled') {\n return '';\n }\n\n return format(afu.queue?.size ?? 0, 0.1, 1);\n },\n});\n\nconst healthCell = (props?: Partial<FleetManagerColumn>): FleetManagerColumn => ({\n dataKey: FleetManagerColumnId.Health,\n width: 68,\n label: 'Health',\n detailedLabel: 'Device health',\n cellRenderer: ({device}) => (\n <DeviceHealthIndicator\n warnings={device.getWarnings()}\n offline={device.isOffline()}\n loading={device.isStarting()}\n />\n ),\n ...props,\n});\n\nconst accessCell = (): FleetManagerColumn => ({\n dataKey: FleetManagerColumnId.Access,\n width: 158,\n label: 'Access',\n cellRenderer: ({device, role}) => {\n const model = device.getModelName();\n\n if (ModelService.isUnify(model) && device.isDown()) {\n return (\n <UnifySwitcher\n project={device}\n action=\"start\"\n size=\"small\"\n disabled={!role.canManageUnify() || !device.capabilities.resume}\n />\n );\n }\n\n if (!device.capabilities.login) {\n return null;\n }\n\n const showSwitcher = !ModelService.isLivescrypt(model) && !ModelService.isNano(model);\n\n const access = device.capabilities.login;\n\n const paymentAccess = role.canEditBilling();\n\n const deviceId = device.getId();\n const offline = device.isOffline();\n\n return (\n <Stack direction=\"row\" alignItems=\"center\" gap={0.5}>\n <RemoteLoginButton\n type=\"admin\"\n premium={access}\n paymentAccess={paymentAccess}\n deviceId={deviceId}\n disabled={offline}\n size=\"small\"\n />\n\n {showSwitcher && (\n <RemoteLoginButton\n type=\"switcher\"\n deviceId={deviceId}\n premium={access}\n paymentAccess={paymentAccess}\n disabled={offline}\n size=\"small\"\n />\n )}\n </Stack>\n );\n },\n});\n\nexport {\n modelCell,\n statusCell,\n ipAddressCell,\n serialNumberCell,\n firmwareCell,\n systemLoadCell,\n temperatureCell,\n uptimeCell,\n storageCell,\n transferQueueCell,\n healthCell,\n accessCell,\n hostNameCell,\n};\n","import {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {HealthStatus} from 'app/components/DeviceDetails/constants';\nimport {FleetManagerColumnId} from 'app/components/FleetManager/constants';\nimport {FilterSwitchGroupId} from 'app/components/FleetManager/useFilterSwitches';\nimport {\n modelCell,\n statusCell,\n ipAddressCell,\n serialNumberCell,\n firmwareCell,\n systemLoadCell,\n temperatureCell,\n uptimeCell,\n storageCell,\n transferQueueCell,\n healthCell,\n accessCell,\n} from 'app/components/FleetManager/cells';\n\nexport const sortOptionsMap = {\n status: {\n value: 'status',\n label: 'Status',\n callback: (device: AnyDeviceModelType) => device.isOnline(),\n },\n name: {\n value: 'name',\n label: 'Name',\n callback: (device: AnyDeviceModelType) => device.getName(),\n },\n health: {\n value: 'health',\n label: 'Health',\n callback: (device: AnyDeviceModelType) => {\n // Errors, Warnings and then No warnings\n switch (device.getHealthStatus()) {\n case HealthStatus.Good:\n return 1;\n case HealthStatus.Fair:\n return 2;\n default:\n return 3;\n }\n },\n },\n model: {\n value: 'model',\n label: 'Model',\n callback: (device: AnyDeviceModelType) => device.getModelName(),\n },\n} as const;\n\nexport const sortOptions = [\n sortOptionsMap.status,\n sortOptionsMap.name,\n sortOptionsMap.health,\n sortOptionsMap.model,\n];\n\nexport const defaultActiveColumns = [\n FleetManagerColumnId.Model,\n FleetManagerColumnId.Status,\n FleetManagerColumnId.IpAddress,\n FleetManagerColumnId.Temperature,\n FleetManagerColumnId.Storage,\n FleetManagerColumnId.Health,\n FleetManagerColumnId.Access,\n];\n\nexport const collapsibleFilterSwitchGroups = new Set([\n FilterSwitchGroupId.View,\n FilterSwitchGroupId.Group,\n FilterSwitchGroupId.Status,\n FilterSwitchGroupId.Activity,\n FilterSwitchGroupId.Model,\n FilterSwitchGroupId.Health,\n FilterSwitchGroupId.Schedule,\n FilterSwitchGroupId.CMS,\n]);\n\nexport const searchableFilterSwitchGroups = new Set([FilterSwitchGroupId.Group]);\n\nexport const columns = [\n modelCell(),\n statusCell(),\n ipAddressCell(),\n serialNumberCell(),\n firmwareCell(),\n temperatureCell(),\n storageCell(),\n transferQueueCell(),\n systemLoadCell(),\n uptimeCell(),\n healthCell(),\n accessCell(),\n];\n","export const ActionTypes = {\n UI_PORTAL_ELEMENT_MOUNT: 'ui.portalElement.mount',\n UI_PORTAL_ELEMENT_UNMOUNT: 'ui.portalElement.unmount',\n\n ALERTS_COUNT: 'user.alerts.count',\n\n TEAMS_TEAM_RENAMED: 'teams.teamRenamed',\n TEAMS_TEAM_CREATED: 'teams.teamCreated',\n TEAMS_TEAM_PLAN_UPDATE: 'teams.teamPlanUpdate',\n\n UNHANDLED_COMPONENT_EXCEPTION: 'app.unhandledComponentException',\n};\n","import {SxProps, Theme} from '@mui/material';\nimport {grey} from '@mui/material/colors';\n\nexport const scrollbarSx: SxProps<Theme> = (t) => ({\n 'html ::-webkit-scrollbar': {\n width: t.spacing(1),\n height: t.spacing(1),\n },\n 'html ::-webkit-scrollbar-track': {\n bgcolor: 'transparent',\n },\n 'html ::-webkit-scrollbar-thumb': {\n borderRadius: 4,\n bgcolor: grey[300],\n },\n 'html ::-webkit-scrollbar-thumb:hover': {\n borderRadius: 4,\n bgcolor: grey[500],\n },\n});\n","import {\n autocompleteClasses,\n createTheme,\n inputBaseClasses,\n outlinedInputClasses,\n} from '@mui/material';\nimport {scrollbarSx} from 'app/themes/styles';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {blue, grey, lightGreen, red} from '@mui/material/colors';\n\nexport const text = {\n // TODO: replace from palette\n group: '#7e8691',\n label: '#848489',\n disabled: 'rgba(51, 51, 51, 0.75)',\n};\n\nexport const borders = {\n normal: '#c0c0c2',\n hover: '#7f838c',\n focus: '#333c50',\n error: '#ff0048',\n};\n\nexport const backgrounds = {\n disabled: 'rgba(51, 51, 51, 0.09)',\n blue: '#eff6ff',\n gray: '#f6f7f8',\n lightGray: '#f3f4f6',\n gray1: '#fafafa',\n};\n\nexport const palette = {\n black: '#03030c',\n gray: '#73839c',\n grayMedium: '#dbdbdb',\n darkerGray: '#7e8691',\n gray1: '#4a4a4a',\n gray2: '#4f4f4f',\n gray3: '#828282',\n gray4: '#bdbdbd',\n gray5: '#5e6871',\n gray6: '#979797',\n gray7: '#a1a7af',\n gray9: '#848fa8',\n blue: '#4a90e2',\n red: '#ff0048',\n green: '#8cbe3f',\n green2: '#6b9936',\n badge: '#333c50',\n orange: '#ffc800',\n orange2: '#ef7a12',\n orange3: '#fbab00',\n obscure: '#667ba8',\n white: '#fff',\n dark: '#2d3546',\n dark1: '#222836',\n};\n\nconst lightTheme = createTheme({\n spacing: 8,\n shape: {borderRadius: 4},\n palette: {\n primary: {main: palette.blue},\n secondary: {main: lightGreen[700]},\n error: {main: red.A400},\n info: {main: grey[600]},\n text: {disabled: grey[500]},\n },\n typography: {\n fontSize: 14,\n htmlFontSize: 16,\n fontFamily: 'Open Sans, sans-serif',\n button: {textTransform: 'none'},\n },\n components: {\n MuiCssBaseline: {\n styleOverrides: (t) =>\n t.unstable_sx(\n packSx(scrollbarSx, {\n html: {fontSize: 14},\n body: {overscrollBehaviorY: 'none'},\n }),\n ),\n },\n MuiDialog: {defaultProps: {scroll: 'body'}},\n MuiSelect: {\n defaultProps: {variant: 'outlined'},\n },\n MuiOutlinedInput: {\n styleOverrides: {\n root: ({theme}) =>\n theme.unstable_sx({\n [`&:hover .${outlinedInputClasses.notchedOutline}`]: {borderColor: borders.hover},\n [`&.Mui-focused .${outlinedInputClasses.notchedOutline}`]: {\n borderColor: borders.focus,\n borderWidth: 1,\n boxShadow: '0 0 0 2px rgba(185, 185, 185, 0.4)',\n },\n [`&.Mui-disabled .${outlinedInputClasses.notchedOutline}`]: {\n borderColor: borders.normal,\n backgroundColor: backgrounds.disabled,\n color: text.disabled,\n },\n [`&.Mui-error .${outlinedInputClasses.notchedOutline}`]: {borderColor: borders.error},\n }),\n input: ({theme}) =>\n theme.unstable_sx({\n padding: '8px 7px',\n '&::placeholder': {color: text.label, opacity: 0.5},\n }),\n },\n },\n MuiInput: {\n defaultProps: {\n disableUnderline: true,\n },\n styleOverrides: {\n root: ({theme}) =>\n theme.unstable_sx({\n border: '1px solid',\n borderRadius: `${theme.shape.borderRadius}px`,\n borderColor: borders.normal,\n bgcolor: 'white',\n [`&.Mui-focused`]: {\n boxShadow: '0 0 0 2px rgba(185, 185, 185, 0.4)',\n borderColor: borders.focus,\n },\n [`&.Mui-disabled`]: {backgroundColor: backgrounds.disabled},\n [`&.Mui-error`]: {borderColor: borders.error},\n [`&.${inputBaseClasses.adornedEnd}`]: {pr: 1},\n }),\n input: ({theme}) =>\n theme.unstable_sx({\n padding: '8px 7px',\n borderRadius: `${theme.shape.borderRadius}px`,\n\n '&::placeholder': {color: text.label, opacity: 1},\n }),\n },\n },\n MuiInputLabel: {\n defaultProps: {\n shrink: true,\n },\n styleOverrides: {\n root: ({theme}) =>\n theme.unstable_sx({\n color: text.label,\n fontSize: '12px',\n transform: 'none',\n\n '&.Mui-focused': {color: text.label},\n '&.Mui-error': {color: text.label},\n '&.Mui-disabled': {color: text.label},\n }),\n },\n },\n MuiFormHelperText: {\n styleOverrides: {\n root: {margin: '0px', fontSize: '12px'},\n },\n },\n MuiAutocomplete: {\n styleOverrides: {\n root: ({theme}) =>\n theme.unstable_sx({\n [`& .${outlinedInputClasses.root}`]: {\n padding: '8px 7px',\n\n [`& .${autocompleteClasses.input}`]: {py: 0, pl: 0},\n },\n }),\n },\n },\n MuiDialogTitle: {\n defaultProps: {variant: 'h5', textAlign: 'center'},\n styleOverrides: {\n root: ({theme}) => theme.unstable_sx({pt: 3, px: 5}),\n },\n },\n MuiDialogContent: {\n styleOverrides: {root: ({theme}) => theme.unstable_sx({px: 5, py: 1})},\n },\n MuiDialogActions: {\n styleOverrides: {\n root: ({theme}) => theme.unstable_sx({justifyContent: 'center', px: 5, pb: 3}),\n },\n },\n MuiTooltip: {\n defaultProps: {\n arrow: true,\n placement: 'top',\n disableInteractive: true,\n },\n styleOverrides: {\n tooltip: {fontSize: 12},\n },\n },\n },\n});\n\nconst darkTheme = createTheme({\n palette: {mode: 'dark', primary: {main: blue[500]}, info: {main: grey[50]}},\n components: {\n MuiTooltip: {\n styleOverrides: {tooltip: {fontSize: 12}},\n },\n },\n typography: {\n fontFamily: 'Open Sans, sans-serif',\n button: {textTransform: 'none'},\n },\n});\n\nexport {lightTheme, darkTheme};\n","import axios, {AxiosRequestConfig} from 'axios';\nimport {front} from 'app/api/CirrusApi';\nimport {EdgeContract} from 'app/contracts/edge';\nimport {Edge} from 'app/domain/edge';\n\nexport class PresetApiService {\n static async applyLocalPreset(\n deviceId: string,\n contract: EdgeContract.ApplyUnitPreset,\n ): Promise<void> {\n return front.devices(deviceId).presets().local().put(contract);\n }\n static async applyTeamPreset(\n deviceId: string,\n payload: EdgeContract.ApplyTeamPreset,\n ): Promise<void> {\n return front.devices(deviceId).presets().cloud().put(payload);\n }\n\n static async getTeamPresets(): Promise<EdgeContract.TeamPreset[]> {\n return front.presets().get();\n }\n\n static async getUnitPresets(id: string): Promise<Edge.UnitPreset[] | undefined> {\n return front.devices(id).presets().local().get();\n }\n\n static async uploadUnitPreset(unitId: string, name: string): Promise<void> {\n return front.devices(unitId).presets().local().push().post({name});\n }\n\n static async updateTeamPreset(id: string, p: EdgeContract.UpdatePreset) {\n return front.presets(id).put(p);\n }\n\n static async uploadPresetFile(\n data: FormData,\n config?: AxiosRequestConfig<FormData>,\n ): Promise<EdgeContract.TeamPreset> {\n const url: string = front.presets().url();\n return axios.post<FormData, EdgeContract.TeamPreset>(url, data, config);\n }\n\n static async createUnitPreset(deviceId: string, data: EdgeContract.CreateUnitPreset) {\n return front.devices(deviceId).presets().local().post(data);\n }\n\n static getDownloadUrl(id: string): string {\n return front.presets(id).url();\n }\n\n static deleteTeamPreset(id: string): Promise<void> {\n return front.presets(id).delete();\n }\n\n static deleteLocalPreset(deviceId: string, name: string): Promise<void> {\n return front.devices(deviceId).presets().local().remove().post({name});\n }\n}\n","import {front} from 'app/api/CirrusApi';\nimport {apiClient} from 'app/components/shared';\n\nexport class DeviceGroupApiService {\n static async moveToGroup(teamId: string, groupId: string, deviceId: string): Promise<void> {\n return apiClient.post(`front/api/v1t/team/${teamId}/groups/${groupId}/${deviceId}`);\n }\n\n static async removeFromGroup(teamId: string, groupId: string, deviceId: string): Promise<void> {\n return apiClient.delete(`front/api/v1t/team/${teamId}/groups/${groupId}/${deviceId}`);\n }\n\n static async createGroup(teamId: string, name: string): Promise<void> {\n return apiClient.post(`/front/api/v1t/team/${teamId}/groups`, {name});\n }\n\n static async renameGroup(teamId: string, groupId: string, name: string): Promise<void> {\n return apiClient.put(`front/api/v1t/team/${teamId}/groups/${groupId}`, {name});\n }\n\n static async deleteGroup(teamId: string, groupId: string): Promise<void> {\n return apiClient.delete(`front/api/v1t/team/${teamId}/groups/${groupId}`);\n }\n\n static async batchDelete(groups: string[]): Promise<void> {\n return front.groups().batch().remove().post({groups});\n }\n\n static async batchRemoveDevices(devices: string[]): Promise<void> {\n return front.groups().batch().ungroup().post({devices});\n }\n\n static async batchMoveToGroup(groupId: string, devices: string[]): Promise<void> {\n return front.groups(groupId).devices().move().post({devices});\n }\n}\n","import React, {useState} from 'react';\nimport {Controller, useForm} from 'react-hook-form';\nimport {z} from 'zod';\nimport {zodResolver} from '@hookform/resolvers/zod';\nimport {\n Box,\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n Stack,\n TextField,\n} from '@mui/material';\nimport {LoadingButton} from '@mui/lab';\nimport {Prompt} from 'app/types/common';\nimport {useMounted} from 'app/hooks/useIsMounted';\nimport {isNil} from 'app/util/isNil';\n\nconst scheme = z.object({\n name: z.string().trim().min(1, {message: 'Required field'}),\n});\n\ntype Form = z.infer<typeof scheme>;\n\ntype Props = {\n loading: boolean;\n onCreate: (name: string) => Promise<void>;\n onClose: () => void;\n};\n\nfunction CreateGroup({loading, onCreate, onClose}: Props) {\n const {\n control,\n formState: {isValid},\n handleSubmit,\n } = useForm<Form>({\n defaultValues: {name: ''},\n mode: 'onChange',\n resolver: zodResolver(scheme),\n });\n\n const handleCreate = async ({name}: Form) => {\n await onCreate(name);\n };\n\n return (\n <Box>\n <DialogTitle>Create group</DialogTitle>\n\n <DialogContent>\n <Stack component=\"form\" id=\"create-group\" onSubmit={handleSubmit(handleCreate)}>\n <Controller\n name=\"name\"\n control={control}\n render={({field, fieldState: {error}}) => (\n <TextField\n {...field}\n inputProps={{'data-id': 'group-name-input'}}\n label=\"Name\"\n variant=\"standard\"\n fullWidth={true}\n error={!isNil(error)}\n helperText={error?.message ?? ' '}\n autoFocus={true}\n />\n )}\n />\n </Stack>\n </DialogContent>\n\n <DialogActions>\n <LoadingButton\n data-id=\"confirm-create-btn\"\n type=\"submit\"\n variant=\"contained\"\n color=\"secondary\"\n form=\"create-group\"\n loading={loading}\n disabled={!isValid}\n >\n Create\n </LoadingButton>\n\n <Button data-id=\"cancel-create-btn\" variant=\"outlined\" color=\"info\" onClick={onClose}>\n Cancel\n </Button>\n </DialogActions>\n </Box>\n );\n}\n\ntype PromptProps = Prompt & Omit<Props, 'loading'>;\n\nexport function CreateGroupDialog({open, onClose, onCreate}: PromptProps) {\n const mounted = useMounted();\n const [loading, setLoading] = useState(false);\n\n const handleCreate = async (name: string) => {\n try {\n setLoading(true);\n await onCreate(name);\n } finally {\n if (mounted()) {\n setLoading(false);\n }\n }\n };\n\n return (\n <Dialog maxWidth=\"xs\" fullWidth={true} open={open} onClose={onClose}>\n <CreateGroup loading={loading} onCreate={handleCreate} onClose={onClose} />\n </Dialog>\n );\n}\n","import {front} from 'app/api/CirrusApi';\nimport {UpdateMode} from 'app/components/sharedReactComponents/Events/Editor/EventForm/types';\nimport {ScheduleContract} from 'app/contracts/schedule';\nimport {Device} from 'app/components/DeviceDetails/Models/types';\n\nexport class ScheduleApiService {\n static async refreshDeviceSchedule(id: string): Promise<void> {\n return front.cms().v2().schedule().devices(id).refresh().post();\n }\n\n static async refreshTeamSchedule(): Promise<void> {\n return front.cms().v2().schedule().refresh().post();\n }\n\n static async startEvent(id: string): Promise<void> {\n return front.cms().v2().schedule().events(id).action().start().post();\n }\n\n static async stopEvent(id: string): Promise<void> {\n return front.cms().v2().schedule().events(id).action().stop().post();\n }\n\n static async pauseEvent(id: string): Promise<void> {\n return front.cms().v2().schedule().events(id).action().pause().post();\n }\n\n static async resumeEvent(id: string): Promise<void> {\n return front.cms().v2().schedule().events(id).action().resume().post();\n }\n\n static async extendEvent(id: string): Promise<void> {\n return front.cms().v2().schedule().events(id).action().extend().post();\n }\n\n static async confirmEvent(eventId: string, deviceId: string): Promise<void> {\n return front.cms().v2().schedule().events(eventId).confirm().devices(deviceId).post();\n }\n\n static async updateEvent(\n eventId: string,\n r: ScheduleContract.EventRule,\n mode: UpdateMode,\n ): Promise<void> {\n return front.cms().v2().schedule().events(eventId, {scope: mode}).put(r);\n }\n\n static async createEvent(p: ScheduleContract.EventRule): Promise<void> {\n return front.cms().v2().schedule().events().post(p);\n }\n\n static async getTeamSchedule(\n since: TimeStampMilliseconds,\n until: TimeStampMilliseconds,\n ): Promise<ScheduleContract.TeamSchedule> {\n return front.cms().v2().schedule().events().get({since, until});\n }\n\n static async getDeviceSchedule(\n deviceId: string,\n since: TimeStampMilliseconds,\n until: TimeStampMilliseconds,\n ): Promise<ScheduleContract.DeviceSchedule> {\n return front.cms().v2().schedule().devices(deviceId).events().get({since, until});\n }\n\n static async getEventDetails(id: string): Promise<ScheduleContract.DetailedEvent> {\n return front.cms().v2().schedule().events(id).get();\n }\n\n static async deleteEvent(id: string, mode: UpdateMode): Promise<void> {\n return front.cms().v2().schedule().events(id, {scope: mode}).delete();\n }\n\n static async getEpiphanCmsDevices(): Promise<Device[]> {\n return front.cms().v2().schedule().devices().get({cms_name: 'chrono'});\n }\n\n static async getDeviceActualEvent(deviceId: string): Promise<ScheduleContract.Event | undefined> {\n return front.cms().v2().schedule().devices(deviceId).current_event().get();\n }\n\n static async getTeamActualEvents(): Promise<Record<string, ScheduleContract.Event>> {\n return front.cms().v2().schedule().current_events().get();\n }\n}\n\nexport const scheduleApiService = new ScheduleApiService();\n","import {EdgeContract} from 'app/contracts/edge';\nimport {Edge} from 'app/domain/edge';\nimport {isNil} from 'app/util/isNil';\nimport dayjs from 'dayjs';\n\nfunction mapSources(c: EdgeContract.Source[]): Edge.Sources {\n const video: Edge.VideoSource[] = [];\n const audio: Edge.AudioSource[] = [];\n\n c.forEach((c) => {\n const {id, name, status} = c;\n if (status.video) {\n const {state, resolution, vrr, actual_fps: fps, real_device_name} = status.video;\n\n const frameRate = vrr ? `${vrr} Hz` : fps ? `${fps} FPS` : '';\n\n video.push({\n id,\n name,\n resolution,\n frameRate,\n fps,\n hasSignal: !isNil(resolution) && resolution !== '0x0',\n isActive: state === 'active',\n realName: real_device_name ?? '',\n });\n }\n\n if (status.audio) {\n const {state, real_device_name} = status.audio;\n audio.push({\n id,\n name,\n isActive: state === 'active',\n realName: real_device_name ?? '',\n });\n }\n });\n\n return {video, audio};\n}\n\nfunction mapSystem(c: EdgeContract.System): Edge.System {\n return {\n load: c.cpu_load,\n temperature: c.cpu_temp,\n uptime: c.uptime_since,\n };\n}\n\nfunction mapStorage(c: EdgeContract.Storage): Edge.Storage {\n if (c.state !== 'ready') {\n return {total: 0, free: 0, used: 0};\n }\n\n const {free, total} = c;\n\n return {\n total,\n free,\n used: total - free,\n };\n}\n\nfunction mapTranscribeSection(c: EdgeContract.TranscribeSession): Edge.TranscribeSession {\n const {started_at, session_id, is_streaming, stopped_at} = c;\n\n return {\n id: session_id,\n name: buildSessionName(started_at, stopped_at, is_streaming),\n startedAt: started_at,\n stoppedAt: stopped_at,\n streaming: is_streaming,\n };\n}\n\nfunction buildSessionName(start: TimeStampSeconds, stop: TimeStampSeconds, isStreaming: boolean) {\n const startDate = dayjs.unix(start);\n\n if (isStreaming) {\n return startDate.format('YYYY-MM-DD_HH:mm');\n }\n\n const stopDate = dayjs.unix(stop);\n\n return `${startDate.format('YYYY-MM-DD_HH:mm')}-${stopDate.format(\n stopDate.isSame(startDate, 'd') ? 'HH:mm' : 'YYYY-MM-DD_HH:mm',\n )}`;\n}\n\nfunction mapTeamPreset(c: EdgeContract.TeamPreset): Edge.TeamPreset {\n const {id, name, sections, created_at, device_model, hash, description, size} = c;\n\n return {id, name, sections, hash, size, createdAt: created_at, device: device_model, description};\n}\n\nexport const EdgeMapper = {\n mapSources,\n mapSystem,\n mapStorage,\n mapTranscribeSection,\n mapTeamPreset,\n};\n","import {always} from 'ramda';\nimport {Dispatcher} from 'app/data/Dispatcher';\nimport {ActionTypes} from 'app/data/ActionTypes';\nimport {minutesToMilliseconds, secondsToMilliseconds} from 'app/util/timeConverter';\nimport {noop} from 'app/util/noop';\nimport {Callback, TimeStampMilliseconds} from 'app/types/common';\nimport {AbortCallback, GetAbortCallback} from 'app/api/types';\n\ntype RepeatedCallCallType = ({getAbort}: {getAbort: GetAbortCallback}) => Promise<any>;\n\ninterface RepeatedCallOptions {\n call: RepeatedCallCallType;\n onSuccess?: Callback;\n hasData?: (response: any) => boolean; // check function. If returns `false` call interval increases by *2\n initialTimeoutMs?: TimeStampMilliseconds; // call interval\n maxTimeoutMs?: TimeStampMilliseconds; // maximum increased call interval\n}\n\ntype ResolveType = (value: unknown) => void;\ntype RejectType = (reason?: any) => void;\n\nclass RepeatedCall {\n protected call: RepeatedCallCallType;\n protected onSuccessCb;\n protected hasData;\n protected initialTimeoutMs;\n protected maxTimeoutMs: TimeStampMilliseconds;\n\n protected timeoutId = -1;\n protected resolve: ResolveType = noop;\n protected reject: RejectType = noop;\n protected stopped = false;\n protected timeoutMs: TimeStampMilliseconds;\n protected abortRequest: AbortCallback = noop;\n\n constructor({\n call,\n onSuccess,\n hasData = always(true),\n initialTimeoutMs = secondsToMilliseconds(1),\n maxTimeoutMs = minutesToMilliseconds(13), // Don't known why 13 minutes\n }: RepeatedCallOptions) {\n this.call = call;\n this.onSuccessCb = onSuccess;\n this.hasData = hasData;\n this.initialTimeoutMs = initialTimeoutMs;\n this.maxTimeoutMs = maxTimeoutMs;\n\n this.timeoutMs = this.initialTimeoutMs;\n\n this.handleComponentException = this.handleComponentException.bind(this);\n }\n\n async start(immediately?: boolean): Promise<any> {\n this.stopped = false;\n\n Dispatcher.on(ActionTypes.UNHANDLED_COMPONENT_EXCEPTION, this.handleComponentException);\n\n return new Promise((resolve, reject) => {\n this.resolve = resolve;\n this.reject = reject;\n\n this.task(immediately);\n });\n }\n\n stop() {\n this.stopped = true;\n this.abortRequest();\n\n window.clearTimeout(this.timeoutId);\n\n Dispatcher.removeListener(ActionTypes.UNHANDLED_COMPONENT_EXCEPTION, this.handleComponentException);\n }\n\n async restart(immediately?: boolean): Promise<any> {\n this.stop();\n this.timeoutMs = this.initialTimeoutMs;\n return this.start(immediately);\n }\n\n getTimeoutMs() {\n return this.timeoutMs;\n }\n\n private increaseTimeout() {\n this.timeoutMs = Math.min(this.maxTimeoutMs, this.timeoutMs * 2);\n }\n\n private onSuccess(result) {\n if (this.hasData(result)) {\n this.timeoutMs = this.initialTimeoutMs;\n this.resolve(result);\n } else {\n this.increaseTimeout();\n }\n\n if (typeof this.onSuccessCb === 'function') {\n this.onSuccessCb(result, () => this.stop());\n }\n\n if (this.stopped) {\n this.resolve(result);\n } else {\n this.task();\n }\n }\n\n private catch(err) {\n if (!this.stopped) {\n this.stop();\n }\n\n this.reject(err);\n }\n\n private async task(immediately = false) {\n if (immediately) {\n await this.runTask();\n } else {\n this.runTaskTimeout();\n }\n }\n\n private runTaskTimeout() {\n this.timeoutId = window.setTimeout(async () => {\n await this.runTask();\n }, this.timeoutMs);\n }\n\n private async runTask() {\n try {\n const result = await this.call({\n getAbort: abort => this.abortRequest = abort,\n });\n\n if (!this.stopped) {\n this.onSuccess(result);\n }\n } catch (err: unknown) {\n this.catch(err);\n }\n }\n\n private handleComponentException() {\n this.stop();\n }\n}\n\nexport {RepeatedCall};\n","import {front} from 'app/api/CirrusApi';\nimport {StreamingDestinationOptions} from 'app/components/StreamingServices/StreamingDestinations/types';\nimport {Callback} from 'app/types/common';\n\nclass StreamApiService {\n getStreams = async (\n getAbort?: Callback\n ): Promise<StreamingDestinationOptions[]> => front.streams().get(undefined, {getAbort});\n}\n\nexport const streamApiService = new StreamApiService();\n","import {STREAMING_SERVICE_TYPE} from 'app/components/StreamingServices/constants';\nimport {StreamingDestinationOptions} from 'app/components/StreamingServices/StreamingDestinations/types';\n\nclass BaseStreamingService {\n protected type: STREAMING_SERVICE_TYPE | null = null;\n protected name: string | null = null;\n protected service: any = null;\n\n getType() {\n return this.type;\n }\n\n getName() {\n return this.name;\n }\n\n createStreamingDestinationModel(_json: StreamingDestinationOptions): any {\n throw new Error('Unregistered method');\n }\n\n async createService(_name?: string): Promise<string> {\n throw new Error('Unregistered method');\n }\n\n isDisabled() {\n return false;\n }\n\n isAvailableToCreate() {\n return true;\n }\n}\n\nexport {\n BaseStreamingService,\n};\n","import {front} from 'app/api/CirrusApi';\nimport {Notifications} from 'app/components/Notifications';\nimport {\n STREAMING_SERVICE_PROP_NAME,\n STREAMING_SERVICE_SETTINGS_PROP_NAME,\n STREAMING_SERVICE_TYPE,\n} from 'app/components/StreamingServices/constants';\nimport {StreamingDestinationOptions} from 'app/components/StreamingServices/StreamingDestinations/types';\nimport {DeviceActiveStreamingInfo} from 'app/components/DeviceDetails/Models/types';\n\nclass BaseStreamingDestinationModel {\n protected data: Record<string, any> = {};\n protected options: Record<string, any> = {};\n protected settings: Record<string, any> = {};\n protected streamingInfo: DeviceActiveStreamingInfo | Record<string, any> = {};\n protected endpoint: any;\n\n constructor(json: StreamingDestinationOptions) {\n this.updateFromJSON(json);\n\n this.endpoint = front.streams(this.getId());\n }\n\n toJSON(data = {}) {\n const json = this.dataToJSON({\n ...this.data,\n ...data,\n });\n\n if (this.getOptionsPropName()) {\n json[this.getOptionsPropName()] = this.optionsToJSON({\n ...this.getOptions(),\n ...data,\n });\n }\n\n if (this.getSettingsPropName()) {\n json[this.getSettingsPropName()] = this.settingsToJSON({\n ...this.getSettings(),\n ...data,\n });\n }\n\n return json;\n }\n\n isDeleted(): boolean {\n return this.data.deleted;\n }\n\n getLastModified() {\n return this.data.lastModified;\n }\n\n getName(): string {\n return this.data.name;\n }\n\n async updateName(name: string) {\n return this.updateAction({name});\n }\n\n getId(): string {\n return this.data.id;\n }\n\n getType(): STREAMING_SERVICE_TYPE {\n return this.data.type;\n }\n\n getOptions() {\n return this.options;\n }\n\n getSettings() {\n return this.settings;\n }\n\n getStartTime() {\n return this.getStreamingInfo().startTime || null;\n }\n\n getStreamingURL() {\n return this.getStreamingInfo().url || null;\n }\n\n async deleteAction() {\n return this.endpoint.delete();\n }\n\n async updateAction(data): Promise<any> {\n const newData = this.toJSON(data);\n\n return this.endpoint.put(newData).then(() => {\n // TODO: May be from `response`?\n this.updateFromJSON(newData);\n });\n }\n\n isStreaming() {\n return this.data.streaming;\n }\n\n /**\n * Data from DeviceModel.getActiveStreamingInfo()\n */\n setStreamingInfo(data: DeviceActiveStreamingInfo) {\n this.streamingInfo = data;\n }\n\n getSelectedOnDeviceId() {\n return this.getStreamingDeviceId();\n }\n\n getStreamingDeviceId() {\n return this.data.lockByDevice || null;\n }\n\n async startStreamingAction(deviceId: string) {\n return this.endpoint\n .start()\n .post({DeviceID: deviceId})\n .catch(async (error) => {\n let errorMessage = \"Can't start streaming\";\n\n const errorType = error?.data?.Error as string;\n if (errorType) {\n // Check error:\n // \"Failed load StreamNow settings: Failed find StreamNow broadcast: googleapi: Error 403: The user is not enabled for live-streaming., liveStreamingNotEnabled\"\n if (errorType.includes('googleapi') && errorType.includes('liveStreamingNotEnabled')) {\n errorMessage = 'Enable \"Live Streaming\" in your YouTube account.';\n }\n }\n\n Notifications.addErrorNotification(\n `Streaming start error: ${errorMessage} \"${this.getName()}\"`,\n );\n\n return Promise.reject(error);\n });\n }\n\n async stopStreamingAction(deviceId: string) {\n return this.endpoint\n .stop()\n .post({DeviceID: deviceId})\n .catch(async (error) => {\n Notifications.addErrorNotification(\n `Streaming stop error: Can't stop streaming \"${this.getName()}\"`,\n );\n\n return Promise.reject(error);\n });\n }\n\n async attachToDevice(deviceId: string) {\n return this.endpoint.attach().post({DeviceID: deviceId});\n }\n\n protected getOptionsPropName(): STREAMING_SERVICE_PROP_NAME | string {\n return '';\n }\n\n protected getSettingsPropName(): STREAMING_SERVICE_SETTINGS_PROP_NAME | string {\n return '';\n }\n\n protected processOptionsData(json: StreamingDestinationOptions): Record<string, any> {\n return {\n name: json.Name,\n };\n }\n\n protected processSettingsData(_json: StreamingDestinationOptions): Record<string, any> {\n return {};\n }\n\n protected optionsToJSON(_options: Record<string, any>): Record<string, any> {\n return {};\n }\n\n protected settingsToJSON(_settings: Record<string, any>): Record<string, any> {\n return {};\n }\n\n private updateFromJSON(json: StreamingDestinationOptions) {\n this.data = this.processData(json);\n this.options = this.processOptionsData(json);\n this.settings = this.processSettingsData(json);\n }\n\n private processData({\n CurrentlyStreaming = false,\n IsDeleted = false,\n LastModified = 0,\n Name = '',\n StreamID = '',\n Type,\n LockByDevice = '',\n }: StreamingDestinationOptions) {\n return {\n streaming: CurrentlyStreaming,\n deleted: IsDeleted,\n lastModified: LastModified,\n name: Name,\n id: StreamID,\n type: Type || '',\n lockByDevice: LockByDevice,\n };\n }\n\n private dataToJSON({\n streaming,\n deleted,\n lastModified,\n name,\n id,\n type,\n lockByDevice,\n }: Record<string, any>): StreamingDestinationOptions {\n return {\n CurrentlyStreaming: streaming,\n IsDeleted: deleted,\n LastModified: lastModified,\n Name: name,\n StreamID: id,\n Type: type,\n LockByDevice: lockByDevice,\n };\n }\n\n private getStreamingInfo() {\n return this.streamingInfo;\n }\n}\n\nexport {BaseStreamingDestinationModel};\n","/* eslint-disable @typescript-eslint/member-ordering */\nimport {BaseStreamingDestinationModel} from 'app/components/StreamingServices/StreamingDestinations/BaseStreamingDestinationModel';\nimport {STREAMING_SERVICE_PROP_NAME} from 'app/components/StreamingServices/constants';\n\nclass OAuth2StreamingDestinationModel extends BaseStreamingDestinationModel {\n protected processOptionsData(json) {\n const options = json[this.getOptionsPropName()];\n\n return {\n error: options.Error,\n errorTime: options.ErrorTime,\n externalID: options.ExternalID,\n login: options.Login,\n rToken: options.RToken,\n service: options.Service,\n token: options.Token,\n userName: options.UserName,\n };\n }\n\n protected processSettingsData(json): Record<string, any> {\n const settings = json[this.getSettingsPropName()];\n\n if (!settings) {\n return {};\n }\n\n return {\n title: settings.Title,\n description: settings.Description,\n privacy: settings.Privacy,\n publishDestination: settings.PublishDestination,\n publishDestinationID: settings.PublishDestinationID,\n };\n }\n\n protected getOptionsPropName() {\n return STREAMING_SERVICE_PROP_NAME.OAUTH2;\n }\n\n getUserNameSetting() {\n return this.getOptions().userName;\n }\n\n getUserPictureSetting() {\n // TODO: Update fake data\n return this.getSettings().userPicture || '';\n }\n\n getTitleSetting() {\n return this.getSettings().title || '';\n }\n\n getDescriptionSetting() {\n return this.getSettings().description || '';\n }\n\n getPrivacySetting() {\n return this.getSettings().privacy;\n }\n\n getDestinationSetting() {\n return this.getSettings().publishDestination;\n }\n\n getDestinationIDSetting(): string | undefined {\n return this.getSettings().publishDestinationID || undefined;\n }\n\n protected optionsToJSON({\n error,\n errorTime,\n externalID,\n login,\n rToken,\n service,\n token,\n userName,\n }) {\n return {\n Error: error,\n ErrorTime: errorTime,\n ExternalID: externalID,\n Login: login,\n RToken: rToken,\n Service: service,\n Token: token,\n UserName: userName,\n };\n }\n\n protected settingsToJSON({\n title,\n description,\n privacy,\n publishDestination,\n publishDestinationID,\n }: Record<string, any>) {\n return {\n Title: title,\n Description: description,\n Privacy: privacy,\n PublishDestination: publishDestination,\n PublishDestinationID: publishDestinationID,\n };\n }\n}\n\nexport {OAuth2StreamingDestinationModel};\n","import {OAuth2StreamingDestinationModel} from 'app/components/StreamingServices/StreamingDestinations/OAuth2StreamingDestinationModel';\nimport {\n STREAMING_SERVICE_SETTINGS_PROP_NAME,\n FACEBOOK_STREAMING_DESTINATION,\n FACEBOOK_STREAMING_PRIVACY,\n} from 'app/components/StreamingServices/constants';\n\nclass FacebookStreamingDestinationModel extends OAuth2StreamingDestinationModel {\n getDestinationSetting() {\n return this.getSettings().publishDestination || FACEBOOK_STREAMING_DESTINATION.TIMELINE;\n }\n\n getPrivacySetting() {\n return this.getSettings().privacy || FACEBOOK_STREAMING_PRIVACY.ONLY_ME;\n }\n\n isContinuous() {\n return this.getSettings().continuousStream || false;\n }\n\n isDeletingPostAfterStop() {\n return this.getSettings().deletePostAfterStreaming || false;\n }\n\n protected getSettingsPropName() {\n return STREAMING_SERVICE_SETTINGS_PROP_NAME.FACEBOOK;\n }\n\n protected processSettingsData(json) {\n const settings = json[this.getSettingsPropName()];\n\n if (!settings) {\n return {};\n }\n\n return {\n ...super.processSettingsData(json),\n continuousStream: settings.ContinuousStream,\n deletePostAfterStreaming: settings.DeletePostAfterStreaming,\n };\n }\n\n protected settingsToJSON({\n continuousStream,\n deletePostAfterStreaming,\n ...rest\n }: Record<string, any>) {\n return {\n ...super.settingsToJSON(rest),\n ContinuousStream: continuousStream,\n DeletePostAfterStreaming: deletePostAfterStreaming,\n };\n }\n}\n\nexport {FacebookStreamingDestinationModel};\n","import {parseLocationSearch} from 'app/util/OAuthProvider/utils';\n\nexport class OAuthCallback {\n protected callback;\n\n // Used in callback HTML\n protected globalCallbackName = 'loginCallback';\n protected fired = false;\n\n constructor(callback) {\n this.callback = callback;\n\n this.register();\n }\n\n public destroy() {\n this.unregister();\n if (!this.fired) {\n this.callback({loginCallbackIsNotFired: true});\n }\n }\n\n private register() {\n this.setGlobalCallback((search: string) => {\n this.fired = true;\n this.unregister();\n this.callback(parseLocationSearch(search));\n });\n }\n\n private unregister() {\n this.setGlobalCallback(undefined);\n }\n\n private setGlobalCallback(callback) {\n window[this.globalCallbackName] = callback;\n }\n}\n","type A = Record<string, string>;\n\nexport const parseLocationSearch = (search: string): A => {\n if (!search) {\n return {};\n }\n\n return search.substr(1).split('&').reduce((acc: A, current: string) => {\n const [key, value] = current.split('=');\n\n // @ts-expect-error\n acc[key] = value;\n\n return acc;\n }, {});\n};\n","import {noop} from 'app/util/noop';\nimport {OAuthCallback} from 'app/util/OAuthProvider/OAuthCallback';\nimport {Callback} from 'app/types/common';\n\nconst OAUTH_WINDOW_CLOSED_CHECKING_INTERVAL = 300;\n\nexport class ModalWindow {\n protected name: string;\n protected url: string;\n protected width: number;\n protected height: number;\n protected onOpen: Callback;\n protected onClose: Callback;\n protected oauthWindow;\n protected oauthInterval = -1;\n\n constructor(options) {\n // should not include space for IE\n this.name = options.name || 'OAuth';\n this.url = options.url;\n this.width = options.width || 600;\n this.height = options.height || 600;\n\n this.onOpen = options.onOpen || noop;\n this.onClose = options.onClose || noop;\n }\n\n public open() {\n this.onOpen();\n\n const oauthCallback = new OAuthCallback(this.onClose);\n\n this.oauthWindow = this.openWindow();\n\n this.oauthInterval = window.setInterval(() => {\n if (this.oauthWindow === null || this.oauthWindow.closed) {\n window.clearInterval(this.oauthInterval);\n oauthCallback.destroy();\n }\n }, OAUTH_WINDOW_CLOSED_CHECKING_INTERVAL);\n }\n\n private openWindow() {\n const {top, left} = this.calculateWindowPosition();\n\n const windowFeatures = 'toolbar=no, directories=no, status=no, menubar=no, scrollbars=no,' +\n `resizable=no, copyhistory=no, width=${this.width}, height=${this.height}, top=${top}, left=${left}`;\n\n return window.open(this.url, this.name, windowFeatures);\n }\n\n private calculateWindowPosition() {\n const windowLeft = window.screenLeft ? window.screenLeft : window.screenX;\n const windowTop = window.screenTop ? window.screenTop : window.screenY;\n\n const left = windowLeft + (window.innerWidth / 2) - (this.width / 2);\n const top = windowTop + (window.innerHeight / 2) - (this.height / 2);\n\n return {top, left};\n }\n}\n","import {ModalWindow} from 'app/util/OAuthProvider/ModalWindow';\nimport {OAuthProviderOptions} from 'app/util/OAuthProvider/types';\n\nclass BaseProvider {\n name;\n url;\n onOpen;\n onClose;\n\n windowWidth: null | number = null;\n windowHeight: null | number = null;\n oauthWindow: null | ModalWindow = null;\n\n constructor({\n name,\n url,\n onOpen,\n onClose,\n }: OAuthProviderOptions) {\n this.name = name;\n this.url = url;\n this.onOpen = onOpen;\n this.onClose = onClose;\n }\n\n public open() {\n this.oauthWindow = new ModalWindow({\n name: this.name,\n url: this.url,\n width: this.windowWidth,\n height: this.windowHeight,\n onOpen: this.onOpen,\n onClose: this.onClose,\n });\n\n this.oauthWindow.open();\n }\n}\n\nexport {BaseProvider};\n","import {BaseProvider} from 'app/util/OAuthProvider/BaseProvider';\nimport {OAuthProviderOptions} from 'app/util/OAuthProvider/types';\n\nclass FacebookProvider extends BaseProvider {\n constructor(options: OAuthProviderOptions) {\n super(options);\n\n this.name = 'Facebook';\n this.windowWidth = 600;\n this.windowHeight = 679;\n }\n}\n\nexport {FacebookProvider};\n","import {BaseStreamingService} from 'app/components/StreamingServices/BaseStreamingService';\nimport {FacebookStreamingDestinationModel} from 'app/components/StreamingServices/StreamingDestinations/FacebookStreamingDestinationModel';\nimport {FacebookProvider} from 'app/util/OAuthProvider/FacebookProvider';\nimport {front} from 'app/api/CirrusApi';\nimport {STREAMING_SERVICE_TYPE} from 'app/components/StreamingServices/constants';\nimport {noop} from 'app/util/noop';\nimport {StreamingDestinationOptions} from 'app/components/StreamingServices/StreamingDestinations/types';\n\nclass FacebookStreamingService extends BaseStreamingService {\n protected type = STREAMING_SERVICE_TYPE.FACEBOOK;\n protected name = 'Facebook';\n\n async createService(name: string): Promise<string> {\n // TODO: Update handlers\n return new Promise((resolve, reject) => {\n new FacebookProvider({\n url: front.connections().connect().facebook().stream(name).url(),\n onOpen: noop,\n onClose: (response) => {\n if (response.error || response.loginCallbackIsNotFired) {\n console.log('Error', response);\n reject(response.error);\n return;\n }\n\n resolve(name);\n },\n }).open();\n });\n }\n\n createStreamingDestinationModel(json: StreamingDestinationOptions) {\n return new FacebookStreamingDestinationModel(json);\n }\n\n isDisabled() {\n return false;\n }\n\n isAvailableToCreate(): boolean {\n return false;\n }\n}\n\nexport {FacebookStreamingService};\n","import {OAuth2StreamingDestinationModel} from 'app/components/StreamingServices/StreamingDestinations/OAuth2StreamingDestinationModel';\nimport {\n STREAMING_SERVICE_SETTINGS_PROP_NAME,\n YOUTUBE_STREAMING_DESTINATION,\n YOUTUBE_STREAMING_PRIVACY,\n} from 'app/components/StreamingServices/constants';\n\nclass YoutubeStreamingDestinationModel extends OAuth2StreamingDestinationModel {\n getPrivacySetting(): YOUTUBE_STREAMING_PRIVACY {\n return super.getPrivacySetting() || YOUTUBE_STREAMING_PRIVACY.PRIVATE;\n }\n\n getDestinationSetting(): YOUTUBE_STREAMING_DESTINATION {\n return super.getDestinationSetting() || YOUTUBE_STREAMING_DESTINATION.EVENTS;\n }\n\n isPreviewAfterPlaying(): boolean {\n return this.getSettings().previewBeforeStart;\n }\n\n protected processSettingsData(json) {\n const settings = json[this.getSettingsPropName()];\n\n if (!settings) {\n return {};\n }\n\n const result = super.processSettingsData(json);\n\n // Filter unsupported \"StreamNow\" value\n if (result.publishDestination === YOUTUBE_STREAMING_DESTINATION.STREAM_NOW) {\n result.publishDestination = YOUTUBE_STREAMING_DESTINATION.EVENTS;\n }\n\n result.previewBeforeStart = settings.YouTubePreview === true;\n\n return result;\n }\n\n protected getSettingsPropName() {\n return STREAMING_SERVICE_SETTINGS_PROP_NAME.YOUTUBE;\n }\n\n protected settingsToJSON({\n previewBeforeStart,\n ...rest\n }) {\n return {\n ...super.settingsToJSON(rest),\n YouTubePreview: previewBeforeStart,\n };\n }\n}\n\nexport {YoutubeStreamingDestinationModel};\n","import {BaseProvider} from 'app/util/OAuthProvider/BaseProvider';\nimport {OAuthProviderOptions} from 'app/util/OAuthProvider/types';\n\nclass YoutubeProvider extends BaseProvider {\n constructor(options: OAuthProviderOptions) {\n super(options);\n\n this.name = 'Youtube';\n this.windowWidth = 600;\n this.windowHeight = 690;\n }\n}\n\nexport {YoutubeProvider};\n","import {BaseStreamingService} from 'app/components/StreamingServices/BaseStreamingService';\nimport {YoutubeStreamingDestinationModel} from 'app/components/StreamingServices/StreamingDestinations/YoutubeStreamingDestinationModel';\nimport {YoutubeProvider} from 'app/util/OAuthProvider/YoutubeProvider';\nimport {front} from 'app/api/CirrusApi';\nimport {STREAMING_SERVICE_TYPE} from 'app/components/StreamingServices/constants';\nimport {noop} from 'app/util/noop';\nimport {StreamingDestinationOptions} from 'app/components/StreamingServices/StreamingDestinations/types';\n\nclass YoutubeStreamingService extends BaseStreamingService {\n protected type = STREAMING_SERVICE_TYPE.YOUTUBE;\n protected name = 'YouTube';\n\n async createService(name): Promise<string> {\n // TODO: Update handlers\n return new Promise((resolve, reject) => {\n new YoutubeProvider({\n url: front.connections().connect().google().stream(name).url(),\n onOpen: noop,\n onClose: (response) => {\n if (response.error || response.loginCallbackIsNotFired) {\n console.log('Error', response);\n reject(response.error);\n return;\n }\n\n resolve(name);\n },\n }).open();\n });\n }\n\n createStreamingDestinationModel(json: StreamingDestinationOptions) {\n return new YoutubeStreamingDestinationModel(json);\n }\n\n isDisabled() {\n return false;\n }\n\n isAvailableToCreate(): boolean {\n return false;\n }\n}\n\nexport {YoutubeStreamingService};\n","import {BaseProvider} from 'app/util/OAuthProvider/BaseProvider';\nimport {OAuthProviderOptions} from 'app/util/OAuthProvider/types';\n\nclass TwitchProvider extends BaseProvider {\n constructor(options: OAuthProviderOptions) {\n super(options);\n\n this.name = 'Twitch';\n this.windowWidth = 520;\n this.windowHeight = 750;\n }\n}\n\nexport {TwitchProvider};\n","import {BaseStreamingService} from 'app/components/StreamingServices/BaseStreamingService';\nimport {OAuth2StreamingDestinationModel} from 'app/components/StreamingServices/StreamingDestinations/OAuth2StreamingDestinationModel';\nimport {TwitchProvider} from 'app/util/OAuthProvider/TwitchProvider';\nimport {front} from 'app/api/CirrusApi';\nimport {STREAMING_SERVICE_TYPE} from 'app/components/StreamingServices/constants';\nimport {noop} from 'app/util/noop';\nimport {StreamingDestinationOptions} from 'app/components/StreamingServices/StreamingDestinations/types';\n\nclass TwitchStreamingService extends BaseStreamingService {\n protected type = STREAMING_SERVICE_TYPE.TWITCH;\n protected name = 'Twitch';\n\n async createService(name: string): Promise<string> {\n // TODO: Update handlers\n return new Promise((resolve, reject) => {\n new TwitchProvider({\n url: front.connections().connect().twitch().stream(name).url(),\n onOpen: noop,\n onClose: (response) => {\n if (response.error || response.loginCallbackIsNotFired) {\n console.log('Error', response);\n reject(response.error);\n return;\n }\n\n resolve(name);\n },\n }).open();\n });\n }\n\n createStreamingDestinationModel(json: StreamingDestinationOptions) {\n return new OAuth2StreamingDestinationModel(json);\n }\n\n isDisabled() {\n return true;\n }\n\n isAvailableToCreate(): boolean {\n return false;\n }\n}\n\nexport {TwitchStreamingService};\n","import React, {Component} from 'react';\nimport classNames from 'classnames';\nimport {FormControl} from 'app/components/sharedReactComponents/FormControl';\nimport {Callback, ClassName} from 'app/types/common';\nimport {FORM_CONTROL_TYPE} from 'app/components/sharedReactComponents/FormControl/constants';\n\nfunction isValid(formData, requiredFields) {\n const hasInvalidItem = requiredFields.some(name => {\n const item = formData[name];\n return typeof item === 'string' && item.trim() === '';\n });\n\n return hasInvalidItem === false;\n}\n\ninterface FormData {\n name: string;\n url: string;\n key: string;\n valid: boolean;\n}\ninterface Props extends ClassName {\n requiredFields: any[];\n onChange: Callback;\n formData: FormData;\n}\n\nexport class Form extends Component<Props> {\n handleChange = ({target: {name, value}}) => {\n const {\n formData,\n requiredFields,\n onChange,\n } = this.props;\n\n const newFormData = {\n ...formData,\n [name]: value,\n };\n\n onChange({\n ...newFormData,\n valid: isValid(newFormData, requiredFields),\n });\n };\n\n render() {\n const {\n className,\n formData,\n } = this.props;\n\n return (\n <div className={classNames('create-rtmp-streaming-destination-prompt__form', className)}>\n <FormControl\n className=\"create-rtmp-streaming-destination-prompt__input\"\n name=\"name\"\n value={formData.name}\n label=\"Name\"\n placeholder=\"RTMP destination 1\"\n required={true}\n autoFocus={true}\n onChange={this.handleChange}\n />\n\n <FormControl\n className=\"create-rtmp-streaming-destination-prompt__input\"\n name=\"url\"\n value={formData.url}\n label=\"Server url\"\n type={FORM_CONTROL_TYPE.URL}\n pattern=\"rtmp.?://.*\"\n required={true}\n onChange={this.handleChange}\n />\n\n <FormControl\n className=\"create-rtmp-streaming-destination-prompt__input\"\n name=\"key\"\n value={formData.key}\n label=\"Streaming key\"\n onChange={this.handleChange}\n />\n </div>\n );\n }\n}\n","function getApiErrorMessage(error?: any): string {\n let message;\n\n if (error?.data) {\n const {data} = error;\n message = data.message || data.Error || data.error;\n }\n\n return message || '';\n}\n\nexport {\n getApiErrorMessage,\n};\n","import React, {useCallback, useState} from 'react';\nimport {\n Modal,\n ModalBody,\n ModalCancelButton,\n ModalContainer,\n ModalFooter,\n ModalTitle,\n} from 'app/components/sharedReactComponents/Modal/Modal';\nimport {ProgressButton} from 'app/components/sharedReactComponents/ProgressButton';\nimport {\n SIZE,\n THEME,\n VARIANT,\n} from 'app/constants';\nimport {Form} from 'app/components/libs/dialogs/CreateRTMPStreamingDestinationPrompt/Form';\nimport {front} from 'app/api/CirrusApi';\nimport {Notifications} from 'app/components/Notifications';\nimport {getApiErrorMessage} from 'app/util/getApiErrorMessage';\n\n/**\n * @type {string[]}\n */\nconst RTMP_REQUIRED_FIELDS = [\n 'name',\n 'url',\n];\n\ninterface Props {\n onDone: (name: string) => void;\n}\n\nconst Content: React.FC<Props> = ({onDone}) => {\n const [formData, setFormData] = useState({\n name: '',\n url: '',\n key: '',\n valid: false,\n });\n\n const handleChange = useCallback(formData => {\n setFormData(formData);\n }, []);\n\n const handleClickSubmit = useCallback(() => {\n const {\n name,\n url,\n key,\n } = formData;\n\n return front.streams().post({\n Name: name,\n RTMP: {\n DestName: name,\n StreamingKey: key,\n URL: url,\n }\n })\n .then(() => {\n onDone(name);\n Modal.hide();\n })\n .catch(async error => {\n const errorText = getApiErrorMessage(error);\n Notifications.addErrorNotification(`Create streaming destination request error${errorText ? `: \"${errorText}\"` : ''}`);\n\n return Promise.reject();\n });\n }, [formData, onDone]);\n\n return (\n <ModalContainer>\n <ModalTitle>\n New RTMP/RTMPS streaming destination\n </ModalTitle>\n\n <ModalBody>\n <Form\n formData={formData}\n requiredFields={RTMP_REQUIRED_FIELDS}\n onChange={handleChange}\n />\n </ModalBody>\n\n <ModalFooter>\n <ProgressButton\n theme={THEME.PRIMARY}\n variant={VARIANT.SOLID}\n disabled={formData.valid === false}\n onClick={handleClickSubmit}\n dataId=\"modal_confirm_button\"\n >\n Save\n </ProgressButton>\n\n <ModalCancelButton/>\n </ModalFooter>\n </ModalContainer>\n );\n};\n\nexport const CreateRTMPStreamingDestinationPrompt = {\n show({\n onDone,\n }: Props) {\n Modal.show({\n className: 'create-rtmp-streaming-destination-prompt',\n fullWidth: true,\n maxWidth: SIZE.L,\n children: (\n <Content\n onDone={onDone}\n />\n )\n });\n }\n};\n","import {BaseStreamingDestinationModel} from 'app/components/StreamingServices/StreamingDestinations/BaseStreamingDestinationModel';\nimport {STREAMING_SERVICE_PROP_NAME} from 'app/components/StreamingServices/constants';\nimport {StreamingDestinationRTMPSettings} from 'app/components/StreamingServices/StreamingDestinations/types';\n\nclass RTMPStreamingDestinationModel extends BaseStreamingDestinationModel {\n getNameSetting() {\n return this.getOptions().name;\n }\n\n getKeySetting() {\n return this.getOptions().key;\n }\n\n getUrlSetting() {\n return this.getOptions().url;\n }\n\n protected processOptionsData(json) {\n const options = json[this.getOptionsPropName()];\n\n return {\n name: options.DestName,\n key: options.StreamingKey,\n url: options.URL,\n };\n }\n\n protected getOptionsPropName() {\n return STREAMING_SERVICE_PROP_NAME.RTMP;\n }\n\n protected optionsToJSON({\n name,\n key,\n url,\n }): StreamingDestinationRTMPSettings {\n return {\n DestName: name,\n StreamingKey: key,\n URL: url,\n };\n }\n}\n\nexport {RTMPStreamingDestinationModel};\n","import {BaseStreamingService} from 'app/components/StreamingServices/BaseStreamingService';\nimport {CreateRTMPStreamingDestinationPrompt} from 'app/components/libs/dialogs/CreateRTMPStreamingDestinationPrompt';\nimport {RTMPStreamingDestinationModel} from 'app/components/StreamingServices/StreamingDestinations/RTMPStreamingDestinationModel';\nimport {STREAMING_SERVICE_TYPE} from 'app/components/StreamingServices/constants';\nimport {StreamingDestinationOptions} from 'app/components/StreamingServices/StreamingDestinations/types';\n\nclass RTMPStreamingService extends BaseStreamingService {\n protected type = STREAMING_SERVICE_TYPE.RTMP;\n protected name = 'RTMP';\n\n async createService(): Promise<string> {\n return new Promise((resolve) => {\n CreateRTMPStreamingDestinationPrompt.show({\n onDone: resolve,\n // onClose: reject,\n });\n });\n }\n\n createStreamingDestinationModel(json: StreamingDestinationOptions) {\n return new RTMPStreamingDestinationModel(json);\n }\n\n isAvailableToCreate() {\n return true;\n }\n}\n\nexport {\n RTMPStreamingService,\n};\n","import {FacebookStreamingService} from 'app/components/StreamingServices/FacebookStreamingService';\nimport {YoutubeStreamingService} from 'app/components/StreamingServices/YoutubeStreamingService';\nimport {TwitchStreamingService} from 'app/components/StreamingServices/TwitchStreamingService';\nimport {RTMPStreamingService} from 'app/components/StreamingServices/RTMPStreamingService';\nimport {AnyStreamingDestinationModelType} from 'app/components/StreamingServices/types';\nimport {STREAMING_SERVICE_TYPE} from 'app/components/StreamingServices/constants';\nimport {StreamingDestinationOptions} from 'app/components/StreamingServices/StreamingDestinations/types';\n\ntype StreamingServiceType =\n | FacebookStreamingService\n | YoutubeStreamingService\n | TwitchStreamingService\n | RTMPStreamingService;\n\nclass StreamingServicesRepository {\n private readonly registeredServices = new Map<string, StreamingServiceType>();\n\n constructor() {\n this.registerService(new FacebookStreamingService());\n this.registerService(new YoutubeStreamingService());\n this.registerService(new TwitchStreamingService());\n this.registerService(new RTMPStreamingService());\n }\n\n registerService(service: StreamingServiceType) {\n this.registeredServices.set(service.getType() ?? '', service);\n }\n\n getAvailableToCreateServices(): StreamingServiceType[] {\n return Array.from(this.registeredServices.values()).filter(service => service.isAvailableToCreate());\n }\n\n isAvailableToCreateService(serviceType: STREAMING_SERVICE_TYPE): boolean {\n const service = this.getServiceByType(serviceType);\n\n return Boolean(service?.isAvailableToCreate());\n }\n\n getServiceByType(serviceType: STREAMING_SERVICE_TYPE) {\n return this.registeredServices.get(serviceType);\n }\n\n createStreamingDestinationModel(json: StreamingDestinationOptions): AnyStreamingDestinationModelType | undefined {\n const serviceType = json.Type;\n const service = this.getServiceByType(serviceType);\n\n if (service) {\n return service.createStreamingDestinationModel(json);\n }\n }\n}\n\nconst streamingServicesRepository = new StreamingServicesRepository();\n\nexport {\n streamingServicesRepository,\n};\n","import {useCallback, useEffect, useRef} from 'react';\nimport {ModelService} from 'app/services/deviceModel/DeviceModelService';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {PearlMasterDeviceModel} from 'app/components/DeviceDetails/Models/PearlMasterDeviceModel';\n\nconst emptyMap = new Map<string, AnyDeviceModelType>();\n\nexport function useGetDeviceById(devices: AnyDeviceModelType | AnyDeviceModelType[]) {\n const devicesMap = useRef(emptyMap);\n\n useEffect(() => {\n devicesMap.current = new Map<string, AnyDeviceModelType>();\n\n function process(device: AnyDeviceModelType) {\n devicesMap.current.set(device.getId(), device);\n\n if (ModelService.isMultiChannel(device.getModelName())) {\n (device as PearlMasterDeviceModel).getChanelModels().forEach((channelDevice) => {\n devicesMap.current.set(channelDevice.getId(), channelDevice);\n });\n }\n }\n\n if (Array.isArray(devices)) {\n devices.forEach(process);\n } else if (devices) {\n process(devices);\n }\n }, [devices]);\n\n const getDeviceById = useCallback((deviceId: string) => {\n return devicesMap.current.get(deviceId);\n }, []);\n\n return getDeviceById;\n}\n","import React from 'react';\nimport {Typography} from '@mui/material';\nimport {DataId, StyleSx, Sx} from 'app/types/common';\nimport {Edge} from 'app/domain/edge';\nimport {capitalize} from 'app/components/helpers/commonHelpers';\nimport {packSx} from 'app/util/packSx/packSx';\n\ntype Props = Sx &\n DataId & {\n status: Edge.DeviceStatus;\n };\n\nexport function EdgeDeviceStatus({dataId, sx, status}: Props) {\n return (\n <Typography data-id={dataId} sx={packSx(getStyles(status), sx)} textAlign=\"center\">\n {getNormalizedStatus(status)}\n </Typography>\n );\n}\n\nfunction getStyles(status: Edge.DeviceStatus): StyleSx {\n switch (status) {\n case 'online':\n return {color: 'secondary.main', fontWeight: 600};\n\n case 'rebooting':\n case 'upgrading': {\n return {color: 'primary.main', fontWeight: 600};\n }\n\n default:\n return {color: 'text.disabled'};\n }\n}\n\nfunction getNormalizedStatus(status: Edge.DeviceStatus): string {\n if (status === 'holding_legacy') {\n return 'Incompatible'\n }\n\n return capitalize(status)\n}\n","import React from 'react';\nimport {Sx} from 'app/types/common';\nimport {Stack} from '@mui/material';\nimport ContactlessIcon from '@mui/icons-material/Contactless';\nimport ModeStandbyIcon from '@mui/icons-material/ModeStandby';\nimport VoiceChatIcon from '@mui/icons-material/VoiceChat';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\nimport {Edge} from 'app/domain/edge';\nimport {formatStartedAtDate} from 'app/util/time';\nimport {EdgeDeviceStatus} from 'app/components/features/edge/EdgeDevice/StatusIndicator/EdgeDeviceStatus/EdgeDeviceStatus';\n\ntype Props = Sx & {\n status: Edge.DeviceStatus;\n streaming: boolean;\n recording: boolean;\n transcribing: boolean;\n stateTime?: number;\n};\n\nexport function StatusIndicator({\n sx,\n status,\n recording,\n streaming,\n transcribing,\n stateTime,\n}: Props) {\n const showIndicators = streaming || recording || transcribing;\n\n return (\n <Stack sx={sx} direction=\"row\" alignItems=\"center\" justifyContent=\"center\" gap={0.5}>\n {showIndicators ? (\n <>\n {streaming && (\n <Tooltip content=\"Streaming\">\n <ContactlessIcon\n data-id=\"device_status_icon_streaming\"\n fontSize=\"large\"\n color=\"primary\"\n />\n </Tooltip>\n )}\n {recording && (\n <Tooltip content=\"Recording\">\n <ModeStandbyIcon\n data-id=\"device_status_icon_recording\"\n fontSize=\"large\"\n color=\"error\"\n />\n </Tooltip>\n )}\n {transcribing && (\n <Tooltip content=\"Transcribing\">\n <VoiceChatIcon\n data-id=\"device_status_icon_transcribing\"\n fontSize=\"large\"\n color=\"secondary\"\n />\n </Tooltip>\n )}\n </>\n ) : (\n <Tooltip content={getDeviceStatusTooltip(status, stateTime)}>\n <span>\n <EdgeDeviceStatus dataId=\"device-status\" status={status} />\n </span>\n </Tooltip>\n )}\n </Stack>\n );\n}\n\nfunction getDeviceStatusTooltip(status: Edge.DeviceStatus, stateTime?: number): string {\n switch (status) {\n case 'online':\n return '';\n case 'holding_legacy':\n return 'Incompatible firmware. Update your device firmware for Epiphan Edge compatibility.';\n default:\n return stateTime ? `Last time online: ${formatStartedAtDate(stateTime)}` : '';\n }\n}\n","import {gaugeClasses} from '@mui/x-charts';\n\nexport type GaugeVariant = 'ok' | 'warning' | 'error';\n\nexport function getGaugeSx(variant: GaugeVariant) {\n return {\n [`& .${gaugeClasses.valueArc}`]: {\n fill: ({palette}) => {\n if (variant === 'error') return palette.error.main;\n\n if (variant === 'warning') return palette.warning.main;\n\n return palette.primary.main;\n },\n },\n };\n}\n","import React, {useEffect, useRef, useState} from 'react';\nimport dayjs from 'dayjs';\nimport {Button, Popover, Stack, Tooltip, Typography} from '@mui/material';\nimport SpeedIcon from '@mui/icons-material/Speed';\nimport ThermostatIcon from '@mui/icons-material/Thermostat';\nimport {Gauge} from '@mui/x-charts';\nimport {StyleSx, Sx} from 'app/types/common';\nimport {isNil} from 'app/util/isNil';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {Edge} from 'app/domain/edge';\nimport {formatUptime} from 'app/util/time';\nimport {getGaugeSx} from 'app/components/features/edge/EdgeDevice/indicators/indicators.types';\n\nconst rootSx: StyleSx = {py: 0.5, px: 1};\nconst paperSx: StyleSx = {p: 1};\n\ntype Props = Sx & {system: Edge.System};\n\nexport function DevicePerformance({sx, system}: Props) {\n const [menu, setMenu] = useState<HTMLElement | null>(null);\n const [uptime, setUptime] = useState(() => formatUptime(system.uptime));\n\n const {load, temperature} = system;\n\n const raf = useRef<number>(0);\n\n useEffect(() => {\n let lastCallTimestamp: number | undefined;\n\n const step = (t: number) => {\n if (isNil(lastCallTimestamp) || t - lastCallTimestamp > 1000) {\n lastCallTimestamp = t;\n\n setUptime(formatUptime(system.uptime));\n }\n\n raf.current = requestAnimationFrame(step);\n };\n\n raf.current = requestAnimationFrame(step);\n\n return () => {\n cancelAnimationFrame(raf.current);\n raf.current = 0;\n };\n }, [system.uptime]);\n\n return (\n <>\n <Tooltip title=\"Device performance\">\n <Button\n sx={packSx(rootSx, sx)}\n data-id=\"performance-btn\"\n variant=\"outlined\"\n color=\"info\"\n onClick={(e) => setMenu(e.currentTarget)}\n >\n <Typography data-id=\"uptime-text\">Uptime: {uptime}</Typography>\n </Button>\n </Tooltip>\n\n <Popover\n anchorEl={menu}\n open={!isNil(menu)}\n slotProps={{paper: {sx: paperSx}}}\n anchorOrigin={{vertical: 'bottom', horizontal: 'left'}}\n transformOrigin={{vertical: 'top', horizontal: 'left'}}\n onClose={() => setMenu(null)}\n >\n <Typography mb={0.25} fontWeight={600}>\n CPU performance\n </Typography>\n\n <Stack mb={1} direction=\"row\" justifyContent=\"center\" gap={1}>\n {!isNil(load) && (\n <Stack alignItems=\"center\">\n <Gauge\n data-id=\"performance-gauge\"\n sx={getGaugeStyles(load)}\n width={80}\n height={80}\n innerRadius=\"90%\"\n outerRadius=\"125%\"\n value={load}\n text={({value}) => `${(value ?? 0).toFixed(0)}%`}\n />\n\n <Stack direction=\"row\" alignItems=\"center\" gap={0.25}>\n <SpeedIcon color=\"info\" />\n <Typography>System load</Typography>\n </Stack>\n </Stack>\n )}\n\n {!isNil(temperature) && (\n <Stack alignItems=\"center\">\n <Gauge\n data-id=\"temperature-gauge\"\n sx={getGaugeStyles(temperature)}\n width={80}\n height={80}\n innerRadius=\"90%\"\n outerRadius=\"125%\"\n value={temperature}\n text={({value}) => `${(value ?? 0).toFixed(0)}°C`}\n />\n\n <Stack direction=\"row\" alignItems=\"center\" gap={0.25}>\n <ThermostatIcon color=\"info\" />\n <Typography>Temperature</Typography>\n </Stack>\n </Stack>\n )}\n </Stack>\n\n <Typography mb={0.25} fontWeight={600}>\n Uptime\n </Typography>\n\n <Typography mb={0.25}>\n Online since{' '}\n <span data-id=\"online-since-text\"> {dayjs.unix(system.uptime).format('lll')}</span>\n </Typography>\n </Popover>\n </>\n );\n}\n\nfunction getGaugeStyles(value: number): StyleSx {\n if (value > 95) return getGaugeSx('error');\n\n if (value > 80) return getGaugeSx('warning');\n\n return getGaugeSx('ok');\n}\n","import {useQuery} from '@tanstack/react-query';\nimport {DeviceApiService} from 'app/services/api/device/DeviceApiService';\nimport {EdgeMapper} from 'app/util/mappers/edge/EdgeMapper';\n\ntype Args = {\n deviceId: string;\n enabled: boolean;\n staleTime?: number;\n refetchInterval?: number;\n};\n\nexport function useSystemInfo({deviceId, enabled, refetchInterval, staleTime}: Args) {\n return useQuery({\n queryKey: ['unit', 'sys', deviceId],\n queryFn: async () => {\n const response = await DeviceApiService.getSystemStatus(deviceId);\n\n if (response) {\n return EdgeMapper.mapSystem(response);\n }\n\n return null;\n },\n refetchInterval,\n staleTime,\n enabled,\n });\n}\n","import React from 'react';\nimport {Skeleton} from '@mui/material';\nimport {Sx} from 'app/types/common';\nimport {DevicePerformance} from 'app/components/features/edge/EdgeDevice/PerformanceIndicator/DevicePerformance/DevicePerformance';\nimport {useSystemInfo} from 'app/components/DeviceDetails/DeviceInfoTab/SystemInformation/useSystemInfo';\n\ntype Props = Sx & {\n deviceId: string;\n enabled: boolean;\n};\n\nexport function PerformanceIndicator({sx, deviceId, enabled}: Props) {\n const query = useSystemInfo({\n deviceId,\n enabled,\n staleTime: 30 * 1000,\n refetchInterval: 60 * 1000,\n });\n\n if (enabled && query.isLoading) {\n return <Skeleton sx={sx} variant=\"rounded\" height={31} width={132} />;\n }\n\n if (query.isSuccess && query.data) {\n return <DevicePerformance sx={sx} system={query.data} />;\n }\n\n return null;\n}\n","import {Schedule} from 'app/domain/schedule';\n\nexport function isSkipped(status: Schedule.EventStatus): boolean {\n return status === 'skipped';\n}\n\nexport function isUploading(status: Schedule.EventStatus): boolean {\n return status === 'uploading';\n}\n\nexport function isFinished(status: Schedule.EventStatus): boolean {\n return status === 'finished';\n}\n\nexport function isCompleted(status: Schedule.EventStatus) {\n return status === 'canceled' || isSkipped(status) || isUploading(status) || isFinished(status);\n}\n\nexport function isRunning(status: Schedule.EventStatus) {\n return status === 'running';\n}\n\nexport function isPaused(status: Schedule.EventStatus) {\n return status === 'paused';\n}\n\nexport function isWaitingConfirmation(status: Schedule.EventStatus) {\n return status === 'awaiting_confirmation';\n}\n\nexport function isRunningOrPaused(status: Schedule.EventStatus) {\n return isRunning(status) || isPaused(status);\n}\n\nexport function isOngoing(status: Schedule.EventStatus) {\n return isRunningOrPaused(status);\n}\n\nexport function isScheduled(status: Schedule.EventStatus) {\n return status === 'scheduled' || isWaitingConfirmation(status);\n}\n","import React from 'react';\nimport {Typography} from '@mui/material';\nimport {Sx} from 'app/types/common';\nimport {OverflowTooltip} from 'app/components/sharedReactComponents/OverflowTooltip/OverflowTooltip';\n\ninterface Props extends Sx {\n text: string;\n rows?: number;\n dataId?: string;\n}\n\nexport function EventTitle({sx, text, rows = 1, dataId}: Props) {\n return (\n <Typography sx={sx} component=\"span\">\n <OverflowTooltip rowsNumber={rows} dataId={dataId}>\n {text}\n </OverflowTooltip>\n </Typography>\n );\n}\n","import dayjs from 'dayjs';\nimport {TimeStampSeconds} from 'app/types/common';\nimport {Schedule} from 'app/domain/schedule';\n\nexport function getOverMessage(\n variant: Schedule.EventVariant,\n start: number,\n scheduledLabel = 'Scheduled for',\n): string {\n if (variant === 'ongoing') {\n return '00:00:00';\n }\n\n if (variant === 'scheduled') {\n return `${scheduledLabel} ${dayjs.unix(start).format('LT MMM D')}`;\n }\n\n return '';\n}\n\nexport function isSoon(timestamp: TimeStampSeconds): boolean {\n const minutes = dayjs.unix(timestamp).diff(dayjs(), 'minutes');\n return minutes > 0 && minutes < 60;\n}\n","import {TimeStampSeconds} from 'app/types/common';\nimport {isPassedTimestamp} from 'app/util/time';\n\nexport const calcTimeToTimestamp = (\n timestamp: TimeStampSeconds,\n): [value: number, isOver: boolean] => {\n if (isPassedTimestamp(timestamp)) {\n return [Number.MIN_VALUE, true];\n }\n\n return [timestamp, false];\n};\n\nexport const calcTime = (\n timestamp: TimeStampSeconds\n): [value: number, isOver: boolean] => {\n return [timestamp, false];\n};\n","import React, {ReactNode, useCallback, useEffect, useRef, useState} from 'react';\nimport classNames from 'classnames';\nimport {Callback, ClassName, DataId, Sx, TimeStampSeconds} from 'app/types/common';\nimport {isNil} from 'app/util/isNil';\nimport {useMounted} from 'app/hooks/useIsMounted';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\nimport {calcTimeToTimestamp} from 'app/components/sharedReactComponents/Countdown/utils';\nimport {getCountdownToTimestamp} from 'app/util/time';\nimport {Box, Stack, Typography} from '@mui/material';\n\ninterface Props extends ClassName, DataId, Sx {\n timestamp: TimeStampSeconds;\n label?: ReactNode;\n message?: ReactNode;\n tooltip?: ReactNode;\n calculate?: Fn<[value: number, isOver: boolean], [t: TimeStampSeconds]>;\n format?: Fn<string, [t: TimeStampSeconds]>;\n onTimeIsOut?: Callback;\n}\n\nconst UPDATE_EVERY_MS = 1000;\n\nexport function Countdown({\n className,\n dataId,\n timestamp,\n label = '',\n message = '',\n tooltip = '',\n format = getCountdownToTimestamp,\n calculate = calcTimeToTimestamp,\n onTimeIsOut,\n ...elementProps\n}: Props) {\n const requestId = useRef<number>(0);\n const mounted = useMounted();\n\n const [isExpired, setIsExpired] = useState(false);\n const [value, setValue] = useState('');\n\n const stop = useCallback(() => {\n cancelAnimationFrame(requestId.current);\n requestId.current = 0;\n }, []);\n\n const start = useCallback(() => {\n let lastCallTimestamp: number | undefined;\n\n const step = (rafTimestamp: number) => {\n if (isNil(lastCallTimestamp) || rafTimestamp - lastCallTimestamp > UPDATE_EVERY_MS) {\n lastCallTimestamp = rafTimestamp;\n if (mounted()) {\n const [time, isOver] = calculate(timestamp);\n setIsExpired(isOver);\n\n if (isOver) {\n stop();\n setValue('');\n onTimeIsOut?.();\n return;\n }\n\n setValue(format(time));\n }\n }\n\n requestId.current = requestAnimationFrame(step);\n };\n\n requestId.current = requestAnimationFrame(step);\n }, [timestamp, mounted, stop, calculate, format, onTimeIsOut]);\n\n useEffect(() => {\n start();\n return () => {\n stop();\n };\n }, [stop, start]);\n\n return (\n <Box className={classNames('countdown', className)} data-id={dataId} {...elementProps}>\n {isExpired ? (\n message\n ) : (\n <Tooltip content={tooltip}>\n <Stack\n display=\"inline-flex\"\n direction=\"row\"\n alignItems=\"center\"\n className=\"countdown__content\"\n gap={0.5}\n >\n {label}\n <Typography color=\"inherit\">{value}</Typography>\n </Stack>\n </Tooltip>\n )}\n </Box>\n );\n}\n","import React from 'react';\nimport {Typography} from '@mui/material';\nimport {DataId, Sx} from 'app/types/common';\nimport {isSoon} from 'app/components/sharedReactComponents/Events/shared/EventCountdown/utils';\nimport {getTimeToDate} from 'app/util/time';\nimport {Countdown} from 'app/components/sharedReactComponents/Countdown';\nimport {Schedule} from 'app/domain/schedule';\n\ninterface Props extends Sx, DataId {\n variant: Schedule.EventVariant;\n start: number;\n end: number;\n label?: React.ReactNode;\n overMessage?: string;\n}\n\nexport function EventCountdown({sx, dataId, start, end, variant, label = '', overMessage}: Props) {\n const getTimestamp = () => {\n if (variant === 'ongoing') return end;\n\n if (variant === 'scheduled') return start;\n };\n\n const formatter = variant === 'scheduled' && !isSoon(start) ? getScheduleTime : undefined;\n\n const timestamp = getTimestamp();\n\n const message = <Typography color=\"error.main\">{overMessage}</Typography>;\n\n return timestamp ? (\n <Countdown\n sx={sx}\n data-id={dataId}\n label={label}\n timestamp={timestamp}\n message={message}\n format={formatter}\n />\n ) : null;\n}\n\nfunction getScheduleTime(timestamp: TimeStampSeconds): string {\n return getTimeToDate(timestamp, {trim: 'both'});\n}\n","import {Router} from 'app/router/Router';\n\nconst routes = {\n jarvis: {\n url: 'jarvis',\n title: '',\n },\n\n teams: {\n url: 'teams',\n title: 'Teams',\n },\n teamDetails: {\n url: 'teams/:teamId/details',\n title: 'Team Details',\n },\n\n users: {\n url: 'users',\n title: 'Users',\n },\n userDetails: {\n url: 'users/:userId/details',\n title: 'User Details',\n },\n\n devices: {\n url: 'devices',\n title: 'Paired Devices',\n },\n deviceDetails: {\n url: 'devices/:deviceId/details',\n title: 'Device Details',\n },\n\n devicesBySN: {\n url: 'devices_by_sn',\n title: 'Devices by s/n',\n },\n\n vtun: {\n url: 'vtun',\n title: 'VTUN',\n },\n\n presets: {\n url: 'presets',\n title: 'Presets',\n },\n\n livescryptSessions: {\n url: 'livescrypt_sessions',\n title: 'LiveScrypt sessions',\n },\n\n streamDestinations: {\n url: 'stream_destinations',\n title: 'Stream Destinations',\n },\n\n stats: {\n url: 'stats',\n title: 'Stats',\n },\n\n firmware: {\n url: 'firmware',\n title: 'Firmware',\n },\n\n loginSessions: {\n url: 'login_sessions',\n title: 'Login Sessions',\n },\n\n projects: {\n url: 'projects',\n title: 'Projects',\n },\n\n instances: {\n url: 'instances',\n title: 'EC2 instances',\n },\n\n meetings: {\n url: 'meetings',\n title: 'Meetings',\n },\n\n tenants: {\n url: 'tenants',\n title: 'Tenants',\n },\n\n cmsDevices: {\n url: 'cms_devices',\n title: 'CMS Devices'\n },\n \n fileManagement: {\n url: 'file_management',\n title: 'File Management'\n }\n} as const;\n\nexport type AdminRoutes = keyof typeof routes;\n\nconst router = new Router<AdminRoutes>({\n routes,\n defaultRoute: {\n name: 'jarvis',\n params: {},\n },\n});\n\nexport {\n router,\n};\n","import React from 'react';\nimport TodayIcon from '@mui/icons-material/Today';\nimport {Sx} from 'app/types/common';\nimport {EventCategory} from 'app/components/sharedReactComponents/Events/types';\n\ninterface Props extends Sx {\n type?: EventCategory;\n}\n\nexport function EventIcon({sx, type}: Props) {\n const color = getColor(type);\n return <TodayIcon sx={sx} color={color} />;\n}\n\nfunction getColor(category?: EventCategory) {\n if (category === 'ongoing') {\n return 'error';\n }\n\n if (category === 'scheduled') {\n return 'primary';\n }\n\n return 'info';\n}\n","import React from 'react';\nimport {Sx} from 'app/types/common';\nimport {Chip} from '@mui/material';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {grey} from '@mui/material/colors';\n\ninterface Props extends Sx {}\n\nexport function PausedBadge({sx}: Props) {\n return (\n <Chip\n sx={packSx({color: 'white', height: 'auto', bgcolor: grey[900]}, sx)}\n label=\"Paused\"\n variant=\"filled\"\n size=\"small\"\n />\n );\n}\n","import {Schedule} from 'app/domain/schedule';\n\ntype Permissions = {\n start: boolean;\n stop: boolean;\n pause: boolean;\n extend: boolean;\n};\n\nexport const defaultPermissions: Permissions = {\n start: false,\n stop: false,\n pause: false,\n extend: false,\n};\n\nconst panopto: Permissions = {\n start: true,\n stop: true,\n pause: true,\n extend: true,\n};\n\nconst chrono: Permissions = {\n start: true,\n stop: true,\n pause: false,\n extend: true,\n};\n\nconst kaltura: Permissions = {\n start: true,\n stop: true,\n pause: false,\n extend: true,\n};\n\nconst yuja: Permissions = {\n start: true,\n stop: true,\n pause: false,\n extend: true,\n};\n\nconst opencast: Permissions = {\n start: true,\n stop: true,\n pause: true,\n extend: true,\n};\n\nexport const permissions = new Map<Schedule.Cms, Permissions>([\n ['kaltura', kaltura],\n ['panopto', panopto],\n ['yuja', yuja],\n ['chrono', chrono],\n ['opencast', opencast],\n]);\n","import dayjs, {Dayjs} from 'dayjs';\nimport {router} from 'app/router/main';\nimport {Schedule} from 'app/domain/schedule';\nimport {\n ScheduleFilterSwitch,\n ScheduleView,\n} from 'app/components/sharedReactComponents/Events/types';\nimport {capitalize} from 'app/components/helpers/commonHelpers';\nimport {filterItemsByFilterSwitches} from 'app/components/sharedReactComponents/FilterSelector/utils';\nimport {containsSearchString} from 'app/components/FleetManager/utils';\nimport {isCompleted, isOngoing, isScheduled} from 'app/domain/schedule/utils';\nimport {permissions} from 'app/components/sharedReactComponents/Events/constants';\n\n/* filter helpers */\nexport function filterOngoing(events: Schedule.Event[]) {\n return events.filter((e) => isOngoing(e.status));\n}\n\nexport function filterCompleted(events: Schedule.Event[]) {\n return events.filter((e) => isCompleted(e.status));\n}\n\nexport function filterScheduled(events: Schedule.Event[]) {\n return events.filter((e) => isScheduled(e.status));\n}\n\nexport function filterEvents(events: Schedule.Event[], filters: ScheduleFilterSwitch[]) {\n return filterItemsByFilterSwitches(events, filters);\n}\n\nexport function filterByName(event: Schedule.Event, search: string) {\n return containsSearchString(event.title, search);\n}\n\nexport function getActiveFilters(\n allFilters: ScheduleFilterSwitch[],\n activeFilterSwitches: Set<string>,\n): ScheduleFilterSwitch[] {\n return allFilters.filter((filterSwitch) => activeFilterSwitches.has(filterSwitch.id));\n}\n\nexport function isListView(view: ScheduleView) {\n return view === 'list';\n}\nexport function isCalendarView(view: ScheduleView) {\n return view === 'calendar';\n}\n\nexport function getDeviceDetailsUrl(deviceId: string): string {\n return router.url('deviceDetails', {deviceId});\n}\n\nexport function formatEventMedia(m: Schedule.EventMedia) {\n switch (m) {\n case 'streaming':\n return 'Live stream';\n\n case 'recording':\n return 'VOD';\n\n default:\n return 'VOD + Live stream';\n }\n}\n\nexport function formatEventPeriod(begin: TimeStampSeconds, end: TimeStampSeconds) {\n const t1 = dayjs.unix(begin);\n const t2 = dayjs.unix(end);\n const isSameDay = t1.isSame(t2, 'day');\n\n const format = isSameDay ? 'h:mm A' : 'MMM D h:mm A';\n\n return `${t1.format(format)} - ${t2.format(format)}`;\n}\n\nexport function formatCmsName(cms: Schedule.Cms): string {\n switch (cms) {\n case 'chrono':\n return 'Epiphan Edge';\n\n case 'yuja':\n return 'YuJa';\n\n default:\n return capitalize(cms);\n }\n}\n\nexport function sortEvents(a: Schedule.Event, b: Schedule.Event) {\n if (a.start < b.start) {\n return -1;\n }\n\n if (a.start > b.start) {\n return 1;\n }\n\n if (a.end < b.end) {\n return -1;\n }\n\n if (a.end > b.end) {\n return 1;\n }\n\n return 0;\n}\n\nexport function fromPeriod(period: Schedule.Period): Dayjs {\n return dayjs().year(period.year).week(period.week).startOf('week');\n}\n\nexport function getCurrentPeriod(): Schedule.Period {\n return {\n week: dayjs().week(),\n year: dayjs().weekYear(),\n };\n}\n\nexport function isCurrentPeriod(period: Schedule.Period) {\n const current = getCurrentPeriod();\n return current.week === period.week && current.year === period.year;\n}\n\nexport function getNextPeriod(period: Schedule.Period): Schedule.Period {\n const date = fromPeriod(period).add(1, 'week');\n\n return {\n week: date.week(),\n year: date.weekYear(),\n };\n}\n\nexport function getPreviousPeriod(period: Schedule.Period): Schedule.Period {\n const date = fromPeriod(period).subtract(1, 'week');\n\n return {\n week: date.week(),\n year: date.weekYear(),\n };\n}\n\nexport function getPeriodBorders(period: Schedule.Period): TimeRange {\n const date = fromPeriod(period);\n\n return {\n from: date.startOf('week').unix(),\n to: date.endOf('week').unix(),\n };\n}\n\nexport function getVariant(status: Schedule.EventStatus): Schedule.EventVariant {\n if (isOngoing(status)) return 'ongoing';\n\n if (isScheduled(status)) return 'scheduled';\n\n return 'completed';\n}\n\nexport function formatEventTime(start: number, end: number): string {\n const from = dayjs.unix(start);\n const to = dayjs.unix(end);\n\n return `${from.format('hh:mm A')} - ${to.format('hh:mm A')}`;\n}\n\nexport function formatEventDate(start: number, end: number): string {\n const from = dayjs.unix(start);\n const to = dayjs.unix(end);\n\n if (from.isSame(to, 'day')) {\n return from.format('MMM D, YYYY');\n }\n return `${from.format('MMM D')} - ${to.format('MMM D, YYYY')}`;\n}\n\nexport function formatEventFullTime(start: number, end: number): string {\n return `${formatEventTime(start, end)}, ${formatEventDate(start, end)}`;\n}\n\nexport function canStart(cms: Schedule.Cms): boolean {\n return permissions.get(cms)?.start ?? false;\n}\n\nexport function canStop(cms: Schedule.Cms): boolean {\n return permissions.get(cms)?.stop ?? false;\n}\n\nexport function canPauseResume(cms: Schedule.Cms): boolean {\n return permissions.get(cms)?.pause ?? false;\n}\n\nexport function canExtend(cms: Schedule.Cms): boolean {\n return permissions.get(cms)?.extend ?? false;\n}\n","import React from 'react';\nimport {Button, ButtonProps, Stack, Typography} from '@mui/material';\nimport {EventTitle} from 'app/components/sharedReactComponents/Events/shared/EventTitle/EventTitle';\nimport {DataId, Sx} from 'app/types/common';\nimport {EventCountdown} from 'app/components/sharedReactComponents/Events/shared/EventCountdown/EventCountdown';\nimport {router} from 'app/router/admin';\nimport {parseMasterAndChannelIds} from 'app/components/DeviceDetails/utils';\nimport {EventIcon} from 'app/components/sharedReactComponents/Events/shared/EventIcon/EventIcon';\nimport {Schedule} from 'app/domain/schedule';\nimport {PausedBadge} from 'app/components/sharedReactComponents/Events/shared/PausedBadge/PausedBadge';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {getVariant} from 'app/components/sharedReactComponents/Events/utils';\nimport {getOverMessage} from 'app/components/sharedReactComponents/Events/shared/EventCountdown/utils';\n\ntype Props = DataId &\n Sx & {\n event: Schedule.Event;\n deviceId: string;\n label?: string;\n showTime?: boolean;\n overLabel?: string;\n } & Pick<ButtonProps, 'variant' | 'color'>;\n\nexport function EventInfo({\n dataId,\n sx,\n deviceId,\n event,\n color,\n overLabel,\n showTime = false,\n label = '',\n variant = 'text',\n}: Props) {\n const [master] = parseMasterAndChannelIds(deviceId);\n\n const eventVariant = getVariant(event.status);\n const paused = event.status === 'paused';\n\n const deviceDetailsUrl = router.url('deviceDetails', {deviceId: master}, {activeTab: 'events'});\n\n const completed = eventVariant === 'completed';\n\n const renderCountdown = () => {\n if (!showTime || completed) {\n return null;\n }\n\n if (event.status === 'awaiting_confirmation') {\n return (\n <Typography data-id=\"confirmation-message\" sx={sx} color=\"error.main\">\n Waiting confirmation\n </Typography>\n );\n }\n\n return (\n <EventCountdown\n dataId=\"event-timer\"\n sx={{flexShrink: 0, color: getTimerTextColor(eventVariant)}}\n variant={eventVariant}\n start={event.start}\n end={event.end}\n overMessage={getOverMessage(eventVariant, event.start, overLabel)}\n label={\n label ? (\n <Typography noWrap={true} color=\"inherit\">\n {label}\n </Typography>\n ) : null\n }\n />\n );\n };\n\n return (\n <Button\n data-id={dataId}\n sx={packSx({height: 24, fontSize: 14, '&:focus': {outline: 'none'}}, sx)}\n variant={variant}\n color={color}\n href={deviceDetailsUrl}\n >\n <Stack direction=\"row\" alignItems=\"center\" gap={1} minWidth={0}>\n <EventIcon type={eventVariant} />\n\n <EventTitle\n sx={{color: 'text.primary', minWidth: 0}}\n dataId=\"event-title\"\n text={event.title}\n rows={1}\n />\n\n {paused && <PausedBadge />}\n\n {renderCountdown()}\n </Stack>\n </Button>\n );\n}\n\nfunction getTimerTextColor(variant: Schedule.EventVariant) {\n if (variant === 'ongoing') {\n return 'error.main';\n }\n\n if (variant === 'scheduled') {\n return 'primary.main';\n }\n\n return 'text.primary';\n}\n","import React, {useState} from 'react';\nimport {filesize} from 'filesize';\nimport {Button, Popover, Stack, Tooltip, Typography} from '@mui/material';\nimport {Gauge} from '@mui/x-charts';\nimport StorageIcon from '@mui/icons-material/Storage';\nimport {StyleSx, Sx} from 'app/types/common';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {isNil} from 'app/util/isNil';\nimport {Edge} from 'app/domain/edge';\nimport {getGaugeSx} from 'app/components/features/edge/EdgeDevice/indicators/indicators.types';\n\nconst rootSx: StyleSx = {py: 0.5, px: 1, gap: 0.5};\nconst paperSx: StyleSx = {p: 1, minWidth: 132};\n\ntype Props = Sx & {\n storage: Edge.Storage;\n};\n\nexport function DeviceStorage({sx, storage}: Props) {\n const [menu, setMenu] = useState<HTMLElement | null>(null);\n\n const {free, used, total} = storage;\n\n const gaugeSx = packSx(getGaugeStyles(used / total), {alignSelf: 'center'});\n\n const renderPanel = () => {\n if (!total) {\n return <Typography>No storage available</Typography>;\n }\n\n return (\n <>\n <Gauge\n sx={gaugeSx}\n width={80}\n height={80}\n innerRadius=\"90%\"\n outerRadius=\"125%\"\n valueMax={total}\n value={used}\n text={({value}) => {\n const used = value ?? 0;\n const usage = (used / total) * 100;\n\n return `${usage.toFixed(1).replace('.0', '')}%`;\n }}\n />\n <Stack direction=\"row\" justifyContent=\"space-between\">\n <Typography>Total:</Typography>\n\n <Typography fontWeight={600} data-id=\"storage-total\">\n {filesize(total, {round: 1})}\n </Typography>\n </Stack>\n <Stack direction=\"row\" justifyContent=\"space-between\">\n <Typography>Used:</Typography>\n\n <Typography data-id=\"storage-used\" fontWeight={600}>\n {filesize(used, {round: 1})}\n </Typography>\n </Stack>\n <Stack direction=\"row\" justifyContent=\"space-between\">\n <Typography>Free:</Typography>\n\n <Typography data-id=\"storage-free\" fontWeight={600}>\n {filesize(free, {round: 1})}\n </Typography>\n </Stack>\n </>\n );\n };\n\n return (\n <>\n <Tooltip title=\"Device storage\">\n <Button\n data-id=\"storage-btn\"\n sx={packSx(rootSx, sx)}\n variant=\"outlined\"\n color=\"info\"\n onClick={(e) => setMenu(e.currentTarget)}\n >\n <StorageIcon />\n\n <Typography data-id=\"device_card_storage\" noWrap={true}>\n {filesize(free, {round: 1})}\n </Typography>\n </Button>\n </Tooltip>\n\n <Popover\n anchorEl={menu}\n open={!isNil(menu)}\n slotProps={{paper: {sx: paperSx}}}\n anchorOrigin={{vertical: 'bottom', horizontal: 'left'}}\n transformOrigin={{vertical: 'top', horizontal: 'left'}}\n onClose={() => setMenu(null)}\n >\n <Typography mb={0.25} fontWeight={600}>\n Device storage\n </Typography>\n\n {renderPanel()}\n </Popover>\n </>\n );\n}\n\nfunction getGaugeStyles(ratio: number): StyleSx {\n if (ratio > 0.95) return getGaugeSx('error');\n\n if (ratio > 0.8) return getGaugeSx('warning');\n\n return getGaugeSx('ok');\n}\n","import {useQuery} from '@tanstack/react-query';\nimport {DeviceApiService} from 'app/services/api/device/DeviceApiService';\nimport {EdgeMapper} from 'app/util/mappers/edge/EdgeMapper';\n\ninterface Args {\n deviceId: string;\n enabled: boolean;\n staleTime?: number;\n refetchInterval?: number;\n}\n\nexport function useDeviceStorage({deviceId, enabled, staleTime, refetchInterval}: Args) {\n return useQuery({\n queryKey: ['unit', 'storage', deviceId],\n queryFn: async () => {\n const response = await DeviceApiService.getStorage(deviceId);\n\n if (response) {\n return EdgeMapper.mapStorage(response);\n }\n\n return null;\n },\n refetchInterval,\n staleTime,\n enabled,\n });\n}\n","import React from 'react';\nimport {Skeleton} from '@mui/material';\nimport {Sx} from 'app/types/common';\nimport {DeviceStorage} from 'app/components/features/edge/EdgeDevice/StorageIndicator/DeviceStorage/DeviceStorage';\nimport {useDeviceStorage} from 'app/components/DeviceDetails/DeviceInfoTab/SystemInformation/useStorageInfo';\n\ntype Props = Sx & {\n deviceId: string;\n enabled: boolean;\n};\n\nexport function StorageIndicator({sx, deviceId, enabled}: Props) {\n const query = useDeviceStorage({\n deviceId,\n enabled,\n staleTime: 30 * 1000,\n refetchInterval: 60 * 1000,\n });\n\n if (enabled && query.isLoading) {\n return <Skeleton sx={sx} variant=\"rounded\" height={31} width={70} />;\n }\n\n if (query.isSuccess && query.data) {\n return <DeviceStorage sx={sx} storage={query.data} />;\n }\n\n return null;\n}\n","import React, {useState} from 'react';\nimport {filesize} from 'filesize';\nimport {Button, Divider, Popover, Stack, Tooltip, Typography} from '@mui/material';\nimport CloudDoneIcon from '@mui/icons-material/CloudDone';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {StyleSx, Sx} from 'app/types/common';\nimport {isNil} from 'app/util/isNil';\nimport {Edge} from 'app/domain/edge';\nimport {capitalize, pluralizeN} from 'app/components/helpers/commonHelpers';\n\nconst rootSx: StyleSx = {py: 0.5, px: 1, gap: 0.5, minWidth: 68, justifyContent: 'flex-start'};\nconst paperSx: StyleSx = {p: 1, minWidth: 132, maxWidth: 280};\n\ntype Props = Sx & {\n afu: Edge.Afu;\n};\n\nexport function DeviceUploading({sx, afu}: Props) {\n const [menu, setMenu] = useState<HTMLElement | null>(null);\n\n const renderQueue = () => {\n const {queue, state} = afu;\n\n if (state === 'disabled') {\n return null;\n }\n\n if (!isNil(queue) && !isNil(queue.files) && !isNil(queue.size)) {\n return (\n <Typography data-id=\"queue-size\">\n {filesize(queue.size, {round: 1})} in {queue.files} {pluralizeN('file', queue.files)}\n </Typography>\n );\n }\n\n return <Typography data-id=\"queue-size\">No files in queue</Typography>;\n };\n\n const renderButtonValue = () => {\n if (afu.queue && !isNil(afu.queue.files)) {\n return `${afu.queue.files} ${pluralizeN('file', afu.queue.files)}`;\n }\n\n return 'Up to date';\n };\n\n return (\n <>\n <Tooltip title=\"Automatic file upload\">\n <Button\n data-id=\"upload-indicators\"\n sx={packSx(rootSx, sx)}\n variant=\"outlined\"\n color=\"info\"\n disableRipple={false}\n onClick={(e) => setMenu(e.currentTarget)}\n >\n <CloudDoneIcon />\n\n <Typography data-id=\"device_card_transferQueue\" noWrap={true}>\n {renderButtonValue()}\n </Typography>\n </Button>\n </Tooltip>\n\n <Popover\n anchorEl={menu}\n open={!isNil(menu)}\n slotProps={{paper: {sx: paperSx}}}\n anchorOrigin={{vertical: 'bottom', horizontal: 'left'}}\n transformOrigin={{vertical: 'top', horizontal: 'left'}}\n onClose={() => setMenu(null)}\n >\n <Typography mb={0.25} fontWeight={600}>\n Automatic file upload\n </Typography>\n\n <Stack\n direction=\"row\"\n alignItems=\"center\"\n gap={1}\n divider={<Divider orientation=\"vertical\" flexItem={true} />}\n >\n <Typography data-id=\"queue-state\" component=\"span\" color={getStateColor(afu.state)}>\n {formatState(afu.state)}\n </Typography>\n\n {renderQueue()}\n </Stack>\n\n {afu.error && (\n <Typography data-id=\"queue-message\" mt={0.25} color=\"error.main\">\n {afu.error.message}\n </Typography>\n )}\n </Popover>\n </>\n );\n}\n\nfunction formatState(state: Edge.AfuState): string {\n if (state === 'idle') {\n return 'Ready';\n }\n\n return capitalize(state);\n}\n\nfunction getStateColor(state: Edge.AfuState): string {\n if (state === 'idle') return 'secondary.main';\n\n if (state === 'error') return 'error.main';\n\n if (state === 'uploading') return 'primary.main';\n\n return 'text.disabled';\n}\n","import {front} from 'app/api/CirrusApi';\nimport {Afu} from 'app/components/entities/afu/model';\n\nexport class AfuApi {\n static async getAfu(deviceId: string): Promise<Afu.Configuration | null> {\n return front.devices(deviceId).afu().get();\n }\n\n static async setProtocol(deviceId: string, protocol: string) {\n return front.devices(deviceId).afu().post({protocol});\n }\n}\n","import {useEffect} from 'react';\nimport {WS} from 'app/api/WebSocket/WS';\nimport {EVENT_TYPE} from 'app/api/WebSocket/constants';\nimport {useUnitAfuQuery} from 'app/components/entities/afu/hooks/useUnitAfuQuery';\nimport {Ws} from 'app/contracts/ws';\n\ninterface Args {\n deviceId: string;\n enabled: boolean;\n refetchInterval?: number;\n}\n\nexport function useUnitAfu(args: Args) {\n const query = useUnitAfuQuery(args);\n\n const {deviceId, enabled} = args;\n const {refetch} = query;\n\n useEffect(() => {\n if (!enabled) {\n return;\n }\n\n const onAfuChange = (message: Ws.AfuChange) => {\n if (message.Body.DeviceID === deviceId) {\n void refetch();\n }\n };\n\n WS.on(EVENT_TYPE.AFU_CHANGE, onAfuChange);\n\n return () => {\n WS.off(EVENT_TYPE.AFU_CHANGE, onAfuChange);\n };\n }, [enabled, deviceId, refetch]);\n\n return query;\n}\n","import {useQuery} from '@tanstack/react-query';\nimport {AfuApi} from 'app/components/entities/afu/api/AfuApi';\n\ninterface Args {\n deviceId: string;\n enabled: boolean;\n staleTime?: number;\n refetchInterval?: number;\n}\n\nexport function useUnitAfuQuery({deviceId, enabled, refetchInterval, staleTime}: Args) {\n return useQuery({\n queryKey: ['unit', 'afu', deviceId],\n queryFn: async () => {\n const response = await AfuApi.getAfu(deviceId);\n return response;\n },\n\n refetchInterval,\n staleTime,\n enabled,\n });\n}\n","import React from 'react';\nimport {Skeleton} from '@mui/material';\nimport {Sx} from 'app/types/common';\nimport {DeviceUploading} from 'app/components/features/edge/EdgeDevice/UploadingIndicator/DeviceUploading/DeviceUploading';\nimport {useUnitAfu} from 'app/components/entities/afu';\n\ntype Props = Sx & {\n deviceId: string;\n enabled: boolean;\n};\n\nexport function UploadingIndicator({sx, deviceId, enabled}: Props) {\n const query = useUnitAfu({deviceId, enabled, refetchInterval: 30 * 1000});\n\n if (enabled && query.isLoading) {\n return <Skeleton sx={sx} variant=\"rounded\" height={31} width={70} />;\n }\n\n if (query.isSuccess && query.data) {\n return <DeviceUploading sx={sx} afu={query.data} />;\n }\n\n return null;\n}\n","export enum PreviewUpdateStrategy {\n Interval,\n Ws,\n WsApi,\n}\n","import {useEffect, useState} from 'react';\nimport {DeviceIdentifier, parseMasterAndChannelIds} from 'app/components/DeviceDetails/utils';\n\nexport function useDeviceId(id: string): DeviceIdentifier {\n const [pair, setPair] = useState<DeviceIdentifier>(() => parseMasterAndChannelIds(id));\n\n useEffect(() => {\n setPair(parseMasterAndChannelIds(id));\n }, [id]);\n\n return pair;\n}\n","import {\n TimeStampMilliseconds,\n TimeStampSeconds,\n} from 'app/types/common';\n\nfunction createStampedImageSrc(imageSrc: string, timeStamp?: TimeStampMilliseconds | TimeStampSeconds): string {\n return `${imageSrc}${imageSrc.includes('?') ? '&' : '?'}v=${timeStamp ?? Date.now()}`;\n}\n\nexport {\n createStampedImageSrc,\n};\n","import {useEffect, useRef} from 'react';\nimport {RepeatedCall} from 'app/util/RepeatedCall';\nimport {secondsToMilliseconds} from 'app/util/timeConverter';\nimport {Callback} from 'app/types/common';\n\n/**\n * Send device command every 30 seconds to continue receive WebSocket data\n * @type {number}\n */\nconst REPEATED_COMMAND_TIMEOUT_MS = secondsToMilliseconds(30);\n\ntype CommandProp = Callback<Promise<any>>;\n\nexport function useDeviceStatusStartCommand({\n command,\n disabled,\n}: {\n command: CommandProp;\n disabled: boolean;\n}) {\n const commandRef = useRef<CommandProp>(command);\n\n commandRef.current = command;\n\n useEffect(() => {\n if (disabled) {\n return;\n }\n\n const repeatedCall = new RepeatedCall({\n call: async () => commandRef.current(),\n initialTimeoutMs: REPEATED_COMMAND_TIMEOUT_MS,\n });\n\n void repeatedCall.start(true);\n\n return () => {\n repeatedCall.stop();\n };\n }, [disabled]);\n}\n","import {useEffect} from 'react';\nimport {secondsToMilliseconds} from 'app/util/timeConverter';\nimport {Callback} from 'app/types/common';\nimport {createStampedImageSrc} from 'app/components/sharedReactComponents/StatusImage/utils';\n\nconst UPDATING_INTERVAL = secondsToMilliseconds(10);\n\ninterface Params {\n initialImageSrc: string;\n disabled?: boolean;\n immediately?: boolean;\n setImageSrc: Callback;\n}\n\nexport function useUpdatePreviewByInterval({\n initialImageSrc,\n disabled,\n immediately,\n setImageSrc,\n}: Params) {\n useEffect(() => {\n if (disabled) {\n return;\n }\n\n let imageUpdatingTimeout = 0;\n\n function action() {\n setImageSrc(createStampedImageSrc(initialImageSrc));\n }\n\n function start() {\n imageUpdatingTimeout = window.setTimeout(() => {\n action();\n start();\n }, UPDATING_INTERVAL);\n }\n\n if (immediately === true) {\n action();\n }\n\n start();\n\n return () => {\n window.clearTimeout(imageUpdatingTimeout);\n };\n }, [initialImageSrc, disabled, immediately, setImageSrc]);\n}\n","export enum ApiDevicePreviewSize {\n Small = 'small',\n Big = 'big',\n}\n","import {front} from 'app/api/CirrusApi';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {ApiDevicePreviewSize} from 'app/components/sharedReactComponents/StatusImage/types';\nimport {PreviewUpdateStrategy} from 'app/hooks/Device/Preview/types';\n\nexport const getPreviewUrl = (\n id: string,\n updateStrategy: PreviewUpdateStrategy,\n big = false,\n): string => {\n if (updateStrategy === PreviewUpdateStrategy.WsApi) {\n return front\n .devices(id)\n .preview({size: big ? ApiDevicePreviewSize.Big : undefined})\n .url();\n }\n\n return front.devices(id).snapshot().url();\n};\n\nexport function getPreviewUpdateStrategy(device: AnyDeviceModelType): PreviewUpdateStrategy {\n const caps = device.getCapabilities();\n\n if (caps.supportsWsApi()) {\n return PreviewUpdateStrategy.WsApi;\n }\n\n if (caps.supportsChannelPreviews()) {\n return PreviewUpdateStrategy.Ws;\n }\n\n return PreviewUpdateStrategy.Interval;\n}\n","import {\n useCallback,\n useEffect,\n useState,\n} from 'react';\nimport {WS} from 'app/api/WebSocket/WS';\nimport {PreviewUpdateStrategy} from 'app/hooks/Device/Preview/types';\nimport {useUpdatePreviewByWebsocket} from 'app/hooks/Device/Preview/useUpdatePreviewByWebsocket';\nimport {DeviceCommandDispatcher} from 'app/util/CommandDispatcher';\nimport {parseMasterAndChannelIds} from 'app/components/DeviceDetails/utils';\nimport {useUpdatePreviewByInterval} from 'app/hooks/Device/Preview/useUpdatePreviewByInterval';\nimport {getPreviewUrl} from 'app/components/sharedReactComponents/Preview/utils';\n\ninterface ChannelPreviewParams {\n channelId: string;\n updateStrategy: PreviewUpdateStrategy;\n big?: boolean;\n}\n\nexport function useChannelPreview({\n channelId,\n updateStrategy,\n big,\n}: ChannelPreviewParams): string {\n const [baseSrc, setBaseSrc] = useState(() => getPreviewUrl(channelId, updateStrategy, big));\n const [imageSrc, setImageSrc] = useState(baseSrc);\n\n const command = useCallback(async () => {\n const [master] = parseMasterAndChannelIds(channelId);\n return DeviceCommandDispatcher.channelPreviews(master);\n }, [channelId]);\n\n useEffect(() => {\n setBaseSrc(getPreviewUrl(channelId, updateStrategy, big));\n }, [channelId, updateStrategy, big]);\n\n useUpdatePreviewByWebsocket({\n baseSrc,\n command,\n deviceId: channelId,\n disabled: updateStrategy !== PreviewUpdateStrategy.Ws,\n setSrc: setImageSrc,\n listener: WS.onDeviceChannelImage,\n disposer: WS.offDeviceChannelImage,\n });\n\n useUpdatePreviewByInterval({\n initialImageSrc: baseSrc,\n disabled: updateStrategy === PreviewUpdateStrategy.Ws,\n setImageSrc,\n });\n\n return imageSrc;\n}\n","import {useEffect} from 'react';\nimport {WSBaseDto} from 'app/api/WebSocket/types';\nimport {createStampedImageSrc} from 'app/components/sharedReactComponents/StatusImage/utils';\nimport {Callback} from 'app/types/common';\nimport {useDeviceStatusStartCommand} from 'app/hooks/Device/useDeviceStatusStartCommand';\n\ninterface Params {\n baseSrc: string;\n disabled: boolean;\n deviceId: string;\n sourceId?: string;\n command: Callback<Promise<any>>;\n setSrc: Callback<void, [string]>;\n listener: Callback<void>;\n disposer: Callback<void>;\n}\n\nexport function useUpdatePreviewByWebsocket({\n deviceId,\n sourceId,\n command,\n disabled,\n baseSrc,\n setSrc,\n listener,\n disposer,\n}: Params) {\n useDeviceStatusStartCommand({\n command,\n disabled,\n });\n\n useEffect(() => {\n if (disabled) {\n return;\n }\n\n function socketHandler(data: WSBaseDto) {\n setSrc(createStampedImageSrc(baseSrc, data.Timestamp));\n }\n\n listener(socketHandler, deviceId, sourceId);\n\n return () => disposer(socketHandler, deviceId, sourceId);\n }, [disabled, baseSrc, deviceId, sourceId, listener, disposer, setSrc]);\n}\n","import React from 'react';\nimport {ClassName, DataId} from 'app/types/common';\nimport {PreviewUpdateStrategy} from 'app/hooks/Device/Preview/types';\nimport {useChannelPreview} from 'app/components/sharedReactComponents/Preview/ChannelPreview/useChannelPreview';\n\ninterface Props extends ClassName, DataId {\n channelId: string;\n updateStrategy: PreviewUpdateStrategy;\n big?: boolean;\n alt?: string;\n}\n\nexport const ChannelPreview: React.VFC<Props> = ({\n className,\n channelId,\n updateStrategy,\n big,\n dataId,\n alt = '',\n}) => {\n const src = useChannelPreview({\n channelId,\n big,\n updateStrategy,\n });\n\n return <img className={className} src={src} alt={alt} data-id={dataId} />;\n};\n","import React from 'react';\nimport {Icons} from 'app/util/icons';\nimport {SIZE} from 'app/constants';\n\ninterface Props {\n size: SIZE;\n}\n\nexport const StatusImageLoading: React.FC<Props> = ({size}) => (\n <div className=\"status-image-loading\">\n {Icons.spinner().size(size).reactComponent()}\n </div>\n);\n","import React, {useEffect, useState} from 'react';\nimport {SIZE} from 'app/constants';\nimport {ClassName, DataId} from 'app/types/common';\nimport {StatusImageLoading} from 'app/components/sharedReactComponents/StatusImage/StatusImageLoading';\nimport {PreviewUpdateStrategy} from 'app/hooks/Device/Preview/types';\nimport {getPreviewUrl} from 'app/components/sharedReactComponents/Preview/utils';\nimport {useUpdatePreviewByInterval} from 'app/hooks/Device/Preview/useUpdatePreviewByInterval';\n\ninterface Props extends ClassName, DataId {\n deviceId: string;\n updateStrategy: PreviewUpdateStrategy;\n size?: SIZE;\n alt?: string;\n}\n\nexport const DevicePreview: React.VFC<Props> = ({\n className,\n deviceId,\n updateStrategy,\n size,\n dataId,\n alt = '',\n}) => {\n const [imageSrc, setImageSrc] = useState<string>();\n const [baseSrc, setBaseSrc] = useState(() =>\n getPreviewUrl(deviceId, updateStrategy, size === SIZE.XXL),\n );\n\n useEffect(() => {\n setBaseSrc(getPreviewUrl(deviceId, updateStrategy, size === SIZE.XXL));\n }, [deviceId, updateStrategy, size]);\n\n useUpdatePreviewByInterval({\n initialImageSrc: baseSrc,\n setImageSrc,\n immediately: true,\n });\n\n if (imageSrc && size) {\n return (\n <div className={className}>\n <StatusImageLoading size={size} />\n </div>\n );\n }\n\n return <img className={className} src={imageSrc} data-id={dataId} alt={alt} />;\n};\n","import React from 'react';\nimport {ClassName, DataId} from 'app/types/common';\nimport {SIZE} from 'app/constants';\nimport {PreviewUpdateStrategy} from 'app/hooks/Device/Preview/types';\nimport {useDeviceId} from 'app/hooks/Device/useDeviceId';\nimport {ChannelPreview} from 'app/components/sharedReactComponents/Preview/ChannelPreview/ChannelPreview';\nimport {DevicePreview} from 'app/components/sharedReactComponents/Preview/DevicePreview/DevicePreview';\nimport classNames from 'classnames';\n\ninterface Props extends ClassName, DataId {\n id: string;\n updateStrategy: PreviewUpdateStrategy;\n size?: SIZE;\n alt?: string;\n}\n\nexport const Preview: React.VFC<Props> = ({className, id, updateStrategy, dataId, size, alt}) => {\n const [, channel] = useDeviceId(id);\n\n const classes = classNames('preview', className);\n\n if (channel) {\n return (\n <ChannelPreview\n className={classes}\n channelId={id}\n updateStrategy={updateStrategy}\n big={size === SIZE.XXL}\n dataId={dataId}\n alt={alt}\n />\n );\n }\n\n return (\n <DevicePreview\n className={classes}\n deviceId={id}\n updateStrategy={updateStrategy}\n size={size}\n dataId={dataId}\n alt={alt}\n />\n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport {\n ClassName,\n Callback,\n} from 'app/types/common';\nimport {Icons} from 'app/util/icons';\nimport {PreviewUpdateStrategy} from 'app/hooks/Device/Preview/types';\nimport {Preview} from 'app/components/sharedReactComponents/Preview/Preview';\nimport {SIZE} from 'app/constants';\n\ninterface Props extends ClassName {\n id: string;\n updateStrategy: PreviewUpdateStrategy;\n detailsUrl?: string;\n size?: SIZE;\n onClick?: Callback;\n}\n\nexport const Thumbnail: React.VFC<Props> = ({\n className,\n id,\n updateStrategy,\n detailsUrl,\n size,\n onClick,\n}) => {\n return (\n <div\n className={classNames('thumbnail', className)}\n data-id=\"thumbnail\"\n >\n <Preview\n className=\"thumbnail__image\"\n id={id}\n size={size}\n updateStrategy={updateStrategy}\n dataId=\"thumbnail_image\"\n />\n\n <a\n className=\"thumbnail__activate-btn\"\n data-id=\"thumbnail_details_button\"\n href={detailsUrl}\n onClick={onClick}\n >\n {Icons.info().label('Details').reactComponent()}\n </a>\n </div>\n );\n};\n","import {WSDeviceAlsDto} from 'app/api/WebSocket/types';\nimport {WS} from 'app/api/WebSocket/WS';\nimport {useDeviceId} from 'app/hooks/Device/useDeviceId';\nimport {useDeviceStatusStartCommand} from 'app/hooks/Device/useDeviceStatusStartCommand';\nimport {DeviceCommandDispatcher} from 'app/util/CommandDispatcher';\nimport {secondsToMilliseconds} from 'app/util/timeConverter';\nimport {useEffect, useRef, useState} from 'react';\n\ninterface AudioLevels {\n valueL?: number;\n valueR?: number;\n}\n\n/**\n * id: {masterId}-{channelIdx}?\n */\ninterface Params {\n id: string;\n disabled: boolean;\n sourceId?: string;\n}\n\nconst sourceGetter = (\n source?: string,\n channelIdx?: string,\n) => source ? source : channelIdx ? `CHANNEL${channelIdx}` : 'master';\n\nconst RESET_ON_IDLE_MS = secondsToMilliseconds(5);\n\nexport function useDeviceAudioLevels({\n id,\n sourceId,\n disabled,\n}: Params): AudioLevels {\n const [master, channelIdx] = useDeviceId(id);\n const [state, setState] = useState<AudioLevels>({});\n const [source, setSource] = useState(() => sourceGetter(sourceId, channelIdx));\n const idleTimeout = useRef<number>();\n\n useDeviceStatusStartCommand({\n command: async () => DeviceCommandDispatcher.audioLevels(master),\n disabled,\n });\n\n useEffect(() => {\n setSource(sourceGetter(sourceId, channelIdx));\n }, [sourceId, channelIdx]);\n\n useEffect(() => {\n if (disabled) {\n return;\n }\n\n function handleDeviceALS(socketData: WSDeviceAlsDto) {\n const data = socketData.Body.Data || {};\n\n const [valueL, valueR] = data[source] ?? [];\n\n clearTimeout(idleTimeout.current);\n\n idleTimeout.current = window.setTimeout(() => {\n setState({});\n }, RESET_ON_IDLE_MS);\n\n setState({\n valueL,\n valueR,\n });\n }\n\n WS.onDeviceALS(handleDeviceALS, master);\n\n return () => {\n clearTimeout(idleTimeout.current);\n setState({});\n WS.offDeviceALS(handleDeviceALS, master);\n };\n }, [disabled, source, master]);\n\n return state;\n}\n","import {Callback} from 'app/types/common';\nimport {isNil} from 'app/util/isNil';\n\ntype ColorLevels = [\n fair: number,\n bad: number\n];\n\nconst Colors = {\n Disabled: '#e1e3e5',\n Green: '#8cbe3f',\n Orange: '#ffc800',\n Red: '#ff0048'\n} as const;\n\nexport const getSegmentColor = (\n segment: number,\n active: boolean,\n levels: ColorLevels,\n): string => {\n const [fair, bad] = levels;\n\n let color: string = Colors.Disabled;\n\n if (active) {\n color = Colors.Green;\n\n if (segment >= fair) {\n color = Colors.Orange;\n }\n\n if (segment >= bad) {\n color = Colors.Red;\n }\n }\n\n return color;\n};\n\ntype Measure = 'width' | 'height';\n\ntype SegmentMeasure<T extends Measure> =\n | `${T}`\n | `segment${Capitalize<T>}`\n | `segment${Capitalize<T>}WithGap`;\n\ntype Height = Record<SegmentMeasure<'height'>, number>;\ntype Width = Record<SegmentMeasure<'width'>, number>;\n\ninterface DrawSegmentArgs {\n context: CanvasRenderingContext2D;\n segment: number;\n active?: boolean;\n vertical: boolean;\n levels: ColorLevels;\n w: Width;\n h: Height;\n}\n\nexport const drawSegment = ({\n context,\n segment,\n levels,\n vertical,\n h,\n w,\n active = false,\n}: DrawSegmentArgs): void => {\n const {\n width,\n segmentWidth,\n segmentWidthWithGap,\n } = w;\n\n const {\n height,\n segmentHeight,\n segmentHeightWithGap\n } = h;\n\n const color = getSegmentColor(segment, active, levels);\n context.fillStyle = color;\n\n if (vertical) {\n context.fillRect(0, height - segmentHeight - (segment * segmentHeightWithGap), width, segmentHeight);\n } else {\n context.fillRect(segment * segmentWidthWithGap, 0, segmentWidth, height);\n }\n};\n\ninterface DrawCanvasArgs {\n value?: number;\n context: CanvasRenderingContext2D;\n width: number;\n height: number;\n vertical: boolean;\n segmentsGap: number;\n segmentsCount: number;\n}\n\nconst Thresholds = {\n start: -60,\n fair: -18,\n bad: -9,\n end: -0,\n} as const;\n\n/**\n * {@link http://www.playdotsound.com/portfolio-item/decibel-db-to-float-value-calculator-making-sense-of-linear-values-in-audio-tools/}\n * {@link https://github.com/tomnomnom/vumeter}\n * {@link https://github.com/LinusU/vu-meter}\n * @param {number} value\n * @param {number} segmentsCount\n * @returns {number}\n */\nfunction processValue(value: number, segmentsCount: number): number {\n const startThreshold = Thresholds.start;\n const endThreshold = Thresholds.end;\n\n const processed = Math.max(Math.min(value, endThreshold), startThreshold);\n\n const aspect = (Math.abs(startThreshold) - Math.abs(endThreshold)) / segmentsCount;\n\n let truncFunc: Callback<number>;\n let addVal = 0;\n\n if (segmentsCount <= 60) {\n truncFunc = Math.trunc;\n addVal = 1;\n } else {\n truncFunc = (num) => Math.ceil(num * 2) / 2;\n addVal = 0.5;\n }\n\n let val = truncFunc(processed);\n\n if (processed === val && processed < 0) {\n val += addVal;\n }\n\n return segmentsCount - Math.trunc(Math.abs(val) / aspect) - 1;\n}\n\nexport const drawAudioMeter = ({\n value,\n context,\n width,\n height,\n vertical,\n segmentsGap,\n segmentsCount,\n}: DrawCanvasArgs): void => {\n const containerWidthWithLastGap = width + segmentsGap;\n const segmentWidthWithGap = Math.round(containerWidthWithLastGap / segmentsCount);\n const segmentWidth = segmentWidthWithGap - segmentsGap;\n\n const containerHeightWithLastGap = height + segmentsGap;\n const segmentHeightWithGap = Math.round(containerHeightWithLastGap / segmentsCount);\n const segmentHeight = segmentHeightWithGap - segmentsGap;\n const processedValue = processValue(value ?? 0, segmentsCount);\n const levels: ColorLevels = [\n processValue(Thresholds.fair, segmentsCount),\n processValue(Thresholds.bad, segmentsCount),\n ];\n\n for (let segment = 0; segment < segmentsCount; segment++) {\n const params: DrawSegmentArgs = {\n context,\n segment,\n levels,\n vertical,\n active: isNil(value) ? false : segment <= processedValue,\n h: {\n height,\n segmentHeight,\n segmentHeightWithGap,\n },\n w: {\n width,\n segmentWidth,\n segmentWidthWithGap\n },\n };\n\n drawSegment(params);\n }\n};\n","import {\n RefObject,\n useCallback,\n useState,\n} from 'react';\nimport {useResizeObserver} from 'app/hooks/useResizeObserver';\n\nexport function useDimensions<T extends HTMLElement>(\n ref: RefObject<T>\n) {\n const [height, setHeight] = useState<number>(0);\n const [width, setWidth] = useState<number>(0);\n\n const handler = useCallback(\n (e: ResizeObserverEntry) => {\n const {height, width} = e.contentRect;\n\n setHeight(height);\n setWidth(width);\n },\n [],\n );\n\n useResizeObserver(ref, handler);\n\n return {height, width};\n}\n","import {Callback} from 'app/types/common';\nimport {RefObject, useCallback, useLayoutEffect} from 'react';\n\nexport function useResizeObserver<R extends HTMLElement>(\n ref: RefObject<R>,\n callback: Callback<void, [ResizeObserverEntry]>,\n) {\n const resizeHandler = useCallback(\n (entries: ResizeObserverEntry[]) => {\n const entry = entries[0];\n\n if (entry) {\n callback(entry);\n }\n },\n [callback],\n );\n\n useLayoutEffect(() => {\n if (!ref.current) {\n return;\n }\n\n const Observer = new ResizeObserver(resizeHandler);\n\n Observer.observe(ref.current);\n\n return () => {\n Observer.disconnect();\n };\n }, [resizeHandler, ref]);\n}\n","import React, {forwardRef, useCallback, useEffect, useMemo, useRef} from 'react';\nimport {getPixelRatio} from 'app/components/sharedReactComponents/Canvas/utils';\n\ntype CanvasChildrenFn = (\n context: CanvasRenderingContext2D,\n width: number,\n height: number,\n) => void;\n\ninterface Props {\n width: number;\n height: number;\n children: CanvasChildrenFn;\n canvasRef?: any;\n}\n\nconst CanvasComponent: React.FC<Props> = ({\n canvasRef,\n width,\n height,\n children,\n}) => {\n const canvasElement = useRef<HTMLCanvasElement>();\n\n const setRef = useCallback((ref) => {\n canvasElement.current = ref;\n\n if (canvasRef) {\n canvasRef.current = ref;\n }\n }, [canvasRef]);\n\n useEffect(() => {\n const pixelRatio = getPixelRatio();\n\n const canvas = canvasElement.current;\n\n if (!canvas) {\n return;\n }\n\n canvas.width = width * pixelRatio;\n canvas.height = height * pixelRatio;\n\n const context = canvas.getContext('2d');\n\n if (!context) {\n return;\n }\n\n context.scale(pixelRatio, pixelRatio);\n children(context, width, height);\n }, [children, width, height]);\n\n const style = useMemo(() => ({\n width,\n height,\n }), [width, height]);\n\n return (\n <canvas\n ref={setRef}\n style={style}\n />\n );\n};\n\nexport const Canvas = forwardRef<any, Props>((props, ref) => (\n <CanvasComponent\n {...props}\n canvasRef={ref}\n />\n));\n\nCanvas.displayName = 'Canvas';\n","function getPixelRatio() {\n return window.devicePixelRatio || 1;\n}\n\nexport {\n getPixelRatio,\n};\n","import React, {useRef} from 'react';\nimport classNames from 'classnames';\nimport {ClassName, DataId} from 'app/types/common';\nimport {drawAudioMeter} from 'app/components/sharedReactComponents/DeviceAudioMeter/AudioMeter/utils';\nimport {useDimensions} from 'app/components/sharedReactComponents/DeviceAudioMeter/AudioMeter/useDimensions';\nimport {Canvas} from 'app/components/sharedReactComponents/Canvas';\n\ninterface Props extends ClassName, DataId {\n value?: number;\n height?: number;\n segmentsCount?: number;\n segmentsGap?: number;\n vertical?: boolean;\n}\n\nexport const AudioMeter: React.VFC<Props> = ({\n className,\n value,\n height,\n segmentsCount = 22,\n segmentsGap = 4,\n vertical = false,\n dataId,\n}) => {\n const containerRef = useRef<HTMLDivElement>(null);\n\n const dimensions = useDimensions(containerRef);\n\n return (\n <div\n ref={containerRef}\n className={classNames('audio-meter-core', className)}\n style={{\n height,\n }}\n data-id={dataId}\n >\n <Canvas width={dimensions.width} height={height ?? dimensions.height}>\n {(context, width, height) =>\n drawAudioMeter({\n value,\n context,\n height,\n width,\n segmentsCount,\n segmentsGap,\n vertical,\n })\n }\n </Canvas>\n </div>\n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport {AudioMeter} from 'app/components/sharedReactComponents/DeviceAudioMeter/AudioMeter/AudioMeter';\nimport {ClassName, DataId} from 'app/types/common';\n\ninterface Props extends ClassName, DataId {\n valueL?: number;\n valueR?: number;\n segmentsCount?: number;\n segmentsGap?: number;\n vertical?: boolean;\n}\n\nexport const AudioMeterStereo: React.FC<Props> = React.memo(\n ({className, valueL, valueR, segmentsCount, segmentsGap, vertical}) => {\n return (\n <div\n className={classNames(\n 'stereo-audio-meter',\n vertical && 'stereo-audio-meter--vertical',\n className,\n )}\n >\n <AudioMeter\n className=\"stereo-audio-meter__channel\"\n data-id=\"audio_meter_stereo_left\"\n value={valueL}\n segmentsCount={segmentsCount}\n segmentsGap={segmentsGap}\n vertical={vertical}\n />\n\n <AudioMeter\n className=\"stereo-audio-meter__channel\"\n data-id=\"audio_meter_stereo_right\"\n value={valueR}\n segmentsCount={segmentsCount}\n segmentsGap={segmentsGap}\n vertical={vertical}\n />\n </div>\n );\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport {ClassName} from 'app/types/common';\nimport {AudioMeter} from 'app/components/sharedReactComponents/DeviceAudioMeter/AudioMeter/AudioMeter';\n\ninterface Props extends ClassName {\n value?: number;\n segmentsCount?: number;\n segmentsGap?: number;\n vertical?: boolean;\n}\n\nexport const AudioMeterMono: React.VFC<Props> = ({\n className,\n value,\n segmentsCount,\n segmentsGap,\n vertical,\n}) => {\n return (\n <div className={classNames('mono-audio-meter', className)}>\n <AudioMeter\n dataId=\"audio_meter_mono\"\n value={value}\n segmentsCount={segmentsCount}\n segmentsGap={segmentsGap}\n vertical={vertical}\n />\n </div>\n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport {ClassName, DataId, Sx} from 'app/types/common';\nimport {useDeviceAudioLevels} from 'app/components/sharedReactComponents/DeviceAudioMeter/useDeviceAudioLevels';\nimport {AudioMeterStereo} from 'app/components/sharedReactComponents/DeviceAudioMeter/AudioMeterStereo/AudioMeterStereo';\nimport {AudioMeterMono} from 'app/components/sharedReactComponents/DeviceAudioMeter/AudioMeterMono/AudioMeterMono';\nimport {Box} from '@mui/material';\n\ntype MODE = 'mono' | 'stereo';\n\nconst DEFAULT_MODE: MODE = 'mono';\n\ninterface Props extends ClassName, Sx, DataId {\n id: string;\n source?: string;\n mode?: MODE;\n segmentsCount?: number;\n segmentsGap?: number;\n vertical?: boolean;\n disabled?: boolean;\n}\n\nexport const DeviceAudioMeter: React.VFC<Props> = ({\n sx,\n className,\n id,\n source,\n mode = DEFAULT_MODE,\n disabled = false,\n segmentsCount,\n segmentsGap,\n vertical,\n}) => {\n const {valueL, valueR} = useDeviceAudioLevels({id, sourceId: source, disabled});\n\n return (\n <Box sx={sx} className={classNames('device-audio-meter', className)}>\n {mode === 'stereo' ? (\n <AudioMeterStereo\n valueL={valueL}\n valueR={valueR}\n segmentsCount={segmentsCount}\n segmentsGap={segmentsGap}\n vertical={vertical}\n />\n ) : (\n <AudioMeterMono\n value={valueL}\n segmentsCount={segmentsCount}\n segmentsGap={segmentsGap}\n vertical={vertical}\n />\n )}\n </Box>\n );\n};\n","import React, {Fragment} from 'react';\nimport flattenChildren from 'react-keyed-flatten-children';\nimport classNames from 'classnames';\nimport {ClassName} from 'app/types/common';\n\nenum STACK_DIRECTION {\n HORIZONTAL = 'horizontal',\n VERTICAL = 'vertical',\n}\n\ninterface Props extends ClassName {\n children: React.ReactNode;\n separatorComponent?: React.ReactNode;\n direction?: STACK_DIRECTION;\n}\n\nexport const Stack: React.FC<Props> = ({\n className,\n children,\n separatorComponent,\n direction = STACK_DIRECTION.VERTICAL,\n}) => {\n if (React.Children.count(children) === 0) {\n return null;\n }\n\n let hasVisibleItems = false;\n\n React.Children.forEach(children, item => {\n if (React.isValidElement(item)) {\n hasVisibleItems = true;\n }\n });\n\n if (hasVisibleItems === false) {\n return null;\n }\n\n let firstItemAdded = false;\n\n return (\n <div className={classNames('stack', `stack--${direction}`, className)}>\n {flattenChildren(children).map((child: any, index) => { // rework child type\n if (React.isValidElement(child) === false) {\n return null;\n }\n\n if (separatorComponent && index > 0 && firstItemAdded) {\n return (\n <Fragment key={child.key}>\n <div className=\"stack__separator\">\n {separatorComponent}\n </div>\n\n <div className=\"stack__item\">\n {child}\n </div>\n </Fragment>\n );\n }\n\n firstItemAdded = true;\n\n return (\n <div\n key={child.key}\n className=\"stack__item\"\n >\n {child}\n </div>\n );\n })}\n </div>\n );\n};\n\nconst StackHorizontal: React.FC<Props> = (props) => (\n <Stack\n {...props}\n direction={STACK_DIRECTION.HORIZONTAL}\n />\n);\n\nexport {\n STACK_DIRECTION,\n StackHorizontal,\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport {ClassName} from 'app/types/common';\n\nenum SEPARATOR_DIRECTION {\n HORIZONTAL = 'horizontal',\n VERTICAL = 'vertical',\n}\n\ninterface Props extends ClassName {\n direction?: SEPARATOR_DIRECTION;\n}\n\nexport const Separator: React.FC<Props> = ({\n className,\n direction = SEPARATOR_DIRECTION.HORIZONTAL,\n}) => {\n return (\n <div className={classNames('separator', `separator--${direction}`, className)}/>\n );\n};\n\nconst SeparatorVertical: React.FC<Props> = (props) => (\n <Separator\n {...props}\n direction={SEPARATOR_DIRECTION.VERTICAL}\n />\n);\n\nexport {\n SEPARATOR_DIRECTION,\n SeparatorVertical,\n};\n","import React from 'react';\nimport {SeparatorVertical} from 'app/components/sharedReactComponents/Separator';\n\nexport function ActionButtonsSeparator() {\n return (\n <SeparatorVertical className=\"action-separator\"/>\n );\n}\n","/**\n * @readonly\n * @enum {string}\n */\nenum DEVICE_START_STOP_BUTTON_STATUS {\n STOPPED = 'stopped',\n LOADING = 'loading',\n STARTED = 'started',\n PAUSED = 'paused',\n ERROR = 'error',\n}\n\n/**\n * @readonly\n * @number\n */\nconst STATUS_CHANGING_TIMEOUT = 10 * 1000;\n\nexport {DEVICE_START_STOP_BUTTON_STATUS, STATUS_CHANGING_TIMEOUT};\n","import React from 'react';\nimport classNames from 'classnames';\nimport {formatPlayback} from 'app/util/time';\nimport {ClassName} from 'app/types/common';\n\n// rework typing\ninterface Props extends ClassName {\n value: number;\n}\n\nexport const Duration: React.FC<Props> = ({\n className,\n value,\n ...elementProps\n}) => {\n const formattedDuration = formatPlayback(value);\n\n return (\n <div\n className={classNames('duration', className)}\n {...elementProps}\n >\n {formattedDuration}\n </div>\n );\n};\n","/* eslint-disable react/default-props-match-prop-types */\nimport React, {Component} from 'react';\nimport classNames from 'classnames';\nimport moment from 'moment';\nimport {Duration} from 'app/components/sharedReactComponents/DurationTimer/Duration';\nimport {ClassName} from 'app/types/common';\nimport {isNil} from 'app/util/isNil';\n\nconst UPDATE_EVERY_MS = 1000;\n\ninterface Props extends ClassName {\n startTime: number;\n receivedTime: number;\n}\n\ninterface State {\n duration: number;\n}\nexport class DurationTimerComponent extends Component<Props, State> {\n static defaultProps = {\n receivedTime: 0,\n };\n\n public requestId: number | null = null;\n constructor(props: Props) {\n super(props);\n\n this.state = {\n duration: 0,\n };\n }\n\n componentDidMount() {\n this.updateState();\n }\n\n componentWillUnmount() {\n this.stop();\n }\n\n componentDidUpdate() {\n this.updateState();\n }\n\n updateState() {\n const {\n startTime,\n } = this.props;\n\n if (startTime) {\n if (this.requestId === null) {\n this.start();\n }\n } else if (this.requestId !== null) {\n this.stop();\n }\n }\n\n start() {\n let lastCallTimestamp: number | null = null;\n\n const step = timestamp => {\n if (lastCallTimestamp === null || timestamp - lastCallTimestamp > UPDATE_EVERY_MS) {\n lastCallTimestamp = timestamp;\n this.tick();\n }\n\n this.requestId = requestAnimationFrame(step);\n };\n\n this.requestId = requestAnimationFrame(step);\n }\n\n stop() {\n if (!isNil(this.requestId)) {\n cancelAnimationFrame(this.requestId);\n this.requestId = null;\n }\n }\n\n tick() {\n this.setState({duration: this.calculateDuration()});\n }\n\n calculateDuration() {\n const {\n startTime,\n receivedTime,\n } = this.props;\n\n let seconds = Math.floor(moment().unix() - startTime + receivedTime);\n\n if (seconds < 0) {\n seconds = 0;\n }\n\n return seconds;\n }\n\n render() {\n const {\n className,\n startTime,\n receivedTime,\n ...elementProps\n } = this.props;\n const {\n duration,\n } = this.state;\n\n const value = startTime === null ? 0 : duration;\n\n return (\n <Duration\n className={classNames('duration-timer', className)}\n // rework fix !-operator\n value={value}\n {...elementProps}\n />\n );\n }\n}\n","import React from 'react';\nimport classNames from 'classnames';\nimport {Duration} from 'app/components/sharedReactComponents/DurationTimer/Duration';\nimport {DurationTimerComponent} from 'app/components/sharedReactComponents/DurationTimer/DurationTimerComponent';\nimport {ClassName} from 'app/types/common';\n\ninterface Props extends ClassName {\n startTime?: number;\n receivedTime?: number;\n paused?: boolean;\n}\n\nexport const DurationTimer: React.FC<Props> = ({\n className,\n startTime = 0,\n receivedTime = 0,\n paused,\n ...elementProps\n}) => {\n if (paused) {\n return (\n <Duration\n className={classNames('duration-timer', 'duration-timer--paused', className)}\n value={receivedTime}\n {...elementProps}\n />\n );\n }\n\n return (\n <DurationTimerComponent\n className={classNames('duration-timer', className)}\n startTime={startTime}\n receivedTime={receivedTime}\n {...elementProps}\n />\n );\n};\n","import React, {Fragment, useCallback} from 'react';\nimport classNames from 'classnames';\nimport {DEVICE_START_STOP_BUTTON_STATUS} from 'app/components/sharedReactComponents/ActionButtons/StartStopButton/constants';\nimport {DurationTimer} from 'app/components/sharedReactComponents/DurationTimer';\nimport {Icons} from 'app/util/icons';\nimport {SIZE} from 'app/constants';\nimport {ProgressButton} from 'app/components/sharedReactComponents/ProgressButton';\nimport {Callback, ClassName} from 'app/types/common';\n\nconst StopLabel: React.FC<{stopLabel: string}> = ({stopLabel}) => {\n return (\n <span className=\"device-start-stop-button__stop\">\n {Icons.stop().size(SIZE.S).reactComponent()}\n\n {stopLabel}\n </span>\n );\n};\n\ninterface Props extends ClassName {\n status?: DEVICE_START_STOP_BUTTON_STATUS;\n icon: React.ReactNode;\n stoppedLabel?: string;\n startedLabel?: string;\n errorLabel?: string;\n pausedLabel?: string;\n loadingLabel: string;\n stopLabel: string;\n stopLoadingLabel: string;\n startTime?: number;\n receivedTime?: number;\n size?: SIZE;\n disabled?: boolean;\n hovered?: boolean;\n loading?: boolean;\n unsetLoadingAfterPromise?: boolean;\n startAction: Callback;\n resumeAction?: Callback;\n stopAction: Callback;\n}\n\nexport function StartStopButton({\n className,\n status = DEVICE_START_STOP_BUTTON_STATUS.STOPPED,\n icon,\n stoppedLabel,\n startedLabel,\n pausedLabel,\n errorLabel,\n loadingLabel,\n stopLabel,\n stopLoadingLabel,\n startTime,\n receivedTime,\n size,\n disabled,\n hovered,\n loading,\n unsetLoadingAfterPromise,\n startAction,\n resumeAction,\n stopAction,\n ...elementProps\n}: Props) {\n const handleClick = useCallback(() => {\n switch (status) {\n case DEVICE_START_STOP_BUTTON_STATUS.STOPPED:\n return startAction();\n case DEVICE_START_STOP_BUTTON_STATUS.PAUSED:\n return resumeAction?.();\n case DEVICE_START_STOP_BUTTON_STATUS.LOADING:\n case DEVICE_START_STOP_BUTTON_STATUS.STARTED:\n case DEVICE_START_STOP_BUTTON_STATUS.ERROR:\n default:\n return stopAction();\n }\n }, [status, startAction, resumeAction, stopAction]);\n\n return (\n <ProgressButton\n className={classNames(\n 'device-start-stop-button',\n {\n [`device-start-stop-button--${status}`]: Boolean(status),\n 'device-start-stop-button--hovered': hovered === true,\n },\n size && `device-start-stop-button--size-${size}`,\n className,\n )}\n size={size}\n disabled={disabled}\n loading={loading}\n unsetLoadingAfterPromise={unsetLoadingAfterPromise}\n onClick={handleClick}\n {...elementProps}\n >\n {icon}\n\n {status === DEVICE_START_STOP_BUTTON_STATUS.STOPPED && stoppedLabel}\n\n {status === DEVICE_START_STOP_BUTTON_STATUS.LOADING && (\n <Fragment>\n {loadingLabel}\n\n <StopLabel stopLabel={stopLoadingLabel} />\n </Fragment>\n )}\n\n {status === DEVICE_START_STOP_BUTTON_STATUS.STARTED && (\n <Fragment>\n {startedLabel}\n\n <DurationTimer\n className=\"device-start-stop-button__duration\"\n startTime={startTime}\n receivedTime={receivedTime}\n />\n\n <StopLabel stopLabel={stopLabel} />\n </Fragment>\n )}\n\n {status === DEVICE_START_STOP_BUTTON_STATUS.ERROR && (\n <Fragment>\n {errorLabel}\n <StopLabel stopLabel={stopLabel} />\n </Fragment>\n )}\n\n {status === DEVICE_START_STOP_BUTTON_STATUS.PAUSED && pausedLabel}\n </ProgressButton>\n );\n}\n","import React from 'react';\nimport classNames from 'classnames';\nimport {SIZE} from 'app/constants';\nimport {Icons} from 'app/util/icons';\nimport {StartStopButton} from 'app/components/sharedReactComponents/ActionButtons/StartStopButton';\nimport {DEVICE_START_STOP_BUTTON_STATUS} from 'app/components/sharedReactComponents/ActionButtons/StartStopButton/constants';\nimport {\n Callback,\n ClassName,\n} from 'app/types/common';\n\ninterface Props extends ClassName {\n status: DEVICE_START_STOP_BUTTON_STATUS;\n startTime?: number;\n size?: SIZE;\n disabled: boolean;\n hovered?: boolean;\n loading: boolean;\n startAction: Callback;\n stopAction: Callback;\n hasEvent?: boolean;\n}\n\nexport const RecordingStartStopButton: React.FC<Props> = ({\n className,\n status,\n startTime,\n size,\n disabled,\n hovered,\n loading,\n startAction,\n stopAction,\n hasEvent,\n}: Props) => {\n const icon = hasEvent && status === DEVICE_START_STOP_BUTTON_STATUS.STARTED ?\n Icons.recordEvent() :\n Icons.record();\n\n return (\n <StartStopButton\n className={classNames('recording-start-stop-button', className)}\n data-id=\"recording_start_stop_button\"\n status={status}\n icon={icon.size(SIZE.S).reactComponent()}\n stoppedLabel=\"Start recording\"\n startedLabel=\"Recording\"\n loadingLabel=\"Starting...\"\n stopLoadingLabel=\"Stop recording\"\n stopLabel=\"Stop recording\"\n startTime={startTime}\n size={size}\n disabled={disabled}\n hovered={hovered}\n loading={loading}\n startAction={startAction}\n stopAction={stopAction}\n unsetLoadingAfterPromise={false}\n />\n );\n};\n","import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react';\nimport {RecordingStartStopButton} from 'app/components/sharedReactComponents/ActionButtons/StartStopButton/RecordingStartStopButton';\nimport {DEVICE_START_STOP_BUTTON_STATUS} from 'app/components/sharedReactComponents/ActionButtons/StartStopButton/constants';\nimport {SIZE} from 'app/constants';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\n\nconst getButtonStatus = (device: AnyDeviceModelType) =>\n device.isRecording()\n ? DEVICE_START_STOP_BUTTON_STATUS.STARTED\n : DEVICE_START_STOP_BUTTON_STATUS.STOPPED;\n\ninterface Props {\n device: AnyDeviceModelType;\n size?: SIZE;\n hasEvent?: boolean;\n}\n\nexport const RecordingButton: React.FC<Props> = ({device, hasEvent = false, size}: Props) => {\n const [loading, setLoading] = useState(false);\n const fetching = useRef<boolean>(false);\n\n useEffect(() => {\n if (!fetching.current) {\n setLoading(false);\n }\n }, [device]);\n\n const action = useCallback(async () => {\n try {\n fetching.current = true;\n setLoading(true);\n await device.startStopRecordingCommand();\n } catch {\n setLoading(false);\n } finally {\n fetching.current = false;\n }\n }, [device]);\n\n const status = useMemo(() => getButtonStatus(device), [device]);\n\n return (\n <RecordingStartStopButton\n status={status}\n startTime={device.getDeviceRecordingStartTime() ?? undefined}\n size={size}\n startAction={action}\n stopAction={action}\n disabled={device.isOffline()}\n loading={loading}\n hasEvent={hasEvent}\n />\n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport {SIZE} from 'app/constants';\nimport {Icons} from 'app/util/icons';\nimport {StartStopButton} from 'app/components/sharedReactComponents/ActionButtons/StartStopButton';\nimport {DEVICE_START_STOP_BUTTON_STATUS} from 'app/components/sharedReactComponents/ActionButtons/StartStopButton/constants';\nimport {Callback, ClassName} from 'app/types/common';\n\ninterface Props extends ClassName {\n status: DEVICE_START_STOP_BUTTON_STATUS;\n startTime: number;\n receivedTime: number;\n size?: SIZE;\n disabled?: boolean;\n hovered?: boolean;\n startAction: Callback;\n resumeAction: Callback;\n stopAction: Callback;\n}\n\nexport const TranscribingStartStopButton: React.FC<Props> = ({\n className,\n status,\n startTime,\n receivedTime,\n size,\n disabled,\n hovered,\n startAction,\n resumeAction,\n stopAction,\n}) => {\n return (\n <StartStopButton\n data-id=\"transcribing-btn\"\n className={classNames('transcribing-start-stop-button', className)}\n status={status}\n icon={Icons.liveScrypt().size(SIZE.S).reactComponent()}\n stoppedLabel=\"Start transcribing\"\n startedLabel=\"Transcribing\"\n pausedLabel=\"Resume transcribing\"\n loadingLabel=\"Starting...\"\n stopLoadingLabel=\"Stop transcribing\"\n stopLabel=\"Stop transcribing\"\n startTime={startTime}\n receivedTime={receivedTime}\n size={size}\n disabled={disabled}\n hovered={hovered}\n startAction={startAction}\n resumeAction={resumeAction}\n stopAction={stopAction}\n />\n );\n};\n","import React, {useCallback, useEffect, useState} from 'react';\nimport {TranscribingStartStopButton} from 'app/components/sharedReactComponents/ActionButtons/StartStopButton/TranscribingStartStopButton';\nimport {DEVICE_START_STOP_BUTTON_STATUS} from 'app/components/sharedReactComponents/ActionButtons/StartStopButton/constants';\nimport {useDeviceTranscriptionTime} from 'app/components/sharedReactComponents/TranscribeDuration/useDeviceTranscriptionTime';\nimport {TranscribingStatus} from 'app/components/DeviceDetails/constants';\n\nfunction getButtonStatusByTranscribeStatus(transcribeStatus: TranscribingStatus): DEVICE_START_STOP_BUTTON_STATUS {\n switch (transcribeStatus) {\n case TranscribingStatus.Started:\n return DEVICE_START_STOP_BUTTON_STATUS.STARTED;\n case TranscribingStatus.Paused:\n return DEVICE_START_STOP_BUTTON_STATUS.PAUSED;\n case TranscribingStatus.Stopped:\n default:\n return DEVICE_START_STOP_BUTTON_STATUS.STOPPED;\n }\n}\n\ninterface Props {\n device: any;\n}\n\nexport const TranscribingButton: React.FC<Props> = ({\n device,\n}) => {\n const [buttonStatus, setButtonStatus] = useState(DEVICE_START_STOP_BUTTON_STATUS.STOPPED);\n\n useEffect(() => {\n const buttonStatus = getButtonStatusByTranscribeStatus(device.getTranscribingStatus());\n setButtonStatus(buttonStatus);\n }, [device]);\n\n const transcribingInfo = device.getTranscribingInfo();\n\n const {\n startTime,\n receivedTime,\n } = useDeviceTranscriptionTime({\n deviceId: device.getId(),\n sessionId: transcribingInfo.sessionId,\n status: transcribingInfo.status,\n });\n\n const startStopAction = useCallback(() => {\n const status = device.getTranscribingStatus();\n\n if (status === TranscribingStatus.Started) {\n return device.stopTranscribing();\n }\n\n setButtonStatus(DEVICE_START_STOP_BUTTON_STATUS.LOADING);\n\n if (status === TranscribingStatus.Paused) {\n return device.resumeTranscribing();\n }\n\n return device.startTranscribing();\n }, [device]);\n\n return (\n <TranscribingStartStopButton\n status={buttonStatus}\n startTime={startTime}\n receivedTime={receivedTime}\n startAction={startStopAction}\n resumeAction={startStopAction}\n stopAction={startStopAction}\n />\n );\n};\n","import {useEffect, useState} from 'react';\nimport {front} from 'app/api/CirrusApi';\nimport {TranscribingStatus} from 'app/components/DeviceDetails/constants';\nimport {noop} from 'app/util/noop';\nimport {AbortCallback} from 'app/api/types';\n\nexport function useDeviceTranscriptionTime({\n deviceId,\n sessionId,\n status,\n}) {\n // rework typing\n const [startTime, setStartTime] = useState<any>(null);\n const [receivedTime, setReceivedTime] = useState(0);\n\n useEffect(() => {\n if (status === TranscribingStatus.Stopped) {\n setStartTime(null);\n setReceivedTime(0);\n\n return;\n }\n\n let abortRequest: AbortCallback = noop;\n\n front.transcribing(deviceId).sessions(sessionId).get(undefined, {getAbort: abort => abortRequest = abort})\n .then(response => {\n const {data} = response;\n\n if (!data) {\n setStartTime(null);\n setReceivedTime(0);\n\n return;\n }\n\n const secondsReceived = data.received.seconds || 0;\n\n if (status === TranscribingStatus.Paused) {\n setStartTime(null);\n } else {\n const currentTime = Date.now() / 1000;\n const responseTime = data.current_ts;\n const timeCorrection = currentTime - responseTime;\n setStartTime(currentTime + timeCorrection);\n }\n\n setReceivedTime(secondsReceived);\n });\n\n return () => abortRequest();\n }, [status, deviceId, sessionId]);\n\n return {\n startTime,\n receivedTime,\n };\n}\n","import React, {forwardRef, Fragment, memo} from 'react';\nimport classNames from 'classnames';\nimport {DropdownSelectButton} from 'app/components/sharedReactComponents/DropdownSelect/DropdownSelectButton';\nimport {pluralizeN} from 'app/components/helpers/commonHelpers';\nimport {Icons} from 'app/util/icons';\n\ninterface Props {\n count: number;\n offline: boolean;\n opened?: boolean;\n failed: boolean;\n started: boolean;\n}\n\nexport const StreamingDestinationsSelectorButton: React.FC<Props> = memo(forwardRef(({\n count,\n offline,\n opened,\n failed,\n started,\n}, ref) => {\n return (\n <DropdownSelectButton\n ref={ref}\n className={classNames('streaming-destinations-selector-button', {\n 'streaming-destinations-selector-button--offline': offline,\n 'streaming-destinations-selector-button--started': started,\n })}\n opened={opened}\n data-id=\"streaming_destinations_selector_button\"\n >\n {count === 0 ? (\n <span className=\"streaming-destinations-selector-button__placeholder-text\">\n Streaming destination\n </span>\n ) : (\n <Fragment>\n {failed && (\n <div className=\"streaming-destinations-selector-button__error-icon\">\n {Icons.warning().reactComponent()}\n </div>\n )}\n\n <span className=\"streaming-destinations-selector-button__count\">\n {count}\n </span>\n\n <span className=\"streaming-destinations-selector-button__selected-text\">\n {pluralizeN('Streaming destination', count)}\n </span>\n </Fragment>\n )}\n </DropdownSelectButton>\n );\n}));\n\nStreamingDestinationsSelectorButton.displayName = 'StreamingDestinationsSelectorButton';\n","import React from 'react';\nimport {SelectMenuOption, SelectMenuOptionProps} from 'app/components/sharedReactComponents/SelectMenuOption';\nimport {useRadioGroup} from 'app/components/sharedReactComponents/RadioGroup/useRadioGroup';\nimport {Radio, RADIO_THEME} from 'app/components/sharedReactComponents/Radio';\nimport {SIZE} from 'app/constants';\nimport {isNil} from 'app/util/isNil';\nimport {stopPropagation} from 'app/util/stopPropagation';\n\ninterface Props extends SelectMenuOptionProps {\n value: string | number | boolean;\n uncheckable?: boolean;\n}\n\nexport const SelectMenuOptionWithRadio: React.FC<Props> = ({\n name: nameProp,\n value,\n active,\n uncheckable: uncheckableProp,\n disabled,\n onClick,\n children,\n ...restProps\n}) => {\n const radioGroup = useRadioGroup();\n\n let name = nameProp;\n let uncheckable = uncheckableProp;\n let checked = active;\n\n if (radioGroup) {\n if (isNil(checked)) {\n checked = radioGroup.value === value;\n }\n\n if (isNil(uncheckable)) {\n uncheckable = radioGroup.uncheckable;\n }\n\n if (isNil(name)) {\n name = radioGroup.name;\n }\n }\n\n const changeAction = () => {\n if (typeof onClick === 'function') {\n onClick({\n target: {\n name,\n value: checked ? undefined : value,\n },\n });\n }\n\n if (radioGroup?.onChange) {\n radioGroup.onChange({\n target: {\n name,\n value: checked ? undefined : value,\n },\n });\n }\n };\n\n const handleRadioClick = (e) => {\n stopPropagation(e);\n\n if (!radioGroup && typeof onClick === 'function') {\n onClick({\n target: {\n name,\n value: checked ? undefined : value,\n },\n });\n }\n };\n\n return (\n <SelectMenuOption\n {...restProps}\n controlComponent={(\n <Radio\n name={name}\n value={value as string}\n theme={RADIO_THEME.BLACK}\n size={SIZE.S}\n checked={active}\n focusable={false}\n uncheckable={uncheckable}\n disabled={disabled}\n onClick={handleRadioClick}\n // onChange={changeAction}\n />\n )}\n disabled={disabled}\n onClick={changeAction}\n >\n {children}\n </SelectMenuOption>\n );\n};\n","import {Icons} from 'app/util/icons';\nimport {STREAMING_SERVICE_TYPE} from 'app/components/StreamingServices/constants';\n\nexport const StreamingServiceIcon = {\n /**\n * @param {STREAMING_SERVICE_TYPE} type\n * @return {SvgIcon}\n */\n getIconByType(type) {\n switch (type) {\n case STREAMING_SERVICE_TYPE.FACEBOOK:\n return Icons.facebookStreamingService();\n case STREAMING_SERVICE_TYPE.YOUTUBE:\n return Icons.youtubeStreamingService();\n case STREAMING_SERVICE_TYPE.TWITCH:\n return Icons.twitchStreamingService();\n case STREAMING_SERVICE_TYPE.RTMP:\n case STREAMING_SERVICE_TYPE.RTMPS:\n default:\n return Icons.rtmpStreamingService();\n }\n },\n\n /**\n * @param {STREAMING_SERVICE_TYPE} type\n * @return {SvgIcon}\n */\n getSmallIconByType(type) {\n switch (type) {\n case STREAMING_SERVICE_TYPE.FACEBOOK:\n return Icons.facebookStreamingServiceSmall()\n .class('streaming-service-icon streaming-service-icon--facebook');\n case STREAMING_SERVICE_TYPE.YOUTUBE:\n return Icons.youtubeStreamingServiceSmall()\n .class('streaming-service-icon streaming-service-icon--youtube');\n case STREAMING_SERVICE_TYPE.TWITCH:\n return Icons.twitchStreamingServiceSmall()\n .class('streaming-service-icon streaming-service-icon--twitch');\n case STREAMING_SERVICE_TYPE.RTMP:\n case STREAMING_SERVICE_TYPE.RTMPS:\n default:\n return Icons.rtmpStreamingServiceSmall()\n .class('streaming-service-icon streaming-service-icon--rtmp');\n }\n },\n};\n","import React, {Fragment} from 'react';\nimport classNames from 'classnames';\nimport {router} from 'app/router/main';\nimport {stopPropagation} from 'app/util/stopPropagation';\nimport {OverflowTooltip} from 'app/components/sharedReactComponents/OverflowTooltip/OverflowTooltip';\nimport {ClassName} from 'app/types/common';\nimport {ModelService} from 'app/services/deviceModel/DeviceModelService';\n\ninterface Props extends ClassName {\n currentDevice: any;\n usedByDevice: any;\n}\n\nexport const AlreadyUsedByDevice: React.FC<Props> = ({className, currentDevice, usedByDevice}) => {\n // rework typing\n let device: any = null;\n let channelDevice: any = null;\n let sameParent = false;\n\n if (usedByDevice) {\n const deviceModel = usedByDevice;\n device = {\n id: deviceModel.getId(),\n name: deviceModel.getName(),\n };\n\n if (ModelService.isChannel(deviceModel.getModelName())) {\n const masterDeviceId = deviceModel.getChannelDeviceMasterDeviceId();\n channelDevice = {...device};\n device = {\n id: masterDeviceId,\n name: deviceModel.getChannelDeviceMasterDeviceName(),\n };\n\n if (\n ModelService.isChannel(currentDevice.getModelName()) &&\n currentDevice.getChannelDeviceMasterDeviceId() === masterDeviceId\n ) {\n sameParent = true;\n }\n }\n }\n\n const showDevice = device !== null && sameParent === false;\n\n return (\n <span className={classNames('already-used-by-device', className)}>\n {showDevice && (\n <Fragment>\n Device:{' '}\n <a href={router.url('deviceDetails', {deviceId: device.id})} onClick={stopPropagation}>\n <OverflowTooltip>{device.name}</OverflowTooltip>\n </a>\n </Fragment>\n )}\n\n {showDevice && channelDevice && <Fragment>, </Fragment>}\n\n {channelDevice && (\n <Fragment>\n Channel:{' '}\n <a\n href={router.url('deviceDetails', {deviceId: channelDevice.id})}\n onClick={stopPropagation}\n >\n <OverflowTooltip>{channelDevice.name}</OverflowTooltip>\n </a>\n </Fragment>\n )}\n </span>\n );\n};\n","import React, {Fragment} from 'react';\nimport classNames from 'classnames';\nimport {Icons} from 'app/util/icons';\nimport {SIZE} from 'app/constants';\nimport {AlreadyUsedByDevice} from 'app/components/sharedReactComponents/ActionButtons/StreamingDestinationsSelector/AlreadyUsedByDevice';\nimport {ClassName} from 'app/types/common';\n\ninterface Props extends ClassName {\n currentDevice: any;\n device: any;\n}\n\nexport const StreamingFromDeviceNote: React.FC<Props> = ({\n className,\n currentDevice,\n device,\n}) => {\n return (\n <span\n className={classNames('streaming-from-device-note', className)}\n data-id=\"streaming_from_device_note\"\n >\n {Icons.streaming().size(SIZE.S).reactComponent()}\n\n <span className=\"streaming-from-device-note__label\">\n Streaming\n\n {device && (\n <Fragment> from </Fragment>\n )}\n\n {device && (\n <AlreadyUsedByDevice\n currentDevice={currentDevice}\n usedByDevice={device}\n />\n )}\n </span>\n </span>\n );\n};\n","import React, {Fragment} from 'react';\nimport classNames from 'classnames';\nimport {AlreadyUsedByDevice} from 'app/components/sharedReactComponents/ActionButtons/StreamingDestinationsSelector/AlreadyUsedByDevice';\nimport {ClassName} from 'app/types/common';\n\n// rework any\ninterface Props extends ClassName {\n currentDevice: any;\n device: any;\n}\n\nexport const AlreadySelectedOnDeviceNote: React.FC<Props> = ({\n className,\n currentDevice,\n device,\n}) => {\n return (\n <div\n className={classNames('already-selected-on-device-note', className)}\n data-id=\"streaming_destination_already_selected_on\"\n >\n {'Already selected on '}\n\n {device ? (\n <AlreadyUsedByDevice\n currentDevice={currentDevice}\n usedByDevice={device}\n />\n ) : (\n <Fragment> another device</Fragment>\n )}\n </div>\n );\n};\n","import React, {Fragment} from 'react';\nimport {Stack, Typography} from '@mui/material';\nimport WarningIcon from '@mui/icons-material/Warning';\nimport {SelectMenuOptionWithRadio} from 'app/components/sharedReactComponents/SelectMenuOption/SelectMenuOptionWithRadio';\nimport {StreamingServiceIcon} from 'app/components/StreamingServices/StreamingServiceIcon';\nimport {Button} from 'app/components/sharedReactComponents/Button';\nimport {VARIANT, SIZE} from 'app/constants';\nimport {router} from 'app/router/main';\nimport {Icons} from 'app/util/icons';\nimport {StreamingFromDeviceNote} from 'app/components/sharedReactComponents/ActionButtons/StreamingDestinationsSelector/StreamingFromDeviceNote';\nimport {AlreadySelectedOnDeviceNote} from 'app/components/sharedReactComponents/ActionButtons/StreamingDestinationsSelector/AlreadySelectedOnDeviceNote';\nimport {stopPropagation} from 'app/util/stopPropagation';\nimport {OverflowTooltip} from 'app/components/sharedReactComponents/OverflowTooltip/OverflowTooltip';\nimport {TooltipMultipleMessages} from 'app/components/sharedReactComponents/Tooltip/TooltipMultipleMessages';\nimport {noop} from 'app/util/noop';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {AnyStreamingDestinationModelType} from 'app/components/StreamingServices/types';\nimport {DeviceWarning} from 'app/components/DeviceDetails/Models/types';\n\ninterface Props {\n streamingDestination: AnyStreamingDestinationModelType;\n isUnify: boolean;\n device: AnyDeviceModelType;\n warnings: DeviceWarning[];\n disabled: boolean;\n editable: boolean;\n getDeviceById: (id: string) => AnyDeviceModelType | undefined;\n}\n\nexport function StreamingDestinationsSelectorMenuItem({\n streamingDestination,\n isUnify,\n device,\n warnings,\n disabled,\n editable,\n getDeviceById,\n}: Props) {\n const streaming = streamingDestination.isStreaming();\n const selectedOnDeviceId = streamingDestination.getSelectedOnDeviceId();\n const availableOnThisDevice = device.checkStreamingDestinationAvailableToUse(\n streamingDestination.getType(),\n );\n const id = streamingDestination.getId() as string;\n\n const hasWarnings = warnings.length > 0;\n\n return (\n <SelectMenuOptionWithRadio\n // rework onClick is requred\n className=\"streaming-destinations-selector-menu-item\"\n icon={StreamingServiceIcon.getSmallIconByType(\n streamingDestination.getType(),\n ).reactComponent()}\n name={id}\n value={id}\n disabled={availableOnThisDevice === false || disabled || streaming}\n disabledReasonMessage={\n availableOnThisDevice === false ? `Unavailable for ${device.getModelName()} devices` : ''\n }\n onClick={noop}\n >\n <div className=\"streaming-destinations-selector-menu-item__label\">\n <div className=\"streaming-destinations-selector-menu-item__name\">\n <Stack direction=\"row\" alignItems=\"flex-start\" gap={1}>\n <Typography component=\"span\" sx={hasWarnings ? {color: 'error.main'} : {}}>\n <OverflowTooltip rowsNumber={2} async={true}>\n {streamingDestination.getName()}\n </OverflowTooltip>\n </Typography>\n\n {hasWarnings && (\n <TooltipMultipleMessages messages={warnings}>\n <WarningIcon color=\"error\" />\n </TooltipMultipleMessages>\n )}\n </Stack>\n\n {disabled !== true && (\n <Fragment>\n {streaming ? (\n <StreamingFromDeviceNote\n className=\"streaming-destinations-selector-menu-item__streaming-from\"\n currentDevice={device}\n device={getDeviceById(streamingDestination.getStreamingDeviceId())}\n />\n ) : (\n <Fragment>\n {selectedOnDeviceId && selectedOnDeviceId !== device.getId() && (\n <AlreadySelectedOnDeviceNote\n className=\"streaming-destinations-selector-menu-item__selected-on\"\n currentDevice={device}\n device={getDeviceById(selectedOnDeviceId)}\n />\n )}\n </Fragment>\n )}\n </Fragment>\n )}\n </div>\n\n {disabled !== true && editable && (\n <Button\n className=\"streaming-destinations-selector-menu-item__edit\"\n title=\"Edit Destination\"\n variant={VARIANT.TEXT}\n size={SIZE.S}\n onClick={(e) => {\n stopPropagation(e);\n router.go(\n isUnify ? 'projectDetails' : 'deviceDetails',\n {deviceId: device.getId()},\n {activeTab: 'channels', scrollTo: `streamingDestination=${id}`},\n );\n }}\n >\n {Icons.edit().size(SIZE.S).reactComponent()}\n </Button>\n )}\n </div>\n </SelectMenuOptionWithRadio>\n );\n}\n","import React, {useState} from 'react';\nimport {Checkbox, CHECKBOX_THEME} from 'app/components/sharedReactComponents/Checkbox';\nimport {SIZE} from 'app/constants';\nimport {stopPropagation} from 'app/util/stopPropagation';\nimport {\n SelectMenuOption,\n SelectMenuOptionProps,\n} from 'app/components/sharedReactComponents/SelectMenuOption';\nimport {isPromise} from 'app/util/isPromise';\nimport {useIsMounted} from 'app/hooks/useIsMounted';\n\nexport function SelectMenuOptionWithCheckbox({\n name,\n active,\n disabled,\n onClick,\n children,\n ...restProps\n}: SelectMenuOptionProps) {\n const [loading, setLoading] = useState(false);\n const mountedRef = useIsMounted();\n\n const changeAction = () => {\n if (!onClick) {\n return;\n }\n\n const callback = onClick({\n target: {\n name,\n value: !active,\n },\n });\n\n if (isPromise(callback)) {\n setLoading(true);\n\n callback.finally(() => {\n if (mountedRef.current) {\n setLoading(false);\n }\n });\n }\n };\n\n return (\n <SelectMenuOption\n {...restProps}\n controlComponent={\n <Checkbox\n name={name}\n value={active}\n theme={CHECKBOX_THEME.BLACK}\n size={SIZE.S}\n focusable={false}\n loading={loading}\n disabled={disabled}\n onClick={stopPropagation}\n onChange={changeAction}\n />\n }\n disabled={disabled}\n onClick={changeAction}\n >\n {children}\n </SelectMenuOption>\n );\n}\n","import React from 'react';\nimport {Stack, StackProps} from '@mui/material';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {DataId} from 'app/types/common';\n\nexport const LegacyIcon = React.forwardRef<any, StackProps & DataId>(\n ({sx, dataId, ...props}, ref) => {\n return (\n <Stack\n data-id={dataId}\n ref={ref}\n direction=\"row\"\n justifyContent=\"center\"\n alignItems=\"center\"\n sx={packSx(\n {\n '& > .svg-icon': {\n width: '1em',\n height: '1em',\n },\n },\n sx,\n )}\n {...props}\n />\n );\n },\n);\n","import React from 'react';\nimport {Stack, Typography} from '@mui/material';\nimport {grey} from '@mui/material/colors';\nimport {Icons} from 'app/util/icons';\nimport {SIZE} from 'app/constants';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\nimport {Sx} from 'app/types/common';\nimport {LegacyIcon} from 'app/components/sharedReactComponents/LegacyIcon/LegacyIcon';\n\nconst tooltip =\n 'Streams created using Epiphan Cloud appear here and are available to all paired encoders. These common streams can only be started one at a time.';\n\ninterface Props extends Sx {}\n\nexport function StreamingDestinationListTitle({sx}: Props) {\n return (\n <Stack sx={sx} direction=\"row\" alignItems=\"center\" gap={1} color={grey[600]}>\n <Typography fontWeight=\"bold\" fontSize={12}>\n Epiphan Cloud - Common streaming destinations\n </Typography>\n\n <Tooltip content={tooltip}>\n <LegacyIcon>{Icons.helpCircle().size(SIZE.S).reactComponent()}</LegacyIcon>\n </Tooltip>\n </Stack>\n );\n}\n","import React, {forwardRef} from 'react';\nimport classNames from 'classnames';\nimport {ClassName} from 'app/types/common';\n\ninterface Props extends ClassName {\n disabled: boolean;\n selected: boolean;\n children: React.ReactNode;\n}\n\nexport const ListItem = forwardRef<HTMLDivElement, Props>(({\n className,\n disabled,\n selected,\n children,\n}, ref) => (\n <div\n ref={ref}\n className={classNames('device-streaming-destination-list-item', {\n 'device-streaming-destination-list-item--selected': selected,\n 'device-streaming-destination-list-item--disabled': disabled,\n }, className)}\n data-id=\"streaming_destination_list_item\"\n >\n {children}\n </div>\n));\n\nListItem.displayName = 'ListItem';\n","import React from 'react';\nimport {Checkbox, CHECKBOX_THEME} from 'app/components/sharedReactComponents/Checkbox';\nimport {SIZE} from 'app/constants';\nimport {Radio, RADIO_THEME} from 'app/components/sharedReactComponents/Radio';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\nimport {Callback} from 'app/types/common';\n\nexport enum COMMON_STREAM_SELECT_INPUT_TYPE {\n CHECKBOX = 'checkbox',\n RADIO = 'radio',\n}\n\ninterface Props {\n id: string;\n type: COMMON_STREAM_SELECT_INPUT_TYPE;\n disabled: boolean;\n disabledReasonMessage?: string;\n selected: boolean;\n started: boolean;\n loading: boolean;\n onSelect: Callback;\n}\nexport const SelectInput: React.VFC<Props> = ({\n id,\n type,\n disabled,\n disabledReasonMessage,\n selected,\n started,\n loading,\n onSelect,\n}) => {\n const selectionDisabled = disabled || started;\n\n return (\n <Tooltip content={(disabled && disabledReasonMessage) || undefined}>\n <div className=\"device-streaming-destination-list-item__input\">\n {type === COMMON_STREAM_SELECT_INPUT_TYPE.CHECKBOX && (\n <Checkbox\n data-id=\"streaming_destination_select_input\"\n name={id}\n value={selected}\n disabled={selectionDisabled}\n loading={loading}\n size={SIZE.S}\n theme={CHECKBOX_THEME.BLACK}\n onChange={onSelect}\n />\n )}\n\n {type === COMMON_STREAM_SELECT_INPUT_TYPE.RADIO && (\n <Radio\n dataId=\"streaming_destination_select_input\"\n name={id}\n value={id}\n checked={selected}\n disabled={selectionDisabled}\n loading={loading}\n uncheckable={true}\n size={SIZE.S}\n theme={RADIO_THEME.BLACK}\n onChange={onSelect}\n />\n )}\n </div>\n </Tooltip>\n );\n};\n","/* eslint-disable */\nimport React, {Component, createRef} from 'react';\nimport classNames from 'classnames';\nimport {FormControl} from 'app/components/sharedReactComponents/FormControl';\nimport {FORM_CONTROL_TYPE} from 'app/components/sharedReactComponents/FormControl/constants';\nimport {KeyboardCode, SIZE, THEME} from 'app/constants';\nimport {Icons} from 'app/util/icons';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\nimport {OverflowTooltip} from 'app/components/sharedReactComponents/OverflowTooltip/OverflowTooltip';\nimport {Callback, ClassName, DataId} from 'app/types/common';\n\nexport enum EDITABLE_NAME_TEXT_THEME {\n DEFAULT = 'default',\n DASHBOARD = 'dashboard',\n}\n\nexport type EDITABLE_NAME_TEXT_TYPE = FORM_CONTROL_TYPE.TEXT | FORM_CONTROL_TYPE.TEXTAREA;\n\ninterface Props extends ClassName, DataId {\n value: string;\n name?: string;\n ariaLabel?: string;\n placeholder?: string;\n validators: any[];\n disabled?: boolean;\n type: EDITABLE_NAME_TEXT_TYPE;\n theme: EDITABLE_NAME_TEXT_THEME;\n onChange?: Callback;\n}\n\ninterface State {\n editing: boolean;\n value: string;\n valid: boolean;\n errorMessage: any;\n}\n// rework all any\nexport class EditableNameText extends Component<Props, State> {\n static defaultProps = {\n validators: [],\n theme: EDITABLE_NAME_TEXT_THEME.DEFAULT,\n type: FORM_CONTROL_TYPE.TEXT,\n };\n\n _saveFailed = false;\n inputRef = createRef<any>();\n divRef = createRef<any>();\n\n constructor(props) {\n super(props);\n\n this.state = {\n editing: false,\n value: props.value,\n valid: true,\n errorMessage: null,\n };\n }\n\n componentDidUpdate(prevProps) {\n const {value} = this.props;\n\n if (value !== prevProps.value) {\n this.setState({\n value,\n valid: true,\n errorMessage: null,\n });\n }\n }\n\n /*\n * Validate onChange if last save failed\n * Validate onSave everything\n */\n validate(force?: any) {\n if (!force && !this._saveFailed) {\n return;\n }\n\n const {valid, errorMessage} = this._validate();\n\n this.setState({\n valid,\n errorMessage,\n });\n\n return valid;\n }\n\n _validate() {\n const {validators} = this.props;\n const {value} = this.state;\n\n for (const validator of validators) {\n if (validator.validate(value) === false) {\n return {\n valid: false,\n errorMessage: validator.getErrorMessage(),\n };\n }\n }\n\n return {\n valid: true,\n errorMessage: null,\n };\n }\n\n handleChange = ({target: {value}}) => {\n this.setState(\n {\n value,\n editing: true,\n },\n () => this.validate(),\n );\n };\n\n handleBlur = () => {\n if (this.state.editing) {\n this.save();\n }\n };\n\n handleKeyUp = (e: React.KeyboardEvent) => {\n const {type} = this.props;\n\n if (e.code === KeyboardCode.Enter || e.code === KeyboardCode.NumpadEnter) {\n if (type === FORM_CONTROL_TYPE.TEXTAREA && e.shiftKey) {\n return;\n }\n\n this.save();\n }\n };\n\n handleKeyDown = (e: React.KeyboardEvent) => {\n if (e.code === KeyboardCode.Enter && !e.shiftKey) {\n e.preventDefault();\n }\n };\n\n handleInputKeyUp = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.code === KeyboardCode.Enter) {\n event.preventDefault();\n this.setEditing();\n }\n };\n\n handleClickEdit = () => {\n this.setEditing();\n };\n\n setEditing() {\n if (this.props.disabled) {\n return;\n }\n\n this.setState({editing: true}, () => this.inputRef.current.focus());\n }\n\n save() {\n if (this.validate(true)) {\n this._save();\n\n this._saveFailed = false;\n } else {\n this._saveFailed = true;\n }\n }\n\n _save() {\n const {value} = this.state;\n const {name, value: previousValue, onChange} = this.props;\n\n const trimCurrentValue = value.trim();\n\n if (trimCurrentValue !== previousValue) {\n onChange?.({target: {name, value: trimCurrentValue}});\n }\n\n this.setState(\n {\n value: trimCurrentValue,\n editing: false,\n },\n () => this.divRef.current.focus(),\n );\n }\n\n render() {\n const {dataId, className, ariaLabel, placeholder, disabled, theme, type} = this.props;\n const {editing, value, valid, errorMessage} = this.state;\n\n const multiline = type === FORM_CONTROL_TYPE.TEXTAREA;\n\n return (\n <div\n data-id={dataId}\n className={classNames(\n 'cr-text-input',\n `cr-text-input--theme-${theme}`,\n {\n 'cr-text-input--multiline': multiline,\n 'cr-text-input--single-line': multiline === false,\n 'cr-text-input--invalid': !valid,\n 'cr-text-input--editing': editing,\n 'cr-text-input--enabled': !disabled,\n },\n className,\n )}\n aria-label={ariaLabel}\n >\n <div\n ref={this.divRef}\n className=\"cr-text-input__value-indicator\"\n tabIndex={0}\n onKeyUp={this.handleInputKeyUp}\n onClick={this.handleClickEdit}\n >\n {value ? (\n <div className=\"cr-text-input__value-indicator-value\">\n {multiline ? value : <OverflowTooltip>{value}</OverflowTooltip>}\n </div>\n ) : (\n <div className=\"cr-text-input__placeholder\">{placeholder}</div>\n )}\n\n {!disabled && (\n <Tooltip content=\"Click to edit\">\n {Icons.edit()\n .size(SIZE.S)\n .class('cr-text-input__value-indicator-icon')\n .reactComponent()}\n </Tooltip>\n )}\n </div>\n\n {!disabled && (\n <FormControl\n name=\"editable-text\"\n inputRef={this.inputRef}\n className=\"cr-text-input__input\"\n value={value}\n type={type}\n error={!valid}\n endAdornment={\n errorMessage && (\n <Tooltip content={errorMessage}>\n {Icons.warning().theme(THEME.DANGER).reactComponent()}\n </Tooltip>\n )\n }\n fullWidth={true}\n onChange={this.handleChange}\n onKeyDown={this.handleKeyDown}\n onBlur={this.handleBlur}\n onKeyUp={this.handleKeyUp}\n />\n )}\n </div>\n );\n }\n}\n","import {isNil} from 'app/util/isNil';\nimport {BaseValidatorOptions} from 'app/util/validators/types';\n\nclass BaseValidator {\n protected messageProp: any;\n protected message = '';\n protected type = '';\n\n constructor({\n message,\n }: BaseValidatorOptions = {}) {\n if (isNil(message) === false) {\n this.messageProp = message;\n }\n }\n\n validate(_: any): boolean {\n throw new Error('Not implemented');\n }\n\n getErrorMessage(): string {\n return isNil(this.messageProp) ? this.message : this.messageProp;\n }\n\n getErrorType(): string {\n return this.type;\n }\n}\n\nexport {BaseValidator};\n","import {BaseValidator} from 'app/util/validators/BaseValidator';\n\nconst DISALLOWED_CHARS = [\n '^',\n '<',\n '>',\n '/',\n '\\\\',\n '?',\n '*',\n ':',\n '\"',\n '|',\n];\n\nfunction escapeRegExp(string) {\n /**\n * `$&` means the whole matched string\n * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Escaping}\n */\n return string.replace(/[^\\\\]/g, '\\\\$&');\n}\n\nconst DISALLOWED_CHARS_REGEXP = new RegExp('[' + DISALLOWED_CHARS.map(escapeRegExp).join('') + ']');\nconst ERROR_MESSAGE = `The following characters are not allowed: ${DISALLOWED_CHARS.join(' ')}`;\n\nconst containsDisallowedChars = (str: string) => DISALLOWED_CHARS_REGEXP.test(str);\n\nclass NameValidator extends BaseValidator {\n protected message = ERROR_MESSAGE;\n protected type = 'name';\n\n validate(value: string): boolean {\n return !containsDisallowedChars(value);\n }\n}\n\nexport {NameValidator};\n","import {BaseValidator} from 'app/util/validators/BaseValidator';\n\nclass EmptyStringValidator extends BaseValidator {\n protected message = 'Name should be non empty';\n protected type = 'empty_string';\n\n validate(value: string): boolean {\n return value.trim() !== '';\n }\n}\n\nexport {EmptyStringValidator};\n","import {BaseValidator} from 'app/util/validators/BaseValidator';\n\n// See: https://rgxdb.com/r/3YPXXFO0\n// eslint-disable-next-line no-control-regex\nconst EMAIL_REGEXP = /^([^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+|\\x22([^\\x0d\\x22\\x5c\\x80-\\xff]|\\x5c[\\x00-\\x7f])*\\x22)(\\x2e([^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+|\\x22([^\\x0d\\x22\\x5c\\x80-\\xff]|\\x5c[\\x00-\\x7f])*\\x22))*\\x40([^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+|\\x5b([^\\x0d\\x5b-\\x5d\\x80-\\xff]|\\x5c[\\x00-\\x7f])*\\x5d)(\\x2e([^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+|\\x5b([^\\x0d\\x5b-\\x5d\\x80-\\xff]|\\x5c[\\x00-\\x7f])*\\x5d))*$/i;\n\nclass EmailValidator extends BaseValidator {\n protected type = 'email';\n\n validate(value: string): boolean {\n value = value.trim();\n\n if (value.length > 320 || value.length === 0) {\n return false;\n }\n\n if (!EMAIL_REGEXP.test(value)) {\n return false;\n }\n\n const [\n firstPart = '',\n secondPart = '',\n ] = value.split('@');\n\n if (firstPart.length > 64 || firstPart.length === 0) {\n return false;\n }\n\n if (secondPart.length > 254 || secondPart.length === 0) {\n return false;\n }\n\n const domainParts = secondPart.split('.');\n\n return !domainParts.some(part => part.length > 63 || part.length === 0);\n }\n}\n\nexport {EmailValidator};\n","import {BaseValidator} from 'app/util/validators/BaseValidator';\n\nconst ALLOWED_CHARS = 'A-Za-z0-9_-+ #()[]';\nexport const ALLOWED_CHARS_REGEXP = /^[A-Za-z0-9_\\-+ #()[\\]]+$/;\n\nconst ERROR_MESSAGE = `Allowed characters: ${ALLOWED_CHARS}`;\n\nconst isAllCharsIsAllowed = (str: string) => ALLOWED_CHARS_REGEXP.test(str);\n\nclass DevicePresetNameValidator extends BaseValidator {\n message = ERROR_MESSAGE;\n type = 'device_preset_name';\n\n validate(value: string): boolean {\n return isAllCharsIsAllowed(value);\n }\n}\n\nexport {DevicePresetNameValidator};\n","import {NameValidator} from 'app/util/validators/NameValidator';\nimport {EmptyStringValidator} from 'app/util/validators/EmptyStringValidator';\nimport {EmailValidator} from 'app/util/validators/EmailValidator';\nimport {DevicePresetSectionsValidator} from 'app/util/validators/DevicePresetSectionsValidator';\nimport {DevicePresetNameValidator} from 'app/util/validators/DevicePresetNameValidator';\n\nconst emailValidator = new EmailValidator();\nconst nameValidator = new NameValidator();\nconst emptyStringValidator = new EmptyStringValidator();\nconst devicePresetSectionsValidator = new DevicePresetSectionsValidator();\nconst devicePresetNameValidator = new DevicePresetNameValidator();\n\nexport {\n emailValidator,\n nameValidator,\n emptyStringValidator,\n devicePresetSectionsValidator,\n devicePresetNameValidator,\n};\n","import {BaseValidator} from 'app/util/validators/BaseValidator';\n\nclass DevicePresetSectionsValidator extends BaseValidator {\n protected message = 'Select at least one configuration group';\n protected type = 'device_preset_sections';\n\n validate(sections: App.Presets.Section[]): boolean {\n return Array.isArray(sections) && sections.length > 0;\n }\n}\n\nexport {DevicePresetSectionsValidator};\n","import React, {useCallback} from 'react';\nimport classNames from 'classnames';\nimport {Button} from 'app/components/sharedReactComponents/Button';\nimport {SIZE} from 'app/constants';\nimport {Caret, CARET_VARIANT} from 'app/components/sharedReactComponents/Caret';\nimport {Callback, ClassName} from 'app/types/common';\n\ninterface Props extends ClassName {\n opened: boolean;\n size?: SIZE;\n onClick: Callback;\n}\n\nexport const DetailsToggler: React.FC<Props> = ({\n className,\n opened,\n size,\n onClick,\n ...elementProps\n}) => {\n const handleClick = useCallback(event => {\n event.stopPropagation();\n\n if (typeof onClick === 'function') {\n onClick();\n }\n }, [onClick]);\n\n return (\n <Button\n className={classNames('details-toggler', className)}\n title={`${opened ? 'Close' : 'Open'} details`}\n onClick={handleClick}\n {...elementProps}\n >\n <Caret\n className=\"details-toggler__caret\"\n // rework remove !\n size={size}\n opened={opened}\n variant={CARET_VARIANT.THIN}\n />\n </Button>\n );\n};\n","const STORE_KEY_NAME = 'ScrollToAnchorController';\n\nconst ScrollToAnchorController = {\n register(name: string): void {\n window.sessionStorage.setItem(STORE_KEY_NAME, name);\n },\n\n check(name: string): boolean {\n return window.sessionStorage.getItem(STORE_KEY_NAME) === name;\n },\n\n _scrollTo(element: HTMLElement): void {\n element.scrollIntoView({\n behavior: 'smooth',\n block: 'start',\n });\n },\n\n mountElement(name: string, element: HTMLElement): void {\n if (this.check(name)) {\n this._scrollTo(element);\n this.unregister();\n }\n },\n\n unregister(): void {\n window.sessionStorage.removeItem(STORE_KEY_NAME);\n },\n};\n\nScrollToAnchorController.unregister();\n\nexport {ScrollToAnchorController};\n","import React from 'react';\nimport classNames from 'classnames';\nimport {SIZE} from 'app/constants';\nimport {Icons} from 'app/util/icons';\nimport {StartStopButton} from 'app/components/sharedReactComponents/ActionButtons/StartStopButton';\nimport {DEVICE_START_STOP_BUTTON_STATUS} from 'app/components/sharedReactComponents/ActionButtons/StartStopButton/constants';\nimport {Callback, ClassName} from 'app/types/common';\n\ninterface Props extends ClassName {\n stoppedLabel?: string;\n status: DEVICE_START_STOP_BUTTON_STATUS;\n startTime?: number;\n size?: SIZE;\n disabled: boolean;\n hovered?: boolean;\n loading?: boolean;\n startAction: Callback;\n stopAction: Callback;\n hasEvent?: boolean;\n}\n\nexport function StreamingStartStopButton({\n className,\n stoppedLabel = 'Start streaming',\n status,\n startTime,\n size,\n disabled,\n hovered,\n loading,\n startAction,\n stopAction,\n hasEvent = false,\n}: Props) {\n const icon =\n hasEvent && status === DEVICE_START_STOP_BUTTON_STATUS.STARTED\n ? Icons.streamingEvent()\n : Icons.streaming();\n\n return (\n <StartStopButton\n className={classNames('streaming-start-stop-button', className)}\n data-id=\"streaming_start_stop_button\"\n status={status}\n icon={icon.size(SIZE.S).reactComponent()}\n stoppedLabel={stoppedLabel}\n startedLabel=\"Streaming\"\n loadingLabel=\"Connecting...\"\n stopLoadingLabel=\"Stop connection\"\n stopLabel=\"Stop streaming\"\n errorLabel=\"Streaming error\"\n startTime={startTime}\n size={size}\n disabled={disabled}\n hovered={hovered}\n loading={loading}\n startAction={startAction}\n stopAction={stopAction}\n unsetLoadingAfterPromise={false}\n />\n );\n}\n","import React, {useRef, useState} from 'react';\nimport {StreamingStartStopButton} from 'app/components/sharedReactComponents/ActionButtons/StartStopButton/StreamingStartStopButton';\nimport {\n DEVICE_START_STOP_BUTTON_STATUS,\n STATUS_CHANGING_TIMEOUT,\n} from 'app/components/sharedReactComponents/ActionButtons/StartStopButton/constants';\nimport {useComponentWillUnmount} from 'app/hooks/useComponentWillUnmount';\nimport {isNil} from 'app/util/isNil';\nimport {ClassName} from 'app/types/common';\n\ninterface Props extends ClassName {\n disabled: boolean;\n stoppedLabel?: string;\n hasEvent?: boolean;\n startTime?: number;\n statusGetter: () => DEVICE_START_STOP_BUTTON_STATUS;\n startStopAction: () => Promise<void>;\n}\n\nexport function StreamingButton({\n className,\n stoppedLabel,\n disabled: _disabled,\n startTime,\n hasEvent = false,\n statusGetter,\n startStopAction,\n}: Props) {\n const status = statusGetter();\n\n let loading = false;\n let disabled = _disabled;\n\n const [previousStatus, setPreviousStatus] = useState<DEVICE_START_STOP_BUTTON_STATUS>();\n const statusChangingTimeoutRef = useRef<number>();\n\n if (!isNil(previousStatus)) {\n if (previousStatus === status) {\n loading = true;\n disabled = true;\n } else {\n loading = false;\n window.clearTimeout(statusChangingTimeoutRef.current);\n setPreviousStatus(undefined);\n }\n }\n\n const action = async () => {\n setPreviousStatus(status);\n statusChangingTimeoutRef.current = window.setTimeout(() => {\n setPreviousStatus(undefined);\n }, STATUS_CHANGING_TIMEOUT);\n\n try {\n await startStopAction();\n } catch {\n setPreviousStatus(undefined);\n }\n };\n\n useComponentWillUnmount(() => {\n window.clearTimeout(statusChangingTimeoutRef.current);\n });\n\n return (\n <StreamingStartStopButton\n className={className}\n stoppedLabel={stoppedLabel}\n disabled={disabled}\n status={status}\n startTime={startTime}\n loading={loading}\n startAction={action}\n stopAction={action}\n hasEvent={hasEvent}\n />\n );\n}\n","import React, {useCallback, useEffect, useState} from 'react';\nimport {Stack} from '@mui/material';\nimport {DevicePublisherModel} from 'app/models/Device/Publisher/DevicePublisherModel';\nimport {CommonStreamListItem} from 'app/components/DeviceDetails/ChannelDetailsTab/DeviceStreamingPanel/DeviceStreamingDestinationList/CommonStreamListItem';\nimport {isPromise} from 'app/util/isPromise';\nimport {useMounted} from 'app/hooks/useIsMounted';\nimport {Callback, Sx} from 'app/types/common';\nimport {COMMON_STREAM_SELECT_INPUT_TYPE} from 'app/components/DeviceDetails/ChannelDetailsTab/DeviceStreamingPanel/DeviceStreamingDestinationList/SelectInput';\nimport {DeviceWarning} from 'app/components/DeviceDetails/Models/types';\nimport {DeviceWarningId} from 'app/components/DeviceDetails/constants';\n\ninterface PublisherProps {\n disabled: boolean;\n offline: boolean;\n selected: boolean;\n publisher: DevicePublisherModel;\n warnings: DeviceWarning[];\n onSelect: Callback;\n}\n\nfunction PublisherItem({\n disabled,\n offline,\n selected,\n publisher,\n warnings,\n onSelect,\n}: PublisherProps) {\n const [selecting, setSelecting] = useState(false);\n\n const isMounted = useMounted();\n\n const handleSelect = useCallback(\n (event) => {\n const promise = onSelect(event);\n\n if (isPromise(promise)) {\n setSelecting(true);\n promise.finally(() => {\n if (isMounted()) {\n setSelecting(false);\n }\n });\n }\n },\n [onSelect, isMounted],\n );\n\n const startStopAction = useCallback(() => {\n if (publisher.isStarted()) {\n return publisher.stopStreaming();\n }\n\n return publisher.startStreaming();\n }, [publisher]);\n\n const started = publisher.isStarted();\n const streaming = publisher.isStreaming();\n const startTime = publisher.getStartTime();\n const failed = publisher.isFailed();\n\n return (\n <CommonStreamListItem\n id={publisher.getId()}\n name={publisher.getName()}\n offline={offline}\n selected={selected}\n disabled={disabled}\n started={started}\n streaming={streaming}\n selecting={selecting}\n startTime={startTime!}\n hasError={failed}\n warnings={warnings}\n selectInputType={COMMON_STREAM_SELECT_INPUT_TYPE.CHECKBOX}\n startStopAction={startStopAction}\n onSelect={handleSelect}\n />\n );\n}\n\ninterface Props extends Sx {\n offline: boolean;\n started: boolean;\n publishers: DevicePublisherModel[];\n selectedPublishers: Set<string>;\n warnings: DeviceWarning[];\n onSelect: Callback;\n}\n\nexport function DevicePublisherList({\n sx,\n offline,\n started,\n publishers,\n selectedPublishers,\n warnings,\n onSelect,\n}: Props) {\n const {getWarnings} = usePublisherWarnings(warnings);\n\n return (\n <Stack sx={sx} gap={1}>\n {publishers.map((p) => {\n const publisherId = p.getId();\n\n return (\n <PublisherItem\n key={publisherId}\n disabled={started}\n offline={offline}\n selected={selectedPublishers.has(publisherId)}\n publisher={p}\n warnings={getWarnings(publisherId)}\n onSelect={onSelect}\n />\n );\n })}\n </Stack>\n );\n}\n\ninterface Return {\n getWarnings: (publisherId: string) => DeviceWarning[];\n hasWarnings: (publisherId: string) => boolean;\n}\n\n// TODO: to separated file\nexport function usePublisherWarnings(warnings: DeviceWarning[]): Return {\n const [map, setMap] = useState<Map<string, DeviceWarning[]>>(new Map());\n\n useEffect(() => {\n const filtered = warnings.filter((w) => w.id === DeviceWarningId.PublisherError);\n\n const result = filtered.reduce((acc, warning) => {\n const {data} = warning;\n\n if (data?.publisher_id) {\n const id = data.publisher_id;\n\n const array = acc.get(id);\n\n acc.set(id, array ? [...array, warning] : [warning]);\n }\n\n return acc;\n }, new Map<string, DeviceWarning[]>());\n\n setMap(result);\n }, [warnings]);\n\n const getWarnings = useCallback(\n (id: string) => {\n return map.get(id) ?? [];\n },\n [map],\n );\n\n return {\n getWarnings,\n hasWarnings: map.has.bind(map),\n };\n}\n","import React, {useMemo} from 'react';\nimport {Box, Divider, Stack, Typography} from '@mui/material';\nimport WarningIcon from '@mui/icons-material/Warning';\nimport {Icons} from 'app/util/icons';\nimport {router} from 'app/router/main';\nimport {StreamingDestinationsSelectorMenuItem} from 'app/components/sharedReactComponents/ActionButtons/StreamingDestinationsSelector/StreamingDestinationsSelectorMenuItem';\nimport {SelectMenuOptionWithCheckbox} from 'app/components/sharedReactComponents/SelectMenuOption/SelectMenuOptionWithCheckbox';\nimport {TooltipMultipleMessages} from 'app/components/sharedReactComponents/Tooltip/TooltipMultipleMessages';\nimport {RadioGroup} from 'app/components/sharedReactComponents/RadioGroup';\nimport {StreamingDestinationListTitle} from 'app/components/sharedReactComponents/StreamingDestinationListTitle';\nimport {Callback, Sx} from 'app/types/common';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {ModelService} from 'app/services/deviceModel/DeviceModelService';\nimport {PearlSlotDeviceModel} from 'app/components/DeviceDetails/Models/PearlSlotDeviceModel';\nimport {DevicePublisherModel} from 'app/models/Device/Publisher/DevicePublisherModel';\nimport {usePublisherWarnings} from 'app/components/DeviceDetails/ChannelDetailsTab/DeviceStreamingPanel/DeviceStreamingDestinationList/DevicePublisherList';\nimport {DeviceWarning} from 'app/components/DeviceDetails/Models/types';\nimport {AnyStreamingDestinationModelType} from 'app/components/StreamingServices/types';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {OverflowTooltip} from 'app/components/sharedReactComponents/OverflowTooltip/OverflowTooltip';\n\ninterface PublishersSelectMenuProps {\n publishers: DevicePublisherModel[];\n selectedPublishers: Set<string>;\n warnings: DeviceWarning[];\n disabled: boolean;\n onChange: Callback;\n}\n\nfunction PublishersSelectMenu({\n publishers,\n selectedPublishers,\n warnings,\n disabled,\n onChange,\n}: PublishersSelectMenuProps) {\n const {getWarnings} = usePublisherWarnings(warnings);\n\n return (\n <Box>\n {publishers.map((publisher) => {\n const publisherId = publisher.getId();\n const name = publisher.getName();\n const isActive = selectedPublishers.has(publisherId);\n const publisherWarnings = getWarnings(publisherId);\n const hasWarnings = publisherWarnings.length > 0;\n\n return (\n <SelectMenuOptionWithCheckbox\n key={publisherId}\n name={publisherId}\n active={isActive}\n disabled={disabled}\n onClick={onChange}\n >\n <Stack direction=\"row\" alignItems=\"flex-start\" gap={1}>\n <Typography component=\"span\" sx={hasWarnings ? {color: 'error.main'} : {}}>\n <OverflowTooltip rowsNumber={2} async={true}>\n {name}\n </OverflowTooltip>\n </Typography>\n\n {hasWarnings && (\n <TooltipMultipleMessages messages={publisherWarnings}>\n <WarningIcon color=\"error\" />\n </TooltipMultipleMessages>\n )}\n </Stack>\n </SelectMenuOptionWithCheckbox>\n );\n })}\n </Box>\n );\n}\n\nfunction MenuFooter({children}: React.PropsWithChildren<{}>) {\n return (\n <Stack direction=\"row\" component=\"footer\" p={1}>\n {children}\n </Stack>\n );\n}\n\ninterface Props extends Sx {\n publishers: DevicePublisherModel[];\n selectedPublishers: Set<string>;\n selectedStreamingDestinations: Set<any>;\n device: AnyDeviceModelType;\n streamingDestinations: AnyStreamingDestinationModelType[];\n publisherWarnings: DeviceWarning[];\n streamingDestinationWarnings: DeviceWarning[];\n offline: boolean;\n started: boolean;\n editable: boolean;\n getDeviceById: (id: string) => AnyDeviceModelType | undefined;\n onPublisherSelect: Callback;\n onStreamingDestinationSelect: Callback;\n}\n\nexport function StreamingDestinationsSelectorMenu({\n sx,\n publishers,\n selectedPublishers,\n selectedStreamingDestinations,\n device,\n streamingDestinations,\n publisherWarnings,\n streamingDestinationWarnings,\n offline,\n started,\n editable,\n getDeviceById,\n onPublisherSelect,\n onStreamingDestinationSelect,\n}: Props) {\n const [visiblePublishers, visibleStreamingDestinations] = useMemo(() => {\n if (started) {\n return [\n publishers.filter((p) => selectedPublishers.has(p.getId())),\n streamingDestinations.filter((d) => selectedStreamingDestinations.has(d.getId())),\n ];\n }\n\n return [publishers, streamingDestinations];\n }, [\n started,\n publishers,\n selectedPublishers,\n streamingDestinations,\n selectedStreamingDestinations,\n ]);\n\n const hasItems = visiblePublishers.length > 0 || visibleStreamingDestinations.length > 0;\n const selectedStreamingDestination = [...selectedStreamingDestinations][0];\n\n const isChannel = ModelService.isChannel(device.getModelName());\n\n const isUnify = ModelService.isUnify(\n isChannel ? (device as PearlSlotDeviceModel).getMasterModelName() : device.getModelName(),\n );\n\n const destinationsUrl = offline\n ? router.url('streamingDestinations')\n : router.url(\n isUnify ? 'projectDetails' : 'deviceDetails',\n {deviceId: device.getId()},\n {activeTab: 'channels', scrollTo: 'streamingDestinations'},\n );\n\n return (\n <Box\n sx={packSx({width: hasItems ? 365 : 400}, sx)}\n // TODO: remove\n className=\"streaming-destinations-selector-menu\"\n >\n <Box p={0.5}>\n {hasItems ? (\n <Stack gap={1} divider={<Divider flexItem={true} />}>\n {visiblePublishers.length > 0 && (\n <PublishersSelectMenu\n publishers={visiblePublishers}\n selectedPublishers={selectedPublishers}\n warnings={publisherWarnings}\n disabled={started || offline}\n onChange={onPublisherSelect}\n />\n )}\n\n {visibleStreamingDestinations.length > 0 && (\n <div>\n {!started && <StreamingDestinationListTitle sx={{mb: 1, ml: 1}} />}\n\n <RadioGroup\n uncheckable={true}\n value={selectedStreamingDestination}\n onChange={onStreamingDestinationSelect}\n >\n {visibleStreamingDestinations.map((streamingDestination) => {\n const destId = streamingDestination.getId();\n return (\n <StreamingDestinationsSelectorMenuItem\n key={destId}\n streamingDestination={streamingDestination}\n isUnify={isUnify}\n device={device}\n disabled={started || offline}\n editable={editable}\n getDeviceById={getDeviceById}\n warnings={\n selectedStreamingDestination === destId\n ? streamingDestinationWarnings\n : []\n }\n />\n );\n })}\n </RadioGroup>\n </div>\n )}\n </Stack>\n ) : (\n <Box p={1}>\n <Typography fontWeight={600} color=\"primary.main\" fontSize={16}>\n You don't have streaming destinations created.\n </Typography>\n <Typography>Create a streaming destination now and start streaming.</Typography>\n </Box>\n )}\n </Box>\n\n {editable && (\n <>\n {hasItems ? (\n <>\n {!started && (\n <MenuFooter>\n <a\n className=\"streaming-destinations-selector-menu__edit-destinations-button\"\n href={destinationsUrl}\n >\n Add and edit destinations {Icons.urlGoArrow().reactComponent()}\n </a>\n </MenuFooter>\n )}\n </>\n ) : (\n <MenuFooter>\n <a\n className=\"streaming-destinations-selector-menu__add-destination-button\"\n href={destinationsUrl}\n >\n New destination {Icons.urlGoArrow().reactComponent()}\n </a>\n </MenuFooter>\n )}\n </>\n )}\n </Box>\n );\n}\n","import React from 'react';\nimport classNames from 'classnames';\nimport {Dropdown} from 'app/components/sharedReactComponents/Dropdown';\nimport {StreamingDestinationsSelectorButton} from 'app/components/sharedReactComponents/ActionButtons/StreamingDestinationsSelector/StreamingDestinationsSelectorButton';\nimport {StreamingDestinationsSelectorMenu} from 'app/components/sharedReactComponents/ActionButtons/StreamingDestinationsSelector/StreamingDestinationsSelectorMenu';\nimport {Callback, ClassName, Sx} from 'app/types/common';\nimport {TOOLTIP_PLACEMENT} from 'app/components/sharedReactComponents/Tooltip';\nimport {DevicePublisherModel} from 'app/models/Device/Publisher/DevicePublisherModel';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {DeviceWarning} from 'app/components/DeviceDetails/Models/types';\nimport {AnyStreamingDestinationModelType} from 'app/components/StreamingServices/types';\nimport {Box} from '@mui/material';\n\ninterface Props extends ClassName, Sx {\n publishers: DevicePublisherModel[];\n selectedPublishers: Set<string>;\n selectedStreamingDestinations: Set<any>;\n device: AnyDeviceModelType;\n streamingDestinations: AnyStreamingDestinationModelType[];\n publisherWarnings: DeviceWarning[];\n streamingDestinationWarnings: DeviceWarning[];\n started: boolean;\n disabled?: boolean;\n offline: boolean;\n editable: boolean;\n getDeviceById: (id: string) => AnyDeviceModelType | undefined;\n onPublisherSelect: Callback;\n onStreamingDestinationSelect: Callback;\n}\n\nexport function StreamingDestinationsSelector({\n sx,\n className,\n publishers,\n selectedPublishers,\n selectedStreamingDestinations,\n device,\n streamingDestinations,\n publisherWarnings = [],\n streamingDestinationWarnings = [],\n started,\n disabled,\n offline,\n editable,\n getDeviceById,\n onPublisherSelect,\n onStreamingDestinationSelect,\n}: Props) {\n return (\n <Box sx={sx} className={classNames('streaming-destinations-selector', className)}>\n <Dropdown\n content={\n <StreamingDestinationsSelectorMenu\n publishers={publishers}\n selectedPublishers={selectedPublishers}\n selectedStreamingDestinations={selectedStreamingDestinations}\n device={device}\n streamingDestinations={streamingDestinations}\n publisherWarnings={publisherWarnings}\n streamingDestinationWarnings={streamingDestinationWarnings}\n getDeviceById={getDeviceById}\n offline={offline}\n started={started}\n editable={editable}\n onPublisherSelect={onPublisherSelect}\n onStreamingDestinationSelect={onStreamingDestinationSelect}\n />\n }\n placement={TOOLTIP_PLACEMENT.TOP_START}\n maxWidth={414}\n disabled={disabled}\n interactive={true}\n >\n <StreamingDestinationsSelectorButton\n count={selectedPublishers.size + selectedStreamingDestinations.size}\n offline={offline}\n failed={\n started && (publisherWarnings.length > 0 || streamingDestinationWarnings.length > 0)\n }\n started={started}\n />\n </Dropdown>\n </Box>\n );\n}\n","import React, {useCallback} from 'react';\nimport {DEVICE_START_STOP_BUTTON_STATUS} from 'app/components/sharedReactComponents/ActionButtons/StartStopButton/constants';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {Notifications} from 'app/components/Notifications';\nimport {StreamingButton} from 'app/components/sharedReactComponents/ActionButtons/StreamingButton';\n\ninterface Props {\n device: AnyDeviceModelType;\n disabled: boolean;\n hasEvent?: boolean;\n}\n\nexport function DeviceStreamingButton({device, hasEvent = false, disabled}: Props) {\n const getStatus = useCallback(() => {\n if (device.hasStreamingError()) {\n return DEVICE_START_STOP_BUTTON_STATUS.ERROR;\n }\n\n if (device.isStreaming()) {\n return DEVICE_START_STOP_BUTTON_STATUS.STARTED;\n }\n\n if (device.isStreamingStarted()) {\n return DEVICE_START_STOP_BUTTON_STATUS.LOADING;\n }\n\n return DEVICE_START_STOP_BUTTON_STATUS.STOPPED;\n }, [device]);\n\n const action = useCallback(async () => {\n const streamingStarted = device.isStreamingStarted();\n\n try {\n if (streamingStarted) {\n await device.stopStreaming();\n } else {\n await device.startStreaming();\n }\n } catch (e: unknown) {\n Notifications.addErrorNotification(\n `Could not ${streamingStarted ? 'stop' : 'start'} streaming`,\n );\n throw e;\n }\n }, [device]);\n\n return (\n <StreamingButton\n disabled={disabled}\n hasEvent={hasEvent}\n statusGetter={getStatus}\n startStopAction={action}\n startTime={device.getStreamingStartTime() ?? undefined}\n />\n );\n}\n","import {useEffect, useRef, useState} from 'react';\nimport {secondsToMilliseconds} from 'app/util/timeConverter';\nimport {useIsMounted} from 'app/hooks/useIsMounted';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {Callback} from 'app/types/common';\nimport {noop} from 'app/util/noop';\n\nconst WAITING_MS = secondsToMilliseconds(1);\n\ntype Props = {\n device: AnyDeviceModelType;\n onChange?: Callback;\n};\n\nexport function useDevicePublisherSelection({device, onChange = noop}: Props) {\n const [selectedPublishers, setSelectedPublishers] = useState<Set<string>>(new Set());\n const [selecting, setSelecting] = useState(false);\n const publishersLoading = useRef(0);\n const lastLoadingFinishTimestamp = useRef(0);\n const mountedRef = useIsMounted();\n\n useEffect(() => {\n if (publishersLoading.current > 0) {\n return;\n }\n\n // If new devices received after last finished request in 1000 ms. This response may be not actual\n if (Date.now() - lastLoadingFinishTimestamp.current < WAITING_MS) {\n return;\n }\n\n const selectedPublishers = device\n .getPublishers()\n .filter((publisher) => publisher.isSelected() || publisher.isStarted())\n .map((publisher) => publisher.getId());\n\n setSelectedPublishers(new Set(selectedPublishers));\n }, [device]);\n\n // TODO: simple type\n const handlePublisherSelect = async ({target: {name, value}}) => {\n setSelecting(true);\n publishersLoading.current += 1;\n\n const nextSelectedPublishers = new Set(selectedPublishers);\n\n if (value) {\n nextSelectedPublishers.add(name);\n } else {\n nextSelectedPublishers.delete(name);\n }\n\n setSelectedPublishers(nextSelectedPublishers);\n\n return device\n .selectPublisher(name, value)\n .catch(() => {\n if (mountedRef.current) {\n setSelectedPublishers(selectedPublishers);\n }\n })\n .finally(() => {\n if (mountedRef.current === false) {\n return;\n }\n\n publishersLoading.current -= 1;\n\n if (publishersLoading.current === 0) {\n setSelecting(false);\n }\n\n lastLoadingFinishTimestamp.current = Date.now();\n })\n .then(() => onChange());\n };\n\n return {\n selectedPublishers,\n selectingPublishers: selecting,\n handlePublisherSelect,\n };\n}\n","/**\n * ```typescript\n * intersectionOfSets(new Set([1, 2]), new Set([2, 3])); //=> new Set([2])\n * ```\n */\nexport function intersectionOfSets(set1: Set<any>, set2: Set<any>): Set<any> {\n const intersection = new Set();\n\n for (const item of set1) {\n if (set2.has(item)) {\n intersection.add(item);\n }\n }\n\n return intersection;\n}\n","import {useEffect, useRef, useState} from 'react';\nimport {isNil} from 'app/util/isNil';\nimport {front} from 'app/api/CirrusApi';\nimport {noop} from 'app/util/noop';\nimport {intersectionOfSets} from 'app/util/intersectionOfSets';\nimport {isSetsEquals} from 'app/util/isSetsEquals';\nimport {useIsMounted} from 'app/hooks/useIsMounted';\nimport {AnyStreamingDestinationModelType} from 'app/components/StreamingServices/types';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\n\n// /**\n// * @param device\n// * @param {AnyStreamingDestinationModelType[]} streamingDestinations\n// * @return {{handleStreamingDestinationSelect: function, selectingStreamingDestinations: boolean, selectedStreamingDestinations: Set<string>}}\n// */\n\ninterface Args {\n device: AnyDeviceModelType;\n streamingDestinations: AnyStreamingDestinationModelType[];\n}\n\nexport function useDeviceStreamingDestinationSelection({device, streamingDestinations}: Args) {\n const [selected, setSelected] = useState(new Set());\n const [selecting, setSelecting] = useState(false);\n const mountedRef = useIsMounted();\n\n const selectionManager = useRef<SelectionManager | null>(null);\n\n if (selectionManager.current === null) {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n selectionManager.current = new SelectionManager({\n device,\n streamingDestinations,\n onUpdate: (selected) => setSelected(selected),\n onStartSelecting: () => setSelecting(true),\n onStopSelecting: () => {\n if (mountedRef.current) {\n setSelecting(false);\n }\n },\n });\n }\n\n useEffect(() => () => selectionManager.current?.unmount(), []);\n\n useEffect(() => {\n selectionManager.current?.setDevice(device);\n }, [device]);\n\n useEffect(() => {\n selectionManager.current?.setStreamingDestinations(streamingDestinations);\n }, [streamingDestinations]);\n\n const handleSelect = ({target: {name, value}}) => {\n const checked = isNil(value) === false;\n return selectionManager.current?.updateAction(name, checked);\n };\n\n return {\n selectedStreamingDestinations: selected,\n selectingStreamingDestinations: selecting,\n handleStreamingDestinationSelect: handleSelect,\n };\n}\n\nclass SelectionManager {\n /**\n * @type {AnyDeviceModelType}\n */\n #device: any = null;\n #deviceId = null;\n #streamingDestinationsIds = new Set();\n #selectedIds = new Set();\n #selectedInDeviceIds = new Set();\n #touched = false;\n #previousSelectedIds = new Set();\n #updateTimeout: any = null;\n #command = {execute: noop};\n #updatePromiseResolve = noop;\n #updateTimeoutMs = 1000;\n #onUpdate;\n #onStartSelecting;\n #onStopSelecting;\n\n /**\n * @param {AnyDeviceModelType} device\n * @param {AnyStreamingDestinationModelType[]} streamingDestinations\n * @param {Function} onStartSelecting\n * @param {Function} onStopSelecting\n * @param {Function} onUpdate\n */\n constructor({device, streamingDestinations, onStartSelecting, onStopSelecting, onUpdate}) {\n this.#onUpdate = onUpdate;\n this.#onStartSelecting = onStartSelecting;\n this.#onStopSelecting = onStopSelecting;\n\n this.setDevice(device);\n this.setStreamingDestinations(streamingDestinations);\n\n this.#updateTimeout = null;\n }\n\n unmount() {\n this.#stopTimer();\n }\n\n /**\n * @return {Set<string>}\n */\n getSelectedIds() {\n let result = this.#selectedInDeviceIds;\n\n if (this.#touched && isSetsEquals(this.#selectedInDeviceIds, this.#selectedIds)) {\n this.#touched = false;\n this.#selectedIds = new Set();\n this.#previousSelectedIds = new Set();\n }\n\n if (this.#touched) {\n result = this.#selectedIds;\n }\n\n return intersectionOfSets(result, this.#streamingDestinationsIds);\n }\n\n /**\n * @param {AnyDeviceModelType} device\n */\n setDevice(device) {\n this.#device = device;\n\n if (this.#device) {\n this.#deviceId = this.#device?.getId();\n this.#selectedInDeviceIds = new Set([this.#device.getSelectedStreamingDestinationId()]);\n }\n\n this.#triggerUpdate();\n }\n\n /**\n * @param {AnyStreamingDestinationModelType[]} streamingDestinations\n */\n setStreamingDestinations(streamingDestinations) {\n this.#streamingDestinationsIds = new Set(\n streamingDestinations.map((streamingDestination) => {\n return streamingDestination.getId();\n }),\n );\n\n this.#triggerUpdate();\n }\n\n /**\n * @param {string} id Streaming destination ID\n * @param {boolean} value If `true` select streaming destination\n */\n async updateAction(id, value) {\n this.#touched = true;\n this.#stopTimer();\n this.#savePrevious();\n this.#selectedIds = new Set(value ? [id] : []);\n this.#triggerUpdate();\n this.#command.execute = () => {\n this.#onStartSelecting();\n front\n .streams(id)\n .attach()\n .post({DeviceID: value ? this.#deviceId : null})\n .catch(() => this.#restorePrevious())\n .finally(() => {\n this.#onStopSelecting();\n this.#updatePromiseResolve();\n });\n };\n\n this.#startTimer();\n\n return new Promise((resolve: any) => {\n this.#updatePromiseResolve = resolve;\n });\n }\n\n #triggerUpdate = () => {\n this.#onUpdate(this.getSelectedIds());\n };\n\n #startTimer = () => {\n this.#updateTimeout = setTimeout(() => {\n this.#command.execute();\n }, this.#updateTimeoutMs);\n };\n\n #stopTimer = () => {\n clearTimeout(this.#updateTimeout);\n };\n\n #savePrevious = () => {\n this.#previousSelectedIds = this.#selectedIds;\n };\n\n #restorePrevious = () => {\n this.#selectedIds = this.#previousSelectedIds;\n this.#triggerUpdate();\n };\n}\n","/**\n * ```typescript\n * isSetsEquals(new Set([1, 2]), new Set([1, 2])); //=> true\n * isSetsEquals(new Set([3]), new Set([4])); //=> false\n * ```\n */\nexport function isSetsEquals(set1: Set<any>, set2: Set<any>): boolean {\n if (set1.size !== set2.size) {\n return false;\n }\n\n const compareSet = new Set([...set1, ...set2]);\n\n return compareSet.size === set1.size;\n}\n","import React from 'react';\nimport {Stack} from '@mui/material';\nimport classNames from 'classnames';\nimport {noop} from 'app/util/noop';\nimport {StreamingDestinationsSelector} from 'app/components/sharedReactComponents/ActionButtons/StreamingDestinationsSelector';\nimport {DeviceStreamingButton} from 'app/components/sharedReactComponents/ActionButtons/DeviceStreamingButton';\nimport {useDevicePublisherSelection} from 'app/components/sharedReactComponents/ActionButtons/useDevicePublisherSelection';\nimport {useDeviceStreamingDestinationSelection} from 'app/components/sharedReactComponents/ActionButtons/useDeviceStreamingDestinationSelection';\nimport {useDeviceWarnings} from 'app/components/sharedReactComponents/ActionButtons/useDeviceWarnings';\nimport {Callback, ClassName} from 'app/types/common';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {AnyStreamingDestinationModelType} from 'app/components/StreamingServices/types';\n\ninterface Props extends ClassName {\n device: AnyDeviceModelType;\n streamingDestinations: AnyStreamingDestinationModelType[];\n editable: boolean;\n hasEvent?: boolean;\n getDeviceById: (id: string) => AnyDeviceModelType | undefined;\n onChange?: Callback;\n}\n\nexport function StreamingDestinationControl({\n className,\n device,\n streamingDestinations,\n hasEvent,\n editable,\n getDeviceById,\n onChange = noop,\n}: Props) {\n const {destinations: streamingDestinationWarnings, publisher: publisherWarnings} =\n useDeviceWarnings(device);\n\n const {\n selectedStreamingDestinations,\n selectingStreamingDestinations,\n handleStreamingDestinationSelect,\n } = useDeviceStreamingDestinationSelection({\n device,\n streamingDestinations,\n });\n\n const {selectedPublishers, selectingPublishers, handlePublisherSelect} =\n useDevicePublisherSelection({\n device,\n onChange,\n });\n\n const offline = device.isOffline();\n const selectedCount = selectedPublishers.size + selectedStreamingDestinations.size;\n const buttonDisabled =\n selectingStreamingDestinations || selectingPublishers || selectedCount === 0 || offline;\n\n return (\n <Stack\n direction=\"row\"\n alignItems=\"center\"\n className={classNames('streaming-destination-control', className)}\n gap={1}\n >\n <StreamingDestinationsSelector\n sx={{minWidth: 196}}\n className=\"streaming-destination-control__select\"\n publishers={device.getPublishers()}\n selectedPublishers={selectedPublishers}\n selectedStreamingDestinations={selectedStreamingDestinations}\n device={device}\n streamingDestinations={streamingDestinations}\n publisherWarnings={publisherWarnings}\n streamingDestinationWarnings={streamingDestinationWarnings}\n offline={offline}\n started={device.isStreamingStarted()}\n editable={editable}\n getDeviceById={getDeviceById}\n onPublisherSelect={handlePublisherSelect}\n onStreamingDestinationSelect={handleStreamingDestinationSelect}\n />\n\n <DeviceStreamingButton device={device} hasEvent={hasEvent} disabled={buttonDisabled} />\n </Stack>\n );\n}\n","import {useEffect, useState} from 'react';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {DeviceWarning} from 'app/components/DeviceDetails/Models/types';\n\ninterface State {\n publisher: DeviceWarning[];\n destinations: DeviceWarning[];\n}\n\nexport function useDeviceWarnings(device: AnyDeviceModelType): State {\n const [state, setState] = useState<State>({destinations: [], publisher: []});\n\n useEffect(() => {\n setState({\n destinations: device.getStreamingDestinationWarnings(),\n publisher: device.getSelectedPublisherWarnings(),\n });\n }, [device]);\n\n return state;\n}\n","import React from 'react';\nimport {StackHorizontal} from 'app/components/sharedReactComponents/Stack';\nimport {ActionButtonsSeparator} from 'app/components/sharedReactComponents/ActionButtons/ActionButtonsSeparator';\nimport {RecordingButton} from 'app/components/sharedReactComponents/ActionButtons/RecordingButton';\nimport {TranscribingButton} from 'app/components/sharedReactComponents/ActionButtons/TranscribingButton';\nimport {StreamingDestinationControl} from 'app/components/sharedReactComponents/ActionButtons/StreamingDestinationControl';\nimport {Callback} from 'app/types/common';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {AnyStreamingDestinationModelType} from 'app/components/StreamingServices/types';\n\ninterface Props {\n device: AnyDeviceModelType;\n streamingDestinations: AnyStreamingDestinationModelType[];\n editable: boolean;\n hasEvent?: boolean;\n getDeviceById: (id: string) => AnyDeviceModelType | undefined;\n onChangeStreamingDestination: Callback;\n}\n\nexport function ActionButtons({\n device,\n hasEvent,\n streamingDestinations,\n editable,\n getDeviceById,\n onChangeStreamingDestination,\n}: Props) {\n return (\n <StackHorizontal separatorComponent={<ActionButtonsSeparator />}>\n {device.capabilities.transcribing && <TranscribingButton device={device} />}\n\n {device.capabilities.streaming && (\n <StreamingDestinationControl\n device={device}\n streamingDestinations={streamingDestinations}\n editable={editable}\n getDeviceById={getDeviceById}\n onChange={onChangeStreamingDestination}\n />\n )}\n\n {device.capabilities.recording && <RecordingButton device={device} hasEvent={hasEvent} />}\n </StackHorizontal>\n );\n}\n","import React, {useEffect, useState} from 'react';\nimport {Checkbox, CheckboxProps, Popover} from '@mui/material';\nimport {UpgradeToEdgePremium} from 'app/components/sharedReactComponents/UpgradeToEdgePremium/UpgradeToEdgePremium';\n\ntype Props = CheckboxProps & {\n premium: boolean;\n billingAccess: boolean;\n};\n\nexport function EdgeCheckbox({sx, premium, billingAccess, onClick, ...props}: Props) {\n const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);\n\n useEffect(() => {\n if (premium) {\n setAnchorEl(null);\n }\n }, [premium]);\n\n return (\n <>\n <Checkbox\n {...props}\n onClick={(e) => {\n if (!premium) {\n setAnchorEl(e.currentTarget);\n return;\n }\n\n onClick?.(e);\n }}\n />\n\n <Popover\n open={Boolean(anchorEl)}\n anchorEl={anchorEl}\n slotProps={{paper: {sx: {p: 2}}}}\n anchorOrigin={{vertical: 'bottom', horizontal: 'center'}}\n transformOrigin={{vertical: 'top', horizontal: 'center'}}\n onClose={() => setAnchorEl(null)}\n >\n <UpgradeToEdgePremium billingAccess={billingAccess} />\n </Popover>\n </>\n );\n}\n","import {StyleSx} from 'app/types/common';\n\nconst root: StyleSx = {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n px: 1.5,\n py: 1,\n flex: 1,\n minWidth: 0,\n gap: 2,\n};\n\nconst selected: StyleSx = {\n borderColor: 'primary.main',\n boxShadow: ({palette: {primary}}) => `0px 0px 0px 1px ${primary.main}`,\n};\n\nexport const bodyStyles = {root, selected};\n","import React from 'react';\nimport {useInView} from 'react-intersection-observer';\nimport {Box, Link, Paper, Stack} from '@mui/material';\nimport {DataId, Sx} from 'app/types/common';\nimport {PearlSlotDeviceModel} from 'app/components/DeviceDetails/Models/PearlSlotDeviceModel';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {Thumbnail} from 'app/components/sharedReactComponents/Preview/Thumbnail/Thumbnail';\nimport {DeviceAudioMeter} from 'app/components/sharedReactComponents/DeviceAudioMeter/DeviceAudioMeter';\nimport {PreviewUpdateStrategy} from 'app/hooks/Device/Preview/types';\nimport {router} from 'app/router/main';\nimport {OverflowTooltip} from 'app/components/sharedReactComponents/OverflowTooltip/OverflowTooltip';\nimport {ActionButtons} from 'app/components/sharedReactComponents/ActionButtons/ActionButtons';\nimport {AnyStreamingDestinationModelType} from 'app/components/StreamingServices/types';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {EdgeCheckbox} from 'app/components/features/edge/EdgeDevice/EdgeCheckbox/EdgeCheckbox';\nimport {bodyStyles} from 'app/components/features/edge/EdgeDevice/body/body.styles';\n\ninterface Props extends Sx, DataId {\n channel: PearlSlotDeviceModel;\n premium: boolean;\n billingAccess: boolean;\n streamsAccess: boolean;\n previewType: PreviewUpdateStrategy;\n streamingDestinations: AnyStreamingDestinationModelType[];\n getDeviceById: (deviceId: string) => AnyDeviceModelType | undefined;\n checkSelection: (channelId: string) => boolean;\n toggleSelection: (channel: PearlSlotDeviceModel) => void;\n}\n\nexport function DeviceChannel({\n dataId,\n sx,\n channel,\n premium,\n previewType,\n billingAccess,\n streamsAccess,\n streamingDestinations,\n checkSelection,\n toggleSelection,\n getDeviceById,\n}: Props) {\n const {ref, inView} = useInView();\n\n const channelId = channel.getId();\n const selected = checkSelection(channelId);\n\n const url = router.url('deviceDetails', {deviceId: channelId});\n const online = channel.isOnline();\n\n return (\n <Stack data-id={dataId} sx={sx} direction=\"row\" alignItems=\"center\" gap={0.5}>\n <EdgeCheckbox\n data-id=\"device_card_child_checkbox\"\n premium={premium}\n billingAccess={billingAccess}\n checked={selected}\n disableRipple={false}\n onClick={() => toggleSelection(channel)}\n />\n\n <Paper sx={packSx(bodyStyles.root, selected && bodyStyles.selected)} variant=\"outlined\">\n <Stack direction=\"row\" ref={ref} width={98} height={50} gap={0.5}>\n {inView && (\n <>\n <Thumbnail id={channelId} detailsUrl={url} updateStrategy={previewType} />\n\n <DeviceAudioMeter\n sx={{height: 50, width: 5}}\n id={channelId}\n disabled={false}\n segmentsCount={13}\n segmentsGap={2}\n vertical={true}\n />\n </>\n )}\n </Stack>\n\n <Box minWidth={0} mr=\"auto\">\n <Link\n color=\"inherit\"\n sx={{color: online ? 'text.primary' : 'text.disabled'}}\n href={url}\n underline=\"none\"\n >\n <OverflowTooltip rowsNumber={2}>{channel.getName()}</OverflowTooltip>\n </Link>\n </Box>\n\n <ActionButtons\n device={channel}\n editable={streamsAccess}\n streamingDestinations={streamingDestinations}\n getDeviceById={getDeviceById}\n onChangeStreamingDestination={() => {}}\n />\n </Paper>\n </Stack>\n );\n}\n","import React, {useMemo} from 'react';\nimport {Stack} from '@mui/material';\nimport {Sx} from 'app/types/common';\nimport {PearlMasterDeviceModel} from 'app/components/DeviceDetails/Models/PearlMasterDeviceModel';\nimport {DeviceChannel} from 'app/components/features/edge/EdgeDevice/body/DeviceChannels/DeviceChannel/DeviceChannel';\nimport {PearlSlotDeviceModel} from 'app/components/DeviceDetails/Models/PearlSlotDeviceModel';\nimport {PreviewUpdateStrategy} from 'app/hooks/Device/Preview/types';\nimport {AnyStreamingDestinationModelType} from 'app/components/StreamingServices/types';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\n\ntype Props = Sx & {\n master: PearlMasterDeviceModel;\n premium: boolean;\n previewType: PreviewUpdateStrategy;\n billingAccess: boolean;\n streamsAccess: boolean;\n streamingDestinations: AnyStreamingDestinationModelType[];\n getDeviceById: (deviceId: string) => AnyDeviceModelType | undefined;\n checkSelection: (channelId: string) => boolean;\n toggleSelection: (channel: PearlSlotDeviceModel) => void;\n};\n\nexport const DeviceChannels = React.memo(\n ({\n sx,\n master,\n premium,\n billingAccess,\n previewType,\n streamsAccess,\n streamingDestinations,\n getDeviceById,\n checkSelection,\n toggleSelection,\n }: Props) => {\n const channels = useMemo(() => master.getChanelModels(), [master]);\n\n return (\n <Stack sx={sx} gap={1}>\n {channels.map((channel) => (\n <DeviceChannel\n dataId={channel.getId()}\n key={channel.getId()}\n previewType={previewType}\n channel={channel}\n premium={premium}\n billingAccess={billingAccess}\n streamsAccess={streamsAccess}\n streamingDestinations={streamingDestinations}\n getDeviceById={getDeviceById}\n checkSelection={checkSelection}\n toggleSelection={toggleSelection}\n />\n ))}\n </Stack>\n );\n },\n);\n","import {Edge} from 'app/domain/edge';\nimport {Icons, SvgIcon} from 'app/util/icons';\n\nconst DEVICE_PRESET_SECTION_NAME: Record<Exclude<Edge.PresetSection, 'all'>, string> = {\n afu: 'Automatic File Upload',\n channels: 'Channels',\n cms: 'Content Management System',\n displays: 'Output ports',\n edid: 'EDID',\n avstudio: 'Epiphan Cloud',\n frontscreen: 'Touch screen',\n network: 'Network',\n sources: 'Inputs',\n system: 'System',\n};\n\nconst SORTED_DEVICE_PRESET_SECTION_IDS: Edge.PresetSection[] = [\n 'system',\n 'network',\n 'sources',\n 'edid',\n 'channels',\n 'afu',\n 'cms',\n 'avstudio',\n 'frontscreen',\n 'displays',\n];\n\nconst DEVICE_PRESET_SECTION_ICON: Record<Exclude<Edge.PresetSection, 'all'>, SvgIcon> = {\n afu: Icons.devicePresetAfu(),\n channels: Icons.devicePresetChannels(),\n cms: Icons.devicePresetCms(),\n displays: Icons.devicePresetDisplays(),\n edid: Icons.devicePresetEdid(),\n avstudio: Icons.devicePresetEpiphanCloud(),\n frontscreen: Icons.devicePresetFrontScreen(),\n network: Icons.devicePresetNetwork(),\n sources: Icons.devicePresetSources(),\n system: Icons.devicePresetSystem(),\n};\n\nconst UNIFY_PRESET_SECTIONS: Edge.PresetSection[] = ['sources', 'channels', 'afu'];\n\nconst ALL_PRESET_SECTIONS: Edge.PresetSection[] = [\n 'system',\n 'network',\n 'sources',\n 'edid',\n 'channels',\n 'afu',\n 'cms',\n 'avstudio',\n 'frontscreen',\n 'displays',\n];\n\nexport {\n DEVICE_PRESET_SECTION_NAME,\n DEVICE_PRESET_SECTION_ICON,\n SORTED_DEVICE_PRESET_SECTION_IDS,\n ALL_PRESET_SECTIONS,\n UNIFY_PRESET_SECTIONS,\n};\n","import React from 'react';\nimport {Stack} from '@mui/material';\nimport {grey} from '@mui/material/colors';\nimport {StyleSx, Sx} from 'app/types/common';\nimport {Edge} from 'app/domain/edge';\nimport {LegacyIcon} from 'app/components/sharedReactComponents/LegacyIcon/LegacyIcon';\nimport {\n DEVICE_PRESET_SECTION_ICON,\n DEVICE_PRESET_SECTION_NAME,\n} from 'app/constants/devicePresetSection';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\n\nconst iconSx: StyleSx = {\n fontSize: 24,\n height: 32,\n width: 32,\n bgcolor: 'white',\n color: grey[600],\n border: 1,\n borderColor: grey[200],\n borderRadius: 1,\n};\n\ninterface Props extends Sx {\n sections: Edge.PresetSection[];\n}\n\nexport function PresetSections({sx, sections}: Props) {\n return (\n <Stack sx={sx} direction=\"row\" alignItems=\"center\" justifyContent=\"flex-start\" gap={0.5}>\n {sections\n .filter((s) => Boolean(s))\n .map((s) => (\n <Tooltip key={s} content={DEVICE_PRESET_SECTION_NAME[s]}>\n <LegacyIcon dataId={s} key={s} sx={iconSx}>\n {DEVICE_PRESET_SECTION_ICON[s].reactComponent()}\n </LegacyIcon>\n </Tooltip>\n ))}\n </Stack>\n );\n}\n","import React, {useState} from 'react';\nimport {Card, Collapse, IconButton, Stack, Typography, alpha} from '@mui/material';\nimport {blue, grey} from '@mui/material/colors';\nimport ExpandMoreIcon from '@mui/icons-material/ExpandMore';\nimport WarningIcon from '@mui/icons-material/Warning';\nimport {DataId, Sx} from 'app/types/common';\nimport {OverflowTooltip} from 'app/components/sharedReactComponents/OverflowTooltip/OverflowTooltip';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {PresetSections} from 'app/components/sharedReactComponents/DevicePresetCard/PresetSections/PresetSections';\nimport {Edge} from 'app/domain/edge';\nimport {isNil} from 'app/util/isNil';\n\ntype CardProps = Sx &\n DataId & {\n selected: boolean;\n preset: Edge.TeamPreset;\n onSelect: () => void;\n };\n\nexport function SelectPresetCard({dataId, sx, selected, preset, onSelect}: CardProps) {\n const [expanded, setExpanded] = useState(false);\n\n const hasDescription = Boolean(preset.description);\n const hasWarning = !isNil(preset.sections.find((s) => s === 'network'));\n\n return (\n <Card\n data-id={dataId}\n tabIndex={0}\n sx={packSx(\n {bgcolor: grey[50], p: 1},\n selected\n ? ({palette: {primary}}) => ({\n bgcolor: alpha(blue[50], 0.7),\n borderColor: primary.main,\n boxShadow: `0 0 0 1px ${primary.main}`,\n transitionProperty: 'box-shadow, background-color',\n transitionDuration: 0.3,\n transitionTimingFunction: 'ease',\n })\n : false,\n sx,\n )}\n variant=\"outlined\"\n role=\"button\"\n onClick={() => {\n onSelect();\n }}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n onSelect();\n }\n }}\n >\n <Stack direction=\"row\" alignItems=\"center\" gap={1}>\n <Typography minWidth={0} flex={1} component=\"span\">\n <OverflowTooltip>{preset.name}</OverflowTooltip>\n </Typography>\n\n <PresetSections sections={preset.sections} />\n\n <IconButton\n data-id=\"preset-toggler\"\n disabled={!hasDescription}\n disableRipple={false}\n onClick={(e) => {\n setExpanded((p) => !p);\n e.stopPropagation();\n }}\n onKeyDown={(e) => e.stopPropagation()}\n >\n <ExpandMoreIcon\n sx={{transform: `rotate(${expanded ? 180 : 0}deg)`, transition: 'transform .3s'}}\n />\n </IconButton>\n </Stack>\n\n <Collapse in={expanded}>\n <Typography textAlign=\"left\" mt={1}>\n {preset.description}\n </Typography>\n </Collapse>\n\n {hasWarning && (\n <Stack mt={1} direction=\"row\" gap={0.5}>\n <WarningIcon color=\"warning\" fontSize=\"small\" />\n\n <Typography color=\"warning.main\" variant=\"body2\">\n This preset includes Network settings, make sure you know that these settings are\n correct\n </Typography>\n </Stack>\n )}\n </Card>\n );\n}\n","import React, {useMemo, useState} from 'react';\nimport {Box, Button, Dialog, Stack, Typography} from '@mui/material';\nimport {LoadingButton} from '@mui/lab';\nimport {Prompt} from 'app/types/common';\nimport {Edge} from 'app/domain/edge';\nimport {SelectPresetCard} from 'app/components/sharedReactComponents/DevicePresetCard/SelectPresetCard/SelectPresetCard';\nimport {useMounted} from 'app/hooks/useIsMounted';\nimport {Cloud} from 'app/domain/cloud';\n\ntype Props = {\n loading: boolean;\n model: Cloud.UnitModel;\n unitCount: number;\n presets: Edge.TeamPreset[];\n rebootWarning: boolean;\n onApply: (preset: Edge.TeamPreset) => Promise<void>;\n onClose: () => void;\n};\n\nfunction ApplyPresetToDevices({\n loading,\n presets,\n rebootWarning,\n model,\n unitCount,\n onApply,\n onClose,\n}: Props) {\n const [selected, setSelected] = useState('');\n\n const modelPresets = useMemo(() => {\n return presets.filter((p) => p.device === model);\n }, [model, presets]);\n\n const handleApply = async () => {\n const preset = presets.find((p) => p.id === selected);\n\n if (preset) {\n await onApply(preset);\n }\n };\n\n const hasPresets = modelPresets.length > 0;\n\n const loadingRequired = useMemo(() => {\n const preset = modelPresets.find((p) => p.id === selected);\n\n if (!preset) {\n return false;\n }\n\n return preset.sections.filter((s) => s === 'network' || s === 'system').length > 0;\n }, [modelPresets, selected]);\n\n const showWarning = rebootWarning && loadingRequired;\n\n return (\n <Box p={3}>\n <Typography textAlign=\"center\" variant=\"h5\" mb={2}>\n Select preset to apply\n </Typography>\n\n {hasPresets ? (\n <>\n <Typography>\n Select{' '}\n <Typography color=\"secondary\" component=\"span\">\n {model}\n </Typography>{' '}\n preset\n </Typography>\n\n <Stack mt={1} gap={1}>\n {modelPresets.map((p) => (\n <SelectPresetCard\n dataId={p.id}\n key={p.id}\n preset={p}\n selected={p.id === selected}\n onSelect={() => setSelected(p.id)}\n />\n ))}\n </Stack>\n </>\n ) : (\n <Typography mt={1} color=\"text.disabled\" textAlign=\"center\">\n There are no{' '}\n <Typography color=\"secondary\" component=\"span\">\n {model}\n </Typography>{' '}\n configuration presets in the team library\n </Typography>\n )}\n\n <Box mt={0.5} height={24}>\n {showWarning && (\n <Typography color=\"warning.main\">\n <strong>{unitCount > 1 ? `${unitCount} devices` : 'Device '} will be rebooted</strong>{' '}\n and temporarily go offline while applying preset\n </Typography>\n )}\n </Box>\n\n <Stack mt={2} direction=\"row\" justifyContent=\"center\" alignItems=\"center\" gap={1}>\n <LoadingButton\n data-id=\"apply-preset-btn\"\n loading={loading}\n variant=\"contained\"\n color=\"secondary\"\n disabled={!selected}\n disableRipple={false}\n onClick={handleApply}\n >\n Apply\n </LoadingButton>\n\n <Button\n data-id=\"cancel-preset-btn\"\n variant=\"outlined\"\n color=\"info\"\n disableRipple={false}\n onClick={onClose}\n >\n Cancel\n </Button>\n </Stack>\n </Box>\n );\n}\n\ntype PromptProps = Prompt & Omit<Props, 'loading'>;\n\nexport function ApplyPresetToDevicesDialog({\n open,\n presets,\n rebootWarning,\n model,\n unitCount,\n onApply,\n onClose,\n}: PromptProps) {\n const [loading, setLoading] = useState(false);\n const mounted = useMounted();\n\n const handleApply = async (preset: Edge.TeamPreset) => {\n if (preset) {\n try {\n setLoading(true);\n await onApply(preset);\n } finally {\n if (mounted()) {\n setLoading(false);\n }\n }\n }\n };\n\n return (\n <Dialog open={open} maxWidth=\"sm\" fullWidth={true} onClose={onClose}>\n <ApplyPresetToDevices\n presets={presets}\n loading={loading}\n rebootWarning={rebootWarning}\n model={model}\n unitCount={unitCount}\n onApply={handleApply}\n onClose={onClose}\n />\n </Dialog>\n );\n}\n","import React, {useState} from 'react';\nimport {Box, Button, Dialog, DialogActions, DialogProps, DialogTitle} from '@mui/material';\nimport {Prompt} from 'app/types/common';\nimport {LoadingButton} from '@mui/lab';\nimport {pluralizeN} from 'app/components/helpers/commonHelpers';\nimport {NamesList} from 'app/components/sharedReactComponents/ItemsEnumeration';\nimport {useMounted} from 'app/hooks/useIsMounted';\n\ntype Props = {\n loading: boolean;\n names: string[];\n onReboot: () => Promise<void>;\n onClose: () => void;\n};\n\nfunction RebootDevices({loading, names, onReboot, onClose}: Props) {\n return (\n <Box>\n <DialogTitle>\n Reboot <NamesList variant=\"inherit\" color=\"primary.main\" names={names} max={3} />{' '}\n {pluralizeN('device', names.length)}\n </DialogTitle>\n\n <DialogActions>\n <LoadingButton\n data-id=\"confirm-reboot-btn\"\n loading={loading}\n variant=\"contained\"\n color=\"secondary\"\n disableRipple={false}\n onClick={onReboot}\n >\n Reboot\n </LoadingButton>\n\n <Button\n data-id=\"cancel-reboot-btn\"\n variant=\"outlined\"\n color=\"info\"\n disableRipple={false}\n onClick={onClose}\n >\n Cancel\n </Button>\n </DialogActions>\n </Box>\n );\n}\n\ntype PromptProps = Prompt &\n Omit<Props, 'loading'> &\n Pick<DialogProps, 'maxWidth' | 'fullWidth' | 'keepMounted'>;\n\nexport function RebootDevicesDialog({open, names, onReboot, onClose, ...props}: PromptProps) {\n const mounted = useMounted();\n const [loading, setLoading] = useState(false);\n\n const handleReboot = async () => {\n try {\n setLoading(true);\n await onReboot();\n } finally {\n if (mounted()) {\n setLoading(false);\n }\n }\n };\n\n return (\n <Dialog open={open} onClose={onClose} PaperProps={{sx: {minWidth: 400}}} {...props}>\n <RebootDevices loading={loading} names={names} onReboot={handleReboot} onClose={onClose} />\n </Dialog>\n );\n}\n","import React, {useState} from 'react';\nimport {\n Box,\n Button,\n Checkbox,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n FormControlLabel,\n Stack,\n Typography,\n} from '@mui/material';\nimport {LoadingButton} from '@mui/lab';\nimport {pluralize, pluralizeN} from 'app/components/helpers/commonHelpers';\nimport {NamesList} from 'app/components/sharedReactComponents/ItemsEnumeration';\nimport {useMounted} from 'app/hooks/useIsMounted';\nimport {Prompt} from 'app/types/common';\n\ntype DeviceCheck = 'dashboard' | 'content' | 'alerts';\n\ntype Props = {\n loading: boolean;\n names: string[];\n lvsOnly: boolean;\n onDelete: () => Promise<void>;\n onClose: () => void;\n};\n\nfunction DeleteDevices({loading, names, lvsOnly, onDelete, onClose}: Props) {\n const [checks, setChecks] = useState<Set<DeviceCheck>>(new Set());\n\n const toggleCheck = (check: DeviceCheck) => {\n const copy = new Set(checks);\n\n if (copy.has(check)) {\n copy.delete(check);\n } else {\n copy.add(check);\n }\n\n setChecks(copy);\n };\n\n const plural = pluralizeN('device', names.length);\n\n const disabled = lvsOnly ? checks.size !== 1 : checks.size !== 3;\n\n return (\n <Box>\n <DialogTitle>\n Delete <NamesList max={3} variant=\"inherit\" color=\"primary.main\" names={names} />{' '}\n {pluralizeN('device', names.length)}\n </DialogTitle>\n\n <DialogContent>\n <Typography textAlign=\"center\">Click the check boxes to confirm</Typography>\n\n <Stack alignItems=\"center\">\n <Stack alignItems=\"flex-start\">\n {!lvsOnly && (\n <>\n <FormControlLabel\n sx={{mb: 0}}\n control={\n <Checkbox\n data-id=\"dashboard-checkbox\"\n checked={checks.has('dashboard')}\n disableRipple={false}\n onChange={() => toggleCheck('dashboard')}\n />\n }\n label={`Remove the ${plural} from the Devices Dashboard and Remote login access`}\n />\n <FormControlLabel\n sx={{mb: 0}}\n control={\n <Checkbox\n data-id=\"content-checkbox\"\n checked={checks.has('content')}\n disableRipple={false}\n onChange={() => toggleCheck('content')}\n />\n }\n label={`Delete all content stored in the cloud that is associated with ${pluralize(\n 'this',\n names,\n )} ${plural}`}\n />\n </>\n )}\n\n <FormControlLabel\n sx={{mb: 0}}\n control={\n <Checkbox\n data-id=\"alerts-checkbox\"\n checked={checks.has('alerts')}\n disableRipple={false}\n onChange={() => toggleCheck('alerts')}\n />\n }\n label={`Stop receiving alerts from ${pluralize('this', names)} ${plural}`}\n />\n </Stack>\n </Stack>\n </DialogContent>\n\n <DialogActions>\n <LoadingButton\n data-id=\"confirm-delete-btn\"\n variant=\"contained\"\n color=\"error\"\n loading={loading}\n disableRipple={false}\n disabled={disabled}\n onClick={onDelete}\n >\n Delete\n </LoadingButton>\n\n <Button\n data-id=\"cancel-delete-btn\"\n variant=\"outlined\"\n color=\"info\"\n disableRipple={false}\n onClick={onClose}\n >\n Cancel\n </Button>\n </DialogActions>\n </Box>\n );\n}\n\ntype PromptProps = Prompt & Omit<Props, 'loading'>;\n\nexport function DeleteDevicesDialog({open, names, lvsOnly, onDelete, onClose}: PromptProps) {\n const mounted = useMounted();\n const [loading, setLoading] = useState(false);\n\n const handleDelete = async () => {\n try {\n setLoading(true);\n await onDelete();\n } finally {\n if (mounted()) {\n setLoading(false);\n }\n }\n };\n\n return (\n <Dialog maxWidth=\"md\" open={open} onClose={onClose}>\n <DeleteDevices\n names={names}\n loading={loading}\n lvsOnly={lvsOnly}\n onDelete={handleDelete}\n onClose={onClose}\n />\n </Dialog>\n );\n}\n","import React, {useState} from 'react';\nimport {\n Box,\n Button,\n DialogActions,\n DialogContent,\n DialogTitle,\n FormLabel,\n MenuItem,\n Select,\n Stack,\n Typography,\n} from '@mui/material';\nimport {LoadingButton} from '@mui/lab';\nimport {StyleSx, Sx} from 'app/types/common';\nimport {Edge} from 'app/domain/edge';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {pluralizeN} from 'app/components/helpers/commonHelpers';\n\nconst titleSx: StyleSx = {overflowWrap: 'break-word', wordBreak: 'break-all'};\n\ninterface Props extends Sx {\n devices: AnyDeviceModelType[];\n groups: Edge.Group[];\n loading: boolean;\n showRemove?: boolean;\n onMove: (groupId: string) => Promise<void>;\n onRemove?: () => Promise<void>;\n onCancel: () => void;\n}\n\nexport function MoveToGroup({\n sx,\n devices,\n loading,\n groups,\n showRemove,\n onMove,\n onRemove,\n onCancel,\n}: Props) {\n const [selected, setSelected] = useState('');\n\n const hasOptions = groups.length > 0;\n const totalDevices = devices.length;\n\n const renderNames = () => {\n return (\n <Typography component=\"span\" sx={titleSx} color=\"primary.main\">\n {totalDevices > 1 ? totalDevices : devices[0]?.getName() ?? ''}\n </Typography>\n );\n };\n\n return (\n <Box sx={sx}>\n <DialogTitle>Move to group</DialogTitle>\n\n <DialogContent>\n <Typography mb={1} textAlign=\"center\">\n Move {renderNames()} {pluralizeN('device', devices.length)}\n </Typography>\n\n <FormLabel sx={{display: 'block', mb: 0.5}}>Group name</FormLabel>\n <Select\n fullWidth={true}\n data-id=\"team-select\"\n displayEmpty={true}\n disabled={loading}\n value={selected}\n MenuProps={{sx: {maxWidth: 364}}}\n renderValue={(value) => {\n if (!value) {\n return <Typography color=\"text.disabled\">Select group</Typography>;\n }\n\n return groups.find((g) => g.id === value)?.name ?? '';\n }}\n >\n {!hasOptions && (\n <MenuItem key=\"no-options\" value=\"\" disabled={true}>\n No options\n </MenuItem>\n )}\n {groups.map((group) => (\n <MenuItem key={group.id} value={group.id} onClick={() => setSelected(group.id)}>\n <Typography variant=\"inherit\" noWrap={true}>\n {group.name}\n </Typography>\n </MenuItem>\n ))}\n </Select>\n </DialogContent>\n\n <DialogActions>\n {showRemove && (\n <LoadingButton\n data-id=\"remove-from-group-btn\"\n sx={{mr: 'auto'}}\n disableRipple={false}\n color=\"error\"\n variant=\"outlined\"\n loading={loading}\n onClick={onRemove}\n >\n Remove from group\n </LoadingButton>\n )}\n\n <Stack direction=\"row\" justifyContent=\"center\" gap={1}>\n <LoadingButton\n data-id=\"confirm-move-btn\"\n color=\"secondary\"\n variant=\"contained\"\n loading={loading}\n disabled={!selected}\n disableRipple={false}\n onClick={() => onMove(selected)}\n >\n Move\n </LoadingButton>\n\n <Button\n data-id=\"cancel-move-btn\"\n disableRipple={false}\n color=\"info\"\n variant=\"outlined\"\n onClick={onCancel}\n >\n Cancel\n </Button>\n </Stack>\n </DialogActions>\n </Box>\n );\n}\n","import React, {useState} from 'react';\nimport {Dialog} from '@mui/material';\nimport {Prompt} from 'app/types/common';\nimport {Edge} from 'app/domain/edge';\nimport {MoveToGroup} from 'app/components/dialogs/MoveToGroupDialog/MoveToGroup';\nimport {useMounted} from 'app/hooks/useIsMounted';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\n\ninterface Props extends Prompt {\n devices: AnyDeviceModelType[];\n groups: Edge.Group[];\n showRemove?: boolean;\n onMove: (groupId: string) => Promise<void>;\n onRemove?: () => Promise<void>;\n}\n\nexport function MoveToGroupDialog({\n open,\n devices,\n groups,\n showRemove,\n onMove,\n onRemove,\n onClose,\n}: Props) {\n const [loading, setLoading] = useState(false);\n\n const mounted = useMounted();\n\n const handleMove = async (groupId: string) => {\n try {\n setLoading(true);\n await onMove(groupId);\n } finally {\n if (mounted()) {\n setLoading(false);\n }\n }\n };\n\n const handleRemove = async () => {\n try {\n setLoading(true);\n await onRemove?.();\n } finally {\n if (mounted()) {\n setLoading(false);\n }\n }\n };\n\n return (\n <Dialog open={open} fullWidth={true} maxWidth=\"xs\" onClose={onClose}>\n <MoveToGroup\n devices={devices}\n groups={groups}\n loading={loading}\n showRemove={showRemove}\n onMove={handleMove}\n onRemove={handleRemove}\n onCancel={onClose}\n />\n </Dialog>\n );\n}\n","import React, {useState} from 'react';\nimport {IconButton, ListItemIcon, ListItemText, Menu, MenuItem} from '@mui/material';\nimport MoreVertIcon from '@mui/icons-material/MoreVert';\nimport TuneIcon from '@mui/icons-material/Tune';\nimport RestartAltIcon from '@mui/icons-material/RestartAlt';\nimport DeleteIcon from '@mui/icons-material/Delete';\nimport DriveFileMoveIcon from '@mui/icons-material/DriveFileMove';\nimport {Sx} from 'app/types/common';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {ApplyPresetToDevicesDialog} from 'app/components/dialogs/ApplyPresetToDevicesDialog/ApplyPresetToDevicesDialog';\nimport {RebootDevicesDialog} from 'app/components/dialogs/RebootDevicesDialog/RebootDevicesDialog';\nimport {Edge} from 'app/domain/edge';\nimport {DeleteDevicesDialog} from 'app/components/dialogs/DeleteDevicesDialog/DeleteDevicesDialog';\nimport {ModelService} from 'app/services/deviceModel/DeviceModelService';\nimport {useMounted} from 'app/hooks/useIsMounted';\nimport {MoveToGroupDialog} from 'app/components/dialogs/MoveToGroupDialog/MoveToGroupDialog';\n\ntype Props = Sx & {\n device: AnyDeviceModelType;\n groups: Edge.Group[];\n groupsAccess: boolean;\n presets: Edge.TeamPreset[];\n permitReboot: boolean;\n permitPresets: boolean;\n onApplyPreset: (preset: Edge.TeamPreset) => Promise<void>;\n onDelete: () => Promise<void>;\n onReboot: () => Promise<void>;\n onMoveToGroup: (groupId: string) => Promise<void>;\n onMoveFromGroup: () => Promise<void>;\n};\n\nexport function DeviceMenu({\n sx,\n device,\n groups,\n presets,\n permitReboot,\n permitPresets,\n groupsAccess,\n onApplyPreset,\n onDelete,\n onReboot,\n onMoveToGroup,\n onMoveFromGroup,\n}: Props) {\n const [anchorEl, setAnchorEl] = React.useState<HTMLElement | null>(null);\n\n const [presetDialog, setPresetDialog] = useState(false);\n const [rebootDialog, setRebootDialog] = useState(false);\n const [deleteDialog, setDeleteDialog] = useState(false);\n const [groupDialog, setGroupDialog] = useState(false);\n\n const mounted = useMounted();\n\n const name = device.getName();\n const model = device.getModelName();\n const online = device.isOnline();\n const groupId = device.getGroupId();\n const lvs = ModelService.isLivescrypt(model);\n\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n setAnchorEl(event.currentTarget);\n };\n\n const handleClose = () => {\n setAnchorEl(null);\n };\n\n const showPreset = online && device.capabilities.presets && permitPresets;\n const showReboot = online && device.capabilities.reboot && permitReboot;\n\n const handleApplyPreset = async (preset: Edge.TeamPreset) => {\n await onApplyPreset(preset);\n\n if (mounted()) {\n setPresetDialog(false);\n }\n };\n\n const handleReboot = async () => {\n await onReboot();\n\n if (mounted()) {\n setRebootDialog(false);\n }\n };\n\n const handleDelete = async () => {\n await onDelete();\n\n if (mounted()) {\n setDeleteDialog(false);\n }\n };\n\n return (\n <>\n <IconButton\n data-id=\"device_card_context_menu_button\"\n sx={sx}\n disableRipple={false}\n onClick={handleClick}\n >\n <MoreVertIcon />\n </IconButton>\n\n <Menu open={Boolean(anchorEl)} anchorEl={anchorEl} onClose={handleClose}>\n {groupsAccess && (\n <MenuItem\n data-id=\"move_to_group_option\"\n onClick={() => {\n setGroupDialog(true);\n handleClose();\n }}\n >\n <ListItemIcon>\n <DriveFileMoveIcon />\n </ListItemIcon>\n\n <ListItemText>Move to group</ListItemText>\n </MenuItem>\n )}\n\n {showPreset && (\n <MenuItem\n data-id=\"apply_preset_option\"\n onClick={() => {\n setPresetDialog(true);\n handleClose();\n }}\n >\n <ListItemIcon>\n <TuneIcon color=\"error\" />\n </ListItemIcon>\n\n <ListItemText>Apply preset</ListItemText>\n </MenuItem>\n )}\n\n {showReboot && (\n <MenuItem\n data-id=\"reboot_option\"\n onClick={() => {\n setRebootDialog(true);\n handleClose();\n }}\n >\n <ListItemIcon>\n <RestartAltIcon color=\"error\" />\n </ListItemIcon>\n\n <ListItemText>Reboot</ListItemText>\n </MenuItem>\n )}\n\n <MenuItem\n data-id=\"delete_option\"\n onClick={() => {\n setDeleteDialog(true);\n handleClose();\n }}\n >\n <ListItemIcon>\n <DeleteIcon color=\"error\" />\n </ListItemIcon>\n\n <ListItemText>Delete</ListItemText>\n </MenuItem>\n </Menu>\n\n <RebootDevicesDialog\n open={rebootDialog}\n names={[name]}\n onReboot={handleReboot}\n onClose={() => setRebootDialog(false)}\n />\n\n <ApplyPresetToDevicesDialog\n open={presetDialog}\n unitCount={1}\n model={model}\n presets={presets}\n rebootWarning={true}\n onApply={handleApplyPreset}\n onClose={() => setPresetDialog(false)}\n />\n\n <DeleteDevicesDialog\n open={deleteDialog}\n names={[name]}\n lvsOnly={lvs}\n onDelete={handleDelete}\n onClose={() => setDeleteDialog(false)}\n />\n\n <MoveToGroupDialog\n open={groupDialog}\n devices={[device]}\n groups={groups}\n showRemove={groupId !== ''}\n onMove={onMoveToGroup}\n onRemove={onMoveFromGroup}\n onClose={() => setGroupDialog(false)}\n />\n </>\n );\n}\n","import {StyleSx} from 'app/types/common';\n\nexport const root: StyleSx = {\n '&:focus': {\n outline: 'none',\n boxShadow: ({palette: {info}}) => `0px 0px 3px 1px ${info.main}`,\n },\n};\n\nexport const selected: StyleSx = ({palette: {primary, info}}) => ({\n borderColor: 'primary.main',\n boxShadow: `0px 0px 0px 1px ${primary.main}`,\n '&:focus': {\n boxShadow: `0px 0px 0px 1px ${primary.main}, 0px 0px 4px 1px ${info.main}`,\n },\n});\n\nexport const cardStyles = {root, selected};\n","import {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\n\nexport function isDisabledAudioMeter(device: AnyDeviceModelType): boolean {\n return device.isOffline() || !device.capabilities.audioLevels;\n}\n","import React from 'react';\nimport {Box, Paper} from '@mui/material';\nimport {StyleSx, Sx} from 'app/types/common';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {DeviceAudioMeter} from 'app/components/sharedReactComponents/DeviceAudioMeter/DeviceAudioMeter';\nimport {LiveScryptDeviceModel} from 'app/components/DeviceDetails/Models/LiveScryptDeviceModel';\nimport {isDisabledAudioMeter} from 'app/components/sharedReactComponents/DeviceAudioMeter/utils';\nimport {ActionButtons} from 'app/components/sharedReactComponents/ActionButtons/ActionButtons';\nimport {bodyStyles} from 'app/components/features/edge/EdgeDevice/body/body.styles';\nimport {noop} from 'app/util/noop';\n\ntype Props = Sx & {\n selected: boolean;\n device: LiveScryptDeviceModel;\n};\n\nconst meterSx: StyleSx = {height: 20, width: 96};\n\nconst destinations = [];\n\nexport function LivescryptDetails({sx, device, selected}: Props) {\n return (\n <Paper sx={packSx(bodyStyles.root, selected && bodyStyles.selected, sx)} variant=\"outlined\">\n <Box flex={1}>\n <DeviceAudioMeter\n sx={meterSx}\n id={device.getId()}\n disabled={isDisabledAudioMeter(device)}\n segmentsCount={13}\n segmentsGap={3}\n />\n </Box>\n\n <ActionButtons\n device={device}\n editable={false}\n streamingDestinations={destinations}\n getDeviceById={noop}\n onChangeStreamingDestination={noop}\n />\n </Paper>\n );\n}\n","import React from 'react';\nimport {Paper, Stack, Typography} from '@mui/material';\nimport {useInView} from 'react-intersection-observer';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {Thumbnail} from 'app/components/sharedReactComponents/Preview/Thumbnail/Thumbnail';\nimport {DeviceModel} from 'app/components/DeviceDetails/Models/DeviceModel';\nimport {Sx} from 'app/types/common';\nimport {DeviceAudioMeter} from 'app/components/sharedReactComponents/DeviceAudioMeter/DeviceAudioMeter';\nimport {router} from 'app/router/main';\nimport {PreviewUpdateStrategy} from 'app/hooks/Device/Preview/types';\nimport {bodyStyles} from 'app/components/features/edge/EdgeDevice/body/body.styles';\n\ntype Props = Sx & {\n device: DeviceModel;\n selected: boolean;\n previewType: PreviewUpdateStrategy;\n};\n\nexport function WebcasterDetails({sx, selected, device, previewType}: Props) {\n const {ref, inView} = useInView();\n\n const deviceId = device.getId();\n\n const detailsUrl = router.url('deviceDetails', {deviceId});\n\n return (\n <Paper sx={packSx(bodyStyles.root, selected && bodyStyles.selected, sx)} variant=\"outlined\">\n <Stack direction=\"row\" ref={ref} width={98} height={50} gap={0.5}>\n {inView && (\n <>\n <Thumbnail id={deviceId} detailsUrl={detailsUrl} updateStrategy={previewType} />\n\n <DeviceAudioMeter\n sx={{height: 50, width: 5}}\n id={deviceId}\n disabled={false}\n segmentsCount={13}\n segmentsGap={2}\n vertical={true}\n />\n </>\n )}\n </Stack>\n\n <Typography ml=\"auto\" color=\"text.secondary\">\n Controls are not available for Webcaster\n </Typography>\n </Paper>\n );\n}\n","import React, {useState} from 'react';\nimport {Button, Popover, Tooltip, Typography} from '@mui/material';\nimport MemoryIcon from '@mui/icons-material/Memory';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {StyleSx, Sx} from 'app/types/common';\nimport {FirmwareState} from 'app/components/features/edge';\n\nconst rootSx: StyleSx = {py: 0.5, px: 1, gap: 0.5};\nconst paperSx: StyleSx = {p: 1, minWidth: 132};\n\ntype Props = Sx & {\n deviceId: string;\n firmware: string;\n checkUpdates: boolean;\n onUpgrade: () => Promise<any>;\n};\n\nexport function FirmwareIndicator({sx, deviceId, firmware, checkUpdates, onUpgrade}: Props) {\n const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);\n\n return (\n <>\n <Tooltip title=\"Firmware\">\n <Button\n data-id=\"firmware-btn\"\n sx={packSx(rootSx, sx)}\n variant=\"outlined\"\n color=\"info\"\n onClick={(e) => setAnchorEl(e.currentTarget)}\n >\n <MemoryIcon />\n\n <Typography data-id=\"device_card_firmwareVersion\" noWrap={true}>\n {firmware}\n </Typography>\n </Button>\n </Tooltip>\n\n <Popover\n anchorEl={anchorEl}\n open={Boolean(anchorEl)}\n slotProps={{paper: {sx: paperSx}}}\n anchorOrigin={{vertical: 'bottom', horizontal: 'left'}}\n transformOrigin={{vertical: 'top', horizontal: 'left'}}\n onClose={() => setAnchorEl(null)}\n >\n <Typography mb={0.25} fontWeight={600}>\n Firmware\n </Typography>\n\n <Typography mb={0.25}>\n Version: <strong data-id=\"firmware-version\">{firmware}</strong>\n </Typography>\n\n {checkUpdates && <FirmwareState deviceId={deviceId} onUpgrade={onUpgrade} />}\n </Popover>\n </>\n );\n}\n","import React, {useRef, useState} from 'react';\nimport {useCopyToClipboard} from 'react-use';\nimport {Button, ButtonProps, Tooltip} from '@mui/material';\nimport {useMounted} from 'app/hooks/useIsMounted';\nimport {DataId} from 'app/types/common';\n\ntype Props = DataId &\n ButtonProps & {\n value: string;\n tooltip?: string;\n };\n\nexport function CopyButton({dataId, sx, value, tooltip, ...props}: Props) {\n const [userTooltip, setUserTooltip] = useState(false);\n const [copyTooltip, setCopyTooltip] = useState(false);\n\n const tooltipTimeout = useRef<number | null>(null);\n\n const mounted = useMounted();\n const [, copyToClipboard] = useCopyToClipboard();\n\n const handleClick = () => {\n copyToClipboard(value);\n setCopyTooltip(true);\n\n if (tooltipTimeout.current && mounted()) {\n clearTimeout(tooltipTimeout.current);\n }\n\n tooltipTimeout.current = window.setTimeout(() => {\n if (mounted()) {\n setCopyTooltip(false);\n }\n }, 500);\n };\n\n const renderTitle = () => {\n if (copyTooltip) {\n return 'Copied!';\n }\n\n if (tooltip) {\n return tooltip;\n }\n\n return null;\n };\n\n return (\n <Tooltip\n open={userTooltip}\n title={renderTitle()}\n onOpen={() => setUserTooltip(true)}\n onClose={() => setUserTooltip(false)}\n >\n <Button data-id={dataId} sx={sx} {...props} onClick={handleClick}>\n {value}\n </Button>\n </Tooltip>\n );\n}\n","import React, {useMemo} from 'react';\nimport {\n Box,\n Card,\n Collapse,\n IconButton,\n Link,\n Stack,\n Tooltip,\n Typography,\n alpha,\n} from '@mui/material';\nimport {green, grey} from '@mui/material/colors';\nimport KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';\nimport {DataId, StyleSx, Sx} from 'app/types/common';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {OverflowTooltip} from 'app/components/sharedReactComponents/OverflowTooltip/OverflowTooltip';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {Edge} from 'app/domain/edge';\nimport {StatusIndicator} from 'app/components/features/edge/EdgeDevice/StatusIndicator/StatusIndicator';\nimport {DeviceHealthIndicator} from 'app/components/sharedReactComponents/DeviceHealthIndicator/DeviceHealthIndicator';\nimport {PerformanceIndicator} from 'app/components/features/edge/EdgeDevice/PerformanceIndicator/PerformanceIndicator';\nimport {ModelService} from 'app/services/deviceModel/DeviceModelService';\nimport {PearlMasterDeviceModel} from 'app/components/DeviceDetails/Models/PearlMasterDeviceModel';\nimport {RemoteLoginButton} from 'app/components/sharedReactComponents/RemoteLogin';\nimport {Schedule} from 'app/domain/schedule';\nimport {isScheduled} from 'app/domain/schedule/utils';\nimport {EventInfo} from 'app/components/sharedReactComponents/Events/shared/EventInfo/EventInfo';\nimport {router} from 'app/router/main';\nimport {StorageIndicator} from 'app/components/features/edge/EdgeDevice/StorageIndicator/StorageIndicator';\nimport {UploadingIndicator} from 'app/components/features/edge/EdgeDevice/UploadingIndicator/UploadingIndicator';\nimport {DeviceChannels} from 'app/components/features/edge/EdgeDevice/body/DeviceChannels/DeviceChannels';\nimport {EdgeCheckbox} from 'app/components/features/edge/EdgeDevice/EdgeCheckbox/EdgeCheckbox';\nimport {getPreviewUpdateStrategy} from 'app/components/sharedReactComponents/Preview/utils';\nimport {AnyStreamingDestinationModelType} from 'app/components/StreamingServices/types';\nimport {DeviceMenu} from 'app/components/features/edge/EdgeDevice/DeviceMenu/DeviceMenu';\nimport {Notifications} from 'app/components/Notifications';\nimport {cardStyles} from 'app/components/features/edge/styles/card.styles';\nimport {LivescryptDetails} from 'app/components/features/edge/EdgeDevice/body/LivescryptDetails/LivescryptDetails';\nimport {LiveScryptDeviceModel} from 'app/components/DeviceDetails/Models/LiveScryptDeviceModel';\nimport {WebcasterDetails} from 'app/components/features/edge/EdgeDevice/body/WebcasterDetails/WebcasterDetails';\nimport {FirmwareIndicator} from 'app/components/features/edge/EdgeDevice/FirmwareIndicator/FirmwareIndicator';\nimport {CopyButton} from 'app/components/features/edge/shared/CopyButton/CopyButton';\nimport {UserRole} from 'app/models/PermissionsModel/types';\n\nconst rootSx: StyleSx = packSx(\n {py: 1, pl: 0.25, pr: 1, bgcolor: alpha(grey[100], 0.75)},\n cardStyles.root,\n);\nconst onlineSx: StyleSx = {bgcolor: alpha(green[50], 0.15), borderColor: green[200]};\nconst buttonSx: StyleSx = {py: 0.5, px: 1};\nconst iconButtonSx: StyleSx = packSx(buttonSx, {minWidth: 24});\nconst copyButtonSx: StyleSx = packSx(buttonSx, {fontSize: 14});\nconst checkboxSx: StyleSx = {m: 0};\nconst togglerSx: StyleSx = {transform: 'rotate(180deg)'};\nconst eventSx: StyleSx = packSx({minWidth: 0, minHeight: 31, maxWidth: 300}, buttonSx);\nconst bodySx: StyleSx = {mt: 1};\nconst singleBodySx: StyleSx = packSx(bodySx, {ml: 1.25});\n\ntype Props = Sx &\n DataId & {\n device: AnyDeviceModelType;\n groups: Edge.Group[];\n presets: Edge.TeamPreset[];\n open: boolean;\n role: UserRole;\n streamingDestinations: AnyStreamingDestinationModelType[];\n detailed: boolean;\n event?: Schedule.Event;\n getDeviceById: (deviceId: string) => AnyDeviceModelType | undefined;\n checkSelection: (deviceId: string) => boolean;\n toggleSelection: (device: AnyDeviceModelType) => void;\n onApplyPreset: (deviceId: string, preset: Edge.TeamPreset) => Promise<void>;\n onDelete: (deviceId: string) => Promise<void>;\n onMoveToGroup: (deviceId: string, groupId: string) => Promise<void>;\n onMoveFromGroup: (deviceId: string, groupId: string) => Promise<void>;\n toggleOpen: (deviceId: string) => void;\n };\n\nexport const EdgeDevice = React.memo<Props>(\n ({\n dataId,\n sx,\n device,\n groups,\n open,\n event,\n role,\n streamingDestinations,\n detailed,\n presets,\n getDeviceById,\n checkSelection,\n toggleSelection,\n onApplyPreset,\n onDelete,\n onMoveToGroup,\n onMoveFromGroup,\n toggleOpen,\n }: Props) => {\n const hasDetails = areDetailsAvailable(device);\n\n const deviceId = device.getId();\n const model = device.getModelName();\n const online = device.isOnline();\n const groupId = device.getGroupId();\n const ip = device.getIPAddress() ?? '';\n const status = device.getStatus() as Edge.DeviceStatus;\n\n const selected = checkSelection(deviceId);\n\n const streaming = device.isStreaming();\n const recording = device.isRecording();\n const transcribing = device.isTranscribing();\n\n const detailsUrl = getDetailsUrl(device);\n\n const {allSelected, partlySelected} = useChannelSelection(device, checkSelection);\n\n const highlighted = selected || allSelected || partlySelected;\n\n const {capabilities} = device;\n\n const isWebcaster = ModelService.isWebcaster(model);\n const isNano = ModelService.isNano(model);\n const isLvs = ModelService.isLivescrypt(model);\n const isPearl = ModelService.isPearlFamily(model);\n\n const activeIndicators = isPearl && online;\n\n const disabledSwitcher = isNano || isWebcaster || isLvs;\n const warnings = device.getWarnings();\n\n const groupAccess = capabilities.groups;\n const batchAccess = capabilities.batch;\n\n const permitBillingEdit = role.canEditBilling();\n const permitStreamsEdit = role.canEditStreamingDestinations();\n const permitReboot = role.canRebootDevices();\n const permitPresets = capabilities.presets && role.canApplyPresets();\n\n const availableGroups = useMemo(\n () => (groupAccess ? groups.filter((g) => g.id !== groupId) : []),\n [groupAccess, groups, groupId],\n );\n\n const expanded = hasDetails ? open : false;\n\n const showIndicators = detailed && online;\n\n const showWarnings = online && warnings.length > 0;\n\n const handleApplyPreset = async (preset: Edge.TeamPreset) => onApplyPreset(deviceId, preset);\n\n const handleDelete = async () => onDelete(deviceId);\n\n const handleMoveToGroup = async (groupId: string) => onMoveToGroup(deviceId, groupId);\n\n const handleMoveFromGroup = async () => {\n if (groupId) {\n await onMoveFromGroup(deviceId, groupId);\n }\n };\n\n const handleUpgrade = async () => {\n try {\n await device.sendUpdateFirmwareCommand();\n } catch (e) {\n Notifications.addErrorNotification('Failed to start device upgrade.');\n throw e;\n }\n };\n\n const handleReboot = async () => {\n try {\n await device.sendRebootCommand();\n } catch (e) {\n Notifications.addErrorNotification('Failed to reboot device.');\n throw e;\n }\n };\n\n const infoFields = (\n <Stack direction=\"row\" alignItems=\"center\" gap={1}>\n <Typography data-id=\"device_card_model\" width={80} textAlign=\"center\">\n {model}\n </Typography>\n\n <CopyButton\n dataId=\"device_card_serialNumber\"\n sx={copyButtonSx}\n value={device.getSerialNumber()}\n tooltip=\"Serial number\"\n variant=\"text\"\n color=\"inherit\"\n />\n\n <CopyButton\n dataId=\"device_card_ipAddress\"\n sx={copyButtonSx}\n value={ip}\n tooltip=\"IP address\"\n variant=\"text\"\n color=\"inherit\"\n />\n </Stack>\n );\n\n const renderSection = () => {\n if (isLvs) {\n return (\n <LivescryptDetails\n sx={singleBodySx}\n selected={selected}\n device={device as LiveScryptDeviceModel}\n />\n );\n }\n\n const previewType = getPreviewUpdateStrategy(device);\n\n if (ModelService.isMultiChannel(model)) {\n return (\n <DeviceChannels\n sx={bodySx}\n master={device as PearlMasterDeviceModel}\n premium={batchAccess}\n previewType={previewType}\n billingAccess={permitBillingEdit}\n streamsAccess={permitStreamsEdit}\n streamingDestinations={streamingDestinations}\n getDeviceById={getDeviceById}\n checkSelection={checkSelection}\n toggleSelection={toggleSelection}\n />\n );\n }\n\n return (\n <WebcasterDetails\n sx={singleBodySx}\n device={device}\n selected={selected}\n previewType={previewType}\n />\n );\n };\n\n return (\n <Card\n data-id={dataId}\n sx={packSx(rootSx, online && onlineSx, highlighted && cardStyles.selected, sx)}\n variant=\"outlined\"\n tabIndex={0}\n >\n <Stack direction=\"row\" alignItems=\"center\" gap={0.5}>\n <EdgeCheckbox\n data-id=\"device_card_checkbox\"\n sx={checkboxSx}\n billingAccess={permitBillingEdit}\n premium={batchAccess}\n checked={selected}\n indeterminate={partlySelected}\n disableRipple={false}\n onClick={() => toggleSelection(device)}\n />\n\n <Box minWidth={0} flex={1} fontWeight={600} fontSize={16}>\n <Link\n color=\"inherit\"\n sx={{color: online ? 'text.primary' : 'text.disabled'}}\n href={detailsUrl}\n underline=\"none\"\n >\n <OverflowTooltip dataId=\"device_card_name\">{device.getName()}</OverflowTooltip>\n </Link>\n </Box>\n\n {event && (\n <EventInfo\n dataId=\"event-indicator\"\n sx={eventSx}\n event={event}\n showTime={true}\n deviceId={deviceId}\n variant=\"text\"\n label={isScheduled(event.status) ? 'in' : undefined}\n overLabel=\"at\"\n />\n )}\n\n {!online && infoFields}\n\n <StatusIndicator\n sx={{px: 0.5}}\n status={status}\n recording={recording}\n streaming={streaming}\n transcribing={transcribing}\n />\n\n {showWarnings && <DeviceHealthIndicator warnings={warnings} offline={!online} />}\n\n {online && (\n <>\n <Tooltip title={online && disabledSwitcher && `${model} does not support switcher`}>\n <span>\n <RemoteLoginButton\n sx={iconButtonSx}\n type=\"switcher\"\n deviceId={deviceId}\n size=\"small\"\n paymentAccess={permitBillingEdit}\n premium={capabilities.login}\n labeled={true}\n disabled={!online || disabledSwitcher}\n />\n </span>\n </Tooltip>\n\n <Tooltip title={online && isWebcaster && `${model} does not support admin login`}>\n <span>\n <RemoteLoginButton\n sx={iconButtonSx}\n type=\"admin\"\n deviceId={deviceId}\n size=\"small\"\n paymentAccess={permitBillingEdit}\n premium={capabilities.login}\n labeled={true}\n disabled={!online || isWebcaster}\n />\n </span>\n </Tooltip>\n </>\n )}\n\n <DeviceMenu\n device={device}\n groups={availableGroups}\n presets={presets}\n permitReboot={permitReboot}\n permitPresets={permitPresets}\n groupsAccess={groupAccess}\n onApplyPreset={handleApplyPreset}\n onDelete={handleDelete}\n onReboot={handleReboot}\n onMoveToGroup={handleMoveToGroup}\n onMoveFromGroup={handleMoveFromGroup}\n />\n\n <IconButton\n data-id=\"device_card_toggler\"\n disabled={!hasDetails}\n onClick={() => toggleOpen(deviceId)}\n >\n <KeyboardArrowDownIcon sx={packSx(expanded && togglerSx)} />\n </IconButton>\n </Stack>\n\n {showIndicators && (\n <Stack mt={1} ml={1.25} direction=\"row\" alignItems=\"center\" gap={1}>\n <Stack direction=\"row\" alignItems=\"center\" gap={1} mr=\"auto\">\n <FirmwareIndicator\n deviceId={deviceId}\n firmware={device.getFirmwareVersion()}\n checkUpdates={activeIndicators}\n onUpgrade={handleUpgrade}\n />\n\n <StorageIndicator deviceId={deviceId} enabled={activeIndicators} />\n\n <UploadingIndicator deviceId={deviceId} enabled={activeIndicators} />\n\n <PerformanceIndicator deviceId={deviceId} enabled={activeIndicators} />\n </Stack>\n\n {infoFields}\n </Stack>\n )}\n\n <Collapse in={expanded}>{renderSection()}</Collapse>\n </Card>\n );\n },\n);\n\nfunction areDetailsAvailable(device: AnyDeviceModelType): boolean {\n const online = device.isOnline();\n\n if (ModelService.isMultiChannel(device.getModelName())) {\n return (device as PearlMasterDeviceModel).hasChannels() && online;\n }\n\n return online;\n}\n\nfunction getDetailsUrl(device: AnyDeviceModelType): string {\n const deviceId = device.getId();\n\n if (ModelService.isLivescrypt(device.getModelName())) {\n return router.url('transcribeDeviceDetails', {deviceId});\n }\n\n return router.url('deviceDetails', {deviceId});\n}\n\nfunction useChannelSelection(device: AnyDeviceModelType, checkSelection: (id: string) => boolean) {\n return useMemo(() => {\n let partlySelected = false;\n let allSelected = false;\n\n const model = device.getModelName();\n\n if (ModelService.isMultiChannel(model)) {\n const channels = (device as PearlMasterDeviceModel).getChanelModels();\n\n if (channels.length > 0) {\n const selectedChannels = channels.filter((channel) => checkSelection(channel.getId()));\n\n allSelected = selectedChannels.length === channels.length;\n partlySelected = selectedChannels.length > 0 && !allSelected;\n }\n }\n\n return {partlySelected, allSelected};\n }, [device, checkSelection]);\n}\n","import React from 'react';\nimport classNames from 'classnames';\nimport {SIZE, VARIANT} from 'app/constants';\nimport {ClassName} from 'app/types/common';\n\ninterface Props extends ClassName {\n online: boolean;\n variant?: VARIANT.OUTLINE | VARIANT.SOLID;\n size: SIZE;\n}\n\nexport const OnlineIndicator: React.FC<Props> = ({\n className,\n online,\n variant = VARIANT.OUTLINE,\n size = SIZE.M,\n}) => {\n return (\n <span\n className={classNames(\n 'online-indicator',\n {\n [`online-indicator--size-${size}`]: Boolean(size),\n [`online-indicator--variant-${variant}`]: Boolean(variant),\n 'online-indicator--online': online,\n },\n className\n )}\n data-id=\"online_indicator\"\n />\n );\n};\n","import React, {useState} from 'react';\nimport {\n Box,\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n Typography,\n} from '@mui/material';\nimport {LoadingButton} from '@mui/lab';\nimport {pluralizeN} from 'app/components/helpers/commonHelpers';\nimport {NamesList} from 'app/components/sharedReactComponents/ItemsEnumeration';\nimport {useMounted} from 'app/hooks/useIsMounted';\nimport {Prompt} from 'app/types/common';\n\ntype Props = {\n names: string[];\n loading: boolean;\n onDelete: () => Promise<void>;\n onClose: () => void;\n};\n\nfunction DeleteGroups({names, loading, onDelete, onClose}: Props) {\n return (\n <Box>\n <DialogTitle>\n Delete <NamesList max={3} variant=\"inherit\" color=\"primary.main\" names={names} />{' '}\n {pluralizeN('group', names.length)}\n </DialogTitle>\n\n <DialogContent>\n <Typography>\n Devices currently assigned to this group will be moved out of the group\n </Typography>\n </DialogContent>\n\n <DialogActions>\n <LoadingButton\n data-id=\"confirm-delete-btn\"\n variant=\"contained\"\n color=\"error\"\n loading={loading}\n disableRipple={false}\n onClick={onDelete}\n >\n Delete\n </LoadingButton>\n\n <Button\n data-id=\"cancel-delete-btn\"\n variant=\"outlined\"\n color=\"info\"\n disableRipple={false}\n onClick={onClose}\n >\n Cancel\n </Button>\n </DialogActions>\n </Box>\n );\n}\n\ntype PromptProps = Prompt & Omit<Props, 'loading'>;\n\nexport function DeleteGroupsDialog({open, names, onDelete, onClose}: PromptProps) {\n const mounted = useMounted();\n const [loading, setLoading] = useState(false);\n\n const handleDelete = async () => {\n try {\n setLoading(true);\n await onDelete();\n } finally {\n if (mounted()) {\n setLoading(false);\n }\n }\n };\n\n return (\n <Dialog open={open} onClose={onClose}>\n <DeleteGroups loading={loading} names={names} onDelete={handleDelete} onClose={onClose} />\n </Dialog>\n );\n}\n","import React, {useState} from 'react';\nimport {Controller, useForm} from 'react-hook-form';\nimport {z} from 'zod';\nimport {zodResolver} from '@hookform/resolvers/zod';\nimport {\n Box,\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n Stack,\n TextField,\n} from '@mui/material';\nimport {LoadingButton} from '@mui/lab';\nimport {Prompt} from 'app/types/common';\nimport {useMounted} from 'app/hooks/useIsMounted';\nimport {isNil} from 'app/util/isNil';\n\nconst scheme = z.object({\n name: z.string().trim().min(1, {message: 'Required field'}),\n});\n\ntype Form = z.infer<typeof scheme>;\n\ntype Props = {\n name: string;\n loading: boolean;\n onRename: (name: string) => Promise<void>;\n onClose: () => void;\n};\n\nfunction RenameGroup({name, loading, onRename, onClose}: Props) {\n const {\n control,\n formState: {isValid},\n watch,\n handleSubmit,\n } = useForm<Form>({\n defaultValues: {name},\n mode: 'onChange',\n resolver: zodResolver(scheme),\n });\n\n const inputName = watch('name');\n\n const handleCreate = async ({name}: Form) => {\n await onRename(name);\n };\n\n return (\n <Box>\n <DialogTitle>Rename group</DialogTitle>\n\n <DialogContent>\n <Stack component=\"form\" id=\"rename-group\" onSubmit={handleSubmit(handleCreate)}>\n <Controller\n name=\"name\"\n control={control}\n render={({field, fieldState: {error}}) => (\n <TextField\n {...field}\n autoFocus={true}\n inputProps={{'data-id': 'group-name-input'}}\n label=\"Name\"\n variant=\"standard\"\n fullWidth={true}\n error={!isNil(error)}\n helperText={error?.message ?? ' '}\n />\n )}\n />\n </Stack>\n </DialogContent>\n\n <DialogActions>\n <LoadingButton\n data-id=\"confirm-rename-btn\"\n type=\"submit\"\n variant=\"contained\"\n color=\"secondary\"\n form=\"rename-group\"\n disabled={inputName === name || !isValid}\n loading={loading}\n >\n Rename\n </LoadingButton>\n\n <Button data-id=\"cancel-rename-btn\" variant=\"outlined\" color=\"info\" onClick={onClose}>\n Cancel\n </Button>\n </DialogActions>\n </Box>\n );\n}\n\ntype PromptProps = Prompt & Omit<Props, 'loading'>;\n\nexport function RenameGroupDialog({name, open, onClose, onRename}: PromptProps) {\n const mounted = useMounted();\n const [loading, setLoading] = useState(false);\n\n const handleRename = async (name: string) => {\n try {\n setLoading(true);\n await onRename(name);\n } finally {\n if (mounted()) {\n setLoading(false);\n }\n }\n };\n\n return (\n <Dialog maxWidth=\"xs\" fullWidth={true} open={open} onClose={onClose}>\n <RenameGroup name={name} loading={loading} onRename={handleRename} onClose={onClose} />\n </Dialog>\n );\n}\n","import React from 'react';\nimport {Sx} from 'app/types/common';\nimport {Box, Typography} from '@mui/material';\nimport {pluralizeN} from 'app/components/helpers/commonHelpers';\n\ntype Props = Sx & {\n groups: number;\n devices: number;\n channels: number;\n};\n\nexport function SelectionSummary({sx, devices, channels, groups}: Props) {\n return (\n <Box sx={sx}>\n {groups > 0 && (\n <Typography fontWeight={600}>\n {groups} {pluralizeN('Group', groups)}\n </Typography>\n )}\n\n {devices > 0 && (\n <Typography fontWeight={600}>\n {devices} {pluralizeN('Device', devices)}\n </Typography>\n )}\n\n {channels > 0 && (\n <Typography>\n {channels} {pluralizeN('Channel', channels)}\n </Typography>\n )}\n </Box>\n );\n}\n","import React from 'react';\nimport classNames from 'classnames';\nimport {ProgressButton} from 'app/components/sharedReactComponents/ProgressButton';\nimport {Icons} from 'app/util/icons';\nimport {SIZE, THEME} from 'app/constants';\nimport {TooltipMultipleMessages} from 'app/components/sharedReactComponents/Tooltip/TooltipMultipleMessages';\nimport {Callback, ClassName, WarningBaseType} from 'app/types/common';\n\ntype Warning = WarningBaseType & {\n deviceName: string;\n};\n\ninterface ControlProps {\n warnings: Warning[];\n canStart: boolean;\n canStop: boolean;\n startAction: Callback;\n stopAction: Callback;\n dataId?: string;\n}\n\nexport function StreamBatchActionControl({\n warnings,\n canStart,\n canStop,\n startAction,\n stopAction,\n dataId,\n}: ControlProps) {\n return (\n <BatchActionControl\n className=\"batch-action-control--stream\"\n dataId={dataId}\n label=\"Stream\"\n startIcon={Icons.streaming().size(SIZE.S).reactComponent()}\n startTooltipMessage=\"Start Streaming\"\n stopTooltipMessage=\"Stop Streaming\"\n warnings={warnings}\n canStart={canStart}\n canStop={canStop}\n startAction={startAction}\n stopAction={stopAction}\n />\n );\n}\n\nexport function RecordBatchActionControl({\n warnings,\n canStart,\n canStop,\n startAction,\n stopAction,\n dataId,\n}: ControlProps) {\n return (\n <BatchActionControl\n className=\"batch-action-control--record\"\n dataId={dataId}\n label=\"Record\"\n startIcon={Icons.record().size(SIZE.S).reactComponent()}\n startTooltipMessage=\"Start Recording\"\n stopTooltipMessage=\"Stop Recording\"\n warnings={warnings}\n canStart={canStart}\n canStop={canStop}\n startAction={startAction}\n stopAction={stopAction}\n />\n );\n}\n\nexport function TranscribeBatchActionControl({\n warnings,\n canStart,\n canStop,\n startAction,\n stopAction,\n dataId,\n}: ControlProps) {\n return (\n <BatchActionControl\n className=\"batch-action-control--transcribe\"\n dataId={dataId}\n label=\"Transcribe\"\n startIcon={Icons.liveScrypt().size(SIZE.S).reactComponent()}\n startTooltipMessage=\"Start Transcribing\"\n stopTooltipMessage=\"Stop Transcribing\"\n warnings={warnings}\n canStart={canStart}\n canStop={canStop}\n startAction={startAction}\n stopAction={stopAction}\n />\n );\n}\n\ninterface ActionProps {\n title: string;\n // children: node;\n disabled: boolean;\n action: Callback;\n}\n\nconst ActionButton: React.FC<ActionProps> = ({\n title,\n children,\n disabled,\n action,\n ...elementProps\n}) => {\n return (\n <ProgressButton title={title} disabled={disabled} onClick={action} {...elementProps}>\n {children}\n </ProgressButton>\n );\n};\n\ninterface Props extends ClassName, ControlProps {\n label: string;\n startIcon: React.ReactNode;\n startTooltipMessage: string;\n stopTooltipMessage: string;\n dataId?: string;\n}\n\nfunction BatchActionControl({\n className,\n label,\n startIcon,\n startTooltipMessage,\n stopTooltipMessage,\n warnings,\n canStart,\n canStop,\n startAction,\n stopAction,\n dataId,\n}: Props) {\n return (\n <div\n className={classNames(\n 'batch-action-control',\n {\n 'batch-action-control--enabled': canStart || canStop,\n },\n className,\n )}\n data-id={dataId}\n >\n <div className=\"batch-action-control__label\">{label}</div>\n\n <div className=\"batch-action-control__action-item\">\n <ActionButton\n data-id=\"batch_action_control_start_button\"\n title={startTooltipMessage}\n disabled={canStart === false}\n action={startAction}\n >\n {startIcon}\n </ActionButton>\n\n {warnings.length > 0 && (\n <TooltipMultipleMessages\n messages={warnings.map(({deviceName, message}) => ({\n message: `${deviceName}: ${message}`,\n }))}\n theme={THEME.DANGER}\n preformatted={true}\n >\n <span className=\"batch-action-control__warning-indicator\">\n {Icons.warning().size(SIZE.S).reactComponent()}\n </span>\n </TooltipMultipleMessages>\n )}\n </div>\n\n <div className=\"batch-action-control__action-item\">\n <ActionButton\n data-id=\"batch_action_control_stop_button\"\n title={stopTooltipMessage}\n disabled={canStop === false}\n action={stopAction}\n >\n {Icons.stop().size(SIZE.S).reactComponent()}\n </ActionButton>\n </div>\n </div>\n );\n}\n","import {useEffect, useState} from 'react';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {ModelService} from 'app/services/deviceModel/DeviceModelService';\nimport {Cloud} from 'app/domain/cloud';\n\ntype State = {\n started: AnyDeviceModelType[];\n stopped: AnyDeviceModelType[];\n};\n\ntype Statistic = {\n streaming: State & {selectedDestinations: boolean};\n recording: State;\n transcribing: State;\n};\n\nexport function useBatchMultimedia(devices: AnyDeviceModelType[]): Statistic {\n const [state, setState] = useState(() => getDefaultState());\n\n useEffect(() => {\n const state = getDefaultState();\n\n devices.forEach((device) => {\n if (device.isOffline()) {\n return;\n }\n\n const model = device.getModelName();\n\n if (device.capabilities.streaming && isChannelOrWebcaster(model)) {\n if (device.isStreaming() || device.isStreamingStarted()) {\n state.streaming.started.push(device);\n } else {\n state.streaming.stopped.push(device);\n }\n\n const hasSelectedTargets =\n Boolean(device.getSelectedStreamingDestinationId()) ||\n device.getSelectedPublisherIds().length > 0;\n\n if (!state.streaming.selectedDestinations && hasSelectedTargets) {\n state.streaming.selectedDestinations = true;\n }\n }\n\n if (device.capabilities.recording && isChannelOrWebcaster(model)) {\n if (device.isRecording()) {\n state.recording.started.push(device);\n } else {\n state.recording.stopped.push(device);\n }\n }\n\n if (device.capabilities.transcribing) {\n if (device.isTranscribing()) {\n state.transcribing.started.push(device);\n } else {\n state.transcribing.stopped.push(device);\n }\n }\n });\n\n setState(state);\n }, [devices]);\n\n return state;\n}\n\nfunction isChannelOrWebcaster(model: Cloud.UnitModel) {\n return ModelService.isWebcaster(model) || ModelService.isChannel(model);\n}\n\nfunction getDefaultState(): Statistic {\n return {\n streaming: {started: [], stopped: [], selectedDestinations: false},\n recording: {started: [], stopped: []},\n transcribing: {started: [], stopped: []},\n };\n}\n","import React, {useState} from 'react';\nimport {Stack} from '@mui/material';\nimport {\n StreamBatchActionControl,\n RecordBatchActionControl,\n TranscribeBatchActionControl,\n} from 'app/components/FleetManager/BatchActionsPanel/BatchActionControl';\nimport {Sx} from 'app/types/common';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {useBatchMultimedia} from 'app/components/features/edge/BatchDevices/MultimediaControls/useBatchMultimedia';\nimport {DeviceApiService} from 'app/services/api/device/DeviceApiService';\nimport {EdgeContract} from 'app/contracts/edge';\nimport {LiveScryptDeviceModel} from 'app/components/DeviceDetails/Models/LiveScryptDeviceModel';\n\ntype DeviceWaning = {\n deviceName: string;\n message: string;\n};\n\ntype MediaWarnings = {\n recording: DeviceWaning[];\n transcribing: DeviceWaning[];\n};\n\ntype Props = Sx & {\n devices: AnyDeviceModelType[];\n};\n\nexport function MultimediaControls({sx, devices}: Props) {\n const {streaming, recording, transcribing} = useBatchMultimedia(devices);\n\n const [warnings, setWarnings] = useState<MediaWarnings>(() => ({\n recording: [],\n transcribing: [],\n }));\n\n const handleStartStreaming = async () => {\n return Promise.all(streaming.stopped.map((device) => device.startStreaming()));\n };\n\n const handleStopStreaming = async () => {\n return Promise.all(streaming.started.map((device) => device.stopStreaming()));\n };\n\n const handleStartRecording = async () => {\n setWarnings((prev) => ({...prev, recording: []}));\n\n const response = await runTask('recording.start', recording.stopped);\n\n setWarnings((prev) => ({...prev, recording: collectWarnings(response, recording.stopped)}));\n };\n\n const handleStopRecording = async () => {\n setWarnings((prev) => ({...prev, recording: []}));\n\n const response = await runTask('recording.stop', recording.started);\n\n setWarnings((prev) => ({...prev, recording: collectWarnings(response, recording.started)}));\n };\n\n const handleStartTranscribing = async () => {\n return Promise.all(\n transcribing.stopped.map((device) => {\n if (device instanceof LiveScryptDeviceModel) {\n return device.startTranscribing();\n }\n\n return Promise.resolve();\n }),\n );\n };\n\n const handleStopTranscribing = async () => {\n return Promise.all(\n transcribing.stopped.map((device) => {\n if (device instanceof LiveScryptDeviceModel) {\n return device.stopTranscribing();\n }\n\n return Promise.resolve();\n }),\n );\n };\n\n return (\n <Stack sx={sx} direction=\"row\" alignItems=\"center\" gap={3}>\n <StreamBatchActionControl\n dataId=\"stream_batch_action_control\"\n warnings={[]}\n canStart={streaming.stopped.length > 0 && streaming.selectedDestinations}\n canStop={streaming.started.length > 0}\n startAction={handleStartStreaming}\n stopAction={handleStopStreaming}\n />\n\n <RecordBatchActionControl\n dataId=\"record_batch_action_control\"\n warnings={warnings.recording}\n canStart={recording.stopped.length > 0}\n canStop={recording.started.length > 0}\n startAction={handleStartRecording}\n stopAction={handleStopRecording}\n />\n\n <TranscribeBatchActionControl\n dataId=\"transcribe_batch_action_control\"\n warnings={warnings.transcribing}\n canStart={transcribing.stopped.length > 0}\n canStop={transcribing.started.length > 0}\n startAction={handleStartTranscribing}\n stopAction={handleStopTranscribing}\n />\n </Stack>\n );\n}\n\nasync function runTask(command: string, devices: AnyDeviceModelType[]) {\n const ids = devices.map((device) => device.getId());\n return DeviceApiService.sendBatchTask(command, ids);\n}\n\nfunction collectWarnings(response: EdgeContract.BatchResponse, devices: AnyDeviceModelType[]) {\n const map = new Map(devices.map((device) => [device.getId(), device]));\n\n return response.reduce<DeviceWaning[]>((acc, result) => {\n if (result.Error) {\n const deviceName = map.get(result.Device)?.getName() || 'Unknown device';\n\n const warning: DeviceWaning = {\n deviceName,\n message: result.Error,\n };\n\n return [...acc, warning];\n }\n\n return acc;\n }, []);\n}\n","import {useEffect, useMemo, useState} from 'react';\nimport {useQuery} from '@tanstack/react-query';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {DeviceApiService} from 'app/services/api/device/DeviceApiService';\nimport {isNil} from 'app/util/isNil';\nimport {Edge} from 'app/domain/edge';\n\nexport function useBatchFirmware(devices: AnyDeviceModelType[]) {\n const [upgradeable, setUpgradeable] = useState<AnyDeviceModelType[]>([]);\n\n const ids = useMemo(() => {\n return devices\n .filter((d) => d.isOnline())\n .map((d) => d.getId())\n .sort();\n }, [devices]);\n\n const enabledCheck = ids.length > 0;\n\n const {data, isInitialLoading, refetch} = useQuery({\n queryKey: ['batch-firmware', ...ids],\n queryFn: async () => {\n const response = await DeviceApiService.getDevicesFirmware(ids);\n return mapFirmware(response);\n },\n enabled: enabledCheck,\n });\n\n useEffect(() => {\n if (isNil(data)) {\n setUpgradeable([]);\n return;\n }\n\n const result = devices.filter((d) => {\n const firmware = data.get(d.getId());\n return firmware ? firmware.update?.status === 'available' : false;\n });\n\n setUpgradeable(result);\n }, [data, devices]);\n\n return {upgradeable, firmwareLoading: isInitialLoading, refetchFirmware: refetch};\n}\n\nfunction mapFirmware(c: Record<string, Edge.Firmware>): Map<string, Edge.Firmware> {\n const entries = Object.entries(c).map(([k, v]) => [k, v] as const);\n return new Map(entries);\n}\n","import React, {forwardRef, PropsWithChildren} from 'react';\nimport classNames from 'classnames';\nimport {Button} from 'app/components/sharedReactComponents/Button';\nimport {Callback, ClassName} from 'app/types/common';\n\ninterface Props extends ClassName {\n opened?: boolean;\n title?: React.ReactNode;\n disabled?: boolean;\n onClick?: Callback;\n}\n\nexport const BatchActionButton = forwardRef<any, PropsWithChildren<Props>>(\n ({className, opened, title, children, disabled, onClick, ...elementProps}, ref) => {\n return (\n <Button\n ref={ref}\n className={classNames(\n 'batch-action-button',\n opened && 'batch-action-button--opened',\n className,\n )}\n title={title}\n disabled={disabled}\n onClick={onClick}\n {...elementProps}\n >\n {children}\n </Button>\n );\n },\n);\n","import React, {useState} from 'react';\nimport {Button, Dialog, DialogActions, DialogContent, DialogTitle, Typography} from '@mui/material';\nimport {LoadingButton} from '@mui/lab';\nimport {Prompt} from 'app/types/common';\nimport {NamesList} from 'app/components/sharedReactComponents/ItemsEnumeration';\nimport {pluralize} from 'app/components/helpers/commonHelpers';\nimport {useMounted} from 'app/hooks/useIsMounted';\n\ninterface Props extends Prompt {\n names: string[];\n onUpdate: () => Promise<void>;\n}\n\nexport function BatchFirmwareDialog({open, names, onUpdate, onClose}: Props) {\n const [loading, setLoading] = useState(false);\n\n const mounted = useMounted();\n\n const handleUpdate = async () => {\n setLoading(true);\n\n try {\n await onUpdate();\n } finally {\n if (mounted()) {\n setLoading(false);\n }\n }\n };\n\n return (\n <Dialog open={open} onClose={onClose}>\n <DialogTitle>\n Update your <NamesList names={names} variant=\"inherit\" color=\"primary.main\" />{' '}\n {pluralize('device', names)} firmware\n </DialogTitle>\n\n <DialogContent>\n <Typography textAlign=\"center\">\n During update process, your {pluralize('device', names)} will be offline.\n <br />\n Your {pluralize('device', names)} will reboot automatically after the firmware has been\n downloaded.\n </Typography>\n </DialogContent>\n\n <DialogActions>\n <LoadingButton\n data-i=\"confirm-upd-btn\"\n variant=\"contained\"\n color=\"secondary\"\n loading={loading}\n onClick={handleUpdate}\n >\n Update\n </LoadingButton>\n\n <Button data-id=\"cancel-upd-btn\" variant=\"outlined\" color=\"info\" onClick={onClose}>\n Cancel\n </Button>\n </DialogActions>\n </Dialog>\n );\n}\n","import React, {useMemo, useState} from 'react';\nimport {Stack, Typography} from '@mui/material';\nimport AutorenewIcon from '@mui/icons-material/Autorenew';\nimport {BatchActionButton} from 'app/components/FleetManager/BatchActionsPanel/BatchActionButton';\nimport {BatchFirmwareDialog} from 'app/components/FleetManager/BatchActionsPanel/dialogs/BatchFirmwareDialog/BatchFirmwareDialog';\nimport {LoadingWrapper} from 'app/components/sharedReactComponents/LoadingWrapper';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {DeviceApiService} from 'app/services/api/device/DeviceApiService';\n\ntype Props = {\n devices: AnyDeviceModelType[];\n loading: boolean;\n refetch: () => Promise<any>;\n};\n\nexport function BatchFirmware({devices, loading, refetch}: Props) {\n const [dialog, setDialog] = useState(false);\n\n const names = useMemo(() => devices.map((d) => d.getName()), [devices]);\n\n const handleUpdate = async () => {\n const ids = devices.map((d) => d.getId());\n\n await DeviceApiService.sendBatchTask('firmware.update', ids);\n await refetch();\n\n setDialog(false);\n };\n\n return (\n <>\n <BatchFirmwareDialog\n open={dialog}\n names={names}\n onUpdate={handleUpdate}\n onClose={() => setDialog(false)}\n />\n\n <LoadingWrapper loading={loading}>\n <BatchActionButton\n data-id=\"batch_action_firmware_update\"\n title=\"Update Firmware\"\n onClick={() => setDialog(true)}\n >\n <Stack direction=\"row\" alignItems=\"center\">\n <AutorenewIcon />\n <Typography>{devices.length}</Typography>\n </Stack>\n </BatchActionButton>\n </LoadingWrapper>\n </>\n );\n}\n","import React from 'react';\nimport {Box, Button, DialogActions, DialogContent, DialogTitle, Typography} from '@mui/material';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {LoadingButton} from '@mui/lab';\n\ninterface Props {\n devices: AnyDeviceModelType[];\n loading: boolean;\n onRemove: () => Promise<void>;\n onCancel: () => void;\n}\n\nexport function RemoveFromGroup({devices, loading, onRemove, onCancel}: Props) {\n const singleDevice = devices.length === 1;\n\n return (\n <Box>\n <DialogTitle>Remove from group</DialogTitle>\n <DialogContent>\n <Typography textAlign=\"center\">\n You are about to ungroup{' '}\n <Typography component=\"span\" color=\"primary.main\">\n {singleDevice ? `${devices[0]?.getName() ?? ''}` : `${devices.length} devices`}\n </Typography>\n </Typography>\n </DialogContent>\n <DialogActions>\n <LoadingButton\n data-id=\"confirm-remove-btn\"\n loading={loading}\n variant=\"contained\"\n color=\"error\"\n disableRipple={false}\n onClick={onRemove}\n >\n Remove\n </LoadingButton>\n\n <Button\n data-id=\"cancel-remove-btn\"\n variant=\"outlined\"\n color=\"info\"\n disableRipple={false}\n onClick={onCancel}\n >\n Cancel\n </Button>\n </DialogActions>\n </Box>\n );\n}\n","import React, {useState} from 'react';\nimport {Dialog} from '@mui/material';\nimport {Prompt} from 'app/types/common';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {RemoveFromGroup} from 'app/components/dialogs/RemoveFromGroupDialog/RemoveFromGroup';\n\ntype Props = Prompt & {\n devices: AnyDeviceModelType[];\n onRemove: () => Promise<void>;\n};\n\nexport function RemoveFromGroupDialog({open, devices, onRemove, onClose}: Props) {\n const [loading, setLoading] = useState(false);\n\n const handleRemove = async () => {\n try {\n setLoading(true);\n await onRemove();\n } finally {\n setLoading(false);\n }\n };\n\n return (\n <Dialog open={open} fullWidth={true} maxWidth=\"xs\" keepMounted={false} onClose={onClose}>\n <RemoveFromGroup\n devices={devices}\n loading={loading}\n onRemove={handleRemove}\n onCancel={onClose}\n />\n </Dialog>\n );\n}\n","import React, {useMemo, useState} from 'react';\nimport {Stack, Tooltip} from '@mui/material';\nimport CreateNewFolderIcon from '@mui/icons-material/CreateNewFolder';\nimport FolderDeleteIcon from '@mui/icons-material/FolderDelete';\nimport DriveFileMoveIcon from '@mui/icons-material/DriveFileMove';\nimport {BatchActionButton} from 'app/components/FleetManager/BatchActionsPanel/BatchActionButton';\nimport {Edge} from 'app/domain/edge';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {MoveToGroupDialog} from 'app/components/dialogs/MoveToGroupDialog/MoveToGroupDialog';\nimport {RemoveFromGroupDialog} from 'app/components/dialogs/RemoveFromGroupDialog/RemoveFromGroupDialog';\nimport {Sx} from 'app/types/common';\nimport {DeleteGroupsDialog} from 'app/components/dialogs/DeleteGroupsDialog/DeleteGroupsDialog';\nimport {useMounted} from 'app/hooks/useIsMounted';\nimport {DeviceGroupApiService} from 'app/services/api/deviceGroup/DeviceGroupApiService';\n\ntype Props = Sx & {\n devices: AnyDeviceModelType[];\n groups: Edge.Group[];\n allGroups: Edge.Group[];\n};\n\nexport function BatchGroups({sx, devices, groups, allGroups}: Props) {\n const [deleteDialog, setDeleteDialog] = useState(false);\n const [moveInDialog, setMoveInDialog] = useState(false);\n const [moveOutDialog, setMoveOutDialog] = useState(false);\n\n const mounted = useMounted();\n const {grouped, availableGroups} = useActionGroups(devices, allGroups);\n\n const handleMoveToGroup = async (groupId: string) => {\n await DeviceGroupApiService.batchMoveToGroup(\n groupId,\n devices.map((d) => d.getId()),\n );\n\n if (mounted()) {\n setMoveInDialog(false);\n }\n };\n\n const handleRemoveFromGroup = async () => {\n await DeviceGroupApiService.batchRemoveDevices(grouped.map((d) => d.getId()));\n\n if (mounted()) {\n setMoveOutDialog(false);\n }\n };\n\n const handleDelete = async () => {\n await DeviceGroupApiService.batchDelete(groups.map((group) => group.id));\n\n if (mounted()) {\n setDeleteDialog(false);\n }\n };\n\n return (\n <>\n <Stack sx={sx} direction=\"row\" alignItems=\"center\" gap={1}>\n {groups.length > 0 && (\n <Tooltip title=\"Delete groups\">\n <BatchActionButton data-id=\"remove-group-btn\" onClick={() => setDeleteDialog(true)}>\n <FolderDeleteIcon />\n </BatchActionButton>\n </Tooltip>\n )}\n\n {devices.length > 0 && (\n <Tooltip title=\"Move to group\">\n <BatchActionButton data-id=\"add-to-group-btn\" onClick={() => setMoveInDialog(true)}>\n <CreateNewFolderIcon />\n </BatchActionButton>\n </Tooltip>\n )}\n\n {grouped.length > 0 && (\n <Tooltip title=\"Remove from group\">\n <BatchActionButton\n data-id=\"remove-from-group-btn\"\n onClick={() => setMoveOutDialog(true)}\n >\n <DriveFileMoveIcon />\n </BatchActionButton>\n </Tooltip>\n )}\n </Stack>\n\n <MoveToGroupDialog\n open={moveInDialog}\n devices={devices}\n groups={availableGroups}\n onMove={handleMoveToGroup}\n onClose={() => setMoveInDialog(false)}\n />\n\n <RemoveFromGroupDialog\n open={moveOutDialog}\n devices={grouped}\n onRemove={handleRemoveFromGroup}\n onClose={() => setMoveOutDialog(false)}\n />\n\n <DeleteGroupsDialog\n open={deleteDialog}\n names={groups.map((g) => g.name)}\n onDelete={handleDelete}\n onClose={() => setDeleteDialog(false)}\n />\n </>\n );\n}\n\nfunction useActionGroups(devices: AnyDeviceModelType[], allGroups: Edge.Group[]) {\n return useMemo(() => {\n const grouped = devices.filter((device) => Boolean(device.getGroupId()));\n const currentGroups = new Set(grouped.map((d) => d.getGroupId()));\n const availableGroups = allGroups.filter((g) => !currentGroups.has(g.id));\n\n return {grouped, availableGroups};\n }, [devices, allGroups]);\n}\n","import React, {useMemo, useState} from 'react';\nimport {Stack, Tooltip} from '@mui/material';\nimport RestartAltIcon from '@mui/icons-material/RestartAlt';\nimport DeleteIcon from '@mui/icons-material/Delete';\nimport TuneIcon from '@mui/icons-material/Tune';\nimport {Sx} from 'app/types/common';\nimport {BatchActionButton} from 'app/components/FleetManager/BatchActionsPanel/BatchActionButton';\nimport {RebootDevicesDialog} from 'app/components/dialogs/RebootDevicesDialog/RebootDevicesDialog';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {ModelService} from 'app/services/deviceModel/DeviceModelService';\nimport {DeleteDevicesDialog} from 'app/components/dialogs/DeleteDevicesDialog/DeleteDevicesDialog';\nimport {DeviceApiService} from 'app/services/api/device/DeviceApiService';\nimport {PresetApiService} from 'app/services/api/preset/PresetApiService';\nimport {Edge} from 'app/domain/edge';\nimport {ApplyPresetToDevicesDialog} from 'app/components/dialogs/ApplyPresetToDevicesDialog/ApplyPresetToDevicesDialog';\nimport {Cloud} from 'app/domain/cloud';\nimport {useMounted} from 'app/hooks/useIsMounted';\n\ntype Props = Sx & {\n devices: AnyDeviceModelType[];\n presets: Edge.TeamPreset[];\n permitReboot: boolean;\n permitPreset: boolean;\n};\n\nexport function BatchActions({sx, devices, presets, permitPreset, permitReboot}: Props) {\n const [rebootDialog, setRebootDialog] = useState(false);\n const [deleteDialog, setDeleteDialog] = useState(false);\n const [presetDialog, setPresetDialog] = useState(false);\n\n const mounted = useMounted();\n const {rebootable, lvsOnly, configurable, presetModel} = useActionDevices(devices);\n\n const handleReboot = async () => {\n if (!permitReboot) {\n return;\n }\n\n await Promise.allSettled(rebootable.map((d) => d.sendRebootCommand()));\n\n if (mounted()) {\n setRebootDialog(false);\n }\n };\n\n const handleDelete = async () => {\n const promises = devices.map((device) => DeviceApiService.deleteDevice(device.getId()));\n await Promise.allSettled(promises);\n\n if (mounted()) {\n setDeleteDialog(false);\n }\n };\n\n const handleApplyPreset = async (preset: Edge.TeamPreset) => {\n if (!permitPreset) {\n return;\n }\n\n const promises = configurable.map((device) =>\n PresetApiService.applyTeamPreset(device.getId(), preset),\n );\n await Promise.allSettled(promises);\n\n if (mounted()) {\n setPresetDialog(false);\n }\n };\n\n const presetTooltip = presetModel\n ? 'Apply preset'\n : 'Select devices with the same model to apply preset';\n\n return (\n <>\n <Stack sx={sx} direction=\"row\" alignItems=\"center\" gap={1}>\n {permitPreset && configurable.length > 0 && (\n <Tooltip title={presetTooltip}>\n <span>\n <BatchActionButton\n data-id=\"preset-btn\"\n disabled={!presetModel}\n onClick={() => setPresetDialog(true)}\n >\n <TuneIcon />\n </BatchActionButton>\n </span>\n </Tooltip>\n )}\n\n {permitReboot && rebootable.length > 0 && (\n <Tooltip title=\"Reboot\">\n <BatchActionButton data-id=\"reboot-btn\" onClick={() => setRebootDialog(true)}>\n <RestartAltIcon />\n </BatchActionButton>\n </Tooltip>\n )}\n\n {devices.length > 0 && (\n <Tooltip title=\"Delete\">\n <BatchActionButton data-id=\"delete-btn\" onClick={() => setDeleteDialog(true)}>\n <DeleteIcon />\n </BatchActionButton>\n </Tooltip>\n )}\n </Stack>\n\n <RebootDevicesDialog\n open={rebootDialog}\n names={rebootable.map((r) => r.getName())}\n onReboot={handleReboot}\n onClose={() => setRebootDialog(false)}\n />\n\n <DeleteDevicesDialog\n open={deleteDialog}\n names={devices.map((d) => d.getName())}\n lvsOnly={lvsOnly}\n onDelete={handleDelete}\n onClose={() => setDeleteDialog(false)}\n />\n\n {presetModel && (\n <ApplyPresetToDevicesDialog\n open={presetDialog}\n unitCount={configurable.length}\n model={presetModel}\n presets={presets}\n rebootWarning={true}\n onApply={handleApplyPreset}\n onClose={() => setPresetDialog(false)}\n />\n )}\n </>\n );\n}\n\nfunction useActionDevices(devices: AnyDeviceModelType[]) {\n return useMemo(() => {\n const online = devices.filter((d) => d.isOnline());\n\n const configurable = online.filter((device) => device.capabilities.presets);\n const rebootable = online.filter((device) => device.capabilities.reboot);\n\n const lvsOnly = devices.every((m) => ModelService.isLivescrypt(m.getModelName()));\n\n const models = new Set(configurable.map((d) => d.getModelName() as Cloud.UnitModel));\n\n const presetModel = models.size === 1 ? [...models][0] : undefined;\n\n return {online, configurable, rebootable, lvsOnly, presetModel};\n }, [devices]);\n}\n","import React, {useMemo} from 'react';\nimport {Card, Divider, IconButton, Stack, Tooltip} from '@mui/material';\nimport {grey} from '@mui/material/colors';\nimport CloseIcon from '@mui/icons-material/Close';\nimport {StyleSx, Sx} from 'app/types/common';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {Edge} from 'app/domain/edge';\nimport {SelectionSummary} from 'app/components/features/edge/BatchDevices/SelectionSummary/SelectionSummary';\nimport {useCountBatched} from 'app/components/features/edge/BatchDevices/hooks/useCountBatched';\nimport {MultimediaControls} from 'app/components/features/edge/BatchDevices/MultimediaControls/MultimediaControls';\nimport {useBatchFirmware} from 'app/components/features/edge/BatchDevices/hooks/useBatchFirmware';\nimport {BatchFirmware} from 'app/components/features/edge/BatchDevices/BatchFirmware/BatchFirmware';\nimport {BatchGroups} from 'app/components/features/edge/BatchDevices/BatchGroups/BatchGroups';\nimport {BatchActions} from 'app/components/features/edge/BatchDevices/BatchActions/BatchActions';\nimport {ModelService} from 'app/services/deviceModel/DeviceModelService';\n\nconst rootSx: StyleSx = {\n display: 'flex',\n alignItems: 'center',\n gap: 1,\n color: 'white',\n bgcolor: grey[900],\n borderRadius: 0,\n pl: 3,\n pr: 2,\n};\n\nconst summarySx: StyleSx = {minWidth: 120};\nconst mediaSx: StyleSx = {mr: 'auto'};\n\ntype Props = Sx & {\n devices: AnyDeviceModelType[];\n groups: Edge.Group[];\n allGroups: Edge.Group[];\n presets: Edge.TeamPreset[];\n permitReboot: boolean;\n permitPreset: boolean;\n onClose: () => void;\n};\n\nexport const BatchDevices = React.forwardRef<HTMLDivElement, Props>(\n ({sx, devices, groups, allGroups, presets, permitPreset, permitReboot, onClose}, ref) => {\n const count = useCountBatched(devices);\n\n const masters = useMemo(\n () => devices.filter((d) => !ModelService.isChannel(d.getModelName())),\n [devices],\n );\n\n const {upgradeable, firmwareLoading, refetchFirmware} = useBatchFirmware(masters);\n\n return (\n <Card ref={ref} sx={packSx(rootSx, sx)} variant=\"elevation\" elevation={8}>\n <SelectionSummary\n sx={summarySx}\n groups={groups.length}\n devices={count.devices}\n channels={count.channels}\n />\n\n <MultimediaControls sx={mediaSx} devices={devices} />\n\n <Stack\n direction=\"row\"\n alignItems=\"center\"\n mr={3}\n gap={1}\n divider={<Divider sx={{borderColor: grey[800]}} orientation=\"vertical\" flexItem={true} />}\n >\n {upgradeable.length > 0 && (\n <BatchFirmware\n devices={upgradeable}\n loading={firmwareLoading}\n refetch={refetchFirmware}\n />\n )}\n\n {(masters.length > 0 || groups.length > 0) && (\n <BatchGroups devices={masters} groups={groups} allGroups={allGroups} />\n )}\n\n {masters.length > 0 && (\n <BatchActions\n devices={masters}\n presets={presets}\n permitPreset={permitPreset}\n permitReboot={permitReboot}\n />\n )}\n </Stack>\n\n <Tooltip title=\"Close and reset selection\">\n <IconButton color=\"inherit\" onClick={onClose}>\n <CloseIcon />\n </IconButton>\n </Tooltip>\n </Card>\n );\n },\n);\n","import {useEffect, useState} from 'react';\nimport {ModelService} from 'app/services/deviceModel/DeviceModelService';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {PearlSlotDeviceModel} from 'app/components/DeviceDetails/Models/PearlSlotDeviceModel';\n\ntype State = {\n devices: number;\n channels: number;\n};\n\nexport function useCountBatched(devices: AnyDeviceModelType[]) {\n const [state, setState] = useState<State>({devices: 0, channels: 0});\n\n useEffect(() => {\n const counter: State = {devices: 0, channels: 0};\n\n const multiSlotDevices = new Set<string>();\n\n devices.forEach((device) => {\n if (ModelService.isChannel(device.getModelName())) {\n const masterId = (device as PearlSlotDeviceModel).getChannelDeviceMasterDeviceId();\n multiSlotDevices.add(masterId);\n counter.channels += 1;\n return;\n }\n\n if (ModelService.isMultiChannel(device.getModelName())) {\n const masterId = device.getId();\n multiSlotDevices.add(masterId);\n return;\n }\n\n counter.devices += 1;\n });\n\n counter.devices += multiSlotDevices.size;\n\n setState(counter);\n }, [devices]);\n\n return state;\n}\n","import {useReducer} from 'react';\n\n/**\n * {@link https://usehooks.com/useToggle/}\n * @param {boolean} [initialValue=false]\n * @return {[boolean, function]}\n *\n * ```typescript\n * const [disabled, toggleDisabled] = useToggle();\n * ```\n */\nexport function useToggle(initialValue = false) {\n return useReducer((state) => !state, initialValue);\n}\n","const stringComparator = (a?: string, b?: string): number => {\n if (typeof a === 'string') {\n if (typeof b === 'string') {\n return a.localeCompare(b, undefined, {\n sensitivity: 'base',\n numeric: true,\n });\n }\n\n return -1;\n }\n\n if (typeof b === 'string') {\n return 1;\n }\n\n return 0;\n};\n\nconst negativeStringComparator = (a?: string, b?: string): number => stringComparator(b, a);\n\ntype Data = Record<string, any>;\ntype PropGetter = (a: Data) => string;\n\nconst createStringComparator = (propName: string | PropGetter): ((a: Data, b: Data) => number) => {\n const propGetter: PropGetter = typeof propName === 'function' ? propName : item => item[propName];\n return (a, b) => stringComparator(propGetter(a), propGetter(b));\n};\n\nconst curriedSortBy = (propName: string | PropGetter) => (list: any[]) => {\n const comparator = createStringComparator(propName);\n return list.sort(comparator);\n};\n\nexport {\n stringComparator,\n negativeStringComparator,\n createStringComparator,\n curriedSortBy,\n};\n","import {useCallback, useEffect, useState} from 'react';\nimport {FilterSwitchGroupId} from 'app/components/FleetManager/useFilterSwitches';\nimport {stringComparator} from 'app/util/Sort';\nimport {toggleInSet} from 'app/util/toggleInSet';\nimport {FilterSwitch} from 'app/components/sharedReactComponents/FilterSelector/types';\nimport {Edge} from 'app/domain/edge';\nimport {isNil} from 'app/util/isNil';\nimport {containsSearchString, filterPresets} from 'app/components/FleetManager/utils';\n\nexport const deviceModelFilterGroups = [\n {\n id: FilterSwitchGroupId.Model,\n label: 'Device model',\n },\n];\n\nfunction createDeviceModelNameFilter(modelName: string): FilterSwitch {\n return {\n id: modelName,\n group: FilterSwitchGroupId.Model,\n label: modelName,\n callback: (preset: Edge.TeamPreset) => preset.device === modelName,\n };\n}\n\ninterface Return {\n filtered: Edge.TeamPreset[];\n search: string;\n filters: FilterSwitch[];\n activeFilters: FilterSwitch[];\n activeSet: Set<string>;\n setSearch: (value: string) => void;\n toggleFilter: (id: string) => void;\n clearFilters: () => void;\n}\n\nexport function useTeamPresetsFilters(presets?: Edge.TeamPreset[]): Return {\n const [filters, setFilters] = useState<FilterSwitch[]>([]);\n const [activeSet, setActiveSet] = useState<Set<string>>(new Set());\n const [activeFilters, setActiveFilters] = useState<FilterSwitch[]>([]);\n const [search, setSearch] = useState('');\n const [filtered, setFiltered] = useState<Edge.TeamPreset[]>(presets ?? []);\n\n useEffect(() => {\n const distinctModels = [...new Set(presets?.map(({device}) => device ?? '').filter((m) => m))];\n\n if (distinctModels.length) {\n const filters = distinctModels.sort(stringComparator).map(createDeviceModelNameFilter);\n return setFilters(filters);\n }\n\n setFilters([]);\n }, [presets]);\n\n useEffect(() => {\n setActiveFilters(filters.filter((f) => activeSet.has(f.id)));\n }, [activeSet, filters]);\n\n const trimmedSearch = search.trim();\n\n useEffect(() => {\n if (isNil(presets)) {\n setFiltered([]);\n return;\n }\n\n let result: Edge.TeamPreset[] = [...presets];\n\n if (trimmedSearch.length > 0) {\n result = result.filter((preset) => containsSearchString(preset.name, trimmedSearch));\n }\n\n if (activeFilters.length > 0) {\n result = filterPresets(result, activeFilters);\n }\n\n setFiltered(result);\n }, [presets, activeFilters, trimmedSearch]);\n\n const toggleFilter = useCallback((id: string) => {\n setActiveSet((prev) => {\n const copied = new Set(prev);\n return toggleInSet(copied, id);\n });\n }, []);\n\n const clearFilters = useCallback(() => {\n setActiveSet(new Set());\n }, []);\n\n return {\n search,\n filters,\n filtered,\n activeFilters,\n activeSet,\n setSearch,\n clearFilters,\n toggleFilter,\n };\n}\n","import React from 'react';\nimport {FileRejection, useDropzone} from 'react-dropzone';\nimport {Box, Button, LinearProgress, Stack, SxProps, Theme, Typography, alpha} from '@mui/material';\nimport AddIcon from '@mui/icons-material/Add';\nimport {blue, grey, red} from '@mui/material/colors';\nimport {Sx} from 'app/types/common';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {OverflowTooltip} from 'app/components/sharedReactComponents/OverflowTooltip/OverflowTooltip';\nimport {LegacyIcon} from 'app/components/sharedReactComponents/LegacyIcon/LegacyIcon';\nimport {Icons} from 'app/util/icons';\n\nconst rootSx: SxProps<Theme> = {\n p: 1,\n border: 1,\n borderStyle: 'dashed',\n borderRadius: 1,\n borderColor: grey[500],\n cursor: 'pointer',\n outline: 'none',\n '&:focus': {boxShadow: `0 0 0 2px ${alpha(grey[500], 0.4)}`},\n};\n\ninterface Props extends Sx {\n fileName: string;\n errorMessage: string;\n progress: number;\n size: 'small' | 'large';\n onDropFile: (files: File[]) => void;\n onDropRejected: (rejected: FileRejection[]) => void;\n onClickReset: () => void;\n}\n\nexport function PresetUploader({\n fileName,\n errorMessage,\n progress,\n size,\n onDropFile,\n onClickReset,\n onDropRejected,\n}: Props) {\n const {open, getRootProps, getInputProps} = useDropzone({\n accept: {'text/plain': ['.preset']},\n multiple: false,\n noDragEventsBubbling: true,\n onDrop: onDropFile,\n onDropRejected: onDropRejected,\n });\n\n const renderName = () => {\n if (fileName) {\n if (errorMessage) {\n return (\n <Box color=\"error.main\">\n <Typography textAlign=\"center\">\n Error uploading file{' '}\n <Typography component=\"span\" fontWeight={600}>\n <OverflowTooltip component=\"span\">{fileName}</OverflowTooltip>\n </Typography>\n </Typography>\n\n <Typography textAlign=\"center\">{errorMessage}</Typography>\n </Box>\n );\n }\n\n return (\n <Stack direction=\"row\" alignItems=\"center\" gap={1}>\n <LegacyIcon>{Icons.preset().reactComponent()}</LegacyIcon>\n <Typography component=\"span\" fontWeight={600}>\n <OverflowTooltip component=\"span\">{fileName}</OverflowTooltip>\n </Typography>{' '}\n </Stack>\n );\n }\n\n return (\n <Typography component=\"span\">\n Drop configuration preset file here or{' '}\n <Typography component=\"span\" color=\"primary.main\">\n click to select it\n </Typography>\n </Typography>\n );\n };\n\n const renderActions = () => {\n if (errorMessage) {\n return (\n <Button size=\"large\" variant=\"outlined\" color=\"error\" onClick={onClickReset}>\n Upload another file\n </Button>\n );\n }\n\n if (fileName) {\n return (\n <Stack direction=\"row\" alignItems=\"center\" gap={2}>\n <LinearProgress\n sx={{width: 110}}\n color=\"primary\"\n variant=\"determinate\"\n value={progress}\n />\n <Typography>Loading...</Typography>\n </Stack>\n );\n }\n\n return null;\n };\n\n return (\n <Stack\n data-id=\"preset_uploader\"\n sx={packSx(rootSx, {\n minHeight: size === 'small' ? 60 : 130,\n bgcolor: alpha(errorMessage ? red[50] : blue[50], 0.3),\n })}\n component=\"section\"\n {...getRootProps()}\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n gap={2}\n onClick={open}\n >\n <input {...getInputProps()} />\n\n <Stack flex={1} direction=\"row\" gap={1}>\n <AddIcon color=\"primary\" />\n <Typography color={grey[600]}>Add new preset</Typography>\n </Stack>\n\n <Box>{renderName()}</Box>\n\n <Stack direction=\"row\" justifyContent=\"flex-end\" alignItems=\"center\" flex={1}>\n {renderActions()}\n </Stack>\n </Stack>\n );\n}\n","import React from 'react';\nimport {Box} from '@mui/material';\nimport {Sx} from 'app/types/common';\nimport {LegacyIcon} from 'app/components/sharedReactComponents/LegacyIcon/LegacyIcon';\nimport {Icons} from 'app/util/icons';\nimport {Cloud} from 'app/domain/cloud';\n\n/** Part of pathname to an icon */\ntype IconName =\n | 'livescrypt'\n | 'pearl-2'\n | 'pearl-nano'\n | 'pearl-mini'\n | 'pearl-nexus'\n | 'webcaster'\n | 'unify';\n\ninterface Props extends Sx {\n model: Cloud.UnitModel;\n}\n\nexport function DevicePicture({sx, model}: Props) {\n const iconName = getDeviceIcon(model);\n\n if (!iconName) {\n return null;\n }\n\n if (iconName === 'unify') {\n return <LegacyIcon sx={sx}>{Icons.projectIconColored().reactComponent()}</LegacyIcon>;\n }\n\n return (\n <Box\n sx={sx}\n component=\"img\"\n alt=\"\"\n src={`/assets/img/device-model/${iconName}.png`}\n srcSet={`/assets/img/device-model/${iconName}@2x.png 2x`}\n />\n );\n}\n\nfunction getDeviceIcon(model: Cloud.UnitModel): IconName | undefined {\n switch (model) {\n case 'Pearl-2':\n return 'pearl-2';\n\n case 'Pearl Nano':\n return 'pearl-nano';\n\n case 'Pearl Mini':\n return 'pearl-mini';\n\n case 'LiveScrypt':\n return 'livescrypt';\n\n case 'Webcaster':\n return 'webcaster';\n\n case 'Epiphan Unify Project':\n return 'unify';\n\n case 'Pearl Nexus':\n return 'pearl-nexus';\n\n default:\n break;\n }\n}\n","import React, {useEffect, useState} from 'react';\nimport {Box, CircularProgress, Stack, Typography} from '@mui/material';\nimport dayjs from 'dayjs';\nimport {SortBySelector} from 'app/components/Presets/SortBySelector/SortBySelector';\nimport {Header} from 'app/components/FleetManager/Header';\nimport {Edge} from 'app/domain/edge';\nimport {curriedSortBy} from 'app/util/Sort';\nimport {\n deviceModelFilterGroups,\n useTeamPresetsFilters,\n} from 'app/components/Presets/usePresetsFilterSwitches';\nimport {useTeamPresets} from 'app/hooks/Device/Preset/usePresets';\nimport {isNil} from 'app/util/isNil';\nimport {DevicePresetUploader} from 'app/components/sharedReactComponents/PresetUploader/DevicePresetUploader';\nimport {PresetApiService} from 'app/services/api/preset/PresetApiService';\nimport {EdgeContract} from 'app/contracts/edge';\nimport {downloadPreset} from 'app/components/DeviceDetails/PresetsTab/utils';\nimport {PresetCard} from 'app/components/sharedReactComponents/DevicePresetCard/PresetCard/PresetCard';\nimport {SortKey, SortOptionsMap} from 'app/components/Presets/types';\nimport {FilterSelector} from 'app/components/sharedReactComponents/FilterSelector';\nimport {ActiveFilters} from 'app/components/sharedReactComponents/ActiveFilters/ActiveFilters';\nimport {Notifications} from 'app/components/Notifications';\nimport {useCloud} from 'app/components/features/cloud';\n\nconst sortByDeviceModel = curriedSortBy('device');\nconst sortByName = curriedSortBy('name');\n\nexport const sortOptionsMap: SortOptionsMap = {\n model: {\n value: 'model',\n label: 'Device model',\n sort: (presets: Edge.TeamPreset[]) => sortByDeviceModel(presets),\n },\n name: {\n value: 'name',\n label: 'Preset name',\n sort: (presets: Edge.TeamPreset[]) => sortByName(presets),\n },\n createdAt: {\n value: 'createdAt',\n label: 'Creation date',\n sort: (presets: Edge.TeamPreset[]) =>\n presets.sort((a, b) => dayjs.unix(b.createdAt).diff(dayjs.unix(a.createdAt))),\n },\n};\n\nconst sortOptions = [sortOptionsMap.model, sortOptionsMap.name, sortOptionsMap.createdAt];\n\nexport function PresetsPage() {\n const {team, user} = useCloud();\n\n const {capabilities} = team;\n\n const [sorted, setSorted] = useState<Edge.TeamPreset[]>([]);\n const [sortValue, setSortValue] = useState<SortKey>(sortOptionsMap.name.value);\n\n const presetAccess = capabilities.has('presets');\n\n const {data: presets, refetch: reload, isSuccess} = useTeamPresets({enabled: true});\n\n const hasPresets = !isNil(presets) && presets.length > 0;\n\n const permitManage = user.role.canApplyPresets();\n\n const {\n filters,\n activeFilters,\n activeSet,\n search,\n filtered,\n setSearch,\n toggleFilter,\n clearFilters,\n } = useTeamPresetsFilters(presets);\n\n useEffect(() => {\n const sorted = sortOptionsMap[sortValue].sort([...filtered]);\n setSorted(sorted);\n }, [filtered, sortValue]);\n\n const handleDownload = (preset: Edge.Preset) => {\n if (Edge.isTeamPreset(preset)) {\n downloadPreset(preset.id, `${preset.name}.preset`);\n }\n };\n\n const handleUpdate = async (id: string, c: EdgeContract.UpdatePreset) => {\n try {\n await PresetApiService.updateTeamPreset(id, c);\n await reload();\n } catch (e) {\n Notifications.addErrorNotification('Failed to update preset');\n throw e;\n }\n };\n\n const handleDelete = async (preset: Edge.Preset) => {\n if (!Edge.isTeamPreset(preset)) {\n return;\n }\n\n try {\n await PresetApiService.deleteTeamPreset(preset.id);\n await reload();\n } catch (e) {\n Notifications.addErrorNotification('Failed to delete preset');\n throw e;\n }\n };\n\n const handleUpload = async () => {\n await reload();\n };\n\n const renderContent = () => {\n if (!isSuccess) {\n return (\n <Stack direction=\"row\" justifyContent=\"center\" alignItems=\"center\" gap={2}>\n <CircularProgress />\n <Typography variant=\"h6\">Loading team presets</Typography>\n </Stack>\n );\n }\n\n return (\n <>\n {hasPresets && (\n <Stack gap={1} mb={2}>\n {sorted.map((preset) => (\n <PresetCard\n key={preset.id}\n preset={preset}\n showModel={true}\n permitApply={permitManage}\n permitDelete={permitManage}\n available={presetAccess}\n offline={false}\n onDelete={handleDelete}\n onUpdate={handleUpdate}\n onDownload={handleDownload}\n />\n ))}\n </Stack>\n )}\n\n <DevicePresetUploader size={hasPresets ? 'small' : 'large'} onUpload={handleUpload} />\n </>\n );\n };\n\n return (\n <Box mb={2}>\n <Header searchValue={search} onSearch={setSearch} />\n\n <Box mt={2} className=\"container\">\n <Box mb={2}>\n <Stack direction=\"row\" alignItems=\"center\" justifyContent=\"space-between\">\n <Typography variant=\"h5\" fontWeight={600} mb={1}>\n Configuration presets\n </Typography>\n\n {hasPresets && (\n <Stack direction=\"row\" alignItems=\"center\" gap={1}>\n <SortBySelector value={sortValue} options={sortOptions} onChange={setSortValue} />\n\n <FilterSelector\n filterSwitchGroups={deviceModelFilterGroups}\n filterSwitches={filters}\n activeFilterSwitches={activeSet}\n onClickFilterSwitcher={toggleFilter}\n />\n </Stack>\n )}\n </Stack>\n\n <Typography>Configuration presets available for your team.</Typography>\n\n {hasPresets && (\n <ActiveFilters\n filters={activeFilters}\n onRemove={toggleFilter}\n onRemoveAll={clearFilters}\n />\n )}\n </Box>\n\n {renderContent()}\n </Box>\n </Box>\n );\n}\n","import React from 'react';\nimport classNames from 'classnames';\nimport {IconButton} from '@mui/material';\nimport CloseIcon from '@mui/icons-material/Close';\nimport {Callback, Component} from 'app/types/common';\n\ninterface Props extends Component {\n onClose: Callback;\n}\n\nexport const DialogClose = ({className, dataId, onClose}: Props) => {\n return (\n <IconButton\n aria-label=\"close\"\n data-id={dataId ?? 'close-dialog-btn'}\n className={classNames('dialog-close', className)}\n onClick={onClose}\n >\n <CloseIcon />\n </IconButton>\n );\n};\n","import {front} from 'app/api/CirrusApi';\nimport {ApiResponseStatus} from 'app/data/Status';\nimport {Dispatcher} from 'app/data/Dispatcher';\nimport {ActionTypes} from 'app/data/ActionTypes';\nimport {getApiErrorMessage} from 'app/util/getApiErrorMessage';\nimport {Notifications} from 'app/components/Notifications';\nimport {TeamDetailsDto} from 'app/models/Team/dto';\nimport {AjaxComplexSuccessfulResponseType} from 'app/api/types';\nimport {CloudContract} from 'app/contracts/cloud';\n\nexport class TeamApiService {\n async fetchTeamDetails(teamId: string): Promise<TeamDetailsDto> {\n return front.teams(teamId).get();\n }\n\n async rename(teamId: string, name: string) {\n return front\n .teams(teamId)\n .put({\n Name: name,\n })\n .then((resp: AjaxComplexSuccessfulResponseType) => {\n if (resp.Status === ApiResponseStatus.Ok) {\n Dispatcher.emit(ActionTypes.TEAMS_TEAM_RENAMED, {\n id: teamId,\n name,\n });\n }\n })\n .catch((error) => {\n const errorText = getApiErrorMessage(error);\n\n Notifications.addErrorNotification(\n `Team update error${errorText ? `: \"${errorText}\"` : ''}`,\n );\n\n throw error;\n });\n }\n\n async createTeam(name: string): Promise<{teamId: string}> {\n return front\n .teams()\n .post({Name: name, Billing: {}})\n .then((response: AjaxComplexSuccessfulResponseType<{ID: string}>) => {\n return {\n teamId: response.ID,\n };\n });\n }\n\n static async deleteTeam(teamId: string): Promise<void> {\n return front.teams(teamId).delete();\n }\n\n static async logout(): Promise<void> {\n return front.oauth().logout().get();\n }\n\n static async getTeams(): Promise<CloudContract.Team[]> {\n return front.teams().get();\n }\n\n static async createTeam(name: string): Promise<{ID: string}> {\n return front.teams().post({Name: name, Billing: {}});\n }\n}\n\nexport const teamApiService = new TeamApiService();\n","import React, {useState} from 'react';\nimport classNames from 'classnames';\nimport {Icons} from 'app/util/icons';\nimport {UserRole, THEME, VARIANT, SIZE} from 'app/constants';\nimport {front} from 'app/api/CirrusApi';\nimport {emailValidator} from 'app/util/validators';\nimport {FormControl} from 'app/components/sharedReactComponents/FormControl';\nimport {FormControlLabel} from 'app/components/sharedReactComponents/FormControlLabel';\nimport {UserRoleSelector} from 'app/components/Teams/UsersPanel/UserRoleSelector';\nimport {ProgressButton, BUTTON_TYPE} from 'app/components/sharedReactComponents/ProgressButton';\nimport {ClassName} from 'app/types/common';\nimport {FORM_CONTROL_TYPE} from 'app/components/sharedReactComponents/FormControl/constants';\n\nconst initialFormData = {\n email: '',\n role: UserRole.Owner,\n};\n\nconst SHOW_SUCCESS_SPLASH_TIMEOUT = 2000;\n\nconst SuccessSplash: React.VFC = () => (\n <div className=\"invite-user-form-success-splash\">\n <div className=\"invite-user-form-success-splash__title\">Invitation sent</div>\n\n <div className=\"invite-user-form-success-splash__icon\">\n {Icons.check().size(SIZE.XXL).theme(THEME.SUCCESS).reactComponent()}\n </div>\n </div>\n);\n\ninterface Props extends ClassName {\n teamId: string;\n}\n\ninterface FormData {\n email: string;\n role: UserRole;\n}\n\nexport const InviteUserForm = ({className, teamId}: Props) => {\n let showSuccessSplashTimeout: any = null;\n const usersEndpoint = front.teams(teamId).users;\n\n const [creating, setCreating] = useState<boolean>(false);\n const [showSuccessSplashFlag, setShowSuccessSplashFlag] = useState<boolean>(false);\n const [formData, setFormData] = useState<FormData>({...initialFormData});\n\n const handleSubmit = (e) => {\n e.preventDefault();\n\n setCreating(true);\n\n usersEndpoint()\n .post({\n Email: formData.email.trim(),\n Role: formData.role,\n })\n .then(() => showSuccessSplash())\n .then(() => resetForm())\n .finally(() => {\n setCreating(false);\n });\n };\n\n const resetForm = () => {\n setFormData({\n ...initialFormData,\n });\n };\n\n const showSuccessSplash = () => {\n setShowSuccessSplashFlag(true);\n\n clearTimeout(showSuccessSplashTimeout);\n\n showSuccessSplashTimeout = setTimeout(() => {\n setShowSuccessSplashFlag(false);\n }, SHOW_SUCCESS_SPLASH_TIMEOUT);\n };\n\n const handleChange = ({target: {name, value}}) => {\n setFormData({\n ...formData,\n [name]: value,\n });\n };\n\n return (\n <form\n className={classNames('invite-user-form', className)}\n action=\"\"\n autoComplete=\"off\"\n noValidate={true}\n onSubmit={handleSubmit}\n >\n <div className=\"invite-user-form__title\">Invite a new team member</div>\n\n <FormControl\n className=\"invite-user-form__row\"\n label=\"Email address\"\n type={FORM_CONTROL_TYPE.EMAIL}\n name=\"email\"\n value={formData.email}\n placeholder=\"your@email.com\"\n disabled={creating}\n required={true}\n onChange={handleChange}\n />\n\n <FormControlLabel\n className=\"invite-user-form__row invite-user-form__row--role\"\n label=\"Role\"\n control={\n <UserRoleSelector\n name=\"role\"\n value={formData.role}\n disabled={creating}\n onChange={handleChange}\n />\n }\n />\n\n <ProgressButton\n type={BUTTON_TYPE.SUBMIT}\n theme={THEME.PRIMARY}\n variant={VARIANT.SOLID}\n className=\"invite-user-form__submit-button\"\n disabled={!emailValidator.validate(formData.email)}\n loading={creating}\n >\n {Icons.send().label('Send invitation').reactComponent()}\n </ProgressButton>\n\n {showSuccessSplashFlag && <SuccessSplash />}\n </form>\n );\n};\n","import React from 'react';\nimport {BillingState} from 'app/components/BillingManager/types/types';\n\nexport const BillingManagerContext = React.createContext<BillingState | undefined>(undefined);\n","/* global ClipboardItem */\nimport React, {useRef} from 'react';\nimport classNames from 'classnames';\nimport {Button} from 'app/components/sharedReactComponents/Button';\nimport {Icons, TextPlacement} from 'app/util/icons';\nimport {THEME, VARIANT, SIZE} from 'app/constants';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\nimport {Callback, ClassName, DataId} from 'app/types/common';\n\nconst SHOW_COPIED_TOOLTIP_TIMEOUT = 1500;\n\ninterface CopyProps extends ClassName, DataId {\n text?: string;\n placement?: TextPlacement;\n theme?: THEME;\n variant?: VARIANT;\n disabled?: boolean;\n buttonContent?: React.ReactNode;\n onClick?: Callback;\n}\n\ninterface CopyTextProps extends CopyProps {\n value?: string | number;\n}\n\ninterface CopyCanvasProps extends CopyProps {\n valueCanvas?: any;\n}\n\ntype Props = CopyTextProps | CopyCanvasProps;\n\nconst CopyButtonComponent = ({\n className,\n dataId,\n text,\n placement,\n buttonContent,\n theme,\n variant,\n disabled,\n children,\n onClick,\n}: React.PropsWithChildren<CopyProps>) => {\n // rework any for refs\n const copiedTooltipRef = useRef<any>(null);\n const showCopiedTooltipTimeout = useRef<any>(null);\n\n const currentButtonText =\n buttonContent ??\n Icons.copy()\n .size(SIZE.S)\n .label(text ?? '', placement)\n .reactComponent();\n\n const handleClickCopy = (e: React.SyntheticEvent) => {\n onClick?.(e);\n\n copiedTooltipRef.current.show();\n\n clearTimeout(showCopiedTooltipTimeout.current);\n showCopiedTooltipTimeout.current = setTimeout(() => {\n if (copiedTooltipRef.current) {\n copiedTooltipRef.current.hide();\n }\n }, SHOW_COPIED_TOOLTIP_TIMEOUT);\n };\n\n return (\n <div className={classNames('copy-button', className)}>\n {children}\n\n <Tooltip ref={copiedTooltipRef} content=\"Copied!\" trigger=\"manual\">\n <Button\n className=\"copy-button__button\"\n dataId={dataId}\n theme={theme}\n variant={variant}\n disabled={disabled}\n onClick={handleClickCopy}\n >\n {currentButtonText}\n </Button>\n </Tooltip>\n </div>\n );\n};\n\nconst CopyTextButton = ({value, onClick, ...props}: CopyTextProps) => {\n // rework any type\n const hiddenInputRef = useRef<any>(null);\n\n const handleClickCopy = (e: React.SyntheticEvent) => {\n onClick?.(e);\n hiddenInputRef.current.select();\n document.execCommand('copy', false, undefined);\n };\n\n return (\n <CopyButtonComponent {...props} onClick={handleClickCopy}>\n <input\n ref={hiddenInputRef}\n className=\"copy-button__hidden-input\"\n value={value}\n tabIndex={-1}\n readOnly={true}\n />\n </CopyButtonComponent>\n );\n};\n\nconst CopyCanvasButton = ({valueCanvas, onClick, ...props}: CopyCanvasProps) => {\n /**\n * From version 63: this feature is behind the dom.events.asyncClipboard.dataTransfer preferences (needs to be set to true).\n * To change preferences in Firefox, visit about:config.\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/write}\n */\n const supportsClipboard = typeof window.navigator.clipboard?.write === 'function';\n\n const handleClickCopy = ({...args}) => {\n valueCanvas.current.toBlob((blob) => {\n const clipboardItems: ClipboardItem[] = [];\n const clipboardItem = new ClipboardItem({\n 'image/png': blob,\n });\n clipboardItems.push(clipboardItem);\n\n if (supportsClipboard) {\n // @ts-expect-error\n void window.navigator.clipboard.write(clipboardItems);\n }\n });\n\n onClick?.(args);\n };\n\n if (!supportsClipboard) {\n return null;\n }\n\n return <CopyButtonComponent onClick={handleClickCopy} {...props} />;\n};\n\nexport const CopyButton = ({text = 'Copy', variant = VARIANT.TEXT, ...rest}: Props) => {\n if ('valueCanvas' in rest) {\n return <CopyCanvasButton text={text} variant={variant} {...rest} />;\n }\n\n return <CopyTextButton text={text} variant={variant} {...rest} />;\n};\n","import React, {Component} from 'react';\nimport classNames from 'classnames';\nimport {front} from 'app/api/CirrusApi';\nimport {Icons} from 'app/util/icons';\nimport {CreateTokenForm} from 'app/components/Settings/ApiTokens/TokensPanel/CreateTokenForm';\nimport {TokensPanelList} from 'app/components/Settings/ApiTokens/TokensPanel/TokensPanelList';\nimport {\n descend,\n filter,\n find,\n map,\n prop,\n sort,\n} from 'ramda';\nimport {ClassName} from 'app/types/common';\n\nconst byCreationTime = descend<any>(prop('CreationTime'));\nconst sortByCreationTime = sort(byCreationTime);\n\ninterface Props extends ClassName {\n teamId: string;\n}\n\ninterface State {\n tokens: any[];\n loadingTokens: boolean;\n}\n\nexport class TokensPanel extends Component<Props, State> {\n // rework any\n tokensEndpoint: any;\n constructor(props) {\n super(props);\n\n this.tokensEndpoint = front.teams(props.teamId).tokens;\n\n this.state = {\n tokens: [],\n loadingTokens: true,\n };\n }\n\n componentDidMount() {\n this.fetchTokens();\n }\n\n fetchTokens() {\n this.setState({loadingTokens: true});\n\n this.tokensEndpoint().get()\n .then(sortByCreationTime)\n .then(tokens => this.setState({tokens}))\n .finally(() => this.setState({loadingTokens: false}));\n }\n\n renderLoading() {\n return (\n <div className=\"tokens-panel__loading\">\n {Icons.spinner().reactComponent()}\n </div>\n );\n }\n\n isUniqueTokenName = (tokenName, tokenId) => {\n const tokenWithSameName = find(({ID, Name}) => {\n if (\n Name === tokenName &&\n ID !== tokenId\n ) {\n return true;\n }\n\n return false;\n }, this.state.tokens);\n\n return Boolean(tokenWithSameName) === false;\n };\n\n renderTokensList() {\n return (\n <TokensPanelList\n tokens={this.state.tokens}\n endpoint={this.tokensEndpoint}\n isUniqueTokenName={this.isUniqueTokenName}\n onUpdate={this.handleUpdateToken}\n onDelete={this.handleDeleteToken}\n />\n );\n }\n\n handleCreateToken = (token) => {\n this.setState((state) => {\n return {\n tokens: [token].concat(state.tokens)\n };\n });\n };\n\n handleUpdateToken = (tokenId, tokenName) => {\n this.setState((state) => {\n return {\n tokens: map(token => {\n if (token.ID === tokenId) {\n return {\n ...token,\n Name: tokenName,\n };\n }\n\n return token;\n }, state.tokens)\n };\n });\n };\n\n handleDeleteToken = (tokenId) => {\n this.setState((state) => {\n return {\n tokens: filter(({ID}) => ID !== tokenId, state.tokens)\n };\n });\n };\n\n render() {\n const {\n className,\n } = this.props;\n const {\n loadingTokens,\n } = this.state;\n\n return (\n <div className={classNames('tokens-panel', className)}>\n <CreateTokenForm\n endpoint={this.tokensEndpoint}\n isUniqueTokenName={this.isUniqueTokenName}\n onCreate={this.handleCreateToken}\n />\n\n {loadingTokens ? this.renderLoading() : this.renderTokensList()}\n </div>\n );\n }\n}\n","import React, {memo} from 'react';\nimport classNames from 'classnames';\nimport {router} from 'app/router/main';\nimport {Icons} from 'app/util/icons';\nimport {SIZE} from 'app/constants';\nimport {Button} from 'app/components/sharedReactComponents/Button';\nimport {ClassName} from 'app/types/common';\n\ninterface Props extends ClassName {\n url?: string;\n}\n\nexport const PairDevicePageCloseButton: React.FC<Props> = memo(({\n className,\n url = router.url('dashboard'),\n}) => {\n return (\n <Button\n dataId=\"close_pair_device_page_button\"\n className={classNames('pair-device-page-close-button', className)}\n href={url}\n >\n {Icons.close().size(SIZE.L).reactComponent()}\n </Button>\n );\n});\n\n","import {booleanComparator} from 'app/util/comparators/booleanComparator';\nimport {numberComparator} from 'app/util/comparators/numberComparator';\nimport {stringComparator} from 'app/util/Sort';\n\nexport function valueComparator(a: any, b: any): number {\n if (a === b) {\n return 0;\n }\n\n if (a === null || typeof a === 'undefined') {\n return 1;\n }\n\n if (b === null || typeof b === 'undefined') {\n return -1;\n }\n\n switch (typeof a) {\n case 'boolean':\n return booleanComparator(a, b);\n case 'number':\n return numberComparator(a, b);\n case 'string':\n return stringComparator(a, b as string);\n default:\n return 0;\n }\n}\n","// Truthy values on top\nexport function booleanComparator(a: any, b: any): number {\n if (a === b) {\n return 0;\n }\n\n if (a === true) {\n return -1;\n }\n\n return 1;\n}\n","/**\n * Non zero values on top\n *\n * ```typescript\n * [1, 0, 3].sort(numberComparator); //=> [3, 1, 0]\n * ```\n */\nexport function numberComparator(a: any, b: any): number {\n if (Number.isNaN(a)) {\n return -1;\n }\n\n if (a > b) {\n return -1;\n }\n\n if (a < b) {\n return 1;\n }\n\n return 0;\n}\n","import React from 'react';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\n\ninterface Props {\n disabled: boolean;\n}\n\nexport const DisabledButtonWrapper: React.FC<Props> = ({\n children,\n disabled,\n}) => {\n if (!disabled) {\n return <>{children}</>;\n }\n\n return (\n <Tooltip content=\"Coming soon\">\n {children}\n </Tooltip>\n );\n};\n","import React, {KeyboardEvent} from 'react';\nimport classNames from 'classnames';\nimport {DisabledButtonWrapper} from 'app/components/Settings/StreamingDestinations/NewStreamingDestinationTypeSelector/DisabledButtonWrapper';\nimport {StreamingServiceIcon} from 'app/components/StreamingServices/StreamingServiceIcon';\nimport {Callback, ClassName} from 'app/types/common';\nimport {KeyboardCode} from 'app/constants';\n\nconst getReactIcon = (type) => StreamingServiceIcon.getIconByType(type)?.reactComponent();\n\ninterface Props extends ClassName {\n service: any;\n createServiceAction: Callback;\n}\n\nexport const ListItem: React.FC<Props> = ({\n className,\n service,\n createServiceAction,\n}) => {\n const handleClick = () => {\n if (service.isDisabled()) {\n return;\n }\n\n createServiceAction(service.getType());\n };\n\n const disabled = service.isDisabled();\n\n if (disabled) {\n return null;\n }\n\n const handleKeyDown = (event: KeyboardEvent<HTMLLIElement>) => {\n if (event.code === KeyboardCode.Enter || event.code === KeyboardCode.Space) {\n event.preventDefault();\n handleClick();\n }\n };\n\n return (\n <DisabledButtonWrapper disabled={disabled}>\n <li\n className={classNames(\n 'new-streaming-destination-type-selector-list__item',\n `new-streaming-destination-type-selector-list__item--${service.getType() as string}`,\n {\n 'new-streaming-destination-type-selector-list__item--disabled': disabled,\n },\n className\n )}\n data-id=\"add_streaming_destination_button\"\n tabIndex={disabled ? undefined : 0}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n >\n <div className=\"new-streaming-destination-type-selector-list__icon\">\n {getReactIcon(service.getType())}\n </div>\n\n <div className=\"new-streaming-destination-type-selector-list__name\">\n {service.getName()}\n </div>\n </li>\n </DisabledButtonWrapper>\n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport {ListItem} from 'app/components/Settings/StreamingDestinations/NewStreamingDestinationTypeSelector/List/ListItem';\nimport {Callback, ClassName} from 'app/types/common';\n\ninterface Props extends ClassName {\n services: any[];\n createServiceAction: Callback;\n}\n\nexport const List: React.FC<Props> = ({\n className,\n services,\n createServiceAction,\n}) => {\n return (\n <section className={classNames('new-streaming-destination-type-selector-list', className)}>\n {services.map(service => (\n <ListItem\n key={service.getType()}\n service={service}\n createServiceAction={createServiceAction}\n />\n ))}\n </section>\n );\n};\n","import React, {KeyboardEvent} from 'react';\nimport {KeyboardCode, SIZE} from 'app/constants';\nimport classNames from 'classnames';\nimport {DisabledButtonWrapper} from 'app/components/Settings/StreamingDestinations/NewStreamingDestinationTypeSelector/DisabledButtonWrapper';\nimport {StreamingServiceIcon} from 'app/components/StreamingServices/StreamingServiceIcon';\nimport {Callback, ClassName} from 'app/types/common';\n\nconst getReactIcon = (type) => StreamingServiceIcon.getIconByType(type).size(SIZE.XL).reactComponent();\n\ninterface Props extends ClassName {\n service: any;\n createServiceAction: Callback;\n}\n\nexport const TileItem: React.FC<Props> = ({\n className,\n service,\n createServiceAction,\n}) => {\n const handleClick = () => {\n if (service.isDisabled()) {\n return;\n }\n\n createServiceAction(service.getType());\n };\n\n const disabled = service.isDisabled();\n\n if (disabled) {\n return null;\n }\n\n const handleKeyDown = (event: KeyboardEvent<HTMLLIElement>) => {\n if (event.code === KeyboardCode.Enter || event.code === KeyboardCode.Space) {\n event.preventDefault();\n handleClick();\n }\n };\n\n return (\n <DisabledButtonWrapper disabled={disabled}>\n <li\n className={classNames(\n 'new-streaming-destination-type-selector-tiles__item',\n `new-streaming-destination-type-selector-tiles__item--${service.getType() as string}`,\n {\n 'new-streaming-destination-type-selector-tiles__item--disabled': disabled,\n },\n className\n )}\n data-id=\"add_streaming_destination_button\"\n tabIndex={disabled ? undefined : 0}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n >\n <div className=\"new-streaming-destination-type-selector-tiles__icon\">\n {getReactIcon(service.getType())}\n </div>\n\n <div className=\"new-streaming-destination-type-selector-tiles__name\">\n {service.getName()}\n </div>\n </li>\n </DisabledButtonWrapper>\n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport {TileItem} from 'app/components/Settings/StreamingDestinations/NewStreamingDestinationTypeSelector/Tiles/TileItem';\nimport {Callback, ClassName} from 'app/types/common';\n\ninterface Props extends ClassName {\n services: any[];\n createServiceAction: Callback;\n}\n\nexport const Tiles: React.FC<Props> = ({className, services, createServiceAction}) => {\n return (\n <section className={classNames('new-streaming-destination-type-selector-tiles', className)}>\n {services.map((service) => (\n <TileItem\n key={service.getType()}\n service={service}\n createServiceAction={createServiceAction}\n />\n ))}\n </section>\n );\n};\n","enum NEW_STREAMING_DESTINATION_TYPE_SELECTOR_VARIANT {\n TILE = 'tile',\n LIST = 'list',\n}\n\nexport {\n NEW_STREAMING_DESTINATION_TYPE_SELECTOR_VARIANT,\n};\n","// Enabled services on top\nexport function streamingServiceComparator(a, b): number {\n const aDisabled = a.isDisabled();\n const bDisabled = b.isDisabled();\n\n if (aDisabled === bDisabled) {\n return 0;\n }\n\n if (aDisabled) {\n return 1;\n }\n\n return -1;\n}\n","/* eslint-disable react/default-props-match-prop-types */\nimport React, {Component} from 'react';\nimport classNames from 'classnames';\nimport {List} from 'app/components/Settings/StreamingDestinations/NewStreamingDestinationTypeSelector/List';\nimport {Tiles} from 'app/components/Settings/StreamingDestinations/NewStreamingDestinationTypeSelector/Tiles';\nimport {NEW_STREAMING_DESTINATION_TYPE_SELECTOR_VARIANT} from 'app/components/Settings/StreamingDestinations/NewStreamingDestinationTypeSelector/constants';\nimport {streamingServiceComparator} from 'app/util/comparators/streamingServiceComparator';\nimport {Callback, ClassName} from 'app/types/common';\nimport {streamingServicesRepository} from 'app/components/StreamingServices';\n\ninterface Props extends ClassName {\n variant: NEW_STREAMING_DESTINATION_TYPE_SELECTOR_VARIANT;\n createServiceAction: Callback;\n}\n\nexport class NewStreamingDestinationTypeSelector extends Component<Props> {\n static defaultProps = {\n variant: NEW_STREAMING_DESTINATION_TYPE_SELECTOR_VARIANT.LIST,\n };\n\n // Enabled services first\n _services = streamingServicesRepository\n .getAvailableToCreateServices()\n .sort(streamingServiceComparator);\n\n render() {\n const {className, variant, createServiceAction} = this.props;\n\n // TODO: refactor Tiles and List components and create universal component for these\n return (\n <div className={classNames('new-streaming-destination-type-selector', className)}>\n <div className=\"new-streaming-destination-type-selector__title\">\n Add new streaming destination\n </div>\n\n {variant === NEW_STREAMING_DESTINATION_TYPE_SELECTOR_VARIANT.TILE ? (\n <Tiles\n className=\"new-streaming-destination-type-selector__tile\"\n services={this._services}\n createServiceAction={createServiceAction}\n />\n ) : (\n <List\n className=\"new-streaming-destination-type-selector__list\"\n services={this._services}\n createServiceAction={createServiceAction}\n />\n )}\n </div>\n );\n }\n}\n","import React from 'react';\nimport classNames from 'classnames';\nimport {AccountInfo} from 'app/components/sharedReactComponents/StreamingDestinationSettings/AccountInfo';\nimport {Footer} from 'app/components/sharedReactComponents/StreamingDestinationSettings/Footer';\nimport {\n FACEBOOK_STREAMING_DESTINATION,\n FACEBOOK_STREAMING_PRIVACY,\n} from 'app/components/StreamingServices/constants';\nimport {StreamingDestinationSettingsForm} from 'app/components/sharedReactComponents/StreamingDestinationSettings/StreamingDestinationSettingsForm';\nimport {FORM_CONTROL_TYPE} from 'app/components/sharedReactComponents/FormControl/constants';\nimport {DestinationSelect} from 'app/components/sharedReactComponents/StreamingDestinationSettings/DestinationSelect';\nimport {Callback, ClassName} from 'app/types/common';\nimport {StreamingDestinationControl} from 'app/components/sharedReactComponents/StreamingDestinationSettings/types';\n\nconst destinationOptions = [\n {\n label: 'Timeline',\n value: FACEBOOK_STREAMING_DESTINATION.TIMELINE,\n },\n {\n label: 'Page',\n value: FACEBOOK_STREAMING_DESTINATION.PAGES,\n },\n {\n label: 'Group',\n value: FACEBOOK_STREAMING_DESTINATION.GROUPS,\n },\n];\n\nconst privacyOptions = [\n {\n label: 'Public',\n value: FACEBOOK_STREAMING_PRIVACY.PUBLIC,\n },\n {\n label: 'Friends',\n value: FACEBOOK_STREAMING_PRIVACY.FRIENDS,\n },\n {\n label: 'Only Me',\n value: FACEBOOK_STREAMING_PRIVACY.ONLY_ME,\n },\n];\n\ninterface Props extends ClassName {\n streamingDestination: any;\n updating: boolean;\n deleting?: boolean;\n disabled: boolean;\n onChange: Callback;\n onClickDelete: Callback;\n}\n\nexport const FacebookStreamingDestinationSettings = ({\n className,\n streamingDestination,\n updating,\n deleting,\n disabled,\n onChange,\n onClickDelete,\n}: Props) => {\n const getProcessedFormData = () => ({\n title: streamingDestination.getTitleSetting(),\n description: streamingDestination.getDescriptionSetting(),\n publishDestination: streamingDestination.getDestinationSetting(),\n publishDestinationID: streamingDestination.getDestinationIDSetting(),\n privacy: streamingDestination.getPrivacySetting(),\n continuousStream: streamingDestination.isContinuous(),\n deletePostAfterStreaming: streamingDestination.isDeletingPostAfterStop(),\n });\n\n const handleSaveForm = (formData) => {\n onChange(formData);\n };\n\n const formData = getProcessedFormData();\n\n const controls: StreamingDestinationControl[] = [\n {\n label: 'Facebook account',\n value: streamingDestination,\n componentRenderer: ({value}) => <AccountInfo streamingDestination={value}/>\n },\n {\n label: 'Facebook streaming destination',\n name: 'publishDestination',\n type: FORM_CONTROL_TYPE.SELECT,\n selectComponentProps: {\n options: destinationOptions,\n },\n resetOnChange: () => {\n return {\n publishDestinationID: undefined,\n };\n },\n },\n {\n name: 'publishDestinationID',\n componentRenderer: (props, {publishDestination}) => (\n <DestinationSelect\n {...props}\n data-id=\"streaming_destination_select_destination_input\"\n publishDestination={publishDestination}\n streamingDestinationId={streamingDestination.getId()}\n />\n ),\n isVisible: ({publishDestination}) => (\n publishDestination === FACEBOOK_STREAMING_DESTINATION.PAGES ||\n publishDestination === FACEBOOK_STREAMING_DESTINATION.GROUPS\n ),\n },\n {\n label: 'Title',\n name: 'title',\n },\n {\n label: 'Description',\n name: 'description',\n type: FORM_CONTROL_TYPE.TEXTAREA,\n },\n {\n label: 'Privacy',\n name: 'privacy',\n type: FORM_CONTROL_TYPE.SELECT,\n selectComponentProps: {\n options: privacyOptions,\n },\n isVisible: ({publishDestination}) => publishDestination === FACEBOOK_STREAMING_DESTINATION.TIMELINE,\n },\n {\n label: 'Continuous stream',\n name: 'continuousStream',\n type: FORM_CONTROL_TYPE.CHECKBOX,\n },\n {\n label: 'Delete post after stream? (Continuous only)',\n name: 'deletePostAfterStreaming',\n type: FORM_CONTROL_TYPE.CHECKBOX,\n },\n ];\n\n return (\n <div className={classNames('streaming-destination-settings', className)}>\n <StreamingDestinationSettingsForm\n formData={formData}\n controls={controls}\n disabled={disabled}\n loading={updating}\n onSave={handleSaveForm}\n />\n\n <Footer\n deleteButtonText=\"Forget this destination\"\n deleting={deleting}\n disabled={disabled}\n onClickDelete={onClickDelete}\n />\n </div>\n );\n};\n","import React, {useCallback, useEffect, useRef, useState} from 'react';\nimport {IndeterminateProgressBar} from 'app/components/sharedReactComponents/IndeterminateProgressBar';\nimport {RepeatedCall} from 'app/util/RepeatedCall';\nimport {stringComparator} from 'app/util/Sort';\nimport {uniqueNewName} from 'app/util/newName';\nimport {NewStreamingDestinationTypeSelector} from 'app/components/Settings/StreamingDestinations/NewStreamingDestinationTypeSelector';\nimport {NEW_STREAMING_DESTINATION_TYPE_SELECTOR_VARIANT} from 'app/components/Settings/StreamingDestinations/NewStreamingDestinationTypeSelector/constants';\nimport {StreamingDestinationsPanel} from 'app/components/Settings/StreamingDestinations/StreamingDestinationsPanel';\nimport {minutesToMilliseconds} from 'app/util/timeConverter';\nimport {isNil} from 'app/util/isNil';\nimport {streamApiService} from 'app/services/api/stream/StreamApiService';\nimport {AnyStreamingDestinationModelType} from 'app/components/StreamingServices/types';\nimport {streamingServicesRepository} from 'app/components/StreamingServices';\nimport {useCloud} from 'app/components/features/cloud';\n\nconst STREAMING_REPEAT_CALL_INITIAL_TIMEOUT = minutesToMilliseconds(2);\nconst STREAMING_REPEAT_CALL_MAX_TIMEOUT = minutesToMilliseconds(5);\n\nexport function StreamingDestinations() {\n const {user} = useCloud();\n const userRole = user.role;\n\n const streamingRepeatedCall = useRef<RepeatedCall | undefined>();\n\n const [initialFetchFinished, setInitialFetchFinished] = useState(false);\n const [streamingDestinations, setStreamingDestinations] = useState<\n AnyStreamingDestinationModelType[]\n >([]);\n\n useEffect(() => {\n streamingRepeatedCall.current = new RepeatedCall({\n call: async () => {\n try {\n const response = await streamApiService.getStreams();\n const streamingDestinationModels = response\n .map((d) => streamingServicesRepository.createStreamingDestinationModel(d))\n .filter((model): model is AnyStreamingDestinationModelType => !isNil(model))\n .sort((a, b) => stringComparator(a.getName(), b.getName()));\n\n setStreamingDestinations(streamingDestinationModels);\n\n return streamingDestinationModels;\n } catch {\n setStreamingDestinations([]);\n\n return [];\n } finally {\n setInitialFetchFinished(true);\n }\n },\n initialTimeoutMs: STREAMING_REPEAT_CALL_INITIAL_TIMEOUT,\n maxTimeoutMs: STREAMING_REPEAT_CALL_MAX_TIMEOUT,\n });\n\n streamingRepeatedCall.current.start(true);\n\n return () => {\n streamingRepeatedCall.current?.stop();\n };\n }, []);\n\n const createServiceAction = useCallback((serviceType) => {\n const service = streamingServicesRepository.getServiceByType(serviceType);\n\n if (!service) {\n return;\n }\n\n const newName = uniqueNewName(\n service.getName() ?? '',\n streamingDestinations.map((a) => a.getName()),\n );\n let createdName: string | undefined;\n\n return service\n .createService(newName)\n .then((name) => (createdName = name))\n .then(async () => streamingRepeatedCall.current?.restart(true))\n .then((streamingDestinationModels) => {\n return streamingDestinationModels.find(\n (streamingDestination) => streamingDestination.getName() === createdName,\n );\n });\n }, []);\n\n const handleStreamingDestinationDelete = useCallback((streamingDestination) => {\n const deleteId = streamingDestination.getId();\n\n setStreamingDestinations((prevStreamingDestinations) => {\n return prevStreamingDestinations.filter((item) => item.getId() !== deleteId);\n });\n\n streamingRepeatedCall.current?.restart(true);\n }, []);\n\n if (!initialFetchFinished) {\n return <IndeterminateProgressBar />;\n }\n\n const hasStreamDestinations = streamingDestinations.length > 0;\n const userCanEditStreamingDestinations = userRole.canEditStreamingDestinations();\n\n if (!hasStreamDestinations && !userCanEditStreamingDestinations) {\n return (\n <div className=\"streaming-destinations__warning\">There are no streaming destinations.</div>\n );\n }\n\n return (\n <div className=\"streaming-destinations\">\n <div className=\"container streaming-destinations__container\">\n <div className=\"streaming-destinations__content\">\n {hasStreamDestinations ? (\n <StreamingDestinationsPanel\n streamingDestinations={streamingDestinations}\n editable={userCanEditStreamingDestinations}\n onDelete={handleStreamingDestinationDelete}\n />\n ) : (\n <>\n {userCanEditStreamingDestinations && (\n <NewStreamingDestinationTypeSelector\n variant={NEW_STREAMING_DESTINATION_TYPE_SELECTOR_VARIANT.TILE}\n createServiceAction={createServiceAction}\n />\n )}\n </>\n )}\n </div>\n\n {hasStreamDestinations && userCanEditStreamingDestinations && (\n <div className=\"streaming-destinations__aside\">\n <NewStreamingDestinationTypeSelector createServiceAction={createServiceAction} />\n </div>\n )}\n </div>\n </div>\n );\n}\n","import React, {Fragment, useCallback} from 'react';\nimport classNames from 'classnames';\nimport {Icons} from 'app/util/icons';\nimport {SIZE, SORT_DIRECTION} from 'app/constants';\nimport {Callback} from 'app/types/common';\n\ninterface SortArrowProps {\n sortDirection: SORT_DIRECTION;\n}\n\nconst SortArrow: React.VFC<SortArrowProps> = ({sortDirection}) => {\n let icon;\n\n if (sortDirection === SORT_DIRECTION.DESC) {\n icon = Icons.arrowUp();\n } else {\n icon = Icons.arrowDown();\n }\n\n return (\n <Fragment>\n  \n {icon.size(SIZE.S).reactComponent()}\n </Fragment>\n );\n};\n\ninterface Props {\n sortDirection: SORT_DIRECTION;\n dataKey: string;\n disableSort?: boolean;\n sortBy: string;\n // Use only with `renderAsTable={false}`\n width: string | number;\n flexGrow?: number;\n renderAsTable: boolean;\n onSort: Callback;\n}\n\nexport const TableHeaderCell: React.FC<Props> = ({\n children,\n width,\n flexGrow,\n renderAsTable,\n dataKey,\n sortDirection,\n disableSort = false,\n sortBy,\n onSort,\n}) => {\n const handleClick = useCallback(() => {\n if (disableSort) {\n return;\n }\n\n let newSortDirection = sortDirection;\n if (sortBy === dataKey) {\n newSortDirection = sortDirection === SORT_DIRECTION.ASC ? SORT_DIRECTION.DESC : SORT_DIRECTION.ASC;\n }\n\n onSort({\n sortBy: dataKey,\n sortDirection: newSortDirection\n });\n }, [dataKey, disableSort, onSort, sortBy, sortDirection]);\n\n const sortable = disableSort === false;\n const active = sortBy === dataKey;\n const showSortArrow = sortable && active;\n\n const CellComponent = renderAsTable ? 'th' : 'div';\n let style;\n if (!renderAsTable) {\n style = {\n flex: `${flexGrow || 0} 1 ${width || 100}px`,\n };\n }\n\n return (\n <CellComponent\n className={classNames('dashboard-table__header-cell', {\n 'dashboard-table__header-cell--sortable': sortable,\n 'dashboard-table__header-cell--active': active,\n })}\n data-id={`table_header_cell_${dataKey}`}\n style={style}\n onClick={handleClick}\n >\n <span>\n {children}\n </span>\n\n {showSortArrow && <SortArrow sortDirection={sortDirection}/>}\n </CellComponent>\n );\n};\n","import React, {Fragment} from 'react';\nimport classNames from 'classnames';\nimport {TableHeaderCell} from 'app/components/Dashboard/Devices/TableView/TableHeaderCell';\nimport {Callback, ClassName} from 'app/types/common';\nimport {TableColumnType} from 'app/components/sharedReactComponents/Table/types';\nimport {SORT_DIRECTION} from 'app/constants';\n\ninterface Props extends ClassName {\n sortDirection: SORT_DIRECTION;\n cells: TableColumnType[];\n sortBy: string;\n renderAsTable: boolean;\n onSort: Callback;\n}\n\nconst TableHeader: React.VFC<Props> = ({\n className,\n cells,\n sortBy,\n sortDirection,\n renderAsTable,\n onSort,\n}) => {\n const HeaderComponent = renderAsTable ? THeadComponent : 'div';\n\n return (\n <Fragment>\n {renderAsTable && (\n <colgroup>\n {cells.map(cell => (\n <col\n key={cell.dataKey}\n style={{\n width: cell.width,\n }}\n />\n ))}\n </colgroup>\n )}\n\n <HeaderComponent className={classNames('dashboard-table__header', className)}>\n {cells.map(cell => {\n const label = cell.headerRenderer ? cell.headerRenderer({sortBy, sortDirection}) : cell.label;\n\n return (\n <TableHeaderCell\n key={cell.dataKey}\n dataKey={cell.dataKey}\n disableSort={cell.disableSort}\n sortBy={sortBy}\n sortDirection={sortDirection}\n width={cell.width!}\n flexGrow={cell.flexGrow}\n renderAsTable={renderAsTable}\n onSort={onSort}\n >\n {label}\n </TableHeaderCell>\n );\n })}\n </HeaderComponent>\n </Fragment>\n );\n};\n\nconst THeadComponent: React.FC<ClassName> = ({\n className,\n children,\n}) => {\n return (\n <thead className={className}>\n <tr>\n {children}\n </tr>\n </thead>\n );\n};\n\nexport {\n TableHeader,\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport {TableColumnType} from 'app/components/sharedReactComponents/Table/types';\n\ninterface Props {\n cell: TableColumnType;\n rowData: any;\n rowIndex: number;\n renderAsTable: boolean;\n}\n\nconst TableRowCell: React.VFC<Props> = ({\n cell,\n rowData,\n rowIndex,\n renderAsTable,\n}) => {\n const cellData = rowData[cell.dataKey];\n\n const CellComponent = renderAsTable ? 'td' : 'div';\n let style;\n if (!renderAsTable) {\n style = {\n flex: `${cell.flexGrow ?? 0} 1 ${cell.width ?? 100}px`\n };\n }\n\n return (\n <CellComponent\n className={classNames(\n 'dashboard-table__row-cell',\n `dashboard-table__row-cell--${cell.dataKey}`,\n cell.className,\n )}\n style={style}\n >\n {cell.cellRenderer ? cell.cellRenderer({cellData, rowData, rowIndex}) : cellData}\n </CellComponent>\n );\n};\n\nexport {\n TableRowCell,\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport {TableRowCell} from 'app/components/Dashboard/Devices/TableView/TableRowCell';\nimport {ClassName} from 'app/types/common';\nimport {TableColumnType} from 'app/components/sharedReactComponents/Table/types';\n\ninterface Props extends ClassName {\n cells: TableColumnType[];\n data: any;\n renderAsTable: boolean;\n}\n\nconst TableRow: React.VFC<Props> = ({\n className,\n cells,\n data,\n renderAsTable,\n}) => {\n const RowComponent = renderAsTable ? 'tr' : 'div';\n\n return (\n <RowComponent\n className={classNames('dashboard-table__row', {\n 'dashboard-table__row--selected': data.selected,\n }, className)}\n data-id=\"table_body_row\"\n >\n {cells.map((cell, index) => (\n <TableRowCell\n key={cell.dataKey}\n cell={cell}\n rowData={data}\n rowIndex={index}\n renderAsTable={renderAsTable}\n />\n ))}\n </RowComponent>\n );\n};\n\nexport {\n TableRow,\n};\n","import React, {Component} from 'react';\nimport classNames from 'classnames';\nimport {TableRow} from 'app/components/Dashboard/Devices/TableView/TableRow';\nimport {ClassName} from 'app/types/common';\nimport {TableColumnType} from 'app/components/sharedReactComponents/Table/types';\n\ninterface Props extends ClassName {\n cells: TableColumnType[];\n list: any[];\n renderAsTable: boolean;\n}\nexport class TableBody extends Component<Props> {\n render() {\n const {\n className,\n cells,\n list,\n renderAsTable,\n } = this.props;\n\n const BodyComponent = renderAsTable ? 'tbody' : 'div';\n\n return (\n <BodyComponent className={classNames('dashboard-table__body', className)}>\n {list.map(item => (\n <TableRow\n key={item.id}\n cells={cells}\n data={item}\n renderAsTable={renderAsTable}\n />\n ))}\n </BodyComponent>\n );\n }\n}\n","export interface StoreProps {\n defaultValue: any;\n storeKey: string;\n}\n\nclass Store {\n protected defaultValue: any;\n protected storeKey: string;\n\n constructor({\n defaultValue,\n storeKey,\n }: StoreProps) {\n this.defaultValue = defaultValue;\n this.storeKey = storeKey;\n }\n\n load<T = any>(): T {\n const savedData = window.localStorage.getItem(this.storeKey);\n\n if (savedData) {\n try {\n return JSON.parse(savedData);\n } catch (_: unknown) {\n }\n }\n\n return this.defaultValue;\n }\n\n save<T = any>(data: T) {\n window.localStorage.setItem(this.storeKey, JSON.stringify(data));\n }\n}\n\nexport {\n Store,\n};\n","import {Store} from 'app/util/Store';\n\ninterface Params {\n storeKey: string;\n fixedColumns?: string[];\n defaultActiveColumns?: string[];\n}\n\nexport class ColumnActiveManager {\n _store: Store;\n _fixedColumns: string[];\n _items: Set<string>;\n\n constructor({\n storeKey,\n fixedColumns = [],\n defaultActiveColumns = [],\n }: Params) {\n this._store = new Store({\n storeKey: `${storeKey}.Active`,\n defaultValue: defaultActiveColumns,\n });\n\n this._fixedColumns = fixedColumns;\n\n this._items = new Set<string>(this._load());\n }\n\n _load() {\n return this._fixedColumns.concat(this._store.load());\n }\n\n _save() {\n this._store.save(this._toJSON());\n }\n\n _toJSON(): any[] {\n return Array.from(this._items);\n }\n\n enable(id): void {\n this._items.add(id);\n this._save();\n }\n\n disable(id) {\n this._items.delete(id);\n this._save();\n }\n\n toggle(id: string, enable: boolean) {\n if (enable === true) {\n this.enable(id);\n } else {\n this.disable(id);\n }\n }\n\n getActiveIds() {\n return this._toJSON();\n }\n\n isActive(id: string) {\n return this._items.has(id);\n }\n}\n","/* eslint-disable react/default-props-match-prop-types */\nimport React, {Component} from 'react';\nimport {Icons} from 'app/util/icons';\nimport {\n VARIANT,\n SIZE,\n} from 'app/constants';\nimport {Dropdown} from 'app/components/sharedReactComponents/Dropdown';\nimport {Checkbox, CHECKBOX_THEME} from 'app/components/sharedReactComponents/Checkbox';\nimport {Tooltip, TOOLTIP_PLACEMENT} from 'app/components/sharedReactComponents/Tooltip';\nimport {Button} from 'app/components/sharedReactComponents/Button';\nimport {Callback} from 'app/types/common';\nimport {FleetManagerColumn} from 'app/components/FleetManager/types';\nimport {TableColumnType} from 'app/components/sharedReactComponents/Table/types';\n\nfunction checkAllColumnsIsFixed(columns: Array<FleetManagerColumn | TableColumnType>, fixedColumnIds: string[]) {\n if (fixedColumnIds.length === 0) {\n return false;\n }\n\n const columnsIdSet = new Set(columns.map(({dataKey}) => dataKey));\n\n const fixedColumnsIdSet = new Set(fixedColumnIds);\n\n for (const columnId of columnsIdSet) {\n if (!fixedColumnsIdSet.has(columnId)) {\n return false;\n }\n }\n\n return true;\n}\n\ninterface ItemProps {\n label: React.ReactNode;\n detailedLabel?: React.ReactNode;\n value: boolean;\n name: string;\n disabled: boolean;\n onChange: Callback;\n}\n\nconst Item: React.VFC<ItemProps> = ({\n label,\n detailedLabel,\n value,\n name,\n disabled,\n onChange,\n}) => {\n return (\n <li className=\"fleet-manager-columns-selector__option\">\n <Checkbox\n value={value}\n name={name}\n label={detailedLabel ?? label}\n theme={CHECKBOX_THEME.BLACK}\n size={SIZE.S}\n disabled={disabled}\n onChange={onChange}\n />\n </li>\n );\n};\n\ninterface Props {\n maxActiveColumns: number;\n columns: Array<FleetManagerColumn | TableColumnType>;\n fixedColumnIds: string[];\n isColumnActive: Callback;\n onChange: Callback;\n}\n\nexport class ColumnsSelector extends Component<Props> {\n static defaultProps = {\n maxActiveColumns: 12,\n columns: [],\n fixedColumnIds: [],\n };\n\n handleChange = (e) => {\n this.props.onChange(e);\n };\n\n renderList() {\n const {\n maxActiveColumns,\n columns,\n isColumnActive,\n fixedColumnIds,\n } = this.props;\n\n const activeColumnsCount = columns.reduce((acc: number, column) => {\n if (isColumnActive(column.dataKey)) {\n return acc + 1;\n }\n\n return acc;\n }, 0);\n\n const activateAllowed = activeColumnsCount < maxActiveColumns;\n\n const columnsWithoutFixed = columns.filter(column => !fixedColumnIds.includes(column.dataKey));\n\n return (\n <ul className=\"fleet-manager-columns-selector__menu\">\n {columnsWithoutFixed.map(column => (\n <Item\n key={column.dataKey}\n label={column.label}\n detailedLabel={column.detailedLabel}\n name={column.dataKey}\n value={isColumnActive(column.dataKey)}\n disabled={isColumnActive(column.dataKey) === false && activateAllowed === false}\n onChange={this.handleChange}\n />\n ))}\n </ul>\n );\n }\n\n render() {\n const {\n columns,\n fixedColumnIds,\n } = this.props;\n\n if (columns.length === 0) {\n return null;\n }\n\n if (checkAllColumnsIsFixed(columns, fixedColumnIds)) {\n return null;\n }\n\n return (\n <Dropdown\n content={this.renderList()}\n placement={TOOLTIP_PLACEMENT.BOTTOM_END}\n buttonOpenedClassName=\"fleet-manager-columns-selector__button--active\"\n appendToBody={true}\n interactive={true}\n >\n <Button\n className=\"fleet-manager-columns-selector__button\"\n variant={VARIANT.TEXT}\n >\n <Tooltip\n content=\"Column settings\"\n delay={250}\n >\n {Icons.settings().size(SIZE.S).reactComponent()}\n </Tooltip>\n </Button>\n </Dropdown>\n );\n }\n}\n","/* eslint-disable react/default-props-match-prop-types */\nimport React, {Component} from 'react';\nimport classNames from 'classnames';\nimport {TableHeader} from 'app/components/Dashboard/Devices/TableView/TableHeader';\nimport {TableBody} from 'app/components/Dashboard/Devices/TableView/TableBody';\nimport {ColumnActiveManager} from 'app/components/Dashboard/Devices/TableView/ColumnManager/ColumnActiveManager';\nimport {ColumnsSelector} from 'app/components/FleetManager/ColumnsHeader/ColumnsSelector';\nimport {stringComparator} from 'app/util/Sort';\nimport {valueComparator} from 'app/util/comparators/valueComparator';\nimport {SORT_DIRECTION} from 'app/constants';\nimport {Callback, ClassName} from 'app/types/common';\nimport {TableColumnType} from 'app/components/sharedReactComponents/Table/types';\n\nconst NAME_CELL_DATA_KEY = 'name';\n\nconst nameGetter = value => {\n if (value === null || value === undefined) {\n return '';\n }\n\n return String(value.name);\n};\n\nfunction sortList({sortBy, sortDirection, list, comparator = valueComparator}) {\n const valueGetter = item => item[sortBy];\n\n const isAscSorting = sortDirection === SORT_DIRECTION.ASC;\n\n return list.sort((a, b) => {\n const aValue = valueGetter(a);\n const bValue = valueGetter(b);\n let sortRes = 0;\n\n const nameSortRes = stringComparator(nameGetter(a), nameGetter(b));\n\n if (sortBy === NAME_CELL_DATA_KEY) {\n sortRes = nameSortRes;\n } else {\n if (aValue === bValue) {\n return 0;\n }\n\n // Don't desc sorting by name in this case\n if (aValue === null || typeof aValue === 'undefined') {\n return 1;\n }\n\n // Don't desc sorting by name in this case\n if (bValue === null || typeof bValue === 'undefined') {\n return -1;\n }\n\n sortRes = comparator(aValue, bValue);\n\n // Sort by name by default. Don't desc sorting by name in this case\n if (sortRes === 0) {\n return nameSortRes;\n }\n }\n\n return isAscSorting ? sortRes : -1 * sortRes;\n });\n}\n\ninterface Props extends ClassName {\n sortDirection: SORT_DIRECTION;\n cells: TableColumnType[];\n list: any[];\n sortBy: string;\n fixedColumnIds?: string[];\n defaultActiveColumns?: string[];\n storeKey: string;\n renderAsTable: boolean;\n}\n\ninterface State {\n cells: TableColumnType[];\n sortBy: string;\n sortDirection: SORT_DIRECTION;\n sortedList: any[];\n}\n\nexport class Table extends Component<Props, State> {\n static defaultProps = {\n sortBy: NAME_CELL_DATA_KEY,\n sortDirection: SORT_DIRECTION.ASC,\n renderAsTable: true,\n };\n\n columnActiveManager: ColumnActiveManager | null;\n cellSortComparators: Map<string, Callback>;\n\n constructor(props: Props) {\n super(props);\n\n const storeKey = props.storeKey + '.Columns';\n\n this.columnActiveManager = null;\n if (props.fixedColumnIds || props.defaultActiveColumns) {\n this.columnActiveManager = new ColumnActiveManager({\n storeKey,\n fixedColumns: props.fixedColumnIds,\n defaultActiveColumns: props.defaultActiveColumns,\n });\n }\n\n this.cellSortComparators = props.cells.reduce((acc, cell) => {\n if (cell.comparator) {\n acc.set(cell.dataKey, cell.comparator);\n }\n\n return acc;\n }, new Map());\n\n const {list} = props;\n const {sortBy} = props;\n const {sortDirection} = props;\n const sortedList = sortList({\n sortBy,\n sortDirection,\n list,\n comparator: this.cellSortComparators.get(sortBy),\n });\n\n this.state = {\n cells: this._processCells(),\n sortBy,\n sortDirection,\n sortedList,\n };\n }\n\n componentDidUpdate(prevProps) {\n const {\n cells,\n list,\n } = this.props;\n\n if (cells !== prevProps.cells) {\n this.setState({cells: this._processCells()});\n }\n\n if (list !== prevProps.list) {\n const {\n sortBy,\n sortDirection,\n } = this.state;\n\n const sortedList = sortList({\n sortBy,\n sortDirection,\n list,\n comparator: this.cellSortComparators.get(sortBy),\n });\n\n this.setState({sortedList});\n }\n }\n\n _processCells() {\n const {\n cells,\n } = this.props;\n\n if (this.columnActiveManager === null) {\n return cells;\n }\n\n const activeCells = cells.filter(cell => this.columnActiveManager?.isActive(cell.dataKey));\n\n return activeCells;\n }\n\n handleColumnsSelectorChange = ({target: {name, value}}) => {\n this.columnActiveManager?.toggle(name, value);\n this.setState({cells: this._processCells()});\n };\n\n isColumnActive = (id) => {\n return this.columnActiveManager?.isActive(id);\n };\n\n handleSort = ({sortBy, sortDirection}) => {\n const {\n list,\n } = this.props;\n\n this.setState({\n sortedList: sortList({\n sortBy,\n sortDirection,\n list,\n comparator: this.cellSortComparators.get(sortBy),\n }),\n sortBy,\n sortDirection,\n });\n };\n\n render() {\n const {\n className,\n fixedColumnIds,\n renderAsTable,\n } = this.props;\n const {\n cells,\n sortBy,\n sortDirection,\n sortedList,\n } = this.state;\n\n // TODO: Refactor this\n const cellWithContextMenu = cells.find(cell => cell.dataKey === 'contextMenu');\n if (cellWithContextMenu) {\n cellWithContextMenu.headerRenderer = () => (\n <ColumnsSelector\n columns={this.props.cells}\n fixedColumnIds={fixedColumnIds}\n isColumnActive={this.isColumnActive}\n onChange={this.handleColumnsSelectorChange}\n />\n );\n }\n\n const Component = renderAsTable ? 'table' : 'div';\n\n return (\n <Component\n className={classNames('dashboard-table', {\n 'dashboard-table--view-table': renderAsTable,\n 'dashboard-table--view-list': !renderAsTable,\n }, className)}\n >\n <TableHeader\n cells={cells}\n sortBy={sortBy}\n sortDirection={sortDirection}\n renderAsTable={renderAsTable}\n onSort={this.handleSort}\n />\n\n <TableBody\n cells={cells}\n list={sortedList}\n renderAsTable={renderAsTable}\n />\n </Component>\n );\n }\n}\n","import React from 'react';\nimport {Box, Stack, Tab, Tabs, tabClasses, tabsClasses} from '@mui/material';\nimport {grey} from '@mui/material/colors';\nimport {StyleSx, Sx} from 'app/types/common';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {RemoteLoginButton} from 'app/components/sharedReactComponents/RemoteLogin';\nimport {ModelService} from 'app/services/deviceModel/DeviceModelService';\nimport {AnyUserRoleModel} from 'app/models/PermissionsModel/types';\nimport {DetailsTab} from 'app/components/DeviceDetails/DeviceInfoTab/types';\nimport {UnifySwitcher} from 'app/components/sharedReactComponents/UnifySwitcher/UnifySwitcher';\nimport {capitalize} from 'app/components/helpers/commonHelpers';\n\nconst tabsSx: StyleSx = {\n [`& .${tabClasses.root}`]: {\n fontSize: 16,\n opacity: 1,\n minHeight: 48,\n },\n [`& .${tabsClasses.indicator}`]: {height: 4},\n};\n\ninterface Props extends Sx {\n role: AnyUserRoleModel;\n device: AnyDeviceModelType;\n activeTab: string;\n tabs: DetailsTab[];\n onTabsChange: (tab: string) => void;\n}\n\nexport function DeviceDetailsNavigation({role, activeTab, tabs, device, onTabsChange}: Props) {\n const model = device.getModelName();\n const isUnify = ModelService.isUnify(model);\n const isLiveScrypt = ModelService.isLivescrypt(model);\n const isNano = ModelService.isNano(model);\n const isWebcaster = ModelService.isWebcaster(model);\n\n const showUnify = isUnify && (device.isDown() || device.isOnline());\n const showSwitcher = !isLiveScrypt && !isNano && !isWebcaster;\n\n const permitUnify = role.canManageUnify();\n const canEditBilling = role.canEditBilling();\n\n const handleTabChange = (_event: React.SyntheticEvent, newValue: string) => {\n onTabsChange(newValue);\n };\n\n const access = device.capabilities.login;\n\n return (\n <Box bgcolor={grey[200]} borderTop={1} borderBottom={1} borderColor={grey[300]}>\n <Stack direction=\"row\" className=\"container\">\n <Stack direction=\"row\" flexGrow={1}>\n <Tabs\n data-id=\"details-tabs\"\n sx={tabsSx}\n textColor=\"inherit\"\n value={activeTab}\n onChange={handleTabChange}\n >\n {tabs.map((tab) => (\n <Tab\n data-id={`${tab}-tab`}\n key={tab}\n value={tab}\n label={formatTab(tab)}\n disableRipple={false}\n />\n ))}\n </Tabs>\n </Stack>\n\n <Stack direction=\"row\" alignItems=\"center\" gap={1} flexShrink={0}>\n {showSwitcher && (\n <RemoteLoginButton\n type=\"switcher\"\n premium={access}\n paymentAccess={canEditBilling}\n deviceId={device.getId()}\n disabled={device.isOffline()}\n />\n )}\n\n {!isWebcaster && (\n <RemoteLoginButton\n type=\"admin\"\n premium={access}\n paymentAccess={canEditBilling}\n deviceId={device.getId()}\n disabled={device.isOffline()}\n />\n )}\n\n {showUnify && (\n <UnifySwitcher\n project={device}\n action={device.isDown() ? 'start' : 'stop'}\n disabled={!permitUnify}\n />\n )}\n </Stack>\n </Stack>\n </Box>\n );\n}\n\nfunction formatTab(tab: DetailsTab): string {\n if (tab === 'status') {\n return 'Device info';\n }\n\n return capitalize(tab);\n}\n","/* eslint-disable react/default-props-match-prop-types */\nimport React, {Component} from 'react';\nimport classNames from 'classnames';\nimport {Icons} from 'app/util/icons';\nimport {SIZE} from 'app/constants';\nimport {ClassName} from 'app/types/common';\n\nfunction trimTranscript(transcript: Transcription[], itemsCount: number): Transcription[] {\n if (itemsCount > 0) {\n return transcript.slice(-(itemsCount));\n }\n\n return transcript;\n}\n\nconst SHOW_MESSAGES_COUNT = 5;\n\ninterface Props extends ClassName {\n transcript: Transcription[];\n itemsCount: number;\n paused: boolean;\n disabled: boolean;\n placeholder: string;\n}\n\ninterface State {\n transcript: any[];\n}\n\n// move to service\ninterface Transcription {\n // rework indexed\n [key: string]: any;\n id: string | number;\n value: string;\n timestamp: string;\n partial: boolean;\n}\n\nexport class TranscribingText extends Component<Props, State> {\n static defaultProps = {\n transcript: [],\n placeholder: 'Your transcription will show up here',\n itemsCount: SHOW_MESSAGES_COUNT,\n };\n\n constructor(props) {\n super(props);\n\n this.state = {\n transcript: trimTranscript(props.transcript, props.itemsCount),\n };\n }\n\n componentDidUpdate(prevProps) {\n let {\n transcript,\n itemsCount,\n } = this.props;\n\n if (transcript === prevProps.transcript) {\n return;\n }\n\n const prevIds = prevProps.transcript.reduce((acc, b) => {\n if (!b.partial) {\n acc.add(b.id);\n }\n\n return acc;\n }, new Set());\n\n transcript = trimTranscript(transcript, itemsCount);\n\n transcript.forEach((item): any => {\n item.new = !prevIds.has(item.id);\n });\n\n this.setState({transcript});\n }\n\n render() {\n const {\n className,\n paused,\n disabled,\n placeholder,\n transcript: transcriptProps,\n itemsCount,\n ...rest\n } = this.props;\n const {\n transcript,\n } = this.state;\n\n if (disabled) {\n return null;\n }\n\n return (\n <div\n className={classNames('transcribing-text', className)}\n {...rest}\n >\n {transcript.length > 0 ? (\n <div className=\"transcribing-text__content\">\n {transcript.map(item => (\n <div\n key={item.id || 'new'}\n className={classNames('transcribing-text__item', {\n 'transcribing-text__item--partial': item.partial && !paused,\n 'transcribing-text__item--new': item.new && !paused,\n })}\n >\n {item.value}\n\n {(item.partial && !paused) && (\n <span className=\"transcribing-text__item-progress\">\n {Icons.loadingDots().size(SIZE.XL).reactComponent()}\n </span>\n )}\n </div>\n ))}\n </div>\n ) : (\n <div className=\"transcribing-text__placeholder\">\n {placeholder}\n </div>\n )}\n </div>\n );\n }\n}\n","const MARGIN_SIZE = 4;\n\n// This is *very* rough estimate of max amount of QRCode allowed to be covered.\n// It is \"wrong\" in a lot of ways (area is a terrible way to estimate, it\n// really should be number of modules covered), but if for some reason we don't\n// get an explicit height or width, I'd rather default to something than throw.\nconst DEFAULT_IMG_SCALE = 0.1;\n\nenum QR_CODE_LEVEL {\n L = 'L',\n M = 'M',\n Q = 'Q',\n H = 'H',\n}\n\nexport {\n MARGIN_SIZE,\n DEFAULT_IMG_SCALE,\n QR_CODE_LEVEL,\n};\n","import React, {Fragment} from 'react';\n\ninterface Props {\n value: string;\n}\n\nexport const TabPanels: React.FC<Props> = ({\n value,\n children: childrenProp,\n}) => {\n const children = React.Children.map(childrenProp, (child: any) => {\n if (\n React.isValidElement(child) === false ||\n value !== child.props.value\n ) {\n return null;\n }\n\n return child;\n });\n\n return (\n <Fragment>\n {children}\n </Fragment>\n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport {WAI_ARIA_ROLE} from 'app/constants/waiAriaRole';\nimport {ClassName, Sx} from 'app/types/common';\nimport {Box} from '@mui/material';\n\ninterface Props extends ClassName, Sx {\n // Used in <TabPanels>\n // eslint-disable-next-line react/no-unused-prop-types\n value?: string;\n}\n\nexport const TabPanel: React.FC<Props> = ({sx, className, children}) => {\n if (!children) {\n return null;\n }\n\n return (\n <Box\n sx={sx}\n className={classNames('tabs__tab-panel', className)}\n role={WAI_ARIA_ROLE.TAB_PANEL}\n >\n {children}\n </Box>\n );\n};\n","enum SETTINGS_LIST_THEME {\n DEFAULT = 'default',\n DEVICE_SETTINGS = 'device-settings',\n}\n\nexport {\n SETTINGS_LIST_THEME,\n};\n","import React, {useState} from 'react';\nimport {z} from 'zod';\nimport {Box, Button, Card, FormLabel, Stack, TextField, Typography, alpha} from '@mui/material';\nimport {LoadingButton} from '@mui/lab';\nimport {Controller, useForm} from 'react-hook-form';\nimport {zodResolver} from '@hookform/resolvers/zod';\nimport {blue} from '@mui/material/colors';\nimport {formatYYYYMMDD} from 'app/util/time';\nimport {Sx} from 'app/types/common';\nimport {ALLOWED_CHARS_REGEXP} from 'app/util/validators/DevicePresetNameValidator';\nimport {\n DEVICE_PRESET_SECTION_ICON,\n DEVICE_PRESET_SECTION_NAME,\n} from 'app/constants/devicePresetSection';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {Edge} from 'app/domain/edge';\nimport {isNil} from 'app/util/isNil';\nimport {OverwritePresetDialog} from 'app/components/sharedReactComponents/DevicePresetForm/dialogs/OverwritePresetDialog';\nimport {Cloud} from 'app/domain/cloud';\nimport {getModelSections} from 'app/components/DeviceDetails/PresetsTab/utils';\nimport {ModelService} from 'app/services/deviceModel/DeviceModelService';\nimport {useMounted} from 'app/hooks/useIsMounted';\n\nconst PresetScheme = z.object({\n name: z\n .string()\n .trim()\n .min(1, {message: 'Name is required'})\n .refine((value) => /^[A-Za-z0-9_\\-+ #()[\\]]+$/.test(value), {\n message: 'Allowed symbols: A-Z a-z 0-9 _-+ #()[]',\n }),\n description: z.string().trim().optional(),\n sections: z\n .array(z.string())\n .refine((s) => s.length > 0, {message: 'Select at least one configuration group'}),\n});\n\nexport type PresetFields = z.infer<typeof PresetScheme>;\n\ninterface Props extends Sx {\n deviceName: string;\n model: Cloud.UnitModel;\n unitPresets: Edge.UnitPreset[];\n offline: boolean;\n onCancel: () => void;\n onCreate: (preset: PresetFields) => Promise<void>;\n}\n\nexport function DevicePresetForm({\n sx,\n deviceName,\n model,\n unitPresets,\n offline,\n onCreate,\n onCancel,\n}: Props) {\n const mounted = useMounted();\n\n const [loading, setLoading] = useState(false);\n const [presetToOverwrite, setPresetToOverwrite] = useState<PresetFields | undefined>(undefined);\n\n const sections = getModelSections(model);\n\n const disabled = loading || offline;\n\n const {\n control,\n formState: {errors, isValid},\n handleSubmit,\n } = useForm<PresetFields>({\n defaultValues: {name: generatePresetName(deviceName), sections},\n mode: 'onChange',\n resolver: zodResolver(PresetScheme),\n });\n\n const handleCreate = async (fields: PresetFields) => {\n try {\n setLoading(true);\n await onCreate({name: fields.name, sections: fields.sections});\n setPresetToOverwrite(undefined);\n } finally {\n if (mounted()) {\n setLoading(false);\n }\n }\n };\n\n const handleFormSubmit = async (fields: PresetFields) => {\n if (unitPresets.some((localPreset) => localPreset.name === fields.name)) {\n setPresetToOverwrite(fields);\n return;\n }\n\n await handleCreate(fields);\n };\n\n const getErrorTooltip = () => {\n return Object.values(errors)[0]?.message;\n };\n\n const shouldOverwrite = !isNil(presetToOverwrite);\n\n return (\n <Card\n data-id=\"preset-form\"\n component=\"form\"\n sx={packSx({p: 1, bgcolor: alpha(blue[50], 0.3)}, sx)}\n variant=\"outlined\"\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n }\n }}\n onSubmit={handleSubmit(handleFormSubmit)}\n >\n <Stack direction=\"row\" alignItems=\"center\" justifyContent=\"space-between\" gap={2} mb={2}>\n <Typography>\n Create team preset from the local {ModelService.isUnify(model) ? 'project' : 'device'}{' '}\n configuration\n </Typography>\n\n <Stack direction=\"row\" alignItems=\"center\" gap={1}>\n <Button\n data-id=\"cancel-preset-from-btn\"\n variant=\"outlined\"\n color=\"info\"\n disabled={disabled}\n onClick={onCancel}\n >\n Cancel\n </Button>\n\n <Tooltip content={getErrorTooltip()}>\n <span>\n <LoadingButton\n data-id=\"submit-preset-from-btn\"\n type=\"submit\"\n variant=\"contained\"\n color=\"secondary\"\n disabled={!isValid}\n loading={loading}\n >\n Create\n </LoadingButton>\n </span>\n </Tooltip>\n </Stack>\n </Stack>\n\n <Stack direction=\"row\" alignItems=\"flex-start\" justifyContent=\"space-between\" gap={5}>\n <Box flex={1}>\n <FormLabel sx={{display: 'block', mb: 0.5}}>Preset name</FormLabel>\n\n <Controller\n name=\"name\"\n control={control}\n disabled={disabled}\n render={({field, fieldState: {error}}) => (\n <TextField\n {...field}\n data-id=\"preset-name\"\n variant=\"standard\"\n disabled={disabled}\n fullWidth={true}\n error={Boolean(error)}\n helperText={error?.message ?? ' '}\n />\n )}\n />\n </Box>\n\n <Box>\n <FormLabel sx={{display: 'block', mb: 0.5}}>Preset name</FormLabel>\n <Controller\n control={control}\n name=\"sections\"\n disabled={disabled}\n render={({field: {value, onChange}}) => {\n const active = new Set([...value]);\n\n const handleChange = (section: Edge.PresetSection) => {\n if (active.has(section)) {\n active.delete(section);\n } else {\n active.add(section);\n }\n\n onChange([...active]);\n };\n\n return (\n <Stack component=\"fieldset\" direction=\"row\" alignItems=\"flex-start\" gap={1}>\n {sections.map((s) => {\n const selected = active.has(s);\n\n return (\n <Tooltip key={s} content={DEVICE_PRESET_SECTION_NAME[s]}>\n <Button\n key={s}\n data-id={`${s}-btn`}\n sx={{p: 0.5, width: 36, height: 36, minWidth: 0}}\n variant={selected ? 'contained' : 'outlined'}\n color={selected ? 'primary' : 'info'}\n disabled={disabled}\n onClick={() => handleChange(s)}\n >\n {DEVICE_PRESET_SECTION_ICON[s].reactComponent()}\n </Button>\n </Tooltip>\n );\n })}\n </Stack>\n );\n }}\n />\n </Box>\n </Stack>\n\n {shouldOverwrite && (\n <OverwritePresetDialog\n open={shouldOverwrite}\n name={presetToOverwrite.name}\n loading={loading}\n onOverwrite={async () => handleCreate(presetToOverwrite)}\n onClose={() => setPresetToOverwrite(undefined)}\n />\n )}\n </Card>\n );\n\n function generatePresetName(deviceName = '') {\n const name = deviceName\n .split('')\n .map((char) => (ALLOWED_CHARS_REGEXP.test(char) ? char : '_'))\n .join('');\n return `${name} Config as of ${formatYYYYMMDD(Date.now() / 1000)}`;\n }\n}\n","import React from 'react';\nimport classNames from 'classnames';\nimport {\n DeviceStatusRecordingIcon,\n DeviceStatusStreamingIcon,\n} from 'app/components/sharedReactComponents/DeviceStatusIcons';\nimport {DurationTimer} from 'app/components/sharedReactComponents/DurationTimer';\nimport {Callback, ClassName} from 'app/types/common';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {Schedule} from 'app/domain/schedule';\nimport {EventInfo} from 'app/components/sharedReactComponents/Events/shared/EventInfo/EventInfo';\n\nconst items = [\n {\n id: 'streaming',\n icon: <DeviceStatusStreamingIcon />,\n isActive: (device) => device.isStreaming(),\n getStartTime: (device) => device.getStreamingStartTime(),\n },\n {\n id: 'recording',\n icon: <DeviceStatusRecordingIcon />,\n isActive: (device) => device.isRecording(),\n getStartTime: (device) => device.getDeviceRecordingStartTime(),\n },\n];\ninterface StatusProps {\n id: string;\n icon: React.ReactNode;\n isActive: Callback;\n getStartTime: Callback;\n device: any;\n}\n\nconst Status: React.VFC<StatusProps> = ({id, icon, isActive, getStartTime, device}) => {\n if (isActive(device) === false) {\n return null;\n }\n\n return (\n <div\n className={classNames(\n 'channel-details-status-list__item',\n `channel-details-status-list__item--${id}`,\n )}\n data-id={`device_status_${id}`}\n >\n {icon}\n\n <DurationTimer\n className=\"channel-details-status-list__duration\"\n startTime={getStartTime(device)}\n />\n </div>\n );\n};\n\ninterface Props extends ClassName {\n device: AnyDeviceModelType;\n event?: Schedule.Event;\n}\n\nexport function ChannelDetailsStatusList({className, device, event}: Props) {\n return (\n <div className={classNames('channel-details-status-list', className)}>\n {items.map((item) => (\n <Status\n key={item.id}\n id={item.id}\n icon={item.icon}\n isActive={item.isActive}\n getStartTime={item.getStartTime}\n device={device}\n />\n ))}\n\n {event && <EventInfo deviceId={device.getId()} event={event} />}\n </div>\n );\n}\n","import React from 'react';\nimport classNames from 'classnames';\nimport {ClassName} from 'app/types/common';\n\nexport const PropsListItem: React.FC<ClassName> = ({\n className,\n children,\n ...elementProps\n}) => {\n return (\n <li\n className={classNames('props-list__item', className)}\n {...elementProps}\n >\n {children}\n </li>\n );\n};\n","import React, {Component} from 'react';\nimport classNames from 'classnames';\nimport {ClassName} from 'app/types/common';\n\nexport class PropsListLabel extends Component<ClassName> {\n render() {\n const {\n className,\n children,\n } = this.props;\n\n return (\n <div className={classNames('props-list__label', className)}>\n {children}\n </div>\n );\n }\n}\n","import React, {Component} from 'react';\nimport classNames from 'classnames';\nimport {ClassName} from 'app/types/common';\n\nexport class PropsListValue extends Component<ClassName> {\n render() {\n const {\n className,\n children,\n } = this.props;\n\n return (\n <div className={classNames('props-list__value', className)}>\n {children}\n </div>\n );\n }\n}\n","import React, {Component} from 'react';\nimport classNames from 'classnames';\nimport {Callback, ClassName} from 'app/types/common';\n\ninterface Props extends ClassName {\n note: Callback | React.ReactNode;\n}\nexport class PropsListItemNote extends Component<Props> {\n render() {\n const {\n className,\n note,\n } = this.props;\n\n return (\n <div className={classNames('props-list__item-note', className)}>\n {typeof note === 'function' ? note() : note}\n </div>\n );\n }\n}\n","import React from 'react';\nimport classNames from 'classnames';\nimport {PropsListItem} from 'app/components/sharedReactComponents/PropsList/PropsListItem';\nimport {PropsListLabel} from 'app/components/sharedReactComponents/PropsList/PropsListLabel';\nimport {PropsListValue} from 'app/components/sharedReactComponents/PropsList/PropsListValue';\nimport {PropsListItemNote} from 'app/components/sharedReactComponents/PropsList/PropsListItemNote';\nimport {isNil} from 'app/util/isNil';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\nimport {Callback, ClassName} from 'app/types/common';\n\n/**\n * @readonly\n * @enum {string}\n */\nexport enum PROPS_LIST_THEME {\n ADMIN = 'admin',\n DEFAULT = 'default',\n BOLD = 'bold',\n SLIM_VERTICAL = 'slim-vertical',\n SLIM_HORIZONTAL = 'slim-horizontal',\n}\n\nexport interface Row {\n dataKey: string;\n label: string | React.ReactNode;\n value?: number | string | React.ReactNode;\n cellRenderer?: Callback;\n note?: Callback | React.ReactNode;\n visible?: boolean;\n}\n\nfunction processValue(value, defaultValue) {\n if (!isNil(value)) {\n return value;\n }\n\n return defaultValue;\n}\n\ninterface ItemProps {\n data: any;\n row: Row;\n defaultValue: string;\n}\n\nconst Item: React.FC<ItemProps> = ({\n data,\n row,\n defaultValue,\n}) => {\n const {\n dataKey,\n label,\n value: rowValue,\n cellRenderer,\n note,\n visible,\n } = row;\n\n if (visible === false) {\n return null;\n }\n\n let value;\n if (cellRenderer) {\n try {\n value = cellRenderer({\n cellData: data[dataKey],\n rowData: data,\n });\n } catch (error: unknown) {\n value = (\n <Tooltip content={(error as Error).message}>\n <span style={{color: 'red'}}>\n error\n </span>\n </Tooltip>\n );\n }\n } else if (isNil(rowValue) === false) {\n value = rowValue;\n } else {\n value = data[dataKey];\n }\n\n return (\n <PropsListItem data-id={`props_list_item_${dataKey}`}>\n <PropsListLabel>\n {label}\n </PropsListLabel>\n\n <PropsListValue>\n {processValue(value, defaultValue)}\n </PropsListValue>\n\n {note && (\n <PropsListItemNote note={note}/>\n )}\n </PropsListItem>\n );\n};\n\ninterface Props extends ClassName {\n data?: Record<string, any>;\n rows?: Row[];\n defaultValue?: string;\n theme?: PROPS_LIST_THEME;\n}\n\nexport const PropsList: React.VFC<Props> = ({\n className,\n data = {},\n rows = [],\n defaultValue = 'N/A',\n theme = PROPS_LIST_THEME.DEFAULT,\n ...elementProps\n}) => {\n return (\n <ul\n className={classNames('props-list', {\n [`props-list--theme-${theme}`]: Boolean(theme),\n }, className)}\n {...elementProps}\n >\n {rows.map((row, index) => (\n <Item\n key={isNil(row.dataKey) ? index : row.dataKey}\n data={data}\n row={row}\n defaultValue={defaultValue}\n />\n ))}\n </ul>\n );\n};\n","enum PREVIEW_MODE {\n LIVE_SD = 'LIVE_SD',\n LIVE_HD = 'LIVE_HD',\n OFFLINE = 'OFFLINE',\n}\n\nexport {\n PREVIEW_MODE,\n};\n","import React from 'react';\nimport {PREVIEW_MODE} from 'app/components/DeviceDetails/ChannelDetailsTab/constants';\nimport {Switcher, SWITCHER_THEME} from 'app/components/sharedReactComponents/Switcher';\nimport {SIZE} from 'app/constants';\nimport {Callback} from 'app/types/common';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\n\ninterface Props {\n previewMode: PREVIEW_MODE;\n onPreviewModeChange: Callback;\n tooltip?: string;\n disabled?: boolean;\n}\n\nexport const FrameRate = React.forwardRef<HTMLDivElement, Props>(\n ({previewMode, disabled, tooltip, onPreviewModeChange}, ref) => {\n const handlePreviewModeChange = ({target: {value}}) => {\n const mode = value ? PREVIEW_MODE.LIVE_HD : PREVIEW_MODE.LIVE_SD;\n onPreviewModeChange({target: {value: mode}});\n };\n\n return (\n <div ref={ref}>\n <Tooltip content={tooltip}>\n <div>\n <span className=\"device-status-preview-controls__label\">Frame Rate:</span>\n\n <Switcher\n data-id=\"device_preview_mode_switcher\"\n value={previewMode === PREVIEW_MODE.LIVE_HD}\n theme={SWITCHER_THEME.SILVER_SAND}\n showLabel={true}\n labelOnText=\"Full\"\n labelOffText=\"Low\"\n size={SIZE.S}\n disabled={disabled}\n onChange={handlePreviewModeChange}\n />\n </div>\n </Tooltip>\n </div>\n );\n },\n);\n","import Hls from 'hls.js';\nimport {secondsToMilliseconds} from 'app/util/timeConverter';\nimport {noop} from 'app/util/noop';\nimport {Callback} from 'app/types/common';\nimport {isNil} from 'app/util/isNil';\n\nconst FATAL_RETRY_TIMEOUT = secondsToMilliseconds(2);\nconst FATAL_RETRY_COUNT = 5;\n\ninterface Params {\n element: HTMLVideoElement;\n onError?: Callback;\n}\n\nexport class VideoHlsController {\n private element: HTMLVideoElement;\n private hls?: Hls;\n private onError: Callback;\n private fatalRetriesLeft = FATAL_RETRY_COUNT;\n private retryTimeout: number = 0;\n private manifestParsed = false;\n private lastClickedStateIsPlay = false;\n private playPromise?: Promise<any>;\n\n constructor({element, onError = noop}: Params) {\n this.element = element;\n this.onError = onError;\n }\n\n play(url: string): void {\n this.lastClickedStateIsPlay = true;\n\n if (this.hls) {\n this.hls.destroy();\n }\n\n this.initialize(url, this.element);\n this.hls?.attachMedia(this.element);\n }\n\n async pause(): Promise<void> {\n this.lastClickedStateIsPlay = false;\n\n if (this.hls) {\n this.hls.stopLoad();\n }\n\n if (this.playPromise) {\n await this.playPromise;\n this.element.pause();\n }\n }\n\n destroy(): void {\n clearTimeout(this.retryTimeout);\n this.retryTimeout = 0;\n\n if (this.hls) {\n this.hls.destroy();\n }\n }\n\n private initialize(url: string, element: HTMLVideoElement) {\n this.hls = new Hls({\n manifestLoadingMaxRetry: 5,\n manifestLoadingTimeOut: secondsToMilliseconds(20),\n manifestLoadingRetryDelay: secondsToMilliseconds(4),\n });\n\n this.hls.on(Hls.Events.MEDIA_ATTACHED, () => {\n this.manifestParsed = false;\n this.resetFatalRetriesCounter();\n this.hls?.loadSource(url);\n });\n\n this.hls.on(Hls.Events.MANIFEST_PARSED, () => {\n this.manifestParsed = true;\n\n if (this.lastClickedStateIsPlay) {\n this.playPromise = element.play();\n // TODO: Empty catch to prevent console logs?\n this.playPromise.catch(() => ({}));\n } else if (this.hls) {\n this.hls.stopLoad();\n }\n });\n\n this.hls.on(Hls.Events.FRAG_PARSED, () => {\n this.resetFatalRetriesCounter();\n });\n\n this.hls.on(Hls.Events.ERROR, (_event, data) => {\n if (!this.lastClickedStateIsPlay) {\n return;\n }\n\n if (!data.fatal) {\n return;\n }\n\n switch (data.type) {\n case Hls.ErrorTypes.NETWORK_ERROR:\n this.handleFatalError(data, () => {\n if (this.manifestParsed) {\n this.hls?.startLoad();\n } else {\n this.hls?.loadSource(url);\n }\n });\n break;\n case Hls.ErrorTypes.MEDIA_ERROR:\n this.handleFatalError(data, () => {\n this.hls?.recoverMediaError();\n });\n break;\n default:\n this.handleFatalError(data);\n }\n });\n }\n\n private resetFatalRetriesCounter() {\n this.fatalRetriesLeft = FATAL_RETRY_COUNT;\n }\n\n private handleFatalError(errorData: any, tryHandle?: Callback, onError = this.onError) {\n this.fatalRetriesLeft -= 1;\n\n if (!isNil(tryHandle) && this.fatalRetriesLeft > 0) {\n this.retryTimeout = window.setTimeout(tryHandle, FATAL_RETRY_TIMEOUT);\n } else if (onError) {\n onError(errorData);\n }\n }\n}\n","import {front} from 'app/api/CirrusApi';\nimport {Callback} from 'app/types/common';\nimport {noop} from 'app/util/noop';\nimport {secondsToMilliseconds} from 'app/util/timeConverter';\nimport {ApiResponseNumeralStatus} from 'app/data/Status';\nimport {AbortCallback} from 'app/api/types';\nimport {VideoHlsController} from 'app/components/DeviceDetails/ChannelDetailsTab/DeviceStatusPreview/VideoHlsController';\n\nconst KEEPALIVE_TIMEOUT = secondsToMilliseconds(15);\n\nconst WAIT_FOR_STREAM_TIMEOUT = secondsToMilliseconds(2);\nconst WAIT_FOR_STREAM_RETRIES = 5;\n\ninterface Params {\n deviceId: string;\n videoHlsController: any;\n onError?: Callback;\n}\n\nexport class VideoStreamController {\n private deviceId: string;\n private controller: VideoHlsController;\n private onError: Callback;\n private streamEndpoint: any;\n private streamUrl: string;\n private tryGetHlsTimeout = 0;\n private abortRequest: AbortCallback = noop;\n private abortHlsRequest: AbortCallback = noop;\n private keepAliveTimeout = 0;\n private loadingPromise: any = null;\n private isLoaded = false;\n private isPlaying = false;\n\n constructor({deviceId, videoHlsController, onError = noop}: Params) {\n this.deviceId = deviceId;\n this.controller = videoHlsController;\n this.onError = onError;\n\n this.streamEndpoint = front.devices(deviceId).hls().playlist();\n this.streamUrl = this.streamEndpoint.url();\n }\n\n destroy() {\n this.stopKeepAliveRequest();\n this.abortRequest();\n this.abortHlsRequest();\n this.controller.destroy();\n clearTimeout(this.tryGetHlsTimeout);\n }\n\n play() {\n this.isPlaying = true;\n\n let loading;\n if (this.loadingPromise) {\n loading = this.loadingPromise;\n } else if (this.isLoaded) {\n loading = Promise.resolve();\n } else {\n loading = this.load();\n }\n\n return loading\n .then(() => {\n if (this.isPlaying) {\n this.controller.play(this.streamUrl);\n }\n })\n .catch((errorMessage) => {\n this.pause();\n\n this.onError(errorMessage);\n });\n }\n\n pause() {\n void this.controller.pause();\n this.isPlaying = false;\n this.stopKeepAliveRequest();\n this.isLoaded = false;\n }\n\n private load(): Promise<any> {\n this.loadingPromise = this.startLive()\n .then(() => {\n this.isLoaded = true;\n\n if (!this.keepAliveTimeout) {\n this.startKeepAliveRequest();\n }\n })\n .then(async () => this.waitForHlsUrl())\n .catch(async (error) => {\n this.isLoaded = false;\n\n let errorMessage;\n\n if (error.status === ApiResponseNumeralStatus.PaymentRequired) {\n errorMessage = 'Full frame rate and audio are not available for free teams.';\n }\n\n return Promise.reject(errorMessage);\n })\n .finally(() => {\n this.loadingPromise = null;\n });\n\n return this.loadingPromise;\n }\n\n private startLive(): Promise<void> {\n const getAbort = (abort) => {\n this.abortRequest = abort;\n };\n\n return front.devices(this.deviceId).task().live().start().post(undefined, {getAbort});\n }\n\n private waitForHlsUrl(): Promise<any> {\n let tryCounter = 0;\n\n const tryGetHls = (resolve, reject) => {\n const getAbort = (abort) => {\n this.abortHlsRequest = abort;\n };\n\n this.streamEndpoint\n .get(undefined, {\n contentType: false,\n getAbort,\n })\n .then((response) => {\n if (response) {\n return resolve();\n }\n\n return Promise.reject(response);\n })\n .catch((error) => {\n if (tryCounter < WAIT_FOR_STREAM_RETRIES) {\n tryCounter += 1;\n this.tryGetHlsTimeout = window.setTimeout(() => {\n tryGetHls(resolve, reject);\n }, WAIT_FOR_STREAM_TIMEOUT);\n } else {\n reject(error);\n }\n });\n };\n\n return new Promise(tryGetHls);\n }\n\n private startKeepAliveRequest() {\n this.keepAliveTimeout = window.setTimeout(async () => {\n await this.startLive();\n await this.startKeepAliveRequest();\n }, KEEPALIVE_TIMEOUT);\n }\n\n private stopKeepAliveRequest() {\n clearTimeout(this.keepAliveTimeout);\n this.keepAliveTimeout = 0;\n }\n}\n","import React, {forwardRef} from 'react';\nimport classNames from 'classnames';\nimport {ClassName} from 'app/types/common';\n\nexport enum PANEL_THEME {\n DEVICE_DETAILS_ACTIONS = 'device-details-actions',\n DEVICE_SETTINGS = 'device-settings',\n}\n\ninterface Props extends ClassName {\n title: React.ReactNode;\n theme: PANEL_THEME;\n children?: React.ReactNode;\n}\n\nexport const Panel = forwardRef<HTMLDivElement, Props>(({\n className,\n title,\n theme,\n children\n}, ref) => (\n <div\n ref={ref}\n className={classNames('panel', `panel--theme-${theme}`, className)}\n >\n <div className=\"panel__title\">\n {title}\n </div>\n\n <div className=\"panel__body\">\n {children}\n </div>\n </div>\n));\n\nPanel.displayName = 'Panel';\n","import React, {Fragment, ReactNode, KeyboardEvent} from 'react';\nimport classNames from 'classnames';\nimport {Dropdown} from 'app/components/sharedReactComponents/Dropdown';\nimport {Icons} from 'app/util/icons';\nimport {\n VARIANT,\n SIZE,\n KeyboardCode,\n} from 'app/constants';\nimport {Button} from 'app/components/sharedReactComponents/Button';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\nimport {Callback} from 'app/types/common';\nimport {LoadingWrapper} from 'app/components/sharedReactComponents/LoadingWrapper';\n\nconst Separator = () => <li className=\"context-menu__separator\"/>;\n\nexport interface ContextMenuItem {\n label?: React.ReactNode;\n action?: Callback;\n icon?: React.ReactNode;\n title?: React.ReactChild;\n danger?: boolean;\n disabled?: boolean;\n visible?: boolean;\n separator?: boolean;\n itemDataId?: string;\n loading?: boolean;\n}\n\ntype ItemProps = Omit<ContextMenuItem, 'visible' | 'separator'>;\n\nconst Item: React.FC<ItemProps> = ({\n label,\n action,\n icon,\n title,\n danger,\n disabled,\n itemDataId,\n loading = false,\n}) => {\n const handleKeyUp = (event: KeyboardEvent) => {\n if (!disabled && action && event.code === KeyboardCode.Enter) {\n action();\n }\n };\n\n const handleClick = (e: React.SyntheticEvent) => {\n e.stopPropagation();\n action?.();\n };\n\n return (\n <LoadingWrapper loading={loading}>\n <li\n className={classNames('context-menu__item', {\n 'context-menu__item--danger': danger,\n 'context-menu__item--disabled': disabled,\n })}\n >\n <span\n className=\"context-menu__action\"\n data-id={itemDataId}\n tabIndex={0}\n onKeyUp={handleKeyUp}\n onClick={disabled ? undefined : handleClick}\n >\n {icon && (\n <span className=\"context-menu__icon\">\n {icon}\n </span>\n )}\n\n <Tooltip content={title}>\n <span className=\"context-menu__name\">\n {label}\n </span>\n </Tooltip>\n </span>\n </li>\n </LoadingWrapper>\n );\n};\n\ntype ListProps = {\n items: ContextMenuItem[];\n headerComponent: ReactNode;\n};\n\nconst List: React.VFC<ListProps> = ({\n items,\n headerComponent,\n}) => {\n const withIcons = items.some(item => Boolean(item.icon));\n\n return (\n <ul\n className={classNames('context-menu__list', {'context-menu__list--with-icons': withIcons})}\n onClick={(e) => e.stopPropagation()}\n >\n {headerComponent && (\n <Fragment>\n <li className=\"context-menu__header\">\n {headerComponent}\n </li>\n\n <Separator/>\n </Fragment>\n )}\n\n {items.map((item, index) => {\n if (item.separator) {\n return (\n <Separator key={index}/>\n );\n }\n\n return (\n <Item\n key={index}\n {...item}\n />\n );\n })}\n </ul>\n );\n};\n\ninterface Props {\n items: ContextMenuItem[];\n buttonOpenedClassName?: string;\n headerComponent?: React.ReactNode;\n onOpen?: Callback;\n onClose?: Callback;\n}\n\nexport const ContextMenu: React.FC<Props> = ({\n buttonOpenedClassName,\n items,\n children,\n headerComponent,\n onOpen,\n onClose,\n}) => {\n const visibleItems = items.filter(item => item.visible !== false);\n const visibleItemsWithoutSeparators = visibleItems.filter(item => item.separator !== true);\n\n if (visibleItemsWithoutSeparators.length === 0) {\n return null;\n }\n\n return (\n <Dropdown\n buttonOpenedClassName={buttonOpenedClassName}\n content={(\n <List\n items={visibleItems}\n headerComponent={headerComponent}\n />\n )}\n onOpen={onOpen}\n onBlur={onClose}\n >\n {children}\n </Dropdown>\n );\n};\n\ninterface EllipsedContextMenuProps extends Props {\n size?: SIZE;\n buttonDataId?: string;\n disabled?: boolean;\n}\n\nexport const EllipsedContextMenu = ({\n buttonDataId,\n disabled,\n size,\n ...props\n}: EllipsedContextMenuProps) => (\n <ContextMenu {...props}>\n <Button\n className=\"context-menu__ellipsis-button\"\n dataId={buttonDataId}\n variant={VARIANT.TEXT}\n disabled={disabled}\n onClick={(e) => e.stopPropagation()}\n >\n {Icons.ellipsis().size(size).reactComponent()}\n </Button>\n </ContextMenu>\n);\n","/**\n * @readonly\n * @enum {string}\n */\nexport enum USER_GUIDE_ADMIN_PANEL_URL {\n PEARL_2 = 'https://www.epiphan.com/userguides/pearl/Content/UserGuides/Streaming/setup/connectToAdmin.htm',\n PEARL_MINI = 'https://www.epiphan.com/userguides/pearl-mini/Content/UserGuides/Streaming/setup/connectToAdmin.htm',\n}\n","import React, {FC, ReactElement, ReactNode, useState} from 'react';\nimport {\n Modal,\n ModalBody,\n ModalCancelButton,\n ModalContainer,\n ModalFooter,\n ModalTitle,\n} from 'app/components/sharedReactComponents/Modal/Modal';\nimport {ProgressButton} from 'app/components/sharedReactComponents/ProgressButton';\nimport {\n SIZE,\n THEME,\n VARIANT,\n} from 'app/constants';\nimport {useIsMounted} from 'app/hooks/useIsMounted';\nimport {Callback, ClassName} from 'app/types/common';\n\ninterface Props {\n title?: ReactNode;\n titleIcon?: ReactElement;\n body?: ReactNode;\n confirmButtonLabel?: ReactNode;\n confirmButtonTheme?: THEME;\n onDone?: Callback;\n}\n\nconst Content: FC<Props> = ({\n title,\n titleIcon,\n body,\n confirmButtonLabel = 'Yes',\n confirmButtonTheme = THEME.PRIMARY,\n onDone,\n}) => {\n const [applying, setApplying] = useState(false);\n const mountedRef = useIsMounted();\n\n return (\n <ModalContainer>\n <ModalTitle icon={titleIcon}>\n {title}\n </ModalTitle>\n\n {body && (\n <ModalBody>\n {body}\n </ModalBody>\n )}\n\n <ModalFooter>\n <ProgressButton\n dataId=\"modal_confirm_button\"\n theme={confirmButtonTheme}\n variant={VARIANT.SOLID}\n autoFocus={true}\n onClick={async () => {\n setApplying(true);\n\n return Promise.resolve(onDone?.())\n .then(() => Modal.hide())\n .finally(() => {\n if (mountedRef.current) {\n setApplying(false);\n }\n });\n }}\n >\n {confirmButtonLabel}\n </ProgressButton>\n\n <ModalCancelButton\n disabled={applying}\n />\n </ModalFooter>\n </ModalContainer>\n );\n};\n\ninterface ModalPromptProps extends ClassName, Props {\n fullWidth?: boolean;\n maxWidth?: SIZE;\n onClose?: Callback;\n}\n\nexport const ModalPrompt = {\n show({\n className,\n fullWidth,\n maxWidth,\n title,\n titleIcon,\n body,\n confirmButtonLabel,\n confirmButtonTheme,\n onDone,\n onClose,\n }: ModalPromptProps) {\n Modal.show({\n className,\n fullWidth,\n maxWidth,\n children: (\n <Content\n title={title}\n titleIcon={titleIcon}\n body={body}\n confirmButtonLabel={confirmButtonLabel}\n confirmButtonTheme={confirmButtonTheme}\n onDone={onDone}\n />\n ),\n onClose,\n });\n }\n};\n","import React from 'react';\nimport {ModalPrompt} from 'app/components/sharedReactComponents/Modal/ModalPrompt';\nimport {Modal} from 'app/components/sharedReactComponents/Modal/Modal';\nimport {pluralize} from 'app/components/helpers/commonHelpers';\nimport {noop} from 'app/util/noop';\nimport {ItemsEnumeration} from 'app/components/sharedReactComponents/ItemsEnumeration';\nimport {SIZE, THEME} from 'app/constants';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {Callback} from 'app/types/common';\n\ntype PromptShowProps = {\n devices: AnyDeviceModelType[];\n onDone?: Callback;\n onClose?: Callback;\n onConfirm?: Callback;\n};\n\nexport const UpdateDeviceFirmwarePrompt = {\n show({\n devices,\n onDone = noop,\n onConfirm = noop,\n onClose,\n }: PromptShowProps) {\n ModalPrompt.show({\n className: 'update-device-firmware-prompt',\n fullWidth: true,\n maxWidth: SIZE.L,\n title: (\n <>\n {'Update your '}\n\n <ItemsEnumeration\n items={devices}\n theme={THEME.INFO}\n />\n\n {` ${pluralize('device', devices)} firmware?`}\n </>\n ),\n body: (\n <>\n During update process, your {pluralize('device', devices)} will be offline.\n <br/>\n Your {pluralize('device', devices)} will reboot automatically after the firmware has been downloaded.\n </>\n ),\n confirmButtonLabel: 'Yes, update',\n onDone: async () => {\n onConfirm();\n\n return Promise.all(\n devices.map(async (device) => device.sendUpdateFirmwareCommand())\n )\n .then(() => onDone())\n .finally(() => Modal.hide());\n },\n onClose,\n });\n }\n};\n","import {makeAutoObservable} from 'mobx';\nimport {FirmwareUpdateStatus} from 'app/components/DeviceDetails/constants';\nimport {Edge} from 'app/domain/edge';\n\nexport type FirmwareUpdate = {\n progress?: number;\n status: FirmwareUpdateStatus;\n};\n\nexport interface FirmwareData {\n current: string;\n available?: string;\n update?: FirmwareUpdate;\n}\n\nexport class FirmwareFeature {\n private readonly firmware: Edge.Firmware;\n\n constructor(deviceFirmware: Edge.Firmware) {\n this.firmware = deviceFirmware;\n makeAutoObservable(this);\n }\n\n private get update() {\n return this.firmware.update;\n }\n\n get version(): string {\n return this.firmware.current;\n }\n\n get availableVersion(): string | undefined {\n return this.firmware.available;\n }\n\n get updateStatus() {\n return this.update?.status;\n }\n\n get updateAvailable(): boolean {\n if (this.updateStatus) {\n return this.updateStatus === FirmwareUpdateStatus.Available;\n }\n\n return false;\n }\n\n get updateInProgress() {\n return this.updateStatus\n ? this.updateStatus === 'progress' || this.updateStatus === 'downloading'\n : false;\n }\n}\n","import React from 'react';\nimport classNames from 'classnames';\nimport {ClassName} from 'app/types/common';\n\nexport enum METER_THEME {\n DEFAULT = 'default',\n GREEN = 'green',\n RED = 'red',\n}\n\ninterface Props extends ClassName {\n vertical?: boolean;\n value: number;\n theme: METER_THEME;\n disabled: boolean;\n}\n\nexport const Meter: React.VFC<Props> = ({\n className,\n vertical,\n value,\n theme,\n disabled,\n}) => {\n const valuePercentage = `${value}%`;\n const valueStyle = vertical ? {height: valuePercentage} : {width: valuePercentage};\n\n return (\n <div\n className={classNames('meter', {\n 'meter--disabled': Boolean(disabled),\n 'meter--vertical': Boolean(vertical),\n 'meter--theme-green': theme === METER_THEME.GREEN,\n 'meter--theme-red': theme === METER_THEME.RED,\n }, className)}\n >\n <div className=\"meter__value\" style={valueStyle}/>\n </div>\n );\n};\n","import React, {useState} from 'react';\nimport {\n Box,\n IconButton,\n Stack,\n SxProps,\n Theme,\n Tooltip,\n Typography,\n tablePaginationClasses,\n} from '@mui/material';\nimport {DataGrid, GridColDef, GridRenderCellParams, gridClasses} from '@mui/x-data-grid';\nimport DeleteIcon from '@mui/icons-material/Delete';\nimport DescriptionIcon from '@mui/icons-material/Description';\nimport {Sx} from 'app/types/common';\nimport {DeviceApiService} from 'app/services/api/device/DeviceApiService';\nimport {Edge} from 'app/domain/edge';\nimport {LiveScryptDeviceModel} from 'app/components/DeviceDetails/Models/LiveScryptDeviceModel';\nimport {downloadFile} from 'app/util/download';\nimport {FileExtension} from 'app/components/DeviceDetails/TranscriberDevice/Tabs/Archive/types';\nimport {DownloadSession} from 'app/components/DeviceDetails/TranscriberDevice/Tabs/Archive/DownloadSession/DownloadSession';\nimport {DeleteTranscribeSessionDialog} from 'app/components/DeviceDetails/TranscriberDevice/Tabs/Archive/dialogs/DeleteTranscribeSessionDialog/DeleteTranscribeSessionDialog';\nimport {useTranscribeSessionsQuery} from 'app/components/DeviceDetails/TranscriberDevice/Tabs/Archive/hooks/useTranscribeSessionsQuery';\n\nconst gridSx: SxProps<Theme> = {\n fontSize: 14,\n [`& .${gridClasses.cell}:focus, & .${gridClasses.cell}:focus-within`]: {\n outline: 'none',\n },\n [`& .${gridClasses.columnHeader}:focus, & .${gridClasses.columnHeader}:focus-within`]: {\n outline: 'none',\n },\n [`& .${tablePaginationClasses.selectLabel}, & .${tablePaginationClasses.displayedRows}`]: {\n mb: 0,\n fontSize: 14,\n },\n [`& .${tablePaginationClasses.select}`]: {fontSize: 14},\n};\n\ninterface Props extends Sx {\n device: LiveScryptDeviceModel;\n}\n\nexport function Archive({device, sx}: Props) {\n const deviceId = device.getId();\n const {sessionId, paused} = device.getTranscribingInfo();\n\n const [sessionToDelete, setSessionToDelete] = useState<string>('');\n const {isSuccess, data, refetch} = useTranscribeSessionsQuery({deviceId, enabled: true});\n\n const handleCloseDeleteDialog = () => {\n setSessionToDelete('');\n };\n\n const handleDelete = async () => {\n if (sessionToDelete) {\n await DeviceApiService.deleteTranscribeSession(deviceId, sessionToDelete);\n await refetch();\n handleCloseDeleteDialog();\n }\n };\n\n const columns: GridColDef<Edge.TranscribeSession>[] = [\n {\n field: 'name',\n flex: 1,\n headerName: 'Name',\n renderCell: ({value, row}: GridRenderCellParams<Edge.TranscribeSession, string>) => {\n const isCurrentPaused = row.id === sessionId && paused;\n const disabled = isCurrentPaused || row.streaming;\n\n return (\n <Typography data-id=\"record-name\" color={disabled ? 'text.disabled' : 'inherit'}>\n {value}\n </Typography>\n );\n },\n },\n {\n field: 'actions',\n headerName: 'Actions',\n sortable: false,\n renderCell: ({row}: GridRenderCellParams<Edge.TranscribeSession>) => {\n const {id, name} = row;\n\n const handleDownload = (ext: FileExtension) => {\n downloadFile(\n DeviceApiService.getTranscriberSessionUrl(deviceId, id, ext),\n `${name}.${ext}`,\n );\n };\n\n const isCurrentPaused = row.id === sessionId && paused;\n const isDisabled = isCurrentPaused || row.streaming;\n\n return (\n <Stack direction=\"row\" alignItems=\"center\" gap={1}>\n <DownloadSession onDownload={handleDownload} />\n\n <Tooltip title=\"Delete\">\n <IconButton\n data-id=\"delete-record-btn\"\n color=\"error\"\n disabled={isDisabled}\n onClick={() => setSessionToDelete(id)}\n >\n <DeleteIcon />\n </IconButton>\n </Tooltip>\n </Stack>\n );\n },\n },\n ];\n\n return (\n <Box sx={sx}>\n <Typography fontWeight={600} variant=\"h5\" mb={3}>\n Session\n </Typography>\n\n {isSuccess && (\n <>\n <DataGrid\n data-id=\"record-grid\"\n sx={gridSx}\n slots={{\n noRowsOverlay: () => (\n <Stack\n height=\"100%\"\n direction=\"row\"\n justifyContent=\"center\"\n gap={1}\n alignItems=\"center\"\n >\n <DescriptionIcon fontSize=\"large\" color=\"info\" />\n <Typography>There are currently no sessions</Typography>\n </Stack>\n ),\n }}\n disableColumnMenu={true}\n autoHeight={true}\n columns={columns}\n rowSelection={false}\n rows={data}\n initialState={{\n sorting: {\n sortModel: [{field: 'name', sort: 'desc'}],\n },\n }}\n />\n\n <DeleteTranscribeSessionDialog\n open={Boolean(sessionToDelete)}\n onDelete={handleDelete}\n onClose={handleCloseDeleteDialog}\n />\n </>\n )}\n </Box>\n );\n}\n","import React, {useState} from 'react';\nimport {Button, Dialog, DialogActions, DialogTitle} from '@mui/material';\nimport {LoadingButton} from '@mui/lab';\nimport {Prompt} from 'app/types/common';\nimport {DialogClose} from 'app/components/sharedReactComponents/DialogClose/DialogClose';\n\ninterface Props extends Prompt {\n name: string;\n onStart(): Promise<void>;\n}\n\nexport function StartEventDialog({open, name, onStart, onClose}: Props) {\n const [loading, setLoading] = useState(false);\n\n const handleStop = async () => {\n try {\n setLoading(true);\n await onStart();\n } finally {\n setLoading(false);\n }\n };\n\n return (\n <Dialog open={open} maxWidth=\"xs\" fullWidth={true} onClose={onClose}>\n <DialogClose onClose={onClose} />\n <DialogTitle>\n Start <b>{name}</b>\n </DialogTitle>\n\n <DialogActions>\n <LoadingButton\n data-id=\"confirm-start-button\"\n variant=\"contained\"\n color=\"primary\"\n loading={loading}\n onClick={handleStop}\n >\n Start\n </LoadingButton>\n <Button data-id=\"cancel-start-button\" variant=\"outlined\" color=\"info\" onClick={onClose}>\n Cancel\n </Button>\n </DialogActions>\n </Dialog>\n );\n}\n","import React, {useState} from 'react';\nimport {Button, Tooltip} from '@mui/material';\nimport {Sx} from 'app/types/common';\nimport {StartEventDialog} from 'app/components/sharedReactComponents/Events/dialogs/StartEventDialog/StartEventDialog';\n\nconst offlineTooltip = 'Device is offline';\nconst notNextTooltip = 'Ongoing or not next event for the device';\n\ninterface Props extends Sx {\n eventName: string;\n nextInSchedule: boolean;\n offline: boolean;\n onStart(): Promise<void>;\n}\n\nexport function ScheduledControl({sx, eventName, offline, nextInSchedule, onStart}: Props) {\n const [dialog, setDialog] = useState(false);\n\n const handleStart = async () => {\n await onStart();\n setDialog(false);\n };\n\n return (\n <>\n <StartEventDialog\n open={dialog}\n name={eventName}\n onStart={handleStart}\n onClose={() => setDialog(false)}\n />\n\n <Tooltip title={offline ? offlineTooltip : !nextInSchedule ? notNextTooltip : undefined}>\n <span>\n <Button\n sx={sx}\n data-id=\"start-button\"\n variant=\"contained\"\n disabled={offline || !nextInSchedule}\n onClick={() => setDialog(true)}\n >\n Start\n </Button>\n </span>\n </Tooltip>\n </>\n );\n}\n","import React, {useState} from 'react';\nimport {Button, Dialog, DialogActions, DialogTitle} from '@mui/material';\nimport {Prompt} from 'app/types/common';\nimport {DialogClose} from 'app/components/sharedReactComponents/DialogClose/DialogClose';\nimport {LoadingButton} from '@mui/lab';\n\ninterface Props extends Prompt {\n name: string;\n onStop(): Promise<void>;\n}\n\nexport function StopEventDialog({open, name, onStop, onClose}: Props) {\n const [loading, setLoading] = useState(false);\n\n const handleStop = async () => {\n try {\n setLoading(true);\n await onStop();\n } finally {\n setLoading(false);\n }\n };\n\n return (\n <Dialog open={open} maxWidth=\"xs\" fullWidth={true} onClose={onClose}>\n <DialogClose onClose={onClose} />\n <DialogTitle>\n Stop <b>{name}</b>\n </DialogTitle>\n\n <DialogActions>\n <LoadingButton\n data-id=\"confirm-stop-button\"\n variant=\"contained\"\n color=\"error\"\n loading={loading}\n onClick={handleStop}\n >\n Stop\n </LoadingButton>\n <Button data-id=\"cancel-stop-button\" variant=\"outlined\" color=\"info\" onClick={onClose}>\n Cancel\n </Button>\n </DialogActions>\n </Dialog>\n );\n}\n","import React, {useState} from 'react';\nimport {Button, Tooltip} from '@mui/material';\nimport {LoadingButton} from '@mui/lab';\nimport PlayArrowIcon from '@mui/icons-material/PlayArrow';\nimport PauseIcon from '@mui/icons-material/Pause';\nimport {StopEventDialog} from 'app/components/sharedReactComponents/Events/dialogs/StopEventDialog/StopEventDialog';\nimport {StyleSx} from 'app/types/common';\n\nconst pauseSx: StyleSx = {minWidth: 20, px: 1};\nconst offlineTooltip = 'Device is offline';\n\ninterface Props {\n eventName: string;\n offline: boolean;\n paused: boolean;\n pauseSupport: boolean;\n onStop(): Promise<void>;\n onPause(): Promise<void>;\n onResume(): Promise<void>;\n}\n\nexport function OngoingControls({\n eventName,\n paused,\n offline,\n pauseSupport,\n onPause,\n onResume,\n onStop,\n}: Props) {\n const [dialog, setDialog] = useState(false);\n\n const handleStop = async () => {\n await onStop();\n setDialog(false);\n };\n\n const handleResume = async () => {\n await onResume();\n };\n\n const handlePause = async () => {\n await onPause();\n };\n\n const renderPauseResume = () => {\n if (!pauseSupport) {\n return null;\n }\n\n if (paused) {\n return (\n <Tooltip title={offline ? offlineTooltip : undefined}>\n <span>\n <LoadingButton\n sx={pauseSx}\n data-id=\"resume-button\"\n color=\"secondary\"\n variant=\"contained\"\n disabled={offline}\n disableRipple={false}\n onClick={handleResume}\n >\n <PlayArrowIcon />\n </LoadingButton>\n </span>\n </Tooltip>\n );\n }\n\n return (\n <Tooltip title={offline ? offlineTooltip : undefined}>\n <span>\n <LoadingButton\n sx={pauseSx}\n data-id=\"pause-button\"\n color=\"error\"\n variant=\"contained\"\n disabled={offline}\n disableRipple={false}\n onClick={handlePause}\n >\n <PauseIcon />\n </LoadingButton>\n </span>\n </Tooltip>\n );\n };\n\n return (\n <>\n <StopEventDialog\n open={dialog}\n name={eventName}\n onStop={handleStop}\n onClose={() => setDialog(false)}\n />\n\n {renderPauseResume()}\n\n <Tooltip title={offline ? offlineTooltip : undefined}>\n <span>\n <Button\n data-id=\"stop-button\"\n color=\"error\"\n variant=\"contained\"\n disabled={offline}\n disableRipple={false}\n onClick={() => setDialog(true)}\n >\n Stop\n </Button>\n </span>\n </Tooltip>\n </>\n );\n}\n","import React, {useState} from 'react';\nimport {LoadingButton} from '@mui/lab';\nimport {Button, Dialog, DialogActions, DialogTitle} from '@mui/material';\nimport {Prompt} from 'app/types/common';\n\ninterface Props extends Prompt {\n name: string;\n onConfirm(): Promise<void>;\n}\n\nexport function ConfirmEventDialog({open, name, onConfirm, onClose}: Props) {\n const [loading, setLoading] = useState(false);\n\n const handleStop = async () => {\n try {\n setLoading(true);\n await onConfirm();\n } finally {\n setLoading(false);\n }\n };\n\n return (\n <Dialog open={open} maxWidth=\"xs\" fullWidth={true} onClose={onClose}>\n <DialogTitle>\n Confirm <b>{name}</b>\n </DialogTitle>\n\n <DialogActions>\n <LoadingButton\n data-id=\"confirm-confirm-button\"\n variant=\"contained\"\n color=\"primary\"\n loading={loading}\n onClick={handleStop}\n >\n Confirm\n </LoadingButton>\n\n <Button data-id=\"cancel-confirm-button\" variant=\"outlined\" color=\"info\" onClick={onClose}>\n Cancel\n </Button>\n </DialogActions>\n </Dialog>\n );\n}\n","import React, {useState} from 'react';\nimport {Button} from '@mui/material';\nimport {ConfirmEventDialog} from 'app/components/entities/schedule';\nimport {Sx} from 'app/types/common';\n\ninterface Props extends Sx {\n name: string;\n offline: boolean;\n onConfirm(): Promise<void>;\n}\n\nexport function ConfirmControls({sx, name, onConfirm, offline}: Props) {\n const [dialog, setDialog] = useState(false);\n\n const handleConfirm = async () => {\n await onConfirm();\n setDialog(false);\n };\n\n return (\n <>\n <Button\n sx={sx}\n data-id=\"confirm-button\"\n color=\"primary\"\n variant=\"contained\"\n disabled={offline}\n onClick={() => setDialog(true)}\n >\n Confirm\n </Button>\n\n <ConfirmEventDialog\n open={dialog}\n name={name}\n onConfirm={handleConfirm}\n onClose={() => setDialog(false)}\n />\n </>\n );\n}\n","import React from 'react';\nimport {Stack} from '@mui/material';\nimport {Sx} from 'app/types/common';\nimport {Schedule} from 'app/domain/schedule';\nimport {isPaused, isRunning, isScheduled} from 'app/domain/schedule/utils';\nimport {canStart, canPauseResume} from 'app/components/sharedReactComponents/Events/utils';\nimport {ScheduledControl} from 'app/components/sharedReactComponents/Events/List/EventCard/EventActions/ScheduledControl';\nimport {OngoingControls} from 'app/components/sharedReactComponents/Events/List/EventCard/EventActions/OngoingControls';\nimport {ConfirmControls} from 'app/components/sharedReactComponents/Events/List/EventCard/EventActions/ConfirmControls';\n\ninterface Props extends Sx {\n event: Schedule.Event;\n offline: boolean;\n allowStart: boolean;\n onStart(id: string): Promise<void>;\n onStop(id: string): Promise<void>;\n onPause(id: string): Promise<void>;\n onResume(id: string): Promise<void>;\n onConfirm: (id: string) => Promise<void>;\n}\n\nexport function EventActions({\n sx,\n event,\n offline,\n allowStart,\n onPause,\n onStart,\n onStop,\n onResume,\n onConfirm,\n}: Props) {\n const paused = isPaused(event.status);\n const running = isRunning(event.status);\n const scheduled = isScheduled(event.status);\n const ongoing = running || paused;\n\n const renderControls = () => {\n if (scheduled) {\n if (!event.confirmed && event.capabilities?.includes('confirm')) {\n return (\n <ConfirmControls\n name={event.title}\n offline={offline}\n onConfirm={async () => onConfirm(event.id)}\n />\n );\n }\n\n if (canStart(event.cms)) {\n return (\n <ScheduledControl\n nextInSchedule={allowStart}\n eventName={event.title}\n offline={offline}\n onStart={() => onStart(event.id)}\n />\n );\n }\n\n return null;\n }\n\n if (ongoing) {\n const pauseSupport = canPauseResume(event.cms);\n\n return (\n <OngoingControls\n eventName={event.title}\n offline={offline}\n paused={paused}\n pauseSupport={pauseSupport}\n onPause={() => onPause(event.id)}\n onResume={() => onResume(event.id)}\n onStop={() => onStop(event.id)}\n />\n );\n }\n\n return null;\n };\n\n return (\n <Stack sx={sx} direction=\"row\" alignItems=\"center\" gap={1}>\n {renderControls()}\n </Stack>\n );\n}\n","import React from 'react';\nimport {Icons} from 'app/util/icons';\nimport {SIZE} from 'app/constants';\nimport {ClassName} from 'app/types/common';\nimport {Stack} from '@mui/material';\nimport {grey} from '@mui/material/colors';\n\ninterface Props extends ClassName {\n type: 'streaming' | 'recording';\n active: boolean;\n size?: SIZE;\n}\n\nexport function EventMediaIcon({active, type, size = SIZE.S}: Props) {\n const isStreaming = type === 'streaming';\n const icon = isStreaming ? Icons.streaming() : Icons.record();\n\n return (\n <Stack\n sx={{\n color: active ? (isStreaming ? 'primary.main' : 'error.main') : grey[400],\n }}\n >\n {icon.size(size).reactComponent()}\n </Stack>\n );\n}\n","import React from 'react';\nimport {Box, Link, Stack} from '@mui/material';\nimport {DeviceAudioMeter} from 'app/components/sharedReactComponents/DeviceAudioMeter/DeviceAudioMeter';\nimport {isDisabledAudioMeter} from 'app/components/sharedReactComponents/DeviceAudioMeter/utils';\nimport {PearlMasterDeviceModel} from 'app/components/DeviceDetails/Models/PearlMasterDeviceModel';\nimport {EventMediaIcon} from 'app/components/sharedReactComponents/Events/shared/EventMediaIcon/EventMediaIcon';\nimport {getDeviceDetailsUrl} from 'app/components/sharedReactComponents/Events/utils';\nimport {Thumbnail} from 'app/components/sharedReactComponents/Preview/Thumbnail/Thumbnail';\nimport {getPreviewUpdateStrategy} from 'app/components/sharedReactComponents/Preview/utils';\nimport {PearlSlotDeviceModel} from 'app/components/DeviceDetails/Models/PearlSlotDeviceModel';\nimport {Sx, DataId} from 'app/types/common';\nimport {noop} from 'app/util/noop';\nimport {SIZE} from 'app/constants';\nimport {OverflowTooltip} from 'app/components/sharedReactComponents/OverflowTooltip/OverflowTooltip';\n\ninterface Props extends Sx, DataId {\n master: PearlMasterDeviceModel;\n channel: PearlSlotDeviceModel;\n streaming: boolean;\n recording: boolean;\n active: boolean;\n preview: boolean;\n}\n\nexport const EventChannel = React.memo(\n ({sx, master, channel, streaming, recording, active, preview, dataId}: Props) => {\n const channelId = channel.getId();\n const detailsUrl = getDeviceDetailsUrl(channelId);\n const disabledMeter = isDisabledAudioMeter(master);\n\n return (\n <Stack sx={sx} direction=\"row\" alignItems=\"center\" data-id={dataId} gap={1}>\n <Stack direction={preview ? 'column' : 'row'} gap={1}>\n {streaming && <EventMediaIcon type=\"streaming\" active={active} size={SIZE.S} />}\n\n {recording && <EventMediaIcon type=\"recording\" active={active} size={SIZE.S} />}\n </Stack>\n\n {preview && (\n <Stack direction=\"row\" alignItems=\"center\" gap={0.5}>\n <Thumbnail\n id={channel.getId()}\n detailsUrl={detailsUrl}\n updateStrategy={getPreviewUpdateStrategy(channel)}\n onClick={noop}\n />\n <Box\n sx={{\n '& .device-audio-meter': {\n width: 5,\n height: 46,\n },\n }}\n >\n <DeviceAudioMeter\n id={channelId}\n disabled={disabledMeter}\n vertical={true}\n segmentsCount={12}\n segmentsGap={2}\n />\n </Box>\n </Stack>\n )}\n\n <Link data-id=\"channel-link\" href={detailsUrl} sx={{fontSize: 'inherit'}}>\n <OverflowTooltip rowsNumber={2}>{channel.getName()}</OverflowTooltip>\n </Link>\n </Stack>\n );\n },\n);\n","import React from 'react';\nimport {Sx} from 'app/types/common';\nimport {Divider, Grid, Link, Stack} from '@mui/material';\nimport WarningIcon from '@mui/icons-material/Warning';\nimport {Schedule} from 'app/domain/schedule';\nimport {EventChannel} from 'app/components/sharedReactComponents/Events/List/EventCard/EventChannel/EventChannel';\nimport {DevicePicture} from 'app/components/sharedReactComponents/DevicePicture/DevicePicture';\nimport {router} from 'app/router/main';\nimport {OverflowTooltip} from 'app/components/sharedReactComponents/OverflowTooltip/OverflowTooltip';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {PearlMasterDeviceModel} from 'app/components/DeviceDetails/Models/PearlMasterDeviceModel';\n\ninterface Props extends Sx {\n profile: Map<string, Schedule.ChannelProfile>;\n device: PearlMasterDeviceModel;\n showDevice: boolean;\n showPreview: boolean;\n active: boolean;\n}\n\nexport function EventDevice({sx, profile, device, showDevice, active, showPreview}: Props) {\n const offline = device.isOffline();\n\n return (\n <Stack\n sx={sx}\n direction=\"row\"\n gap={1}\n divider={<Divider orientation=\"vertical\" flexItem={true} />}\n >\n {showDevice && (\n <Stack direction=\"row\" alignItems=\"center\" gap={1} flex={1}>\n <DevicePicture\n sx={packSx({height: 20, flexShrink: 0}, offline && {opacity: 0.5})}\n model={device.getModelName() as App.Cloud.DeviceModel}\n />\n\n <Link\n data-id=\"device-link\"\n sx={packSx({minWidth: 0}, offline && {opacity: 0.5})}\n href={router.url('deviceDetails', {deviceId: device.getId()})}\n >\n <OverflowTooltip rowsNumber={2}>{device.getName()}</OverflowTooltip>\n </Link>\n\n {offline && <WarningIcon color=\"error\" />}\n </Stack>\n )}\n\n <Grid sx={{flex: 3}} container={true} spacing={1}>\n {Array.from(profile.entries()).map(([idx, c]) => {\n const channel = device.getChannelByIndex(idx);\n\n if (!channel) {\n return;\n }\n\n return (\n <Grid key={idx} item={true} xs={4}>\n <EventChannel\n master={device}\n channel={channel}\n preview={showPreview}\n active={active}\n recording={c.recording}\n streaming={c.streaming}\n />\n </Grid>\n );\n })}\n </Grid>\n </Stack>\n );\n}\n","import React, {useState} from 'react';\nimport {Box, Button, Link, Menu, MenuItem, Skeleton} from '@mui/material';\nimport {OverflowTooltip} from 'app/components/sharedReactComponents/OverflowTooltip/OverflowTooltip';\nimport {Schedule} from 'app/domain/schedule';\nimport {router} from 'app/router/main';\nimport {StyleSx, Sx} from 'app/types/common';\nimport {isNil} from 'app/util/isNil';\nimport {DevicePicture} from 'app/components/sharedReactComponents/DevicePicture/DevicePicture';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {PearlMasterDeviceModel} from 'app/components/DeviceDetails/Models/PearlMasterDeviceModel';\n\ninterface Props extends Sx {\n event: Schedule.Event;\n devices?: Map<string, PearlMasterDeviceModel>;\n}\n\nconst buttonSx: StyleSx = {py: 0};\nconst pictureSx: StyleSx = {height: 20, flexShrink: 0};\nconst menuSx: StyleSx = {maxWidth: 250};\nconst menuItemSx: StyleSx = {gap: 0.5};\nconst menuLinkSx: StyleSx = {gap: 0.5};\nconst deviceLinkSx: StyleSx = {display: 'block'};\n\nexport function DeviceLink({sx, event, devices}: Props) {\n const [menuAnchor, setMenuAnchor] = useState<HTMLElement | null>(null);\n const isSingleDevice = event.devices.size === 1;\n\n if (isSingleDevice) {\n const deviceId = [...event.devices.keys()][0];\n\n if (!deviceId) {\n return null;\n }\n\n const device = devices?.get(deviceId);\n\n if (!device) {\n return <Skeleton width={80} variant=\"text\" />;\n }\n\n return (\n <Link\n data-id=\"device-link\"\n sx={packSx(deviceLinkSx, sx)}\n href={router.url('deviceDetails', {deviceId: device.getId()}, {activeTab: 'events'})}\n >\n <OverflowTooltip rowsNumber={1}>{device.getName()}</OverflowTooltip>\n </Link>\n );\n }\n\n const handleOpen = (e: React.SyntheticEvent<HTMLElement>) => {\n setMenuAnchor(e.currentTarget);\n };\n\n const handleClose = () => {\n setMenuAnchor(null);\n };\n\n return (\n <Box sx={sx}>\n <Button\n sx={buttonSx}\n data-id=\"device-link-menu\"\n onClick={handleOpen}\n variant=\"text\"\n color=\"primary\"\n >\n {event.devices.size} devices\n </Button>\n\n <Menu sx={menuSx} open={!isNil(menuAnchor)} anchorEl={menuAnchor} onClose={handleClose}>\n {Array.from(event.devices.keys()).map((id) => {\n const instance = devices?.get(id);\n\n if (!instance) {\n return (\n <Box px={2} py={1}>\n <Skeleton variant=\"rounded\" height={20} />\n </Box>\n );\n }\n\n return (\n <MenuItem key={id} sx={menuItemSx}>\n <DevicePicture sx={pictureSx} model={instance.getModelName()} />\n\n <Link\n sx={menuLinkSx}\n data-id=\"device-link\"\n href={router.url('deviceDetails', {deviceId: id}, {activeTab: 'events'})}\n >\n <OverflowTooltip rowsNumber={1}>{instance.getName()}</OverflowTooltip>\n </Link>\n </MenuItem>\n );\n })}\n </Menu>\n </Box>\n );\n}\n","import React, {useEffect, useState} from 'react';\nimport {Prompt} from 'app/types/common';\nimport {\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n FormControl,\n FormControlLabel,\n FormLabel,\n Radio,\n RadioGroup,\n} from '@mui/material';\nimport {LoadingButton} from '@mui/lab';\nimport {UpdateMode} from 'app/components/sharedReactComponents/Events/Editor/EventForm/types';\nimport {DialogClose} from 'app/components/sharedReactComponents/DialogClose/DialogClose';\n\ninterface Props extends Prompt {\n name: string;\n recurrent: boolean;\n onDelete: Fn<Promise<void>, [mode: UpdateMode]>;\n}\n\nexport function DeleteEventDialog({open, recurrent, name, onClose, onDelete}: Props) {\n const [mode, setMode] = useState<UpdateMode>('this');\n\n const [loading, setLoading] = useState(false);\n\n const handleSelect = (event: React.ChangeEvent<HTMLInputElement>) => {\n setMode(event.target.value as UpdateMode);\n };\n\n const handleDelete = async () => {\n try {\n setLoading(true);\n await onDelete(recurrent ? mode : 'this');\n } finally {\n setLoading(false);\n }\n };\n\n useEffect(() => {\n if (!open) {\n setMode('this');\n }\n }, [open]);\n\n return (\n <Dialog open={open} maxWidth=\"xs\" fullWidth={true} onClose={onClose}>\n <DialogClose onClose={onClose} />\n <DialogTitle>\n Delete: <strong>{name}</strong>?\n </DialogTitle>\n\n {recurrent && (\n <DialogContent sx={{display: 'flex', justifyContent: 'center', '& label': {mb: 0}}}>\n <FormControl>\n <FormLabel>Select delete option</FormLabel>\n <RadioGroup value={mode} onChange={handleSelect}>\n <FormControlLabel\n value=\"this\"\n control={<Radio data-id=\"this-radio\" />}\n label=\"This\"\n />\n <FormControlLabel\n value=\"forward\"\n control={<Radio data-id=\"forward-radio\" />}\n label=\"This and following\"\n />\n </RadioGroup>\n </FormControl>\n </DialogContent>\n )}\n\n <DialogActions>\n <LoadingButton\n data-id=\"confirm-delete-button\"\n variant=\"contained\"\n color=\"error\"\n loading={loading}\n onClick={handleDelete}\n >\n Delete\n </LoadingButton>\n <Button data-id=\"cancel-delete-button\" variant=\"outlined\" color=\"info\" onClick={onClose}>\n Cancel\n </Button>\n </DialogActions>\n </Dialog>\n );\n}\n","import React from 'react';\nimport EditNoteIcon from '@mui/icons-material/EditNote';\nimport ClearIcon from '@mui/icons-material/Clear';\nimport MoreTimeIcon from '@mui/icons-material/MoreTime';\nimport {Schedule} from 'app/domain/schedule';\nimport {isOngoing, isScheduled} from 'app/domain/schedule/utils';\nimport {canExtend} from 'app/components/sharedReactComponents/Events/utils';\n\ninterface Option {\n id: string;\n name: string;\n icon: React.ReactNode;\n disabled?: boolean;\n onClick: () => any;\n}\n\ninterface Args {\n event: Schedule.Event;\n offline: boolean;\n onExtend: () => void;\n onEdit: () => void;\n onDelete: () => void;\n}\n\nexport function useEventMenuOptions({event, offline, onExtend, onDelete, onEdit}: Args): Option[] {\n const ongoing = isOngoing(event.status);\n const scheduled = isScheduled(event.status);\n const isChrono = event.cms === 'chrono';\n\n const result: Option[] = [];\n\n if (ongoing && canExtend(event.cms)) {\n result.push({\n id: 'extend-event',\n name: 'Add 5 minutes',\n icon: <EditNoteIcon color=\"error\" />,\n disabled: offline,\n onClick: onExtend,\n });\n }\n\n if (isChrono) {\n if (scheduled) {\n result.push({\n id: 'edit-time',\n name: 'Edit',\n icon: <MoreTimeIcon color=\"primary\" />,\n onClick: onEdit,\n });\n\n result.push({\n id: 'delete-event',\n name: 'Delete',\n icon: <ClearIcon color=\"error\" />,\n onClick: onDelete,\n });\n }\n }\n\n return result;\n}\n","import React, {PropsWithChildren} from 'react';\nimport {Stack, SxProps, Theme} from '@mui/material';\nimport RadioButtonCheckedIcon from '@mui/icons-material/RadioButtonChecked';\nimport WifiIcon from '@mui/icons-material/Wifi';\nimport {grey} from '@mui/material/colors';\nimport {Sx} from 'app/types/common';\nimport {packSx} from 'app/util/packSx/packSx';\n\ntype Props = Sx & {\n active: boolean;\n};\n\nconst iconStyles: SxProps<Theme> = {fontSize: 18, color: 'white'};\n\nconst Indicator = React.forwardRef<any, PropsWithChildren<Sx>>(({sx, children}, ref) => {\n return (\n <Stack ref={ref} sx={packSx({p: 0.75, bgcolor: grey[400], borderRadius: '50%'}, sx)}>\n {children}\n </Stack>\n );\n});\n\nexport const StreamingIndicator = React.forwardRef<HTMLElement, Props>(({sx, active}, ref) => {\n return (\n <Indicator ref={ref} sx={packSx(active ? {bgcolor: 'primary.main'} : {}, sx)}>\n <WifiIcon sx={packSx(iconStyles, {rotate: '90deg'})} />\n </Indicator>\n );\n});\n\nexport const RecordingIndicator = React.forwardRef<HTMLElement, Props>(({sx, active}, ref) => {\n return (\n <Indicator ref={ref} sx={packSx(active ? {bgcolor: 'error.main'} : {}, sx)}>\n <RadioButtonCheckedIcon sx={packSx(iconStyles, {rotate: '90deg'})} />\n </Indicator>\n );\n});\n","import React from 'react';\nimport {Stack} from '@mui/material';\nimport {Sx} from 'app/types/common';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\nimport {useEventMedia} from 'app/components/sharedReactComponents/Events/List/EventCard/hooks/useEventIndicators';\nimport {Schedule} from 'app/domain/schedule';\nimport {PearlMasterDeviceModel} from 'app/components/DeviceDetails/Models/PearlMasterDeviceModel';\nimport {\n RecordingIndicator,\n StreamingIndicator,\n} from 'app/components/sharedReactComponents/DeviceIndicators/DeviceIndicators';\n\ninterface Props extends Sx {\n event: Schedule.Event;\n devices?: Map<string, PearlMasterDeviceModel>;\n offline: boolean;\n}\n\nexport function EventMedia({sx, event, devices, offline}: Props) {\n const {streaming, recording} = useEventMedia({event, devices});\n\n const {media} = event;\n\n const showStreaming = media === 'all' || media === 'streaming';\n const showRecording = media === 'all' || media === 'recording';\n\n return (\n <Tooltip content={offline ? 'Device is offline' : undefined}>\n <Stack sx={sx} direction=\"row\" alignItems=\"center\" gap={0.25}>\n {showStreaming && (\n <Tooltip content={offline ? undefined : 'Streaming'}>\n <StreamingIndicator active={streaming} />\n </Tooltip>\n )}\n {showRecording && (\n <Tooltip content={offline ? undefined : 'Recording'}>\n <RecordingIndicator active={recording} />\n </Tooltip>\n )}\n </Stack>\n </Tooltip>\n );\n}\n","/* eslint-disable no-restricted-syntax */\nimport {PearlMasterDeviceModel} from 'app/components/DeviceDetails/Models/PearlMasterDeviceModel';\nimport {DeviceIndicatorItem} from 'app/components/FleetManager/DeviceCard/StatusList/DeviceStatusIndicator/types';\nimport {deviceIndicators} from 'app/components/FleetManager/DeviceCard/StatusList/DeviceStatusIndicator/useActiveItems';\nimport {Schedule} from 'app/domain/schedule';\nimport {useEffect, useState} from 'react';\n\ninterface Args {\n event: Schedule.Event;\n devices?: Map<string, PearlMasterDeviceModel>;\n}\n\nexport function useEventIndicators({devices, event}: Args): DeviceIndicatorItem[] {\n const [indicators, setIndicators] = useState<DeviceIndicatorItem[]>([]);\n\n useEffect(() => {\n if (!devices) {\n setIndicators([]);\n return;\n }\n\n let [streaming, recording] = [false, false];\n\n for (const pair of [...event.devices.entries()]) {\n if (streaming && recording) {\n break;\n }\n\n const [deviceId, deviceProfile] = pair;\n\n const device = devices.get(deviceId);\n\n if (device) {\n const channels = device.getChanelModels();\n\n for (const [channelIdx, profile] of [...deviceProfile.entries()]) {\n if (streaming && recording) {\n break;\n }\n\n const channel = channels.find((c) => c.getChannelDeviceIdIndex() === channelIdx);\n\n if (channel) {\n if (channel.isRecording() && profile.recording) {\n recording = true;\n }\n\n if (channel.isStreaming() && profile.streaming) {\n streaming = true;\n }\n }\n }\n }\n }\n\n setIndicators(deviceIndicators.filter((item) => item.isActive({streaming, recording})));\n }, [event, devices]);\n\n return indicators;\n}\n\ntype MediaState = {\n streaming: boolean;\n recording: boolean;\n};\n\nexport function useEventMedia({devices, event}: Args): MediaState {\n const [state, setState] = useState<MediaState>({streaming: false, recording: false});\n\n useEffect(() => {\n let [streaming, recording] = [false, false];\n\n if (!devices) {\n setState({streaming, recording});\n return;\n }\n\n for (const pair of [...event.devices.entries()]) {\n if (streaming && recording) {\n break;\n }\n\n const [deviceId, deviceProfile] = pair;\n\n const device = devices.get(deviceId);\n\n if (device) {\n const channels = device.getChanelModels();\n\n for (const [channelIdx, profile] of [...deviceProfile.entries()]) {\n if (streaming && recording) {\n break;\n }\n\n const channel = channels.find((c) => c.getChannelDeviceIdIndex() === channelIdx);\n\n if (channel) {\n if (channel.isRecording() && profile.recording) {\n recording = true;\n }\n\n if (channel.isStreaming() && profile.streaming) {\n streaming = true;\n }\n }\n }\n }\n }\n\n setState({streaming, recording});\n }, [event, devices]);\n\n return state;\n}\n","import {SxProps, Theme, alpha} from '@mui/material';\nimport {blue, grey, red} from '@mui/material/colors';\nimport {EventCategory} from 'app/components/sharedReactComponents/Events/types';\n\nexport const cardStyles: Record<EventCategory | 'root', SxProps<Theme>> = {\n root: {p: 1, border: 1, borderRadius: 1},\n ongoing: {\n borderLeftWidth: 4,\n borderStyle: 'solid',\n borderColor: 'error.main',\n bgcolor: alpha(red[50], 0.4),\n },\n scheduled: {\n borderLeftWidth: 4,\n borderStyle: 'solid',\n borderColor: 'primary.main',\n bgcolor: alpha(blue[50], 0.25),\n },\n completed: {\n borderLeftWidth: 4,\n borderStyle: 'solid',\n borderColor: grey[500],\n bgcolor: alpha(grey[50], 0.9),\n },\n};\n","import React from 'react';\nimport {Typography, capitalize} from '@mui/material';\nimport {DataId, Sx} from 'app/types/common';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {Schedule} from 'app/domain/schedule';\nimport {isWaitingConfirmation} from 'app/domain/schedule/utils';\nimport {EventCountdown} from 'app/components/sharedReactComponents/Events/shared/EventCountdown/EventCountdown';\nimport {getOverMessage} from 'app/components/sharedReactComponents/Events/shared/EventCountdown/utils';\nimport {getVariant} from 'app/components/sharedReactComponents/Events/utils';\n\ntype Props = Sx &\n DataId & {\n event: Schedule.Event;\n };\n\nexport function EventStatus({dataId, sx, event}: Props) {\n const variant = getVariant(event.status);\n\n const ongoing = variant === 'ongoing';\n const scheduled = variant === 'scheduled';\n const waiting = isWaitingConfirmation(event.status);\n\n if (waiting) {\n return (\n <Typography data-id={dataId} sx={sx} color=\"error.main\">\n Waiting confirmation\n </Typography>\n );\n }\n\n if (ongoing || scheduled) {\n return (\n <EventCountdown\n dataId={dataId}\n sx={packSx({whiteSpace: 'pre', color: ongoing ? 'error.main' : 'primary.main'}, sx)}\n variant={variant}\n start={event.start}\n end={event.end}\n overMessage={getOverMessage(variant, event.start)}\n label={<Typography noWrap={true}>{ongoing ? 'Ends in' : 'Starts in'}</Typography>}\n />\n );\n }\n\n return (\n <Typography data-id={dataId} sx={sx} color=\"text.disabled\">\n {formatStatus(event.status)}\n </Typography>\n );\n}\n\nfunction formatStatus(status: Schedule.EventStatus) {\n if (status === 'finished') {\n return 'Completed';\n }\n\n return capitalize(status);\n}\n","import React, {useMemo, useState} from 'react';\nimport {\n Box,\n Collapse,\n Divider,\n IconButton,\n ListItemIcon,\n ListItemText,\n Menu,\n MenuItem,\n Skeleton,\n Stack,\n Typography,\n} from '@mui/material';\nimport MoreVertIcon from '@mui/icons-material/MoreVert';\nimport ExpandMoreIcon from '@mui/icons-material/ExpandMore';\nimport {grey} from '@mui/material/colors';\nimport {EventActions} from 'app/components/sharedReactComponents/Events/List/EventCard/EventActions/EventActions';\nimport {useToggle} from 'app/hooks/useToggle';\nimport {DataId, Sx} from 'app/types/common';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {isNil} from 'app/util/isNil';\nimport {Schedule} from 'app/domain/schedule';\nimport {isCompleted, isOngoing, isRunningOrPaused, isScheduled} from 'app/domain/schedule/utils';\nimport {EventDevice} from 'app/components/sharedReactComponents/Events/List/EventCard/EventDevice/EventDevice';\nimport {DeviceLink} from 'app/components/sharedReactComponents/Events/List/EventCard/DeviceLink/DeviceLink';\nimport {UpdateMode} from 'app/components/sharedReactComponents/Events/Editor/EventForm/types';\nimport {DeleteEventDialog} from 'app/components/sharedReactComponents/Events/dialogs/DeleteEventDialog/DeleteEventDialog';\nimport {useEventMenuOptions} from 'app/components/sharedReactComponents/Events/List/EventCard/hooks/useEventMenuOptions';\nimport {PearlMasterDeviceModel} from 'app/components/DeviceDetails/Models/PearlMasterDeviceModel';\nimport {\n formatEventMedia,\n formatEventTime,\n formatEventDate,\n} from 'app/components/sharedReactComponents/Events/utils';\nimport {EventMedia} from 'app/components/sharedReactComponents/Events/List/EventCard/EventMedia/EventMedia';\nimport {cardStyles} from 'app/components/sharedReactComponents/Events/styles';\nimport {OverflowTooltip} from 'app/components/sharedReactComponents/OverflowTooltip/OverflowTooltip';\nimport {EventStatus} from 'app/components/sharedReactComponents/Events/shared/EventStatus/EventStatus';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\n\ninterface Props extends Sx, DataId {\n event: Schedule.Event;\n devices?: Map<string, PearlMasterDeviceModel>;\n allowStart: boolean;\n onEdit: (id: string) => void;\n onDelete: (id: string, mode: UpdateMode) => Promise<void>;\n onStart(id: string): Promise<void>;\n onStop(id: string): Promise<void>;\n onPause(id: string): Promise<void>;\n onResume(id: string): Promise<void>;\n onExtend: (id: string) => Promise<void>;\n onConfirm: (id: string, deviceId: string) => Promise<void>;\n}\n\nexport const EventCard = React.memo(\n ({\n dataId,\n sx,\n event,\n devices,\n allowStart,\n onPause,\n onResume,\n onStart,\n onStop,\n onExtend,\n onEdit,\n onDelete,\n onConfirm,\n }: Props) => {\n const [menuAnchor, setMenuAnchor] = useState<HTMLElement | null>(null);\n\n const [expanded, toggleExpanded] = useToggle(false);\n const [deleteDialog, setDeleteDialog] = useState(false);\n\n const openDeleteDialog = () => {\n setDeleteDialog(true);\n };\n\n const closeDeleteDialog = () => {\n setDeleteDialog(false);\n };\n\n const closeMenu = () => {\n setMenuAnchor(null);\n };\n\n const openMenu = (e: React.SyntheticEvent<HTMLElement>) => {\n setMenuAnchor(e.currentTarget);\n };\n\n const handleDelete = async (mode: UpdateMode) => {\n await onDelete(event.id, mode);\n closeDeleteDialog();\n };\n\n const editEvent = () => {\n onEdit(event.id);\n closeMenu();\n };\n\n const deleteEvent = () => {\n if (event.cms === 'chrono') {\n openDeleteDialog();\n closeMenu();\n }\n };\n\n const handleConfirm = async () => {\n const deviceId = [...event.devices.keys()][0];\n console.log('deviceId', deviceId);\n\n if (deviceId) {\n await onConfirm(event.id, deviceId);\n }\n };\n\n const offline = useMemo(() => {\n if (!devices) {\n return true;\n }\n\n return [...event.devices.keys()].some((deviceId) => {\n const instance = devices.get(deviceId);\n return instance ? instance.isOffline() : true;\n });\n }, [event, devices]);\n\n const handleExtend = async () => {\n await onExtend(event.id);\n closeMenu();\n };\n\n const options = useEventMenuOptions({\n event,\n offline,\n onDelete: deleteEvent,\n onEdit: editEvent,\n onExtend: handleExtend,\n });\n\n const showDevice = event.devices.size > 1;\n\n const ongoing = isOngoing(event.status);\n const scheduled = isScheduled(event.status);\n const completed = isCompleted(event.status);\n const runningOrPaused = isRunningOrPaused(event.status);\n\n const renderActions = () => {\n const hasMediaControls = ongoing || scheduled;\n\n return (\n <Stack direction=\"row\" gap={0.5} alignItems=\"center\">\n {runningOrPaused && <EventMedia event={event} devices={devices} offline={offline} />}\n\n {hasMediaControls && (\n <EventActions\n event={event}\n offline={offline}\n allowStart={allowStart}\n onStart={onStart}\n onStop={onStop}\n onResume={onResume}\n onPause={onPause}\n onConfirm={handleConfirm}\n />\n )}\n\n <IconButton\n data-id=\"more-actions\"\n disabled={!options.length}\n disableRipple={false}\n onClick={openMenu}\n >\n <MoreVertIcon />\n </IconButton>\n\n <Menu open={!isNil(menuAnchor)} anchorEl={menuAnchor} onClose={closeMenu}>\n {options.map((o) => (\n <MenuItem\n key={o.id}\n data-id={`${o.id}-button`}\n disabled={o.disabled}\n onClick={o.onClick}\n >\n <ListItemIcon>{o.icon}</ListItemIcon>\n <ListItemText>{o.name}</ListItemText>\n </MenuItem>\n ))}\n </Menu>\n\n <DeleteEventDialog\n open={deleteDialog}\n recurrent={true}\n name={event.title}\n onDelete={handleDelete}\n onClose={closeDeleteDialog}\n />\n\n <Tooltip content={expanded ? 'Collapse' : 'Expand'}>\n <IconButton data-id=\"details-toggler\" disableRipple={false} onClick={toggleExpanded}>\n <ExpandMoreIcon\n sx={{transform: `rotate(${expanded ? 180 : 0}deg)`, transition: 'transform .3s'}}\n />\n </IconButton>\n </Tooltip>\n </Stack>\n );\n };\n\n return (\n <Box\n data-id={dataId}\n sx={packSx(\n cardStyles.root,\n ongoing && cardStyles.ongoing,\n scheduled && cardStyles.scheduled,\n completed && cardStyles.completed,\n sx,\n )}\n >\n <Stack\n direction=\"row\"\n alignItems=\"center\"\n gap={1}\n divider={<Divider flexItem={true} orientation=\"vertical\" />}\n >\n <Box flexShrink={0} minWidth={0}>\n <Typography data-id=\"event-time\" color={grey[700]} whiteSpace=\"pre\" mb={0.5}>\n {formatEventTime(event.start, event.end)}\n </Typography>\n\n <Typography data-id=\"event-date\" color={grey[700]} whiteSpace=\"pre\">\n {formatEventDate(event.start, event.end)}\n </Typography>\n </Box>\n\n <Stack flexGrow={1} minWidth={0}>\n <Stack\n direction=\"row\"\n alignItems=\"center\"\n gap={1}\n mb={0.5}\n divider={<Divider flexItem={true} orientation=\"vertical\" />}\n >\n <Typography\n data-id=\"event-title\"\n fontWeight={600}\n component=\"span\"\n minWidth={0}\n maxWidth=\"100%\"\n >\n <OverflowTooltip rowsNumber={1}>{event.title}</OverflowTooltip>\n </Typography>\n </Stack>\n\n <Stack\n direction=\"row\"\n alignItems=\"center\"\n gap={1}\n minHeight={22}\n divider={<Divider flexItem={true} orientation=\"vertical\" />}\n >\n <EventStatus dataId=\"event-status\" event={event} />\n\n <Typography data-id=\"event-type\" whiteSpace=\"pre\">\n {formatEventMedia(event.media)}\n </Typography>\n\n <DeviceLink sx={{minWidth: 0}} event={event} devices={devices} />\n </Stack>\n </Stack>\n\n <Stack direction=\"row\" alignItems=\"center\" justifyContent=\"space-between\" gap={1}>\n {renderActions()}\n </Stack>\n </Stack>\n\n <Collapse in={expanded} unmountOnExit={true}>\n <Divider sx={{my: 0.5}} orientation=\"horizontal\" flexItem={true} />\n\n <Stack\n direction=\"column\"\n gap={1}\n divider={<Divider sx={{borderStyle: 'dashed'}} flexItem={true} />}\n >\n {Array.from(event.devices.entries()).map(([id, p]) => {\n const device = devices?.get(id);\n\n if (!device) {\n return <Skeleton key={id} variant=\"rounded\" height={showDevice ? 40 : 22} />;\n }\n\n return (\n <EventDevice\n key={id}\n profile={p}\n device={device}\n showDevice={showDevice}\n showPreview={ongoing}\n active={ongoing}\n />\n );\n })}\n </Stack>\n </Collapse>\n </Box>\n );\n },\n);\n","import React from 'react';\nimport {Box, Chip, Divider} from '@mui/material';\nimport {Except} from 'type-fest';\nimport {EventCard} from 'app/components/sharedReactComponents/Events/List/EventCard/EventCard';\nimport {Component, Sx} from 'app/types/common';\nimport {Schedule} from 'app/domain/schedule';\nimport {PearlMasterDeviceModel} from 'app/components/DeviceDetails/Models/PearlMasterDeviceModel';\nimport {Virtuoso} from 'react-virtuoso';\n\ntype CardActions = Except<React.ComponentProps<typeof EventCard>, 'event' | 'sx' | 'allowStart'>;\n\ninterface Props extends Component, Sx, CardActions {\n events: Schedule.Event[];\n devices?: Map<string, PearlMasterDeviceModel>;\n showTitle?: boolean;\n title?: string;\n actualEventIds?: Set<string>;\n}\n\nexport const EventsList = React.memo(\n ({sx, events, devices, showTitle, title, actualEventIds, ...actions}: Props) => {\n return (\n <Box sx={sx}>\n {showTitle && (\n <Divider sx={{mb: 1}} orientation=\"horizontal\" flexItem={true}>\n <Chip label={title} size=\"small\" />\n </Divider>\n )}\n\n <Virtuoso\n data={events}\n useWindowScroll={true}\n itemContent={(_, e) => {\n const allowStart = actualEventIds?.has(e.id) ?? false;\n\n return (\n <Box pb={1}>\n <EventCard\n dataId={e.id}\n key={e.id}\n devices={devices}\n event={e}\n allowStart={allowStart}\n {...actions}\n />\n </Box>\n );\n }}\n />\n </Box>\n );\n },\n);\n","/* eslint-disable no-restricted-syntax */\nimport dayjs, {Dayjs} from 'dayjs';\nimport {EventGroup, EventGroups} from 'app/components/sharedReactComponents/Events/types';\nimport {daysToSeconds, secondsToHours} from 'app/util/timeConverter';\nimport {Schedule} from 'app/domain/schedule';\nimport {\n fromPeriod,\n isCurrentPeriod,\n sortEvents,\n} from 'app/components/sharedReactComponents/Events/utils';\nimport {createRange} from 'app/util/createRange';\nimport {isOngoing, isScheduled} from 'app/domain/schedule/utils';\nimport {stringComparator} from 'app/util/Sort';\n\nexport function isToday(timestamp: number): boolean {\n return dayjs.unix(timestamp).isSame(dayjs(), 'day');\n}\n\nexport function getNowPosition(start: number) {\n return dayjs().diff(dayjs.unix(start), 'minutes');\n}\n\nexport function getHoursInDuration(seconds: number) {\n return Math.trunc(secondsToHours(seconds));\n}\n\nexport function isPassed(timestamp: number) {\n return dayjs.unix(timestamp).isBefore(dayjs(), 'day');\n}\n\nexport function hasOverlap(a: TimeRange, b: TimeRange) {\n return a.from < b.to && a.to > b.from;\n}\n\nexport function buildEventGroups(events: Schedule.Event[]): EventGroups {\n const overlapGroups: EventGroup[] = [];\n\n for (const event of events) {\n let inGroup = false;\n\n for (const group of overlapGroups) {\n if (hasOverlap({from: event.start, to: event.end}, {from: group.start, to: group.end})) {\n group.events.push(event);\n\n if (group.end < event.end) {\n group.end = event.end;\n }\n\n inGroup = true;\n break;\n }\n }\n\n if (!inGroup) {\n overlapGroups.push({start: event.start, end: event.end, events: [event]});\n }\n }\n\n const groups: EventGroup[] = [];\n const ungrouped: Schedule.Event[] = [];\n\n for (const group of overlapGroups) {\n if (group.events.length === 1) {\n ungrouped.push(...group.events);\n } else {\n groups.push(group);\n }\n }\n\n groups.forEach((group) => {\n group.events.sort(sortGroupEvents);\n });\n\n return {groups, ungrouped};\n}\n\nexport function buildDayInterval(range: TimeRange, timestamp = dayjs().unix()): TimeRange {\n const base = dayjs.unix(timestamp).startOf('day');\n\n return {\n from: base.add(range.from, 'seconds').unix(),\n to: base.add(range.to, 'seconds').unix(),\n };\n}\n\nexport function showNowLine(\n period: Schedule.Period,\n range: TimeRange,\n selected: TimeStampSeconds,\n): boolean {\n if ((selected && !isToday(selected)) || !isCurrentPeriod(period)) {\n return false;\n }\n\n const interval = buildDayInterval(range);\n const now = dayjs();\n const from = dayjs.unix(interval.from);\n const to = dayjs.unix(interval.to);\n return now.isAfter(from, 'second') && now.isBefore(to, 'second');\n}\n\nexport function getDailySummary(\n days: TimeStampSeconds[],\n events: Schedule.Event[],\n): Map<TimeStampSeconds, Schedule.Event[]> {\n const result = new Map<TimeStampSeconds, Schedule.Event[]>(days.map((d) => [d, []]));\n\n for (const event of events) {\n const {start, end} = event;\n\n for (const dayStart of days) {\n const dayEnd = dayStart + daysToSeconds(1);\n\n if (start < dayEnd && end > dayStart) {\n result.get(dayStart)?.push(event);\n }\n }\n }\n\n return result;\n}\n\nexport function getDayTimeline(start: number, duration: number): TimeStampSeconds[] {\n const base = dayjs().startOf('day').add(start, 'seconds');\n\n const hours = getHoursInDuration(duration);\n\n return createRange(hours).reduce<TimeStampSeconds[]>((acc, value) => {\n return [...acc, base.add(value, 'h').unix()];\n }, []);\n}\n\nexport function getFirstDayOfPeriod(period: Schedule.Period): Dayjs {\n const date = fromPeriod(period);\n return date.day(0);\n}\n\nexport function getLastDayOfPeriod(period: Schedule.Period): Dayjs {\n const date = fromPeriod(period);\n return date.day(6);\n}\n\nexport function getDaysOfPeriod(period: Schedule.Period) {\n const date = fromPeriod(period);\n\n return createRange(7).map((day) => {\n const instance = date.day(day);\n return instance.unix();\n });\n}\n\nfunction sortGroupEvents(a: Schedule.Event, b: Schedule.Event): number {\n const timeSort = sortEvents(a, b);\n\n if (timeSort !== 0) {\n return timeSort;\n }\n\n const statusSort = statusComparator(a, b);\n\n if (statusSort !== 0) {\n return statusSort;\n }\n\n return stringComparator(a.title, b.title);\n}\n\nfunction statusComparator(a: Schedule.Event, b: Schedule.Event): number {\n return getStatusRatio(b.status) - getStatusRatio(a.status);\n}\n\nfunction getStatusRatio(status: Schedule.EventStatus): number {\n switch (true) {\n case isOngoing(status):\n return 2;\n\n case isScheduled(status):\n return 1;\n\n default:\n return 0;\n }\n}\n","import React from 'react';\nimport {Box, Stack, Typography} from '@mui/material';\nimport {Sx} from 'app/types/common';\nimport {grey} from '@mui/material/colors';\nimport {OverflowTooltip} from 'app/components/sharedReactComponents/OverflowTooltip/OverflowTooltip';\nimport {\n formatEventMedia,\n formatEventFullTime,\n} from 'app/components/sharedReactComponents/Events/utils';\nimport {Schedule} from 'app/domain/schedule';\nimport {EventStatus} from 'app/components/sharedReactComponents/Events/shared/EventStatus/EventStatus';\n\ninterface Props extends Sx {\n event: Schedule.Event;\n}\n\nexport function EventDefinition({sx, event}: Props) {\n return (\n <Box sx={sx}>\n <Stack mb={0.5} direction=\"row\" alignItems=\"center\" justifyContent=\"space-between\" gap={1}>\n <Typography data-id=\"event-title\" minWidth={0} flex={1} fontWeight={600} component=\"span\">\n <OverflowTooltip rowsNumber={1}>{event.title}</OverflowTooltip>\n </Typography>\n\n <Typography data-id=\"event-type\">{formatEventMedia(event.media)}</Typography>\n </Stack>\n\n <Stack direction=\"row\" alignItems=\"center\" justifyContent=\"space-between\" gap={1}>\n <Typography data-id=\"event-datetime\" color={grey[700]}>\n {formatEventFullTime(event.start, event.end)}\n </Typography>\n\n <EventStatus dataId=\"event-status\" event={event} />\n </Stack>\n </Box>\n );\n}\n","import React from 'react';\nimport {Box, Divider, Grid, Link, Skeleton, Stack} from '@mui/material';\nimport {DataId, Sx} from 'app/types/common';\nimport {Schedule} from 'app/domain/schedule';\nimport {EventDefinition} from 'app/components/sharedReactComponents/Events/Calendar/shared/EventDefinition/EventDefinition';\nimport {EventChannel} from 'app/components/sharedReactComponents/Events/List/EventCard/EventChannel/EventChannel';\nimport {isCompleted, isOngoing, isScheduled} from 'app/domain/schedule/utils';\nimport {grey} from '@mui/material/colors';\nimport {Icons} from 'app/util/icons';\nimport {OverflowTooltip} from 'app/components/sharedReactComponents/OverflowTooltip/OverflowTooltip';\nimport {router} from 'app/router/main';\nimport {PearlMasterDeviceModel} from 'app/components/DeviceDetails/Models/PearlMasterDeviceModel';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {cardStyles} from 'app/components/sharedReactComponents/Events/styles';\n\ninterface Props extends Sx, DataId {\n event: Schedule.Event;\n devices?: Map<string, PearlMasterDeviceModel>;\n}\n\nexport const EventDetails = React.memo(({dataId, sx, event, devices}: Props) => {\n const ongoing = isOngoing(event.status);\n const scheduled = isScheduled(event.status);\n const completed = isCompleted(event.status);\n\n return (\n <Stack\n direction=\"row\"\n data-id={dataId}\n sx={packSx(\n cardStyles.root,\n ongoing ? cardStyles.ongoing : {},\n scheduled ? cardStyles.scheduled : {},\n completed ? cardStyles.completed : {},\n sx,\n )}\n minWidth={400}\n maxWidth={550}\n maxHeight={500}\n >\n <Stack flexGrow={1} gap={0.5} minWidth={0} divider={<Divider flexItem={true} />}>\n <EventDefinition event={event} />\n\n <Stack\n sx={{scrollbarGutter: 'stable'}}\n pr={1}\n overflow=\"auto\"\n minHeight={0}\n gap={0.5}\n divider={<Divider sx={{borderStyle: 'dashed'}} flexItem={true} />}\n >\n {Array.from(event.devices.entries()).map(([deviceId, profile]) => {\n const master = devices?.get(deviceId);\n\n if (!master) {\n return <Skeleton key={deviceId} width={80} variant=\"text\" />;\n }\n\n return (\n <Box key={deviceId}>\n <Stack direction=\"row\" alignItems=\"center\" gap={1} mb={0.5}>\n <Box color={grey[500]}>{Icons.deviceCircuit().reactComponent()}</Box>\n\n <Link\n data-id=\"device-link\"\n sx={{minWidth: 0}}\n href={router.url('deviceDetails', {deviceId}, {activeTab: 'events'})}\n >\n <OverflowTooltip rowsNumber={2}>{master.getName()}</OverflowTooltip>\n </Link>\n </Stack>\n\n <Grid container={true} spacing={0.5}>\n {Array.from(profile.entries()).map(([channelIdx, c]) => {\n const channel = master.getChannelByIndex(channelIdx);\n\n if (!channel) {\n return null;\n }\n\n return (\n <Grid key={channelIdx} item={true} xs={4}>\n <EventChannel\n key={channelIdx}\n master={master}\n channel={channel}\n preview={false}\n active={ongoing}\n recording={c.recording}\n streaming={c.streaming}\n />\n </Grid>\n );\n })}\n </Grid>\n </Box>\n );\n })}\n </Stack>\n </Stack>\n </Stack>\n );\n});\n","import React, {useEffect} from 'react';\nimport {Box, ClickAwayListener, Paper, Popper, PopperPlacementType} from '@mui/material';\nimport {isNil} from 'app/util/isNil';\n\ninterface Props {\n anchorEl: HTMLElement | null;\n placement: PopperPlacementType;\n setAnchor: React.Dispatch<React.SetStateAction<HTMLElement | null>>;\n}\n\nexport function EventPopper({\n anchorEl,\n children,\n placement,\n setAnchor,\n}: React.PropsWithChildren<Props>) {\n const open = !isNil(anchorEl);\n\n const handleClickAway = (e: MouseEvent | TouchEvent) => {\n if (anchorEl && anchorEl.contains(e.currentTarget as HTMLElement)) {\n return;\n }\n\n setAnchor(null);\n };\n\n useEffect(() => {\n if (!open) {\n return;\n }\n\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n setAnchor(null);\n }\n };\n\n document.addEventListener('keydown', handleKeyDown);\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n };\n }, [open, setAnchor]);\n\n return (\n <Popper\n sx={{zIndex: ({zIndex}) => zIndex.modal}}\n open={open}\n anchorEl={anchorEl}\n transition={false}\n placement={placement}\n modifiers={[{name: 'offset', options: {offset: [2, 2]}}]}\n >\n <Paper elevation={16}>\n <ClickAwayListener onClickAway={handleClickAway}>\n <Box position=\"relative\">{children}</Box>\n </ClickAwayListener>\n </Paper>\n </Popper>\n );\n}\n","import React, {forwardRef, useState} from 'react';\nimport {Box, ButtonBase, Skeleton, Stack, SxProps, Theme, Typography} from '@mui/material';\nimport {grey} from '@mui/material/colors';\nimport {Sx} from 'app/types/common';\nimport {EventDetails} from 'app/components/sharedReactComponents/Events/Calendar/EventsSchedule/DayEvents/EventDetails/EventDetails';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {formatEventMedia} from 'app/components/sharedReactComponents/Events/utils';\nimport {OverflowTooltip} from 'app/components/sharedReactComponents/OverflowTooltip/OverflowTooltip';\nimport {EventPopper} from 'app/components/sharedReactComponents/Events/Calendar/shared/EventPopper/EventPopper';\nimport {Schedule} from 'app/domain/schedule';\nimport {Icons} from 'app/util/icons';\nimport {pluralizeN} from 'app/components/helpers/commonHelpers';\nimport {PearlMasterDeviceModel} from 'app/components/DeviceDetails/Models/PearlMasterDeviceModel';\nimport {cardStyles} from 'app/components/sharedReactComponents/Events/styles';\nimport {isCompleted, isOngoing, isScheduled} from 'app/domain/schedule/utils';\n\nconst rootStyles: SxProps<Theme> = {\n borderRadius: 1,\n alignItems: 'stretch',\n overflow: 'hidden',\n bgcolor: 'white',\n};\n\ninterface Props extends Sx {\n event: Schedule.Event;\n devices?: Map<string, PearlMasterDeviceModel>;\n placement?: 'vertical' | 'horizontal';\n}\n\nconst CalendarEventRef = forwardRef<HTMLButtonElement, Props>(\n ({sx, event, devices, placement = 'horizontal'}, ref) => {\n const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);\n\n const handleOpen = (event: React.MouseEvent<HTMLElement>) => {\n setAnchorEl(event.currentTarget);\n };\n\n const deviceCount = event.devices.size;\n\n const ongoing = isOngoing(event.status);\n const scheduled = isScheduled(event.status);\n const completed = isCompleted(event.status);\n\n const renderDevices = () => {\n const renderNames = () => {\n if (deviceCount === 1) {\n const deviceId = Array.from(event.devices.keys()).at(0);\n const instance = deviceId ? devices?.get(deviceId) : undefined;\n\n if (!instance) {\n return <Skeleton width={50} variant=\"text\" />;\n }\n\n return <OverflowTooltip>{instance.getName()}</OverflowTooltip>;\n }\n\n return `${deviceCount} ${pluralizeN('device', deviceCount)}`;\n };\n\n return (\n <Stack direction=\"row\" alignItems=\"center\" gap={1} minWidth={0} maxWidth=\"100%\">\n <Box color={grey[500]}>{Icons.deviceCircuit().reactComponent()}</Box>\n\n <Typography data-id=\"event-devices\" component=\"span\" minWidth={0}>\n {renderNames()}\n </Typography>\n </Stack>\n );\n };\n\n return (\n <ButtonBase\n ref={ref}\n data-id={`calendar-event-${event.id}`}\n sx={packSx(rootStyles, sx)}\n onClick={handleOpen}\n >\n <Stack\n sx={packSx(\n cardStyles.root,\n ongoing && cardStyles.ongoing,\n scheduled && cardStyles.scheduled,\n completed && cardStyles.completed,\n {p: 0.5},\n )}\n flex={1}\n alignItems=\"flex-start\"\n minWidth={0}\n >\n <Typography fontWeight={600} component=\"span\" minWidth={0} maxWidth=\"100%\" mb={0.5}>\n <OverflowTooltip dataId=\"event-title\" rowsNumber={1}>\n {event.title}\n </OverflowTooltip>\n </Typography>\n\n <Typography\n fontSize={12}\n textAlign=\"left\"\n minWidth={0}\n maxWidth=\"100%\"\n component=\"span\"\n mb={0.5}\n >\n <OverflowTooltip dataId=\"event-type\">{formatEventMedia(event.media)}</OverflowTooltip>\n </Typography>\n\n {renderDevices()}\n </Stack>\n\n <EventPopper\n anchorEl={anchorEl}\n placement={placement === 'horizontal' ? 'right' : 'top'}\n setAnchor={setAnchorEl}\n >\n <EventDetails\n dataId={`calendar-event-detail-${event.id}`}\n event={event}\n devices={devices}\n />\n </EventPopper>\n </ButtonBase>\n );\n },\n);\nexport const CalendarEvent = React.memo(CalendarEventRef);\n","import React from 'react';\nimport {Sx} from 'app/types/common';\nimport {Box, Stack, Typography} from '@mui/material';\nimport {Schedule} from 'app/domain/schedule';\nimport {formatEventFullTime} from 'app/components/sharedReactComponents/Events/utils';\nimport {PearlMasterDeviceModel} from 'app/components/DeviceDetails/Models/PearlMasterDeviceModel';\nimport {EventDetails} from 'app/components/sharedReactComponents/Events/Calendar/EventsSchedule/DayEvents/EventDetails/EventDetails';\nimport {Virtuoso} from 'react-virtuoso';\n\ninterface Props extends Sx {\n events: Schedule.Event[];\n devices?: Map<string, PearlMasterDeviceModel>;\n}\n\nexport function GroupDetails({sx, events, devices}: Props) {\n const renderTime = () => {\n const first = events.at(0);\n const last = events.at(-1);\n\n if (!first || !last) {\n return false;\n }\n\n return <Typography>{formatEventFullTime(first.start, last.end)}</Typography>;\n };\n\n const listHeight = events.length * 102;\n\n return (\n <Box sx={sx} minWidth={420} maxWidth={580} maxHeight={600} pt={1}>\n <Stack px={1} direction=\"row\" justifyContent=\"space-between\" mb={1} flexShrink={0}>\n <Typography fontWeight={600} fontSize={16}>\n {events.length} events\n </Typography>\n\n {renderTime()}\n </Stack>\n\n <Box pl={1} pb={1} height={listHeight > 310 ? 310 : listHeight}>\n <Virtuoso\n data={events}\n itemContent={(_, e) => (\n <Box mb={1}>\n <EventDetails key={e.id} event={e} devices={devices} />\n </Box>\n )}\n />\n </Box>\n </Box>\n );\n}\n","import React from 'react';\nimport {Stack, Typography} from '@mui/material';\nimport {DataId, Sx} from 'app/types/common';\nimport {EventCategory} from 'app/components/sharedReactComponents/Events/types';\nimport {EventIcon} from 'app/components/sharedReactComponents/Events/shared/EventIcon/EventIcon';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\nimport {capitalize} from 'app/components/helpers/commonHelpers';\n\ninterface Props extends Sx, DataId {\n category: EventCategory;\n count: number;\n}\n\nexport function EventsCount({dataId, sx, category, count}: Props) {\n return (\n <Tooltip content={capitalize(category)}>\n <Stack sx={sx} direction=\"row\" alignItems=\"center\" gap={0.25}>\n <EventIcon type={category} />\n <Typography data-id={dataId}>{count}</Typography>\n </Stack>\n </Tooltip>\n );\n}\n","import React from 'react';\nimport {Stack} from '@mui/material';\nimport {EventsCount} from 'app/components/sharedReactComponents/Events/shared/EventsCount/EventsCount';\nimport {DataId, Sx} from 'app/types/common';\nimport {EventCategory} from 'app/components/sharedReactComponents/Events/types';\nimport {isNil} from 'app/util/isNil';\n\ntype Props = Sx & DataId & {[K in EventCategory]?: number};\n\nexport function CategoryCount({dataId, sx, completed, ongoing, scheduled}: Props) {\n return (\n <Stack data-id={dataId} sx={sx} direction=\"row\" alignItems=\"center\" gap={0.5}>\n {!isNil(ongoing) && ongoing > 0 && (\n <EventsCount dataId=\"ongoing-count\" category=\"ongoing\" count={ongoing} />\n )}\n\n {!isNil(scheduled) && scheduled > 0 && (\n <EventsCount dataId=\"scheduled-count\" category=\"scheduled\" count={scheduled} />\n )}\n\n {!isNil(completed) && completed > 0 && (\n <EventsCount dataId=\"completed-count\" category=\"completed\" count={completed} />\n )}\n </Stack>\n );\n}\n","import React, {forwardRef, useMemo, useState} from 'react';\nimport {Box, ButtonBase, SxProps, Theme, Typography} from '@mui/material';\nimport {DataId, Sx} from 'app/types/common';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {EventPopper} from 'app/components/sharedReactComponents/Events/Calendar/shared/EventPopper/EventPopper';\nimport {pluralizeN} from 'app/components/helpers/commonHelpers';\nimport {GroupDetails} from 'app/components/sharedReactComponents/Events/Calendar/EventsSchedule/DayEvents/CalendarGroup/GroupDetails/GroupDetails';\nimport {Schedule} from 'app/domain/schedule';\nimport {isOngoing, isScheduled} from 'app/domain/schedule/utils';\nimport {PearlMasterDeviceModel} from 'app/components/DeviceDetails/Models/PearlMasterDeviceModel';\nimport {CategoryCount} from 'app/components/sharedReactComponents/Events/Calendar/shared/CategoryCount/CategoryCount';\n\nconst rootStyles: SxProps<Theme> = {\n borderRadius: 1,\n border: 1,\n alignItems: 'stretch',\n overflow: 'hidden',\n bgcolor: 'white',\n};\n\ninterface Props extends Sx, DataId {\n events: Schedule.Event[];\n devices?: Map<string, PearlMasterDeviceModel>;\n placement?: 'vertical' | 'horizontal';\n}\n\nconst CalendarGroupRef = forwardRef<HTMLButtonElement, Props>(\n ({sx, events, devices, placement = 'horizontal'}, ref) => {\n const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);\n\n const stats = useMemo(() => {\n return events.reduce<Record<Schedule.EventVariant, number>>(\n (acc, value) => {\n if (isOngoing(value.status)) {\n acc.ongoing += 1;\n } else if (isScheduled(value.status)) {\n acc.scheduled += 1;\n } else {\n acc.completed += 1;\n }\n\n return {...acc};\n },\n {\n completed: 0,\n ongoing: 0,\n scheduled: 0,\n },\n );\n }, [events]);\n\n const devicesCount = useMemo(() => {\n const set = events.reduce((acc, event) => {\n Array.from(event.devices.keys()).forEach((id) => acc.add(id));\n return acc;\n }, new Set<string>());\n return set.size;\n }, [events]);\n\n const total = events.length;\n\n const handleOpen = (event: React.MouseEvent<HTMLElement>) => {\n setAnchorEl(event.currentTarget);\n };\n\n return (\n <ButtonBase\n ref={ref}\n data-id=\"group-events-card\"\n sx={packSx(rootStyles, sx)}\n onClick={handleOpen}\n >\n <Box flex={1} pl={1} pr={0.5} py={0.5}>\n <Typography data-id=\"group-title\" textAlign=\"left\" fontWeight={600} mb={0.5}>\n {total} events\n </Typography>\n\n <CategoryCount\n data-id=\"group-stats\"\n sx={{minWidth: 0}}\n ongoing={stats.ongoing}\n scheduled={stats.scheduled}\n completed={stats.completed}\n />\n\n <Typography textAlign=\"left\">\n {devicesCount} {pluralizeN('device', devicesCount)}\n </Typography>\n </Box>\n\n <EventPopper\n anchorEl={anchorEl}\n placement={placement === 'horizontal' ? 'right' : 'top'}\n setAnchor={setAnchorEl}\n >\n <GroupDetails events={events} devices={devices} />\n </EventPopper>\n </ButtonBase>\n );\n },\n);\n\nexport const CalendarGroup = React.memo(CalendarGroupRef);\n","import {useEffect, useState} from 'react';\nimport {Schedule} from 'app/domain/schedule';\nimport {\n buildEventGroups,\n hasOverlap,\n} from 'app/components/sharedReactComponents/Events/Calendar/utils';\n\ninterface Args {\n events: Schedule.Event[];\n range: TimeRange;\n}\n\ninterface EventGroup {\n start: TimeStampSeconds;\n end: TimeStampSeconds;\n events: Schedule.Event[];\n}\n\ninterface DayEvents {\n ungrouped: Schedule.Event[];\n groups: EventGroup[];\n}\n\nexport function useDayEvents({range, events}: Args) {\n const [stats, setStats] = useState<DayEvents>({groups: [], ungrouped: []});\n\n useEffect(() => {\n const intervalEvents = events.filter((event) => {\n return hasOverlap({from: event.start, to: event.end}, range);\n });\n\n const result = buildEventGroups(intervalEvents);\n setStats(result);\n }, [range, events]);\n\n return stats;\n}\n","import React from 'react';\nimport {Box} from '@mui/material';\nimport {grey} from '@mui/material/colors';\nimport {DataId, StyleSx, Sx} from 'app/types/common';\nimport {secondsToMinutes} from 'app/util/timeConverter';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\nimport {CalendarEvent} from 'app/components/sharedReactComponents/Events/Calendar/EventsSchedule/DayEvents/CalendarEvent/CalendarEvent';\nimport {CalendarGroup} from 'app/components/sharedReactComponents/Events/Calendar/EventsSchedule/DayEvents/CalendarGroup/CalendarGroup';\nimport {Schedule} from 'app/domain/schedule';\nimport {useDayEvents} from 'app/components/sharedReactComponents/Events/Calendar/EventsSchedule/DayEvents/useDayEvents';\nimport {PearlMasterDeviceModel} from 'app/components/DeviceDetails/Models/PearlMasterDeviceModel';\nimport {packSx} from 'app/util/packSx/packSx';\n\nconst MAX_HEIGHT_EVENT_CARD_FOR_DISPLAYING_TOOLTIP = 14;\nconst MAX_HEIGHT_EVENTS_GROUP_FOR_DISPLAYING_TOOLTIP = 30;\n\nconst eventSx: StyleSx = {position: 'absolute', left: 0, right: 0, zIndex: 1};\n\ntype Props = Sx &\n DataId & {\n range: TimeRange;\n events: Schedule.Event[];\n oneDay: boolean;\n devices?: Map<string, PearlMasterDeviceModel>;\n disabled?: boolean;\n };\n\nexport const DayEvents = React.memo(\n ({sx, dataId, range, events, devices, disabled, oneDay}: Props) => {\n const {groups, ungrouped} = useDayEvents({events, range});\n\n return (\n <Box\n data-id={dataId}\n sx={sx}\n position=\"relative\"\n bgcolor={disabled ? grey[100] : 'transparent'}\n >\n {ungrouped.map((event) => {\n const {id} = event;\n\n const {top, height} = calculateDimensions({from: event.start, to: event.end}, range);\n\n const tooltipContent =\n height < MAX_HEIGHT_EVENT_CARD_FOR_DISPLAYING_TOOLTIP && event.title;\n\n return (\n <Tooltip key={id} content={tooltipContent}>\n <CalendarEvent\n sx={packSx({top: `${top}px`, height: `${height}px`}, eventSx)}\n event={event}\n devices={devices}\n placement={oneDay ? 'vertical' : 'horizontal'}\n />\n </Tooltip>\n );\n })}\n\n {groups.map((group) => {\n const {top, height} = calculateDimensions({from: group.start, to: group.end}, range);\n\n const tooltipContent =\n height < MAX_HEIGHT_EVENTS_GROUP_FOR_DISPLAYING_TOOLTIP &&\n `${group.events.length} events`;\n\n return (\n <Tooltip key={group.start} content={tooltipContent}>\n <CalendarGroup\n sx={packSx({top: `${top}px`, height: `${height}px`}, eventSx)}\n events={group.events}\n devices={devices}\n placement={oneDay ? 'vertical' : 'horizontal'}\n />\n </Tooltip>\n );\n })}\n </Box>\n );\n },\n);\n\nfunction calculateDimensions(event: TimeRange, day: TimeRange): {top: number; height: number} {\n const normalizedStart = Math.max(event.from, day.from);\n const normalizedFinish = Math.min(event.to, day.to);\n\n const top = secondsToMinutes(normalizedStart - day.from);\n const height = secondsToMinutes(normalizedFinish - normalizedStart);\n\n return {top, height};\n}\n","import React, {useState} from 'react';\nimport dayjs from 'dayjs';\nimport {useDebounce} from 'react-use';\nimport {Box, Button, Collapse, Slider, Stack, Typography} from '@mui/material';\nimport ExpandMoreIcon from '@mui/icons-material/ExpandMore';\nimport {Sx} from 'app/types/common';\n\ninterface Props extends Sx {\n range: TimeRange;\n onChange: (r: TimeRange) => void;\n}\n\nconst MIN_TIME = 0;\nconst MAX_TIME = 86400;\nconst STEP = 3600;\n\nexport function HoursToView({sx, range, onChange}: Props) {\n const [expanded, setExpanded] = useState(false);\n\n const [state, setState] = useState<TimeRange>(() => ({...range}));\n\n useDebounce(\n () => {\n onChange({...state});\n },\n 300,\n [state],\n );\n\n const handleExpand = () => {\n setExpanded((p) => !p);\n };\n\n const handleReset = () => {\n setState({from: MIN_TIME, to: MAX_TIME});\n };\n\n const {from, to} = state;\n const showReset = from !== MIN_TIME || to !== MAX_TIME;\n\n return (\n <Box sx={sx}>\n <Stack direction=\"row\" alignItems=\"center\" gap={1}>\n <Button\n data-id=\"hours-view-btn\"\n sx={{minWidth: 254}}\n variant=\"outlined\"\n endIcon={\n <ExpandMoreIcon\n sx={{transform: `rotate(${expanded ? 180 : 0}deg)`, transition: 'transform .3s'}}\n />\n }\n disableRipple={false}\n onClick={handleExpand}\n >\n <Typography textAlign=\"left\" flexGrow={1}>\n Hours to view: {getTimeText(state.from)} - {getTimeText(state.to)}\n </Typography>\n </Button>\n\n {showReset && (\n <Button data-id=\"reset-hours\" variant=\"outlined\" onClick={handleReset}>\n <Typography>Reset</Typography>\n </Button>\n )}\n </Stack>\n\n <Collapse sx={{px: 1.5}} in={expanded}>\n <Slider\n data-id=\"hours-range\"\n min={MIN_TIME}\n max={MAX_TIME}\n step={STEP}\n marks={true}\n disableSwap={true}\n value={[state.from, state.to]}\n valueLabelDisplay=\"auto\"\n valueLabelFormat={(value) => getTimeText(value)}\n onChange={(_e, value) => {\n if (Array.isArray(value)) {\n const [from, to] = value;\n\n setState((prev) => {\n if (from !== to) {\n return {from: from ?? prev[0], to: to ?? prev[1]};\n }\n\n return prev;\n });\n }\n }}\n />\n </Collapse>\n </Box>\n );\n}\n\nconst now = dayjs().startOf('date');\n\nfunction getTimeText(seconds: number) {\n const formatted = now.add(seconds, 'seconds').format('h A');\n return formatted;\n}\n","import React from 'react';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport {resolveComponentProps} from '@mui/base/utils';\nimport {\n DateCalendar,\n DateCalendarProps,\n DateTimePickerProps,\n DigitalClock,\n DigitalClockProps,\n} from '@mui/x-date-pickers';\nimport {DateOrTimeViewWithMeridiem} from '@mui/x-date-pickers/internals/models';\nimport {isDatePickerView} from '@mui/x-date-pickers/internals/utils/date-utils';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {VIEW_HEIGHT} from '@mui/x-date-pickers/internals/constants/dimensions';\nimport {Box, Divider} from '@mui/material';\nimport {isNil} from 'app/util/isNil';\n\nexport interface DateTimeViewRendererProps<TDate>\n extends Omit<\n DateCalendarProps<TDate> & DigitalClockProps<TDate>,\n | 'views'\n | 'openTo'\n | 'view'\n | 'onViewChange'\n | 'focusedView'\n | 'components'\n | 'componentsProps'\n | 'slots'\n | 'slotProps'\n | 'timeStep'\n >,\n Pick<\n DateTimePickerProps<TDate>,\n 'components' | 'componentsProps' | 'slots' | 'slotProps' | 'timeSteps'\n > {\n view: DateOrTimeViewWithMeridiem;\n views: readonly DateOrTimeViewWithMeridiem[];\n focusedView: DateOrTimeViewWithMeridiem | null;\n timeViewsCount?: number;\n onViewChange?: (view: DateOrTimeViewWithMeridiem) => void;\n}\n\nexport const renderDesktopDateTimeView = <TDate extends unknown>({\n sx,\n view,\n views,\n focusedView,\n value,\n defaultValue,\n className,\n classes,\n disablePast,\n disableFuture,\n minDate,\n minTime,\n maxDate,\n maxTime,\n reduceAnimations,\n minutesStep,\n ampm,\n monthsPerRow,\n yearsPerRow,\n defaultCalendarMonth,\n slots,\n slotProps,\n loading,\n disableHighlightToday,\n readOnly,\n disabled,\n showDaysOutsideCurrentMonth,\n disableIgnoringDatePartForTimeValidation,\n skipDisabled,\n timeViewsCount,\n autoFocus,\n fixedWeekNumber,\n displayWeekNumber,\n timeSteps,\n renderLoading,\n dayOfWeekFormatter,\n onMonthChange,\n onYearChange,\n shouldDisableDate,\n shouldDisableMonth,\n shouldDisableYear,\n shouldDisableTime,\n onChange,\n onViewChange,\n onFocusedViewChange,\n}: DateTimeViewRendererProps<TDate>) => {\n const isActionBarVisible = !!resolveComponentProps(slotProps?.actionBar, {} as any)?.actions\n ?.length;\n\n return (\n <React.Fragment>\n <Box display=\"flex\" margin=\"0 auto\">\n <DateCalendar\n sx={sx}\n view={isDatePickerView(view) ? view : 'day'}\n views={views.filter(isDatePickerView)}\n focusedView={focusedView && isDatePickerView(focusedView) ? focusedView : null}\n value={value}\n defaultValue={defaultValue}\n className={className}\n classes={classes}\n disableFuture={disableFuture}\n disablePast={disablePast}\n minDate={minDate}\n maxDate={maxDate}\n reduceAnimations={reduceAnimations}\n monthsPerRow={monthsPerRow}\n yearsPerRow={yearsPerRow}\n slots={slots}\n slotProps={slotProps}\n loading={loading}\n disableHighlightToday={disableHighlightToday}\n defaultCalendarMonth={defaultCalendarMonth}\n showDaysOutsideCurrentMonth={showDaysOutsideCurrentMonth}\n autoFocus={autoFocus}\n fixedWeekNumber={fixedWeekNumber}\n displayWeekNumber={displayWeekNumber}\n readOnly={readOnly}\n disabled={disabled}\n dayOfWeekFormatter={dayOfWeekFormatter}\n renderLoading={renderLoading}\n shouldDisableDate={shouldDisableDate}\n shouldDisableMonth={shouldDisableMonth}\n shouldDisableYear={shouldDisableYear}\n onChange={onChange}\n onFocusedViewChange={onFocusedViewChange}\n onMonthChange={onMonthChange}\n onYearChange={onYearChange}\n onViewChange={onViewChange}\n />\n {!isNil(timeViewsCount) && timeViewsCount > 0 && (\n <React.Fragment>\n <Divider orientation=\"vertical\" />\n <DigitalClock\n sx={packSx({borderBottom: 0, width: 'auto', maxHeight: VIEW_HEIGHT}, sx)}\n view={view === 'hours' ? view : 'hours'}\n views={views.includes('hours') ? ['hours'] : []}\n value={value}\n defaultValue={defaultValue}\n ampm={ampm}\n slots={slots}\n slotProps={{digitalClockItem: slotProps?.digitalClockSectionItem}}\n className={className}\n classes={classes}\n disableFuture={disableFuture}\n disablePast={disablePast}\n minTime={minTime}\n maxTime={maxTime}\n disabled={disabled}\n readOnly={readOnly}\n autoFocus={autoFocus}\n disableIgnoringDatePartForTimeValidation={disableIgnoringDatePartForTimeValidation}\n timeStep={timeSteps?.minutes}\n minutesStep={minutesStep}\n skipDisabled={skipDisabled}\n shouldDisableTime={shouldDisableTime}\n onChange={onChange}\n onViewChange={onViewChange}\n onFocusedViewChange={onFocusedViewChange}\n />\n </React.Fragment>\n )}\n </Box>\n {isActionBarVisible && <Divider />}\n </React.Fragment>\n );\n};\n","import {z} from 'zod';\nimport dayjs from 'dayjs';\n\nexport const UntilScheme = z.object({\n type: z.enum(['never', 'date', 'occurrences']),\n date: z.number(),\n occurrences: z.number(),\n});\n\nexport const recurrenceType = z.enum(['daily', 'weekly']);\n\nexport const RecurrenceScheme = z.object({\n type: recurrenceType,\n until: UntilScheme,\n});\n\nexport const EventScheme = z\n .object({\n title: z.string().min(1, {message: 'Required field'}),\n start: z\n .number()\n .min(1, {message: 'Required field'})\n .refine(\n (value) => {\n return dayjs.unix(value).isAfter(dayjs());\n },\n {message: \"Can't be past date or time\"},\n ),\n end: z.number().min(1, {message: 'Required field'}),\n timezone: z.string().min(1, {message: 'Required field'}),\n recurrent: z.boolean(),\n recurrence: RecurrenceScheme,\n })\n .superRefine((val, ctx) => {\n const {\n start,\n end,\n recurrence: {until},\n } = val;\n\n if (dayjs.unix(end).subtract(1, 'minute').unix() < start) {\n ctx.addIssue({\n code: 'custom',\n message: \"Can't be equal or less than start\",\n path: ['end'],\n });\n }\n\n if (until.type === 'date') {\n if (until.date === 0) {\n ctx.addIssue({\n code: 'custom',\n message: 'Required field',\n path: ['recurrence.until.date'],\n });\n }\n\n if (dayjs.unix(until.date).isBefore(dayjs(), 'day')) {\n ctx.addIssue({\n code: 'custom',\n message: \"Can't be past date\",\n path: ['recurrence.until.date'],\n });\n }\n\n if (end > 0 && dayjs.unix(until.date).isBefore(dayjs.unix(end), 'day')) {\n ctx.addIssue({\n code: 'custom',\n message: \"Can't be less that end\",\n path: ['recurrence.until.date'],\n });\n }\n }\n\n if (until.type === 'occurrences') {\n if (until.occurrences < 0) {\n ctx.addIssue({\n code: 'custom',\n message: 'Min: 1',\n path: ['recurrence.until.occurrences'],\n });\n }\n }\n });\n","import React, {SyntheticEvent, useEffect, useMemo, useState} from 'react';\nimport dayjs, {Dayjs} from 'dayjs';\nimport {Controller, useForm, useWatch} from 'react-hook-form';\nimport {\n Autocomplete,\n Box,\n Button,\n Checkbox,\n Collapse,\n FormControlLabel,\n FormLabel,\n IconButton,\n MenuItem,\n Popover,\n Radio,\n RadioGroup,\n Select,\n Stack,\n TextField,\n Tooltip,\n Typography,\n capitalize,\n} from '@mui/material';\nimport {DesktopDatePicker, DesktopDateTimePicker} from '@mui/x-date-pickers';\nimport RestoreIcon from '@mui/icons-material/Restore';\nimport AddIcon from '@mui/icons-material/Add';\nimport {zodResolver} from '@hookform/resolvers/zod';\nimport {getTimeZones} from '@vvo/tzdb';\nimport {DeviceForm} from 'app/components/sharedReactComponents/Events/Editor/EventForm/DeviceForm/DeviceForm';\nimport {PearlMasterDeviceModel} from 'app/components/DeviceDetails/Models/PearlMasterDeviceModel';\nimport {Sx} from 'app/types/common';\nimport {isNil} from 'app/util/isNil';\nimport {\n ChannelAction,\n Destination,\n DestinationType,\n ChannelFields,\n EventFormFields,\n EventConfig,\n DeviceConfiguration,\n} from 'app/components/sharedReactComponents/Events/Editor/EventForm/types';\nimport {grey} from '@mui/material/colors';\nimport {useDeviceConfiguration} from 'app/components/sharedReactComponents/Events/hooks/useDevicesConfiguration';\nimport {renderDesktopDateTimeView} from 'app/components/sharedReactComponents/DateTimePicker/renderDesktopDateTimeView';\nimport {\n EventScheme,\n recurrenceType,\n} from 'app/components/sharedReactComponents/Events/Editor/EventForm/scheme';\nimport {DevicePicker} from 'app/components/sharedReactComponents/Events/Editor/EventForm/DevicePicker/DevicePicker';\nimport {LoadingButton} from '@mui/lab';\nimport {useMounted} from 'app/hooks/useIsMounted';\n\ninterface Timezone {\n label: string;\n value: string;\n}\n\nconst zones = new Map<string, Timezone>(\n getTimeZones().map((z) => [z.name, {label: `GMT${z.currentTimeFormat}`, value: z.name}]),\n);\n\nconst timezones = Array.from(zones.values());\n\ninterface Props extends Sx {\n initConfig: EventConfig;\n mode: 'create' | 'edit';\n connectedDevices: Map<string, PearlMasterDeviceModel>;\n destinations: Destination[];\n configurable: boolean;\n onConfirm: (config: EventConfig) => Promise<void>;\n onClose: () => void;\n}\n\nexport function EventForm({\n sx,\n mode,\n connectedDevices,\n initConfig,\n destinations,\n configurable,\n onConfirm,\n onClose,\n}: Props) {\n const mounted = useMounted();\n const [anchorEl, setAnchorEl] = useState<HTMLButtonElement | null>(null);\n\n const [loading, setLoading] = useState(false);\n\n const [devicesConf, dispatchConf] = useDeviceConfiguration({\n devicesConfig: initConfig.devices,\n connectedDevices,\n destinations,\n });\n\n const availableDevices = useMemo(() => Array.from(connectedDevices.values()), [connectedDevices]);\n\n const checkIsSelected = (id: string) => devicesConf.has(id);\n\n const {\n control,\n formState: {isValid},\n setValue,\n getValues,\n trigger,\n } = useForm<EventFormFields>({\n defaultValues: {...initConfig.event},\n mode: 'all',\n resolver: async (data, context, options) => {\n const result = await zodResolver(EventScheme)(data, context, options);\n\n return result;\n },\n });\n\n const {start, end, recurrent, recurrence} = useWatch({control});\n\n const userTimezone = dayjs.tz.guess();\n\n const [invalidDevices, setInvalidDevices] = useState<string[]>([]);\n\n useEffect(() => {\n void trigger();\n }, [trigger]);\n\n useEffect(() => {\n const result: string[] = [];\n\n if (devicesConf.size === 0) {\n result.push('No selected devices');\n }\n\n const usedDestinations = new Map<string, number>();\n\n Array.from(devicesConf.values()).forEach((meta) => {\n const {device, state} = meta;\n const name = device.getName();\n\n const channels = device.getChanelModels();\n\n if (!channels.length) {\n result.push(`${name}: no available channels`);\n return;\n }\n\n let [streaming, recording] = [0, 0];\n\n Array.from(state.values()).forEach((s) => {\n if (s.destination) {\n const count = usedDestinations.get(s.destination);\n usedDestinations.set(s.destination, isNil(count) ? 1 : count + 1);\n }\n\n if (s.streaming) {\n streaming += 1;\n }\n\n if (s.recording) {\n recording += 1;\n }\n });\n\n if (!streaming && !recording) {\n result.push(`${name}: no selected action at least on one channel`);\n return;\n }\n\n const duplicates = Array.from(usedDestinations.entries()).filter(([, value]) => value > 1);\n\n duplicates.forEach(([destId]) => {\n const name = destinations.find((d) => d.id === destId)?.name;\n result.push(`\"${name ?? destId}\" cannot be selected multiple times`);\n });\n });\n\n setInvalidDevices(result);\n }, [devicesConf, destinations]);\n\n const openDeviceMenu = (e: SyntheticEvent<HTMLButtonElement>) => {\n setAnchorEl(e.currentTarget);\n };\n\n const closeDeviceMenu = () => {\n setAnchorEl(null);\n };\n\n const handleAddDevice = (i: PearlMasterDeviceModel) => {\n const channelMap = new Map<string, ChannelFields>();\n\n const channels = i.getChanelModels();\n\n channels.forEach((c) => {\n channelMap.set(c.getChannelDeviceIdIndex(), {\n destination: '',\n publishers: [],\n recording: true,\n streaming: false,\n });\n });\n\n dispatchConf({type: 'add', payload: {device: i, state: channelMap}});\n closeDeviceMenu();\n };\n\n const handleRemoveDevice = (id: string) => {\n dispatchConf({type: 'delete', payload: {id}});\n };\n\n const handleChannelDestination = (\n deviceId: string,\n channelIdx: string,\n type: DestinationType,\n value: string,\n ) => {\n dispatchConf({\n type: 'streaming-destination',\n payload: {\n deviceId,\n channelIdx,\n type,\n value,\n },\n });\n };\n\n const handleChannelAction = (\n deviceId: string,\n channelIdx: string,\n type: ChannelAction,\n value: boolean,\n ) => {\n dispatchConf({\n type: 'channel-action',\n payload: {\n deviceId,\n channelIdx,\n type,\n value,\n },\n });\n };\n\n const isDevicePickerOpen = Boolean(anchorEl);\n\n const hasDevices = devicesConf.size > 0;\n\n const now = dayjs();\n\n const resetTimezone = () => {\n setValue('timezone', dayjs.tz.guess(), {shouldValidate: true});\n };\n\n const handleConfirm = async () => {\n setLoading(true);\n const validation = await trigger();\n\n if (!validation) {\n setLoading(false);\n return;\n }\n\n const fields = getValues();\n const devices = getDevicesConf(devicesConf);\n try {\n await onConfirm({event: fields, devices});\n } finally {\n if (mounted()) {\n setLoading(false);\n }\n }\n };\n\n const disabledConfirm = !isValid || invalidDevices.length > 0;\n\n const handleStartDateChange = (value: Dayjs | null, onChange: (v: number) => void) => {\n if (value?.isValid()) {\n const result = value;\n\n const end = getValues('end');\n const until = getValues('recurrence.until.date');\n\n if (end === 0 || result.isAfter(dayjs.unix(end), 'minutes')) {\n setValue('end', result.add(1, 'hour').unix(), {shouldValidate: true});\n }\n\n if (until === 0 || result.isAfter(dayjs.unix(end), 'days')) {\n setValue('recurrence.until.date', result.add(1, 'day').unix(), {shouldValidate: true});\n }\n\n onChange(result.unix());\n } else {\n setValue('end', 0, {shouldValidate: true});\n onChange(0);\n }\n void trigger(['end', 'recurrence.until.date']);\n };\n\n const handleEndDateChange = (value: Dayjs | null, onChange: (v: number) => void) => {\n if (value?.isValid()) {\n const until = getValues('recurrence.until.date');\n const result = value;\n\n if (until === 0 || result.isAfter(dayjs.unix(until), 'days')) {\n setValue('recurrence.until.date', result.add(1, 'day').unix(), {shouldValidate: true});\n }\n\n onChange(result.unix());\n } else {\n onChange(0);\n }\n void trigger('recurrence.until.date');\n };\n\n return (\n <Stack sx={sx} flexGrow={1} component=\"form\" minHeight={0}>\n <Box p={3} flexGrow={1} sx={{overflowY: 'auto'}}>\n <FormLabel>Event name</FormLabel>\n <Controller\n name=\"title\"\n control={control}\n render={({field, fieldState: {error}}) => (\n <TextField\n {...field}\n inputProps={{'data-id': 'event-name-input'}}\n variant=\"standard\"\n error={!isNil(error)}\n fullWidth={true}\n helperText={error?.message ?? ' '}\n />\n )}\n />\n\n <Stack direction=\"row\" gap={2}>\n <Box>\n <FormLabel sx={{display: 'block'}}>Start date and time</FormLabel>\n <Controller\n name=\"start\"\n control={control}\n render={({field: {value: formValue, onChange, onBlur}, fieldState: {error}}) => {\n const instance = formValue > 0 ? dayjs.unix(formValue) : null;\n const hasError = !isNil(error?.message);\n const helperText = hasError ? error?.message ?? ' ' : ' ';\n\n return (\n <DesktopDateTimePicker\n value={instance}\n minDate={now}\n minTime={now}\n timeSteps={{minutes: 15}}\n disableIgnoringDatePartForTimeValidation={true}\n skipDisabled={true}\n viewRenderers={{\n hours: renderDesktopDateTimeView,\n minutes: renderDesktopDateTimeView,\n seconds: renderDesktopDateTimeView,\n meridiem: renderDesktopDateTimeView,\n day: renderDesktopDateTimeView,\n month: renderDesktopDateTimeView,\n year: renderDesktopDateTimeView,\n }}\n slotProps={{\n textField: {\n inputProps: {'data-id': 'start-date-input'},\n placeholder: 'Select date',\n error: hasError,\n helperText,\n onBlur,\n },\n }}\n onChange={(newValue) => handleStartDateChange(newValue, onChange)}\n />\n );\n }}\n />\n </Box>\n\n <Box>\n <FormLabel sx={{display: 'block'}}>End date and time</FormLabel>\n\n <Controller\n name=\"end\"\n control={control}\n render={({field: {value: formValue, onChange, onBlur}, fieldState: {error}}) => {\n const disabled = !start;\n const hasError = !disabled && Boolean(error?.message);\n const helperText = hasError ? error?.message ?? ' ' : ' ';\n\n const instance = formValue > 0 ? dayjs.unix(formValue) : null;\n\n const minDate = start ? dayjs.unix(start) : undefined;\n\n return (\n <DesktopDateTimePicker\n value={instance}\n minDate={minDate}\n minTime={minDate}\n timeSteps={{minutes: 15}}\n disabled={disabled}\n disableIgnoringDatePartForTimeValidation={true}\n skipDisabled={true}\n viewRenderers={{\n hours: renderDesktopDateTimeView,\n minutes: renderDesktopDateTimeView,\n seconds: renderDesktopDateTimeView,\n meridiem: renderDesktopDateTimeView,\n day: renderDesktopDateTimeView,\n month: renderDesktopDateTimeView,\n year: renderDesktopDateTimeView,\n }}\n slotProps={{\n textField: {\n inputProps: {'data-id': 'end-date-input'},\n placeholder: 'Select date',\n error: hasError,\n helperText,\n onBlur,\n },\n }}\n onChange={(newValue) => handleEndDateChange(newValue, onChange)}\n />\n );\n }}\n />\n </Box>\n\n <Box flex={1}>\n <FormLabel sx={{display: 'block'}}>Timezone</FormLabel>\n\n <Controller\n name=\"timezone\"\n control={control}\n render={({field: {ref, value: formValue, onChange, onBlur}, fieldState: {error}}) => {\n return (\n <Stack direction=\"row\" gap={1} alignItems=\"start\">\n <Autocomplete\n ref={ref}\n fullWidth={true}\n value={zones.get(formValue) ?? null}\n options={timezones}\n renderInput={(params) => (\n <TextField\n {...params}\n inputProps={{...params.inputProps, 'data-id': 'timezone-select'}}\n error={!isNil(error)}\n helperText={error?.message ?? ' '}\n />\n )}\n onChange={(_e, value) => {\n onChange(value?.value ?? '');\n }}\n onBlur={onBlur}\n />\n\n <Tooltip title=\"Use current timezone\">\n <span>\n <IconButton\n data-id=\"default-tz-button\"\n disabled={userTimezone === formValue}\n sx={{height: 36}}\n onClick={resetTimezone}\n >\n <RestoreIcon />\n </IconButton>\n </span>\n </Tooltip>\n </Stack>\n );\n }}\n />\n </Box>\n </Stack>\n\n <Controller\n control={control}\n name=\"recurrent\"\n render={({field}) => (\n <FormControlLabel\n sx={{mb: 0, alignSelf: 'flex-start'}}\n label=\"Repeat event\"\n control={\n <Checkbox\n data-id=\"repeat-checkbox\"\n ref={field.ref}\n checked={field.value}\n onChange={(e) => field.onChange(e.target.checked)}\n onBlur={field.onBlur}\n />\n }\n />\n )}\n />\n\n <Collapse in={recurrent}>\n <Box border={`1px solid ${grey[400]}`} borderRadius={1} px={4} py={3}>\n <FormLabel>Repeat</FormLabel>\n <Controller\n control={control}\n name=\"recurrence.type\"\n render={({field}) => (\n <Select data-id=\"repeat-selector\" sx={{display: 'block', width: 200}} {...field}>\n {Object.keys(recurrenceType.enum).map((v) => (\n <MenuItem data-id={`repeat-option-${v}`} key={v} value={v}>\n {capitalize(v)}\n </MenuItem>\n ))}\n </Select>\n )}\n />\n\n <FormLabel sx={{mt: 2}}>End</FormLabel>\n <Controller\n control={control}\n name=\"recurrence.until.type\"\n render={({field}) => (\n <RadioGroup\n sx={{gap: 3, alignItems: 'start', '& label': {mb: 0, mr: 0}}}\n ref={field.ref}\n value={field.value}\n onBlur={field.onBlur}\n onChange={(e) => field.onChange(e.target.value)}\n row={true}\n >\n <FormControlLabel\n value=\"never\"\n control={<Radio data-id=\"never-end-radio\" />}\n label=\"Never\"\n />\n\n <Stack direction=\"row\" alignItems=\"start\" gap={1}>\n <FormControlLabel\n value=\"date\"\n control={<Radio data-id=\"until-date-radio\" />}\n label=\"On\"\n />\n <Controller\n control={control}\n name=\"recurrence.until.date\"\n render={({\n field: {value: formValue, onChange, onBlur},\n fieldState: {error},\n }) => {\n const instance = formValue ? dayjs.unix(formValue) : null;\n const disabled = recurrence?.until?.type !== 'date';\n\n const minDate = !isNil(end) && end > 0 ? dayjs.unix(end) : now;\n\n const hasError = !disabled && Boolean(error?.message);\n const helperText = hasError ? error?.message ?? ' ' : ' ';\n\n return (\n <DesktopDatePicker\n sx={{width: 150}}\n value={instance}\n disabled={disabled}\n minDate={minDate}\n slotProps={{\n textField: {\n id: 'until-date',\n inputProps: {'data-id': 'occurrences-input'},\n error: hasError,\n helperText,\n onBlur,\n },\n }}\n onChange={(newValue) => {\n if (newValue?.isValid()) {\n onChange(newValue.unix());\n } else {\n onChange(0);\n }\n }}\n />\n );\n }}\n />\n </Stack>\n\n <Stack direction=\"row\" alignItems=\"start\" gap={1}>\n <FormControlLabel\n value=\"occurrences\"\n control={<Radio data-id=\"occurrences-radio\" />}\n label=\"After\"\n />\n <Controller\n control={control}\n name=\"recurrence.until.occurrences\"\n render={({field, fieldState: {error}}) => {\n const disabled = recurrence?.until?.type !== 'occurrences';\n const hasError = !disabled && !isNil(error);\n const helperText = hasError ? error.message ?? ' ' : ' ';\n\n return (\n <TextField\n {...field}\n value={field.value >= 0 ? field.value : ''}\n sx={{width: 75}}\n inputProps={{'data-id': 'occurrences-input'}}\n disabled={disabled}\n error={hasError}\n helperText={helperText}\n onChange={(e) => {\n const input = e.target.value;\n const parsed = Number.parseInt(input, 10);\n\n if (input === '' || Number.isNaN(parsed)) {\n field.onChange(Number.MIN_SAFE_INTEGER);\n return;\n }\n\n if (/^[0-9]+$/.test(input)) {\n field.onChange(parsed);\n }\n }}\n />\n );\n }}\n />\n <Typography lineHeight=\"36px\" color={grey[500]}>\n occurrences\n </Typography>\n </Stack>\n </RadioGroup>\n )}\n />\n </Box>\n </Collapse>\n\n <Stack mt={1} direction=\"row\" justifyContent=\"space-between\" alignItems=\"center\">\n <Typography fontWeight={600} fontSize={16}>\n Devices and Channels\n </Typography>\n\n {configurable && (\n <Button\n data-id=\"add-device-button\"\n startIcon={<AddIcon />}\n variant=\"outlined\"\n color=\"primary\"\n disabled={devicesConf.size > 0}\n onClick={openDeviceMenu}\n >\n Add device\n </Button>\n )}\n\n <Popover\n open={isDevicePickerOpen}\n anchorEl={anchorEl}\n anchorOrigin={{vertical: 'bottom', horizontal: 'right'}}\n transformOrigin={{vertical: 'top', horizontal: 'right'}}\n onClose={closeDeviceMenu}\n >\n <DevicePicker\n sx={{width: 550}}\n checkIsSelected={checkIsSelected}\n devices={availableDevices}\n onSelect={handleAddDevice}\n />\n </Popover>\n </Stack>\n\n <Stack flexGrow={1} mt={2} gap={2}>\n {hasDevices &&\n Array.from(devicesConf.values()).map((s) => (\n <DeviceForm\n dataId={`device-${s.device.getId()}-form`}\n key={s.device.getId()}\n device={s.device}\n deviceState={s.state}\n destinations={destinations}\n removable={configurable}\n setChannelAction={handleChannelAction}\n selectChannelDestination={handleChannelDestination}\n onRemove={handleRemoveDevice}\n />\n ))}\n\n {!hasDevices && (\n <Stack\n sx={{\n p: 3,\n borderWidth: 1,\n bgcolor: grey[50],\n borderColor: grey[400],\n borderRadius: 1,\n borderStyle: 'dashed',\n }}\n >\n <Typography textAlign=\"center\" color={grey[500]}>\n Selected devices and channels will be shown here\n </Typography>\n </Stack>\n )}\n </Stack>\n </Box>\n\n <Stack\n py={1}\n borderTop={1}\n borderColor={grey[400]}\n bgcolor={grey[100]}\n direction=\"row\"\n justifyContent=\"center\"\n gap={2}\n >\n <Tooltip disableFocusListener title={invalidDevices.join('\\n')}>\n <span>\n <LoadingButton\n data-id=\"submit-button\"\n variant=\"contained\"\n color=\"secondary\"\n disabled={disabledConfirm}\n loading={loading}\n onClick={handleConfirm}\n >\n {mode === 'create' ? 'Create' : 'Save'}\n </LoadingButton>\n </span>\n </Tooltip>\n\n <Button data-id=\"close-form-button\" variant=\"outlined\" color=\"info\" onClick={onClose}>\n Cancel\n </Button>\n </Stack>\n </Stack>\n );\n}\n\nfunction getDevicesConf(\n map: Map<string, DeviceConfiguration>,\n): Map<string, Map<string, ChannelFields>> {\n const result = new Map<string, Map<string, ChannelFields>>();\n\n Array.from(map.entries()).forEach((d) => {\n const [deviceId, value] = d;\n\n const conf = new Map<string, ChannelFields>();\n\n Array.from(value.state.entries()).forEach((c) => {\n const [channelId, state] = c;\n conf.set(channelId, state);\n });\n\n result.set(deviceId, conf);\n });\n\n return result;\n}\n","import {useCallback} from 'react';\nimport {Schedule} from 'app/domain/schedule';\nimport {\n getCurrentPeriod,\n getNextPeriod,\n getPreviousPeriod,\n} from 'app/components/sharedReactComponents/Events/utils';\n\ntype Return = {\n goNext: () => void;\n goPrevious: () => void;\n goCurrent: () => void;\n};\n\nexport function usePeriodActions(\n setPeriod: React.Dispatch<React.SetStateAction<Schedule.Period>>,\n): Return {\n const goNext = useCallback(() => {\n setPeriod((prev) => getNextPeriod(prev));\n }, [setPeriod]);\n\n const goPrevious = useCallback(() => {\n setPeriod((prev) => getPreviousPeriod(prev));\n }, [setPeriod]);\n\n const goCurrent = useCallback(() => {\n setPeriod(getCurrentPeriod());\n }, [setPeriod]);\n\n return {goPrevious, goNext, goCurrent};\n}\n","import React, {useState} from 'react';\nimport {Button, ButtonGroup, Popover, buttonGroupClasses} from '@mui/material';\nimport KeyboardArrowLeftIcon from '@mui/icons-material/KeyboardArrowLeft';\nimport KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';\nimport EventRepeatIcon from '@mui/icons-material/EventRepeat';\nimport {\n DateCalendar,\n PickersDay,\n PickersDayProps,\n pickersMonthClasses,\n pickersYearClasses,\n} from '@mui/x-date-pickers';\nimport dayjs, {Dayjs} from 'dayjs';\nimport {StyleSx, Sx} from 'app/types/common';\nimport {Schedule} from 'app/domain/schedule';\nimport {getCurrentPeriod} from 'app/components/sharedReactComponents/Events/utils';\nimport {usePeriodActions} from 'app/components/sharedReactComponents/Events/hooks/useSchedulePeriod';\nimport {\n getFirstDayOfPeriod,\n getLastDayOfPeriod,\n} from 'app/components/sharedReactComponents/Events/Calendar/utils';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\n\ntype DayProps = PickersDayProps<Dayjs> & {\n isSelected?: boolean;\n isHovered?: boolean;\n};\n\nfunction Day({day, isSelected, isHovered, ...props}: DayProps) {\n return (\n <PickersDay\n sx={(theme) => ({\n px: 2.5,\n borderRadius: 0,\n ...(isSelected && {\n backgroundColor: theme.palette.primary.main,\n color: theme.palette.primary.contrastText,\n '&:hover, &:focus': {\n backgroundColor: theme.palette.primary.main,\n },\n }),\n ...(isHovered && {\n backgroundColor: theme.palette.primary[theme.palette.mode],\n '&:hover, &:focus': {\n backgroundColor: theme.palette.primary[theme.palette.mode],\n },\n }),\n ...(day.day() === 0 && {\n borderTopLeftRadius: '50%',\n borderBottomLeftRadius: '50%',\n }),\n ...(day.day() === 6 && {\n borderTopRightRadius: '50%',\n borderBottomRightRadius: '50%',\n }),\n })}\n day={day}\n {...props}\n selected={false}\n disableMargin={true}\n disableHighlightToday={true}\n />\n );\n}\n\nconst calendarSx: StyleSx = {\n [`& .${pickersYearClasses.yearButton}, & .${pickersMonthClasses.monthButton}`]: {\n display: 'block',\n },\n};\n\ntype PickerProps = Sx & {\n period: Schedule.Period;\n setPeriod: (period: Schedule.Period) => void;\n};\n\nconst PeriodPicker = React.memo<PickerProps>(({sx, period, setPeriod}) => {\n const [hoveredDay, setHoveredDay] = React.useState<Dayjs | null>(null);\n const [selectedDay, setSelectedDay] = useState<Dayjs | null>(() =>\n dayjs().year(period.year).week(period.week).startOf('week'),\n );\n\n const [anchorEl, setAnchorEl] = useState<HTMLButtonElement | null>(null);\n const pickerOpen = Boolean(anchorEl);\n\n const handleSelect = (day: Dayjs | null) => {\n setSelectedDay(day);\n\n if (!day) {\n return;\n }\n\n setPeriod({week: day.week(), year: day.weekYear()});\n };\n\n const firstDay = getFirstDayOfPeriod(period);\n const lastDay = getLastDayOfPeriod(period);\n\n const begin = firstDay.format('MMM D');\n const end = lastDay.format('MMM D');\n\n return (\n <>\n <Tooltip content=\"Select week\">\n <Button\n data-id=\"pick-week-btn\"\n sx={packSx({px: 1}, sx)}\n onClick={(e) => setAnchorEl(e.currentTarget)}\n >\n {begin} - {end}, {lastDay.format('YYYY')}\n </Button>\n </Tooltip>\n\n <Popover\n open={pickerOpen}\n anchorEl={anchorEl}\n anchorOrigin={{vertical: 'bottom', horizontal: 'left'}}\n onClose={() => {\n setAnchorEl(null);\n }}\n >\n <DateCalendar\n sx={calendarSx}\n showDaysOutsideCurrentMonth={true}\n value={selectedDay}\n views={['year', 'month', 'day']}\n minDate={dayjs().year(2022).startOf('year')}\n slots={{day: Day}}\n slotProps={{\n day: (props) => ({\n isSelected: props.day.isSame(selectedDay, 'week'),\n isHovered: props.day.isSame(hoveredDay, 'week'),\n onPointerEnter: () => setHoveredDay(props.day),\n onPointerLeave: () => setHoveredDay(null),\n }),\n }}\n onChange={(day, state) => {\n handleSelect(day);\n\n if (state === 'finish') {\n setAnchorEl(null);\n }\n }}\n />\n </Popover>\n </>\n );\n});\n\ntype Props = Sx & {\n period: Schedule.Period;\n disabled?: boolean;\n setPeriod: React.Dispatch<React.SetStateAction<Schedule.Period>>;\n};\n\nexport const PeriodSwitcher = React.memo<Props>(({sx, period, disabled, setPeriod}) => {\n const currentPeriod = getCurrentPeriod();\n const {goNext, goPrevious, goCurrent} = usePeriodActions(setPeriod);\n const isCurrent = currentPeriod.week === period.week && currentPeriod.year === period.year;\n\n return (\n <ButtonGroup sx={sx} variant=\"outlined\" color=\"primary\" disabled={disabled}>\n <Tooltip content=\"Previous week\">\n <Button data-id=\"previous-week-btn\" sx={{px: 1}}>\n <KeyboardArrowLeftIcon onClick={goPrevious} />\n </Button>\n </Tooltip>\n\n <PeriodPicker\n sx={{[`&.${buttonGroupClasses.grouped}`]: {minWidth: 150}}}\n period={period}\n setPeriod={setPeriod}\n />\n\n <Tooltip content=\"Next week\">\n <Button data-id=\"previous-next-btn\" sx={{px: 1}} onClick={goNext}>\n <KeyboardArrowRightIcon />\n </Button>\n </Tooltip>\n\n <Tooltip content=\"Return to current week\">\n <Button\n data-id=\"current-week-btn\"\n sx={{px: 1}}\n disabled={disabled || isCurrent}\n onClick={goCurrent}\n >\n <EventRepeatIcon />\n </Button>\n </Tooltip>\n </ButtonGroup>\n );\n});\n","import {front} from 'app/api/CirrusApi';\nimport {FilesContracts, Files} from 'app/components/entities/files/model';\nimport {apiClient} from 'app/components/shared';\n\nexport class FilesApi {\n static async getTeamRecordings(): Promise<{files: FilesContracts.Recording[]}> {\n return front.filemanager().v1().files().get();\n }\n\n static async getUnitRecordings(deviceId: string): Promise<{files: FilesContracts.Recording[]}> {\n return front.filemanager().v1().devices(deviceId).files().get();\n }\n\n static async batchDelete(ids: string[]): Promise<void> {\n return front.filemanager().v1().files().remove().post(ids);\n }\n\n static async deleteRecording(id: string): Promise<void> {\n return front.filemanager().v1().files(id).delete();\n }\n\n static getDownloadUrl(teamId: string, fileId: string): string {\n return `/front/api/v1t/team/${teamId}/filemanager/v1/files/${fileId}/download`;\n }\n\n static async shareFile(\n teamId: string,\n fileId: string,\n authorId: string,\n authorName: string,\n ): Promise<void> {\n return apiClient.post(`/front/api/v1t/team/${teamId}/filemanager/v1/files/${fileId}/share`, {\n shared_by_user_id: authorId,\n shared_by_user_name: authorName,\n });\n }\n\n static async revokeShare(teamId: string, fileId: string): Promise<void> {\n return apiClient.delete(`/front/api/v1t/team/${teamId}/filemanager/v1/files/${fileId}/share`);\n }\n\n static async batchRevoke(teamId: string, ids: string[]): Promise<void> {\n await apiClient.post(`/front/api/v1t/team/${teamId}/filemanager/v1/files/shares/delete`, ids);\n }\n\n static async getPublicFile(fileId: string): Promise<Files.PublicInfo> {\n return apiClient.get<Files.PublicInfo>(`front/api/v2/public/files/${fileId}/info`);\n }\n\n static getPublicLink(fileId: string): string {\n return `front/api/v2/public/files/${fileId}`;\n }\n}\n","import React, {useState} from 'react';\nimport {LoadingButton} from '@mui/lab';\nimport {\n Box,\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n Typography,\n} from '@mui/material';\nimport {useMounted} from 'app/hooks/useIsMounted';\nimport {Prompt} from 'app/types/common';\n\ntype Props = {\n loading: boolean;\n total: number;\n onDelete: () => Promise<void>;\n onCancel: () => void;\n};\n\nfunction DeleteRecordings({loading, total, onDelete, onCancel}: Props) {\n const title =\n total > 1 ? (\n <>\n these{' '}\n <Typography component=\"span\" variant=\"inherit\" color=\"primary.main\">\n {total}\n </Typography>{' '}\n files\n </>\n ) : (\n 'this file'\n );\n\n return (\n <Box>\n <DialogTitle>Are you sure you want to delete {title}?</DialogTitle>\n\n <DialogContent>\n <Typography textAlign=\"center\" color=\"text.secondary\">\n This action cannot be undone. Anyone with the link to this video will lose access after\n this action.\n </Typography>\n </DialogContent>\n\n <DialogActions>\n <LoadingButton\n data-id=\"confirm-delete-btn\"\n loading={loading}\n color=\"error\"\n variant=\"contained\"\n onClick={onDelete}\n >\n Yes, delete\n </LoadingButton>\n\n <Button data-id=\"cancel-delete-btn\" variant=\"outlined\" color=\"info\" onClick={onCancel}>\n Cancel\n </Button>\n </DialogActions>\n </Box>\n );\n}\n\ntype DialogProps = Prompt & Omit<Props, 'onCancel' | 'loading'>;\n\nexport function DeleteRecordingsDialog({open, total, onDelete, onClose}: DialogProps) {\n const mounted = useMounted();\n const [loading, setLoading] = useState(false);\n\n const handleDelete = async () => {\n try {\n setLoading(true);\n await onDelete();\n } finally {\n if (mounted()) {\n setLoading(false);\n }\n }\n };\n\n return (\n <Dialog open={open} maxWidth=\"sm\" onClose={onClose}>\n <DeleteRecordings\n loading={loading}\n total={total}\n onDelete={handleDelete}\n onCancel={onClose}\n />\n </Dialog>\n );\n}\n","import React, {useState} from 'react';\nimport {LoadingButton} from '@mui/lab';\nimport {Box, Button, Dialog, DialogActions, DialogTitle, Typography} from '@mui/material';\nimport {pluralizeN} from 'app/components/helpers/commonHelpers';\nimport {Prompt} from 'app/types/common';\nimport {useMounted} from 'app/hooks/useIsMounted';\nimport {NamesList} from 'app/components/sharedReactComponents/ItemsEnumeration';\n\ntype Props = {\n recordings: string[];\n loading: boolean;\n batching: boolean;\n onDownload: () => Promise<void>;\n onCancel: () => void;\n};\n\nfunction DownloadRecordings({recordings, batching, loading, onDownload, onCancel}: Props) {\n return (\n <Box>\n <DialogTitle>\n Download <NamesList variant=\"inherit\" color=\"primary.main\" names={recordings} max={3} />{' '}\n {pluralizeN('recording', recordings.length)}\n </DialogTitle>\n\n {batching && (\n <Typography mb={2} textAlign=\"center\" color=\"warning.main\">\n Do not close the tab until download is finished\n </Typography>\n )}\n\n <DialogActions>\n <LoadingButton\n data-id=\"confirm-delete-btn\"\n loading={loading}\n color=\"secondary\"\n variant=\"contained\"\n onClick={onDownload}\n >\n Download\n </LoadingButton>\n\n <Button data-id=\"cancel-delete-btn\" variant=\"outlined\" color=\"info\" onClick={onCancel}>\n Cancel\n </Button>\n </DialogActions>\n </Box>\n );\n}\n\ntype DialogProps = Prompt & Omit<Props, 'onCancel' | 'loading'>;\n\nexport function DownloadRecordingsDialog({\n open,\n recordings,\n batching,\n onDownload,\n onClose,\n}: DialogProps) {\n const mounted = useMounted();\n const [loading, setLoading] = useState(false);\n\n const handleDownload = async () => {\n try {\n setLoading(true);\n await onDownload();\n } finally {\n if (mounted()) {\n setLoading(false);\n }\n }\n };\n\n return (\n <Dialog open={open} maxWidth=\"sm\" onClose={onClose}>\n <DownloadRecordings\n loading={loading}\n recordings={recordings}\n batching={batching}\n onDownload={handleDownload}\n onCancel={onClose}\n />\n </Dialog>\n );\n}\n","import React, {useState} from 'react';\nimport {LoadingButton} from '@mui/lab';\nimport {Button, Dialog, DialogActions, DialogContent, DialogTitle, Typography} from '@mui/material';\nimport {Prompt} from 'app/types/common';\n\ninterface Props extends Prompt {\n total: number;\n onRevoke: () => Promise<void>;\n}\n\nexport function RevokeSharingDialog({open, total, onClose, onRevoke}: Props) {\n const [loading, setLoading] = useState(false);\n\n const handleRevoke = async () => {\n try {\n setLoading(true);\n await onRevoke();\n } finally {\n setLoading(false);\n }\n };\n\n return (\n <Dialog open={open} maxWidth=\"sm\" onClose={onClose}>\n <DialogTitle>\n Are you sure you want to stop sharing{' '}\n {total > 1 ? (\n <>\n these{' '}\n <Typography component=\"span\" variant=\"inherit\" color=\"primary.main\">\n {total}\n </Typography>{' '}\n files\n </>\n ) : (\n 'this file'\n )}\n ?\n </DialogTitle>\n\n <DialogContent>\n <Typography textAlign=\"center\" color=\"text.secondary\">\n This action cannot be undone. Anyone with the link to this video will lose access after\n this action.\n </Typography>\n </DialogContent>\n\n <DialogActions>\n <LoadingButton\n data-id=\"confirm-revoke-btn\"\n loading={loading}\n color=\"error\"\n variant=\"contained\"\n onClick={handleRevoke}\n >\n Stop sharing\n </LoadingButton>\n\n <Button data-id=\"cancel-revoke-btn\" variant=\"outlined\" color=\"info\" onClick={onClose}>\n Cancel\n </Button>\n </DialogActions>\n </Dialog>\n );\n}\n","import React, {useState} from 'react';\nimport dayjs, {Dayjs} from 'dayjs';\nimport {Button, Dialog, DialogActions, DialogTitle, Divider, Stack, alpha} from '@mui/material';\nimport {DateCalendar, pickersMonthClasses, pickersYearClasses} from '@mui/x-date-pickers';\nimport {Prompt, StyleSx, Sx} from 'app/types/common';\nimport {packSx} from 'app/util/packSx/packSx';\n\nconst calendarSx: StyleSx = {\n [`& .${pickersYearClasses.yearButton}, & .${pickersMonthClasses.monthButton}`]: {\n display: 'block',\n },\n};\nconst daysSx: StyleSx = (t) => ({bgcolor: alpha(t.palette.primary.main, 0.15)});\nconst actionSx: StyleSx = {minWidth: 80};\n\ninterface PickerProps extends Sx {\n defaultStart?: number;\n defaultEnd?: number;\n onSelect: (period: [number, number]) => void;\n onCancel: () => void;\n}\n\nfunction DatesPicker({defaultStart, defaultEnd, onSelect, onCancel}: PickerProps) {\n const [start, setStart] = useState<Dayjs | null>(defaultStart ? dayjs.unix(defaultStart) : null);\n const [end, setEnd] = useState<Dayjs | null>(defaultEnd ? dayjs.unix(defaultEnd) : null);\n\n const handleSave = () => {\n if (start && end) {\n onSelect([start.unix(), end.endOf('day').unix()]);\n }\n };\n\n const bothSet = start && end;\n\n return (\n <>\n <DialogTitle>Select dates range</DialogTitle>\n\n <Stack direction=\"row\" divider={<Divider orientation=\"vertical\" flexItem={true} />}>\n <DateCalendar\n data-id=\"start-calendar\"\n sx={calendarSx}\n value={start}\n maxDate={end}\n views={['year', 'month', 'day']}\n slotProps={{\n day: (state) => ({\n sx: packSx(bothSet && state.day && inRange(state.day, start, end) && daysSx),\n }),\n }}\n onChange={(value) => setStart(value)}\n />\n\n <DateCalendar\n data-id=\"end-calendar\"\n sx={calendarSx}\n views={['year', 'month', 'day']}\n value={end}\n minDate={start}\n slotProps={{\n day: (state) => ({\n sx: packSx(bothSet && state.day && inRange(state.day, start, end) && daysSx),\n }),\n }}\n onChange={(value) => setEnd(value)}\n />\n </Stack>\n\n <DialogActions>\n <Button\n data-id=\"apply-button\"\n sx={actionSx}\n disabled={!bothSet}\n variant=\"outlined\"\n color=\"primary\"\n onClick={handleSave}\n >\n Apply\n </Button>\n <Button\n data-id=\"cancel-button\"\n sx={actionSx}\n variant=\"outlined\"\n color=\"info\"\n onClick={onCancel}\n >\n Cancel\n </Button>\n </DialogActions>\n </>\n );\n}\n\nfunction inRange(value: Dayjs, start: Dayjs, end: Dayjs) {\n return value.isAfter(start) && value.isBefore(end);\n}\n\ninterface Props extends Prompt {\n period?: [number, number];\n onSelect: (period: [number, number]) => void;\n}\n\nexport function DatesPickerDialog({open, period, onSelect, onClose}: Props) {\n return (\n <Dialog open={open} maxWidth=\"md\" onClose={onClose}>\n <DatesPicker\n defaultStart={period?.[0]}\n defaultEnd={period?.[1]}\n onSelect={onSelect}\n onCancel={onClose}\n />\n </Dialog>\n );\n}\n","import React, {useEffect, useRef, useState} from 'react';\nimport {z} from 'zod';\nimport {zodResolver} from '@hookform/resolvers/zod';\nimport {Controller, useForm} from 'react-hook-form';\nimport {Box, ButtonBase, TextField, Typography} from '@mui/material';\nimport EditIcon from '@mui/icons-material/Edit';\nimport WarningIcon from '@mui/icons-material/Warning';\nimport {DataId, Sx} from 'app/types/common';\nimport {OverflowTooltip} from 'app/components/sharedReactComponents/OverflowTooltip/OverflowTooltip';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {isNil} from 'app/util/isNil';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\n\nconst scheme = z.object({\n name: z.string().trim().min(1, {message: 'Name is required'}),\n});\n\ntype Form = z.infer<typeof scheme>;\n\ntype EditableProps = Sx &\n DataId & {\n name: string;\n onSave: (name: string) => void;\n };\n\n// TODO: to shared components\nexport function EditableName({sx, name, onSave}: EditableProps) {\n const [edit, setEdit] = useState(false);\n\n const [hovered, setHovered] = useState(false);\n\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n const {control, reset, handleSubmit} = useForm<Form>({\n defaultValues: {name},\n resolver: zodResolver(scheme),\n mode: 'onChange',\n });\n\n const handleCancel = () => {\n reset();\n setEdit(false);\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (e.key === 'Escape') {\n handleCancel();\n }\n };\n\n const handleSave = ({name}: Form) => {\n onSave(name);\n handleCancel();\n };\n\n const startEdit = () => {\n setEdit(true);\n };\n\n useEffect(() => {\n if (edit) {\n inputRef.current?.focus();\n }\n }, [edit]);\n\n if (edit) {\n return (\n <Box sx={sx} component=\"form\" onSubmit={handleSubmit(handleSave)}>\n <Controller\n control={control}\n name=\"name\"\n render={({field: {onBlur, ...rest}, fieldState: {error}}) => {\n const hasError = !isNil(error);\n\n return (\n <TextField\n {...rest}\n inputRef={inputRef}\n fullWidth={true}\n error={hasError}\n InputProps={{\n endAdornment: hasError ? (\n <Tooltip content={error.message}>\n <WarningIcon color=\"error\" fontSize=\"small\" />\n </Tooltip>\n ) : null,\n }}\n inputProps={{'data-id': 'name-input'}}\n onKeyDown={handleKeyDown}\n onBlur={() => {\n onBlur();\n handleCancel();\n }}\n />\n );\n }}\n />\n </Box>\n );\n }\n\n return (\n <ButtonBase\n sx={packSx({display: 'flex', alignItems: 'center', gap: 0.5, minWidth: 0}, sx)}\n onMouseEnter={() => setHovered(true)}\n onMouseLeave={() => setHovered(false)}\n onClick={startEdit}\n >\n <Typography component=\"span\" flex={1} minWidth={0}>\n <OverflowTooltip rowsNumber={1} dataId=\"recording-name\">\n {name}\n </OverflowTooltip>\n </Typography>\n\n <EditIcon\n data-id=\"edit-btn\"\n sx={{visibility: hovered ? 'visible' : 'hidden'}}\n fontSize=\"small\"\n />\n </ButtonBase>\n );\n}\n\ntype ReadonlyProps = Sx & {\n name: string;\n};\n\nfunction ReadonlyName({sx, name}: ReadonlyProps) {\n return (\n <Typography sx={sx} component=\"span\">\n <OverflowTooltip rowsNumber={1} dataId=\"recording-name\">\n {name}\n </OverflowTooltip>\n </Typography>\n );\n}\n\ntype Props = EditableProps & {\n editable: boolean;\n};\n\nexport function RecordingName({sx, name, editable, onSave}: Props) {\n if (editable) {\n return <EditableName sx={sx} name={name} onSave={onSave} />;\n }\n\n return <ReadonlyName sx={sx} name={name} />;\n}\n","import React from 'react';\nimport dayjs from 'dayjs';\nimport {filesize} from 'filesize';\nimport {Box, Checkbox, Grid, Stack} from '@mui/material';\nimport {grey} from '@mui/material/colors';\nimport {DataId, StyleSx, Sx} from 'app/types/common';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {Files} from 'app/components/entities/files';\nimport {RecordingName} from 'app/components/features/files/ui/RecordingName/RecordingName';\nimport {RecordingDevice} from 'app/components/features/files/ui/RecordingDevice';\nimport {formatPlayback} from 'app/util/time';\nimport {ShareFile, FileMenu} from 'app/components/features/files';\n\nconst rootSx: StyleSx = {\n py: 0.5,\n display: 'flex',\n borderBottom: 1,\n minHeight: 48,\n borderColor: (t) => t.palette.divider,\n '&:hover': {bgcolor: grey[50]},\n};\n\nconst selectedSx: StyleSx = {bgcolor: grey[100]};\nconst uploadingSx: StyleSx = {opacity: 0.7};\n\ntype Props = Sx &\n DataId & {\n selected: boolean;\n recording: Files.Recording;\n device?: AnyDeviceModelType;\n showUnit?: boolean;\n loadingDevice?: boolean;\n onSelect: () => void;\n onDelete: () => Promise<void>;\n onDownload: () => Promise<void>;\n onShare: () => Promise<void>;\n onRevokeSharing: () => Promise<void>;\n };\n\nexport function RecordingCard({\n dataId,\n sx,\n selected,\n recording,\n showUnit,\n device,\n loadingDevice,\n onSelect,\n onDelete,\n onDownload,\n onShare,\n onRevokeSharing,\n}: Props) {\n const {uploaded} = recording;\n\n return (\n <Box data-id={dataId} sx={packSx(rootSx, selected && selectedSx, !uploaded && uploadingSx, sx)}>\n <Grid container={true} columns={24} columnGap={1} alignItems=\"center\">\n <Grid width={40} item={true}>\n <Checkbox\n data-id=\"recording-checkbox\"\n checked={selected}\n disabled={!uploaded}\n onChange={() => onSelect()}\n />\n </Grid>\n\n <Grid xs={true} item={true} minWidth={0}>\n <RecordingName\n sx={{maxWidth: '100%'}}\n name={recording.name}\n editable={false}\n onSave={() => {}}\n />\n </Grid>\n\n <Grid width={100} item={true} data-id=\"recording-size\">\n {filesize(recording.size)}\n </Grid>\n\n <Grid width={100} item={true} data-id=\"recording-time\">\n {formatPlayback(recording.duration)}\n </Grid>\n\n <Grid width={100} item={true} data-id=\"recording-date\">\n {formateDate(recording.startAt)}\n </Grid>\n\n {showUnit && (\n <Grid width={100} item={true}>\n <RecordingDevice\n dataId=\"recording-device-link\"\n deviceId={device?.getId()}\n name={device?.getName()}\n loading={loadingDevice}\n />\n </Grid>\n )}\n\n <Grid width={140} item={true}>\n <Stack direction=\"row\" justifyContent=\"space-between\">\n <ShareFile\n filename={recording.name}\n share={recording.share}\n link={recording.publicUrl}\n onShare={onShare}\n />\n\n <FileMenu\n dataId=\"recording-actions\"\n file={recording}\n onDownload={onDownload}\n onDelete={onDelete}\n onRevokeSharing={onRevokeSharing}\n />\n </Stack>\n </Grid>\n </Grid>\n </Box>\n );\n}\n\nfunction formateDate(datetime: number): string {\n return dayjs.unix(datetime).format('MMM D, YYYY');\n}\n","import React, {useMemo} from 'react';\nimport {filesize} from 'filesize';\nimport {Typography} from '@mui/material';\nimport {DataId, Sx} from 'app/types/common';\nimport {Files} from 'app/components/entities/files';\nimport {pluralizeN} from 'app/components/helpers/commonHelpers';\n\ninterface Props extends Sx, DataId {\n recordings: Files.Recording[];\n}\n\nexport function TotalAndSize({dataId, sx, recordings}: Props) {\n const size = useMemo(() => recordings.reduce((acc, file) => acc + file.size, 0), [recordings]);\n\n return (\n <Typography data-id={dataId} sx={sx}>\n {recordings.length} {pluralizeN('file', recordings.length)} | {filesize(size)}\n </Typography>\n );\n}\n","import React, {forwardRef, useMemo, useState} from 'react';\nimport {Button, Card, IconButton, ThemeProvider} from '@mui/material';\nimport ClearIcon from '@mui/icons-material/Clear';\nimport DeleteIcon from '@mui/icons-material/Delete';\nimport CloudDownloadIcon from '@mui/icons-material/CloudDownload';\nimport CancelIcon from '@mui/icons-material/Cancel';\nimport {StyleSx, Sx} from 'app/types/common';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {\n Files,\n FilesApi,\n DeleteRecordingsDialog,\n DownloadRecordingsDialog,\n RevokeSharingDialog,\n} from 'app/components/entities/files';\nimport {darkTheme} from 'app/themes/app';\nimport {Notifications} from 'app/components/Notifications';\nimport {TotalAndSize} from '../TotalAndSize/TotalAndSize';\n\nconst rootStyles: StyleSx = {\n p: 2,\n position: 'fixed',\n left: 0,\n right: 0,\n bottom: 0,\n height: 64,\n zIndex: 1,\n display: 'flex',\n alignItems: 'center',\n gap: 2,\n};\n\ninterface Props extends Sx {\n teamId: string;\n recordings: Files.Recording[];\n onClose: () => void;\n}\n\nexport const BatchRecordings = forwardRef<HTMLDivElement, Props>(\n ({sx, teamId, recordings, onClose}, ref) => {\n const [deleteDialog, setDeleteDialog] = useState(false);\n const [downloadDialog, setDownloadDialog] = useState(false);\n const [revokeDialog, setRevokeDialog] = useState(false);\n\n const {shared, uploaded} = useMemo(\n () => ({\n shared: recordings.filter((r) => r.share),\n uploaded: recordings.filter((r) => r.uploaded),\n }),\n [recordings],\n );\n\n const handleDelete = async () => {\n try {\n await FilesApi.batchDelete(recordings.map((r) => r.id));\n setDeleteDialog(false);\n } catch {\n Notifications.addErrorNotification('Failed to delete recording(s)');\n }\n };\n\n const handleRevoke = async () => {\n try {\n await FilesApi.batchRevoke(\n teamId,\n shared.map((r) => r.id),\n );\n setRevokeDialog(false);\n } catch {\n Notifications.addErrorNotification('Failed to delete recording(s)');\n }\n };\n\n const handleDownload = async () => {\n // need backend implementation\n };\n\n return (\n <>\n <DeleteRecordingsDialog\n open={deleteDialog}\n onDelete={handleDelete}\n total={recordings.length}\n onClose={() => setDeleteDialog(false)}\n />\n\n <DownloadRecordingsDialog\n open={downloadDialog}\n recordings={uploaded.map((r) => r.name)}\n batching={true}\n onDownload={handleDownload}\n onClose={() => setDownloadDialog(false)}\n />\n\n <RevokeSharingDialog\n open={revokeDialog}\n total={shared.length}\n onRevoke={handleRevoke}\n onClose={() => setRevokeDialog(false)}\n />\n\n <ThemeProvider theme={darkTheme}>\n <Card\n data-id=\"recordings-batch\"\n ref={ref}\n sx={packSx(rootStyles, sx)}\n variant=\"elevation\"\n elevation={8}\n >\n <TotalAndSize sx={{mr: 'auto'}} dataId=\"batch-summary\" recordings={recordings} />\n\n {shared.length > 0 && (\n <Button\n data-id=\"revoke-sharing-btn\"\n variant=\"outlined\"\n color=\"info\"\n startIcon={<CancelIcon />}\n onClick={() => setRevokeDialog(true)}\n >\n Stop sharing\n </Button>\n )}\n\n <Button\n data-id=\"delete-btn\"\n variant=\"outlined\"\n color=\"info\"\n startIcon={<DeleteIcon />}\n onClick={() => setDeleteDialog(true)}\n >\n Delete\n </Button>\n\n <Button\n data-id=\"download-btn\"\n sx={{display: 'none'}}\n variant=\"contained\"\n color=\"primary\"\n startIcon={<CloudDownloadIcon />}\n onClick={() => setDownloadDialog(true)}\n >\n Download\n </Button>\n\n <IconButton data-id=\"close-batch-btn\" onClick={onClose}>\n <ClearIcon />\n </IconButton>\n </Card>\n </ThemeProvider>\n </>\n );\n },\n);\n","import React from 'react';\nimport {Stack, Typography} from '@mui/material';\nimport {Sx} from 'app/types/common';\nimport {EdgeAfuSwitcher, useUnitFiles} from 'app/components/features/files';\nimport {useUnitAfu} from 'app/components/entities/afu';\nimport {FilesLibrary} from 'app/components/widgets/files';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\n\nconst devices = new Map<string, AnyDeviceModelType>();\n\ntype Props = Sx & {\n teamId: string;\n userId: string;\n userName: string;\n deviceId: string;\n online: boolean;\n};\n\nexport function UnitFiles({teamId, userId, userName, sx, deviceId, online}: Props) {\n const {data: recordings, isSuccess} = useUnitFiles({enabled: true, deviceId, teamId});\n const {data: afu} = useUnitAfu({deviceId, enabled: online, refetchInterval: 1000 * 60});\n\n return (\n <Stack sx={sx}>\n <Typography mb={1} fontWeight={600} variant=\"h5\">\n Recordings\n </Typography>\n\n {afu && <EdgeAfuSwitcher sx={{mb: 1}} deviceId={deviceId} afu={afu} />}\n\n {isSuccess ? (\n <FilesLibrary\n teamId={teamId}\n recordings={recordings}\n devices={devices}\n userId={userId}\n userName={userName}\n displayDevice={false}\n />\n ) : (\n <Typography mt={5} textAlign=\"center\" variant=\"h6\" color=\"text.secondary\">\n Loading device recordings\n </Typography>\n )}\n </Stack>\n );\n}\n","import {createContext} from 'react';\nimport {Main} from 'app/components/entities/app/model';\n\nexport const FeaturesContext = createContext<Set<Main.Feature>>(new Set());\n","import React, {Fragment, useCallback, useEffect, useState} from 'react';\nimport {FormControl} from 'app/components/sharedReactComponents/FormControl';\nimport {FORM_CONTROL_AUTOCOMPLETE} from 'app/constants/formControlAutocomplete';\nimport {Icons} from 'app/util/icons';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\nimport {SIZE, THEME, VARIANT} from 'app/constants';\nimport {DeviceGroupSelector} from 'app/components/PairDevice/PairDeviceForm/DeviceGroupSelector';\nimport {PairDeviceSubmitButton} from 'app/components/PairDevice/PairDeviceForm/PairDeviceSubmitButton';\nimport {Button} from 'app/components/sharedReactComponents/Button';\nimport {Callback, Validation} from 'app/types/common';\nimport {EmptyStringValidator} from 'app/util/validators/EmptyStringValidator';\nimport {NameValidator} from 'app/util/validators/NameValidator';\n\nconst DEVICE_ID_HELP_MESSAGE =\n \"Your device's pairing code shows on the \" +\n \"front screen of device when it's not \" +\n \"already paired. For Pearl, it's found on the \" +\n 'Epiphan Cloud status page in the Admin panel.';\n\nexport type PairingFormData = {\n name: string;\n groupId: string;\n code: string;\n};\n\nconst getDefaultForm = (): PairingFormData => {\n return {\n name: '',\n groupId: '',\n code: '',\n };\n};\n\ninterface Props {\n currentTeamId: string;\n hasGroups: boolean;\n showCancelButton: boolean;\n onSubmit: Callback<Promise<unknown>, [PairingFormData]>;\n onCancel: Callback;\n}\n\nconst formValidators = {\n code: [new EmptyStringValidator({message: 'Enter device pairing code'})],\n name: [new EmptyStringValidator({message: 'Enter device name'}), new NameValidator()],\n};\n\nexport function PairDeviceForm({\n currentTeamId,\n hasGroups,\n showCancelButton,\n onSubmit,\n onCancel,\n}: Props) {\n const [formData, setFormData] = useState<PairingFormData>(() => getDefaultForm());\n const [loading, setLoading] = useState(false);\n const [validation, setValidation] = useState<Validation>({\n valid: false,\n errorMessage: '',\n });\n\n const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {\n e.preventDefault();\n setLoading(true);\n\n try {\n await onSubmit(formData);\n } finally {\n setLoading(false);\n }\n };\n\n useEffect(() => {\n for (const [field, validators] of Object.entries(formValidators)) {\n for (const validator of validators) {\n if (!validator.validate(formData[field])) {\n setValidation({\n valid: false,\n errorMessage: validator.getErrorMessage(),\n });\n return;\n }\n }\n }\n\n setValidation({\n valid: true,\n errorMessage: '',\n });\n }, [formData]);\n\n const handleChange = useCallback(({target: {name, value}}) => {\n setFormData((formData) => ({\n ...formData,\n [name]: value,\n }));\n }, []);\n\n return (\n <form className=\"pair-device-form\" action=\"\" onSubmit={handleSubmit}>\n <div className=\"pair-device-form__form-controls\">\n <FormControl\n data-id=\"device_pairing_code_input\"\n className=\"pair-device-form__form-control\"\n value={formData.code}\n name=\"code\"\n label={\n <Fragment>\n Pairing code\n <Tooltip content={DEVICE_ID_HELP_MESSAGE}>\n {Icons.helpCircle().size(SIZE.S).reactComponent()}\n </Tooltip>\n </Fragment>\n }\n placeholder=\"12345678\"\n autoComplete={FORM_CONTROL_AUTOCOMPLETE.OFF}\n autoFocus={true}\n fullWidth={true}\n disabled={loading}\n onChange={handleChange}\n />\n\n <FormControl\n data-id=\"device_name_input\"\n className=\"pair-device-form__form-control\"\n value={formData.name}\n name=\"name\"\n label=\"Device name\"\n placeholder=\"Name your device\"\n autoComplete={FORM_CONTROL_AUTOCOMPLETE.OFF}\n disabled={loading}\n fullWidth={true}\n onChange={handleChange}\n />\n\n {hasGroups && (\n <DeviceGroupSelector\n name=\"groupId\"\n className=\"pair-device-form__form-control\"\n value={formData.groupId || undefined}\n teamId={currentTeamId}\n disabled={loading}\n onChange={handleChange}\n />\n )}\n </div>\n\n <div className=\"pair-device-form__form-actions\">\n <PairDeviceSubmitButton\n className=\"pair-device-form__form-button\"\n loading={loading}\n disabled={!validation.valid}\n tooltip={validation.errorMessage}\n />\n\n {showCancelButton && (\n <Button\n dataId=\"cancel_pair_device_button\"\n className=\"pair-device-form__form-button\"\n variant={VARIANT.OUTLINE}\n theme={THEME.SECONDARY}\n size={SIZE.L}\n onClick={onCancel}\n >\n Cancel\n </Button>\n )}\n </div>\n </form>\n );\n}\n","export enum STORAGE_PROP_NAME {\n FTP = 'FTP',\n SFTP = 'SFTP',\n OAUTH2 = 'OAuth2',\n}\n\nexport enum STORAGE_TYPE {\n FTP = 'ftp',\n SFTP = 'sftp',\n GOOGLE_DRIVE = 'google',\n BOX = 'box',\n DROPBOX = 'dropbox',\n}\n\nexport const STORAGE_PROP_NAME_BY_TYPE = {\n [STORAGE_TYPE.FTP]: STORAGE_PROP_NAME.FTP,\n [STORAGE_TYPE.SFTP]: STORAGE_PROP_NAME.SFTP,\n [STORAGE_TYPE.GOOGLE_DRIVE]: STORAGE_PROP_NAME.OAUTH2,\n [STORAGE_TYPE.BOX]: STORAGE_PROP_NAME.OAUTH2,\n [STORAGE_TYPE.DROPBOX]: STORAGE_PROP_NAME.OAUTH2,\n};\n","import {BaseFTPLocationModel} from 'app/components/UploadLocations/Models/BaseFTPLocationModel';\nimport {\n computed,\n makeObservable,\n IReactionDisposer,\n} from 'mobx';\nimport {lensPath} from 'ramda';\nimport {ValidatedInputModel} from 'app/components/UploadLocations/Models/ValidatedInputModel';\nimport {makeSaveLocationApiReaction} from 'app/components/UploadLocations/Models/utils';\n\nimport {\n STORAGE_PROP_NAME,\n STORAGE_TYPE,\n} from 'app/components/UploadLocations/constants';\n\nconst passwordPathLens = lensPath([STORAGE_PROP_NAME.FTP, 'Password']);\n\nclass FTPLocationModel extends BaseFTPLocationModel {\n type: STORAGE_TYPE;\n useTls: ValidatedInputModel;\n stopAutoSave: IReactionDisposer;\n\n constructor(json, saveLocationApi) {\n json.Path = json.Path || '/';\n json.Port = json.Port || 21;\n\n super(json);\n\n this.type = STORAGE_TYPE.FTP;\n\n const {InSecureTLS = false} = json;\n this.useTls = new ValidatedInputModel('Use TLS', InSecureTLS);\n\n this.stopAutoSave = makeSaveLocationApiReaction(\n () => this.json,\n this.id,\n passwordPathLens,\n saveLocationApi,\n );\n\n makeObservable(this, {\n options: computed,\n json: computed,\n });\n }\n\n get options() {\n return {\n Server: this.address.value,\n Username: this.username.value,\n Password: this.password.value,\n Path: this.path.value,\n Port: this.port.value,\n InSecureTLS: this.useTls.value\n };\n }\n\n get json() {\n return {\n [STORAGE_PROP_NAME.FTP]: this.options,\n StorageID: this.id,\n Name: this.name.value,\n Type: this.type\n };\n }\n}\n\nexport {FTPLocationModel};\n","import {BaseFTPLocationModel} from 'app/components/UploadLocations/Models/BaseFTPLocationModel';\nimport {\n computed,\n makeObservable,\n IReactionDisposer,\n} from 'mobx';\nimport {lensPath} from 'ramda';\nimport {makeSaveLocationApiReaction} from 'app/components/UploadLocations/Models/utils';\nimport {ValidatedInputModel} from 'app/components/UploadLocations/Models/ValidatedInputModel';\n\nimport {\n STORAGE_PROP_NAME,\n STORAGE_TYPE,\n} from 'app/components/UploadLocations/constants';\n\nconst passwordPathLens = lensPath([STORAGE_PROP_NAME.SFTP, 'Password']);\n\nclass SFTPLocationModel extends BaseFTPLocationModel {\n type: STORAGE_TYPE;\n privateKey: ValidatedInputModel;\n stopAutoSave: IReactionDisposer;\n\n constructor(json, saveLocationApi) {\n json.Path = json.Path || '';\n json.Port = json.Port || 22;\n\n super(json);\n\n this.type = STORAGE_TYPE.SFTP;\n\n const {PrivateKey = ''} = json;\n this.privateKey = new ValidatedInputModel('Private Key', PrivateKey);\n\n this.stopAutoSave = makeSaveLocationApiReaction(\n () => this.json,\n this.id,\n passwordPathLens,\n saveLocationApi,\n );\n\n makeObservable(this, {\n options: computed,\n json: computed\n });\n }\n\n get options() {\n return {\n Server: this.address.value,\n Username: this.username.value,\n Password: this.password.value,\n Path: this.path.value,\n Port: this.port.value,\n PrivateKey: this.privateKey.value,\n };\n }\n\n get json() {\n return {\n [STORAGE_PROP_NAME.SFTP]: this.options,\n StorageID: this.id,\n Name: this.name.value,\n Type: this.type\n };\n }\n}\n\nexport {SFTPLocationModel};\n","import React from 'react';\nimport {alpha, Divider, Stack, SxProps, Typography} from '@mui/material';\nimport {Component, Sx} from 'app/types/common';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {backgrounds, palette} from 'app/themes/app';\n\ninterface Props extends Sx, Component {\n disabled?: boolean;\n title: string;\n body: React.ReactNode;\n action?: React.ReactNode;\n footer?: React.ReactNode;\n}\n\nconst rootSx: SxProps = {\n pl: 4,\n pr: 4.5,\n pt: 3,\n pb: 2,\n width: 480,\n height: 290,\n bgcolor: alpha(backgrounds.lightGray, 0.5),\n borderWidth: 1,\n borderStyle: 'solid',\n borderColor: palette.grayMedium,\n borderRadius: 1.5,\n};\n\nexport function ProductCard({sx, title, action, disabled, dataId, body, footer}: Props) {\n return (\n <Stack\n sx={packSx(\n rootSx,\n disabled\n ? {\n borderStyle: 'dashed',\n bgcolor: palette.white,\n }\n : {},\n sx,\n )}\n gap={2}\n data-id={dataId}\n divider={<Divider flexItem />}\n >\n <Stack sx={{flexGrow: 1}} component=\"section\" gap={3}>\n <Stack direction=\"row\" gap={2} alignItems=\"center\" justifyContent=\"space-between\">\n <Typography\n variant=\"h5\"\n fontWeight={600}\n color={disabled ? palette.gray7 : palette.black}\n >\n {title}\n </Typography>\n {action}\n </Stack>\n\n {body}\n </Stack>\n <Stack sx={{height: 58}} component=\"section\" justifyContent=\"center\">\n {footer}\n </Stack>\n </Stack>\n );\n}\n","import React from 'react';\nimport {Box, Card, Divider, Stack, Typography} from '@mui/material';\nimport {grey} from '@mui/material/colors';\nimport {Component, StyleSx, Sx} from 'app/types/common';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {formatAbbreviatedDateWithYear} from 'app/util/time';\nimport {palette} from 'app/themes/app';\nimport {formatPrice} from 'app/components/shared';\nimport {Billing} from 'app/domain/billing';\n\nconst rootSx: StyleSx = {p: 5, bgcolor: grey[50]};\n\nexport interface Row {\n name: string;\n total: number;\n description: React.ReactNode;\n}\n\ninterface Props extends Sx, Component {\n issueDate: TimeStampSeconds;\n period: Billing.TimePeriod;\n rows: Row[];\n total: number;\n}\n\nexport function InvoiceCard({sx, dataId, issueDate, period, rows, total}: Props) {\n return (\n <Card data-id={dataId} sx={packSx(rootSx, sx)} variant=\"outlined\">\n <Box mb={2}>\n <Stack direction=\"row\" justifyContent=\"space-between\" alignItems=\"center\" mb={1}>\n <Typography variant=\"h5\" fontWeight={600}>\n Upcoming invoice\n </Typography>\n\n <Typography data-id=\"invoice-period\" color={palette.darkerGray}>\n {formatAbbreviatedDateWithYear(period.begin)} -{' '}\n {formatAbbreviatedDateWithYear(period.end)}\n </Typography>\n </Stack>\n <Typography data-id=\"invoice-date\" color={palette.blue}>\n Will be issued on: {formatAbbreviatedDateWithYear(issueDate)}\n </Typography>\n </Box>\n\n <Stack gap={2} mb={2} divider={<Divider flexItem={true} />}>\n {rows.map((r, i) => {\n return (\n <Box key={r.name} data-id={`invoice-row-${i}`}>\n <Stack direction=\"row\" alignItems=\"center\" justifyContent=\"space-between\" mb={0.5}>\n <Typography data-id=\"invoice-row-name\" fontSize={16}>\n {r.name}\n </Typography>\n <Typography data-id=\"invoice-row-total\" fontSize={16} fontWeight={600}>\n ${formatPrice(r.total)}\n </Typography>\n </Stack>\n\n <Typography data-id=\"invoice-row-description\">{r.description}</Typography>\n </Box>\n );\n })}\n </Stack>\n\n <Typography\n data-id=\"invoice-total\"\n fontSize={16}\n fontWeight={600}\n color={palette.blue}\n textAlign=\"right\"\n >\n Total period amount: ${formatPrice(total)}\n </Typography>\n </Card>\n );\n}\n","import React from 'react';\nimport {TableCell, tableCellClasses, TableCellProps} from '@mui/material';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {StyleSx} from 'app/types/common';\n\nconst rootSx: StyleSx = {\n [`&.${tableCellClasses.head}`]: {py: 1.5, px: 1, fontSize: 14, fontWeight: 'bold'},\n [`&.${tableCellClasses.body}`]: {py: 1.5, px: 1, fontSize: 14},\n};\n\nexport function InvoiceCell({sx, ...rest}: TableCellProps) {\n return <TableCell sx={packSx(rootSx, sx)} {...rest} />;\n}\n","import React from 'react';\nimport dayjs from 'dayjs';\nimport {Box, Card, Divider, Stack, Typography} from '@mui/material';\nimport {grey} from '@mui/material/colors';\nimport {StyleSx, Sx} from 'app/types/common';\nimport {FilesBilling} from 'app/components/entities/billing/files';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {formatPrice} from 'app/components/shared';\n\nconst rootSx: StyleSx = {p: 5, bgcolor: grey[50]};\n\ninterface Props extends Sx {\n invoice: FilesBilling.Invoice;\n}\n\nexport function FilesInvoice({sx, invoice}: Props) {\n return (\n <Card data-id=\"files-invoice\" sx={packSx(rootSx, sx)} variant=\"outlined\">\n <Stack mb={1} direction=\"row\" alignItems=\"center\" justifyContent=\"space-between\">\n <Typography variant=\"h5\" fontWeight={600}>\n Upcoming invoice\n </Typography>\n\n <Typography data-id=\"invoice-period\" color=\"text.secondary\">\n {dayjs.unix(invoice.periodStart).format('ll')} -{' '}\n {dayjs.unix(invoice.periodEnd).format('ll')}\n </Typography>\n </Stack>\n\n <Typography data-id=\"invoice-date\" mb={2} color=\"primary.main\">\n Will be issued on: {dayjs.unix(invoice.date).format('LL')}\n </Typography>\n\n <Stack mb={1} gap={2} divider={<Divider flexItem orientation=\"horizontal\" />}>\n <Stack direction=\"row\" justifyContent=\"space-between\">\n <Box>\n <Typography fontSize={16}>Storage fee</Typography>\n\n <Typography>\n <b>{invoice.storageSize.toLocaleString(undefined, {maximumFractionDigits: 2})} GB</b>{' '}\n of storage used\n </Typography>\n </Box>\n\n <Typography data-id=\"storage-price\" fontSize={16} fontWeight={600}>\n ${formatPrice(invoice.storageFee)}\n </Typography>\n </Stack>\n\n <Stack direction=\"row\" justifyContent=\"space-between\">\n <Box>\n <Typography fontSize={16}>Transfer fee</Typography>\n\n <Typography>\n <b>{invoice.transferSize.toLocaleString(undefined, {maximumFractionDigits: 2})} GB</b>{' '}\n transferred\n </Typography>\n </Box>\n\n <Typography data-id=\"transfer-price\" fontSize={16} fontWeight={600}>\n ${formatPrice(invoice.transferFee)}\n </Typography>\n </Stack>\n </Stack>\n\n <Typography\n data-id=\"invoice-total\"\n fontSize={16}\n color=\"primary.main\"\n textAlign=\"right\"\n fontWeight={600}\n >\n Total period amount: ${formatPrice(invoice.total)}\n </Typography>\n </Card>\n );\n}\n","/* eslint-disable jsx-a11y/anchor-is-valid */\nimport React, {useState} from 'react';\nimport {Box, Button, Card, Divider, Link, Stack, Typography} from '@mui/material';\nimport {grey} from '@mui/material/colors';\nimport CreditCardIcon from '@mui/icons-material/CreditCard';\nimport {DataId, StyleSx, Sx} from 'app/types/common';\nimport {useMounted} from 'app/hooks/useIsMounted';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {\n FilesBilling,\n SubscribeDialog,\n UnsubscribeDialog,\n} from 'app/components/entities/billing/files';\n\nconst rootSx: StyleSx = {\n display: 'flex',\n flexDirection: 'column',\n px: 4,\n py: 3,\n height: 290,\n gap: 1,\n bgcolor: grey[50],\n};\n\nconst inactiveSx: StyleSx = {\n borderStyle: 'dashed',\n bgcolor: ({palette}) => palette.background.paper,\n};\n\ninterface Props extends Sx, DataId {\n hasPayment: boolean;\n price: FilesBilling.Price;\n active: boolean;\n onSubscribe: () => Promise<void>;\n onUnsubscribe: () => Promise<void>;\n onEditPayment: () => void;\n}\n\nexport function FilesCard({\n dataId,\n sx,\n price,\n active,\n hasPayment,\n onSubscribe,\n onUnsubscribe,\n onEditPayment,\n}: Props) {\n const mounted = useMounted();\n\n const [subscribeDialog, setSubscribeDialog] = useState(false);\n const [unsubscribeDialog, setUnsubscribeDialog] = useState(false);\n\n const handleChange = () => {\n if (active) {\n setUnsubscribeDialog(true);\n } else {\n setSubscribeDialog(true);\n }\n };\n\n const handleSubscribe = async () => {\n await onSubscribe();\n\n if (mounted()) {\n setSubscribeDialog(false);\n }\n };\n const handleUnsubscribe = async () => {\n await onUnsubscribe();\n\n if (mounted()) {\n setUnsubscribeDialog(false);\n }\n };\n\n return (\n <>\n <Card data-id={dataId} sx={packSx(rootSx, !active && inactiveSx, sx)} variant=\"outlined\">\n <Box flex={1}>\n <Stack mb={3} direction=\"row\" justifyContent=\"space-between\" alignItems=\"center\">\n <Typography variant=\"h5\" color={!active ? 'text.disabled' : 'inherit'} fontWeight={600}>\n File management\n </Typography>\n\n <Button\n data-id=\"switch-subscription-btn\"\n variant=\"outlined\"\n color={active ? 'error' : 'primary'}\n disabled={!hasPayment}\n onClick={handleChange}\n >\n {active ? 'Unsubscribe' : 'Subscribe'}\n </Button>\n </Stack>\n\n {active && (\n <Typography variant=\"h5\" color=\"primary.main\" fontWeight={600} mb={0.5}>\n Plan active\n </Typography>\n )}\n\n <Typography>\n First {price.free.storage} GB are free for any subscribed account.\n </Typography>\n\n {!active && (\n <Link\n data-id=\"file-management-link\"\n href=\"https://www.epiphan.com/file-management\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n Learn more\n </Link>\n )}\n </Box>\n\n <Divider />\n\n <Stack height={58} justifyContent=\"center\">\n {!hasPayment && (\n <Stack direction=\"row\" alignItems=\"center\" gap={1}>\n <CreditCardIcon color=\"primary\" />\n <Link\n sx={{verticalAlign: 'baseline'}}\n component=\"button\"\n variant=\"inherit\"\n onClick={onEditPayment}\n >\n Add billing information to subscribe\n </Link>\n </Stack>\n )}\n </Stack>\n </Card>\n\n <SubscribeDialog\n open={subscribeDialog}\n price={price}\n onClose={() => setSubscribeDialog(false)}\n onConfirm={handleSubscribe}\n />\n\n <UnsubscribeDialog\n open={unsubscribeDialog}\n onClose={() => setUnsubscribeDialog(false)}\n onConfirm={handleUnsubscribe}\n />\n </>\n );\n}\n","import {useEffect, useState, useCallback, useMemo} from 'react';\nimport {useQuery, useQueryClient} from '@tanstack/react-query';\nimport {produce} from 'immer';\nimport {throttle} from 'throttle-debounce';\nimport {EVENT_TYPE} from 'app/api/WebSocket/constants';\nimport {WS} from 'app/api/WebSocket/WS';\nimport {Ws} from 'app/contracts/ws';\nimport {createDeviceModel} from 'app/components/DeviceDetails/Models/Fabric';\nimport {useTeamScheduleQuery} from 'app/hooks/useTeamScheduleQuery';\nimport {DeviceApiService} from 'app/services/api/device/DeviceApiService';\nimport {ScheduleMapper} from 'app/util/mappers/ScheduleMapper';\nimport {Schedule} from 'app/domain/schedule';\nimport {getCurrentPeriod, sortEvents} from 'app/components/sharedReactComponents/Events/utils';\nimport {useGetEventsDevices} from 'app/components/sharedReactComponents/Events/hooks/useGetEventsDevices';\nimport {PearlMasterDeviceModel} from 'app/components/DeviceDetails/Models/PearlMasterDeviceModel';\nimport {useWsMessageQueue} from 'app/hooks/useWsMessageQueue';\nimport {useDevicesState} from 'app/hooks/useDevicesState';\nimport {useActualEvents} from 'app/components/sharedReactComponents/Events/hooks/useActualEvents';\nimport {setDesiredState, setPublishers, setUnitStatus} from 'app/components/features/edge/utils';\nimport {parseMasterAndChannelIds} from 'app/components/DeviceDetails/utils';\n\nconst defaultConnection: Schedule.TeamConnection = {\n total: 0,\n hasEdge: false,\n hasExternal: false,\n};\n\ninterface Args {\n enabled: boolean;\n teamId: string;\n}\n\ninterface Return {\n ready: boolean;\n connection: Schedule.TeamConnection;\n events: Schedule.Event[];\n devices?: Map<string, PearlMasterDeviceModel>;\n period: Schedule.Period;\n fetching: boolean;\n actualEventIds: Set<string>;\n setPeriod: React.Dispatch<React.SetStateAction<Schedule.Period>>;\n refetch: () => Promise<any>;\n}\n\nconst defaultDevices = new Map<string, PearlMasterDeviceModel>();\n\nexport function useTeamSchedule({enabled, teamId}: Args): Return {\n const queryClient = useQueryClient();\n\n const [period, setPeriod] = useState<Schedule.Period>(() => getCurrentPeriod());\n\n const [events, setEvents] = useState<Schedule.Event[]>([]);\n const [connection, setConnection] = useState<Schedule.TeamConnection>(() => defaultConnection);\n const {map: deviceMap, setMap: setDeviceMap, setDevice, get: getDevice} = useDevicesState();\n\n const [ready, setReady] = useState(!enabled);\n\n const scheduleQuery = useTeamScheduleQuery({teamId, enabled, period});\n\n const {queue: scheduleQueue, setQueue: setScheduleQueue} =\n useWsMessageQueue<Ws.ScheduleEventChange>();\n\n const actualEvents = useActualEvents({enabled, teamId});\n\n const refetchSchedule = scheduleQuery.refetch;\n\n const observedDevices = useGetEventsDevices(scheduleQuery.data?.events);\n\n const hasObservedDevices = enabled && observedDevices.length > 0;\n\n const devicesQuery = useQuery({\n queryKey: ['team-schedule-devices', teamId, ...observedDevices],\n queryFn: async () => {\n const response = await DeviceApiService.getUnits(observedDevices);\n const mapped = response.map((d) => createDeviceModel(d));\n return new Map(mapped.map((m) => [m.getId(), m]));\n },\n enabled: hasObservedDevices,\n keepPreviousData: true,\n });\n\n const captureScheduleWs = scheduleQuery.isFetching;\n\n useEffect(() => {\n if (!enabled || !scheduleQuery.isSuccess) {\n setEvents([]);\n setConnection(defaultConnection);\n return;\n }\n\n const list = Array.from(scheduleQuery.data.events.values()).sort(sortEvents);\n setEvents(list);\n setConnection(scheduleQuery.data.connection);\n }, [enabled, scheduleQuery.data, scheduleQuery.isSuccess]);\n\n useEffect(() => {\n if (!enabled || !hasObservedDevices) {\n setDeviceMap(new Map());\n return;\n }\n\n const devices = new Map<string, PearlMasterDeviceModel>();\n\n devicesQuery.data?.forEach((d, deviceId) => {\n if (d instanceof PearlMasterDeviceModel) {\n devices.set(deviceId, d);\n }\n });\n\n setDeviceMap(devices);\n }, [enabled, hasObservedDevices, devicesQuery.data, setDeviceMap]);\n\n const handleEventStatusChange = useCallback(\n (message: Ws.ScheduleEventChange) => {\n queryClient.setQueriesData<Schedule.TeamSchedule>(['team-schedule', teamId], (schedule) => {\n if (schedule) {\n const {events} = schedule;\n const mapped = ScheduleMapper.mapEvent(message.Body);\n\n if (events.has(mapped.id)) {\n return {\n ...schedule,\n events: produce(events, (map) => {\n map.set(mapped.id, mapped);\n }),\n };\n }\n\n return {...schedule, events};\n }\n\n return schedule;\n });\n },\n [queryClient, teamId],\n );\n\n useEffect(() => {\n if (!enabled) {\n return;\n }\n\n const onScheduleChange = async () => {\n await refetchSchedule();\n };\n\n const throttled = throttle(5000, onScheduleChange);\n\n WS.on(EVENT_TYPE.EVENT_SCHEDULE_CHANGED, throttled);\n\n return () => {\n WS.off(EVENT_TYPE.EVENT_SCHEDULE_CHANGED, throttled);\n throttled.cancel();\n };\n }, [enabled, refetchSchedule]);\n\n useEffect(() => {\n if (!enabled) {\n return;\n }\n\n const onChronoEventChange = async (m: Ws.ScheduleEventChange) => {\n if (captureScheduleWs) {\n setScheduleQueue((p) => [...p, m]);\n } else {\n handleEventStatusChange(m);\n }\n };\n\n WS.on(EVENT_TYPE.CHRONO_EVENT_CHANGED, onChronoEventChange);\n\n return () => {\n WS.off(EVENT_TYPE.CHRONO_EVENT_CHANGED, onChronoEventChange);\n };\n }, [enabled, captureScheduleWs, setScheduleQueue, handleEventStatusChange]);\n\n useEffect(() => {\n if (!enabled) {\n return;\n }\n\n if (!captureScheduleWs && scheduleQueue.length > 0) {\n scheduleQueue.forEach((msg) => {\n handleEventStatusChange(msg);\n });\n setScheduleQueue([]);\n }\n }, [enabled, captureScheduleWs, scheduleQueue, handleEventStatusChange, setScheduleQueue]);\n\n useEffect(() => {\n if (!observedDevices.length) {\n return;\n }\n\n const observed = new Set(observedDevices);\n\n const onDeviceChange = (message: Ws.DeviceChange) => {\n const {DeviceID: deviceId} = message.Body;\n\n if (!observed.has(deviceId)) {\n return;\n }\n\n const instance = createDeviceModel(message.Body.Payload);\n setDevice(instance);\n };\n\n const onStatusChange = (message: Ws.DeviceStatusChange) => {\n const {DeviceID: deviceId} = message.Body;\n\n if (!observed.has(deviceId)) {\n return;\n }\n\n const instance = getDevice(deviceId);\n\n if (instance) {\n const copy = instance.getInnerModel();\n const updated = setUnitStatus(copy, message);\n setDevice(createDeviceModel(updated));\n }\n };\n\n const onStateChange = (message: Ws.DeviceDesiredState) => {\n const {DeviceID: deviceId} = message.Body;\n\n if (!observed.has(deviceId)) {\n return;\n }\n\n const instance = getDevice(deviceId);\n\n if (instance) {\n const copy = instance.getInnerModel();\n const updated = setDesiredState(copy, message.Body.Payload);\n setDevice(createDeviceModel(updated));\n }\n };\n\n const onPublishersChange = (message: Ws.DevicePublishers) => {\n const {DeviceID: deviceId} = message.Body;\n\n if (!observed.has(deviceId)) {\n return;\n }\n\n const instance = getDevice(deviceId);\n\n if (instance) {\n const copy = instance.getInnerModel();\n const updated = setPublishers(copy, message.Body.Payload);\n setDevice(createDeviceModel(updated));\n }\n };\n\n const onRenameDevice = (message: Ws.DeviceRename) => {\n const {DeviceID: deviceId} = message.Body;\n\n const [masterId, channelIdx] = parseMasterAndChannelIds(deviceId);\n\n if (!observed.has(masterId)) {\n return;\n }\n\n const instance = getDevice(masterId);\n\n if (!instance) {\n return;\n }\n\n const copy = instance.getInnerModel();\n\n if (channelIdx) {\n const channels = (copy.Child ?? []).map((channel) =>\n channel.Id === deviceId ? {...channel, Name: message.Body.Payload.Name} : channel,\n );\n\n setDevice(createDeviceModel({...copy, Child: channels}));\n return;\n }\n\n setDevice(createDeviceModel({...copy, Name: message.Body.Payload.Name}));\n };\n\n WS.on(EVENT_TYPE.DEVICE_CHANGE, onDeviceChange);\n WS.on(EVENT_TYPE.DEVICE_STATUS, onStatusChange);\n WS.on(EVENT_TYPE.DEVICE_DESIRED_STATE, onStateChange);\n WS.on(EVENT_TYPE.DEVICE_PUBLISHERS, onPublishersChange);\n WS.off(EVENT_TYPE.DEVICE_RENAME, onRenameDevice);\n\n return () => {\n WS.off(EVENT_TYPE.DEVICE_CHANGE, onDeviceChange);\n WS.off(EVENT_TYPE.DEVICE_STATUS, onStatusChange);\n WS.off(EVENT_TYPE.DEVICE_DESIRED_STATE, onStateChange);\n WS.off(EVENT_TYPE.DEVICE_PUBLISHERS, onPublishersChange);\n WS.off(EVENT_TYPE.DEVICE_RENAME, onRenameDevice);\n };\n }, [observedDevices, setDevice, getDevice]);\n\n useEffect(() => {\n if (scheduleQuery.isSuccess) {\n setReady(true);\n }\n }, [scheduleQuery.isSuccess]);\n\n const actualEventIds = useMemo(() => {\n const items = [...(actualEvents?.values() ?? [])].map((e) => e.id);\n return new Set(items);\n }, [actualEvents]);\n\n return {\n period,\n events,\n ready,\n connection,\n actualEventIds,\n fetching: scheduleQuery.isFetching,\n devices: deviceMap ? (deviceMap as Map<string, PearlMasterDeviceModel>) : defaultDevices,\n setPeriod,\n refetch: refetchSchedule,\n };\n}\n","import React from 'react';\nimport {Stack} from '@mui/material';\nimport {Header} from 'app/components/FleetManager/Header';\nimport {useTeamSchedule} from 'app/components/sharedReactComponents/Events/hooks/useTeamSchedule';\nimport {TeamSchedule} from 'app/components/sharedReactComponents/Events/TeamSchedule/TeamSchedule';\nimport {IndeterminateProgressBar} from 'app/components/sharedReactComponents/IndeterminateProgressBar';\nimport {StyleSx} from 'app/types/common';\nimport {noop} from 'app/util/noop';\nimport {useCloud} from 'app/components/features/cloud';\n\nconst scheduleSx: StyleSx = {flex: 1, my: 4};\n\nexport const EventsPage = () => {\n const {team, user} = useCloud();\n\n const enabled = team.capabilities.has('cms');\n\n const {connection, ready, events, devices, period, fetching, actualEventIds, setPeriod} =\n useTeamSchedule({\n enabled,\n teamId: team.id,\n });\n\n return (\n <Stack flex={1}>\n <Header searchValue=\"\" showSearch={false} onSearch={noop} />\n\n {!ready ? (\n <IndeterminateProgressBar />\n ) : (\n <TeamSchedule\n sx={scheduleSx}\n teamId={team.id}\n userId={user.id}\n events={events}\n devices={devices}\n connection={connection}\n period={period}\n fetching={fetching}\n actualEventIds={actualEventIds}\n setPeriod={setPeriod}\n />\n )}\n </Stack>\n );\n};\n","import React, {useContext} from 'react';\nimport {RootStore} from 'app/store/RootStore';\n\nexport const StoreContext = React.createContext<RootStore | undefined>(undefined);\n\nexport function useRootStore(): RootStore {\n const ctx = useContext(StoreContext);\n\n if (!ctx) {\n throw new Error('Out of root store');\n }\n\n return ctx;\n}\n","import React from 'react';\nimport classNames from 'classnames';\nimport {Callback, ClassName, DataId} from 'app/types/common';\nimport {Button} from 'app/components/sharedReactComponents/Button';\nimport {SIZE} from 'app/constants';\n\ninterface Props extends ClassName, DataId {\n icon?: React.ReactNode;\n summary: number;\n label: React.ReactNode;\n title: string;\n onClick: Callback;\n}\n\nexport const SummaryButton = ({className, dataId, icon, label, summary, title, onClick}: Props) => {\n if (!summary) {\n return null;\n }\n\n return (\n <Button\n className={classNames('summary-button', className)}\n title={title}\n size={SIZE.S}\n dataId={dataId}\n onClick={onClick}\n >\n {icon && <span className=\"summary-button__icon\">{icon}</span>}\n\n <span>{label}</span>\n </Button>\n );\n};\n","import React from 'react';\nimport {Icons} from 'app/util/icons';\nimport {THEME, VARIANT, SIZE} from 'app/constants';\nimport {router} from 'app/router/main';\nimport {Button} from 'app/components/sharedReactComponents/Button';\n\ninterface Props {\n canEdit: boolean;\n}\n\nexport const UpgradeToProTooltip = ({canEdit}: Props) => (\n <div className=\"upgrade-to-pro-tooltip\">\n <div className=\"upgrade-to-pro-tooltip__title\">\n Supercharge your experience and upgrade to Premium\n </div>\n\n <div className=\"upgrade-to-pro-tooltip__list-item\">\n {Icons.batchForStreamingUpgradeToPro()\n .class('upgrade-to-pro-tooltip__icon')\n .size(SIZE.L)\n .reactComponent()}\n\n <div className=\"upgrade-to-pro-tooltip__description\">\n Batch control streaming, recording and transcription, fleet maintenance, remote login and\n more.\n </div>\n </div>\n\n <div className=\"upgrade-to-pro-tooltip__list-item\">\n {Icons.deviceGroupingUpgradeToPro()\n .class('upgrade-to-pro-tooltip__icon')\n .size(SIZE.L)\n .reactComponent()}\n\n <div className=\"upgrade-to-pro-tooltip__description\">\n Device grouping to enhance your device organization during Live Events.\n </div>\n </div>\n\n <div className=\"upgrade-to-pro-tooltip__list-item\">\n {Icons.preset().class('upgrade-to-pro-tooltip__icon').size(SIZE.L).reactComponent()}\n\n <div className=\"upgrade-to-pro-tooltip__description\">Configuration presets support.</div>\n </div>\n\n <div className=\"upgrade-to-pro-tooltip__list-item\">\n {Icons.highDefinitionVideoUpgradeToPro()\n .class('upgrade-to-pro-tooltip__icon')\n .size(SIZE.L)\n .reactComponent()}\n\n <div className=\"upgrade-to-pro-tooltip__description\">High-definition video playback.</div>\n </div>\n\n {canEdit && (\n <Button\n className=\"upgrade-to-pro-tooltip__button\"\n theme={THEME.PRIMARY}\n variant={VARIANT.SOLID}\n href={router.url('settingBillingUsage')}\n >\n Upgrade to Premium\n </Button>\n )}\n </div>\n);\n","import React, {\n forwardRef,\n useCallback,\n} from 'react';\nimport classNames from 'classnames';\nimport {KeyboardCode} from 'app/constants';\nimport {\n Callback,\n ClassName,\n} from 'app/types/common';\n\ninterface Props extends ClassName {\n selected: boolean;\n indeterminate?: boolean;\n disabled?: boolean;\n onChange?: Callback;\n}\n\nexport const SelectCheckbox = forwardRef<any, Props>(({\n className,\n selected,\n indeterminate,\n disabled,\n onChange,\n ...elementProps\n}, ref) => {\n const handleClick = useCallback(() => {\n onChange?.({target: {value: !selected}});\n }, [onChange, selected]);\n\n const handleKeyDown = useCallback((e: React.KeyboardEvent<HTMLSpanElement>) => {\n if (e.code === KeyboardCode.Space) {\n e.preventDefault();\n onChange?.({target: {value: !selected}});\n }\n }, [onChange, selected]);\n\n if (disabled) {\n return (\n <span\n ref={ref}\n className=\"device-card-select-checkbox device-card-select-checkbox--disabled\"\n {...elementProps}\n />\n );\n }\n\n return (\n <span\n ref={ref}\n className={classNames('device-card-select-checkbox device-card-select-checkbox--enabled', {\n 'device-card-select-checkbox--checked': selected,\n 'device-card-select-checkbox--indeterminate': indeterminate,\n })}\n tabIndex={0}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n {...elementProps}\n />\n );\n});\n\nSelectCheckbox.displayName = 'SelectCheckbox';\n","import React from 'react';\nimport classNames from 'classnames';\nimport {useInView} from 'react-intersection-observer';\nimport {ClassName} from 'app/types/common';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {FleetManagerColumn} from 'app/components/FleetManager/types';\nimport {FleetManagerColumnId} from 'app/components/FleetManager/constants';\nimport {intersectionOfSets} from 'app/util/intersectionOfSets';\nimport {AnyUserRoleModel} from 'app/models/PermissionsModel/types';\nimport {useSystemInfo} from 'app/components/DeviceDetails/DeviceInfoTab/SystemInformation/useSystemInfo';\nimport {useDeviceStorage} from 'app/components/DeviceDetails/DeviceInfoTab/SystemInformation/useStorageInfo';\nimport {useUnitAfu} from 'app/components/entities/afu';\n\ninterface Props extends ClassName {\n device: AnyDeviceModelType;\n role: AnyUserRoleModel;\n columns: FleetManagerColumn[];\n progress?: number;\n}\n\nconst columnsSystem = new Set([\n FleetManagerColumnId.SystemLoad,\n FleetManagerColumnId.Temperature,\n FleetManagerColumnId.Uptime,\n]);\n\nconst storageColumns = new Set([FleetManagerColumnId.Storage]);\n\nconst afuColumns = new Set([FleetManagerColumnId.TransferQueue]);\n\nconst isColumnUsed = (\n featureColumnIds: Set<FleetManagerColumnId>,\n columnIds: Set<FleetManagerColumnId>,\n) => {\n return intersectionOfSets(featureColumnIds, columnIds).size > 0;\n};\n\nexport const StatusList = React.memo(({className, columns, device, role, progress}: Props) => {\n const {ref, inView} = useInView();\n\n const columnIds = new Set(columns.map((column) => column.dataKey));\n const disabled = device.isOffline() || device.isUnpaired() || !inView;\n\n const deviceId = device.getId();\n\n const {data: system} = useSystemInfo({\n deviceId,\n enabled: !disabled && isColumnUsed(columnsSystem, columnIds),\n refetchInterval: 60 * 1000,\n });\n\n const {data: storage} = useDeviceStorage({\n deviceId,\n enabled: !disabled && isColumnUsed(storageColumns, columnIds),\n refetchInterval: 60 * 1000,\n });\n\n const {data: afu} = useUnitAfu({\n deviceId,\n enabled: !disabled && isColumnUsed(afuColumns, columnIds),\n refetchInterval: 60 * 1000,\n });\n\n return (\n <div ref={ref} className={classNames('device-card-status-list', className)}>\n {columns.map((column) => (\n <div\n key={column.dataKey}\n className=\"device-card-status-list__item\"\n data-id={`device_card_${column.dataKey}`}\n style={{\n width: column.width,\n }}\n >\n {column.cellRenderer({\n device,\n system: system ?? undefined,\n storage: storage ?? undefined,\n afu: afu ?? undefined,\n progress,\n role,\n }) || '—'}\n </div>\n ))}\n </div>\n );\n});\n","import React, {useState} from 'react';\nimport {\n Box,\n Button,\n Checkbox,\n Dialog,\n DialogActions,\n DialogContent,\n DialogProps,\n DialogTitle,\n FormControlLabel,\n Stack,\n Typography,\n} from '@mui/material';\nimport {LoadingButton} from '@mui/lab';\nimport {Prompt} from 'app/types/common';\nimport {useMounted} from 'app/hooks/useIsMounted';\nimport {NamesList} from 'app/components/sharedReactComponents/ItemsEnumeration';\nimport {pluralize, pluralizeN} from 'app/components/helpers/commonHelpers';\n\ntype ProjectCheck = 'recordings' | 'configuration' | 'alerts';\n\ntype Props = {\n loading: boolean;\n names: string[];\n onDelete: () => Promise<void>;\n onClose: () => void;\n};\n\nfunction DeleteProjects({loading, names, onDelete, onClose}: Props) {\n const plural = pluralizeN('project', names.length);\n\n const [checks, setChecks] = useState<Set<ProjectCheck>>(new Set());\n\n const toggleCheck = (check: ProjectCheck) => {\n const copy = new Set(checks);\n\n if (copy.has(check)) {\n copy.delete(check);\n } else {\n copy.add(check);\n }\n\n setChecks(copy);\n };\n\n return (\n <Box>\n <DialogTitle>\n Delete <NamesList max={3} variant=\"inherit\" color=\"primary.main\" names={names} />{' '}\n {pluralizeN('project', names.length)}\n </DialogTitle>\n\n <DialogContent>\n <Typography textAlign=\"center\">Click the check boxes to confirm</Typography>\n\n <Stack alignItems=\"center\">\n <Stack alignItems=\"flex-start\">\n <FormControlLabel\n sx={{mb: 0}}\n control={\n <Checkbox\n checked={checks.has('recordings')}\n onChange={() => toggleCheck('recordings')}\n />\n }\n label={`Delete all content and recordings associated with ${pluralize(\n 'this',\n names,\n )} ${plural}`}\n />\n <FormControlLabel\n sx={{mb: 0}}\n control={\n <Checkbox\n checked={checks.has('configuration')}\n onChange={() => toggleCheck('configuration')}\n />\n }\n label={`Delete ${plural} ${pluralize('configuration', names)}`}\n />\n <FormControlLabel\n sx={{mb: 0}}\n control={\n <Checkbox checked={checks.has('alerts')} onChange={() => toggleCheck('alerts')} />\n }\n label={`Stop receiving alerts from ${pluralize('this', names)} ${plural}`}\n />\n </Stack>\n </Stack>\n </DialogContent>\n\n <DialogActions>\n <LoadingButton\n data-id=\"confirm-delete-btn\"\n variant=\"contained\"\n color=\"error\"\n loading={loading}\n disableRipple={false}\n disabled={checks.size !== 3}\n onClick={onDelete}\n >\n Delete\n </LoadingButton>\n <Button\n data-id=\"cancel-delete-btn\"\n variant=\"outlined\"\n color=\"info\"\n disableRipple={false}\n onClick={onClose}\n >\n Cancel\n </Button>\n </DialogActions>\n </Box>\n );\n}\n\ntype PromptProps = Prompt & Omit<Props, 'loading'> & Pick<DialogProps, 'maxWidth' | 'fullWidth'>;\n\nexport function DeleteProjectsDialog({open, names, onDelete, onClose, ...props}: PromptProps) {\n const mounted = useMounted();\n const [loading, setLoading] = useState(false);\n\n const handleDelete = async () => {\n try {\n setLoading(true);\n await onDelete();\n } finally {\n if (mounted()) {\n setLoading(false);\n }\n }\n };\n\n return (\n <Dialog open={open} {...props}>\n <DeleteProjects loading={loading} names={names} onDelete={handleDelete} onClose={onClose} />\n </Dialog>\n );\n}\n","import React, {ComponentProps, useCallback, useMemo, useRef, useState} from 'react';\nimport classNames from 'classnames';\nimport {\n ContextMenuItem,\n EllipsedContextMenu,\n} from 'app/components/sharedReactComponents/ContextMenu';\nimport {Icons} from 'app/util/icons';\nimport {SIZE, THEME} from 'app/constants';\nimport {UpdateDeviceFirmwarePrompt} from 'app/components/libs/dialogs/UpdateDeviceFirmwarePrompt';\nimport {AVAILABLE_FOR_PRO_PLAN_TOOLTIP_MESSAGE} from 'app/components/sharedReactComponents/AvailableForProPlanTooltip/constants';\nimport {Callback, ClassName} from 'app/types/common';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {FirmwareFeature} from 'app/store/models/features/firmware/FirmwareFeature';\nimport {DeviceApiService} from 'app/services/api/device/DeviceApiService';\nimport {noop} from 'app/util/noop';\nimport {AbortCallback} from 'app/api/types';\nimport {MoveToGroupDialog} from 'app/components/dialogs/MoveToGroupDialog/MoveToGroupDialog';\nimport {Edge} from 'app/domain/edge';\nimport {Notifications} from 'app/components/Notifications';\nimport {useMounted} from 'app/hooks/useIsMounted';\nimport {ModelService} from 'app/services/deviceModel/DeviceModelService';\nimport {RemoveFromGroupDialog} from 'app/components/dialogs/RemoveFromGroupDialog/RemoveFromGroupDialog';\nimport {ApplyPresetToDevicesDialog} from 'app/components/dialogs/ApplyPresetToDevicesDialog/ApplyPresetToDevicesDialog';\nimport {RebootDevicesDialog} from 'app/components/dialogs/RebootDevicesDialog/RebootDevicesDialog';\nimport {ProjectsSwitcherDialog} from 'app/components/dialogs/ProjectsSwitcherDialog/ProjectsSwitcherDialog';\nimport {DeleteProjectsDialog} from 'app/components/dialogs/DeleteProjectsDialog/DeleteProjectsDialog';\nimport {DeleteDevicesDialog} from 'app/components/dialogs/DeleteDevicesDialog/DeleteDevicesDialog';\n\ntype ProjectAction = ComponentProps<typeof ProjectsSwitcherDialog>['action'];\n\ninterface Props extends ClassName {\n device: AnyDeviceModelType;\n groups: Edge.Group[];\n permitReboot: boolean;\n permitPreset: boolean;\n permitUnify: boolean;\n presets: Edge.TeamPreset[];\n onApplyPreset: (preset: Edge.TeamPreset) => Promise<void>;\n onMoveToGroup: (groupId: string) => Promise<void>;\n onRemoveFromGroup: () => Promise<void>;\n onStartProject?: () => Promise<any>;\n onStopProject?: () => Promise<any>;\n onDelete: () => Promise<any>;\n\n unpairAction: Callback;\n}\n\nexport const ContextMenu = React.memo(\n ({\n className,\n device,\n groups,\n permitPreset,\n permitReboot,\n permitUnify,\n presets,\n onApplyPreset,\n onMoveToGroup,\n onRemoveFromGroup,\n onStartProject,\n onStopProject,\n onDelete,\n\n unpairAction,\n }: Props) => {\n const [presetDialog, setPresetDialog] = useState(false);\n const [rebootDialog, setRebootDialog] = useState(false);\n const [moveToGroupDialog, setMoveToGroupDialog] = useState(false);\n const [removeFromGroupDialog, setRemoveFromGroupDialog] = useState(false);\n const [projectDialog, setProjectDialog] = useState(false);\n const [deleteDialog, setDeleteDialog] = useState(false);\n\n const mounted = useMounted();\n\n const groupsAccess = device.capabilities.groups;\n\n const deviceGroup = device.getGroupId() ?? '';\n const model = device.getModelName();\n const name = device.getName() ?? '';\n const isOnline = device.isOnline();\n\n const isUnify = ModelService.isUnify(model);\n const isLvs = ModelService.isLivescrypt(model);\n\n const disableReboot = !device.capabilities.reboot || !permitReboot;\n\n const applyPresetDisabled = !device.capabilities.presets || device.isOffline() || !permitPreset;\n\n const [firmware, setFirmware] = useState<FirmwareFeature | undefined>(undefined);\n const [firmwareLoading, setFirmwareLoading] = useState<boolean>(true);\n\n const updateAvailable = firmware\n ? firmware.updateInProgress || firmware.availableVersion\n : false;\n\n const disabledFirmwareOption = device.isOffline() || firmwareLoading || !updateAvailable;\n\n const abortCb = useRef<AbortCallback>(noop);\n\n const onOpen = useCallback(async () => {\n if (device.isOffline() || isUnify) {\n setFirmwareLoading(false);\n return;\n }\n\n try {\n setFirmwareLoading(true);\n const response = await DeviceApiService.getFirmware(\n device.getId(),\n (abort) => (abortCb.current = abort),\n );\n if (!response) {\n throw new Error('firmware is null');\n }\n\n setFirmware(new FirmwareFeature(response));\n } catch {\n setFirmware(undefined);\n } finally {\n setFirmwareLoading(false);\n }\n }, [device, isUnify]);\n\n const onClose = useCallback(() => {\n if (!isUnify) {\n abortCb.current();\n setFirmware(undefined);\n }\n }, [abortCb, isUnify]);\n\n const availableGroups = useMemo(() => {\n if (groupsAccess) {\n return groups.filter((g) => g.id !== deviceGroup);\n }\n\n return [];\n }, [groupsAccess, groups, deviceGroup]);\n\n const currentGroup =\n groupsAccess && deviceGroup ? groups.find((g) => g.id === deviceGroup) : undefined;\n\n const handleRemoveFromGroup = async () => {\n await onRemoveFromGroup();\n\n if (mounted()) {\n setRemoveFromGroupDialog(false);\n }\n };\n\n const handleReboot = async () => {\n try {\n await device.sendRebootCommand();\n\n if (mounted()) {\n setRebootDialog(false);\n }\n } catch {\n Notifications.addErrorNotification('Failed to reboot device');\n }\n };\n\n const handleSwitch = async (action: ProjectAction) => {\n try {\n if (action === 'start') {\n await onStartProject?.();\n } else {\n await onStopProject?.();\n }\n setProjectDialog(false);\n } catch {\n Notifications.addErrorNotification(`Failed to reboot device`);\n }\n };\n\n const handleApplyPreset = async (preset: Edge.TeamPreset) => {\n await onApplyPreset(preset);\n\n if (mounted()) {\n setPresetDialog(false);\n }\n };\n\n const handleDelete = async () => {\n try {\n await onDelete();\n\n if (mounted()) {\n setDeleteDialog(false);\n }\n } catch {\n Notifications.addErrorNotification('Failed to delete device');\n }\n };\n\n return (\n <div className={classNames('device-card-context-menu', className)}>\n <ApplyPresetToDevicesDialog\n open={presetDialog}\n unitCount={1}\n model={model}\n presets={presets}\n rebootWarning={!isUnify}\n onApply={handleApplyPreset}\n onClose={() => setPresetDialog(false)}\n />\n\n {groupsAccess && (\n <>\n <MoveToGroupDialog\n open={moveToGroupDialog}\n devices={[]}\n groups={availableGroups}\n onMove={onMoveToGroup}\n onRemove={deviceGroup ? handleRemoveFromGroup : undefined}\n onClose={() => setMoveToGroupDialog(false)}\n />\n\n {currentGroup && (\n <RemoveFromGroupDialog\n open={removeFromGroupDialog}\n devices={[device]}\n onRemove={handleRemoveFromGroup}\n onClose={() => setRemoveFromGroupDialog(false)}\n />\n )}\n </>\n )}\n\n {isUnify ? (\n <>\n <ProjectsSwitcherDialog\n open={projectDialog}\n names={[name]}\n action={isOnline ? 'stop' : 'start'}\n onSwitch={handleSwitch}\n onClose={() => setProjectDialog(false)}\n />\n\n <DeleteProjectsDialog\n open={deleteDialog}\n names={[name]}\n onDelete={handleDelete}\n onClose={() => setDeleteDialog(false)}\n />\n </>\n ) : (\n <>\n <RebootDevicesDialog\n open={rebootDialog}\n names={[name]}\n onReboot={handleReboot}\n onClose={() => setRebootDialog(false)}\n />\n\n <DeleteDevicesDialog\n open={deleteDialog}\n names={[name]}\n lvsOnly={isLvs}\n onDelete={handleDelete}\n onClose={() => setDeleteDialog(false)}\n />\n </>\n )}\n\n <EllipsedContextMenu\n buttonDataId=\"device_card_context_menu_button\"\n size={SIZE.S}\n items={[\n ...(isUnify\n ? createUnifyProjectDeviceOptions({\n device,\n permitted: permitUnify,\n onStart: () => {\n setProjectDialog(true);\n },\n onStop: () => {\n setProjectDialog(true);\n },\n })\n : []),\n ...(isUnify\n ? []\n : [\n {\n label: 'Update firmware',\n itemDataId: 'update_firmware_option',\n icon: Icons.updateFirmware().reactComponent(),\n disabled: disabledFirmwareOption,\n loading: firmwareLoading,\n action: () => {\n UpdateDeviceFirmwarePrompt.show({\n devices: [device],\n });\n },\n },\n {\n separator: true,\n },\n ]),\n ...(isUnify\n ? []\n : [\n {\n label: 'Move to group',\n itemDataId: 'move_to_group_option',\n icon: Icons.groupMove().reactComponent(),\n visible: groupsAccess,\n action: () => setMoveToGroupDialog(true),\n },\n {\n label: 'Remove from group',\n itemDataId: 'remove_from_group_option',\n icon: Icons.groupRemove().reactComponent(),\n visible: groupsAccess && Boolean(deviceGroup),\n action: () => setRemoveFromGroupDialog(true),\n },\n {\n separator: true,\n visible: groupsAccess,\n },\n ]),\n {\n label: 'Apply preset',\n itemDataId: 'apply_preset_option',\n icon: Icons.selectPreset().reactComponent(),\n danger: true,\n disabled: applyPresetDisabled,\n title: !device.capabilities.presets\n ? AVAILABLE_FOR_PRO_PLAN_TOOLTIP_MESSAGE\n : undefined,\n action: () => setPresetDialog(true),\n },\n ...(isUnify\n ? []\n : [\n {\n label: 'Reboot',\n itemDataId: 'reboot_option',\n icon: Icons.retry().reactComponent(),\n danger: true,\n disabled: disableReboot,\n action: () => {\n setRebootDialog(true);\n },\n },\n {\n label: 'Unpair',\n itemDataId: 'unpair_option',\n icon: Icons.unlink().reactComponent(),\n danger: true,\n disabled: device.isUnpaired(),\n action: () => unpairAction([device]),\n },\n ]),\n {\n label: 'Delete',\n itemDataId: 'delete_option',\n icon: Icons.trash().reactComponent(),\n danger: true,\n disabled: isUnify ? !permitUnify : false,\n action: () => {\n setDeleteDialog(true);\n },\n },\n ]}\n onOpen={onOpen}\n onClose={onClose}\n />\n </div>\n );\n },\n);\n\ninterface Args {\n device: AnyDeviceModelType;\n permitted: boolean;\n onStart: () => void;\n onStop: () => void;\n}\n\nfunction createUnifyProjectDeviceOptions({\n device,\n permitted,\n onStart,\n onStop,\n}: Args): ContextMenuItem[] {\n const showStart = permitted && device.isDown() && device.capabilities.resume;\n const showStop = permitted && device.isOnline();\n\n if (showStart || showStop) {\n return [\n {\n icon: Icons.play().theme(THEME.PRIMARY).reactComponent(),\n itemDataId: 'context_menu_start_virtual_device',\n label: 'Start project',\n visible: showStart,\n action: onStart,\n },\n {\n icon: Icons.stop().theme(THEME.SUCCESS).reactComponent(),\n itemDataId: 'context_menu_start_virtual_stop',\n label: 'Stop project',\n visible: showStop,\n action: onStop,\n },\n {\n separator: true,\n },\n ];\n }\n\n return [];\n}\n","const AVAILABLE_FOR_PRO_PLAN_TOOLTIP_MESSAGE = 'Available for Premium plan only';\n\nexport {AVAILABLE_FOR_PRO_PLAN_TOOLTIP_MESSAGE};\n","import React from 'react';\nimport {useInView} from 'react-intersection-observer';\nimport classNames from 'classnames';\nimport {SelectCheckbox} from 'app/components/FleetManager/DeviceCard/SelectCheckbox';\nimport {ActionButtons} from 'app/components/sharedReactComponents/ActionButtons/ActionButtons';\nimport {StackHorizontal} from 'app/components/sharedReactComponents/Stack';\nimport {ActionButtonsSeparator} from 'app/components/sharedReactComponents/ActionButtons/ActionButtonsSeparator';\nimport {DeviceAudioMeter} from 'app/components/sharedReactComponents/DeviceAudioMeter/DeviceAudioMeter';\nimport {isDisabledAudioMeter} from 'app/components/sharedReactComponents/DeviceAudioMeter/utils';\nimport {OverflowTooltip} from 'app/components/sharedReactComponents/OverflowTooltip/OverflowTooltip';\nimport {Tooltip, TOOLTIP_PLACEMENT} from 'app/components/sharedReactComponents/Tooltip';\nimport {UpgradeToProTooltip} from 'app/components/FleetManager/UpgradeToProTooltip';\nimport {THEME} from 'app/constants';\nimport {ClassName, Callback} from 'app/types/common';\nimport {Thumbnail} from 'app/components/sharedReactComponents/Preview/Thumbnail/Thumbnail';\nimport {getPreviewUpdateStrategy} from 'app/components/sharedReactComponents/Preview/utils';\nimport {AnyUserRoleModel} from 'app/models/PermissionsModel/types';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {AnyStreamingDestinationModelType} from 'app/components/StreamingServices/types';\n\ninterface Props extends ClassName {\n selectable?: boolean;\n selected: boolean;\n preview?: React.ReactNode;\n name?: React.ReactNode;\n detailsUrl?: string;\n actions?: React.ReactNode;\n device: AnyDeviceModelType;\n masterDevice?: AnyDeviceModelType;\n hasEvent?: boolean;\n streamingDestinations: AnyStreamingDestinationModelType[];\n withThumbnail?: boolean;\n withAudioMeter?: boolean;\n currentUserRole: AnyUserRoleModel;\n getDeviceById?: (id: string) => AnyDeviceModelType | undefined;\n onSelect?: Callback;\n onChangeStreamingDestination?: Callback;\n}\n\nexport const Container: React.FC<Props> = React.memo(\n ({\n className,\n selectable,\n selected,\n preview,\n name,\n detailsUrl,\n withThumbnail,\n withAudioMeter,\n device,\n masterDevice,\n streamingDestinations,\n actions,\n currentUserRole,\n hasEvent,\n getDeviceById,\n onSelect,\n onChangeStreamingDestination,\n }) => {\n const {ref, inView} = useInView();\n const {batch} = device.capabilities;\n\n return (\n <div\n className={classNames(\n 'device-card-child-container',\n {\n 'device-card-child-container--selectable': selectable,\n 'device-card-child-container--selected': selected,\n },\n className,\n )}\n data-id=\"device_card_child\"\n >\n {selectable && (\n <div className=\"device-card-child-container__select\">\n <Tooltip\n content={\n !batch ? (\n <UpgradeToProTooltip canEdit={currentUserRole.canEditBilling()} />\n ) : undefined\n }\n interactive={true}\n trigger=\"click\"\n placement={TOOLTIP_PLACEMENT.BOTTOM}\n theme={THEME.WHITE}\n >\n <SelectCheckbox\n data-id=\"device_card_child_checkbox\"\n selected={selected}\n disabled={!batch}\n onChange={onSelect}\n />\n </Tooltip>\n </div>\n )}\n\n <div className=\"device-card-child-container__content\">\n <div ref={ref} className=\"device-card-child-container__preview\">\n {inView && (\n <>\n {withThumbnail && (\n <Thumbnail\n id={device.getId() ?? masterDevice?.getId()}\n detailsUrl={detailsUrl}\n updateStrategy={getPreviewUpdateStrategy(masterDevice ?? device)}\n />\n )}\n\n {withAudioMeter && (\n <DeviceAudioMeter\n className=\"device-card-child-container__audio\"\n id={device.getId() ?? masterDevice?.getId()}\n disabled={isDisabledAudioMeter(masterDevice ?? device)}\n segmentsCount={13}\n segmentsGap={2}\n vertical={true}\n />\n )}\n\n {preview}\n </>\n )}\n </div>\n\n {name && (\n <div className=\"device-card-child-container__name\">\n {detailsUrl ? (\n <a\n className=\"device-card-child-container__link\"\n href={detailsUrl}\n data-id=\"device_card_child_name\"\n >\n <OverflowTooltip rowsNumber={1}>{name}</OverflowTooltip>\n </a>\n ) : (\n name\n )}\n </div>\n )}\n\n <div className=\"device-card-child-container__actions\">\n <StackHorizontal separatorComponent={<ActionButtonsSeparator />}>\n <ActionButtons\n device={device}\n hasEvent={hasEvent}\n editable={currentUserRole.canEditStreamingDestinations()}\n // rework !-operator\n streamingDestinations={streamingDestinations!}\n getDeviceById={getDeviceById!}\n onChangeStreamingDestination={onChangeStreamingDestination!}\n />\n\n {actions}\n </StackHorizontal>\n </div>\n </div>\n </div>\n );\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport {Container} from 'app/components/FleetManager/DeviceCard/ChildCard/Container';\nimport {Callback, ClassName} from 'app/types/common';\nimport {DeviceAudioMeter} from 'app/components/sharedReactComponents/DeviceAudioMeter/DeviceAudioMeter';\nimport {isDisabledAudioMeter} from 'app/components/sharedReactComponents/DeviceAudioMeter/utils';\nimport {AnyUserRoleModel} from 'app/models/PermissionsModel/types';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\n\ninterface Props extends ClassName {\n device: AnyDeviceModelType;\n currentUserRole: AnyUserRoleModel;\n checkIsDeviceSelected: Callback;\n}\n\nexport const TranscribeDeviceDetails = ({\n className,\n device,\n currentUserRole,\n checkIsDeviceSelected,\n}: Props) => {\n return (\n <Container\n className={classNames('transcribe-device-details', className)}\n preview={\n <DeviceAudioMeter\n className=\"transcribe-device-details__audio\"\n id={device.getId()}\n disabled={isDisabledAudioMeter(device)}\n segmentsCount={13}\n segmentsGap={3}\n />\n }\n device={device}\n currentUserRole={currentUserRole}\n selected={checkIsDeviceSelected(device.getId())}\n streamingDestinations={[]}\n />\n );\n};\n","import React, {useCallback} from 'react';\nimport classNames from 'classnames';\nimport {Container} from 'app/components/FleetManager/DeviceCard/ChildCard/Container';\nimport {router} from 'app/router/main';\nimport {Callback, ClassName} from 'app/types/common';\nimport {AnyUserRoleModel} from 'app/models/PermissionsModel/types';\nimport {PearlSlotDeviceModel} from 'app/components/DeviceDetails/Models/PearlSlotDeviceModel';\nimport {PearlMasterDeviceModel} from 'app/components/DeviceDetails/Models/PearlMasterDeviceModel';\nimport {AnyStreamingDestinationModelType} from 'app/components/StreamingServices/types';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\n\ninterface Props extends ClassName {\n device: PearlSlotDeviceModel;\n masterDevice: PearlMasterDeviceModel;\n selectable: boolean;\n streamingDestinations: AnyStreamingDestinationModelType[];\n currentUserRole: AnyUserRoleModel;\n isUnify?: boolean;\n hasEvent?: boolean;\n getDeviceById: (id: string) => AnyDeviceModelType | undefined;\n checkIsDeviceSelected: Callback;\n toggleDeviceSelection: Callback;\n onChangeStreamingDestination: Callback;\n}\n\nexport const ChannelCard: React.FC<Props> = React.memo(\n ({\n className,\n device,\n masterDevice,\n selectable,\n streamingDestinations,\n currentUserRole,\n isUnify = false,\n hasEvent,\n getDeviceById,\n checkIsDeviceSelected,\n toggleDeviceSelection,\n onChangeStreamingDestination,\n }) => {\n const deviceId = device.getId();\n\n const detailsUrl = router.url(isUnify ? 'projectDetails' : 'deviceDetails', {deviceId});\n\n const selected = selectable && checkIsDeviceSelected(deviceId);\n\n const handleSelect = useCallback(() => {\n toggleDeviceSelection(device);\n }, [device, toggleDeviceSelection]);\n\n return (\n <Container\n className={classNames('device-channel-card', className)}\n selected={selected}\n selectable={selectable}\n name={device.getName()}\n detailsUrl={detailsUrl}\n withThumbnail={true}\n withAudioMeter={true}\n device={device}\n masterDevice={masterDevice}\n currentUserRole={currentUserRole}\n streamingDestinations={streamingDestinations}\n hasEvent={hasEvent}\n getDeviceById={getDeviceById}\n onSelect={handleSelect}\n onChangeStreamingDestination={onChangeStreamingDestination}\n />\n );\n },\n);\n","import React, {useEffect, useState} from 'react';\nimport classNames from 'classnames';\nimport {ChannelCard} from 'app/components/FleetManager/DeviceCard/ChildCard/ChannelCard';\nimport {Callback, ClassName} from 'app/types/common';\nimport {AnyUserRoleModel} from 'app/models/PermissionsModel/types';\nimport {PearlSlotDeviceModel} from 'app/components/DeviceDetails/Models/PearlSlotDeviceModel';\nimport {PearlMasterDeviceModel} from 'app/components/DeviceDetails/Models/PearlMasterDeviceModel';\nimport {AnyStreamingDestinationModelType} from 'app/components/StreamingServices/types';\nimport {ModelService} from 'app/services/deviceModel/DeviceModelService';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\n\ninterface Props extends ClassName {\n device: PearlMasterDeviceModel;\n streamingDestinations: AnyStreamingDestinationModelType[];\n selectable: boolean;\n currentUserRole: AnyUserRoleModel;\n hasEvent?: boolean;\n getDeviceById: (id: string) => AnyDeviceModelType | undefined;\n checkIsDeviceSelected: Callback;\n toggleDeviceSelection: Callback;\n onChangeStreamingDestination: Callback;\n}\n\nexport const Channels = React.memo(\n ({\n className,\n device,\n streamingDestinations,\n selectable,\n currentUserRole,\n hasEvent,\n getDeviceById,\n checkIsDeviceSelected,\n toggleDeviceSelection,\n onChangeStreamingDestination,\n }: Props) => {\n const [channelDevices, setChannelDevices] = useState<PearlSlotDeviceModel[]>([]);\n\n useEffect(() => {\n setChannelDevices(device.getChanelModels());\n }, [device]);\n\n if (channelDevices.length === 0) {\n return null;\n }\n\n const isUnify = ModelService.isUnify(device.getModelName());\n\n return (\n <div className={classNames('device-card-channels', className)}>\n {channelDevices.map((channelDevice) => (\n <ChannelCard\n key={channelDevice.getId()}\n className=\"device-card-channels__item\"\n device={channelDevice}\n masterDevice={device}\n selectable={selectable}\n streamingDestinations={streamingDestinations}\n currentUserRole={currentUserRole}\n isUnify={isUnify}\n hasEvent={hasEvent}\n getDeviceById={getDeviceById}\n checkIsDeviceSelected={checkIsDeviceSelected}\n toggleDeviceSelection={toggleDeviceSelection}\n onChangeStreamingDestination={onChangeStreamingDestination}\n />\n ))}\n </div>\n );\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport {Container} from 'app/components/FleetManager/DeviceCard/ChildCard/Container';\nimport {router} from 'app/router/main';\nimport {Callback, ClassName} from 'app/types/common';\nimport {AnyUserRoleModel} from 'app/models/PermissionsModel/types';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\n\ninterface Props extends ClassName {\n device: AnyDeviceModelType;\n streamingDestinations: any[];\n currentUserRole: AnyUserRoleModel;\n getDeviceById: Callback;\n checkIsDeviceSelected: Callback;\n onChangeStreamingDestination: Callback;\n}\n\nexport const WebcasterDeviceDetails: React.FC<Props> = ({\n className,\n device,\n streamingDestinations,\n getDeviceById,\n\n currentUserRole,\n checkIsDeviceSelected,\n onChangeStreamingDestination,\n}) => {\n const detailsUrl = router.url('deviceDetails', {deviceId: device.getId()});\n\n return (\n <Container\n className={classNames('webcaster-device-details', className)}\n detailsUrl={detailsUrl}\n withThumbnail={true}\n withAudioMeter={true}\n selected={checkIsDeviceSelected(device.getId())}\n device={device}\n currentUserRole={currentUserRole}\n getDeviceById={getDeviceById}\n streamingDestinations={streamingDestinations}\n onChangeStreamingDestination={onChangeStreamingDestination}\n />\n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport {Container} from 'app/components/FleetManager/DeviceCard/ChildCard/Container';\nimport {router} from 'app/router/main';\nimport {Callback, ClassName} from 'app/types/common';\nimport {AnyUserRoleModel} from 'app/models/PermissionsModel/types';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\n\ninterface Props extends ClassName {\n device: AnyDeviceModelType;\n currentUserRole: AnyUserRoleModel;\n checkIsDeviceSelected: Callback;\n}\n\nexport function DemoDeviceDetails({\n className,\n device,\n currentUserRole,\n checkIsDeviceSelected,\n}: Props) {\n const detailsUrl = router.url('deviceDetails', {deviceId: device.getId()});\n\n return (\n <Container\n className={classNames('demo-device-details', className)}\n detailsUrl={detailsUrl}\n withThumbnail={true}\n selected={checkIsDeviceSelected(device.getId())}\n currentUserRole={currentUserRole}\n device={device}\n streamingDestinations={[]}\n />\n );\n}\n","import React from 'react';\nimport {TranscribeDeviceDetails} from 'app/components/FleetManager/DeviceCard/ChildCard/TranscribeDeviceDetails';\nimport {Channels} from 'app/components/FleetManager/DeviceCard/Channels';\nimport {WebcasterDeviceDetails} from 'app/components/FleetManager/DeviceCard/ChildCard/WebcasterDeviceDetails';\nimport {DemoDeviceDetails} from 'app/components/FleetManager/DeviceCard/ChildCard/DemoDeviceDetails';\nimport {DeviceModel} from 'app/components/DeviceDetails/constants';\nimport {Callback} from 'app/types/common';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {AnyStreamingDestinationModelType} from 'app/components/StreamingServices/types';\nimport {AnyUserRoleModel} from 'app/models/PermissionsModel/types';\nimport {PearlMasterDeviceModel} from 'app/components/DeviceDetails/Models/PearlMasterDeviceModel';\nimport {ModelService} from 'app/services/deviceModel/DeviceModelService';\n\ninterface Props {\n device: AnyDeviceModelType;\n streamingDestinations: AnyStreamingDestinationModelType[];\n selectable: boolean;\n role: AnyUserRoleModel;\n hasEvent?: boolean;\n getDeviceById: (id: string) => AnyDeviceModelType | undefined;\n checkIsDeviceSelected: Callback;\n toggleDeviceSelection: Callback;\n onChangeStreamingDestination: Callback;\n}\n\nexport const DeviceDetails = React.memo<Props>(\n ({\n device,\n streamingDestinations,\n selectable,\n hasEvent,\n getDeviceById,\n role: currentUserRole,\n checkIsDeviceSelected,\n toggleDeviceSelection,\n onChangeStreamingDestination,\n }: Props) => {\n if (ModelService.isMultiChannel(device.getModelName())) {\n return (\n <Channels\n device={device as PearlMasterDeviceModel}\n streamingDestinations={streamingDestinations}\n selectable={selectable}\n getDeviceById={getDeviceById}\n currentUserRole={currentUserRole}\n hasEvent={hasEvent}\n checkIsDeviceSelected={checkIsDeviceSelected}\n toggleDeviceSelection={toggleDeviceSelection}\n onChangeStreamingDestination={onChangeStreamingDestination}\n />\n );\n }\n\n switch (device.getModelName()) {\n case DeviceModel.LiveScrypt:\n return (\n <TranscribeDeviceDetails\n device={device}\n currentUserRole={currentUserRole}\n checkIsDeviceSelected={checkIsDeviceSelected}\n />\n );\n case DeviceModel.Webcaster:\n return (\n <WebcasterDeviceDetails\n device={device}\n streamingDestinations={streamingDestinations}\n currentUserRole={currentUserRole}\n getDeviceById={getDeviceById}\n checkIsDeviceSelected={checkIsDeviceSelected}\n onChangeStreamingDestination={onChangeStreamingDestination}\n />\n );\n case DeviceModel.Demo:\n return (\n <DemoDeviceDetails\n device={device}\n currentUserRole={currentUserRole}\n checkIsDeviceSelected={checkIsDeviceSelected}\n />\n );\n default:\n return null;\n }\n },\n);\n","/* eslint-disable jsx-a11y/no-noninteractive-tabindex */\nimport React, {useCallback} from 'react';\nimport classNames from 'classnames';\nimport {Stack} from '@mui/material';\nimport {SelectCheckbox} from 'app/components/FleetManager/DeviceCard/SelectCheckbox';\nimport {StatusList} from 'app/components/FleetManager/DeviceCard/StatusList';\nimport {ContextMenu} from 'app/components/FleetManager/DeviceCard/ContextMenu';\nimport {DetailsToggler} from 'app/components/sharedReactComponents/DetailsToggler';\nimport {OverflowTooltip} from 'app/components/sharedReactComponents/OverflowTooltip/OverflowTooltip';\nimport {noop} from 'app/util/noop';\nimport {router} from 'app/router/main';\nimport {Tooltip, TOOLTIP_PLACEMENT} from 'app/components/sharedReactComponents/Tooltip';\nimport {UpgradeToProTooltip} from 'app/components/FleetManager/UpgradeToProTooltip';\nimport {THEME} from 'app/constants';\nimport {useToggle} from 'app/hooks/useToggle';\nimport {Callback, ClassName, DataId, TimeStampSeconds} from 'app/types/common';\nimport {EventInfo} from 'app/components/sharedReactComponents/Events/shared/EventInfo/EventInfo';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {PearlMasterDeviceModel} from 'app/components/DeviceDetails/Models/PearlMasterDeviceModel';\nimport {DeviceDetails} from 'app/components/FleetManager/DeviceCard/DeviceDetails/DeviceDetails';\nimport {FleetManagerColumn} from 'app/components/FleetManager/types';\nimport {AnyStreamingDestinationModelType} from 'app/components/StreamingServices/types';\nimport {ModelService} from 'app/services/deviceModel/DeviceModelService';\nimport {useDeviceStatus} from 'app/components/FleetManager/DeviceCard/useStatusProgress';\nimport {isOngoing, isScheduled} from 'app/domain/schedule/utils';\nimport {Schedule} from 'app/domain/schedule';\nimport {isNil} from 'app/util/isNil';\nimport {UnifyConnection} from 'app/components/sharedReactComponents/UnifyConnection/UnifyConnection';\nimport {UserRole} from 'app/models/PermissionsModel/types';\nimport {Edge} from 'app/domain/edge';\n\ninterface DeviceNameProps extends DataId {\n device: AnyDeviceModelType;\n}\n\nconst DeviceName: React.FC<DeviceNameProps> = React.memo(({device, dataId}) => {\n const detailsUrl = getDetailsUrl(device);\n\n return (\n <a className=\"device-card__name-link\" href={detailsUrl}>\n <OverflowTooltip dataId={dataId}>{device.getName()}</OverflowTooltip>\n </a>\n );\n});\n\ninterface Props extends ClassName, DataId {\n device: AnyDeviceModelType;\n role: UserRole;\n groups: Edge.Group[];\n presets: Edge.TeamPreset[];\n event?: Schedule.Event;\n\n columns: FleetManagerColumn[];\n streamingDestinations?: AnyStreamingDestinationModelType[];\n selectable?: boolean;\n opened?: boolean;\n\n getDeviceById: (id: string) => AnyDeviceModelType | undefined;\n onApplyPreset: (preset: Edge.TeamPreset) => Promise<void>;\n onMoveToGroup: (groupId: string) => Promise<void>;\n onRemoveFromGroup: (device: AnyDeviceModelType) => Promise<void>;\n onStartProject?: () => Promise<void>;\n onStopProject?: () => Promise<void>;\n onDelete: () => Promise<void>;\n\n checkIsDeviceSelected?: Callback;\n toggleDeviceSelection?: Callback;\n unpairAction?: Callback;\n onChangeStreamingDestination?: Callback;\n}\n\nexport function DeviceCard({\n dataId,\n role,\n device,\n groups,\n className,\n event,\n presets,\n\n columns,\n streamingDestinations = [],\n selectable = true,\n opened = true,\n\n getDeviceById,\n onApplyPreset,\n onMoveToGroup,\n onRemoveFromGroup,\n onStartProject,\n onStopProject,\n onDelete,\n\n checkIsDeviceSelected = () => false,\n toggleDeviceSelection = noop,\n unpairAction = noop,\n onChangeStreamingDestination = noop,\n}: Props) {\n const [detailsOpened, toggleDetailsOpened] = useToggle(opened);\n\n const deviceId = device.getId();\n\n const handleChangeSelect = useCallback(() => {\n toggleDeviceSelection(device);\n }, [device, toggleDeviceSelection]);\n\n const selected = selectable && checkIsDeviceSelected(deviceId);\n\n // Stylize as Selected if some Channel-device selected\n let indeterminateSelected = false;\n let allChildDevicesSelected = false;\n\n if (ModelService.isMultiChannel(device.getModelName())) {\n const channels = (device as PearlMasterDeviceModel).getChanelModels();\n\n if (channels.length > 0) {\n const selectedDevices = channels.filter((device) => checkIsDeviceSelected(device.getId()));\n\n allChildDevicesSelected = selectedDevices.length === channels.length;\n indeterminateSelected = selectedDevices.length > 0 && allChildDevicesSelected === false;\n }\n }\n\n const detailsAvailable = isDetailsAvailable(device);\n\n const {batch} = device.capabilities;\n const isDeviceSelectable = selectable && batch;\n\n const status = useDeviceStatus(device);\n\n const hasOngoingEvent = !isNil(event) && isOngoing(event.status);\n\n const handleRemoveFromGroup = async () => {\n if (!device.getGroupId()) {\n return;\n }\n\n await onRemoveFromGroup(device);\n };\n\n return (\n <div\n data-id={dataId}\n className={classNames(\n 'device-card',\n {\n 'device-card--offline': device.isOffline(),\n 'device-card--selectable': selectable,\n 'device-card--selected': selected || indeterminateSelected || allChildDevicesSelected,\n },\n className,\n )}\n tabIndex={selectable ? 0 : undefined}\n >\n {status.showProgress && (\n <UnifyConnection dataId=\"unify_status_progress\" value={status.progress} />\n )}\n\n <div className=\"device-card__container\">\n <div className=\"device-card__content\">\n <div className=\"device-card__select\">\n <Tooltip\n content={\n !batch && device.isOnline() && !device.isUnpaired() ? (\n <UpgradeToProTooltip canEdit={role.canEditBilling()} />\n ) : (\n ''\n )\n }\n interactive={true}\n trigger=\"click\"\n placement={TOOLTIP_PLACEMENT.BOTTOM}\n theme={THEME.WHITE}\n >\n <SelectCheckbox\n data-id=\"device_card_checkbox\"\n selected={selected}\n indeterminate={indeterminateSelected}\n disabled={!isDeviceSelectable}\n onChange={handleChangeSelect}\n />\n </Tooltip>\n </div>\n\n <div className=\"device-card__name\">\n <DeviceName dataId=\"device_card_name\" device={device} />\n </div>\n\n <StatusList columns={columns} device={device} role={role} progress={status?.progress} />\n\n <Stack direction=\"row\" alignItems=\"center\" minWidth={70}>\n <ContextMenu\n className=\"device-card__context-menu\"\n device={device}\n groups={groups}\n presets={presets}\n permitPreset={role.canApplyPresets()}\n permitReboot={role.canRebootDevices()}\n permitUnify={role.canManageUnify()}\n onApplyPreset={onApplyPreset}\n onMoveToGroup={onMoveToGroup}\n onStartProject={onStartProject}\n onStopProject={onStopProject}\n onRemoveFromGroup={handleRemoveFromGroup}\n unpairAction={unpairAction}\n onDelete={onDelete}\n />\n\n <div className=\"device-card__toggler\" data-id=\"device_card_toggler\">\n {detailsAvailable && (\n <DetailsToggler\n className=\"device-card__details-toggler\"\n opened={detailsOpened}\n onClick={toggleDetailsOpened}\n />\n )}\n </div>\n </Stack>\n </div>\n\n {event && (\n <EventInfo\n sx={{ml: 3.5, maxWidth: 500}}\n event={event}\n showTime={true}\n deviceId={device.getId()}\n label={isScheduled(event.status) ? 'Starts in' : undefined}\n />\n )}\n\n {detailsOpened && detailsAvailable && (\n <div className=\"device-card__details\">\n <DeviceDetails\n device={device}\n hasEvent={hasOngoingEvent}\n streamingDestinations={streamingDestinations}\n selectable={selectable}\n getDeviceById={getDeviceById}\n role={role}\n checkIsDeviceSelected={checkIsDeviceSelected}\n toggleDeviceSelection={toggleDeviceSelection}\n onChangeStreamingDestination={onChangeStreamingDestination}\n />\n </div>\n )}\n </div>\n </div>\n );\n}\n\nfunction getDetailsUrl(device: AnyDeviceModelType): string {\n const deviceId = device.getId();\n\n if (ModelService.isLivescrypt(device.getModelName())) {\n return router.url('transcribeDeviceDetails', {deviceId});\n }\n\n if (ModelService.isUnify(device.getModelName())) {\n return router.url('projectDetails', {deviceId});\n }\n\n return router.url('deviceDetails', {deviceId});\n}\n\nexport function getUnifyUpdateTimestamp(device: AnyDeviceModelType): TimeStampSeconds | undefined {\n if (device instanceof PearlMasterDeviceModel) {\n const status = device.getStatus();\n\n if (status === 'starting') {\n return device.createdAt;\n }\n\n if (status === 'resuming') {\n return device.updatedAt;\n }\n }\n}\n\nfunction isDetailsAvailable(device: AnyDeviceModelType): boolean {\n const online = device.isOnline();\n\n if (ModelService.isMultiChannel(device.getModelName())) {\n return (device as PearlMasterDeviceModel).hasChannels() && online;\n }\n\n return online;\n}\n","import React, {useEffect, useState} from 'react';\nimport {observer} from 'mobx-react';\nimport classNames from 'classnames';\nimport {ColumnsSelector} from 'app/components/FleetManager/ColumnsHeader/ColumnsSelector';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\nimport {\n closestCenter,\n DndContext,\n KeyboardSensor,\n PointerSensor,\n useSensor,\n useSensors,\n} from '@dnd-kit/core';\nimport {\n horizontalListSortingStrategy,\n SortableContext,\n sortableKeyboardCoordinates,\n useSortable,\n} from '@dnd-kit/sortable';\nimport {CSS} from '@dnd-kit/utilities';\nimport type {DragEndEvent} from '@dnd-kit/core';\nimport {restrictToParentElement} from '@dnd-kit/modifiers';\nimport {Callback, ClassName} from 'app/types/common';\nimport {FleetManagerColumnId} from 'app/components/FleetManager/constants';\nimport {FleetManagerColumn} from 'app/components/FleetManager/types';\n\ninterface RearrangeColumnListProps extends ClassName {\n columns: FleetManagerColumn[];\n fixedColumnIds: FleetManagerColumnId[];\n onChange: (columnId: string, nextIndex: number) => void;\n}\n\nconst RearrangeColumnList: React.FC<RearrangeColumnListProps> = ({\n className,\n columns,\n fixedColumnIds,\n onChange,\n}) => {\n const [sortedColumns, setSortedColumns] = useState<FleetManagerColumn[]>([]);\n const ids = sortedColumns.map(({dataKey}) => dataKey);\n\n useEffect(() => {\n setSortedColumns(columns);\n }, [columns, fixedColumnIds]);\n\n const handleDragEnd = (event: DragEndEvent) => {\n const {active, over} = event;\n\n // dropped outside the list\n if (!over) {\n return;\n }\n\n if (active.id !== over.id) {\n onChange(active.id as FleetManagerColumnId, ids.indexOf(over.id as FleetManagerColumnId));\n }\n };\n\n const sensors = useSensors(\n useSensor(PointerSensor),\n useSensor(KeyboardSensor, {\n coordinateGetter: sortableKeyboardCoordinates,\n }),\n );\n\n return (\n <DndContext\n autoScroll={false}\n sensors={sensors}\n collisionDetection={closestCenter}\n modifiers={[restrictToParentElement]}\n onDragEnd={handleDragEnd}\n >\n <SortableContext items={ids} strategy={horizontalListSortingStrategy}>\n <div className={classNames(className, 'rearrange-column-list')}>\n {sortedColumns.map((column, index) => (\n <Item\n key={column.dataKey}\n index={index}\n column={column}\n draggable={!fixedColumnIds.includes(column.dataKey)}\n />\n ))}\n </div>\n </SortableContext>\n </DndContext>\n );\n};\n\ninterface ItemProps {\n column: FleetManagerColumn;\n index: number;\n draggable: boolean;\n}\n\nfunction Item({column, index, draggable}: ItemProps) {\n if (draggable) {\n return <DraggableItem index={index} column={column} />;\n }\n\n return <ItemComponent column={column} />;\n}\n\ninterface DraggableItemProps {\n index: number;\n column: FleetManagerColumn;\n}\n\nfunction DraggableItem({column}: DraggableItemProps) {\n const {attributes, isDragging, listeners, setNodeRef, transform} = useSortable({\n id: column.dataKey,\n });\n\n const style = {\n transform: CSS.Translate.toString(transform),\n width: column.width,\n };\n\n return (\n <div\n ref={setNodeRef}\n className={classNames(\n 'rearrange-column-list__item',\n isDragging && 'rearrange-column-list__item--dragging',\n )}\n style={style}\n {...attributes}\n {...listeners}\n >\n {isDragging ? <DraggingItem label={column.label} /> : <ItemComponent column={column} />}\n </div>\n );\n}\n\nfunction DraggingItem({label}: {label: React.ReactNode}) {\n return <div className=\"rearrange-column-list__item-clone\">{label}</div>;\n}\n\nfunction ItemComponent({column}: {column: FleetManagerColumn}) {\n const {width, label, detailedLabel} = column;\n\n return (\n <div className=\"fleet-manager-columns-header__item\" style={{width}}>\n <Tooltip content={detailedLabel} delay={250}>\n {label}\n </Tooltip>\n </div>\n );\n}\n\ninterface Props {\n columns: FleetManagerColumn[];\n activeColumns: FleetManagerColumn[];\n fixedColumnIds: FleetManagerColumnId[];\n isColumnActive: Callback;\n withGroups: boolean;\n onChange: Callback;\n onChangeArrangement: (columnId: string, nextIndex: number) => void;\n}\n\nexport const ColumnsHeader = observer<React.VFC<Props>>(\n ({\n columns,\n activeColumns,\n fixedColumnIds,\n isColumnActive,\n withGroups,\n onChange,\n onChangeArrangement,\n }) => {\n const fixedColumns: FleetManagerColumn[] = [];\n const arrangedColumns: FleetManagerColumn[] = [];\n\n for (const activeColumn of activeColumns) {\n if (fixedColumnIds.includes(activeColumn.dataKey)) {\n fixedColumns.push(activeColumn);\n } else {\n arrangedColumns.push(activeColumn);\n }\n }\n\n if (fixedColumns[0]) {\n arrangedColumns.unshift(fixedColumns[0]);\n }\n\n return (\n <div\n className={classNames('fleet-manager-columns-header', {\n 'fleet-manager-columns-header--with-groups': withGroups,\n })}\n >\n <div className=\"fleet-manager-columns-header__container\">\n <div className=\"fleet-manager-columns-header__content\">\n <div className=\"fleet-manager-columns-header__item fleet-manager-columns-header__item--name\">\n Name\n </div>\n\n <RearrangeColumnList\n className=\"fleet-manager-columns-header__rearrange-column-list\"\n columns={arrangedColumns}\n fixedColumnIds={fixedColumnIds}\n onChange={onChangeArrangement}\n />\n\n {fixedColumns[1] && <ItemComponent column={fixedColumns[1]} />}\n\n <div className=\"fleet-manager-columns-header__item fleet-manager-columns-header__item--actions\">\n <ColumnsSelector\n columns={columns}\n fixedColumnIds={fixedColumnIds}\n isColumnActive={isColumnActive}\n onChange={onChange}\n />\n </div>\n </div>\n </div>\n </div>\n );\n },\n);\n\nColumnsHeader.displayName = 'ColumnsHeader';\n","import {FleetManagerColumn} from 'app/components/FleetManager/types';\nimport {\n statusCell,\n healthCell,\n storageCell,\n transferQueueCell,\n accessCell,\n hostNameCell,\n} from 'app/components/FleetManager/cells';\nimport {FleetManagerColumnId} from 'app/components/FleetManager/constants';\nimport {useColumnActiveManager} from 'app/components/FleetManager/useColumnActiveManager';\nimport {useColumnArrangementManager} from 'app/components/FleetManager/useColumnArrangementManager';\nimport {Callback} from 'app/types/common';\n\nconst defaultActiveColumns: FleetManagerColumnId[] = [\n FleetManagerColumnId.Status,\n FleetManagerColumnId.HostName,\n FleetManagerColumnId.Storage,\n FleetManagerColumnId.TransferQueue,\n FleetManagerColumnId.Access,\n];\n\nconst fixedColumns: FleetManagerColumnId[] = [\n FleetManagerColumnId.Status,\n FleetManagerColumnId.Access,\n];\n\ninterface Return {\n columns: FleetManagerColumn[];\n arrangedColumns: FleetManagerColumn[];\n fixedColumns: FleetManagerColumnId[];\n isColumnActive: Callback<boolean, [string]>;\n onChange: Callback;\n onChangeArrangement: Callback;\n}\n\nconst storeKey = 'UnifyManager.Columns';\n\nconst columns = [\n statusCell({\n width: 110,\n }),\n hostNameCell(),\n storageCell(),\n transferQueueCell(),\n healthCell({\n detailedLabel: 'Project health',\n }),\n accessCell(),\n];\n\nexport function useUnifyMangerColumns(): Return {\n const {activeColumns, isColumnActive, handleColumnsSelectorChange} = useColumnActiveManager({\n storeKey,\n columns,\n fixedColumns,\n defaultActiveColumns,\n });\n\n const {arrangedColumns, handleColumnsChangeArrangement} = useColumnArrangementManager({\n storeKey,\n columns,\n activeColumns,\n });\n\n return {\n columns,\n arrangedColumns,\n fixedColumns,\n isColumnActive,\n onChange: handleColumnsSelectorChange,\n onChangeArrangement: handleColumnsChangeArrangement,\n };\n}\n","import React, {ComponentProps, memo, useMemo, useState} from 'react';\nimport {Icons} from 'app/util/icons';\nimport {ContextMenu, ContextMenuItem} from 'app/components/sharedReactComponents/ContextMenu';\nimport {SIZE, THEME} from 'app/constants';\nimport {BatchActionButton} from 'app/components/FleetManager/BatchActionsPanel/BatchActionButton';\nimport {Callback, ClassName} from 'app/types/common';\nimport {AnyDeviceModelType} from 'app/components/DeviceDetails/Models/Fabric';\nimport {pluralizeN} from 'app/components/helpers/commonHelpers';\nimport {ModelService} from 'app/services/deviceModel/DeviceModelService';\nimport {ApplyPresetToDevicesDialog} from 'app/components/dialogs/ApplyPresetToDevicesDialog/ApplyPresetToDevicesDialog';\nimport {Edge} from 'app/domain/edge';\nimport {RebootDevicesDialog} from 'app/components/dialogs/RebootDevicesDialog/RebootDevicesDialog';\nimport {ProjectsSwitcherDialog} from 'app/components/dialogs/ProjectsSwitcherDialog/ProjectsSwitcherDialog';\nimport {Cloud} from 'app/domain/cloud';\nimport {DeleteProjectsDialog} from 'app/components/dialogs/DeleteProjectsDialog/DeleteProjectsDialog';\nimport {DeleteDevicesDialog} from 'app/components/dialogs/DeleteDevicesDialog/DeleteDevicesDialog';\n\ninterface Props extends ClassName {\n devices: AnyDeviceModelType[];\n presets: Edge.TeamPreset[];\n isUnify?: boolean;\n permitPreset: boolean;\n permitReboot: boolean;\n canStart: boolean;\n onApplyPreset: (preset: Edge.TeamPreset, devices: string[]) => Promise<void>;\n onStartProjects?: (projectIds: string[]) => Promise<void>;\n onStopProjects?: (projectIds: string[]) => Promise<void>;\n onDelete: (deviceIds: string[]) => Promise<void>;\n unpairAction: Callback;\n}\n\ntype ProjectAction = ComponentProps<typeof ProjectsSwitcherDialog>['action'];\n\nexport const BatchActionContextMenu = memo(\n ({\n className,\n devices,\n isUnify = false,\n presets,\n permitReboot,\n permitPreset,\n canStart,\n onApplyPreset,\n onStartProjects,\n onStopProjects,\n onDelete,\n unpairAction,\n }: Props) => {\n const [presetDialog, setPresetDialog] = useState(false);\n const [rebootDialog, setRebootDialog] = useState(false);\n const [projectDialog, setProjectDialog] = useState(false);\n const [deleteDialog, setDeleteDialog] = useState(false);\n\n const [projectAction, setProjectAction] = useState<ProjectAction>('start');\n\n const masters = useMemo(\n () => devices.filter((d) => !ModelService.isChannel(d.getModelName())),\n [devices],\n );\n\n const onlineMasters = useMemo(\n () => masters.filter((d) => d.isOnline() && !ModelService.isChannel(d.getModelName())),\n [masters],\n );\n\n const presetUnits = useMemo(\n () => onlineMasters.filter((device) => device.capabilities.presets),\n [onlineMasters],\n );\n\n const presetModel = useMemo<Cloud.UnitModel | undefined>(() => {\n const models = new Set(presetUnits.map((d) => d.getModelName()));\n\n return models.size === 1 ? [...models.values()][0] : undefined;\n }, [presetUnits]);\n\n const rebootUnits = useMemo(\n () => onlineMasters.filter((device) => device.capabilities.reboot),\n [onlineMasters],\n );\n\n const hasOffline = presetUnits.some((device) => device.isOffline());\n\n const {online: onlineProjects, offline: offlineProjects} = useMemo(() => {\n const projects = devices.filter((device) => ModelService.isUnify(device.getModelName()));\n\n return projects.reduce<Record<'online' | 'offline', AnyDeviceModelType[]>>(\n (acc, project) => {\n if (project.isOnline()) {\n const {online} = acc;\n return {...acc, online: [...online, project]};\n }\n\n if (project.isDown()) {\n const {offline} = acc;\n return {...acc, offline: [...offline, project]};\n }\n\n return acc;\n },\n {online: [], offline: []},\n );\n }, [devices]);\n\n const projectNames = (projectAction === 'start' ? offlineProjects : onlineProjects).map((d) =>\n d.getName(),\n );\n\n const handleReboot = async () => {\n await Promise.allSettled(rebootUnits.map((d) => d.sendRebootCommand()));\n setRebootDialog(false);\n };\n\n const handleApply = async (preset: Edge.TeamPreset) => {\n await onApplyPreset(\n preset,\n presetUnits.map((d) => d.getId()),\n );\n setPresetDialog(false);\n };\n\n const handleSwitch = async (action: ProjectAction) => {\n if (action === 'start') {\n await onStartProjects?.(offlineProjects.map((p) => p.getId()));\n } else {\n await onStopProjects?.(onlineProjects.map((p) => p.getId()));\n }\n\n setProjectDialog(false);\n };\n\n const handleDelete = async () => {\n await onDelete(masters.map((d) => d.getId()));\n setDeleteDialog(false);\n };\n\n const hasProjects = onlineProjects.length > 0 || offlineProjects.length > 0;\n\n const projectOptions: ContextMenuItem[] =\n isUnify && hasProjects\n ? [\n {\n icon: Icons.play().theme(THEME.PRIMARY).reactComponent(),\n itemDataId: 'context_menu_start_virtual_device',\n label: `Start ${pluralizeN('project', offlineProjects.length)}`,\n visible: offlineProjects.length > 0 && canStart,\n action: () => {\n setProjectAction('start');\n setProjectDialog(true);\n },\n },\n {\n icon: Icons.stop().theme(THEME.SUCCESS).reactComponent(),\n itemDataId: 'context_menu_start_virtual_stop',\n label: `Stop ${pluralizeN('project', onlineProjects.length)}`,\n visible: onlineProjects.length > 0,\n action: () => {\n setProjectAction('stop');\n setProjectDialog(true);\n },\n },\n {\n separator: true,\n },\n ]\n : [];\n\n return (\n <div className={className}>\n <ContextMenu\n items={[\n ...projectOptions,\n {\n label: 'Apply preset',\n itemDataId: 'context_menu_apply_preset_action',\n icon: Icons.selectPreset().reactComponent(),\n danger: true,\n disabled: hasOffline || !permitPreset || !presetModel,\n title: getTooltip(hasOffline, presetModel),\n action: () => setPresetDialog(true),\n },\n {\n label: 'Delete',\n itemDataId: 'context_menu_delete_action',\n icon: Icons.trash().reactComponent(),\n disabled: isDisabled(canDelete, devices),\n danger: true,\n action: () => {\n setDeleteDialog(true);\n },\n },\n ...(isUnify\n ? []\n : [\n {\n label: 'Unpair',\n itemDataId: 'context_menu_unpair_action',\n icon: Icons.unlink().reactComponent(),\n disabled: isDisabled(canUnpair, devices),\n danger: true,\n action: () => unpairAction(filter(canUnpair, devices)),\n },\n {\n label: 'Reboot',\n itemDataId: 'context_menu_reboot_action',\n icon: Icons.retry().reactComponent(),\n danger: true,\n disabled: !permitReboot || !rebootUnits.length,\n action: () => setRebootDialog(true),\n },\n ]),\n ]}\n >\n <BatchActionButton\n className=\"batch-action-context-menu__button\"\n data-id=\"batch_action_context_menu_button\"\n >\n {Icons.ellipsis().size(SIZE.S).reactComponent()}\n </BatchActionButton>\n </ContextMenu>\n\n {presetModel && (\n <ApplyPresetToDevicesDialog\n open={presetDialog}\n unitCount={presetUnits.length}\n model={presetModel}\n presets={presets}\n rebootWarning={!isUnify}\n onApply={handleApply}\n onClose={() => setPresetDialog(false)}\n />\n )}\n\n {isUnify ? (\n <>\n <ProjectsSwitcherDialog\n open={projectDialog}\n names={masters.map((d) => d.getName())}\n action={projectAction}\n onSwitch={handleSwitch}\n onClose={() => setProjectDialog(false)}\n />\n\n <DeleteProjectsDialog\n open={deleteDialog}\n names={projectNames}\n onDelete={handleDelete}\n onClose={() => setDeleteDialog(false)}\n />\n </>\n ) : (\n <>\n <RebootDevicesDialog\n open={rebootDialog}\n names={rebootUnits.map((r) => r.getName())}\n onReboot={handleReboot}\n onClose={() => setRebootDialog(false)}\n />\n\n <DeleteDevicesDialog\n open={deleteDialog}\n names={masters.map((d) => d.getName())}\n lvsOnly={masters.every((m) => ModelService.isLivescrypt(m.getModelName()))}\n onDelete={handleDelete}\n onClose={() => setDeleteDialog(false)}\n />\n </>\n )}\n </div>\n );\n },\n);\n\nfunction canDelete(device: AnyDeviceModelType) {\n return ModelService.isChannel(device.getModelName()) === false;\n}\n\nfunction canUnpair(device: AnyDeviceModelType) {\n return device.isUnpaired() === false && ModelService.isChannel(device.getModelName()) === false;\n}\n\nfunction isDisabled(checkCallback, devices: AnyDeviceModelType[]) {\n return devices.some((device) => checkCallback(device)) === false;\n}\n\nfunction filter(checkCallback, devices: AnyDeviceModelType[]) {\n return devices.filter((device) => checkCallback(device));\n}\n\nfunction getTooltip(hasOffline: boolean, model?: Cloud.UnitModel): string | undefined {\n if (hasOffline) {\n return \"Can't be applied for offline devices\";\n }\n\n if (!model) {\n return 'Please select devices of the same model';\n }\n}\n","import React, {useState} from 'react';\nimport {\n Box,\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n TextField,\n Typography,\n} from '@mui/material';\nimport {Controller, useForm} from 'react-hook-form';\nimport {z} from 'zod';\nimport {zodResolver} from '@hookform/resolvers/zod';\nimport {LoadingButton} from '@mui/lab';\nimport {Prompt} from 'app/types/common';\nimport {useMounted} from 'app/hooks/useIsMounted';\nimport {isNil} from 'app/util/isNil';\nimport {formatPrice} from 'app/util/prices';\n\nconst scheme = z.object({\n name: z.string().trim().min(1, {message: 'Required field'}),\n});\n\ntype Form = z.infer<typeof scheme>;\n\ntype Props = {\n loading: boolean;\n price?: number;\n onCreate: (name: string) => Promise<void>;\n onClose: () => void;\n};\n\nfunction CreateProject({loading, price, onCreate, onClose}: Props) {\n const {control, handleSubmit} = useForm<Form>({\n defaultValues: {name: ''},\n mode: 'onChange',\n resolver: zodResolver(scheme),\n });\n\n const handleCreate = async ({name}: Form) => {\n await onCreate(name);\n };\n\n return (\n <Box>\n <DialogTitle>Create a new Unify project</DialogTitle>\n\n <DialogContent>\n <Typography mb={1}>Epiphan Unify will create and run a new project for you.</Typography>\n\n <Box component=\"form\" id=\"create-project\" onSubmit={handleSubmit(handleCreate)}>\n <Controller\n control={control}\n name=\"name\"\n render={({field, fieldState: {error}}) => (\n <TextField\n {...field}\n inputProps={{'data-id': 'project-name-input'}}\n autoFocus={true}\n variant=\"standard\"\n label=\"Name\"\n placeholder=\"Enter your project name\"\n fullWidth={true}\n helperText={error?.message ?? ' '}\n error={!isNil(error)}\n />\n )}\n />\n </Box>\n\n {!isNil(price) && (\n <Typography>\n Every project costs <strong>${formatPrice(price)}</strong> per each running hour (when\n project is active).\n <br />\n You can activate or deactivate projects as needed.\n </Typography>\n )}\n </DialogContent>\n\n <DialogActions>\n <LoadingButton\n data-id=\"confirm-create-btn\"\n type=\"submit\"\n variant=\"contained\"\n color=\"secondary\"\n form=\"create-project\"\n loading={loading}\n disableRipple={false}\n >\n Create\n </LoadingButton>\n\n <Button\n data-id=\"cancel-create-btn\"\n variant=\"outlined\"\n color=\"info\"\n disableRipple={false}\n onClick={onClose}\n >\n Cancel\n </Button>\n </DialogActions>\n </Box>\n );\n}\n\ntype PromptProps = Prompt & Omit<Props, 'loading'>;\n\nexport function CreateProjectDialog({open, price, onCreate, onClose}: PromptProps) {\n const mounted = useMounted();\n const [loading, setLoading] = useState(false);\n\n const handleCreate = async (name: string) => {\n try {\n setLoading(true);\n await onCreate(name);\n } finally {\n if (mounted()) {\n setLoading(false);\n }\n }\n };\n\n return (\n <Dialog fullWidth={true} maxWidth=\"sm\" open={open} onClose={onClose}>\n <CreateProject price={price} loading={loading} onCreate={handleCreate} onClose={onClose} />\n </Dialog>\n );\n}\n","import {front} from 'app/api/CirrusApi';\nimport {GetAbortCallback} from 'app/api/types';\n\nexport class MeetingsApiService {\n static async getMeeting(\n id: string,\n getAbort?: GetAbortCallback,\n ): Promise<Contracts.Connect.Meeting> {\n return front.econnect().meetings(id).get(undefined, {getAbort});\n }\n\n static async getMeetings(\n active: boolean,\n getAbort?: GetAbortCallback,\n ): Promise<{meetings: Contracts.Connect.Meeting[]}> {\n return front.econnect().meetings().get({active}, {getAbort});\n }\n\n static async connectToMeeting(\n data: Payloads.Connect.Meeting,\n ): Promise<{meeting: Contracts.Connect.Meeting}> {\n return front.econnect().meetings().post(data);\n }\n\n static async createHosted(name: string): Promise<void> {\n return front.econnect().calls().teams().post({name});\n }\n\n static async deleteCall(id: string): Promise<void> {\n return front.econnect().calls().teams(id).delete();\n }\n\n static async deleteMeeting(id: string): Promise<void> {\n return front.econnect().meetings(id).delete();\n }\n\n static async connect(id: string): Promise<void> {\n return front.econnect().meetings(id).connect().post();\n }\n\n static async disconnect(id: string): Promise<void> {\n return front.econnect().meetings(id).disconnect().post();\n }\n\n static async getParticipant(\n meetingId: string,\n participantId: string,\n getAbort?: GetAbortCallback,\n ): Promise<Contracts.Connect.Participant> {\n return front\n .econnect()\n .meetings(meetingId)\n .participants(participantId)\n .get(undefined, {getAbort});\n }\n\n static async getReturnFeed(\n meetingId: string,\n getAbort?: GetAbortCallback,\n ): Promise<Contracts.Connect.ReturnFeed> {\n return front.econnect().meetings(meetingId).injection().get(undefined, {getAbort});\n }\n\n static async getTenants(\n getAbort?: GetAbortCallback,\n ): Promise<Contracts.Connect.Auth.TeamsTenant[]> {\n return front.econnect().ms_tenants().get(undefined, {getAbort});\n }\n\n static async getTenantHealth(\n getAbort?: GetAbortCallback,\n ): Promise<Contracts.Connect.Auth.TeamsTenant[]> {\n return front.econnect().ms_tenants().health().get(undefined, {getAbort});\n }\n\n static async disconnectTenant(tenantId: string) {\n return front.econnect().ms_tenants(tenantId).delete();\n }\n\n static async setName(id: string, name: string): Promise<void> {\n return front.econnect().meetings(id).put({name});\n }\n\n static async getLink(): Promise<{link: string}> {\n return front.econnect().shareable_link().get();\n }\n\n static async getCalls(): Promise<Contracts.Connect.Calls> {\n return front.econnect().calls().teams().get({active: true});\n }\n\n static async setPasscode(id: string, data: Payloads.Connect.Password): Promise<any> {\n return front.econnect().meetings(id).password().put(data);\n }\n\n static async getZoomAccounts(): Promise<Contracts.Connect.Auth.ZoomAccount[]> {\n return front.econnect().zoomAccounts().get();\n }\n\n static async shareZoom(id: string, body: Payloads.Connect.ShareZoom): Promise<void> {\n return front.econnect().zoomAccounts(id).share().put(body);\n }\n\n static async signOutZoom(id: string): Promise<any> {\n return front.econnect().zoomAccounts(id).delete();\n }\n\n static async setZoomAccount(id: string, data: Payloads.Connect.ZoomAccount) {\n return front.econnect().meetings(id).account().put(data);\n }\n}\n","import {isNil} from 'app/util/isNil';\n\nexport function arrayToMap<\n Entity extends Record<string, any>,\n Key extends keyof Entity\n>(\n arr: Entity[],\n key: Key,\n): Map<Entity[Key], Entity> {\n const pairs = arr.map<[Entity[Key], Entity]>((entity) => {\n return [entity[key], entity];\n });\n\n return new Map(pairs.filter(([key]) => !isNil(key)));\n}\n","import {makeAutoObservable} from 'mobx';\nimport {Participant} from 'app/store/models/connect/Participant/Participant';\nimport {Callback, TimeStampSeconds} from 'app/types/common';\nimport {arrayToMap} from 'app/util/arrayToMap';\nimport {ReturnFeed} from 'app/store/models/connect/ReturnFeed/ReturnFeed';\n\nexport interface MeetingArgs {\n id: string;\n name: string;\n tenantName: string;\n tenantId: string;\n platform: App.Connect.Platform;\n permission?: App.Connect.Permission;\n url: string;\n host?: string;\n status: App.Connect.MeetingStatus;\n createdAt: TimeStampSeconds;\n startedAt?: TimeStampSeconds;\n disconnectedAt?: TimeStampSeconds;\n deletedAt?: TimeStampSeconds;\n isolatedAudio: boolean;\n error: string;\n version?: string;\n settings?: App.Connect.MeetingSettings;\n externalId?: string;\n}\n\ninterface SrtEntity {\n id: string;\n name: string;\n port: number;\n}\n\nexport type Entity = Participant | ReturnFeed;\n\nexport class Meeting implements MeetingArgs {\n id: string;\n name: string;\n url: string;\n host?: string;\n platform: App.Connect.Platform;\n status: App.Connect.MeetingStatus;\n permission?: App.Connect.Permission;\n createdAt: TimeStampSeconds;\n startedAt?: TimeStampSeconds;\n disconnectedAt?: TimeStampSeconds;\n deletedAt?: TimeStampSeconds;\n isolatedAudio: boolean;\n error: string;\n tenantId: string;\n tenantName: string;\n version?: string;\n settings?: App.Connect.MeetingSettings;\n feed?: ReturnFeed;\n externalId?: string;\n\n private members: Map<string, Participant> = new Map();\n\n constructor(data: MeetingArgs, participants: Participant[] = [], feed?: ReturnFeed) {\n this.id = data.id;\n this.name = data.name;\n this.permission = data.permission;\n this.status = data.status;\n this.host = data.host;\n this.url = data.url;\n this.platform = data.platform;\n this.isolatedAudio = data.isolatedAudio;\n this.createdAt = data.createdAt;\n this.startedAt = data.startedAt;\n this.disconnectedAt = data.disconnectedAt;\n this.deletedAt = data.deletedAt;\n this.error = data.error;\n this.tenantName = data.tenantName;\n this.tenantId = data.tenantId;\n this.members = arrayToMap(participants, 'id');\n this.version = data.version;\n this.settings = data.settings;\n this.feed = feed;\n this.externalId = data.externalId;\n makeAutoObservable(this, {}, {autoBind: true});\n }\n\n setVersion(v: string) {\n this.version = v;\n }\n\n get participants(): Participant[] {\n return [...this.members.values()].filter(\n (p) => p.state === 'joined' || p.state === 'left-with-stream',\n );\n }\n\n setParticipants(list: Participant[]) {\n this.members = arrayToMap(list, 'id');\n }\n\n getParticipants(predicate: Callback<boolean, [Participant, number, Participant[]]>) {\n return this.participants.filter(predicate);\n }\n\n get guests(): Participant[] {\n return this.getParticipants((p) => p.type === 'participant' && p.state === 'joined');\n }\n\n getParticipant(id: string): Participant | undefined {\n return this.members.get(id);\n }\n\n setParticipant(participant: Participant): void {\n this.members.set(participant.id, participant);\n }\n\n setReturnFeed(feed?: ReturnFeed) {\n this.feed = feed;\n }\n\n removeParticipant(id: string) {\n this.members.delete(id);\n }\n\n get listeners(): SrtEntity[] {\n return this.participants\n .filter((p) => p.stream.settings?.mode === 'listener')\n .map((p) => ({\n id: p.id,\n name: p.name,\n port: p.stream.settings?.port ?? 0,\n }));\n }\n\n checkLimit(): boolean {\n if (this.settings) {\n const active = this.participants.filter((p) => p.stream.active).length;\n return active < this.settings.extractionsLimit;\n }\n\n return false;\n }\n\n setName(name: string) {\n this.name = name;\n }\n\n get entities(): Entity[] {\n const all: Entity[] = [...this.participants];\n\n if (this.feed) {\n all.push(this.feed);\n }\n\n return all;\n }\n\n get tenant() {\n return this.tenantName;\n }\n\n get zoomId(): string {\n const id = this.externalId;\n const isZoom = this.platform === 'zoom';\n return id && isZoom ? `${id.slice(0, 3)} ${id.slice(3, 6)} ${id.slice(6)}` : '';\n }\n}\n","import {makeAutoObservable} from 'mobx';\nimport {SrtStream} from 'app/store/models/connect/SrtStream/SrtStream';\n\nexport interface ParticipantArgs {\n id: string;\n name: string;\n video: boolean;\n audio: boolean;\n individualAudio: boolean;\n share: boolean;\n type: App.Connect.ParticipantType;\n state: App.Connect.ParticipantState;\n version?: string;\n}\n\nexport class Participant {\n id: string;\n name: string;\n video: boolean;\n audio: boolean;\n state: App.Connect.ParticipantState;\n type: App.Connect.ParticipantType;\n stream: SrtStream;\n share: boolean;\n individualAudio: boolean;\n\n constructor(participant: ParticipantArgs, stream: SrtStream) {\n this.id = participant.id;\n this.name = participant.name;\n this.audio = participant.audio;\n this.individualAudio = participant.individualAudio;\n this.video = participant.video;\n this.type = participant.type;\n this.share = participant.share;\n this.state = participant.state;\n this.stream = stream;\n makeAutoObservable(this);\n }\n}\n","import {makeAutoObservable} from 'mobx';\n\nexport interface SrtStreamArgs {\n status: App.Connect.StreamStatus;\n error?: App.Connect.SteamError;\n settings?: App.Connect.StreamSettings;\n latency?: number;\n}\n\nexport class SrtStream {\n status: App.Connect.StreamStatus;\n error?: App.Connect.SteamError = undefined;\n settings?: App.Connect.StreamSettings;\n latency?: number;\n\n constructor({status, error, settings, latency}: SrtStreamArgs) {\n this.status = status;\n this.error = error;\n this.settings = settings;\n this.latency = latency;\n makeAutoObservable(this);\n }\n\n setSettings(settings: App.Connect.StreamSettings) {\n this.settings = settings;\n }\n\n get stopped() {\n return this.status === 'stopped';\n }\n\n get stopping() {\n return this.status === 'stopping';\n }\n\n get started() {\n return this.status === 'started';\n }\n\n get starting() {\n return this.status === 'starting';\n }\n\n get connected() {\n return this.status === 'connected';\n }\n\n get disconnected() {\n return this.status === 'disconnected';\n }\n\n get running() {\n return this.started || this.connected || this.disconnected;\n }\n\n get failed() {\n return this.status === 'error';\n }\n\n get active() {\n return !this.stopped;\n }\n\n get mute() {\n return this.settings?.mute;\n }\n\n get listener() {\n return this.settings?.mode === 'listener';\n }\n\n getActualLatency() {\n if (this.connected) {\n return this.latency ?? this.settings?.latency;\n }\n\n return this.settings?.latency;\n }\n}\n","import {makeAutoObservable} from 'mobx';\nimport {SrtStream} from 'app/store/models/connect/SrtStream/SrtStream';\n\ninterface ReturnFeedArgs {\n meetingId: string;\n enabled: boolean;\n owner?: App.Connect.ReturnFeedOwner;\n}\n\nexport class ReturnFeed {\n meetingId: string;\n stream: SrtStream;\n enabled: boolean;\n owner?: App.Connect.ReturnFeedOwner;\n\n constructor({enabled, meetingId, owner}: ReturnFeedArgs, stream: SrtStream) {\n this.meetingId = meetingId;\n this.stream = stream;\n this.enabled = enabled;\n this.owner = owner;\n makeAutoObservable(this);\n }\n}\n","import {Meeting, MeetingArgs} from 'app/store/models/connect/Meeting/Meeting';\nimport {Participant, ParticipantArgs} from 'app/store/models/connect/Participant/Participant';\nimport {isNil} from 'app/util/isNil';\nimport {SrtStream} from 'app/store/models/connect/SrtStream/SrtStream';\nimport {ReturnFeed} from 'app/store/models/connect/ReturnFeed/ReturnFeed';\nimport {isParticipantStreamSetting} from 'app/contracts/connect/utils';\nimport {ModelService} from 'app/services/deviceModel/DeviceModelService';\n\nfunction mapMeeting(\n contract: Contracts.Connect.Meeting,\n participants?: Participant[],\n returnFeed?: ReturnFeed,\n): Meeting {\n return new Meeting(mapMeetingContract(contract), participants, returnFeed);\n}\n\nfunction mapParticipant(contract: Contracts.Connect.Participant): Participant {\n const stream = mapStream(contract.stream);\n return new Participant(mapParticipantContract(contract), stream);\n}\n\nfunction mapReturnFeedOwner(\n contract?: Contracts.Connect.InjectionOwner,\n): App.Connect.ReturnFeedOwner | undefined {\n if (!isNil(contract)) {\n return {\n id: contract.meeting_id,\n name: contract.meeting_name,\n internal: contract.owned_by_team,\n };\n }\n}\n\nfunction mapReturnFeed(contract: Contracts.Connect.ReturnFeed): ReturnFeed {\n const {meeting_id, enabled, stream, injection_owner} = contract;\n const owner = mapReturnFeedOwner(injection_owner);\n return new ReturnFeed({meetingId: meeting_id, enabled, owner}, mapStream(stream));\n}\n\nfunction mapStreamSettings(\n settings: Contracts.Connect.StreamSettings<Contracts.Connect.StreamSetting>,\n): App.Connect.StreamSettings {\n const {mode, mute, setting} = settings;\n\n const {port, key_length, latency, protocol, stream_url, stream_key} = setting;\n\n const feed: App.Connect.FeedStreamSettings = {\n mode,\n mute,\n url: stream_url,\n key: stream_key,\n latency,\n size: key_length,\n port,\n protocol,\n };\n\n if (isParticipantStreamSetting(setting)) {\n const {video_setting, audio_setting} = setting;\n\n const participant: App.Connect.ParticipantStreamSettings = {\n ...feed,\n audio: {\n bitrate: audio_setting.bitrate,\n format: audio_setting.format,\n mode: audio_setting.channels === 2 ? 'stereo' : 'mono',\n },\n video: {\n bitrate: video_setting.bitrate,\n size: video_setting.frame_size,\n framerate: video_setting.framerate,\n },\n integration: setting.epiphan_device_configured,\n cloud: {\n deviceId: setting.stream_source.device_id,\n deviceName: setting.stream_source.device_name,\n sourceId: setting.stream_source.source_id,\n sourceName: setting.stream_source.source_name,\n type: setting.stream_source.device_type,\n },\n };\n\n return participant;\n }\n\n return feed;\n}\n\nfunction mapStream(contract: Contracts.Connect.Stream<Contracts.Connect.StreamSetting>) {\n const {status, error, settings, connection} = contract;\n\n return new SrtStream({\n status,\n error,\n latency: connection?.latency,\n settings: settings ? mapStreamSettings(settings) : undefined,\n });\n}\n\nfunction toFeedSettingsContract(\n settings: App.Connect.FeedStreamSettings,\n): Contracts.Connect.StreamSettings<Contracts.Connect.FeedStreamSetting> {\n return {\n mode: settings.mode,\n mute: {...settings.mute},\n setting: {\n stream_url: settings.url,\n port: settings.port,\n stream_key: settings.key,\n key_length: settings.size,\n latency: settings.latency,\n protocol: settings.protocol,\n },\n };\n}\n\nfunction toParticipantSettingsContract(\n settings: App.Connect.ParticipantStreamSettings,\n): Contracts.Connect.StreamSettings<Contracts.Connect.ParticipantStreamSetting> {\n return {\n mode: settings.mode,\n mute: {...settings.mute},\n setting: {\n audio_setting: {\n format: settings.audio.format,\n channels: settings.audio.mode === 'stereo' ? 2 : 1,\n bitrate: settings.audio.bitrate,\n },\n video_setting: {\n bitrate: settings.video.bitrate,\n framerate: settings.video.framerate,\n frame_size: settings.video.size,\n codec: 'H264',\n },\n stream_url: settings.url,\n port: settings.port,\n stream_key: settings.key,\n key_length: settings.size,\n latency: settings.latency,\n protocol: settings.protocol,\n epiphan_device_configured: settings.integration,\n stream_source: {\n device_id: settings.cloud.deviceId,\n device_name: settings.cloud.deviceName,\n source_id: settings.cloud.sourceId,\n source_name: settings.cloud.sourceName,\n device_type: settings.cloud.type,\n },\n },\n };\n}\n\nfunction mapMeetingContract(dto: Contracts.Connect.Meeting): MeetingArgs {\n const {\n id,\n name,\n kind,\n isolated_audio,\n created_at,\n started_at,\n permissions,\n disconnected_at,\n deleted_at,\n state,\n url,\n error,\n meeting_tenant_name,\n meeting_tenant_id,\n settings,\n hosted_call_id,\n external_id,\n } = dto;\n\n return {\n id,\n name,\n url,\n host: hosted_call_id,\n platform: kind,\n permission: permissions,\n createdAt: created_at,\n startedAt: started_at ?? undefined,\n disconnectedAt: disconnected_at ?? undefined,\n deletedAt: deleted_at ?? undefined,\n isolatedAudio: isolated_audio,\n error: error ?? '',\n status: state,\n tenantId: meeting_tenant_id,\n tenantName: meeting_tenant_name,\n settings: settings ? mapMeetingSettings(settings) : undefined,\n externalId: external_id,\n };\n}\n\nfunction mapMeetingSettings(\n contract: Contracts.Connect.MeetingSettings,\n): App.Connect.MeetingSettings {\n const {\n srt_ports_range,\n max_simultaneous_extractions,\n extractor_dns,\n automatic_disconnect_after,\n automatic_delete_after,\n } = contract;\n\n const [start, end] = srt_ports_range.split('-');\n\n const from = start ? Number(start) : 14000;\n const to = end ? Number(end) : 14100;\n\n return {\n dns: extractor_dns,\n extractionsLimit: max_simultaneous_extractions,\n timeouts: {\n delete: automatic_delete_after,\n disconnect: automatic_disconnect_after,\n },\n portRange: {\n from,\n to,\n },\n };\n}\n\nfunction mapParticipantContract(dto: Contracts.Connect.Participant): ParticipantArgs {\n const {\n id,\n name,\n sharing_screen,\n state,\n resource_type: type,\n video,\n audio,\n has_individual_audio,\n } = dto;\n\n return {\n id,\n type,\n state,\n name,\n video,\n audio,\n individualAudio: has_individual_audio,\n share: sharing_screen,\n };\n}\n\nfunction mapStreamingStatus(\n contract: Contracts.Connect.StreamingStatus,\n): App.Connect.StreamingStatus {\n const {audio_quality, video_quality, caller_address, streaming_parameters} = contract;\n\n return {\n callerAddress: caller_address,\n params: {\n latency: streaming_parameters.latency,\n packetsLost: streaming_parameters.packets_lost,\n },\n video: {\n receiving: {\n bitrate: video_quality.receiving_video_stream.bitrate,\n format: video_quality.receiving_video_stream.format,\n size: video_quality.receiving_video_stream.frame_size,\n framerate: video_quality.receiving_video_stream.framerate,\n },\n sending: {\n bitrate: video_quality.sending_video_stream.bitrate,\n format: video_quality.sending_video_stream.format,\n size: video_quality.sending_video_stream.frame_size,\n framerate: video_quality.sending_video_stream.framerate,\n },\n },\n audio: {\n receiving: {\n bitrate: audio_quality.receiving_audio_stream.bitrate,\n format: audio_quality.receiving_audio_stream.coding_format,\n mode: audio_quality.receiving_audio_stream.type,\n },\n sending: {\n bitrate: audio_quality.sending_audio_stream.bitrate,\n format: audio_quality.sending_audio_stream.coding_format,\n mode: audio_quality.sending_audio_stream.type,\n },\n },\n };\n}\n\nfunction mapCloudEntity(contract: Contracts.Connect.CloudEntity): App.Connect.CloudEntity {\n return {\n ...contract,\n type: ModelService.isUnify(contract.model) ? 'unify' : 'device',\n };\n}\n\nfunction mapCall(contract: Contracts.Connect.Call): App.Connect.Call {\n const {id, name, team_id, created_at, deleted_at, start_at, end_at, join_url} = contract;\n\n return {\n id,\n name,\n url: join_url,\n endAt: end_at,\n createdAt: created_at,\n deletedAt: deleted_at,\n startAt: start_at,\n teamId: team_id,\n };\n}\n\nfunction mapZoomAccount(c: Contracts.Connect.Auth.ZoomAccount): App.Connect.Auth.ZoomAccount {\n return {\n id: c.id,\n name: c.name,\n number: c.account_number,\n shared: c.team_shared,\n picture: c.picture_url,\n owner: c.user_id,\n ready: c.status === 'ok',\n };\n}\n\nfunction mapTeamsTenant(c: Contracts.Connect.Auth.TeamsTenant): App.Connect.Auth.TeamsTenant {\n return {\n id: c.id,\n name: c.name,\n teamId: c.team_id,\n available: c.healthy,\n };\n}\n\nexport const ConnectMapper = {\n mapMeeting,\n mapStream,\n mapReturnFeed,\n mapParticipant,\n mapStreamingStatus,\n toFeedSettingsContract,\n toParticipantSettingsContract,\n mapCloudEntity,\n mapCall,\n mapZoomAccount,\n mapTeamsTenant,\n};\n","type Contract = Contracts.Connect.ReturnFeed | Contracts.Connect.Participant;\nexport function isParticipantContract(\n contract: Contract,\n): contract is Contracts.Connect.Participant {\n return 'name' in contract;\n}\n\nexport function isParticipantStreamSetting(\n settings: Contracts.Connect.StreamSetting,\n): settings is Contracts.Connect.ParticipantStreamSetting {\n return 'audio_setting' in settings;\n}\n","import {useQuery} from '@tanstack/react-query';\nimport {MeetingsApiService} from 'app/services/api/meetings/MeetingsApiService';\nimport {ConnectMapper} from 'app/util/mappers/ConnectMapper/ConnectMapper';\n\ninterface Args {\n enabled: boolean;\n teamId: string;\n}\n\nasync function queryTenants(): Promise<Contracts.Connect.Auth.TeamsTenant[]> {\n const [list, states] = await Promise.all([\n MeetingsApiService.getTenants(),\n MeetingsApiService.getTenantHealth(),\n ]);\n\n return list.map((tenant) => {\n const state = states.find((s) => s.id === tenant.id);\n\n return {\n ...tenant,\n healthy: state?.healthy ?? false,\n };\n });\n}\n\nfunction mapTenants(c: Contracts.Connect.Auth.TeamsTenant[]): App.Connect.Auth.TeamsTenant[] {\n return c.map(ConnectMapper.mapTeamsTenant);\n}\n\nexport function useTeamTenants({enabled, teamId}: Args) {\n return useQuery({\n queryKey: ['teams-tenants', teamId],\n queryFn: queryTenants,\n enabled,\n select: mapTenants,\n });\n}\n","import React from 'react';\nimport classNames from 'classnames';\nimport {ClassName} from 'app/types/common';\nimport {SIZE, THEME} from 'app/constants';\nimport {Icons} from 'app/util/icons';\n\ninterface Props extends ClassName {\n type: 'simple' | 'admin';\n}\n\nexport const NoPairingPermission = ({className, type}: Props) => {\n const renderMessage = () => {\n if (type === 'simple') {\n return (\n <div className=\"no-pairing-permission__message\">\n To continue you can either sign in with another Microsoft Teams account or ask your\n Microsoft Teams administrator to join Epiphan Cloud and go through the connection process.\n To invite them, go to the members page to invite a new team member.\n </div>\n );\n }\n\n return (\n <div className=\"no-pairing-permission__message\">\n To continue you can either: <br />\n 1) Restart this process using the link you received and sign\n <br /> in with another Microsoft Teams account. <br />\n 2) Share the link provided with your Microsoft Organization\n <br /> administrator and ask them to go through the steps.\n <br />\n <br />\n For more details, please consult our{' '}\n <a\n href=\"https://www.epiphan.com/userguides/connect/Content/Connect/Connect-QuickStart-Guide.htm\"\n target=\"__blank\"\n rel=\"noopener noreferrer\"\n >\n User Guide\n </a>\n </div>\n );\n };\n\n return (\n <div className={classNames('no-pairing-permission', className)}>\n <div>\n {Icons.microsoftTeams().reactComponent()}\n <span className=\"no-pairing-permission__teams\">Microsoft Teams</span>\n </div>\n\n <div className=\"no-pairing-permission__title\">\n {Icons.warning().theme(THEME.DANGER).size(SIZE.L).reactComponent()} Your Microsoft Teams\n account doesn't have\n <br />\n administrator privileges\n </div>\n\n <div className=\"no-pairing-permission__body\">\n <div>\n In order to give consent to use Epiphan Connect you need to have one of the following\n roles in your Microsoft Teams tenant:\n </div>\n\n <ul>\n <li>Global Administrator</li>\n <li>Privileged Role Administrator</li>\n </ul>\n\n {renderMessage()}\n </div>\n </div>\n );\n};\n","import React from 'react';\nimport {Modal} from 'app/components/sharedReactComponents/Modal/Modal';\nimport {NoPairingPermission} from 'app/components/sharedReactComponents/Pairing/NoPairingPermission/NoPairingPermission';\n\nexport const NotTenantAdminPrompt = {\n show() {\n Modal.show({\n children: <NoPairingPermission type=\"simple\" />,\n });\n },\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport {ClassName} from 'app/types/common';\n\ninterface Props extends ClassName {\n text?: string;\n}\n\nexport const UnexpectedError = ({className, text}: Props) => {\n return (\n <div className={classNames('unexpected-error', className)}>\n <div className=\"unexpected-error__title\">An error happened.</div>\n <div>Try to pair your organization again</div>\n {text && <div className=\"unexpected-error__message\">Details: {text}</div>}\n </div>\n );\n};\n","import React from 'react';\nimport {Modal} from 'app/components/sharedReactComponents/Modal/Modal';\nimport {UnexpectedError} from 'app/components/sharedReactComponents/Pairing/UnexpectedError/UnexpectedError';\n\ninterface Props {\n text?: string;\n}\n\nexport const UnexpectedErrorPrompt = {\n show({text}: Props) {\n Modal.show({\n children: <UnexpectedError text={text} />,\n });\n },\n};\n","import {NotTenantAdminPrompt} from 'app/components/MeetingsManager/modals/NotTenantAdminPrompt/NotTenantAdminPrompt';\nimport {UnexpectedErrorPrompt} from 'app/components/MeetingsManager/modals/UnexpectedErrorPrompt/UnexpectedErrorPrompt';\nimport {Notifications} from 'app/components/Notifications';\nimport {Location} from 'app/router/Location';\n\ninterface Args {\n teamName: string;\n error?: string;\n state?: string;\n}\n\nfunction cleanQuery() {\n const url = new URL(window.location.href);\n const {href} = url;\n\n const res = href.split('?');\n\n const query = res[1];\n\n if (query) {\n const params = new URLSearchParams(query);\n\n params.forEach((_v, key) => {\n if (key !== 'tab') {\n params.delete(key);\n }\n });\n\n const search = params.toString();\n\n url.href = `${res[0] ?? ''}?${search}`;\n }\n\n Location.replace(url.href);\n}\n\nexport function useTeamsConnectionUrlHandlers({error, state, teamName}: Args) {\n if (error) {\n window.setTimeout(() => {\n const decoded = decodeURIComponent(error.replace(/\\+/g, '%20'));\n if (decoded === 'the user is not an admin of the tenant') {\n NotTenantAdminPrompt.show();\n return;\n }\n\n UnexpectedErrorPrompt.show({text: decoded});\n }, 200);\n\n cleanQuery();\n return;\n }\n\n if (state) {\n Notifications.addSuccessNotification(\n `You have paired your identity to Epiphan Connect team: ${teamName} `,\n );\n cleanQuery();\n }\n}\n","import React, {useEffect} from 'react';\nimport classNames from 'classnames';\nimport {WAI_ARIA_ROLE} from 'app/constants/waiAriaRole';\nimport {isNil} from 'app/util/isNil';\nimport {\n Callback,\n ChangeEvent,\n ClassName,\n} from 'app/types/common';\n\nexport enum TABS_THEME {\n WIDE = 'wide',\n MENU = 'menu',\n SETTINGS = 'settings',\n}\n\nfunction collectRegisteredValues(children) {\n const registeredValues = new Set();\n\n React.Children.forEach(children, child => {\n if (React.isValidElement(child) === false) {\n return;\n }\n\n const {value} = child.props;\n\n if (isNil(value)) {\n return;\n }\n\n registeredValues.add(value);\n });\n\n return registeredValues;\n}\n\ninterface Props extends ClassName {\n value: string;\n onChange: Callback<void, [ChangeEvent<any>]>;\n 'aria-label'?: string;\n defaultValue?: string;\n theme?: TABS_THEME;\n disabled?: boolean;\n}\n\nexport const Tabs: React.FC<Props> = ({\n className,\n 'aria-label': ariaLabel,\n value,\n defaultValue,\n children: childrenProp,\n theme = TABS_THEME.WIDE,\n disabled,\n onChange,\n}) => {\n // Set default value as active if value is not defined or there is no tab with same value\n useEffect(() => {\n if (isNil(defaultValue)) {\n return;\n }\n\n const registeredValues = collectRegisteredValues(childrenProp);\n\n if (registeredValues.has(value)) {\n return;\n }\n\n onChange({\n target: {\n name: '',\n value: defaultValue\n }});\n }, [value, defaultValue, childrenProp, onChange]);\n\n const children = React.Children.map(childrenProp, (child: any) => {\n if (React.isValidElement(child) === false) {\n return null;\n }\n\n const selected = value === child.props.value;\n\n return React.cloneElement(child, {\n selected,\n disabled,\n onChange,\n });\n });\n\n return (\n <div\n className={classNames('tabs__tab-list', {\n [`tabs__tab-list--${theme}`]: Boolean(theme),\n }, className)}\n aria-label={ariaLabel}\n role={WAI_ARIA_ROLE.TAB_LIST}\n >\n {children}\n </div>\n );\n};\n","import React, {useCallback} from 'react';\nimport classNames from 'classnames';\nimport {Button} from 'app/components/sharedReactComponents/Button';\nimport {WAI_ARIA_ROLE} from 'app/constants/waiAriaRole';\nimport {Callback} from 'app/types/common';\n\ninterface Props {\n value: string;\n label: React.ReactNode;\n visible?: boolean;\n selected?: boolean;\n disabled?: boolean;\n onClick?: Callback;\n onChange?: Callback;\n}\n\nexport const Tab: React.FC<Props> = ({\n value,\n label,\n visible,\n selected,\n disabled,\n onClick,\n onChange,\n ...elementProps\n}) => {\n const handleClick = useCallback(() => {\n const event = {\n target: {\n value,\n },\n };\n\n if (onClick) {\n onClick(event);\n }\n\n if (onChange) {\n onChange(event);\n }\n }, [value, onClick, onChange]);\n\n if (visible === false) {\n return null;\n }\n\n return (\n <Button\n className={classNames('tabs__tab', selected && 'tabs__tab--selected')}\n role={WAI_ARIA_ROLE.TAB}\n disabled={disabled}\n onClick={handleClick}\n {...elementProps}\n >\n {label}\n </Button>\n );\n};\n","import {useQuery} from '@tanstack/react-query';\nimport {MeetingsApiService} from 'app/services/api/meetings/MeetingsApiService';\nimport {ConnectMapper} from 'app/util/mappers/ConnectMapper/ConnectMapper';\n\ninterface Args {\n teamId: string;\n enabled: boolean;\n}\n\nfunction mapper(c: Contracts.Connect.Auth.ZoomAccount[]): App.Connect.Auth.ZoomAccount[] {\n return c.map(ConnectMapper.mapZoomAccount);\n}\n\nexport function useZoomAccounts({enabled, teamId}: Args) {\n return useQuery({\n queryKey: ['zoom-accounts', teamId],\n queryFn: MeetingsApiService.getZoomAccounts,\n select: mapper,\n enabled,\n });\n}\n","import React, {useEffect, useState} from 'react';\nimport {Box, Dialog, DialogContent, DialogTitle, Stack} from '@mui/material';\nimport {Callback, SxObj} from 'app/types/common';\nimport {DialogClose} from 'app/components/sharedReactComponents/DialogClose/DialogClose';\nimport {palette} from 'app/themes/app';\nimport {CopyButton} from 'app/components/sharedReactComponents/CopyButton';\nimport {THEME, VARIANT} from 'app/constants';\nimport {LoadingPlaceholder} from 'app/components/sharedReactComponents/LoadingPlaceholder';\nimport {useMounted} from 'app/hooks/useIsMounted';\n\ninterface Props {\n open: boolean;\n generateLink: Callback<Promise<{link: string}>>;\n onClose: Callback;\n}\n\ntype Styles = 'box' | 'link' | 'expire' | 'message' | 'action';\n\nconst styles: Record<Styles, SxObj> = {\n message: {color: palette.darkerGray, textAlign: 'center', mb: 2},\n box: {borderRadius: 2, backgroundColor: '#f3f3f3', minHeight: '280px', p: 3},\n link: {textDecoration: 'underline', wordBreak: 'break-all', textAlign: 'start', mb: 2},\n expire: {color: palette.darkerGray},\n action: {mt: 'auto'},\n};\n\nexport function GeneratePairingLinkDialog({open, generateLink, onClose}: Props) {\n const [isLoading, setIsLoading] = useState(true);\n const [link, setLink] = useState('');\n const isMounted = useMounted();\n\n useEffect(() => {\n const generate = async () => {\n try {\n setIsLoading(true);\n const {link} = await generateLink();\n if (isMounted()) {\n setLink(link);\n }\n } finally {\n if (isMounted()) {\n setIsLoading(false);\n }\n }\n };\n\n if (open) {\n void generate();\n }\n }, [open, isMounted, generateLink]);\n\n const handleCopy = async () => {\n if ('clipboard' in navigator) {\n await navigator.clipboard.writeText(link);\n } else {\n document.execCommand('copy', false, link);\n }\n };\n\n const renderLink = () => {\n if (isLoading) {\n return <LoadingPlaceholder />;\n }\n\n return (\n <>\n <CopyButton\n value={link}\n buttonContent={<Box sx={styles.link}>{link}</Box>}\n onClick={handleCopy}\n />\n <Box sx={styles.expire}>Link will expire after 14 days</Box>\n\n <Box sx={styles.action}>\n <CopyButton\n value={link}\n variant={VARIANT.SOLID}\n theme={THEME.SUCCESS}\n onClick={handleCopy}\n />\n </Box>\n </>\n );\n };\n\n return (\n <Dialog open={open} fullWidth={true} maxWidth=\"sm\" onClose={onClose}>\n <DialogClose onClose={onClose} />\n <DialogTitle>\n If you are not the administrator\n <br />\n of your Microsoft organization\n </DialogTitle>\n <DialogContent>\n <Box sx={styles.message}>\n Please send this link to your Microsoft organization administrator and <br />\n ask them to go through the connection steps showed in the link.\n </Box>\n\n <Stack sx={styles.box} alignItems=\"center\" justifyContent=\"center\">\n {renderLink()}\n </Stack>\n </DialogContent>\n </Dialog>\n );\n}\n","import React from 'react';\nimport {Box, Dialog, DialogContent, DialogTitle, Divider, Stack} from '@mui/material';\nimport {Callback, SxObj} from 'app/types/common';\nimport {DialogClose} from 'app/components/sharedReactComponents/DialogClose/DialogClose';\nimport {palette} from 'app/themes/app';\nimport {Button} from 'app/components/sharedReactComponents/Button';\nimport {THEME, VARIANT} from 'app/constants';\n\ninterface Props {\n open: boolean;\n onPair: Callback;\n onGenerateLink: Callback;\n onClose: Callback;\n}\n\nconst box: SxObj = {flex: 1, padding: 4};\nconst title: SxObj = {fontSize: '16px', mb: 1, color: palette.badge};\nconst message: SxObj = {mb: 2, color: palette.badge};\n\nexport function PairActionSelectorDialog({open, onPair, onGenerateLink, onClose}: Props) {\n return (\n <Dialog open={open} fullWidth={true} maxWidth=\"md\" onClose={onClose}>\n <DialogClose onClose={onClose} />\n <DialogTitle>\n Pair a Microsoft Teams organization\n <Box sx={{color: palette.blue, mt: 1, fontSize: '16px'}}>\n Do you have administrator access to your Microsoft Teams organization?\n </Box>\n </DialogTitle>\n\n <DialogContent>\n <Stack direction=\"row\" gap={3} divider={<Divider orientation=\"vertical\" flexItem />}>\n <Box sx={box}>\n <Box sx={title}>\n <strong>I am NOT the administrator</strong>\n <br />\n of my Microsoft organization\n </Box>\n <Box sx={message}>\n Please generate a URL and send it to the <br />\n administrator of the Microsoft organization\n </Box>\n\n <Button variant={VARIANT.OUTLINE} theme={THEME.SUCCESS} onClick={onGenerateLink}>\n Generate connection link\n </Button>\n </Box>\n <Box sx={box}>\n <Box sx={title}>\n <strong>I am the administrator</strong> <br />\n of my Microsoft organization\n </Box>\n <Box sx={message}>\n Follow the easy steps to connect and start <br />\n producing high-quality content right away\n </Box>\n\n <Button variant={VARIANT.OUTLINE} theme={THEME.SUCCESS} onClick={onPair}>\n Pair your Microsoft Teams organization\n </Button>\n </Box>\n </Stack>\n </DialogContent>\n </Dialog>\n );\n}\n","import React, {createContext, Reducer, useCallback, useContext, useMemo, useReducer} from 'react';\nimport {GeneratePairingLinkDialog} from 'app/components/dialogs/GeneratePairingLinkDialog/GeneratePairingLinkDialog';\nimport {PairActionSelectorDialog} from 'app/components/dialogs/PairActionSelectorDialog/PairActionSelectorDialog';\nimport {MeetingsApiService} from 'app/services/api/meetings/MeetingsApiService';\nimport {front} from 'app/api/CirrusApi';\nimport {Location} from 'app/router/Location';\nimport {ZoomIntegrationDialog} from 'app/components/ConnectPlatformsIntegration/dialogs/ZoomIntegrationDialog/ZoomIntegrationDialog';\nimport {PairTeamsTenantDialog} from 'app/components/dialogs/PairTeamsTenantDialog/PairTeamsTenantDialog';\n\ntype View = 'none' | 'select' | 'teams-admin' | 'teams-not-admin' | 'zoom';\n\ninterface State {\n view: View;\n backUrl: string;\n}\n\ntype Type = 'select' | 'admin-pair' | 'user-pair' | 'zoom' | 'close';\n\ninterface ActionType<T extends Type> {\n type: T;\n}\n\ninterface ActionPayload<T extends Type, P extends any> extends ActionType<T> {\n payload: P;\n}\n\ntype SelectAction = ActionPayload<'select', string>;\ntype CloseAction = ActionType<'close'>;\ntype AdminAction = ActionType<'admin-pair'>;\ntype NotAdminAction = ActionType<'user-pair'>;\ntype ZoomAction = ActionPayload<'zoom', string>;\n\ntype Action = SelectAction | CloseAction | AdminAction | NotAdminAction | ZoomAction;\n\nfunction reducer(state: State, action: Action): State {\n switch (action.type) {\n case 'select': {\n return {view: 'select', backUrl: action.payload};\n }\n case 'admin-pair': {\n return {...state, view: 'teams-admin'};\n }\n\n case 'user-pair': {\n return {...state, view: 'teams-not-admin'};\n }\n\n case 'close': {\n return {view: 'none', backUrl: ''};\n }\n\n case 'zoom': {\n return {view: 'zoom', backUrl: action.payload};\n }\n\n default:\n return state;\n }\n}\n\ntype ContextValue = {\n startTeams: Fn<void, [string]>;\n startZoom: Fn<void, [string]>;\n};\nconst ConnectIntegrationContext = createContext<ContextValue | undefined>(undefined);\n\ninterface Props {\n teamName: string;\n enabled: boolean;\n}\n\nexport function ConnectPlatformsIntegration({\n teamName,\n enabled,\n children,\n}: React.PropsWithChildren<Props>) {\n const [state, dispatch] = useReducer<Reducer<State, Action>, State>(\n reducer,\n {\n view: 'none',\n backUrl: '',\n },\n (state) => state,\n );\n\n const startTeams = useCallback(\n (backUrl: string) => {\n if (enabled) {\n dispatch({type: 'select', payload: backUrl});\n }\n },\n [enabled],\n );\n\n const startZoom = useCallback(\n (returnUrl: string) => {\n if (enabled) {\n dispatch({type: 'zoom', payload: returnUrl});\n }\n },\n [enabled],\n );\n\n const handleClose = useCallback(() => {\n dispatch({type: 'close'});\n }, []);\n\n const selectAdmin = useCallback(() => {\n dispatch({type: 'admin-pair'});\n }, []);\n\n const selectNotAdmin = useCallback(() => {\n dispatch({type: 'user-pair'});\n }, []);\n\n const handleAdminPair = useCallback(() => {\n const url = front.econnect().pair().ms().tenant({redirect_url: state.backUrl}).url() as string;\n Location.assign(url);\n }, [state.backUrl]);\n\n const handleZoom = useCallback(() => {\n const url = front.econnect().pair().zoom().user({redirect_url: state.backUrl}).url() as string;\n Location.assign(url);\n }, [state.backUrl]);\n\n const contextValue = useMemo<ContextValue>(\n () => ({\n startTeams,\n startZoom,\n }),\n [startZoom, startTeams],\n );\n\n return (\n <ConnectIntegrationContext.Provider value={contextValue}>\n <PairActionSelectorDialog\n open={state.view === 'select'}\n onGenerateLink={selectNotAdmin}\n onPair={selectAdmin}\n onClose={handleClose}\n />\n\n <GeneratePairingLinkDialog\n open={state.view === 'teams-not-admin'}\n generateLink={MeetingsApiService.getLink}\n onClose={handleClose}\n />\n\n <PairTeamsTenantDialog\n open={state.view === 'teams-admin'}\n team={teamName}\n onPair={handleAdminPair}\n onClose={handleClose}\n />\n\n <ZoomIntegrationDialog\n open={state.view === 'zoom'}\n onPair={handleZoom}\n onClose={handleClose}\n />\n {children}\n </ConnectIntegrationContext.Provider>\n );\n}\n\nexport function useConnectIntegration() {\n const runPairing = useContext(ConnectIntegrationContext);\n if (!runPairing) {\n throw new Error('Out of Pairing Tenant Context');\n }\n\n return runPairing;\n}\n","import {Box} from '@mui/material';\nimport React from 'react';\n\ntype Props<T extends string | number = string> = React.ComponentProps<typeof Box> & {\n value: T;\n active: T;\n};\n\nexport function TabPanel({value, active, children, ...props}: React.PropsWithChildren<Props>) {\n if (value !== active) {\n return null;\n }\n\n return <Box {...props}>{children}</Box>;\n}\n","import React, {useState} from 'react';\nimport {Box, Stack, SxProps, TextField, Typography} from '@mui/material';\nimport {Controller, useForm} from 'react-hook-form';\nimport Joi from 'joi';\nimport {joiResolver} from '@hookform/resolvers/joi';\nimport {BUTTON_TYPE, ProgressButton} from 'app/components/sharedReactComponents/ProgressButton';\nimport {THEME, VARIANT} from 'app/constants';\nimport {Callback} from 'app/types/common';\nimport {palette} from 'app/themes/app';\nimport {isNil} from 'app/util/isNil';\nimport AccessTimeIcon from '@mui/icons-material/AccessTime';\nimport {useMounted} from 'app/hooks/useIsMounted';\nimport {Notifications} from 'app/components/Notifications';\n\ninterface CreateData {\n name: string;\n}\n\nconst scheme = Joi.object<CreateData>({\n name: Joi.string()\n .trim()\n .custom((value, helpers) => {\n if (typeof value === 'string') {\n const urlScheme = Joi.string().uri();\n\n const result = urlScheme.validate(value);\n\n if (!result.error) {\n return helpers.error('string.uri');\n }\n }\n\n return value;\n })\n .required(),\n}).messages({\n 'any.required': 'Required field',\n 'string.empty': 'Cannot be empty',\n 'string.uri': 'Meeting name cannot be a URL',\n});\n\ninterface Props {\n sx?: SxProps;\n onCreate: Callback<Promise<any>, [name: string]>;\n}\n\nexport function CreateTeamsCall({sx, onCreate}: Props) {\n const [confirming, setConfirming] = useState(false);\n const mounted = useMounted();\n\n const {\n control,\n formState: {isValid},\n handleSubmit,\n } = useForm<CreateData>({\n defaultValues: {name: ''},\n mode: 'onChange',\n resolver: joiResolver(scheme),\n });\n\n const handleCreate = async (data: CreateData) => {\n try {\n setConfirming(true);\n await onCreate(data.name);\n } catch {\n Notifications.addErrorNotification(`Could not create a meeting`);\n } finally {\n if (mounted()) {\n setConfirming(false);\n }\n }\n };\n\n return (\n <Box sx={sx}>\n <form onSubmit={handleSubmit(handleCreate)}>\n <Box\n mb={2}\n component=\"img\"\n src=\"/assets/img/logo/teams-logo.png\"\n width={173}\n height={28}\n srcSet=\"/assets/img/logo/teams-logo@2x.png 2x\"\n alt=\"\"\n />\n\n <Typography variant=\"h5\" fontWeight={600}>\n Create a Microsoft Teams meeting\n </Typography>\n\n <Box sx={{color: palette.darkerGray, mt: 1, mb: 5}}>\n Create a meeting link to share with your participants and produce your\n <br /> live event. <strong>This will not join existing meetings</strong>.\n </Box>\n\n <Box sx={{fontSize: 16, fontWeight: 600, mb: 1}}>New meeting name:</Box>\n\n <Controller\n control={control}\n name=\"name\"\n render={({field, fieldState: {error}}) => (\n <TextField\n {...field}\n autoFocus={true}\n inputProps={{'data-id': 'hosted-meeting-name'}}\n variant=\"standard\"\n placeholder=\"Add your meeting name\"\n fullWidth={true}\n error={!isNil(error)}\n helperText={error?.message ?? ' '}\n />\n )}\n />\n\n <Stack sx={{color: palette.gray, mb: 5}} direction=\"row\" alignItems=\"center\" gap={1}>\n <AccessTimeIcon fontSize=\"small\" />\n The meeting link will only be available for the next 45 days\n </Stack>\n\n <Box sx={{color: palette.darkerGray, mb: 5.5}}>\n You won't be charged until you click on <i>Start Connect</i> button, after the meeting is\n created.\n </Box>\n\n <Box sx={{'& button': {width: 154}}}>\n <ProgressButton\n type={BUTTON_TYPE.SUBMIT}\n loading={confirming}\n dataId=\"call_create_button\"\n theme={THEME.PRIMARY}\n variant={VARIANT.SOLID}\n disabled={!isValid}\n >\n Create\n </ProgressButton>\n </Box>\n </form>\n </Box>\n );\n}\n","import React, {useState} from 'react';\nimport {Controller, useForm} from 'react-hook-form';\nimport Joi from 'joi';\nimport {joiResolver} from '@hookform/resolvers/joi';\nimport {\n Box,\n FormControl,\n FormControlLabel,\n FormHelperText,\n Radio,\n RadioGroup,\n TextField,\n} from '@mui/material';\nimport {Callback} from 'app/types/common';\nimport {isNil} from 'ramda';\nimport {BUTTON_TYPE, ProgressButton} from 'app/components/sharedReactComponents/ProgressButton';\nimport {palette} from 'app/themes/app';\nimport {THEME, VARIANT} from 'app/constants';\nimport {Notifications} from 'app/components/Notifications';\nimport {useMounted} from 'app/hooks/useIsMounted';\n\nconst scheme = Joi.object<ConnectData>({\n url: Joi.string().trim().uri().required(),\n mode: Joi.string().required(),\n}).messages({\n 'any.required': 'Required field',\n 'string.empty': 'Cannot be empty',\n 'string.uri': 'Invalid url',\n});\n\ntype AudioMode = 'mixed' | 'isolated';\n\ninterface ConnectData {\n url: string;\n mode: AudioMode;\n}\ninterface ValidationErrors {\n meeting_url?: string;\n}\n\ninterface Props {\n onConnect: Callback<any, [data: ConnectData]>;\n}\n\nconst placeholder = 'https://teams.microsoft.com/l/meetup-join/meeting_id';\n\nexport function ConnectForm({onConnect}: Props) {\n const [confirming, setConfirming] = useState(false);\n const mounted = useMounted();\n\n const {\n control,\n formState: {isValid},\n handleSubmit,\n setError,\n } = useForm<ConnectData>({\n defaultValues: {url: '', mode: 'isolated'},\n mode: 'onChange',\n resolver: joiResolver(scheme),\n });\n\n const handleConnect = async (d: ConnectData) => {\n try {\n setConfirming(true);\n await onConnect(d);\n } catch (e: any) {\n if (e.data.ErrorData) {\n const {meeting_url} = e.data.ErrorData as ValidationErrors;\n\n if (meeting_url) {\n setError('url', {type: 'custom', message: meeting_url});\n }\n\n return;\n }\n\n const msg = e.data.Error;\n\n if (typeof msg === 'string') {\n Notifications.addErrorNotification(`Error: ${msg}`);\n }\n } finally {\n if (mounted()) {\n setConfirming(false);\n }\n }\n };\n\n return (\n <Box>\n <form onSubmit={handleSubmit(handleConnect)}>\n <Box sx={{mb: 0.5, fontSize: '16px', fontWeight: 'bold'}}>Teams Meeting URL:</Box>\n\n <Controller\n control={control}\n name=\"url\"\n render={({field, fieldState: {error}}) => (\n <TextField\n {...field}\n autoFocus={true}\n inputProps={{'data-id': 'meeting-url'}}\n sx={{mb: 1, wordBreak: 'break-all'}}\n variant=\"standard\"\n placeholder={placeholder}\n helperText={error?.message ?? ' '}\n fullWidth={true}\n multiline={true}\n minRows={5}\n error={!isNil(error)}\n />\n )}\n />\n\n <Controller\n name=\"mode\"\n control={control}\n render={({field}) => (\n <FormControl>\n <Box sx={{mt: 2, mb: 1, fontWeight: 'bold'}}>Epiphan Connect audio mode:</Box>\n\n <RadioGroup\n sx={{display: 'flex', gap: 3, flexDirection: 'row', flexWrap: 'nowrap'}}\n {...field}\n >\n <Box sx={{flex: 1}}>\n <FormControlLabel\n sx={{mb: 0}}\n value=\"isolated\"\n control={<Radio data-id=\"isolated-mode-radio\" />}\n label=\"Isolated\"\n />\n <FormHelperText sx={{ml: '28px'}}>\n Isolate participant audio into separate tracks. Use this to control extracted\n audio.\n </FormHelperText>\n </Box>\n\n <Box sx={{flex: 1}}>\n <FormControlLabel\n sx={{mb: 0}}\n value=\"mixed\"\n control={<Radio data-id=\"mixed-mode-radio\" />}\n label=\"Mixed\"\n />\n <FormHelperText sx={{ml: '28px'}}>\n Each participant's audio track will contain the mixed audio from the Microsoft\n Teams meeting.\n </FormHelperText>\n </Box>\n </RadioGroup>\n </FormControl>\n )}\n />\n\n <Box sx={{color: palette.darkerGray, my: 4}}>\n Connecting to a meeting can take several minutes. Give yourself sufficient time to get\n connected before the meeting start time.\n </Box>\n <Box sx={{'& button': {width: '154px'}}}>\n <ProgressButton\n dataId=\"teams_connect_button\"\n type={BUTTON_TYPE.SUBMIT}\n loading={confirming}\n theme={THEME.PRIMARY}\n variant={VARIANT.SOLID}\n disabled={!isValid}\n >\n Connect\n </ProgressButton>\n </Box>\n </form>\n </Box>\n );\n}\n","import {Box, Typography} from '@mui/material';\nimport {Button} from 'app/components/sharedReactComponents/Button';\nimport {THEME, VARIANT} from 'app/constants';\nimport {palette} from 'app/themes/app';\nimport {Callback} from 'app/types/common';\nimport React from 'react';\n\ninterface Props {\n canPair: boolean;\n onPair: Callback;\n onCreate: Callback;\n}\n\nexport function TenantMessage({canPair, onCreate, onPair}: Props) {\n return (\n <Box sx={{borderRadius: 2, bgcolor: '#f3f3f3', px: 5, py: 6}}>\n <Typography variant=\"h6\" fontWeight={600}>\n You don't have a Microsoft organization paired yet.\n </Typography>\n\n <Box mb={9}>\n {canPair ? (\n <>\n <Box sx={{color: palette.darkerGray, mb: 2}}>\n Your Microsoft Teams account administrator will need to authorize Epiphan Connect to\n join meetings.\n </Box>\n\n <Button\n dataId=\"pair_tenant_button\"\n theme={THEME.SUCCESS}\n variant={VARIANT.SOLID}\n onClick={onPair}\n >\n Pair Microsoft Organization\n </Button>\n </>\n ) : (\n <>\n <Box sx={{color: palette.darkerGray}}>\n Please contact the Epiphan Cloud team owner or admin for configuration.\n </Box>\n </>\n )}\n </Box>\n\n <Typography sx={{fontWeight: 'bold', fontSize: '16px', mb: 0.5}}>\n Create a meeting without pairing.\n </Typography>\n\n <Box sx={{color: palette.darkerGray, mb: 2}}>\n You can also create a meeting without pairing your Microsoft Teams organization.\n </Box>\n\n <Button\n dataId=\"create_call_button\"\n theme={THEME.SUCCESS}\n variant={VARIANT.OUTLINE}\n onClick={onCreate}\n >\n Create a meeting\n </Button>\n </Box>\n );\n}\n","import React from 'react';\nimport {Box, Link, SxProps, Typography} from '@mui/material';\nimport {Callback} from 'app/types/common';\nimport {palette} from 'app/themes/app';\nimport {ConnectForm} from 'app/components/dialogs/TeamsConnectDialog/TeamsConnect/ConnectToTeamsCall/ConnectForm/ConnectForm';\nimport {TenantMessage} from 'app/components/dialogs/TeamsConnectDialog/TeamsConnect/ConnectToTeamsCall/TenantMessage/TenantMessage';\nimport {router} from 'app/router/main';\n\ninterface Props {\n sx?: SxProps;\n hasTenants: boolean;\n canPair: boolean;\n onConnect: React.ComponentProps<typeof ConnectForm>['onConnect'];\n onCreate: Callback;\n onPair: Callback;\n}\n\nexport function ConnectToTeamsCall({sx, hasTenants, canPair, onCreate, onConnect, onPair}: Props) {\n const renderMessage = () => {\n if (hasTenants) {\n return (\n <>\n You can only connect to an existing meeting from your paired Microsoft Organizations.{' '}\n <Link\n sx={{color: 'inherit', textDecorationColor: 'currentcolor'}}\n href={router.url('connectAccountSettings')}\n >\n View paired organizations.\n </Link>\n </>\n );\n }\n\n return <>You need to have a paired Microsoft organization to connect to an existing meeting.</>;\n };\n\n return (\n <Box sx={sx}>\n <Box\n mb={2}\n component=\"img\"\n src=\"/assets/img/logo/teams-logo.png\"\n width={173}\n height={28}\n srcSet=\"/assets/img/logo/teams-logo@2x.png 2x\"\n alt=\"\"\n />\n\n <Typography variant=\"h5\" fontWeight={600}>\n Connect to an existing Teams meeting\n </Typography>\n\n <Box sx={{color: palette.darkerGray, mt: 1, mb: 5}}>{renderMessage()}</Box>\n\n {hasTenants ? (\n <ConnectForm onConnect={onConnect} />\n ) : (\n <TenantMessage canPair={canPair} onCreate={onCreate} onPair={onPair} />\n )}\n </Box>\n );\n}\n","import React, {useState} from 'react';\nimport {Box, Stack, Tab, Tabs} from '@mui/material';\nimport {TabPanel} from 'app/components/sharedReactComponents/TabPanel/TabPanel';\nimport {Callback} from 'app/types/common';\nimport {CreateTeamsCall} from 'app/components/dialogs/TeamsConnectDialog/TeamsConnect/CreateTeamsCall/CreateTeamsCall';\nimport {palette} from 'app/themes/app';\nimport {ConnectToTeamsCall} from 'app/components/dialogs/TeamsConnectDialog/TeamsConnect/ConnectToTeamsCall/ConnectToTeamsCall';\n\ninterface Props {\n hasTenants: boolean;\n canPair: boolean;\n onCreate: React.ComponentProps<typeof CreateTeamsCall>['onCreate'];\n onConnect: React.ComponentProps<typeof ConnectToTeamsCall>['onConnect'];\n onPair: Callback;\n}\ntype TeamsTab = 'create' | 'connect';\n\nexport default function TeamsConnect({canPair, hasTenants, onConnect, onCreate, onPair}: Props) {\n const [tab, setTab] = useState<TeamsTab>('create');\n\n const handleTabChange = (_e: React.SyntheticEvent, value: TeamsTab) => {\n setTab(value);\n };\n\n return (\n <Stack direction=\"row\" sx={{minHeight: 784}}>\n <Stack sx={{bgcolor: '#f1f1f1', width: 220}}>\n <Stack direction=\"row\" gap={1} alignItems=\"center\" px={3} my={4}>\n <Box\n component=\"img\"\n width={130}\n height={20}\n src=\"/assets/img/logo/teams-logo.png\"\n srcSet=\"/assets/img/logo/teams-logo@2x.png 2x\"\n alt=\"\"\n />\n </Stack>\n <Tabs\n sx={{\n '& .MuiTabs-indicator': {display: 'none'},\n '& .MuiTab-root': {\n color: palette.gray,\n alignItems: 'flex-start',\n px: 3,\n fontSize: 14,\n fontWeight: 'bold',\n '&:hover, &.Mui-focusVisible': {bgcolor: '#e8e8e880'},\n '&.Mui-selected': {color: '#333333', bgcolor: '#e8e8e8'},\n },\n }}\n value={tab}\n orientation=\"vertical\"\n onChange={handleTabChange}\n >\n <Tab data-id=\"create-tab\" value=\"create\" label=\"Create a meeting\" />\n <Tab data-id=\"connect-tab\" value=\"connect\" label=\"Connect to a meeting\" />\n </Tabs>\n </Stack>\n\n <TabPanel sx={{flex: 1}} value=\"create\" active={tab}>\n <CreateTeamsCall sx={{px: 9, py: 10}} onCreate={onCreate} />\n </TabPanel>\n <TabPanel sx={{flex: 1}} value=\"connect\" active={tab}>\n <ConnectToTeamsCall\n sx={{px: 9, py: 10}}\n hasTenants={hasTenants}\n canPair={canPair}\n onConnect={onConnect}\n onCreate={() => setTab('create')}\n onPair={onPair}\n />\n </TabPanel>\n </Stack>\n );\n}\n","import React from 'react';\nimport {Dialog} from '@mui/material';\nimport {DialogClose} from 'app/components/sharedReactComponents/DialogClose/DialogClose';\nimport {Callback} from 'app/types/common';\nimport TeamsConnect from 'app/components/dialogs/TeamsConnectDialog/TeamsConnect/TeamsConnect';\n\ntype Props = React.ComponentProps<typeof TeamsConnect> & {\n open: boolean;\n onClose: Callback;\n};\n\nexport function TeamsConnectDialog({\n open,\n canPair: canEdit,\n hasTenants,\n onPair,\n onConnect,\n onCreate,\n onClose,\n}: Props) {\n return (\n <Dialog open={open} fullWidth={true} maxWidth=\"md\" onClose={onClose}>\n <DialogClose onClose={onClose} />\n\n <TeamsConnect\n hasTenants={hasTenants}\n canPair={canEdit}\n onConnect={onConnect}\n onCreate={onCreate}\n onPair={onPair}\n />\n </Dialog>\n );\n}\n","import React, {useState} from 'react';\nimport {\n Box,\n FormControl,\n FormControlLabel,\n FormHelperText,\n Radio,\n RadioGroup,\n Typography,\n} from '@mui/material';\nimport {palette} from 'app/themes/app';\nimport {ProgressButton} from 'app/components/sharedReactComponents/ProgressButton';\nimport {THEME, VARIANT} from 'app/constants';\nimport {Callback} from 'app/types/common';\nimport {Notifications} from 'app/components/Notifications';\n\ntype AudioMode = 'mixed' | 'isolated';\n\ninterface Props {\n onConnect: Callback<Promise<void>, [mode: AudioMode]>;\n}\n\nexport function ConnectToHosted({onConnect}: Props) {\n const [mode, setMode] = useState<AudioMode>('isolated');\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n setMode(e.target.value as AudioMode);\n };\n\n const handleConnect = async () => {\n try {\n await onConnect(mode);\n } catch {\n Notifications.addErrorNotification(`Could not connect to an hosted meeting`);\n }\n };\n\n return (\n <Box sx={{p: 7}}>\n <Box\n mb={2}\n component=\"img\"\n src=\"/assets/img/logo/teams-logo.png\"\n width={173}\n height={28}\n srcSet=\"/assets/img/logo/teams-logo@2x.png 2x\"\n alt=\"\"\n />\n\n <Typography variant=\"h5\" fontWeight={600}>\n Start Epiphan Connect\n </Typography>\n\n <Box sx={{color: palette.darkerGray, mt: 1}}>\n Start extracting your meeting participants’ video and audio signals by starting Epiphan\n Connect.\n </Box>\n\n <FormControl sx={{mt: 2}}>\n <Box sx={{mb: 1, fontWeight: 'bold'}}>Epiphan Connect audio mode:</Box>\n\n <RadioGroup\n sx={{display: 'flex', gap: 3, flexDirection: 'row', flexWrap: 'nowrap'}}\n value={mode}\n onChange={handleChange}\n >\n <Box sx={{flex: 1}}>\n <FormControlLabel\n sx={{mb: 0}}\n value=\"isolated\"\n control={<Radio data-id=\"isolated-mode-radio\" />}\n label=\"Isolated\"\n />\n <FormHelperText sx={{ml: '28px'}}>\n Isolate participant audio into separate tracks. Use this to control extracted audio.\n </FormHelperText>\n </Box>\n\n <Box sx={{flex: 1}}>\n <FormControlLabel\n sx={{mb: 0}}\n value=\"mixed\"\n control={<Radio data-id=\"mixed-mode-radio\" />}\n label=\"Mixed\"\n />\n <FormHelperText sx={{ml: '28px'}}>\n Each participant's audio track will contain the mixed audio from the Microsoft Teams\n meeting.\n </FormHelperText>\n </Box>\n </RadioGroup>\n </FormControl>\n\n <Box sx={{color: palette.darkerGray, my: 4}}>\n Connecting to a meeting can take several minutes. Give yourself sufficient time to get\n connected before the meeting start time.\n </Box>\n <Box sx={{'& button': {width: '154px'}}}>\n <ProgressButton\n dataId=\"hosted_connect_button\"\n theme={THEME.PRIMARY}\n variant={VARIANT.SOLID}\n onClick={handleConnect}\n >\n Connect\n </ProgressButton>\n </Box>\n </Box>\n );\n}\n","import React from 'react';\nimport {Dialog} from '@mui/material';\nimport {DialogClose} from 'app/components/sharedReactComponents/DialogClose/DialogClose';\nimport {Callback} from 'app/types/common';\nimport {ConnectToHosted} from 'app/components/dialogs/ConnectToHostedDialog/ConnectToHosted';\n\ntype Props = React.ComponentProps<typeof ConnectToHosted> & {\n open: boolean;\n onClose: Callback;\n};\n\nexport function ConnectToHostedDialog({open, onConnect, onClose}: Props) {\n return (\n <Dialog fullWidth={true} maxWidth=\"sm\" open={open} onClose={onClose}>\n <DialogClose onClose={onClose} />\n\n <ConnectToHosted onConnect={onConnect} />\n </Dialog>\n );\n}\n","import {ApiResponseNumeralStatus, ApiResponseStatus} from 'app/data/Status';\nimport {isNil} from 'app/util/isNil';\n\nexport type Endpoints = Record<string, EndpointData | Record<string, EndpointData>>;\nexport type EndpointData = {\n __noteam__?: boolean;\n __url__?: string;\n __nocache__?: boolean;\n __protocol__?: string;\n} & Record<string, any>;\n\nexport type AbortCallback = () => void;\nexport type GetAbortCallback = (abort: AbortCallback) => void;\n\nexport type AjaxErrorCallback = (error) => void;\n\nexport type AjaxComplexSuccessfulResponseType<T = {}> = T & {\n Status: ApiResponseStatus;\n StatusCode: ApiResponseNumeralStatus;\n};\n\nexport type ErrorResponse = {\n data: {\n Status: 'error';\n StatusCode: number;\n Error?: string;\n ErrorData?: Record<string, any>;\n };\n};\n\nexport type ErrorRes = {\n Status: 'error';\n StatusCode: number;\n Error: string;\n};\n\nexport type ErrorResWithData = {\n Status: 'error';\n StatusCode: number;\n ErrorData: Record<string, any>;\n};\n\nexport function isErrorResponse(e: unknown): e is ErrorResponse {\n const response = e as ErrorResponse;\n return Boolean(response.data?.Error) || Boolean(response.data?.ErrorData);\n}\n\nexport function getErrorContents(e: ErrorResponse): string {\n if (e.data.ErrorData) {\n return Object.values(e.data.ErrorData).join(' ');\n }\n\n if (e.data.Error) {\n return e.data.Error;\n }\n\n return '';\n}\n\nexport function isError(e: unknown): e is ErrorRes {\n const casted = e as ErrorRes;\n return !isNil(casted.Status) && !isNil(casted.StatusCode) && !isNil(casted.Error);\n}\n\nexport function isErrorWithData(e: unknown): e is ErrorResWithData {\n const casted = e as ErrorResWithData;\n return !isNil(casted.Status) && !isNil(casted.StatusCode) && !isNil(casted.ErrorData);\n}\n","import React from 'react';\nimport {palette} from 'app/themes/app';\nimport {\n Box,\n FormControl,\n FormControlLabel,\n FormHelperText,\n ListItemIcon,\n ListItemText,\n MenuItem,\n Radio,\n RadioGroup,\n Stack,\n TextField,\n Typography,\n} from '@mui/material';\nimport ErrorIcon from '@mui/icons-material/Error';\nimport {Controller, useForm} from 'react-hook-form';\nimport Joi from 'joi';\nimport {joiResolver} from '@hookform/resolvers/joi';\nimport AddIcon from '@mui/icons-material/Add';\nimport {isNil} from 'app/util/isNil';\nimport {ProgressButton} from 'app/components/sharedReactComponents/ProgressButton';\nimport {THEME, VARIANT} from 'app/constants';\nimport {Callback} from 'app/types/common';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\nimport {router} from 'app/router/main';\nimport {isErrorResponse} from 'app/api/types';\nimport {Notifications} from 'app/components/Notifications';\nimport {capitalize} from 'app/components/helpers/commonHelpers';\n\ntype AudioMode = 'mixed' | 'isolated';\n\ntype ZoomIdentity = 'guest' | (string & {});\n\ninterface ZoomData {\n url: string;\n code: string;\n mode: AudioMode;\n account: ZoomIdentity;\n}\n\nconst scheme = Joi.object<ZoomData>({\n url: Joi.string().trim().required(),\n code: Joi.string().trim().allow(''),\n mode: Joi.string().required(),\n account: Joi.string(),\n}).messages({\n 'any.required': 'Required field',\n 'string.empty': 'Required field',\n});\n\ninterface Props {\n accounts: App.Connect.Auth.ZoomAccount[];\n onConnect: Callback<Promise<void>, [data: ZoomData]>;\n}\n\nexport function ZoomConnection({accounts, onConnect}: Props) {\n const {control, getValues, trigger, setError} = useForm<ZoomData>({\n defaultValues: {url: '', code: '', mode: 'isolated', account: 'guest'},\n mode: 'onChange',\n reValidateMode: 'onChange',\n resolver: joiResolver(scheme),\n });\n\n const handleConnect = async () => {\n const validation = await trigger();\n\n if (validation) {\n try {\n const form = getValues();\n await onConnect(form);\n } catch (e: any) {\n if (!isErrorResponse(e)) {\n return;\n }\n\n const data = e.data.ErrorData;\n\n if (isValidationError(data)) {\n if (data.meeting_url) {\n setError('url', {type: 'custom', message: data.meeting_url});\n }\n\n if (data.meeting_password) {\n setError('code', {type: 'custom', message: data.meeting_password});\n }\n\n return;\n }\n\n if (isAccountError(data)) {\n Notifications.addErrorNotification(capitalize(data.account_id));\n }\n\n Notifications.addErrorNotification('Could not connect to a meeting');\n }\n }\n };\n\n return (\n <Box sx={{p: 7}}>\n <Box sx={{mb: 3}}>\n <img\n src=\"/assets/img/logo/zoom-logo.png\"\n srcSet=\"/assets/img/logo/zoom-logo@2x.png 2x\"\n alt=\"\"\n />\n </Box>\n\n <Box sx={{mb: 5}}>\n <Typography variant=\"h5\" fontWeight={600}>\n Connect to an existing Zoom meeting\n </Typography>\n <Box sx={{mt: 0.5, color: palette.darkerGray}}>\n Enter you meeting URL or ID and passcode (if required).\n </Box>\n </Box>\n\n <Stack mb={1} direction=\"row\" gap={0.5} alignItems=\"center\">\n <Typography sx={{fontSize: '16px', fontWeight: 'bold'}}>\n Zoom Meeting URL or meeting ID:\n </Typography>\n\n <Tooltip\n content=\"You can find it on your meeting invitation email or in your “upcoming meetings” area in\n Zoom\"\n >\n <ErrorIcon sx={{color: palette.gray4, fontSize: '14px'}} />\n </Tooltip>\n </Stack>\n <Controller\n control={control}\n name=\"url\"\n render={({field, fieldState: {error}}) => (\n <TextField\n {...field}\n autoFocus={true}\n variant=\"standard\"\n placeholder=\"https://name.zoom.us/j/6522688015 or 6522688015\"\n fullWidth={true}\n helperText={error?.message ?? ' '}\n inputProps={{'data-id': 'zoom-url'}}\n error={!isNil(error)}\n onChange={(e) => {\n e.target.value = e.target.value.replace(/\\s/g, '');\n field.onChange(e);\n }}\n />\n )}\n />\n\n <Stack my={1} direction=\"row\" gap={0.5} alignItems=\"center\">\n <Typography sx={{fontSize: 16, fontWeight: 'bold'}}>Passcode:</Typography>\n\n <Typography fontSize={16} color={palette.gray3}>\n (if required)\n </Typography>\n\n <Tooltip content=\"You can find it on your meeting invitation email\">\n <ErrorIcon sx={{color: palette.gray4, fontSize: '14px'}} />\n </Tooltip>\n </Stack>\n <Controller\n control={control}\n name=\"code\"\n render={({field, fieldState: {error}}) => (\n <TextField\n {...field}\n fullWidth={true}\n placeholder=\"1234567890\"\n inputProps={{\n 'data-id': 'zoom-passcode',\n }}\n InputProps={{sx: {width: 230}}}\n helperText={error?.message ?? ' '}\n error={!isNil(error)}\n />\n )}\n />\n\n <Stack my={1} direction=\"row\" gap={0.5} alignItems=\"center\">\n <Typography sx={{fontSize: 16, fontWeight: 'bold'}}>Zoom identity:</Typography>\n\n <Tooltip content=\"\">\n <ErrorIcon sx={{color: palette.gray4, fontSize: '14px'}} />\n </Tooltip>\n </Stack>\n <Controller\n name=\"account\"\n control={control}\n render={({field: {onChange, ...props}}) => (\n <TextField\n select={true}\n {...props}\n fullWidth={true}\n placeholder=\"1234567890\"\n inputProps={{\n 'data-id': 'zoom-passcode',\n }}\n InputProps={{sx: {width: 230}}}\n onChange={(e) => {\n const {value} = e.target;\n if (value === 'manage') {\n router.go('connectAccountSettings', {}, {tab: 'zoom'});\n return;\n }\n\n onChange(e);\n }}\n >\n <MenuItem value=\"guest\">Join as a guest</MenuItem>\n {accounts.map((acc) => (\n <MenuItem key={acc.id} value={acc.id}>\n {acc.name}\n </MenuItem>\n ))}\n\n <MenuItem value=\"manage\" sx={{color: palette.blue}}>\n <ListItemIcon sx={{color: 'inherit'}}>\n <AddIcon />\n </ListItemIcon>\n <ListItemText>Manage identities</ListItemText>\n </MenuItem>\n </TextField>\n )}\n />\n\n <Controller\n name=\"mode\"\n control={control}\n render={({field}) => (\n <FormControl>\n <Box sx={{mt: 2, mb: 1, fontWeight: 'bold'}}>Epiphan Connect audio mode:</Box>\n\n <RadioGroup\n sx={{display: 'flex', gap: 3, flexDirection: 'row', flexWrap: 'nowrap'}}\n {...field}\n >\n <Box sx={{flex: 1}}>\n <FormControlLabel\n sx={{mb: 0}}\n value=\"isolated\"\n control={<Radio data-id=\"isolated-mode-radio\" />}\n label=\"Isolated\"\n />\n <FormHelperText sx={{ml: 3}}>\n Isolate participant audio into separate tracks. Use this to control extracted\n audio.\n </FormHelperText>\n </Box>\n\n <Box sx={{flex: 1}}>\n <FormControlLabel\n sx={{mb: 0}}\n value=\"mixed\"\n control={<Radio data-id=\"mixed-mode-radio\" />}\n label=\"Mixed\"\n />\n <FormHelperText sx={{ml: 3}}>\n Each participant's audio track will contain the mixed audio from the Zoom meeting.\n </FormHelperText>\n </Box>\n </RadioGroup>\n </FormControl>\n )}\n />\n\n <Typography sx={{color: palette.darkerGray, mt: 4, mb: 2}}>\n The Zoom meeting host will receive a pop-up in Zoom asking for streaming permissions.\n </Typography>\n\n <Typography sx={{color: palette.darkerGray, mb: 4}}>\n Connecting to a meeting can take several minutes. Give yourself sufficient time to get\n connected before the meeting start time.\n </Typography>\n <Box sx={{'& button': {width: 154}}}>\n <ProgressButton\n dataId=\"zoom_connect_button\"\n theme={THEME.PRIMARY}\n variant={VARIANT.SOLID}\n onClick={handleConnect}\n >\n Connect\n </ProgressButton>\n </Box>\n </Box>\n );\n}\n\ninterface ValidationError {\n meeting_url?: string;\n meeting_password?: string;\n}\n\ninterface AccountError {\n account_id: string;\n}\n\nfunction isValidationError(data: any): data is ValidationError {\n return 'meeting_url' in data || 'meeting_password' in data;\n}\n\nfunction isAccountError(data: any): data is AccountError {\n return 'meeting_url' in data;\n}\n","import React from 'react';\nimport {Dialog} from '@mui/material';\nimport {DialogClose} from 'app/components/sharedReactComponents/DialogClose/DialogClose';\nimport {Callback} from 'app/types/common';\nimport {ZoomConnection} from 'app/components/dialogs/ZoomConnectDialog/ZoomConnection';\n\ninterface Props extends React.ComponentProps<typeof ZoomConnection> {\n open: boolean;\n onClose: Callback;\n}\n\nexport function ZoomConnectDialog({open, accounts, onConnect, onClose}: Props) {\n return (\n <Dialog fullWidth={true} open={open} onClose={onClose}>\n <DialogClose onClose={onClose} />\n\n <ZoomConnection accounts={accounts} onConnect={onConnect} />\n </Dialog>\n );\n}\n","import React, {useState} from 'react';\nimport {Box, TextField, Typography} from '@mui/material';\nimport {Controller, useForm} from 'react-hook-form';\nimport {joiResolver} from '@hookform/resolvers/joi';\nimport Joi from 'joi';\nimport {palette} from 'app/themes/app';\nimport {isNil} from 'app/util/isNil';\nimport {BUTTON_TYPE, ProgressButton} from 'app/components/sharedReactComponents/ProgressButton';\nimport {THEME, VARIANT} from 'app/constants';\nimport {useMounted} from 'app/hooks/useIsMounted';\n\ninterface Props {\n onSubmit: Fn<Promise<any>, [pwd: string]>;\n}\n\ninterface FormData {\n passcode: string;\n}\n\nconst scheme = Joi.object<FormData>({\n passcode: Joi.string().trim().required().messages({'string.empty': 'Cannot be empty'}),\n});\n\nexport default function ZoomPasscode({onSubmit}: Props) {\n const [confirming, setConfirming] = useState(false);\n const mounted = useMounted();\n\n const {\n control,\n formState: {isValid},\n handleSubmit,\n setError,\n clearErrors,\n } = useForm<FormData>({\n defaultValues: {passcode: ''},\n resolver: joiResolver(scheme),\n });\n\n const handleApply = async (data: FormData) => {\n try {\n setConfirming(true);\n await onSubmit(data.passcode);\n } catch {\n setError('passcode', {type: 'manual', message: 'Incorrect passcode. Please try again.'});\n } finally {\n if (mounted()) {\n setConfirming(false);\n }\n }\n };\n\n return (\n <Box sx={{py: 7, px: 7}}>\n <form onSubmit={handleSubmit(handleApply)}>\n <Box sx={{mb: 3}}>\n <img\n src=\"/assets/img/logo/zoom-logo.png\"\n srcSet=\"/assets/img/logo/zoom-logo@2x.png 2x\"\n alt=\"\"\n />\n </Box>\n\n <Typography variant=\"h5\" fontWeight={600}>\n Invalid or missing passcode\n </Typography>\n\n <Box sx={{mt: 0.5, mb: 3, color: palette.darkerGray}}>\n Enter you passcode. It can be found in your meeting invitation or meeting details page.\n </Box>\n\n <Controller\n control={control}\n name=\"passcode\"\n render={({field, fieldState: {error}}) => (\n <TextField\n {...field}\n inputProps={{'data-id': 'zoom-pwd'}}\n InputProps={{sx: {width: 170}}}\n autoFocus={true}\n variant=\"standard\"\n placeholder=\"Passcode\"\n helperText={error?.message ?? ' '}\n error={!isNil(error)}\n onChange={(e) => {\n clearErrors();\n field.onChange(e);\n }}\n />\n )}\n />\n\n <Box sx={{mt: 3, '& button': {width: 154}}}>\n <ProgressButton\n type={BUTTON_TYPE.SUBMIT}\n dataId=\"zoom_pwd_button\"\n loading={confirming}\n theme={THEME.PRIMARY}\n variant={VARIANT.SOLID}\n disabled={!isValid}\n >\n Apply\n </ProgressButton>\n </Box>\n </form>\n </Box>\n );\n}\n","import React from 'react';\nimport ZoomPasscode from 'app/components/dialogs/ZoomPasscodeDialog/ZoomPasscode';\nimport {Callback} from 'app/types/common';\nimport {Dialog} from '@mui/material';\nimport {DialogClose} from 'app/components/sharedReactComponents/DialogClose/DialogClose';\n\ntype Props = React.ComponentProps<typeof ZoomPasscode> & {\n open: boolean;\n onClose: Callback;\n};\n\nexport function ZoomPasscodeDialog({open, onClose, ...props}: Props) {\n return (\n <Dialog open={open} fullWidth={true} maxWidth=\"sm\" onClose={onClose}>\n <DialogClose onClose={onClose} />\n <ZoomPasscode {...props} />\n </Dialog>\n );\n}\n","import {Store, StoreProps} from 'app/util/Store';\n\ninterface UserTeamStoreProps extends StoreProps {\n teamId: string;\n userId: string;\n}\n\nclass UserTeamStore {\n private readonly store: Store;\n private readonly defaultValue: string;\n private readonly teamId: string;\n private readonly userId: string;\n\n constructor({\n defaultValue,\n storeKey,\n teamId,\n userId,\n }: UserTeamStoreProps) {\n this.store = new Store({\n storeKey,\n defaultValue: {},\n });\n this.defaultValue = defaultValue;\n this.teamId = teamId;\n this.userId = userId;\n }\n\n load<T = any>(): T {\n const teams = this.store.load();\n const data = teams?.[this.teamId]?.[this.userId];\n\n return data ?? this.defaultValue;\n }\n\n save<T = any>(data: T) {\n const teams = this.store.load();\n\n if (teams[this.teamId] === undefined) {\n teams[this.teamId] = {};\n }\n\n teams[this.teamId][this.userId] = data;\n\n this.store.save(teams);\n }\n}\n\nexport {\n UserTeamStore,\n};\n","import {UserTeamStore} from 'app/util/UserTeamStore';\n\ninterface CustomerStorageArgs<Value extends any = any> {\n defaultValue: Value;\n key: string;\n teamId: string;\n userId: string;\n}\n\nexport class CustomerStorage<Value extends any = any> {\n private readonly storage: UserTeamStore;\n\n constructor({defaultValue, key, teamId, userId}: CustomerStorageArgs<Value>) {\n this.storage = new UserTeamStore({\n defaultValue,\n storeKey: key,\n teamId,\n userId,\n });\n }\n\n getValue() {\n return this.storage.load<Value>();\n }\n\n setValue(value?: Value) {\n this.storage.save<Value | undefined>(value);\n }\n}\n","import {useEffect, useRef, useState} from 'react';\nimport {CustomerStorage} from 'app/util/LocalStorage/CustomerStorage';\n\ninterface Args<V extends any = string> {\n teamId: string;\n userId: string;\n defaultValue: V;\n key: string;\n}\n\nexport function useStorageValue<V extends any = string>({\n defaultValue,\n key,\n teamId,\n userId,\n}: Args<V>) {\n const [value, setValue] = useState<V>(defaultValue);\n\n const storage = useRef<CustomerStorage<V> | undefined>(undefined);\n\n useEffect(() => {\n if (key && teamId && userId) {\n storage.current = new CustomerStorage<V>({\n defaultValue,\n key,\n teamId,\n userId,\n });\n\n const saved = storage.current.getValue();\n setValue(saved);\n }\n }, [key, teamId, userId, defaultValue]);\n\n useEffect(() => {\n if (storage.current) {\n storage.current.setValue(value);\n }\n }, [value]);\n\n return [value, setValue] as const;\n}\n","import React from 'react';\nimport {\n Box,\n Checkbox,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n FormControlLabel,\n Stack,\n Typography,\n} from '@mui/material';\nimport {Prompt} from 'app/types/common';\nimport {Button} from 'app/components/sharedReactComponents/Button';\nimport {THEME, VARIANT} from 'app/constants';\n\ninterface Props extends Prompt {\n state: boolean;\n setState: Fn<any, [state: boolean]>;\n}\n\nexport function StartingZoomMeetingDialog({open, state, setState, onClose}: Props) {\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n setState(e.target.checked);\n };\n\n return (\n <Dialog fullWidth={true} maxWidth=\"sm\" open={open} onClose={onClose}>\n <DialogTitle fontWeight={600} variant=\"h5\">\n Connect is initializing...\n <br />\n Some permissions are needed\n </DialogTitle>\n <DialogContent>\n <Stack alignItems=\"center\">\n <Typography textAlign=\"center\">\n The Zoom meeting host might receive a pop-up asking to approve\n <br /> permissions for Epiphan Connect. These permissions must be <br />\n approved for Connect to work.\n </Typography>\n\n <Box sx={{mt: 2, mb: 5}}>\n <img\n src=\"/assets/img/connect/permission-request.png\"\n srcSet=\"assets/img/connect/permission-request@2x.png 2x\"\n alt=\"zoom recoding modal\"\n width={390}\n height={178}\n />\n </Box>\n\n <FormControlLabel\n control={<Checkbox data-id=\"checkbox\" checked={state} onChange={handleChange} />}\n label=\"Don't show this again\"\n />\n </Stack>\n </DialogContent>\n <DialogActions sx={{'& > button': {minWidth: '170px'}}}>\n <Button\n dataId=\"confirm-button\"\n variant={VARIANT.SOLID}\n theme={THEME.SUCCESS}\n onClick={onClose}\n >\n Ok\n </Button>\n </DialogActions>\n </Dialog>\n );\n}\n","import React, {useState} from 'react';\nimport {Sx} from 'app/types/common';\nimport {\n Box,\n Link,\n ListItemIcon,\n ListItemText,\n MenuItem,\n Stack,\n TextField,\n Typography,\n} from '@mui/material';\nimport {joiResolver} from '@hookform/resolvers/joi';\nimport {grey} from '@mui/material/colors';\nimport AddIcon from '@mui/icons-material/Add';\nimport Joi from 'joi';\nimport {Controller, useForm} from 'react-hook-form';\nimport {router} from 'app/router/main';\nimport {palette} from 'app/themes/app';\nimport {BUTTON_TYPE, ProgressButton} from 'app/components/sharedReactComponents/ProgressButton';\nimport {THEME, VARIANT} from 'app/constants';\nimport {isNil} from 'app/util/isNil';\nimport {useMounted} from 'app/hooks/useIsMounted';\n\nexport interface ZoomIdentityArgs {\n id: string;\n identity: App.Connect.Auth.ZoomId;\n}\n\ninterface FormData {\n identity: App.Connect.Auth.ZoomId;\n}\n\nconst scheme = Joi.object<FormData>({\n identity: Joi.string().required().invalid('none'),\n}).messages({\n 'any.required': 'Required field',\n 'string.empty': 'Required field',\n});\n\ninterface Props extends Sx {\n args: ZoomIdentityArgs;\n accounts: App.Connect.Auth.ZoomAccount[];\n onApply: Fn<Promise<void>, [id: string, account: string]>;\n}\n\nexport function ZoomIdentity({sx, args, accounts, onApply}: Props) {\n const {\n control,\n formState: {isValid},\n handleSubmit,\n } = useForm<FormData>({\n defaultValues: {identity: accounts.find((a) => a.id === args.identity)?.id ?? 'none'},\n resolver: joiResolver(scheme),\n });\n\n const isMounted = useMounted();\n\n const [handling, setHandling] = useState(false);\n\n const handleApply = async (data: FormData) => {\n setHandling(true);\n\n try {\n await onApply(args.id, data.identity);\n } finally {\n if (isMounted()) {\n setHandling(false);\n }\n }\n };\n\n return (\n <Box p={7} sx={sx}>\n <form onSubmit={handleSubmit(handleApply)}>\n <Box sx={{mb: 3}}>\n <img\n src=\"/assets/img/logo/zoom-logo.png\"\n srcSet=\"/assets/img/logo/zoom-logo@2x.png 2x\"\n alt=\"\"\n />\n </Box>\n\n <Typography variant=\"h5\" fontWeight=\"bold\">\n This meeting only allows authenticated users.\n </Typography>\n\n <Box sx={{mt: 1, mb: 5, color: grey[500]}}>\n This meeting only allows authenticated users to join or your selected Zoom identity wasn't\n accepted. Either select a different Zoom identity or ask the Zoom meeting host to change\n meeting settings to allow anonymous participants. <Link href=\"ss\">Read more</Link>\n </Box>\n\n <Stack my={1} direction=\"row\" gap={0.5} alignItems=\"center\">\n <Typography sx={{fontSize: 16, fontWeight: 'bold'}}>Zoom identity:</Typography>\n </Stack>\n\n <Controller\n name=\"identity\"\n control={control}\n render={({field: {onChange, ...props}, fieldState: {error}}) => (\n <TextField\n {...props}\n variant=\"standard\"\n autoFocus={true}\n select={true}\n fullWidth={true}\n helperText={error?.message ?? ' '}\n error={!isNil(error)}\n inputProps={{\n 'data-id': 'zoom-account',\n }}\n InputProps={{sx: {width: 230}}}\n onChange={(e) => {\n const {value} = e.target;\n if (value === 'manage') {\n router.go('connectAccountSettings', {}, {tab: 'zoom'});\n return;\n }\n\n onChange(e);\n }}\n >\n <MenuItem value=\"none\">\n <em>Select identity</em>\n </MenuItem>\n {accounts.map((acc) => (\n <MenuItem key={acc.id} value={acc.id}>\n {acc.name}\n </MenuItem>\n ))}\n\n <MenuItem value=\"manage\" sx={{color: palette.blue}}>\n <ListItemIcon sx={{color: 'inherit'}}>\n <AddIcon />\n </ListItemIcon>\n <ListItemText>Manage identities</ListItemText>\n </MenuItem>\n </TextField>\n )}\n />\n\n <Box mt={5} sx={{'& button': {width: 154}}}>\n <ProgressButton\n disabled={!isValid}\n loading={handling}\n type={BUTTON_TYPE.SUBMIT}\n dataId=\"apply-identity-btn\"\n theme={THEME.PRIMARY}\n variant={VARIANT.SOLID}\n >\n Apply\n </ProgressButton>\n </Box>\n </form>\n </Box>\n );\n}\n","import {Dialog} from '@mui/material';\nimport {ZoomIdentity} from 'app/components/MeetingsManager/dialogs/ZoomIdentityDialog/ZoomIdentity/ZoomIdentity';\nimport {DialogClose} from 'app/components/sharedReactComponents/DialogClose/DialogClose';\nimport {Prompt} from 'app/types/common';\nimport React from 'react';\n\ninterface Props extends Prompt, React.ComponentProps<typeof ZoomIdentity> {}\n\nexport function ZoomIdentityDialog({open, args, accounts, onApply, onClose}: Props) {\n return (\n <Dialog fullWidth={true} open={open} onClose={onClose}>\n <DialogClose onClose={onClose} />\n\n <ZoomIdentity args={args} accounts={accounts} onApply={onApply} />\n </Dialog>\n );\n}\n","import React from 'react';\nimport {Box, Dialog, DialogActions, DialogTitle} from '@mui/material';\nimport {DialogClose} from 'app/components/sharedReactComponents/DialogClose/DialogClose';\nimport {Prompt} from 'app/types/common';\nimport {OverflowTooltip} from 'app/components/sharedReactComponents/OverflowTooltip/OverflowTooltip';\nimport {palette} from 'app/themes/app';\nimport {ProgressButton} from 'app/components/sharedReactComponents/ProgressButton';\nimport {THEME, VARIANT} from 'app/constants';\nimport {Button} from 'app/components/sharedReactComponents/Button';\nimport {Notifications} from 'app/components/Notifications';\n\ninterface Props extends Prompt {\n name: string;\n onDelete(): Promise<void>;\n}\n\nexport function DeleteCallDialog({open, name, onDelete, onClose}: Props) {\n const handleDelete = async () => {\n try {\n await onDelete();\n } catch {\n Notifications.addErrorNotification(`Could not delete meeting`);\n }\n };\n\n return (\n <Dialog open={open} onClose={onClose} maxWidth=\"xs\" fullWidth={true}>\n <DialogClose onClose={onClose} />\n <DialogTitle>\n Delete{' '}\n <Box sx={{color: palette.blue}} component=\"span\">\n <OverflowTooltip>{name}</OverflowTooltip>\n </Box>\n </DialogTitle>\n <DialogActions>\n <ProgressButton\n dataId=\"modal_confirm_button\"\n theme={THEME.DANGER}\n variant={VARIANT.SOLID}\n autoFocus={true}\n onClick={handleDelete}\n >\n Delete\n </ProgressButton>\n\n <Button\n dataId=\"modal_cancel_button\"\n theme={THEME.SECONDARY}\n variant={VARIANT.OUTLINE}\n onClick={onClose}\n >\n Cancel\n </Button>\n </DialogActions>\n </Dialog>\n );\n}\n","import React, {createContext, useMemo, useContext, useState} from 'react';\nimport {TeamsConnectDialog} from 'app/components/dialogs/TeamsConnectDialog/TeamsConnectDialog';\nimport {ConnectToHostedDialog} from 'app/components/dialogs/ConnectToHostedDialog/ConnectToHostedDialog';\nimport {ZoomConnectDialog} from 'app/components/dialogs/ZoomConnectDialog/ZoomConnectDialog';\nimport {MeetingsApiService} from 'app/services/api/meetings/MeetingsApiService';\nimport {ZoomPasscodeDialog} from 'app/components/dialogs/ZoomPasscodeDialog/ZoomPasscodeDialog';\nimport {useStorageValue} from 'app/components/pages/MeetingDetails/ParticipantsList/useStorageValue';\nimport {StartingZoomMeetingDialog} from 'app/components/dialogs/StartingZoomMeetingDialog/StartingZoomMeetingDialog';\nimport {useZoomAccounts} from 'app/hooks/useZoomAccounts';\nimport {ZoomIdentityArgs} from 'app/components/MeetingsManager/dialogs/ZoomIdentityDialog/ZoomIdentity/ZoomIdentity';\nimport {ZoomIdentityDialog} from 'app/components/MeetingsManager/dialogs/ZoomIdentityDialog/ZoomIdentityDialog';\nimport {DeleteCallDialog} from 'app/components/MeetingsManager/dialogs/DeleteCallDialog/DeleteCallDialog';\n\ninterface HostedArgs {\n id: string;\n url: string;\n}\n\nexport type ConnectActions = {\n openTeams: Fn;\n openZoom: Fn;\n connectHosted: Fn<void, [args: HostedArgs]>;\n enterPasscode: Fn<void, [id: string]>;\n setIdentity: Fn<void, [args: ZoomIdentityArgs]>;\n deleteCall: Fn<void, [c: App.Connect.Call]>;\n};\n\nexport const ConnectContext = createContext<ConnectActions | undefined>(undefined);\n\ntype View =\n | 'connect-zoom'\n | 'connect-teams'\n | 'connect-hosted'\n | 'zoom-pwd'\n | 'zoom-starting'\n | 'zoom-identity'\n | 'delete-call';\n\ninterface Props {\n teamId: string;\n userId: string;\n hasTenants: boolean;\n canEdit: boolean;\n reloadHosted: Fn<Promise<any>>;\n reloadMeetings: Fn<Promise<any>>;\n onPair: Fn;\n}\n\nexport function useConnectAction() {\n const ctx = useContext(ConnectContext);\n\n if (!ctx) {\n throw new Error('Component should be in context');\n }\n\n return ctx;\n}\n\nexport function ConnectManager({\n teamId,\n userId,\n children,\n hasTenants,\n canEdit,\n reloadHosted,\n reloadMeetings,\n onPair,\n}: React.PropsWithChildren<Props>) {\n const [view, setView] = useState<View | undefined>();\n\n const [zoomIdentityArgs, setZoomIdentityArgs] = useState<ZoomIdentityArgs | undefined>(undefined);\n const [deleteCallArgs, setDeleteCallArgs] = useState<App.Connect.Call | undefined>(undefined);\n\n const [hostedArgs, setHostedArgs] = useState<HostedArgs | undefined>();\n const [zoomMeeting, setZoomMeeting] = useState('');\n\n const zoomQuery = useZoomAccounts({enabled: true, teamId});\n\n const handleClean = () => {\n setZoomIdentityArgs(undefined);\n setHostedArgs(undefined);\n setZoomMeeting('');\n };\n\n const handleClose = () => {\n setView(undefined);\n handleClean();\n };\n\n const handlePair = () => {\n handleClose();\n onPair();\n };\n\n const [skipStarting, setSkipStarting] = useStorageValue<boolean>({\n defaultValue: false,\n teamId,\n userId,\n key: 'Dialogs.StartingZoom',\n });\n\n const actions = useMemo<ConnectActions>(\n () => ({\n connectHosted: (data) => {\n setHostedArgs(data);\n setView('connect-hosted');\n },\n openTeams: () => {\n setView('connect-teams');\n },\n openZoom: () => {\n setView('connect-zoom');\n },\n enterPasscode: (id: string) => {\n setZoomMeeting(id);\n setView('zoom-pwd');\n },\n setIdentity: (p) => {\n setZoomIdentityArgs(p);\n setView('zoom-identity');\n },\n deleteCall: (p) => {\n setDeleteCallArgs(p);\n setView('delete-call');\n },\n }),\n [],\n );\n\n const handleZoomConnect = async (\n data: Parameters<React.ComponentProps<typeof ZoomConnectDialog>['onConnect']>[0],\n ) => {\n const {mode, code, url, account} = data;\n\n await MeetingsApiService.connectToMeeting({\n isolated_audio: mode === 'isolated',\n kind: 'zoom',\n meeting_url: url,\n meeting_password: code,\n account_id: account === 'guest' ? undefined : account,\n });\n\n if (!skipStarting) {\n handleClean();\n setView('zoom-starting');\n } else {\n handleClose();\n }\n };\n\n const handleTeamsConnect = async (\n data: Parameters<React.ComponentProps<typeof TeamsConnectDialog>['onConnect']>[0],\n ) => {\n const {mode, url} = data;\n\n await MeetingsApiService.connectToMeeting({\n kind: 'teams',\n isolated_audio: mode === 'isolated',\n meeting_url: url,\n });\n\n await reloadMeetings();\n handleClose();\n };\n\n const handleTeamsCreate = async (name: string) => {\n await MeetingsApiService.createHosted(name);\n await reloadHosted();\n handleClose();\n };\n\n const handleHostedConnect = async (mode: App.Connect.ConnectionMode) => {\n if (!hostedArgs) {\n return;\n }\n\n const {url} = hostedArgs;\n await MeetingsApiService.connectToMeeting({\n kind: 'teams',\n isolated_audio: mode === 'isolated',\n meeting_url: url,\n });\n\n await reloadMeetings();\n handleClose();\n };\n\n const handleZoomPasscode = async (pwd: string) => {\n if (!zoomMeeting) {\n return;\n }\n\n await MeetingsApiService.setPasscode(zoomMeeting, {meeting_password: pwd});\n handleClose();\n };\n\n const handleDeleteCall = async () => {\n if (!deleteCallArgs) {\n return;\n }\n\n await MeetingsApiService.deleteCall(deleteCallArgs.id);\n await reloadHosted();\n handleClose();\n };\n\n const handleApplyZoomAccount = async (meetingId: string, accountId: string) => {\n await MeetingsApiService.setZoomAccount(meetingId, {account_id: accountId});\n handleClose();\n };\n\n return (\n <ConnectContext.Provider value={actions}>\n <TeamsConnectDialog\n open={view === 'connect-teams'}\n canPair={canEdit}\n hasTenants={hasTenants}\n onConnect={handleTeamsConnect}\n onCreate={handleTeamsCreate}\n onClose={handleClose}\n onPair={handlePair}\n />\n\n <ZoomConnectDialog\n open={view === 'connect-zoom'}\n accounts={zoomQuery.data ?? []}\n onConnect={handleZoomConnect}\n onClose={handleClose}\n />\n\n {hostedArgs && (\n <ConnectToHostedDialog\n open={view === 'connect-hosted'}\n onConnect={handleHostedConnect}\n onClose={handleClose}\n />\n )}\n\n <ZoomPasscodeDialog\n open={view === 'zoom-pwd'}\n onSubmit={handleZoomPasscode}\n onClose={handleClose}\n />\n\n <StartingZoomMeetingDialog\n open={view === 'zoom-starting'}\n state={skipStarting}\n setState={setSkipStarting}\n onClose={handleClose}\n />\n\n {zoomIdentityArgs && (\n <ZoomIdentityDialog\n open={view === 'zoom-identity'}\n args={zoomIdentityArgs}\n accounts={zoomQuery.data ?? []}\n onApply={handleApplyZoomAccount}\n onClose={handleClose}\n />\n )}\n {deleteCallArgs && (\n <DeleteCallDialog\n name={deleteCallArgs.name}\n open={view === 'delete-call'}\n onDelete={handleDeleteCall}\n onClose={handleClose}\n />\n )}\n {children}\n </ConnectContext.Provider>\n );\n}\n","import React from 'react';\nimport {Stack, Typography} from '@mui/material';\nimport FiberManualRecordIcon from '@mui/icons-material/FiberManualRecord';\nimport WarningIcon from '@mui/icons-material/Warning';\nimport {grey} from '@mui/material/colors';\nimport {Component, Sx} from 'app/types/common';\nimport {Icons} from 'app/util/icons';\nimport {LegacyIcon} from 'app/components/sharedReactComponents/LegacyIcon/LegacyIcon';\nimport {palette} from 'app/themes/app';\n\ninterface Props extends Sx, Component {\n name: string;\n platform: App.Connect.Platform;\n available: boolean;\n}\n\nexport function PlatformAccount({dataId, sx, name, platform, available}: Props) {\n return (\n <Stack data-id={dataId} sx={sx} direction=\"row\" alignItems=\"center\" gap={0.5}>\n {available ? (\n <FiberManualRecordIcon sx={{color: palette.green, fontSize: 10}} />\n ) : (\n <WarningIcon sx={{color: palette.red, fontSize: 16}} />\n )}\n <LegacyIcon sx={{fontSize: 16}}>\n {(platform === 'teams' ? Icons.microsoftTeams() : Icons.zoom()).reactComponent()}\n </LegacyIcon>\n <Typography color={grey[500]}>{name}</Typography>\n </Stack>\n );\n}\n","import React, {PropsWithChildren, useState} from 'react';\nimport {Box, Link, Menu, MenuItem, Stack, Typography} from '@mui/material';\nimport {grey} from '@mui/material/colors';\nimport KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';\nimport KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp';\nimport {Sx} from 'app/types/common';\nimport {Button} from 'app/components/sharedReactComponents/Button';\nimport {THEME, VARIANT} from 'app/constants';\nimport {router} from 'app/router/main';\nimport {Icons} from 'app/util/icons';\nimport {useConnectAction} from 'app/components/MeetingsManager/ConnectManager';\nimport {isNil} from 'app/util/isNil';\nimport {PlatformAccount} from 'app/components/MeetingsManager/MeetingsHeader/PlatformAccount/PlatformAccount';\n\ninterface Props extends Sx {\n tenants: App.Connect.Auth.TeamsTenant[];\n accounts: App.Connect.Auth.ZoomAccount[];\n canCreate: boolean;\n canEditTenants: boolean;\n}\n\nexport function MeetingsHeader({sx, tenants, accounts, canCreate, canEditTenants}: Props) {\n const {openTeams, openZoom} = useConnectAction();\n\n const [anchorEl, setAnchorEl] = useState<HTMLElement | undefined>();\n const openMenu = (e: React.SyntheticEvent<HTMLButtonElement>) => {\n setAnchorEl(e.currentTarget);\n };\n\n const closeMenu = () => setAnchorEl(undefined);\n\n const open = !isNil(anchorEl);\n\n const renderList = () => {\n if (tenants.length === 0) {\n return null;\n }\n\n return (\n <div>\n <span>\n <Typography component=\"span\" mb={0.5} fontWeight=\"bold\" color={grey[500]}>\n Connected accounts:\n </Typography>{' '}\n {canEditTenants && <Link href={router.url('connectAccountSettings')}>edit</Link>}\n </span>\n\n <Stack flexWrap=\"wrap\" mt={1} direction=\"row\" alignItems=\"center\" columnGap={2} rowGap={1}>\n {tenants.map((t) => (\n <PlatformAccount key={t.id} name={t.name} platform=\"teams\" available={t.available} />\n ))}\n {accounts.map((acc) => (\n <PlatformAccount key={acc.id} name={acc.name} platform=\"zoom\" available={acc.ready} />\n ))}\n </Stack>\n </div>\n );\n };\n\n const handleTeams = () => {\n openTeams();\n closeMenu();\n };\n\n const handleZoom = () => {\n openZoom();\n closeMenu();\n };\n\n return (\n <Box sx={sx}>\n <Typography fontWeight=\"bold\" fontSize={24}>\n All meetings\n </Typography>\n\n <Stack direction=\"row\" alignItems=\"flex-end\" justifyContent=\"space-between\">\n {renderList()}\n\n <Box sx={{ml: 'auto', '& > button': {width: 196}}}>\n <Button\n dataId=\"connect_to_meeting\"\n theme={THEME.PRIMARY}\n variant={VARIANT.SOLID}\n disabled={!canCreate}\n onClick={openMenu}\n >\n <Stack direction=\"row\" justifyContent=\"space-between\" flex={1}>\n <span>New meeting</span>\n {open ? <KeyboardArrowUpIcon /> : <KeyboardArrowDownIcon />}\n </Stack>\n </Button>\n <Menu anchorEl={anchorEl} open={open} PaperProps={{sx: {width: 196}}} onClose={closeMenu}>\n <MenuItem data-id=\"open-teams-btn\" onClick={handleTeams}>\n <Source>\n {Icons.microsoftTeams().reactComponent()}\n <span>Microsoft Teams</span>\n </Source>\n </MenuItem>\n <MenuItem data-id=\"open-zoom-btn\" onClick={handleZoom}>\n <Source>\n {Icons.zoom().reactComponent()}\n <span>Zoom</span>\n </Source>\n </MenuItem>\n </Menu>\n </Box>\n </Stack>\n </Box>\n );\n}\n\nfunction Source({children}: PropsWithChildren<{}>) {\n return (\n <Stack direction=\"row\" gap={1} alignItems=\"center\">\n {children}\n </Stack>\n );\n}\n","import {SxObj} from 'app/types/common';\n\nconst grid: SxObj = {\n display: 'grid',\n gridTemplateColumns:\n '[icon] 24px [icon name] 1fr [name col] 174px [col] 116px [col] 192px [col menu] 32px [menu]',\n columnGap: 1,\n alignItems: 'center',\n};\n\nexport const styles = {grid};\n","import React from 'react';\nimport {Component, SxObj} from 'app/types/common';\nimport {Box} from '@mui/material';\nimport {palette} from 'app/themes/app';\nimport {styles} from 'app/components/MeetingsManager/styles';\n\nconst root: SxObj = {\n color: palette.darkerGray,\n fontWeight: 'bold',\n fontSize: '12px',\n px: 1,\n mb: 1,\n};\n\nexport const MeetingCardHeader = ({dataId}: Component) => {\n return (\n <Box data-id={dataId} sx={[styles.grid, root]}>\n <span> </span>\n <span>Name</span>\n <span>Status</span>\n <span>Participants</span>\n <span>SRT Connections</span>\n </Box>\n );\n};\n","import React, {useEffect, useRef} from 'react';\nimport {Box} from '@mui/material';\nimport {Button} from 'app/components/sharedReactComponents/Button';\nimport {Callback, Sx, SxObj} from 'app/types/common';\nimport {SIZE, THEME, VARIANT} from 'app/constants';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\nimport {Icons} from 'app/util/icons';\n\ninterface Props extends Sx {\n url: string;\n onClick?: Callback;\n}\n\nconst styles: Record<'title' | 'url' | 'copy' | 'join', SxObj> = {\n title: {textAlign: 'center'},\n url: {textAlign: 'center', fontSize: '10px', color: '#A4B0C0'},\n copy: {ml: 0.5, '& .cr-icon': {}},\n join: {ml: 0.5, '& .cr-icon': {rotate: '135deg'}},\n};\n\nexport function CopyUrl({url, sx, onClick}: Props) {\n const copyRef = useRef<any>(null);\n const timeoutRef = useRef<number>(0);\n\n const renderContent = () => (\n <Box>\n <Box sx={styles.title}>Copy and share the URL with the meeting participants</Box>\n <Box sx={styles.url}>{url}</Box>\n </Box>\n );\n\n const handleCopy = async (e: React.SyntheticEvent) => {\n onClick?.(e);\n\n if ('clipboard' in navigator) {\n await navigator.clipboard.writeText(url);\n } else {\n document.execCommand('copy', false, url);\n }\n\n copyRef.current.show();\n window.clearTimeout(timeoutRef.current);\n timeoutRef.current = window.setTimeout(() => {\n if (copyRef.current) {\n copyRef.current.hide();\n }\n }, 1500);\n };\n\n useEffect(() => {\n return () => {\n window.clearTimeout(timeoutRef.current);\n };\n }, []);\n\n return (\n <Tooltip content={renderContent()}>\n <Box sx={sx}>\n <Tooltip ref={copyRef} content=\"Copied!\" trigger=\"manual\">\n <span>\n <Button\n variant={VARIANT.LINK_UNDERLINE}\n theme={THEME.SUCCESS}\n dataId=\"meeting_url\"\n onClick={handleCopy}\n >\n Meeting URL\n <Box sx={styles.copy} component=\"span\">\n {Icons.copy().size(SIZE.S).reactComponent()}\n </Box>\n </Button>\n </span>\n </Tooltip>\n </Box>\n </Tooltip>\n );\n}\n\nexport function JoinMeeting({sx, url, onClick}: Props) {\n const handleJoin = (e: React.SyntheticEvent) => {\n onClick?.(e);\n window.open(url, '_blank', 'noopener, noreferrer');\n };\n\n return (\n <Tooltip content=\"Join as a participant\">\n <Box sx={sx}>\n <Button\n variant={VARIANT.LINK_UNDERLINE}\n theme={THEME.SUCCESS}\n dataId=\"join_meeting\"\n onClick={handleJoin}\n >\n Join meeting\n <Box sx={styles.join} component=\"span\">\n {Icons.backLeft().size(SIZE.S).reactComponent()}\n </Box>\n </Button>\n </Box>\n </Tooltip>\n );\n}\n","import React from 'react';\nimport {Box} from '@mui/material';\nimport {\n ContextMenuItem,\n EllipsedContextMenu,\n} from 'app/components/sharedReactComponents/ContextMenu';\nimport {SIZE} from 'app/constants';\nimport {Component, Sx, SxObj} from 'app/types/common';\nimport {packSx} from 'app/util/packSx/packSx';\n\ninterface Props extends Component, Sx {\n items: ContextMenuItem[];\n disabled?: boolean;\n}\n\nconst root: SxObj = {\n gridColumn: 'menu 1 / menu 2',\n '& .cr-btn': {width: '32px', height: '28px'},\n};\n\nexport const EntityMenu = ({sx, items, disabled}: Props) => {\n return (\n <Box sx={packSx(root, sx)}>\n <EllipsedContextMenu\n size={SIZE.S}\n buttonDataId=\"meeting_card_context_menu\"\n disabled={disabled}\n items={items}\n />\n </Box>\n );\n};\n","import React from 'react';\nimport {Box, CSSObject} from '@mui/material';\nimport {Callback, Component, Sx} from 'app/types/common';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {palette} from 'app/themes/app';\nimport {EntityName} from 'app/components/MeetingsManager/cards/EntityCard/EntityName/EntityName';\nimport {EntityMenu} from 'app/components/MeetingsManager/cards/EntityCard/EntityMenu/EntityMenu';\nimport {Icons} from 'app/util/icons';\nimport {styles} from 'app/components/MeetingsManager/styles';\n\nconst root: CSSObject = {\n borderRadius: 1,\n p: 1,\n border: '1px solid',\n borderColor: palette.grayMedium,\n};\n\ninterface Props extends React.PropsWithChildren<Component>, Sx {\n onClick?: Callback;\n}\n\nexport const EntityCard = ({dataId, sx, children, onClick}: Props) => {\n return (\n <Box data-id={dataId} sx={packSx(root, styles.grid, sx)} onClick={onClick}>\n {children}\n </Box>\n );\n};\n\ninterface IconProps extends Component {\n platform: App.Connect.Platform;\n}\n\nfunction Icon({dataId, platform}: IconProps) {\n return (\n <Box data-id={dataId} sx={{gridColumn: 'icon 1 / icon 2'}}>\n {(platform === 'teams' ? Icons.microsoftTeams() : Icons.zoom()).reactComponent()}\n </Box>\n );\n}\n\nEntityCard.Icon = Icon;\nEntityCard.Name = EntityName;\nEntityCard.Menu = EntityMenu;\n","import React from 'react';\nimport {Box, Stack} from '@mui/material';\nimport {Component, Sx} from 'app/types/common';\nimport {OverflowTooltip} from 'app/components/sharedReactComponents/OverflowTooltip/OverflowTooltip';\nimport {palette} from 'app/themes/app';\nimport {CopyUrl, JoinMeeting} from 'app/components/MeetingsManager/buttons';\nimport {packSx} from 'app/util/packSx/packSx';\n\ninterface Props extends Component, Sx {\n value: string;\n url: string;\n selfHosted: boolean;\n tenant?: string;\n disabled?: boolean;\n}\n\nexport function EntityName({sx, value, disabled, url, selfHosted, tenant}: Props) {\n const handleClick = (e: React.SyntheticEvent) => {\n e.stopPropagation();\n };\n\n return (\n <Box sx={packSx({minWidth: 0}, sx)}>\n <Box component=\"span\" sx={{color: disabled ? 'grey' : 'black', minWidth: 0}}>\n <OverflowTooltip dataId=\"meeting_name\">{value}</OverflowTooltip>\n </Box>\n\n <Stack direction=\"row\" gap={0.5} alignItems=\"baseline\" sx={{fontSize: '12px'}}>\n {!selfHosted && tenant && <Box sx={{color: palette.darkerGray}}>{tenant},</Box>}\n\n <Stack direction=\"row\" alignItems=\"center\" gap={1} sx={{'& .cr-btn': {p: 0}}}>\n <CopyUrl url={url} onClick={handleClick} />\n <JoinMeeting url={url} onClick={handleClick} />\n </Stack>\n </Stack>\n </Box>\n );\n}\n","import React from 'react';\nimport {Box} from '@mui/material';\nimport {Component, Sx} from 'app/types/common';\nimport {EntityCard} from 'app/components/MeetingsManager/cards/EntityCard/EntityCard';\nimport {ContextMenuItem} from 'app/components/sharedReactComponents/ContextMenu';\nimport {Icons} from 'app/util/icons';\nimport {palette} from 'app/themes/app';\nimport {SIZE, THEME, VARIANT} from 'app/constants';\nimport {Button} from 'app/components/sharedReactComponents/Button';\nimport moment from 'moment';\nimport {useConnectAction} from 'app/components/MeetingsManager/ConnectManager';\n\ninterface Props extends Component, Sx {\n call: App.Connect.Call;\n canStart: boolean;\n onDelete: Fn<void, [c: App.Connect.Call]>;\n}\n\nexport const CallCard = ({dataId, sx, call, canStart, onDelete}: Props) => {\n const handleDelete = () => onDelete(call);\n\n const items: ContextMenuItem[] = [\n {\n label: 'Delete',\n danger: true,\n icon: Icons.trash().reactComponent(),\n action: handleDelete,\n },\n ];\n\n const {connectHosted} = useConnectAction();\n\n const handleConnect = () => {\n connectHosted({id: call.id, url: call.url});\n };\n\n return (\n <EntityCard dataId={dataId} sx={sx}>\n <EntityCard.Icon platform=\"teams\" />\n\n <EntityCard.Name value={call.name} url={call.url} disabled={true} selfHosted={true} />\n\n <Box sx={{gridColumn: 'col 1 / col 2'}}>\n <Box sx={{color: palette.gray2}} data-id=\"meeting_status_text\">\n Meeting available\n </Box>\n\n <Box sx={{color: palette.darkerGray, fontSize: '12px'}}>\n Link expires <span data-id=\"expiration-date\">{formatTime(call.endAt)}</span>\n </Box>\n </Box>\n\n <Box sx={{gridColumn: 'col 2 / col 3', color: '#bdbdbd', fontSize: '12px'}}>\n Not available\n </Box>\n\n <Box sx={{gridColumn: 'col 3 / col 4'}}>\n <Button\n data-id=\"connect-hosted-btn\"\n variant={VARIANT.OUTLINE}\n theme={THEME.SUCCESS}\n size={SIZE.S}\n disabled={!canStart}\n onClick={handleConnect}\n >\n Start Connect\n </Button>\n </Box>\n\n <EntityCard.Menu items={items} />\n </EntityCard>\n );\n};\n\nfunction formatTime(timestamp: TimeStampSeconds): string {\n return moment.unix(timestamp).format('MMM D, ha');\n}\n","import React from 'react';\nimport classNames from 'classnames';\nimport {ClassName, DataId} from 'app/types/common';\n\ninterface Props extends ClassName, DataId {\n value: number;\n max?: number;\n barClassName?: string;\n}\n\nexport const Progress: React.FC<Props> = ({className, value, max = 100, barClassName, dataId}) => {\n const width = (value / max) * 100;\n\n return (\n <div data-id={dataId} className={classNames('progress', className)}>\n <div\n className={classNames('progress__bar', barClassName)}\n style={{\n width: `${width}%`,\n }}\n />\n </div>\n );\n};\n","import React, {useEffect, useRef, useState} from 'react';\nimport classNames from 'classnames';\nimport moment from 'moment';\nimport {ClassName, TimeStampSeconds} from 'app/types/common';\nimport {Progress} from 'app/components/sharedReactComponents/Progress';\nimport {isNil} from 'app/util/isNil';\n\ninterface Props extends ClassName, Args {}\n\nexport const ConnectionProgress = ({className, timestamp, zoomId, platform}: Props) => {\n const {value, estimated, status, state} = useConnectionProgress({platform, timestamp, zoomId});\n const normal = state === 'normal';\n\n return (\n <div className={classNames('connection-progress', className)}>\n <Progress\n dataId=\"connection_status_progress\"\n className=\"connection-progress__progress\"\n barClassName={classNames('connection-progress__bar', {\n 'connection-progress__bar--normal': normal,\n })}\n value={value}\n max={105}\n />\n\n <div className=\"connection-progress__info\">\n <span\n data-id=\"progress-text-desc\"\n className={classNames('connection-progress__status', {\n 'connection-progress__status--normal': normal,\n })}\n >\n {status}\n </span>\n {estimated && <span>{estimated}</span>}\n </div>\n </div>\n );\n};\n\ntype State = 'normal' | 'problem';\n\ninterface Return {\n status: string;\n state: State;\n estimated: string;\n value: number;\n}\n\nconst UPDATE_INTERVAL_IN_SEC = 2000;\n\ninterface Args {\n timestamp: TimeStampSeconds;\n zoomId?: string;\n platform: App.Connect.Platform;\n}\n\nfunction useConnectionProgress({platform, timestamp, zoomId}: Args): Return {\n const rafId = useRef<number>(0);\n const [estimated, setEstimated] = useState('');\n const [state, setState] = useState<State>('normal');\n const [status, setStatus] = useState('');\n const [value, setValue] = useState(0);\n\n useEffect(() => {\n let lastCallTimestamp: number | undefined;\n\n const isZoom = platform === 'zoom';\n const hasId = isZoom && !isNil(zoomId);\n\n const step = (time: number) => {\n if (isNil(lastCallTimestamp) || time - lastCallTimestamp < UPDATE_INTERVAL_IN_SEC) {\n const diff = moment().diff(moment.unix(timestamp), 'seconds');\n\n const meetingId = zoomId ? `meeting ID ${zoomId}` : '';\n\n if (diff <= 360) {\n setState('normal');\n setEstimated('Estimated time: 5 min');\n const next = diff / 4.5;\n setValue((prev) => (prev <= 80 ? next : 80));\n\n if (diff <= 150) {\n setStatus(`Initializing${hasId ? `: ${meetingId}` : '...'}`);\n } else if (diff <= 300) {\n setStatus(`Connecting${hasId ? `: ${meetingId}` : '...'}`);\n } else {\n setStatus(\n `Starting soon...${isZoom ? ' meeting host might receive a pop-up in Zoom' : ''}`,\n );\n }\n } else {\n if (diff > 720) {\n setValue(100);\n } else {\n const rest = diff - 360;\n const sum = rest / 18;\n setValue(80 + sum);\n }\n setState('problem');\n setEstimated('');\n setStatus(`Something is taking longer than expected${hasId ? `: ${meetingId}` : '...'}`);\n }\n }\n\n rafId.current = requestAnimationFrame(step);\n };\n\n rafId.current = requestAnimationFrame(step);\n\n return () => {\n cancelAnimationFrame(rafId.current);\n rafId.current = 0;\n };\n }, [timestamp, zoomId, platform]);\n\n return {\n estimated,\n state,\n status,\n value,\n };\n}\n","import React from 'react';\nimport {Box, Divider, Stack, Typography} from '@mui/material';\nimport {Countdown} from 'app/components/sharedReactComponents/Countdown';\nimport {palette} from 'app/themes/app';\nimport {getTimeToDate} from 'app/util/time';\nimport {calcTime} from 'app/components/sharedReactComponents/Countdown/utils';\nimport {Icons} from 'app/util/icons';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\nimport KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';\n\ninterface Props {\n id?: string;\n status: App.Connect.MeetingStatus;\n permission?: App.Connect.Permission;\n startedAt: TimeStampSeconds;\n}\n\nexport function PermissionStatus({id, startedAt, status, permission}: Props) {\n const {text, tooltip, serious} = usePermission(status, permission);\n\n return (\n <Box>\n <Stack\n sx={{color: serious ? palette.red : palette.orange2, height: '24px'}}\n direction=\"row\"\n alignItems=\"center\"\n gap={0.5}\n >\n <Tooltip content={tooltip}>\n <Stack data-id=\"meeting_status_text\" direction=\"row\" alignItems=\"center\" gap={0.5}>\n {text}\n </Stack>\n </Tooltip>\n </Stack>\n\n {permission !== 'failed' && (\n <Stack\n sx={{color: palette.blue, fontSize: 12, mt: 0.5}}\n direction=\"row\"\n alignItems=\"center\"\n gap={2}\n divider={<Divider sx={{borderColor: palette.blue}} orientation=\"vertical\" flexItem />}\n >\n <Countdown\n dataId=\"meeting_uptime\"\n timestamp={startedAt}\n calculate={calcTime}\n format={getTimeToDate}\n />\n\n {id && (\n <Typography component=\"span\" color=\"inherit\" fontSize=\"inherit\">\n Meeting ID {id}\n </Typography>\n )}\n </Stack>\n )}\n </Box>\n );\n}\n\ninterface Return {\n text: React.ReactNode;\n tooltip?: string;\n serious: boolean;\n}\n\nfunction usePermission(\n status: App.Connect.MeetingStatus,\n permission?: App.Connect.Permission,\n): Return {\n if (status === 'waiting-for-account') {\n return {\n text: (\n <>\n Action required: <u>meeting only allows authenticated users</u> <Arrow />\n </>\n ),\n serious: false,\n };\n }\n\n if (status === 'waiting-for-password') {\n return {\n text: (\n <>\n Action required: <u>invalid or missing passcode</u> <Arrow />\n </>\n ),\n serious: false,\n };\n }\n\n if (status === 'waiting-for-host') {\n return {\n text: 'Waiting for meeting start',\n tooltip: \"Zoom Meeting hasn't started yet. The meeting host needs to join the meeting.\",\n serious: false,\n };\n }\n\n if (status === 'in-waiting-room') {\n return {\n text: 'Waiting in the lobby',\n tooltip:\n 'Epiphan Connect is waiting in the meeting lobby. The meeting host has to admit it to the meeting.',\n serious: false,\n };\n }\n\n if (permission === 'failed') {\n return {\n text: <>{Icons.warning().reactComponent()} Not enough permissions in Zoom</>,\n tooltip:\n \"We weren't able to obtain the required permissions. There was a problem with the features supported in this meeting. Please change meeting permissions and try again.\",\n serious: true,\n };\n }\n\n // Streaming\n if (permission === 'requesting-streaming') {\n return {\n text: (\n <>\n Action required: <u>approve live streaming in Zoom</u> <Arrow />\n </>\n ),\n tooltip: 'The meeting host needs to approve the live streaming request in Zoom',\n serious: false,\n };\n }\n\n if (permission === 'streaming-request-timeout') {\n return {\n text: (\n <>\n Action required: <u>permission request timed out</u> <Arrow />\n </>\n ),\n tooltip: \"Meeting host hasn't approved or denied the streaming request in Zoom\",\n serious: false,\n };\n }\n\n if (permission === 'streaming-request-denied') {\n return {\n text: (\n <>\n {Icons.warning().reactComponent()}\n Action required: <u>permission request denied</u> <Arrow />\n </>\n ),\n tooltip: 'Meeting host has denied the streaming request. Click to see next steps',\n serious: true,\n };\n }\n\n // Recording\n if (permission === 'requesting-recording') {\n return {\n text: (\n <>\n Action required: <u>requesting recording in Zoom</u> <Arrow />\n </>\n ),\n tooltip: 'The meeting host needs to approve the recording permissions in Zoom',\n serious: false,\n };\n }\n\n if (permission === 'recording-request-timeout') {\n return {\n text: (\n <>\n Action required: <u>permission request timed out</u> <Arrow />\n </>\n ),\n tooltip: \"Meeting host hasn't approved or denied the recording request in Zoom\",\n serious: false,\n };\n }\n\n if (permission === 'recording-request-denied') {\n return {\n text: (\n <>\n {Icons.warning().reactComponent()}\n Action required: <u>permission request denied</u> <Arrow />\n </>\n ),\n tooltip: 'Meeting host has denied the recording request. Click to see next steps',\n serious: true,\n };\n }\n\n if (permission === 'waiting-recording') {\n return {\n text: (\n <>\n Action required: <u>manual permissions are needed</u> <Arrow />\n </>\n ),\n tooltip: 'Meeting host needs to allow recording of local files. Click to see instructions',\n serious: false,\n };\n }\n\n return {\n text: '',\n tooltip: '',\n serious: false,\n };\n}\n\nfunction Arrow() {\n return <KeyboardArrowRightIcon sx={{fontSize: 16}} />;\n}\n","import React, {useCallback, useEffect, useState} from 'react';\nimport {Box, Stack, Typography} from '@mui/material';\nimport {Callback, Component, Sx, TimeStampSeconds} from 'app/types/common';\nimport {capitalize} from 'app/components/helpers/commonHelpers';\nimport {Countdown} from 'app/components/sharedReactComponents/Countdown';\nimport {counterFormat} from 'app/util/time';\nimport {calcTime} from 'app/components/sharedReactComponents/Countdown/utils';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\nimport {ConnectionProgress} from 'app/components/MeetingsManager/cards/MeetingCard/columns/MeetingStatusColumn/ConnectionProgress/ConnectionProgress';\nimport {PermissionStatus} from 'app/components/MeetingsManager/cards/MeetingCard/columns/MeetingStatusColumn/PermissionStatus/PermissionStatus';\nimport {palette} from 'app/themes/app';\nimport {isNil} from 'app/util/isNil';\nimport {Icons} from 'app/util/icons';\nimport {THEME} from 'app/constants';\n\ntype State = App.Connect.MeetingStatus | 'deleting';\n\ninterface Props extends Component, Sx {\n status: App.Connect.MeetingStatus;\n platform: App.Connect.Platform;\n permission?: App.Connect.Permission;\n error?: string;\n createdAt: TimeStampSeconds;\n startedAt?: TimeStampSeconds;\n disconnectedAt?: TimeStampSeconds;\n deleteTimeout?: number;\n zoomId?: string;\n}\n\nexport function MeetingStatus({\n status,\n permission,\n platform,\n createdAt,\n deleteTimeout,\n startedAt,\n disconnectedAt,\n error,\n zoomId,\n sx,\n}: Props) {\n const [state, setState] = useState<State>(status);\n\n useEffect(() => {\n setState(status);\n }, [status]);\n\n const onTimeIsOut = useCallback(() => setState('deleting'), []);\n\n if (state === 'error') {\n return (\n <Box sx={sx}>\n <Tooltip content={error}>\n <Stack color={palette.red} direction=\"row\" alignItems=\"center\" gap={0.5}>\n {Icons.warning().theme(THEME.DANGER).reactComponent()}\n <Typography>Connection failed</Typography>\n </Stack>\n </Tooltip>\n </Box>\n );\n }\n\n if (state === 'starting') {\n return (\n <Box sx={sx}>\n <ConnectionProgress platform={platform} zoomId={zoomId} timestamp={createdAt} />\n </Box>\n );\n }\n\n const permissionIssue = state === 'running' && !isNil(permission) && permission !== 'ok';\n\n const waiting =\n state === 'waiting-for-account' ||\n state === 'in-waiting-room' ||\n state === 'waiting-for-host' ||\n state === 'waiting-for-password';\n\n if ((permissionIssue || waiting) && startedAt) {\n return (\n <Box sx={sx}>\n <PermissionStatus\n id={zoomId}\n permission={permission}\n startedAt={startedAt}\n status={state}\n />\n </Box>\n );\n }\n\n const disconnected = state === 'disconnected';\n const deletionTimestamp =\n disconnectedAt && deleteTimeout ? disconnectedAt + deleteTimeout : undefined;\n\n const showCountdown = disconnected && !isNil(deletionTimestamp);\n\n return (\n <Box sx={sx}>\n <Typography\n data-id=\"meeting_status_text\"\n sx={{color: statusColor(status), height: '24px'}}\n component=\"span\"\n >\n {formatStatus(state)}\n </Typography>\n\n {!isNil(startedAt) && state === 'running' && renderUptime(startedAt)}\n {showCountdown && renderCountdown(deletionTimestamp, disconnected, onTimeIsOut)}\n </Box>\n );\n}\n\nfunction statusColor(status: App.Connect.MeetingStatus) {\n switch (status) {\n case 'connecting':\n case 'disconnecting': {\n return palette.blue;\n }\n case 'error': {\n return palette.red;\n }\n\n case 'running': {\n return palette.green;\n }\n default:\n return palette.darkerGray;\n }\n}\n\nfunction formatStatus(state: State) {\n let value: string = state;\n\n switch (state) {\n case 'connecting': {\n value = 'Joining...';\n break;\n }\n\n default: {\n break;\n }\n }\n\n return capitalize(value);\n}\n\nfunction renderUptime(startedAt: TimeStampSeconds) {\n return (\n <Box sx={{color: palette.blue, fontSize: '12px'}}>\n <Countdown\n dataId=\"meeting_uptime\"\n timestamp={startedAt}\n calculate={calcTime}\n format={counterFormat}\n />\n </Box>\n );\n}\n\nfunction renderCountdown(deletedAt: TimeStampSeconds, showTip: boolean, onOut: Callback) {\n const tip = 'When time runs out, the meeting will be deleted.';\n return (\n <Box sx={{color: palette.red, fontSize: '12px'}}>\n <Countdown\n dataId=\"meeting_deletion_timer\"\n timestamp={deletedAt}\n tooltip={showTip ? tip : undefined}\n onTimeIsOut={onOut}\n />\n </Box>\n );\n}\n","import React from 'react';\nimport {ClassName} from 'app/types/common';\nimport {SIZE, THEME} from 'app/constants';\nimport {Icons} from 'app/util/icons';\nimport classNames from 'classnames';\n\ninterface Props extends ClassName {\n count: number;\n}\n\nexport const MeetingParticipantsCount = ({className, count}: Props) => {\n return (\n <div\n className={classNames('meeting-participants-count', className)}\n data-id=\"meeting_participants_count\"\n >\n {Icons.user().size(SIZE.S).theme(THEME.PRIMARY).label(`${count}`).reactComponent()}\n </div>\n );\n};\n","import {useMemo} from 'react';\nimport {Participant} from 'app/store/models/connect/Participant/Participant';\nimport {Entity} from 'app/store/models/connect/Meeting/Meeting';\n\ntype SummaryItem = {\n value: number;\n tooltip?: string;\n};\n\nexport type SrtSummaryCounts = {\n connecting: SummaryItem;\n connected: SummaryItem;\n error: SummaryItem;\n disconnected: SummaryItem;\n};\n\nfunction countStreams(entities: Entity[]): SrtSummaryCounts {\n const state: SrtSummaryCounts = {\n connecting: {value: 0},\n connected: {value: 0},\n error: {value: 0},\n disconnected: {value: 0},\n };\n\n entities.forEach((p) => {\n const {connected, disconnected, failed, started, starting, stopping} = p.stream;\n\n if (isParticipant(p) && p.state === 'left-with-stream') {\n state.disconnected.value += 1;\n return;\n }\n\n if (starting || started || stopping || disconnected) {\n state.connecting.value += 1;\n return;\n }\n\n if (connected) {\n state.connected.value += 1;\n return;\n }\n\n if (failed) {\n state.error.value += 1;\n const err = p.stream.error?.message;\n const name = p instanceof Participant ? p.name : 'Return feed';\n const row = err ? `${name} - ${err}\\n` : '';\n\n if (state.error.tooltip) {\n state.error.tooltip += row;\n } else {\n state.error.tooltip = row;\n }\n }\n });\n\n return state;\n}\n\nexport function useSrtCount(participants: Entity[]): SrtSummaryCounts {\n const state = useMemo(() => countStreams(participants), [participants]);\n return state;\n}\n\nexport function isParticipant(e: Entity): e is Participant {\n return e instanceof Participant;\n}\n","import React from 'react';\nimport classNames from 'classnames';\nimport {Component} from 'app/types/common';\nimport {Icons, SvgIcon} from 'app/util/icons';\nimport {SIZE, THEME} from 'app/constants';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\n\nexport type SrtState = 'connected' | 'connecting' | 'error' | 'disconnected';\n\ninterface Props extends Component {\n state: SrtState;\n label?: string;\n tooltip?: string;\n}\n\nfunction getIcon(state: SrtState): SvgIcon {\n if (state === 'connecting') {\n return Icons.spinner().theme(THEME.SUCCESS);\n }\n\n if (state === 'error') {\n return Icons.warning().theme(THEME.DANGER);\n }\n\n if (state === 'disconnected') {\n return Icons.disconnectedSource().theme(THEME.DANGER);\n }\n\n return Icons.streaming().theme(THEME.PRIMARY);\n}\n\nexport const SrtSummary = ({dataId, className, state, tooltip, label}: Props) => {\n return (\n <Tooltip content={tooltip}>\n <div className={classNames('srt-summary', className)} data-id={dataId}>\n {getIcon(state)\n .size(SIZE.S)\n .label(label ?? '')\n .reactComponent()}\n </div>\n </Tooltip>\n );\n};\n","import React from 'react';\nimport {Box, Stack} from '@mui/material';\nimport {Component} from 'app/types/common';\nimport {SrtSummary} from 'app/components/sharedReactComponents/MeetingSrtSummary/SrtSummary/SrtSummary';\nimport {SrtSummaryCounts} from 'app/hooks/useSrtCount';\n\ninterface Props extends Component {\n label: string;\n count: SrtSummaryCounts;\n}\n\nexport const MeetingSrtSummary = ({dataId, className, count, label}: Props) => {\n return (\n <Stack className={className} data-id={dataId} sx={{fontSize: '12px'}} direction=\"row\">\n <Box data-id=\"srt_summary_label\" component=\"span\" sx={{mr: 1, color: '#2d3546'}}>\n {label}\n </Box>\n\n <Stack sx={{gap: 1.5}} direction=\"row\">\n {count.connected.value > 0 && (\n <SrtSummary\n state=\"connected\"\n label={`${count.connected.value}`}\n tooltip=\"Connected\"\n dataId=\"srt_connected_count\"\n />\n )}\n {count.connecting.value > 0 && (\n <SrtSummary\n state=\"connecting\"\n label={`${count.connecting.value}`}\n tooltip=\"Connecting\"\n dataId=\"srt_connecting_count\"\n />\n )}\n {count.disconnected.value > 0 && (\n <SrtSummary\n state=\"disconnected\"\n label={`${count.disconnected.value}`}\n tooltip=\"Left with active stream\"\n dataId=\"srt_disconnected_count\"\n />\n )}\n {count.error.value > 0 && (\n <SrtSummary\n state=\"error\"\n label={`${count.error.value}`}\n tooltip={count.error.tooltip}\n dataId=\"srt_error_count\"\n />\n )}\n </Stack>\n </Stack>\n );\n};\n","import React from 'react';\nimport {observer} from 'mobx-react';\nimport classNames from 'classnames';\nimport {Component} from 'app/types/common';\nimport {useSrtCount} from 'app/hooks/useSrtCount';\nimport {Entity} from 'app/store/models/connect/Meeting/Meeting';\nimport {MeetingSrtSummary} from 'app/components/sharedReactComponents/MeetingSrtSummary/MeetingSrtSummary';\n\ninterface Props extends Component {\n entities: Entity[];\n label?: string;\n message?: string;\n}\n\nexport const MeetingCountColumn = observer(({className, entities, dataId}: Props) => {\n const count = useSrtCount(entities);\n const hasActiveStreams = Object.values(count).some((v) => v.value > 0);\n\n if (hasActiveStreams) {\n return <MeetingSrtSummary className={className} dataId={dataId} label=\"SRT:\" count={count} />;\n }\n\n return (\n <div data-id={dataId} className={classNames('meeting-count-column ', className)}>\n SRT: no active connections\n </div>\n );\n});\n","import React from 'react';\nimport {Callback} from 'app/types/common';\nimport {ModalPrompt} from 'app/components/sharedReactComponents/Modal/ModalPrompt';\nimport {OverflowTooltip} from 'app/components/sharedReactComponents/OverflowTooltip/OverflowTooltip';\nimport {SIZE, THEME} from 'app/constants';\nimport {ModalTitleHighlightedItem} from 'app/components/sharedReactComponents/Modal/Modal';\n\ninterface Args {\n name: string;\n onDone?: Callback;\n onClose?: Callback;\n}\n\nexport const DisconnectMeetingPrompt = {\n show({\n name,\n onClose,\n onDone,\n }: Args) {\n ModalPrompt.show({\n className: 'disconnect-meeting-prompt',\n fullWidth: true,\n maxWidth: SIZE.S,\n title: (\n <>\n Disconnect from \n <ModalTitleHighlightedItem>\n <OverflowTooltip component=\"span\">{name}</OverflowTooltip>\n </ModalTitleHighlightedItem>\n  meeting?\n </>\n ),\n body: (\n <div className=\"disconnect-meeting-prompt__message\">\n All active SRT connections will be stopped.<br/>\n <br/>\n Reconnection to the meeting will take the same amount of<br/>\n time as the initial connection did (up to several minutes).\n </div>\n ),\n confirmButtonLabel: 'Yes, disconnect',\n confirmButtonTheme: THEME.DANGER,\n onClose,\n onDone: async () => {\n return onDone?.();\n },\n });\n }\n};\n","import React from 'react';\nimport {Callback} from 'app/types/common';\nimport {ModalPrompt} from 'app/components/sharedReactComponents/Modal/ModalPrompt';\nimport {SIZE, THEME} from 'app/constants';\nimport {ModalTitleHighlightedItem} from 'app/components/sharedReactComponents/Modal/Modal';\nimport {OverflowTooltip} from 'app/components/sharedReactComponents/OverflowTooltip/OverflowTooltip';\n\ninterface Props {\n name: string;\n onDone: () => Promise<unknown>;\n onClose?: Callback;\n}\n\nexport const DeleteMeetingPrompt = {\n show({\n name,\n onClose,\n onDone,\n }: Props) {\n ModalPrompt.show({\n className: 'delete-meeting-prompt',\n fullWidth: true,\n maxWidth: SIZE.S,\n title: (\n <>\n Delete \n <ModalTitleHighlightedItem>\n <OverflowTooltip className=\"delete-meeting-prompt__name\">\n {name}\n </OverflowTooltip>\n </ModalTitleHighlightedItem>\n ?\n </>\n ),\n body: (\n <>\n This meeting will be deleted and all the meeting's data will<br/>\n be lost. Payment for this meeting will be stopped.\n </>\n ),\n confirmButtonLabel: 'Yes, delete',\n confirmButtonTheme: THEME.DANGER,\n onClose,\n onDone,\n });\n }\n};\n","import React from 'react';\nimport {observer} from 'mobx-react';\nimport {Component} from 'app/types/common';\nimport {MeetingStatus} from 'app/components/MeetingsManager/cards/MeetingCard/columns/MeetingStatusColumn/MeetingStatus';\nimport {MeetingParticipantsCount} from 'app/components/sharedReactComponents/MeetingParticipantsCount/MeetingParticipantsCount';\nimport {MeetingCountColumn} from 'app/components/MeetingsManager/cards/MeetingCard/columns/MeetingCountColumn/MeetingCountColumn';\nimport {Meeting} from 'app/store/models/connect/Meeting/Meeting';\nimport {EntityCard} from 'app/components/MeetingsManager/cards/EntityCard/EntityCard';\nimport {ContextMenuItem} from 'app/components/sharedReactComponents/ContextMenu';\nimport {THEME} from 'app/constants';\nimport {Icons} from 'app/util/icons';\nimport {DisconnectMeetingPrompt} from 'app/components/MeetingsManager/modals/DisconnectMeetingPrompt/DisconnectMeetingPrompt';\nimport {MeetingsApiService} from 'app/services/api/meetings/MeetingsApiService';\nimport {Notifications} from 'app/components/Notifications';\nimport {DeleteMeetingPrompt} from 'app/components/libs/dialogs/DeleteMeetingPrompt';\nimport {isNil} from 'app/util/isNil';\n\ninterface Props extends Component {\n meeting: Meeting;\n canStart: boolean;\n onClick: Fn<any, [meeting: Meeting]>;\n}\n\nconst processingStates: App.Connect.MeetingStatus[] = [\n 'starting',\n 'error',\n 'in-waiting-room',\n 'waiting-for-host',\n 'waiting-for-password',\n 'waiting-for-account',\n];\n\nconst disconnectable = new Set<App.Connect.MeetingStatus>([\n 'running',\n 'in-waiting-room',\n 'waiting-for-host',\n 'waiting-for-password',\n]);\n\nconst MeetingCardComponent = ({meeting, dataId, canStart, onClick}: Props) => {\n const connected = meeting.status === 'running';\n const accessIssue = connected && !isNil(meeting.permission) && meeting.permission !== 'ok';\n const expanded = processingStates.includes(meeting.status) || accessIssue;\n\n const handleCardClick = () => onClick(meeting);\n\n const handleDisconnect = async () => {\n DisconnectMeetingPrompt.show({\n name: meeting.name,\n onDone: async () => {\n try {\n await MeetingsApiService.disconnect(meeting.id);\n } catch {\n Notifications.addErrorNotification('Cannot disconnect from meeting');\n }\n },\n });\n };\n\n const handleDelete = async () => {\n DeleteMeetingPrompt.show({\n name: meeting.name,\n onDone: async () => {\n try {\n await MeetingsApiService.deleteMeeting(meeting.id);\n } catch {\n Notifications.addErrorNotification('Cannot delete connect to meeting');\n }\n },\n });\n };\n\n const items: ContextMenuItem[] = [\n {\n label: 'Disconnect',\n icon: Icons.unlink().reactComponent(),\n danger: true,\n visible: disconnectable.has(meeting.status),\n action: handleDisconnect,\n },\n {\n label: 'Reconnect',\n icon: Icons.chain().theme(THEME.PRIMARY).reactComponent(),\n visible:\n (meeting.status === 'disconnecting' || meeting.status === 'disconnected') && canStart,\n action: async () => {\n try {\n await MeetingsApiService.connect(meeting.id);\n } catch {\n Notifications.addErrorNotification('Cannot reconnect to meeting');\n }\n },\n },\n {\n label: 'Delete',\n icon: Icons.trash().reactComponent(),\n danger: true,\n visible: meeting.status !== 'running',\n action: handleDelete,\n },\n ];\n\n const ready = connected && (meeting.platform === 'zoom' ? meeting.permission === 'ok' : true);\n const clickable =\n connected ||\n meeting.status === 'waiting-for-password' ||\n meeting.status === 'waiting-for-account';\n\n return (\n <EntityCard\n dataId={dataId}\n sx={{\n cursor: clickable ? 'pointer' : 'default',\n }}\n onClick={handleCardClick}\n >\n <EntityCard.Icon platform={meeting.platform} />\n\n <EntityCard.Name\n value={meeting.name}\n url={meeting.url}\n tenant={meeting.tenant}\n selfHosted={!isNil(meeting.host)}\n disabled={!connected}\n />\n\n <MeetingStatus\n sx={{gridColumn: expanded ? 'col 1 / col 4' : 'col 1 / col 2'}}\n status={meeting.status}\n permission={meeting.permission}\n createdAt={meeting.createdAt}\n startedAt={meeting.startedAt}\n disconnectedAt={meeting.disconnectedAt}\n error={meeting.error}\n deleteTimeout={meeting.settings?.timeouts.delete}\n platform={meeting.platform}\n zoomId={meeting.zoomId}\n />\n\n {ready && (\n <>\n <MeetingParticipantsCount count={meeting.guests.length} />\n <MeetingCountColumn entities={meeting.entities} />\n </>\n )}\n\n <EntityCard.Menu items={items} disabled={!isNil(meeting.deletedAt)} />\n </EntityCard>\n );\n};\n\nexport const MeetingCard = observer(MeetingCardComponent);\n","import React from 'react';\nimport {observer} from 'mobx-react';\nimport classNames from 'classnames';\nimport {Stack} from '@mui/material';\nimport {Callback, ClassName} from 'app/types/common';\nimport {EmptyFilterMessage} from 'app/components/sharedReactComponents/EmptyFilterMessage/EmptyFilterMessage';\nimport {Meeting} from 'app/store/models/connect/Meeting/Meeting';\nimport {MeetingCardHeader} from 'app/components/MeetingsManager/MeetingCardHeader/MeetingCardHeader';\nimport {CallCard, MeetingCard} from 'app/components/MeetingsManager/cards';\nimport {useConnectAction} from 'app/components/MeetingsManager/ConnectManager';\nimport {router} from 'app/router/main';\n\ninterface Props extends ClassName {\n items: Array<Meeting | App.Connect.Call>;\n hasFilter: boolean;\n canStart: boolean;\n onClearFilter: Callback;\n}\n\nexport const MeetingsList = observer(\n ({className, items, hasFilter, canStart, onClearFilter}: Props) => {\n const {enterPasscode, setIdentity, deleteCall} = useConnectAction();\n\n const handleMeetingClick = (m: Meeting) => {\n if (m.status === 'waiting-for-password') {\n enterPasscode(m.id);\n return;\n }\n\n if (m.status === 'waiting-for-account') {\n setIdentity({id: m.id, identity: 'guest'});\n }\n\n if (m.status === 'running') {\n router.go('meetingDetails', {meetingId: m.id});\n }\n };\n\n const handleDeleteCall = (c: App.Connect.Call) => deleteCall(c);\n\n const noEntities = items.length === 0;\n const showEmptyFilter = hasFilter && noEntities;\n\n return (\n <div className={classNames('meetings-list', className)}>\n {showEmptyFilter ? (\n <EmptyFilterMessage\n message=\"Search applied, but no results found.\"\n buttonText=\"Reset search\"\n handleClear={onClearFilter}\n />\n ) : (\n <>\n <MeetingCardHeader />\n <Stack gap={1}>\n {items.map((item) => {\n if (item instanceof Meeting) {\n return (\n <MeetingCard\n key={item.id}\n dataId={item.id}\n className=\"meetings-list__meeting\"\n meeting={item}\n canStart={canStart}\n onClick={handleMeetingClick}\n />\n );\n }\n\n return (\n <CallCard\n key={item.id}\n call={item}\n dataId={item.id}\n canStart={canStart}\n onDelete={handleDeleteCall}\n />\n );\n })}\n </Stack>\n </>\n )}\n </div>\n );\n },\n);\n","import React from 'react';\nimport {Box} from '@mui/material';\nimport {Sx, SxObj} from 'app/types/common';\nimport {packSx} from 'app/util/packSx/packSx';\n\nconst root: SxObj = {\n display: 'inline-block',\n fontSize: '12px',\n color: '#979797',\n\n a: {\n color: '#979797',\n textDecoration: 'underline',\n },\n};\n\nexport function MoreDetails({sx}: Sx) {\n return (\n <Box sx={packSx(root, sx)}>\n <b>Need more info?</b> Please check our{' '}\n <a\n data-id=\"video-center-link\"\n href=\"https://fast.wistia.com/embed/channel/vbcnielsxo?wchannelid=vbcnielsxo\"\n target=\"_blank\"\n rel=\"noreferrer\"\n >\n video resource center\n </a>{' '}\n or our{' '}\n <a\n data-id=\"user-guide-link\"\n href=\"https://www.epiphan.com/userguides/connect/Content/Home-Connect.htm\"\n target=\"_blank\"\n rel=\"noreferrer\"\n >\n user guide\n </a>\n </Box>\n );\n}\n","import React from 'react';\nimport {Sx} from 'app/types/common';\nimport {MoreDetails} from 'app/components/MeetingsManager/MoreDetails/MoreDetails';\nimport {Box, Link, Stack, Typography} from '@mui/material';\nimport {palette} from 'app/themes/app';\nimport {grey} from '@mui/material/colors';\nimport {Button} from 'app/components/sharedReactComponents/Button';\nimport {THEME, VARIANT} from 'app/constants';\n\ninterface Props extends Sx {\n canSubscribe: boolean;\n onManage: Fn;\n}\n\nexport const MeetingsWelcome = ({sx, canSubscribe, onManage}: Props) => {\n return (\n <Box sx={sx}>\n <Box\n sx={{\n backgroundImage: `url('/assets/img/meetings-welcome/epiphan-connect-welcome.jpeg')`,\n backgroundSize: 'cover',\n backgroundPosition: 'center',\n }}\n borderRadius={2.5}\n px={9}\n pt={8}\n pb={10}\n >\n <Box\n mb={2}\n component=\"img\"\n maxWidth={172}\n src=\"/assets/img/meetings-welcome/epiphan-connect-logo.png\"\n srcSet=\"/assets/img/meetings-welcome/epiphan-connect-logo@2x.png 2x\"\n alt=\"\"\n />\n\n <Typography fontSize={32} color={palette.white} mb={2}>\n Turn any meeting into a <br />\n professional broadcast\n </Typography>\n\n <Typography color={palette.white} mb={2}>\n Compatible with a range of video production solutions, Epiphan\n <br />\n Connect gives you the power to extract Microsoft Teams and Zoom\n <br />\n participant feeds plus screen-sharing content, and transport them\n <br />\n into your production tools to deliver truly compelling content.\n </Typography>\n\n <Link\n href=\"https://www.epiphan.com/connect/\"\n sx={{display: 'block', mb: 2}}\n data-id=\"learn_more_button\"\n color={palette.white}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n Learn More\n </Link>\n\n <Stack sx={{mb: 5}} direction=\"row\" gap={3} alignItems=\"center\">\n <Typography color={palette.white}>Works with:</Typography>\n\n <Box\n component=\"img\"\n src=\"/assets/img/logo/teams-logo-white.png\"\n srcSet=\"/assets/img/logo/teams-logo-white@2x.png 2x\"\n width={173}\n height={28}\n alt=\"\"\n />\n\n <Box\n component=\"img\"\n src=\"/assets/img/logo/zoom-logo-white.png\"\n srcSet=\"/assets/img/logo/zoom-logo-white@2x.png 2x\"\n width={60}\n height={14}\n alt=\"\"\n />\n </Stack>\n\n <Box width={410} p={5} borderRadius={2.5} bgcolor={palette.white}>\n <Typography fontSize={24} fontWeight={600} mb={2} color={palette.blue}>\n Get started with Epiphan Connect\n </Typography>\n\n <Box p={2} bgcolor={grey[300]} borderRadius={1}>\n <Typography mb={3}>\n {canSubscribe ? (\n <>Please subscribe to Epiphan Connect before setting up your first connection.</>\n ) : (\n <> Please contact the Epiphan Cloud team owner for subscription.</>\n )}\n </Typography>\n\n {canSubscribe && (\n <Button\n dataId=\"subscribe-btn\"\n variant={VARIANT.SOLID}\n theme={THEME.INFO}\n onClick={onManage}\n >\n Subscribe\n </Button>\n )}\n </Box>\n </Box>\n </Box>\n\n <MoreDetails sx={{mt: 2}} />\n </Box>\n );\n};\n","import {useRootStore} from 'app/store/StoreContext';\nimport {MeetingsStore} from 'app/store/Meetings/MeetingsStore';\n\nexport function useMeetingsStore(): MeetingsStore {\n return useRootStore().meetings;\n}\n","import {useCallback} from 'react';\nimport {\n WSMeetingChangedDto,\n WSParticipantUpdated,\n WSReturnFeedUpdated,\n} from 'app/api/WebSocket/types';\nimport {useMeetingsStore} from 'app/store/hooks';\nimport {ConnectMapper} from 'app/util/mappers/ConnectMapper/ConnectMapper';\nimport {MeetingsApiService} from 'app/services/api/meetings/MeetingsApiService';\nimport {Notifications} from 'app/components/Notifications';\n\ninterface Return {\n onMeetingChange: (data: WSMeetingChangedDto) => void;\n onParticipantChange: (data: WSParticipantUpdated) => void;\n onReturnFeedChange: (data: WSReturnFeedUpdated) => void;\n}\n\nexport function useSocketHandlers(): Return {\n const {getMeeting, setMeeting, removeMeeting} = useMeetingsStore();\n\n const fetchMeeting = useCallback(\n async (id: string) => {\n try {\n const response = await MeetingsApiService.getMeeting(id);\n const participants = response?.participants\n ? response.participants.map(ConnectMapper.mapParticipant)\n : [];\n\n const feed = response.injection\n ? ConnectMapper.mapReturnFeed(response.injection)\n : undefined;\n\n const meeting = ConnectMapper.mapMeeting(response, participants, feed);\n\n if (meeting.deletedAt) {\n removeMeeting(meeting.id);\n return;\n }\n\n setMeeting(meeting);\n } catch {\n Notifications.addErrorNotification('Could not get meeting, please update the page');\n }\n },\n [setMeeting, removeMeeting],\n );\n\n const onMeetingChange = useCallback((data: WSMeetingChangedDto) => {\n const {metadata, ...dto} = data.Body;\n\n const targetId = dto.id;\n const meeting = getMeeting(targetId);\n\n if (meeting?.version && metadata.previous && meeting.version !== metadata.previous) {\n void fetchMeeting(meeting.id);\n return;\n }\n\n const next = ConnectMapper.mapMeeting(data.Body, meeting?.participants, meeting?.feed);\n\n if (metadata.current) {\n next.setVersion(metadata.current);\n }\n\n if (next.deletedAt) {\n removeMeeting(targetId);\n return;\n }\n\n if (next.status !== 'running') {\n next.setParticipants([]);\n }\n\n setMeeting(next);\n }, []);\n\n const onParticipantChange = useCallback((data: WSParticipantUpdated) => {\n const {metadata} = data.Body;\n const targetId = data.Body.meeting_id;\n const meeting = getMeeting(targetId);\n\n if (!meeting) {\n return;\n }\n\n // The metadata values apply to the whole meeting + participant list,\n // so if \"meeting.version !== metadata.previous\" we need to fetch the whole meeting\n if (meeting?.version && metadata.previous && meeting.version !== metadata.previous) {\n void fetchMeeting(meeting.id);\n return;\n }\n\n const next = ConnectMapper.mapParticipant(data.Body);\n\n if (next.state === 'in-lobby' || next.state === 'left') {\n meeting.removeParticipant(next.id);\n return;\n }\n\n meeting.setParticipant(next);\n\n if (metadata.current) {\n meeting.setVersion(metadata.current);\n }\n }, []);\n\n const onReturnFeedChange = useCallback((data: WSReturnFeedUpdated) => {\n const {metadata} = data.Body;\n const targetId = data.Body.meeting_id;\n const meeting = getMeeting(targetId);\n\n if (!meeting) {\n return;\n }\n\n if (meeting?.version && metadata.previous && meeting.version !== metadata.previous) {\n void fetchMeeting(meeting.id);\n return;\n }\n\n const next = ConnectMapper.mapReturnFeed(data.Body);\n\n meeting.setReturnFeed(next);\n\n if (metadata.current) {\n meeting.setVersion(metadata.current);\n }\n }, []);\n\n return {\n onMeetingChange,\n onParticipantChange,\n onReturnFeedChange,\n };\n}\n","import {useQuery} from '@tanstack/react-query';\nimport {MeetingsApiService} from 'app/services/api/meetings/MeetingsApiService';\nimport {ConnectMapper} from 'app/util/mappers/ConnectMapper/ConnectMapper';\n\nexport function useMeetingsQuery(enabled: boolean) {\n return useQuery({\n queryKey: ['meetings'],\n queryFn: async () => {\n const result = await MeetingsApiService.getMeetings(true);\n return result.meetings.map(mapMeeting);\n },\n enabled,\n });\n}\n\nfunction mapMeeting(meeting: Contracts.Connect.Meeting) {\n const feed = meeting.injection ? ConnectMapper.mapReturnFeed(meeting.injection) : undefined;\n\n return ConnectMapper.mapMeeting(\n meeting,\n meeting.participants?.map(ConnectMapper.mapParticipant),\n feed,\n );\n}\n\nexport function useCallsQuery(enabled: boolean) {\n return useQuery({\n queryKey: ['calls'],\n queryFn: async () => {\n const result = await MeetingsApiService.getCalls();\n return result.ms_teams_calls.map(ConnectMapper.mapCall);\n },\n enabled,\n });\n}\n","import {useMeetingsSocket} from 'app/hooks/Meeting/useMeetingsSocket';\nimport {useMeetingsStore} from 'app/store/hooks';\nimport {\n useCallsQuery,\n useMeetingsQuery,\n} from 'app/components/MeetingsManager/hooks/useMeetingsQuery';\nimport {useCallback, useEffect, useState} from 'react';\nimport {WS} from 'app/api/WebSocket/WS';\nimport {ConnectMapper} from 'app/util/mappers/ConnectMapper/ConnectMapper';\nimport {WSTeamsCallUpdated} from 'app/api/WebSocket/types';\nimport {Meeting} from 'app/store/models/connect/Meeting/Meeting';\n\nfunction useRegularMeetings(enabled: boolean) {\n const {meetings, setMeetings} = useMeetingsStore();\n\n const meetingsQuery = useMeetingsQuery(enabled);\n\n useEffect(() => {\n if (!enabled || meetingsQuery.isInitialLoading) {\n setMeetings([]);\n return;\n }\n\n setMeetings(meetingsQuery.data ?? []);\n }, [enabled, meetingsQuery.isInitialLoading, setMeetings, meetingsQuery.data]);\n\n useMeetingsSocket(enabled && meetingsQuery.isSuccess);\n\n return {\n meetings,\n meetingsQuery,\n };\n}\n\nfunction useHostedMeetings(enabled: boolean) {\n const {calls, setCalls, removeCall, setCall} = useMeetingsStore();\n const callsQuery = useCallsQuery(enabled);\n\n useEffect(() => {\n if (!enabled || callsQuery.isInitialLoading) {\n setCalls([]);\n return;\n }\n\n setCalls(callsQuery.data ?? []);\n }, [callsQuery.data, enabled, setCalls, callsQuery.isInitialLoading]);\n\n const handleTeamsCallWs = useCallback(\n (data: WSTeamsCallUpdated) => {\n const call = ConnectMapper.mapCall(data.Body);\n if (call.deletedAt) {\n removeCall(call.id);\n } else {\n setCall(call);\n }\n },\n [removeCall, setCall],\n );\n\n useEffect(() => {\n if (callsQuery.isInitialLoading || !enabled) {\n return;\n }\n\n WS.onTeamsCallUpdate(handleTeamsCallWs);\n\n return () => {\n WS.onTeamsCallUpdate(handleTeamsCallWs);\n };\n }, [callsQuery.isInitialLoading, enabled, handleTeamsCallWs]);\n\n return {\n calls,\n callsQuery,\n };\n}\n\nfunction useConnectItems(meetings: Meeting[], calls: App.Connect.Call[]) {\n const [items, setItems] = useState<Array<App.Connect.Call | Meeting>>([]);\n\n useEffect(() => {\n const displayedCalls = calls.filter(\n (c) => !meetings.some((m) => m.platform === 'teams' && c.id === m.host),\n );\n setItems([...displayedCalls, ...meetings]);\n }, [calls, meetings]);\n\n return items;\n}\n\ninterface Props {\n enabled: boolean;\n}\n\nexport function useMeetings({enabled}: Props) {\n const {meetings, meetingsQuery} = useRegularMeetings(enabled);\n const {calls, callsQuery} = useHostedMeetings(enabled);\n const items = useConnectItems(meetings, calls);\n return {items, callsQuery, meetingsQuery};\n}\n","import {useEffect} from 'react';\nimport {WS} from 'app/api/WebSocket/WS';\nimport {useSocketHandlers} from 'app/hooks/Meeting/useSocketHandlers';\n\nexport function useMeetingsSocket(enabled: boolean): void {\n const {onMeetingChange, onParticipantChange} = useSocketHandlers();\n\n useEffect(() => {\n if (!enabled) {\n return;\n }\n\n WS.onMeetingChange(onMeetingChange);\n\n return () => {\n WS.offMeetingChange(onMeetingChange);\n };\n }, [enabled, onMeetingChange]);\n\n useEffect(() => {\n if (!enabled) {\n return;\n }\n\n WS.onParticipantUpdate(onParticipantChange);\n\n return () => {\n WS.offParticipantUpdate(onParticipantChange);\n };\n }, [enabled, onParticipantChange]);\n}\n","import React from 'react';\nimport {Box, Link, Stack, Typography, typographyClasses} from '@mui/material';\nimport {blue, grey} from '@mui/material/colors';\nimport {Component, Sx} from 'app/types/common';\nimport {Icons} from 'app/util/icons';\nimport {SIZE} from 'app/constants';\nimport ArrowUpwardIcon from '@mui/icons-material/ArrowUpward';\nimport {router} from 'app/router/main';\nimport {packSx} from 'app/util/packSx/packSx';\n\ninterface Props extends Component, Sx {}\n\nexport const ReadyToConnect = ({sx}: Props) => {\n return (\n <Stack\n sx={packSx(\n {\n border: '1px solid',\n borderColor: '#e1e3e5',\n height: '520px',\n px: 7,\n position: 'relative',\n },\n sx,\n )}\n direction=\"row\"\n alignItems=\"center\"\n gap={10}\n >\n <Stack direction=\"row\" gap={3}>\n {Icons.microsoftTeams().size(SIZE.XXL).reactComponent()}\n {Icons.zoom().size(SIZE.XXL).reactComponent()}\n </Stack>\n\n <Box>\n <Typography variant=\"h5\" mb={2}>\n You are ready to create or connect to existing meetings.\n </Typography>\n\n <Box color={grey[600]} sx={{[`& > .${typographyClasses.root}`]: {color: 'inherit'}}}>\n <Typography mb={2}>Click on the ”New meeting” button above to start.</Typography>\n\n <Typography mb={2}>\n You can join a Zoom meeting or create a Microsoft Teams meeting and start producing your\n stream right now.\n </Typography>\n\n <Typography mb={2}>\n You can also connect to existing meetings from Microsoft, however you will need to{' '}\n <Link href={router.url('connectAccountSettings', undefined, {tab: 'teams'})}>\n pair your organization\n </Link>{' '}\n first.\n </Typography>\n\n <Typography>\n To Connect to a Zoom meeting that requires participants to be authenticated, you will\n need to first{' '}\n <Link href={router.url('connectAccountSettings', undefined, {tab: 'zoom'})}>\n add a Zoom account.\n </Link>\n </Typography>\n </Box>\n </Box>\n\n <ArrowUpwardIcon\n sx={{\n position: 'absolute',\n top: '40px',\n right: '80px',\n fontSize: '38px',\n color: blue[500],\n }}\n />\n </Stack>\n );\n};\n","import {useEffect, useState} from 'react';\nimport {containsSearchString} from 'app/components/FleetManager/utils';\nimport {Meeting} from 'app/store/models/connect/Meeting/Meeting';\n\ntype Entity = Meeting | App.Connect.Call;\n\nfunction isMeeting(e: Entity): e is Meeting {\n return e instanceof Meeting === true;\n}\n\nfunction filterEntities<T extends Entity>(entities: T[], search: string): T[] {\n return entities.filter((e) => {\n if (isMeeting(e)) {\n return containsSearchString(e.name, search) || containsSearchString(e.tenantName, search);\n }\n\n return containsSearchString(e.name, search);\n });\n}\n\nexport function useFilter(\n entities: Array<Meeting | App.Connect.Call>,\n search: string,\n): Array<Meeting | App.Connect.Call> {\n const [filtered, setFiltered] = useState<Array<Meeting | App.Connect.Call>>([]);\n\n useEffect(() => {\n const result = search ? filterEntities(entities, search.trim()) : entities;\n\n setFiltered(result.sort(sortPredicate));\n }, [search, entities]);\n\n return filtered;\n}\n\ntype SortOrder = {\n [K in App.Connect.MeetingStatus]: number;\n};\n\nconst order: SortOrder = {\n disconnected: 0,\n disconnecting: 0,\n starting: 1,\n connecting: 1,\n 'in-waiting-room': 2,\n 'waiting-for-host': 2,\n 'waiting-for-password': 2,\n 'waiting-for-account': 2,\n running: 3,\n error: 3,\n};\n\nconst prioritized: Array<App.Connect.MeetingStatus> = [\n 'running',\n 'in-waiting-room',\n 'waiting-for-host',\n];\n\nfunction sortPredicate(a: Entity, b: Entity): number {\n if (isMeeting(a) && isMeeting(b)) {\n return order[b.status] - order[a.status] || b.createdAt - a.createdAt;\n }\n\n if (isMeeting(a)) {\n if (prioritized.includes(a.status)) {\n return -1;\n }\n\n return 1;\n }\n\n if (isMeeting(b)) {\n if (prioritized.includes(b.status)) {\n return -1;\n }\n\n return 1;\n }\n\n return b.createdAt - a.createdAt;\n}\n","import React from 'react';\nimport {Box, Link, Stack} from '@mui/material';\nimport {Sx} from 'app/types/common';\nimport LockIcon from '@mui/icons-material/Lock';\nimport {palette} from 'app/themes/app';\n\nexport function SecureMessage({sx}: Sx) {\n return (\n <Box sx={sx}>\n <Stack direction=\"row\" alignItems=\"center\" gap={0.5} fontSize={12}>\n <LockIcon fontSize=\"small\" sx={{color: palette.gray5}} />\n <Box sx={{color: palette.gray6}} component=\"span\">\n Epiphan Connect keeps your data secure.{' '}\n <Link\n data-id=\"secure-policy-link\"\n sx={{color: 'inherit', textDecorationColor: 'currentcolor'}}\n href=\"https://www.epiphan.com/download/TE-Security-and-data-privacy-in-Epiphan-Connect_01.pdf\"\n target=\"_blank\"\n >\n Learn More\n </Link>\n </Box>\n </Stack>\n </Box>\n );\n}\n","import React, {useState} from 'react';\nimport {Box, Button, Paper, Stack, Typography} from '@mui/material';\nimport {grey} from '@mui/material/colors';\nimport ExpandMoreIcon from '@mui/icons-material/ExpandMore';\nimport {WistiaPlayer} from '@wistia/wistia-player-react';\nimport {Sx} from 'app/types/common';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {router} from 'app/router/main';\nimport {isNil} from 'app/util/isNil';\nimport {formatTrialSeconds} from 'app/components/entities/billing/base';\n\ninterface Props extends Sx {\n trialSeconds?: number;\n billingAccess?: boolean;\n}\n\nexport function ConnectGuide({sx, trialSeconds, billingAccess}: Props) {\n const [expanded, setExpanded] = useState(true);\n\n const isTrial = !isNil(trialSeconds);\n\n const renderMessage = () => {\n if (!isTrial) {\n return null;\n }\n\n if (!trialSeconds) {\n return (\n <Typography color=\"error.main\" mt={2}>\n Your free trial hours of Connect have been used.\n </Typography>\n );\n }\n\n return (\n <Typography color=\"text.secondary\" mt={2}>\n Your free trial has <b>{formatTrialSeconds(trialSeconds)} of Connect</b> remaining.\n </Typography>\n );\n };\n\n return (\n <Paper sx={packSx(sx, {bgcolor: grey[100]})} variant=\"outlined\">\n <Stack direction=\"row\" justifyContent=\"space-between\">\n <Stack p={2} alignItems=\"flex-start\">\n <Typography variant=\"h5\" fontWeight={600} mb={2}>\n Getting started\n </Typography>\n\n <Typography color=\"text.secondary\" mb={2}>\n Learn the basics of projects, adding sources, channels, layouts,\n <br /> switching, streaming, and recording.\n </Typography>\n\n {expanded && isTrial && (\n <>\n {renderMessage()}\n\n {billingAccess && (\n <Button\n sx={{my: 2}}\n variant=\"contained\"\n onClick={() => router.go('settingBillingUsage')}\n >\n Upgrade subscription\n </Button>\n )}\n </>\n )}\n\n <Button\n sx={{mt: 'auto'}}\n startIcon={<ExpandMoreIcon sx={packSx(expanded && {transform: `rotate(180deg)`})} />}\n onClick={() => setExpanded((prev) => !prev)}\n >\n {expanded ? 'Collapse' : 'Expand'}\n </Button>\n </Stack>\n\n {expanded && (\n <Box sx={{aspectRatio: '16/9', width: 533}}>\n <WistiaPlayer mediaId=\"nbqts6e74a\" />\n </Box>\n )}\n </Stack>\n </Paper>\n );\n}\n","import {BaseBilling} from 'app/components/entities/billing/base/model';\nimport {pluralizeN} from 'app/components/helpers/commonHelpers';\n\nexport function formatBillingPeriod({count, interval}: BaseBilling.Config): string {\n return count === 1 ? `per ${interval}` : `every ${count} ${pluralizeN(interval, count)}`;\n}\n\nexport function formatPrice(amount: number, fraction = 0): string {\n return new Intl.NumberFormat('en-US', {\n style: 'currency',\n currency: 'USD',\n minimumFractionDigits: fraction,\n maximumFractionDigits: fraction,\n }).format(amount);\n}\n\nexport function formatHours(hours: number, fraction = 0): string {\n return new Intl.NumberFormat('en-US', {\n maximumFractionDigits: fraction,\n }).format(hours);\n}\n\nexport function formatTrialSeconds(seconds: number): string {\n if (seconds < 60) {\n return 'less than a minute';\n }\n\n const minutes = Math.trunc(seconds / 60);\n\n if (minutes < 60) {\n return `${minutes} ${pluralizeN('minute', minutes)} `;\n }\n\n const hours = Math.round(minutes / 60);\n return `${hours} ${pluralizeN('hour', hours)}`;\n}\n","import React from 'react';\nimport {observer} from 'mobx-react';\nimport {Divider, Stack} from '@mui/material';\nimport {grey} from '@mui/material/colors';\nimport {DashboardListHeader} from 'app/components/Dashboard/DashboardListHeader';\nimport {MeetingsHeader} from 'app/components/MeetingsManager/MeetingsHeader/MeetingsHeader';\nimport {useSearch} from 'app/components/DeviceDetails/hooks/useSearch';\nimport {MeetingsList} from 'app/components/MeetingsManager/MeetingsList/MeetingsList';\nimport {MeetingsWelcome} from 'app/components/MeetingsManager/MeetingsWelcome/MeetingsWelcome';\nimport {useMeetings} from 'app/components/MeetingsManager/hooks/useMeetings';\nimport {IndeterminateProgressBar} from 'app/components/sharedReactComponents/IndeterminateProgressBar';\nimport {ReadyToConnect} from 'app/components/MeetingsManager/ReadyToConnect/ReadyToConnect';\nimport {useFilter} from 'app/components/MeetingsManager/hooks/useFilter';\nimport {useTeamTenants} from 'app/hooks/useTenantsQuery';\nimport {useTeamsConnectionUrlHandlers} from 'app/hooks/Meeting/useTeamsConnectionUrlHandlers';\nimport {ConnectManager} from 'app/components/MeetingsManager/ConnectManager';\nimport {router} from 'app/router/main';\nimport {MoreDetails} from 'app/components/MeetingsManager/MoreDetails/MoreDetails';\nimport {useTeamBilling} from 'app/components/BillingManager/hooks/useTeamBilling';\nimport {SecureMessage} from 'app/components/MeetingsManager/SecureMessage/SecureMessage';\nimport {useConnectIntegration} from 'app/components/ConnectPlatformsIntegration/ConnectPlatformsIntegration';\nimport {useZoomAccounts} from 'app/hooks/useZoomAccounts';\nimport {useCloud} from 'app/components/features/cloud';\nimport {ConnectGuide} from 'app/components/widgets/connect';\n\nconst Content = ({children}) => {\n return (\n <Stack className=\"meetings-manager__content\">\n <Stack flexGrow={1} className=\"container\">\n {children}\n <SecureMessage sx={{mt: 'auto', mb: 2}} />\n </Stack>\n </Stack>\n );\n};\n\ninterface Props {\n error?: string;\n state?: string;\n}\n\nfunction MeetingsManagerComponent({error, state}: Props) {\n const {team, user} = useCloud();\n const teamId = team.id;\n\n const canSubscribe = user.role.canEditBilling();\n\n const enabled = team.capabilities.has('connect');\n const canManageAccounts = user.role.canPairConnectAuth();\n\n const {search, setSearch, clearSearch} = useSearch('');\n\n const teamsQuery = useTeamTenants({enabled, teamId});\n const zoomQuery = useZoomAccounts({enabled, teamId});\n const tenants = teamsQuery.data ?? [];\n const accounts = zoomQuery.data ?? [];\n\n const {items, callsQuery, meetingsQuery} = useMeetings({enabled});\n\n const filteredItems = useFilter(items, search);\n\n const {connect, actions} = useTeamBilling();\n\n const teamName = team.name;\n const userId = user.id;\n\n useTeamsConnectionUrlHandlers({\n error,\n state,\n teamName,\n });\n\n const {startTeams} = useConnectIntegration();\n\n const handlePair = () => {\n const backUrl = `/${teamId}${router.url('meetings')}`;\n startTeams(backUrl);\n };\n\n if (\n callsQuery.isInitialLoading ||\n meetingsQuery.isInitialLoading ||\n teamsQuery.isInitialLoading ||\n zoomQuery.isInitialLoading\n ) {\n return (\n <>\n <DashboardListHeader\n showSearch={enabled}\n filterValue={search}\n buttonsComponent={null}\n onFilter={setSearch}\n />\n <IndeterminateProgressBar />\n </>\n );\n }\n\n const hasEntities = items.length > 0;\n const hasFilter = search.length > 0;\n\n const disableCreate = connect?.type === 'token' && connect.balance.amount === 0;\n\n const renderMainContent = () => (\n <>\n <DashboardListHeader\n showSearch={enabled}\n filterValue={search}\n buttonsComponent={null}\n onFilter={setSearch}\n />\n\n <Content>\n <ConnectGuide\n sx={{my: 2}}\n trialSeconds={connect?.type === 'token' ? connect.balance.amount : undefined}\n billingAccess={canSubscribe}\n />\n\n <MeetingsHeader\n sx={{mt: 3, mb: 2}}\n accounts={accounts}\n tenants={tenants}\n canEditTenants={canManageAccounts}\n canCreate={!disableCreate}\n />\n\n <Divider sx={{borderWidth: 2, borderColor: grey[100], mb: 5}} />\n\n {hasEntities ? (\n <MeetingsList\n className=\"meetings-manager__list\"\n items={filteredItems}\n hasFilter={hasFilter}\n canStart={!disableCreate}\n onClearFilter={clearSearch}\n />\n ) : (\n <>\n <ReadyToConnect />\n <MoreDetails sx={{my: 2}} />\n </>\n )}\n </Content>\n </>\n );\n\n const isAvailable = enabled;\n\n return (\n <ConnectManager\n teamId={teamId}\n userId={userId}\n canEdit={canManageAccounts}\n hasTenants={tenants.length > 0}\n reloadHosted={callsQuery.refetch}\n reloadMeetings={meetingsQuery.refetch}\n onPair={handlePair}\n >\n <div className=\"meetings-manager\">\n {isAvailable ? (\n renderMainContent()\n ) : (\n <Content>\n <MeetingsWelcome\n sx={{mt: 2}}\n canSubscribe={canSubscribe}\n onManage={() => actions.manageConnect()}\n />\n </Content>\n )}\n </div>\n </ConnectManager>\n );\n}\n\nexport const MeetingsManager = observer(MeetingsManagerComponent);\n","import {useCallback, useState} from 'react';\nimport {Callback} from 'app/types/common';\n\ninterface Return {\n search: string;\n setSearch: Callback<void, [string]>;\n clearSearch: Callback;\n}\n\nexport function useSearch(initialValue = ''): Return {\n const [search, setSearch] = useState(initialValue);\n\n const clearSearch = useCallback(() => {\n setSearch('');\n }, []);\n\n return {\n search,\n setSearch,\n clearSearch,\n };\n}\n","import {useContext} from 'react';\nimport {BillingManagerContext} from 'app/components/BillingManager/context';\nimport {BillingState} from 'app/components/BillingManager/types/types';\n\nexport function useTeamBilling(): BillingState {\n const ctx = useContext(BillingManagerContext);\n\n if (!ctx) {\n throw new Error('Hook is used outside of BillingManagerContext');\n }\n\n return ctx;\n}\n","import {useEffect, useState} from 'react';\nimport {AbortCallback} from 'app/api/types';\nimport {\n WSMeetingChangedDto,\n WSParticipantUpdated,\n WSReturnFeedUpdated,\n} from 'app/api/WebSocket/types';\nimport {WS} from 'app/api/WebSocket/WS';\nimport {useMeetingsStore} from 'app/store/hooks';\nimport {Meeting} from 'app/store/models/connect/Meeting/Meeting';\nimport {ConnectMapper} from 'app/util/mappers/ConnectMapper/ConnectMapper';\nimport {noop} from 'app/util/noop';\nimport {useSocketHandlers} from 'app/hooks/Meeting/useSocketHandlers';\nimport {MeetingsApiService} from 'app/services/api/meetings/MeetingsApiService';\n\ninterface Return {\n loading: boolean;\n meeting?: Meeting;\n}\n\nfunction useMeetingQuery(id: string): Return {\n const store = useMeetingsStore();\n const [loading, setLoading] = useState(true);\n\n useEffect(() => {\n let abortCb: AbortCallback = noop;\n\n const load = async () => {\n try {\n const response = await MeetingsApiService.getMeeting(id, (abort) => (abortCb = abort));\n\n const feed = response.injection\n ? ConnectMapper.mapReturnFeed(response.injection)\n : undefined;\n\n store.setMeeting(\n ConnectMapper.mapMeeting(\n response,\n response.participants?.map(ConnectMapper.mapParticipant),\n feed,\n ),\n );\n } catch {\n store.removeMeeting(id);\n } finally {\n setLoading(false);\n }\n };\n\n void load();\n\n return () => {\n abortCb();\n };\n }, [id]);\n\n const meeting = store.getMeeting(id);\n\n return {\n loading,\n meeting,\n };\n}\n\nfunction useMeetingSocket(id?: string) {\n const {onMeetingChange, onParticipantChange, onReturnFeedChange} = useSocketHandlers();\n\n useEffect(() => {\n if (!id) {\n return;\n }\n\n const handleMeetingMessage = (data: WSMeetingChangedDto) => {\n const targetId = data.Body.id;\n\n if (targetId !== id) {\n return;\n }\n\n onMeetingChange(data);\n };\n\n WS.onMeetingChange(handleMeetingMessage);\n\n return () => {\n WS.offMeetingChange(handleMeetingMessage);\n };\n }, [id, onMeetingChange]);\n\n useEffect(() => {\n if (!id) {\n return;\n }\n\n const handleParticipantUpdated = (data: WSParticipantUpdated) => {\n const targetId = data.Body.meeting_id;\n\n if (targetId !== id) {\n return;\n }\n\n onParticipantChange(data);\n };\n\n WS.onParticipantUpdate(handleParticipantUpdated);\n\n return () => {\n WS.offParticipantUpdate(handleParticipantUpdated);\n };\n }, [id, onParticipantChange]);\n\n useEffect(() => {\n if (!id) {\n return;\n }\n\n const handleReturnFeedMessage = (data: WSReturnFeedUpdated) => {\n const targetId = data.Body.meeting_id;\n\n if (targetId !== id) {\n return;\n }\n\n onReturnFeedChange(data);\n };\n\n WS.onReturnFeedUpdate(handleReturnFeedMessage);\n\n return () => {\n WS.offReturnFeedUpdate(handleReturnFeedMessage);\n };\n }, [id, onReturnFeedChange]);\n}\n\nexport function useMeeting(id: string): Return {\n const {loading, meeting} = useMeetingQuery(id);\n\n const disabled = loading || !meeting;\n\n useMeetingSocket(disabled ? undefined : meeting.id);\n\n return {\n loading,\n meeting,\n };\n}\n","import React from 'react';\nimport classNames from 'classnames';\nimport {Countdown} from 'app/components/sharedReactComponents/Countdown';\nimport {ClassName, TimeStampSeconds} from 'app/types/common';\nimport {counterFormat} from 'app/util/time';\nimport {calcTime} from 'app/components/sharedReactComponents/Countdown/utils';\n\ninterface Props extends ClassName {\n timestamp: TimeStampSeconds;\n}\n\nexport const MeetingUpTime = ({className, timestamp}: Props) => {\n return (\n <Countdown\n className={classNames('meeting-uptime', className)}\n data-id=\"meeting_up_time\"\n timestamp={timestamp}\n calculate={calcTime}\n format={counterFormat}\n />\n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport {ClassName} from 'app/types/common';\n\ninterface Props extends ClassName {\n audioIsolated: boolean;\n}\n\nexport const MeetingAudioMode = ({className, audioIsolated}: Props) => {\n const name = audioIsolated ? 'Isolated' : 'Mixed';\n\n return (\n <div className={classNames('meeting-audio-mode', className)}>\n <span className=\"meeting-audio-mode__mode\">Audio mode:</span>\n <span className=\"meeting-audio-mode__mode-name\" data-id=\"meeting_audio_mode_name\">\n {name} audio\n </span>\n </div>\n );\n};\n","import React from 'react';\nimport {observer} from 'mobx-react';\nimport {Divider, Stack} from '@mui/material';\nimport {Meeting} from 'app/store/models/connect/Meeting/Meeting';\nimport {MeetingParticipantsCount} from 'app/components/sharedReactComponents/MeetingParticipantsCount/MeetingParticipantsCount';\nimport {MeetingUpTime} from 'app/components/pages/MeetingDetails/MeetingDetailsHeader/MeetingDetailsInfo/MeetingUpTime';\nimport {MeetingAudioMode} from 'app/components/pages/MeetingDetails/MeetingDetailsHeader/MeetingDetailsInfo/MeetingAudioMode';\nimport {useSrtCount} from 'app/hooks/useSrtCount';\nimport {MeetingSrtSummary} from 'app/components/sharedReactComponents/MeetingSrtSummary/MeetingSrtSummary';\nimport {CopyUrl, JoinMeeting} from 'app/components/MeetingsManager/buttons';\nimport {Icons} from 'app/util/icons';\nimport {SxObj} from 'app/types/common';\n\ninterface Props {\n meeting: Meeting;\n}\n\nconst buttonSx: SxObj = {\n fontSize: '12px',\n '& button': {p: 0},\n};\n\nexport const MeetingDetailsInfo = observer(({meeting}: Props) => {\n const streams = useSrtCount(meeting.participants);\n const rf = useSrtCount(meeting.feed ? [meeting.feed] : []);\n\n const hasActiveSrt = Object.values(streams).some((v) => v.value > 0);\n const hasActiveRf = Object.values(rf).some((v) => v.value > 0);\n\n return (\n <div className=\"meeting-details-info\">\n <Stack\n direction=\"row\"\n gap={1.5}\n alignItems=\"center\"\n divider={<Divider orientation=\"vertical\" flexItem={true} />}\n >\n <Stack>\n {(meeting.platform === 'teams' ? Icons.microsoftTeams() : Icons.zoom()).reactComponent()}\n </Stack>\n\n {meeting.startedAt && <MeetingUpTime timestamp={meeting.startedAt} />}\n\n <MeetingParticipantsCount count={meeting.guests.length} />\n <MeetingAudioMode audioIsolated={meeting.isolatedAudio} />\n\n <CopyUrl sx={buttonSx} url={meeting.url} />\n <JoinMeeting sx={buttonSx} url={meeting.url} />\n\n {hasActiveSrt && (\n <MeetingSrtSummary dataId=\"mainstreams_summary\" label=\"SRT Stream\" count={streams} />\n )}\n\n {hasActiveRf && <MeetingSrtSummary dataId=\"rf_summary\" label=\"Return Feed\" count={rf} />}\n </Stack>\n </div>\n );\n});\n","import React, {useCallback} from 'react';\nimport classNames from 'classnames';\nimport {observer} from 'mobx-react';\nimport {Stack, Typography} from '@mui/material';\nimport {ChangeEvent, ClassName} from 'app/types/common';\nimport {Button} from 'app/components/sharedReactComponents/Button';\nimport {Meeting} from 'app/store/models/connect/Meeting/Meeting';\nimport {THEME, VARIANT} from 'app/constants';\nimport {DisconnectMeetingPrompt} from 'app/components/MeetingsManager/modals/DisconnectMeetingPrompt/DisconnectMeetingPrompt';\nimport {MeetingDetailsInfo} from 'app/components/pages/MeetingDetails/MeetingDetailsHeader/MeetingDetailsInfo';\nimport {Notifications} from 'app/components/Notifications';\nimport {EditableNameText} from 'app/components/sharedReactComponents/EditableNameText';\nimport {emptyStringValidator} from 'app/util/validators';\nimport {MeetingsApiService} from 'app/services/api/meetings/MeetingsApiService';\nimport {palette} from 'app/themes/app';\nimport CheckCircleIcon from '@mui/icons-material/CheckCircle';\nimport ErrorIcon from '@mui/icons-material/Error';\nimport WarningIcon from '@mui/icons-material/Warning';\n\ninterface Props extends ClassName {\n meeting: Meeting;\n}\n\nconst MeetingDetailsHeaderComponent = ({className, meeting}: Props) => {\n const handleMeetingDisconnect = useCallback(() => {\n const onDisconnect = async () => {\n try {\n await MeetingsApiService.disconnect(meeting.id);\n } catch {\n Notifications.addErrorNotification('Could not disconnect meeting');\n }\n };\n\n DisconnectMeetingPrompt.show({\n name: meeting.name,\n onDone: onDisconnect,\n });\n }, [meeting]);\n\n const handleSaveName = async ({target: {value}}: ChangeEvent<string>) => {\n await MeetingsApiService.setName(meeting.id, value);\n meeting.setName(value);\n };\n\n const state = usePermissionText(meeting.permission);\n\n return (\n <div className={classNames('meeting-details-header', className)}>\n <div className=\"container meeting-details-header__container\">\n <Stack direction=\"row\" justifyContent=\"space-between\" alignItems=\"center\" mb={2}>\n <EditableNameText\n dataId=\"edit_meeting_name\"\n className=\"meeting-details-header__name\"\n value={meeting.name}\n ariaLabel=\"Meeting name\"\n validators={[emptyStringValidator]}\n onChange={handleSaveName}\n />\n\n <Stack direction=\"row\" alignItems=\"center\" gap={3}>\n <Stack direction=\"row\" alignItems=\"center\" gap={2}>\n <Stack direction=\"row\" alignItems=\"center\" gap={1}>\n <CheckCircleIcon sx={{color: palette.green}} />\n <span>Connected</span>\n </Stack>\n\n {state && (\n <Stack\n direction=\"row\"\n alignItems=\"center\"\n gap={1}\n sx={state.serious ? {color: palette.red} : {}}\n >\n {state.serious ? (\n <WarningIcon sx={{color: palette.red}} />\n ) : (\n <ErrorIcon sx={{color: palette.orange3}} />\n )}\n <Typography\n data-id=\"permission-state\"\n component=\"span\"\n sx={{whiteSpace: 'nowrap'}}\n >\n {state.text}\n </Typography>\n </Stack>\n )}\n </Stack>\n\n <Button\n data-id=\"disconnect_meeting_button\"\n theme={THEME.INFO}\n variant={VARIANT.OUTLINE}\n onClick={handleMeetingDisconnect}\n >\n Disconnect\n </Button>\n </Stack>\n </Stack>\n\n <MeetingDetailsInfo meeting={meeting} />\n </div>\n </div>\n );\n};\n\nexport const MeetingDetailsHeader = observer(MeetingDetailsHeaderComponent);\n\ninterface Permissions {\n text: string;\n serious: boolean;\n}\n\nfunction usePermissionText(permission?: App.Connect.Permission): Permissions | undefined {\n if (!permission) {\n return;\n }\n\n switch (permission) {\n case 'streaming-request-denied':\n case 'recording-request-denied': {\n return {\n text: 'Denied: permission request ',\n serious: true,\n };\n }\n\n case 'requesting-streaming':\n case 'streaming-request-timeout': {\n return {\n text: 'Requesting live streaming permission',\n serious: false,\n };\n }\n\n case 'requesting-recording':\n case 'recording-request-timeout': {\n return {\n text: 'Requesting recording permission',\n serious: false,\n };\n }\n\n case 'waiting-recording': {\n return {\n text: 'Requesting manual permission',\n serious: false,\n };\n }\n\n case 'failed':\n default:\n }\n}\n","const streaming = new Set<App.Connect.Permission>([\n 'requesting-streaming',\n 'streaming-request-denied',\n 'streaming-request-timeout',\n]);\n\nconst denied = new Set<App.Connect.Permission>([\n 'recording-request-denied',\n 'streaming-request-denied',\n]);\n\nexport type MediaAction = 'recording' | 'streaming';\n\ntype MediaPermission = {\n action: MediaAction;\n denied: boolean;\n};\n\nexport type PermissionIssue = MediaPermission | 'wait-record';\n\nexport function usePermissionIssue(\n permission?: App.Connect.Permission,\n): PermissionIssue | undefined {\n if (!permission || permission === 'ok') {\n return;\n }\n\n if (permission === 'waiting-recording') {\n return 'wait-record';\n }\n\n return {\n action: streaming.has(permission) ? 'streaming' : 'recording',\n denied: denied.has(permission),\n };\n}\n","import React from 'react';\nimport {Box, Stack, Typography} from '@mui/material';\nimport {Sx} from 'app/types/common';\nimport {Icons} from 'app/util/icons';\nimport {SIZE} from 'app/constants';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {palette} from 'app/themes/app';\n\nexport function PermissionNote({sx}: Sx) {\n return (\n <Stack sx={packSx({color: palette.gray3}, sx)} direction=\"row\" gap={1} alignItems=\"center\">\n <Box sx={{color: '#d2d2d3'}}> {Icons.exclamation().size(SIZE.S).reactComponent()}</Box>\n <Typography>\n Your meeting will not be recorded.\n <br />\n The new permission will only allow Epiphan to get access to the raw audio and video from the\n call.\n </Typography>\n </Stack>\n );\n}\n","import React from 'react';\nimport {Box, Link, Typography} from '@mui/material';\nimport {palette} from 'app/themes/app';\nimport {Sx} from 'app/types/common';\nimport {PermissionNote} from 'app/components/pages/MeetingDetails/MeetingLayout/PermissionNote';\n\ninterface Props extends Sx {\n variant: 'local' | 'media';\n}\n\nexport function LocalRecordGuide({sx, variant}: Props) {\n const media = variant === 'media';\n const title = media\n ? 'The meeting host can grant permissions manually'\n : 'The meeting host must request a manual permission';\n\n return (\n <Box sx={sx}>\n <Typography sx={{fontSize: '20px', mb: 0.5}}>{title}</Typography>\n\n <Typography fontSize={16} color={palette.gray3} mb={2}>\n <>\n {media ? 'The meeting host can grant permissions manually. ' : null}\n Please ask the <b>meeting host</b> to:\n </>\n </Typography>\n\n <Typography sx={{fontSize: '16px', mb: 4, color: palette.gray3}}>\n 1. Access the Zoom meeting.\n </Typography>\n\n <Typography sx={{fontSize: '16px', mb: 1, color: palette.gray3}}>\n 2. Locate the Epiphan Connect participant:\n </Typography>\n\n <Box sx={{mb: 4}}>\n <img\n src=\"/assets/img/connect/instructions-recording.png\"\n srcSet=\"assets/img/connect/instructions-recording@2x.png 2x\"\n width={520}\n height={286}\n alt=\"\"\n />\n </Box>\n\n <Typography sx={{fontSize: '16px', mb: 1, color: palette.gray3}}>\n 3. Access the menu of the Epiphan Connect participant and click on ”Allow to Record Local\n Files”. The <br /> participants of the meeting will hear a message telling the meeting will\n be recorded.\n </Typography>\n\n <Box sx={{mb: 2}}>\n <img\n src=\"/assets/img/connect/instructions-recording2.png\"\n srcSet=\"assets/img/connect/instructions-recording2@2x.png 2x\"\n width={520}\n height={286}\n alt=\"\"\n />\n </Box>\n\n <PermissionNote sx={{mb: 4}} />\n\n <Typography sx={{fontSize: '16px', mb: 4, color: palette.gray3}}>\n 4. Done. You're ready to start producing events with Epiphan Connect and Zoom. This page\n will automatically <br /> update once the permissions are enabled.\n </Typography>\n\n <Typography sx={{color: palette.gray3}}>\n <Link\n href=\"https://www.epiphan.com/userguides/connect/Content/Connect/Connect-to-a-Zoom-Meeting-Permissions.htm\"\n target=\"_blank\"\n rel=\"noreferrer\"\n >\n Get the link for this guide\n </Link>{' '}\n and share it with the meeting host.\n </Typography>\n </Box>\n );\n}\n","import React from 'react';\nimport {Box, Divider, Stack, Typography} from '@mui/material';\nimport ErrorIcon from '@mui/icons-material/Error';\nimport {palette} from 'app/themes/app';\nimport {Sx} from 'app/types/common';\nimport {LocalRecordGuide} from 'app/components/pages/MeetingDetails/MeetingLayout/LocalRecordGuide/LocalRecordGuide';\n\ninterface Props extends Sx {\n id?: string;\n}\n\nexport function LocalRecordIssue({sx, id}: Props) {\n return (\n <Box sx={sx}>\n <Stack sx={{mb: 1}} direction=\"row\" alignItems=\"center\" gap={1}>\n <ErrorIcon sx={{color: palette.orange3}} />\n <Typography sx={{fontSize: '20px'}}>\n Host needs to allow Epiphan Connect to record local files\n </Typography>\n </Stack>\n\n <Box sx={{fontSize: '16px', color: palette.gray2, mb: 1.5}}>\n Connect has joined the Zoom meeting but the meeting host needs to follow the instructions\n below.\n </Box>\n\n {id && (\n <Typography mb={3} fontSize={12} color=\"#a1a7af\">\n Meeting ID {id}\n </Typography>\n )}\n\n <Divider sx={{mb: 4}} />\n\n <LocalRecordGuide variant=\"local\" />\n </Box>\n );\n}\n","import React from 'react';\nimport {MediaAction} from 'app/components/pages/MeetingDetails/hooks/usePermissionIssue';\nimport {Box, Divider, Stack, Typography} from '@mui/material';\nimport WarningIcon from '@mui/icons-material/Warning';\nimport {palette} from 'app/themes/app';\nimport {Sx} from 'app/types/common';\nimport {LocalRecordGuide} from 'app/components/pages/MeetingDetails/MeetingLayout/LocalRecordGuide/LocalRecordGuide';\n\ninterface Props extends Sx {\n id?: string;\n action: MediaAction;\n}\n\nexport function DeniedAccessIssue({sx, id, action}: Props) {\n return (\n <Box sx={sx}>\n <Stack sx={{mb: 1}} direction=\"row\" alignItems=\"center\" gap={1}>\n <WarningIcon sx={{color: palette.red}} />\n\n <Typography sx={{fontSize: '20px', color: palette.red}}>\n Denied: {action} permission request\n </Typography>\n </Stack>\n\n <Typography sx={{color: palette.gray2, fontSize: '16px', mb: 1.5}}>\n The {action} request was denied or the request pop-up in Zoom was closed by the meeting\n host.\n </Typography>\n\n {id && (\n <Typography mb={3} fontSize={12} color=\"#a1a7af\">\n Meeting ID {id}\n </Typography>\n )}\n\n <Divider sx={{mb: 4}} />\n\n <Typography sx={{fontSize: '16px', color: palette.darkerGray, mb: 4}}>\n Suggested actions:\n </Typography>\n\n <LocalRecordGuide variant=\"media\" />\n </Box>\n );\n}\n","import React from 'react';\nimport {Box, Divider, Stack, Typography} from '@mui/material';\nimport ErrorIcon from '@mui/icons-material/Error';\nimport KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';\nimport {MediaAction} from 'app/components/pages/MeetingDetails/hooks/usePermissionIssue';\nimport {Sx} from 'app/types/common';\nimport {VARIANT} from 'app/constants';\nimport {palette} from 'app/themes/app';\nimport {Button} from 'app/components/sharedReactComponents/Button';\nimport {useToggle} from 'app/hooks/useToggle';\nimport {PermissionNote} from 'app/components/pages/MeetingDetails/MeetingLayout/PermissionNote';\nimport {LocalRecordGuide} from 'app/components/pages/MeetingDetails/MeetingLayout/LocalRecordGuide/LocalRecordGuide';\n\ninterface Props extends Sx {\n id?: string;\n action: MediaAction;\n}\n\nexport function MediaActionIssue({sx, id, action}: Props) {\n const [expanded, toggle] = useToggle(false);\n\n return (\n <Box sx={sx}>\n <Stack sx={{mb: 1}} direction=\"row\" alignItems=\"center\" gap={1}>\n <ErrorIcon sx={{color: palette.orange3}} />\n\n <Typography sx={{fontSize: '20px'}}>\n Meeting host needs to approve the {action} permission\n </Typography>\n </Stack>\n\n <Box sx={{fontSize: '16px', color: palette.gray2, mb: 1.5}}>\n Connect has joined the Zoom meeting but it needs {action} permission from the meeting host\n to start. <br />\n Please ask the Zoom meeting host to approve the pop-up request in the Zoom application. The\n meeting host should be running the latest version of Zoom.\n </Box>\n\n {id && (\n <Typography mb={3} fontSize={12} color=\"#a1a7af\">\n Meeting ID {id}\n </Typography>\n )}\n\n <Box sx={{mb: 3}}>\n <img\n src=\"/assets/img/connect/permission-request.png\"\n srcSet=\"assets/img/connect/permission-request@2x.png 2x\"\n alt=\"zoom recoding modal\"\n width={390}\n height={178}\n />\n </Box>\n\n {action === 'recording' && <PermissionNote sx={{mb: 3}} />}\n\n <Divider sx={{mb: 3}} />\n\n <Box sx={{mb: 0.5, '& button': {p: 0, boxShadow: 'none', color: palette.darkerGray}}}>\n <Button variant={VARIANT.TEXT} onClick={toggle}>\n <Typography fontWeight={600} mr={1}>\n If the meeting host hasn't received a pop-up, try a different permission request\n </Typography>\n\n <KeyboardArrowDownIcon sx={expanded ? {transform: 'rotate(180deg)'} : {}} />\n </Button>\n </Box>\n\n {expanded && (\n <Box sx={{mt: 4}}>\n <LocalRecordGuide variant=\"media\" />\n </Box>\n )}\n </Box>\n );\n}\n","/* eslint-disable no-restricted-syntax */\nimport {FilterSwitch} from 'app/components/sharedReactComponents/FilterSelector/types';\nimport {Callback} from 'app/types/common';\nimport {intersectionOfSets} from 'app/util/intersectionOfSets';\n\nconst defaultCallbackGetter = (filter: FilterSwitch) => filter.callback;\n\n/**\n * @param items\n * @param filters Active filters\n * @param callbackGetter\n * @return filtered items\n */\nfunction filterItemsByFilterSwitches<T>(\n items: T[],\n filters: FilterSwitch[],\n callbackGetter: Callback = defaultCallbackGetter,\n): T[] {\n const callbacksByGroups: Record<string, Callback[]> = {};\n\n for (const filter of filters) {\n const {group} = filter;\n const callback = callbackGetter(filter);\n\n if (!callback || !group) {\n continue;\n }\n\n const callbacksByGroup = callbacksByGroups[group];\n\n if (callbacksByGroup) {\n callbacksByGroup.push(callback);\n } else {\n callbacksByGroups[group] = [callback];\n }\n }\n\n const filteredByGroup: Array<Set<T>> = [];\n\n for (const [, callbacks] of Object.entries(callbacksByGroups)) {\n const filtered = items.filter((item) => callbacks.some((callback) => callback(item)));\n filteredByGroup.push(new Set(filtered));\n }\n\n let intersection = new Set(items);\n for (const filter of filteredByGroup) {\n intersection = intersectionOfSets(intersection, filter);\n }\n\n return [...intersection];\n}\n\nexport {filterItemsByFilterSwitches};\n","import {useEffect, useState} from 'react';\nimport {Participant} from 'app/store/models/connect/Participant/Participant';\nimport {stringComparator} from 'app/util/Sort';\nimport {ParticipantSort} from 'app/components/pages/MeetingDetails/ParticipantsList/ParticipantsList';\nimport {FilterSwitch} from 'app/components/sharedReactComponents/FilterSelector/types';\nimport {filterItemsByFilterSwitches} from 'app/components/sharedReactComponents/FilterSelector/utils';\nimport {ReturnFeed} from 'app/store/models/connect/ReturnFeed/ReturnFeed';\nimport {Meeting} from 'app/store/models/connect/Meeting/Meeting';\n\ninterface Return {\n users: Participant[];\n mainstreams: Participant[];\n feed?: ReturnFeed;\n}\n\ntype SortPredicate = (a: Participant, b: Participant) => number;\n\nexport function useParticipants(\n meeting: Meeting,\n sortType: ParticipantSort = 'name',\n filters: FilterSwitch[] = [],\n): Return {\n const [result, setResult] = useState<Return>({\n mainstreams: [],\n users: [],\n feed: undefined,\n });\n\n useEffect(() => {\n const res = meeting.participants.reduce<Return>(\n (acc, p) => {\n if (p.type === 'participant') {\n acc.users.push(p);\n return acc;\n }\n\n acc.mainstreams.push(p);\n return acc;\n },\n {mainstreams: [], users: []},\n );\n\n res.feed = meeting.feed;\n\n const sortPredicate = getSortPredicate(sortType);\n\n const users = filters.length > 0 ? filterItemsByFilterSwitches(res.users, filters) : res.users;\n const mainstreams =\n filters.length > 0 ? filterItemsByFilterSwitches(res.mainstreams, filters) : res.mainstreams;\n\n const feed =\n filters.length > 0 && res.feed\n ? filterItemsByFilterSwitches([res.feed], filters)\n : [res.feed];\n\n setResult({\n users: users.sort(sortPredicate),\n mainstreams: mainstreams.sort(sortByName),\n feed: feed?.[0],\n });\n }, [meeting.participants, meeting.feed, sortType, filters]);\n\n return result;\n}\n\nfunction getSortPredicate(sort: ParticipantSort): SortPredicate {\n if (sort === 'status') {\n return sortByStatus;\n }\n\n return sortByName;\n}\n\nfunction sortByName(a: Participant, b: Participant): number {\n return stringComparator(a.name, b.name);\n}\n\ntype SortOrder = {[K in App.Connect.StreamStatus]: number};\n\nconst order: SortOrder = {\n stopped: 0,\n starting: 1,\n stopping: 1,\n started: 2,\n connected: 2,\n disconnected: 2,\n error: 3,\n};\n\nfunction sortByStatus(a: Participant, b: Participant): number {\n const res = order[b.stream.status] - order[a.stream.status];\n return res || sortByName(a, b);\n}\n","import React from 'react';\nimport classNames from 'classnames';\nimport {ClassName, DataId} from 'app/types/common';\n\nfunction getName(name: string): string {\n const [one, two] = name\n .replace(/\\(.*?\\)/, '')\n .trim()\n .split(/\\s+/);\n\n const [first, second] = [one?.charAt(0), two?.charAt(0)];\n\n if (first && second) {\n return `${first}${second}`;\n }\n\n if (one) {\n return one.slice(0, 2);\n }\n\n return '';\n}\n\ninterface Props extends ClassName, DataId {\n name: string;\n type: App.Connect.MemberType;\n size?: 'normal' | 'big';\n disconnected?: boolean;\n cameraOff?: boolean;\n sharing?: boolean;\n active?: boolean;\n}\n\ntype Background = 'blue' | 'grey' | 'silvery' | 'green' | 'cerulean' | 'dark';\n\nexport const ParticipantAvatar = ({\n className,\n name,\n type,\n size = 'normal',\n cameraOff = false,\n sharing = false,\n active = false,\n disconnected = false,\n dataId,\n}: Props) => {\n const isShare = type === 'vbss';\n const isUser = type === 'participant';\n const isFeed = type === 'return-feed';\n\n const getBackground = (): Background => {\n if (isShare) {\n if (!sharing && active) {\n return 'green';\n }\n\n if (!sharing) {\n return 'grey';\n }\n }\n\n if (isUser) {\n if (disconnected) {\n return 'cerulean';\n }\n\n if (cameraOff) {\n return 'silvery';\n }\n }\n\n if (isFeed && !active) {\n return 'grey';\n }\n\n return 'blue';\n };\n\n const renderContent = () => {\n if (isShare) {\n if (!sharing && active) {\n return (\n <span\n className={`participant-avatar__waiting-share participant-avatar__waiting-share--${size}`}\n >\n waiting for\n <br />\n screen sharing\n </span>\n );\n }\n\n return (\n <img\n className={`participant-avatar__${size}-icon`}\n src={`/assets/img/connect/screen-share-${size}.png`}\n srcSet={`/assets/img/connect/screen-share-${size}@2x.png 2x`}\n alt=\"SC\"\n />\n );\n }\n\n if (isFeed) {\n return (\n <img\n className={`participant-avatar__${size}-icon`}\n src={`/assets/img/connect/return-feed-${size}.png`}\n srcSet={`/assets/img/connect/return-feed-${size}@2x.png 2x`}\n alt=\"SC\"\n />\n );\n }\n\n if (isUser) {\n if (disconnected) {\n return (\n <span\n className={`participant-avatar__disconnected participant-avatar__disconnected--${size}`}\n >\n No signal\n </span>\n );\n }\n\n if (cameraOff) {\n return (\n <span\n className={`participant-avatar__camera-off participant-avatar__camera-off--${size}`}\n >\n Camera off\n </span>\n );\n }\n }\n\n return <span>{getName(name)}</span>;\n };\n\n return (\n <div\n className={classNames(\n 'participant-avatar',\n `participant-avatar--${size}`,\n `participant-avatar--${getBackground()}`,\n className,\n )}\n data-id={dataId}\n >\n {renderContent()}\n </div>\n );\n};\n","export function isParticipantStreamSettings(\n settings: App.Connect.StreamSettings,\n): settings is App.Connect.ParticipantStreamSettings {\n return 'audio' in settings;\n}\n","/* eslint-disable react/jsx-no-target-blank */\nimport React from 'react';\nimport {observer} from 'mobx-react';\nimport {Component} from 'app/types/common';\nimport {SrtStream} from 'app/store/models/connect/SrtStream/SrtStream';\nimport {CopyButton} from 'app/components/sharedReactComponents/CopyButton';\nimport {THEME} from 'app/constants';\nimport {isNil} from 'app/util/isNil';\nimport classNames from 'classnames';\nimport {isParticipantStreamSettings} from 'app/types/guards/connect';\nimport {router} from 'app/router/main';\n\ninterface Props extends Component {\n stream: SrtStream;\n}\n\nexport const SrtDestination = observer(({className, stream, dataId}: Props) => {\n const {settings} = stream;\n\n if (isNil(settings)) {\n return null;\n }\n\n if (isParticipantStreamSettings(settings) && settings.integration) {\n return (\n <div data-id={dataId} className={classNames('srt-destination', className)}>\n <CloudCDestination\n isConnected={stream.connected}\n isDevice={settings.cloud.type === 'device'}\n id={settings.cloud.deviceId}\n name={settings.cloud.deviceName}\n />\n </div>\n );\n }\n\n return (\n <div data-id={dataId} className={classNames('srt-destination', className)}>\n <CustomDestination\n mode={settings.mode}\n isConnected={stream.connected}\n port={`${settings.port}`}\n url={settings.url}\n />\n </div>\n );\n});\n\ninterface DestinationProps {\n isConnected: boolean;\n}\n\ninterface CustomDestinationProps extends DestinationProps {\n mode: App.Connect.SteamMode;\n port: string;\n url: string;\n}\n\nfunction CustomDestination({mode, isConnected, url, port}: CustomDestinationProps) {\n const isListener = mode === 'listener';\n\n return (\n <>\n <div data-id=\"srt_mode\">{getModeText(mode === 'caller', isConnected)},</div>\n\n <CopyButton\n className=\"srt-destination__copy\"\n dataId=\"copy_srt_url\"\n placement=\"left\"\n text=\"URL\"\n value={url}\n theme={THEME.SUCCESS}\n />\n\n {isListener && (\n <CopyButton\n className=\"srt-destination__copy\"\n dataId=\"copy_srt_port\"\n placement=\"left\"\n text={port}\n value={port}\n theme={THEME.SUCCESS}\n />\n )}\n </>\n );\n}\n\nfunction getModeText(isCaller: boolean, isConnected: boolean) {\n if (isCaller) {\n if (isConnected) {\n return 'Caller';\n }\n\n return 'Caller to';\n }\n\n return 'Listener';\n}\n\ninterface CloudDestinationProps extends DestinationProps {\n isDevice: boolean;\n id: string;\n name: string;\n}\n\nfunction CloudCDestination({isConnected, isDevice, name, id}: CloudDestinationProps) {\n return (\n <span>\n <span data-id=\"destination_label\">{isConnected ? 'Connected to' : 'Connecting to'} </span>\n <a\n target=\"_blank\"\n data-id=\"destination_entity\"\n href={router.url(isDevice ? 'deviceDetails' : 'projectDetails', {deviceId: id})}\n >\n {name}\n </a>\n </span>\n );\n}\n","import React, {PropsWithChildren} from 'react';\nimport classNames from 'classnames';\nimport {ClassName} from 'app/types/common';\nimport {CopyButton} from 'app/components/sharedReactComponents/CopyButton';\nimport {SIZE, THEME} from 'app/constants';\nimport {Icons, SvgIcon} from 'app/util/icons';\nimport {observer} from 'mobx-react';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\nimport {SrtStream} from 'app/store/models/connect/SrtStream/SrtStream';\nimport {isParticipantStreamSettings} from 'app/types/guards/connect';\nimport {SrtDestination} from 'app/components/pages/MeetingDetails/ParticipantCard/ParticipantStream/SrtDestination/SrtDestination';\nimport {isNil} from 'app/util/isNil';\n\ninterface Props extends ClassName {\n stream: SrtStream;\n}\n\nfunction getStateIcon(stream: SrtStream): SvgIcon {\n const {starting, stopping, started, disconnected, failed} = stream;\n\n if (failed) {\n return Icons.warning().theme(THEME.DANGER);\n }\n\n if (starting || stopping || started || disconnected) {\n return Icons.spinner().theme(THEME.SUCCESS);\n }\n\n return Icons.streaming().theme(THEME.PRIMARY);\n}\n\ninterface StatusProps extends ClassName {\n tooltip?: string;\n}\n\nfunction StreamStatus({className, tooltip, children}: PropsWithChildren<StatusProps>) {\n return (\n <Tooltip content={tooltip}>\n <span\n className={classNames('participant-stream__status-text', className)}\n data-id=\"srt_status_text\"\n >\n {children}\n </span>\n </Tooltip>\n );\n}\n\nfunction getStateText(stream: SrtStream): React.ReactNode {\n const {starting, stopping, started, disconnected, failed, error} = stream;\n\n if (failed) {\n return (\n <StreamStatus className=\"participant-stream__status-text--error\" tooltip={error?.message}>\n Connection failed\n </StreamStatus>\n );\n }\n\n if (disconnected) {\n return (\n <StreamStatus tooltip={error?.message}>\n <div className=\"participant-stream__container\">\n Reconnecting {Icons.warning().theme(THEME.DANGER).reactComponent()}\n </div>\n </StreamStatus>\n );\n }\n\n if (starting || stopping || started) {\n return <StreamStatus>Connecting</StreamStatus>;\n }\n\n return <StreamStatus>Connected</StreamStatus>;\n}\n\nconst ParticipantStreamComponent = ({className, stream}: Props) => {\n const {settings} = stream;\n\n if (!settings) {\n return null;\n }\n\n const latency = stream.getActualLatency();\n\n const showPwd = isPassphraseVisible(settings);\n\n const getSrtStatus = () => {\n const icon = getStateIcon(stream).size(SIZE.S).reactComponent();\n const label = getStateText(stream);\n\n return (\n <span className=\"participant-stream__status\" data-id=\"srt_status\">\n {icon}\n {label}\n </span>\n );\n };\n\n return (\n <div className={classNames('participant-stream', className)} data-id=\"participant_srt\">\n <div className=\"participant-stream__col-1\">\n <div className=\"participant-stream__container\">\n <span>SRT Stream:</span>\n {getSrtStatus()}\n </div>\n\n <SrtDestination className=\"participant-stream__address\" stream={stream} />\n </div>\n\n <div className=\"participant-stream__col-2\">\n {!isNil(latency) && (\n <div className=\"participant-stream__latency\">\n <span className=\"participant-stream__label\">Latency: </span>\n <span data-id=\"srt_mode_latency\">{latency} ms</span>\n </div>\n )}\n\n {showPwd && (\n <CopyButton\n className=\"participant-stream__copy\"\n dataId=\"copy_srt_passphrase\"\n placement=\"left\"\n text=\"Copy passphrase\"\n value={settings.key}\n theme={THEME.SUCCESS}\n />\n )}\n </div>\n </div>\n );\n};\n\nexport const ParticipantStream = observer(ParticipantStreamComponent);\n\nfunction isPassphraseVisible(settings: App.Connect.StreamSettings): boolean {\n if (isParticipantStreamSettings(settings)) {\n return !settings.integration && settings.key.length > 0;\n }\n\n return settings.key.length > 0;\n}\n","import React from 'react';\nimport classNames from 'classnames';\nimport {ClassName, DataId} from 'app/types/common';\nimport {SIZE} from 'app/constants';\nimport {Icons, SvgIcon} from 'app/util/icons';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\n\ntype InputType = 'audio' | 'video';\n\ninterface InputProps extends ClassName {\n muted: boolean;\n type: InputType;\n tooltip?: string;\n}\n\nfunction getIcon(type: InputType, muted: boolean): SvgIcon {\n const isVideo = type === 'video';\n\n if (isVideo) {\n if (muted) {\n return Icons.videoOff();\n }\n\n return Icons.videoOn();\n }\n\n return muted ? Icons.microOff() : Icons.microOn();\n}\n\nconst ParticipantInputIcon = ({className, muted, type, tooltip}: InputProps) => {\n const icon = getIcon(type, muted);\n\n return (\n <Tooltip content={tooltip}>\n {icon\n .size(SIZE.S)\n .class(\n classNames('participant-input-icon', muted && 'participant-input-icon--muted', className),\n )\n .reactComponent()}\n </Tooltip>\n );\n};\n\ninterface Props extends ClassName, DataId {\n video: boolean;\n audio: boolean;\n audioTip?: string;\n}\n\nexport const ParticipantInput = ({className, audio, video, audioTip, dataId}: Props) => {\n return (\n <div className={classNames('participant-input', className)} data-id={dataId}>\n <ParticipantInputIcon className=\"participant-input__icon\" type=\"video\" muted={!video} />\n\n <ParticipantInputIcon\n className=\"participant-input__icon\"\n type=\"audio\"\n muted={!audio}\n tooltip={audioTip}\n />\n </div>\n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport {ClassName, DataId} from 'app/types/common';\n\ninterface Props extends ClassName, DataId {\n type: App.Connect.MemberType;\n active?: boolean;\n}\n\nexport const ParticipantMessage = ({className, type, active, dataId}: Props) => {\n if (type === 'participant') {\n return null;\n }\n\n if (type === 'primary-speaker') {\n return (\n <div className={classNames('participant-message', className)} data-id={dataId}>\n Available stream\n </div>\n );\n }\n\n if (type === 'return-feed') {\n return (\n <div\n className={classNames(\n 'participant-message participant-message__share--inactive',\n className,\n )}\n data-id={dataId}\n >\n When started, this stream will appear in the meeting on behalf of Epiphan Connect.\n </div>\n );\n }\n\n return (\n <div\n className={classNames(\n 'participant-message',\n 'participant-message__share',\n !active && 'participant-message__share--inactive',\n className,\n )}\n data-id={dataId}\n >\n {active ? 'One participant is sharing the screen' : 'Nobody is sharing the screen'}\n </div>\n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport {Icons} from 'app/util/icons';\nimport {ClassName, DataId} from 'app/types/common';\nimport {SIZE} from 'app/constants';\n\nexport const DisconnectedLabel = ({className, dataId}: ClassName & DataId) => {\n return (\n <div className={classNames('disconnected-label', className)} data-id={dataId}>\n {Icons.disconnectedSource()\n .size(SIZE.S)\n .class('disconnected-label')\n .label('Disconnected')\n .reactComponent()}\n </div>\n );\n};\n","import {makeAutoObservable} from 'mobx';\n\nexport class SrtSettingsForm {\n settings: App.Connect.StreamSettings;\n errors?: App.Connect.ValidationErrors;\n\n synchronization = false;\n invalid = false;\n\n constructor(settings: App.Connect.StreamSettings) {\n this.settings = settings;\n makeAutoObservable(this, {}, {autoBind: true});\n }\n\n setSettings(settings: Partial<App.Connect.StreamSettings>) {\n this.settings = {\n ...this.settings,\n ...settings,\n };\n }\n\n setSynchronization(value: boolean) {\n this.synchronization = value;\n }\n\n setInvalid(value: boolean) {\n this.invalid = value;\n }\n\n setError(errors?: App.Connect.ValidationErrors) {\n this.errors = errors;\n }\n}\n","import React, {PropsWithChildren} from 'react';\nimport {ClassName, DataId} from 'app/types/common';\nimport classNames from 'classnames';\n\ninterface Props extends PropsWithChildren<ClassName>, DataId {\n label?: string;\n}\n\nexport const StreamSetting = ({className, dataId, label, children}: Props) => {\n return (\n <div className={classNames('stream-setting', className)} data-id={dataId}>\n {label && <div className=\"stream-setting__label\">{label}</div>}\n\n {children}\n </div>\n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport {Autocomplete, TextField} from '@mui/material';\nimport {Callback, ClassName, DataId} from 'app/types/common';\nimport {isNil} from 'app/util/isNil';\n\ninterface Props extends ClassName, DataId {\n value: string;\n error?: string;\n onChange: Callback<void, [string]>;\n onBlur?: Callback;\n}\n\nexport const BitrateInput = ({className, dataId, value, error, onChange, onBlur}: Props) => {\n const onInputChange = (_e, value: string) => {\n onChange(value.replace(/[^0-9]/g, ''));\n };\n\n return (\n <Autocomplete\n className={classNames('bitrate-input', className)}\n data-id={dataId}\n options={[\n {\n label: '1024',\n value: 1024,\n },\n {\n label: '2500',\n value: 2500,\n },\n {\n label: '3000',\n value: 3000,\n },\n {\n label: '6000',\n value: 6000,\n },\n {\n label: '8000',\n value: 8000,\n },\n {\n label: '16000',\n value: 16000,\n },\n {\n label: '32000',\n value: 32000,\n },\n ]}\n freeSolo={true}\n forcePopupIcon={true}\n disableClearable={true}\n disablePortal={true}\n renderInput={(args) => (\n <TextField\n {...args}\n placeholder=\"Select\"\n fullWidth={true}\n error={!isNil(error)}\n helperText={error}\n InputProps={{\n ...args.InputProps,\n endAdornment: (\n <>\n {value ? <span className=\"bitrate-input__suffix\">kbits</span> : null}\n {args.InputProps.endAdornment}\n </>\n ),\n }}\n />\n )}\n inputValue={value}\n onInputChange={onInputChange}\n onBlur={onBlur}\n />\n );\n};\n","import React from 'react';\nimport {Autocomplete, TextField} from '@mui/material';\nimport {Callback, ClassName, DataId} from 'app/types/common';\nimport {isNil} from 'app/util/isNil';\n\ninterface Props extends ClassName, DataId {\n value: string;\n error?: string;\n onChange: Callback<void, [string]>;\n onBlur?: Callback;\n}\n\nexport const FramerateInput = ({className, value, dataId, error, onChange, onBlur}: Props) => {\n const onInputChange = (_e, value: string) => onChange(value.replace(/[^0-9]/g, ''));\n\n return (\n <Autocomplete\n className={className}\n data-id={dataId}\n options={[\n {\n label: '15',\n value: 15,\n },\n {\n label: '24',\n value: 24,\n },\n {\n label: '25',\n value: 25,\n },\n {\n label: '30',\n value: 30,\n },\n {\n label: '45',\n value: 45,\n },\n {\n label: '50',\n value: 50,\n },\n ]}\n freeSolo={true}\n forcePopupIcon={true}\n disableClearable={true}\n disablePortal={true}\n renderInput={(args) => (\n <TextField\n {...args}\n error={!isNil(error)}\n helperText={error}\n placeholder=\"Framerate\"\n fullWidth={true}\n />\n )}\n inputValue={value}\n onInputChange={onInputChange}\n onBlur={onBlur}\n />\n );\n};\n","import {isParticipantStreamSettings} from 'app/types/guards/connect';\n\ntype SuccessResult = {result: true};\ntype ErrorResult = {\n result: false;\n error: string;\n};\n\ntype ValidationResult = SuccessResult | ErrorResult;\n\nfunction validateNotEmpty(value: string | number, error: string): ValidationResult {\n if (typeof value === 'number') {\n return value > 0 ? {result: true} : {result: false, error};\n }\n\n return value.length > 0 ? {result: true} : {result: false, error};\n}\n\nexport function validateStreamSettings(settings: App.Connect.StreamSettings): ValidationResult {\n const checks: ValidationResult[] = [];\n\n if (isParticipantStreamSettings(settings) && settings.integration) {\n checks.push(validateNotEmpty(settings.cloud.deviceId, 'Device is not selected'));\n checks.push(validateNotEmpty(settings.cloud.sourceId, 'Input is not selected'));\n }\n\n const failed = checks.filter((c) => !c.result) as ErrorResult[];\n\n if (failed.length > 0) {\n return {result: false, error: failed.map((f) => f.error).join('. ')};\n }\n\n return {result: true};\n}\n\nexport function getValidNumber(input: string, limit: number, fallback: number): number {\n const casted = Number(input);\n\n if (Number.isSafeInteger(casted) && casted <= limit) {\n return casted;\n }\n\n return fallback;\n}\n","import React, {useState} from 'react';\nimport {ClassName, SelectOption} from 'app/types/common';\nimport classNames from 'classnames';\nimport {observer} from 'mobx-react';\nimport {FormControl, MenuItem, Select, SelectChangeEvent} from '@mui/material';\nimport {StreamSetting} from 'app/components/pages/MeetingDetails/StreamSettings/common/StreamSetting/StreamSetting';\nimport {Icons} from 'app/util/icons';\nimport {SIZE} from 'app/constants';\nimport {BitrateInput} from 'app/components/pages/MeetingDetails/StreamSettings/StreamVideoSettings/BitrateInput/BitrateInput';\nimport {useStrSettingsForm} from 'app/components/pages/MeetingDetails/StreamSettings/SrtSettingsFormContext';\nimport {SrtSettingsCallback} from 'app/components/pages/MeetingDetails/StreamSettings/types';\nimport {FramerateInput} from 'app/components/pages/MeetingDetails/StreamSettings/StreamVideoSettings/FramerateInput/FramerateInput';\nimport {getValidNumber} from 'app/components/pages/MeetingDetails/StreamSettings/utils';\n\nconst presets = ['hd720', 'hd1080'] as const;\nconst configs = [...presets, 'custom'] as const;\n\ntype Config = typeof configs[number];\n\ntype Resolution = SelectOption<App.Connect.VideoSize>;\ntype Configuration = SelectOption<Config>;\n\ntype Presets = Exclude<Config, 'custom'>;\ntype PresetSettings = {[K in Presets]: App.Connect.VideoSettings};\n\nconst Resolutions: Resolution[] = [\n {\n value: 'HDTV_1080',\n label: '1920x1080',\n },\n {\n value: 'HDTV_720',\n label: '1280x720',\n },\n];\n\nexport const Settings: PresetSettings = {\n hd1080: {\n size: 'HDTV_1080',\n framerate: 30,\n bitrate: 6000,\n },\n hd720: {\n size: 'HDTV_720',\n framerate: 30,\n bitrate: 2500,\n },\n};\n\nconst Configs: Configuration[] = [\n {\n label: 'Full HD',\n value: 'hd1080',\n },\n {\n label: 'HD',\n value: 'hd720',\n },\n {\n label: 'Custom',\n value: 'custom',\n },\n];\n\ninterface Props extends ClassName, SrtSettingsCallback {\n settings: App.Connect.ParticipantStreamSettings;\n}\n\nconst StreamVideoSettingsComponent = ({className, settings, onSync: sync}: Props) => {\n const {errors, setSettings} = useStrSettingsForm();\n\n const [config, setConfig] = useState<Config>(() => getMatchedConfig(settings.video));\n\n const handleConfigChange = async (e: SelectChangeEvent<Config>) => {\n const config = e.target.value as Config;\n setConfig(config);\n\n if (config !== 'custom') {\n const settings = getPredefinedSettingsSet(config);\n setSettings({video: settings});\n await sync();\n }\n };\n\n const handleSizeChange = async (e: SelectChangeEvent<App.Connect.VideoSize>) => {\n const size = e.target.value as App.Connect.VideoSize;\n setSettings({\n video: {\n ...settings.video,\n size,\n },\n });\n await sync();\n };\n\n const handleFramerateChange = async (value: string) => {\n const framerate = getValidNumber(value, 60, settings.video.framerate);\n setSettings({\n video: {\n ...settings.video,\n framerate,\n },\n });\n await sync();\n };\n\n const handleBitrateChange = (value: string) => {\n const bitrate = getValidNumber(value, 100000, settings.video.bitrate);\n\n setSettings({\n video: {\n ...settings.video,\n bitrate,\n },\n });\n };\n\n const summary = formatSummary(settings.video);\n const configurable = config === 'custom';\n\n return (\n <div className={classNames('stream-video-settings', className)}>\n <StreamSetting className=\"stream-video-settings__quality\" label=\"Video quality\">\n <FormControl fullWidth={true}>\n <Select data-id=\"srt_video_selector\" value={config} onChange={handleConfigChange}>\n {Configs.map((c) => (\n <MenuItem key={c.value} value={c.value}>\n {c.label}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n </StreamSetting>\n\n {configurable ? (\n <>\n <div className=\"stream-video-settings__custom\">\n <StreamSetting label=\"Frame size\">\n <FormControl fullWidth={true}>\n <Select\n data-id=\"srt_video_frame_size\"\n value={settings.video.size}\n onChange={handleSizeChange}\n >\n {Resolutions.map((r) => (\n <MenuItem key={r.value} value={r.value}>\n {r.label}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n </StreamSetting>\n\n <StreamSetting label=\"Frame rate\">\n <FramerateInput\n dataId=\"srt_video_framerate\"\n value={settings.video.framerate ? settings.video.framerate.toString() : ''}\n error={errors?.VideoFramerate}\n onChange={handleFramerateChange}\n onBlur={sync}\n />\n </StreamSetting>\n\n <StreamSetting label=\"Video bitrate\">\n <BitrateInput\n dataId=\"srt_video_bitrate\"\n value={settings.video.bitrate ? settings.video.bitrate.toString() : ''}\n error={errors?.VideoBitrate}\n onChange={handleBitrateChange}\n onBlur={sync}\n />\n </StreamSetting>\n </div>\n </>\n ) : (\n <StreamSetting label={summary} dataId=\"srt_video_summary\" />\n )}\n\n <div className=\"stream-video-settings__warning\">\n {Icons.info().size(SIZE.S).reactComponent()}\n\n <span className=\"stream-video-settings__message\">\n The video will be scaled if the source is of a different frame size\n </span>\n </div>\n </div>\n );\n};\n\nexport const StreamVideoSettings = observer(StreamVideoSettingsComponent);\n\nfunction getPredefinedSettingsSet(config: Presets): App.Connect.VideoSettings {\n return Settings[config];\n}\n\nfunction matchPredefinedSet(config: Presets, settings: App.Connect.VideoSettings): boolean {\n const {bitrate, framerate, size} = settings;\n\n const set = getPredefinedSettingsSet(config);\n return bitrate === set.bitrate && framerate === set.framerate && size === set.size;\n}\n\nfunction getMatchedConfig(settings: App.Connect.VideoSettings): Config {\n if (matchPredefinedSet('hd1080', settings)) {\n return 'hd1080';\n }\n\n if (matchPredefinedSet('hd720', settings)) {\n return 'hd720';\n }\n\n return 'custom';\n}\n\nfunction formatSummary(settings: App.Connect.VideoSettings) {\n const size = Resolutions.find((r) => settings.size === r.value)?.label ?? '';\n const fps = `${settings.framerate} fps`;\n const bitrate = `Video bitrate: ${settings.bitrate} kbits`;\n\n return `${size} | ${fps} | ${bitrate}`;\n}\n","import React, {PropsWithChildren, useContext, useMemo, useState} from 'react';\nimport {SrtSettingsForm} from 'app/components/pages/MeetingDetails/StreamSettings/SrtSettingsForm';\nimport {noop} from 'app/util/noop';\nimport {Settings} from 'app/components/pages/MeetingDetails/StreamSettings/StreamVideoSettings/StreamVideoSettings';\n\nexport const getDefaultConfiguration = () => {\n return new SrtSettingsForm({\n mode: 'listener',\n port: 14001,\n url: '',\n video: Settings.hd1080,\n audio: {\n bitrate: 96,\n format: 'AAC_48000',\n mode: 'stereo',\n },\n mute: {\n audio: false,\n video: false,\n },\n key: '',\n size: 0,\n latency: 24,\n protocol: 'SRT',\n });\n};\n\ninterface SettingsFormState {\n form: SrtSettingsForm;\n setForm: (form: SrtSettingsForm) => void;\n}\n\nconst SrtSettingsFormContext = React.createContext<SettingsFormState>({\n form: getDefaultConfiguration(),\n setForm: noop,\n});\n\nexport const SrtSettingsFormProvider = ({children}: PropsWithChildren<{}>) => {\n const [form, setForm] = useState<SrtSettingsForm>(getDefaultConfiguration());\n\n const state = useMemo<SettingsFormState>(\n () => ({\n form,\n setForm,\n }),\n [form, setForm],\n );\n\n return (\n <SrtSettingsFormContext.Provider value={state}>{children}</SrtSettingsFormContext.Provider>\n );\n};\n\nexport function useSrtSettings() {\n const state = useContext(SrtSettingsFormContext);\n\n if (!state) {\n throw new Error('Hook should be used inside StreamSettingsContext');\n }\n\n return state;\n}\n\nexport function useStrSettingsForm() {\n const state = useSrtSettings();\n return state.form;\n}\n\nexport function useParticipantSrtSettings() {}\n","import React from 'react';\nimport classNames from 'classnames';\nimport {ClassName, DataId} from 'app/types/common';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\nimport {SIZE, THEME} from 'app/constants';\nimport {Icons} from 'app/util/icons';\n\ninterface Props extends ClassName, DataId {\n name: string;\n}\n\nexport const NoAudioLabel = ({className, name, dataId}: Props) => {\n const tooltip = `${name} is video only`;\n return (\n <Tooltip content={tooltip}>\n <div className={classNames('no-audio-label', className)} data-id={dataId}>\n {Icons.info()\n .theme(THEME.WARNING)\n .size(SIZE.S)\n .label('No audio available')\n .reactComponent()}\n </div>\n </Tooltip>\n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport {ProgressButton} from 'app/components/sharedReactComponents/ProgressButton';\nimport {SIZE, THEME, VARIANT} from 'app/constants';\nimport {Callback, ClassName, DataId} from 'app/types/common';\nimport {Button} from 'app/components/sharedReactComponents/Button';\nimport {Icons, SvgIcon} from 'app/util/icons';\n\ntype InputType = 'video' | 'audio';\n\ninterface Props extends ClassName, DataId {\n disabled?: boolean;\n onAction: Callback;\n}\n\ninterface MuteButtonProps extends Props {\n loading?: boolean;\n muted: boolean;\n}\n\ninterface StreamMuteButtonProps extends MuteButtonProps {\n type: InputType;\n}\n\nconst getIcon = (type: InputType, muted: boolean): SvgIcon => {\n const isVideo = type === 'video';\n\n if (muted) {\n return isVideo ? Icons.videoOff() : Icons.microOff();\n }\n\n return isVideo ? Icons.videoOn() : Icons.microOn();\n};\n\nconst StreamMuteButton = ({\n className,\n type,\n muted,\n dataId,\n disabled = false,\n loading,\n onAction,\n}: StreamMuteButtonProps) => {\n const icon = getIcon(type, muted);\n\n return (\n <ProgressButton\n className={classNames('meeting-stream-btn', className)}\n size={SIZE.S}\n variant={muted ? VARIANT.SOLID : VARIANT.OUTLINE}\n theme={muted ? THEME.DANGER : THEME.SUCCESS}\n dataId={dataId}\n disabled={disabled}\n loading={loading}\n onClick={onAction}\n >\n {icon.reactComponent()}\n </ProgressButton>\n );\n};\n\nconst VideoMuteButton = ({\n className,\n muted,\n dataId,\n disabled,\n loading,\n onAction,\n}: MuteButtonProps) => (\n <StreamMuteButton\n className={className}\n type=\"video\"\n muted={muted}\n dataId={dataId}\n disabled={disabled}\n loading={loading}\n onAction={onAction}\n />\n);\n\nconst AudioMuteButton = ({\n className,\n muted,\n dataId,\n disabled = false,\n loading,\n onAction,\n}: MuteButtonProps) => (\n <StreamMuteButton\n className={className}\n type=\"audio\"\n muted={muted}\n dataId={dataId}\n disabled={disabled}\n loading={loading}\n onAction={onAction}\n />\n);\n\nconst StreamSettingsButton = ({className, dataId, disabled = false, onAction}: Props) => {\n return (\n <Button\n className={classNames('meeting-stream-btn', className)}\n size={SIZE.S}\n variant={VARIANT.OUTLINE}\n theme={THEME.SUCCESS}\n dataId={dataId}\n disabled={disabled}\n onClick={onAction}\n >\n {Icons.options().reactComponent()}\n </Button>\n );\n};\n\nconst StreamStopButton = ({className, dataId, disabled = false, onAction}: Props) => {\n return (\n <>\n <ProgressButton\n className={classNames('meeting-stream-start-stop-btn', className)}\n size={SIZE.S}\n variant={VARIANT.SOLID}\n theme={THEME.SUCCESS}\n dataId={dataId}\n disabled={disabled}\n onClick={onAction}\n >\n {Icons.stop().label('Stop').reactComponent()}\n </ProgressButton>\n </>\n );\n};\n\nconst StreamStartButton = ({className, dataId, disabled = false, onAction}: Props) => {\n return (\n <>\n <ProgressButton\n className={classNames('meeting-stream-start-stop-btn', className)}\n size={SIZE.S}\n variant={VARIANT.SOLID}\n theme={THEME.PRIMARY}\n dataId={dataId}\n disabled={disabled}\n onClick={onAction}\n >\n {Icons.play().label('Start').reactComponent()}\n </ProgressButton>\n </>\n );\n};\n\nexport {\n VideoMuteButton,\n AudioMuteButton,\n StreamSettingsButton,\n StreamStartButton,\n StreamStopButton,\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport {observer} from 'mobx-react';\nimport {ClassName} from 'app/types/common';\nimport {Separator} from 'app/components/sharedReactComponents/Separator';\nimport {OverflowTooltip} from 'app/components/sharedReactComponents/OverflowTooltip/OverflowTooltip';\nimport {ParticipantInput} from 'app/components/pages/MeetingDetails/shared/ParticipantInput/ParticipantInput';\nimport {\n AudioMuteButton,\n VideoMuteButton,\n} from 'app/components/pages/MeetingDetails/shared/StreamButtons/StreamButtons';\nimport {ParticipantMessage} from 'app/components/pages/MeetingDetails/shared/ParticipantMessage/ParticipantMessage';\nimport {ParticipantAvatar} from 'app/components/pages/MeetingDetails/shared/ParticipantAvatar/ParticipantAvatar';\nimport {useStrSettingsForm} from 'app/components/pages/MeetingDetails/StreamSettings/SrtSettingsFormContext';\nimport {SrtSettingsCallback} from 'app/components/pages/MeetingDetails/StreamSettings/types';\n\ninterface Props extends ClassName, SrtSettingsCallback {\n name: string;\n state: App.Connect.ParticipantState;\n type: App.Connect.MemberType;\n share: boolean;\n video: boolean;\n audio: boolean;\n}\n\nconst StreamGeneralSettingsComponent = ({\n className,\n name,\n type,\n share,\n state,\n audio,\n video,\n onSync,\n}: Props) => {\n const {synchronization, settings, setSettings} = useStrSettingsForm();\n\n const isShare = type === 'vbss';\n const isSpeaker = type === 'primary-speaker';\n\n const onAudioMute = async () => {\n const audio = !settings.mute.audio;\n\n setSettings({\n mute: {\n audio,\n video: settings.mute.video,\n },\n });\n await onSync();\n };\n\n const onVideoMute = async () => {\n const video = !settings.mute.video;\n\n setSettings({\n mute: {\n audio: settings.mute.audio,\n video,\n },\n });\n\n await onSync();\n };\n\n return (\n <div className={classNames('stream-general-settings', className)}>\n <ParticipantAvatar\n className=\"stream-general-settings__avatar\"\n dataId=\"participant_avatar\"\n type={type}\n name={name}\n cameraOff={!video}\n sharing={share}\n size=\"big\"\n disconnected={state === 'left-with-stream'}\n />\n\n <div className=\"stream-general-settings__info\">\n <div className=\"stream-general-settings__user\">\n <div className=\"stream-general-settings__container\">\n <span className=\"stream-general-settings__name\">\n <OverflowTooltip dataId=\"participant_name\">{name}</OverflowTooltip>\n </span>\n\n {!isShare && (\n <ParticipantInput audio={audio} video={video} dataId=\"participant_input\" />\n )}\n </div>\n\n {isSpeaker && <ParticipantMessage type=\"primary-speaker\" dataId=\"participant_message\" />}\n\n {isShare && (\n <ParticipantMessage type=\"vbss\" dataId=\"participant_message\" active={share} />\n )}\n </div>\n\n <Separator className=\"stream-general-settings__separator\" />\n\n <div className=\"stream-general-settings__mute\">\n <AudioMuteButton\n className=\"stream-general-settings__btn\"\n dataId=\"mute_srt_audio\"\n muted={settings.mute.audio}\n disabled={synchronization}\n onAction={onAudioMute}\n />\n\n <span>Mute audio on start</span>\n </div>\n\n <div className=\"stream-general-settings__mute\">\n <VideoMuteButton\n className=\"stream-general-settings__btn\"\n dataId=\"mute_srt_video\"\n muted={settings.mute.video}\n disabled={synchronization}\n onAction={onVideoMute}\n />\n\n <span>Mute video on start</span>\n </div>\n </div>\n </div>\n );\n};\n\nexport const StreamGeneralSettings = observer(StreamGeneralSettingsComponent);\n","import React, {PropsWithChildren} from 'react';\nimport {ClassName, DataId, Sx} from 'app/types/common';\nimport {Caret, CARET_VARIANT} from 'app/components/sharedReactComponents/Caret';\nimport {useToggle} from 'app/hooks/useToggle';\nimport {SIZE, VARIANT} from 'app/constants';\nimport {Button} from 'app/components/sharedReactComponents/Button';\nimport {Box, Stack, Typography} from '@mui/material';\nimport {packSx} from 'app/util/packSx/packSx';\n\ninterface Props extends PropsWithChildren<ClassName>, DataId, Sx {\n title: string;\n initState?: boolean;\n collapsible?: boolean;\n}\n\nexport const CollapsiblePanel = ({\n sx,\n title,\n collapsible = true,\n initState,\n dataId,\n children,\n}: Props) => {\n const [opened, toggleOpened] = useToggle(collapsible ? initState : true);\n\n const handleToggle = () => {\n if (collapsible) {\n toggleOpened();\n }\n };\n\n return (\n <Box sx={packSx({'& > button': {padding: '2px 0px'}}, sx)}>\n <Button data-id={dataId} variant={VARIANT.TEXT} onClick={handleToggle}>\n <Stack direction=\"row\" alignItems=\"center\" gap={1}>\n <Typography fontWeight={600}>{title}</Typography>\n {collapsible && <Caret variant={CARET_VARIANT.THIN} size={SIZE.S} opened={opened} />}\n </Stack>\n </Button>\n\n {opened && <div>{children}</div>}\n </Box>\n );\n};\n","import React from 'react';\nimport {OutlinedTextFieldProps, TextField} from '@mui/material';\nimport classNames from 'classnames';\nimport {DataId} from 'app/types/common';\n\nexport type TextInputProps = Omit<OutlinedTextFieldProps, 'variant'>;\n\nexport const TextInput = ({className, dataId, ...props}: TextInputProps & DataId) => {\n return (\n <TextField\n {...props}\n className={classNames('text-input', className)}\n variant=\"outlined\"\n data-id={dataId}\n />\n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport {Component} from 'app/types/common';\nimport {THEME} from 'app/constants';\nimport {CopyButton} from 'app/components/sharedReactComponents/CopyButton';\n\ninterface Props extends Component {\n value: string | number;\n}\n\nexport const CopyText = ({className, value, dataId}: Props) => {\n return (\n <div className={classNames('copy-text', className)} data-id={dataId}>\n <span className=\"copy-text__value\">{value}</span>\n\n <CopyButton className=\"copy-text__copy\" theme={THEME.SUCCESS} text=\"\" value={value} />\n </div>\n );\n};\n","import React, {useState} from 'react';\nimport {observer} from 'mobx-react';\nimport classNames from 'classnames';\nimport {InputAdornment, TextField, Typography} from '@mui/material';\nimport {Callback, ChangeEvent, Component} from 'app/types/common';\nimport {StreamSetting} from 'app/components/pages/MeetingDetails/StreamSettings/common/StreamSetting/StreamSetting';\nimport {RadioGroup} from 'app/components/sharedReactComponents/RadioGroup';\nimport {Radio} from 'app/components/sharedReactComponents/Radio';\nimport {SIZE} from 'app/constants';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\nimport {TextInput} from 'app/components/sharedReactComponents/TextInput/TextInput';\nimport {getValidNumber} from 'app/components/pages/MeetingDetails/StreamSettings/utils';\nimport {CopyText} from 'app/components/pages/MeetingDetails/shared/CopyText/CopyText';\nimport {Icons} from 'app/util/icons';\nimport {SrtSettingsCallback} from 'app/components/pages/MeetingDetails/StreamSettings/types';\nimport {isNil} from 'app/util/isNil';\n\ninterface CustomConnection {\n url: string;\n port: number;\n}\n\nfunction getInitialSettings(mode: App.Connect.SteamMode, settings: CustomConfig): CustomConnection {\n if (mode === settings.mode) {\n const {url, port} = settings;\n return {url, port};\n }\n\n return {\n port: 0,\n url: '',\n };\n}\n\nexport interface CustomConfig {\n mode: App.Connect.SteamMode;\n url: string;\n port: number;\n}\n\ninterface Props extends Component, SrtSettingsCallback {\n config: CustomConfig;\n range: App.Connect.PortRange;\n dns: string;\n errors?: App.Connect.ValidationErrors;\n setConfig: Callback<void, [Partial<CustomConfig>]>;\n}\n\nexport const CustomSrtConnection = observer(\n ({className, dataId, config, range, dns, errors, onSync, setConfig}: Props) => {\n const [caller, setCaller] = useState<CustomConnection>(() =>\n getInitialSettings('caller', config),\n );\n\n const [listener, setListener] = useState<CustomConnection>(() =>\n getInitialSettings('listener', config),\n );\n\n const handleModeChange = async (e: ChangeEvent<App.Connect.SteamMode>) => {\n const mode = e.target.value;\n const connection = mode === 'listener' ? {...listener} : {...caller};\n setConfig({...connection, mode});\n await onSync();\n };\n\n const handleUrlChange = (e: ChangeEvent<string>) => {\n const url = e.target.value;\n setConfig({url});\n setCaller((prev) => ({...prev, url}));\n };\n\n const handlePortChange = async (e: ChangeEvent<string>) => {\n const input = e.target.value.replace(/[^0-9]/g, '');\n const port = getValidNumber(input, range.to, listener.port);\n\n setConfig({port});\n setListener((prev) => ({\n ...prev,\n port,\n }));\n };\n\n const renderControls = () => {\n const callerMode = config.mode === 'caller';\n\n if (callerMode) {\n return (\n <>\n <StreamSetting className=\"custom-srt-connection__setting\" label=\"URL\">\n <TextField\n data-id=\"srt_caller_url\"\n placeholder=\"srt://decoder-url:port\"\n value={caller.url}\n fullWidth={true}\n error={!isNil(errors?.StreamUrl)}\n helperText={errors?.StreamUrl}\n onChange={handleUrlChange}\n onBlur={onSync}\n />\n </StreamSetting>\n\n <StreamSetting\n className=\"custom-srt-connection__setting\"\n label=\"Configure SRT listener at the specified URL to get the SRT stream\"\n />\n </>\n );\n }\n\n const portWarning = `Make sure this port is in range ${range.from} - ${range.to}`;\n const listenerUrl = `srt://${dns}:${config.port}`;\n\n return (\n <>\n <StreamSetting className=\"custom-srt-connection__setting\" label=\"Port\">\n <div className=\"custom-srt-connection__port-wrapper\">\n <TextInput\n className=\"custom-srt-connection__port\"\n dataId=\"srt_listener_port\"\n placeholder=\"Port\"\n fullWidth={true}\n InputProps={{\n sx: {width: 140},\n endAdornment: (\n <InputAdornment sx={{mr: 0.5, cursor: 'default'}} position=\"end\">\n <Tooltip content={portWarning}>{Icons.info().reactComponent()}</Tooltip>\n </InputAdornment>\n ),\n }}\n value={listener.port ? listener.port.toString() : ''}\n error={!isNil(errors?.Port)}\n helperText={errors?.Port}\n onChange={handlePortChange}\n onBlur={onSync}\n />\n </div>\n </StreamSetting>\n\n <StreamSetting\n className=\"custom-srt-connection__setting\"\n label=\"Your stream will be available at\"\n >\n <CopyText value={listenerUrl} dataId=\"srt_listener_url\" />\n </StreamSetting>\n </>\n );\n };\n\n return (\n <div data-id={dataId} className={classNames('custom-srt-connection', className)}>\n <Typography mb={2}>\n Manually configure your SRT connection to send it to your preferred video production tool.\n </Typography>\n\n <StreamSetting className=\"custom-srt-connection__mode\" label=\"Connection mode\">\n <RadioGroup\n className=\"custom-srt-connection__group\"\n dataId=\"srt_mode_radio\"\n value={config.mode}\n onChange={handleModeChange}\n >\n <Radio\n className=\"custom-srt-connection__radio\"\n dataId=\"srt_listener_mode\"\n size={SIZE.S}\n value=\"listener\"\n label=\"Listener\"\n />\n\n <Radio\n className=\"custom-srt-connection__radio\"\n dataId=\"srt_caller_mode\"\n size={SIZE.S}\n value=\"caller\"\n label=\"Caller\"\n />\n </RadioGroup>\n </StreamSetting>\n\n {renderControls()}\n </div>\n );\n },\n);\n","import React, {PropsWithChildren} from 'react';\nimport {\n Autocomplete,\n AutocompleteChangeDetails,\n AutocompleteChangeReason,\n AutocompleteValue,\n Box,\n InputAdornment,\n MenuItem,\n Stack,\n TextField,\n} from '@mui/material';\nimport {Callback, Component} from 'app/types/common';\nimport {text} from 'app/themes/app';\nimport {OnlineIndicator} from 'app/components/sharedReactComponents/OnlineIndicator';\nimport {SIZE} from 'app/constants';\nimport {isNil} from 'app/util/isNil';\nimport {DevicePicture} from 'app/components/sharedReactComponents/DevicePicture/DevicePicture';\n\ninterface Props extends Component {\n value: App.Connect.CloudEntity | null;\n error?: string;\n entities: App.Connect.CloudEntity[];\n onChange: SrtEntityChangeCallback;\n}\n\nexport type SrtEntityChangeCallback = Callback<\n void,\n [\n event: React.SyntheticEvent,\n value: AutocompleteValue<App.Connect.CloudEntity, false, false, false>,\n reason: AutocompleteChangeReason,\n details?: AutocompleteChangeDetails<App.Connect.CloudEntity>,\n ]\n>;\n\nfunction GroupHeader({children}: PropsWithChildren<{}>) {\n return <Box sx={{px: 2, py: 1, color: text.group}}>{children}</Box>;\n}\n\nfunction formatGroupHeader(value: string) {\n if (value === 'device') {\n return 'Devices';\n }\n\n return 'Unify projects';\n}\n\nfunction GroupItem({children}: PropsWithChildren<{}>) {\n return <div>{children}</div>;\n}\n\nexport const SrtEntitySelector = ({dataId, value, error, entities, onChange}: Props) => {\n const renderAdornment = () => {\n if (value) {\n return (\n <InputAdornment position=\"start\">\n <EntityIcon model={value.model} />\n </InputAdornment>\n );\n }\n\n return null;\n };\n\n return (\n <Autocomplete\n data-id={dataId}\n value={value}\n fullWidth={true}\n isOptionEqualToValue={(o, v) => o.id === v?.id}\n groupBy={(o) => o.type}\n renderInput={(params) => (\n <TextField\n data-id=\"selector_input\"\n helperText={error ?? 'Please make sure your projects and devices are online'}\n error={!isNil(error)}\n {...params}\n InputProps={{\n ...params.InputProps,\n startAdornment: renderAdornment(),\n }}\n placeholder=\"Select device or project\"\n />\n )}\n renderGroup={(params) => (\n <div key={params.key}>\n <GroupHeader>{formatGroupHeader(params.group)}</GroupHeader>\n <GroupItem>{params.children}</GroupItem>\n </div>\n )}\n renderOption={(props, option) => (\n <MenuItem {...props}>\n <EntityIcon model={option.model} /> {option.name}\n </MenuItem>\n )}\n getOptionLabel={(o) => o.name}\n options={entities}\n onChange={onChange}\n />\n );\n};\n\ninterface EntityIconProps {\n model: App.Connect.SrtEntityModel;\n}\n\nfunction EntityIcon({model}: EntityIconProps) {\n const renderIcon = () => {\n if (model === 'Epiphan Unify Project') {\n return <OnlineIndicator online={true} size={SIZE.S} />;\n }\n\n return <DevicePicture sx={{width: 34}} model={model as App.Cloud.DeviceModel} />;\n };\n\n return (\n <Stack sx={{height: '16px', mr: 0.5}} alignItems=\"center\" direction=\"row\">\n {renderIcon()}\n </Stack>\n );\n}\n","import React, {PropsWithChildren, useMemo} from 'react';\nimport {Box, FormControl, FormHelperText, InputLabel, MenuItem, Select, Stack} from '@mui/material';\nimport {Callback, Component} from 'app/types/common';\nimport {text} from 'app/themes/app';\nimport {isNil} from 'app/util/isNil';\nimport {Icons} from 'app/util/icons';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\nimport {SIZE, THEME} from 'app/constants';\n\nfunction Placeholder({children}: PropsWithChildren<{}>) {\n return <InputLabel sx={{m: 0, color: text.label}}>{children}</InputLabel>;\n}\n\nconst replaceMessage =\n 'The SRT input will be overwritten with a new configuration. You still can edit this input by logging into your device or Unify project and going to the input section. ';\n\ninterface Props extends Component {\n value: string;\n loading: boolean;\n entity?: App.Connect.CloudEntityType;\n error?: string;\n sources: App.Connect.EntitySource[];\n onChange: Callback;\n}\n\nexport const SrtSourceSelector = ({\n value,\n dataId,\n sources,\n loading,\n entity,\n error,\n onChange,\n}: Props) => {\n const areSourcesAvailable = useMemo(() => sources.some((s) => !s.active), [sources]);\n const noSources = sources.length === 0;\n\n const disabled = noSources || !areSourcesAvailable || isNil(entity) || loading;\n\n const renderHelper = () => {\n if (value) {\n return (\n <div>\n <Tooltip content={replaceMessage}>\n <Stack sx={{display: 'inline-flex'}} spacing={0.5} direction=\"row\" alignItems=\"center\">\n {Icons.info().theme(THEME.DANGER).size(SIZE.S).reactComponent()}\n <FormHelperText error={true}>This input will be replaced</FormHelperText>\n </Stack>\n </Tooltip>\n </div>\n );\n }\n\n if (error && !disabled) {\n return <FormHelperText>{error ?? ' '}</FormHelperText>;\n }\n\n if (!isNil(entity) && (!areSourcesAvailable || noSources)) {\n return (\n <FormHelperText error={false} disabled={false}>\n To create an input, admin log in your {entity === 'device' ? 'Device' : 'Unify project'}\n </FormHelperText>\n );\n }\n\n return null;\n };\n\n const renderLabel = () => {\n if (loading) {\n return <Placeholder>Loading</Placeholder>;\n }\n\n if (!isNil(entity)) {\n if (noSources) {\n return `This ${entity} has no input created`;\n }\n\n if (!areSourcesAvailable) {\n return 'All inputs are in use. Please create a new one';\n }\n }\n\n return 'Select input';\n };\n\n const renderValue = (value: string) => {\n if (!value) {\n return renderLabel();\n }\n\n return sources.find((s) => s.id === value)?.name ?? value;\n };\n\n return (\n <FormControl\n data-id={dataId}\n fullWidth={true}\n disabled={disabled}\n error={!disabled && Boolean(error)}\n >\n <Select value={value} renderValue={renderValue} displayEmpty={true} onChange={onChange}>\n {sources.map((src) => (\n <MenuItem key={src.id} value={src.id} disabled={src.active}>\n {src.name}\n\n {src.active && <Box sx={{ml: 'auto'}}>active</Box>}\n </MenuItem>\n ))}\n </Select>\n {renderHelper()}\n </FormControl>\n );\n};\n","import React, {useState} from 'react';\nimport classNames from 'classnames';\nimport {Button} from 'app/components/sharedReactComponents/Button';\nimport {THEME, VARIANT} from 'app/constants';\nimport {Callback, Component} from 'app/types/common';\nimport {\n SrtEntityChangeCallback,\n SrtEntitySelector,\n} from 'app/components/pages/MeetingDetails/StreamSettings/StreamConnectionSettings/CloudSrtConnection/SrtEntitySelector/SrtEntitySelector';\nimport {StreamSetting} from 'app/components/pages/MeetingDetails/StreamSettings/common/StreamSetting/StreamSetting';\nimport {SrtSourceSelector} from 'app/components/pages/MeetingDetails/StreamSettings/StreamConnectionSettings/CloudSrtConnection/SrtSourceSelector/SrtSourceSelector';\nimport {Box, SelectChangeEvent, Stack, Typography} from '@mui/material';\nimport {SrtSettingsCallback} from 'app/components/pages/MeetingDetails/StreamSettings/types';\nimport {router} from 'app/router/main';\nimport {palette} from 'app/themes/app';\n\ninterface Props extends Component, SrtSettingsCallback {\n config: App.Connect.CloudConnection;\n entities: App.Connect.CloudEntity[];\n sources: App.Connect.EntitySource[];\n errors?: App.Connect.ValidationErrors;\n isLoadingSources: boolean;\n supportUnify: boolean;\n setConfig: Callback<void, [Partial<App.Connect.CloudConnection>]>;\n onEntityChange: Callback<Promise<void>, [entity: App.Connect.CloudEntity | null]>;\n}\n\nexport const CloudSrtConnection = ({\n className,\n dataId,\n config,\n entities,\n sources,\n isLoadingSources,\n supportUnify,\n errors,\n setConfig,\n onSync,\n onEntityChange,\n}: Props) => {\n const [entity, setEntity] = useState<App.Connect.CloudEntity | null>(() => {\n if (config.deviceId) {\n const found = entities.find((e) => e.id === config.deviceId);\n return found ?? null;\n }\n\n return null;\n });\n const [sourceId, setSourceId] = useState(config.sourceId);\n\n const handleEntityChange: SrtEntityChangeCallback = async (...args) => {\n const [, value] = args;\n const deviceId = value?.id ?? '';\n\n setEntity(value ?? null);\n setSourceId('');\n\n setConfig({\n sourceId: '',\n sourceName: '',\n deviceId,\n deviceName: value?.name ?? '',\n });\n\n await onEntityChange(value);\n };\n\n const handleSourceChange = async (e: SelectChangeEvent<string>) => {\n const selectedId = e.target.value;\n setSourceId(e.target.value);\n const selectedSource = sources.find((s) => s.id === selectedId);\n\n if (selectedSource) {\n setConfig({sourceId: selectedSource.id, sourceName: selectedSource.name});\n } else {\n setConfig({sourceId: '', sourceName: ''});\n }\n await onSync();\n };\n\n const handlePairDevice = () => {\n router.go('welcome');\n };\n\n if (entities.length === 0) {\n return (\n <Stack data-id={dataId} gap={3} alignItems=\"start\">\n <Box>\n <Box sx={{mb: 1}}>Epiphan devices and Unify projects are offline or not paired.</Box>\n\n <Box sx={{fontSize: '12px', color: palette.gray}}>\n Turn on or pair your Epiphan devices. Start or create your Unify projects.\n </Box>\n </Box>\n\n <Button\n dataId=\"cloud_srt_pair_device\"\n variant={VARIANT.OUTLINE}\n theme={THEME.SUCCESS}\n href={router.url('welcome')}\n onClick={handlePairDevice}\n >\n Pair a new Epiphan device\n </Button>\n\n {supportUnify && (\n <Button\n dataId=\"cloud_srt_pair_unify_pair\"\n variant={VARIANT.OUTLINE}\n theme={THEME.SUCCESS}\n href={router.url('projects')}\n >\n Open Unify\n </Button>\n )}\n </Stack>\n );\n }\n\n return (\n <div className={classNames('cloud-srt-connection', className)} data-id={dataId}>\n <Typography mb={2}>Send this feed to an Epiphan device or Unify project.</Typography>\n\n <StreamSetting className=\"cloud-srt-connection__item\" label=\"Epiphan device or Unify project\">\n <SrtEntitySelector\n dataId=\"entity_selector\"\n value={entity}\n error={errors?.DeviceId}\n entities={entities}\n onChange={handleEntityChange}\n />\n </StreamSetting>\n\n <StreamSetting className=\"cloud-srt-connection__item\" label=\"SRT input\">\n <SrtSourceSelector\n dataId=\"source_selector\"\n value={sourceId}\n error={errors?.SourceId}\n loading={isLoadingSources}\n sources={sources}\n entity={entity?.type}\n onChange={handleSourceChange}\n />\n </StreamSetting>\n </div>\n );\n};\n","import {front} from 'app/api/CirrusApi';\nimport {GetAbortCallback} from 'app/api/types';\n\nexport class SrtApiService {\n static async mute(\n meetingId: string,\n participantId: string,\n mute: App.Connect.StreamMute,\n ): Promise<void> {\n return front\n .econnect()\n .meetings(meetingId)\n .participants(participantId)\n .stream()\n .settings()\n .mute()\n .put(mute);\n }\n\n static async muteFeed(meetingId: string, mute: App.Connect.StreamMute) {\n return front.econnect().meetings(meetingId).injection().stream().settings().mute().put(mute);\n }\n\n static async start(meetingId: string, participantId: string): Promise<void> {\n return front.econnect().meetings(meetingId).participants(participantId).stream().start().post();\n }\n\n static async startFeed(meetingId: string): Promise<void> {\n return front.econnect().meetings(meetingId).injection().stream().start().post();\n }\n\n static async setParticipantSettings(\n meetingId: string,\n participantId: string,\n contract: Contracts.Connect.StreamSettings<Contracts.Connect.ParticipantStreamSetting>,\n ): Promise<void> {\n return front\n .econnect()\n .meetings(meetingId)\n .participants(participantId)\n .stream()\n .settings()\n .put(contract);\n }\n\n static async setFeedSettings(\n meetingId: string,\n contract: Contracts.Connect.StreamSettings<Contracts.Connect.FeedStreamSetting>,\n ): Promise<void> {\n return front.econnect().meetings(meetingId).injection().stream().settings().put(contract);\n }\n\n static async stop(meetingId: string, participantId: string): Promise<void> {\n return front.econnect().meetings(meetingId).participants(participantId).stream().stop().post();\n }\n\n static async stopFeed(meetingId: string) {\n return front.econnect().meetings(meetingId).injection().stream().stop().post();\n }\n\n static async getParticipantStreamStatus(\n meetingId: string,\n participantId: string,\n getAbort?: GetAbortCallback,\n ): Promise<Contracts.Connect.StreamingStatus> {\n return front\n .econnect()\n .meetings(meetingId)\n .participants(participantId)\n .stream()\n .status()\n .get(undefined, {getAbort});\n }\n\n static async getReturnFeedStreamStatus(\n meetingId: string,\n getAbort?: GetAbortCallback,\n ): Promise<Contracts.Connect.StreamingStatus> {\n return front\n .econnect()\n .meetings(meetingId)\n .injection()\n .stream()\n .status()\n .get(undefined, {getAbort});\n }\n\n static async getOnlineCloudEntities(): Promise<Array<Contracts.Connect.CloudEntity>> {\n return front.devices().ssrt().get();\n }\n\n static async getEntitySources(id: string): Promise<Array<App.Connect.EntitySource>> {\n return front.devices().ssrt(id).inputs().get();\n }\n}\n","import React, {useEffect, useState} from 'react';\nimport classNames from 'classnames';\nimport {Stack, Typography} from '@mui/material';\nimport {ChangeEvent, ClassName} from 'app/types/common';\nimport {SrtSettingsCallback} from 'app/components/pages/MeetingDetails/StreamSettings/types';\nimport {Tabs, TABS_THEME} from 'app/components/sharedReactComponents/Tabs/Tabs';\nimport {Tab} from 'app/components/sharedReactComponents/Tabs/Tab';\nimport {TabPanels} from 'app/components/sharedReactComponents/Tabs/TabPanels';\nimport {TabPanel} from 'app/components/sharedReactComponents/Tabs/TabPanel';\nimport {\n CustomConfig,\n CustomSrtConnection,\n} from 'app/components/pages/MeetingDetails/StreamSettings/StreamConnectionSettings/CustomSrtConnection/CustomSrtConnection';\nimport {CloudSrtConnection} from 'app/components/pages/MeetingDetails/StreamSettings/StreamConnectionSettings/CloudSrtConnection/CloudSrtConnection';\nimport {useSrtSettings} from 'app/components/pages/MeetingDetails/StreamSettings/SrtSettingsFormContext';\nimport {isParticipantStreamSettings} from 'app/types/guards/connect';\nimport {SrtApiService} from 'app/services/api/meetings/SrtApiService';\nimport {LoadingPlaceholder} from 'app/components/sharedReactComponents/LoadingPlaceholder';\nimport {ConnectMapper} from 'app/util/mappers/ConnectMapper/ConnectMapper';\nimport {stringComparator} from 'app/util/Sort';\nimport {isNil} from 'app/util/isNil';\nimport {palette} from 'app/themes/app';\nimport {useCloud} from 'app/components/features/cloud';\n\ntype ConnectionType = 'cloud' | 'custom';\n\nfunction CloudSyncLoader() {\n return (\n <Stack direction=\"row\" justifyContent=\"center\" alignItems=\"center\" gap={1}>\n <LoadingPlaceholder /> <span>Loading cloud devices</span>\n </Stack>\n );\n}\n\ninterface Props extends ClassName, SrtSettingsCallback {\n range: App.Connect.PortRange;\n dns: string;\n}\n\nexport function StreamConnectionSettings({className, dns, range, onSync}: Props) {\n const {team} = useCloud();\n const {form} = useSrtSettings();\n const [type, setType] = useState<ConnectionType>(() => getConnectionType(form.settings));\n\n const supportUnify = team.capabilities.has('unify');\n\n const [isLoadingCloud, setIsLoadingCloud] = useState(type === 'cloud');\n const [isLoadingSources, setIsLoadingSources] = useState(false);\n\n const [entities, setEntities] = useState<App.Connect.CloudEntity[]>([]);\n const [sources, setSources] = useState<App.Connect.EntitySource[]>([]);\n\n const handleTabChange = async ({target: {value}}: ChangeEvent<ConnectionType>) => {\n setType(value);\n const isCloud = value === 'cloud';\n form.setSettings({integration: isCloud});\n\n if (!isCloud) {\n await onSync();\n return;\n }\n\n form.setSettings({key: '', size: 0});\n };\n\n const handleSetCustomConfig = (config: Partial<CustomConfig>) => {\n form.setSettings(config);\n };\n\n const handleSetCloudConfig = (config: Partial<App.Connect.CloudConnection>) => {\n if (isParticipantStreamSettings(form.settings)) {\n const current = form.settings.cloud;\n form.setSettings({cloud: {...current, ...config}});\n }\n };\n\n const handleEntityChange = async (entity: App.Connect.CloudEntity | null) => {\n if (!isNil(entity)) {\n try {\n setIsLoadingSources(true);\n const inputs = await SrtApiService.getEntitySources(entity.id);\n\n setSources(inputs);\n } catch {\n setSources([]);\n } finally {\n setIsLoadingSources(false);\n }\n } else {\n setSources([]);\n }\n\n await onSync();\n };\n\n const {mode, url, port} = form.settings;\n const customConfig = {mode, url, port};\n\n useEffect(() => {\n const syncCloudSettings = async () => {\n if (!isParticipantStreamSettings(form.settings)) {\n return;\n }\n\n const {cloud} = form.settings;\n setIsLoadingCloud(true);\n\n const items = await getOnlineEntities();\n setEntities(items.map(ConnectMapper.mapCloudEntity));\n\n const {deviceId} = cloud;\n const entity = items.find((i) => i.id === deviceId);\n\n if (!entity) {\n form.setSettings({\n cloud: {deviceId: '', deviceName: '', sourceId: '', sourceName: '', type: 'device'},\n });\n setSources([]);\n } else {\n const srtEntity: App.Connect.SrtEntity = {\n deviceId: entity.id,\n deviceName: entity.name,\n type: entity.type,\n };\n form.setSettings({cloud: {...cloud, ...srtEntity}});\n\n const inputs = await getEntitySource(deviceId);\n setSources(inputs);\n\n const {sourceId} = form.settings.cloud;\n const source = inputs.find((i) => i.id === sourceId && !i.active);\n\n const srtSource: App.Connect.SrtSource = {\n sourceId: source?.id ?? '',\n sourceName: source?.name ?? '',\n };\n\n form.setSettings({cloud: {...cloud, ...srtSource}});\n }\n\n setIsLoadingCloud(false);\n await onSync();\n };\n\n if (type === 'cloud') {\n void syncCloudSettings();\n }\n }, [type, form, onSync]);\n\n if (!isParticipantStreamSettings(form.settings)) {\n return (\n <div className={classNames('stream-connection-settings', className)}>\n <CustomSrtConnection\n className=\"stream-connection-settings__feed-panel\"\n config={customConfig}\n range={range}\n errors={form.errors}\n dns={dns}\n setConfig={handleSetCustomConfig}\n onSync={onSync}\n />\n </div>\n );\n }\n\n return (\n <div className={classNames('stream-connection-settings', className)}>\n <Typography color={palette.darkerGray} mb={3}>\n Configure where Connect will send the participant's AV signals.\n </Typography>\n\n <Tabs\n className=\"stream-connection-settings__tabs\"\n theme={TABS_THEME.SETTINGS}\n value={type}\n onChange={handleTabChange}\n >\n <Tab data-id=\"cloud_tab\" label=\"Epiphan\" value=\"cloud\" />\n <Tab data-id=\"custom_tab\" label=\"Manual SRT\" value=\"custom\" />\n </Tabs>\n\n <TabPanels value={type}>\n <TabPanel className=\"stream-connection-settings__panel\" value=\"cloud\">\n {isLoadingCloud ? (\n <CloudSyncLoader />\n ) : (\n <CloudSrtConnection\n entities={entities}\n sources={sources}\n errors={form.errors}\n isLoadingSources={isLoadingSources}\n config={form.settings.cloud}\n supportUnify={supportUnify}\n setConfig={handleSetCloudConfig}\n onEntityChange={handleEntityChange}\n onSync={onSync}\n />\n )}\n </TabPanel>\n\n <TabPanel className=\"stream-connection-settings__panel\" value=\"custom\">\n <CustomSrtConnection\n config={customConfig}\n errors={form.errors}\n range={range}\n dns={dns}\n setConfig={handleSetCustomConfig}\n onSync={onSync}\n />\n </TabPanel>\n </TabPanels>\n </div>\n );\n}\n\nfunction sortEntities(a: App.Connect.CloudEntity, b: App.Connect.CloudEntity) {\n if (a.type === b.type) {\n return stringComparator(a.name, b.name);\n }\n\n if (a.type === 'device') {\n return 1;\n }\n\n return -1;\n}\n\nasync function getOnlineEntities(): Promise<App.Connect.CloudEntity[]> {\n try {\n const result = await SrtApiService.getOnlineCloudEntities();\n return result.map(ConnectMapper.mapCloudEntity).sort(sortEntities);\n } catch {\n return [];\n }\n}\n\nasync function getEntitySource(id: string): Promise<App.Connect.EntitySource[]> {\n try {\n const sources = await SrtApiService.getEntitySources(id);\n return sources;\n } catch {\n return [];\n }\n}\n\nfunction getConnectionType(settings: App.Connect.StreamSettings): ConnectionType {\n if (isParticipantStreamSettings(settings)) {\n return settings.integration ? 'cloud' : 'custom';\n }\n\n return 'cloud';\n}\n","import React, {useState} from 'react';\nimport classNames from 'classnames';\nimport {observer} from 'mobx-react';\nimport {FormControl, MenuItem, Select, SelectChangeEvent, TextField} from '@mui/material';\nimport {ClassName, SelectOption} from 'app/types/common';\nimport {StreamSetting} from 'app/components/pages/MeetingDetails/StreamSettings/common/StreamSetting/StreamSetting';\nimport {useStrSettingsForm} from 'app/components/pages/MeetingDetails/StreamSettings/SrtSettingsFormContext';\nimport {SrtSettingsCallback} from 'app/components/pages/MeetingDetails/StreamSettings/types';\nimport {getValidNumber} from 'app/components/pages/MeetingDetails/StreamSettings/utils';\nimport {FormControl as Checkbox} from 'app/components/sharedReactComponents/FormControl';\nimport {FORM_CONTROL_TYPE} from 'app/components/sharedReactComponents/FormControl/constants';\nimport {SIZE} from 'app/constants';\nimport {isNil} from 'app/util/isNil';\n\nconst Sizes: Array<SelectOption<App.Connect.EncryptionSize>> = [\n {label: 'AES-128', value: 16},\n {label: 'AES-192', value: 24},\n {label: 'AES-256', value: 32},\n];\n\ninterface Props extends ClassName, SrtSettingsCallback {\n encryption: boolean;\n}\n\nconst StreamAdvancedSettingsComponent = ({className, encryption, onSync}: Props) => {\n const {settings, errors, setSettings} = useStrSettingsForm();\n\n const [pwd, setPwd] = useState(settings.key);\n const [size, setSize] = useState<App.Connect.EncryptionSize>(settings.size ? settings.size : 16);\n const [encrypted, setEncrypted] = useState(settings.size !== 0);\n\n const handleLatencyChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const latency = e.target.value.replace(/[^0-9]/g, '');\n const insert = getValidNumber(latency, 8000, settings.latency);\n setSettings({latency: insert});\n };\n\n const handleSizeChange = async (e: SelectChangeEvent<App.Connect.EncryptionSize>) => {\n const size = e.target.value as App.Connect.EncryptionSize;\n setSettings({size});\n setSize(size);\n await onSync();\n };\n\n const handleKeyChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const key = e.target.value;\n setSettings({key});\n setPwd(key);\n };\n\n const toggleEncryption = async () => {\n const newState = !encrypted;\n const newSize = newState ? size : 0;\n const newkey = newState ? pwd : '';\n\n setEncrypted(newState);\n setSettings({\n key: newkey,\n size: newSize,\n });\n await onSync();\n };\n\n return (\n <div className={classNames('stream-advanced-settings', className)}>\n <StreamSetting className=\"stream-advanced-settings__field\" label=\"Latency\">\n <TextField\n data-id=\"srt_latency\"\n className=\"stream-advanced-settings__latency\"\n fullWidth={false}\n placeholder=\"Milliseconds\"\n value={settings.latency ? settings.latency.toString() : ''}\n error={!isNil(errors?.Latency)}\n helperText={errors?.Latency}\n onChange={handleLatencyChange}\n onBlur={onSync}\n />\n </StreamSetting>\n\n {encryption && (\n <>\n <Checkbox\n dataId=\"srt_encryption\"\n className=\"stream-advanced-settings__field\"\n type={FORM_CONTROL_TYPE.CHECKBOX}\n value={encrypted}\n label=\"Encryption\"\n size={SIZE.S}\n onChange={toggleEncryption}\n />\n\n {encrypted && (\n <>\n <StreamSetting className=\"stream-advanced-settings__field\" label=\"Passphrase\">\n <TextField\n data-id=\"srt_encryption_key\"\n type=\"password\"\n placeholder=\"Passphrase\"\n fullWidth={true}\n error={!isNil(errors?.Passphrase)}\n helperText={errors?.Passphrase}\n value={settings.key}\n onChange={handleKeyChange}\n onBlur={onSync}\n />\n </StreamSetting>\n\n <StreamSetting className=\"stream-advanced-settings__field\" label=\"Key length\">\n <FormControl fullWidth={true}>\n <Select\n data-id=\"srt_encryption_len\"\n value={settings.size}\n onChange={handleSizeChange}\n >\n {Sizes.map((s) => (\n <MenuItem key={s.value} value={s.value}>\n {s.label}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n </StreamSetting>\n </>\n )}\n </>\n )}\n </div>\n );\n};\n\nexport const StreamAdvancedSettings = observer(StreamAdvancedSettingsComponent);\n","import React from 'react';\nimport classNames from 'classnames';\nimport {observer} from 'mobx-react';\nimport {ClassName, SelectOption} from 'app/types/common';\nimport {StreamSetting} from 'app/components/pages/MeetingDetails/StreamSettings/common/StreamSetting/StreamSetting';\nimport {useStrSettingsForm} from 'app/components/pages/MeetingDetails/StreamSettings/SrtSettingsFormContext';\nimport {SrtSettingsCallback} from 'app/components/pages/MeetingDetails/StreamSettings/types';\nimport {FormControl, MenuItem, Select, SelectChangeEvent} from '@mui/material';\n\nconst Formats: Array<SelectOption<App.Connect.AudioFormat>> = [\n {label: 'AAC 44.1 kHz', value: 'AAC_44100'},\n {label: 'AAC 48 kHz', value: 'AAC_48000'},\n];\n\nconst Channels: Array<SelectOption<App.Connect.AudioMode>> = [\n {label: 'Mono', value: 'mono'},\n {label: 'Stereo', value: 'stereo'},\n];\n\nconst Bitrates: Array<SelectOption<number>> = [\n {label: '64 kbps', value: 64},\n {label: '96 kbps', value: 96},\n {label: '112 kbps', value: 112},\n {label: '128 kbps', value: 128},\n {label: '160 kbps', value: 160},\n {label: '256 kbps', value: 256},\n {label: '320 kbps', value: 320},\n];\n\ninterface Props extends ClassName, SrtSettingsCallback {\n settings: App.Connect.ParticipantStreamSettings;\n}\n\nconst StreamAudioSettingsComponent = ({className, settings, onSync}: Props) => {\n const {setSettings} = useStrSettingsForm();\n\n const handleModeChange = async (e: SelectChangeEvent<App.Connect.AudioMode>) => {\n const mode = e.target.value as App.Connect.AudioMode;\n setSettings({\n audio: {\n ...settings.audio,\n mode,\n },\n });\n await onSync();\n };\n\n const handleFormatChange = async (e: SelectChangeEvent<App.Connect.AudioFormat>) => {\n const format = e.target.value as App.Connect.AudioFormat;\n setSettings({\n audio: {\n ...settings.audio,\n format,\n },\n });\n\n await onSync();\n };\n\n const handleBitrateChange = async (e: SelectChangeEvent<number>) => {\n const bitrate = e.target.value as number;\n\n setSettings({\n audio: {\n ...settings.audio,\n bitrate,\n },\n });\n\n await onSync();\n };\n\n return (\n <div className={classNames('stream-audio-settings', className)}>\n <StreamSetting className=\"\" label=\"Audio format\">\n <FormControl fullWidth={true}>\n <Select\n data-id=\"srt_audio_format\"\n value={settings.audio.format}\n onChange={handleFormatChange}\n >\n {Formats.map((f) => (\n <MenuItem key={f.value} value={f.value}>\n {f.label}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n </StreamSetting>\n\n <StreamSetting label=\"Audio channels\">\n <FormControl fullWidth={true}>\n <Select data-id=\"srt_audio_mode\" value={settings.audio.mode} onChange={handleModeChange}>\n {Channels.map((c) => (\n <MenuItem key={c.value} value={c.value}>\n {c.label}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n </StreamSetting>\n\n <StreamSetting label=\"Audio bitrate\">\n <FormControl fullWidth={true}>\n <Select\n data-id=\"srt_audio_bitrate\"\n value={settings.audio.bitrate}\n onChange={handleBitrateChange}\n >\n {Bitrates.map((c) => (\n <MenuItem key={c.value} value={c.value}>\n {c.label}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n </StreamSetting>\n </div>\n );\n};\n\nexport const StreamAudioSettings = observer(StreamAudioSettingsComponent);\n","import React from 'react';\nimport classNames from 'classnames';\nimport {Component} from 'app/types/common';\nimport {Icons} from 'app/util/icons';\nimport {SIZE} from 'app/constants';\n\ninterface Props extends Component {}\n\nexport const EncryptionMessage = ({className, dataId}: Props) => {\n return (\n <div data-id={dataId} className={classNames('encryption-message', className)}>\n <div className=\"encryption-message__title\">\n {Icons.lock().size(SIZE.S).reactComponent()}{' '}\n <span className=\"stream-settings__encryption-title\">Secure connection</span>\n </div>\n\n <div>This connection will be automatically encrypted using AES-128 key.</div>\n <a\n className=\"encryption-message__link\"\n href=\"https://www.epiphan.com/download/TE-Security-and-data-privacy-in-Epiphan-Connect_01.pdf\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n data-id=\"policy_link\"\n >\n Security and data privacy policy\n </a>\n </div>\n );\n};\n","import React, {useCallback, useEffect, useState} from 'react';\nimport classNames from 'classnames';\nimport {observer} from 'mobx-react';\nimport {StreamGeneralSettings} from 'app/components/pages/MeetingDetails/StreamSettings/StreamGeneralSettings/StreamGeneralSettings';\nimport {Callback, ClassName} from 'app/types/common';\nimport {CollapsiblePanel} from 'app/components/pages/MeetingDetails/StreamSettings/CollapsiblePanel/CollapsiblePanel';\nimport {StreamVideoSettings} from 'app/components/pages/MeetingDetails/StreamSettings/StreamVideoSettings/StreamVideoSettings';\nimport {StreamConnectionSettings} from 'app/components/pages/MeetingDetails/StreamSettings/StreamConnectionSettings/StreamConnectionSettings';\nimport {StreamAdvancedSettings} from 'app/components/pages/MeetingDetails/StreamSettings/StreamAdvancedSettings/StreamAdvancedSettings';\nimport {StreamAudioSettings} from 'app/components/pages/MeetingDetails/StreamSettings/StreamAudioSettings/StreamAudioSettings';\nimport {Meeting} from 'app/store/models/connect/Meeting/Meeting';\nimport {useSrtSettings} from 'app/components/pages/MeetingDetails/StreamSettings/SrtSettingsFormContext';\nimport {ConnectMapper} from 'app/util/mappers/ConnectMapper/ConnectMapper';\nimport {ErrorResponse, getErrorContents, isErrorResponse} from 'app/api/types';\nimport {THEME, VARIANT} from 'app/constants';\nimport {Button} from 'app/components/sharedReactComponents/Button';\nimport {SrtStream} from 'app/store/models/connect/SrtStream/SrtStream';\nimport {ProgressButton} from 'app/components/sharedReactComponents/ProgressButton';\nimport {LoadingPlaceholder} from 'app/components/sharedReactComponents/LoadingPlaceholder';\nimport {MeetingsApiService} from 'app/services/api/meetings/MeetingsApiService';\nimport {SrtApiService} from 'app/services/api/meetings/SrtApiService';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\nimport {Notifications} from 'app/components/Notifications';\nimport {IndeterminateProgressBar} from 'app/components/sharedReactComponents/IndeterminateProgressBar';\nimport {EncryptionMessage} from 'app/components/pages/MeetingDetails/StreamSettings/EncryptionMessage/EncryptionMessage';\nimport {useMounted} from 'app/hooks/useIsMounted';\nimport {SrtSettingsForm} from 'app/components/pages/MeetingDetails/StreamSettings/SrtSettingsForm';\nimport {isParticipantStreamSettings} from 'app/types/guards/connect';\n\ninterface Props extends ClassName {\n meeting: Meeting;\n participantId: string;\n name: string;\n state: App.Connect.ParticipantState;\n share: boolean;\n video: boolean;\n audio: boolean;\n type: App.Connect.MemberType;\n stream: SrtStream;\n onClose: Callback;\n}\n\nconst StreamSettingsComponent = ({\n className,\n meeting,\n participantId,\n name,\n type,\n state,\n audio,\n video,\n share,\n stream,\n onClose,\n}: Props) => {\n const {form, setForm} = useSrtSettings();\n const [init, setInit] = useState(true);\n const [validationMessage, setValidationMessage] = useState('');\n\n const isMounted = useMounted();\n\n const initParticipantSettings = useCallback(async () => {\n try {\n const contract = await MeetingsApiService.getParticipant(meeting.id, participantId);\n\n if (isMounted()) {\n if (contract.stream.settings) {\n await SrtApiService.setParticipantSettings(\n meeting.id,\n participantId,\n contract.stream.settings,\n );\n }\n\n const participant = ConnectMapper.mapParticipant(contract);\n meeting.setParticipant(participant);\n\n if (participant.stream.settings) {\n setForm(new SrtSettingsForm(participant.stream.settings));\n }\n }\n } catch {\n throw new Error('Participant init');\n }\n }, [isMounted, meeting.id, participantId, setForm]);\n\n const initFeedSettings = useCallback(async () => {\n try {\n const contract = await MeetingsApiService.getReturnFeed(meeting.id);\n\n if (isMounted()) {\n if (contract.stream.settings) {\n await SrtApiService.setFeedSettings(meeting.id, contract.stream.settings);\n }\n\n const feed = ConnectMapper.mapReturnFeed(contract);\n meeting.setReturnFeed(feed);\n\n if (feed.stream.settings) {\n setForm(new SrtSettingsForm(feed.stream.settings));\n }\n }\n } catch {\n Notifications.addErrorNotification('Could not initialized Return feed settings, try again');\n throw new Error('RF init');\n }\n }, [meeting.id, isMounted, setForm]);\n\n const initializeSettings = useCallback(async () => {\n try {\n setInit(true);\n\n if (type === 'return-feed') {\n await initFeedSettings();\n } else {\n await initParticipantSettings();\n }\n } catch {\n onClose();\n } finally {\n setInit(false);\n }\n }, [type, initFeedSettings, initParticipantSettings, onClose]);\n\n useEffect(() => {\n void initializeSettings();\n }, [initializeSettings]);\n\n const handleSync = useCallback(async () => {\n const {settings} = form;\n\n form.setSynchronization(true);\n\n setValidationMessage('');\n\n try {\n if (isParticipantStreamSettings(settings) && participantId) {\n await SrtApiService.setParticipantSettings(\n meeting.id,\n participantId,\n ConnectMapper.toParticipantSettingsContract(settings),\n );\n } else {\n await SrtApiService.setFeedSettings(\n meeting.id,\n ConnectMapper.toFeedSettingsContract(settings),\n );\n }\n\n stream.setSettings(settings);\n form.setError(undefined);\n form.setInvalid(false);\n } catch (e: unknown) {\n if (isErrorResponse(e)) {\n const result = getFieldErrors(e);\n\n form.setError(result);\n }\n form.setInvalid(true);\n } finally {\n form.setSynchronization(false);\n }\n }, [meeting.id, participantId, form]);\n\n const handleStart = async () => {\n try {\n if (participantId) {\n await SrtApiService.start(meeting.id, participantId);\n } else {\n await SrtApiService.startFeed(meeting.id);\n }\n onClose();\n } catch (e: unknown) {\n const reason = isErrorResponse(e) && getErrorContents(e);\n Notifications.addErrorNotification(`Could not start srt${reason ? ': '.concat(reason) : ''}`);\n }\n };\n\n if (!meeting.settings) {\n return null;\n }\n\n if (init) {\n return (\n <div className={classNames('stream-settings', className)} data-id=\"srt_settings_panel\">\n <div className=\"stream-settings__init\">\n <h4>Synchronizing settings</h4>\n <LoadingPlaceholder />\n </div>\n </div>\n );\n }\n\n const isCloudSrt = isParticipantStreamSettings(form.settings) && form.settings.integration;\n\n return (\n <div className={classNames('stream-settings', className)} data-id=\"srt_settings_panel\">\n <div className=\"stream-settings__body\">\n <StreamGeneralSettings\n className=\"stream-settings__general\"\n name={name}\n state={state}\n audio={audio}\n video={video}\n type={type}\n share={share}\n onSync={handleSync}\n />\n\n <CollapsiblePanel sx={{mb: 4}} title=\"Connection settings\" collapsible={false}>\n <StreamConnectionSettings\n dns={meeting.settings.dns}\n range={meeting.settings.portRange}\n onSync={handleSync}\n />\n </CollapsiblePanel>\n\n {isParticipantStreamSettings(form.settings) && (\n <CollapsiblePanel\n sx={{ml: 2, mb: 3}}\n dataId=\"srt_video_settings\"\n title=\"Video quality\"\n initState={true}\n >\n <StreamVideoSettings\n className=\"stream-settings__section\"\n settings={form.settings}\n onSync={handleSync}\n />\n </CollapsiblePanel>\n )}\n\n {isParticipantStreamSettings(form.settings) && (\n <CollapsiblePanel\n sx={{ml: 2, mb: 3}}\n dataId=\"srt_audio_settings\"\n title=\"Audio quality\"\n initState={true}\n >\n <StreamAudioSettings\n className=\"stream-settings__section\"\n settings={form.settings}\n onSync={handleSync}\n />\n </CollapsiblePanel>\n )}\n\n <CollapsiblePanel\n sx={{ml: 2, mb: 3}}\n dataId=\"srt_advanced_settings\"\n title={isCloudSrt ? 'Latency' : 'Advanced settings'}\n initState={true}\n >\n <StreamAdvancedSettings\n className=\"stream-settings__section\"\n encryption={!isCloudSrt}\n onSync={handleSync}\n />\n </CollapsiblePanel>\n {isCloudSrt && <EncryptionMessage className=\"stream-settings__encryption\" />}\n </div>\n\n <div className=\"stream-settings__footer\">\n {form.synchronization && <IndeterminateProgressBar className=\"stream-settings__progress\" />}\n\n <Tooltip content={validationMessage}>\n <span>\n <ProgressButton\n theme={THEME.PRIMARY}\n variant={VARIANT.SOLID}\n disabled={form.synchronization || form.invalid}\n dataId=\"start_srt\"\n onClick={handleStart}\n >\n Start\n </ProgressButton>\n </span>\n </Tooltip>\n\n <Button\n theme={THEME.SECONDARY}\n variant={VARIANT.OUTLINE}\n dataId=\"close_settings\"\n onClick={onClose}\n >\n Cancel\n </Button>\n </div>\n </div>\n );\n};\n\nexport const StreamSettings = observer(StreamSettingsComponent);\n\nexport function getFieldErrors(e: ErrorResponse): App.Connect.ValidationErrors | undefined {\n if (e.data.ErrorData) {\n return e.data.ErrorData as App.Connect.ValidationErrors;\n }\n}\n","import React from 'react';\nimport {Callback} from 'app/types/common';\nimport {ModalPrompt} from 'app/components/sharedReactComponents/Modal/ModalPrompt';\nimport {OverflowTooltip} from 'app/components/sharedReactComponents/OverflowTooltip/OverflowTooltip';\nimport {SIZE, THEME} from 'app/constants';\nimport {ModalTitleHighlightedItem} from 'app/components/sharedReactComponents/Modal/Modal';\n\ninterface Args {\n name: string;\n onDone?: Callback;\n onClose?: Callback;\n}\n\nexport const StopSrtPrompt = {\n show({\n name,\n onClose,\n onDone,\n }: Args) {\n ModalPrompt.show({\n className: 'stop-srt-prompt',\n fullWidth: true,\n maxWidth: SIZE.S,\n title: (\n <>\n Stop SRT stream for<br/>\n <ModalTitleHighlightedItem>\n <OverflowTooltip>{name}</OverflowTooltip>\n </ModalTitleHighlightedItem>?\n </>\n ),\n confirmButtonLabel: 'Yes, stop',\n confirmButtonTheme: THEME.SUCCESS,\n onClose,\n onDone,\n });\n }\n};\n","import React, {useState} from 'react';\nimport classNames from 'classnames';\nimport {\n AudioMuteButton,\n StreamSettingsButton,\n StreamStartButton,\n StreamStopButton,\n VideoMuteButton,\n} from 'app/components/pages/MeetingDetails/shared/StreamButtons/StreamButtons';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\nimport {Callback, ClassName} from 'app/types/common';\nimport {StopSrtPrompt} from 'app/components/MeetingsManager/modals/StopSrtPrompt/StopSrtPrompt';\nimport {isErrorResponse, getErrorContents} from 'app/api/types';\nimport {Notifications} from 'app/components/Notifications';\n\ninterface Props extends ClassName {\n name: string;\n audio: boolean;\n video: boolean;\n view: 'start' | 'stop';\n disabledMute: boolean;\n disabledStart: boolean;\n disabledStop: boolean;\n onStart: Callback;\n onStatus: Callback;\n onStop: Callback<Promise<void>>;\n onMute: Callback<Promise<void>, [App.Connect.StreamMute]>;\n}\n\nconst maxSrtMessage = (\n <span>\n You have reached the maximum number\n <br />\n of SRT connections. Remove at least one\n <br />\n to create a new SRT Connection.\n </span>\n);\n\nexport const ParticipantActions = ({\n className,\n name,\n view,\n audio,\n video,\n disabledMute,\n disabledStart,\n disabledStop,\n onMute,\n onStart,\n onStop,\n onStatus,\n}: Props) => {\n const tip = disabledStart ? maxSrtMessage : undefined;\n\n const [muting, setMuting] = useState({audio: false, video: false});\n\n const handleMuteAudio = async () => {\n try {\n setMuting((prev) => ({...prev, audio: true}));\n const mute: App.Connect.StreamMute = {video, audio: !audio};\n await onMute(mute);\n } catch (e: unknown) {\n const reason = isErrorResponse(e) && getErrorContents(e);\n Notifications.addErrorNotification(`Could not mute srt${reason ? ': '.concat(reason) : ''}`);\n } finally {\n setMuting((prev) => ({...prev, audio: false}));\n }\n };\n\n const handleMuteVideo = async () => {\n try {\n setMuting((prev) => ({...prev, video: true}));\n const mute: App.Connect.StreamMute = {video: !video, audio};\n await onMute(mute);\n } catch (e: unknown) {\n const reason = isErrorResponse(e) && getErrorContents(e);\n Notifications.addErrorNotification(`Could not mute srt${reason ? ': '.concat(reason) : ''}`);\n } finally {\n setMuting((prev) => ({...prev, video: false}));\n }\n };\n\n const handleStop = async () => {\n StopSrtPrompt.show({\n name,\n onDone: async () => {\n try {\n await onStop();\n } catch (e: unknown) {\n const reason = isErrorResponse(e) && getErrorContents(e);\n Notifications.addErrorNotification(\n `Could not stop srt${reason ? ': '.concat(reason) : ''}`,\n );\n }\n },\n });\n };\n\n return (\n <div className={classNames('participant-actions', className)}>\n {view === 'stop' ? (\n <>\n <VideoMuteButton\n className=\"participant-actions__item\"\n dataId=\"mute_video_stream_btn\"\n muted={video}\n disabled={disabledMute || muting.video}\n onAction={handleMuteVideo}\n />\n\n <AudioMuteButton\n className=\"participant-actions__item\"\n dataId=\"mute_audio_stream_btn\"\n disabled={disabledMute || muting.audio}\n muted={audio}\n onAction={handleMuteAudio}\n />\n\n <StreamSettingsButton\n className=\"participant-actions__item\"\n dataId=\"stream_settings_btn\"\n onAction={onStatus}\n />\n\n <StreamStopButton\n className=\"participant-actions__item\"\n dataId=\"stream_stop_btn\"\n onAction={handleStop}\n disabled={disabledStop}\n />\n </>\n ) : (\n <Tooltip content={tip}>\n <span>\n <StreamStartButton\n dataId=\"stream_start_btn\"\n disabled={disabledStart}\n onAction={onStart}\n />\n </span>\n </Tooltip>\n )}\n </div>\n );\n};\n","import React from 'react';\nimport {observer} from 'mobx-react';\nimport {Component} from 'app/types/common';\nimport {SIZE, THEME} from 'app/constants';\nimport {SrtStream} from 'app/store/models/connect/SrtStream/SrtStream';\nimport {Icons} from 'app/util/icons';\nimport classNames from 'classnames';\n\ninterface Props extends Component {\n stream: SrtStream;\n}\n\nexport const SrtConnectionState = observer(({className, dataId, stream}: Props) => {\n const {icon, theme} = useIndicator(stream);\n\n const {stopping, starting, started, connected, disconnected, failed, error} = stream;\n\n const renderStatus = () => {\n if (connected) {\n return <Status>Connected</Status>;\n }\n\n if (started || starting || stopping) {\n return <Status className=\"srt-connection-state__status--connecting\">Connecting</Status>;\n }\n\n if (disconnected) {\n return (\n <Status className=\"srt-connection-state__status--disconnected\">Connection lost</Status>\n );\n }\n\n if (failed) {\n const message = error?.message;\n\n return (\n <Status className=\"srt-connection-state__status--error\">\n Connection failed\n {message && (\n <div className=\"srt-connection-state__message\" data-id=\"srt-error-message\">\n {error?.message}\n </div>\n )}\n </Status>\n );\n }\n\n return null;\n };\n\n return (\n <div data-id={dataId} className={classNames('srt-connection-state', className)}>\n <div className=\"srt-connection-state__indicator\">\n <Divider theme={theme} />\n\n <div data-id=\"status_icon\">\n {icon.size(SIZE.M).class('srt-connection-state__icon').theme(theme).reactComponent()}\n </div>\n\n <Divider theme={theme} />\n </div>\n\n {renderStatus()}\n </div>\n );\n});\n\ninterface DividerProps {\n theme: THEME;\n}\n\nfunction Divider({theme}: DividerProps) {\n return (\n <div className={`srt-connection-state__divider srt-connection-state__divider--${theme}`} />\n );\n}\n\nfunction Status({\n className,\n children,\n dataId = 'srt-status-text',\n}: React.PropsWithChildren<Component>) {\n return (\n <div className={classNames('srt-connection-state__status', className)} data-id={dataId}>\n {children}\n </div>\n );\n}\n\nfunction useIndicator(stream: SrtStream) {\n const {started, starting, stopping, disconnected, failed} = stream;\n if (started || starting || stopping || disconnected) {\n return {\n theme: THEME.SUCCESS,\n icon: Icons.spinner(),\n };\n }\n\n if (failed) {\n return {\n theme: THEME.DANGER,\n icon: Icons.warning(),\n };\n }\n\n return {\n theme: THEME.PRIMARY,\n icon: Icons.checkCircle(),\n };\n}\n","/* eslint-disable react/jsx-no-target-blank */\nimport React from 'react';\nimport {observer} from 'mobx-react';\nimport classNames from 'classnames';\nimport {CopyText} from 'app/components/pages/MeetingDetails/shared/CopyText/CopyText';\nimport {router} from 'app/router/main';\nimport {SrtStream} from 'app/store/models/connect/SrtStream/SrtStream';\nimport {Component} from 'app/types/common';\nimport {isParticipantStreamSettings} from 'app/types/guards/connect';\n\ninterface Props extends Component {\n stream: SrtStream;\n direction: 'to' | 'from';\n domain?: string;\n}\n\nexport const SrtConnectionPoint = observer(\n ({className, dataId, stream, direction, domain = ''}: Props) => {\n if (!stream.settings) {\n return null;\n }\n\n const {settings, listener, connected} = stream;\n\n const renderFrom = () => {\n if (isParticipantStreamSettings(settings) && settings.integration) {\n return <Title>Epiphan Connect;\n }\n\n if (listener) {\n return ;\n }\n\n if (connected) {\n return SRT caller;\n }\n\n return ;\n };\n\n const renderTo = () => {\n if (isParticipantStreamSettings(settings) && settings.integration) {\n return (\n \n {settings.cloud.deviceName}\n \n );\n }\n\n if (listener) {\n if (connected) {\n return ;\n }\n\n return Waiting for SRT caller;\n }\n\n if (connected) {\n return ;\n }\n\n return Waiting for SRT listener;\n };\n\n return (\n
    \n {direction === 'from' ? renderFrom() : renderTo()}\n
    \n );\n },\n);\n\ninterface UrlProps extends Component {\n url: string;\n title: string;\n port: number;\n}\n\nfunction Url({className, url, title, port}: UrlProps) {\n return (\n
    \n
    \n {title}\n \n
    \n\n {port > 0 && (\n
    \n Port\n \n
    \n )}\n
    \n );\n}\n\nfunction Title({children}: React.PropsWithChildren<{}>) {\n return
    {children}
    ;\n}\n","import React from 'react';\nimport classNames from 'classnames';\nimport {observer} from 'mobx-react';\nimport {ClassName} from 'app/types/common';\nimport {SrtStream} from 'app/store/models/connect/SrtStream/SrtStream';\nimport {SrtConnectionState} from 'app/components/pages/MeetingDetails/StreamConnectionStatus/SrtConnectionState/SrtConnectionState';\nimport {SrtConnectionPoint} from 'app/components/pages/MeetingDetails/StreamConnectionStatus/SrtConnectionPoint/SrtConnectionPoint';\n\ninterface Props extends ClassName {\n stream: SrtStream;\n domain?: string;\n}\n\nconst StreamConnectionStatusComponent = ({className, stream, domain = ''}: Props) => {\n const {stopped, settings} = stream;\n\n if (stopped) {\n return null;\n }\n\n if (!settings) {\n return null;\n }\n\n return (\n
    \n \n\n \n\n \n
    \n );\n};\n\nexport const StreamConnectionStatus = observer(StreamConnectionStatusComponent);\n","import React, {useState} from 'react';\nimport {observer} from 'mobx-react';\nimport classNames from 'classnames';\nimport {Callback, ClassName} from 'app/types/common';\nimport {\n AudioMuteButton,\n StreamStopButton,\n VideoMuteButton,\n} from 'app/components/pages/MeetingDetails/shared/StreamButtons/StreamButtons';\nimport {} from 'app/services/api/meetings/SrtApiService';\nimport {getErrorContents, isErrorResponse} from 'app/api/types';\nimport {Notifications} from 'app/components/Notifications';\nimport {Dialog} from '@mui/material';\nimport {\n ModalContainer,\n ModalFooter,\n ModalTitle,\n ModalTitleHighlightedItem,\n} from 'app/components/sharedReactComponents/Modal/Modal';\nimport {OverflowTooltip} from 'app/components/sharedReactComponents/OverflowTooltip/OverflowTooltip';\nimport {THEME, VARIANT} from 'app/constants';\nimport {ProgressButton} from 'app/components/sharedReactComponents/ProgressButton';\nimport {Button} from 'app/components/sharedReactComponents/Button';\n\ninterface Props extends ClassName {\n name: string;\n audio: boolean;\n video: boolean;\n disabledMute: boolean;\n disabledStop: boolean;\n onMute: Callback, [App.Connect.StreamMute]>;\n onStop: Callback>;\n}\n\ninterface DialogProps {\n open: boolean;\n name: string;\n onStop: Callback>;\n onClose: Callback;\n}\n\nfunction StopSrtDialog({open, name, onStop, onClose}: DialogProps) {\n const [applying, setApplying] = useState(false);\n\n const handleStop = async () => {\n setApplying(true);\n\n try {\n await onStop();\n onClose();\n } finally {\n setApplying(false);\n }\n };\n\n return (\n \n \n \n Stop SRT stream for\n
    \n \n {name}\n \n ?\n
    \n\n \n \n Yes, stop\n \n\n \n Cancel\n \n \n
    \n
    \n );\n}\n\nexport const StreamStatusActions = observer(\n ({className, audio, video, name, disabledMute, disabledStop, onStop, onMute}: Props) => {\n const [muting, setMuting] = useState({audio: false, video: false});\n const [open, setOpen] = useState(false);\n\n const handleMuteAudio = async () => {\n try {\n setMuting((prev) => ({...prev, audio: true}));\n const mute: App.Connect.StreamMute = {video, audio: !audio};\n await onMute(mute);\n } catch (e: unknown) {\n const reason = isErrorResponse(e) && getErrorContents(e);\n Notifications.addErrorNotification(\n `Could not mute srt${reason ? ': '.concat(reason) : ''}`,\n );\n } finally {\n setMuting((prev) => ({...prev, audio: false}));\n }\n };\n\n const handleMuteVideo = async () => {\n try {\n setMuting((prev) => ({...prev, video: true}));\n const mute: App.Connect.StreamMute = {video: !video, audio};\n await onMute(mute);\n } catch (e: unknown) {\n const reason = isErrorResponse(e) && getErrorContents(e);\n Notifications.addErrorNotification(\n `Could not mute srt${reason ? ': '.concat(reason) : ''}`,\n );\n } finally {\n setMuting((prev) => ({...prev, video: false}));\n }\n };\n\n const handleOpenDialog = () => setOpen(true);\n const handleCloseDialog = () => setOpen(false);\n\n return (\n
    \n \n\n \n\n \n\n \n
    \n );\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport {observer} from 'mobx-react';\nimport {Callback, ClassName} from 'app/types/common';\nimport {StreamConnectionStatus} from 'app/components/pages/MeetingDetails/StreamConnectionStatus/StreamConnectionStatus';\nimport {OverflowTooltip} from 'app/components/sharedReactComponents/OverflowTooltip/OverflowTooltip';\nimport {ParticipantInput} from 'app/components/pages/MeetingDetails/shared/ParticipantInput/ParticipantInput';\nimport {ParticipantAvatar} from 'app/components/pages/MeetingDetails/shared/ParticipantAvatar/ParticipantAvatar';\nimport {SrtStream} from 'app/store/models/connect/SrtStream/SrtStream';\nimport {StreamStatusActions} from 'app/components/pages/MeetingDetails/StreamStatus/StreamStatusActions/StreamStatusActions';\nimport {Box, Stack} from '@mui/material';\nimport {DisconnectedLabel} from 'app/components/pages/MeetingDetails/shared/DisconnectedLabel/DisconnectedLabel';\n\ninterface Props extends ClassName {\n callerUrl: string;\n name: string;\n type: App.Connect.MemberType;\n stream: SrtStream;\n share: boolean;\n video: boolean;\n audio: boolean;\n disconnected: boolean;\n onMute: Callback, [App.Connect.StreamMute]>;\n onStop: Callback>;\n}\n\nexport const StreamStatusHeader = observer(\n ({\n className,\n callerUrl,\n stream,\n type,\n audio,\n video,\n name,\n share,\n disconnected,\n onMute,\n onStop,\n }: Props) => {\n const isShare = type === 'vbss';\n\n return (\n
    \n \n\n
    \n \n \n \n {name}\n \n\n {!isShare && (\n \n )}\n \n\n {disconnected && }\n \n\n \n\n \n
    \n
    \n );\n },\n);\n","import React, {PropsWithChildren} from 'react';\nimport classNames from 'classnames';\nimport {Icons} from 'app/util/icons';\nimport {THEME} from 'app/constants';\nimport {ClassName} from 'app/types/common';\n\ninterface Props extends PropsWithChildren {\n warning: boolean;\n title: string;\n}\n\nexport const StreamStatusContainer = ({className, title, warning, children}: Props) => {\n return (\n
    \n
    \n {title}\n {warning && Icons.warning().theme(THEME.DANGER).reactComponent()}\n
    \n {children}\n
    \n );\n};\n","import React from 'react';\nimport {PROPS_LIST_THEME, PropsList} from 'app/components/sharedReactComponents/PropsList';\nimport {Icons} from 'app/util/icons';\nimport {THEME} from 'app/constants';\nimport {StreamStatusContainer} from 'app/components/pages/MeetingDetails/StreamStatus/StreamStatusDetails/StreamStatusContainer/StreamStatusContainer';\n\ninterface Props {\n params: App.Connect.StreamingParams;\n joined: boolean;\n}\n\ninterface CellProps {\n cellData: number | string;\n}\n\nconst latencyRenderer = ({cellData}: CellProps) => (\n {cellData} ms\n);\nconst packetsLostRenderer = ({cellData}: CellProps) => (\n {cellData} %\n);\n\nexport const StreamingParameters = ({params, joined}: Props) => {\n const renderLabel = (label: string) => (\n {Icons.srt().theme(THEME.SECONDARY).label(label).reactComponent()}\n );\n\n const {latency, packetsLost} = params;\n\n return (\n \n \n \n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport {StreamStatusRow} from 'app/components/pages/MeetingDetails/StreamStatus/StreamStatusDetails/types';\nimport {Icons} from 'app/util/icons';\nimport {THEME} from 'app/constants';\nimport {StreamStatusContainer} from 'app/components/pages/MeetingDetails/StreamStatus/StreamStatusDetails/StreamStatusContainer/StreamStatusContainer';\n\ninterface ItemProps {\n row: StreamStatusRow;\n running: boolean;\n joined: boolean;\n receiving: string | number;\n sending: string | number;\n noWarning?: boolean;\n}\n\nconst Item = ({row, receiving, sending, running, joined, noWarning}: ItemProps) => {\n const sendingValue = row.cellRenderer ? row.cellRenderer({cellData: sending}) : sending;\n\n const getValue = (): React.ReactNode => {\n if (!running) {\n return Icons.spinner().theme(THEME.SUCCESS).reactComponent();\n }\n\n if (!joined) {\n return '--—';\n }\n\n if (row.cellRenderer) {\n return row.cellRenderer({cellData: receiving});\n }\n\n return receiving;\n };\n\n const receivingValue = getValue();\n\n const equalData = noWarning ? true : receiving === sending;\n const hasError = !equalData || !joined;\n\n return (\n \n
    {row.label}
    \n
    \n {receivingValue}\n
    \n
    \n {sendingValue}\n
    \n \n );\n};\n\ninterface Props {\n platform: App.Connect.Platform;\n title: string;\n rows: StreamStatusRow[];\n from: string;\n to: string;\n receiving: App.Connect.Quality;\n sending: App.Connect.Quality;\n running: boolean;\n joined: boolean;\n}\n\nexport const StreamStatusTable = ({\n platform,\n title,\n rows,\n receiving,\n sending,\n joined,\n running,\n from,\n to,\n}: Props) => {\n return (\n \n
    \n
    \n
    \n  \n
    \n\n
    \n Receiving from\n
    \n \n {from}\n \n
    \n\n
    \n Sending to\n
    \n \n {to}\n \n
    \n
    \n\n
      \n {rows.map((row) => (\n \n ))}\n
    \n
    \n
    \n );\n};\n","import React from 'react';\nimport {\n StreamStatusSource,\n StreamStatusRow,\n} from 'app/components/pages/MeetingDetails/StreamStatus/StreamStatusDetails/types';\nimport {StreamingParameters} from 'app/components/pages/MeetingDetails/StreamStatus/StreamStatusDetails/StreamingParameters/StreamingParameters';\nimport {StreamStatusTable} from 'app/components/pages/MeetingDetails/StreamStatus/StreamStatusDetails/StreamStatusTable/StreamStatusTable';\n\nconst videoRows: StreamStatusRow[] = [\n {\n dataKey: 'format',\n label: 'Format',\n },\n {\n dataKey: 'size',\n label: 'Frame size',\n cellRenderer: ({cellData}) => {\n if (cellData === 'HDTV_720') {\n return '1280x720';\n }\n\n if (cellData === 'HDTV_1080') {\n return '1920x1080';\n }\n\n return cellData;\n },\n },\n {\n dataKey: 'framerate',\n label: 'Frame rate',\n cellRenderer: ({cellData}) => `${cellData} fps`,\n },\n {\n dataKey: 'bitrate',\n label: 'Video bitrate',\n cellRenderer: ({cellData}) => {\n if (cellData) {\n return `${cellData} kbit/s`;\n }\n\n return '---';\n },\n },\n];\n\nconst audioRows: StreamStatusRow[] = [\n {\n dataKey: 'format',\n label: 'Coding format',\n cellRenderer: ({cellData}) => {\n if (cellData === 'AAC_44100') {\n return 'AAC 44.1 kHz';\n }\n\n if (cellData === 'AAC_48000') {\n return 'AAC 48 kHz';\n }\n\n return cellData;\n },\n },\n {\n dataKey: 'mode',\n label: 'Type',\n },\n];\n\ninterface Props {\n source: StreamStatusSource;\n platform: App.Connect.Platform;\n running: boolean;\n joined: boolean;\n streamStatus: App.Connect.StreamingStatus;\n}\n\ninterface Labels {\n from: string;\n to: string;\n}\n\nconst getLabels = (source: StreamStatusSource, platform: App.Connect.Platform): Labels => {\n if (source === 'participant') {\n return {\n from: platform === 'teams' ? 'Microsoft Teams' : 'Zoom',\n to: 'SRT Stream',\n };\n }\n\n return {\n from: 'SRT Stream',\n to: platform === 'teams' ? 'Microsoft Teams' : 'Zoom',\n };\n};\n\nexport const StreamStatusDetails = ({streamStatus, joined, running, source, platform}: Props) => {\n const {from, to} = getLabels(source, platform);\n\n return (\n
    \n \n\n \n\n \n
    \n );\n};\n","import React from 'react';\nimport {observer} from 'mobx-react';\nimport {StreamStatusHeader} from 'app/components/pages/MeetingDetails/StreamStatus/StreamStatusHeader/StreamStatusHeader';\nimport {useStreamStatus} from 'app/components/pages/MeetingDetails/StreamStatus/useStreamStatus';\nimport {LoadingPlaceholder} from 'app/components/sharedReactComponents/LoadingPlaceholder';\nimport {Meeting} from 'app/store/models/connect/Meeting/Meeting';\nimport {StreamStatusDetails} from 'app/components/pages/MeetingDetails/StreamStatus/StreamStatusDetails/StreamStatusDetails';\nimport {SrtStream} from 'app/store/models/connect/SrtStream/SrtStream';\nimport {Callback} from 'app/types/common';\nimport {isNil} from 'app/util/isNil';\nimport {Stack} from '@mui/material';\nimport {Icons} from 'app/util/icons';\nimport {SIZE} from 'app/constants';\nimport {palette} from 'app/themes/app';\n\ninterface Props {\n meeting: Meeting;\n participantId: string;\n name: string;\n state: App.Connect.ParticipantState;\n type: App.Connect.MemberType;\n share: boolean;\n video: boolean;\n audio: boolean;\n stream: SrtStream;\n onMute: Callback, [App.Connect.StreamMute]>;\n onStop: Callback>;\n}\n\nexport const StreamStatus = observer(\n ({\n meeting,\n name,\n participantId,\n state,\n stream,\n type,\n audio,\n share,\n video,\n onMute,\n onStop,\n }: Props) => {\n const {loading, status} = useStreamStatus({\n meetingId: meeting.id,\n participantId,\n disabled: !stream.running,\n });\n\n const renderDetails = () => {\n if (isNil(status)) {\n return null;\n }\n\n if (loading) {\n return ;\n }\n\n return (\n \n );\n };\n\n const showConfigMessage = !isNil(status) && !loading;\n\n return (\n
    \n \n\n {renderDetails()}\n\n {showConfigMessage && (\n \n {Icons.info().size(SIZE.S).reactComponent()}\n To change audio and video settings, you'll need to stop the SRT connection\n \n )}\n
    \n );\n },\n);\n","import {useQuery} from '@tanstack/react-query';\nimport {ConnectMapper} from 'app/util/mappers/ConnectMapper/ConnectMapper';\nimport {SrtApiService} from 'app/services/api/meetings/SrtApiService';\nimport {secondsToMilliseconds} from 'app/util/timeConverter';\n\ninterface Return {\n loading: boolean;\n status?: App.Connect.StreamingStatus;\n}\n\ninterface Props {\n meetingId: string;\n participantId: string;\n disabled: boolean;\n}\n\ntype Args = {\n meetingId: string;\n participantId: string;\n};\n\nexport function useStreamStatus({meetingId, participantId, disabled}: Props): Return {\n const {isLoading, data} = useQuery<\n Contracts.Connect.StreamingStatus,\n Error,\n App.Connect.StreamingStatus,\n [string, Args]\n >(\n ['status', {meetingId, participantId}],\n ({queryKey}) => {\n const [, {meetingId, participantId}] = queryKey;\n\n if (participantId) {\n return SrtApiService.getParticipantStreamStatus(meetingId, participantId);\n }\n\n return SrtApiService.getReturnFeedStreamStatus(meetingId);\n },\n {\n select: ConnectMapper.mapStreamingStatus,\n refetchInterval: secondsToMilliseconds(10),\n enabled: !disabled,\n },\n );\n\n return {\n loading: isLoading,\n status: data,\n };\n}\n","/* eslint-disable complexity */\nimport React, {useEffect, useState} from 'react';\nimport classNames from 'classnames';\nimport {observer} from 'mobx-react';\nimport {ClassName} from 'app/types/common';\nimport {ParticipantAvatar} from 'app/components/pages/MeetingDetails/shared/ParticipantAvatar/ParticipantAvatar';\nimport {ParticipantStream} from 'app/components/pages/MeetingDetails/ParticipantCard/ParticipantStream/ParticipantStream';\nimport {OverflowTooltip} from 'app/components/sharedReactComponents/OverflowTooltip/OverflowTooltip';\nimport {ParticipantInput} from 'app/components/pages/MeetingDetails/shared/ParticipantInput/ParticipantInput';\nimport {ParticipantMessage} from 'app/components/pages/MeetingDetails/shared/ParticipantMessage/ParticipantMessage';\nimport {DisconnectedLabel} from 'app/components/pages/MeetingDetails/shared/DisconnectedLabel/DisconnectedLabel';\nimport {SrtSettingsFormProvider} from 'app/components/pages/MeetingDetails/StreamSettings/SrtSettingsFormContext';\nimport {Meeting} from 'app/store/models/connect/Meeting/Meeting';\nimport {Tooltip} from 'app/components/sharedReactComponents/Tooltip';\nimport {Icons} from 'app/util/icons';\nimport {SIZE} from 'app/constants';\nimport {NoAudioLabel} from 'app/components/pages/MeetingDetails/shared/IsolatedAudioLabel/NoAudioLabel';\nimport {SrtStream} from 'app/store/models/connect/SrtStream/SrtStream';\nimport {Drawer} from '@mui/material';\nimport {useToggle} from 'app/hooks/useToggle';\nimport {StreamSettings} from 'app/components/pages/MeetingDetails/StreamSettings/StreamSettings';\nimport {ParticipantActions} from 'app/components/pages/MeetingDetails/shared/ParticipantActions/ParticipantActions';\nimport {SrtApiService} from 'app/services/api/meetings/SrtApiService';\nimport {StreamStatus} from 'app/components/pages/MeetingDetails/StreamStatus/StreamStatus';\n\ninterface Props extends ClassName {\n meeting: Meeting;\n id: string;\n name: string;\n state: App.Connect.ParticipantState;\n type: App.Connect.MemberType;\n individualAudio: boolean;\n stream: SrtStream;\n share: boolean;\n video: boolean;\n audio: boolean;\n canStart: boolean;\n}\n\ntype View = 'settings' | 'status';\n\nconst ParticipantCardComponent = ({\n className,\n id,\n meeting,\n stream,\n name,\n type,\n state,\n share,\n video,\n audio,\n individualAudio,\n canStart,\n}: Props) => {\n const [aside, toggleAside] = useToggle(false);\n const [view, setView] = useState(stream.active ? 'status' : 'settings');\n\n const isParticipant = type === 'participant';\n const isSpeaker = type === 'primary-speaker';\n const isShare = type === 'vbss';\n const isFeed = type === 'return-feed';\n\n const {stopped, starting, started, connected, disconnected, stopping, active, failed, mute} =\n stream;\n\n const audioUnavailable = meeting.isolatedAudio && !individualAudio;\n const showInputIcons = isParticipant || (isSpeaker && active);\n const isLeftWithStream = isParticipant && state === 'left-with-stream';\n const showNoAudio = !isFeed && audioUnavailable && stopped;\n const showMessage = (isFeed || isShare || isSpeaker) && stopped;\n const showState = showInputIcons || isLeftWithStream || showNoAudio || showMessage;\n const connecting = starting || stopping || started || failed || disconnected;\n const audioTip = audioUnavailable ? '' : '';\n\n useEffect(() => {\n if (stream.active) {\n setView('status');\n } else {\n setView('settings');\n }\n }, [stream.active]);\n\n const handleMute = async (mute: App.Connect.StreamMute) => {\n if (id) {\n return SrtApiService.mute(meeting.id, id, mute);\n }\n\n return SrtApiService.muteFeed(meeting.id, mute);\n };\n\n const handleStop = async () => {\n if (id) {\n await SrtApiService.stop(meeting.id, id);\n } else {\n await SrtApiService.stopFeed(meeting.id);\n }\n\n if (aside) {\n toggleAside();\n }\n };\n\n return (\n \n \n\n
    \n
    \n {name}\n\n {isSpeaker && (\n \n {Icons.info().size(SIZE.S).class('participant-card__speaker-tip').reactComponent()}\n \n )}\n
    \n\n {showState && (\n
    \n {showMessage && (\n \n )}\n\n {showInputIcons && (\n \n )}\n\n {isLeftWithStream && (\n \n )}\n\n {showNoAudio && (\n \n )}\n
    \n )}\n
    \n\n {active && }\n\n \n\n \n {view === 'settings' ? (\n \n \n \n ) : (\n \n )}\n \n
    \n );\n};\n\nexport const ParticipantCard = observer(ParticipantCardComponent);\n","import {UserTeamStore} from 'app/util/UserTeamStore';\n\nconst STORE_KEY = 'FleetManagerPage.Filters.Active';\n\ninterface FilterStoreManagerProps {\n teamId: string;\n userId: string;\n storeKey: string;\n}\n\nexport class FilterStoreManager {\n private readonly store: UserTeamStore;\n\n constructor({\n teamId,\n userId,\n storeKey = STORE_KEY,\n }: FilterStoreManagerProps) {\n this.store = new UserTeamStore({\n defaultValue: [],\n storeKey,\n teamId,\n userId,\n });\n }\n\n loadActiveFiltersSet(): Set {\n return new Set(this.store.load());\n }\n\n saveActiveFiltersSet(activeFilterSwitches: Set) {\n this.store.save(Array.from(activeFilterSwitches));\n }\n}\n","import {useCallback, useEffect, useRef, useState} from 'react';\nimport {FilterSwitch} from 'app/components/sharedReactComponents/FilterSelector/types';\nimport {toggleInSet} from 'app/util/toggleInSet';\nimport {Callback} from 'app/types/common';\nimport {FilterStoreManager} from 'app/components/FleetManager/FilterStoreManager';\n\ninterface Storage {\n key: string;\n userId: string;\n teamId: string;\n}\n\ninterface Args {\n options: T[];\n storage?: Storage;\n}\n\ninterface Return {\n filters: Set;\n active: T[];\n options: T[];\n clear: Callback;\n toggle: Callback;\n}\n\nexport function useFilterFeature({\n options,\n storage,\n}: Args): Return {\n const [filters, setFilters] = useState(new Set());\n const [active, setActive] = useState([]);\n\n const store = useRef();\n\n useEffect(() => {\n if (storage?.key && storage.teamId && storage.userId) {\n store.current = new FilterStoreManager({\n storeKey: storage.key,\n teamId: storage.teamId,\n userId: storage.userId,\n });\n\n const persisted = store.current.loadActiveFiltersSet();\n setFilters(persisted);\n return;\n }\n\n store.current = undefined;\n }, [storage?.key, storage?.teamId, storage?.userId]);\n\n const toggle = useCallback(\n (id: string) => {\n setFilters(\n prev => {\n const next = new Set(prev);\n return toggleInSet(next, id);\n });\n },\n [],\n );\n\n useEffect(() => {\n setActive(getActiveFilters(options, filters));\n }, [filters, options]);\n\n useEffect(() => {\n if (store.current) {\n store.current.saveActiveFiltersSet(filters);\n }\n }, [filters]);\n\n const clear = useCallback(() => setFilters(new Set()), []);\n\n return {\n active,\n filters,\n options,\n clear,\n toggle,\n };\n}\n\nfunction getActiveFilters(\n options: T[],\n filters: Set,\n) {\n return options.filter(option => filters.has(option.id));\n}\n","/**\n * Add or remove item from Set\n *\n * ```typescript\n * toggleInSet(new Set([1, 2, 3]), 2)\n * //=> Set(2) {1, 3}\n *\n * toggleInSet(new Set([1, 2, 3]), 4)\n * //=> Set(4) {1, 2, 3, 4}\n * ```\n */\nfunction toggleInSet(set: Set, value: any): Set {\n const result = new Set(set);\n\n if (result.has(value)) {\n result.delete(value);\n } else {\n result.add(value);\n }\n\n return result;\n}\n\nexport {\n toggleInSet,\n};\n","import React, {useCallback} from 'react';\nimport {Box} from '@mui/material';\nimport classNames from 'classnames';\nimport {Button} from 'app/components/sharedReactComponents/Button';\nimport {SIZE, THEME, VARIANT} from 'app/constants';\nimport {Icons} from 'app/util/icons';\nimport {OverflowTooltip} from 'app/components/sharedReactComponents/OverflowTooltip/OverflowTooltip';\nimport {Callback, ClassName, Sx} from 'app/types/common';\nimport {FilterSwitch} from 'app/components/sharedReactComponents/FilterSelector/types';\n\ninterface ItemProps {\n id: string;\n label: React.ReactNode;\n onDelete: Callback;\n}\n\nconst Item: React.FC = ({id, label, onDelete}) => {\n const handleClickDelete = useCallback(() => {\n onDelete(id);\n }, [id, onDelete]);\n\n return (\n
    \n \n {label}\n \n\n \n {Icons.remove().size(SIZE.S).reactComponent()}\n \n
    \n );\n};\n\ninterface ListProps {\n filterSwitches: FilterSwitch[];\n onDelete: Callback;\n}\n\nconst List: React.FC = ({filterSwitches, onDelete}) => {\n return (\n
    \n {filterSwitches.map((filterSwitch) => (\n \n ))}\n
    \n );\n};\n\ninterface Props extends ClassName, Sx {\n filterSwitches: FilterSwitch[];\n activeFilterSwitches: Set;\n onClickFilterSwitcher: Callback;\n onClickClearAll: Callback;\n}\nexport const ActiveFilters = ({\n sx,\n className,\n filterSwitches,\n activeFilterSwitches,\n onClickFilterSwitcher,\n onClickClearAll,\n}: Props) => {\n const enabledFilterSwitches = filterSwitches.filter(({id}) => activeFilterSwitches.has(id));\n\n if (enabledFilterSwitches.length === 0) {\n return null;\n }\n\n return (\n \n
    Filtering by:
    \n\n \n\n \n Clear all\n \n
    \n );\n};\n","import React from 'react';\nimport {Component} from 'app/types/common';\nimport classNames from 'classnames';\nimport {router} from 'app/router/main';\n\ninterface Props extends Component {\n platform: App.Connect.Platform;\n owner?: App.Connect.ReturnFeedOwner;\n}\n\nexport const ReturnFeedMessage = ({className, dataId, owner, platform}: Props) => {\n const renderOwner = (owner: App.Connect.ReturnFeedOwner) => {\n const {id, internal, name} = owner;\n if (internal) {\n return (\n <>\n meeting {name}\n \n );\n }\n return 'a different Epiphan Cloud team';\n };\n\n const renderContent = () => {\n if (platform === 'zoom') {\n return 'Coming soon';\n }\n\n if (owner) {\n return (\n <>\n The return feed is currently active in {renderOwner(owner)}. Only one active return feed\n is possible per meeting.\n \n );\n }\n\n return 'Return feed is not available. Please reconnect the current meeting or connect a new one to enable this feature.';\n };\n\n return (\n
    \n {renderContent()}\n
    \n );\n};\n","import React from 'react';\nimport {observer} from 'mobx-react';\nimport {Box, Stack, Typography} from '@mui/material';\nimport {ChangeEvent, ClassName} from 'app/types/common';\nimport {useParticipants} from 'app/components/pages/MeetingDetails/ParticipantsList/useParticipants';\nimport {ParticipantCard} from 'app/components/pages/MeetingDetails/ParticipantCard/ParticipantCard';\nimport {Meeting} from 'app/store/models/connect/Meeting/Meeting';\nimport {DropdownSelect} from 'app/components/sharedReactComponents/DropdownSelect';\nimport {SIZE} from 'app/constants';\nimport {DROPDOWN_SELECT_THEME} from 'app/components/sharedReactComponents/DropdownSelect/constants';\nimport {Tooltip, TOOLTIP_PLACEMENT} from 'app/components/sharedReactComponents/Tooltip';\nimport {noop} from 'app/util/noop';\nimport {FilterSelector} from 'app/components/sharedReactComponents/FilterSelector';\nimport {\n FilterSwitch,\n FilterSwitchGroup,\n} from 'app/components/sharedReactComponents/FilterSelector/types';\nimport {useFilterFeature} from 'app/hooks/useFilterFeature';\nimport {Participant} from 'app/store/models/connect/Participant/Participant';\nimport {ActiveFilters} from 'app/components/FleetManager/SubHeader/ActiveFilters';\nimport {EmptyFilterMessage} from 'app/components/sharedReactComponents/EmptyFilterMessage/EmptyFilterMessage';\nimport {Icons} from 'app/util/icons';\nimport {useStorageValue} from 'app/components/pages/MeetingDetails/ParticipantsList/useStorageValue';\nimport {ReturnFeedMessage} from 'app/components/pages/MeetingDetails/ReturnFeedOwner/ReturnFeedOwner';\nimport {ReturnFeed} from 'app/store/models/connect/ReturnFeed/ReturnFeed';\nimport {palette} from 'app/themes/app';\nimport {isNil} from 'app/util/isNil';\n\nexport type ParticipantSort = 'name' | 'status';\n\nconst groups: FilterSwitchGroup[] = [\n {\n id: 'extractions',\n label: 'Extraction',\n },\n];\n\nconst emptySet = new Set();\n\nconst options: FilterSwitch[] = [\n {\n id: 'active',\n label: 'Only active',\n disabled: false,\n group: 'extractions',\n isVisible: () => true,\n callback: (p: Participant | ReturnFeed) => p.stream.active,\n },\n];\n\ninterface Props extends ClassName {\n meeting: Meeting;\n userId: string;\n teamId: string;\n}\n\nconst ParticipantsListComponent = ({meeting, teamId, userId}: Props) => {\n const [sort, setSort] = useStorageValue({\n defaultValue: 'name',\n key: 'Connect.Participants.Sorter',\n teamId,\n userId,\n });\n\n const handleSelect = (e: ChangeEvent) => {\n setSort(e.target.value);\n };\n\n const {filters, active, toggle, clear} = useFilterFeature({\n options,\n storage: {\n key: 'Connect.Participants.Filter',\n teamId,\n userId,\n },\n });\n\n const {users, mainstreams, feed} = useParticipants(meeting, sort, active);\n\n const filtered = active.length > 0;\n const hasUsers = users.length > 0;\n const hasMainstreams = mainstreams.length > 0;\n const hasParticipants = hasUsers || hasMainstreams || !isNil(feed);\n const showNoFiltered = !hasParticipants && filtered;\n\n return (\n
    \n \n \n\n \n Sort by:\n\n \n \n\n \n \n\n {showNoFiltered ? (\n \n ) : (\n \n {hasUsers && (\n \n \n Participants\n \n\n \n {users.map((p) => (\n \n ))}\n \n \n )}\n\n {hasMainstreams && (\n \n \n Main streams\n \n \n {mainstreams.map((p) => (\n \n ))}\n \n \n )}\n\n {feed && (\n \n \n Return feed\n \n\n \n \n Show the video feed back to your meeting participants\n {' '}\n \n {Icons.info().size(SIZE.S).reactComponent()}\n \n \n\n {feed.enabled ? (\n \n ) : (\n \n )}\n \n )}\n \n )}\n
    \n );\n};\n\nexport const ParticipantsList = observer(ParticipantsListComponent);\n","import React from 'react';\nimport {observer} from 'mobx-react';\nimport {Meeting} from 'app/store/models/connect/Meeting/Meeting';\nimport {usePermissionIssue} from 'app/components/pages/MeetingDetails/hooks/usePermissionIssue';\nimport {LocalRecordIssue} from 'app/components/pages/MeetingDetails/MeetingLayout/LocalRecordIssue/LocalRecordIssue';\nimport {DeniedAccessIssue} from 'app/components/pages/MeetingDetails/MeetingLayout/DeniedAccessIssue/DeniedAccessIssue';\nimport {MediaActionIssue} from 'app/components/pages/MeetingDetails/MeetingLayout/MediaActionIssue/MediaActionIssue';\nimport {ParticipantsList} from 'app/components/pages/MeetingDetails/ParticipantsList/ParticipantsList';\n\ninterface Props {\n meeting: Meeting;\n userId: string;\n teamId: string;\n}\n\nfunction MeetingLayoutRoot({userId, teamId, meeting}: Props) {\n const issue = usePermissionIssue(meeting.permission);\n\n if (issue) {\n if (issue === 'wait-record') {\n return ;\n }\n\n if (issue.denied) {\n return (\n \n );\n }\n\n return (\n \n );\n }\n\n return ;\n}\n\nexport const MeetingLayout = observer(MeetingLayoutRoot);\n","import React, {useEffect} from 'react';\nimport {Box} from '@mui/material';\nimport {observer} from 'mobx-react';\nimport {router} from 'app/router/main';\nimport {PageHeader} from 'app/components/sharedReactComponents/PageHeader';\nimport {useMeeting} from 'app/components/pages/MeetingDetails/hooks/useMeeting';\nimport {IndeterminateProgressBar} from 'app/components/sharedReactComponents/IndeterminateProgressBar';\nimport {MeetingDetailsHeader} from 'app/components/pages/MeetingDetails/MeetingDetailsHeader/MeetingDetailsHeader';\nimport {MeetingLayout} from 'app/components/pages/MeetingDetails/MeetingLayout/MeetingLayout';\nimport {useCloud} from 'app/components/features/cloud';\n\ninterface Props {\n meetingId: string;\n}\n\nfunction MeetingDetailsPageRoot({meetingId}: Props) {\n const {meeting, loading} = useMeeting(meetingId);\n\n const {team, user} = useCloud();\n\n // Don't show this page if meeting is not running or waiting permissions\n useEffect(() => {\n if (!loading) {\n if (meeting?.status !== 'running' || meeting?.permission === 'failed') {\n router.go('meetings');\n }\n }\n }, [loading, meeting?.status, meeting?.permission]);\n\n const showMeeting = meeting && !loading;\n\n return (\n
    \n \n\n {showMeeting ? (\n <>\n \n\n \n \n \n \n ) : (\n \n )}\n
    \n );\n}\n\nexport const MeetingDetailsPage = observer(MeetingDetailsPageRoot);\n","import React, {useState} from 'react';\nimport {red} from '@mui/material/colors';\nimport {Card, IconButton, Stack, Typography, Collapse, Box} from '@mui/material';\nimport ExpandMoreIcon from '@mui/icons-material/ExpandMore';\nimport {StyleSx, Sx} from 'app/types/common';\nimport {packSx} from 'app/util/packSx/packSx';\n\nconst rootSx: StyleSx = {bgcolor: red[50]};\nconst detailsSx: StyleSx = {maxHeight: 450, overflow: 'auto'};\n\ninterface Props extends Sx {\n title: string;\n message: string;\n}\n\nexport function ErrorSection({sx, title, message}: Props) {\n const [expanded, setExpanded] = useState(false);\n\n return (\n \n \n \n Error: {title}\n \n\n setExpanded((prev) => !prev)}>\n \n \n \n\n \n {message}\n \n \n );\n}\n\nfunction getIconSx(expanded: boolean): StyleSx {\n return {transform: `rotate(${expanded ? 180 : 0}deg)`, transition: 'transform .3s'};\n}\n","import React, {ReactNode} from 'react';\nimport {Stack, Typography} from '@mui/material';\nimport WarningIcon from '@mui/icons-material/Warning';\nimport {StyleSx} from 'app/types/common';\nimport {ErrorSection} from 'app/components/ErrorBoundary/ErrorSection';\n\nconst iconSx: StyleSx = {fontSize: 72};\nconst errorSx: StyleSx = {mt: 5, width: 670};\n\ntype State = {\n hasError: boolean;\n title: string;\n message: string;\n};\n\nexport class ErrorBoundary extends React.Component<{}, State> {\n state: Readonly = {hasError: false, title: '', message: ''};\n\n static getDerivedStateFromError(error: any): State {\n return {\n hasError: true,\n title: error.message ?? 'Unknown',\n message: '',\n };\n }\n\n componentDidCatch(error: Error, info: React.ErrorInfo): void {\n this.setState({message: info?.componentStack ?? error.stack ?? ''});\n }\n\n render(): ReactNode {\n const {hasError, title, message} = this.state;\n const {children} = this.props;\n\n if (hasError) {\n return (\n \n \n \n\n \n The app is unexpectedly down.\n
    Try to reload the page.\n
    \n
    \n\n \n
    \n );\n }\n\n return children;\n }\n}\n","/* eslint-disable jsx-a11y/label-has-associated-control */\nimport React, {useEffect, useState} from 'react';\nimport {CardElement, Elements, useElements, useStripe} from '@stripe/react-stripe-js';\nimport {\n CreateTokenCardData,\n StripeCardElementChangeEvent,\n StripeCardElementOptions,\n} from '@stripe/stripe-js';\nimport {Box, FormHelperText, Stack, StackProps, TextField} from '@mui/material';\nimport classNames from 'classnames';\nimport {useForm, Controller} from 'react-hook-form';\nimport {joiResolver} from '@hookform/resolvers/joi';\nimport Joi from 'joi';\nimport {SIZE, THEME, VARIANT} from 'app/constants';\nimport {ProgressButton} from 'app/components/sharedReactComponents/ProgressButton';\nimport {LoadingPlaceholder} from 'app/components/sharedReactComponents/LoadingPlaceholder';\nimport {RadioGroup} from 'app/components/sharedReactComponents/RadioGroup';\nimport {Radio, RADIO_THEME} from 'app/components/sharedReactComponents/Radio';\nimport {Callback} from 'app/types/common';\nimport {useStripeConnection} from 'app/components/sharedReactComponents/PaymentForm/useStripeConnection';\nimport {isNil} from 'app/util/isNil';\nimport {PaymentSection} from 'app/components/sharedReactComponents/PaymentForm/PaymentSection';\nimport {PaymentFormCoupon} from 'app/components/sharedReactComponents/PaymentForm/PaymentFormCoupon/PaymentFormCoupon';\nimport {CouponState} from 'app/components/BillingManager/hooks/useCoupon';\nimport {isIbbCoupon} from 'app/components/BillingManager/Coupon';\n\nconst cardElementOptions: StripeCardElementOptions = {\n hidePostalCode: true,\n style: {\n base: {\n fontWeight: 400,\n fontFamily: '\"Open Sans\", \"Helvetica Neue\", \"Helvetica\", sans-serif',\n fontSize: '14px',\n color: '#333',\n },\n invalid: {\n color: '#ff2e63',\n iconColor: '#ff2e63',\n },\n },\n};\n\nexport type Method = 'card' | 'invoice' | 'invoice coupon';\n\ninterface PaymentData {\n method: M;\n}\n\nexport interface PaymentCardData extends PaymentData<'card'> {\n ccToken: string;\n billingEmail: string;\n}\n\nexport interface PaymentInvoiceData extends PaymentData<'invoice'> {\n firstName: string;\n lastName: string;\n billingEmail: string;\n phone: string;\n country: string;\n state: string;\n city: string;\n postalCode: string;\n addressLineOne: string;\n}\n\nexport interface PaymentInvoiceCouponData extends PaymentData<'invoice coupon'> {\n billingEmail: string;\n}\n\nexport type PaymentPayload = PaymentCardData | PaymentInvoiceData | PaymentInvoiceCouponData;\n\ntype AvailablePayment = 'credit-card' | 'invoice';\n\ninterface BillingData {\n firstName: string;\n lastName: string;\n email: string;\n phone: string;\n country: string;\n state: string;\n city: string;\n postalCode: string;\n address: string;\n method: AvailablePayment;\n cc: boolean;\n}\n\nconst emptyData: BillingData = {\n address: '',\n city: '',\n country: '',\n email: '',\n firstName: '',\n lastName: '',\n phone: '',\n postalCode: '',\n state: '',\n method: 'credit-card',\n cc: false,\n};\n\nconst scheme = Joi.object({\n firstName: Joi.string().empty('').required(),\n lastName: Joi.string().empty('').required(),\n email: Joi.string()\n .empty('')\n .email({tlds: {allow: false}})\n .required(),\n address: Joi.string().empty('').required(),\n city: Joi.string().empty('').required(),\n country: Joi.string().empty('').required(),\n postalCode: Joi.string().empty('').required(),\n phone: Joi.string().empty(''),\n state: Joi.string().empty(''),\n method: Joi.string().valid('credit-card', 'invoice'),\n cc: Joi.boolean().when('method', {\n is: 'credit-card',\n then: Joi.valid(true),\n }),\n}).messages({\n 'any.required': 'Required field',\n 'string.empty': 'Cannot be empty',\n 'string.email': 'Must be valid email',\n});\n\ninterface Props {\n hasConnect: boolean;\n email?: string;\n externalError: string;\n coupon: CouponState;\n setCoupon: Callback;\n validateCoupon: Callback, [value: string]>;\n onSubmit: Callback, [data: PaymentPayload]>;\n}\n\nconst PaymentFormRoot = ({\n email,\n externalError,\n hasConnect,\n coupon,\n setCoupon,\n validateCoupon,\n onSubmit,\n}: Props) => {\n const stripe = useStripe();\n const elements = useElements();\n\n const [isSubmitting, setIsSubmitting] = useState(false);\n\n const {control, formState, getFieldState, watch, getValues, trigger, setValue} =\n useForm({\n defaultValues: {...emptyData, email},\n mode: 'all',\n resolver: joiResolver(scheme),\n });\n\n const [stripeError, setStripeError] = useState('');\n\n const isCouponFilled = coupon.value.length > 0 && !isNil(coupon.instance);\n const isIbb = coupon.instance ? isIbbCoupon(coupon.instance) : false;\n const isRegularCoupon = isCouponFilled && !isIbb;\n\n useEffect(() => {\n if (isIbb) {\n setValue('method', 'invoice');\n }\n }, [isIbb, setValue]);\n\n const handleCardChange = (event: StripeCardElementChangeEvent) => {\n setValue('cc', event.complete, {shouldValidate: true});\n setStripeError(event.error?.message ?? '');\n };\n\n const isDisabled = isSubmitting || (coupon.value.length > 0 && isNil(coupon.instance));\n\n const method = watch('method');\n const cardError = getFieldState('cc', formState).error;\n\n const handleSubmit = async () => {\n if (isDisabled || !stripe || !elements) {\n return;\n }\n\n try {\n const validation = await trigger();\n if (!validation) {\n return;\n }\n } catch {\n return;\n }\n\n const fields = getValues();\n\n setIsSubmitting(true);\n setStripeError('');\n\n if (isIbb) {\n try {\n await onSubmit({\n method: 'invoice coupon',\n billingEmail: fields.email,\n });\n } finally {\n setIsSubmitting(false);\n }\n return;\n }\n\n if (fields.method === 'credit-card') {\n const cardElement = elements.getElement(CardElement);\n\n if (!cardElement) {\n return;\n }\n\n const data: CreateTokenCardData = {\n address_line1: fields.address,\n address_city: fields.city,\n address_state: fields.state,\n address_zip: fields.postalCode,\n address_country: fields.country,\n };\n\n try {\n const result = await stripe.createToken(cardElement, data);\n\n if (result.token) {\n await onSubmit({\n method: 'card',\n ccToken: result.token.id,\n billingEmail: fields.email,\n });\n }\n\n if (result.error) {\n setStripeError(result.error.message ?? 'Stripe error');\n }\n } finally {\n setIsSubmitting(false);\n }\n\n return;\n }\n\n try {\n await onSubmit({\n method: 'invoice',\n firstName: fields.firstName,\n lastName: fields.lastName,\n billingEmail: fields.email,\n phone: fields.phone,\n country: fields.country,\n state: fields.state,\n city: fields.city,\n postalCode: fields.postalCode,\n addressLineOne: fields.address,\n });\n } finally {\n setIsSubmitting(false);\n }\n };\n\n return (\n
    \n
    \n \n (\n \n )}\n />\n\n (\n \n )}\n />\n \n\n \n (\n \n )}\n />\n\n (\n \n )}\n />\n \n\n \n (\n \n )}\n />\n\n (\n \n )}\n />\n \n\n \n (\n \n )}\n />\n\n (\n \n )}\n />\n \n\n \n (\n \n )}\n />\n \n
    \n\n {externalError && (\n \n

    {externalError}

    \n
    \n )}\n\n \n \n \n\n \n \n {isIbb ? (\n
    Invoice-based billing.
    \n ) : (\n (\n \n \n\n \n \n )}\n />\n )}\n
    \n
    \n\n {!isIbb && (\n <>\n \n \n \n\n {method === 'invoice' && (\n
    \n {(!isCouponFilled || isRegularCoupon) && (\n <>Your request will be reviewed in 3 business days.\n )}\n\n {isRegularCoupon && (\n
    \n \n Your voucher cannot be activated now. Please come back to this page to activate\n the voucher when your request is approved.\n
    \n )}\n
    \n )}\n \n )}\n\n
    \n \n Confirm billing\n {isCouponFilled && method === 'credit-card' && ' & activate voucher'}\n \n
    \n
    \n );\n};\n\nexport const PaymentForm = (props: Props) => {\n const stripe = useStripeConnection();\n\n if (!stripe) {\n return ;\n }\n\n return (\n \n \n \n );\n};\n\nfunction Row({children, ...props}: StackProps) {\n return (\n \n {children}\n \n );\n}\n","import React from 'react';\nimport {alpha, Box, Divider, Stack} from '@mui/material';\nimport {Component} from 'app/types/common';\nimport {freeTier} from 'app/util/billing/utils';\nimport {backgrounds} from 'app/themes/app';\nimport {Icons} from 'app/util/icons';\nimport {THEME} from 'app/constants';\nimport {Billing} from 'app/domain/billing';\n\ntype EdgeFeature =\n | 'dashboard'\n | 'media-actions'\n | 'monitoring'\n | 'remote'\n | 'batch-actins'\n | 'presets'\n | 'live'\n | 'alerts'\n | 'events';\n\nconst edgeFeatures: Array> = [\n {id: 'dashboard', name: 'Dashboard for system monitoring and management'},\n {id: 'media-actions', name: 'Centralized streaming and recording'},\n\n {id: 'monitoring', name: 'Channel and input monitoring'},\n {\n id: 'remote',\n name: 'Remote access, configuration, and control for streaming, recording, and production',\n },\n {id: 'batch-actins', name: 'Device grouping and batch actions for one-click fleet management'},\n {id: 'events', name: 'Events scheduling'},\n {id: 'presets', name: 'Create and manage presets from anywhere'},\n {id: 'live', name: 'Live video monitoring'},\n {id: 'alerts', name: 'Email alerts to solve issues'},\n];\n\nconst freeFeatures = new Set(['dashboard', 'media-actions', 'monitoring']);\nconst premiumFeatures = new Set(edgeFeatures.map((f) => f.id));\n\ninterface Props extends Component {\n tiers: App.Billing.Cloud.Tier[];\n currentTier: string;\n}\n\nexport function EdgeFeatures({tiers, currentTier}: Props) {\n return (\n \n {edgeFeatures.map((feature) => (\n }\n sx={{\n '&:last-child > div': {\n borderBottomLeftRadius: 8,\n borderBottomRightRadius: 8,\n },\n }}\n >\n \n\n {tiers.map((p) => (\n \n ))}\n \n ))}\n \n );\n}\n\ninterface TierFeatureProps {\n featureId: EdgeFeature;\n tier: App.Billing.Cloud.Tier;\n current: boolean;\n}\n\nfunction CloudTierFeature({tier, featureId, current}: TierFeatureProps) {\n const isFree = freeTier(tier.id);\n\n const checkFeature = () => {\n if (isFree) {\n return freeFeatures.has(featureId);\n }\n return premiumFeatures.has(featureId);\n };\n\n const isAvailable = checkFeature();\n\n return (\n \n \n {isAvailable ? Icons.checkmark().theme(THEME.PRIMARY).reactComponent() : null}\n \n \n );\n}\n\ninterface FeatureProps {\n name: string;\n}\n\nfunction Feature({name}: FeatureProps) {\n return (\n \n {name}\n \n );\n}\n","import React from 'react';\nimport {Box, Stack, SxProps, Typography} from '@mui/material';\nimport {Component} from 'app/types/common';\nimport {backgrounds} from 'app/themes/app';\n\ninterface BaseProps extends React.PropsWithChildren {}\ntype Components = 'root' | 'title' | 'price' | 'description' | 'actions';\n\nconst styles: Record = {\n root: {\n px: 4,\n pt: 2,\n pb: 5,\n borderTopLeftRadius: 8,\n borderTopRightRadius: 8,\n minWidth: 260,\n height: 380,\n flexGrow: 0,\n flexShrink: 0,\n },\n title: {mb: 2, textTransform: 'uppercase', fontWeight: 'bold'},\n price: {mb: 2, fontWeight: 'bold', fontSize: '16px'},\n description: {textAlign: 'center'},\n actions: {mt: 'auto', textAlign: 'center'},\n};\n\nfunction Title({children}: BaseProps) {\n return (\n \n {children}\n \n );\n}\n\ninterface PriceProps extends BaseProps {\n value: number;\n interval: string;\n perDevice?: boolean;\n}\n\nfunction Price({dataId, value, interval, perDevice}: Omit) {\n return (\n \n \n ${value}\n {' '}\n {perDevice ? 'per device unit' : ''} / {interval}\n \n );\n}\n\nfunction Description({children}: BaseProps) {\n return {children};\n}\n\nfunction Actions({children}: BaseProps) {\n return {children};\n}\n\ninterface Props extends BaseProps {\n sx?: SxProps;\n current?: boolean;\n}\n\nexport function TierCard({children, dataId, sx, current = false}: Props) {\n return (\n \n {children}\n \n );\n}\n\nTierCard.Title = Title;\nTierCard.Price = Price;\nTierCard.Description = Description;\nTierCard.Actions = Actions;\n","/* eslint-disable */\n/**\n * Use in DriftComTracker only\n * {@link https://devdocs.drift.com/docs/installation}\n */\nexport const DriftComScripts = {\n load() {\n // Start of Async Drift Code\n var t = (window.driftt = window.drift = window.driftt || []);\n if (!t.init) {\n if (t.invoked)\n return void (\n window.console &&\n console.error &&\n console.error('Drift snippet included twice.')\n );\n (t.invoked = !0),\n (t.methods = [\n 'identify',\n 'config',\n 'track',\n 'reset',\n 'debug',\n 'show',\n 'ping',\n 'page',\n 'hide',\n 'off',\n 'on',\n ]),\n (t.factory = function (e) {\n return function () {\n var n = Array.prototype.slice.call(arguments);\n return n.unshift(e), t.push(n), t;\n };\n }),\n t.methods.forEach(function (e) {\n t[e] = t.factory(e);\n }),\n (t.load = function (t) {\n var e = 3e5,\n n = Math.ceil(new Date() / e) * e,\n o = document.createElement('script');\n (o.type = 'text/javascript'),\n (o.async = !0),\n (o.crossorigin = 'anonymous'),\n (o.src = 'https://js.driftt.com/include/' + n + '/' + t + '.js');\n var i = document.getElementsByTagName('script')[0];\n i.parentNode.insertBefore(o, i);\n });\n }\n window.drift.SNIPPET_VERSION = '0.3.1';\n // End of Async Drift Code\n },\n\n // @legacy\n initialize() {\n if (!Boolean(CIRRUS_DRIFTCOM_TOKEN)) {\n return;\n }\n\n // Start of Async Drift Code\n var t = (window.driftt = window.drift = window.driftt || []);\n if (!t.init) {\n if (t.invoked)\n return void (\n window.console &&\n console.error &&\n console.error('Drift snippet included twice.')\n );\n (t.invoked = !0),\n (t.methods = [\n 'identify',\n 'config',\n 'track',\n 'reset',\n 'debug',\n 'show',\n 'ping',\n 'page',\n 'hide',\n 'off',\n 'on',\n ]),\n (t.factory = function (e) {\n return function () {\n var n = Array.prototype.slice.call(arguments);\n return n.unshift(e), t.push(n), t;\n };\n }),\n t.methods.forEach(function (e) {\n t[e] = t.factory(e);\n }),\n (t.load = function (t) {\n var e = 3e5,\n n = Math.ceil(new Date() / e) * e,\n o = document.createElement('script');\n (o.type = 'text/javascript'),\n (o.async = !0),\n (o.crossorigin = 'anonymous'),\n (o.src = 'https://js.driftt.com/include/' + n + '/' + t + '.js');\n var i = document.getElementsByTagName('script')[0];\n i.parentNode.insertBefore(o, i);\n });\n }\n window.drift.SNIPPET_VERSION = '0.3.1';\n // End of Async Drift Code\n },\n\n configure(hidden = false) {\n let config = {\n verticalOffset: 58,\n };\n\n // Don't show chat. When you needed to reset user data only. On Login page for example\n if (hidden) {\n window.drift?.on('ready', function (api) {\n api.widget.hide();\n\n api.on('chatOpen', function () {\n api.widget.hide();\n });\n });\n config = {\n ...config,\n enableWelcomeMessage: false,\n enableCampaigns: false,\n enableChatTargeting: false,\n disableNewConversations: true,\n };\n }\n\n window.drift?.config(config);\n },\n\n /**\n * Identify user in Drift\n * @param {string} userId\n * @param {string} userEmail\n * @param {string} teamId\n */\n identify(userId, userEmail, teamId) {\n window.drift?.identify(userId, {\n userEmail,\n teamId,\n });\n },\n\n setUserAttributes(userId, userEmail, teamId) {\n window.drift?.on('ready', function (api) {\n api.setUserAttributes({userId, teamId, email: userEmail});\n });\n },\n\n resetUserData() {\n window.drift?.reset();\n },\n\n run(token) {\n window.drift?.load(token);\n },\n\n // @legacy\n start() {\n window.drift?.load(CIRRUS_DRIFTCOM_TOKEN);\n },\n};\n","import {DriftComScripts} from 'app/util/DriftComTracker/DriftComScripts';\n\ninterface UserOptions {\n userId: string;\n userEmail: string;\n teamId: string;\n}\n\nexport class DriftComTracker {\n static runApp(appKey: string, {teamId, userId, userEmail}: UserOptions) {\n DriftComScripts.initialize();\n DriftComScripts.configure();\n DriftComScripts.identify(userId, userEmail, teamId);\n DriftComScripts.run(appKey);\n }\n\n static useInMaintenance() {\n DriftComScripts.initialize();\n DriftComScripts.configure();\n DriftComScripts.resetUserData();\n DriftComScripts.start();\n }\n\n static useInLogin() {\n DriftComScripts.initialize();\n DriftComScripts.configure(true);\n DriftComScripts.resetUserData();\n DriftComScripts.start();\n }\n\n static logOut() {\n DriftComScripts.resetUserData();\n }\n}\n","import React from 'react';\nimport {ListItemText} from '@mui/material';\n\ninterface TextProps {\n value: string;\n}\n\nexport function NavText({value}: TextProps) {\n return (\n \n );\n}\n","import React, {forwardRef} from 'react';\nimport {ListItemButton, SxProps, Theme, listItemButtonClasses} from '@mui/material';\nimport ExpandLess from '@mui/icons-material/ExpandLess';\nimport ExpandMore from '@mui/icons-material/ExpandMore';\nimport {grey} from '@mui/material/colors';\nimport {NavText} from 'app/components/Navigation/shared/NavText';\nimport {palette} from 'app/themes/app';\nimport {DataId, Sx} from 'app/types/common';\nimport {packSx} from 'app/util/packSx/packSx';\n\ninterface SectionProps extends DataId, Sx {\n expanded: boolean;\n icon?: React.ReactNode;\n compact?: boolean;\n label: string;\n onClick(): void;\n}\n\nconst sectionButtonSx: SxProps = {\n gap: 1.5,\n [`&:hover, &.${listItemButtonClasses.focusVisible}`]: {\n bgcolor: palette.dark1,\n },\n};\n\nexport const SectionButton = forwardRef(\n ({dataId, sx, expanded, compact, label, icon, onClick}, ref) => {\n return (\n \n {icon ?? false}\n {!compact && (\n <>\n \n {expanded ? (\n \n ) : (\n \n )}\n \n )}\n \n );\n },\n);\n","import React, {useRef, useState} from 'react';\nimport {Collapse, Link, List, ListItemButton, Popover, listItemButtonClasses} from '@mui/material';\nimport VideoFileIcon from '@mui/icons-material/VideoFile';\nimport {Component, Sx} from 'app/types/common';\nimport {MainRoutes, router} from 'app/router/main';\nimport {palette} from 'app/themes/app';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {Icons} from 'app/util/icons';\nimport {NavText} from 'app/components/Navigation/shared/NavText';\nimport {TOOLTIP_PLACEMENT, Tooltip} from 'app/components/sharedReactComponents/Tooltip';\nimport {RouteDefinition} from 'app/components/Navigation/types';\nimport {GroupPortal} from 'app/components/Navigation/EdgeNav/GroupPortal/GroupPortal';\nimport {PORTAL_ELEMENT_ID} from 'app/constants/portalElementId';\nimport {NavSection} from 'app/components/Navigation/hooks/useNavRoutes';\nimport {LegacyIcon} from 'app/components/sharedReactComponents/LegacyIcon/LegacyIcon';\nimport {SectionButton} from 'app/components/Navigation/shared/SectionButton/SectionButton';\n\ninterface Props extends Sx {\n open: boolean;\n route: MainRoutes;\n routes: RouteDefinition[];\n compact?: boolean;\n onSetSection: Fn;\n}\n\nconst navIcons = new Map([\n ['devices', {Icons.devices().reactComponent()}],\n [\n 'transcribeDevices',\n {Icons.liveScrypt().reactComponent()},\n ],\n ['events', {Icons.cms().reactComponent()}],\n ['recordings', ],\n]);\n\nexport function EdgeNav({sx, compact, open, route, routes, onSetSection}: Props) {\n const [menu, setMenu] = useState(() => false);\n\n const anchorRef = useRef(null);\n\n const handleRoute = () => {\n if (compact) {\n setMenu(false);\n }\n };\n\n const renderList = () => {\n return (\n \n {routes.map((r) => {\n if (!r.access) {\n return false;\n }\n\n return (\n \n \n {r.route === 'devices' && (\n \n )}\n \n );\n })}\n \n );\n };\n\n const renderSection = () => {\n if (compact) {\n return (\n setMenu(false)}\n >\n {renderList()}\n \n );\n }\n\n return {renderList()};\n };\n\n const toggleSection = () => {\n if (open) {\n onSetSection(undefined);\n } else {\n onSetSection('edge');\n }\n\n setMenu((o) => !o);\n };\n\n return (\n \n \n \n {Icons.edge().reactComponent()}\n \n }\n compact={compact}\n onClick={toggleSection}\n />\n \n\n {renderSection()}\n \n );\n}\n\ninterface NavigationItemProps extends Component, Sx {\n href: string;\n label: string;\n selected?: boolean;\n icon?: React.ReactNode;\n onClick(): void;\n}\n\nfunction NavigationItem({sx, dataId, label, href, icon, selected, onClick}: NavigationItemProps) {\n return (\n \n {icon}\n \n \n );\n}\n","import React from 'react';\nimport {Link, ListItemButton, listItemButtonClasses} from '@mui/material';\nimport {palette} from 'app/themes/app';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {DataId, Sx} from 'app/types/common';\n\ninterface Props extends Sx, DataId {\n selected?: boolean;\n href: string;\n onClick?: () => void;\n}\n\nexport const NavButton = React.forwardRef>(\n ({sx, dataId, href, selected, children, onClick}, ref) => (\n \n {children}\n \n ),\n);\n","import React from 'react';\nimport {Divider, List, ListItemButton, ListItemText, Stack} from '@mui/material';\nimport CheckIcon from '@mui/icons-material/Check';\nimport {DataId, Sx} from 'app/types/common';\nimport {palette} from 'app/themes/app';\nimport {router} from 'app/router/main';\nimport {Team} from 'app/components/entities/team';\n\ninterface ListProps extends Sx, DataId {\n teamId: string;\n teams: Team.Team[];\n onMyTeam: () => void;\n onCreate: () => Promise;\n onLogout: () => Promise;\n}\n\nexport const TeamList = React.forwardRef(\n ({sx, teamId, teams, onCreate, onMyTeam, onLogout}, ref) => {\n const handleSelect = (id: string) => {\n if (teamId !== id) {\n router.goToTeam(id);\n }\n };\n\n return (\n \n \n {teams.map((t) => (\n handleSelect(t.id)}>\n \n {t.name}\n \n\n {teamId === t.id && }\n \n ))}\n \n\n \n\n \n \n \n + Add new team\n \n \n \n My team\n \n \n Log out\n \n \n \n );\n },\n);\n","import React, {useRef, useState} from 'react';\nimport {\n Box,\n ButtonBase,\n Popover,\n PopoverOrigin,\n Stack,\n Tooltip,\n Typography,\n buttonBaseClasses,\n} from '@mui/material';\nimport {grey} from '@mui/material/colors';\nimport UnfoldMoreIcon from '@mui/icons-material/UnfoldMore';\nimport GroupIcon from '@mui/icons-material/Group';\nimport {OverflowTooltip} from 'app/components/sharedReactComponents/OverflowTooltip/OverflowTooltip';\nimport {StyleSx, Sx} from 'app/types/common';\nimport {palette} from 'app/themes/app';\nimport {TeamList} from 'app/components/Navigation/TeamSelector/TeamList';\nimport {packSx} from 'app/util/packSx/packSx';\n\nconst bgcolor = palette.dark1;\nconst rootSx: StyleSx = {\n width: '100%',\n px: 2,\n py: 1,\n [`&:hover, &.${buttonBaseClasses.focusVisible}`]: {bgcolor},\n};\nconst listSx: StyleSx = {maxHeight: '50vh', width: 230};\n\ntype OriginType = 'anchor' | 'transform';\n\nconst normalOrigin: Record = {\n anchor: {vertical: 'bottom', horizontal: 'left'},\n transform: {vertical: 'top', horizontal: 'left'},\n};\n\nconst compactOrigin: Record = {\n anchor: {vertical: 'top', horizontal: 'right'},\n transform: {vertical: 'top', horizontal: 'left'},\n};\n\ninterface Props extends Sx, React.ComponentProps {\n email: string;\n teamId: string;\n teamName: string;\n compact: boolean;\n}\n\nexport function TeamSelector({\n compact,\n email,\n teamId,\n teamName,\n teams,\n sx,\n onCreate,\n onLogout,\n onMyTeam,\n}: Props) {\n const [open, setOpen] = useState(false);\n\n const anchorRef = useRef(null);\n\n const popperOrigin = compact ? compactOrigin : normalOrigin;\n\n const handleMyTeam = () => {\n onMyTeam();\n setOpen(false);\n };\n\n return (\n \n setOpen(true)}\n >\n {compact ? (\n \n \n {email}\n \n \n {teamName}\n \n \n }\n >\n \n \n ) : (\n \n \n \n {email}\n \n\n \n {teamName}\n \n \n \n \n )}\n \n\n setOpen(false)}\n >\n \n \n \n );\n}\n","import React, {useState} from 'react';\nimport {Paper, Stack, Typography} from '@mui/material';\nimport {LoadingButton} from '@mui/lab';\nimport {grey} from '@mui/material/colors';\nimport {StyleSx, Sx} from 'app/types/common';\nimport {AppNotifications, NotificationsApi} from 'app/components/entities/notifications';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {Notifications} from 'app/components/Notifications';\nimport {useMounted} from 'app/hooks/useIsMounted';\n\nconst rootSx: StyleSx = {p: 2, bgcolor: grey[100]};\n\ninterface Props extends Sx {\n notification: AppNotifications.OwnershipNotification;\n onReload: () => Promise;\n}\n\nexport function OwnershipNotification({sx, notification, onReload}: Props) {\n const {token, teamName, ownerName} = notification;\n const [accepting, setAccepting] = useState(false);\n const [declining, setDeclining] = useState(false);\n\n const mounted = useMounted();\n\n const handleAccept = async () => {\n try {\n setAccepting(true);\n await NotificationsApi.acceptOwnership(notification.token);\n await onReload();\n } catch {\n Notifications.addErrorNotification('Failed to accept ownership');\n } finally {\n if (mounted()) {\n setAccepting(false);\n }\n }\n };\n\n const handleDecline = async () => {\n try {\n setDeclining(true);\n await NotificationsApi.declineOwnership(notification.token);\n await onReload();\n } catch {\n Notifications.addErrorNotification('Failed to decline ownership');\n } finally {\n if (mounted()) {\n setDeclining(false);\n }\n }\n };\n\n return (\n \n \n Would you like to accept ownership of{' '}\n \n {teamName}\n {' '}\n sent to you by {ownerName}\n \n\n \n \n Accept transfer ownership\n \n\n \n Decline transfer ownership\n \n \n\n \n * If ownership transfer is accepted, your role will change to Owner\n \n \n );\n}\n","import React, {useEffect, useMemo, useState} from 'react';\nimport {useLocalStorage} from 'react-use';\nimport {\n ButtonBase,\n Drawer,\n IconButton,\n Stack,\n Typography,\n alpha,\n buttonBaseClasses,\n} from '@mui/material';\nimport AnnouncementIcon from '@mui/icons-material/Announcement';\nimport CloseIcon from '@mui/icons-material/Close';\nimport {StyleSx, Sx} from 'app/types/common';\nimport {packSx} from 'app/util/packSx/packSx';\nimport {pluralizeN} from 'app/components/helpers/commonHelpers';\nimport {useNotifications} from 'app/components/entities/notifications';\nimport {OwnershipNotification} from 'app/components/features/notifications';\n\nconst rootSx: StyleSx = {\n display: 'flex',\n justifyContent: 'flex-start',\n alignItems: 'center',\n borderRadius: 1,\n gap: 1.5,\n p: 1,\n bgcolor: 'transparent',\n [`&:hover, &.${buttonBaseClasses.focusVisible}`]: {bgcolor: '#222836'},\n};\nconst unreadSx: StyleSx = {\n bgcolor: '#ff0048',\n [`&:hover, &.${buttonBaseClasses.focusVisible}`]: {bgcolor: alpha('#ff0048', 0.9)},\n};\n\ninterface Props extends Sx {\n teamId: string;\n userId: string;\n compact: boolean;\n}\n\nexport function UserNotifications({sx, teamId, userId, compact}: Props) {\n const [open, setOpen] = useState(false);\n\n const {data, refetch} = useNotifications();\n\n const [tokens = {}, setTokens] = useLocalStorage>>(\n 'Notifications',\n {},\n );\n\n const total = data?.length ?? 0;\n\n const hasUnread = useMemo(() => {\n if (!data) {\n return false;\n }\n\n const read = new Set(tokens[teamId]?.[userId] ?? []);\n return data.some(({token}) => !read.has(token));\n }, [tokens, data, teamId, userId]);\n\n useEffect(() => {\n if (!data) {\n return;\n }\n\n if (!data.length) {\n setOpen(false);\n }\n }, [data]);\n\n if (!data) {\n return null;\n }\n\n const handleOpen = () => {\n setOpen(true);\n\n const newList = data?.map(({token}) => token) ?? [];\n\n setTokens((prev) => {\n if (!prev) {\n if (data) {\n return {\n [teamId]: {\n [userId]: newList,\n },\n };\n }\n\n return prev;\n }\n\n const team = prev[teamId] ?? {};\n\n return {\n ...prev,\n [teamId]: {...team, [userId]: newList},\n };\n });\n };\n\n const hasItems = data.length > 0;\n\n return (\n <>\n {hasItems && (\n \n \n {!compact && (\n \n {total} {pluralizeN('Notification', total)}{' '}\n \n )}\n \n )}\n\n setOpen(false)}\n >\n \n \n Notifications\n \n\n setOpen(false)}>\n \n \n \n\n \n {data.map((item) => (\n {\n await refetch();\n }}\n />\n ))}\n \n \n \n );\n}\n","import React from 'react';\nimport {CssBaseline, ThemeProvider} from '@mui/material';\nimport {lightTheme} from 'app/themes/app';\n\nexport function MainTheme({children}: React.PropsWithChildren<{}>) {\n return (\n \n \n {children}\n \n );\n}\n","/* eslint-disable complexity */\nimport React, {useState, useEffect, useMemo} from 'react';\nimport {enableMapSet} from 'immer';\nimport dayjs from 'dayjs';\nimport timezone from 'dayjs/plugin/timezone';\nimport weekOfYear from 'dayjs/plugin/weekOfYear';\nimport weekYear from 'dayjs/plugin/weekYear';\nimport utc from 'dayjs/plugin/utc';\nimport duration from 'dayjs/plugin/duration';\nimport relativeTime from 'dayjs/plugin/relativeTime';\nimport {SnackbarOrigin, Stack, useMediaQuery, useTheme} from '@mui/material';\nimport {QueryClient, QueryClientProvider} from '@tanstack/react-query';\nimport {ReactQueryDevtools} from '@tanstack/react-query-devtools';\nimport {LocalizationProvider} from '@mui/x-date-pickers';\nimport {AdapterDayjs} from '@mui/x-date-pickers/AdapterDayjs';\nimport {useComponentDidMount} from 'app/hooks/useComponentDidMount';\nimport {MainRoutes, router} from 'app/router/main';\nimport {Footer} from 'app/components/Footer';\nimport {Alerts} from 'app/components/Settings/Alerts';\nimport {FleetManagerPage} from 'app/components/FleetManager/FleetManagerPage';\nimport {DevicesAlertsPage} from 'app/components/DevicesAlerts/DevicesAlertsPage';\nimport {PresetsPage} from 'app/components/Presets/PresetsPage';\nimport {Agreement} from 'app/components/LegalInformation/Agreement';\nimport {AccountSettings} from 'app/components/Settings/AccountSettings/AccountSettings';\nimport {ApiTokens} from 'app/components/Settings/ApiTokens';\nimport {UsePolicy} from 'app/components/LegalInformation/UsePolicy';\nimport {OneClickDevicePairingPage} from 'app/components/OneClickDevicePairing/OneClickDevicePairingPage';\nimport {StreamingDestinations} from 'app/components/Settings/StreamingDestinations';\nimport {TranscribeDevices} from 'app/components/Dashboard/TranscribeDevices';\nimport {DeviceDetailsPage} from 'app/components/DeviceDetails/DeviceDetailsPage';\nimport {PairDevicePage} from 'app/components/PairDevice/PairDevicePage';\nimport {FileTransfer} from 'app/components/Settings/FileTransfer';\nimport {BillingAndUsage} from 'app/components/Settings/BillingAndUsage/BillingAndUsage';\nimport {ScrollToAnchorController} from 'app/components/sharedReactComponents/ScrollToAnchor/ScrollToAnchorController';\nimport {RouterStateType} from 'app/router/types';\nimport {EventsPage} from 'app/components/pages/Events/EventsPage';\nimport {StoreContext} from 'app/store/StoreContext';\nimport {UnifyProjects} from 'app/components/UnifyProjects/UnifyProjects';\nimport {ConnectAccounts} from 'app/components/Settings/ConnectSettings/ConnectSettings';\nimport {MeetingsManager} from 'app/components/MeetingsManager/MeetingsManager';\nimport {MeetingDetailsPage} from 'app/components/pages/MeetingDetails/MeetingDetailsPage';\nimport {ErrorBoundary} from 'app/components/ErrorBoundary/ErrorBoundary';\nimport {BillingManager} from 'app/components/BillingManager/BillingManager';\nimport {Trackers} from 'app/components/Trackers/Trackers';\nimport {RootStore} from 'app/store/RootStore';\nimport {Navigation} from 'app/components/Navigation/Navigation';\nimport {useNavRoutes} from 'app/components/Navigation/hooks/useNavRoutes';\nimport {ConnectPlatformsIntegration} from 'app/components/ConnectPlatformsIntegration/ConnectPlatformsIntegration';\nimport {MainTheme} from 'app/themes/MainTheme';\nimport {MaintenanceSnackbar, useMaintenance} from 'app/components/features/maintenance';\nimport {TeamFileManagement} from 'app/components/pages/files';\nimport {Team, useTeamsQuery} from 'app/components/entities/team';\nimport {useCloud} from 'app/components/features/cloud';\nimport {StyleSx} from 'app/types/common';\nimport {AppBootstrap, ApplicationFeatures} from 'app/components/widgets/app';\nimport {useFeature} from 'app/components/entities/app';\nimport {WS} from 'app/api/WebSocket/WS';\nimport {EVENT_TYPE} from 'app/api/WebSocket/constants';\nimport {Ws} from 'app/contracts/ws';\n\nenableMapSet();\ndayjs.extend(timezone);\ndayjs.extend(weekOfYear);\ndayjs.extend(weekYear);\ndayjs.extend(utc);\ndayjs.extend(duration);\ndayjs.extend(relativeTime);\n\nconst maintenanceOrigin: SnackbarOrigin = {vertical: 'bottom', horizontal: 'left'};\nconst navSx: StyleSx = {\n position: 'sticky',\n top: 0,\n height: '100vh',\n overflowY: 'auto',\n flexShrink: 0,\n};\n\ntype RenderBody = {\n content: React.ReactNode;\n key: string;\n};\n\ntype ContentProps = {\n routeState: RouterStateType;\n};\n\nfunction Content({routeState}: ContentProps) {\n const {user, team} = useCloud();\n const {capabilities} = team;\n\n const {data: teams, refetch: refetchTeams} = useTeamsQuery();\n const {instance, minimized, expand, setStored} = useMaintenance();\n\n const theme = useTheme();\n const compact = useMediaQuery(theme.breakpoints.down('lg'));\n\n const routes = useNavRoutes({\n scheduleAccess: team.capabilities.has('cms'),\n billingAccess: user.role.canEditBilling(),\n });\n\n const {role} = user;\n\n useEffect(() => {\n const onTeamChange = async (message: Ws.TeamChange) => {\n if (message.Body.Change === 'name') {\n await refetchTeams();\n }\n };\n\n WS.on(EVENT_TYPE.TEAM_CHANGE, onTeamChange);\n\n return () => {\n WS.off(EVENT_TYPE.TEAM_CHANGE, onTeamChange);\n };\n }, [refetchTeams]);\n\n useEffect(() => {\n const {query} = routeState;\n\n if (query) {\n const {scrollTo} = query;\n\n if (scrollTo) {\n delete router.state.query?.scrollTo;\n ScrollToAnchorController.register(decodeURIComponent(scrollTo as string));\n }\n }\n }, [routeState]);\n\n const filesFeature = useFeature('files');\n const connectFeature = useFeature('connect');\n const unifyFeature = useFeature('unify');\n\n useEffect(() => {\n const {name} = routeState;\n\n if (!role.canAccessRoute(name) || !checkAccess(name, capabilities)) {\n router.go('devices');\n return;\n }\n\n if (!filesFeature && name === 'recordings') {\n router.go('devices');\n }\n\n if (!unifyFeature && (name === 'projects' || name === 'projectDetails')) {\n router.go('devices');\n }\n\n if (\n !connectFeature &&\n (name === 'meetings' || name === 'meetingDetails' || name === 'connectAccountSettings')\n ) {\n router.go('devices');\n }\n }, [routeState, role, capabilities, filesFeature, unifyFeature, connectFeature]);\n\n const bodyRender = (): RenderBody => {\n const {name, params, query} = routeState;\n\n if (!role.canAccessRoute(name) || !checkAccess(name, capabilities)) {\n return {content: null, key: 'default'};\n }\n\n switch (name) {\n case 'devices': {\n return {content: , key: 'devices'};\n }\n\n case 'projects': {\n return {content: , key: 'projects'};\n }\n\n case 'alerts': {\n return {content: , key: 'alerts'};\n }\n\n case 'devicesAlerts': {\n return {content: , key: 'devicesAlerts'};\n }\n\n case 'presets': {\n return {content: , key: 'presets'};\n }\n\n case 'agreement': {\n return {content: , key: 'agreement'};\n }\n\n case 'accountSettings': {\n return {content: , key: 'accountSettings'};\n }\n\n case 'apiTokens': {\n return {\n content: ,\n key: 'apiTokens',\n };\n }\n\n case 'acceptanceUsePolicy': {\n return {content: , key: 'use-policy'};\n }\n\n case 'oneClickDevicePairing': {\n return {\n content: ,\n key: 'oneClickDevicePairing',\n };\n }\n\n case 'streamingDestinations': {\n return {\n content: ,\n key: 'streamingDestinations',\n };\n }\n\n case 'transcribeDevices': {\n return {content: , key: 'transcribeDevices'};\n }\n\n case 'deviceDetails': {\n return {\n content: ,\n key: 'deviceDetails',\n };\n }\n\n case 'transcribeDeviceDetails': {\n return {\n content: ,\n key: 'transcribeDeviceDetails',\n };\n }\n\n case 'welcome': {\n return {content: , key: 'welcome'};\n }\n\n case 'fileTransfer': {\n return {\n content: ,\n key: 'fileTransfer',\n };\n }\n\n case 'settingBillingUsage': {\n return {content: , key: 'settingBillingUsage'};\n }\n\n case 'events': {\n return {content: , key: 'events'};\n }\n\n case 'projectDetails': {\n return {\n content: ,\n key: 'projectDetails',\n };\n }\n\n case 'meetings': {\n return {\n content: ,\n key: 'meetings',\n };\n }\n\n case 'meetingDetails': {\n return {\n content: ,\n key: 'meetingDetails',\n };\n }\n\n case 'connectAccountSettings': {\n return {\n key: 'connectAccountSettings',\n content: ,\n };\n }\n\n case 'recordings': {\n return {\n key: 'recordings',\n content: ,\n };\n }\n\n case 'dashboard':\n default: {\n if (user.role.canViewDevices()) {\n router.go('devices');\n }\n\n return {content: false, key: 'default'};\n }\n }\n };\n\n const {name} = routeState;\n const {content, key} = bodyRender();\n\n return (\n \n \n \n {instance && (\n setStored(instance.id)}\n />\n )}\n\n \n \n\n \n \n {content}\n \n\n