@creejs/commons-lang 2.1.25 → 2.1.26

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