@vope/utils 1.6.0 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -20,23 +20,43 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ Cron: () => Cron,
24
+ DayLastValue: () => DayLastValue,
25
+ DigitsValue: () => DigitsValue,
23
26
  FlexTable: () => FlexTable,
27
+ InvalidValue: () => InvalidValue,
24
28
  MemoryBasic: () => MemoryBasic,
25
29
  MemoryList: () => MemoryList,
26
30
  MemoryPower: () => MemoryPower,
27
31
  MemorySimple: () => MemorySimple,
28
32
  Neo4j: () => Neo4j,
29
33
  Neo4jAhchors: () => Neo4jAhchors,
34
+ RangeValue: () => RangeValue,
30
35
  Subscriber: () => Subscriber,
31
36
  Union: () => Union,
37
+ WeekLastValue: () => WeekLastValue,
38
+ WildcardValue: () => WildcardValue,
32
39
  clamp: () => clamp,
33
40
  classnames: () => classnames,
34
41
  compareVersion: () => compareVersion,
35
42
  connectURLParams: () => connectURLParams,
43
+ createCronRegexText: () => createCronRegexText,
36
44
  css: () => css,
37
45
  cubeURLParams: () => cubeURLParams,
38
46
  deconPowersSum: () => deconPowersSum,
39
47
  deepWeakEqual: () => deepWeakEqual,
48
+ default_max_day: () => default_max_day,
49
+ default_max_hour: () => default_max_hour,
50
+ default_max_minute: () => default_max_minute,
51
+ default_max_month: () => default_max_month,
52
+ default_max_second: () => default_max_second,
53
+ default_max_week: () => default_max_week,
54
+ default_min_day: () => default_min_day,
55
+ default_min_hour: () => default_min_hour,
56
+ default_min_minute: () => default_min_minute,
57
+ default_min_month: () => default_min_month,
58
+ default_min_second: () => default_min_second,
59
+ default_min_week: () => default_min_week,
40
60
  desensDecrypt: () => desensDecrypt,
41
61
  desensEncrypt: () => desensEncrypt,
42
62
  desensReplace: () => desensReplace,
@@ -47,16 +67,23 @@ __export(index_exports, {
47
67
  hash8strings: () => hash8strings,
48
68
  inputRegex: () => inputRegex,
49
69
  isClass: () => isClass,
70
+ isDayLastValue: () => isDayLastValue,
71
+ isDigitsValue: () => isDigitsValue,
50
72
  isEmpty: () => isEmpty,
73
+ isInvalidValue: () => isInvalidValue,
51
74
  isKey: () => isKey,
52
75
  isNull: () => isNull,
76
+ isRangeValue: () => isRangeValue,
77
+ isWeekLastValue: () => isWeekLastValue,
78
+ isWildcardValue: () => isWildcardValue,
53
79
  joinPaths: () => joinPaths,
54
80
  loadImage: () => loadImage,
55
81
  once: () => once,
56
82
  parseNum: () => parseNum,
57
83
  rotateAngle: () => rotateAngle,
58
84
  rotateRad: () => rotateRad,
59
- wait: () => wait
85
+ wait: () => wait,
86
+ weekDic: () => weekDic
60
87
  });
61
88
  module.exports = __toCommonJS(index_exports);
62
89
 
@@ -149,8 +176,654 @@ var hash8object = (list, key) => list.reduce((caches, data) => {
149
176
  return caches;
150
177
  }, /* @__PURE__ */ new Map());
151
178
 
152
- // src/desens.ts
179
+ // src/cron.ts
153
180
  var import_lodash_es2 = require("lodash-es");
