{"version":3,"file":"public.98cc4e0a.js","sources":["../../../node_modules/react-cookie/es6/CookiesContext.js","../../../node_modules/react-cookie/es6/CookiesProvider.js","../../../frontend/api/rest/subscribers.js","../../../frontend/api/v3/private/ideaBoard.js","../../../node_modules/swr/infinite/dist/index.esm.js","../../../node_modules/react-speech-recognition/lib/utils.js","../../../node_modules/react-speech-recognition/lib/constants.js","../../../node_modules/react-speech-recognition/lib/actions.js","../../../node_modules/react-speech-recognition/lib/reducers.js","../../../node_modules/react-speech-recognition/lib/isAndroid.js","../../../node_modules/react-speech-recognition/lib/NativeSpeechRecognition.js","../../../node_modules/react-speech-recognition/lib/RecognitionManager.js","../../../node_modules/react-speech-recognition/lib/SpeechRecognition.js","../../../node_modules/react-speech-recognition/lib/index.js","../../../frontend/features/common/components/NotificationsSignupModal/Success/index.js","../../../frontend/features/common/utils/rules.js","../../../frontend/features/common/components/CheckBox/index.js","../../../frontend/features/common/components/CheckboxGroup/index.js","../../../frontend/features/common/components/NotificationsSignupModal/Form/index.js","../../../frontend/features/common/components/NotificationsSignupModal/index.js","../../../frontend/features/common/components/NotificationsSignup/index.js","../../../frontend/features/ideation/components/base/CheckboxInput/index.js","../../../frontend/features/ideation/components/base/TextInput/index.js","../../../frontend/features/ideation/components/base/InputLengthDisplay/index.js","../../../frontend/features/ideation/components/base/FileInput/index.js","../../../frontend/features/ideation/validations/ideaValidations.js","../../../frontend/features/ideation/enums/sortOrder.js","../../../frontend/features/ideation/components/createIdea/CreateIdeaForm/index.js","../../../frontend/features/ideation/components/createIdea/CreateIdeaModal/index.js","../../../frontend/features/ideation/components/ideaBoard/IdeaBoardActions/index.js","../../../frontend/features/ideation/components/ideaBoard/IdeaBoardHeaderContainer/index.js","../../../frontend/features/ideation/components/ideaBoard/IdeaBoardHeader/index.js","../../../frontend/features/ideation/components/base/SearchInput/index.js","../../../frontend/features/ideation/components/ideaBoard/IdeaBoardSearch/index.js","../../../frontend/features/ideation/components/ideaBoard/IdeaBoardSort/index.js","../../../frontend/features/ideation/utils/userAuthorize.js","../../../frontend/features/ideation/enums/votingTypes.js","../../../frontend/features/ideation/components/ideaActions/VotingWidget/index.js","../../../frontend/features/ideation/enums/propTypes.js","../../../frontend/features/ideation/components/ideaActions/CommentCountWidget/index.js","../../../frontend/features/ideation/enums/flagIdeaReasons.js","../../../frontend/features/ideation/components/ideaActions/FlagIdeaWidgetMenu/index.js","../../../frontend/features/ideation/components/ideaActions/FlagIdeaWidget/index.js","../../../frontend/features/ideation/components/ideaActions/IdeaActionContainer/index.js","../../../frontend/features/common/enums/ModerationStatuses.js","../../../frontend/features/ideation/components/ideaBoard/IdeaCard/WarningMessage/index.js","../../../frontend/features/ideation/components/ideaBoard/IdeaCard/index.js","../../../frontend/features/ideation/components/ideaBoard/IdeaCards/index.js","../../../frontend/features/common/components/Notification/index.js","../../../frontend/features/ideation/components/ideaBoard/ApprovedNotification/index.js","../../../frontend/features/ideation/components/ideaBoard/PendingNotification/index.js","../../../frontend/features/ideation/components/ideaBoard/UserBannedNotification/index.js","../../../frontend/features/ideation/components/ideaBoard/UserSuspendedNotification/index.js","../../../frontend/features/ideation/enums/submissionStatus.js","../../../frontend/features/ideation/enums/userStatusErrors.js","../../../frontend/features/common/hooks/useScrollIntoView.js","../../../frontend/features/ideation/components/ideaBoard/SubmissionNotification/index.js","../../../frontend/features/ideation/components/ideaBoard/ClosedNotification/index.js","../../../frontend/features/ideation/components/ideaBoard/IdeaBoard/index.js","../../../frontend/features/ideation/components/ideaBoard/IdeaBoardContainer/index.js","../../../frontend/features/ideation/components/idea/IdeaHeader/index.js","../../../frontend/features/discussion/enums/sortOrder.js","../../../frontend/features/discussion/enums/reportReason.js","../../../frontend/features/discussion/components/CommentInput/CommentActionBar/index.js","../../../frontend/features/discussion/components/CommentInput/CommentInputToast/index.js","../../../frontend/features/discussion/components/CommentInput/index.js","../../../frontend/features/discussion/utils/index.js","../../../node_modules/date-fns/esm/compareDesc/index.js","../../../frontend/features/discussion/components/DiscussionComment/ReportButton/index.js","../../../frontend/features/discussion/components/DiscussionComment/index.js","../../../frontend/features/discussion/components/DiscussionCommentList/SortOptions/index.js","../../../frontend/features/discussion/components/DiscussionCommentList/index.js","../../../frontend/features/discussion/components/DiscussionBoard/index.js","../../../frontend/features/discussion/components/LoginSection/index.js","../../../frontend/features/discussion/components/ProfileSection/index.js","../../../frontend/features/ideation/components/idea/IdeaContainer/index.js","../../../frontend/features/common/components/PreviewModeBanner/index.js","../../../node_modules/pure-react-carousel/dist/index.es.js","../../../frontend/features/engagement/components/ImageGallery/Thumbnails/index.js","../../../frontend/features/engagement/components/ImageGallery/index.js","../../../frontend/features/engagement/components/Content/Media/index.js","../../../frontend/features/engagement/components/Content/index.js","../../../frontend/features/engagement/components/QuestionContainer/questions/BasicQuestion/inputs/TextInput/index.js","../../../frontend/features/common/components/Textarea/index.js","../../../frontend/features/engagement/components/QuestionContainer/questions/BasicQuestion/inputs/TextareaInput/index.js","../../../frontend/features/engagement/components/QuestionContainer/questions/BasicQuestion/index.js","../../../frontend/features/engagement/components/QuestionContainer/questions/SingleSelectQuestion/index.js","../../../frontend/features/engagement/components/inputs/CheckboxSelectInput/index.js","../../../frontend/features/engagement/components/QuestionContainer/questions/MultiSelectQuestion/index.js","../../../node_modules/react-transition-group/esm/config.js","../../../node_modules/react-transition-group/esm/TransitionGroupContext.js","../../../node_modules/react-transition-group/esm/Transition.js","../../../node_modules/react-transition-group/esm/utils/ChildMapping.js","../../../node_modules/react-transition-group/esm/TransitionGroup.js","../../../node_modules/react-select/animated/dist/react-select-animated.esm.js","../../../frontend/features/engagement/components/QuestionContainer/questions/DropdownQuestion/index.js","../../../frontend/features/engagement/components/QuestionContainer/questions/MatrixQuestion/MatrixInput/Options/index.js","../../../frontend/features/engagement/components/QuestionContainer/questions/MatrixQuestion/MatrixInput/Rows/index.js","../../../frontend/features/engagement/components/QuestionContainer/questions/MatrixQuestion/MatrixInput/index.js","../../../frontend/features/engagement/components/QuestionContainer/questions/MatrixQuestion/index.js","../../../frontend/features/engagement/components/inputs/AnnotationInput/Marker/index.js","../../../frontend/features/engagement/components/inputs/AnnotationInput/Tooltip/index.js","../../../frontend/features/engagement/components/inputs/AnnotationInput/index.js","../../../frontend/features/engagement/components/inputs/GeolocationAnnotationInput/index.js","../../../frontend/features/engagement/components/QuestionContainer/questions/GeolocationQuestion/index.js","../../../node_modules/@babel/runtime/helpers/esm/objectSpread.js","../../../node_modules/invariant/browser.js","../../../node_modules/react-sortable-hoc/dist/react-sortable-hoc.esm.js","../../../frontend/features/engagement/components/inputs/SortableInput/SortableList/SortableItem/index.js","../../../frontend/features/engagement/components/inputs/SortableInput/SortableList/index.js","../../../frontend/features/engagement/components/inputs/SortableInput/MobileSortableList/MobileSortableItem/index.js","../../../frontend/features/engagement/components/inputs/SortableInput/MobileSortableList/index.js","../../../frontend/features/engagement/components/inputs/SortableInput/index.js","../../../frontend/features/engagement/components/inputs/SortableInput/SortableAccessibility/index.js","../../../frontend/features/engagement/components/QuestionContainer/questions/OrderedQuestion/index.js","../../../frontend/features/engagement/components/inputs/ImageAnnotationInput/index.js","../../../frontend/features/engagement/components/QuestionContainer/questions/ImageQuestion/index.js","../../../frontend/features/engagement/components/QuestionContainer/questions/Budget/BudgetMediaModal/index.js","../../../frontend/features/engagement/components/QuestionContainer/questions/Budget/BudgetCheckbox/index.js","../../../frontend/features/engagement/components/QuestionContainer/questions/Budget/BudgetCheckboxGroup/index.js","../../../frontend/features/engagement/components/inputs/BudgetInput/index.js","../../../frontend/features/engagement/components/QuestionContainer/questions/Budget/BudgetBox/index.js","../../../frontend/features/engagement/components/QuestionContainer/questions/Budget/BudgetQuestion/index.js","../../../frontend/features/common/components/NumberInput/index.js","../../../frontend/features/engagement/components/QuestionContainer/questions/NumericQuestion/index.js","../../../frontend/features/common/enums/SliderPosition.js","../../../node_modules/react-slider/dist/es/prod/components/ReactSlider/ReactSlider.mjs","../../../frontend/features/common/components/Slider/index.js","../../../frontend/features/engagement/components/QuestionContainer/questions/SliderQuestion/SliderQuestionInput/index.js","../../../frontend/features/engagement/components/QuestionContainer/questions/SliderQuestion/index.js","../../../node_modules/react-rater/node_modules/react/cjs/react.production.min.js","../../../node_modules/react-rater/node_modules/react/index.js","../../../node_modules/react-rater/lib/star.js","../../../node_modules/react-rater/lib/index.js","../../../frontend/features/engagement/components/QuestionContainer/questions/RatingQuestion/RatingQuestionStar/index.js","../../../frontend/features/engagement/components/QuestionContainer/questions/RatingQuestion/RatingQuestionInput/index.js","../../../frontend/features/engagement/components/QuestionContainer/questions/RatingQuestion/index.js","../../../frontend/features/engagement/components/QuestionContainer/questions/OpenBudgetQuestion/OpenBudgetOverview/index.js","../../../frontend/features/engagement/components/QuestionContainer/questions/OpenBudgetQuestion/OpenBudgetInputsHeader/index.js","../../../frontend/features/common/components/Image/index.js","../../../frontend/features/engagement/components/QuestionContainer/questions/OpenBudgetQuestion/OpenBudgetComparison/index.js","../../../frontend/features/engagement/components/QuestionContainer/questions/OpenBudgetQuestion/OpenBudgetInput/index.js","../../../frontend/features/engagement/components/QuestionContainer/questions/OpenBudgetQuestion/OpenBudgetChartTooltip/index.js","../../../frontend/features/engagement/components/QuestionContainer/questions/OpenBudgetQuestion/OpenBudgetChart/index.js","../../../frontend/features/engagement/components/QuestionContainer/questions/OpenBudgetQuestion/index.js","../../../frontend/features/engagement/components/QuestionContainer/index.js","../../../frontend/features/engagement/components/Block/index.js","../../../frontend/features/engagement/components/Quote/index.js","../../../frontend/features/engagement/components/FingerprintCollectionConsent/index.js","../../../frontend/features/engagement/components/SectionsContainer/Section/index.js","../../../frontend/features/engagement/components/ProgressBarContainer/index.js","../../../frontend/features/engagement/components/QuitConfirmationModal/index.js","../../../frontend/features/common/components/Link/index.js","../../../frontend/features/engagement/components/VisitHubLink/index.js","../../../frontend/features/engagement/components/NavigationContainer/index.js","../../../frontend/features/project/components/Tag/index.js","../../../frontend/features/project/components/DateInfo/index.js","../../../frontend/features/project/components/CallToActionTile/index.js","../../../frontend/features/project/components/EngagementTile/index.js","../../../frontend/features/common/components/QRCodeImage/index.js","../../../frontend/features/engagement/components/CompleteEngagementFooter/index.js","../../../frontend/features/engagement/components/SocialShareModal/index.js","../../../frontend/features/engagement/components/SectionsContainer/index.js","../../../frontend/features/engagement/components/QuitPageContainer/index.js","../../../frontend/features/engagement/components/ClosedPageContainer/index.js","../../../frontend/features/engagement/components/ErrorPageContainer/index.js","../../../frontend/features/engagement/components/EngagementContainer/index.js","../../../frontend/features/announcement/components/AnnouncementHero/index.js","../../../frontend/features/announcement/components/AnnouncementDetails/index.js","../../../frontend/features/common/components/ShowMoreList/index.js","../../../frontend/features/announcement/components/AnnouncementListItem/index.js","../../../frontend/features/announcement/components/AnnouncementSidebar/index.js","../../../frontend/features/announcement/components/AnnouncementContainer/index.js","../../../frontend/features/project/components/Hero/index.js","../../../frontend/features/project/components/IdeaBoardTile/index.js","../../../frontend/features/project/components/DiscussionTopicTile/index.js","../../../frontend/features/project/components/SponsorQuote/index.js","../../../frontend/features/project/components/ProjectDetail/index.js","../../../frontend/features/project/components/ProjectMeta/index.js","../../../frontend/features/project/components/Phases/index.js","../../../frontend/features/project/components/StoryPhases/index.js","../../../frontend/features/project/components/Announcements/index.js","../../../frontend/features/project/components/Events/index.js","../../../node_modules/lodash.startcase/index.js","../../../frontend/features/project/components/Documents/index.js","../../../frontend/features/project/components/Sidebar/index.js","../../../frontend/features/project/components/ProjectContainer/index.js","../../../frontend/features/project/enums/ProjectGrouping.js","../../../frontend/features/project/components/ProjectsContainer/ProjectTile/index.js","../../../frontend/features/project/components/ProjectsContainer/ActiveProjects/SingleList/index.js","../../../frontend/features/project/components/ProjectsContainer/ActiveProjects/CategoryGrouping/index.js","../../../frontend/features/project/components/ProjectsContainer/ActiveProjects/index.js","../../../frontend/features/project/components/ProjectsContainer/CategoryList/CategoryItem/index.js","../../../frontend/features/project/components/ProjectsContainer/CategoryList/index.js","../../../frontend/features/project/components/ProjectsContainer/FinishedProjects/index.js","../../../frontend/features/project/components/ProjectsContainer/Opportunities/index.js","../../../frontend/features/project/components/ProjectsContainer/index.js","../../../frontend/features/project/components/CategoryContainer/index.js","../../../frontend/features/discussionTopic/components/DiscussionTopicHeader/index.js","../../../frontend/features/discussionTopic/components/StayInformed/index.js","../../../frontend/features/discussionTopic/components/CommunityRules/index.js","../../../frontend/features/discussionTopic/components/DiscussionTopic/index.js","../../../frontend/features/discussionTopic/components/DiscussionTopicContainer/index.js","../../../frontend/features/sitemap/components/Sitemap/index.js","../../../frontend/entrypoints/public.js"],"sourcesContent":["import * as React from 'react';\r\nimport Cookies from './Cookies';\r\nvar CookiesContext = React.createContext(new Cookies());\r\nexport var Provider = CookiesContext.Provider, Consumer = CookiesContext.Consumer;\r\nexport default CookiesContext;\r\n","var __extends = (this && this.__extends) || (function () {\r\n var 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 (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n };\r\n return function (d, b) {\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\nimport * as React from 'react';\r\nimport Cookies from 'universal-cookie';\r\nimport { Provider } from './CookiesContext';\r\nvar CookiesProvider = /** @class */ (function (_super) {\r\n __extends(CookiesProvider, _super);\r\n function CookiesProvider(props) {\r\n var _this = _super.call(this, props) || this;\r\n if (props.cookies) {\r\n _this.cookies = props.cookies;\r\n }\r\n else {\r\n _this.cookies = new Cookies();\r\n }\r\n return _this;\r\n }\r\n CookiesProvider.prototype.render = function () {\r\n return React.createElement(Provider, { value: this.cookies }, this.props.children);\r\n };\r\n return CookiesProvider;\r\n}(React.Component));\r\nexport default CookiesProvider;\r\n","import { apiCall } from './helper';\n\nexport const subscribeUser = (name, email, projectId) => {\n const body = {\n data: {\n type: 'subscriber',\n attributes: {\n name,\n email,\n project_id: projectId,\n all_projects: !projectId,\n },\n },\n };\n\n return apiCall('/subscribers', 'POST', JSON.stringify(body));\n};\n","// Helpers\nimport { privateApiUrl } from 'api/v3';\n\nexport function getIdeaBoardUrl(id, { include = ['hero_image', 'project'] } = {}) {\n return privateApiUrl(`idea_boards/${id}`, { include });\n}\n","import { useEffect, useLayoutEffect, useState, useRef, useCallback } from 'react';\nimport useSWR from 'swr';\n\n/*! *****************************************************************************\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\r\nvar __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\nfunction __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\nfunction __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}\n\nvar noop = function () { };\n// Using noop() as the undefined value as undefined can possibly be replaced\n// by something else. Prettier ignore and extra parentheses are necessary here\n// to ensure that tsc doesn't remove the __NOINLINE__ comment.\n// prettier-ignore\nvar UNDEFINED = ( /*#__NOINLINE__*/noop());\nvar OBJECT = Object;\nvar isUndefined = function (v) { return v === UNDEFINED; };\nvar isFunction = function (v) { return typeof v == 'function'; };\nvar STR_UNDEFINED = 'undefined';\n// NOTE: Use function to guarantee it's re-evaluated between jsdom and node runtime for tests.\nvar hasWindow = function () { return typeof window != STR_UNDEFINED; };\n\nvar IS_SERVER = !hasWindow() || 'Deno' in window;\n// React currently throws a warning when using useLayoutEffect on the server.\n// To get around it, we can conditionally useEffect on the server (no-op) and\n// useLayoutEffect in the browser.\nvar useIsomorphicLayoutEffect = IS_SERVER ? useEffect : useLayoutEffect;\n\n// use WeakMap to store the object->key mapping\n// so the objects can be garbage collected.\n// WeakMap uses a hashtable under the hood, so the lookup\n// complexity is almost O(1).\nvar table = new WeakMap();\n// counter of the key\nvar counter = 0;\n// A stable hash implementation that supports:\n// - Fast and ensures unique hash properties\n// - Handles unserializable values\n// - Handles object key ordering\n// - Generates short results\n//\n// This is not a serialization function, and the result is not guaranteed to be\n// parsible.\nvar stableHash = function (arg) {\n var type = typeof arg;\n var constructor = arg && arg.constructor;\n var isDate = constructor == Date;\n var result;\n var index;\n if (OBJECT(arg) === arg && !isDate && constructor != RegExp) {\n // Object/function, not null/date/regexp. Use WeakMap to store the id first.\n // If it's already hashed, directly return the result.\n result = table.get(arg);\n if (result)\n return result;\n // Store the hash first for circular reference detection before entering the\n // recursive `stableHash` calls.\n // For other objects like set and map, we use this id directly as the hash.\n result = ++counter + '~';\n table.set(arg, result);\n if (constructor == Array) {\n // Array.\n result = '@';\n for (index = 0; index < arg.length; index++) {\n result += stableHash(arg[index]) + ',';\n }\n table.set(arg, result);\n }\n if (constructor == OBJECT) {\n // Object, sort keys.\n result = '#';\n var keys = OBJECT.keys(arg).sort();\n while (!isUndefined((index = keys.pop()))) {\n if (!isUndefined(arg[index])) {\n result += index + ':' + stableHash(arg[index]) + ',';\n }\n }\n table.set(arg, result);\n }\n }\n else {\n result = isDate\n ? arg.toJSON()\n : type == 'symbol'\n ? arg.toString()\n : type == 'string'\n ? JSON.stringify(arg)\n : '' + arg;\n }\n return result;\n};\n\nvar serialize = function (key) {\n if (isFunction(key)) {\n try {\n key = key();\n }\n catch (err) {\n // dependencies not ready\n key = '';\n }\n }\n var args = [].concat(key);\n // If key is not falsy, or not an empty array, hash it.\n key =\n typeof key == 'string'\n ? key\n : (Array.isArray(key) ? key.length : key)\n ? stableHash(key)\n : '';\n var infoKey = key ? '$swr$' + key : '';\n return [key, args, infoKey];\n};\n\nvar normalize = function (args) {\n return isFunction(args[1])\n ? [args[0], args[1], args[2] || {}]\n : [args[0], null, (args[1] === null ? args[2] : args[1]) || {}];\n};\n\n// Create a custom hook with a middleware\nvar withMiddleware = function (useSWR, middleware) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var _a = normalize(args), key = _a[0], fn = _a[1], config = _a[2];\n var uses = (config.use || []).concat(middleware);\n return useSWR(key, fn, __assign(__assign({}, config), { use: uses }));\n };\n};\n\n// We have to several type castings here because `useSWRInfinite` is a special\nvar INFINITE_PREFIX = '$inf$';\nvar getFirstPageKey = function (getKey) {\n return serialize(getKey ? getKey(0, null) : null)[0];\n};\nvar unstable_serialize = function (getKey) {\n return INFINITE_PREFIX + getFirstPageKey(getKey);\n};\nvar infinite = (function (useSWRNext) {\n return function (getKey, fn, config) {\n var rerender = useState({})[1];\n var didMountRef = useRef(false);\n var dataRef = useRef();\n var cache = config.cache, _a = config.initialSize, initialSize = _a === void 0 ? 1 : _a, _b = config.revalidateAll, revalidateAll = _b === void 0 ? false : _b, _c = config.persistSize, persistSize = _c === void 0 ? false : _c, _d = config.revalidateFirstPage, revalidateFirstPage = _d === void 0 ? true : _d, _e = config.revalidateOnMount, revalidateOnMount = _e === void 0 ? false : _e;\n // The serialized key of the first page.\n var firstPageKey = null;\n try {\n firstPageKey = getFirstPageKey(getKey);\n }\n catch (err) {\n // not ready\n }\n // We use cache to pass extra info (context) to fetcher so it can be globally\n // shared. The key of the context data is based on the first page key.\n var contextCacheKey = null;\n // Page size is also cached to share the page data between hooks with the\n // same key.\n var pageSizeCacheKey = null;\n if (firstPageKey) {\n contextCacheKey = '$ctx$' + firstPageKey;\n pageSizeCacheKey = '$len$' + firstPageKey;\n }\n var resolvePageSize = useCallback(function () {\n var cachedPageSize = cache.get(pageSizeCacheKey);\n return isUndefined(cachedPageSize) ? initialSize : cachedPageSize;\n // `cache` isn't allowed to change during the lifecycle\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [pageSizeCacheKey, initialSize]);\n // keep the last page size to restore it with the persistSize option\n var lastPageSizeRef = useRef(resolvePageSize());\n // When the page key changes, we reset the page size if it's not persisted\n useIsomorphicLayoutEffect(function () {\n if (!didMountRef.current) {\n didMountRef.current = true;\n return;\n }\n if (firstPageKey) {\n // If the key has been changed, we keep the current page size if persistSize is enabled\n cache.set(pageSizeCacheKey, persistSize ? lastPageSizeRef.current : initialSize);\n }\n // `initialSize` isn't allowed to change during the lifecycle\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [firstPageKey]);\n // Needs to check didMountRef during mounting, not in the fetcher\n var shouldRevalidateOnMount = revalidateOnMount && !didMountRef.current;\n // Actual SWR hook to load all pages in one fetcher.\n var swr = useSWRNext(firstPageKey ? INFINITE_PREFIX + firstPageKey : null, function () { return __awaiter(void 0, void 0, void 0, function () {\n var _a, forceRevalidateAll, originalData, data, pageSize, previousPageData, i, _b, pageKey, pageArgs, pageData, shouldFetchPage;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n _a = cache.get(contextCacheKey) || [], forceRevalidateAll = _a[0], originalData = _a[1];\n data = [];\n pageSize = resolvePageSize();\n previousPageData = null;\n i = 0;\n _c.label = 1;\n case 1:\n if (!(i < pageSize)) return [3 /*break*/, 5];\n _b = serialize(getKey(i, previousPageData)), pageKey = _b[0], pageArgs = _b[1];\n if (!pageKey) {\n // `pageKey` is falsy, stop fetching new pages.\n return [3 /*break*/, 5];\n }\n pageData = cache.get(pageKey);\n shouldFetchPage = revalidateAll ||\n forceRevalidateAll ||\n isUndefined(pageData) ||\n (revalidateFirstPage && !i && !isUndefined(dataRef.current)) ||\n shouldRevalidateOnMount ||\n (originalData &&\n !isUndefined(originalData[i]) &&\n !config.compare(originalData[i], pageData));\n if (!(fn && shouldFetchPage)) return [3 /*break*/, 3];\n return [4 /*yield*/, fn.apply(void 0, pageArgs)];\n case 2:\n pageData = _c.sent();\n cache.set(pageKey, pageData);\n _c.label = 3;\n case 3:\n data.push(pageData);\n previousPageData = pageData;\n _c.label = 4;\n case 4:\n ++i;\n return [3 /*break*/, 1];\n case 5:\n // once we executed the data fetching based on the context, clear the context\n cache.delete(contextCacheKey);\n // return the data\n return [2 /*return*/, data];\n }\n });\n }); }, config);\n // update dataRef\n useIsomorphicLayoutEffect(function () {\n dataRef.current = swr.data;\n }, [swr.data]);\n var mutate = useCallback(function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var data = args[0];\n // Default to true.\n var shouldRevalidate = args[1] !== false;\n // It is possible that the key is still falsy.\n if (!contextCacheKey)\n return;\n if (shouldRevalidate) {\n if (!isUndefined(data)) {\n // We only revalidate the pages that are changed\n var originalData = dataRef.current;\n cache.set(contextCacheKey, [false, originalData]);\n }\n else {\n // Calling `mutate()`, we revalidate all pages\n cache.set(contextCacheKey, [true]);\n }\n }\n return args.length ? swr.mutate(data, shouldRevalidate) : swr.mutate();\n }, \n // swr.mutate is always the same reference\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [contextCacheKey]);\n // Function to load pages data from the cache based on the page size.\n var resolvePagesFromCache = function (pageSize) {\n // return an array of page data\n var data = [];\n var previousPageData = null;\n for (var i = 0; i < pageSize; ++i) {\n var pageKey = serialize(getKey(i, previousPageData))[0];\n // Get the cached page data.\n var pageData = pageKey ? cache.get(pageKey) : UNDEFINED;\n // Return the current data if we can't get it from the cache.\n if (isUndefined(pageData))\n return dataRef.current;\n data.push(pageData);\n previousPageData = pageData;\n }\n // Return the data\n return data;\n };\n // Extend the SWR API\n var setSize = useCallback(function (arg) {\n // It is possible that the key is still falsy.\n if (!pageSizeCacheKey)\n return;\n var size;\n if (isFunction(arg)) {\n size = arg(resolvePageSize());\n }\n else if (typeof arg == 'number') {\n size = arg;\n }\n if (typeof size != 'number')\n return;\n cache.set(pageSizeCacheKey, size);\n lastPageSizeRef.current = size;\n rerender({});\n return mutate(resolvePagesFromCache(size));\n }, \n // `cache` and `rerender` isn't allowed to change during the lifecycle\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [pageSizeCacheKey, resolvePageSize, mutate]);\n // Use getter functions to avoid unnecessary re-renders caused by triggering\n // all the getters of the returned swr object.\n return {\n size: resolvePageSize(),\n setSize: setSize,\n mutate: mutate,\n get error() {\n return swr.error;\n },\n get data() {\n return swr.data;\n },\n get isValidating() {\n return swr.isValidating;\n }\n };\n };\n});\nvar index = withMiddleware(useSWR, infinite);\n\nexport { index as default, infinite, unstable_serialize };\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.browserSupportsPolyfills = exports.compareTwoStringsUsingDiceCoefficient = exports.commandToRegExp = exports.concatTranscripts = exports.debounce = void 0;\n\nvar debounce = function debounce(func, wait, immediate) {\n var timeout;\n return function () {\n var context = this;\n var args = arguments;\n\n var later = function later() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n};\n\nexports.debounce = debounce;\n\nvar concatTranscripts = function concatTranscripts() {\n for (var _len = arguments.length, transcriptParts = new Array(_len), _key = 0; _key < _len; _key++) {\n transcriptParts[_key] = arguments[_key];\n }\n\n return transcriptParts.map(function (t) {\n return t.trim();\n }).join(' ').trim();\n}; // The command matching code is a modified version of Backbone.Router by Jeremy Ashkenas, under the MIT license.\n\n\nexports.concatTranscripts = concatTranscripts;\nvar optionalParam = /\\s*\\((.*?)\\)\\s*/g;\nvar optionalRegex = /(\\(\\?:[^)]+\\))\\?/g;\nvar namedParam = /(\\(\\?)?:\\w+/g;\nvar splatParam = /\\*/g;\nvar escapeRegExp = /[-{}[\\]+?.,\\\\^$|#]/g;\n\nvar commandToRegExp = function commandToRegExp(command) {\n if (command instanceof RegExp) {\n return new RegExp(command.source, 'i');\n }\n\n command = command.replace(escapeRegExp, '\\\\$&').replace(optionalParam, '(?:$1)?').replace(namedParam, function (match, optional) {\n return optional ? match : '([^\\\\s]+)';\n }).replace(splatParam, '(.*?)').replace(optionalRegex, '\\\\s*$1?\\\\s*');\n return new RegExp('^' + command + '$', 'i');\n}; // this is from https://github.com/aceakash/string-similarity\n\n\nexports.commandToRegExp = commandToRegExp;\n\nvar compareTwoStringsUsingDiceCoefficient = function compareTwoStringsUsingDiceCoefficient(first, second) {\n first = first.replace(/\\s+/g, '').toLowerCase();\n second = second.replace(/\\s+/g, '').toLowerCase();\n if (!first.length && !second.length) return 1; // if both are empty strings\n\n if (!first.length || !second.length) return 0; // if only one is empty string\n\n if (first === second) return 1; // identical\n\n if (first.length === 1 && second.length === 1) return 0; // both are 1-letter strings\n\n if (first.length < 2 || second.length < 2) return 0; // if either is a 1-letter string\n\n var firstBigrams = new Map();\n\n for (var i = 0; i < first.length - 1; i++) {\n var bigram = first.substring(i, i + 2);\n var count = firstBigrams.has(bigram) ? firstBigrams.get(bigram) + 1 : 1;\n firstBigrams.set(bigram, count);\n }\n\n var intersectionSize = 0;\n\n for (var _i = 0; _i < second.length - 1; _i++) {\n var _bigram = second.substring(_i, _i + 2);\n\n var _count = firstBigrams.has(_bigram) ? firstBigrams.get(_bigram) : 0;\n\n if (_count > 0) {\n firstBigrams.set(_bigram, _count - 1);\n intersectionSize++;\n }\n }\n\n return 2.0 * intersectionSize / (first.length + second.length - 2);\n};\n\nexports.compareTwoStringsUsingDiceCoefficient = compareTwoStringsUsingDiceCoefficient;\n\nvar browserSupportsPolyfills = function browserSupportsPolyfills() {\n return typeof window !== 'undefined' && window.navigator !== undefined && window.navigator.mediaDevices !== undefined && window.navigator.mediaDevices.getUserMedia !== undefined && (window.AudioContext !== undefined || window.webkitAudioContext !== undefined);\n};\n\nexports.browserSupportsPolyfills = browserSupportsPolyfills;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.APPEND_TRANSCRIPT = exports.CLEAR_TRANSCRIPT = void 0;\nvar CLEAR_TRANSCRIPT = 'CLEAR_TRANSCRIPT';\nexports.CLEAR_TRANSCRIPT = CLEAR_TRANSCRIPT;\nvar APPEND_TRANSCRIPT = 'APPEND_TRANSCRIPT';\nexports.APPEND_TRANSCRIPT = APPEND_TRANSCRIPT;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.appendTranscript = exports.clearTranscript = void 0;\n\nvar _constants = require(\"./constants\");\n\nvar clearTranscript = function clearTranscript() {\n return {\n type: _constants.CLEAR_TRANSCRIPT\n };\n};\n\nexports.clearTranscript = clearTranscript;\n\nvar appendTranscript = function appendTranscript(interimTranscript, finalTranscript) {\n return {\n type: _constants.APPEND_TRANSCRIPT,\n payload: {\n interimTranscript: interimTranscript,\n finalTranscript: finalTranscript\n }\n };\n};\n\nexports.appendTranscript = appendTranscript;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.transcriptReducer = void 0;\n\nvar _constants = require(\"./constants\");\n\nvar _utils = require(\"./utils\");\n\nvar transcriptReducer = function transcriptReducer(state, action) {\n switch (action.type) {\n case _constants.CLEAR_TRANSCRIPT:\n return {\n interimTranscript: '',\n finalTranscript: ''\n };\n\n case _constants.APPEND_TRANSCRIPT:\n return {\n interimTranscript: action.payload.interimTranscript,\n finalTranscript: (0, _utils.concatTranscripts)(state.finalTranscript, action.payload.finalTranscript)\n };\n\n default:\n throw new Error();\n }\n};\n\nexports.transcriptReducer = transcriptReducer;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\n\nvar _default = function _default() {\n return /(android)/i.test(typeof navigator !== 'undefined' ? navigator.userAgent : '');\n};\n\nexports[\"default\"] = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = exports.isNative = void 0;\nvar NativeSpeechRecognition = typeof window !== 'undefined' && (window.SpeechRecognition || window.webkitSpeechRecognition || window.mozSpeechRecognition || window.msSpeechRecognition || window.oSpeechRecognition);\n\nvar isNative = function isNative(SpeechRecognition) {\n return SpeechRecognition === NativeSpeechRecognition;\n};\n\nexports.isNative = isNative;\nvar _default = NativeSpeechRecognition;\nexports[\"default\"] = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\n\nvar _isAndroid = _interopRequireDefault(require(\"./isAndroid\"));\n\nvar _utils = require(\"./utils\");\n\nvar _NativeSpeechRecognition = require(\"./NativeSpeechRecognition\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\n\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nvar RecognitionManager = /*#__PURE__*/function () {\n function RecognitionManager(SpeechRecognition) {\n _classCallCheck(this, RecognitionManager);\n\n this.recognition = null;\n this.pauseAfterDisconnect = false;\n this.interimTranscript = '';\n this.finalTranscript = '';\n this.listening = false;\n this.isMicrophoneAvailable = true;\n this.subscribers = {};\n\n this.onStopListening = function () {};\n\n this.previousResultWasFinalOnly = false;\n this.resetTranscript = this.resetTranscript.bind(this);\n this.startListening = this.startListening.bind(this);\n this.stopListening = this.stopListening.bind(this);\n this.abortListening = this.abortListening.bind(this);\n this.setSpeechRecognition = this.setSpeechRecognition.bind(this);\n this.disableRecognition = this.disableRecognition.bind(this);\n this.setSpeechRecognition(SpeechRecognition);\n\n if ((0, _isAndroid[\"default\"])()) {\n this.updateFinalTranscript = (0, _utils.debounce)(this.updateFinalTranscript, 250, true);\n }\n }\n\n _createClass(RecognitionManager, [{\n key: \"setSpeechRecognition\",\n value: function setSpeechRecognition(SpeechRecognition) {\n var browserSupportsRecogniser = !!SpeechRecognition && ((0, _NativeSpeechRecognition.isNative)(SpeechRecognition) || (0, _utils.browserSupportsPolyfills)());\n\n if (browserSupportsRecogniser) {\n this.disableRecognition();\n this.recognition = new SpeechRecognition();\n this.recognition.continuous = false;\n this.recognition.interimResults = true;\n this.recognition.onresult = this.updateTranscript.bind(this);\n this.recognition.onend = this.onRecognitionDisconnect.bind(this);\n this.recognition.onerror = this.onError.bind(this);\n }\n\n this.emitBrowserSupportsSpeechRecognitionChange(browserSupportsRecogniser);\n }\n }, {\n key: \"subscribe\",\n value: function subscribe(id, callbacks) {\n this.subscribers[id] = callbacks;\n }\n }, {\n key: \"unsubscribe\",\n value: function unsubscribe(id) {\n delete this.subscribers[id];\n }\n }, {\n key: \"emitListeningChange\",\n value: function emitListeningChange(listening) {\n var _this = this;\n\n this.listening = listening;\n Object.keys(this.subscribers).forEach(function (id) {\n var onListeningChange = _this.subscribers[id].onListeningChange;\n onListeningChange(listening);\n });\n }\n }, {\n key: \"emitMicrophoneAvailabilityChange\",\n value: function emitMicrophoneAvailabilityChange(isMicrophoneAvailable) {\n var _this2 = this;\n\n this.isMicrophoneAvailable = isMicrophoneAvailable;\n Object.keys(this.subscribers).forEach(function (id) {\n var onMicrophoneAvailabilityChange = _this2.subscribers[id].onMicrophoneAvailabilityChange;\n onMicrophoneAvailabilityChange(isMicrophoneAvailable);\n });\n }\n }, {\n key: \"emitTranscriptChange\",\n value: function emitTranscriptChange(interimTranscript, finalTranscript) {\n var _this3 = this;\n\n Object.keys(this.subscribers).forEach(function (id) {\n var onTranscriptChange = _this3.subscribers[id].onTranscriptChange;\n onTranscriptChange(interimTranscript, finalTranscript);\n });\n }\n }, {\n key: \"emitClearTranscript\",\n value: function emitClearTranscript() {\n var _this4 = this;\n\n Object.keys(this.subscribers).forEach(function (id) {\n var onClearTranscript = _this4.subscribers[id].onClearTranscript;\n onClearTranscript();\n });\n }\n }, {\n key: \"emitBrowserSupportsSpeechRecognitionChange\",\n value: function emitBrowserSupportsSpeechRecognitionChange(browserSupportsSpeechRecognitionChange) {\n var _this5 = this;\n\n Object.keys(this.subscribers).forEach(function (id) {\n var _this5$subscribers$id = _this5.subscribers[id],\n onBrowserSupportsSpeechRecognitionChange = _this5$subscribers$id.onBrowserSupportsSpeechRecognitionChange,\n onBrowserSupportsContinuousListeningChange = _this5$subscribers$id.onBrowserSupportsContinuousListeningChange;\n onBrowserSupportsSpeechRecognitionChange(browserSupportsSpeechRecognitionChange);\n onBrowserSupportsContinuousListeningChange(browserSupportsSpeechRecognitionChange);\n });\n }\n }, {\n key: \"disconnect\",\n value: function disconnect(disconnectType) {\n if (this.recognition && this.listening) {\n switch (disconnectType) {\n case 'ABORT':\n this.pauseAfterDisconnect = true;\n this.abort();\n break;\n\n case 'RESET':\n this.pauseAfterDisconnect = false;\n this.abort();\n break;\n\n case 'STOP':\n default:\n this.pauseAfterDisconnect = true;\n this.stop();\n }\n }\n }\n }, {\n key: \"disableRecognition\",\n value: function disableRecognition() {\n if (this.recognition) {\n this.recognition.onresult = function () {};\n\n this.recognition.onend = function () {};\n\n this.recognition.onerror = function () {};\n\n if (this.listening) {\n this.stopListening();\n }\n }\n }\n }, {\n key: \"onError\",\n value: function onError(event) {\n if (event && event.error && event.error === 'not-allowed') {\n this.emitMicrophoneAvailabilityChange(false);\n this.disableRecognition();\n }\n }\n }, {\n key: \"onRecognitionDisconnect\",\n value: function onRecognitionDisconnect() {\n this.onStopListening();\n this.listening = false;\n\n if (this.pauseAfterDisconnect) {\n this.emitListeningChange(false);\n } else if (this.recognition) {\n if (this.recognition.continuous) {\n this.startListening({\n continuous: this.recognition.continuous\n });\n } else {\n this.emitListeningChange(false);\n }\n }\n\n this.pauseAfterDisconnect = false;\n }\n }, {\n key: \"updateTranscript\",\n value: function updateTranscript(_ref) {\n var results = _ref.results,\n resultIndex = _ref.resultIndex;\n var currentIndex = resultIndex === undefined ? results.length - 1 : resultIndex;\n this.interimTranscript = '';\n this.finalTranscript = '';\n\n for (var i = currentIndex; i < results.length; ++i) {\n if (results[i].isFinal && (!(0, _isAndroid[\"default\"])() || results[i][0].confidence > 0)) {\n this.updateFinalTranscript(results[i][0].transcript);\n } else {\n this.interimTranscript = (0, _utils.concatTranscripts)(this.interimTranscript, results[i][0].transcript);\n }\n }\n\n var isDuplicateResult = false;\n\n if (this.interimTranscript === '' && this.finalTranscript !== '') {\n if (this.previousResultWasFinalOnly) {\n isDuplicateResult = true;\n }\n\n this.previousResultWasFinalOnly = true;\n } else {\n this.previousResultWasFinalOnly = false;\n }\n\n if (!isDuplicateResult) {\n this.emitTranscriptChange(this.interimTranscript, this.finalTranscript);\n }\n }\n }, {\n key: \"updateFinalTranscript\",\n value: function updateFinalTranscript(newFinalTranscript) {\n this.finalTranscript = (0, _utils.concatTranscripts)(this.finalTranscript, newFinalTranscript);\n }\n }, {\n key: \"resetTranscript\",\n value: function resetTranscript() {\n this.disconnect('RESET');\n }\n }, {\n key: \"startListening\",\n value: function () {\n var _startListening = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {\n var _ref2,\n _ref2$continuous,\n continuous,\n language,\n isContinuousChanged,\n isLanguageChanged,\n _args = arguments;\n\n return regeneratorRuntime.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _ref2 = _args.length > 0 && _args[0] !== undefined ? _args[0] : {}, _ref2$continuous = _ref2.continuous, continuous = _ref2$continuous === void 0 ? false : _ref2$continuous, language = _ref2.language;\n\n if (this.recognition) {\n _context.next = 3;\n break;\n }\n\n return _context.abrupt(\"return\");\n\n case 3:\n isContinuousChanged = continuous !== this.recognition.continuous;\n isLanguageChanged = language && language !== this.recognition.lang;\n\n if (!(isContinuousChanged || isLanguageChanged)) {\n _context.next = 11;\n break;\n }\n\n if (!this.listening) {\n _context.next = 9;\n break;\n }\n\n _context.next = 9;\n return this.stopListening();\n\n case 9:\n this.recognition.continuous = isContinuousChanged ? continuous : this.recognition.continuous;\n this.recognition.lang = isLanguageChanged ? language : this.recognition.lang;\n\n case 11:\n if (this.listening) {\n _context.next = 22;\n break;\n }\n\n if (!this.recognition.continuous) {\n this.resetTranscript();\n this.emitClearTranscript();\n }\n\n _context.prev = 13;\n _context.next = 16;\n return this.start();\n\n case 16:\n this.emitListeningChange(true);\n _context.next = 22;\n break;\n\n case 19:\n _context.prev = 19;\n _context.t0 = _context[\"catch\"](13);\n\n // DOMExceptions indicate a redundant microphone start - safe to swallow\n if (!(_context.t0 instanceof DOMException)) {\n this.emitMicrophoneAvailabilityChange(false);\n }\n\n case 22:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this, [[13, 19]]);\n }));\n\n function startListening() {\n return _startListening.apply(this, arguments);\n }\n\n return startListening;\n }()\n }, {\n key: \"abortListening\",\n value: function () {\n var _abortListening = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {\n var _this6 = this;\n\n return regeneratorRuntime.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n this.disconnect('ABORT');\n this.emitListeningChange(false);\n _context2.next = 4;\n return new Promise(function (resolve) {\n _this6.onStopListening = resolve;\n });\n\n case 4:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2, this);\n }));\n\n function abortListening() {\n return _abortListening.apply(this, arguments);\n }\n\n return abortListening;\n }()\n }, {\n key: \"stopListening\",\n value: function () {\n var _stopListening = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {\n var _this7 = this;\n\n return regeneratorRuntime.wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n this.disconnect('STOP');\n this.emitListeningChange(false);\n _context3.next = 4;\n return new Promise(function (resolve) {\n _this7.onStopListening = resolve;\n });\n\n case 4:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3, this);\n }));\n\n function stopListening() {\n return _stopListening.apply(this, arguments);\n }\n\n return stopListening;\n }()\n }, {\n key: \"getRecognition\",\n value: function getRecognition() {\n return this.recognition;\n }\n }, {\n key: \"start\",\n value: function () {\n var _start = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {\n return regeneratorRuntime.wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n if (!(this.recognition && !this.listening)) {\n _context4.next = 4;\n break;\n }\n\n _context4.next = 3;\n return this.recognition.start();\n\n case 3:\n this.listening = true;\n\n case 4:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4, this);\n }));\n\n function start() {\n return _start.apply(this, arguments);\n }\n\n return start;\n }()\n }, {\n key: \"stop\",\n value: function stop() {\n if (this.recognition && this.listening) {\n this.recognition.stop();\n this.listening = false;\n }\n }\n }, {\n key: \"abort\",\n value: function abort() {\n if (this.recognition && this.listening) {\n this.recognition.abort();\n this.listening = false;\n }\n }\n }]);\n\n return RecognitionManager;\n}();\n\nexports[\"default\"] = RecognitionManager;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = exports.useSpeechRecognition = void 0;\n\nvar _react = require(\"react\");\n\nvar _utils = require(\"./utils\");\n\nvar _actions = require(\"./actions\");\n\nvar _reducers = require(\"./reducers\");\n\nvar _RecognitionManager = _interopRequireDefault(require(\"./RecognitionManager\"));\n\nvar _isAndroid = _interopRequireDefault(require(\"./isAndroid\"));\n\nvar _NativeSpeechRecognition = _interopRequireDefault(require(\"./NativeSpeechRecognition\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\n\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\n\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\n\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter); }\n\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _iterableToArrayLimit(arr, i) { if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nvar _browserSupportsSpeechRecognition = !!_NativeSpeechRecognition[\"default\"];\n\nvar _browserSupportsContinuousListening = _browserSupportsSpeechRecognition && !(0, _isAndroid[\"default\"])();\n\nvar recognitionManager;\n\nvar useSpeechRecognition = function useSpeechRecognition() {\n var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n _ref$transcribing = _ref.transcribing,\n transcribing = _ref$transcribing === void 0 ? true : _ref$transcribing,\n _ref$clearTranscriptO = _ref.clearTranscriptOnListen,\n clearTranscriptOnListen = _ref$clearTranscriptO === void 0 ? true : _ref$clearTranscriptO,\n _ref$commands = _ref.commands,\n commands = _ref$commands === void 0 ? [] : _ref$commands;\n\n var _useState = (0, _react.useState)(SpeechRecognition.getRecognitionManager()),\n _useState2 = _slicedToArray(_useState, 1),\n recognitionManager = _useState2[0];\n\n var _useState3 = (0, _react.useState)(_browserSupportsSpeechRecognition),\n _useState4 = _slicedToArray(_useState3, 2),\n browserSupportsSpeechRecognition = _useState4[0],\n setBrowserSupportsSpeechRecognition = _useState4[1];\n\n var _useState5 = (0, _react.useState)(_browserSupportsContinuousListening),\n _useState6 = _slicedToArray(_useState5, 2),\n browserSupportsContinuousListening = _useState6[0],\n setBrowserSupportsContinuousListening = _useState6[1];\n\n var _useReducer = (0, _react.useReducer)(_reducers.transcriptReducer, {\n interimTranscript: recognitionManager.interimTranscript,\n finalTranscript: ''\n }),\n _useReducer2 = _slicedToArray(_useReducer, 2),\n _useReducer2$ = _useReducer2[0],\n interimTranscript = _useReducer2$.interimTranscript,\n finalTranscript = _useReducer2$.finalTranscript,\n dispatch = _useReducer2[1];\n\n var _useState7 = (0, _react.useState)(recognitionManager.listening),\n _useState8 = _slicedToArray(_useState7, 2),\n listening = _useState8[0],\n setListening = _useState8[1];\n\n var _useState9 = (0, _react.useState)(recognitionManager.isMicrophoneAvailable),\n _useState10 = _slicedToArray(_useState9, 2),\n isMicrophoneAvailable = _useState10[0],\n setMicrophoneAvailable = _useState10[1];\n\n var commandsRef = (0, _react.useRef)(commands);\n commandsRef.current = commands;\n\n var dispatchClearTranscript = function dispatchClearTranscript() {\n dispatch((0, _actions.clearTranscript)());\n };\n\n var resetTranscript = (0, _react.useCallback)(function () {\n recognitionManager.resetTranscript();\n dispatchClearTranscript();\n }, [recognitionManager]);\n\n var testFuzzyMatch = function testFuzzyMatch(command, input, fuzzyMatchingThreshold) {\n var commandToString = _typeof(command) === 'object' ? command.toString() : command;\n var commandWithoutSpecials = commandToString.replace(/[&/\\\\#,+()!$~%.'\":*?<>{}]/g, '').replace(/ +/g, ' ').trim();\n var howSimilar = (0, _utils.compareTwoStringsUsingDiceCoefficient)(commandWithoutSpecials, input);\n\n if (howSimilar >= fuzzyMatchingThreshold) {\n return {\n command: command,\n commandWithoutSpecials: commandWithoutSpecials,\n howSimilar: howSimilar,\n isFuzzyMatch: true\n };\n }\n\n return null;\n };\n\n var testMatch = function testMatch(command, input) {\n var pattern = (0, _utils.commandToRegExp)(command);\n var result = pattern.exec(input);\n\n if (result) {\n return {\n command: command,\n parameters: result.slice(1)\n };\n }\n\n return null;\n };\n\n var matchCommands = (0, _react.useCallback)(function (newInterimTranscript, newFinalTranscript) {\n commandsRef.current.forEach(function (_ref2) {\n var command = _ref2.command,\n callback = _ref2.callback,\n _ref2$matchInterim = _ref2.matchInterim,\n matchInterim = _ref2$matchInterim === void 0 ? false : _ref2$matchInterim,\n _ref2$isFuzzyMatch = _ref2.isFuzzyMatch,\n isFuzzyMatch = _ref2$isFuzzyMatch === void 0 ? false : _ref2$isFuzzyMatch,\n _ref2$fuzzyMatchingTh = _ref2.fuzzyMatchingThreshold,\n fuzzyMatchingThreshold = _ref2$fuzzyMatchingTh === void 0 ? 0.8 : _ref2$fuzzyMatchingTh,\n _ref2$bestMatchOnly = _ref2.bestMatchOnly,\n bestMatchOnly = _ref2$bestMatchOnly === void 0 ? false : _ref2$bestMatchOnly;\n var input = !newFinalTranscript && matchInterim ? newInterimTranscript.trim() : newFinalTranscript.trim();\n var subcommands = Array.isArray(command) ? command : [command];\n var results = subcommands.map(function (subcommand) {\n if (isFuzzyMatch) {\n return testFuzzyMatch(subcommand, input, fuzzyMatchingThreshold);\n }\n\n return testMatch(subcommand, input);\n }).filter(function (x) {\n return x;\n });\n\n if (isFuzzyMatch && bestMatchOnly && results.length >= 2) {\n results.sort(function (a, b) {\n return b.howSimilar - a.howSimilar;\n });\n var _results$ = results[0],\n _command = _results$.command,\n commandWithoutSpecials = _results$.commandWithoutSpecials,\n howSimilar = _results$.howSimilar;\n callback(commandWithoutSpecials, input, howSimilar, {\n command: _command,\n resetTranscript: resetTranscript\n });\n } else {\n results.forEach(function (result) {\n if (result.isFuzzyMatch) {\n var _command2 = result.command,\n _commandWithoutSpecials = result.commandWithoutSpecials,\n _howSimilar = result.howSimilar;\n callback(_commandWithoutSpecials, input, _howSimilar, {\n command: _command2,\n resetTranscript: resetTranscript\n });\n } else {\n var _command3 = result.command,\n parameters = result.parameters;\n callback.apply(void 0, _toConsumableArray(parameters).concat([{\n command: _command3,\n resetTranscript: resetTranscript\n }]));\n }\n });\n }\n });\n }, [resetTranscript]);\n var handleTranscriptChange = (0, _react.useCallback)(function (newInterimTranscript, newFinalTranscript) {\n if (transcribing) {\n dispatch((0, _actions.appendTranscript)(newInterimTranscript, newFinalTranscript));\n }\n\n matchCommands(newInterimTranscript, newFinalTranscript);\n }, [matchCommands, transcribing]);\n var handleClearTranscript = (0, _react.useCallback)(function () {\n if (clearTranscriptOnListen) {\n dispatchClearTranscript();\n }\n }, [clearTranscriptOnListen]);\n (0, _react.useEffect)(function () {\n var id = SpeechRecognition.counter;\n SpeechRecognition.counter += 1;\n var callbacks = {\n onListeningChange: setListening,\n onMicrophoneAvailabilityChange: setMicrophoneAvailable,\n onTranscriptChange: handleTranscriptChange,\n onClearTranscript: handleClearTranscript,\n onBrowserSupportsSpeechRecognitionChange: setBrowserSupportsSpeechRecognition,\n onBrowserSupportsContinuousListeningChange: setBrowserSupportsContinuousListening\n };\n recognitionManager.subscribe(id, callbacks);\n return function () {\n recognitionManager.unsubscribe(id);\n };\n }, [transcribing, clearTranscriptOnListen, recognitionManager, handleTranscriptChange, handleClearTranscript]);\n var transcript = (0, _utils.concatTranscripts)(finalTranscript, interimTranscript);\n return {\n transcript: transcript,\n interimTranscript: interimTranscript,\n finalTranscript: finalTranscript,\n listening: listening,\n isMicrophoneAvailable: isMicrophoneAvailable,\n resetTranscript: resetTranscript,\n browserSupportsSpeechRecognition: browserSupportsSpeechRecognition,\n browserSupportsContinuousListening: browserSupportsContinuousListening\n };\n};\n\nexports.useSpeechRecognition = useSpeechRecognition;\nvar SpeechRecognition = {\n counter: 0,\n applyPolyfill: function applyPolyfill(PolyfillSpeechRecognition) {\n if (recognitionManager) {\n recognitionManager.setSpeechRecognition(PolyfillSpeechRecognition);\n } else {\n recognitionManager = new _RecognitionManager[\"default\"](PolyfillSpeechRecognition);\n }\n\n var browserSupportsPolyfill = !!PolyfillSpeechRecognition && (0, _utils.browserSupportsPolyfills)();\n _browserSupportsSpeechRecognition = browserSupportsPolyfill;\n _browserSupportsContinuousListening = browserSupportsPolyfill;\n },\n removePolyfill: function removePolyfill() {\n if (recognitionManager) {\n recognitionManager.setSpeechRecognition(_NativeSpeechRecognition[\"default\"]);\n } else {\n recognitionManager = new _RecognitionManager[\"default\"](_NativeSpeechRecognition[\"default\"]);\n }\n\n _browserSupportsSpeechRecognition = !!_NativeSpeechRecognition[\"default\"];\n _browserSupportsContinuousListening = _browserSupportsSpeechRecognition && !(0, _isAndroid[\"default\"])();\n },\n getRecognitionManager: function getRecognitionManager() {\n if (!recognitionManager) {\n recognitionManager = new _RecognitionManager[\"default\"](_NativeSpeechRecognition[\"default\"]);\n }\n\n return recognitionManager;\n },\n getRecognition: function getRecognition() {\n var recognitionManager = SpeechRecognition.getRecognitionManager();\n return recognitionManager.getRecognition();\n },\n startListening: function () {\n var _startListening = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {\n var _ref3,\n continuous,\n language,\n recognitionManager,\n _args = arguments;\n\n return regeneratorRuntime.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _ref3 = _args.length > 0 && _args[0] !== undefined ? _args[0] : {}, continuous = _ref3.continuous, language = _ref3.language;\n recognitionManager = SpeechRecognition.getRecognitionManager();\n _context.next = 4;\n return recognitionManager.startListening({\n continuous: continuous,\n language: language\n });\n\n case 4:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n\n function startListening() {\n return _startListening.apply(this, arguments);\n }\n\n return startListening;\n }(),\n stopListening: function () {\n var _stopListening = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {\n var recognitionManager;\n return regeneratorRuntime.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n recognitionManager = SpeechRecognition.getRecognitionManager();\n _context2.next = 3;\n return recognitionManager.stopListening();\n\n case 3:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2);\n }));\n\n function stopListening() {\n return _stopListening.apply(this, arguments);\n }\n\n return stopListening;\n }(),\n abortListening: function () {\n var _abortListening = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {\n var recognitionManager;\n return regeneratorRuntime.wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n recognitionManager = SpeechRecognition.getRecognitionManager();\n _context3.next = 3;\n return recognitionManager.abortListening();\n\n case 3:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3);\n }));\n\n function abortListening() {\n return _abortListening.apply(this, arguments);\n }\n\n return abortListening;\n }(),\n browserSupportsSpeechRecognition: function browserSupportsSpeechRecognition() {\n return _browserSupportsSpeechRecognition;\n },\n browserSupportsContinuousListening: function browserSupportsContinuousListening() {\n return _browserSupportsContinuousListening;\n }\n};\nvar _default = SpeechRecognition;\nexports[\"default\"] = _default;","\"use strict\";\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"useSpeechRecognition\", {\n enumerable: true,\n get: function get() {\n return _SpeechRecognition.useSpeechRecognition;\n }\n});\nexports[\"default\"] = void 0;\n\nvar _SpeechRecognition = _interopRequireWildcard(require(\"./SpeechRecognition\"));\n\nfunction _getRequireWildcardCache() { if (typeof WeakMap !== \"function\") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== \"object\" && typeof obj !== \"function\") { return { \"default\": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj[\"default\"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }\n\nvar _default = _SpeechRecognition[\"default\"];\nexports[\"default\"] = _default;","// Libraries\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { withTranslation } from 'react-i18next';\n\n// Components\nimport Button from '../../Button';\n\nexport const Success = ({ hideModal, t }) => (\n
\n

{t('common.great')}

\n \n

{t('common.you_have_signed_up')}

\n \n
\n);\n\nSuccess.propTypes = {\n hideModal: PropTypes.func.isRequired,\n t: PropTypes.func.isRequired,\n};\n\nexport default withTranslation()(Success);\n","export const email = (message) => ({\n pattern: { value: /^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$/, message },\n});\n","import React from 'react';\nimport classNames from 'classnames';\n\nconst CheckBox = ({ className, type, checked, ...props }) => (\n \n);\n\nexport default CheckBox;\n","// Libraries\nimport React, { useEffect, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { useTranslation } from 'react-i18next';\n\n// Utilities\nimport { classicTheme, generateHtmlIdForLabel, toggleArrayValue } from 'common/utils/helpers';\n\n// Components\nimport CheckBox from 'common/components/CheckBox';\n\n/**\n * Checkbox group component. Used to render multiple checkboxes in a group.\n */\nconst CheckboxGroup = ({ options, initialValue, value, onChange }) => {\n const { t } = useTranslation();\n const [state, setState] = useState({ value: initialValue, lastId: null });\n\n const checkboxOnChange = (id) => () => {\n if (value) {\n onChange(id);\n } else {\n setState((currentState) => ({\n value: toggleArrayValue(currentState.value, id),\n lastId: id,\n }));\n }\n };\n\n useEffect(() => {\n if (!value && state.value !== initialValue) {\n onChange(state.value, state.lastId);\n }\n }, [state]);\n\n return (\n
\n {options.map(({ label, id }) => (\n
\n \n \n
\n \n {t(label, { defaultValue: label })}\n \n \n
\n ))}\n
\n );\n};\n\nCheckboxGroup.propTypes = {\n options: PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,\n label: PropTypes.string.isRequired,\n })\n ).isRequired,\n initialValue: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),\n value: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),\n onChange: PropTypes.func,\n};\n\nCheckboxGroup.defaultProps = {\n initialValue: [],\n value: null,\n onChange: () => {},\n};\n\nexport default CheckboxGroup;\n","// Libraries\nimport React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { useParams } from 'react-router-dom';\nimport { Trans, useTranslation } from 'react-i18next';\nimport { useController, useForm } from 'react-hook-form';\nimport classNames from 'classnames';\n\n// Utilities\nimport * as rules from 'common/utils/rules';\nimport { subscribeUser } from 'api/rest';\n\n// Components\nimport Button from 'common/components/Button';\nimport Input from 'common/components/Input';\nimport RadioGroup from 'common/components/RadioGroup';\nimport CheckboxGroup from 'common/components/CheckboxGroup';\n\nconst notifications = Object.freeze({\n PROJECT: 'project',\n FUTURE_PROJECTS: 'future_projects',\n});\n\nfunction Form({ projectTitle, onSuccess, hideModal }) {\n const { t } = useTranslation();\n const params = useParams();\n const [error, setError] = useState(false);\n const { register, control, handleSubmit, formState } = useForm({\n defaultValues: { type: notifications.PROJECT, consent: false },\n });\n const { errors } = formState;\n const { field: typeField } = useController({ name: 'type', control });\n const { field: consentField } = useController({\n name: 'consent',\n rules: { required: t('common.consent_is_required') },\n control,\n });\n\n async function onSubmit(formValues) {\n try {\n const { name, email, type } = formValues;\n const projectId = type === notifications.PROJECT ? params.projectId : undefined;\n await subscribeUser(name, email, projectId);\n onSuccess();\n } catch {\n setError(true);\n }\n }\n\n return (\n
\n
\n

{t('common.stay_notified')}

\n

{t('common.sign_up_for_notifications')}

\n
\n
\n
\n \n \n {errors.name &&

{errors.name.message}

}\n
\n
\n
\n
\n \n \n {errors.email &&

{errors.email.message}

}\n
\n
\n
\n\n
\n
{t('common.stay_informed_about')}
\n \n
\n\n
\n

\n \n This form collects your name and email so that we can send you updates about your\n idea. Check out our\n \n privacy policy\n \n to see how we protect and manage your submitted data.\n \n

\n\n
\n consentField.onChange(Boolean(value))}\n />\n {errors.consent &&

{errors.consent.message}

}\n
\n
\n
\n\n
\n \n {error && (\n
\n

\n \n Something went wrong\n
\n Close and try again\n
\n

\n
\n )}\n \n
\n
\n );\n}\n\nForm.propTypes = {\n projectTitle: PropTypes.string,\n hideModal: PropTypes.func.isRequired,\n onSuccess: PropTypes.func.isRequired,\n};\n\nForm.defaultProps = {\n projectTitle: '',\n};\n\nexport default Form;\n","// Libraries\nimport React, { useEffect, useState } from 'react';\nimport PropTypes from 'prop-types';\n\n// Components\nimport Success from './Success';\nimport Form from './Form';\n\n// Enums\nimport Key from '../../enums/Key';\n\nconst NotificationsSignupModal = ({ onClose, title }) => {\n const [success, setSuccess] = useState(false);\n\n useEffect(() => {\n const hotKeyListener = ({ key }) => {\n if (key === Key.ESCAPE) {\n onClose();\n }\n };\n\n window.addEventListener('keydown', hotKeyListener);\n return () => window.removeEventListener('keydown', hotKeyListener);\n }, []);\n\n return (\n
\n {success && }\n {!success && (\n
setSuccess(true)} projectTitle={title} />\n )}\n
\n );\n};\n\nNotificationsSignupModal.propTypes = {\n onClose: PropTypes.func.isRequired,\n title: PropTypes.string,\n};\n\nNotificationsSignupModal.defaultProps = {\n title: '',\n};\n\nexport default NotificationsSignupModal;\n","// Libraries\nimport React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { withTranslation } from 'react-i18next';\n\n// Contexts\nimport ModalProvider from 'contexts/Modal/ModalProvider';\n\n// Components\nimport Button from 'common/components/Button';\nimport Modal from 'ideation/components/base/Modal';\nimport NotificationsSignupModal from '../NotificationsSignupModal';\n\nconst NotificationsSignup = ({ title, t }) => {\n const [showModal, setShowModal] = useState(false);\n\n const openModal = () => setShowModal(true);\n\n const closeModal = () => setShowModal(false);\n\n return (\n \n \n \n closeModal()} title={title} />\n \n \n );\n};\n\nNotificationsSignup.propTypes = {\n title: PropTypes.string.isRequired,\n t: PropTypes.func.isRequired,\n};\n\nexport default withTranslation()(NotificationsSignup);\n","// Libraries\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { useTranslation } from 'react-i18next';\nimport classNames from 'classnames';\n\n// Utilities\nimport { classicTheme } from 'common/utils/helpers';\n\nconst CheckboxInput = ({ id, name, label, register, validations, error, disabled }) => {\n const { t } = useTranslation();\n\n return (\n
\n
\n
\n );\n};\n\nCheckboxInput.propTypes = {\n id: PropTypes.string.isRequired,\n name: PropTypes.string.isRequired,\n register: PropTypes.func.isRequired,\n label: PropTypes.string.isRequired,\n validations: PropTypes.objectOf(PropTypes.any),\n error: PropTypes.shape({ message: PropTypes.string.isRequired }),\n disabled: PropTypes.bool,\n};\n\nCheckboxInput.defaultProps = {\n validations: {},\n error: null,\n disabled: false,\n};\n\nexport default CheckboxInput;\n","// Libraries\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { useTranslation } from 'react-i18next';\n\nconst TextInput = ({\n id,\n name,\n label,\n register,\n validations,\n renderHelpItems,\n error,\n placeholder,\n}) => {\n const { t } = useTranslation();\n\n return (\n
\n \n \n {renderHelpItems()}\n {error && {t(error.message)}}\n
\n );\n};\n\nTextInput.propTypes = {\n id: PropTypes.string.isRequired,\n name: PropTypes.string.isRequired,\n register: PropTypes.func.isRequired,\n label: PropTypes.string.isRequired,\n validations: PropTypes.objectOf(PropTypes.any),\n renderHelpItems: PropTypes.func,\n error: PropTypes.shape({ message: PropTypes.string.isRequired }),\n placeholder: PropTypes.string,\n};\n\nTextInput.defaultProps = {\n validations: {},\n renderHelpItems: () => {},\n error: null,\n placeholder: '',\n};\n\nexport default TextInput;\n","// Libraries\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\n\nconst InputLengthDisplay = ({ minLength, currentLength, maxLength }) => (\n
\n maxLength || currentLength < minLength,\n })}\n >\n {currentLength}\n \n {`/${maxLength}`}\n
\n);\n\nInputLengthDisplay.propTypes = {\n currentLength: PropTypes.number,\n maxLength: PropTypes.number.isRequired,\n minLength: PropTypes.number,\n};\n\nInputLengthDisplay.defaultProps = {\n currentLength: 0,\n minLength: 0,\n};\n\nexport default InputLengthDisplay;\n","// Libraries\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { useTranslation } from 'react-i18next';\n\nconst FileInput = ({ id, name, label, register, validations, error, accept }) => {\n const { t } = useTranslation();\n\n return (\n
\n \n \n {error && {t(error.message)}}\n
\n );\n};\n\nFileInput.propTypes = {\n id: PropTypes.string.isRequired,\n name: PropTypes.string.isRequired,\n register: PropTypes.func.isRequired,\n label: PropTypes.string.isRequired,\n validations: PropTypes.objectOf(PropTypes.any),\n error: PropTypes.shape({ message: PropTypes.string.isRequired }),\n accept: PropTypes.string,\n};\n\nFileInput.defaultProps = {\n validations: {},\n error: null,\n accept: '',\n};\n\nexport default FileInput;\n","// Libraries\nimport isString from 'lodash/isString';\n\n// Redux\nimport { setSubmissionStatus } from 'state/ducks/ideation';\n\nconst IMAGE_SIZE_LIMIT_MB = 2;\nconst PREFIX = 'ideation.errors.idea';\n\nexport const formValidations = Object.freeze({\n title: {\n required: `${PREFIX}.title.required`,\n maxLength: { value: 80, message: `${PREFIX}.title.max_length` },\n minLength: { value: 2, message: `${PREFIX}.title.min_length` },\n },\n description: {\n maxLength: { value: 500, message: `${PREFIX}.description.max_length` },\n minLength: { value: 0, message: `${PREFIX}.description.min_length` },\n },\n image: {\n validate: {\n size: ([file]) => {\n if (!file) return true;\n if (file.size < IMAGE_SIZE_LIMIT_MB * 1000 * 1000) return true;\n return `${PREFIX}.image.size`;\n },\n },\n },\n consent: { required: `${PREFIX}.consent.must_consent` },\n});\n\nconst userErrors = ['USER_BANNED', 'USER_SUSPENDED'];\nconst createStringErrors = [['title', 'TITLE_TAKEN', `${PREFIX}.title.taken`]];\nconst createErrors = [\n ['title', 'TOXIC', `${PREFIX}.title.toxic`],\n ['description', 'TOXIC', `${PREFIX}.description.toxic`],\n ['image', 'TOXIC', `${PREFIX}.image.toxic`],\n ['image', 'INVALID_IMAGE_TYPE', `${PREFIX}.image.invalid_mime_type`],\n];\n\nexport function processUserError(error, dispatch, onError) {\n const bodyError = error.body?.errors;\n\n if (userErrors.includes(bodyError)) {\n dispatch(setSubmissionStatus({ status: bodyError }));\n onError?.();\n throw bodyError;\n }\n}\n\nexport function processCreateError(error) {\n const bodyError = error.body?.errors;\n const errors = [];\n\n if (!bodyError) return errors;\n\n if (isString(bodyError)) {\n for (const [field, type, message] of createStringErrors) {\n if (bodyError.includes(type)) errors.push([field, { type, message }]);\n }\n\n return errors;\n }\n\n for (const [field, type, message] of createErrors) {\n if (bodyError[field]?.includes(type)) errors.push([field, { type, message }]);\n }\n\n return errors;\n}\n","const sorts = {\n MOST_POPULAR: {\n sortTab: 'MOST_POPULAR',\n label: 'ideation.sort_orders.most_popular',\n param: 'most_popular',\n },\n NEWEST: {\n sortTab: 'NEWEST',\n label: 'ideation.sort_orders.newest',\n param: '-created_at',\n },\n OLDEST: {\n sortTab: 'OLDEST',\n label: 'ideation.sort_orders.oldest',\n param: 'created_at',\n },\n};\n\nexport const { MOST_POPULAR, NEWEST, OLDEST } = sorts;\n","// Libraries\nimport React, { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport { useDispatch } from 'react-redux';\nimport { Trans, useTranslation } from 'react-i18next';\nimport { useForm } from 'react-hook-form';\n\n// Components\nimport CheckboxInput from 'ideation/components/base/CheckboxInput';\nimport TextInput from 'ideation/components/base/TextInput';\nimport TextAreaInput from 'ideation/components/base/TextAreaInput';\nimport InputLengthDisplay from 'ideation/components/base/InputLengthDisplay';\nimport FileInput from 'ideation/components/base/FileInput';\n\n// Errors & Validations\nimport {\n formValidations,\n processCreateError,\n processUserError,\n} from 'ideation/validations/ideaValidations';\n\n// Utils\nimport { createIdea } from 'api/v3/private';\nimport { logParticipantSubmission } from 'engagement/utils/analytics';\n\n// State\nimport { setSubmissionStatus } from 'state/ducks/ideation';\n\n// Enums\nimport { NEWEST } from 'ideation/enums/sortOrder';\nimport { readFileAsDataUrl } from 'common/utils/helpers';\n\nconst renderInputLengthDisplay = (name, watchedValues) => (\n \n);\n\nconst CreateIdeaForm = ({\n ideaBoardId,\n projectId,\n allowDescription,\n allowImage,\n onClose,\n searchValue,\n resetSearchValues,\n setSort,\n finalTranscript,\n}) => {\n const dispatch = useDispatch();\n const [defaultError, setDefaultError] = useState(false);\n const { register, watch, handleSubmit, formState, setError } = useForm({\n defaultValues: {\n title: finalTranscript || searchValue,\n consent: Boolean(finalTranscript),\n },\n });\n const { t } = useTranslation();\n const watchedValues = watch();\n const { errors, isSubmitting } = formState;\n const errorValues = Object.values(errors);\n const forceSubmission =\n errorValues.length && errorValues.every((error) => error.type === 'TOXIC');\n\n const submitForm = async ({ title, description, image }) => {\n try {\n const data = { title, description };\n\n if (image?.length) data.image = await readFileAsDataUrl(image[0]);\n if (forceSubmission) data.force = true;\n\n const idea = await createIdea(ideaBoardId, data);\n\n logParticipantSubmission('Public Board', ideaBoardId, projectId);\n onClose();\n dispatch(setSubmissionStatus({ status: idea.deserialized.status }));\n resetSearchValues();\n setSort(NEWEST);\n } catch (error) {\n processUserError(error, dispatch, onClose);\n const formErrors = processCreateError(error);\n\n if (formErrors.length) {\n for (const formError of formErrors) {\n setError(...formError);\n }\n } else {\n setDefaultError(true);\n }\n }\n };\n\n useEffect(() => {\n const error = errors.title || errors.description || errors.image;\n\n if (error?.isManual) {\n error.ref.scrollIntoView();\n }\n }, [errors.title, errors.description, errors.image]);\n\n return (\n <>\n

