@react-hive/honey-utils 3.13.1 → 3.14.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/README.md CHANGED
@@ -553,7 +553,6 @@ function divide(a: number, b: number): number {
553
553
  - `toKebabCase(input: string): string` - Converts a string to kebab-case.
554
554
  - `camelToDashCase(input: string): string` - Converts camelCase to dash-case.
555
555
  - `splitStringIntoWords(input: string): string[]` - Splits a string into an array of words.
556
- - `hashString(input: string): string` - Generates a short hash from a string.
557
556
 
558
557
  ### Object Utilities
559
558
 
@@ -583,9 +582,6 @@ function divide(a: number, b: number): number {
583
582
  - `noop(): void` - A no-operation function.
584
583
  - `not<Args extends any[]>(fn: (...args: Args) => any): (...args: Args) => boolean` - Creates a new function that negates the result of the given predicate function. Useful for logical inversions, e.g., turning `isEven` into `isOdd`.
585
584
  - `invokeIfFunction<Args extends any[], Result>(input: ((...args: Args) => Result) | Result, ...args: Args): Result` - Invokes the input if it's a function, otherwise returns it as-is.
586
- - `delay(delayMs: number): Promise<void>` - Creates a promise that resolves after the specified delay in milliseconds.
587
- - `timeout<T>(promise: Promise<T>, timeoutMs: number, message?: string): Promise<T>` - Wraps a promise with a timeout. If the promise does not settle within the given duration, it rejects with a timeout error.
588
- - `retry<Task, TaskResult>(task: Task, options?: RetryOptions): Function` - Wraps an asynchronous function with retry logic, with configurable max attempts, delay between retries, exponential backoff, and retry callbacks.
589
585
  - `once<T extends (...args: any[]) => any>(fn: T): T` - Wraps a function so it can only be executed once. The result of the first invocation is cached and returned for all subsequent calls. Preserves both the original function’s parameter types and `this` binding.
590
586
 
591
587
  ### Type Guards
@@ -620,6 +616,7 @@ function divide(a: number, b: number): number {
620
616
  - `calculateEuclideanDistance(startX: number, startY: number, endX: number, endY: number): number` - Calculates the Euclidean distance between two points.
621
617
  - `calculateMovingSpeed(distance: number, elapsedTime: number): number` - Calculates moving speed.
622
618
  - `calculatePercentage(value: number, percentage: number): number` - Calculates the specified percentage of a value.
619
+ - `hashString(input: string): string` - Generates a short hash from a string.
623
620
 
624
621
  ### ENV
625
622
 
@@ -687,6 +684,9 @@ function divide(a: number, b: number): number {
687
684
  - `someAsync<Item>(array: Item[], predicate): Promise<boolean>` - Returns `true` if **any** item in the array passes the async predicate.
688
685
  - `everyAsync<Item>(array: Item[], predicate): Promise<boolean>` - Returns `true` if **all** items in the array pass the async predicate.
689
686
  - `findAsync<Item>(array: Item[], predicate): Promise<Nullable<Item>>` - Returns the first array item that passes the async predicate, or `null` if no match is found.
687
+ - `delay(delayMs: number): Promise<void>` - Creates a promise that resolves after the specified delay in milliseconds.
688
+ - `timeout<T>(promise: Promise<T>, timeoutMs: number, message?: string): Promise<T>` - Wraps a promise with a timeout. If the promise does not settle within the given duration, it rejects with a timeout error.
689
+ - `retry<Task, TaskResult>(task: Task, options?: RetryOptions): Function` - Wraps an asynchronous function with retry logic, with configurable max attempts, delay between retries, exponential backoff, and retry callbacks.
690
690
 
691
691
  ### Intersection Utilities
692
692
 
package/dist/README.md CHANGED
@@ -553,7 +553,6 @@ function divide(a: number, b: number): number {
553
553
  - `toKebabCase(input: string): string` - Converts a string to kebab-case.
554
554
  - `camelToDashCase(input: string): string` - Converts camelCase to dash-case.
555
555
  - `splitStringIntoWords(input: string): string[]` - Splits a string into an array of words.
556
- - `hashString(input: string): string` - Generates a short hash from a string.
557
556
 
558
557
  ### Object Utilities
559
558
 
@@ -583,9 +582,6 @@ function divide(a: number, b: number): number {
583
582
  - `noop(): void` - A no-operation function.
584
583
  - `not<Args extends any[]>(fn: (...args: Args) => any): (...args: Args) => boolean` - Creates a new function that negates the result of the given predicate function. Useful for logical inversions, e.g., turning `isEven` into `isOdd`.
585
584
  - `invokeIfFunction<Args extends any[], Result>(input: ((...args: Args) => Result) | Result, ...args: Args): Result` - Invokes the input if it's a function, otherwise returns it as-is.
586
- - `delay(delayMs: number): Promise<void>` - Creates a promise that resolves after the specified delay in milliseconds.
587
- - `timeout<T>(promise: Promise<T>, timeoutMs: number, message?: string): Promise<T>` - Wraps a promise with a timeout. If the promise does not settle within the given duration, it rejects with a timeout error.
588
- - `retry<Task, TaskResult>(task: Task, options?: RetryOptions): Function` - Wraps an asynchronous function with retry logic, with configurable max attempts, delay between retries, exponential backoff, and retry callbacks.
589
585
  - `once<T extends (...args: any[]) => any>(fn: T): T` - Wraps a function so it can only be executed once. The result of the first invocation is cached and returned for all subsequent calls. Preserves both the original function’s parameter types and `this` binding.
590
586
 
591
587
  ### Type Guards
@@ -620,6 +616,7 @@ function divide(a: number, b: number): number {
620
616
  - `calculateEuclideanDistance(startX: number, startY: number, endX: number, endY: number): number` - Calculates the Euclidean distance between two points.
621
617
  - `calculateMovingSpeed(distance: number, elapsedTime: number): number` - Calculates moving speed.
622
618
  - `calculatePercentage(value: number, percentage: number): number` - Calculates the specified percentage of a value.
619
+ - `hashString(input: string): string` - Generates a short hash from a string.
623
620
 
624
621
  ### ENV
625
622
 
@@ -687,6 +684,9 @@ function divide(a: number, b: number): number {
687
684
  - `someAsync<Item>(array: Item[], predicate): Promise<boolean>` - Returns `true` if **any** item in the array passes the async predicate.
688
685
  - `everyAsync<Item>(array: Item[], predicate): Promise<boolean>` - Returns `true` if **all** items in the array pass the async predicate.
689
686
  - `findAsync<Item>(array: Item[], predicate): Promise<Nullable<Item>>` - Returns the first array item that passes the async predicate, or `null` if no match is found.
687
+ - `delay(delayMs: number): Promise<void>` - Creates a promise that resolves after the specified delay in milliseconds.
688
+ - `timeout<T>(promise: Promise<T>, timeoutMs: number, message?: string): Promise<T>` - Wraps a promise with a timeout. If the promise does not settle within the given duration, it rejects with a timeout error.
689
+ - `retry<Task, TaskResult>(task: Task, options?: RetryOptions): Function` - Wraps an asynchronous function with retry logic, with configurable max attempts, delay between retries, exponential backoff, and retry callbacks.
690
690
 
691
691
  ### Intersection Utilities
692
692
 
@@ -1,4 +1,4 @@
1
- import type { Nullable } from '../../types';
1
+ import type { Nullable } from '~/types';
2
2
  export declare const FOCUSABLE_HTML_TAGS: string[];
3
3
  /**
4
4
  * Determines whether an HTMLElement is focusable under standard browser rules.
@@ -1,4 +1,4 @@
1
- import type { Nullable } from '../../types';
1
+ import type { Nullable } from '~/types';
2
2
  export type FocusMoveDirection = 'next' | 'previous';
3
3
  export interface MoveFocusWithinContainerOptions {
4
4
  /**
@@ -1,4 +1,4 @@
1
- import type { Nullable } from './types';
1
+ import type { Nullable } from '~/types';
2
2
  /**
3
3
  * Checks if a value is a Promise.
4
4
  *
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Creates a promise that resolves after the specified delay.
3
+ *
4
+ * Useful for creating artificial delays, implementing timeouts, or spacing operations.
5
+ *
6
+ * @param delayMs - The delay in milliseconds.
7
+ *
8
+ * @returns A promise that resolves after the specified delay.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * // Wait for 1 second
13
+ * await delay(1000);
14
+ * console.log('This logs after 1 second');
15
+ *
16
+ * // Use with other async operations
17
+ * const fetchWithTimeout = async () => {
18
+ * const timeoutPromise = delay(5000).then(() => {
19
+ * throw new Error('Request timed out');
20
+ * });
21
+ *
22
+ * return Promise.race([fetchData(), timeoutPromise]);
23
+ * }
24
+ * ```
25
+ */
26
+ export declare const delay: (delayMs: number) => Promise<void>;
@@ -0,0 +1,4 @@
1
+ export * from './async';
2
+ export * from './delay';
3
+ export * from './timeout';
4
+ export * from './retry';
@@ -0,0 +1,72 @@
1
+ interface RetryOptions {
2
+ /**
3
+ * Maximum number of retry attempts before failing.
4
+ *
5
+ * @default 3
6
+ */
7
+ maxAttempts?: number;
8
+ /**
9
+ * Delay in milliseconds between retry attempts.
10
+ * If `backoff` is true, this is the base delay for exponential backoff.
11
+ *
12
+ * @default 300
13
+ */
14
+ delayMs?: number;
15
+ /**
16
+ * Whether to use exponential backoff for delays between attempts.
17
+ * When enabled, the delay is multiplied by 2 ^ (`attempt` - 1).
18
+ *
19
+ * @default true
20
+ */
21
+ backoff?: boolean;
22
+ /**
23
+ * Optional callback triggered before each retry attempt.
24
+ *
25
+ * @param attempt - The current attempt number (starting from 1).
26
+ * @param error - The error that caused the retry.
27
+ */
28
+ onRetry?: (attempt: number, error: unknown) => void;
29
+ }
30
+ /**
31
+ * Wraps an asynchronous function with retry logic.
32
+ *
33
+ * The returned function will attempt to call the original function up to `maxAttempts` times,
34
+ * with a delay between retries. If all attempts fail, the last encountered error is thrown.
35
+ *
36
+ * Useful for operations that may fail intermittently, such as network requests.
37
+ *
38
+ * @template Task - The type of the async function to wrap.
39
+ * @template TaskResult - The result type of the async function.
40
+ *
41
+ * @param task - The async function to wrap with retry logic.
42
+ * @param options - Configuration options for retry behavior.
43
+ *
44
+ * @returns A function that wraps the original function with retry support.
45
+ *
46
+ * @example
47
+ * ```ts
48
+ * async function fetchData() {
49
+ * const response = await fetch('/api/data');
50
+ *
51
+ * if (!response.ok) {
52
+ * throw new Error('Network error');
53
+ * }
54
+ *
55
+ * return await response.json();
56
+ * }
57
+ *
58
+ * const fetchWithRetry = retry(fetchData, {
59
+ * maxAttempts: 5,
60
+ * delayMs: 500,
61
+ * onRetry: (attempt, error) => {
62
+ * console.warn(`Attempt ${attempt} failed:`, error);
63
+ * }
64
+ * });
65
+ *
66
+ * fetchWithRetry()
67
+ * .then(data => console.log('Success:', data))
68
+ * .catch(error => console.error('Failed after retries:', error));
69
+ * ```
70
+ */
71
+ export declare const retry: <Task extends (...args: unknown[]) => Promise<TaskResult>, TaskResult>(task: Task, { maxAttempts, delayMs, backoff, onRetry }?: RetryOptions) => ((...args: Parameters<Task>) => Promise<TaskResult>);
72
+ export {};
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Wraps a promise with a timeout. If the promise does not settle within the specified time,
3
+ * it will reject with a timeout error.
4
+ *
5
+ * @template T - The type of the promise result.
6
+ *
7
+ * @param promise - The promise to wrap.
8
+ * @param timeoutMs - Timeout duration in milliseconds.
9
+ * @param errorMessage - Optional custom error message.
10
+ *
11
+ * @returns A promise that resolves or rejects with the original promise,
12
+ * or rejects with a timeout error if the duration is exceeded.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * // Rejects if fetch takes longer than 3 seconds
17
+ * const response = await timeout(fetch('/api/data'), 3000);
18
+ *
19
+ * // With custom message
20
+ * await timeout(fetchData(), 2000, 'Too long');
21
+ * ```
22
+ */
23
+ export declare const timeout: <T>(promise: Promise<T>, timeoutMs: number, errorMessage?: string) => Promise<T>;
@@ -0,0 +1,47 @@
1
+ export declare const noop: () => void;
2
+ /**
3
+ * Checks if a value is a function.
4
+ *
5
+ * @param value - The value to check.
6
+ *
7
+ * @returns `true` if the value is a function; otherwise, `false`.
8
+ */
9
+ export declare const isFunction: (value: unknown) => value is Function;
10
+ /**
11
+ * Creates a function that negates the result of the given predicate function.
12
+ *
13
+ * @template Args - Argument types of the predicate function.
14
+ *
15
+ * @param fn - A function that returns any value.
16
+ *
17
+ * @returns A new function that returns the negated result of the original function.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * const isEven = (n: number) => n % 2 === 0;
22
+ * const isOdd = not(isEven);
23
+ *
24
+ * console.log(isOdd(2)); // false
25
+ * console.log(isOdd(3)); // true
26
+ * ```
27
+ */
28
+ export declare const not: <Args extends unknown[]>(fn: (...args: Args) => any) => ((...args: Args) => boolean);
29
+ /**
30
+ * Wraps a function so that it can only be executed once.
31
+ * The wrapped function remembers (caches) the result of the first invocation
32
+ * and returns that same result for all subsequent calls, regardless of the arguments provided.
33
+ *
34
+ * Common use cases include:
35
+ * - initializing singletons
36
+ * - running setup logic only once
37
+ * - avoiding repeated expensive computations
38
+ *
39
+ * @template T - A function type whose return value should be cached.
40
+ *
41
+ * @param fn - The function to execute at most once.
42
+ *
43
+ * @returns A new function with the same signature as `fn`, but guaranteed to
44
+ * execute `fn` only on the first call and return the cached result
45
+ * thereafter.
46
+ */
47
+ export declare const once: <T extends (...args: any[]) => any>(fn: T) => T;
@@ -0,0 +1,2 @@
1
+ export * from './function';
2
+ export * from './invoke-if-function';
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Invokes the given input if it is a function, passing the provided arguments.
3
+ * Otherwise, returns the input as-is.
4
+ *
5
+ * @template Args - Tuple of argument types to pass to the function.
6
+ * @template Result - Return type of the function or the value.
7
+ *
8
+ * @param input - A function to invoke with `args`, or a direct value of type `Result`.
9
+ * @param args - Arguments to pass if `input` is a function.
10
+ *
11
+ * @returns The result of invoking the function, or the original value if it's not a function.
12
+ */
13
+ export declare const invokeIfFunction: <Args extends unknown[], Result>(input: ((...args: Args) => Result) | Result, ...args: Args) => Result;
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- (()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function n(e,t){if(!e)throw new Error(t)}e.r(t),e.d(t,{FOCUSABLE_HTML_TAGS:()=>xe,assert:()=>n,blobToFile:()=>be,calculateCenterOffset:()=>he,calculateEuclideanDistance:()=>te,calculateMovingSpeed:()=>ne,calculatePercentage:()=>re,camelToDashCase:()=>K,camelToWords:()=>J,centerElementInContainer:()=>me,chunk:()=>F,cloneBlob:()=>ie,compact:()=>E,compose:()=>C,definedProps:()=>Oe,delay:()=>N,difference:()=>T,downloadFile:()=>se,everyAsync:()=>U,fileListToFiles:()=>we,filterParallel:()=>W,filterSequential:()=>z,findAsync:()=>q,getDOMRectIntersectionRatio:()=>ve,getElementOffsetRect:()=>ae,getFocusableHtmlElements:()=>Me,getLocalStorageCapabilities:()=>Ce,getXOverflowWidth:()=>ue,getYOverflowHeight:()=>de,hasXOverflow:()=>ce,hasYOverflow:()=>fe,hashString:()=>ee,intersection:()=>M,invokeIfFunction:()=>D,isAnchorHtmlElement:()=>le,isArray:()=>O,isBlob:()=>d,isBool:()=>s,isContentEditableHtmlElement:()=>oe,isDate:()=>f,isDecimal:()=>A,isDefined:()=>a,isEmptyArray:()=>v,isEmptyObject:()=>u,isError:()=>h,isFile:()=>ge,isFiniteNumber:()=>b,isFunction:()=>_,isHtmlElementFocusable:()=>Fe,isInteger:()=>S,isLocalStorageReadable:()=>Pe,isMap:()=>g,isNil:()=>i,isNilOrEmptyString:()=>V,isNull:()=>r,isNumber:()=>o,isObject:()=>c,isPromise:()=>j,isRegExp:()=>y,isSet:()=>p,isString:()=>G,isSymbol:()=>w,isUndefined:()=>l,isValidDate:()=>m,moveFocusWithinContainer:()=>Te,noop:()=>k,not:()=>L,once:()=>Y,parse2DMatrix:()=>ye,parseFileName:()=>pe,pipe:()=>P,readFilesFromDataTransfer:()=>Ae,reduceAsync:()=>$,resolveAxisDelta:()=>Ee,retry:()=>X,runParallel:()=>I,runSequential:()=>H,someAsync:()=>B,splitStringIntoWords:()=>Q,timeout:()=>R,toKebabCase:()=>Z,traverseFileSystemDirectory:()=>Se,unique:()=>x});const r=e=>null===e,i=e=>null==e,a=e=>null!=e,l=e=>void 0===e,o=e=>"number"==typeof e,s=e=>"boolean"==typeof e,c=e=>"object"==typeof e,u=e=>c(e)&&!r(e)&&0===Object.keys(e).length,f=e=>e instanceof Date,d=e=>e instanceof Blob,h=e=>e instanceof Error,m=e=>f(e)&&!isNaN(e.getTime()),y=e=>e instanceof RegExp,g=e=>e instanceof Map,p=e=>e instanceof Set,w=e=>"symbol"==typeof e,b=e=>o(e)&&isFinite(e),S=e=>o(e)&&Number.isInteger(e),A=e=>b(e)&&!Number.isInteger(e),O=e=>Array.isArray(e),v=e=>O(e)&&0===e.length,E=e=>e.filter(Boolean),x=e=>[...new Set(e)],F=(e,t)=>(n(t>0,"Chunk size must be greater than 0"),Array.from({length:Math.ceil(e.length/t)},(n,r)=>e.slice(r*t,(r+1)*t))),M=(...e)=>{if(0===e.length)return[];if(1===e.length)return[...e[0]];const[t,...n]=e;return x(t).filter(e=>n.every(t=>t.includes(e)))},T=(e,t)=>e.filter(e=>!t.includes(e)),P=(...e)=>t=>e.reduce((e,t)=>t(e),t),C=(...e)=>t=>e.reduceRight((e,t)=>t(e),t),k=()=>{},_=e=>"function"==typeof e,L=e=>(...t)=>!e(...t),D=(e,...t)=>"function"==typeof e?e(...t):e,N=e=>new Promise(t=>setTimeout(t,e)),R=async(e,t,n="Operation timed out")=>{try{return await Promise.race([e,N(t).then(()=>Promise.reject(new Error(n)))])}finally{}},X=(e,{maxAttempts:t=3,delayMs:n=300,backoff:r=!0,onRetry:i}={})=>async(...a)=>{let l;for(let o=1;o<=t;o++)try{return await e(...a)}catch(e){if(l=e,o<t){i?.(o,e);const t=r?n*2**(o-1):n;await N(t)}}throw l},Y=e=>{let t,n=!1;return function(...r){return n||(n=!0,t=e.apply(this,r)),t}},j=e=>_(e?.then),H=async(e,t)=>{const n=[];for(let r=0;r<e.length;r++)n.push(await t(e[r],r,e));return n},I=async(e,t)=>Promise.all(e.map(t)),z=async(e,t)=>{const n=[];for(let r=0;r<e.length;r++){const i=e[r];await t(i,r,e)&&n.push(i)}return n},W=async(e,t)=>{const n=await I(e,async(e,n,r)=>!!await t(e,n,r)&&e);return E(n)},B=async(e,t)=>{for(let n=0;n<e.length;n++)if(await t(e[n],n,e))return!0;return!1},U=async(e,t)=>{for(let n=0;n<e.length;n++)if(!await t(e[n],n,e))return!1;return!0},$=async(e,t,n)=>{let r=n;for(let n=0;n<e.length;n++)r=await t(r,e[n],n,e);return r},q=async(e,t)=>{for(let n=0;n<e.length;n++)if(await t(e[n],n,e))return e[n];return null},G=e=>"string"==typeof e,V=e=>""===e||i(e),Z=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),K=e=>{const t=e.charAt(0),n=e.slice(1);return t.toLowerCase()+n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)},J=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1 $2"),Q=e=>e.split(" ").filter(Boolean),ee=e=>{let t=5381;for(let n=0;n<e.length;n++)t=33*t^e.charCodeAt(n);return(t>>>0).toString(36)},te=(e,t,n,r)=>{const i=n-e,a=r-t;return Math.hypot(i,a)},ne=(e,t)=>Math.abs(e/t),re=(e,t)=>e*t/100,ie=e=>new Blob([e],{type:e.type}),ae=e=>new DOMRect(e.offsetLeft,e.offsetTop,e.clientWidth,e.clientHeight),le=e=>"A"===e.tagName,oe=e=>"true"===e.getAttribute("contenteditable"),se=(e,{fileName:t,target:r}={})=>{if(l(document))return;const i=document.createElement("a");let a=null;try{const n=G(e)?e:a=URL.createObjectURL(e);i.href=n,t&&(i.download=t),r&&(i.target=r),document.body.appendChild(i),i.click()}finally{i.remove(),a&&setTimeout(()=>{n(a,"Object URL should not be null"),URL.revokeObjectURL(a)},0)}},ce=e=>e.scrollWidth>e.clientWidth,ue=e=>Math.max(0,e.scrollWidth-e.clientWidth),fe=e=>e.scrollHeight>e.clientHeight,de=e=>Math.max(0,e.scrollHeight-e.clientHeight),he=({overflowSize:e,containerSize:t,elementOffset:n,elementSize:r})=>{if(e<=0)return 0;const i=n+r/2-t/2;return-Math.max(0,Math.min(i,e))},me=(e,t,{axis:n="both"}={})=>{let r=0,i=0;"x"!==n&&"both"!==n||(r=he({overflowSize:ue(e),containerSize:e.clientWidth,elementOffset:t.offsetLeft,elementSize:t.clientWidth})),"y"!==n&&"both"!==n||(i=he({overflowSize:de(e),containerSize:e.clientHeight,elementOffset:t.offsetTop,elementSize:t.clientHeight})),e.style.transform=`translate(${r}px, ${i}px)`},ye=e=>{const t=window.getComputedStyle(e).getPropertyValue("transform").match(/^matrix\((.+)\)$/);if(!t)return{translateX:0,translateY:0,scaleX:1,scaleY:1,skewX:0,skewY:0};const[n,r,i,a,l,o]=t[1].split(", ").map(parseFloat);return{translateX:l,translateY:o,scaleX:n,scaleY:a,skewX:i,skewY:r}},ge=e=>e instanceof File,pe=e=>{const t=e.lastIndexOf(".");return t<=0||t===e.length-1?[e,""]:[e.slice(0,t),e.slice(t+1).toLowerCase()]},we=e=>{if(!e)return[];const t=[];for(let n=0;n<e.length;n++)t.push(e[n]);return t},be=(e,t)=>new File([e],t,{type:e.type}),Se=async(e,{skipFiles:t=[".DS_Store","Thumbs.db","desktop.ini","ehthumbs.db",".Spotlight-V100",".Trashes",".fseventsd","__MACOSX"]}={})=>{const n=new Set(t),r=await(async e=>{const t=e.createReader(),n=async()=>new Promise((e,r)=>{t.readEntries(async t=>{if(t.length)try{const r=await n();e([...t,...r])}catch(e){r(e)}else e([])},r)});return n()})(e);return(await I(r,async e=>e.isDirectory?Se(e,{skipFiles:t}):n.has(e.name)?[]:[await new Promise((t,n)=>{e.file(t,n)})])).flat()},Ae=async(e,t={})=>{const n=e?.items;if(!n)return[];const r=[];for(let e=0;e<n.length;e++){const i=n[e];if("webkitGetAsEntry"in i){const e=i.webkitGetAsEntry?.();if(e?.isDirectory){r.push(Se(e,t));continue}if(e?.isFile){r.push(new Promise((t,n)=>e.file(e=>t([e]),n)));continue}}const a=i.getAsFile();a&&r.push(Promise.resolve([a]))}return(await Promise.all(r)).flat()},Oe=e=>Object.entries(e).reduce((e,[t,n])=>(void 0!==n&&(e[t]=n),e),{}),ve=(e,t)=>Math.max(0,Math.min(e.right,t.right)-Math.max(e.left,t.left))*Math.max(0,Math.min(e.bottom,t.bottom)-Math.max(e.top,t.top))/(t.width*t.height),Ee=(e,t,{allowFallback:n=!0,invert:r=!0}={})=>{const i=r?-1:1;switch(t){case"x":return{deltaX:i*(0!==e.deltaX?e.deltaX:n?e.deltaY:0),deltaY:0};case"y":return{deltaX:0,deltaY:i*e.deltaY};default:return{deltaX:i*e.deltaX,deltaY:i*e.deltaY}}},xe=["INPUT","SELECT","TEXTAREA","BUTTON","A"],Fe=e=>{if(!e)return!1;const t=window.getComputedStyle(e);if("hidden"===t.visibility||"none"===t.display)return!1;if("disabled"in e&&e.disabled)return!1;const n=e.getAttribute("tabindex");return"-1"!==n&&(xe.includes(e.tagName)?!le(e)||""!==e.href:!!oe(e)||null!==n)},Me=e=>Array.from(e.querySelectorAll("*")).filter(Fe),Te=(e,t=null,{wrap:n=!0,getNextIndex:r}={})=>{const i=document.activeElement,a=t??i?.parentElement;if(!i||!a)return;const l=Me(a);if(0===l.length)return;const o=l.indexOf(i);if(-1===o)return;let s;r?s=r(o,e,l):"next"===e?(s=o+1,s>=l.length&&(s=n?0:null)):(s=o-1,s<0&&(s=n?l.length-1:null)),null!==s&&l[s]?.focus()},Pe=()=>{if("undefined"==typeof window||!window.localStorage)return!1;try{return window.localStorage.getItem("__non_existing_key__"),!0}catch{return!1}},Ce=()=>{if(!Pe())return{readable:!1,writable:!1};try{const e="__test_write__";return window.localStorage.setItem(e,"1"),window.localStorage.removeItem(e),{readable:!0,writable:!0}}catch{}return{readable:!0,writable:!1}};module.exports=t})();
1
+ (()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function n(e,t){if(!e)throw new Error(t)}e.r(t),e.d(t,{FOCUSABLE_HTML_TAGS:()=>xe,assert:()=>n,blobToFile:()=>be,calculateCenterOffset:()=>he,calculateEuclideanDistance:()=>ee,calculateMovingSpeed:()=>te,calculatePercentage:()=>ne,camelToDashCase:()=>V,camelToWords:()=>Z,centerElementInContainer:()=>me,chunk:()=>F,cloneBlob:()=>ie,compact:()=>E,compose:()=>C,definedProps:()=>Oe,delay:()=>B,difference:()=>T,downloadFile:()=>se,everyAsync:()=>I,fileListToFiles:()=>we,filterParallel:()=>j,filterSequential:()=>Y,findAsync:()=>W,getDOMRectIntersectionRatio:()=>ve,getElementOffsetRect:()=>ae,getFocusableHtmlElements:()=>Me,getLocalStorageCapabilities:()=>Ce,getXOverflowWidth:()=>ue,getYOverflowHeight:()=>de,hasXOverflow:()=>ce,hasYOverflow:()=>fe,hashString:()=>re,intersection:()=>M,invokeIfFunction:()=>Q,isAnchorHtmlElement:()=>le,isArray:()=>O,isBlob:()=>d,isBool:()=>s,isContentEditableHtmlElement:()=>oe,isDate:()=>f,isDecimal:()=>A,isDefined:()=>a,isEmptyArray:()=>v,isEmptyObject:()=>u,isError:()=>h,isFile:()=>ge,isFiniteNumber:()=>b,isFunction:()=>_,isHtmlElementFocusable:()=>Fe,isInteger:()=>S,isLocalStorageReadable:()=>Pe,isMap:()=>g,isNil:()=>i,isNilOrEmptyString:()=>J,isNull:()=>r,isNumber:()=>o,isObject:()=>c,isPromise:()=>N,isRegExp:()=>y,isSet:()=>p,isString:()=>q,isSymbol:()=>w,isUndefined:()=>l,isValidDate:()=>m,moveFocusWithinContainer:()=>Te,noop:()=>k,not:()=>L,once:()=>D,parse2DMatrix:()=>ye,parseFileName:()=>pe,pipe:()=>P,readFilesFromDataTransfer:()=>Ae,reduceAsync:()=>z,resolveAxisDelta:()=>Ee,retry:()=>$,runParallel:()=>X,runSequential:()=>R,someAsync:()=>H,splitStringIntoWords:()=>K,timeout:()=>U,toKebabCase:()=>G,traverseFileSystemDirectory:()=>Se,unique:()=>x});const r=e=>null===e,i=e=>null==e,a=e=>null!=e,l=e=>void 0===e,o=e=>"number"==typeof e,s=e=>"boolean"==typeof e,c=e=>"object"==typeof e,u=e=>c(e)&&!r(e)&&0===Object.keys(e).length,f=e=>e instanceof Date,d=e=>e instanceof Blob,h=e=>e instanceof Error,m=e=>f(e)&&!isNaN(e.getTime()),y=e=>e instanceof RegExp,g=e=>e instanceof Map,p=e=>e instanceof Set,w=e=>"symbol"==typeof e,b=e=>o(e)&&isFinite(e),S=e=>o(e)&&Number.isInteger(e),A=e=>b(e)&&!Number.isInteger(e),O=e=>Array.isArray(e),v=e=>O(e)&&0===e.length,E=e=>e.filter(Boolean),x=e=>[...new Set(e)],F=(e,t)=>(n(t>0,"Chunk size must be greater than 0"),Array.from({length:Math.ceil(e.length/t)},(n,r)=>e.slice(r*t,(r+1)*t))),M=(...e)=>{if(0===e.length)return[];if(1===e.length)return[...e[0]];const[t,...n]=e;return x(t).filter(e=>n.every(t=>t.includes(e)))},T=(e,t)=>e.filter(e=>!t.includes(e)),P=(...e)=>t=>e.reduce((e,t)=>t(e),t),C=(...e)=>t=>e.reduceRight((e,t)=>t(e),t),k=()=>{},_=e=>"function"==typeof e,L=e=>(...t)=>!e(...t),D=e=>{let t,n=!1;return function(...r){return n||(n=!0,t=e.apply(this,r)),t}},N=e=>_(e?.then),R=async(e,t)=>{const n=[];for(let r=0;r<e.length;r++)n.push(await t(e[r],r,e));return n},X=async(e,t)=>Promise.all(e.map(t)),Y=async(e,t)=>{const n=[];for(let r=0;r<e.length;r++){const i=e[r];await t(i,r,e)&&n.push(i)}return n},j=async(e,t)=>{const n=await X(e,async(e,n,r)=>!!await t(e,n,r)&&e);return E(n)},H=async(e,t)=>{for(let n=0;n<e.length;n++)if(await t(e[n],n,e))return!0;return!1},I=async(e,t)=>{for(let n=0;n<e.length;n++)if(!await t(e[n],n,e))return!1;return!0},z=async(e,t,n)=>{let r=n;for(let n=0;n<e.length;n++)r=await t(r,e[n],n,e);return r},W=async(e,t)=>{for(let n=0;n<e.length;n++)if(await t(e[n],n,e))return e[n];return null},B=e=>new Promise(t=>setTimeout(t,e)),U=async(e,t,n="Operation timed out")=>{try{return await Promise.race([e,B(t).then(()=>Promise.reject(new Error(n)))])}finally{}},$=(e,{maxAttempts:t=3,delayMs:n=300,backoff:r=!0,onRetry:i}={})=>async(...a)=>{let l;for(let o=1;o<=t;o++)try{return await e(...a)}catch(e){if(l=e,o<t){i?.(o,e);const t=r?n*2**(o-1):n;await B(t)}}throw l},q=e=>"string"==typeof e,G=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),V=e=>{const t=e.charAt(0),n=e.slice(1);return t.toLowerCase()+n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)},Z=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1 $2"),K=e=>e.split(" ").filter(Boolean),J=e=>""===e||i(e),Q=(e,...t)=>"function"==typeof e?e(...t):e,ee=(e,t,n,r)=>{const i=n-e,a=r-t;return Math.hypot(i,a)},te=(e,t)=>Math.abs(e/t),ne=(e,t)=>e*t/100,re=e=>{let t=5381;for(let n=0;n<e.length;n++)t=33*t^e.charCodeAt(n);return(t>>>0).toString(36)},ie=e=>new Blob([e],{type:e.type}),ae=e=>new DOMRect(e.offsetLeft,e.offsetTop,e.clientWidth,e.clientHeight),le=e=>"A"===e.tagName,oe=e=>"true"===e.getAttribute("contenteditable"),se=(e,{fileName:t,target:r}={})=>{if(l(document))return;const i=document.createElement("a");let a=null;try{const n=q(e)?e:a=URL.createObjectURL(e);i.href=n,t&&(i.download=t),r&&(i.target=r),document.body.appendChild(i),i.click()}finally{i.remove(),a&&setTimeout(()=>{n(a,"Object URL should not be null"),URL.revokeObjectURL(a)},0)}},ce=e=>e.scrollWidth>e.clientWidth,ue=e=>Math.max(0,e.scrollWidth-e.clientWidth),fe=e=>e.scrollHeight>e.clientHeight,de=e=>Math.max(0,e.scrollHeight-e.clientHeight),he=({overflowSize:e,containerSize:t,elementOffset:n,elementSize:r})=>{if(e<=0)return 0;const i=n+r/2-t/2;return-Math.max(0,Math.min(i,e))},me=(e,t,{axis:n="both"}={})=>{let r=0,i=0;"x"!==n&&"both"!==n||(r=he({overflowSize:ue(e),containerSize:e.clientWidth,elementOffset:t.offsetLeft,elementSize:t.clientWidth})),"y"!==n&&"both"!==n||(i=he({overflowSize:de(e),containerSize:e.clientHeight,elementOffset:t.offsetTop,elementSize:t.clientHeight})),e.style.transform=`translate(${r}px, ${i}px)`},ye=e=>{const t=window.getComputedStyle(e).getPropertyValue("transform").match(/^matrix\((.+)\)$/);if(!t)return{translateX:0,translateY:0,scaleX:1,scaleY:1,skewX:0,skewY:0};const[n,r,i,a,l,o]=t[1].split(", ").map(parseFloat);return{translateX:l,translateY:o,scaleX:n,scaleY:a,skewX:i,skewY:r}},ge=e=>e instanceof File,pe=e=>{const t=e.lastIndexOf(".");return t<=0||t===e.length-1?[e,""]:[e.slice(0,t),e.slice(t+1).toLowerCase()]},we=e=>{if(!e)return[];const t=[];for(let n=0;n<e.length;n++)t.push(e[n]);return t},be=(e,t)=>new File([e],t,{type:e.type}),Se=async(e,{skipFiles:t=[".DS_Store","Thumbs.db","desktop.ini","ehthumbs.db",".Spotlight-V100",".Trashes",".fseventsd","__MACOSX"]}={})=>{const n=new Set(t),r=await(async e=>{const t=e.createReader(),n=async()=>new Promise((e,r)=>{t.readEntries(async t=>{if(t.length)try{const r=await n();e([...t,...r])}catch(e){r(e)}else e([])},r)});return n()})(e);return(await X(r,async e=>e.isDirectory?Se(e,{skipFiles:t}):n.has(e.name)?[]:[await new Promise((t,n)=>{e.file(t,n)})])).flat()},Ae=async(e,t={})=>{const n=e?.items;if(!n)return[];const r=[];for(let e=0;e<n.length;e++){const i=n[e];if("webkitGetAsEntry"in i){const e=i.webkitGetAsEntry?.();if(e?.isDirectory){r.push(Se(e,t));continue}if(e?.isFile){r.push(new Promise((t,n)=>e.file(e=>t([e]),n)));continue}}const a=i.getAsFile();a&&r.push(Promise.resolve([a]))}return(await Promise.all(r)).flat()},Oe=e=>Object.entries(e).reduce((e,[t,n])=>(void 0!==n&&(e[t]=n),e),{}),ve=(e,t)=>Math.max(0,Math.min(e.right,t.right)-Math.max(e.left,t.left))*Math.max(0,Math.min(e.bottom,t.bottom)-Math.max(e.top,t.top))/(t.width*t.height),Ee=(e,t,{allowFallback:n=!0,invert:r=!0}={})=>{const i=r?-1:1;switch(t){case"x":return{deltaX:i*(0!==e.deltaX?e.deltaX:n?e.deltaY:0),deltaY:0};case"y":return{deltaX:0,deltaY:i*e.deltaY};default:return{deltaX:i*e.deltaX,deltaY:i*e.deltaY}}},xe=["INPUT","SELECT","TEXTAREA","BUTTON","A"],Fe=e=>{if(!e)return!1;const t=window.getComputedStyle(e);if("hidden"===t.visibility||"none"===t.display)return!1;if("disabled"in e&&e.disabled)return!1;const n=e.getAttribute("tabindex");return"-1"!==n&&(xe.includes(e.tagName)?!le(e)||""!==e.href:!!oe(e)||null!==n)},Me=e=>Array.from(e.querySelectorAll("*")).filter(Fe),Te=(e,t=null,{wrap:n=!0,getNextIndex:r}={})=>{const i=document.activeElement,a=t??i?.parentElement;if(!i||!a)return;const l=Me(a);if(0===l.length)return;const o=l.indexOf(i);if(-1===o)return;let s;r?s=r(o,e,l):"next"===e?(s=o+1,s>=l.length&&(s=n?0:null)):(s=o-1,s<0&&(s=n?l.length-1:null)),null!==s&&l[s]?.focus()},Pe=()=>{if("undefined"==typeof window||!window.localStorage)return!1;try{return window.localStorage.getItem("__non_existing_key__"),!0}catch{return!1}},Ce=()=>{if(!Pe())return{readable:!1,writable:!1};try{const e="__test_write__";return window.localStorage.setItem(e,"1"),window.localStorage.removeItem(e),{readable:!0,writable:!0}}catch{}return{readable:!0,writable:!1}};module.exports=t})();
2
2
  //# sourceMappingURL=index.cjs.map