@react-hive/honey-utils 4.0.0 โ†’ 4.1.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
@@ -17,7 +17,7 @@ A lightweight TypeScript utility library providing a collection of helper functi
17
17
  - ๐Ÿงฎ **Math Utilities** - Common mathematical calculations
18
18
  - ๐ŸŽฏ **Function Utilities** - Function handling helpers
19
19
  - ๐Ÿ–ฅ๏ธ **DOM Utilities** - Browser DOM manipulation helpers
20
- - ๐Ÿงฌ **Encoding Utilities** - Base64 decoding and encoded JSON helpers
20
+ - ๐Ÿงฌ **Encoding Utilities** - Base64 encoding and decoding, and encoded JSON helpers
21
21
  - ๐Ÿงพ **JSON Utilities** - Safe JSON parsing
22
22
  - ๐Ÿ“ฆ **Zero Dependencies** - Lightweight and dependency-free
23
23
  - ๐Ÿ“ **TypeScript Support** - Full TypeScript type definitions
@@ -105,7 +105,12 @@ const hash = hashString('background-color: red;');
105
105
  ### Encoding Utilities
106
106
 
107
107
  ```ts
108
- import { decodeBase64, decodeBase64Json } from '@react-hive/honey-utils';
108
+ import {
109
+ decodeBase64,
110
+ decodeBase64Json,
111
+ encodeBase64,
112
+ encodeBase64Json,
113
+ } from '@react-hive/honey-utils';
109
114
 
110
115
  /**
111
116
  * Decode a base64 string
@@ -130,6 +135,24 @@ decodeBase64Json<{ name: string; age: number }>('eyJuYW1lIjoiTWlrZSIsImFnZSI6MzN
130
135
  */
131
136
  decodeBase64Json('invalid');
132
137
  // โžœ null
138
+
139
+ /**
140
+ * Encode a string as base64
141
+ */
142
+ encodeBase64('Hello world');
143
+ // โžœ 'SGVsbG8gd29ybGQ='
144
+
145
+ /**
146
+ * Unicode text is encoded from its UTF-8 bytes
147
+ */
148
+ encodeBase64('ะŸั€ะธะฒะตั‚ ะผะธั€');
149
+ // โžœ '0J/RgNC40LLQtdGCINC80LjRgA=='
150
+
151
+ /**
152
+ * Serialize a value as JSON and encode it as base64
153
+ */
154
+ encodeBase64Json({ name: 'Mike', age: 33 });
155
+ // โžœ 'eyJuYW1lIjoiTWlrZSIsImFnZSI6MzN9'
133
156
  ```
134
157
 
135
158
  ### JSON Utilities
@@ -176,6 +199,7 @@ import {
176
199
  chunk,
177
200
  intersection,
178
201
  difference,
202
+ toggleArrayItem,
179
203
  pipe,
180
204
  compose,
181
205
  } from '@react-hive/honey-utils';
@@ -226,6 +250,16 @@ intersection([1, 2, 3], [2, 3, 4]);
226
250
  difference([1, 2, 3, 4], [2, 4]);
227
251
  // โžœ [1, 3]
228
252
 
253
+ /**
254
+ * Add an item to an array or remove it
255
+ */
256
+ toggleArrayItem(['a', 'b'], 'c', true);
257
+ // โžœ ['a', 'b', 'c']
258
+ toggleArrayItem(['a', 'b'], 'b', false);
259
+ // โžœ ['a']
260
+ toggleArrayItem(['a', 'b'], 'a');
261
+ // โžœ ['b']
262
+
229
263
  /**
230
264
  * Compose functions from left to right
231
265
  */
@@ -492,7 +526,8 @@ isSet(new Set());
492
526
  import {
493
527
  calculateEuclideanDistance,
494
528
  calculateMovingSpeed,
495
- calculatePercentage
529
+ calculatePercentage,
530
+ clamp,
496
531
  } from '@react-hive/honey-utils';
497
532
 
498
533
  /**
@@ -512,12 +547,18 @@ calculateMovingSpeed(100, 5);
512
547
  */
513
548
  calculatePercentage(200, 25);
514
549
  // โžœ 50
550
+
551
+ /**
552
+ * Restrict a number to a range
553
+ */
554
+ clamp(42, 0, 10);
555
+ // โžœ 10
515
556
  ```
516
557
 
517
558
  ### DOM Utilities
518
559
 
519
560
  ```ts
520
- import { parse2DMatrix, cloneBlob } from '@react-hive/honey-utils';
561
+ import { parse2DMatrix, cloneBlob, replaceHistorySearchParams } from '@react-hive/honey-utils';
521
562
 
