@jsrepo/mcp 0.0.1-beta.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/LICENSE +21 -0
- package/README.md +41 -0
- package/dist/index.js +8857 -0
- package/dist/sqids-BjCHarkR.js +684 -0
- package/package.json +54 -0
|
@@ -0,0 +1,684 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/sqids@0.3.0/node_modules/sqids/esm/sqids.js
|
|
2
|
+
const defaultOptions = {
|
|
3
|
+
alphabet: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
|
|
4
|
+
minLength: 0,
|
|
5
|
+
blocklist: new Set([
|
|
6
|
+
"0rgasm",
|
|
7
|
+
"1d10t",
|
|
8
|
+
"1d1ot",
|
|
9
|
+
"1di0t",
|
|
10
|
+
"1diot",
|
|
11
|
+
"1eccacu10",
|
|
12
|
+
"1eccacu1o",
|
|
13
|
+
"1eccacul0",
|
|
14
|
+
"1eccaculo",
|
|
15
|
+
"1mbec11e",
|
|
16
|
+
"1mbec1le",
|
|
17
|
+
"1mbeci1e",
|
|
18
|
+
"1mbecile",
|
|
19
|
+
"a11upat0",
|
|
20
|
+
"a11upato",
|
|
21
|
+
"a1lupat0",
|
|
22
|
+
"a1lupato",
|
|
23
|
+
"aand",
|
|
24
|
+
"ah01e",
|
|
25
|
+
"ah0le",
|
|
26
|
+
"aho1e",
|
|
27
|
+
"ahole",
|
|
28
|
+
"al1upat0",
|
|
29
|
+
"al1upato",
|
|
30
|
+
"allupat0",
|
|
31
|
+
"allupato",
|
|
32
|
+
"ana1",
|
|
33
|
+
"ana1e",
|
|
34
|
+
"anal",
|
|
35
|
+
"anale",
|
|
36
|
+
"anus",
|
|
37
|
+
"arrapat0",
|
|
38
|
+
"arrapato",
|
|
39
|
+
"arsch",
|
|
40
|
+
"arse",
|
|
41
|
+
"ass",
|
|
42
|
+
"b00b",
|
|
43
|
+
"b00be",
|
|
44
|
+
"b01ata",
|
|
45
|
+
"b0ceta",
|
|
46
|
+
"b0iata",
|
|
47
|
+
"b0ob",
|
|
48
|
+
"b0obe",
|
|
49
|
+
"b0sta",
|
|
50
|
+
"b1tch",
|
|
51
|
+
"b1te",
|
|
52
|
+
"b1tte",
|
|
53
|
+
"ba1atkar",
|
|
54
|
+
"balatkar",
|
|
55
|
+
"bastard0",
|
|
56
|
+
"bastardo",
|
|
57
|
+
"batt0na",
|
|
58
|
+
"battona",
|
|
59
|
+
"bitch",
|
|
60
|
+
"bite",
|
|
61
|
+
"bitte",
|
|
62
|
+
"bo0b",
|
|
63
|
+
"bo0be",
|
|
64
|
+
"bo1ata",
|
|
65
|
+
"boceta",
|
|
66
|
+
"boiata",
|
|
67
|
+
"boob",
|
|
68
|
+
"boobe",
|
|
69
|
+
"bosta",
|
|
70
|
+
"bran1age",
|
|
71
|
+
"bran1er",
|
|
72
|
+
"bran1ette",
|
|
73
|
+
"bran1eur",
|
|
74
|
+
"bran1euse",
|
|
75
|
+
"branlage",
|
|
76
|
+
"branler",
|
|
77
|
+
"branlette",
|
|
78
|
+
"branleur",
|
|
79
|
+
"branleuse",
|
|
80
|
+
"c0ck",
|
|
81
|
+
"c0g110ne",
|
|
82
|
+
"c0g11one",
|
|
83
|
+
"c0g1i0ne",
|
|
84
|
+
"c0g1ione",
|
|
85
|
+
"c0gl10ne",
|
|
86
|
+
"c0gl1one",
|
|
87
|
+
"c0gli0ne",
|
|
88
|
+
"c0glione",
|
|
89
|
+
"c0na",
|
|
90
|
+
"c0nnard",
|
|
91
|
+
"c0nnasse",
|
|
92
|
+
"c0nne",
|
|
93
|
+
"c0u111es",
|
|
94
|
+
"c0u11les",
|
|
95
|
+
"c0u1l1es",
|
|
96
|
+
"c0u1lles",
|
|
97
|
+
"c0ui11es",
|
|
98
|
+
"c0ui1les",
|
|
99
|
+
"c0uil1es",
|
|
100
|
+
"c0uilles",
|
|
101
|
+
"c11t",
|
|
102
|
+
"c11t0",
|
|
103
|
+
"c11to",
|
|
104
|
+
"c1it",
|
|
105
|
+
"c1it0",
|
|
106
|
+
"c1ito",
|
|
107
|
+
"cabr0n",
|
|
108
|
+
"cabra0",
|
|
109
|
+
"cabrao",
|
|
110
|
+
"cabron",
|
|
111
|
+
"caca",
|
|
112
|
+
"cacca",
|
|
113
|
+
"cacete",
|
|
114
|
+
"cagante",
|
|
115
|
+
"cagar",
|
|
116
|
+
"cagare",
|
|
117
|
+
"cagna",
|
|
118
|
+
"cara1h0",
|
|
119
|
+
"cara1ho",
|
|
120
|
+
"caracu10",
|
|
121
|
+
"caracu1o",
|
|
122
|
+
"caracul0",
|
|
123
|
+
"caraculo",
|
|
124
|
+
"caralh0",
|
|
125
|
+
"caralho",
|
|
126
|
+
"cazz0",
|
|
127
|
+
"cazz1mma",
|
|
128
|
+
"cazzata",
|
|
129
|
+
"cazzimma",
|
|
130
|
+
"cazzo",
|
|
131
|
+
"ch00t1a",
|
|
132
|
+
"ch00t1ya",
|
|
133
|
+
"ch00tia",
|
|
134
|
+
"ch00tiya",
|
|
135
|
+
"ch0d",
|
|
136
|
+
"ch0ot1a",
|
|
137
|
+
"ch0ot1ya",
|
|
138
|
+
"ch0otia",
|
|
139
|
+
"ch0otiya",
|
|
140
|
+
"ch1asse",
|
|
141
|
+
"ch1avata",
|
|
142
|
+
"ch1er",
|
|
143
|
+
"ch1ng0",
|
|
144
|
+
"ch1ngadaz0s",
|
|
145
|
+
"ch1ngadazos",
|
|
146
|
+
"ch1ngader1ta",
|
|
147
|
+
"ch1ngaderita",
|
|
148
|
+
"ch1ngar",
|
|
149
|
+
"ch1ngo",
|
|
150
|
+
"ch1ngues",
|
|
151
|
+
"ch1nk",
|
|
152
|
+
"chatte",
|
|
153
|
+
"chiasse",
|
|
154
|
+
"chiavata",
|
|
155
|
+
"chier",
|
|
156
|
+
"ching0",
|
|
157
|
+
"chingadaz0s",
|
|
158
|
+
"chingadazos",
|
|
159
|
+
"chingader1ta",
|
|
160
|
+
"chingaderita",
|
|
161
|
+
"chingar",
|
|
162
|
+
"chingo",
|
|
163
|
+
"chingues",
|
|
164
|
+
"chink",
|
|
165
|
+
"cho0t1a",
|
|
166
|
+
"cho0t1ya",
|
|
167
|
+
"cho0tia",
|
|
168
|
+
"cho0tiya",
|
|
169
|
+
"chod",
|
|
170
|
+
"choot1a",
|
|
171
|
+
"choot1ya",
|
|
172
|
+
"chootia",
|
|
173
|
+
"chootiya",
|
|
174
|
+
"cl1t",
|
|
175
|
+
"cl1t0",
|
|
176
|
+
"cl1to",
|
|
177
|
+
"clit",
|
|
178
|
+
"clit0",
|
|
179
|
+
"clito",
|
|
180
|
+
"cock",
|
|
181
|
+
"cog110ne",
|
|
182
|
+
"cog11one",
|
|
183
|
+
"cog1i0ne",
|
|
184
|
+
"cog1ione",
|
|
185
|
+
"cogl10ne",
|
|
186
|
+
"cogl1one",
|
|
187
|
+
"cogli0ne",
|
|
188
|
+
"coglione",
|
|
189
|
+
"cona",
|
|
190
|
+
"connard",
|
|
191
|
+
"connasse",
|
|
192
|
+
"conne",
|
|
193
|
+
"cou111es",
|
|
194
|
+
"cou11les",
|
|
195
|
+
"cou1l1es",
|
|
196
|
+
"cou1lles",
|
|
197
|
+
"coui11es",
|
|
198
|
+
"coui1les",
|
|
199
|
+
"couil1es",
|
|
200
|
+
"couilles",
|
|
201
|
+
"cracker",
|
|
202
|
+
"crap",
|
|
203
|
+
"cu10",
|
|
204
|
+
"cu1att0ne",
|
|
205
|
+
"cu1attone",
|
|
206
|
+
"cu1er0",
|
|
207
|
+
"cu1ero",
|
|
208
|
+
"cu1o",
|
|
209
|
+
"cul0",
|
|
210
|
+
"culatt0ne",
|
|
211
|
+
"culattone",
|
|
212
|
+
"culer0",
|
|
213
|
+
"culero",
|
|
214
|
+
"culo",
|
|
215
|
+
"cum",
|
|
216
|
+
"cunt",
|
|
217
|
+
"d11d0",
|
|
218
|
+
"d11do",
|
|
219
|
+
"d1ck",
|
|
220
|
+
"d1ld0",
|
|
221
|
+
"d1ldo",
|
|
222
|
+
"damn",
|
|
223
|
+
"de1ch",
|
|
224
|
+
"deich",
|
|
225
|
+
"depp",
|
|
226
|
+
"di1d0",
|
|
227
|
+
"di1do",
|
|
228
|
+
"dick",
|
|
229
|
+
"dild0",
|
|
230
|
+
"dildo",
|
|
231
|
+
"dyke",
|
|
232
|
+
"encu1e",
|
|
233
|
+
"encule",
|
|
234
|
+
"enema",
|
|
235
|
+
"enf01re",
|
|
236
|
+
"enf0ire",
|
|
237
|
+
"enfo1re",
|
|
238
|
+
"enfoire",
|
|
239
|
+
"estup1d0",
|
|
240
|
+
"estup1do",
|
|
241
|
+
"estupid0",
|
|
242
|
+
"estupido",
|
|
243
|
+
"etr0n",
|
|
244
|
+
"etron",
|
|
245
|
+
"f0da",
|
|
246
|
+
"f0der",
|
|
247
|
+
"f0ttere",
|
|
248
|
+
"f0tters1",
|
|
249
|
+
"f0ttersi",
|
|
250
|
+
"f0tze",
|
|
251
|
+
"f0utre",
|
|
252
|
+
"f1ca",
|
|
253
|
+
"f1cker",
|
|
254
|
+
"f1ga",
|
|
255
|
+
"fag",
|
|
256
|
+
"fica",
|
|
257
|
+
"ficker",
|
|
258
|
+
"figa",
|
|
259
|
+
"foda",
|
|
260
|
+
"foder",
|
|
261
|
+
"fottere",
|
|
262
|
+
"fotters1",
|
|
263
|
+
"fottersi",
|
|
264
|
+
"fotze",
|
|
265
|
+
"foutre",
|
|
266
|
+
"fr0c10",
|
|
267
|
+
"fr0c1o",
|
|
268
|
+
"fr0ci0",
|
|
269
|
+
"fr0cio",
|
|
270
|
+
"fr0sc10",
|
|
271
|
+
"fr0sc1o",
|
|
272
|
+
"fr0sci0",
|
|
273
|
+
"fr0scio",
|
|
274
|
+
"froc10",
|
|
275
|
+
"froc1o",
|
|
276
|
+
"froci0",
|
|
277
|
+
"frocio",
|
|
278
|
+
"frosc10",
|
|
279
|
+
"frosc1o",
|
|
280
|
+
"frosci0",
|
|
281
|
+
"froscio",
|
|
282
|
+
"fuck",
|
|
283
|
+
"g00",
|
|
284
|
+
"g0o",
|
|
285
|
+
"g0u1ne",
|
|
286
|
+
"g0uine",
|
|
287
|
+
"gandu",
|
|
288
|
+
"go0",
|
|
289
|
+
"goo",
|
|
290
|
+
"gou1ne",
|
|
291
|
+
"gouine",
|
|
292
|
+
"gr0gnasse",
|
|
293
|
+
"grognasse",
|
|
294
|
+
"haram1",
|
|
295
|
+
"harami",
|
|
296
|
+
"haramzade",
|
|
297
|
+
"hund1n",
|
|
298
|
+
"hundin",
|
|
299
|
+
"id10t",
|
|
300
|
+
"id1ot",
|
|
301
|
+
"idi0t",
|
|
302
|
+
"idiot",
|
|
303
|
+
"imbec11e",
|
|
304
|
+
"imbec1le",
|
|
305
|
+
"imbeci1e",
|
|
306
|
+
"imbecile",
|
|
307
|
+
"j1zz",
|
|
308
|
+
"jerk",
|
|
309
|
+
"jizz",
|
|
310
|
+
"k1ke",
|
|
311
|
+
"kam1ne",
|
|
312
|
+
"kamine",
|
|
313
|
+
"kike",
|
|
314
|
+
"leccacu10",
|
|
315
|
+
"leccacu1o",
|
|
316
|
+
"leccacul0",
|
|
317
|
+
"leccaculo",
|
|
318
|
+
"m1erda",
|
|
319
|
+
"m1gn0tta",
|
|
320
|
+
"m1gnotta",
|
|
321
|
+
"m1nch1a",
|
|
322
|
+
"m1nchia",
|
|
323
|
+
"m1st",
|
|
324
|
+
"mam0n",
|
|
325
|
+
"mamahuev0",
|
|
326
|
+
"mamahuevo",
|
|
327
|
+
"mamon",
|
|
328
|
+
"masturbat10n",
|
|
329
|
+
"masturbat1on",
|
|
330
|
+
"masturbate",
|
|
331
|
+
"masturbati0n",
|
|
332
|
+
"masturbation",
|
|
333
|
+
"merd0s0",
|
|
334
|
+
"merd0so",
|
|
335
|
+
"merda",
|
|
336
|
+
"merde",
|
|
337
|
+
"merdos0",
|
|
338
|
+
"merdoso",
|
|
339
|
+
"mierda",
|
|
340
|
+
"mign0tta",
|
|
341
|
+
"mignotta",
|
|
342
|
+
"minch1a",
|
|
343
|
+
"minchia",
|
|
344
|
+
"mist",
|
|
345
|
+
"musch1",
|
|
346
|
+
"muschi",
|
|
347
|
+
"n1gger",
|
|
348
|
+
"neger",
|
|
349
|
+
"negr0",
|
|
350
|
+
"negre",
|
|
351
|
+
"negro",
|
|
352
|
+
"nerch1a",
|
|
353
|
+
"nerchia",
|
|
354
|
+
"nigger",
|
|
355
|
+
"orgasm",
|
|
356
|
+
"p00p",
|
|
357
|
+
"p011a",
|
|
358
|
+
"p01la",
|
|
359
|
+
"p0l1a",
|
|
360
|
+
"p0lla",
|
|
361
|
+
"p0mp1n0",
|
|
362
|
+
"p0mp1no",
|
|
363
|
+
"p0mpin0",
|
|
364
|
+
"p0mpino",
|
|
365
|
+
"p0op",
|
|
366
|
+
"p0rca",
|
|
367
|
+
"p0rn",
|
|
368
|
+
"p0rra",
|
|
369
|
+
"p0uff1asse",
|
|
370
|
+
"p0uffiasse",
|
|
371
|
+
"p1p1",
|
|
372
|
+
"p1pi",
|
|
373
|
+
"p1r1a",
|
|
374
|
+
"p1rla",
|
|
375
|
+
"p1sc10",
|
|
376
|
+
"p1sc1o",
|
|
377
|
+
"p1sci0",
|
|
378
|
+
"p1scio",
|
|
379
|
+
"p1sser",
|
|
380
|
+
"pa11e",
|
|
381
|
+
"pa1le",
|
|
382
|
+
"pal1e",
|
|
383
|
+
"palle",
|
|
384
|
+
"pane1e1r0",
|
|
385
|
+
"pane1e1ro",
|
|
386
|
+
"pane1eir0",
|
|
387
|
+
"pane1eiro",
|
|
388
|
+
"panele1r0",
|
|
389
|
+
"panele1ro",
|
|
390
|
+
"paneleir0",
|
|
391
|
+
"paneleiro",
|
|
392
|
+
"patakha",
|
|
393
|
+
"pec0r1na",
|
|
394
|
+
"pec0rina",
|
|
395
|
+
"pecor1na",
|
|
396
|
+
"pecorina",
|
|
397
|
+
"pen1s",
|
|
398
|
+
"pendej0",
|
|
399
|
+
"pendejo",
|
|
400
|
+
"penis",
|
|
401
|
+
"pip1",
|
|
402
|
+
"pipi",
|
|
403
|
+
"pir1a",
|
|
404
|
+
"pirla",
|
|
405
|
+
"pisc10",
|
|
406
|
+
"pisc1o",
|
|
407
|
+
"pisci0",
|
|
408
|
+
"piscio",
|
|
409
|
+
"pisser",
|
|
410
|
+
"po0p",
|
|
411
|
+
"po11a",
|
|
412
|
+
"po1la",
|
|
413
|
+
"pol1a",
|
|
414
|
+
"polla",
|
|
415
|
+
"pomp1n0",
|
|
416
|
+
"pomp1no",
|
|
417
|
+
"pompin0",
|
|
418
|
+
"pompino",
|
|
419
|
+
"poop",
|
|
420
|
+
"porca",
|
|
421
|
+
"porn",
|
|
422
|
+
"porra",
|
|
423
|
+
"pouff1asse",
|
|
424
|
+
"pouffiasse",
|
|
425
|
+
"pr1ck",
|
|
426
|
+
"prick",
|
|
427
|
+
"pussy",
|
|
428
|
+
"put1za",
|
|
429
|
+
"puta",
|
|
430
|
+
"puta1n",
|
|
431
|
+
"putain",
|
|
432
|
+
"pute",
|
|
433
|
+
"putiza",
|
|
434
|
+
"puttana",
|
|
435
|
+
"queca",
|
|
436
|
+
"r0mp1ba11e",
|
|
437
|
+
"r0mp1ba1le",
|
|
438
|
+
"r0mp1bal1e",
|
|
439
|
+
"r0mp1balle",
|
|
440
|
+
"r0mpiba11e",
|
|
441
|
+
"r0mpiba1le",
|
|
442
|
+
"r0mpibal1e",
|
|
443
|
+
"r0mpiballe",
|
|
444
|
+
"rand1",
|
|
445
|
+
"randi",
|
|
446
|
+
"rape",
|
|
447
|
+
"recch10ne",
|
|
448
|
+
"recch1one",
|
|
449
|
+
"recchi0ne",
|
|
450
|
+
"recchione",
|
|
451
|
+
"retard",
|
|
452
|
+
"romp1ba11e",
|
|
453
|
+
"romp1ba1le",
|
|
454
|
+
"romp1bal1e",
|
|
455
|
+
"romp1balle",
|
|
456
|
+
"rompiba11e",
|
|
457
|
+
"rompiba1le",
|
|
458
|
+
"rompibal1e",
|
|
459
|
+
"rompiballe",
|
|
460
|
+
"ruff1an0",
|
|
461
|
+
"ruff1ano",
|
|
462
|
+
"ruffian0",
|
|
463
|
+
"ruffiano",
|
|
464
|
+
"s1ut",
|
|
465
|
+
"sa10pe",
|
|
466
|
+
"sa1aud",
|
|
467
|
+
"sa1ope",
|
|
468
|
+
"sacanagem",
|
|
469
|
+
"sal0pe",
|
|
470
|
+
"salaud",
|
|
471
|
+
"salope",
|
|
472
|
+
"saugnapf",
|
|
473
|
+
"sb0rr0ne",
|
|
474
|
+
"sb0rra",
|
|
475
|
+
"sb0rrone",
|
|
476
|
+
"sbattere",
|
|
477
|
+
"sbatters1",
|
|
478
|
+
"sbattersi",
|
|
479
|
+
"sborr0ne",
|
|
480
|
+
"sborra",
|
|
481
|
+
"sborrone",
|
|
482
|
+
"sc0pare",
|
|
483
|
+
"sc0pata",
|
|
484
|
+
"sch1ampe",
|
|
485
|
+
"sche1se",
|
|
486
|
+
"sche1sse",
|
|
487
|
+
"scheise",
|
|
488
|
+
"scheisse",
|
|
489
|
+
"schlampe",
|
|
490
|
+
"schwachs1nn1g",
|
|
491
|
+
"schwachs1nnig",
|
|
492
|
+
"schwachsinn1g",
|
|
493
|
+
"schwachsinnig",
|
|
494
|
+
"schwanz",
|
|
495
|
+
"scopare",
|
|
496
|
+
"scopata",
|
|
497
|
+
"sexy",
|
|
498
|
+
"sh1t",
|
|
499
|
+
"shit",
|
|
500
|
+
"slut",
|
|
501
|
+
"sp0mp1nare",
|
|
502
|
+
"sp0mpinare",
|
|
503
|
+
"spomp1nare",
|
|
504
|
+
"spompinare",
|
|
505
|
+
"str0nz0",
|
|
506
|
+
"str0nza",
|
|
507
|
+
"str0nzo",
|
|
508
|
+
"stronz0",
|
|
509
|
+
"stronza",
|
|
510
|
+
"stronzo",
|
|
511
|
+
"stup1d",
|
|
512
|
+
"stupid",
|
|
513
|
+
"succh1am1",
|
|
514
|
+
"succh1ami",
|
|
515
|
+
"succhiam1",
|
|
516
|
+
"succhiami",
|
|
517
|
+
"sucker",
|
|
518
|
+
"t0pa",
|
|
519
|
+
"tapette",
|
|
520
|
+
"test1c1e",
|
|
521
|
+
"test1cle",
|
|
522
|
+
"testic1e",
|
|
523
|
+
"testicle",
|
|
524
|
+
"tette",
|
|
525
|
+
"topa",
|
|
526
|
+
"tr01a",
|
|
527
|
+
"tr0ia",
|
|
528
|
+
"tr0mbare",
|
|
529
|
+
"tr1ng1er",
|
|
530
|
+
"tr1ngler",
|
|
531
|
+
"tring1er",
|
|
532
|
+
"tringler",
|
|
533
|
+
"tro1a",
|
|
534
|
+
"troia",
|
|
535
|
+
"trombare",
|
|
536
|
+
"turd",
|
|
537
|
+
"twat",
|
|
538
|
+
"vaffancu10",
|
|
539
|
+
"vaffancu1o",
|
|
540
|
+
"vaffancul0",
|
|
541
|
+
"vaffanculo",
|
|
542
|
+
"vag1na",
|
|
543
|
+
"vagina",
|
|
544
|
+
"verdammt",
|
|
545
|
+
"verga",
|
|
546
|
+
"w1chsen",
|
|
547
|
+
"wank",
|
|
548
|
+
"wichsen",
|
|
549
|
+
"x0ch0ta",
|
|
550
|
+
"x0chota",
|
|
551
|
+
"xana",
|
|
552
|
+
"xoch0ta",
|
|
553
|
+
"xochota",
|
|
554
|
+
"z0cc01a",
|
|
555
|
+
"z0cc0la",
|
|
556
|
+
"z0cco1a",
|
|
557
|
+
"z0ccola",
|
|
558
|
+
"z1z1",
|
|
559
|
+
"z1zi",
|
|
560
|
+
"ziz1",
|
|
561
|
+
"zizi",
|
|
562
|
+
"zocc01a",
|
|
563
|
+
"zocc0la",
|
|
564
|
+
"zocco1a",
|
|
565
|
+
"zoccola"
|
|
566
|
+
])
|
|
567
|
+
};
|
|
568
|
+
var Sqids = class {
|
|
569
|
+
constructor(options) {
|
|
570
|
+
var _a, _b, _c;
|
|
571
|
+
const alphabet = (_a = options === null || options === void 0 ? void 0 : options.alphabet) !== null && _a !== void 0 ? _a : defaultOptions.alphabet;
|
|
572
|
+
const minLength = (_b = options === null || options === void 0 ? void 0 : options.minLength) !== null && _b !== void 0 ? _b : defaultOptions.minLength;
|
|
573
|
+
const blocklist = (_c = options === null || options === void 0 ? void 0 : options.blocklist) !== null && _c !== void 0 ? _c : defaultOptions.blocklist;
|
|
574
|
+
if (new Blob([alphabet]).size !== alphabet.length) throw new Error("Alphabet cannot contain multibyte characters");
|
|
575
|
+
const minAlphabetLength = 3;
|
|
576
|
+
if (alphabet.length < minAlphabetLength) throw new Error(`Alphabet length must be at least ${minAlphabetLength}`);
|
|
577
|
+
if (new Set(alphabet).size !== alphabet.length) throw new Error("Alphabet must contain unique characters");
|
|
578
|
+
const minLengthLimit = 255;
|
|
579
|
+
if (typeof minLength !== "number" || minLength < 0 || minLength > minLengthLimit) throw new Error(`Minimum length has to be between 0 and ${minLengthLimit}`);
|
|
580
|
+
const filteredBlocklist = /* @__PURE__ */ new Set();
|
|
581
|
+
const alphabetChars = alphabet.toLowerCase().split("");
|
|
582
|
+
for (const word of blocklist) if (word.length >= 3) {
|
|
583
|
+
const wordLowercased = word.toLowerCase();
|
|
584
|
+
const wordChars = wordLowercased.split("");
|
|
585
|
+
if (wordChars.filter((c) => alphabetChars.includes(c)).length === wordChars.length) filteredBlocklist.add(wordLowercased);
|
|
586
|
+
}
|
|
587
|
+
this.alphabet = this.shuffle(alphabet);
|
|
588
|
+
this.minLength = minLength;
|
|
589
|
+
this.blocklist = filteredBlocklist;
|
|
590
|
+
}
|
|
591
|
+
encode(numbers) {
|
|
592
|
+
if (numbers.length === 0) return "";
|
|
593
|
+
if (numbers.filter((n) => n >= 0 && n <= this.maxValue()).length !== numbers.length) throw new Error(`Encoding supports numbers between 0 and ${this.maxValue()}`);
|
|
594
|
+
return this.encodeNumbers(numbers);
|
|
595
|
+
}
|
|
596
|
+
decode(id) {
|
|
597
|
+
const ret = [];
|
|
598
|
+
if (id === "") return ret;
|
|
599
|
+
const alphabetChars = this.alphabet.split("");
|
|
600
|
+
for (const c of id.split("")) if (!alphabetChars.includes(c)) return ret;
|
|
601
|
+
const prefix = id.charAt(0);
|
|
602
|
+
const offset = this.alphabet.indexOf(prefix);
|
|
603
|
+
let alphabet = this.alphabet.slice(offset) + this.alphabet.slice(0, offset);
|
|
604
|
+
alphabet = alphabet.split("").reverse().join("");
|
|
605
|
+
let slicedId = id.slice(1);
|
|
606
|
+
while (slicedId.length > 0) {
|
|
607
|
+
const separator = alphabet.slice(0, 1);
|
|
608
|
+
const chunks = slicedId.split(separator);
|
|
609
|
+
if (chunks.length > 0) {
|
|
610
|
+
if (chunks[0] === "") return ret;
|
|
611
|
+
ret.push(this.toNumber(chunks[0], alphabet.slice(1)));
|
|
612
|
+
if (chunks.length > 1) alphabet = this.shuffle(alphabet);
|
|
613
|
+
}
|
|
614
|
+
slicedId = chunks.slice(1).join(separator);
|
|
615
|
+
}
|
|
616
|
+
return ret;
|
|
617
|
+
}
|
|
618
|
+
encodeNumbers(numbers, increment = 0) {
|
|
619
|
+
if (increment > this.alphabet.length) throw new Error("Reached max attempts to re-generate the ID");
|
|
620
|
+
let offset = numbers.reduce((a, v, i) => this.alphabet[v % this.alphabet.length].codePointAt(0) + i + a, numbers.length) % this.alphabet.length;
|
|
621
|
+
offset = (offset + increment) % this.alphabet.length;
|
|
622
|
+
let alphabet = this.alphabet.slice(offset) + this.alphabet.slice(0, offset);
|
|
623
|
+
const prefix = alphabet.charAt(0);
|
|
624
|
+
alphabet = alphabet.split("").reverse().join("");
|
|
625
|
+
const ret = [prefix];
|
|
626
|
+
for (let i = 0; i !== numbers.length; i++) {
|
|
627
|
+
const num = numbers[i];
|
|
628
|
+
ret.push(this.toId(num, alphabet.slice(1)));
|
|
629
|
+
if (i < numbers.length - 1) {
|
|
630
|
+
ret.push(alphabet.slice(0, 1));
|
|
631
|
+
alphabet = this.shuffle(alphabet);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
let id = ret.join("");
|
|
635
|
+
if (this.minLength > id.length) {
|
|
636
|
+
id += alphabet.slice(0, 1);
|
|
637
|
+
while (this.minLength - id.length > 0) {
|
|
638
|
+
alphabet = this.shuffle(alphabet);
|
|
639
|
+
id += alphabet.slice(0, Math.min(this.minLength - id.length, alphabet.length));
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
if (this.isBlockedId(id)) id = this.encodeNumbers(numbers, increment + 1);
|
|
643
|
+
return id;
|
|
644
|
+
}
|
|
645
|
+
shuffle(alphabet) {
|
|
646
|
+
const chars = alphabet.split("");
|
|
647
|
+
for (let i = 0, j = chars.length - 1; j > 0; i++, j--) {
|
|
648
|
+
const r = (i * j + chars[i].codePointAt(0) + chars[j].codePointAt(0)) % chars.length;
|
|
649
|
+
[chars[i], chars[r]] = [chars[r], chars[i]];
|
|
650
|
+
}
|
|
651
|
+
return chars.join("");
|
|
652
|
+
}
|
|
653
|
+
toId(num, alphabet) {
|
|
654
|
+
const id = [];
|
|
655
|
+
const chars = alphabet.split("");
|
|
656
|
+
let result = num;
|
|
657
|
+
do {
|
|
658
|
+
id.unshift(chars[result % chars.length]);
|
|
659
|
+
result = Math.floor(result / chars.length);
|
|
660
|
+
} while (result > 0);
|
|
661
|
+
return id.join("");
|
|
662
|
+
}
|
|
663
|
+
toNumber(id, alphabet) {
|
|
664
|
+
const chars = alphabet.split("");
|
|
665
|
+
return id.split("").reduce((a, v) => a * chars.length + chars.indexOf(v), 0);
|
|
666
|
+
}
|
|
667
|
+
isBlockedId(id) {
|
|
668
|
+
const lowercaseId = id.toLowerCase();
|
|
669
|
+
for (const word of this.blocklist) if (word.length <= lowercaseId.length) {
|
|
670
|
+
if (lowercaseId.length <= 3 || word.length <= 3) {
|
|
671
|
+
if (lowercaseId === word) return true;
|
|
672
|
+
} else if (/\d/.test(word)) {
|
|
673
|
+
if (lowercaseId.startsWith(word) || lowercaseId.endsWith(word)) return true;
|
|
674
|
+
} else if (lowercaseId.includes(word)) return true;
|
|
675
|
+
}
|
|
676
|
+
return false;
|
|
677
|
+
}
|
|
678
|
+
maxValue() {
|
|
679
|
+
return Number.MAX_SAFE_INTEGER;
|
|
680
|
+
}
|
|
681
|
+
};
|
|
682
|
+
|
|
683
|
+
//#endregion
|
|
684
|
+
export { Sqids as default, defaultOptions };
|