@tolki/str 1.0.4 → 1.0.6

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/str.js CHANGED
@@ -1,14 +1,17 @@
1
- import { substr as x, ltrim as I, rtrim as q, randomInt as O, title as G, trim as K, upper as Z, randomString as D } from "@tolki/str";
2
- import { isArray as S, toLower as W, isString as _, isFunction as Q, isNumber as V } from "@tolki/utils";
1
+ import { isArray as x, toLower as W, isString as _, isFunction as K, isNumber as Z } from "@tolki/utils";
2
+ import { title as I, upper as D } from "./convertcase/index.js";
3
+ import { randomInt as O, randomString as Q } from "./random/index.js";
4
+ import { substr as S } from "./replacer/index.js";
5
+ import { ltrim as q, rtrim as G, trim as V } from "./trimmer/index.js";
3
6
  const R = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Map(), F = /* @__PURE__ */ new Map();
4
- let E = null;
7
+ let L = null;
5
8
  function T(t, e) {
6
9
  if (e === "")
7
10
  return t;
8
11
  const n = String(e), r = t.indexOf(n);
9
12
  return r === -1 ? t : t.slice(r + n.length);
10
13
  }
11
- function at(t, e) {
14
+ function gt(t, e) {
12
15
  if (e === "")
13
16
  return t;
14
17
  const n = t.lastIndexOf(String(e));
@@ -24,34 +27,34 @@ function Y(t, e) {
24
27
  if (e === "")
25
28
  return t;
26
29
  const n = t.lastIndexOf(String(e));
27
- return n === -1 ? t : x(t, 0, n);
30
+ return n === -1 ? t : S(t, 0, n);
28
31
  }
29
- function ut(t, e, n) {
32
+ function mt(t, e, n) {
30
33
  return e === "" || n === "" ? t : Y(T(t, e), n);
31
34
  }
32
- function pt(t, e, n) {
35
+ function ht(t, e, n) {
33
36
  return e === "" || n === "" ? t : X(T(t, e), n);
34
37
  }
35
- function gt(t) {
38
+ function dt(t) {
36
39
  if (C.has(t))
37
40
  return C.get(t);
38
- const e = st(H(t));
41
+ const e = st(J(t));
39
42
  return C.set(t, e), e;
40
43
  }
41
- function mt(t, e) {
44
+ function yt(t, e) {
42
45
  const n = t.length;
43
46
  return (e < 0 ? e < -n : e > n - 1) ? !1 : (e < 0 && (e += n), t.charAt(e));
44
47
  }
45
- function ht(t, e) {
46
- for (const n of S(e) ? e : [e])
48
+ function wt(t, e) {
49
+ for (const n of x(e) ? e : [e])
47
50
  if (n !== "" && t.startsWith(n)) {
48
51
  const r = [...t], s = [...n];
49
52
  return r.slice(s.length).join("");
50
53
  }
51
54
  return t;
52
55
  }
53
- function dt(t, e) {
54
- for (const n of S(e) ? e : [e])
56
+ function xt(t, e) {
57
+ for (const n of x(e) ? e : [e])
55
58
  if (n !== "" && t.endsWith(n)) {
56
59
  const r = [...t], s = [...n];
57
60
  return r.slice(0, -s.length).join("");
@@ -67,54 +70,54 @@ function B(t, e, n = !1) {
67
70
  return !0;
68
71
  return !1;
69
72
  }
70
- function yt(t, e = "", n = {}) {
73
+ function St(t, e = "", n = {}) {
71
74
  const { radius: r = 100, omission: s = "..." } = n, o = String(t ?? ""), c = e ?? "", i = ($) => $.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), l = new RegExp(`^(.*?)(${i(c)})(.*)$`, "iu").exec(o);
72
75
  if (!l)
73
76
  return null;
74
- const m = String(l[1]), a = String(l[2]), p = String(l[3]), u = I(m), g = Array.from(u).length, y = x(u, Math.max(g - r, 0), r);
75
- let w = I(y);
77
+ const p = String(l[1]), a = String(l[2]), g = String(l[3]), u = q(p), m = Array.from(u).length, y = S(u, Math.max(m - r, 0), r);
78
+ let w = q(y);
76
79
  w !== u && (w = s + w);
77
- const h = q(p), d = x(h, 0, r);
78
- let k = q(d);
80
+ const h = G(g), d = S(h, 0, r);
81
+ let k = G(d);
79
82
  return k !== h && (k = k + s), w + a + k;
80
83
  }
81
- function wt(t, e, n = !1) {
84
+ function $t(t, e, n = !1) {
82
85
  for (const r of e)
83
86
  if (!B(t, r, n))
84
87
  return !1;
85
88
  return !0;
86
89
  }
87
- function xt(t, e, n = !1) {
90
+ function kt(t, e, n = !1) {
88
91
  return !B(t, e, n);
89
92
  }
90
- function St(t, e = " ") {
91
- return S(e) ? (e.forEach((n) => {
93
+ function At(t, e = " ") {
94
+ return x(e) ? (e.forEach((n) => {
92
95
  t = t.replace(new RegExp(`${n}+`, "g"), n);
93
96
  }), t) : t.replace(new RegExp(`${e}+`, "g"), e);
94
97
  }
95
98
  function M(t, e) {
96
99
  if (t === null)
97
100
  return !1;
98
- t = String(t), S(e) ? e = Array.from(e) : e = [String(e)];
101
+ t = String(t), x(e) ? e = Array.from(e) : e = [String(e)];
99
102
  for (const n of e)
100
103
  if (n !== "" && t.endsWith(n))
101
104
  return !0;
102
105
  return !1;
103
106
  }
104
- function $t(t, e) {
107
+ function bt(t, e) {
105
108
  return !M(t, e);
106
109
  }
107
- function kt(t, e) {
110
+ function Et(t, e) {
108
111
  const n = e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
109
112
  return t.replace(new RegExp(`(?:${n})+$`, "u"), "") + e;
110
113
  }
111
- function At(t, e, n = null) {
114
+ function Lt(t, e, n = null) {
112
115
  return e + t + (n ?? e);
113
116
  }
114
- function bt(t, e, n = null) {
115
- return P(t, e) && (t = x(t, N(e))), M(t, n ??= e) && (t = x(t, 0, -N(n))), t;
117
+ function Rt(t, e, n = null) {
118
+ return U(t, e) && (t = S(t, z(e))), M(t, n ??= e) && (t = S(t, 0, -z(n))), t;
116
119
  }
117
- function Lt(t, e, n = !1) {
120
+ function Ct(t, e, n = !1) {
118
121
  e = String(e);
119
122
  let r;
120
123
  typeof t == "string" ? r = [t] : r = Array.from(t);
@@ -128,13 +131,13 @@ function Lt(t, e, n = !1) {
128
131
  }
129
132
  return !1;
130
133
  }
131
- function Et(t) {
134
+ function Ft(t) {
132
135
  for (let e = 0; e < t.length; e++)
133
136
  if (t.charCodeAt(e) > 127)
134
137
  return !1;
135
138
  return !0;
136
139
  }
137
- function Rt(t) {
140
+ function zt(t) {
138
141
  if (!_(t))
139
142
  return !1;
140
143
  try {
@@ -144,13 +147,13 @@ function Rt(t) {
144
147
  }
145
148
  return !0;
146
149
  }
147
- function Ct(t, e = []) {
150
+ function Nt(t, e = []) {
148
151
  if (!_(t))
149
152
  return !1;
150
153
  const r = (e.length === 0 ? "aaa|aaas|about|acap|acct|acd|acr|adiumxtra|adt|afp|afs|aim|amss|android|appdata|apt|ark|attachment|aw|barion|beshare|bitcoin|bitcoincash|blob|bolo|browserext|calculator|callto|cap|cast|casts|chrome|chrome-extension|cid|coap|coap+tcp|coap+ws|coaps|coaps+tcp|coaps+ws|com-eventbrite-attendee|content|conti|crid|cvs|dab|data|dav|diaspora|dict|did|dis|dlna-playcontainer|dlna-playsingle|dns|dntp|dpp|drm|drop|dtn|dvb|ed2k|elsi|example|facetime|fax|feed|feedready|file|filesystem|finger|first-run-pen-experience|fish|fm|ftp|fuchsia-pkg|geo|gg|git|gizmoproject|go|gopher|graph|gtalk|h323|ham|hcap|hcp|http|https|hxxp|hxxps|hydrazone|iax|icap|icon|im|imap|info|iotdisco|ipn|ipp|ipps|irc|irc6|ircs|iris|iris.beep|iris.lwz|iris.xpc|iris.xpcs|isostore|itms|jabber|jar|jms|keyparc|lastfm|ldap|ldaps|leaptofrogans|lorawan|lvlt|magnet|mailserver|mailto|maps|market|message|mid|mms|modem|mongodb|moz|ms-access|ms-browser-extension|ms-calculator|ms-drive-to|ms-enrollment|ms-excel|ms-eyecontrolspeech|ms-gamebarservices|ms-gamingoverlay|ms-getoffice|ms-help|ms-infopath|ms-inputapp|ms-lockscreencomponent-config|ms-media-stream-id|ms-mixedrealitycapture|ms-mobileplans|ms-officeapp|ms-people|ms-project|ms-powerpoint|ms-publisher|ms-restoretabcompanion|ms-screenclip|ms-screensketch|ms-search|ms-search-repair|ms-secondary-screen-controller|ms-secondary-screen-setup|ms-settings|ms-settings-airplanemode|ms-settings-bluetooth|ms-settings-camera|ms-settings-cellular|ms-settings-cloudstorage|ms-settings-connectabledevices|ms-settings-displays-topology|ms-settings-emailandaccounts|ms-settings-language|ms-settings-location|ms-settings-lock|ms-settings-nfctransactions|ms-settings-notifications|ms-settings-power|ms-settings-privacy|ms-settings-proximity|ms-settings-screenrotation|ms-settings-wifi|ms-settings-workplace|ms-spd|ms-sttoverlay|ms-transit-to|ms-useractivityset|ms-virtualtouchpad|ms-visio|ms-walk-to|ms-whiteboard|ms-whiteboard-cmd|ms-word|msnim|msrp|msrps|mss|mtqp|mumble|mupdate|mvn|news|nfs|ni|nih|nntp|notes|ocf|oid|onenote|onenote-cmd|opaquelocktoken|openpgp4fpr|pack|palm|paparazzi|payto|pkcs11|platform|pop|pres|prospero|proxy|pwid|psyc|pttp|qb|query|redis|rediss|reload|res|resource|rmi|rsync|rtmfp|rtmp|rtsp|rtsps|rtspu|s3|secondlife|service|session|sftp|sgn|shttp|sieve|simpleledger|sip|sips|skype|smb|sms|smtp|snews|snmp|soap.beep|soap.beeps|soldat|spiffe|spotify|ssh|steam|stun|stuns|submit|svn|tag|teamspeak|tel|teliaeid|telnet|tftp|tg|things|thismessage|tip|tn3270|tool|ts3server|turn|turns|tv|udp|unreal|urn|ut2004|v-event|vemmi|ventrilo|videotex|vnc|view-source|wais|webcal|wpid|ws|wss|wtai|wyciwyg|xcon|xcon-userid|xfire|xmlrpc.beep|xmlrpc.beeps|xmpp|xri|ymsgr|z39.50|z39.50r|z39.50s" : e.join("|")).split("|").map((o) => o.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
151
154
  try {
152
- const c = new URL(t).protocol.replace(":", "");
153
- if (r.split("|").includes(c))
155
+ const o = new URL(t), c = o.protocol.replace(":", ""), i = o.hostname, l = t.slice(t.indexOf("://") + 3).startsWith("/"), p = i.length > 0 && !/^\.+$/.test(i) && !l, a = c === "file" && l;
156
+ if (r.split("|").includes(c) && (p || a))
154
157
  return !0;
155
158
  } catch {
156
159
  }
@@ -160,7 +163,7 @@ function Ct(t, e = []) {
160
163
  "):\\/\\/",
161
164
  "(?:((?:[_.\\p{L}\\p{N}-]|%[0-9A-Fa-f]{2})+:)?((?:[_.\\p{L}\\p{N}-]|%[0-9A-Fa-f]{2})+)@)?",
162
165
  "(",
163
- "(?:[\\p{L}\\p{N}\\p{S}_\\.-]+(?:\\.?([\\p{L}\\p{N}]|xn--[\\p{L}\\p{N}-]+)+\\.?)",
166
+ "(?:(?:xn--[a-z0-9-]+\\.)*xn--[a-z0-9-]+|(?:[\\p{L}\\p{N}\\p{S}\\p{M}_-]+\\.)+[\\p{L}\\p{N}\\p{M}]+|[a-z0-9_-]+)\\.?",
164
167
  "|",
165
168
  "(?:\\d{1,3}\\.){3}\\d{1,3}",
166
169
  "|",
@@ -172,19 +175,15 @@ function Ct(t, e = []) {
172
175
  '(?:#(?:[\\p{L}\\p{N}\\-._~!$&"()*,;=:@/?]|%[0-9A-Fa-f]{2})*)?',
173
176
  "$"
174
177
  ].join("");
175
- try {
176
- return new RegExp(s, "iu").test(t);
177
- } catch {
178
- return !1;
179
- }
178
+ return new RegExp(s, "iu").test(t);
180
179
  }
181
- function Ft(t) {
180
+ function _t(t) {
182
181
  return rt(t, "-");
183
182
  }
184
- function N(t) {
183
+ function z(t) {
185
184
  return t.length;
186
185
  }
187
- function Nt(t, e = 100, n = "...", r = !1) {
186
+ function Ot(t, e = 100, n = "...", r = !1) {
188
187
  if (t.length <= e)
189
188
  return t;
190
189
  if (!r)
@@ -193,16 +192,16 @@ function Nt(t, e = 100, n = "...", r = !1) {
193
192
  const s = t.slice(0, e).replace(/\s+$/, "");
194
193
  return t.substring(e, e + 1) === " " ? s + n : s.replace(/(.*)\s.*/, "$1") + n;
195
194
  }
196
- function J(t) {
195
+ function H(t) {
197
196
  return W(t);
198
197
  }
199
- function zt(t, e = 100, n = "...") {
198
+ function Wt(t, e = 100, n = "...") {
200
199
  if (e <= 0)
201
200
  return t;
202
201
  const r = e, s = new RegExp(`^\\s*(?:\\S+\\s*){1,${r}}`, "u"), o = t.match(s);
203
- return !o || N(t) === N(o[0]) ? t : o[0].trimEnd() + n;
202
+ return !o || z(t) === z(o[0]) ? t : o[0].trimEnd() + n;
204
203
  }
205
- function _t(t, e, n, r = null) {
204
+ function Mt(t, e, n, r = null) {
206
205
  if (e === "")
207
206
  return t;
208
207
  const s = t.length;
@@ -217,7 +216,7 @@ function _t(t, e, n, r = null) {
217
216
  const i = t.slice(0, o), f = c.length, l = t.slice(o + f);
218
217
  return i + e.slice(0, 1).repeat(f) + l;
219
218
  }
220
- function Ot(t, e) {
219
+ function Ut(t, e) {
221
220
  let n = "u", r = t;
222
221
  if (t.length >= 2 && t[0] === "/") {
223
222
  let s = -1;
@@ -246,7 +245,7 @@ function Ot(t, e) {
246
245
  return "";
247
246
  }
248
247
  }
249
- function Wt(t, e) {
248
+ function Pt(t, e) {
250
249
  e = String(e);
251
250
  const n = typeof t == "string" ? [t] : Array.from(t);
252
251
  for (const r of n) {
@@ -280,7 +279,7 @@ function Wt(t, e) {
280
279
  }
281
280
  return !1;
282
281
  }
283
- function Mt(t, e) {
282
+ function It(t, e) {
284
283
  let n = "u", r = t;
285
284
  if (t.length >= 2 && t[0] === "/") {
286
285
  let o = -1;
@@ -314,37 +313,37 @@ function Mt(t, e) {
314
313
  }
315
314
  return s;
316
315
  }
317
- function Pt(t) {
318
- return S(t) ? t.map((e) => e.replace(/[^0-9]/g, "")) : t.replace(/[^0-9]/g, "");
316
+ function qt(t) {
317
+ return x(t) ? t.map((e) => e.replace(/[^0-9]/g, "")) : t.replace(/[^0-9]/g, "");
319
318
  }
320
- function Ut(t, e, n = " ") {
319
+ function Gt(t, e, n = " ") {
321
320
  const r = t.length;
322
321
  if (e <= r || n === "")
323
322
  return t;
324
323
  const s = e - r, o = Math.floor(s / 2), c = s - o;
325
- return z(n, o) + t + z(n, c);
324
+ return N(n, o) + t + N(n, c);
326
325
  }
327
- function It(t, e, n = " ") {
326
+ function Tt(t, e, n = " ") {
328
327
  const r = t.length;
329
328
  if (e <= r || n === "")
330
329
  return t;
331
330
  const o = e - r;
332
- return z(n, o) + t;
331
+ return N(n, o) + t;
333
332
  }
334
- function qt(t, e, n = " ") {
333
+ function Bt(t, e, n = " ") {
335
334
  const r = t.length;
336
335
  if (e <= r || n === "")
337
336
  return t;
338
337
  const o = e - r;
339
- return t + z(n, o);
338
+ return t + N(n, o);
340
339
  }
341
- function z(t, e) {
340
+ function N(t, e) {
342
341
  if (e <= 0 || t.length === 0)
343
342
  return "";
344
343
  const n = Math.ceil(e / t.length);
345
344
  return t.repeat(n).slice(0, e);
346
345
  }
347
- function Gt(t = 32, e = !0, n = !0, r = !0, s = !1) {
346
+ function Ht(t = 32, e = !0, n = !0, r = !0, s = !1) {
348
347
  const l = [
349
348
  e ? [
350
349
  "a",
@@ -430,26 +429,26 @@ function Gt(t = 32, e = !0, n = !0, r = !0, s = !1) {
430
429
  ";"
431
430
  ] : null,
432
431
  s ? [" "] : null
433
- ].filter((u) => S(u));
432
+ ].filter((u) => x(u));
434
433
  if (l.length === 0 || t <= 0)
435
434
  return "";
436
- const m = [];
435
+ const p = [];
437
436
  for (const u of l) {
438
- const g = O(0, u.length - 1);
439
- m.push(u[g]);
437
+ const m = O(0, u.length - 1);
438
+ p.push(u[m]);
440
439
  }
441
- const a = Math.max(0, t - m.length), p = l.flat();
440
+ const a = Math.max(0, t - p.length), g = l.flat();
442
441
  for (let u = 0; u < a; u++) {
443
- const g = O(0, p.length - 1);
444
- m.push(p[g]);
442
+ const m = O(0, g.length - 1);
443
+ p.push(g[m]);
445
444
  }
446
- for (let u = m.length - 1; u > 0; u--) {
447
- const g = O(0, u), y = m[u];
448
- m[u] = m[g], m[g] = y;
445
+ for (let u = p.length - 1; u > 0; u--) {
446
+ const m = O(0, u), y = p[u];
447
+ p[u] = p[m], p[m] = y;
449
448
  }
450
- return m.join("");
449
+ return p.join("");
451
450
  }
452
- function Tt(t, e, n = 0) {
451
+ function Jt(t, e, n = 0) {
453
452
  if (e === "")
454
453
  return !1;
455
454
  const r = Array.from(t), s = Array.from(e);
@@ -470,30 +469,30 @@ function Tt(t, e, n = 0) {
470
469
  return !1;
471
470
  }
472
471
  function j(t = 16) {
473
- return (E ?? ((n) => D(n)))(t);
472
+ return (L ?? ((n) => Q(n)))(t);
474
473
  }
475
474
  function v(t) {
476
- E = t;
475
+ L = t;
477
476
  }
478
- function Bt(t, e) {
477
+ function Kt(t, e) {
479
478
  let n = 0;
480
479
  const r = e ?? function(s) {
481
- const o = E;
482
- E = null;
480
+ const o = L;
481
+ L = null;
483
482
  const c = j(s);
484
- return E = o, n++, c;
483
+ return L = o, n++, c;
485
484
  };
486
485
  v((s) => n < t.length ? String(t[n++]) : r(s));
487
486
  }
488
- function Jt() {
489
- E = null;
487
+ function Zt() {
488
+ L = null;
490
489
  }
491
- function Ht(t, e) {
490
+ function Dt(t, e) {
492
491
  return e <= 0 ? "" : t.repeat(e);
493
492
  }
494
- function Kt(t, e, n) {
493
+ function Qt(t, e, n) {
495
494
  let r;
496
- typeof e == "object" && !S(e) ? r = Object.values(e) : r = S(e) ? [...e] : Array.from(e);
495
+ typeof e == "object" && !x(e) ? r = Object.values(e) : r = x(e) ? [...e] : Array.from(e);
497
496
  const s = n.split(t);
498
497
  if (s.length === 1)
499
498
  return n;
@@ -504,7 +503,7 @@ function Kt(t, e, n) {
504
503
  }
505
504
  return String(o);
506
505
  }
507
- function Zt(t, e) {
506
+ function Vt(t, e) {
508
507
  try {
509
508
  const n = String(t);
510
509
  if (n.length)
@@ -514,14 +513,14 @@ function Zt(t, e) {
514
513
  return e;
515
514
  }
516
515
  }
517
- function Dt(t, e, n, r = !0) {
518
- const s = (l) => typeof l == "string" ? [l] : Array.from(l), o = s(t), c = s(e), i = (l) => l.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), f = (l) => o.reduce((m, a, p) => {
519
- if (a === "") return m;
520
- const u = c[p] ?? "";
516
+ function Xt(t, e, n, r = !0) {
517
+ const s = (l) => typeof l == "string" ? [l] : Array.from(l), o = s(t), c = s(e), i = (l) => l.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), f = (l) => o.reduce((p, a, g) => {
518
+ if (a === "") return p;
519
+ const u = c[g] ?? "";
521
520
  if (!r)
522
- return m.split(a).join(u);
523
- const g = new RegExp(i(a), "gi");
524
- return m.replace(g, () => u);
521
+ return p.split(a).join(u);
522
+ const m = new RegExp(i(a), "gi");
523
+ return p.replace(m, () => u);
525
524
  }, l);
526
525
  return _(n) ? f(n) : Array.from(n).map(f);
527
526
  }
@@ -531,8 +530,8 @@ function tt(t, e, n) {
531
530
  const r = n.indexOf(t);
532
531
  return r !== -1 ? n.slice(0, r) + e + n.slice(r + t.length) : n;
533
532
  }
534
- function Qt(t, e, n) {
535
- return t = String(t), t === "" ? n : P(n, t) ? tt(t, e, n) : n;
533
+ function Yt(t, e, n) {
534
+ return t = String(t), t === "" ? n : U(n, t) ? tt(t, e, n) : n;
536
535
  }
537
536
  function et(t, e, n) {
538
537
  if (t = String(t), t === "")
@@ -540,40 +539,40 @@ function et(t, e, n) {
540
539
  const r = n.lastIndexOf(t);
541
540
  return r !== -1 ? n.slice(0, r) + e + n.slice(r + t.length) : n;
542
541
  }
543
- function Vt(t, e, n) {
542
+ function jt(t, e, n) {
544
543
  return t = String(t), t === "" ? n : M(n, t) ? et(t, e, n) : n;
545
544
  }
546
- function Xt(t, e, n, r = -1) {
547
- const s = (a) => S(a) ? a : [a], o = s(t);
545
+ function vt(t, e, n, r = -1) {
546
+ const s = (a) => x(a) ? a : [a], o = s(t);
548
547
  function c(a) {
549
548
  try {
550
549
  if (a instanceof RegExp) {
551
- let g = a.flags;
552
- return g.includes("g") || (g += "g"), g.includes("u") || (g += "u"), new RegExp(a.source, g);
550
+ let m = a.flags;
551
+ return m.includes("g") || (m += "g"), m.includes("u") || (m += "u"), new RegExp(a.source, m);
553
552
  }
554
- let p = a, u = "gu";
553
+ let g = a, u = "gu";
555
554
  if (a.length >= 2 && a[0] === "/") {
556
- let g = -1;
555
+ let m = -1;
557
556
  for (let y = a.length - 1; y > 0; y--)
558
557
  if (a[y] === "/") {
559
558
  let w = 0;
560
559
  for (let h = y - 1; h >= 0 && a[h] === "\\"; h--)
561
560
  w++;
562
561
  if (w % 2 === 0) {
563
- g = y;
562
+ m = y;
564
563
  break;
565
564
  }
566
565
  }
567
- if (g > 1) {
568
- p = a.slice(1, g);
569
- const y = a.slice(g + 1);
566
+ if (m > 1) {
567
+ g = a.slice(1, m);
568
+ const y = a.slice(m + 1);
570
569
  if (y)
571
570
  for (const w of y)
572
571
  /[imsuy]/.test(w) && !u.includes(w) && (u += w);
573
572
  }
574
573
  }
575
574
  return new RegExp(
576
- p,
575
+ g,
577
576
  Array.from(new Set(u.split(""))).join("")
578
577
  );
579
578
  } catch {
@@ -582,56 +581,56 @@ function Xt(t, e, n, r = -1) {
582
581
  }
583
582
  const i = [];
584
583
  for (const a of o) {
585
- const p = c(a);
586
- if (!p) return null;
587
- i.push(p);
584
+ const g = c(a);
585
+ if (!g) return null;
586
+ i.push(g);
588
587
  }
589
- const f = Q(e), l = f ? [] : s(e), m = (a) => {
590
- let p = a;
588
+ const f = K(e), l = f ? [] : s(e), p = (a) => {
589
+ let g = a;
591
590
  for (let u = 0; u < i.length; u++) {
592
- const g = i[u];
591
+ const m = i[u];
593
592
  if (f) {
594
593
  let y = 0;
595
594
  const w = e;
596
- p = p.replace(
597
- g,
595
+ g = g.replace(
596
+ m,
598
597
  (h, ...d) => {
599
598
  if (r >= 0 && y >= r) return h;
600
599
  y++;
601
600
  const b = d.length > 0 && d[d.length - 1] !== null && typeof d[d.length - 1] == "object" ? d.length - 3 : d.length - 2, $ = [];
602
601
  for (let A = 0; A < b; A++)
603
602
  $.push(d[A]);
604
- const L = [h, ...$];
605
- return w(L);
603
+ const E = [h, ...$];
604
+ return w(E);
606
605
  }
607
606
  );
608
607
  } else {
609
608
  const y = l[u] ?? (l.length === 1 ? l[0] : "");
610
609
  if (r < 0)
611
- p = p.replace(g, (w, ...h) => {
610
+ g = g.replace(m, (w, ...h) => {
612
611
  const k = h.length > 0 && h[h.length - 1] !== null && typeof h[h.length - 1] == "object" ? h.length - 3 : h.length - 2, b = h.slice(0, k).map(($) => String($));
613
- return y.replace(/\$(\d{1,2})/g, ($, L) => {
614
- const A = parseInt(L, 10);
612
+ return y.replace(/\$(\d{1,2})/g, ($, E) => {
613
+ const A = parseInt(E, 10);
615
614
  return (b[A - 1] ?? "").toUpperCase();
616
615
  });
617
616
  });
618
617
  else {
619
618
  let w = 0;
620
- p = p.replace(g, (h, ...d) => {
619
+ g = g.replace(m, (h, ...d) => {
621
620
  if (w >= r) return h;
622
621
  w++;
623
- const b = d.length > 0 && d[d.length - 1] !== null && typeof d[d.length - 1] == "object" ? d.length - 3 : d.length - 2, $ = d.slice(0, b).map((L) => String(L));
624
- return y.replace(/\$(\d{1,2})/g, (L, A) => {
625
- const U = parseInt(A, 10);
626
- return ($[U - 1] ?? "").toUpperCase();
622
+ const b = d.length > 0 && d[d.length - 1] !== null && typeof d[d.length - 1] == "object" ? d.length - 3 : d.length - 2, $ = d.slice(0, b).map((E) => String(E));
623
+ return y.replace(/\$(\d{1,2})/g, (E, A) => {
624
+ const P = parseInt(A, 10);
625
+ return ($[P - 1] ?? "").toUpperCase();
627
626
  });
628
627
  });
629
628
  }
630
629
  }
631
630
  }
632
- return p;
631
+ return g;
633
632
  };
634
- return S(n) ? n.map(m) : m(n);
633
+ return x(n) ? n.map(p) : p(n);
635
634
  }
636
635
  function nt(t) {
637
636
  let e = "", n = !1;
@@ -641,7 +640,7 @@ function nt(t) {
641
640
  }
642
641
  return e;
643
642
  }
644
- function Yt(t, e, n = !0) {
643
+ function te(t, e, n = !0) {
645
644
  const r = typeof t == "string" ? [t] : Array.from(t), s = (c) => c.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), o = (c) => {
646
645
  let i = c;
647
646
  for (const f of r)
@@ -656,21 +655,21 @@ function Yt(t, e, n = !0) {
656
655
  };
657
656
  return typeof e == "string" ? o(e) : Array.from(e, (c) => o(String(c)));
658
657
  }
659
- function jt(t) {
658
+ function ee(t) {
660
659
  return Array.from(t).reverse().join("");
661
660
  }
662
- function vt(t, e) {
661
+ function ne(t, e) {
663
662
  const n = e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
664
663
  return e + t.replace(new RegExp(`^(?:${n})+`, "u"), "");
665
664
  }
666
- function te(t) {
665
+ function re(t) {
667
666
  const e = String(t).trim();
668
667
  if (e === "")
669
668
  return "";
670
669
  let n = e.split(/\s+/u);
671
- return n.length > 1 ? n = n.map((s) => G(s)) : n = ot(n.join("_")).map((s) => G(s)), n.join("_").replace(/[-_ ]+/gu, "_").split("_").filter((s) => s.length > 0).join(" ");
670
+ return n.length > 1 ? n = n.map((s) => I(s)) : n = ot(n.join("_")).map((s) => I(s)), n.join("_").replace(/[-_ ]+/gu, "_").split("_").filter((s) => s.length > 0).join(" ");
672
671
  }
673
- function ee(t) {
672
+ function se(t) {
674
673
  if (t.trim() === "")
675
674
  return t;
676
675
  const e = /* @__PURE__ */ new Set([
@@ -731,16 +730,16 @@ function rt(t, e = "_") {
731
730
  if (R.has(r))
732
731
  return R.get(r);
733
732
  let s = t;
734
- return /^[a-z]+$/.test(t) || (s = it(t).replace(/\s+/gu, ""), s = s.replace(/(.)(?=[A-Z])/g, `$1${e}`), s = J(s)), R.set(r, s), s;
733
+ return /^[a-z]+$/.test(t) || (s = it(t).replace(/\s+/gu, ""), s = s.replace(/(.)(?=[A-Z])/g, `$1${e}`), s = H(s)), R.set(r, s), s;
735
734
  }
736
- function ne(t) {
737
- return K(t).replace(/[\s\u3164\u1160]+/gu, " ");
735
+ function oe(t) {
736
+ return V(t).replace(/[\s\u3164\u1160]+/gu, " ");
738
737
  }
739
- function P(t, e) {
738
+ function U(t, e) {
740
739
  if (t == null || e == null)
741
740
  return !1;
742
741
  let n;
743
- _(e) || V(e) ? n = [e] : Symbol.iterator in Object(e) ? n = Array.from(e) : n = [e];
742
+ _(e) || Z(e) ? n = [e] : Symbol.iterator in Object(e) ? n = Array.from(e) : n = [e];
744
743
  const r = String(t);
745
744
  for (const s of n) {
746
745
  if (s == null)
@@ -751,10 +750,10 @@ function P(t, e) {
751
750
  }
752
751
  return !1;
753
752
  }
754
- function re(t, e) {
755
- return !P(t, e);
753
+ function ie(t, e) {
754
+ return !U(t, e);
756
755
  }
757
- function H(t) {
756
+ function J(t) {
758
757
  const e = t;
759
758
  if (F.has(e))
760
759
  return F.get(e);
@@ -765,10 +764,10 @@ function H(t) {
765
764
  }, o = r.map(s).join("");
766
765
  return F.set(e, o), o;
767
766
  }
768
- function se(t) {
769
- return H(t);
767
+ function ce(t) {
768
+ return J(t);
770
769
  }
771
- function oe(t, e) {
770
+ function le(t, e) {
772
771
  if (!t || Object.keys(t).length === 0)
773
772
  return e;
774
773
  const n = Object.keys(t).filter((o) => o !== "");
@@ -778,28 +777,28 @@ function oe(t, e) {
778
777
  const r = (o) => o.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), s = new RegExp(n.map(r).join("|"), "gu");
779
778
  return e.replace(s, (o) => t[o]);
780
779
  }
781
- function ie(t, e) {
782
- return e < 0 ? x(t, e) : x(t, 0, e);
780
+ function fe(t, e) {
781
+ return e < 0 ? S(t, e) : S(t, 0, e);
783
782
  }
784
783
  function st(t) {
785
- return J(x(t, 0, 1)) + x(t, 1);
784
+ return H(S(t, 0, 1)) + S(t, 1);
786
785
  }
787
- function ce(t) {
788
- return Z(x(t, 0, 1)) + x(t, 1);
786
+ function ae(t) {
787
+ return D(S(t, 0, 1)) + S(t, 1);
789
788
  }
790
789
  function ot(t) {
791
790
  return t.split(new RegExp("(?=\\p{Lu})", "u")).filter(Boolean);
792
791
  }
793
792
  function it(t, e = ` \r
794
793
  \f\v`) {
795
- const n = S(e) ? e.join("") : e, r = (i) => i.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&"), s = n.length ? r(n) : "", o = s.length ? `(?:\\s|[${s}])` : "\\s", c = new RegExp(`(^|${o})(\\p{Ll})`, "gu");
794
+ const n = x(e) ? e.join("") : e, r = (i) => i.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&"), s = n.length ? r(n) : "", o = s.length ? `(?:\\s|[${s}])` : "\\s", c = new RegExp(`(^|${o})(\\p{Ll})`, "gu");
796
795
  return t.replace(c, (i, f, l) => f + l.toUpperCase());
797
796
  }
798
- function le(t, e = null) {
797
+ function ue(t, e = null) {
799
798
  const n = e && e.length > 0 ? e.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&") : "", r = n.length > 0 ? new RegExp(`[\\p{L}\\p{N}${n}]+`, "gu") : /[\p{L}\p{N}]+/gu, s = t.match(r);
800
799
  return s ? s.length : 0;
801
800
  }
802
- function fe(t, e = 75, n = `
801
+ function pe(t, e = 75, n = `
803
802
  `, r = !1) {
804
803
  if (t.length === 0 || e < 1 || n === "")
805
804
  return t;
@@ -826,14 +825,14 @@ function fe(t, e = 75, n = `
826
825
  if (f.length !== i.length && (i = f, i.length <= e))
827
826
  break;
828
827
  const l = i.slice(0, e + 1);
829
- let m = -1;
830
- for (let p = l.length - 1; p >= 0; p--)
831
- if (/\s/u.test(l[p])) {
832
- m = p;
828
+ let p = -1;
829
+ for (let g = l.length - 1; g >= 0; g--)
830
+ if (/\s/u.test(l[g])) {
831
+ p = g;
833
832
  break;
834
833
  }
835
- if (m > 0) {
836
- o.push(i.slice(0, m)), i = i.slice(m + 1);
834
+ if (p > 0) {
835
+ o.push(i.slice(0, p)), i = i.slice(p + 1);
837
836
  continue;
838
837
  }
839
838
  const a = i.search(/\s/u);
@@ -848,94 +847,94 @@ function fe(t, e = 75, n = `
848
847
  }
849
848
  return o.join(n);
850
849
  }
851
- function ae() {
850
+ function ge() {
852
851
  return R.size;
853
852
  }
854
- function ue() {
853
+ function me() {
855
854
  return C.size;
856
855
  }
857
- function pe() {
856
+ function he() {
858
857
  return F.size;
859
858
  }
860
- function ge() {
859
+ function de() {
861
860
  R.clear(), C.clear(), F.clear();
862
861
  }
863
862
  export {
864
863
  T as after,
865
- at as afterLast,
866
- ee as apa,
864
+ gt as afterLast,
865
+ se as apa,
867
866
  X as before,
868
867
  Y as beforeLast,
869
- ut as between,
870
- pt as betweenFirst,
871
- gt as camel,
872
- ue as camelCacheSize,
873
- mt as charAt,
874
- dt as chopEnd,
875
- ht as chopStart,
868
+ mt as between,
869
+ ht as betweenFirst,
870
+ dt as camel,
871
+ me as camelCacheSize,
872
+ yt as charAt,
873
+ xt as chopEnd,
874
+ wt as chopStart,
876
875
  B as contains,
877
- wt as containsAll,
878
- Jt as createRandomStringsNormally,
876
+ $t as containsAll,
877
+ Zt as createRandomStringsNormally,
879
878
  v as createRandomStringsUsing,
880
- Bt as createRandomStringsUsingSequence,
881
- St as deduplicate,
882
- xt as doesntContain,
883
- $t as doesntEndWith,
884
- re as doesntStartWith,
879
+ Kt as createRandomStringsUsingSequence,
880
+ At as deduplicate,
881
+ kt as doesntContain,
882
+ bt as doesntEndWith,
883
+ ie as doesntStartWith,
885
884
  M as endsWith,
886
- yt as excerpt,
887
- kt as finish,
888
- ge as flushCache,
889
- te as headline,
890
- Lt as is,
891
- Et as isAscii,
892
- Rt as isJson,
893
- Wt as isMatch,
894
- Ct as isUrl,
895
- Ft as kebab,
885
+ St as excerpt,
886
+ Et as finish,
887
+ de as flushCache,
888
+ re as headline,
889
+ Ct as is,
890
+ Ft as isAscii,
891
+ zt as isJson,
892
+ Pt as isMatch,
893
+ Nt as isUrl,
894
+ _t as kebab,
896
895
  st as lcfirst,
897
- N as length,
898
- Nt as limit,
899
- J as lower,
900
- z as makePad,
901
- _t as mask,
902
- Ot as match,
903
- Mt as matchAll,
904
- Pt as numbers,
905
- Ut as padBoth,
906
- It as padLeft,
907
- qt as padRight,
908
- se as pascal,
909
- Gt as password,
910
- Tt as position,
896
+ z as length,
897
+ Ot as limit,
898
+ H as lower,
899
+ N as makePad,
900
+ Mt as mask,
901
+ Ut as match,
902
+ It as matchAll,
903
+ qt as numbers,
904
+ Gt as padBoth,
905
+ Tt as padLeft,
906
+ Bt as padRight,
907
+ ce as pascal,
908
+ Ht as password,
909
+ Jt as position,
911
910
  j as random,
912
- Yt as remove,
913
- Ht as repeat,
914
- Dt as replace,
915
- Kt as replaceArray,
916
- Vt as replaceEnd,
911
+ te as remove,
912
+ Dt as repeat,
913
+ Xt as replace,
914
+ Qt as replaceArray,
915
+ jt as replaceEnd,
917
916
  tt as replaceFirst,
918
917
  et as replaceLast,
919
- Xt as replaceMatches,
920
- Qt as replaceStart,
921
- jt as reverse,
918
+ vt as replaceMatches,
919
+ Yt as replaceStart,
920
+ ee as reverse,
922
921
  rt as snake,
923
- ae as snakeCacheSize,
924
- ne as squish,
925
- vt as start,
926
- P as startsWith,
922
+ ge as snakeCacheSize,
923
+ oe as squish,
924
+ ne as start,
925
+ U as startsWith,
927
926
  nt as stripTags,
928
- H as studly,
929
- pe as studlyCacheSize,
930
- oe as swap,
931
- ie as take,
932
- Zt as toStringOr,
933
- ce as ucfirst,
927
+ J as studly,
928
+ he as studlyCacheSize,
929
+ le as swap,
930
+ fe as take,
931
+ Vt as toStringOr,
932
+ ae as ucfirst,
934
933
  ot as ucsplit,
935
934
  it as ucwords,
936
- bt as unwrap,
937
- le as wordCount,
938
- fe as wordWrap,
939
- zt as words,
940
- At as wrap
935
+ Rt as unwrap,
936
+ ue as wordCount,
937
+ pe as wordWrap,
938
+ Wt as words,
939
+ Lt as wrap
941
940
  };