@react-hive/honey-utils 3.9.0 → 3.11.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
@@ -619,10 +619,13 @@ function divide(a: number, b: number): number {
619
619
  - `isContentEditableHtmlElement(element: HTMLElement): boolean` - Returns `true` if the element has `contenteditable="true"`, making it user-editable and implicitly focusable.
620
620
  - `isHtmlElementFocusable(element: Nullable<HTMLElement>): boolean` - Checks whether an element is considered focusable according to browser rules. Factors include: visibility, `display`, `disabled`, `tabindex`, native focusable tags, `contenteditable`, and presence of a non-null `tabindex`.
621
621
  - `getFocusableHtmlElements(container: HTMLElement): HTMLElement[]` - Returns all focusable descendant elements within a container, using `isHtmlElementFocusable` to filter them.
622
+ - `moveFocusWithinContainer(direction: FocusMoveDirection, container?: Nullable<HTMLElement>, options?: MoveFocusWithinContainerOptions): void` - Moves focus to the next or previous focusable element within a container. Supports cyclic navigation, optional wrapping control, and custom focus index resolution for advanced keyboard navigation patterns (e.g. roving tabindex).
622
623
  - `hasXOverflow(element: HTMLElement): boolean` - Checks whether an element has horizontal overflow. Returns `true` if the content overflows beyond the visible width.
623
624
  - `getXOverflowWidth(element: HTMLElement): number` - Calculates the horizontal overflow width of an element. Returns the number of pixels by which the content exceeds the visible width, or `0` when no horizontal overflow exists.
624
625
  - `hasYOverflow(element: HTMLElement): boolean` - Checks whether an element has vertical overflow. Returns `true` if the content overflows beyond the visible height.
625
626
  - `getYOverflowHeight(element: HTMLElement): number` - Calculates the vertical overflow height of an element. Returns the number of pixels by which the content exceeds the visible height, or `0` when no vertical overflow exists.
627
+ - `calculateCenterOffset(options: CalculateCenterOffsetOptions): number` - Calculates a clamped offset value that centers an element within a container along a single axis. Returns a negative value suitable for use in a CSS `translate` transform, or `0` when no overflow exists.
628
+ - `centerElementInContainer(containerElement: HTMLElement, elementToCenter: HTMLElement, options?: CenterElementInContainerOptions): void` - Translates a container so that a target element is visually centered within its visible bounds using CSS transforms. Centering is applied independently per axis and only when an overflow exists.
626
629
  - `isLocalStorageReadable(): boolean` - Determines whether `localStorage` can be safely read from. This check works even when writes fail (e.g., due to `QuotaExceededError`) and ensures that calling `getItem()` does not throw in restricted environments.
627
630
  - `getLocalStorageCapabilities(): LocalStorageCapabilities` - Detects the browser's read and write capabilities for `localStorage`. Readability is determined by safe execution of `getItem()`, while writability requires successful `setItem()` and `removeItem()`.
628
631
 
package/dist/README.md CHANGED
@@ -619,10 +619,13 @@ function divide(a: number, b: number): number {
619
619
  - `isContentEditableHtmlElement(element: HTMLElement): boolean` - Returns `true` if the element has `contenteditable="true"`, making it user-editable and implicitly focusable.
620
620
  - `isHtmlElementFocusable(element: Nullable<HTMLElement>): boolean` - Checks whether an element is considered focusable according to browser rules. Factors include: visibility, `display`, `disabled`, `tabindex`, native focusable tags, `contenteditable`, and presence of a non-null `tabindex`.
621
621
  - `getFocusableHtmlElements(container: HTMLElement): HTMLElement[]` - Returns all focusable descendant elements within a container, using `isHtmlElementFocusable` to filter them.
622
+ - `moveFocusWithinContainer(direction: FocusMoveDirection, container?: Nullable<HTMLElement>, options?: MoveFocusWithinContainerOptions): void` - Moves focus to the next or previous focusable element within a container. Supports cyclic navigation, optional wrapping control, and custom focus index resolution for advanced keyboard navigation patterns (e.g. roving tabindex).
622
623
  - `hasXOverflow(element: HTMLElement): boolean` - Checks whether an element has horizontal overflow. Returns `true` if the content overflows beyond the visible width.
623
624
  - `getXOverflowWidth(element: HTMLElement): number` - Calculates the horizontal overflow width of an element. Returns the number of pixels by which the content exceeds the visible width, or `0` when no horizontal overflow exists.
624
625
  - `hasYOverflow(element: HTMLElement): boolean` - Checks whether an element has vertical overflow. Returns `true` if the content overflows beyond the visible height.
625
626
  - `getYOverflowHeight(element: HTMLElement): number` - Calculates the vertical overflow height of an element. Returns the number of pixels by which the content exceeds the visible height, or `0` when no vertical overflow exists.
627
+ - `calculateCenterOffset(options: CalculateCenterOffsetOptions): number` - Calculates a clamped offset value that centers an element within a container along a single axis. Returns a negative value suitable for use in a CSS `translate` transform, or `0` when no overflow exists.
628
+ - `centerElementInContainer(containerElement: HTMLElement, elementToCenter: HTMLElement, options?: CenterElementInContainerOptions): void` - Translates a container so that a target element is visually centered within its visible bounds using CSS transforms. Centering is applied independently per axis and only when an overflow exists.
626
629
  - `isLocalStorageReadable(): boolean` - Determines whether `localStorage` can be safely read from. This check works even when writes fail (e.g., due to `QuotaExceededError`) and ensures that calling `getItem()` does not throw in restricted environments.
627
630
  - `getLocalStorageCapabilities(): LocalStorageCapabilities` - Detects the browser's read and write capabilities for `localStorage`. Readability is determined by safe execution of `getItem()`, while writability requires successful `setItem()` and `removeItem()`.
628
631
 
package/dist/async.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { Nullable } from './types';
1
2
  /**
2
3
  * Checks if a value is a Promise.
3
4
  *
@@ -144,4 +145,4 @@ export declare const reduceAsync: <Item, Accumulator>(array: Item[], fn: (accumu
144
145
  *
145
146
  * @returns A promise that resolves to the found item or null if none match.
146
147
  */
147
- export declare const findAsync: <Item>(array: Item[], predicate: (item: Item, index: number, array: Item[]) => Promise<boolean>) => Promise<Item | null>;
148
+ export declare const findAsync: <Item>(array: Item[], predicate: (item: Item, index: number, array: Item[]) => Promise<boolean>) => Promise<Nullable<Item>>;
package/dist/dom.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { Nullable } from './types';
1
2
  export declare const FOCUSABLE_HTML_TAGS: string[];
2
3
  interface HTMLElementTransformationValues {
3
4
  translateX: number;
@@ -95,7 +96,7 @@ export declare const isContentEditableHtmlElement: (element: HTMLElement) => boo
95
96
  *
96
97
  * @returns Whether the element is focusable.
97
98
  */
98
- export declare const isHtmlElementFocusable: (element: HTMLElement | null) => boolean;
99
+ export declare const isHtmlElementFocusable: (element: Nullable<HTMLElement>) => boolean;
99
100
  /**
100
101
  * Collects all focusable descendant elements within a container.
101
102
  *
@@ -108,6 +109,57 @@ export declare const isHtmlElementFocusable: (element: HTMLElement | null) => bo
108
109
  * @returns An array of focusable HTMLElements in DOM order.
109
110
  */
110
111
  export declare const getFocusableHtmlElements: (container: HTMLElement) => HTMLElement[];
112
+ export type FocusMoveDirection = 'next' | 'previous';
113
+ export interface MoveFocusWithinContainerOptions {
114
+ /**
115
+ * Whether focus navigation should wrap around when reaching
116
+ * the beginning or end of the focusable elements list.
117
+ *
118
+ * When enabled, moving past the last element focuses the first,
119
+ * and moving before the first focuses the last.
120
+ *
121
+ * @default true
122
+ */
123
+ wrap?: boolean;
124
+ /**
125
+ * Custom resolver for determining the next focus index.
126
+ *
127
+ * When provided, this function overrides the default navigation logic
128
+ * and receives full control over how the focus moves.
129
+ *
130
+ * @param currentIndex - Index of the currently focused element.
131
+ * @param direction - Direction in which focus is moving.
132
+ * @param elements - Ordered list of focusable elements within the container.
133
+ *
134
+ * @returns The index of the element to focus next, or `null` to prevent focus movement.
135
+ */
136
+ getNextIndex?: (currentIndex: number, direction: FocusMoveDirection, elements: HTMLElement[]) => Nullable<number>;
137
+ }
138
+ /**
139
+ * Moves focus to the next or previous focusable element within a container.
140
+ *
141
+ * This utility is commonly used to implement accessible keyboard navigation patterns such as:
142
+ * - roving tabindex
143
+ * - custom dropdowns
144
+ * - tablists
145
+ * - menus
146
+ * - horizontal or vertical navigation groups
147
+ *
148
+ * Focus movement is scoped to a container and operates on the list of
149
+ * focusable descendants returned by `getFocusableHtmlElements`.
150
+ *
151
+ * @param direction - Direction in which focus should move (`'next'` or `'previous'`).
152
+ * @param container - Optional container that defines the focus scope.
153
+ * If omitted, the parent element of the currently focused element is used.
154
+ * @param options - Optional configuration controlling wrapping behavior and custom index resolution.
155
+ *
156
+ * @remarks
157
+ * - This function reads from and mutates the document's focus state.
158
+ * - If no active element exists, no container can be resolved,
159
+ * or the active element is not part of the focusable set, no action is taken.
160
+ * - When `getNextIndex` is provided, it fully overrides the default wrapping and directional logic.
161
+ */
162
+ export declare const moveFocusWithinContainer: (direction: FocusMoveDirection, container?: Nullable<HTMLElement>, { wrap, getNextIndex }?: MoveFocusWithinContainerOptions) => void;
111
163
  /**
112
164
  * Checks whether an element has horizontal overflow.
113
165
  *
@@ -146,6 +198,74 @@ export declare const hasYOverflow: (element: HTMLElement) => boolean;
146
198
  * @returns The overflow height in pixels. Returns `0` when the content does not overflow vertically.
147
199
  */
148
200
  export declare const getYOverflowHeight: (element: HTMLElement) => number;
201
+ export interface CalculateCenterOffsetOptions {
202
+ /**
203
+ * Total overflow size for the axis.
204
+ *
205
+ * Represents how much larger the content is compared to the visible
206
+ * container size (e.g. scroll width minus client width).
207
+ */
208
+ overflowSize: number;
209
+ /**
210
+ * Visible size of the container along the axis.
211
+ *
212
+ * Typically, `clientWidth` for the X axis or `clientHeight` for the Y axis.
213
+ */
214
+ containerSize: number;
215
+ /**
216
+ * Offset of the target element from the start of the container along the axis.
217
+ *
218
+ * Typically, `offsetLeft` (X axis) or `offsetTop` (Y axis).
219
+ */
220
+ elementOffset: number;
221
+ /**
222
+ * Size of the target element along the axis.
223
+ *
224
+ * Typically, `clientWidth` (X axis) or `clientHeight` (Y axis).
225
+ */
226
+ elementSize: number;
227
+ }
228
+ /**
229
+ * Calculates the offset required to center an element within a container along a single axis.
230
+ *
231
+ * The returned value is clamped so that the resulting translation does not
232
+ * exceed the container's scrollable bounds.
233
+ *
234
+ * This function performs pure math only and does not access the DOM.
235
+ *
236
+ * @returns A negative offset value suitable for use in a CSS `translate`
237
+ * transform, or `0` when no overflow exists on the axis.
238
+ */
239
+ export declare const calculateCenterOffset: ({ overflowSize, containerSize, elementOffset, elementSize, }: CalculateCenterOffsetOptions) => number;
240
+ type Axis = 'x' | 'y' | 'both';
241
+ export interface CenterElementInContainerOptions {
242
+ /**
243
+ * Axis (or axes) along which centering is applied.
244
+ *
245
+ * @default 'both'
246
+ */
247
+ axis?: Axis;
248
+ }
249
+ /**
250
+ * Translates a container so that a target element is visually centered within its visible bounds.
251
+ *
252
+ * Centering is achieved by applying a CSS `transform: translate(...)` to the
253
+ * container element rather than using native scrolling.
254
+ *
255
+ * ### Behavior
256
+ * - Centering is calculated independently for each enabled axis.
257
+ * - Translation is applied only when the container content overflows on that axis.
258
+ * - When no overflow exists, the container remains untransformed for that axis.
259
+ *
260
+ * ### Notes
261
+ * - This function performs immediate DOM reads and writes.
262
+ * - The resulting transform is clamped to valid scrollable bounds.
263
+ *
264
+ * @param containerElement - The container whose content is translated.
265
+ * @param elementToCenter - The descendant element to align to the container’s center.
266
+ * @param options - Optional configuration controlling which axis or axes are centered.
267
+ */
268
+ export declare const centerElementInContainer: (containerElement: HTMLElement, elementToCenter: HTMLElement, { axis }?: CenterElementInContainerOptions) => void;
149
269
  /**
150
270
  * Determines whether the browser environment allows safe read access to
151
271
  * `localStorage`. Some platforms (e.g., Safari Private Mode, sandboxed iframes)
package/dist/file.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { Nullable } from './types';
1
2
  /**
2
3
  * Checks if a value is a `File` object.
3
4
  *
@@ -29,7 +30,7 @@ export declare const parseFileName: (fileName: string) => string[];
29
30
  *
30
31
  * @returns An array of `File` objects.
31
32
  */
32
- export declare const fileListToFiles: (fileList: FileList | null) => File[];
33
+ export declare const fileListToFiles: (fileList: Nullable<FileList>) => File[];
33
34
  /**
34
35
  * Converts a `Blob` object into a `File` object with the specified name.
35
36
  *
@@ -92,5 +93,5 @@ export declare const traverseFileSystemDirectory: (directoryEntry: FileSystemDir
92
93
  * - files extracted from directory entries via `webkitGetAsEntry`,
93
94
  * - and files found recursively within nested subdirectories.
94
95
  */
95
- export declare const readFilesFromDataTransfer: (dataTransfer: DataTransfer | null, traverseOptions?: TraverseDirectoryOptions) => Promise<File[]>;
96
+ export declare const readFilesFromDataTransfer: (dataTransfer: Nullable<DataTransfer>, traverseOptions?: TraverseDirectoryOptions) => Promise<File[]>;
96
97
  export {};
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- (()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},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 r(e,t){if(!e)throw new Error(t)}e.r(t),e.d(t,{FOCUSABLE_HTML_TAGS:()=>ie,assert:()=>r,blobToFile:()=>Ee,calculateEuclideanDistance:()=>te,calculateMovingSpeed:()=>re,calculatePercentage:()=>ne,camelToDashCase:()=>K,camelToWords:()=>J,chunk:()=>P,cloneBlob:()=>se,compact:()=>O,compose:()=>k,definedProps:()=>Fe,delay:()=>H,difference:()=>v,everyAsync:()=>q,fileListToFiles:()=>Ae,filterParallel:()=>Y,filterSequential:()=>W,findAsync:()=>z,getDOMRectIntersectionRatio:()=>oe,getElementOffsetRect:()=>le,getFocusableHtmlElements:()=>he,getLocalStorageCapabilities:()=>we,getXOverflowWidth:()=>me,getYOverflowHeight:()=>ge,hasXOverflow:()=>ye,hasYOverflow:()=>de,hashString:()=>ee,intersection:()=>T,invokeIfFunction:()=>N,isAnchorHtmlElement:()=>ce,isArray:()=>E,isBlob:()=>h,isBool:()=>l,isContentEditableHtmlElement:()=>ue,isDate:()=>f,isDecimal:()=>A,isDefined:()=>a,isEmptyArray:()=>M,isEmptyObject:()=>u,isError:()=>y,isFile:()=>be,isFiniteNumber:()=>b,isFunction:()=>C,isHtmlElementFocusable:()=>fe,isInteger:()=>S,isLocalStorageReadable:()=>pe,isMap:()=>g,isNil:()=>i,isNilOrEmptyString:()=>V,isNull:()=>n,isNumber:()=>o,isObject:()=>c,isPromise:()=>j,isRegExp:()=>d,isSet:()=>p,isString:()=>G,isSymbol:()=>w,isUndefined:()=>s,isValidDate:()=>m,noop:()=>x,not:()=>D,once:()=>R,parse2DMatrix:()=>ae,parseFileName:()=>Se,pipe:()=>_,readFilesFromDataTransfer:()=>Oe,reduceAsync:()=>U,retry:()=>L,runParallel:()=>B,runSequential:()=>X,someAsync:()=>$,splitStringIntoWords:()=>Q,timeout:()=>I,toKebabCase:()=>Z,traverseFileSystemDirectory:()=>Me,unique:()=>F});const n=e=>null===e,i=e=>null==e,a=e=>null!=e,s=e=>void 0===e,o=e=>"number"==typeof e,l=e=>"boolean"==typeof e,c=e=>"object"==typeof e,u=e=>c(e)&&!n(e)&&0===Object.keys(e).length,f=e=>e instanceof Date,h=e=>e instanceof Blob,y=e=>e instanceof Error,m=e=>f(e)&&!isNaN(e.getTime()),d=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),E=e=>Array.isArray(e),M=e=>E(e)&&0===e.length,O=e=>e.filter(Boolean),F=e=>[...new Set(e)],P=(e,t)=>(r(t>0,"Chunk size must be greater than 0"),Array.from({length:Math.ceil(e.length/t)},(r,n)=>e.slice(n*t,(n+1)*t))),T=(...e)=>{if(0===e.length)return[];if(1===e.length)return[...e[0]];const[t,...r]=e;return F(t).filter(e=>r.every(t=>t.includes(e)))},v=(e,t)=>e.filter(e=>!t.includes(e)),_=(...e)=>t=>e.reduce((e,t)=>t(e),t),k=(...e)=>t=>e.reduceRight((e,t)=>t(e),t),x=()=>{},C=e=>"function"==typeof e,D=e=>(...t)=>!e(...t),N=(e,...t)=>"function"==typeof e?e(...t):e,H=e=>new Promise(t=>setTimeout(t,e)),I=async(e,t,r="Operation timed out")=>{try{return await Promise.race([e,H(t).then(()=>Promise.reject(new Error(r)))])}finally{}},L=(e,{maxAttempts:t=3,delayMs:r=300,backoff:n=!0,onRetry:i}={})=>async(...a)=>{let s;for(let o=1;o<=t;o++)try{return await e(...a)}catch(e){if(s=e,o<t){i?.(o,e);const t=n?r*2**(o-1):r;await H(t)}}throw s},R=e=>{let t,r=!1;return function(...n){return r||(r=!0,t=e.apply(this,n)),t}},j=e=>C(e?.then),X=async(e,t)=>{const r=[];for(let n=0;n<e.length;n++)r.push(await t(e[n],n,e));return r},B=async(e,t)=>Promise.all(e.map(t)),W=async(e,t)=>{const r=[];for(let n=0;n<e.length;n++){const i=e[n];await t(i,n,e)&&r.push(i)}return r},Y=async(e,t)=>{const r=await B(e,async(e,r,n)=>!!await t(e,r,n)&&e);return O(r)},$=async(e,t)=>{for(let r=0;r<e.length;r++)if(await t(e[r],r,e))return!0;return!1},q=async(e,t)=>{for(let r=0;r<e.length;r++)if(!await t(e[r],r,e))return!1;return!0},U=async(e,t,r)=>{let n=r;for(let r=0;r<e.length;r++)n=await t(n,e[r],r,e);return n},z=async(e,t)=>{for(let r=0;r<e.length;r++)if(await t(e[r],r,e))return e[r];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),r=e.slice(1);return t.toLowerCase()+r.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 r=0;r<e.length;r++)t=33*t^e.charCodeAt(r);return(t>>>0).toString(36)},te=(e,t,r,n)=>{const i=r-e,a=n-t;return Math.hypot(i,a)},re=(e,t)=>Math.abs(e/t),ne=(e,t)=>e*t/100,ie=["INPUT","SELECT","TEXTAREA","BUTTON","A"],ae=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[r,n,i,a,s,o]=t[1].split(", ").map(parseFloat);return{translateX:s,translateY:o,scaleX:r,scaleY:a,skewX:i,skewY:n}},se=e=>new Blob([e],{type:e.type}),oe=(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),le=e=>new DOMRect(e.offsetLeft,e.offsetTop,e.clientWidth,e.clientHeight),ce=e=>"A"===e.tagName,ue=e=>"true"===e.getAttribute("contenteditable"),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 r=e.getAttribute("tabindex");return"-1"!==r&&(ie.includes(e.tagName)?!ce(e)||""!==e.href:!!ue(e)||null!==r)},he=e=>Array.from(e.querySelectorAll("*")).filter(fe),ye=e=>e.scrollWidth>e.clientWidth,me=e=>Math.max(0,e.scrollWidth-e.clientWidth),de=e=>e.scrollHeight>e.clientHeight,ge=e=>Math.max(0,e.scrollHeight-e.clientHeight),pe=()=>{if("undefined"==typeof window||!window.localStorage)return!1;try{return window.localStorage.getItem("__non_existing_key__"),!0}catch{return!1}},we=()=>{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}},be=e=>e instanceof File,Se=e=>{const t=e.lastIndexOf(".");return t<=0||t===e.length-1?[e,""]:[e.slice(0,t),e.slice(t+1).toLowerCase()]},Ae=e=>{if(!e)return[];const t=[];for(let r=0;r<e.length;r++)t.push(e[r]);return t},Ee=(e,t)=>new File([e],t,{type:e.type}),Me=async(e,{skipFiles:t=[".DS_Store","Thumbs.db","desktop.ini","ehthumbs.db",".Spotlight-V100",".Trashes",".fseventsd","__MACOSX"]}={})=>{const r=new Set(t),n=await(async e=>{const t=e.createReader(),r=async()=>new Promise((e,n)=>{t.readEntries(async t=>{if(t.length)try{const n=await r();e([...t,...n])}catch(e){n(e)}else e([])},n)});return r()})(e);return(await B(n,async e=>e.isDirectory?Me(e,{skipFiles:t}):r.has(e.name)?[]:[await new Promise((t,r)=>{e.file(t,r)})])).flat()},Oe=async(e,t={})=>{const r=e?.items;if(!r)return[];const n=[];for(let e=0;e<r.length;e++){const i=r[e];if("webkitGetAsEntry"in i){const e=i.webkitGetAsEntry?.();if(e?.isDirectory){n.push(Me(e,t));continue}if(e?.isFile){n.push(new Promise((t,r)=>e.file(e=>t([e]),r)));continue}}const a=i.getAsFile();a&&n.push(Promise.resolve([a]))}return(await Promise.all(n)).flat()},Fe=e=>Object.entries(e).reduce((e,[t,r])=>(void 0!==r&&(e[t]=r),e),{});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:()=>ie,assert:()=>n,blobToFile:()=>xe,calculateCenterOffset:()=>we,calculateEuclideanDistance:()=>te,calculateMovingSpeed:()=>ne,calculatePercentage:()=>re,camelToDashCase:()=>K,camelToWords:()=>J,centerElementInContainer:()=>be,chunk:()=>M,cloneBlob:()=>le,compact:()=>v,compose:()=>C,definedProps:()=>Te,delay:()=>H,difference:()=>T,everyAsync:()=>$,fileListToFiles:()=>ve,filterParallel:()=>B,filterSequential:()=>X,findAsync:()=>U,getDOMRectIntersectionRatio:()=>oe,getElementOffsetRect:()=>se,getFocusableHtmlElements:()=>he,getLocalStorageCapabilities:()=>Ae,getXOverflowWidth:()=>de,getYOverflowHeight:()=>pe,hasXOverflow:()=>ye,hasYOverflow:()=>ge,hashString:()=>ee,intersection:()=>F,invokeIfFunction:()=>N,isAnchorHtmlElement:()=>ce,isArray:()=>E,isBlob:()=>h,isBool:()=>s,isContentEditableHtmlElement:()=>fe,isDate:()=>u,isDecimal:()=>A,isDefined:()=>a,isEmptyArray:()=>O,isEmptyObject:()=>f,isError:()=>m,isFile:()=>Ee,isFiniteNumber:()=>b,isFunction:()=>k,isHtmlElementFocusable:()=>ue,isInteger:()=>S,isLocalStorageReadable:()=>Se,isMap:()=>g,isNil:()=>i,isNilOrEmptyString:()=>V,isNull:()=>r,isNumber:()=>o,isObject:()=>c,isPromise:()=>R,isRegExp:()=>d,isSet:()=>p,isString:()=>G,isSymbol:()=>w,isUndefined:()=>l,isValidDate:()=>y,moveFocusWithinContainer:()=>me,noop:()=>_,not:()=>D,once:()=>L,parse2DMatrix:()=>ae,parseFileName:()=>Oe,pipe:()=>P,readFilesFromDataTransfer:()=>Fe,reduceAsync:()=>q,retry:()=>z,runParallel:()=>j,runSequential:()=>W,someAsync:()=>Y,splitStringIntoWords:()=>Q,timeout:()=>I,toKebabCase:()=>Z,traverseFileSystemDirectory:()=>Me,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,f=e=>c(e)&&!r(e)&&0===Object.keys(e).length,u=e=>e instanceof Date,h=e=>e instanceof Blob,m=e=>e instanceof Error,y=e=>u(e)&&!isNaN(e.getTime()),d=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),E=e=>Array.isArray(e),O=e=>E(e)&&0===e.length,v=e=>e.filter(Boolean),x=e=>[...new Set(e)],M=(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))),F=(...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,D=e=>(...t)=>!e(...t),N=(e,...t)=>"function"==typeof e?e(...t):e,H=e=>new Promise(t=>setTimeout(t,e)),I=async(e,t,n="Operation timed out")=>{try{return await Promise.race([e,H(t).then(()=>Promise.reject(new Error(n)))])}finally{}},z=(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 H(t)}}throw l},L=e=>{let t,n=!1;return function(...r){return n||(n=!0,t=e.apply(this,r)),t}},R=e=>k(e?.then),W=async(e,t)=>{const n=[];for(let r=0;r<e.length;r++)n.push(await t(e[r],r,e));return n},j=async(e,t)=>Promise.all(e.map(t)),X=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},B=async(e,t)=>{const n=await j(e,async(e,n,r)=>!!await t(e,n,r)&&e);return v(n)},Y=async(e,t)=>{for(let n=0;n<e.length;n++)if(await t(e[n],n,e))return!0;return!1},$=async(e,t)=>{for(let n=0;n<e.length;n++)if(!await t(e[n],n,e))return!1;return!0},q=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},U=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=["INPUT","SELECT","TEXTAREA","BUTTON","A"],ae=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}},le=e=>new Blob([e],{type:e.type}),oe=(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),se=e=>new DOMRect(e.offsetLeft,e.offsetTop,e.clientWidth,e.clientHeight),ce=e=>"A"===e.tagName,fe=e=>"true"===e.getAttribute("contenteditable"),ue=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&&(ie.includes(e.tagName)?!ce(e)||""!==e.href:!!fe(e)||null!==n)},he=e=>Array.from(e.querySelectorAll("*")).filter(ue),me=(e,t=null,{wrap:n=!0,getNextIndex:r}={})=>{const i=document.activeElement,a=t??i?.parentElement;if(!i||!a)return;const l=he(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()},ye=e=>e.scrollWidth>e.clientWidth,de=e=>Math.max(0,e.scrollWidth-e.clientWidth),ge=e=>e.scrollHeight>e.clientHeight,pe=e=>Math.max(0,e.scrollHeight-e.clientHeight),we=({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))},be=(e,t,{axis:n="both"}={})=>{let r=0,i=0;"x"!==n&&"both"!==n||(r=we({overflowSize:de(e),containerSize:e.clientWidth,elementOffset:t.offsetLeft,elementSize:t.clientWidth})),"y"!==n&&"both"!==n||(i=we({overflowSize:pe(e),containerSize:e.clientHeight,elementOffset:t.offsetTop,elementSize:t.clientHeight})),e.style.transform=`translate(${r}px, ${i}px)`},Se=()=>{if("undefined"==typeof window||!window.localStorage)return!1;try{return window.localStorage.getItem("__non_existing_key__"),!0}catch{return!1}},Ae=()=>{if(!Se())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}},Ee=e=>e instanceof File,Oe=e=>{const t=e.lastIndexOf(".");return t<=0||t===e.length-1?[e,""]:[e.slice(0,t),e.slice(t+1).toLowerCase()]},ve=e=>{if(!e)return[];const t=[];for(let n=0;n<e.length;n++)t.push(e[n]);return t},xe=(e,t)=>new File([e],t,{type:e.type}),Me=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 j(r,async e=>e.isDirectory?Me(e,{skipFiles:t}):n.has(e.name)?[]:[await new Promise((t,n)=>{e.file(t,n)})])).flat()},Fe=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(Me(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()},Te=e=>Object.entries(e).reduce((e,[t,n])=>(void 0!==n&&(e[t]=n),e),{});module.exports=t})();
2
2
  //# sourceMappingURL=index.cjs.map