@_henriquewilson/gabirubi-domain 1.3.64 → 1.3.65
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/model/journey.d.mts +45 -45
- package/dist/model/journey.d.ts +45 -45
- package/dist/model/user.model.d.mts +2 -2
- package/dist/model/user.model.d.ts +2 -2
- package/dist/test/string.test.js.map +1 -1
- package/dist/test/string.test.mjs.map +1 -1
- package/dist/util/string.util.d.mts +2 -1
- package/dist/util/string.util.d.ts +2 -1
- package/dist/util/string.util.js +88 -0
- package/dist/util/string.util.js.map +1 -1
- package/dist/util/string.util.mjs +85 -1
- package/dist/util/string.util.mjs.map +1 -1
- package/package.json +1 -1
package/dist/model/journey.d.mts
CHANGED
|
@@ -58,8 +58,8 @@ declare const PlanSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
58
58
|
stripePrice: z.ZodString;
|
|
59
59
|
}>, "strip", z.ZodTypeAny, {
|
|
60
60
|
id: string | number;
|
|
61
|
-
enabled: boolean;
|
|
62
61
|
title: string;
|
|
62
|
+
enabled: boolean;
|
|
63
63
|
price: number;
|
|
64
64
|
period: "month" | "year";
|
|
65
65
|
pixPrice: number;
|
|
@@ -79,8 +79,8 @@ declare const PlanSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
79
79
|
createdAt?: unknown;
|
|
80
80
|
updatedAt?: unknown;
|
|
81
81
|
order?: number | null | undefined;
|
|
82
|
-
enabled?: boolean | undefined;
|
|
83
82
|
description?: string | undefined;
|
|
83
|
+
enabled?: boolean | undefined;
|
|
84
84
|
period?: "month" | "year" | undefined;
|
|
85
85
|
}>;
|
|
86
86
|
declare const JourneySchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<{
|
|
@@ -347,8 +347,8 @@ declare const JourneySchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.e
|
|
|
347
347
|
stripePrice: z.ZodString;
|
|
348
348
|
}>, "strip", z.ZodTypeAny, {
|
|
349
349
|
id: string | number;
|
|
350
|
-
enabled: boolean;
|
|
351
350
|
title: string;
|
|
351
|
+
enabled: boolean;
|
|
352
352
|
price: number;
|
|
353
353
|
period: "month" | "year";
|
|
354
354
|
pixPrice: number;
|
|
@@ -368,8 +368,8 @@ declare const JourneySchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.e
|
|
|
368
368
|
createdAt?: unknown;
|
|
369
369
|
updatedAt?: unknown;
|
|
370
370
|
order?: number | null | undefined;
|
|
371
|
-
enabled?: boolean | undefined;
|
|
372
371
|
description?: string | undefined;
|
|
372
|
+
enabled?: boolean | undefined;
|
|
373
373
|
period?: "month" | "year" | undefined;
|
|
374
374
|
}>, "many">>;
|
|
375
375
|
}>, z.objectUtil.extendShape<{
|
|
@@ -384,15 +384,15 @@ declare const JourneySchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.e
|
|
|
384
384
|
}>>, "strip", z.ZodTypeAny, {
|
|
385
385
|
type: "simple" | "modular" | "free";
|
|
386
386
|
id: string | number;
|
|
387
|
-
published: boolean;
|
|
388
387
|
title: string;
|
|
388
|
+
published: boolean;
|
|
389
389
|
activitiesCounter: number;
|
|
390
390
|
createdAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
391
391
|
updatedAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
392
392
|
order?: number | null | undefined;
|
|
393
|
+
description?: string | undefined;
|
|
393
394
|
publishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
394
395
|
unpublishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
395
|
-
description?: string | undefined;
|
|
396
396
|
lastNewsDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
397
397
|
thumbnail?: string | undefined;
|
|
398
398
|
expirationDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
@@ -447,8 +447,8 @@ declare const JourneySchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.e
|
|
|
447
447
|
stripeProductId?: string | undefined;
|
|
448
448
|
plans?: {
|
|
449
449
|
id: string | number;
|
|
450
|
-
enabled: boolean;
|
|
451
450
|
title: string;
|
|
451
|
+
enabled: boolean;
|
|
452
452
|
price: number;
|
|
453
453
|
period: "month" | "year";
|
|
454
454
|
pixPrice: number;
|
|
@@ -467,10 +467,10 @@ declare const JourneySchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.e
|
|
|
467
467
|
createdAt?: unknown;
|
|
468
468
|
updatedAt?: unknown;
|
|
469
469
|
order?: number | null | undefined;
|
|
470
|
+
description?: string | undefined;
|
|
470
471
|
publishOnDate?: unknown;
|
|
471
472
|
unpublishOnDate?: unknown;
|
|
472
473
|
published?: boolean | undefined;
|
|
473
|
-
description?: string | undefined;
|
|
474
474
|
lastNewsDate?: unknown;
|
|
475
475
|
thumbnail?: string | undefined;
|
|
476
476
|
expirationDate?: unknown;
|
|
@@ -533,8 +533,8 @@ declare const JourneySchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.e
|
|
|
533
533
|
createdAt?: unknown;
|
|
534
534
|
updatedAt?: unknown;
|
|
535
535
|
order?: number | null | undefined;
|
|
536
|
-
enabled?: boolean | undefined;
|
|
537
536
|
description?: string | undefined;
|
|
537
|
+
enabled?: boolean | undefined;
|
|
538
538
|
period?: "month" | "year" | undefined;
|
|
539
539
|
}[] | undefined;
|
|
540
540
|
}>;
|
|
@@ -581,20 +581,20 @@ declare const ModuleSchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.ex
|
|
|
581
581
|
published: z.ZodDefault<z.ZodBoolean>;
|
|
582
582
|
}>>, "strip", z.ZodTypeAny, {
|
|
583
583
|
id: string | number;
|
|
584
|
-
published: boolean;
|
|
585
584
|
title: string;
|
|
585
|
+
published: boolean;
|
|
586
586
|
isPrivate: boolean;
|
|
587
587
|
createdAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
588
588
|
updatedAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
589
589
|
order?: number | null | undefined;
|
|
590
|
+
publishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
591
|
+
unpublishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
590
592
|
previous?: {
|
|
591
593
|
id: string | number;
|
|
592
594
|
createdAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
593
595
|
updatedAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
594
596
|
order?: number | null | undefined;
|
|
595
597
|
}[] | undefined;
|
|
596
|
-
publishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
597
|
-
unpublishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
598
598
|
rss?: string | undefined;
|
|
599
599
|
isExclusive?: boolean | null | undefined;
|
|
600
600
|
}, {
|
|
@@ -603,15 +603,15 @@ declare const ModuleSchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.ex
|
|
|
603
603
|
createdAt?: unknown;
|
|
604
604
|
updatedAt?: unknown;
|
|
605
605
|
order?: number | null | undefined;
|
|
606
|
+
publishOnDate?: unknown;
|
|
607
|
+
unpublishOnDate?: unknown;
|
|
608
|
+
published?: boolean | undefined;
|
|
606
609
|
previous?: {
|
|
607
610
|
id?: unknown;
|
|
608
611
|
createdAt?: unknown;
|
|
609
612
|
updatedAt?: unknown;
|
|
610
613
|
order?: number | null | undefined;
|
|
611
614
|
}[] | undefined;
|
|
612
|
-
publishOnDate?: unknown;
|
|
613
|
-
unpublishOnDate?: unknown;
|
|
614
|
-
published?: boolean | undefined;
|
|
615
615
|
isPrivate?: boolean | undefined;
|
|
616
616
|
rss?: string | undefined;
|
|
617
617
|
isExclusive?: boolean | null | undefined;
|
|
@@ -652,17 +652,15 @@ declare const ActivitySchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.
|
|
|
652
652
|
published: z.ZodDefault<z.ZodBoolean>;
|
|
653
653
|
}>>, "strip", z.ZodTypeAny, {
|
|
654
654
|
id: string | number;
|
|
655
|
-
published: boolean;
|
|
656
655
|
title: string;
|
|
657
|
-
content: string;
|
|
658
656
|
contentType: "video" | "document" | "audio" | "text" | "soundcloud" | "youtube" | "form" | "live" | "file";
|
|
657
|
+
content: string;
|
|
659
658
|
hideComments: boolean;
|
|
660
659
|
showChat: boolean;
|
|
660
|
+
published: boolean;
|
|
661
661
|
createdAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
662
662
|
updatedAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
663
663
|
order?: number | null | undefined;
|
|
664
|
-
publishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
665
|
-
unpublishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
666
664
|
description?: string | undefined;
|
|
667
665
|
files?: {
|
|
668
666
|
url: string;
|
|
@@ -670,17 +668,16 @@ declare const ActivitySchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.
|
|
|
670
668
|
}[] | undefined;
|
|
671
669
|
reference?: string | undefined;
|
|
672
670
|
tagsStr?: string | undefined;
|
|
671
|
+
publishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
672
|
+
unpublishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
673
673
|
}, {
|
|
674
674
|
title: string;
|
|
675
|
-
content: string;
|
|
676
675
|
contentType: "video" | "document" | "audio" | "text" | "soundcloud" | "youtube" | "form" | "live" | "file";
|
|
676
|
+
content: string;
|
|
677
677
|
id?: unknown;
|
|
678
678
|
createdAt?: unknown;
|
|
679
679
|
updatedAt?: unknown;
|
|
680
680
|
order?: number | null | undefined;
|
|
681
|
-
publishOnDate?: unknown;
|
|
682
|
-
unpublishOnDate?: unknown;
|
|
683
|
-
published?: boolean | undefined;
|
|
684
681
|
description?: string | undefined;
|
|
685
682
|
files?: {
|
|
686
683
|
url: string;
|
|
@@ -690,6 +687,9 @@ declare const ActivitySchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.
|
|
|
690
687
|
showChat?: boolean | undefined;
|
|
691
688
|
reference?: string | undefined;
|
|
692
689
|
tagsStr?: string | undefined;
|
|
690
|
+
publishOnDate?: unknown;
|
|
691
|
+
unpublishOnDate?: unknown;
|
|
692
|
+
published?: boolean | undefined;
|
|
693
693
|
}>;
|
|
694
694
|
type Module = z.infer<typeof ModuleSchema>;
|
|
695
695
|
type Journey = z.infer<typeof JourneySchema>;
|
|
@@ -771,17 +771,15 @@ declare const ModuleWithActivities: z.ZodObject<z.objectUtil.extendShape<z.objec
|
|
|
771
771
|
published: z.ZodDefault<z.ZodBoolean>;
|
|
772
772
|
}>>, "strip", z.ZodTypeAny, {
|
|
773
773
|
id: string | number;
|
|
774
|
-
published: boolean;
|
|
775
774
|
title: string;
|
|
776
|
-
content: string;
|
|
777
775
|
contentType: "video" | "document" | "audio" | "text" | "soundcloud" | "youtube" | "form" | "live" | "file";
|
|
776
|
+
content: string;
|
|
778
777
|
hideComments: boolean;
|
|
779
778
|
showChat: boolean;
|
|
779
|
+
published: boolean;
|
|
780
780
|
createdAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
781
781
|
updatedAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
782
782
|
order?: number | null | undefined;
|
|
783
|
-
publishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
784
|
-
unpublishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
785
783
|
description?: string | undefined;
|
|
786
784
|
files?: {
|
|
787
785
|
url: string;
|
|
@@ -789,17 +787,16 @@ declare const ModuleWithActivities: z.ZodObject<z.objectUtil.extendShape<z.objec
|
|
|
789
787
|
}[] | undefined;
|
|
790
788
|
reference?: string | undefined;
|
|
791
789
|
tagsStr?: string | undefined;
|
|
790
|
+
publishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
791
|
+
unpublishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
792
792
|
}, {
|
|
793
793
|
title: string;
|
|
794
|
-
content: string;
|
|
795
794
|
contentType: "video" | "document" | "audio" | "text" | "soundcloud" | "youtube" | "form" | "live" | "file";
|
|
795
|
+
content: string;
|
|
796
796
|
id?: unknown;
|
|
797
797
|
createdAt?: unknown;
|
|
798
798
|
updatedAt?: unknown;
|
|
799
799
|
order?: number | null | undefined;
|
|
800
|
-
publishOnDate?: unknown;
|
|
801
|
-
unpublishOnDate?: unknown;
|
|
802
|
-
published?: boolean | undefined;
|
|
803
800
|
description?: string | undefined;
|
|
804
801
|
files?: {
|
|
805
802
|
url: string;
|
|
@@ -809,25 +806,26 @@ declare const ModuleWithActivities: z.ZodObject<z.objectUtil.extendShape<z.objec
|
|
|
809
806
|
showChat?: boolean | undefined;
|
|
810
807
|
reference?: string | undefined;
|
|
811
808
|
tagsStr?: string | undefined;
|
|
809
|
+
publishOnDate?: unknown;
|
|
810
|
+
unpublishOnDate?: unknown;
|
|
811
|
+
published?: boolean | undefined;
|
|
812
812
|
}>, "many">;
|
|
813
813
|
}>, "strip", z.ZodTypeAny, {
|
|
814
814
|
id: string | number;
|
|
815
|
-
published: boolean;
|
|
816
815
|
title: string;
|
|
816
|
+
published: boolean;
|
|
817
817
|
isPrivate: boolean;
|
|
818
818
|
activities: {
|
|
819
819
|
id: string | number;
|
|
820
|
-
published: boolean;
|
|
821
820
|
title: string;
|
|
822
|
-
content: string;
|
|
823
821
|
contentType: "video" | "document" | "audio" | "text" | "soundcloud" | "youtube" | "form" | "live" | "file";
|
|
822
|
+
content: string;
|
|
824
823
|
hideComments: boolean;
|
|
825
824
|
showChat: boolean;
|
|
825
|
+
published: boolean;
|
|
826
826
|
createdAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
827
827
|
updatedAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
828
828
|
order?: number | null | undefined;
|
|
829
|
-
publishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
830
|
-
unpublishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
831
829
|
description?: string | undefined;
|
|
832
830
|
files?: {
|
|
833
831
|
url: string;
|
|
@@ -835,33 +833,32 @@ declare const ModuleWithActivities: z.ZodObject<z.objectUtil.extendShape<z.objec
|
|
|
835
833
|
}[] | undefined;
|
|
836
834
|
reference?: string | undefined;
|
|
837
835
|
tagsStr?: string | undefined;
|
|
836
|
+
publishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
837
|
+
unpublishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
838
838
|
}[];
|
|
839
839
|
createdAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
840
840
|
updatedAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
841
841
|
order?: number | null | undefined;
|
|
842
|
+
publishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
843
|
+
unpublishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
842
844
|
previous?: {
|
|
843
845
|
id: string | number;
|
|
844
846
|
createdAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
845
847
|
updatedAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
846
848
|
order?: number | null | undefined;
|
|
847
849
|
}[] | undefined;
|
|
848
|
-
publishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
849
|
-
unpublishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
850
850
|
rss?: string | undefined;
|
|
851
851
|
isExclusive?: boolean | null | undefined;
|
|
852
852
|
}, {
|
|
853
853
|
title: string;
|
|
854
854
|
activities: {
|
|
855
855
|
title: string;
|
|
856
|
-
content: string;
|
|
857
856
|
contentType: "video" | "document" | "audio" | "text" | "soundcloud" | "youtube" | "form" | "live" | "file";
|
|
857
|
+
content: string;
|
|
858
858
|
id?: unknown;
|
|
859
859
|
createdAt?: unknown;
|
|
860
860
|
updatedAt?: unknown;
|
|
861
861
|
order?: number | null | undefined;
|
|
862
|
-
publishOnDate?: unknown;
|
|
863
|
-
unpublishOnDate?: unknown;
|
|
864
|
-
published?: boolean | undefined;
|
|
865
862
|
description?: string | undefined;
|
|
866
863
|
files?: {
|
|
867
864
|
url: string;
|
|
@@ -871,20 +868,23 @@ declare const ModuleWithActivities: z.ZodObject<z.objectUtil.extendShape<z.objec
|
|
|
871
868
|
showChat?: boolean | undefined;
|
|
872
869
|
reference?: string | undefined;
|
|
873
870
|
tagsStr?: string | undefined;
|
|
871
|
+
publishOnDate?: unknown;
|
|
872
|
+
unpublishOnDate?: unknown;
|
|
873
|
+
published?: boolean | undefined;
|
|
874
874
|
}[];
|
|
875
875
|
id?: unknown;
|
|
876
876
|
createdAt?: unknown;
|
|
877
877
|
updatedAt?: unknown;
|
|
878
878
|
order?: number | null | undefined;
|
|
879
|
+
publishOnDate?: unknown;
|
|
880
|
+
unpublishOnDate?: unknown;
|
|
881
|
+
published?: boolean | undefined;
|
|
879
882
|
previous?: {
|
|
880
883
|
id?: unknown;
|
|
881
884
|
createdAt?: unknown;
|
|
882
885
|
updatedAt?: unknown;
|
|
883
886
|
order?: number | null | undefined;
|
|
884
887
|
}[] | undefined;
|
|
885
|
-
publishOnDate?: unknown;
|
|
886
|
-
unpublishOnDate?: unknown;
|
|
887
|
-
published?: boolean | undefined;
|
|
888
888
|
isPrivate?: boolean | undefined;
|
|
889
889
|
rss?: string | undefined;
|
|
890
890
|
isExclusive?: boolean | null | undefined;
|
package/dist/model/journey.d.ts
CHANGED
|
@@ -58,8 +58,8 @@ declare const PlanSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
58
58
|
stripePrice: z.ZodString;
|
|
59
59
|
}>, "strip", z.ZodTypeAny, {
|
|
60
60
|
id: string | number;
|
|
61
|
-
enabled: boolean;
|
|
62
61
|
title: string;
|
|
62
|
+
enabled: boolean;
|
|
63
63
|
price: number;
|
|
64
64
|
period: "month" | "year";
|
|
65
65
|
pixPrice: number;
|
|
@@ -79,8 +79,8 @@ declare const PlanSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
79
79
|
createdAt?: unknown;
|
|
80
80
|
updatedAt?: unknown;
|
|
81
81
|
order?: number | null | undefined;
|
|
82
|
-
enabled?: boolean | undefined;
|
|
83
82
|
description?: string | undefined;
|
|
83
|
+
enabled?: boolean | undefined;
|
|
84
84
|
period?: "month" | "year" | undefined;
|
|
85
85
|
}>;
|
|
86
86
|
declare const JourneySchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<{
|
|
@@ -347,8 +347,8 @@ declare const JourneySchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.e
|
|
|
347
347
|
stripePrice: z.ZodString;
|
|
348
348
|
}>, "strip", z.ZodTypeAny, {
|
|
349
349
|
id: string | number;
|
|
350
|
-
enabled: boolean;
|
|
351
350
|
title: string;
|
|
351
|
+
enabled: boolean;
|
|
352
352
|
price: number;
|
|
353
353
|
period: "month" | "year";
|
|
354
354
|
pixPrice: number;
|
|
@@ -368,8 +368,8 @@ declare const JourneySchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.e
|
|
|
368
368
|
createdAt?: unknown;
|
|
369
369
|
updatedAt?: unknown;
|
|
370
370
|
order?: number | null | undefined;
|
|
371
|
-
enabled?: boolean | undefined;
|
|
372
371
|
description?: string | undefined;
|
|
372
|
+
enabled?: boolean | undefined;
|
|
373
373
|
period?: "month" | "year" | undefined;
|
|
374
374
|
}>, "many">>;
|
|
375
375
|
}>, z.objectUtil.extendShape<{
|
|
@@ -384,15 +384,15 @@ declare const JourneySchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.e
|
|
|
384
384
|
}>>, "strip", z.ZodTypeAny, {
|
|
385
385
|
type: "simple" | "modular" | "free";
|
|
386
386
|
id: string | number;
|
|
387
|
-
published: boolean;
|
|
388
387
|
title: string;
|
|
388
|
+
published: boolean;
|
|
389
389
|
activitiesCounter: number;
|
|
390
390
|
createdAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
391
391
|
updatedAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
392
392
|
order?: number | null | undefined;
|
|
393
|
+
description?: string | undefined;
|
|
393
394
|
publishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
394
395
|
unpublishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
395
|
-
description?: string | undefined;
|
|
396
396
|
lastNewsDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
397
397
|
thumbnail?: string | undefined;
|
|
398
398
|
expirationDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
@@ -447,8 +447,8 @@ declare const JourneySchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.e
|
|
|
447
447
|
stripeProductId?: string | undefined;
|
|
448
448
|
plans?: {
|
|
449
449
|
id: string | number;
|
|
450
|
-
enabled: boolean;
|
|
451
450
|
title: string;
|
|
451
|
+
enabled: boolean;
|
|
452
452
|
price: number;
|
|
453
453
|
period: "month" | "year";
|
|
454
454
|
pixPrice: number;
|
|
@@ -467,10 +467,10 @@ declare const JourneySchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.e
|
|
|
467
467
|
createdAt?: unknown;
|
|
468
468
|
updatedAt?: unknown;
|
|
469
469
|
order?: number | null | undefined;
|
|
470
|
+
description?: string | undefined;
|
|
470
471
|
publishOnDate?: unknown;
|
|
471
472
|
unpublishOnDate?: unknown;
|
|
472
473
|
published?: boolean | undefined;
|
|
473
|
-
description?: string | undefined;
|
|
474
474
|
lastNewsDate?: unknown;
|
|
475
475
|
thumbnail?: string | undefined;
|
|
476
476
|
expirationDate?: unknown;
|
|
@@ -533,8 +533,8 @@ declare const JourneySchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.e
|
|
|
533
533
|
createdAt?: unknown;
|
|
534
534
|
updatedAt?: unknown;
|
|
535
535
|
order?: number | null | undefined;
|
|
536
|
-
enabled?: boolean | undefined;
|
|
537
536
|
description?: string | undefined;
|
|
537
|
+
enabled?: boolean | undefined;
|
|
538
538
|
period?: "month" | "year" | undefined;
|
|
539
539
|
}[] | undefined;
|
|
540
540
|
}>;
|
|
@@ -581,20 +581,20 @@ declare const ModuleSchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.ex
|
|
|
581
581
|
published: z.ZodDefault<z.ZodBoolean>;
|
|
582
582
|
}>>, "strip", z.ZodTypeAny, {
|
|
583
583
|
id: string | number;
|
|
584
|
-
published: boolean;
|
|
585
584
|
title: string;
|
|
585
|
+
published: boolean;
|
|
586
586
|
isPrivate: boolean;
|
|
587
587
|
createdAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
588
588
|
updatedAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
589
589
|
order?: number | null | undefined;
|
|
590
|
+
publishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
591
|
+
unpublishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
590
592
|
previous?: {
|
|
591
593
|
id: string | number;
|
|
592
594
|
createdAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
593
595
|
updatedAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
594
596
|
order?: number | null | undefined;
|
|
595
597
|
}[] | undefined;
|
|
596
|
-
publishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
597
|
-
unpublishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
598
598
|
rss?: string | undefined;
|
|
599
599
|
isExclusive?: boolean | null | undefined;
|
|
600
600
|
}, {
|
|
@@ -603,15 +603,15 @@ declare const ModuleSchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.ex
|
|
|
603
603
|
createdAt?: unknown;
|
|
604
604
|
updatedAt?: unknown;
|
|
605
605
|
order?: number | null | undefined;
|
|
606
|
+
publishOnDate?: unknown;
|
|
607
|
+
unpublishOnDate?: unknown;
|
|
608
|
+
published?: boolean | undefined;
|
|
606
609
|
previous?: {
|
|
607
610
|
id?: unknown;
|
|
608
611
|
createdAt?: unknown;
|
|
609
612
|
updatedAt?: unknown;
|
|
610
613
|
order?: number | null | undefined;
|
|
611
614
|
}[] | undefined;
|
|
612
|
-
publishOnDate?: unknown;
|
|
613
|
-
unpublishOnDate?: unknown;
|
|
614
|
-
published?: boolean | undefined;
|
|
615
615
|
isPrivate?: boolean | undefined;
|
|
616
616
|
rss?: string | undefined;
|
|
617
617
|
isExclusive?: boolean | null | undefined;
|
|
@@ -652,17 +652,15 @@ declare const ActivitySchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.
|
|
|
652
652
|
published: z.ZodDefault<z.ZodBoolean>;
|
|
653
653
|
}>>, "strip", z.ZodTypeAny, {
|
|
654
654
|
id: string | number;
|
|
655
|
-
published: boolean;
|
|
656
655
|
title: string;
|
|
657
|
-
content: string;
|
|
658
656
|
contentType: "video" | "document" | "audio" | "text" | "soundcloud" | "youtube" | "form" | "live" | "file";
|
|
657
|
+
content: string;
|
|
659
658
|
hideComments: boolean;
|
|
660
659
|
showChat: boolean;
|
|
660
|
+
published: boolean;
|
|
661
661
|
createdAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
662
662
|
updatedAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
663
663
|
order?: number | null | undefined;
|
|
664
|
-
publishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
665
|
-
unpublishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
666
664
|
description?: string | undefined;
|
|
667
665
|
files?: {
|
|
668
666
|
url: string;
|
|
@@ -670,17 +668,16 @@ declare const ActivitySchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.
|
|
|
670
668
|
}[] | undefined;
|
|
671
669
|
reference?: string | undefined;
|
|
672
670
|
tagsStr?: string | undefined;
|
|
671
|
+
publishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
672
|
+
unpublishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
673
673
|
}, {
|
|
674
674
|
title: string;
|
|
675
|
-
content: string;
|
|
676
675
|
contentType: "video" | "document" | "audio" | "text" | "soundcloud" | "youtube" | "form" | "live" | "file";
|
|
676
|
+
content: string;
|
|
677
677
|
id?: unknown;
|
|
678
678
|
createdAt?: unknown;
|
|
679
679
|
updatedAt?: unknown;
|
|
680
680
|
order?: number | null | undefined;
|
|
681
|
-
publishOnDate?: unknown;
|
|
682
|
-
unpublishOnDate?: unknown;
|
|
683
|
-
published?: boolean | undefined;
|
|
684
681
|
description?: string | undefined;
|
|
685
682
|
files?: {
|
|
686
683
|
url: string;
|
|
@@ -690,6 +687,9 @@ declare const ActivitySchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.
|
|
|
690
687
|
showChat?: boolean | undefined;
|
|
691
688
|
reference?: string | undefined;
|
|
692
689
|
tagsStr?: string | undefined;
|
|
690
|
+
publishOnDate?: unknown;
|
|
691
|
+
unpublishOnDate?: unknown;
|
|
692
|
+
published?: boolean | undefined;
|
|
693
693
|
}>;
|
|
694
694
|
type Module = z.infer<typeof ModuleSchema>;
|
|
695
695
|
type Journey = z.infer<typeof JourneySchema>;
|
|
@@ -771,17 +771,15 @@ declare const ModuleWithActivities: z.ZodObject<z.objectUtil.extendShape<z.objec
|
|
|
771
771
|
published: z.ZodDefault<z.ZodBoolean>;
|
|
772
772
|
}>>, "strip", z.ZodTypeAny, {
|
|
773
773
|
id: string | number;
|
|
774
|
-
published: boolean;
|
|
775
774
|
title: string;
|
|
776
|
-
content: string;
|
|
777
775
|
contentType: "video" | "document" | "audio" | "text" | "soundcloud" | "youtube" | "form" | "live" | "file";
|
|
776
|
+
content: string;
|
|
778
777
|
hideComments: boolean;
|
|
779
778
|
showChat: boolean;
|
|
779
|
+
published: boolean;
|
|
780
780
|
createdAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
781
781
|
updatedAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
782
782
|
order?: number | null | undefined;
|
|
783
|
-
publishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
784
|
-
unpublishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
785
783
|
description?: string | undefined;
|
|
786
784
|
files?: {
|
|
787
785
|
url: string;
|
|
@@ -789,17 +787,16 @@ declare const ModuleWithActivities: z.ZodObject<z.objectUtil.extendShape<z.objec
|
|
|
789
787
|
}[] | undefined;
|
|
790
788
|
reference?: string | undefined;
|
|
791
789
|
tagsStr?: string | undefined;
|
|
790
|
+
publishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
791
|
+
unpublishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
792
792
|
}, {
|
|
793
793
|
title: string;
|
|
794
|
-
content: string;
|
|
795
794
|
contentType: "video" | "document" | "audio" | "text" | "soundcloud" | "youtube" | "form" | "live" | "file";
|
|
795
|
+
content: string;
|
|
796
796
|
id?: unknown;
|
|
797
797
|
createdAt?: unknown;
|
|
798
798
|
updatedAt?: unknown;
|
|
799
799
|
order?: number | null | undefined;
|
|
800
|
-
publishOnDate?: unknown;
|
|
801
|
-
unpublishOnDate?: unknown;
|
|
802
|
-
published?: boolean | undefined;
|
|
803
800
|
description?: string | undefined;
|
|
804
801
|
files?: {
|
|
805
802
|
url: string;
|
|
@@ -809,25 +806,26 @@ declare const ModuleWithActivities: z.ZodObject<z.objectUtil.extendShape<z.objec
|
|
|
809
806
|
showChat?: boolean | undefined;
|
|
810
807
|
reference?: string | undefined;
|
|
811
808
|
tagsStr?: string | undefined;
|
|
809
|
+
publishOnDate?: unknown;
|
|
810
|
+
unpublishOnDate?: unknown;
|
|
811
|
+
published?: boolean | undefined;
|
|
812
812
|
}>, "many">;
|
|
813
813
|
}>, "strip", z.ZodTypeAny, {
|
|
814
814
|
id: string | number;
|
|
815
|
-
published: boolean;
|
|
816
815
|
title: string;
|
|
816
|
+
published: boolean;
|
|
817
817
|
isPrivate: boolean;
|
|
818
818
|
activities: {
|
|
819
819
|
id: string | number;
|
|
820
|
-
published: boolean;
|
|
821
820
|
title: string;
|
|
822
|
-
content: string;
|
|
823
821
|
contentType: "video" | "document" | "audio" | "text" | "soundcloud" | "youtube" | "form" | "live" | "file";
|
|
822
|
+
content: string;
|
|
824
823
|
hideComments: boolean;
|
|
825
824
|
showChat: boolean;
|
|
825
|
+
published: boolean;
|
|
826
826
|
createdAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
827
827
|
updatedAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
828
828
|
order?: number | null | undefined;
|
|
829
|
-
publishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
830
|
-
unpublishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
831
829
|
description?: string | undefined;
|
|
832
830
|
files?: {
|
|
833
831
|
url: string;
|
|
@@ -835,33 +833,32 @@ declare const ModuleWithActivities: z.ZodObject<z.objectUtil.extendShape<z.objec
|
|
|
835
833
|
}[] | undefined;
|
|
836
834
|
reference?: string | undefined;
|
|
837
835
|
tagsStr?: string | undefined;
|
|
836
|
+
publishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
837
|
+
unpublishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
838
838
|
}[];
|
|
839
839
|
createdAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
840
840
|
updatedAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
841
841
|
order?: number | null | undefined;
|
|
842
|
+
publishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
843
|
+
unpublishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
842
844
|
previous?: {
|
|
843
845
|
id: string | number;
|
|
844
846
|
createdAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
845
847
|
updatedAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
846
848
|
order?: number | null | undefined;
|
|
847
849
|
}[] | undefined;
|
|
848
|
-
publishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
849
|
-
unpublishOnDate?: FirebaseFirestore.Timestamp | null | undefined;
|
|
850
850
|
rss?: string | undefined;
|
|
851
851
|
isExclusive?: boolean | null | undefined;
|
|
852
852
|
}, {
|
|
853
853
|
title: string;
|
|
854
854
|
activities: {
|
|
855
855
|
title: string;
|
|
856
|
-
content: string;
|
|
857
856
|
contentType: "video" | "document" | "audio" | "text" | "soundcloud" | "youtube" | "form" | "live" | "file";
|
|
857
|
+
content: string;
|
|
858
858
|
id?: unknown;
|
|
859
859
|
createdAt?: unknown;
|
|
860
860
|
updatedAt?: unknown;
|
|
861
861
|
order?: number | null | undefined;
|
|
862
|
-
publishOnDate?: unknown;
|
|
863
|
-
unpublishOnDate?: unknown;
|
|
864
|
-
published?: boolean | undefined;
|
|
865
862
|
description?: string | undefined;
|
|
866
863
|
files?: {
|
|
867
864
|
url: string;
|
|
@@ -871,20 +868,23 @@ declare const ModuleWithActivities: z.ZodObject<z.objectUtil.extendShape<z.objec
|
|
|
871
868
|
showChat?: boolean | undefined;
|
|
872
869
|
reference?: string | undefined;
|
|
873
870
|
tagsStr?: string | undefined;
|
|
871
|
+
publishOnDate?: unknown;
|
|
872
|
+
unpublishOnDate?: unknown;
|
|
873
|
+
published?: boolean | undefined;
|
|
874
874
|
}[];
|
|
875
875
|
id?: unknown;
|
|
876
876
|
createdAt?: unknown;
|
|
877
877
|
updatedAt?: unknown;
|
|
878
878
|
order?: number | null | undefined;
|
|
879
|
+
publishOnDate?: unknown;
|
|
880
|
+
unpublishOnDate?: unknown;
|
|
881
|
+
published?: boolean | undefined;
|
|
879
882
|
previous?: {
|
|
880
883
|
id?: unknown;
|
|
881
884
|
createdAt?: unknown;
|
|
882
885
|
updatedAt?: unknown;
|
|
883
886
|
order?: number | null | undefined;
|
|
884
887
|
}[] | undefined;
|
|
885
|
-
publishOnDate?: unknown;
|
|
886
|
-
unpublishOnDate?: unknown;
|
|
887
|
-
published?: boolean | undefined;
|
|
888
888
|
isPrivate?: boolean | undefined;
|
|
889
889
|
rss?: string | undefined;
|
|
890
890
|
isExclusive?: boolean | null | undefined;
|
|
@@ -32,10 +32,10 @@ declare const UserSchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.exte
|
|
|
32
32
|
createdAt?: Timestamp | null | undefined;
|
|
33
33
|
updatedAt?: Timestamp | null | undefined;
|
|
34
34
|
order?: number | null | undefined;
|
|
35
|
-
name?: string | undefined;
|
|
36
35
|
enabled?: boolean | undefined;
|
|
37
36
|
lastNewsDate?: Timestamp | null | undefined;
|
|
38
37
|
password?: string | undefined;
|
|
38
|
+
name?: string | undefined;
|
|
39
39
|
phone?: string | undefined;
|
|
40
40
|
userHash?: string | null | undefined;
|
|
41
41
|
avatar?: string | null | undefined;
|
|
@@ -53,10 +53,10 @@ declare const UserSchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.exte
|
|
|
53
53
|
createdAt?: unknown;
|
|
54
54
|
updatedAt?: unknown;
|
|
55
55
|
order?: number | null | undefined;
|
|
56
|
-
name?: string | undefined;
|
|
57
56
|
enabled?: boolean | undefined;
|
|
58
57
|
lastNewsDate?: unknown;
|
|
59
58
|
password?: string | undefined;
|
|
59
|
+
name?: string | undefined;
|
|
60
60
|
phone?: string | undefined;
|
|
61
61
|
userHash?: string | null | undefined;
|
|
62
62
|
avatar?: string | null | undefined;
|
|
@@ -32,10 +32,10 @@ declare const UserSchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.exte
|
|
|
32
32
|
createdAt?: Timestamp | null | undefined;
|
|
33
33
|
updatedAt?: Timestamp | null | undefined;
|
|
34
34
|
order?: number | null | undefined;
|
|
35
|
-
name?: string | undefined;
|
|
36
35
|
enabled?: boolean | undefined;
|
|
37
36
|
lastNewsDate?: Timestamp | null | undefined;
|
|
38
37
|
password?: string | undefined;
|
|
38
|
+
name?: string | undefined;
|
|
39
39
|
phone?: string | undefined;
|
|
40
40
|
userHash?: string | null | undefined;
|
|
41
41
|
avatar?: string | null | undefined;
|
|
@@ -53,10 +53,10 @@ declare const UserSchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.exte
|
|
|
53
53
|
createdAt?: unknown;
|
|
54
54
|
updatedAt?: unknown;
|
|
55
55
|
order?: number | null | undefined;
|
|
56
|
-
name?: string | undefined;
|
|
57
56
|
enabled?: boolean | undefined;
|
|
58
57
|
lastNewsDate?: unknown;
|
|
59
58
|
password?: string | undefined;
|
|
59
|
+
name?: string | undefined;
|
|
60
60
|
phone?: string | undefined;
|
|
61
61
|
userHash?: string | null | undefined;
|
|
62
62
|
avatar?: string | null | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/henriquewilson/Developer/Projects/gabirubi-domain/dist/test/string.test.js","../../src/test/string.test.ts","../../src/util/string.util.ts"],"names":["import_globals","require","import_lodash","capitalize","value","v","jump","split","map","s","lower","toLowerCase","includes","charAt","toUpperCase","slice","join","describe","test","r","expect","toBeDefined","toBe"],"mappings":"AAAA;AAEA,0BAA0B;ACF1B,IAAAA,iBAAuCC,QAAA;ADKvC,0BAA0B;AEL1B,IAAAC,gBAAsBD,QAAA;AAEf,IAAME,aAAa,SACxBC;IAEA,IAAIA,OAAO;QACT,IAAMC,IAAI,GAAQ,OAALD;QACb,IAAME,OAAO;YAAC;YAAM;YAAM;SAAI;QAC9B,OAAOD,EACJE,KAAA,CAAM,KACNC,GAAA,CAAI,SAACC;YACJ,IAAMC,QAAQD,EAAEE,WAAA;YAChB,IAAIL,KAAKM,QAAA,CAASF,QAAQ;gBACxB,OAAOA;YACT;YACA,OAAO,GAAmCA,OAAhCA,MAAMG,MAAA,CAAO,GAAGC,WAAA,IAA8B,OAAdJ,MAAMK,KAAA,CAAM;QACxD,GACCC,IAAA,CAAK;IACV;IACA,OAAO;AACT;AFEA,0BAA0B;AACzB,CAAA,GCnBDhB,eAAAiB,QAAA,EAAS,eAAe;IACtB,CAAA,GAAAjB,eAAAkB,IAAA,EAAK,yBAAyB;QAE5B,IAAMC,IAAIhB,WAAW;QACrB,CAAA,GAAAH,eAAAoB,MAAA,EAAOD,GAAGE,WAAA;QACV,CAAA,GAAArB,eAAAoB,MAAA,EAAOD,GAAGG,IAAA,CAAK;IACjB;AACF","sourcesContent":["\"use strict\";\n\n// src/test/string.test.ts\nvar import_globals = require(\"@jest/globals\");\n\n// src/util/string.util.ts\nvar import_lodash = require(\"lodash\");\nvar capitalize = (value) => {\n if (value) {\n const v = `${value}`;\n const jump = [\"de\", \"da\", \"do\"];\n return v.split(\" \").map((s) => {\n const lower = s.toLowerCase();\n if (jump.includes(lower)) {\n return lower;\n }\n return `${lower.charAt(0).toUpperCase()}${lower.slice(1)}`;\n }).join(\" \");\n }\n return \"\";\n};\n\n// src/test/string.test.ts\n(0, import_globals.describe)(\"test string\", () => {\n (0, import_globals.test)(\"test string structure\", () => {\n const r = capitalize(\"RUTE DE PAULA\");\n (0, import_globals.expect)(r).toBeDefined();\n (0, import_globals.expect)(r).toBe(\"Rute de Paula\");\n });\n});\n","import { describe, expect, test } from '@jest/globals';\nimport {UserSchema} from \"../model/user.model\";\nimport {capitalize} from \"../util/string.util\";\n\ndescribe('test string', () => {\n test('test string structure', () => {\n\n const r = capitalize('RUTE DE PAULA')\n expect(r).toBeDefined();\n expect(r).toBe('Rute de Paula');\n });\n});\n","import { first } from 'lodash'\n\nexport const capitalize = (\n value: string | number | unknown | undefined,\n): string => {\n if (value) {\n const v = `${value}`\n const jump = ['de', 'da', 'do']\n return v\n .split(' ')\n .map((s) => {\n const lower = s.toLowerCase()\n if (jump.includes(lower)) {\n return lower\n }\n return `${lower.charAt(0).toUpperCase()}${lower.slice(1)}`\n })\n .join(' ')\n }\n return ''\n}\n\nexport const removeCData = (text: string): string => {\n return text?.replace(/<!\\[CDATA\\[|\\]\\]>/g, '') || ''\n}\n\nexport const firstWord = (text?: string): string => {\n if (!text) return ''\n return first(text.split(' ')) || ''\n}\n\nexport const capitalizeFirstLetter = (frase: string): string => {\n if (!frase) return '';\n return frase.charAt(0).toUpperCase() + frase.slice(1);\n}\n\nexport const stripHtml = (html: string): string => {\n return html?.replace(/<[^>]*>/g, '').replace(/\\s+/g, ' ').trim() || ''\n}\n\nexport const normalizeFileName = (filename: string) => {\n return filename\n .normalize('NFD') // separa acentos de letras\n .replace(/[\\u0300-\\u036f]/g, '') // remove os acentos\n .replace(/\\[.*?\\]/g, '') // remove colchetes e seu conteúdo\n .replace(/[^a-zA-Z0-9.-]+/g, '-') // substitui espaços e símbolos por hífen\n .replace(/--+/g, '-') // evita múltiplos hífens consecutivos\n .replace(/^-+|-+$/g, '') // remove hífens do início/fim\n .toLowerCase(); // tudo minúsculo\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/Users/henriquewilson/Developer/Projects/gabirubi-domain/dist/test/string.test.js","../../src/test/string.test.ts","../../src/util/string.util.ts"],"names":["import_globals","require","import_lodash","capitalize","value","v","jump","split","map","s","lower","toLowerCase","includes","charAt","toUpperCase","slice","join","describe","test","r","expect","toBeDefined","toBe"],"mappings":"AAAA;AAEA,0BAA0B;ACF1B,IAAAA,iBAAuCC,QAAA;ADKvC,0BAA0B;AEL1B,IAAAC,gBAAsBD,QAAA;AAEf,IAAME,aAAa,SACxBC;IAEA,IAAIA,OAAO;QACT,IAAMC,IAAI,GAAQ,OAALD;QACb,IAAME,OAAO;YAAC;YAAM;YAAM;SAAI;QAC9B,OAAOD,EACJE,KAAA,CAAM,KACNC,GAAA,CAAI,SAACC;YACJ,IAAMC,QAAQD,EAAEE,WAAA;YAChB,IAAIL,KAAKM,QAAA,CAASF,QAAQ;gBACxB,OAAOA;YACT;YACA,OAAO,GAAmCA,OAAhCA,MAAMG,MAAA,CAAO,GAAGC,WAAA,IAA8B,OAAdJ,MAAMK,KAAA,CAAM;QACxD,GACCC,IAAA,CAAK;IACV;IACA,OAAO;AACT;AFEA,0BAA0B;AACzB,CAAA,GCnBDhB,eAAAiB,QAAA,EAAS,eAAe;IACtB,CAAA,GAAAjB,eAAAkB,IAAA,EAAK,yBAAyB;QAE5B,IAAMC,IAAIhB,WAAW;QACrB,CAAA,GAAAH,eAAAoB,MAAA,EAAOD,GAAGE,WAAA;QACV,CAAA,GAAArB,eAAAoB,MAAA,EAAOD,GAAGG,IAAA,CAAK;IACjB;AACF","sourcesContent":["\"use strict\";\n\n// src/test/string.test.ts\nvar import_globals = require(\"@jest/globals\");\n\n// src/util/string.util.ts\nvar import_lodash = require(\"lodash\");\nvar capitalize = (value) => {\n if (value) {\n const v = `${value}`;\n const jump = [\"de\", \"da\", \"do\"];\n return v.split(\" \").map((s) => {\n const lower = s.toLowerCase();\n if (jump.includes(lower)) {\n return lower;\n }\n return `${lower.charAt(0).toUpperCase()}${lower.slice(1)}`;\n }).join(\" \");\n }\n return \"\";\n};\n\n// src/test/string.test.ts\n(0, import_globals.describe)(\"test string\", () => {\n (0, import_globals.test)(\"test string structure\", () => {\n const r = capitalize(\"RUTE DE PAULA\");\n (0, import_globals.expect)(r).toBeDefined();\n (0, import_globals.expect)(r).toBe(\"Rute de Paula\");\n });\n});\n","import { describe, expect, test } from '@jest/globals';\nimport {UserSchema} from \"../model/user.model\";\nimport {capitalize} from \"../util/string.util\";\n\ndescribe('test string', () => {\n test('test string structure', () => {\n\n const r = capitalize('RUTE DE PAULA')\n expect(r).toBeDefined();\n expect(r).toBe('Rute de Paula');\n });\n});\n","import { first } from 'lodash'\n\nexport const capitalize = (\n value: string | number | unknown | undefined,\n): string => {\n if (value) {\n const v = `${value}`\n const jump = ['de', 'da', 'do']\n return v\n .split(' ')\n .map((s) => {\n const lower = s.toLowerCase()\n if (jump.includes(lower)) {\n return lower\n }\n return `${lower.charAt(0).toUpperCase()}${lower.slice(1)}`\n })\n .join(' ')\n }\n return ''\n}\n\nexport const removeCData = (text: string): string => {\n return text?.replace(/<!\\[CDATA\\[|\\]\\]>/g, '') || ''\n}\n\nexport const firstWord = (text?: string): string => {\n if (!text) return ''\n return first(text.split(' ')) || ''\n}\n\nexport const capitalizeFirstLetter = (frase: string): string => {\n if (!frase) return '';\n return frase.charAt(0).toUpperCase() + frase.slice(1);\n}\n\nexport const stripHtml = (html: string): string => {\n return html?.replace(/<[^>]*>/g, '').replace(/\\s+/g, ' ').trim() || ''\n}\n\nexport const normalizeFileName = (filename: string) => {\n return filename\n .normalize('NFD') // separa acentos de letras\n .replace(/[\\u0300-\\u036f]/g, '') // remove os acentos\n .replace(/\\[.*?\\]/g, '') // remove colchetes e seu conteúdo\n .replace(/[^a-zA-Z0-9.-]+/g, '-') // substitui espaços e símbolos por hífen\n .replace(/--+/g, '-') // evita múltiplos hífens consecutivos\n .replace(/^-+|-+$/g, '') // remove hífens do início/fim\n .toLowerCase(); // tudo minúsculo\n}\n\nexport const cleanHTML = (htmlString: string)=> {\n let cleaned = htmlString;\n\n // Remove todos os atributos style (incluindo inline styles complexos)\n cleaned = cleaned.replace(/\\s*style\\s*=\\s*\"[^\"]*\"/gi, '');\n cleaned = cleaned.replace(/\\s*style\\s*=\\s*'[^']*'/gi, '');\n\n // Remove classes CSS\n cleaned = cleaned.replace(/\\s*class\\s*=\\s*\"[^\"]*\"/gi, '');\n cleaned = cleaned.replace(/\\s*class\\s*=\\s*'[^']*'/gi, '');\n\n // Remove todos os atributos data-*\n cleaned = cleaned.replace(/\\s*data-[a-zA-Z0-9\\-_]*\\s*=\\s*\"[^\"]*\"/gi, '');\n cleaned = cleaned.replace(/\\s*data-[a-zA-Z0-9\\-_]*\\s*=\\s*'[^']*'/gi, '');\n\n // Remove atributos rel\n cleaned = cleaned.replace(/\\s*rel\\s*=\\s*\"[^\"]*\"/gi, '');\n cleaned = cleaned.replace(/\\s*rel\\s*=\\s*'[^']*'/gi, '');\n\n // Remove atributos específicos do Tailwind e CSS variables\n const unwantedAttributes = [\n '--tw-scale-x', '--tw-scale-y', '--tw-pan-x', '--tw-pan-y',\n '--tw-pinch-zoom', '--tw-scroll-snap-strictness', '--tw-gradient-from-position',\n '--tw-gradient-via-position', '--tw-gradient-to-position', '--tw-ordinal',\n '--tw-slashed-zero', '--tw-numeric-figure', '--tw-numeric-spacing',\n '--tw-numeric-fraction', '--tw-ring-inset', '--tw-ring-offset-width',\n '--tw-ring-offset-color', '--tw-ring-color', '--tw-ring-offset-shadow',\n '--tw-ring-shadow', '--tw-shadow', '--tw-shadow-colored', '--tw-blur',\n '--tw-brightness', '--tw-contrast', '--tw-grayscale', '--tw-hue-rotate',\n '--tw-invert', '--tw-saturate', '--tw-sepia', '--tw-drop-shadow',\n '--tw-backdrop-blur', '--tw-backdrop-brightness', '--tw-backdrop-contrast',\n '--tw-backdrop-grayscale', '--tw-backdrop-hue-rotate', '--tw-backdrop-invert',\n '--tw-backdrop-opacity', '--tw-backdrop-saturate', '--tw-backdrop-sepia',\n '--tw-contain-size', '--tw-contain-layout', '--tw-contain-paint', '--tw-contain-style',\n ];\n\n unwantedAttributes.forEach((attr) => {\n const regex = new RegExp(`\\\\s*${attr.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&')}\\\\s*=\\\\s*\"[^\"]*\"`, 'gi');\n cleaned = cleaned.replace(regex, '');\n });\n\n // Remove spans que só servem para estilização (vazios ou só com texto)\n // Primeiro remove spans vazios\n cleaned = cleaned.replace(/<span[^>]*>\\s*<\\/span>/gi, '');\n\n // Remove spans que só contêm texto (sem elementos filhos)\n cleaned = cleaned.replace(/<span[^>]*>([^<]+)<\\/span>/gi, '$1');\n\n // Remove spans aninhados desnecessários (múltiplas passadas)\n for (let i = 0; i < 5; i++) {\n cleaned = cleaned.replace(/<span[^>]*>([^<]*(?:<(?!span|\\/span)[^>]*>[^<]*<\\/[^>]*>[^<]*)*)<\\/span>/gi, '$1');\n }\n\n // Remove elementos vazios (exceto br, img, hr, input)\n const selfClosingTags = ['br', 'img', 'hr', 'input', 'meta', 'link'];\n cleaned = cleaned.replace(/<(\\w+)[^>]*>\\s*<\\/\\1>/gi, (match, tagName) => {\n return selfClosingTags.includes(tagName.toLowerCase()) ? match : '';\n });\n\n // Remove BRs consecutivos excessivos\n cleaned = cleaned.replace(/(<br[^>]*>\\s*){3,}/gi, '<br><br>');\n\n // Remove apenas parágrafos completamente vazios (sem br)\n cleaned = cleaned.replace(/<p[^>]*>\\s*<\\/p>/gi, '');\n\n // Limpa espaços em excesso\n cleaned = cleaned.replace(/\\s+/g, ' ');\n\n // Remove espaços no início e fim de tags\n cleaned = cleaned.replace(/>\\s+</g, '><');\n\n // Remove espaços extras no início e fim\n cleaned = cleaned.trim();\n\n // Remove linhas vazias múltiplas\n cleaned = cleaned.replace(/\\n\\s*\\n\\s*\\n/g, '\\n\\n');\n\n return cleaned;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/henriquewilson/Developer/Projects/gabirubi-domain/dist/test/string.test.mjs","../../src/test/string.test.ts","../../src/util/string.util.ts"],"names":["describe","expect","test","first","capitalize","value","v","jump","split","map","s","lower","toLowerCase","includes","charAt","toUpperCase","slice","join","r","toBeDefined","toBe"],"mappings":"AAAA,0BAA0B;ACA1B,SAASA,QAAA,EAAUC,MAAA,EAAQC,IAAA,QAAY,gBAAA;ADGvC,0BAA0B;AEH1B,SAASC,KAAA,QAAa,SAAA;AAEf,IAAMC,aAAa,SACxBC;IAEA,IAAIA,OAAO;QACT,IAAMC,IAAI,GAAQ,OAALD;QACb,IAAME,OAAO;YAAC;YAAM;YAAM;SAAI;QAC9B,OAAOD,EACJE,KAAA,CAAM,KACNC,GAAA,CAAI,SAACC;YACJ,IAAMC,QAAQD,EAAEE,WAAA;YAChB,IAAIL,KAAKM,QAAA,CAASF,QAAQ;gBACxB,OAAOA;YACT;YACA,OAAO,GAAmCA,OAAhCA,MAAMG,MAAA,CAAO,GAAGC,WAAA,IAA8B,OAAdJ,MAAMK,KAAA,CAAM;QACxD,GACCC,IAAA,CAAK;IACV;IACA,OAAO;AACT;AFAA,0BAA0B;AChB1BjB,SAAS,eAAe;IACtBE,KAAK,yBAAyB;QAE5B,IAAMgB,IAAId,WAAW;QACrBH,OAAOiB,GAAGC,WAAA;QACVlB,OAAOiB,GAAGE,IAAA,CAAK;IACjB;AACF","sourcesContent":["// src/test/string.test.ts\nimport { describe, expect, test } from \"@jest/globals\";\n\n// src/util/string.util.ts\nimport { first } from \"lodash\";\nvar capitalize = (value) => {\n if (value) {\n const v = `${value}`;\n const jump = [\"de\", \"da\", \"do\"];\n return v.split(\" \").map((s) => {\n const lower = s.toLowerCase();\n if (jump.includes(lower)) {\n return lower;\n }\n return `${lower.charAt(0).toUpperCase()}${lower.slice(1)}`;\n }).join(\" \");\n }\n return \"\";\n};\n\n// src/test/string.test.ts\ndescribe(\"test string\", () => {\n test(\"test string structure\", () => {\n const r = capitalize(\"RUTE DE PAULA\");\n expect(r).toBeDefined();\n expect(r).toBe(\"Rute de Paula\");\n });\n});\n","import { describe, expect, test } from '@jest/globals';\nimport {UserSchema} from \"../model/user.model\";\nimport {capitalize} from \"../util/string.util\";\n\ndescribe('test string', () => {\n test('test string structure', () => {\n\n const r = capitalize('RUTE DE PAULA')\n expect(r).toBeDefined();\n expect(r).toBe('Rute de Paula');\n });\n});\n","import { first } from 'lodash'\n\nexport const capitalize = (\n value: string | number | unknown | undefined,\n): string => {\n if (value) {\n const v = `${value}`\n const jump = ['de', 'da', 'do']\n return v\n .split(' ')\n .map((s) => {\n const lower = s.toLowerCase()\n if (jump.includes(lower)) {\n return lower\n }\n return `${lower.charAt(0).toUpperCase()}${lower.slice(1)}`\n })\n .join(' ')\n }\n return ''\n}\n\nexport const removeCData = (text: string): string => {\n return text?.replace(/<!\\[CDATA\\[|\\]\\]>/g, '') || ''\n}\n\nexport const firstWord = (text?: string): string => {\n if (!text) return ''\n return first(text.split(' ')) || ''\n}\n\nexport const capitalizeFirstLetter = (frase: string): string => {\n if (!frase) return '';\n return frase.charAt(0).toUpperCase() + frase.slice(1);\n}\n\nexport const stripHtml = (html: string): string => {\n return html?.replace(/<[^>]*>/g, '').replace(/\\s+/g, ' ').trim() || ''\n}\n\nexport const normalizeFileName = (filename: string) => {\n return filename\n .normalize('NFD') // separa acentos de letras\n .replace(/[\\u0300-\\u036f]/g, '') // remove os acentos\n .replace(/\\[.*?\\]/g, '') // remove colchetes e seu conteúdo\n .replace(/[^a-zA-Z0-9.-]+/g, '-') // substitui espaços e símbolos por hífen\n .replace(/--+/g, '-') // evita múltiplos hífens consecutivos\n .replace(/^-+|-+$/g, '') // remove hífens do início/fim\n .toLowerCase(); // tudo minúsculo\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/Users/henriquewilson/Developer/Projects/gabirubi-domain/dist/test/string.test.mjs","../../src/test/string.test.ts","../../src/util/string.util.ts"],"names":["describe","expect","test","first","capitalize","value","v","jump","split","map","s","lower","toLowerCase","includes","charAt","toUpperCase","slice","join","r","toBeDefined","toBe"],"mappings":"AAAA,0BAA0B;ACA1B,SAASA,QAAA,EAAUC,MAAA,EAAQC,IAAA,QAAY,gBAAA;ADGvC,0BAA0B;AEH1B,SAASC,KAAA,QAAa,SAAA;AAEf,IAAMC,aAAa,SACxBC;IAEA,IAAIA,OAAO;QACT,IAAMC,IAAI,GAAQ,OAALD;QACb,IAAME,OAAO;YAAC;YAAM;YAAM;SAAI;QAC9B,OAAOD,EACJE,KAAA,CAAM,KACNC,GAAA,CAAI,SAACC;YACJ,IAAMC,QAAQD,EAAEE,WAAA;YAChB,IAAIL,KAAKM,QAAA,CAASF,QAAQ;gBACxB,OAAOA;YACT;YACA,OAAO,GAAmCA,OAAhCA,MAAMG,MAAA,CAAO,GAAGC,WAAA,IAA8B,OAAdJ,MAAMK,KAAA,CAAM;QACxD,GACCC,IAAA,CAAK;IACV;IACA,OAAO;AACT;AFAA,0BAA0B;AChB1BjB,SAAS,eAAe;IACtBE,KAAK,yBAAyB;QAE5B,IAAMgB,IAAId,WAAW;QACrBH,OAAOiB,GAAGC,WAAA;QACVlB,OAAOiB,GAAGE,IAAA,CAAK;IACjB;AACF","sourcesContent":["// src/test/string.test.ts\nimport { describe, expect, test } from \"@jest/globals\";\n\n// src/util/string.util.ts\nimport { first } from \"lodash\";\nvar capitalize = (value) => {\n if (value) {\n const v = `${value}`;\n const jump = [\"de\", \"da\", \"do\"];\n return v.split(\" \").map((s) => {\n const lower = s.toLowerCase();\n if (jump.includes(lower)) {\n return lower;\n }\n return `${lower.charAt(0).toUpperCase()}${lower.slice(1)}`;\n }).join(\" \");\n }\n return \"\";\n};\n\n// src/test/string.test.ts\ndescribe(\"test string\", () => {\n test(\"test string structure\", () => {\n const r = capitalize(\"RUTE DE PAULA\");\n expect(r).toBeDefined();\n expect(r).toBe(\"Rute de Paula\");\n });\n});\n","import { describe, expect, test } from '@jest/globals';\nimport {UserSchema} from \"../model/user.model\";\nimport {capitalize} from \"../util/string.util\";\n\ndescribe('test string', () => {\n test('test string structure', () => {\n\n const r = capitalize('RUTE DE PAULA')\n expect(r).toBeDefined();\n expect(r).toBe('Rute de Paula');\n });\n});\n","import { first } from 'lodash'\n\nexport const capitalize = (\n value: string | number | unknown | undefined,\n): string => {\n if (value) {\n const v = `${value}`\n const jump = ['de', 'da', 'do']\n return v\n .split(' ')\n .map((s) => {\n const lower = s.toLowerCase()\n if (jump.includes(lower)) {\n return lower\n }\n return `${lower.charAt(0).toUpperCase()}${lower.slice(1)}`\n })\n .join(' ')\n }\n return ''\n}\n\nexport const removeCData = (text: string): string => {\n return text?.replace(/<!\\[CDATA\\[|\\]\\]>/g, '') || ''\n}\n\nexport const firstWord = (text?: string): string => {\n if (!text) return ''\n return first(text.split(' ')) || ''\n}\n\nexport const capitalizeFirstLetter = (frase: string): string => {\n if (!frase) return '';\n return frase.charAt(0).toUpperCase() + frase.slice(1);\n}\n\nexport const stripHtml = (html: string): string => {\n return html?.replace(/<[^>]*>/g, '').replace(/\\s+/g, ' ').trim() || ''\n}\n\nexport const normalizeFileName = (filename: string) => {\n return filename\n .normalize('NFD') // separa acentos de letras\n .replace(/[\\u0300-\\u036f]/g, '') // remove os acentos\n .replace(/\\[.*?\\]/g, '') // remove colchetes e seu conteúdo\n .replace(/[^a-zA-Z0-9.-]+/g, '-') // substitui espaços e símbolos por hífen\n .replace(/--+/g, '-') // evita múltiplos hífens consecutivos\n .replace(/^-+|-+$/g, '') // remove hífens do início/fim\n .toLowerCase(); // tudo minúsculo\n}\n\nexport const cleanHTML = (htmlString: string)=> {\n let cleaned = htmlString;\n\n // Remove todos os atributos style (incluindo inline styles complexos)\n cleaned = cleaned.replace(/\\s*style\\s*=\\s*\"[^\"]*\"/gi, '');\n cleaned = cleaned.replace(/\\s*style\\s*=\\s*'[^']*'/gi, '');\n\n // Remove classes CSS\n cleaned = cleaned.replace(/\\s*class\\s*=\\s*\"[^\"]*\"/gi, '');\n cleaned = cleaned.replace(/\\s*class\\s*=\\s*'[^']*'/gi, '');\n\n // Remove todos os atributos data-*\n cleaned = cleaned.replace(/\\s*data-[a-zA-Z0-9\\-_]*\\s*=\\s*\"[^\"]*\"/gi, '');\n cleaned = cleaned.replace(/\\s*data-[a-zA-Z0-9\\-_]*\\s*=\\s*'[^']*'/gi, '');\n\n // Remove atributos rel\n cleaned = cleaned.replace(/\\s*rel\\s*=\\s*\"[^\"]*\"/gi, '');\n cleaned = cleaned.replace(/\\s*rel\\s*=\\s*'[^']*'/gi, '');\n\n // Remove atributos específicos do Tailwind e CSS variables\n const unwantedAttributes = [\n '--tw-scale-x', '--tw-scale-y', '--tw-pan-x', '--tw-pan-y',\n '--tw-pinch-zoom', '--tw-scroll-snap-strictness', '--tw-gradient-from-position',\n '--tw-gradient-via-position', '--tw-gradient-to-position', '--tw-ordinal',\n '--tw-slashed-zero', '--tw-numeric-figure', '--tw-numeric-spacing',\n '--tw-numeric-fraction', '--tw-ring-inset', '--tw-ring-offset-width',\n '--tw-ring-offset-color', '--tw-ring-color', '--tw-ring-offset-shadow',\n '--tw-ring-shadow', '--tw-shadow', '--tw-shadow-colored', '--tw-blur',\n '--tw-brightness', '--tw-contrast', '--tw-grayscale', '--tw-hue-rotate',\n '--tw-invert', '--tw-saturate', '--tw-sepia', '--tw-drop-shadow',\n '--tw-backdrop-blur', '--tw-backdrop-brightness', '--tw-backdrop-contrast',\n '--tw-backdrop-grayscale', '--tw-backdrop-hue-rotate', '--tw-backdrop-invert',\n '--tw-backdrop-opacity', '--tw-backdrop-saturate', '--tw-backdrop-sepia',\n '--tw-contain-size', '--tw-contain-layout', '--tw-contain-paint', '--tw-contain-style',\n ];\n\n unwantedAttributes.forEach((attr) => {\n const regex = new RegExp(`\\\\s*${attr.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&')}\\\\s*=\\\\s*\"[^\"]*\"`, 'gi');\n cleaned = cleaned.replace(regex, '');\n });\n\n // Remove spans que só servem para estilização (vazios ou só com texto)\n // Primeiro remove spans vazios\n cleaned = cleaned.replace(/<span[^>]*>\\s*<\\/span>/gi, '');\n\n // Remove spans que só contêm texto (sem elementos filhos)\n cleaned = cleaned.replace(/<span[^>]*>([^<]+)<\\/span>/gi, '$1');\n\n // Remove spans aninhados desnecessários (múltiplas passadas)\n for (let i = 0; i < 5; i++) {\n cleaned = cleaned.replace(/<span[^>]*>([^<]*(?:<(?!span|\\/span)[^>]*>[^<]*<\\/[^>]*>[^<]*)*)<\\/span>/gi, '$1');\n }\n\n // Remove elementos vazios (exceto br, img, hr, input)\n const selfClosingTags = ['br', 'img', 'hr', 'input', 'meta', 'link'];\n cleaned = cleaned.replace(/<(\\w+)[^>]*>\\s*<\\/\\1>/gi, (match, tagName) => {\n return selfClosingTags.includes(tagName.toLowerCase()) ? match : '';\n });\n\n // Remove BRs consecutivos excessivos\n cleaned = cleaned.replace(/(<br[^>]*>\\s*){3,}/gi, '<br><br>');\n\n // Remove apenas parágrafos completamente vazios (sem br)\n cleaned = cleaned.replace(/<p[^>]*>\\s*<\\/p>/gi, '');\n\n // Limpa espaços em excesso\n cleaned = cleaned.replace(/\\s+/g, ' ');\n\n // Remove espaços no início e fim de tags\n cleaned = cleaned.replace(/>\\s+</g, '><');\n\n // Remove espaços extras no início e fim\n cleaned = cleaned.trim();\n\n // Remove linhas vazias múltiplas\n cleaned = cleaned.replace(/\\n\\s*\\n\\s*\\n/g, '\\n\\n');\n\n return cleaned;\n}\n"]}
|
|
@@ -4,5 +4,6 @@ declare const firstWord: (text?: string) => string;
|
|
|
4
4
|
declare const capitalizeFirstLetter: (frase: string) => string;
|
|
5
5
|
declare const stripHtml: (html: string) => string;
|
|
6
6
|
declare const normalizeFileName: (filename: string) => string;
|
|
7
|
+
declare const cleanHTML: (htmlString: string) => string;
|
|
7
8
|
|
|
8
|
-
export { capitalize, capitalizeFirstLetter, firstWord, normalizeFileName, removeCData, stripHtml };
|
|
9
|
+
export { capitalize, capitalizeFirstLetter, cleanHTML, firstWord, normalizeFileName, removeCData, stripHtml };
|
|
@@ -4,5 +4,6 @@ declare const firstWord: (text?: string) => string;
|
|
|
4
4
|
declare const capitalizeFirstLetter: (frase: string) => string;
|
|
5
5
|
declare const stripHtml: (html: string) => string;
|
|
6
6
|
declare const normalizeFileName: (filename: string) => string;
|
|
7
|
+
declare const cleanHTML: (htmlString: string) => string;
|
|
7
8
|
|
|
8
|
-
export { capitalize, capitalizeFirstLetter, firstWord, normalizeFileName, removeCData, stripHtml };
|
|
9
|
+
export { capitalize, capitalizeFirstLetter, cleanHTML, firstWord, normalizeFileName, removeCData, stripHtml };
|
package/dist/util/string.util.js
CHANGED
|
@@ -54,6 +54,9 @@ __export(string_util_exports, {
|
|
|
54
54
|
capitalizeFirstLetter: function() {
|
|
55
55
|
return capitalizeFirstLetter;
|
|
56
56
|
},
|
|
57
|
+
cleanHTML: function() {
|
|
58
|
+
return cleanHTML;
|
|
59
|
+
},
|
|
57
60
|
firstWord: function() {
|
|
58
61
|
return firstWord;
|
|
59
62
|
},
|
|
@@ -104,10 +107,95 @@ var stripHtml = function(html) {
|
|
|
104
107
|
var normalizeFileName = function(filename) {
|
|
105
108
|
return filename.normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/\[.*?\]/g, "").replace(/[^a-zA-Z0-9.-]+/g, "-").replace(/--+/g, "-").replace(/^-+|-+$/g, "").toLowerCase();
|
|
106
109
|
};
|
|
110
|
+
var cleanHTML = function(htmlString) {
|
|
111
|
+
var cleaned = htmlString;
|
|
112
|
+
cleaned = cleaned.replace(/\s*style\s*=\s*"[^"]*"/gi, "");
|
|
113
|
+
cleaned = cleaned.replace(/\s*style\s*=\s*'[^']*'/gi, "");
|
|
114
|
+
cleaned = cleaned.replace(/\s*class\s*=\s*"[^"]*"/gi, "");
|
|
115
|
+
cleaned = cleaned.replace(/\s*class\s*=\s*'[^']*'/gi, "");
|
|
116
|
+
cleaned = cleaned.replace(/\s*data-[a-zA-Z0-9\-_]*\s*=\s*"[^"]*"/gi, "");
|
|
117
|
+
cleaned = cleaned.replace(/\s*data-[a-zA-Z0-9\-_]*\s*=\s*'[^']*'/gi, "");
|
|
118
|
+
cleaned = cleaned.replace(/\s*rel\s*=\s*"[^"]*"/gi, "");
|
|
119
|
+
cleaned = cleaned.replace(/\s*rel\s*=\s*'[^']*'/gi, "");
|
|
120
|
+
var unwantedAttributes = [
|
|
121
|
+
"--tw-scale-x",
|
|
122
|
+
"--tw-scale-y",
|
|
123
|
+
"--tw-pan-x",
|
|
124
|
+
"--tw-pan-y",
|
|
125
|
+
"--tw-pinch-zoom",
|
|
126
|
+
"--tw-scroll-snap-strictness",
|
|
127
|
+
"--tw-gradient-from-position",
|
|
128
|
+
"--tw-gradient-via-position",
|
|
129
|
+
"--tw-gradient-to-position",
|
|
130
|
+
"--tw-ordinal",
|
|
131
|
+
"--tw-slashed-zero",
|
|
132
|
+
"--tw-numeric-figure",
|
|
133
|
+
"--tw-numeric-spacing",
|
|
134
|
+
"--tw-numeric-fraction",
|
|
135
|
+
"--tw-ring-inset",
|
|
136
|
+
"--tw-ring-offset-width",
|
|
137
|
+
"--tw-ring-offset-color",
|
|
138
|
+
"--tw-ring-color",
|
|
139
|
+
"--tw-ring-offset-shadow",
|
|
140
|
+
"--tw-ring-shadow",
|
|
141
|
+
"--tw-shadow",
|
|
142
|
+
"--tw-shadow-colored",
|
|
143
|
+
"--tw-blur",
|
|
144
|
+
"--tw-brightness",
|
|
145
|
+
"--tw-contrast",
|
|
146
|
+
"--tw-grayscale",
|
|
147
|
+
"--tw-hue-rotate",
|
|
148
|
+
"--tw-invert",
|
|
149
|
+
"--tw-saturate",
|
|
150
|
+
"--tw-sepia",
|
|
151
|
+
"--tw-drop-shadow",
|
|
152
|
+
"--tw-backdrop-blur",
|
|
153
|
+
"--tw-backdrop-brightness",
|
|
154
|
+
"--tw-backdrop-contrast",
|
|
155
|
+
"--tw-backdrop-grayscale",
|
|
156
|
+
"--tw-backdrop-hue-rotate",
|
|
157
|
+
"--tw-backdrop-invert",
|
|
158
|
+
"--tw-backdrop-opacity",
|
|
159
|
+
"--tw-backdrop-saturate",
|
|
160
|
+
"--tw-backdrop-sepia",
|
|
161
|
+
"--tw-contain-size",
|
|
162
|
+
"--tw-contain-layout",
|
|
163
|
+
"--tw-contain-paint",
|
|
164
|
+
"--tw-contain-style"
|
|
165
|
+
];
|
|
166
|
+
unwantedAttributes.forEach(function(attr) {
|
|
167
|
+
var regex = new RegExp("\\s*".concat(attr.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), '\\s*=\\s*"[^"]*"'), "gi");
|
|
168
|
+
cleaned = cleaned.replace(regex, "");
|
|
169
|
+
});
|
|
170
|
+
cleaned = cleaned.replace(/<span[^>]*>\s*<\/span>/gi, "");
|
|
171
|
+
cleaned = cleaned.replace(/<span[^>]*>([^<]+)<\/span>/gi, "$1");
|
|
172
|
+
for(var i = 0; i < 5; i++){
|
|
173
|
+
cleaned = cleaned.replace(/<span[^>]*>([^<]*(?:<(?!span|\/span)[^>]*>[^<]*<\/[^>]*>[^<]*)*)<\/span>/gi, "$1");
|
|
174
|
+
}
|
|
175
|
+
var selfClosingTags = [
|
|
176
|
+
"br",
|
|
177
|
+
"img",
|
|
178
|
+
"hr",
|
|
179
|
+
"input",
|
|
180
|
+
"meta",
|
|
181
|
+
"link"
|
|
182
|
+
];
|
|
183
|
+
cleaned = cleaned.replace(/<(\w+)[^>]*>\s*<\/\1>/gi, function(match, tagName) {
|
|
184
|
+
return selfClosingTags.includes(tagName.toLowerCase()) ? match : "";
|
|
185
|
+
});
|
|
186
|
+
cleaned = cleaned.replace(/(<br[^>]*>\s*){3,}/gi, "<br><br>");
|
|
187
|
+
cleaned = cleaned.replace(/<p[^>]*>\s*<\/p>/gi, "");
|
|
188
|
+
cleaned = cleaned.replace(/\s+/g, " ");
|
|
189
|
+
cleaned = cleaned.replace(/>\s+</g, "><");
|
|
190
|
+
cleaned = cleaned.trim();
|
|
191
|
+
cleaned = cleaned.replace(/\n\s*\n\s*\n/g, "\n\n");
|
|
192
|
+
return cleaned;
|
|
193
|
+
};
|
|
107
194
|
// Annotate the CommonJS export names for ESM import in node:
|
|
108
195
|
0 && (module.exports = {
|
|
109
196
|
capitalize: capitalize,
|
|
110
197
|
capitalizeFirstLetter: capitalizeFirstLetter,
|
|
198
|
+
cleanHTML: cleanHTML,
|
|
111
199
|
firstWord: firstWord,
|
|
112
200
|
normalizeFileName: normalizeFileName,
|
|
113
201
|
removeCData: removeCData,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/henriquewilson/Developer/Projects/gabirubi-domain/dist/util/string.util.js","../../src/util/string.util.ts"],"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","value","string_util_exports","capitalize","capitalizeFirstLetter","firstWord","normalizeFileName","removeCData","stripHtml","module","exports","import_lodash","require","v","jump","split","map","s","lower","toLowerCase","includes","charAt","toUpperCase","slice","join","text","replace","first","frase","html","trim","filename","normalize"],"mappings":"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","sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n\n// src/util/string.util.ts\nvar string_util_exports = {};\n__export(string_util_exports, {\n capitalize: () => capitalize,\n capitalizeFirstLetter: () => capitalizeFirstLetter,\n firstWord: () => firstWord,\n normalizeFileName: () => normalizeFileName,\n removeCData: () => removeCData,\n stripHtml: () => stripHtml\n});\nmodule.exports = __toCommonJS(string_util_exports);\nvar import_lodash = require(\"lodash\");\nvar capitalize = (value) => {\n if (value) {\n const v = `${value}`;\n const jump = [\"de\", \"da\", \"do\"];\n return v.split(\" \").map((s) => {\n const lower = s.toLowerCase();\n if (jump.includes(lower)) {\n return lower;\n }\n return `${lower.charAt(0).toUpperCase()}${lower.slice(1)}`;\n }).join(\" \");\n }\n return \"\";\n};\nvar removeCData = (text) => {\n return text?.replace(/<!\\[CDATA\\[|\\]\\]>/g, \"\") || \"\";\n};\nvar firstWord = (text) => {\n if (!text) return \"\";\n return (0, import_lodash.first)(text.split(\" \")) || \"\";\n};\nvar capitalizeFirstLetter = (frase) => {\n if (!frase) return \"\";\n return frase.charAt(0).toUpperCase() + frase.slice(1);\n};\nvar stripHtml = (html) => {\n return html?.replace(/<[^>]*>/g, \"\").replace(/\\s+/g, \" \").trim() || \"\";\n};\nvar normalizeFileName = (filename) => {\n return filename.normalize(\"NFD\").replace(/[\\u0300-\\u036f]/g, \"\").replace(/\\[.*?\\]/g, \"\").replace(/[^a-zA-Z0-9.-]+/g, \"-\").replace(/--+/g, \"-\").replace(/^-+|-+$/g, \"\").toLowerCase();\n};\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n capitalize,\n capitalizeFirstLetter,\n firstWord,\n normalizeFileName,\n removeCData,\n stripHtml\n});\n","import { first } from 'lodash'\n\nexport const capitalize = (\n value: string | number | unknown | undefined,\n): string => {\n if (value) {\n const v = `${value}`\n const jump = ['de', 'da', 'do']\n return v\n .split(' ')\n .map((s) => {\n const lower = s.toLowerCase()\n if (jump.includes(lower)) {\n return lower\n }\n return `${lower.charAt(0).toUpperCase()}${lower.slice(1)}`\n })\n .join(' ')\n }\n return ''\n}\n\nexport const removeCData = (text: string): string => {\n return text?.replace(/<!\\[CDATA\\[|\\]\\]>/g, '') || ''\n}\n\nexport const firstWord = (text?: string): string => {\n if (!text) return ''\n return first(text.split(' ')) || ''\n}\n\nexport const capitalizeFirstLetter = (frase: string): string => {\n if (!frase) return '';\n return frase.charAt(0).toUpperCase() + frase.slice(1);\n}\n\nexport const stripHtml = (html: string): string => {\n return html?.replace(/<[^>]*>/g, '').replace(/\\s+/g, ' ').trim() || ''\n}\n\nexport const normalizeFileName = (filename: string) => {\n return filename\n .normalize('NFD') // separa acentos de letras\n .replace(/[\\u0300-\\u036f]/g, '') // remove os acentos\n .replace(/\\[.*?\\]/g, '') // remove colchetes e seu conteúdo\n .replace(/[^a-zA-Z0-9.-]+/g, '-') // substitui espaços e símbolos por hífen\n .replace(/--+/g, '-') // evita múltiplos hífens consecutivos\n .replace(/^-+|-+$/g, '') // remove hífens do início/fim\n .toLowerCase(); // tudo minúsculo\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/Users/henriquewilson/Developer/Projects/gabirubi-domain/dist/util/string.util.js","../../src/util/string.util.ts"],"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","value","string_util_exports","capitalize","capitalizeFirstLetter","cleanHTML","firstWord","normalizeFileName","removeCData","stripHtml","module","exports","import_lodash","require","v","jump","split","map","s","lower","toLowerCase","includes","charAt","toUpperCase","slice","join","text","replace","first","frase","html","trim","filename","normalize","htmlString","cleaned","unwantedAttributes","forEach","attr","regex","RegExp","i","selfClosingTags","match","tagName"],"mappings":"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","sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n\n// src/util/string.util.ts\nvar string_util_exports = {};\n__export(string_util_exports, {\n capitalize: () => capitalize,\n capitalizeFirstLetter: () => capitalizeFirstLetter,\n cleanHTML: () => cleanHTML,\n firstWord: () => firstWord,\n normalizeFileName: () => normalizeFileName,\n removeCData: () => removeCData,\n stripHtml: () => stripHtml\n});\nmodule.exports = __toCommonJS(string_util_exports);\nvar import_lodash = require(\"lodash\");\nvar capitalize = (value) => {\n if (value) {\n const v = `${value}`;\n const jump = [\"de\", \"da\", \"do\"];\n return v.split(\" \").map((s) => {\n const lower = s.toLowerCase();\n if (jump.includes(lower)) {\n return lower;\n }\n return `${lower.charAt(0).toUpperCase()}${lower.slice(1)}`;\n }).join(\" \");\n }\n return \"\";\n};\nvar removeCData = (text) => {\n return text?.replace(/<!\\[CDATA\\[|\\]\\]>/g, \"\") || \"\";\n};\nvar firstWord = (text) => {\n if (!text) return \"\";\n return (0, import_lodash.first)(text.split(\" \")) || \"\";\n};\nvar capitalizeFirstLetter = (frase) => {\n if (!frase) return \"\";\n return frase.charAt(0).toUpperCase() + frase.slice(1);\n};\nvar stripHtml = (html) => {\n return html?.replace(/<[^>]*>/g, \"\").replace(/\\s+/g, \" \").trim() || \"\";\n};\nvar normalizeFileName = (filename) => {\n return filename.normalize(\"NFD\").replace(/[\\u0300-\\u036f]/g, \"\").replace(/\\[.*?\\]/g, \"\").replace(/[^a-zA-Z0-9.-]+/g, \"-\").replace(/--+/g, \"-\").replace(/^-+|-+$/g, \"\").toLowerCase();\n};\nvar cleanHTML = (htmlString) => {\n let cleaned = htmlString;\n cleaned = cleaned.replace(/\\s*style\\s*=\\s*\"[^\"]*\"/gi, \"\");\n cleaned = cleaned.replace(/\\s*style\\s*=\\s*'[^']*'/gi, \"\");\n cleaned = cleaned.replace(/\\s*class\\s*=\\s*\"[^\"]*\"/gi, \"\");\n cleaned = cleaned.replace(/\\s*class\\s*=\\s*'[^']*'/gi, \"\");\n cleaned = cleaned.replace(/\\s*data-[a-zA-Z0-9\\-_]*\\s*=\\s*\"[^\"]*\"/gi, \"\");\n cleaned = cleaned.replace(/\\s*data-[a-zA-Z0-9\\-_]*\\s*=\\s*'[^']*'/gi, \"\");\n cleaned = cleaned.replace(/\\s*rel\\s*=\\s*\"[^\"]*\"/gi, \"\");\n cleaned = cleaned.replace(/\\s*rel\\s*=\\s*'[^']*'/gi, \"\");\n const unwantedAttributes = [\n \"--tw-scale-x\",\n \"--tw-scale-y\",\n \"--tw-pan-x\",\n \"--tw-pan-y\",\n \"--tw-pinch-zoom\",\n \"--tw-scroll-snap-strictness\",\n \"--tw-gradient-from-position\",\n \"--tw-gradient-via-position\",\n \"--tw-gradient-to-position\",\n \"--tw-ordinal\",\n \"--tw-slashed-zero\",\n \"--tw-numeric-figure\",\n \"--tw-numeric-spacing\",\n \"--tw-numeric-fraction\",\n \"--tw-ring-inset\",\n \"--tw-ring-offset-width\",\n \"--tw-ring-offset-color\",\n \"--tw-ring-color\",\n \"--tw-ring-offset-shadow\",\n \"--tw-ring-shadow\",\n \"--tw-shadow\",\n \"--tw-shadow-colored\",\n \"--tw-blur\",\n \"--tw-brightness\",\n \"--tw-contrast\",\n \"--tw-grayscale\",\n \"--tw-hue-rotate\",\n \"--tw-invert\",\n \"--tw-saturate\",\n \"--tw-sepia\",\n \"--tw-drop-shadow\",\n \"--tw-backdrop-blur\",\n \"--tw-backdrop-brightness\",\n \"--tw-backdrop-contrast\",\n \"--tw-backdrop-grayscale\",\n \"--tw-backdrop-hue-rotate\",\n \"--tw-backdrop-invert\",\n \"--tw-backdrop-opacity\",\n \"--tw-backdrop-saturate\",\n \"--tw-backdrop-sepia\",\n \"--tw-contain-size\",\n \"--tw-contain-layout\",\n \"--tw-contain-paint\",\n \"--tw-contain-style\"\n ];\n unwantedAttributes.forEach((attr) => {\n const regex = new RegExp(`\\\\s*${attr.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, \"\\\\$&\")}\\\\s*=\\\\s*\"[^\"]*\"`, \"gi\");\n cleaned = cleaned.replace(regex, \"\");\n });\n cleaned = cleaned.replace(/<span[^>]*>\\s*<\\/span>/gi, \"\");\n cleaned = cleaned.replace(/<span[^>]*>([^<]+)<\\/span>/gi, \"$1\");\n for (let i = 0; i < 5; i++) {\n cleaned = cleaned.replace(/<span[^>]*>([^<]*(?:<(?!span|\\/span)[^>]*>[^<]*<\\/[^>]*>[^<]*)*)<\\/span>/gi, \"$1\");\n }\n const selfClosingTags = [\"br\", \"img\", \"hr\", \"input\", \"meta\", \"link\"];\n cleaned = cleaned.replace(/<(\\w+)[^>]*>\\s*<\\/\\1>/gi, (match, tagName) => {\n return selfClosingTags.includes(tagName.toLowerCase()) ? match : \"\";\n });\n cleaned = cleaned.replace(/(<br[^>]*>\\s*){3,}/gi, \"<br><br>\");\n cleaned = cleaned.replace(/<p[^>]*>\\s*<\\/p>/gi, \"\");\n cleaned = cleaned.replace(/\\s+/g, \" \");\n cleaned = cleaned.replace(/>\\s+</g, \"><\");\n cleaned = cleaned.trim();\n cleaned = cleaned.replace(/\\n\\s*\\n\\s*\\n/g, \"\\n\\n\");\n return cleaned;\n};\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n capitalize,\n capitalizeFirstLetter,\n cleanHTML,\n firstWord,\n normalizeFileName,\n removeCData,\n stripHtml\n});\n","import { first } from 'lodash'\n\nexport const capitalize = (\n value: string | number | unknown | undefined,\n): string => {\n if (value) {\n const v = `${value}`\n const jump = ['de', 'da', 'do']\n return v\n .split(' ')\n .map((s) => {\n const lower = s.toLowerCase()\n if (jump.includes(lower)) {\n return lower\n }\n return `${lower.charAt(0).toUpperCase()}${lower.slice(1)}`\n })\n .join(' ')\n }\n return ''\n}\n\nexport const removeCData = (text: string): string => {\n return text?.replace(/<!\\[CDATA\\[|\\]\\]>/g, '') || ''\n}\n\nexport const firstWord = (text?: string): string => {\n if (!text) return ''\n return first(text.split(' ')) || ''\n}\n\nexport const capitalizeFirstLetter = (frase: string): string => {\n if (!frase) return '';\n return frase.charAt(0).toUpperCase() + frase.slice(1);\n}\n\nexport const stripHtml = (html: string): string => {\n return html?.replace(/<[^>]*>/g, '').replace(/\\s+/g, ' ').trim() || ''\n}\n\nexport const normalizeFileName = (filename: string) => {\n return filename\n .normalize('NFD') // separa acentos de letras\n .replace(/[\\u0300-\\u036f]/g, '') // remove os acentos\n .replace(/\\[.*?\\]/g, '') // remove colchetes e seu conteúdo\n .replace(/[^a-zA-Z0-9.-]+/g, '-') // substitui espaços e símbolos por hífen\n .replace(/--+/g, '-') // evita múltiplos hífens consecutivos\n .replace(/^-+|-+$/g, '') // remove hífens do início/fim\n .toLowerCase(); // tudo minúsculo\n}\n\nexport const cleanHTML = (htmlString: string)=> {\n let cleaned = htmlString;\n\n // Remove todos os atributos style (incluindo inline styles complexos)\n cleaned = cleaned.replace(/\\s*style\\s*=\\s*\"[^\"]*\"/gi, '');\n cleaned = cleaned.replace(/\\s*style\\s*=\\s*'[^']*'/gi, '');\n\n // Remove classes CSS\n cleaned = cleaned.replace(/\\s*class\\s*=\\s*\"[^\"]*\"/gi, '');\n cleaned = cleaned.replace(/\\s*class\\s*=\\s*'[^']*'/gi, '');\n\n // Remove todos os atributos data-*\n cleaned = cleaned.replace(/\\s*data-[a-zA-Z0-9\\-_]*\\s*=\\s*\"[^\"]*\"/gi, '');\n cleaned = cleaned.replace(/\\s*data-[a-zA-Z0-9\\-_]*\\s*=\\s*'[^']*'/gi, '');\n\n // Remove atributos rel\n cleaned = cleaned.replace(/\\s*rel\\s*=\\s*\"[^\"]*\"/gi, '');\n cleaned = cleaned.replace(/\\s*rel\\s*=\\s*'[^']*'/gi, '');\n\n // Remove atributos específicos do Tailwind e CSS variables\n const unwantedAttributes = [\n '--tw-scale-x', '--tw-scale-y', '--tw-pan-x', '--tw-pan-y',\n '--tw-pinch-zoom', '--tw-scroll-snap-strictness', '--tw-gradient-from-position',\n '--tw-gradient-via-position', '--tw-gradient-to-position', '--tw-ordinal',\n '--tw-slashed-zero', '--tw-numeric-figure', '--tw-numeric-spacing',\n '--tw-numeric-fraction', '--tw-ring-inset', '--tw-ring-offset-width',\n '--tw-ring-offset-color', '--tw-ring-color', '--tw-ring-offset-shadow',\n '--tw-ring-shadow', '--tw-shadow', '--tw-shadow-colored', '--tw-blur',\n '--tw-brightness', '--tw-contrast', '--tw-grayscale', '--tw-hue-rotate',\n '--tw-invert', '--tw-saturate', '--tw-sepia', '--tw-drop-shadow',\n '--tw-backdrop-blur', '--tw-backdrop-brightness', '--tw-backdrop-contrast',\n '--tw-backdrop-grayscale', '--tw-backdrop-hue-rotate', '--tw-backdrop-invert',\n '--tw-backdrop-opacity', '--tw-backdrop-saturate', '--tw-backdrop-sepia',\n '--tw-contain-size', '--tw-contain-layout', '--tw-contain-paint', '--tw-contain-style',\n ];\n\n unwantedAttributes.forEach((attr) => {\n const regex = new RegExp(`\\\\s*${attr.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&')}\\\\s*=\\\\s*\"[^\"]*\"`, 'gi');\n cleaned = cleaned.replace(regex, '');\n });\n\n // Remove spans que só servem para estilização (vazios ou só com texto)\n // Primeiro remove spans vazios\n cleaned = cleaned.replace(/<span[^>]*>\\s*<\\/span>/gi, '');\n\n // Remove spans que só contêm texto (sem elementos filhos)\n cleaned = cleaned.replace(/<span[^>]*>([^<]+)<\\/span>/gi, '$1');\n\n // Remove spans aninhados desnecessários (múltiplas passadas)\n for (let i = 0; i < 5; i++) {\n cleaned = cleaned.replace(/<span[^>]*>([^<]*(?:<(?!span|\\/span)[^>]*>[^<]*<\\/[^>]*>[^<]*)*)<\\/span>/gi, '$1');\n }\n\n // Remove elementos vazios (exceto br, img, hr, input)\n const selfClosingTags = ['br', 'img', 'hr', 'input', 'meta', 'link'];\n cleaned = cleaned.replace(/<(\\w+)[^>]*>\\s*<\\/\\1>/gi, (match, tagName) => {\n return selfClosingTags.includes(tagName.toLowerCase()) ? match : '';\n });\n\n // Remove BRs consecutivos excessivos\n cleaned = cleaned.replace(/(<br[^>]*>\\s*){3,}/gi, '<br><br>');\n\n // Remove apenas parágrafos completamente vazios (sem br)\n cleaned = cleaned.replace(/<p[^>]*>\\s*<\\/p>/gi, '');\n\n // Limpa espaços em excesso\n cleaned = cleaned.replace(/\\s+/g, ' ');\n\n // Remove espaços no início e fim de tags\n cleaned = cleaned.replace(/>\\s+</g, '><');\n\n // Remove espaços extras no início e fim\n cleaned = cleaned.trim();\n\n // Remove linhas vazias múltiplas\n cleaned = cleaned.replace(/\\n\\s*\\n\\s*\\n/g, '\\n\\n');\n\n return cleaned;\n}\n"]}
|
|
@@ -35,5 +35,89 @@ var stripHtml = function(html) {
|
|
|
35
35
|
var normalizeFileName = function(filename) {
|
|
36
36
|
return filename.normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/\[.*?\]/g, "").replace(/[^a-zA-Z0-9.-]+/g, "-").replace(/--+/g, "-").replace(/^-+|-+$/g, "").toLowerCase();
|
|
37
37
|
};
|
|
38
|
-
|
|
38
|
+
var cleanHTML = function(htmlString) {
|
|
39
|
+
var cleaned = htmlString;
|
|
40
|
+
cleaned = cleaned.replace(/\s*style\s*=\s*"[^"]*"/gi, "");
|
|
41
|
+
cleaned = cleaned.replace(/\s*style\s*=\s*'[^']*'/gi, "");
|
|
42
|
+
cleaned = cleaned.replace(/\s*class\s*=\s*"[^"]*"/gi, "");
|
|
43
|
+
cleaned = cleaned.replace(/\s*class\s*=\s*'[^']*'/gi, "");
|
|
44
|
+
cleaned = cleaned.replace(/\s*data-[a-zA-Z0-9\-_]*\s*=\s*"[^"]*"/gi, "");
|
|
45
|
+
cleaned = cleaned.replace(/\s*data-[a-zA-Z0-9\-_]*\s*=\s*'[^']*'/gi, "");
|
|
46
|
+
cleaned = cleaned.replace(/\s*rel\s*=\s*"[^"]*"/gi, "");
|
|
47
|
+
cleaned = cleaned.replace(/\s*rel\s*=\s*'[^']*'/gi, "");
|
|
48
|
+
var unwantedAttributes = [
|
|
49
|
+
"--tw-scale-x",
|
|
50
|
+
"--tw-scale-y",
|
|
51
|
+
"--tw-pan-x",
|
|
52
|
+
"--tw-pan-y",
|
|
53
|
+
"--tw-pinch-zoom",
|
|
54
|
+
"--tw-scroll-snap-strictness",
|
|
55
|
+
"--tw-gradient-from-position",
|
|
56
|
+
"--tw-gradient-via-position",
|
|
57
|
+
"--tw-gradient-to-position",
|
|
58
|
+
"--tw-ordinal",
|
|
59
|
+
"--tw-slashed-zero",
|
|
60
|
+
"--tw-numeric-figure",
|
|
61
|
+
"--tw-numeric-spacing",
|
|
62
|
+
"--tw-numeric-fraction",
|
|
63
|
+
"--tw-ring-inset",
|
|
64
|
+
"--tw-ring-offset-width",
|
|
65
|
+
"--tw-ring-offset-color",
|
|
66
|
+
"--tw-ring-color",
|
|
67
|
+
"--tw-ring-offset-shadow",
|
|
68
|
+
"--tw-ring-shadow",
|
|
69
|
+
"--tw-shadow",
|
|
70
|
+
"--tw-shadow-colored",
|
|
71
|
+
"--tw-blur",
|
|
72
|
+
"--tw-brightness",
|
|
73
|
+
"--tw-contrast",
|
|
74
|
+
"--tw-grayscale",
|
|
75
|
+
"--tw-hue-rotate",
|
|
76
|
+
"--tw-invert",
|
|
77
|
+
"--tw-saturate",
|
|
78
|
+
"--tw-sepia",
|
|
79
|
+
"--tw-drop-shadow",
|
|
80
|
+
"--tw-backdrop-blur",
|
|
81
|
+
"--tw-backdrop-brightness",
|
|
82
|
+
"--tw-backdrop-contrast",
|
|
83
|
+
"--tw-backdrop-grayscale",
|
|
84
|
+
"--tw-backdrop-hue-rotate",
|
|
85
|
+
"--tw-backdrop-invert",
|
|
86
|
+
"--tw-backdrop-opacity",
|
|
87
|
+
"--tw-backdrop-saturate",
|
|
88
|
+
"--tw-backdrop-sepia",
|
|
89
|
+
"--tw-contain-size",
|
|
90
|
+
"--tw-contain-layout",
|
|
91
|
+
"--tw-contain-paint",
|
|
92
|
+
"--tw-contain-style"
|
|
93
|
+
];
|
|
94
|
+
unwantedAttributes.forEach(function(attr) {
|
|
95
|
+
var regex = new RegExp("\\s*".concat(attr.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), '\\s*=\\s*"[^"]*"'), "gi");
|
|
96
|
+
cleaned = cleaned.replace(regex, "");
|
|
97
|
+
});
|
|
98
|
+
cleaned = cleaned.replace(/<span[^>]*>\s*<\/span>/gi, "");
|
|
99
|
+
cleaned = cleaned.replace(/<span[^>]*>([^<]+)<\/span>/gi, "$1");
|
|
100
|
+
for(var i = 0; i < 5; i++){
|
|
101
|
+
cleaned = cleaned.replace(/<span[^>]*>([^<]*(?:<(?!span|\/span)[^>]*>[^<]*<\/[^>]*>[^<]*)*)<\/span>/gi, "$1");
|
|
102
|
+
}
|
|
103
|
+
var selfClosingTags = [
|
|
104
|
+
"br",
|
|
105
|
+
"img",
|
|
106
|
+
"hr",
|
|
107
|
+
"input",
|
|
108
|
+
"meta",
|
|
109
|
+
"link"
|
|
110
|
+
];
|
|
111
|
+
cleaned = cleaned.replace(/<(\w+)[^>]*>\s*<\/\1>/gi, function(match, tagName) {
|
|
112
|
+
return selfClosingTags.includes(tagName.toLowerCase()) ? match : "";
|
|
113
|
+
});
|
|
114
|
+
cleaned = cleaned.replace(/(<br[^>]*>\s*){3,}/gi, "<br><br>");
|
|
115
|
+
cleaned = cleaned.replace(/<p[^>]*>\s*<\/p>/gi, "");
|
|
116
|
+
cleaned = cleaned.replace(/\s+/g, " ");
|
|
117
|
+
cleaned = cleaned.replace(/>\s+</g, "><");
|
|
118
|
+
cleaned = cleaned.trim();
|
|
119
|
+
cleaned = cleaned.replace(/\n\s*\n\s*\n/g, "\n\n");
|
|
120
|
+
return cleaned;
|
|
121
|
+
};
|
|
122
|
+
export { capitalize, capitalizeFirstLetter, cleanHTML, firstWord, normalizeFileName, removeCData, stripHtml };
|
|
39
123
|
//# sourceMappingURL=string.util.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/henriquewilson/Developer/Projects/gabirubi-domain/dist/util/string.util.mjs","../../src/util/string.util.ts"],"names":["first","capitalize","value","v","jump","split","map","s","lower","toLowerCase","includes","charAt","toUpperCase","slice","join","removeCData","text","replace","firstWord","capitalizeFirstLetter","frase","stripHtml","html","trim","normalizeFileName","filename","normalize"],"mappings":"AAAA,0BAA0B;ACA1B,SAASA,KAAA,QAAa,SAAA;AAEf,IAAMC,aAAa,SACxBC;IAEA,IAAIA,OAAO;QACT,IAAMC,IAAI,GAAQ,OAALD;QACb,IAAME,OAAO;YAAC;YAAM;YAAM;SAAI;QAC9B,OAAOD,EACJE,KAAA,CAAM,KACNC,GAAA,CAAI,SAACC;YACJ,IAAMC,QAAQD,EAAEE,WAAA;YAChB,IAAIL,KAAKM,QAAA,CAASF,QAAQ;gBACxB,OAAOA;YACT;YACA,OAAO,GAAmCA,OAAhCA,MAAMG,MAAA,CAAO,GAAGC,WAAA,IAA8B,OAAdJ,MAAMK,KAAA,CAAM;QACxD,GACCC,IAAA,CAAK;IACV;IACA,OAAO;AACT;AAEO,IAAMC,cAAc,SAACC;IAC1B,OAAOA,CAAAA,iBAAAA,2BAAAA,KAAMC,OAAA,CAAQ,sBAAsB,QAAO;AACpD;AAEO,IAAMC,YAAY,SAACF;IACxB,IAAI,CAACA,MAAM,OAAO;IAClB,OAAOhB,MAAMgB,KAAKX,KAAA,CAAM,SAAS;AACnC;AAEO,IAAMc,wBAAwB,SAACC;IACpC,IAAI,CAACA,OAAO,OAAO;IACnB,OAAOA,MAAMT,MAAA,CAAO,GAAGC,WAAA,KAAgBQ,MAAMP,KAAA,CAAM;AACrD;AAEO,IAAMQ,YAAY,SAACC;IACxB,OAAOA,CAAAA,iBAAAA,2BAAAA,KAAML,OAAA,CAAQ,YAAY,IAAIA,OAAA,CAAQ,QAAQ,KAAKM,IAAA,OAAU;AACtE;AAEO,IAAMC,oBAAoB,SAACC;IAChC,OAAOA,SACJC,SAAA,CAAU,OACVT,OAAA,CAAQ,oBAAoB,IAC5BA,OAAA,CAAQ,YAAY,IACpBA,OAAA,CAAQ,oBAAoB,KAC5BA,OAAA,CAAQ,QAAQ,KAChBA,OAAA,CAAQ,YAAY,IACpBR,WAAA;AACL;ADhBA,SACER,UAAU,EACVkB,qBAAqB,EACrBD,SAAS,EACTM,iBAAiB,EACjBT,WAAW,EACXM,SAAS,GACT","sourcesContent":["// src/util/string.util.ts\nimport { first } from \"lodash\";\nvar capitalize = (value) => {\n if (value) {\n const v = `${value}`;\n const jump = [\"de\", \"da\", \"do\"];\n return v.split(\" \").map((s) => {\n const lower = s.toLowerCase();\n if (jump.includes(lower)) {\n return lower;\n }\n return `${lower.charAt(0).toUpperCase()}${lower.slice(1)}`;\n }).join(\" \");\n }\n return \"\";\n};\nvar removeCData = (text) => {\n return text?.replace(/<!\\[CDATA\\[|\\]\\]>/g, \"\") || \"\";\n};\nvar firstWord = (text) => {\n if (!text) return \"\";\n return first(text.split(\" \")) || \"\";\n};\nvar capitalizeFirstLetter = (frase) => {\n if (!frase) return \"\";\n return frase.charAt(0).toUpperCase() + frase.slice(1);\n};\nvar stripHtml = (html) => {\n return html?.replace(/<[^>]*>/g, \"\").replace(/\\s+/g, \" \").trim() || \"\";\n};\nvar normalizeFileName = (filename) => {\n return filename.normalize(\"NFD\").replace(/[\\u0300-\\u036f]/g, \"\").replace(/\\[.*?\\]/g, \"\").replace(/[^a-zA-Z0-9.-]+/g, \"-\").replace(/--+/g, \"-\").replace(/^-+|-+$/g, \"\").toLowerCase();\n};\nexport {\n capitalize,\n capitalizeFirstLetter,\n firstWord,\n normalizeFileName,\n removeCData,\n stripHtml\n};\n","import { first } from 'lodash'\n\nexport const capitalize = (\n value: string | number | unknown | undefined,\n): string => {\n if (value) {\n const v = `${value}`\n const jump = ['de', 'da', 'do']\n return v\n .split(' ')\n .map((s) => {\n const lower = s.toLowerCase()\n if (jump.includes(lower)) {\n return lower\n }\n return `${lower.charAt(0).toUpperCase()}${lower.slice(1)}`\n })\n .join(' ')\n }\n return ''\n}\n\nexport const removeCData = (text: string): string => {\n return text?.replace(/<!\\[CDATA\\[|\\]\\]>/g, '') || ''\n}\n\nexport const firstWord = (text?: string): string => {\n if (!text) return ''\n return first(text.split(' ')) || ''\n}\n\nexport const capitalizeFirstLetter = (frase: string): string => {\n if (!frase) return '';\n return frase.charAt(0).toUpperCase() + frase.slice(1);\n}\n\nexport const stripHtml = (html: string): string => {\n return html?.replace(/<[^>]*>/g, '').replace(/\\s+/g, ' ').trim() || ''\n}\n\nexport const normalizeFileName = (filename: string) => {\n return filename\n .normalize('NFD') // separa acentos de letras\n .replace(/[\\u0300-\\u036f]/g, '') // remove os acentos\n .replace(/\\[.*?\\]/g, '') // remove colchetes e seu conteúdo\n .replace(/[^a-zA-Z0-9.-]+/g, '-') // substitui espaços e símbolos por hífen\n .replace(/--+/g, '-') // evita múltiplos hífens consecutivos\n .replace(/^-+|-+$/g, '') // remove hífens do início/fim\n .toLowerCase(); // tudo minúsculo\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/Users/henriquewilson/Developer/Projects/gabirubi-domain/dist/util/string.util.mjs","../../src/util/string.util.ts"],"names":["first","capitalize","value","v","jump","split","map","s","lower","toLowerCase","includes","charAt","toUpperCase","slice","join","removeCData","text","replace","firstWord","capitalizeFirstLetter","frase","stripHtml","html","trim","normalizeFileName","filename","normalize","cleanHTML","htmlString","cleaned","unwantedAttributes","forEach","attr","regex","RegExp","i","selfClosingTags","match","tagName"],"mappings":"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","sourcesContent":["// src/util/string.util.ts\nimport { first } from \"lodash\";\nvar capitalize = (value) => {\n if (value) {\n const v = `${value}`;\n const jump = [\"de\", \"da\", \"do\"];\n return v.split(\" \").map((s) => {\n const lower = s.toLowerCase();\n if (jump.includes(lower)) {\n return lower;\n }\n return `${lower.charAt(0).toUpperCase()}${lower.slice(1)}`;\n }).join(\" \");\n }\n return \"\";\n};\nvar removeCData = (text) => {\n return text?.replace(/<!\\[CDATA\\[|\\]\\]>/g, \"\") || \"\";\n};\nvar firstWord = (text) => {\n if (!text) return \"\";\n return first(text.split(\" \")) || \"\";\n};\nvar capitalizeFirstLetter = (frase) => {\n if (!frase) return \"\";\n return frase.charAt(0).toUpperCase() + frase.slice(1);\n};\nvar stripHtml = (html) => {\n return html?.replace(/<[^>]*>/g, \"\").replace(/\\s+/g, \" \").trim() || \"\";\n};\nvar normalizeFileName = (filename) => {\n return filename.normalize(\"NFD\").replace(/[\\u0300-\\u036f]/g, \"\").replace(/\\[.*?\\]/g, \"\").replace(/[^a-zA-Z0-9.-]+/g, \"-\").replace(/--+/g, \"-\").replace(/^-+|-+$/g, \"\").toLowerCase();\n};\nvar cleanHTML = (htmlString) => {\n let cleaned = htmlString;\n cleaned = cleaned.replace(/\\s*style\\s*=\\s*\"[^\"]*\"/gi, \"\");\n cleaned = cleaned.replace(/\\s*style\\s*=\\s*'[^']*'/gi, \"\");\n cleaned = cleaned.replace(/\\s*class\\s*=\\s*\"[^\"]*\"/gi, \"\");\n cleaned = cleaned.replace(/\\s*class\\s*=\\s*'[^']*'/gi, \"\");\n cleaned = cleaned.replace(/\\s*data-[a-zA-Z0-9\\-_]*\\s*=\\s*\"[^\"]*\"/gi, \"\");\n cleaned = cleaned.replace(/\\s*data-[a-zA-Z0-9\\-_]*\\s*=\\s*'[^']*'/gi, \"\");\n cleaned = cleaned.replace(/\\s*rel\\s*=\\s*\"[^\"]*\"/gi, \"\");\n cleaned = cleaned.replace(/\\s*rel\\s*=\\s*'[^']*'/gi, \"\");\n const unwantedAttributes = [\n \"--tw-scale-x\",\n \"--tw-scale-y\",\n \"--tw-pan-x\",\n \"--tw-pan-y\",\n \"--tw-pinch-zoom\",\n \"--tw-scroll-snap-strictness\",\n \"--tw-gradient-from-position\",\n \"--tw-gradient-via-position\",\n \"--tw-gradient-to-position\",\n \"--tw-ordinal\",\n \"--tw-slashed-zero\",\n \"--tw-numeric-figure\",\n \"--tw-numeric-spacing\",\n \"--tw-numeric-fraction\",\n \"--tw-ring-inset\",\n \"--tw-ring-offset-width\",\n \"--tw-ring-offset-color\",\n \"--tw-ring-color\",\n \"--tw-ring-offset-shadow\",\n \"--tw-ring-shadow\",\n \"--tw-shadow\",\n \"--tw-shadow-colored\",\n \"--tw-blur\",\n \"--tw-brightness\",\n \"--tw-contrast\",\n \"--tw-grayscale\",\n \"--tw-hue-rotate\",\n \"--tw-invert\",\n \"--tw-saturate\",\n \"--tw-sepia\",\n \"--tw-drop-shadow\",\n \"--tw-backdrop-blur\",\n \"--tw-backdrop-brightness\",\n \"--tw-backdrop-contrast\",\n \"--tw-backdrop-grayscale\",\n \"--tw-backdrop-hue-rotate\",\n \"--tw-backdrop-invert\",\n \"--tw-backdrop-opacity\",\n \"--tw-backdrop-saturate\",\n \"--tw-backdrop-sepia\",\n \"--tw-contain-size\",\n \"--tw-contain-layout\",\n \"--tw-contain-paint\",\n \"--tw-contain-style\"\n ];\n unwantedAttributes.forEach((attr) => {\n const regex = new RegExp(`\\\\s*${attr.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, \"\\\\$&\")}\\\\s*=\\\\s*\"[^\"]*\"`, \"gi\");\n cleaned = cleaned.replace(regex, \"\");\n });\n cleaned = cleaned.replace(/<span[^>]*>\\s*<\\/span>/gi, \"\");\n cleaned = cleaned.replace(/<span[^>]*>([^<]+)<\\/span>/gi, \"$1\");\n for (let i = 0; i < 5; i++) {\n cleaned = cleaned.replace(/<span[^>]*>([^<]*(?:<(?!span|\\/span)[^>]*>[^<]*<\\/[^>]*>[^<]*)*)<\\/span>/gi, \"$1\");\n }\n const selfClosingTags = [\"br\", \"img\", \"hr\", \"input\", \"meta\", \"link\"];\n cleaned = cleaned.replace(/<(\\w+)[^>]*>\\s*<\\/\\1>/gi, (match, tagName) => {\n return selfClosingTags.includes(tagName.toLowerCase()) ? match : \"\";\n });\n cleaned = cleaned.replace(/(<br[^>]*>\\s*){3,}/gi, \"<br><br>\");\n cleaned = cleaned.replace(/<p[^>]*>\\s*<\\/p>/gi, \"\");\n cleaned = cleaned.replace(/\\s+/g, \" \");\n cleaned = cleaned.replace(/>\\s+</g, \"><\");\n cleaned = cleaned.trim();\n cleaned = cleaned.replace(/\\n\\s*\\n\\s*\\n/g, \"\\n\\n\");\n return cleaned;\n};\nexport {\n capitalize,\n capitalizeFirstLetter,\n cleanHTML,\n firstWord,\n normalizeFileName,\n removeCData,\n stripHtml\n};\n","import { first } from 'lodash'\n\nexport const capitalize = (\n value: string | number | unknown | undefined,\n): string => {\n if (value) {\n const v = `${value}`\n const jump = ['de', 'da', 'do']\n return v\n .split(' ')\n .map((s) => {\n const lower = s.toLowerCase()\n if (jump.includes(lower)) {\n return lower\n }\n return `${lower.charAt(0).toUpperCase()}${lower.slice(1)}`\n })\n .join(' ')\n }\n return ''\n}\n\nexport const removeCData = (text: string): string => {\n return text?.replace(/<!\\[CDATA\\[|\\]\\]>/g, '') || ''\n}\n\nexport const firstWord = (text?: string): string => {\n if (!text) return ''\n return first(text.split(' ')) || ''\n}\n\nexport const capitalizeFirstLetter = (frase: string): string => {\n if (!frase) return '';\n return frase.charAt(0).toUpperCase() + frase.slice(1);\n}\n\nexport const stripHtml = (html: string): string => {\n return html?.replace(/<[^>]*>/g, '').replace(/\\s+/g, ' ').trim() || ''\n}\n\nexport const normalizeFileName = (filename: string) => {\n return filename\n .normalize('NFD') // separa acentos de letras\n .replace(/[\\u0300-\\u036f]/g, '') // remove os acentos\n .replace(/\\[.*?\\]/g, '') // remove colchetes e seu conteúdo\n .replace(/[^a-zA-Z0-9.-]+/g, '-') // substitui espaços e símbolos por hífen\n .replace(/--+/g, '-') // evita múltiplos hífens consecutivos\n .replace(/^-+|-+$/g, '') // remove hífens do início/fim\n .toLowerCase(); // tudo minúsculo\n}\n\nexport const cleanHTML = (htmlString: string)=> {\n let cleaned = htmlString;\n\n // Remove todos os atributos style (incluindo inline styles complexos)\n cleaned = cleaned.replace(/\\s*style\\s*=\\s*\"[^\"]*\"/gi, '');\n cleaned = cleaned.replace(/\\s*style\\s*=\\s*'[^']*'/gi, '');\n\n // Remove classes CSS\n cleaned = cleaned.replace(/\\s*class\\s*=\\s*\"[^\"]*\"/gi, '');\n cleaned = cleaned.replace(/\\s*class\\s*=\\s*'[^']*'/gi, '');\n\n // Remove todos os atributos data-*\n cleaned = cleaned.replace(/\\s*data-[a-zA-Z0-9\\-_]*\\s*=\\s*\"[^\"]*\"/gi, '');\n cleaned = cleaned.replace(/\\s*data-[a-zA-Z0-9\\-_]*\\s*=\\s*'[^']*'/gi, '');\n\n // Remove atributos rel\n cleaned = cleaned.replace(/\\s*rel\\s*=\\s*\"[^\"]*\"/gi, '');\n cleaned = cleaned.replace(/\\s*rel\\s*=\\s*'[^']*'/gi, '');\n\n // Remove atributos específicos do Tailwind e CSS variables\n const unwantedAttributes = [\n '--tw-scale-x', '--tw-scale-y', '--tw-pan-x', '--tw-pan-y',\n '--tw-pinch-zoom', '--tw-scroll-snap-strictness', '--tw-gradient-from-position',\n '--tw-gradient-via-position', '--tw-gradient-to-position', '--tw-ordinal',\n '--tw-slashed-zero', '--tw-numeric-figure', '--tw-numeric-spacing',\n '--tw-numeric-fraction', '--tw-ring-inset', '--tw-ring-offset-width',\n '--tw-ring-offset-color', '--tw-ring-color', '--tw-ring-offset-shadow',\n '--tw-ring-shadow', '--tw-shadow', '--tw-shadow-colored', '--tw-blur',\n '--tw-brightness', '--tw-contrast', '--tw-grayscale', '--tw-hue-rotate',\n '--tw-invert', '--tw-saturate', '--tw-sepia', '--tw-drop-shadow',\n '--tw-backdrop-blur', '--tw-backdrop-brightness', '--tw-backdrop-contrast',\n '--tw-backdrop-grayscale', '--tw-backdrop-hue-rotate', '--tw-backdrop-invert',\n '--tw-backdrop-opacity', '--tw-backdrop-saturate', '--tw-backdrop-sepia',\n '--tw-contain-size', '--tw-contain-layout', '--tw-contain-paint', '--tw-contain-style',\n ];\n\n unwantedAttributes.forEach((attr) => {\n const regex = new RegExp(`\\\\s*${attr.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&')}\\\\s*=\\\\s*\"[^\"]*\"`, 'gi');\n cleaned = cleaned.replace(regex, '');\n });\n\n // Remove spans que só servem para estilização (vazios ou só com texto)\n // Primeiro remove spans vazios\n cleaned = cleaned.replace(/<span[^>]*>\\s*<\\/span>/gi, '');\n\n // Remove spans que só contêm texto (sem elementos filhos)\n cleaned = cleaned.replace(/<span[^>]*>([^<]+)<\\/span>/gi, '$1');\n\n // Remove spans aninhados desnecessários (múltiplas passadas)\n for (let i = 0; i < 5; i++) {\n cleaned = cleaned.replace(/<span[^>]*>([^<]*(?:<(?!span|\\/span)[^>]*>[^<]*<\\/[^>]*>[^<]*)*)<\\/span>/gi, '$1');\n }\n\n // Remove elementos vazios (exceto br, img, hr, input)\n const selfClosingTags = ['br', 'img', 'hr', 'input', 'meta', 'link'];\n cleaned = cleaned.replace(/<(\\w+)[^>]*>\\s*<\\/\\1>/gi, (match, tagName) => {\n return selfClosingTags.includes(tagName.toLowerCase()) ? match : '';\n });\n\n // Remove BRs consecutivos excessivos\n cleaned = cleaned.replace(/(<br[^>]*>\\s*){3,}/gi, '<br><br>');\n\n // Remove apenas parágrafos completamente vazios (sem br)\n cleaned = cleaned.replace(/<p[^>]*>\\s*<\\/p>/gi, '');\n\n // Limpa espaços em excesso\n cleaned = cleaned.replace(/\\s+/g, ' ');\n\n // Remove espaços no início e fim de tags\n cleaned = cleaned.replace(/>\\s+</g, '><');\n\n // Remove espaços extras no início e fim\n cleaned = cleaned.trim();\n\n // Remove linhas vazias múltiplas\n cleaned = cleaned.replace(/\\n\\s*\\n\\s*\\n/g, '\\n\\n');\n\n return cleaned;\n}\n"]}
|