@3dsource/utils 1.0.19 → 1.0.21

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.
Files changed (92) hide show
  1. package/LICENSE +14 -14
  2. package/README.md +149 -46
  3. package/fesm2022/3dsource-utils.mjs +75 -50
  4. package/fesm2022/3dsource-utils.mjs.map +1 -1
  5. package/index.d.ts +863 -3
  6. package/package.json +2 -2
  7. package/lib/color/CMYKtoRGB.d.ts +0 -10
  8. package/lib/color/HEXtoRGB.d.ts +0 -5
  9. package/lib/color/HSVtoRGB.d.ts +0 -21
  10. package/lib/color/RGBtoCMYK.d.ts +0 -20
  11. package/lib/color/RGBtoHEX.d.ts +0 -1
  12. package/lib/color/RGBtoHSV.d.ts +0 -19
  13. package/lib/color/hsv.d.ts +0 -1
  14. package/lib/color/index.d.ts +0 -16
  15. package/lib/color/max.d.ts +0 -1
  16. package/lib/color/min.d.ts +0 -1
  17. package/lib/color/overlay.d.ts +0 -1
  18. package/lib/color/rgb.d.ts +0 -8
  19. package/lib/color/sub.d.ts +0 -1
  20. package/lib/color/subtract.d.ts +0 -1
  21. package/lib/color/sum.d.ts +0 -1
  22. package/lib/color/toRGB.d.ts +0 -8
  23. package/lib/color/toRGBA.d.ts +0 -1
  24. package/lib/constants/color-codes.constant.d.ts +0 -9
  25. package/lib/constants/index.d.ts +0 -1
  26. package/lib/csv/CSV2Array.d.ts +0 -1
  27. package/lib/csv/CSV2Records.d.ts +0 -1
  28. package/lib/csv/ObjectToCSV.d.ts +0 -1
  29. package/lib/csv/index.d.ts +0 -3
  30. package/lib/dev/dev3d.d.ts +0 -1
  31. package/lib/dev/index.d.ts +0 -3
  32. package/lib/dev/logger.d.ts +0 -11
  33. package/lib/dev/timeToString.d.ts +0 -5
  34. package/lib/filenaming/cleanupFileName.d.ts +0 -1
  35. package/lib/filenaming/index.d.ts +0 -3
  36. package/lib/filenaming/makePath.d.ts +0 -1
  37. package/lib/filenaming/normalizePath.d.ts +0 -1
  38. package/lib/geom/expandOverRectangle.d.ts +0 -2
  39. package/lib/geom/fitIntoRectangle.d.ts +0 -2
  40. package/lib/geom/index.d.ts +0 -3
  41. package/lib/geom/interfaces/area.interface.d.ts +0 -4
  42. package/lib/geom/interfaces/index.d.ts +0 -4
  43. package/lib/geom/interfaces/rect.interface.d.ts +0 -4
  44. package/lib/geom/interfaces/size.interface.d.ts +0 -4
  45. package/lib/geom/interfaces//321/201oords.interface.d.ts +0 -4
  46. package/lib/helpers/BatchLoader.d.ts +0 -47
  47. package/lib/helpers/KeyboardNumericCode.d.ts +0 -103
  48. package/lib/helpers/debounce.d.ts +0 -1
  49. package/lib/helpers/generate-uuid.d.ts +0 -1
  50. package/lib/helpers/index.d.ts +0 -12
  51. package/lib/helpers/is-desktop.d.ts +0 -1
  52. package/lib/helpers/media.d.ts +0 -1
  53. package/lib/helpers/save-to-local-drive.d.ts +0 -1
  54. package/lib/helpers/serialize.d.ts +0 -1
  55. package/lib/helpers/short-hash.d.ts +0 -2
  56. package/lib/helpers/signal.d.ts +0 -23
  57. package/lib/helpers/sleep.d.ts +0 -1
  58. package/lib/helpers/trimLastSlashFromUrl.d.ts +0 -1
  59. package/lib/image/SaveImage.d.ts +0 -18
  60. package/lib/image/getCanvasCached.d.ts +0 -4
  61. package/lib/image/getSnapshot.d.ts +0 -2
  62. package/lib/image/index.d.ts +0 -4
  63. package/lib/image/loadImage.d.ts +0 -1
  64. package/lib/interfaces/image-output.d.ts +0 -7
  65. package/lib/interfaces/index.d.ts +0 -3
  66. package/lib/interfaces/load-args-tmp.interface.d.ts +0 -4
  67. package/lib/interfaces/load-args.interface.d.ts +0 -15
  68. package/lib/math/baseSortedIndex.d.ts +0 -25
  69. package/lib/math/calculateMedian.d.ts +0 -17
  70. package/lib/math/circularIndex.d.ts +0 -35
  71. package/lib/math/clampf.d.ts +0 -8
  72. package/lib/math/degrees.d.ts +0 -2
  73. package/lib/math/floatCompare.d.ts +0 -42
  74. package/lib/math/index.d.ts +0 -8
  75. package/lib/math/inverseLerp.d.ts +0 -17
  76. package/lib/math/lerp.d.ts +0 -7
  77. package/lib/mutex/Mutex.d.ts +0 -43
  78. package/lib/mutex/Semaphore.d.ts +0 -42
  79. package/lib/mutex/TaskRunner.d.ts +0 -5
  80. package/lib/mutex/index.d.ts +0 -3
  81. package/lib/predicates/index.d.ts +0 -3
  82. package/lib/predicates/operators.d.ts +0 -32
  83. package/lib/predicates/textForSearch.d.ts +0 -18
  84. package/lib/predicates/where.d.ts +0 -46
  85. package/lib/rxjs/index.d.ts +0 -3
  86. package/lib/rxjs/leadingTrailingDebounceTime.d.ts +0 -15
  87. package/lib/rxjs/smoothTransition.d.ts +0 -11
  88. package/lib/rxjs/tapLog.d.ts +0 -2
  89. package/lib/strings/index.d.ts +0 -1
  90. package/lib/strings/pad.d.ts +0 -8
  91. package/lib/tokens/index.d.ts +0 -3
  92. package/public-api.d.ts +0 -15
