@bgskinner2/ts-utils 1.0.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/LICENSE +2 -0
- package/README.md +272 -0
- package/dist/index.cjs +3 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2546 -0
- package/dist/index.d.ts +2546 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/package.json +67 -0
package/LICENSE
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
# TypeScript Utility Library
|
|
2
|
+
|
|
3
|
+
A **type-safe, custom-built utility library** for TypeScript projects, designed to make everyday development easier and safer.
|
|
4
|
+
|
|
5
|
+
This library contains a growing collection of **helpers, validators, type guards, transformers, processors, and debug utilities**, all written with TypeScript type safety in mind.
|
|
6
|
+
|
|
7
|
+
It’s **actively maintained and continuously expanded**, so new utilities and improvements are regularly added as I encounter common patterns and challenges in projects. Think of it as a personal toolkit for TypeScript development that **evolves with real-world needs**.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Table of Contents
|
|
12
|
+
|
|
13
|
+
- [Installation](#installation)
|
|
14
|
+
- [Project Structure](#project-structure)
|
|
15
|
+
- [Tree-Shaking & Modular Imports](#tree-shaking--modular-imports)
|
|
16
|
+
- [Type Guards](#type-guards)
|
|
17
|
+
- [Core Guards](#core-guards)
|
|
18
|
+
- [React Guards](#react-guards)
|
|
19
|
+
- [Validation Guards](#validation-guards)
|
|
20
|
+
- [Common Utilities](#common-utilities)
|
|
21
|
+
- [Computation Utilities](#computation-utilities)
|
|
22
|
+
- [Debug Utilities](#debug-utilities)
|
|
23
|
+
- [DOM Utilities](#dom-utilities)
|
|
24
|
+
- [Color Utilities](#color-utilities)
|
|
25
|
+
- [Processor Utilities](#processor-utilities)
|
|
26
|
+
- [Transformer Utilities](#transformer-utilities)
|
|
27
|
+
- [Usage](#usage)
|
|
28
|
+
- [Contributing](#contributing)
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install your-ts-utils
|
|
36
|
+
# or
|
|
37
|
+
yarn add your-ts-utils
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Project Structure
|
|
44
|
+
|
|
45
|
+
```text
|
|
46
|
+
|
|
47
|
+
src/
|
|
48
|
+
├── lib/
|
|
49
|
+
│ ├── common/
|
|
50
|
+
│ │ ├── arrays.ts
|
|
51
|
+
│ │ ├── objects.ts
|
|
52
|
+
│ │ └── index.ts
|
|
53
|
+
│ ├── validations/
|
|
54
|
+
│ │ ├── assertions.ts
|
|
55
|
+
│ │ └── index.ts
|
|
56
|
+
│ ├── guards/
|
|
57
|
+
│ │ ├── core
|
|
58
|
+
│ │ | ├── primitives.ts
|
|
59
|
+
│ │ | ├── link-guards.ts
|
|
60
|
+
│ │ | ├── composite.ts
|
|
61
|
+
│ │ | ├── reference.ts
|
|
62
|
+
│ │ | ├── refined.ts
|
|
63
|
+
│ │ | ├── string-guards.ts
|
|
64
|
+
│ │ | └── index.ts
|
|
65
|
+
│ │ ├── react
|
|
66
|
+
│ │ | ├── dom-guards.ts
|
|
67
|
+
│ │ | ├── node-guards.ts
|
|
68
|
+
│ │ | ├── react-primitive.ts
|
|
69
|
+
│ │ | └── index.ts
|
|
70
|
+
│ ├── color/
|
|
71
|
+
│ │ ├── color.ts
|
|
72
|
+
│ │ └── index.ts
|
|
73
|
+
│ ├── dom/
|
|
74
|
+
│ │ ├── events.ts
|
|
75
|
+
│ │ ├── media.ts
|
|
76
|
+
│ │ └── index.ts
|
|
77
|
+
│ ├── link/
|
|
78
|
+
│ │ ├── link-utils.ts
|
|
79
|
+
│ │ └── index.ts
|
|
80
|
+
│ ├── processors/
|
|
81
|
+
│ │ ├── network.ts
|
|
82
|
+
│ │ ├── react.ts
|
|
83
|
+
│ │ └── index.ts
|
|
84
|
+
│ ├── transformers/
|
|
85
|
+
│ │ ├── object-transformers.ts
|
|
86
|
+
│ │ ├── string-transformers.ts
|
|
87
|
+
│ │ └── index.ts
|
|
88
|
+
│ ├── computation/
|
|
89
|
+
│ │ └── index.ts
|
|
90
|
+
│ ├── debug/
|
|
91
|
+
│ │ ├── debug.ts
|
|
92
|
+
│ │ └── index.ts
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Tree-Shaking & Modular Imports
|
|
99
|
+
|
|
100
|
+
This library is designed with **tree-shaking in mind**, allowing you to import only the utilities you need, keeping your bundle size minimal.
|
|
101
|
+
|
|
102
|
+
### How It Works
|
|
103
|
+
|
|
104
|
+
- All utility classes (e.g., `ArrayUtils`, `ObjectUtils`) are **pure static classes**.
|
|
105
|
+
- Each class is accompanied by **renamed, individual function exports** for **direct, tree-shakable imports**.
|
|
106
|
+
- Standalone utilities, like **type guards** (`isArrayOf`, `isKeyOfObject`, etc.), are also **tree-shakable**.
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
// Import only what you need (tree-shakable)
|
|
110
|
+
import { arrayMap, arrayFilter, objectGet } from '@/utils';
|
|
111
|
+
|
|
112
|
+
const doubled = arrayMap([1, 2, 3], (n) => n * 2);
|
|
113
|
+
const filtered = arrayFilter(doubled, (n) => n > 2);
|
|
114
|
+
|
|
115
|
+
const value = objectGet({ user: { name: 'Alice' } }, 'user.name');
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Type Guards
|
|
121
|
+
|
|
122
|
+
Type guards are the backbone of this library. They allow you to safely narrow types across different environments.
|
|
123
|
+
|
|
124
|
+
### 🔹 Core Guards
|
|
125
|
+
|
|
126
|
+
The "Pure JS" foundation. These have zero dependencies and work in any environment (Node, Deno, Bun, Browser).
|
|
127
|
+
|
|
128
|
+
- Primitives: High-speed checks for strings, numbers, bigints, and symbols.
|
|
129
|
+
- Composite: Complex validation for objects, arrays, and record shapes.
|
|
130
|
+
- String Formats: Validation for JSON, Hex, HTML, and case-conventions (Camel, Snake, Kebab).
|
|
131
|
+
- Network: Safe URL detection and same-origin validation.
|
|
132
|
+
|
|
133
|
+
[Full Reference →](docs/type-guards.md)
|
|
134
|
+
|
|
135
|
+
### ⚛️ React Guards
|
|
136
|
+
|
|
137
|
+
Specific utilities for the React ecosystem. These handle the complexities of the Virtual DOM and component lifecycle.
|
|
138
|
+
|
|
139
|
+
- Nodes: Validate renderable content, JSX elements, and Fragments.
|
|
140
|
+
- Primitives: Safe checks for useRef objects, Portals, and forwardRef components.
|
|
141
|
+
- DOM: Validation for prop keys and interactive elements (e.g., hasOnClick).
|
|
142
|
+
|
|
143
|
+
[Full Reference →](docs/type-guards.md)
|
|
144
|
+
|
|
145
|
+
### 🔹 Validation Guards
|
|
146
|
+
|
|
147
|
+
**Purpose:**
|
|
148
|
+
Runtime validators built on top of type guards. Use them to assert that values conform to expected types, with optional error messages. Includes **primitive, reference, and composite assertions**, as well as **custom assertion creators**.
|
|
149
|
+
|
|
150
|
+
- **Creators:** `assertValue`, `makeAssert`
|
|
151
|
+
- **Primitive Assertions:** `assertIsNumber`, `assertIsInteger`, `assertIsString`, `assertIsBoolean`, `assertIsBigInt`, `assertIsSymbol`
|
|
152
|
+
- **Reference Assertions:** `assertIsNull`, `assertIsUndefined`, `assertIsDefined`, `assertIsNil`, `assertIsFunction`, `assertObject`, `assertIsArray`, `assertIsMap`, `assertIsSet`, `assertIsWeakMap`, `assertIsWeakSet`
|
|
153
|
+
- **Refined / Composite Assertions:** `assertIsCamelCase`, `assertIsBufferLikeObject`, `assertIsJSONArrayString`, `assertIsJSONObjectString`, `assertIsJsonString`, `assertIsAbsoluteUrl`, `assertIsInternalUrl`, `assertIsRGBTuple`
|
|
154
|
+
|
|
155
|
+
> ⚠️ **Note:** Importing the full `AssertionUtils` object is **not tree-shakable**. For smaller bundles, prefer individual assertion imports.
|
|
156
|
+
|
|
157
|
+
[Full Reference →](docs/type-guards.md)
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## Common Utilities
|
|
162
|
+
|
|
163
|
+
✅ Tree-shakable
|
|
164
|
+
✅ Type-safe
|
|
165
|
+
✅ Works with objects, arrays, and primitive types
|
|
166
|
+
✅ Modular imports supported
|
|
167
|
+
|
|
168
|
+
### 🧰 Object, array, and generic helpers
|
|
169
|
+
|
|
170
|
+
Provides **type-safe, reusable, and tree-shakable utilities** for working with objects, arrays, and other common operations. Designed to improve type inference, maintain immutability, and simplify everyday tasks.
|
|
171
|
+
|
|
172
|
+
[Full Reference →](docs/common.md)
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Computation Utilities
|
|
177
|
+
|
|
178
|
+
`ComputationUtils` provides **type-safe, numeric, and statistical helpers** for common mathematical operations.
|
|
179
|
+
It supports **numbers and BigInts**, incremental statistics (Welford’s algorithm), percentages, deltas, clamping, rounding, and anomaly detection.
|
|
180
|
+
|
|
181
|
+
### Features
|
|
182
|
+
|
|
183
|
+
✅ Supports both `number` and `bigint`
|
|
184
|
+
✅ Rounding & Clamping utilities
|
|
185
|
+
✅ Percentages & Ratios
|
|
186
|
+
✅ Incremental Statistics (Welford’s algorithm)
|
|
187
|
+
✅ Deltas & Percentage Change
|
|
188
|
+
✅ Anomaly Detection
|
|
189
|
+
⚠️ **Note:** Not tree-shakable — importing the class brings in all methods
|
|
190
|
+
|
|
191
|
+
[Full Reference →](docs/computation-utils.md)
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## DOM Utilities (`DomUtils`)
|
|
196
|
+
|
|
197
|
+
> ⚠️ **Note:** These utilities are framework-agnostic, but importing `DomUtils` as a whole will include all methods in your bundle.
|
|
198
|
+
|
|
199
|
+
`DomUtils` provides **type-safe, DOM-focused helpers** for handling keyboard interactions, media preloading, and image normalization. These utilities are **pure functions**, easy to test, and work in both native DOM and React environments.
|
|
200
|
+
|
|
201
|
+
### Features
|
|
202
|
+
|
|
203
|
+
✅ Keyboard event interpretation
|
|
204
|
+
✅ Image preloading with caching
|
|
205
|
+
✅ Image source normalization
|
|
206
|
+
✅ Pure and framework-agnostic
|
|
207
|
+
⚠️ Not tree-shakable when importing the full `DomUtils` object
|
|
208
|
+
|
|
209
|
+
[Full Reference →](docs/dom-utils.md)
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## Color Utilities
|
|
214
|
+
|
|
215
|
+
> ⚠️ **Note:** Importing the full `ColorUtils` object will include all methods in your bundle.
|
|
216
|
+
|
|
217
|
+
`ColorUtils` provides **type-safe, color-focused helpers** for common operations like color parsing, conversion, and manipulation.
|
|
218
|
+
These utilities are **pure functions**, framework-agnostic, and work in both browser and Node environments.
|
|
219
|
+
|
|
220
|
+
### Features
|
|
221
|
+
|
|
222
|
+
✅ Parse color strings (HEX, RGB, HSL)
|
|
223
|
+
✅ Convert between color formats (e.g., HEX → RGB, RGB → HSL)
|
|
224
|
+
✅ Generate color variations (lighten, darken, alpha adjustments)
|
|
225
|
+
✅ Compare and blend colors
|
|
226
|
+
✅ Pure and framework-agnostic
|
|
227
|
+
⚠️ Not tree-shakable when importing the full `ColorUtils` object
|
|
228
|
+
|
|
229
|
+
[Full Reference →](docs/color-utils.md)
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## Processor Utilities
|
|
234
|
+
|
|
235
|
+
> ⚠️ **Note:** Importing the full `ProcessorUtils` or `ReactProcessorUtils` object will include all methods in your bundle.
|
|
236
|
+
|
|
237
|
+
`ProcessorUtils` and `ReactProcessorUtils` provide **async, event, and React-focused helpers** for common operations like network requests, delays, retries, and React ref management.
|
|
238
|
+
These utilities are **pure functions** where possible, easy to test, and work in both browser and Node environments (with React-specific utilities designed for React apps).
|
|
239
|
+
|
|
240
|
+
### Features
|
|
241
|
+
|
|
242
|
+
✅ Fetch and parse JSON with robust error handling
|
|
243
|
+
✅ Retry async operations with exponential backoff
|
|
244
|
+
✅ Delay execution for throttling or timeouts
|
|
245
|
+
✅ Combine multiple React refs into a single callback
|
|
246
|
+
✅ Lazily evaluate object properties and cache results
|
|
247
|
+
✅ Merge CSS variables with existing style objects
|
|
248
|
+
✅ Safely merge event handlers with internal logic
|
|
249
|
+
✅ Filter and extract valid DOM props
|
|
250
|
+
✅ Select React children by `displayName`
|
|
251
|
+
✅ Pure and framework-agnostic where possible
|
|
252
|
+
⚠️ Not tree-shakable when importing the full `ProcessorUtils` / `ReactProcessorUtils` object
|
|
253
|
+
|
|
254
|
+
[Full Reference →](docs/processor-utils.md)
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## Transformer Utilities
|
|
259
|
+
|
|
260
|
+
WIP
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## Debug Utilities
|
|
265
|
+
|
|
266
|
+
WIP
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## Link Utilities
|
|
271
|
+
|
|
272
|
+
WIP
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";var de=Object.defineProperty;var vt=Object.getOwnPropertyDescriptor;var _t=Object.getOwnPropertyNames;var $t=Object.prototype.hasOwnProperty;var Ft=(e,t)=>{for(var r in t)de(e,r,{get:t[r],enumerable:!0})},zt=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of _t(t))!$t.call(e,o)&&o!==r&&de(e,o,{get:()=>t[o],enumerable:!(n=vt(t,o))||n.enumerable});return e};var Ht=e=>zt(de({},"__esModule",{value:!0}),e);var Kr={};Ft(Kr,{ANSI_COLOR_CODES:()=>ee,ArrayUtils:()=>k,AssertionUtils:()=>Er,CollectionTypeGuards:()=>Ar,ColorUtils:()=>Mr,ComputationUtils:()=>Qe,CoreTypeGuards:()=>y,DEFAULT_KEYBOARD_CONFIG:()=>fe,DebugUtils:()=>D,DomUtils:()=>jr,FormatTypeGuards:()=>Rr,HTML_TAGS:()=>ar,LOG_TYPES:()=>ye,LinkUtils:()=>G,ObjectUtils:()=>x,REGEX_CONSTANTS:()=>T,ReactTypeGuards:()=>Nr,RenamedArrayMethods:()=>lt,RenamedObjectMethods:()=>pt,SAFE_HTML_TAGS:()=>Te,TransformersUtils:()=>Ir,VALID_DOM_PROPS:()=>te,VALID_DOM_TESTING_KEYS:()=>kr,arrayFilter:()=>Wt,arrayFilterNonNullable:()=>Qt,arrayFlat:()=>Xt,arrayFlatMap:()=>Zt,arrayForEach:()=>Yt,arrayIncludes:()=>Jt,arrayMap:()=>Vt,arrayReduce:()=>qt,assertIsAbsoluteUrl:()=>Lt,assertIsArray:()=>Ct,assertIsBigInt:()=>xt,assertIsBoolean:()=>gt,assertIsBufferLikeObject:()=>jt,assertIsCamelCase:()=>Gt,assertIsDefined:()=>Rt,assertIsFunction:()=>wt,assertIsInteger:()=>ft,assertIsInternalUrl:()=>Ut,assertIsJSONArrayString:()=>Mt,assertIsJSONObjectString:()=>Kt,assertIsJsonString:()=>Bt,assertIsMap:()=>Nt,assertIsNil:()=>At,assertIsNonEmptyString:()=>bt,assertIsNull:()=>St,assertIsNumber:()=>Tt,assertIsRGBTuple:()=>ae,assertIsSet:()=>Et,assertIsString:()=>yt,assertIsSymbol:()=>ht,assertIsUndefined:()=>kt,assertIsWeakMap:()=>It,assertIsWeakSet:()=>Pt,assertObject:()=>Ot,capitalizeArray:()=>ue,capitalizeString:()=>X,capitalizedKeys:()=>Je,contrastTextColor:()=>tt,extractRelativePath:()=>at,generateKeyMap:()=>Ve,getCallerLocation:()=>qe,getKeyboardAction:()=>Xe,getLuminance:()=>Y,handleInternalHashScroll:()=>ct,hasChildren:()=>Be,hasDefinedKeys:()=>Ee,hasNameMetadata:()=>$e,hasOnClick:()=>ve,hexToHSL:()=>ot,hexToNormalizedRGB:()=>st,hexToRGB:()=>v,hexToRGBShorthand:()=>rt,highlight:()=>N,interpolateColor:()=>nt,isAbsoluteUrl:()=>E,isArray:()=>w,isArrayOf:()=>P,isBigInt:()=>h,isBoolean:()=>j,isBufferLikeObject:()=>W,isCamelCase:()=>z,isComponentType:()=>Le,isDOMEntry:()=>Ge,isDOMPropKey:()=>ne,isDarkColor:()=>et,isDefined:()=>R,isElementLike:()=>ie,isElementOfType:()=>_e,isEmail:()=>Pe,isForwardRef:()=>Ue,isFragment:()=>De,isFunction:()=>g,isHTMLString:()=>Ae,isHexByteString:()=>we,isInArray:()=>Oe,isInstanceOf:()=>Se,isInteger:()=>me,isInternalUrl:()=>I,isJSONArrayString:()=>B,isJSONObjectString:()=>L,isJsonString:()=>H,isKebabCase:()=>Re,isKeyInObject:()=>p,isKeyOfArray:()=>V,isKeyOfObject:()=>Ce,isLumGreaterThan:()=>pe,isLumLessThan:()=>le,isMap:()=>be,isNil:()=>A,isNonEmptyString:()=>b,isNull:()=>K,isNumber:()=>S,isObject:()=>c,isPhoneNumber:()=>Ie,isPrimitive:()=>F,isPromise:()=>Ke,isPropValid:()=>re,isRGBTuple:()=>J,isReactElement:()=>se,isReactPortal:()=>q,isRecordOf:()=>Ne,isRef:()=>je,isRefObject:()=>Me,isSet:()=>ge,isSnakeCase:()=>ke,isString:()=>m,isSymbol:()=>M,isUndefined:()=>C,isValidReactNode:()=>oe,isWeakMap:()=>xe,isWeakSet:()=>he,logDev:()=>Dt,normalizeImageSrc:()=>Ye,normalizeUrl:()=>it,objectEntries:()=>tr,objectFromEntries:()=>rr,objectGet:()=>sr,objectHas:()=>or,objectKeys:()=>er,objectSet:()=>ir,objectValues:()=>nr,preloadImages:()=>Ze,serialize:()=>ce,stripHash:()=>ut,toCamelCase:()=>Fe,toKebabCase:()=>ze,toKeyByField:()=>We,toSnakeCase:()=>He,validateRGB:()=>_});module.exports=Ht(Kr);function Q(e,t){let r={};for(let[n,o]of Object.entries(t)){let s=e[o];typeof s=="function"&&(r[n]=s.bind(e))}return r}var k=class e{static includes(t,r){return t.includes(r)}static createFixedLengthArray(t,r){if(t.length!==r)throw new Error(`Array must have exactly ${r} elements`);return t}static readAllItems(t){return[...t]}static map(t,r){return t.map(r)}static forEachUnion(t,r){(Array.isArray(t[0])?[].concat(...t):t).forEach(r)}static forEach(t,r){t.forEach(r)}static reduce(t,r,n){return t.reduce(r,n)}static flat(t){return t.reduce((r,n)=>r.concat(n),[])}static flatMap(t,r){return t.reduce((n,o,s)=>{let i=r(o,s);return n.concat(i)},[])}static filter(t,r){return t.filter(r)}static filterNonNullable(t){return e.filter(t,r=>r!=null)}},lt=Q(k,{arrayIncludes:"includes",arrayMap:"map",arrayFilter:"filter",arrayFlat:"flat",arrayReduce:"reduce",arrayForEach:"forEach",arrayFlatMap:"flatMap",arrayFilterNonNullable:"filterNonNullable"}),{arrayMap:Vt,arrayFilter:Wt,arrayIncludes:Jt,arrayReduce:qt,arrayFlat:Xt,arrayFlatMap:Zt,arrayForEach:Yt,arrayFilterNonNullable:Qt}=lt;var x=class{static keys(t){return Object.keys(t)}static entries(t){return t?Object.entries(t):[]}static fromEntries(t){return Object.fromEntries(t)}static values(t){return Object.values(t)}static has(t,r){if(!r)return!1;let n=r.split("."),o=t;for(let s of n){if(o==null||typeof o!="object"||!(s in o))return!1;o=o[s]}return!0}static get(t,r){if(!r)return;let n=r.split("."),o=t;for(let s of n){if(o==null||typeof o!="object"||!(s in o))return;o=o[s]}return o}static set(t,r,n){if(!r)return;let o=r.split("."),s=t;for(let i=0;i<o.length-1;i++){let a=o[i];if(typeof s!="object"||s===null)return;let u=s;(!(a in u)||typeof u[a]!="object"||u[a]===null)&&(u[a]={}),s=u[a]}typeof s=="object"&&s!==null&&(s[o[o.length-1]]=n)}},pt=Q(x,{objectKeys:"keys",objectEntries:"entries",objectFromEntries:"fromEntries",objectValues:"values",objectHas:"has",objectGet:"get",objectSet:"set"}),{objectKeys:er,objectEntries:tr,objectFromEntries:rr,objectValues:nr,objectHas:or,objectGet:sr,objectSet:ir}=pt;var S=e=>typeof e=="number"&&!Number.isNaN(e)&&Number.isFinite(e),me=e=>Number.isInteger(e),m=e=>typeof e=="string",b=e=>typeof e=="string"&&e.length>0&&e.trim().length>0,j=e=>typeof e=="boolean",h=e=>typeof e=="bigint",M=e=>typeof e=="symbol",F=e=>m(e)||S(e)||j(e)||h(e);var ar=Object.freeze(["div","span","a","p","ul","li"]),Te=Object.freeze(["b","i","p","ul","li","a","span","div","br","strong","em","u","code","pre","blockquote"]),fe={allowedKeys:["arrowleft","arrowright","arrowup","arrowdown","backspace","delete","tab"],clearKeys:["backspace","delete"],copyShortcut:{key:"c",modifiers:["ctrl","meta"]},pasteShortcut:{key:"v",modifiers:["ctrl","meta"]}};var ye=Object.freeze(["log","warn","error","info","debug","table"]),T={isoRegex:/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/,camelCase:/^[a-z]+(?:[A-Z][a-z0-9]*)*$/,kebabCase:/^[a-z0-9]+(?:-[a-z0-9]+)*$/,snakeCase:/^[a-z0-9]+(?:_[a-z0-9]+)*$/,hexString:/^[0-9a-fA-F]+$/,hexColor:/^[0-9A-Fa-f]{6}$/,letterSeparator:/[^A-Za-z]+/g,camelCaseBoundary:/(?:^\w|[A-Z]|\b\w)/g,kebabCaseBoundary:/([a-z0-9])([A-Z])/g,whitespace:/\s+/g,wordBoundarySplitter:/[^A-Za-z0-9]+/g,USPhoneNumber:/^(?:\+1\s?)?(?:\(\d{3}\)|\d{3})[-.\s]?\d{3}[-.\s]?\d{4}$/,EUPhoneNumber:/^\+?\d{1,4}[\s.-]?\d{2,4}([\s.-]?\d{2,4}){1,3}$/,genericPhoneNumber:/^\+?(\d[\d\s-().]{6,}\d)$/,genericEmail:/^[^\s@]+@[^\s@]+\.[^\s@]+$/,emailRegex:/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*\.[a-zA-Z]{2,}$/,imageSrcRegex:/<img[^>]+src="([^">]+)"/i,singleAlphabetChar:/^[a-zA-Z]$/,htmlDetection:new RegExp(`<\\/?(${Te.join("|")})\\b[^>]*>|&[a-z]+;`,"i"),stackTracePrefix:/^\s*at\s+/},ee={reset:"\x1B[0m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",bold:"\x1B[1m",underline:"\x1B[4m"};var ur={children:!0,dangerouslySetInnerHTML:!0,key:!0,ref:!0,autoFocus:!0,defaultValue:!0,defaultChecked:!0,innerHTML:!0,suppressContentEditableWarning:!0,suppressHydrationWarning:!0,valueLink:!0},cr={action:!0,formAction:!0,onCaptured:!0,precedence:!0,blocking:!0},lr={autoFocus:!0,readOnly:!0,noValidate:!0,spellCheck:!0,tabIndex:!0,autoComplete:!0,autoCorrect:!0,autoCapitalize:!0},pr={popover:!0,popoverTarget:!0,popoverTargetAction:!0,inert:!0,loading:!0,fetchpriority:!0,fetchPriority:!0,enterKeyHint:!0,shadowRoot:!0,disablePictureInPicture:!0,playsInline:!0},dr={paintOrder:!0,vectorEffect:!0,imageRendering:!0,shapeRendering:!0,textAnchor:!0,ariaHasPopup:!0,ariaLabel:!0,ariaLabelledBy:!0,alignmentBaseline:!0,baselineShift:!0,dominantBaseline:!0},mr={about:!0,datatype:!0,inlist:!0,prefix:!0,property:!0,resource:!0,typeof:!0,vocab:!0,itemProp:!0,itemScope:!0,itemType:!0,itemID:!0,itemRef:!0},Tr={autoCapitalize:!0,autoCorrect:!0,autoSave:!0,color:!0,incremental:!0,results:!0,security:!0,unselectable:!0,on:!0,option:!0,fallback:!0},fr={abbr:!0,accept:!0,acceptCharset:!0,accessKey:!0,action:!0,allow:!0,allowFullScreen:!0,allowPaymentRequest:!0,alt:!0,async:!0,autoComplete:!0,autoFocus:!0,autoPlay:!0,capture:!0,cellPadding:!0,cellSpacing:!0,challenge:!0,charSet:!0,checked:!0,cite:!0,classID:!0,className:!0,cols:!0,colSpan:!0,content:!0,contentEditable:!0,contextMenu:!0,controls:!0,controlsList:!0,coords:!0,crossOrigin:!0,data:!0,dateTime:!0,decoding:!0,default:!0,defer:!0,dir:!0,disabled:!0,disablePictureInPicture:!0,disableRemotePlayback:!0,download:!0,draggable:!0,encType:!0,enterKeyHint:!0,form:!0,formAction:!0,formEncType:!0,formMethod:!0,formNoValidate:!0,formTarget:!0,frameBorder:!0,headers:!0,height:!0,hidden:!0,high:!0,href:!0,hrefLang:!0,htmlFor:!0,httpEquiv:!0,id:!0,inputMode:!0,integrity:!0,is:!0,keyParams:!0,keyType:!0,kind:!0,label:!0,lang:!0,list:!0,loading:!0,loop:!0,low:!0,marginHeight:!0,marginWidth:!0,max:!0,maxLength:!0,media:!0,mediaGroup:!0,method:!0,min:!0,minLength:!0,multiple:!0,muted:!0,name:!0,nonce:!0,noValidate:!0,open:!0,optimum:!0,pattern:!0,placeholder:!0,playsInline:!0,poster:!0,preload:!0,profile:!0,radioGroup:!0,readOnly:!0,referrerPolicy:!0,rel:!0,required:!0,reversed:!0,role:!0,rows:!0,rowSpan:!0,sandbox:!0,scope:!0,scoped:!0,scrolling:!0,seamless:!0,selected:!0,shape:!0,size:!0,sizes:!0,slot:!0,span:!0,spellCheck:!0,src:!0,srcDoc:!0,srcLang:!0,srcSet:!0,start:!0,step:!0,style:!0,summary:!0,tabIndex:!0,target:!0,title:!0,translate:!0,type:!0,useMap:!0,value:!0,width:!0,wmode:!0,wrap:!0},yr={alignmentBaseline:!0,baselineShift:!0,clip:!0,clipPath:!0,clipRule:!0,color:!0,colorInterpolation:!0,colorInterpolationFilters:!0,colorProfile:!0,colorRendering:!0,cursor:!0,direction:!0,display:!0,dominantBaseline:!0,enableBackground:!0,fill:!0,fillOpacity:!0,fillRule:!0,filter:!0,floodColor:!0,floodOpacity:!0,imageRendering:!0,lightingColor:!0,markerEnd:!0,markerMid:!0,markerStart:!0,mask:!0,opacity:!0,overflow:!0,paintOrder:!0,pointerEvents:!0,shapeRendering:!0,stopColor:!0,stopOpacity:!0,stroke:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeLinecap:!0,strokeLinejoin:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0,textAnchor:!0,textDecoration:!0,textRendering:!0,unicodeBidi:!0,vectorEffect:!0,visibility:!0,wordSpacing:!0,writingMode:!0},br={cx:!0,cy:!0,d:!0,dx:!0,dy:!0,fr:!0,fx:!0,fy:!0,height:!0,points:!0,r:!0,rx:!0,ry:!0,transform:!0,version:!0,viewBox:!0,width:!0,x:!0,x1:!0,x2:!0,y:!0,y1:!0,y2:!0,z:!0},gr={accumulate:!0,additive:!0,allowReorder:!0,amplitude:!0,attributeName:!0,attributeType:!0,autoReverse:!0,begin:!0,bias:!0,by:!0,calcMode:!0,decelerate:!0,diffuseConstant:!0,divisor:!0,dur:!0,edgeMode:!0,elevation:!0,end:!0,exponent:!0,externalResourcesRequired:!0,filterRes:!0,filterUnits:!0,from:!0,in:!0,in2:!0,intercept:!0,k:!0,k1:!0,k2:!0,k3:!0,k4:!0,kernelMatrix:!0,kernelUnitLength:!0,keyPoints:!0,keySplines:!0,keyTimes:!0,limitingConeAngle:!0,mode:!0,numOctaves:!0,operator:!0,order:!0,orient:!0,orientation:!0,origin:!0,pathLength:!0,primitiveUnits:!0,repeatCount:!0,repeatDur:!0,restart:!0,result:!0,rotate:!0,scale:!0,seed:!0,slope:!0,spacing:!0,specularConstant:!0,specularExponent:!0,speed:!0,spreadMethod:!0,startOffset:!0,stdDeviation:!0,stitchTiles:!0,surfaceScale:!0,targetX:!0,targetY:!0,to:!0,values:!0,xChannelSelector:!0,yChannelSelector:!0,zoomAndPan:!0},xr={accentHeight:!0,alphabetic:!0,arabicForm:!0,ascent:!0,bbox:!0,capHeight:!0,descent:!0,fontFamily:!0,fontSize:!0,fontSizeAdjust:!0,fontStretch:!0,fontStyle:!0,fontVariant:!0,fontWeight:!0,format:!0,g1:!0,g2:!0,glyphName:!0,glyphOrientationHorizontal:!0,glyphOrientationVertical:!0,glyphRef:!0,hanging:!0,horizAdvX:!0,horizOriginX:!0,ideographic:!0,kerning:!0,lengthAdjust:!0,letterSpacing:!0,local:!0,mathematical:!0,overlinePosition:!0,overlineThickness:!0,panose1:!0,refX:!0,refY:!0,renderingIntent:!0,strikethroughPosition:!0,strikethroughThickness:!0,string:!0,systemLanguage:!0,tableValues:!0,textLength:!0,u1:!0,u2:!0,underlinePosition:!0,underlineThickness:!0,unicode:!0,unicodeRange:!0,unitsPerEm:!0,vAlphabetic:!0,vHanging:!0,vIdeographic:!0,vMathematical:!0,values:!0,vertAdvY:!0,vertOriginX:!0,vertOriginY:!0,widths:!0,xHeight:!0},hr={clipPathUnits:!0,contentScriptType:!0,contentStyleType:!0,gradientTransform:!0,gradientUnits:!0,markerHeight:!0,markerUnits:!0,markerWidth:!0,maskContentUnits:!0,maskUnits:!0,offset:!0,patternContentUnits:!0,patternTransform:!0,patternUnits:!0,preserveAlpha:!0,preserveAspectRatio:!0,requiredExtensions:!0,requiredFeatures:!0,viewTarget:!0,xlinkActuate:!0,xlinkArcrole:!0,xlinkHref:!0,xlinkRole:!0,xlinkShow:!0,xlinkTitle:!0,xlinkType:!0,xmlBase:!0,xmlns:!0,xmlnsXlink:!0,xmlLang:!0,xmlSpace:!0},Sr={for:!0,class:!0,autofocus:!0},te={...Tr,...mr,...dr,...pr,...lr,...cr,...ur,...Sr,...hr,...xr,...gr,...br,...yr,...fr},kr=Object.keys(te);var K=e=>e===null,C=e=>typeof e>"u",R=e=>e!=null,A=e=>e==null,g=e=>typeof e=="function",c=e=>!K(e)&&!w(e)&&typeof e=="object",w=e=>Array.isArray(e),be=e=>e instanceof Map,ge=e=>e instanceof Set,xe=e=>e instanceof WeakMap,he=e=>e instanceof WeakSet;function Se(e,t){return e instanceof t}var z=e=>typeof e=="string"&&T.camelCase.test(e),ke=e=>typeof e=="string"&&T.snakeCase.test(e),Re=e=>typeof e=="string"&&T.kebabCase.test(e),B=e=>{if(!b(e))return!1;try{return Array.isArray(JSON.parse(e))}catch{return!1}},L=e=>{if(!b(e))return!1;try{let t=JSON.parse(e);return typeof t=="object"&&t!==null&&!Array.isArray(t)}catch{return!1}},Ae=e=>m(e)&&T.htmlDetection.test(e),we=e=>t=>!(!b(t)||t.length%2!==0||!T.hexString.test(t)||!C(e)&&t.length!==e),H=e=>B(e)||L(e);var E=e=>{if(!b(e))return!1;try{return new URL(e),!0}catch{return!1}},I=e=>{if(typeof window>"u"||typeof location>"u"||!b(e))return!1;if(e.startsWith("/"))return!0;try{return new URL(e,location.origin).hostname===location.hostname}catch{return!1}};var Oe=e=>{let t=new Set(e);return r=>!C(r)&&t.has(r)},Ce=e=>t=>(m(t)||S(t)||M(t))&&t in e,p=e=>t=>c(t)&&e in t,V=e=>t=>(m(t)||S(t)||M(t)||j(t))&&e.includes(t),P=(e,t)=>Array.isArray(t)&&t.every(e),Ne=(e,t)=>c(e)&&x.values(e).every(t),Ee=e=>t=>!t||!c(t)?!1:e.every(r=>p(r)(t)&&R(t[r]));var W=e=>{if(!c(e))return!1;let t="type"in e&&e.type==="Buffer",r="data"in e&&P(S,e.data);return t&&r},J=e=>w(e)&&e.length===3&&e.every(t=>S(t)&&t>=0&&t<=255),Ie=e=>b(e)?[T.USPhoneNumber,T.EUPhoneNumber,T.genericPhoneNumber].some(t=>t.test(e)):!1,Pe=e=>m(e)&&T.emailRegex.test(e);var y={isString:m,isNumber:S,isBoolean:j,isBigInt:h,isNil:A,isDefined:R,isInteger:me,isNonEmptyString:b,isSymbol:M,isPrimitive:F,isNull:K,isFunction:g,isObject:c,isArray:w,isMap:be,isSet:ge,isWeakMap:xe,isWeakSet:he,isUndefined:C,isInstanceOf:Se},Rr={isEmail:Pe,isPhone:Ie,isUrlAbsolute:E,isUrlInternal:I,isJsonString:H,isHTMLString:Ae,isCamelCase:z,isSnakeCase:ke,isKebabCase:Re,isHexByteString:we,isJSONObjectString:L,isJSONArrayString:B,isRGBTuple:J,isBufferLikeObject:W},Ar={isArrayOf:P,isRecordOf:Ne,isKeyOfObject:Ce,isKeyInObject:p,isKeyOfArray:V,isInArray:Oe,hasKeys:Ee};var dt=e=>{let t=Object.create(null);return r=>{if(r in t)return t[r];let n=e(r);return t[r]=n,n}};var wr=x.keys(te).join("|"),Or=new RegExp(`^((${wr})|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$`),re=dt(e=>Or.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91),ne=e=>m(e)&&re(e),Ge=e=>m(e[0])&&ne(e[0]);var Cr=(e,t)=>p("$$typeof")(e)&&e.$$typeof===t,je=e=>R(e)&&(g(e)||c(e)&&"current"in e),Me=e=>!K(e)&&c(e)&&"current"in e,Ke=e=>!!e&&p("then")(e)&&g(e.then),q=e=>c(e)&&p("containerInfo")(e),Be=e=>c(e)&&p("children")(e)&&R(e.children),Le=e=>g(e)||p("prototype")(e)&&c(e.prototype)&&p("render")(e.prototype)&&g(e.prototype.render),Ue=e=>Cr(e,Symbol.for("react.forward_ref"));var U=require("react"),oe=e=>A(e)||F(e)||(0,U.isValidElement)(e)||q(e)||P(oe,e),se=e=>(0,U.isValidElement)(e),De=e=>(0,U.isValidElement)(e)&&e.type===U.Fragment,ve=e=>se(e)&&!A(e.props)&&p("onClick")(e.props)&&g(e.props.onClick),ie=e=>c(e)&&p("type")(e)&&p("props")(e)&&c(e.props)&&(m(e.type)||g(e.type)),_e=(e,t)=>ie(e)&&t.includes(e.type),$e=e=>g(e)&&(c(e)||g(e))&&(p("displayName")(e)||p("name")(e)||p("type")(e));var Nr={isRef:je,isRefObject:Me,isPromise:Ke,isReactPortal:q,hasChildren:Be,isComponentType:Le,isForwardRef:Ue,isValidReactNode:oe,isReactElement:se,isFragment:De,hasOnClick:ve,isElementLike:ie,isElementOfType:_e,hasNameMetadata:$e,isDOMPropKey:ne,isDOMEntry:Ge,isPropValid:re};var mt=(e,t,r)=>{if(!t(e))throw new Error(r??"Validation failed for value")},d=(e,t)=>(r,n)=>mt(r,e,n),Tt=d(y.isNumber,"isNumber"),ft=d(y.isInteger,"isInteger"),yt=d(y.isString,"isString"),bt=d(y.isNonEmptyString,"isNonEmptyString"),gt=d(y.isBoolean,"isBoolean"),xt=d(y.isBigInt,"isBigInt"),ht=d(y.isSymbol,"isSymbol"),St=d(y.isNull,"isNull"),kt=d(y.isUndefined,"isUndefined"),Rt=d(y.isDefined,"isDefined"),At=d(y.isNil,"isNil"),wt=d(y.isFunction,"isFunction"),Ot=d(y.isObject,"isObject"),Ct=d(y.isArray,"isArray"),Nt=d(y.isMap,"isMap"),Et=d(y.isSet,"isSet"),It=d(y.isWeakMap,"isWeakMap"),Pt=d(y.isWeakSet,"isWeakSet"),Gt=d(z,"isCamelCase"),jt=d(W,"isBufferLikeObject"),Mt=d(B,"isJSONArrayString"),Kt=d(L,"isJSONObjectString"),Bt=d(H,"isJsonString"),Lt=d(E,"isAbsoluteUrl"),Ut=d(I,"isInternalUrl"),ae=d(J,"isRGBTuple"),Er={assertValue:mt,makeAssert:d,assertIsNumber:Tt,assertIsInteger:ft,assertIsString:yt,assertIsNonEmptyString:bt,assertIsBoolean:gt,assertIsBigInt:xt,assertIsSymbol:ht,assertIsNull:St,assertIsUndefined:kt,assertIsDefined:Rt,assertIsNil:At,assertIsFunction:wt,assertObject:Ot,assertIsArray:Ct,assertIsMap:Nt,assertIsSet:Et,assertIsWeakMap:It,assertIsWeakSet:Pt,assertIsCamelCase:Gt,assertIsBufferLikeObject:jt,assertIsJSONArrayString:Mt,assertIsJSONObjectString:Kt,assertIsJsonString:Bt,assertIsAbsoluteUrl:Lt,assertIsInternalUrl:Ut,assertIsRGBTuple:ae};var X=e=>e[0].toUpperCase()+e.slice(1),Fe=e=>A(e)||!b(e)?"":e.replace(T.letterSeparator," ").replace(T.camelCaseBoundary,(r,n)=>n===0?r.toLowerCase():r.toUpperCase()).replace(T.whitespace,""),ze=e=>A(e)||!b(e)?"":e.replace(T.wordBoundarySplitter," ").replace(T.kebabCaseBoundary,"$1 $2").trim().split(T.whitespace).join("-").toLowerCase(),He=e=>A(e)||!b(e)?"":e.replace(T.wordBoundarySplitter," ").replace(T.kebabCaseBoundary,"$1 $2").trim().split(T.whitespace).join("_").toLowerCase();var Ve=e=>{let{keys:t,prefix:r,suffix:n}=e,o=k.map(t,s=>{let i=r?`${r}${s.charAt(0).toUpperCase()+s.slice(1)}${n}`:`${s.charAt(0).toLowerCase()+s.slice(1)}${n}`;return[s,i]});return x.fromEntries(o)},We=(e,t)=>x.fromEntries(k.map(e,r=>{let n=r[t],{[t]:o,...s}=r;return[n,s]})),ue=e=>k.map(e,X),Je=e=>ue(x.keys(e).map(String).filter(t=>/^[A-Za-z]/.test(t)));var Ir={capitalizedKeys:Je,capitalizeArray:ue,toKeyByField:We,generateKeyMap:Ve,toSnakeCase:He,toKebabCase:ze,toCamelCase:Fe,capitalizeString:X};function N(e,t="yellow"){return`${ee[t]}${e}${ee.reset}`}var Pr={log:e=>N(e,"yellow"),info:e=>N(e,"cyan"),error:e=>N(e,"red"),debug:e=>N(e,"magenta"),warn:e=>N(e,"yellow"),table:e=>e},ce=e=>{if(C(e))return"";if(m(e))return e;try{return JSON.stringify(e,(t,r)=>h(r)?r.toString():r,2)}catch{return String(e)}},qe=e=>{let{preferredIndex:t=3,fallbackIndex:r=2,topParent:n=!1,stripPathPrefix:o=process.cwd()}=e,s=new Error().stack;if(!s)return"unknown";let i=s.split(`
|
|
2
|
+
`).slice(1).map(u=>u.replace(T.stackTracePrefix,"").trim()).filter(Boolean),a=n?[...i].reverse().find(u=>!u.includes("node_modules"))??i.at(-1):i[t]??i[r]??i.at(-1);return o?a?.replace(o,"")??"unknown":a??"unknown"},Dt=(e,...t)=>{let r=process.env.NODE_ENV!=="production",{enabled:n=!0,overrideDev:o=!1}=e;if(!n||!r&&!o)return;let s="log",i=t[0];if(m(i)&&V(ye)(i)&&(s=i),s==="table"){let l=k.map(t.slice(1),f=>f&&c(f)&&"current"in f?f.current.map($=>({key:$.key,duration:$.end!=null&&$.start!=null?`${($.end-$.start).toFixed(2)}ms`:"in progress"})):f);console.table(l.flat());return}let a=Pr[s],u=t.map(l=>{let f=c(l)?ce(l):String(l);return a?a(f):f});(console[s]??console.log)(...u)};var D=class{};D.highlight=N,D.serialize=ce,D.getCallerLocation=qe;function Xe(e,t={}){let r=(l,f)=>l.key.toLowerCase()!==f.key?!1:f.modifiers.some(O=>O==="ctrl"?l.ctrlKey:O==="meta"?l.metaKey:O==="alt"?l.altKey:O==="shift"?l.shiftKey:!1),n={...fe,...t},o=e.key.toLowerCase(),s=r(e,n.copyShortcut),i=r(e,n.pasteShortcut),a=n.clearKeys.includes(o),u=n.allowedKeys.includes(o);return{isPaste:i,isCopy:s,isClear:a,isAllowedKey:u,shouldBlockTyping:!u&&!s&&!i}}var Z=new Map,Gr=200;async function Ze(e,t={}){if(typeof window>"u")return;let{fetchPriority:r="low"}=t,o=(w(e)?e:[e]).filter(s=>!Z.has(s)).map(s=>new Promise(i=>{let a=new Image;a.fetchPriority=r,a.src=s;let u=()=>{if(Z.size>=Gr){let l=Z.keys().next().value;l&&Z.delete(l)}Z.set(s,!0),i()};a.complete?u():p("decode")(a)&&g(a.decode)?a.decode().then(u).catch(u):(a.onload=u,a.onerror=u)}));o.length!==0&&await Promise.all(o)}function Ye(e){return e?m(e)?e:(p("default")(e),p("default")(e)&&e.default&&c(e.default)&&p("src")(e.default)?e.default.src:c(e)&&p("src")(e)&&m(e.src)?e.src:""):""}var jr={getKeyboardAction:Xe,preloadImages:Ze,normalizeImageSrc:Ye};var Qe=class{static toNum(t){return h(t)?Number(t):t}static round(t,r=0){let n=Math.pow(10,r);return Math.round(t*n)/n}static clamp(t,r,n){return Math.max(r,Math.min(n,t))}static getPercentage(t,r,n=0){if(r===0||r===0n)return 0;if(h(t)||h(r)){let o=BigInt(10**(n+2));return Number(BigInt(t)*100n*o/BigInt(r))/Number(o)}return this.round(t/r*100,n)}static computeMean(t){if(!t.length)return 0;let r=t.map(n=>this.toNum(n));return r.reduce((n,o)=>n+o,0)/r.length}static isAnomaly(t,r,n,o=2){return n===0?!1:Math.abs(t-r)>n*o}static computeRatio(t,r,n=2){return this.getPercentage(t,r,n)}static welfordUpdate(t,r){if(!t)return{welford:{count:1,mean:r,squaredDeviationSum:0},stdDev:0};let{count:n,mean:o,squaredDeviationSum:s}=t,i=n+1,a=r-o,u=o+a/i,l=s+a*(r-u),f=i>1?l/(i-1):0,O=Math.sqrt(f);return{welford:{count:i,mean:u,squaredDeviationSum:l},stdDev:O}}static computeDelta(t,r){if(h(t)&&h(r)){let n=t-r,o=n<0n?-n:n;return{netDelta:n,absDelta:o}}if(S(t)&&S(r)){let n=t-r,o=Math.abs(n);return{netDelta:n,absDelta:o}}throw new Error("Incompatible types: current and past must both be number or both be bigint.")}static computePercentageChange(t,r,n=1n){if(r===0||r===0n)return 0;if(h(t)||h(r)){let o=BigInt(t),s=BigInt(r);return Number((o-s)*(100n*n)/s)/Number(n)}return(t-r)/r*100}};var v=e=>{let t=e.startsWith("#")?e.slice(1):e;if(!T.hexColor.test(t))throw new Error(`Invalid hex color: "${e}"`);let r=parseInt(t.slice(0,2),16),n=parseInt(t.slice(2,4),16),o=parseInt(t.slice(4,6),16);return[r,n,o]},_=e=>m(e)?v(e):(ae(e),e),Y=e=>{let[t,r,n]=_(e),o=s=>{let i=s/255;return i<=.03928?i/12.92:((i+.055)/1.055)**2.4};return .2126*o(t)+.7152*o(r)+.0722*o(n)},le=(e,t)=>Y(_(e))<t,et=e=>le(e,.179),pe=(e,t)=>Y(_(e))>t,tt=(e,t)=>{let{mode:r="tailwind",threshold:n=.179}=t??{},o=pe(e,n);return r==="css"?o?"#000000":"#ffffff":o?"text-black":"text-white"},rt=e=>{let t=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,r=e.replace(t,(o,s,i,a)=>s+s+i+i+a+a),n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(r);return n?[parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)]:null},nt=(e,t,r)=>{let n={r:Math.round(e.r+(t.r-e.r)*r),g:Math.round(e.g+(t.g-e.g)*r),b:Math.round(e.b+(t.b-e.b)*r)};return`rgb(${n.r}, ${n.g}, ${n.b})`};function ot(e){let[t,r,n]=v(e).map(f=>f/255),o=Math.max(t,r,n),s=Math.min(t,r,n),i=(o+s)/2,a=0,u=0,l=o-s;return l!==0&&(u=i>.5?l/(2-o-s):l/(o+s),o===t?a=((r-n)/l+(r<n?6:0))*60:o===r?a=((n-t)/l+2)*60:o===n&&(a=((t-r)/l+4)*60)),{h:a,s:u,l:i}}var st=e=>{let[t,r,n]=v(e);return[t/255,r/255,n/255]};var Mr={hexToNormalizedRGB:st,hexToHSL:ot,interpolateColor:nt,hexToRGBShorthand:rt,contrastTextColor:tt,isLumGreaterThan:pe,isDarkColor:et,isLumLessThan:le,getLuminance:Y,validateRGB:_,hexToRGB:v};function it(e){if(!R(e))return"";if(m(e))return e;if(e instanceof URL)return e.toString();if(c(e)&&(p("pathname")(e)||p("query")(e))){let{pathname:t="",query:r,hash:n=""}=e,o="";if(c(r)){let a=new URLSearchParams;x.entries(r).forEach(([l,f])=>{R(f)&&(w(f)?k.forEach(f,O=>a.append(l,String(O))):a.append(l,String(f)))});let u=a.toString();u&&(o=`?${u}`)}let s=t||"",i=n&&!n.startsWith("#")?`#${n}`:n||"";return`${s}${o}${i}`}return""}var at=e=>{if(!I(e))return"/";let t=e.trim();return t?t.startsWith("/")?t:E(t)?new URL(t).pathname||"/":`/${t}`:"/"},ut=e=>{if(!e)return"";if(!e.includes("#"))return e;try{let t=typeof window<"u"?window.location.origin:"http://localhost",r=new URL(e,t);return typeof window<"u"&&r.origin===window.location.origin?`${r.pathname}${r.search}`:`${r.origin}${r.pathname}${r.search}`}catch{return e.split("#")[0]}},ct=({event:e,href:t,behavior:r="smooth",block:n="start"})=>{if(typeof window>"u"||!t.startsWith("#")||/iPad|iPhone|iPod/.test(navigator.userAgent))return!1;let s=t.replace(/^#/,""),i=document.getElementById(s);return i?(e?.preventDefault(),i.scrollIntoView({behavior:r,block:n}),!0):!1};var G=class{};G.normalize=it,G.extractRelativePath=at,G.stripHash=ut,G.handleHashScroll=ct;0&&(module.exports={ANSI_COLOR_CODES,ArrayUtils,AssertionUtils,CollectionTypeGuards,ColorUtils,ComputationUtils,CoreTypeGuards,DEFAULT_KEYBOARD_CONFIG,DebugUtils,DomUtils,FormatTypeGuards,HTML_TAGS,LOG_TYPES,LinkUtils,ObjectUtils,REGEX_CONSTANTS,ReactTypeGuards,RenamedArrayMethods,RenamedObjectMethods,SAFE_HTML_TAGS,TransformersUtils,VALID_DOM_PROPS,VALID_DOM_TESTING_KEYS,arrayFilter,arrayFilterNonNullable,arrayFlat,arrayFlatMap,arrayForEach,arrayIncludes,arrayMap,arrayReduce,assertIsAbsoluteUrl,assertIsArray,assertIsBigInt,assertIsBoolean,assertIsBufferLikeObject,assertIsCamelCase,assertIsDefined,assertIsFunction,assertIsInteger,assertIsInternalUrl,assertIsJSONArrayString,assertIsJSONObjectString,assertIsJsonString,assertIsMap,assertIsNil,assertIsNonEmptyString,assertIsNull,assertIsNumber,assertIsRGBTuple,assertIsSet,assertIsString,assertIsSymbol,assertIsUndefined,assertIsWeakMap,assertIsWeakSet,assertObject,capitalizeArray,capitalizeString,capitalizedKeys,contrastTextColor,extractRelativePath,generateKeyMap,getCallerLocation,getKeyboardAction,getLuminance,handleInternalHashScroll,hasChildren,hasDefinedKeys,hasNameMetadata,hasOnClick,hexToHSL,hexToNormalizedRGB,hexToRGB,hexToRGBShorthand,highlight,interpolateColor,isAbsoluteUrl,isArray,isArrayOf,isBigInt,isBoolean,isBufferLikeObject,isCamelCase,isComponentType,isDOMEntry,isDOMPropKey,isDarkColor,isDefined,isElementLike,isElementOfType,isEmail,isForwardRef,isFragment,isFunction,isHTMLString,isHexByteString,isInArray,isInstanceOf,isInteger,isInternalUrl,isJSONArrayString,isJSONObjectString,isJsonString,isKebabCase,isKeyInObject,isKeyOfArray,isKeyOfObject,isLumGreaterThan,isLumLessThan,isMap,isNil,isNonEmptyString,isNull,isNumber,isObject,isPhoneNumber,isPrimitive,isPromise,isPropValid,isRGBTuple,isReactElement,isReactPortal,isRecordOf,isRef,isRefObject,isSet,isSnakeCase,isString,isSymbol,isUndefined,isValidReactNode,isWeakMap,isWeakSet,logDev,normalizeImageSrc,normalizeUrl,objectEntries,objectFromEntries,objectGet,objectHas,objectKeys,objectSet,objectValues,preloadImages,serialize,stripHash,toCamelCase,toKebabCase,toKeyByField,toSnakeCase,validateRGB});
|
|
3
|
+
//# sourceMappingURL=index.cjs.map
|