Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

intl-messageformat

Package Overview
Dependencies
Maintainers
10
Versions
268
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

intl-messageformat - npm Package Compare versions

Comparing version 6.0.4 to 6.1.0

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

# [6.1.0](https://github.com/formatjs/formatjs/compare/intl-messageformat@6.0.4...intl-messageformat@6.1.0) (2019-08-08)
### Features
* **intl-messageformat:** rm core bundle for now ([5311ac2](https://github.com/formatjs/formatjs/commit/5311ac2))
## [6.0.4](https://github.com/formatjs/formatjs/compare/intl-messageformat@6.0.3...intl-messageformat@6.0.4) (2019-08-07)

@@ -8,0 +19,0 @@

2

dist/core.js

@@ -146,3 +146,3 @@ "use strict";

IntlMessageFormat.defaultLocale = 'en';
IntlMessageFormat.__parse = undefined;
IntlMessageFormat.__parse = intl_messageformat_parser_1.parse;
// Default format options used as the prototype of the `formats` provided to the

@@ -149,0 +149,0 @@ // constructor. These are used when constructing the internal Intl.NumberFormat

@@ -11,7 +11,5 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
var intl_messageformat_parser_1 = require("intl-messageformat-parser");
var core_1 = require("./core");
core_1.default.__parse = intl_messageformat_parser_1.parse;
__export(require("./formatters"));
__export(require("./core"));
exports.default = core_1.default;

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).IntlMessageFormat={})}(this,function(e){"use strict";var tt,t;function v(e){return e.type===tt.literal}function d(e){return e.type===tt.argument}function y(e){return e.type===tt.number}function g(e){return e.type===tt.date}function b(e){return e.type===tt.time}function A(e){return e.type===tt.select}function x(e){return e.type===tt.plural}(t=tt||(tt={}))[t.literal=0]="literal",t[t.argument=1]="argument",t[t.number=2]="number",t[t.date=3]="date",t[t.time=4]="time",t[t.select=5]="select",t[t.plural=6]="plural";var n,o,r=(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),rt=function(){return(rt=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var u in t=arguments[r])Object.prototype.hasOwnProperty.call(t,u)&&(e[u]=t[u]);return e}).apply(this,arguments)},nt=(o=Error,r(a,o),a.buildMessage=function(e,t){function r(e){return e.charCodeAt(0).toString(16).toUpperCase()}function n(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(e){return"\\x0"+r(e)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(e){return"\\x"+r(e)})}function u(e){return e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(e){return"\\x0"+r(e)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(e){return"\\x"+r(e)})}function o(e){switch(e.type){case"literal":return'"'+n(e.text)+'"';case"class":var t=e.parts.map(function(e){return Array.isArray(e)?u(e[0])+"-"+u(e[1]):u(e)});return"["+(e.inverted?"^":"")+t+"]";case"any":return"any character";case"end":return"end of input";case"other":return e.description}}return"Expected "+function(e){var t,r,n=e.map(o);if(n.sort(),0<n.length){for(r=t=1;t<n.length;t++)n[t-1]!==n[t]&&(n[r]=n[t],r++);n.length=r}switch(n.length){case 1:return n[0];case 2:return n[0]+" or "+n[1];default:return n.slice(0,-1).join(", ")+", or "+n[n.length-1]}}(e)+" but "+((a=t)?'"'+n(a)+'"':"end of input")+" found.";var a},a);function a(e,t,r,n){var u=o.call(this)||this;return u.message=e,u.expected=t,u.found=r,u.location=n,u.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(u,a),u}var f=function(f,e){e=void 0!==e?e:{};var t,r,n,u,p={},o={start:Re},a=Re,i=function(e){return e.join("")},s=function(e){return rt({type:tt.literal,value:e},et())},c=Pe("argumentElement"),h="{",m=Me("{",!1),v="}",d=Me("}",!1),l=function(e){return rt({type:tt.argument,value:e},et())},y=Pe("numberSkeletonId"),g=/^['\/{}]/,b=ke(["'","/","{","}"],!1,!1),A={type:"any"},x=Pe("numberSkeletonTokenOption"),w="/",C=Me("/",!1),F=function(e){return e},O=Pe("numberSkeletonToken"),E=function(e,t){return{stem:e,options:t}},_=function(e){return rt({type:0,tokens:e},et())},T="::",j=Me("::",!1),M=function(e){return e},k=function(e){return e.replace(/\s*$/,"")},P=",",D=Me(",",!1),I="number",N=Me("number",!1),R=function(e,t,r){return rt({type:"number"===t?tt.number:"date"===t?tt.date:tt.time,style:r&&r[2],value:e},et())},S=function(e){return rt({type:1,pattern:e},et())},B="date",L=Me("date",!1),X="time",H=Me("time",!1),Z="plural",$=Me("plural",!1),z="selectordinal",J=Me("selectordinal",!1),U="offset:",q=Me("offset:",!1),G=function(e,t,r,n){return rt({type:tt.plural,pluralType:"plural"===t?"cardinal":"ordinal",value:e,offset:r?r[2]:0,options:n.reduce(function(e,t){var r=t.id,n=t.value,u=t.location;return e[r]={value:n,location:u},e},{})},et())},K="select",Q=Me("select",!1),V=function(e,t){return rt({type:tt.select,value:e,options:t.reduce(function(e,t){var r=t.id,n=t.value,u=t.location;return e[r]={value:n,location:u},e},{})},et())},W="=",Y=Me("=",!1),ee=function(e,t){return rt({id:e,value:t},et())},te=function(e,t){return rt({id:e,value:t},et())},re=/^[\t-\r \x85\u200E\u200F\u2028\u2029]/,ne=ke([["\t","\r"]," ","…","‎","‏","\u2028","\u2029"],!1,!1),ue=/^[!-\/:-@[-\^`{-~\xA1-\xA7\xA9\xAB\xAC\xAE\xB0\xB1\xB6\xBB\xBF\xD7\xF7\u2010-\u2027\u2030-\u203E\u2041-\u2053\u2055-\u205E\u2190-\u245F\u2500-\u2775\u2794-\u2BFF\u2E00-\u2E7F\u3001-\u3003\u3008-\u3020\u3030\uFD3E\uFD3F\uFE45\uFE46]/,oe=ke([["!","/"],[":","@"],["[","^"],"`",["{","~"],["¡","§"],"©","«","¬","®","°","±","¶","»","¿","×","÷",["‐","‧"],["‰","‾"],["⁁","⁓"],["⁕","⁞"],["←","⑟"],["─","❵"],["➔","⯿"],["⸀","⹿"],["、","〃"],["〈","〠"],"〰","﴾","﴿","﹅","﹆"],!1,!1),ae=Pe("optional whitespace"),ie=/^[0-9]/,se=ke([["0","9"]],!1,!1),ce=function(e){return parseInt(e.join(""),10)},le="'",fe=Me("'",!1),pe=Pe("double apostrophes"),he="''",me=Me("''",!1),ve=function(){return"'"},de=/^[{}]/,ye=ke(["{","}"],!1,!1),ge=/^[^']/,be=ke(["'"],!0,!1),Ae=function(e,t){return e+t.replace("''","'")},xe=/^[^{}]/,we=ke(["{","}"],!0,!1),Ce=Pe("keyword"),Fe=0,Oe=0,Ee=[{line:1,column:1}],_e=0,Te=[],je=0;if(void 0!==e.startRule){if(!(e.startRule in o))throw new Error("Can't start parsing from rule \""+e.startRule+'".');a=o[e.startRule]}function Me(e,t){return{type:"literal",text:e,ignoreCase:t}}function ke(e,t,r){return{type:"class",parts:e,inverted:t,ignoreCase:r}}function Pe(e){return{type:"other",description:e}}function De(e){var t,r=Ee[e];if(r)return r;for(t=e-1;!Ee[t];)t--;for(r={line:(r=Ee[t]).line,column:r.column};t<e;)10===f.charCodeAt(t)?(r.line++,r.column=1):r.column++,t++;return Ee[e]=r}function Ie(e,t){var r=De(e),n=De(t);return{start:{offset:e,line:r.line,column:r.column},end:{offset:t,line:n.line,column:n.column}}}function Ne(e){Fe<_e||(_e<Fe&&(_e=Fe,Te=[]),Te.push(e))}function Re(){return Se()}function Se(){var e,t;for(e=[],t=Be();t!==p;)e.push(t),t=Be();return e}function Be(){var e;return(e=function(){var e,t;e=Fe,(t=Le())!==p&&(Oe=e,t=s(t));return e=t}())===p&&(e=function(){var e,t,r,n,u;je++,e=Fe,123===f.charCodeAt(Fe)?(t=h,Fe++):(t=p,0===je&&Ne(m));e=t!==p?(r=Ge(),r!==p?(n=Xe())!==p?Ge()!==p?(125===f.charCodeAt(Fe)?(u=v,Fe++):(u=p,0===je&&Ne(d)),u!==p?(Oe=e,t=l(n)):(Fe=e,p)):(Fe=e,p):(Fe=e,p):(Fe=e,p)):(Fe=e,p);je--,e===p&&(t=p,0===je&&Ne(c));return e}())===p&&(e=function(){var e;(e=function(){var e,t,r,n,u,o,a,i,s,c;e=Fe,123===f.charCodeAt(Fe)?(t=h,Fe++):(t=p,0===je&&Ne(m));e=t!==p?(r=Ge(),r!==p?(n=Xe())!==p?Ge()!==p?(44===f.charCodeAt(Fe)?(u=P,Fe++):(u=p,0===je&&Ne(D)),u!==p?Ge()!==p?(f.substr(Fe,6)===I?(o=I,Fe+=6):(o=p,0===je&&Ne(N)),o!==p?Ge()!==p?(a=Fe,44===f.charCodeAt(Fe)?(i=P,Fe++):(i=p,0===je&&Ne(D)),(a=i!==p?(s=Ge())!==p?(c=function(){var e,t,r;e=Fe,f.substr(Fe,2)===T?(t=T,Fe+=2):(t=p,0===je&&Ne(j));e=t!==p?(r=function(){var e,t,r;if(e=Fe,t=[],(r=$e())!==p)for(;r!==p;)t.push(r),r=$e();else t=p;t!==p&&(Oe=e,t=_(t));return e=t}(),r!==p?(Oe=e,t=M(r)):(Fe=e,p)):(Fe=e,p);e===p&&(e=Fe,(t=Le())!==p&&(Oe=e,t=k(t)),e=t);return e}())!==p?i=[i,s,c]:(Fe=a,p):(Fe=a,p):(Fe=a,p))===p&&(a=null),a!==p?(i=Ge())!==p?(125===f.charCodeAt(Fe)?(s=v,Fe++):(s=p,0===je&&Ne(d)),s!==p?(Oe=e,t=R(n,o,a)):(Fe=e,p)):(Fe=e,p):(Fe=e,p)):(Fe=e,p):(Fe=e,p)):(Fe=e,p):(Fe=e,p)):(Fe=e,p):(Fe=e,p):(Fe=e,p)):(Fe=e,p);return e}())===p&&(e=function(){var e,t,r,n,u,o,a,i,s,c;e=Fe,123===f.charCodeAt(Fe)?(t=h,Fe++):(t=p,0===je&&Ne(m));e=t!==p?(r=Ge(),r!==p?(n=Xe())!==p?Ge()!==p?(44===f.charCodeAt(Fe)?(u=P,Fe++):(u=p,0===je&&Ne(D)),u!==p?Ge()!==p?(f.substr(Fe,4)===B?(o=B,Fe+=4):(o=p,0===je&&Ne(L)),o===p&&(f.substr(Fe,4)===X?(o=X,Fe+=4):(o=p,0===je&&Ne(H))),o!==p?Ge()!==p?(a=Fe,44===f.charCodeAt(Fe)?(i=P,Fe++):(i=p,0===je&&Ne(D)),(a=i!==p?(s=Ge())!==p?(c=function(){var e,t,r;e=Fe,f.substr(Fe,2)===T?(t=T,Fe+=2):(t=p,0===je&&Ne(j));e=t!==p?(r=function(){var e,t;e=Fe,(t=Le())!==p&&(Oe=e,t=S(t));return e=t}(),r!==p?(Oe=e,t=M(r)):(Fe=e,p)):(Fe=e,p);e===p&&(e=Fe,(t=Le())!==p&&(Oe=e,t=k(t)),e=t);return e}())!==p?i=[i,s,c]:(Fe=a,p):(Fe=a,p):(Fe=a,p))===p&&(a=null),a!==p?(i=Ge())!==p?(125===f.charCodeAt(Fe)?(s=v,Fe++):(s=p,0===je&&Ne(d)),s!==p?(Oe=e,t=R(n,o,a)):(Fe=e,p)):(Fe=e,p):(Fe=e,p)):(Fe=e,p):(Fe=e,p)):(Fe=e,p):(Fe=e,p)):(Fe=e,p):(Fe=e,p):(Fe=e,p)):(Fe=e,p);return e}());return e}())===p&&(e=function(){var e,t,r,n,u,o,a,i,s,c,l;e=Fe,123===f.charCodeAt(Fe)?(t=h,Fe++):(t=p,0===je&&Ne(m));if(t!==p)if(Ge()!==p)if((r=Xe())!==p)if(Ge()!==p)if(44===f.charCodeAt(Fe)?(n=P,Fe++):(n=p,0===je&&Ne(D)),n!==p)if(Ge()!==p)if(f.substr(Fe,6)===Z?(u=Z,Fe+=6):(u=p,0===je&&Ne($)),u===p&&(f.substr(Fe,13)===z?(u=z,Fe+=13):(u=p,0===je&&Ne(J))),u!==p)if(Ge()!==p)if(44===f.charCodeAt(Fe)?(o=P,Fe++):(o=p,0===je&&Ne(D)),o!==p)if(Ge()!==p)if(a=Fe,f.substr(Fe,7)===U?(i=U,Fe+=7):(i=p,0===je&&Ne(q)),(a=i!==p?(s=Ge())!==p?(c=Ke())!==p?i=[i,s,c]:(Fe=a,p):(Fe=a,p):(Fe=a,p))===p&&(a=null),a!==p)if((i=Ge())!==p){if(s=[],(c=Je())!==p)for(;c!==p;)s.push(c),c=Je();else s=p;e=s!==p?(c=Ge())!==p?(125===f.charCodeAt(Fe)?(l=v,Fe++):(l=p,0===je&&Ne(d)),l!==p?(Oe=e,t=G(r,u,a,s)):(Fe=e,p)):(Fe=e,p):(Fe=e,p)}else Fe=e,e=p;else Fe=e,e=p;else Fe=e,e=p;else Fe=e,e=p;else Fe=e,e=p;else Fe=e,e=p;else Fe=e,e=p;else Fe=e,e=p;else Fe=e,e=p;else Fe=e,e=p;else Fe=e,e=p;else Fe=e,e=p;return e}())===p&&(e=function(){var e,t,r,n,u,o,a,i,s;e=Fe,123===f.charCodeAt(Fe)?(t=h,Fe++):(t=p,0===je&&Ne(m));if(t!==p)if(Ge()!==p)if((r=Xe())!==p)if(Ge()!==p)if(44===f.charCodeAt(Fe)?(n=P,Fe++):(n=p,0===je&&Ne(D)),n!==p)if(Ge()!==p)if(f.substr(Fe,6)===K?(u=K,Fe+=6):(u=p,0===je&&Ne(Q)),u!==p)if(Ge()!==p)if(44===f.charCodeAt(Fe)?(o=P,Fe++):(o=p,0===je&&Ne(D)),o!==p)if(Ge()!==p){if(a=[],(i=ze())!==p)for(;i!==p;)a.push(i),i=ze();else a=p;e=a!==p?(i=Ge())!==p?(125===f.charCodeAt(Fe)?(s=v,Fe++):(s=p,0===je&&Ne(d)),s!==p?(Oe=e,t=V(r,a)):(Fe=e,p)):(Fe=e,p):(Fe=e,p)}else Fe=e,e=p;else Fe=e,e=p;else Fe=e,e=p;else Fe=e,e=p;else Fe=e,e=p;else Fe=e,e=p;else Fe=e,e=p;else Fe=e,e=p;else Fe=e,e=p;else Fe=e,e=p;return e}()),e}function Le(){var e,t,r;if(e=Fe,t=[],(r=Qe())===p&&(r=Ve())===p&&(r=We()),r!==p)for(;r!==p;)t.push(r),(r=Qe())===p&&(r=Ve())===p&&(r=We());else t=p;return t!==p&&(Oe=e,t=i(t)),e=t}function Xe(){var e,t;return e=Fe,(t=Ke())===p&&(t=Ye()),e=t!==p?f.substring(e,Fe):t}function He(){var e,t,r,n,u;if(je++,t=[],n=r=e=Fe,je++,(u=Ue())===p&&(g.test(f.charAt(Fe))?(u=f.charAt(Fe),Fe++):(u=p,0===je&&Ne(b))),je--,(r=(n=u===p?void 0:(Fe=n,p))!==p?(f.length>Fe?(u=f.charAt(Fe),Fe++):(u=p,0===je&&Ne(A)),u!==p?n=[n,u]:(Fe=r,p)):(Fe=r,p))!==p)for(;r!==p;)t.push(r),n=r=Fe,je++,(u=Ue())===p&&(g.test(f.charAt(Fe))?(u=f.charAt(Fe),Fe++):(u=p,0===je&&Ne(b))),je--,r=(n=u===p?void 0:(Fe=n,p))!==p?(f.length>Fe?(u=f.charAt(Fe),Fe++):(u=p,0===je&&Ne(A)),u!==p?n=[n,u]:(Fe=r,p)):(Fe=r,p);else t=p;return e=t!==p?f.substring(e,Fe):t,je--,e===p&&(t=p,0===je&&Ne(y)),e}function Ze(){var e,t,r;return je++,e=Fe,47===f.charCodeAt(Fe)?(t=w,Fe++):(t=p,0===je&&Ne(C)),e=t!==p&&(r=He())!==p?(Oe=e,t=F(r)):(Fe=e,p),je--,e===p&&(t=p,0===je&&Ne(x)),e}function $e(){var e,t,r,n;if(je++,e=Fe,Ge()!==p)if((t=He())!==p){for(r=[],n=Ze();n!==p;)r.push(n),n=Ze();e=r!==p?(Oe=e,E(t,r)):(Fe=e,p)}else Fe=e,e=p;else Fe=e,e=p;return je--,e===p&&(p,0===je&&Ne(O)),e}function ze(){var e,t,r,n,u;return e=Fe,e=Ge()!==p&&(t=Ye())!==p&&Ge()!==p?(123===f.charCodeAt(Fe)?(r=h,Fe++):(r=p,0===je&&Ne(m)),r!==p&&(n=Se())!==p?(125===f.charCodeAt(Fe)?(u=v,Fe++):(u=p,0===je&&Ne(d)),u!==p?(Oe=e,ee(t,n)):(Fe=e,p)):(Fe=e,p)):(Fe=e,p)}function Je(){var e,t,r,n,u;return e=Fe,e=Ge()!==p&&(t=function(){var e,t,r,n;return t=e=Fe,61===f.charCodeAt(Fe)?(r=W,Fe++):(r=p,0===je&&Ne(Y)),(e=(t=r!==p&&(n=Ke())!==p?r=[r,n]:(Fe=t,p))!==p?f.substring(e,Fe):t)===p&&(e=Ye()),e}())!==p&&Ge()!==p?(123===f.charCodeAt(Fe)?(r=h,Fe++):(r=p,0===je&&Ne(m)),r!==p&&(n=Se())!==p?(125===f.charCodeAt(Fe)?(u=v,Fe++):(u=p,0===je&&Ne(d)),u!==p?(Oe=e,te(t,n)):(Fe=e,p)):(Fe=e,p)):(Fe=e,p)}function Ue(){var e;return re.test(f.charAt(Fe))?(e=f.charAt(Fe),Fe++):(e=p,0===je&&Ne(ne)),e}function qe(){var e;return ue.test(f.charAt(Fe))?(e=f.charAt(Fe),Fe++):(e=p,0===je&&Ne(oe)),e}function Ge(){var e,t,r;for(je++,e=Fe,t=[],r=Ue();r!==p;)t.push(r),r=Ue();return e=t!==p?f.substring(e,Fe):t,je--,e===p&&(t=p,0===je&&Ne(ae)),e}function Ke(){var e,t,r;if(e=Fe,t=[],ie.test(f.charAt(Fe))?(r=f.charAt(Fe),Fe++):(r=p,0===je&&Ne(se)),r!==p)for(;r!==p;)t.push(r),ie.test(f.charAt(Fe))?(r=f.charAt(Fe),Fe++):(r=p,0===je&&Ne(se));else t=p;return t!==p&&(Oe=e,t=ce(t)),e=t}function Qe(){var e,t;return je++,e=Fe,f.substr(Fe,2)===he?(t=he,Fe+=2):(t=p,0===je&&Ne(me)),t!==p&&(Oe=e,t=ve()),je--,(e=t)===p&&(t=p,0===je&&Ne(pe)),e}function Ve(){var e,t,r,n,u,o;if(e=Fe,39===f.charCodeAt(Fe)?(t=le,Fe++):(t=p,0===je&&Ne(fe)),t!==p)if(de.test(f.charAt(Fe))?(r=f.charAt(Fe),Fe++):(r=p,0===je&&Ne(ye)),r!==p){for(n=Fe,u=[],f.substr(Fe,2)===he?(o=he,Fe+=2):(o=p,0===je&&Ne(me)),o===p&&(ge.test(f.charAt(Fe))?(o=f.charAt(Fe),Fe++):(o=p,0===je&&Ne(be)));o!==p;)u.push(o),f.substr(Fe,2)===he?(o=he,Fe+=2):(o=p,0===je&&Ne(me)),o===p&&(ge.test(f.charAt(Fe))?(o=f.charAt(Fe),Fe++):(o=p,0===je&&Ne(be)));e=(n=u!==p?f.substring(n,Fe):u)!==p?(39===f.charCodeAt(Fe)?(u=le,Fe++):(u=p,0===je&&Ne(fe)),u!==p?(Oe=e,t=Ae(r,n)):(Fe=e,p)):(Fe=e,p)}else Fe=e,e=p;else Fe=e,e=p;return e}function We(){var e,t;return e=Fe,xe.test(f.charAt(Fe))?(t=f.charAt(Fe),Fe++):(t=p,0===je&&Ne(we)),e=t!==p?f.substring(e,Fe):t}function Ye(){var e,t,r,n,u;if(je++,t=[],n=r=e=Fe,je++,(u=Ue())===p&&(u=qe()),je--,(r=(n=u===p?void 0:(Fe=n,p))!==p?(f.length>Fe?(u=f.charAt(Fe),Fe++):(u=p,0===je&&Ne(A)),u!==p?n=[n,u]:(Fe=r,p)):(Fe=r,p))!==p)for(;r!==p;)t.push(r),n=r=Fe,je++,(u=Ue())===p&&(u=qe()),je--,r=(n=u===p?void 0:(Fe=n,p))!==p?(f.length>Fe?(u=f.charAt(Fe),Fe++):(u=p,0===je&&Ne(A)),u!==p?n=[n,u]:(Fe=r,p)):(Fe=r,p);else t=p;return e=t!==p?f.substring(e,Fe):t,je--,e===p&&(t=p,0===je&&Ne(Ce)),e}function et(){return e&&e.captureLocation?{location:Ie(Oe,Fe)}:{}}if((t=a())!==p&&Fe===f.length)return t;throw t!==p&&Fe<f.length&&Ne({type:"end"}),r=Te,n=_e<f.length?f.charAt(_e):null,u=_e<f.length?Ie(_e,_e+1):Ie(_e,_e),new nt(nt.buildMessage(r,n),r,n,u)},p=/(^|[^\\])#/g;function i(e){return JSON.stringify(e.map(function(e){return e&&"object"==typeof e?function(r){return Object.keys(r).sort().map(function(e){var t;return(t={})[e]=r[e],t})}(e):e}))}var u,s,h,c=function(o,a){return void 0===a&&(a={}),function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=i(t),u=n&&a[n];return u||(u=new((e=o).bind.apply(e,[void 0].concat(t))),n&&(a[n]=u)),u}},l=(u=function(e,t){return(u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}u(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),w=/\\#/g,C=(s=Error,l(m,s),m);function m(e,t){var r=s.call(this,e)||this;return r.variableId=t,r}function F(e,t,r,n,u,o){if(1===e.length&&v(e[0]))return[{type:0,value:e[0].value.replace(w,"#")}];for(var a=[],i=0,s=e;i<s.length;i++){var c=s[i];if(v(c))a.push({type:0,value:c.value.replace(w,"#")});else{var l=c.value;if(!(u&&l in u))throw new C('The intl string context variable "'+l+'" was not provided to the string "'+o+'"');var f=u[l];if(d(c))f&&"string"!=typeof f&&"number"!=typeof f?a.push({type:1,value:f}):a.push({type:0,value:"string"==typeof f||"number"==typeof f?String(f):""});else if(g(c)){var p="string"==typeof c.style?n.date[c.style]:void 0;a.push({type:0,value:r.getDateTimeFormat(t,p).format(f)})}else if(b(c)){p="string"==typeof c.style?n.time[c.style]:void 0;a.push({type:0,value:r.getDateTimeFormat(t,p).format(f)})}else if(y(c)){p="string"==typeof c.style?n.number[c.style]:void 0;a.push({type:0,value:r.getNumberFormat(t,p).format(f)})}else if(A(c)){if(!(h=c.options[f]||c.options.other))throw new RangeError('Invalid values for "'+c.value+'": "'+f+'". Options are "'+Object.keys(c.options).join('", "')+'"');a.push.apply(a,F(h.value,t,r,n,u))}else if(x(c)){var h;if(!(h=c.options["="+f])){var m=r.getPluralRules(t,{type:c.pluralType}).select(f-(c.offset||0));h=c.options[m]||c.options.other}if(!h)throw new RangeError('Invalid values for "'+c.value+'": "'+f+'". Options are "'+Object.keys(c.options).join('", "')+'"');a.push.apply(a,F(h.value,t,r,n,u))}else;}}return function(e){return e.length<2?e:e.reduce(function(e,t){var r=e[e.length-1];return r&&0===r.type&&0===t.type?r.value+=t.value:e.push(t),e},[])}(a)}function O(e,t,r,n,u,o){var a=F(e,t,r,n,u,o);return 1===a.length?a[0].value:a.reduce(function(e,t){return e+t.value},"")}var E="@@",_=/@@(.*?)@@/g,T=0;function j(e,t){return e.split(_).filter(Boolean).map(function(e){return t[e]||e})}function M(e,t,r,n,i,u){var o=F(e,t,r,n,i,u),s={},a=o.reduce(function(e,t){if("string"==typeof t.value||0===t.type)return e+t.value;var r=Date.now()+"_"+ ++T;return s[r]=t.value,e+(E+r)+E},"");if(!~a.indexOf("<"))return j(a,s);if(!i)throw new C("Message has placeholders but no values was given");if("undefined"==typeof DOMParser)throw new C("Cannot format XML message without DOMParser");h||(h=new DOMParser);var c=h.parseFromString("<template>"+a+"</template>","application/xml");if(c.getElementsByTagName("parsererror").length)throw new C("Malformed XML message "+c.getElementsByTagName("parsererror")[0].innerHTML);var l=c.firstChild;if(!l)throw new C("Malformed XML message "+a);return Object.keys(i).filter(function(e){return!!c.getElementsByTagName(e).length}).length?Array.prototype.slice.call(l.childNodes).reduce(function(e,t){var r=t.tagName,n=t.outerHTML,u=t.textContent;if(!r){var o=j(u||"",s);return e.concat(o)}if(!i[r])return 1===(o=j(n,s)).length?e.concat([o[0]]):e.concat(o);var a=i[r];if("function"!=typeof a)return e.concat([a]);if(null==u)return e.concat([a(u||void 0)]);o=j(u,s);return e.concat([a.apply(void 0,o)])},[]):j(a,s)}var k=function(){return(k=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var u in t=arguments[r])Object.prototype.hasOwnProperty.call(t,u)&&(e[u]=t[u]);return e}).apply(this,arguments)};function P(r,n){return n?Object.keys(r).reduce(function(e,t){return e[t]=function(r,n){return n?k({},r||{},n||{},Object.keys(r).reduce(function(e,t){return e[t]=k({},r[t],n[t]||{}),e},{})):r}(r[t],n[t]),e},k({},r)):r}function D(e){return void 0===e&&(e={number:{},dateTime:{},pluralRules:{}}),{getNumberFormat:c(Intl.NumberFormat,e.number),getDateTimeFormat:c(Intl.DateTimeFormat,e.dateTime),getPluralRules:c(Intl.PluralRules,e.pluralRules)}}var I=(N.defaultLocale="en",N.__parse=void 0,N.formats={number:{currency:{style:"currency"},percent:{style:"percent"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},N);function N(e,t,r,n){var u=this;if(void 0===t&&(t=N.defaultLocale),this.formatterCache={number:{},dateTime:{},pluralRules:{}},this.format=function(e){return O(u.ast,u.locale,u.formatters,u.formats,e,u.message)},this.formatToParts=function(e){return F(u.ast,u.locale,u.formatters,u.formats,e,u.message)},this.formatXMLMessage=function(e){return M(u.ast,u.locale,u.formatters,u.formats,e,u.message)},this.resolvedOptions=function(){return{locale:u.locale}},this.getAst=function(){return u.ast},"string"==typeof e){if(this.message=e,!N.__parse)throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");this.ast=N.__parse(e)}else this.ast=e;if(!Array.isArray(this.ast))throw new TypeError("A message must be provided as a String or AST.");this.formats=P(N.formats,r),this.locale=function(e){"string"==typeof e&&(e=[e]);try{return Intl.NumberFormat.supportedLocalesOf(e,{localeMatcher:"best fit"})[0]}catch(e){return I.defaultLocale}}(t||[]),this.formatters=n&&n.formatters||D(this.formatterCache),function r(e,n,u,o){e.filter(function(e){return!d(e)&&!v(e)}).forEach(function(t){if(g(t)){var e="string"==typeof t.style?o.date[t.style]:void 0;u.getDateTimeFormat(n,e)}b(t)&&(e="string"==typeof t.style?o.time[t.style]:void 0,u.getDateTimeFormat(n,e)),y(t)&&(e="string"==typeof t.style?o.number[t.style]:void 0,u.getNumberFormat(n,e)),A(t)&&Object.keys(t.options).forEach(function(e){return r(t.options[e].value,n,u,o)}),x(t)&&(u.getPluralRules(n,{type:t.pluralType}),Object.keys(t.options).forEach(function(e){return r(t.options[e].value,n,u,o)}))})}(this.ast,this.locale,this.formatters,this.formats)}I.__parse=function(e,t){var r=f(e,t);return t&&!1===t.normalizeHashtagInPlural||function l(e){e.forEach(function(c){(x(c)||A(c))&&Object.keys(c.options).forEach(function(e){for(var t,r=c.options[e],n=-1,u=void 0,o=0;o<r.value.length;o++){var a=r.value[o];if(v(a)&&p.test(a.value)){n=o,u=a;break}}if(u){var i=u.value.replace(p,"$1{"+c.value+", number}"),s=f(i);(t=r.value).splice.apply(t,[n,1].concat(s))}l(r.value)})})}(r),r},e.IntlMessageFormat=I,e.createDefaultFormatters=D,e.default=I,e.formatToParts=F,e.formatToString=O,e.formatXMLMessage=M,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).IntlMessageFormat={})}(this,function(e){"use strict";var it,t;function v(e){return e.type===it.literal}function d(e){return e.type===it.argument}function y(e){return e.type===it.number}function g(e){return e.type===it.date}function A(e){return e.type===it.time}function b(e){return e.type===it.select}function x(e){return e.type===it.plural}(t=it||(it={}))[t.literal=0]="literal",t[t.argument=1]="argument",t[t.number=2]="number",t[t.date=3]="date",t[t.time=4]="time",t[t.select=5]="select",t[t.plural=6]="plural";var n,o,r=(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),st=function(){return(st=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var u in t=arguments[r])Object.prototype.hasOwnProperty.call(t,u)&&(e[u]=t[u]);return e}).apply(this,arguments)},ct=(o=Error,r(a,o),a.buildMessage=function(e,t){function r(e){return e.charCodeAt(0).toString(16).toUpperCase()}function n(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(e){return"\\x0"+r(e)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(e){return"\\x"+r(e)})}function u(e){return e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(e){return"\\x0"+r(e)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(e){return"\\x"+r(e)})}function o(e){switch(e.type){case"literal":return'"'+n(e.text)+'"';case"class":var t=e.parts.map(function(e){return Array.isArray(e)?u(e[0])+"-"+u(e[1]):u(e)});return"["+(e.inverted?"^":"")+t+"]";case"any":return"any character";case"end":return"end of input";case"other":return e.description}}return"Expected "+function(e){var t,r,n=e.map(o);if(n.sort(),0<n.length){for(r=t=1;t<n.length;t++)n[t-1]!==n[t]&&(n[r]=n[t],r++);n.length=r}switch(n.length){case 1:return n[0];case 2:return n[0]+" or "+n[1];default:return n.slice(0,-1).join(", ")+", or "+n[n.length-1]}}(e)+" but "+((a=t)?'"'+n(a)+'"':"end of input")+" found.";var a},a);function a(e,t,r,n){var u=o.call(this)||this;return u.message=e,u.expected=t,u.found=r,u.location=n,u.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(u,a),u}var f=function(f,e){e=void 0!==e?e:{};var t,r,n,u,p={},o={start:Ze},a=Ze,i=function(e){return e.join("")},s=function(e){return st({type:it.literal,value:e},at())},c=Re("argumentElement"),h="{",m=Ie("{",!1),v="}",d=Ie("}",!1),l=function(e){return st({type:it.argument,value:e},at())},y=Re("numberSkeletonId"),g=/^['\/{}]/,A=Ne(["'","/","{","}"],!1,!1),b={type:"any"},x=Re("numberSkeletonTokenOption"),C="/",w=Ie("/",!1),F=function(e){return e},O=Re("numberSkeletonToken"),E=function(e,t){return{stem:e,options:t}},T=function(e){return st({type:0,tokens:e},at())},_="::",j=Ie("::",!1),M=function(e){return e},k=function(e){return e.replace(/\s*$/,"")},P=",",D=Ie(",",!1),I="number",N=Ie("number",!1),R=function(e,t,r){return st({type:"number"===t?it.number:"date"===t?it.date:it.time,style:r&&r[2],value:e},at())},S="'",B=Ie("'",!1),L=/^[^']/,Z=Ne(["'"],!0,!1),z=/^[^a-zA-Z'{}]/,X=Ne([["a","z"],["A","Z"],"'","{","}"],!0,!1),H=/^[a-zA-Z]/,$=Ne([["a","z"],["A","Z"]],!1,!1),J=function(e){return st({type:1,pattern:e},at())},U="date",q=Ie("date",!1),G="time",K=Ie("time",!1),Q="plural",V=Ie("plural",!1),W="selectordinal",Y=Ie("selectordinal",!1),ee="offset:",te=Ie("offset:",!1),re=function(e,t,r,n){return st({type:it.plural,pluralType:"plural"===t?"cardinal":"ordinal",value:e,offset:r?r[2]:0,options:n.reduce(function(e,t){var r=t.id,n=t.value,u=t.location;return e[r]={value:n,location:u},e},{})},at())},ne="select",ue=Ie("select",!1),oe=function(e,t){return st({type:it.select,value:e,options:t.reduce(function(e,t){var r=t.id,n=t.value,u=t.location;return e[r]={value:n,location:u},e},{})},at())},ae="=",ie=Ie("=",!1),se=function(e,t){return st({id:e,value:t},at())},ce=function(e,t){return st({id:e,value:t},at())},le=/^[\t-\r \x85\u200E\u200F\u2028\u2029]/,fe=Ne([["\t","\r"]," ","…","‎","‏","\u2028","\u2029"],!1,!1),pe=/^[!-\/:-@[-\^`{-~\xA1-\xA7\xA9\xAB\xAC\xAE\xB0\xB1\xB6\xBB\xBF\xD7\xF7\u2010-\u2027\u2030-\u203E\u2041-\u2053\u2055-\u205E\u2190-\u245F\u2500-\u2775\u2794-\u2BFF\u2E00-\u2E7F\u3001-\u3003\u3008-\u3020\u3030\uFD3E\uFD3F\uFE45\uFE46]/,he=Ne([["!","/"],[":","@"],["[","^"],"`",["{","~"],["¡","§"],"©","«","¬","®","°","±","¶","»","¿","×","÷",["‐","‧"],["‰","‾"],["⁁","⁓"],["⁕","⁞"],["←","⑟"],["─","❵"],["➔","⯿"],["⸀","⹿"],["、","〃"],["〈","〠"],"〰","﴾","﴿","﹅","﹆"],!1,!1),me=Re("optional whitespace"),ve=/^[0-9]/,de=Ne([["0","9"]],!1,!1),ye=function(e){return parseInt(e.join(""),10)},ge=Re("double apostrophes"),Ae="''",be=Ie("''",!1),xe=function(){return"'"},Ce=/^[{}]/,we=Ne(["{","}"],!1,!1),Fe=function(e,t){return e+t.replace("''","'")},Oe=/^[^{}]/,Ee=Ne(["{","}"],!0,!1),Te=Re("keyword"),_e=0,je=0,Me=[{line:1,column:1}],ke=0,Pe=[],De=0;if(void 0!==e.startRule){if(!(e.startRule in o))throw new Error("Can't start parsing from rule \""+e.startRule+'".');a=o[e.startRule]}function Ie(e,t){return{type:"literal",text:e,ignoreCase:t}}function Ne(e,t,r){return{type:"class",parts:e,inverted:t,ignoreCase:r}}function Re(e){return{type:"other",description:e}}function Se(e){var t,r=Me[e];if(r)return r;for(t=e-1;!Me[t];)t--;for(r={line:(r=Me[t]).line,column:r.column};t<e;)10===f.charCodeAt(t)?(r.line++,r.column=1):r.column++,t++;return Me[e]=r}function Be(e,t){var r=Se(e),n=Se(t);return{start:{offset:e,line:r.line,column:r.column},end:{offset:t,line:n.line,column:n.column}}}function Le(e){_e<ke||(ke<_e&&(ke=_e,Pe=[]),Pe.push(e))}function Ze(){return ze()}function ze(){var e,t;for(e=[],t=Xe();t!==p;)e.push(t),t=Xe();return e}function Xe(){var e;return(e=function(){var e,t;e=_e,(t=He())!==p&&(je=e,t=s(t));return e=t}())===p&&(e=function(){var e,t,r,n,u;De++,e=_e,123===f.charCodeAt(_e)?(t=h,_e++):(t=p,0===De&&Le(m));e=t!==p?(r=et(),r!==p?(n=$e())!==p?et()!==p?(125===f.charCodeAt(_e)?(u=v,_e++):(u=p,0===De&&Le(d)),u!==p?(je=e,t=l(n)):(_e=e,p)):(_e=e,p):(_e=e,p):(_e=e,p)):(_e=e,p);De--,e===p&&(t=p,0===De&&Le(c));return e}())===p&&(e=function(){var e;(e=function(){var e,t,r,n,u,o,a,i,s,c;e=_e,123===f.charCodeAt(_e)?(t=h,_e++):(t=p,0===De&&Le(m));e=t!==p?(r=et(),r!==p?(n=$e())!==p?et()!==p?(44===f.charCodeAt(_e)?(u=P,_e++):(u=p,0===De&&Le(D)),u!==p?et()!==p?(f.substr(_e,6)===I?(o=I,_e+=6):(o=p,0===De&&Le(N)),o!==p?et()!==p?(a=_e,44===f.charCodeAt(_e)?(i=P,_e++):(i=p,0===De&&Le(D)),(a=i!==p?(s=et())!==p?(c=function(){var e,t,r;e=_e,f.substr(_e,2)===_?(t=_,_e+=2):(t=p,0===De&&Le(j));e=t!==p?(r=function(){var e,t,r;if(e=_e,t=[],(r=qe())!==p)for(;r!==p;)t.push(r),r=qe();else t=p;t!==p&&(je=e,t=T(t));return e=t}(),r!==p?(je=e,t=M(r)):(_e=e,p)):(_e=e,p);e===p&&(e=_e,(t=He())!==p&&(je=e,t=k(t)),e=t);return e}())!==p?i=[i,s,c]:(_e=a,p):(_e=a,p):(_e=a,p))===p&&(a=null),a!==p?(i=et())!==p?(125===f.charCodeAt(_e)?(s=v,_e++):(s=p,0===De&&Le(d)),s!==p?(je=e,t=R(n,o,a)):(_e=e,p)):(_e=e,p):(_e=e,p)):(_e=e,p):(_e=e,p)):(_e=e,p):(_e=e,p)):(_e=e,p):(_e=e,p):(_e=e,p)):(_e=e,p);return e}())===p&&(e=function(){var e,t,r,n,u,o,a,i,s,c;e=_e,123===f.charCodeAt(_e)?(t=h,_e++):(t=p,0===De&&Le(m));e=t!==p?(r=et(),r!==p?(n=$e())!==p?et()!==p?(44===f.charCodeAt(_e)?(u=P,_e++):(u=p,0===De&&Le(D)),u!==p?et()!==p?(f.substr(_e,4)===U?(o=U,_e+=4):(o=p,0===De&&Le(q)),o===p&&(f.substr(_e,4)===G?(o=G,_e+=4):(o=p,0===De&&Le(K))),o!==p?et()!==p?(a=_e,44===f.charCodeAt(_e)?(i=P,_e++):(i=p,0===De&&Le(D)),(a=i!==p?(s=et())!==p?(c=function(){var e,t,r;e=_e,f.substr(_e,2)===_?(t=_,_e+=2):(t=p,0===De&&Le(j));e=t!==p?(r=function(){var e,t,r,n;t=e=_e,r=[],(n=Ge())===p&&(n=Ke());if(n!==p)for(;n!==p;)r.push(n),(n=Ge())===p&&(n=Ke());else r=p;t=r!==p?f.substring(t,_e):r;t!==p&&(je=e,t=J(t));return e=t}(),r!==p?(je=e,t=M(r)):(_e=e,p)):(_e=e,p);e===p&&(e=_e,(t=He())!==p&&(je=e,t=k(t)),e=t);return e}())!==p?i=[i,s,c]:(_e=a,p):(_e=a,p):(_e=a,p))===p&&(a=null),a!==p?(i=et())!==p?(125===f.charCodeAt(_e)?(s=v,_e++):(s=p,0===De&&Le(d)),s!==p?(je=e,t=R(n,o,a)):(_e=e,p)):(_e=e,p):(_e=e,p)):(_e=e,p):(_e=e,p)):(_e=e,p):(_e=e,p)):(_e=e,p):(_e=e,p):(_e=e,p)):(_e=e,p);return e}());return e}())===p&&(e=function(){var e,t,r,n,u,o,a,i,s,c,l;e=_e,123===f.charCodeAt(_e)?(t=h,_e++):(t=p,0===De&&Le(m));if(t!==p)if(et()!==p)if((r=$e())!==p)if(et()!==p)if(44===f.charCodeAt(_e)?(n=P,_e++):(n=p,0===De&&Le(D)),n!==p)if(et()!==p)if(f.substr(_e,6)===Q?(u=Q,_e+=6):(u=p,0===De&&Le(V)),u===p&&(f.substr(_e,13)===W?(u=W,_e+=13):(u=p,0===De&&Le(Y))),u!==p)if(et()!==p)if(44===f.charCodeAt(_e)?(o=P,_e++):(o=p,0===De&&Le(D)),o!==p)if(et()!==p)if(a=_e,f.substr(_e,7)===ee?(i=ee,_e+=7):(i=p,0===De&&Le(te)),(a=i!==p?(s=et())!==p?(c=tt())!==p?i=[i,s,c]:(_e=a,p):(_e=a,p):(_e=a,p))===p&&(a=null),a!==p)if((i=et())!==p){if(s=[],(c=Ve())!==p)for(;c!==p;)s.push(c),c=Ve();else s=p;e=s!==p?(c=et())!==p?(125===f.charCodeAt(_e)?(l=v,_e++):(l=p,0===De&&Le(d)),l!==p?(je=e,t=re(r,u,a,s)):(_e=e,p)):(_e=e,p):(_e=e,p)}else _e=e,e=p;else _e=e,e=p;else _e=e,e=p;else _e=e,e=p;else _e=e,e=p;else _e=e,e=p;else _e=e,e=p;else _e=e,e=p;else _e=e,e=p;else _e=e,e=p;else _e=e,e=p;else _e=e,e=p;return e}())===p&&(e=function(){var e,t,r,n,u,o,a,i,s;e=_e,123===f.charCodeAt(_e)?(t=h,_e++):(t=p,0===De&&Le(m));if(t!==p)if(et()!==p)if((r=$e())!==p)if(et()!==p)if(44===f.charCodeAt(_e)?(n=P,_e++):(n=p,0===De&&Le(D)),n!==p)if(et()!==p)if(f.substr(_e,6)===ne?(u=ne,_e+=6):(u=p,0===De&&Le(ue)),u!==p)if(et()!==p)if(44===f.charCodeAt(_e)?(o=P,_e++):(o=p,0===De&&Le(D)),o!==p)if(et()!==p){if(a=[],(i=Qe())!==p)for(;i!==p;)a.push(i),i=Qe();else a=p;e=a!==p?(i=et())!==p?(125===f.charCodeAt(_e)?(s=v,_e++):(s=p,0===De&&Le(d)),s!==p?(je=e,t=oe(r,a)):(_e=e,p)):(_e=e,p):(_e=e,p)}else _e=e,e=p;else _e=e,e=p;else _e=e,e=p;else _e=e,e=p;else _e=e,e=p;else _e=e,e=p;else _e=e,e=p;else _e=e,e=p;else _e=e,e=p;else _e=e,e=p;return e}()),e}function He(){var e,t,r;if(e=_e,t=[],(r=rt())===p&&(r=nt())===p&&(r=ut()),r!==p)for(;r!==p;)t.push(r),(r=rt())===p&&(r=nt())===p&&(r=ut());else t=p;return t!==p&&(je=e,t=i(t)),e=t}function $e(){var e,t;return e=_e,(t=tt())===p&&(t=ot()),e=t!==p?f.substring(e,_e):t}function Je(){var e,t,r,n,u;if(De++,t=[],n=r=e=_e,De++,(u=We())===p&&(g.test(f.charAt(_e))?(u=f.charAt(_e),_e++):(u=p,0===De&&Le(A))),De--,(r=(n=u===p?void 0:(_e=n,p))!==p?(f.length>_e?(u=f.charAt(_e),_e++):(u=p,0===De&&Le(b)),u!==p?n=[n,u]:(_e=r,p)):(_e=r,p))!==p)for(;r!==p;)t.push(r),n=r=_e,De++,(u=We())===p&&(g.test(f.charAt(_e))?(u=f.charAt(_e),_e++):(u=p,0===De&&Le(A))),De--,r=(n=u===p?void 0:(_e=n,p))!==p?(f.length>_e?(u=f.charAt(_e),_e++):(u=p,0===De&&Le(b)),u!==p?n=[n,u]:(_e=r,p)):(_e=r,p);else t=p;return e=t!==p?f.substring(e,_e):t,De--,e===p&&(t=p,0===De&&Le(y)),e}function Ue(){var e,t,r;return De++,e=_e,47===f.charCodeAt(_e)?(t=C,_e++):(t=p,0===De&&Le(w)),e=t!==p&&(r=Je())!==p?(je=e,t=F(r)):(_e=e,p),De--,e===p&&(t=p,0===De&&Le(x)),e}function qe(){var e,t,r,n;if(De++,e=_e,et()!==p)if((t=Je())!==p){for(r=[],n=Ue();n!==p;)r.push(n),n=Ue();e=r!==p?(je=e,E(t,r)):(_e=e,p)}else _e=e,e=p;else _e=e,e=p;return De--,e===p&&(p,0===De&&Le(O)),e}function Ge(){var e,t,r,n;if(e=_e,39===f.charCodeAt(_e)?(t=S,_e++):(t=p,0===De&&Le(B)),t!==p){if(r=[],(n=rt())===p&&(L.test(f.charAt(_e))?(n=f.charAt(_e),_e++):(n=p,0===De&&Le(Z))),n!==p)for(;n!==p;)r.push(n),(n=rt())===p&&(L.test(f.charAt(_e))?(n=f.charAt(_e),_e++):(n=p,0===De&&Le(Z)));else r=p;e=r!==p?(39===f.charCodeAt(_e)?(n=S,_e++):(n=p,0===De&&Le(B)),n!==p?t=[t,r,n]:(_e=e,p)):(_e=e,p)}else _e=e,e=p;if(e===p)if(e=[],(t=rt())===p&&(z.test(f.charAt(_e))?(t=f.charAt(_e),_e++):(t=p,0===De&&Le(X))),t!==p)for(;t!==p;)e.push(t),(t=rt())===p&&(z.test(f.charAt(_e))?(t=f.charAt(_e),_e++):(t=p,0===De&&Le(X)));else e=p;return e}function Ke(){var e,t;if(e=[],H.test(f.charAt(_e))?(t=f.charAt(_e),_e++):(t=p,0===De&&Le($)),t!==p)for(;t!==p;)e.push(t),H.test(f.charAt(_e))?(t=f.charAt(_e),_e++):(t=p,0===De&&Le($));else e=p;return e}function Qe(){var e,t,r,n,u;return e=_e,e=et()!==p&&(t=ot())!==p&&et()!==p?(123===f.charCodeAt(_e)?(r=h,_e++):(r=p,0===De&&Le(m)),r!==p&&(n=ze())!==p?(125===f.charCodeAt(_e)?(u=v,_e++):(u=p,0===De&&Le(d)),u!==p?(je=e,se(t,n)):(_e=e,p)):(_e=e,p)):(_e=e,p)}function Ve(){var e,t,r,n,u;return e=_e,e=et()!==p&&(t=function(){var e,t,r,n;return t=e=_e,61===f.charCodeAt(_e)?(r=ae,_e++):(r=p,0===De&&Le(ie)),(e=(t=r!==p&&(n=tt())!==p?r=[r,n]:(_e=t,p))!==p?f.substring(e,_e):t)===p&&(e=ot()),e}())!==p&&et()!==p?(123===f.charCodeAt(_e)?(r=h,_e++):(r=p,0===De&&Le(m)),r!==p&&(n=ze())!==p?(125===f.charCodeAt(_e)?(u=v,_e++):(u=p,0===De&&Le(d)),u!==p?(je=e,ce(t,n)):(_e=e,p)):(_e=e,p)):(_e=e,p)}function We(){var e;return le.test(f.charAt(_e))?(e=f.charAt(_e),_e++):(e=p,0===De&&Le(fe)),e}function Ye(){var e;return pe.test(f.charAt(_e))?(e=f.charAt(_e),_e++):(e=p,0===De&&Le(he)),e}function et(){var e,t,r;for(De++,e=_e,t=[],r=We();r!==p;)t.push(r),r=We();return e=t!==p?f.substring(e,_e):t,De--,e===p&&(t=p,0===De&&Le(me)),e}function tt(){var e,t,r;if(e=_e,t=[],ve.test(f.charAt(_e))?(r=f.charAt(_e),_e++):(r=p,0===De&&Le(de)),r!==p)for(;r!==p;)t.push(r),ve.test(f.charAt(_e))?(r=f.charAt(_e),_e++):(r=p,0===De&&Le(de));else t=p;return t!==p&&(je=e,t=ye(t)),e=t}function rt(){var e,t;return De++,e=_e,f.substr(_e,2)===Ae?(t=Ae,_e+=2):(t=p,0===De&&Le(be)),t!==p&&(je=e,t=xe()),De--,(e=t)===p&&(t=p,0===De&&Le(ge)),e}function nt(){var e,t,r,n,u,o;if(e=_e,39===f.charCodeAt(_e)?(t=S,_e++):(t=p,0===De&&Le(B)),t!==p)if(Ce.test(f.charAt(_e))?(r=f.charAt(_e),_e++):(r=p,0===De&&Le(we)),r!==p){for(n=_e,u=[],f.substr(_e,2)===Ae?(o=Ae,_e+=2):(o=p,0===De&&Le(be)),o===p&&(L.test(f.charAt(_e))?(o=f.charAt(_e),_e++):(o=p,0===De&&Le(Z)));o!==p;)u.push(o),f.substr(_e,2)===Ae?(o=Ae,_e+=2):(o=p,0===De&&Le(be)),o===p&&(L.test(f.charAt(_e))?(o=f.charAt(_e),_e++):(o=p,0===De&&Le(Z)));e=(n=u!==p?f.substring(n,_e):u)!==p?(39===f.charCodeAt(_e)?(u=S,_e++):(u=p,0===De&&Le(B)),u!==p?(je=e,t=Fe(r,n)):(_e=e,p)):(_e=e,p)}else _e=e,e=p;else _e=e,e=p;return e}function ut(){var e,t;return e=_e,Oe.test(f.charAt(_e))?(t=f.charAt(_e),_e++):(t=p,0===De&&Le(Ee)),e=t!==p?f.substring(e,_e):t}function ot(){var e,t,r,n,u;if(De++,t=[],n=r=e=_e,De++,(u=We())===p&&(u=Ye()),De--,(r=(n=u===p?void 0:(_e=n,p))!==p?(f.length>_e?(u=f.charAt(_e),_e++):(u=p,0===De&&Le(b)),u!==p?n=[n,u]:(_e=r,p)):(_e=r,p))!==p)for(;r!==p;)t.push(r),n=r=_e,De++,(u=We())===p&&(u=Ye()),De--,r=(n=u===p?void 0:(_e=n,p))!==p?(f.length>_e?(u=f.charAt(_e),_e++):(u=p,0===De&&Le(b)),u!==p?n=[n,u]:(_e=r,p)):(_e=r,p);else t=p;return e=t!==p?f.substring(e,_e):t,De--,e===p&&(t=p,0===De&&Le(Te)),e}function at(){return e&&e.captureLocation?{location:Be(je,_e)}:{}}if((t=a())!==p&&_e===f.length)return t;throw t!==p&&_e<f.length&&Le({type:"end"}),r=Pe,n=ke<f.length?f.charAt(ke):null,u=ke<f.length?Be(ke,ke+1):Be(ke,ke),new ct(ct.buildMessage(r,n),r,n,u)},p=/(^|[^\\])#/g;function u(e,t){var r=f(e,t);return t&&!1===t.normalizeHashtagInPlural||function l(e){e.forEach(function(c){(x(c)||b(c))&&Object.keys(c.options).forEach(function(e){for(var t,r=c.options[e],n=-1,u=void 0,o=0;o<r.value.length;o++){var a=r.value[o];if(v(a)&&p.test(a.value)){n=o,u=a;break}}if(u){var i=u.value.replace(p,"$1{"+c.value+", number}"),s=f(i);(t=r.value).splice.apply(t,[n,1].concat(s))}l(r.value)})})}(r),r}function i(e){return JSON.stringify(e.map(function(e){return e&&"object"==typeof e?function(r){return Object.keys(r).sort().map(function(e){var t;return(t={})[e]=r[e],t})}(e):e}))}var s,c,h,l=function(o,a){return void 0===a&&(a={}),function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=i(t),u=n&&a[n];return u||(u=new((e=o).bind.apply(e,[void 0].concat(t))),n&&(a[n]=u)),u}},m=(s=function(e,t){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}s(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),C=/\\#/g,w=(c=Error,m(F,c),F);function F(e,t){var r=c.call(this,e)||this;return r.variableId=t,r}function O(e,t,r,n,u,o){if(1===e.length&&v(e[0]))return[{type:0,value:e[0].value.replace(C,"#")}];for(var a=[],i=0,s=e;i<s.length;i++){var c=s[i];if(v(c))a.push({type:0,value:c.value.replace(C,"#")});else{var l=c.value;if(!(u&&l in u))throw new w('The intl string context variable "'+l+'" was not provided to the string "'+o+'"');var f=u[l];if(d(c))f&&"string"!=typeof f&&"number"!=typeof f?a.push({type:1,value:f}):a.push({type:0,value:"string"==typeof f||"number"==typeof f?String(f):""});else if(g(c)){var p="string"==typeof c.style?n.date[c.style]:void 0;a.push({type:0,value:r.getDateTimeFormat(t,p).format(f)})}else if(A(c)){p="string"==typeof c.style?n.time[c.style]:void 0;a.push({type:0,value:r.getDateTimeFormat(t,p).format(f)})}else if(y(c)){p="string"==typeof c.style?n.number[c.style]:void 0;a.push({type:0,value:r.getNumberFormat(t,p).format(f)})}else if(b(c)){if(!(h=c.options[f]||c.options.other))throw new RangeError('Invalid values for "'+c.value+'": "'+f+'". Options are "'+Object.keys(c.options).join('", "')+'"');a.push.apply(a,O(h.value,t,r,n,u))}else if(x(c)){var h;if(!(h=c.options["="+f])){var m=r.getPluralRules(t,{type:c.pluralType}).select(f-(c.offset||0));h=c.options[m]||c.options.other}if(!h)throw new RangeError('Invalid values for "'+c.value+'": "'+f+'". Options are "'+Object.keys(c.options).join('", "')+'"');a.push.apply(a,O(h.value,t,r,n,u))}else;}}return function(e){return e.length<2?e:e.reduce(function(e,t){var r=e[e.length-1];return r&&0===r.type&&0===t.type?r.value+=t.value:e.push(t),e},[])}(a)}function E(e,t,r,n,u,o){var a=O(e,t,r,n,u,o);return 1===a.length?a[0].value:a.reduce(function(e,t){return e+t.value},"")}var T="@@",_=/@@(.*?)@@/g,j=0;function M(e,t){return e.split(_).filter(Boolean).map(function(e){return t[e]||e})}function k(e,t,r,n,i,u){var o=O(e,t,r,n,i,u),s={},a=o.reduce(function(e,t){if("string"==typeof t.value||0===t.type)return e+t.value;var r=Date.now()+"_"+ ++j;return s[r]=t.value,e+(T+r)+T},"");if(!~a.indexOf("<"))return M(a,s);if(!i)throw new w("Message has placeholders but no values was given");if("undefined"==typeof DOMParser)throw new w("Cannot format XML message without DOMParser");h||(h=new DOMParser);var c=h.parseFromString("<template>"+a+"</template>","application/xml");if(c.getElementsByTagName("parsererror").length)throw new w("Malformed XML message "+c.getElementsByTagName("parsererror")[0].innerHTML);var l=c.firstChild;if(!l)throw new w("Malformed XML message "+a);return Object.keys(i).filter(function(e){return!!c.getElementsByTagName(e).length}).length?Array.prototype.slice.call(l.childNodes).reduce(function(e,t){var r=t.tagName,n=t.outerHTML,u=t.textContent;if(!r){var o=M(u||"",s);return e.concat(o)}if(!i[r])return 1===(o=M(n,s)).length?e.concat([o[0]]):e.concat(o);var a=i[r];if("function"!=typeof a)return e.concat([a]);if(null==u)return e.concat([a(u||void 0)]);o=M(u,s);return e.concat([a.apply(void 0,o)])},[]):M(a,s)}var P=function(){return(P=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var u in t=arguments[r])Object.prototype.hasOwnProperty.call(t,u)&&(e[u]=t[u]);return e}).apply(this,arguments)};function D(r,n){return n?Object.keys(r).reduce(function(e,t){return e[t]=function(r,n){return n?P({},r||{},n||{},Object.keys(r).reduce(function(e,t){return e[t]=P({},r[t],n[t]||{}),e},{})):r}(r[t],n[t]),e},P({},r)):r}function I(e){return void 0===e&&(e={number:{},dateTime:{},pluralRules:{}}),{getNumberFormat:l(Intl.NumberFormat,e.number),getDateTimeFormat:l(Intl.DateTimeFormat,e.dateTime),getPluralRules:l(Intl.PluralRules,e.pluralRules)}}var N=(R.defaultLocale="en",R.__parse=u,R.formats={number:{currency:{style:"currency"},percent:{style:"percent"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},R);function R(e,t,r,n){var u=this;if(void 0===t&&(t=R.defaultLocale),this.formatterCache={number:{},dateTime:{},pluralRules:{}},this.format=function(e){return E(u.ast,u.locale,u.formatters,u.formats,e,u.message)},this.formatToParts=function(e){return O(u.ast,u.locale,u.formatters,u.formats,e,u.message)},this.formatXMLMessage=function(e){return k(u.ast,u.locale,u.formatters,u.formats,e,u.message)},this.resolvedOptions=function(){return{locale:u.locale}},this.getAst=function(){return u.ast},"string"==typeof e){if(this.message=e,!R.__parse)throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");this.ast=R.__parse(e)}else this.ast=e;if(!Array.isArray(this.ast))throw new TypeError("A message must be provided as a String or AST.");this.formats=D(R.formats,r),this.locale=function(e){"string"==typeof e&&(e=[e]);try{return Intl.NumberFormat.supportedLocalesOf(e,{localeMatcher:"best fit"})[0]}catch(e){return N.defaultLocale}}(t||[]),this.formatters=n&&n.formatters||I(this.formatterCache),function r(e,n,u,o){e.filter(function(e){return!d(e)&&!v(e)}).forEach(function(t){if(g(t)){var e="string"==typeof t.style?o.date[t.style]:void 0;u.getDateTimeFormat(n,e)}A(t)&&(e="string"==typeof t.style?o.time[t.style]:void 0,u.getDateTimeFormat(n,e)),y(t)&&(e="string"==typeof t.style?o.number[t.style]:void 0,u.getNumberFormat(n,e)),b(t)&&Object.keys(t.options).forEach(function(e){return r(t.options[e].value,n,u,o)}),x(t)&&(u.getPluralRules(n,{type:t.pluralType}),Object.keys(t.options).forEach(function(e){return r(t.options[e].value,n,u,o)}))})}(this.ast,this.locale,this.formatters,this.formats)}e.IntlMessageFormat=N,e.createDefaultFormatters=I,e.default=N,e.formatToParts=O,e.formatToString=E,e.formatXMLMessage=k,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=intl-messageformat.min.js.map
{
"name": "intl-messageformat",
"version": "6.0.4",
"version": "6.1.0",
"description": "Formats ICU Message strings with number, date, plural, and select placeholders to create localized messages.",

@@ -35,3 +35,3 @@ "keywords": [

"intl-format-cache": "^4.1.6",
"intl-messageformat-parser": "^3.0.3"
"intl-messageformat-parser": "^3.0.4"
},

@@ -41,3 +41,3 @@ "scripts": {

"mjs": "find ./dist -depth -name \"*.js\" -exec sh -c 'f=\"{}\"; mv -- \"$f\" \"${f%.js}.mjs\"' \\;",
"build": "npm run tsc && npm run tsc:core && npm run rollup",
"build": "npm run tsc && npm run rollup",
"clean": "rimraf dist lib",

@@ -48,3 +48,2 @@ "karma:ci": "karma start karma.conf-ci.js",

"test": "TS_NODE_PROJECT='./tsconfig.cjs.json' mocha --opts ../../mocha.opts -r tests/setup.js tests/index.ts",
"tsc:core": "tsc -p tsconfig.core.json",
"tsc": "tsc -p src/tsconfig.json && npm run mjs && tsc -p src/tsconfig.cjs.json"

@@ -57,3 +56,3 @@ },

"license": "BSD-3-Clause",
"gitHead": "e4991d253408fd29bbdbf20f9d133fa7f3714ac0"
"gitHead": "6e67775d81ba150bf565c9b49ffee06b48fddbcb"
}

@@ -193,5 +193,5 @@ # Intl MessageFormat

### Core entry point
### Passing in AST
We also expose another entry point via `intl-messageformat/core` that does not contain the parser from `intl-messageformat-parser`. This is significantly smaller than the regular package but expects the message passed in to be in `AST` form instead of string. E.g:
You can pass in pre-parsed AST to IntlMessageFormat like this:

@@ -211,5 +211,7 @@ ```ts

If your messages are all in ASTs, you can alias `intl-messageformat-parser` to `{default: undefined}` to save some bytes during bundling.
### Formatters
For complex messages, initializing `Intl.*` constructors can be expensive. Therefore, we allow user to pass in `formatters` to provide memoized instances of these `Intl` objects. This opts combines with passing in AST + using [core entry point](#core-entry-point) and `intl-format-cache` can speed things up by 30x per the benchmark down below.
For complex messages, initializing `Intl.*` constructors can be expensive. Therefore, we allow user to pass in `formatters` to provide memoized instances of these `Intl` objects. This opts combines with [passing in AST](#passing-in-ast) and `intl-format-cache` can speed things up by 30x per the benchmark down below.

@@ -216,0 +218,0 @@ For example:

@@ -224,3 +224,3 @@ /*

static defaultLocale = 'en';
static __parse: typeof parse | undefined = undefined;
static __parse: typeof parse | undefined = parse;
// Default format options used as the prototype of the `formats` provided to the

@@ -227,0 +227,0 @@ // constructor. These are used when constructing the internal Intl.NumberFormat

@@ -7,9 +7,5 @@ /*

import { parse } from 'intl-messageformat-parser';
import IntlMessageFormat from './core';
IntlMessageFormat.__parse = parse;
export * from './formatters';
export * from './core';
export default IntlMessageFormat;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc