reactlang.js
Version:
React.js localization component highly inspired by Laravel's Lang
3 lines (2 loc) • 37.3 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.ReactlangJs=t()}(this,function(){"use strict";"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function e(e,t){return e(t={exports:{}},t.exports),t.exports}var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;var o=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,o){for(var a,i,s=function(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),u=1;u<arguments.length;u++){a=Object(arguments[u]);for(var c in a)n.call(a,c)&&(s[c]=a[c]);if(t){i=t(a);for(var l=0;l<i.length;l++)r.call(a,i[l])&&(s[i[l]]=a[i[l]])}}return s},a={};"production"!==process.env.NODE_ENV&&Object.freeze(a);var i=a;function s(e){return function(){return e}}var u=function(){};u.thatReturns=s,u.thatReturnsFalse=s(!1),u.thatReturnsTrue=s(!0),u.thatReturnsNull=s(null),u.thatReturnsThis=function(){return this},u.thatReturnsArgument=function(e){return e};var c=u,l="function"==typeof Symbol&&Symbol.for,f=l?Symbol.for("react.element"):60103,p=l?Symbol.for("react.call"):60104,y=l?Symbol.for("react.return"):60105,d=l?Symbol.for("react.portal"):60106,h=l?Symbol.for("react.fragment"):60107,v="function"==typeof Symbol&&Symbol.iterator;function m(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.")).name="Invariant Violation",t.framesToPop=1,t}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}};function g(e,t,n){this.props=e,this.context=t,this.refs=i,this.updater=n||b}function w(e,t,n){this.props=e,this.context=t,this.refs=i,this.updater=n||b}function _(){}g.prototype.isReactComponent={},g.prototype.setState=function(e,t){"object"!=typeof e&&"function"!=typeof e&&null!=e&&m("85"),this.updater.enqueueSetState(this,e,t,"setState")},g.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},_.prototype=g.prototype;var k=w.prototype=new _;function O(e,t,n){this.props=e,this.context=t,this.refs=i,this.updater=n||b}k.constructor=w,o(k,g.prototype),k.isPureReactComponent=!0;var j=O.prototype=new _;j.constructor=O,o(j,g.prototype),j.unstable_isAsyncReactComponent=!0,j.render=function(){return this.props.children};var E={current:null},S=Object.prototype.hasOwnProperty,P={key:!0,ref:!0,__self:!0,__source:!0};function R(e,t,n){var r,o={},a=null,i=null;if(null!=t)for(r in void 0!==t.ref&&(i=t.ref),void 0!==t.key&&(a=""+t.key),t)S.call(t,r)&&!P.hasOwnProperty(r)&&(o[r]=t[r]);var s=arguments.length-2;if(1===s)o.children=n;else if(1<s){for(var u=Array(s),c=0;c<s;c++)u[c]=arguments[c+2];o.children=u}if(e&&e.defaultProps)for(r in s=e.defaultProps,s)void 0===o[r]&&(o[r]=s[r]);return{$$typeof:f,type:e,key:a,ref:i,props:o,_owner:E.current}}function x(e){return"object"==typeof e&&null!==e&&e.$$typeof===f}var A=/\/+/g,N=[];function T(e,t,n,r){if(N.length){var o=N.pop();return o.result=e,o.keyPrefix=t,o.func=n,o.context=r,o.count=0,o}return{result:e,keyPrefix:t,func:n,context:r,count:0}}function C(e){e.result=null,e.keyPrefix=null,e.func=null,e.context=null,e.count=0,10>N.length&&N.push(e)}function I(e,t,n,r){var o=typeof e;"undefined"!==o&&"boolean"!==o||(e=null);var a=!1;if(null===e)a=!0;else switch(o){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case f:case p:case y:case d:a=!0}}if(a)return n(r,e,""===t?"."+U(e,0):t),1;if(a=0,t=""===t?".":t+":",Array.isArray(e))for(var i=0;i<e.length;i++){var s=t+U(o=e[i],i);a+=I(o,s,n,r)}else if(null===e||void 0===e?s=null:(s=v&&e[v]||e["@@iterator"],s="function"==typeof s?s:null),"function"==typeof s)for(e=s.call(e),i=0;!(o=e.next()).done;)o=o.value,s=t+U(o,i++),a+=I(o,s,n,r);else"object"===o&&(n=""+e,m("31","[object Object]"===n?"object with keys {"+Object.keys(e).join(", ")+"}":n,""));return a}function U(e,t){return"object"==typeof e&&null!==e&&null!=e.key?(n=e.key,r={"=":"=0",":":"=2"},"$"+(""+n).replace(/[=:]/g,function(e){return r[e]})):t.toString(36);var n,r}function F(e,t){e.func.call(e.context,t,e.count++)}function q(e,t,n){var r=e.result,o=e.keyPrefix;e=e.func.call(e.context,t,e.count++),Array.isArray(e)?D(e,r,n,c.thatReturnsArgument):null!=e&&(x(e)&&(t=o+(!e.key||t&&t.key===e.key?"":(""+e.key).replace(A,"$&/")+"/")+n,e={$$typeof:f,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}),r.push(e))}function D(e,t,n,r,o){var a="";null!=n&&(a=(""+n).replace(A,"$&/")+"/"),t=T(t,a,r,o),null==e||I(e,"",q,t),C(t)}var $={Children:{map:function(e,t,n){if(null==e)return e;var r=[];return D(e,r,null,t,n),r},forEach:function(e,t,n){if(null==e)return e;t=T(null,null,t,n),null==e||I(e,"",F,t),C(t)},count:function(e){return null==e?0:I(e,"",c.thatReturnsNull,null)},toArray:function(e){var t=[];return D(e,t,null,c.thatReturnsArgument),t},only:function(e){return x(e)||m("143"),e}},Component:g,PureComponent:w,unstable_AsyncComponent:O,Fragment:h,createElement:R,cloneElement:function(e,t,n){var r=o({},e.props),a=e.key,i=e.ref,s=e._owner;if(null!=t){if(void 0!==t.ref&&(i=t.ref,s=E.current),void 0!==t.key&&(a=""+t.key),e.type&&e.type.defaultProps)var u=e.type.defaultProps;for(c in t)S.call(t,c)&&!P.hasOwnProperty(c)&&(r[c]=void 0===t[c]&&void 0!==u?u[c]:t[c])}var c=arguments.length-2;if(1===c)r.children=n;else if(1<c){u=Array(c);for(var l=0;l<c;l++)u[l]=arguments[l+2];r.children=u}return{$$typeof:f,type:e.type,key:a,ref:i,props:r,_owner:s}},createFactory:function(e){var t=R.bind(null,e);return t.type=e,t},isValidElement:x,version:"16.2.0",__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentOwner:E,assign:o}},V=Object.freeze({default:$}),L=V&&$||V,M=L.default?L.default:L,z=function(e){};"production"!==process.env.NODE_ENV&&(z=function(e){if(void 0===e)throw new Error("invariant requires an error message argument")});var W=function(e,t,n,r,o,a,i,s){if(z(t),!e){var u;if(void 0===t)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,o,a,i,s],l=0;(u=new Error(t.replace(/%s/g,function(){return c[l++]}))).name="Invariant Violation"}throw u.framesToPop=1,u}},K=c;if("production"!==process.env.NODE_ENV){K=function(e,t){if(void 0===t)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(0!==t.indexOf("Failed Composite propType: ")&&!e){for(var n=arguments.length,r=Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];(function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o=0,a="Warning: "+e.replace(/%s/g,function(){return n[o++]});"undefined"!=typeof console&&console.error(a);try{throw new Error(a)}catch(e){}}).apply(void 0,[t].concat(r))}}}var Y=K,B="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";if("production"!==process.env.NODE_ENV)var H=W,J=Y,G=B,Q={};var X=function(e,t,n,r,o){if("production"!==process.env.NODE_ENV)for(var a in e)if(e.hasOwnProperty(a)){var i;try{H("function"==typeof e[a],"%s: %s type `%s` is invalid; it must be a function, usually from the `prop-types` package, but received `%s`.",r||"React class",n,a,typeof e[a]),i=e[a](t,a,r,n,null,G)}catch(e){i=e}if(J(!i||i instanceof Error,"%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",r||"React class",n,a,typeof i),i instanceof Error&&!(i.message in Q)){Q[i.message]=!0;var s=o?o():"";J(!1,"Failed %s type: %s%s",n,i.message,null!=s?s:"")}}},Z=e(function(e){"production"!==process.env.NODE_ENV&&function(){var t=o,n=i,r=W,a=Y,s=c,u=X,l="function"==typeof Symbol&&Symbol.for,f=l?Symbol.for("react.element"):60103,p=l?Symbol.for("react.call"):60104,y=l?Symbol.for("react.return"):60105,d=l?Symbol.for("react.portal"):60106,h=l?Symbol.for("react.fragment"):60107,v="function"==typeof Symbol&&Symbol.iterator,m="@@iterator";function b(e){if(null===e||void 0===e)return null;var t=v&&e[v]||e[m];return"function"==typeof t?t:null}var g=function(e,t){if(void 0===t)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(!e){for(var n=arguments.length,r=Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];(function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o=0,a="Warning: "+e.replace(/%s/g,function(){return n[o++]});"undefined"!=typeof console&&console.warn(a);try{throw new Error(a)}catch(e){}}).apply(void 0,[t].concat(r))}},w={};function _(e,t){var n=e.constructor,r=n&&(n.displayName||n.name)||"ReactClass",o=r+"."+t;w[o]||(a(!1,"%s(...): Can only update a mounted or mounting component. This usually means you called %s() on an unmounted component. This is a no-op.\n\nPlease check the code for the %s component.",t,t,r),w[o]=!0)}var k={isMounted:function(e){return!1},enqueueForceUpdate:function(e,t,n){_(e,"forceUpdate")},enqueueReplaceState:function(e,t,n,r){_(e,"replaceState")},enqueueSetState:function(e,t,n,r){_(e,"setState")}};function O(e,t,r){this.props=e,this.context=t,this.refs=n,this.updater=r||k}O.prototype.isReactComponent={},O.prototype.setState=function(e,t){"object"!=typeof e&&"function"!=typeof e&&null!=e&&r(!1,"setState(...): takes an object of state variables to update or a function which returns an object of state variables."),this.updater.enqueueSetState(this,e,t,"setState")},O.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};var j={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]},E=function(e,t){Object.defineProperty(O.prototype,e,{get:function(){g(!1,"%s(...) is deprecated in plain JavaScript React classes. %s",t[0],t[1])}})};for(var S in j)j.hasOwnProperty(S)&&E(S,j[S]);function P(e,t,r){this.props=e,this.context=t,this.refs=n,this.updater=r||k}function R(){}R.prototype=O.prototype;var x=P.prototype=new R;function A(e,t,r){this.props=e,this.context=t,this.refs=n,this.updater=r||k}x.constructor=P,t(x,O.prototype),x.isPureReactComponent=!0;var N=A.prototype=new R;N.constructor=A,t(N,O.prototype),N.unstable_isAsyncReactComponent=!0,N.render=function(){return this.props.children};var T,C,I={current:null},U=Object.prototype.hasOwnProperty,F={key:!0,ref:!0,__self:!0,__source:!0};function q(e){if(U.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return void 0!==e.ref}function D(e){if(U.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}var $=function(e,t,n,r,o,a,i){var s={$$typeof:f,type:e,key:t,ref:n,props:i,_owner:a};return s._store={},Object.defineProperty(s._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(s,"_self",{configurable:!1,enumerable:!1,writable:!1,value:r}),Object.defineProperty(s,"_source",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.freeze&&(Object.freeze(s.props),Object.freeze(s)),s};function V(e,t,n){var r,o={},i=null,s=null,u=null,c=null;if(null!=t){q(t)&&(s=t.ref),D(t)&&(i=""+t.key),u=void 0===t.__self?null:t.__self,c=void 0===t.__source?null:t.__source;for(r in t)U.call(t,r)&&!F.hasOwnProperty(r)&&(o[r]=t[r])}var l,p,y,d,h,v,m=arguments.length-2;if(1===m)o.children=n;else if(m>1){for(var b=Array(m),g=0;g<m;g++)b[g]=arguments[g+2];Object.freeze&&Object.freeze(b),o.children=b}if(e&&e.defaultProps){var w=e.defaultProps;for(r in w)void 0===o[r]&&(o[r]=w[r])}if((i||s)&&(void 0===o.$$typeof||o.$$typeof!==f)){var _="function"==typeof e?e.displayName||e.name||"Unknown":e;i&&(d=o,h=_,(v=function(){T||(T=!0,a(!1,"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://fb.me/react-special-props)",h))}).isReactWarning=!0,Object.defineProperty(d,"key",{get:v,configurable:!0})),s&&(l=o,p=_,(y=function(){C||(C=!0,a(!1,"%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://fb.me/react-special-props)",p))}).isReactWarning=!0,Object.defineProperty(l,"ref",{get:y,configurable:!0}))}return $(e,i,s,u,c,I.current,o)}function L(e){return"object"==typeof e&&null!==e&&e.$$typeof===f}var M={};M.getCurrentStack=null,M.getStackAddendum=function(){var e=M.getCurrentStack;return e?e():null};var z=".",K=":";var B=!1,H=/\/+/g;function J(e){return(""+e).replace(H,"$&/")}var G=10,Q=[];function Z(e,t,n,r){if(Q.length){var o=Q.pop();return o.result=e,o.keyPrefix=t,o.func=n,o.context=r,o.count=0,o}return{result:e,keyPrefix:t,func:n,context:r,count:0}}function ee(e){e.result=null,e.keyPrefix=null,e.func=null,e.context=null,e.count=0,Q.length<G&&Q.push(e)}function te(e,t,n){return null==e?0:function e(t,n,o,i){var s=typeof t;"undefined"!==s&&"boolean"!==s||(t=null);var u,c=!1;if(null===t)c=!0;else switch(s){case"string":case"number":c=!0;break;case"object":switch(t.$$typeof){case f:case p:case y:case d:c=!0}}if(c)return o(i,t,""===n?z+ne(t,0):n),1;var l=0,h=""===n?z:n+K;if(Array.isArray(t))for(var v=0;v<t.length;v++)l+=e(u=t[v],h+ne(u,v),o,i);else{var m=b(t);if("function"==typeof m){m===t.entries&&(a(B,"Using Maps as children is unsupported and will likely yield unexpected results. Convert it to a sequence/iterable of keyed ReactElements instead.%s",M.getStackAddendum()),B=!0);for(var g,w=m.call(t),_=0;!(g=w.next()).done;)l+=e(u=g.value,h+ne(u,_++),o,i)}else if("object"===s){var k;k=" If you meant to render a collection of children, use an array instead."+M.getStackAddendum();var O=""+t;r(!1,"Objects are not valid as a React child (found: %s).%s","[object Object]"===O?"object with keys {"+Object.keys(t).join(", ")+"}":O,k)}}return l}(e,"",t,n)}function ne(e,t){return"object"==typeof e&&null!==e&&null!=e.key?(n=e.key,r={"=":"=0",":":"=2"},"$"+(""+n).replace(/[=:]/g,function(e){return r[e]})):t.toString(36);var n,r}function re(e,t,n){var r=e.func,o=e.context;r.call(o,t,e.count++)}function oe(e,t,n){var r,o,a=e.result,i=e.keyPrefix,u=e.func,c=e.context,l=u.call(c,t,e.count++);Array.isArray(l)?ae(l,a,n,s.thatReturnsArgument):null!=l&&(L(l)&&(r=l,o=i+(!l.key||t&&t.key===l.key?"":J(l.key)+"/")+n,l=$(r.type,o,r.ref,r._self,r._source,r._owner,r.props)),a.push(l))}function ae(e,t,n,r,o){var a="";null!=n&&(a=J(n)+"/");var i=Z(t,a,r,o);te(e,oe,i),ee(i)}function ie(e){var t=e.type;return"string"==typeof t?t:"function"==typeof t?t.displayName||t.name:null}var se=null,ue=!1,ce=function(){var e,t,n,r,o="";if(se){var a=null==(r=se)?"#empty":"string"==typeof r||"number"==typeof r?"#text":"string"==typeof r.type?r.type:r.type===h?"React.Fragment":r.type.displayName||r.type.name||"Unknown",i=se._owner;o+=(e=a,t=se._source,n=i&&ie(i),"\n in "+(e||"Unknown")+(t?" (at "+t.fileName.replace(/^.*[\\\/]/,"")+":"+t.lineNumber+")":n?" (created by "+n+")":""))}return o+=M.getStackAddendum()||""},le=new Map([["children",!0],["key",!0]]);function fe(){if(I.current){var e=ie(I.current);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}var pe={};function ye(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var n=function(e){var t=fe();if(!t){var n="string"==typeof e?e:e.displayName||e.name;n&&(t="\n\nCheck the top-level render call using <"+n+">.")}return t}(t);if(!pe[n]){pe[n]=!0;var r="";e&&e._owner&&e._owner!==I.current&&(r=" It was passed a child from "+ie(e._owner)+"."),se=e,a(!1,'Each child in an array or iterator should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.%s',n,r,ce()),se=null}}}function de(e,t){if("object"==typeof e)if(Array.isArray(e))for(var n=0;n<e.length;n++){var r=e[n];L(r)&&ye(r,t)}else if(L(e))e._store&&(e._store.validated=!0);else if(e){var o=b(e);if("function"==typeof o&&o!==e.entries)for(var a,i=o.call(e);!(a=i.next()).done;)L(a.value)&&ye(a.value,t)}}function he(e){var t=e.type;if("function"==typeof t){var n=t.displayName||t.name,r=t.propTypes;r?(se=e,u(r,e.props,"prop",n,ce),se=null):void 0===t.PropTypes||ue||(ue=!0,a(!1,"Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",n||"Unknown")),"function"==typeof t.getDefaultProps&&a(t.getDefaultProps.isReactClassApproved,"getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ve(e,t,n){var r="string"==typeof e||"function"==typeof e||"symbol"==typeof e||"number"==typeof e;if(!r){var o="";(void 0===e||"object"==typeof e&&null!==e&&0===Object.keys(e).length)&&(o+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var i=function(e){if(null!==e&&void 0!==e&&void 0!==e.__source){var t=e.__source;return"\n\nCheck your code at "+t.fileName.replace(/^.*[\\\/]/,"")+":"+t.lineNumber+"."}return""}(t);o+=i||fe(),o+=ce()||"",a(!1,"React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",null==e?e:typeof e,o)}var s=V.apply(this,arguments);if(null==s)return s;if(r)for(var u=2;u<arguments.length;u++)de(arguments[u],e);return"symbol"==typeof e&&e===h?function(e){se=e;var t=!0,n=!1,r=void 0;try{for(var o,i=Object.keys(e.props)[Symbol.iterator]();!(t=(o=i.next()).done);t=!0){var s=o.value;if(!le.has(s)){a(!1,"Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.%s",s,ce());break}}}catch(e){n=!0,r=e}finally{try{!t&&i.return&&i.return()}finally{if(n)throw r}}null!==e.ref&&a(!1,"Invalid attribute `ref` supplied to `React.Fragment`.%s",ce()),se=null}(s):he(s),s}var me={Children:{map:function(e,t,n){if(null==e)return e;var r=[];return ae(e,r,null,t,n),r},forEach:function(e,t,n){if(null==e)return e;var r=Z(null,null,t,n);te(e,re,r),ee(r)},count:function(e,t){return te(e,s.thatReturnsNull,null)},toArray:function(e){var t=[];return ae(e,t,null,s.thatReturnsArgument),t},only:function(e){return L(e)||r(!1,"React.Children.only expected to receive a single React element child."),e}},Component:O,PureComponent:P,unstable_AsyncComponent:A,Fragment:h,createElement:ve,cloneElement:function(e,n,r){for(var o=function(e,n,r){var o,a=t({},e.props),i=e.key,s=e.ref,u=e._self,c=e._source,l=e._owner;if(null!=n){var f;q(n)&&(s=n.ref,l=I.current),D(n)&&(i=""+n.key),e.type&&e.type.defaultProps&&(f=e.type.defaultProps);for(o in n)U.call(n,o)&&!F.hasOwnProperty(o)&&(void 0===n[o]&&void 0!==f?a[o]=f[o]:a[o]=n[o])}var p=arguments.length-2;if(1===p)a.children=r;else if(p>1){for(var y=Array(p),d=0;d<p;d++)y[d]=arguments[d+2];a.children=y}return $(e.type,i,s,u,c,l,a)}.apply(this,arguments),a=2;a<arguments.length;a++)de(arguments[a],o.type);return he(o),o},createFactory:function(e){var t=ve.bind(null,e);return t.type=e,Object.defineProperty(t,"type",{enumerable:!1,get:function(){return g(!1,"Factory.type is deprecated. Access the class directly before passing it to createFactory."),Object.defineProperty(this,"type",{value:e}),e}}),t},isValidElement:L,version:"16.2.0",__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentOwner:I,assign:t}};t(me.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,{ReactDebugCurrentFrame:M,ReactComponentTreeHook:{}});var be=Object.freeze({default:me}),ge=be&&me||be,we=ge.default?ge.default:ge;e.exports=we}()}),ee=e(function(e){"production"===process.env.NODE_ENV?e.exports=M:e.exports=Z}),te=function(e,t){var n="function"==typeof Symbol&&Symbol.iterator,r="@@iterator";var a="<<anonymous>>",i={array:f("array"),bool:f("boolean"),func:f("function"),number:f("number"),object:f("object"),string:f("string"),symbol:f("symbol"),any:l(c.thatReturnsNull),arrayOf:function(e){return l(function(t,n,r,o,a){if("function"!=typeof e)return new u("Property `"+a+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var i=t[n];if(!Array.isArray(i)){var s=y(i);return new u("Invalid "+o+" `"+a+"` of type `"+s+"` supplied to `"+r+"`, expected an array.")}for(var c=0;c<i.length;c++){var l=e(i,c,r,o,a+"["+c+"]",B);if(l instanceof Error)return l}return null})},element:function(){return l(function(t,n,r,o,a){var i=t[n];if(!e(i)){var s=y(i);return new u("Invalid "+o+" `"+a+"` of type `"+s+"` supplied to `"+r+"`, expected a single ReactElement.")}return null})}(),instanceOf:function(e){return l(function(t,n,r,o,i){if(!(t[n]instanceof e)){var s=e.name||a,c=function(e){if(!e.constructor||!e.constructor.name)return a;return e.constructor.name}(t[n]);return new u("Invalid "+o+" `"+i+"` of type `"+c+"` supplied to `"+r+"`, expected instance of `"+s+"`.")}return null})},node:function(){return l(function(e,t,n,r,o){if(!p(e[t]))return new u("Invalid "+r+" `"+o+"` supplied to `"+n+"`, expected a ReactNode.");return null})}(),objectOf:function(e){return l(function(t,n,r,o,a){if("function"!=typeof e)return new u("Property `"+a+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var i=t[n],s=y(i);if("object"!==s)return new u("Invalid "+o+" `"+a+"` of type `"+s+"` supplied to `"+r+"`, expected an object.");for(var c in i)if(i.hasOwnProperty(c)){var l=e(i,c,r,o,a+"."+c,B);if(l instanceof Error)return l}return null})},oneOf:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&Y(!1,"Invalid argument supplied to oneOf, expected an instance of array."),c.thatReturnsNull;return l(function(t,n,r,o,a){for(var i=t[n],c=0;c<e.length;c++)if(s(i,e[c]))return null;var l=JSON.stringify(e);return new u("Invalid "+o+" `"+a+"` of value `"+i+"` supplied to `"+r+"`, expected one of "+l+".")})},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&Y(!1,"Invalid argument supplied to oneOfType, expected an instance of array."),c.thatReturnsNull;for(var t=0;t<e.length;t++){var n=e[t];if("function"!=typeof n)return Y(!1,"Invalid argument supplied to oneOfType. Expected an array of check functions, but received %s at index %s.",h(n),t),c.thatReturnsNull}return l(function(t,n,r,o,a){for(var i=0;i<e.length;i++){var s=e[i];if(null==s(t,n,r,o,a,B))return null}return new u("Invalid "+o+" `"+a+"` supplied to `"+r+"`.")})},shape:function(e){return l(function(t,n,r,o,a){var i=t[n],s=y(i);if("object"!==s)return new u("Invalid "+o+" `"+a+"` of type `"+s+"` supplied to `"+r+"`, expected `object`.");for(var c in e){var l=e[c];if(l){var f=l(i,c,r,o,a+"."+c,B);if(f)return f}}return null})},exact:function(e){return l(function(t,n,r,a,i){var s=t[n],c=y(s);if("object"!==c)return new u("Invalid "+a+" `"+i+"` of type `"+c+"` supplied to `"+r+"`, expected `object`.");var l=o({},t[n],e);for(var f in l){var p=e[f];if(!p)return new u("Invalid "+a+" `"+i+"` key `"+f+"` supplied to `"+r+"`.\nBad object: "+JSON.stringify(t[n],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var d=p(s,f,r,a,i+"."+f,B);if(d)return d}return null})}};function s(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function u(e){this.message=e,this.stack=""}function l(e){if("production"!==process.env.NODE_ENV)var n={},r=0;function o(o,i,s,c,l,f,p){if(c=c||a,f=f||s,p!==B)if(t)W(!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");else if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var y=c+":"+s;!n[y]&&r<3&&(Y(!1,"You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.",f,c),n[y]=!0,r++)}return null==i[s]?o?null===i[s]?new u("The "+l+" `"+f+"` is marked as required in `"+c+"`, but its value is `null`."):new u("The "+l+" `"+f+"` is marked as required in `"+c+"`, but its value is `undefined`."):null:e(i,s,c,l,f)}var i=o.bind(null,!1);return i.isRequired=o.bind(null,!0),i}function f(e){return l(function(t,n,r,o,a,i){var s=t[n];return y(s)!==e?new u("Invalid "+o+" `"+a+"` of type `"+d(s)+"` supplied to `"+r+"`, expected `"+e+"`."):null})}function p(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(p);if(null===t||e(t))return!0;var o=function(e){var t=e&&(n&&e[n]||e[r]);if("function"==typeof t)return t}(t);if(!o)return!1;var a,i=o.call(t);if(o!==t.entries){for(;!(a=i.next()).done;)if(!p(a.value))return!1}else for(;!(a=i.next()).done;){var s=a.value;if(s&&!p(s[1]))return!1}return!0;default:return!1}}function y(e){var t,n=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":(t=e,"symbol"===n||"Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol?"symbol":n)}function d(e){if(void 0===e||null===e)return""+e;var t=y(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function h(e){var t=d(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return u.prototype=Error.prototype,i.checkPropTypes=X,i.PropTypes=i,i},ne=e(function(e){if("production"!==process.env.NODE_ENV){var t="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103;e.exports=te(function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},!0)}else e.exports=function(){function e(e,t,n,r,o,a){a!==B&&W(!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=c,n.PropTypes=n,n}()}),re=e(function(e,t){var n;n=function(){function e(e){return"-Inf"===e?-1/0:"+Inf"===e||"Inf"===e||"*"===e?1/0:parseInt(e,10)}var t=/^({\s*(\-?\d+(\.\d+)?[\s*,\s*\-?\d+(\.\d+)?]*)\s*})|([\[\]])\s*(-Inf|\*|\-?\d+(\.\d+)?)\s*,\s*(\+?Inf|\*|\-?\d+(\.\d+)?)\s*([\[\]])$/,n=/({\s*(\-?\d+(\.\d+)?[\s*,\s*\-?\d+(\.\d+)?]*)\s*})|([\[\]])\s*(-Inf|\*|\-?\d+(\.\d+)?)\s*,\s*(\+?Inf|\*|\-?\d+(\.\d+)?)\s*([\[\]])/,r="en",o=function(e){e=e||{},this.locale=e.locale||function(){if("undefined"!=typeof document&&document.documentElement)return document.documentElement.lang}()||r,this.fallback=e.fallback,this.messages=e.messages};return o.prototype.setMessages=function(e){this.messages=e},o.prototype.getLocale=function(){return this.locale||this.fallback},o.prototype.setLocale=function(e){this.locale=e},o.prototype.getFallback=function(){return this.fallback},o.prototype.setFallback=function(e){this.fallback=e},o.prototype.has=function(e,t){return!("string"!=typeof e||!this.messages)&&null!==this._getMessage(e,t)},o.prototype.get=function(e,t,n){if(!this.has(e,n))return e;var r=this._getMessage(e,n);return null===r?e:(t&&(r=this._applyReplacements(r,t)),r)},o.prototype.trans=function(e,t){return this.get(e,t)},o.prototype.choice=function(e,t,r,o){(r=void 0!==r?r:{}).count=t;var a=this.get(e,r,o);if(null===a||void 0===a)return a;for(var i=a.split("|"),s=[],u=0;u<i.length;u++)if(i[u]=i[u].trim(),n.test(i[u])){var c=i[u].split(/\s/);s.push(c.shift()),i[u]=c.join(" ")}if(1===i.length)return a;for(var l=0;l<s.length;l++)if(this._testInterval(t,s[l]))return i[l];return o=o||this._getLocale(e),i[this._getPluralForm(t,o)]},o.prototype.transChoice=function(e,t,n){return this.choice(e,t,n)},o.prototype._parseKey=function(e,t){if("string"!=typeof e||"string"!=typeof t)return null;var n=e.split("."),r=n[0].replace(/\//g,".");return{source:t+"."+r,sourceFallback:this.getFallback()+"."+r,entries:n.slice(1)}},o.prototype._getMessage=function(e,t){if(t=t||this.getLocale(),e=this._parseKey(e,t),void 0===this.messages[e.source]&&void 0===this.messages[e.sourceFallback])return null;for(var n=this.messages[e.source],r=e.entries.slice(),o="";r.length&&void 0!==n;){void 0!==n[o=o?o.concat(".",r.shift()):r.shift()]&&(n=n[o],o="")}if("string"!=typeof n&&this.messages[e.sourceFallback])for(n=this.messages[e.sourceFallback],r=e.entries.slice(),o="";r.length&&void 0!==n;){n[o=o?o.concat(".",r.shift()):r.shift()]&&(n=n[o],o="")}return"string"!=typeof n?null:n},o.prototype._getLocale=function(e){return e=this._parseKey(e,this.locale),this.messages[e.source]?this.locale:this.messages[e.sourceFallback]?this.fallback:null},o.prototype._findMessageInTree=function(e,t){for(;e.length&&void 0!==t;){var n=e.join(".");if(t[n]){t=t[n];break}t=t[e.shift()]}return t},o.prototype._sortReplacementKeys=function(e,t){return t.length-e.length},o.prototype._applyReplacements=function(e,t){return Object.keys(t).sort(this._sortReplacementKeys).forEach(function(n){e=e.replace(new RegExp(":"+n,"gi"),function(e){var r=t[n];return e===e.toUpperCase()?r.toUpperCase():e===e.replace(/\w/i,function(e){return e.toUpperCase()})?r.charAt(0).toUpperCase()+r.slice(1):r})}),e},o.prototype._testInterval=function(n,r){if("string"!=typeof r)throw"Invalid interval: should be a string.";var o=(r=r.trim()).match(t);if(!o)throw"Invalid interval: "+r;if(!o[2]){var a=(o=o.filter(function(e){return!!e}))[1],i=e(o[2]);i===1/0&&(i=-1/0);var s=e(o[3]),u=o[4];return("["===a?n>=i:n>i)&&("]"===u?n<=s:n<s)}for(var c=o[2].split(","),l=0;l<c.length;l++)if(parseInt(c[l],10)===n)return!0;return!1},o.prototype._getPluralForm=function(e,t){switch(t){case"az":case"bo":case"dz":case"id":case"ja":case"jv":case"ka":case"km":case"kn":case"ko":case"ms":case"th":case"tr":case"vi":case"zh":return 0;case"af":case"bn":case"bg":case"ca":case"da":case"de":case"el":case"en":case"eo":case"es":case"et":case"eu":case"fa":case"fi":case"fo":case"fur":case"fy":case"gl":case"gu":case"ha":case"he":case"hu":case"is":case"it":case"ku":case"lb":case"ml":case"mn":case"mr":case"nah":case"nb":case"ne":case"nl":case"nn":case"no":case"om":case"or":case"pa":case"pap":case"ps":case"pt":case"so":case"sq":case"sv":case"sw":case"ta":case"te":case"tk":case"ur":case"zu":return 1==e?0:1;case"am":case"bh":case"fil":case"fr":case"gun":case"hi":case"hy":case"ln":case"mg":case"nso":case"xbr":case"ti":case"wa":return 0===e||1===e?0:1;case"be":case"bs":case"hr":case"ru":case"sr":case"uk":return e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2;case"cs":case"sk":return 1==e?0:e>=2&&e<=4?1:2;case"ga":return 1==e?0:2==e?1:2;case"lt":return e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2;case"sl":return e%100==1?0:e%100==2?1:e%100==3||e%100==4?2:3;case"mk":return e%10==1?0:1;case"mt":return 1==e?0:0===e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3;case"lv":return 0===e?0:e%10==1&&e%100!=11?1:2;case"pl":return 1==e?0:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?1:2;case"cy":return 1==e?0:2==e?1:8==e||11==e?2:3;case"ro":return 1==e?0:0===e||e%100>0&&e%100<20?1:2;case"ar":return 0===e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11&&e%100<=99?4:5;default:return 0}},o},e.exports=n()}),oe="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},ae=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},ie=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}}(),se=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},ue=function(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)},ce=function(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},le=function(e){function t(e){ae(this,t);var n=ce(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.messages=e.messages,n}return ue(t,re),ie(t,[{key:"_parseKey",value:function(e){if("string"!=typeof e)return null;var t=e.split("."),n=t[0].replace(/\//g,".");return{source:n,sourceFallback:n,entries:t.slice(1)}}},{key:"getAndReplace",value:function(e,t){return"string"!=typeof e?null:"object"!==(void 0===t?"undefined":oe(t))?null:this.choice(e,1,t)}}]),t}(),fe=function(e){function t(e){ae(this,t);var n=ce(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.langHelper=new le({messages:e.lang}),n.applyPropsAndContentToChildren=n.applyPropsAndContentToChildren.bind(n),n.handleAttributes=n.handleAttributes.bind(n),n.handleNestedAttributes=n.handleNestedAttributes.bind(n),n.mungeString=n.mungeString.bind(n),n.removeUnwantedProps=n.removeUnwantedProps.bind(n),n}return ue(t,e),ie(t,[{key:"applyPropsAndContentToChildren",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return ee.Children.map(this.props.children,function(n){var r=se({},n.props,e);for(var o in n.props)e[o]&&(e[o]instanceof Object?r[o]=se({},n.props[o],e[o]):"string"==typeof e[o]&&(r[o]=n.props[o]+" "+e[o]));if(e.nestedAttributes)for(var a in n.props)if(e.nestedAttributes[a]){var i=n.props[a];i&&i instanceof Object&&r[a]&&(r[a]=se({},i,e[a]))}var s=ee.cloneElement(n,r,t);return n.props.children&&(s=ee.cloneElement(n,r,n.props.children)),s})}},{key:"handleAttributes",value:function(e){var t=se({},e);for(var n in t){var r=t[n];if(r&&void 0===r.transKey)t[n]=this.handleAttributes(r);else if(r){var o=this.mungeString(r);t[n]=o}}return t}},{key:"handleNestedAttributes",value:function(e){var t=se({},e);for(var n in t.nestedAttributes){var r=t.nestedAttributes[n];if(r)for(var o in r){var a=r[o];if(a){var i=this.mungeString(a);t[n]={},t[n][o]=i}}}return t}},{key:"mungeString",value:function(e){var t=e.transKey,n=e.count,r=e.replacements,o=void 0;if(void 0!==n)o=this.langHelper.choice(t,n,r);else if(void 0===n&&void 0!==r){if(!this.props.handleError)throw new Error("Replacements were given without the required count property");this.props.handleError({message:"Replacements were given without the required count property",name:"No count supplied"})}else o=this.langHelper.get(t);return this.props.reference&&this.props.reference(o),o}},{key:"removeUnwantedProps",value:function(){var e=se({},this.props);return delete e.store,delete e.storeSubscription,delete e.dispatch,delete e.lang,e}},{key:"render",value:function(){if(this.props.children&&ee.Children.count(this.props.children)>1){if(!this.props.handleError)throw new Error("The Translatable component only allows a single child");this.props.handleError({message:"The Translatable component only allows a single child",name:"Too many children"})}var e=this.removeUnwantedProps(),t=e.content;if(delete e.content,delete e.handleError,e.className?e.className="translatable "+e.className:e.className="translatable",e.attributes){var n=this.handleAttributes(e.attributes);delete(e=se({},e,n)).attributes}if(e.nestedAttributes&&(e=this.handleNestedAttributes(e)),this.props.reference&&delete e.reference,this.props.children){delete e.children;var r=void 0;if(t){var o=this.mungeString(t);r=this.applyPropsAndContentToChildren(e,o)}else r=this.applyPropsAndContentToChildren(e);var a=r[0];return ee.createElement(a.type,a.props)}return ee.createElement("span",e,this.mungeString(t))}}]),t}(ee.Component);return fe.propTypes={attributes:ne.object,children:ne.node,className:ne.string,content:ne.shape({transKey:ne.string.isRequired,count:ne.number,replacements:ne.objectOf(ne.oneOfType([ne.string,ne.number]))}),handleError:ne.func,id:ne.oneOfType([ne.number,ne.string]),lang:ne.objectOf(ne.object).isRequired,reference:ne.func},fe});
//# sourceMappingURL=reactlang.js.umd.min.js.map