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.2.0 to 5.3.0

11

CHANGELOG.md

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

# [5.3.0](https://github.com/formatjs/formatjs/compare/intl-messageformat@5.2.0...intl-messageformat@5.3.0) (2019-07-25)
### Features
* **intl-messageformat:** allow passing in object to formatXMLMessage ([ce05b8a](https://github.com/formatjs/formatjs/commit/ce05b8a))
# [5.2.0](https://github.com/formatjs/formatjs/compare/intl-messageformat@5.1.2...intl-messageformat@5.2.0) (2019-07-25)

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

2

dist/core.d.ts

@@ -17,3 +17,3 @@ import { parse, MessageFormatElement } from 'intl-messageformat-parser';

formatToParts: (values?: Record<string, any> | undefined) => import("./formatters").MessageFormatPart[];
formatXMLMessage: (values?: Record<string, string | number | boolean | FormatXMLElementFn | null | undefined> | undefined) => (string | object)[];
formatXMLMessage: (values?: Record<string, string | number | boolean | object | FormatXMLElementFn | null | undefined> | undefined) => (string | object)[];
resolvedOptions: () => {

@@ -20,0 +20,0 @@ locale: string;

@@ -34,2 +34,2 @@ import { MessageFormatElement } from 'intl-messageformat-parser';

export declare type FormatXMLElementFn = (str?: string) => string | object;
export declare function formatXMLMessage(els: MessageFormatElement[], locales: string | string[], formatters: Formatters, formats: Formats, values?: Record<string, PrimitiveType | FormatXMLElementFn>, originalMessage?: string): Array<string | object>;
export declare function formatXMLMessage(els: MessageFormatElement[], locales: string | string[], formatters: Formatters, formats: Formats, values?: Record<string, PrimitiveType | object | FormatXMLElementFn>, originalMessage?: string): Array<string | object>;

@@ -207,4 +207,9 @@ "use strict";

else {
var formatFn = values[tagName];
reconstructedChunks.push(formatFn(node.textContent || undefined));
var formatFnOrValue = values[tagName];
if (typeof formatFnOrValue === 'function') {
reconstructedChunks.push(formatFnOrValue(node.textContent || undefined));
}
else {
reconstructedChunks.push(formatFnOrValue);
}
}

@@ -211,0 +216,0 @@ }

@@ -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,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:",N=Ze("offset:",!1),k=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())},I="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())},S="=0",D=Ze("=0",!1),X="=1",z=Ze("=1",!1),B="=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="\\}",Ne=Ze("\\}",!1),ke=function(){return"}"},Ie="\\u",Re=Ze("\\u",!1),Le=function(e){return String.fromCharCode(parseInt(e,16))},Se=0,De=0,Xe=[{line:1,column:1}],ze=0,Be=[],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){Se<ze||(ze<Se&&(ze=Se,Be=[]),Be.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=Se,(t=function(){var e,t,r,n,o,u;t=[],r=e=Se,r=(n=rt())!==p?(o=ct(),o!==p?(u=rt())!==p?n=[n,o,u]:(Se=r,p):(Se=r,p)):(Se=r,p);if(r!==p)for(;r!==p;)t.push(r),r=Se,n=rt(),r=n!==p?(o=ct())!==p?(u=rt())!==p?n=[n,o,u]:(Se=r,p):(Se=r,p):(Se=r,p);else t=p;t!==p&&(De=e,t=i(t));(e=t)===p&&(e=Se,t=tt(),e=t!==p?f.substring(e,Se):t);return e}())!==p&&(De=e,t=s(t));return e=t}())===p&&(e=function(){var e,t,r,n,o;He++,e=Se,123===f.charCodeAt(Se)?(t=h,Se++):(t=p,0===He&&qe(m));e=t!==p?(r=rt(),r!==p?(n=Ve())!==p?rt()!==p?(125===f.charCodeAt(Se)?(o=v,Se++):(o=p,0===He&&qe(d)),o!==p?(De=e,t=y(n)):(Se=e,p)):(Se=e,p):(Se=e,p):(Se=e,p)):(Se=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=Se,123===f.charCodeAt(Se)?(t=h,Se++):(t=p,0===He&&qe(m));e=t!==p?(r=rt(),r!==p?(n=Ve())!==p?rt()!==p?(44===f.charCodeAt(Se)?(o=g,Se++):(o=p,0===He&&qe(b)),o!==p?rt()!==p?(f.substr(Se,6)===A?(u=A,Se+=6):(u=p,0===He&&qe(w)),u===p&&(f.substr(Se,4)===C?(u=C,Se+=4):(u=p,0===He&&qe(O)),u===p&&(f.substr(Se,4)===x?(u=x,Se+=4):(u=p,0===He&&qe(_)))),u!==p?rt()!==p?(a=Se,44===f.charCodeAt(Se)?(i=g,Se++):(i=p,0===He&&qe(b)),(a=i!==p?(s=rt())!==p?(c=ct())!==p?i=[i,s,c]:(Se=a,p):(Se=a,p):(Se=a,p))===p&&(a=null),a!==p?(i=rt())!==p?(125===f.charCodeAt(Se)?(s=v,Se++):(s=p,0===He&&qe(d)),s!==p?(De=e,t=j(n,u,a)):(Se=e,p)):(Se=e,p):(Se=e,p)):(Se=e,p):(Se=e,p)):(Se=e,p):(Se=e,p)):(Se=e,p):(Se=e,p):(Se=e,p)):(Se=e,p);return e}())===p&&(e=function(){var e,t,r,n,o,u,a,i,s,c,l;e=Se,123===f.charCodeAt(Se)?(t=h,Se++):(t=p,0===He&&qe(m));if(t!==p)if(rt()!==p)if((r=Ve())!==p)if(rt()!==p)if(44===f.charCodeAt(Se)?(n=g,Se++):(n=p,0===He&&qe(b)),n!==p)if(rt()!==p)if(f.substr(Se,6)===F?(o=F,Se+=6):(o=p,0===He&&qe(T)),o===p&&(f.substr(Se,13)===M?(o=M,Se+=13):(o=p,0===He&&qe(E))),o!==p)if(rt()!==p)if(44===f.charCodeAt(Se)?(u=g,Se++):(u=p,0===He&&qe(b)),u!==p)if(rt()!==p)if(a=Se,f.substr(Se,7)===P?(i=P,Se+=7):(i=p,0===He&&qe(N)),(a=i!==p?(s=rt())!==p?(c=ut())!==p?i=[i,s,c]:(Se=a,p):(Se=a,p):(Se=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(Se)?(l=v,Se++):(l=p,0===He&&qe(d)),l!==p?(De=e,t=k(r,o,a,s)):(Se=e,p)):(Se=e,p):(Se=e,p)}else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;return e}())===p&&(e=function(){var e,t,r,n,o,u,a,i,s;e=Se,123===f.charCodeAt(Se)?(t=h,Se++):(t=p,0===He&&qe(m));if(t!==p)if(rt()!==p)if((r=Ve())!==p)if(rt()!==p)if(44===f.charCodeAt(Se)?(n=g,Se++):(n=p,0===He&&qe(b)),n!==p)if(rt()!==p)if(f.substr(Se,6)===I?(o=I,Se+=6):(o=p,0===He&&qe(R)),o!==p)if(rt()!==p)if(44===f.charCodeAt(Se)?(u=g,Se++):(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(Se)?(s=v,Se++):(s=p,0===He&&qe(d)),s!==p?(De=e,t=L(r,a)):(Se=e,p)):(Se=e,p):(Se=e,p)}else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;return e}()),e}function Ve(){var e,t,r;if((e=ut())===p){for(e=Se,t=[],r=at();r!==p;)t.push(r),r=at();t!==p&&(De=e,t=c(t)),e=t}return e}function Ye(){var e,t,r,n,o;return e=Se,e=rt()!==p&&(t=ct())!==p&&rt()!==p?(123===f.charCodeAt(Se)?(r=h,Se++):(r=p,0===He&&qe(m)),r!==p&&(n=Ke())!==p?(125===f.charCodeAt(Se)?(o=v,Se++):(o=p,0===He&&qe(d)),o!==p?(De=e,te(t,n)):(Se=e,p)):(Se=e,p)):(Se=e,p)}function et(){var e,t,r,n,o;return e=Se,e=rt()!==p&&(t=function(){var e;return f.substr(Se,2)===S?(e=S,Se+=2):(e=p,0===He&&qe(D)),e===p&&(f.substr(Se,2)===X?(e=X,Se+=2):(e=p,0===He&&qe(z)),e===p&&(f.substr(Se,2)===B?(e=B,Se+=2):(e=p,0===He&&qe(H)),e===p&&(f.substr(Se,4)===Z?(e=Z,Se+=4):(e=p,0===He&&qe(J)),e===p&&(f.substr(Se,3)===U?(e=U,Se+=3):(e=p,0===He&&qe(W)),e===p&&(f.substr(Se,3)===$?(e=$,Se+=3):(e=p,0===He&&qe(q)),e===p&&(f.substr(Se,3)===G?(e=G,Se+=3):(e=p,0===He&&qe(K)),e===p&&(f.substr(Se,4)===Q?(e=Q,Se+=4):(e=p,0===He&&qe(V)),e===p&&(f.substr(Se,5)===Y?(e=Y,Se+=5):(e=p,0===He&&qe(ee)))))))))),e}())!==p&&rt()!==p?(123===f.charCodeAt(Se)?(r=h,Se++):(r=p,0===He&&qe(m)),r!==p&&(n=Ke())!==p?(125===f.charCodeAt(Se)?(o=v,Se++):(o=p,0===He&&qe(d)),o!==p?(De=e,re(t,n)):(Se=e,p)):(Se=e,p)):(Se=e,p)}function tt(){var e,t;if(He++,e=[],oe.test(f.charAt(Se))?(t=f.charAt(Se),Se++):(t=p,0===He&&qe(ue)),t!==p)for(;t!==p;)e.push(t),oe.test(f.charAt(Se))?(t=f.charAt(Se),Se++):(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=Se,t=[],r=tt();r!==p;)t.push(r),r=tt();return e=t!==p?f.substring(e,Se):t,He--,e===p&&(t=p,0===He&&qe(ae)),e}function nt(){var e;return ie.test(f.charAt(Se))?(e=f.charAt(Se),Se++):(e=p,0===He&&qe(se)),e}function ot(){var e;return ce.test(f.charAt(Se))?(e=f.charAt(Se),Se++):(e=p,0===He&&qe(le)),e}function ut(){var e,t,r;if(e=Se,t=[],(r=nt())!==p)for(;r!==p;)t.push(r),r=nt();else t=p;return t!==p&&(De=e,t=fe(t)),e=t}function at(){var e,t,r;return t=e=Se,He++,39===f.charCodeAt(Se)?(r=pe,Se++):(r=p,0===He&&qe(he)),r===p&&(me.test(f.charAt(Se))?(r=f.charAt(Se),Se++):(r=p,0===He&&qe(ve))),He--,(e=(t=r===p?void 0:(Se=t,p))!==p?(f.length>Se?(r=f.charAt(Se),Se++):(r=p,0===He&&qe(de)),r!==p?(De=e,t=ye(r)):(Se=e,p)):(Se=e,p))===p&&(e=Se,39===f.charCodeAt(Se)?(t=pe,Se++):(t=p,0===He&&qe(he)),e=t!==p&&(r=function(){var e;me.test(f.charAt(Se))?(e=f.charAt(Se),Se++):(e=p,0===He&&qe(ve));e===p&&(e=it());return e}())!==p?(De=e,t=ge(r)):(Se=e,p)),e}function it(){var e;return He++,39===f.charCodeAt(Se)?(e=pe,Se++):(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=Se,39===f.charCodeAt(Se)?(t=pe,Se++):(t=p,0===He&&qe(he)),(e=t!==p&&(r=it())!==p?(De=e,t=ge(r)):(Se=e,p))===p&&(Ae.test(f.charAt(Se))?(e=f.charAt(Se),Se++):(e=p,0===He&&qe(we)),e===p&&(e=Se,f.substr(Se,2)===Ce?(t=Ce,Se+=2):(t=p,0===He&&qe(Oe)),t!==p&&(De=e,t=xe()),(e=t)===p&&(e=Se,f.substr(Se,2)===_e?(t=_e,Se+=2):(t=p,0===He&&qe(je)),t!==p&&(De=e,t=Fe()),(e=t)===p&&(e=Se,f.substr(Se,2)===Te?(t=Te,Se+=2):(t=p,0===He&&qe(Me)),t!==p&&(De=e,t=Ee()),(e=t)===p&&(e=Se,f.substr(Se,2)===Pe?(t=Pe,Se+=2):(t=p,0===He&&qe(Ne)),t!==p&&(De=e,t=ke()),(e=t)===p&&(e=Se,f.substr(Se,2)===Ie?(t=Ie,Se+=2):(t=p,0===He&&qe(Re)),e=t!==p?(n=r=Se,(r=(n=(o=ot())!==p&&(u=ot())!==p&&(a=ot())!==p&&(i=ot())!==p?o=[o,u,a,i]:(Se=n,p))!==p?f.substring(r,Se):n)!==p?(De=e,t=Le(r)):(Se=e,p)):(Se=e,p))))))),e}function ct(){var e,t,r;if(e=Se,t=[],(r=st())!==p)for(;r!==p;)t.push(r),r=st();else t=p;return t!==p&&(De=e,t=c(t)),e=t}function lt(){return e&&e.captureLocation?{location:$e(De,Se)}:{}}if((t=a())!==p&&Se===f.length)return t;throw t!==p&&Se<f.length&&qe({type:"end"}),r=Be,n=ze<f.length?f.charAt(ze):null,o=ze<f.length?$e(ze,ze+1):$e(ze,ze),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,m,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(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,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},"")}function j(e,t,r,n,o,u){var a=x(e,t,r,n,o,u).reduce(function(e,t){return e+t.value},"");if(!~a.indexOf("<"))return[a];if(!o)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 i=(m=m||new DOMParser).parseFromString("<template>"+a+"</template>","application/xml");if(i.getElementsByTagName("parsererror").length)throw new O("Malformed XML message "+i.getElementsByTagName("parsererror")[0].innerHTML);var s=i.firstChild;if(!s)throw new O("Malformed XML message "+a);if(!Object.keys(o).filter(function(e){return!!i.getElementsByTagName(e).length}).length)return[a];for(var c=[],l=0;l<s.childNodes.length;l++){var f=s.childNodes[l],p=f.tagName;if(p)if(o[p]){var h=o[p];c.push(h(f.textContent||void 0))}else c.push(f.outerHTML);else c.push(f.textContent||"")}return c}var F=function(){return(F=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 T(r,n){return n?Object.keys(r).reduce(function(e,t){return e[t]=function(r,n){return n?F({},r||{},n||{},Object.keys(r).reduce(function(e,t){return e[t]=F({},r[t],n[t]||{}),e},{})):r}(r[t],n[t]),e},F({},r)):r}function M(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 E=(P.defaultLocale="en",P.__parse=void 0,P.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"}}},P);function P(e,t,r,n){var o=this;if(void 0===t&&(t=P.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 j(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,!P.__parse)throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");this.ast=P.__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=T(P.formats,r),this.locale=function(e){"string"==typeof e&&(e=[e]);try{return Intl.NumberFormat.supportedLocalesOf(e,{localeMatcher:"best fit"})[0]}catch(e){return E.defaultLocale}}(t||[]),this.formatters=n&&n.formatters||M(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)}E.__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=E,e.createDefaultFormatters=M,e.default=E,e.formatToParts=x,e.formatToString=_,e.formatXMLMessage=j,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:",N=Ze("offset:",!1),k=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())},I="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())},S="=0",D=Ze("=0",!1),X="=1",z=Ze("=1",!1),B="=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="\\}",Ne=Ze("\\}",!1),ke=function(){return"}"},Ie="\\u",Re=Ze("\\u",!1),Le=function(e){return String.fromCharCode(parseInt(e,16))},Se=0,De=0,Xe=[{line:1,column:1}],ze=0,Be=[],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){Se<ze||(ze<Se&&(ze=Se,Be=[]),Be.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=Se,(t=function(){var e,t,r,n,o,u;t=[],r=e=Se,r=(n=rt())!==p?(o=ct(),o!==p?(u=rt())!==p?n=[n,o,u]:(Se=r,p):(Se=r,p)):(Se=r,p);if(r!==p)for(;r!==p;)t.push(r),r=Se,n=rt(),r=n!==p?(o=ct())!==p?(u=rt())!==p?n=[n,o,u]:(Se=r,p):(Se=r,p):(Se=r,p);else t=p;t!==p&&(De=e,t=i(t));(e=t)===p&&(e=Se,t=tt(),e=t!==p?f.substring(e,Se):t);return e}())!==p&&(De=e,t=s(t));return e=t}())===p&&(e=function(){var e,t,r,n,o;He++,e=Se,123===f.charCodeAt(Se)?(t=h,Se++):(t=p,0===He&&qe(m));e=t!==p?(r=rt(),r!==p?(n=Ve())!==p?rt()!==p?(125===f.charCodeAt(Se)?(o=v,Se++):(o=p,0===He&&qe(d)),o!==p?(De=e,t=y(n)):(Se=e,p)):(Se=e,p):(Se=e,p):(Se=e,p)):(Se=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=Se,123===f.charCodeAt(Se)?(t=h,Se++):(t=p,0===He&&qe(m));e=t!==p?(r=rt(),r!==p?(n=Ve())!==p?rt()!==p?(44===f.charCodeAt(Se)?(o=g,Se++):(o=p,0===He&&qe(b)),o!==p?rt()!==p?(f.substr(Se,6)===A?(u=A,Se+=6):(u=p,0===He&&qe(w)),u===p&&(f.substr(Se,4)===C?(u=C,Se+=4):(u=p,0===He&&qe(O)),u===p&&(f.substr(Se,4)===x?(u=x,Se+=4):(u=p,0===He&&qe(_)))),u!==p?rt()!==p?(a=Se,44===f.charCodeAt(Se)?(i=g,Se++):(i=p,0===He&&qe(b)),(a=i!==p?(s=rt())!==p?(c=ct())!==p?i=[i,s,c]:(Se=a,p):(Se=a,p):(Se=a,p))===p&&(a=null),a!==p?(i=rt())!==p?(125===f.charCodeAt(Se)?(s=v,Se++):(s=p,0===He&&qe(d)),s!==p?(De=e,t=j(n,u,a)):(Se=e,p)):(Se=e,p):(Se=e,p)):(Se=e,p):(Se=e,p)):(Se=e,p):(Se=e,p)):(Se=e,p):(Se=e,p):(Se=e,p)):(Se=e,p);return e}())===p&&(e=function(){var e,t,r,n,o,u,a,i,s,c,l;e=Se,123===f.charCodeAt(Se)?(t=h,Se++):(t=p,0===He&&qe(m));if(t!==p)if(rt()!==p)if((r=Ve())!==p)if(rt()!==p)if(44===f.charCodeAt(Se)?(n=g,Se++):(n=p,0===He&&qe(b)),n!==p)if(rt()!==p)if(f.substr(Se,6)===F?(o=F,Se+=6):(o=p,0===He&&qe(T)),o===p&&(f.substr(Se,13)===M?(o=M,Se+=13):(o=p,0===He&&qe(E))),o!==p)if(rt()!==p)if(44===f.charCodeAt(Se)?(u=g,Se++):(u=p,0===He&&qe(b)),u!==p)if(rt()!==p)if(a=Se,f.substr(Se,7)===P?(i=P,Se+=7):(i=p,0===He&&qe(N)),(a=i!==p?(s=rt())!==p?(c=ut())!==p?i=[i,s,c]:(Se=a,p):(Se=a,p):(Se=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(Se)?(l=v,Se++):(l=p,0===He&&qe(d)),l!==p?(De=e,t=k(r,o,a,s)):(Se=e,p)):(Se=e,p):(Se=e,p)}else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;return e}())===p&&(e=function(){var e,t,r,n,o,u,a,i,s;e=Se,123===f.charCodeAt(Se)?(t=h,Se++):(t=p,0===He&&qe(m));if(t!==p)if(rt()!==p)if((r=Ve())!==p)if(rt()!==p)if(44===f.charCodeAt(Se)?(n=g,Se++):(n=p,0===He&&qe(b)),n!==p)if(rt()!==p)if(f.substr(Se,6)===I?(o=I,Se+=6):(o=p,0===He&&qe(R)),o!==p)if(rt()!==p)if(44===f.charCodeAt(Se)?(u=g,Se++):(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(Se)?(s=v,Se++):(s=p,0===He&&qe(d)),s!==p?(De=e,t=L(r,a)):(Se=e,p)):(Se=e,p):(Se=e,p)}else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;else Se=e,e=p;return e}()),e}function Ve(){var e,t,r;if((e=ut())===p){for(e=Se,t=[],r=at();r!==p;)t.push(r),r=at();t!==p&&(De=e,t=c(t)),e=t}return e}function Ye(){var e,t,r,n,o;return e=Se,e=rt()!==p&&(t=ct())!==p&&rt()!==p?(123===f.charCodeAt(Se)?(r=h,Se++):(r=p,0===He&&qe(m)),r!==p&&(n=Ke())!==p?(125===f.charCodeAt(Se)?(o=v,Se++):(o=p,0===He&&qe(d)),o!==p?(De=e,te(t,n)):(Se=e,p)):(Se=e,p)):(Se=e,p)}function et(){var e,t,r,n,o;return e=Se,e=rt()!==p&&(t=function(){var e;return f.substr(Se,2)===S?(e=S,Se+=2):(e=p,0===He&&qe(D)),e===p&&(f.substr(Se,2)===X?(e=X,Se+=2):(e=p,0===He&&qe(z)),e===p&&(f.substr(Se,2)===B?(e=B,Se+=2):(e=p,0===He&&qe(H)),e===p&&(f.substr(Se,4)===Z?(e=Z,Se+=4):(e=p,0===He&&qe(J)),e===p&&(f.substr(Se,3)===U?(e=U,Se+=3):(e=p,0===He&&qe(W)),e===p&&(f.substr(Se,3)===$?(e=$,Se+=3):(e=p,0===He&&qe(q)),e===p&&(f.substr(Se,3)===G?(e=G,Se+=3):(e=p,0===He&&qe(K)),e===p&&(f.substr(Se,4)===Q?(e=Q,Se+=4):(e=p,0===He&&qe(V)),e===p&&(f.substr(Se,5)===Y?(e=Y,Se+=5):(e=p,0===He&&qe(ee)))))))))),e}())!==p&&rt()!==p?(123===f.charCodeAt(Se)?(r=h,Se++):(r=p,0===He&&qe(m)),r!==p&&(n=Ke())!==p?(125===f.charCodeAt(Se)?(o=v,Se++):(o=p,0===He&&qe(d)),o!==p?(De=e,re(t,n)):(Se=e,p)):(Se=e,p)):(Se=e,p)}function tt(){var e,t;if(He++,e=[],oe.test(f.charAt(Se))?(t=f.charAt(Se),Se++):(t=p,0===He&&qe(ue)),t!==p)for(;t!==p;)e.push(t),oe.test(f.charAt(Se))?(t=f.charAt(Se),Se++):(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=Se,t=[],r=tt();r!==p;)t.push(r),r=tt();return e=t!==p?f.substring(e,Se):t,He--,e===p&&(t=p,0===He&&qe(ae)),e}function nt(){var e;return ie.test(f.charAt(Se))?(e=f.charAt(Se),Se++):(e=p,0===He&&qe(se)),e}function ot(){var e;return ce.test(f.charAt(Se))?(e=f.charAt(Se),Se++):(e=p,0===He&&qe(le)),e}function ut(){var e,t,r;if(e=Se,t=[],(r=nt())!==p)for(;r!==p;)t.push(r),r=nt();else t=p;return t!==p&&(De=e,t=fe(t)),e=t}function at(){var e,t,r;return t=e=Se,He++,39===f.charCodeAt(Se)?(r=pe,Se++):(r=p,0===He&&qe(he)),r===p&&(me.test(f.charAt(Se))?(r=f.charAt(Se),Se++):(r=p,0===He&&qe(ve))),He--,(e=(t=r===p?void 0:(Se=t,p))!==p?(f.length>Se?(r=f.charAt(Se),Se++):(r=p,0===He&&qe(de)),r!==p?(De=e,t=ye(r)):(Se=e,p)):(Se=e,p))===p&&(e=Se,39===f.charCodeAt(Se)?(t=pe,Se++):(t=p,0===He&&qe(he)),e=t!==p&&(r=function(){var e;me.test(f.charAt(Se))?(e=f.charAt(Se),Se++):(e=p,0===He&&qe(ve));e===p&&(e=it());return e}())!==p?(De=e,t=ge(r)):(Se=e,p)),e}function it(){var e;return He++,39===f.charCodeAt(Se)?(e=pe,Se++):(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=Se,39===f.charCodeAt(Se)?(t=pe,Se++):(t=p,0===He&&qe(he)),(e=t!==p&&(r=it())!==p?(De=e,t=ge(r)):(Se=e,p))===p&&(Ae.test(f.charAt(Se))?(e=f.charAt(Se),Se++):(e=p,0===He&&qe(we)),e===p&&(e=Se,f.substr(Se,2)===Ce?(t=Ce,Se+=2):(t=p,0===He&&qe(Oe)),t!==p&&(De=e,t=xe()),(e=t)===p&&(e=Se,f.substr(Se,2)===_e?(t=_e,Se+=2):(t=p,0===He&&qe(je)),t!==p&&(De=e,t=Fe()),(e=t)===p&&(e=Se,f.substr(Se,2)===Te?(t=Te,Se+=2):(t=p,0===He&&qe(Me)),t!==p&&(De=e,t=Ee()),(e=t)===p&&(e=Se,f.substr(Se,2)===Pe?(t=Pe,Se+=2):(t=p,0===He&&qe(Ne)),t!==p&&(De=e,t=ke()),(e=t)===p&&(e=Se,f.substr(Se,2)===Ie?(t=Ie,Se+=2):(t=p,0===He&&qe(Re)),e=t!==p?(n=r=Se,(r=(n=(o=ot())!==p&&(u=ot())!==p&&(a=ot())!==p&&(i=ot())!==p?o=[o,u,a,i]:(Se=n,p))!==p?f.substring(r,Se):n)!==p?(De=e,t=Le(r)):(Se=e,p)):(Se=e,p))))))),e}function ct(){var e,t,r;if(e=Se,t=[],(r=st())!==p)for(;r!==p;)t.push(r),r=st();else t=p;return t!==p&&(De=e,t=c(t)),e=t}function lt(){return e&&e.captureLocation?{location:$e(De,Se)}:{}}if((t=a())!==p&&Se===f.length)return t;throw t!==p&&Se<f.length&&qe({type:"end"}),r=Be,n=ze<f.length?f.charAt(ze):null,o=ze<f.length?$e(ze,ze+1):$e(ze,ze),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,m,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(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,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},"")}function j(e,t,r,n,o,u){var a=x(e,t,r,n,o,u).reduce(function(e,t){return e+t.value},"");if(!~a.indexOf("<"))return[a];if(!o)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 i=(m=m||new DOMParser).parseFromString("<template>"+a+"</template>","application/xml");if(i.getElementsByTagName("parsererror").length)throw new O("Malformed XML message "+i.getElementsByTagName("parsererror")[0].innerHTML);var s=i.firstChild;if(!s)throw new O("Malformed XML message "+a);if(!Object.keys(o).filter(function(e){return!!i.getElementsByTagName(e).length}).length)return[a];for(var c=[],l=0;l<s.childNodes.length;l++){var f=s.childNodes[l],p=f.tagName;if(p)if(o[p]){var h=o[p];"function"==typeof h?c.push(h(f.textContent||void 0)):c.push(h)}else c.push(f.outerHTML);else c.push(f.textContent||"")}return c}var F=function(){return(F=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 T(r,n){return n?Object.keys(r).reduce(function(e,t){return e[t]=function(r,n){return n?F({},r||{},n||{},Object.keys(r).reduce(function(e,t){return e[t]=F({},r[t],n[t]||{}),e},{})):r}(r[t],n[t]),e},F({},r)):r}function M(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 E=(P.defaultLocale="en",P.__parse=void 0,P.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"}}},P);function P(e,t,r,n){var o=this;if(void 0===t&&(t=P.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 j(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,!P.__parse)throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");this.ast=P.__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=T(P.formats,r),this.locale=function(e){"string"==typeof e&&(e=[e]);try{return Intl.NumberFormat.supportedLocalesOf(e,{localeMatcher:"best fit"})[0]}catch(e){return E.defaultLocale}}(t||[]),this.formatters=n&&n.formatters||M(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)}E.__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=E,e.createDefaultFormatters=M,e.default=E,e.formatToParts=x,e.formatToString=_,e.formatXMLMessage=j,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=intl-messageformat.min.js.map

@@ -17,3 +17,3 @@ import { parse, MessageFormatElement } from 'intl-messageformat-parser';

formatToParts: (values?: Record<string, any> | undefined) => import("./formatters").MessageFormatPart[];
formatXMLMessage: (values?: Record<string, string | number | boolean | FormatXMLElementFn | null | undefined> | undefined) => (string | object)[];
formatXMLMessage: (values?: Record<string, string | number | boolean | object | FormatXMLElementFn | null | undefined> | undefined) => (string | object)[];
resolvedOptions: () => {

@@ -20,0 +20,0 @@ locale: string;

@@ -34,2 +34,2 @@ import { MessageFormatElement } from 'intl-messageformat-parser';

export declare type FormatXMLElementFn = (str?: string) => string | object;
export declare function formatXMLMessage(els: MessageFormatElement[], locales: string | string[], formatters: Formatters, formats: Formats, values?: Record<string, PrimitiveType | FormatXMLElementFn>, originalMessage?: string): Array<string | object>;
export declare function formatXMLMessage(els: MessageFormatElement[], locales: string | string[], formatters: Formatters, formats: Formats, values?: Record<string, PrimitiveType | object | FormatXMLElementFn>, originalMessage?: string): Array<string | object>;

@@ -203,4 +203,9 @@ var __extends = (this && this.__extends) || (function () {

else {
var formatFn = values[tagName];
reconstructedChunks.push(formatFn(node.textContent || undefined));
var formatFnOrValue = values[tagName];
if (typeof formatFnOrValue === 'function') {
reconstructedChunks.push(formatFnOrValue(node.textContent || undefined));
}
else {
reconstructedChunks.push(formatFnOrValue);
}
}

@@ -207,0 +212,0 @@ }

{
"name": "intl-messageformat",
"version": "5.2.0",
"version": "5.3.0",
"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": "0a4253ccd32ac4d878b6a9ebb8777f29c0c32201"
"gitHead": "5c28b462ac096859747dfd24ad4fbfda406a844b"
}

@@ -206,3 +206,3 @@ /*

formatXMLMessage = (
values?: Record<string, PrimitiveType | FormatXMLElementFn>
values?: Record<string, PrimitiveType | object | FormatXMLElementFn>
) =>

@@ -209,0 +209,0 @@ formatXMLMessage(

@@ -248,3 +248,3 @@ import {

formats: Formats,
values?: Record<string, PrimitiveType | FormatXMLElementFn>,
values?: Record<string, PrimitiveType | object | FormatXMLElementFn>,
// For debugging

@@ -312,4 +312,10 @@ originalMessage?: string

} else {
const formatFn = values[tagName] as FormatXMLElementFn;
reconstructedChunks.push(formatFn(node.textContent || undefined));
const formatFnOrValue = values[tagName];
if (typeof formatFnOrValue === 'function') {
reconstructedChunks.push(
formatFnOrValue(node.textContent || undefined)
);
} else {
reconstructedChunks.push(formatFnOrValue as object);
}
}

@@ -316,0 +322,0 @@ }

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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