tiny-essentials 1.7.1 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ColorSafeStringify.js +235 -0
- package/dist/ColorSafeStringify.min.js +1 -0
- package/dist/TinyBasicsEs.js +15 -7
- package/dist/TinyBasicsEs.min.js +1 -1
- package/dist/TinyEssentials.js +213 -7
- package/dist/TinyEssentials.min.js +1 -1
- package/dist/v1/basics/objFilter.cjs +16 -7
- package/dist/v1/basics/objFilter.d.mts +7 -0
- package/dist/v1/basics/objFilter.mjs +14 -7
- package/dist/v1/build/ColorSafeStringify.cjs +7 -0
- package/dist/v1/build/ColorSafeStringify.d.mts +3 -0
- package/dist/v1/build/ColorSafeStringify.mjs +2 -0
- package/dist/v1/index.cjs +2 -0
- package/dist/v1/index.d.mts +2 -1
- package/dist/v1/index.mjs +2 -1
- package/dist/v1/libs/ColorSafeStringify.cjs +196 -0
- package/dist/v1/libs/ColorSafeStringify.d.mts +62 -0
- package/dist/v1/libs/ColorSafeStringify.mjs +168 -0
- package/docs/README.md +9 -8
- package/docs/basics/objFilter.md +6 -0
- package/docs/libs/ColorSafeStringify.md +145 -0
- package/package.json +9 -2
package/dist/TinyEssentials.js
CHANGED
|
@@ -2142,6 +2142,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2142
2142
|
|
|
2143
2143
|
// EXPORTS
|
|
2144
2144
|
__webpack_require__.d(__webpack_exports__, {
|
|
2145
|
+
ColorSafeStringify: () => (/* reexport */ libs_ColorSafeStringify),
|
|
2145
2146
|
TinyLevelUp: () => (/* reexport */ userLevel),
|
|
2146
2147
|
TinyPromiseQueue: () => (/* reexport */ libs_TinyPromiseQueue),
|
|
2147
2148
|
addAiMarkerShortcut: () => (/* reexport */ addAiMarkerShortcut),
|
|
@@ -2630,7 +2631,7 @@ const typeValidator = {
|
|
|
2630
2631
|
/** @param {*} val @returns {val is Function} */
|
|
2631
2632
|
function: (val) => typeof val === 'function',
|
|
2632
2633
|
|
|
2633
|
-
/** @param {*} val @returns {val is Array
|
|
2634
|
+
/** @param {*} val @returns {val is Array} */
|
|
2634
2635
|
array: (val) => Array.isArray(val),
|
|
2635
2636
|
|
|
2636
2637
|
/** @param {*} val @returns {val is Date} */
|
|
@@ -2639,19 +2640,19 @@ const typeValidator = {
|
|
|
2639
2640
|
/** @param {*} val @returns {val is RegExp} */
|
|
2640
2641
|
regexp: (val) => val instanceof RegExp,
|
|
2641
2642
|
|
|
2642
|
-
/** @param {*} val @returns {val is Map
|
|
2643
|
+
/** @param {*} val @returns {val is Map} */
|
|
2643
2644
|
map: (val) => val instanceof Map,
|
|
2644
2645
|
|
|
2645
|
-
/** @param {*} val @returns {val is Set
|
|
2646
|
+
/** @param {*} val @returns {val is Set} */
|
|
2646
2647
|
set: (val) => val instanceof Set,
|
|
2647
2648
|
|
|
2648
|
-
/** @param {*} val @returns {val is WeakMap
|
|
2649
|
+
/** @param {*} val @returns {val is WeakMap} */
|
|
2649
2650
|
weakmap: (val) => val instanceof WeakMap,
|
|
2650
2651
|
|
|
2651
|
-
/** @param {*} val @returns {val is WeakSet
|
|
2652
|
+
/** @param {*} val @returns {val is WeakSet} */
|
|
2652
2653
|
weakset: (val) => val instanceof WeakSet,
|
|
2653
2654
|
|
|
2654
|
-
/** @param {*} val @returns {val is Promise
|
|
2655
|
+
/** @param {*} val @returns {val is Promise} */
|
|
2655
2656
|
promise: (val) => val instanceof Promise,
|
|
2656
2657
|
|
|
2657
2658
|
/** @param {*} val @returns {val is Buffer} */
|
|
@@ -2664,7 +2665,7 @@ const typeValidator = {
|
|
|
2664
2665
|
htmlelement: (val) => typeof HTMLElement !== 'undefined' && val instanceof HTMLElement,
|
|
2665
2666
|
|
|
2666
2667
|
/** @param {*} val @returns {val is object} */
|
|
2667
|
-
object: (val) => typeof val === 'object' && val !== null,
|
|
2668
|
+
object: (val) => typeof val === 'object' && val !== null && !Array.isArray(val),
|
|
2668
2669
|
},
|
|
2669
2670
|
|
|
2670
2671
|
/** Evaluation order of the type checkers. */
|
|
@@ -2838,6 +2839,14 @@ function checkObj(obj) {
|
|
|
2838
2839
|
return data;
|
|
2839
2840
|
}
|
|
2840
2841
|
|
|
2842
|
+
/**
|
|
2843
|
+
* Creates a clone of the functions from the `typeValidator` object.
|
|
2844
|
+
* It returns a new object where the keys are the same and the values are the cloned functions.
|
|
2845
|
+
*/
|
|
2846
|
+
function getCheckObj() {
|
|
2847
|
+
return Object.fromEntries(Object.entries(typeValidator.items).map(([key, fn]) => [key, fn]));
|
|
2848
|
+
}
|
|
2849
|
+
|
|
2841
2850
|
/**
|
|
2842
2851
|
* Counts the number of elements in an array or the number of properties in an object.
|
|
2843
2852
|
*
|
|
@@ -3031,6 +3040,202 @@ function KeyPressHandler() {
|
|
|
3031
3040
|
export default KeyPressHandler;
|
|
3032
3041
|
*/
|
|
3033
3042
|
|
|
3043
|
+
;// ./src/v1/libs/ColorSafeStringify.mjs
|
|
3044
|
+
/**
|
|
3045
|
+
* @typedef {Record<string, string>} ColorsList
|
|
3046
|
+
* Represents a mapping of color keys to ANSI escape codes.
|
|
3047
|
+
*/
|
|
3048
|
+
|
|
3049
|
+
class ColorSafeStringify {
|
|
3050
|
+
/**
|
|
3051
|
+
* Currently active color configuration.
|
|
3052
|
+
* @type {ColorsList}
|
|
3053
|
+
*/
|
|
3054
|
+
#colors;
|
|
3055
|
+
|
|
3056
|
+
/**
|
|
3057
|
+
* Preset collections (internal and user-defined).
|
|
3058
|
+
* @type {Record<string, ColorsList>}
|
|
3059
|
+
* @static
|
|
3060
|
+
*/
|
|
3061
|
+
static #PRESETS = {
|
|
3062
|
+
default: {
|
|
3063
|
+
reset: '\x1b[0m',
|
|
3064
|
+
key: '\x1b[36m', // Cyan (object keys)
|
|
3065
|
+
string: '\x1b[32m', // Green (regular strings)
|
|
3066
|
+
string_url: '\x1b[34m', // Blue (URLs)
|
|
3067
|
+
string_bool: '\x1b[35m', // Magenta (boolean/null in string form)
|
|
3068
|
+
string_number: '\x1b[33m', // Yellow (numbers in string form)
|
|
3069
|
+
number: '\x1b[33m', // Yellow (raw numbers)
|
|
3070
|
+
boolean: '\x1b[35m', // Magenta (true/false)
|
|
3071
|
+
null: '\x1b[1;30m', // Gray (null)
|
|
3072
|
+
special: '\x1b[31m', // Red (e.g., [Circular], [undefined])
|
|
3073
|
+
func: '\x1b[90m', // Dim (function string representations)
|
|
3074
|
+
},
|
|
3075
|
+
solarized: {
|
|
3076
|
+
reset: '\x1b[0m',
|
|
3077
|
+
key: '\x1b[38;5;37m',
|
|
3078
|
+
string: '\x1b[38;5;136m',
|
|
3079
|
+
string_url: '\x1b[38;5;33m',
|
|
3080
|
+
string_bool: '\x1b[38;5;166m',
|
|
3081
|
+
string_number: '\x1b[38;5;136m',
|
|
3082
|
+
number: '\x1b[38;5;136m',
|
|
3083
|
+
boolean: '\x1b[38;5;166m',
|
|
3084
|
+
null: '\x1b[38;5;241m',
|
|
3085
|
+
special: '\x1b[38;5;160m',
|
|
3086
|
+
func: '\x1b[38;5;244m',
|
|
3087
|
+
},
|
|
3088
|
+
monokai: {
|
|
3089
|
+
reset: '\x1b[0m',
|
|
3090
|
+
key: '\x1b[38;5;81m',
|
|
3091
|
+
string: '\x1b[38;5;114m',
|
|
3092
|
+
string_url: '\x1b[38;5;75m',
|
|
3093
|
+
string_bool: '\x1b[38;5;204m',
|
|
3094
|
+
string_number: '\x1b[38;5;221m',
|
|
3095
|
+
number: '\x1b[38;5;221m',
|
|
3096
|
+
boolean: '\x1b[38;5;204m',
|
|
3097
|
+
null: '\x1b[38;5;241m',
|
|
3098
|
+
special: '\x1b[38;5;160m',
|
|
3099
|
+
func: '\x1b[38;5;102m',
|
|
3100
|
+
},
|
|
3101
|
+
};
|
|
3102
|
+
|
|
3103
|
+
/**
|
|
3104
|
+
* Constructs a new instance with an optional base preset or custom override.
|
|
3105
|
+
* @param {ColorsList} [defaultColors] - Optional override for the default color scheme.
|
|
3106
|
+
*/
|
|
3107
|
+
constructor(defaultColors = {}) {
|
|
3108
|
+
this.#colors = { ...ColorSafeStringify.#PRESETS.default, ...defaultColors };
|
|
3109
|
+
}
|
|
3110
|
+
|
|
3111
|
+
/**
|
|
3112
|
+
* Internal method to apply ANSI color codes to different parts of a JSON string.
|
|
3113
|
+
* @param {string} str - Raw JSON string to be colorized.
|
|
3114
|
+
* @param {ColorsList} colors - ANSI color mapping to be applied to each JSON element type.
|
|
3115
|
+
* @returns {string} Colorized JSON string.
|
|
3116
|
+
*/
|
|
3117
|
+
#colorizeJSON(str, colors) {
|
|
3118
|
+
/** @type {{ marker: string, key: string }[]} */
|
|
3119
|
+
const keyMatches = [];
|
|
3120
|
+
|
|
3121
|
+
// Colorize numeric values
|
|
3122
|
+
str = str.replace(
|
|
3123
|
+
/(?<!")\b(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)\b(?!")/g,
|
|
3124
|
+
`${colors.number}$1${colors.reset}`,
|
|
3125
|
+
);
|
|
3126
|
+
|
|
3127
|
+
// Replace keys with temporary markers for later colorization
|
|
3128
|
+
str = str.replace(/"([^"]+)":/g, (_, key) => {
|
|
3129
|
+
const marker = `___KEY${keyMatches.length}___`;
|
|
3130
|
+
keyMatches.push({ marker, key });
|
|
3131
|
+
return `${marker}:`; // Keep the colon for valid syntax
|
|
3132
|
+
});
|
|
3133
|
+
|
|
3134
|
+
// Replace strings and apply specific colors based on their content
|
|
3135
|
+
str = str.replace(/"(?:\\.|[^"\\])*?"/g, (match) => {
|
|
3136
|
+
const val = match.slice(1, -1); // Remove surrounding quotes
|
|
3137
|
+
|
|
3138
|
+
if (/^(https?|ftp):\/\/[^\s]+$/i.test(val)) {
|
|
3139
|
+
return `${colors.string_url}${match}${colors.reset}`;
|
|
3140
|
+
}
|
|
3141
|
+
|
|
3142
|
+
if (/^(true|false|null)$/.test(val)) {
|
|
3143
|
+
return `${colors.string_bool}${match}${colors.reset}`;
|
|
3144
|
+
}
|
|
3145
|
+
|
|
3146
|
+
if (/^-?\d+(\.\d+)?([eE][+-]?\d+)?$/.test(val)) {
|
|
3147
|
+
return `${colors.string_number}${match}${colors.reset}`;
|
|
3148
|
+
}
|
|
3149
|
+
|
|
3150
|
+
return `${colors.string}${match}${colors.reset}`;
|
|
3151
|
+
});
|
|
3152
|
+
|
|
3153
|
+
// Replace markers with colorized keys
|
|
3154
|
+
for (const { marker, key } of keyMatches) {
|
|
3155
|
+
const regex = new RegExp(marker, 'g');
|
|
3156
|
+
str = str.replace(regex, `${colors.key}"${key}"${colors.reset}`);
|
|
3157
|
+
}
|
|
3158
|
+
|
|
3159
|
+
// Colorize boolean values
|
|
3160
|
+
str = str.replace(/(?<!")\b(true|false)\b(?!")/g, `${colors.boolean}$1${colors.reset}`);
|
|
3161
|
+
|
|
3162
|
+
// Colorize null values
|
|
3163
|
+
str = str.replace(/(?<!")\bnull\b(?!")/g, `${colors.null}null${colors.reset}`);
|
|
3164
|
+
|
|
3165
|
+
// Highlight special placeholder values
|
|
3166
|
+
str = str.replace(/\[Circular\]/g, `${colors.special}[Circular]${colors.reset}`);
|
|
3167
|
+
str = str.replace(/\[undefined\]/g, `${colors.special}[undefined]${colors.reset}`);
|
|
3168
|
+
|
|
3169
|
+
// Colorize function string representations
|
|
3170
|
+
str = str.replace(/"function.*?[^\\]"/gs, `${colors.func}$&${colors.reset}`);
|
|
3171
|
+
return str;
|
|
3172
|
+
}
|
|
3173
|
+
|
|
3174
|
+
/**
|
|
3175
|
+
* Colorizes a JSON string using the active or optionally overridden color set.
|
|
3176
|
+
* @param {string} json - The JSON string to format.
|
|
3177
|
+
* @param {ColorsList} [customColors] - Optional temporary color override.
|
|
3178
|
+
* @returns {string}
|
|
3179
|
+
*/
|
|
3180
|
+
colorize(json, customColors = {}) {
|
|
3181
|
+
const colors = { ...this.#colors, ...customColors };
|
|
3182
|
+
return this.#colorizeJSON(json, colors);
|
|
3183
|
+
}
|
|
3184
|
+
|
|
3185
|
+
/**
|
|
3186
|
+
* Returns the currently active color scheme.
|
|
3187
|
+
* @returns {ColorsList}
|
|
3188
|
+
*/
|
|
3189
|
+
getColors() {
|
|
3190
|
+
return { ...this.#colors };
|
|
3191
|
+
}
|
|
3192
|
+
|
|
3193
|
+
/**
|
|
3194
|
+
* Updates the current color scheme with a partial override.
|
|
3195
|
+
* @param {Partial<ColorsList>} newColors
|
|
3196
|
+
*/
|
|
3197
|
+
updateColors(newColors) {
|
|
3198
|
+
Object.assign(this.#colors, newColors);
|
|
3199
|
+
}
|
|
3200
|
+
|
|
3201
|
+
/**
|
|
3202
|
+
* Resets the current color scheme to the default preset.
|
|
3203
|
+
*/
|
|
3204
|
+
resetColors() {
|
|
3205
|
+
this.#colors = { ...ColorSafeStringify.#PRESETS.default };
|
|
3206
|
+
}
|
|
3207
|
+
|
|
3208
|
+
/**
|
|
3209
|
+
* Loads a color preset by name.
|
|
3210
|
+
* @param {string} presetName - Name of the preset to load.
|
|
3211
|
+
* @throws Will throw if the preset doesn't exist.
|
|
3212
|
+
*/
|
|
3213
|
+
loadColorPreset(presetName) {
|
|
3214
|
+
const preset = ColorSafeStringify.#PRESETS[presetName];
|
|
3215
|
+
if (!preset) throw new Error(`Preset "${presetName}" not found.`);
|
|
3216
|
+
this.#colors = { ...preset };
|
|
3217
|
+
}
|
|
3218
|
+
|
|
3219
|
+
/**
|
|
3220
|
+
* Saves a new custom color preset.
|
|
3221
|
+
* @param {string} name - Name of the new preset.
|
|
3222
|
+
* @param {ColorsList} colors - ANSI color map to save.
|
|
3223
|
+
*/
|
|
3224
|
+
saveColorPreset(name, colors) {
|
|
3225
|
+
ColorSafeStringify.#PRESETS[name] = { ...colors };
|
|
3226
|
+
}
|
|
3227
|
+
|
|
3228
|
+
/**
|
|
3229
|
+
* Returns a list of all available color preset names.
|
|
3230
|
+
* @returns {string[]}
|
|
3231
|
+
*/
|
|
3232
|
+
getAvailablePresets() {
|
|
3233
|
+
return Object.keys(ColorSafeStringify.#PRESETS);
|
|
3234
|
+
}
|
|
3235
|
+
}
|
|
3236
|
+
|
|
3237
|
+
/* harmony default export */ const libs_ColorSafeStringify = (ColorSafeStringify);
|
|
3238
|
+
|
|
3034
3239
|
;// ./src/v1/libs/TinyPromiseQueue.mjs
|
|
3035
3240
|
/**
|
|
3036
3241
|
* A queue system for managing and executing asynchronous tasks sequentially, one at a time.
|
|
@@ -3289,6 +3494,7 @@ class TinyPromiseQueue {
|
|
|
3289
3494
|
|
|
3290
3495
|
|
|
3291
3496
|
|
|
3497
|
+
|
|
3292
3498
|
})();
|
|
3293
3499
|
|
|
3294
3500
|
window.TinyEssentials = __webpack_exports__;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see TinyEssentials.min.js.LICENSE.txt */
|
|
2
|
-
(()=>{var t={251:(t,e)=>{e.read=function(t,e,r,n,o){var i,s,u=8*o-n-1,a=(1<<u)-1,f=a>>1,h=-7,l=r?o-1:0,c=r?-1:1,p=t[e+l];for(l+=c,i=p&(1<<-h)-1,p>>=-h,h+=u;h>0;i=256*i+t[e+l],l+=c,h-=8);for(s=i&(1<<-h)-1,i>>=-h,h+=n;h>0;s=256*s+t[e+l],l+=c,h-=8);if(0===i)i=1-f;else{if(i===a)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),i-=f}return(p?-1:1)*s*Math.pow(2,i-n)},e.write=function(t,e,r,n,o,i){var s,u,a,f=8*i-o-1,h=(1<<f)-1,l=h>>1,c=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,y=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-s))<1&&(s--,a*=2),(e+=s+l>=1?c/a:c*Math.pow(2,1-l))*a>=2&&(s++,a/=2),s+l>=h?(u=0,s=h):s+l>=1?(u=(e*a-1)*Math.pow(2,o),s+=l):(u=e*Math.pow(2,l-1)*Math.pow(2,o),s=0));o>=8;t[r+p]=255&u,p+=y,u/=256,o-=8);for(s=s<<o|u,f+=o;f>0;t[r+p]=255&s,p+=y,s/=256,f-=8);t[r+p-y]|=128*g}},287:(t,e,r)=>{"use strict";var n=r(526),o=r(251),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.hp=a,e.IS=50;var s=2147483647;function u(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,a.prototype),e}function a(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return l(t)}return f(t,e,r)}function f(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!a.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|g(t,e),n=u(r),o=n.write(t,e);return o!==r&&(n=n.slice(0,o)),n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Q(t,Uint8Array)){var e=new Uint8Array(t);return p(e.buffer,e.byteOffset,e.byteLength)}return c(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Q(t,ArrayBuffer)||t&&Q(t.buffer,ArrayBuffer))return p(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(Q(t,SharedArrayBuffer)||t&&Q(t.buffer,SharedArrayBuffer)))return p(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return a.from(n,e,r);var o=function(t){if(a.isBuffer(t)){var e=0|y(t.length),r=u(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||_(t.length)?u(0):c(t):"Buffer"===t.type&&Array.isArray(t.data)?c(t.data):void 0}(t);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return a.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function l(t){return h(t),u(t<0?0:0|y(t))}function c(t){for(var e=t.length<0?0:0|y(t.length),r=u(e),n=0;n<e;n+=1)r[n]=255&t[n];return r}function p(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,a.prototype),n}function y(t){if(t>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function g(t,e){if(a.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Q(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return D(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return q(t).length;default:if(o)return n?-1:D(t).length;e=(""+e).toLowerCase(),o=!0}}function d(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return S(this,e,r);case"utf8":case"utf-8":return U(this,e,r);case"ascii":return L(this,e,r);case"latin1":case"binary":return O(this,e,r);case"base64":return B(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function m(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function w(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),_(r=+r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=a.from(e,n)),a.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,o){var i,s=1,u=t.length,a=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,u/=2,a/=2,r/=2}function f(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(o){var h=-1;for(i=r;i<u;i++)if(f(t,i)===f(e,-1===h?0:i-h)){if(-1===h&&(h=i),i-h+1===a)return h*s}else-1!==h&&(i-=i-h),h=-1}else for(r+a>u&&(r=u-a),i=r;i>=0;i--){for(var l=!0,c=0;c<a;c++)if(f(t,i+c)!==f(e,c)){l=!1;break}if(l)return i}return-1}function b(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=e.length;n>i/2&&(n=i/2);for(var s=0;s<n;++s){var u=parseInt(e.substr(2*s,2),16);if(_(u))return s;t[r+s]=u}return s}function E(t,e,r,n){return F(D(e,t.length-r),t,r,n)}function A(t,e,r,n){return F(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function T(t,e,r,n){return F(q(e),t,r,n)}function x(t,e,r,n){return F(function(t,e){for(var r,n,o,i=[],s=0;s<t.length&&!((e-=2)<0);++s)n=(r=t.charCodeAt(s))>>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function B(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function U(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var i,s,u,a,f=t[o],h=null,l=f>239?4:f>223?3:f>191?2:1;if(o+l<=r)switch(l){case 1:f<128&&(h=f);break;case 2:128==(192&(i=t[o+1]))&&(a=(31&f)<<6|63&i)>127&&(h=a);break;case 3:i=t[o+1],s=t[o+2],128==(192&i)&&128==(192&s)&&(a=(15&f)<<12|(63&i)<<6|63&s)>2047&&(a<55296||a>57343)&&(h=a);break;case 4:i=t[o+1],s=t[o+2],u=t[o+3],128==(192&i)&&128==(192&s)&&128==(192&u)&&(a=(15&f)<<18|(63&i)<<12|(63&s)<<6|63&u)>65535&&a<1114112&&(h=a)}null===h?(h=65533,l=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),o+=l}return function(t){var e=t.length;if(e<=M)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=M));return r}(n)}a.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),a.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(t,e,r){return f(t,e,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(t,e,r){return function(t,e,r){return h(t),t<=0?u(t):void 0!==e?"string"==typeof r?u(t).fill(e,r):u(t).fill(e):u(t)}(t,e,r)},a.allocUnsafe=function(t){return l(t)},a.allocUnsafeSlow=function(t){return l(t)},a.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==a.prototype},a.compare=function(t,e){if(Q(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),Q(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(t)||!a.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,n=e.length,o=0,i=Math.min(r,n);o<i;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0},a.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return a.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=a.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var i=t[r];if(Q(i,Uint8Array))o+i.length>n.length?a.from(i).copy(n,o):Uint8Array.prototype.set.call(n,i,o);else{if(!a.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,o)}o+=i.length}return n},a.byteLength=g,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)m(this,e,e+1);return this},a.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},a.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},a.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?U(this,0,t):d.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(t){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===a.compare(this,t)},a.prototype.inspect=function(){var t="",r=e.IS;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},i&&(a.prototype[i]=a.prototype.inspect),a.prototype.compare=function(t,e,r,n,o){if(Q(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0),u=Math.min(i,s),f=this.slice(n,o),h=t.slice(e,r),l=0;l<u;++l)if(f[l]!==h[l]){i=f[l],s=h[l];break}return i<s?-1:s<i?1:0},a.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},a.prototype.indexOf=function(t,e,r){return w(this,t,e,r,!0)},a.prototype.lastIndexOf=function(t,e,r){return w(this,t,e,r,!1)},a.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return b(this,t,e,r);case"utf8":case"utf-8":return E(this,t,e,r);case"ascii":case"latin1":case"binary":return A(this,t,e,r);case"base64":return T(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var M=4096;function L(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}function O(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function S(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=e;i<r;++i)o+=Y[t[i]];return o}function N(t,e,r){for(var n=t.slice(e,r),o="",i=0;i<n.length-1;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function I(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function k(t,e,r,n,o,i){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function P(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function C(t,e,r,n,i){return e=+e,r>>>=0,i||P(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function R(t,e,r,n,i){return e=+e,r>>>=0,i||P(t,0,r,8),o.write(t,e,r,n,52,8),r+8}a.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var n=this.subarray(t,e);return Object.setPrototypeOf(n,a.prototype),n},a.prototype.readUintLE=a.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||I(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n},a.prototype.readUintBE=a.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||I(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},a.prototype.readUint8=a.prototype.readUInt8=function(t,e){return t>>>=0,e||I(t,1,this.length),this[t]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(t,e){return t>>>=0,e||I(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(t,e){return t>>>=0,e||I(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(t,e){return t>>>=0,e||I(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(t,e){return t>>>=0,e||I(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||I(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*e)),n},a.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||I(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},a.prototype.readInt8=function(t,e){return t>>>=0,e||I(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},a.prototype.readInt16LE=function(t,e){t>>>=0,e||I(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(t,e){t>>>=0,e||I(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(t,e){return t>>>=0,e||I(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return t>>>=0,e||I(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readFloatLE=function(t,e){return t>>>=0,e||I(t,4,this.length),o.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return t>>>=0,e||I(t,4,this.length),o.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return t>>>=0,e||I(t,8,this.length),o.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return t>>>=0,e||I(t,8,this.length),o.read(this,t,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||k(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||k(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},a.prototype.writeUint8=a.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||k(this,t,e,1,255,0),this[e]=255&t,e+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||k(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||k(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||k(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||k(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);k(this,t,e,r,o-1,-o)}var i=0,s=1,u=0;for(this[e]=255&t;++i<r&&(s*=256);)t<0&&0===u&&0!==this[e+i-1]&&(u=1),this[e+i]=(t/s|0)-u&255;return e+r},a.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);k(this,t,e,r,o-1,-o)}var i=r-1,s=1,u=0;for(this[e+i]=255&t;--i>=0&&(s*=256);)t<0&&0===u&&0!==this[e+i+1]&&(u=1),this[e+i]=(t/s|0)-u&255;return e+r},a.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||k(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||k(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||k(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||k(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},a.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||k(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeFloatLE=function(t,e,r){return C(this,t,e,!0,r)},a.prototype.writeFloatBE=function(t,e,r){return C(this,t,e,!1,r)},a.prototype.writeDoubleLE=function(t,e,r){return R(this,t,e,!0,r)},a.prototype.writeDoubleBE=function(t,e,r){return R(this,t,e,!1,r)},a.prototype.copy=function(t,e,r,n){if(!a.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var o=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),o},a.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!a.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var o=t.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(t=o)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{var s=a.isBuffer(t)?t:a.from(t,n),u=s.length;if(0===u)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<r-e;++i)this[i+e]=s[i%u]}return this};var j=/[^+/0-9A-Za-z-_]/g;function D(t,e){var r;e=e||1/0;for(var n=t.length,o=null,i=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function q(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(j,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function F(t,e,r,n){for(var o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function Q(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function _(t){return t!=t}var Y=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=16*r,o=0;o<16;++o)e[n+o]=t[r]+t[o];return e}()},526:(t,e)=>{"use strict";e.byteLength=function(t){var e=u(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,i=u(t),s=i[0],a=i[1],f=new o(function(t,e,r){return 3*(e+r)/4-r}(0,s,a)),h=0,l=a>0?s-4:s;for(r=0;r<l;r+=4)e=n[t.charCodeAt(r)]<<18|n[t.charCodeAt(r+1)]<<12|n[t.charCodeAt(r+2)]<<6|n[t.charCodeAt(r+3)],f[h++]=e>>16&255,f[h++]=e>>8&255,f[h++]=255&e;return 2===a&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,f[h++]=255&e),1===a&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,f[h++]=e>>8&255,f[h++]=255&e),f},e.fromByteArray=function(t){for(var e,n=t.length,o=n%3,i=[],s=16383,u=0,f=n-o;u<f;u+=s)i.push(a(t,u,u+s>f?f:u+s));return 1===o?(e=t[n-1],i.push(r[e>>2]+r[e<<4&63]+"==")):2===o&&(e=(t[n-2]<<8)+t[n-1],i.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),i.join("")};for(var r=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)r[s]=i[s],n[i.charCodeAt(s)]=s;function u(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function a(t,e,n){for(var o,i,s=[],u=e;u<n;u+=3)o=(t[u]<<16&16711680)+(t[u+1]<<8&65280)+(255&t[u+2]),s.push(r[(i=o)>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};(()=>{"use strict";async function t(t,e,r){const n=[];t.replace(e,((t,...e)=>(n.push(r(t,...e)),t)));const o=await Promise.all(n);return t.replace(e,(()=>o.shift()))}r.r(n),r.d(n,{TinyLevelUp:()=>e,TinyPromiseQueue:()=>x,addAiMarkerShortcut:()=>T,asyncReplace:()=>t,checkObj:()=>d,cloneObjTypeOrder:()=>p,countObj:()=>m,extendObjType:()=>l,formatCustomTimer:()=>s,formatDayTimer:()=>a,formatTimer:()=>u,getAge:()=>b,getSimplePerc:()=>v,getTimeDuration:()=>i,objType:()=>g,reorderObjTypeOrder:()=>c,ruleOfThree:()=>w,shuffleArray:()=>o,toTitleCase:()=>E,toTitleCaseLowerFirst:()=>A});const e=class{constructor(t,e){this.giveExp=t,this.expLevel=e}expValidator(t){let e=0;const r=this.expLevel*t.level;return t.exp>=r&&(t.level++,e=t.exp-r,t.exp=0,e>0)?this.give(t,e,"extra"):t.exp<1&&t.level>1&&(t.level--,e=Math.abs(t.exp),t.exp=this.expLevel*t.level,e>0)?this.remove(t,e,"extra"):t}getTotalExp(t){let e=0;for(let r=1;r<=t.level;r++)e+=this.expLevel*r;return e+=t.exp,e}expGenerator(t=1){return Math.floor(Math.random()*this.giveExp)+1*t}progress(t){return this.expLevel*t.level}getProgress(t){return this.expLevel*t.level}set(t,e){return t.exp=e,this.expValidator(t),t.totalExp=this.getTotalExp(t),t}give(t,e=0,r="add",n=1){return"add"===r?t.exp+=this.expGenerator(n)+e:"extra"===r&&(t.exp+=e),this.expValidator(t),t.totalExp=this.getTotalExp(t),t}remove(t,e=0,r="add",n=1){return"add"===r?t.exp-=this.expGenerator(n)+e:"extra"===r&&(t.exp-=e),this.expValidator(t),t.totalExp=this.getTotalExp(t),t}};function o(t){let e,r=t.length;for(;0!==r;)e=Math.floor(Math.random()*r),r--,[t[r],t[e]]=[t[e],t[r]];return t}function i(t=new Date,e="asSeconds",r=null){if(t instanceof Date){const n=r instanceof Date?r:new Date,o=t.getTime()-n.getTime();switch(e){case"asMilliseconds":return o;case"asSeconds":default:return o/1e3;case"asMinutes":return o/6e4;case"asHours":return o/36e5;case"asDays":return o/864e5}}return null}function s(t,e="seconds",r="{time}"){t=Math.max(0,Math.floor(t));const n=["seconds","minutes","hours","days","months","years"].indexOf(e),o=n>=5,i=n>=4,s=n>=3,u=n>=2,a=n>=1,f=n>=0,h={years:o?0:NaN,months:i?0:NaN,days:s?0:NaN,hours:u?0:NaN,minutes:a?0:NaN,seconds:f?0:NaN,total:NaN};let l=t;if(o||i||s){const t=new Date(1980,0,1),e=new Date(t.getTime()+1e3*l),r=new Date(t);if(o)for(;new Date(r.getFullYear()+1,r.getMonth(),r.getDate()).getTime()<=e.getTime();)r.setFullYear(r.getFullYear()+1),h.years++;if(i)for(;new Date(r.getFullYear(),r.getMonth()+1,r.getDate()).getTime()<=e.getTime();)r.setMonth(r.getMonth()+1),h.months++;if(s)for(;new Date(r.getFullYear(),r.getMonth(),r.getDate()+1).getTime()<=e.getTime();)r.setDate(r.getDate()+1),h.days++;l=Math.floor((e.getTime()-r.getTime())/1e3)}u&&(h.hours=Math.floor(l/3600),l%=3600),a&&(h.minutes=Math.floor(l/60),l%=60),f&&(h.seconds=l);const c={seconds:f?t:NaN,minutes:a?t/60:NaN,hours:u?t/3600:NaN,days:s?t/86400:NaN,months:i?12*h.years+h.months+(h.days||0)/30:NaN,years:o?h.years+(h.months||0)/12+(h.days||0)/365:NaN};h.total=+(c[e]||0).toFixed(2).replace(/\.00$/,"");const p=t=>{const e="string"==typeof t?parseInt(t):t;return Number.isNaN(e)?"NaN":String(e).padStart(2,"0")},y=[u?p(h.hours):null,a?p(h.minutes):null,f?p(h.seconds):null].filter((t=>null!==t)).join(":");return r.replace(/\{years\}/g,String(h.years)).replace(/\{months\}/g,String(h.months)).replace(/\{days\}/g,String(h.days)).replace(/\{hours\}/g,p(h.hours)).replace(/\{minutes\}/g,p(h.minutes)).replace(/\{seconds\}/g,p(h.seconds)).replace(/\{time\}/g,y).replace(/\{total\}/g,String(h.total)).trim()}function u(t){return s(t,"hours","{hours}:{minutes}:{seconds}")}function a(t){return s(t,"days","{days}d {hours}:{minutes}:{seconds}")}var f=r(287);const h={items:{undefined:t=>void 0===t,null:t=>null===t,boolean:t=>"boolean"==typeof t,number:t=>"number"==typeof t&&!isNaN(t),bigint:t=>"bigint"==typeof t,string:t=>"string"==typeof t,symbol:t=>"symbol"==typeof t,function:t=>"function"==typeof t,array:t=>Array.isArray(t),date:t=>t instanceof Date,regexp:t=>t instanceof RegExp,map:t=>t instanceof Map,set:t=>t instanceof Set,weakmap:t=>t instanceof WeakMap,weakset:t=>t instanceof WeakSet,promise:t=>t instanceof Promise,buffer:t=>void 0!==f.hp&&f.hp.isBuffer(t),file:t=>"undefined"!=typeof File&&t instanceof File,htmlelement:t=>"undefined"!=typeof HTMLElement&&t instanceof HTMLElement,object:t=>"object"==typeof t&&null!==t},order:["undefined","null","boolean","number","bigint","string","symbol","function","array","buffer","file","date","regexp","map","set","weakmap","weakset","promise","htmlelement","object"]};function l(t,e){const r=[];for(const[n,o]of Object.entries(t))if(!h.items.hasOwnProperty(n)){h.items[n]=o;let t="number"==typeof e?e:-1;if(-1===t){const e=h.order.indexOf("object");t=e>-1?e:h.order.length}t=Math.min(Math.max(0,t),h.order.length),h.order.splice(t,0,n),r.push(n)}return r}function c(t){const e=[...h.order];return!!t.every((t=>e.includes(t)))&&(h.order=t.slice(),!0)}function p(){return[...h.order]}const y=t=>{if(null===t)return"null";for(const e of h.order)if("function"!=typeof h.items[e]||h.items[e](t))return e;return"unknown"};function g(t,e){if(void 0===t)return null;const r=y(t);return"string"==typeof e?r===e.toLowerCase():r}function d(t){const e={valid:null,type:null};for(const r of h.order)if("function"==typeof h.items[r]){const n=h.items[r](t);if(n){e.valid=n,e.type=r;break}}return e}function m(t){return Array.isArray(t)?t.length:g(t,"object")?Object.keys(t).length:0}function w(t,e,r,n=!1){return n?Number(t*e)/r:Number(r*e)/t}function v(t,e){return t*(e/100)}function b(t=0,e=null){if(null!=t&&0!==t){const r=new Date(t);if(Number.isNaN(r.getTime()))return null;const n=e instanceof Date?e:new Date;let o=n.getFullYear()-r.getFullYear();const i=n.getMonth(),s=r.getMonth(),u=n.getDate(),a=r.getDate();return(i<s||i===s&&u<a)&&o--,Math.abs(o)}return null}function E(t){return t.replace(/\w\S*/g,(t=>t.charAt(0).toUpperCase()+t.substr(1).toLowerCase()))}function A(t){const e=t.replace(/\w\S*/g,(t=>t.charAt(0).toUpperCase()+t.substr(1).toLowerCase()));return e.charAt(0).toLowerCase()+e.slice(1)}function T(t="a"){"undefined"!=typeof HTMLElement?document.addEventListener("keydown",(function(e){if(e.ctrlKey&&e.altKey&&e.key.toLowerCase()===t){if(e.preventDefault(),!document.body)return void console.warn("[AiMarkerShortcut] <body> element not found. Cannot toggle class. Ensure the DOM is fully loaded when using the shortcut.");document.body.classList.toggle("detect-made-by-ai")}})):console.error("[AiMarkerShortcut] Environment does not support the DOM. This function must be run in a browser.")}const x=class{#t=[];#e=!1;#r={};#n=new Set;isRunning(){return this.#e}async#o(t){if(t&&"function"==typeof t.task&&"function"==typeof t.resolve&&"function"==typeof t.reject){const{task:e,resolve:r,reject:n,delay:o,id:i}=t;try{if(i&&this.#n.has(i))return n(new Error("The function was canceled on TinyPromiseQueue.")),this.#n.delete(i),this.#e=!1,void this.#i();o&&i&&await new Promise((t=>{const e=setTimeout((()=>{delete this.#r[i],t(null)}),o);this.#r[i]=e})),r(await e())}catch(t){n(t)}finally{this.#e=!1,this.#i()}}}async#s(){const t=[];for(;this.#t.length&&"POINT_MARKER"===this.#t[0]?.marker;)t.push(this.#t.shift());if(0===t.length)return this.#e=!1,void this.#i();await Promise.all(t.map((({task:t,resolve:e,reject:r,id:n})=>new Promise((async o=>{if(n&&this.#n.has(n))return this.#n.delete(n),r(new Error("The function was canceled on TinyPromiseQueue.")),void o(!0);await t().then(e).catch(r),o(!0)}))))),this.#e=!1,this.#i()}async#i(){if(!this.#e&&0!==this.#t.length)if(this.#e=!0,"string"!=typeof this.#t[0]?.marker||"POINT_MARKER"!==this.#t[0]?.marker){const t=this.#t.shift();this.#o(t)}else this.#s()}getIndexById(t){return this.#t.findIndex((e=>e.id===t))}getQueuedIds(){return this.#t.map(((t,e)=>({index:e,id:t.id}))).filter((t=>"string"==typeof t.id))}reorderQueue(t,e){if("number"!=typeof t||"number"!=typeof e||t<0||e<0||t>=this.#t.length||e>=this.#t.length)return;const[r]=this.#t.splice(t,1);this.#t.splice(e,0,r)}async enqueuePoint(t,e){return this.#e?new Promise(((r,n)=>{this.#t.push({marker:"POINT_MARKER",task:t,resolve:r,reject:n,id:e}),this.#i()})):t()}enqueue(t,e,r){return new Promise(((n,o)=>{this.#t.push({task:t,resolve:n,reject:o,id:r,delay:e}),this.#i()}))}cancelTask(t){if(!t)return!1;let e=!1;t in this.#r&&(clearTimeout(this.#r[t]),delete this.#r[t],e=!0);const r=this.getIndexById(t);if(-1!==r){const[t]=this.#t.splice(r,1);t?.reject?.(new Error("The function was canceled on TinyPromiseQueue.")),e=!0}return e&&this.#n.add(t),e}}})(),window.TinyEssentials=n})();
|
|
2
|
+
(()=>{var e={251:(e,t)=>{t.read=function(e,t,r,n,o){var i,s,u=8*o-n-1,a=(1<<u)-1,f=a>>1,h=-7,l=r?o-1:0,c=r?-1:1,p=e[t+l];for(l+=c,i=p&(1<<-h)-1,p>>=-h,h+=u;h>0;i=256*i+e[t+l],l+=c,h-=8);for(s=i&(1<<-h)-1,i>>=-h,h+=n;h>0;s=256*s+e[t+l],l+=c,h-=8);if(0===i)i=1-f;else{if(i===a)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),i-=f}return(p?-1:1)*s*Math.pow(2,i-n)},t.write=function(e,t,r,n,o,i){var s,u,a,f=8*i-o-1,h=(1<<f)-1,l=h>>1,c=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,y=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,s=h):(s=Math.floor(Math.log(t)/Math.LN2),t*(a=Math.pow(2,-s))<1&&(s--,a*=2),(t+=s+l>=1?c/a:c*Math.pow(2,1-l))*a>=2&&(s++,a/=2),s+l>=h?(u=0,s=h):s+l>=1?(u=(t*a-1)*Math.pow(2,o),s+=l):(u=t*Math.pow(2,l-1)*Math.pow(2,o),s=0));o>=8;e[r+p]=255&u,p+=y,u/=256,o-=8);for(s=s<<o|u,f+=o;f>0;e[r+p]=255&s,p+=y,s/=256,f-=8);e[r+p-y]|=128*g}},287:(e,t,r)=>{"use strict";var n=r(526),o=r(251),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.hp=a,t.IS=50;var s=2147483647;function u(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return l(e)}return f(e,t,r)}function f(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!a.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|g(e,t),n=u(r),o=n.write(e,t);return o!==r&&(n=n.slice(0,o)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(q(e,Uint8Array)){var t=new Uint8Array(e);return p(t.buffer,t.byteOffset,t.byteLength)}return c(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(q(e,ArrayBuffer)||e&&q(e.buffer,ArrayBuffer))return p(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(q(e,SharedArrayBuffer)||e&&q(e.buffer,SharedArrayBuffer)))return p(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return a.from(n,t,r);var o=function(e){if(a.isBuffer(e)){var t=0|y(e.length),r=u(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||F(e.length)?u(0):c(e):"Buffer"===e.type&&Array.isArray(e.data)?c(e.data):void 0}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return a.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function h(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function l(e){return h(e),u(e<0?0:0|y(e))}function c(e){for(var t=e.length<0?0:0|y(e.length),r=u(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}function p(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,a.prototype),n}function y(e){if(e>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function g(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||q(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return $(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return D(e).length;default:if(o)return n?-1:$(e).length;t=(""+t).toLowerCase(),o=!0}}function d(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return k(this,t,r);case"utf8":case"utf-8":return S(this,t,r);case"ascii":return M(this,t,r);case"latin1":case"binary":return O(this,t,r);case"base64":return B(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function m(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function w(e,t,r,n,o){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),F(r=+r)&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof t&&(t=a.from(t,n)),a.isBuffer(t))return 0===t.length?-1:b(e,t,r,n,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):b(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function b(e,t,r,n,o){var i,s=1,u=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,u/=2,a/=2,r/=2}function f(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){var h=-1;for(i=r;i<u;i++)if(f(e,i)===f(t,-1===h?0:i-h)){if(-1===h&&(h=i),i-h+1===a)return h*s}else-1!==h&&(i-=i-h),h=-1}else for(r+a>u&&(r=u-a),i=r;i>=0;i--){for(var l=!0,c=0;c<a;c++)if(f(e,i+c)!==f(t,c)){l=!1;break}if(l)return i}return-1}function v(e,t,r,n){r=Number(r)||0;var o=e.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=t.length;n>i/2&&(n=i/2);for(var s=0;s<n;++s){var u=parseInt(t.substr(2*s,2),16);if(F(u))return s;e[r+s]=u}return s}function E(e,t,r,n){return _($(t,e.length-r),e,r,n)}function A(e,t,r,n){return _(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function T(e,t,r,n){return _(D(t),e,r,n)}function x(e,t,r,n){return _(function(e,t){for(var r,n,o,i=[],s=0;s<e.length&&!((t-=2)<0);++s)n=(r=e.charCodeAt(s))>>8,o=r%256,i.push(o),i.push(n);return i}(t,e.length-r),e,r,n)}function B(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function S(e,t,r){r=Math.min(e.length,r);for(var n=[],o=t;o<r;){var i,s,u,a,f=e[o],h=null,l=f>239?4:f>223?3:f>191?2:1;if(o+l<=r)switch(l){case 1:f<128&&(h=f);break;case 2:128==(192&(i=e[o+1]))&&(a=(31&f)<<6|63&i)>127&&(h=a);break;case 3:i=e[o+1],s=e[o+2],128==(192&i)&&128==(192&s)&&(a=(15&f)<<12|(63&i)<<6|63&s)>2047&&(a<55296||a>57343)&&(h=a);break;case 4:i=e[o+1],s=e[o+2],u=e[o+3],128==(192&i)&&128==(192&s)&&128==(192&u)&&(a=(15&f)<<18|(63&i)<<12|(63&s)<<6|63&u)>65535&&a<1114112&&(h=a)}null===h?(h=65533,l=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),o+=l}return function(e){var t=e.length;if(t<=U)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=U));return r}(n)}a.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),a.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(e,t,r){return f(e,t,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(e,t,r){return function(e,t,r){return h(e),e<=0?u(e):void 0!==t?"string"==typeof r?u(e).fill(t,r):u(e).fill(t):u(e)}(e,t,r)},a.allocUnsafe=function(e){return l(e)},a.allocUnsafeSlow=function(e){return l(e)},a.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==a.prototype},a.compare=function(e,t){if(q(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),q(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,o=0,i=Math.min(r,n);o<i;++o)if(e[o]!==t[o]){r=e[o],n=t[o];break}return r<n?-1:n<r?1:0},a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return a.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=a.allocUnsafe(t),o=0;for(r=0;r<e.length;++r){var i=e[r];if(q(i,Uint8Array))o+i.length>n.length?a.from(i).copy(n,o):Uint8Array.prototype.set.call(n,i,o);else{if(!a.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,o)}o+=i.length}return n},a.byteLength=g,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)m(this,t,t+1);return this},a.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},a.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},a.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?S(this,0,e):d.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===a.compare(this,e)},a.prototype.inspect=function(){var e="",r=t.IS;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},i&&(a.prototype[i]=a.prototype.inspect),a.prototype.compare=function(e,t,r,n,o){if(q(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),t<0||r>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=r)return 0;if(n>=o)return-1;if(t>=r)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),u=Math.min(i,s),f=this.slice(n,o),h=e.slice(t,r),l=0;l<u;++l)if(f[l]!==h[l]){i=f[l],s=h[l];break}return i<s?-1:s<i?1:0},a.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},a.prototype.indexOf=function(e,t,r){return w(this,e,t,r,!0)},a.prototype.lastIndexOf=function(e,t,r){return w(this,e,t,r,!1)},a.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-t;if((void 0===r||r>o)&&(r=o),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return v(this,e,t,r);case"utf8":case"utf-8":return E(this,e,t,r);case"ascii":case"latin1":case"binary":return A(this,e,t,r);case"base64":return T(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var U=4096;function M(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(127&e[o]);return n}function O(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(e[o]);return n}function k(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=t;i<r;++i)o+=Q[e[i]];return o}function L(e,t,r){for(var n=e.slice(t,r),o="",i=0;i<n.length-1;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function N(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,r,n,o,i){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function C(e,t,r,n,o,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function I(e,t,r,n,i){return t=+t,r>>>=0,i||C(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function R(e,t,r,n,i){return t=+t,r>>>=0,i||C(e,0,r,8),o.write(e,t,r,n,52,8),r+8}a.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return Object.setPrototypeOf(n,a.prototype),n},a.prototype.readUintLE=a.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||N(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n},a.prototype.readUintBE=a.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||N(e,t,this.length);for(var n=this[e+--t],o=1;t>0&&(o*=256);)n+=this[e+--t]*o;return n},a.prototype.readUint8=a.prototype.readUInt8=function(e,t){return e>>>=0,t||N(e,1,this.length),this[e]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||N(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||N(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||N(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||N(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||N(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*t)),n},a.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||N(e,t,this.length);for(var n=t,o=1,i=this[e+--n];n>0&&(o*=256);)i+=this[e+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},a.prototype.readInt8=function(e,t){return e>>>=0,t||N(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||N(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(e,t){e>>>=0,t||N(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||N(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||N(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return e>>>=0,t||N(e,4,this.length),o.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||N(e,4,this.length),o.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||N(e,8,this.length),o.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||N(e,8,this.length),o.read(this,e,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||P(this,e,t,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[t]=255&e;++i<r&&(o*=256);)this[t+i]=e/o&255;return t+r},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||P(this,e,t,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+r},a.prototype.writeUint8=a.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var o=Math.pow(2,8*r-1);P(this,e,t,r,o-1,-o)}var i=0,s=1,u=0;for(this[t]=255&e;++i<r&&(s*=256);)e<0&&0===u&&0!==this[t+i-1]&&(u=1),this[t+i]=(e/s|0)-u&255;return t+r},a.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var o=Math.pow(2,8*r-1);P(this,e,t,r,o-1,-o)}var i=r-1,s=1,u=0;for(this[t+i]=255&e;--i>=0&&(s*=256);)e<0&&0===u&&0!==this[t+i+1]&&(u=1),this[t+i]=(e/s|0)-u&255;return t+r},a.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeFloatLE=function(e,t,r){return I(this,e,t,!0,r)},a.prototype.writeFloatBE=function(e,t,r){return I(this,e,t,!1,r)},a.prototype.writeDoubleLE=function(e,t,r){return R(this,e,t,!0,r)},a.prototype.writeDoubleBE=function(e,t,r){return R(this,e,t,!1,r)},a.prototype.copy=function(e,t,r,n){if(!a.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var o=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),o},a.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!a.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var o=e.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(e=o)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{var s=a.isBuffer(e)?e:a.from(e,n),u=s.length;if(0===u)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=s[i%u]}return this};var j=/[^+/0-9A-Za-z-_]/g;function $(e,t){var r;t=t||1/0;for(var n=e.length,o=null,i=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function D(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(j,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function _(e,t,r,n){for(var o=0;o<n&&!(o+r>=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function q(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function F(e){return e!=e}var Q=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var n=16*r,o=0;o<16;++o)t[n+o]=e[r]+e[o];return t}()},526:(e,t)=>{"use strict";t.byteLength=function(e){var t=u(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,i=u(e),s=i[0],a=i[1],f=new o(function(e,t,r){return 3*(t+r)/4-r}(0,s,a)),h=0,l=a>0?s-4:s;for(r=0;r<l;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],f[h++]=t>>16&255,f[h++]=t>>8&255,f[h++]=255&t;return 2===a&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,f[h++]=255&t),1===a&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,f[h++]=t>>8&255,f[h++]=255&t),f},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],s=16383,u=0,f=n-o;u<f;u+=s)i.push(a(e,u,u+s>f?f:u+s));return 1===o?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),i.join("")};for(var r=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)r[s]=i[s],n[i.charCodeAt(s)]=s;function u(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function a(e,t,n){for(var o,i,s=[],u=t;u<n;u+=3)o=(e[u]<<16&16711680)+(e[u+1]<<8&65280)+(255&e[u+2]),s.push(r[(i=o)>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";async function e(e,t,r){const n=[];e.replace(t,((e,...t)=>(n.push(r(e,...t)),e)));const o=await Promise.all(n);return e.replace(t,(()=>o.shift()))}r.r(n),r.d(n,{ColorSafeStringify:()=>B,TinyLevelUp:()=>t,TinyPromiseQueue:()=>S,addAiMarkerShortcut:()=>T,asyncReplace:()=>e,checkObj:()=>d,cloneObjTypeOrder:()=>p,countObj:()=>m,extendObjType:()=>l,formatCustomTimer:()=>s,formatDayTimer:()=>a,formatTimer:()=>u,getAge:()=>v,getSimplePerc:()=>b,getTimeDuration:()=>i,objType:()=>g,reorderObjTypeOrder:()=>c,ruleOfThree:()=>w,shuffleArray:()=>o,toTitleCase:()=>E,toTitleCaseLowerFirst:()=>A});const t=class{constructor(e,t){this.giveExp=e,this.expLevel=t}expValidator(e){let t=0;const r=this.expLevel*e.level;return e.exp>=r&&(e.level++,t=e.exp-r,e.exp=0,t>0)?this.give(e,t,"extra"):e.exp<1&&e.level>1&&(e.level--,t=Math.abs(e.exp),e.exp=this.expLevel*e.level,t>0)?this.remove(e,t,"extra"):e}getTotalExp(e){let t=0;for(let r=1;r<=e.level;r++)t+=this.expLevel*r;return t+=e.exp,t}expGenerator(e=1){return Math.floor(Math.random()*this.giveExp)+1*e}progress(e){return this.expLevel*e.level}getProgress(e){return this.expLevel*e.level}set(e,t){return e.exp=t,this.expValidator(e),e.totalExp=this.getTotalExp(e),e}give(e,t=0,r="add",n=1){return"add"===r?e.exp+=this.expGenerator(n)+t:"extra"===r&&(e.exp+=t),this.expValidator(e),e.totalExp=this.getTotalExp(e),e}remove(e,t=0,r="add",n=1){return"add"===r?e.exp-=this.expGenerator(n)+t:"extra"===r&&(e.exp-=t),this.expValidator(e),e.totalExp=this.getTotalExp(e),e}};function o(e){let t,r=e.length;for(;0!==r;)t=Math.floor(Math.random()*r),r--,[e[r],e[t]]=[e[t],e[r]];return e}function i(e=new Date,t="asSeconds",r=null){if(e instanceof Date){const n=r instanceof Date?r:new Date,o=e.getTime()-n.getTime();switch(t){case"asMilliseconds":return o;case"asSeconds":default:return o/1e3;case"asMinutes":return o/6e4;case"asHours":return o/36e5;case"asDays":return o/864e5}}return null}function s(e,t="seconds",r="{time}"){e=Math.max(0,Math.floor(e));const n=["seconds","minutes","hours","days","months","years"].indexOf(t),o=n>=5,i=n>=4,s=n>=3,u=n>=2,a=n>=1,f=n>=0,h={years:o?0:NaN,months:i?0:NaN,days:s?0:NaN,hours:u?0:NaN,minutes:a?0:NaN,seconds:f?0:NaN,total:NaN};let l=e;if(o||i||s){const e=new Date(1980,0,1),t=new Date(e.getTime()+1e3*l),r=new Date(e);if(o)for(;new Date(r.getFullYear()+1,r.getMonth(),r.getDate()).getTime()<=t.getTime();)r.setFullYear(r.getFullYear()+1),h.years++;if(i)for(;new Date(r.getFullYear(),r.getMonth()+1,r.getDate()).getTime()<=t.getTime();)r.setMonth(r.getMonth()+1),h.months++;if(s)for(;new Date(r.getFullYear(),r.getMonth(),r.getDate()+1).getTime()<=t.getTime();)r.setDate(r.getDate()+1),h.days++;l=Math.floor((t.getTime()-r.getTime())/1e3)}u&&(h.hours=Math.floor(l/3600),l%=3600),a&&(h.minutes=Math.floor(l/60),l%=60),f&&(h.seconds=l);const c={seconds:f?e:NaN,minutes:a?e/60:NaN,hours:u?e/3600:NaN,days:s?e/86400:NaN,months:i?12*h.years+h.months+(h.days||0)/30:NaN,years:o?h.years+(h.months||0)/12+(h.days||0)/365:NaN};h.total=+(c[t]||0).toFixed(2).replace(/\.00$/,"");const p=e=>{const t="string"==typeof e?parseInt(e):e;return Number.isNaN(t)?"NaN":String(t).padStart(2,"0")},y=[u?p(h.hours):null,a?p(h.minutes):null,f?p(h.seconds):null].filter((e=>null!==e)).join(":");return r.replace(/\{years\}/g,String(h.years)).replace(/\{months\}/g,String(h.months)).replace(/\{days\}/g,String(h.days)).replace(/\{hours\}/g,p(h.hours)).replace(/\{minutes\}/g,p(h.minutes)).replace(/\{seconds\}/g,p(h.seconds)).replace(/\{time\}/g,y).replace(/\{total\}/g,String(h.total)).trim()}function u(e){return s(e,"hours","{hours}:{minutes}:{seconds}")}function a(e){return s(e,"days","{days}d {hours}:{minutes}:{seconds}")}var f=r(287);const h={items:{undefined:e=>void 0===e,null:e=>null===e,boolean:e=>"boolean"==typeof e,number:e=>"number"==typeof e&&!isNaN(e),bigint:e=>"bigint"==typeof e,string:e=>"string"==typeof e,symbol:e=>"symbol"==typeof e,function:e=>"function"==typeof e,array:e=>Array.isArray(e),date:e=>e instanceof Date,regexp:e=>e instanceof RegExp,map:e=>e instanceof Map,set:e=>e instanceof Set,weakmap:e=>e instanceof WeakMap,weakset:e=>e instanceof WeakSet,promise:e=>e instanceof Promise,buffer:e=>void 0!==f.hp&&f.hp.isBuffer(e),file:e=>"undefined"!=typeof File&&e instanceof File,htmlelement:e=>"undefined"!=typeof HTMLElement&&e instanceof HTMLElement,object:e=>"object"==typeof e&&null!==e&&!Array.isArray(e)},order:["undefined","null","boolean","number","bigint","string","symbol","function","array","buffer","file","date","regexp","map","set","weakmap","weakset","promise","htmlelement","object"]};function l(e,t){const r=[];for(const[n,o]of Object.entries(e))if(!h.items.hasOwnProperty(n)){h.items[n]=o;let e="number"==typeof t?t:-1;if(-1===e){const t=h.order.indexOf("object");e=t>-1?t:h.order.length}e=Math.min(Math.max(0,e),h.order.length),h.order.splice(e,0,n),r.push(n)}return r}function c(e){const t=[...h.order];return!!e.every((e=>t.includes(e)))&&(h.order=e.slice(),!0)}function p(){return[...h.order]}const y=e=>{if(null===e)return"null";for(const t of h.order)if("function"!=typeof h.items[t]||h.items[t](e))return t;return"unknown"};function g(e,t){if(void 0===e)return null;const r=y(e);return"string"==typeof t?r===t.toLowerCase():r}function d(e){const t={valid:null,type:null};for(const r of h.order)if("function"==typeof h.items[r]){const n=h.items[r](e);if(n){t.valid=n,t.type=r;break}}return t}function m(e){return Array.isArray(e)?e.length:g(e,"object")?Object.keys(e).length:0}function w(e,t,r,n=!1){return n?Number(e*t)/r:Number(r*t)/e}function b(e,t){return e*(t/100)}function v(e=0,t=null){if(null!=e&&0!==e){const r=new Date(e);if(Number.isNaN(r.getTime()))return null;const n=t instanceof Date?t:new Date;let o=n.getFullYear()-r.getFullYear();const i=n.getMonth(),s=r.getMonth(),u=n.getDate(),a=r.getDate();return(i<s||i===s&&u<a)&&o--,Math.abs(o)}return null}function E(e){return e.replace(/\w\S*/g,(e=>e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()))}function A(e){const t=e.replace(/\w\S*/g,(e=>e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()));return t.charAt(0).toLowerCase()+t.slice(1)}function T(e="a"){"undefined"!=typeof HTMLElement?document.addEventListener("keydown",(function(t){if(t.ctrlKey&&t.altKey&&t.key.toLowerCase()===e){if(t.preventDefault(),!document.body)return void console.warn("[AiMarkerShortcut] <body> element not found. Cannot toggle class. Ensure the DOM is fully loaded when using the shortcut.");document.body.classList.toggle("detect-made-by-ai")}})):console.error("[AiMarkerShortcut] Environment does not support the DOM. This function must be run in a browser.")}class x{#e;static#t={default:{reset:"[0m",key:"[36m",string:"[32m",string_url:"[34m",string_bool:"[35m",string_number:"[33m",number:"[33m",boolean:"[35m",null:"[1;30m",special:"[31m",func:"[90m"},solarized:{reset:"[0m",key:"[38;5;37m",string:"[38;5;136m",string_url:"[38;5;33m",string_bool:"[38;5;166m",string_number:"[38;5;136m",number:"[38;5;136m",boolean:"[38;5;166m",null:"[38;5;241m",special:"[38;5;160m",func:"[38;5;244m"},monokai:{reset:"[0m",key:"[38;5;81m",string:"[38;5;114m",string_url:"[38;5;75m",string_bool:"[38;5;204m",string_number:"[38;5;221m",number:"[38;5;221m",boolean:"[38;5;204m",null:"[38;5;241m",special:"[38;5;160m",func:"[38;5;102m"}};constructor(e={}){this.#e={...x.#t.default,...e}}#r(e,t){const r=[];e=(e=(e=e.replace(/(?<!")\b(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)\b(?!")/g,`${t.number}$1${t.reset}`)).replace(/"([^"]+)":/g,((e,t)=>{const n=`___KEY${r.length}___`;return r.push({marker:n,key:t}),`${n}:`}))).replace(/"(?:\\.|[^"\\])*?"/g,(e=>{const r=e.slice(1,-1);return/^(https?|ftp):\/\/[^\s]+$/i.test(r)?`${t.string_url}${e}${t.reset}`:/^(true|false|null)$/.test(r)?`${t.string_bool}${e}${t.reset}`:/^-?\d+(\.\d+)?([eE][+-]?\d+)?$/.test(r)?`${t.string_number}${e}${t.reset}`:`${t.string}${e}${t.reset}`}));for(const{marker:n,key:o}of r){const r=new RegExp(n,"g");e=e.replace(r,`${t.key}"${o}"${t.reset}`)}return(e=(e=(e=(e=e.replace(/(?<!")\b(true|false)\b(?!")/g,`${t.boolean}$1${t.reset}`)).replace(/(?<!")\bnull\b(?!")/g,`${t.null}null${t.reset}`)).replace(/\[Circular\]/g,`${t.special}[Circular]${t.reset}`)).replace(/\[undefined\]/g,`${t.special}[undefined]${t.reset}`)).replace(/"function.*?[^\\]"/gs,`${t.func}$&${t.reset}`)}colorize(e,t={}){const r={...this.#e,...t};return this.#r(e,r)}getColors(){return{...this.#e}}updateColors(e){Object.assign(this.#e,e)}resetColors(){this.#e={...x.#t.default}}loadColorPreset(e){const t=x.#t[e];if(!t)throw new Error(`Preset "${e}" not found.`);this.#e={...t}}saveColorPreset(e,t){x.#t[e]={...t}}getAvailablePresets(){return Object.keys(x.#t)}}const B=x,S=class{#n=[];#o=!1;#i={};#s=new Set;isRunning(){return this.#o}async#u(e){if(e&&"function"==typeof e.task&&"function"==typeof e.resolve&&"function"==typeof e.reject){const{task:t,resolve:r,reject:n,delay:o,id:i}=e;try{if(i&&this.#s.has(i))return n(new Error("The function was canceled on TinyPromiseQueue.")),this.#s.delete(i),this.#o=!1,void this.#a();o&&i&&await new Promise((e=>{const t=setTimeout((()=>{delete this.#i[i],e(null)}),o);this.#i[i]=t})),r(await t())}catch(e){n(e)}finally{this.#o=!1,this.#a()}}}async#f(){const e=[];for(;this.#n.length&&"POINT_MARKER"===this.#n[0]?.marker;)e.push(this.#n.shift());if(0===e.length)return this.#o=!1,void this.#a();await Promise.all(e.map((({task:e,resolve:t,reject:r,id:n})=>new Promise((async o=>{if(n&&this.#s.has(n))return this.#s.delete(n),r(new Error("The function was canceled on TinyPromiseQueue.")),void o(!0);await e().then(t).catch(r),o(!0)}))))),this.#o=!1,this.#a()}async#a(){if(!this.#o&&0!==this.#n.length)if(this.#o=!0,"string"!=typeof this.#n[0]?.marker||"POINT_MARKER"!==this.#n[0]?.marker){const e=this.#n.shift();this.#u(e)}else this.#f()}getIndexById(e){return this.#n.findIndex((t=>t.id===e))}getQueuedIds(){return this.#n.map(((e,t)=>({index:t,id:e.id}))).filter((e=>"string"==typeof e.id))}reorderQueue(e,t){if("number"!=typeof e||"number"!=typeof t||e<0||t<0||e>=this.#n.length||t>=this.#n.length)return;const[r]=this.#n.splice(e,1);this.#n.splice(t,0,r)}async enqueuePoint(e,t){return this.#o?new Promise(((r,n)=>{this.#n.push({marker:"POINT_MARKER",task:e,resolve:r,reject:n,id:t}),this.#a()})):e()}enqueue(e,t,r){return new Promise(((n,o)=>{this.#n.push({task:e,resolve:n,reject:o,id:r,delay:t}),this.#a()}))}cancelTask(e){if(!e)return!1;let t=!1;e in this.#i&&(clearTimeout(this.#i[e]),delete this.#i[e],t=!0);const r=this.getIndexById(e);if(-1!==r){const[e]=this.#n.splice(r,1);e?.reject?.(new Error("The function was canceled on TinyPromiseQueue.")),t=!0}return t&&this.#s.add(e),t}}})(),window.TinyEssentials=n})();
|
|
@@ -47,7 +47,7 @@ const typeValidator = {
|
|
|
47
47
|
/** @param {*} val @returns {val is Function} */
|
|
48
48
|
function: (val) => typeof val === 'function',
|
|
49
49
|
|
|
50
|
-
/** @param {*} val @returns {val is Array
|
|
50
|
+
/** @param {*} val @returns {val is Array} */
|
|
51
51
|
array: (val) => Array.isArray(val),
|
|
52
52
|
|
|
53
53
|
/** @param {*} val @returns {val is Date} */
|
|
@@ -56,19 +56,19 @@ const typeValidator = {
|
|
|
56
56
|
/** @param {*} val @returns {val is RegExp} */
|
|
57
57
|
regexp: (val) => val instanceof RegExp,
|
|
58
58
|
|
|
59
|
-
/** @param {*} val @returns {val is Map
|
|
59
|
+
/** @param {*} val @returns {val is Map} */
|
|
60
60
|
map: (val) => val instanceof Map,
|
|
61
61
|
|
|
62
|
-
/** @param {*} val @returns {val is Set
|
|
62
|
+
/** @param {*} val @returns {val is Set} */
|
|
63
63
|
set: (val) => val instanceof Set,
|
|
64
64
|
|
|
65
|
-
/** @param {*} val @returns {val is WeakMap
|
|
65
|
+
/** @param {*} val @returns {val is WeakMap} */
|
|
66
66
|
weakmap: (val) => val instanceof WeakMap,
|
|
67
67
|
|
|
68
|
-
/** @param {*} val @returns {val is WeakSet
|
|
68
|
+
/** @param {*} val @returns {val is WeakSet} */
|
|
69
69
|
weakset: (val) => val instanceof WeakSet,
|
|
70
70
|
|
|
71
|
-
/** @param {*} val @returns {val is Promise
|
|
71
|
+
/** @param {*} val @returns {val is Promise} */
|
|
72
72
|
promise: (val) => val instanceof Promise,
|
|
73
73
|
|
|
74
74
|
/** @param {*} val @returns {val is Buffer} */
|
|
@@ -81,7 +81,7 @@ const typeValidator = {
|
|
|
81
81
|
htmlelement: (val) => typeof HTMLElement !== 'undefined' && val instanceof HTMLElement,
|
|
82
82
|
|
|
83
83
|
/** @param {*} val @returns {val is object} */
|
|
84
|
-
object: (val) => typeof val === 'object' && val !== null,
|
|
84
|
+
object: (val) => typeof val === 'object' && val !== null && !Array.isArray(val),
|
|
85
85
|
},
|
|
86
86
|
|
|
87
87
|
/** Evaluation order of the type checkers. */
|
|
@@ -255,6 +255,14 @@ function checkObj(obj) {
|
|
|
255
255
|
return data;
|
|
256
256
|
}
|
|
257
257
|
|
|
258
|
+
/**
|
|
259
|
+
* Creates a clone of the functions from the `typeValidator` object.
|
|
260
|
+
* It returns a new object where the keys are the same and the values are the cloned functions.
|
|
261
|
+
*/
|
|
262
|
+
function getCheckObj() {
|
|
263
|
+
return Object.fromEntries(Object.entries(typeValidator.items).map(([key, fn]) => [key, fn]));
|
|
264
|
+
}
|
|
265
|
+
|
|
258
266
|
/**
|
|
259
267
|
* Counts the number of elements in an array or the number of properties in an object.
|
|
260
268
|
*
|
|
@@ -279,5 +287,6 @@ exports.checkObj = checkObj;
|
|
|
279
287
|
exports.cloneObjTypeOrder = cloneObjTypeOrder;
|
|
280
288
|
exports.countObj = countObj;
|
|
281
289
|
exports.extendObjType = extendObjType;
|
|
290
|
+
exports.getCheckObj = getCheckObj;
|
|
282
291
|
exports.objType = objType;
|
|
283
292
|
exports.reorderObjTypeOrder = reorderObjTypeOrder;
|
|
@@ -62,6 +62,13 @@ export function checkObj(obj: any): {
|
|
|
62
62
|
valid: any;
|
|
63
63
|
type: string | null;
|
|
64
64
|
};
|
|
65
|
+
/**
|
|
66
|
+
* Creates a clone of the functions from the `typeValidator` object.
|
|
67
|
+
* It returns a new object where the keys are the same and the values are the cloned functions.
|
|
68
|
+
*/
|
|
69
|
+
export function getCheckObj(): {
|
|
70
|
+
[k: string]: (val: any) => boolean;
|
|
71
|
+
};
|
|
65
72
|
/**
|
|
66
73
|
* Counts the number of elements in an array or the number of properties in an object.
|
|
67
74
|
*
|
|
@@ -35,21 +35,21 @@ const typeValidator = {
|
|
|
35
35
|
symbol: (val) => typeof val === 'symbol',
|
|
36
36
|
/** @param {*} val @returns {val is Function} */
|
|
37
37
|
function: (val) => typeof val === 'function',
|
|
38
|
-
/** @param {*} val @returns {val is Array
|
|
38
|
+
/** @param {*} val @returns {val is Array} */
|
|
39
39
|
array: (val) => Array.isArray(val),
|
|
40
40
|
/** @param {*} val @returns {val is Date} */
|
|
41
41
|
date: (val) => val instanceof Date,
|
|
42
42
|
/** @param {*} val @returns {val is RegExp} */
|
|
43
43
|
regexp: (val) => val instanceof RegExp,
|
|
44
|
-
/** @param {*} val @returns {val is Map
|
|
44
|
+
/** @param {*} val @returns {val is Map} */
|
|
45
45
|
map: (val) => val instanceof Map,
|
|
46
|
-
/** @param {*} val @returns {val is Set
|
|
46
|
+
/** @param {*} val @returns {val is Set} */
|
|
47
47
|
set: (val) => val instanceof Set,
|
|
48
|
-
/** @param {*} val @returns {val is WeakMap
|
|
48
|
+
/** @param {*} val @returns {val is WeakMap} */
|
|
49
49
|
weakmap: (val) => val instanceof WeakMap,
|
|
50
|
-
/** @param {*} val @returns {val is WeakSet
|
|
50
|
+
/** @param {*} val @returns {val is WeakSet} */
|
|
51
51
|
weakset: (val) => val instanceof WeakSet,
|
|
52
|
-
/** @param {*} val @returns {val is Promise
|
|
52
|
+
/** @param {*} val @returns {val is Promise} */
|
|
53
53
|
promise: (val) => val instanceof Promise,
|
|
54
54
|
/** @param {*} val @returns {val is Buffer} */
|
|
55
55
|
buffer: (val) => typeof Buffer !== 'undefined' && Buffer.isBuffer(val),
|
|
@@ -58,7 +58,7 @@ const typeValidator = {
|
|
|
58
58
|
/** @param {*} val @returns {val is HTMLElement} */
|
|
59
59
|
htmlelement: (val) => typeof HTMLElement !== 'undefined' && val instanceof HTMLElement,
|
|
60
60
|
/** @param {*} val @returns {val is object} */
|
|
61
|
-
object: (val) => typeof val === 'object' && val !== null,
|
|
61
|
+
object: (val) => typeof val === 'object' && val !== null && !Array.isArray(val),
|
|
62
62
|
},
|
|
63
63
|
/** Evaluation order of the type checkers. */
|
|
64
64
|
order: [
|
|
@@ -219,6 +219,13 @@ export function checkObj(obj) {
|
|
|
219
219
|
}
|
|
220
220
|
return data;
|
|
221
221
|
}
|
|
222
|
+
/**
|
|
223
|
+
* Creates a clone of the functions from the `typeValidator` object.
|
|
224
|
+
* It returns a new object where the keys are the same and the values are the cloned functions.
|
|
225
|
+
*/
|
|
226
|
+
export function getCheckObj() {
|
|
227
|
+
return Object.fromEntries(Object.entries(typeValidator.items).map(([key, fn]) => [key, fn]));
|
|
228
|
+
}
|
|
222
229
|
/**
|
|
223
230
|
* Counts the number of elements in an array or the number of properties in an object.
|
|
224
231
|
*
|
package/dist/v1/index.cjs
CHANGED
|
@@ -7,6 +7,7 @@ var clock = require('./basics/clock.cjs');
|
|
|
7
7
|
var objFilter = require('./basics/objFilter.cjs');
|
|
8
8
|
var simpleMath = require('./basics/simpleMath.cjs');
|
|
9
9
|
var text = require('./basics/text.cjs');
|
|
10
|
+
var ColorSafeStringify = require('./libs/ColorSafeStringify.cjs');
|
|
10
11
|
var TinyPromiseQueue = require('./libs/TinyPromiseQueue.cjs');
|
|
11
12
|
|
|
12
13
|
|
|
@@ -30,4 +31,5 @@ exports.ruleOfThree = simpleMath.ruleOfThree;
|
|
|
30
31
|
exports.addAiMarkerShortcut = text.addAiMarkerShortcut;
|
|
31
32
|
exports.toTitleCase = text.toTitleCase;
|
|
32
33
|
exports.toTitleCaseLowerFirst = text.toTitleCaseLowerFirst;
|
|
34
|
+
exports.ColorSafeStringify = ColorSafeStringify;
|
|
33
35
|
exports.TinyPromiseQueue = TinyPromiseQueue;
|
package/dist/v1/index.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import ColorSafeStringify from './libs/ColorSafeStringify.mjs';
|
|
1
2
|
import TinyPromiseQueue from './libs/TinyPromiseQueue.mjs';
|
|
2
3
|
import TinyLevelUp from '../legacy/libs/userLevel.mjs';
|
|
3
4
|
import { addAiMarkerShortcut } from './basics/text.mjs';
|
|
@@ -18,5 +19,5 @@ import { getTimeDuration } from './basics/clock.mjs';
|
|
|
18
19
|
import { shuffleArray } from './basics/array.mjs';
|
|
19
20
|
import { toTitleCase } from './basics/text.mjs';
|
|
20
21
|
import { toTitleCaseLowerFirst } from './basics/text.mjs';
|
|
21
|
-
export { TinyPromiseQueue, TinyLevelUp, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, checkObj, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst };
|
|
22
|
+
export { ColorSafeStringify, TinyPromiseQueue, TinyLevelUp, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, checkObj, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst };
|
|
22
23
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/v1/index.mjs
CHANGED
|
@@ -5,5 +5,6 @@ import { formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, } from
|
|
|
5
5
|
import { countObj, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, objType, checkObj, } from './basics/objFilter.mjs';
|
|
6
6
|
import { getAge, getSimplePerc, ruleOfThree } from './basics/simpleMath.mjs';
|
|
7
7
|
import { addAiMarkerShortcut, toTitleCase, toTitleCaseLowerFirst } from './basics/text.mjs';
|
|
8
|
+
import ColorSafeStringify from './libs/ColorSafeStringify.mjs';
|
|
8
9
|
import TinyPromiseQueue from './libs/TinyPromiseQueue.mjs';
|
|
9
|
-
export { TinyPromiseQueue, TinyLevelUp, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, checkObj, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst, };
|
|
10
|
+
export { ColorSafeStringify, TinyPromiseQueue, TinyLevelUp, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, checkObj, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst, };
|