522
563
  /**
523
564
  * Extract transformation values from an HTML element's 2D matrix
@@ -539,6 +580,16 @@ const clonedBlob = cloneBlob(originalBlob);
539
580
 
540
581
  console.log(clonedBlob.type);
541
582
  // โžœ 'text/plain'
583
+
584
+ /**
585
+ * Replace the query string of the current URL without adding a history entry
586
+ */
587
+ const searchParams = new URLSearchParams(window.location.search);
588
+
589
+ searchParams.set('page', '2');
590
+
591
+ replaceHistorySearchParams(searchParams);
592
+ // โžœ /products?page=2#reviews
542
593
  ```
543
594
 
544
595
  ### File Utilities
@@ -628,8 +679,10 @@ function divide(a: number, b: number): number {
628
679
 
629
680
  ---
630
681
 
631
- - `decodeBase64(value: string): Nullable<string>` - Decodes a base64-encoded string into UTF-8 text. Returns `null` when decoding fails.
682
+ - `decodeBase64(value: string): Nullable<string>` - Decodes a base64-encoded string into UTF-8 text. Returns `null` when the value is not padded standard base64 or its bytes are not valid UTF-8.
632
683
  - `decodeBase64Json<Value>(value: string): Nullable<Value>` - Decodes a base64-encoded string and safely parses the decoded result as JSON. Returns `null` when base64 decoding fails or when the decoded value is not valid JSON.
684
+ - `encodeBase64(value: string): string` - Encodes a string as base64 from its UTF-8 bytes - the counterpart of `decodeBase64`.
685
+ - `encodeBase64Json<Value>(value: Value): string` - Serializes a value as JSON and encodes the result as base64 - the counterpart of `decodeBase64Json`. Throws as `JSON.stringify` does, for a circular structure or a `BigInt`.
633
686
 
634
687
  ### JSON Utilities
635
688
 
@@ -663,6 +716,7 @@ function divide(a: number, b: number): number {
663
716
  - `pipe(...fns: Function[]): Function` - Composes unary functions left-to-right. Returns a new function that applies all given functions in a sequence.
664
717
  - `compose(...fns: Function[]): Function` - Composes unary functions **right-to-left**. Same as `pipe`, but applies functions in reverse order.
665
718
  - `getAdjacentItems<T>(items: Nullable<T[]> | undefined, targetItem: Nullable<T> | undefined, isSameItem: (item: T, targetItem: T) => boolean): AdjacentItems` - Returns the previous, current, and next items for the matched item in the array. If the target is not found, all returned values are `null`.
719
+ - `toggleArrayItem<T>(array: T[], item: T, isIncluded?: boolean): T[]` - Adds an item to an array or removes it, without changing the source array. `isIncluded` says whether the item should be in the array; when omitted, the item's presence is flipped. Returns the source array itself when it already is as asked, and never adds an item already present a second time.
666
720
 
667
721
  ### Function Utilities
668
722
 
@@ -707,6 +761,7 @@ function divide(a: number, b: number): number {
707
761
  - `calculateMovingSpeed(distance: number, elapsedTime: number): number` - Calculates moving speed.
708
762
  - `calculatePercentage(value: number, percentage: number): number` - Calculates the specified percentage of a value.
709
763
  - `hashString(input: string): string` - Generates a short hash from a string.
764
+ - `clamp(value: number, min: number, max: number): number` - Restricts a number to the inclusive range between `min` and `max`. `max` wins when the bounds cross.
710
765
 
711
766
  ### ENV
712
767
 
@@ -742,6 +797,10 @@ function divide(a: number, b: number): number {
742
797
 
743
798
  - `downloadFile(file: Downloadable, options?: DownloadFileOptions): void` - Initiates a file download in a browser environment from a URL string or binary source (`Blob` / `MediaSource`). Automatically creates and revokes object URLs when required and safely no-ops in non-DOM environments (e.g. SSR).
744
799
 
800
+ #### History
801
+
802
+ - `replaceHistorySearchParams(searchParams: URLSearchParams): void` - Replaces the query string of the current URL with `history.replaceState()`, without navigating or adding a history entry. Keeps the path, the hash and the history entry's state, which routers such as React Router keep their own bookkeeping in. Empty search params remove the query string altogether.
803
+
745
804
  #### Layout
746
805
 
747
806
  - `hasXOverflow(element: HTMLElement): boolean` - Checks whether an element has horizontal overflow. Returns `true` if the content overflows beyond the visible width.
package/dist/README.md CHANGED
@@ -17,7 +17,7 @@ A lightweight TypeScript utility library providing a collection of helper functi
17
17
  - ๐Ÿงฎ **Math Utilities** - Common mathematical calculations
18
18
  - ๐ŸŽฏ **Function Utilities** - Function handling helpers
19
19
  - ๐Ÿ–ฅ๏ธ **DOM Utilities** - Browser DOM manipulation helpers
20
- - ๐Ÿงฌ **Encoding Utilities** - Base64 decoding and encoded JSON helpers
20
+ - ๐Ÿงฌ **Encoding Utilities** - Base64 encoding and decoding, and encoded JSON helpers
21
21
  - ๐Ÿงพ **JSON Utilities** - Safe JSON parsing
22
22
  - ๐Ÿ“ฆ **Zero Dependencies** - Lightweight and dependency-free
23
23
  - ๐Ÿ“ **TypeScript Support** - Full TypeScript type definitions
@@ -105,7 +105,12 @@ const hash = hashString('background-color: red;');
105
105
  ### Encoding Utilities
106
106
 
107
107
  ```ts
108
- import { decodeBase64, decodeBase64Json } from '@react-hive/honey-utils';
108
+ import {
109
+ decodeBase64,
110
+ decodeBase64Json,
111
+ encodeBase64,
112
+ encodeBase64Json,
113
+ } from '@react-hive/honey-utils';
109
114
 
110
115
  /**
111
116
  * Decode a base64 string
@@ -130,6 +135,24 @@ decodeBase64Json<{ name: string; age: number }>('eyJuYW1lIjoiTWlrZSIsImFnZSI6MzN
130
135
  */
131
136
  decodeBase64Json('invalid');
132
137
  // โžœ null
138
+
139
+ /**
140
+ * Encode a string as base64
141
+ */
142
+ encodeBase64('Hello world');
143
+ // โžœ 'SGVsbG8gd29ybGQ='
144
+
145
+ /**
146
+ * Unicode text is encoded from its UTF-8 bytes
147
+ */
148
+ encodeBase64('ะŸั€ะธะฒะตั‚ ะผะธั€');
149
+ // โžœ '0J/RgNC40LLQtdGCINC80LjRgA=='
150
+
151
+ /**
152
+ * Serialize a value as JSON and encode it as base64
153
+ */
154
+ encodeBase64Json({ name: 'Mike', age: 33 });
155
+ // โžœ 'eyJuYW1lIjoiTWlrZSIsImFnZSI6MzN9'
133
156
  ```
134
157
 
135
158
  ### JSON Utilities
@@ -176,6 +199,7 @@ import {
176
199
  chunk,
177
200
  intersection,
178
201
  difference,
202
+ toggleArrayItem,
179
203
  pipe,
180
204
  compose,
181
205
  } from '@react-hive/honey-utils';
@@ -226,6 +250,16 @@ intersection([1, 2, 3], [2, 3, 4]);
226
250
  difference([1, 2, 3, 4], [2, 4]);
227
251
  // โžœ [1, 3]
228
252
 
253
+ /**
254
+ * Add an item to an array or remove it
255
+ */
256
+ toggleArrayItem(['a', 'b'], 'c', true);
257
+ // โžœ ['a', 'b', 'c']
258
+ toggleArrayItem(['a', 'b'], 'b', false);
259
+ // โžœ ['a']
260
+ toggleArrayItem(['a', 'b'], 'a');
261
+ // โžœ ['b']
262
+
229
263
  /**
230
264
  * Compose functions from left to right
231
265
  */
@@ -492,7 +526,8 @@ isSet(new Set());
492
526
  import {
493
527
  calculateEuclideanDistance,
494
528
  calculateMovingSpeed,
495
- calculatePercentage
529
+ calculatePercentage,
530
+ clamp,
496
531
  } from '@react-hive/honey-utils';
497
532
 
498
533
  /**
@@ -512,12 +547,18 @@ calculateMovingSpeed(100, 5);
512
547
  */
513
548
  calculatePercentage(200, 25);
514
549
  // โžœ 50
550
+
551
+ /**
552
+ * Restrict a number to a range
553
+ */
554
+ clamp(42, 0, 10);
555
+ // โžœ 10
515
556
  ```
