@flemist/simple-utils 1.0.7 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +1 -1
- package/build/node/index.cjs +1 -1
- package/build/node/index.mjs +1 -1
- package/build/{urlGet-gNalp7x6.mjs → urlGet-A6tzime-.mjs} +2 -2
- package/build/{urlGet-CcwXaB12.js → urlGet-Be7wEmXE.js} +1 -1
- 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-Be7wEmXE.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.setFuncName=e.setFuncName;exports.sha256=e.sha256;exports.sha256Buffer=e.sha256Buffer;exports.timeoutAbortController=e.timeoutAbortController;exports.toHex=e.toHex;exports.truncateString=e.truncateString;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 { H as s, O as o, P as t, R as n, U as r, G as m, I as l, q as d, l as u, o as i, A as c, B as p, C as g, D as I, y as R, z as T, K as f, u as x, v as N, w as h, p as E, E as F, d as L, g as M, L as P, b as S, m as U, c as k, n as q, f as A, k as C, r as D, h as G, e as y, i as B, j as O, F as b, a as w, s as z, M as J, t as _, x as v, X as H, Z as W, Y as j, Q, W as X, S as Z, V as K, T as V, J as Y, N as $ } from "../urlGet-
|
|
1
|
+
import { H as s, O as o, P as t, R as n, U as r, G as m, I as l, q as d, l as u, o as i, A as c, B as p, C as g, D as I, y as R, z as T, K as f, u as x, v as N, w as h, p as E, E as F, d as L, g as M, L as P, b as S, m as U, c as k, n as q, f as A, k as C, r as D, h as G, e as y, i as B, j as O, F as b, a as w, s as z, M as J, t as _, x as v, X as H, Z as W, Y as j, Q, W as X, S as Z, V as K, T as V, J as Y, N as $ } from "../urlGet-A6tzime-.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-Be7wEmXE.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.setFuncName=e.setFuncName;exports.sha256=e.sha256;exports.sha256Buffer=e.sha256Buffer;exports.timeoutAbortController=e.timeoutAbortController;exports.toHex=e.toHex;exports.truncateString=e.truncateString;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 { H as s, O as o, P as t, R as n, U as r, G as m, I as l, q as d, l as u, o as i, A as c, B as p, C as g, D as I, y as R, z as T, K as f, u as x, v as N, w as h, p as E, E as F, d as L, g as M, L as P, b as S, m as U, c as k, n as q, f as A, k as C, r as D, h as G, e as y, i as B, j as O, F as b, a as w, s as z, M as J, t as _, x as v, X as H, Z as W, Y as j, Q, W as X, S as Z, V as K, T as V, J as Y, N as $ } from "../urlGet-
|
|
1
|
+
import { H as s, O as o, P as t, R as n, U as r, G as m, I as l, q as d, l as u, o as i, A as c, B as p, C as g, D as I, y as R, z as T, K as f, u as x, v as N, w as h, p as E, E as F, d as L, g as M, L as P, b as S, m as U, c as k, n as q, f as A, k as C, r as D, h as G, e as y, i as B, j as O, F as b, a as w, s as z, M as J, t as _, x as v, X as H, Z as W, Y as j, Q, W as X, S as Z, V as K, T as V, J as Y, N as $ } from "../urlGet-A6tzime-.mjs";
|
|
2
2
|
export {
|
|
3
3
|
s as ConsoleMessageLevel,
|
|
4
4
|
o as Lazy,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type FormatAnyToString = (obj: any, toString: (obj: any) => any
|
|
1
|
+
export type FormatAnyToString = (obj: any, path: string[], toString: (obj: any) => any) => string | null | undefined | void;
|
|
2
2
|
export type FormatAnyOptions = {
|
|
3
3
|
pretty?: boolean;
|
|
4
4
|
filter?: null | ((path: string[], value: any) => boolean);
|
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-Be7wEmXE.js"),C=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),g=j(ee),z=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 C.Locker,I.set(n,a)),a}function re(e){const{filePath:n,func:a}=e;return ne(n).lock(()=>S.poolRunWait({pool:z,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,l=e.pool??z,p=e.handleError,d=e.priority??W.priorityCreate(0),c=e.walkLinks??!1,m=e.log,D=e.handlePath,N=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 C.useAbortController(async L=>{const E=C.combineAbortSignals(r,L),T={totalSize:0,maxFileDateModified:0,countFiles:0,countDirs:0,countLinks:0};function q(f,y){if(Y(y.totalSize)){const o=`${y.totalSize.toLocaleString("en-US").replace(/,/g," ").padStart(19)}: ${f}`;m?.handleLog?m.handleLog(o):console.log(o)}}async function G(f,y,k,o){return D?await S.poolRunWait({pool:l,func:async()=>{try{return await D({level:a,path:f,stat:y,itemStat:k,totalStat:T,abortSignal:E})}catch(u){return await R(u),!1}},count:1,priority:o,abortSignal:E}):!0}async function O(f,y,k,o){o||(o=f);const u=await S.poolRunWait({pool:l,func:()=>g.promises.lstat(f).catch(R),count:1,priority:W.priorityCreate(y,W.priorityCreate(1,d)),abortSignal:E});if(!u||!k&&u.isFile())return null;const U=H(f,u);if(i.has(U))return null;i.add(U);let s={totalSize:u.size,maxFileDateModified:u.isDirectory()?0:u.mtimeMs,countFiles:0,countDirs:0,countLinks:0};const M=W.priorityCreate(y,W.priorityCreate(u.isDirectory()?2:3,d));if(u.isSymbolicLink()){if(c){const h=await S.poolRunWait({pool:l,func:()=>g.promises.readlink(f).catch(R).then(F=>F??null),count:1,priority:M,abortSignal:E});if(h){const F=w.isAbsolute(h)?h:w.resolve(w.dirname(o),h),v=await O(F,y,k,o);v&&(s=v)}}return(k||s.countFiles+s.countDirs+s.countLinks>=1)&&(s.countLinks+=1,await G(o,u,s,M)&&(_(T,s),q(o,s))),s}else if(u.isDirectory()){const h=await S.poolRunWait({pool:l,func:()=>g.promises.readdir(f).catch(R),count:1,priority:d,abortSignal:E});if(h){for(let F=0,v=h.length;F<v;F++)h[F]=w.join(o,h[F]);s=await Q({...e,paths:h,abortSignal:E,priority:M,level:a+1,walkedIds:i})}}return(k||s.countFiles+s.countDirs+s.countLinks>=1)&&(u.isDirectory()?s.countDirs+=1:u.isFile()&&(s.countFiles+=1),await G(o,u,s,M)&&(_(T,s),q(o,s))),s}const A=[];for(let f=0,y=n.length;f<y;f++){const k=$(n[f]),o=N?N(k):!0;o!==!1&&A.push(O(k,f,o))}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 l=r.startsWith("^");l&&(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:l,negative:p,debugInfo:d,match:c})}),function(l){l=x(l);let p=null,d=!1;for(let c=0,m=i.length;c<m;c++){const D=i[c];D.match(l)&&(D.exclude?d=!D.negative:(p=!D.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 g.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 se(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:z,count:1,func:async()=>{const l=w.resolve(n,r.value),p=await K(l),d=w.relative(n,w.dirname(l));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.setFuncName=t.setFuncName;exports.sha256=t.sha256;exports.sha256Buffer=t.sha256Buffer;exports.timeoutAbortController=t.timeoutAbortController;exports.toHex=t.toHex;exports.truncateString=t.truncateString;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=se;exports.loadGlobsFromFile=K;exports.pathNormalize=x;exports.pathResolve=$;exports.poolFs=z;exports.walkPathHandleErrorDefault=J;exports.walkPaths=ae;
|
package/build/node/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as mt, O as ht, P as pt, R as kt, U as wt, G as yt, I as xt, q as Ft, l as Lt, o as Dt, A as St, B as Et, C as Wt, D as zt, y as vt, z as Mt, K as Tt, u as It, v as Nt, w as Rt, p as Ct, E as At, d as Gt, g as Ut, L 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 gt, e as Pt, i as Qt, j as Xt, F as Zt, a as Kt, s as Yt, M as Vt, t as bt, x as te, X as ee, Z as ne, Y as se, Q as ae, W as re, S as ie, V as oe, T as ce, J as ue, N as le } from "../urlGet-
|
|
1
|
+
import { H as mt, O as ht, P as pt, R as kt, U as wt, G as yt, I as xt, q as Ft, l as Lt, o as Dt, A as St, B as Et, C as Wt, D as zt, y as vt, z as Mt, K as Tt, u as It, v as Nt, w as Rt, p as Ct, E as At, d as Gt, g as Ut, L 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 gt, e as Pt, i as Qt, j as Xt, F as Zt, a as Kt, s as Yt, M as Vt, t as bt, x as te, X as ee, Z as ne, Y as se, Q as ae, W as re, S as ie, V as oe, T as ce, J as ue, N as le } from "../urlGet-A6tzime-.mjs";
|
|
2
2
|
import { Locker as j, useAbortController as H, combineAbortSignals as J } from "@flemist/async-utils";
|
|
3
3
|
import { Pool as g, poolRunWait as D } from "@flemist/time-limits";
|
|
4
4
|
import P from "node:os";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const z=require("@flemist/abort-controller-fast"),K=require("@flemist/async-utils"),At=require("@flemist/time-controller");let q=null;function Tt(){if(!q){q=new Array(256);for(let t=0;t<256;t++)q[t]=t.toString(16).padStart(2,"0")}return q}function st(t){const e=Tt(),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 Y=null,ut=null,B=null,lt=null;function Et(){Y||(Y=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]),ut=new Uint32Array(64),lt=new TextEncoder,B=new Uint8Array(65536))}function at(t){if(t==null)return null;Et();const e=Y,r=ut,n=lt;let o=B,i;if(typeof t=="string"){const f=t.length*3;o.length<f+128&&(o=B=new Uint8Array(f+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=B=new Uint8Array(a)),i!==o&&o.set(i),o[m]=128;for(let f=m+1;f<a;f++)o[f]=0;const A=m*8,O=A/4294967296|0,C=A|0;o[a-8]=O>>>24,o[a-7]=O>>>16,o[a-6]=O>>>8,o[a-5]=O,o[a-4]=C>>>24,o[a-3]=C>>>16,o[a-2]=C>>>8,o[a-1]=C;let T=1779033703,U=-1150833019,u=1013904242,s=-1521486534,l=1359893119,g=-1694144372,d=528734635,y=1541459225;for(let f=0;f<a;f+=64){for(let h=0;h<16;h++){const p=f+(h<<2);r[h]=o[p]<<24|o[p+1]<<16|o[p+2]<<8|o[p+3]}for(let h=16;h<64;h++){const p=r[h-15],$=r[h-2],b=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,F=($>>>17|$<<15)^($>>>19|$<<13)^$>>>10;r[h]=r[h-16]+b+r[h-7]+F|0}let c=T,S=U,D=u,W=s,_=l,L=g,N=d,J=y;for(let h=0;h<64;h+=4)for(let p=0;p<4;p++){const $=h+p,b=(_>>>6|_<<26)^(_>>>11|_<<21)^(_>>>25|_<<7),F=J+b+(N^_&(L^N))+e[$]+r[$]|0,$t=((c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10))+(c&S^D&(c^S))|0;J=N,N=L,L=_,_=W+F|0,W=D,D=S,S=c,c=F+$t|0}T=T+c|0,U=U+S|0,u=u+D|0,s=s+W|0,l=l+_|0,g=g+L|0,d=d+N|0,y=y+J|0}const w=new Uint8Array(32),R=[T,U,u,s,l,g,d,y];for(let f=0;f<8;f++){const c=R[f],S=f<<2;w[S]=c>>>24,w[S+1]=c>>>16&255,w[S+2]=c>>>8&255,w[S+3]=c&255}return w}function Ct(t){const e=at(t);return e?st(e):null}function ct(t,e){return t==null?e:e==null?t:Math.min(t,e)}function ft(t,e){return t==null?e:e==null?t:Math.max(t,e)}function Rt(t,e,r){return ft(ct(t,e),r)}function It(t,e){return(t%e+e)%e}function kt(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 Nt(){return Math.random()}function Pt(){return Math.random()*2**32>>>0}function ht(t){return t!=null?kt(t):Nt}class G{_seed;_rnd;constructor(e){this._seed=e,this._rnd=ht(e)}get seed(){return this._seed}nextSeed(){return this.next()*2**32>>>0}nextRandom(){return new G(this.nextSeed())}next(){return this._rnd()}clone(){return new G(this._seed)}}function v(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 mt(t,e,r){return Math.floor(v(t,e,r))}function Mt(t,e){return t.next()<(e??.5)}function xt(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=v(t,n);for(let i=0;i<e;i++)if(o-=r(i),o<0)return i;return e-1}function j(t,e){if(e.length===0)throw new Error("[random][randomItem] items is empty");const r=mt(t,e.length);return e[r]}function Dt(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(j(t,e));return n}function Lt(t,e,r){let n=Object.values(e);return r&&(n=n.filter(r)),j(t,n)}const dt=1073741789,V=(dt>>2)-1;function Ft(t=V,e){if(t<=0)throw new Error(`[random][PseudoRandom] count(${t}) must be > 0`);if(t>V)throw new Error(`[random][PseudoRandom] count(${t}) must be <= ${V}`);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+dt)%t,r}}let P=null;function qt(){const t=Date.now();return P==null||t>P?(P=t,t):(P++,P)}async function Bt({url:t,timeout:e}={}){t||(t=typeof window<"u"?"/":"https://google.com");let r;try{const n=new z.AbortControllerFast;r=e?setTimeout(()=>{n.abort()},e):null;const o=await fetch(t,{method:"HEAD",signal:z.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 tt(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 pt(t,e){t=tt(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 Vt=0;const X=new WeakMap;function I(t){if(X.has(t))return X.get(t);const e=Vt++;return X.set(t,e),e}function M(t,e,r){return t==null?t??null:e==null?t:t.length>e?e<=0?"…":r?.fromStart?"…"+t.slice(t.length-e+1):t.slice(0,e-1)+"…":t}function rt(t,e){try{return t[e]}catch(r){return"Error: "+(r instanceof Error?r.message:String(r))}}function k(t,e,r,n){const{pretty:o,filter:i,maxDepth:m,maxItems:a,maxStringLength:A,showObjectId:O,showArrayIndex:C,customToString:T}=e??{};if(r==null&&(r=[]),n==null&&(n=new Set),T){const u=T(t,s=>k(s,e,r,n)
|
|
1
|
+
"use strict";const z=require("@flemist/abort-controller-fast"),K=require("@flemist/async-utils"),At=require("@flemist/time-controller");let q=null;function Tt(){if(!q){q=new Array(256);for(let t=0;t<256;t++)q[t]=t.toString(16).padStart(2,"0")}return q}function st(t){const e=Tt(),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 Y=null,ut=null,B=null,lt=null;function Et(){Y||(Y=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]),ut=new Uint32Array(64),lt=new TextEncoder,B=new Uint8Array(65536))}function at(t){if(t==null)return null;Et();const e=Y,r=ut,n=lt;let o=B,i;if(typeof t=="string"){const f=t.length*3;o.length<f+128&&(o=B=new Uint8Array(f+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=B=new Uint8Array(a)),i!==o&&o.set(i),o[m]=128;for(let f=m+1;f<a;f++)o[f]=0;const A=m*8,O=A/4294967296|0,C=A|0;o[a-8]=O>>>24,o[a-7]=O>>>16,o[a-6]=O>>>8,o[a-5]=O,o[a-4]=C>>>24,o[a-3]=C>>>16,o[a-2]=C>>>8,o[a-1]=C;let T=1779033703,U=-1150833019,u=1013904242,s=-1521486534,l=1359893119,g=-1694144372,d=528734635,y=1541459225;for(let f=0;f<a;f+=64){for(let h=0;h<16;h++){const p=f+(h<<2);r[h]=o[p]<<24|o[p+1]<<16|o[p+2]<<8|o[p+3]}for(let h=16;h<64;h++){const p=r[h-15],$=r[h-2],b=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,F=($>>>17|$<<15)^($>>>19|$<<13)^$>>>10;r[h]=r[h-16]+b+r[h-7]+F|0}let c=T,S=U,D=u,W=s,_=l,L=g,N=d,J=y;for(let h=0;h<64;h+=4)for(let p=0;p<4;p++){const $=h+p,b=(_>>>6|_<<26)^(_>>>11|_<<21)^(_>>>25|_<<7),F=J+b+(N^_&(L^N))+e[$]+r[$]|0,$t=((c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10))+(c&S^D&(c^S))|0;J=N,N=L,L=_,_=W+F|0,W=D,D=S,S=c,c=F+$t|0}T=T+c|0,U=U+S|0,u=u+D|0,s=s+W|0,l=l+_|0,g=g+L|0,d=d+N|0,y=y+J|0}const w=new Uint8Array(32),R=[T,U,u,s,l,g,d,y];for(let f=0;f<8;f++){const c=R[f],S=f<<2;w[S]=c>>>24,w[S+1]=c>>>16&255,w[S+2]=c>>>8&255,w[S+3]=c&255}return w}function Ct(t){const e=at(t);return e?st(e):null}function ct(t,e){return t==null?e:e==null?t:Math.min(t,e)}function ft(t,e){return t==null?e:e==null?t:Math.max(t,e)}function Rt(t,e,r){return ft(ct(t,e),r)}function It(t,e){return(t%e+e)%e}function kt(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 Nt(){return Math.random()}function Pt(){return Math.random()*2**32>>>0}function ht(t){return t!=null?kt(t):Nt}class G{_seed;_rnd;constructor(e){this._seed=e,this._rnd=ht(e)}get seed(){return this._seed}nextSeed(){return this.next()*2**32>>>0}nextRandom(){return new G(this.nextSeed())}next(){return this._rnd()}clone(){return new G(this._seed)}}function v(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 mt(t,e,r){return Math.floor(v(t,e,r))}function Mt(t,e){return t.next()<(e??.5)}function xt(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=v(t,n);for(let i=0;i<e;i++)if(o-=r(i),o<0)return i;return e-1}function j(t,e){if(e.length===0)throw new Error("[random][randomItem] items is empty");const r=mt(t,e.length);return e[r]}function Dt(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(j(t,e));return n}function Lt(t,e,r){let n=Object.values(e);return r&&(n=n.filter(r)),j(t,n)}const dt=1073741789,V=(dt>>2)-1;function Ft(t=V,e){if(t<=0)throw new Error(`[random][PseudoRandom] count(${t}) must be > 0`);if(t>V)throw new Error(`[random][PseudoRandom] count(${t}) must be <= ${V}`);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+dt)%t,r}}let P=null;function qt(){const t=Date.now();return P==null||t>P?(P=t,t):(P++,P)}async function Bt({url:t,timeout:e}={}){t||(t=typeof window<"u"?"/":"https://google.com");let r;try{const n=new z.AbortControllerFast;r=e?setTimeout(()=>{n.abort()},e):null;const o=await fetch(t,{method:"HEAD",signal:z.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 tt(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 pt(t,e){t=tt(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 Vt=0;const X=new WeakMap;function I(t){if(X.has(t))return X.get(t);const e=Vt++;return X.set(t,e),e}function M(t,e,r){return t==null?t??null:e==null?t:t.length>e?e<=0?"…":r?.fromStart?"…"+t.slice(t.length-e+1):t.slice(0,e-1)+"…":t}function rt(t,e){try{return t[e]}catch(r){return"Error: "+(r instanceof Error?r.message:String(r))}}function k(t,e,r,n){const{pretty:o,filter:i,maxDepth:m,maxItems:a,maxStringLength:A,showObjectId:O,showArrayIndex:C,customToString:T}=e??{};if(r==null&&(r=[]),n==null&&(n=new Set),T){const u=T(t,r,s=>k(s,e,r,n));if(u!=null)return M(u,A)}const U=r.length;if(typeof t=="string")return t=M(t,A),n.size>0&&(t=JSON.stringify(t)),t;if(t==null||typeof t!="object")return String(t);if(t instanceof ArrayBuffer||ArrayBuffer.isView(t))return`${t.constructor?.name??""}#${I(t)}[${t.byteLength}]`;if(t instanceof RegExp)return M(String(t),A);if(t instanceof Date)return pt(t);if(t instanceof Object){if(n.has(t)||m!=null&&U>=m)return`${t.constructor===Object?"":t.constructor?.name??""}#${I(t)}`;n.add(t)}if(t instanceof Error)return M(t.stack||t.message||String(t),A);if(Array.isArray(t)){const u=o?" ".repeat(U):"";let s="";O&&(s+=`#${I(t)} `),s+="[";let l=0,g=!1;for(let d=0;d<t.length;d++){if(a!=null&&l>=a){g=!0;break}const y=[...r,String(d)],w=rt(t,d);if(i!=null&&!i(y,w))continue;const R=k(w,e,y,n);l>0&&(s+=","),o&&(s+=`
|
|
2
2
|
`),o&&(s+=`${u} `),C&&(s+=`${d}: `),s+=`${R}`,l++}return g?(l>0&&(s+=","),o?(s+=`
|
|
3
3
|
`,s+=`${u} ...
|
|
4
4
|
`):s+="...",s+=u,s+="]"):(l>0&&o&&(s+=`
|