react-localize-redux
Advanced tools
Comparing version 2.17.5 to 3.0.0-rc1
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-redux"),require("redux")):"function"==typeof define&&define.amd?define(["react","react-redux","redux"],t):"object"==typeof exports?exports.ReactLocalizeRedux=t(require("react"),require("react-redux"),require("redux")):e.ReactLocalizeRedux=t(e.React,e.ReactRedux,e.Redux)}(this,function(e,t,n){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=6)}([function(t,n){t.exports=e},function(e,t,n){"use strict";function r(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments[1];switch(t.type){case g:case v:var n=t.payload.options||{},r=t.payload.activeLanguage||n.defaultLanguage;return t.payload.languages.map(function(e,t){var n=function(e){return void 0!==r?e===r:0===t};return"string"==typeof e?{code:e,active:n(e)}:c({},e,{active:n(e.code)})});case m:return e.map(function(e){return e.code===t.payload.languageCode?c({},e,{active:!0}):c({},e,{active:!1})});default:return e}}function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];switch(t.type){case h:var n=void 0!==t.translationTransform?t.translationTransform(t.payload.translation,t.languageCodes):t.payload.translation;return c({},e,(0,f.flatten)(n,{safe:!0}));case y:var r=t.languageCodes.indexOf(t.payload.language),a=r>=0?(0,f.flatten)(t.payload.translation):{},i=Object.keys(a).reduce(function(n,i){var u=t.languageCodes.map(function(t,n){var o=e[i]||[];return n===r?a[i]:o[n]});return c({},n,o({},i,u))},{});return c({},e,i);default:return e}}function u(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:b,t=arguments[1];switch(t.type){case g:var n=t.payload.options||{};return c({},e,(0,d.validateOptions)(n));default:return e}}Object.defineProperty(t,"__esModule",{value:!0}),t.getTranslateComponent=t.getTranslate=t.getTranslationsForSpecificLanguage=t.getTranslationsForActiveLanguage=t.translationsEqualSelector=t.getActiveLanguage=t.getOptions=t.getLanguages=t.getTranslations=t.setActiveLanguage=t.setLanguages=t.addTranslationForLanguage=t.addTranslation=t.initialize=t.localeReducer=t.defaultTranslateOptions=t.TRANSLATE=t.SET_ACTIVE_LANGUAGE=t.SET_LANGUAGES=t.ADD_TRANSLATION_FOR_LANGUGE=t.ADD_TRANSLATION=t.INITIALIZE=void 0;var l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.languages=a,t.translations=i,t.options=u;var s=n(0),f=(function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);t.default=e}(s),n(22),n(12)),p=n(20),d=n(2),g=t.INITIALIZE="@@localize/INITIALIZE",h=t.ADD_TRANSLATION="@@localize/ADD_TRANSLATION",y=t.ADD_TRANSLATION_FOR_LANGUGE="@@localize/ADD_TRANSLATION_FOR_LANGUGE",v=t.SET_LANGUAGES="@@localize/SET_LANGUAGES",m=t.SET_ACTIVE_LANGUAGE="@@localize/SET_ACTIVE_LANGUAGE",b=(t.TRANSLATE="@@localize/TRANSLATE",t.defaultTranslateOptions={renderInnerHtml:!0,showMissingTranslationMsg:!0,missingTranslationMsg:"Missing translation key ${ key } for language ${ code }",ignoreTranslateChildren:!1}),w={languages:[],translations:{},options:b},x=(t.localeReducer=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:w,t=arguments[1],n=e.languages.map(function(e){return e.code}),r=e.options.translationTransform;return{languages:a(e.languages,t),translations:i(e.translations,c({},t,{languageCodes:n,translationTransform:r})),options:u(e.options,t)}},t.initialize=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:b;return{type:g,payload:{languages:e,options:t}}},t.addTranslation=function(e){return{type:h,payload:{translation:e}}},t.addTranslationForLanguage=function(e,t){return{type:y,payload:{translation:e,language:t}}},t.setLanguages=function(e,t){return(0,d.warning)("The setLanguages action will be removed in the next major version. Please use initialize action instead https://ryandrewjohnson.github.io/react-localize-redux/api/action-creators/#initializelanguages-options"),{type:v,payload:{languages:e,activeLanguage:t}}},t.setActiveLanguage=function(e){return{type:m,payload:{languageCode:e}}},t.getTranslations=function(e){return e.translations}),S=t.getLanguages=function(e){return e.languages},O=t.getOptions=function(e){return e.options},T=t.getActiveLanguage=function(e){return S(e).filter(function(e){return!0===e.active})[0]},k=t.translationsEqualSelector=(0,p.createSelectorCreator)(p.defaultMemoize,function(e,t){var n="object"===(void 0===t?"undefined":l(t))?Object.keys(t).toString():void 0,r="object"===(void 0===e?"undefined":l(e))?Object.keys(e).toString():void 0,o="object"===(void 0===t?"undefined":l(t))?(0,d.objectValuesToString)(t):void 0,a="object"===(void 0===e?"undefined":l(e))?(0,d.objectValuesToString)(e):void 0;return(n&&o?t:n+" - "+o)===(r&&a?e:r+" - "+a)}),j=t.getTranslationsForActiveLanguage=k(T,S,x,d.getTranslationsForLanguage),L=t.getTranslationsForSpecificLanguage=k(S,x,function(e,t){return(0,p.defaultMemoize)(function(n){return(0,d.getTranslationsForLanguage)(n,e,t)})}),A=(0,p.createSelector)(j,L,T,O,function(e,t,n,a){return function(i){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=l.defaultLanguage,f=r(l,["defaultLanguage"]),p=c({},a,f),g=void 0!==s?t({code:s,active:!1}):e;if("string"==typeof i)return(0,d.getLocalizedElement)(i,g,u,n,p);if(Array.isArray(i))return i.reduce(function(e,t){return c({},e,o({},t,(0,d.getLocalizedElement)(t,g,u,n,p)))},{});throw new Error("react-localize-redux: Invalid key passed to getTranslate.")}});t.getTranslate=A;t.getTranslateComponent=(0,p.createSelector)(A,function(e){return function(t){return e(t.id,t.data,t.options)}})},function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(t,"__esModule",{value:!0}),t.warning=t.storeDidChange=t.getTranslationsForLanguage=t.validateOptions=t.objectValuesToString=t.getIndexForLanguageCode=t.templater=t.hasHtmlTags=t.getLocalizedElement=void 0;var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a=n(0),i=function(e){return e&&e.__esModule?e:{default:e}}(a),u=n(1),l=(t.getLocalizedElement=function(e,t,n,r){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:u.defaultTranslateOptions,a=t[e]||function(){return o.missingTranslationCallback&&o.missingTranslationCallback(e,r.code),!1===o.showMissingTranslationMsg?"":c(o.missingTranslationMsg||"",{key:e,code:r.code})}(),s=c(a,n);return o.renderInnerHtml&&l(s)?i.default.createElement("span",{dangerouslySetInnerHTML:{__html:s}}):s},t.hasHtmlTags=function(e){var t=/(&[^\s]*;|<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[\^'">\s]+))?)+\s*|\s*)\/?>)/;return e.search(t)>=0}),c=t.templater=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for(var n in t){var r="\\${\\s*"+n+"\\s*}",o=new RegExp(r,"gmi");e=e.replace(o,t[n])}return e},s=t.getIndexForLanguageCode=function(e,t){return t.map(function(e){return e.code}).indexOf(e)};t.objectValuesToString=function(e){return Object.values?Object.values(e).toString():Object.keys(e).map(function(t){return e[t].toString()}).toString()},t.validateOptions=function(e){if(void 0!==e.translationTransform&&"function"!=typeof e.translationTransform)throw new Error("react-localize-redux: Invalid translationTransform function.");return e},t.getTranslationsForLanguage=function(e,t,n){if(!e)return{};var a=e.code,i=s(a,t);return Object.keys(n).reduce(function(e,t){return o({},e,r({},t,n[t][i]))},{})},t.storeDidChange=function(e,t){function n(){var n=e.getState();n!==r&&(t(r),r=n)}var r=void 0,o=e.subscribe(n);return n(),o},t.warning=function(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(e){}}},function(e,t,n){"use strict";function r(e){return function(){return e}}var o=function(){};o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.localize=void 0;var r=n(0),o=(function(e){e&&e.__esModule}(r),n(21)),a=n(1),i=function(e,t){return function(n){var r=t?t(n):e&&n[e]||n,o=(0,a.getActiveLanguage)(r);return{currentLanguage:o?o.code:void 0,translate:(0,a.getTranslate)(r)}}};t.localize=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return(0,o.connect)(i(t,n))(e)}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.Translate=void 0;var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(0),s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(c),f=n(19),p=r(f),d=n(16),g=r(d),h=n(1),y=n(2);(t.Translate=function(e){function t(e,n){a(this,t);var r=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));if(!r.getStore())throw new Error("react-localize-redux: Unable to locate redux store in context. Ensure your app is wrapped with <Provider />.");if(!r.getStateSlice().languages)throw new Error("react-localize-redux: cannot find languages ensure you have correctly dispatched initialize action.");return r.state={hasUpdated:!1},r.onStateDidChange=r.onStateDidChange.bind(r),r.addDefaultTranslation(),r}return u(t,e),l(t,[{key:"componentDidMount",value:function(){this.unsubscribeFromStore=(0,y.storeDidChange)(this.getStore(),this.onStateDidChange)}},{key:"componentWillUnmount",value:function(){this.unsubscribeFromStore()}},{key:"onStateDidChange",value:function(e){var t=this.getStateSlice(e),n=this.getStateSlice(),r=(0,h.getActiveLanguage)(t),o=(0,h.getActiveLanguage)(n),a=(0,h.getOptions)(t),i=(0,h.getOptions)(n),u=(0,h.getTranslationsForActiveLanguage)(t),l=(0,h.getTranslationsForActiveLanguage)(n),c=r.code!==o.code,s=a!==i,f=u!==l;(c||s||f)&&this.setState({hasUpdated:!0})}},{key:"addDefaultTranslation",value:function(){var e=this.getStateSlice(),t=this.props,n=t.id,r=t.children;if(void 0!==r&&"function"!=typeof r&&!e.options.ignoreTranslateChildren&&void 0!==n){var a=this.getStore(),i=p.default.renderToStaticMarkup(r),u=e.options.defaultLanguage||e.languages[0].code;a.dispatch((0,h.addTranslationForLanguage)(o({},n,i),u))}}},{key:"getStore",value:function(){var e=this.context.storeKey;return this.context[e||"store"]}},{key:"getStateSlice",value:function(e){var t=this.context,n=t.getLocaleState,r=(t.storeKey,e||this.getStore().getState());return void 0!==n?n(r):r.locale||r}},{key:"render",value:function(){var e=(0,h.getTranslate)(this.getStateSlice()),t=(0,h.getActiveLanguage)(this.getStateSlice()),n=(0,h.getLanguages)(this.getStateSlice()),r=this.props,o=r.id,a=void 0===o?"":o,i=r.data,u=r.options;return"function"==typeof this.props.children?this.props.children(e,t,n):e(a,i,u)}}]),t}(s.Component)).contextTypes={store:g.default.shape({subscribe:g.default.func.isRequired,dispatch:g.default.func.isRequired,getState:g.default.func.isRequired}),getLocaleState:g.default.func,storeKey:g.default.string}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4);Object.defineProperty(t,"localize",{enumerable:!0,get:function(){return r.localize}});var o=n(5);Object.defineProperty(t,"Translate",{enumerable:!0,get:function(){return o.Translate}});var a=n(1);Object.defineProperty(t,"localeReducer",{enumerable:!0,get:function(){return a.localeReducer}}),Object.defineProperty(t,"initialize",{enumerable:!0,get:function(){return a.initialize}}),Object.defineProperty(t,"addTranslation",{enumerable:!0,get:function(){return a.addTranslation}}),Object.defineProperty(t,"addTranslationForLanguage",{enumerable:!0,get:function(){return a.addTranslationForLanguage}}),Object.defineProperty(t,"setLanguages",{enumerable:!0,get:function(){return a.setLanguages}}),Object.defineProperty(t,"setActiveLanguage",{enumerable:!0,get:function(){return a.setActiveLanguage}}),Object.defineProperty(t,"getTranslate",{enumerable:!0,get:function(){return a.getTranslate}}),Object.defineProperty(t,"getActiveLanguage",{enumerable:!0,get:function(){return a.getActiveLanguage}}),Object.defineProperty(t,"getLanguages",{enumerable:!0,get:function(){return a.getLanguages}}),Object.defineProperty(t,"getTranslations",{enumerable:!0,get:function(){return a.getTranslations}}),Object.defineProperty(t,"getOptions",{enumerable:!0,get:function(){return a.getOptions}})},function(e,t,n){"use strict";var r={};e.exports=r},function(e,t,n){"use strict";function r(e){return e.replace(o,"-$1").toLowerCase()}var o=/([A-Z])/g;e.exports=r},function(e,t,n){"use strict";function r(e){return o(e).replace(a,"-ms-")}var o=n(8),a=/^ms-/;e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r,a,i,u,l){if(o(t),!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var s=[n,r,a,i,u,l],f=0;c=new Error(t.replace(/%s/g,function(){return s[f++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}}var o=function(e){};e.exports=r},function(e,t,n){"use strict";function r(e){var t={};return function(n){return t.hasOwnProperty(n)||(t[n]=e.call(this,n)),t[n]}}e.exports=r},function(e,t,n){function r(e,t){function n(e,u,l){l=l||1,Object.keys(e).forEach(function(c){var s=e[c],f=t.safe&&Array.isArray(s),p=Object.prototype.toString.call(s),d=a(s),g="[object Object]"===p||"[object Array]"===p,h=u?u+r+c:c;if(!f&&!d&&g&&Object.keys(s).length&&(!t.maxDepth||l<o))return n(s,h,l+1);i[h]=s})}t=t||{};var r=t.delimiter||".",o=t.maxDepth,i={};return n(e),i}function o(e,t){function n(e){var t=Number(e);return isNaN(t)||-1!==e.indexOf(".")?e:t}t=t||{};var r=t.delimiter||".",i=t.overwrite||!1,u={};return a(e)||"[object Object]"!==Object.prototype.toString.call(e)?e:(Object.keys(e).forEach(function(a){for(var l=a.split(r),c=n(l.shift()),s=n(l[0]),f=u;void 0!==s;){var p=Object.prototype.toString.call(f[c]),d="[object Object]"===p||"[object Array]"===p;if(!i&&!d&&void 0!==f[c])return;(i&&!d||!i&&null==f[c])&&(f[c]="number"!=typeof s||t.object?{}:[]),f=f[c],l.length>0&&(c=n(l.shift()),s=n(l[0]))}f[c]=o(e[a],t)}),u)}var a=n(13);e.exports=r;r.flatten=r,r.unflatten=o},function(e,t){function n(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function r(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&n(e.slice(0,0))}/*! | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.ReactLocalizeRedux=t(require("react")):e.ReactLocalizeRedux=t(e.React)}(this,function(e){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=18)}([function(t,n){t.exports=e},function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments[1];switch(t.type){case h:var n=t.payload.options||{};return t.payload.languages.map(function(e,t){var r=function(e){return void 0!==n.defaultLanguage?e===n.defaultLanguage:0===t};return"string"==typeof e?{code:e,active:r(e)}:l({},e,{active:r(e.code)})});case y:return e.map(function(e){return e.code===t.payload.languageCode?l({},e,{active:!0}):l({},e,{active:!1})});default:return e}}function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1],n=void 0,r=void 0;switch(t.type){case h:if(!t.payload.translation)return e;n=(0,f.flatten)(t.payload.translation,{safe:!0});var o=t.payload.options||{},a="string"==typeof t.payload.languages[0]?t.payload.languages[0]:t.payload.languages[0].code,i=o.defaultLanguage||a,u=Object.keys(n).some(function(e){return Array.isArray(n[e])}),c=u?void 0!==t.translationTransform?(0,f.flatten)(t.translationTransform(t.payload.translation||{},t.languageCodes),{safe:!0}):n:(0,p.getSingleToMultilanguageTranslation)(i,t.languageCodes,n,e);return l({},e,c);case g:return r=void 0!==t.translationTransform?t.translationTransform(t.payload.translation||{},t.languageCodes):t.payload.translation,l({},e,(0,f.flatten)(r,{safe:!0}));case v:return n=(0,f.flatten)(t.payload.translation,{safe:!0}),l({},e,(0,p.getSingleToMultilanguageTranslation)(t.payload.language,t.languageCodes,n,e));default:return e}}function u(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:b,t=arguments[1];switch(t.type){case h:var n=t.payload.options||{};return l({},e,(0,p.validateOptions)(n));default:return e}}Object.defineProperty(t,"__esModule",{value:!0}),t.getTranslate=t.getTranslationsForSpecificLanguage=t.getTranslationsForActiveLanguage=t.translationsEqualSelector=t.getActiveLanguage=t.getOptions=t.getLanguages=t.getTranslations=t.setActiveLanguage=t.addTranslationForLanguage=t.addTranslation=t.initialize=t.localizeReducer=t.defaultTranslateOptions=t.TRANSLATE=t.SET_ACTIVE_LANGUAGE=t.ADD_TRANSLATION_FOR_LANGUAGE=t.ADD_TRANSLATION=t.INITIALIZE=void 0;var c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.languages=a,t.translations=i,t.options=u;var s=n(0),f=(function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);t.default=e}(s),n(5),n(8)),d=n(15),p=n(3),h=t.INITIALIZE="@@localize/INITIALIZE",g=t.ADD_TRANSLATION="@@localize/ADD_TRANSLATION",v=t.ADD_TRANSLATION_FOR_LANGUAGE="@@localize/ADD_TRANSLATION_FOR_LANGUAGE",y=t.SET_ACTIVE_LANGUAGE="@@localize/SET_ACTIVE_LANGUAGE",b=(t.TRANSLATE="@@localize/TRANSLATE",t.defaultTranslateOptions={renderInnerHtml:!1,ignoreTranslateChildren:!1,onMissingTranslation:function(e){e.translationId,e.languageCode;return"Missing translationId: ${ translationId } for language: ${ languageCode }"}}),m={languages:[],translations:{},options:b},w=(t.localizeReducer=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:m,t=arguments[1],n=e.languages.map(function(e){return e.code}),r=e.options.translationTransform;return{languages:a(e.languages,t),translations:i(e.translations,l({},t,{languageCodes:n,translationTransform:r})),options:u(e.options,t)}},t.initialize=function(e){return{type:h,payload:e}},t.addTranslation=function(e){return{type:g,payload:{translation:e}}},t.addTranslationForLanguage=function(e,t){return{type:v,payload:{translation:e,language:t}}},t.setActiveLanguage=function(e){return{type:y,payload:{languageCode:e}}},t.getTranslations=function(e){return e.translations}),O=t.getLanguages=function(e){return e.languages},x=t.getOptions=function(e){return e.options},T=t.getActiveLanguage=function(e){return O(e).filter(function(e){return!0===e.active})[0]},j=t.translationsEqualSelector=(0,d.createSelectorCreator)(d.defaultMemoize,function(e,t){var n="object"===(void 0===e?"undefined":c(e))?Object.keys(e).toString():void 0,r="object"===(void 0===t?"undefined":c(t))?Object.keys(t).toString():void 0,o="object"===(void 0===e?"undefined":c(e))?(0,p.objectValuesToString)(e):void 0,a="object"===(void 0===t?"undefined":c(t))?(0,p.objectValuesToString)(t):void 0;return(void 0!==n&&void 0!==o?n+" - "+o:e)===(void 0!==r&&void 0!==a?r+" - "+a:t)}),S=t.getTranslationsForActiveLanguage=j(T,O,w,p.getTranslationsForLanguage),_=t.getTranslationsForSpecificLanguage=j(O,w,function(e,t){return(0,d.defaultMemoize)(function(n){return(0,p.getTranslationsForLanguage)({code:n,active:!1},e,t)})}),k=(0,d.createSelector)(S,_,T,x,function(e,t,n,a){return function(i){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=(a.defaultLanguage,a.translationTransform,o(a,["defaultLanguage","translationTransform"])),f=c.language,d=void 0!==f?t(f):e,h=n&&n.code===a.defaultLanguage?e:void 0!==a.defaultLanguage?t(a.defaultLanguage):{},g=void 0!==f?f:n&&n.code,v=function(e){return y.onMissingTranslation({translationId:e,languageCode:g,defaultTranslation:h[e]})},y=l({},s,c),b=y.renderInnerHtml,m={translations:d,data:u,languageCode:g,renderInnerHtml:b,onMissingTranslation:v};if("string"==typeof i)return(0,p.getLocalizedElement)(l({translationId:i},m));if(Array.isArray(i))return i.reduce(function(e,t){return l({},e,r({},t,(0,p.getLocalizedElement)(l({translationId:t},m))))},{});throw new Error("react-localize-redux: Invalid key passed to getTranslate.")}});t.getTranslate=k},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.LocalizeContext=t.getContextPropsFromState=void 0;var o=n(0),a=(r(o),n(20)),i=r(a),u=n(15),c=n(1),l=function(e){return function(t){return e((0,c.initialize)(t))}},s=function(e){return function(t){return e((0,c.addTranslation)(t))}},f=function(e){return function(t,n){return e((0,c.addTranslationForLanguage)(t,n))}},d=function(e){return function(t){return e((0,c.setActiveLanguage)(t))}},p=t.getContextPropsFromState=function(e){return(0,u.createSelector)(c.getTranslate,c.getLanguages,c.getActiveLanguage,c.getOptions,function(t,n,r,o){return{translate:t,languages:n,defaultLanguage:o.defaultLanguage||n[0]&&n[0].code,activeLanguage:r,initialize:l(e),addTranslation:s(e),addTranslationForLanguage:f(e),setActiveLanguage:d(e)}})},h=(0,c.localizeReducer)(void 0,{}),g=p(function(){})(h);t.LocalizeContext=(0,i.default)(g)},function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(t,"__esModule",{value:!0}),t.warning=t.getSingleToMultilanguageTranslation=t.storeDidChange=t.getTranslationsForLanguage=t.validateOptions=t.objectValuesToString=t.getIndexForLanguageCode=t.templater=t.hasHtmlTags=t.getLocalizedElement=void 0;var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a=n(0),i=function(e){return e&&e.__esModule?e:{default:e}}(a);n(5);var u=(n(8),n(1),t.getLocalizedElement=function(e){var t=e.translationId,n=e.translations,r=e.data,o=e.renderInnerHtml,a=e.onMissingTranslation,l=n[t]||a(t),s=n[t]?r:{translationId:e.translationId,languageCode:e.languageCode},f=c(l,s);return!0===o&&u(f)?i.default.createElement("span",{dangerouslySetInnerHTML:{__html:f}}):f},t.hasHtmlTags=function(e){var t=/(&[^\s]*;|<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[\^'">\s]+))?)+\s*|\s*)\/?>)/;return e.search(t)>=0}),c=t.templater=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for(var n in t){var r="\\${\\s*"+n+"\\s*}",o=new RegExp(r,"gmi");e=e.replace(o,t[n])}return e},l=t.getIndexForLanguageCode=function(e,t){return t.map(function(e){return e.code}).indexOf(e)};t.objectValuesToString=function(e){return Object.values?Object.values(e).toString():Object.keys(e).map(function(t){return e[t].toString()}).toString()},t.validateOptions=function(e){if(void 0!==e.translationTransform&&"function"!=typeof e.translationTransform)throw new Error("react-localize-redux: an invalid translationTransform function was provided.");if(void 0!==e.onMissingTranslation&&"function"!=typeof e.onMissingTranslation)throw new Error("react-localize-redux: an invalid onMissingTranslation function was provided.");return e},t.getTranslationsForLanguage=function(e,t,n){if(!e)return{};var a=e.code,i=l(a,t);return Object.keys(n).reduce(function(e,t){return o({},e,r({},t,n[t][i]))},{})},t.storeDidChange=function(e,t){function n(){var n=e.getState();n!==r&&(t(r),r=n)}var r=void 0,o=e.subscribe(n);return n(),o},t.getSingleToMultilanguageTranslation=function(e,t,n,a){var i=t.indexOf(e),u=i>=0?n:{};return Object.keys(u).reduce(function(e,u){var c=t.map(function(e,t){var r=a[u]||[];return t===i?n[u]:r[t]});return o({},e,r({},u,c))},{})},t.warning=function(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(e){}}},function(e,t,n){"use strict";function r(e){return function(){return e}}var o=function(){};o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(13),o=n(44),a=n(43),i=n(42),u=n(12);n(14);n.d(t,"createStore",function(){return r.a}),n.d(t,"combineReducers",function(){return o.a}),n.d(t,"bindActionCreators",function(){return a.a}),n.d(t,"applyMiddleware",function(){return i.a}),n.d(t,"compose",function(){return u.a})},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";function r(e){return function(t){return i.default.createElement(u.LocalizeContext.Consumer,null,function(n){return i.default.createElement(e,o({},n,t))})}}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.withLocalize=r;var a=n(0),i=function(e){return e&&e.__esModule?e:{default:e}}(a),u=n(2)},function(e,t,n){function r(e,t){function n(e,u,c){c=c||1,Object.keys(e).forEach(function(l){var s=e[l],f=t.safe&&Array.isArray(s),d=Object.prototype.toString.call(s),p=a(s),h="[object Object]"===d||"[object Array]"===d,g=u?u+r+l:l;if(!f&&!p&&h&&Object.keys(s).length&&(!t.maxDepth||c<o))return n(s,g,c+1);i[g]=s})}t=t||{};var r=t.delimiter||".",o=t.maxDepth,i={};return n(e),i}function o(e,t){function n(e){var t=Number(e);return isNaN(t)||-1!==e.indexOf(".")?e:t}t=t||{};var r=t.delimiter||".",i=t.overwrite||!1,u={};return a(e)||"[object Object]"!==Object.prototype.toString.call(e)?e:(Object.keys(e).forEach(function(a){for(var c=a.split(r),l=n(c.shift()),s=n(c[0]),f=u;void 0!==s;){var d=Object.prototype.toString.call(f[l]),p="[object Object]"===d||"[object Array]"===d;if(!i&&!p&&void 0!==f[l])return;(i&&!p||!i&&null==f[l])&&(f[l]="number"!=typeof s||t.object?{}:[]),f=f[l],c.length>0&&(l=n(c.shift()),s=n(c[0]))}f[l]=o(e[a],t)}),u)}var a=n(28);e.exports=r;r.flatten=r,r.unflatten=o},function(e,t,n){"use strict";var r=n(35),o=r.a.Symbol;t.a=o},function(e,t,n){"use strict";function r(e){if(!n.i(i.a)(e)||n.i(o.a)(e)!=u)return!1;var t=n.i(a.a)(e);if(null===t)return!0;var r=f.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&s.call(r)==d}var o=n(29),a=n(31),i=n(36),u="[object Object]",c=Function.prototype,l=Object.prototype,s=c.toString,f=l.hasOwnProperty,d=s.call(Object);t.a=r},function(e,t,n){e.exports=n(38)()},function(e,t,n){"use strict";function r(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce(function(e,t){return function(){return e(t.apply(void 0,arguments))}})}t.a=r},function(e,t,n){"use strict";function r(e,t,a){function c(){b===y&&(b=y.slice())}function l(){return v}function s(e){if("function"!=typeof e)throw new Error("Expected listener to be a function.");var t=!0;return c(),b.push(e),function(){if(t){t=!1,c();var n=b.indexOf(e);b.splice(n,1)}}}function f(e){if(!n.i(o.a)(e))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===e.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(m)throw new Error("Reducers may not dispatch actions.");try{m=!0,v=g(v,e)}finally{m=!1}for(var t=y=b,r=0;r<t.length;r++){(0,t[r])()}return e}function d(e){if("function"!=typeof e)throw new Error("Expected the nextReducer to be a function.");g=e,f({type:u.INIT})}function p(){var e,t=s;return e={subscribe:function(e){function n(){e.next&&e.next(l())}if("object"!=typeof e)throw new TypeError("Expected the observer to be an object.");return n(),{unsubscribe:t(n)}}},e[i.a]=function(){return this},e}var h;if("function"==typeof t&&void 0===a&&(a=t,t=void 0),void 0!==a){if("function"!=typeof a)throw new Error("Expected the enhancer to be a function.");return a(r)(e,t)}if("function"!=typeof e)throw new Error("Expected the reducer to be a function.");var g=e,v=t,y=[],b=y,m=!1;return f({type:u.INIT}),h={dispatch:f,subscribe:s,getState:l,replaceReducer:d},h[i.a]=p,h}n.d(t,"b",function(){return u}),t.a=r;var o=n(10),a=n(45),i=n.n(a),u={INIT:"@@redux/INIT"}},function(e,t,n){"use strict"},function(e,t,n){"use strict";function r(e,t){return e===t}function o(e,t,n){if(null===t||null===n||t.length!==n.length)return!1;for(var r=t.length,o=0;o<r;o++)if(!e(t[o],n[o]))return!1;return!0}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r,n=null,a=null;return function(){return o(t,n,arguments)||(a=e.apply(null,arguments)),n=arguments,a}}function i(e){var t=Array.isArray(e[0])?e[0]:e;if(!t.every(function(e){return"function"==typeof e})){var n=t.map(function(e){return typeof e}).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, instead received the following types: ["+n+"]")}return t}function u(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return function(){for(var t=arguments.length,r=Array(t),o=0;o<t;o++)r[o]=arguments[o];var u=0,c=r.pop(),l=i(r),s=e.apply(void 0,[function(){return u++,c.apply(null,arguments)}].concat(n)),f=a(function(){for(var e=[],t=l.length,n=0;n<t;n++)e.push(l[n].apply(null,arguments));return s.apply(null,e)});return f.resultFunc=c,f.recomputations=function(){return u},f.resetRecomputations=function(){return u=0},f}}function c(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l;if("object"!=typeof e)throw new Error("createStructuredSelector expects first argument to be an object where each property is a selector, instead received a "+typeof e);var n=Object.keys(e);return t(n.map(function(t){return e[t]}),function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.reduce(function(e,t,r){return e[n[r]]=t,e},{})})}t.__esModule=!0,t.defaultMemoize=a,t.createSelectorCreator=u,t.createStructuredSelector=c;var l=t.createSelector=u(a)},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.LocalizeProvider=void 0;var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(0),c=function(e){return e&&e.__esModule?e:{default:e}}(u);n(5);var l=n(1),s=n(2),f=n(3);t.LocalizeProvider=function(e){function t(e){r(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),a=n.props.store?n.props.store.dispatch:n.dispatch.bind(n);return n.getContextPropsSelector=(0,s.getContextPropsFromState)(a),n.state={localize:(0,l.localizeReducer)(void 0,{})},n}return a(t,e),i(t,[{key:"componentDidMount",value:function(){this.props.store&&(this.unsubscribeFromStore=(0,f.storeDidChange)(this.props.store,this.onStateDidChange.bind(this)))}},{key:"componentWillUnmount",value:function(){this.unsubscribeFromStore&&this.unsubscribeFromStore()}},{key:"onStateDidChange",value:function(e){if(this.props.store){var t=e&&e.localize,n=this.props.store.getState().localize,r=e&&(0,l.getActiveLanguage)(t),o=(0,l.getActiveLanguage)(n),a=e&&(0,l.getOptions)(t),i=(0,l.getOptions)(n),u=e&&(0,l.getTranslationsForActiveLanguage)(t),c=(0,l.getTranslationsForActiveLanguage)(n),s=(r&&r.code)!==(o&&o.code),f=a!==i,d=u!==c;(s||f||d)&&this.setState({localize:n})}}},{key:"dispatch",value:function(e){console.log("action",e),this.setState(function(t){return{localize:(0,l.localizeReducer)(t.localize,e)}})}},{key:"render",value:function(){return this.contextProps=this.getContextPropsSelector(this.state.localize),c.default.createElement(s.LocalizeContext.Provider,{value:this.contextProps},this.props.children)}}],[{key:"getDerivedStateFromProps",value:function(e,t){return null}}]),t}(u.Component)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.Translate=void 0;var c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(0),s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(l),f=n(41),d=r(f),p=n(11),h=(r(p),n(1),n(3),n(2));n(7),t.Translate=function(e){function t(e){a(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={hasAddedDefaultTranslation:!1},n}return u(t,e),c(t,[{key:"componentDidMount",value:function(){this.setState({hasAddedDefaultTranslation:!0})}},{key:"addDefaultTranslation",value:function(e){if(!this.state.hasAddedDefaultTranslation){var t=this.props,n=t.id,r=t.children,a=t.options,i=void 0===a?{}:a,u=i.language||e.defaultLanguage;if(void 0!==r&&"function"!=typeof r&&!i.ignoreTranslateChildren&&void 0!==n&&void 0!==u){var c=d.default.renderToStaticMarkup(r);e.addTranslationForLanguage&&e.addTranslationForLanguage(o({},n,c),u)}}}},{key:"renderChildren",value:function(e){var t=this.props,n=t.id,r=void 0===n?"":n,o=t.options,a=t.data;return this.addDefaultTranslation(e),"function"==typeof this.props.children?this.props.children(e):e.translate&&e.translate(r,a,o)}},{key:"render",value:function(){var e=this;return s.createElement(h.LocalizeContext.Consumer,null,function(t){return e.renderChildren(t)})}}]),t}(s.Component)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(17);Object.defineProperty(t,"Translate",{enumerable:!0,get:function(){return r.Translate}});var o=n(7);Object.defineProperty(t,"withLocalize",{enumerable:!0,get:function(){return o.withLocalize}});var a=n(16);Object.defineProperty(t,"LocalizeProvider",{enumerable:!0,get:function(){return a.LocalizeProvider}});var i=n(2);Object.defineProperty(t,"LocalizeContext",{enumerable:!0,get:function(){return i.LocalizeContext}});var u=n(1);Object.defineProperty(t,"localizeReducer",{enumerable:!0,get:function(){return u.localizeReducer}}),Object.defineProperty(t,"initialize",{enumerable:!0,get:function(){return u.initialize}}),Object.defineProperty(t,"addTranslation",{enumerable:!0,get:function(){return u.addTranslation}}),Object.defineProperty(t,"addTranslationForLanguage",{enumerable:!0,get:function(){return u.addTranslationForLanguage}}),Object.defineProperty(t,"setActiveLanguage",{enumerable:!0,get:function(){return u.setActiveLanguage}}),Object.defineProperty(t,"getTranslate",{enumerable:!0,get:function(){return u.getTranslate}}),Object.defineProperty(t,"getActiveLanguage",{enumerable:!0,get:function(){return u.getActiveLanguage}}),Object.defineProperty(t,"getLanguages",{enumerable:!0,get:function(){return u.getLanguages}}),Object.defineProperty(t,"getTranslations",{enumerable:!0,get:function(){return u.getTranslations}}),Object.defineProperty(t,"getOptions",{enumerable:!0,get:function(){return u.getOptions}})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function u(e,t){return e===t?0!==e||1/e==1/t:e!==e&&t!==t}function c(e){var t=[];return{on:function(e){t.push(e)},off:function(e){t=t.filter(function(t){return t!==e})},get:function(){return e},set:function(n,r){e=n,t.forEach(function(t){return t(e,r)})}}}function l(e){return Array.isArray(e)?e[0]:e}function s(e,t){var n,r,s="__create-react-context-"+(0,g.default)()+"__",d=function(e){function n(){var t,r,i;o(this,n);for(var u=arguments.length,l=Array(u),s=0;s<u;s++)l[s]=arguments[s];return t=r=a(this,e.call.apply(e,[this].concat(l))),r.emitter=c(r.props.value),i=t,a(r,i)}return i(n,e),n.prototype.getChildContext=function(){var e;return e={},e[s]=this.emitter,e},n.prototype.componentWillReceiveProps=function(e){if(this.props.value!==e.value){var n=this.props.value,r=e.value,o=void 0;u(n,r)?o=0:(o="function"==typeof t?t(n,r):y,0!==(o|=0)&&this.emitter.set(e.value,o))}},n.prototype.render=function(){return this.props.children},n}(f.Component);d.childContextTypes=(n={},n[s]=p.default.object.isRequired,n);var h=function(t){function n(){var e,r,i;o(this,n);for(var u=arguments.length,c=Array(u),l=0;l<u;l++)c[l]=arguments[l];return e=r=a(this,t.call.apply(t,[this].concat(c))),r.state={value:r.getValue()},r.onUpdate=function(e,t){0!=((0|r.observedBits)&t)&&r.setState({value:r.getValue()})},i=e,a(r,i)}return i(n,t),n.prototype.componentWillReceiveProps=function(e){var t=e.observedBits;this.observedBits=void 0===t||null===t?y:t},n.prototype.componentDidMount=function(){this.context[s]&&this.context[s].on(this.onUpdate);var e=this.props.observedBits;this.observedBits=void 0===e||null===e?y:e},n.prototype.componentWillUnmount=function(){this.context[s]&&this.context[s].off(this.onUpdate)},n.prototype.getValue=function(){return this.context[s]?this.context[s].get():e},n.prototype.render=function(){return l(this.props.children)(this.state.value)},n}(f.Component);return h.contextTypes=(r={},r[s]=p.default.object,r),{Provider:d,Consumer:h}}t.__esModule=!0;var f=n(0),d=(r(f),n(11)),p=r(d),h=n(27),g=r(h),v=n(26),y=(r(v),1073741823);t.default=s,e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=n(0),a=r(o),i=n(19),u=r(i);t.default=a.default.createContext||u.default,e.exports=t.default},function(e,t,n){"use strict";var r={};e.exports=r},function(e,t,n){"use strict";function r(e){return e.replace(o,"-$1").toLowerCase()}var o=/([A-Z])/g;e.exports=r},function(e,t,n){"use strict";function r(e){return o(e).replace(a,"-ms-")}var o=n(22),a=/^ms-/;e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r,a,i,u,c){if(o(t),!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var s=[n,r,a,i,u,c],f=0;l=new Error(t.replace(/%s/g,function(){return s[f++]})),l.name="Invariant Violation"}throw l.framesToPop=1,l}}var o=function(e){};e.exports=r},function(e,t,n){"use strict";function r(e){var t={};return function(n){return t.hasOwnProperty(n)||(t[n]=e.call(this,n)),t[n]}}e.exports=r},function(e,t,n){"use strict";var r=n(4),o=r;e.exports=o},function(e,t,n){"use strict";(function(t){var n="__global_unique_id__";e.exports=function(){return t[n]=(t[n]||0)+1}}).call(t,n(6))},function(e,t){function n(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function r(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&n(e.slice(0,0))}/*! | ||
* Determine if an object is a Buffer | ||
@@ -7,3 +7,3 @@ * | ||
*/ | ||
e.exports=function(e){return null!=e&&(n(e)||r(e)||!!e._isBuffer)}},function(e,t,n){"use strict";function r(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}/* | ||
e.exports=function(e){return null!=e&&(n(e)||r(e)||!!e._isBuffer)}},function(e,t,n){"use strict";function r(e){return null==e?void 0===e?c:u:l&&l in Object(e)?n.i(a.a)(e):n.i(i.a)(e)}var o=n(9),a=n(32),i=n(33),u="[object Null]",c="[object Undefined]",l=o.a?o.a.toStringTag:void 0;t.a=r},function(e,t,n){"use strict";(function(e){var n="object"==typeof e&&e&&e.Object===Object&&e;t.a=n}).call(t,n(6))},function(e,t,n){"use strict";var r=n(34),o=n.i(r.a)(Object.getPrototypeOf,Object);t.a=o},function(e,t,n){"use strict";function r(e){var t=i.call(e,c),n=e[c];try{e[c]=void 0;var r=!0}catch(e){}var o=u.call(e);return r&&(t?e[c]=n:delete e[c]),o}var o=n(9),a=Object.prototype,i=a.hasOwnProperty,u=a.toString,c=o.a?o.a.toStringTag:void 0;t.a=r},function(e,t,n){"use strict";function r(e){return a.call(e)}var o=Object.prototype,a=o.toString;t.a=r},function(e,t,n){"use strict";function r(e,t){return function(n){return e(t(n))}}t.a=r},function(e,t,n){"use strict";var r=n(30),o="object"==typeof self&&self&&self.Object===Object&&self,a=r.a||o||Function("return this")();t.a=a},function(e,t,n){"use strict";function r(e){return null!=e&&"object"==typeof e}t.a=r},function(e,t,n){"use strict";function r(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}/* | ||
object-assign | ||
@@ -13,3 +13,3 @@ (c) Sindre Sorhus | ||
*/ | ||
var o=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,u,l=r(e),c=1;c<arguments.length;c++){n=Object(arguments[c]);for(var s in n)a.call(n,s)&&(l[s]=n[s]);if(o){u=o(n);for(var f=0;f<u.length;f++)i.call(n,u[f])&&(l[u[f]]=n[u[f]])}}return l}},function(e,t,n){"use strict";var r=n(3),o=n(10),a=n(17);e.exports=function(){function e(e,t,n,r,i,u){u!==a&&o(!1,"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")}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return n.checkPropTypes=r,n.PropTypes=n,n}},function(e,t,n){e.exports=n(15)()},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";function r(e){for(var t=arguments.length-1,n="Minified React error #"+e+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant="+e,r=0;r<t;r++)n+="&args[]="+encodeURIComponent(arguments[r+1]);throw t=Error(n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."),t.name="Invariant Violation",t.framesToPop=1,t}function o(e){return!!I.hasOwnProperty(e)||!P.hasOwnProperty(e)&&(C.test(e)?I[e]=!0:(P[e]=!0,!1))}function a(e,t,n,r){if(null!==n&&0===n.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!r&&(null!==n?!n.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}function i(e,t,n,r){if(null===t||void 0===t||a(e,t,n,r))return!0;if(null!==n)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function u(e,t,n,r,o){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t}function l(e){return e[1].toUpperCase()}function c(e){if("boolean"==typeof e||"number"==typeof e)return""+e;e=""+e;var t=R.exec(e);if(t){var n,r="",o=0;for(n=t.index;n<e.length;n++){switch(e.charCodeAt(n)){case 34:t=""";break;case 38:t="&";break;case 39:t="'";break;case 60:t="<";break;case 62:t=">";break;default:continue}o!==n&&(r+=e.substring(o,n)),o=n+1,r+=t}e=o!==n?r+e.substring(o,n):r}return e}function s(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function f(e){return"string"==typeof e?e:"function"==typeof e?e.displayName||e.name:null}function p(e){var t="";return v.Children.forEach(e,function(e){null==e||"string"!=typeof e&&"number"!=typeof e||(t+=e)}),t}function d(e,t){if(e=e.contextTypes){var n,r={};for(n in e)r[n]=t[n];t=r}else t=b;return t}function g(e,t){void 0===e&&r("152",f(t)||"Component")}function h(e,t){for(;v.isValidElement(e);){var n=e,o=n.type;if("function"!=typeof o)break;!function(n,o){var a=d(o,t),i=[],u=!1,l={isMounted:function(){return!1},enqueueForceUpdate:function(){if(null===i)return null},enqueueReplaceState:function(e,t){u=!0,i=[t]},enqueueSetState:function(e,t){if(null===i)return null;i.push(t)}},c=void 0;if(o.prototype&&o.prototype.isReactComponent){if(c=new o(n.props,a,l),"function"==typeof o.getDerivedStateFromProps){var s=o.getDerivedStateFromProps.call(null,n.props,c.state);null!=s&&(c.state=y({},c.state,s))}}else if(null==(c=o(n.props,a,l))||null==c.render)return e=c,void g(e,o);if(c.props=n.props,c.context=a,c.updater=l,l=c.state,void 0===l&&(c.state=l=null),"function"==typeof c.UNSAFE_componentWillMount||"function"==typeof c.componentWillMount)if("function"==typeof c.componentWillMount&&"function"!=typeof o.getDerivedStateFromProps&&c.componentWillMount(),"function"==typeof c.UNSAFE_componentWillMount&&"function"!=typeof o.getDerivedStateFromProps&&c.UNSAFE_componentWillMount(),i.length){l=i;var p=u;if(i=null,u=!1,p&&1===l.length)c.state=l[0];else{s=p?l[0]:c.state;var h=!0;for(p=p?1:0;p<l.length;p++){var v=l[p];null!=(v="function"==typeof v?v.call(c,s,n.props,a):v)&&(h?(h=!1,s=y({},s,v)):y(s,v))}c.state=s}}else i=null;if(e=c.render(),g(e,o),n=void 0,"function"==typeof c.getChildContext&&"object"==typeof(a=o.childContextTypes)){n=c.getChildContext();for(var m in n)m in a||r("108",f(o)||"Unknown",m)}n&&(t=y({},t,n))}(n,o)}return{child:e,context:t}}/** @license React v16.3.1 | ||
var o=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,u,c=r(e),l=1;l<arguments.length;l++){n=Object(arguments[l]);for(var s in n)a.call(n,s)&&(c[s]=n[s]);if(o){u=o(n);for(var f=0;f<u.length;f++)i.call(n,u[f])&&(c[u[f]]=n[u[f]])}}return c}},function(e,t,n){"use strict";var r=n(4),o=n(24),a=n(39);e.exports=function(){function e(e,t,n,r,i,u){u!==a&&o(!1,"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")}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return n.checkPropTypes=r,n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";function r(e){for(var t=arguments.length-1,n="Minified React error #"+e+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant="+e,r=0;r<t;r++)n+="&args[]="+encodeURIComponent(arguments[r+1]);throw t=Error(n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."),t.name="Invariant Violation",t.framesToPop=1,t}function o(e){return!!I.hasOwnProperty(e)||!F.hasOwnProperty(e)&&(P.test(e)?I[e]=!0:(F[e]=!0,!1))}function a(e,t,n,r){if(null!==n&&0===n.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!r&&(null!==n?!n.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}function i(e,t,n,r){if(null===t||void 0===t||a(e,t,n,r))return!0;if(null!==n)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function u(e,t,n,r,o){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t}function c(e){return e[1].toUpperCase()}function l(e){if("boolean"==typeof e||"number"==typeof e)return""+e;e=""+e;var t=z.exec(e);if(t){var n,r="",o=0;for(n=t.index;n<e.length;n++){switch(e.charCodeAt(n)){case 34:t=""";break;case 38:t="&";break;case 39:t="'";break;case 60:t="<";break;case 62:t=">";break;default:continue}o!==n&&(r+=e.substring(o,n)),o=n+1,r+=t}e=o!==n?r+e.substring(o,n):r}return e}function s(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function f(e){return"string"==typeof e?e:"function"==typeof e?e.displayName||e.name:null}function d(e){var t="";return y.Children.forEach(e,function(e){null==e||"string"!=typeof e&&"number"!=typeof e||(t+=e)}),t}function p(e,t){if(e=e.contextTypes){var n,r={};for(n in e)r[n]=t[n];t=r}else t=m;return t}function h(e,t){void 0===e&&r("152",f(t)||"Component")}function g(e,t){for(;y.isValidElement(e);){var n=e,o=n.type;if("function"!=typeof o)break;!function(n,o){var a=p(o,t),i=[],u=!1,c={isMounted:function(){return!1},enqueueForceUpdate:function(){if(null===i)return null},enqueueReplaceState:function(e,t){u=!0,i=[t]},enqueueSetState:function(e,t){if(null===i)return null;i.push(t)}},l=void 0;if(o.prototype&&o.prototype.isReactComponent){if(l=new o(n.props,a,c),"function"==typeof o.getDerivedStateFromProps){var s=o.getDerivedStateFromProps.call(null,n.props,l.state);null!=s&&(l.state=v({},l.state,s))}}else if(null==(l=o(n.props,a,c))||null==l.render)return e=l,void h(e,o);if(l.props=n.props,l.context=a,l.updater=c,c=l.state,void 0===c&&(l.state=c=null),"function"==typeof l.UNSAFE_componentWillMount||"function"==typeof l.componentWillMount)if("function"==typeof l.componentWillMount&&"function"!=typeof o.getDerivedStateFromProps&&l.componentWillMount(),"function"==typeof l.UNSAFE_componentWillMount&&"function"!=typeof o.getDerivedStateFromProps&&l.UNSAFE_componentWillMount(),i.length){c=i;var d=u;if(i=null,u=!1,d&&1===c.length)l.state=c[0];else{s=d?c[0]:l.state;var g=!0;for(d=d?1:0;d<c.length;d++){var y=c[d];null!=(y="function"==typeof y?y.call(l,s,n.props,a):y)&&(g?(g=!1,s=v({},s,y)):v(s,y))}l.state=s}}else i=null;if(e=l.render(),h(e,o),n=void 0,"function"==typeof l.getChildContext&&"object"==typeof(a=o.childContextTypes)){n=l.getChildContext();for(var b in n)b in a||r("108",f(o)||"Unknown",b)}n&&(t=v({},t,n))}(n,o)}return{child:e,context:t}}/** @license React v16.3.1 | ||
* react-dom-server.browser.production.min.js | ||
@@ -22,2 +22,2 @@ * | ||
*/ | ||
var y=n(14),v=n(0),m=n(3),b=n(7),w=n(9),x=n(11),S="function"==typeof Symbol&&Symbol.for,O=S?Symbol.for("react.call"):60104,T=S?Symbol.for("react.return"):60105,k=S?Symbol.for("react.portal"):60106,j=S?Symbol.for("react.fragment"):60107,L=S?Symbol.for("react.strict_mode"):60108,A=S?Symbol.for("react.provider"):60109,E=S?Symbol.for("react.context"):60110,_=S?Symbol.for("react.async_mode"):60111,F=S?Symbol.for("react.forward_ref"):60112,C=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,P={},I={},N={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){N[e]=new u(e,0,!1,e,null)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];N[t]=new u(t,1,!1,e[1],null)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){N[e]=new u(e,2,!1,e.toLowerCase(),null)}),["autoReverse","externalResourcesRequired","preserveAlpha"].forEach(function(e){N[e]=new u(e,2,!1,e,null)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){N[e]=new u(e,3,!1,e.toLowerCase(),null)}),["checked","multiple","muted","selected"].forEach(function(e){N[e]=new u(e,3,!0,e.toLowerCase(),null)}),["capture","download"].forEach(function(e){N[e]=new u(e,4,!1,e.toLowerCase(),null)}),["cols","rows","size","span"].forEach(function(e){N[e]=new u(e,6,!1,e.toLowerCase(),null)}),["rowSpan","start"].forEach(function(e){N[e]=new u(e,5,!1,e.toLowerCase(),null)});var M=/[\-\:]([a-z])/g;"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(M,l);N[t]=new u(t,1,!1,e,null)}),"xlink:actuate xlink:arcrole xlink:href xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(M,l);N[t]=new u(t,1,!1,e,"http://www.w3.org/1999/xlink")}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(M,l);N[t]=new u(t,1,!1,e,"http://www.w3.org/XML/1998/namespace")}),N.tabIndex=new u("tabIndex",1,!1,"tabindex",null);var R=/["'&<>]/,D={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"},z={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},V=y({menuitem:!0},z),U={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},q=["Webkit","ms","Moz","O"];Object.keys(U).forEach(function(e){q.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),U[t]=U[e]})});var G=v.Children.toArray,W=m.thatReturns("");m.thatReturns("");var H={listing:!0,pre:!0,textarea:!0},$=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,Z={},B=x(function(e){return w(e)}),K={children:null,dangerouslySetInnerHTML:null,suppressContentEditableWarning:null,suppressHydrationWarning:null},X=function(){function e(t,n){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");v.isValidElement(t)?t.type!==j?t=[t]:(t=t.props.children,t=v.isValidElement(t)?[t]:G(t)):t=G(t),this.stack=[{type:null,domNamespace:D.html,children:t,childIndex:0,context:b,footer:""}],this.exhausted=!1,this.currentSelectValue=null,this.previousWasTextNode=!1,this.makeStaticMarkup=n,this.providerStack=[],this.providerIndex=-1}return e.prototype.pushProvider=function(e){this.providerIndex+=1,this.providerStack[this.providerIndex]=e,e.type._context._currentValue=e.props.value},e.prototype.popProvider=function(e){this.providerStack[this.providerIndex]=null,--this.providerIndex,e=e.type._context,e._currentValue=0>this.providerIndex?e._defaultValue:this.providerStack[this.providerIndex].props.value},e.prototype.read=function(e){if(this.exhausted)return null;for(var t="";t.length<e;){if(0===this.stack.length){this.exhausted=!0;break}var n=this.stack[this.stack.length-1];if(n.childIndex>=n.children.length){var r=n.footer;t+=r,""!==r&&(this.previousWasTextNode=!1),this.stack.pop(),"select"===n.type?this.currentSelectValue=null:null!=n.type&&null!=n.type.type&&n.type.type.$$typeof===A&&this.popProvider(n.type)}else r=n.children[n.childIndex++],t+=this.render(r,n.context,n.domNamespace)}return t},e.prototype.render=function(e,t,n){if("string"==typeof e||"number"==typeof e)return""===(n=""+e)?"":this.makeStaticMarkup?c(n):this.previousWasTextNode?"\x3c!-- --\x3e"+c(n):(this.previousWasTextNode=!0,c(n));if(t=h(e,t),e=t.child,t=t.context,null===e||!1===e)return"";if(!v.isValidElement(e)){if(null!=e&&null!=e.$$typeof){var o=e.$$typeof;o===k&&r("257"),r("258",o.toString())}return e=G(e),this.stack.push({type:null,domNamespace:n,children:e,childIndex:0,context:t,footer:""}),""}if("string"==typeof(o=e.type))return this.renderDOM(e,t,n);switch(o){case L:case _:case j:return e=G(e.props.children),this.stack.push({type:null,domNamespace:n,children:e,childIndex:0,context:t,footer:""}),"";case O:case T:r("259")}if("object"==typeof o&&null!==o)switch(o.$$typeof){case F:return e=G(o.render(e.props,e.ref)),this.stack.push({type:null,domNamespace:n,children:e,childIndex:0,context:t,footer:""}),"";case A:return o=G(e.props.children),n={type:e,domNamespace:n,children:o,childIndex:0,context:t,footer:""},this.pushProvider(e),this.stack.push(n),"";case E:return o=G(e.props.children(e.type._currentValue)),this.stack.push({type:e,domNamespace:n,children:o,childIndex:0,context:t,footer:""}),""}r("130",null==o?o:typeof o,"")},e.prototype.renderDOM=function(e,t,n){var a=e.type.toLowerCase();n===D.html&&s(a),Z.hasOwnProperty(a)||($.test(a)||r("65",a),Z[a]=!0);var u=e.props;if("input"===a)u=y({type:void 0},u,{defaultChecked:void 0,defaultValue:void 0,value:null!=u.value?u.value:u.defaultValue,checked:null!=u.checked?u.checked:u.defaultChecked});else if("textarea"===a){var l=u.value;if(null==l){l=u.defaultValue;var f=u.children;null!=f&&(null!=l&&r("92"),Array.isArray(f)&&(1>=f.length||r("93"),f=f[0]),l=""+f),null==l&&(l="")}u=y({},u,{value:void 0,children:""+l})}else if("select"===a)this.currentSelectValue=null!=u.value?u.value:u.defaultValue,u=y({},u,{value:void 0});else if("option"===a){f=this.currentSelectValue;var d=p(u.children);if(null!=f){var g=null!=u.value?u.value+"":d;if(l=!1,Array.isArray(f)){for(var h=0;h<f.length;h++)if(""+f[h]===g){l=!0;break}}else l=""+f===g;u=y({selected:void 0,children:void 0},u,{selected:l,children:d})}}(l=u)&&(V[a]&&(null!=l.children||null!=l.dangerouslySetInnerHTML)&&r("137",a,W()),null!=l.dangerouslySetInnerHTML&&(null!=l.children&&r("60"),"object"==typeof l.dangerouslySetInnerHTML&&"__html"in l.dangerouslySetInnerHTML||r("61")),null!=l.style&&"object"!=typeof l.style&&r("62",W())),l=u,f=this.makeStaticMarkup,d=1===this.stack.length,g="<"+e.type;for(S in l)if(l.hasOwnProperty(S)){var v=l[S];if(null!=v){if("style"===S){h=void 0;var m="",b="";for(h in v)if(v.hasOwnProperty(h)){var w=0===h.indexOf("--"),x=v[h];null!=x&&(m+=b+B(h)+":",b=h,w=null==x||"boolean"==typeof x||""===x?"":w||"number"!=typeof x||0===x||U.hasOwnProperty(b)&&U[b]?(""+x).trim():x+"px",m+=w,b=";")}v=m||null}h=null;e:if(w=a,x=l,-1===w.indexOf("-"))w="string"==typeof x.is;else switch(w){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":w=!1;break e;default:w=!0}w?K.hasOwnProperty(S)||(h=S,h=o(h)&&null!=v?h+'="'+c(v)+'"':""):(w=S,h=v,v=N.hasOwnProperty(w)?N[w]:null,(x="style"!==w)&&(x=null!==v?0===v.type:2<w.length&&("o"===w[0]||"O"===w[0])&&("n"===w[1]||"N"===w[1])),x||i(w,h,v,!1)?h="":null!==v?(w=v.attributeName,v=v.type,h=3===v||4===v&&!0===h?w+'=""':w+'="'+c(h)+'"'):h=w+'="'+c(h)+'"'),h&&(g+=" "+h)}}f||d&&(g+=' data-reactroot=""');var S=g;l="",z.hasOwnProperty(a)?S+="/>":(S+=">",l="</"+e.type+">");e:{if(null!=(f=u.dangerouslySetInnerHTML)){if(null!=f.__html){f=f.__html;break e}}else if("string"==typeof(f=u.children)||"number"==typeof f){f=c(f);break e}f=null}return null!=f?(u=[],H[a]&&"\n"===f.charAt(0)&&(S+="\n"),S+=f):u=G(u.children),e=e.type,n=null==n||"http://www.w3.org/1999/xhtml"===n?s(e):"http://www.w3.org/2000/svg"===n&&"foreignObject"===e?"http://www.w3.org/1999/xhtml":n,this.stack.push({domNamespace:n,type:a,children:u,childIndex:0,context:t,footer:l}),this.previousWasTextNode=!1,S},e}(),Y={renderToString:function(e){return new X(e,!1).read(1/0)},renderToStaticMarkup:function(e){return new X(e,!0).read(1/0)},renderToNodeStream:function(){r("207")},renderToStaticNodeStream:function(){r("208")},version:"16.3.1"},J=Object.freeze({default:Y}),Q=J&&Y||J;e.exports=Q.default?Q.default:Q},function(e,t,n){"use strict";e.exports=n(18)},function(e,t,n){"use strict";function r(e,t){return e===t}function o(e,t,n){if(null===t||null===n||t.length!==n.length)return!1;for(var r=t.length,o=0;o<r;o++)if(!e(t[o],n[o]))return!1;return!0}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r,n=null,a=null;return function(){return o(t,n,arguments)||(a=e.apply(null,arguments)),n=arguments,a}}function i(e){var t=Array.isArray(e[0])?e[0]:e;if(!t.every(function(e){return"function"==typeof e})){var n=t.map(function(e){return typeof e}).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, instead received the following types: ["+n+"]")}return t}function u(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return function(){for(var t=arguments.length,r=Array(t),o=0;o<t;o++)r[o]=arguments[o];var u=0,l=r.pop(),c=i(r),s=e.apply(void 0,[function(){return u++,l.apply(null,arguments)}].concat(n)),f=a(function(){for(var e=[],t=c.length,n=0;n<t;n++)e.push(c[n].apply(null,arguments));return s.apply(null,e)});return f.resultFunc=l,f.recomputations=function(){return u},f.resetRecomputations=function(){return u=0},f}}function l(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c;if("object"!=typeof e)throw new Error("createStructuredSelector expects first argument to be an object where each property is a selector, instead received a "+typeof e);var n=Object.keys(e);return t(n.map(function(t){return e[t]}),function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.reduce(function(e,t,r){return e[n[r]]=t,e},{})})}t.__esModule=!0,t.defaultMemoize=a,t.createSelectorCreator=u,t.createStructuredSelector=l;var c=t.createSelector=u(a)},function(e,n){e.exports=t},function(e,t){e.exports=n}])}); | ||
var v=n(37),y=n(0),b=n(4),m=n(21),w=n(23),O=n(25),x="function"==typeof Symbol&&Symbol.for,T=x?Symbol.for("react.call"):60104,j=x?Symbol.for("react.return"):60105,S=x?Symbol.for("react.portal"):60106,_=x?Symbol.for("react.fragment"):60107,k=x?Symbol.for("react.strict_mode"):60108,L=x?Symbol.for("react.provider"):60109,C=x?Symbol.for("react.context"):60110,E=x?Symbol.for("react.async_mode"):60111,A=x?Symbol.for("react.forward_ref"):60112,P=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,F={},I={},M={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){M[e]=new u(e,0,!1,e,null)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];M[t]=new u(t,1,!1,e[1],null)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){M[e]=new u(e,2,!1,e.toLowerCase(),null)}),["autoReverse","externalResourcesRequired","preserveAlpha"].forEach(function(e){M[e]=new u(e,2,!1,e,null)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){M[e]=new u(e,3,!1,e.toLowerCase(),null)}),["checked","multiple","muted","selected"].forEach(function(e){M[e]=new u(e,3,!0,e.toLowerCase(),null)}),["capture","download"].forEach(function(e){M[e]=new u(e,4,!1,e.toLowerCase(),null)}),["cols","rows","size","span"].forEach(function(e){M[e]=new u(e,6,!1,e.toLowerCase(),null)}),["rowSpan","start"].forEach(function(e){M[e]=new u(e,5,!1,e.toLowerCase(),null)});var N=/[\-\:]([a-z])/g;"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(N,c);M[t]=new u(t,1,!1,e,null)}),"xlink:actuate xlink:arcrole xlink:href xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(N,c);M[t]=new u(t,1,!1,e,"http://www.w3.org/1999/xlink")}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(N,c);M[t]=new u(t,1,!1,e,"http://www.w3.org/XML/1998/namespace")}),M.tabIndex=new u("tabIndex",1,!1,"tabindex",null);var z=/["'&<>]/,R={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"},D={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},V=v({menuitem:!0},D),U={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},W=["Webkit","ms","Moz","O"];Object.keys(U).forEach(function(e){W.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),U[t]=U[e]})});var H=y.Children.toArray,q=b.thatReturns("");b.thatReturns("");var G={listing:!0,pre:!0,textarea:!0},$=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,B={},Z=O(function(e){return w(e)}),K={children:null,dangerouslySetInnerHTML:null,suppressContentEditableWarning:null,suppressHydrationWarning:null},X=function(){function e(t,n){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");y.isValidElement(t)?t.type!==_?t=[t]:(t=t.props.children,t=y.isValidElement(t)?[t]:H(t)):t=H(t),this.stack=[{type:null,domNamespace:R.html,children:t,childIndex:0,context:m,footer:""}],this.exhausted=!1,this.currentSelectValue=null,this.previousWasTextNode=!1,this.makeStaticMarkup=n,this.providerStack=[],this.providerIndex=-1}return e.prototype.pushProvider=function(e){this.providerIndex+=1,this.providerStack[this.providerIndex]=e,e.type._context._currentValue=e.props.value},e.prototype.popProvider=function(e){this.providerStack[this.providerIndex]=null,--this.providerIndex,e=e.type._context,e._currentValue=0>this.providerIndex?e._defaultValue:this.providerStack[this.providerIndex].props.value},e.prototype.read=function(e){if(this.exhausted)return null;for(var t="";t.length<e;){if(0===this.stack.length){this.exhausted=!0;break}var n=this.stack[this.stack.length-1];if(n.childIndex>=n.children.length){var r=n.footer;t+=r,""!==r&&(this.previousWasTextNode=!1),this.stack.pop(),"select"===n.type?this.currentSelectValue=null:null!=n.type&&null!=n.type.type&&n.type.type.$$typeof===L&&this.popProvider(n.type)}else r=n.children[n.childIndex++],t+=this.render(r,n.context,n.domNamespace)}return t},e.prototype.render=function(e,t,n){if("string"==typeof e||"number"==typeof e)return""===(n=""+e)?"":this.makeStaticMarkup?l(n):this.previousWasTextNode?"\x3c!-- --\x3e"+l(n):(this.previousWasTextNode=!0,l(n));if(t=g(e,t),e=t.child,t=t.context,null===e||!1===e)return"";if(!y.isValidElement(e)){if(null!=e&&null!=e.$$typeof){var o=e.$$typeof;o===S&&r("257"),r("258",o.toString())}return e=H(e),this.stack.push({type:null,domNamespace:n,children:e,childIndex:0,context:t,footer:""}),""}if("string"==typeof(o=e.type))return this.renderDOM(e,t,n);switch(o){case k:case E:case _:return e=H(e.props.children),this.stack.push({type:null,domNamespace:n,children:e,childIndex:0,context:t,footer:""}),"";case T:case j:r("259")}if("object"==typeof o&&null!==o)switch(o.$$typeof){case A:return e=H(o.render(e.props,e.ref)),this.stack.push({type:null,domNamespace:n,children:e,childIndex:0,context:t,footer:""}),"";case L:return o=H(e.props.children),n={type:e,domNamespace:n,children:o,childIndex:0,context:t,footer:""},this.pushProvider(e),this.stack.push(n),"";case C:return o=H(e.props.children(e.type._currentValue)),this.stack.push({type:e,domNamespace:n,children:o,childIndex:0,context:t,footer:""}),""}r("130",null==o?o:typeof o,"")},e.prototype.renderDOM=function(e,t,n){var a=e.type.toLowerCase();n===R.html&&s(a),B.hasOwnProperty(a)||($.test(a)||r("65",a),B[a]=!0);var u=e.props;if("input"===a)u=v({type:void 0},u,{defaultChecked:void 0,defaultValue:void 0,value:null!=u.value?u.value:u.defaultValue,checked:null!=u.checked?u.checked:u.defaultChecked});else if("textarea"===a){var c=u.value;if(null==c){c=u.defaultValue;var f=u.children;null!=f&&(null!=c&&r("92"),Array.isArray(f)&&(1>=f.length||r("93"),f=f[0]),c=""+f),null==c&&(c="")}u=v({},u,{value:void 0,children:""+c})}else if("select"===a)this.currentSelectValue=null!=u.value?u.value:u.defaultValue,u=v({},u,{value:void 0});else if("option"===a){f=this.currentSelectValue;var p=d(u.children);if(null!=f){var h=null!=u.value?u.value+"":p;if(c=!1,Array.isArray(f)){for(var g=0;g<f.length;g++)if(""+f[g]===h){c=!0;break}}else c=""+f===h;u=v({selected:void 0,children:void 0},u,{selected:c,children:p})}}(c=u)&&(V[a]&&(null!=c.children||null!=c.dangerouslySetInnerHTML)&&r("137",a,q()),null!=c.dangerouslySetInnerHTML&&(null!=c.children&&r("60"),"object"==typeof c.dangerouslySetInnerHTML&&"__html"in c.dangerouslySetInnerHTML||r("61")),null!=c.style&&"object"!=typeof c.style&&r("62",q())),c=u,f=this.makeStaticMarkup,p=1===this.stack.length,h="<"+e.type;for(x in c)if(c.hasOwnProperty(x)){var y=c[x];if(null!=y){if("style"===x){g=void 0;var b="",m="";for(g in y)if(y.hasOwnProperty(g)){var w=0===g.indexOf("--"),O=y[g];null!=O&&(b+=m+Z(g)+":",m=g,w=null==O||"boolean"==typeof O||""===O?"":w||"number"!=typeof O||0===O||U.hasOwnProperty(m)&&U[m]?(""+O).trim():O+"px",b+=w,m=";")}y=b||null}g=null;e:if(w=a,O=c,-1===w.indexOf("-"))w="string"==typeof O.is;else switch(w){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":w=!1;break e;default:w=!0}w?K.hasOwnProperty(x)||(g=x,g=o(g)&&null!=y?g+'="'+l(y)+'"':""):(w=x,g=y,y=M.hasOwnProperty(w)?M[w]:null,(O="style"!==w)&&(O=null!==y?0===y.type:2<w.length&&("o"===w[0]||"O"===w[0])&&("n"===w[1]||"N"===w[1])),O||i(w,g,y,!1)?g="":null!==y?(w=y.attributeName,y=y.type,g=3===y||4===y&&!0===g?w+'=""':w+'="'+l(g)+'"'):g=w+'="'+l(g)+'"'),g&&(h+=" "+g)}}f||p&&(h+=' data-reactroot=""');var x=h;c="",D.hasOwnProperty(a)?x+="/>":(x+=">",c="</"+e.type+">");e:{if(null!=(f=u.dangerouslySetInnerHTML)){if(null!=f.__html){f=f.__html;break e}}else if("string"==typeof(f=u.children)||"number"==typeof f){f=l(f);break e}f=null}return null!=f?(u=[],G[a]&&"\n"===f.charAt(0)&&(x+="\n"),x+=f):u=H(u.children),e=e.type,n=null==n||"http://www.w3.org/1999/xhtml"===n?s(e):"http://www.w3.org/2000/svg"===n&&"foreignObject"===e?"http://www.w3.org/1999/xhtml":n,this.stack.push({domNamespace:n,type:a,children:u,childIndex:0,context:t,footer:c}),this.previousWasTextNode=!1,x},e}(),Y={renderToString:function(e){return new X(e,!1).read(1/0)},renderToStaticMarkup:function(e){return new X(e,!0).read(1/0)},renderToNodeStream:function(){r("207")},renderToStaticNodeStream:function(){r("208")},version:"16.3.1"},J=Object.freeze({default:Y}),Q=J&&Y||J;e.exports=Q.default?Q.default:Q},function(e,t,n){"use strict";e.exports=n(40)},function(e,t,n){"use strict";function r(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(n,r,i){var u=e(n,r,i),c=u.dispatch,l=[],s={getState:u.getState,dispatch:function(e){return c(e)}};return l=t.map(function(e){return e(s)}),c=o.a.apply(void 0,l)(u.dispatch),a({},u,{dispatch:c})}}}t.a=r;var o=n(12),a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}},function(e,t,n){"use strict";function r(e,t){return function(){return t(e.apply(void 0,arguments))}}function o(e,t){if("function"==typeof e)return r(e,t);if("object"!=typeof e||null===e)throw new Error("bindActionCreators expected an object or a function, instead received "+(null===e?"null":typeof e)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');for(var n=Object.keys(e),o={},a=0;a<n.length;a++){var i=n[a],u=e[i];"function"==typeof u&&(o[i]=r(u,t))}return o}t.a=o},function(e,t,n){"use strict";function r(e,t){var n=t&&t.type;return"Given action "+(n&&'"'+n.toString()+'"'||"an action")+', reducer "'+e+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}function o(e){Object.keys(e).forEach(function(t){var n=e[t];if(void 0===n(void 0,{type:i.b.INIT}))throw new Error('Reducer "'+t+"\" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.");if(void 0===n(void 0,{type:"@@redux/PROBE_UNKNOWN_ACTION_"+Math.random().toString(36).substring(7).split("").join(".")}))throw new Error('Reducer "'+t+"\" returned undefined when probed with a random type. Don't try to handle "+i.b.INIT+' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.')})}function a(e){for(var t=Object.keys(e),n={},a=0;a<t.length;a++){var i=t[a];"function"==typeof e[i]&&(n[i]=e[i])}var u=Object.keys(n),c=void 0;try{o(n)}catch(e){c=e}return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];if(c)throw c;for(var o=!1,a={},i=0;i<u.length;i++){var l=u[i],s=n[l],f=e[l],d=s(f,t);if(void 0===d){var p=r(l,t);throw new Error(p)}a[l]=d,o=o||d!==f}return o?a:e}}t.a=a;var i=n(13);n(10),n(14)},function(e,t,n){e.exports=n(46)},function(e,t,n){"use strict";(function(e,r){Object.defineProperty(t,"__esModule",{value:!0});var o,a=n(47),i=function(e){return e&&e.__esModule?e:{default:e}}(a);o="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:r;var u=(0,i.default)(o);t.default=u}).call(t,n(6),n(48)(e))},function(e,t,n){"use strict";function r(e){var t,n=e.Symbol;return"function"==typeof n?n.observable?t=n.observable:(t=n("observable"),n.observable=t):t="@@observable",t}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}}])}); |
import { ReactElement, ReactNode, Component as ReactComponent } from 'react'; | ||
import { Store } from 'redux'; | ||
import { ComponentClass, Component } from 'react-redux'; | ||
@@ -23,20 +24,33 @@ | ||
type MissingTranslationCallback = (key: string, languageCode: string) => any; | ||
type onMissingTranslationFunction = ({translationId: string, languageCode: string, defaultTranslation: string}) => string; | ||
export interface Options { | ||
export interface InitializeOptions { | ||
renderInnerHtml?: boolean; | ||
onMissingTranslation?: onMissingTranslationFunction; | ||
defaultLanguage?: string; | ||
showMissingTranslationMsg?: boolean; | ||
missingTranslationMsg?: string; | ||
missingTranslationCallback?: MissingTranslationCallback; | ||
translationTransform?: TransFormFunction; | ||
ignoreTranslateChildren?: boolean; | ||
} | ||
export interface LocaleState { | ||
export interface LocalizeState { | ||
languages: Language[]; | ||
translations: Translations; | ||
options: Options; | ||
options: InitializeOptions; | ||
} | ||
export interface LocalizeContextProps { | ||
translate: TranslateFunction, | ||
languages: Language[], | ||
activeLanguage: Language, | ||
defaultLanguage: string, | ||
initialize: (payload: InitializePayload) => void, | ||
addTranslation: (translation: MultipleLanguageTranslation) => void, | ||
addTranslationForLanguage: (translation: SingleLanguageTranslation, language: string) => void, | ||
setActiveLanguage: (languageCode: string) => void | ||
} | ||
export interface LocalizeProviderProps { | ||
store?: Store<any>, | ||
children: any | ||
} | ||
export interface TranslatedLanguage { | ||
@@ -56,16 +70,13 @@ [key: string]: string; | ||
export type TranslateChildFunction = ( | ||
translate: TranslateFunction, | ||
activeLanguage: Language, | ||
languages: Language[]) => any; | ||
export type TranslateChildFunction = (context: LocalizeContextProps) => any; | ||
export interface TranslateProps { | ||
id?: string; | ||
options?: Options; | ||
options?: InitializeOptions; | ||
data?: TranslatePlaceholderData; | ||
children?: any|TranslateChildFunction; | ||
children?: TranslateChildFunction; | ||
} | ||
export type TranslateValue = string|string[]; | ||
interface BaseAction<T, P> { | ||
@@ -76,7 +87,8 @@ type: T; | ||
export type TranslateFunction = (value: TranslateValue, data?: TranslatePlaceholderData, options?: Options) => LocalizedElement|LocalizedElementMap; | ||
type InitializePayload = { | ||
languages: any[], | ||
options?: Options | ||
export type TranslateFunction = (value: TranslateValue, data?: TranslatePlaceholderData, options?: InitializeOptions) => LocalizedElement|LocalizedElementMap; | ||
export type InitializePayload = { | ||
languages: Array<string|NamedLanguage>, | ||
translation?: Object, | ||
options?: InitializeOptions | ||
}; | ||
@@ -93,7 +105,2 @@ | ||
type SetLanguagesPayload = { | ||
languages: string[]|NamedLanguage[], | ||
activeLanguage?: string | ||
}; | ||
type SetActiveLanguagePayload = { | ||
@@ -103,7 +110,2 @@ languageCode: string | ||
type LocalizeProps = { | ||
currentLanguage: string, | ||
translate: TranslateFunction | ||
}; | ||
export type SingleLanguageTranslation = { | ||
@@ -119,5 +121,4 @@ [key: string]: Object | string | ||
export type AddTranslationAction = BaseAction<'@@localize/ADD_TRANSLATION', AddTranslationPayload>; | ||
export type AddTranslationForLanguageAction = BaseAction<'@@localize/ADD_TRANSLATION_FOR_LANGUGE', AddTranslationForLanguagePayload>; | ||
export type AddTranslationForLanguageAction = BaseAction<'@@localize/ADD_TRANSLATION_FOR_LANGUAGE', AddTranslationForLanguagePayload>; | ||
export type SetActiveLanguageAction = BaseAction<'@@localize/SET_ACTIVE_LANGUAGE', SetActiveLanguagePayload>; | ||
export type SetLanguagesAction = BaseAction<'@@localize/SET_LANGUAGES', SetLanguagesPayload>; | ||
@@ -130,12 +131,9 @@ export type Action = BaseAction< | ||
& SetActiveLanguagePayload | ||
& SetLanguagesPayload | ||
>; | ||
export type GetSliceStateFn = (state: Object|LocaleState) => LocaleState; | ||
export type ActionLanguageCodes = Action & { languageCodes: string[] }; | ||
export function localeReducer(state: LocaleState, action: Action): LocaleState; | ||
export function localizeReducer(state: LocalizeState, action: Action): LocalizeState; | ||
export function initialize(languages: Array<string|NamedLanguage>, options?: Options): InitializeAction; | ||
export function initialize(payload: InitializePayload): InitializeAction; | ||
@@ -146,20 +144,18 @@ export function addTranslation(translation: MultipleLanguageTranslation): AddTranslationAction; | ||
export function setLanguages(languages: Array<string|NamedLanguage>, activeLanguage?: string): SetLanguagesAction; | ||
export function setActiveLanguage(languageCode: string): SetActiveLanguageAction; | ||
export function getTranslations(state: LocaleState): Translations; | ||
export function getTranslations(state: LocalizeState): Translations; | ||
export function getLanguages(state: LocaleState): Language[]; | ||
export function getLanguages(state: LocalizeState): Language[]; | ||
export function getOptions(state: LocaleState): Options; | ||
export function getOptions(state: LocalizeState): InitializeOptions; | ||
export function getActiveLanguage(state: LocaleState): Language; | ||
export function getActiveLanguage(state: LocalizeState): Language; | ||
export function getTranslate(state: LocaleState): TranslateFunction; | ||
export function getTranslate(state: LocalizeState): TranslateFunction; | ||
export function localize(Component: Component<any>, slice?: string, getStateSlice?: GetSliceStateFn): (state: Object|LocaleState) => ComponentClass<LocalizeProps>; | ||
export function withLocalize<Props extends {}>(WrappedComponent: ReactComponent<Props>): ReactComponent<Props & LocalizeContextProps>; | ||
export function TranslateChildFunction(translate: Translate, activeLanguage: Language, languages: Language[]): ReactNode; | ||
export function TranslateChildFunction(context: LocalizeContextProps): ReactNode; | ||
export class Translate extends ReactComponent<TranslateProps> {} | ||
export default class Translate extends ReactComponent<TranslateProps> {} |
@@ -1,4 +0,7 @@ | ||
export { localize } from './Localize'; | ||
export { Translate } from './Translate'; | ||
export { withLocalize } from './withLocalize'; | ||
export { LocalizeProvider } from './LocalizeProvider'; | ||
export { LocalizeContext } from './LocalizeContext'; | ||
export { localeReducer, initialize, addTranslation, addTranslationForLanguage, setLanguages, setActiveLanguage, getTranslate, getActiveLanguage, getLanguages, getTranslations, getOptions } from './locale'; | ||
export { localizeReducer, initialize, addTranslation, addTranslationForLanguage, setActiveLanguage, getTranslate, getActiveLanguage, getLanguages, getTranslations, getOptions } from './localize'; |
@@ -14,31 +14,19 @@ var _createClass = function () { function 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
import PropTypes from 'prop-types'; | ||
import { getTranslate, addTranslationForLanguage, getLanguages, getOptions, getActiveLanguage, getTranslationsForActiveLanguage } from './locale'; | ||
import { getTranslate, addTranslationForLanguage, getLanguages, getOptions, getActiveLanguage, getTranslationsForActiveLanguage } from './localize'; | ||
import { storeDidChange } from './utils'; | ||
import { LocalizeContext } from './LocalizeContext'; | ||
import { withLocalize } from './withLocalize'; | ||
var DEFAULT_LOCALE_STATE_NAME = 'locale'; | ||
var DEFAULT_REDUX_STORE_KEY = 'store'; | ||
export var Translate = function (_React$Component) { | ||
_inherits(Translate, _React$Component); | ||
function Translate(props, context) { | ||
function Translate(props) { | ||
_classCallCheck(this, Translate); | ||
var _this = _possibleConstructorReturn(this, (Translate.__proto__ || Object.getPrototypeOf(Translate)).call(this, props, context)); | ||
var _this = _possibleConstructorReturn(this, (Translate.__proto__ || Object.getPrototypeOf(Translate)).call(this, props)); | ||
if (!_this.getStore()) { | ||
throw new Error('react-localize-redux: Unable to locate redux store in context. Ensure your app is wrapped with <Provider />.'); | ||
} | ||
if (!_this.getStateSlice().languages) { | ||
throw new Error('react-localize-redux: cannot find languages ensure you have correctly dispatched initialize action.'); | ||
} | ||
_this.state = { | ||
hasUpdated: false | ||
hasAddedDefaultTranslation: false | ||
}; | ||
_this.onStateDidChange = _this.onStateDidChange.bind(_this); | ||
_this.addDefaultTranslation(); | ||
return _this; | ||
@@ -50,40 +38,18 @@ } | ||
value: function componentDidMount() { | ||
this.unsubscribeFromStore = storeDidChange(this.getStore(), this.onStateDidChange); | ||
this.setState({ hasAddedDefaultTranslation: true }); | ||
} | ||
}, { | ||
key: 'componentWillUnmount', | ||
value: function componentWillUnmount() { | ||
this.unsubscribeFromStore(); | ||
} | ||
}, { | ||
key: 'onStateDidChange', | ||
value: function onStateDidChange(prevState) { | ||
var prevLocaleState = this.getStateSlice(prevState); | ||
var curLocaleState = this.getStateSlice(); | ||
key: 'addDefaultTranslation', | ||
value: function addDefaultTranslation(context) { | ||
if (this.state.hasAddedDefaultTranslation) { | ||
return; | ||
} | ||
var prevActiveLanguage = getActiveLanguage(prevLocaleState); | ||
var curActiveLanguage = getActiveLanguage(curLocaleState); | ||
var prevOptions = getOptions(prevLocaleState); | ||
var curOptions = getOptions(curLocaleState); | ||
var prevTranslations = getTranslationsForActiveLanguage(prevLocaleState); | ||
var curTranslations = getTranslationsForActiveLanguage(curLocaleState); | ||
var hasActiveLangaugeChanged = prevActiveLanguage.code !== curActiveLanguage.code; | ||
var hasOptionsChanged = prevOptions !== curOptions; | ||
var hasTranslationsChanged = prevTranslations !== curTranslations; | ||
if (hasActiveLangaugeChanged || hasOptionsChanged || hasTranslationsChanged) { | ||
this.setState({ hasUpdated: true }); | ||
} | ||
} | ||
}, { | ||
key: 'addDefaultTranslation', | ||
value: function addDefaultTranslation() { | ||
var locale = this.getStateSlice(); | ||
var _props = this.props, | ||
id = _props.id, | ||
children = _props.children; | ||
children = _props.children, | ||
_props$options = _props.options, | ||
options = _props$options === undefined ? {} : _props$options; | ||
var defaultLanguage = options.language || context.defaultLanguage; | ||
@@ -94,29 +60,24 @@ if (children === undefined || typeof children === 'function') { | ||
if (locale.options.ignoreTranslateChildren) { | ||
if (options.ignoreTranslateChildren) { | ||
return; | ||
} | ||
if (id !== undefined) { | ||
var store = this.getStore(); | ||
if (id !== undefined && defaultLanguage !== undefined) { | ||
var translation = ReactDOMServer.renderToStaticMarkup(children); | ||
var defaultLanguage = locale.options.defaultLanguage || locale.languages[0].code; | ||
store.dispatch(addTranslationForLanguage(_defineProperty({}, id, translation), defaultLanguage)); | ||
context.addTranslationForLanguage && context.addTranslationForLanguage(_defineProperty({}, id, translation), defaultLanguage); | ||
} | ||
} | ||
}, { | ||
key: 'getStore', | ||
value: function getStore() { | ||
var storeKey = this.context.storeKey; | ||
key: 'renderChildren', | ||
value: function renderChildren(context) { | ||
var _props2 = this.props, | ||
_props2$id = _props2.id, | ||
id = _props2$id === undefined ? '' : _props2$id, | ||
options = _props2.options, | ||
data = _props2.data; | ||
return this.context[storeKey || DEFAULT_REDUX_STORE_KEY]; | ||
} | ||
}, { | ||
key: 'getStateSlice', | ||
value: function getStateSlice(myState) { | ||
var _context = this.context, | ||
getLocaleState = _context.getLocaleState, | ||
storeKey = _context.storeKey; | ||
var state = myState || this.getStore().getState(); | ||
return getLocaleState !== undefined ? getLocaleState(state) : state[DEFAULT_LOCALE_STATE_NAME] || state; | ||
this.addDefaultTranslation(context); | ||
return typeof this.props.children === 'function' ? this.props.children(context) : context.translate && context.translate(id, data, options); | ||
} | ||
@@ -126,12 +87,11 @@ }, { | ||
value: function render() { | ||
var translateFn = getTranslate(this.getStateSlice()); | ||
var activeLanguage = getActiveLanguage(this.getStateSlice()); | ||
var languages = getLanguages(this.getStateSlice()); | ||
var _props2 = this.props, | ||
_props2$id = _props2.id, | ||
id = _props2$id === undefined ? '' : _props2$id, | ||
data = _props2.data, | ||
options = _props2.options; | ||
var _this2 = this; | ||
return typeof this.props.children === 'function' ? this.props.children(translateFn, activeLanguage, languages) : translateFn(id, data, options); | ||
return React.createElement( | ||
LocalizeContext.Consumer, | ||
null, | ||
function (context) { | ||
return _this2.renderChildren(context); | ||
} | ||
); | ||
} | ||
@@ -141,12 +101,2 @@ }]); | ||
return Translate; | ||
}(React.Component); | ||
Translate.contextTypes = { | ||
store: PropTypes.shape({ | ||
subscribe: PropTypes.func.isRequired, | ||
dispatch: PropTypes.func.isRequired, | ||
getState: PropTypes.func.isRequired | ||
}), | ||
getLocaleState: PropTypes.func, | ||
storeKey: PropTypes.string | ||
}; | ||
}(React.Component); |
@@ -6,17 +6,19 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
import React from 'react'; | ||
import { defaultTranslateOptions } from './locale'; | ||
import 'redux'; | ||
import { flatten } from 'flat'; | ||
import { defaultTranslateOptions } from './localize'; | ||
export var getLocalizedElement = function getLocalizedElement(key, translations, data, activeLanguage) { | ||
var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : defaultTranslateOptions; | ||
export var getLocalizedElement = function getLocalizedElement(options) { | ||
var translationId = options.translationId, | ||
translations = options.translations, | ||
data = options.data, | ||
renderInnerHtml = options.renderInnerHtml, | ||
onMissingTranslation = options.onMissingTranslation; | ||
var onMissingTranslation = function onMissingTranslation() { | ||
if (options.missingTranslationCallback) { | ||
options.missingTranslationCallback(key, activeLanguage.code); | ||
} | ||
return options.showMissingTranslationMsg === false ? '' : templater(options.missingTranslationMsg || '', { key: key, code: activeLanguage.code }); | ||
}; | ||
var localizedString = translations[key] || onMissingTranslation(); | ||
var translatedValue = templater(localizedString, data); | ||
return options.renderInnerHtml && hasHtmlTags(translatedValue) ? React.createElement('span', { dangerouslySetInnerHTML: { __html: translatedValue } }) : translatedValue; | ||
var localizedString = translations[translationId] || onMissingTranslation(translationId); | ||
var placeholderData = translations[translationId] ? data : { translationId: options.translationId, languageCode: options.languageCode }; | ||
var translatedValue = templater(localizedString, placeholderData); | ||
return renderInnerHtml === true && hasHtmlTags(translatedValue) ? React.createElement('span', { dangerouslySetInnerHTML: { __html: translatedValue } }) : translatedValue; | ||
}; | ||
@@ -61,4 +63,9 @@ | ||
if (options.translationTransform !== undefined && typeof options.translationTransform !== 'function') { | ||
throw new Error('react-localize-redux: Invalid translationTransform function.'); | ||
throw new Error('react-localize-redux: an invalid translationTransform function was provided.'); | ||
} | ||
if (options.onMissingTranslation !== undefined && typeof options.onMissingTranslation !== 'function') { | ||
throw new Error('react-localize-redux: an invalid onMissingTranslation function was provided.'); | ||
} | ||
return options; | ||
@@ -97,2 +104,17 @@ }; | ||
export var getSingleToMultilanguageTranslation = function getSingleToMultilanguageTranslation(language, languageCodes, flattenedTranslations, existingTranslations) { | ||
var languageIndex = languageCodes.indexOf(language); | ||
var translations = languageIndex >= 0 ? flattenedTranslations : {}; | ||
return Object.keys(translations).reduce(function (prev, cur) { | ||
// loop through each language, and for languages that don't match languageIndex | ||
// keep existing translation data, and for languageIndex store new translation data | ||
var translationValues = languageCodes.map(function (code, index) { | ||
var existingValues = existingTranslations[cur] || []; | ||
return index === languageIndex ? flattenedTranslations[cur] : existingValues[index]; | ||
}); | ||
return _extends({}, prev, _defineProperty({}, cur, translationValues)); | ||
}, {}); | ||
}; | ||
// Thanks react-redux for utility function | ||
@@ -99,0 +121,0 @@ // https://github.com/reactjs/react-redux/blob/master/src/utils/warning.js |
import { ReactElement, ReactNode, Component as ReactComponent } from 'react'; | ||
import { Store } from 'redux'; | ||
import { ComponentClass, Component } from 'react-redux'; | ||
@@ -23,20 +24,33 @@ | ||
type MissingTranslationCallback = (key: string, languageCode: string) => any; | ||
type onMissingTranslationFunction = ({translationId: string, languageCode: string, defaultTranslation: string}) => string; | ||
export interface Options { | ||
export interface InitializeOptions { | ||
renderInnerHtml?: boolean; | ||
onMissingTranslation?: onMissingTranslationFunction; | ||
defaultLanguage?: string; | ||
showMissingTranslationMsg?: boolean; | ||
missingTranslationMsg?: string; | ||
missingTranslationCallback?: MissingTranslationCallback; | ||
translationTransform?: TransFormFunction; | ||
ignoreTranslateChildren?: boolean; | ||
} | ||
export interface LocaleState { | ||
export interface LocalizeState { | ||
languages: Language[]; | ||
translations: Translations; | ||
options: Options; | ||
options: InitializeOptions; | ||
} | ||
export interface LocalizeContextProps { | ||
translate: TranslateFunction, | ||
languages: Language[], | ||
activeLanguage: Language, | ||
defaultLanguage: string, | ||
initialize: (payload: InitializePayload) => void, | ||
addTranslation: (translation: MultipleLanguageTranslation) => void, | ||
addTranslationForLanguage: (translation: SingleLanguageTranslation, language: string) => void, | ||
setActiveLanguage: (languageCode: string) => void | ||
} | ||
export interface LocalizeProviderProps { | ||
store?: Store<any>, | ||
children: any | ||
} | ||
export interface TranslatedLanguage { | ||
@@ -56,16 +70,13 @@ [key: string]: string; | ||
export type TranslateChildFunction = ( | ||
translate: TranslateFunction, | ||
activeLanguage: Language, | ||
languages: Language[]) => any; | ||
export type TranslateChildFunction = (context: LocalizeContextProps) => any; | ||
export interface TranslateProps { | ||
id?: string; | ||
options?: Options; | ||
options?: InitializeOptions; | ||
data?: TranslatePlaceholderData; | ||
children?: any|TranslateChildFunction; | ||
children?: TranslateChildFunction; | ||
} | ||
export type TranslateValue = string|string[]; | ||
interface BaseAction<T, P> { | ||
@@ -76,7 +87,8 @@ type: T; | ||
export type TranslateFunction = (value: TranslateValue, data?: TranslatePlaceholderData, options?: Options) => LocalizedElement|LocalizedElementMap; | ||
type InitializePayload = { | ||
languages: any[], | ||
options?: Options | ||
export type TranslateFunction = (value: TranslateValue, data?: TranslatePlaceholderData, options?: InitializeOptions) => LocalizedElement|LocalizedElementMap; | ||
export type InitializePayload = { | ||
languages: Array<string|NamedLanguage>, | ||
translation?: Object, | ||
options?: InitializeOptions | ||
}; | ||
@@ -93,7 +105,2 @@ | ||
type SetLanguagesPayload = { | ||
languages: string[]|NamedLanguage[], | ||
activeLanguage?: string | ||
}; | ||
type SetActiveLanguagePayload = { | ||
@@ -103,7 +110,2 @@ languageCode: string | ||
type LocalizeProps = { | ||
currentLanguage: string, | ||
translate: TranslateFunction | ||
}; | ||
export type SingleLanguageTranslation = { | ||
@@ -119,5 +121,4 @@ [key: string]: Object | string | ||
export type AddTranslationAction = BaseAction<'@@localize/ADD_TRANSLATION', AddTranslationPayload>; | ||
export type AddTranslationForLanguageAction = BaseAction<'@@localize/ADD_TRANSLATION_FOR_LANGUGE', AddTranslationForLanguagePayload>; | ||
export type AddTranslationForLanguageAction = BaseAction<'@@localize/ADD_TRANSLATION_FOR_LANGUAGE', AddTranslationForLanguagePayload>; | ||
export type SetActiveLanguageAction = BaseAction<'@@localize/SET_ACTIVE_LANGUAGE', SetActiveLanguagePayload>; | ||
export type SetLanguagesAction = BaseAction<'@@localize/SET_LANGUAGES', SetLanguagesPayload>; | ||
@@ -130,12 +131,9 @@ export type Action = BaseAction< | ||
& SetActiveLanguagePayload | ||
& SetLanguagesPayload | ||
>; | ||
export type GetSliceStateFn = (state: Object|LocaleState) => LocaleState; | ||
export type ActionLanguageCodes = Action & { languageCodes: string[] }; | ||
export function localeReducer(state: LocaleState, action: Action): LocaleState; | ||
export function localizeReducer(state: LocalizeState, action: Action): LocalizeState; | ||
export function initialize(languages: Array<string|NamedLanguage>, options?: Options): InitializeAction; | ||
export function initialize(payload: InitializePayload): InitializeAction; | ||
@@ -146,20 +144,18 @@ export function addTranslation(translation: MultipleLanguageTranslation): AddTranslationAction; | ||
export function setLanguages(languages: Array<string|NamedLanguage>, activeLanguage?: string): SetLanguagesAction; | ||
export function setActiveLanguage(languageCode: string): SetActiveLanguageAction; | ||
export function getTranslations(state: LocaleState): Translations; | ||
export function getTranslations(state: LocalizeState): Translations; | ||
export function getLanguages(state: LocaleState): Language[]; | ||
export function getLanguages(state: LocalizeState): Language[]; | ||
export function getOptions(state: LocaleState): Options; | ||
export function getOptions(state: LocalizeState): InitializeOptions; | ||
export function getActiveLanguage(state: LocaleState): Language; | ||
export function getActiveLanguage(state: LocalizeState): Language; | ||
export function getTranslate(state: LocaleState): TranslateFunction; | ||
export function getTranslate(state: LocalizeState): TranslateFunction; | ||
export function localize(Component: Component<any>, slice?: string, getStateSlice?: GetSliceStateFn): (state: Object|LocaleState) => ComponentClass<LocalizeProps>; | ||
export function withLocalize<Props extends {}>(WrappedComponent: ReactComponent<Props>): ReactComponent<Props & LocalizeContextProps>; | ||
export function TranslateChildFunction(translate: Translate, activeLanguage: Language, languages: Language[]): ReactNode; | ||
export function TranslateChildFunction(context: LocalizeContextProps): ReactNode; | ||
export class Translate extends ReactComponent<TranslateProps> {} | ||
export default class Translate extends ReactComponent<TranslateProps> {} |
@@ -7,56 +7,68 @@ 'use strict'; | ||
var _Localize = require('./Localize'); | ||
var _Translate = require('./Translate'); | ||
Object.defineProperty(exports, 'localize', { | ||
Object.defineProperty(exports, 'Translate', { | ||
enumerable: true, | ||
get: function get() { | ||
return _Localize.localize; | ||
return _Translate.Translate; | ||
} | ||
}); | ||
var _Translate = require('./Translate'); | ||
var _withLocalize = require('./withLocalize'); | ||
Object.defineProperty(exports, 'Translate', { | ||
Object.defineProperty(exports, 'withLocalize', { | ||
enumerable: true, | ||
get: function get() { | ||
return _Translate.Translate; | ||
return _withLocalize.withLocalize; | ||
} | ||
}); | ||
var _locale = require('./locale'); | ||
var _LocalizeProvider = require('./LocalizeProvider'); | ||
Object.defineProperty(exports, 'localeReducer', { | ||
Object.defineProperty(exports, 'LocalizeProvider', { | ||
enumerable: true, | ||
get: function get() { | ||
return _locale.localeReducer; | ||
return _LocalizeProvider.LocalizeProvider; | ||
} | ||
}); | ||
Object.defineProperty(exports, 'initialize', { | ||
var _LocalizeContext = require('./LocalizeContext'); | ||
Object.defineProperty(exports, 'LocalizeContext', { | ||
enumerable: true, | ||
get: function get() { | ||
return _locale.initialize; | ||
return _LocalizeContext.LocalizeContext; | ||
} | ||
}); | ||
Object.defineProperty(exports, 'addTranslation', { | ||
var _localize = require('./localize'); | ||
Object.defineProperty(exports, 'localizeReducer', { | ||
enumerable: true, | ||
get: function get() { | ||
return _locale.addTranslation; | ||
return _localize.localizeReducer; | ||
} | ||
}); | ||
Object.defineProperty(exports, 'addTranslationForLanguage', { | ||
Object.defineProperty(exports, 'initialize', { | ||
enumerable: true, | ||
get: function get() { | ||
return _locale.addTranslationForLanguage; | ||
return _localize.initialize; | ||
} | ||
}); | ||
Object.defineProperty(exports, 'setLanguages', { | ||
Object.defineProperty(exports, 'addTranslation', { | ||
enumerable: true, | ||
get: function get() { | ||
return _locale.setLanguages; | ||
return _localize.addTranslation; | ||
} | ||
}); | ||
Object.defineProperty(exports, 'addTranslationForLanguage', { | ||
enumerable: true, | ||
get: function get() { | ||
return _localize.addTranslationForLanguage; | ||
} | ||
}); | ||
Object.defineProperty(exports, 'setActiveLanguage', { | ||
enumerable: true, | ||
get: function get() { | ||
return _locale.setActiveLanguage; | ||
return _localize.setActiveLanguage; | ||
} | ||
@@ -67,3 +79,3 @@ }); | ||
get: function get() { | ||
return _locale.getTranslate; | ||
return _localize.getTranslate; | ||
} | ||
@@ -74,3 +86,3 @@ }); | ||
get: function get() { | ||
return _locale.getActiveLanguage; | ||
return _localize.getActiveLanguage; | ||
} | ||
@@ -81,3 +93,3 @@ }); | ||
get: function get() { | ||
return _locale.getLanguages; | ||
return _localize.getLanguages; | ||
} | ||
@@ -88,3 +100,3 @@ }); | ||
get: function get() { | ||
return _locale.getTranslations; | ||
return _localize.getTranslations; | ||
} | ||
@@ -95,4 +107,4 @@ }); | ||
get: function get() { | ||
return _locale.getOptions; | ||
return _localize.getOptions; | ||
} | ||
}); |
@@ -22,6 +22,10 @@ 'use strict'; | ||
var _locale = require('./locale'); | ||
var _localize = require('./localize'); | ||
var _utils = require('./utils'); | ||
var _LocalizeContext = require('./LocalizeContext'); | ||
var _withLocalize = require('./withLocalize'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -39,27 +43,13 @@ | ||
var DEFAULT_LOCALE_STATE_NAME = 'locale'; | ||
var DEFAULT_REDUX_STORE_KEY = 'store'; | ||
var Translate = exports.Translate = function (_React$Component) { | ||
_inherits(Translate, _React$Component); | ||
function Translate(props, context) { | ||
function Translate(props) { | ||
_classCallCheck(this, Translate); | ||
var _this = _possibleConstructorReturn(this, (Translate.__proto__ || Object.getPrototypeOf(Translate)).call(this, props, context)); | ||
var _this = _possibleConstructorReturn(this, (Translate.__proto__ || Object.getPrototypeOf(Translate)).call(this, props)); | ||
if (!_this.getStore()) { | ||
throw new Error('react-localize-redux: Unable to locate redux store in context. Ensure your app is wrapped with <Provider />.'); | ||
} | ||
if (!_this.getStateSlice().languages) { | ||
throw new Error('react-localize-redux: cannot find languages ensure you have correctly dispatched initialize action.'); | ||
} | ||
_this.state = { | ||
hasUpdated: false | ||
hasAddedDefaultTranslation: false | ||
}; | ||
_this.onStateDidChange = _this.onStateDidChange.bind(_this); | ||
_this.addDefaultTranslation(); | ||
return _this; | ||
@@ -71,40 +61,18 @@ } | ||
value: function componentDidMount() { | ||
this.unsubscribeFromStore = (0, _utils.storeDidChange)(this.getStore(), this.onStateDidChange); | ||
this.setState({ hasAddedDefaultTranslation: true }); | ||
} | ||
}, { | ||
key: 'componentWillUnmount', | ||
value: function componentWillUnmount() { | ||
this.unsubscribeFromStore(); | ||
} | ||
}, { | ||
key: 'onStateDidChange', | ||
value: function onStateDidChange(prevState) { | ||
var prevLocaleState = this.getStateSlice(prevState); | ||
var curLocaleState = this.getStateSlice(); | ||
key: 'addDefaultTranslation', | ||
value: function addDefaultTranslation(context) { | ||
if (this.state.hasAddedDefaultTranslation) { | ||
return; | ||
} | ||
var prevActiveLanguage = (0, _locale.getActiveLanguage)(prevLocaleState); | ||
var curActiveLanguage = (0, _locale.getActiveLanguage)(curLocaleState); | ||
var prevOptions = (0, _locale.getOptions)(prevLocaleState); | ||
var curOptions = (0, _locale.getOptions)(curLocaleState); | ||
var prevTranslations = (0, _locale.getTranslationsForActiveLanguage)(prevLocaleState); | ||
var curTranslations = (0, _locale.getTranslationsForActiveLanguage)(curLocaleState); | ||
var hasActiveLangaugeChanged = prevActiveLanguage.code !== curActiveLanguage.code; | ||
var hasOptionsChanged = prevOptions !== curOptions; | ||
var hasTranslationsChanged = prevTranslations !== curTranslations; | ||
if (hasActiveLangaugeChanged || hasOptionsChanged || hasTranslationsChanged) { | ||
this.setState({ hasUpdated: true }); | ||
} | ||
} | ||
}, { | ||
key: 'addDefaultTranslation', | ||
value: function addDefaultTranslation() { | ||
var locale = this.getStateSlice(); | ||
var _props = this.props, | ||
id = _props.id, | ||
children = _props.children; | ||
children = _props.children, | ||
_props$options = _props.options, | ||
options = _props$options === undefined ? {} : _props$options; | ||
var defaultLanguage = options.language || context.defaultLanguage; | ||
@@ -115,29 +83,24 @@ if (children === undefined || typeof children === 'function') { | ||
if (locale.options.ignoreTranslateChildren) { | ||
if (options.ignoreTranslateChildren) { | ||
return; | ||
} | ||
if (id !== undefined) { | ||
var store = this.getStore(); | ||
if (id !== undefined && defaultLanguage !== undefined) { | ||
var translation = _server2.default.renderToStaticMarkup(children); | ||
var defaultLanguage = locale.options.defaultLanguage || locale.languages[0].code; | ||
store.dispatch((0, _locale.addTranslationForLanguage)(_defineProperty({}, id, translation), defaultLanguage)); | ||
context.addTranslationForLanguage && context.addTranslationForLanguage(_defineProperty({}, id, translation), defaultLanguage); | ||
} | ||
} | ||
}, { | ||
key: 'getStore', | ||
value: function getStore() { | ||
var storeKey = this.context.storeKey; | ||
key: 'renderChildren', | ||
value: function renderChildren(context) { | ||
var _props2 = this.props, | ||
_props2$id = _props2.id, | ||
id = _props2$id === undefined ? '' : _props2$id, | ||
options = _props2.options, | ||
data = _props2.data; | ||
return this.context[storeKey || DEFAULT_REDUX_STORE_KEY]; | ||
} | ||
}, { | ||
key: 'getStateSlice', | ||
value: function getStateSlice(myState) { | ||
var _context = this.context, | ||
getLocaleState = _context.getLocaleState, | ||
storeKey = _context.storeKey; | ||
var state = myState || this.getStore().getState(); | ||
return getLocaleState !== undefined ? getLocaleState(state) : state[DEFAULT_LOCALE_STATE_NAME] || state; | ||
this.addDefaultTranslation(context); | ||
return typeof this.props.children === 'function' ? this.props.children(context) : context.translate && context.translate(id, data, options); | ||
} | ||
@@ -147,12 +110,11 @@ }, { | ||
value: function render() { | ||
var translateFn = (0, _locale.getTranslate)(this.getStateSlice()); | ||
var activeLanguage = (0, _locale.getActiveLanguage)(this.getStateSlice()); | ||
var languages = (0, _locale.getLanguages)(this.getStateSlice()); | ||
var _props2 = this.props, | ||
_props2$id = _props2.id, | ||
id = _props2$id === undefined ? '' : _props2$id, | ||
data = _props2.data, | ||
options = _props2.options; | ||
var _this2 = this; | ||
return typeof this.props.children === 'function' ? this.props.children(translateFn, activeLanguage, languages) : translateFn(id, data, options); | ||
return React.createElement( | ||
_LocalizeContext.LocalizeContext.Consumer, | ||
null, | ||
function (context) { | ||
return _this2.renderChildren(context); | ||
} | ||
); | ||
} | ||
@@ -162,12 +124,2 @@ }]); | ||
return Translate; | ||
}(React.Component); | ||
Translate.contextTypes = { | ||
store: _propTypes2.default.shape({ | ||
subscribe: _propTypes2.default.func.isRequired, | ||
dispatch: _propTypes2.default.func.isRequired, | ||
getState: _propTypes2.default.func.isRequired | ||
}), | ||
getLocaleState: _propTypes2.default.func, | ||
storeKey: _propTypes2.default.string | ||
}; | ||
}(React.Component); |
@@ -6,3 +6,3 @@ 'use strict'; | ||
}); | ||
exports.warning = exports.storeDidChange = exports.getTranslationsForLanguage = exports.validateOptions = exports.objectValuesToString = exports.getIndexForLanguageCode = exports.templater = exports.hasHtmlTags = exports.getLocalizedElement = undefined; | ||
exports.warning = exports.getSingleToMultilanguageTranslation = exports.storeDidChange = exports.getTranslationsForLanguage = exports.validateOptions = exports.objectValuesToString = exports.getIndexForLanguageCode = exports.templater = exports.hasHtmlTags = exports.getLocalizedElement = undefined; | ||
@@ -15,4 +15,8 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _locale = require('./locale'); | ||
require('redux'); | ||
var _flat = require('flat'); | ||
var _localize = require('./localize'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -22,14 +26,14 @@ | ||
var getLocalizedElement = exports.getLocalizedElement = function getLocalizedElement(key, translations, data, activeLanguage) { | ||
var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : _locale.defaultTranslateOptions; | ||
var getLocalizedElement = exports.getLocalizedElement = function getLocalizedElement(options) { | ||
var translationId = options.translationId, | ||
translations = options.translations, | ||
data = options.data, | ||
renderInnerHtml = options.renderInnerHtml, | ||
onMissingTranslation = options.onMissingTranslation; | ||
var onMissingTranslation = function onMissingTranslation() { | ||
if (options.missingTranslationCallback) { | ||
options.missingTranslationCallback(key, activeLanguage.code); | ||
} | ||
return options.showMissingTranslationMsg === false ? '' : templater(options.missingTranslationMsg || '', { key: key, code: activeLanguage.code }); | ||
}; | ||
var localizedString = translations[key] || onMissingTranslation(); | ||
var translatedValue = templater(localizedString, data); | ||
return options.renderInnerHtml && hasHtmlTags(translatedValue) ? _react2.default.createElement('span', { dangerouslySetInnerHTML: { __html: translatedValue } }) : translatedValue; | ||
var localizedString = translations[translationId] || onMissingTranslation(translationId); | ||
var placeholderData = translations[translationId] ? data : { translationId: options.translationId, languageCode: options.languageCode }; | ||
var translatedValue = templater(localizedString, placeholderData); | ||
return renderInnerHtml === true && hasHtmlTags(translatedValue) ? _react2.default.createElement('span', { dangerouslySetInnerHTML: { __html: translatedValue } }) : translatedValue; | ||
}; | ||
@@ -74,4 +78,9 @@ | ||
if (options.translationTransform !== undefined && typeof options.translationTransform !== 'function') { | ||
throw new Error('react-localize-redux: Invalid translationTransform function.'); | ||
throw new Error('react-localize-redux: an invalid translationTransform function was provided.'); | ||
} | ||
if (options.onMissingTranslation !== undefined && typeof options.onMissingTranslation !== 'function') { | ||
throw new Error('react-localize-redux: an invalid onMissingTranslation function was provided.'); | ||
} | ||
return options; | ||
@@ -110,2 +119,17 @@ }; | ||
var getSingleToMultilanguageTranslation = exports.getSingleToMultilanguageTranslation = function getSingleToMultilanguageTranslation(language, languageCodes, flattenedTranslations, existingTranslations) { | ||
var languageIndex = languageCodes.indexOf(language); | ||
var translations = languageIndex >= 0 ? flattenedTranslations : {}; | ||
return Object.keys(translations).reduce(function (prev, cur) { | ||
// loop through each language, and for languages that don't match languageIndex | ||
// keep existing translation data, and for languageIndex store new translation data | ||
var translationValues = languageCodes.map(function (code, index) { | ||
var existingValues = existingTranslations[cur] || []; | ||
return index === languageIndex ? flattenedTranslations[cur] : existingValues[index]; | ||
}); | ||
return _extends({}, prev, _defineProperty({}, cur, translationValues)); | ||
}, {}); | ||
}; | ||
// Thanks react-redux for utility function | ||
@@ -112,0 +136,0 @@ // https://github.com/reactjs/react-redux/blob/master/src/utils/warning.js |
{ | ||
"name": "react-localize-redux", | ||
"version": "2.17.5", | ||
"version": "3.0.0-rc1", | ||
"description": "Localization library for React/Redux", | ||
@@ -25,3 +25,2 @@ "main": "./lib/index.js", | ||
"prepublish": "npm run build", | ||
"start": "webpack-dev-server --config examples/webpack.config.babel.js --content-base examples --inline --open", | ||
"test": "cross-env BABEL_ENV=test jest", | ||
@@ -41,4 +40,2 @@ "test:dev": "jest --watch", | ||
"redux", | ||
"react-redux", | ||
"decorator", | ||
"intl", | ||
@@ -62,5 +59,3 @@ "i18n", | ||
"peerDependencies": { | ||
"react": "^16.0.0", | ||
"react-redux": "^4.3.0 || ^5.0.0", | ||
"redux": "^3.0.0" | ||
"react": "^16.0.0" | ||
}, | ||
@@ -80,11 +75,9 @@ "devDependencies": { | ||
"cross-env": "^3.1.4", | ||
"enzyme": "^3.0.0", | ||
"enzyme-adapter-react-16": "^1.0.0", | ||
"express": "^4.14.0", | ||
"flow-bin": "^0.53.1", | ||
"flow-copy-source": "^1.2.1", | ||
"flow-typed": "^2.1.5", | ||
"html-webpack-plugin": "^2.24.1", | ||
"enzyme": "^3.3.0", | ||
"enzyme-adapter-react-16": "^1.1.1", | ||
"flow-bin": "^0.70.0", | ||
"flow-copy-source": "^1.3.0", | ||
"flow-typed": "^2.4.0", | ||
"immutable": "^3.8.2", | ||
"jest": "^20.0.4", | ||
"jest": "^22.4.3", | ||
"json-loader": "^0.5.4", | ||
@@ -97,14 +90,7 @@ "ncp": "^2.0.0", | ||
"react-dom": "^16.3.1", | ||
"react-redux": "^5.0.6", | ||
"react-router": "^3.0.0", | ||
"react-test-renderer": "^16.0.0", | ||
"redux": "^3.6.0", | ||
"redux-devtools": "^3.4.0", | ||
"redux-devtools-extension": "^2.13.2", | ||
"redux-mock-store": "^1.2.1", | ||
"rimraf": "^2.5.4", | ||
"webpack": "^2.2.0-rc.2", | ||
"webpack-config-utils": "^2.3.0", | ||
"webpack-dev-middleware": "^1.9.0", | ||
"webpack-dev-server": "^2.2.0-rc.0" | ||
"webpack-config-utils": "^2.3.0" | ||
}, | ||
@@ -125,7 +111,7 @@ "jest": { | ||
"dependencies": { | ||
"create-react-context": "^0.2.2", | ||
"flat": "^2.0.1", | ||
"prop-types": "^15.6.1", | ||
"react": "^16.3.1", | ||
"reselect": "^3.0.1" | ||
} | ||
} |
@@ -22,15 +22,2 @@ <p align="center"> | ||
--- | ||
#### Not using React 16? | ||
If you are using an older version of react, and plan on using the [Translate](/api/translate/) component | ||
you have the following options: | ||
* Update react to a version > 16 as `Translate` requires the ability to render [fragments and strings](https://reactjs.org/blog/2017/09/26/react-v16.0.html#new-render-return-types-fragments-and-strings) (**recommended**). | ||
* [Using Translate component with React 15](https://ryandrewjohnson.github.io/react-localize-redux/faq/#can-i-use-translate-component-with-react-15xx) | ||
____ | ||
## Docs | ||
@@ -50,3 +37,2 @@ | ||
- [Dead simple localization for your React components](https://medium.com/@ryandrewjohnson/adding-multi-language-support-to-your-react-redux-app-cf6e64250050) | ||
- [Migrating from v1 to v2?](MIGRATING.md) | ||
@@ -53,0 +39,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 2 instances in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
352585
5
31
24
7072
2
45
7
+ Addedcreate-react-context@^0.2.2
+ Addedasap@2.0.6(transitive)
+ Addedcore-js@1.2.7(transitive)
+ Addedcreate-react-context@0.2.3(transitive)
+ Addedencoding@0.1.13(transitive)
+ Addedfbjs@0.8.18(transitive)
+ Addedgud@1.0.0(transitive)
+ Addediconv-lite@0.6.3(transitive)
+ Addedis-stream@1.1.0(transitive)
+ Addedisomorphic-fetch@2.2.1(transitive)
+ Addednode-fetch@1.7.3(transitive)
+ Addedpromise@7.3.1(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsetimmediate@1.0.5(transitive)
+ Addedua-parser-js@0.7.39(transitive)
+ Addedwhatwg-fetch@3.6.20(transitive)
- Removedreact@^16.3.1
- Removed@babel/runtime@7.26.0(transitive)
- Removedhoist-non-react-statics@3.3.2(transitive)
- Removedinvariant@2.2.4(transitive)
- Removedlodash@4.17.21(transitive)
- Removedlodash-es@4.17.21(transitive)
- Removedreact-lifecycles-compat@3.0.4(transitive)
- Removedreact-redux@5.1.2(transitive)
- Removedredux@3.7.2(transitive)
- Removedregenerator-runtime@0.14.1(transitive)
- Removedsymbol-observable@1.2.0(transitive)