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AKuF,iBAAiBH,GAAYC,GACnDrF,KAAKgF,OAAOM,KAAK,GAADrG,OAAIe,KAAK8E,UAAS,KAAA7F,OAAImG,GAAaC,EACrD,GAAC,CAAAvF,IAAA,KAAAvB,MAED,SAAU6G,EAAmBI,EAAmCC,GAC9D,OAAOzF,KAAKgF,OAAOU,GAAG1F,KAAKuF,iBAAiBH,GAAYI,EAAUC,EACpE,GAAC,CAAA3F,IAAA,YAAAvB,MAED,SAAiB6G,GACf,OAAOpF,KAAKgF,OAAOW,UAAU3F,KAAKuF,iBAAiBH,GACrD,GAAC,CAAAtF,IAAA,SAAAvB,MAED,SAAcY,GACRA,EAAQ2F,YACV9E,KAAK8E,UAAY3F,EAAQ2F,WAEvB3F,EAAQ0F,KACV7E,KAAK6E,GAAK1F,EAAQ0F,IAEhB1F,EAAQ4F,QACV9C,OAAOiB,OAAOlD,KAAK+E,OAAQ5F,EAAQ4F,QAErC/E,KAAKsF,KAAK,UACZ,GAAC,CAAAxF,IAAA,WAAA8F,IAED,WACE,OAAO5F,KAAKiF,cACd,EAACY,IAED,SAAaZ,GACXjF,KAAKiF,eAAiBA,EAElBjF,KAAa,UACf8F,EAAAA,EAAAA,wBAAuB9F,KAAK6E,IAC5B7E,KAAa,SAEjB,GAAC,CAAAF,IAAA,mBAAAvB,MAED,SAAyB6G,GACvB,MAAM,GAANnG,OAAUe,KAAK8E,UAAS,KAAA7F,OAAIe,KAAK+E,OAAO5B,IAAG,KAAAlE,OAAImG,EACjD,M,8EAACR,CAAA,CA7DwB,E","sources":["webpack://app/./app/javascript/components/Button/Button.js","webpack://app/./app/javascript/util/locales/helpers.js","webpack://app/./app/javascript/util/TranslationsLoader.js","webpack://app/./app/javascript/components/ComponentWrapper.js","webpack://app/./app/javascript/components/SelectCountry/SelectCountry.js","webpack://app/./app/javascript/components/SweetSelect/SweetSelect.js","webpack://app/./app/javascript/plugins/plugin.ts"],"sourcesContent":["import React from 'react';\nimport classnames from 'classnames';\nimport './Button.scss';\n\nconst Button = props => {\n const className = classnames(\n 'Button-root',\n props.theme,\n props.disabled ? 'disabled' : '',\n props.className ? props.className : ''\n );\n return (\n \n {props.children}\n \n );\n};\n\nexport default Button;\n","// Converts translations from Rails format to ReactIntl format.\nimport flatten from 'flat';\nimport mapValues from 'lodash/mapValues';\nimport reduce from 'lodash/reduce';\nimport isPlainObject from 'lodash/reduce';\n\nexport function transform(translations) {\n return mapValues(flatten(translations), replaceInterpolations);\n}\n\nexport function replaceInterpolations(value) {\n if (typeof value === 'string') return value.replace(/%{(\\w+)}/g, '{$1}');\n return value;\n}\n","// champaign-i18n is an external (aliases to window.I18n)\n// see config/webpack/custom.js to see where it's aliased\nimport flatten from 'flat';\nimport I18n from 'champaign-i18n';\nimport { mapValues } from 'lodash';\nimport { replaceInterpolations } from './locales/helpers';\n\nconst translations = mapValues(I18n.translations, tree =>\n mapValues(flatten(tree), replaceInterpolations)\n);\n\nexport default function loadTranslations(locale) {\n if (!translations[locale]) {\n throw new Error(`Unsuported locale: ${locale}`);\n }\n return translations[locale];\n}\n","/* */\nimport React, { Component } from 'react';\nimport { Provider } from 'react-redux';\nimport { IntlProvider, addLocaleData } from 'react-intl';\nimport enLocaleData from 'react-intl/locale-data/en';\nimport deLocaleData from 'react-intl/locale-data/de';\nimport frLocaleData from 'react-intl/locale-data/fr';\nimport esLocaleData from 'react-intl/locale-data/es';\nimport ptLocaleData from 'react-intl/locale-data/pt';\nimport nlLocaleData from 'react-intl/locale-data/nl';\nimport arLocaleData from 'react-intl/locale-data/ar';\nimport loadTranslations from '../util/TranslationsLoader';\n\nfunction WrapInStore(options) {\n if (options.store) {\n return {options.children};\n }\n return options.children;\n}\n\nexport default class ComponentWrapper extends Component {\n render() {\n return (\n \n \n
{this.props.children}
\n
\n \n );\n }\n}\n\naddLocaleData([\n ...enLocaleData,\n ...deLocaleData,\n ...frLocaleData,\n ...esLocaleData,\n ...ptLocaleData,\n ...nlLocaleData,\n ...arLocaleData,\n]);\n","import React, { Component } from 'react';\nimport { map, indexOf } from 'lodash';\nimport SweetSelect from '../SweetSelect/SweetSelect';\nimport countriesEn from './countries/en.json';\nimport countriesDe from './countries/de.json';\nimport countriesEs from './countries/es.json';\nimport countriesFr from './countries/fr.json';\nimport countriesPt from './countries/pt.json';\nimport countriesNl from './countries/nl.json';\nimport countriesAR from './countries/ar.json';\nimport { injectIntl } from 'react-intl';\n\nexport const countries = countriesEn;\n\nconst countriesByLocale = {\n en: countriesEn,\n es: countriesEs,\n de: countriesDe,\n fr: countriesFr,\n pt: countriesPt,\n nl: countriesNl,\n ar: countriesAR,\n};\n\nexport class SelectCountry extends Component {\n focus() {\n if (!this.refs.select) return;\n this.refs.select.focus();\n }\n\n render() {\n const props = this.props;\n const locale = props.intl.locale;\n let countries = countriesByLocale[locale];\n\n countries = Object.keys(countries)\n .map(c => ({ value: c.toString(), label: countries[c].toString() }))\n .sort((a, b) => {\n if (typeof window.Intl.Collator === 'function') {\n return new window.Intl.Collator(locale).compare(a.label, b.label);\n }\n if (a.label.toString() > b.label.toString()) return 1;\n if (a.label.toString() < b.label.toString()) return -1;\n return 0;\n });\n\n if (props.filter && props.filter.length) {\n countries = countries.filter(c => {\n return indexOf(props.filter, c.value.toString()) > -1;\n });\n }\n\n return (\n \n );\n }\n}\n\nexport default injectIntl(SelectCountry, { withRef: true });\n","import React, { Component } from 'react';\nimport classnames from 'classnames';\nimport Select from 'react-select';\nimport 'react-select/dist/react-select.css';\nimport './SweetSelect.scss';\n\n// TODO: deduplicate this (also seen in SweetInput)\n\nexport default class SweetSelect extends Component {\n constructor(props) {\n super(props);\n this.state = {\n filled: false,\n focused: false,\n };\n }\n\n onChange(item) {\n if (this.props.onChange) {\n const value = item ? item.value : '';\n this.props.onChange(value);\n }\n }\n\n hasError() {\n const { validationState, errorMessage } = this.props;\n if (validationState || validationState === null) {\n return validationState === 'error';\n }\n return !!this.props.errorMessage;\n }\n\n focus() {\n if (!this.refs.select) return;\n this.refs.select.focus();\n }\n toggleFocus(focused) {\n if (focused) this.refs.select.focus();\n this.setState({ focused });\n }\n\n render() {\n const className = classnames('sweet-placeholder__label', {\n 'sweet-placeholder__label--full':\n !!this.props.value && !this.state.focused,\n 'sweet-placeholder__label--active': this.state.focused,\n 'has-error': this.hasError(),\n });\n\n const rootClassName = classnames(\n 'SweetSelect',\n 'sweet-placeholder',\n this.props.className\n );\n\n return (\n
\n \n this.toggleFocus(true)}\n onBlur={e => this.toggleFocus(false)}\n onChange={this.onChange.bind(this)}\n className={this.hasError() ? 'has-error' : ''}\n />\n {this.props.errorMessage}\n
\n );\n }\n}\n","import * as EventEmitter from 'eventemitter3';\nimport { unmountComponentAtNode } from 'react-dom';\nimport { Store } from 'redux';\nimport { IAppState } from '../types';\n\nexport interface IPluginConfig {\n id: number;\n active: boolean;\n page_id: number;\n ref: string;\n created_at?: string;\n updated_at?: string;\n}\n\nexport interface IPluginOptions {\n config: T;\n customRenderer?: (instance: any) => any | undefined;\n el: HTMLElement;\n eventEmitter?: any;\n namespace?: string;\n store?: Store;\n}\n\n// Plugin is the base class from which other\n// plugins inherit. It implements an EventEmitter\n// with some basic lifecycle methods;\nexport default class Plugin\n implements IPluginOptions {\n public el: HTMLElement;\n public namespace: string;\n public config: T;\n public events: EventEmitter;\n public customRenderer: (instance: any) => any | undefined;\n public store?: Store;\n\n constructor(options: IPluginOptions) {\n this.config = options.config;\n this.el = options.el;\n this.events = options.eventEmitter || new EventEmitter.EventEmitter();\n this.namespace = options.namespace || '';\n this.store = options.store;\n if (options.customRenderer) {\n this.customRenderer = options.customRenderer;\n }\n }\n\n public emit(eventName: string, data?: any) {\n this.events.emit(this.privateEventName(eventName), data);\n this.events.emit(`${this.namespace}:${eventName}`, data);\n }\n\n public on(eventName: string, listener: EventEmitter.ListenerFn, ctx: any) {\n return this.events.on(this.privateEventName(eventName), listener, ctx);\n }\n\n public listeners(eventName: string) {\n return this.events.listeners(this.privateEventName(eventName));\n }\n\n public update(options: Partial>) {\n if (options.namespace) {\n this.namespace = options.namespace;\n }\n if (options.el) {\n this.el = options.el;\n }\n if (options.config) {\n Object.assign(this.config, options.config);\n }\n this.emit('updated');\n }\n\n get renderer() {\n return this.customRenderer;\n }\n\n set renderer(customRenderer: (instance: any) => any) {\n this.customRenderer = customRenderer;\n\n if (this['render']) {\n unmountComponentAtNode(this.el);\n this['render']();\n }\n }\n\n private privateEventName(eventName: string) {\n return `${this.namespace}:${this.config.ref}:${eventName}`;\n }\n}\n"],"names":["props","className","classnames","theme","disabled","React","type","name","id","onClick","children","replaceInterpolations","value","replace","translations","mapValues","I18n","tree","flatten","loadTranslations","locale","Error","concat","WrapInStore","options","store","Provider","ComponentWrapper","_Component","_inherits","_super","_createSuper","_classCallCheck","apply","arguments","key","IntlProvider","this","messages","Component","addLocaleData","_toConsumableArray","enLocaleData","deLocaleData","frLocaleData","esLocaleData","ptLocaleData","nlLocaleData","arLocaleData","countries","countriesEn","countriesByLocale","en","es","countriesEs","de","countriesDe","fr","countriesFr","pt","countriesPt","nl","countriesNl","ar","countriesAR","SelectCountry","refs","select","focus","intl","Object","keys","map","c","toString","label","sort","a","b","window","Intl","Collator","compare","filter","length","indexOf","SweetSelect","assign","ref","injectIntl","withRef","_this","call","state","filled","focused","item","onChange","_this$props","validationState","errorMessage","setState","_this2","hasError","rootClassName","e","toggleFocus","Select","placeholder","openOnFocus","onFocus","onBlur","bind","Plugin","el","namespace","config","events","customRenderer","eventEmitter","EventEmitter","eventName","data","emit","privateEventName","listener","ctx","on","listeners","get","set","unmountComponentAtNode"],"sourceRoot":""}