@pezkuwi/util 14.0.25 → 14.0.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.
@@ -7,7 +7,7 @@
7
7
  const global = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : window;
8
8
 
9
9
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
10
- const packageInfo$4 = { name: '@pezkuwi/util', path: (({ url: (typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('bundle-pezkuwi-util.js', document.baseURI).href)) }) && (typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('bundle-pezkuwi-util.js', document.baseURI).href))) ? new URL((typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('bundle-pezkuwi-util.js', document.baseURI).href))).pathname.substring(0, new URL((typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('bundle-pezkuwi-util.js', document.baseURI).href))).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '14.0.23' };
10
+ const packageInfo$3 = { name: '@pezkuwi/util', path: (({ url: (typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('bundle-pezkuwi-util.js', document.baseURI).href)) }) && (typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('bundle-pezkuwi-util.js', document.baseURI).href))) ? new URL((typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('bundle-pezkuwi-util.js', document.baseURI).href))).pathname.substring(0, new URL((typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('bundle-pezkuwi-util.js', document.baseURI).href))).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '14.0.26' };
11
11
 
12
12
  function arrayChunk(array, chunkSize) {
13
13
  const outputSize = Math.ceil(array.length / chunkSize);
@@ -132,120 +132,66 @@
132
132
  const nMax = createCmp((a, b) => a > b);
133
133
  const nMin = createCmp((a, b) => a < b);
134
134
 
135
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
136
-
137
- function getDefaultExportFromCjs (x) {
138
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
139
- }
140
-
141
- function getAugmentedNamespace(n) {
142
- if (n.__esModule) return n;
143
- var f = n.default;
144
- if (typeof f == "function") {
145
- var a = function a () {
146
- if (this instanceof a) {
147
- return Reflect.construct(f, arguments, this.constructor);
148
- }
149
- return f.apply(this, arguments);
150
- };
151
- a.prototype = f.prototype;
152
- } else a = {};
153
- Object.defineProperty(a, '__esModule', {value: true});
154
- Object.keys(n).forEach(function (k) {
155
- var d = Object.getOwnPropertyDescriptor(n, k);
156
- Object.defineProperty(a, k, d.get ? d : {
157
- enumerable: true,
158
- get: function () {
159
- return n[k];
160
- }
161
- });
162
- });
163
- return a;
135
+ const packageInfo$2 = { name: '@pezkuwi/x-global', path: (({ url: (typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('bundle-pezkuwi-util.js', document.baseURI).href)) }) && (typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('bundle-pezkuwi-util.js', document.baseURI).href))) ? new URL((typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('bundle-pezkuwi-util.js', document.baseURI).href))).pathname.substring(0, new URL((typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('bundle-pezkuwi-util.js', document.baseURI).href))).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '14.0.26' };
136
+
137
+ function evaluateThis(fn) {
138
+ return fn('return this');
139
+ }
140
+ const xglobal = (typeof globalThis !== 'undefined'
141
+ ? globalThis
142
+ : typeof global !== 'undefined'
143
+ ? global
144
+ : typeof self !== 'undefined'
145
+ ? self
146
+ : typeof window !== 'undefined'
147
+ ? window
148
+ : evaluateThis(Function));
149
+ function extractGlobal(name, fallback) {
150
+ return typeof xglobal[name] === 'undefined'
151
+ ? fallback
152
+ : xglobal[name];
153
+ }
154
+ function exposeGlobal(name, fallback) {
155
+ if (typeof xglobal[name] === 'undefined') {
156
+ xglobal[name] = fallback;
157
+ }
164
158
  }
165
159
 