516
557
 
517
558
  ### DOM Utilities
518
559
 
519
560
  ```ts
520
- import { parse2DMatrix, cloneBlob } from '@react-hive/honey-utils';
561
+ import { parse2DMatrix, cloneBlob, replaceHistorySearchParams } from '@react-hive/honey-utils';
521
562
 
522
563
  /**
523
564
  * Extract transformation values from an HTML element's 2D matrix
@@ -539,6 +580,16 @@ const clonedBlob = cloneBlob(originalBlob);
539
580
 
540
581
  console.log(clonedBlob.type);
541
582
  // โžœ 'text/plain'
583
+
584
+ /**
585
+ * Replace the query string of the current URL without adding a history entry
586
+ */
587
+ const searchParams = new URLSearchParams(window.location.search);
588
+
589
+ searchParams.set('page', '2');
590
+
591
+ replaceHistorySearchParams(searchParams);
592
+ // โžœ /products?page=2#reviews
542
593
  ```
543
594
 
544
595
  ### File Utilities
@@ -628,8 +679,10 @@ function divide(a: number, b: number): number {
628
679
 
629
680
  ---
630
681
 
631
- - `decodeBase64(value: string): Nullable<string>` - Decodes a base64-encoded string into UTF-8 text. Returns `null` when decoding fails.
682
+ - `decodeBase64(value: string): Nullable<string>` - Decodes a base64-encoded string into UTF-8 text. Returns `null` when the value is not padded standard base64 or its bytes are not valid UTF-8.
632
683
  - `decodeBase64Json<Value>(value: string): Nullable<Value>` - Decodes a base64-encoded string and safely parses the decoded result as JSON. Returns `null` when base64 decoding fails or when the decoded value is not valid JSON.
684
+ - `encodeBase64(value: string): string` - Encodes a string as base64 from its UTF-8 bytes - the counterpart of `decodeBase64`.
685
+ - `encodeBase64Json<Value>(value: Value): string` - Serializes a value as JSON and encodes the result as base64 - the counterpart of `decodeBase64Json`. Throws as `JSON.stringify` does, for a circular structure or a `BigInt`.
633
686
 
634
687
  ### JSON Utilities
635
688
 
@@ -663,6 +716,7 @@ function divide(a: number, b: number): number {
663
716
  - `pipe(...fns: Function[]): Function` - Composes unary functions left-to-right. Returns a new function that applies all given functions in a sequence.
664
717
  - `compose(...fns: Function[]): Function` - Composes unary functions **right-to-left**. Same as `pipe`, but applies functions in reverse order.
665
718
  - `getAdjacentItems<T>(items: Nullable<T[]> | undefined, targetItem: Nullable<T> | undefined, isSameItem: (item: T, targetItem: T) => boolean): AdjacentItems` - Returns the previous, current, and next items for the matched item in the array. If the target is not found, all returned values are `null`.
719
+ - `toggleArrayItem<T>(array: T[], item: T, isIncluded?: boolean): T[]` - Adds an item to an array or removes it, without changing the source array. `isIncluded` says whether the item should be in the array; when omitted, the item's presence is flipped. Returns the source array itself when it already is as asked, and never adds an item already present a second time.
666
720
 
667
721
  ### Function Utilities
668
722
 
@@ -707,6 +761,7 @@ function divide(a: number, b: number): number {
707
761
  - `calculateMovingSpeed(distance: number, elapsedTime: number): number` - Calculates moving speed.
708
762
  - `calculatePercentage(value: number, percentage: number): number` - Calculates the specified percentage of a value.
709
763
  - `hashString(input: string): string` - Generates a short hash from a string.
764
+ - `clamp(value: number, min: number, max: number): number` - Restricts a number to the inclusive range between `min` and `max`. `max` wins when the bounds cross.
710
765
 
711
766
  ### ENV
712
767
 
@@ -742,6 +797,10 @@ function divide(a: number, b: number): number {
742
797
 
743
798
  - `downloadFile(file: Downloadable, options?: DownloadFileOptions): void` - Initiates a file download in a browser environment from a URL string or binary source (`Blob` / `MediaSource`). Automatically creates and revokes object URLs when required and safely no-ops in non-DOM environments (e.g. SSR).
744
799
 
800
+ #### History
801
+
802
+ - `replaceHistorySearchParams(searchParams: URLSearchParams): void` - Replaces the query string of the current URL with `history.replaceState()`, without navigating or adding a history entry. Keeps the path, the hash and the history entry's state, which routers such as React Router keep their own bookkeeping in. Empty search params remove the query string altogether.
803
+
745
804
  #### Layout
746
805
 
747
806
  - `hasXOverflow(element: HTMLElement): boolean` - Checks whether an element has horizontal overflow. Returns `true` if the content overflows beyond the visible width.
@@ -8,3 +8,4 @@ export * from './compact';
8
8
  export * from './is-array';
9
9
  export * from './is-empty-array';
10
10
  export * from './get-adjacent-items';
11
+ export * from './toggle-array-item';
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Adds an item to an array or removes it from the array, without changing the source array.
3
+ *
4
+ * With `isIncluded` given, the item ends up in the array or out of it as asked - what a checkbox
5
+ * in a list of them reports. Without it, the item's presence is flipped.
6
+ *
7
+ * The source array itself is returned when it already is as asked, and an item already present is
8
+ * never added a second time. Items are matched as `includes()` matches them.
9
+ *
10
+ * @template T - The type of the items in the array.
11
+ *
12
+ * @param array - The source array.
13
+ * @param item - The item to add or remove.
14
+ * @param isIncluded - Whether the item should be in the array. Flips its presence when omitted.
15
+ *
16
+ * @returns The array with the item in it or out of it.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * toggleArrayItem(['a', 'b'], 'c', true); // ['a', 'b', 'c']
21
+ * toggleArrayItem(['a', 'b'], 'b', false); // ['a']
22
+ * toggleArrayItem(['a', 'b'], 'a'); // ['b']
23
+ * toggleArrayItem(['a', 'b'], 'c'); // ['a', 'b', 'c']
24
+ * ```
25
+ */
26
+ export declare const toggleArrayItem: <T>(array: T[], item: T, isIncluded?: boolean) => T[];
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Replaces the query string of the current URL without navigating or adding a history entry.
3
+ *
4
+ * The path and the hash are kept, and so is the history entry's state, which routers such as
5
+ * React Router keep their own bookkeeping in. Empty search params remove the query string
6
+ * altogether rather than leaving a bare `?`.
7
+ *
8
+ * `history.replaceState()` fires no event, so a router listening for navigation is not told: its
9
+ * own location keeps the previous query until it next navigates.
10
+ *
11
+ * @param searchParams - The search params the URL should carry.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * // https://example.com/products?page=1#reviews
16
+ * const searchParams = new URLSearchParams(window.location.search);
17
+ *
18
+ * searchParams.set('page', '2');
19
+ *
20
+ * replaceHistorySearchParams(searchParams);
21
+ * // โžœ https://example.com/products?page=2#reviews
22
+ * ```
23
+ */
24
+ export declare const replaceHistorySearchParams: (searchParams: URLSearchParams) => void;
@@ -1,5 +1,6 @@
1
1
  export * from './data-transfer';
2
2
  export * from './dom';
3
3
  export * from './file';
4
+ export * from './history';
4
5
  export * from './layout';
5
6
  export * from './transform';
@@ -0,0 +1 @@
1
+ export declare const encodeBase64Json: <Value>(value: Value) => string;
@@ -0,0 +1 @@
1
+ export declare const encodeBase64: (value: string) => string;
@@ -1,2 +1,4 @@
1
1
  export * from './decode-base64';
2
2
  export * from './decode-base64-json';
3
+ export * from './encode-base64';
4
+ export * from './encode-base64-json';
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={};e.r(t),e.d(t,{DATA_TRANSFER_JSON_MIME:()=>re,FOCUSABLE_HTML_TAGS:()=>i,applyInertiaStep:()=>Me,assert:()=>p,blobToFile:()=>Se,calculateCenterOffset:()=>he,calculateEuclideanDistance:()=>Te,calculateMovingSpeed:()=>Fe,calculatePercentage:()=>Pe,camelToDashCase:()=>Ne,camelToWords:()=>Re,centerElementInContainer:()=>me,chunk:()=>N,clampOffsetToOverflow:()=>de,cloneBlob:()=>n,compact:()=>R,compose:()=>f,decodeBase64:()=>qe,decodeBase64Json:()=>Ve,definedProps:()=>_e,delay:()=>Q,difference:()=>h,downloadFile:()=>oe,everyAsync:()=>V,fileListToFiles:()=>we,filterParallel:()=>Z,filterSequential:()=>J,findAsync:()=>K,findCharIndices:()=>$e,flattenTree:()=>He,forEachChar:()=>Be,generateEphemeralId:()=>Ce,getAdjacentItems:()=>X,getDOMRectIntersectionRatio:()=>Oe,getDataTransferJson:()=>le,getElementOffsetRect:()=>r,getFocusableHtmlElements:()=>s,getLocalStorageCapabilities:()=>ye,getTreeChildren:()=>ze,getWordsInitials:()=>We,getXOverflowWidth:()=>ce,getYOverflowHeight:()=>fe,hasXOverflow:()=>se,hasYOverflow:()=>ue,hashString:()=>De,hexWithAlpha:()=>Je,intersection:()=>m,invokeIfFunction:()=>xe,isAnchorHtmlElement:()=>a,isArray:()=>j,isBlob:()=>M,isBool:()=>A,isContentEditableHtmlElement:()=>l,isDate:()=>I,isDecimal:()=>L,isDefined:()=>b,isEmptyArray:()=>k,isEmptyObject:()=>x,isError:()=>C,isFile:()=>be,isFiniteNumber:()=>D,isFunction:()=>B,isHtmlElementFocusable:()=>o,isInteger:()=>_,isLocalStorageReadable:()=>ge,isMap:()=>T,isNil:()=>y,isNilOrEmptyString:()=>ke,isNull:()=>g,isNumber:()=>S,isObject:()=>v,isPromise:()=>H,isRegExp:()=>E,isSet:()=>F,isString:()=>ie,isSymbol:()=>P,isUndefined:()=>w,isValidDate:()=>O,moveFocusWithinContainer:()=>c,noop:()=>$,not:()=>W,once:()=>Y,parse2DMatrix:()=>pe,parseFileName:()=>Xe,parseJson:()=>ne,pipe:()=>u,readFilesFromDataTransfer:()=>ve,reduceAsync:()=>G,resolveAxisDelta:()=>Ee,resolveBoundedDelta:()=>Ie,retry:()=>te,runParallel:()=>U,runSequential:()=>z,searchTree:()=>Ue,setDataTransferJson:()=>ae,someAsync:()=>q,splitMapJoin:()=>Ye,splitStringIntoWords:()=>je,timeout:()=>ee,toKebabCase:()=>Le,traverseFileSystemDirectory:()=>Ae,unique:()=>d});const n=e=>new Blob([e],{type:e.type}),r=e=>new DOMRect(e.offsetLeft,e.offsetTop,e.clientWidth,e.clientHeight),a=e=>"A"===e.tagName,l=e=>"true"===e.getAttribute("contenteditable"),i=["INPUT","SELECT","TEXTAREA","BUTTON","A"],o=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&&(i.includes(e.tagName)?!a(e)||""!==e.href:!!l(e)||null!==n)},s=e=>Array.from(e.querySelectorAll("*")).filter(o),c=(e,t=null,{wrap:n=!0,getNextIndex:r}={})=>{const a=document.activeElement,l=t??a?.parentElement;if(!a||!l)return;const i=s(l);if(0===i.length)return;const o=i.indexOf(a);if(-1===o)return;let c;r?c=r(o,e,i):"next"===e?(c=o+1,c>=i.length&&(c=n?0:null)):(c=o-1,c<0&&(c=n?i.length-1:null)),null!==c&&i[c]?.focus()},u=(...e)=>t=>e.reduce((e,t)=>t(e),t),f=(...e)=>t=>e.reduceRight((e,t)=>t(e),t),h=(e,t)=>e.filter(e=>!t.includes(e)),d=e=>[...new Set(e)],m=(...e)=>{if(0===e.length)return[];if(1===e.length)return[...e[0]];const[t,...n]=e;return d(t).filter(e=>n.every(t=>t.includes(e)))};function p(e,t){if(!e)throw new Error(t)}const g=e=>null===e,y=e=>null==e,b=e=>null!=e,w=e=>void 0===e,S=e=>"number"==typeof e,A=e=>"boolean"==typeof e,v=e=>"object"==typeof e,x=e=>v(e)&&!g(e)&&0===Object.keys(e).length,I=e=>e instanceof Date,M=e=>e instanceof Blob,C=e=>e instanceof Error,O=e=>I(e)&&!isNaN(e.getTime()),E=e=>e instanceof RegExp,T=e=>e instanceof Map,F=e=>e instanceof Set,P=e=>"symbol"==typeof e,D=e=>S(e)&&isFinite(e),_=e=>S(e)&&Number.isInteger(e),L=e=>D(e)&&!Number.isInteger(e),N=(e,t)=>(p(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))),R=e=>e.filter(Boolean),j=e=>Array.isArray(e),k=e=>j(e)&&0===e.length,X=(e,t,n)=>{if(!e?.length||!t)return{previousItem:null,currentItem:null,nextItem:null};const r=e.findIndex(e=>n(e,t));return-1===r?{previousItem:null,currentItem:null,nextItem:null}:{previousItem:r>0?e[r-1]:null,currentItem:e[r],nextItem:r<e.length-1?e[r+1]:null}},$=()=>{},B=e=>"function"==typeof e,W=e=>(...t)=>!e(...t),Y=e=>{let t,n=!1;return function(...r){return n||(n=!0,t=e.apply(this,r)),t}},H=e=>B(e?.then),z=async(e,t)=>{const n=[];for(let r=0;r<e.length;r++)n.push(await t(e[r],r,e));return n},U=async(e,t)=>Promise.all(e.map(t)),J=async(e,t)=>{const n=[];for(let r=0;r<e.length;r++){const a=e[r];await t(a,r,e)&&n.push(a)}return n},Z=async(e,t)=>{const n=await U(e,async(e,n,r)=>!!await t(e,n,r)&&e);return R(n)},q=async(e,t)=>{for(let n=0;n<e.length;n++)if(await t(e[n],n,e))return!0;return!1},V=async(e,t)=>{for(let n=0;n<e.length;n++)if(!await t(e[n],n,e))return!1;return!0},G=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},K=async(e,t)=>{for(let n=0;n<e.length;n++)if(await t(e[n],n,e))return e[n];return null},Q=e=>new Promise(t=>setTimeout(t,e)),ee=async(e,t,n="Operation timed out")=>{try{return await Promise.race([e,Q(t).then(()=>Promise.reject(new Error(n)))])}finally{}},te=(e,{maxAttempts:t=3,delayMs:n=300,backoff:r=!0,onRetry:a}={})=>async(...l)=>{let i;for(let o=1;o<=t;o++)try{return await e(...l)}catch(e){if(i=e,o<t){a?.(o,e);const t=r?n*2**(o-1):n;await Q(t)}}throw i},ne=e=>{try{return JSON.parse(e)}catch{return null}},re="application/json",ae=(e,t)=>{e.setData(re,JSON.stringify(t))},le=e=>{const t=e.getData(re);return t?ne(t):null},ie=e=>"string"==typeof e,oe=(e,{fileName:t,target:n}={})=>{if(w(document))return;const r=document.createElement("a");let a=null;try{const l=ie(e)?e:a=URL.createObjectURL(e);r.href=l,t&&(r.download=t),n&&(r.target=n),document.body.appendChild(r),r.click()}finally{r.remove(),a&&setTimeout(()=>{p(a,"Object URL should not be null"),URL.revokeObjectURL(a)},0)}},se=e=>e.scrollWidth>e.clientWidth,ce=e=>Math.max(0,e.scrollWidth-e.clientWidth),ue=e=>e.scrollHeight>e.clientHeight,fe=e=>Math.max(0,e.scrollHeight-e.clientHeight),he=({containerSize:e,elementOffset:t,elementSize:n})=>-(t+n/2-e/2),de=(e,t)=>t<=0?0:Math.max(-t,Math.min(e,0)),me=(e,t,{axis:n="both",shouldClamp:r=!0}={})=>{let a=0,l=0;if("x"===n||"both"===n){const n=he({containerSize:e.clientWidth,elementOffset:t.offsetLeft,elementSize:t.clientWidth});a=r?de(n,ce(e)):n}if("y"===n||"both"===n){const n=he({containerSize:e.clientHeight,elementOffset:t.offsetTop,elementSize:t.clientHeight});l=r?de(n,fe(e)):n}e.style.transform=`translate(${a}px, ${l}px)`},pe=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,a,l,i,o]=t[1].split(", ").map(parseFloat);return{translateX:i,translateY:o,scaleX:n,scaleY:l,skewX:a,skewY:r}},ge=()=>{if("undefined"==typeof window||!window.localStorage)return!1;try{return window.localStorage.getItem("__non_existing_key__"),!0}catch{return!1}},ye=()=>{if(!ge())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,we=e=>{if(!e)return[];const t=[];for(let n=0;n<e.length;n++)t.push(e[n]);return t},Se=(e,t)=>new File([e],t,{type:e.type}),Ae=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 U(r,async e=>e.isDirectory?Ae(e,{skipFiles:t}):n.has(e.name)?[]:[await new Promise((t,n)=>{e.file(t,n)})])).flat()},ve=async(e,t={})=>{const n=e?.items;if(!n)return[];const r=[];for(let e=0;e<n.length;e++){const a=n[e];if("webkitGetAsEntry"in a){const e=a.webkitGetAsEntry?.();if(e?.isDirectory){r.push(Ae(e,t));continue}if(e?.isFile){r.push(new Promise((t,n)=>e.file(e=>t([e]),n)));continue}}const l=a.getAsFile();l&&r.push(Promise.resolve([l]))}return(await Promise.all(r)).flat()},xe=(e,...t)=>"function"==typeof e?e(...t):e,Ie=({delta:e,value:t,min:n,max:r})=>{if(0===e)return null;const a=t+e;return e<0?t<=n?null:Math.max(a,n):e>0?t>=r?null:Math.min(a,r):null},Me=({value:e,min:t,max:n,velocityPxMs:r,deltaTimeMs:a,friction:l=.002,minVelocityPxMs:i=.01,emaAlpha:o=.2})=>{if(Math.abs(r)<i)return null;const s=Ie({delta:r*a,value:e,min:t,max:n});if(null===s)return null;const c=r*Math.exp(-l*a),u=o>0?r*(1-o)+c*o:c;return Math.abs(u)<i?null:{value:s,velocityPxMs:u}},Ce=()=>`${Math.floor(1e3*performance.now()).toString(36)}${Math.random().toString(36).slice(2,10)}`,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),Ee=(e,t,{allowFallback:n=!0,invert:r=!0}={})=>{const a=r?-1:1;switch(t){case"x":return{deltaX:a*(0!==e.deltaX?e.deltaX:n?e.deltaY:0),deltaY:0};case"y":return{deltaX:0,deltaY:a*e.deltaY};default:return{deltaX:a*e.deltaX,deltaY:a*e.deltaY}}},Te=(e,t,n,r)=>{const a=n-e,l=r-t;return Math.hypot(a,l)},Fe=(e,t)=>Math.abs(e/t),Pe=(e,t)=>e*t/100,De=e=>{let t=5381;for(let n=0;n<e.length;n++)t=33*t^e.charCodeAt(n);return(t>>>0).toString(36)},_e=e=>Object.entries(e).reduce((e,[t,n])=>(void 0!==n&&(e[t]=n),e),{}),Le=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ne=e=>{const t=e.charAt(0),n=e.slice(1);return t.toLowerCase()+n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)},Re=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1 $2"),je=e=>0===e.length?[]:e.split(" ").filter(Boolean),ke=e=>""===e||y(e),Xe=e=>{const t=e.lastIndexOf(".");return t<=0||t===e.length-1?[e,""]:[e.slice(0,t),e.slice(t+1).toLowerCase()]},$e=(e,t)=>{if(0===e.length)return[];const n=t.charCodeAt(0),r=[];for(let t=0;t<e.length;t++)e.charCodeAt(t)===n&&r.push(t);return r},Be=(e,t,n)=>{if(0===e.length)return;const r=e.length;for(let a=0;a<r;a++){const l=e[a],i={charIndex:a,prevChar:a>0?e[a-1]:null,nextChar:a<r-1?e[a+1]:null};n?.(l,i)||t(l,i)}},We=(e,t=1/0)=>0===e.length?"":je(e).slice(0,t).map(e=>e[0]).join("").toUpperCase(),Ye=(e,t,n,r=t)=>e.split(t).map((e,t)=>n(e.trim(),t)).join(r),He=(e,t,n,r=[],a=void 0,l=0)=>(e?.forEach(e=>{const{[n]:i,...o}=e,s=e[n],c=Array.isArray(s);if(r.push({...o,parentId:a,depthLevel:l,childCount:c?s.length:0}),c){const a=e[t];He(s,t,n,r,a,l+1)}}),r),ze=(e,t,n)=>e.filter(e=>e.parentId===t&&(!n||n(e))),Ue=(e,t,n,r)=>{const a=je(r.toLowerCase());if(!a.length)return e;const l=e.reduce((e,n,r)=>(e[n[t]]=r,e),{});return e.reduce((r,i)=>{const o=i[n];if(!o)return r;if(r.some(e=>e[t]===i[t]))return r;const s=je(o.toLowerCase());if(a.every(e=>s.some(t=>t.startsWith(e))))if(w(i.parentId)){r.push(i);const n=a=>{a.childCount&&e.forEach(e=>{e.parentId===a[t]&&(r.push(e),n(e))})};n(i)}else{const t=n=>{const a=l[n.parentId],i=e[a];w(i.parentId)||t(i);const o=r.length?r[r.length-1].parentId:null;(g(o)||o!==n.parentId)&&(p(i,"[@react-hive/honey-utils]: Parent node was not found."),r.push(i))};t(i),r.push(i)}return r},[])},Je=(e,t)=>{p(t>=0&&t<=1,`[@react-hive/honey-utils]: Alpha "${t}" must be a number between 0 and 1.`);const n=e.match(/^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/);p(n,`[@react-hive/honey-utils]: Invalid hex format: ${e}`);const r=n[1];return`#${(3===r.length?r[0]+r[0]+r[1]+r[1]+r[2]+r[2]:r)+Math.round(255*t).toString(16).toUpperCase().padStart(2,"0")}`},Ze=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,qe=e=>{try{return Ze.test(e)?"undefined"!=typeof Buffer?Buffer.from(e,"base64").toString("utf-8"):decodeURIComponent(atob(e).split("").map(e=>`%${e.charCodeAt(0).toString(16).padStart(2,"0")}`).join("")):null}catch{return null}},Ve=e=>{const t=qe(e);return null===t?null:ne(t)};module.exports=t})();
1
+ (()=>{"use strict";const 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=>{Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}};let t={};e.r(t),e.d(t,{DATA_TRANSFER_JSON_MIME:()=>ae,FOCUSABLE_HTML_TAGS:()=>i,applyInertiaStep:()=>Ce,assert:()=>p,blobToFile:()=>xe,calculateCenterOffset:()=>me,calculateEuclideanDistance:()=>Pe,calculateMovingSpeed:()=>Be,calculatePercentage:()=>De,camelToDashCase:()=>ke,camelToWords:()=>Re,centerElementInContainer:()=>ge,chunk:()=>N,clamp:()=>Ne,clampOffsetToOverflow:()=>pe,cloneBlob:()=>n,compact:()=>_,compose:()=>f,decodeBase64:()=>Ke,decodeBase64Json:()=>Qe,definedProps:()=>_e,delay:()=>ee,difference:()=>h,downloadFile:()=>se,encodeBase64:()=>et,encodeBase64Json:()=>tt,everyAsync:()=>G,fileListToFiles:()=>Ae,filterParallel:()=>q,filterSequential:()=>Z,findAsync:()=>Q,findCharIndices:()=>Ue,flattenTree:()=>Je,forEachChar:()=>We,generateEphemeralId:()=>Ee,getAdjacentItems:()=>R,getDOMRectIntersectionRatio:()=>Te,getDataTransferJson:()=>ie,getElementOffsetRect:()=>r,getFocusableHtmlElements:()=>s,getLocalStorageCapabilities:()=>be,getTreeChildren:()=>Ze,getWordsInitials:()=>Ye,getXOverflowWidth:()=>fe,getYOverflowHeight:()=>de,hasXOverflow:()=>ue,hasYOverflow:()=>he,hashString:()=>Le,hexWithAlpha:()=>Ve,intersection:()=>m,invokeIfFunction:()=>Ie,isAnchorHtmlElement:()=>a,isArray:()=>$,isBlob:()=>I,isBool:()=>A,isContentEditableHtmlElement:()=>l,isDate:()=>M,isDecimal:()=>L,isDefined:()=>w,isEmptyArray:()=>k,isEmptyObject:()=>v,isError:()=>O,isFile:()=>Se,isFiniteNumber:()=>B,isFunction:()=>H,isHtmlElementFocusable:()=>o,isInteger:()=>D,isLocalStorageReadable:()=>we,isMap:()=>T,isNil:()=>y,isNilOrEmptyString:()=>Xe,isNull:()=>g,isNumber:()=>S,isObject:()=>x,isPromise:()=>Y,isRegExp:()=>E,isSet:()=>F,isString:()=>oe,isSymbol:()=>P,isUndefined:()=>b,isValidDate:()=>C,moveFocusWithinContainer:()=>c,noop:()=>X,not:()=>U,once:()=>W,parse2DMatrix:()=>ye,parseFileName:()=>He,parseJson:()=>re,pipe:()=>u,readFilesFromDataTransfer:()=>Me,reduceAsync:()=>K,replaceHistorySearchParams:()=>ce,resolveAxisDelta:()=>Fe,resolveBoundedDelta:()=>Oe,retry:()=>ne,runParallel:()=>J,runSequential:()=>z,searchTree:()=>qe,setDataTransferJson:()=>le,someAsync:()=>V,splitMapJoin:()=>ze,splitStringIntoWords:()=>je,timeout:()=>te,toKebabCase:()=>$e,toggleArrayItem:()=>j,traverseFileSystemDirectory:()=>ve,unique:()=>d});const n=e=>new Blob([e],{type:e.type}),r=e=>new DOMRect(e.offsetLeft,e.offsetTop,e.clientWidth,e.clientHeight),a=e=>"A"===e.tagName,l=e=>"true"===e.getAttribute("contenteditable"),i=["INPUT","SELECT","TEXTAREA","BUTTON","A"],o=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&&(i.includes(e.tagName)?!a(e)||""!==e.href:!!l(e)||null!==n)},s=e=>Array.from(e.querySelectorAll("*")).filter(o),c=(e,t=null,{wrap:n=!0,getNextIndex:r}={})=>{const a=document.activeElement,l=t??a?.parentElement;if(!a||!l)return;const i=s(l);if(0===i.length)return;const o=i.indexOf(a);if(-1===o)return;let c;r?c=r(o,e,i):"next"===e?(c=o+1,c>=i.length&&(c=n?0:null)):(c=o-1,c<0&&(c=n?i.length-1:null)),null!==c&&i[c]?.focus()},u=(...e)=>t=>e.reduce((e,t)=>t(e),t),f=(...e)=>t=>e.reduceRight((e,t)=>t(e),t),h=(e,t)=>e.filter(e=>!t.includes(e)),d=e=>[...new Set(e)],m=(...e)=>{if(0===e.length)return[];if(1===e.length)return[...e[0]];const[t,...n]=e;return d(t).filter(e=>n.every(t=>t.includes(e)))};function p(e,t){if(!e)throw new Error(t)}const g=e=>null===e,y=e=>null==e,w=e=>null!=e,b=e=>void 0===e,S=e=>"number"==typeof e,A=e=>"boolean"==typeof e,x=e=>"object"==typeof e,v=e=>x(e)&&!g(e)&&0===Object.keys(e).length,M=e=>e instanceof Date,I=e=>e instanceof Blob,O=e=>e instanceof Error,C=e=>M(e)&&!isNaN(e.getTime()),E=e=>e instanceof RegExp,T=e=>e instanceof Map,F=e=>e instanceof Set,P=e=>"symbol"==typeof e,B=e=>S(e)&&isFinite(e),D=e=>S(e)&&Number.isInteger(e),L=e=>B(e)&&!Number.isInteger(e),N=(e,t)=>(p(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))),_=e=>e.filter(Boolean),$=e=>Array.isArray(e),k=e=>$(e)&&0===e.length,R=(e,t,n)=>{if(!e?.length||!t)return{previousItem:null,currentItem:null,nextItem:null};const r=e.findIndex(e=>n(e,t));return-1===r?{previousItem:null,currentItem:null,nextItem:null}:{previousItem:r>0?e[r-1]:null,currentItem:e[r],nextItem:r<e.length-1?e[r+1]:null}},j=(e,t,n)=>{const r=e.includes(t);return r===(n??!r)?e:r?h(e,[t]):[...e,t]},X=()=>{},H=e=>"function"==typeof e,U=e=>(...t)=>!e(...t),W=e=>{let t,n=!1;return function(...r){return n||(n=!0,t=e.apply(this,r)),t}},Y=e=>H(e?.then),z=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)),Z=async(e,t)=>{const n=[];for(let r=0;r<e.length;r++){const a=e[r];await t(a,r,e)&&n.push(a)}return n},q=async(e,t)=>{const n=await J(e,async(e,n,r)=>!!await t(e,n,r)&&e);return _(n)},V=async(e,t)=>{for(let n=0;n<e.length;n++)if(await t(e[n],n,e))return!0;return!1},G=async(e,t)=>{for(let n=0;n<e.length;n++)if(!await t(e[n],n,e))return!1;return!0},K=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},ee=e=>new Promise(t=>setTimeout(t,e)),te=async(e,t,n="Operation timed out")=>{try{return await Promise.race([e,ee(t).then(()=>Promise.reject(new Error(n)))])}finally{}},ne=(e,{maxAttempts:t=3,delayMs:n=300,backoff:r=!0,onRetry:a}={})=>async(...l)=>{let i;for(let o=1;o<=t;o++)try{return await e(...l)}catch(e){if(i=e,o<t){a?.(o,e);const t=r?n*2**(o-1):n;await ee(t)}}throw i},re=e=>{try{return JSON.parse(e)}catch{return null}},ae="application/json",le=(e,t)=>{e.setData(ae,JSON.stringify(t))},ie=e=>{const t=e.getData(ae);return t?re(t):null},oe=e=>"string"==typeof e,se=(e,{fileName:t,target:n}={})=>{if(b(document))return;const r=document.createElement("a");let a=null;try{const l=oe(e)?e:a=URL.createObjectURL(e);r.href=l,t&&(r.download=t),n&&(r.target=n),document.body.appendChild(r),r.click()}finally{r.remove(),a&&setTimeout(()=>{p(a,"Object URL should not be null"),URL.revokeObjectURL(a)},0)}},ce=e=>{const t=e.toString();window.history.replaceState(window.history.state,"",`${window.location.pathname}${t?`?${t}`:""}${window.location.hash}`)},ue=e=>e.scrollWidth>e.clientWidth,fe=e=>Math.max(0,e.scrollWidth-e.clientWidth),he=e=>e.scrollHeight>e.clientHeight,de=e=>Math.max(0,e.scrollHeight-e.clientHeight),me=({containerSize:e,elementOffset:t,elementSize:n})=>-(t+n/2-e/2),pe=(e,t)=>t<=0?0:Math.max(-t,Math.min(e,0)),ge=(e,t,{axis:n="both",shouldClamp:r=!0}={})=>{let a=0,l=0;if("x"===n||"both"===n){const n=me({containerSize:e.clientWidth,elementOffset:t.offsetLeft,elementSize:t.clientWidth});a=r?pe(n,fe(e)):n}if("y"===n||"both"===n){const n=me({containerSize:e.clientHeight,elementOffset:t.offsetTop,elementSize:t.clientHeight});l=r?pe(n,de(e)):n}e.style.transform=`translate(${a}px, ${l}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,a,l,i,o]=t[1].split(", ").map(parseFloat);return{translateX:i,translateY:o,scaleX:n,scaleY:l,skewX:a,skewY:r}},we=()=>{if("undefined"==typeof window||!window.localStorage)return!1;try{return window.localStorage.getItem("__non_existing_key__"),!0}catch{return!1}},be=()=>{if(!we())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}},Se=e=>e instanceof File,Ae=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}),ve=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?ve(e,{skipFiles:t}):n.has(e.name)?[]:[await new Promise((t,n)=>{e.file(t,n)})])).flat()},Me=async(e,t={})=>{const n=e?.items;if(!n)return[];const r=[];for(let e=0;e<n.length;e++){const a=n[e];if("webkitGetAsEntry"in a){const e=a.webkitGetAsEntry?.();if(e?.isDirectory){r.push(ve(e,t));continue}if(e?.isFile){r.push(new Promise((t,n)=>e.file(e=>t([e]),n)));continue}}const l=a.getAsFile();l&&r.push(Promise.resolve([l]))}return(await Promise.all(r)).flat()},Ie=(e,...t)=>"function"==typeof e?e(...t):e,Oe=({delta:e,value:t,min:n,max:r})=>{if(0===e)return null;const a=t+e;return e<0?t<=n?null:Math.max(a,n):e>0?t>=r?null:Math.min(a,r):null},Ce=({value:e,min:t,max:n,velocityPxMs:r,deltaTimeMs:a,friction:l=.002,minVelocityPxMs:i=.01,emaAlpha:o=.2})=>{if(Math.abs(r)<i)return null;const s=Oe({delta:r*a,value:e,min:t,max:n});if(null===s)return null;const c=r*Math.exp(-l*a),u=o>0?r*(1-o)+c*o:c;return Math.abs(u)<i?null:{value:s,velocityPxMs:u}},Ee=()=>`${Math.floor(1e3*performance.now()).toString(36)}${Math.random().toString(36).slice(2,10)}`,Te=(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),Fe=(e,t,{allowFallback:n=!0,invert:r=!0}={})=>{const a=r?-1:1;switch(t){case"x":return{deltaX:a*(0!==e.deltaX?e.deltaX:n?e.deltaY:0),deltaY:0};case"y":return{deltaX:0,deltaY:a*e.deltaY};default:return{deltaX:a*e.deltaX,deltaY:a*e.deltaY}}},Pe=(e,t,n,r)=>{const a=n-e,l=r-t;return Math.hypot(a,l)},Be=(e,t)=>Math.abs(e/t),De=(e,t)=>e*t/100,Le=e=>{let t=5381;for(let n=0;n<e.length;n++)t=33*t^e.charCodeAt(n);return(t>>>0).toString(36)},Ne=(e,t,n)=>Math.min(Math.max(e,t),n),_e=e=>Object.entries(e).reduce((e,[t,n])=>(void 0!==n&&(e[t]=n),e),{}),$e=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ke=e=>{const t=e.charAt(0),n=e.slice(1);return t.toLowerCase()+n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)},Re=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1 $2"),je=e=>0===e.length?[]:e.split(" ").filter(Boolean),Xe=e=>""===e||y(e),He=e=>{const t=e.lastIndexOf(".");return t<=0||t===e.length-1?[e,""]:[e.slice(0,t),e.slice(t+1).toLowerCase()]},Ue=(e,t)=>{if(0===e.length)return[];const n=t.charCodeAt(0),r=[];for(let t=0;t<e.length;t++)e.charCodeAt(t)===n&&r.push(t);return r},We=(e,t,n)=>{if(0===e.length)return;const r=e.length;for(let a=0;a<r;a++){const l=e[a],i={charIndex:a,prevChar:a>0?e[a-1]:null,nextChar:a<r-1?e[a+1]:null};n?.(l,i)||t(l,i)}},Ye=(e,t=1/0)=>0===e.length?"":je(e).slice(0,t).map(e=>e[0]).join("").toUpperCase(),ze=(e,t,n,r=t)=>e.split(t).map((e,t)=>n(e.trim(),t)).join(r),Je=(e,t,n,r=[],a=void 0,l=0)=>(e?.forEach(e=>{const{[n]:i,...o}=e,s=e[n],c=Array.isArray(s);if(r.push({...o,parentId:a,depthLevel:l,childCount:c?s.length:0}),c){const a=e[t];Je(s,t,n,r,a,l+1)}}),r),Ze=(e,t,n)=>e.filter(e=>e.parentId===t&&(!n||n(e))),qe=(e,t,n,r)=>{const a=je(r.toLowerCase());if(!a.length)return e;const l=e.reduce((e,n,r)=>(e[n[t]]=r,e),{});return e.reduce((r,i)=>{const o=i[n];if(!o)return r;if(r.some(e=>e[t]===i[t]))return r;const s=je(o.toLowerCase());if(a.every(e=>s.some(t=>t.startsWith(e))))if(b(i.parentId)){r.push(i);const n=a=>{a.childCount&&e.forEach(e=>{e.parentId===a[t]&&(r.push(e),n(e))})};n(i)}else{const t=n=>{const a=l[n.parentId],i=e[a];b(i.parentId)||t(i);const o=r.length?r[r.length-1].parentId:null;(g(o)||o!==n.parentId)&&(p(i,"[@react-hive/honey-utils]: Parent node was not found."),r.push(i))};t(i),r.push(i)}return r},[])},Ve=(e,t)=>{p(t>=0&&t<=1,`[@react-hive/honey-utils]: Alpha "${t}" must be a number between 0 and 1.`);const n=e.match(/^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/);p(n,`[@react-hive/honey-utils]: Invalid hex format: ${e}`);const r=n[1];return`#${(3===r.length?r[0]+r[0]+r[1]+r[1]+r[2]+r[2]:r)+Math.round(255*t).toString(16).toUpperCase().padStart(2,"0")}`},Ge=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,Ke=e=>{if(!Ge.test(e))return null;try{return new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0}).decode((e=>{if("function"==typeof Uint8Array.fromBase64)return Uint8Array.fromBase64(e);if("undefined"!=typeof Buffer)return Buffer.from(e,"base64");const t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n})(e))}catch{return null}},Qe=e=>{const t=Ke(e);return null===t?null:re(t)},et=e=>(e=>{if("function"==typeof e.toBase64)return e.toBase64();if("undefined"!=typeof Buffer)return Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("base64");let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)})((new TextEncoder).encode(e)),tt=e=>et(JSON.stringify(e));module.exports=t})();
2
2
  //# sourceMappingURL=index.cjs.map