weekly release 4.0dev
[moodle.git] / lib / amd / build / str.min.js
1 define ("core/str",["exports","jquery","core/ajax","core/localstorage"],function(a,b,c,d){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.cache_strings=a.get_strings=a.get_string=void 0;b=e(b);c=e(c);d=e(d);function e(a){return a&&a.__esModule?a:{default:a}}function f(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);if(b)d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable});c.push.apply(c,d)}return c}function g(a){for(var b=1,c;b<arguments.length;b++){c=null!=arguments[b]?arguments[b]:{};if(b%2){f(Object(c),!0).forEach(function(b){h(a,b,c[b])})}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(a,Object.getOwnPropertyDescriptors(c))}else{f(Object(c)).forEach(function(b){Object.defineProperty(a,b,Object.getOwnPropertyDescriptor(c,b))})}}return a}function h(a,b,c){if(b in a){Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0})}else{a[b]=c}return a}var i=[];a.get_string=function get_string(a,b,c,d){return j([{key:a,component:b,param:c,lang:d}]).then(function(a){return a[0]})};var j=function(a){var e=[],f=(0,b.default)("html").attr("lang").replace(/-/g,"_"),j=function(a){var b=a.key,c=a.component,d=a.lang,e=void 0===d?f:d;if(!c){c="core"}return"core_str/".concat(b,"/").concat(c,"/").concat(e)},k=a.map(function(a){var b=j(a),c=a.component,k=a.key,l=a.param,m=a.lang,n=void 0===m?f:m,o=function(a){i[b]=a;return a};if(c in M.str&&k in M.str[c]){return o(new Promise(function(a){a(M.util.get_string(k,c,l,n))}))}var p=d.default.get(b);if(p){M.str[c]=g({},M.str[c],h({},k,p));return o(new Promise(function(a){a(M.util.get_string(k,c,l,n))}))}if(b in i){return o(i[b]).then(function(){return M.util.get_string(k,c,l,n)})}else{return o(new Promise(function(a,f){e.push({methodname:"core_get_string",args:{stringid:k,stringparams:[],component:c,lang:n},done:function done(e){M.str[c]=g({},M.str[c],h({},k,e));d.default.set(b,e);a(M.util.get_string(k,c,l,n))},fail:f})}))}});if(e.length){c.default.call(e,!0,!1,!1,0,M.cfg.langrev)}return b.default.when.apply(b.default,k).then(function(){for(var a=arguments.length,b=Array(a),c=0;c<a;c++){b[c]=arguments[c]}return b})};a.get_strings=j;var k=function(a){var c=(0,b.default)("html").attr("lang").replace(/-/g,"_");a.forEach(function(a){var e=a.key,f=a.component,g=a.value,h=a.lang,j=void 0===h?c:h,k=["core_str",e,f,j].join("/");if(!(f in M.str)||!(e in M.str[f])){if(!(f in M.str)){M.str[f]={}}M.str[f][e]=g}if(!d.default.get(k)){d.default.set(k,g)}if(!(k in i)){i[k]=b.default.Deferred().resolve(g).promise()}})};a.cache_strings=k});
2 //# sourceMappingURL=str.min.js.map