@tolki/str 1.6.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 +25 -5
- package/dist/str.d.ts.map +1 -1
- package/dist/str.js +353 -343
- 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,19 +1,19 @@
|
|
|
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));
|
|
@@ -25,29 +25,29 @@ function ot(t, n) {
|
|
|
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 :
|
|
33
|
-
}
|
|
34
|
-
function Rt(t, n, e) {
|
|
35
|
-
return n === "" || e === "" ? t : it(J(t, n), e);
|
|
32
|
+
return e === -1 ? t : A(t, 0, e);
|
|
36
33
|
}
|
|
37
34
|
function Ft(t, n, e) {
|
|
38
|
-
return n === "" || e === "" ? t :
|
|
35
|
+
return n === "" || e === "" ? t : ct(Z(t, n), e);
|
|
36
|
+
}
|
|
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 zt(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 Wt(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 Z(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]), p = String(l[3]), g =
|
|
80
|
-
let y =
|
|
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
81
|
y !== g && (y = s + y);
|
|
82
|
-
const h =
|
|
83
|
-
let
|
|
84
|
-
return
|
|
82
|
+
const h = B(p), d = A(h, 0, r);
|
|
83
|
+
let $ = B(d);
|
|
84
|
+
return $ !== h && ($ = $ + s), y + a + $;
|
|
85
85
|
}
|
|
86
|
-
function
|
|
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 Bt(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 Dt(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",
|
|
@@ -435,29 +440,29 @@ function en(t = 32, n = !0, e = !0, r = !0, s = !1) {
|
|
|
435
440
|
].filter((g) => x(g));
|
|
436
441
|
if (l.length === 0)
|
|
437
442
|
throw new Error("At least one character pool must be enabled.");
|
|
438
|
-
const m = l.flat(), a =
|
|
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(
|
|
439
444
|
{ length: Math.max(0, t - a.length) },
|
|
440
|
-
() => m[
|
|
445
|
+
() => m[I(0, m.length - 1)]
|
|
441
446
|
);
|
|
442
|
-
return
|
|
447
|
+
return D([...a, ...p]).join("");
|
|
443
448
|
}
|
|
444
|
-
function
|
|
449
|
+
function D(t) {
|
|
445
450
|
const n = [...t];
|
|
446
451
|
for (let e = n.length - 1; e > 0; e--) {
|
|
447
|
-
const r =
|
|
452
|
+
const r = I(0, e);
|
|
448
453
|
[n[e], n[r]] = [n[r], n[e]];
|
|
449
454
|
}
|
|
450
455
|
return n;
|
|
451
456
|
}
|
|
452
|
-
function
|
|
457
|
+
function sn(t, n, e = 0) {
|
|
453
458
|
if (n === "")
|
|
454
459
|
return !1;
|
|
455
460
|
const r = Array.from(t), s = Array.from(n);
|
|
456
|
-
let
|
|
457
|
-
if (
|
|
461
|
+
let i = e >= 0 ? e : r.length + e;
|
|
462
|
+
if (i < 0 && (i = 0), i >= r.length)
|
|
458
463
|
return !1;
|
|
459
|
-
const
|
|
460
|
-
for (let c =
|
|
464
|
+
const o = r.length - s.length;
|
|
465
|
+
for (let c = i; c <= o; c++) {
|
|
461
466
|
let f = !0;
|
|
462
467
|
for (let l = 0; l < s.length; l++)
|
|
463
468
|
if (r[c + l] !== s[l]) {
|
|
@@ -469,42 +474,42 @@ function rn(t, n, e = 0) {
|
|
|
469
474
|
}
|
|
470
475
|
return !1;
|
|
471
476
|
}
|
|
472
|
-
function
|
|
473
|
-
return (R ?? ((e) =>
|
|
477
|
+
function ft(t = 16) {
|
|
478
|
+
return (R ?? ((e) => et(e)))(t);
|
|
474
479
|
}
|
|
475
|
-
function
|
|
480
|
+
function at(t) {
|
|
476
481
|
R = t;
|
|
477
482
|
}
|
|
478
|
-
function
|
|
483
|
+
function on(t, n) {
|
|
479
484
|
let e = 0;
|
|
480
485
|
const r = n ?? function(s) {
|
|
481
|
-
const
|
|
486
|
+
const i = R;
|
|
482
487
|
R = null;
|
|
483
|
-
const
|
|
484
|
-
return R =
|
|
488
|
+
const o = ft(s);
|
|
489
|
+
return R = i, e++, o;
|
|
485
490
|
};
|
|
486
|
-
|
|
491
|
+
at((s) => e < t.length ? String(t[e++]) : r(s));
|
|
487
492
|
}
|
|
488
|
-
function
|
|
493
|
+
function ut() {
|
|
489
494
|
R = null;
|
|
490
495
|
}
|
|
491
|
-
function
|
|
496
|
+
function cn(t, n) {
|
|
492
497
|
return n <= 0 ? "" : t.repeat(n);
|
|
493
498
|
}
|
|
494
|
-
function
|
|
499
|
+
function ln(t, n, e) {
|
|
495
500
|
let r;
|
|
496
501
|
typeof n == "object" && !x(n) ? r = Object.values(n) : r = x(n) ? [...n] : Array.from(n);
|
|
497
502
|
const s = e.split(t);
|
|
498
503
|
if (s.length === 1)
|
|
499
504
|
return e;
|
|
500
|
-
let
|
|
501
|
-
for (let
|
|
505
|
+
let i = s[0];
|
|
506
|
+
for (let o = 1; o < s.length; o++) {
|
|
502
507
|
const c = r.length ? r.shift() : t;
|
|
503
|
-
|
|
508
|
+
i += c + s[o];
|
|
504
509
|
}
|
|
505
|
-
return String(
|
|
510
|
+
return String(i);
|
|
506
511
|
}
|
|
507
|
-
function
|
|
512
|
+
function fn(t, n) {
|
|
508
513
|
try {
|
|
509
514
|
const e = String(t);
|
|
510
515
|
if (e.length)
|
|
@@ -514,57 +519,57 @@ function ln(t, n) {
|
|
|
514
519
|
return n;
|
|
515
520
|
}
|
|
516
521
|
}
|
|
517
|
-
function
|
|
522
|
+
function an(t, n, e, r = !0) {
|
|
518
523
|
if (S(t) && !S(n))
|
|
519
524
|
throw new TypeError(
|
|
520
525
|
"The replacement must be a string when the search term is a string."
|
|
521
526
|
);
|
|
522
|
-
const s = S(e) ? e : Array.from(e, (f) =>
|
|
527
|
+
const s = S(e) ? e : Array.from(e, (f) => C(f));
|
|
523
528
|
if (!r)
|
|
524
|
-
return
|
|
529
|
+
return Q(
|
|
525
530
|
t,
|
|
526
531
|
n,
|
|
527
532
|
s
|
|
528
533
|
);
|
|
529
|
-
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);
|
|
530
535
|
return S(s) ? c(s) : s.map(c);
|
|
531
536
|
}
|
|
532
|
-
function
|
|
533
|
-
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) => {
|
|
534
539
|
if (l === "")
|
|
535
540
|
return f;
|
|
536
541
|
const a = s[m] ?? "", p = new RegExp(
|
|
537
|
-
|
|
538
|
-
|
|
542
|
+
i(l),
|
|
543
|
+
lt(l) ? "gi" : "giu"
|
|
539
544
|
);
|
|
540
545
|
return f.replace(p, () => a);
|
|
541
546
|
}, c);
|
|
542
|
-
return S(e) ?
|
|
547
|
+
return S(e) ? o(e) : e.map(o);
|
|
543
548
|
}
|
|
544
|
-
function
|
|
545
|
-
return
|
|
549
|
+
function C(t) {
|
|
550
|
+
return tt(t) || nt(t) ? "" : String(t);
|
|
546
551
|
}
|
|
547
|
-
function
|
|
552
|
+
function pt(t, n, e) {
|
|
548
553
|
if (t = String(t), t === "")
|
|
549
554
|
return e;
|
|
550
555
|
const r = e.indexOf(t);
|
|
551
556
|
return r !== -1 ? e.slice(0, r) + n + e.slice(r + t.length) : e;
|
|
552
557
|
}
|
|
553
|
-
function
|
|
554
|
-
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;
|
|
555
560
|
}
|
|
556
|
-
function
|
|
561
|
+
function mt(t, n, e) {
|
|
557
562
|
if (t = String(t), t === "")
|
|
558
563
|
return e;
|
|
559
564
|
const r = e.lastIndexOf(t);
|
|
560
565
|
return r !== -1 ? e.slice(0, r) + n + e.slice(r + t.length) : e;
|
|
561
566
|
}
|
|
562
|
-
function
|
|
563
|
-
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;
|
|
564
569
|
}
|
|
565
|
-
function
|
|
566
|
-
const s = (a) => x(a) ? a : [a],
|
|
567
|
-
function
|
|
570
|
+
function mn(t, n, e, r = -1) {
|
|
571
|
+
const s = (a) => x(a) ? a : [a], i = s(t);
|
|
572
|
+
function o(a) {
|
|
568
573
|
try {
|
|
569
574
|
if (a instanceof RegExp) {
|
|
570
575
|
let u = a.flags;
|
|
@@ -600,12 +605,12 @@ function pn(t, n, e, r = -1) {
|
|
|
600
605
|
}
|
|
601
606
|
}
|
|
602
607
|
const c = [];
|
|
603
|
-
for (const a of
|
|
604
|
-
const p =
|
|
608
|
+
for (const a of i) {
|
|
609
|
+
const p = o(a);
|
|
605
610
|
if (!p) return null;
|
|
606
611
|
c.push(p);
|
|
607
612
|
}
|
|
608
|
-
const f =
|
|
613
|
+
const f = Y(n), l = f ? [] : s(n), m = (a) => {
|
|
609
614
|
let p = a;
|
|
610
615
|
for (let g = 0; g < c.length; g++) {
|
|
611
616
|
const u = c[g];
|
|
@@ -617,21 +622,21 @@ function pn(t, n, e, r = -1) {
|
|
|
617
622
|
(h, ...d) => {
|
|
618
623
|
if (r >= 0 && w >= r) return h;
|
|
619
624
|
w++;
|
|
620
|
-
const
|
|
621
|
-
for (let b = 0; b <
|
|
622
|
-
|
|
623
|
-
const
|
|
624
|
-
return y(
|
|
625
|
+
const E = d.length > 0 && d[d.length - 1] !== null && typeof d[d.length - 1] == "object" ? d.length - 3 : d.length - 2, k = [];
|
|
626
|
+
for (let b = 0; b < E; b++)
|
|
627
|
+
k.push(d[b]);
|
|
628
|
+
const L = [h, ...k];
|
|
629
|
+
return y(L);
|
|
625
630
|
}
|
|
626
631
|
);
|
|
627
632
|
} else {
|
|
628
633
|
const w = l[g] ?? (l.length === 1 ? l[0] : "");
|
|
629
634
|
if (r < 0)
|
|
630
635
|
p = p.replace(u, (y, ...h) => {
|
|
631
|
-
const
|
|
632
|
-
return w.replace(/\$(\d{1,2})/g, (
|
|
633
|
-
const b = parseInt(
|
|
634
|
-
return (
|
|
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);
|
|
639
|
+
return (E[b - 1] ?? "").toUpperCase();
|
|
635
640
|
});
|
|
636
641
|
});
|
|
637
642
|
else {
|
|
@@ -639,10 +644,10 @@ function pn(t, n, e, r = -1) {
|
|
|
639
644
|
p = p.replace(u, (h, ...d) => {
|
|
640
645
|
if (y >= r) return h;
|
|
641
646
|
y++;
|
|
642
|
-
const
|
|
643
|
-
return w.replace(/\$(\d{1,2})/g, (
|
|
644
|
-
const
|
|
645
|
-
return (
|
|
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();
|
|
646
651
|
});
|
|
647
652
|
});
|
|
648
653
|
}
|
|
@@ -652,7 +657,7 @@ function pn(t, n, e, r = -1) {
|
|
|
652
657
|
};
|
|
653
658
|
return x(e) ? e.map(m) : m(e);
|
|
654
659
|
}
|
|
655
|
-
function
|
|
660
|
+
function gt(t) {
|
|
656
661
|
let n = "", e = !1;
|
|
657
662
|
for (let r = 0; r < t.length; r++) {
|
|
658
663
|
const s = t[r];
|
|
@@ -660,37 +665,42 @@ function mt(t) {
|
|
|
660
665
|
}
|
|
661
666
|
return n;
|
|
662
667
|
}
|
|
663
|
-
function
|
|
664
|
-
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));
|
|
665
670
|
if (!e)
|
|
666
|
-
return
|
|
667
|
-
const s = S(t) ? [t] : Array.from(t, (
|
|
668
|
-
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;
|
|
669
674
|
for (const f of s)
|
|
670
675
|
f !== "" && (c = c.split(f).join(""));
|
|
671
676
|
return c;
|
|
672
677
|
};
|
|
673
|
-
return S(r) ?
|
|
678
|
+
return S(r) ? i(r) : r.map(i);
|
|
674
679
|
}
|
|
675
|
-
function
|
|
680
|
+
function hn(t) {
|
|
676
681
|
return Array.from(t).reverse().join("");
|
|
677
682
|
}
|
|
678
|
-
function
|
|
679
|
-
const e =
|
|
680
|
-
|
|
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)}`;
|
|
681
691
|
}
|
|
682
|
-
function
|
|
692
|
+
function yn(t) {
|
|
683
693
|
const n = String(t).trim();
|
|
684
694
|
if (n === "")
|
|
685
695
|
return "";
|
|
686
696
|
let e = n.split(/\s+/u);
|
|
687
|
-
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(" ");
|
|
688
698
|
}
|
|
689
|
-
function
|
|
699
|
+
function wn(t, n = !1) {
|
|
690
700
|
const r = t.split(/\s+/u).filter((s) => s.length > 0).map((s) => [...s][0]).join("");
|
|
691
|
-
return n ?
|
|
701
|
+
return n ? J(r) : r;
|
|
692
702
|
}
|
|
693
|
-
function
|
|
703
|
+
function Sn(t) {
|
|
694
704
|
if (t.trim() === "")
|
|
695
705
|
return t;
|
|
696
706
|
const n = /* @__PURE__ */ new Set([
|
|
@@ -729,52 +739,52 @@ function wn(t) {
|
|
|
729
739
|
"des",
|
|
730
740
|
"par",
|
|
731
741
|
"à"
|
|
732
|
-
]), e = /* @__PURE__ */ new Set([".", "!", "?", ":", "—", ","]), r = t.split(/\s+/u), s = (
|
|
733
|
-
if (!
|
|
734
|
-
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("");
|
|
735
745
|
return c + f;
|
|
736
746
|
};
|
|
737
|
-
for (let
|
|
738
|
-
const
|
|
739
|
-
if (
|
|
740
|
-
const f =
|
|
741
|
-
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("-");
|
|
742
752
|
} else {
|
|
743
|
-
const c =
|
|
744
|
-
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);
|
|
745
755
|
}
|
|
746
756
|
}
|
|
747
757
|
return r.join(" ");
|
|
748
758
|
}
|
|
749
|
-
function
|
|
759
|
+
function ht(t, n = "_") {
|
|
750
760
|
const r = `${t}|${n}`;
|
|
751
761
|
if (F.has(r))
|
|
752
762
|
return F.get(r);
|
|
753
763
|
let s = t;
|
|
754
|
-
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;
|
|
755
765
|
}
|
|
756
|
-
function
|
|
757
|
-
return
|
|
766
|
+
function xn(t) {
|
|
767
|
+
return rt(t).replace(/[\s\u3164\u1160]+/gu, " ");
|
|
758
768
|
}
|
|
759
|
-
function
|
|
769
|
+
function j(t, n) {
|
|
760
770
|
if (t == null || n == null)
|
|
761
771
|
return !1;
|
|
762
772
|
let e;
|
|
763
|
-
S(n) ||
|
|
773
|
+
S(n) || v(n) ? e = [n] : Symbol.iterator in Object(n) ? e = Array.from(n) : e = [n];
|
|
764
774
|
const r = String(t);
|
|
765
775
|
for (const s of e) {
|
|
766
776
|
if (s == null)
|
|
767
777
|
continue;
|
|
768
|
-
const
|
|
769
|
-
if (
|
|
778
|
+
const i = String(s);
|
|
779
|
+
if (i !== "" && r.startsWith(i))
|
|
770
780
|
return !0;
|
|
771
781
|
}
|
|
772
782
|
return !1;
|
|
773
783
|
}
|
|
774
|
-
function
|
|
775
|
-
return !
|
|
784
|
+
function An(t, n) {
|
|
785
|
+
return !j(t, n);
|
|
776
786
|
}
|
|
777
|
-
function
|
|
787
|
+
function X(t, n = !1) {
|
|
778
788
|
let e = t;
|
|
779
789
|
n && (e = t.replace(
|
|
780
790
|
/(^|[-_ \s])([A-Z]+)(?=[-_ \s]|$)/gu,
|
|
@@ -783,59 +793,59 @@ function Q(t, n = !1) {
|
|
|
783
793
|
const r = e;
|
|
784
794
|
if (_.has(r))
|
|
785
795
|
return _.get(r);
|
|
786
|
-
const s = String(e).replace(/[-_]+/g, " "),
|
|
796
|
+
const s = String(e).replace(/[-_]+/g, " "), i = s.trim() === "" ? [] : s.split(/\s+/u), o = (f) => {
|
|
787
797
|
if (!f) return f;
|
|
788
798
|
const l = Array.from(f), m = l[0].toUpperCase(), a = l.slice(1).join("");
|
|
789
799
|
return m + a;
|
|
790
|
-
}, c =
|
|
800
|
+
}, c = i.map(o).join("");
|
|
791
801
|
return _.set(r, c), c;
|
|
792
802
|
}
|
|
793
|
-
function
|
|
794
|
-
return
|
|
803
|
+
function kn(t, n = !1) {
|
|
804
|
+
return X(t, n);
|
|
795
805
|
}
|
|
796
|
-
function
|
|
806
|
+
function $n(t, n) {
|
|
797
807
|
if (!t || Object.keys(t).length === 0)
|
|
798
808
|
return n;
|
|
799
|
-
const e = Object.keys(t).filter((
|
|
809
|
+
const e = Object.keys(t).filter((i) => i !== "");
|
|
800
810
|
if (e.length === 0)
|
|
801
811
|
return n;
|
|
802
|
-
e.sort((
|
|
803
|
-
const r = (
|
|
804
|
-
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]);
|
|
805
815
|
}
|
|
806
|
-
function
|
|
807
|
-
return n < 0 ?
|
|
816
|
+
function bn(t, n) {
|
|
817
|
+
return n < 0 ? A(t, n) : A(t, 0, n);
|
|
808
818
|
}
|
|
809
|
-
function
|
|
810
|
-
return
|
|
819
|
+
function dt(t) {
|
|
820
|
+
return V(A(t, 0, 1)) + A(t, 1);
|
|
811
821
|
}
|
|
812
|
-
function
|
|
813
|
-
return
|
|
822
|
+
function Cn(t) {
|
|
823
|
+
return J(A(t, 0, 1)) + A(t, 1);
|
|
814
824
|
}
|
|
815
|
-
function
|
|
825
|
+
function yt(t) {
|
|
816
826
|
return t.split(new RegExp("(?=\\p{Lu})", "u")).filter(Boolean);
|
|
817
827
|
}
|
|
818
|
-
function
|
|
828
|
+
function wt(t, n = ` \r
|
|
819
829
|
\f\v`) {
|
|
820
|
-
const e = x(n) ? n.join("") : n, r = (c) => c.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&"), s = e.length ? r(e) : "",
|
|
821
|
-
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());
|
|
822
832
|
}
|
|
823
833
|
function En(t, n = null) {
|
|
824
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);
|
|
825
835
|
return s ? s.length : 0;
|
|
826
836
|
}
|
|
827
|
-
function
|
|
837
|
+
function M(t) {
|
|
828
838
|
return t.trim() === "";
|
|
829
839
|
}
|
|
830
|
-
function
|
|
840
|
+
function H(t, n, e) {
|
|
831
841
|
let r = n;
|
|
832
|
-
for (; r < e &&
|
|
842
|
+
for (; r < e && M(t[r]); )
|
|
833
843
|
r++;
|
|
834
844
|
return r;
|
|
835
845
|
}
|
|
836
|
-
function
|
|
846
|
+
function St(t, n, e) {
|
|
837
847
|
let r = e;
|
|
838
|
-
for (; r > n &&
|
|
848
|
+
for (; r > n && M(t[r - 1]); )
|
|
839
849
|
r--;
|
|
840
850
|
return r;
|
|
841
851
|
}
|
|
@@ -843,154 +853,154 @@ function Ln(t, n = 75, e = `
|
|
|
843
853
|
`, r = !1) {
|
|
844
854
|
if (t.length === 0 || n < 1 || e === "")
|
|
845
855
|
return t;
|
|
846
|
-
const s = t.split(/\r\n|\n|\r/),
|
|
847
|
-
for (const
|
|
848
|
-
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;
|
|
849
859
|
if (f === 0) {
|
|
850
|
-
|
|
860
|
+
i.push("");
|
|
851
861
|
continue;
|
|
852
862
|
}
|
|
853
863
|
let l = 0;
|
|
854
864
|
if (r) {
|
|
855
|
-
for (; l < f && (l =
|
|
865
|
+
for (; l < f && (l = H(c, l, f), l !== f); ) {
|
|
856
866
|
if (f - l <= n) {
|
|
857
|
-
|
|
867
|
+
i.push(c.slice(l, f).join(""));
|
|
858
868
|
break;
|
|
859
869
|
}
|
|
860
|
-
const m =
|
|
870
|
+
const m = St(
|
|
861
871
|
c,
|
|
862
872
|
l,
|
|
863
873
|
l + n
|
|
864
874
|
);
|
|
865
|
-
|
|
875
|
+
i.push(c.slice(l, m).join("")), l += n;
|
|
866
876
|
}
|
|
867
877
|
continue;
|
|
868
878
|
}
|
|
869
879
|
for (; f - l > n; ) {
|
|
870
|
-
const m =
|
|
880
|
+
const m = H(c, l, f);
|
|
871
881
|
if (m !== l && (l = m, f - l <= n))
|
|
872
882
|
break;
|
|
873
883
|
const a = Math.min(f, l + n + 1);
|
|
874
884
|
let p = -1;
|
|
875
885
|
for (let u = a - 1; u >= l; u--)
|
|
876
|
-
if (
|
|
886
|
+
if (M(c[u])) {
|
|
877
887
|
p = u;
|
|
878
888
|
break;
|
|
879
889
|
}
|
|
880
890
|
if (p > l) {
|
|
881
|
-
|
|
891
|
+
i.push(c.slice(l, p).join("")), l = p + 1;
|
|
882
892
|
continue;
|
|
883
893
|
}
|
|
884
894
|
let g = -1;
|
|
885
895
|
for (let u = l; u < f; u++)
|
|
886
|
-
if (
|
|
896
|
+
if (M(c[u])) {
|
|
887
897
|
g = u;
|
|
888
898
|
break;
|
|
889
899
|
}
|
|
890
900
|
if (g >= 0) {
|
|
891
|
-
|
|
901
|
+
i.push(c.slice(l, g).join("")), l = g + 1;
|
|
892
902
|
continue;
|
|
893
903
|
}
|
|
894
|
-
|
|
904
|
+
i.push(c.slice(l, f).join("")), l = f;
|
|
895
905
|
break;
|
|
896
906
|
}
|
|
897
|
-
f - l > 0 &&
|
|
907
|
+
f - l > 0 && i.push(c.slice(l, f).join(""));
|
|
898
908
|
}
|
|
899
|
-
return
|
|
909
|
+
return i.join(e);
|
|
900
910
|
}
|
|
901
|
-
function
|
|
911
|
+
function Rn() {
|
|
902
912
|
return F.size;
|
|
903
913
|
}
|
|
904
|
-
function
|
|
914
|
+
function Fn() {
|
|
905
915
|
return N.size;
|
|
906
916
|
}
|
|
907
|
-
function
|
|
917
|
+
function Nn() {
|
|
908
918
|
return _.size;
|
|
909
919
|
}
|
|
910
|
-
function
|
|
920
|
+
function _n() {
|
|
911
921
|
F.clear(), N.clear(), _.clear();
|
|
912
922
|
}
|
|
913
|
-
function
|
|
914
|
-
|
|
923
|
+
function zn() {
|
|
924
|
+
ut(), st(), it();
|
|
915
925
|
}
|
|
916
926
|
export {
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
927
|
+
Z as after,
|
|
928
|
+
Rt as afterLast,
|
|
929
|
+
Sn as apa,
|
|
920
930
|
ot as before,
|
|
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
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
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,
|
|
995
|
+
$n as swap,
|
|
996
|
+
bn as take,
|
|
997
|
+
fn as toStringOr,
|
|
998
|
+
Cn as ucfirst,
|
|
999
|
+
yt as ucsplit,
|
|
1000
|
+
wt as ucwords,
|
|
1001
|
+
qt as unwrap,
|
|
992
1002
|
En as wordCount,
|
|
993
1003
|
Ln as wordWrap,
|
|
994
|
-
|
|
995
|
-
|
|
1004
|
+
Kt as words,
|
|
1005
|
+
Gt as wrap
|
|
996
1006
|
};
|