tiseza_oss_live/Scripts/cldr.min.js

6 lines
4.6 KiB
JavaScript

/*!
* CLDR JavaScript Library v0.5.1 2019-01-21T13:43Z MIT license © Rafael Xavier
* http://git.io/h4lmVg
*/
!function(e,n){"function"==typeof define&&define.amd?define(n):"object"==typeof module&&"object"==typeof module.exports?module.exports=n():e.Cldr=n()}(this,function(){var e=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},n=function(n,t){if(e(n)&&(n=n.join("/")),"string"!=typeof n)throw new Error('invalid path "'+n+'"');return n=n.replace(/^\//,"").replace(/^cldr\//,""),n=n.replace(/{[a-zA-Z]+}/g,function(e){return e=e.replace(/^{([^}]*)}$/,"$1"),t[e]}),n.split("/")},t=function(e,n){var t,r;if(e.some)return e.some(n);for(t=0,r=e.length;t<r;t++)if(n(e[t],t,e))return!0;return!1},r=function(e,n,r,o){var a,i,u=r[0],l=r[1],c=e.localeSep,f=r[2],p=r.slice(3,4);return o=o||{},"und"!==u&&"Zzzz"!==l&&"ZZ"!==f?[u,l,f].concat(p):"undefined"!=typeof n.get("supplemental/likelySubtags")?(i=t([[u,l,f],[u,f],[u,l],[u],["und",l]],function(e){return a=!/\b(Zzzz|ZZ)\b/.test(e.join(c))&&n.get(["supplemental/likelySubtags",e.join(c)])}),i?(a=a.split(c),["und"!==u?u:a[0],"Zzzz"!==l?l:a[1],"ZZ"!==f?f:a[2]].concat(p)):o.force?n.get("supplemental/likelySubtags/und").split(c):void 0):void 0},o=function(e,n,o){var a,i,u=o[0],l=o[1],c=o[2],f=o[3];return i=t([[[u,"Zzzz","ZZ"],[u]],[[u,"Zzzz",c],[u,c]],[[u,l,"ZZ"],[u,l]]],function(t){var i=r(e,n,t[0]);return a=t[1],i&&i[0]===o[0]&&i[1]===o[1]&&i[2]===o[2]}),i?(f&&a.push(f),a):o},a=function(e){var n,t,r=[];return e=e.replace(/_/,"-"),n=e.split("-u-"),n[1]&&(n[1]=n[1].split("-t-"),e=n[0]+(n[1][1]?"-t-"+n[1][1]:""),r[4]=n[1][0]),t=e.split("-t-")[0],n=t.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)$/),null===n?["und","Zzzz","ZZ"]:(r[0]=n[10]||n[2]||"und",r[1]=n[4]||"Zzzz",r[2]=n[6]||"ZZ",n[7]&&n[7].length&&(r[3]=n[7].slice(1)),r)},i=function(e,n){var t,r;if(e.forEach)return e.forEach(n);for(t=0,r=e.length;t<r;t++)n(e[t],t,e)},u=function(e,n,t){var u=e._availableBundleMap,l=e._availableBundleMapQueue;return l.length&&(i(l,function(t){var i,l,c,f;f=a(t),l=r(e,n,f),c=o(e,n,l),c=c.join(e.localeSep),i=u[c],i&&i.length<t.length||(u[c]=t)}),e._availableBundleMapQueue=[]),u[t]||null},l=function(e){var n,t=[];if(Object.keys)return Object.keys(e);for(n in e)t.push(n);return t},c=function(e,n){var t,r;return r=e+(n&&JSON?": "+JSON.stringify(n):""),t=new Error(r),t.code=e,i(l(n),function(e){t[e]=n[e]}),t},f=function(e,n,t){if(!n)throw c(e,t)},p=function(e,n){f("E_MISSING_PARAMETER","undefined"!=typeof e,{name:n})},s=function(e,n,t,r){f("E_INVALID_PAR_TYPE",t,{expected:r,name:n,value:e})},d=function(n,t){s(n,t,"string"==typeof n||e(n),"String or Array")},v=function(e){return null!==e&&""+e=="[object Object]"},h=function(e,n){s(e,n,"undefined"==typeof e||v(e),"Plain Object")},g=function(e,n){s(e,n,"string"==typeof e,"a string")},y=function(e,n){var t,r=e,o=n.length;for(t=0;t<o-1;t++)if(r=r[n[t]],!r)return;return r[n[t]]},z=function(e,n){var t,r=e._availableBundleMapQueue,o=y(n,["main"]);if(o)for(t in o)o.hasOwnProperty(t)&&"root"!==t&&r.indexOf(t)===-1&&r.push(t)},_=function(n){return e(n)?n:[n]},b=function(){var n=function(){var t={},r=[].slice.call(arguments,0);return i(r,function(r){var o;for(o in r)o in t&&"object"==typeof t[o]&&!e(t[o])?t[o]=n(t[o],r[o]):t[o]=r[o]}),t};return n}(),Z=function(e,n,t){var r,o,a;for(p(t[0],"json"),r=0;r<t.length;r++)for(a=_(t[r]),o=0;o<a.length;o++)h(a[o],"json"),n=b(n,a[o]),z(e,a[o]);return n},j=function(e,t,r){var o=n(t,r);return y(e._resolved,o)},m=function(e){this.init(e)};return m._alwaysArray=_,m._coreLoad=Z,m._createError=c,m._itemGetResolved=j,m._jsonMerge=b,m._pathNormalize=n,m._resourceGet=y,m._validatePresence=p,m._validateType=s,m._validateTypePath=d,m._validateTypePlainObject=h,m._availableBundleMap={},m._availableBundleMapQueue=[],m._resolved={},m.localeSep="-",m.load=function(){m._resolved=Z(m,m._resolved,arguments)},m.prototype.init=function(e){var n,t,i,l,c,f,s,d,v,h=m.localeSep,y="";p(e,"locale"),g(e,"locale"),f=a(e),5===f.length&&(d=f.pop(),y=h+"u"+h+d,f[3]||f.pop()),v=f[3],i=r(m,this,f,{force:!0})||f,t=i[0],c=i[1],s=i[2],l=o(m,this,i).join(h),this.attributes=n={bundle:u(m,this,l),minLanguageId:l+y,maxLanguageId:i.join(h)+y,language:t,script:c,territory:s,region:s,variant:v},d&&("-"+d).replace(/-[a-z]{3,8}|(-[a-z]{2})-([a-z]{3,8})/g,function(e,t,r){t?n["u"+t]=r:n["u"+e]=!0}),this.locale=e},m.prototype.get=function(e){return p(e,"path"),d(e,"path"),j(m,e,this.attributes)},m.prototype.main=function(e){return p(e,"path"),d(e,"path"),f("E_MISSING_BUNDLE",null!==this.attributes.bundle,{locale:this.locale}),e=_(e),this.get(["main/{bundle}"].concat(e))},m});