166
- var cjs$1 = {};
167
-
168
- var cjs = {};
169
-
170
- var packageInfo$3 = {};
171
-
172
- Object.defineProperty(packageInfo$3, "__esModule", { value: true });
173
- packageInfo$3.packageInfo = void 0;
174
- packageInfo$3.packageInfo = { name: '@pezkuwi/x-global', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '14.0.23' };
175
-
176
- (function (exports$1) {
177
- Object.defineProperty(exports$1, "__esModule", { value: true });
178
- exports$1.xglobal = exports$1.packageInfo = void 0;
179
- exports$1.extractGlobal = extractGlobal;
180
- exports$1.exposeGlobal = exposeGlobal;
181
- var packageInfo_js_1 = packageInfo$3;
182
- Object.defineProperty(exports$1, "packageInfo", { enumerable: true, get: function () { return packageInfo_js_1.packageInfo; } });
183
- function evaluateThis(fn) {
184
- return fn('return this');
185
- }
186
- exports$1.xglobal = (typeof globalThis !== 'undefined'
187
- ? globalThis
188
- : typeof commonjsGlobal !== 'undefined'
189
- ? commonjsGlobal
190
- : typeof self !== 'undefined'
191
- ? self
192
- : typeof window !== 'undefined'
193
- ? window
194
- : evaluateThis(Function));
195
- function extractGlobal(name, fallback) {
196
- return typeof exports$1.xglobal[name] === 'undefined'
197
- ? fallback
198
- : exports$1.xglobal[name];
199
- }
200
- function exposeGlobal(name, fallback) {
201
- if (typeof exports$1.xglobal[name] === 'undefined') {
202
- exports$1.xglobal[name] = fallback;
203
- }
204
- }
205
- } (cjs));
206
- getDefaultExportFromCjs(cjs);
207
-
208
- var packageInfo$2 = {};
209
-
210
- Object.defineProperty(packageInfo$2, "__esModule", { value: true });
211
- packageInfo$2.packageInfo = void 0;
212
- packageInfo$2.packageInfo = { name: '@pezkuwi/x-bigint', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '14.0.23' };
160
+ const build = /*#__PURE__*/Object.freeze({
161
+ __proto__: null,
162
+ exposeGlobal: exposeGlobal,
163
+ extractGlobal: extractGlobal,
164
+ packageInfo: packageInfo$2,
165
+ xglobal: xglobal
166
+ });
213
167
 
214
- (function (exports$1) {
215
- Object.defineProperty(exports$1, "__esModule", { value: true });
216
- exports$1.BigInt = exports$1.packageInfo = void 0;
217
- const x_global_1 = cjs;
218
- var packageInfo_js_1 = packageInfo$2;
219
- Object.defineProperty(exports$1, "packageInfo", { enumerable: true, get: function () { return packageInfo_js_1.packageInfo; } });
220
- function invalidFallback() {
221
- return Number.NaN;
222
- }
223
- exports$1.BigInt = (0, x_global_1.extractGlobal)('BigInt', invalidFallback);
224
- } (cjs$1));
225
- getDefaultExportFromCjs(cjs$1);
226
-
227
- const _0n = cjs$1.BigInt(0);
228
- const _1n = cjs$1.BigInt(1);
229
- const _2n = cjs$1.BigInt(2);
230
- const _3n = cjs$1.BigInt(3);
231
- const _4n = cjs$1.BigInt(4);
232
- const _5n = cjs$1.BigInt(5);
233
- const _6n = cjs$1.BigInt(6);
234
- const _7n = cjs$1.BigInt(7);
235
- const _8n = cjs$1.BigInt(8);
236
- const _9n = cjs$1.BigInt(9);
237
- const _10n = cjs$1.BigInt(10);
238
- const _100n = cjs$1.BigInt(100);
239
- const _1000n = cjs$1.BigInt(1_000);
240
- const _1Mn = cjs$1.BigInt(1_000_000);
241
- const _1Bn = cjs$1.BigInt(1_000_000_000);
168
+ function invalidFallback() {
169
+ return Number.NaN;
170
+ }
171
+ const BigInt = extractGlobal('BigInt', invalidFallback);
172
+
173
+ const _0n = BigInt(0);
174
+ const _1n = BigInt(1);
175
+ const _2n = BigInt(2);
176
+ const _3n = BigInt(3);
177
+ const _4n = BigInt(4);
178
+ const _5n = BigInt(5);
179
+ const _6n = BigInt(6);
180
+ const _7n = BigInt(7);
181
+ const _8n = BigInt(8);
182
+ const _9n = BigInt(9);
183
+ const _10n = BigInt(10);
184
+ const _100n = BigInt(100);
185
+ const _1000n = BigInt(1_000);
186
+ const _1Mn = BigInt(1_000_000);
187
+ const _1Bn = BigInt(1_000_000_000);
242
188
  const _1Qn = _1Bn * _1Bn;
243
- const _2pow53n = cjs$1.BigInt(Number.MAX_SAFE_INTEGER);
244
- const _sqrt2pow53n = cjs$1.BigInt(94906265);
189
+ const _2pow53n = BigInt(Number.MAX_SAFE_INTEGER);
190
+ const _sqrt2pow53n = BigInt(94906265);
245
191
 
246
- const U8_MAX = cjs$1.BigInt(256);
247
- const U16_MAX = cjs$1.BigInt(256 * 256);
248
- const U64_MAX = cjs$1.BigInt('0x10000000000000000');
192
+ const U8_MAX = BigInt(256);
193
+ const U16_MAX = BigInt(256 * 256);
194
+ const U64_MAX = BigInt('0x10000000000000000');
249
195
  function u8aToBigInt(value, { isLe = true, isNegative = false } = {}) {
250
196
  if (!isLe) {
251
197
  value = value.slice().reverse();
@@ -254,37 +200,37 @@
254
200
  if (isNegative && count && (value[count - 1] & 0x80)) {
255
201
  switch (count) {
256
202
  case 0:
257
- return cjs$1.BigInt(0);
203
+ return BigInt(0);
258
204
  case 1:
259
- return cjs$1.BigInt(((value[0] ^ 0x0000_00ff) * -1) - 1);
205
+ return BigInt(((value[0] ^ 0x0000_00ff) * -1) - 1);
260
206
  case 2:
261
- return cjs$1.BigInt((((value[0] + (value[1] << 8)) ^ 0x0000_ffff) * -1) - 1);
207
+ return BigInt((((value[0] + (value[1] << 8)) ^ 0x0000_ffff) * -1) - 1);
262
208
  case 4:
263
- return cjs$1.BigInt((((value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 0x1_00_00_00)) ^ 0xffff_ffff) * -1) - 1);
209
+ return BigInt((((value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 0x1_00_00_00)) ^ 0xffff_ffff) * -1) - 1);
264
210
  }
265
211
  const dvI = new DataView(value.buffer, value.byteOffset);
266
212
  if (count === 8) {
267
213
  return dvI.getBigInt64(0, true);
268
214
  }
269
- let result = cjs$1.BigInt(0);
215
+ let result = BigInt(0);
270
216
  const mod = count % 2;
271
217
  for (let i = count - 2; i >= mod; i -= 2) {
272
- result = (result * U16_MAX) + cjs$1.BigInt(dvI.getUint16(i, true) ^ 0xffff);
218
+ result = (result * U16_MAX) + BigInt(dvI.getUint16(i, true) ^ 0xffff);
273
219
  }
274
220
  if (mod) {
275
- result = (result * U8_MAX) + cjs$1.BigInt(value[0] ^ 0xff);
221
+ result = (result * U8_MAX) + BigInt(value[0] ^ 0xff);
276
222
  }
277
223
  return (result * -_1n) - _1n;
278
224
  }
279
225
  switch (count) {
280
226
  case 0:
281
- return cjs$1.BigInt(0);
227
+ return BigInt(0);
282
228
  case 1:
283
- return cjs$1.BigInt(value[0]);
229
+ return BigInt(value[0]);
284
230
  case 2:
285
- return cjs$1.BigInt(value[0] + (value[1] << 8));
231
+ return BigInt(value[0] + (value[1] << 8));
286
232
  case 4:
287
- return cjs$1.BigInt(value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 0x1_00_00_00));
233
+ return BigInt(value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 0x1_00_00_00));
288
234
  }
289
235
  const dvI = new DataView(value.buffer, value.byteOffset);
