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 5.4.0 to 5.4.1

11

CHANGELOG.md

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

## [5.4.1](https://github.com/formatjs/formatjs/compare/intl-messageformat@5.4.0...intl-messageformat@5.4.1) (2019-07-25)
### Bug Fixes
* **intl-messageformat:** fix formatXMLMessage w/o tag ([8d3bfcd](https://github.com/formatjs/formatjs/commit/8d3bfcd))
# [5.4.0](https://github.com/formatjs/formatjs/compare/intl-messageformat@5.3.0...intl-messageformat@5.4.0) (2019-07-25)

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

24

dist/formatters.js

@@ -168,2 +168,8 @@ "use strict";

}
function restoreRichPlaceholderMessage(text, objectParts) {
return text
.split(TOKEN_REGEX)
.filter(Boolean)
.map(function (c) { return objectParts[c] || c; });
}
function formatXMLMessage(els, locales, formatters, formats, values,

@@ -184,3 +190,3 @@ // For debugging

if (!~formattedMessage.indexOf('<')) {
return [formattedMessage];
return restoreRichPlaceholderMessage(formattedMessage, objectParts);
}

@@ -208,3 +214,3 @@ if (!values) {

if (!tagsToFormat.length) {
return [formattedMessage];
return restoreRichPlaceholderMessage(formattedMessage, objectParts);
}

@@ -216,12 +222,12 @@ var childNodes = Array.prototype.slice.call(content.childNodes);

if (!tagName) {
var chunks = (textContent || '').split(TOKEN_REGEX).filter(Boolean);
return reconstructedChunks.concat.apply(reconstructedChunks, chunks.map(function (c) { return objectParts[c] || c; }));
var chunks = restoreRichPlaceholderMessage(textContent || '', objectParts);
return reconstructedChunks.concat(chunks);
}
// Legacy HTML
if (!values[tagName]) {
var chunks = outerHTML.split(TOKEN_REGEX).filter(Boolean);
var chunks = restoreRichPlaceholderMessage(outerHTML, objectParts);
if (chunks.length === 1) {
return reconstructedChunks.concat([chunks[0]]);
}
return reconstructedChunks.concat.apply(reconstructedChunks, chunks.map(function (c) { return objectParts[c] || c; }));
return reconstructedChunks.concat(chunks);
}

@@ -236,6 +242,4 @@ // XML Tag replacement

}
var chunks = textContent.split(TOKEN_REGEX).filter(Boolean);
return reconstructedChunks.concat([
formatFnOrValue.apply(void 0, chunks.map(function (c) { return objectParts[c] || c; }))
]);
var chunks = restoreRichPlaceholderMessage(textContent, objectParts);
return reconstructedChunks.concat([formatFnOrValue.apply(void 0, chunks)]);
}

@@ -242,0 +246,0 @@ return reconstructedChunks.concat([formatFnOrValue]);

@@ -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 ft,t;function v(e){return e.type===ft.literal}function d(e){return e.type===ft.argument}function y(e){return e.type===ft.number}function g(e){return e.type===ft.date}function b(e){return e.type===ft.time}function A(e){return e.type===ft.select}function w(e){return e.type===ft.plural}(t=ft=ft||{})[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,a,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)}),pt=function(){return(pt=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},mt=(a=Error,r(u,a),u.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 o(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 a(e){switch(e.type){case"literal":return'"'+n(e.text)+'"';case"class":var t=e.parts.map(function(e){return Array.isArray(e)?o(e[0])+"-"+o(e[1]):o(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(a);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 "+((u=t)?'"'+n(u)+'"':"end of input")+" found.";var u},u);function u(e,t,r,n){var o=a.call(this)||this;return o.message=e,o.expected=t,o.found=r,o.location=n,o.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(o,u),o}var f=function(f,e){e=void 0!==e?e:{};var t,r,n,o,p={},a={start:Ge},u=Ge,i=function(e){return e.reduce(function(e,t){return e.concat(t)},[]).join("")},s=function(e){return pt({type:ft.literal,value:e},lt())},c=function(e){return e.join("")},l=Ue("argumentElement"),m="{",h=Ze("{",!1),v="}",d=Ze("}",!1),y=function(e){return pt({type:ft.argument,value:e},lt())},g=",",b=Ze(",",!1),A="number",w=Ze("number",!1),C="date",O=Ze("date",!1),x="time",_=Ze("time",!1),j=function(e,t,r){return pt({type:"number"===t?ft.number:"date"===t?ft.date:ft.time,style:r&&r[2],value:e},lt())},F="plural",T=Ze("plural",!1),M="selectordinal",E=Ze("selectordinal",!1),P="offset:",k=Ze("offset:",!1),I=function(e,t,r,n){return pt({type:ft.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,o=t.location;return e[r]={value:n,location:o},e},{})},lt())},N="select",R=Ze("select",!1),L=function(e,t){return pt({type:ft.select,value:e,options:t.reduce(function(e,t){var r=t.id,n=t.value,o=t.location;return e[r]={value:n,location:o},e},{})},lt())},D="=0",S=Ze("=0",!1),B="=1",X=Ze("=1",!1),z="=2",H=Ze("=2",!1),Z="zero",J=Ze("zero",!1),U="one",W=Ze("one",!1),$="two",q=Ze("two",!1),G="few",K=Ze("few",!1),Q="many",V=Ze("many",!1),Y="other",ee=Ze("other",!1),te=function(e,t){return pt({id:e,value:t},lt())},re=function(e,t){return pt({id:e,value:t},lt())},ne=Ue("whitespace"),oe=/^[ \t\n\r]/,ae=Je([" ","\t","\n","\r"],!1,!1),ue=Ue("optionalWhitespace"),ie=/^[0-9]/,se=Je([["0","9"]],!1,!1),ce=/^[0-9a-f]/i,le=Je([["0","9"],["a","f"]],!1,!0),fe=function(e){return parseInt(e.join(""),10)},pe="'",me=Ze("'",!1),he=/^[ \t\n\r,.+={}#]/,ve=Je([" ","\t","\n","\r",",",".","+","=","{","}","#"],!1,!1),de={type:"any"},ye=function(e){return e},ge=function(e){return e},be=Ue("apostrophe"),Ae=/^[^{}\\\0-\x1F\x7F \t\n\r]/,we=Je(["{","}","\\",["\0",""],""," ","\t","\n","\r"],!0,!1),Ce="\\\\",Oe=Ze("\\\\",!1),xe=function(){return"\\"},_e="\\#",je=Ze("\\#",!1),Fe=function(){return"\\#"},Te="\\{",Me=Ze("\\{",!1),Ee=function(){return"{"},Pe="\\}",ke=Ze("\\}",!1),Ie=function(){return"}"},Ne="\\u",Re=Ze("\\u",!1),Le=function(e){return String.fromCharCode(parseInt(e,16))},De=0,Se=0,Be=[{line:1,column:1}],Xe=0,ze=[],He=0;if(void 0!==e.startRule){if(!(e.startRule in a))throw new Error("Can't start parsing from rule \""+e.startRule+'".');u=a[e.startRule]}function Ze(e,t){return{type:"literal",text:e,ignoreCase:t}}function Je(e,t,r){return{type:"class",parts:e,inverted:t,ignoreCase:r}}function Ue(e){return{type:"other",description:e}}function We(e){var t,r=Be[e];if(r)return r;for(t=e-1;!Be[t];)t--;for(r={line:(r=Be[t]).line,column:r.column};t<e;)10===f.charCodeAt(t)?(r.line++,r.column=1):r.column++,t++;return Be[e]=r}function $e(e,t){var r=We(e),n=We(t);return{start:{offset:e,line:r.line,column:r.column},end:{offset:t,line:n.line,column:n.column}}}function qe(e){De<Xe||(Xe<De&&(Xe=De,ze=[]),ze.push(e))}function Ge(){return Ke()}function Ke(){var e,t;for(e=[],t=Qe();t!==p;)e.push(t),t=Qe();return e}function Qe(){var e;return(e=function(){var e,t;e=De,(t=function(){var e,t,r,n,o,a;t=[],r=e=De,r=(n=rt())!==p?(o=ct(),o!==p?(a=rt())!==p?n=[n,o,a]:(De=r,p):(De=r,p)):(De=r,p);if(r!==p)for(;r!==p;)t.push(r),r=De,n=rt(),r=n!==p?(o=ct())!==p?(a=rt())!==p?n=[n,o,a]:(De=r,p):(De=r,p):(De=r,p);else t=p;t!==p&&(Se=e,t=i(t));(e=t)===p&&(e=De,t=tt(),e=t!==p?f.substring(e,De):t);return e}())!==p&&(Se=e,t=s(t));return e=t}())===p&&(e=function(){var e,t,r,n,o;He++,e=De,123===f.charCodeAt(De)?(t=m,De++):(t=p,0===He&&qe(h));e=t!==p?(r=rt(),r!==p?(n=Ve())!==p?rt()!==p?(125===f.charCodeAt(De)?(o=v,De++):(o=p,0===He&&qe(d)),o!==p?(Se=e,t=y(n)):(De=e,p)):(De=e,p):(De=e,p):(De=e,p)):(De=e,p);He--,e===p&&(t=p,0===He&&qe(l));return e}())===p&&(e=function(){var e,t,r,n,o,a,u,i,s,c;e=De,123===f.charCodeAt(De)?(t=m,De++):(t=p,0===He&&qe(h));e=t!==p?(r=rt(),r!==p?(n=Ve())!==p?rt()!==p?(44===f.charCodeAt(De)?(o=g,De++):(o=p,0===He&&qe(b)),o!==p?rt()!==p?(f.substr(De,6)===A?(a=A,De+=6):(a=p,0===He&&qe(w)),a===p&&(f.substr(De,4)===C?(a=C,De+=4):(a=p,0===He&&qe(O)),a===p&&(f.substr(De,4)===x?(a=x,De+=4):(a=p,0===He&&qe(_)))),a!==p?rt()!==p?(u=De,44===f.charCodeAt(De)?(i=g,De++):(i=p,0===He&&qe(b)),(u=i!==p?(s=rt())!==p?(c=ct())!==p?i=[i,s,c]:(De=u,p):(De=u,p):(De=u,p))===p&&(u=null),u!==p?(i=rt())!==p?(125===f.charCodeAt(De)?(s=v,De++):(s=p,0===He&&qe(d)),s!==p?(Se=e,t=j(n,a,u)):(De=e,p)):(De=e,p):(De=e,p)):(De=e,p):(De=e,p)):(De=e,p):(De=e,p)):(De=e,p):(De=e,p):(De=e,p)):(De=e,p);return e}())===p&&(e=function(){var e,t,r,n,o,a,u,i,s,c,l;e=De,123===f.charCodeAt(De)?(t=m,De++):(t=p,0===He&&qe(h));if(t!==p)if(rt()!==p)if((r=Ve())!==p)if(rt()!==p)if(44===f.charCodeAt(De)?(n=g,De++):(n=p,0===He&&qe(b)),n!==p)if(rt()!==p)if(f.substr(De,6)===F?(o=F,De+=6):(o=p,0===He&&qe(T)),o===p&&(f.substr(De,13)===M?(o=M,De+=13):(o=p,0===He&&qe(E))),o!==p)if(rt()!==p)if(44===f.charCodeAt(De)?(a=g,De++):(a=p,0===He&&qe(b)),a!==p)if(rt()!==p)if(u=De,f.substr(De,7)===P?(i=P,De+=7):(i=p,0===He&&qe(k)),(u=i!==p?(s=rt())!==p?(c=at())!==p?i=[i,s,c]:(De=u,p):(De=u,p):(De=u,p))===p&&(u=null),u!==p)if((i=rt())!==p){if(s=[],(c=et())!==p)for(;c!==p;)s.push(c),c=et();else s=p;e=s!==p?(c=rt())!==p?(125===f.charCodeAt(De)?(l=v,De++):(l=p,0===He&&qe(d)),l!==p?(Se=e,t=I(r,o,u,s)):(De=e,p)):(De=e,p):(De=e,p)}else De=e,e=p;else De=e,e=p;else De=e,e=p;else De=e,e=p;else De=e,e=p;else De=e,e=p;else De=e,e=p;else De=e,e=p;else De=e,e=p;else De=e,e=p;else De=e,e=p;else De=e,e=p;return e}())===p&&(e=function(){var e,t,r,n,o,a,u,i,s;e=De,123===f.charCodeAt(De)?(t=m,De++):(t=p,0===He&&qe(h));if(t!==p)if(rt()!==p)if((r=Ve())!==p)if(rt()!==p)if(44===f.charCodeAt(De)?(n=g,De++):(n=p,0===He&&qe(b)),n!==p)if(rt()!==p)if(f.substr(De,6)===N?(o=N,De+=6):(o=p,0===He&&qe(R)),o!==p)if(rt()!==p)if(44===f.charCodeAt(De)?(a=g,De++):(a=p,0===He&&qe(b)),a!==p)if(rt()!==p){if(u=[],(i=Ye())!==p)for(;i!==p;)u.push(i),i=Ye();else u=p;e=u!==p?(i=rt())!==p?(125===f.charCodeAt(De)?(s=v,De++):(s=p,0===He&&qe(d)),s!==p?(Se=e,t=L(r,u)):(De=e,p)):(De=e,p):(De=e,p)}else De=e,e=p;else De=e,e=p;else De=e,e=p;else De=e,e=p;else De=e,e=p;else De=e,e=p;else De=e,e=p;else De=e,e=p;else De=e,e=p;else De=e,e=p;return e}()),e}function Ve(){var e,t,r;if((e=at())===p){for(e=De,t=[],r=ut();r!==p;)t.push(r),r=ut();t!==p&&(Se=e,t=c(t)),e=t}return e}function Ye(){var e,t,r,n,o;return e=De,e=rt()!==p&&(t=ct())!==p&&rt()!==p?(123===f.charCodeAt(De)?(r=m,De++):(r=p,0===He&&qe(h)),r!==p&&(n=Ke())!==p?(125===f.charCodeAt(De)?(o=v,De++):(o=p,0===He&&qe(d)),o!==p?(Se=e,te(t,n)):(De=e,p)):(De=e,p)):(De=e,p)}function et(){var e,t,r,n,o;return e=De,e=rt()!==p&&(t=function(){var e;return f.substr(De,2)===D?(e=D,De+=2):(e=p,0===He&&qe(S)),e===p&&(f.substr(De,2)===B?(e=B,De+=2):(e=p,0===He&&qe(X)),e===p&&(f.substr(De,2)===z?(e=z,De+=2):(e=p,0===He&&qe(H)),e===p&&(f.substr(De,4)===Z?(e=Z,De+=4):(e=p,0===He&&qe(J)),e===p&&(f.substr(De,3)===U?(e=U,De+=3):(e=p,0===He&&qe(W)),e===p&&(f.substr(De,3)===$?(e=$,De+=3):(e=p,0===He&&qe(q)),e===p&&(f.substr(De,3)===G?(e=G,De+=3):(e=p,0===He&&qe(K)),e===p&&(f.substr(De,4)===Q?(e=Q,De+=4):(e=p,0===He&&qe(V)),e===p&&(f.substr(De,5)===Y?(e=Y,De+=5):(e=p,0===He&&qe(ee)))))))))),e}())!==p&&rt()!==p?(123===f.charCodeAt(De)?(r=m,De++):(r=p,0===He&&qe(h)),r!==p&&(n=Ke())!==p?(125===f.charCodeAt(De)?(o=v,De++):(o=p,0===He&&qe(d)),o!==p?(Se=e,re(t,n)):(De=e,p)):(De=e,p)):(De=e,p)}function tt(){var e,t;if(He++,e=[],oe.test(f.charAt(De))?(t=f.charAt(De),De++):(t=p,0===He&&qe(ae)),t!==p)for(;t!==p;)e.push(t),oe.test(f.charAt(De))?(t=f.charAt(De),De++):(t=p,0===He&&qe(ae));else e=p;return He--,e===p&&(t=p,0===He&&qe(ne)),e}function rt(){var e,t,r;for(He++,e=De,t=[],r=tt();r!==p;)t.push(r),r=tt();return e=t!==p?f.substring(e,De):t,He--,e===p&&(t=p,0===He&&qe(ue)),e}function nt(){var e;return ie.test(f.charAt(De))?(e=f.charAt(De),De++):(e=p,0===He&&qe(se)),e}function ot(){var e;return ce.test(f.charAt(De))?(e=f.charAt(De),De++):(e=p,0===He&&qe(le)),e}function at(){var e,t,r;if(e=De,t=[],(r=nt())!==p)for(;r!==p;)t.push(r),r=nt();else t=p;return t!==p&&(Se=e,t=fe(t)),e=t}function ut(){var e,t,r;return t=e=De,He++,39===f.charCodeAt(De)?(r=pe,De++):(r=p,0===He&&qe(me)),r===p&&(he.test(f.charAt(De))?(r=f.charAt(De),De++):(r=p,0===He&&qe(ve))),He--,(e=(t=r===p?void 0:(De=t,p))!==p?(f.length>De?(r=f.charAt(De),De++):(r=p,0===He&&qe(de)),r!==p?(Se=e,t=ye(r)):(De=e,p)):(De=e,p))===p&&(e=De,39===f.charCodeAt(De)?(t=pe,De++):(t=p,0===He&&qe(me)),e=t!==p&&(r=function(){var e;he.test(f.charAt(De))?(e=f.charAt(De),De++):(e=p,0===He&&qe(ve));e===p&&(e=it());return e}())!==p?(Se=e,t=ge(r)):(De=e,p)),e}function it(){var e;return He++,39===f.charCodeAt(De)?(e=pe,De++):(e=p,0===He&&qe(me)),He--,e===p&&0===He&&qe(be),e}function st(){var e,t,r,n,o,a,u,i;return e=De,39===f.charCodeAt(De)?(t=pe,De++):(t=p,0===He&&qe(me)),(e=t!==p&&(r=it())!==p?(Se=e,t=ge(r)):(De=e,p))===p&&(Ae.test(f.charAt(De))?(e=f.charAt(De),De++):(e=p,0===He&&qe(we)),e===p&&(e=De,f.substr(De,2)===Ce?(t=Ce,De+=2):(t=p,0===He&&qe(Oe)),t!==p&&(Se=e,t=xe()),(e=t)===p&&(e=De,f.substr(De,2)===_e?(t=_e,De+=2):(t=p,0===He&&qe(je)),t!==p&&(Se=e,t=Fe()),(e=t)===p&&(e=De,f.substr(De,2)===Te?(t=Te,De+=2):(t=p,0===He&&qe(Me)),t!==p&&(Se=e,t=Ee()),(e=t)===p&&(e=De,f.substr(De,2)===Pe?(t=Pe,De+=2):(t=p,0===He&&qe(ke)),t!==p&&(Se=e,t=Ie()),(e=t)===p&&(e=De,f.substr(De,2)===Ne?(t=Ne,De+=2):(t=p,0===He&&qe(Re)),e=t!==p?(n=r=De,(r=(n=(o=ot())!==p&&(a=ot())!==p&&(u=ot())!==p&&(i=ot())!==p?o=[o,a,u,i]:(De=n,p))!==p?f.substring(r,De):n)!==p?(Se=e,t=Le(r)):(De=e,p)):(De=e,p))))))),e}function ct(){var e,t,r;if(e=De,t=[],(r=st())!==p)for(;r!==p;)t.push(r),r=st();else t=p;return t!==p&&(Se=e,t=c(t)),e=t}function lt(){return e&&e.captureLocation?{location:$e(Se,De)}:{}}if((t=u())!==p&&De===f.length)return t;throw t!==p&&De<f.length&&qe({type:"end"}),r=ze,n=Xe<f.length?f.charAt(Xe):null,o=Xe<f.length?$e(Xe,Xe+1):$e(Xe,Xe),new mt(mt.buildMessage(r,n),r,n,o)},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 o,s,m,c=function(a,u){return void 0===u&&(u={}),function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=i(t),o=n&&u[n];return o||(o=new((e=a).bind.apply(e,[void 0].concat(t))),n&&(u[n]=o)),o}},l=(o=function(e,t){return(o=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}o(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),C=/\\#/g,O=(s=Error,l(h,s),h);function h(e,t){var r=s.call(this,e)||this;return r.variableId=t,r}function x(e,t,r,n,o,a){if(1===e.length&&v(e[0]))return[{type:0,value:e[0].value.replace(C,"#")}];for(var u=[],i=0,s=e;i<s.length;i++){var c=s[i];if(v(c))u.push({type:0,value:c.value.replace(C,"#")});else{var l=c.value;if(!(o&&l in o))throw new O("The intl string context variable '"+l+"' was not provided to the string '"+a+"'");var f=o[l];if(d(c))f&&"string"!=typeof f&&"number"!=typeof f?u.push({type:1,value:f}):u.push({type:0,value:"string"==typeof f||"number"==typeof f?String(f):""});else if(g(c)){var p=c.style?n.date[c.style]:void 0;u.push({type:0,value:r.getDateTimeFormat(t,p).format(f)})}else if(b(c)){p=c.style?n.time[c.style]:void 0;u.push({type:0,value:r.getDateTimeFormat(t,p).format(f)})}else if(y(c)){p=c.style?n.number[c.style]:void 0;u.push({type:0,value:r.getNumberFormat(t,p).format(f)})}else if(A(c)){if(!(m=c.options[f]||c.options.other))throw new RangeError('Invalid values for "'+c.value+'": "'+f+'". Options are "'+Object.keys(c.options).join('", "')+'"');u.push.apply(u,x(m.value,t,r,n,o))}else if(w(c)){var m;if(!(m=c.options["="+f])){var h=r.getPluralRules(t,{type:c.pluralType}).select(f-(c.offset||0));m=c.options[h]||c.options.other}if(!m)throw new RangeError('Invalid values for "'+c.value+'": "'+f+'". Options are "'+Object.keys(c.options).join('", "')+'"');u.push.apply(u,x(m.value,t,r,n,o))}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},[])}(u)}function _(e,t,r,n,o,a){var u=x(e,t,r,n,o,a);return 1===u.length?u[0].value:u.reduce(function(e,t){return e+t.value},"")}var j="@@",F=/@@(.*)@@/,T=0;function M(e,t,r,n,i,o){var a=x(e,t,r,n,i,o),s={},u=a.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+(j+r)+j},"");if(!~u.indexOf("<"))return[u];if(!i)throw new O("Message has placeholders but no values was given");if("undefined"==typeof DOMParser)throw new O("Cannot format XML message without DOMParser");var c=(m=m||new DOMParser).parseFromString("<template>"+u+"</template>","application/xml");if(c.getElementsByTagName("parsererror").length)throw new O("Malformed XML message "+c.getElementsByTagName("parsererror")[0].innerHTML);var l=c.firstChild;if(!l)throw new O("Malformed XML message "+u);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,o=t.textContent;if(!r){var a=(o||"").split(F).filter(Boolean);return e.concat.apply(e,a.map(function(e){return s[e]||e}))}if(!i[r])return 1===(a=n.split(F).filter(Boolean)).length?e.concat([a[0]]):e.concat.apply(e,a.map(function(e){return s[e]||e}));var u=i[r];if("function"!=typeof u)return e.concat([u]);if(null==o)return e.concat([u(o||void 0)]);a=o.split(F).filter(Boolean);return e.concat([u.apply(void 0,a.map(function(e){return s[e]||e}))])},[]):[u]}var E=function(){return(E=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);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?E({},r||{},n||{},Object.keys(r).reduce(function(e,t){return e[t]=E({},r[t],n[t]||{}),e},{})):r}(r[t],n[t]),e},E({},r)):r}function k(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 o=this;if(void 0===t&&(t=N.defaultLocale),this.formatterCache={number:{},dateTime:{},pluralRules:{}},this.format=function(e){return _(o.ast,o.locale,o.formatters,o.formats,e,o.message)},this.formatToParts=function(e){return x(o.ast,o.locale,o.formatters,o.formats,e,o.message)},this.formatXMLMessage=function(e){return M(o.ast,o.locale,o.formatters,o.formats,e,o.message)},this.resolvedOptions=function(){return{locale:o.locale}},this.getAst=function(){return o.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||k(this.formatterCache),function r(e,n,o,a){e.filter(function(e){return!d(e)&&!v(e)}).forEach(function(t){if(g(t)){var e=t.style?a.date[t.style]:void 0;return o.getDateTimeFormat(n,e)}return b(t)?(e=t.style?a.time[t.style]:void 0,o.getDateTimeFormat(n,e)):y(t)?(e=t.style?a.number[t.style]:void 0,o.getNumberFormat(n,e)):A(t)?Object.keys(t.options).forEach(function(e){return r(t.options[e].value,n,o,a)}):w(t)?(o.getPluralRules(n,{type:t.pluralType}),Object.keys(t.options).forEach(function(e){return r(t.options[e].value,n,o,a)})):void 0})}(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){w(c)&&Object.keys(c.options).forEach(function(e){for(var t,r=c.options[e],n=-1,o=void 0,a=0;a<r.value.length;a++){var u=r.value[a];if(v(u)&&p.test(u.value)){n=a,o=u;break}}if(o){var i=o.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=k,e.default=I,e.formatToParts=x,e.formatToString=_,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 ft,t;function v(e){return e.type===ft.literal}function d(e){return e.type===ft.argument}function y(e){return e.type===ft.number}function g(e){return e.type===ft.date}function b(e){return e.type===ft.time}function A(e){return e.type===ft.select}function w(e){return e.type===ft.plural}(t=ft=ft||{})[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,u,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)}),pt=function(){return(pt=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},ht=(u=Error,r(a,u),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 o(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 u(e){switch(e.type){case"literal":return'"'+n(e.text)+'"';case"class":var t=e.parts.map(function(e){return Array.isArray(e)?o(e[0])+"-"+o(e[1]):o(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(u);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 o=u.call(this)||this;return o.message=e,o.expected=t,o.found=r,o.location=n,o.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(o,a),o}var f=function(f,e){e=void 0!==e?e:{};var t,r,n,o,p={},u={start:Ge},a=Ge,i=function(e){return e.reduce(function(e,t){return e.concat(t)},[]).join("")},s=function(e){return pt({type:ft.literal,value:e},lt())},c=function(e){return e.join("")},l=Ue("argumentElement"),h="{",m=Ze("{",!1),v="}",d=Ze("}",!1),y=function(e){return pt({type:ft.argument,value:e},lt())},g=",",b=Ze(",",!1),A="number",w=Ze("number",!1),C="date",O=Ze("date",!1),x="time",_=Ze("time",!1),j=function(e,t,r){return pt({type:"number"===t?ft.number:"date"===t?ft.date:ft.time,style:r&&r[2],value:e},lt())},F="plural",T=Ze("plural",!1),M="selectordinal",E=Ze("selectordinal",!1),P="offset:",k=Ze("offset:",!1),I=function(e,t,r,n){return pt({type:ft.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,o=t.location;return e[r]={value:n,location:o},e},{})},lt())},N="select",R=Ze("select",!1),L=function(e,t){return pt({type:ft.select,value:e,options:t.reduce(function(e,t){var r=t.id,n=t.value,o=t.location;return e[r]={value:n,location:o},e},{})},lt())},D="=0",S=Ze("=0",!1),X="=1",B=Ze("=1",!1),z="=2",H=Ze("=2",!1),Z="zero",J=Ze("zero",!1),U="one",W=Ze("one",!1),$="two",q=Ze("two",!1),G="few",K=Ze("few",!1),Q="many",V=Ze("many",!1),Y="other",ee=Ze("other",!1),te=function(e,t){return pt({id:e,value:t},lt())},re=function(e,t){return pt({id:e,value:t},lt())},ne=Ue("whitespace"),oe=/^[ \t\n\r]/,ue=Je([" ","\t","\n","\r"],!1,!1),ae=Ue("optionalWhitespace"),ie=/^[0-9]/,se=Je([["0","9"]],!1,!1),ce=/^[0-9a-f]/i,le=Je([["0","9"],["a","f"]],!1,!0),fe=function(e){return parseInt(e.join(""),10)},pe="'",he=Ze("'",!1),me=/^[ \t\n\r,.+={}#]/,ve=Je([" ","\t","\n","\r",",",".","+","=","{","}","#"],!1,!1),de={type:"any"},ye=function(e){return e},ge=function(e){return e},be=Ue("apostrophe"),Ae=/^[^{}\\\0-\x1F\x7F \t\n\r]/,we=Je(["{","}","\\",["\0",""],""," ","\t","\n","\r"],!0,!1),Ce="\\\\",Oe=Ze("\\\\",!1),xe=function(){return"\\"},_e="\\#",je=Ze("\\#",!1),Fe=function(){return"\\#"},Te="\\{",Me=Ze("\\{",!1),Ee=function(){return"{"},Pe="\\}",ke=Ze("\\}",!1),Ie=function(){return"}"},Ne="\\u",Re=Ze("\\u",!1),Le=function(e){return String.fromCharCode(parseInt(e,16))},De=0,Se=0,Xe=[{line:1,column:1}],Be=0,ze=[],He=0;if(void 0!==e.startRule){if(!(e.startRule in u))throw new Error("Can't start parsing from rule \""+e.startRule+'".');a=u[e.startRule]}function Ze(e,t){return{type:"literal",text:e,ignoreCase:t}}function Je(e,t,r){return{type:"class",parts:e,inverted:t,ignoreCase:r}}function Ue(e){return{type:"other",description:e}}function We(e){var t,r=Xe[e];if(r)return r;for(t=e-1;!Xe[t];)t--;for(r={line:(r=Xe[t]).line,column:r.column};t<e;)10===f.charCodeAt(t)?(r.line++,r.column=1):r.column++,t++;return Xe[e]=r}function $e(e,t){var r=We(e),n=We(t);return{start:{offset:e,line:r.line,column:r.column},end:{offset:t,line:n.line,column:n.column}}}function qe(e){De<Be||(Be<De&&(Be=De,ze=[]),ze.push(e))}function Ge(){return Ke()}function Ke(){var e,t;for(e=[],t=Qe();t!==p;)e.push(t),t=Qe();return e}function Qe(){var e;return(e=function(){var e,t;e=De,(t=function(){var e,t,r,n,o,u;t=[],r=e=De,r=(n=rt())!==p?(o=ct(),o!==p?(u=rt())!==p?n=[n,o,u]:(De=r,p):(De=r,p)):(De=r,p);if(r!==p)for(;r!==p;)t.push(r),r=De,n=rt(),r=n!==p?(o=ct())!==p?(u=rt())!==p?n=[n,o,u]:(De=r,p):(De=r,p):(De=r,p);else t=p;t!==p&&(Se=e,t=i(t));(e=t)===p&&(e=De,t=tt(),e=t!==p?f.substring(e,De):t);return e}())!==p&&(Se=e,t=s(t));return e=t}())===p&&(e=function(){var e,t,r,n,o;He++,e=De,123===f.charCodeAt(De)?(t=h,De++):(t=p,0===He&&qe(m));e=t!==p?(r=rt(),r!==p?(n=Ve())!==p?rt()!==p?(125===f.charCodeAt(De)?(o=v,De++):(o=p,0===He&&qe(d)),o!==p?(Se=e,t=y(n)):(De=e,p)):(De=e,p):(De=e,p):(De=e,p)):(De=e,p);He--,e===p&&(t=p,0===He&&qe(l));return e}())===p&&(e=function(){var e,t,r,n,o,u,a,i,s,c;e=De,123===f.charCodeAt(De)?(t=h,De++):(t=p,0===He&&qe(m));e=t!==p?(r=rt(),r!==p?(n=Ve())!==p?rt()!==p?(44===f.charCodeAt(De)?(o=g,De++):(o=p,0===He&&qe(b)),o!==p?rt()!==p?(f.substr(De,6)===A?(u=A,De+=6):(u=p,0===He&&qe(w)),u===p&&(f.substr(De,4)===C?(u=C,De+=4):(u=p,0===He&&qe(O)),u===p&&(f.substr(De,4)===x?(u=x,De+=4):(u=p,0===He&&qe(_)))),u!==p?rt()!==p?(a=De,44===f.charCodeAt(De)?(i=g,De++):(i=p,0===He&&qe(b)),(a=i!==p?(s=rt())!==p?(c=ct())!==p?i=[i,s,c]:(De=a,p):(De=a,p):(De=a,p))===p&&(a=null),a!==p?(i=rt())!==p?(125===f.charCodeAt(De)?(s=v,De++):(s=p,0===He&&qe(d)),s!==p?(Se=e,t=j(n,u,a)):(De=e,p)):(De=e,p):(De=e,p)):(De=e,p):(De=e,p)):(De=e,p):(De=e,p)):(De=e,p):(De=e,p):(De=e,p)):(De=e,p);return e}())===p&&(e=function(){var e,t,r,n,o,u,a,i,s,c,l;e=De,123===f.charCodeAt(De)?(t=h,De++):(t=p,0===He&&qe(m));if(t!==p)if(rt()!==p)if((r=Ve())!==p)if(rt()!==p)if(44===f.charCodeAt(De)?(n=g,De++):(n=p,0===He&&qe(b)),n!==p)if(rt()!==p)if(f.substr(De,6)===F?(o=F,De+=6):(o=p,0===He&&qe(T)),o===p&&(f.substr(De,13)===M?(o=M,De+=13):(o=p,0===He&&qe(E))),o!==p)if(rt()!==p)if(44===f.charCodeAt(De)?(u=g,De++):(u=p,0===He&&qe(b)),u!==p)if(rt()!==p)if(a=De,f.substr(De,7)===P?(i=P,De+=7):(i=p,0===He&&qe(k)),(a=i!==p?(s=rt())!==p?(c=ut())!==p?i=[i,s,c]:(De=a,p):(De=a,p):(De=a,p))===p&&(a=null),a!==p)if((i=rt())!==p){if(s=[],(c=et())!==p)for(;c!==p;)s.push(c),c=et();else s=p;e=s!==p?(c=rt())!==p?(125===f.charCodeAt(De)?(l=v,De++):(l=p,0===He&&qe(d)),l!==p?(Se=e,t=I(r,o,a,s)):(De=e,p)):(De=e,p):(De=e,p)}else De=e,e=p;else De=e,e=p;else De=e,e=p;else De=e,e=p;else De=e,e=p;else De=e,e=p;else De=e,e=p;else De=e,e=p;else De=e,e=p;else De=e,e=p;else De=e,e=p;else De=e,e=p;return e}())===p&&(e=function(){var e,t,r,n,o,u,a,i,s;e=De,123===f.charCodeAt(De)?(t=h,De++):(t=p,0===He&&qe(m));if(t!==p)if(rt()!==p)if((r=Ve())!==p)if(rt()!==p)if(44===f.charCodeAt(De)?(n=g,De++):(n=p,0===He&&qe(b)),n!==p)if(rt()!==p)if(f.substr(De,6)===N?(o=N,De+=6):(o=p,0===He&&qe(R)),o!==p)if(rt()!==p)if(44===f.charCodeAt(De)?(u=g,De++):(u=p,0===He&&qe(b)),u!==p)if(rt()!==p){if(a=[],(i=Ye())!==p)for(;i!==p;)a.push(i),i=Ye();else a=p;e=a!==p?(i=rt())!==p?(125===f.charCodeAt(De)?(s=v,De++):(s=p,0===He&&qe(d)),s!==p?(Se=e,t=L(r,a)):(De=e,p)):(De=e,p):(De=e,p)}else De=e,e=p;else De=e,e=p;else De=e,e=p;else De=e,e=p;else De=e,e=p;else De=e,e=p;else De=e,e=p;else De=e,e=p;else De=e,e=p;else De=e,e=p;return e}()),e}function Ve(){var e,t,r;if((e=ut())===p){for(e=De,t=[],r=at();r!==p;)t.push(r),r=at();t!==p&&(Se=e,t=c(t)),e=t}return e}function Ye(){var e,t,r,n,o;return e=De,e=rt()!==p&&(t=ct())!==p&&rt()!==p?(123===f.charCodeAt(De)?(r=h,De++):(r=p,0===He&&qe(m)),r!==p&&(n=Ke())!==p?(125===f.charCodeAt(De)?(o=v,De++):(o=p,0===He&&qe(d)),o!==p?(Se=e,te(t,n)):(De=e,p)):(De=e,p)):(De=e,p)}function et(){var e,t,r,n,o;return e=De,e=rt()!==p&&(t=function(){var e;return f.substr(De,2)===D?(e=D,De+=2):(e=p,0===He&&qe(S)),e===p&&(f.substr(De,2)===X?(e=X,De+=2):(e=p,0===He&&qe(B)),e===p&&(f.substr(De,2)===z?(e=z,De+=2):(e=p,0===He&&qe(H)),e===p&&(f.substr(De,4)===Z?(e=Z,De+=4):(e=p,0===He&&qe(J)),e===p&&(f.substr(De,3)===U?(e=U,De+=3):(e=p,0===He&&qe(W)),e===p&&(f.substr(De,3)===$?(e=$,De+=3):(e=p,0===He&&qe(q)),e===p&&(f.substr(De,3)===G?(e=G,De+=3):(e=p,0===He&&qe(K)),e===p&&(f.substr(De,4)===Q?(e=Q,De+=4):(e=p,0===He&&qe(V)),e===p&&(f.substr(De,5)===Y?(e=Y,De+=5):(e=p,0===He&&qe(ee)))))))))),e}())!==p&&rt()!==p?(123===f.charCodeAt(De)?(r=h,De++):(r=p,0===He&&qe(m)),r!==p&&(n=Ke())!==p?(125===f.charCodeAt(De)?(o=v,De++):(o=p,0===He&&qe(d)),o!==p?(Se=e,re(t,n)):(De=e,p)):(De=e,p)):(De=e,p)}function tt(){var e,t;if(He++,e=[],oe.test(f.charAt(De))?(t=f.charAt(De),De++):(t=p,0===He&&qe(ue)),t!==p)for(;t!==p;)e.push(t),oe.test(f.charAt(De))?(t=f.charAt(De),De++):(t=p,0===He&&qe(ue));else e=p;return He--,e===p&&(t=p,0===He&&qe(ne)),e}function rt(){var e,t,r;for(He++,e=De,t=[],r=tt();r!==p;)t.push(r),r=tt();return e=t!==p?f.substring(e,De):t,He--,e===p&&(t=p,0===He&&qe(ae)),e}function nt(){var e;return ie.test(f.charAt(De))?(e=f.charAt(De),De++):(e=p,0===He&&qe(se)),e}function ot(){var e;return ce.test(f.charAt(De))?(e=f.charAt(De),De++):(e=p,0===He&&qe(le)),e}function ut(){var e,t,r;if(e=De,t=[],(r=nt())!==p)for(;r!==p;)t.push(r),r=nt();else t=p;return t!==p&&(Se=e,t=fe(t)),e=t}function at(){var e,t,r;return t=e=De,He++,39===f.charCodeAt(De)?(r=pe,De++):(r=p,0===He&&qe(he)),r===p&&(me.test(f.charAt(De))?(r=f.charAt(De),De++):(r=p,0===He&&qe(ve))),He--,(e=(t=r===p?void 0:(De=t,p))!==p?(f.length>De?(r=f.charAt(De),De++):(r=p,0===He&&qe(de)),r!==p?(Se=e,t=ye(r)):(De=e,p)):(De=e,p))===p&&(e=De,39===f.charCodeAt(De)?(t=pe,De++):(t=p,0===He&&qe(he)),e=t!==p&&(r=function(){var e;me.test(f.charAt(De))?(e=f.charAt(De),De++):(e=p,0===He&&qe(ve));e===p&&(e=it());return e}())!==p?(Se=e,t=ge(r)):(De=e,p)),e}function it(){var e;return He++,39===f.charCodeAt(De)?(e=pe,De++):(e=p,0===He&&qe(he)),He--,e===p&&0===He&&qe(be),e}function st(){var e,t,r,n,o,u,a,i;return e=De,39===f.charCodeAt(De)?(t=pe,De++):(t=p,0===He&&qe(he)),(e=t!==p&&(r=it())!==p?(Se=e,t=ge(r)):(De=e,p))===p&&(Ae.test(f.charAt(De))?(e=f.charAt(De),De++):(e=p,0===He&&qe(we)),e===p&&(e=De,f.substr(De,2)===Ce?(t=Ce,De+=2):(t=p,0===He&&qe(Oe)),t!==p&&(Se=e,t=xe()),(e=t)===p&&(e=De,f.substr(De,2)===_e?(t=_e,De+=2):(t=p,0===He&&qe(je)),t!==p&&(Se=e,t=Fe()),(e=t)===p&&(e=De,f.substr(De,2)===Te?(t=Te,De+=2):(t=p,0===He&&qe(Me)),t!==p&&(Se=e,t=Ee()),(e=t)===p&&(e=De,f.substr(De,2)===Pe?(t=Pe,De+=2):(t=p,0===He&&qe(ke)),t!==p&&(Se=e,t=Ie()),(e=t)===p&&(e=De,f.substr(De,2)===Ne?(t=Ne,De+=2):(t=p,0===He&&qe(Re)),e=t!==p?(n=r=De,(r=(n=(o=ot())!==p&&(u=ot())!==p&&(a=ot())!==p&&(i=ot())!==p?o=[o,u,a,i]:(De=n,p))!==p?f.substring(r,De):n)!==p?(Se=e,t=Le(r)):(De=e,p)):(De=e,p))))))),e}function ct(){var e,t,r;if(e=De,t=[],(r=st())!==p)for(;r!==p;)t.push(r),r=st();else t=p;return t!==p&&(Se=e,t=c(t)),e=t}function lt(){return e&&e.captureLocation?{location:$e(Se,De)}:{}}if((t=a())!==p&&De===f.length)return t;throw t!==p&&De<f.length&&qe({type:"end"}),r=ze,n=Be<f.length?f.charAt(Be):null,o=Be<f.length?$e(Be,Be+1):$e(Be,Be),new ht(ht.buildMessage(r,n),r,n,o)},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 o,s,h,c=function(u,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),o=n&&a[n];return o||(o=new((e=u).bind.apply(e,[void 0].concat(t))),n&&(a[n]=o)),o}},l=(o=function(e,t){return(o=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}o(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),C=/\\#/g,O=(s=Error,l(m,s),m);function m(e,t){var r=s.call(this,e)||this;return r.variableId=t,r}function x(e,t,r,n,o,u){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(!(o&&l in o))throw new O("The intl string context variable '"+l+"' was not provided to the string '"+u+"'");var f=o[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=c.style?n.date[c.style]:void 0;a.push({type:0,value:r.getDateTimeFormat(t,p).format(f)})}else if(b(c)){p=c.style?n.time[c.style]:void 0;a.push({type:0,value:r.getDateTimeFormat(t,p).format(f)})}else if(y(c)){p=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,x(h.value,t,r,n,o))}else if(w(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,x(h.value,t,r,n,o))}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,t,r,n,o,u){var a=x(e,t,r,n,o,u);return 1===a.length?a[0].value:a.reduce(function(e,t){return e+t.value},"")}var j="@@",F=/@@(.*)@@/,T=0;function M(e,t){return e.split(F).filter(Boolean).map(function(e){return t[e]||e})}function E(e,t,r,n,i,o){var u=x(e,t,r,n,i,o),s={},a=u.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+(j+r)+j},"");if(!~a.indexOf("<"))return M(a,s);if(!i)throw new O("Message has placeholders but no values was given");if("undefined"==typeof DOMParser)throw new O("Cannot format XML message without DOMParser");var c=(h=h||new DOMParser).parseFromString("<template>"+a+"</template>","application/xml");if(c.getElementsByTagName("parsererror").length)throw new O("Malformed XML message "+c.getElementsByTagName("parsererror")[0].innerHTML);var l=c.firstChild;if(!l)throw new O("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,o=t.textContent;if(!r){var u=M(o||"",s);return e.concat(u)}if(!i[r])return 1===(u=M(n,s)).length?e.concat([u[0]]):e.concat(u);var a=i[r];if("function"!=typeof a)return e.concat([a]);if(null==o)return e.concat([a(o||void 0)]);u=M(o,s);return e.concat([a.apply(void 0,u)])},[]):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 o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function k(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:c(Intl.NumberFormat,e.number),getDateTimeFormat:c(Intl.DateTimeFormat,e.dateTime),getPluralRules:c(Intl.PluralRules,e.pluralRules)}}var N=(R.defaultLocale="en",R.__parse=void 0,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 o=this;if(void 0===t&&(t=R.defaultLocale),this.formatterCache={number:{},dateTime:{},pluralRules:{}},this.format=function(e){return _(o.ast,o.locale,o.formatters,o.formats,e,o.message)},this.formatToParts=function(e){return x(o.ast,o.locale,o.formatters,o.formats,e,o.message)},this.formatXMLMessage=function(e){return E(o.ast,o.locale,o.formatters,o.formats,e,o.message)},this.resolvedOptions=function(){return{locale:o.locale}},this.getAst=function(){return o.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=k(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,o,u){e.filter(function(e){return!d(e)&&!v(e)}).forEach(function(t){if(g(t)){var e=t.style?u.date[t.style]:void 0;return o.getDateTimeFormat(n,e)}return b(t)?(e=t.style?u.time[t.style]:void 0,o.getDateTimeFormat(n,e)):y(t)?(e=t.style?u.number[t.style]:void 0,o.getNumberFormat(n,e)):A(t)?Object.keys(t.options).forEach(function(e){return r(t.options[e].value,n,o,u)}):w(t)?(o.getPluralRules(n,{type:t.pluralType}),Object.keys(t.options).forEach(function(e){return r(t.options[e].value,n,o,u)})):void 0})}(this.ast,this.locale,this.formatters,this.formats)}N.__parse=function(e,t){var r=f(e,t);return t&&!1===t.normalizeHashtagInPlural||function l(e){e.forEach(function(c){w(c)&&Object.keys(c.options).forEach(function(e){for(var t,r=c.options[e],n=-1,o=void 0,u=0;u<r.value.length;u++){var a=r.value[u];if(v(a)&&p.test(a.value)){n=u,o=a;break}}if(o){var i=o.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=N,e.createDefaultFormatters=I,e.default=N,e.formatToParts=x,e.formatToString=_,e.formatXMLMessage=E,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=intl-messageformat.min.js.map

@@ -164,2 +164,8 @@ var __extends = (this && this.__extends) || (function () {

}
function restoreRichPlaceholderMessage(text, objectParts) {
return text
.split(TOKEN_REGEX)
.filter(Boolean)
.map(function (c) { return objectParts[c] || c; });
}
export function formatXMLMessage(els, locales, formatters, formats, values,

@@ -180,3 +186,3 @@ // For debugging

if (!~formattedMessage.indexOf('<')) {
return [formattedMessage];
return restoreRichPlaceholderMessage(formattedMessage, objectParts);
}

@@ -204,3 +210,3 @@ if (!values) {

if (!tagsToFormat.length) {
return [formattedMessage];
return restoreRichPlaceholderMessage(formattedMessage, objectParts);
}

@@ -212,12 +218,12 @@ var childNodes = Array.prototype.slice.call(content.childNodes);

if (!tagName) {
var chunks = (textContent || '').split(TOKEN_REGEX).filter(Boolean);
return reconstructedChunks.concat.apply(reconstructedChunks, chunks.map(function (c) { return objectParts[c] || c; }));
var chunks = restoreRichPlaceholderMessage(textContent || '', objectParts);
return reconstructedChunks.concat(chunks);
}
// Legacy HTML
if (!values[tagName]) {
var chunks = outerHTML.split(TOKEN_REGEX).filter(Boolean);
var chunks = restoreRichPlaceholderMessage(outerHTML, objectParts);
if (chunks.length === 1) {
return reconstructedChunks.concat([chunks[0]]);
}
return reconstructedChunks.concat.apply(reconstructedChunks, chunks.map(function (c) { return objectParts[c] || c; }));
return reconstructedChunks.concat(chunks);
}

@@ -232,6 +238,4 @@ // XML Tag replacement

}
var chunks = textContent.split(TOKEN_REGEX).filter(Boolean);
return reconstructedChunks.concat([
formatFnOrValue.apply(void 0, chunks.map(function (c) { return objectParts[c] || c; }))
]);
var chunks = restoreRichPlaceholderMessage(textContent, objectParts);
return reconstructedChunks.concat([formatFnOrValue.apply(void 0, chunks)]);
}

@@ -238,0 +242,0 @@ return reconstructedChunks.concat([formatFnOrValue]);

{
"name": "intl-messageformat",
"version": "5.4.0",
"version": "5.4.1",
"description": "Formats ICU Message strings with number, date, plural, and select placeholders to create localized messages.",

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

"license": "BSD-3-Clause",
"gitHead": "84ec48b28f7ce7d3520c629e1519cfe8afd4050b"
"gitHead": "d2225cb98a37cea5d5dbd7950c7380950c67a3e9"
}

@@ -249,2 +249,12 @@ import {

function restoreRichPlaceholderMessage(
text: string,
objectParts: Record<string, any>
): Array<string | object> {
return text
.split(TOKEN_REGEX)
.filter(Boolean)
.map(c => objectParts[c] || c);
}
export function formatXMLMessage(

@@ -279,3 +289,3 @@ els: MessageFormatElement[],

if (!~formattedMessage.indexOf('<')) {
return [formattedMessage];
return restoreRichPlaceholderMessage(formattedMessage, objectParts);
}

@@ -313,3 +323,3 @@ if (!values) {

if (!tagsToFormat.length) {
return [formattedMessage];
return restoreRichPlaceholderMessage(formattedMessage, objectParts);
}

@@ -322,6 +332,7 @@

if (!tagName) {
const chunks = (textContent || '').split(TOKEN_REGEX).filter(Boolean);
return reconstructedChunks.concat(
...chunks.map(c => objectParts[c] || c)
const chunks = restoreRichPlaceholderMessage(
textContent || '',
objectParts
);
return reconstructedChunks.concat(chunks);
}

@@ -331,3 +342,3 @@

if (!values[tagName]) {
const chunks = outerHTML.split(TOKEN_REGEX).filter(Boolean);
const chunks = restoreRichPlaceholderMessage(outerHTML, objectParts);
if (chunks.length === 1) {

@@ -337,5 +348,3 @@ return reconstructedChunks.concat([chunks[0]]);

return reconstructedChunks.concat(
...chunks.map(c => objectParts[c] || c)
);
return reconstructedChunks.concat(chunks);
}

@@ -351,6 +360,4 @@

}
const chunks = textContent.split(TOKEN_REGEX).filter(Boolean);
return reconstructedChunks.concat([
formatFnOrValue(...chunks.map(c => objectParts[c] || c))
]);
const chunks = restoreRichPlaceholderMessage(textContent, objectParts);
return reconstructedChunks.concat([formatFnOrValue(...chunks)]);
}

@@ -357,0 +364,0 @@ return reconstructedChunks.concat([formatFnOrValue as object]);

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