181
+ var {
182
+ parseInt,
183
+ isInteger,
184
+ MAX_SAFE_INTEGER
185
+ } = Number;
186
+ var Dic = class {
187
+ constructor(dics) {
188
+ this.dics = dics;
189
+ this.keys = hash8json(dics, "key");
190
+ this.values = hash8json(dics, "value");
191
+ }
192
+ keys;
193
+ values;
194
+ item(key) {
195
+ return this.keys[key]?.value;
196
+ }
197
+ at(value) {
198
+ return this.values[value]?.key;
199
+ }
200
+ reduce(callbackfn, initialValue) {
201
+ return this.dics.reduce(callbackfn, initialValue);
202
+ }
203
+ };
204
+ var weekDic = new Dic([
205
+ {
206
+ key: "SUN",
207
+ value: 0
208
+ },
209
+ {
210
+ key: "MON",
211
+ value: 1
212
+ },
213
+ {
214
+ key: "TUE",
215
+ value: 2
216
+ },
217
+ {
218
+ key: "WED",
219
+ value: 3
220
+ },
221
+ {
222
+ key: "THU",
223
+ value: 4
224
+ },
225
+ {
226
+ key: "FRI",
227
+ value: 5
228
+ },
229
+ {
230
+ key: "SAT",
231
+ value: 6
232
+ }
233
+ ]);
234
+ var place_value = 0;
235
+ var default_max_second = 59;
236
+ var default_min_second = 0;
237
+ var default_max_minute = default_max_second;
238
+ var default_min_minute = default_min_second;
239
+ var default_max_hour = 23;
240
+ var default_min_hour = 0;
241
+ var default_max_day = 31;
242
+ var default_min_day = 1;
243
+ var default_max_month = 12;
244
+ var default_min_month = 1;
245
+ var default_max_week = 6;
246
+ var default_min_week = 0;
247
+ var re_single_number_text = "\\d";
248
+ var createCronRegexText = (options = {}) => {
249
+ const {
250
+ enableSlot = true,
251
+ enableSecond = true,
252
+ enableYear = true,
253
+ enableMax = true,
254
+ enableInvalid = true,
255
+ enableDayLast = true,
256
+ enableWeekLast = true,
257
+ enableWeekSupport7 = true,
258
+ enableWeekSupportDic = true,
259
+ enableDicEnumSupportMixin = true,
260
+ enablePrefixZero
261
+ } = options;
262
+ const enableMaxSplit = enableMax && (options.enableIncrementMax ?? true);
263
+ const singleNumberMatch = (end, fromZero) => {
264
+ const start = fromZero ? 0 : 1;
265
+ if (end === start) {
266
+ return `${end}`;
267
+ } else if (end < 3 + start) {
268
+ let text = "";
269
+ for (let i = start; i <= end; i++) {
270
+ text += i;
271
+ }
272
+ return `[${text}]`;
273
+ } else if (start === 0 && end === 9) {
274
+ return re_single_number_text;
275
+ } else {
276
+ return `[${start}-${end}]`;
277
+ }
278
+ };
279
+ const numberMatch = (max, fromZero) => {
280
+ if (max === place_value) return `[1-9]${re_single_number_text}*`;
281
+ if (max < 10) return singleNumberMatch(max, fromZero);
282
+ const mod = max % 10;
283
+ const quot = (max - mod) / 10;
284
+ let text = "";
285
+ if (fromZero) {
286
+ text = re_single_number_text;
287
+ } else {
288
+ text = singleNumberMatch(9);
289
+ }
290
+ text += "|";
291
+ if (mod === 9) {
292
+ text += singleNumberMatch(quot) + re_single_number_text;
293
+ } else {
294
+ if (quot > 1) {
295
+ text += singleNumberMatch(quot - 1) + re_single_number_text + "|";
296
+ }
297
+ text += `${quot}${singleNumberMatch(mod, true)}`;
298
+ }
299
+ return `(?:${text})`;
300
+ };
301
+ const numberMatchByPrefix = (max, fromZero) => {
302
+ const text = numberMatch(max, fromZero);
303
+ return enablePrefixZero ? "0*" + text : text;
304
+ };
305
+ const mixin = (text) => {
306
+ let tmp = "";
307
+ for (const char of text) {
308
+ const code = char.charCodeAt(0);
309
+ if (code > 64 && code < 91) {
310
+ tmp += `[${char.toLocaleLowerCase()}${char}]`;
311
+ } else if (code > 96 && code < 123) {
312
+ tmp += `[${char}${char.toLocaleUpperCase()}]`;
313
+ } else {
314
+ tmp += char;
315
+ }
316
+ }
317
+ return tmp;
318
+ };
319
+ const generate = ({
320
+ type,
321
+ max,
322
+ split,
323
+ dic,
324
+ invalid,
325
+ last,
326
+ fromZero
327
+ }) => {
328
+ const list = [];
329
+ invalid && list.push("\\?");
330
+ const template = [numberMatchByPrefix(max, fromZero)];
331
+ let lastTemplate;
332
+ if (last) {
333
+ if (type === "D") {
334
+ lastTemplate = `L(?:-${numberMatchByPrefix(max - 1)})?`;
335
+ } else if (type === "w") {
336
+ lastTemplate = `${numberMatchByPrefix(max, true)}L`;
337
+ }
338
+ }
339
+ if (type === "w" && dic) {
340
+ template.push(
341
+ dic.reduce((tmp2, { key }) => {
342
+ const text = enableDicEnumSupportMixin ? mixin(key) : key;
343
+ return tmp2 ? tmp2 + "|" + text : text;
344
+ }, "")
345
+ );
346
+ }
347
+ let tmp = template.length > 1 ? `(?:${template.join("|")})` : template[0];
348
+ if (lastTemplate) {
349
+ tmp = `(?:\\*|(?:${lastTemplate}|${tmp}(?:-${tmp})?)(?:,(?:${lastTemplate}|${tmp}(?:-${tmp})?))*)`;
350
+ } else {
351
+ tmp = `(?:\\*|${tmp}(?:-${tmp})?(?:,${tmp}(?:-${tmp})?)*)`;
352
+ }
353
+ list.push(`${tmp}(?:\\/${numberMatchByPrefix(split)})?`);
354
+ return list.join("|");
355
+ };
356
+ let regex = "";
357
+ const join = (config, isLast) => {
358
+ const space = "\\s+";
359
+ let code = generate(config);
360
+ if (enableSlot) {
361
+ code = `(?<${config.type}>${code})`;
362
+ } else {
363
+ code = `(${code})`;
364
+ }
365
+ if (!isLast) {
366
+ code += space;
367
+ }
368
+ if (config.partial) {
369
+ if (isLast) {
370
+ regex = regex.slice(0, space.length * -1) + `(?:${space}${code})?`;
371
+ return;
372
+ } else {
373
+ code = `(?:${code})?`;
374
+ }
375
+ }
376
+ regex += code;
377
+ };
378
+ enableSecond && join({
379
+ type: "s",
380
+ max: enableMax ? default_max_second : place_value,
381
+ split: enableMaxSplit ? default_max_second : place_value,
382
+ fromZero: !default_min_second
383
+ });
384
+ join({
385
+ type: "m",
386
+ max: enableMax ? default_max_minute : place_value,
387
+ split: enableMaxSplit ? default_max_minute : place_value,
388
+ fromZero: !default_min_minute
389
+ });
390
+ join({
391
+ type: "h",
392
+ max: enableMax ? default_max_hour : place_value,
393
+ split: enableMaxSplit ? default_max_hour : place_value,
394
+ fromZero: !default_min_hour
395
+ });
396
+ join({
397
+ type: "D",
398
+ max: enableMax ? default_max_day : place_value,
399
+ split: enableMaxSplit ? default_max_day : place_value,
400
+ invalid: enableInvalid,
401
+ last: enableDayLast,
402
+ fromZero: !default_min_day
403
+ });
404
+ join({
405
+ type: "M",
406
+ max: enableMax ? default_max_month : place_value,
407
+ split: enableMaxSplit ? default_max_month : place_value,
408
+ fromZero: !default_min_month
409
+ });
410
+ join((() => {
411
+ const max = enableWeekSupport7 ? 7 : default_max_week;
412
+ const config = {
413
+ type: "w",
414
+ max: enableMax ? max : place_value,
415
+ split: enableMaxSplit ? 7 : place_value,
416
+ fromZero: !default_min_week,
417
+ invalid: enableInvalid,
418
+ last: enableWeekLast
419
+ };
420
+ if (enableWeekSupportDic) {
421
+ config.dic = weekDic;
422
+ }
423
+ return config;
424
+ })(), !enableYear);
425
+ enableYear && join({
426
+ type: "Y",
427
+ max: place_value,
428
+ split: place_value,
429
+ fromZero: true,
430
+ partial: true
431
+ }, true);
432
+ return {
433
+ regex,
434
+ enableSlot,
435
+ enableSecond,
436
+ enableYear,
437
+ enableDayLast,
438
+ enableWeekLast,
439
+ enableInvalid
440
+ };
441
+ };
442
+ var InvalidValue = class {
443
+ constructor(isEnableInvalid) {
444
+ this.isEnableInvalid = isEnableInvalid;
445
+ }
446
+ text() {
447
+ return this.isEnableInvalid ? "?" : "*";
448
+ }
449
+ };
450
+ var isInvalidValue = (value) => value instanceof InvalidValue;
451
+ var LastValue = class {
452
+ constructor(value) {
453
+ this.value = value;
454
+ }
455
+ };
456
+ var DayLastValue = class extends LastValue {
457
+ text() {
458
+ const { value } = this;
459
+ return "L" + (value ? `-${value}` : "");
460
+ }
461
+ };
462
+ var isDayLastValue = (value) => value instanceof DayLastValue;
463
+ var WeekLastValue = class extends LastValue {
464
+ text() {
465
+ return `${this.value}L`;
466
+ }
467
+ };
468
+ var isWeekLastValue = (value) => value instanceof WeekLastValue;
469
+ var WildcardValue = class {
470
+ text() {
471
+ return "*";
472
+ }
473
+ };
474
+ var isWildcardValue = (value) => value instanceof WildcardValue;
475
+ var RangeValue = class {
476
+ constructor(start, stop) {
477
+ this.start = start;
478
+ this.stop = stop;
479
+ }
480
+ text() {
481
+ return `${this.start}-${this.stop}`;
482
+ }
483
+ };
484
+ var isRangeValue = (value) => value instanceof RangeValue;
485
+ var DigitsValue = class {
486
+ constructor(values, increment) {
487
+ this.values = values;
488
+ this.increment = increment;
489
+ }
490
+ text() {
491
+ const { values, increment } = this;
492
+ let tmp;
493
+ if (Array.isArray(values)) {
494
+ tmp = values.reduce((caches, data) => {
495
+ let tmp2;
496
+ if ((0, import_lodash_es2.isNumber)(data)) {
497
+ tmp2 = `${data}`;
498
+ } else {
499
+ tmp2 = data.text();
500
+ }
501
+ return caches ? caches + "," + tmp2 : tmp2;
502
+ }, "");
503
+ } else {
504
+ tmp = values.text();
505
+ }
506
+ return increment ? `${tmp}/${increment}` : tmp;
507
+ }
508
+ };
509
+ var isDigitsValue = (value) => value instanceof DigitsValue;
510
+ var re_num = /\d/;
511
+ var parseDigit = (text) => {
512
+ if (re_num.test(text[0])) {
513
+ return parseInt(text);
514
+ } else {
515
+ return weekDic.item(text.toLocaleUpperCase());
516
+ }
517
+ };
518
+ var parseDigits = (text) => {
519
+ return text.split(",").map((text2) => {
520
+ const [a, b] = text2.split("-");
521
+ if (a === "L" && b === void 0) {
522
+ return new DayLastValue(0);
523
+ } else if (b === void 0) {
524
+ if (a.slice(-1) === "L") {
525
+ return new WeekLastValue(parseInt(a.slice(0, -1)));
526
+ } else {
527
+ return parseDigit(a);
528
+ }
529
+ } else {
530
+ if (a === "L") {
531
+ return new DayLastValue(parseInt(b));
532
+ } else {
533
+ return new RangeValue(parseDigit(a), parseDigit(b));
534
+ }
535
+ }
536
+ });
537
+ };
538
+ var validate = (value, min, max) => {
539
+ if (isInteger(value)) {
540
+ return value >= min && value <= max;
541
+ } else if (Array.isArray(value)) {
542
+ if (value.length !== 2) return false;
543
+ const [a, b] = value;
544
+ return isInteger(a) && isInteger(b) && a <= b && a >= min && b <= max;
545
+ }
546
+ return false;
547
+ };
548
+ var validateIncrement = (value, min, max) => {
549
+ return isInteger(value) && value > 0 && value >= min && value <= max;
550
+ };
551
+ var formaterDigits = (value, min, max) => {
552
+ let values;
553
+ if (value === "*") {
554
+ values = new WildcardValue();
555
+ } else if (Array.isArray(value)) {
556
+ const tmp = [];
557
+ value.some((data) => {
558
+ if (validate(data, min, max)) {
559
+ tmp.push(
560
+ (0, import_lodash_es2.isNumber)(data) ? data : new RangeValue(data[0], data[1])
561
+ );
562
+ return false;
563
+ } else {
564
+ return true;
565
+ }
566
+ }) || (values = tmp);
567
+ } else if (validate(value, min, max)) {
568
+ values = [value];
569
+ }
570
+ return values;
571
+ };
572
+ var formaterLastDigits = (value, min, max, prototype) => {
573
+ let values;
574
+ if (value === "*") {
575
+ values = new WildcardValue();
576
+ } else {
577
+ const tmp = [];
578
+ const list = Array.isArray(value) ? value : [value];
579
+ list.some((data) => {
580
+ if ((0, import_lodash_es2.isString)(data)) {
581
+ const result = parseDigits(data);
582
+ if (result.length === 1 && result[0] instanceof prototype && validate(result[0].value, min, max - 1)) {
583
+ tmp.push(result[0]);
584
+ return false;
585
+ }
586
+ } else if (validate(data, min, max)) {
587
+ tmp.push(
588
+ (0, import_lodash_es2.isNumber)(data) ? data : new RangeValue(data[0], data[1])
589
+ );
590
+ return false;
591
+ }
592
+ return true;
593
+ }) || (values = tmp);
594
+ }
595
+ return values;
596
+ };
597
+ var Parse = class {
598
+ constructor(second, minute, hour, day, month, week, year, cron) {
599
+ this.cron = cron;
600
+ if (second) {
601
+ this.second = this.parse(second);
602
+ }
603
+ this.minute = this.parse(minute);
604
+ this.hour = this.parse(hour);
605
+ this.day = this.parse(day);
606
+ this.month = this.parse(month);
607
+ this.week = this.parse(week);
608
+ if (year) {
609
+ this.year = this.parse(year);
610
+ }
611
+ }
612
+ second;
613
+ minute;
614
+ hour;
615
+ day;
616
+ month;
617
+ week;
618
+ year;
619
+ parse(text) {
620
+ if (text === "?") return new InvalidValue(this.cron.isEnableInvalid);
621
+ const [slices, increment] = text.split("/");
622
+ return new DigitsValue(
623
+ slices === "*" ? new WildcardValue() : parseDigits(slices),
624
+ increment ? parseInt(increment) : void 0
625
+ );
626
+ }
627
+ setSecond(value, increment) {
628
+ if (!this.cron.isEnableSecond) return false;
629
+ const values = formaterDigits(value, default_min_second, default_max_second);
630
+ if (!values) return false;
631
+ const second = new DigitsValue(values);
632
+ if (validateIncrement(increment, default_min_second, default_max_second)) {
633
+ second.increment = increment;
634
+ }
635
+ this.second = second;
636
+ return true;
637
+ }
638
+ setMinute(value, increment) {
639
+ const values = formaterDigits(value, default_min_minute, default_max_minute);
640
+ if (!values) return false;
641
+ const minute = new DigitsValue(values);
642
+ if (validateIncrement(increment, default_min_minute, default_max_minute)) {
643
+ minute.increment = increment;
644
+ }
645
+ this.minute = minute;
646
+ return true;
647
+ }
648
+ setHour(value, increment) {
649
+ const values = formaterDigits(value, default_min_hour, default_max_hour);
650
+ if (!values) return false;
651
+ const hour = new DigitsValue(values);
652
+ if (validateIncrement(increment, default_min_hour, default_max_hour)) {
653
+ hour.increment = increment;
654
+ }
655
+ this.hour = hour;
656
+ return true;
657
+ }
658
+ setDayInvalid() {
659
+ this.day = new InvalidValue(this.cron.isEnableInvalid);
660
+ if (this.week instanceof InvalidValue) {
661
+ this.week = new DigitsValue(new WildcardValue());
662
+ }
663
+ }
664
+ setDay(value, increment) {
665
+ let values;
666
+ if (value === "?") {
667
+ this.setDayInvalid();
668
+ return true;
669
+ } else {
670
+ const tmp2 = formaterLastDigits(value, default_min_day, default_max_day, DayLastValue);
671
+ if (!tmp2) return false;
672
+ values = tmp2;
673
+ }
674
+ const tmp = new DigitsValue(values);
675
+ if (validateIncrement(increment, default_min_day, default_max_day)) {
676
+ tmp.increment = increment;
677
+ }
678
+ this.day = tmp;
679
+ const { week } = this;
680
+ if (isDigitsValue(week) && (week.increment !== void 0 || !isWildcardValue(week.values))) {
681
+ if (this.cron.isEnableInvalid) {
682
+ this.week = new InvalidValue(true);
683
+ } else {
684
+ week.values = new WildcardValue();
685
+ week.increment = void 0;
686
+ }
687
+ }
688
+ return true;
689
+ }
690
+ setMonth(value, increment) {
691
+ const values = formaterDigits(value, default_min_month, default_max_month);
692
+ if (!values) return false;
693
+ const month = new DigitsValue(values);
694
+ if (validateIncrement(increment, default_min_month, default_max_month)) {
695
+ month.increment = increment;
696
+ }
697
+ this.month = month;
698
+ return true;
699
+ }
700
+ setWeekInvalid() {
701
+ this.week = new InvalidValue(this.cron.isEnableInvalid);
702
+ if (this.day instanceof InvalidValue) {
703
+ this.day = new DigitsValue(new WildcardValue());
704
+ }
705
+ }
706
+ setWeek(value, increment) {
707
+ let values;
708
+ if (value === "?") {
709
+ this.setWeekInvalid();
710
+ return true;
711
+ } else {
712
+ const tmp2 = formaterLastDigits(value, default_min_week, default_max_week, WeekLastValue);
713
+ if (!tmp2) return false;
714
+ values = tmp2;
715
+ }
716
+ const tmp = new DigitsValue(values);
717
+ if (validateIncrement(increment, default_min_week, default_max_week)) {
718
+ tmp.increment = increment;
719
+ }
720
+ this.week = tmp;
721
+ const { day } = this;
722
+ if (isDigitsValue(day) && (day.increment !== void 0 || !isWildcardValue(day.values))) {
723
+ if (this.cron.isEnableInvalid) {
724
+ this.day = new InvalidValue(true);
725
+ } else {
726
+ day.values = new WildcardValue();
727
+ day.increment = void 0;
728
+ }
729
+ }
730
+ return true;
731
+ }
732
+ setYear(value, increment) {
733
+ if (!this.cron.isEnableYear) return false;
734
+ const values = formaterDigits(value, 0, MAX_SAFE_INTEGER);
735
+ if (!values) return false;
736
+ const year = new DigitsValue(values);
737
+ if (validateIncrement(increment, 0, MAX_SAFE_INTEGER)) {
738
+ year.increment = increment;
739
+ }
740
+ this.year = year;
741
+ return true;
742
+ }
743
+ text() {
744
+ const { cron, second, year } = this;
745
+ const list = [];
746
+ if (cron.isEnableSecond) {
747
+ list.push(second ? second.text() : "0");
748
+ }
749
+ list.push(this.minute.text());
750
+ list.push(this.hour.text());
751
+ list.push(this.day.text());
752
+ list.push(this.month.text());
753
+ list.push(this.week.text());
754
+ if (cron.isEnableYear && year) {
755
+ list.push(year.text());
756
+ }
757
+ return list.join(" ");
758
+ }
759
+ };
760
+ var Cron = class {
761
+ #options;
762
+ #regex;
763
+ get isEnableSecond() {
764
+ return this.#options.enableSecond;
765
+ }
766
+ get isEnableYear() {
767
+ return this.#options.enableYear;
768
+ }
769
+ get isEnableDayLast() {
770
+ return this.#options.enableDayLast;
771
+ }
772
+ get isEnableWeekLast() {
773
+ return this.#options.enableWeekLast;
774
+ }
775
+ get isEnableInvalid() {
776
+ return this.#options.enableInvalid;
777
+ }
778
+ constructor(options) {
779
+ const { regex } = this.#options = createCronRegexText(options);
780
+ this.#regex = new RegExp(`^${regex}$`);
781
+ }
782
+ parse(text) {
783
+ const matchs = text.trim().match(this.#regex);
784
+ if (!matchs) return;
785
+ const config = this.#options;
786
+ const { enableSecond, enableYear } = config;
787
+ let second;
788
+ let minute;
789
+ let hour;
790
+ let day;
791
+ let month;
792
+ let week;
793
+ let year;
794
+ if (config.enableSlot) {
795
+ const groups = matchs.groups;
796
+ if (enableSecond) {
797
+ second = groups.s;
798
+ }
799
+ minute = groups.m;
800
+ hour = groups.h;
801
+ day = groups.D;
802
+ month = groups.M;
803
+ week = groups.w;
804
+ if (enableYear) {
805
+ year = groups.Y;
806
+ }
807
+ } else {
808
+ let count = 1;
809
+ if (enableSecond) {
810
+ second = matchs[count++];
811
+ }
812
+ minute = matchs[count++];
813
+ hour = matchs[count++];
814
+ day = matchs[count++];
815
+ month = matchs[count++];
816
+ week = matchs[count++];
817
+ if (enableYear) {
818
+ year = matchs[count++];
819
+ }
820
+ }
821
+ return new Parse(second, minute, hour, day, month, week, year, this);
822
+ }
823
+ };
824
+
825
+ // src/desens.ts
826
+ var import_lodash_es3 = require("lodash-es");
154
827
  var desensEncrypt = (plaintext, encrypt) => {
155
828
  const rules = [];
156
829
  let point = -1;
@@ -189,7 +862,7 @@ var desensReplace = (ciphertext, rules, replacer = "*") => {
189
862
  return rules.reduce((cache, { range: [start, stop], modify }) => {
190
863
  const part = ciphertext.slice(start + offset, start + offset + modify);
191
864
  const size = stop + 1 - start;
192
- const replaceValue = (0, import_lodash_es2.isString)(replacer) ? replacer.repeat(size) : replacer[Symbol.replace](part, size);
865
+ const replaceValue = (0, import_lodash_es3.isString)(replacer) ? replacer.repeat(size) : replacer[Symbol.replace](part, size);
193
866
  cache += ciphertext.slice(from, start + offset) + replaceValue;
194
867
  from = start + offset + modify;
195
868
  offset += modify - size;
@@ -939,12 +1612,12 @@ var once = (func, thisArg) => {
939
1612
  };
940
1613
 
941
1614
  // src/parse/num.ts
942
- var import_lodash_es3 = require("lodash-es");
1615
+ var import_lodash_es4 = require("lodash-es");
943
1616
  var pow = Math.floor(Math.log10(Number.MAX_SAFE_INTEGER));
944
- var re_num = /^([-+]?)0*(\d+)(?:(n)|(?:\.(\d+))?(?:[Ee]([-+]?)(\d+))?)$/;
1617
+ var re_num2 = /^([-+]?)0*(\d+)(?:(n)|(?:\.(\d+))?(?:[Ee]([-+]?)(\d+))?)$/;
945
1618
  var parseNum = (num) => {
946
- if ((0, import_lodash_es3.isNumber)(num) || typeof num === "bigint") return num;
947
- const match = num.match(re_num);
1619
+ if ((0, import_lodash_es4.isNumber)(num) || typeof num === "bigint") return num;
1620
+ const match = num.match(re_num2);
948
1621
  if (!match) return Number.NaN;
949
1622
  const [, valueSymbol, integer, bigint, decimal, powSymbol, powValue] = match;
950
1623
  if (bigint === "n") return BigInt(valueSymbol + integer);
@@ -972,7 +1645,7 @@ var parseNum = (num) => {
972
1645
  var rotateAngle = (from, angle, visit) => rotateRad(from, angle / 180 * Math.PI, visit);
973
1646
 
974
1647
  // src/serialize/url-params.ts
975
- var import_lodash_es4 = require("lodash-es");
1648
+ var import_lodash_es5 = require("lodash-es");
976
1649
  var cubes = {
977
1650
  string: (text) => text,
978
1651
  boolean: (text) => text === "true",
@@ -997,7 +1670,7 @@ var cubeURLParams = (text, serializes) => {
997
1670
  for (const [key, value] of params) {
998
1671
  const serialize = serializes[key];
999
1672
  if (!serialize) continue;
1000
- if ((0, import_lodash_es4.isString)(serialize) && isKey(serialize, cubes)) {
1673
+ if ((0, import_lodash_es5.isString)(serialize) && isKey(serialize, cubes)) {
1001
1674
  result[key] = cubes[serialize](value);
1002
1675
  } else {
1003
1676
  result[key] = serialize.cube(value);
@@ -1015,21 +1688,21 @@ var flatURLParams = (data, serializes) => {
1015
1688
  if (!serialize) continue;
1016
1689
  params.append(
1017
1690
  key,
1018
- (0, import_lodash_es4.isString)(serialize) && isKey(serialize, flats) ? flats[serialize](value) : serialize.flat(value)
1691
+ (0, import_lodash_es5.isString)(serialize) && isKey(serialize, flats) ? flats[serialize](value) : serialize.flat(value)
1019
1692
  );
1020
1693
  }
1021
1694
  return params.toString();
1022
1695
  };
1023
1696
 
1024
1697
  // src/style/css.ts
1025
- var import_lodash_es5 = require("lodash-es");
1698
+ var import_lodash_es6 = require("lodash-es");
1026
1699
  var hump = /[A-Z]/g;
1027
1700
  var css = (...args) => {
1028
1701
  const list = [];
1029
1702
  for (let i = 0; i < args.length; i++) {
1030
1703
  const data = args[i];
1031
1704
  if (!data) continue;
1032
- if ((0, import_lodash_es5.isString)(data)) {
1705
+ if ((0, import_lodash_es6.isString)(data)) {
1033
1706
  list.push(data);
1034
1707
  } else if (Array.isArray(data)) {
1035
1708
  const result = css(...data);
@@ -1256,8 +1929,18 @@ var joinPaths = (...list) => {
1256
1929
  };
1257
1930
 
1258
1931
  // src/url/params.ts
1932
+ var rasterize = (data) => {
1933
+ const params = new URLSearchParams();
1934
+ for (const key in data) {
1935
+ params.append(
1936
+ key,
1937
+ data[key]
1938
+ );
1939
+ }
1940
+ return params.toString();
1941
+ };
1259
1942
  var connectURLParams = (url, params, serializes) => {
1260
- const query = flatURLParams(params, serializes);
1943
+ const query = serializes ? flatURLParams(params, serializes) : rasterize(params);
1261
1944
  return query ? url.includes("?") ? url + "&" + query : url + "?" + query : url;
1262
1945
  };
1263
1946