290
236
  switch (count) {
@@ -293,13 +239,13 @@
293
239
  case 16:
294
240
  return (dvI.getBigUint64(8, true) * U64_MAX) + dvI.getBigUint64(0, true);
295
241
  default: {
296
- let result = cjs$1.BigInt(0);
242
+ let result = BigInt(0);
297
243
  const mod = count % 2;
298
244
  for (let i = count - 2; i >= mod; i -= 2) {
299
- result = (result * U16_MAX) + cjs$1.BigInt(dvI.getUint16(i, true));
245
+ result = (result * U16_MAX) + BigInt(dvI.getUint16(i, true));
300
246
  }
301
247
  if (mod) {
302
- result = (result * U8_MAX) + cjs$1.BigInt(value[0]);
248
+ result = (result * U8_MAX) + BigInt(value[0]);
303
249
  }
304
250
  return result;
305
251
  }
@@ -344,10 +290,41 @@
344
290
 
345
291
  function hexToBigInt(value, { isLe = false, isNegative = false } = {}) {
346
292
  return !value || value === '0x'
347
- ? cjs$1.BigInt(0)
293
+ ? BigInt(0)
348
294
  : u8aToBigInt(hexToU8a(value), { isLe, isNegative });
349
295
  }
350
296
 
297
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
298
+
299
+ function getDefaultExportFromCjs (x) {
300
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
301
+ }
302
+
303
+ function getAugmentedNamespace(n) {
304
+ if (n.__esModule) return n;
305
+ var f = n.default;
306
+ if (typeof f == "function") {
307
+ var a = function a () {
308
+ if (this instanceof a) {
309
+ return Reflect.construct(f, arguments, this.constructor);
310
+ }
311
+ return f.apply(this, arguments);
312
+ };
313
+ a.prototype = f.prototype;
314
+ } else a = {};
315
+ Object.defineProperty(a, '__esModule', {value: true});
316
+ Object.keys(n).forEach(function (k) {
317
+ var d = Object.getOwnPropertyDescriptor(n, k);
318
+ Object.defineProperty(a, k, d.get ? d : {
319
+ enumerable: true,
320
+ get: function () {
321
+ return n[k];
322
+ }
323
+ });
324
+ });
325
+ return a;
326
+ }
327
+
351
328
  var bn = {exports: {}};
352
329
 
353
330
  const _nodeResolve_empty = {};
@@ -357,7 +334,7 @@
357
334
  default: _nodeResolve_empty
358
335
  });
359
336
 
360
- const require$$0 = /*@__PURE__*/getAugmentedNamespace(_nodeResolve_empty$1);
337
+ const require$$0$1 = /*@__PURE__*/getAugmentedNamespace(_nodeResolve_empty$1);
361
338
 
362
339
  bn.exports;
363
340
  (function (module) {
@@ -400,7 +377,7 @@
400
377
  if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') {
401
378
  Buffer = window.Buffer;
402
379
  } else {
403
- Buffer = require$$0.Buffer;
380
+ Buffer = require$$0$1.Buffer;
404
381
  }
405
382
  } catch (e) {
406
383
  }
@@ -3074,16 +3051,16 @@
3074
3051
  return typeof value === 'bigint'
3075
3052
  ? value
3076
3053
  : !value
3077
- ? cjs$1.BigInt(0)
3054
+ ? BigInt(0)
3078
3055
  : isHex(value)
3079
3056
  ? hexToBigInt(value.toString())
3080
3057
  : isBn(value)
3081
- ? cjs$1.BigInt(value.toString())
3058
+ ? BigInt(value.toString())
3082
3059
  : isToBigInt(value)
3083
3060
  ? value.toBigInt()
3084
3061
  : isToBn(value)
3085
- ? cjs$1.BigInt(value.toBn().toString())
3086
- : cjs$1.BigInt(value);
3062
+ ? BigInt(value.toBn().toString())
3063
+ : BigInt(value);
3087
3064
  }
3088
3065
 
3089
3066
  function nSqrt(value) {
@@ -3092,7 +3069,7 @@
3092
3069
  throw new Error('square root of negative numbers is not supported');
3093
3070
  }
3094
3071
  if (n <= _2pow53n) {
3095
- return cjs$1.BigInt(~~Math.sqrt(Number(n)));
3072
+ return BigInt(~~Math.sqrt(Number(n)));
3096
3073
  }
3097
3074
  let x0 = _sqrt2pow53n;
3098
3075
  while (true) {
@@ -3104,16 +3081,16 @@
3104
3081
  }
3105
3082
  }
3106
3083
 
3107
- const hasBigInt = typeof cjs$1.BigInt === 'function' && typeof cjs$1.BigInt.asIntN === 'function';
3084
+ const hasBigInt = typeof BigInt === 'function' && typeof BigInt.asIntN === 'function';
3108
3085
  const hasCjs = typeof require === 'function' && typeof module !== 'undefined';
3109
3086
  const hasDirname = typeof __dirname !== 'undefined';
3110
3087
  const hasEsm = !hasCjs;
3111
3088
  const hasWasm = typeof WebAssembly !== 'undefined';
