@arkyn/server 3.0.1-beta.73 → 3.0.1-beta.75

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/bundle.js CHANGED
@@ -1,25 +1,28 @@
1
- var U = Object.defineProperty;
2
- var I = (n, t, s) => t in n ? U(n, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : n[t] = s;
3
- var o = (n, t, s) => I(n, typeof t != "symbol" ? t + "" : t, s);
4
- function p(n) {
1
+ var A = Object.defineProperty;
2
+ var k = (e, t, s) => t in e ? A(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
3
+ var o = (e, t, s) => k(e, typeof t != "symbol" ? t + "" : t, s);
4
+ import "zod";
5
+ import { removeNonNumeric as R } from "@arkyn/shared";
6
+ import { countries as w } from "@arkyn/templates";
7
+ function g(e) {
5
8
  var s;
6
9
  if (process.env.NODE_ENV === "development" || ((s = process.env) == null ? void 0 : s.SHOW_ERRORS_IN_CONSOLE) === "true") {
7
- const u = `${{
10
+ const a = `${{
8
11
  yellow: "\x1B[33m",
9
12
  cyan: "\x1B[36m",
10
13
  red: "\x1B[31m",
11
14
  green: "\x1B[32m"
12
- }[n.scheme]}[${n.name}]\x1B[0m`;
15
+ }[e.scheme]}[${e.name}]\x1B[0m`;
13
16
  let c = `
14
17
  `;
15
- n.debugs.forEach((h) => {
16
- c += `${u} ${h.trim()}
18
+ e.debugs.forEach((h) => {
19
+ c += `${a} ${h.trim()}
17
20
  `;
18
21
  }), console.log(c);
19
22
  }
20
23
  }
21
- const k = {};
22
- class S {
24
+ const $ = {};
25
+ class I {
23
26
  /**
24
27
  * Sets the file name to be ignored during stack trace analysis.
25
28
  *
@@ -58,27 +61,27 @@ class S {
58
61
  * The name of the file to ignore when analyzing the stack trace.
59
62
  * When set, the `getCaller` function will skip stack frames containing this file name.
60
63
  */
61
- o(S, "ignoreFiles", []);
62
- function x() {
63
- const n = process.cwd(), e = (new Error().stack || "").split(`
64
- `).map((a) => a.trim()), r = S.ignoreFiles;
65
- let u = 2;
66
- for (; u < e.length && (e[u].includes("node:internal") || e[u].includes("/node_modules/")); )
67
- u++;
64
+ o(I, "ignoreFiles", []);
65
+ function N() {
66
+ const e = process.cwd(), n = (new Error().stack || "").split(`
67
+ `).map((u) => u.trim()), r = I.ignoreFiles;
68
+ let a = 2;
69
+ for (; a < n.length && (n[a].includes("node:internal") || n[a].includes("/node_modules/")); )
70
+ a++;
68
71
  if (r.length > 0)
69
- for (; u < e.length && r.some(
70
- (a) => e[u].includes(a)
72
+ for (; a < n.length && r.some(
73
+ (u) => n[a].includes(u)
71
74
  ); )
72
- u++;
73
- const c = e[u] || "";
75
+ a++;
76
+ const c = n[a] || "";
74
77
  let h = "Unknown function", i = "Unknown caller";
75
78
  const l = c.match(/at\s+([^(\s]+)\s+\(([^)]+)\)/);
76
79
  if (l)
77
80
  h = l[1], i = l[2];
78
81
  else {
79
- const a = c.match(/at\s+(.+)/);
80
- if (a) {
81
- i = a[1];
82
+ const u = c.match(/at\s+(.+)/);
83
+ if (u) {
84
+ i = u[1];
82
85
  const d = i.match(/at\s+([^(\s]+)\s+/);
83
86
  d && d[1] !== "new" && (h = d[1]);
84
87
  }
@@ -88,31 +91,31 @@ function x() {
88
91
  i.lastIndexOf(")")
89
92
  )), i = i.split(":").slice(0, -2).join(":");
90
93
  try {
91
- i = k.relative(n, i);
94
+ i = $.relative(e, i);
92
95
  } catch {
93
96
  }
94
97
  return { functionName: h, callerInfo: i };
95
98
  }
96
99
  class y {
97
100
  onDebug(t) {
98
- const { name: s, body: e, cause: r, message: u } = t, c = [], { callerInfo: h, functionName: i } = x();
99
- c.push(`${s} initialized`), c.push(`Caller Function: ${i}`), c.push(`Caller Location: ${h}`), u && c.push(`Message: ${u}`), e && c.push(`Body: ${JSON.stringify(e, null, 2)}`), r && c.push(`Cause: ${JSON.stringify(r, null, 2)}`), p({ scheme: "red", name: "ARKYN-BAD-RESPONSE-DEBUG", debugs: c });
101
+ const { name: s, body: n, cause: r, message: a } = t, c = [], { callerInfo: h, functionName: i } = N();
102
+ c.push(`${s} initialized`), c.push(`Caller Function: ${i}`), c.push(`Caller Location: ${h}`), a && c.push(`Message: ${a}`), n && c.push(`Body: ${JSON.stringify(n, null, 2)}`), r && c.push(`Cause: ${JSON.stringify(r, null, 2)}`), g({ scheme: "red", name: "ARKYN-BAD-RESPONSE-DEBUG", debugs: c });
100
103
  }
101
104
  }
102
- class j extends y {
105
+ class J extends y {
103
106
  /**
104
107
  * Creates an instance of the `BadGateway` class.
105
108
  *
106
109
  * @param message - A descriptive message explaining the cause of the error.
107
110
  * @param cause - Optional additional information about the cause of the error.
108
111
  */
109
- constructor(s, e) {
112
+ constructor(s, n) {
110
113
  super();
111
114
  o(this, "body");
112
115
  o(this, "cause");
113
116
  o(this, "status", 502);
114
117
  o(this, "statusText");
115
- this.body = { name: "BadGateway", message: s }, this.statusText = s, this.cause = e ? JSON.stringify(e) : void 0, this.onDebug({
118
+ this.body = { name: "BadGateway", message: s }, this.statusText = s, this.cause = n ? JSON.stringify(n) : void 0, this.onDebug({
116
119
  name: "BadGateway",
117
120
  body: this.body,
118
121
  cause: this.cause,
@@ -147,20 +150,20 @@ class j extends y {
147
150
  return Response.json(this.body, s);
148
151
  }
149
152
  }
150
- class b extends y {
153
+ class x extends y {
151
154
  /**
152
155
  * Creates an instance of the `BadRequest` class.
153
156
  *
154
157
  * @param message - A descriptive message explaining the cause of the error.
155
158
  * @param cause - Optional additional information about the cause of the error.
156
159
  */
157
- constructor(s, e) {
160
+ constructor(s, n) {
158
161
  super();
159
162
  o(this, "body");
160
163
  o(this, "cause");
161
164
  o(this, "status", 400);
162
165
  o(this, "statusText");
163
- this.body = { name: "BadRequest", message: s }, this.statusText = s, this.cause = e ? JSON.stringify(e) : void 0, this.onDebug({
166
+ this.body = { name: "BadRequest", message: s }, this.statusText = s, this.cause = n ? JSON.stringify(n) : void 0, this.onDebug({
164
167
  name: "BadRequest",
165
168
  body: this.body,
166
169
  cause: this.cause,
@@ -195,20 +198,20 @@ class b extends y {
195
198
  return Response.json(this.body, s);
196
199
  }
197
200
  }
198
- class J extends y {
201
+ class j extends y {
199
202
  /**
200
203
  * Creates an instance of the `Conflict` class.
201
204
  *
202
205
  * @param message - A descriptive message explaining the cause of the conflict.
203
206
  * @param cause - Optional additional information about the cause of the conflict.
204
207
  */
205
- constructor(s, e) {
208
+ constructor(s, n) {
206
209
  super();
207
210
  o(this, "body");
208
211
  o(this, "cause");
209
212
  o(this, "status", 409);
210
213
  o(this, "statusText");
211
- this.body = { name: "Conflict", message: s }, this.statusText = s, this.cause = e ? JSON.stringify(e) : void 0, this.onDebug({
214
+ this.body = { name: "Conflict", message: s }, this.statusText = s, this.cause = n ? JSON.stringify(n) : void 0, this.onDebug({
212
215
  name: "Conflict",
213
216
  body: this.body,
214
217
  cause: this.cause,
@@ -243,20 +246,20 @@ class J extends y {
243
246
  return Response.json(this.body, s);
244
247
  }
245
248
  }
246
- class D extends y {
249
+ class L extends y {
247
250
  /**
248
251
  * Creates an instance of the `Forbidden` class.
249
252
  *
250
253
  * @param message - A descriptive message explaining why access is forbidden.
251
254
  * @param cause - Optional additional information about the cause of the error.
252
255
  */
253
- constructor(s, e) {
256
+ constructor(s, n) {
254
257
  super();
255
258
  o(this, "body");
256
259
  o(this, "cause");
257
260
  o(this, "status", 403);
258
261
  o(this, "statusText");
259
- this.body = { name: "Forbidden", message: s }, this.statusText = s, this.cause = e ? JSON.stringify(e) : void 0, this.onDebug({
262
+ this.body = { name: "Forbidden", message: s }, this.statusText = s, this.cause = n ? JSON.stringify(n) : void 0, this.onDebug({
260
263
  name: "Forbidden",
261
264
  body: this.body,
262
265
  cause: this.cause,
@@ -291,20 +294,20 @@ class D extends y {
291
294
  return Response.json(this.body, s);
292
295
  }
293
296
  }
294
- class C extends y {
297
+ class B extends y {
295
298
  /**
296
299
  * Creates an instance of the `NotFound` class.
297
300
  *
298
301
  * @param message - A descriptive message explaining the reason the resource was not found.
299
302
  * @param cause - Optional additional information about the cause of the error.
300
303
  */
301
- constructor(s, e) {
304
+ constructor(s, n) {
302
305
  super();
303
306
  o(this, "body");
304
307
  o(this, "cause");
305
308
  o(this, "status", 404);
306
309
  o(this, "statusText");
307
- this.body = { name: "NotFound", message: s }, this.statusText = s, this.cause = e ? JSON.stringify(e) : void 0, this.onDebug({
310
+ this.body = { name: "NotFound", message: s }, this.statusText = s, this.cause = n ? JSON.stringify(n) : void 0, this.onDebug({
308
311
  name: "NotFound",
309
312
  body: this.body,
310
313
  cause: this.cause,
@@ -339,20 +342,20 @@ class C extends y {
339
342
  return Response.json(this.body, s);
340
343
  }
341
344
  }
342
- class B extends y {
345
+ class H extends y {
343
346
  /**
344
347
  * Creates an instance of the `NotImplemented` class.
345
348
  *
346
349
  * @param message - A descriptive message explaining why the functionality is not implemented.
347
350
  * @param cause - Optional additional information about the cause of the error.
348
351
  */
349
- constructor(s, e) {
352
+ constructor(s, n) {
350
353
  super();
351
354
  o(this, "body");
352
355
  o(this, "cause");
353
356
  o(this, "status", 501);
354
357
  o(this, "statusText");
355
- this.body = { name: "NotImplemented", message: s }, this.statusText = s, this.cause = e ? JSON.stringify(e) : void 0, this.onDebug({
358
+ this.body = { name: "NotImplemented", message: s }, this.statusText = s, this.cause = n ? JSON.stringify(n) : void 0, this.onDebug({
356
359
  name: "NotImplemented",
357
360
  body: this.body,
358
361
  cause: this.cause,
@@ -387,20 +390,20 @@ class B extends y {
387
390
  return Response.json(this.body, s);
388
391
  }
389
392
  }
390
- class m extends y {
393
+ class b extends y {
391
394
  /**
392
395
  * Creates an instance of the `ServerError` class.
393
396
  *
394
397
  * @param message - A descriptive message explaining the cause of the server error.
395
398
  * @param cause - Optional additional information about the cause of the error.
396
399
  */
397
- constructor(s, e) {
400
+ constructor(s, n) {
398
401
  super();
399
402
  o(this, "body");
400
403
  o(this, "cause");
401
404
  o(this, "status", 500);
402
405
  o(this, "statusText");
403
- this.body = { name: "ServerError", message: s }, this.statusText = s, this.cause = e ? JSON.stringify(e) : void 0, this.onDebug({
406
+ this.body = { name: "ServerError", message: s }, this.statusText = s, this.cause = n ? JSON.stringify(n) : void 0, this.onDebug({
404
407
  name: "ServerError",
405
408
  body: this.body,
406
409
  cause: this.cause,
@@ -442,13 +445,13 @@ class q extends y {
442
445
  * @param message - A descriptive message explaining why the request is unauthorized.
443
446
  * @param cause - Optional additional information about the cause of the error.
444
447
  */
445
- constructor(s, e) {
448
+ constructor(s, n) {
446
449
  super();
447
450
  o(this, "body");
448
451
  o(this, "cause");
449
452
  o(this, "status", 401);
450
453
  o(this, "statusText");
451
- this.body = { name: "Unauthorized", message: s }, this.statusText = s, this.cause = e ? JSON.stringify(e) : void 0, this.onDebug({
454
+ this.body = { name: "Unauthorized", message: s }, this.statusText = s, this.cause = n ? JSON.stringify(n) : void 0, this.onDebug({
452
455
  name: "Unauthorized",
453
456
  body: this.body,
454
457
  cause: this.cause,
@@ -483,7 +486,7 @@ class q extends y {
483
486
  return Response.json(this.body, s);
484
487
  }
485
488
  }
486
- class N extends y {
489
+ class O extends y {
487
490
  /**
488
491
  * Creates an instance of the `UnprocessableEntity` class.
489
492
  *
@@ -539,7 +542,7 @@ class N extends y {
539
542
  return Response.json(this.body, s);
540
543
  }
541
544
  }
542
- class T {
545
+ class m {
543
546
  /**
544
547
  * Logs debug information for success responses including caller context and response details.
545
548
  *
@@ -553,34 +556,34 @@ class T {
553
556
  * SuccessResponse.onDebug("ValidationError", { field: "email", message: "Invalid format" });
554
557
  * ```
555
558
  */
556
- onDebug(t, s, e) {
557
- const r = [], { callerInfo: u, functionName: c } = x();
559
+ onDebug(t, s, n) {
560
+ const r = [], { callerInfo: a, functionName: c } = N();
558
561
  r.push(`${t} initialized
559
562
  `), r.push(`Caller Function: ${c}
560
- `), r.push(`Caller Location: ${u}
563
+ `), r.push(`Caller Location: ${a}
561
564
  `), r.push(`Body: ${JSON.stringify(s, null, 2)}
562
- `), e && r.push(`Cause: ${JSON.stringify(e, null, 2)}
563
- `), p({
565
+ `), n && r.push(`Cause: ${JSON.stringify(n, null, 2)}
566
+ `), g({
564
567
  scheme: "green",
565
568
  name: "ARKYN-SUCCESS-RESPONSE-DEBUG",
566
569
  debugs: r
567
570
  });
568
571
  }
569
572
  }
570
- class P extends T {
573
+ class F extends m {
571
574
  /**
572
575
  * Creates an instance of the `Created` class.
573
576
  *
574
577
  * @param body - The response body to be included in the HTTP response.
575
578
  * @param init - Optional initialization object for customizing headers, status, and status text.
576
579
  */
577
- constructor(s, e) {
580
+ constructor(s, n) {
578
581
  super();
579
582
  o(this, "body");
580
583
  o(this, "headers");
581
584
  o(this, "status");
582
585
  o(this, "statusText");
583
- this.body = s, this.headers = (e == null ? void 0 : e.headers) || {}, this.status = (e == null ? void 0 : e.status) || 201, this.statusText = (e == null ? void 0 : e.statusText) || "Resource created successfully", this.onDebug("Created", s);
586
+ this.body = s, this.headers = (n == null ? void 0 : n.headers) || {}, this.status = (n == null ? void 0 : n.status) || 201, this.statusText = (n == null ? void 0 : n.statusText) || "Resource created successfully", this.onDebug("Created", s);
584
587
  }
585
588
  /**
586
589
  * Converts the `Created` instance into a `Response` object with a JSON body.
@@ -611,7 +614,7 @@ class P extends T {
611
614
  return Response.json(this.body, s);
612
615
  }
613
616
  }
614
- class $ extends T {
617
+ class Y extends m {
615
618
  /**
616
619
  * Creates an instance of the `Found` class.
617
620
  *
@@ -621,13 +624,13 @@ class $ extends T {
621
624
  * - `status`: HTTP status code (default is 302).
622
625
  * - `statusText`: HTTP status text (default is "Found").
623
626
  */
624
- constructor(s, e) {
627
+ constructor(s, n) {
625
628
  super();
626
629
  o(this, "body");
627
630
  o(this, "headers");
628
631
  o(this, "status");
629
632
  o(this, "statusText");
630
- this.body = s, this.headers = (e == null ? void 0 : e.headers) || {}, this.status = (e == null ? void 0 : e.status) || 302, this.statusText = (e == null ? void 0 : e.statusText) || "Found", this.onDebug("Found", s);
633
+ this.body = s, this.headers = (n == null ? void 0 : n.headers) || {}, this.status = (n == null ? void 0 : n.status) || 302, this.statusText = (n == null ? void 0 : n.statusText) || "Found", this.onDebug("Found", s);
631
634
  }
632
635
  /**
633
636
  * Converts the `Found` instance into a `Response` object.
@@ -658,7 +661,7 @@ class $ extends T {
658
661
  return Response.json(this.body, s);
659
662
  }
660
663
  }
661
- class H extends T {
664
+ class P extends m {
662
665
  /**
663
666
  * Creates an instance of the `NoContent` class.
664
667
  *
@@ -686,20 +689,20 @@ class H extends T {
686
689
  return new Response(null, s);
687
690
  }
688
691
  }
689
- class A extends T {
692
+ class M extends m {
690
693
  /**
691
694
  * Creates an instance of the `Success` class.
692
695
  *
693
696
  * @param body - The response body to be included in the HTTP response.
694
697
  * @param init - Optional initialization object for customizing headers, status, and status text.
695
698
  */
696
- constructor(s, e) {
699
+ constructor(s, n) {
697
700
  super();
698
701
  o(this, "body");
699
702
  o(this, "headers");
700
703
  o(this, "status");
701
704
  o(this, "statusText");
702
- this.body = s, this.headers = (e == null ? void 0 : e.headers) || {}, this.status = (e == null ? void 0 : e.status) || 200, this.statusText = (e == null ? void 0 : e.statusText) ?? "OK", this.onDebug("Success", s);
705
+ this.body = s, this.headers = (n == null ? void 0 : n.headers) || {}, this.status = (n == null ? void 0 : n.status) || 200, this.statusText = (n == null ? void 0 : n.statusText) ?? "OK", this.onDebug("Success", s);
703
706
  }
704
707
  /**
705
708
  * Converts the `Success` instance into a `Response` object with a JSON body.
@@ -730,20 +733,20 @@ class A extends T {
730
733
  return Response.json(this.body, s);
731
734
  }
732
735
  }
733
- class L extends T {
736
+ class z extends m {
734
737
  /**
735
738
  * Creates an instance of the `Updated` class.
736
739
  *
737
740
  * @param body - The response body to be included in the HTTP response.
738
741
  * @param init - Optional initialization object for customizing headers, status, and status text.
739
742
  */
740
- constructor(s, e) {
743
+ constructor(s, n) {
741
744
  super();
742
745
  o(this, "body");
743
746
  o(this, "headers");
744
747
  o(this, "status");
745
748
  o(this, "statusText");
746
- this.body = s, this.headers = (e == null ? void 0 : e.headers) || {}, this.status = (e == null ? void 0 : e.status) || 200, this.statusText = (e == null ? void 0 : e.statusText) || "Resource updated successfully", this.onDebug("Updated", s);
749
+ this.body = s, this.headers = (n == null ? void 0 : n.headers) || {}, this.status = (n == null ? void 0 : n.status) || 200, this.statusText = (n == null ? void 0 : n.statusText) || "Resource updated successfully", this.onDebug("Updated", s);
747
750
  }
748
751
  /**
749
752
  * Converts the `Updated` instance into a `Response` object with a JSON body.
@@ -774,14 +777,14 @@ class L extends T {
774
777
  return Response.json(this.body, s);
775
778
  }
776
779
  }
777
- class v {
780
+ class _ {
778
781
  static mapHeaders(t) {
779
- return t instanceof Headers ? Object.fromEntries(t.entries()) : typeof t == "object" ? Object.entries(t).reduce((s, [e, r]) => (typeof r == "string" ? s[e] = r : Array.isArray(r) ? s[e] = r.join(", ") : s[e] = JSON.stringify(r), s), {}) : {};
782
+ return t instanceof Headers ? Object.fromEntries(t.entries()) : typeof t == "object" ? Object.entries(t).reduce((s, [n, r]) => (typeof r == "string" ? s[n] = r : Array.isArray(r) ? s[n] = r.join(", ") : s[n] = JSON.stringify(r), s), {}) : {};
780
783
  }
781
784
  static mapQueryParams(t) {
782
785
  const s = {};
783
- return t.forEach((e, r) => {
784
- s[r] = e;
786
+ return t.forEach((n, r) => {
787
+ s[r] = n;
785
788
  }), s;
786
789
  }
787
790
  static handle(t) {
@@ -799,7 +802,7 @@ class v {
799
802
  };
800
803
  }
801
804
  }
802
- class w {
805
+ class U {
803
806
  /**
804
807
  * Sets the configuration for the arkyn. This method initializes the arkyn configuration
805
808
  * with the provided `arkynConfig` values. If the configuration has already been set,
@@ -813,11 +816,11 @@ class w {
813
816
  */
814
817
  static setArkynConfig(t) {
815
818
  if (this.arkynConfig) return;
816
- let e = t.arkynLogBaseApiUrl || "https://logs-arkyn-flow-logs.vw6wo7.easypanel.host";
817
- e = e + "/http-traffic-records/:trafficSourceId", this.arkynConfig = {
819
+ let n = t.arkynLogBaseApiUrl || "https://logs-arkyn-flow-logs.vw6wo7.easypanel.host";
820
+ n = n + "/http-traffic-records/:trafficSourceId", this.arkynConfig = {
818
821
  arkynTrafficSourceId: t.arkynTrafficSourceId,
819
822
  arkynUserToken: t.arkynUserToken,
820
- arkynApiUrl: e
823
+ arkynApiUrl: n
821
824
  };
822
825
  }
823
826
  /**
@@ -837,64 +840,64 @@ class w {
837
840
  this.arkynConfig = void 0;
838
841
  }
839
842
  }
840
- o(w, "arkynConfig");
841
- async function F(n) {
842
- const t = w.getArkynConfig();
843
+ o(U, "arkynConfig");
844
+ async function V(e) {
845
+ const t = U.getArkynConfig();
843
846
  if (!t) return;
844
- const { arkynUserToken: s, arkynApiUrl: e } = t, {
847
+ const { arkynUserToken: s, arkynApiUrl: n } = t, {
845
848
  elapsedTime: r,
846
- method: u,
849
+ method: a,
847
850
  queryParams: c,
848
851
  requestBody: h,
849
852
  requestHeaders: i,
850
853
  responseBody: l,
851
- responseHeaders: a,
854
+ responseHeaders: u,
852
855
  status: d,
853
- token: Q,
854
- rawUrl: E
855
- } = n;
856
+ token: C,
857
+ rawUrl: f
858
+ } = e;
856
859
  if (process.env.NODE_ENV !== "development")
857
860
  try {
858
- const f = new URL(E);
859
- let R = "HTTPS";
860
- f.protocol === "http:" && (R = "HTTP");
861
- const O = JSON.stringify({
862
- domainUrl: f.protocol + "//" + f.host,
863
- pathnameUrl: f.pathname,
861
+ const p = new URL(f);
862
+ let S = "HTTPS";
863
+ p.protocol === "http:" && (S = "HTTP");
864
+ const v = JSON.stringify({
865
+ domainUrl: p.protocol + "//" + p.host,
866
+ pathnameUrl: p.pathname,
864
867
  status: d,
865
- protocol: R,
866
- method: u,
868
+ protocol: S,
869
+ method: a,
867
870
  trafficUserId: null,
868
871
  elapsedTime: r,
869
872
  requestHeaders: i,
870
873
  requestBody: h,
871
874
  queryParams: c,
872
- responseHeaders: a,
875
+ responseHeaders: u,
873
876
  responseBody: l
874
877
  });
875
878
  await fetch(
876
- e.replace(
879
+ n.replace(
877
880
  ":trafficSourceId",
878
881
  t.arkynTrafficSourceId
879
882
  ),
880
883
  {
881
884
  method: "POST",
882
- body: O,
885
+ body: v,
883
886
  headers: {
884
887
  "Content-Type": "application/json",
885
888
  Authorization: `Bearer ${s}`
886
889
  }
887
890
  }
888
891
  );
889
- } catch (f) {
890
- p({
891
- debugs: [`Error sending request: ${f}`],
892
+ } catch (p) {
893
+ g({
894
+ debugs: [`Error sending request: ${p}`],
892
895
  name: "ARKYN_LOG_ERROR",
893
896
  scheme: "red"
894
897
  });
895
898
  }
896
899
  }
897
- async function g(n, t, s = {}, e) {
900
+ async function T(e, t, s = {}, n) {
898
901
  const r = {
899
902
  POST: "Resource created successfully",
900
903
  PUT: "Resource updated successfully",
@@ -903,44 +906,44 @@ async function g(n, t, s = {}, e) {
903
906
  GET: "Request successful"
904
907
  };
905
908
  try {
906
- const u = performance.now(), c = { ...s, "Content-Type": "application/json" }, h = await fetch(t, {
907
- method: n,
909
+ const a = performance.now(), c = { ...s, "Content-Type": "application/json" }, h = await fetch(t, {
910
+ method: e,
908
911
  headers: c,
909
- body: e ? JSON.stringify(e) : void 0
910
- }), i = performance.now() - u, l = h.status;
911
- let a = null;
912
+ body: n ? JSON.stringify(n) : void 0
913
+ }), i = performance.now() - a, l = h.status;
914
+ let u = null;
912
915
  try {
913
- a = await h.json();
916
+ u = await h.json();
914
917
  } catch {
915
- a = null;
918
+ u = null;
916
919
  }
917
- const d = v.handle({
920
+ const d = _.handle({
918
921
  elapsedTime: i,
919
- method: n,
922
+ method: e,
920
923
  queryParams: new URL(t).searchParams,
921
924
  requestHeaders: c,
922
- requestBody: e,
923
- responseBody: a,
925
+ requestBody: n,
926
+ responseBody: u,
924
927
  responseHeaders: h.headers,
925
928
  status: l,
926
929
  url: t
927
930
  });
928
- return F(d), h.ok ? {
931
+ return V(d), h.ok ? {
929
932
  success: !0,
930
933
  status: l,
931
- message: (a == null ? void 0 : a.message) || r[n],
932
- response: a,
934
+ message: (u == null ? void 0 : u.message) || r[e],
935
+ response: u,
933
936
  cause: null
934
937
  } : {
935
938
  success: !1,
936
939
  status: l,
937
- message: (a == null ? void 0 : a.message) || h.statusText || "Request failed",
938
- response: a,
940
+ message: (u == null ? void 0 : u.message) || h.statusText || "Request failed",
941
+ response: u,
939
942
  cause: null
940
943
  };
941
- } catch (u) {
942
- return p({
943
- debugs: [`Network error or request failed: ${u}`],
944
+ } catch (a) {
945
+ return g({
946
+ debugs: [`Network error or request failed: ${a}`],
944
947
  name: "ARKYN_MAKE_REQUEST_ERROR",
945
948
  scheme: "red"
946
949
  }), {
@@ -948,26 +951,26 @@ async function g(n, t, s = {}, e) {
948
951
  status: 0,
949
952
  message: "Network error or request failed",
950
953
  response: null,
951
- cause: u instanceof Error ? u.message : String(u)
954
+ cause: a instanceof Error ? a.message : String(a)
952
955
  };
953
956
  }
954
957
  }
955
- async function M(n, t = {}, s) {
956
- return g("DELETE", n, t, s);
958
+ async function G(e, t = {}, s) {
959
+ return T("DELETE", e, t, s);
957
960
  }
958
- async function _(n, t = {}) {
959
- return g("GET", n, t);
961
+ async function Z(e, t = {}) {
962
+ return T("GET", e, t);
960
963
  }
961
- async function z(n, t = {}, s) {
962
- return g("PATCH", n, t, s);
964
+ async function W(e, t = {}, s) {
965
+ return T("PATCH", e, t, s);
963
966
  }
964
- async function G(n, t = {}, s) {
965
- return g("POST", n, t, s);
967
+ async function K(e, t = {}, s) {
968
+ return T("POST", e, t, s);
966
969
  }
967
- async function K(n, t = {}, s) {
968
- return g("PUT", n, t, s);
970
+ async function Q(e, t = {}, s) {
971
+ return T("PUT", e, t, s);
969
972
  }
970
- class X {
973
+ class Rs {
971
974
  /**
972
975
  * Creates an instance of ApiService.
973
976
  * @param props - The configuration properties for the API instance.
@@ -988,10 +991,10 @@ class X {
988
991
  * @param route - The route to append to the base URL.
989
992
  * @returns The full URL as a string.
990
993
  */
991
- onDebug(t, s, e) {
994
+ onDebug(t, s, n) {
992
995
  if (this.enableDebug) {
993
996
  const r = [];
994
- r.push(`Base URL: ${this.baseUrl}`), r.push(`Endpoint: ${t}`), r.push(`Method: ${s}`), e[0] && r.push(`Headers: ${JSON.stringify(e[0])}`), e[1] && r.push(`Body: ${JSON.stringify(e[1])}`), p({ debugs: r, name: "ARKYN-API-DEBUG", scheme: "yellow" });
997
+ r.push(`Base URL: ${this.baseUrl}`), r.push(`Endpoint: ${t}`), r.push(`Method: ${s}`), n[0] && r.push(`Headers: ${JSON.stringify(n[0])}`), n[1] && r.push(`Body: ${JSON.stringify(n[1])}`), g({ debugs: r, name: "ARKYN-API-DEBUG", scheme: "yellow" });
995
998
  }
996
999
  }
997
1000
  generateURL(t) {
@@ -1004,8 +1007,8 @@ class X {
1004
1007
  * @returns The merged headers as a HeadersInit object.
1005
1008
  */
1006
1009
  generateHeaders(t, s) {
1007
- let e = {};
1008
- return this.baseToken && (e = { Authorization: `Bearer ${this.baseToken}` }), this.baseHeaders && (e = { ...e, ...this.baseHeaders }), t && (e = { ...e, ...t }), s && (e = { ...e, Authorization: `Bearer ${s}` }), e;
1010
+ let n = {};
1011
+ return this.baseToken && (n = { Authorization: `Bearer ${this.baseToken}` }), this.baseHeaders && (n = { ...n, ...this.baseHeaders }), t && (n = { ...n, ...t }), s && (n = { ...n, Authorization: `Bearer ${s}` }), n;
1009
1012
  }
1010
1013
  /**
1011
1014
  * Sends a get request to the specified endpoint.
@@ -1014,8 +1017,8 @@ class X {
1014
1017
  * @returns The API response data.
1015
1018
  */
1016
1019
  async get(t, s) {
1017
- const e = this.generateURL(t), r = this.generateHeaders((s == null ? void 0 : s.headers) || {}, s == null ? void 0 : s.token);
1018
- return this.onDebug(t, "get", [r]), await _(e, r);
1020
+ const n = this.generateURL(t), r = this.generateHeaders((s == null ? void 0 : s.headers) || {}, s == null ? void 0 : s.token);
1021
+ return this.onDebug(t, "get", [r]), await Z(n, r);
1019
1022
  }
1020
1023
  /**
1021
1024
  * Sends a post request to the specified endpoint.
@@ -1024,8 +1027,8 @@ class X {
1024
1027
  * @returns The API response data.
1025
1028
  */
1026
1029
  async post(t, s) {
1027
- const e = this.generateURL(t), r = this.generateHeaders((s == null ? void 0 : s.headers) || {}, s == null ? void 0 : s.token), u = s == null ? void 0 : s.body;
1028
- return this.onDebug(t, "post", [r, u]), await G(e, r, u);
1030
+ const n = this.generateURL(t), r = this.generateHeaders((s == null ? void 0 : s.headers) || {}, s == null ? void 0 : s.token), a = s == null ? void 0 : s.body;
1031
+ return this.onDebug(t, "post", [r, a]), await K(n, r, a);
1029
1032
  }
1030
1033
  /**
1031
1034
  * Sends a put request to the specified endpoint.
@@ -1034,8 +1037,8 @@ class X {
1034
1037
  * @returns The API response data.
1035
1038
  */
1036
1039
  async put(t, s) {
1037
- const e = this.generateURL(t), r = this.generateHeaders((s == null ? void 0 : s.headers) || {}, s == null ? void 0 : s.token), u = s == null ? void 0 : s.body;
1038
- return this.onDebug(t, "put", [r, u]), await K(e, r, u);
1040
+ const n = this.generateURL(t), r = this.generateHeaders((s == null ? void 0 : s.headers) || {}, s == null ? void 0 : s.token), a = s == null ? void 0 : s.body;
1041
+ return this.onDebug(t, "put", [r, a]), await Q(n, r, a);
1039
1042
  }
1040
1043
  /**
1041
1044
  * Sends a patch request to the specified endpoint.
@@ -1044,8 +1047,8 @@ class X {
1044
1047
  * @returns The API response data.
1045
1048
  */
1046
1049
  async patch(t, s) {
1047
- const e = this.generateURL(t), r = this.generateHeaders((s == null ? void 0 : s.headers) || {}, s == null ? void 0 : s.token), u = s == null ? void 0 : s.body;
1048
- return this.onDebug(t, "patch", [r, u]), await z(e, r, u);
1050
+ const n = this.generateURL(t), r = this.generateHeaders((s == null ? void 0 : s.headers) || {}, s == null ? void 0 : s.token), a = s == null ? void 0 : s.body;
1051
+ return this.onDebug(t, "patch", [r, a]), await W(n, r, a);
1049
1052
  }
1050
1053
  /**
1051
1054
  * Sends a delete request to the specified endpoint.
@@ -1054,82 +1057,82 @@ class X {
1054
1057
  * @returns The API response data.
1055
1058
  */
1056
1059
  async delete(t, s) {
1057
- const e = this.generateURL(t), r = this.generateHeaders((s == null ? void 0 : s.headers) || {}, s == null ? void 0 : s.token), u = s == null ? void 0 : s.body;
1058
- return this.onDebug(t, "delete", [r, u]), await M(e, r, u);
1060
+ const n = this.generateURL(t), r = this.generateHeaders((s == null ? void 0 : s.headers) || {}, s == null ? void 0 : s.token), a = s == null ? void 0 : s.body;
1061
+ return this.onDebug(t, "delete", [r, a]), await G(n, r, a);
1059
1062
  }
1060
1063
  }
1061
- function Z(n, t) {
1062
- var s, e, r;
1063
- return n != null && n.message && typeof (n == null ? void 0 : n.message) == "string" ? n == null ? void 0 : n.message : n != null && n.error && typeof (n == null ? void 0 : n.error) == "string" ? n == null ? void 0 : n.error : (s = n == null ? void 0 : n.error) != null && s.message && typeof ((e = n == null ? void 0 : n.error) == null ? void 0 : e.message) == "string" ? (r = n == null ? void 0 : n.error) == null ? void 0 : r.message : t != null && t.statusText && typeof (t == null ? void 0 : t.statusText) == "string" ? t == null ? void 0 : t.statusText : "Missing error message";
1064
+ function Ns(e, t) {
1065
+ var s, n, r;
1066
+ return e != null && e.message && typeof (e == null ? void 0 : e.message) == "string" ? e == null ? void 0 : e.message : e != null && e.error && typeof (e == null ? void 0 : e.error) == "string" ? e == null ? void 0 : e.error : (s = e == null ? void 0 : e.error) != null && s.message && typeof ((n = e == null ? void 0 : e.error) == null ? void 0 : n.message) == "string" ? (r = e == null ? void 0 : e.error) == null ? void 0 : r.message : t != null && t.statusText && typeof (t == null ? void 0 : t.statusText) == "string" ? t == null ? void 0 : t.statusText : "Missing error message";
1064
1067
  }
1065
- const ss = async (n) => {
1068
+ const Ss = async (e) => {
1066
1069
  let t;
1067
- const s = await n.arrayBuffer(), e = new TextDecoder().decode(s);
1070
+ const s = await e.arrayBuffer(), n = new TextDecoder().decode(s);
1068
1071
  try {
1069
- t = JSON.parse(e);
1072
+ t = JSON.parse(n);
1070
1073
  } catch {
1071
1074
  try {
1072
- if (e.includes("=")) {
1073
- const u = new URLSearchParams(e);
1074
- t = Object.fromEntries(u.entries());
1075
+ if (n.includes("=")) {
1076
+ const a = new URLSearchParams(n);
1077
+ t = Object.fromEntries(a.entries());
1075
1078
  } else
1076
- throw new b("Invalid URLSearchParams format");
1079
+ throw new x("Invalid URLSearchParams format");
1077
1080
  } catch {
1078
- throw new b("Failed to extract data from request");
1081
+ throw new x("Failed to extract data from request");
1079
1082
  }
1080
1083
  }
1081
1084
  return t;
1082
1085
  };
1083
- function es(n) {
1086
+ function Es(e) {
1084
1087
  switch (!0) {
1085
- case n instanceof Response:
1086
- return n;
1087
- case n instanceof $:
1088
- return n.toResponse();
1089
- case n instanceof P:
1090
- return n.toResponse();
1091
- case n instanceof L:
1092
- return n.toResponse();
1093
- case n instanceof A:
1094
- return n.toResponse();
1095
- case n instanceof H:
1096
- return n.toResponse();
1088
+ case e instanceof Response:
1089
+ return e;
1090
+ case e instanceof Y:
1091
+ return e.toResponse();
1092
+ case e instanceof F:
1093
+ return e.toResponse();
1094
+ case e instanceof z:
1095
+ return e.toResponse();
1096
+ case e instanceof M:
1097
+ return e.toResponse();
1098
+ case e instanceof P:
1099
+ return e.toResponse();
1097
1100
  }
1098
1101
  switch (!0) {
1099
- case n instanceof j:
1100
- return n.toResponse();
1101
- case n instanceof b:
1102
- return n.toResponse();
1103
- case n instanceof J:
1104
- return n.toResponse();
1105
- case n instanceof D:
1106
- return n.toResponse();
1107
- case n instanceof C:
1108
- return n.toResponse();
1109
- case n instanceof B:
1110
- return n.toResponse();
1111
- case n instanceof m:
1112
- return n.toResponse();
1113
- case n instanceof q:
1114
- return n.toResponse();
1115
- case n instanceof N:
1116
- return n.toResponse();
1117
- }
1118
- return new m("Server error", n).toResponse();
1102
+ case e instanceof J:
1103
+ return e.toResponse();
1104
+ case e instanceof x:
1105
+ return e.toResponse();
1106
+ case e instanceof j:
1107
+ return e.toResponse();
1108
+ case e instanceof L:
1109
+ return e.toResponse();
1110
+ case e instanceof B:
1111
+ return e.toResponse();
1112
+ case e instanceof H:
1113
+ return e.toResponse();
1114
+ case e instanceof b:
1115
+ return e.toResponse();
1116
+ case e instanceof q:
1117
+ return e.toResponse();
1118
+ case e instanceof O:
1119
+ return e.toResponse();
1120
+ }
1121
+ return new b("Server error", e).toResponse();
1119
1122
  }
1120
- function V([
1121
- n,
1123
+ function X([
1124
+ e,
1122
1125
  t
1123
1126
  ]) {
1124
- const s = t.safeParse(n);
1127
+ const s = t.safeParse(e);
1125
1128
  if (s.success === !1) {
1126
- const e = Object.fromEntries(
1129
+ const n = Object.fromEntries(
1127
1130
  s.error.issues.map((r) => [r.path.join("."), r.message])
1128
1131
  );
1129
1132
  return {
1130
1133
  success: s.success,
1131
- fieldErrors: e,
1132
- fields: n
1134
+ fieldErrors: n,
1135
+ fields: e
1133
1136
  };
1134
1137
  } else
1135
1138
  return {
@@ -1137,28 +1140,28 @@ function V([
1137
1140
  data: s.data
1138
1141
  };
1139
1142
  }
1140
- const ts = (n, t = "") => {
1141
- const s = new URL(n.url);
1143
+ const Ds = (e, t = "") => {
1144
+ const s = new URL(e.url);
1142
1145
  if (t === "") return s.searchParams;
1143
- const e = Array.from(
1146
+ const n = Array.from(
1144
1147
  s.searchParams.entries()
1145
- ).filter(([r]) => r.startsWith(`${t}:`)).map(([r, u]) => [r.replace(`${t}:`, ""), u]);
1146
- return new URLSearchParams(e);
1148
+ ).filter(([r]) => r.startsWith(`${t}:`)).map(([r, a]) => [r.replace(`${t}:`, ""), a]);
1149
+ return new URLSearchParams(n);
1147
1150
  };
1148
- function Y(n) {
1149
- const t = "Error validating:", s = n.issues.map(
1150
- ({ path: e, message: r }) => `-> ${e.join(".")}: ${r}`
1151
+ function ss(e) {
1152
+ const t = "Error validating:", s = e.issues.map(
1153
+ ({ path: n, message: r }) => `-> ${n.join(".")}: ${r}`
1151
1154
  );
1152
1155
  return [t, ...s].join(`
1153
1156
  `);
1154
1157
  }
1155
- class ns {
1158
+ class $s {
1156
1159
  constructor(t) {
1157
1160
  o(this, "functionName");
1158
1161
  o(this, "callerInfo");
1159
1162
  this.schema = t;
1160
- const { callerInfo: s, functionName: e } = x();
1161
- this.callerInfo = s, this.functionName = e;
1163
+ const { callerInfo: s, functionName: n } = N();
1164
+ this.callerInfo = s, this.functionName = n;
1162
1165
  }
1163
1166
  isValid(t) {
1164
1167
  return this.schema.safeParse(t).success;
@@ -1170,47 +1173,211 @@ class ns {
1170
1173
  try {
1171
1174
  return this.schema.parse(t);
1172
1175
  } catch (s) {
1173
- throw new m(Y(s));
1176
+ throw new b(ss(s));
1174
1177
  }
1175
1178
  }
1176
1179
  formValidate(t, s) {
1177
- const e = V([t, this.schema]);
1178
- if (!e.success) {
1179
- const r = Object.keys(e.fieldErrors)[0];
1180
- throw new N({
1181
- fields: e.fields,
1182
- fieldErrors: e.fieldErrors,
1180
+ const n = X([t, this.schema]);
1181
+ if (!n.success) {
1182
+ const r = Object.keys(n.fieldErrors)[0];
1183
+ throw new O({
1184
+ fields: n.fields,
1185
+ fieldErrors: n.fieldErrors,
1183
1186
  data: { scrollTo: r },
1184
1187
  message: s
1185
1188
  });
1186
1189
  }
1187
- return e.data;
1190
+ return n.data;
1188
1191
  }
1189
1192
  }
1193
+ const Is = (e) => {
1194
+ if (!e || !/^[0-9-]+$/.test(e)) return !1;
1195
+ const s = R(e), n = 8, r = /^\d{8}$/.test(s);
1196
+ return s.length === n && r;
1197
+ };
1198
+ function es(e) {
1199
+ return e.length !== 14;
1200
+ }
1201
+ function ts(e) {
1202
+ const [t] = e;
1203
+ return [...e].every((s) => s === t);
1204
+ }
1205
+ function E(e, t) {
1206
+ let s = 0;
1207
+ for (let r = 0; r < t.length; r++)
1208
+ s += parseInt(e[r]) * t[r];
1209
+ const n = s % 11;
1210
+ return n < 2 ? 0 : 11 - n;
1211
+ }
1212
+ function ns(e) {
1213
+ return e.slice(12);
1214
+ }
1215
+ const Os = (e) => {
1216
+ if (!e) return !1;
1217
+ const t = R(e);
1218
+ if (es(t) || ts(t)) return !1;
1219
+ const s = t.slice(0, 12), n = E(s, [5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2]), r = E(
1220
+ s + n,
1221
+ [6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2]
1222
+ );
1223
+ return ns(t) === `${n}${r}`;
1224
+ };
1225
+ function rs(e) {
1226
+ return e.length !== 11;
1227
+ }
1228
+ function os(e) {
1229
+ const [t] = e;
1230
+ return [...e].every((s) => s === t);
1231
+ }
1232
+ function D(e, t) {
1233
+ let s = 0;
1234
+ for (const r of e)
1235
+ t > 1 && (s += parseInt(r) * t--);
1236
+ const n = s % 11;
1237
+ return n < 2 ? 0 : 11 - n;
1238
+ }
1239
+ function as(e) {
1240
+ return e.slice(9);
1241
+ }
1242
+ const Us = (e) => {
1243
+ if (!e) return !1;
1244
+ const t = R(e);
1245
+ if (rs(t) || os(t)) return !1;
1246
+ const s = D(t, 10), n = D(t, 11);
1247
+ return as(t) === `${s}${n}`;
1248
+ }, Cs = (e, t) => {
1249
+ let s, n, r;
1250
+ const a = (t == null ? void 0 : t.inputFormat) || "DD/MM/YYYY", c = (t == null ? void 0 : t.minYear) || 1900, h = (t == null ? void 0 : t.maxYear) || 3e3;
1251
+ if (a === "DD/MM/YYYY") {
1252
+ const f = /^(\d{2})\/(\d{2})\/(\d{4})$/;
1253
+ if (!f.test(e)) return !1;
1254
+ [, s, n, r] = e.match(f) || [];
1255
+ } else if (a === "MM-DD-YYYY") {
1256
+ const f = /^(\d{2})-(\d{2})-(\d{4})$/;
1257
+ if (!f.test(e)) return !1;
1258
+ [, n, s, r] = e.match(f) || [];
1259
+ } else if (a === "YYYY-MM-DD") {
1260
+ const f = /^(\d{4})-(\d{2})-(\d{2})$/;
1261
+ if (!f.test(e)) return !1;
1262
+ [, r, n, s] = e.match(f) || [];
1263
+ } else
1264
+ throw new Error("Invalid date format");
1265
+ const i = parseInt(s, 10), l = parseInt(n, 10), u = parseInt(r, 10);
1266
+ if (i < 1 || i > 31 || l < 1 || l > 12) return !1;
1267
+ const d = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
1268
+ if (l === 2) {
1269
+ const f = u % 4 === 0 && u % 100 !== 0 || u % 400 === 0;
1270
+ if (i > (f ? 29 : 28)) return !1;
1271
+ } else if (i > d[l - 1])
1272
+ return !1;
1273
+ return u < c || u > h ? !1 : new Date(u, l - 1, i).getDate() === i;
1274
+ }, us = $.promises.resolve;
1275
+ function is(e) {
1276
+ return /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(e);
1277
+ }
1278
+ function cs(e) {
1279
+ return !(e.length === 0 || e.length > 64 || e.startsWith(".") || e.endsWith(".") || e.includes("..") || !/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+$/.test(e));
1280
+ }
1281
+ function hs(e) {
1282
+ return !(e.length === 0 || e.length > 63 || e.startsWith("-") || e.endsWith("-") || !/^[a-zA-Z0-9-]+$/.test(e));
1283
+ }
1284
+ function ls(e) {
1285
+ if (e.length === 0 || e.length > 253 || e.startsWith(".") || e.endsWith(".") || e.startsWith("-") || e.endsWith("-"))
1286
+ return !1;
1287
+ const t = e.split(".");
1288
+ if (t.length < 2) return !1;
1289
+ for (const n of t) if (!hs(n)) return !1;
1290
+ const s = t[t.length - 1];
1291
+ return !(s.length < 2 || !/^[a-zA-Z]+$/.test(s));
1292
+ }
1293
+ function fs(e) {
1294
+ const t = e.split("@");
1295
+ if (t.length !== 2) return !1;
1296
+ const [s, n] = t;
1297
+ return !(!cs(s) || !ls(n));
1298
+ }
1299
+ function ds(e) {
1300
+ const t = e.split("@");
1301
+ return t.length === 2 ? t[1].toLowerCase() : null;
1302
+ }
1303
+ const ys = ["MX", "A", "AAAA"];
1304
+ async function ps(e, t) {
1305
+ try {
1306
+ return await us(e, t), !0;
1307
+ } catch {
1308
+ return !1;
1309
+ }
1310
+ }
1311
+ async function gs(e) {
1312
+ for (const t of ys)
1313
+ if (await ps(e, t)) return !0;
1314
+ return !1;
1315
+ }
1316
+ const vs = async (e) => {
1317
+ if (!e || typeof e != "string") return !1;
1318
+ const t = e.trim();
1319
+ if (!is(t) || !fs(t)) return !1;
1320
+ const s = ds(t);
1321
+ return s ? await gs(s) : !1;
1322
+ }, As = (e) => {
1323
+ if (!e) return !1;
1324
+ const t = e.length >= 8, s = /[A-Z]/.test(e), n = /[a-z]/.test(e), r = /\d/.test(e), a = /[!@#$%^&*(),.?":{}|<>_\-+=~`[\]\\\/]/.test(
1325
+ e
1326
+ );
1327
+ return [
1328
+ t,
1329
+ s,
1330
+ n,
1331
+ r,
1332
+ a
1333
+ ].every((c) => c);
1334
+ }, ks = (e) => {
1335
+ for (const t of w) {
1336
+ const s = t.code, n = t.prefix ? `-${t.prefix}` : "", r = t.mask.replace(/[^_]/g, "").length;
1337
+ if (t.iso === "BR") {
1338
+ if (new RegExp(`^\\${s} \\d{2}9?\\d{8}$`).test(e)) return !0;
1339
+ continue;
1340
+ }
1341
+ if (new RegExp(`^\\${s}${n} \\d{${r}}$`).test(e)) return !0;
1342
+ }
1343
+ return !1;
1344
+ }, ws = (e) => {
1345
+ if (!e || !/^[0-9a-zA-Z.-]+$/.test(e)) return !1;
1346
+ const s = e.replace(/[^a-zA-Z0-9]/g, "");
1347
+ return s.length < 7 || s.length > 9 ? !1 : /^[0-9]{7,8}[0-9Xx]?$/.test(s);
1348
+ };
1190
1349
  export {
1191
- X as ApiService,
1192
- w as ArkynLogService,
1193
- j as BadGateway,
1194
- b as BadRequest,
1195
- J as Conflict,
1196
- P as Created,
1197
- S as DebugService,
1198
- D as Forbidden,
1199
- $ as Found,
1200
- H as NoContent,
1201
- C as NotFound,
1202
- B as NotImplemented,
1203
- ns as SchemaValidator,
1204
- m as ServerError,
1205
- A as Success,
1350
+ Rs as ApiService,
1351
+ U as ArkynLogService,
1352
+ J as BadGateway,
1353
+ x as BadRequest,
1354
+ j as Conflict,
1355
+ F as Created,
1356
+ I as DebugService,
1357
+ L as Forbidden,
1358
+ Y as Found,
1359
+ P as NoContent,
1360
+ B as NotFound,
1361
+ H as NotImplemented,
1362
+ $s as SchemaValidator,
1363
+ b as ServerError,
1364
+ M as Success,
1206
1365
  q as Unauthorized,
1207
- N as UnprocessableEntity,
1208
- L as Updated,
1209
- Z as decodeErrorMessageFromRequest,
1210
- ss as decodeRequestBody,
1211
- es as errorHandler,
1212
- p as flushDebugLogs,
1213
- V as formParse,
1214
- x as getCaller,
1215
- ts as getScopedParams
1366
+ O as UnprocessableEntity,
1367
+ z as Updated,
1368
+ Ns as decodeErrorMessageFromRequest,
1369
+ Ss as decodeRequestBody,
1370
+ Es as errorHandler,
1371
+ g as flushDebugLogs,
1372
+ X as formParse,
1373
+ N as getCaller,
1374
+ Ds as getScopedParams,
1375
+ Is as validateCep,
1376
+ Os as validateCnpj,
1377
+ Us as validateCpf,
1378
+ Cs as validateDate,
1379
+ vs as validateEmail,
1380
+ As as validatePassword,
1381
+ ks as validatePhone,
1382
+ ws as validateRg
1216
1383
  };