@flemist/simple-utils 1.0.3 → 1.0.4
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/build/browser/index.cjs +1 -1
- package/build/browser/index.mjs +1 -1
- package/build/common/index.cjs +1 -1
- package/build/common/index.mjs +1 -1
- package/build/common/string/format/formatAny.d.ts +3 -2
- package/build/node/index.cjs +1 -1
- package/build/node/index.mjs +1 -1
- package/build/{urlGet-Dr4stTPz.js → urlGet-CyEem81y.js} +1 -1
- package/build/{urlGet-CW30yZvt.mjs → urlGet-D67uJSsb.mjs} +3 -3
- package/package.json +1 -1
package/build/browser/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../urlGet-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../urlGet-CyEem81y.js");exports.ConsoleMessageLevel=e.ConsoleMessageLevel;exports.Lazy=e.Lazy;exports.LazyWithId=e.LazyWithId;exports.Random=e.Random;exports.UNIQUE_PSEUDO_RANDOM_MAX_COUNT=e.UNIQUE_PSEUDO_RANDOM_MAX_COUNT;exports.alertReplace=e.alertReplace;exports.consoleReplace=e.consoleReplace;exports.convertTimeZone=e.convertTimeZone;exports.createUniquePseudoRandom=e.createUniquePseudoRandom;exports.dateNowUnique=e.dateNowUnique;exports.deepCloneJsonLike=e.deepCloneJsonLike;exports.deepEqualJsonLike=e.deepEqualJsonLike;exports.deepEqualJsonLikeMap=e.deepEqualJsonLikeMap;exports.equalArray=e.equalArray;exports.escapeHtml=e.escapeHtml;exports.escapeRegExp=e.escapeRegExp;exports.fixStackTrace=e.fixStackTrace;exports.formatAny=e.formatAny;exports.formatDate=e.formatDate;exports.formatDateFileName=e.formatDateFileName;exports.getDateInet=e.getDateInet;exports.getNormalizedObject=e.getNormalizedObject;exports.getRandomFunc=e.getRandomFunc;exports.getRandomSeed=e.getRandomSeed;exports.getStackTrace=e.getStackTrace;exports.max=e.max;exports.min=e.min;exports.minMax=e.minMax;exports.numberMod=e.numberMod;exports.randomBoolean=e.randomBoolean;exports.randomEnum=e.randomEnum;exports.randomFloat=e.randomFloat;exports.randomIndexWeighted=e.randomIndexWeighted;exports.randomInt=e.randomInt;exports.randomItem=e.randomItem;exports.randomItems=e.randomItems;exports.sha256=e.sha256;exports.sha256Buffer=e.sha256Buffer;exports.timeoutAbortController=e.timeoutAbortController;exports.toHex=e.toHex;exports.urlGetBoolean=e.urlGetBoolean;exports.urlGetFloat=e.urlGetFloat;exports.urlGetInt=e.urlGetInt;exports.urlGetParams=e.urlGetParams;exports.urlGetString=e.urlGetString;exports.urlParamToBoolean=e.urlParamToBoolean;exports.urlParamToFloat=e.urlParamToFloat;exports.urlParamToInt=e.urlParamToInt;exports.withConsoleReplace=e.withConsoleReplace;exports.withTimeout=e.withTimeout;
|
package/build/browser/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as s, M as o, N as t, R as n, U as r, E as m, G as l, q as d, l as u, o as i, z as c, A as p, B as g, C as I, x as R, y as T, I as f, u as x, v as h, w as E, p as L, D as M, d as N, g as P, J as U, b as k, m as q, c as A, n as C, f as D, k as F, r as G, h as S, e as y, i as B, j as O, a as b, s as w, K as z, t as J, V as _, X as v, W as H, O as W, T as j, P as Q, S as X, Q as K, H as V, L as Z } from "../urlGet-
|
|
1
|
+
import { F as s, M as o, N as t, R as n, U as r, E as m, G as l, q as d, l as u, o as i, z as c, A as p, B as g, C as I, x as R, y as T, I as f, u as x, v as h, w as E, p as L, D as M, d as N, g as P, J as U, b as k, m as q, c as A, n as C, f as D, k as F, r as G, h as S, e as y, i as B, j as O, a as b, s as w, K as z, t as J, V as _, X as v, W as H, O as W, T as j, P as Q, S as X, Q as K, H as V, L as Z } from "../urlGet-D67uJSsb.mjs";
|
|
2
2
|
export {
|
|
3
3
|
s as ConsoleMessageLevel,
|
|
4
4
|
o as Lazy,
|
package/build/common/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../urlGet-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../urlGet-CyEem81y.js");exports.ConsoleMessageLevel=e.ConsoleMessageLevel;exports.Lazy=e.Lazy;exports.LazyWithId=e.LazyWithId;exports.Random=e.Random;exports.UNIQUE_PSEUDO_RANDOM_MAX_COUNT=e.UNIQUE_PSEUDO_RANDOM_MAX_COUNT;exports.alertReplace=e.alertReplace;exports.consoleReplace=e.consoleReplace;exports.convertTimeZone=e.convertTimeZone;exports.createUniquePseudoRandom=e.createUniquePseudoRandom;exports.dateNowUnique=e.dateNowUnique;exports.deepCloneJsonLike=e.deepCloneJsonLike;exports.deepEqualJsonLike=e.deepEqualJsonLike;exports.deepEqualJsonLikeMap=e.deepEqualJsonLikeMap;exports.equalArray=e.equalArray;exports.escapeHtml=e.escapeHtml;exports.escapeRegExp=e.escapeRegExp;exports.fixStackTrace=e.fixStackTrace;exports.formatAny=e.formatAny;exports.formatDate=e.formatDate;exports.formatDateFileName=e.formatDateFileName;exports.getDateInet=e.getDateInet;exports.getNormalizedObject=e.getNormalizedObject;exports.getRandomFunc=e.getRandomFunc;exports.getRandomSeed=e.getRandomSeed;exports.getStackTrace=e.getStackTrace;exports.max=e.max;exports.min=e.min;exports.minMax=e.minMax;exports.numberMod=e.numberMod;exports.randomBoolean=e.randomBoolean;exports.randomEnum=e.randomEnum;exports.randomFloat=e.randomFloat;exports.randomIndexWeighted=e.randomIndexWeighted;exports.randomInt=e.randomInt;exports.randomItem=e.randomItem;exports.randomItems=e.randomItems;exports.sha256=e.sha256;exports.sha256Buffer=e.sha256Buffer;exports.timeoutAbortController=e.timeoutAbortController;exports.toHex=e.toHex;exports.urlGetBoolean=e.urlGetBoolean;exports.urlGetFloat=e.urlGetFloat;exports.urlGetInt=e.urlGetInt;exports.urlGetParams=e.urlGetParams;exports.urlGetString=e.urlGetString;exports.urlParamToBoolean=e.urlParamToBoolean;exports.urlParamToFloat=e.urlParamToFloat;exports.urlParamToInt=e.urlParamToInt;exports.withConsoleReplace=e.withConsoleReplace;exports.withTimeout=e.withTimeout;
|
package/build/common/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as s, M as o, N as t, R as n, U as r, E as m, G as l, q as d, l as u, o as i, z as c, A as p, B as g, C as I, x as R, y as T, I as f, u as x, v as h, w as E, p as L, D as M, d as N, g as P, J as U, b as k, m as q, c as A, n as C, f as D, k as F, r as G, h as S, e as y, i as B, j as O, a as b, s as w, K as z, t as J, V as _, X as v, W as H, O as W, T as j, P as Q, S as X, Q as K, H as V, L as Z } from "../urlGet-
|
|
1
|
+
import { F as s, M as o, N as t, R as n, U as r, E as m, G as l, q as d, l as u, o as i, z as c, A as p, B as g, C as I, x as R, y as T, I as f, u as x, v as h, w as E, p as L, D as M, d as N, g as P, J as U, b as k, m as q, c as A, n as C, f as D, k as F, r as G, h as S, e as y, i as B, j as O, a as b, s as w, K as z, t as J, V as _, X as v, W as H, O as W, T as j, P as Q, S as X, Q as K, H as V, L as Z } from "../urlGet-D67uJSsb.mjs";
|
|
2
2
|
export {
|
|
3
3
|
s as ConsoleMessageLevel,
|
|
4
4
|
o as Lazy,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type FormatAnyOptions = {
|
|
2
2
|
pretty?: boolean;
|
|
3
3
|
filter?: null | ((path: string[], value: any) => boolean);
|
|
4
4
|
maxDepth?: number;
|
|
@@ -6,4 +6,5 @@ export declare function formatAny(obj: any, options?: {
|
|
|
6
6
|
showObjectId?: boolean;
|
|
7
7
|
showArrayIndex?: boolean;
|
|
8
8
|
customToString?: null | ((obj: any, toString: (obj: any) => any) => string | null | undefined | void);
|
|
9
|
-
}
|
|
9
|
+
};
|
|
10
|
+
export declare function formatAny(obj: any, options?: null | FormatAnyOptions, path?: null | string[], visited?: null | Set<any>): string;
|
package/build/node/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../urlGet-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../urlGet-CyEem81y.js"),N=require("@flemist/async-utils"),S=require("@flemist/time-limits"),b=require("node:os"),V=require("path"),W=require("@flemist/priority-queue"),ee=require("fs"),te=require("picomatch");function j(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const i=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(n,a,i.get?i:{enumerable:!0,get:()=>e[a]})}}return n.default=e,Object.freeze(n)}const w=j(V),z=j(ee),g=new S.Pool(b.cpus().length);function x(e){return e.replace(/\\/g,"/")}let I=null;function ne(e){I==null&&(I=new Map);const n=x(e);let a=I.get(n);return a==null&&(a=new N.Locker,I.set(n,a)),a}function re(e){const{filePath:n,func:a}=e;return ne(n).lock(()=>S.poolRunWait({pool:g,count:1,func:a}))}function B(e){return e.match(/^[/\\]?[^/\\]+/)[0]}function H(e,n){return B(e)+"|"+n.ino}function $(e){return e.endsWith(":")&&(e+="/"),w.resolve(e)}function _(e,n){e.totalSize+=n.totalSize,e.maxFileDateModified=Math.max(e.maxFileDateModified,n.maxFileDateModified),e.countFiles+=n.countFiles,e.countDirs+=n.countDirs,e.countLinks+=n.countLinks}const J=function(n){return n.code==="ENOENT"};function Q(e){const n=e.paths;if(!n||n.length===0)return Promise.resolve({totalSize:0,maxFileDateModified:0,countFiles:0,countDirs:0,countLinks:0});const a=e.level??0,i=e.walkedIds??new Set,r=e.abortSignal,u=e.pool??g,p=e.handleError,d=e.priority??W.priorityCreate(0),c=e.walkLinks??!1,m=e.log,F=e.handlePath,C=e.matchPath;async function R(L){if(!(p&&await p(L))&&!J(L))throw L}function Y(L){return!(!m||m.minTotalContentSize!=null&&L<m.minTotalContentSize||m.maxNestedLevel!=null&&a>m.maxNestedLevel)}return N.useAbortController(async L=>{const E=N.combineAbortSignals(r,L),T={totalSize:0,maxFileDateModified:0,countFiles:0,countDirs:0,countLinks:0};function q(f,y){if(Y(y.totalSize)){const s=`${y.totalSize.toLocaleString("en-US").replace(/,/g," ").padStart(19)}: ${f}`;m?.handleLog?m.handleLog(s):console.log(s)}}async function G(f,y,k,s){return F?await S.poolRunWait({pool:u,func:async()=>{try{return await F({level:a,path:f,stat:y,itemStat:k,totalStat:T,abortSignal:E})}catch(l){return await R(l),!1}},count:1,priority:s,abortSignal:E}):!0}async function O(f,y,k,s){s||(s=f);const l=await S.poolRunWait({pool:u,func:()=>z.promises.lstat(f).catch(R),count:1,priority:W.priorityCreate(y,W.priorityCreate(1,d)),abortSignal:E});if(!l||!k&&l.isFile())return null;const U=H(f,l);if(i.has(U))return null;i.add(U);let o={totalSize:l.size,maxFileDateModified:l.isDirectory()?0:l.mtimeMs,countFiles:0,countDirs:0,countLinks:0};const M=W.priorityCreate(y,W.priorityCreate(l.isDirectory()?2:3,d));if(l.isSymbolicLink()){if(c){const h=await S.poolRunWait({pool:u,func:()=>z.promises.readlink(f).catch(R).then(D=>D??null),count:1,priority:M,abortSignal:E});if(h){const D=w.isAbsolute(h)?h:w.resolve(w.dirname(s),h),v=await O(D,y,k,s);v&&(o=v)}}return(k||o.countFiles+o.countDirs+o.countLinks>=1)&&(o.countLinks+=1,await G(s,l,o,M)&&(_(T,o),q(s,o))),o}else if(l.isDirectory()){const h=await S.poolRunWait({pool:u,func:()=>z.promises.readdir(f).catch(R),count:1,priority:d,abortSignal:E});if(h){for(let D=0,v=h.length;D<v;D++)h[D]=w.join(s,h[D]);o=await Q({...e,paths:h,abortSignal:E,priority:M,level:a+1,walkedIds:i})}}return(k||o.countFiles+o.countDirs+o.countLinks>=1)&&(l.isDirectory()?o.countDirs+=1:l.isFile()&&(o.countFiles+=1),await G(s,l,o,M)&&(_(T,o),q(s,o))),o}const A=[];for(let f=0,y=n.length;f<y;f++){const k=$(n[f]),s=C?C(k):!0;s!==!1&&A.push(O(k,f,s))}return await Promise.all(A),T})}function ae(e){return Q(e)}function ie({globs:e,rootDir:n,noCase:a}){const i=[];return e.forEach(r=>{r=x(r).trim();const u=r.startsWith("^");u&&(r=r.substring(1).trim());const p=r.startsWith("!");if(p&&(r=r.substring(1).trim()),r.startsWith("!")||r.startsWith("^"))throw new Error(`Invalid glob pattern: "${r}". The syntax '${r.substring(0,2)}' is not supported. Valid glob patterns use: * (match any characters), ** (match any directories), ? (match single character), [abc] (character class), ! (negate pattern), ^ (exclude if included). Examples of valid patterns: "*.js", "src/**/*.ts", "!node_modules", "^dist". Avoid starting with '!' after '^' or multiple special prefixes.`);r.startsWith("/")&&(r="."+r);const d=x(n?w.resolve(n,r):r);if(!d)return;let c;try{c=te(d,{nocase:a??!1,dot:!0,strictBrackets:!0})}catch(m){throw new Error(`Invalid glob pattern: "${r}". ${m instanceof Error?m.message:"Unknown error"}. Valid glob patterns use: * (match any characters), ** (match any directories), ? (match single character), [abc] (character class with balanced brackets), ! (negate pattern), ^ (exclude if included). Examples: "*.js", "src/**/*.ts", "!node_modules", "[abc]def.txt". Ensure all brackets [ ] are properly closed and balanced.`)}i.push({exclude:u,negative:p,debugInfo:d,match:c})}),function(u){u=x(u);let p=null,d=!1;for(let c=0,m=i.length;c<m;c++){const F=i[c];F.match(u)&&(F.exclude?d=!F.negative:(p=!F.negative,d=!1))}return d?!1:p}}function X(e){const n=e.startsWith("!");return n&&(e=e.substring(1)),e.startsWith("/")?e=e.substring(1):!e.startsWith("**")&&!e.startsWith("../")&&(e=`**/${e}`),n&&(e="!"+e),e}function Z(e,n){if(!n||n===".")return e;const a=e.startsWith("^");a&&(e=e.substring(1));const i=e.startsWith("!");return i&&(e=e.substring(1)),e.startsWith("/")?(n.endsWith("/")&&(n=n.substring(0,n.length-1)),e=n+e):(n.endsWith("/")||(n+="/"),e.startsWith("./")?e=n+e.substring(2):e.startsWith("../")?e=n+e:(n.startsWith("..")&&(n=""),e.startsWith("**")?e=n+e:e=n+"**/"+e)),e=x(w.normalize(e)),i&&(e="!"+e),a&&(e="^"+e),e}function P(e){return"^"+e}async function K(e){const a=(await z.promises.readFile(e,"utf-8")).split(`
|
|
2
2
|
`),i=[];return a.forEach(r=>{r=r.trim(),!(!r||r.startsWith("#"))&&i.push(r)}),i}async function oe(e){const n=e.rootDir??".",a=[];if(!e.globs?.length)return a;const i=[];return e.globs.forEach(r=>{r.value&&(r.valueType==="file-contains-patterns"?i.push(r):r.valueType==="pattern"&&a.push(r.exclude?P(r.value):r.value))}),i.length&&await Promise.all(i.map(async r=>{await S.poolRunWait({pool:g,count:1,func:async()=>{const u=w.resolve(n,r.value),p=await K(u),d=w.relative(n,w.dirname(u));p.forEach(c=>{c=X(c),c=Z(c,d),a.push(r.exclude?P(c):c)})}})})),a}exports.ConsoleMessageLevel=t.ConsoleMessageLevel;exports.Lazy=t.Lazy;exports.LazyWithId=t.LazyWithId;exports.Random=t.Random;exports.UNIQUE_PSEUDO_RANDOM_MAX_COUNT=t.UNIQUE_PSEUDO_RANDOM_MAX_COUNT;exports.alertReplace=t.alertReplace;exports.consoleReplace=t.consoleReplace;exports.convertTimeZone=t.convertTimeZone;exports.createUniquePseudoRandom=t.createUniquePseudoRandom;exports.dateNowUnique=t.dateNowUnique;exports.deepCloneJsonLike=t.deepCloneJsonLike;exports.deepEqualJsonLike=t.deepEqualJsonLike;exports.deepEqualJsonLikeMap=t.deepEqualJsonLikeMap;exports.equalArray=t.equalArray;exports.escapeHtml=t.escapeHtml;exports.escapeRegExp=t.escapeRegExp;exports.fixStackTrace=t.fixStackTrace;exports.formatAny=t.formatAny;exports.formatDate=t.formatDate;exports.formatDateFileName=t.formatDateFileName;exports.getDateInet=t.getDateInet;exports.getNormalizedObject=t.getNormalizedObject;exports.getRandomFunc=t.getRandomFunc;exports.getRandomSeed=t.getRandomSeed;exports.getStackTrace=t.getStackTrace;exports.max=t.max;exports.min=t.min;exports.minMax=t.minMax;exports.numberMod=t.numberMod;exports.randomBoolean=t.randomBoolean;exports.randomEnum=t.randomEnum;exports.randomFloat=t.randomFloat;exports.randomIndexWeighted=t.randomIndexWeighted;exports.randomInt=t.randomInt;exports.randomItem=t.randomItem;exports.randomItems=t.randomItems;exports.sha256=t.sha256;exports.sha256Buffer=t.sha256Buffer;exports.timeoutAbortController=t.timeoutAbortController;exports.toHex=t.toHex;exports.urlGetBoolean=t.urlGetBoolean;exports.urlGetFloat=t.urlGetFloat;exports.urlGetInt=t.urlGetInt;exports.urlGetParams=t.urlGetParams;exports.urlGetString=t.urlGetString;exports.urlParamToBoolean=t.urlParamToBoolean;exports.urlParamToFloat=t.urlParamToFloat;exports.urlParamToInt=t.urlParamToInt;exports.withConsoleReplace=t.withConsoleReplace;exports.withTimeout=t.withTimeout;exports.createMatchPath=ie;exports.fileLock=re;exports.getDrive=B;exports.getFileId=H;exports.globGitIgnoreToPicomatch=X;exports.globToRelative=Z;exports.loadGlobs=oe;exports.loadGlobsFromFile=K;exports.pathNormalize=x;exports.pathResolve=$;exports.poolFs=g;exports.walkPathHandleErrorDefault=J;exports.walkPaths=ae;
|
package/build/node/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as mt, M as ht, N as pt, R as kt, U as wt, E as yt, G as xt, q as Lt, l as Dt, o as Ft, z as St, A as Et, B as Wt, C as zt, x as vt, y as Mt, I as Tt, u as It, v as Rt, w as Ct, p as Nt, D as At, d as Gt, g as Ut, J as Ot, b as $t, m as qt, c as Bt, n as _t, f as jt, k as Ht, r as Jt, h as Pt, e as Qt, i as Xt, j as gt, a as Kt, s as Zt, K as Yt, t as Vt, V as bt, X as te, W as ee, O as ne, T as se, P as ae, S as re, Q as ie, H as oe, L as ce } from "../urlGet-
|
|
1
|
+
import { F as mt, M as ht, N as pt, R as kt, U as wt, E as yt, G as xt, q as Lt, l as Dt, o as Ft, z as St, A as Et, B as Wt, C as zt, x as vt, y as Mt, I as Tt, u as It, v as Rt, w as Ct, p as Nt, D as At, d as Gt, g as Ut, J as Ot, b as $t, m as qt, c as Bt, n as _t, f as jt, k as Ht, r as Jt, h as Pt, e as Qt, i as Xt, j as gt, a as Kt, s as Zt, K as Yt, t as Vt, V as bt, X as te, W as ee, O as ne, T as se, P as ae, S as re, Q as ie, H as oe, L as ce } from "../urlGet-D67uJSsb.mjs";
|
|
2
2
|
import { Locker as j, useAbortController as H, combineAbortSignals as J } from "@flemist/async-utils";
|
|
3
3
|
import { Pool as P, poolRunWait as F } from "@flemist/time-limits";
|
|
4
4
|
import Q from "node:os";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const F=require("@flemist/abort-controller-fast"),Z=require("@flemist/async-utils"),$t=require("@flemist/time-controller");let L=null;function At(){if(!L){L=new Array(256);for(let t=0;t<256;t++)L[t]=t.toString(16).padStart(2,"0")}return L}function it(t){const e=At(),r=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);let n="";for(let o=0,i=r.length;o<i;o++)n+=e[r[o]];return n}let X=null,st=null,q=null,ut=null;function Tt(){X||(X=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),st=new Uint32Array(64),ut=new TextEncoder,q=new Uint8Array(65536))}function lt(t){if(t==null)return null;Tt();const e=X,r=st,n=ut;let o=q,i;if(typeof t=="string"){const h=t.length*3;o.length<h+128&&(o=q=new Uint8Array(h+128));const c=n.encodeInto(t,o);i=o.subarray(0,c.written)}else if(t instanceof Uint8Array)i=t;else if(ArrayBuffer.isView(t))i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);else throw new Error(`[sha256Buffer] Unsupported content type: ${typeof t}`);const m=i.length,a=m+72>>>6<<6;o.length<a&&(o=q=new Uint8Array(a)),i!==o&&o.set(i),o[m]=128;for(let h=m+1;h<a;h++)o[h]=0;const A=m*8,C=A/4294967296|0,T=A|0;o[a-8]=C>>>24,o[a-7]=C>>>16,o[a-6]=C>>>8,o[a-5]=C,o[a-4]=T>>>24,o[a-3]=T>>>16,o[a-2]=T>>>8,o[a-1]=T;let U=1779033703,u=-1150833019,s=1013904242,l=-1521486534,y=1359893119,d=-1694144372,g=528734635,w=1541459225;for(let h=0;h<a;h+=64){for(let f=0;f<16;f++){const p=h+(f<<2);r[f]=o[p]<<24|o[p+1]<<16|o[p+2]<<8|o[p+3]}for(let f=16;f<64;f++){const p=r[f-15],$=r[f-2],b=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,D=($>>>17|$<<15)^($>>>19|$<<13)^$>>>10;r[f]=r[f-16]+b+r[f-7]+D|0}let c=U,_=u,N=s,H=l,O=y,P=d,k=g,W=w;for(let f=0;f<64;f+=4)for(let p=0;p<4;p++){const $=f+p,b=(O>>>6|O<<26)^(O>>>11|O<<21)^(O>>>25|O<<7),D=W+b+(k^O&(P^k))+e[$]+r[$]|0,Ut=((c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10))+(c&_^N&(c^_))|0;W=k,k=P,P=O,O=H+D|0,H=N,N=_,_=c,c=D+Ut|0}U=U+c|0,u=u+_|0,s=s+N|0,l=l+H|0,y=y+O|0,d=d+P|0,g=g+k|0,w=w+W|0}const S=new Uint8Array(32),G=[U,u,s,l,y,d,g,w];for(let h=0;h<8;h++){const c=G[h],_=h<<2;S[_]=c>>>24,S[_+1]=c>>>16&255,S[_+2]=c>>>8&255,S[_+3]=c&255}return S}function Et(t){const e=lt(t);return e?it(e):null}function at(t,e){return t==null?e:e==null?t:Math.min(t,e)}function ct(t,e){return t==null?e:e==null?t:Math.max(t,e)}function Ct(t,e,r){return ct(at(t,e),r)}function Rt(t,e){return(t%e+e)%e}function It(t){return function(){let r=t+=1831565813;return r=Math.imul(r^r>>>15,r|1),r^=r+Math.imul(r^r>>>7,r|61),(r^r>>>14)/4294967296+.5}}function kt(){return Math.random()}function xt(){return Math.random()*2**32>>>0}function ft(t){return t!=null?It(t):kt}class V{_seed;_rnd;constructor(e){this._seed=e,this._rnd=ft(e)}get seed(){return this._seed}nextSeed(){return this.next()*2**32>>>0}nextRandom(){return new V(this.nextSeed())}next(){return this._rnd()}clone(){return new V(this._seed)}}function K(t,e,r){if(r==null&&(r=e,e=0),r<=e)throw new Error(`[random][randomFloat] toExclusive (${r}) must be greater than from (${e})`);return t.next()*(r-e)+e}function ht(t,e,r){return Math.floor(K(t,e,r))}function Mt(t,e){return t.next()<(e??.5)}function Nt(t,e,r){if(Array.isArray(e)){const i=e;e=i.length,r=m=>i[m]}if(!r)throw new Error("[random][randomIndexWeighted] getWeight is required");let n=0;for(let i=0;i<e;i++)n+=r(i);if(n===0)return-1;let o=K(t,n);for(let i=0;i<e;i++)if(o-=r(i),o<0)return i;return e-1}function v(t,e){if(e.length===0)throw new Error("[random][randomItem] items is empty");const r=ht(t,e.length);return e[r]}function Pt(t,e,r){if(e.length===0)throw new Error("[random][randomItems] items is empty");const n=[];for(let o=0;o<r;o++)n.push(v(t,e));return n}function Dt(t,e,r){let n=Object.values(e);return r&&(n=n.filter(r)),v(t,n)}const mt=1073741789,B=(mt>>2)-1;function Lt(t=B,e){if(t<=0)throw new Error(`[random][PseudoRandom] count(${t}) must be > 0`);if(t>B)throw new Error(`[random][PseudoRandom] count(${t}) must be <= ${B}`);if(e==null&&(e=Math.floor(Math.random()*t)),e>=t)throw new Error(`[random][PseudoRandom] startFrom(${e}) must be < count(${t})`);let r=e;return function(){return r=(r+mt)%t,r}}let x=null;function qt(){const t=Date.now();return x==null||t>x?(x=t,t):(x++,x)}async function Bt({url:t,timeout:e}={}){t||(t=typeof window<"u"?"/":"https://google.com");let r;try{const n=new F.AbortControllerFast;r=e?setTimeout(()=>{n.abort()},e):null;const o=await fetch(t,{method:"HEAD",signal:F.toAbortSignal(n.signal)}),i=o.headers.get("date");if(!i)throw new Error(`[Now][getDateInet] No date header in response: ${o.status} ${t}`);return new Date(i).getTime()}finally{r&&clearTimeout(r)}}function j(t,e,r){const n=e==null?t:new Date(t.toLocaleString("en-US",{timeZone:e})),o=r==null?t:new Date(t.toLocaleString("en-US",{timeZone:r}));return new Date(t.getTime()+o.getTime()-n.getTime())}function dt(t,e){t=j(t,"UTC",e);const r=t.getUTCFullYear().toString().padStart(4,"0"),n=(t.getUTCMonth()+1).toString().padStart(2,"0"),o=t.getUTCDate().toString().padStart(2,"0"),i=t.getUTCHours().toString().padStart(2,"0"),m=t.getUTCMinutes().toString().padStart(2,"0"),a=t.getUTCSeconds().toString().padStart(2,"0");return`${r}-${n}-${o} ${i}:${m}:${a}`}let Ft=0;const J=new WeakMap;function R(t){if(J.has(t))return J.get(t);const e=Ft++;return J.set(t,e),e}function et(t,e){try{return t[e]}catch(r){return"Error: "+(r instanceof Error?r.message:String(r))}}function I(t,e
|
|
1
|
+
"use strict";const F=require("@flemist/abort-controller-fast"),Z=require("@flemist/async-utils"),$t=require("@flemist/time-controller");let L=null;function At(){if(!L){L=new Array(256);for(let t=0;t<256;t++)L[t]=t.toString(16).padStart(2,"0")}return L}function it(t){const e=At(),r=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);let n="";for(let o=0,i=r.length;o<i;o++)n+=e[r[o]];return n}let X=null,st=null,q=null,ut=null;function Tt(){X||(X=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),st=new Uint32Array(64),ut=new TextEncoder,q=new Uint8Array(65536))}function lt(t){if(t==null)return null;Tt();const e=X,r=st,n=ut;let o=q,i;if(typeof t=="string"){const h=t.length*3;o.length<h+128&&(o=q=new Uint8Array(h+128));const c=n.encodeInto(t,o);i=o.subarray(0,c.written)}else if(t instanceof Uint8Array)i=t;else if(ArrayBuffer.isView(t))i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);else throw new Error(`[sha256Buffer] Unsupported content type: ${typeof t}`);const m=i.length,a=m+72>>>6<<6;o.length<a&&(o=q=new Uint8Array(a)),i!==o&&o.set(i),o[m]=128;for(let h=m+1;h<a;h++)o[h]=0;const A=m*8,C=A/4294967296|0,T=A|0;o[a-8]=C>>>24,o[a-7]=C>>>16,o[a-6]=C>>>8,o[a-5]=C,o[a-4]=T>>>24,o[a-3]=T>>>16,o[a-2]=T>>>8,o[a-1]=T;let U=1779033703,u=-1150833019,s=1013904242,l=-1521486534,y=1359893119,d=-1694144372,g=528734635,w=1541459225;for(let h=0;h<a;h+=64){for(let f=0;f<16;f++){const p=h+(f<<2);r[f]=o[p]<<24|o[p+1]<<16|o[p+2]<<8|o[p+3]}for(let f=16;f<64;f++){const p=r[f-15],$=r[f-2],b=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,D=($>>>17|$<<15)^($>>>19|$<<13)^$>>>10;r[f]=r[f-16]+b+r[f-7]+D|0}let c=U,_=u,N=s,H=l,O=y,P=d,k=g,W=w;for(let f=0;f<64;f+=4)for(let p=0;p<4;p++){const $=f+p,b=(O>>>6|O<<26)^(O>>>11|O<<21)^(O>>>25|O<<7),D=W+b+(k^O&(P^k))+e[$]+r[$]|0,Ut=((c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10))+(c&_^N&(c^_))|0;W=k,k=P,P=O,O=H+D|0,H=N,N=_,_=c,c=D+Ut|0}U=U+c|0,u=u+_|0,s=s+N|0,l=l+H|0,y=y+O|0,d=d+P|0,g=g+k|0,w=w+W|0}const S=new Uint8Array(32),G=[U,u,s,l,y,d,g,w];for(let h=0;h<8;h++){const c=G[h],_=h<<2;S[_]=c>>>24,S[_+1]=c>>>16&255,S[_+2]=c>>>8&255,S[_+3]=c&255}return S}function Et(t){const e=lt(t);return e?it(e):null}function at(t,e){return t==null?e:e==null?t:Math.min(t,e)}function ct(t,e){return t==null?e:e==null?t:Math.max(t,e)}function Ct(t,e,r){return ct(at(t,e),r)}function Rt(t,e){return(t%e+e)%e}function It(t){return function(){let r=t+=1831565813;return r=Math.imul(r^r>>>15,r|1),r^=r+Math.imul(r^r>>>7,r|61),(r^r>>>14)/4294967296+.5}}function kt(){return Math.random()}function xt(){return Math.random()*2**32>>>0}function ft(t){return t!=null?It(t):kt}class V{_seed;_rnd;constructor(e){this._seed=e,this._rnd=ft(e)}get seed(){return this._seed}nextSeed(){return this.next()*2**32>>>0}nextRandom(){return new V(this.nextSeed())}next(){return this._rnd()}clone(){return new V(this._seed)}}function K(t,e,r){if(r==null&&(r=e,e=0),r<=e)throw new Error(`[random][randomFloat] toExclusive (${r}) must be greater than from (${e})`);return t.next()*(r-e)+e}function ht(t,e,r){return Math.floor(K(t,e,r))}function Mt(t,e){return t.next()<(e??.5)}function Nt(t,e,r){if(Array.isArray(e)){const i=e;e=i.length,r=m=>i[m]}if(!r)throw new Error("[random][randomIndexWeighted] getWeight is required");let n=0;for(let i=0;i<e;i++)n+=r(i);if(n===0)return-1;let o=K(t,n);for(let i=0;i<e;i++)if(o-=r(i),o<0)return i;return e-1}function v(t,e){if(e.length===0)throw new Error("[random][randomItem] items is empty");const r=ht(t,e.length);return e[r]}function Pt(t,e,r){if(e.length===0)throw new Error("[random][randomItems] items is empty");const n=[];for(let o=0;o<r;o++)n.push(v(t,e));return n}function Dt(t,e,r){let n=Object.values(e);return r&&(n=n.filter(r)),v(t,n)}const mt=1073741789,B=(mt>>2)-1;function Lt(t=B,e){if(t<=0)throw new Error(`[random][PseudoRandom] count(${t}) must be > 0`);if(t>B)throw new Error(`[random][PseudoRandom] count(${t}) must be <= ${B}`);if(e==null&&(e=Math.floor(Math.random()*t)),e>=t)throw new Error(`[random][PseudoRandom] startFrom(${e}) must be < count(${t})`);let r=e;return function(){return r=(r+mt)%t,r}}let x=null;function qt(){const t=Date.now();return x==null||t>x?(x=t,t):(x++,x)}async function Bt({url:t,timeout:e}={}){t||(t=typeof window<"u"?"/":"https://google.com");let r;try{const n=new F.AbortControllerFast;r=e?setTimeout(()=>{n.abort()},e):null;const o=await fetch(t,{method:"HEAD",signal:F.toAbortSignal(n.signal)}),i=o.headers.get("date");if(!i)throw new Error(`[Now][getDateInet] No date header in response: ${o.status} ${t}`);return new Date(i).getTime()}finally{r&&clearTimeout(r)}}function j(t,e,r){const n=e==null?t:new Date(t.toLocaleString("en-US",{timeZone:e})),o=r==null?t:new Date(t.toLocaleString("en-US",{timeZone:r}));return new Date(t.getTime()+o.getTime()-n.getTime())}function dt(t,e){t=j(t,"UTC",e);const r=t.getUTCFullYear().toString().padStart(4,"0"),n=(t.getUTCMonth()+1).toString().padStart(2,"0"),o=t.getUTCDate().toString().padStart(2,"0"),i=t.getUTCHours().toString().padStart(2,"0"),m=t.getUTCMinutes().toString().padStart(2,"0"),a=t.getUTCSeconds().toString().padStart(2,"0");return`${r}-${n}-${o} ${i}:${m}:${a}`}let Ft=0;const J=new WeakMap;function R(t){if(J.has(t))return J.get(t);const e=Ft++;return J.set(t,e),e}function et(t,e){try{return t[e]}catch(r){return"Error: "+(r instanceof Error?r.message:String(r))}}function I(t,e,r,n){const{pretty:o,filter:i,maxDepth:m,maxItems:a,showObjectId:A,showArrayIndex:C,customToString:T}=e??{};if(r==null&&(r=[]),n==null&&(n=new Set),T){const u=T(t,s=>I(s,e,r,n));if(u!=null)return u}const U=r.length;if(typeof t=="string")return JSON.stringify(t);if(t==null||typeof t!="object")return String(t);if(t instanceof ArrayBuffer||ArrayBuffer.isView(t))return`${t.constructor?.name??""}#${R(t)}[${t.byteLength}]`;if(t instanceof RegExp)return String(t);if(t instanceof Date)return dt(t);if(t instanceof Object){if(n.has(t)||m!=null&&U>=m)return`${t.constructor===Object?"":t.constructor?.name??""}#${R(t)}`;n.add(t)}if(t instanceof Error)return t.stack||t.message||String(t);if(Array.isArray(t)){const u=o?" ".repeat(U):"";let s="";A&&(s+=`#${R(t)} `),s+="[";let l=0,y=!1;for(let d=0;d<t.length;d++){if(a!=null&&l>=a){y=!0;break}const g=[...r,String(d)],w=et(t,d);if(i!=null&&!i(g,w))continue;const S=I(w,e,g,n);l>0&&(s+=","),o&&(s+=`
|
|
2
2
|
`),o&&(s+=`${u} `),C&&(s+=`${d}: `),s+=`${S}`,l++}return y?(l>0&&(s+=","),o?(s+=`
|
|
3
3
|
`,s+=`${u} ...
|
|
4
4
|
`):s+="...",s+=u,s+="]"):(l>0&&o&&(s+=`
|
|
@@ -322,7 +322,7 @@ function Y(t, e) {
|
|
|
322
322
|
return "Error: " + (r instanceof Error ? r.message : String(r));
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
|
-
function k(t, e
|
|
325
|
+
function k(t, e, r, n) {
|
|
326
326
|
const {
|
|
327
327
|
pretty: o,
|
|
328
328
|
filter: s,
|
|
@@ -331,8 +331,8 @@ function k(t, e = {}, r = [], n = /* @__PURE__ */ new Set()) {
|
|
|
331
331
|
showObjectId: U,
|
|
332
332
|
showArrayIndex: C,
|
|
333
333
|
customToString: T
|
|
334
|
-
} = e;
|
|
335
|
-
if (T) {
|
|
334
|
+
} = e ?? {};
|
|
335
|
+
if (r == null && (r = []), n == null && (n = /* @__PURE__ */ new Set()), T) {
|
|
336
336
|
const u = T(t, (i) => k(i, e, r, n));
|
|
337
337
|
if (u != null)
|
|
338
338
|
return u;
|