3112
- const hasBuffer = typeof cjs.xglobal.Buffer === 'function' && typeof cjs.xglobal.Buffer.isBuffer === 'function';
3113
- const hasProcess = typeof cjs.xglobal.process === 'object';
3089
+ const hasBuffer = typeof xglobal.Buffer === 'function' && typeof xglobal.Buffer.isBuffer === 'function';
3090
+ const hasProcess = typeof xglobal.process === 'object';
3114
3091
 
3115
3092
  function isBuffer(value) {
3116
- return hasBuffer && !!value && isFunction(value.readDoubleLE) && cjs.xglobal.Buffer.isBuffer(value);
3093
+ return hasBuffer && !!value && isFunction(value.readDoubleLE) && xglobal.Buffer.isBuffer(value);
3117
3094
  }
3118
3095
 
3119
3096
  function isU8a(value) {
@@ -3123,6 +3100,8 @@
3123
3100
 
3124
3101
  var browser$1 = {};
3125
3102
 
3103
+ const require$$0 = /*@__PURE__*/getAugmentedNamespace(build);
3104
+
3126
3105
  var fallback$1 = {};
3127
3106
 
3128
3107
  Object.defineProperty(fallback$1, "__esModule", { value: true });
@@ -3143,12 +3122,12 @@
3143
3122
 
3144
3123
  Object.defineProperty(packageInfo$1, "__esModule", { value: true });
3145
3124
  packageInfo$1.packageInfo = void 0;
3146
- packageInfo$1.packageInfo = { name: '@pezkuwi/x-textencoder', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '14.0.23' };
3125
+ packageInfo$1.packageInfo = { name: '@pezkuwi/x-textencoder', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '14.0.26' };
3147
3126
 
3148
3127
  (function (exports$1) {
3149
3128
  Object.defineProperty(exports$1, "__esModule", { value: true });
3150
3129
  exports$1.TextEncoder = exports$1.packageInfo = void 0;
3151
- const x_global_1 = cjs;
3130
+ const x_global_1 = require$$0;
3152
3131
  const fallback_js_1 = fallback$1;
3153
3132
  var packageInfo_js_1 = packageInfo$1;
3154
3133
  Object.defineProperty(exports$1, "packageInfo", { enumerable: true, get: function () { return packageInfo_js_1.packageInfo; } });
@@ -3326,7 +3305,7 @@
3326
3305
 
3327
3306
  function u8aToBuffer(value) {
3328
3307
  return hasBuffer
3329
- ? cjs.xglobal.Buffer.from(value || [])
3308
+ ? xglobal.Buffer.from(value || [])
3330
3309
  : new Uint8Array(value || []);
3331
3310
  }
3332
3311
 
@@ -3451,12 +3430,12 @@
3451
3430
 
3452
3431
  Object.defineProperty(packageInfo, "__esModule", { value: true });
3453
3432
  packageInfo.packageInfo = void 0;
3454
- packageInfo.packageInfo = { name: '@pezkuwi/x-textdecoder', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '14.0.23' };
3433
+ packageInfo.packageInfo = { name: '@pezkuwi/x-textdecoder', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '14.0.26' };
3455
3434
 
3456
3435
  (function (exports$1) {
3457
3436
  Object.defineProperty(exports$1, "__esModule", { value: true });
3458
3437
  exports$1.TextDecoder = exports$1.packageInfo = void 0;
3459
- const x_global_1 = cjs;
3438
+ const x_global_1 = require$$0;
3460
3439
  const fallback_js_1 = fallback;
3461
3440
  var packageInfo_js_1 = packageInfo;
3462
3441
  Object.defineProperty(exports$1, "packageInfo", { enumerable: true, get: function () { return packageInfo_js_1.packageInfo; } });
@@ -3496,8 +3475,8 @@
3496
3475
  : u8aConcatStrict([U8A_WRAP_PREFIX, u8a, U8A_WRAP_POSTFIX]);
3497
3476
  }
3498
3477
 
3499
- const DIV = cjs$1.BigInt(256);
3500
- const NEG_MASK = cjs$1.BigInt(0xff);
3478
+ const DIV = BigInt(256);
3479
+ const NEG_MASK = BigInt(0xff);
3501
3480
  function toU8a(value, isLe, isNegative) {
3502
3481
  const arr = [];
3503
3482
  const withSigned = isNegative && (value < _0n);
@@ -3750,7 +3729,7 @@
3750
3729
  const DEDUPE = 'Either remove and explicitly install matching versions or dedupe using your package manager.\nThe following conflicting packages were found:';
3751
3730
  const POLKADOTJS_DISABLE_ESM_CJS_WARNING_FLAG = 'POLKADOTJS_DISABLE_ESM_CJS_WARNING';
3752
3731
  function getEntry(name) {
3753
- const _global = cjs.xglobal;
3732
+ const _global = xglobal;
3754
3733
  if (!_global.__polkadotjs) {
3755
3734
  _global.__polkadotjs = {};
3756
3735
  }
@@ -3814,7 +3793,7 @@
3814
3793
  const entry = getEntry(name);
3815
3794
  entry.push({ path: getPath(path, pathOrFn), type, version });
3816
3795
  const entriesSameVersion = entry.every((e) => e.version === version);
3817
- const esmCjsWarningDisabled = cjs.xglobal.process?.env?.[POLKADOTJS_DISABLE_ESM_CJS_WARNING_FLAG] === '1';
3796
+ const esmCjsWarningDisabled = xglobal.process?.env?.[POLKADOTJS_DISABLE_ESM_CJS_WARNING_FLAG] === '1';
3818
3797
  const multipleEntries = entry.length !== 1;
3819
3798
  const disableWarnings = esmCjsWarningDisabled && entriesSameVersion;
3820
3799
  if (multipleEntries && !disableWarnings) {
@@ -3887,13 +3866,46 @@
3887
3866
  return typeof value === 'boolean';
3888
3867
  }
3889
3868
 
3890
- const NUMBER_REGEX = new RegExp('(\\d+?)(?=(\\d{3})+(?!\\d)|$)', 'g');
3869
+ function isDigit(c) {
3870
+ return c >= '0' && c <= '9';
3871
+ }
3872
+ function groups(value) {
3873
+ const out = [];
3874
+ const end = value.length;
3875
+ let i = 0;
3876
+ while (i < end) {
3877
+ if (!isDigit(value[i])) {
3878
+ i++;
3879
+ continue;
3880
+ }
3881
+ let j = i;
3882
+ while (j < end && isDigit(value[j])) {
3883
+ j++;
3884
+ }
3885
+ let start = i;
3886
+ while (start < j) {
3887
+ let stop = -1;
3888
+ for (let q = start + 1; q <= j; q++) {
3889
+ const left = j - q;
3890
+ if ((left > 0 && left % 3 === 0) || (left === 0 && j === end)) {
3891
+ stop = q;
3892
+ break;
3893
+ }
3894
+ }
3895
+ if (stop === -1) {
3896
+ break;
3897
+ }
3898
+ out.push(value.slice(start, stop));
3899
+ start = stop;
3900
+ }
3901
+ i = j;
3902
+ }
3903
+ return out;
3904
+ }
3891
3905
  function formatDecimal(value, separator = ',') {
3892
3906
  const isNegative = value[0].startsWith('-');
3893
- const matched = isNegative
3894
- ? value.substring(1).match(NUMBER_REGEX)
3895
- : value.match(NUMBER_REGEX);
3896
- return matched
3907
+ const matched = groups(isNegative ? value.substring(1) : value);
3908
+ return matched.length
3897
3909
  ? `${isNegative ? '-' : ''}${matched.join(separator)}`
3898
3910
  : value;
3899
3911
  }
@@ -4470,9 +4482,9 @@
4470
4482
  return flag;
4471
4483
  }
4472
4484
  function parseEnv(type) {
4473
- const maxSize = parseInt(cjs.xglobal.process?.env?.['DEBUG_MAX'] || '-1', 10);
4485
+ const maxSize = parseInt(xglobal.process?.env?.['DEBUG_MAX'] || '-1', 10);
4474
4486
  return [
4475
- getDebugFlag((cjs.xglobal.process?.env?.['DEBUG'] || '').toLowerCase().split(','), type),
4487
+ getDebugFlag((xglobal.process?.env?.['DEBUG'] || '').toLowerCase().split(','), type),
4476
4488
  isNaN(maxSize)
4477
4489
  ? -1
4478
4490
  : maxSize
@@ -4819,7 +4831,7 @@
4819
4831
  exports.objectProperty = objectProperty;
4820
4832
  exports.objectSpread = objectSpread;
4821
4833
  exports.objectValues = objectValues;
4822
- exports.packageInfo = packageInfo$4;
4834
+ exports.packageInfo = packageInfo$3;
4823
4835
  exports.promisify = promisify;
4824
4836
  exports.stringCamelCase = stringCamelCase;
4825
4837
  exports.stringLowerFirst = stringLowerFirst;
@@ -1,7 +1,50 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.formatDecimal = formatDecimal;
4
- const NUMBER_REGEX = new RegExp('(\\d+?)(?=(\\d{3})+(?!\\d)|$)', 'g');
4
+ function isDigit(c) {
5
+ return c >= '0' && c <= '9';
6
+ }
7
+ /**
8
+ * Splits the digits of value into thousands groups, exactly as the pattern
9
+ * /(\d+?)(?=(\d{3})+(?!\d)|$)/g matched them, without its quadratic cost
10
+ * on long digit runs (CodeQL js/polynomial-redos): within each run of digits,
11
+ * a group ends where the digits left in the run are a positive multiple of
12
+ * three, or at the end of the string. A run that never reaches such a point
13
+ * (two digits followed by a letter, say) contributes nothing.
14
+ */
15
+ function groups(value) {
16
+ const out = [];
17
+ const end = value.length;
18
+ let i = 0;
19
+ while (i < end) {
20
+ if (!isDigit(value[i])) {
21
+ i++;
22
+ continue;
23
+ }
24
+ let j = i;
25
+ while (j < end && isDigit(value[j])) {
26
+ j++;
27
+ }
28
+ let start = i;
29
+ while (start < j) {
30
+ let stop = -1;
31
+ for (let q = start + 1; q <= j; q++) {
32
+ const left = j - q;
33
+ if ((left > 0 && left % 3 === 0) || (left === 0 && j === end)) {
34
+ stop = q;
35
+ break;
36
+ }
37
+ }
38
+ if (stop === -1) {
39
+ break;
40
+ }
41
+ out.push(value.slice(start, stop));
42
+ start = stop;
43
+ }
44
+ i = j;
45
+ }
46
+ return out;
47
+ }
5
48
  /**
6
49
  * @name formatDecimal
7
50
  * @description Formats a number into string format with thousand separators
@@ -10,10 +53,8 @@ function formatDecimal(value, separator = ',') {
10
53
  // We can do this by adjusting the regx, however for the sake of clarity
11
54
  // we rather strip and re-add the negative sign in the output
12
55
  const isNegative = value[0].startsWith('-');
13
- const matched = isNegative
14
- ? value.substring(1).match(NUMBER_REGEX)
15
- : value.match(NUMBER_REGEX);
16
- return matched
56
+ const matched = groups(isNegative ? value.substring(1) : value);
57
+ return matched.length
17
58
  ? `${isNegative ? '-' : ''}${matched.join(separator)}`
18
59
  : value;
19
60
  }
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.packageInfo = void 0;
4
- exports.packageInfo = { name: '@pezkuwi/util', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '14.0.23' };
4
+ exports.packageInfo = { name: '@pezkuwi/util', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '14.0.26' };
@@ -1,4 +1,47 @@
1
- const NUMBER_REGEX = new RegExp('(\\d+?)(?=(\\d{3})+(?!\\d)|$)', 'g');
1
+ function isDigit(c) {
2
+ return c >= '0' && c <= '9';
3
+ }
4
+ /**
5
+ * Splits the digits of value into thousands groups, exactly as the pattern
6
+ * /(\d+?)(?=(\d{3})+(?!\d)|$)/g matched them, without its quadratic cost
7
+ * on long digit runs (CodeQL js/polynomial-redos): within each run of digits,
8
+ * a group ends where the digits left in the run are a positive multiple of
9
+ * three, or at the end of the string. A run that never reaches such a point
10
+ * (two digits followed by a letter, say) contributes nothing.
11
+ */
12
+ function groups(value) {
13
+ const out = [];
14
+ const end = value.length;
15
+ let i = 0;
16
+ while (i < end) {
17
+ if (!isDigit(value[i])) {
18
+ i++;
19
+ continue;
20
+ }
21
+ let j = i;
22
+ while (j < end && isDigit(value[j])) {
23
+ j++;
24
+ }
25
+ let start = i;
26
+ while (start < j) {
27
+ let stop = -1;
28
+ for (let q = start + 1; q <= j; q++) {
29
+ const left = j - q;
30
+ if ((left > 0 && left % 3 === 0) || (left === 0 && j === end)) {
31
+ stop = q;
32
+ break;
33
+ }
34
+ }
35
+ if (stop === -1) {
36
+ break;
37
+ }
38
+ out.push(value.slice(start, stop));
39
+ start = stop;
40
+ }
41
+ i = j;
42
+ }
43
+ return out;
44
+ }
2
45
  /**
3
46
  * @name formatDecimal
4
47
  * @description Formats a number into string format with thousand separators
@@ -7,10 +50,8 @@ export function formatDecimal(value, separator = ',') {
7
50
  // We can do this by adjusting the regx, however for the sake of clarity
8
51
  // we rather strip and re-add the negative sign in the output
9
52
  const isNegative = value[0].startsWith('-');
10
- const matched = isNegative
11
- ? value.substring(1).match(NUMBER_REGEX)
12
- : value.match(NUMBER_REGEX);
13
- return matched
53
+ const matched = groups(isNegative ? value.substring(1) : value);
54
+ return matched.length
14
55
  ? `${isNegative ? '-' : ''}${matched.join(separator)}`
15
56
  : value;
16
57
  }
package/package.json CHANGED
@@ -1,37 +1,35 @@
1
1
  {
2
2
  "author": "Dijital Kurdistan Tech Institute <dev@pezkuwichain.io>",
3
- "bugs": "https://github.com/pezkuwichain/pezkuwi-common/issues",
3
+ "bugs": "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-common/issues",
4
4
  "description": "A collection of useful utilities for @pezkuwi",
5
5
  "engines": {
6
6
  "node": ">=18"
7
7
  },
8
- "homepage": "https://github.com/pezkuwichain/pezkuwi-common/tree/master/packages/util#readme",
8
+ "homepage": "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-common/tree/master/packages/util#readme",
9
9
  "license": "Apache-2.0",
10
10
  "name": "@pezkuwi/util",
11
11
  "repository": {
12
12
  "directory": "packages/util",
13
13
  "type": "git",
14
- "url": "https://github.com/pezkuwichain/pezkuwi-common.git"
14
+ "url": "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-common.git"
15
15
  },
16
16
  "sideEffects": [
17
17
  "./packageDetect.js",
18
18
  "./cjs/packageDetect.js"
19
19
  ],
20
20
  "type": "module",
21
- "version": "14.0.25",
21
+ "version": "14.0.26",
22
22
  "main": "./cjs/index.js",
23
- "module": "./cjs/index.js",
24
- "types": "./cjs/index.d.ts",
23
+ "module": "./index.js",
24
+ "types": "./index.d.ts",
25
25
  "exports": {
26
26
  "./cjs/package.json": "./cjs/package.json",
27
27
  "./cjs/*": "./cjs/*.js",
28
28
  ".": {
29
- "types": "./index.d.ts",
30
29
  "module": {
31
30
  "types": "./index.d.ts",
32
31
  "default": "./index.js"
33
32
  },
34
- "import": "./index.js",
35
33
  "require": {
36
34
  "types": "./cjs/index.d.ts",
37
35
  "default": "./cjs/index.js"
@@ -1987,10 +1985,10 @@
1987
1985
  }
1988
1986
  },
1989
1987
  "dependencies": {
1990
- "@pezkuwi/x-bigint": "14.0.25",
1991
- "@pezkuwi/x-global": "14.0.25",
1992
- "@pezkuwi/x-textdecoder": "14.0.25",
1993
- "@pezkuwi/x-textencoder": "14.0.25",
1988
+ "@pezkuwi/x-bigint": "14.0.26",
1989
+ "@pezkuwi/x-global": "14.0.26",
1990
+ "@pezkuwi/x-textdecoder": "14.0.26",
1991
+ "@pezkuwi/x-textencoder": "14.0.26",
1994
1992
  "@types/bn.js": "^5.1.6",
1995
1993
  "bn.js": "^5.2.1",
1996
1994
  "tslib": "^2.8.0"
package/packageInfo.js CHANGED
@@ -1 +1 @@
1
- export const packageInfo = { name: '@pezkuwi/util', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '14.0.23' };
1
+ export const packageInfo = { name: '@pezkuwi/util', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '14.0.26' };