\n {t('ideation.what_is_your_idea_heading')}\n

\n \n renderInputLengthDisplay('title', watchedValues)}\n error={errors.title}\n />\n {allowDescription && (\n renderInputLengthDisplay('description', watchedValues)}\n error={errors.description}\n />\n )}\n {allowImage && (\n \n )}\n \n \n This form collects information about your idea. Check out our\n \n privacy policy\n \n to see how we protect and manage your submitted data.\n \n
\n \n {defaultError && (\n
{t('ideation.errors.idea.default')}
\n )}\n
\n \n {t('ideation.submit_idea_button')}\n \n
\n \n
\n {t('ideation.cancel')}\n
\n \n );\n};\n\nCreateIdeaForm.propTypes = {\n ideaBoardId: PropTypes.string.isRequired,\n projectId: PropTypes.string.isRequired,\n allowDescription: PropTypes.bool.isRequired,\n allowImage: PropTypes.bool.isRequired,\n onClose: PropTypes.func.isRequired,\n searchValue: PropTypes.string,\n resetSearchValues: PropTypes.func.isRequired,\n setSort: PropTypes.func.isRequired,\n finalTranscript: PropTypes.string.isRequired,\n};\n\nCreateIdeaForm.defaultProps = {\n searchValue: '',\n};\n\nexport default CreateIdeaForm;\n","// Libraries\nimport React from 'react';\nimport PropTypes from 'prop-types';\n\n// Components\nimport Modal from 'ideation/components/base/Modal';\nimport CreateIdeaForm from 'ideation/components/createIdea/CreateIdeaForm';\n\nconst CreateIdeaModal = ({\n isOpen,\n onClose,\n setSort,\n searchValue,\n resetSearchValues,\n ideaBoardId,\n projectId,\n allowDescription,\n allowImage,\n finalTranscript,\n}) => (\n \n \n \n);\n\nCreateIdeaModal.propTypes = {\n ideaBoardId: PropTypes.string.isRequired,\n projectId: PropTypes.string.isRequired,\n allowDescription: PropTypes.bool.isRequired,\n allowImage: PropTypes.bool.isRequired,\n setSort: PropTypes.func.isRequired,\n searchValue: PropTypes.string,\n resetSearchValues: PropTypes.func.isRequired,\n isOpen: PropTypes.bool.isRequired,\n onClose: PropTypes.func.isRequired,\n finalTranscript: PropTypes.string.isRequired,\n};\n\nCreateIdeaModal.defaultProps = {\n searchValue: '',\n};\n\nexport default CreateIdeaModal;\n","// Libraries\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { useTranslation } from 'react-i18next';\n\nconst IdeaBoardActions = ({ openModal }) => {\n const { t } = useTranslation();\n\n return (\n
\n
\n {t('ideation.comment_on_idea')}\n
\n
\n {`-${t('ideation.or')}-`}\n
\n
\n \n {`+${t('ideation.add_idea_button')}`}\n \n
\n
\n );\n};\n\nIdeaBoardActions.propTypes = {\n openModal: PropTypes.func.isRequired,\n};\n\nexport default IdeaBoardActions;\n","// Libraries\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\n\nconst IdeaBoardHeaderContainer = ({\n backgroundImageUrl,\n backgroundImagePosition,\n single,\n children,\n}) => {\n return (\n \n {backgroundImageUrl &&
}\n {children}\n
\n );\n};\n\nIdeaBoardHeaderContainer.propTypes = {\n backgroundImageUrl: PropTypes.string,\n backgroundImagePosition: PropTypes.string,\n single: PropTypes.bool,\n children: PropTypes.node.isRequired,\n};\n\nIdeaBoardHeaderContainer.defaultProps = {\n backgroundImageUrl: null,\n backgroundImagePosition: 'center',\n single: null,\n};\n\nexport default IdeaBoardHeaderContainer;\n","// Libraries\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { withRouter } from 'react-router-dom';\nimport { useTranslation } from 'react-i18next';\n\n// Routes\nimport Routes from 'routes';\n\n// Utilities\nimport { populatePath, renderMarkdown } from 'common/utils/helpers';\n\n// Components\nimport IdeaBoardHeaderContainer from 'ideation/components/ideaBoard/IdeaBoardHeaderContainer';\n\nconst IdeaBoardHeader = ({\n title,\n description,\n match,\n backgroundImageUrl,\n backgroundImagePosition,\n projectPublic,\n}) => {\n const { t } = useTranslation();\n\n return (\n \n {projectPublic && (\n \n )}\n
\n