package/index.d.ts CHANGED
@@ -1,5 +1,865 @@
1
+ import * as rxjs from 'rxjs';
2
+ import { Observable, SchedulerLike } from 'rxjs';
3
+
1
4
  /**
2
- * Generated bundle index. Do not edit.
5
+ * RGB from each of the CMYK values to determine a return as an any[].
6
+ * CMYK values are as follows.
7
+ * C - a number between 0 and 255 representing cyan
8
+ * M - number between 0 and 255 representing magenta
9
+ * Y - number between 0 and 255 representing yellow
10
+ * K - number between 0 and 255 representing black
11
+ *
12
+ **/
13
+ declare function CMYKtoRGB(c: number, m: number, y: number, k: number): any[];
14
+
15
+ declare function HEXtoRGB(color: number | string): {
16
+ r: number;
17
+ g: number;
18
+ b: number;
19
+ };
20
+
21
+ declare function hsv(h: number, s: number, v: number): number;
22
+
23
+ /**
24
+ * HSV from each of the RGB values to determine a return as an any[].
25
+ * RGB values are as follows.
26
+ * R - a number from 0 to 255
27
+ * G - a number from 0 to 255
28
+ * B - a number from 0 to 255
29
+ *
30
+ * HSV values are as follows.
31
+ * H - a number between 360-0
32
+ * S - number between 0 and 1.0
33
+ * V - number between 0 and 1.0
34
+ *
35
+ * H is replaced with equivalent numbers in the range of the 360-0 that is out of range.
36
+ * Cannot compute, including alpha.
37
+ *
38
+ * @ Param h hue (Hue) number that indicates (to 360-0)
39
+ * @ Param s the saturation (Saturation) shows the number (0.0 to 1.0)
40
+ * @ Param v lightness (Value) indicates the number (0.0 to 1.0)
41
+ * @ Return RGB values into an any[] of [R, G, B]
42
+ **/
43
+ declare function HSVtoRGB(h: number, s: number, v: number): number[];
44
+
45
+ declare function max(col1: number, col2: number): number;
46
+
47
+ declare function min(col1: number, col2: number): number;
48
+
49
+ declare function overlay(col1: number, col2: number): number;
50
+
51
+ /**
52
+ * Values calculated from each RGB * RGB color value.
53
+ * @ Param r the red (R) indicating the number (0-255)
54
+ * @ Param g green (G) indicates the number (0-255)
55
+ * @ Param b blue (B) shows the number (0-255)
56
+ * @ Return obtained from the RGB color value for each indicating the number
57
+ **/
58
+ declare function rgb(r: number, g: number, b: number): number;
59
+
60
+ /**
61
+ * RGB from the respective figures, HSV sequences in terms of returns.
62
+ * RGB values are as follows.
63
+ * R - a number from 0 to 255
64
+ * G - a number from 0 to 255
65
+ * B - a number from 0 to 255
66
+ *
67
+ * CMYK values are as follows.
68
+ * C - a number between 0 and 255 representing cyan
69
+ * M - number between 0 and 255 representing magenta
70
+ * Y - number between 0 and 255 representing yellow
71
+ * K - number between 0 and 255 representing black
72
+ *
73
+ * Cannot compute, including alpha.
74
+ * @ Param r the red (R) indicating the number (0x00 to 0xFF to)
75
+ * @ Param g green (G) indicates the number (0x00 to 0xFF to)
76
+ * @ Param b blue (B) shows the number (0x00 to 0xFF to)
77
+ * @ Return CMYK values into an any[] of [H, S, V]
78
+ **/
79
+ declare function RGBtoCMYK(r: number, g: number, b: number): any[];
80
+
81
+ declare function RGBtoHEX(r: number, g: number, b: number): string;
82
+
83
+ /**
84
+ * RGB from the respective figures, HSV sequences in terms of returns.
85
+ * RGB values are as follows.
86
+ * R - a number from 0 to 255
87
+ * G - a number from 0 to 255
88
+ * B - a number from 0 to 255
89
+ *
90
+ * HSV values are as follows.
91
+ * H - a number between 360-0
92
+ * S - number between 0 and 1.0
93
+ * V - number between 0 and 1.0
94
+ *
95
+ * Cannot compute, including alpha.
96
+ * @ Param r the red (R) indicating the number (0x00 to 0xFF to)
97
+ * @ Param g green (G) indicates the number (0x00 to 0xFF to)
98
+ * @ Param b blue (B) shows the number (0x00 to 0xFF to)
99
+ * @ Return HSV values into an any[] of [H, S, V]
100
+ **/
101
+ declare function RGBtoHSV(r: number, g: number, b: number): number[];
102
+
103
+ declare function sub(col1: number, col2: number): number;
104
+
105
+ declare function subtract(col1: number, col2: number): number;
106
+
107
+ declare function sum(col1: number, col2: number): number;
108
+
109
+ /**
110
+ * RGB figures show (0x000000 0xFFFFFF up from) the
111
+ * R, G, B returns an any[] divided into a number from 0 to 255, respectively.
112
+ *
113
+ * @ Param rgb numbers show (0x000000 0xFFFFFF up from)
114
+ * @ Return any[] indicates the value of each color [R, G, B]
115
+ **/
116
+ declare function toRGB(rgb: number): number[];
117
+
118
+ declare function toRGBA(rgba: number): number[];
119
+
120
+ declare const COLOR_CODES: {
121
+ readonly TO_UNREAL: readonly ["#ffffff", "#005912", "UNREAL <-"];
122
+ readonly TAP_LOG: readonly ["#ffff00", "#1976d2", " [TAPLOG]"];
123
+ readonly FROM_UNREAL: readonly ["#ffff00", "#898989", "UNREAL ->"];
124
+ readonly FROM_UNREAL_ERROR: readonly ["#ffffff", "#ff0000", "UNREAL ERROR ->"];
125
+ readonly FROM_CIRRUS: readonly ["#ffffff", "#ef702b", "CIRRUS ->"];
126
+ readonly FROM_CIRRUS_ERROR: readonly ["#ffffff", "#ff0000", "CIRRUS ->"];
127
+ readonly TO_CIRRUS: readonly ["#ffffff", "#3c9738", "CIRRUS <-"];
128
+ };
129
+
130
+ declare const DOCUMENT_ROOT: any;
131
+
132
+ declare function CSV2Array(strData: any, strDelimiter?: string): any[];
133
+
134
+ declare function CSV2Records(csv: string, useRowAsHead?: number, strDelimiter?: string): any;
135
+
136
+ declare function ObjectToCSV<T extends object>(records: T[]): string | undefined;
137
+
138
+ declare const isLocalhost: boolean;
139
+
140
+ declare class Logger {
141
+ static isDevMode: boolean;
142
+ static colored(color: string, background: string, ...args: unknown[]): void;
143
+ static log(...args: unknown[]): void;
144
+ static warn(...args: unknown[]): void;
145
+ static info(...args: unknown[]): void;
146
+ static error(...args: unknown[]): void;
147
+ static table(...args: unknown[]): void;
148
+ static time(...args: any): void;
149
+ static timeEnd(...args: any): void;
150
+ }
151
+
152
+ /**
153
+ * Create a string of the form 'HOURS.MINUTES.SECONDS.MILLISECONDS'.
154
+ */
155
+ declare function timeToString(): string;
156
+ declare function timeUTCToString(): string;
157
+
158
+ declare function cleanupFileName(value: string): string;
159
+
160
+ declare function makePath(...value: string[]): string;
161
+
162
+ declare function normalizePath(value: string): string;
163
+
164
+ interface Size {
165
+ w: number;
166
+ h: number;
167
+ }
168
+
169
+ interface Coords {
170
+ x: number;
171
+ y: number;
172
+ }
173
+
174
+ interface Rect extends Size, Coords {
175
+ }
176
+
177
+ interface Area extends Rect {
178
+ scale: number;
179
+ }
180
+
181
+ declare function expandOverRectangle(objectRect: Rect, areaRect: Rect): Area;
182
+
183
+ declare function fitIntoRectangle(objectRect: Rect, areaRect: Rect, round?: boolean, fixedRatio?: number | null): Area;
184
+
185
+ interface LoadArgs {
186
+ order: number;
187
+ extra: any;
188
+ item?: HTMLImageElement;
189
+ useXhr?: boolean;
190
+ path: string;
191
+ onLoadEnd: (data: LoadArgs) => void;
192
+ onLoadStart: (data: ProgressEvent) => void;
193
+ onProgress: (data: ProgressEvent) => void;
194
+ id?: string;
195
+ img?: HTMLImageElement;
196
+ error?: boolean;
197
+ fallBack?: string;
198
+ resolutionId: number | string | null;
199
+ }
200
+
201
+ interface LoadArgsTmp extends LoadArgs {
202
+ xhr?: XMLHttpRequest;
203
+ }
204
+
205
+ declare const ImageOutput: {
206
+ readonly CANVAS: "canvas";
207
+ readonly PNG: "image/png";
208
+ readonly WEBP: "image/webp";
209
+ readonly JPG: "image/jpeg";
210
+ };
211
+ type ImageOutputValues = (typeof ImageOutput)[keyof typeof ImageOutput];
212
+
213
+ declare class BatchLoader {
214
+ private maximumSlotsNumber;
215
+ private queue;
216
+ private slots;
217
+ private _whenDone;
218
+ clear(): void;
219
+ /**
220
+ * new settings
221
+ * you must pass new settings
222
+ * @param sett
223
+ */
224
+ setSettings(sett: any): void;
225
+ /**
226
+ * execute with a chosen file
227
+ * @param id
228
+ * @param func
229
+ */
230
+ withItem(id: string, func: (item: LoadArgs) => any): boolean;
231
+ remove(id: string): LoadArgs[];
232
+ /**
233
+ * executes when all files are downloaded
234
+ * @param cb
235
+ */
236
+ whenDone(cb: any): void;
237
+ load(args: LoadArgs[]): {
238
+ path: string;
239
+ self?: any;
240
+ id: string;
241
+ }[];
242
+ /**
243
+ * operates with one file
244
+ * @param item
245
+ * @private
246
+ */
247
+ private add;
248
+ private sortByOrder;
249
+ private loadEnd;
250
+ private checkSlots;
251
+ /**
252
+ * get Item By id for interaction with files in this.queue
253
+ * @param id
254
+ * @private
255
+ */
256
+ private getById;
257
+ private getXmlHttp;
258
+ }
259
+
260
+ declare const debounce: <T extends (...args: any[]) => any>(fn: T, ms?: number) => (this: any, ...args: any[]) => void;
261
+
262
+ declare const KeyboardNumericCode: {
263
+ readonly Backspace: 8;
264
+ readonly Tab: 9;
265
+ readonly Numpad5: 12;
266
+ readonly NumpadEnter: 13;
267
+ readonly ShiftRight: 16;
268
+ readonly ControlRight: 17;
269
+ readonly ControlLeft: 17;
270
+ readonly AltRight: 18;
271
+ readonly Escape: 27;
272
+ readonly Space: 32;
273
+ readonly Numpad9: 33;
274
+ readonly Numpad3: 34;
275
+ readonly Numpad1: 35;
276
+ readonly Numpad7: 36;
277
+ readonly Numpad4: 37;
278
+ readonly Numpad8: 38;
279
+ readonly Numpad6: 39;
280
+ readonly Numpad2: 40;
281
+ readonly Numpad0: 45;
282
+ readonly NumpadDecimal: 46;
283
+ readonly Digit0: 48;
284
+ readonly Digit1: 49;
285
+ readonly Digit2: 50;
286
+ readonly Digit3: 51;
287
+ readonly Digit4: 52;
288
+ readonly Digit5: 53;
289
+ readonly Digit6: 54;
290
+ readonly Digit7: 55;
291
+ readonly Digit8: 56;
292
+ readonly Digit9: 57;
293
+ readonly KeyA: 65;
294
+ readonly KeyB: 66;
295
+ readonly KeyC: 67;
296
+ readonly KeyD: 68;
297
+ readonly KeyE: 69;
298
+ readonly KeyF: 70;
299
+ readonly KeyG: 71;
300
+ readonly KeyH: 72;
301
+ readonly KeyI: 73;
302
+ readonly KeyJ: 74;
303
+ readonly KeyK: 75;
304
+ readonly KeyL: 76;
305
+ readonly KeyM: 77;
306
+ readonly KeyN: 78;
307
+ readonly KeyO: 79;
308
+ readonly KeyP: 80;
309
+ readonly KeyQ: 81;
310
+ readonly KeyR: 82;
311
+ readonly KeyS: 83;
312
+ readonly KeyT: 84;
313
+ readonly KeyU: 85;
314
+ readonly KeyV: 86;
315
+ readonly KeyW: 87;
316
+ readonly KeyX: 88;
317
+ readonly KeyY: 89;
318
+ readonly KeyZ: 90;
319
+ readonly MetaLeft: 91;
320
+ readonly ContextMenu: 93;
321
+ readonly NumpadMultiply: 106;
322
+ readonly NumpadAdd: 107;
323
+ readonly NumpadSubtract: 109;
324
+ readonly NumpadDivide: 111;
325
+ readonly F1: 112;
326
+ readonly F2: 113;
327
+ readonly F3: 114;
328
+ readonly F4: 115;
329
+ readonly F5: 116;
330
+ readonly F6: 117;
331
+ readonly F7: 118;
332
+ readonly F8: 119;
333
+ readonly F9: 120;
334
+ readonly F10: 121;
335
+ readonly F11: 122;
336
+ readonly F12: 123;
337
+ readonly NumLock: 144;
338
+ readonly ScrollLock: 145;
339
+ readonly Semicolon: 186;
340
+ readonly Equal: 187;
341
+ readonly Comma: 188;
342
+ readonly Minus: 189;
343
+ readonly Period: 190;
344
+ readonly Slash: 191;
345
+ readonly Backquote: 192;
346
+ readonly BracketLeft: 219;
347
+ readonly Backslash: 220;
348
+ readonly BracketRight: 221;
349
+ readonly Quote: 222;
350
+ readonly IntlBackslash: 226;
351
+ readonly ArrowUp: 38;
352
+ readonly ArrowDown: 40;
353
+ readonly ArrowLeft: 37;
354
+ readonly ArrowRight: 39;
355
+ };
356
+ type IKeyName = keyof typeof KeyboardNumericCode;
357
+ type IKeyCode = (typeof KeyboardNumericCode)[IKeyName];
358
+ type InvertedKeyMapType = {
359
+ [K in IKeyName as (typeof KeyboardNumericCode)[K]]: K;
360
+ };
361
+ declare const InvertedKeyMap: InvertedKeyMapType;
362
+ declare const KeyboardStringCode: { [K in IKeyName]: K; };
363
+
364
+ declare function serialize(obj: any): string;
365
+
366
+ declare const saveToLocalDrive: (uri: string, name: string) => any;
367
+
368
+ declare function sleep(time: number): Promise<unknown>;
369
+
370
+ declare function trimLastSlashFromUrl(baseUrl: string): string | null | undefined;
371
+
372
+ /**
373
+ * SingleTone Private class.
374
+ * Event-Driving pattern for sending signals from component to component.
375
+ */
376
+ declare class SignalClass {
377
+ private static eventBus;
378
+ constructor();
379
+ /**
380
+ * It is not recommended to use this class directly.
381
+ * use the sendSignal functions instead.
382
+ * those wrappers are more convenient and provide a better type safety.
383
+ */
384
+ broadcast<K, D>(key: K, data?: D): void;
385
+ /**
386
+ * It is not recommended to use this class directly.
387
+ * use the fromSignal functions instead.
388
+ * those wrappers are more convenient and provide a better type safety.
389
+ */
390
+ on<K, D = any>(key: K): Observable<D>;
391
+ }
392
+ declare const Signal: SignalClass;
393
+
394
+ declare function generateUuid(): string;
395
+
396
+ declare function shortHash<T>(data: T, shorten?: boolean): string;
397
+ declare function shortHash(data: null | undefined, shorten?: boolean): null;
398
+
399
+ declare const isDesktop: () => boolean;
400
+
401
+ declare const media: (query: string) => rxjs.Observable<boolean>;
402
+
403
+ declare function getCanvasCached(id: string): {
404
+ canvas: HTMLCanvasElement;
405
+ ctx: CanvasRenderingContext2D;
406
+ };
407
+
408
+ declare function getSnapshot(imageElement: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap, maxWidth?: number, output?: ImageOutputValues, quality?: number): HTMLCanvasElement | string;
409
+
410
+ declare function loadImage(url: string): Promise<HTMLImageElement>;
411
+
412
+ /**
413
+ * USE DownloadImage instead!
414
+ * @deprecated use DownloadImage instead!
415
+ * @param imageSource
416
+ * @param name
417
+ * @param width
418
+ * @param format
419
+ */
420
+ declare function SaveImage(imageSource: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap | string, name: string, width?: number, format?: string | ImageOutputValues): any;
421
+ /**
422
+ * @param imageSource
423
+ * @param string name
424
+ * @param number width
425
+ * @param string format
426
+ */
427
+ declare const DownloadImage: typeof SaveImage;
428
+
429
+ /**
430
+ * Calculates the index at which the `value` should be inserted into the `array` to maintain its
431
+ * sorted order. This function performs a binary search with a complexity of O(log n), making it
432
+ * efficient for large datasets. It assumes that the input array is sorted in ascending order and
433
+ * contains comparable elements.
434
+ *
435
+ * Note: The function is designed to handle arrays with lengths up to a maximum of `HALF_MAX_ARRAY_LENGTH`
436
+ * to ensure the search operation remains within JavaScript's maximum array index limit.
437
+ *
438
+ * @param {any[]} array The sorted array into which the value should be inserted. The array elements
439
+ * should be comparable with the `value` using less-than and greater-than operations.
440
+ * @param {number} value The value to insert into the array. This function assumes that `array` is sorted
441
+ * in ascending order and will find the correct position for `value` accordingly.
442
+ * @returns {number} The index at which the `value` should be inserted into `array` to maintain its sorted order.
443
+ * If the `array` is empty or if `value` is less than or equal to all elements in `array`,
444
+ * returns 0. If `value` is greater than all elements in `array`, returns the length of `array`.
445
+ * @example
446
+ * // returns 2
447
+ * baseSortedIndex([1, 3, 4], 3);
448
+ *
449
+ * @example
450
+ * // returns 1
451
+ * baseSortedIndex([1, 2, 3], 2);
452
+ */
453
+ declare function baseSortedIndex(array: number[], value: number): number;
454
+
455
+ /**
456
+ * Calculates the median of an array of numbers.
457
+ *
458
+ * The median is the middle value of a sorted list of numbers. If the list has an even number
459
+ * of elements, the median is the average of the two middle numbers.
460
+ *
461
+ * @param numbers - An array of numbers for which the median will be calculated.
462
+ * @returns The median value as a number, or `null` if the array is empty.
463
+ *
464
+ * @example
465
+ * ```typescript
466
+ * const numbers = [3, 1, 4, 2];
467
+ * const median = calculateMedian(numbers);
468
+ * console.log(median); // Output: 2.5
469
+ * ```
470
+ */
471
+ declare function calculateMedian(numbers: number[]): number;
472
+
473
+ /**
474
+ * Computes a circular index within a given range.
475
+ *
476
+ * This function ensures that the index wraps around within the range of 0 to `totalItems - 1`.
477
+ * It uses the `clampf` function to clamp the result within the valid range.
478
+ *
479
+ * @param index - The current index to be wrapped.
480
+ * @param totalItems - The total number of items in the range.
481
+ * @returns The wrapped index within the range of 0 to `totalItems - 1`.
482
+ *
483
+ * @example
484
+ * ```typescript
485
+ * import { circularIndex } from './circularIndex';
486
+ *
487
+ * // Example 1: Basic usage
488
+ * const index1 = circularIndex(5, 5);
489
+ * console.log(index1); // Output: 0
490
+ *
491
+ * // Example 2: Index greater than totalItems
492
+ * const index2 = circularIndex(6, 5);
493
+ * console.log(index2); // Output: 1
494
+ *
495
+ * // Example 3: Negative index
496
+ * const index3 = circularIndex(-2, 5);
497
+ * console.log(index3); // Output: 3
498
+ *
499
+ * // Example 4: Large Negative index
500
+ * const index4 = circularIndex(-6, 5);
501
+ * console.log(index4); // Output: 4
502
+ *
503
+ * // Example 5: Index equal to totalItems
504
+ * const index5 = circularIndex(1, 1);
505
+ * console.log(index5); // Output: 0
506
+ */
507
+ declare function circularIndex(index: number, totalItems: number): number;
508
+
509
+ /**
510
+ * Clamps value between min and max;
511
+ * @param min minValue
512
+ * @param max maxValue
513
+ * @param value inputValue
514
+ * @returns number
515
+ */
516
+ declare function clampf(min: number, max: number, value: number): number;
517
+
518
+ declare function degreesToRadians(degrees: number): number;
519
+ declare function radiansToDegrees(radians: number): number;
520
+
521
+ /**
522
+ * Checks if floating-point number `A` is less than `B` considering a small margin of error.
523
+ *
524
+ * @param A - The first floating-point number to compare.
525
+ * @param B - The second floating-point number to compare.
526
+ * @param Epsilon - Optional custom epsilon value for comparison. Defaults to `EPSILON` if not provided.
527
+ * @returns `true` if `A` is less than `B` considering the epsilon margin, otherwise `false`.
528
+ *
529
+ * @example
530
+ * ```
531
+ * const result = fpIsALessThanB(0.0034, 0.0066); // true
532
+ * ```
533
+ */
534
+ declare function fpIsALessThanB(A: number, B: number, Epsilon?: number): boolean;
535
+ /**
536
+ * Checks if floating-point number `A` is greater than `B` considering a small margin of error.
537
+ *
538
+ * @param A - The first floating-point number to compare.
539
+ * @param B - The second floating-point number to compare.
540
+ * @param Epsilon - Optional custom epsilon value for comparison. Defaults to `EPSILON` if not provided.
541
+ * @returns `true` if `A` is greater than `B` considering the epsilon margin, otherwise `false`.
542
+ *
543
+ * @example
544
+ * ```
545
+ * const result = fpIsAGreaterThanB(0.0066, 0.0034); // true
546
+ * ```
547
+ */
548
+ declare function fpIsAGreaterThanB(A: number, B: number, Epsilon?: number): boolean;
549
+ /**
550
+ * Checks if floating-point number `A` is approximately the same as `B` considering a small margin of error.
551
+ *
552
+ * @param A - The first floating-point number to compare.
553
+ * @param B - The second floating-point number to compare.
554
+ * @param Epsilon - Optional custom epsilon value for comparison. Defaults to `EPSILON` if not provided.
555
+ * @returns `true` if `A` is approximately equal to `B` considering the epsilon margin, otherwise `false`.
556
+ *
557
+ * @example
558
+ * ```
559
+ * const result = fpIsASameAsB(0.005, 0.0051); // true
560
+ * ```
561
+ */
562
+ declare function fpIsASameAsB(A: number, B: number, Epsilon?: number): boolean;
563
+
564
+ /**
565
+ * Performs an inverse linear interpolation.
566
+ *
567
+ * Given a range defined by `min` and `max`, this function calculates the
568
+ * interpolation factor (or percentage) of `value` within that range. Optionally,
569
+ * it can clamp the result to be between 0 and 1 to ensure the return value is
570
+ * within the range of a standard lerp operation.
571
+ *
572
+ * @param {number} min - The minimum value of the interpolation range.
573
+ * @param {number} max - The maximum value of the interpolation range.
574
+ * @param {number} value - The value to interpolate.
575
+ * @param {boolean} [clampToNormal=false] - Whether to clamp the result between 0 and 1.
576
+ * @returns {number} The interpolation factor of `value` between `min` and `max`.
577
+ * If `clampToNormal` is true, the result is clamped between 0 and 1.
578
+ * If the difference between `min` and `max` is 0, returns 1 to avoid division by zero.
579
+ */
580
+ declare function inverseLerp(min: number, max: number, value: number, clampToNormal?: boolean): number;
581
+
582
+ /**
583
+ * @param min minimums
584
+ * @param max maximums
585
+ * @param value current float value in 0-1 range
586
+ * @returns clamped value
587
+ */
588
+ declare function lerp(min: number, max: number, value: number): number;
589
+
590
+ /**
591
+ * A Mutex class to handle mutual exclusion locks, ensuring that only one asynchronous task can execute a critical section at a time.
592
+ *
593
+ * @example
594
+ * const mutex = new Mutex();
595
+ *
596
+ * async function task(name: string, duration: number) {
597
+ * console.log(`${name} waiting to acquire mutex`);
598
+ * const release = await mutex.acquire();
599
+ * console.log(`${name} acquired mutex`);
600
+ * await new Promise(resolve => setTimeout(resolve, duration));
601
+ * console.log(`${name} releasing mutex`);
602
+ * release();
603
+ * }
604
+ *
605
+ * task('Task 1', 1000);
606
+ * task('Task 2', 2000);
607
+ * task('Task 3', 1500);
608
+ * task('Task 4', 500);
609
+ *
610
+ * Outputs
611
+ * [LOG]: "Task 1 waiting to acquire mutex"
612
+ * [LOG]: "Task 2 waiting to acquire mutex"
613
+ * [LOG]: "Task 3 waiting to acquire mutex"
614
+ * [LOG]: "Task 4 waiting to acquire mutex"
615
+ * [LOG]: "Task 1 acquired mutex"
616
+ * [LOG]: "Task 1 releasing mutex"
617
+ * [LOG]: "Task 2 acquired mutex"
618
+ * [LOG]: "Task 2 releasing mutex"
619
+ * [LOG]: "Task 3 acquired mutex"
620
+ * [LOG]: "Task 3 releasing mutex"
621
+ * [LOG]: "Task 4 acquired mutex"
622
+ * [LOG]: "Task 4 releasing mutex"
623
+ */
624
+ declare class Mutex {
625
+ private mutex;
626
+ /**
627
+ * Acquires the mutex, returning a promise that resolves when the mutex is acquired.
628
+ * The returned promise provides a release function that should be called to release the mutex.
629
+ * @returns A promise that resolves with a release function.
630
+ */
631
+ acquire(): Promise<() => void>;
632
+ }
633
+
634
+ /**
635
+ * A Semaphore controls access to a resource that can handle a limited number of concurrent operations.
636
+ *
637
+ * @example
638
+ * const semaphore = new Semaphore(2);
639
+ *
640
+ * async function task(name: string, duration: number) {
641
+ * console.log(`${name} waiting to acquire semaphore`);
642
+ * await semaphore.acquire();
643
+ * console.log(`${name} acquired semaphore`);
644
+ * await new Promise(resolve => setTimeout(resolve, duration));
645
+ * console.log(`${name} releasing semaphore`);
646
+ * semaphore.release();
647
+ * }
648
+ *
649
+ * task('Task 1', 1000);
650
+ * task('Task 2', 2000);
651
+ * task('Task 3', 1500);
652
+ * task('Task 4', 500);
653
+ *
654
+ * Outputs
655
+ * [LOG]: "Task 1 waiting to acquire semaphore"
656
+ * [LOG]: "Task 2 waiting to acquire semaphore"
657
+ * [LOG]: "Task 3 waiting to acquire semaphore"
658
+ * [LOG]: "Task 4 waiting to acquire semaphore"
659
+ * [LOG]: "Task 1 acquired semaphore"
660
+ * [LOG]: "Task 2 acquired semaphore"
661
+ * [LOG]: "Task 1 releasing semaphore"
662
+ * [LOG]: "Task 3 acquired semaphore"
663
+ * [LOG]: "Task 2 releasing semaphore"
664
+ * [LOG]: "Task 4 acquired semaphore"
665
+ * [LOG]: "Task 4 releasing semaphore"
666
+ * [LOG]: "Task 3 releasing semaphore"
667
+ */
668
+ declare class Semaphore {
669
+ private readonly maxConcurrency;
670
+ private tasks;
671
+ private currentCount;
672
+ constructor(maxConcurrency: number);
673
+ acquire(): Promise<void>;
674
+ release(): void;
675
+ }
676
+
677
+ declare class TaskRunner {
678
+ private mutex;
679
+ runTask(name: string, task: () => Observable<string | null>): Observable<string | null>;
680
+ }
681
+
682
+ type TruthyTypesOf$1<T> = T extends false | '' | 0 | null | undefined ? never : T;
683
+ type FalsyTypesOf<T> = T extends false | '' | 0 | null | undefined ? T : never;
684
+ type EmptyTypesOf<T> = T extends undefined | null | object | '' ? T : never;
685
+ type NonEmptyTypesOf<T> = T extends undefined | null | object | '' ? never : T;
686
+ /**
687
+ * The Boolean object represents a truth value: true or false.
688
+ * @param value
689
+ * @constructor
690
+ * Returns:boolean
691
+ */
692
+ declare const Truthy: <T>(value: T) => value is TruthyTypesOf$1<T>;
693
+ /**
694
+ * The Boolean object represents an INVERSE truth value: true or false.
695
+ * @param value
696
+ * @constructor
697
+ * Returns:boolean
698
+ */
699
+ declare const Falsy$1: <T>(value: T) => value is FalsyTypesOf<T>;
700
+ /**
701
+ * Checks if a value is empty.
702
+ *
703
+ * @param {any} value - The value to check.
704
+ * @return {boolean} Returns true if the value is empty, otherwise false.
705
+ */
706
+ declare const IsEmpty: <T>(value: T) => value is EmptyTypesOf<T>;
707
+ declare const NotEmpty: <T>(value: T) => value is NonEmptyTypesOf<T>;
708
+ declare const isDefined: <T>(arg: T | null | undefined) => arg is T;
709
+ declare const isNotDefined: <T>(arg: T | null | undefined) => arg is null | undefined;
710
+ declare const isJSON: (str: string) => boolean;
711
+ declare const isEmpty: (value: any) => boolean;
712
+ declare function isAllValuesTruthy<T extends string, K>(value: Record<T, K>): boolean;
713
+
714
+ /**
715
+ * Converts a given value to a string suitable for search comparisons.
716
+ * The resulting string is in lowercase, with consecutive spaces replaced by underscores.
717
+ * The function uses a cache to improve performance by storing and reusing the results of previous conversions.
718
+ *
719
+ * @param {any} value - The value to be converted to a search-friendly string.
720
+ * It can be of any type, but it will be coerced to a string if not already one.
721
+ *
722
+ * @param {boolean} caseSensitive - A flag indicating whether the comparison should be case-sensitive.
723
+ * If set to true, the function will perform case-sensitive comparisons, preserving the original casing of input strings.
724
+ * If set to false (default), the function will convert the input strings to lowercase for case-insensitive comparisons
725
+ *
726
+ * @returns {string} The processed string, which is trimmed, converted to lowercase (unless caseSensitive is true),
727
+ * and has all sequences of spaces replaced with underscores. This string is either
728
+ * retrieved from the cache or freshly computed and then cached.
729
+ *
730
+ */
731
+ declare function textForSearch(value: unknown, caseSensitive?: boolean): string;
732
+
733
+ /**
734
+ * Builds a predicate that checks whether a record matches **all** provided criteria.
735
+ *
736
+ * Behavior:
737
+ * - Only keys with **defined** values in `criteria` are considered; keys with `undefined` are ignored.
738
+ * - Both the criterion value and the corresponding record value are normalized using `textForSearch(value, caseSensitive)`,
739
+ * then compared for **equality** (not substring/contains).
740
+ * - By default (`caseSensitive = false`), comparisons are case-insensitive and tolerant to extra spacing
741
+ * (per `textForSearch`). When `caseSensitive = true`, comparisons preserve original casing.
742
+ * - If **no** criteria have defined values, the resulting predicate always returns **false**.
743
+ *
744
+ * @remarks
745
+ * **Nested object stringification (runtime edge case):**
746
+ * Although the TypeScript types constrain comparisons to primitive fields via `ISearchable<T>`,
747
+ * at runtime any non-primitive value that slips through (e.g., due to loose typing) will be coerced to a string
748
+ * before normalization. For example:
749
+ *
750
+ * ```ts
751
+ * // Runtime behavior with nested objects (typing omitted for brevity)
752
+ * const record = { age: 20, test: { hello: 'world' } } as any;
753
+ * // textForSearch(record.test, false) => "[object_object]" (e.g., "[object Object]" normalized)
754
+ * const criteria = { age: 20, test: "[object_object]" } as any;
755
+ * const matches = where<any>(criteria)(record);
756
+ * // matches === true
757
+ * ```
758
+ *
759
+ * In other words, `{ hello: 'world' }` is interpreted as the string `"[object_object]"` after normalization,
760
+ * so a criterion with `test: "[object_object]"` will successfully match.
761
+ *
762
+ * @typeParam T - The object type whose **primitive** fields are comparable via `ISearchable<T>`.
763
+ *
764
+ * @param criteria - A partial set of key–value pairs over `ISearchable<T>` to match against.
765
+ * Only keys with defined values participate in the comparison.
766
+ * @param caseSensitive - Whether comparisons should be case-sensitive. Defaults to `false`.
767
+ *
768
+ * @returns A predicate `(record: ISearchable<T>) => boolean` that is `true` iff the record matches **all** criteria.
769
+ *
770
+ * @example
771
+ * type Item = { name: string; category: string; note?: string };
772
+ * const items: Item[] = [
773
+ * { name: "Apple", category: "Fruit" },
774
+ * { name: "Carrot", category: "Vegetable" },
775
+ * { name: "Banana", category: "Fruit" }
776
+ * ];
777
+ *
778
+ * // Case-insensitive equality match on category ("fruit" matches "Fruit")
779
+ * const isFruit = where<Item>({ category: "fruit" });
780
+ * const fruits = items.filter(isFruit);
781
+ * // → [{ name: "Apple", category: "Fruit" }, { name: "Banana", category: "Fruit" }]
782
+ *
783
+ * // Empty criteria → predicate always false
784
+ * const matchNothing = where<Item>({});
785
+ * items.filter(matchNothing); // → []
786
+ */
787
+ declare function where<T extends object>(criteria: Input<T>, caseSensitive?: boolean): (record: ISearchable<T>) => boolean;
788
+ /**
789
+ * Builds a predicate that is the logical **negation** of `where`.
790
+ *
791
+ * Behavior mirrors `where(criteria, caseSensitive)` but returns `true` when a record **does not**
792
+ * satisfy all criteria. Notable edge cases:
793
+ * - If `criteria` has no defined values (i.e., `where` would always return `false`), this negated predicate
794
+ * will always return **true**.
795
+ * - **Nested object stringification (runtime edge case):** If a nested object is compared against a criterion
796
+ * like `"[object_object]"` (after normalization), the original `where` would return `true`, so `whereNot` will return `false`.
797
+ *
798
+ * @typeParam T - The object type whose **primitive** fields are comparable via `ISearchable<T>`.
799
+ *
800
+ * @param criteria - Same as in `where`.
801
+ * @param caseSensitive - Same as in `where`. Defaults to `false`.
802
+ *
803
+ * @returns A predicate `(record: ISearchable<T>) => boolean` that is `true` iff the record **fails** the `where` check.
804
+ *
805
+ * @example
806
+ * type Item = { name: string; category: string };
807
+ * const items: Item[] = [
808
+ * { name: "Apple", category: "Fruit" },
809
+ * { name: "Carrot", category: "Vegetable" }
810
+ * ];
811
+ *
812
+ * const isNotFruit = whereNot<Item>({ category: "fruit" });
813
+ * items.filter(isNotFruit);
814
+ * // → [{ name: "Carrot", category: "Vegetable" }]
815
+ */
816
+ declare function whereNot<T extends object>(criteria: Input<T>, caseSensitive?: boolean): (record: ISearchable<T>) => boolean;
817
+ type HasPrimitivePartKeys<T> = {
818
+ [K in keyof T]: Extract<T[K], Primitive> extends never ? never : K;
819
+ }[keyof T];
820
+ type ISearchable<T> = {
821
+ [K in HasPrimitivePartKeys<T>]: Extract<T[K], Primitive>;
822
+ };
823
+ type Input<T> = Partial<TruthyTypesOf<ISearchable<T>>>;
824
+ type Primitive = string | number | bigint | boolean | symbol | null | undefined;
825
+ type TruthyTypesOf<T> = T extends Falsy ? never : T;
826
+ type Falsy = null | undefined | false | 0 | -0 | 0n | '';
827
+
828
+ /**
829
+ * Emits the most recent value emitted by the source Observable after a
830
+ * specified time span has passed without another source emission.
831
+ *
832
+ * This is a combination of `debounceTime` and `auditTime` operators.
833
+ *
834
+ * The leading value is emitted immediately, and trailing values are debounced.
835
+ *
836
+ * @param dueTime The time to wait before emitting the last value.
837
+ * @param scheduler The scheduler to use for the timeout.
838
+ * @returns A function that returns an Observable that mirrors the source Observable, but applies the specified debouncing.
839
+ */
840
+ declare function leadingTrailingDebounceTime<T>(dueTime: number, scheduler?: SchedulerLike): (source: Observable<T>) => Observable<T>;
841
+
842
+ /**
843
+ * Creates an observable that emits values transitioning smoothly from the start value to the end value over a specified duration.
844
+ * The transition is performed using linear interpolation (lerp) and clamped to the range [0, 1].
845
+ *
846
+ * @param {number} start - The starting value of the transition.
847
+ * @param {number} end - The ending value of the transition.
848
+ * @param {number} duration - The duration of the transition in milliseconds.
849
+ * @returns {Observable<number>} An observable that emits the interpolated values from start to end over the specified duration.
850
+ */
851
+ declare const smoothTransition: (start: number, end: number, duration: number) => Observable<number>;
852
+
853
+ declare const tapLog: <T>(text: string, ...args: any) => ((source: Observable<T>) => Observable<T>);
854
+
855
+ /**
856
+ * Adds required number of symbols before input
857
+ * @param input input string
858
+ * @param size amount of total symbols
859
+ * @param symbol filler
860
+ * @returns string
3
861
  */
