tsu 2.8.1 → 2.9.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/dist/index.cjs +1 -1
- package/dist/index.d.cts +41 -4
- package/dist/index.d.ts +41 -4
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var d=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var U=Object.prototype.hasOwnProperty;var M=(e,n)=>{for(var t in n)d(e,t,{get:n[t],enumerable:!0})},E=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of N(n))!U.call(e,o)&&o!==t&&d(e,o,{get:()=>n[o],enumerable:!(r=C(n,o))||r.enumerable});return e};var S=e=>E(d({},"__esModule",{value:!0}),e);var Le={};M(Le,{capitalise:()=>ke,ceil:()=>F,chars:()=>Oe,clamp:()=>I,clone:()=>m,copyToClipboard:()=>de,debounce:()=>he,deepMerge:()=>O,drop:()=>te,floor:()=>L,groupsOf:()=>re,head:()=>oe,init:()=>ie,isArray:()=>l,isBlank:()=>Ae,isBoolean:()=>_,isBrowser:()=>p,isDefined:()=>$,isEmpty:()=>Ce,isEmptyArray:()=>z,isEmptyObject:()=>J,isEven:()=>q,isFunction:()=>K,isNull:()=>c,isNumber:()=>x,isObject:()=>a,isObjectLike:()=>f,isOdd:()=>R,isString:()=>b,isTouchDevice:()=>Y,isUndefined:()=>Z,isWindow:()=>G,last:()=>ue,max:()=>V,memoize:()=>we,min:()=>D,noop:()=>Q,once:()=>ve,partition:()=>le,product:()=>B,randomChance:()=>P,randomNumber:()=>s,range:()=>se,replaceChar:()=>Ne,round:()=>W,scroll:()=>xe,shuffle:()=>ce,sleep:()=>ee,splitAt:()=>ae,splitStrAt:()=>Ue,sum:()=>X,tail:()=>fe,take:()=>me,throttle:()=>je,toArray:()=>pe,toCamel:()=>Me,toKebab:()=>Ee,toNumber:()=>Se,toOrdinal:()=>Fe,toRomanNumerals:()=>H,truncate:()=>Ie,uniq:()=>T,uuid:()=>ne});module.exports=S(Le);function F(e,n=1){let t=e/n;return Math.ceil(t)*n}function I(e,n,t){return Math.min(t,Math.max(n,e))}function L(e,n=1){let t=e/n;return Math.floor(t)*n}function q(e){return e%2===0}function R(e){return e%2!==0}function V(...e){let n;return e.length===1&&Array.isArray(e[0])?n=e[0]:n=e,Math.max(...n)}function D(...e){let n;return e.length===1&&Array.isArray(e[0])?n=e[0]:n=e,Math.min(...n)}function B(e){let n=1;for(let t=0;t<e.length;t++)n*=e[t];return n}function P(e){return s(e)===0}function s(...e){let n,t;return e.length===1?(n=0,t=e[0]):(n=e[0],t=e[1]),Math.floor(Math.random()*(t-n))+n}function W(e,n=1){let t=e/n;return Math.round(t)*n}function X(e){let n=0;for(let t=0;t<e.length;t++)n+=e[t];return n}var j={1:"I",4:"IV",5:"V",9:"IX",10:"X",40:"XL",50:"L",90:"XC",100:"C",400:"CD",500:"D",900:"CM",1e3:"M"};function H(e,n=!1){let t=e,r="",o=Object.keys(j).map(Number).sort((i,u)=>u-i);for(let i of o)for(;t>=i;)r+=j[i],t-=i;return n?r.toLowerCase():r}function l(e){return Array.isArray(e)}function _(e){return typeof e=="boolean"}function p(){return typeof window<"u"}function $(e){return typeof e<"u"}function z(e){return l(e)&&e.length===0}function J(e){if(!a(e))return!1;for(let n in e)return!1;return!0}function K(e){return typeof e=="function"}function c(e){return Object.prototype.toString.call(e)==="[object Null]"}function x(e){return typeof e=="number"}function a(e){return Object.prototype.toString.call(e)==="[object Object]"}function f(e){return typeof e=="object"}function b(e){return typeof e=="string"}function Y(){return"ontouchstart"in window||navigator.maxTouchPoints>0}function Z(e){return typeof e>"u"}function G(e){return p()&&Object.prototype.toString.call(e)==="[object Window]"}function m(e){if(l(e)){let n=[];for(let t=0;t<e.length;t++)f(e[t])&&!c(e[t])?n[t]=m(e[t]):n[t]=e[t];return n}if(f(e)&&!c(e)){let n={};for(let t in e)f(e[t])&&!c(e[t])?n[t]=m(e[t]):n[t]=e[t];return n}return e}function Q(){}async function ee(e){return e<0&&console.warn("[tsu] warning: a sleep duration less than 0ms will be treated as 0ms."),new Promise(n=>{setTimeout(n,e)})}var k="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";function ne(e=16){let n=k.length,t=e,r="";for(;t--;)r+=k[s(n)];return r}function te(e,n){return e<=0?[...n]:n.slice(e)}function re(e,n){if(e<=0)throw new Error("[tsu] Invalid group size. Is it greater than 0?");if(e>=n.length)return[[...n]];let t=[];for(let r=0;r<n.length;r+=e)t.push(n.slice(r,r+e));return t}function oe(e){return e[0]}function ie(e){return e.slice(0,e.length-1)}function ue(e){return e[e.length-1]}function le(e,n){let t=[],r=[];for(let o=0;o<e.length;o++){let i=e[o];n(i,o,e)?t.push(i):r.push(i)}return[t,r]}function se(...e){let n,t,r;e.length===1?(t=e[0],n=0,r=1):(n=e[0],t=e[1],r=e[2]||1),r<=0&&(console.warn("[tsu] warning: a step less than or equal to 0 will be set to 1."),r=1);let o=[],i=n;for(;i<t;)o.push(i),i+=r||1;return o}function ce(e){let n=m(e),t,r,o;for(t=n.length;t;t-=1)r=s(t),o=n[t-1],n[t-1]=n[r],n[r]=o;return n}function ae(e,n){return e<=0?[[],[...n]]:e>n.length?[[...n],[]]:[n.slice(0,e),n.slice(e)]}function fe(e){return e.slice(1)}function me(e,n){return e<=0?[]:n.slice(0,e)}function pe(e){return e?Array.isArray(e)?e:[e]:[]}function T(e){return Array.from(new Set(e))}function be(e){let n=document.createElement("textarea");n.value=e??"",n.style.position="absolute",n.style.opacity="0",document.body.appendChild(n),n.select(),document.execCommand("copy"),n.remove()}function de(e){p()&&(window.navigator&&"clipboard"in window.navigator?navigator.clipboard.writeText(e):be(e))}function xe({to:e,offset:n=0,duration:t=1e3,container:r=null}){let o=b(e)?document.querySelector(e):e,i=b(r)?document.querySelector(r):r,u=i?.scrollTop||window?.pageYOffset||0,g=(x(o)?o:ye(o,u))+n,A=Date.now();function y(){let h=Date.now()-A,w=h<t,v=w?ge(u,g,h,t):g;w&&requestAnimationFrame(y),i?i.scrollTop=v:window.scrollTo(0,v)}y()}function Te(e){return e<.5?4*Math.pow(e,3):(e-1)*(2*e-2)*(2*e-2)+1}function ge(e,n,t,r){return e+(n-e)*Te(t/r)}function ye(e,n){return e.nodeName==="HTML"?-n:e.getBoundingClientRect().top+n}function he(e,n){n<0&&console.warn("[tsu] warning: a debounce delay less than 0ms will be treated as 0ms.");let t;return function(...r){clearTimeout(t),t=setTimeout(()=>{clearTimeout(t),e(...r)},n)}}function we(e){let n={};return function(...t){let r=JSON.stringify(t);if(r in n)return n[r];let o=e(...t);return n[r]=o,o}}function ve(e){let n=!1;return(...t)=>{n||(e(...t),n=!0)}}function je(e,n){n<0&&console.warn("[tsu] warning: a throttle limit less than 0ms will be treated as 0ms.");let t=!1;return function(...r){t||(e(...r),t=!0,setTimeout(()=>{t=!1},n))}}function O(...e){let n={};for(let t=0;t<e.length;t++){let r=e[t],o=Object.keys(r);for(let i=0;i<o.length;i++){let u=o[i];l(n[u])&&l(r[u])?n[u]=T(n[u].concat(r[u])):a(n[u])&&a(r[u])?n[u]=O(n[u],r[u]):n[u]=r[u]}}return n}function ke(e,n=!1,t=" "){return n?e.split(t).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join(t):e.charAt(0).toUpperCase()+e.slice(1)}function Oe(e){return e.split("")}function Ae(e){return e.trim().length===0}function Ce(e){return e.length===0}function Ne(e,n,t){return n<0||n>e.length-1?e:e.slice(0,n)+t+e.slice(n+1)}function Ue(e,n){return n<=0?["",e]:n>e.length?[e,""]:[e.slice(0,n),e.slice(n)]}function Me(e){let n=/-(\w)/g;return e.replace(n,(t,r)=>r?r.toUpperCase():"")}function Ee(e){let n=/\B([A-Z])/g;return e.replace(n,"-$1").toLowerCase()}function Se(e){return e.length?Number(e.replace(/[#£€$,%]/g,"")):NaN}function Fe(e){let t=["st","nd","rd"][(e/10%10^1&&e%10)-1]||"th";return`${e}${t}`}function Ie(e,n,t="..."){return n<=0?t:e.slice(0,n)+t}0&&(module.exports={capitalise,ceil,chars,clamp,clone,copyToClipboard,debounce,deepMerge,drop,floor,groupsOf,head,init,isArray,isBlank,isBoolean,isBrowser,isDefined,isEmpty,isEmptyArray,isEmptyObject,isEven,isFunction,isNull,isNumber,isObject,isObjectLike,isOdd,isString,isTouchDevice,isUndefined,isWindow,last,max,memoize,min,noop,once,partition,product,randomChance,randomNumber,range,replaceChar,round,scroll,shuffle,sleep,splitAt,splitStrAt,sum,tail,take,throttle,toArray,toCamel,toKebab,toNumber,toOrdinal,toRomanNumerals,truncate,uniq,uuid});
|
package/dist/index.d.cts
CHANGED
|
@@ -106,6 +106,12 @@ declare function toArray<T>(maybeArray: Nullable<Arrayable<T>>): T[];
|
|
|
106
106
|
*/
|
|
107
107
|
declare function uniq<T>(array: readonly T[]): T[];
|
|
108
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Copies the provided string to the user's clipboard.
|
|
111
|
+
*
|
|
112
|
+
* @param str - The string to be copied to the clipboard.
|
|
113
|
+
*/
|
|
114
|
+
declare function copyToClipboard(str: string): void;
|
|
109
115
|
interface ScrollConfig {
|
|
110
116
|
to: Element | string | number;
|
|
111
117
|
offset?: number;
|
|
@@ -180,7 +186,14 @@ declare function isBrowser(): boolean;
|
|
|
180
186
|
* @param val - The value.
|
|
181
187
|
* @returns If the value is defined.
|
|
182
188
|
*/
|
|
183
|
-
declare function isDefined<T
|
|
189
|
+
declare function isDefined<T>(val: T): val is T;
|
|
190
|
+
/**
|
|
191
|
+
* Identifies if a value is an empty array.
|
|
192
|
+
*
|
|
193
|
+
* @param val - The value.
|
|
194
|
+
* @returns If the value is an empty array.
|
|
195
|
+
*/
|
|
196
|
+
declare function isEmptyArray(val: unknown): val is [];
|
|
184
197
|
/**
|
|
185
198
|
* Identifies if a value is an empty object.
|
|
186
199
|
*
|
|
@@ -236,6 +249,13 @@ declare function isString(val: unknown): val is string;
|
|
|
236
249
|
* @returns If the code is being run on a touch device.
|
|
237
250
|
*/
|
|
238
251
|
declare function isTouchDevice(): boolean;
|
|
252
|
+
/**
|
|
253
|
+
* Identifies if a value is undefined.
|
|
254
|
+
*
|
|
255
|
+
* @param val - The value.
|
|
256
|
+
* @returns If the value is undefined.
|
|
257
|
+
*/
|
|
258
|
+
declare function isUndefined(val: unknown): val is undefined;
|
|
239
259
|
/**
|
|
240
260
|
* Identifies if a value is the global window.
|
|
241
261
|
*
|
|
@@ -335,6 +355,14 @@ declare function round(n: number, factor?: number): number;
|
|
|
335
355
|
* @returns The sum.
|
|
336
356
|
*/
|
|
337
357
|
declare function sum(ns: readonly number[]): number;
|
|
358
|
+
/**
|
|
359
|
+
* Converts a given number to Roman numerals.
|
|
360
|
+
*
|
|
361
|
+
* @param n - The number to convert to Roman numerals.
|
|
362
|
+
* @param lowerCase - If the numerals should be in lowercase.
|
|
363
|
+
* @returns - The Roman numeral representation of the given number.
|
|
364
|
+
*/
|
|
365
|
+
declare function toRomanNumerals(n: number, lowerCase?: boolean): string;
|
|
338
366
|
|
|
339
367
|
/**
|
|
340
368
|
* Deep clones an array or object.
|
|
@@ -403,14 +431,23 @@ declare function isBlank(str: string): boolean;
|
|
|
403
431
|
* @returns If the string is empty.
|
|
404
432
|
*/
|
|
405
433
|
declare function isEmpty(str: string): boolean;
|
|
434
|
+
/**
|
|
435
|
+
* Replaces a character at a specified index in a string with a new character.
|
|
436
|
+
*
|
|
437
|
+
* @param str - The string.
|
|
438
|
+
* @param i - The index of the character to replace.
|
|
439
|
+
* @param char - The character to replace with.
|
|
440
|
+
* @returns - The modified string with the character replaced.
|
|
441
|
+
*/
|
|
442
|
+
declare function replaceChar(str: string, i: number, char: string): string;
|
|
406
443
|
/**
|
|
407
444
|
* Splits a string into two at a specified index.
|
|
408
445
|
*
|
|
409
|
-
* @param i - The position to split at.
|
|
410
446
|
* @param str - The string.
|
|
447
|
+
* @param i - The position to split at.
|
|
411
448
|
* @returns The tuple of strings before and after the split.
|
|
412
449
|
*/
|
|
413
|
-
declare function splitStrAt(
|
|
450
|
+
declare function splitStrAt(str: string, i: number): [string, string];
|
|
414
451
|
/**
|
|
415
452
|
* Converts a kebab case string to camel case.
|
|
416
453
|
*
|
|
@@ -449,4 +486,4 @@ declare function toOrdinal(n: number): string;
|
|
|
449
486
|
*/
|
|
450
487
|
declare function truncate(str: string, length: number, suffix?: string): string;
|
|
451
488
|
|
|
452
|
-
export { type Arrayable, type Fn, type Nullable, type Obj, type VoidFn, capitalise, ceil, chars, clamp, clone, debounce, deepMerge, drop, floor, groupsOf, head, init, isArray, isBlank, isBoolean, isBrowser, isDefined, isEmpty, isEmptyObject, isEven, isFunction, isNull, isNumber, isObject, isObjectLike, isOdd, isString, isTouchDevice, isWindow, last, max, memoize, min, noop, once, partition, product, randomChance, randomNumber, range, round, scroll, shuffle, sleep, splitAt, splitStrAt, sum, tail, take, throttle, toArray, toCamel, toKebab, toNumber, toOrdinal, truncate, uniq, uuid };
|
|
489
|
+
export { type Arrayable, type Fn, type Nullable, type Obj, type VoidFn, capitalise, ceil, chars, clamp, clone, copyToClipboard, debounce, deepMerge, drop, floor, groupsOf, head, init, isArray, isBlank, isBoolean, isBrowser, isDefined, isEmpty, isEmptyArray, isEmptyObject, isEven, isFunction, isNull, isNumber, isObject, isObjectLike, isOdd, isString, isTouchDevice, isUndefined, isWindow, last, max, memoize, min, noop, once, partition, product, randomChance, randomNumber, range, replaceChar, round, scroll, shuffle, sleep, splitAt, splitStrAt, sum, tail, take, throttle, toArray, toCamel, toKebab, toNumber, toOrdinal, toRomanNumerals, truncate, uniq, uuid };
|
package/dist/index.d.ts
CHANGED
|
@@ -106,6 +106,12 @@ declare function toArray<T>(maybeArray: Nullable<Arrayable<T>>): T[];
|
|
|
106
106
|
*/
|
|
107
107
|
declare function uniq<T>(array: readonly T[]): T[];
|
|
108
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Copies the provided string to the user's clipboard.
|
|
111
|
+
*
|
|
112
|
+
* @param str - The string to be copied to the clipboard.
|
|
113
|
+
*/
|
|
114
|
+
declare function copyToClipboard(str: string): void;
|
|
109
115
|
interface ScrollConfig {
|
|
110
116
|
to: Element | string | number;
|
|
111
117
|
offset?: number;
|
|
@@ -180,7 +186,14 @@ declare function isBrowser(): boolean;
|
|
|
180
186
|
* @param val - The value.
|
|
181
187
|
* @returns If the value is defined.
|
|
182
188
|
*/
|
|
183
|
-
declare function isDefined<T
|
|
189
|
+
declare function isDefined<T>(val: T): val is T;
|
|
190
|
+
/**
|
|
191
|
+
* Identifies if a value is an empty array.
|
|
192
|
+
*
|
|
193
|
+
* @param val - The value.
|
|
194
|
+
* @returns If the value is an empty array.
|
|
195
|
+
*/
|
|
196
|
+
declare function isEmptyArray(val: unknown): val is [];
|
|
184
197
|
/**
|
|
185
198
|
* Identifies if a value is an empty object.
|
|
186
199
|
*
|
|
@@ -236,6 +249,13 @@ declare function isString(val: unknown): val is string;
|
|
|
236
249
|
* @returns If the code is being run on a touch device.
|
|
237
250
|
*/
|
|
238
251
|
declare function isTouchDevice(): boolean;
|
|
252
|
+
/**
|
|
253
|
+
* Identifies if a value is undefined.
|
|
254
|
+
*
|
|
255
|
+
* @param val - The value.
|
|
256
|
+
* @returns If the value is undefined.
|
|
257
|
+
*/
|
|
258
|
+
declare function isUndefined(val: unknown): val is undefined;
|
|
239
259
|
/**
|
|
240
260
|
* Identifies if a value is the global window.
|
|
241
261
|
*
|
|
@@ -335,6 +355,14 @@ declare function round(n: number, factor?: number): number;
|
|
|
335
355
|
* @returns The sum.
|
|
336
356
|
*/
|
|
337
357
|
declare function sum(ns: readonly number[]): number;
|
|
358
|
+
/**
|
|
359
|
+
* Converts a given number to Roman numerals.
|
|
360
|
+
*
|
|
361
|
+
* @param n - The number to convert to Roman numerals.
|
|
362
|
+
* @param lowerCase - If the numerals should be in lowercase.
|
|
363
|
+
* @returns - The Roman numeral representation of the given number.
|
|
364
|
+
*/
|
|
365
|
+
declare function toRomanNumerals(n: number, lowerCase?: boolean): string;
|
|
338
366
|
|
|
339
367
|
/**
|
|
340
368
|
* Deep clones an array or object.
|
|
@@ -403,14 +431,23 @@ declare function isBlank(str: string): boolean;
|
|
|
403
431
|
* @returns If the string is empty.
|
|
404
432
|
*/
|
|
405
433
|
declare function isEmpty(str: string): boolean;
|
|
434
|
+
/**
|
|
435
|
+
* Replaces a character at a specified index in a string with a new character.
|
|
436
|
+
*
|
|
437
|
+
* @param str - The string.
|
|
438
|
+
* @param i - The index of the character to replace.
|
|
439
|
+
* @param char - The character to replace with.
|
|
440
|
+
* @returns - The modified string with the character replaced.
|
|
441
|
+
*/
|
|
442
|
+
declare function replaceChar(str: string, i: number, char: string): string;
|
|
406
443
|
/**
|
|
407
444
|
* Splits a string into two at a specified index.
|
|
408
445
|
*
|
|
409
|
-
* @param i - The position to split at.
|
|
410
446
|
* @param str - The string.
|
|
447
|
+
* @param i - The position to split at.
|
|
411
448
|
* @returns The tuple of strings before and after the split.
|
|
412
449
|
*/
|
|
413
|
-
declare function splitStrAt(
|
|
450
|
+
declare function splitStrAt(str: string, i: number): [string, string];
|
|
414
451
|
/**
|
|
415
452
|
* Converts a kebab case string to camel case.
|
|
416
453
|
*
|
|
@@ -449,4 +486,4 @@ declare function toOrdinal(n: number): string;
|
|
|
449
486
|
*/
|
|
450
487
|
declare function truncate(str: string, length: number, suffix?: string): string;
|
|
451
488
|
|
|
452
|
-
export { type Arrayable, type Fn, type Nullable, type Obj, type VoidFn, capitalise, ceil, chars, clamp, clone, debounce, deepMerge, drop, floor, groupsOf, head, init, isArray, isBlank, isBoolean, isBrowser, isDefined, isEmpty, isEmptyObject, isEven, isFunction, isNull, isNumber, isObject, isObjectLike, isOdd, isString, isTouchDevice, isWindow, last, max, memoize, min, noop, once, partition, product, randomChance, randomNumber, range, round, scroll, shuffle, sleep, splitAt, splitStrAt, sum, tail, take, throttle, toArray, toCamel, toKebab, toNumber, toOrdinal, truncate, uniq, uuid };
|
|
489
|
+
export { type Arrayable, type Fn, type Nullable, type Obj, type VoidFn, capitalise, ceil, chars, clamp, clone, copyToClipboard, debounce, deepMerge, drop, floor, groupsOf, head, init, isArray, isBlank, isBoolean, isBrowser, isDefined, isEmpty, isEmptyArray, isEmptyObject, isEven, isFunction, isNull, isNumber, isObject, isObjectLike, isOdd, isString, isTouchDevice, isUndefined, isWindow, last, max, memoize, min, noop, once, partition, product, randomChance, randomNumber, range, replaceChar, round, scroll, shuffle, sleep, splitAt, splitStrAt, sum, tail, take, throttle, toArray, toCamel, toKebab, toNumber, toOrdinal, toRomanNumerals, truncate, uniq, uuid };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function M(e,n=1){let t=e/n;return Math.ceil(t)*n}function E(e,n,t){return Math.min(t,Math.max(n,e))}function S(e,n=1){let t=e/n;return Math.floor(t)*n}function F(e){return e%2===0}function I(e){return e%2!==0}function L(...e){let n;return e.length===1&&Array.isArray(e[0])?n=e[0]:n=e,Math.max(...n)}function q(...e){let n;return e.length===1&&Array.isArray(e[0])?n=e[0]:n=e,Math.min(...n)}function R(e){let n=1;for(let t=0;t<e.length;t++)n*=e[t];return n}function V(e){return s(e)===0}function s(...e){let n,t;return e.length===1?(n=0,t=e[0]):(n=e[0],t=e[1]),Math.floor(Math.random()*(t-n))+n}function D(e,n=1){let t=e/n;return Math.round(t)*n}function B(e){let n=0;for(let t=0;t<e.length;t++)n+=e[t];return n}var h={1:"I",4:"IV",5:"V",9:"IX",10:"X",40:"XL",50:"L",90:"XC",100:"C",400:"CD",500:"D",900:"CM",1e3:"M"};function P(e,n=!1){let t=e,r="",o=Object.keys(h).map(Number).sort((i,u)=>u-i);for(let i of o)for(;t>=i;)r+=h[i],t-=i;return n?r.toLowerCase():r}function l(e){return Array.isArray(e)}function X(e){return typeof e=="boolean"}function p(){return typeof window<"u"}function H(e){return typeof e<"u"}function _(e){return l(e)&&e.length===0}function $(e){if(!a(e))return!1;for(let n in e)return!1;return!0}function z(e){return typeof e=="function"}function c(e){return Object.prototype.toString.call(e)==="[object Null]"}function w(e){return typeof e=="number"}function a(e){return Object.prototype.toString.call(e)==="[object Object]"}function f(e){return typeof e=="object"}function b(e){return typeof e=="string"}function J(){return"ontouchstart"in window||navigator.maxTouchPoints>0}function K(e){return typeof e>"u"}function Y(e){return p()&&Object.prototype.toString.call(e)==="[object Window]"}function m(e){if(l(e)){let n=[];for(let t=0;t<e.length;t++)f(e[t])&&!c(e[t])?n[t]=m(e[t]):n[t]=e[t];return n}if(f(e)&&!c(e)){let n={};for(let t in e)f(e[t])&&!c(e[t])?n[t]=m(e[t]):n[t]=e[t];return n}return e}function ee(){}async function ne(e){return e<0&&console.warn("[tsu] warning: a sleep duration less than 0ms will be treated as 0ms."),new Promise(n=>{setTimeout(n,e)})}var v="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";function te(e=16){let n=v.length,t=e,r="";for(;t--;)r+=v[s(n)];return r}function ue(e,n){return e<=0?[...n]:n.slice(e)}function le(e,n){if(e<=0)throw new Error("[tsu] Invalid group size. Is it greater than 0?");if(e>=n.length)return[[...n]];let t=[];for(let r=0;r<n.length;r+=e)t.push(n.slice(r,r+e));return t}function se(e){return e[0]}function ce(e){return e.slice(0,e.length-1)}function ae(e){return e[e.length-1]}function fe(e,n){let t=[],r=[];for(let o=0;o<e.length;o++){let i=e[o];n(i,o,e)?t.push(i):r.push(i)}return[t,r]}function me(...e){let n,t,r;e.length===1?(t=e[0],n=0,r=1):(n=e[0],t=e[1],r=e[2]||1),r<=0&&(console.warn("[tsu] warning: a step less than or equal to 0 will be set to 1."),r=1);let o=[],i=n;for(;i<t;)o.push(i),i+=r||1;return o}function pe(e){let n=m(e),t,r,o;for(t=n.length;t;t-=1)r=s(t),o=n[t-1],n[t-1]=n[r],n[r]=o;return n}function be(e,n){return e<=0?[[],[...n]]:e>n.length?[[...n],[]]:[n.slice(0,e),n.slice(e)]}function de(e){return e.slice(1)}function xe(e,n){return e<=0?[]:n.slice(0,e)}function Te(e){return e?Array.isArray(e)?e:[e]:[]}function j(e){return Array.from(new Set(e))}function O(e){let n=document.createElement("textarea");n.value=e??"",n.style.position="absolute",n.style.opacity="0",document.body.appendChild(n),n.select(),document.execCommand("copy"),n.remove()}function he(e){p()&&(window.navigator&&"clipboard"in window.navigator?navigator.clipboard.writeText(e):O(e))}function we({to:e,offset:n=0,duration:t=1e3,container:r=null}){let o=b(e)?document.querySelector(e):e,i=b(r)?document.querySelector(r):r,u=i?.scrollTop||window?.pageYOffset||0,d=(w(o)?o:N(o,u))+n,k=Date.now();function x(){let T=Date.now()-k,g=T<t,y=g?C(u,d,T,t):d;g&&requestAnimationFrame(x),i?i.scrollTop=y:window.scrollTo(0,y)}x()}function A(e){return e<.5?4*Math.pow(e,3):(e-1)*(2*e-2)*(2*e-2)+1}function C(e,n,t,r){return e+(n-e)*A(t/r)}function N(e,n){return e.nodeName==="HTML"?-n:e.getBoundingClientRect().top+n}function je(e,n){n<0&&console.warn("[tsu] warning: a debounce delay less than 0ms will be treated as 0ms.");let t;return function(...r){clearTimeout(t),t=setTimeout(()=>{clearTimeout(t),e(...r)},n)}}function ke(e){let n={};return function(...t){let r=JSON.stringify(t);if(r in n)return n[r];let o=e(...t);return n[r]=o,o}}function Oe(e){let n=!1;return(...t)=>{n||(e(...t),n=!0)}}function Ae(e,n){n<0&&console.warn("[tsu] warning: a throttle limit less than 0ms will be treated as 0ms.");let t=!1;return function(...r){t||(e(...r),t=!0,setTimeout(()=>{t=!1},n))}}function U(...e){let n={};for(let t=0;t<e.length;t++){let r=e[t],o=Object.keys(r);for(let i=0;i<o.length;i++){let u=o[i];l(n[u])&&l(r[u])?n[u]=j(n[u].concat(r[u])):a(n[u])&&a(r[u])?n[u]=U(n[u],r[u]):n[u]=r[u]}}return n}function Ee(e,n=!1,t=" "){return n?e.split(t).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join(t):e.charAt(0).toUpperCase()+e.slice(1)}function Se(e){return e.split("")}function Fe(e){return e.trim().length===0}function Ie(e){return e.length===0}function Le(e,n,t){return n<0||n>e.length-1?e:e.slice(0,n)+t+e.slice(n+1)}function qe(e,n){return n<=0?["",e]:n>e.length?[e,""]:[e.slice(0,n),e.slice(n)]}function Re(e){let n=/-(\w)/g;return e.replace(n,(t,r)=>r?r.toUpperCase():"")}function Ve(e){let n=/\B([A-Z])/g;return e.replace(n,"-$1").toLowerCase()}function De(e){return e.length?Number(e.replace(/[#£€$,%]/g,"")):NaN}function Be(e){let t=["st","nd","rd"][(e/10%10^1&&e%10)-1]||"th";return`${e}${t}`}function Pe(e,n,t="..."){return n<=0?t:e.slice(0,n)+t}export{Ee as capitalise,M as ceil,Se as chars,E as clamp,m as clone,he as copyToClipboard,je as debounce,U as deepMerge,ue as drop,S as floor,le as groupsOf,se as head,ce as init,l as isArray,Fe as isBlank,X as isBoolean,p as isBrowser,H as isDefined,Ie as isEmpty,_ as isEmptyArray,$ as isEmptyObject,F as isEven,z as isFunction,c as isNull,w as isNumber,a as isObject,f as isObjectLike,I as isOdd,b as isString,J as isTouchDevice,K as isUndefined,Y as isWindow,ae as last,L as max,ke as memoize,q as min,ee as noop,Oe as once,fe as partition,R as product,V as randomChance,s as randomNumber,me as range,Le as replaceChar,D as round,we as scroll,pe as shuffle,ne as sleep,be as splitAt,qe as splitStrAt,B as sum,de as tail,xe as take,Ae as throttle,Te as toArray,Re as toCamel,Ve as toKebab,De as toNumber,Be as toOrdinal,P as toRomanNumerals,Pe as truncate,j as uniq,te as uuid};
|