UNPKG

lakutata

Version:

An IoC-based universal application framework.

653 lines (611 loc) 19.2 kB
/* Build Date: Mon Jan 05 2026 23:52:23 GMT+0800 (China Standard Time) */ import e from "buffer"; import t from "tty"; import r from "util"; // -- Shims -- import cjsUrl from 'node:url'; import cjsPath from 'node:path'; import cjsModule from 'node:module'; const __filename = cjsUrl.fileURLToPath(import.meta.url); const __dirname = cjsPath.dirname(__filename); const require = cjsModule.createRequire(import.meta.url); var n = { exports: {} }; var s = { exports: {} }; s.exports; var o; function i() { if (o) return s.exports; o = 1; if (typeof Object.create === "function") { s.exports = function e(t, r) { if (r) { t.super_ = r; t.prototype = Object.create(r.prototype, { constructor: { value: t, enumerable: false, writable: true, configurable: true } }); } }; } else { s.exports = function e(t, r) { if (r) { t.super_ = r; var n = function() {}; n.prototype = r.prototype; t.prototype = new n; t.prototype.constructor = t; } }; } return s.exports; } n.exports; var c; function a() { if (c) return n.exports; c = 1; try { var e = require("util"); if (typeof e.inherits !== "function") throw ""; n.exports = e.inherits; } catch (e) { n.exports = i(); } return n.exports; } var u = { exports: {} }; u.exports; var f; function l() { if (f) return u.exports; f = 1; (function(t, r) { var n = e; var s = n.Buffer; function o(e, t) { for (var r in e) { t[r] = e[r]; } } if (s.from && s.alloc && s.allocUnsafe && s.allocUnsafeSlow) { t.exports = n; } else { o(n, r); r.Buffer = i; } function i(e, t, r) { return s(e, t, r); } i.prototype = Object.create(s.prototype); o(s, i); i.from = function(e, t, r) { if (typeof e === "number") { throw new TypeError("Argument must not be a number"); } return s(e, t, r); }; i.alloc = function(e, t, r) { if (typeof e !== "number") { throw new TypeError("Argument must be a number"); } var n = s(e); if (t !== undefined) { if (typeof r === "string") { n.fill(t, r); } else { n.fill(t); } } else { n.fill(0); } return n; }; i.allocUnsafe = function(e) { if (typeof e !== "number") { throw new TypeError("Argument must be a number"); } return s(e); }; i.allocUnsafeSlow = function(e) { if (typeof e !== "number") { throw new TypeError("Argument must be a number"); } return n.SlowBuffer(e); }; })(u, u.exports); return u.exports; } var p = { exports: {} }; var d = { exports: {} }; var C; var m; function g() { if (m) return C; m = 1; var e = 1e3; var t = e * 60; var r = t * 60; var n = r * 24; var s = n * 7; var o = n * 365.25; C = function(e, t) { t = t || {}; var r = typeof e; if (r === "string" && e.length > 0) { return i(e); } else if (r === "number" && isFinite(e)) { return t.long ? a(e) : c(e); } throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(e)); }; function i(i) { i = String(i); if (i.length > 100) { return; } var c = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i); if (!c) { return; } var a = parseFloat(c[1]); var u = (c[2] || "ms").toLowerCase(); switch (u) { case "years": case "year": case "yrs": case "yr": case "y": return a * o; case "weeks": case "week": case "w": return a * s; case "days": case "day": case "d": return a * n; case "hours": case "hour": case "hrs": case "hr": case "h": return a * r; case "minutes": case "minute": case "mins": case "min": case "m": return a * t; case "seconds": case "second": case "secs": case "sec": case "s": return a * e; case "milliseconds": case "millisecond": case "msecs": case "msec": case "ms": return a; default: return undefined; } } function c(s) { var o = Math.abs(s); if (o >= n) { return Math.round(s / n) + "d"; } if (o >= r) { return Math.round(s / r) + "h"; } if (o >= t) { return Math.round(s / t) + "m"; } if (o >= e) { return Math.round(s / e) + "s"; } return s + "ms"; } function a(s) { var o = Math.abs(s); if (o >= n) { return u(s, o, n, "day"); } if (o >= r) { return u(s, o, r, "hour"); } if (o >= t) { return u(s, o, t, "minute"); } if (o >= e) { return u(s, o, e, "second"); } return s + " ms"; } function u(e, t, r, n) { var s = t >= r * 1.5; return Math.round(e / r) + " " + n + (s ? "s" : ""); } return C; } var h; var y; function F() { if (y) return h; y = 1; function e(e) { r.debug = r; r.default = r; r.coerce = a; r.disable = i; r.enable = s; r.enabled = c; r.humanize = g(); r.destroy = u; Object.keys(e).forEach(t => { r[t] = e[t]; }); r.names = []; r.skips = []; r.formatters = {}; function t(e) { let t = 0; for (let r = 0; r < e.length; r++) { t = (t << 5) - t + e.charCodeAt(r); t |= 0; } return r.colors[Math.abs(t) % r.colors.length]; } r.selectColor = t; function r(e) { let t; let s = null; let o; let i; function c(...e) { if (!c.enabled) { return; } const n = c; const s = Number(new Date); const o = s - (t || s); n.diff = o; n.prev = t; n.curr = s; t = s; e[0] = r.coerce(e[0]); if (typeof e[0] !== "string") { e.unshift("%O"); } let i = 0; e[0] = e[0].replace(/%([a-zA-Z%])/g, (t, s) => { if (t === "%%") { return "%"; } i++; const o = r.formatters[s]; if (typeof o === "function") { const r = e[i]; t = o.call(n, r); e.splice(i, 1); i--; } return t; }); r.formatArgs.call(n, e); const a = n.log || r.log; a.apply(n, e); } c.namespace = e; c.useColors = r.useColors(); c.color = r.selectColor(e); c.extend = n; c.destroy = r.destroy; Object.defineProperty(c, "enabled", { enumerable: true, configurable: false, get: () => { if (s !== null) { return s; } if (o !== r.namespaces) { o = r.namespaces; i = r.enabled(e); } return i; }, set: e => { s = e; } }); if (typeof r.init === "function") { r.init(c); } return c; } function n(e, t) { const n = r(this.namespace + (typeof t === "undefined" ? ":" : t) + e); n.log = this.log; return n; } function s(e) { r.save(e); r.namespaces = e; r.names = []; r.skips = []; const t = (typeof e === "string" ? e : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean); for (const e of t) { if (e[0] === "-") { r.skips.push(e.slice(1)); } else { r.names.push(e); } } } function o(e, t) { let r = 0; let n = 0; let s = -1; let o = 0; while (r < e.length) { if (n < t.length && (t[n] === e[r] || t[n] === "*")) { if (t[n] === "*") { s = n; o = r; n++; } else { r++; n++; } } else if (s !== -1) { n = s + 1; o++; r = o; } else { return false; } } while (n < t.length && t[n] === "*") { n++; } return n === t.length; } function i() { const e = [ ...r.names, ...r.skips.map(e => "-" + e) ].join(","); r.enable(""); return e; } function c(e) { for (const t of r.skips) { if (o(e, t)) { return false; } } for (const t of r.names) { if (o(e, t)) { return true; } } return false; } function a(e) { if (e instanceof Error) { return e.stack || e.message; } return e; } function u() { console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."); } r.enable(r.load()); return r; } h = e; return h; } d.exports; var v; function b() { if (v) return d.exports; v = 1; (function(e, t) { t.formatArgs = n; t.save = s; t.load = o; t.useColors = r; t.storage = i(); t.destroy = (() => { let e = false; return () => { if (!e) { e = true; console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."); } }; })(); t.colors = [ "#0000CC", "#0000FF", "#0033CC", "#0033FF", "#0066CC", "#0066FF", "#0099CC", "#0099FF", "#00CC00", "#00CC33", "#00CC66", "#00CC99", "#00CCCC", "#00CCFF", "#3300CC", "#3300FF", "#3333CC", "#3333FF", "#3366CC", "#3366FF", "#3399CC", "#3399FF", "#33CC00", "#33CC33", "#33CC66", "#33CC99", "#33CCCC", "#33CCFF", "#6600CC", "#6600FF", "#6633CC", "#6633FF", "#66CC00", "#66CC33", "#9900CC", "#9900FF", "#9933CC", "#9933FF", "#99CC00", "#99CC33", "#CC0000", "#CC0033", "#CC0066", "#CC0099", "#CC00CC", "#CC00FF", "#CC3300", "#CC3333", "#CC3366", "#CC3399", "#CC33CC", "#CC33FF", "#CC6600", "#CC6633", "#CC9900", "#CC9933", "#CCCC00", "#CCCC33", "#FF0000", "#FF0033", "#FF0066", "#FF0099", "#FF00CC", "#FF00FF", "#FF3300", "#FF3333", "#FF3366", "#FF3399", "#FF33CC", "#FF33FF", "#FF6600", "#FF6633", "#FF9900", "#FF9933", "#FFCC00", "#FFCC33" ]; function r() { if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) { return true; } if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { return false; } let e; return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && (e = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(e[1], 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); } function n(t) { t[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + t[0] + (this.useColors ? "%c " : " ") + "+" + e.exports.humanize(this.diff); if (!this.useColors) { return; } const r = "color: " + this.color; t.splice(1, 0, r, "color: inherit"); let n = 0; let s = 0; t[0].replace(/%[a-zA-Z%]/g, e => { if (e === "%%") { return; } n++; if (e === "%c") { s = n; } }); t.splice(s, 0, r); } t.log = console.debug || console.log || (() => {}); function s(e) { try { if (e) { t.storage.setItem("debug", e); } else { t.storage.removeItem("debug"); } } catch (e) {} } function o() { let e; try { e = t.storage.getItem("debug") || t.storage.getItem("DEBUG"); } catch (e) {} if (!e && typeof process !== "undefined" && "env" in process) { e = process.env.DEBUG; } return e; } function i() { try { return localStorage; } catch (e) {} } e.exports = F()(t); const {formatters: c} = e.exports; c.j = function(e) { try { return JSON.stringify(e); } catch (e) { return "[UnexpectedJSONParseError]: " + e.message; } }; })(d, d.exports); return d.exports; } var w = { exports: {} }; w.exports; var x; function O() { if (x) return w.exports; x = 1; (function(e, n) { const s = t; const o = r; n.init = p; n.log = u; n.formatArgs = c; n.save = f; n.load = l; n.useColors = i; n.destroy = o.deprecate(() => {}, "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."); n.colors = [ 6, 2, 3, 4, 5, 1 ]; try { const e = require("supports-color"); if (e && (e.stderr || e).level >= 2) { n.colors = [ 20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 214, 215, 220, 221 ]; } } catch (e) {} n.inspectOpts = Object.keys(process.env).filter(e => /^debug_/i.test(e)).reduce((e, t) => { const r = t.substring(6).toLowerCase().replace(/_([a-z])/g, (e, t) => t.toUpperCase()); let n = process.env[t]; if (/^(yes|on|true|enabled)$/i.test(n)) { n = true; } else if (/^(no|off|false|disabled)$/i.test(n)) { n = false; } else if (n === "null") { n = null; } else { n = Number(n); } e[r] = n; return e; }, {}); function i() { return "colors" in n.inspectOpts ? Boolean(n.inspectOpts.colors) : s.isatty(process.stderr.fd); } function c(t) { const {namespace: r, useColors: n} = this; if (n) { const n = this.color; const s = "[3" + (n < 8 ? n : "8;5;" + n); const o = ` ${s};1m${r} `; t[0] = o + t[0].split("\n").join("\n" + o); t.push(s + "m+" + e.exports.humanize(this.diff) + ""); } else { t[0] = a() + r + " " + t[0]; } } function a() { if (n.inspectOpts.hideDate) { return ""; } return (new Date).toISOString() + " "; } function u(...e) { return process.stderr.write(o.formatWithOptions(n.inspectOpts, ...e) + "\n"); } function f(e) { if (e) { process.env.DEBUG = e; } else { delete process.env.DEBUG; } } function l() { return process.env.DEBUG; } function p(e) { e.inspectOpts = {}; const t = Object.keys(n.inspectOpts); for (let r = 0; r < t.length; r++) { e.inspectOpts[t[r]] = n.inspectOpts[t[r]]; } } e.exports = F()(n); const {formatters: d} = e.exports; d.o = function(e) { this.inspectOpts.colors = this.useColors; return o.inspect(e, this.inspectOpts).split("\n").map(e => e.trim()).join(" "); }; d.O = function(e) { this.inspectOpts.colors = this.useColors; return o.inspect(e, this.inspectOpts); }; })(w, w.exports); return w.exports; } p.exports; if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) { p.exports = b(); } else { p.exports = O(); } var A = p.exports; export { l as a, a as r, A as s };