intl-messageformat 8.2.0 → 8.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/umd/intl-messageformat.js +3 -0
- package/dist/umd/intl-messageformat.js.map +1 -1
- package/dist/umd/intl-messageformat.min.js +1 -1
- package/dist/umd/intl-messageformat.min.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/intl-messageformat.d.ts +20 -0
- package/package.json +2 -2
- package/src/index.ts +1 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!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 Xt,t;function C(e){return e.type===Xt.literal}function F(e){return e.type===Xt.select}function k(e){return e.type===Xt.plural}(t=Xt||(Xt={}))[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",t[t.pound=7]="pound",t[t.tag=8]="tag";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)}),Yt=function(){return(Yt=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)},er=(o=Error,r(u,o),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 a(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)?a(e[0])+"-"+a(e[1]):a(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 "+((u=t)?'"'+n(u)+'"':"end of input")+" found.";var u},u);function u(e,t,r,n){var a=o.call(this)||this;return a.message=e,a.expected=t,a.found=r,a.location=n,a.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(a,u),a}var f=function(f,e){e=void 0!==e?e:{};var t,p={},r={start:Ct},n=Ct,a=function(e){return e.join("")},o=function(e){return Yt({type:Xt.literal,value:e},Wt())},u="#",i=yt("#",!1),c=function(){return Yt({type:Xt.pound},Wt())},s=bt("tagElement"),l="<",h=yt("<",!1),g="/>",m=yt("/>",!1),d=function(e){return Yt({type:Xt.literal,value:e.join("")},Wt())},y=function(e,t,r){return e!==r&&dt('Mismatch tag "'+e+'" !== "'+r+'"',mt()),Yt({type:Xt.tag,value:e,children:t},Wt())},v=function(){return Jt.push("openingTag"),!0},b=">",A=yt(">",!1),w=function(e){return Jt.pop(),!0},x=function(e){return e},C="</",F=yt("</",!1),k=function(){return Jt.push("closingTag"),!0},D=bt("argumentElement"),E="{",O=yt("{",!1),j="}",S=yt("}",!1),T=function(e){return Yt({type:Xt.argument,value:e},Wt())},_=bt("numberSkeletonId"),R=/^['\/{}]/,P=vt(["'","/","{","}"],!1,!1),I={type:"any"},N=bt("numberSkeletonTokenOption"),Z="/",z=yt("/",!1),B=function(e){return e},M=bt("numberSkeletonToken"),L=function(e,t){return{stem:e,options:t}},H=function(e){return Yt({type:0,tokens:e},Wt())},$="::",q=yt("::",!1),U=function(e){return e},V=function(){return Jt.push("numberArgStyle"),!0},G=function(e){return Jt.pop(),e.replace(/\s*$/,"")},J=",",K=yt(",",!1),Q="number",W=yt("number",!1),X=function(e,t,r){return Yt({type:"number"===t?Xt.number:"date"===t?Xt.date:Xt.time,style:r&&r[2],value:e},Wt())},Y="'",ee=yt("'",!1),te=/^[^']/,re=vt(["'"],!0,!1),ne=/^[^a-zA-Z'{}]/,ae=vt([["a","z"],["A","Z"],"'","{","}"],!0,!1),oe=/^[a-zA-Z]/,ue=vt([["a","z"],["A","Z"]],!1,!1),ie=function(e){return Yt({type:1,pattern:e},Wt())},ce=function(){return Jt.push("dateOrTimeArgStyle"),!0},se="date",le=yt("date",!1),fe="time",pe=yt("time",!1),he="plural",ge=yt("plural",!1),me="selectordinal",de=yt("selectordinal",!1),ye="offset:",ve=yt("offset:",!1),be=function(e,t,r,n){return Yt({type:Xt.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,a=t.location;return r in e&&dt('Duplicate option "'+r+'" in plural element: "'+gt()+'"',mt()),e[r]={value:n,location:a},e},{})},Wt())},Ae="select",we=yt("select",!1),xe=function(e,t){return Yt({type:Xt.select,value:e,options:t.reduce(function(e,t){var r=t.id,n=t.value,a=t.location;return r in e&&dt('Duplicate option "'+r+'" in select element: "'+gt()+'"',mt()),e[r]={value:n,location:a},e},{})},Wt())},Ce="=",Fe=yt("=",!1),ke=function(e){return Jt.push("select"),!0},De=function(e,t){return Jt.pop(),Yt({id:e,value:t},Wt())},Ee=function(e){return Jt.push("plural"),!0},Oe=function(e,t){return Jt.pop(),Yt({id:e,value:t},Wt())},je=bt("whitespace"),Se=/^[\t-\r \x85\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,Te=vt([["\t","\r"]," ","
"," "," ",[" "," "],"\u2028","\u2029"," "," "," "],!1,!1),_e=bt("syntax pattern"),Re=/^[!-\/:-@[-\^`{-~\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]/,Pe=vt([["!","/"],[":","@"],["[","^"],"`",["{","~"],["¡","§"],"©","«","¬","®","°","±","¶","»","¿","×","÷",["‐","‧"],["‰","‾"],["⁁","⁓"],["⁕","⁞"],["←",""],["─","❵"],["➔","⯿"],["⸀",""],["、","〃"],["〈","〠"],"〰","﴾","﴿","﹅","﹆"],!1,!1),Ie=bt("optional whitespace"),Ne=bt("number"),Ze="-",ze=yt("-",!1),Be=function(e,t){return t?e?-t:t:0},Me=bt("double apostrophes"),Le="''",He=yt("''",!1),$e=function(){return"'"},qe=function(e,t){return e+t.replace("''","'")},Ue=function(e){return!("<"===e||"{"===e||Qt()&&"#"===e||Kt()&&"}"===e||Kt()&&">"===e)},Ve="\n",Ge=yt("\n",!1),Je=function(e){return"<"===e||">"===e||"{"===e||"}"===e||Qt()&&"#"===e},Ke=bt("argNameOrNumber"),Qe=bt("validTag"),We=bt("argNumber"),Xe="0",Ye=yt("0",!1),et=function(){return 0},tt=/^[1-9]/,rt=vt([["1","9"]],!1,!1),nt=/^[0-9]/,at=vt([["0","9"]],!1,!1),ot=function(e){return parseInt(e.join(""),10)},ut=bt("argName"),it=bt("tagName"),ct=0,st=0,lt=[{line:1,column:1}],ft=0,pt=[],ht=0;if(void 0!==e.startRule){if(!(e.startRule in r))throw new Error("Can't start parsing from rule \""+e.startRule+'".');n=r[e.startRule]}function gt(){return f.substring(st,ct)}function mt(){return wt(st,ct)}function dt(e,t){throw function(e,t){return new er(e,[],"",t)}(e,t=void 0!==t?t:wt(st,ct))}function yt(e,t){return{type:"literal",text:e,ignoreCase:t}}function vt(e,t,r){return{type:"class",parts:e,inverted:t,ignoreCase:r}}function bt(e){return{type:"other",description:e}}function At(e){var t,r=lt[e];if(r)return r;for(t=e-1;!lt[t];)t--;for(r={line:(r=lt[t]).line,column:r.column};t<e;)10===f.charCodeAt(t)?(r.line++,r.column=1):r.column++,t++;return lt[e]=r}function wt(e,t){var r=At(e),n=At(t);return{start:{offset:e,line:r.line,column:r.column},end:{offset:t,line:n.line,column:n.column}}}function xt(e){ct<ft||(ft<ct&&(ft=ct,pt=[]),pt.push(e))}function Ct(){return Ft()}function Ft(){var e,t;for(e=[],t=kt();t!==p;)e.push(t),t=kt();return e}function kt(){var e;return(e=function(){var e,t;e=ct,(t=Dt())!==p&&(st=e,t=o(t));return e=t}())===p&&(e=function(){var e,t,r,n,a;ht++,e=ct,123===f.charCodeAt(ct)?(t=E,ct++):(t=p,0===ht&&xt(O));e=t!==p?(r=Nt(),r!==p?(n=Lt())!==p?Nt()!==p?(125===f.charCodeAt(ct)?(a=j,ct++):(a=p,0===ht&&xt(S)),a!==p?(st=e,t=T(n)):(ct=e,p)):(ct=e,p):(ct=e,p):(ct=e,p)):(ct=e,p);ht--,e===p&&(t=p,0===ht&&xt(D));return e}())===p&&(e=function(){var e;(e=function(){var e,t,r,n,a,o,u,i,c,s;e=ct,123===f.charCodeAt(ct)?(t=E,ct++):(t=p,0===ht&&xt(O));e=t!==p?(r=Nt(),r!==p?(n=Lt())!==p?Nt()!==p?(44===f.charCodeAt(ct)?(a=J,ct++):(a=p,0===ht&&xt(K)),a!==p?Nt()!==p?(f.substr(ct,6)===Q?(o=Q,ct+=6):(o=p,0===ht&&xt(W)),o!==p?Nt()!==p?(u=ct,44===f.charCodeAt(ct)?(i=J,ct++):(i=p,0===ht&&xt(K)),(u=i!==p?(c=Nt())!==p?(s=function(){var e,t,r;e=ct,f.substr(ct,2)===$?(t=$,ct+=2):(t=p,0===ht&&xt(q));e=t!==p?(r=function(){var e,t,r;if(e=ct,t=[],(r=jt())!==p)for(;r!==p;)t.push(r),r=jt();else t=p;t!==p&&(st=e,t=H(t));return e=t}(),r!==p?(st=e,t=U(r)):(ct=e,p)):(ct=e,p);e===p&&(st=e=ct,t=V(),e=(t=t?void 0:p)!==p?(r=Dt())!==p?(st=e,t=G(r)):(ct=e,p):(ct=e,p));return e}())!==p?i=[i,c,s]:(ct=u,p):(ct=u,p):(ct=u,p))===p&&(u=null),u!==p?(i=Nt())!==p?(125===f.charCodeAt(ct)?(c=j,ct++):(c=p,0===ht&&xt(S)),c!==p?(st=e,t=X(n,o,u)):(ct=e,p)):(ct=e,p):(ct=e,p)):(ct=e,p):(ct=e,p)):(ct=e,p):(ct=e,p)):(ct=e,p):(ct=e,p):(ct=e,p)):(ct=e,p);return e}())===p&&(e=function(){var e,t,r,n,a,o,u,i,c,s;e=ct,123===f.charCodeAt(ct)?(t=E,ct++):(t=p,0===ht&&xt(O));e=t!==p?(r=Nt(),r!==p?(n=Lt())!==p?Nt()!==p?(44===f.charCodeAt(ct)?(a=J,ct++):(a=p,0===ht&&xt(K)),a!==p?Nt()!==p?(f.substr(ct,4)===se?(o=se,ct+=4):(o=p,0===ht&&xt(le)),o===p&&(f.substr(ct,4)===fe?(o=fe,ct+=4):(o=p,0===ht&&xt(pe))),o!==p?Nt()!==p?(u=ct,44===f.charCodeAt(ct)?(i=J,ct++):(i=p,0===ht&&xt(K)),(u=i!==p?(c=Nt())!==p?(s=function(){var e,t,r;e=ct,f.substr(ct,2)===$?(t=$,ct+=2):(t=p,0===ht&&xt(q));e=t!==p?(r=function(){var e,t,r,n;t=e=ct,r=[],(n=St())===p&&(n=Tt());if(n!==p)for(;n!==p;)r.push(n),(n=St())===p&&(n=Tt());else r=p;t=r!==p?f.substring(t,ct):r;t!==p&&(st=e,t=ie(t));return e=t}(),r!==p?(st=e,t=U(r)):(ct=e,p)):(ct=e,p);e===p&&(st=e=ct,t=ce(),e=(t=t?void 0:p)!==p?(r=Dt())!==p?(st=e,t=G(r)):(ct=e,p):(ct=e,p));return e}())!==p?i=[i,c,s]:(ct=u,p):(ct=u,p):(ct=u,p))===p&&(u=null),u!==p?(i=Nt())!==p?(125===f.charCodeAt(ct)?(c=j,ct++):(c=p,0===ht&&xt(S)),c!==p?(st=e,t=X(n,o,u)):(ct=e,p)):(ct=e,p):(ct=e,p)):(ct=e,p):(ct=e,p)):(ct=e,p):(ct=e,p)):(ct=e,p):(ct=e,p):(ct=e,p)):(ct=e,p);return e}());return e}())===p&&(e=function(){var e,t,r,n,a,o,u,i,c,s,l;e=ct,123===f.charCodeAt(ct)?(t=E,ct++):(t=p,0===ht&&xt(O));if(t!==p)if(Nt()!==p)if((r=Lt())!==p)if(Nt()!==p)if(44===f.charCodeAt(ct)?(n=J,ct++):(n=p,0===ht&&xt(K)),n!==p)if(Nt()!==p)if(f.substr(ct,6)===he?(a=he,ct+=6):(a=p,0===ht&&xt(ge)),a===p&&(f.substr(ct,13)===me?(a=me,ct+=13):(a=p,0===ht&&xt(de))),a!==p)if(Nt()!==p)if(44===f.charCodeAt(ct)?(o=J,ct++):(o=p,0===ht&&xt(K)),o!==p)if(Nt()!==p)if(u=ct,f.substr(ct,7)===ye?(i=ye,ct+=7):(i=p,0===ht&&xt(ve)),(u=i!==p?(c=Nt())!==p?(s=Zt())!==p?i=[i,c,s]:(ct=u,p):(ct=u,p):(ct=u,p))===p&&(u=null),u!==p)if((i=Nt())!==p){if(c=[],(s=Rt())!==p)for(;s!==p;)c.push(s),s=Rt();else c=p;e=c!==p?(s=Nt())!==p?(125===f.charCodeAt(ct)?(l=j,ct++):(l=p,0===ht&&xt(S)),l!==p?(st=e,t=be(r,a,u,c)):(ct=e,p)):(ct=e,p):(ct=e,p)}else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;return e}())===p&&(e=function(){var e,t,r,n,a,o,u,i,c;e=ct,123===f.charCodeAt(ct)?(t=E,ct++):(t=p,0===ht&&xt(O));if(t!==p)if(Nt()!==p)if((r=Lt())!==p)if(Nt()!==p)if(44===f.charCodeAt(ct)?(n=J,ct++):(n=p,0===ht&&xt(K)),n!==p)if(Nt()!==p)if(f.substr(ct,6)===Ae?(a=Ae,ct+=6):(a=p,0===ht&&xt(we)),a!==p)if(Nt()!==p)if(44===f.charCodeAt(ct)?(o=J,ct++):(o=p,0===ht&&xt(K)),o!==p)if(Nt()!==p){if(u=[],(i=_t())!==p)for(;i!==p;)u.push(i),i=_t();else u=p;e=u!==p?(i=Nt())!==p?(125===f.charCodeAt(ct)?(c=j,ct++):(c=p,0===ht&&xt(S)),c!==p?(st=e,t=xe(r,u)):(ct=e,p)):(ct=e,p):(ct=e,p)}else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;return e}())===p&&(e=function(){var e,t,r,n,a,o;ht++,t=e=ct,60===f.charCodeAt(ct)?(r=l,ct++):(r=p,0===ht&&xt(h));t=r!==p?(n=Ht(),n!==p?(a=Nt())!==p?(f.substr(ct,2)===g?(o=g,ct+=2):(o=p,0===ht&&xt(m)),o!==p?r=[r,n,a,o]:(ct=t,p)):(ct=t,p):(ct=t,p)):(ct=t,p);t!==p&&(st=e,t=d(t));(e=t)===p&&(e=ct,t=function(){var e,t,r,n,a;e=ct,60===f.charCodeAt(ct)?(t=l,ct++):(t=p,0===ht&&xt(h));e=t!==p?(st=ct,r=v(),(r=r?void 0:p)!==p?(n=Ht())!==p?(62===f.charCodeAt(ct)?(a=b,ct++):(a=p,0===ht&&xt(A)),a!==p?(st=ct,(w()?void 0:p)!==p?(st=e,t=x(n)):(ct=e,p)):(ct=e,p)):(ct=e,p):(ct=e,p)):(ct=e,p);return e}(),e=t!==p?(r=Ft())!==p?(n=function(){var e,t,r,n,a;e=ct,f.substr(ct,2)===C?(t=C,ct+=2):(t=p,0===ht&&xt(F));e=t!==p?(st=ct,r=k(),(r=r?void 0:p)!==p?(n=Ht())!==p?(62===f.charCodeAt(ct)?(a=b,ct++):(a=p,0===ht&&xt(A)),a!==p?(st=ct,(w()?void 0:p)!==p?(st=e,t=x(n)):(ct=e,p)):(ct=e,p)):(ct=e,p):(ct=e,p)):(ct=e,p);return e}())!==p?(st=e,t=y(t,r,n)):(ct=e,p):(ct=e,p):(ct=e,p));ht--,e===p&&(t=p,0===ht&&xt(s));return e}())===p&&(e=function(){var e,t;e=ct,35===f.charCodeAt(ct)?(t=u,ct++):(t=p,0===ht&&xt(i));t!==p&&(st=e,t=c());return e=t}()),e}function Dt(){var e,t,r;if(e=ct,t=[],(r=zt())===p&&(r=Bt())===p&&(r=Mt()),r!==p)for(;r!==p;)t.push(r),(r=zt())===p&&(r=Bt())===p&&(r=Mt());else t=p;return t!==p&&(st=e,t=a(t)),e=t}function Et(){var e,t,r,n,a;if(ht++,t=[],n=r=e=ct,ht++,(a=Pt())===p&&(R.test(f.charAt(ct))?(a=f.charAt(ct),ct++):(a=p,0===ht&&xt(P))),ht--,(r=(n=a===p?void 0:(ct=n,p))!==p?(f.length>ct?(a=f.charAt(ct),ct++):(a=p,0===ht&&xt(I)),a!==p?n=[n,a]:(ct=r,p)):(ct=r,p))!==p)for(;r!==p;)t.push(r),n=r=ct,ht++,(a=Pt())===p&&(R.test(f.charAt(ct))?(a=f.charAt(ct),ct++):(a=p,0===ht&&xt(P))),ht--,r=(n=a===p?void 0:(ct=n,p))!==p?(f.length>ct?(a=f.charAt(ct),ct++):(a=p,0===ht&&xt(I)),a!==p?n=[n,a]:(ct=r,p)):(ct=r,p);else t=p;return e=t!==p?f.substring(e,ct):t,ht--,e===p&&(t=p,0===ht&&xt(_)),e}function Ot(){var e,t,r;return ht++,e=ct,47===f.charCodeAt(ct)?(t=Z,ct++):(t=p,0===ht&&xt(z)),e=t!==p&&(r=Et())!==p?(st=e,t=B(r)):(ct=e,p),ht--,e===p&&(t=p,0===ht&&xt(N)),e}function jt(){var e,t,r,n;if(ht++,e=ct,Nt()!==p)if((t=Et())!==p){for(r=[],n=Ot();n!==p;)r.push(n),n=Ot();e=r!==p?(st=e,L(t,r)):(ct=e,p)}else ct=e,e=p;else ct=e,e=p;return ht--,e===p&&(p,0===ht&&xt(M)),e}function St(){var e,t,r,n;if(e=ct,39===f.charCodeAt(ct)?(t=Y,ct++):(t=p,0===ht&&xt(ee)),t!==p){if(r=[],(n=zt())===p&&(te.test(f.charAt(ct))?(n=f.charAt(ct),ct++):(n=p,0===ht&&xt(re))),n!==p)for(;n!==p;)r.push(n),(n=zt())===p&&(te.test(f.charAt(ct))?(n=f.charAt(ct),ct++):(n=p,0===ht&&xt(re)));else r=p;e=r!==p?(39===f.charCodeAt(ct)?(n=Y,ct++):(n=p,0===ht&&xt(ee)),n!==p?t=[t,r,n]:(ct=e,p)):(ct=e,p)}else ct=e,e=p;if(e===p)if(e=[],(t=zt())===p&&(ne.test(f.charAt(ct))?(t=f.charAt(ct),ct++):(t=p,0===ht&&xt(ae))),t!==p)for(;t!==p;)e.push(t),(t=zt())===p&&(ne.test(f.charAt(ct))?(t=f.charAt(ct),ct++):(t=p,0===ht&&xt(ae)));else e=p;return e}function Tt(){var e,t;if(e=[],oe.test(f.charAt(ct))?(t=f.charAt(ct),ct++):(t=p,0===ht&&xt(ue)),t!==p)for(;t!==p;)e.push(t),oe.test(f.charAt(ct))?(t=f.charAt(ct),ct++):(t=p,0===ht&&xt(ue));else e=p;return e}function _t(){var e,t,r,n,a;return e=ct,e=Nt()!==p&&(t=qt())!==p&&Nt()!==p?(123===f.charCodeAt(ct)?(r=E,ct++):(r=p,0===ht&&xt(O)),r!==p?(st=ct,(ke()?void 0:p)!==p&&(n=Ft())!==p?(125===f.charCodeAt(ct)?(a=j,ct++):(a=p,0===ht&&xt(S)),a!==p?(st=e,De(t,n)):(ct=e,p)):(ct=e,p)):(ct=e,p)):(ct=e,p)}function Rt(){var e,t,r,n,a;return e=ct,e=Nt()!==p&&(t=function(){var e,t,r,n;return t=e=ct,61===f.charCodeAt(ct)?(r=Ce,ct++):(r=p,0===ht&&xt(Fe)),(e=(t=r!==p&&(n=Zt())!==p?r=[r,n]:(ct=t,p))!==p?f.substring(e,ct):t)===p&&(e=qt()),e}())!==p&&Nt()!==p?(123===f.charCodeAt(ct)?(r=E,ct++):(r=p,0===ht&&xt(O)),r!==p?(st=ct,(Ee()?void 0:p)!==p&&(n=Ft())!==p?(125===f.charCodeAt(ct)?(a=j,ct++):(a=p,0===ht&&xt(S)),a!==p?(st=e,Oe(t,n)):(ct=e,p)):(ct=e,p)):(ct=e,p)):(ct=e,p)}function Pt(){var e;return ht++,Se.test(f.charAt(ct))?(e=f.charAt(ct),ct++):(e=p,0===ht&&xt(Te)),ht--,e===p&&0===ht&&xt(je),e}function It(){var e;return ht++,Re.test(f.charAt(ct))?(e=f.charAt(ct),ct++):(e=p,0===ht&&xt(Pe)),ht--,e===p&&0===ht&&xt(_e),e}function Nt(){var e,t,r;for(ht++,e=ct,t=[],r=Pt();r!==p;)t.push(r),r=Pt();return e=t!==p?f.substring(e,ct):t,ht--,e===p&&(t=p,0===ht&&xt(Ie)),e}function Zt(){var e,t,r;return ht++,e=ct,45===f.charCodeAt(ct)?(t=Ze,ct++):(t=p,0===ht&&xt(ze)),t===p&&(t=null),e=t!==p&&(r=$t())!==p?(st=e,t=Be(t,r)):(ct=e,p),ht--,e===p&&(t=p,0===ht&&xt(Ne)),e}function zt(){var e,t;return ht++,e=ct,f.substr(ct,2)===Le?(t=Le,ct+=2):(t=p,0===ht&&xt(He)),t!==p&&(st=e,t=$e()),ht--,(e=t)===p&&(t=p,0===ht&&xt(Me)),e}function Bt(){var e,t,r,n,a,o;if(e=ct,39===f.charCodeAt(ct)?(t=Y,ct++):(t=p,0===ht&&xt(ee)),t!==p)if((r=function(){var e,t,r,n;t=e=ct,f.length>ct?(r=f.charAt(ct),ct++):(r=p,0===ht&&xt(I));t=r!==p?(st=ct,n=Je(r),(n=n?void 0:p)!==p?r=[r,n]:(ct=t,p)):(ct=t,p);e=t!==p?f.substring(e,ct):t;return e}())!==p){for(n=ct,a=[],f.substr(ct,2)===Le?(o=Le,ct+=2):(o=p,0===ht&&xt(He)),o===p&&(te.test(f.charAt(ct))?(o=f.charAt(ct),ct++):(o=p,0===ht&&xt(re)));o!==p;)a.push(o),f.substr(ct,2)===Le?(o=Le,ct+=2):(o=p,0===ht&&xt(He)),o===p&&(te.test(f.charAt(ct))?(o=f.charAt(ct),ct++):(o=p,0===ht&&xt(re)));e=(n=a!==p?f.substring(n,ct):a)!==p?(39===f.charCodeAt(ct)?(a=Y,ct++):(a=p,0===ht&&xt(ee)),a===p&&(a=null),a!==p?(st=e,t=qe(r,n)):(ct=e,p)):(ct=e,p)}else ct=e,e=p;else ct=e,e=p;return e}function Mt(){var e,t,r,n;return t=e=ct,f.length>ct?(r=f.charAt(ct),ct++):(r=p,0===ht&&xt(I)),(t=r!==p?(st=ct,(n=(n=Ue(r))?void 0:p)!==p?r=[r,n]:(ct=t,p)):(ct=t,p))===p&&(10===f.charCodeAt(ct)?(t=Ve,ct++):(t=p,0===ht&&xt(Ge))),e=t!==p?f.substring(e,ct):t}function Lt(){var e,t;return ht++,e=ct,(t=$t())===p&&(t=qt()),e=t!==p?f.substring(e,ct):t,ht--,e===p&&(t=p,0===ht&&xt(Ke)),e}function Ht(){var e,t;return ht++,e=ct,(t=$t())===p&&(t=function(){var e,t,r,n,a;ht++,e=ct,t=[],45===f.charCodeAt(ct)?(r=Ze,ct++):(r=p,0===ht&&xt(ze));r===p&&(n=r=ct,ht++,(a=Pt())===p&&(a=It()),ht--,n=a===p?void 0:(ct=n,p),r=n!==p?(f.length>ct?(a=f.charAt(ct),ct++):(a=p,0===ht&&xt(I)),a!==p?n=[n,a]:(ct=r,p)):(ct=r,p));if(r!==p)for(;r!==p;)t.push(r),45===f.charCodeAt(ct)?(r=Ze,ct++):(r=p,0===ht&&xt(ze)),r===p&&(n=r=ct,ht++,(a=Pt())===p&&(a=It()),ht--,n=a===p?void 0:(ct=n,p),r=n!==p?(f.length>ct?(a=f.charAt(ct),ct++):(a=p,0===ht&&xt(I)),a!==p?n=[n,a]:(ct=r,p)):(ct=r,p));else t=p;e=t!==p?f.substring(e,ct):t;ht--,e===p&&(t=p,0===ht&&xt(it));return e}()),e=t!==p?f.substring(e,ct):t,ht--,e===p&&(t=p,0===ht&&xt(Qe)),e}function $t(){var e,t,r,n,a;if(ht++,e=ct,48===f.charCodeAt(ct)?(t=Xe,ct++):(t=p,0===ht&&xt(Ye)),t!==p&&(st=e,t=et()),(e=t)===p){if(t=e=ct,tt.test(f.charAt(ct))?(r=f.charAt(ct),ct++):(r=p,0===ht&&xt(rt)),r!==p){for(n=[],nt.test(f.charAt(ct))?(a=f.charAt(ct),ct++):(a=p,0===ht&&xt(at));a!==p;)n.push(a),nt.test(f.charAt(ct))?(a=f.charAt(ct),ct++):(a=p,0===ht&&xt(at));t=n!==p?r=[r,n]:(ct=t,p)}else ct=t,t=p;t!==p&&(st=e,t=ot(t)),e=t}return ht--,e===p&&(t=p,0===ht&&xt(We)),e}function qt(){var e,t,r,n,a;if(ht++,t=[],n=r=e=ct,ht++,(a=Pt())===p&&(a=It()),ht--,(r=(n=a===p?void 0:(ct=n,p))!==p?(f.length>ct?(a=f.charAt(ct),ct++):(a=p,0===ht&&xt(I)),a!==p?n=[n,a]:(ct=r,p)):(ct=r,p))!==p)for(;r!==p;)t.push(r),n=r=ct,ht++,(a=Pt())===p&&(a=It()),ht--,r=(n=a===p?void 0:(ct=n,p))!==p?(f.length>ct?(a=f.charAt(ct),ct++):(a=p,0===ht&&xt(I)),a!==p?n=[n,a]:(ct=r,p)):(ct=r,p);else t=p;return e=t!==p?f.substring(e,ct):t,ht--,e===p&&(t=p,0===ht&&xt(ut)),e}var Ut,Vt,Gt,Jt=["root"];function Kt(){return 1<Jt.length}function Qt(){return"plural"===Jt[Jt.length-1]}function Wt(){return e&&e.captureLocation?{location:mt()}:{}}if((t=n())!==p&&ct===f.length)return t;throw t!==p&&ct<f.length&&xt({type:"end"}),Ut=pt,Vt=ft<f.length?f.charAt(ft):null,Gt=ft<f.length?wt(ft,ft+1):wt(ft,ft),new er(er.buildMessage(Ut,Vt),Ut,Vt,Gt)},p=function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),a=0;for(t=0;t<r;t++)for(var o=arguments[t],u=0,i=o.length;u<i;u++,a++)n[a]=o[u];return n},h=/(^|[^\\])#/g;var i=function(){return(i=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)},a=/(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;function D(e){var r={};return e.replace(a,function(e){var t=e.length;switch(e[0]){case"G":r.era=4===t?"long":5===t?"narrow":"short";break;case"y":r.year=2===t?"2-digit":"numeric";break;case"Y":case"u":case"U":case"r":throw new RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead");case"q":case"Q":throw new RangeError("`q/Q` (quarter) patterns are not supported");case"M":case"L":r.month=["numeric","2-digit","short","long","narrow"][t-1];break;case"w":case"W":throw new RangeError("`w/W` (week) patterns are not supported");case"d":r.day=["numeric","2-digit"][t-1];break;case"D":case"F":case"g":throw new RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");case"E":r.weekday=4===t?"short":5===t?"narrow":"short";break;case"e":if(t<4)throw new RangeError("`e..eee` (weekday) patterns are not supported");r.weekday=["short","long","narrow","short"][t-4];break;case"c":if(t<4)throw new RangeError("`c..ccc` (weekday) patterns are not supported");r.weekday=["short","long","narrow","short"][t-4];break;case"a":r.hour12=!0;break;case"b":case"B":throw new RangeError("`b/B` (period) patterns are not supported, use `a` instead");case"h":r.hourCycle="h12",r.hour=["numeric","2-digit"][t-1];break;case"H":r.hourCycle="h23",r.hour=["numeric","2-digit"][t-1];break;case"K":r.hourCycle="h11",r.hour=["numeric","2-digit"][t-1];break;case"k":r.hourCycle="h24",r.hour=["numeric","2-digit"][t-1];break;case"j":case"J":case"C":throw new RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");case"m":r.minute=["numeric","2-digit"][t-1];break;case"s":r.second=["numeric","2-digit"][t-1];break;case"S":case"A":throw new RangeError("`S/A` (second) pattenrs are not supported, use `s` instead");case"z":r.timeZoneName=t<4?"short":"long";break;case"Z":case"O":case"v":case"V":case"X":case"x":throw new RangeError("`Z/O/v/V/X/x` (timeZone) pattenrs are not supported, use `z` instead")}return""}),r}var c=/^\.(?:(0+)(\+|#+)?)?$/g,s=/^(@+)?(\+|#+)?$/g;function l(e){var n={};return e.replace(s,function(e,t,r){return"string"!=typeof r?(n.minimumSignificantDigits=t.length,n.maximumSignificantDigits=t.length):"+"===r?n.minimumSignificantDigits=t.length:"#"===t[0]?n.maximumSignificantDigits=t.length:(n.minimumSignificantDigits=t.length,n.maximumSignificantDigits=t.length+("string"==typeof r?r.length:0)),""}),n}function g(e){switch(e){case"sign-auto":return{signDisplay:"auto"};case"sign-accounting":return{currencySign:"accounting"};case"sign-always":return{signDisplay:"always"};case"sign-accounting-always":return{signDisplay:"always",currencySign:"accounting"};case"sign-except-zero":return{signDisplay:"exceptZero"};case"sign-accounting-except-zero":return{signDisplay:"exceptZero",currencySign:"accounting"};case"sign-never":return{signDisplay:"never"}}}function m(e){var t=g(e);return t||{}}function E(e){for(var n={},t=0,r=e;t<r.length;t++){var a=r[t];switch(a.stem){case"percent":n.style="percent";continue;case"currency":n.style="currency",n.currency=a.options[0];continue;case"group-off":n.useGrouping=!1;continue;case"precision-integer":n.maximumFractionDigits=0;continue;case"measure-unit":n.style="unit",n.unit=a.options[0].replace(/^(.*?)-/,"");continue;case"compact-short":n.notation="compact",n.compactDisplay="short";continue;case"compact-long":n.notation="compact",n.compactDisplay="long";continue;case"scientific":n=i(i(i({},n),{notation:"scientific"}),a.options.reduce(function(e,t){return i(i({},e),m(t))},{}));continue;case"engineering":n=i(i(i({},n),{notation:"engineering"}),a.options.reduce(function(e,t){return i(i({},e),m(t))},{}));continue;case"notation-simple":n.notation="standard";continue;case"unit-width-narrow":n.currencyDisplay="narrowSymbol",n.unitDisplay="narrow";continue;case"unit-width-short":n.currencyDisplay="code",n.unitDisplay="short";continue;case"unit-width-full-name":n.currencyDisplay="name",n.unitDisplay="long";continue;case"unit-width-iso-code":n.currencyDisplay="symbol";continue}if(c.test(a.stem)){if(1<a.options.length)throw new RangeError("Fraction-precision stems only accept a single optional option");a.stem.replace(c,function(e,t,r){return"."===e?n.maximumFractionDigits=0:"+"===r?n.minimumFractionDigits=r.length:"#"===t[0]?n.maximumFractionDigits=t.length:(n.minimumFractionDigits=t.length,n.maximumFractionDigits=t.length+("string"==typeof r?r.length:0)),""}),a.options.length&&(n=i(i({},n),l(a.options[0])))}else if(s.test(a.stem))n=i(i({},n),l(a.stem));else{var o=g(a.stem);o&&(n=i(i({},n),o))}}return n}function d(e,t){var r=f(e,t);return t&&!1===t.normalizeHashtagInPlural||function l(e){e.forEach(function(s){(k(s)||F(s))&&Object.keys(s.options).forEach(function(e){for(var t,r=s.options[e],n=-1,a=void 0,o=0;o<r.value.length;o++){var u=r.value[o];if(C(u)&&h.test(u.value)){n=o,a=u;break}}if(a){var i=a.value.replace(h,"$1{"+s.value+", number}"),c=f(i);(t=r.value).splice.apply(t,p([n,1],c))}l(r.value)})})}(r),r}var y=function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),a=0;for(t=0;t<r;t++)for(var o=arguments[t],u=0,i=o.length;u<i;u++,a++)n[a]=o[u];return n};function v(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 b,A,w=function(o,u){return void 0===u&&(u={}),function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=v(t),a=n&&u[n];return a||(a=new((e=o).bind.apply(e,y([void 0],t))),n&&(u[n]=a)),a}},x=(b=function(e,t){return(b=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}b(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),O=(A=Error,x(j,A),j.prototype.toString=function(){return"[formatjs Error: "+this.code+"] "+this.message},j);function j(e,t){var r=A.call(this,e)||this;return r.code=t,r}var S,T=(x(_,S=O),_);function _(e,t,r){return S.call(this,'Invalid values for "'+e+'": "'+t+'". Options are "'+Object.keys(r).join('", "')+'"',1)||this}var R,P=(x(I,R=O),I);function I(e,t){return R.call(this,'The intl string context variable "'+e+'" was not provided to the string "'+t+'"',0)||this}function N(e,t,r,n,a,o,u){if(1===e.length&&C(e[0]))return[{type:0,value:e[0].value}];for(var i,c,s=[],l=0,f=e;l<f.length;l++){var p=f[l];if(C(p))s.push({type:0,value:p.value});else if(p.type!==Xt.pound){var h=p.value;if(!(a&&h in a))throw new P(h,u);var g=a[h];if(p.type!==Xt.argument)if(p.type!==Xt.date)if(p.type!==Xt.time)if(p.type!==Xt.number){if(p.type===Xt.tag){var m=p.children,d=p.value,y=a[d];if("function"!=typeof y)throw new TypeError('Value for "'+d+'" must be a function');var v=N(m,t,r,n,a),b=y.apply(void 0,v.map(function(e){return e.value}));Array.isArray(b)||(b=[b]),s.push.apply(s,b.map(function(e){return{type:"string"==typeof e?0:1,value:e}}))}if(F(p)){if(!(A=p.options[g]||p.options.other))throw new T(p.value,g,Object.keys(p.options));s.push.apply(s,N(A.value,t,r,n,a))}else if(k(p)){var A;if(!(A=p.options["="+g])){if(!Intl.PluralRules)throw new O('Intl.PluralRules is not available in this environment.\nTry polyfilling it using "@formatjs/intl-pluralrules"\n',2);var w=r.getPluralRules(t,{type:p.pluralType}).select(g-(p.offset||0));A=p.options[w]||p.options.other}if(!A)throw new T(p.value,g,Object.keys(p.options));s.push.apply(s,N(A.value,t,r,n,a,g-(p.offset||0)))}else;}else{x="string"==typeof p.style?n.number[p.style]:(i=p.style)&&"object"==typeof i&&0===i.type?E(p.style.tokens):void 0;s.push({type:0,value:r.getNumberFormat(t,x).format(g)})}else{var x="string"==typeof p.style?n.time[p.style]:(c=p.style)&&"object"==typeof c&&1===c.type?D(p.style.pattern):void 0;s.push({type:0,value:r.getDateTimeFormat(t,x).format(g)})}else{var x="string"==typeof p.style?n.date[p.style]:void 0;s.push({type:0,value:r.getDateTimeFormat(t,x).format(g)})}else g&&"string"!=typeof g&&"number"!=typeof g||(g="string"==typeof g||"number"==typeof g?String(g):""),s.push({type:"string"==typeof g?0:1,value:g})}else"number"==typeof o&&s.push({type:0,value:r.getNumberFormat(t).format(o)})}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},[])}(s)}var Z=function(){return(Z=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)};function z(r,n){return n?Object.keys(r).reduce(function(e,t){return e[t]=function(r,n){return n?Z(Z(Z({},r||{}),n||{}),Object.keys(r).reduce(function(e,t){return e[t]=Z(Z({},r[t]),n[t]||{}),e},{})):r}(r[t],n[t]),e},Z({},r)):r}function B(e){return void 0===e&&(e={number:{},dateTime:{},pluralRules:{}}),{getNumberFormat:w(Intl.NumberFormat,e.number),getDateTimeFormat:w(Intl.DateTimeFormat,e.dateTime),getPluralRules:w(Intl.PluralRules,e.pluralRules)}}var M=(L.defaultLocale=(new Intl.NumberFormat).resolvedOptions().locale,L.__parse=d,L.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"}}},L);function L(e,t,r,n){var a=this;if(void 0===t&&(t=L.defaultLocale),this.formatterCache={number:{},dateTime:{},pluralRules:{}},this.format=function(e){var t=a.formatToParts(e);if(1===t.length)return t[0].value;var r=t.reduce(function(e,t){return e.length&&0===t.type&&"string"==typeof e[e.length-1]?e[e.length-1]+=t.value:e.push(t.value),e},[]);return r.length<=1?r[0]||"":r},this.formatToParts=function(e){return N(a.ast,a.locales,a.formatters,a.formats,e,void 0,a.message)},this.resolvedOptions=function(){return{locale:Intl.NumberFormat.supportedLocalesOf(a.locales)[0]}},this.getAst=function(){return a.ast},"string"==typeof e){if(this.message=e,!L.__parse)throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");this.ast=L.__parse(e,{normalizeHashtagInPlural:!1})}else this.ast=e;if(!Array.isArray(this.ast))throw new TypeError("A message must be provided as a String or AST.");this.formats=z(L.formats,r),this.locales=t,this.formatters=n&&n.formatters||B(this.formatterCache)}e.IntlMessageFormat=M,e.createDefaultFormatters=B,e.default=M,e.formatToParts=N,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
1
|
+
!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 Xt,t;function C(e){return e.type===Xt.literal}function F(e){return e.type===Xt.select}function k(e){return e.type===Xt.plural}(t=Xt||(Xt={}))[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",t[t.pound=7]="pound",t[t.tag=8]="tag";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)}),Yt=function(){return(Yt=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)},er=(o=Error,r(u,o),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 a(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)?a(e[0])+"-"+a(e[1]):a(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 "+((u=t)?'"'+n(u)+'"':"end of input")+" found.";var u},u);function u(e,t,r,n){var a=o.call(this)||this;return a.message=e,a.expected=t,a.found=r,a.location=n,a.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(a,u),a}var f=function(f,e){e=void 0!==e?e:{};var t,p={},r={start:Ct},n=Ct,a=function(e){return e.join("")},o=function(e){return Yt({type:Xt.literal,value:e},Wt())},u="#",i=yt("#",!1),c=function(){return Yt({type:Xt.pound},Wt())},s=bt("tagElement"),l="<",h=yt("<",!1),g="/>",m=yt("/>",!1),d=function(e){return Yt({type:Xt.literal,value:e.join("")},Wt())},y=function(e,t,r){return e!==r&&dt('Mismatch tag "'+e+'" !== "'+r+'"',mt()),Yt({type:Xt.tag,value:e,children:t},Wt())},v=function(){return Jt.push("openingTag"),!0},b=">",A=yt(">",!1),w=function(e){return Jt.pop(),!0},x=function(e){return e},C="</",F=yt("</",!1),k=function(){return Jt.push("closingTag"),!0},D=bt("argumentElement"),E="{",O=yt("{",!1),j="}",S=yt("}",!1),T=function(e){return Yt({type:Xt.argument,value:e},Wt())},_=bt("numberSkeletonId"),R=/^['\/{}]/,P=vt(["'","/","{","}"],!1,!1),I={type:"any"},N=bt("numberSkeletonTokenOption"),Z="/",z=yt("/",!1),B=function(e){return e},M=bt("numberSkeletonToken"),L=function(e,t){return{stem:e,options:t}},V=function(e){return Yt({type:0,tokens:e},Wt())},H="::",$=yt("::",!1),q=function(e){return e},U=function(){return Jt.push("numberArgStyle"),!0},G=function(e){return Jt.pop(),e.replace(/\s*$/,"")},J=",",K=yt(",",!1),Q="number",W=yt("number",!1),X=function(e,t,r){return Yt({type:"number"===t?Xt.number:"date"===t?Xt.date:Xt.time,style:r&&r[2],value:e},Wt())},Y="'",ee=yt("'",!1),te=/^[^']/,re=vt(["'"],!0,!1),ne=/^[^a-zA-Z'{}]/,ae=vt([["a","z"],["A","Z"],"'","{","}"],!0,!1),oe=/^[a-zA-Z]/,ue=vt([["a","z"],["A","Z"]],!1,!1),ie=function(e){return Yt({type:1,pattern:e},Wt())},ce=function(){return Jt.push("dateOrTimeArgStyle"),!0},se="date",le=yt("date",!1),fe="time",pe=yt("time",!1),he="plural",ge=yt("plural",!1),me="selectordinal",de=yt("selectordinal",!1),ye="offset:",ve=yt("offset:",!1),be=function(e,t,r,n){return Yt({type:Xt.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,a=t.location;return r in e&&dt('Duplicate option "'+r+'" in plural element: "'+gt()+'"',mt()),e[r]={value:n,location:a},e},{})},Wt())},Ae="select",we=yt("select",!1),xe=function(e,t){return Yt({type:Xt.select,value:e,options:t.reduce(function(e,t){var r=t.id,n=t.value,a=t.location;return r in e&&dt('Duplicate option "'+r+'" in select element: "'+gt()+'"',mt()),e[r]={value:n,location:a},e},{})},Wt())},Ce="=",Fe=yt("=",!1),ke=function(e){return Jt.push("select"),!0},De=function(e,t){return Jt.pop(),Yt({id:e,value:t},Wt())},Ee=function(e){return Jt.push("plural"),!0},Oe=function(e,t){return Jt.pop(),Yt({id:e,value:t},Wt())},je=bt("whitespace"),Se=/^[\t-\r \x85\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,Te=vt([["\t","\r"]," ","
"," "," ",[" "," "],"\u2028","\u2029"," "," "," "],!1,!1),_e=bt("syntax pattern"),Re=/^[!-\/:-@[-\^`{-~\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]/,Pe=vt([["!","/"],[":","@"],["[","^"],"`",["{","~"],["¡","§"],"©","«","¬","®","°","±","¶","»","¿","×","÷",["‐","‧"],["‰","‾"],["⁁","⁓"],["⁕","⁞"],["←",""],["─","❵"],["➔","⯿"],["⸀",""],["、","〃"],["〈","〠"],"〰","﴾","﴿","﹅","﹆"],!1,!1),Ie=bt("optional whitespace"),Ne=bt("number"),Ze="-",ze=yt("-",!1),Be=function(e,t){return t?e?-t:t:0},Me=bt("double apostrophes"),Le="''",Ve=yt("''",!1),He=function(){return"'"},$e=function(e,t){return e+t.replace("''","'")},qe=function(e){return!("<"===e||"{"===e||Qt()&&"#"===e||Kt()&&"}"===e||Kt()&&">"===e)},Ue="\n",Ge=yt("\n",!1),Je=function(e){return"<"===e||">"===e||"{"===e||"}"===e||Qt()&&"#"===e},Ke=bt("argNameOrNumber"),Qe=bt("validTag"),We=bt("argNumber"),Xe="0",Ye=yt("0",!1),et=function(){return 0},tt=/^[1-9]/,rt=vt([["1","9"]],!1,!1),nt=/^[0-9]/,at=vt([["0","9"]],!1,!1),ot=function(e){return parseInt(e.join(""),10)},ut=bt("argName"),it=bt("tagName"),ct=0,st=0,lt=[{line:1,column:1}],ft=0,pt=[],ht=0;if(void 0!==e.startRule){if(!(e.startRule in r))throw new Error("Can't start parsing from rule \""+e.startRule+'".');n=r[e.startRule]}function gt(){return f.substring(st,ct)}function mt(){return wt(st,ct)}function dt(e,t){throw function(e,t){return new er(e,[],"",t)}(e,t=void 0!==t?t:wt(st,ct))}function yt(e,t){return{type:"literal",text:e,ignoreCase:t}}function vt(e,t,r){return{type:"class",parts:e,inverted:t,ignoreCase:r}}function bt(e){return{type:"other",description:e}}function At(e){var t,r=lt[e];if(r)return r;for(t=e-1;!lt[t];)t--;for(r={line:(r=lt[t]).line,column:r.column};t<e;)10===f.charCodeAt(t)?(r.line++,r.column=1):r.column++,t++;return lt[e]=r}function wt(e,t){var r=At(e),n=At(t);return{start:{offset:e,line:r.line,column:r.column},end:{offset:t,line:n.line,column:n.column}}}function xt(e){ct<ft||(ft<ct&&(ft=ct,pt=[]),pt.push(e))}function Ct(){return Ft()}function Ft(){var e,t;for(e=[],t=kt();t!==p;)e.push(t),t=kt();return e}function kt(){var e;return(e=function(){var e,t;e=ct,(t=Dt())!==p&&(st=e,t=o(t));return e=t}())===p&&(e=function(){var e,t,r,n,a;ht++,e=ct,123===f.charCodeAt(ct)?(t=E,ct++):(t=p,0===ht&&xt(O));e=t!==p?(r=Nt(),r!==p?(n=Lt())!==p?Nt()!==p?(125===f.charCodeAt(ct)?(a=j,ct++):(a=p,0===ht&&xt(S)),a!==p?(st=e,t=T(n)):(ct=e,p)):(ct=e,p):(ct=e,p):(ct=e,p)):(ct=e,p);ht--,e===p&&(t=p,0===ht&&xt(D));return e}())===p&&(e=function(){var e;(e=function(){var e,t,r,n,a,o,u,i,c,s;e=ct,123===f.charCodeAt(ct)?(t=E,ct++):(t=p,0===ht&&xt(O));e=t!==p?(r=Nt(),r!==p?(n=Lt())!==p?Nt()!==p?(44===f.charCodeAt(ct)?(a=J,ct++):(a=p,0===ht&&xt(K)),a!==p?Nt()!==p?(f.substr(ct,6)===Q?(o=Q,ct+=6):(o=p,0===ht&&xt(W)),o!==p?Nt()!==p?(u=ct,44===f.charCodeAt(ct)?(i=J,ct++):(i=p,0===ht&&xt(K)),(u=i!==p?(c=Nt())!==p?(s=function(){var e,t,r;e=ct,f.substr(ct,2)===H?(t=H,ct+=2):(t=p,0===ht&&xt($));e=t!==p?(r=function(){var e,t,r;if(e=ct,t=[],(r=jt())!==p)for(;r!==p;)t.push(r),r=jt();else t=p;t!==p&&(st=e,t=V(t));return e=t}(),r!==p?(st=e,t=q(r)):(ct=e,p)):(ct=e,p);e===p&&(st=e=ct,t=U(),e=(t=t?void 0:p)!==p?(r=Dt())!==p?(st=e,t=G(r)):(ct=e,p):(ct=e,p));return e}())!==p?i=[i,c,s]:(ct=u,p):(ct=u,p):(ct=u,p))===p&&(u=null),u!==p?(i=Nt())!==p?(125===f.charCodeAt(ct)?(c=j,ct++):(c=p,0===ht&&xt(S)),c!==p?(st=e,t=X(n,o,u)):(ct=e,p)):(ct=e,p):(ct=e,p)):(ct=e,p):(ct=e,p)):(ct=e,p):(ct=e,p)):(ct=e,p):(ct=e,p):(ct=e,p)):(ct=e,p);return e}())===p&&(e=function(){var e,t,r,n,a,o,u,i,c,s;e=ct,123===f.charCodeAt(ct)?(t=E,ct++):(t=p,0===ht&&xt(O));e=t!==p?(r=Nt(),r!==p?(n=Lt())!==p?Nt()!==p?(44===f.charCodeAt(ct)?(a=J,ct++):(a=p,0===ht&&xt(K)),a!==p?Nt()!==p?(f.substr(ct,4)===se?(o=se,ct+=4):(o=p,0===ht&&xt(le)),o===p&&(f.substr(ct,4)===fe?(o=fe,ct+=4):(o=p,0===ht&&xt(pe))),o!==p?Nt()!==p?(u=ct,44===f.charCodeAt(ct)?(i=J,ct++):(i=p,0===ht&&xt(K)),(u=i!==p?(c=Nt())!==p?(s=function(){var e,t,r;e=ct,f.substr(ct,2)===H?(t=H,ct+=2):(t=p,0===ht&&xt($));e=t!==p?(r=function(){var e,t,r,n;t=e=ct,r=[],(n=St())===p&&(n=Tt());if(n!==p)for(;n!==p;)r.push(n),(n=St())===p&&(n=Tt());else r=p;t=r!==p?f.substring(t,ct):r;t!==p&&(st=e,t=ie(t));return e=t}(),r!==p?(st=e,t=q(r)):(ct=e,p)):(ct=e,p);e===p&&(st=e=ct,t=ce(),e=(t=t?void 0:p)!==p?(r=Dt())!==p?(st=e,t=G(r)):(ct=e,p):(ct=e,p));return e}())!==p?i=[i,c,s]:(ct=u,p):(ct=u,p):(ct=u,p))===p&&(u=null),u!==p?(i=Nt())!==p?(125===f.charCodeAt(ct)?(c=j,ct++):(c=p,0===ht&&xt(S)),c!==p?(st=e,t=X(n,o,u)):(ct=e,p)):(ct=e,p):(ct=e,p)):(ct=e,p):(ct=e,p)):(ct=e,p):(ct=e,p)):(ct=e,p):(ct=e,p):(ct=e,p)):(ct=e,p);return e}());return e}())===p&&(e=function(){var e,t,r,n,a,o,u,i,c,s,l;e=ct,123===f.charCodeAt(ct)?(t=E,ct++):(t=p,0===ht&&xt(O));if(t!==p)if(Nt()!==p)if((r=Lt())!==p)if(Nt()!==p)if(44===f.charCodeAt(ct)?(n=J,ct++):(n=p,0===ht&&xt(K)),n!==p)if(Nt()!==p)if(f.substr(ct,6)===he?(a=he,ct+=6):(a=p,0===ht&&xt(ge)),a===p&&(f.substr(ct,13)===me?(a=me,ct+=13):(a=p,0===ht&&xt(de))),a!==p)if(Nt()!==p)if(44===f.charCodeAt(ct)?(o=J,ct++):(o=p,0===ht&&xt(K)),o!==p)if(Nt()!==p)if(u=ct,f.substr(ct,7)===ye?(i=ye,ct+=7):(i=p,0===ht&&xt(ve)),(u=i!==p?(c=Nt())!==p?(s=Zt())!==p?i=[i,c,s]:(ct=u,p):(ct=u,p):(ct=u,p))===p&&(u=null),u!==p)if((i=Nt())!==p){if(c=[],(s=Rt())!==p)for(;s!==p;)c.push(s),s=Rt();else c=p;e=c!==p?(s=Nt())!==p?(125===f.charCodeAt(ct)?(l=j,ct++):(l=p,0===ht&&xt(S)),l!==p?(st=e,t=be(r,a,u,c)):(ct=e,p)):(ct=e,p):(ct=e,p)}else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;return e}())===p&&(e=function(){var e,t,r,n,a,o,u,i,c;e=ct,123===f.charCodeAt(ct)?(t=E,ct++):(t=p,0===ht&&xt(O));if(t!==p)if(Nt()!==p)if((r=Lt())!==p)if(Nt()!==p)if(44===f.charCodeAt(ct)?(n=J,ct++):(n=p,0===ht&&xt(K)),n!==p)if(Nt()!==p)if(f.substr(ct,6)===Ae?(a=Ae,ct+=6):(a=p,0===ht&&xt(we)),a!==p)if(Nt()!==p)if(44===f.charCodeAt(ct)?(o=J,ct++):(o=p,0===ht&&xt(K)),o!==p)if(Nt()!==p){if(u=[],(i=_t())!==p)for(;i!==p;)u.push(i),i=_t();else u=p;e=u!==p?(i=Nt())!==p?(125===f.charCodeAt(ct)?(c=j,ct++):(c=p,0===ht&&xt(S)),c!==p?(st=e,t=xe(r,u)):(ct=e,p)):(ct=e,p):(ct=e,p)}else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;else ct=e,e=p;return e}())===p&&(e=function(){var e,t,r,n,a,o;ht++,t=e=ct,60===f.charCodeAt(ct)?(r=l,ct++):(r=p,0===ht&&xt(h));t=r!==p?(n=Vt(),n!==p?(a=Nt())!==p?(f.substr(ct,2)===g?(o=g,ct+=2):(o=p,0===ht&&xt(m)),o!==p?r=[r,n,a,o]:(ct=t,p)):(ct=t,p):(ct=t,p)):(ct=t,p);t!==p&&(st=e,t=d(t));(e=t)===p&&(e=ct,t=function(){var e,t,r,n,a;e=ct,60===f.charCodeAt(ct)?(t=l,ct++):(t=p,0===ht&&xt(h));e=t!==p?(st=ct,r=v(),(r=r?void 0:p)!==p?(n=Vt())!==p?(62===f.charCodeAt(ct)?(a=b,ct++):(a=p,0===ht&&xt(A)),a!==p?(st=ct,(w()?void 0:p)!==p?(st=e,t=x(n)):(ct=e,p)):(ct=e,p)):(ct=e,p):(ct=e,p)):(ct=e,p);return e}(),e=t!==p?(r=Ft())!==p?(n=function(){var e,t,r,n,a;e=ct,f.substr(ct,2)===C?(t=C,ct+=2):(t=p,0===ht&&xt(F));e=t!==p?(st=ct,r=k(),(r=r?void 0:p)!==p?(n=Vt())!==p?(62===f.charCodeAt(ct)?(a=b,ct++):(a=p,0===ht&&xt(A)),a!==p?(st=ct,(w()?void 0:p)!==p?(st=e,t=x(n)):(ct=e,p)):(ct=e,p)):(ct=e,p):(ct=e,p)):(ct=e,p);return e}())!==p?(st=e,t=y(t,r,n)):(ct=e,p):(ct=e,p):(ct=e,p));ht--,e===p&&(t=p,0===ht&&xt(s));return e}())===p&&(e=function(){var e,t;e=ct,35===f.charCodeAt(ct)?(t=u,ct++):(t=p,0===ht&&xt(i));t!==p&&(st=e,t=c());return e=t}()),e}function Dt(){var e,t,r;if(e=ct,t=[],(r=zt())===p&&(r=Bt())===p&&(r=Mt()),r!==p)for(;r!==p;)t.push(r),(r=zt())===p&&(r=Bt())===p&&(r=Mt());else t=p;return t!==p&&(st=e,t=a(t)),e=t}function Et(){var e,t,r,n,a;if(ht++,t=[],n=r=e=ct,ht++,(a=Pt())===p&&(R.test(f.charAt(ct))?(a=f.charAt(ct),ct++):(a=p,0===ht&&xt(P))),ht--,(r=(n=a===p?void 0:(ct=n,p))!==p?(f.length>ct?(a=f.charAt(ct),ct++):(a=p,0===ht&&xt(I)),a!==p?n=[n,a]:(ct=r,p)):(ct=r,p))!==p)for(;r!==p;)t.push(r),n=r=ct,ht++,(a=Pt())===p&&(R.test(f.charAt(ct))?(a=f.charAt(ct),ct++):(a=p,0===ht&&xt(P))),ht--,r=(n=a===p?void 0:(ct=n,p))!==p?(f.length>ct?(a=f.charAt(ct),ct++):(a=p,0===ht&&xt(I)),a!==p?n=[n,a]:(ct=r,p)):(ct=r,p);else t=p;return e=t!==p?f.substring(e,ct):t,ht--,e===p&&(t=p,0===ht&&xt(_)),e}function Ot(){var e,t,r;return ht++,e=ct,47===f.charCodeAt(ct)?(t=Z,ct++):(t=p,0===ht&&xt(z)),e=t!==p&&(r=Et())!==p?(st=e,t=B(r)):(ct=e,p),ht--,e===p&&(t=p,0===ht&&xt(N)),e}function jt(){var e,t,r,n;if(ht++,e=ct,Nt()!==p)if((t=Et())!==p){for(r=[],n=Ot();n!==p;)r.push(n),n=Ot();e=r!==p?(st=e,L(t,r)):(ct=e,p)}else ct=e,e=p;else ct=e,e=p;return ht--,e===p&&(p,0===ht&&xt(M)),e}function St(){var e,t,r,n;if(e=ct,39===f.charCodeAt(ct)?(t=Y,ct++):(t=p,0===ht&&xt(ee)),t!==p){if(r=[],(n=zt())===p&&(te.test(f.charAt(ct))?(n=f.charAt(ct),ct++):(n=p,0===ht&&xt(re))),n!==p)for(;n!==p;)r.push(n),(n=zt())===p&&(te.test(f.charAt(ct))?(n=f.charAt(ct),ct++):(n=p,0===ht&&xt(re)));else r=p;e=r!==p?(39===f.charCodeAt(ct)?(n=Y,ct++):(n=p,0===ht&&xt(ee)),n!==p?t=[t,r,n]:(ct=e,p)):(ct=e,p)}else ct=e,e=p;if(e===p)if(e=[],(t=zt())===p&&(ne.test(f.charAt(ct))?(t=f.charAt(ct),ct++):(t=p,0===ht&&xt(ae))),t!==p)for(;t!==p;)e.push(t),(t=zt())===p&&(ne.test(f.charAt(ct))?(t=f.charAt(ct),ct++):(t=p,0===ht&&xt(ae)));else e=p;return e}function Tt(){var e,t;if(e=[],oe.test(f.charAt(ct))?(t=f.charAt(ct),ct++):(t=p,0===ht&&xt(ue)),t!==p)for(;t!==p;)e.push(t),oe.test(f.charAt(ct))?(t=f.charAt(ct),ct++):(t=p,0===ht&&xt(ue));else e=p;return e}function _t(){var e,t,r,n,a;return e=ct,e=Nt()!==p&&(t=$t())!==p&&Nt()!==p?(123===f.charCodeAt(ct)?(r=E,ct++):(r=p,0===ht&&xt(O)),r!==p?(st=ct,(ke()?void 0:p)!==p&&(n=Ft())!==p?(125===f.charCodeAt(ct)?(a=j,ct++):(a=p,0===ht&&xt(S)),a!==p?(st=e,De(t,n)):(ct=e,p)):(ct=e,p)):(ct=e,p)):(ct=e,p)}function Rt(){var e,t,r,n,a;return e=ct,e=Nt()!==p&&(t=function(){var e,t,r,n;return t=e=ct,61===f.charCodeAt(ct)?(r=Ce,ct++):(r=p,0===ht&&xt(Fe)),(e=(t=r!==p&&(n=Zt())!==p?r=[r,n]:(ct=t,p))!==p?f.substring(e,ct):t)===p&&(e=$t()),e}())!==p&&Nt()!==p?(123===f.charCodeAt(ct)?(r=E,ct++):(r=p,0===ht&&xt(O)),r!==p?(st=ct,(Ee()?void 0:p)!==p&&(n=Ft())!==p?(125===f.charCodeAt(ct)?(a=j,ct++):(a=p,0===ht&&xt(S)),a!==p?(st=e,Oe(t,n)):(ct=e,p)):(ct=e,p)):(ct=e,p)):(ct=e,p)}function Pt(){var e;return ht++,Se.test(f.charAt(ct))?(e=f.charAt(ct),ct++):(e=p,0===ht&&xt(Te)),ht--,e===p&&0===ht&&xt(je),e}function It(){var e;return ht++,Re.test(f.charAt(ct))?(e=f.charAt(ct),ct++):(e=p,0===ht&&xt(Pe)),ht--,e===p&&0===ht&&xt(_e),e}function Nt(){var e,t,r;for(ht++,e=ct,t=[],r=Pt();r!==p;)t.push(r),r=Pt();return e=t!==p?f.substring(e,ct):t,ht--,e===p&&(t=p,0===ht&&xt(Ie)),e}function Zt(){var e,t,r;return ht++,e=ct,45===f.charCodeAt(ct)?(t=Ze,ct++):(t=p,0===ht&&xt(ze)),t===p&&(t=null),e=t!==p&&(r=Ht())!==p?(st=e,t=Be(t,r)):(ct=e,p),ht--,e===p&&(t=p,0===ht&&xt(Ne)),e}function zt(){var e,t;return ht++,e=ct,f.substr(ct,2)===Le?(t=Le,ct+=2):(t=p,0===ht&&xt(Ve)),t!==p&&(st=e,t=He()),ht--,(e=t)===p&&(t=p,0===ht&&xt(Me)),e}function Bt(){var e,t,r,n,a,o;if(e=ct,39===f.charCodeAt(ct)?(t=Y,ct++):(t=p,0===ht&&xt(ee)),t!==p)if((r=function(){var e,t,r,n;t=e=ct,f.length>ct?(r=f.charAt(ct),ct++):(r=p,0===ht&&xt(I));t=r!==p?(st=ct,n=Je(r),(n=n?void 0:p)!==p?r=[r,n]:(ct=t,p)):(ct=t,p);e=t!==p?f.substring(e,ct):t;return e}())!==p){for(n=ct,a=[],f.substr(ct,2)===Le?(o=Le,ct+=2):(o=p,0===ht&&xt(Ve)),o===p&&(te.test(f.charAt(ct))?(o=f.charAt(ct),ct++):(o=p,0===ht&&xt(re)));o!==p;)a.push(o),f.substr(ct,2)===Le?(o=Le,ct+=2):(o=p,0===ht&&xt(Ve)),o===p&&(te.test(f.charAt(ct))?(o=f.charAt(ct),ct++):(o=p,0===ht&&xt(re)));e=(n=a!==p?f.substring(n,ct):a)!==p?(39===f.charCodeAt(ct)?(a=Y,ct++):(a=p,0===ht&&xt(ee)),a===p&&(a=null),a!==p?(st=e,t=$e(r,n)):(ct=e,p)):(ct=e,p)}else ct=e,e=p;else ct=e,e=p;return e}function Mt(){var e,t,r,n;return t=e=ct,f.length>ct?(r=f.charAt(ct),ct++):(r=p,0===ht&&xt(I)),(t=r!==p?(st=ct,(n=(n=qe(r))?void 0:p)!==p?r=[r,n]:(ct=t,p)):(ct=t,p))===p&&(10===f.charCodeAt(ct)?(t=Ue,ct++):(t=p,0===ht&&xt(Ge))),e=t!==p?f.substring(e,ct):t}function Lt(){var e,t;return ht++,e=ct,(t=Ht())===p&&(t=$t()),e=t!==p?f.substring(e,ct):t,ht--,e===p&&(t=p,0===ht&&xt(Ke)),e}function Vt(){var e,t;return ht++,e=ct,(t=Ht())===p&&(t=function(){var e,t,r,n,a;ht++,e=ct,t=[],45===f.charCodeAt(ct)?(r=Ze,ct++):(r=p,0===ht&&xt(ze));r===p&&(n=r=ct,ht++,(a=Pt())===p&&(a=It()),ht--,n=a===p?void 0:(ct=n,p),r=n!==p?(f.length>ct?(a=f.charAt(ct),ct++):(a=p,0===ht&&xt(I)),a!==p?n=[n,a]:(ct=r,p)):(ct=r,p));if(r!==p)for(;r!==p;)t.push(r),45===f.charCodeAt(ct)?(r=Ze,ct++):(r=p,0===ht&&xt(ze)),r===p&&(n=r=ct,ht++,(a=Pt())===p&&(a=It()),ht--,n=a===p?void 0:(ct=n,p),r=n!==p?(f.length>ct?(a=f.charAt(ct),ct++):(a=p,0===ht&&xt(I)),a!==p?n=[n,a]:(ct=r,p)):(ct=r,p));else t=p;e=t!==p?f.substring(e,ct):t;ht--,e===p&&(t=p,0===ht&&xt(it));return e}()),e=t!==p?f.substring(e,ct):t,ht--,e===p&&(t=p,0===ht&&xt(Qe)),e}function Ht(){var e,t,r,n,a;if(ht++,e=ct,48===f.charCodeAt(ct)?(t=Xe,ct++):(t=p,0===ht&&xt(Ye)),t!==p&&(st=e,t=et()),(e=t)===p){if(t=e=ct,tt.test(f.charAt(ct))?(r=f.charAt(ct),ct++):(r=p,0===ht&&xt(rt)),r!==p){for(n=[],nt.test(f.charAt(ct))?(a=f.charAt(ct),ct++):(a=p,0===ht&&xt(at));a!==p;)n.push(a),nt.test(f.charAt(ct))?(a=f.charAt(ct),ct++):(a=p,0===ht&&xt(at));t=n!==p?r=[r,n]:(ct=t,p)}else ct=t,t=p;t!==p&&(st=e,t=ot(t)),e=t}return ht--,e===p&&(t=p,0===ht&&xt(We)),e}function $t(){var e,t,r,n,a;if(ht++,t=[],n=r=e=ct,ht++,(a=Pt())===p&&(a=It()),ht--,(r=(n=a===p?void 0:(ct=n,p))!==p?(f.length>ct?(a=f.charAt(ct),ct++):(a=p,0===ht&&xt(I)),a!==p?n=[n,a]:(ct=r,p)):(ct=r,p))!==p)for(;r!==p;)t.push(r),n=r=ct,ht++,(a=Pt())===p&&(a=It()),ht--,r=(n=a===p?void 0:(ct=n,p))!==p?(f.length>ct?(a=f.charAt(ct),ct++):(a=p,0===ht&&xt(I)),a!==p?n=[n,a]:(ct=r,p)):(ct=r,p);else t=p;return e=t!==p?f.substring(e,ct):t,ht--,e===p&&(t=p,0===ht&&xt(ut)),e}var qt,Ut,Gt,Jt=["root"];function Kt(){return 1<Jt.length}function Qt(){return"plural"===Jt[Jt.length-1]}function Wt(){return e&&e.captureLocation?{location:mt()}:{}}if((t=n())!==p&&ct===f.length)return t;throw t!==p&&ct<f.length&&xt({type:"end"}),qt=pt,Ut=ft<f.length?f.charAt(ft):null,Gt=ft<f.length?wt(ft,ft+1):wt(ft,ft),new er(er.buildMessage(qt,Ut),qt,Ut,Gt)},p=function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),a=0;for(t=0;t<r;t++)for(var o=arguments[t],u=0,i=o.length;u<i;u++,a++)n[a]=o[u];return n},h=/(^|[^\\])#/g;var i=function(){return(i=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)},a=/(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;function D(e){var r={};return e.replace(a,function(e){var t=e.length;switch(e[0]){case"G":r.era=4===t?"long":5===t?"narrow":"short";break;case"y":r.year=2===t?"2-digit":"numeric";break;case"Y":case"u":case"U":case"r":throw new RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead");case"q":case"Q":throw new RangeError("`q/Q` (quarter) patterns are not supported");case"M":case"L":r.month=["numeric","2-digit","short","long","narrow"][t-1];break;case"w":case"W":throw new RangeError("`w/W` (week) patterns are not supported");case"d":r.day=["numeric","2-digit"][t-1];break;case"D":case"F":case"g":throw new RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");case"E":r.weekday=4===t?"short":5===t?"narrow":"short";break;case"e":if(t<4)throw new RangeError("`e..eee` (weekday) patterns are not supported");r.weekday=["short","long","narrow","short"][t-4];break;case"c":if(t<4)throw new RangeError("`c..ccc` (weekday) patterns are not supported");r.weekday=["short","long","narrow","short"][t-4];break;case"a":r.hour12=!0;break;case"b":case"B":throw new RangeError("`b/B` (period) patterns are not supported, use `a` instead");case"h":r.hourCycle="h12",r.hour=["numeric","2-digit"][t-1];break;case"H":r.hourCycle="h23",r.hour=["numeric","2-digit"][t-1];break;case"K":r.hourCycle="h11",r.hour=["numeric","2-digit"][t-1];break;case"k":r.hourCycle="h24",r.hour=["numeric","2-digit"][t-1];break;case"j":case"J":case"C":throw new RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");case"m":r.minute=["numeric","2-digit"][t-1];break;case"s":r.second=["numeric","2-digit"][t-1];break;case"S":case"A":throw new RangeError("`S/A` (second) pattenrs are not supported, use `s` instead");case"z":r.timeZoneName=t<4?"short":"long";break;case"Z":case"O":case"v":case"V":case"X":case"x":throw new RangeError("`Z/O/v/V/X/x` (timeZone) pattenrs are not supported, use `z` instead")}return""}),r}var c=/^\.(?:(0+)(\+|#+)?)?$/g,s=/^(@+)?(\+|#+)?$/g;function l(e){var n={};return e.replace(s,function(e,t,r){return"string"!=typeof r?(n.minimumSignificantDigits=t.length,n.maximumSignificantDigits=t.length):"+"===r?n.minimumSignificantDigits=t.length:"#"===t[0]?n.maximumSignificantDigits=t.length:(n.minimumSignificantDigits=t.length,n.maximumSignificantDigits=t.length+("string"==typeof r?r.length:0)),""}),n}function g(e){switch(e){case"sign-auto":return{signDisplay:"auto"};case"sign-accounting":return{currencySign:"accounting"};case"sign-always":return{signDisplay:"always"};case"sign-accounting-always":return{signDisplay:"always",currencySign:"accounting"};case"sign-except-zero":return{signDisplay:"exceptZero"};case"sign-accounting-except-zero":return{signDisplay:"exceptZero",currencySign:"accounting"};case"sign-never":return{signDisplay:"never"}}}function m(e){var t=g(e);return t||{}}function E(e){for(var n={},t=0,r=e;t<r.length;t++){var a=r[t];switch(a.stem){case"percent":n.style="percent";continue;case"currency":n.style="currency",n.currency=a.options[0];continue;case"group-off":n.useGrouping=!1;continue;case"precision-integer":n.maximumFractionDigits=0;continue;case"measure-unit":n.style="unit",n.unit=a.options[0].replace(/^(.*?)-/,"");continue;case"compact-short":n.notation="compact",n.compactDisplay="short";continue;case"compact-long":n.notation="compact",n.compactDisplay="long";continue;case"scientific":n=i(i(i({},n),{notation:"scientific"}),a.options.reduce(function(e,t){return i(i({},e),m(t))},{}));continue;case"engineering":n=i(i(i({},n),{notation:"engineering"}),a.options.reduce(function(e,t){return i(i({},e),m(t))},{}));continue;case"notation-simple":n.notation="standard";continue;case"unit-width-narrow":n.currencyDisplay="narrowSymbol",n.unitDisplay="narrow";continue;case"unit-width-short":n.currencyDisplay="code",n.unitDisplay="short";continue;case"unit-width-full-name":n.currencyDisplay="name",n.unitDisplay="long";continue;case"unit-width-iso-code":n.currencyDisplay="symbol";continue}if(c.test(a.stem)){if(1<a.options.length)throw new RangeError("Fraction-precision stems only accept a single optional option");a.stem.replace(c,function(e,t,r){return"."===e?n.maximumFractionDigits=0:"+"===r?n.minimumFractionDigits=r.length:"#"===t[0]?n.maximumFractionDigits=t.length:(n.minimumFractionDigits=t.length,n.maximumFractionDigits=t.length+("string"==typeof r?r.length:0)),""}),a.options.length&&(n=i(i({},n),l(a.options[0])))}else if(s.test(a.stem))n=i(i({},n),l(a.stem));else{var o=g(a.stem);o&&(n=i(i({},n),o))}}return n}function d(e,t){var r=f(e,t);return t&&!1===t.normalizeHashtagInPlural||function l(e){e.forEach(function(s){(k(s)||F(s))&&Object.keys(s.options).forEach(function(e){for(var t,r=s.options[e],n=-1,a=void 0,o=0;o<r.value.length;o++){var u=r.value[o];if(C(u)&&h.test(u.value)){n=o,a=u;break}}if(a){var i=a.value.replace(h,"$1{"+s.value+", number}"),c=f(i);(t=r.value).splice.apply(t,p([n,1],c))}l(r.value)})})}(r),r}var y=function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),a=0;for(t=0;t<r;t++)for(var o=arguments[t],u=0,i=o.length;u<i;u++,a++)n[a]=o[u];return n};function v(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 b,A,w=function(o,u){return void 0===u&&(u={}),function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=v(t),a=n&&u[n];return a||(a=new((e=o).bind.apply(e,y([void 0],t))),n&&(u[n]=a)),a}},x=(b=function(e,t){return(b=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}b(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),O=(A=Error,x(j,A),j.prototype.toString=function(){return"[formatjs Error: "+this.code+"] "+this.message},j);function j(e,t){var r=A.call(this,e)||this;return r.code=t,r}var S,T=(x(_,S=O),_);function _(e,t,r){return S.call(this,'Invalid values for "'+e+'": "'+t+'". Options are "'+Object.keys(r).join('", "')+'"',1)||this}var R,P=(x(I,R=O),I);function I(e,t){return R.call(this,'The intl string context variable "'+e+'" was not provided to the string "'+t+'"',0)||this}function N(e,t,r,n,a,o,u){if(1===e.length&&C(e[0]))return[{type:0,value:e[0].value}];for(var i,c,s=[],l=0,f=e;l<f.length;l++){var p=f[l];if(C(p))s.push({type:0,value:p.value});else if(p.type!==Xt.pound){var h=p.value;if(!(a&&h in a))throw new P(h,u);var g=a[h];if(p.type!==Xt.argument)if(p.type!==Xt.date)if(p.type!==Xt.time)if(p.type!==Xt.number){if(p.type===Xt.tag){var m=p.children,d=p.value,y=a[d];if("function"!=typeof y)throw new TypeError('Value for "'+d+'" must be a function');var v=N(m,t,r,n,a),b=y.apply(void 0,v.map(function(e){return e.value}));Array.isArray(b)||(b=[b]),s.push.apply(s,b.map(function(e){return{type:"string"==typeof e?0:1,value:e}}))}if(F(p)){if(!(A=p.options[g]||p.options.other))throw new T(p.value,g,Object.keys(p.options));s.push.apply(s,N(A.value,t,r,n,a))}else if(k(p)){var A;if(!(A=p.options["="+g])){if(!Intl.PluralRules)throw new O('Intl.PluralRules is not available in this environment.\nTry polyfilling it using "@formatjs/intl-pluralrules"\n',2);var w=r.getPluralRules(t,{type:p.pluralType}).select(g-(p.offset||0));A=p.options[w]||p.options.other}if(!A)throw new T(p.value,g,Object.keys(p.options));s.push.apply(s,N(A.value,t,r,n,a,g-(p.offset||0)))}else;}else{x="string"==typeof p.style?n.number[p.style]:(i=p.style)&&"object"==typeof i&&0===i.type?E(p.style.tokens):void 0;s.push({type:0,value:r.getNumberFormat(t,x).format(g)})}else{var x="string"==typeof p.style?n.time[p.style]:(c=p.style)&&"object"==typeof c&&1===c.type?D(p.style.pattern):void 0;s.push({type:0,value:r.getDateTimeFormat(t,x).format(g)})}else{var x="string"==typeof p.style?n.date[p.style]:void 0;s.push({type:0,value:r.getDateTimeFormat(t,x).format(g)})}else g&&"string"!=typeof g&&"number"!=typeof g||(g="string"==typeof g||"number"==typeof g?String(g):""),s.push({type:"string"==typeof g?0:1,value:g})}else"number"==typeof o&&s.push({type:0,value:r.getNumberFormat(t).format(o)})}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},[])}(s)}var Z=function(){return(Z=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)};function z(r,n){return n?Object.keys(r).reduce(function(e,t){return e[t]=function(r,n){return n?Z(Z(Z({},r||{}),n||{}),Object.keys(r).reduce(function(e,t){return e[t]=Z(Z({},r[t]),n[t]||{}),e},{})):r}(r[t],n[t]),e},Z({},r)):r}function B(e){return void 0===e&&(e={number:{},dateTime:{},pluralRules:{}}),{getNumberFormat:w(Intl.NumberFormat,e.number),getDateTimeFormat:w(Intl.DateTimeFormat,e.dateTime),getPluralRules:w(Intl.PluralRules,e.pluralRules)}}var M=(L.defaultLocale=(new Intl.NumberFormat).resolvedOptions().locale,L.__parse=d,L.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"}}},L);function L(e,t,r,n){var a=this;if(void 0===t&&(t=L.defaultLocale),this.formatterCache={number:{},dateTime:{},pluralRules:{}},this.format=function(e){var t=a.formatToParts(e);if(1===t.length)return t[0].value;var r=t.reduce(function(e,t){return e.length&&0===t.type&&"string"==typeof e[e.length-1]?e[e.length-1]+=t.value:e.push(t.value),e},[]);return r.length<=1?r[0]||"":r},this.formatToParts=function(e){return N(a.ast,a.locales,a.formatters,a.formats,e,void 0,a.message)},this.resolvedOptions=function(){return{locale:Intl.NumberFormat.supportedLocalesOf(a.locales)[0]}},this.getAst=function(){return a.ast},"string"==typeof e){if(this.message=e,!L.__parse)throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");this.ast=L.__parse(e,{normalizeHashtagInPlural:!1})}else this.ast=e;if(!Array.isArray(this.ast))throw new TypeError("A message must be provided as a String or AST.");this.formats=z(L.formats,r),this.locales=t,this.formatters=n&&n.formatters||B(this.formatterCache)}e.FormatError=O,e.IntlMessageFormat=M,e.InvalidValueError=T,e.MissingValueError=P,e.createDefaultFormatters=B,e.default=M,e.formatToParts=N,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
2
2
|
//# sourceMappingURL=intl-messageformat.min.js.map
|