@creejs/commons-lang 2.1.12 → 2.1.13

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.
@@ -1,2 +1,2 @@
1
- var t={constructorName:r,defaults:function(t,...r){if(null==t)throw new TypeError('"target" must not be null or undefined');for(const n of r)if(null!=n)for(const r in n)void 0===t[r]&&(t[r]=n[r]);return t},extend:n,extends:n,equals:function(t,r){if(t===r)return!0;if("function"==typeof t?.equals)return t.equals(r);if("function"==typeof r?.equals)return r.equals(t);return!1},isBrowser:e,isNode:function(){return!e()}};function r(t){return t?.constructor?.name}function n(t,...r){if(null==t)throw new TypeError('"target" must not be null or undefined');for(const n of r)if(null!=n)for(const r in n)t[r]=n[r];return t}function e(){return"undefined"!=typeof window&&"undefined"!=typeof document}var o={isArray:i,isBoolean:s,isBuffer:function(t){return null!=t&&Buffer.isBuffer(t)},isFunction:u,isInstance:f,isIterable:function(t){return null!=t&&"function"==typeof t[Symbol.iterator]},isDate:function(t){return null!=t&&t instanceof Date},isError:function(t){return null!=t&&t instanceof Error},isMap:function(t){return null!=t&&"object"==typeof t&&t.constructor===Map},isWeakMap:function(t){return null!=t&&"object"==typeof t&&t.constructor===WeakMap},isNumber:h,isPositive:c,isNegative:y,isNotNegative:l,isNil:a,isNullOrUndefined:function(t){return null==t},isNull:p,isUndefined:g,isPlainObject:d,isObject:w,isPromise:m,isRegExp:function(t){return null!=t&&"object"==typeof t&&t.constructor===RegExp},isSet:function(t){return null!=t&&"object"==typeof t&&t.constructor===Set},isWeakSet:function(t){return null!=t&&"object"==typeof t&&t.constructor===WeakSet},isStream:function(t){return null!=t&&"function"==typeof t.pipe},isString:b,isSymbol:N,isPrimitive:function(t){return null!==t&&("string"==typeof t||"number"==typeof t||"boolean"==typeof t)},isInt8Array:O,isUint8Array:$,isUint8ClampedArray:E,isInt16Array:v,isUint16Array:S,isInt32Array:U,isUint32Array:x,isFloat32Array:P,isFloat64Array:j,isBigInt64Array:B,isBigUint64Array:I,isTypedArray:A,isArrayBuffer:T};function i(t){return Array.isArray(t)}function s(t){return"boolean"==typeof t}function u(t){return"function"==typeof t}function f(t){return null!=t&&"object"==typeof t&&!d(t)}function a(t){return null==t}function c(t){return!!h(t)&&t>0}function l(t){return!!h(t)&&t>=0}function y(t){return!!h(t)&&t<0}function p(t){return null===t}function g(t){return void 0===t}function h(t){return null!=t&&"number"==typeof t}function w(t){return null!=t&&"object"==typeof t}function d(t){return null!==t&&"object"==typeof t&&(t.constructor===Object||void 0===t.constructor)}function m(t){return null!=t&&"function"==typeof t.then}function b(t){return null!=t&&"string"==typeof t}function N(t){return null!=t&&"symbol"==typeof t}function A(t){return ArrayBuffer.isView(t)&&t.constructor!==DataView}function O(t){return t instanceof Int8Array}function $(t){return t instanceof Uint8Array}function E(t){return t instanceof Uint8ClampedArray}function v(t){return t instanceof Int16Array}function S(t){return t instanceof Uint16Array}function U(t){return t instanceof Int32Array}function x(t){return t instanceof Uint32Array}function P(t){return t instanceof Float32Array}function j(t){return t instanceof Float64Array}function B(t){return t instanceof BigInt64Array}function I(t){return t instanceof BigUint64Array}function T(t){return t instanceof ArrayBuffer}var L={assertNumber:C,assertPositive:D,assertNegative:function(t,r){if(!y(t))throw new Error(`${r?'"'+r+'" ':" "}Not Negative: ${t}`)},assertNotNegative:F,assertBoolean:function(t,r){if(!s(t))throw new Error(`${r?'"'+r+'" ':" "}Not Boolean: type=${typeof t} value=${JSON.stringify(t)}`)},assertObject:M,assertPlainObject:function(t,r){if(!d(t))throw new Error(`${r?'"'+r+'" ':" "}Not PlainObject: type=${typeof t} value=${JSON.stringify(t)}`)},assertSymbol:function(t,r){if(!N(t))throw new Error(`${r?'"'+r+'" ':" "}Not Symbol: type=${typeof t} value=${JSON.stringify(t)}`)},assertFunction:q,assertInstance:function(t,r){if(!f(t))throw new Error(`${r?'"'+r+'" ':" "}Not Class Instance: type=${typeof t} value=${JSON.stringify(t)}`)},assertPromise:R,assertNil:function(t,r){if(!a(t))throw new Error(`${r?'"'+r+'" ':" "}Neither Null nor Undefined: type=${typeof t} value=${JSON.stringify(t)}`)},assertNotNil:W,assertNull:function(t,r){if(!p(t))throw new Error(`${r?'"'+r+'" ':" "}Not Null: type=${typeof t} value=${JSON.stringify(t)}`)},assertNotNull:function(t,r){if(p(t))throw new Error((r?'"'+r+'" ':" ")+"Should Not Null")},assertUndefined:function(t,r){if(!g(t))throw new Error(`${r?'"'+r+'" ':" "}Not Undefined: type=${typeof t} value=${JSON.stringify(t)}`)},assertString:J,assertArray:k,assertStringOrSymbol:function(t,r){if(!b(t)&&!N(t))throw new Error(`${r?'"'+r+'" ':" "}Not String or Symbol: type=${typeof t} value=${JSON.stringify(t)}`)},assertInt8Array:function(t,r){if(O(t))throw new Error((r?'"'+r+'" ':" ")+"Not Int8Array")},assertUint8Array:function(t,r){if($(t))throw new Error((r?'"'+r+'" ':" ")+"Not Uint8Array")},assertUint8ClampedArray:function(t,r){if(E(t))throw new Error((r?'"'+r+'" ':" ")+"Not Uint8ClampedArray")},assertInt16Array:function(t,r){if(v(t))throw new Error((r?'"'+r+'" ':" ")+"Not Int16Array")},assertUint16Array:function(t,r){if(S(t))throw new Error((r?'"'+r+'" ':" ")+"Not Uint16Array")},assertInt32Array:function(t,r){if(U(t))throw new Error((r?'"'+r+'" ':" ")+"Not Int32Array")},assertUint32Array:function(t,r){if(x(t))throw new Error((r?'"'+r+'" ':" ")+"Not Uint32Array")},assertFloat32Array:function(t,r){if(P(t))throw new Error((r?'"'+r+'" ':" ")+"Not Float32Array")},assertFloat64Array:function(t,r){if(j(t))throw new Error((r?'"'+r+'" ':" ")+"Not Float64Array")},assertBigInt64Array:function(t,r){if(B(t))throw new Error((r?'"'+r+'" ':" ")+"Not BigInt64Array")},assertBigUint64Array:function(t,r){if(I(t))throw new Error((r?'"'+r+'" ':" ")+"Not BigUint64Array")},assertTypedArray:function(t,r){if(A(t))throw new Error((r?'"'+r+'" ':" ")+"Not TypedArray")},assertArrayBuffer:H};function k(t,r){if(!Array.isArray(t))throw new Error(`${r?'"'+r+'" ':" "}Not Array: type=${typeof t} value=${JSON.stringify(t)}`)}function J(t,r){if(!b(t))throw new Error(`${r?'"'+r+'" ':" "}Not String: type=${typeof t} value=${JSON.stringify(t)}`)}function C(t,r){if(!h(t))throw new Error(`${r?'"'+r+'" ':" "}Not Number: type=${typeof t} value=${JSON.stringify(t)}`)}function D(t,r){if(!c(t))throw new Error(`${r?'"'+r+'" ':" "}Not Positive: ${t}`)}function F(t,r){if(!l(t))throw new Error(`${r?'"'+r+'" ':" "}Not "0 or Positive": ${t}`)}function M(t,r){if(!w(t))throw new Error(`${r?'"'+r+'" ':" "}Not Object: type=${typeof t} value=${JSON.stringify(t)}`)}function q(t,r){if(!u(t))throw new Error(`${r?'"'+r+'" ':" "}Not Function: type=${typeof t} value=${JSON.stringify(t)}`)}function R(t,r){if(!m(t))throw new Error(`${r?'"'+r+'" ':" "}Not Promise: type=${typeof t} value=${JSON.stringify(t)}`)}function W(t,r){if(a(t))throw new Error((r?'"'+r+'" ':" ")+"Should Not Nil")}function H(t,r){if(!T(t))throw new Error((r?'"'+r+'" ':" ")+"Not ArrayBuffer")}var V={isEmpty:z,assertNotEmpty:G,isBlank:K,assertNotBlank:function(t){if(K(t))throw new Error(`Blank String: ${t}`)},capitalize:function(t){if(J(t),0===t.length)return t;const r=t.charAt(0),n=r.toUpperCase();return r===n?t:n+t.slice(1)},decapitalize:function(t){if(J(t),0===t.length)return t;const r=t.charAt(0),n=r.toLowerCase();return r===n?t:n+t.slice(1)},splitWithFixedLength:function(t,r,n=" "){if(J(t),C(r),J(n),0===t.length)return[];if(r<=0)throw new Error("length muse >=0");if(t.length<r)return[t.padEnd(r,n)];const e=[];for(let o=0;o<t.length;o+=r){const i=t.substring(o,o+r);e.push(i.padEnd(r,n))}return e},split:function(t,...r){J(t);if(0===t.length)return[];const n=[...r];0===r.length&&r.push(",");const e=Q(t,...n);if(0===e.length)return[];const o=[];let i="",s=0;for(const{marker:r,index:n}of e)i=t.substring(s,n),o.push(i),s=n+r.length;return i=t.substring(s),o.push(i),o},findMarkerPositions:function(t,...r){if(J(t),0===r.length)throw new Error("At least one marker must be provided");const n=[];for(const e of new Set(r)){if(z(e))continue;J(e);let r=t.indexOf(e);for(;-1!==r;)n.push({marker:e,index:r}),r=t.indexOf(e,r+e.length)}return n.sort((t,r)=>t.index-r.index),n},findMarkerPositionsRegex:Q,substringBefore:function(t,r){if(J(t),J(r),0===t.length||0===r.length)return;const n=t.indexOf(r);if(-1===n)return;return t.substring(0,n)},substringBeforeLast:function(t,r){if(J(t),J(r),0===t.length||0===r.length)return;const n=t.lastIndexOf(r);if(-1===n)return;return t.substring(0,n)},substringAfter:function(t,r){if(J(t),J(r),0===t.length||0===r.length)return;const n=t.indexOf(r);if(-1===n)return;return t.substring(n+r.length)},substringAfterLast:function(t,r){if(J(t),J(r),0===t.length||0===r.length)return;const n=t.lastIndexOf(r);if(-1===n)return;return t.substring(n+r.length)},substringBetween:function(t,r,n){G(t),G(r),G(n);const e=t.indexOf(r);if(-1===e)return;const o=t.indexOf(n,e+r.length);if(-1===o)return;return t.substring(e+r.length,o)},substringBetweenGreedy:function(t,r,n){G(t),G(r),G(n);const e=t.indexOf(r);if(-1===e)return;const o=t.lastIndexOf(n);if(-1===o||o<=e)return;return t.substring(e+r.length,o)},substringsBetween:function(t,r,n){G(t),G(r),G(n);const e=[];let o=0;for(;;){const i=t.indexOf(r,o);if(-1===i)break;const s=t.indexOf(n,i+r.length);if(-1===s)break;e.push(t.substring(i+r.length,s)),o=s+n.length}return e}};function z(t){return null==t||(J(t),0===t.length)}function G(t){if(z(t))throw new Error(`Empty String: ${t}`)}function K(t){return null==t||(J(t),0===t.trim().length)}function Q(t,...r){if(J(t),0===r.length)throw new Error("At least one marker must be provided");const n=[...new Set(r.filter(t=>null!=t))].map(t=>(J(t),t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))),e=new RegExp(n.map(t=>`(${t})`).join("|"),"g"),o=[];let i=null;for(;null!==(i=e.exec(t));){for(let t=1;t<i.length;t++)if(i[t]){o.push({marker:r[t-1],index:i.index});break}0===i[0].length&&e.lastIndex++}return o}var X={quiet:function(t){q(t);try{const r=t();return m(r)?r.catch(()=>{}):r}catch(t){}},quietKeepError:function(t,r){q(t),k(r);try{const n=t();return m(n)?n.catch(t=>r.push(t)):n}catch(t){r.push(t)}}},Y={defer:Z,delay:function(t,r){h(t)?(r=t,t=Promise.resolve()):null==t&&null==r&&(r=1,t=Promise.resolve());null!=t&&R(t),C(r=r??1e3);const n=Z(),e=Date.now();return t.then((...t)=>{const o=Date.now()-e;o<r?setTimeout(()=>n.resolve(...t),r-o):n.resolve(...t)}).catch(t=>{const o=Date.now()-e;o<r?setTimeout(()=>n.reject(t),r-o):n.reject(t)}),n.promise},timeout:function(t,r,n){R(t),C(r=r??1);const e=Z(r,n),o=Date.now();return t.then((...t)=>{Date.now()-o<=r?e.resolve(...t):e.reject(new Error(n??`Promise Timeout: ${r}ms`))}).catch(t=>{!e.resolved&&!e.rejected&&e.reject(t)}),e.promise},allSettled:_,returnValuePromised:tt,series:async function(t){k(t);const r=[];for(const n of t)q(n),r.push(await n());return r},seriesAllSettled:async function(t){k(t);const r=[];for(const n of t){q(n);try{r.push({ok:!0,result:await n()})}catch(t){r.push({ok:!1,result:t})}}return r},parallel:async function(t,r=5){if(k(t),C(r),r<=0)throw new Error(`Invalid maxParallel: ${r}, should > 0`);t.forEach(t=>q(t));const n=[];if(t.length<=r){const r=await Promise.all(t.map(t=>tt(t)));return n.push(...r),n}const e=[];for(const o of t)if(q(o),e.push(o),e.length>=r){const t=await Promise.all(e.map(t=>tt(t)));n.push(...t),e.length=0}if(e.length>0&&e.length<r){const t=await Promise.all(e.map(t=>tt(t)));n.push(...t)}return n},parallelAllSettled:async function(t,r=5){if(k(t),C(r),r<=0)throw new Error(`Invalid maxParallel: ${r}, should > 0`);t.forEach(t=>q(t));const n=[];if(t.length<=r){const r=await _(t.map(t=>tt(t)));return n.push(...r),n}const e=[];for(const o of t)if(q(o),e.push(o),e.length>=r){const t=await _(e.map(t=>tt(t)));n.push(...t),e.length=0}if(e.length>0&&e.length<r){const t=await _(e.map(t=>tt(t)));n.push(...t)}return n}};function Z(t=-1,r){C(t);const n={};let e;return t>=0&&(n.timerHandler=e=setTimeout(()=>{clearTimeout(e),n.timerCleared=!0,n.reject(new Error(r??`Promise Timeout: ${t}ms`))},t),n.timerHandler=e),n.promise=new Promise((t,r)=>{n.resolve=(...r)=>{null!=e&&(clearTimeout(e),n.timerCleared=!0),n.resolved=!0,t(...r)},n.reject=t=>{null!=e&&(clearTimeout(e),n.timerCleared=!0),n.rejected=!0,r(t)}}),n.promise.cancel=()=>{null!=e&&(clearTimeout(e),n.timerCleared=!0),n.rejected=!0,n.canceled=n.promise.canceled=!0,n.reject(new Error("Cancelled"))},n}async function _(t){k(t);const r=await Promise.allSettled(t),n=[];for(const t of r)"fulfilled"===t.status&&n.push({ok:!0,result:t.value}),"rejected"===t.status&&n.push({ok:!1,result:t.reason});return n}function tt(t){try{const r=t();return m(r)?r:Promise.resolve(r)}catch(t){return Promise.reject(t)}}const{isPlainObject:rt}=o;var nt={proxy:et,newProxyInstance:function(t,r,n,e=!0){const o=et(t,n,e);return Reflect.construct(o,r??[])}};function et(t,r,n=!0){if("function"!=typeof t)throw new TypeError(`Not Class: type=${typeof t}, value=${JSON.stringify(t)}`);if(null!=r){if(!rt(r))throw new TypeError(`Not PropertyHandler: type=${typeof r}, value=${JSON.stringify(r)}`);const{get:t,set:n}=r;if(null!=t&&"function"!=typeof t)throw new TypeError(`Not PropertyHandler.get: type=${typeof t}, value=${JSON.stringify(t)}`);if(null!=n&&"function"!=typeof n)throw new TypeError(`Not PropertyHandler.set: type=${typeof n}, value=${JSON.stringify(n)}`)}const e={construct(t,e,o){const i=Reflect.construct(t,e);return new Proxy(n?Object.preventExtensions(i):i,r??{})}};return new Proxy(t,e)}var ot={proxy:function(t,r,n=!0){if(a(t)||!w(t)||i(t))throw new TypeError(`Not Object: type=${typeof t}, value=${JSON.stringify(t)}`);return new Proxy(n?Object.preventExtensions(t):t,r??{})}};function it(t){M(t,"obj");const r=new Set;let n=t;for(;n&&n!==Object.prototype;){const e=Object.getOwnPropertyNames(n);for(const n of e)"constructor"!==n&&"function"==typeof t[n]&&r.add(n);n=Object.getPrototypeOf(n)}return[...new Set(r)]}var st={getMethodsOfClass:function(t){q(t,"cls");const r=new Set;let n=t.prototype;for(;n&&n!==Object.prototype;){const t=Object.getOwnPropertyNames(n);for(const e of t)"constructor"!==e&&"function"==typeof n[e]&&r.add(e);n=Object.getPrototypeOf(n)}return[...new Set(r)]},getStaticMethodsOfClass:function(t){q(t,"cls");const r=new Set;let n=t;for(;n&&n!==Object.getPrototypeOf(Object);){const t=Object.getOwnPropertyNames(n);for(const e of t)"function"==typeof n[e]&&r.add(e);n=Object.getPrototypeOf(n)}return[...r]},getMethods:it,getMethodsOfObject:it},ut={startsWith:function(t,r){W(t,"src"),W(r,"searching");return at(t.subarray(0,r.length),r)},isSameType:ft,equals:at};function ft(t,n){return W(t,"src"),W(n,"target"),r(t)===r(n)}function at(t,r){if(W(t,"src"),W(r,"target"),!ft(t,r))return!1;if(t.byteLength!==r.byteLength)return!1;const n=new DataView(t.buffer,t.byteOffset,t.byteLength),e=new DataView(r.buffer,r.byteOffset,r.byteLength);for(let r=0;r<t.byteLength;r++)if(n.getUint8(r)!==e.getUint8(r))return!1;return!0}var ct={readString:function(t,r=0,n){if(H(t),F(r),r>=t.byteLength)return;let e=null;null!=n?(D(n),e=r+n>=t.byteLength?new Uint8Array(t,r):new Uint8Array(t,r,n)):e=new Uint8Array(t,r);return lt.decode(e)},writeString:function(t,r,n=0){H(t,"buffer"),J(r,"str"),F(n,"offset");const e=yt.encode(r),o=e.byteLength;if(n+o>t.byteLength)throw new Error(`offset + str.byteLength > buffer.byteLength:${n+o} > ${t.byteLength}`);new Uint8Array(t,n,e.byteLength).set(e)},writeArrayBuffer:function(t,r,n=0,e=0,o){H(t),H(r),C(n),C(e);const i=t.byteLength;if(n<-1*i)n=0;else if(n<0)n+=i;else if(n>=i)throw new Error(`Out of target Bounds: targetOffset(${n}) >= targetLength(${i})`);const s=r.byteLength;if(e<-1*s)e=0;else if(e<0)e+=s;else if(e>=s)throw new Error(`Out of data Bounds: dataOffset(${e}) >= dataArrayBufferLength(${s})`);null!=o&&(D(o,"dataLength"),e+o>s&&(o=void 0));const u=new Uint8Array(r,e,o);if(u.byteLength>i-n)throw new Error(`Out of target Bounds: from targetOffset(${n}), No Space to store dataArrayBuffer(${e}, ${o??"NoLimit"})`);new Uint8Array(t).set(u,n)}};const lt=new TextDecoder,yt=new TextEncoder;const pt=1e6;var gt={s2ns:1e9,ms2ns:pt,timestamp64:ht,lapseNano:wt,lapseMillis:dt,timeoutNano:function(t,r){return wt(t)>r},timeoutMillis:function(t,r){return dt(t)>r}};function ht(){if("undefined"!=typeof performance&&"number"==typeof performance.timeOrigin){const t=performance.timeOrigin,r=performance.now();return BigInt((t+r)*pt)}return BigInt(Date.now()*pt)}function wt(t,r){return(r??ht())-t}function dt(t,r){r=r??ht();return BigInt(r-t)/BigInt(pt)}var mt={first:function(t,r){return k(t,"arr"),t[0]??r},last:function(t,r){return k(t,"arr"),t[t.length-1]??r},equals:function(t,r,n){if(!Array.isArray(t)||!Array.isArray(r))return!1;if(t.length!==r.length)return!1;for(let e=0;e<t.length;e++)if(n){if(0!==n(t[e],r[e]))return!1}else if(t[e]!==r[e])return!1;return!0},equalsIgnoreOrder:function(t,r,n){if(!Array.isArray(t)||!Array.isArray(r))return!1;if(t.length!==r.length)return!1;t.sort(n),r.sort(n);for(let e=0;e<t.length;e++)if(n){if(0!==n(t[e],r[e]))return!1}else if(t[e]!==r[e])return!1;return!0}};var bt={LangUtils:t,StringUtils:V,TypeUtils:o,TypeAssert:L,ExecUtils:X,PromiseUtils:Y,Lang:t,Type:o,Exec:X,ClassProxyUtils:nt,InstanceProxyUtils:ot,ReflectUtils:st,TypedArrayUtils:ut,ArrayBufferUtils:ct,TimeUtils:gt,ArrayUtils:mt};export{ct as ArrayBufferUtils,mt as ArrayUtils,nt as ClassProxyUtils,X as Exec,X as ExecUtils,ot as InstanceProxyUtils,t as Lang,t as LangUtils,Y as PromiseUtils,st as ReflectUtils,V as StringUtils,gt as TimeUtils,o as Type,L as TypeAssert,o as TypeUtils,ut as TypedArrayUtils,bt as default};
1
+ var t={constructorName:r,defaults:function(t,...r){if(null==t)throw new TypeError('"target" must not be null or undefined');for(const n of r)if(null!=n)for(const r in n)void 0===t[r]&&(t[r]=n[r]);return t},extend:n,extends:n,equals:function(t,r){if(t===r)return!0;if("function"==typeof t?.equals)return t.equals(r);if("function"==typeof r?.equals)return r.equals(t);return!1},isBrowser:e,isNode:function(){return!e()}};function r(t){return t?.constructor?.name}function n(t,...r){if(null==t)throw new TypeError('"target" must not be null or undefined');for(const n of r)if(null!=n)for(const r in n)t[r]=n[r];return t}function e(){return"undefined"!=typeof window&&"undefined"!=typeof document}var o={isArray:i,isBoolean:s,isBuffer:function(t){return null!=t&&Buffer.isBuffer(t)},isFunction:u,isInstance:f,isIterable:function(t){return null!=t&&"function"==typeof t[Symbol.iterator]},isDate:function(t){return null!=t&&t instanceof Date},isError:function(t){return null!=t&&t instanceof Error},isMap:function(t){return null!=t&&"object"==typeof t&&t.constructor===Map},isWeakMap:function(t){return null!=t&&"object"==typeof t&&t.constructor===WeakMap},isNumber:h,isPositive:c,isNegative:y,isNotNegative:l,isNil:a,isNullOrUndefined:function(t){return null==t},isNull:p,isUndefined:g,isPlainObject:d,isObject:w,isPromise:m,isRegExp:function(t){return null!=t&&"object"==typeof t&&t.constructor===RegExp},isSet:function(t){return null!=t&&"object"==typeof t&&t.constructor===Set},isWeakSet:function(t){return null!=t&&"object"==typeof t&&t.constructor===WeakSet},isStream:function(t){return null!=t&&"function"==typeof t.pipe},isString:b,isSymbol:N,isPrimitive:function(t){return null!==t&&("string"==typeof t||"number"==typeof t||"boolean"==typeof t)},isInt8Array:O,isUint8Array:$,isUint8ClampedArray:E,isInt16Array:v,isUint16Array:S,isInt32Array:U,isUint32Array:x,isFloat32Array:P,isFloat64Array:j,isBigInt64Array:B,isBigUint64Array:I,isTypedArray:A,isArrayBuffer:T};function i(t){return Array.isArray(t)}function s(t){return"boolean"==typeof t}function u(t){return"function"==typeof t}function f(t){return null!=t&&"object"==typeof t&&!d(t)}function a(t){return null==t}function c(t){return!!h(t)&&t>0}function l(t){return!!h(t)&&t>=0}function y(t){return!!h(t)&&t<0}function p(t){return null===t}function g(t){return void 0===t}function h(t){return null!=t&&"number"==typeof t}function w(t){return null!=t&&"object"==typeof t}function d(t){return null!==t&&"object"==typeof t&&(t.constructor===Object||void 0===t.constructor)}function m(t){return null!=t&&"function"==typeof t.then}function b(t){return null!=t&&"string"==typeof t}function N(t){return null!=t&&"symbol"==typeof t}function A(t){return ArrayBuffer.isView(t)&&t.constructor!==DataView}function O(t){return t instanceof Int8Array}function $(t){return t instanceof Uint8Array}function E(t){return t instanceof Uint8ClampedArray}function v(t){return t instanceof Int16Array}function S(t){return t instanceof Uint16Array}function U(t){return t instanceof Int32Array}function x(t){return t instanceof Uint32Array}function P(t){return t instanceof Float32Array}function j(t){return t instanceof Float64Array}function B(t){return t instanceof BigInt64Array}function I(t){return t instanceof BigUint64Array}function T(t){return t instanceof ArrayBuffer}var L={assertNumber:C,assertPositive:D,assertNegative:function(t,r){if(!y(t))throw new Error(`${r?'"'+r+'" ':" "}Not Negative: ${t}`)},assertNotNegative:F,assertBoolean:function(t,r){if(!s(t))throw new Error(`${r?'"'+r+'" ':" "}Not Boolean: type=${typeof t} value=${JSON.stringify(t)}`)},assertObject:M,assertPlainObject:function(t,r){if(!d(t))throw new Error(`${r?'"'+r+'" ':" "}Not PlainObject: type=${typeof t} value=${JSON.stringify(t)}`)},assertSymbol:function(t,r){if(!N(t))throw new Error(`${r?'"'+r+'" ':" "}Not Symbol: type=${typeof t} value=${JSON.stringify(t)}`)},assertFunction:q,assertInstance:function(t,r){if(!f(t))throw new Error(`${r?'"'+r+'" ':" "}Not Class Instance: type=${typeof t} value=${JSON.stringify(t)}`)},assertPromise:R,assertNil:function(t,r){if(!a(t))throw new Error(`${r?'"'+r+'" ':" "}Neither Null nor Undefined: type=${typeof t} value=${JSON.stringify(t)}`)},assertNotNil:W,assertNull:function(t,r){if(!p(t))throw new Error(`${r?'"'+r+'" ':" "}Not Null: type=${typeof t} value=${JSON.stringify(t)}`)},assertNotNull:function(t,r){if(p(t))throw new Error((r?'"'+r+'" ':" ")+"Should Not Null")},assertUndefined:function(t,r){if(!g(t))throw new Error(`${r?'"'+r+'" ':" "}Not Undefined: type=${typeof t} value=${JSON.stringify(t)}`)},assertString:J,assertArray:k,assertStringOrSymbol:function(t,r){if(!b(t)&&!N(t))throw new Error(`${r?'"'+r+'" ':" "}Not String or Symbol: type=${typeof t} value=${JSON.stringify(t)}`)},assertInt8Array:function(t,r){if(O(t))throw new Error((r?'"'+r+'" ':" ")+"Not Int8Array")},assertUint8Array:function(t,r){if($(t))throw new Error((r?'"'+r+'" ':" ")+"Not Uint8Array")},assertUint8ClampedArray:function(t,r){if(E(t))throw new Error((r?'"'+r+'" ':" ")+"Not Uint8ClampedArray")},assertInt16Array:function(t,r){if(v(t))throw new Error((r?'"'+r+'" ':" ")+"Not Int16Array")},assertUint16Array:function(t,r){if(S(t))throw new Error((r?'"'+r+'" ':" ")+"Not Uint16Array")},assertInt32Array:function(t,r){if(U(t))throw new Error((r?'"'+r+'" ':" ")+"Not Int32Array")},assertUint32Array:function(t,r){if(x(t))throw new Error((r?'"'+r+'" ':" ")+"Not Uint32Array")},assertFloat32Array:function(t,r){if(P(t))throw new Error((r?'"'+r+'" ':" ")+"Not Float32Array")},assertFloat64Array:function(t,r){if(j(t))throw new Error((r?'"'+r+'" ':" ")+"Not Float64Array")},assertBigInt64Array:function(t,r){if(B(t))throw new Error((r?'"'+r+'" ':" ")+"Not BigInt64Array")},assertBigUint64Array:function(t,r){if(I(t))throw new Error((r?'"'+r+'" ':" ")+"Not BigUint64Array")},assertTypedArray:function(t,r){if(A(t))throw new Error((r?'"'+r+'" ':" ")+"Not TypedArray")},assertArrayBuffer:V};function k(t,r){if(!Array.isArray(t))throw new Error(`${r?'"'+r+'" ':" "}Not Array: type=${typeof t} value=${JSON.stringify(t)}`)}function J(t,r){if(!b(t))throw new Error(`${r?'"'+r+'" ':" "}Not String: type=${typeof t} value=${JSON.stringify(t)}`)}function C(t,r){if(!h(t))throw new Error(`${r?'"'+r+'" ':" "}Not Number: type=${typeof t} value=${JSON.stringify(t)}`)}function D(t,r){if(!c(t))throw new Error(`${r?'"'+r+'" ':" "}Not Positive: ${t}`)}function F(t,r){if(!l(t))throw new Error(`${r?'"'+r+'" ':" "}Not "0 or Positive": ${t}`)}function M(t,r){if(!w(t))throw new Error(`${r?'"'+r+'" ':" "}Not Object: type=${typeof t} value=${JSON.stringify(t)}`)}function q(t,r){if(!u(t))throw new Error(`${r?'"'+r+'" ':" "}Not Function: type=${typeof t} value=${JSON.stringify(t)}`)}function R(t,r){if(!m(t))throw new Error(`${r?'"'+r+'" ':" "}Not Promise: type=${typeof t} value=${JSON.stringify(t)}`)}function W(t,r){if(a(t))throw new Error((r?'"'+r+'" ':" ")+"Should Not Nil")}function V(t,r){if(!T(t))throw new Error((r?'"'+r+'" ':" ")+"Not ArrayBuffer")}var H={isEmpty:z,assertNotEmpty:G,isBlank:K,assertNotBlank:function(t){if(K(t))throw new Error(`Blank String: ${t}`)},capitalize:function(t){if(J(t),0===t.length)return t;const r=t.charAt(0),n=r.toUpperCase();return r===n?t:n+t.slice(1)},decapitalize:function(t){if(J(t),0===t.length)return t;const r=t.charAt(0),n=r.toLowerCase();return r===n?t:n+t.slice(1)},splitWithFixedLength:function(t,r,n=" "){if(J(t),C(r),J(n),0===t.length)return[];if(r<=0)throw new Error("length muse >=0");if(t.length<r)return[t.padEnd(r,n)];const e=[];for(let o=0;o<t.length;o+=r){const i=t.substring(o,o+r);e.push(i.padEnd(r,n))}return e},split:function(t,...r){J(t);if(0===t.length)return[];const n=[...r];0===r.length&&r.push(",");const e=Q(t,...n);if(0===e.length)return[];const o=[];let i="",s=0;for(const{marker:r,index:n}of e)i=t.substring(s,n),o.push(i),s=n+r.length;return i=t.substring(s),o.push(i),o},findMarkerPositions:function(t,...r){if(J(t),0===r.length)throw new Error("At least one marker must be provided");const n=[];for(const e of new Set(r)){if(z(e))continue;J(e);let r=t.indexOf(e);for(;-1!==r;)n.push({marker:e,index:r}),r=t.indexOf(e,r+e.length)}return n.sort((t,r)=>t.index-r.index),n},findMarkerPositionsRegex:Q,substringBefore:function(t,r){if(J(t),J(r),0===t.length||0===r.length)return;const n=t.indexOf(r);if(-1===n)return;return t.substring(0,n)},substringBeforeLast:function(t,r){if(J(t),J(r),0===t.length||0===r.length)return;const n=t.lastIndexOf(r);if(-1===n)return;return t.substring(0,n)},substringAfter:function(t,r){if(J(t),J(r),0===t.length||0===r.length)return;const n=t.indexOf(r);if(-1===n)return;return t.substring(n+r.length)},substringAfterLast:function(t,r){if(J(t),J(r),0===t.length||0===r.length)return;const n=t.lastIndexOf(r);if(-1===n)return;return t.substring(n+r.length)},substringBetween:function(t,r,n){G(t),G(r),G(n);const e=t.indexOf(r);if(-1===e)return;const o=t.indexOf(n,e+r.length);if(-1===o)return;return t.substring(e+r.length,o)},substringBetweenGreedy:function(t,r,n){G(t),G(r),G(n);const e=t.indexOf(r);if(-1===e)return;const o=t.lastIndexOf(n);if(-1===o||o<=e)return;return t.substring(e+r.length,o)},substringsBetween:function(t,r,n){G(t),G(r),G(n);const e=[];let o=0;for(;;){const i=t.indexOf(r,o);if(-1===i)break;const s=t.indexOf(n,i+r.length);if(-1===s)break;e.push(t.substring(i+r.length,s)),o=s+n.length}return e}};function z(t){return null==t||(J(t),0===t.length)}function G(t){if(z(t))throw new Error(`Empty String: ${t}`)}function K(t){return null==t||(J(t),0===t.trim().length)}function Q(t,...r){if(J(t),0===r.length)throw new Error("At least one marker must be provided");const n=[...new Set(r.filter(t=>null!=t))].map(t=>(J(t),t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))),e=new RegExp(n.map(t=>`(${t})`).join("|"),"g"),o=[];let i=null;for(;null!==(i=e.exec(t));){for(let t=1;t<i.length;t++)if(i[t]){o.push({marker:r[t-1],index:i.index});break}0===i[0].length&&e.lastIndex++}return o}var X={quiet:function(t){q(t);try{const r=t();return m(r)?r.catch(()=>{}):r}catch(t){}},quietKeepError:function(t,r){q(t),k(r);try{const n=t();return m(n)?n.catch(t=>r.push(t)):n}catch(t){r.push(t)}}},Y={defer:Z,delay:function(t,r){h(t)?(r=t,t=Promise.resolve()):null==t&&null==r&&(r=1,t=Promise.resolve());null!=t&&R(t),C(r=r??1e3);const n=Z(),e=Date.now();return t.then((...t)=>{const o=Date.now()-e;o<r?setTimeout(()=>n.resolve(...t),r-o):n.resolve(...t)}).catch(t=>{const o=Date.now()-e;o<r?setTimeout(()=>n.reject(t),r-o):n.reject(t)}),n.promise},timeout:function(t,r,n){R(t),C(r=r??1);const e=Z(r,n),o=Date.now();return t.then((...t)=>{Date.now()-o<=r?e.resolve(...t):e.reject(new Error(n??`Promise Timeout: ${r}ms`))}).catch(t=>{!e.resolved&&!e.rejected&&e.reject(t)}),e.promise},allSettled:_,returnValuePromised:tt,series:async function(t){k(t);const r=[];for(const n of t)q(n),r.push(await n());return r},seriesAllSettled:async function(t){k(t);const r=[];for(const n of t){q(n);try{r.push({ok:!0,result:await n()})}catch(t){r.push({ok:!1,result:t})}}return r},parallel:async function(t,r=5){if(k(t),C(r),r<=0)throw new Error(`Invalid maxParallel: ${r}, should > 0`);t.forEach(t=>q(t));const n=[];if(t.length<=r){const r=await Promise.all(t.map(t=>tt(t)));return n.push(...r),n}const e=[];for(const o of t)if(q(o),e.push(o),e.length>=r){const t=await Promise.all(e.map(t=>tt(t)));n.push(...t),e.length=0}if(e.length>0&&e.length<r){const t=await Promise.all(e.map(t=>tt(t)));n.push(...t)}return n},parallelAllSettled:async function(t,r=5){if(k(t),C(r),r<=0)throw new Error(`Invalid maxParallel: ${r}, should > 0`);t.forEach(t=>q(t));const n=[];if(t.length<=r){const r=await _(t.map(t=>tt(t)));return n.push(...r),n}const e=[];for(const o of t)if(q(o),e.push(o),e.length>=r){const t=await _(e.map(t=>tt(t)));n.push(...t),e.length=0}if(e.length>0&&e.length<r){const t=await _(e.map(t=>tt(t)));n.push(...t)}return n}};function Z(t=-1,r){C(t);const n={};let e;return t>=0&&(n.timerHandler=e=setTimeout(()=>{clearTimeout(e),n.timerCleared=!0,n.reject(new Error(r??`Promise Timeout: ${t}ms`))},t)),n.promise=new Promise((t,r)=>{n.resolve=r=>{null!=e&&(clearTimeout(e),n.timerCleared=!0),n.resolved=!0,t(r)},n.reject=t=>{null!=e&&(clearTimeout(e),n.timerCleared=!0),n.rejected=!0,r(t)}}),n.promise.cancel=()=>{null!=e&&(clearTimeout(e),n.timerCleared=!0),n.rejected=!0,n.canceled=n.promise.canceled=!0,n.reject(new Error("Cancelled"))},n}async function _(t){k(t);const r=await Promise.allSettled(t),n=[];for(const t of r)"fulfilled"===t.status&&n.push({ok:!0,result:t.value}),"rejected"===t.status&&n.push({ok:!1,result:t.reason});return n}function tt(t){try{const r=t();return m(r)?r:Promise.resolve(r)}catch(t){return Promise.reject(t)}}const{isPlainObject:rt}=o;var nt={proxy:et,newProxyInstance:function(t,r,n,e=!0){const o=et(t,n,e);return Reflect.construct(o,r??[])}};function et(t,r,n=!0){if("function"!=typeof t)throw new TypeError(`Not Class: type=${typeof t}, value=${JSON.stringify(t)}`);if(null!=r){if(!rt(r))throw new TypeError(`Not PropertyHandler: type=${typeof r}, value=${JSON.stringify(r)}`);const{get:t,set:n}=r;if(null!=t&&"function"!=typeof t)throw new TypeError(`Not PropertyHandler.get: type=${typeof t}, value=${JSON.stringify(t)}`);if(null!=n&&"function"!=typeof n)throw new TypeError(`Not PropertyHandler.set: type=${typeof n}, value=${JSON.stringify(n)}`)}const e={construct(t,e,o){const i=Reflect.construct(t,e);return new Proxy(n?Object.preventExtensions(i):i,r??{})}};return new Proxy(t,e)}var ot={proxy:function(t,r,n=!0){if(a(t)||!w(t)||i(t))throw new TypeError(`Not Object: type=${typeof t}, value=${JSON.stringify(t)}`);return new Proxy(n?Object.preventExtensions(t):t,r??{})}};function it(t){M(t,"obj");const r=new Set;let n=t;for(;n&&n!==Object.prototype;){const e=Object.getOwnPropertyNames(n);for(const n of e)"constructor"!==n&&"function"==typeof t[n]&&r.add(n);n=Object.getPrototypeOf(n)}return[...new Set(r)]}var st={getMethodsOfClass:function(t){q(t,"cls");const r=new Set;let n=t.prototype;for(;n&&n!==Object.prototype;){const t=Object.getOwnPropertyNames(n);for(const e of t)"constructor"!==e&&"function"==typeof n[e]&&r.add(e);n=Object.getPrototypeOf(n)}return[...new Set(r)]},getStaticMethodsOfClass:function(t){q(t,"cls");const r=new Set;let n=t;for(;n&&n!==Object.getPrototypeOf(Object);){const t=Object.getOwnPropertyNames(n);for(const e of t)"function"==typeof n[e]&&r.add(e);n=Object.getPrototypeOf(n)}return[...r]},getMethods:it,getMethodsOfObject:it},ut={startsWith:function(t,r){W(t,"src"),W(r,"searching");return at(t.subarray(0,r.length),r)},isSameType:ft,equals:at};function ft(t,n){return W(t,"src"),W(n,"target"),r(t)===r(n)}function at(t,r){if(W(t,"src"),W(r,"target"),!ft(t,r))return!1;if(t.byteLength!==r.byteLength)return!1;const n=new DataView(t.buffer,t.byteOffset,t.byteLength),e=new DataView(r.buffer,r.byteOffset,r.byteLength);for(let r=0;r<t.byteLength;r++)if(n.getUint8(r)!==e.getUint8(r))return!1;return!0}var ct={readString:function(t,r=0,n){if(V(t),F(r),r>=t.byteLength)return;let e=null;null!=n?(D(n),e=r+n>=t.byteLength?new Uint8Array(t,r):new Uint8Array(t,r,n)):e=new Uint8Array(t,r);return lt.decode(e)},writeString:function(t,r,n=0){V(t,"buffer"),J(r,"str"),F(n,"offset");const e=yt.encode(r),o=e.byteLength;if(n+o>t.byteLength)throw new Error(`offset + str.byteLength > buffer.byteLength:${n+o} > ${t.byteLength}`);new Uint8Array(t,n,e.byteLength).set(e)},writeArrayBuffer:function(t,r,n=0,e=0,o){V(t),V(r),C(n),C(e);const i=t.byteLength;if(n<-1*i)n=0;else if(n<0)n+=i;else if(n>=i)throw new Error(`Out of target Bounds: targetOffset(${n}) >= targetLength(${i})`);const s=r.byteLength;if(e<-1*s)e=0;else if(e<0)e+=s;else if(e>=s)throw new Error(`Out of data Bounds: dataOffset(${e}) >= dataArrayBufferLength(${s})`);null!=o&&(D(o,"dataLength"),e+o>s&&(o=void 0));const u=new Uint8Array(r,e,o);if(u.byteLength>i-n)throw new Error(`Out of target Bounds: from targetOffset(${n}), No Space to store dataArrayBuffer(${e}, ${o??"NoLimit"})`);new Uint8Array(t).set(u,n)}};const lt=new TextDecoder,yt=new TextEncoder;const pt=1e6;var gt={s2ns:1e9,ms2ns:pt,timestamp64:ht,lapseNano:wt,lapseMillis:dt,timeoutNano:function(t,r){return wt(t)>r},timeoutMillis:function(t,r){return dt(t)>r}};function ht(){if("undefined"!=typeof performance&&"number"==typeof performance.timeOrigin){const t=performance.timeOrigin,r=performance.now();return BigInt((t+r)*pt)}return BigInt(Date.now()*pt)}function wt(t,r){return(r??ht())-t}function dt(t,r){r=r??ht();return BigInt(r-t)/BigInt(pt)}var mt={first:function(t,r){return k(t,"arr"),t[0]??r},last:function(t,r){return k(t,"arr"),t[t.length-1]??r},equals:function(t,r,n){if(!Array.isArray(t)||!Array.isArray(r))return!1;if(t.length!==r.length)return!1;for(let e=0;e<t.length;e++)if(n){if(0!==n(t[e],r[e]))return!1}else if(t[e]!==r[e])return!1;return!0},equalsIgnoreOrder:function(t,r,n){if(!Array.isArray(t)||!Array.isArray(r))return!1;if(t.length!==r.length)return!1;t.sort(n),r.sort(n);for(let e=0;e<t.length;e++)if(n){if(0!==n(t[e],r[e]))return!1}else if(t[e]!==r[e])return!1;return!0}};var bt={LangUtils:t,StringUtils:H,TypeUtils:o,TypeAssert:L,ExecUtils:X,PromiseUtils:Y,Lang:t,Type:o,Exec:X,ClassProxyUtils:nt,InstanceProxyUtils:ot,ReflectUtils:st,TypedArrayUtils:ut,ArrayBufferUtils:ct,TimeUtils:gt,ArrayUtils:mt};export{ct as ArrayBufferUtils,mt as ArrayUtils,nt as ClassProxyUtils,X as Exec,X as ExecUtils,ot as InstanceProxyUtils,t as Lang,t as LangUtils,Y as PromiseUtils,st as ReflectUtils,H as StringUtils,gt as TimeUtils,o as Type,L as TypeAssert,o as TypeUtils,ut as TypedArrayUtils,bt as default};
2
2
  //# sourceMappingURL=index-min.js.map