{title}

\n {description && (\n
\n \n
\n )}\n
\n \n );\n};\n\nIdeaBoardHeader.propTypes = {\n title: PropTypes.string.isRequired,\n description: PropTypes.string,\n backgroundImageUrl: PropTypes.string,\n backgroundImagePosition: PropTypes.string,\n projectPublic: PropTypes.bool.isRequired,\n match: PropTypes.shape({\n params: PropTypes.objectOf(PropTypes.string).isRequired,\n }).isRequired,\n};\n\nIdeaBoardHeader.defaultProps = {\n backgroundImageUrl: '',\n backgroundImagePosition: 'center',\n description: '',\n};\n\nexport default withRouter(IdeaBoardHeader);\n","// Libraries\nimport React, { useRef, useCallback } from 'react';\nimport PropTypes from 'prop-types';\nimport { useTranslation } from 'react-i18next';\nimport SpeechRecognition from 'react-speech-recognition';\nimport classNames from 'classnames';\n\n// Hooks\nimport { useKeyListener } from 'common/hooks/useKeyListener';\n\n// Utils\nimport { featureFlagEnabled } from 'common/utils/helpers';\n\n// Enums\nimport Keys from 'common/enums/Key';\n\nconst SearchInput = ({ name, register, placeholder, handleSubmit, listening, volume }) => {\n const searchIcon = useRef(null);\n const { t } = useTranslation();\n const speechRecognitionEnabled = featureFlagEnabled('speech_recognition');\n\n const keyboardSubmit = useCallback((event) => {\n if (searchIcon.current.matches(':focus')) {\n event.preventDefault();\n handleSubmit();\n }\n }, []);\n\n const stopListening = useCallback(() => {\n SpeechRecognition.stopListening();\n }, []);\n\n useKeyListener(Keys.ENTER, keyboardSubmit);\n useKeyListener(Keys.ESCAPE, stopListening);\n\n return (\n \n
\n \n {speechRecognitionEnabled && !listening && (\n SpeechRecognition.startListening({ language: 'en-US' })}\n >\n \n \n )}\n
\n {!listening && (\n \n {t('ideation.search')}\n \n )}\n
\n );\n};\n\nSearchInput.propTypes = {\n name: PropTypes.string.isRequired,\n register: PropTypes.func.isRequired,\n handleSubmit: PropTypes.func.isRequired,\n placeholder: PropTypes.string,\n listening: PropTypes.bool.isRequired,\n volume: PropTypes.number.isRequired,\n};\n\nSearchInput.defaultProps = {\n placeholder: '',\n};\n\nexport default SearchInput;\n","// Libraries\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { useTranslation } from 'react-i18next';\nimport classNames from 'classnames';\n\n// Enums\nimport PublicStatus from 'common/enums/PublicStatus';\n\n// Components\nimport SearchInput from 'ideation/components/base/SearchInput';\n\nconst IdeaBoardSearch = ({\n publicStatus,\n register,\n searchValue,\n reset,\n handleSubmit,\n searchSubmitted,\n listening,\n volume,\n}) => {\n const { t } = useTranslation();\n\n return (\n
\n
\n \n
\n
\n \n {!listening && (searchValue || searchSubmitted) && (\n
\n \n
\n )}\n
\n
\n \n
\n
\n );\n};\n\nIdeaBoardSearch.propTypes = {\n register: PropTypes.func.isRequired,\n reset: PropTypes.func.isRequired,\n handleSubmit: PropTypes.func.isRequired,\n searchSubmitted: PropTypes.bool.isRequired,\n publicStatus: PropTypes.string,\n searchValue: PropTypes.string,\n listening: PropTypes.bool.isRequired,\n volume: PropTypes.number.isRequired,\n};\n\nIdeaBoardSearch.defaultProps = {\n publicStatus: '',\n searchValue: '',\n};\n\nexport default IdeaBoardSearch;\n","// Libraries\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { useTranslation } from 'react-i18next';\nimport classNames from 'classnames';\n\n// Enums\nimport * as sorts from 'ideation/enums/sortOrder';\n\nconst IdeaBoardSort = ({ handleSortClick, activeTab }) => {\n const { t } = useTranslation();\n const sortTabs = Object.keys(sorts).map((key) => (\n handleSortClick(key)}\n >\n {t(sorts[key].label)}\n \n ));\n\n return (\n
\n
\n
    {sortTabs}
\n
\n
\n );\n};\n\nIdeaBoardSort.propTypes = {\n handleSortClick: PropTypes.func.isRequired,\n activeTab: PropTypes.string,\n};\n\nIdeaBoardSort.defaultProps = {\n activeTab: 'MOST_POPULAR',\n};\nexport default IdeaBoardSort;\n","// Enums\nimport { redirectToSignInPath } from 'common/utils/authHelpers';\n\nexport const authorizeAction = (authenticated, action, redirectUrl) =>\n authenticated ? action() : redirectToSignInPath(redirectUrl);\n","const votingTypes = Object.freeze({\n UPVOTE: 'upvote',\n DOWNVOTE: 'downvote',\n});\n\nexport const { UPVOTE, DOWNVOTE } = votingTypes;\n","// Libraries\nimport React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\n\n// Utils\nimport { authorizeAction } from 'ideation/utils/userAuthorize';\nimport { userAuthenticated } from 'ideation/utils/userAuthenticate';\n\n// Enums\nimport { UPVOTE, DOWNVOTE } from 'ideation/enums/votingTypes';\nimport PublicStatus from 'common/enums/PublicStatus';\n\nconst VotingWidget = ({\n handleVote,\n voteType,\n votedByUser,\n voteCount,\n publicStatus,\n voteTooltip,\n}) => {\n const [disabled, setDisabled] = useState(false);\n const closed = publicStatus !== PublicStatus.OPEN;\n\n const handleClick = () => {\n if (closed || disabled) return;\n setDisabled(true);\n authorizeAction(\n userAuthenticated(),\n () => handleVote().finally(() => setDisabled(false)),\n window.location.pathname\n );\n };\n\n return (\n \n \n {voteCount > 0 ? voteCount : 0}\n \n );\n};\n\nVotingWidget.propTypes = {\n handleVote: PropTypes.func.isRequired,\n voteType: PropTypes.string.isRequired,\n voteTooltip: PropTypes.string.isRequired,\n publicStatus: PropTypes.string.isRequired,\n votedByUser: PropTypes.bool,\n voteCount: PropTypes.number,\n};\n\nVotingWidget.defaultProps = {\n votedByUser: false,\n voteCount: 0,\n};\n\nexport default VotingWidget;\n","import PropTypes from 'prop-types';\n\nconst IdeaType = PropTypes.shape({\n id: PropTypes.string,\n title: PropTypes.string,\n totalCommentCount: PropTypes.number,\n});\n\nconst IdeaBoardType = PropTypes.shape({\n id: PropTypes.string.isRequired,\n title: PropTypes.string.isRequired,\n longDescription: PropTypes.string,\n publicStatus: PropTypes.string.isRequired,\n heroImage: PropTypes.shape({\n imageUrls: PropTypes.shape({\n desktop: PropTypes.string,\n card: PropTypes.string,\n mobile: PropTypes.string,\n }),\n }),\n allowDescription: PropTypes.bool.isRequired,\n allowImage: PropTypes.bool.isRequired,\n});\n\nexport { IdeaType, IdeaBoardType };\n","// Libraries\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { useTranslation } from 'react-i18next';\n\n// Enums\nimport { IdeaType } from 'ideation/enums/propTypes';\n\nconst CommentCountWidget = ({ ideaRoute, idea, userHasCommented }) => {\n const { t } = useTranslation();\n\n return (\n \n \n \n \n \n Comment count\n {idea.approvedAndModeratedCount || 0}\n \n \n );\n};\n\nCommentCountWidget.propTypes = {\n ideaRoute: PropTypes.string.isRequired,\n idea: IdeaType.isRequired,\n userHasCommented: PropTypes.bool,\n};\n\nCommentCountWidget.defaultProps = {\n userHasCommented: false,\n};\n\nexport default CommentCountWidget;\n","const reasons = {\n COMMENT_OFFENSIVE: 'COMMENT_OFFENSIVE',\n COMMENT_SPAM: 'COMMENT_SPAM',\n COMMENT_OTHER: 'COMMENT_OTHER',\n};\n\nexport const { COMMENT_OFFENSIVE, COMMENT_SPAM, COMMENT_OTHER } = reasons;\n","// Libraries\nimport React, { useRef } from 'react';\nimport PropTypes from 'prop-types';\nimport { useTranslation } from 'react-i18next';\n\n// Hooks\nimport { useKeyListener } from 'common/hooks/useKeyListener';\nimport { useClickOutsideNode } from 'common/hooks/useClickOutsideNode';\n\n// Enums\nimport Keys from 'common/enums/Key';\nimport { COMMENT_OFFENSIVE, COMMENT_SPAM, COMMENT_OTHER } from 'ideation/enums/flagIdeaReasons';\n\nconst FlagIdeaWidgetMenu = ({ flaggedByUser, handleFlagIdea, setDisplayMenu, id }) => {\n const menu = useRef(null);\n const hideMenu = () => setDisplayMenu(false);\n const { t } = useTranslation();\n\n useClickOutsideNode(menu, hideMenu);\n useKeyListener(Keys.ESCAPE, hideMenu);\n\n return (\n
\n
\n {flaggedByUser ? (\n

{t('ideation.idea_flagged')}

\n ) : (\n <>\n handleFlagIdea(COMMENT_OFFENSIVE)}\n >\n {t('ideation.report_offensive')}\n \n handleFlagIdea(COMMENT_SPAM)}\n >\n {t('ideation.report_spam')}\n \n handleFlagIdea(COMMENT_OTHER)}\n >\n {t('ideation.report_other')}\n \n \n )}\n
\n
\n );\n};\n\nFlagIdeaWidgetMenu.propTypes = {\n handleFlagIdea: PropTypes.func.isRequired,\n setDisplayMenu: PropTypes.func.isRequired,\n flaggedByUser: PropTypes.bool,\n id: PropTypes.string.isRequired,\n};\n\nFlagIdeaWidgetMenu.defaultProps = {\n flaggedByUser: false,\n};\n\nexport default FlagIdeaWidgetMenu;\n","// Libraries\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { useTranslation } from 'react-i18next';\n\n// Enums\nimport PublicStatus from 'common/enums/PublicStatus';\n\n// Utils\nimport { authorizeAction } from 'ideation/utils/userAuthorize';\nimport { userAuthenticated } from 'ideation/utils/userAuthenticate';\n\n// Components\nimport FlagIdeaWidgetMenu from 'ideation/components/ideaActions/FlagIdeaWidgetMenu';\n\nconst FlagIdeaWidget = ({\n handleFlagIdea,\n flaggedByUser,\n displayMenu,\n setDisplayMenu,\n publicStatus,\n id,\n}) => {\n const { t } = useTranslation();\n const disabled = publicStatus !== PublicStatus.OPEN;\n const flagAction = () =>\n authorizeAction(userAuthenticated(), () => setDisplayMenu(true), window.location.pathname);\n return (\n <>\n {} : flagAction}\n aria-controls={`flag-idea-menu-${id}`}\n >\n \n \n \n {t('ideation.flag_idea')}\n \n {displayMenu && (\n \n )}\n \n );\n};\n\nFlagIdeaWidget.propTypes = {\n handleFlagIdea: PropTypes.func.isRequired,\n setDisplayMenu: PropTypes.func.isRequired,\n publicStatus: PropTypes.string.isRequired,\n flaggedByUser: PropTypes.bool,\n displayMenu: PropTypes.bool,\n id: PropTypes.string.isRequired,\n};\n\nFlagIdeaWidget.defaultProps = {\n flaggedByUser: false,\n displayMenu: false,\n};\n\nexport default FlagIdeaWidget;\n","// Libraries\nimport React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { useTranslation } from 'react-i18next';\nimport { useDispatch } from 'react-redux';\n\n// Components\nimport VotingWidget from 'ideation/components/ideaActions/VotingWidget';\nimport CommentCountWidget from 'ideation/components/ideaActions/CommentCountWidget';\nimport FlagIdeaWidget from 'ideation/components/ideaActions/FlagIdeaWidget';\n\n// Enums\nimport PublicStatus from 'common/enums/PublicStatus';\nimport { IdeaType } from 'ideation/enums/propTypes';\nimport { DOWNVOTE, UPVOTE } from 'ideation/enums/votingTypes';\nimport { downvoteIdea, flagIdea, upvoteIdea } from 'api/v3/private';\n\n// Errors & Validations\nimport { processUserError } from 'ideation/validations/ideaValidations';\n\nconst IdeaActionContainer = ({\n displayCommentCount,\n ideaRoute,\n idea,\n publicStatus,\n onIdeaUpdate,\n}) => {\n const { t } = useTranslation();\n const dispatch = useDispatch();\n const [displayFlagMenu, setDisplayFlagMenu] = useState(false);\n const flaggedByUser = Boolean(idea.moderationFlags);\n const displayFlagWidget = publicStatus !== PublicStatus.CLOSED || flaggedByUser;\n\n const upvote = async () => {\n try {\n const { deserialized: updatedIdea } = await upvoteIdea(idea.id);\n onIdeaUpdate({\n ...idea,\n upVotesCount: updatedIdea.upVotesCount,\n downVotesCount: updatedIdea.downVotesCount,\n votes: idea.votes?.voteType === UPVOTE ? null : { voteType: UPVOTE },\n });\n } catch (error) {\n processUserError(error, dispatch);\n }\n };\n\n const downvote = async () => {\n try {\n const { deserialized: updatedIdea } = await downvoteIdea(idea.id);\n onIdeaUpdate({\n ...idea,\n upVotesCount: updatedIdea.upVotesCount,\n downVotesCount: updatedIdea.downVotesCount,\n votes: idea.votes?.voteType === DOWNVOTE ? null : { voteType: DOWNVOTE },\n });\n } catch (error) {\n processUserError(error, dispatch);\n }\n };\n\n const flag = async (reason) => {\n try {\n await flagIdea(idea.id, { reason });\n onIdeaUpdate({ ...idea, moderationFlags: {} });\n } catch (error) {\n processUserError(error, dispatch);\n } finally {\n setDisplayFlagMenu(false);\n }\n };\n\n return (\n <>\n \n \n {displayCommentCount && (\n // TODO\n )}\n {displayFlagWidget && (\n \n )}\n \n );\n};\n\nIdeaActionContainer.propTypes = {\n ideaRoute: PropTypes.string,\n idea: IdeaType.isRequired,\n publicStatus: PropTypes.string.isRequired,\n displayCommentCount: PropTypes.bool,\n onIdeaUpdate: PropTypes.func.isRequired,\n};\n\nIdeaActionContainer.defaultProps = {\n ideaRoute: '',\n displayCommentCount: false,\n};\n\nexport default IdeaActionContainer;\n","export const PENDING = 'pending';\nexport const REJECTED = 'rejected';\nexport const APPROVED = 'approved';\n\nexport default Object.freeze({\n PENDING,\n REJECTED,\n APPROVED,\n});\n","// Libraries\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { useTranslation } from 'react-i18next';\nimport classNames from 'classnames';\n\nimport ModerationStatuses, { PENDING, REJECTED } from 'common/enums/ModerationStatuses';\n\nconst WarningMessage = (props) => {\n const { status } = props;\n const { t } = useTranslation();\n\n if (status !== PENDING && status !== REJECTED) return null;\n\n const getWarningMsg = () => {\n switch (status) {\n case PENDING:\n return 'ideation.pending_idea_msg';\n case REJECTED:\n return 'ideation.rejected_idea_msg';\n default:\n return '';\n }\n };\n\n return (\n
\n
\n \n \n \n
\n
\n

{t(getWarningMsg())}

\n
\n
\n );\n};\n\nWarningMessage.propTypes = {\n status: PropTypes.oneOf(Object.values(ModerationStatuses)).isRequired,\n};\n\nexport default WarningMessage;\n","// Libraries\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { useTranslation } from 'react-i18next';\n\n// Routes\nimport Routes from 'routes';\n\n// Utils\nimport { populatePath, determineImageSize } from 'common/utils/helpers';\nimport { currentLanguage } from 'i18n';\n\n// Components\nimport IdeaActionContainer from 'ideation/components/ideaActions/IdeaActionContainer';\nimport WarningMessage from 'ideation/components/ideaBoard/IdeaCard/WarningMessage';\n\n// Enums\nimport { IdeaType } from 'ideation/enums/propTypes';\n\nconst IdeaCard = ({ ideaBoardId, idea, publicStatus, onIdeaUpdate }) => {\n const { t } = useTranslation();\n const ideaRoute = populatePath(Routes.IDEA, {\n locale: currentLanguage,\n ideaBoardId,\n ideaId: idea.id,\n });\n\n const renderBody = () => {\n if (idea.responseText) {\n return (\n
\n
\n \n {gon.brand.name_translations[currentLanguage]}\n
\n
\n

{idea.responseText}

