summaryrefslogtreecommitdiff
path: root/includes/external/matrix/node_modules/loglevel/dist
diff options
context:
space:
mode:
Diffstat (limited to 'includes/external/matrix/node_modules/loglevel/dist')
-rw-r--r--includes/external/matrix/node_modules/loglevel/dist/loglevel.js292
-rw-r--r--includes/external/matrix/node_modules/loglevel/dist/loglevel.min.js2
2 files changed, 294 insertions, 0 deletions
diff --git a/includes/external/matrix/node_modules/loglevel/dist/loglevel.js b/includes/external/matrix/node_modules/loglevel/dist/loglevel.js
new file mode 100644
index 0000000..83cc77d
--- /dev/null
+++ b/includes/external/matrix/node_modules/loglevel/dist/loglevel.js
@@ -0,0 +1,292 @@
+/*! loglevel - v1.8.1 - https://github.com/pimterry/loglevel - (c) 2022 Tim Perry - licensed MIT */
+(function (root, definition) {
+ "use strict";
+ if (typeof define === 'function' && define.amd) {
+ define(definition);
+ } else if (typeof module === 'object' && module.exports) {
+ module.exports = definition();
+ } else {
+ root.log = definition();
+ }
+}(this, function () {
+ "use strict";
+
+ // Slightly dubious tricks to cut down minimized file size
+ var noop = function() {};
+ var undefinedType = "undefined";
+ var isIE = (typeof window !== undefinedType) && (typeof window.navigator !== undefinedType) && (
+ /Trident\/|MSIE /.test(window.navigator.userAgent)
+ );
+
+ var logMethods = [
+ "trace",
+ "debug",
+ "info",
+ "warn",
+ "error"
+ ];
+
+ // Cross-browser bind equivalent that works at least back to IE6
+ function bindMethod(obj, methodName) {
+ var method = obj[methodName];
+ if (typeof method.bind === 'function') {
+ return method.bind(obj);
+ } else {
+ try {
+ return Function.prototype.bind.call(method, obj);
+ } catch (e) {
+ // Missing bind shim or IE8 + Modernizr, fallback to wrapping
+ return function() {
+ return Function.prototype.apply.apply(method, [obj, arguments]);
+ };
+ }
+ }
+ }
+
+ // Trace() doesn't print the message in IE, so for that case we need to wrap it
+ function traceForIE() {
+ if (console.log) {
+ if (console.log.apply) {
+ console.log.apply(console, arguments);
+ } else {
+ // In old IE, native console methods themselves don't have apply().
+ Function.prototype.apply.apply(console.log, [console, arguments]);
+ }
+ }
+ if (console.trace) console.trace();
+ }
+
+ // Build the best logging method possible for this env
+ // Wherever possible we want to bind, not wrap, to preserve stack traces
+ function realMethod(methodName) {
+ if (methodName === 'debug') {
+ methodName = 'log';
+ }
+
+ if (typeof console === undefinedType) {
+ return false; // No method possible, for now - fixed later by enableLoggingWhenConsoleArrives
+ } else if (methodName === 'trace' && isIE) {
+ return traceForIE;
+ } else if (console[methodName] !== undefined) {
+ return bindMethod(console, methodName);
+ } else if (console.log !== undefined) {
+ return bindMethod(console, 'log');
+ } else {
+ return noop;
+ }
+ }
+
+ // These private functions always need `this` to be set properly
+
+ function replaceLoggingMethods(level, loggerName) {
+ /*jshint validthis:true */
+ for (var i = 0; i < logMethods.length; i++) {
+ var methodName = logMethods[i];
+ this[methodName] = (i < level) ?
+ noop :
+ this.methodFactory(methodName, level, loggerName);
+ }
+
+ // Define log.log as an alias for log.debug
+ this.log = this.debug;
+ }
+
+ // In old IE versions, the console isn't present until you first open it.
+ // We build realMethod() replacements here that regenerate logging methods
+ function enableLoggingWhenConsoleArrives(methodName, level, loggerName) {
+ return function () {
+ if (typeof console !== undefinedType) {
+ replaceLoggingMethods.call(this, level, loggerName);
+ this[methodName].apply(this, arguments);
+ }
+ };
+ }
+
+ // By default, we use closely bound real methods wherever possible, and
+ // otherwise we wait for a console to appear, and then try again.
+ function defaultMethodFactory(methodName, level, loggerName) {
+ /*jshint validthis:true */
+ return realMethod(methodName) ||
+ enableLoggingWhenConsoleArrives.apply(this, arguments);
+ }
+
+ function Logger(name, defaultLevel, factory) {
+ var self = this;
+ var currentLevel;
+ defaultLevel = defaultLevel == null ? "WARN" : defaultLevel;
+
+ var storageKey = "loglevel";
+ if (typeof name === "string") {
+ storageKey += ":" + name;
+ } else if (typeof name === "symbol") {
+ storageKey = undefined;
+ }
+
+ function persistLevelIfPossible(levelNum) {
+ var levelName = (logMethods[levelNum] || 'silent').toUpperCase();
+
+ if (typeof window === undefinedType || !storageKey) return;
+
+ // Use localStorage if available
+ try {
+ window.localStorage[storageKey] = levelName;
+ return;
+ } catch (ignore) {}
+
+ // Use session cookie as fallback
+ try {
+ window.document.cookie =
+ encodeURIComponent(storageKey) + "=" + levelName + ";";
+ } catch (ignore) {}
+ }
+
+ function getPersistedLevel() {
+ var storedLevel;
+
+ if (typeof window === undefinedType || !storageKey) return;
+
+ try {
+ storedLevel = window.localStorage[storageKey];
+ } catch (ignore) {}
+
+ // Fallback to cookies if local storage gives us nothing
+ if (typeof storedLevel === undefinedType) {
+ try {
+ var cookie = window.document.cookie;
+ var location = cookie.indexOf(
+ encodeURIComponent(storageKey) + "=");
+ if (location !== -1) {
+ storedLevel = /^([^;]+)/.exec(cookie.slice(location))[1];
+ }
+ } catch (ignore) {}
+ }
+
+ // If the stored level is not valid, treat it as if nothing was stored.
+ if (self.levels[storedLevel] === undefined) {
+ storedLevel = undefined;
+ }
+
+ return storedLevel;
+ }
+
+ function clearPersistedLevel() {
+ if (typeof window === undefinedType || !storageKey) return;
+
+ // Use localStorage if available
+ try {
+ window.localStorage.removeItem(storageKey);
+ return;
+ } catch (ignore) {}
+
+ // Use session cookie as fallback
+ try {
+ window.document.cookie =
+ encodeURIComponent(storageKey) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
+ } catch (ignore) {}
+ }
+
+ /*
+ *
+ * Public logger API - see https://github.com/pimterry/loglevel for details
+ *
+ */
+
+ self.name = name;
+
+ self.levels = { "TRACE": 0, "DEBUG": 1, "INFO": 2, "WARN": 3,
+ "ERROR": 4, "SILENT": 5};
+
+ self.methodFactory = factory || defaultMethodFactory;
+
+ self.getLevel = function () {
+ return currentLevel;
+ };
+
+ self.setLevel = function (level, persist) {
+ if (typeof level === "string" && self.levels[level.toUpperCase()] !== undefined) {
+ level = self.levels[level.toUpperCase()];
+ }
+ if (typeof level === "number" && level >= 0 && level <= self.levels.SILENT) {
+ currentLevel = level;
+ if (persist !== false) { // defaults to true
+ persistLevelIfPossible(level);
+ }
+ replaceLoggingMethods.call(self, level, name);
+ if (typeof console === undefinedType && level < self.levels.SILENT) {
+ return "No console available for logging";
+ }
+ } else {
+ throw "log.setLevel() called with invalid level: " + level;
+ }
+ };
+
+ self.setDefaultLevel = function (level) {
+ defaultLevel = level;
+ if (!getPersistedLevel()) {
+ self.setLevel(level, false);
+ }
+ };
+
+ self.resetLevel = function () {
+ self.setLevel(defaultLevel, false);
+ clearPersistedLevel();
+ };
+
+ self.enableAll = function(persist) {
+ self.setLevel(self.levels.TRACE, persist);
+ };
+
+ self.disableAll = function(persist) {
+ self.setLevel(self.levels.SILENT, persist);
+ };
+
+ // Initialize with the right level
+ var initialLevel = getPersistedLevel();
+ if (initialLevel == null) {
+ initialLevel = defaultLevel;
+ }
+ self.setLevel(initialLevel, false);
+ }
+
+ /*
+ *
+ * Top-level API
+ *
+ */
+
+ var defaultLogger = new Logger();
+
+ var _loggersByName = {};
+ defaultLogger.getLogger = function getLogger(name) {
+ if ((typeof name !== "symbol" && typeof name !== "string") || name === "") {
+ throw new TypeError("You must supply a name when creating a logger.");
+ }
+
+ var logger = _loggersByName[name];
+ if (!logger) {
+ logger = _loggersByName[name] = new Logger(
+ name, defaultLogger.getLevel(), defaultLogger.methodFactory);
+ }
+ return logger;
+ };
+
+ // Grab the current global log variable in case of overwrite
+ var _log = (typeof window !== undefinedType) ? window.log : undefined;
+ defaultLogger.noConflict = function() {
+ if (typeof window !== undefinedType &&
+ window.log === defaultLogger) {
+ window.log = _log;
+ }
+
+ return defaultLogger;
+ };
+
+ defaultLogger.getLoggers = function getLoggers() {
+ return _loggersByName;
+ };
+
+ // ES6 default export, for compatibility
+ defaultLogger['default'] = defaultLogger;
+
+ return defaultLogger;
+}));
diff --git a/includes/external/matrix/node_modules/loglevel/dist/loglevel.min.js b/includes/external/matrix/node_modules/loglevel/dist/loglevel.min.js
new file mode 100644
index 0000000..8ab9aa6
--- /dev/null
+++ b/includes/external/matrix/node_modules/loglevel/dist/loglevel.min.js
@@ -0,0 +1,2 @@
+/*! loglevel - v1.8.1 - https://github.com/pimterry/loglevel - (c) 2022 Tim Perry - licensed MIT */
+!function(a,b){"use strict";"function"==typeof define&&define.amd?define(b):"object"==typeof module&&module.exports?module.exports=b():a.log=b()}(this,function(){"use strict";function a(a,b){var c=a[b];if("function"==typeof c.bind)return c.bind(a);try{return Function.prototype.bind.call(c,a)}catch(b){return function(){return Function.prototype.apply.apply(c,[a,arguments])}}}function b(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function c(c){return"debug"===c&&(c="log"),typeof console!==i&&("trace"===c&&j?b:void 0!==console[c]?a(console,c):void 0!==console.log?a(console,"log"):h)}function d(a,b){for(var c=0;c<k.length;c++){var d=k[c];this[d]=c<a?h:this.methodFactory(d,a,b)}this.log=this.debug}function e(a,b,c){return function(){typeof console!==i&&(d.call(this,b,c),this[a].apply(this,arguments))}}function f(a,b,d){return c(a)||e.apply(this,arguments)}function g(a,b,c){function e(a){var b=(k[a]||"silent").toUpperCase();if(typeof window!==i&&m){try{return void(window.localStorage[m]=b)}catch(a){}try{window.document.cookie=encodeURIComponent(m)+"="+b+";"}catch(a){}}}function g(){var a;if(typeof window!==i&&m){try{a=window.localStorage[m]}catch(a){}if(typeof a===i)try{var b=window.document.cookie,c=b.indexOf(encodeURIComponent(m)+"=");-1!==c&&(a=/^([^;]+)/.exec(b.slice(c))[1])}catch(a){}return void 0===l.levels[a]&&(a=void 0),a}}function h(){if(typeof window!==i&&m){try{return void window.localStorage.removeItem(m)}catch(a){}try{window.document.cookie=encodeURIComponent(m)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(a){}}}var j,l=this;b=null==b?"WARN":b;var m="loglevel";"string"==typeof a?m+=":"+a:"symbol"==typeof a&&(m=void 0),l.name=a,l.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},l.methodFactory=c||f,l.getLevel=function(){return j},l.setLevel=function(b,c){if("string"==typeof b&&void 0!==l.levels[b.toUpperCase()]&&(b=l.levels[b.toUpperCase()]),!("number"==typeof b&&b>=0&&b<=l.levels.SILENT))throw"log.setLevel() called with invalid level: "+b;if(j=b,!1!==c&&e(b),d.call(l,b,a),typeof console===i&&b<l.levels.SILENT)return"No console available for logging"},l.setDefaultLevel=function(a){b=a,g()||l.setLevel(a,!1)},l.resetLevel=function(){l.setLevel(b,!1),h()},l.enableAll=function(a){l.setLevel(l.levels.TRACE,a)},l.disableAll=function(a){l.setLevel(l.levels.SILENT,a)};var n=g();null==n&&(n=b),l.setLevel(n,!1)}var h=function(){},i="undefined",j=typeof window!==i&&typeof window.navigator!==i&&/Trident\/|MSIE /.test(window.navigator.userAgent),k=["trace","debug","info","warn","error"],l=new g,m={};l.getLogger=function(a){if("symbol"!=typeof a&&"string"!=typeof a||""===a)throw new TypeError("You must supply a name when creating a logger.");var b=m[a];return b||(b=m[a]=new g(a,l.getLevel(),l.methodFactory)),b};var n=typeof window!==i?window.log:void 0;return l.noConflict=function(){return typeof window!==i&&window.log===l&&(window.log=n),l},l.getLoggers=function(){return m},l.default=l,l}); \ No newline at end of file