4
- /// <amd-module name="@3dsource/utils" />
5
- export * from './public-api';
862
+ declare function pad(input: number | string, size: number, symbol?: string): string;
863
+
864
+ export { BatchLoader, CMYKtoRGB, COLOR_CODES, CSV2Array, CSV2Records, DOCUMENT_ROOT, DownloadImage, Falsy$1 as Falsy, HEXtoRGB, HSVtoRGB, ImageOutput, InvertedKeyMap, IsEmpty, KeyboardNumericCode, KeyboardStringCode, Logger, Mutex, NotEmpty, ObjectToCSV, RGBtoCMYK, RGBtoHEX, RGBtoHSV, SaveImage, Semaphore, Signal, TaskRunner, Truthy, baseSortedIndex, calculateMedian, circularIndex, clampf, cleanupFileName, debounce, degreesToRadians, expandOverRectangle, fitIntoRectangle, fpIsAGreaterThanB, fpIsALessThanB, fpIsASameAsB, generateUuid, getCanvasCached, getSnapshot, hsv, inverseLerp, isAllValuesTruthy, isDefined, isDesktop, isEmpty, isJSON, isLocalhost, isNotDefined, leadingTrailingDebounceTime, lerp, loadImage, makePath, max, media, min, normalizePath, overlay, pad, radiansToDegrees, rgb, saveToLocalDrive, serialize, shortHash, sleep, smoothTransition, sub, subtract, sum, tapLog, textForSearch, timeToString, timeUTCToString, toRGB, toRGBA, trimLastSlashFromUrl, where, whereNot };
865
+ export type { Area, Coords, IKeyCode, IKeyName, ImageOutputValues, LoadArgs, LoadArgsTmp, Rect, Size };