@tolki/str 1.5.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -6
- package/dist/str.d.ts +3 -5
- package/dist/str.d.ts.map +1 -1
- package/dist/str.js +403 -395
- package/dist/stringable/index.d.ts +6 -3
- package/dist/stringable/index.d.ts.map +1 -1
- package/dist/stringable/index.js +6 -3
- package/dist/trimmer/index.d.ts +3 -3
- package/dist/trimmer/index.d.ts.map +1 -1
- package/dist/trimmer/index.js +31 -63
- package/package.json +3 -3
package/dist/str.js
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import { isArray as x, toLower as
|
|
2
|
-
import { title as
|
|
3
|
-
import { randomInt as
|
|
4
|
-
import { substr as
|
|
5
|
-
import { ltrim as
|
|
6
|
-
import { createUlidsNormally as
|
|
7
|
-
import { createUuidsNormally as
|
|
1
|
+
import { isArray as x, phpStringCast as z, toLower as U, isString as S, isFunction as Y, isNumber as v, isNull as tt, isUndefined as nt } from "@tolki/utils";
|
|
2
|
+
import { title as G, upper as J } from "./convertcase/index.js";
|
|
3
|
+
import { randomInt as I, randomString as et } from "./random/index.js";
|
|
4
|
+
import { substr as A } from "./replacer/index.js";
|
|
5
|
+
import { ltrim as q, rtrim as B, trim as rt } from "./trimmer/index.js";
|
|
6
|
+
import { createUlidsNormally as st } from "./ulid/index.js";
|
|
7
|
+
import { createUuidsNormally as it } from "./uuid/index.js";
|
|
8
8
|
const F = /* @__PURE__ */ new Map(), N = /* @__PURE__ */ new Map(), _ = /* @__PURE__ */ new Map();
|
|
9
9
|
let R = null;
|
|
10
|
-
function
|
|
10
|
+
function Z(t, n) {
|
|
11
11
|
if (n === "")
|
|
12
12
|
return t;
|
|
13
13
|
const e = String(n), r = t.indexOf(e);
|
|
14
14
|
return r === -1 ? t : t.slice(r + e.length);
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function Rt(t, n) {
|
|
17
17
|
if (n === "")
|
|
18
18
|
return t;
|
|
19
19
|
const e = t.lastIndexOf(String(n));
|
|
20
20
|
return e === -1 ? t : t.slice(e + String(n).length);
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function ot(t, n) {
|
|
23
23
|
if (n === "")
|
|
24
24
|
return t;
|
|
25
25
|
const e = t.indexOf(String(n));
|
|
26
26
|
return e === -1 ? t : t.slice(0, e);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function ct(t, n) {
|
|
29
29
|
if (n === "")
|
|
30
30
|
return t;
|
|
31
31
|
const e = t.lastIndexOf(String(n));
|
|
32
|
-
return e === -1 ? t :
|
|
32
|
+
return e === -1 ? t : A(t, 0, e);
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
return n === "" || e === "" ? t :
|
|
34
|
+
function Ft(t, n, e) {
|
|
35
|
+
return n === "" || e === "" ? t : ct(Z(t, n), e);
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
return n === "" || e === "" ? t :
|
|
37
|
+
function Nt(t, n, e) {
|
|
38
|
+
return n === "" || e === "" ? t : ot(Z(t, n), e);
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function _t(t) {
|
|
41
41
|
if (N.has(t))
|
|
42
42
|
return N.get(t);
|
|
43
|
-
const n =
|
|
43
|
+
const n = dt(X(t));
|
|
44
44
|
return N.set(t, n), n;
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function zt(t, n) {
|
|
47
47
|
const e = t.length;
|
|
48
48
|
return (n < 0 ? n < -e : n > e - 1) ? !1 : (n < 0 && (n += e), t.charAt(n));
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function Wt(t, n) {
|
|
51
51
|
for (const e of x(n) ? n : [n])
|
|
52
52
|
if (e !== "" && t.startsWith(e)) {
|
|
53
53
|
const r = [...t], s = [...e];
|
|
@@ -55,7 +55,7 @@ function _t(t, n) {
|
|
|
55
55
|
}
|
|
56
56
|
return t;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function Ot(t, n) {
|
|
59
59
|
for (const e of x(n) ? n : [n])
|
|
60
60
|
if (e !== "" && t.endsWith(e)) {
|
|
61
61
|
const r = [...t], s = [...e];
|
|
@@ -63,7 +63,7 @@ function zt(t, n) {
|
|
|
63
63
|
}
|
|
64
64
|
return t;
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function K(t, n, e = !1) {
|
|
67
67
|
e && (t = t.toLowerCase());
|
|
68
68
|
let r;
|
|
69
69
|
typeof n == "string" ? r = [n] : r = Array.from(n);
|
|
@@ -72,33 +72,33 @@ function J(t, n, e = !1) {
|
|
|
72
72
|
return !0;
|
|
73
73
|
return !1;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
76
|
-
const { radius: r = 100, omission: s = "..." } = e,
|
|
75
|
+
function Mt(t, n = "", e = {}) {
|
|
76
|
+
const { radius: r = 100, omission: s = "..." } = e, i = String(t ?? ""), o = n ?? "", c = (k) => k.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), l = new RegExp(`^(.*?)(${c(o)})(.*)$`, "iu").exec(i);
|
|
77
77
|
if (!l)
|
|
78
78
|
return null;
|
|
79
|
-
const m = String(l[1]), a = String(l[2]),
|
|
80
|
-
let
|
|
81
|
-
|
|
82
|
-
const h =
|
|
83
|
-
let
|
|
84
|
-
return
|
|
85
|
-
}
|
|
86
|
-
function
|
|
79
|
+
const m = String(l[1]), a = String(l[2]), p = String(l[3]), g = q(m), u = Array.from(g).length, w = A(g, Math.max(u - r, 0), r);
|
|
80
|
+
let y = q(w);
|
|
81
|
+
y !== g && (y = s + y);
|
|
82
|
+
const h = B(p), d = A(h, 0, r);
|
|
83
|
+
let $ = B(d);
|
|
84
|
+
return $ !== h && ($ = $ + s), y + a + $;
|
|
85
|
+
}
|
|
86
|
+
function Ut(t, n, e = !1) {
|
|
87
87
|
let r = !1;
|
|
88
88
|
for (const s of n)
|
|
89
|
-
if (r = !0, !
|
|
89
|
+
if (r = !0, !K(t, s, e))
|
|
90
90
|
return !1;
|
|
91
91
|
return r;
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
return !
|
|
93
|
+
function It(t, n, e = !1) {
|
|
94
|
+
return !K(t, n, e);
|
|
95
95
|
}
|
|
96
|
-
function
|
|
96
|
+
function Pt(t, n = " ") {
|
|
97
97
|
return x(n) ? (n.forEach((e) => {
|
|
98
98
|
t = t.replace(new RegExp(`${e}+`, "g"), e);
|
|
99
99
|
}), t) : t.replace(new RegExp(`${n}+`, "g"), n);
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function P(t, n) {
|
|
102
102
|
if (t === null)
|
|
103
103
|
return !1;
|
|
104
104
|
t = String(t), x(n) ? n = Array.from(n) : n = [String(n)];
|
|
@@ -107,40 +107,45 @@ function I(t, n) {
|
|
|
107
107
|
return !0;
|
|
108
108
|
return !1;
|
|
109
109
|
}
|
|
110
|
-
function
|
|
111
|
-
return !
|
|
110
|
+
function jt(t, n) {
|
|
111
|
+
return !P(t, n);
|
|
112
112
|
}
|
|
113
|
-
function
|
|
114
|
-
const e =
|
|
115
|
-
|
|
113
|
+
function Tt(t, n) {
|
|
114
|
+
const e = z(t), r = z(n);
|
|
115
|
+
if (r === "")
|
|
116
|
+
return e;
|
|
117
|
+
let s = e.length;
|
|
118
|
+
for (; e.endsWith(r, s); )
|
|
119
|
+
s -= r.length;
|
|
120
|
+
return `${e.slice(0, s)}${r}`;
|
|
116
121
|
}
|
|
117
|
-
function
|
|
122
|
+
function Gt(t, n, e = null) {
|
|
118
123
|
return n + t + (e ?? n);
|
|
119
124
|
}
|
|
120
|
-
function
|
|
121
|
-
return
|
|
125
|
+
function qt(t, n, e = null) {
|
|
126
|
+
return j(t, n) && (t = A(t, W(n))), P(t, e ??= n) && (t = A(t, 0, -W(e))), t;
|
|
122
127
|
}
|
|
123
|
-
function
|
|
128
|
+
function Bt(t, n, e = !1) {
|
|
124
129
|
n = String(n);
|
|
125
130
|
let r;
|
|
126
131
|
typeof t == "string" ? r = [t] : r = Array.from(t);
|
|
127
132
|
for (let s of r) {
|
|
128
|
-
if (s = String(s), s === n || e &&
|
|
133
|
+
if (s = String(s), s === n || e && U(s) === U(n))
|
|
129
134
|
return !0;
|
|
130
135
|
s = s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), s = s.replace(/\\\*/g, ".*");
|
|
131
|
-
const
|
|
132
|
-
if (new RegExp(`^${s}$`,
|
|
136
|
+
const i = e ? "iu" : "u";
|
|
137
|
+
if (new RegExp(`^${s}$`, i).test(n))
|
|
133
138
|
return !0;
|
|
134
139
|
}
|
|
135
140
|
return !1;
|
|
136
141
|
}
|
|
137
|
-
function
|
|
142
|
+
function lt(t) {
|
|
138
143
|
for (let n = 0; n < t.length; n++)
|
|
139
144
|
if (t.charCodeAt(n) > 127)
|
|
140
145
|
return !1;
|
|
141
146
|
return !0;
|
|
142
147
|
}
|
|
143
|
-
function
|
|
148
|
+
function Dt(t) {
|
|
144
149
|
if (!S(t))
|
|
145
150
|
return !1;
|
|
146
151
|
try {
|
|
@@ -150,13 +155,13 @@ function Gt(t) {
|
|
|
150
155
|
}
|
|
151
156
|
return !0;
|
|
152
157
|
}
|
|
153
|
-
function
|
|
158
|
+
function Ht(t, n = []) {
|
|
154
159
|
if (!S(t))
|
|
155
160
|
return !1;
|
|
156
|
-
const r = (n.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" : n.join("|")).split("|").map((
|
|
161
|
+
const r = (n.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" : n.join("|")).split("|").map((i) => i.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
|
|
157
162
|
try {
|
|
158
|
-
const
|
|
159
|
-
if (r.split("|").includes(
|
|
163
|
+
const i = new URL(t), o = i.protocol.replace(":", ""), c = i.hostname, l = t.slice(t.indexOf("://") + 3).startsWith("/"), m = c.length > 0 && !/^\.+$/.test(c) && !l, a = o === "file" && l;
|
|
164
|
+
if (r.split("|").includes(o) && (m || a))
|
|
160
165
|
return !0;
|
|
161
166
|
} catch {
|
|
162
167
|
}
|
|
@@ -180,173 +185,173 @@ function Bt(t, n = []) {
|
|
|
180
185
|
].join("");
|
|
181
186
|
return new RegExp(s, "iu").test(t);
|
|
182
187
|
}
|
|
183
|
-
function
|
|
184
|
-
return
|
|
188
|
+
function Jt(t) {
|
|
189
|
+
return ht(t, "-");
|
|
185
190
|
}
|
|
186
|
-
function
|
|
191
|
+
function W(t) {
|
|
187
192
|
return t.length;
|
|
188
193
|
}
|
|
189
|
-
function
|
|
194
|
+
function Zt(t, n = 100, e = "...", r = !1) {
|
|
190
195
|
if (t.length <= n)
|
|
191
196
|
return t;
|
|
192
197
|
if (!r)
|
|
193
|
-
return t.slice(0, n).
|
|
194
|
-
t =
|
|
195
|
-
const s = t.slice(0, n).
|
|
196
|
-
return t.substring(n, n + 1) === " " ? s + e : s.replace(/(.*)\s.*/, "$1") + e;
|
|
198
|
+
return t.slice(0, n).trimEnd() + e;
|
|
199
|
+
t = gt(t).replace(/[\n\r]+/g, " ").trim();
|
|
200
|
+
const s = t.slice(0, n).trimEnd();
|
|
201
|
+
return t.substring(n, n + 1) === " " || !/\s/.test(s) ? s + e : s.replace(/(.*)\s.*/, "$1") + e;
|
|
197
202
|
}
|
|
198
|
-
function
|
|
199
|
-
return
|
|
203
|
+
function V(t) {
|
|
204
|
+
return U(t);
|
|
200
205
|
}
|
|
201
|
-
function
|
|
206
|
+
function Kt(t, n = 100, e = "...") {
|
|
202
207
|
if (n <= 0)
|
|
203
208
|
return t;
|
|
204
|
-
const r = n, s = new RegExp(`^\\s*(?:\\S+\\s*){1,${r}}`, "u"),
|
|
205
|
-
return !
|
|
209
|
+
const r = n, s = new RegExp(`^\\s*(?:\\S+\\s*){1,${r}}`, "u"), i = t.match(s);
|
|
210
|
+
return !i || W(t) === W(i[0]) ? t : i[0].trimEnd() + e;
|
|
206
211
|
}
|
|
207
|
-
function
|
|
212
|
+
function Vt(t, n, e, r = null) {
|
|
208
213
|
if (n === "")
|
|
209
214
|
return t;
|
|
210
215
|
const s = t.length;
|
|
211
|
-
let
|
|
212
|
-
e < 0 && (
|
|
213
|
-
const
|
|
214
|
-
|
|
215
|
-
r !== null ?
|
|
216
|
+
let i = e;
|
|
217
|
+
e < 0 && (i = e < -s ? 0 : s + e);
|
|
218
|
+
const o = t.slice(
|
|
219
|
+
i,
|
|
220
|
+
r !== null ? i + r : void 0
|
|
216
221
|
);
|
|
217
|
-
if (
|
|
222
|
+
if (o === "")
|
|
218
223
|
return t;
|
|
219
|
-
const c = t.slice(0,
|
|
224
|
+
const c = t.slice(0, i), f = o.length, l = t.slice(i + f);
|
|
220
225
|
return c + n.slice(0, 1).repeat(f) + l;
|
|
221
226
|
}
|
|
222
|
-
function
|
|
227
|
+
function Qt(t, n) {
|
|
223
228
|
let e = "u", r = t;
|
|
224
229
|
if (t.length >= 2 && t[0] === "/") {
|
|
225
230
|
let s = -1;
|
|
226
|
-
for (let
|
|
227
|
-
if (t[
|
|
228
|
-
let
|
|
229
|
-
for (let c =
|
|
230
|
-
|
|
231
|
-
if (
|
|
232
|
-
s =
|
|
231
|
+
for (let i = t.length - 1; i > 0; i--)
|
|
232
|
+
if (t[i] === "/") {
|
|
233
|
+
let o = 0;
|
|
234
|
+
for (let c = i - 1; c >= 0 && t[c] === "\\"; c--)
|
|
235
|
+
o++;
|
|
236
|
+
if (o % 2 === 0) {
|
|
237
|
+
s = i;
|
|
233
238
|
break;
|
|
234
239
|
}
|
|
235
240
|
}
|
|
236
241
|
if (s > 0) {
|
|
237
242
|
r = t.slice(1, s);
|
|
238
|
-
const
|
|
239
|
-
if (
|
|
240
|
-
for (const
|
|
241
|
-
/[imsuy]/.test(
|
|
243
|
+
const i = t.slice(s + 1);
|
|
244
|
+
if (i)
|
|
245
|
+
for (const o of i)
|
|
246
|
+
/[imsuy]/.test(o) && !e.includes(o) && (e += o);
|
|
242
247
|
}
|
|
243
248
|
}
|
|
244
249
|
try {
|
|
245
|
-
const
|
|
246
|
-
return
|
|
250
|
+
const i = new RegExp(r, e).exec(n);
|
|
251
|
+
return i ? i[1] !== void 0 ? i[1] : i[0] : "";
|
|
247
252
|
} catch {
|
|
248
253
|
return "";
|
|
249
254
|
}
|
|
250
255
|
}
|
|
251
|
-
function
|
|
256
|
+
function Xt(t, n) {
|
|
252
257
|
n = String(n);
|
|
253
258
|
const e = typeof t == "string" ? [t] : Array.from(t);
|
|
254
259
|
for (const r of e) {
|
|
255
260
|
if (typeof r != "string" || r === "") continue;
|
|
256
|
-
let s = "u",
|
|
261
|
+
let s = "u", i = r;
|
|
257
262
|
if (r.length >= 2 && r[0] === "/") {
|
|
258
|
-
let
|
|
263
|
+
let o = -1;
|
|
259
264
|
for (let c = r.length - 1; c > 0; c--)
|
|
260
265
|
if (r[c] === "/") {
|
|
261
266
|
let f = 0;
|
|
262
267
|
for (let l = c - 1; l >= 0 && r[l] === "\\"; l--)
|
|
263
268
|
f++;
|
|
264
269
|
if (f % 2 === 0) {
|
|
265
|
-
|
|
270
|
+
o = c;
|
|
266
271
|
break;
|
|
267
272
|
}
|
|
268
273
|
}
|
|
269
|
-
if (
|
|
270
|
-
|
|
271
|
-
const c = r.slice(
|
|
274
|
+
if (o > 0) {
|
|
275
|
+
i = r.slice(1, o);
|
|
276
|
+
const c = r.slice(o + 1);
|
|
272
277
|
if (c)
|
|
273
278
|
for (const f of c)
|
|
274
279
|
/[imsuy]/.test(f) && !s.includes(f) && (s += f);
|
|
275
280
|
}
|
|
276
281
|
}
|
|
277
282
|
try {
|
|
278
|
-
if (new RegExp(
|
|
283
|
+
if (new RegExp(i, s).test(n))
|
|
279
284
|
return !0;
|
|
280
285
|
} catch {
|
|
281
286
|
}
|
|
282
287
|
}
|
|
283
288
|
return !1;
|
|
284
289
|
}
|
|
285
|
-
function
|
|
290
|
+
function Yt(t, n) {
|
|
286
291
|
let e = "u", r = t;
|
|
287
292
|
if (t.length >= 2 && t[0] === "/") {
|
|
288
|
-
let
|
|
289
|
-
for (let
|
|
290
|
-
if (t[
|
|
293
|
+
let i = -1;
|
|
294
|
+
for (let o = t.length - 1; o > 0; o--)
|
|
295
|
+
if (t[o] === "/") {
|
|
291
296
|
let c = 0;
|
|
292
|
-
for (let f =
|
|
297
|
+
for (let f = o - 1; f >= 0 && t[f] === "\\"; f--)
|
|
293
298
|
c++;
|
|
294
299
|
if (c % 2 === 0) {
|
|
295
|
-
|
|
300
|
+
i = o;
|
|
296
301
|
break;
|
|
297
302
|
}
|
|
298
303
|
}
|
|
299
|
-
if (
|
|
300
|
-
r = t.slice(1,
|
|
301
|
-
const
|
|
302
|
-
if (
|
|
303
|
-
for (const c of
|
|
304
|
+
if (i > 0) {
|
|
305
|
+
r = t.slice(1, i);
|
|
306
|
+
const o = t.slice(i + 1);
|
|
307
|
+
if (o)
|
|
308
|
+
for (const c of o)
|
|
304
309
|
/[gimsuy]/.test(c) && !e.includes(c) && (e += c);
|
|
305
310
|
}
|
|
306
311
|
}
|
|
307
312
|
e.includes("g") || (e += "g");
|
|
308
313
|
let s = [];
|
|
309
314
|
try {
|
|
310
|
-
const
|
|
311
|
-
let
|
|
312
|
-
for (; (
|
|
313
|
-
s.push(
|
|
315
|
+
const i = new RegExp(r, e);
|
|
316
|
+
let o;
|
|
317
|
+
for (; (o = i.exec(n)) !== null; )
|
|
318
|
+
s.push(o[1] !== void 0 ? o[1] : o[0]), o[0] === "" && i.lastIndex++;
|
|
314
319
|
} catch {
|
|
315
320
|
s = [];
|
|
316
321
|
}
|
|
317
322
|
return s;
|
|
318
323
|
}
|
|
319
|
-
function
|
|
324
|
+
function vt(t) {
|
|
320
325
|
return x(t) ? t.map((n) => n.replace(/\D/g, "")) : t.replace(/\D/g, "");
|
|
321
326
|
}
|
|
322
|
-
function
|
|
327
|
+
function tn(t, n, e = " ") {
|
|
323
328
|
const r = t.length;
|
|
324
329
|
if (n <= r || e === "")
|
|
325
330
|
return t;
|
|
326
|
-
const s = n - r,
|
|
327
|
-
return
|
|
331
|
+
const s = n - r, i = Math.floor(s / 2), o = s - i;
|
|
332
|
+
return O(e, i) + t + O(e, o);
|
|
328
333
|
}
|
|
329
|
-
function
|
|
334
|
+
function nn(t, n, e = " ") {
|
|
330
335
|
const r = t.length;
|
|
331
336
|
if (n <= r || e === "")
|
|
332
337
|
return t;
|
|
333
|
-
const
|
|
334
|
-
return
|
|
338
|
+
const i = n - r;
|
|
339
|
+
return O(e, i) + t;
|
|
335
340
|
}
|
|
336
|
-
function
|
|
341
|
+
function en(t, n, e = " ") {
|
|
337
342
|
const r = t.length;
|
|
338
343
|
if (n <= r || e === "")
|
|
339
344
|
return t;
|
|
340
|
-
const
|
|
341
|
-
return t +
|
|
345
|
+
const i = n - r;
|
|
346
|
+
return t + O(e, i);
|
|
342
347
|
}
|
|
343
|
-
function
|
|
348
|
+
function O(t, n) {
|
|
344
349
|
if (n <= 0 || t.length === 0)
|
|
345
350
|
return "";
|
|
346
351
|
const e = Math.ceil(n / t.length);
|
|
347
352
|
return t.repeat(e).slice(0, n);
|
|
348
353
|
}
|
|
349
|
-
function
|
|
354
|
+
function rn(t = 32, n = !0, e = !0, r = !0, s = !1) {
|
|
350
355
|
const l = [
|
|
351
356
|
n ? [
|
|
352
357
|
"a",
|
|
@@ -432,34 +437,32 @@ function nn(t = 32, n = !0, e = !0, r = !0, s = !1) {
|
|
|
432
437
|
";"
|
|
433
438
|
] : null,
|
|
434
439
|
s ? [" "] : null
|
|
435
|
-
].filter((
|
|
436
|
-
if (l.length === 0
|
|
437
|
-
|
|
438
|
-
const m = []
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
const u = U(0, p), y = m[p];
|
|
450
|
-
m[p] = m[u], m[u] = y;
|
|
440
|
+
].filter((g) => x(g));
|
|
441
|
+
if (l.length === 0)
|
|
442
|
+
throw new Error("At least one character pool must be enabled.");
|
|
443
|
+
const m = l.flat(), a = D(l).slice(0, Math.max(0, t)).map((g) => g[I(0, g.length - 1)]), p = Array.from(
|
|
444
|
+
{ length: Math.max(0, t - a.length) },
|
|
445
|
+
() => m[I(0, m.length - 1)]
|
|
446
|
+
);
|
|
447
|
+
return D([...a, ...p]).join("");
|
|
448
|
+
}
|
|
449
|
+
function D(t) {
|
|
450
|
+
const n = [...t];
|
|
451
|
+
for (let e = n.length - 1; e > 0; e--) {
|
|
452
|
+
const r = I(0, e);
|
|
453
|
+
[n[e], n[r]] = [n[r], n[e]];
|
|
451
454
|
}
|
|
452
|
-
return
|
|
455
|
+
return n;
|
|
453
456
|
}
|
|
454
|
-
function
|
|
457
|
+
function sn(t, n, e = 0) {
|
|
455
458
|
if (n === "")
|
|
456
459
|
return !1;
|
|
457
460
|
const r = Array.from(t), s = Array.from(n);
|
|
458
|
-
let
|
|
459
|
-
if (
|
|
461
|
+
let i = e >= 0 ? e : r.length + e;
|
|
462
|
+
if (i < 0 && (i = 0), i >= r.length)
|
|
460
463
|
return !1;
|
|
461
|
-
const
|
|
462
|
-
for (let c =
|
|
464
|
+
const o = r.length - s.length;
|
|
465
|
+
for (let c = i; c <= o; c++) {
|
|
463
466
|
let f = !0;
|
|
464
467
|
for (let l = 0; l < s.length; l++)
|
|
465
468
|
if (r[c + l] !== s[l]) {
|
|
@@ -471,42 +474,42 @@ function en(t, n, e = 0) {
|
|
|
471
474
|
}
|
|
472
475
|
return !1;
|
|
473
476
|
}
|
|
474
|
-
function
|
|
475
|
-
return (R ?? ((e) =>
|
|
477
|
+
function ft(t = 16) {
|
|
478
|
+
return (R ?? ((e) => et(e)))(t);
|
|
476
479
|
}
|
|
477
|
-
function
|
|
480
|
+
function at(t) {
|
|
478
481
|
R = t;
|
|
479
482
|
}
|
|
480
|
-
function
|
|
483
|
+
function on(t, n) {
|
|
481
484
|
let e = 0;
|
|
482
485
|
const r = n ?? function(s) {
|
|
483
|
-
const
|
|
486
|
+
const i = R;
|
|
484
487
|
R = null;
|
|
485
|
-
const
|
|
486
|
-
return R =
|
|
488
|
+
const o = ft(s);
|
|
489
|
+
return R = i, e++, o;
|
|
487
490
|
};
|
|
488
|
-
|
|
491
|
+
at((s) => e < t.length ? String(t[e++]) : r(s));
|
|
489
492
|
}
|
|
490
|
-
function
|
|
493
|
+
function ut() {
|
|
491
494
|
R = null;
|
|
492
495
|
}
|
|
493
|
-
function
|
|
496
|
+
function cn(t, n) {
|
|
494
497
|
return n <= 0 ? "" : t.repeat(n);
|
|
495
498
|
}
|
|
496
|
-
function
|
|
499
|
+
function ln(t, n, e) {
|
|
497
500
|
let r;
|
|
498
501
|
typeof n == "object" && !x(n) ? r = Object.values(n) : r = x(n) ? [...n] : Array.from(n);
|
|
499
502
|
const s = e.split(t);
|
|
500
503
|
if (s.length === 1)
|
|
501
504
|
return e;
|
|
502
|
-
let
|
|
503
|
-
for (let
|
|
505
|
+
let i = s[0];
|
|
506
|
+
for (let o = 1; o < s.length; o++) {
|
|
504
507
|
const c = r.length ? r.shift() : t;
|
|
505
|
-
|
|
508
|
+
i += c + s[o];
|
|
506
509
|
}
|
|
507
|
-
return String(
|
|
510
|
+
return String(i);
|
|
508
511
|
}
|
|
509
|
-
function
|
|
512
|
+
function fn(t, n) {
|
|
510
513
|
try {
|
|
511
514
|
const e = String(t);
|
|
512
515
|
if (e.length)
|
|
@@ -516,145 +519,145 @@ function cn(t, n) {
|
|
|
516
519
|
return n;
|
|
517
520
|
}
|
|
518
521
|
}
|
|
519
|
-
function
|
|
522
|
+
function an(t, n, e, r = !0) {
|
|
520
523
|
if (S(t) && !S(n))
|
|
521
524
|
throw new TypeError(
|
|
522
525
|
"The replacement must be a string when the search term is a string."
|
|
523
526
|
);
|
|
524
|
-
const s = S(e) ? e : Array.from(e, (f) =>
|
|
527
|
+
const s = S(e) ? e : Array.from(e, (f) => C(f));
|
|
525
528
|
if (!r)
|
|
526
|
-
return
|
|
529
|
+
return Q(
|
|
527
530
|
t,
|
|
528
531
|
n,
|
|
529
532
|
s
|
|
530
533
|
);
|
|
531
|
-
const
|
|
534
|
+
const i = S(t) ? [t] : Array.from(t, (f) => C(f)), o = S(n) ? i.map(() => n) : Array.from(n, (f) => C(f)), c = (f) => i.reduce((l, m, a) => m === "" ? l : l.split(m).join(o[a] ?? ""), f);
|
|
532
535
|
return S(s) ? c(s) : s.map(c);
|
|
533
536
|
}
|
|
534
|
-
function
|
|
535
|
-
const r = S(t) ? [t] : Array.from(t, (c) =>
|
|
537
|
+
function Q(t, n, e) {
|
|
538
|
+
const r = S(t) ? [t] : Array.from(t, (c) => C(c)), s = S(n) ? r.map(() => n) : Array.from(n, (c) => C(c)), i = (c) => c.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), o = (c) => r.reduce((f, l, m) => {
|
|
536
539
|
if (l === "")
|
|
537
540
|
return f;
|
|
538
|
-
const a = s[m] ?? "",
|
|
539
|
-
|
|
540
|
-
|
|
541
|
+
const a = s[m] ?? "", p = new RegExp(
|
|
542
|
+
i(l),
|
|
543
|
+
lt(l) ? "gi" : "giu"
|
|
541
544
|
);
|
|
542
|
-
return f.replace(
|
|
545
|
+
return f.replace(p, () => a);
|
|
543
546
|
}, c);
|
|
544
|
-
return S(e) ?
|
|
547
|
+
return S(e) ? o(e) : e.map(o);
|
|
545
548
|
}
|
|
546
|
-
function
|
|
547
|
-
return
|
|
549
|
+
function C(t) {
|
|
550
|
+
return tt(t) || nt(t) ? "" : String(t);
|
|
548
551
|
}
|
|
549
|
-
function
|
|
552
|
+
function pt(t, n, e) {
|
|
550
553
|
if (t = String(t), t === "")
|
|
551
554
|
return e;
|
|
552
555
|
const r = e.indexOf(t);
|
|
553
556
|
return r !== -1 ? e.slice(0, r) + n + e.slice(r + t.length) : e;
|
|
554
557
|
}
|
|
555
|
-
function
|
|
556
|
-
return t = String(t), t === "" ? e :
|
|
558
|
+
function un(t, n, e) {
|
|
559
|
+
return t = String(t), t === "" ? e : j(e, t) ? pt(t, n, e) : e;
|
|
557
560
|
}
|
|
558
|
-
function
|
|
561
|
+
function mt(t, n, e) {
|
|
559
562
|
if (t = String(t), t === "")
|
|
560
563
|
return e;
|
|
561
564
|
const r = e.lastIndexOf(t);
|
|
562
565
|
return r !== -1 ? e.slice(0, r) + n + e.slice(r + t.length) : e;
|
|
563
566
|
}
|
|
564
|
-
function
|
|
565
|
-
return t = String(t), t === "" ? e :
|
|
567
|
+
function pn(t, n, e) {
|
|
568
|
+
return t = String(t), t === "" ? e : P(e, t) ? mt(t, n, e) : e;
|
|
566
569
|
}
|
|
567
|
-
function
|
|
568
|
-
const s = (a) => x(a) ? a : [a],
|
|
569
|
-
function
|
|
570
|
+
function mn(t, n, e, r = -1) {
|
|
571
|
+
const s = (a) => x(a) ? a : [a], i = s(t);
|
|
572
|
+
function o(a) {
|
|
570
573
|
try {
|
|
571
574
|
if (a instanceof RegExp) {
|
|
572
575
|
let u = a.flags;
|
|
573
576
|
return u.includes("g") || (u += "g"), u.includes("u") || (u += "u"), new RegExp(a.source, u);
|
|
574
577
|
}
|
|
575
|
-
let
|
|
578
|
+
let p = a, g = "gu";
|
|
576
579
|
if (a.length >= 2 && a[0] === "/") {
|
|
577
580
|
let u = -1;
|
|
578
|
-
for (let
|
|
579
|
-
if (a[
|
|
580
|
-
let
|
|
581
|
-
for (let h =
|
|
582
|
-
|
|
583
|
-
if (
|
|
584
|
-
u =
|
|
581
|
+
for (let w = a.length - 1; w > 0; w--)
|
|
582
|
+
if (a[w] === "/") {
|
|
583
|
+
let y = 0;
|
|
584
|
+
for (let h = w - 1; h >= 0 && a[h] === "\\"; h--)
|
|
585
|
+
y++;
|
|
586
|
+
if (y % 2 === 0) {
|
|
587
|
+
u = w;
|
|
585
588
|
break;
|
|
586
589
|
}
|
|
587
590
|
}
|
|
588
591
|
if (u > 1) {
|
|
589
|
-
|
|
590
|
-
const
|
|
591
|
-
if (
|
|
592
|
-
for (const
|
|
593
|
-
/[imsuy]/.test(
|
|
592
|
+
p = a.slice(1, u);
|
|
593
|
+
const w = a.slice(u + 1);
|
|
594
|
+
if (w)
|
|
595
|
+
for (const y of w)
|
|
596
|
+
/[imsuy]/.test(y) && !g.includes(y) && (g += y);
|
|
594
597
|
}
|
|
595
598
|
}
|
|
596
599
|
return new RegExp(
|
|
597
|
-
|
|
598
|
-
Array.from(new Set(
|
|
600
|
+
p,
|
|
601
|
+
Array.from(new Set(g.split(""))).join("")
|
|
599
602
|
);
|
|
600
603
|
} catch {
|
|
601
604
|
return null;
|
|
602
605
|
}
|
|
603
606
|
}
|
|
604
607
|
const c = [];
|
|
605
|
-
for (const a of
|
|
606
|
-
const
|
|
607
|
-
if (!
|
|
608
|
-
c.push(
|
|
608
|
+
for (const a of i) {
|
|
609
|
+
const p = o(a);
|
|
610
|
+
if (!p) return null;
|
|
611
|
+
c.push(p);
|
|
609
612
|
}
|
|
610
|
-
const f =
|
|
611
|
-
let
|
|
612
|
-
for (let
|
|
613
|
-
const u = c[
|
|
613
|
+
const f = Y(n), l = f ? [] : s(n), m = (a) => {
|
|
614
|
+
let p = a;
|
|
615
|
+
for (let g = 0; g < c.length; g++) {
|
|
616
|
+
const u = c[g];
|
|
614
617
|
if (f) {
|
|
615
|
-
let
|
|
616
|
-
const
|
|
617
|
-
|
|
618
|
+
let w = 0;
|
|
619
|
+
const y = n;
|
|
620
|
+
p = p.replace(
|
|
618
621
|
u,
|
|
619
622
|
(h, ...d) => {
|
|
620
|
-
if (r >= 0 &&
|
|
621
|
-
|
|
623
|
+
if (r >= 0 && w >= r) return h;
|
|
624
|
+
w++;
|
|
622
625
|
const E = d.length > 0 && d[d.length - 1] !== null && typeof d[d.length - 1] == "object" ? d.length - 3 : d.length - 2, k = [];
|
|
623
626
|
for (let b = 0; b < E; b++)
|
|
624
627
|
k.push(d[b]);
|
|
625
|
-
const
|
|
626
|
-
return
|
|
628
|
+
const L = [h, ...k];
|
|
629
|
+
return y(L);
|
|
627
630
|
}
|
|
628
631
|
);
|
|
629
632
|
} else {
|
|
630
|
-
const
|
|
633
|
+
const w = l[g] ?? (l.length === 1 ? l[0] : "");
|
|
631
634
|
if (r < 0)
|
|
632
|
-
|
|
633
|
-
const
|
|
634
|
-
return
|
|
635
|
-
const b = parseInt(
|
|
635
|
+
p = p.replace(u, (y, ...h) => {
|
|
636
|
+
const $ = h.length > 0 && h[h.length - 1] !== null && typeof h[h.length - 1] == "object" ? h.length - 3 : h.length - 2, E = h.slice(0, $).map((k) => String(k));
|
|
637
|
+
return w.replace(/\$(\d{1,2})/g, (k, L) => {
|
|
638
|
+
const b = parseInt(L, 10);
|
|
636
639
|
return (E[b - 1] ?? "").toUpperCase();
|
|
637
640
|
});
|
|
638
641
|
});
|
|
639
642
|
else {
|
|
640
|
-
let
|
|
641
|
-
|
|
642
|
-
if (
|
|
643
|
-
|
|
644
|
-
const E = d.length > 0 && d[d.length - 1] !== null && typeof d[d.length - 1] == "object" ? d.length - 3 : d.length - 2, k = d.slice(0, E).map((
|
|
645
|
-
return
|
|
646
|
-
const
|
|
647
|
-
return (k[
|
|
643
|
+
let y = 0;
|
|
644
|
+
p = p.replace(u, (h, ...d) => {
|
|
645
|
+
if (y >= r) return h;
|
|
646
|
+
y++;
|
|
647
|
+
const E = d.length > 0 && d[d.length - 1] !== null && typeof d[d.length - 1] == "object" ? d.length - 3 : d.length - 2, k = d.slice(0, E).map((L) => String(L));
|
|
648
|
+
return w.replace(/\$(\d{1,2})/g, (L, b) => {
|
|
649
|
+
const T = parseInt(b, 10);
|
|
650
|
+
return (k[T - 1] ?? "").toUpperCase();
|
|
648
651
|
});
|
|
649
652
|
});
|
|
650
653
|
}
|
|
651
654
|
}
|
|
652
655
|
}
|
|
653
|
-
return
|
|
656
|
+
return p;
|
|
654
657
|
};
|
|
655
658
|
return x(e) ? e.map(m) : m(e);
|
|
656
659
|
}
|
|
657
|
-
function
|
|
660
|
+
function gt(t) {
|
|
658
661
|
let n = "", e = !1;
|
|
659
662
|
for (let r = 0; r < t.length; r++) {
|
|
660
663
|
const s = t[r];
|
|
@@ -662,37 +665,42 @@ function pt(t) {
|
|
|
662
665
|
}
|
|
663
666
|
return n;
|
|
664
667
|
}
|
|
665
|
-
function
|
|
666
|
-
const r = S(n) ? n : Array.from(n, (
|
|
668
|
+
function gn(t, n, e = !0) {
|
|
669
|
+
const r = S(n) ? n : Array.from(n, (o) => C(o));
|
|
667
670
|
if (!e)
|
|
668
|
-
return
|
|
669
|
-
const s = S(t) ? [t] : Array.from(t, (
|
|
670
|
-
let c =
|
|
671
|
+
return Q(t, "", r);
|
|
672
|
+
const s = S(t) ? [t] : Array.from(t, (o) => C(o)), i = (o) => {
|
|
673
|
+
let c = o;
|
|
671
674
|
for (const f of s)
|
|
672
675
|
f !== "" && (c = c.split(f).join(""));
|
|
673
676
|
return c;
|
|
674
677
|
};
|
|
675
|
-
return S(r) ?
|
|
678
|
+
return S(r) ? i(r) : r.map(i);
|
|
676
679
|
}
|
|
677
|
-
function
|
|
680
|
+
function hn(t) {
|
|
678
681
|
return Array.from(t).reverse().join("");
|
|
679
682
|
}
|
|
680
|
-
function
|
|
681
|
-
const e =
|
|
682
|
-
|
|
683
|
+
function dn(t, n) {
|
|
684
|
+
const e = z(t), r = z(n);
|
|
685
|
+
if (r === "")
|
|
686
|
+
return e;
|
|
687
|
+
let s = 0;
|
|
688
|
+
for (; e.startsWith(r, s); )
|
|
689
|
+
s += r.length;
|
|
690
|
+
return `${r}${e.slice(s)}`;
|
|
683
691
|
}
|
|
684
|
-
function
|
|
692
|
+
function yn(t) {
|
|
685
693
|
const n = String(t).trim();
|
|
686
694
|
if (n === "")
|
|
687
695
|
return "";
|
|
688
696
|
let e = n.split(/\s+/u);
|
|
689
|
-
return e.length > 1 ? e = e.map((s) =>
|
|
697
|
+
return e.length > 1 ? e = e.map((s) => G(s)) : e = yt(e.join("_")).map((s) => G(s)), e.join("_").replace(/[-_ ]+/gu, "_").split("_").filter((s) => s.length > 0).join(" ");
|
|
690
698
|
}
|
|
691
|
-
function
|
|
699
|
+
function wn(t, n = !1) {
|
|
692
700
|
const r = t.split(/\s+/u).filter((s) => s.length > 0).map((s) => [...s][0]).join("");
|
|
693
|
-
return n ?
|
|
701
|
+
return n ? J(r) : r;
|
|
694
702
|
}
|
|
695
|
-
function
|
|
703
|
+
function Sn(t) {
|
|
696
704
|
if (t.trim() === "")
|
|
697
705
|
return t;
|
|
698
706
|
const n = /* @__PURE__ */ new Set([
|
|
@@ -731,52 +739,52 @@ function yn(t) {
|
|
|
731
739
|
"des",
|
|
732
740
|
"par",
|
|
733
741
|
"à"
|
|
734
|
-
]), e = /* @__PURE__ */ new Set([".", "!", "?", ":", "—", ","]), r = t.split(/\s+/u), s = (
|
|
735
|
-
if (!
|
|
736
|
-
const
|
|
742
|
+
]), e = /* @__PURE__ */ new Set([".", "!", "?", ":", "—", ","]), r = t.split(/\s+/u), s = (i) => {
|
|
743
|
+
if (!i) return i;
|
|
744
|
+
const o = Array.from(i), c = o[0].toLocaleUpperCase(), f = o.slice(1).join("");
|
|
737
745
|
return c + f;
|
|
738
746
|
};
|
|
739
|
-
for (let
|
|
740
|
-
const
|
|
741
|
-
if (
|
|
742
|
-
const f =
|
|
743
|
-
r[
|
|
747
|
+
for (let i = 0; i < r.length; i++) {
|
|
748
|
+
const o = r[i].toLocaleLowerCase();
|
|
749
|
+
if (o.includes("-")) {
|
|
750
|
+
const f = o.split("-").map((l) => n.has(l) && l.length <= 3 ? l : s(l));
|
|
751
|
+
r[i] = f.join("-");
|
|
744
752
|
} else {
|
|
745
|
-
const c =
|
|
746
|
-
n.has(
|
|
753
|
+
const c = i > 0 ? r[i - 1] : "", f = c ? Array.from(c).slice(-1)[0] : void 0, l = i === 0 || f !== void 0 && e.has(f);
|
|
754
|
+
n.has(o) && o.length <= 3 && !l ? r[i] = o : r[i] = s(o);
|
|
747
755
|
}
|
|
748
756
|
}
|
|
749
757
|
return r.join(" ");
|
|
750
758
|
}
|
|
751
|
-
function
|
|
759
|
+
function ht(t, n = "_") {
|
|
752
760
|
const r = `${t}|${n}`;
|
|
753
761
|
if (F.has(r))
|
|
754
762
|
return F.get(r);
|
|
755
763
|
let s = t;
|
|
756
|
-
return /^[a-z]+$/.test(t) || (s =
|
|
764
|
+
return /^[a-z]+$/.test(t) || (s = wt(t).replace(/\s+/gu, ""), s = s.replace(/(.)(?=[A-Z])/g, `$1${n}`), s = V(s)), F.set(r, s), s;
|
|
757
765
|
}
|
|
758
|
-
function
|
|
759
|
-
return
|
|
766
|
+
function xn(t) {
|
|
767
|
+
return rt(t).replace(/[\s\u3164\u1160]+/gu, " ");
|
|
760
768
|
}
|
|
761
|
-
function
|
|
769
|
+
function j(t, n) {
|
|
762
770
|
if (t == null || n == null)
|
|
763
771
|
return !1;
|
|
764
772
|
let e;
|
|
765
|
-
S(n) ||
|
|
773
|
+
S(n) || v(n) ? e = [n] : Symbol.iterator in Object(n) ? e = Array.from(n) : e = [n];
|
|
766
774
|
const r = String(t);
|
|
767
775
|
for (const s of e) {
|
|
768
776
|
if (s == null)
|
|
769
777
|
continue;
|
|
770
|
-
const
|
|
771
|
-
if (
|
|
778
|
+
const i = String(s);
|
|
779
|
+
if (i !== "" && r.startsWith(i))
|
|
772
780
|
return !0;
|
|
773
781
|
}
|
|
774
782
|
return !1;
|
|
775
783
|
}
|
|
776
|
-
function
|
|
777
|
-
return !
|
|
784
|
+
function An(t, n) {
|
|
785
|
+
return !j(t, n);
|
|
778
786
|
}
|
|
779
|
-
function
|
|
787
|
+
function X(t, n = !1) {
|
|
780
788
|
let e = t;
|
|
781
789
|
n && (e = t.replace(
|
|
782
790
|
/(^|[-_ \s])([A-Z]+)(?=[-_ \s]|$)/gu,
|
|
@@ -785,59 +793,59 @@ function V(t, n = !1) {
|
|
|
785
793
|
const r = e;
|
|
786
794
|
if (_.has(r))
|
|
787
795
|
return _.get(r);
|
|
788
|
-
const s = String(e).replace(/[-_]+/g, " "),
|
|
796
|
+
const s = String(e).replace(/[-_]+/g, " "), i = s.trim() === "" ? [] : s.split(/\s+/u), o = (f) => {
|
|
789
797
|
if (!f) return f;
|
|
790
798
|
const l = Array.from(f), m = l[0].toUpperCase(), a = l.slice(1).join("");
|
|
791
799
|
return m + a;
|
|
792
|
-
}, c =
|
|
800
|
+
}, c = i.map(o).join("");
|
|
793
801
|
return _.set(r, c), c;
|
|
794
802
|
}
|
|
795
|
-
function
|
|
796
|
-
return
|
|
803
|
+
function kn(t, n = !1) {
|
|
804
|
+
return X(t, n);
|
|
797
805
|
}
|
|
798
806
|
function $n(t, n) {
|
|
799
807
|
if (!t || Object.keys(t).length === 0)
|
|
800
808
|
return n;
|
|
801
|
-
const e = Object.keys(t).filter((
|
|
809
|
+
const e = Object.keys(t).filter((i) => i !== "");
|
|
802
810
|
if (e.length === 0)
|
|
803
811
|
return n;
|
|
804
|
-
e.sort((
|
|
805
|
-
const r = (
|
|
806
|
-
return n.replace(s, (
|
|
812
|
+
e.sort((i, o) => o.length - i.length);
|
|
813
|
+
const r = (i) => i.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), s = new RegExp(e.map(r).join("|"), "gu");
|
|
814
|
+
return n.replace(s, (i) => t[i]);
|
|
807
815
|
}
|
|
808
|
-
function
|
|
809
|
-
return n < 0 ?
|
|
816
|
+
function bn(t, n) {
|
|
817
|
+
return n < 0 ? A(t, n) : A(t, 0, n);
|
|
810
818
|
}
|
|
811
|
-
function
|
|
812
|
-
return
|
|
819
|
+
function dt(t) {
|
|
820
|
+
return V(A(t, 0, 1)) + A(t, 1);
|
|
813
821
|
}
|
|
814
|
-
function
|
|
815
|
-
return
|
|
822
|
+
function Cn(t) {
|
|
823
|
+
return J(A(t, 0, 1)) + A(t, 1);
|
|
816
824
|
}
|
|
817
|
-
function
|
|
825
|
+
function yt(t) {
|
|
818
826
|
return t.split(new RegExp("(?=\\p{Lu})", "u")).filter(Boolean);
|
|
819
827
|
}
|
|
820
|
-
function
|
|
828
|
+
function wt(t, n = ` \r
|
|
821
829
|
\f\v`) {
|
|
822
|
-
const e = x(n) ? n.join("") : n, r = (c) => c.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&"), s = e.length ? r(e) : "",
|
|
823
|
-
return t.replace(
|
|
830
|
+
const e = x(n) ? n.join("") : n, r = (c) => c.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&"), s = e.length ? r(e) : "", i = s.length ? `(?:\\s|[${s}])` : "\\s", o = new RegExp(`(^|${i})(\\p{Ll})`, "gu");
|
|
831
|
+
return t.replace(o, (c, f, l) => f + l.toUpperCase());
|
|
824
832
|
}
|
|
825
|
-
function
|
|
833
|
+
function En(t, n = null) {
|
|
826
834
|
const e = n && n.length > 0 ? n.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&") : "", r = e.length > 0 ? new RegExp(`[\\p{L}\\p{N}${e}]+`, "gu") : /[\p{L}\p{N}]+/gu, s = t.match(r);
|
|
827
835
|
return s ? s.length : 0;
|
|
828
836
|
}
|
|
829
|
-
function
|
|
837
|
+
function M(t) {
|
|
830
838
|
return t.trim() === "";
|
|
831
839
|
}
|
|
832
|
-
function
|
|
840
|
+
function H(t, n, e) {
|
|
833
841
|
let r = n;
|
|
834
|
-
for (; r < e &&
|
|
842
|
+
for (; r < e && M(t[r]); )
|
|
835
843
|
r++;
|
|
836
844
|
return r;
|
|
837
845
|
}
|
|
838
|
-
function
|
|
846
|
+
function St(t, n, e) {
|
|
839
847
|
let r = e;
|
|
840
|
-
for (; r > n &&
|
|
848
|
+
for (; r > n && M(t[r - 1]); )
|
|
841
849
|
r--;
|
|
842
850
|
return r;
|
|
843
851
|
}
|
|
@@ -845,154 +853,154 @@ function Ln(t, n = 75, e = `
|
|
|
845
853
|
`, r = !1) {
|
|
846
854
|
if (t.length === 0 || n < 1 || e === "")
|
|
847
855
|
return t;
|
|
848
|
-
const s = t.split(/\r\n|\n|\r/),
|
|
849
|
-
for (const
|
|
850
|
-
const c = [...
|
|
856
|
+
const s = t.split(/\r\n|\n|\r/), i = [];
|
|
857
|
+
for (const o of s) {
|
|
858
|
+
const c = [...o], f = c.length;
|
|
851
859
|
if (f === 0) {
|
|
852
|
-
|
|
860
|
+
i.push("");
|
|
853
861
|
continue;
|
|
854
862
|
}
|
|
855
863
|
let l = 0;
|
|
856
864
|
if (r) {
|
|
857
|
-
for (; l < f && (l =
|
|
865
|
+
for (; l < f && (l = H(c, l, f), l !== f); ) {
|
|
858
866
|
if (f - l <= n) {
|
|
859
|
-
|
|
867
|
+
i.push(c.slice(l, f).join(""));
|
|
860
868
|
break;
|
|
861
869
|
}
|
|
862
|
-
const m =
|
|
870
|
+
const m = St(
|
|
863
871
|
c,
|
|
864
872
|
l,
|
|
865
873
|
l + n
|
|
866
874
|
);
|
|
867
|
-
|
|
875
|
+
i.push(c.slice(l, m).join("")), l += n;
|
|
868
876
|
}
|
|
869
877
|
continue;
|
|
870
878
|
}
|
|
871
879
|
for (; f - l > n; ) {
|
|
872
|
-
const m =
|
|
880
|
+
const m = H(c, l, f);
|
|
873
881
|
if (m !== l && (l = m, f - l <= n))
|
|
874
882
|
break;
|
|
875
883
|
const a = Math.min(f, l + n + 1);
|
|
876
|
-
let
|
|
884
|
+
let p = -1;
|
|
877
885
|
for (let u = a - 1; u >= l; u--)
|
|
878
|
-
if (
|
|
879
|
-
|
|
886
|
+
if (M(c[u])) {
|
|
887
|
+
p = u;
|
|
880
888
|
break;
|
|
881
889
|
}
|
|
882
|
-
if (
|
|
883
|
-
|
|
890
|
+
if (p > l) {
|
|
891
|
+
i.push(c.slice(l, p).join("")), l = p + 1;
|
|
884
892
|
continue;
|
|
885
893
|
}
|
|
886
|
-
let
|
|
894
|
+
let g = -1;
|
|
887
895
|
for (let u = l; u < f; u++)
|
|
888
|
-
if (
|
|
889
|
-
|
|
896
|
+
if (M(c[u])) {
|
|
897
|
+
g = u;
|
|
890
898
|
break;
|
|
891
899
|
}
|
|
892
|
-
if (
|
|
893
|
-
|
|
900
|
+
if (g >= 0) {
|
|
901
|
+
i.push(c.slice(l, g).join("")), l = g + 1;
|
|
894
902
|
continue;
|
|
895
903
|
}
|
|
896
|
-
|
|
904
|
+
i.push(c.slice(l, f).join("")), l = f;
|
|
897
905
|
break;
|
|
898
906
|
}
|
|
899
|
-
f - l > 0 &&
|
|
907
|
+
f - l > 0 && i.push(c.slice(l, f).join(""));
|
|
900
908
|
}
|
|
901
|
-
return
|
|
909
|
+
return i.join(e);
|
|
902
910
|
}
|
|
903
|
-
function
|
|
911
|
+
function Rn() {
|
|
904
912
|
return F.size;
|
|
905
913
|
}
|
|
906
|
-
function
|
|
914
|
+
function Fn() {
|
|
907
915
|
return N.size;
|
|
908
916
|
}
|
|
909
|
-
function
|
|
917
|
+
function Nn() {
|
|
910
918
|
return _.size;
|
|
911
919
|
}
|
|
912
|
-
function
|
|
920
|
+
function _n() {
|
|
913
921
|
F.clear(), N.clear(), _.clear();
|
|
914
922
|
}
|
|
915
|
-
function
|
|
916
|
-
|
|
923
|
+
function zn() {
|
|
924
|
+
ut(), st(), it();
|
|
917
925
|
}
|
|
918
926
|
export {
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
927
|
+
Z as after,
|
|
928
|
+
Rt as afterLast,
|
|
929
|
+
Sn as apa,
|
|
930
|
+
ot as before,
|
|
931
|
+
ct as beforeLast,
|
|
932
|
+
Ft as between,
|
|
933
|
+
Nt as betweenFirst,
|
|
934
|
+
_t as camel,
|
|
935
|
+
Fn as camelCacheSize,
|
|
936
|
+
zt as charAt,
|
|
937
|
+
Ot as chopEnd,
|
|
938
|
+
Wt as chopStart,
|
|
939
|
+
K as contains,
|
|
940
|
+
Ut as containsAll,
|
|
941
|
+
ut as createRandomStringsNormally,
|
|
942
|
+
at as createRandomStringsUsing,
|
|
943
|
+
on as createRandomStringsUsingSequence,
|
|
944
|
+
Pt as deduplicate,
|
|
945
|
+
It as doesntContain,
|
|
946
|
+
jt as doesntEndWith,
|
|
947
|
+
An as doesntStartWith,
|
|
948
|
+
P as endsWith,
|
|
949
|
+
Mt as excerpt,
|
|
950
|
+
Tt as finish,
|
|
951
|
+
_n as flushCache,
|
|
952
|
+
yn as headline,
|
|
953
|
+
wn as initials,
|
|
954
|
+
Bt as is,
|
|
955
|
+
lt as isAscii,
|
|
956
|
+
Dt as isJson,
|
|
957
|
+
Xt as isMatch,
|
|
958
|
+
Ht as isUrl,
|
|
959
|
+
Jt as kebab,
|
|
960
|
+
dt as lcfirst,
|
|
961
|
+
W as length,
|
|
962
|
+
Zt as limit,
|
|
963
|
+
V as lower,
|
|
964
|
+
O as makePad,
|
|
965
|
+
Vt as mask,
|
|
966
|
+
Qt as match,
|
|
967
|
+
Yt as matchAll,
|
|
968
|
+
vt as numbers,
|
|
969
|
+
tn as padBoth,
|
|
970
|
+
nn as padLeft,
|
|
971
|
+
en as padRight,
|
|
972
|
+
kn as pascal,
|
|
973
|
+
rn as password,
|
|
974
|
+
sn as position,
|
|
975
|
+
ft as random,
|
|
976
|
+
gn as remove,
|
|
977
|
+
cn as repeat,
|
|
978
|
+
an as replace,
|
|
979
|
+
ln as replaceArray,
|
|
980
|
+
pn as replaceEnd,
|
|
981
|
+
pt as replaceFirst,
|
|
982
|
+
mt as replaceLast,
|
|
983
|
+
mn as replaceMatches,
|
|
984
|
+
un as replaceStart,
|
|
985
|
+
zn as resetFactoryState,
|
|
986
|
+
hn as reverse,
|
|
987
|
+
ht as snake,
|
|
988
|
+
Rn as snakeCacheSize,
|
|
989
|
+
xn as squish,
|
|
990
|
+
dn as start,
|
|
991
|
+
j as startsWith,
|
|
992
|
+
gt as stripTags,
|
|
993
|
+
X as studly,
|
|
994
|
+
Nn as studlyCacheSize,
|
|
987
995
|
$n as swap,
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
996
|
+
bn as take,
|
|
997
|
+
fn as toStringOr,
|
|
998
|
+
Cn as ucfirst,
|
|
999
|
+
yt as ucsplit,
|
|
1000
|
+
wt as ucwords,
|
|
1001
|
+
qt as unwrap,
|
|
1002
|
+
En as wordCount,
|
|
995
1003
|
Ln as wordWrap,
|
|
996
|
-
|
|
997
|
-
|
|
1004
|
+
Kt as words,
|
|
1005
|
+
Gt as wrap
|
|
998
1006
|
};
|