\n
\n
\n );\n }\n\n if (idea.heroImage?.imageUrls) {\n return (\n \n );\n }\n\n if (idea.description) {\n return (\n
\n

{idea.description}

\n
\n );\n }\n\n return null;\n };\n\n const renderFooter = () => {\n if (idea.status === 'approved') {\n return (\n \n );\n }\n\n return ;\n };\n\n return (\n
\n
\n {idea.responseIcon && (\n
\n \n {t(`ideation.idea_response_icon_labels.${idea.responseIcon}`)}\n
\n )}\n \n

{idea.title}

\n
{renderBody()}
\n
\n
{renderFooter()}
\n
\n
\n );\n};\n\nIdeaCard.propTypes = {\n ideaBoardId: PropTypes.number.isRequired,\n idea: IdeaType.isRequired,\n publicStatus: PropTypes.string.isRequired,\n onIdeaUpdate: PropTypes.func.isRequired,\n};\n\nexport default IdeaCard;\n","// Libraries\nimport React from 'react';\nimport PropTypes from 'prop-types';\n\n// Components\nimport IdeaCard from 'ideation/components/ideaBoard/IdeaCard';\n\n// Enums\nimport { IdeaType } from 'ideation/enums/propTypes';\nimport { useTranslation } from 'react-i18next';\n\nconst IdeaCards = ({ publicStatus, ideaBoardId, data, mutateIdea }) => {\n const { t } = useTranslation();\n\n return (\n
\n
\n {!data[0]?.deserialized.length && (\n
\n

\n {t('ideation.no_ideas_yet')}\n

\n
\n )}\n {data.map((page, pageIndex) =>\n page.deserialized.map((idea, ideaIndex) => (\n mutateIdea(pageIndex, ideaIndex, updatedIdea)}\n />\n ))\n )}\n
\n
\n );\n};\n\nIdeaCards.propTypes = {\n ideaBoardId: PropTypes.number.isRequired,\n publicStatus: PropTypes.string.isRequired,\n data: PropTypes.arrayOf(\n PropTypes.shape({\n deserialized: PropTypes.arrayOf(IdeaType),\n })\n ).isRequired,\n mutateIdea: PropTypes.func.isRequired,\n};\n\nexport default IdeaCards;\n","// Libraries\nimport React, { forwardRef } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\n\nconst Notification = forwardRef(\n (\n { title, children, onClose, className, isInfo, isSuccess, isDanger, isClosed, noDismiss },\n ref\n ) => (\n \n {!noDismiss && (\n \n )}\n
\n \n \n \n
\n
\n {title &&
{title}
}\n {children}\n
\n \n )\n);\n\nNotification.propTypes = {\n title: PropTypes.string,\n children: PropTypes.node,\n onClose: PropTypes.func,\n className: PropTypes.string,\n isInfo: PropTypes.bool,\n isSuccess: PropTypes.bool,\n isDanger: PropTypes.bool,\n isClosed: PropTypes.bool,\n noDismiss: PropTypes.bool,\n};\n\nNotification.defaultProps = {\n title: null,\n children: null,\n className: null,\n isInfo: false,\n isSuccess: false,\n isDanger: false,\n isClosed: false,\n noDismiss: false,\n onClose: () => {},\n};\n\nexport default Notification;\n","// Libraries\nimport React, { forwardRef } from 'react';\nimport PropTypes from 'prop-types';\nimport { useTranslation } from 'react-i18next';\n\n// Components\nimport Notification from 'common/components/Notification';\n\nconst ApprovedNotification = forwardRef(({ onClose }, ref) => {\n const { t } = useTranslation();\n\n return (\n \n {t('ideation.idea_upvoted_message')}\n \n );\n});\n\nApprovedNotification.propTypes = {\n onClose: PropTypes.func.isRequired,\n};\n\nexport default ApprovedNotification;\n","// Libraries\nimport React, { forwardRef } from 'react';\nimport PropTypes from 'prop-types';\nimport { useTranslation } from 'react-i18next';\n\n// Components\nimport Notification from 'common/components/Notification';\n\nconst PendingNotification = forwardRef(({ onClose }, ref) => {\n const { t } = useTranslation();\n\n return (\n \n {t('ideation.idea_pending_notification')}\n \n );\n});\n\nPendingNotification.propTypes = {\n onClose: PropTypes.func.isRequired,\n};\n\nexport default PendingNotification;\n","// Libraries\nimport React, { forwardRef } from 'react';\nimport PropTypes from 'prop-types';\nimport { useTranslation } from 'react-i18next';\n\n// Components\nimport Notification from 'common/components/Notification';\n\nconst UserBannedNotification = forwardRef(({ onClose }, ref) => {\n const { t } = useTranslation();\n\n return (\n \n {t('ideation.user_banned_notification')}\n \n );\n});\n\nUserBannedNotification.propTypes = {\n onClose: PropTypes.func.isRequired,\n};\n\nexport default UserBannedNotification;\n","// Libraries\nimport React, { forwardRef } from 'react';\nimport PropTypes from 'prop-types';\nimport { useTranslation } from 'react-i18next';\n\n// Components\nimport Notification from 'common/components/Notification';\n\nconst UserSuspendedNotification = forwardRef(({ onClose }, ref) => {\n const { t } = useTranslation();\n\n return (\n \n {t('ideation.user_suspended_notification')}\n \n );\n});\n\nUserSuspendedNotification.propTypes = {\n onClose: PropTypes.func.isRequired,\n};\n\nexport default UserSuspendedNotification;\n","const submissionStatus = Object.freeze({\n APPROVED: 'approved',\n PENDING: 'pending',\n});\n\nexport const { APPROVED, PENDING } = submissionStatus;\n","const userStatusErrors = Object.freeze({\n USER_BANNED: 'USER_BANNED',\n USER_SUSPENDED: 'USER_SUSPENDED',\n});\n\nexport const { USER_BANNED, USER_SUSPENDED } = userStatusErrors;\n","// Libraries\nimport { useEffect, useRef } from 'react';\n\n/**\n * Hook for scrolling an element into view on every `dependency` truthy change\n *\n * @param {any} dependency\n * @returns {React.RefObject}\n */\nexport function useScrollIntoView(dependency) {\n const ref = useRef();\n\n useEffect(() => {\n if (dependency) {\n ref.current?.scrollIntoView();\n }\n }, [dependency]);\n\n return ref;\n}\n","// Libraries\nimport React from 'react';\nimport { useDispatch, useSelector } from 'react-redux';\n\n// State\nimport { clearSubmissionStatus } from 'state/ducks/ideation';\n\n// Components\nimport ApprovedNotification from 'ideation/components/ideaBoard/ApprovedNotification';\nimport PendingNotification from 'ideation/components/ideaBoard/PendingNotification';\nimport UserBannedNotification from 'ideation/components/ideaBoard/UserBannedNotification';\nimport UserSuspendedNotification from 'ideation/components/ideaBoard/UserSuspendedNotification';\n\n// Enums\nimport { APPROVED, PENDING } from 'ideation/enums/submissionStatus';\nimport { USER_BANNED, USER_SUSPENDED } from 'ideation/enums/userStatusErrors';\n\n// Utils\nimport { useScrollIntoView } from 'common/hooks/useScrollIntoView';\n\nconst SubmissionNotification = () => {\n const dispatch = useDispatch();\n const submissionStatus = useSelector(({ ideation }) => ideation.submissionStatus);\n const notificationRef = useScrollIntoView(submissionStatus);\n\n if (!submissionStatus) {\n return null;\n }\n\n const { status, userStatus } = submissionStatus;\n const clearStatus = () => dispatch(clearSubmissionStatus());\n\n switch (status) {\n case APPROVED:\n return ;\n case PENDING:\n return ;\n case USER_BANNED:\n return ;\n case USER_SUSPENDED:\n return (\n \n );\n default:\n return null;\n }\n};\n\nexport default SubmissionNotification;\n","// Libraries\nimport React from 'react';\n// import PropTypes from 'prop-types';\nimport { useTranslation } from 'react-i18next';\n\n// Components\nimport Notification from 'common/components/Notification';\n\nconst ClosedNotification = () => {\n const { t } = useTranslation();\n\n return (\n \n {t('ideation.idea_board_closed_notification')}\n \n );\n};\n\nClosedNotification.propTypes = {};\n\nexport default ClosedNotification;\n","// Libraries\nimport React, { useEffect, useState } from 'react';\nimport { useForm } from 'react-hook-form';\nimport { Waypoint } from 'react-waypoint';\nimport useSWRInfinite from 'swr/infinite';\nimport { useTranslation } from 'react-i18next';\nimport camelcase from 'lodash.camelcase';\nimport SpeechRecognition, { useSpeechRecognition } from 'react-speech-recognition';\n\n// I18n\nimport { currentLanguage } from 'i18n';\n\n// Api\nimport { getIdeasFetcher, getIdeasUrl } from 'api/v3/private';\n\n// Components\nimport Spinner from 'common/components/Spinner';\nimport Header from 'header/components/Header';\nimport Footer from 'common/components/Footer';\nimport SocialFooter from 'common/components/SocialFooter';\nimport NotificationsSignup from 'common/components/NotificationsSignup';\nimport CreateIdeaModal from 'ideation/components/createIdea/CreateIdeaModal';\nimport IdeaBoardActions from 'ideation/components/ideaBoard/IdeaBoardActions';\nimport IdeaBoardHeader from 'ideation/components/ideaBoard/IdeaBoardHeader';\nimport IdeaBoardSearch from 'ideation/components/ideaBoard/IdeaBoardSearch';\nimport IdeaBoardSort from 'ideation/components/ideaBoard/IdeaBoardSort';\nimport IdeaCards from 'ideation/components/ideaBoard/IdeaCards';\nimport SubmissionNotification from 'ideation/components/ideaBoard/SubmissionNotification';\nimport ClosedNotification from 'ideation/components/ideaBoard/ClosedNotification';\n\n// Utils\nimport { determineImageSize, featureFlagEnabled } from 'common/utils/helpers';\nimport { userAuthenticated } from 'ideation/utils/userAuthenticate';\nimport { authorizeAction } from 'ideation/utils/userAuthorize';\n\n// Enums\nimport * as sorts from 'ideation/enums/sortOrder';\nimport PublicStatus from 'common/enums/PublicStatus';\nimport { IdeaBoardType } from 'ideation/enums/propTypes';\n\n// Constants\nconst IDEA_LIMIT = 24;\n\nconst IdeaBoard = ({ ideaBoard }) => {\n const { t } = useTranslation();\n const { register, reset: resetForm, handleSubmit, setValue } = useForm();\n const [sort, setSort] = useState(sorts.MOST_POPULAR);\n const [searchValue, setSearchValue] = useState('');\n const [volume, setVolume] = useState(0);\n const [displayCreateIdeaModal, setDisplayCreateIdeaModal] = useState(\n Boolean(userAuthenticated() && localStorage.getItem('createIdeaModalTitle'))\n );\n const language = camelcase(currentLanguage);\n const { project } = ideaBoard;\n const { listening, transcript, finalTranscript, resetTranscript } = useSpeechRecognition();\n const speechRecognitionEnabled = featureFlagEnabled('speech_recognition');\n\n const { data, size, setSize, mutate } = useSWRInfinite(\n (pageIndex, previousPageData) => {\n if (previousPageData && !previousPageData.links.next) return null;\n\n const params = {\n page: { number: pageIndex + 1, size: IDEA_LIMIT },\n sort: sort.param,\n filter: searchValue,\n include: 'hero_image',\n };\n\n return [getIdeasUrl(ideaBoard.id, params), ideaBoard.id];\n },\n getIdeasFetcher,\n { revalidateAll: true }\n );\n\n const resetSearch = () => {\n setSearchValue('');\n resetForm();\n };\n\n const mutateIdea = (pageIndex, ideaIndex, updatedIdea) => {\n mutate((cachedData) =>\n Object.assign([...cachedData], {\n [pageIndex]: {\n ...cachedData[pageIndex],\n deserialized: Object.assign([...cachedData[pageIndex].deserialized], {\n [ideaIndex]: updatedIdea,\n }),\n },\n })\n );\n };\n\n const renderIdeas = () => {\n if (!data) {\n return (\n
\n \n
\n );\n }\n\n const ideasFetched = Boolean(data.length && !data[data.length - 1].links.next);\n\n return (\n <>\n \n {!ideasFetched && (\n setSize(size + 1)} key={data.length} />\n )}\n \n );\n };\n\n const openModal = () => {\n const authenticated = userAuthenticated();\n if (!authenticated) localStorage.setItem('createIdeaModalTitle', searchValue);\n authorizeAction(authenticated, () => setDisplayCreateIdeaModal(true), window.location.pathname);\n };\n\n const closeModal = () => {\n setDisplayCreateIdeaModal(false);\n localStorage.removeItem('createIdeaModalTitle');\n resetTranscript();\n };\n\n useEffect(() => {\n if (!speechRecognitionEnabled) return;\n\n let frameRequestId = 0;\n let stream;\n\n const onStart = async () => {\n window.scrollTo(0, 0);\n document.documentElement.classList.add('is-clipped');\n stream = await navigator.mediaDevices.getUserMedia({ audio: true });\n\n const context = new AudioContext();\n const source = context.createMediaStreamSource(stream);\n const analyser = context.createAnalyser();\n const frequencyData = new Uint8Array(analyser.frequencyBinCount);\n source.connect(analyser);\n\n const calculateVolume = () => {\n analyser.getByteFrequencyData(frequencyData);\n const squaredSum = frequencyData.reduce((sum, value) => sum + value ** 2);\n return Math.sqrt(squaredSum / frequencyData.length) / 255;\n };\n\n const frame = () => {\n setVolume(calculateVolume());\n frameRequestId = window.requestAnimationFrame(frame);\n };\n\n frame();\n };\n\n const onEnd = () => {\n document.documentElement.classList.remove('is-clipped');\n window.cancelAnimationFrame(frameRequestId);\n stream?.getTracks().forEach((track) => track.stop());\n setVolume(0);\n };\n\n const recognition = SpeechRecognition.getRecognition();\n recognition.addEventListener('start', onStart);\n recognition.addEventListener('end', onEnd);\n }, []);\n\n useEffect(() => {\n if (listening) {\n setValue('ideaSearch', transcript);\n } else {\n setValue('ideaSearch', '');\n if (finalTranscript) openModal();\n }\n }, [transcript, finalTranscript, listening]);\n\n return (\n
\n \n
\n
\n \n setSearchValue(values.ideaSearch))}\n searchSubmitted={Boolean(searchValue)}\n listening={listening}\n volume={volume}\n />\n {!searchValue && (\n setSort(sorts[sortTab])}\n activeTab={sort.sortTab}\n />\n )}\n
\n
\n {ideaBoard.publicStatus !== PublicStatus.CLOSED && searchValue && (\n \n )}\n {ideaBoard.publicStatus === PublicStatus.CLOSED && }\n \n {renderIdeas()}\n
\n {project && project.notificationSignUpEnabled && (\n
\n
\n

\n {t('project.stay_informed')}\n

\n

{t('project.get_notified_message')}

\n
\n \n
\n )}\n
\n
\n \n
\n {listening &&
}\n
\n );\n};\n\nIdeaBoard.propTypes = {\n ideaBoard: IdeaBoardType.isRequired,\n};\n\nexport default IdeaBoard;\n","// Libraries\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport useSWR from 'swr';\n\n// Api\nimport { getRequest } from 'api/v3';\nimport { getIdeaBoardUrl } from 'api/v3/private';\n\n// Components\nimport IdeaBoard from 'ideation/components/ideaBoard/IdeaBoard';\n\nconst IdeaBoardContainer = ({ match }) => {\n const { data } = useSWR(getIdeaBoardUrl(match.params.ideaBoardId), getRequest);\n\n if (!data) return null;\n\n return ;\n};\n\nIdeaBoardContainer.propTypes = {\n match: PropTypes.shape({\n params: PropTypes.shape({\n ideaBoardId: PropTypes.string.isRequired,\n }),\n }).isRequired,\n};\n\nexport default IdeaBoardContainer;\n","// Libraries\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { useRouteMatch } from 'react-router-dom';\nimport { useTranslation } from 'react-i18next';\nimport { currentLanguage } from 'i18n';\n\n// Routes\nimport Routes from 'routes';\n\n// Utils\nimport { determineImageSize, populatePath } from 'common/utils/helpers';\n\n// Enums\nimport PublicStatus from 'common/enums/PublicStatus';\nimport { IdeaBoardType, IdeaType } from 'ideation/enums/propTypes';\n\n// Components\nimport IdeaBoardHeaderContainer from 'ideation/components/ideaBoard/IdeaBoardHeaderContainer';\nimport IdeaActionContainer from 'ideation/components/ideaActions/IdeaActionContainer';\n\nconst IdeaHeader = ({ idea, ideaBoard, onIdeaUpdate }) => {\n const match = useRouteMatch();\n const { t } = useTranslation();\n const backgroundImageUrl =\n ideaBoard?.heroImage?.imageUrls && encodeURI(determineImageSize(ideaBoard.heroImage.imageUrls));\n\n return (\n \n
\n \n {t('ideation.all_ideas')}\n \n
\n
\n
\n {idea?.responseIcon && (\n
\n \n {t(`ideation.idea_response_icon_labels.${idea.responseIcon}`)}\n
\n )}\n
\n

\n {idea?.title}\n

\n
\n {idea?.heroImage?.imageUrls && (\n \n )}\n {idea?.description && (\n
{idea.description}
\n )}\n {idea?.responseText && (\n
\n
\n \n {gon.brand.name_translations[currentLanguage]}\n
\n
{idea.responseText}
\n
\n )}\n
\n
\n {/* TODO: refactor into component */}\n \n {ideaBoard?.publicStatus === PublicStatus.CLOSED\n ? t('ideation.voting_results')\n : t('ideation.vote_for_idea')}\n \n
\n {idea && ideaBoard && (\n \n )}\n
\n
\n
\n
\n );\n};\n\nIdeaHeader.propTypes = {\n idea: IdeaType,\n ideaBoard: IdeaBoardType,\n onIdeaUpdate: PropTypes.func.isRequired,\n};\n\nIdeaHeader.defaultProps = {\n idea: null,\n ideaBoard: null,\n};\n\nexport default IdeaHeader;\n","export const sorts = {\n NEWEST: {\n label: 'ideation.sort_orders.newest',\n param: '-created_at',\n },\n OLDEST: {\n label: 'ideation.sort_orders.oldest',\n param: 'created_at',\n },\n MOST_POPULAR: {\n label: 'ideation.sort_orders.most_popular',\n param: 'most_popular',\n },\n};\n","const reasons = {\n COMMENT_OFFENSIVE: {\n label: 'COMMENT_OFFENSIVE',\n body: 'Report as Offensive',\n id: 1,\n },\n COMMENT_SPAM: {\n label: 'COMMENT_SPAM',\n body: 'Report as Marketing/Spam',\n id: 2,\n },\n COMMENT_OTHER: {\n label: 'COMMENT_OTHER',\n body: 'Report for other reasons',\n id: 3,\n },\n};\n\nexport const { COMMENT_OFFENSIVE, COMMENT_SPAM, COMMENT_OTHER } = reasons;\n","// Libraries\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { useTranslation } from 'react-i18next';\n\nconst CommentActionBar = (props) => {\n const { isReply, disabled, onSubmit, onCancel } = props;\n const { t } = useTranslation();\n\n if (isReply) {\n return (\n
\n \n {t('ideation.reply_button')}\n \n \n
\n );\n }\n\n return (\n
\n \n {t('ideation.comment_button')}\n \n
\n );\n};\n\nCommentActionBar.propTypes = {\n isReply: PropTypes.bool,\n disabled: PropTypes.bool,\n onSubmit: PropTypes.func,\n onCancel: PropTypes.func,\n};\n\nCommentActionBar.defaultProps = {\n isReply: false,\n disabled: false,\n onSubmit: () => {},\n onCancel: () => {},\n};\n\nexport default CommentActionBar;\n","// Libraries\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport toast from 'react-hot-toast';\n\n// Helpers\nimport { rtlLanguage } from 'common/utils/helpers';\n\nconst CommentInputToast = ({ id, children }) => (\n
\n \n \n {children}\n
\n id && toast.remove(id)}\n />\n
\n);\n\nCommentInputToast.propTypes = {\n id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n children: PropTypes.node,\n};\n\nCommentInputToast.defaultProps = {\n id: 0,\n children: <>,\n};\n\nexport default CommentInputToast;\n","// Libraries\nimport React, { useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { currentLanguage } from 'i18n';\nimport PropTypes from 'prop-types';\nimport toast from 'react-hot-toast';\n\n// API\nimport { createDiscussion } from 'api/v3/private/discussion';\n\n// Components\nimport CommentActionBar from 'discussion/components/CommentInput/CommentActionBar';\nimport CommentInputToast from 'discussion/components/CommentInput/CommentInputToast';\n\nconst CommentInput = (props) => {\n const { discussableType, discussableId, parentId, disabled, onSubmit, onCancel } = props;\n const { t } = useTranslation();\n const [loading, setLoading] = useState(false);\n const [comment, setComment] = useState('');\n const [forceSubmit, setForceSubmit] = useState(false);\n const maxLength = 500;\n\n const submitComment = async () => {\n setLoading(true);\n try {\n const response = await createDiscussion(\n discussableType,\n discussableId,\n comment,\n parentId,\n forceSubmit,\n currentLanguage\n );\n\n setComment('');\n setLoading(false);\n setForceSubmit(false);\n toast.remove();\n\n const requireModeration = response?.deserialized?.requireModeration;\n const toxicityScore = response?.deserialized?.toxicityScore;\n if (requireModeration || (toxicityScore && Number(toxicityScore) > 0.5)) {\n toast.custom(\n (toastObj) => (\n \n

{t('ideation.pre_moderate_warning_msg')}

\n
\n ),\n { position: 'bottom-center', duration: 5000 }\n );\n }\n\n onSubmit();\n } catch (err) {\n setLoading(false);\n\n if (err.status === 400) {\n if (!err.body?.errors?.length) return;\n setForceSubmit(true);\n\n const errorMsg = [];\n\n if (Array.isArray(err.body.errors)) {\n err.body.errors.forEach((msg) => errorMsg.push(msg));\n }\n\n if (typeof err.body.errors === 'string') {\n errorMsg.push(err.body.errors);\n }\n\n errorMsg.forEach((msg) =>\n toast.custom(\n (toastObj) => (\n \n

{msg}

\n
\n ),\n { position: 'bottom-center', duration: 60 * 60 * 24 }\n )\n );\n }\n }\n };\n\n const cancelReply = () => {\n setComment('');\n onCancel();\n };\n\n const onCommentChange = (e) => {\n setForceSubmit(false);\n setComment(e.target.value);\n };\n\n return (\n
\n \n
\n \n
\n {comment.length}/{maxLength}\n
\n
\n
\n );\n};\n\nCommentInput.propTypes = {\n discussableType: PropTypes.string.isRequired,\n discussableId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,\n parentId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n disabled: PropTypes.bool,\n onSubmit: PropTypes.func,\n onCancel: PropTypes.func,\n};\n\nCommentInput.defaultProps = {\n parentId: null,\n disabled: false,\n onSubmit: () => {},\n onCancel: () => {},\n};\n\nexport default CommentInput;\n","/**\n * Update the like related properties for a discussion cache\n * @param {function} mutate\n * @param {number} page\n * @param {(number|string)} discussionId\n * @param {(number|string)} discussionLikeId\n */\nexport const updateDiscussionLikeCache = (mutate, page, discussionId, discussionLikeId) => {\n mutate((cachedData) => {\n for (const discussion of cachedData[page].deserialized) {\n if (discussion.id === discussionId) {\n discussion.discussionLikesCount += discussionLikeId ? 1 : -1;\n discussion.userDiscussionLikeId = discussionLikeId;\n }\n }\n\n return cachedData;\n });\n};\n\n/**\n * Update the report related properties for a discussion cache\n * @param {function} mutate\n * @param {number} page\n * @param {(number|string)} discussionId\n * @param {(number|string)} discussionReportId\n */\nexport const updateDiscussionReportCache = (mutate, page, discussionId, discussionReportId) => {\n mutate((cachedData) => {\n for (const discussion of cachedData[page].deserialized) {\n if (discussion.id === discussionId) {\n discussion.discussionReportsCount += 1;\n discussion.userDiscussionReportId = discussionReportId;\n }\n }\n\n return cachedData;\n });\n};\n\n/**\n * To check if the role is a staff role\n * @param {string} role\n * @returns {boolean}\n */\nexport const isStaff = (role) => {\n switch (role) {\n case 'super_admin':\n case 'owner':\n case 'builder':\n case 'contributor':\n case 'read_only':\n case 'participant':\n return true;\n case 'participant_user':\n default:\n return false;\n }\n};\n","import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name compareDesc\n * @category Common Helpers\n * @summary Compare the two dates reverse chronologically and return -1, 0 or 1.\n *\n * @description\n * Compare the two dates and return -1 if the first date is after the second,\n * 1 if the first date is before the second or 0 if dates are equal.\n *\n * @param {Date|Number} dateLeft - the first date to compare\n * @param {Date|Number} dateRight - the second date to compare\n * @returns {Number} the result of the comparison\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Compare 11 February 1987 and 10 July 1989 reverse chronologically:\n * const result = compareDesc(new Date(1987, 1, 11), new Date(1989, 6, 10))\n * //=> 1\n *\n * @example\n * // Sort the array of dates in reverse chronological order:\n * const result = [\n * new Date(1995, 6, 2),\n * new Date(1987, 1, 11),\n * new Date(1989, 6, 10)\n * ].sort(compareDesc)\n * //=> [\n * // Sun Jul 02 1995 00:00:00,\n * // Mon Jul 10 1989 00:00:00,\n * // Wed Feb 11 1987 00:00:00\n * // ]\n */\n\nexport default function compareDesc(dirtyDateLeft, dirtyDateRight) {\n requiredArgs(2, arguments);\n var dateLeft = toDate(dirtyDateLeft);\n var dateRight = toDate(dirtyDateRight);\n var diff = dateLeft.getTime() - dateRight.getTime();\n\n if (diff > 0) {\n return -1;\n } else if (diff < 0) {\n return 1; // Return 0 if diff is 0; return NaN if diff is NaN\n } else {\n return diff;\n }\n}","// Libraries\nimport React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { useTranslation } from 'react-i18next';\nimport { ZCDPopup } from '@zencity/common-ui';\nimport toast from 'react-hot-toast';\n\n// Utils\nimport { rtlLanguage } from 'common/utils/helpers';\n\n// Enums\nimport { COMMENT_OFFENSIVE, COMMENT_OTHER, COMMENT_SPAM } from 'discussion/enums';\n\n// Components\nimport CommentInputToast from 'discussion/components/CommentInput/CommentInputToast';\n\nconst ReportButton = (props) => {\n const {\n userDiscussionReportId,\n discussionReportsCount,\n reportDiscussionAction,\n disabled,\n commentId,\n } = props;\n const { t } = useTranslation();\n const [isOpen, setIsOpen] = useState(false);\n\n const showFlaggedMessage = () => {\n toast.custom(\n (toastObj) => (\n \n

{t('ideation.flagged_msg')}

\n
\n ),\n {\n position: 'bottom-center',\n duration: 2000,\n }\n );\n };\n\n if (userDiscussionReportId) {\n return (\n \n );\n }\n\n return (\n {\n setIsOpen(!isOpen);\n }}\n aria-controls={`reportmenu_${commentId}`}\n >\n \n \n }\n >\n
\n reportDiscussionAction(COMMENT_OFFENSIVE.id, COMMENT_OFFENSIVE.body)}\n role=\"menuitem\"\n >\n {t('ideation.report_offensive')}\n \n reportDiscussionAction(COMMENT_SPAM.id, COMMENT_SPAM.body)}\n role=\"menuitem\"\n >\n {t('ideation.report_spam')}\n \n reportDiscussionAction(COMMENT_OTHER.id, COMMENT_OTHER.body)}\n role=\"menuitem\"\n >\n {t('ideation.report_other')}\n \n
\n \n );\n};\n\nReportButton.propTypes = {\n userDiscussionReportId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n discussionReportsCount: PropTypes.number.isRequired,\n reportDiscussionAction: PropTypes.func,\n disabled: PropTypes.bool,\n commentId: PropTypes.string.isRequired,\n};\n\nReportButton.defaultProps = {\n userDiscussionReportId: null,\n reportDiscussionAction: () => {},\n disabled: false,\n};\n\nexport default ReportButton;\n","// Libraries\nimport React, { useState, useMemo } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport useSWRInfinite from 'swr/infinite';\nimport { format } from 'date-fns';\nimport { useTranslation } from 'react-i18next';\n\n// Utils\nimport { redirectToSignInPath } from 'common/utils/authHelpers';\nimport { isStaff, updateDiscussionLikeCache, updateDiscussionReportCache } from 'discussion/utils';\n\n// APIs\nimport { getRequest } from 'api/v3/helpers';\nimport {\n getDiscussionRepliesURL,\n createDiscussionLike,\n removeDiscussionLike,\n createDiscussionReport,\n} from 'api/v3/private/discussion';\n\n// Components\nimport CommentInput from 'discussion/components/CommentInput';\nimport ReportButton from 'discussion/components/DiscussionComment/ReportButton';\n\nconst DiscussionComment = (props) => {\n const {\n id,\n discussableType,\n discussableId,\n discussionAuthorId,\n approved,\n requireModeration,\n body,\n discussionLikesCount,\n discussionReportsCount,\n username,\n userRole,\n createdAt,\n level,\n isLoggedIn,\n replyCount,\n parentId,\n userDiscussionLikeId,\n userDiscussionReportId,\n disableActions,\n discussionStates,\n onStateChange,\n onCommentSubmit,\n onCreateLike,\n onRemoveLike,\n onCreateReport,\n } = props;\n const { t } = useTranslation();\n const [showReply, setShowReply] = useState(false);\n const [showLoadMoreBtn, setShowLoadMoreBtn] = useState(!!replyCount);\n const {\n data: replyPages,\n size,\n setSize,\n mutate,\n } = useSWRInfinite((pageIndex, previousPageData) => {\n if (!discussionStates[id]?.shouldLoadMore) return null;\n if (previousPageData && !previousPageData.length) return null;\n return getDiscussionRepliesURL(id, pageIndex + 1);\n }, getRequest);\n\n const maxLevel = 5;\n const componentClassName = `discussion-topic-comment${\n level > 1 && level <= maxLevel ? '__child-comment' : ''\n }`;\n\n const loadMoreReplies = () => {\n if (!discussionStates[id]?.shouldLoadMore) {\n onStateChange(id, { shouldLoadMore: true });\n setShowLoadMoreBtn(false);\n return;\n }\n setSize(size + 1);\n };\n\n const formattedCreatedAt = format(new Date(createdAt), 'yyyy-MM-dd hh:mm:ss');\n\n const onCommentSubmitted = () => {\n setShowReply(false);\n onCommentSubmit();\n loadMoreReplies();\n };\n\n const replyCommentElements = useMemo(() => {\n if (!replyPages?.length) {\n return [];\n }\n return replyPages\n .map((replyPage, page) => {\n if (size >= replyPage.meta.totalPages) setShowLoadMoreBtn(false);\n if (!replyPage.deserialized?.length) return false;\n\n return replyPage.deserialized.map((data) => {\n return (\n \n updateDiscussionLikeCache(mutate, page, discussionId, discussionLikeId)\n }\n onRemoveLike={(discussionId) =>\n updateDiscussionLikeCache(mutate, page, discussionId, null)\n }\n onCreateReport={(discussionId, discussionReportId) =>\n updateDiscussionReportCache(mutate, page, discussionId, discussionReportId)\n }\n onStateChange={onStateChange}\n discussableId={discussableId}\n disableActions={disableActions}\n discussionStates={discussionStates}\n />\n );\n });\n })\n .flat();\n }, [replyPages, discussionStates]);\n\n /**\n * Like or dislike a comment\n */\n const likeDiscussionAction = async () => {\n if (!isLoggedIn) {\n redirectToSignInPath(window.location.pathname);\n }\n\n if (userDiscussionLikeId) {\n await removeDiscussionLike(id, userDiscussionLikeId);\n onRemoveLike(id);\n return;\n }\n\n const response = await createDiscussionLike(id);\n if (response?.deserialized?.id) {\n // discussionId, discussionLikeId\n onCreateLike(id, response?.deserialized?.id);\n }\n };\n\n /**\n * Report a comment\n */\n const reportDiscussionAction = async (reasonId, description) => {\n if (!isLoggedIn) {\n redirectToSignInPath(window.location.pathname);\n }\n\n const response = await createDiscussionReport(id, reasonId, description);\n if (response?.deserialized?.id) {\n onCreateReport(id, response?.deserialized?.id);\n }\n };\n\n const showReplyInput = () => {\n if (!isLoggedIn) {\n redirectToSignInPath(window.location.pathname);\n return;\n }\n\n setShowReply(true);\n };\n\n const displayBody = () => {\n // pending comment\n if (!approved && requireModeration)\n return (\n <>\n

