-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglobalize.js
2 lines (2 loc) · 28.3 KB
/
globalize.js
1
2
console.log('globalize.js file');
!function(e,t){"function"==typeof define&&define.amd?define(t):"object"==typeof module&&"object"==typeof module.exports?module.exports=t():e.Cldr=t()}(this,function(){var e=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},t=function(t,n){if(e(t)&&(t=t.join("/")),"string"!=typeof t)throw new Error('invalid path "'+t+'"');return t=t.replace(/^\//,"").replace(/^cldr\//,""),t=t.replace(/{[a-zA-Z]+}/g,function(e){return e=e.replace(/^{([^}]*)}$/,"$1"),n[e]}),t.split("/")},n=function(e,t){var n,r;if(e.some)return e.some(t);for(n=0,r=e.length;n<r;n++)if(t(e[n],n,e))return!0;return!1},r=function(e,t,r,i){var o,a,u=r[0],s=r[1],l=e.localeSep,c=r[2],f=r.slice(3,4);return i=i||{},"und"!==u&&"Zzzz"!==s&&"ZZ"!==c?[u,s,c].concat(f):void 0!==t.get("supplemental/likelySubtags")?(a=n([[u,s,c],[u,c],[u,s],[u],["und",s]],function(e){return o=!/\b(Zzzz|ZZ)\b/.test(e.join(l))&&t.get(["supplemental/likelySubtags",e.join(l)])}),a?(o=o.split(l),["und"!==u?u:o[0],"Zzzz"!==s?s:o[1],"ZZ"!==c?c:o[2]].concat(f)):i.force?t.get("supplemental/likelySubtags/und").split(l):void 0):void 0},i=function(e,t,i){var o,a,u=i[0],s=i[1],l=i[2],c=i[3];return a=n([[[u,"Zzzz","ZZ"],[u]],[[u,"Zzzz",l],[u,l]],[[u,s,"ZZ"],[u,s]]],function(n){var a=r(e,t,n[0]);return o=n[1],a&&a[0]===i[0]&&a[1]===i[1]&&a[2]===i[2]}),a?(c&&o.push(c),o):i},o=function(e){var t,n,r=[];return e=e.replace(/_/,"-"),t=e.split("-u-"),t[1]&&(t[1]=t[1].split("-t-"),e=t[0]+(t[1][1]?"-t-"+t[1][1]:""),r[4]=t[1][0]),n=e.split("-t-")[0],null===(t=n.match(/^(([a-z]{2,3})(-([A-Z][a-z]{3}))?(-([A-Z]{2}|[0-9]{3}))?)((-([a-zA-Z0-9]{5,8}|[0-9][a-zA-Z0-9]{3}))*)$|^(root)$/))?["und","Zzzz","ZZ"]:(r[0]=t[10]||t[2]||"und",r[1]=t[4]||"Zzzz",r[2]=t[6]||"ZZ",t[7]&&t[7].length&&(r[3]=t[7].slice(1)),r)},a=function(e,t){var n,r;if(e.forEach)return e.forEach(t);for(n=0,r=e.length;n<r;n++)t(e[n],n,e)},u=function(e,t,n){var u=e._availableBundleMap,s=e._availableBundleMapQueue;return s.length&&(a(s,function(n){var a,l,c,f;f=o(n),l=r(e,t,f),c=i(e,t,l),c=c.join(e.localeSep),(a=s[c])&&a.length<n.length||(u[c]=n)}),e._availableBundleMapQueue=[]),u[n]||null},s=function(e){var t,n=[];if(Object.keys)return Object.keys(e);for(t in e)n.push(t);return n},l=function(e,t){var n,r;return r=e+(t&&JSON?": "+JSON.stringify(t):""),n=new Error(r),n.code=e,a(s(t),function(e){n[e]=t[e]}),n},c=function(e,t,n){if(!t)throw l(e,n)},f=function(e,t){c("E_MISSING_PARAMETER",void 0!==e,{name:t})},p=function(e,t,n,r){c("E_INVALID_PAR_TYPE",n,{expected:r,name:t,value:e})},h=function(t,n){p(t,n,"string"==typeof t||e(t),"String or Array")},m=function(e){return null!==e&&""+e=="[object Object]"},d=function(e,t){p(e,t,void 0===e||m(e),"Plain Object")},v=function(e,t){p(e,t,"string"==typeof e,"a string")},g=function(e,t){var n,r=e,i=t.length;for(n=0;n<i-1;n++)if(!(r=r[t[n]]))return undefined;return r[t[n]]},y=function(e,t){var n,r=e._availableBundleMapQueue,i=g(t,["main"]);if(i)for(n in i)i.hasOwnProperty(n)&&"root"!==n&&-1===r.indexOf(n)&&r.push(n)},_=function(t){return e(t)?t:[t]},A=function(){var t=function(){var n={},r=[].slice.call(arguments,0);return a(r,function(r){var i;for(i in r)i in n&&"object"==typeof n[i]&&!e(n[i])?n[i]=t(n[i],r[i]):n[i]=r[i]}),n};return t}(),b=function(e,t,n){var r,i,o;for(f(n[0],"json"),r=0;r<n.length;r++)for(o=_(n[r]),i=0;i<o.length;i++)d(o[i],"json"),t=A(t,o[i]),y(e,o[i]);return t},E=function(e,n,r){var i=t(n,r);return g(e._resolved,i)},w=function(e){this.init(e)};return w._alwaysArray=_,w._coreLoad=b,w._createError=l,w._itemGetResolved=E,w._jsonMerge=A,w._pathNormalize=t,w._resourceGet=g,w._validatePresence=f,w._validateType=p,w._validateTypePath=h,w._validateTypePlainObject=d,w._availableBundleMap={},w._availableBundleMapQueue=[],w._resolved={},w.localeSep="-",w.load=function(){w._resolved=b(w,w._resolved,arguments)},w.prototype.init=function(e){var t,n,a,s,l,c,p,h,m,d=w.localeSep;f(e,"locale"),v(e,"locale"),c=o(e),h=c[4],m=c[3],a=r(w,this,c,{force:!0})||c,n=a[0],l=a[1],p=a[2],s=i(w,this,a).join(d),this.attributes=t={bundle:u(w,this,s),minlanguageId:s,maxLanguageId:a.join(d),language:n,script:l,territory:p,region:p,variant:m},h&&("-"+h).replace(/-[a-z]{3,8}|(-[a-z]{2})-([a-z]{3,8})/g,function(e,n,r){n?t["u"+n]=r:t["u"+e]=!0}),this.locale=e},w.prototype.get=function(e){return f(e,"path"),h(e,"path"),E(w,e,this.attributes)},w.prototype.main=function(e){return f(e,"path"),h(e,"path"),c("E_MISSING_BUNDLE",null!==this.attributes.bundle,{locale:this.locale}),e=_(e),this.get(["main/{bundle}"].concat(e))},w}),function(e){"function"==typeof define&&define.amd?define(["../cldr"],e):"object"==typeof module&&"object"==typeof module.exports?module.exports=e(require("cldrjs")):e(Cldr)}(function(e){function t(e,t){c(e,t,"string"==typeof e||e instanceof RegExp,"String or RegExp")}function n(e,n){return function(r,i){return l(r,"event"),t(r,"event"),l(i,"listener"),h(i,"listener"),n[e].apply(n,arguments)}}function r(e){return n("off",e)}function i(e){return n("on",e)}function o(e){return n("once",e)}function a(){f=e.prototype.get,e.prototype.get=function(e){var t=f.apply(this,arguments);return e=s(e,this.attributes).join("/"),m.trigger("get",[e,t]),this.ee.trigger("get",[e,t]),t}}var u,s=e._pathNormalize,l=e._validatePresence,c=e._validateType;u=function(){function e(){}function t(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function n(e){return function(){return this[e].apply(this,arguments)}}var r=e.prototype,i=this,o=i.EventEmitter;return r.getListeners=function(e){var t,n,r=this._getEvents();if(e instanceof RegExp){t={};for(n in r)r.hasOwnProperty(n)&&e.test(n)&&(t[n]=r[n])}else t=r[e]||(r[e]=[]);return t},r.flattenListeners=function(e){var t,n=[];for(t=0;t<e.length;t+=1)n.push(e[t].listener);return n},r.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},r.addListener=function(e,n){var r,i=this.getListenersAsObject(e),o="object"==typeof n;for(r in i)i.hasOwnProperty(r)&&-1===t(i[r],n)&&i[r].push(o?n:{listener:n,once:!1});return this},r.on=n("addListener"),r.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},r.once=n("addOnceListener"),r.defineEvent=function(e){return this.getListeners(e),this},r.defineEvents=function(e){for(var t=0;t<e.length;t+=1)this.defineEvent(e[t]);return this},r.removeListener=function(e,n){var r,i,o=this.getListenersAsObject(e);for(i in o)o.hasOwnProperty(i)&&-1!==(r=t(o[i],n))&&o[i].splice(r,1);return this},r.off=n("removeListener"),r.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},r.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},r.manipulateListeners=function(e,t,n){var r,i,o=e?this.removeListener:this.addListener,a=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(r=n.length;r--;)o.call(this,t,n[r]);else for(r in t)t.hasOwnProperty(r)&&(i=t[r])&&("function"==typeof i?o.call(this,r,i):a.call(this,r,i));return this},r.removeEvent=function(e){var t,n=typeof e,r=this._getEvents();if("string"===n)delete r[e];else if(e instanceof RegExp)for(t in r)r.hasOwnProperty(t)&&e.test(t)&&delete r[t];else delete this._events;return this},r.removeAllListeners=n("removeEvent"),r.emitEvent=function(e,t){var n,r,i,o=this.getListenersAsObject(e);for(i in o)if(o.hasOwnProperty(i))for(r=o[i].length;r--;)n=o[i][r],!0===n.once&&this.removeListener(e,n.listener),n.listener.apply(this,t||[])===this._getOnceReturnValue()&&this.removeListener(e,n.listener);return this},r.trigger=n("emitEvent"),r.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},r.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},r._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},r._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return i.EventEmitter=o,e},e}();var f,p,h=function(e,t){c(e,t,void 0===e||"function"==typeof e,"Function")},m=new u;return e.off=r(m),e.on=i(m),e.once=o(m),p=e.prototype.init,e.prototype.init=function(){var e;this.ee=e=new u,this.off=r(e),this.on=i(e),this.once=o(e),p.apply(this,arguments)},e._eventInit=a,a(),e}),function(e){"function"==typeof define&&define.amd?define(["../cldr"],e):"object"==typeof module&&"object"==typeof module.exports?module.exports=e(require("cldrjs")):e(Cldr)}(function(e){var t=e._alwaysArray,n=function(e){var n,r;return n=function(n){return function(r){return r=t(r),e.get([n].concat(r))}},r=n("supplemental"),r.weekData=n("supplemental/weekData"),r.weekData.firstDay=function(){return e.get("supplemental/weekData/firstDay/{territory}")||e.get("supplemental/weekData/firstDay/001")},r.weekData.minDays=function(){var t=e.get("supplemental/weekData/minDays/{territory}")||e.get("supplemental/weekData/minDays/001");return parseInt(t,10)},r.timeData=n("supplemental/timeData"),r.timeData.allowed=function(){return e.get("supplemental/timeData/{territory}/_allowed")||e.get("supplemental/timeData/001/_allowed")},r.timeData.preferred=function(){return e.get("supplemental/timeData/{territory}/_preferred")||e.get("supplemental/timeData/001/_preferred")},r},r=e.prototype.init;return e.prototype.init=function(){r.apply(this,arguments),this.supplemental=n(this)},e}),function(e,t){"function"==typeof define&&define.amd?define(["cldr","cldr/event"],t):"object"==typeof exports?module.exports=t(require("cldrjs")):e.Globalize=t(e.Cldr)}(this,function(e){function t(e){e.once("get",l),e.get("supplemental/likelySubtags")}function n(e){if(!(this instanceof n))return new n(e);f(e,"locale"),m(e,"locale"),this.cldr=g(e),t(this.cldr)}var r=function(e){return"string"==typeof e?e:"number"==typeof e?""+e:JSON.stringify(e)},i=function(e,t){return e=e.replace(/{[0-9a-zA-Z-_. ]+}/g,function(e){return e=e.replace(/^{([^}]*)}$/,"$1"),r(t[e])})},o=function(){var e=arguments[0];return[].slice.call(arguments,1).forEach(function(t){var n;for(n in t)e[n]=t[n]}),e},a=function(e,t,n){var r;return t=e+(t?": "+i(t,n):""),r=new Error(t),r.code=e,o(r,n),r},u=function(e,t,n,r){if(!n)throw a(e,t,r)},s=function(e){return Array.isArray(e)?e:e?[e]:[]},l=function(e,t,n){var r;n=n||{},r=s(n.skip).some(function(t){return t.test(e)}),u("E_MISSING_CLDR","Missing required CLDR content `{path}`.",t||r,{path:e})},c=function(e){u("E_DEFAULT_LOCALE_NOT_DEFINED","Default locale has not been defined.",e!==undefined,{})},f=function(e,t){u("E_MISSING_PARAMETER","Missing required parameter `{name}`.",e!==undefined,{name:t})},p=function(e,t,n,r){u("E_PAR_OUT_OF_RANGE","Parameter `{name}` has value `{value}` out of range [{minimum}, {maximum}].",e===undefined||e>=n&&e<=r,{maximum:r,minimum:n,name:t,value:e})},h=function(e,t,n,r){u("E_INVALID_PAR_TYPE","Invalid `{name}` parameter ({value}). {expected} expected.",n,{expected:r,name:t,value:e})},m=function(t,n){h(t,n,t===undefined||"string"==typeof t||t instanceof e,"String or Cldr instance")},d=function(e){return null!==e&&""+e=="[object Object]"},v=function(e,t){h(e,t,e===undefined||d(e),"Plain Object")},g=function(t){return t instanceof e?t:new e(t)},y=function(e){return e.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1")},_=function(e,t,n){var r;for("string"!=typeof e&&(e=String(e)),r=e.length;r<t;r+=1)e=n?e+"0":"0"+e;return e};return n.load=function(){e.load.apply(e,arguments)},n.locale=function(e){return m(e,"locale"),arguments.length&&(this.cldr=g(e),t(this.cldr)),this.cldr},n._alwaysArray=s,n._createError=a,n._formatMessage=i,n._isPlainObject=d,n._objectExtend=o,n._regexpEscape=y,n._stringPad=_,n._validate=u,n._validateCldr=l,n._validateDefaultLocale=c,n._validateParameterPresence=f,n._validateParameterRange=p,n._validateParameterTypePlainObject=v,n._validateParameterType=h,n}),function(e,t){"function"==typeof define&&define.amd?define(["cldr","../globalize","cldr/event"],t):"object"==typeof exports?module.exports=t(require("cldrjs"),require("globalize")):t(e.Cldr,e.Globalize)}(this,function(e,t){function n(e,t){var n;return new r(t.locale,function(t){return n||(d(),n=e.pluralGenerator()),n(t)})}var r,i=t._alwaysArray,o=t._isPlainObject,a=t._validate,u=t._validateDefaultLocale,s=t._validateParameterPresence,l=t._validateParameterType,c=t._validateParameterTypePlainObject;r=function(){function e(e,t,n){if(e)if("string"==typeof e){this.lc=[];for(var r=e;r;r=r.replace(/[-_]?[^-_]*$/,""))this.lc.push(r)}else this.lc=e;else this.lc=["en"];if(this.runtime.pf={},this.runtime.pf[this.lc[0]]=t,this.runtime.fmt={},n)for(var i in n)this.runtime.fmt[i]=n[i]}"plurals"in e||(e.plurals={}),e.formatters={number:function(e){return new Function("v,lc,p","return Intl.NumberFormat(lc,\n p=='integer' ? {maximumFractionDigits:0}\n : p=='percent' ? {style:'percent'}\n : p=='currency' ? {style:'currency', currency:'"+(e.currency||"USD")+"', minimumFractionDigits:2, maximumFractionDigits:2}\n : {}).format(v)")},date:function(e,t,n){var r={day:"numeric",month:"short",year:"numeric"};switch(n){case"full":r.weekday="long";case"long":r.month="long";break;case"short":r.month="numeric"}return new Date(e).toLocaleDateString(t,r)},time:function(e,t,n){var r={second:"numeric",minute:"numeric",hour:"numeric"};switch(n){case"full":case"long":r.timeZoneName="short";break;case"short":delete r.minute}return new Date(e).toLocaleTimeString(t,r)}},e.prototype.setIntlSupport=function(e){return this.withIntlSupport=!!e||void 0===e,this},e.prototype.runtime={_n:function(e,t){if(isNaN(e))throw new Error("'"+e+"' isn't a number.");return e-(t||0)},_p:function(e,t,n,r,i){return e in r?r[e]:(e=n(e-t,i),e in r?r[e]:r.other)},_s:function(e,t){return e in t?t[e]:t.other},pf:{},fmt:{},toString:function(){var e=function(t,n){if("object"!=typeof t)return t.toString().replace(/^(function) \w*/,"$1");var r=[];for(var i in t)"toString"!=i&&r.push((n?i+"=":JSON.stringify(i)+":")+e(t[i],!1));return n?r.join(",\n"):"{"+r.join(",\n")+"}"};return e(this,!0)}};var t=function(){function e(e,t){function n(){this.constructor=e}n.prototype=t.prototype,e.prototype=new n}function t(e,t,n,r,i,o){this.message=e,this.expected=t,this.found=n,this.offset=r,this.line=i,this.column=o,this.name="SyntaxError"}function n(e){function n(t){function n(t,n,r){var i,o;for(i=n;i<r;i++)o=e.charAt(i),"\n"===o?(t.seenCR||t.line++,t.column=1,t.seenCR=!1):"\r"===o||"\u2028"===o||"\u2029"===o?(t.line++,t.column=1,t.seenCR=!0):(t.column++,t.seenCR=!1)}return Be!==t&&(Be>t&&(Be=0,Ve={line:1,column:1,seenCR:!1}),n(Ve,Be,t),Be=t),Ve}function r(e){Te<qe||(Te>qe&&(qe=Te,Ue=[]),Ue.push(e))}function i(r,i,o){function a(e){var t=1;for(e.sort(function(e,t){return e.description<t.description?-1:e.description>t.description?1:0});t<e.length;)e[t-1]===e[t]?e.splice(t,1):t++}function u(e,t){function n(e){function t(e){return e.charCodeAt(0).toString(16).toUpperCase()}return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E\x0F]/g,function(e){return"\\x0"+t(e)}).replace(/[\x10-\x1F\x80-\xFF]/g,function(e){return"\\x"+t(e)}).replace(/[\u0180-\u0FFF]/g,function(e){return"\\u0"+t(e)}).replace(/[\u1080-\uFFFF]/g,function(e){return"\\u"+t(e)})}var r,i,o,a=new Array(e.length);for(o=0;o<e.length;o++)a[o]=e[o].description;return r=e.length>1?a.slice(0,-1).join(", ")+" or "+a[e.length-1]:a[0],i=t?'"'+n(t)+'"':"end of input","Expected "+r+" but "+i+" found."}var s=n(o),l=o<e.length?e.charAt(o):null;return null!==i&&a(i),new t(null!==r?r:u(i,l),i,l,o,s.line,s.column)}function o(){var e,t;return e=Te,t=a(),t!==O&&(Je=e,t=D(t)),e=t}function a(){var e,t,n,r;if(e=Te,(t=y())!==O){for(n=[],r=u();r!==O;)n.push(r),r=u();n!==O?(Je=e,t=N(t,n),e=t):(Te=e,e=z)}else Te=e,e=z;return e}function u(){var t,n,i,o,a,u,l;return t=Te,123===e.charCodeAt(Te)?(n=I,Te++):(n=O,0===Qe&&r(R)),n!==O?(i=j(),i!==O?(o=s(),o!==O?(a=j(),a!==O?(125===e.charCodeAt(Te)?(u=C,Te++):(u=O,0===Qe&&r(Z)),u!==O?(l=y(),l!==O?(Je=t,n=k(o,l),t=n):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z),t}function s(){var t,n,i,o,a;return t=Te,n=_(),n!==O?(i=Te,44===e.charCodeAt(Te)?(o=G,Te++):(o=O,0===Qe&&r($)),o!==O?(a=l(),a!==O?(o=[o,a],i=o):(Te=i,i=z)):(Te=i,i=z),i===O&&(i=M),i!==O?(Je=t,n=T(n,i),t=n):(Te=t,t=z)):(Te=t,t=z),t}function l(){var t,n,i,o,a,u,s,l;if(t=Te,n=j(),n!==O?(e.substr(Te,6)===J?(i=J,Te+=6):(i=O,0===Qe&&r(B)),i!==O?(o=j(),o!==O?(44===e.charCodeAt(Te)?(a=G,Te++):(a=O,0===Qe&&r($)),a!==O?(u=j(),u!==O?(s=c(),s!==O?(l=j(),l!==O?(Je=t,n=V(i,s),t=n):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z),t===O&&(t=Te,n=j(),n!==O?(e.substr(Te,13)===q?(i=q,Te+=13):(i=O,0===Qe&&r(U)),i!==O?(o=j(),o!==O?(44===e.charCodeAt(Te)?(a=G,Te++):(a=O,0===Qe&&r($)),a!==O?(u=j(),u!==O?(s=f(),s!==O?(l=j(),l!==O?(Je=t,n=V(i,s),t=n):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z),t===O&&(t=Te,n=j(),n!==O?(e.substr(Te,6)===Q?(i=Q,Te+=6):(i=O,0===Qe&&r(Y)),i!==O?(o=j(),o!==O?(44===e.charCodeAt(Te)?(a=G,Te++):(a=O,0===Qe&&r($)),a!==O?(u=j(),u!==O?(s=f(),s!==O?(l=j(),l!==O?(Je=t,n=V(i,s),t=n):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z),t===O)))if(t=Te,(n=j())!==O)if((i=_())!==O){for(o=[],a=g();a!==O;)o.push(a),a=g();o!==O?(Je=t,n=H(i,o),t=n):(Te=t,t=z)}else Te=t,t=z;else Te=t,t=z;return t}function c(){var e,t;return e=Te,t=p(),t!==O&&(Je=e,t=K(t)),e=t}function f(){var e,t;return e=Te,t=m(),t!==O&&(Je=e,t=W(t)),e=t}function p(){var e,t,n,r;if(e=Te,t=h(),t===O&&(t=M),t!==O){for(n=[],r=d();r!==O;)n.push(r),r=d();n!==O?(Je=e,t=X(t,n),e=t):(Te=e,e=z)}else Te=e,e=z;return e}function h(){var t,n,i,o,a,u,s,l;return t=Te,n=j(),n!==O?(e.substr(Te,6)===ee?(i=ee,Te+=6):(i=O,0===Qe&&r(te)),i!==O?(o=j(),o!==O?(58===e.charCodeAt(Te)?(a=ne,Te++):(a=O,0===Qe&&r(re)),a!==O?(u=j(),u!==O?(s=E(),s!==O?(l=j(),l!==O?(Je=t,n=ie(s),t=n):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z),t}function m(){var e,t,n;for(e=Te,t=[],n=d();n!==O;)t.push(n),n=d();return t!==O&&(Je=e,t=oe(t)),e=t}function d(){var t,n,i,o,u,s,l,c,f;return t=Te,n=j(),n!==O?(i=v(),i!==O?(o=j(),o!==O?(123===e.charCodeAt(Te)?(u=I,Te++):(u=O,0===Qe&&r(R)),u!==O?(s=j(),s!==O?(l=a(),l!==O?(c=j(),c!==O?(125===e.charCodeAt(Te)?(f=C,Te++):(f=O,0===Qe&&r(Z)),f!==O?(Je=t,n=ae(i,l),t=n):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z),t}function v(){var t,n,i;return t=Te,n=_(),n!==O&&(Je=t,n=ue(n)),t=n,t===O&&(t=Te,61===e.charCodeAt(Te)?(n=se,Te++):(n=O,0===Qe&&r(le)),n!==O?(i=E(),i!==O?(Je=t,n=ie(i),t=n):(Te=t,t=z)):(Te=t,t=z)),t}function g(){var t,n,i,o,a,u;return t=Te,n=j(),n!==O?(44===e.charCodeAt(Te)?(i=G,Te++):(i=O,0===Qe&&r($)),i!==O?(o=j(),o!==O?(a=_(),a!==O?(u=j(),u!==O?(Je=t,n=ce(a),t=n):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z),t}function y(){var e,t,n,r,i,o,a;if(e=Te,(t=j())!==O){for(n=[],r=Te,i=j(),i!==O?(o=A(),o!==O?(a=j(),a!==O?(i=[i,o,a],r=i):(Te=r,r=z)):(Te=r,r=z)):(Te=r,r=z);r!==O;)n.push(r),r=Te,i=j(),i!==O?(o=A(),o!==O?(a=j(),a!==O?(i=[i,o,a],r=i):(Te=r,r=z)):(Te=r,r=z)):(Te=r,r=z);n!==O?(Je=e,t=fe(t,n),e=t):(Te=e,e=z)}else Te=e,e=z;return e}function _(){var t,n,i,o,a;if(t=Te,(n=j())!==O)if(pe.test(e.charAt(Te))?(i=e.charAt(Te),Te++):(i=O,0===Qe&&r(he)),i!==O){for(o=[],me.test(e.charAt(Te))?(a=e.charAt(Te),Te++):(a=O,0===Qe&&r(de));a!==O;)o.push(a),me.test(e.charAt(Te))?(a=e.charAt(Te),Te++):(a=O,0===Qe&&r(de));o!==O?(a=j(),a!==O?(Je=t,n=ve(i,o),t=n):(Te=t,t=z)):(Te=t,t=z)}else Te=t,t=z;else Te=t,t=z;return t}function A(){var e,t,n;if(e=Te,t=[],(n=b())!==O)for(;n!==O;)t.push(n),n=b();else t=z;return t!==O&&(Je=e,t=ge(t)),e=t}function b(){var t,n,i,o,a,u;return t=Te,ye.test(e.charAt(Te))?(n=e.charAt(Te),Te++):(n=O,0===Qe&&r(_e)),n!==O&&(Je=t,n=Ae(n)),t=n,t===O&&(t=Te,e.substr(Te,2)===be?(n=be,Te+=2):(n=O,0===Qe&&r(Ee)),n!==O&&(Je=t,n=we()),(t=n)===O&&(t=Te,e.substr(Te,2)===je?(n=je,Te+=2):(n=O,0===Qe&&r(Se)),n!==O&&(Je=t,n=xe()),(t=n)===O&&(t=Te,e.substr(Te,2)===Fe?(n=Fe,Te+=2):(n=O,0===Qe&&r(Oe)),n!==O&&(Je=t,n=Pe()),(t=n)===O&&(t=Te,e.substr(Te,2)===Le?(n=Le,Te+=2):(n=O,0===Qe&&r(De)),n!==O?(i=w(),i!==O?(o=w(),o!==O?(a=w(),a!==O?(u=w(),u!==O?(Je=t,n=ze(i,o,a,u),t=n):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z)):(Te=t,t=z))))),t}function E(){var t,n,i;if(t=Te,n=[],Ne.test(e.charAt(Te))?(i=e.charAt(Te),Te++):(i=O,0===Qe&&r(Ie)),i!==O)for(;i!==O;)n.push(i),Ne.test(e.charAt(Te))?(i=e.charAt(Te),Te++):(i=O,0===Qe&&r(Ie));else n=z;return n!==O&&(Je=t,n=Re(n)),t=n}function w(){var t;return Ce.test(e.charAt(Te))?(t=e.charAt(Te),Te++):(t=O,0===Qe&&r(Ze)),t}function j(){var e,t,n;for(Qe++,e=Te,t=[],n=S();n!==O;)t.push(n),n=S();return t!==O&&(Je=e,t=Me(t)),e=t,Qe--,e===O&&(t=O,0===Qe&&r(ke)),e}function S(){var t;return Ge.test(e.charAt(Te))?(t=e.charAt(Te),Te++):(t=O,0===Qe&&r($e)),t}var x,F=arguments.length>1?arguments[1]:{},O={},P={start:o},L=o,D=function(e){return{type:"program",program:e}},z=O,N=function(e,t){var n=[];e&&e.val&&n.push(e);for(var r in t)t.hasOwnProperty(r)&&n.push(t[r]);return{type:"messageFormatPattern",statements:n}},I="{",R={type:"literal",value:"{",description:'"{"'},C="}",Z={type:"literal",value:"}",description:'"}"'},k=function(e,t){var n=[];return e&&n.push(e),t&&t.val&&n.push(t),{type:"messageFormatPatternRight",statements:n}},M=null,G=",",$={type:"literal",value:",",description:'","'},T=function(e,t){var n={type:"messageFormatElement",argumentIndex:e};return t&&t.length?n.elementFormat=t[1]:n.output=!0,n},J="plural",B={type:"literal",value:"plural",description:'"plural"'},V=function(e,t){return{type:"elementFormat",key:e,val:t.val}},q="selectordinal",U={type:"literal",value:"selectordinal",description:'"selectordinal"'},Q="select",Y={type:"literal",value:"select",description:'"select"'},H=function(e,t){return{type:"elementFormat",key:e,val:t}},K=function(e){return{type:"pluralStyle",val:e}},W=function(e){return{type:"selectStyle",val:e}},X=function(e,t){var n={type:"pluralFormatPattern",pluralForms:t};return n.offset=e||0,n},ee="offset",te={type:"literal",value:"offset",description:'"offset"'},ne=":",re={type:"literal",value:":",description:'":"'},ie=function(e){return e},oe=function(e){return{type:"selectFormatPattern",pluralForms:e}},ae=function(e,t){return{type:"pluralForms",key:e,val:t}},ue=function(e){return e},se="=",le={type:"literal",value:"=",description:'"="'},ce=function(e){return e},fe=function(e,t){for(var n=[],r=0;r<t.length;++r)for(var i=0;i<t[r].length;++i)n.push(t[r][i]);return{type:"string",val:e+n.join("")}},pe=/^[0-9a-zA-Z$_]/,he={type:"class",value:"[0-9a-zA-Z$_]",description:"[0-9a-zA-Z$_]"},me=/^[^ \t\n\r,.+={}]/,de={type:"class",value:"[^ \\t\\n\\r,.+={}]",description:"[^ \\t\\n\\r,.+={}]"},ve=function(e,t){return e+(t?t.join(""):"")},ge=function(e){return e.join("")},ye=/^[^{}\\\0-\x1F\x7f \t\n\r]/,_e={type:"class",value:"[^{}\\\\\\0-\\x1F\x7f \\t\\n\\r]",description:"[^{}\\\\\\0-\\x1F\x7f \\t\\n\\r]"},Ae=function(e){return e},be="\\#",Ee={type:"literal",value:"\\#",description:'"\\\\#"'},we=function(){return"\\#"},je="\\{",Se={type:"literal",value:"\\{",description:'"\\\\{"'},xe=function(){return"{"},Fe="\\}",Oe={type:"literal",value:"\\}",description:'"\\\\}"'},Pe=function(){return"}"},Le="\\u",De={type:"literal",value:"\\u",description:'"\\\\u"'},ze=function(e,t,n,r){return String.fromCharCode(parseInt("0x"+e+t+n+r))},Ne=/^[0-9]/,Ie={type:"class",value:"[0-9]",description:"[0-9]"},Re=function(e){return parseInt(e.join(""),10)},Ce=/^[0-9a-fA-F]/,Ze={type:"class",value:"[0-9a-fA-F]",description:"[0-9a-fA-F]"},ke={type:"other",description:"whitespace"},Me=function(e){return e.join("")},Ge=/^[ \t\n\r]/,$e={type:"class",value:"[ \\t\\n\\r]",description:"[ \\t\\n\\r]"},Te=0,Je=0,Be=0,Ve={line:1,column:1,seenCR:!1},qe=0,Ue=[],Qe=0;if("startRule"in F){if(!(F.startRule in P))throw new Error("Can't start parsing from rule \""+F.startRule+'".');L=P[F.startRule]}if((x=L())!==O&&Te===e.length)return x;throw x!==O&&Te<e.length&&r({type:"end",description:"end of input"}),i(null,Ue,qe)}return e(t,Error),{SyntaxError:t,parse:n}}();e._parse=function(){return t.parse.apply(t,arguments)};var n=function(e){return/^[A-Z_$][0-9A-Z_$]*$/i.test(e)?e:JSON.stringify(e)};return e.prototype._precompile=function(t,r){r=r||{keys:{},offset:{}};var i,o,a=[],u=[];switch(t.type){case"messageFormatPattern":for(i=0;i<t.statements.length;++i)a.push(this._precompile(t.statements[i],r));return o=a.join("+")||'""',r.pf_count?o:"function(d){return "+o+"}";case"messageFormatPatternRight":for(i=0;i<t.statements.length;++i)a.push(this._precompile(t.statements[i],r));return a.join("+");case"messageFormatElement":return r.pf_count=r.pf_count||0,t.output?"d["+JSON.stringify(t.argumentIndex)+"]":(r.keys[r.pf_count]=JSON.stringify(t.argumentIndex),this._precompile(t.elementFormat,r));case"elementFormat":var u=["d["+r.keys[r.pf_count]+"]"];switch(t.key){case"select":return u.push(this._precompile(t.val,r)),"_s("+u.join(",")+")";case"selectordinal":return u=u.concat([0,"pf["+JSON.stringify(this.lc[0])+"]",this._precompile(t.val,r),1]),"_p("+u.join(",")+")";case"plural":return r.offset[r.pf_count||0]=t.val.offset||0,u=u.concat([r.offset[r.pf_count]||0,"pf["+JSON.stringify(this.lc[0])+"]",this._precompile(t.val,r)]),"_p("+u.join(",")+")";default:return this.withIntlSupport&&!(t.key in this.runtime.fmt)&&t.key in e.formatters&&(o=e.formatters[t.key],this.runtime.fmt[t.key]="function"==typeof o(this)?o(this):o),u.push(JSON.stringify(this.lc)),t.val&&t.val.length&&u.push(JSON.stringify(1==t.val.length?t.val[0]:t.val)),"fmt."+t.key+"("+u.join(",")+")"}case"pluralFormatPattern":case"selectFormatPattern":r.pf_count=r.pf_count||0,"selectFormatPattern"==t.type&&(r.offset[r.pf_count]=0);var s=!0;for(i=0;i<t.pluralForms.length;++i){var l=t.pluralForms[i].key;"other"===l&&(s=!1);var c=JSON.parse(JSON.stringify(r));c.pf_count++,a.push(n(l)+":"+this._precompile(t.pluralForms[i].val,c))}if(s)throw new Error("No 'other' form found in "+t.type+" "+r.pf_count);return"{"+a.join(",")+"}";case"string":return o='"'+(t.val||"").replace(/\n/g,"\\n").replace(/"/g,'\\"')+'"',r.pf_count&&(u=["d["+r.keys[r.pf_count-1]+"]"],r.offset[r.pf_count-1]&&u.push(r.offset[r.pf_count-1]),o=o.replace(/(^|[^\\])#/g,'$1"+_n('+u.join(",")+')+"'),o=o.replace(/^""\+/,"").replace(/\+""$/,"")),o;default:throw new Error("Bad AST type: "+t.type)}},e.prototype.compile=function(t,r){var i={},o=this.lc,a=function(t,n){try{var r=e._parse(n).program;return t._precompile(r)}catch(e){throw new Error((r?"Precompiler":"Parser")+" error: "+e.toString())}},u=function(e){if("object"!=typeof e)return e;var t=[];for(var r in e)t.push(n(r)+":"+u(e[r]));return"{\n"+t.join(",\n")+"}"};if("string"==typeof t){return new Function("_n,_p,_s,pf,fmt","return "+a(this,t))(this.runtime._n,this.runtime._p,this.runtime._s,this.runtime.pf,this.runtime.fmt)}r=r||{};for(var s in t)if(r.locale&&(this.lc=r.locale[s]&&[].concat(r.locale[s])||o),"string"==typeof t[s])try{i[s]=a(this,t[s])}catch(e){throw e.message=e.message.replace(":"," with `"+s+"`:"),e}else{i[s]={};for(var l in t[s])try{i[s][l]=a(this,t[s][l])}catch(e){throw e.message=e.message.replace(":"," with `"+l+"` in `"+s+"`:"),e}}this.lc=o;var c="var\n"+this.runtime.toString()+";\n\n";switch(r.global||""){case"exports":var f=[];for(var p in i)f.push("exports["+JSON.stringify(p)+"] = "+u(i[p]));return new Function(c+f.join(";\n"));case"module.exports":return new Function(c+"module.exports = "+u(i));case"":return new Function(c+"return "+u(i));default:return new Function("G",c+"G["+JSON.stringify(r.global)+"] = "+u(i))}},e}();var f=function(e){a("E_MISSING_MESSAGE_BUNDLE","Missing message bundle for locale `{locale}`.",e.attributes.bundle&&e.get("globalize-messages/{bundle}")!==undefined,{locale:e.locale})},p=function(e,t){e=e.join("/"),a("E_MISSING_MESSAGE","Missing required message content `{path}`.",t!==undefined,{path:e})},h=function(e,t){e=e.join("/"),a("E_INVALID_MESSAGE","Invalid message content `{path}`. {expected} expected.","string"==typeof t,{expected:"a string",path:e})},m=function(e,t){l(e,t,e===undefined||o(e)||Array.isArray(e),"Array or Plain Object")},d=function(){a("E_MISSING_PLURAL_MODULE","Plural module not loaded.",t.plural!==undefined,{})},v=[].slice;return t.loadMessages=function(t){var n,r={"globalize-messages":t,main:{}};s(t,"json"),c(t,"json");for(n in t)t.hasOwnProperty(n)&&(r.main[n]={});e.load(r)},t.messageFormatter=t.prototype.messageFormatter=function(e){var t,r,o;return s(e,"path"),l(e,"path","string"==typeof e||Array.isArray(e),"a String nor an Array"),e=i(e),t=this.cldr,u(t),f(t),o=t.get(["globalize-messages/{bundle}"].concat(e)),p(e,o),Array.isArray(o)&&(o=o.join(" ")),h(e,o),r=n(this,t).compile(o),function(e){return"number"!=typeof e&&"string"!=typeof e||(e=v.call(arguments,0)),m(e,"variables"),r(e)}},t.formatMessage=t.prototype.formatMessage=function(e){return this.messageFormatter(e).apply({},v.call(arguments,1))},t});