forked from i18next/react-i18next
-
Notifications
You must be signed in to change notification settings - Fork 0
/
react-i18next.min.js
1 lines (1 loc) · 24.1 KB
/
react-i18next.min.js
1
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t(e["react-i18next"]={},e.React)}(this,function(e,t){"use strict";var n="default"in t?t.default:t;function r(e){return(r="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})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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)}}function a(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){s(e,t,n[t])})}return e}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function d(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?d(e):t}function h(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(o)throw i}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function m(){if(console&&console.warn){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];"string"==typeof t[0]&&(t[0]="react-i18next:: ".concat(t[0])),console.warn.apply(null,t)}}var v={};function b(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];"string"==typeof t[0]&&v[t[0]]||("string"==typeof t[0]&&(v[t[0]]=new Date),m.apply(void 0,t))}function g(){if(process&&process.env&&(!process.env.NODE_ENV||"development"===process.env.NODE_ENV)){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];"string"==typeof t[0]&&(t[0]="deprecation warning -> ".concat(t[0])),b.apply(void 0,t)}}function O(e,t){e.initialI18nStore&&(e.i18n.services.resourceStore.data=e.initialI18nStore,t&&(e.i18n.options.isInitialSSR=!0),e.i18nOptions&&(e.i18nOptions.wait=!1)),e.initialLanguage&&e.i18n.changeLanguage(e.initialLanguage)}var S=Object.entries||function(e){for(var t=Object.keys(e),n=t.length,r=new Array(n);n--;)r[n]=[t[n],e[t[n]]];return r};function w(e){var t=[];return function(e,t){for(var n=0,o=e.length;n<o;n++)if("object"===r(e[n])){var i=!0,a=!1,s=void 0;try{for(var c,u=S(e[n])[Symbol.iterator]();!(i=(c=u.next()).done);i=!0){var l=h(c.value,2),p=l[0];t(l[1],n,p)}}catch(e){a=!0,s=e}finally{try{i||null==u.return||u.return()}finally{if(a)throw s}}}else t(e[n],n)}(e,function(e){e&&e.namespaces&&e.namespaces.forEach(function(e){-1===t.indexOf(e)&&t.push(e)})}),t}var j=Object.prototype.hasOwnProperty;function x(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function E(e,t){return e(t={exports:{}},t.exports),t.exports}Object.defineProperty(e,"__esModule",{value:!0});var P="function"==typeof Symbol&&Symbol.for,N=P?Symbol.for("react.element"):60103,C=P?Symbol.for("react.portal"):60106,I=P?Symbol.for("react.fragment"):60107,_=P?Symbol.for("react.strict_mode"):60108,k=P?Symbol.for("react.profiler"):60114,$=P?Symbol.for("react.provider"):60109,T=P?Symbol.for("react.context"):60110,M=P?Symbol.for("react.async_mode"):60111,R=P?Symbol.for("react.forward_ref"):60112,A=P?Symbol.for("react.placeholder"):60113;function D(e){if("object"===r(e)&&null!==e){var t=e.$$typeof;switch(t){case N:switch(e=e.type){case M:case I:case k:case _:return e;default:switch(e=e&&e.$$typeof){case T:case R:case $:return e;default:return t}}case C:return t}}}e.typeOf=D,e.AsyncMode=M,e.ContextConsumer=T,e.ContextProvider=$,e.Element=N,e.ForwardRef=R,e.Fragment=I,e.Profiler=k,e.Portal=C,e.StrictMode=_,e.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===I||e===M||e===k||e===_||e===A||"object"===r(e)&&null!==e&&("function"==typeof e.then||e.$$typeof===$||e.$$typeof===T||e.$$typeof===R)},e.isAsyncMode=function(e){return D(e)===M},e.isContextConsumer=function(e){return D(e)===T},e.isContextProvider=function(e){return D(e)===$},e.isElement=function(e){return"object"===r(e)&&null!==e&&e.$$typeof===N},e.isForwardRef=function(e){return D(e)===R},e.isFragment=function(e){return D(e)===I},e.isProfiler=function(e){return D(e)===k},e.isPortal=function(e){return D(e)===C},e.isStrictMode=function(e){return D(e)===_};var V=Object.freeze({});"production"!==process.env.NODE_ENV&&function(){Object.defineProperty(e,"__esModule",{value:!0});var t="function"==typeof Symbol&&Symbol.for,n=t?Symbol.for("react.element"):60103,o=t?Symbol.for("react.portal"):60106,i=t?Symbol.for("react.fragment"):60107,a=t?Symbol.for("react.strict_mode"):60108,s=t?Symbol.for("react.profiler"):60114,c=t?Symbol.for("react.provider"):60109,u=t?Symbol.for("react.context"):60110,l=t?Symbol.for("react.async_mode"):60111,p=t?Symbol.for("react.forward_ref"):60112,f=t?Symbol.for("react.placeholder"):60113;function d(e){if("object"===r(e)&&null!==e){var t=e.$$typeof;switch(t){case n:var f=e.type;switch(f){case l:case i:case s:case a:return f;default:var d=f&&f.$$typeof;switch(d){case u:case p:case c:return d;default:return t}}case o:return t}}}var y=l,h=u,m=c,v=n,b=p,g=i,O=s,S=o,w=a;e.typeOf=d,e.AsyncMode=y,e.ContextConsumer=h,e.ContextProvider=m,e.Element=v,e.ForwardRef=b,e.Fragment=g,e.Profiler=O,e.Portal=S,e.StrictMode=w,e.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===l||e===s||e===a||e===f||"object"===r(e)&&null!==e&&("function"==typeof e.then||e.$$typeof===c||e.$$typeof===u||e.$$typeof===p)},e.isAsyncMode=function(e){return d(e)===l},e.isContextConsumer=function(e){return d(e)===u},e.isContextProvider=function(e){return d(e)===c},e.isElement=function(e){return"object"===r(e)&&null!==e&&e.$$typeof===n},e.isForwardRef=function(e){return d(e)===p},e.isFragment=function(e){return d(e)===i},e.isProfiler=function(e){return d(e)===s},e.isPortal=function(e){return d(e)===o},e.isStrictMode=function(e){return d(e)===a}}();var F,W=Object.freeze({}),L=E(function(e){"production"===process.env.NODE_ENV?e.exports=V:e.exports=W});function B(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var U={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},q={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},z=B({},L.ForwardRef,(B(F={},"$$typeof",!0),B(F,"render",!0),F)),H=Object.defineProperty,K=Object.getOwnPropertyNames,J=Object.getOwnPropertySymbols,Y=Object.getOwnPropertyDescriptor,G=Object.getPrototypeOf,Q=Object.prototype;var X=function e(t,n,r){if("string"!=typeof n){if(Q){var o=G(n);o&&o!==Q&&e(t,o,r)}var i=K(n);J&&(i=i.concat(J(n)));for(var a=z[t.$$typeof]||U,s=z[n.$$typeof]||U,c=0;c<i.length;++c){var u=i[c];if(!(q[u]||r&&r[u]||s&&s[u]||a&&a[u])){var l=Y(n,u);try{H(t,u,l)}catch(e){}}}return t}return t};e.__esModule=!0;var Z=require("react"),ee=(re(Z),re(require("prop-types"))),te=re(require("gud")),ne=re(require("fbjs/lib/warning"));function re(e){return e&&e.__esModule?e:{default:e}}function oe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ie(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==r(t)&&"function"!=typeof t?e:t}function ae(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+r(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)}var se=1073741823;e.default=function(e,t){var n,r,o="__create-react-context-"+(0,te.default)()+"__",i=function(e){function n(){var t,r,o,i;oe(this,n);for(var a=arguments.length,s=Array(a),c=0;c<a;c++)s[c]=arguments[c];return t=r=ie(this,e.call.apply(e,[this].concat(s))),r.emitter=(o=r.props.value,i=[],{on:function(e){i.push(e)},off:function(e){i=i.filter(function(t){return t!==e})},get:function(){return o},set:function(e,t){o=e,i.forEach(function(e){return e(o,t)})}}),ie(r,t)}return ae(n,e),n.prototype.getChildContext=function(){var e;return(e={})[o]=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;((i=n)===(a=r)?0!==i||1/i==1/a:i!=i&&a!=a)?o=0:(o="function"==typeof t?t(n,r):se,"production"!==process.env.NODE_ENV&&(0,ne.default)((o&se)===o,"calculateChangedBits: Expected the return value to be a 31-bit integer. Instead received: %s",o),0!=(o|=0)&&this.emitter.set(e.value,o))}var i,a},n.prototype.render=function(){return this.props.children},n}(Z.Component);i.childContextTypes=((n={})[o]=ee.default.object.isRequired,n);var a=function(t){function n(){var e,r;oe(this,n);for(var o=arguments.length,i=Array(o),a=0;a<o;a++)i[a]=arguments[a];return e=r=ie(this,t.call.apply(t,[this].concat(i))),r.state={value:r.getValue()},r.onUpdate=function(e,t){0!=((0|r.observedBits)&t)&&r.setState({value:r.getValue()})},ie(r,e)}return ae(n,t),n.prototype.componentWillReceiveProps=function(e){var t=e.observedBits;this.observedBits=null==t?se:t},n.prototype.componentDidMount=function(){this.context[o]&&this.context[o].on(this.onUpdate);var e=this.props.observedBits;this.observedBits=null==e?se:e},n.prototype.componentWillUnmount=function(){this.context[o]&&this.context[o].off(this.onUpdate)},n.prototype.getValue=function(){return this.context[o]?this.context[o].get():e},n.prototype.render=function(){return(e=this.props.children,Array.isArray(e)?e[0]:e)(this.state.value);var e},n}(Z.Component);return a.contextTypes=((r={})[o]=ee.default.object,r),{Provider:i,Consumer:a}},module.exports=e.default;var ce,ue,le=Object.freeze({}),pe=E(function(e,t){t.__esModule=!0;var r=i(n),o=i(le);function i(e){return e&&e.__esModule?e:{default:e}}t.default=r.default.createContext||o.default,e.exports=t.default}),fe=(ce=pe)&&ce.__esModule&&Object.prototype.hasOwnProperty.call(ce,"default")?ce.default:ce,de={wait:!1,withRef:!1,bindI18n:"languageChanged loaded",bindStore:"added removed",translateFuncName:"t",nsMode:"default",usePureComponent:!1,omitBoundRerender:!0};function ye(e){de=c({},de,e)}function he(){return de}function me(e){ue=e}function ve(){return ue}var be={type:"3rdParty",init:function(e){ye(e.options.react),me(e)}},ge=fe();function Oe(){return function(e){return function(e){return function(r){function i(){return o(this,i),y(this,l(i).apply(this,arguments))}return u(i,t.Component),a(i,[{key:"render",value:function(){var t=this;return n.createElement(ge.Consumer,null,function(r){return n.createElement(e,c({},r,t.props))})}}]),i}()}(function(r){function i(){return o(this,i),y(this,l(i).apply(this,arguments))}return u(i,t.Component),a(i,[{key:"render",value:function(){var t=this,r={},o=this.props.i18nOptions,i=this.props.i18n||ve();if(!o){var a=Object.keys(de).reduce(function(e,n){return t.props[n]&&(e[n]=t.props[n]),e},{});o=c({},he(),i&&i.options&&i.options.react,a)}return i&&(r.i18n=i,r.t=i.t.bind(i),r.lng=i.language,r.i18nOptions=o),n.createElement(e,c({},r,this.props))}}]),i}())}}var Se=!1,we=function(e){function r(e){var t;if(o(this,r),t=y(this,l(r).call(this,e)),!e.i18n)return y(t,b("You will need pass in an i18next instance either by props, using I18nextProvider or by using i18nextReactModule. Learn more https://react.i18next.com/components/overview#getting-the-i-18-n-function-into-the-flow"));O(e),e.i18n.options&&e.i18n.options.isInitialSSR&&(e.i18nOptions.wait=!1);var n=t.getNamespaces();e.reportNS&&n.forEach(e.reportNS);var i=e.i18n.languages&&e.i18n.languages[0],a=!!i&&n.every(function(t){return e.i18n.hasResourceBundle(i,t)});return t.state={i18nLoadedAt:null,ready:a},t.t=t.getI18nTranslate(),t.onI18nChanged=t.onI18nChanged.bind(d(d(t))),t.getI18nTranslate=t.getI18nTranslate.bind(d(d(t))),t.namespaces=t.getNamespaces.bind(d(d(t))),t}return u(r,t.Component),a(r,[{key:"componentDidMount",value:function(){this.loadNamespaces()}},{key:"componentDidUpdate",value:function(e){this.props.ns&&e.ns!==this.props.ns&&this.loadNamespaces()}},{key:"componentWillUnmount",value:function(){var e=this,t=this.props,n=t.i18n,r=t.i18nOptions;if(this.mounted=!1,this.onI18nChanged){if(r.bindI18n)r.bindI18n.split(" ").forEach(function(t){return n.off(t,e.onI18nChanged)});if(r.bindStore)r.bindStore.split(" ").forEach(function(t){return n.store&&n.store.off(t,e.onI18nChanged)})}}},{key:"onI18nChanged",value:function(){var e=this.props.i18nOptions,t=this.state.ready;this.mounted&&(!t&&e.omitBoundRerender||(this.t=this.getI18nTranslate(),this.setState({i18nLoadedAt:new Date})))}},{key:"getI18nTranslate",value:function(){var e=this.props,t=e.i18n,n=e.i18nOptions,r=this.getNamespaces();return t.getFixedT(null,"fallback"===n.nsMode?r:r&&r.length?r[0]:"translation")}},{key:"getNamespaces",value:function(){var e=this.props,t=e.i18n,n=e.ns,r=e.defaultNS,o="function"==typeof n?n(this.props):n||r||t.options&&t.options.defaultNS;return"string"==typeof o?[o]:o||[]}},{key:"loadNamespaces",value:function(){var e=this,t=this.props,n=t.i18n,r=t.i18nOptions,o=this.state.ready,i=function(){r.bindI18n&&n&&n.on(r.bindI18n,e.onI18nChanged),r.bindStore&&n.store&&n.store.on(r.bindStore,e.onI18nChanged)};this.mounted=!0,n.loadNamespaces(this.getNamespaces(),function(){var t=function(){e.mounted&&!o&&e.setState({ready:!0},function(){r.wait||e.onI18nChanged()}),r.wait&&e.mounted&&i()};if(n.isInitialized)t();else{n.on("initialized",function e(){setTimeout(function(){n.off("initialized",e)},1e3),t()})}}),r.wait||i()}},{key:"render",value:function(){var e=this.props,t=e.children,r=e.i18n,o=e.defaultNS,i=e.reportNS,a=e.i18nOptions,s=this.state.ready,c=this.t;return!s&&a.wait?null:(r.options&&r.options.isInitialSSR&&!Se&&(Se=!0,setTimeout(function(){delete r.options.isInitialSSR},100)),n.createElement(ge.Provider,{value:{i18n:r,t:c,defaultNS:o,reportNS:i,lng:r&&r.language}},t(this.t,{i18n:r,t:c,lng:r.language,ready:s})))}}]),r}(),je=Oe()(we);function xe(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(s){var p,h=function(p){function h(e){var t;return o(this,h),(t=y(this,l(h).call(this,e))).getWrappedInstance=t.getWrappedInstance.bind(d(d(t))),t}return u(h,t.Component),a(h,[{key:"shouldComponentUpdate",value:function(e){return!this.props.i18nOptions.usePureComponent&&!i.usePureComponent||!function(e,t){if(x(e,t))return!0;if("object"!==r(e)||null===e||"object"!==r(t)||null===t)return!1;var n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(var i=0;i<n.length;i++)if(!j.call(t,n[i])||!x(e[n[i]],t[n[i]]))return!1;return!0}(this.props,e)}},{key:"getWrappedInstance",value:function(){return this.props.i18nOptions.withRef||i.usePureComponent||console.error("To access the wrapped instance, you need to specify { withRef: true } as the second argument of the translate() call."),this.wrappedInstance}},{key:"render",value:function(){var t=this,r=this.props,o=r.namespaces,a=c({},r.i18nOptions,i),u={};return a.withRef&&(u.ref=function(e){t.wrappedInstance=e}),n.createElement(je,c({ns:o||e},this.props,{i18nOptions:Object.keys(a).length>0?a:null}),function(e,r){var o=r.ready,i=f(r,["ready"]);return n.createElement(s,c({tReady:o},t.props,u,i))})}}]),h}(),m=Oe()(h);return m.WrappedComponent=s,m.displayName="LoadNamespace(".concat((p=s).displayName||p.name||"Component",")"),m.namespaces=e,X(m,s)}}xe.setDefaults=ye,xe.setI18n=me;var Ee={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,menuitem:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},Pe=/([\w-]+)|=|(['"])([.\s\S]*?)\2/g,Ne=/(?:<!--[\S\s]*?-->|<(?:"[^"]*"['"]*|'[^']*'['"]*|[^'">])+>)/g,Ce=Object.create?Object.create(null):{};function Ie(e,t,n,r,o){var i=t.indexOf("<",r),a=t.slice(r,-1===i?void 0:i);/^\s*$/.test(a)&&(a=" "),(!o&&i>-1&&n+e.length>=0||" "!==a)&&e.push({type:"text",content:a})}function _e(e,t){switch(t.type){case"text":return e+t.content;case"tag":return e+="<"+t.name+(t.attrs?function(e){var t=[];for(var n in e)t.push(n+'="'+e[n]+'"');return t.length?" "+t.join(" "):""}(t.attrs):"")+(t.voidElement?"/>":">"),t.voidElement?e:e+t.children.reduce(_e,"")+"</"+t.name+">"}}var ke={parse:function(e,t){t||(t={}),t.components||(t.components=Ce);var n,r=[],o=-1,i=[],a={},s=!1;return e.replace(Ne,function(c,u){if(s){if(c!=="</"+n.name+">")return;s=!1}var l,p="/"!==c.charAt(1),f=0===c.indexOf("\x3c!--"),d=u+c.length,y=e.charAt(d);p&&!f&&(o++,"tag"===(n=function(e){var t,n=0,r=!0,o={type:"tag",name:"",voidElement:!1,attrs:{},children:[]};return e.replace(Pe,function(i){if("="===i)return r=!0,void n++;r?0===n?((Ee[i]||"/"===e.charAt(e.length-2))&&(o.voidElement=!0),o.name=i):(o.attrs[t]=i.replace(/^['"]|['"]$/g,""),t=void 0):(t&&(o.attrs[t]=t),t=i),n++,r=!1}),o}(c)).type&&t.components[n.name]&&(n.type="component",s=!0),n.voidElement||s||!y||"<"===y||Ie(n.children,e,o,d,t.ignoreWhitespace),a[n.tagName]=n,0===o&&r.push(n),(l=i[o-1])&&l.children.push(n),i[o]=n),(f||!p||n.voidElement)&&(f||o--,!s&&"<"!==y&&y&&Ie(l=-1===o?r:i[o].children,e,o,d,t.ignoreWhitespace))}),!r.length&&e.length&&Ie(r,e,0,0,t.ignoreWhitespace),r},stringify:function(e){return e.reduce(function(e,t){return e+_e("",t)},"")}};function $e(e){return e&&(e.children||e.props&&e.props.children)}function Te(e){return e&&e.children?e.children:e.props&&e.props.children}function Me(e,t,o){if(""===t)return[];if(!e)return[t];var i={};!function e(t){"[object Array]"!==Object.prototype.toString.call(t)&&(t=[t]),t.forEach(function(t){"string"!=typeof t&&($e(t)?e(Te(t)):"object"!==r(t)||n.isValidElement(t)||Object.assign(i,t))})}(e),t=o.services.interpolator.interpolate(t,i,o.language);var a=function e(t,o){return"[object Array]"!==Object.prototype.toString.call(t)&&(t=[t]),"[object Array]"!==Object.prototype.toString.call(o)&&(o=[o]),o.reduce(function(o,i,a){if("tag"===i.type){var s=t[parseInt(i.name,10)]||{},u=n.isValidElement(s);if("string"==typeof s)o.push(s);else if($e(s)){var l=e(Te(s),i.children);s.dummy&&(s.children=l),o.push(n.cloneElement(s,c({},s.props,{key:a}),l))}else if("object"!==r(s)||u)o.push(s);else{var p=i.children[0]?i.children[0].content:null;p&&o.push(p)}}else"text"===i.type&&o.push(i.content);return o},[])}([{dummy:!0,children:e}],ke.parse("<0>".concat(t,"</0>")));return Te(a[0])}var Re=function(e){function t(){return o(this,t),y(this,l(t).apply(this,arguments))}return u(t,n.Component),a(t,[{key:"render",value:function(){var e=this.props,t=e.children,o=e.count,i=e.parent,a=e.i18nKey,s=e.tOptions,u=e.values,l=e.defaults,p=e.components,d=e.ns,y=e.i18n,h=e.t,v=(e.defaultNS,e.reportNS,e.lng,e.i18nOptions,f(e,["children","count","parent","i18nKey","tOptions","values","defaults","components","ns","i18n","t","defaultNS","reportNS","lng","i18nOptions"])),b=h||y.t.bind(y),g=y.options&&y.options.react||{},O=void 0!==i?i:g.defaultTransParent,S=l||function e(t,o,i){return o?("[object Array]"!==Object.prototype.toString.call(o)&&(o=[o]),o.forEach(function(o,i){var a="".concat(i);if("string"==typeof o)t="".concat(t).concat(o);else if($e(o))t="".concat(t,"<").concat(a,">").concat(e("",Te(o),i+1),"</").concat(a,">");else if(n.isValidElement(o))t="".concat(t,"<").concat(a,"></").concat(a,">");else if("object"===r(o)){var s=c({},o),u=s.format;delete s.format;var l=Object.keys(s);u&&1===l.length?t="".concat(t,"{{").concat(l[0],", ").concat(u,"}}"):1===l.length?t="".concat(t,"{{").concat(l[0],"}}"):m("react-i18next: the passed in object contained more than one variable - the object should look like {{ value, format }} where format is optional.",o)}else m("Trans: the passed in value is invalid - seems you passed in a variable like {number} - please pass in variables for interpolation as full objects like {{number}}.",o)}),t):""}("",t),w=g.hashTransKey,j=a||(w?w(S):S),x=j?b(j,c({},s,u,u?{}:{interpolation:{prefix:"#$?",suffix:"?$#"}},{defaultValue:S,count:o,ns:d})):S;if(g.exposeNamespace){var E="string"==typeof b.ns?b.ns:b.ns[0];if(a&&y.options&&y.options.nsSeparator&&a.indexOf(y.options.nsSeparator)>-1)E=a.split(y.options.nsSeparator)[0];b.ns&&(v["data-i18next-options"]=JSON.stringify({ns:E}))}return O?n.createElement(O,v,Me(p||t,x,y)):Me(p||t,x,y)}}]),t}(),Ae=Oe()(Re),De=function(e){function r(e){var t;return o(this,r),t=y(this,l(r).call(this,e)),O(e,!0),t}return u(r,t.Component),a(r,[{key:"componentWillReceiveProps",value:function(e){if(this.props.i18n!==e.i18n)throw new Error("[react-i18next][I18nextProvider]does not support changing the i18n object.")}},{key:"render",value:function(){var e=this.props,t=e.children,r=e.i18n,o=e.defaultNS,i=e.reportNS;return n.createElement(ge.Provider,{value:{i18n:r,defaultNS:o,reportNS:i,lng:r&&r.language,t:r&&r.t.bind(r)}},t)}}]),r}(),Ve=function(e){function r(e){var t;return o(this,r),t=y(this,l(r).call(this,e)),g('Interpolate is deprecated and will be removed in the next major version (v9.0.0). Usage can be replaced by the "Trans" component'),t}return u(r,t.Component),a(r,[{key:"render",value:function(){var e=this,t=this.props,r=t.i18n,o=t.t,i=t.i18nKey,a=t.options,s=t.className,u=t.style,l=this.props.parent||"span",p=this.props.regexp||r.services.interpolator.regexp,f=this.props.useDangerouslySetInnerHTML||!1,d=this.props.dangerouslySetInnerHTMLPartElement||"span",y=o(i,c({},{},a,{interpolation:{prefix:"#$?",suffix:"?$#"}}));if(!y||"string"!=typeof y)return n.createElement("noscript",null);var h=[];y.split(p).reduce(function(t,o,i){var a;if(i%2==0){if(0===o.length)return t;a=f?n.createElement(d,{dangerouslySetInnerHTML:{__html:o}}):o}else a=function(e,t){if(e.indexOf(r.options.interpolation.formatSeparator)<0)return void 0===t[e]&&r.services.logger.warn("interpolator: missed to pass in variable ".concat(e," for interpolating ").concat(y)),t[e];var n=e.split(r.options.interpolation.formatSeparator),o=n.shift().trim(),i=n.join(r.options.interpolation.formatSeparator).trim();return void 0===t[o]&&r.services.logger.warn("interpolator: missed to pass in variable ".concat(o," for interpolating ").concat(y)),r.options.interpolation.format(t[o],i,r.language)}(o,e.props);return t.push(a),t},h);var m={};if(r.options.react&&r.options.react.exposeNamespace){var v="string"==typeof o.ns?o.ns:o.ns[0];if(i&&r.options.nsSeparator&&i.indexOf(r.options.nsSeparator)>-1)v=i.split(r.options.nsSeparator)[0];o.ns&&(m["data-i18next-options"]=JSON.stringify({ns:v}))}return s&&(m.className=s),u&&(m.style=u),n.createElement.apply(this,[l,m].concat(h))}}]),r}(),Fe=Oe()(Ve);e.loadNamespaces=function(e){var t=e.components,n=e.i18n,r=w(t);return new Promise(function(e){n.loadNamespaces(r,e)})},e.withNamespaces=xe,e.translate=function(e,t){return g('translate was renamed to "withNamespaces" to make it more clear what the HOC does.'),xe(e,t)},e.NamespacesConsumer=je,e.I18n=function(e){return g('I18n was renamed to "NamespacesConsumer" to make it more clear what the render prop does.'),n.createElement(je,e)},e.Trans=Ae,e.I18nextProvider=De,e.withI18n=Oe,e.I18nContext=ge,e.reactI18nextModule=be,e.setDefaults=ye,e.getDefaults=he,e.setI18n=me,e.getI18n=ve,e.Interpolate=Fe,Object.defineProperty(e,"__esModule",{value:!0})});