{body}

\n \n \n {t('ideation.pending_comment_reminder')}\n \n \n );\n\n // rejected comment\n if (!approved)\n return (\n \n \n {t('ideation.moderator_message')}\n \n );\n\n return

{body}

;\n };\n\n const shouldDisplayActions = approved && !requireModeration;\n\n return (\n \n
\n {isStaff(userRole) ? (\n Staff\n ) : (\n \n )}\n {username || '--'}・\n {formattedCreatedAt}\n
\n
{displayBody()}
\n {shouldDisplayActions && (\n
\n
\n {level < maxLevel && (\n \n )}\n \n
\n {/* Report Flag */}\n
\n \n
\n
\n )}\n {showReply && (\n
\n = maxLevel ? parentId : id}\n disabled={disableActions}\n onSubmit={onCommentSubmitted}\n onCancel={() => setShowReply(false)}\n />\n
\n )}\n {!!replyCommentElements.length && (\n
{replyCommentElements}
\n )}\n {showLoadMoreBtn && (\n
\n \n
\n )}\n \n );\n};\n\nconst commentPropTypes = {\n id: PropTypes.string.isRequired,\n discussableId: PropTypes.number.isRequired,\n discussionAuthorId: PropTypes.number.isRequired,\n approved: PropTypes.bool.isRequired,\n body: PropTypes.string.isRequired,\n discussionLikesCount: PropTypes.number.isRequired,\n discussionReportsCount: PropTypes.number.isRequired,\n username: PropTypes.string,\n createdAt: PropTypes.string,\n level: PropTypes.number,\n userDiscussionLikeId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n userDiscussionReportId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n};\n\nDiscussionComment.propTypes = {\n ...commentPropTypes,\n parentId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n level: PropTypes.number,\n isLoggedIn: PropTypes.bool,\n disableActions: PropTypes.bool,\n onCommentSubmit: PropTypes.func,\n onCreateLike: PropTypes.func,\n onRemoveLike: PropTypes.func,\n onCreateReport: PropTypes.func,\n};\n\nDiscussionComment.defaultProps = {\n parentId: null,\n level: 1,\n isLoggedIn: false,\n disableActions: false,\n onCommentSubmit: () => {},\n onCreateLike: () => {},\n onRemoveLike: () => {},\n onCreateReport: () => {},\n};\n\nexport default DiscussionComment;\n","// Libraries\nimport React, { useEffect, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { useTranslation } from 'react-i18next';\n\n// Enums\nimport * as eumns from 'discussion/enums';\n\nconst SortOptions = ({ defaultSorting, onSortingChange, ariaLabel }) => {\n const { t } = useTranslation();\n const [sorting, setSorting] = useState(defaultSorting);\n\n const options = Object.keys(eumns.sorts).map((key) => {\n const option = eumns.sorts[key];\n\n return (\n \n );\n });\n\n useEffect(() => onSortingChange(sorting), [sorting]);\n\n return (\n \n );\n};\n\nSortOptions.propTypes = {\n defaultSorting: PropTypes.oneOf(Object.values(eumns.sorts).map((o) => o.param)),\n onSortingChange: PropTypes.func,\n ariaLabel: PropTypes.string.isRequired,\n};\n\nSortOptions.defaultProps = {\n defaultSorting: eumns.sorts.NEWEST.param,\n onSortingChange: () => {},\n};\n\nexport default SortOptions;\n","// Libraries\nimport React, { useState, useMemo } from 'react';\nimport PropTypes from 'prop-types';\nimport { useTranslation } from 'react-i18next';\nimport useSWRInfinite from 'swr/infinite';\n\n// API\nimport { getRequest } from 'api/v3/helpers';\nimport { getDiscussionTopicDiscussionsURL, getIdeaDiscussionsURL } from 'api/v3/private';\n\n// Utils\nimport { updateDiscussionLikeCache, updateDiscussionReportCache } from 'discussion/utils';\n\n// Enums\nimport { DiscussionTopic, Idea } from 'common/enums/DiscussableTypes';\n\n// Components\nimport DiscussionComment from 'discussion/components/DiscussionComment';\nimport SortOptions from 'discussion/components/DiscussionCommentList/SortOptions';\n\nconst DiscussionCommentList = (props) => {\n const {\n discussableType,\n discussableId,\n approvedAndModeratedCount,\n isLoggedIn,\n sorting,\n disableActions,\n onSortingChange,\n onCommentSubmit,\n } = props;\n const { t } = useTranslation();\n const [discussionStates, setDiscussionStates] = useState({});\n const [showLoadMoreBtn, setShowLoadMoreBtn] = useState(false);\n\n const {\n data: commentPages,\n size,\n setSize,\n mutate,\n } = useSWRInfinite((pageIndex, previousPageData) => {\n if (previousPageData && !previousPageData.deserialized.length) return null;\n\n switch (discussableType) {\n case DiscussionTopic:\n return getDiscussionTopicDiscussionsURL(discussableId, pageIndex + 1, 25, sorting);\n case Idea:\n return getIdeaDiscussionsURL(discussableId, pageIndex + 1, 25, sorting);\n default:\n return '';\n }\n }, getRequest);\n\n const changeDiscussionState = (discussionId, value) => {\n const state = discussionStates[discussionId]\n ? { ...discussionStates[discussionId], ...value }\n : value;\n\n const states = { ...discussionStates };\n states[discussionId] = state;\n setDiscussionStates(states);\n };\n\n const commentElements = useMemo(() => {\n if (!commentPages?.length) {\n return [];\n }\n\n return commentPages\n .map((commentPage, page) => {\n if (size < commentPage.meta.totalPages) {\n setShowLoadMoreBtn(true);\n } else {\n setShowLoadMoreBtn(false);\n }\n if (!commentPage.deserialized?.length) return false;\n\n return commentPage.deserialized.map((c) => {\n if (c.approved === false) {\n if (!c.requireModeration && c.replyCount === 0) return null;\n }\n\n return (\n \n updateDiscussionLikeCache(mutate, page, discussionId, discussionLikeId)\n }\n onRemoveLike={(discussionId) =>\n updateDiscussionLikeCache(mutate, page, discussionId, null)\n }\n onCreateReport={(discussionId, discussionReportId) =>\n updateDiscussionReportCache(mutate, page, discussionId, discussionReportId)\n }\n onStateChange={changeDiscussionState}\n isLoggedIn={isLoggedIn}\n disableActions={disableActions}\n {...c}\n discussionStates={discussionStates}\n />\n );\n });\n })\n .flat();\n }, [commentPages, discussionStates]);\n\n const changeSorting = (sortingOption) => {\n onSortingChange(sortingOption);\n };\n\n const commentCountSuffix = `ideation.comment_${\n approvedAndModeratedCount > 1 ? 'plural' : 'single'\n }`;\n\n return (\n
\n
\n
{`${approvedAndModeratedCount} ${t(commentCountSuffix)}`}
\n
\n {t('ideation.sort_by')} :\n \n
\n
\n {commentElements}\n {showLoadMoreBtn && (\n
\n setSize(size + 1)}\n >\n {t('ideation.view_more_comments')}\n \n
\n )}\n
\n );\n};\n\nDiscussionCommentList.propTypes = {\n discussableType: PropTypes.string.isRequired,\n discussableId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,\n approvedAndModeratedCount: PropTypes.number.isRequired,\n isLoggedIn: PropTypes.bool,\n sorting: PropTypes.string.isRequired,\n disableActions: PropTypes.bool,\n onSortingChange: PropTypes.func,\n onCommentSubmit: PropTypes.func,\n};\n\nDiscussionCommentList.defaultProps = {\n isLoggedIn: false,\n disableActions: false,\n onSortingChange: () => {},\n onCommentSubmit: () => {},\n};\n\nexport default DiscussionCommentList;\n","// Libraries\nimport React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { useSWRConfig } from 'swr';\n\n// Enums\nimport { sorts } from 'discussion/enums';\nimport DiscussableTypes from 'common/enums/DiscussableTypes';\n\n// Components\nimport CommentInput from 'discussion/components/CommentInput';\nimport DiscussionCommentList from 'discussion/components/DiscussionCommentList';\n\nconst DiscussionBoard = (props) => {\n const {\n discussableId,\n discussableType,\n isLoggedIn,\n approvedAndModeratedCount,\n disabled,\n onRootCommentSubmit,\n } = props;\n\n const { cache, mutate } = useSWRConfig();\n const [sorting, setSorting] = useState(sorts.NEWEST.param);\n\n // Mutate SWR for getting latest data\n const clearDiscussionCaches = async () => {\n const mutations = Array.from(cache.keys()).map((key) => mutate(key));\n await Promise.all(mutations);\n };\n\n const onSortingChange = async (sortingOption) => {\n if (sortingOption !== sorting) {\n setSorting(sortingOption);\n await clearDiscussionCaches();\n }\n };\n\n return (\n
\n {isLoggedIn && (\n {\n clearDiscussionCaches();\n onRootCommentSubmit?.();\n }}\n />\n )}\n
\n \n
\n );\n};\n\nDiscussionBoard.propTypes = {\n discussableId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,\n discussableType: PropTypes.oneOf(Object.values(DiscussableTypes)).isRequired,\n isLoggedIn: PropTypes.bool.isRequired,\n disabled: PropTypes.bool.isRequired,\n approvedAndModeratedCount: PropTypes.number.isRequired,\n onRootCommentSubmit: PropTypes.func,\n};\n\nDiscussionBoard.defaultProps = {\n onRootCommentSubmit: null,\n};\n\nexport default DiscussionBoard;\n","// Libraries\nimport React from 'react';\nimport { useTranslation } from 'react-i18next';\n\n// Utils\nimport { redirectToSignInPath, redirectToSignUpPath } from 'common/utils/authHelpers';\n\nconst LoginSection = () => {\n const { t } = useTranslation();\n\n return (\n
\n
{t('ideation.login_or_sign_up_reminder')}
\n
\n redirectToSignInPath(window.location.pathname)}\n >\n {t('ideation.log_in_button')}\n \n redirectToSignUpPath(window.location.pathname)}\n >\n {t('ideation.sign_up_button')}\n \n
\n
\n );\n};\n\nexport default LoginSection;\n","// Libraries\nimport React from 'react';\nimport jwtDecode from 'jwt-decode';\nimport { useTranslation } from 'react-i18next';\n\n// Utils\nimport { getUserToken } from 'ideation/utils/userAuthenticate';\nimport { csrfToken, signOutPath } from 'common/utils/authHelpers';\n\nconst SIGN_OUT_PATH = signOutPath(window.location.pathname);\nconst CSRF_TOKEN = csrfToken();\n\nconst ProfileSection = () => {\n const { t } = useTranslation();\n const token = getUserToken();\n const username = jwtDecode(token).preferred_username;\n\n return (\n
\n ${username}`,\n interpolation: { escapeValue: false },\n }),\n }}\n />\n {/* TODO create a user profile page for this button */}\n {/* .\n console.log('my profile')}\n >\n {t('ideation.my_profile')}\n */}\n .\n
\n \n \n \n
\n
\n );\n};\n\nexport default ProfileSection;\n","// Libraries\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { withRouter } from 'react-router-dom';\nimport { useTranslation } from 'react-i18next';\nimport useSWR from 'swr';\n\n// Api\nimport { getRequest } from 'api/v3';\nimport { getIdeaBoardUrl, getIdeaUrl, getIdeaFetcher } from 'api/v3/private';\n\n// Utils\nimport { userAuthenticated } from 'ideation/utils/userAuthenticate';\n\n// Enums\nimport DiscussableTypes from 'common/enums/DiscussableTypes';\nimport PublicStatus from 'common/enums/PublicStatus';\n\n// Components\nimport Header from 'header/components/Header';\nimport Footer from 'common/components/Footer';\nimport SocialFooter from 'common/components/SocialFooter';\nimport IdeaHeader from 'ideation/components/idea/IdeaHeader';\nimport DiscussionBoard from 'discussion/components/DiscussionBoard';\nimport LoginSection from 'discussion/components/LoginSection';\nimport ProfileSection from 'discussion/components/ProfileSection';\n\nconst IdeaContainer = ({ match }) => {\n const { t } = useTranslation();\n const { ideaBoardId, ideaId } = match.params;\n const ideaBoard = useSWR(getIdeaBoardUrl(ideaBoardId), getRequest);\n const idea = useSWR([getIdeaUrl(ideaId, { include: 'hero_image' }), ideaBoardId], getIdeaFetcher);\n const isLoggedIn = userAuthenticated();\n const approvedAndModeratedCount = idea.data\n ? idea.data?.deserialized?.approvedAndModeratedCount\n : 0;\n\n const onIdeaUpdate = (updatedIdea) => {\n idea.mutate({ deserialized: updatedIdea }, false);\n };\n\n const disabled = ideaBoard?.data?.deserialized?.publicStatus !== PublicStatus.OPEN;\n\n return (\n
\n
\n \n
\n
\n
\n

\n {t(\n disabled\n ? 'ideation.idea_board_closed_notification'\n : 'ideation.thoughts_or_feedback'\n )}\n

\n
\n
\n\n
\n
\n {isLoggedIn ? : }\n\n {ideaBoard.data?.deserialized && (\n \n )}\n
\n
\n
\n \n
\n
\n );\n};\n\nIdeaContainer.propTypes = {\n match: PropTypes.shape({\n params: PropTypes.objectOf(PropTypes.string).isRequired,\n }).isRequired,\n};\n\nexport default withRouter(IdeaContainer);\n","// Libraries\nimport React from 'react';\nimport PropTypes from 'prop-types';\n\nconst PreviewModeBanner = ({ message }) => (\n
\n
\n \n {message}\n
\n
\n);\n\nPreviewModeBanner.propTypes = {\n message: PropTypes.string.isRequired,\n};\n\nexport default PreviewModeBanner;\n","function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function _objectSpread2(e){for(var t=1;t=0||(n[r]=e[r]);return n}function _objectWithoutProperties(e,t){if(null==e)return{};var r,i,n=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");return e}function _possibleConstructorReturn(e,t){if(t&&(\"object\"==typeof t||\"function\"==typeof t))return t;if(void 0!==t)throw new TypeError(\"Derived constructors may only return object or undefined\");return _assertThisInitialized(e)}function _createSuper(e){var t=_isNativeReflectConstruct();return function(){var r,i=_getPrototypeOf(e);if(t){var n=_getPrototypeOf(this).constructor;r=Reflect.construct(i,arguments,n)}else r=i.apply(this,arguments);return _possibleConstructorReturn(this,r)}}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _iterableToArray(e){if(\"undefined\"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e[\"@@iterator\"])return Array.from(e)}function _unsupportedIterableToArray(e,t){if(e){if(\"string\"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return\"Object\"===r&&e.constructor&&(r=e.constructor.name),\"Map\"===r||\"Set\"===r?Array.from(e):\"Arguments\"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:function(){return{}},r=function(r){function i(e,r){var s;return _classCallCheck(this,i),s=n.call(this,e,r),s.state=t(_objectSpread2({},r.state)),s.updateStateProps=s.updateStateProps.bind(_assertThisInitialized(s)),s}_inherits(i,r);var n=_createSuper(i);return _createClass(i,[{key:\"componentDidMount\",value:function(){this.context.subscribe(this.updateStateProps)}},{key:\"shouldComponentUpdate\",value:function(e,t){return!equals(t,this.state)||!equals(e,this.props)}},{key:\"componentWillUnmount\",value:function(){this.context.unsubscribe(this.updateStateProps)}},{key:\"updateStateProps\",value:function(){this.setState(t(_objectSpread2({},this.context.state)))}},{key:\"render\",value:function(){var t=this,r=deepmerge_1(this.state,this.props);return React.createElement(e,_extends({ref:function(e){t.instance=e}},r,{carouselStore:{getStoreState:this.context.getStoreState,masterSpinnerError:this.context.masterSpinnerError,masterSpinnerSuccess:this.context.masterSpinnerSuccess,setStoreState:this.context.setStoreState,subscribeMasterSpinner:this.context.subscribeMasterSpinner,unsubscribeAllMasterSpinner:this.context.unsubscribeAllMasterSpinner,unsubscribeMasterSpinner:this.context.unsubscribeMasterSpinner}}),this.props.children)}}]),i}(React.Component);return _defineProperty(r,\"contextType\",Context),_defineProperty(r,\"propTypes\",{children:CarouselPropTypes.children}),_defineProperty(r,\"defaultProps\",{children:null}),r}import React from\"react\";var ReactPropTypesSecret=\"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED\",ReactPropTypesSecret_1=ReactPropTypesSecret;emptyFunctionWithReset.resetWarningCache=emptyFunction;var factoryWithThrowingShims=function(){function e(e,t,r,i,n,s){if(s!==ReactPropTypesSecret_1){var a=new Error(\"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types\");throw a.name=\"Invariant Violation\",a}}function t(){return e}e.isRequired=e;var r={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:emptyFunctionWithReset,resetWarningCache:emptyFunction};return r.PropTypes=r,r},propTypes=createCommonjsModule(function(e){e.exports=factoryWithThrowingShims()}),LOADING=\"loading\",SUCCESS=\"success\",ERROR=\"error\",CarouselPropTypes={children:propTypes.oneOfType([propTypes.arrayOf(propTypes.node),propTypes.node]),direction:propTypes.oneOf([\"forward\",\"backward\"]),height:function(e,t){var r=e[t];return\"vertical\"!==e.orientation||null!==r&&\"number\"==typeof r?null:new Error(\"Missing required property '\".concat(t,\"' when orientation is vertical. You must supply a number representing the height in pixels\"))},orientation:propTypes.oneOf([\"horizontal\",\"vertical\"]),isBgImage:function(e,t){return!0===e[t]&&\"img\"===e.tag?new Error(\"HTML img elements should not have a backgroundImage. Please use \".concat(t,\" for other block-level HTML tags, like div, a, section, etc...\")):null}},boundedRange=function(e){var t=e.min,r=e.max,i=e.x;return Math.min(r,Math.max(t,i))},s={buttonBack:\"buttonBack___1mlaL\"},_excluded=[\"carouselStore\",\"className\",\"currentSlide\",\"disabled\",\"onClick\",\"step\",\"totalSlides\",\"visibleSlides\",\"infinite\"],ButtonBack=function(e){function t(e){var i;return _classCallCheck(this,t),i=r.call(this,e),i.handleOnClick=i.handleOnClick.bind(_assertThisInitialized(i)),i}_inherits(t,e);var r=_createSuper(t);return _createClass(t,[{key:\"handleOnClick\",value:function(e){var t=this.props,r=t.carouselStore,i=t.currentSlide,n=t.onClick,s=t.step,a=t.infinite,o=t.visibleSlides,l=t.totalSlides-o,c=Math.max(i-s,0);a&&(c=0===i?l:c),r.setStoreState({currentSlide:c,isPlaying:!1},null!==n&&n.call(this,e))}},{key:\"render\",value:function(){var e=this.props,r=(e.carouselStore,e.className),i=(e.currentSlide,e.disabled,e.onClick,e.step,e.totalSlides,e.visibleSlides,e.infinite),n=_objectWithoutProperties(e,_excluded),a=cn([s.buttonBack,\"carousel__back-button\",r]),o=t.setDisabled(this.props.disabled,this.props.currentSlide,i);return React.createElement(\"button\",_extends({type:\"button\",\"aria-label\":\"previous\",className:a,onClick:this.handleOnClick,disabled:o},n),this.props.children)}}],[{key:\"setDisabled\",value:function(e,t,r){return null!==e?e:0===t&&!r}}]),t}(React.Component);_defineProperty(ButtonBack,\"propTypes\",{carouselStore:propTypes.object.isRequired,children:CarouselPropTypes.children.isRequired,className:propTypes.string,currentSlide:propTypes.number.isRequired,disabled:propTypes.bool,onClick:propTypes.func,step:propTypes.number.isRequired,totalSlides:propTypes.number.isRequired,visibleSlides:propTypes.number.isRequired,infinite:propTypes.bool}),_defineProperty(ButtonBack,\"defaultProps\",{className:null,disabled:null,onClick:null,infinite:!1});var jkrosoType=createCommonjsModule(function(e,t){var r={}.toString,i=\"undefined\"!=typeof window?window.Node:Function;e.exports=t=function(e){var t=typeof e;if(\"object\"!=t)return t;if(t=n[r.call(e)],\"object\"==t)return e instanceof Map?\"map\":e instanceof Set?\"set\":\"object\";if(t)return t;if(e instanceof i)switch(e.nodeType){case 1:return\"element\";case 3:return\"text-node\";case 9:return\"document\";case 11:return\"document-fragment\";default:return\"dom-node\"}};var n=t.types={\"[object Function]\":\"function\",\"[object Date]\":\"date\",\"[object RegExp]\":\"regexp\",\"[object Arguments]\":\"arguments\",\"[object Array]\":\"array\",\"[object Set]\":\"set\",\"[object String]\":\"string\",\"[object Null]\":\"null\",\"[object Undefined]\":\"undefined\",\"[object Number]\":\"number\",\"[object Boolean]\":\"boolean\",\"[object Object]\":\"object\",\"[object Map]\":\"map\",\"[object Text]\":\"text-node\",\"[object Uint8Array]\":\"bit-array\",\"[object Uint16Array]\":\"bit-array\",\"[object Uint32Array]\":\"bit-array\",\"[object Uint8ClampedArray]\":\"bit-array\",\"[object Error]\":\"error\",\"[object FormData]\":\"form-data\",\"[object File]\":\"file\",\"[object Blob]\":\"blob\"}}),jkrosoType_1=jkrosoType.types,types={};types.number=function(e,t){return e!==e&&t!==t},types.function=function(e,t,r){return e.toString()===t.toString()&&types.object(e,t,r)&&equal(e.prototype,t.prototype)},types.date=function(e,t){return+e==+t},types.regexp=function(e,t){return e.toString()===t.toString()},types.element=function(e,t){return e.outerHTML===t.outerHTML},types.textnode=function(e,t){return e.textContent===t.textContent},types.arguments=types[\"bit-array\"]=types.array=memoGaurd(arrayEqual),types.object=memoGaurd(objectEqual);var equals=equal,isMergeableObject=function(e){return isNonNullObject(e)&&!isSpecial(e)},canUseSymbol=\"function\"==typeof Symbol&&Symbol.for,REACT_ELEMENT_TYPE=canUseSymbol?Symbol.for(\"react.element\"):60103;deepmerge.all=function(e,t){if(!Array.isArray(e))throw new Error(\"first argument should be an array\");return e.reduce(function(e,r){return deepmerge(e,r,t)},{})};var deepmerge_1=deepmerge,Context=React.createContext(),deepFreeze=function e(t){return Object.freeze(t),Object.getOwnPropertyNames(t).forEach(function(r){!t.hasOwnProperty(r)||null===t[r]||\"object\"!=typeof t[r]&&\"function\"!=typeof t[r]||Object.isFrozen(t[r])||e(t[r])}),t},DEFAULT_STATE={masterSpinnerFinished:!1},Store=function(){function e(t){_classCallCheck(this,e),this.state=deepFreeze(deepmerge_1(DEFAULT_STATE,t)),this.subscriptions=[],this.masterSpinnerSubscriptions={},this.setStoreState=this.setStoreState.bind(this),this.getStoreState=this.getStoreState.bind(this),this.subscribe=this.subscribe.bind(this),this.unsubscribe=this.unsubscribe.bind(this),this.updateSubscribers=this.updateSubscribers.bind(this),this.subscribeMasterSpinner=this.subscribeMasterSpinner.bind(this),this.unsubscribeMasterSpinner=this.unsubscribeMasterSpinner.bind(this),this.unsubscribeAllMasterSpinner=this.unsubscribeAllMasterSpinner.bind(this),this.masterSpinnerSuccess=this.masterSpinnerSuccess.bind(this),this.masterSpinnerError=this.masterSpinnerError.bind(this)}return _createClass(e,[{key:\"setStoreState\",value:function(e,t){this.state=deepFreeze(deepmerge_1(this.state,e)),this.updateSubscribers(t)}},{key:\"getStoreState\",value:function(){return deepmerge_1({},this.state)}},{key:\"subscribe\",value:function(e){this.subscriptions.push(e)}},{key:\"unsubscribe\",value:function(e){var t=this.subscriptions.indexOf(e);-1!==t&&this.subscriptions.splice(t,1)}},{key:\"updateSubscribers\",value:function(e){this.subscriptions.forEach(function(e){return e()}),\"function\"==typeof e&&e(this.getStoreState())}},{key:\"subscribeMasterSpinner\",value:function(e){-1===Object.keys(this.masterSpinnerSubscriptions).indexOf(e)&&(this.masterSpinnerSubscriptions[e]={success:!1,error:!1,complete:!1})}},{key:\"unsubscribeMasterSpinner\",value:function(e){return-1!==Object.keys(this.masterSpinnerSubscriptions).indexOf(e)&&(this.setMasterSpinnerFinished(),delete this.masterSpinnerSubscriptions[e])}},{key:\"unsubscribeAllMasterSpinner\",value:function(){this.masterSpinnerSubscriptions={},this.setMasterSpinnerFinished()}},{key:\"masterSpinnerSuccess\",value:function(e){this.masterSpinnerSubscriptions[e].success=!0,this.masterSpinnerSubscriptions[e].complete=!0,this.setMasterSpinnerFinished()}},{key:\"masterSpinnerError\",value:function(e){this.masterSpinnerSubscriptions[e].error=!0,this.masterSpinnerSubscriptions[e].complete=!0,this.setMasterSpinnerFinished()}},{key:\"setMasterSpinnerFinished\",value:function(){this.setStoreState({masterSpinnerFinished:this.isMasterSpinnerFinished()})}},{key:\"isMasterSpinnerFinished\",value:function(){var e=this;return 0===Object.keys(this.masterSpinnerSubscriptions).filter(function(t){return!0!==e.masterSpinnerSubscriptions[t].complete}).length}}]),e}(),_excluded$1=[\"children\",\"className\",\"currentSlide\",\"disableAnimation\",\"disableKeyboard\",\"hasMasterSpinner\",\"interval\",\"isPageScrollLocked\",\"isPlaying\",\"lockOnWindowScroll\",\"naturalSlideHeight\",\"naturalSlideWidth\",\"orientation\",\"playDirection\",\"step\",\"dragStep\",\"tag\",\"totalSlides\",\"touchEnabled\",\"dragEnabled\",\"visibleSlides\",\"infinite\",\"isIntrinsicHeight\"],_class,_temp,CarouselProvider=(_temp=_class=function(e){function t(e){var i;if(_classCallCheck(this,t),i=r.call(this,e),e.isIntrinsicHeight&&\"horizontal\"!==e.orientation)throw Error('isIntrinsicHeight can only be used in \"horizontal\" orientation. See Readme for more information.');var n={currentSlide:e.currentSlide,disableAnimation:e.disableAnimation,disableKeyboard:e.disableKeyboard,hasMasterSpinner:e.hasMasterSpinner,imageErrorCount:0,imageSuccessCount:0,interval:e.interval,isPageScrollLocked:e.isPageScrollLocked,isPlaying:e.isPlaying,lockOnWindowScroll:e.lockOnWindowScroll,masterSpinnerThreshold:0,naturalSlideHeight:e.naturalSlideHeight,naturalSlideWidth:e.naturalSlideWidth,orientation:e.orientation,playDirection:e.playDirection,privateUnDisableAnimation:!1,slideSize:slideSize(e.totalSlides,e.visibleSlides),slideTraySize:slideTraySize(e.totalSlides,e.visibleSlides),step:e.step,dragStep:e.dragStep,totalSlides:e.totalSlides,touchEnabled:e.touchEnabled,dragEnabled:e.dragEnabled,visibleSlides:e.visibleSlides,infinite:e.infinite,isIntrinsicHeight:e.isIntrinsicHeight};return i.carouselStore=new Store(n),i}_inherits(t,e);var r=_createSuper(t);return _createClass(t,[{key:\"componentDidUpdate\",value:function(e){var t=this,r={};[\"currentSlide\",\"disableAnimation\",\"disableKeyboard\",\"hasMasterSpinner\",\"interval\",\"isPlaying\",\"naturalSlideHeight\",\"naturalSlideWidth\",\"lockOnWindowScroll\",\"orientation\",\"playDirection\",\"step\",\"dragStep\",\"totalSlides\",\"touchEnabled\",\"dragEnabled\",\"visibleSlides\"].forEach(function(i){e[i]!==t.props[i]&&(r[i]=t.props[i])}),this.props.currentSlide!==e.currentSlide&&!this.props.disableAnimation&&(r.disableAnimation=!0,r.privateUnDisableAnimation=!0),this.props.totalSlides===e.totalSlides&&this.props.visibleSlides===e.visibleSlides||(r.slideSize=slideSize(this.props.totalSlides,this.props.visibleSlides),r.slideTraySize=slideTraySize(this.props.totalSlides,this.props.visibleSlides)),this.carouselStore.state.currentSlide>=this.props.totalSlides&&(r.currentSlide=Math.max(this.props.totalSlides-1,0)),Object.keys(r).length>0&&this.carouselStore.setStoreState(r)}},{key:\"componentWillUnmount\",value:function(){this.carouselStore.unsubscribeAllMasterSpinner()}},{key:\"getStore\",value:function(){return this.carouselStore}},{key:\"render\",value:function(){var e=this.props,t=(e.children,e.className,e.currentSlide,e.disableAnimation,e.disableKeyboard,e.hasMasterSpinner,e.interval,e.isPageScrollLocked,e.isPlaying,e.lockOnWindowScroll,e.naturalSlideHeight,e.naturalSlideWidth,e.orientation,e.playDirection,e.step,e.dragStep,e.tag),r=(e.totalSlides,e.touchEnabled,e.dragEnabled,e.visibleSlides,e.infinite,e.isIntrinsicHeight,_objectWithoutProperties(e,_excluded$1)),i=cn([\"carousel\",this.props.className]);return React.createElement(t,_extends({className:i},r),React.createElement(Context.Provider,{value:this.carouselStore},this.props.children))}}]),t}(React.Component),_defineProperty(_class,\"propTypes\",{children:CarouselPropTypes.children.isRequired,className:propTypes.string,currentSlide:propTypes.number,disableAnimation:propTypes.bool,disableKeyboard:propTypes.bool,hasMasterSpinner:propTypes.bool,interval:propTypes.number,isPageScrollLocked:propTypes.bool,isPlaying:propTypes.bool,lockOnWindowScroll:propTypes.bool,naturalSlideHeight:propTypes.number.isRequired,naturalSlideWidth:propTypes.number.isRequired,orientation:CarouselPropTypes.orientation,playDirection:CarouselPropTypes.direction,step:propTypes.number,dragStep:propTypes.number,tag:propTypes.string,totalSlides:propTypes.number.isRequired,touchEnabled:propTypes.bool,dragEnabled:propTypes.bool,visibleSlides:propTypes.number,infinite:propTypes.bool,isIntrinsicHeight:propTypes.bool}),_defineProperty(_class,\"defaultProps\",{className:null,currentSlide:0,disableAnimation:!1,disableKeyboard:!1,hasMasterSpinner:!1,interval:5e3,isPageScrollLocked:!1,isPlaying:!1,lockOnWindowScroll:!1,orientation:\"horizontal\",playDirection:\"forward\",step:1,dragStep:1,tag:\"div\",touchEnabled:!0,dragEnabled:!0,visibleSlides:1,infinite:!1,isIntrinsicHeight:!1}),_temp);Context.Consumer;var index=WithStore(ButtonBack,function(e){return{currentSlide:e.currentSlide,step:e.step,totalSlides:e.totalSlides,visibleSlides:e.visibleSlides,infinite:e.infinite}}),s$1={buttonFirst:\"buttonFirst___2rhFr\"},_excluded$2=[\"carouselStore\",\"className\",\"currentSlide\",\"disabled\",\"onClick\",\"totalSlides\"],_class$1,_temp$1,ButtonFirst=(_temp$1=_class$1=function(e){function t(){var e;return _classCallCheck(this,t),e=r.call(this),e.handleOnClick=e.handleOnClick.bind(_assertThisInitialized(e)),e}_inherits(t,e);var r=_createSuper(t);return _createClass(t,[{key:\"handleOnClick\",value:function(e){var t=this.props,r=t.carouselStore,i=t.onClick;r.setStoreState({currentSlide:0,isPlaying:!1},null!==i&&i.call(this,e))}},{key:\"render\",value:function(){var e=this.props,t=(e.carouselStore,e.className),r=e.currentSlide,i=e.disabled,n=(e.onClick,e.totalSlides,_objectWithoutProperties(e,_excluded$2)),s=cn([s$1.buttonFirst,\"carousel__first-button\",t]),a=null!==i?i:0===r;return React.createElement(\"button\",_extends({type:\"button\",\"aria-label\":\"first\",className:s,onClick:this.handleOnClick,disabled:a},n),this.props.children)}}]),t}(React.Component),_defineProperty(_class$1,\"propTypes\",{carouselStore:propTypes.object.isRequired,children:CarouselPropTypes.children.isRequired,className:propTypes.string,currentSlide:propTypes.number.isRequired,disabled:propTypes.bool,onClick:propTypes.func,totalSlides:propTypes.number.isRequired}),_defineProperty(_class$1,\"defaultProps\",{className:null,disabled:null,onClick:null}),_temp$1),index$1=WithStore(ButtonFirst,function(e){return{currentSlide:e.currentSlide,totalSlides:e.totalSlides}}),s$2={buttonNext:\"buttonNext___2mOCa\"},_excluded$3=[\"carouselStore\",\"className\",\"currentSlide\",\"disabled\",\"onClick\",\"step\",\"totalSlides\",\"visibleSlides\",\"infinite\"],_class$2,_temp$2,ButtonNext=(_temp$2=_class$2=function(e){function t(e){var i;return _classCallCheck(this,t),i=r.call(this,e),i.handleOnClick=i.handleOnClick.bind(_assertThisInitialized(i)),i}_inherits(t,e);var r=_createSuper(t);return _createClass(t,[{key:\"handleOnClick\",value:function(e){var t=this.props,r=t.currentSlide,i=t.onClick,n=t.step,s=t.carouselStore,a=t.infinite,o=t.totalSlides-t.visibleSlides,l=n+r,c=Math.min(l,o);a&&(c=o===r?0:c),s.setStoreState({currentSlide:c,isPlaying:!1},null!==i&&i.call(this,e))}},{key:\"render\",value:function(){var e=this.props,r=(e.carouselStore,e.className),i=e.currentSlide,n=e.disabled,s=(e.onClick,e.step,e.totalSlides),a=e.visibleSlides,o=e.infinite,l=_objectWithoutProperties(e,_excluded$3),c=cn([s$2.buttonNext,\"carousel__next-button\",r]),u=t.setDisabled(n,i,a,s,o);return React.createElement(\"button\",_extends({type:\"button\",\"aria-label\":\"next\",className:c,onClick:this.handleOnClick,disabled:u},l),this.props.children)}}],[{key:\"setDisabled\",value:function(e,t,r,i,n){return null!==e?e:t>=i-r&&!n}}]),t}(React.PureComponent),_defineProperty(_class$2,\"propTypes\",{carouselStore:propTypes.object.isRequired,children:CarouselPropTypes.children.isRequired,className:propTypes.string,currentSlide:propTypes.number.isRequired,disabled:propTypes.bool,onClick:propTypes.func,step:propTypes.number.isRequired,totalSlides:propTypes.number.isRequired,visibleSlides:propTypes.number.isRequired,infinite:propTypes.bool}),_defineProperty(_class$2,\"defaultProps\",{className:null,disabled:null,onClick:null,infinite:!1}),_temp$2),index$2=WithStore(ButtonNext,function(e){return{currentSlide:e.currentSlide,step:e.step,totalSlides:e.totalSlides,visibleSlides:e.visibleSlides,infinite:e.infinite}}),s$3={buttonLast:\"buttonLast___2yuh0\"},_excluded$4=[\"carouselStore\",\"className\",\"currentSlide\",\"disabled\",\"onClick\",\"totalSlides\",\"visibleSlides\"],_class$3,_temp$3,ButtonLast=(_temp$3=_class$3=function(e){function t(){var e;return _classCallCheck(this,t),e=r.call(this),e.handleOnClick=e.handleOnClick.bind(_assertThisInitialized(e)),e}_inherits(t,e);var r=_createSuper(t);return _createClass(t,[{key:\"handleOnClick\",value:function(e){var t=this.props,r=t.carouselStore,i=t.onClick,n=t.totalSlides,s=t.visibleSlides;r.setStoreState({currentSlide:n-s,isPlaying:!1},null!==i&&i.call(this,e))}},{key:\"render\",value:function(){var e=this.props,t=(e.carouselStore,e.className),r=e.currentSlide,i=e.disabled,n=(e.onClick,e.totalSlides),s=e.visibleSlides,a=_objectWithoutProperties(e,_excluded$4),o=cn([s$3.buttonLast,\"carousel__last-button\",t]),l=null!==i?i:r>=n-s;return React.createElement(\"button\",_extends({type:\"button\",\"aria-label\":\"last\",className:o,onClick:this.handleOnClick,disabled:l},a),this.props.children)}}]),t}(React.Component),_defineProperty(_class$3,\"propTypes\",{carouselStore:propTypes.object.isRequired,children:CarouselPropTypes.children.isRequired,className:propTypes.string,currentSlide:propTypes.number.isRequired,disabled:propTypes.bool,onClick:propTypes.func,totalSlides:propTypes.number.isRequired,visibleSlides:propTypes.number.isRequired}),_defineProperty(_class$3,\"defaultProps\",{className:null,disabled:null,onClick:null}),_temp$3),index$3=WithStore(ButtonLast,function(e){return{currentSlide:e.currentSlide,totalSlides:e.totalSlides,visibleSlides:e.visibleSlides}}),s$4={buttonNext:\"buttonNext___3Lm3s\"},_excluded$5=[\"carouselStore\",\"children\",\"childrenPaused\",\"childrenPlaying\",\"className\",\"isPlaying\",\"onClick\"],_class$4,_temp$4,ButtonPlay=(_temp$4=_class$4=function(e){function t(e){var i;return _classCallCheck(this,t),i=r.call(this,e),i.handleOnClick=i.handleOnClick.bind(_assertThisInitialized(i)),i}_inherits(t,e);var r=_createSuper(t);return _createClass(t,[{key:\"handleOnClick\",value:function(e){var t=this.props.onClick;this.props.carouselStore.setStoreState({isPlaying:!this.props.isPlaying},null!==t&&t.call(this,e))}},{key:\"render\",value:function(){var e=this.props,t=(e.carouselStore,e.children,e.childrenPaused),r=e.childrenPlaying,i=e.className,n=e.isPlaying,s=(e.onClick,_objectWithoutProperties(e,_excluded$5)),a=cn([s$4.buttonNext,\"carousel__play-button\",i]);return React.createElement(\"button\",_extends({type:\"button\",\"aria-label\":\"play\",className:a,onClick:this.handleOnClick},s),n&&r,!n&&t,this.props.children)}}]),t}(React.PureComponent),_defineProperty(_class$4,\"propTypes\",{carouselStore:propTypes.object.isRequired,children:propTypes.node,childrenPaused:propTypes.node,childrenPlaying:propTypes.node,className:propTypes.string,isPlaying:propTypes.bool.isRequired,onClick:propTypes.func}),_defineProperty(_class$4,\"defaultProps\",{children:null,childrenPaused:null,childrenPlaying:null,className:null,onClick:null}),_temp$4),index$4=WithStore(ButtonPlay,function(e){return{isPlaying:e.isPlaying}}),s$5={dot:\"dot___3c3SI\"},_excluded$6=[\"carouselStore\",\"children\",\"className\",\"currentSlide\",\"disabled\",\"onClick\",\"selected\",\"slide\",\"totalSlides\",\"visibleSlides\"],_class$5,_temp$5,Dot=(_temp$5=_class$5=function(e){function t(e){var i;return _classCallCheck(this,t),i=r.call(this,e),i.handleOnClick=i.handleOnClick.bind(_assertThisInitialized(i)),i}_inherits(t,e);var r=_createSuper(t);return _createClass(t,[{key:\"handleOnClick\",value:function(e){var t=this.props,r=t.carouselStore,i=t.onClick,n=t.slide,s=t.totalSlides,a=t.visibleSlides,o=n>=s-a?s-a:n;r.setStoreState({currentSlide:o,isPlaying:!1},null!==i&&i.call(this,e))}},{key:\"render\",value:function(){var e=this.props,t=(e.carouselStore,e.children,e.className),r=e.currentSlide,i=e.disabled,n=(e.onClick,e.selected),s=e.slide,a=(e.totalSlides,e.visibleSlides),o=_objectWithoutProperties(e,_excluded$6),l=s>=r&&s=t&&c=r-i?r-i:c;l.push(React.createElement(Dot$1,{key:c,slide:h,selected:d,disabled:!!n&&d},React.createElement(\"span\",{className:cn[\"carousel__dot-group-dot\"]},this.props.dotNumbers&&c+1)))}return l}},{key:\"render\",value:function(){var e=this.props,t=(e.carouselStore,e.children),r=e.className,i=(e.currentSlide,e.dotNumbers,e.totalSlides,e.visibleSlides,e.disableActiveDots,e.showAsSelectedForCurrentSlideOnly,e.renderDots,_objectWithoutProperties(e,_excluded2)),n=cn([s$6.DotGroup,\"carousel__dot-group\",r]);return React.createElement(\"div\",_extends({className:n},i),this.renderDots(),t)}}]),t}(React.Component),_defineProperty(_class$6,\"propTypes\",{children:CarouselPropTypes.children,className:propTypes.string,currentSlide:propTypes.number.isRequired,carouselStore:propTypes.object.isRequired,totalSlides:propTypes.number.isRequired,visibleSlides:propTypes.number.isRequired,dotNumbers:propTypes.bool,disableActiveDots:propTypes.bool,showAsSelectedForCurrentSlideOnly:propTypes.bool,renderDots:propTypes.func}),_defineProperty(_class$6,\"defaultProps\",{children:null,className:null,dotNumbers:!1,disableActiveDots:!0,showAsSelectedForCurrentSlideOnly:!1,renderDots:null}),_temp$6),index$5=WithStore(DotGroup,function(e){return{currentSlide:e.currentSlide,totalSlides:e.totalSlides,visibleSlides:e.visibleSlides}}),s$7={image:\"image___xtQGH\"},_excluded$8=[\"src\",\"alt\"],_excluded2$1=[\"carouselStore\",\"children\",\"className\",\"hasMasterSpinner\",\"isBgImage\",\"onError\",\"onLoad\",\"renderError\",\"renderLoading\",\"style\",\"tag\"],Image=function(e){function t(e){var i;return _classCallCheck(this,t),i=r.call(this,e),i.state={imageStatus:LOADING},i.handleImageLoad=i.handleImageLoad.bind(_assertThisInitialized(i)),i.handleImageError=i.handleImageError.bind(_assertThisInitialized(i)),i.image=null,i}_inherits(t,e);var r=_createSuper(t);return _createClass(t,[{key:\"componentDidMount\",value:function(){t.subscribeMasterSpinner(this.props),this.initImage()}},{key:\"componentDidUpdate\",value:function(e){e.src!==this.props.src&&(t.unsubscribeMasterSpinner(e),t.subscribeMasterSpinner(this.props),this.initImage())}},{key:\"componentWillUnmount\",value:function(){t.unsubscribeMasterSpinner(this.props),this.image.removeEventListener(\"load\",this.handleImageLoad),this.image.removeEventListener(\"error\",this.handleImageError),this.image=null}},{key:\"initImage\",value:function(){if(this.setState({imageStatus:LOADING}),this.image=document.createElement(\"img\"),this.image.addEventListener(\"load\",this.handleImageLoad,!1),this.image.addEventListener(\"error\",this.handleImageError,!1),this.image.src=this.props.src,this.image.readyState||this.image.complete){var e=this.image.src;this.image.src=\"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==\",this.image.src=e}}},{key:\"handleImageLoad\",value:function(e){this.setState({imageStatus:SUCCESS}),this.props.hasMasterSpinner&&this.props.carouselStore.masterSpinnerSuccess(this.props.src),this.props.onLoad&&this.props.onLoad(e)}},{key:\"handleImageError\",value:function(e){this.setState({imageStatus:ERROR}),this.props.hasMasterSpinner&&this.props.carouselStore.masterSpinnerError(this.props.src),this.props.onError&&this.props.onError(e)}},{key:\"tempTag\",value:function(){return\"img\"===this.props.tag?\"div\":this.props.tag}},{key:\"customRender\",value:function(e){return\"function\"==typeof this.props[e]?this.props[e]():this.props.children}},{key:\"renderLoading\",value:function(e){var t=this.tempTag(),r=cn([s$7.image,s$7.imageLoading,\"carousel__image\",this.props.isBgImage&&\"carousel__image--with-background\",\"carousel__image--loading\",this.props.className]);return React.createElement(t,_extends({className:r},e),this.customRender(\"renderLoading\"))}},{key:\"renderError\",value:function(e){var t=this.tempTag(),r=cn([s$7.image,s$7.imageError,\"carousel__image\",this.props.isBgImage&&\"carousel__image--with-background\",\"carousel__image--error\",this.props.className]);return React.createElement(t,_extends({className:r},e),this.customRender(\"renderError\"))}},{key:\"renderSuccess\",value:function(e){var t=this.props,r=t.style,i=t.tag,n=cn([s$7.image,\"carousel__image\",this.props.isBgImage&&\"carousel__image--with-background\",\"carousel__image--success\",this.props.className]),s=_extends({},r),a=e;if(\"img\"!==i){var o=e.src;e.alt;a=_objectWithoutProperties(e,_excluded$8),s=_extends({},r,{backgroundImage:'url(\"'.concat(o,'\")'),backgroundSize:\"cover\"})}return React.createElement(i,_extends({className:n,style:s},a),this.props.children)}},{key:\"render\",value:function(){var e=this.props,t=(e.carouselStore,e.children,e.className,e.hasMasterSpinner,e.isBgImage,e.onError,e.onLoad,e.renderError,e.renderLoading,e.style,e.tag,_objectWithoutProperties(e,_excluded2$1));switch(this.state.imageStatus){case LOADING:return this.renderLoading(t);case SUCCESS:return this.renderSuccess(t);case ERROR:return this.renderError(t);default:throw new Error(\"unknown value for this.state.imageStatus\")}}}],[{key:\"subscribeMasterSpinner\",value:function(e){e.hasMasterSpinner&&e.carouselStore.subscribeMasterSpinner(e.src)}},{key:\"unsubscribeMasterSpinner\",value:function(e){e.hasMasterSpinner&&e.carouselStore.unsubscribeMasterSpinner(e.src)}}]),t}(React.Component);_defineProperty(Image,\"propTypes\",{alt:propTypes.string,carouselStore:propTypes.object.isRequired,children:CarouselPropTypes.children,className:propTypes.string,hasMasterSpinner:propTypes.bool.isRequired,isBgImage:CarouselPropTypes.isBgImage,onError:propTypes.func,onLoad:propTypes.func,renderError:propTypes.func,renderLoading:propTypes.func,src:propTypes.string.isRequired,style:propTypes.object,tag:propTypes.string}),_defineProperty(Image,\"defaultProps\",{alt:\"\",children:null,className:null,isBgImage:!1,onError:null,onLoad:null,renderError:null,renderLoading:null,style:null,tag:\"img\"});var Image$1=WithStore(Image,function(e){return{hasMasterSpinner:e.hasMasterSpinner,orientation:e.orientation}}),s$8={spinner:\"spinner___27VUp\",spin:\"spin___S3UuE\"},_excluded$9=[\"className\"],_class$7,_temp$7,Spinner=(_temp$7=_class$7=function(e){function t(){return _classCallCheck(this,t),r.apply(this,arguments)}_inherits(t,e);var r=_createSuper(t);return _createClass(t,[{key:\"render\",value:function(){var e=this.props,t=e.className,r=_objectWithoutProperties(e,_excluded$9),i=cn([s$8.spinner,\"carousel__spinner\",t]);return React.createElement(\"div\",_extends({className:i},r))}}]),t}(React.PureComponent),_defineProperty(_class$7,\"propTypes\",{className:propTypes.string}),_defineProperty(_class$7,\"defaultProps\",{className:null}),_temp$7),s$9={container:\"container___2O72F\",overlay:\"overlay___IV4qY\",hover:\"hover___MYy31\",zoom:\"zoom___3kqYk\",loading:\"loading___1pvNI\",imageLoadingSpinnerContainer:\"imageLoadingSpinnerContainer___3UIPD\"},_excluded$a=[\"alt\",\"bgImageProps\",\"bgImageTag\",\"carouselStore\",\"className\",\"imageClassName\",\"overlayClassName\",\"isPinchZoomEnabled\",\"spinner\",\"src\",\"srcZoomed\",\"tag\"],_class$8,_temp$8,MOUSE_SCALE=2,MAX_TOUCH_SCALE=3,ImageWithZoom=(_temp$8=_class$8=function(e){function t(e){var i;return _classCallCheck(this,t),i=r.call(this,e),i.state={isImageLoading:!0,isHovering:!1,isZooming:!1,x:null,y:null,scale:1},i.tpCache={},i.handleImageComplete=i.handleImageComplete.bind(_assertThisInitialized(i)),i.handleOnMouseMove=i.handleOnMouseMove.bind(_assertThisInitialized(i)),i.handleOnMouseOut=i.handleOnMouseOut.bind(_assertThisInitialized(i)),i.handleOnMouseOver=i.handleOnMouseOver.bind(_assertThisInitialized(i)),i.handleOnTouchEnd=i.handleOnTouchEnd.bind(_assertThisInitialized(i)),i.handleOnTouchMove=i.handleOnTouchMove.bind(_assertThisInitialized(i)),i.handleOnTouchStart=i.handleOnTouchStart.bind(_assertThisInitialized(i)),i}_inherits(t,e);var r=_createSuper(t);return _createClass(t,[{key:\"componentDidUpdate\",value:function(e,t){!1===t.isZooming&&!0===this.state.isZooming&&this.props.carouselStore.setStoreState({isPageScrollLocked:!0}),!0===t.isZooming&&!1===this.state.isZooming&&this.props.carouselStore.setStoreState({isPageScrollLocked:!1})}},{key:\"handleImageComplete\",value:function(){this.setState({isImageLoading:!1})}},{key:\"handleOnMouseOver\",value:function(){this.state.isZooming||this.setState({isHovering:!0,scale:MOUSE_SCALE})}},{key:\"handleOnMouseOut\",value:function(){this.state.isZooming||this.setState({isHovering:!1,scale:1})}},{key:\"handleOnMouseMove\",value:function(e){if(!this.state.isZooming){var t=pct(e.nativeEvent.offsetX/e.target.offsetWidth*100),r=pct(e.nativeEvent.offsetY/e.target.offsetHeight*100);this.setState({x:t,y:r})}}},{key:\"handleOnTouchStart\",value:function(e){var t=this;this.props.isPinchZoomEnabled&&(_toConsumableArray(e.targetTouches).forEach(function(e){t.tpCache[e.identifier]={clientX:e.clientX,clientY:e.clientY}}),this.setState(function(e){return{isZooming:e.isZooming||Object.keys(t.tpCache).length>1}}))}},{key:\"handleOnTouchMove\",value:function(e){var r=this;if(this.state.isZooming){e.persist();var i=_toConsumableArray(e.targetTouches).filter(function(e){return r.tpCache[e.identifier]}).slice(0,2);if(2===i.length){e.stopPropagation();var n=e.target.getBoundingClientRect(),s=i[0].identifier,a=i[1].identifier,o={x1:this.tpCache[s].clientX,y1:this.tpCache[s].clientY,x2:this.tpCache[a].clientX,y2:this.tpCache[a].clientY};o.distance=t.distanceBetweenTwoTouches(_objectSpread2({},o));var l=t.midpointBetweenTwoTouches(_objectSpread2({},o));o.cx=l.x,o.cy=l.y;var c={x1:i[0].clientX,y1:i[0].clientY,x2:i[1].clientX,y2:i[1].clientY};c.distance=t.distanceBetweenTwoTouches(_objectSpread2({},c));var u=t.midpointBetweenTwoTouches(_objectSpread2({},c));c.cx=u.x,c.cy=u.y;var p=pct(boundedRange({min:0,max:100,x:(c.cx-n.left)/n.width*100})),d=pct(boundedRange({min:0,max:100,x:(c.cy-n.top)/n.height*100})),h=function(e){return boundedRange({min:1,max:MAX_TOUCH_SCALE,x:e.scale+(c.distance-o.distance)/100})};this.setState(function(e){return{isZooming:1!==h(e),scale:h(e),x:p,y:d}})}}}},{key:\"handleOnTouchEnd\",value:function(e){var t=this;this.props.isPinchZoomEnabled&&(_toConsumableArray(e.changedTouches).forEach(function(e){delete t.tpCache[e.identifier]}),0===Object.keys(this.tpCache).length&&this.setState({isZooming:!1}))}},{key:\"renderLoading\",value:function(){if(this.state.isImageLoading){var e=this.props.spinner;return React.createElement(\"div\",{className:cn([s$9.imageLoadingSpinnerContainer,\"carousel__image-loading-spinner-container\"])},e&&e(),!e&&React.createElement(Spinner,null))}return null}},{key:\"render\",value:function(){var e=this.props,t=e.alt,r=e.bgImageProps,i=e.bgImageTag,n=(e.carouselStore,e.className),s=e.imageClassName,a=e.overlayClassName,o=(e.isPinchZoomEnabled,e.spinner,e.src),l=e.srcZoomed,c=e.tag,u=_objectWithoutProperties(e,_excluded$a),p=cn([s$9.container,n]),d=cn([s$9.image,\"carousel__zoom-image\",s]),h=cn([s$9.overlay,\"carousel__zoom-image-overlay\",this.state.isHovering&&s$9.hover,this.state.isZooming&&s$9.zoom,this.state.isHovering&&\"carousel__zoom-image-overlay--hovering\",this.state.isZooming&&\"carousel__zoom-image-overlay--zooming\",a]),y={};return(this.state.isHovering||this.state.isZooming)&&(y.transformOrigin=\"\".concat(this.state.x,\" \").concat(this.state.y),y.transform=\"scale(\".concat(this.state.scale,\")\")),React.createElement(c,_extends({className:p},u),React.createElement(Image$1,_extends({alt:t,className:d,tag:i,src:o,onLoad:this.handleImageComplete,onError:this.handleImageComplete},r)),React.createElement(Image$1,{className:h,tag:\"div\",src:l||o,style:y,isBgImage:!0,onFocus:this.handleOnMouseOver,onMouseOver:this.handleOnMouseOver,onBlur:this.handleOnMouseOut,onMouseOut:this.handleOnMouseOut,onMouseMove:this.handleOnMouseMove,onTouchStart:this.handleOnTouchStart,onTouchEnd:this.handleOnTouchEnd,onTouchMove:this.handleOnTouchMove}),this.renderLoading())}}],[{key:\"midpointBetweenTwoTouches\",value:function(e){var t=e.x1,r=e.y1;return{x:(t+e.x2)/2,y:(r+e.y2)/2}}},{key:\"distanceBetweenTwoTouches\",value:function(e){var t=e.x1,r=e.y1,i=e.x2,n=e.y2;return Math.sqrt(Math.pow(i-t,2)+Math.pow(n-r,2))}}]),t}(React.Component),_defineProperty(_class$8,\"propTypes\",{alt:propTypes.string,bgImageProps:propTypes.object,bgImageTag:propTypes.string,carouselStore:propTypes.object.isRequired,className:propTypes.string,imageClassName:propTypes.string,overlayClassName:propTypes.string,spinner:propTypes.func,src:propTypes.string.isRequired,srcZoomed:propTypes.string,tag:propTypes.string,isPinchZoomEnabled:propTypes.bool}),_defineProperty(_class$8,\"defaultProps\",{alt:void 0,bgImageProps:{},bgImageTag:\"div\",className:null,imageClassName:null,overlayClassName:null,isPinchZoomEnabled:!0,spinner:null,srcZoomed:null,tag:\"div\"}),_temp$8),index$6=WithStore(ImageWithZoom,function(){return{}}),s$a={slide:\"slide___3-Nqo\",slideHorizontal:\"slideHorizontal___1NzNV\",slideInner:\"slideInner___2mfX9\",focusRing:\"focusRing___1airF\"},_excluded$b=[\"ariaLabel\",\"carouselStore\",\"children\",\"className\",\"classNameHidden\",\"classNameVisible\",\"currentSlide\",\"index\",\"innerClassName\",\"innerTag\",\"naturalSlideHeight\",\"naturalSlideWidth\",\"onBlur\",\"onFocus\",\"orientation\",\"slideSize\",\"style\",\"tabIndex\",\"tag\",\"totalSlides\",\"visibleSlides\",\"isIntrinsicHeight\"],_class$9,_temp$9,Slide=(_temp$9=_class$9=function(e){function t(e){var i;return _classCallCheck(this,t),i=r.call(this,e),i.handleOnFocus=i.handleOnFocus.bind(_assertThisInitialized(i)),i.handleOnBlur=i.handleOnBlur.bind(_assertThisInitialized(i)),i.state={focused:!1},i}_inherits(t,e);var r=_createSuper(t);return _createClass(t,[{key:\"isVisible\",value:function(){var e=this.props,t=e.currentSlide,r=e.index,i=e.visibleSlides;return r>=t&&r=i&&r>0&&(n=0),0===this.props.currentSlide&&r<0&&(n=i)),this.props.carouselStore.setStoreState({currentSlide:n})}},{key:\"focus\",value:function(){this.sliderElement.focus()}},{key:\"handleOnTouchEnd\",value:function(e){this.endTouchMove(),this.callCallback(\"onTouchEnd\",e)}},{key:\"handleOnTouchCancel\",value:function(e){this.endTouchMove(),this.callCallback(\"onTouchCancel\",e)}},{key:\"endTouchMove\",value:function(){this.props.touchEnabled&&this.fakeOnDragEnd()}},{key:\"renderMasterSpinner\",value:function(){var e=this.props,t=e.hasMasterSpinner,r=e.masterSpinnerFinished,i=e.spinner;return t&&!r?(\"function\"==typeof this.props.onMasterSpinner&&this.props.onMasterSpinner(),React.createElement(\"div\",{className:cn([s$b.masterSpinnerContainer,\"carousel__master-spinner-container\"])},i&&i(),!i&&React.createElement(Spinner,null))):null}},{key:\"render\",value:function(){var e=this,t=this.props,r=t.ariaLabel,i=(t.carouselStore,t.children),n=t.className,s=t.classNameAnimation,a=t.classNameTray,o=t.classNameTrayWrap,l=t.currentSlide,c=t.disableAnimation,u=(t.disableKeyboard,t.dragEnabled,t.hasMasterSpinner,t.interval,t.isPageScrollLocked,t.isPlaying,t.lockOnWindowScroll,t.masterSpinnerFinished,t.moveThreshold,t.naturalSlideHeight),p=t.naturalSlideWidth,d=(t.onMasterSpinner,t.orientation),h=(t.playDirection,t.privateUnDisableAnimation,t.slideSize),y=t.slideTraySize,S=(t.spinner,t.style),m=t.tabIndex,b=(t.totalSlides,t.touchEnabled,t.trayProps),f=t.trayTag,g=t.visibleSlides,v=t.isIntrinsicHeight,_=_objectWithoutProperties(t,_excluded$c),T=_extends({},S),k={};\"vertical\"===d&&(k.height=0,k.paddingBottom=pct(100*u*g/p),k.width=pct(100));var C={},O=pct(h*l*-1);(this.state.isBeingTouchDragged||this.state.isBeingMouseDragged||c)&&(C.transition=\"none\"),v&&(C.display=\"flex\",C.alignItems=\"stretch\"),\"vertical\"===d?(C.transform=\"translateY(\".concat(O,\") translateY(\").concat(this.state.deltaY,\"px)\"),C.width=pct(100),C.flexDirection=\"column\"):(C.width=pct(y),C.transform=\"translateX(\".concat(O,\") translateX(\").concat(this.state.deltaX,\"px)\"),C.flexDirection=\"row\");var P=cn([\"vertical\"===d?s$b.verticalSlider:s$b.horizontalSlider,\"carousel__slider\",\"vertical\"===d?\"carousel__slider--vertical\":\"carousel__slider--horizontal\",n]),E=cn([s$b.sliderTrayWrap,\"carousel__slider-tray-wrapper\",\"vertical\"===d?s$b.verticalSlideTrayWrap:s$b.horizontalTrayWrap,\"vertical\"===d?\"carousel__slider-tray-wrap--vertical\":\"carousel__slider-tray-wrap--horizontal\",o]),M=cn([s$b.sliderTray,s||s$b.sliderAnimation,\"carousel__slider-tray\",\"vertical\"===d?s$b.verticalTray:s$b.horizontalTray,\"vertical\"===d?\"carousel__slider-tray--vertical\":\"carousel__slider-tray--horizontal\",a]),w=null!==m?m:0,x=(_.dragStep,_.step,_.infinite,_objectWithoutProperties(_,_excluded2$2)),R=(b.className,b.onClickCapture,b.onMouseDown,b.onTouchCancel,b.onTouchEnd,b.onTouchMove,b.onTouchStart,b.ref,b.style,_objectWithoutProperties(b,_excluded3));return React.createElement(\"div\",_extends({ref:function(t){e.sliderElement=t},className:P,\"aria-live\":\"polite\",\"aria-label\":r,style:T,tabIndex:w,onKeyDown:this.handleOnKeyDown,role:\"listbox\"},x),React.createElement(\"div\",{className:E,style:k},React.createElement(f,_extends({ref:this.getSliderRef,className:M,style:C,onTouchStart:this.handleOnTouchStart,onTouchMove:this.handleOnTouchMove,onTouchEnd:this.handleOnTouchEnd,onTouchCancel:this.handleOnTouchCancel,onMouseDown:this.handleOnMouseDown,onClickCapture:this.handleOnClickCapture},R),i),this.renderMasterSpinner()))}}],[{key:\"slideSizeInPx\",value:function(e,t,r,i){return(\"horizontal\"===e?t:r)/i}},{key:\"slidesMoved\",value:function(e,t,r,i,n,s){var a=\"horizontal\"===t?r:i,o=Math.abs(Math.round(a/n)),l=Math.abs(a)>=n*e?s:0,c=Math.max(l,o);if(a<0)return c;var u=-c;return 0===u?0:u}}]),t}(React.Component),_defineProperty(_class$a,\"propTypes\",{ariaLabel:propTypes.string,carouselStore:propTypes.object.isRequired,children:propTypes.node.isRequired,className:propTypes.string,classNameAnimation:propTypes.string,classNameTray:propTypes.string,classNameTrayWrap:propTypes.string,currentSlide:propTypes.number.isRequired,disableAnimation:propTypes.bool,disableKeyboard:propTypes.bool,dragEnabled:propTypes.bool.isRequired,dragStep:propTypes.number,hasMasterSpinner:propTypes.bool.isRequired,infinite:propTypes.bool,interval:propTypes.number.isRequired,isPageScrollLocked:propTypes.bool.isRequired,isPlaying:propTypes.bool.isRequired,lockOnWindowScroll:propTypes.bool.isRequired,masterSpinnerFinished:propTypes.bool.isRequired,moveThreshold:propTypes.number,naturalSlideHeight:propTypes.number.isRequired,naturalSlideWidth:propTypes.number.isRequired,onMasterSpinner:propTypes.func,orientation:CarouselPropTypes.orientation.isRequired,playDirection:CarouselPropTypes.direction.isRequired,privateUnDisableAnimation:propTypes.bool,slideSize:propTypes.number.isRequired,slideTraySize:propTypes.number.isRequired,spinner:propTypes.func,step:propTypes.number.isRequired,style:propTypes.object,tabIndex:propTypes.number,totalSlides:propTypes.number.isRequired,touchEnabled:propTypes.bool.isRequired,trayProps:propTypes.shape({className:propTypes.string,onClickCapture:propTypes.func,onMouseDown:propTypes.func,onTouchCancel:propTypes.func,onTouchEnd:propTypes.func,onTouchMove:propTypes.func,onTouchStart:propTypes.func,ref:propTypes.shape({}),style:propTypes.string}),trayTag:propTypes.string,visibleSlides:propTypes.number,isIntrinsicHeight:propTypes.bool}),_defineProperty(_class$a,\"defaultProps\",{ariaLabel:\"slider\",className:null,classNameAnimation:null,classNameTray:null,classNameTrayWrap:null,disableAnimation:!1,disableKeyboard:!1,dragStep:1,infinite:!1,moveThreshold:.1,onMasterSpinner:null,privateUnDisableAnimation:!1,spinner:null,style:{},tabIndex:null,trayProps:{},trayTag:\"div\",visibleSlides:1,isIntrinsicHeight:!1}),_temp$a),index$8=WithStore(Slider,function(e){return{currentSlide:e.currentSlide,disableAnimation:e.disableAnimation,privateUnDisableAnimation:e.privateUnDisableAnimation,disableKeyboard:e.disableKeyboard,dragEnabled:e.dragEnabled,hasMasterSpinner:e.hasMasterSpinner,infinite:e.infinite,interval:e.interval,isPageScrollLocked:e.isPageScrollLocked,isPlaying:e.isPlaying,lockOnWindowScroll:e.lockOnWindowScroll,masterSpinnerFinished:e.masterSpinnerFinished,naturalSlideHeight:e.naturalSlideHeight,naturalSlideWidth:e.naturalSlideWidth,orientation:e.orientation,playDirection:e.playDirection,slideSize:e.slideSize,slideTraySize:e.slideTraySize,step:e.step,dragStep:e.dragStep,totalSlides:e.totalSlides,touchEnabled:e.touchEnabled,visibleSlides:e.visibleSlides,isIntrinsicHeight:e.isIntrinsicHeight}});export{index as ButtonBack,index$1 as ButtonFirst,index$3 as ButtonLast,index$2 as ButtonNext,index$4 as ButtonPlay,Context as CarouselContext,CarouselProvider,Dot$1 as Dot,index$5 as DotGroup,Image$1 as Image,index$6 as ImageWithZoom,index$7 as Slide,index$8 as Slider,Spinner,Store,WithStore};\n//# sourceMappingURL=index.es.js.map\n","/* eslint-disable react/no-array-index-key */\n// Libraries\nimport React, { Component, createRef } from 'react';\nimport PropTypes from 'prop-types';\nimport { Dot, WithStore } from 'pure-react-carousel';\n\n// Utilities\nimport { clamp } from 'common/utils/helpers';\n\nconst ROW_MOVEMENT_FACTOR = 2;\nconst THUMBNAIL_EXPOSE_FACTOR = 3;\n\nexport class Thumbnails extends Component {\n // eslint-disable-next-line react/static-property-placement\n static propTypes = {\n images: PropTypes.arrayOf(\n PropTypes.shape({\n src: PropTypes.string.isRequired,\n thumbnailSrc: PropTypes.string.isRequired,\n title: PropTypes.string,\n description: PropTypes.string,\n })\n ).isRequired,\n currentSlide: PropTypes.number.isRequired,\n t: PropTypes.func.isRequired,\n };\n\n // eslint-disable-next-line react/state-in-constructor\n state = {\n offset: 0,\n };\n\n containerRef = createRef();\n\n rowRef = createRef();\n\n componentDidUpdate(prevProps) {\n const { currentSlide } = this.props;\n\n if (currentSlide !== prevProps.currentSlide) {\n this.handleSlideChange(prevProps.currentSlide);\n }\n }\n\n get containerWidth() {\n return this.containerRef.current.getBoundingClientRect().width;\n }\n\n get rowWidth() {\n return this.rowRef.current.getBoundingClientRect().width;\n }\n\n get thumbnailWidth() {\n return this.rowRef.current.children[0].getBoundingClientRect().width;\n }\n\n get padding() {\n return this.rowRef.current.offsetLeft;\n }\n\n get minOffset() {\n if (this.rowWidth < this.containerWidth) {\n return 0;\n }\n\n return -this.rowWidth - this.padding * 2 + this.containerWidth;\n }\n\n get maxOffset() {\n return 0;\n }\n\n handleSlideChange = (prevCurrentSlide) => {\n const { currentSlide } = this.props;\n\n if (currentSlide < prevCurrentSlide) {\n if (!this.exposePreviousThumbnail()) {\n this.exposeNextThumbnail();\n }\n }\n\n if (currentSlide > prevCurrentSlide) {\n if (!this.exposeNextThumbnail()) {\n this.exposePreviousThumbnail();\n }\n }\n };\n\n exposePreviousThumbnail = () => {\n const { currentSlide } = this.props;\n const { offset } = this.state;\n const previousThumbnailRef = this.rowRef.current.children[currentSlide - 1];\n let moved = false;\n\n if (previousThumbnailRef) {\n const thumbnailOffset =\n previousThumbnailRef.offsetLeft +\n offset +\n (this.thumbnailWidth - this.thumbnailWidth / THUMBNAIL_EXPOSE_FACTOR) +\n this.padding;\n\n if (thumbnailOffset < 0) {\n this.setOffset(offset - thumbnailOffset);\n moved = true;\n }\n } else {\n this.setOffset(this.maxOffset);\n }\n\n return moved;\n };\n\n exposeNextThumbnail = () => {\n const { currentSlide } = this.props;\n const { offset } = this.state;\n const nextThumbnailRef = this.rowRef.current.children[currentSlide + 1];\n let moved = false;\n\n if (nextThumbnailRef) {\n const thumbnailOffset =\n nextThumbnailRef.offsetLeft +\n offset +\n this.thumbnailWidth / THUMBNAIL_EXPOSE_FACTOR +\n this.padding;\n\n if (thumbnailOffset > this.containerWidth) {\n this.setOffset(offset - (thumbnailOffset - this.containerWidth));\n moved = true;\n }\n } else {\n this.setOffset(this.minOffset);\n }\n\n return moved;\n };\n\n handlePreviousClick = () => {\n const { offset } = this.state;\n\n this.setOffset(offset + Math.round(this.containerWidth / ROW_MOVEMENT_FACTOR));\n };\n\n handleNextClick = () => {\n const { offset } = this.state;\n\n this.setOffset(offset - Math.round(this.containerWidth / ROW_MOVEMENT_FACTOR));\n };\n\n setOffset = (value) => {\n this.setState({ offset: clamp(value, this.minOffset, this.maxOffset) });\n };\n\n render() {\n const { images, t } = this.props;\n const { offset } = this.state;\n\n return (\n
\n \n \n \n\n
\n
\n
\n \n {images.map(({ thumbnailSrc }, index) => (\n \n ))}\n
\n
\n\n \n \n \n
\n );\n }\n}\n\nexport default WithStore(Thumbnails, ({ currentSlide }) => ({ currentSlide }));\n","// Libraries\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport {\n CarouselProvider,\n Slider,\n Slide,\n Image,\n ButtonBack,\n ButtonNext,\n} from 'pure-react-carousel';\nimport { withTranslation } from 'react-i18next';\n\n// Components\nimport Thumbnails from './Thumbnails';\n\nconst renderCaption = (title, description) => {\n if (!title) {\n return null;\n }\n return (\n
\n

{title}

\n {description &&

{description}

}\n
\n );\n};\n\nexport const ImageGallery = ({ images, t }) => {\n if (!images.length) {\n return null;\n }\n\n return (\n
\n \n
\n \n \n \n\n \n \n \n\n \n {images.map(({ src, title, description }, index) => (\n \n
\n {renderCaption(title, description)}\n \n
\n
\n ))}\n
\n
\n\n \n \n
\n );\n};\n\nImageGallery.propTypes = {\n images: PropTypes.arrayOf(\n PropTypes.shape({\n src: PropTypes.string.isRequired,\n thumbnailSrc: PropTypes.string.isRequired,\n title: PropTypes.string,\n description: PropTypes.string,\n })\n ).isRequired,\n t: PropTypes.func.isRequired,\n};\n\nexport default withTranslation()(ImageGallery);\n","// Libraries\nimport React from 'react';\nimport PropTypes from 'prop-types';\n\n// Utilities\nimport { determineImageSize } from 'common/utils/helpers';\n\n// Components\nimport ImageGallery from '../../ImageGallery';\n\nexport const Media = ({ media }) => {\n if (media.length >= 2) {\n const images = media.map(({ imageUrls, caption: title }) => ({\n src: determineImageSize(imageUrls),\n thumbnailSrc: determineImageSize(imageUrls),\n title,\n }));\n\n return ;\n }\n\n if (media.length === 1) {\n return {media[0].altText};\n }\n\n return null;\n};\n\nMedia.propTypes = {\n media: PropTypes.arrayOf(PropTypes.object).isRequired,\n};\n\nexport default Media;\n","// Libraries\nimport React from 'react';\nimport PropTypes from 'prop-types';\n\n// Utilities\nimport { getMediaDataByLocale, getVariationByLocale, renderMarkdown } from 'common/utils/helpers';\n\n// Components\nimport YoutubeEmbedder from 'common/components/YoutubeEmbedder';\nimport Media from './Media';\n\nconst Content = (props) => {\n const { content } = props;\n const { media, video, title, description } = content;\n\n let mediaInSelectedLocale = media;\n let videoInSelectedLocale = video;\n\n if (!gon.inDefaultLanguage) {\n mediaInSelectedLocale = media?.map((m) => getMediaDataByLocale(m, gon.currentLocale));\n videoInSelectedLocale = getVariationByLocale(video?.variations, gon.currentLocale, video);\n }\n\n return (\n
\n {title &&

{title}

}\n {description && (\n \n )}\n {Boolean(mediaInSelectedLocale?.length) && (\n
\n \n
\n )}\n {videoInSelectedLocale && (\n
\n \n
\n )}\n
\n );\n};\n\nContent.propTypes = {\n content: PropTypes.objectOf(PropTypes.shape).isRequired,\n};\n\nexport default Content;\n","// Libraries\nimport React from 'react';\nimport PropTypes from 'prop-types';\n\n// Enums\nimport { ValidationTypes } from 'engagement/enums/singleTextBox';\n\n// Components\nimport Input from 'common/components/Input';\n\nconst TextInput = (props) => {\n const { id, label, placeholder, value, validationType, characterCountMax, onChange } = props;\n\n const inputFormId = `input-${id}`;\n const showCharacterCount = validationType === ValidationTypes.CHARACTER_COUNT;\n\n return (\n
\n \n
\n onChange(e.target.value)}\n />\n
\n {showCharacterCount && (\n \n {`${value.length}/${characterCountMax}`}\n
\n )}\n
\n );\n};\n\nTextInput.propTypes = {\n id: PropTypes.string.isRequired,\n label: PropTypes.string,\n placeholder: PropTypes.string,\n value: PropTypes.string,\n validationType: PropTypes.string,\n characterCountMax: PropTypes.string,\n onChange: PropTypes.func.isRequired,\n};\n\nTextInput.defaultProps = {\n value: '',\n placeholder: '',\n label: '',\n validationType: '',\n characterCountMax: '',\n};\n\nexport default TextInput;\n","// Libraries\nimport React, { forwardRef } from 'react';\nimport classNames from 'classnames';\n\nconst Textarea = forwardRef(({ className, ...props }, ref) => (\n