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kC,EAAe,OAClCL,EAAkBE,KAEPE,GAAM,EAkEzB,EA7CiBvD,IACf,MAAMvE,GAAOiI,EAAAA,EAAAA,MACP,cACJ9D,EAAa,aACbO,EAAY,mBACZmB,EAAkB,WAClBV,EAAU,WACVwC,EAAU,OACVrK,GACE0C,EAEEnE,EAAY0I,EACdD,EAAuB4D,KAAK,KAAM3D,EAAWJ,GAC7CD,EAAuBgE,KAAK,KAAM/D,GAEhCgE,EAAiB1D,EAAiByD,KAAK,KAAMxD,GAC7C0D,EAAUxC,EAAesC,KAAK,KAAMrC,GACpCwC,EAAgBnD,EAAagD,KAAK,KAAM/C,GACxCuC,EAAoBlC,EAAqB0C,KAC7C,KACArM,EACAwM,GASF,MAAO,CACLxM,YACA6I,eACAyD,iBACAR,aACA9B,qBACAyC,mBAZyBb,EAAmBS,KAC5C,KACAR,EACA7B,EACA8B,GASAS,UACAC,gBACAX,oBACAH,eACAjK,SACD,C,2BC1JHzC,OAAO0N,4CAA6C,EAOpD1N,OAAO2N,aAAe3N,OAAO2N,cAAgBC,EAAAA,OAAAA,QAQxC5N,OAAO6N,oBACV7N,OAAO6N,mBAAoB,EAE3B7N,OAAO8N,iBACL,mBACA9N,OAAO2N,aAAaI,wB","sources":["webpack://gohiring-mpt/./frontend/bundles/components/common/spinner.js","webpack://gohiring-mpt/./frontend/bundles/components/common/axios.js","webpack://gohiring-mpt/./frontend/bundles/components/common/locale_selector.js","webpack://gohiring-mpt/./frontend/bundles/contexts/company_name.js","webpack://gohiring-mpt/./frontend/bundles/contexts/countries.js","webpack://gohiring-mpt/./frontend/bundles/contexts/form.js","webpack://gohiring-mpt/./frontend/bundles/contexts/store.js","webpack://gohiring-mpt/./frontend/bundles/components/common/error_boundary.js","webpack://gohiring-mpt/./frontend/bundles/hoc.js","webpack://gohiring-mpt/./frontend/bundles/lib/cookie-consent.js","webpack://gohiring-mpt/./frontend/bundles/lib/helpers/select_unit.js","webpack://gohiring-mpt/./frontend/bundles/lib/use_i18n.js","webpack://gohiring-mpt/./frontend/bundles/react_on_rails.js"],"sourcesContent":["import React from 'react';\n\n// https://tobiasahlin.com/spinkit/\nconst Spinner = () => (\n
\n
\n
\n
\n
\n
\n);\n\nexport default Spinner;\n","/* global Rollbar */\n\nimport React, { useState, useEffect } from 'react';\nimport axios from 'axios';\nimport PropTypes from 'prop-types';\nimport useI18n from '../../lib/use_i18n';\n\nimport Spinner from './spinner';\n\nconst redirectIfNeeded = (resp) => {\n const url = (resp['headers'] || {})['location'];\n if (url) window.location.replace(url);\n};\n\n// A wrapper function around the rest call functions(`action`) that allows additional\n// flexibility in how we handle rest call errors. Most common unhandled errors\n// are 422 outside of the form context (form usually handles the 422 response).\nexport const errorHandleWrapper = async ({ action, getErrorMessage }) => {\n try {\n return await action();\n } catch (error) {\n const errorMessage = getErrorMessage\n ? getErrorMessage(error)\n : error?.response?.data?.error ||\n `HTTP status: ${error?.response?.status}`;\n Flash.alert(errorMessage);\n }\n};\n\nconst handleError = (error, generalError) => {\n const resp = error.response;\n\n // If the request is canceled by user, axios will handle it as an error\n if (error?.code === 'ERR_CANCELED') {\n return Promise.reject(error);\n }\n\n if (resp) {\n const { status, data } = resp;\n\n switch (status) {\n case 401:\n redirectIfNeeded(resp);\n break;\n case 409:\n redirectIfNeeded(resp);\n\n // it is about some conflicts, show it\n Flash.alert(data);\n return Promise.reject(data);\n case 422:\n // it is about validation, allow it to pass\n return Promise.reject(error);\n case 424:\n // an external dependency failed\n return Promise.reject(error);\n\n // don't report it to Rollbar, it is something on the client side, we can do nothing\n default: {\n Flash.alert(generalError);\n\n const errorMsg = `HTTP status: ${status}; Body: ${data}`;\n return Promise.reject(errorMsg);\n }\n }\n } else {\n Flash.alert(generalError);\n Rollbar.error(error);\n\n return Promise.reject(error);\n }\n};\n\n/**\n * Sets settings for Axios (https://github.com/axios/axios),\n * handles errors occurred after getting a response from the backend.\n *\n * If recovery from an error isn't possible, it will show a general server error.\n *\n * Also, it shows a spinner when there are active requests.\n */\nconst Axios = ({ csrfToken, children }) => {\n const { translate } = useI18n('errors');\n const [counter, setCounter] = useState(0);\n\n const decreaseCounter = () => setCounter(counter - 1);\n\n /**\n * This hook adds interceptors to Axios. Some pages have a few components which get rendered\n * independently in Rails views, such components render this component too. When an error\n * occurs every instance of this component receives that error. In case of validation errors\n * there is no big harm besides several re-rendering but if it is a general error, users would\n * see the same error several times (3 independent components = 3 errors). So, only first Axios\n * component should add interceptors and never remove them even if the component is removed\n * from DOM.\n */\n useEffect(() => {\n if (window.axiosHandlersAdded) return;\n\n window.axiosHandlersAdded = true;\n\n const commonHeaders = axios.defaults.headers.common;\n\n commonHeaders['X-CSRF-Token'] = csrfToken;\n commonHeaders['X-Requested-With'] = 'XMLHttpRequest';\n\n axios.interceptors.request.use((config) => {\n setCounter(counter + 1);\n return config;\n });\n\n /**\n * this interceptor processes responses before any other,\n * more about interceptors is here https://github.com/axios/axios#interceptors\n */\n axios.interceptors.response.use(\n (response) => {\n decreaseCounter();\n return response;\n },\n (error) => {\n decreaseCounter();\n return handleError(error, translate('.server'));\n }\n );\n }, []);\n\n return (\n <>\n {children}\n {counter > 0 && }\n \n );\n};\n\nAxios.propTypes = {\n csrfToken: PropTypes.string.isRequired,\n};\n\nexport default Axios;\n","import React from 'react';\nimport PropTypes from 'prop-types';\n\nconst isCurrentLocale = (locale, currentLocale) => {\n return locale === currentLocale;\n};\n\nconst LocaleSpan = ({ locale }) => {\n return (\n \n {locale}\n \n );\n};\n\nconst LocaleLink = ({ locale }) => {\n return (\n \n {locale}\n \n );\n};\n\nconst LocaleSelector = ({ availableLocales, currentLocale }) => {\n return (\n <>\n {availableLocales.map((locale) => (\n \n  \n {isCurrentLocale(locale, currentLocale) ? (\n \n ) : (\n \n )}\n \n ))}\n \n );\n};\n\nLocaleSelector.propTypes = {\n availableLocales: PropTypes.arrayOf(PropTypes.string),\n currentLocale: PropTypes.string,\n};\n\nexport default LocaleSelector;\n","import { createContext } from 'react';\n\n/**\n * Initializes a context for sharing a company name.\n */\nexport const CompanyNameContext = createContext(null);\n","import { createContext } from 'react';\n\n/**\n * Initializes a context for sharing countries between components.\n * More info can be found in https://reactjs.org/docs/context.html\n */\nexport const CountriesContext = createContext([]);\n","import React, { useCallback, useEffect, useState } from 'react';\nimport { createContext } from 'react';\n\n/**\n * Initializes a context for keeping track of 'dirty' forms.\n * Provider will be handled on a top level, by wrapping the\n * top level component with FormContextWrapper.\n * value is supposed to be consumed by the `components/common/form/form.js`\n * value is supposed to be a function that enables form to register itself\n * as dirty/not dirty\n */\nexport const FormContext = createContext();\n\n/**\n * This component is used as a part of the change in the\n * `topLevel` function, see `hoc.js`.\n * we use it to keep track of dirty forms, and prevent the\n * page change if needed\n */\nexport const FormContextWrapper = ({ children }) => {\n const [dirtyForms, setDirtyForms] = useState({});\n const isDirty = Object.values(dirtyForms).some(Boolean);\n\n // a function exposed through FormContext.\n // we wrapp it in the `useCallback` to ensure\n // reffernce stability, thus preventing unecessery\n // re-renders\n const setDirty = useCallback(\n ({ id, isDirty }) => {\n setDirtyForms((oldState) => {\n if (id in oldState && !isDirty) {\n delete oldState[id];\n return { ...oldState };\n } else if (!oldState[id] && isDirty) {\n return { ...oldState, [id]: isDirty };\n }\n return oldState;\n });\n },\n [setDirtyForms]\n );\n\n useEffect(() => {\n if (isDirty) {\n window.onbeforeunload = () => true;\n } else {\n window.onbeforeunload = null;\n }\n }, [isDirty]);\n\n return (\n {children}\n );\n};\n","import { createContext } from 'react';\n\nexport const StateContext = createContext(null);\n\nexport const DispatchContext = createContext(null);\n\n/**\n * StoreProvider component provides state and dispatch contexts to its children.\n * It is designed to work with the useReducer hook, enabling state management\n * through a centralized store.\n *\n * state: from the useReducer hook.\n * dispatch: The dispatch function from useReducer.\n * children: The child components that will have access to the context.\n */\nexport const StoreProvider = ({ state, dispatch, children }) => (\n \n \n {children}\n \n \n);\n","/* global Rollbar */\n\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { injectIntl } from 'react-intl';\n\nimport { translate } from '../../lib/use_i18n';\n\n/**\n * It is a special component which catches exceptions raised while\n * rendering components below this one. Since it isn't possible\n * to recover from an exception (otherwise, it would've been caught\n * and processed somewhere), it shows a general error.\n *\n * More info about this approach can be found here\n * https://reactjs.org/docs/error-boundaries.html\n */\nclass ErrorBoundary extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n error: null,\n errorInfo: null,\n };\n }\n\n componentDidCatch(error, errorInfo) {\n this.setState({\n error: error,\n errorInfo: errorInfo,\n });\n\n console.error(error, errorInfo);\n Rollbar.error(error);\n }\n\n render() {\n if (this.state.errorInfo) {\n return (\n <>\n
\n
\n {translate(this.props.intl, 'errors.general')}\n
\n \n );\n }\n // normally render children\n return this.props.children;\n }\n}\n\nErrorBoundary.propTypes = {\n intl: PropTypes.object.isRequired,\n};\n\nexport default injectIntl(ErrorBoundary);\n","import PropTypes from 'prop-types';\n\nimport { IntlProvider } from 'react-intl';\nimport ErrorBoundary from './components/common/error_boundary';\nimport Axios from './components/common/axios';\nimport { FormContextWrapper } from './contexts';\n\n/**\n * High order components (https://reactjs.org/docs/higher-order-components.html).\n */\n\n/**\n * Sets settings for Axios (https://github.com/axios/axios).\n */\nconst withAxios = (WrappedComponent) => {\n const wrapper = (props) => (\n \n \n \n );\n\n wrapper.displayName = 'withAxios';\n wrapper.propTypes = {\n csrfToken: PropTypes.string.isRequired,\n };\n\n return wrapper;\n};\n\n/**\n * Initializes the intl provider to be used by children.\n */\nconst withIntl = (WrappedComponent) => {\n const wrapper = (props) => {\n const locale = props.locale || props.defaultLocale;\n const translations = window.translations || {};\n\n return (\n \n \n \n );\n };\n\n wrapper.displayName = 'withIntl';\n wrapper.propTypes = {\n locale: PropTypes.string,\n defaultLocale: PropTypes.string.isRequired,\n };\n return wrapper;\n};\n\n/**\n * Adds a global error catcher (https://reactjs.org/docs/error-boundaries.html).\n */\nconst withErrorBoundary = (WrappedComponent) => {\n const wrapper = (props) => (\n \n \n \n );\n\n wrapper.displayName = 'withErrorBoundary';\n\n return wrapper;\n};\n\nconst withFormContext = (WrappedComponent) => {\n const wrapper = (props) => (\n \n \n \n );\n\n wrapper.displayName = 'withFormContext';\n\n return wrapper;\n};\n/**\n * Setups a given component for use in Rails views.\n */\nconst topLevel = (WrappedComponent) => {\n return withIntl(\n withAxios(withErrorBoundary(withFormContext(WrappedComponent)))\n );\n};\n\nexport { withAxios, withIntl, topLevel };\n","/**\n * A small lib for managing user tracking consent in a GDPR-compliant way,\n * so that tracking code is only executed once user consent has been given.\n * See also the CookieBanner react component.\n * Adapted from https://github.com/Alex-D/Cookies-EU-banner\n *\n * We use localStorage to store consent but for a little while we used a cookie.\n * Cookies aren't a good solution because of chrome's restrictions on third-party\n * cookies in an iframe. We still check for the cookie so that we don't annoy\n * users who already set it, it should be possible to remove this check after a\n * year or so.\n */\nconst CookieConsent = {\n /**\n * A list of functions that initialize tracking code when called.\n * Tracking code is kept here to be executed when the user gives consent.\n * If the user has already consented, tracking code will be executed\n * immediately and this list will remain empty.\n */\n trackedSnippets: [],\n\n // Name of the cookie used to track user consent\n cookieName: 'hasConsent',\n // 12 months in milliseconds. According to GDPR user consent should expire after this period\n cookieTimeout: 31104000000,\n\n // We make an attempt to hide the consent popup from crawlers,\n // so that it won't appear in search results.\n bots: /bot|crawler|spider|crawling/i,\n // We make an attempt to clear some known, accessible cookies\n // when a user refuses to give consent.\n trackingCookies: /^(_ga|_gid|__hs|__zl|_hj|hubspot|__utm)/,\n\n /**\n * Any third-party code embedded into the page that tracks individual users should be\n * wrapped using this function. The code will then only be executed on the condition\n * that the user has given their consent to be tracked.\n */\n trackingCode(func) {\n if (this.hasConsent()) return func();\n\n this.trackedSnippets.push(func);\n },\n\n // Returns true if a consent banner should be shown to the user.\n showBanner() {\n if (this.isBot() || this.doNotTrack() || this.isConsentSet()) {\n if (!this.hasConsent()) this.clearCookies();\n\n return false;\n }\n return true;\n },\n\n // Should be called when the user has consented\n acceptCookies() {\n this.setConsent(true);\n this.trackedSnippets.forEach((fn) => fn());\n },\n\n // Should be called when the user has withheld consent.\n rejectCookies() {\n this.clearCookies();\n this.setConsent(false);\n },\n\n // User Agent is a bot\n isBot() {\n return this.bots.test(navigator.userAgent);\n },\n\n // Browser \"Do Not Track\" feature is enabled\n doNotTrack() {\n const dnt =\n navigator.doNotTrack || navigator.msDoNotTrack || window.doNotTrack;\n return dnt === 'yes' || dnt === 1 || dnt === '1';\n },\n\n // User has given explicit consent for tracking\n hasConsent() {\n return (\n document.cookie.indexOf(`${this.cookieName}=true`) >= 0 ||\n this.getLocalStorageItem() === 'true'\n );\n },\n\n // User has already made a choice about consent\n isConsentSet() {\n return (\n document.cookie.indexOf(`${this.cookieName}=`) >= 0 ||\n this.getLocalStorageItem() !== null\n );\n },\n\n getLocalStorageItem() {\n try {\n return window.localStorage.getItem(this.cookieName);\n } catch (e) {\n return null;\n }\n },\n\n // Stores whether the user has accepted, or explicitly rejected, tracking cookies.\n // We prefer local storage over cookies, because a significant number of our\n // users are accessing the app through an iframe, where modern browsers\n // disallow third party cookies.\n setConsent(accepted) {\n this.setLocalStorageConsent(accepted) || this.setCookieConsent(accepted);\n },\n\n setLocalStorageConsent(accepted) {\n try {\n // It turns out, the most effective way to detect local storage\n // is to try writing to it:\n // https://stackoverflow.com/q/11214404\n window.localStorage.setItem(this.cookieName, accepted);\n\n return true;\n } catch (e) {\n return false;\n }\n },\n\n setCookieConsent(accepted) {\n const hostname = this.hostname(),\n date = new Date();\n date.setTime(date.getTime + this.cookieTimeout);\n\n // We don't currently have a fallback if cookies are disabled,\n // so we just hope this is going to work.\n document.cookie = `${\n this.cookieName\n }=${accepted};domain=${hostname};expires=${date.toGMTString()};path=/`;\n },\n\n clearCookies() {\n const hostname = this.hostname(),\n commonSuffix = `domain=${hostname}; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/`;\n\n const cookies = document.cookie.split(';').map((s) => s.trim());\n for (const cookie of cookies) {\n const name = cookie.split('=')[0].trim();\n if (!this.trackingCookies.test(name)) continue;\n\n document.cookie = `${name}=; ${commonSuffix}`;\n }\n },\n\n hostname: () => document.location.hostname.replace(/^[^.]+\\./, ''),\n};\n\nexport default CookieConsent;\n","// extracted from @formatjs/intl-utils which doesn't exist anymore\n\nconst DEFAULT_THRESHOLDS = {\n second: 45,\n minute: 45,\n hour: 22,\n day: 5,\n};\n\nconst MS_PER_SECOND = 1e3;\nconst SECS_PER_MIN = 60;\nconst SECS_PER_HOUR = SECS_PER_MIN * 60;\nconst SECS_PER_DAY = SECS_PER_HOUR * 24;\nconst SECS_PER_WEEK = SECS_PER_DAY * 7;\n\nexport default function selectUnit(from, to, thresholds) {\n if (to === undefined) to = Date.now();\n\n if (thresholds === undefined) thresholds = {};\n\n const resolvedThresholds = Object.assign({}, DEFAULT_THRESHOLDS, thresholds);\n\n const secs = (+from - +to) / MS_PER_SECOND;\n\n if (Math.abs(secs) < resolvedThresholds.second) {\n return { value: Math.round(secs), unit: 'second' };\n }\n\n const mins = secs / SECS_PER_MIN;\n\n if (Math.abs(mins) < resolvedThresholds.minute) {\n return { value: Math.round(mins), unit: 'minute' };\n }\n\n const hours = secs / SECS_PER_HOUR;\n\n if (Math.abs(hours) < resolvedThresholds.hour) {\n return { value: Math.round(hours), unit: 'hour' };\n }\n\n const days = secs / SECS_PER_DAY;\n\n if (Math.abs(days) < resolvedThresholds.day) {\n return { value: Math.round(days), unit: 'day' };\n }\n\n const fromDate = new Date(from);\n const toDate = new Date(to);\n const years = fromDate.getFullYear() - toDate.getFullYear();\n\n if (Math.round(Math.abs(years)) > 0) {\n return { value: Math.round(years), unit: 'year' };\n }\n\n const months = years * 12 + fromDate.getMonth() - toDate.getMonth();\n\n if (Math.round(Math.abs(months)) > 0) {\n return { value: Math.round(months), unit: 'month' };\n }\n\n const weeks = secs / SECS_PER_WEEK;\n\n return { value: Math.round(weeks), unit: 'week' };\n}\n","import { useIntl } from 'react-intl';\nimport selectUnit from './helpers/select_unit';\n\n/**\n * A formatMessage method supplied by react-intl works with objects like this:\n *\n * { id: 'app.actions.edit', defaultMessage: 'Edit' }\n *\n * Usually, this kind of objects could be retrieved from a `intl/default.js` file,\n * however, that file isn't loaded anymore, we load only translations for a certain locale,\n * there aren't missing translations, a Ruby part takes case of providing defaults.\n * So, the method below constructs the mentioned object.\n */\nconst translateWithFormatMsg = (formatMessage, id, opts) => {\n if (window.phraseEnabled) {\n return `{{__phrase_${id}__}}`;\n } else {\n return formatMessage({ id }, opts);\n }\n};\n\n/**\n * Allows for something similar to rails i18n, where a namespace is\n * automatically used for ids beginning with '.'\n */\nconst translateWithNamespace = (namespace, formatMessage, id, opts) => {\n if (id.startsWith('.')) id = `${namespace}${id}`;\n\n return translateWithFormatMsg(formatMessage, id, opts);\n};\n\n/**\n * This method only exists because of components which still inject the intl object via props.\n * Mostly, it is true for class-based components, hooks cannot be used with them.\n */\nconst translate = (intl, id, opts) =>\n translateWithFormatMsg(intl.formatMessage, id, opts);\n\n/**\n * Represents a number with the currency.\n */\nconst numberToCurrency = (formatNumber, number, options) =>\n formatNumber(number, { style: 'currency', currency: 'EUR', ...options });\n\nconst defaultOptions = { year: 'numeric', month: 'short', day: 'numeric' };\n\nconst dateToString = (formatDate, date, options = {}) =>\n formatDate(date, Object.assign({}, defaultOptions, options));\n\n// gets date in format: YYYY-mm-dd\nconst dateInDbFormat = (date) => date.toISOString().substr(0, 10);\n\nconst relativeOrFormatDate = (translate, dateToString, date) => {\n const todayInStr = dateInDbFormat(new Date());\n\n if (date.search(todayInStr) > -1) return translate('app.today');\n\n const yesterdayInStr = dateInDbFormat(\n new Date(new Date().getTime() - 86400 * 1000)\n );\n\n if (date.search(yesterdayInStr) > -1) return translate('app.yesterday');\n\n return dateToString(date);\n};\n\n/**\n * Returns a String representing time in words.\n */\nconst timeToDistance = (formatRelativeTime, date) => {\n const { value, unit } = selectUnit(new Date(date));\n return formatRelativeTime(value, unit);\n};\n\nexport const generateLink = ({ href, text }) =>\n `${text}`;\n\n// we often want to show today/yasterday for recent dates,\n// instead of displaying the date itself.\nconst customRelativeDate = (\n elasticDateFormat,\n formatRelativeTime,\n formatTime,\n { dateString, showTime }\n) => {\n if (!dateString) return;\n\n const time = showTime ? `, ${formatTime(dateString)}` : '';\n const distance = Math.ceil(\n (new Date() - new Date(dateString)) / (86400 * 1000)\n );\n\n const date =\n distance > 2 && distance < 8\n ? formatRelativeTime(distance * -1, 'day')\n : elasticDateFormat(dateString);\n\n return `${date}${time}`;\n};\n\n/**\n * A hook which proxies method calls to react-intl\n * and provides access to the translate method.\n * An optional default namespace can be supplied,\n * which will be prefixed to any given id that starts\n * with the '.' character.\n * Translations can be requested like:\n *\n * let { translate } = useI18n();\n * translate('app.actions.edit')\n *\n * let { translate } = useI18n('app.actions');\n * translate('.edit'); // Evaluates to app.actions.edit\n * translate('no.prefix'); // Evaluates to no.prefix\n *\n * let { formatCurrency } = useI18n();\n * formatCurrency(300) // €300.00\n */\nconst useI18n = (namespace) => {\n const intl = useIntl();\n const {\n formatMessage,\n formatNumber,\n formatRelativeTime,\n formatDate,\n formatTime,\n locale,\n } = intl;\n\n const translate = namespace\n ? translateWithNamespace.bind(null, namespace, formatMessage)\n : translateWithFormatMsg.bind(null, formatMessage);\n\n const formatCurrency = numberToCurrency.bind(null, formatNumber);\n const timeAgo = timeToDistance.bind(null, formatRelativeTime);\n const formattedDate = dateToString.bind(null, formatDate);\n const elasticDateFormat = relativeOrFormatDate.bind(\n null,\n translate,\n formattedDate\n );\n\n const formatRelativeDate = customRelativeDate.bind(\n null,\n elasticDateFormat,\n formatRelativeTime,\n formatTime\n );\n return {\n translate,\n formatNumber,\n formatCurrency,\n formatTime,\n formatRelativeTime,\n formatRelativeDate,\n timeAgo,\n formattedDate,\n elasticDateFormat,\n generateLink,\n locale,\n };\n};\n\nexport default useI18n;\n\nexport { translate };\n","/* eslint-disable no-undef */\n\n// Object.assign is used inside ReactOnRails, IE 11 users suffer without this polyfill\nimport 'core-js/features/object/assign';\n\n// disable React auto-rendering\nwindow.__REACT_ON_RAILS_EVENT_HANDLERS_RAN_ONCE__ = true;\n\n/**\n * ReactOnRails must be included only once, otherwise, it removes registered components\n * from another bundle. More explanation of this problem might be found there\n * https://github.com/shakacode/react_on_rails/issues/991\n */\nwindow.ReactOnRails = window.ReactOnRails || require('react-on-rails').default;\n\n/**\n * Pages might load different bundles with components, it means all components aren't registered\n * right away, React tries to render components once the loading is stopped (see https://bit.ly/34HWLsn).\n * After disabling auto-rendering above, react components must be rendered manually once the DOM is loaded\n * (all components are registered at that time).\n */\nif (!window.reactHandlerAdded) {\n window.reactHandlerAdded = true;\n\n window.addEventListener(\n 'DOMContentLoaded',\n window.ReactOnRails.reactOnRailsPageLoaded\n );\n}\n"],"names":["className","role","redirectIfNeeded","resp","url","window","location","replace","errorHandleWrapper","async","action","getErrorMessage","error","errorMessage","response","data","status","Flash","alert","csrfToken","children","translate","useI18n","counter","setCounter","useState","decreaseCounter","useEffect","axiosHandlersAdded","commonHeaders","axios","defaults","headers","common","interceptors","request","use","config","generalError","code","Promise","reject","Rollbar","errorMsg","handleError","isCurrentLocale","locale","currentLocale","LocaleSpan","LocaleLink","href","availableLocales","map","CompanyNameContext","createContext","CountriesContext","FormContext","FormContextWrapper","dirtyForms","setDirtyForms","isDirty","Object","values","some","Boolean","setDirty","useCallback","id","oldState","onbeforeunload","Provider","value","StateContext","DispatchContext","StoreProvider","state","dispatch","ErrorBoundary","React","constructor","props","super","this","errorInfo","componentDidCatch","setState","console","render","intl","injectIntl","topLevel","WrappedComponent","wrapper","defaultLocale","translations","messages","displayName","withIntl","A","withAxios","withErrorBoundary","withFormContext","trackedSnippets","cookieName","cookieTimeout","bots","trackingCookies","trackingCode","func","hasConsent","push","showBanner","isBot","doNotTrack","isConsentSet","clearCookies","acceptCookies","setConsent","forEach","fn","rejectCookies","test","navigator","userAgent","dnt","msDoNotTrack","document","cookie","indexOf","getLocalStorageItem","localStorage","getItem","e","accepted","setLocalStorageConsent","setCookieConsent","setItem","hostname","date","Date","setTime","getTime","toGMTString","commonSuffix","cookies","split","s","trim","name","DEFAULT_THRESHOLDS","second","minute","hour","day","translateWithFormatMsg","formatMessage","opts","phraseEnabled","translateWithNamespace","namespace","startsWith","numberToCurrency","formatNumber","number","options","style","currency","defaultOptions","year","month","dateToString","formatDate","assign","dateInDbFormat","toISOString","substr","relativeOrFormatDate","todayInStr","search","yesterdayInStr","timeToDistance","formatRelativeTime","unit","from","to","thresholds","undefined","now","resolvedThresholds","secs","Math","abs","round","mins","hours","SECS_PER_MIN","days","SECS_PER_HOUR","fromDate","toDate","years","getFullYear","months","getMonth","weeks","SECS_PER_DAY","selectUnit","generateLink","text","customRelativeDate","elasticDateFormat","formatTime","dateString","showTime","time","distance","ceil","useIntl","bind","formatCurrency","timeAgo","formattedDate","formatRelativeDate","__REACT_ON_RAILS_EVENT_HANDLERS_RAN_ONCE__","ReactOnRails","require","reactHandlerAdded","addEventListener","reactOnRailsPageLoaded"],"sourceRoot":""}