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