tiny-essentials 1.3.1 → 1.4.0
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/TinyBasicsEs.js +48 -25
- package/dist/TinyBasicsEs.min.js +1 -1
- package/dist/TinyEssentials.js +56 -32
- package/dist/TinyEssentials.min.js +1 -1
- package/dist/TinyLevelUp.js +7 -7
- package/dist/legacy/libs/userLevel.cjs +7 -7
- package/dist/legacy/libs/userLevel.d.mts +7 -7
- package/dist/legacy/libs/userLevel.mjs +7 -7
- package/dist/v1/basics/clock.cjs +1 -1
- package/dist/v1/basics/clock.d.mts +1 -1
- package/dist/v1/basics/clock.mjs +1 -1
- package/dist/v1/basics/objFilter.cjs +46 -22
- package/dist/v1/basics/objFilter.d.mts +12 -2
- package/dist/v1/basics/objFilter.mjs +43 -22
- package/dist/v1/basics/simpleMath.cjs +2 -2
- package/dist/v1/basics/simpleMath.d.mts +2 -2
- package/dist/v1/basics/simpleMath.mjs +2 -2
- package/dist/v1/index.cjs +1 -0
- package/dist/v1/index.d.mts +2 -1
- package/dist/v1/index.mjs +2 -2
- package/docs/basics/objFilter.md +33 -0
- package/package.json +1 -1
package/dist/TinyBasicsEs.js
CHANGED
|
@@ -2261,7 +2261,7 @@ function getTimeDuration(timeData = new Date(), durationType = 'asSeconds', now
|
|
|
2261
2261
|
* Includes proper reallocation of lower units into higher ones, ensuring consistent hierarchy.
|
|
2262
2262
|
*
|
|
2263
2263
|
* @param {number} totalSeconds - The total amount of seconds to convert.
|
|
2264
|
-
* @param {'seconds'|'minutes'|'hours'|'days'|'months'|'years'} level - The highest level to calculate and display.
|
|
2264
|
+
* @param {'seconds'|'minutes'|'hours'|'days'|'months'|'years'} [level] - The highest level to calculate and display.
|
|
2265
2265
|
* @param {string} [format='{time}'] - Output template with placeholders like {years}, {months}, {days}, {hours}, {minutes}, {seconds}, {time}, {total}.
|
|
2266
2266
|
* @returns {string} The formatted timer string.
|
|
2267
2267
|
*/
|
|
@@ -2460,64 +2460,64 @@ var buffer = __webpack_require__(287);
|
|
|
2460
2460
|
*/
|
|
2461
2461
|
const typeValidator = {
|
|
2462
2462
|
items: {
|
|
2463
|
-
/**
|
|
2463
|
+
/** @param {*} val @returns {val is undefined} */
|
|
2464
2464
|
undefined: (val) => typeof val === 'undefined',
|
|
2465
2465
|
|
|
2466
|
-
/**
|
|
2466
|
+
/** @param {*} val @returns {val is null} */
|
|
2467
2467
|
null: (val) => val === null,
|
|
2468
2468
|
|
|
2469
|
-
/**
|
|
2469
|
+
/** @param {*} val @returns {val is boolean} */
|
|
2470
2470
|
boolean: (val) => typeof val === 'boolean',
|
|
2471
2471
|
|
|
2472
|
-
/**
|
|
2472
|
+
/** @param {*} val @returns {val is number} */
|
|
2473
2473
|
number: (val) => typeof val === 'number' && !isNaN(val),
|
|
2474
2474
|
|
|
2475
|
-
/**
|
|
2475
|
+
/** @param {*} val @returns {val is bigint} */
|
|
2476
2476
|
bigint: (val) => typeof val === 'bigint',
|
|
2477
2477
|
|
|
2478
|
-
/**
|
|
2478
|
+
/** @param {*} val @returns {val is string} */
|
|
2479
2479
|
string: (val) => typeof val === 'string',
|
|
2480
2480
|
|
|
2481
|
-
/**
|
|
2481
|
+
/** @param {*} val @returns {val is symbol} */
|
|
2482
2482
|
symbol: (val) => typeof val === 'symbol',
|
|
2483
2483
|
|
|
2484
|
-
/**
|
|
2484
|
+
/** @param {*} val @returns {val is Function} */
|
|
2485
2485
|
function: (val) => typeof val === 'function',
|
|
2486
2486
|
|
|
2487
|
-
/**
|
|
2487
|
+
/** @param {*} val @returns {val is Array<any>} */
|
|
2488
2488
|
array: (val) => Array.isArray(val),
|
|
2489
2489
|
|
|
2490
|
-
/**
|
|
2490
|
+
/** @param {*} val @returns {val is Date} */
|
|
2491
2491
|
date: (val) => val instanceof Date,
|
|
2492
2492
|
|
|
2493
|
-
/**
|
|
2493
|
+
/** @param {*} val @returns {val is RegExp} */
|
|
2494
2494
|
regexp: (val) => val instanceof RegExp,
|
|
2495
2495
|
|
|
2496
|
-
/**
|
|
2496
|
+
/** @param {*} val @returns {val is Map<any, any>} */
|
|
2497
2497
|
map: (val) => val instanceof Map,
|
|
2498
2498
|
|
|
2499
|
-
/**
|
|
2499
|
+
/** @param {*} val @returns {val is Set<any>} */
|
|
2500
2500
|
set: (val) => val instanceof Set,
|
|
2501
2501
|
|
|
2502
|
-
/**
|
|
2502
|
+
/** @param {*} val @returns {val is WeakMap<object, any>} */
|
|
2503
2503
|
weakmap: (val) => val instanceof WeakMap,
|
|
2504
2504
|
|
|
2505
|
-
/**
|
|
2505
|
+
/** @param {*} val @returns {val is WeakSet<object>} */
|
|
2506
2506
|
weakset: (val) => val instanceof WeakSet,
|
|
2507
2507
|
|
|
2508
|
-
/**
|
|
2508
|
+
/** @param {*} val @returns {val is Promise<any>} */
|
|
2509
2509
|
promise: (val) => val instanceof Promise,
|
|
2510
2510
|
|
|
2511
|
-
/**
|
|
2511
|
+
/** @param {*} val @returns {val is Buffer} */
|
|
2512
2512
|
buffer: (val) => typeof buffer/* Buffer */.hp !== 'undefined' && buffer/* Buffer */.hp.isBuffer(val),
|
|
2513
2513
|
|
|
2514
|
-
/**
|
|
2514
|
+
/** @param {*} val @returns {val is File} */
|
|
2515
2515
|
file: (val) => typeof File !== 'undefined' && val instanceof File,
|
|
2516
2516
|
|
|
2517
|
-
/**
|
|
2517
|
+
/** @param {*} val @returns {val is HTMLElement} */
|
|
2518
2518
|
htmlelement: (val) => typeof HTMLElement !== 'undefined' && val instanceof HTMLElement,
|
|
2519
2519
|
|
|
2520
|
-
/**
|
|
2520
|
+
/** @param {*} val @returns {val is object} */
|
|
2521
2521
|
object: (val) => typeof val === 'object' && val !== null,
|
|
2522
2522
|
},
|
|
2523
2523
|
|
|
@@ -2644,7 +2644,8 @@ function cloneObjTypeOrder() {
|
|
|
2644
2644
|
const getType = (val) => {
|
|
2645
2645
|
if (val === null) return 'null';
|
|
2646
2646
|
for (const name of typeValidator.order)
|
|
2647
|
-
if (
|
|
2647
|
+
if (typeof typeValidator.items[name] !== 'function' || typeValidator.items[name](val))
|
|
2648
|
+
return name;
|
|
2648
2649
|
return 'unknown';
|
|
2649
2650
|
};
|
|
2650
2651
|
|
|
@@ -2669,10 +2670,32 @@ function objType(obj, type) {
|
|
|
2669
2670
|
return result;
|
|
2670
2671
|
}
|
|
2671
2672
|
|
|
2673
|
+
/**
|
|
2674
|
+
* Checks the type of a given object and returns the validation value if a known type is detected.
|
|
2675
|
+
*
|
|
2676
|
+
* @param {*} obj - The object to check or identify.
|
|
2677
|
+
* @returns {{ valid:*; type: string | null }} - Returns the type result.
|
|
2678
|
+
*/
|
|
2679
|
+
function checkObj(obj) {
|
|
2680
|
+
/** @type {{ valid:*; type: string | null }} */
|
|
2681
|
+
const data = { valid: null, type: null };
|
|
2682
|
+
for (const name of typeValidator.order) {
|
|
2683
|
+
if (typeof typeValidator.items[name] === 'function') {
|
|
2684
|
+
const result = typeValidator.items[name](obj);
|
|
2685
|
+
if (result) {
|
|
2686
|
+
data.valid = result;
|
|
2687
|
+
data.type = name;
|
|
2688
|
+
break;
|
|
2689
|
+
}
|
|
2690
|
+
}
|
|
2691
|
+
}
|
|
2692
|
+
return data;
|
|
2693
|
+
}
|
|
2694
|
+
|
|
2672
2695
|
/**
|
|
2673
2696
|
* Counts the number of elements in an array or the number of properties in an object.
|
|
2674
2697
|
*
|
|
2675
|
-
* @param {
|
|
2698
|
+
* @param {Array<*>|Record<string|number, any>} obj - The array or object to count.
|
|
2676
2699
|
* @returns {number} - The count of items (array elements or object keys), or `0` if the input is neither an array nor an object.
|
|
2677
2700
|
*
|
|
2678
2701
|
* @example
|
|
@@ -2696,7 +2719,7 @@ function countObj(obj) {
|
|
|
2696
2719
|
* @param {number} val1 - The first reference value (numerator in direct proportion, denominator in inverse).
|
|
2697
2720
|
* @param {number} val2 - The second reference value (denominator in direct proportion, numerator in inverse).
|
|
2698
2721
|
* @param {number} val3 - The third value (numerator in direct proportion, denominator in inverse).
|
|
2699
|
-
* @param {boolean} inverse - Whether the calculation should use inverse proportion (true for inverse, false for direct).
|
|
2722
|
+
* @param {boolean} [inverse] - Whether the calculation should use inverse proportion (true for inverse, false for direct).
|
|
2700
2723
|
* @returns {number} The result of the Rule of Three operation.
|
|
2701
2724
|
*
|
|
2702
2725
|
* Rule of Three Formula (Direct Proportion):
|
|
@@ -2725,7 +2748,7 @@ function countObj(obj) {
|
|
|
2725
2748
|
* // Inverse proportion:
|
|
2726
2749
|
* ruleOfThree.execute(2, 6, 3, true); // → 4
|
|
2727
2750
|
*/
|
|
2728
|
-
function ruleOfThree(val1, val2, val3, inverse) {
|
|
2751
|
+
function ruleOfThree(val1, val2, val3, inverse = false) {
|
|
2729
2752
|
return inverse ? Number(val1 * val2) / val3 : Number(val3 * val2) / val1;
|
|
2730
2753
|
}
|
|
2731
2754
|
|
package/dist/TinyBasicsEs.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see TinyBasicsEs.min.js.LICENSE.txt */
|
|
2
|
-
(()=>{var t={251:(t,e)=>{e.read=function(t,e,r,n,o){var i,f,s=8*o-n-1,u=(1<<s)-1,a=u>>1,h=-7,c=r?o-1:0,l=r?-1:1,p=t[e+c];for(c+=l,i=p&(1<<-h)-1,p>>=-h,h+=s;h>0;i=256*i+t[e+c],c+=l,h-=8);for(f=i&(1<<-h)-1,i>>=-h,h+=n;h>0;f=256*f+t[e+c],c+=l,h-=8);if(0===i)i=1-a;else{if(i===u)return f?NaN:1/0*(p?-1:1);f+=Math.pow(2,n),i-=a}return(p?-1:1)*f*Math.pow(2,i-n)},e.write=function(t,e,r,n,o,i){var f,s,u,a=8*i-o-1,h=(1<<a)-1,c=h>>1,l=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?(s=isNaN(e)?1:0,f=h):(f=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-f))<1&&(f--,u*=2),(e+=f+c>=1?l/u:l*Math.pow(2,1-c))*u>=2&&(f++,u/=2),f+c>=h?(s=0,f=h):f+c>=1?(s=(e*u-1)*Math.pow(2,o),f+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,o),f=0));o>=8;t[r+p]=255&s,p+=y,s/=256,o-=8);for(f=f<<o|s,a+=o;a>0;t[r+p]=255&f,p+=y,f/=256,a-=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=u,e.IS=50;var f=2147483647;function s(t){if(t>f)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(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 c(t)}return a(t,e,r)}function a(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|g(t,e),n=s(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(_(t,Uint8Array)){var e=new Uint8Array(t);return p(e.buffer,e.byteOffset,e.byteLength)}return l(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(_(t,ArrayBuffer)||t&&_(t.buffer,ArrayBuffer))return p(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(_(t,SharedArrayBuffer)||t&&_(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 u.from(n,e,r);var o=function(t){if(u.isBuffer(t)){var e=0|y(t.length),r=s(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||z(t.length)?s(0):l(t):"Buffer"===t.type&&Array.isArray(t.data)?l(t.data):void 0}(t);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.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 c(t){return h(t),s(t<0?0:0|y(t))}function l(t){for(var e=t.length<0?0:0|y(t.length),r=s(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,u.prototype),n}function y(t){if(t>=f)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+f.toString(16)+" bytes");return 0|t}function g(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||_(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 k(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return F(t).length;default:if(o)return n?-1:k(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 L(this,e,r);case"utf8":case"utf-8":return O(this,e,r);case"ascii":return M(this,e,r);case"latin1":case"binary":return N(this,e,r);case"base64":return T(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function w(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function m(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),z(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=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:b(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):b(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function b(t,e,r,n,o){var i,f=1,s=t.length,u=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;f=2,s/=2,u/=2,r/=2}function a(t,e){return 1===f?t[e]:t.readUInt16BE(e*f)}if(o){var h=-1;for(i=r;i<s;i++)if(a(t,i)===a(e,-1===h?0:i-h)){if(-1===h&&(h=i),i-h+1===u)return h*f}else-1!==h&&(i-=i-h),h=-1}else for(r+u>s&&(r=s-u),i=r;i>=0;i--){for(var c=!0,l=0;l<u;l++)if(a(t,i+l)!==a(e,l)){c=!1;break}if(c)return i}return-1}function v(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 f=0;f<n;++f){var s=parseInt(e.substr(2*f,2),16);if(z(s))return f;t[r+f]=s}return f}function E(t,e,r,n){return Y(k(e,t.length-r),t,r,n)}function A(t,e,r,n){return Y(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function B(t,e,r,n){return Y(F(e),t,r,n)}function U(t,e,r,n){return Y(function(t,e){for(var r,n,o,i=[],f=0;f<t.length&&!((e-=2)<0);++f)n=(r=t.charCodeAt(f))>>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function T(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function O(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var i,f,s,u,a=t[o],h=null,c=a>239?4:a>223?3:a>191?2:1;if(o+c<=r)switch(c){case 1:a<128&&(h=a);break;case 2:128==(192&(i=t[o+1]))&&(u=(31&a)<<6|63&i)>127&&(h=u);break;case 3:i=t[o+1],f=t[o+2],128==(192&i)&&128==(192&f)&&(u=(15&a)<<12|(63&i)<<6|63&f)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:i=t[o+1],f=t[o+2],s=t[o+3],128==(192&i)&&128==(192&f)&&128==(192&s)&&(u=(15&a)<<18|(63&i)<<12|(63&f)<<6|63&s)>65535&&u<1114112&&(h=u)}null===h?(h=65533,c=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),o+=c}return function(t){var e=t.length;if(e<=S)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=S));return r}(n)}u.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}}(),u.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(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(t,e,r){return a(t,e,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(t,e,r){return function(t,e,r){return h(t),t<=0?s(t):void 0!==e?"string"==typeof r?s(t).fill(e,r):s(t).fill(e):s(t)}(t,e,r)},u.allocUnsafe=function(t){return c(t)},u.allocUnsafeSlow=function(t){return c(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(_(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),_(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(t)||!u.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},u.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}},u.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=u.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var i=t[r];if(_(i,Uint8Array))o+i.length>n.length?u.from(i).copy(n,o):Uint8Array.prototype.set.call(n,i,o);else{if(!u.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,o)}o+=i.length}return n},u.byteLength=g,u.prototype._isBuffer=!0,u.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)w(this,e,e+1);return this},u.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)w(this,e,e+3),w(this,e+1,e+2);return this},u.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)w(this,e,e+7),w(this,e+1,e+6),w(this,e+2,e+5),w(this,e+3,e+4);return this},u.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?O(this,0,t):d.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.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&&(u.prototype[i]=u.prototype.inspect),u.prototype.compare=function(t,e,r,n,o){if(_(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.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),f=(r>>>=0)-(e>>>=0),s=Math.min(i,f),a=this.slice(n,o),h=t.slice(e,r),c=0;c<s;++c)if(a[c]!==h[c]){i=a[c],f=h[c];break}return i<f?-1:f<i?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return m(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return m(this,t,e,r,!1)},u.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 v(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 B(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var S=4096;function M(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 N(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 L(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+=W[t[i]];return o}function I(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 C(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 x(t,e,r,n,o,i){if(!u.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 R(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 j(t,e,r,n,i){return e=+e,r>>>=0,i||R(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function D(t,e,r,n,i){return e=+e,r>>>=0,i||R(t,0,r,8),o.write(t,e,r,n,52,8),r+8}u.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,u.prototype),n},u.prototype.readUintLE=u.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||C(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n},u.prototype.readUintBE=u.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||C(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||C(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||C(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||C(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||C(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||C(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||C(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},u.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||C(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},u.prototype.readInt8=function(t,e){return t>>>=0,e||C(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||C(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){t>>>=0,e||C(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||C(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return t>>>=0,e||C(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return t>>>=0,e||C(t,4,this.length),o.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||C(t,4,this.length),o.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||C(t,8,this.length),o.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||C(t,8,this.length),o.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||x(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},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||x(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},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||x(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},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||x(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},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);x(this,t,e,r,o-1,-o)}var i=0,f=1,s=0;for(this[e]=255&t;++i<r&&(f*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/f|0)-s&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);x(this,t,e,r,o-1,-o)}var i=r-1,f=1,s=0;for(this[e+i]=255&t;--i>=0&&(f*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/f|0)-s&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||x(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},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||x(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},u.prototype.writeFloatLE=function(t,e,r){return j(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return j(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return D(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return D(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(!u.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},u.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&&!u.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 f=u.isBuffer(t)?t:u.from(t,n),s=f.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<r-e;++i)this[i+e]=f[i%s]}return this};var P=/[^+/0-9A-Za-z-_]/g;function k(t,e){var r;e=e||1/0;for(var n=t.length,o=null,i=[],f=0;f<n;++f){if((r=t.charCodeAt(f))>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(f+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 F(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(P,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Y(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 _(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function z(t){return t!=t}var W=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=s(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,i=s(t),f=i[0],u=i[1],a=new o(function(t,e,r){return 3*(e+r)/4-r}(0,f,u)),h=0,c=u>0?f-4:f;for(r=0;r<c;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)],a[h++]=e>>16&255,a[h++]=e>>8&255,a[h++]=255&e;return 2===u&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,a[h++]=255&e),1===u&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,a[h++]=e>>8&255,a[h++]=255&e),a},e.fromByteArray=function(t){for(var e,n=t.length,o=n%3,i=[],f=16383,s=0,a=n-o;s<a;s+=f)i.push(u(t,s,s+f>a?a:s+f));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+/",f=0;f<64;++f)r[f]=i[f],n[i.charCodeAt(f)]=f;function s(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 u(t,e,n){for(var o,i,f=[],s=e;s<n;s+=3)o=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),f.push(r[(i=o)>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return f.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()))}function e(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 o(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 i(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,f=n>=3,s=n>=2,u=n>=1,a=n>=0,h={years:o?0:NaN,months:i?0:NaN,days:f?0:NaN,hours:s?0:NaN,minutes:u?0:NaN,seconds:a?0:NaN,total:NaN};let c=t;if(o||i||f){const t=new Date(1980,0,1),e=new Date(t.getTime()+1e3*c),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(f)for(;new Date(r.getFullYear(),r.getMonth(),r.getDate()+1).getTime()<=e.getTime();)r.setDate(r.getDate()+1),h.days++;c=Math.floor((e.getTime()-r.getTime())/1e3)}s&&(h.hours=Math.floor(c/3600),c%=3600),u&&(h.minutes=Math.floor(c/60),c%=60),a&&(h.seconds=c);const l={seconds:a?t:NaN,minutes:u?t/60:NaN,hours:s?t/3600:NaN,days:f?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=+(l[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=[s?p(h.hours):null,u?p(h.minutes):null,a?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 f(t){return i(t,"hours","{hours}:{minutes}:{seconds}")}function s(t){return i(t,"days","{days}d {hours}:{minutes}:{seconds}")}r.r(n),r.d(n,{asyncReplace:()=>t,cloneObjTypeOrder:()=>l,countObj:()=>g,extendObjType:()=>h,formatCustomTimer:()=>i,formatDayTimer:()=>s,formatTimer:()=>f,getAge:()=>m,getSimplePerc:()=>w,getTimeDuration:()=>o,objType:()=>y,reorderObjTypeOrder:()=>c,ruleOfThree:()=>d,shuffleArray:()=>e,toTitleCase:()=>b,toTitleCaseLowerFirst:()=>v});var u=r(287);const a={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!==u.hp&&u.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 h(t,e){const r=[];for(const[n,o]of Object.entries(t))if(!a.items.hasOwnProperty(n)){a.items[n]=o;let t="number"==typeof e?e:-1;if(-1===t){const e=a.order.indexOf("object");t=e>-1?e:a.order.length}t=Math.min(Math.max(0,t),a.order.length),a.order.splice(t,0,n),r.push(n)}return r}function c(t){const e=[...a.order];return!!t.every((t=>e.includes(t)))&&(a.order=t.slice(),!0)}function l(){return[...a.order]}const p=t=>{if(null===t)return"null";for(const e of a.order)if(!a.items[e]||a.items[e](t))return e;return"unknown"};function y(t,e){if(void 0===t)return null;const r=p(t);return"string"==typeof e?r===e.toLowerCase():r}function g(t){return Array.isArray(t)?t.length:y(t,"object")?Object.keys(t).length:0}function d(t,e,r,n){return n?Number(t*e)/r:Number(r*e)/t}function w(t,e){return t*(e/100)}function m(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(),f=r.getMonth(),s=n.getDate(),u=r.getDate();return(i<f||i===f&&s<u)&&o--,Math.abs(o)}return null}function b(t){return t.replace(/\w\S*/g,(t=>t.charAt(0).toUpperCase()+t.substr(1).toLowerCase()))}function v(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)}})(),window.TinyBasicsEs=n})();
|
|
2
|
+
(()=>{var t={251:(t,e)=>{e.read=function(t,e,r,n,o){var i,f,s=8*o-n-1,u=(1<<s)-1,a=u>>1,h=-7,c=r?o-1:0,p=r?-1:1,l=t[e+c];for(c+=p,i=l&(1<<-h)-1,l>>=-h,h+=s;h>0;i=256*i+t[e+c],c+=p,h-=8);for(f=i&(1<<-h)-1,i>>=-h,h+=n;h>0;f=256*f+t[e+c],c+=p,h-=8);if(0===i)i=1-a;else{if(i===u)return f?NaN:1/0*(l?-1:1);f+=Math.pow(2,n),i-=a}return(l?-1:1)*f*Math.pow(2,i-n)},e.write=function(t,e,r,n,o,i){var f,s,u,a=8*i-o-1,h=(1<<a)-1,c=h>>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,l=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?(s=isNaN(e)?1:0,f=h):(f=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-f))<1&&(f--,u*=2),(e+=f+c>=1?p/u:p*Math.pow(2,1-c))*u>=2&&(f++,u/=2),f+c>=h?(s=0,f=h):f+c>=1?(s=(e*u-1)*Math.pow(2,o),f+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,o),f=0));o>=8;t[r+l]=255&s,l+=y,s/=256,o-=8);for(f=f<<o|s,a+=o;a>0;t[r+l]=255&f,l+=y,f/=256,a-=8);t[r+l-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=u,e.IS=50;var f=2147483647;function s(t){if(t>f)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(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 c(t)}return a(t,e,r)}function a(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|g(t,e),n=s(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(_(t,Uint8Array)){var e=new Uint8Array(t);return l(e.buffer,e.byteOffset,e.byteLength)}return p(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(_(t,ArrayBuffer)||t&&_(t.buffer,ArrayBuffer))return l(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(_(t,SharedArrayBuffer)||t&&_(t.buffer,SharedArrayBuffer)))return l(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 u.from(n,e,r);var o=function(t){if(u.isBuffer(t)){var e=0|y(t.length),r=s(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||z(t.length)?s(0):p(t):"Buffer"===t.type&&Array.isArray(t.data)?p(t.data):void 0}(t);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.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 c(t){return h(t),s(t<0?0:0|y(t))}function p(t){for(var e=t.length<0?0:0|y(t.length),r=s(e),n=0;n<e;n+=1)r[n]=255&t[n];return r}function l(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,u.prototype),n}function y(t){if(t>=f)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+f.toString(16)+" bytes");return 0|t}function g(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||_(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 k(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return F(t).length;default:if(o)return n?-1:k(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 L(this,e,r);case"utf8":case"utf-8":return O(this,e,r);case"ascii":return M(this,e,r);case"latin1":case"binary":return N(this,e,r);case"base64":return T(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function w(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function m(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),z(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=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:b(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):b(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function b(t,e,r,n,o){var i,f=1,s=t.length,u=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;f=2,s/=2,u/=2,r/=2}function a(t,e){return 1===f?t[e]:t.readUInt16BE(e*f)}if(o){var h=-1;for(i=r;i<s;i++)if(a(t,i)===a(e,-1===h?0:i-h)){if(-1===h&&(h=i),i-h+1===u)return h*f}else-1!==h&&(i-=i-h),h=-1}else for(r+u>s&&(r=s-u),i=r;i>=0;i--){for(var c=!0,p=0;p<u;p++)if(a(t,i+p)!==a(e,p)){c=!1;break}if(c)return i}return-1}function v(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 f=0;f<n;++f){var s=parseInt(e.substr(2*f,2),16);if(z(s))return f;t[r+f]=s}return f}function E(t,e,r,n){return Y(k(e,t.length-r),t,r,n)}function A(t,e,r,n){return Y(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function B(t,e,r,n){return Y(F(e),t,r,n)}function U(t,e,r,n){return Y(function(t,e){for(var r,n,o,i=[],f=0;f<t.length&&!((e-=2)<0);++f)n=(r=t.charCodeAt(f))>>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function T(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function O(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var i,f,s,u,a=t[o],h=null,c=a>239?4:a>223?3:a>191?2:1;if(o+c<=r)switch(c){case 1:a<128&&(h=a);break;case 2:128==(192&(i=t[o+1]))&&(u=(31&a)<<6|63&i)>127&&(h=u);break;case 3:i=t[o+1],f=t[o+2],128==(192&i)&&128==(192&f)&&(u=(15&a)<<12|(63&i)<<6|63&f)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:i=t[o+1],f=t[o+2],s=t[o+3],128==(192&i)&&128==(192&f)&&128==(192&s)&&(u=(15&a)<<18|(63&i)<<12|(63&f)<<6|63&s)>65535&&u<1114112&&(h=u)}null===h?(h=65533,c=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),o+=c}return function(t){var e=t.length;if(e<=S)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=S));return r}(n)}u.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}}(),u.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(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(t,e,r){return a(t,e,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(t,e,r){return function(t,e,r){return h(t),t<=0?s(t):void 0!==e?"string"==typeof r?s(t).fill(e,r):s(t).fill(e):s(t)}(t,e,r)},u.allocUnsafe=function(t){return c(t)},u.allocUnsafeSlow=function(t){return c(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(_(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),_(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(t)||!u.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},u.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}},u.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=u.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var i=t[r];if(_(i,Uint8Array))o+i.length>n.length?u.from(i).copy(n,o):Uint8Array.prototype.set.call(n,i,o);else{if(!u.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,o)}o+=i.length}return n},u.byteLength=g,u.prototype._isBuffer=!0,u.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)w(this,e,e+1);return this},u.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)w(this,e,e+3),w(this,e+1,e+2);return this},u.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)w(this,e,e+7),w(this,e+1,e+6),w(this,e+2,e+5),w(this,e+3,e+4);return this},u.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?O(this,0,t):d.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.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&&(u.prototype[i]=u.prototype.inspect),u.prototype.compare=function(t,e,r,n,o){if(_(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.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),f=(r>>>=0)-(e>>>=0),s=Math.min(i,f),a=this.slice(n,o),h=t.slice(e,r),c=0;c<s;++c)if(a[c]!==h[c]){i=a[c],f=h[c];break}return i<f?-1:f<i?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return m(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return m(this,t,e,r,!1)},u.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 v(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 B(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var S=4096;function M(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 N(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 L(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+=W[t[i]];return o}function I(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 C(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 x(t,e,r,n,o,i){if(!u.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 R(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 j(t,e,r,n,i){return e=+e,r>>>=0,i||R(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function D(t,e,r,n,i){return e=+e,r>>>=0,i||R(t,0,r,8),o.write(t,e,r,n,52,8),r+8}u.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,u.prototype),n},u.prototype.readUintLE=u.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||C(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n},u.prototype.readUintBE=u.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||C(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||C(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||C(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||C(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||C(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||C(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||C(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},u.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||C(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},u.prototype.readInt8=function(t,e){return t>>>=0,e||C(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||C(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){t>>>=0,e||C(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||C(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return t>>>=0,e||C(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return t>>>=0,e||C(t,4,this.length),o.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||C(t,4,this.length),o.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||C(t,8,this.length),o.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||C(t,8,this.length),o.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||x(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},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||x(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},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||x(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},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||x(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},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);x(this,t,e,r,o-1,-o)}var i=0,f=1,s=0;for(this[e]=255&t;++i<r&&(f*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/f|0)-s&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);x(this,t,e,r,o-1,-o)}var i=r-1,f=1,s=0;for(this[e+i]=255&t;--i>=0&&(f*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/f|0)-s&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||x(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},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||x(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},u.prototype.writeFloatLE=function(t,e,r){return j(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return j(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return D(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return D(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(!u.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},u.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&&!u.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 f=u.isBuffer(t)?t:u.from(t,n),s=f.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<r-e;++i)this[i+e]=f[i%s]}return this};var P=/[^+/0-9A-Za-z-_]/g;function k(t,e){var r;e=e||1/0;for(var n=t.length,o=null,i=[],f=0;f<n;++f){if((r=t.charCodeAt(f))>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(f+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 F(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(P,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Y(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 _(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function z(t){return t!=t}var W=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=s(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,i=s(t),f=i[0],u=i[1],a=new o(function(t,e,r){return 3*(e+r)/4-r}(0,f,u)),h=0,c=u>0?f-4:f;for(r=0;r<c;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)],a[h++]=e>>16&255,a[h++]=e>>8&255,a[h++]=255&e;return 2===u&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,a[h++]=255&e),1===u&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,a[h++]=e>>8&255,a[h++]=255&e),a},e.fromByteArray=function(t){for(var e,n=t.length,o=n%3,i=[],f=16383,s=0,a=n-o;s<a;s+=f)i.push(u(t,s,s+f>a?a:s+f));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+/",f=0;f<64;++f)r[f]=i[f],n[i.charCodeAt(f)]=f;function s(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 u(t,e,n){for(var o,i,f=[],s=e;s<n;s+=3)o=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),f.push(r[(i=o)>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return f.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()))}function e(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 o(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 i(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,f=n>=3,s=n>=2,u=n>=1,a=n>=0,h={years:o?0:NaN,months:i?0:NaN,days:f?0:NaN,hours:s?0:NaN,minutes:u?0:NaN,seconds:a?0:NaN,total:NaN};let c=t;if(o||i||f){const t=new Date(1980,0,1),e=new Date(t.getTime()+1e3*c),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(f)for(;new Date(r.getFullYear(),r.getMonth(),r.getDate()+1).getTime()<=e.getTime();)r.setDate(r.getDate()+1),h.days++;c=Math.floor((e.getTime()-r.getTime())/1e3)}s&&(h.hours=Math.floor(c/3600),c%=3600),u&&(h.minutes=Math.floor(c/60),c%=60),a&&(h.seconds=c);const p={seconds:a?t:NaN,minutes:u?t/60:NaN,hours:s?t/3600:NaN,days:f?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=+(p[e]||0).toFixed(2).replace(/\.00$/,"");const l=t=>{const e="string"==typeof t?parseInt(t):t;return Number.isNaN(e)?"NaN":String(e).padStart(2,"0")},y=[s?l(h.hours):null,u?l(h.minutes):null,a?l(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,l(h.hours)).replace(/\{minutes\}/g,l(h.minutes)).replace(/\{seconds\}/g,l(h.seconds)).replace(/\{time\}/g,y).replace(/\{total\}/g,String(h.total)).trim()}function f(t){return i(t,"hours","{hours}:{minutes}:{seconds}")}function s(t){return i(t,"days","{days}d {hours}:{minutes}:{seconds}")}r.r(n),r.d(n,{asyncReplace:()=>t,cloneObjTypeOrder:()=>p,countObj:()=>g,extendObjType:()=>h,formatCustomTimer:()=>i,formatDayTimer:()=>s,formatTimer:()=>f,getAge:()=>m,getSimplePerc:()=>w,getTimeDuration:()=>o,objType:()=>y,reorderObjTypeOrder:()=>c,ruleOfThree:()=>d,shuffleArray:()=>e,toTitleCase:()=>b,toTitleCaseLowerFirst:()=>v});var u=r(287);const a={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!==u.hp&&u.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 h(t,e){const r=[];for(const[n,o]of Object.entries(t))if(!a.items.hasOwnProperty(n)){a.items[n]=o;let t="number"==typeof e?e:-1;if(-1===t){const e=a.order.indexOf("object");t=e>-1?e:a.order.length}t=Math.min(Math.max(0,t),a.order.length),a.order.splice(t,0,n),r.push(n)}return r}function c(t){const e=[...a.order];return!!t.every((t=>e.includes(t)))&&(a.order=t.slice(),!0)}function p(){return[...a.order]}const l=t=>{if(null===t)return"null";for(const e of a.order)if("function"!=typeof a.items[e]||a.items[e](t))return e;return"unknown"};function y(t,e){if(void 0===t)return null;const r=l(t);return"string"==typeof e?r===e.toLowerCase():r}function g(t){return Array.isArray(t)?t.length:y(t,"object")?Object.keys(t).length:0}function d(t,e,r,n=!1){return n?Number(t*e)/r:Number(r*e)/t}function w(t,e){return t*(e/100)}function m(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(),f=r.getMonth(),s=n.getDate(),u=r.getDate();return(i<f||i===f&&s<u)&&o--,Math.abs(o)}return null}function b(t){return t.replace(/\w\S*/g,(t=>t.charAt(0).toUpperCase()+t.substr(1).toLowerCase()))}function v(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)}})(),window.TinyBasicsEs=n})();
|
package/dist/TinyEssentials.js
CHANGED
|
@@ -2144,6 +2144,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2144
2144
|
__webpack_require__.d(__webpack_exports__, {
|
|
2145
2145
|
TinyLevelUp: () => (/* reexport */ userLevel),
|
|
2146
2146
|
asyncReplace: () => (/* reexport */ asyncReplace),
|
|
2147
|
+
checkObj: () => (/* reexport */ checkObj),
|
|
2147
2148
|
cloneObjTypeOrder: () => (/* reexport */ cloneObjTypeOrder),
|
|
2148
2149
|
countObj: () => (/* reexport */ countObj),
|
|
2149
2150
|
extendObjType: () => (/* reexport */ extendObjType),
|
|
@@ -2261,7 +2262,7 @@ class TinyLevelUp {
|
|
|
2261
2262
|
|
|
2262
2263
|
/**
|
|
2263
2264
|
* Generates random experience points based on the configured multiplier.
|
|
2264
|
-
* @param {number} multi - A multiplier for the generated experience.
|
|
2265
|
+
* @param {number} [multi] - A multiplier for the generated experience.
|
|
2265
2266
|
* @returns {number} The generated experience points.
|
|
2266
2267
|
*/
|
|
2267
2268
|
expGenerator(multi = 1) {
|
|
@@ -2302,9 +2303,9 @@ class TinyLevelUp {
|
|
|
2302
2303
|
/**
|
|
2303
2304
|
* Adds experience to the user, adjusting their level if necessary.
|
|
2304
2305
|
* @param {UserEditor} user - The user object.
|
|
2305
|
-
* @param {number} extraExp - Additional experience to be added.
|
|
2306
|
-
* @param {'add' | 'extra'} type - Type of addition ('add' or 'extra').
|
|
2307
|
-
* @param {number} multi - Multiplier for experience generation.
|
|
2306
|
+
* @param {number} [extraExp] - Additional experience to be added.
|
|
2307
|
+
* @param {'add' | 'extra'} [type] - Type of addition ('add' or 'extra').
|
|
2308
|
+
* @param {number} [multi] - Multiplier for experience generation.
|
|
2308
2309
|
* @returns {UserResult} The updated user object.
|
|
2309
2310
|
*/
|
|
2310
2311
|
give(user, extraExp = 0, type = 'add', multi = 1) {
|
|
@@ -2319,9 +2320,9 @@ class TinyLevelUp {
|
|
|
2319
2320
|
/**
|
|
2320
2321
|
* Removes experience from the user, adjusting their level if necessary.
|
|
2321
2322
|
* @param {UserEditor} user - The user object.
|
|
2322
|
-
* @param {number} extraExp -
|
|
2323
|
-
* @param {'add' | 'extra'} type - Type of removal ('add' or 'extra').
|
|
2324
|
-
* @param {number} multi - Multiplier for experience generation.
|
|
2323
|
+
* @param {number} [extraExp] - Additional experience to remove.
|
|
2324
|
+
* @param {'add' | 'extra'} [type] - Type of removal ('add' or 'extra').
|
|
2325
|
+
* @param {number} [multi] - Multiplier for experience generation.
|
|
2325
2326
|
* @returns {UserResult} The updated user object.
|
|
2326
2327
|
*/
|
|
2327
2328
|
remove(user, extraExp = 0, type = 'add', multi = 1) {
|
|
@@ -2404,7 +2405,7 @@ function getTimeDuration(timeData = new Date(), durationType = 'asSeconds', now
|
|
|
2404
2405
|
* Includes proper reallocation of lower units into higher ones, ensuring consistent hierarchy.
|
|
2405
2406
|
*
|
|
2406
2407
|
* @param {number} totalSeconds - The total amount of seconds to convert.
|
|
2407
|
-
* @param {'seconds'|'minutes'|'hours'|'days'|'months'|'years'} level - The highest level to calculate and display.
|
|
2408
|
+
* @param {'seconds'|'minutes'|'hours'|'days'|'months'|'years'} [level] - The highest level to calculate and display.
|
|
2408
2409
|
* @param {string} [format='{time}'] - Output template with placeholders like {years}, {months}, {days}, {hours}, {minutes}, {seconds}, {time}, {total}.
|
|
2409
2410
|
* @returns {string} The formatted timer string.
|
|
2410
2411
|
*/
|
|
@@ -2603,64 +2604,64 @@ var buffer = __webpack_require__(287);
|
|
|
2603
2604
|
*/
|
|
2604
2605
|
const typeValidator = {
|
|
2605
2606
|
items: {
|
|
2606
|
-
/**
|
|
2607
|
+
/** @param {*} val @returns {val is undefined} */
|
|
2607
2608
|
undefined: (val) => typeof val === 'undefined',
|
|
2608
2609
|
|
|
2609
|
-
/**
|
|
2610
|
+
/** @param {*} val @returns {val is null} */
|
|
2610
2611
|
null: (val) => val === null,
|
|
2611
2612
|
|
|
2612
|
-
/**
|
|
2613
|
+
/** @param {*} val @returns {val is boolean} */
|
|
2613
2614
|
boolean: (val) => typeof val === 'boolean',
|
|
2614
2615
|
|
|
2615
|
-
/**
|
|
2616
|
+
/** @param {*} val @returns {val is number} */
|
|
2616
2617
|
number: (val) => typeof val === 'number' && !isNaN(val),
|
|
2617
2618
|
|
|
2618
|
-
/**
|
|
2619
|
+
/** @param {*} val @returns {val is bigint} */
|
|
2619
2620
|
bigint: (val) => typeof val === 'bigint',
|
|
2620
2621
|
|
|
2621
|
-
/**
|
|
2622
|
+
/** @param {*} val @returns {val is string} */
|
|
2622
2623
|
string: (val) => typeof val === 'string',
|
|
2623
2624
|
|
|
2624
|
-
/**
|
|
2625
|
+
/** @param {*} val @returns {val is symbol} */
|
|
2625
2626
|
symbol: (val) => typeof val === 'symbol',
|
|
2626
2627
|
|
|
2627
|
-
/**
|
|
2628
|
+
/** @param {*} val @returns {val is Function} */
|
|
2628
2629
|
function: (val) => typeof val === 'function',
|
|
2629
2630
|
|
|
2630
|
-
/**
|
|
2631
|
+
/** @param {*} val @returns {val is Array<any>} */
|
|
2631
2632
|
array: (val) => Array.isArray(val),
|
|
2632
2633
|
|
|
2633
|
-
/**
|
|
2634
|
+
/** @param {*} val @returns {val is Date} */
|
|
2634
2635
|
date: (val) => val instanceof Date,
|
|
2635
2636
|
|
|
2636
|
-
/**
|
|
2637
|
+
/** @param {*} val @returns {val is RegExp} */
|
|
2637
2638
|
regexp: (val) => val instanceof RegExp,
|
|
2638
2639
|
|
|
2639
|
-
/**
|
|
2640
|
+
/** @param {*} val @returns {val is Map<any, any>} */
|
|
2640
2641
|
map: (val) => val instanceof Map,
|
|
2641
2642
|
|
|
2642
|
-
/**
|
|
2643
|
+
/** @param {*} val @returns {val is Set<any>} */
|
|
2643
2644
|
set: (val) => val instanceof Set,
|
|
2644
2645
|
|
|
2645
|
-
/**
|
|
2646
|
+
/** @param {*} val @returns {val is WeakMap<object, any>} */
|
|
2646
2647
|
weakmap: (val) => val instanceof WeakMap,
|
|
2647
2648
|
|
|
2648
|
-
/**
|
|
2649
|
+
/** @param {*} val @returns {val is WeakSet<object>} */
|
|
2649
2650
|
weakset: (val) => val instanceof WeakSet,
|
|
2650
2651
|
|
|
2651
|
-
/**
|
|
2652
|
+
/** @param {*} val @returns {val is Promise<any>} */
|
|
2652
2653
|
promise: (val) => val instanceof Promise,
|
|
2653
2654
|
|
|
2654
|
-
/**
|
|
2655
|
+
/** @param {*} val @returns {val is Buffer} */
|
|
2655
2656
|
buffer: (val) => typeof buffer/* Buffer */.hp !== 'undefined' && buffer/* Buffer */.hp.isBuffer(val),
|
|
2656
2657
|
|
|
2657
|
-
/**
|
|
2658
|
+
/** @param {*} val @returns {val is File} */
|
|
2658
2659
|
file: (val) => typeof File !== 'undefined' && val instanceof File,
|
|
2659
2660
|
|
|
2660
|
-
/**
|
|
2661
|
+
/** @param {*} val @returns {val is HTMLElement} */
|
|
2661
2662
|
htmlelement: (val) => typeof HTMLElement !== 'undefined' && val instanceof HTMLElement,
|
|
2662
2663
|
|
|
2663
|
-
/**
|
|
2664
|
+
/** @param {*} val @returns {val is object} */
|
|
2664
2665
|
object: (val) => typeof val === 'object' && val !== null,
|
|
2665
2666
|
},
|
|
2666
2667
|
|
|
@@ -2787,7 +2788,8 @@ function cloneObjTypeOrder() {
|
|
|
2787
2788
|
const getType = (val) => {
|
|
2788
2789
|
if (val === null) return 'null';
|
|
2789
2790
|
for (const name of typeValidator.order)
|
|
2790
|
-
if (
|
|
2791
|
+
if (typeof typeValidator.items[name] !== 'function' || typeValidator.items[name](val))
|
|
2792
|
+
return name;
|
|
2791
2793
|
return 'unknown';
|
|
2792
2794
|
};
|
|
2793
2795
|
|
|
@@ -2812,10 +2814,32 @@ function objType(obj, type) {
|
|
|
2812
2814
|
return result;
|
|
2813
2815
|
}
|
|
2814
2816
|
|
|
2817
|
+
/**
|
|
2818
|
+
* Checks the type of a given object and returns the validation value if a known type is detected.
|
|
2819
|
+
*
|
|
2820
|
+
* @param {*} obj - The object to check or identify.
|
|
2821
|
+
* @returns {{ valid:*; type: string | null }} - Returns the type result.
|
|
2822
|
+
*/
|
|
2823
|
+
function checkObj(obj) {
|
|
2824
|
+
/** @type {{ valid:*; type: string | null }} */
|
|
2825
|
+
const data = { valid: null, type: null };
|
|
2826
|
+
for (const name of typeValidator.order) {
|
|
2827
|
+
if (typeof typeValidator.items[name] === 'function') {
|
|
2828
|
+
const result = typeValidator.items[name](obj);
|
|
2829
|
+
if (result) {
|
|
2830
|
+
data.valid = result;
|
|
2831
|
+
data.type = name;
|
|
2832
|
+
break;
|
|
2833
|
+
}
|
|
2834
|
+
}
|
|
2835
|
+
}
|
|
2836
|
+
return data;
|
|
2837
|
+
}
|
|
2838
|
+
|
|
2815
2839
|
/**
|
|
2816
2840
|
* Counts the number of elements in an array or the number of properties in an object.
|
|
2817
2841
|
*
|
|
2818
|
-
* @param {
|
|
2842
|
+
* @param {Array<*>|Record<string|number, any>} obj - The array or object to count.
|
|
2819
2843
|
* @returns {number} - The count of items (array elements or object keys), or `0` if the input is neither an array nor an object.
|
|
2820
2844
|
*
|
|
2821
2845
|
* @example
|
|
@@ -2839,7 +2863,7 @@ function countObj(obj) {
|
|
|
2839
2863
|
* @param {number} val1 - The first reference value (numerator in direct proportion, denominator in inverse).
|
|
2840
2864
|
* @param {number} val2 - The second reference value (denominator in direct proportion, numerator in inverse).
|
|
2841
2865
|
* @param {number} val3 - The third value (numerator in direct proportion, denominator in inverse).
|
|
2842
|
-
* @param {boolean} inverse - Whether the calculation should use inverse proportion (true for inverse, false for direct).
|
|
2866
|
+
* @param {boolean} [inverse] - Whether the calculation should use inverse proportion (true for inverse, false for direct).
|
|
2843
2867
|
* @returns {number} The result of the Rule of Three operation.
|
|
2844
2868
|
*
|
|
2845
2869
|
* Rule of Three Formula (Direct Proportion):
|
|
@@ -2868,7 +2892,7 @@ function countObj(obj) {
|
|
|
2868
2892
|
* // Inverse proportion:
|
|
2869
2893
|
* ruleOfThree.execute(2, 6, 3, true); // → 4
|
|
2870
2894
|
*/
|
|
2871
|
-
function ruleOfThree(val1, val2, val3, inverse) {
|
|
2895
|
+
function ruleOfThree(val1, val2, val3, inverse = false) {
|
|
2872
2896
|
return inverse ? Number(val1 * val2) / val3 : Number(val3 * val2) / val1;
|
|
2873
2897
|
}
|
|
2874
2898
|
|