@exyconn/common 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/README.md +259 -0
  2. package/dist/client/http/index.d.mts +85 -0
  3. package/dist/client/http/index.d.ts +85 -0
  4. package/dist/client/http/index.js +127 -0
  5. package/dist/client/http/index.js.map +1 -0
  6. package/dist/client/http/index.mjs +109 -0
  7. package/dist/client/http/index.mjs.map +1 -0
  8. package/dist/client/index.d.mts +7 -0
  9. package/dist/client/index.d.ts +7 -0
  10. package/dist/client/index.js +964 -0
  11. package/dist/client/index.js.map +1 -0
  12. package/dist/client/index.mjs +889 -0
  13. package/dist/client/index.mjs.map +1 -0
  14. package/dist/client/logger/index.d.mts +53 -0
  15. package/dist/client/logger/index.d.ts +53 -0
  16. package/dist/client/logger/index.js +120 -0
  17. package/dist/client/logger/index.js.map +1 -0
  18. package/dist/client/logger/index.mjs +116 -0
  19. package/dist/client/logger/index.mjs.map +1 -0
  20. package/dist/client/utils/index.d.mts +285 -0
  21. package/dist/client/utils/index.d.ts +285 -0
  22. package/dist/client/utils/index.js +403 -0
  23. package/dist/client/utils/index.js.map +1 -0
  24. package/dist/client/utils/index.mjs +362 -0
  25. package/dist/client/utils/index.mjs.map +1 -0
  26. package/dist/index-BNdT-2X4.d.ts +229 -0
  27. package/dist/index-CcrANHAQ.d.mts +59 -0
  28. package/dist/index-ClWtDfwk.d.ts +833 -0
  29. package/dist/index-DSW6JfD-.d.mts +833 -0
  30. package/dist/index-Du0LLt9f.d.mts +229 -0
  31. package/dist/index-iTKxFa78.d.ts +59 -0
  32. package/dist/index.d.mts +171 -0
  33. package/dist/index.d.ts +171 -0
  34. package/dist/index.js +3806 -0
  35. package/dist/index.js.map +1 -0
  36. package/dist/index.mjs +3792 -0
  37. package/dist/index.mjs.map +1 -0
  38. package/dist/response.types-D--UhLJq.d.mts +67 -0
  39. package/dist/response.types-D--UhLJq.d.ts +67 -0
  40. package/dist/server/db/index.d.mts +38 -0
  41. package/dist/server/db/index.d.ts +38 -0
  42. package/dist/server/db/index.js +68 -0
  43. package/dist/server/db/index.js.map +1 -0
  44. package/dist/server/db/index.mjs +60 -0
  45. package/dist/server/db/index.mjs.map +1 -0
  46. package/dist/server/enums/index.d.mts +46 -0
  47. package/dist/server/enums/index.d.ts +46 -0
  48. package/dist/server/enums/index.js +48 -0
  49. package/dist/server/enums/index.js.map +1 -0
  50. package/dist/server/enums/index.mjs +43 -0
  51. package/dist/server/enums/index.mjs.map +1 -0
  52. package/dist/server/index.d.mts +9 -0
  53. package/dist/server/index.d.ts +9 -0
  54. package/dist/server/index.js +569 -0
  55. package/dist/server/index.js.map +1 -0
  56. package/dist/server/index.mjs +523 -0
  57. package/dist/server/index.mjs.map +1 -0
  58. package/dist/server/logger/index.d.mts +34 -0
  59. package/dist/server/logger/index.d.ts +34 -0
  60. package/dist/server/logger/index.js +125 -0
  61. package/dist/server/logger/index.js.map +1 -0
  62. package/dist/server/logger/index.mjs +113 -0
  63. package/dist/server/logger/index.mjs.map +1 -0
  64. package/dist/server/middleware/index.d.mts +56 -0
  65. package/dist/server/middleware/index.d.ts +56 -0
  66. package/dist/server/middleware/index.js +128 -0
  67. package/dist/server/middleware/index.js.map +1 -0
  68. package/dist/server/middleware/index.mjs +118 -0
  69. package/dist/server/middleware/index.mjs.map +1 -0
  70. package/dist/server/response/index.d.mts +86 -0
  71. package/dist/server/response/index.d.ts +86 -0
  72. package/dist/server/response/index.js +140 -0
  73. package/dist/server/response/index.js.map +1 -0
  74. package/dist/server/response/index.mjs +126 -0
  75. package/dist/server/response/index.mjs.map +1 -0
  76. package/dist/server/utils/index.d.mts +69 -0
  77. package/dist/server/utils/index.d.ts +69 -0
  78. package/dist/server/utils/index.js +114 -0
  79. package/dist/server/utils/index.js.map +1 -0
  80. package/dist/server/utils/index.mjs +106 -0
  81. package/dist/server/utils/index.mjs.map +1 -0
  82. package/dist/shared/index.d.mts +4 -0
  83. package/dist/shared/index.d.ts +4 -0
  84. package/dist/shared/index.js +933 -0
  85. package/dist/shared/index.js.map +1 -0
  86. package/dist/shared/index.mjs +612 -0
  87. package/dist/shared/index.mjs.map +1 -0
  88. package/package.json +202 -0
package/dist/index.mjs ADDED
@@ -0,0 +1,3792 @@
1
+ import winston from 'winston';
2
+ import DailyRotateFile from 'winston-daily-rotate-file';
3
+ import path from 'path';
4
+ import mongoose from 'mongoose';
5
+ import jwt from 'jsonwebtoken';
6
+ import axios from 'axios';
7
+ import { useCallback, useState, useEffect, useRef } from 'react';
8
+ import { subYears, subWeeks, subMonths, subMinutes, subHours, subDays, startOfYear, startOfWeek, startOfMonth, startOfDay as startOfDay$1, setSeconds, setMinutes, setHours, parseISO, isYesterday, isValid, isTomorrow, isToday as isToday$1, isThisYear, isThisWeek, isThisMonth, isSameYear, isSameWeek, isSameMonth, isSameDay, isPast as isPast$1, isFuture as isFuture$1, isEqual, isBefore, isAfter, intervalToDuration, getYear, getSeconds, getMonth, getMinutes, getHours, getDay, getDate, formatRelative, formatDuration, formatDistanceToNow, formatDistance, format, endOfYear, endOfWeek, endOfMonth, endOfDay as endOfDay$1, eachWeekOfInterval, eachMonthOfInterval, eachDayOfInterval, differenceInYears, differenceInWeeks, differenceInSeconds, differenceInMonths, differenceInMinutes, differenceInHours, differenceInDays, addYears, addWeeks, addMonths, addMinutes, addHours, addDays as addDays$1 } from 'date-fns';
9
+ import { toZonedTime, fromZonedTime, formatInTimeZone } from 'date-fns-tz';
10
+
11
+ var __defProp = Object.defineProperty;
12
+ var __export = (target, all) => {
13
+ for (var name in all)
14
+ __defProp(target, name, { get: all[name], enumerable: true });
15
+ };
16
+
17
+ // src/server/index.ts
18
+ var server_exports = {};
19
+ __export(server_exports, {
20
+ StatusCode: () => StatusCode,
21
+ StatusMessage: () => StatusMessage,
22
+ authenticateApiKey: () => authenticateApiKey,
23
+ authenticateJWT: () => authenticateJWT,
24
+ badRequestResponse: () => badRequestResponse,
25
+ buildFilter: () => buildFilter,
26
+ buildPagination: () => buildPagination,
27
+ buildPaginationMeta: () => buildPaginationMeta,
28
+ conflictResponse: () => conflictResponse,
29
+ connectDB: () => connectDB,
30
+ createLogger: () => createLogger,
31
+ createMorganStream: () => createMorganStream,
32
+ createdResponse: () => createdResponse,
33
+ disconnectDB: () => disconnectDB,
34
+ errorResponse: () => errorResponse,
35
+ extractColumns: () => extractColumns,
36
+ extractOrganization: () => extractOrganization,
37
+ forbiddenResponse: () => forbiddenResponse,
38
+ getConnectionStatus: () => getConnectionStatus,
39
+ logger: () => logger,
40
+ noContentResponse: () => noContentResponse,
41
+ notFoundResponse: () => notFoundResponse,
42
+ omitFields: () => omitFields,
43
+ optionalAuthenticateJWT: () => optionalAuthenticateJWT,
44
+ pickFields: () => pickFields,
45
+ rateLimitResponse: () => rateLimitResponse,
46
+ requireOrganization: () => requireOrganization,
47
+ sanitizeDocument: () => sanitizeDocument,
48
+ sanitizeUser: () => sanitizeUser,
49
+ simpleLogger: () => simpleLogger,
50
+ statusCode: () => statusCode,
51
+ statusMessage: () => statusMessage,
52
+ stream: () => stream,
53
+ successResponse: () => successResponse,
54
+ successResponseArr: () => successResponseArr,
55
+ unauthorizedResponse: () => unauthorizedResponse,
56
+ validationErrorResponse: () => validationErrorResponse
57
+ });
58
+
59
+ // src/server/enums/status.ts
60
+ var StatusCode = /* @__PURE__ */ ((StatusCode2) => {
61
+ StatusCode2[StatusCode2["SUCCESS"] = 200] = "SUCCESS";
62
+ StatusCode2[StatusCode2["CREATED"] = 201] = "CREATED";
63
+ StatusCode2[StatusCode2["ACCEPTED"] = 202] = "ACCEPTED";
64
+ StatusCode2[StatusCode2["NO_CONTENT"] = 204] = "NO_CONTENT";
65
+ StatusCode2[StatusCode2["BAD_REQUEST"] = 400] = "BAD_REQUEST";
66
+ StatusCode2[StatusCode2["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
67
+ StatusCode2[StatusCode2["FORBIDDEN"] = 403] = "FORBIDDEN";
68
+ StatusCode2[StatusCode2["NOT_FOUND"] = 404] = "NOT_FOUND";
69
+ StatusCode2[StatusCode2["CONFLICT"] = 409] = "CONFLICT";
70
+ StatusCode2[StatusCode2["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
71
+ StatusCode2[StatusCode2["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
72
+ StatusCode2[StatusCode2["INTERNAL_ERROR"] = 500] = "INTERNAL_ERROR";
73
+ StatusCode2[StatusCode2["NOT_IMPLEMENTED"] = 501] = "NOT_IMPLEMENTED";
74
+ StatusCode2[StatusCode2["BAD_GATEWAY"] = 502] = "BAD_GATEWAY";
75
+ StatusCode2[StatusCode2["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
76
+ return StatusCode2;
77
+ })(StatusCode || {});
78
+ var StatusMessage = /* @__PURE__ */ ((StatusMessage2) => {
79
+ StatusMessage2["SUCCESS"] = "success";
80
+ StatusMessage2["CREATED"] = "created";
81
+ StatusMessage2["ACCEPTED"] = "accepted";
82
+ StatusMessage2["NO_CONTENT"] = "no-data-found";
83
+ StatusMessage2["BAD_REQUEST"] = "bad-request";
84
+ StatusMessage2["UNAUTHORIZED"] = "unauthorized";
85
+ StatusMessage2["FORBIDDEN"] = "forbidden";
86
+ StatusMessage2["NOT_FOUND"] = "not-found";
87
+ StatusMessage2["CONFLICT"] = "conflict";
88
+ StatusMessage2["UNPROCESSABLE_ENTITY"] = "validation-error";
89
+ StatusMessage2["TOO_MANY_REQUESTS"] = "rate-limit-exceeded";
90
+ StatusMessage2["INTERNAL_ERROR"] = "error";
91
+ StatusMessage2["NOT_IMPLEMENTED"] = "not-implemented";
92
+ StatusMessage2["BAD_GATEWAY"] = "bad-gateway";
93
+ StatusMessage2["SERVICE_UNAVAILABLE"] = "service-unavailable";
94
+ return StatusMessage2;
95
+ })(StatusMessage || {});
96
+ var statusCode = StatusCode;
97
+ var statusMessage = StatusMessage;
98
+
99
+ // src/server/response/response-object.ts
100
+ var extractColumns = (data) => {
101
+ if (!Array.isArray(data) || data.length === 0) {
102
+ return [];
103
+ }
104
+ const sample = data[0];
105
+ return Object.entries(sample).map(([key, value]) => {
106
+ let datatype = typeof value;
107
+ if (value === null) {
108
+ datatype = "null";
109
+ } else if (Array.isArray(value)) {
110
+ datatype = "array";
111
+ } else if (value instanceof Date) {
112
+ datatype = "date";
113
+ } else if (typeof value === "object") {
114
+ datatype = "object";
115
+ }
116
+ return {
117
+ name: key,
118
+ datatype,
119
+ required: value !== null && value !== void 0
120
+ };
121
+ });
122
+ };
123
+ var successResponse = (res, data, message = "Operation successful") => {
124
+ return res.status(200 /* SUCCESS */).json({
125
+ message,
126
+ data,
127
+ status: "success" /* SUCCESS */,
128
+ statusCode: 200 /* SUCCESS */
129
+ });
130
+ };
131
+ var successResponseArr = (res, data, paginationData = {}, message = "Operation successful") => {
132
+ return res.status(200 /* SUCCESS */).json({
133
+ message,
134
+ data,
135
+ columns: extractColumns(data),
136
+ paginationData,
137
+ status: "success" /* SUCCESS */,
138
+ statusCode: 200 /* SUCCESS */
139
+ });
140
+ };
141
+ var createdResponse = (res, data, message = "Resource created successfully") => {
142
+ return res.status(201 /* CREATED */).json({
143
+ message,
144
+ data,
145
+ status: "created" /* CREATED */,
146
+ statusCode: 201 /* CREATED */
147
+ });
148
+ };
149
+ var noContentResponse = (res, data = null, message = "No data found") => {
150
+ return res.status(200 /* SUCCESS */).json({
151
+ message,
152
+ data,
153
+ status: "no-data-found" /* NO_CONTENT */,
154
+ statusCode: 204 /* NO_CONTENT */
155
+ });
156
+ };
157
+ var badRequestResponse = (res, message = "Bad request", errors = null) => {
158
+ return res.status(400 /* BAD_REQUEST */).json({
159
+ message,
160
+ data: errors,
161
+ status: "bad-request" /* BAD_REQUEST */,
162
+ statusCode: 400 /* BAD_REQUEST */
163
+ });
164
+ };
165
+ var unauthorizedResponse = (res, message = "Unauthorized access") => {
166
+ return res.status(401 /* UNAUTHORIZED */).json({
167
+ message,
168
+ data: null,
169
+ status: "unauthorized" /* UNAUTHORIZED */,
170
+ statusCode: 401 /* UNAUTHORIZED */
171
+ });
172
+ };
173
+ var forbiddenResponse = (res, message = "Access forbidden") => {
174
+ return res.status(403 /* FORBIDDEN */).json({
175
+ message,
176
+ data: null,
177
+ status: "forbidden" /* FORBIDDEN */,
178
+ statusCode: 403 /* FORBIDDEN */
179
+ });
180
+ };
181
+ var notFoundResponse = (res, message = "Resource not found") => {
182
+ return res.status(404 /* NOT_FOUND */).json({
183
+ message,
184
+ data: null,
185
+ status: "not-found" /* NOT_FOUND */,
186
+ statusCode: 404 /* NOT_FOUND */
187
+ });
188
+ };
189
+ var conflictResponse = (res, message = "Resource conflict") => {
190
+ return res.status(409 /* CONFLICT */).json({
191
+ message,
192
+ data: null,
193
+ status: "conflict" /* CONFLICT */,
194
+ statusCode: 409 /* CONFLICT */
195
+ });
196
+ };
197
+ var validationErrorResponse = (res, errors, message = "Validation failed") => {
198
+ return res.status(422 /* UNPROCESSABLE_ENTITY */).json({
199
+ message,
200
+ data: errors,
201
+ status: "validation-error" /* UNPROCESSABLE_ENTITY */,
202
+ statusCode: 422 /* UNPROCESSABLE_ENTITY */
203
+ });
204
+ };
205
+ var errorResponse = (res, error = null, message = "Something went wrong") => {
206
+ return res.status(500 /* INTERNAL_ERROR */).json({
207
+ message,
208
+ data: error,
209
+ status: "error" /* INTERNAL_ERROR */,
210
+ statusCode: 500 /* INTERNAL_ERROR */
211
+ });
212
+ };
213
+ var rateLimitResponse = (res, message = "Too many requests, please try again later") => {
214
+ return res.status(429 /* TOO_MANY_REQUESTS */).json({
215
+ message,
216
+ data: null,
217
+ status: "rate-limit-exceeded" /* TOO_MANY_REQUESTS */,
218
+ statusCode: 429 /* TOO_MANY_REQUESTS */
219
+ });
220
+ };
221
+ var defaultConfig = {
222
+ level: process.env.LOG_LEVEL || "info",
223
+ logsDir: "logs",
224
+ maxSize: "20m",
225
+ maxFiles: "14d",
226
+ errorMaxFiles: "30d"
227
+ };
228
+ var levels = {
229
+ error: 0,
230
+ warn: 1,
231
+ info: 2,
232
+ http: 3,
233
+ debug: 4
234
+ };
235
+ var colors = {
236
+ error: "red",
237
+ warn: "yellow",
238
+ info: "green",
239
+ http: "magenta",
240
+ debug: "blue"
241
+ };
242
+ winston.addColors(colors);
243
+ var fileFormat = winston.format.combine(
244
+ winston.format.timestamp({ format: "YYYY-MM-DD HH:mm:ss" }),
245
+ winston.format.errors({ stack: true }),
246
+ winston.format.splat(),
247
+ winston.format.json()
248
+ );
249
+ var consoleFormat = winston.format.combine(
250
+ winston.format.colorize({ all: true }),
251
+ winston.format.timestamp({ format: "YYYY-MM-DD HH:mm:ss" }),
252
+ winston.format.printf((info) => {
253
+ const timestamp = info.timestamp;
254
+ const level = info.level;
255
+ const message = info.message;
256
+ const stack = info.stack;
257
+ return `${timestamp} [${level}]: ${message}${stack ? "\n" + stack : ""}`;
258
+ })
259
+ );
260
+ var createLogger = (config = {}) => {
261
+ const finalConfig = { ...defaultConfig, ...config };
262
+ const transports = [
263
+ // Console transport
264
+ new winston.transports.Console({
265
+ format: consoleFormat
266
+ }),
267
+ // Combined logs (all levels)
268
+ new DailyRotateFile({
269
+ filename: path.join(finalConfig.logsDir, "combined-%DATE%.log"),
270
+ datePattern: "YYYY-MM-DD",
271
+ maxSize: finalConfig.maxSize,
272
+ maxFiles: finalConfig.maxFiles,
273
+ format: fileFormat
274
+ }),
275
+ // Error logs only
276
+ new DailyRotateFile({
277
+ filename: path.join(finalConfig.logsDir, "error-%DATE%.log"),
278
+ datePattern: "YYYY-MM-DD",
279
+ level: "error",
280
+ maxSize: finalConfig.maxSize,
281
+ maxFiles: finalConfig.errorMaxFiles,
282
+ format: fileFormat
283
+ })
284
+ ];
285
+ return winston.createLogger({
286
+ level: finalConfig.level,
287
+ levels,
288
+ format: fileFormat,
289
+ transports,
290
+ exitOnError: false
291
+ });
292
+ };
293
+ var logger = createLogger();
294
+ var createMorganStream = (loggerInstance) => ({
295
+ write: (message) => {
296
+ loggerInstance.http(message.trim());
297
+ }
298
+ });
299
+ var stream = createMorganStream(logger);
300
+ var serializeMeta = (meta) => {
301
+ if (meta === void 0 || meta === null) return "";
302
+ if (meta instanceof Error) {
303
+ return JSON.stringify({ message: meta.message, stack: meta.stack }, null, 2);
304
+ }
305
+ try {
306
+ return JSON.stringify(meta, null, 2);
307
+ } catch {
308
+ return String(meta);
309
+ }
310
+ };
311
+ var simpleLogger = {
312
+ info: (message, meta) => {
313
+ console.log(`[INFO] ${message}`, serializeMeta(meta));
314
+ },
315
+ error: (message, meta) => {
316
+ console.error(`[ERROR] ${message}`, serializeMeta(meta));
317
+ },
318
+ warn: (message, meta) => {
319
+ console.warn(`[WARN] ${message}`, serializeMeta(meta));
320
+ },
321
+ debug: (message, meta) => {
322
+ console.debug(`[DEBUG] ${message}`, serializeMeta(meta));
323
+ }
324
+ };
325
+ var defaultOptions = {
326
+ maxPoolSize: process.env.NODE_ENV === "production" ? 50 : 10,
327
+ minPoolSize: process.env.NODE_ENV === "production" ? 10 : 5,
328
+ socketTimeoutMS: 45e3,
329
+ serverSelectionTimeoutMS: 1e4,
330
+ maxIdleTimeMS: 1e4,
331
+ retryWrites: true,
332
+ retryReads: true,
333
+ w: "majority"
334
+ };
335
+ var connectDB = async (mongoUri, options = {}, logger2) => {
336
+ if (mongoose.connection.readyState === 1) {
337
+ logger2?.info("Database already connected, reusing connection");
338
+ return mongoose;
339
+ }
340
+ const finalOptions = { ...defaultOptions, ...options };
341
+ try {
342
+ await mongoose.connect(mongoUri, finalOptions);
343
+ logger2?.info("MongoDB connected successfully");
344
+ mongoose.connection.on("error", (err) => {
345
+ logger2?.error("MongoDB connection error", err);
346
+ });
347
+ mongoose.connection.on("disconnected", () => {
348
+ logger2?.info("MongoDB disconnected");
349
+ });
350
+ mongoose.connection.on("reconnected", () => {
351
+ logger2?.info("MongoDB reconnected");
352
+ });
353
+ return mongoose;
354
+ } catch (error) {
355
+ const errorMessage = error instanceof Error ? error.message : String(error);
356
+ logger2?.error("MongoDB connection failed", { error: errorMessage });
357
+ throw error;
358
+ }
359
+ };
360
+ var disconnectDB = async (logger2) => {
361
+ try {
362
+ await mongoose.disconnect();
363
+ logger2?.info("MongoDB disconnected successfully");
364
+ } catch (error) {
365
+ logger2?.error("Error disconnecting from MongoDB", error);
366
+ throw error;
367
+ }
368
+ };
369
+ var getConnectionStatus = () => {
370
+ const states = {
371
+ 0: "disconnected",
372
+ 1: "connected",
373
+ 2: "connecting",
374
+ 3: "disconnecting"
375
+ };
376
+ return states[mongoose.connection.readyState] || "unknown";
377
+ };
378
+ var authenticateJWT = (secretKey) => {
379
+ return (req, res, next) => {
380
+ const authHeader = req.headers.authorization;
381
+ if (!authHeader || !authHeader.startsWith("Bearer ")) {
382
+ unauthorizedResponse(res, "Authorization header missing or malformed");
383
+ return;
384
+ }
385
+ const token = authHeader.split(" ")[1];
386
+ try {
387
+ const decoded = jwt.verify(token, secretKey);
388
+ req.userId = decoded.userId;
389
+ req.organizationId = decoded.organizationId;
390
+ req.user = decoded;
391
+ if (!decoded.userId) {
392
+ unauthorizedResponse(res, "User ID not found in token");
393
+ return;
394
+ }
395
+ next();
396
+ } catch (err) {
397
+ if (err instanceof jwt.TokenExpiredError) {
398
+ unauthorizedResponse(res, "Token has expired");
399
+ return;
400
+ }
401
+ if (err instanceof jwt.JsonWebTokenError) {
402
+ forbiddenResponse(res, "Invalid token");
403
+ return;
404
+ }
405
+ unauthorizedResponse(res, "Token validation failed");
406
+ }
407
+ };
408
+ };
409
+ var optionalAuthenticateJWT = (secretKey) => {
410
+ return (req, _res, next) => {
411
+ const authHeader = req.headers.authorization;
412
+ if (!authHeader || !authHeader.startsWith("Bearer ")) {
413
+ next();
414
+ return;
415
+ }
416
+ const token = authHeader.split(" ")[1];
417
+ try {
418
+ const decoded = jwt.verify(token, secretKey);
419
+ req.userId = decoded.userId;
420
+ req.organizationId = decoded.organizationId;
421
+ req.user = decoded;
422
+ } catch {
423
+ }
424
+ next();
425
+ };
426
+ };
427
+ var authenticateApiKey = (validateKeyFn) => {
428
+ return async (req, res, next) => {
429
+ try {
430
+ const apiKey = req.headers["x-api-key"];
431
+ if (!apiKey) {
432
+ unauthorizedResponse(res, "API key is required. Please provide x-api-key header");
433
+ return;
434
+ }
435
+ const validation = await validateKeyFn(apiKey);
436
+ if (!validation.valid) {
437
+ unauthorizedResponse(res, "Invalid or inactive API key");
438
+ return;
439
+ }
440
+ if (validation.organizationId) {
441
+ req.organizationId = validation.organizationId;
442
+ }
443
+ if (validation.keyId && validation.keyName) {
444
+ req.apiKey = {
445
+ _id: validation.keyId,
446
+ name: validation.keyName
447
+ };
448
+ }
449
+ next();
450
+ } catch {
451
+ unauthorizedResponse(res, "API key validation failed");
452
+ }
453
+ };
454
+ };
455
+ var extractOrganization = (req, _res, next) => {
456
+ const orgId = req.headers["x-organization-id"];
457
+ if (orgId) {
458
+ req.organizationId = orgId;
459
+ }
460
+ next();
461
+ };
462
+ var requireOrganization = (req, res, next) => {
463
+ if (!req.organizationId) {
464
+ unauthorizedResponse(res, "Organization ID is required");
465
+ return;
466
+ }
467
+ next();
468
+ };
469
+
470
+ // src/server/utils/filter-builder.ts
471
+ var buildFilter = (options) => {
472
+ const {
473
+ organizationId,
474
+ search,
475
+ searchFields = [],
476
+ dateField = "createdAt",
477
+ startDate,
478
+ endDate,
479
+ status,
480
+ isActive,
481
+ ...additionalFilters
482
+ } = options;
483
+ const filter = {};
484
+ if (organizationId) {
485
+ filter.organizationId = organizationId;
486
+ }
487
+ if (search && search.trim().length >= 2 && searchFields.length > 0) {
488
+ const searchRegex = new RegExp(search.trim(), "i");
489
+ filter.$or = searchFields.map((field) => ({ [field]: searchRegex }));
490
+ }
491
+ if (startDate || endDate) {
492
+ filter[dateField] = {};
493
+ if (startDate) {
494
+ filter[dateField].$gte = new Date(startDate);
495
+ }
496
+ if (endDate) {
497
+ filter[dateField].$lte = new Date(endDate);
498
+ }
499
+ }
500
+ if (status !== void 0) {
501
+ filter.status = status;
502
+ }
503
+ if (isActive !== void 0) {
504
+ filter.isActive = isActive;
505
+ }
506
+ Object.entries(additionalFilters).forEach(([key, value]) => {
507
+ if (value !== void 0 && value !== null && value !== "") {
508
+ filter[key] = value;
509
+ }
510
+ });
511
+ return filter;
512
+ };
513
+ var buildPagination = (options) => {
514
+ const { page = 1, limit, defaultLimit = 10, maxLimit = 100 } = options;
515
+ const finalPage = Math.max(1, page);
516
+ const finalLimit = Math.min(maxLimit, Math.max(1, limit || defaultLimit));
517
+ const skip = (finalPage - 1) * finalLimit;
518
+ return {
519
+ skip,
520
+ limit: finalLimit,
521
+ page: finalPage
522
+ };
523
+ };
524
+ var buildPaginationMeta = (total, page, limit) => {
525
+ const totalPages = Math.ceil(total / limit);
526
+ return {
527
+ total,
528
+ page,
529
+ limit,
530
+ totalPages,
531
+ hasNextPage: page < totalPages,
532
+ hasPrevPage: page > 1
533
+ };
534
+ };
535
+
536
+ // src/server/utils/sanitize.ts
537
+ var sanitizeUser = (user, additionalFieldsToRemove = []) => {
538
+ if (!user) return null;
539
+ const fieldsToRemove = ["password", "__v", "_id", ...additionalFieldsToRemove];
540
+ const obj = typeof user.toObject === "function" ? user.toObject() : { ...user };
541
+ fieldsToRemove.forEach((field) => {
542
+ delete obj[field];
543
+ });
544
+ return obj;
545
+ };
546
+ var sanitizeDocument = (doc, fieldsToRemove) => {
547
+ if (!doc) return null;
548
+ const obj = typeof doc.toObject === "function" ? doc.toObject() : { ...doc };
549
+ fieldsToRemove.forEach((field) => {
550
+ delete obj[field];
551
+ });
552
+ return obj;
553
+ };
554
+ var pickFields = (obj, fieldsToPick) => {
555
+ if (!obj) return null;
556
+ const result = {};
557
+ fieldsToPick.forEach((field) => {
558
+ if (field in obj) {
559
+ result[field] = obj[field];
560
+ }
561
+ });
562
+ return result;
563
+ };
564
+ var omitFields = (obj, fieldsToOmit) => {
565
+ if (!obj) return null;
566
+ const result = { ...obj };
567
+ fieldsToOmit.forEach((field) => {
568
+ delete result[field];
569
+ });
570
+ return result;
571
+ };
572
+
573
+ // src/client/index.ts
574
+ var client_exports = {};
575
+ __export(client_exports, {
576
+ ApiUrlBuilder: () => ApiUrlBuilder,
577
+ ClientLogger: () => ClientLogger,
578
+ EventEmitter: () => EventEmitter,
579
+ addDays: () => addDays,
580
+ appEvents: () => appEvents,
581
+ camelToKebab: () => camelToKebab,
582
+ capitalize: () => capitalize,
583
+ capitalizeWords: () => capitalizeWords,
584
+ clientLogger: () => clientLogger,
585
+ copyToClipboard: () => copyToClipboard,
586
+ createApiEndpoints: () => createApiEndpoints,
587
+ createApiUrlBuilder: () => createApiUrlBuilder,
588
+ createClientLogger: () => createClientLogger,
589
+ createEmptyPaginationMeta: () => createEmptyPaginationMeta,
590
+ createErrorResponse: () => createErrorResponse,
591
+ createEventEmitter: () => createEventEmitter,
592
+ createHttpClient: () => createHttpClient,
593
+ createSuccessResponse: () => createSuccessResponse,
594
+ endOfDay: () => endOfDay,
595
+ formatDate: () => formatDate,
596
+ formatDateForInput: () => formatDateForInput,
597
+ formatDateTime: () => formatDateTime,
598
+ formatDateTimeForInput: () => formatDateTimeForInput,
599
+ formatRelativeTime: () => formatRelativeTime,
600
+ getErrorMessage: () => getErrorMessage,
601
+ getNextPage: () => getNextPage,
602
+ getPrevPage: () => getPrevPage,
603
+ getResponseData: () => getResponseData,
604
+ hasData: () => hasData,
605
+ hasMorePages: () => hasMorePages,
606
+ isClipboardAvailable: () => isClipboardAvailable,
607
+ isErrorResponse: () => isErrorResponse,
608
+ isForbidden: () => isForbidden,
609
+ isFuture: () => isFuture,
610
+ isNotFound: () => isNotFound,
611
+ isPast: () => isPast,
612
+ isServerError: () => isServerError,
613
+ isStatusError: () => isStatusError,
614
+ isSuccess: () => isSuccess,
615
+ isSuccessResponse: () => isSuccessResponse,
616
+ isToday: () => isToday,
617
+ isUnauthorized: () => isUnauthorized,
618
+ kebabToCamel: () => kebabToCamel,
619
+ parseError: () => parseError,
620
+ parseFullResponse: () => parseFullResponse,
621
+ parseResponse: () => parseResponse,
622
+ readFromClipboard: () => readFromClipboard,
623
+ slugify: () => slugify,
624
+ slugifyUnique: () => slugifyUnique,
625
+ startOfDay: () => startOfDay,
626
+ truncate: () => truncate,
627
+ truncateWords: () => truncateWords,
628
+ unslugify: () => unslugify,
629
+ useCopyToClipboard: () => useCopyToClipboard_default,
630
+ useDebounce: () => useDebounce_default,
631
+ useInterval: () => useInterval_default,
632
+ useIsDesktop: () => useIsDesktop,
633
+ useIsMobile: () => useIsMobile,
634
+ useIsMobileOrTablet: () => useIsMobileOrTablet,
635
+ useIsTablet: () => useIsTablet,
636
+ useLocalStorage: () => useLocalStorage_default,
637
+ useMediaQuery: () => useMediaQuery_default,
638
+ useOnClickOutside: () => useOnClickOutside_default,
639
+ usePageTitle: () => usePageTitle_default,
640
+ useSnackbar: () => useSnackbar_default,
641
+ useThemeDetector: () => useThemeDetector_default,
642
+ useWindowSize: () => useWindowSize_default,
643
+ withAbortSignal: () => withAbortSignal,
644
+ withFormData: () => withFormData,
645
+ withTimeout: () => withTimeout
646
+ });
647
+ var createHttpClient = (options) => {
648
+ const {
649
+ baseURL,
650
+ timeout = 3e4,
651
+ withCredentials = true,
652
+ getAuthToken,
653
+ onUnauthorized,
654
+ onServerError
655
+ } = options;
656
+ const instance = axios.create({
657
+ baseURL,
658
+ timeout,
659
+ withCredentials,
660
+ headers: {
661
+ "Content-Type": "application/json"
662
+ }
663
+ });
664
+ instance.interceptors.request.use(
665
+ (config) => {
666
+ if (getAuthToken) {
667
+ const token = getAuthToken();
668
+ if (token && config.headers) {
669
+ config.headers.Authorization = `Bearer ${token}`;
670
+ }
671
+ }
672
+ return config;
673
+ },
674
+ (error) => Promise.reject(error)
675
+ );
676
+ instance.interceptors.response.use(
677
+ (response) => response,
678
+ (error) => {
679
+ if (error.response) {
680
+ const status = error.response.status;
681
+ if (status === 401 && onUnauthorized) {
682
+ onUnauthorized();
683
+ }
684
+ if (status >= 500 && onServerError) {
685
+ onServerError(error);
686
+ }
687
+ }
688
+ return Promise.reject(error);
689
+ }
690
+ );
691
+ return instance;
692
+ };
693
+ var withFormData = () => ({
694
+ headers: {
695
+ "Content-Type": "multipart/form-data"
696
+ }
697
+ });
698
+ var withTimeout = (ms) => ({
699
+ timeout: ms
700
+ });
701
+ var withAbortSignal = (signal) => ({
702
+ signal
703
+ });
704
+
705
+ // src/client/http/response-parser.ts
706
+ var parseResponse = (response) => {
707
+ if (response.data?.success && response.data?.data !== void 0) {
708
+ return response.data.data;
709
+ }
710
+ return null;
711
+ };
712
+ var parseFullResponse = (response) => {
713
+ return response.data;
714
+ };
715
+ var parseError = (error) => {
716
+ if (error.response?.data?.message) {
717
+ return error.response.data.message;
718
+ }
719
+ if (error.response?.data?.error) {
720
+ return error.response.data.error;
721
+ }
722
+ if (error.code === "ERR_NETWORK") {
723
+ return "Network error. Please check your connection.";
724
+ }
725
+ if (error.code === "ECONNABORTED") {
726
+ return "Request timed out. Please try again.";
727
+ }
728
+ return error.message || "An unexpected error occurred.";
729
+ };
730
+ var isSuccess = (response) => {
731
+ return response.data?.success === true;
732
+ };
733
+ var isStatusError = (error, statusCode2) => {
734
+ return error.response?.status === statusCode2;
735
+ };
736
+ var isUnauthorized = (error) => {
737
+ return isStatusError(error, 401);
738
+ };
739
+ var isForbidden = (error) => {
740
+ return isStatusError(error, 403);
741
+ };
742
+ var isNotFound = (error) => {
743
+ return isStatusError(error, 404);
744
+ };
745
+ var isServerError = (error) => {
746
+ const status = error.response?.status;
747
+ return status !== void 0 && status >= 500;
748
+ };
749
+
750
+ // src/client/logger/client-logger.ts
751
+ var LOG_LEVELS = {
752
+ debug: 0,
753
+ info: 1,
754
+ warn: 2,
755
+ error: 3
756
+ };
757
+ var ClientLogger = class {
758
+ constructor(config = {}) {
759
+ this.buffer = [];
760
+ this.config = {
761
+ enabled: config.enabled ?? process.env.NODE_ENV !== "production",
762
+ minLevel: config.minLevel ?? "debug",
763
+ prefix: config.prefix ?? "[App]",
764
+ includeTimestamp: config.includeTimestamp ?? true,
765
+ remoteLogging: config.remoteLogging
766
+ };
767
+ if (this.config.remoteLogging?.enabled) {
768
+ const interval = this.config.remoteLogging.flushInterval ?? 3e4;
769
+ this.flushTimer = setInterval(() => this.flush(), interval);
770
+ }
771
+ }
772
+ shouldLog(level) {
773
+ if (!this.config.enabled) return false;
774
+ return LOG_LEVELS[level] >= LOG_LEVELS[this.config.minLevel];
775
+ }
776
+ formatMessage(level, message) {
777
+ const parts = [];
778
+ if (this.config.includeTimestamp) {
779
+ parts.push(`[${(/* @__PURE__ */ new Date()).toISOString()}]`);
780
+ }
781
+ parts.push(this.config.prefix);
782
+ parts.push(`[${level.toUpperCase()}]`);
783
+ parts.push(message);
784
+ return parts.join(" ");
785
+ }
786
+ log(level, message, data) {
787
+ if (!this.shouldLog(level)) return;
788
+ const formattedMessage = this.formatMessage(level, message);
789
+ const entry = {
790
+ level,
791
+ message,
792
+ data,
793
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
794
+ prefix: this.config.prefix
795
+ };
796
+ switch (level) {
797
+ case "debug":
798
+ console.debug(formattedMessage, data ?? "");
799
+ break;
800
+ case "info":
801
+ console.info(formattedMessage, data ?? "");
802
+ break;
803
+ case "warn":
804
+ console.warn(formattedMessage, data ?? "");
805
+ break;
806
+ case "error":
807
+ console.error(formattedMessage, data ?? "");
808
+ break;
809
+ }
810
+ if (this.config.remoteLogging?.enabled) {
811
+ this.buffer.push(entry);
812
+ const batchSize = this.config.remoteLogging.batchSize ?? 10;
813
+ if (this.buffer.length >= batchSize) {
814
+ this.flush();
815
+ }
816
+ }
817
+ }
818
+ debug(message, data) {
819
+ this.log("debug", message, data);
820
+ }
821
+ info(message, data) {
822
+ this.log("info", message, data);
823
+ }
824
+ warn(message, data) {
825
+ this.log("warn", message, data);
826
+ }
827
+ error(message, data) {
828
+ this.log("error", message, data);
829
+ }
830
+ /**
831
+ * Flush buffered logs to remote endpoint
832
+ */
833
+ async flush() {
834
+ if (!this.config.remoteLogging?.enabled || this.buffer.length === 0) return;
835
+ const logs = [...this.buffer];
836
+ this.buffer = [];
837
+ try {
838
+ await fetch(this.config.remoteLogging.endpoint, {
839
+ method: "POST",
840
+ headers: { "Content-Type": "application/json" },
841
+ body: JSON.stringify({ logs })
842
+ });
843
+ } catch (error) {
844
+ this.buffer = [...logs, ...this.buffer].slice(0, 100);
845
+ console.error("Failed to send logs to remote endpoint", error);
846
+ }
847
+ }
848
+ /**
849
+ * Cleanup logger (clear intervals)
850
+ */
851
+ destroy() {
852
+ if (this.flushTimer) {
853
+ clearInterval(this.flushTimer);
854
+ }
855
+ this.flush();
856
+ }
857
+ };
858
+ var createClientLogger = (config) => {
859
+ return new ClientLogger(config);
860
+ };
861
+ var clientLogger = new ClientLogger();
862
+
863
+ // src/client/utils/date.ts
864
+ var formatDate = (date, locale = "en-US") => {
865
+ const dateObj = new Date(date);
866
+ return dateObj.toLocaleDateString(locale, {
867
+ year: "numeric",
868
+ month: "long",
869
+ day: "numeric"
870
+ });
871
+ };
872
+ var formatDateTime = (date, locale = "en-US") => {
873
+ const dateObj = new Date(date);
874
+ return dateObj.toLocaleDateString(locale, {
875
+ year: "numeric",
876
+ month: "short",
877
+ day: "numeric",
878
+ hour: "2-digit",
879
+ minute: "2-digit"
880
+ });
881
+ };
882
+ var formatRelativeTime = (date) => {
883
+ const dateObj = new Date(date);
884
+ const now = /* @__PURE__ */ new Date();
885
+ const diffInSeconds = Math.floor((now.getTime() - dateObj.getTime()) / 1e3);
886
+ const intervals = [
887
+ { label: "year", seconds: 31536e3 },
888
+ { label: "month", seconds: 2592e3 },
889
+ { label: "week", seconds: 604800 },
890
+ { label: "day", seconds: 86400 },
891
+ { label: "hour", seconds: 3600 },
892
+ { label: "minute", seconds: 60 },
893
+ { label: "second", seconds: 1 }
894
+ ];
895
+ for (const interval of intervals) {
896
+ const count = Math.floor(diffInSeconds / interval.seconds);
897
+ if (count >= 1) {
898
+ return `${count} ${interval.label}${count !== 1 ? "s" : ""} ago`;
899
+ }
900
+ }
901
+ return "just now";
902
+ };
903
+ var formatDateForInput = (date) => {
904
+ const dateObj = new Date(date);
905
+ return dateObj.toISOString().split("T")[0];
906
+ };
907
+ var formatDateTimeForInput = (date) => {
908
+ const dateObj = new Date(date);
909
+ return dateObj.toISOString().slice(0, 16);
910
+ };
911
+ var isToday = (date) => {
912
+ const dateObj = new Date(date);
913
+ const today = /* @__PURE__ */ new Date();
914
+ return dateObj.getDate() === today.getDate() && dateObj.getMonth() === today.getMonth() && dateObj.getFullYear() === today.getFullYear();
915
+ };
916
+ var isPast = (date) => {
917
+ return new Date(date).getTime() < Date.now();
918
+ };
919
+ var isFuture = (date) => {
920
+ return new Date(date).getTime() > Date.now();
921
+ };
922
+ var addDays = (date, days) => {
923
+ const dateObj = new Date(date);
924
+ dateObj.setDate(dateObj.getDate() + days);
925
+ return dateObj;
926
+ };
927
+ var startOfDay = (date) => {
928
+ const dateObj = new Date(date);
929
+ dateObj.setHours(0, 0, 0, 0);
930
+ return dateObj;
931
+ };
932
+ var endOfDay = (date) => {
933
+ const dateObj = new Date(date);
934
+ dateObj.setHours(23, 59, 59, 999);
935
+ return dateObj;
936
+ };
937
+
938
+ // src/client/utils/clipboard.ts
939
+ var copyToClipboard = async (text) => {
940
+ try {
941
+ if (navigator.clipboard && window.isSecureContext) {
942
+ await navigator.clipboard.writeText(text);
943
+ return true;
944
+ }
945
+ const textArea = document.createElement("textarea");
946
+ textArea.value = text;
947
+ textArea.style.position = "fixed";
948
+ textArea.style.left = "-999999px";
949
+ textArea.style.top = "-999999px";
950
+ document.body.appendChild(textArea);
951
+ textArea.focus();
952
+ textArea.select();
953
+ const success = document.execCommand("copy");
954
+ document.body.removeChild(textArea);
955
+ return success;
956
+ } catch (error) {
957
+ console.error("Failed to copy to clipboard:", error);
958
+ return false;
959
+ }
960
+ };
961
+ var readFromClipboard = async () => {
962
+ try {
963
+ if (navigator.clipboard && window.isSecureContext) {
964
+ return await navigator.clipboard.readText();
965
+ }
966
+ return null;
967
+ } catch (error) {
968
+ console.error("Failed to read from clipboard:", error);
969
+ return null;
970
+ }
971
+ };
972
+ var isClipboardAvailable = () => {
973
+ return !!(navigator.clipboard && window.isSecureContext);
974
+ };
975
+
976
+ // src/client/utils/slug.ts
977
+ var slugify = (text) => {
978
+ return text.toString().toLowerCase().trim().replace(/\s+/g, "-").replace(/[^\w\-]+/g, "").replace(/\-\-+/g, "-").replace(/^-+/, "").replace(/-+$/, "");
979
+ };
980
+ var slugifyUnique = (text) => {
981
+ const baseSlug = slugify(text);
982
+ const uniqueSuffix = Date.now().toString(36) + Math.random().toString(36).substring(2, 5);
983
+ return `${baseSlug}-${uniqueSuffix}`;
984
+ };
985
+ var unslugify = (slug) => {
986
+ return slug.replace(/-/g, " ").replace(/\b\w/g, (char) => char.toUpperCase());
987
+ };
988
+ var truncate = (text, maxLength, suffix = "...") => {
989
+ if (text.length <= maxLength) return text;
990
+ return text.substring(0, maxLength - suffix.length).trim() + suffix;
991
+ };
992
+ var truncateWords = (text, maxWords, suffix = "...") => {
993
+ const words = text.split(/\s+/);
994
+ if (words.length <= maxWords) return text;
995
+ return words.slice(0, maxWords).join(" ") + suffix;
996
+ };
997
+ var capitalizeWords = (text) => {
998
+ return text.replace(/\b\w/g, (char) => char.toUpperCase());
999
+ };
1000
+ var capitalize = (text) => {
1001
+ if (!text) return "";
1002
+ return text.charAt(0).toUpperCase() + text.slice(1);
1003
+ };
1004
+ var camelToKebab = (text) => {
1005
+ return text.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
1006
+ };
1007
+ var kebabToCamel = (text) => {
1008
+ return text.replace(/-([a-z])/g, (_, char) => char.toUpperCase());
1009
+ };
1010
+
1011
+ // src/client/utils/events.ts
1012
+ var EventEmitter = class {
1013
+ constructor() {
1014
+ this.handlers = /* @__PURE__ */ new Map();
1015
+ }
1016
+ /**
1017
+ * Subscribe to an event
1018
+ * @returns Unsubscribe function
1019
+ */
1020
+ on(event, handler) {
1021
+ if (!this.handlers.has(event)) {
1022
+ this.handlers.set(event, /* @__PURE__ */ new Set());
1023
+ }
1024
+ this.handlers.get(event).add(handler);
1025
+ return () => this.off(event, handler);
1026
+ }
1027
+ /**
1028
+ * Subscribe to an event once
1029
+ */
1030
+ once(event, handler) {
1031
+ const wrappedHandler = (data) => {
1032
+ this.off(event, wrappedHandler);
1033
+ handler(data);
1034
+ };
1035
+ return this.on(event, wrappedHandler);
1036
+ }
1037
+ /**
1038
+ * Unsubscribe from an event
1039
+ */
1040
+ off(event, handler) {
1041
+ const eventHandlers = this.handlers.get(event);
1042
+ if (eventHandlers) {
1043
+ eventHandlers.delete(handler);
1044
+ }
1045
+ }
1046
+ /**
1047
+ * Emit an event
1048
+ */
1049
+ emit(event, data) {
1050
+ const eventHandlers = this.handlers.get(event);
1051
+ if (eventHandlers) {
1052
+ eventHandlers.forEach((handler) => {
1053
+ try {
1054
+ handler(data);
1055
+ } catch (error) {
1056
+ console.error(`Error in event handler for "${String(event)}":`, error);
1057
+ }
1058
+ });
1059
+ }
1060
+ }
1061
+ /**
1062
+ * Remove all handlers for an event (or all events)
1063
+ */
1064
+ removeAllListeners(event) {
1065
+ if (event) {
1066
+ this.handlers.delete(event);
1067
+ } else {
1068
+ this.handlers.clear();
1069
+ }
1070
+ }
1071
+ /**
1072
+ * Get count of listeners for an event
1073
+ */
1074
+ listenerCount(event) {
1075
+ return this.handlers.get(event)?.size ?? 0;
1076
+ }
1077
+ };
1078
+ var createEventEmitter = () => {
1079
+ return new EventEmitter();
1080
+ };
1081
+ var appEvents = new EventEmitter();
1082
+
1083
+ // src/client/utils/api-urls.ts
1084
+ var ApiUrlBuilder = class {
1085
+ constructor(config) {
1086
+ this.baseUrl = config.baseUrl.replace(/\/$/, "");
1087
+ this.version = config.version || "";
1088
+ }
1089
+ /**
1090
+ * Build full URL from path
1091
+ */
1092
+ build(path2) {
1093
+ const normalizedPath = path2.startsWith("/") ? path2 : `/${path2}`;
1094
+ const versionPath = this.version ? `/${this.version}` : "";
1095
+ return `${this.baseUrl}${versionPath}${normalizedPath}`;
1096
+ }
1097
+ /**
1098
+ * Build URL with query parameters
1099
+ */
1100
+ buildWithParams(path2, params) {
1101
+ const url = this.build(path2);
1102
+ const filteredParams = Object.entries(params).filter(([, value]) => value !== void 0).map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`).join("&");
1103
+ return filteredParams ? `${url}?${filteredParams}` : url;
1104
+ }
1105
+ /**
1106
+ * Build URL with path parameters
1107
+ */
1108
+ buildWithPathParams(template, params) {
1109
+ let path2 = template;
1110
+ Object.entries(params).forEach(([key, value]) => {
1111
+ path2 = path2.replace(`:${key}`, String(value));
1112
+ path2 = path2.replace(`{${key}}`, String(value));
1113
+ });
1114
+ return this.build(path2);
1115
+ }
1116
+ /**
1117
+ * Get base URL
1118
+ */
1119
+ getBaseUrl() {
1120
+ return this.baseUrl;
1121
+ }
1122
+ /**
1123
+ * Set new base URL
1124
+ */
1125
+ setBaseUrl(baseUrl) {
1126
+ this.baseUrl = baseUrl.replace(/\/$/, "");
1127
+ }
1128
+ };
1129
+ var createApiUrlBuilder = (config) => {
1130
+ return new ApiUrlBuilder(config);
1131
+ };
1132
+ var createApiEndpoints = (builder) => ({
1133
+ // Auth endpoints
1134
+ auth: {
1135
+ login: () => builder.build("/auth/login"),
1136
+ register: () => builder.build("/auth/register"),
1137
+ logout: () => builder.build("/auth/logout"),
1138
+ refresh: () => builder.build("/auth/refresh"),
1139
+ me: () => builder.build("/auth/me"),
1140
+ forgotPassword: () => builder.build("/auth/forgot-password"),
1141
+ resetPassword: () => builder.build("/auth/reset-password")
1142
+ },
1143
+ // User endpoints
1144
+ users: {
1145
+ list: () => builder.build("/users"),
1146
+ get: (id) => builder.buildWithPathParams("/users/:id", { id }),
1147
+ create: () => builder.build("/users"),
1148
+ update: (id) => builder.buildWithPathParams("/users/:id", { id }),
1149
+ delete: (id) => builder.buildWithPathParams("/users/:id", { id })
1150
+ },
1151
+ // Generic CRUD factory
1152
+ crud: (resource) => ({
1153
+ list: () => builder.build(`/${resource}`),
1154
+ get: (id) => builder.buildWithPathParams(`/${resource}/:id`, { id }),
1155
+ create: () => builder.build(`/${resource}`),
1156
+ update: (id) => builder.buildWithPathParams(`/${resource}/:id`, { id }),
1157
+ delete: (id) => builder.buildWithPathParams(`/${resource}/:id`, { id })
1158
+ })
1159
+ });
1160
+
1161
+ // src/client/utils/response-parser.ts
1162
+ var isSuccessResponse = (response) => {
1163
+ return response.success === true;
1164
+ };
1165
+ var isErrorResponse = (response) => {
1166
+ return response.success === false;
1167
+ };
1168
+ var getResponseData = (response, defaultValue) => {
1169
+ if (isSuccessResponse(response) && response.data !== void 0) {
1170
+ return response.data;
1171
+ }
1172
+ return defaultValue;
1173
+ };
1174
+ var getErrorMessage = (response, defaultMessage = "An error occurred") => {
1175
+ if (response.error) {
1176
+ return response.error;
1177
+ }
1178
+ if (response.message) {
1179
+ return response.message;
1180
+ }
1181
+ return defaultMessage;
1182
+ };
1183
+ var hasData = (response) => {
1184
+ return response.data !== null && response.data !== void 0;
1185
+ };
1186
+ var hasMorePages = (response) => {
1187
+ return response.pagination.hasNextPage;
1188
+ };
1189
+ var getNextPage = (response) => {
1190
+ if (response.pagination.hasNextPage) {
1191
+ return response.pagination.page + 1;
1192
+ }
1193
+ return null;
1194
+ };
1195
+ var getPrevPage = (response) => {
1196
+ if (response.pagination.hasPrevPage) {
1197
+ return response.pagination.page - 1;
1198
+ }
1199
+ return null;
1200
+ };
1201
+ var createEmptyPaginationMeta = () => ({
1202
+ total: 0,
1203
+ page: 1,
1204
+ limit: 10,
1205
+ totalPages: 0,
1206
+ hasNextPage: false,
1207
+ hasPrevPage: false
1208
+ });
1209
+ var createSuccessResponse = (data, message = "Success") => ({
1210
+ success: true,
1211
+ message,
1212
+ data,
1213
+ statusCode: 200
1214
+ });
1215
+ var createErrorResponse = (message, statusCode2 = 400, error) => ({
1216
+ success: false,
1217
+ message,
1218
+ error,
1219
+ statusCode: statusCode2
1220
+ });
1221
+ function useLocalStorage(key, initialValue, options = {}) {
1222
+ const {
1223
+ serializer = JSON.stringify,
1224
+ deserializer = JSON.parse,
1225
+ syncTabs = true,
1226
+ debug = false
1227
+ } = options;
1228
+ const log = useCallback(
1229
+ (...args) => {
1230
+ if (debug) console.log(`[useLocalStorage:${key}]`, ...args);
1231
+ },
1232
+ [debug, key]
1233
+ );
1234
+ const readValue = useCallback(() => {
1235
+ if (typeof window === "undefined") {
1236
+ return initialValue;
1237
+ }
1238
+ try {
1239
+ const item = window.localStorage.getItem(key);
1240
+ if (item === null) {
1241
+ return initialValue;
1242
+ }
1243
+ const parsed = deserializer(item);
1244
+ log("Read value:", parsed);
1245
+ return parsed;
1246
+ } catch (error) {
1247
+ console.warn(`Error reading localStorage key "${key}":`, error);
1248
+ return initialValue;
1249
+ }
1250
+ }, [key, initialValue, deserializer, log]);
1251
+ const [storedValue, setStoredValue] = useState(readValue);
1252
+ const setValue = useCallback(
1253
+ (value) => {
1254
+ if (typeof window === "undefined") {
1255
+ console.warn(`Cannot set localStorage key "${key}" in non-browser environment`);
1256
+ return;
1257
+ }
1258
+ try {
1259
+ const valueToStore = value instanceof Function ? value(storedValue) : value;
1260
+ setStoredValue(valueToStore);
1261
+ window.localStorage.setItem(key, serializer(valueToStore));
1262
+ log("Set value:", valueToStore);
1263
+ window.dispatchEvent(new StorageEvent("storage", { key, newValue: serializer(valueToStore) }));
1264
+ } catch (error) {
1265
+ console.warn(`Error setting localStorage key "${key}":`, error);
1266
+ }
1267
+ },
1268
+ [key, storedValue, serializer, log]
1269
+ );
1270
+ const removeValue = useCallback(() => {
1271
+ if (typeof window === "undefined") {
1272
+ return;
1273
+ }
1274
+ try {
1275
+ window.localStorage.removeItem(key);
1276
+ setStoredValue(initialValue);
1277
+ log("Removed value");
1278
+ window.dispatchEvent(new StorageEvent("storage", { key, newValue: null }));
1279
+ } catch (error) {
1280
+ console.warn(`Error removing localStorage key "${key}":`, error);
1281
+ }
1282
+ }, [key, initialValue, log]);
1283
+ useEffect(() => {
1284
+ if (!syncTabs || typeof window === "undefined") {
1285
+ return;
1286
+ }
1287
+ const handleStorageChange = (event) => {
1288
+ if (event.key !== key) {
1289
+ return;
1290
+ }
1291
+ log("Storage event received:", event.newValue);
1292
+ if (event.newValue === null) {
1293
+ setStoredValue(initialValue);
1294
+ } else {
1295
+ try {
1296
+ setStoredValue(deserializer(event.newValue));
1297
+ } catch {
1298
+ console.warn(`Error parsing localStorage change for key "${key}"`);
1299
+ }
1300
+ }
1301
+ };
1302
+ window.addEventListener("storage", handleStorageChange);
1303
+ return () => window.removeEventListener("storage", handleStorageChange);
1304
+ }, [key, initialValue, syncTabs, deserializer, log]);
1305
+ return [storedValue, setValue, removeValue];
1306
+ }
1307
+ var useLocalStorage_default = useLocalStorage;
1308
+ function useDebounce(value, delay = 500) {
1309
+ const [debouncedValue, setDebouncedValue] = useState(value);
1310
+ useEffect(() => {
1311
+ const timer = setTimeout(() => {
1312
+ setDebouncedValue(value);
1313
+ }, delay);
1314
+ return () => {
1315
+ clearTimeout(timer);
1316
+ };
1317
+ }, [value, delay]);
1318
+ return debouncedValue;
1319
+ }
1320
+ var useDebounce_default = useDebounce;
1321
+ function useCopyToClipboard(resetDelay = 2e3) {
1322
+ const [copied, setCopied] = useState(false);
1323
+ const [error, setError] = useState(null);
1324
+ const reset = useCallback(() => {
1325
+ setCopied(false);
1326
+ setError(null);
1327
+ }, []);
1328
+ const copy = useCallback(
1329
+ async (text) => {
1330
+ if (!navigator?.clipboard) {
1331
+ try {
1332
+ const textarea = document.createElement("textarea");
1333
+ textarea.value = text;
1334
+ textarea.style.position = "fixed";
1335
+ textarea.style.left = "-999999px";
1336
+ textarea.style.top = "-999999px";
1337
+ document.body.appendChild(textarea);
1338
+ textarea.focus();
1339
+ textarea.select();
1340
+ const successful = document.execCommand("copy");
1341
+ document.body.removeChild(textarea);
1342
+ if (successful) {
1343
+ setCopied(true);
1344
+ setError(null);
1345
+ setTimeout(reset, resetDelay);
1346
+ return true;
1347
+ } else {
1348
+ throw new Error("execCommand failed");
1349
+ }
1350
+ } catch (err) {
1351
+ const message = err instanceof Error ? err.message : "Failed to copy to clipboard";
1352
+ setError(message);
1353
+ setCopied(false);
1354
+ return false;
1355
+ }
1356
+ }
1357
+ try {
1358
+ await navigator.clipboard.writeText(text);
1359
+ setCopied(true);
1360
+ setError(null);
1361
+ setTimeout(reset, resetDelay);
1362
+ return true;
1363
+ } catch (err) {
1364
+ const message = err instanceof Error ? err.message : "Failed to copy to clipboard";
1365
+ setError(message);
1366
+ setCopied(false);
1367
+ return false;
1368
+ }
1369
+ },
1370
+ [resetDelay, reset]
1371
+ );
1372
+ return { copy, copied, error, reset };
1373
+ }
1374
+ var useCopyToClipboard_default = useCopyToClipboard;
1375
+ function usePageTitle(title, options = {}) {
1376
+ const { suffix, separator = " | ", restoreOnUnmount = true } = options;
1377
+ useEffect(() => {
1378
+ const originalTitle = document.title;
1379
+ const newTitle = suffix ? `${title}${separator}${suffix}` : title;
1380
+ document.title = newTitle;
1381
+ return () => {
1382
+ if (restoreOnUnmount) {
1383
+ document.title = originalTitle;
1384
+ }
1385
+ };
1386
+ }, [title, suffix, separator, restoreOnUnmount]);
1387
+ }
1388
+ var usePageTitle_default = usePageTitle;
1389
+ function useInterval(callback, delay) {
1390
+ const savedCallback = useRef(callback);
1391
+ useEffect(() => {
1392
+ savedCallback.current = callback;
1393
+ }, [callback]);
1394
+ useEffect(() => {
1395
+ if (delay === null) {
1396
+ return;
1397
+ }
1398
+ const tick = () => savedCallback.current();
1399
+ const id = setInterval(tick, delay);
1400
+ return () => clearInterval(id);
1401
+ }, [delay]);
1402
+ }
1403
+ var useInterval_default = useInterval;
1404
+ function useThemeDetector() {
1405
+ const getCurrentTheme = () => {
1406
+ if (typeof window === "undefined") return "light";
1407
+ return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
1408
+ };
1409
+ const [theme, setTheme] = useState(getCurrentTheme);
1410
+ useEffect(() => {
1411
+ if (typeof window === "undefined") return;
1412
+ const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
1413
+ const handleChange = (e) => {
1414
+ setTheme(e.matches ? "dark" : "light");
1415
+ };
1416
+ mediaQuery.addEventListener("change", handleChange);
1417
+ return () => mediaQuery.removeEventListener("change", handleChange);
1418
+ }, []);
1419
+ return theme;
1420
+ }
1421
+ var useThemeDetector_default = useThemeDetector;
1422
+ var DEFAULT_DURATION = 4e3;
1423
+ function useSnackbar(defaultDuration = DEFAULT_DURATION) {
1424
+ const [state, setState] = useState({
1425
+ open: false,
1426
+ message: "",
1427
+ severity: "info",
1428
+ autoHideDuration: defaultDuration
1429
+ });
1430
+ const show = useCallback(
1431
+ (message, severity = "info", duration) => {
1432
+ setState({
1433
+ open: true,
1434
+ message,
1435
+ severity,
1436
+ autoHideDuration: duration ?? defaultDuration
1437
+ });
1438
+ },
1439
+ [defaultDuration]
1440
+ );
1441
+ const success = useCallback(
1442
+ (message, duration) => show(message, "success", duration),
1443
+ [show]
1444
+ );
1445
+ const error = useCallback(
1446
+ (message, duration) => show(message, "error", duration),
1447
+ [show]
1448
+ );
1449
+ const warning = useCallback(
1450
+ (message, duration) => show(message, "warning", duration),
1451
+ [show]
1452
+ );
1453
+ const info = useCallback(
1454
+ (message, duration) => show(message, "info", duration),
1455
+ [show]
1456
+ );
1457
+ const close = useCallback(() => {
1458
+ setState((prev) => ({ ...prev, open: false }));
1459
+ }, []);
1460
+ return { state, show, success, error, warning, info, close };
1461
+ }
1462
+ var useSnackbar_default = useSnackbar;
1463
+ function useMediaQuery(query) {
1464
+ const getMatches = (query2) => {
1465
+ if (typeof window === "undefined") return false;
1466
+ return window.matchMedia(query2).matches;
1467
+ };
1468
+ const [matches, setMatches] = useState(getMatches(query));
1469
+ useEffect(() => {
1470
+ if (typeof window === "undefined") return;
1471
+ const mediaQuery = window.matchMedia(query);
1472
+ const handleChange = () => setMatches(mediaQuery.matches);
1473
+ handleChange();
1474
+ mediaQuery.addEventListener("change", handleChange);
1475
+ return () => mediaQuery.removeEventListener("change", handleChange);
1476
+ }, [query]);
1477
+ return matches;
1478
+ }
1479
+ var useIsMobile = () => useMediaQuery("(max-width: 767px)");
1480
+ var useIsTablet = () => useMediaQuery("(min-width: 768px) and (max-width: 1023px)");
1481
+ var useIsDesktop = () => useMediaQuery("(min-width: 1024px)");
1482
+ var useIsMobileOrTablet = () => useMediaQuery("(max-width: 1023px)");
1483
+ var useMediaQuery_default = useMediaQuery;
1484
+ function useOnClickOutside(ref, handler, enabled = true) {
1485
+ useEffect(() => {
1486
+ if (!enabled) return;
1487
+ const listener = (event) => {
1488
+ const el = ref?.current;
1489
+ if (!el || el.contains(event.target)) {
1490
+ return;
1491
+ }
1492
+ handler(event);
1493
+ };
1494
+ document.addEventListener("mousedown", listener);
1495
+ document.addEventListener("touchstart", listener);
1496
+ return () => {
1497
+ document.removeEventListener("mousedown", listener);
1498
+ document.removeEventListener("touchstart", listener);
1499
+ };
1500
+ }, [ref, handler, enabled]);
1501
+ }
1502
+ var useOnClickOutside_default = useOnClickOutside;
1503
+ function useWindowSize(debounceMs = 100) {
1504
+ const getSize = () => ({
1505
+ width: typeof window !== "undefined" ? window.innerWidth : 0,
1506
+ height: typeof window !== "undefined" ? window.innerHeight : 0
1507
+ });
1508
+ const [windowSize, setWindowSize] = useState(getSize);
1509
+ useEffect(() => {
1510
+ if (typeof window === "undefined") return;
1511
+ let timeoutId;
1512
+ const handleResize = () => {
1513
+ clearTimeout(timeoutId);
1514
+ timeoutId = setTimeout(() => {
1515
+ setWindowSize(getSize());
1516
+ }, debounceMs);
1517
+ };
1518
+ setWindowSize(getSize());
1519
+ window.addEventListener("resize", handleResize);
1520
+ return () => {
1521
+ clearTimeout(timeoutId);
1522
+ window.removeEventListener("resize", handleResize);
1523
+ };
1524
+ }, [debounceMs]);
1525
+ return windowSize;
1526
+ }
1527
+ var useWindowSize_default = useWindowSize;
1528
+
1529
+ // src/shared/index.ts
1530
+ var shared_exports = {};
1531
+ __export(shared_exports, {
1532
+ DATE_FORMATS: () => DATE_FORMATS,
1533
+ HTTP_STATUS: () => HTTP_STATUS,
1534
+ HTTP_STATUS_MESSAGES: () => HTTP_STATUS_MESSAGES,
1535
+ PAGINATION: () => PAGINATION,
1536
+ ROLES: () => ROLES,
1537
+ STATUS: () => STATUS,
1538
+ TOKEN_TYPES: () => TOKEN_TYPES,
1539
+ USER_STATUS: () => USER_STATUS,
1540
+ VALIDATION_MESSAGES: () => VALIDATION_MESSAGES,
1541
+ VALIDATION_PATTERNS: () => VALIDATION_PATTERNS,
1542
+ VALIDATION_RULES: () => VALIDATION_RULES,
1543
+ addDays: () => addDays$1,
1544
+ addHours: () => addHours,
1545
+ addMinutes: () => addMinutes,
1546
+ addMonths: () => addMonths,
1547
+ addTime: () => addTime,
1548
+ addWeeks: () => addWeeks,
1549
+ addYears: () => addYears,
1550
+ combineDateAndTime: () => combineDateAndTime,
1551
+ dateTime: () => date_time_default,
1552
+ daysSince: () => daysSince,
1553
+ daysUntil: () => daysUntil,
1554
+ differenceInDays: () => differenceInDays,
1555
+ differenceInHours: () => differenceInHours,
1556
+ differenceInMinutes: () => differenceInMinutes,
1557
+ differenceInMonths: () => differenceInMonths,
1558
+ differenceInSeconds: () => differenceInSeconds,
1559
+ differenceInWeeks: () => differenceInWeeks,
1560
+ differenceInYears: () => differenceInYears,
1561
+ doDateRangesOverlap: () => doDateRangesOverlap,
1562
+ eachDayOfInterval: () => eachDayOfInterval,
1563
+ eachMonthOfInterval: () => eachMonthOfInterval,
1564
+ eachWeekOfInterval: () => eachWeekOfInterval,
1565
+ endOfDay: () => endOfDay$1,
1566
+ endOfMonth: () => endOfMonth,
1567
+ endOfWeek: () => endOfWeek,
1568
+ endOfYear: () => endOfYear,
1569
+ format: () => format,
1570
+ formatDate: () => formatDate2,
1571
+ formatDateInTimezone: () => formatDateInTimezone,
1572
+ formatDateRange: () => formatDateRange,
1573
+ formatDateTime: () => formatDateTime2,
1574
+ formatDistance: () => formatDistance,
1575
+ formatDistanceToNow: () => formatDistanceToNow,
1576
+ formatDuration: () => formatDuration,
1577
+ formatInTimeZone: () => formatInTimeZone,
1578
+ formatRelative: () => formatRelative,
1579
+ formatRelativeTime: () => formatRelativeTime2,
1580
+ formatSmartDate: () => formatSmartDate,
1581
+ fromTimezone: () => fromTimezone,
1582
+ fromZonedTime: () => fromZonedTime,
1583
+ getAge: () => getAge,
1584
+ getDate: () => getDate,
1585
+ getDateDifference: () => getDateDifference,
1586
+ getDay: () => getDay,
1587
+ getDayBoundaries: () => getDayBoundaries,
1588
+ getDaysInRange: () => getDaysInRange,
1589
+ getEnv: () => getEnv,
1590
+ getEnvOptional: () => getEnvOptional,
1591
+ getHours: () => getHours,
1592
+ getMinutes: () => getMinutes,
1593
+ getMonth: () => getMonth,
1594
+ getMonthBoundaries: () => getMonthBoundaries,
1595
+ getMonthsInRange: () => getMonthsInRange,
1596
+ getSeconds: () => getSeconds,
1597
+ getTimezoneDifference: () => getTimezoneDifference,
1598
+ getWeekBoundaries: () => getWeekBoundaries,
1599
+ getWeeksInRange: () => getWeeksInRange,
1600
+ getYear: () => getYear,
1601
+ getYearBoundaries: () => getYearBoundaries,
1602
+ intervalToDuration: () => intervalToDuration,
1603
+ isAfter: () => isAfter,
1604
+ isBefore: () => isBefore,
1605
+ isDateBetween: () => isDateBetween,
1606
+ isDev: () => isDev,
1607
+ isEqual: () => isEqual,
1608
+ isFuture: () => isFuture$1,
1609
+ isPast: () => isPast$1,
1610
+ isProd: () => isProd,
1611
+ isSameDay: () => isSameDay,
1612
+ isSameMonth: () => isSameMonth,
1613
+ isSameWeek: () => isSameWeek,
1614
+ isSameYear: () => isSameYear,
1615
+ isTest: () => isTest,
1616
+ isThisMonth: () => isThisMonth,
1617
+ isThisWeek: () => isThisWeek,
1618
+ isThisYear: () => isThisYear,
1619
+ isToday: () => isToday$1,
1620
+ isTomorrow: () => isTomorrow,
1621
+ isValid: () => isValid,
1622
+ isValidDate: () => isValidDate,
1623
+ isValidEmail: () => isValidEmail,
1624
+ isValidPassword: () => isValidPassword,
1625
+ isValidPhone: () => isValidPhone,
1626
+ isValidSlug: () => isValidSlug,
1627
+ isValidUrl: () => isValidUrl,
1628
+ isValidUsername: () => isValidUsername,
1629
+ isWeekday: () => isWeekday,
1630
+ isWeekend: () => isWeekend,
1631
+ isYesterday: () => isYesterday,
1632
+ nowInTimezone: () => nowInTimezone,
1633
+ parseDate: () => parseDate,
1634
+ parseISO: () => parseISO,
1635
+ setHours: () => setHours,
1636
+ setMinutes: () => setMinutes,
1637
+ setSeconds: () => setSeconds,
1638
+ setTime: () => setTime,
1639
+ startOfDay: () => startOfDay$1,
1640
+ startOfMonth: () => startOfMonth,
1641
+ startOfWeek: () => startOfWeek,
1642
+ startOfYear: () => startOfYear,
1643
+ subDays: () => subDays,
1644
+ subHours: () => subHours,
1645
+ subMinutes: () => subMinutes,
1646
+ subMonths: () => subMonths,
1647
+ subWeeks: () => subWeeks,
1648
+ subYears: () => subYears,
1649
+ subtractTime: () => subtractTime,
1650
+ toDateInputValue: () => toDateInputValue,
1651
+ toDateTimeInputValue: () => toDateTimeInputValue,
1652
+ toTimeInputValue: () => toTimeInputValue,
1653
+ toTimezone: () => toTimezone,
1654
+ toZonedTime: () => toZonedTime,
1655
+ validateEnv: () => validateEnv
1656
+ });
1657
+
1658
+ // src/shared/config/env.ts
1659
+ var getEnv = (key, defaultValue) => {
1660
+ const value = process.env[key];
1661
+ if (value === void 0) {
1662
+ if (defaultValue !== void 0) {
1663
+ return defaultValue;
1664
+ }
1665
+ throw new Error(`Environment variable ${key} is required but not defined`);
1666
+ }
1667
+ if (typeof defaultValue === "number") {
1668
+ return Number(value);
1669
+ }
1670
+ if (typeof defaultValue === "boolean") {
1671
+ return value === "true" || value === "1";
1672
+ }
1673
+ return value;
1674
+ };
1675
+ var getEnvOptional = (key, defaultValue) => {
1676
+ const value = process.env[key];
1677
+ if (value === void 0) {
1678
+ return defaultValue;
1679
+ }
1680
+ if (typeof defaultValue === "number") {
1681
+ return Number(value);
1682
+ }
1683
+ if (typeof defaultValue === "boolean") {
1684
+ return value === "true" || value === "1";
1685
+ }
1686
+ return value;
1687
+ };
1688
+ var isProd = () => {
1689
+ return process.env.NODE_ENV === "production";
1690
+ };
1691
+ var isDev = () => {
1692
+ return process.env.NODE_ENV === "development";
1693
+ };
1694
+ var isTest = () => {
1695
+ return process.env.NODE_ENV === "test";
1696
+ };
1697
+ var validateEnv = (requiredVars) => {
1698
+ const missing = requiredVars.filter((key) => !process.env[key]);
1699
+ if (missing.length > 0) {
1700
+ throw new Error(
1701
+ `Missing required environment variables: ${missing.join(", ")}`
1702
+ );
1703
+ }
1704
+ };
1705
+
1706
+ // src/shared/constants/status-codes.ts
1707
+ var HTTP_STATUS = {
1708
+ // Success
1709
+ OK: 200,
1710
+ CREATED: 201,
1711
+ ACCEPTED: 202,
1712
+ NO_CONTENT: 204,
1713
+ // Redirection
1714
+ MOVED_PERMANENTLY: 301,
1715
+ FOUND: 302,
1716
+ NOT_MODIFIED: 304,
1717
+ TEMPORARY_REDIRECT: 307,
1718
+ PERMANENT_REDIRECT: 308,
1719
+ // Client Errors
1720
+ BAD_REQUEST: 400,
1721
+ UNAUTHORIZED: 401,
1722
+ FORBIDDEN: 403,
1723
+ NOT_FOUND: 404,
1724
+ METHOD_NOT_ALLOWED: 405,
1725
+ CONFLICT: 409,
1726
+ GONE: 410,
1727
+ UNPROCESSABLE_ENTITY: 422,
1728
+ TOO_MANY_REQUESTS: 429,
1729
+ // Server Errors
1730
+ INTERNAL_SERVER_ERROR: 500,
1731
+ NOT_IMPLEMENTED: 501,
1732
+ BAD_GATEWAY: 502,
1733
+ SERVICE_UNAVAILABLE: 503,
1734
+ GATEWAY_TIMEOUT: 504
1735
+ };
1736
+ var HTTP_STATUS_MESSAGES = {
1737
+ [HTTP_STATUS.OK]: "OK",
1738
+ [HTTP_STATUS.CREATED]: "Created",
1739
+ [HTTP_STATUS.ACCEPTED]: "Accepted",
1740
+ [HTTP_STATUS.NO_CONTENT]: "No Content",
1741
+ [HTTP_STATUS.BAD_REQUEST]: "Bad Request",
1742
+ [HTTP_STATUS.UNAUTHORIZED]: "Unauthorized",
1743
+ [HTTP_STATUS.FORBIDDEN]: "Forbidden",
1744
+ [HTTP_STATUS.NOT_FOUND]: "Not Found",
1745
+ [HTTP_STATUS.METHOD_NOT_ALLOWED]: "Method Not Allowed",
1746
+ [HTTP_STATUS.CONFLICT]: "Conflict",
1747
+ [HTTP_STATUS.UNPROCESSABLE_ENTITY]: "Unprocessable Entity",
1748
+ [HTTP_STATUS.TOO_MANY_REQUESTS]: "Too Many Requests",
1749
+ [HTTP_STATUS.INTERNAL_SERVER_ERROR]: "Internal Server Error",
1750
+ [HTTP_STATUS.SERVICE_UNAVAILABLE]: "Service Unavailable"
1751
+ };
1752
+ var STATUS = {
1753
+ ACTIVE: "active",
1754
+ INACTIVE: "inactive",
1755
+ PENDING: "pending",
1756
+ APPROVED: "approved",
1757
+ REJECTED: "rejected",
1758
+ DELETED: "deleted",
1759
+ ARCHIVED: "archived",
1760
+ DRAFT: "draft",
1761
+ PUBLISHED: "published",
1762
+ SUSPENDED: "suspended"
1763
+ };
1764
+ var USER_STATUS = {
1765
+ ACTIVE: "active",
1766
+ INACTIVE: "inactive",
1767
+ PENDING: "pending",
1768
+ SUSPENDED: "suspended",
1769
+ BANNED: "banned"
1770
+ };
1771
+ var ROLES = {
1772
+ ADMIN: "admin",
1773
+ USER: "user",
1774
+ MODERATOR: "moderator",
1775
+ GUEST: "guest",
1776
+ SUPER_ADMIN: "super_admin"
1777
+ };
1778
+ var PAGINATION = {
1779
+ DEFAULT_PAGE: 1,
1780
+ DEFAULT_LIMIT: 10,
1781
+ MAX_LIMIT: 100
1782
+ };
1783
+ var TOKEN_TYPES = {
1784
+ ACCESS: "access",
1785
+ REFRESH: "refresh",
1786
+ RESET_PASSWORD: "reset_password",
1787
+ EMAIL_VERIFICATION: "email_verification"
1788
+ };
1789
+ var parseDate = (date) => {
1790
+ if (date instanceof Date) return date;
1791
+ if (typeof date === "string") return parseISO(date);
1792
+ return new Date(date);
1793
+ };
1794
+ var isValidDate = (date) => {
1795
+ const parsed = parseDate(date);
1796
+ return isValid(parsed);
1797
+ };
1798
+ var DATE_FORMATS = {
1799
+ // Date only
1800
+ DATE_SHORT: "MM/dd/yyyy",
1801
+ // 01/15/2026
1802
+ DATE_MEDIUM: "MMM d, yyyy",
1803
+ // Jan 15, 2026
1804
+ DATE_LONG: "MMMM d, yyyy",
1805
+ // January 15, 2026
1806
+ DATE_FULL: "EEEE, MMMM d, yyyy",
1807
+ // Friday, January 15, 2026
1808
+ DATE_ISO: "yyyy-MM-dd",
1809
+ // 2026-01-15
1810
+ // Time only
1811
+ TIME_SHORT: "h:mm a",
1812
+ // 3:30 PM
1813
+ TIME_MEDIUM: "h:mm:ss a",
1814
+ // 3:30:45 PM
1815
+ TIME_24H: "HH:mm",
1816
+ // 15:30
1817
+ TIME_24H_FULL: "HH:mm:ss",
1818
+ // 15:30:45
1819
+ // Date and time
1820
+ DATETIME_SHORT: "MM/dd/yyyy h:mm a",
1821
+ // 01/15/2026 3:30 PM
1822
+ DATETIME_MEDIUM: "MMM d, yyyy h:mm a",
1823
+ // Jan 15, 2026 3:30 PM
1824
+ DATETIME_LONG: "MMMM d, yyyy h:mm a",
1825
+ // January 15, 2026 3:30 PM
1826
+ DATETIME_FULL: "EEEE, MMMM d, yyyy h:mm a",
1827
+ // Friday, January 15, 2026 3:30 PM
1828
+ DATETIME_ISO: "yyyy-MM-dd'T'HH:mm:ss",
1829
+ // 2026-01-15T15:30:45
1830
+ // Special formats
1831
+ MONTH_YEAR: "MMMM yyyy",
1832
+ // January 2026
1833
+ MONTH_DAY: "MMM d",
1834
+ // Jan 15
1835
+ DAY_MONTH: "d MMM",
1836
+ // 15 Jan
1837
+ WEEKDAY: "EEEE",
1838
+ // Friday
1839
+ WEEKDAY_SHORT: "EEE"
1840
+ // Fri
1841
+ };
1842
+ var formatDate2 = (date, formatStr = DATE_FORMATS.DATE_MEDIUM) => {
1843
+ return format(parseDate(date), formatStr);
1844
+ };
1845
+ var formatDateTime2 = (date, formatStr = DATE_FORMATS.DATETIME_MEDIUM) => {
1846
+ return format(parseDate(date), formatStr);
1847
+ };
1848
+ var formatDateInTimezone = (date, timezone, formatStr = DATE_FORMATS.DATETIME_MEDIUM) => {
1849
+ return formatInTimeZone(parseDate(date), timezone, formatStr);
1850
+ };
1851
+ var formatRelativeTime2 = (date, baseDate) => {
1852
+ const parsed = parseDate(date);
1853
+ if (baseDate) {
1854
+ return formatDistance(parsed, parseDate(baseDate), { addSuffix: true });
1855
+ }
1856
+ return formatDistanceToNow(parsed, { addSuffix: true });
1857
+ };
1858
+ var formatSmartDate = (date) => {
1859
+ const parsed = parseDate(date);
1860
+ if (isToday$1(parsed)) {
1861
+ return `Today at ${format(parsed, DATE_FORMATS.TIME_SHORT)}`;
1862
+ }
1863
+ if (isYesterday(parsed)) {
1864
+ return `Yesterday at ${format(parsed, DATE_FORMATS.TIME_SHORT)}`;
1865
+ }
1866
+ if (isTomorrow(parsed)) {
1867
+ return `Tomorrow at ${format(parsed, DATE_FORMATS.TIME_SHORT)}`;
1868
+ }
1869
+ if (isThisWeek(parsed)) {
1870
+ return format(parsed, "EEEE 'at' h:mm a");
1871
+ }
1872
+ if (isThisYear(parsed)) {
1873
+ return format(parsed, "MMM d 'at' h:mm a");
1874
+ }
1875
+ return format(parsed, DATE_FORMATS.DATETIME_MEDIUM);
1876
+ };
1877
+ var formatDateRange = (start, end) => {
1878
+ const duration = intervalToDuration({
1879
+ start: parseDate(start),
1880
+ end: parseDate(end)
1881
+ });
1882
+ return formatDuration(duration, {
1883
+ format: ["years", "months", "days", "hours", "minutes"]
1884
+ });
1885
+ };
1886
+ var toTimezone = (date, timezone) => {
1887
+ return toZonedTime(parseDate(date), timezone);
1888
+ };
1889
+ var fromTimezone = (date, timezone) => {
1890
+ return fromZonedTime(parseDate(date), timezone);
1891
+ };
1892
+ var nowInTimezone = (timezone) => {
1893
+ return toZonedTime(/* @__PURE__ */ new Date(), timezone);
1894
+ };
1895
+ var getTimezoneDifference = (timezone1, timezone2) => {
1896
+ const now = /* @__PURE__ */ new Date();
1897
+ const time1 = toZonedTime(now, timezone1);
1898
+ const time2 = toZonedTime(now, timezone2);
1899
+ const diffMinutes = differenceInMinutes(time1, time2);
1900
+ const hours = Math.floor(Math.abs(diffMinutes) / 60);
1901
+ const minutes = Math.abs(diffMinutes) % 60;
1902
+ const sign = diffMinutes >= 0 ? "+" : "-";
1903
+ if (minutes === 0) {
1904
+ return `${sign}${hours}h`;
1905
+ }
1906
+ return `${sign}${hours}h ${minutes}m`;
1907
+ };
1908
+ var addTime = (date, amount, unit) => {
1909
+ const parsed = parseDate(date);
1910
+ switch (unit) {
1911
+ case "minutes":
1912
+ return addMinutes(parsed, amount);
1913
+ case "hours":
1914
+ return addHours(parsed, amount);
1915
+ case "days":
1916
+ return addDays$1(parsed, amount);
1917
+ case "weeks":
1918
+ return addWeeks(parsed, amount);
1919
+ case "months":
1920
+ return addMonths(parsed, amount);
1921
+ case "years":
1922
+ return addYears(parsed, amount);
1923
+ }
1924
+ };
1925
+ var subtractTime = (date, amount, unit) => {
1926
+ const parsed = parseDate(date);
1927
+ switch (unit) {
1928
+ case "minutes":
1929
+ return subMinutes(parsed, amount);
1930
+ case "hours":
1931
+ return subHours(parsed, amount);
1932
+ case "days":
1933
+ return subDays(parsed, amount);
1934
+ case "weeks":
1935
+ return subWeeks(parsed, amount);
1936
+ case "months":
1937
+ return subMonths(parsed, amount);
1938
+ case "years":
1939
+ return subYears(parsed, amount);
1940
+ }
1941
+ };
1942
+ var getDateDifference = (date1, date2, unit) => {
1943
+ const d1 = parseDate(date1);
1944
+ const d2 = parseDate(date2);
1945
+ switch (unit) {
1946
+ case "seconds":
1947
+ return differenceInSeconds(d1, d2);
1948
+ case "minutes":
1949
+ return differenceInMinutes(d1, d2);
1950
+ case "hours":
1951
+ return differenceInHours(d1, d2);
1952
+ case "days":
1953
+ return differenceInDays(d1, d2);
1954
+ case "weeks":
1955
+ return differenceInWeeks(d1, d2);
1956
+ case "months":
1957
+ return differenceInMonths(d1, d2);
1958
+ case "years":
1959
+ return differenceInYears(d1, d2);
1960
+ }
1961
+ };
1962
+ var getDaysInRange = (start, end) => {
1963
+ return eachDayOfInterval({
1964
+ start: parseDate(start),
1965
+ end: parseDate(end)
1966
+ });
1967
+ };
1968
+ var getWeeksInRange = (start, end) => {
1969
+ return eachWeekOfInterval({
1970
+ start: parseDate(start),
1971
+ end: parseDate(end)
1972
+ });
1973
+ };
1974
+ var getMonthsInRange = (start, end) => {
1975
+ return eachMonthOfInterval({
1976
+ start: parseDate(start),
1977
+ end: parseDate(end)
1978
+ });
1979
+ };
1980
+ var getDayBoundaries = (date) => {
1981
+ const parsed = parseDate(date);
1982
+ return {
1983
+ start: startOfDay$1(parsed),
1984
+ end: endOfDay$1(parsed)
1985
+ };
1986
+ };
1987
+ var getWeekBoundaries = (date, weekStartsOn = 0) => {
1988
+ const parsed = parseDate(date);
1989
+ return {
1990
+ start: startOfWeek(parsed, { weekStartsOn }),
1991
+ end: endOfWeek(parsed, { weekStartsOn })
1992
+ };
1993
+ };
1994
+ var getMonthBoundaries = (date) => {
1995
+ const parsed = parseDate(date);
1996
+ return {
1997
+ start: startOfMonth(parsed),
1998
+ end: endOfMonth(parsed)
1999
+ };
2000
+ };
2001
+ var getYearBoundaries = (date) => {
2002
+ const parsed = parseDate(date);
2003
+ return {
2004
+ start: startOfYear(parsed),
2005
+ end: endOfYear(parsed)
2006
+ };
2007
+ };
2008
+ var isDateBetween = (date, start, end) => {
2009
+ const d = parseDate(date);
2010
+ const s = parseDate(start);
2011
+ const e = parseDate(end);
2012
+ return (isAfter(d, s) || isEqual(d, s)) && (isBefore(d, e) || isEqual(d, e));
2013
+ };
2014
+ var doDateRangesOverlap = (range1Start, range1End, range2Start, range2End) => {
2015
+ const r1s = parseDate(range1Start);
2016
+ const r1e = parseDate(range1End);
2017
+ const r2s = parseDate(range2Start);
2018
+ const r2e = parseDate(range2End);
2019
+ return isBefore(r1s, r2e) && isAfter(r1e, r2s);
2020
+ };
2021
+ var getAge = (birthDate) => {
2022
+ return differenceInYears(/* @__PURE__ */ new Date(), parseDate(birthDate));
2023
+ };
2024
+ var isWeekend = (date) => {
2025
+ const day = getDay(parseDate(date));
2026
+ return day === 0 || day === 6;
2027
+ };
2028
+ var isWeekday = (date) => {
2029
+ return !isWeekend(date);
2030
+ };
2031
+ var daysUntil = (date) => {
2032
+ return differenceInDays(parseDate(date), /* @__PURE__ */ new Date());
2033
+ };
2034
+ var daysSince = (date) => {
2035
+ return differenceInDays(/* @__PURE__ */ new Date(), parseDate(date));
2036
+ };
2037
+ var toDateInputValue = (date) => {
2038
+ return format(parseDate(date), DATE_FORMATS.DATE_ISO);
2039
+ };
2040
+ var toDateTimeInputValue = (date) => {
2041
+ return format(parseDate(date), "yyyy-MM-dd'T'HH:mm");
2042
+ };
2043
+ var toTimeInputValue = (date) => {
2044
+ return format(parseDate(date), DATE_FORMATS.TIME_24H);
2045
+ };
2046
+ var setTime = (date, hours, minutes, seconds = 0) => {
2047
+ let result = parseDate(date);
2048
+ result = setHours(result, hours);
2049
+ result = setMinutes(result, minutes);
2050
+ result = setSeconds(result, seconds);
2051
+ return result;
2052
+ };
2053
+ var combineDateAndTime = (dateInput, timeInput) => {
2054
+ const date = parseDate(dateInput);
2055
+ const time = parseDate(timeInput);
2056
+ return setTime(date, getHours(time), getMinutes(time), getSeconds(time));
2057
+ };
2058
+ var date_time_default = {
2059
+ // Core
2060
+ parseDate,
2061
+ isValidDate,
2062
+ DATE_FORMATS,
2063
+ // Format
2064
+ formatDate: formatDate2,
2065
+ formatDateTime: formatDateTime2,
2066
+ formatDateInTimezone,
2067
+ formatRelativeTime: formatRelativeTime2,
2068
+ formatSmartDate,
2069
+ formatDateRange,
2070
+ // Timezone
2071
+ toTimezone,
2072
+ fromTimezone,
2073
+ nowInTimezone,
2074
+ getTimezoneDifference,
2075
+ // Arithmetic
2076
+ addTime,
2077
+ subtractTime,
2078
+ getDateDifference,
2079
+ // Ranges
2080
+ getDaysInRange,
2081
+ getWeeksInRange,
2082
+ getMonthsInRange,
2083
+ // Boundaries
2084
+ getDayBoundaries,
2085
+ getWeekBoundaries,
2086
+ getMonthBoundaries,
2087
+ getYearBoundaries,
2088
+ // Comparison
2089
+ isDateBetween,
2090
+ doDateRangesOverlap,
2091
+ // Utilities
2092
+ getAge,
2093
+ isWeekend,
2094
+ isWeekday,
2095
+ daysUntil,
2096
+ daysSince,
2097
+ toDateInputValue,
2098
+ toDateTimeInputValue,
2099
+ toTimeInputValue,
2100
+ setTime,
2101
+ combineDateAndTime
2102
+ };
2103
+
2104
+ // src/shared/validation/index.ts
2105
+ var VALIDATION_PATTERNS = {
2106
+ /** Email pattern (RFC 5322 simplified) */
2107
+ EMAIL: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
2108
+ /** Strong password: min 8 chars, uppercase, lowercase, number, special char */
2109
+ PASSWORD_STRONG: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/,
2110
+ /** Medium password: min 8 chars, uppercase, lowercase, number */
2111
+ PASSWORD_MEDIUM: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[A-Za-z\d@$!%*?&]{8,}$/,
2112
+ /** Basic password: min 8 chars */
2113
+ PASSWORD_BASIC: /^.{8,}$/,
2114
+ /** Phone number (international) */
2115
+ PHONE_INTERNATIONAL: /^\+?[\d\s\-().]{10,}$/,
2116
+ /** Phone number (US) */
2117
+ PHONE_US: /^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/,
2118
+ /** Phone number (India) */
2119
+ PHONE_INDIA: /^[6-9]\d{9}$/,
2120
+ /** URL pattern */
2121
+ URL: /^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/,
2122
+ /** URL with required protocol */
2123
+ URL_STRICT: /^https?:\/\/([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/,
2124
+ /** Alphanumeric only */
2125
+ ALPHANUMERIC: /^[a-zA-Z0-9]+$/,
2126
+ /** Letters only */
2127
+ LETTERS_ONLY: /^[a-zA-Z]+$/,
2128
+ /** Numbers only */
2129
+ NUMBERS_ONLY: /^\d+$/,
2130
+ /** Slug pattern (kebab-case) */
2131
+ SLUG: /^[a-z0-9]+(?:-[a-z0-9]+)*$/,
2132
+ /** Username pattern (alphanumeric, underscore, hyphen) */
2133
+ USERNAME: /^[a-zA-Z0-9_-]{3,30}$/,
2134
+ /** Credit card (basic validation) */
2135
+ CREDIT_CARD: /^\d{13,19}$/,
2136
+ /** CVV (3 or 4 digits) */
2137
+ CVV: /^\d{3,4}$/,
2138
+ /** ZIP code (US) */
2139
+ ZIP_US: /^\d{5}(-\d{4})?$/,
2140
+ /** Postal code (India) */
2141
+ POSTAL_INDIA: /^\d{6}$/,
2142
+ /** IP Address (IPv4) */
2143
+ IPV4: /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
2144
+ /** Hex color */
2145
+ HEX_COLOR: /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,
2146
+ /** Date (YYYY-MM-DD) */
2147
+ DATE_ISO: /^\d{4}-\d{2}-\d{2}$/,
2148
+ /** Time (HH:MM or HH:MM:SS) */
2149
+ TIME: /^([01]\d|2[0-3]):([0-5]\d)(:[0-5]\d)?$/
2150
+ };
2151
+ var isValidEmail = (email) => {
2152
+ return VALIDATION_PATTERNS.EMAIL.test(email.trim());
2153
+ };
2154
+ var isValidPassword = (password, strength = "medium") => {
2155
+ switch (strength) {
2156
+ case "strong":
2157
+ return VALIDATION_PATTERNS.PASSWORD_STRONG.test(password);
2158
+ case "medium":
2159
+ return VALIDATION_PATTERNS.PASSWORD_MEDIUM.test(password);
2160
+ case "basic":
2161
+ default:
2162
+ return VALIDATION_PATTERNS.PASSWORD_BASIC.test(password);
2163
+ }
2164
+ };
2165
+ var isValidPhone = (phone, format2 = "international") => {
2166
+ const cleaned = phone.replace(/\s/g, "");
2167
+ switch (format2) {
2168
+ case "us":
2169
+ return VALIDATION_PATTERNS.PHONE_US.test(cleaned);
2170
+ case "india":
2171
+ return VALIDATION_PATTERNS.PHONE_INDIA.test(cleaned);
2172
+ case "international":
2173
+ default:
2174
+ return VALIDATION_PATTERNS.PHONE_INTERNATIONAL.test(cleaned);
2175
+ }
2176
+ };
2177
+ var isValidUrl = (url, requireProtocol = false) => {
2178
+ if (requireProtocol) {
2179
+ return VALIDATION_PATTERNS.URL_STRICT.test(url);
2180
+ }
2181
+ return VALIDATION_PATTERNS.URL.test(url);
2182
+ };
2183
+ var isValidUsername = (username) => {
2184
+ return VALIDATION_PATTERNS.USERNAME.test(username);
2185
+ };
2186
+ var isValidSlug = (slug) => {
2187
+ return VALIDATION_PATTERNS.SLUG.test(slug);
2188
+ };
2189
+ var VALIDATION_MESSAGES = {
2190
+ // Required fields
2191
+ REQUIRED: "This field is required",
2192
+ REQUIRED_FIELD: (field) => `${field} is required`,
2193
+ // Email
2194
+ EMAIL_INVALID: "Please enter a valid email address",
2195
+ EMAIL_REQUIRED: "Email is required",
2196
+ // Password
2197
+ PASSWORD_REQUIRED: "Password is required",
2198
+ PASSWORD_MIN_LENGTH: (length) => `Password must be at least ${length} characters`,
2199
+ PASSWORD_WEAK: "Password is too weak",
2200
+ PASSWORD_MEDIUM: "Password must contain uppercase, lowercase, and number",
2201
+ PASSWORD_STRONG: "Password must contain uppercase, lowercase, number, and special character",
2202
+ PASSWORD_MISMATCH: "Passwords do not match",
2203
+ // Name
2204
+ NAME_REQUIRED: "Name is required",
2205
+ FIRST_NAME_REQUIRED: "First name is required",
2206
+ LAST_NAME_REQUIRED: "Last name is required",
2207
+ NAME_MIN_LENGTH: (length) => `Name must be at least ${length} characters`,
2208
+ NAME_MAX_LENGTH: (length) => `Name must be at most ${length} characters`,
2209
+ // Phone
2210
+ PHONE_INVALID: "Please enter a valid phone number",
2211
+ PHONE_REQUIRED: "Phone number is required",
2212
+ // URL
2213
+ URL_INVALID: "Please enter a valid URL",
2214
+ // Username
2215
+ USERNAME_INVALID: "Username can only contain letters, numbers, underscores, and hyphens",
2216
+ USERNAME_MIN_LENGTH: "Username must be at least 3 characters",
2217
+ USERNAME_MAX_LENGTH: "Username must be at most 30 characters",
2218
+ USERNAME_TAKEN: "This username is already taken",
2219
+ // General
2220
+ MIN_LENGTH: (field, length) => `${field} must be at least ${length} characters`,
2221
+ MAX_LENGTH: (field, length) => `${field} must be at most ${length} characters`,
2222
+ MIN_VALUE: (field, value) => `${field} must be at least ${value}`,
2223
+ MAX_VALUE: (field, value) => `${field} must be at most ${value}`,
2224
+ INVALID_FORMAT: "Invalid format",
2225
+ TERMS_REQUIRED: "You must accept the terms and conditions"
2226
+ };
2227
+ var VALIDATION_RULES = {
2228
+ email: {
2229
+ pattern: VALIDATION_PATTERNS.EMAIL,
2230
+ message: VALIDATION_MESSAGES.EMAIL_INVALID
2231
+ },
2232
+ password: {
2233
+ minLength: 8,
2234
+ pattern: VALIDATION_PATTERNS.PASSWORD_MEDIUM,
2235
+ message: VALIDATION_MESSAGES.PASSWORD_MEDIUM
2236
+ },
2237
+ passwordStrong: {
2238
+ minLength: 8,
2239
+ pattern: VALIDATION_PATTERNS.PASSWORD_STRONG,
2240
+ message: VALIDATION_MESSAGES.PASSWORD_STRONG
2241
+ },
2242
+ name: {
2243
+ minLength: 2,
2244
+ maxLength: 50
2245
+ },
2246
+ username: {
2247
+ minLength: 3,
2248
+ maxLength: 30,
2249
+ pattern: VALIDATION_PATTERNS.USERNAME,
2250
+ message: VALIDATION_MESSAGES.USERNAME_INVALID
2251
+ },
2252
+ phone: {
2253
+ pattern: VALIDATION_PATTERNS.PHONE_INTERNATIONAL,
2254
+ message: VALIDATION_MESSAGES.PHONE_INVALID
2255
+ },
2256
+ url: {
2257
+ pattern: VALIDATION_PATTERNS.URL,
2258
+ message: VALIDATION_MESSAGES.URL_INVALID
2259
+ }
2260
+ };
2261
+
2262
+ // src/data/index.ts
2263
+ var data_exports = {};
2264
+ __export(data_exports, {
2265
+ brands: () => logos_default,
2266
+ countries: () => countries_default,
2267
+ currencies: () => currencies_default,
2268
+ formatCurrency: () => formatCurrency,
2269
+ formatCurrencyNative: () => formatCurrencyNative,
2270
+ getAllBrandKeys: () => getAllBrandKeys,
2271
+ getAllBrands: () => getAllBrands,
2272
+ getAllCities: () => getAllCities,
2273
+ getBrand: () => getBrand,
2274
+ getBrandByDomain: () => getBrandByDomain,
2275
+ getCitiesByState: () => getCitiesByState,
2276
+ getCountriesByContinent: () => getCountriesByContinent,
2277
+ getCountryByCode: () => getCountryByCode,
2278
+ getCountryByName: () => getCountryByName,
2279
+ getCurrencyByCode: () => getCurrencyByCode,
2280
+ getLogo: () => getLogo,
2281
+ getPhoneCodeByCountry: () => getPhoneCodeByCountry,
2282
+ getPhoneCodesByPrefix: () => getPhoneCodesByPrefix,
2283
+ getStatesByCountry: () => getStatesByCountry,
2284
+ getTimezoneByName: () => getTimezoneByName,
2285
+ getTimezonesByOffset: () => getTimezonesByOffset,
2286
+ phoneCodes: () => phone_codes_default,
2287
+ searchCountries: () => searchCountries,
2288
+ searchCurrencies: () => searchCurrencies,
2289
+ searchPhoneCodes: () => searchPhoneCodes,
2290
+ searchTimezones: () => searchTimezones,
2291
+ sortTimezonesByOffset: () => sortTimezonesByOffset,
2292
+ timezones: () => timezones_default
2293
+ });
2294
+
2295
+ // src/data/countries.ts
2296
+ var countries = [
2297
+ {
2298
+ name: "Afghanistan",
2299
+ code: "AF",
2300
+ code3: "AFG",
2301
+ phoneCode: "+93",
2302
+ currency: "AFN",
2303
+ currencySymbol: "\u060B",
2304
+ continent: "Asia",
2305
+ capital: "Kabul",
2306
+ timezone: "Asia/Kabul",
2307
+ states: [
2308
+ { name: "Kabul", code: "KBL", cities: [{ name: "Kabul" }] },
2309
+ { name: "Kandahar", code: "KDH", cities: [{ name: "Kandahar" }] },
2310
+ { name: "Herat", code: "HER", cities: [{ name: "Herat" }] }
2311
+ ]
2312
+ },
2313
+ {
2314
+ name: "Albania",
2315
+ code: "AL",
2316
+ code3: "ALB",
2317
+ phoneCode: "+355",
2318
+ currency: "ALL",
2319
+ currencySymbol: "L",
2320
+ continent: "Europe",
2321
+ capital: "Tirana",
2322
+ timezone: "Europe/Tirane",
2323
+ states: [
2324
+ { name: "Tirana", code: "TR", cities: [{ name: "Tirana" }] },
2325
+ { name: "Durr\xEBs", code: "DR", cities: [{ name: "Durr\xEBs" }] }
2326
+ ]
2327
+ },
2328
+ {
2329
+ name: "Algeria",
2330
+ code: "DZ",
2331
+ code3: "DZA",
2332
+ phoneCode: "+213",
2333
+ currency: "DZD",
2334
+ currencySymbol: "\u062F.\u062C",
2335
+ continent: "Africa",
2336
+ capital: "Algiers",
2337
+ timezone: "Africa/Algiers",
2338
+ states: [
2339
+ { name: "Algiers", code: "ALG", cities: [{ name: "Algiers" }] },
2340
+ { name: "Oran", code: "ORA", cities: [{ name: "Oran" }] }
2341
+ ]
2342
+ },
2343
+ {
2344
+ name: "Argentina",
2345
+ code: "AR",
2346
+ code3: "ARG",
2347
+ phoneCode: "+54",
2348
+ currency: "ARS",
2349
+ currencySymbol: "$",
2350
+ continent: "South America",
2351
+ capital: "Buenos Aires",
2352
+ timezone: "America/Argentina/Buenos_Aires",
2353
+ states: [
2354
+ { name: "Buenos Aires", code: "BA", cities: [{ name: "Buenos Aires" }, { name: "La Plata" }] },
2355
+ { name: "C\xF3rdoba", code: "CO", cities: [{ name: "C\xF3rdoba" }] },
2356
+ { name: "Santa Fe", code: "SF", cities: [{ name: "Rosario" }, { name: "Santa Fe" }] }
2357
+ ]
2358
+ },
2359
+ {
2360
+ name: "Australia",
2361
+ code: "AU",
2362
+ code3: "AUS",
2363
+ phoneCode: "+61",
2364
+ currency: "AUD",
2365
+ currencySymbol: "$",
2366
+ continent: "Oceania",
2367
+ capital: "Canberra",
2368
+ timezone: "Australia/Sydney",
2369
+ states: [
2370
+ { name: "New South Wales", code: "NSW", cities: [{ name: "Sydney" }, { name: "Newcastle" }, { name: "Wollongong" }] },
2371
+ { name: "Victoria", code: "VIC", cities: [{ name: "Melbourne" }, { name: "Geelong" }] },
2372
+ { name: "Queensland", code: "QLD", cities: [{ name: "Brisbane" }, { name: "Gold Coast" }, { name: "Cairns" }] },
2373
+ { name: "Western Australia", code: "WA", cities: [{ name: "Perth" }, { name: "Fremantle" }] },
2374
+ { name: "South Australia", code: "SA", cities: [{ name: "Adelaide" }] },
2375
+ { name: "Tasmania", code: "TAS", cities: [{ name: "Hobart" }, { name: "Launceston" }] },
2376
+ { name: "Australian Capital Territory", code: "ACT", cities: [{ name: "Canberra" }] },
2377
+ { name: "Northern Territory", code: "NT", cities: [{ name: "Darwin" }] }
2378
+ ]
2379
+ },
2380
+ {
2381
+ name: "Austria",
2382
+ code: "AT",
2383
+ code3: "AUT",
2384
+ phoneCode: "+43",
2385
+ currency: "EUR",
2386
+ currencySymbol: "\u20AC",
2387
+ continent: "Europe",
2388
+ capital: "Vienna",
2389
+ timezone: "Europe/Vienna",
2390
+ states: [
2391
+ { name: "Vienna", code: "VIE", cities: [{ name: "Vienna" }] },
2392
+ { name: "Salzburg", code: "SBG", cities: [{ name: "Salzburg" }] },
2393
+ { name: "Tyrol", code: "TYR", cities: [{ name: "Innsbruck" }] }
2394
+ ]
2395
+ },
2396
+ {
2397
+ name: "Bangladesh",
2398
+ code: "BD",
2399
+ code3: "BGD",
2400
+ phoneCode: "+880",
2401
+ currency: "BDT",
2402
+ currencySymbol: "\u09F3",
2403
+ continent: "Asia",
2404
+ capital: "Dhaka",
2405
+ timezone: "Asia/Dhaka",
2406
+ states: [
2407
+ { name: "Dhaka", code: "DHA", cities: [{ name: "Dhaka" }, { name: "Gazipur" }, { name: "Narayanganj" }] },
2408
+ { name: "Chittagong", code: "CTG", cities: [{ name: "Chittagong" }, { name: "Cox's Bazar" }] },
2409
+ { name: "Khulna", code: "KHL", cities: [{ name: "Khulna" }] },
2410
+ { name: "Rajshahi", code: "RAJ", cities: [{ name: "Rajshahi" }] },
2411
+ { name: "Sylhet", code: "SYL", cities: [{ name: "Sylhet" }] }
2412
+ ]
2413
+ },
2414
+ {
2415
+ name: "Belgium",
2416
+ code: "BE",
2417
+ code3: "BEL",
2418
+ phoneCode: "+32",
2419
+ currency: "EUR",
2420
+ currencySymbol: "\u20AC",
2421
+ continent: "Europe",
2422
+ capital: "Brussels",
2423
+ timezone: "Europe/Brussels",
2424
+ states: [
2425
+ { name: "Brussels", code: "BRU", cities: [{ name: "Brussels" }] },
2426
+ { name: "Flanders", code: "FLA", cities: [{ name: "Antwerp" }, { name: "Ghent" }, { name: "Bruges" }] },
2427
+ { name: "Wallonia", code: "WAL", cities: [{ name: "Li\xE8ge" }, { name: "Charleroi" }] }
2428
+ ]
2429
+ },
2430
+ {
2431
+ name: "Brazil",
2432
+ code: "BR",
2433
+ code3: "BRA",
2434
+ phoneCode: "+55",
2435
+ currency: "BRL",
2436
+ currencySymbol: "R$",
2437
+ continent: "South America",
2438
+ capital: "Bras\xEDlia",
2439
+ timezone: "America/Sao_Paulo",
2440
+ states: [
2441
+ { name: "S\xE3o Paulo", code: "SP", cities: [{ name: "S\xE3o Paulo" }, { name: "Campinas" }, { name: "Santos" }] },
2442
+ { name: "Rio de Janeiro", code: "RJ", cities: [{ name: "Rio de Janeiro" }, { name: "Niter\xF3i" }] },
2443
+ { name: "Minas Gerais", code: "MG", cities: [{ name: "Belo Horizonte" }, { name: "Uberl\xE2ndia" }] },
2444
+ { name: "Bahia", code: "BA", cities: [{ name: "Salvador" }] },
2445
+ { name: "Paran\xE1", code: "PR", cities: [{ name: "Curitiba" }] },
2446
+ { name: "Rio Grande do Sul", code: "RS", cities: [{ name: "Porto Alegre" }] },
2447
+ { name: "Federal District", code: "DF", cities: [{ name: "Bras\xEDlia" }] }
2448
+ ]
2449
+ },
2450
+ {
2451
+ name: "Canada",
2452
+ code: "CA",
2453
+ code3: "CAN",
2454
+ phoneCode: "+1",
2455
+ currency: "CAD",
2456
+ currencySymbol: "$",
2457
+ continent: "North America",
2458
+ capital: "Ottawa",
2459
+ timezone: "America/Toronto",
2460
+ states: [
2461
+ { name: "Ontario", code: "ON", cities: [{ name: "Toronto" }, { name: "Ottawa" }, { name: "Mississauga" }, { name: "Hamilton" }] },
2462
+ { name: "Quebec", code: "QC", cities: [{ name: "Montreal" }, { name: "Quebec City" }, { name: "Laval" }] },
2463
+ { name: "British Columbia", code: "BC", cities: [{ name: "Vancouver" }, { name: "Victoria" }, { name: "Surrey" }] },
2464
+ { name: "Alberta", code: "AB", cities: [{ name: "Calgary" }, { name: "Edmonton" }] },
2465
+ { name: "Manitoba", code: "MB", cities: [{ name: "Winnipeg" }] },
2466
+ { name: "Saskatchewan", code: "SK", cities: [{ name: "Saskatoon" }, { name: "Regina" }] },
2467
+ { name: "Nova Scotia", code: "NS", cities: [{ name: "Halifax" }] },
2468
+ { name: "New Brunswick", code: "NB", cities: [{ name: "Moncton" }, { name: "Saint John" }] }
2469
+ ]
2470
+ },
2471
+ {
2472
+ name: "China",
2473
+ code: "CN",
2474
+ code3: "CHN",
2475
+ phoneCode: "+86",
2476
+ currency: "CNY",
2477
+ currencySymbol: "\xA5",
2478
+ continent: "Asia",
2479
+ capital: "Beijing",
2480
+ timezone: "Asia/Shanghai",
2481
+ states: [
2482
+ { name: "Beijing", code: "BJ", cities: [{ name: "Beijing" }] },
2483
+ { name: "Shanghai", code: "SH", cities: [{ name: "Shanghai" }] },
2484
+ { name: "Guangdong", code: "GD", cities: [{ name: "Guangzhou" }, { name: "Shenzhen" }, { name: "Dongguan" }] },
2485
+ { name: "Jiangsu", code: "JS", cities: [{ name: "Nanjing" }, { name: "Suzhou" }, { name: "Wuxi" }] },
2486
+ { name: "Zhejiang", code: "ZJ", cities: [{ name: "Hangzhou" }, { name: "Ningbo" }] },
2487
+ { name: "Sichuan", code: "SC", cities: [{ name: "Chengdu" }, { name: "Chongqing" }] },
2488
+ { name: "Hubei", code: "HB", cities: [{ name: "Wuhan" }] }
2489
+ ]
2490
+ },
2491
+ {
2492
+ name: "Denmark",
2493
+ code: "DK",
2494
+ code3: "DNK",
2495
+ phoneCode: "+45",
2496
+ currency: "DKK",
2497
+ currencySymbol: "kr",
2498
+ continent: "Europe",
2499
+ capital: "Copenhagen",
2500
+ timezone: "Europe/Copenhagen",
2501
+ states: [
2502
+ { name: "Capital Region", code: "HO", cities: [{ name: "Copenhagen" }] },
2503
+ { name: "Central Denmark", code: "MJ", cities: [{ name: "Aarhus" }] },
2504
+ { name: "Southern Denmark", code: "SD", cities: [{ name: "Odense" }] }
2505
+ ]
2506
+ },
2507
+ {
2508
+ name: "Egypt",
2509
+ code: "EG",
2510
+ code3: "EGY",
2511
+ phoneCode: "+20",
2512
+ currency: "EGP",
2513
+ currencySymbol: "\xA3",
2514
+ continent: "Africa",
2515
+ capital: "Cairo",
2516
+ timezone: "Africa/Cairo",
2517
+ states: [
2518
+ { name: "Cairo", code: "CAI", cities: [{ name: "Cairo" }, { name: "Giza" }] },
2519
+ { name: "Alexandria", code: "ALX", cities: [{ name: "Alexandria" }] },
2520
+ { name: "Luxor", code: "LXR", cities: [{ name: "Luxor" }] }
2521
+ ]
2522
+ },
2523
+ {
2524
+ name: "Finland",
2525
+ code: "FI",
2526
+ code3: "FIN",
2527
+ phoneCode: "+358",
2528
+ currency: "EUR",
2529
+ currencySymbol: "\u20AC",
2530
+ continent: "Europe",
2531
+ capital: "Helsinki",
2532
+ timezone: "Europe/Helsinki",
2533
+ states: [
2534
+ { name: "Uusimaa", code: "UUS", cities: [{ name: "Helsinki" }, { name: "Espoo" }, { name: "Vantaa" }] },
2535
+ { name: "Pirkanmaa", code: "PIR", cities: [{ name: "Tampere" }] },
2536
+ { name: "Southwest Finland", code: "VAR", cities: [{ name: "Turku" }] }
2537
+ ]
2538
+ },
2539
+ {
2540
+ name: "France",
2541
+ code: "FR",
2542
+ code3: "FRA",
2543
+ phoneCode: "+33",
2544
+ currency: "EUR",
2545
+ currencySymbol: "\u20AC",
2546
+ continent: "Europe",
2547
+ capital: "Paris",
2548
+ timezone: "Europe/Paris",
2549
+ states: [
2550
+ { name: "\xCEle-de-France", code: "IDF", cities: [{ name: "Paris" }, { name: "Versailles" }, { name: "Boulogne-Billancourt" }] },
2551
+ { name: "Provence-Alpes-C\xF4te d'Azur", code: "PAC", cities: [{ name: "Marseille" }, { name: "Nice" }, { name: "Cannes" }] },
2552
+ { name: "Auvergne-Rh\xF4ne-Alpes", code: "ARA", cities: [{ name: "Lyon" }, { name: "Grenoble" }] },
2553
+ { name: "Nouvelle-Aquitaine", code: "NAQ", cities: [{ name: "Bordeaux" }] },
2554
+ { name: "Occitanie", code: "OCC", cities: [{ name: "Toulouse" }, { name: "Montpellier" }] }
2555
+ ]
2556
+ },
2557
+ {
2558
+ name: "Germany",
2559
+ code: "DE",
2560
+ code3: "DEU",
2561
+ phoneCode: "+49",
2562
+ currency: "EUR",
2563
+ currencySymbol: "\u20AC",
2564
+ continent: "Europe",
2565
+ capital: "Berlin",
2566
+ timezone: "Europe/Berlin",
2567
+ states: [
2568
+ { name: "Berlin", code: "BE", cities: [{ name: "Berlin" }] },
2569
+ { name: "Bavaria", code: "BY", cities: [{ name: "Munich" }, { name: "Nuremberg" }, { name: "Augsburg" }] },
2570
+ { name: "North Rhine-Westphalia", code: "NW", cities: [{ name: "Cologne" }, { name: "D\xFCsseldorf" }, { name: "Dortmund" }, { name: "Essen" }] },
2571
+ { name: "Baden-W\xFCrttemberg", code: "BW", cities: [{ name: "Stuttgart" }, { name: "Mannheim" }, { name: "Karlsruhe" }] },
2572
+ { name: "Hesse", code: "HE", cities: [{ name: "Frankfurt" }, { name: "Wiesbaden" }] },
2573
+ { name: "Hamburg", code: "HH", cities: [{ name: "Hamburg" }] },
2574
+ { name: "Saxony", code: "SN", cities: [{ name: "Dresden" }, { name: "Leipzig" }] }
2575
+ ]
2576
+ },
2577
+ {
2578
+ name: "Greece",
2579
+ code: "GR",
2580
+ code3: "GRC",
2581
+ phoneCode: "+30",
2582
+ currency: "EUR",
2583
+ currencySymbol: "\u20AC",
2584
+ continent: "Europe",
2585
+ capital: "Athens",
2586
+ timezone: "Europe/Athens",
2587
+ states: [
2588
+ { name: "Attica", code: "AT", cities: [{ name: "Athens" }, { name: "Piraeus" }] },
2589
+ { name: "Central Macedonia", code: "CM", cities: [{ name: "Thessaloniki" }] },
2590
+ { name: "Crete", code: "CR", cities: [{ name: "Heraklion" }, { name: "Chania" }] }
2591
+ ]
2592
+ },
2593
+ {
2594
+ name: "Hong Kong",
2595
+ code: "HK",
2596
+ code3: "HKG",
2597
+ phoneCode: "+852",
2598
+ currency: "HKD",
2599
+ currencySymbol: "$",
2600
+ continent: "Asia",
2601
+ capital: "Hong Kong",
2602
+ timezone: "Asia/Hong_Kong",
2603
+ states: [
2604
+ { name: "Hong Kong Island", code: "HKI", cities: [{ name: "Central" }, { name: "Wan Chai" }] },
2605
+ { name: "Kowloon", code: "KLN", cities: [{ name: "Tsim Sha Tsui" }, { name: "Mong Kok" }] },
2606
+ { name: "New Territories", code: "NT", cities: [{ name: "Sha Tin" }, { name: "Tsuen Wan" }] }
2607
+ ]
2608
+ },
2609
+ {
2610
+ name: "India",
2611
+ code: "IN",
2612
+ code3: "IND",
2613
+ phoneCode: "+91",
2614
+ currency: "INR",
2615
+ currencySymbol: "\u20B9",
2616
+ continent: "Asia",
2617
+ capital: "New Delhi",
2618
+ timezone: "Asia/Kolkata",
2619
+ states: [
2620
+ { name: "Delhi", code: "DL", cities: [{ name: "New Delhi" }, { name: "Delhi" }] },
2621
+ { name: "Maharashtra", code: "MH", cities: [{ name: "Mumbai" }, { name: "Pune" }, { name: "Nagpur" }, { name: "Nashik" }] },
2622
+ { name: "Karnataka", code: "KA", cities: [{ name: "Bangalore" }, { name: "Mysore" }, { name: "Mangalore" }] },
2623
+ { name: "Tamil Nadu", code: "TN", cities: [{ name: "Chennai" }, { name: "Coimbatore" }, { name: "Madurai" }] },
2624
+ { name: "Telangana", code: "TG", cities: [{ name: "Hyderabad" }, { name: "Warangal" }] },
2625
+ { name: "West Bengal", code: "WB", cities: [{ name: "Kolkata" }, { name: "Howrah" }] },
2626
+ { name: "Gujarat", code: "GJ", cities: [{ name: "Ahmedabad" }, { name: "Surat" }, { name: "Vadodara" }] },
2627
+ { name: "Rajasthan", code: "RJ", cities: [{ name: "Jaipur" }, { name: "Jodhpur" }, { name: "Udaipur" }] },
2628
+ { name: "Uttar Pradesh", code: "UP", cities: [{ name: "Lucknow" }, { name: "Kanpur" }, { name: "Varanasi" }, { name: "Agra" }, { name: "Noida" }] },
2629
+ { name: "Kerala", code: "KL", cities: [{ name: "Thiruvananthapuram" }, { name: "Kochi" }, { name: "Kozhikode" }] },
2630
+ { name: "Punjab", code: "PB", cities: [{ name: "Chandigarh" }, { name: "Ludhiana" }, { name: "Amritsar" }] },
2631
+ { name: "Haryana", code: "HR", cities: [{ name: "Gurugram" }, { name: "Faridabad" }] },
2632
+ { name: "Madhya Pradesh", code: "MP", cities: [{ name: "Bhopal" }, { name: "Indore" }] },
2633
+ { name: "Bihar", code: "BR", cities: [{ name: "Patna" }] },
2634
+ { name: "Odisha", code: "OR", cities: [{ name: "Bhubaneswar" }] },
2635
+ { name: "Goa", code: "GA", cities: [{ name: "Panaji" }, { name: "Margao" }] }
2636
+ ]
2637
+ },
2638
+ {
2639
+ name: "Indonesia",
2640
+ code: "ID",
2641
+ code3: "IDN",
2642
+ phoneCode: "+62",
2643
+ currency: "IDR",
2644
+ currencySymbol: "Rp",
2645
+ continent: "Asia",
2646
+ capital: "Jakarta",
2647
+ timezone: "Asia/Jakarta",
2648
+ states: [
2649
+ { name: "Jakarta", code: "JK", cities: [{ name: "Jakarta" }] },
2650
+ { name: "West Java", code: "JB", cities: [{ name: "Bandung" }, { name: "Bekasi" }] },
2651
+ { name: "East Java", code: "JI", cities: [{ name: "Surabaya" }, { name: "Malang" }] },
2652
+ { name: "Bali", code: "BA", cities: [{ name: "Denpasar" }, { name: "Ubud" }] }
2653
+ ]
2654
+ },
2655
+ {
2656
+ name: "Ireland",
2657
+ code: "IE",
2658
+ code3: "IRL",
2659
+ phoneCode: "+353",
2660
+ currency: "EUR",
2661
+ currencySymbol: "\u20AC",
2662
+ continent: "Europe",
2663
+ capital: "Dublin",
2664
+ timezone: "Europe/Dublin",
2665
+ states: [
2666
+ { name: "Leinster", code: "L", cities: [{ name: "Dublin" }] },
2667
+ { name: "Munster", code: "M", cities: [{ name: "Cork" }, { name: "Limerick" }] },
2668
+ { name: "Connacht", code: "C", cities: [{ name: "Galway" }] }
2669
+ ]
2670
+ },
2671
+ {
2672
+ name: "Israel",
2673
+ code: "IL",
2674
+ code3: "ISR",
2675
+ phoneCode: "+972",
2676
+ currency: "ILS",
2677
+ currencySymbol: "\u20AA",
2678
+ continent: "Asia",
2679
+ capital: "Jerusalem",
2680
+ timezone: "Asia/Jerusalem",
2681
+ states: [
2682
+ { name: "Tel Aviv", code: "TA", cities: [{ name: "Tel Aviv" }] },
2683
+ { name: "Jerusalem", code: "JM", cities: [{ name: "Jerusalem" }] },
2684
+ { name: "Haifa", code: "HA", cities: [{ name: "Haifa" }] }
2685
+ ]
2686
+ },
2687
+ {
2688
+ name: "Italy",
2689
+ code: "IT",
2690
+ code3: "ITA",
2691
+ phoneCode: "+39",
2692
+ currency: "EUR",
2693
+ currencySymbol: "\u20AC",
2694
+ continent: "Europe",
2695
+ capital: "Rome",
2696
+ timezone: "Europe/Rome",
2697
+ states: [
2698
+ { name: "Lazio", code: "LAZ", cities: [{ name: "Rome" }] },
2699
+ { name: "Lombardy", code: "LOM", cities: [{ name: "Milan" }, { name: "Bergamo" }] },
2700
+ { name: "Veneto", code: "VEN", cities: [{ name: "Venice" }, { name: "Verona" }, { name: "Padua" }] },
2701
+ { name: "Tuscany", code: "TOS", cities: [{ name: "Florence" }, { name: "Pisa" }, { name: "Siena" }] },
2702
+ { name: "Campania", code: "CAM", cities: [{ name: "Naples" }] },
2703
+ { name: "Sicily", code: "SIC", cities: [{ name: "Palermo" }, { name: "Catania" }] }
2704
+ ]
2705
+ },
2706
+ {
2707
+ name: "Japan",
2708
+ code: "JP",
2709
+ code3: "JPN",
2710
+ phoneCode: "+81",
2711
+ currency: "JPY",
2712
+ currencySymbol: "\xA5",
2713
+ continent: "Asia",
2714
+ capital: "Tokyo",
2715
+ timezone: "Asia/Tokyo",
2716
+ states: [
2717
+ { name: "Tokyo", code: "TK", cities: [{ name: "Tokyo" }, { name: "Shibuya" }, { name: "Shinjuku" }] },
2718
+ { name: "Osaka", code: "OS", cities: [{ name: "Osaka" }] },
2719
+ { name: "Kyoto", code: "KY", cities: [{ name: "Kyoto" }] },
2720
+ { name: "Kanagawa", code: "KN", cities: [{ name: "Yokohama" }, { name: "Kawasaki" }] },
2721
+ { name: "Aichi", code: "AI", cities: [{ name: "Nagoya" }] },
2722
+ { name: "Hokkaido", code: "HK", cities: [{ name: "Sapporo" }] },
2723
+ { name: "Fukuoka", code: "FK", cities: [{ name: "Fukuoka" }] },
2724
+ { name: "Hiroshima", code: "HS", cities: [{ name: "Hiroshima" }] }
2725
+ ]
2726
+ },
2727
+ {
2728
+ name: "Malaysia",
2729
+ code: "MY",
2730
+ code3: "MYS",
2731
+ phoneCode: "+60",
2732
+ currency: "MYR",
2733
+ currencySymbol: "RM",
2734
+ continent: "Asia",
2735
+ capital: "Kuala Lumpur",
2736
+ timezone: "Asia/Kuala_Lumpur",
2737
+ states: [
2738
+ { name: "Kuala Lumpur", code: "KL", cities: [{ name: "Kuala Lumpur" }] },
2739
+ { name: "Selangor", code: "SL", cities: [{ name: "Shah Alam" }, { name: "Petaling Jaya" }] },
2740
+ { name: "Penang", code: "PG", cities: [{ name: "George Town" }] },
2741
+ { name: "Johor", code: "JH", cities: [{ name: "Johor Bahru" }] }
2742
+ ]
2743
+ },
2744
+ {
2745
+ name: "Mexico",
2746
+ code: "MX",
2747
+ code3: "MEX",
2748
+ phoneCode: "+52",
2749
+ currency: "MXN",
2750
+ currencySymbol: "$",
2751
+ continent: "North America",
2752
+ capital: "Mexico City",
2753
+ timezone: "America/Mexico_City",
2754
+ states: [
2755
+ { name: "Mexico City", code: "CMX", cities: [{ name: "Mexico City" }] },
2756
+ { name: "Jalisco", code: "JAL", cities: [{ name: "Guadalajara" }] },
2757
+ { name: "Nuevo Le\xF3n", code: "NLE", cities: [{ name: "Monterrey" }] },
2758
+ { name: "Quintana Roo", code: "ROO", cities: [{ name: "Canc\xFAn" }, { name: "Playa del Carmen" }] }
2759
+ ]
2760
+ },
2761
+ {
2762
+ name: "Netherlands",
2763
+ code: "NL",
2764
+ code3: "NLD",
2765
+ phoneCode: "+31",
2766
+ currency: "EUR",
2767
+ currencySymbol: "\u20AC",
2768
+ continent: "Europe",
2769
+ capital: "Amsterdam",
2770
+ timezone: "Europe/Amsterdam",
2771
+ states: [
2772
+ { name: "North Holland", code: "NH", cities: [{ name: "Amsterdam" }, { name: "Haarlem" }] },
2773
+ { name: "South Holland", code: "ZH", cities: [{ name: "Rotterdam" }, { name: "The Hague" }, { name: "Leiden" }] },
2774
+ { name: "Utrecht", code: "UT", cities: [{ name: "Utrecht" }] },
2775
+ { name: "North Brabant", code: "NB", cities: [{ name: "Eindhoven" }, { name: "Tilburg" }] }
2776
+ ]
2777
+ },
2778
+ {
2779
+ name: "New Zealand",
2780
+ code: "NZ",
2781
+ code3: "NZL",
2782
+ phoneCode: "+64",
2783
+ currency: "NZD",
2784
+ currencySymbol: "$",
2785
+ continent: "Oceania",
2786
+ capital: "Wellington",
2787
+ timezone: "Pacific/Auckland",
2788
+ states: [
2789
+ { name: "Auckland", code: "AUK", cities: [{ name: "Auckland" }] },
2790
+ { name: "Wellington", code: "WGN", cities: [{ name: "Wellington" }] },
2791
+ { name: "Canterbury", code: "CAN", cities: [{ name: "Christchurch" }] },
2792
+ { name: "Otago", code: "OTA", cities: [{ name: "Dunedin" }, { name: "Queenstown" }] }
2793
+ ]
2794
+ },
2795
+ {
2796
+ name: "Nigeria",
2797
+ code: "NG",
2798
+ code3: "NGA",
2799
+ phoneCode: "+234",
2800
+ currency: "NGN",
2801
+ currencySymbol: "\u20A6",
2802
+ continent: "Africa",
2803
+ capital: "Abuja",
2804
+ timezone: "Africa/Lagos",
2805
+ states: [
2806
+ { name: "Lagos", code: "LA", cities: [{ name: "Lagos" }, { name: "Ikeja" }] },
2807
+ { name: "FCT", code: "FC", cities: [{ name: "Abuja" }] },
2808
+ { name: "Kano", code: "KN", cities: [{ name: "Kano" }] },
2809
+ { name: "Rivers", code: "RI", cities: [{ name: "Port Harcourt" }] }
2810
+ ]
2811
+ },
2812
+ {
2813
+ name: "Norway",
2814
+ code: "NO",
2815
+ code3: "NOR",
2816
+ phoneCode: "+47",
2817
+ currency: "NOK",
2818
+ currencySymbol: "kr",
2819
+ continent: "Europe",
2820
+ capital: "Oslo",
2821
+ timezone: "Europe/Oslo",
2822
+ states: [
2823
+ { name: "Oslo", code: "OSL", cities: [{ name: "Oslo" }] },
2824
+ { name: "Vestland", code: "VES", cities: [{ name: "Bergen" }] },
2825
+ { name: "Tr\xF8ndelag", code: "TRO", cities: [{ name: "Trondheim" }] }
2826
+ ]
2827
+ },
2828
+ {
2829
+ name: "Pakistan",
2830
+ code: "PK",
2831
+ code3: "PAK",
2832
+ phoneCode: "+92",
2833
+ currency: "PKR",
2834
+ currencySymbol: "\u20A8",
2835
+ continent: "Asia",
2836
+ capital: "Islamabad",
2837
+ timezone: "Asia/Karachi",
2838
+ states: [
2839
+ { name: "Punjab", code: "PB", cities: [{ name: "Lahore" }, { name: "Faisalabad" }, { name: "Rawalpindi" }] },
2840
+ { name: "Sindh", code: "SD", cities: [{ name: "Karachi" }, { name: "Hyderabad" }] },
2841
+ { name: "Islamabad", code: "IS", cities: [{ name: "Islamabad" }] },
2842
+ { name: "Khyber Pakhtunkhwa", code: "KP", cities: [{ name: "Peshawar" }] }
2843
+ ]
2844
+ },
2845
+ {
2846
+ name: "Philippines",
2847
+ code: "PH",
2848
+ code3: "PHL",
2849
+ phoneCode: "+63",
2850
+ currency: "PHP",
2851
+ currencySymbol: "\u20B1",
2852
+ continent: "Asia",
2853
+ capital: "Manila",
2854
+ timezone: "Asia/Manila",
2855
+ states: [
2856
+ { name: "Metro Manila", code: "NCR", cities: [{ name: "Manila" }, { name: "Quezon City" }, { name: "Makati" }] },
2857
+ { name: "Cebu", code: "CEB", cities: [{ name: "Cebu City" }] },
2858
+ { name: "Davao", code: "DAV", cities: [{ name: "Davao City" }] }
2859
+ ]
2860
+ },
2861
+ {
2862
+ name: "Poland",
2863
+ code: "PL",
2864
+ code3: "POL",
2865
+ phoneCode: "+48",
2866
+ currency: "PLN",
2867
+ currencySymbol: "z\u0142",
2868
+ continent: "Europe",
2869
+ capital: "Warsaw",
2870
+ timezone: "Europe/Warsaw",
2871
+ states: [
2872
+ { name: "Masovian", code: "MZ", cities: [{ name: "Warsaw" }] },
2873
+ { name: "Lesser Poland", code: "MA", cities: [{ name: "Krakow" }] },
2874
+ { name: "Greater Poland", code: "WP", cities: [{ name: "Pozna\u0144" }] },
2875
+ { name: "Lower Silesian", code: "DS", cities: [{ name: "Wroc\u0142aw" }] }
2876
+ ]
2877
+ },
2878
+ {
2879
+ name: "Portugal",
2880
+ code: "PT",
2881
+ code3: "PRT",
2882
+ phoneCode: "+351",
2883
+ currency: "EUR",
2884
+ currencySymbol: "\u20AC",
2885
+ continent: "Europe",
2886
+ capital: "Lisbon",
2887
+ timezone: "Europe/Lisbon",
2888
+ states: [
2889
+ { name: "Lisbon", code: "LIS", cities: [{ name: "Lisbon" }] },
2890
+ { name: "Porto", code: "POR", cities: [{ name: "Porto" }] },
2891
+ { name: "Faro", code: "FAR", cities: [{ name: "Faro" }] }
2892
+ ]
2893
+ },
2894
+ {
2895
+ name: "Qatar",
2896
+ code: "QA",
2897
+ code3: "QAT",
2898
+ phoneCode: "+974",
2899
+ currency: "QAR",
2900
+ currencySymbol: "\u0631.\u0642",
2901
+ continent: "Asia",
2902
+ capital: "Doha",
2903
+ timezone: "Asia/Qatar",
2904
+ states: [
2905
+ { name: "Doha", code: "DA", cities: [{ name: "Doha" }] },
2906
+ { name: "Al Wakrah", code: "WA", cities: [{ name: "Al Wakrah" }] }
2907
+ ]
2908
+ },
2909
+ {
2910
+ name: "Russia",
2911
+ code: "RU",
2912
+ code3: "RUS",
2913
+ phoneCode: "+7",
2914
+ currency: "RUB",
2915
+ currencySymbol: "\u20BD",
2916
+ continent: "Europe",
2917
+ capital: "Moscow",
2918
+ timezone: "Europe/Moscow",
2919
+ states: [
2920
+ { name: "Moscow", code: "MOW", cities: [{ name: "Moscow" }] },
2921
+ { name: "Saint Petersburg", code: "SPE", cities: [{ name: "Saint Petersburg" }] },
2922
+ { name: "Novosibirsk Oblast", code: "NVS", cities: [{ name: "Novosibirsk" }] },
2923
+ { name: "Sverdlovsk Oblast", code: "SVE", cities: [{ name: "Yekaterinburg" }] }
2924
+ ]
2925
+ },
2926
+ {
2927
+ name: "Saudi Arabia",
2928
+ code: "SA",
2929
+ code3: "SAU",
2930
+ phoneCode: "+966",
2931
+ currency: "SAR",
2932
+ currencySymbol: "\u0631.\u0633",
2933
+ continent: "Asia",
2934
+ capital: "Riyadh",
2935
+ timezone: "Asia/Riyadh",
2936
+ states: [
2937
+ { name: "Riyadh", code: "RIY", cities: [{ name: "Riyadh" }] },
2938
+ { name: "Makkah", code: "MKK", cities: [{ name: "Jeddah" }, { name: "Mecca" }] },
2939
+ { name: "Eastern Province", code: "ASH", cities: [{ name: "Dammam" }, { name: "Dhahran" }] }
2940
+ ]
2941
+ },
2942
+ {
2943
+ name: "Singapore",
2944
+ code: "SG",
2945
+ code3: "SGP",
2946
+ phoneCode: "+65",
2947
+ currency: "SGD",
2948
+ currencySymbol: "$",
2949
+ continent: "Asia",
2950
+ capital: "Singapore",
2951
+ timezone: "Asia/Singapore",
2952
+ states: [
2953
+ { name: "Central Region", code: "CEN", cities: [{ name: "Singapore" }] }
2954
+ ]
2955
+ },
2956
+ {
2957
+ name: "South Africa",
2958
+ code: "ZA",
2959
+ code3: "ZAF",
2960
+ phoneCode: "+27",
2961
+ currency: "ZAR",
2962
+ currencySymbol: "R",
2963
+ continent: "Africa",
2964
+ capital: "Pretoria",
2965
+ timezone: "Africa/Johannesburg",
2966
+ states: [
2967
+ { name: "Gauteng", code: "GP", cities: [{ name: "Johannesburg" }, { name: "Pretoria" }] },
2968
+ { name: "Western Cape", code: "WC", cities: [{ name: "Cape Town" }] },
2969
+ { name: "KwaZulu-Natal", code: "KZN", cities: [{ name: "Durban" }] }
2970
+ ]
2971
+ },
2972
+ {
2973
+ name: "South Korea",
2974
+ code: "KR",
2975
+ code3: "KOR",
2976
+ phoneCode: "+82",
2977
+ currency: "KRW",
2978
+ currencySymbol: "\u20A9",
2979
+ continent: "Asia",
2980
+ capital: "Seoul",
2981
+ timezone: "Asia/Seoul",
2982
+ states: [
2983
+ { name: "Seoul", code: "SEO", cities: [{ name: "Seoul" }] },
2984
+ { name: "Busan", code: "BUS", cities: [{ name: "Busan" }] },
2985
+ { name: "Incheon", code: "INC", cities: [{ name: "Incheon" }] },
2986
+ { name: "Gyeonggi", code: "GGI", cities: [{ name: "Suwon" }, { name: "Seongnam" }] }
2987
+ ]
2988
+ },
2989
+ {
2990
+ name: "Spain",
2991
+ code: "ES",
2992
+ code3: "ESP",
2993
+ phoneCode: "+34",
2994
+ currency: "EUR",
2995
+ currencySymbol: "\u20AC",
2996
+ continent: "Europe",
2997
+ capital: "Madrid",
2998
+ timezone: "Europe/Madrid",
2999
+ states: [
3000
+ { name: "Madrid", code: "MD", cities: [{ name: "Madrid" }] },
3001
+ { name: "Catalonia", code: "CT", cities: [{ name: "Barcelona" }] },
3002
+ { name: "Andalusia", code: "AN", cities: [{ name: "Seville" }, { name: "Malaga" }, { name: "Granada" }] },
3003
+ { name: "Valencia", code: "VC", cities: [{ name: "Valencia" }] },
3004
+ { name: "Basque Country", code: "PV", cities: [{ name: "Bilbao" }, { name: "San Sebasti\xE1n" }] }
3005
+ ]
3006
+ },
3007
+ {
3008
+ name: "Sri Lanka",
3009
+ code: "LK",
3010
+ code3: "LKA",
3011
+ phoneCode: "+94",
3012
+ currency: "LKR",
3013
+ currencySymbol: "\u20A8",
3014
+ continent: "Asia",
3015
+ capital: "Colombo",
3016
+ timezone: "Asia/Colombo",
3017
+ states: [
3018
+ { name: "Western", code: "WP", cities: [{ name: "Colombo" }] },
3019
+ { name: "Central", code: "CP", cities: [{ name: "Kandy" }] },
3020
+ { name: "Southern", code: "SP", cities: [{ name: "Galle" }] }
3021
+ ]
3022
+ },
3023
+ {
3024
+ name: "Sweden",
3025
+ code: "SE",
3026
+ code3: "SWE",
3027
+ phoneCode: "+46",
3028
+ currency: "SEK",
3029
+ currencySymbol: "kr",
3030
+ continent: "Europe",
3031
+ capital: "Stockholm",
3032
+ timezone: "Europe/Stockholm",
3033
+ states: [
3034
+ { name: "Stockholm", code: "AB", cities: [{ name: "Stockholm" }] },
3035
+ { name: "V\xE4stra G\xF6taland", code: "VG", cities: [{ name: "Gothenburg" }] },
3036
+ { name: "Sk\xE5ne", code: "SK", cities: [{ name: "Malm\xF6" }] }
3037
+ ]
3038
+ },
3039
+ {
3040
+ name: "Switzerland",
3041
+ code: "CH",
3042
+ code3: "CHE",
3043
+ phoneCode: "+41",
3044
+ currency: "CHF",
3045
+ currencySymbol: "CHF",
3046
+ continent: "Europe",
3047
+ capital: "Bern",
3048
+ timezone: "Europe/Zurich",
3049
+ states: [
3050
+ { name: "Z\xFCrich", code: "ZH", cities: [{ name: "Z\xFCrich" }] },
3051
+ { name: "Geneva", code: "GE", cities: [{ name: "Geneva" }] },
3052
+ { name: "Bern", code: "BE", cities: [{ name: "Bern" }] },
3053
+ { name: "Basel-Stadt", code: "BS", cities: [{ name: "Basel" }] }
3054
+ ]
3055
+ },
3056
+ {
3057
+ name: "Taiwan",
3058
+ code: "TW",
3059
+ code3: "TWN",
3060
+ phoneCode: "+886",
3061
+ currency: "TWD",
3062
+ currencySymbol: "NT$",
3063
+ continent: "Asia",
3064
+ capital: "Taipei",
3065
+ timezone: "Asia/Taipei",
3066
+ states: [
3067
+ { name: "Taipei", code: "TPE", cities: [{ name: "Taipei" }, { name: "New Taipei" }] },
3068
+ { name: "Taichung", code: "TXG", cities: [{ name: "Taichung" }] },
3069
+ { name: "Kaohsiung", code: "KHH", cities: [{ name: "Kaohsiung" }] }
3070
+ ]
3071
+ },
3072
+ {
3073
+ name: "Thailand",
3074
+ code: "TH",
3075
+ code3: "THA",
3076
+ phoneCode: "+66",
3077
+ currency: "THB",
3078
+ currencySymbol: "\u0E3F",
3079
+ continent: "Asia",
3080
+ capital: "Bangkok",
3081
+ timezone: "Asia/Bangkok",
3082
+ states: [
3083
+ { name: "Bangkok", code: "BKK", cities: [{ name: "Bangkok" }] },
3084
+ { name: "Chiang Mai", code: "CNX", cities: [{ name: "Chiang Mai" }] },
3085
+ { name: "Phuket", code: "PKT", cities: [{ name: "Phuket" }] },
3086
+ { name: "Chonburi", code: "CBI", cities: [{ name: "Pattaya" }] }
3087
+ ]
3088
+ },
3089
+ {
3090
+ name: "Turkey",
3091
+ code: "TR",
3092
+ code3: "TUR",
3093
+ phoneCode: "+90",
3094
+ currency: "TRY",
3095
+ currencySymbol: "\u20BA",
3096
+ continent: "Asia",
3097
+ capital: "Ankara",
3098
+ timezone: "Europe/Istanbul",
3099
+ states: [
3100
+ { name: "Istanbul", code: "IST", cities: [{ name: "Istanbul" }] },
3101
+ { name: "Ankara", code: "ANK", cities: [{ name: "Ankara" }] },
3102
+ { name: "Izmir", code: "IZM", cities: [{ name: "Izmir" }] },
3103
+ { name: "Antalya", code: "ANT", cities: [{ name: "Antalya" }] }
3104
+ ]
3105
+ },
3106
+ {
3107
+ name: "Ukraine",
3108
+ code: "UA",
3109
+ code3: "UKR",
3110
+ phoneCode: "+380",
3111
+ currency: "UAH",
3112
+ currencySymbol: "\u20B4",
3113
+ continent: "Europe",
3114
+ capital: "Kyiv",
3115
+ timezone: "Europe/Kyiv",
3116
+ states: [
3117
+ { name: "Kyiv", code: "KY", cities: [{ name: "Kyiv" }] },
3118
+ { name: "Kharkiv", code: "KH", cities: [{ name: "Kharkiv" }] },
3119
+ { name: "Odessa", code: "OD", cities: [{ name: "Odessa" }] },
3120
+ { name: "Lviv", code: "LV", cities: [{ name: "Lviv" }] }
3121
+ ]
3122
+ },
3123
+ {
3124
+ name: "United Arab Emirates",
3125
+ code: "AE",
3126
+ code3: "ARE",
3127
+ phoneCode: "+971",
3128
+ currency: "AED",
3129
+ currencySymbol: "\u062F.\u0625",
3130
+ continent: "Asia",
3131
+ capital: "Abu Dhabi",
3132
+ timezone: "Asia/Dubai",
3133
+ states: [
3134
+ { name: "Dubai", code: "DU", cities: [{ name: "Dubai" }] },
3135
+ { name: "Abu Dhabi", code: "AZ", cities: [{ name: "Abu Dhabi" }] },
3136
+ { name: "Sharjah", code: "SH", cities: [{ name: "Sharjah" }] },
3137
+ { name: "Ajman", code: "AJ", cities: [{ name: "Ajman" }] }
3138
+ ]
3139
+ },
3140
+ {
3141
+ name: "United Kingdom",
3142
+ code: "GB",
3143
+ code3: "GBR",
3144
+ phoneCode: "+44",
3145
+ currency: "GBP",
3146
+ currencySymbol: "\xA3",
3147
+ continent: "Europe",
3148
+ capital: "London",
3149
+ timezone: "Europe/London",
3150
+ states: [
3151
+ { name: "England", code: "ENG", cities: [{ name: "London" }, { name: "Manchester" }, { name: "Birmingham" }, { name: "Liverpool" }, { name: "Leeds" }, { name: "Bristol" }] },
3152
+ { name: "Scotland", code: "SCT", cities: [{ name: "Edinburgh" }, { name: "Glasgow" }] },
3153
+ { name: "Wales", code: "WLS", cities: [{ name: "Cardiff" }, { name: "Swansea" }] },
3154
+ { name: "Northern Ireland", code: "NIR", cities: [{ name: "Belfast" }] }
3155
+ ]
3156
+ },
3157
+ {
3158
+ name: "United States",
3159
+ code: "US",
3160
+ code3: "USA",
3161
+ phoneCode: "+1",
3162
+ currency: "USD",
3163
+ currencySymbol: "$",
3164
+ continent: "North America",
3165
+ capital: "Washington, D.C.",
3166
+ timezone: "America/New_York",
3167
+ states: [
3168
+ { name: "California", code: "CA", cities: [{ name: "Los Angeles" }, { name: "San Francisco" }, { name: "San Diego" }, { name: "San Jose" }, { name: "Sacramento" }] },
3169
+ { name: "New York", code: "NY", cities: [{ name: "New York City" }, { name: "Buffalo" }, { name: "Albany" }] },
3170
+ { name: "Texas", code: "TX", cities: [{ name: "Houston" }, { name: "Dallas" }, { name: "Austin" }, { name: "San Antonio" }] },
3171
+ { name: "Florida", code: "FL", cities: [{ name: "Miami" }, { name: "Orlando" }, { name: "Tampa" }, { name: "Jacksonville" }] },
3172
+ { name: "Illinois", code: "IL", cities: [{ name: "Chicago" }] },
3173
+ { name: "Pennsylvania", code: "PA", cities: [{ name: "Philadelphia" }, { name: "Pittsburgh" }] },
3174
+ { name: "Ohio", code: "OH", cities: [{ name: "Columbus" }, { name: "Cleveland" }, { name: "Cincinnati" }] },
3175
+ { name: "Georgia", code: "GA", cities: [{ name: "Atlanta" }] },
3176
+ { name: "North Carolina", code: "NC", cities: [{ name: "Charlotte" }, { name: "Raleigh" }] },
3177
+ { name: "Michigan", code: "MI", cities: [{ name: "Detroit" }] },
3178
+ { name: "Washington", code: "WA", cities: [{ name: "Seattle" }] },
3179
+ { name: "Arizona", code: "AZ", cities: [{ name: "Phoenix" }, { name: "Tucson" }] },
3180
+ { name: "Massachusetts", code: "MA", cities: [{ name: "Boston" }, { name: "Cambridge" }] },
3181
+ { name: "Colorado", code: "CO", cities: [{ name: "Denver" }, { name: "Colorado Springs" }] },
3182
+ { name: "Nevada", code: "NV", cities: [{ name: "Las Vegas" }, { name: "Reno" }] },
3183
+ { name: "Oregon", code: "OR", cities: [{ name: "Portland" }] },
3184
+ { name: "District of Columbia", code: "DC", cities: [{ name: "Washington" }] }
3185
+ ]
3186
+ },
3187
+ {
3188
+ name: "Vietnam",
3189
+ code: "VN",
3190
+ code3: "VNM",
3191
+ phoneCode: "+84",
3192
+ currency: "VND",
3193
+ currencySymbol: "\u20AB",
3194
+ continent: "Asia",
3195
+ capital: "Hanoi",
3196
+ timezone: "Asia/Ho_Chi_Minh",
3197
+ states: [
3198
+ { name: "Ho Chi Minh City", code: "HCM", cities: [{ name: "Ho Chi Minh City" }] },
3199
+ { name: "Hanoi", code: "HAN", cities: [{ name: "Hanoi" }] },
3200
+ { name: "Da Nang", code: "DAN", cities: [{ name: "Da Nang" }] }
3201
+ ]
3202
+ }
3203
+ ];
3204
+ var getCountryByCode = (code) => {
3205
+ return countries.find((c) => c.code === code || c.code3 === code);
3206
+ };
3207
+ var getCountryByName = (name) => {
3208
+ return countries.find((c) => c.name.toLowerCase() === name.toLowerCase());
3209
+ };
3210
+ var getStatesByCountry = (countryCode) => {
3211
+ const country = getCountryByCode(countryCode);
3212
+ return country?.states || [];
3213
+ };
3214
+ var getCitiesByState = (countryCode, stateCode) => {
3215
+ const states = getStatesByCountry(countryCode);
3216
+ const state = states.find((s) => s.code === stateCode);
3217
+ return state?.cities || [];
3218
+ };
3219
+ var getAllCities = (countryCode) => {
3220
+ const states = getStatesByCountry(countryCode);
3221
+ return states.flatMap((s) => s.cities);
3222
+ };
3223
+ var getCountriesByContinent = (continent) => {
3224
+ return countries.filter((c) => c.continent.toLowerCase() === continent.toLowerCase());
3225
+ };
3226
+ var searchCountries = (query) => {
3227
+ const lowerQuery = query.toLowerCase();
3228
+ return countries.filter(
3229
+ (c) => c.name.toLowerCase().includes(lowerQuery) || c.code.toLowerCase() === lowerQuery || c.code3.toLowerCase() === lowerQuery
3230
+ );
3231
+ };
3232
+ var countries_default = countries;
3233
+
3234
+ // src/data/phone-codes.ts
3235
+ var phoneCodes = [
3236
+ { country: "Afghanistan", code: "AF", phoneCode: "+93", flag: "\u{1F1E6}\u{1F1EB}" },
3237
+ { country: "Albania", code: "AL", phoneCode: "+355", flag: "\u{1F1E6}\u{1F1F1}" },
3238
+ { country: "Algeria", code: "DZ", phoneCode: "+213", flag: "\u{1F1E9}\u{1F1FF}" },
3239
+ { country: "American Samoa", code: "AS", phoneCode: "+1684", flag: "\u{1F1E6}\u{1F1F8}" },
3240
+ { country: "Andorra", code: "AD", phoneCode: "+376", flag: "\u{1F1E6}\u{1F1E9}" },
3241
+ { country: "Angola", code: "AO", phoneCode: "+244", flag: "\u{1F1E6}\u{1F1F4}" },
3242
+ { country: "Anguilla", code: "AI", phoneCode: "+1264", flag: "\u{1F1E6}\u{1F1EE}" },
3243
+ { country: "Argentina", code: "AR", phoneCode: "+54", flag: "\u{1F1E6}\u{1F1F7}" },
3244
+ { country: "Armenia", code: "AM", phoneCode: "+374", flag: "\u{1F1E6}\u{1F1F2}" },
3245
+ { country: "Australia", code: "AU", phoneCode: "+61", flag: "\u{1F1E6}\u{1F1FA}" },
3246
+ { country: "Austria", code: "AT", phoneCode: "+43", flag: "\u{1F1E6}\u{1F1F9}" },
3247
+ { country: "Azerbaijan", code: "AZ", phoneCode: "+994", flag: "\u{1F1E6}\u{1F1FF}" },
3248
+ { country: "Bahamas", code: "BS", phoneCode: "+1242", flag: "\u{1F1E7}\u{1F1F8}" },
3249
+ { country: "Bahrain", code: "BH", phoneCode: "+973", flag: "\u{1F1E7}\u{1F1ED}" },
3250
+ { country: "Bangladesh", code: "BD", phoneCode: "+880", flag: "\u{1F1E7}\u{1F1E9}" },
3251
+ { country: "Barbados", code: "BB", phoneCode: "+1246", flag: "\u{1F1E7}\u{1F1E7}" },
3252
+ { country: "Belarus", code: "BY", phoneCode: "+375", flag: "\u{1F1E7}\u{1F1FE}" },
3253
+ { country: "Belgium", code: "BE", phoneCode: "+32", flag: "\u{1F1E7}\u{1F1EA}" },
3254
+ { country: "Belize", code: "BZ", phoneCode: "+501", flag: "\u{1F1E7}\u{1F1FF}" },
3255
+ { country: "Benin", code: "BJ", phoneCode: "+229", flag: "\u{1F1E7}\u{1F1EF}" },
3256
+ { country: "Bermuda", code: "BM", phoneCode: "+1441", flag: "\u{1F1E7}\u{1F1F2}" },
3257
+ { country: "Bhutan", code: "BT", phoneCode: "+975", flag: "\u{1F1E7}\u{1F1F9}" },
3258
+ { country: "Bolivia", code: "BO", phoneCode: "+591", flag: "\u{1F1E7}\u{1F1F4}" },
3259
+ { country: "Bosnia and Herzegovina", code: "BA", phoneCode: "+387", flag: "\u{1F1E7}\u{1F1E6}" },
3260
+ { country: "Botswana", code: "BW", phoneCode: "+267", flag: "\u{1F1E7}\u{1F1FC}" },
3261
+ { country: "Brazil", code: "BR", phoneCode: "+55", flag: "\u{1F1E7}\u{1F1F7}" },
3262
+ { country: "Brunei", code: "BN", phoneCode: "+673", flag: "\u{1F1E7}\u{1F1F3}" },
3263
+ { country: "Bulgaria", code: "BG", phoneCode: "+359", flag: "\u{1F1E7}\u{1F1EC}" },
3264
+ { country: "Burkina Faso", code: "BF", phoneCode: "+226", flag: "\u{1F1E7}\u{1F1EB}" },
3265
+ { country: "Burundi", code: "BI", phoneCode: "+257", flag: "\u{1F1E7}\u{1F1EE}" },
3266
+ { country: "Cambodia", code: "KH", phoneCode: "+855", flag: "\u{1F1F0}\u{1F1ED}" },
3267
+ { country: "Cameroon", code: "CM", phoneCode: "+237", flag: "\u{1F1E8}\u{1F1F2}" },
3268
+ { country: "Canada", code: "CA", phoneCode: "+1", flag: "\u{1F1E8}\u{1F1E6}" },
3269
+ { country: "Cape Verde", code: "CV", phoneCode: "+238", flag: "\u{1F1E8}\u{1F1FB}" },
3270
+ { country: "Cayman Islands", code: "KY", phoneCode: "+1345", flag: "\u{1F1F0}\u{1F1FE}" },
3271
+ { country: "Central African Republic", code: "CF", phoneCode: "+236", flag: "\u{1F1E8}\u{1F1EB}" },
3272
+ { country: "Chad", code: "TD", phoneCode: "+235", flag: "\u{1F1F9}\u{1F1E9}" },
3273
+ { country: "Chile", code: "CL", phoneCode: "+56", flag: "\u{1F1E8}\u{1F1F1}" },
3274
+ { country: "China", code: "CN", phoneCode: "+86", flag: "\u{1F1E8}\u{1F1F3}" },
3275
+ { country: "Colombia", code: "CO", phoneCode: "+57", flag: "\u{1F1E8}\u{1F1F4}" },
3276
+ { country: "Comoros", code: "KM", phoneCode: "+269", flag: "\u{1F1F0}\u{1F1F2}" },
3277
+ { country: "Congo", code: "CG", phoneCode: "+242", flag: "\u{1F1E8}\u{1F1EC}" },
3278
+ { country: "Costa Rica", code: "CR", phoneCode: "+506", flag: "\u{1F1E8}\u{1F1F7}" },
3279
+ { country: "Croatia", code: "HR", phoneCode: "+385", flag: "\u{1F1ED}\u{1F1F7}" },
3280
+ { country: "Cuba", code: "CU", phoneCode: "+53", flag: "\u{1F1E8}\u{1F1FA}" },
3281
+ { country: "Cyprus", code: "CY", phoneCode: "+357", flag: "\u{1F1E8}\u{1F1FE}" },
3282
+ { country: "Czech Republic", code: "CZ", phoneCode: "+420", flag: "\u{1F1E8}\u{1F1FF}" },
3283
+ { country: "Denmark", code: "DK", phoneCode: "+45", flag: "\u{1F1E9}\u{1F1F0}" },
3284
+ { country: "Djibouti", code: "DJ", phoneCode: "+253", flag: "\u{1F1E9}\u{1F1EF}" },
3285
+ { country: "Dominica", code: "DM", phoneCode: "+1767", flag: "\u{1F1E9}\u{1F1F2}" },
3286
+ { country: "Dominican Republic", code: "DO", phoneCode: "+1809", flag: "\u{1F1E9}\u{1F1F4}" },
3287
+ { country: "Ecuador", code: "EC", phoneCode: "+593", flag: "\u{1F1EA}\u{1F1E8}" },
3288
+ { country: "Egypt", code: "EG", phoneCode: "+20", flag: "\u{1F1EA}\u{1F1EC}" },
3289
+ { country: "El Salvador", code: "SV", phoneCode: "+503", flag: "\u{1F1F8}\u{1F1FB}" },
3290
+ { country: "Equatorial Guinea", code: "GQ", phoneCode: "+240", flag: "\u{1F1EC}\u{1F1F6}" },
3291
+ { country: "Eritrea", code: "ER", phoneCode: "+291", flag: "\u{1F1EA}\u{1F1F7}" },
3292
+ { country: "Estonia", code: "EE", phoneCode: "+372", flag: "\u{1F1EA}\u{1F1EA}" },
3293
+ { country: "Ethiopia", code: "ET", phoneCode: "+251", flag: "\u{1F1EA}\u{1F1F9}" },
3294
+ { country: "Fiji", code: "FJ", phoneCode: "+679", flag: "\u{1F1EB}\u{1F1EF}" },
3295
+ { country: "Finland", code: "FI", phoneCode: "+358", flag: "\u{1F1EB}\u{1F1EE}" },
3296
+ { country: "France", code: "FR", phoneCode: "+33", flag: "\u{1F1EB}\u{1F1F7}" },
3297
+ { country: "Gabon", code: "GA", phoneCode: "+241", flag: "\u{1F1EC}\u{1F1E6}" },
3298
+ { country: "Gambia", code: "GM", phoneCode: "+220", flag: "\u{1F1EC}\u{1F1F2}" },
3299
+ { country: "Georgia", code: "GE", phoneCode: "+995", flag: "\u{1F1EC}\u{1F1EA}" },
3300
+ { country: "Germany", code: "DE", phoneCode: "+49", flag: "\u{1F1E9}\u{1F1EA}" },
3301
+ { country: "Ghana", code: "GH", phoneCode: "+233", flag: "\u{1F1EC}\u{1F1ED}" },
3302
+ { country: "Greece", code: "GR", phoneCode: "+30", flag: "\u{1F1EC}\u{1F1F7}" },
3303
+ { country: "Greenland", code: "GL", phoneCode: "+299", flag: "\u{1F1EC}\u{1F1F1}" },
3304
+ { country: "Grenada", code: "GD", phoneCode: "+1473", flag: "\u{1F1EC}\u{1F1E9}" },
3305
+ { country: "Guam", code: "GU", phoneCode: "+1671", flag: "\u{1F1EC}\u{1F1FA}" },
3306
+ { country: "Guatemala", code: "GT", phoneCode: "+502", flag: "\u{1F1EC}\u{1F1F9}" },
3307
+ { country: "Guinea", code: "GN", phoneCode: "+224", flag: "\u{1F1EC}\u{1F1F3}" },
3308
+ { country: "Guyana", code: "GY", phoneCode: "+592", flag: "\u{1F1EC}\u{1F1FE}" },
3309
+ { country: "Haiti", code: "HT", phoneCode: "+509", flag: "\u{1F1ED}\u{1F1F9}" },
3310
+ { country: "Honduras", code: "HN", phoneCode: "+504", flag: "\u{1F1ED}\u{1F1F3}" },
3311
+ { country: "Hong Kong", code: "HK", phoneCode: "+852", flag: "\u{1F1ED}\u{1F1F0}" },
3312
+ { country: "Hungary", code: "HU", phoneCode: "+36", flag: "\u{1F1ED}\u{1F1FA}" },
3313
+ { country: "Iceland", code: "IS", phoneCode: "+354", flag: "\u{1F1EE}\u{1F1F8}" },
3314
+ { country: "India", code: "IN", phoneCode: "+91", flag: "\u{1F1EE}\u{1F1F3}" },
3315
+ { country: "Indonesia", code: "ID", phoneCode: "+62", flag: "\u{1F1EE}\u{1F1E9}" },
3316
+ { country: "Iran", code: "IR", phoneCode: "+98", flag: "\u{1F1EE}\u{1F1F7}" },
3317
+ { country: "Iraq", code: "IQ", phoneCode: "+964", flag: "\u{1F1EE}\u{1F1F6}" },
3318
+ { country: "Ireland", code: "IE", phoneCode: "+353", flag: "\u{1F1EE}\u{1F1EA}" },
3319
+ { country: "Israel", code: "IL", phoneCode: "+972", flag: "\u{1F1EE}\u{1F1F1}" },
3320
+ { country: "Italy", code: "IT", phoneCode: "+39", flag: "\u{1F1EE}\u{1F1F9}" },
3321
+ { country: "Jamaica", code: "JM", phoneCode: "+1876", flag: "\u{1F1EF}\u{1F1F2}" },
3322
+ { country: "Japan", code: "JP", phoneCode: "+81", flag: "\u{1F1EF}\u{1F1F5}" },
3323
+ { country: "Jordan", code: "JO", phoneCode: "+962", flag: "\u{1F1EF}\u{1F1F4}" },
3324
+ { country: "Kazakhstan", code: "KZ", phoneCode: "+7", flag: "\u{1F1F0}\u{1F1FF}" },
3325
+ { country: "Kenya", code: "KE", phoneCode: "+254", flag: "\u{1F1F0}\u{1F1EA}" },
3326
+ { country: "Kiribati", code: "KI", phoneCode: "+686", flag: "\u{1F1F0}\u{1F1EE}" },
3327
+ { country: "Kuwait", code: "KW", phoneCode: "+965", flag: "\u{1F1F0}\u{1F1FC}" },
3328
+ { country: "Kyrgyzstan", code: "KG", phoneCode: "+996", flag: "\u{1F1F0}\u{1F1EC}" },
3329
+ { country: "Laos", code: "LA", phoneCode: "+856", flag: "\u{1F1F1}\u{1F1E6}" },
3330
+ { country: "Latvia", code: "LV", phoneCode: "+371", flag: "\u{1F1F1}\u{1F1FB}" },
3331
+ { country: "Lebanon", code: "LB", phoneCode: "+961", flag: "\u{1F1F1}\u{1F1E7}" },
3332
+ { country: "Lesotho", code: "LS", phoneCode: "+266", flag: "\u{1F1F1}\u{1F1F8}" },
3333
+ { country: "Liberia", code: "LR", phoneCode: "+231", flag: "\u{1F1F1}\u{1F1F7}" },
3334
+ { country: "Libya", code: "LY", phoneCode: "+218", flag: "\u{1F1F1}\u{1F1FE}" },
3335
+ { country: "Liechtenstein", code: "LI", phoneCode: "+423", flag: "\u{1F1F1}\u{1F1EE}" },
3336
+ { country: "Lithuania", code: "LT", phoneCode: "+370", flag: "\u{1F1F1}\u{1F1F9}" },
3337
+ { country: "Luxembourg", code: "LU", phoneCode: "+352", flag: "\u{1F1F1}\u{1F1FA}" },
3338
+ { country: "Macau", code: "MO", phoneCode: "+853", flag: "\u{1F1F2}\u{1F1F4}" },
3339
+ { country: "Madagascar", code: "MG", phoneCode: "+261", flag: "\u{1F1F2}\u{1F1EC}" },
3340
+ { country: "Malawi", code: "MW", phoneCode: "+265", flag: "\u{1F1F2}\u{1F1FC}" },
3341
+ { country: "Malaysia", code: "MY", phoneCode: "+60", flag: "\u{1F1F2}\u{1F1FE}" },
3342
+ { country: "Maldives", code: "MV", phoneCode: "+960", flag: "\u{1F1F2}\u{1F1FB}" },
3343
+ { country: "Mali", code: "ML", phoneCode: "+223", flag: "\u{1F1F2}\u{1F1F1}" },
3344
+ { country: "Malta", code: "MT", phoneCode: "+356", flag: "\u{1F1F2}\u{1F1F9}" },
3345
+ { country: "Mauritania", code: "MR", phoneCode: "+222", flag: "\u{1F1F2}\u{1F1F7}" },
3346
+ { country: "Mauritius", code: "MU", phoneCode: "+230", flag: "\u{1F1F2}\u{1F1FA}" },
3347
+ { country: "Mexico", code: "MX", phoneCode: "+52", flag: "\u{1F1F2}\u{1F1FD}" },
3348
+ { country: "Moldova", code: "MD", phoneCode: "+373", flag: "\u{1F1F2}\u{1F1E9}" },
3349
+ { country: "Monaco", code: "MC", phoneCode: "+377", flag: "\u{1F1F2}\u{1F1E8}" },
3350
+ { country: "Mongolia", code: "MN", phoneCode: "+976", flag: "\u{1F1F2}\u{1F1F3}" },
3351
+ { country: "Montenegro", code: "ME", phoneCode: "+382", flag: "\u{1F1F2}\u{1F1EA}" },
3352
+ { country: "Morocco", code: "MA", phoneCode: "+212", flag: "\u{1F1F2}\u{1F1E6}" },
3353
+ { country: "Mozambique", code: "MZ", phoneCode: "+258", flag: "\u{1F1F2}\u{1F1FF}" },
3354
+ { country: "Myanmar", code: "MM", phoneCode: "+95", flag: "\u{1F1F2}\u{1F1F2}" },
3355
+ { country: "Namibia", code: "NA", phoneCode: "+264", flag: "\u{1F1F3}\u{1F1E6}" },
3356
+ { country: "Nauru", code: "NR", phoneCode: "+674", flag: "\u{1F1F3}\u{1F1F7}" },
3357
+ { country: "Nepal", code: "NP", phoneCode: "+977", flag: "\u{1F1F3}\u{1F1F5}" },
3358
+ { country: "Netherlands", code: "NL", phoneCode: "+31", flag: "\u{1F1F3}\u{1F1F1}" },
3359
+ { country: "New Zealand", code: "NZ", phoneCode: "+64", flag: "\u{1F1F3}\u{1F1FF}" },
3360
+ { country: "Nicaragua", code: "NI", phoneCode: "+505", flag: "\u{1F1F3}\u{1F1EE}" },
3361
+ { country: "Niger", code: "NE", phoneCode: "+227", flag: "\u{1F1F3}\u{1F1EA}" },
3362
+ { country: "Nigeria", code: "NG", phoneCode: "+234", flag: "\u{1F1F3}\u{1F1EC}" },
3363
+ { country: "North Korea", code: "KP", phoneCode: "+850", flag: "\u{1F1F0}\u{1F1F5}" },
3364
+ { country: "North Macedonia", code: "MK", phoneCode: "+389", flag: "\u{1F1F2}\u{1F1F0}" },
3365
+ { country: "Norway", code: "NO", phoneCode: "+47", flag: "\u{1F1F3}\u{1F1F4}" },
3366
+ { country: "Oman", code: "OM", phoneCode: "+968", flag: "\u{1F1F4}\u{1F1F2}" },
3367
+ { country: "Pakistan", code: "PK", phoneCode: "+92", flag: "\u{1F1F5}\u{1F1F0}" },
3368
+ { country: "Palau", code: "PW", phoneCode: "+680", flag: "\u{1F1F5}\u{1F1FC}" },
3369
+ { country: "Palestine", code: "PS", phoneCode: "+970", flag: "\u{1F1F5}\u{1F1F8}" },
3370
+ { country: "Panama", code: "PA", phoneCode: "+507", flag: "\u{1F1F5}\u{1F1E6}" },
3371
+ { country: "Papua New Guinea", code: "PG", phoneCode: "+675", flag: "\u{1F1F5}\u{1F1EC}" },
3372
+ { country: "Paraguay", code: "PY", phoneCode: "+595", flag: "\u{1F1F5}\u{1F1FE}" },
3373
+ { country: "Peru", code: "PE", phoneCode: "+51", flag: "\u{1F1F5}\u{1F1EA}" },
3374
+ { country: "Philippines", code: "PH", phoneCode: "+63", flag: "\u{1F1F5}\u{1F1ED}" },
3375
+ { country: "Poland", code: "PL", phoneCode: "+48", flag: "\u{1F1F5}\u{1F1F1}" },
3376
+ { country: "Portugal", code: "PT", phoneCode: "+351", flag: "\u{1F1F5}\u{1F1F9}" },
3377
+ { country: "Puerto Rico", code: "PR", phoneCode: "+1787", flag: "\u{1F1F5}\u{1F1F7}" },
3378
+ { country: "Qatar", code: "QA", phoneCode: "+974", flag: "\u{1F1F6}\u{1F1E6}" },
3379
+ { country: "Romania", code: "RO", phoneCode: "+40", flag: "\u{1F1F7}\u{1F1F4}" },
3380
+ { country: "Russia", code: "RU", phoneCode: "+7", flag: "\u{1F1F7}\u{1F1FA}" },
3381
+ { country: "Rwanda", code: "RW", phoneCode: "+250", flag: "\u{1F1F7}\u{1F1FC}" },
3382
+ { country: "Saudi Arabia", code: "SA", phoneCode: "+966", flag: "\u{1F1F8}\u{1F1E6}" },
3383
+ { country: "Senegal", code: "SN", phoneCode: "+221", flag: "\u{1F1F8}\u{1F1F3}" },
3384
+ { country: "Serbia", code: "RS", phoneCode: "+381", flag: "\u{1F1F7}\u{1F1F8}" },
3385
+ { country: "Seychelles", code: "SC", phoneCode: "+248", flag: "\u{1F1F8}\u{1F1E8}" },
3386
+ { country: "Sierra Leone", code: "SL", phoneCode: "+232", flag: "\u{1F1F8}\u{1F1F1}" },
3387
+ { country: "Singapore", code: "SG", phoneCode: "+65", flag: "\u{1F1F8}\u{1F1EC}" },
3388
+ { country: "Slovakia", code: "SK", phoneCode: "+421", flag: "\u{1F1F8}\u{1F1F0}" },
3389
+ { country: "Slovenia", code: "SI", phoneCode: "+386", flag: "\u{1F1F8}\u{1F1EE}" },
3390
+ { country: "Solomon Islands", code: "SB", phoneCode: "+677", flag: "\u{1F1F8}\u{1F1E7}" },
3391
+ { country: "Somalia", code: "SO", phoneCode: "+252", flag: "\u{1F1F8}\u{1F1F4}" },
3392
+ { country: "South Africa", code: "ZA", phoneCode: "+27", flag: "\u{1F1FF}\u{1F1E6}" },
3393
+ { country: "South Korea", code: "KR", phoneCode: "+82", flag: "\u{1F1F0}\u{1F1F7}" },
3394
+ { country: "South Sudan", code: "SS", phoneCode: "+211", flag: "\u{1F1F8}\u{1F1F8}" },
3395
+ { country: "Spain", code: "ES", phoneCode: "+34", flag: "\u{1F1EA}\u{1F1F8}" },
3396
+ { country: "Sri Lanka", code: "LK", phoneCode: "+94", flag: "\u{1F1F1}\u{1F1F0}" },
3397
+ { country: "Sudan", code: "SD", phoneCode: "+249", flag: "\u{1F1F8}\u{1F1E9}" },
3398
+ { country: "Suriname", code: "SR", phoneCode: "+597", flag: "\u{1F1F8}\u{1F1F7}" },
3399
+ { country: "Sweden", code: "SE", phoneCode: "+46", flag: "\u{1F1F8}\u{1F1EA}" },
3400
+ { country: "Switzerland", code: "CH", phoneCode: "+41", flag: "\u{1F1E8}\u{1F1ED}" },
3401
+ { country: "Syria", code: "SY", phoneCode: "+963", flag: "\u{1F1F8}\u{1F1FE}" },
3402
+ { country: "Taiwan", code: "TW", phoneCode: "+886", flag: "\u{1F1F9}\u{1F1FC}" },
3403
+ { country: "Tajikistan", code: "TJ", phoneCode: "+992", flag: "\u{1F1F9}\u{1F1EF}" },
3404
+ { country: "Tanzania", code: "TZ", phoneCode: "+255", flag: "\u{1F1F9}\u{1F1FF}" },
3405
+ { country: "Thailand", code: "TH", phoneCode: "+66", flag: "\u{1F1F9}\u{1F1ED}" },
3406
+ { country: "Togo", code: "TG", phoneCode: "+228", flag: "\u{1F1F9}\u{1F1EC}" },
3407
+ { country: "Tonga", code: "TO", phoneCode: "+676", flag: "\u{1F1F9}\u{1F1F4}" },
3408
+ { country: "Trinidad and Tobago", code: "TT", phoneCode: "+1868", flag: "\u{1F1F9}\u{1F1F9}" },
3409
+ { country: "Tunisia", code: "TN", phoneCode: "+216", flag: "\u{1F1F9}\u{1F1F3}" },
3410
+ { country: "Turkey", code: "TR", phoneCode: "+90", flag: "\u{1F1F9}\u{1F1F7}" },
3411
+ { country: "Turkmenistan", code: "TM", phoneCode: "+993", flag: "\u{1F1F9}\u{1F1F2}" },
3412
+ { country: "Tuvalu", code: "TV", phoneCode: "+688", flag: "\u{1F1F9}\u{1F1FB}" },
3413
+ { country: "Uganda", code: "UG", phoneCode: "+256", flag: "\u{1F1FA}\u{1F1EC}" },
3414
+ { country: "Ukraine", code: "UA", phoneCode: "+380", flag: "\u{1F1FA}\u{1F1E6}" },
3415
+ { country: "United Arab Emirates", code: "AE", phoneCode: "+971", flag: "\u{1F1E6}\u{1F1EA}" },
3416
+ { country: "United Kingdom", code: "GB", phoneCode: "+44", flag: "\u{1F1EC}\u{1F1E7}" },
3417
+ { country: "United States", code: "US", phoneCode: "+1", flag: "\u{1F1FA}\u{1F1F8}" },
3418
+ { country: "Uruguay", code: "UY", phoneCode: "+598", flag: "\u{1F1FA}\u{1F1FE}" },
3419
+ { country: "Uzbekistan", code: "UZ", phoneCode: "+998", flag: "\u{1F1FA}\u{1F1FF}" },
3420
+ { country: "Vanuatu", code: "VU", phoneCode: "+678", flag: "\u{1F1FB}\u{1F1FA}" },
3421
+ { country: "Vatican City", code: "VA", phoneCode: "+379", flag: "\u{1F1FB}\u{1F1E6}" },
3422
+ { country: "Venezuela", code: "VE", phoneCode: "+58", flag: "\u{1F1FB}\u{1F1EA}" },
3423
+ { country: "Vietnam", code: "VN", phoneCode: "+84", flag: "\u{1F1FB}\u{1F1F3}" },
3424
+ { country: "Yemen", code: "YE", phoneCode: "+967", flag: "\u{1F1FE}\u{1F1EA}" },
3425
+ { country: "Zambia", code: "ZM", phoneCode: "+260", flag: "\u{1F1FF}\u{1F1F2}" },
3426
+ { country: "Zimbabwe", code: "ZW", phoneCode: "+263", flag: "\u{1F1FF}\u{1F1FC}" }
3427
+ ];
3428
+ var getPhoneCodeByCountry = (countryCode) => {
3429
+ return phoneCodes.find((p) => p.code === countryCode);
3430
+ };
3431
+ var searchPhoneCodes = (query) => {
3432
+ const lowerQuery = query.toLowerCase();
3433
+ return phoneCodes.filter(
3434
+ (p) => p.country.toLowerCase().includes(lowerQuery) || p.code.toLowerCase() === lowerQuery || p.phoneCode.includes(query)
3435
+ );
3436
+ };
3437
+ var getPhoneCodesByPrefix = (prefix) => {
3438
+ return phoneCodes.filter((p) => p.phoneCode.startsWith(prefix));
3439
+ };
3440
+ var phone_codes_default = phoneCodes;
3441
+
3442
+ // src/data/currencies.ts
3443
+ var currencies = [
3444
+ { code: "AED", name: "UAE Dirham", symbol: "AED", symbolNative: "\u062F.\u0625", decimalDigits: 2, rounding: 0, namePlural: "UAE dirhams" },
3445
+ { code: "AFN", name: "Afghan Afghani", symbol: "Af", symbolNative: "\u060B", decimalDigits: 0, rounding: 0, namePlural: "Afghan Afghanis" },
3446
+ { code: "ALL", name: "Albanian Lek", symbol: "ALL", symbolNative: "Lek", decimalDigits: 0, rounding: 0, namePlural: "Albanian lek\xEB" },
3447
+ { code: "AMD", name: "Armenian Dram", symbol: "AMD", symbolNative: "\u0564\u0580.", decimalDigits: 0, rounding: 0, namePlural: "Armenian drams" },
3448
+ { code: "ARS", name: "Argentine Peso", symbol: "AR$", symbolNative: "$", decimalDigits: 2, rounding: 0, namePlural: "Argentine pesos" },
3449
+ { code: "AUD", name: "Australian Dollar", symbol: "AU$", symbolNative: "$", decimalDigits: 2, rounding: 0, namePlural: "Australian dollars" },
3450
+ { code: "AZN", name: "Azerbaijani Manat", symbol: "man.", symbolNative: "\u043C\u0430\u043D.", decimalDigits: 2, rounding: 0, namePlural: "Azerbaijani manats" },
3451
+ { code: "BAM", name: "Bosnia-Herzegovina Convertible Mark", symbol: "KM", symbolNative: "KM", decimalDigits: 2, rounding: 0, namePlural: "Bosnia-Herzegovina convertible marks" },
3452
+ { code: "BDT", name: "Bangladeshi Taka", symbol: "Tk", symbolNative: "\u09F3", decimalDigits: 2, rounding: 0, namePlural: "Bangladeshi takas" },
3453
+ { code: "BGN", name: "Bulgarian Lev", symbol: "BGN", symbolNative: "\u043B\u0432.", decimalDigits: 2, rounding: 0, namePlural: "Bulgarian leva" },
3454
+ { code: "BHD", name: "Bahraini Dinar", symbol: "BD", symbolNative: "\u062F.\u0628.", decimalDigits: 3, rounding: 0, namePlural: "Bahraini dinars" },
3455
+ { code: "BIF", name: "Burundian Franc", symbol: "FBu", symbolNative: "FBu", decimalDigits: 0, rounding: 0, namePlural: "Burundian francs" },
3456
+ { code: "BND", name: "Brunei Dollar", symbol: "BN$", symbolNative: "$", decimalDigits: 2, rounding: 0, namePlural: "Brunei dollars" },
3457
+ { code: "BOB", name: "Bolivian Boliviano", symbol: "Bs", symbolNative: "Bs", decimalDigits: 2, rounding: 0, namePlural: "Bolivian bolivianos" },
3458
+ { code: "BRL", name: "Brazilian Real", symbol: "R$", symbolNative: "R$", decimalDigits: 2, rounding: 0, namePlural: "Brazilian reals" },
3459
+ { code: "BWP", name: "Botswanan Pula", symbol: "BWP", symbolNative: "P", decimalDigits: 2, rounding: 0, namePlural: "Botswanan pulas" },
3460
+ { code: "BYN", name: "Belarusian Ruble", symbol: "Br", symbolNative: "\u0440\u0443\u0431.", decimalDigits: 2, rounding: 0, namePlural: "Belarusian rubles" },
3461
+ { code: "BZD", name: "Belize Dollar", symbol: "BZ$", symbolNative: "$", decimalDigits: 2, rounding: 0, namePlural: "Belize dollars" },
3462
+ { code: "CAD", name: "Canadian Dollar", symbol: "CA$", symbolNative: "$", decimalDigits: 2, rounding: 0, namePlural: "Canadian dollars" },
3463
+ { code: "CDF", name: "Congolese Franc", symbol: "CDF", symbolNative: "FrCD", decimalDigits: 2, rounding: 0, namePlural: "Congolese francs" },
3464
+ { code: "CHF", name: "Swiss Franc", symbol: "CHF", symbolNative: "CHF", decimalDigits: 2, rounding: 0.05, namePlural: "Swiss francs" },
3465
+ { code: "CLP", name: "Chilean Peso", symbol: "CL$", symbolNative: "$", decimalDigits: 0, rounding: 0, namePlural: "Chilean pesos" },
3466
+ { code: "CNY", name: "Chinese Yuan", symbol: "CN\xA5", symbolNative: "\xA5", decimalDigits: 2, rounding: 0, namePlural: "Chinese yuan" },
3467
+ { code: "COP", name: "Colombian Peso", symbol: "CO$", symbolNative: "$", decimalDigits: 0, rounding: 0, namePlural: "Colombian pesos" },
3468
+ { code: "CRC", name: "Costa Rican Col\xF3n", symbol: "\u20A1", symbolNative: "\u20A1", decimalDigits: 0, rounding: 0, namePlural: "Costa Rican col\xF3ns" },
3469
+ { code: "CZK", name: "Czech Koruna", symbol: "K\u010D", symbolNative: "K\u010D", decimalDigits: 2, rounding: 0, namePlural: "Czech korunas" },
3470
+ { code: "DKK", name: "Danish Krone", symbol: "Dkr", symbolNative: "kr", decimalDigits: 2, rounding: 0, namePlural: "Danish kroner" },
3471
+ { code: "DOP", name: "Dominican Peso", symbol: "RD$", symbolNative: "RD$", decimalDigits: 2, rounding: 0, namePlural: "Dominican pesos" },
3472
+ { code: "DZD", name: "Algerian Dinar", symbol: "DA", symbolNative: "\u062F.\u062C.", decimalDigits: 2, rounding: 0, namePlural: "Algerian dinars" },
3473
+ { code: "EGP", name: "Egyptian Pound", symbol: "EGP", symbolNative: "\u062C.\u0645.", decimalDigits: 2, rounding: 0, namePlural: "Egyptian pounds" },
3474
+ { code: "ETB", name: "Ethiopian Birr", symbol: "Br", symbolNative: "Br", decimalDigits: 2, rounding: 0, namePlural: "Ethiopian birrs" },
3475
+ { code: "EUR", name: "Euro", symbol: "\u20AC", symbolNative: "\u20AC", decimalDigits: 2, rounding: 0, namePlural: "euros" },
3476
+ { code: "GBP", name: "British Pound", symbol: "\xA3", symbolNative: "\xA3", decimalDigits: 2, rounding: 0, namePlural: "British pounds" },
3477
+ { code: "GEL", name: "Georgian Lari", symbol: "GEL", symbolNative: "GEL", decimalDigits: 2, rounding: 0, namePlural: "Georgian laris" },
3478
+ { code: "GHS", name: "Ghanaian Cedi", symbol: "GH\u20B5", symbolNative: "GH\u20B5", decimalDigits: 2, rounding: 0, namePlural: "Ghanaian cedis" },
3479
+ { code: "GNF", name: "Guinean Franc", symbol: "FG", symbolNative: "FG", decimalDigits: 0, rounding: 0, namePlural: "Guinean francs" },
3480
+ { code: "GTQ", name: "Guatemalan Quetzal", symbol: "GTQ", symbolNative: "Q", decimalDigits: 2, rounding: 0, namePlural: "Guatemalan quetzals" },
3481
+ { code: "HKD", name: "Hong Kong Dollar", symbol: "HK$", symbolNative: "$", decimalDigits: 2, rounding: 0, namePlural: "Hong Kong dollars" },
3482
+ { code: "HNL", name: "Honduran Lempira", symbol: "HNL", symbolNative: "L", decimalDigits: 2, rounding: 0, namePlural: "Honduran lempiras" },
3483
+ { code: "HRK", name: "Croatian Kuna", symbol: "kn", symbolNative: "kn", decimalDigits: 2, rounding: 0, namePlural: "Croatian kunas" },
3484
+ { code: "HUF", name: "Hungarian Forint", symbol: "Ft", symbolNative: "Ft", decimalDigits: 0, rounding: 0, namePlural: "Hungarian forints" },
3485
+ { code: "IDR", name: "Indonesian Rupiah", symbol: "Rp", symbolNative: "Rp", decimalDigits: 0, rounding: 0, namePlural: "Indonesian rupiahs" },
3486
+ { code: "ILS", name: "Israeli New Shekel", symbol: "\u20AA", symbolNative: "\u20AA", decimalDigits: 2, rounding: 0, namePlural: "Israeli new shekels" },
3487
+ { code: "INR", name: "Indian Rupee", symbol: "\u20B9", symbolNative: "\u20B9", decimalDigits: 2, rounding: 0, namePlural: "Indian rupees" },
3488
+ { code: "IQD", name: "Iraqi Dinar", symbol: "IQD", symbolNative: "\u062F.\u0639.", decimalDigits: 0, rounding: 0, namePlural: "Iraqi dinars" },
3489
+ { code: "IRR", name: "Iranian Rial", symbol: "IRR", symbolNative: "\uFDFC", decimalDigits: 0, rounding: 0, namePlural: "Iranian rials" },
3490
+ { code: "ISK", name: "Icelandic Kr\xF3na", symbol: "Ikr", symbolNative: "kr", decimalDigits: 0, rounding: 0, namePlural: "Icelandic kr\xF3nur" },
3491
+ { code: "JMD", name: "Jamaican Dollar", symbol: "J$", symbolNative: "$", decimalDigits: 2, rounding: 0, namePlural: "Jamaican dollars" },
3492
+ { code: "JOD", name: "Jordanian Dinar", symbol: "JD", symbolNative: "\u062F.\u0623.", decimalDigits: 3, rounding: 0, namePlural: "Jordanian dinars" },
3493
+ { code: "JPY", name: "Japanese Yen", symbol: "\xA5", symbolNative: "\uFFE5", decimalDigits: 0, rounding: 0, namePlural: "Japanese yen" },
3494
+ { code: "KES", name: "Kenyan Shilling", symbol: "Ksh", symbolNative: "Ksh", decimalDigits: 2, rounding: 0, namePlural: "Kenyan shillings" },
3495
+ { code: "KHR", name: "Cambodian Riel", symbol: "KHR", symbolNative: "\u17DB", decimalDigits: 2, rounding: 0, namePlural: "Cambodian riels" },
3496
+ { code: "KRW", name: "South Korean Won", symbol: "\u20A9", symbolNative: "\u20A9", decimalDigits: 0, rounding: 0, namePlural: "South Korean won" },
3497
+ { code: "KWD", name: "Kuwaiti Dinar", symbol: "KD", symbolNative: "\u062F.\u0643.", decimalDigits: 3, rounding: 0, namePlural: "Kuwaiti dinars" },
3498
+ { code: "KZT", name: "Kazakhstani Tenge", symbol: "KZT", symbolNative: "\u0442\u04A3\u0433.", decimalDigits: 2, rounding: 0, namePlural: "Kazakhstani tenges" },
3499
+ { code: "LAK", name: "Lao Kip", symbol: "\u20AD", symbolNative: "\u20AD", decimalDigits: 0, rounding: 0, namePlural: "Lao kip" },
3500
+ { code: "LBP", name: "Lebanese Pound", symbol: "LB\xA3", symbolNative: "\u0644.\u0644.", decimalDigits: 0, rounding: 0, namePlural: "Lebanese pounds" },
3501
+ { code: "LKR", name: "Sri Lankan Rupee", symbol: "SLRs", symbolNative: "\u0DBB\u0DD4", decimalDigits: 2, rounding: 0, namePlural: "Sri Lankan rupees" },
3502
+ { code: "LYD", name: "Libyan Dinar", symbol: "LD", symbolNative: "\u062F.\u0644.", decimalDigits: 3, rounding: 0, namePlural: "Libyan dinars" },
3503
+ { code: "MAD", name: "Moroccan Dirham", symbol: "MAD", symbolNative: "\u062F.\u0645.", decimalDigits: 2, rounding: 0, namePlural: "Moroccan dirhams" },
3504
+ { code: "MDL", name: "Moldovan Leu", symbol: "MDL", symbolNative: "MDL", decimalDigits: 2, rounding: 0, namePlural: "Moldovan lei" },
3505
+ { code: "MGA", name: "Malagasy Ariary", symbol: "MGA", symbolNative: "MGA", decimalDigits: 0, rounding: 0, namePlural: "Malagasy ariaries" },
3506
+ { code: "MKD", name: "Macedonian Denar", symbol: "MKD", symbolNative: "MKD", decimalDigits: 2, rounding: 0, namePlural: "Macedonian denari" },
3507
+ { code: "MMK", name: "Myanmar Kyat", symbol: "MMK", symbolNative: "K", decimalDigits: 0, rounding: 0, namePlural: "Myanmar kyats" },
3508
+ { code: "MNT", name: "Mongolian Tugrik", symbol: "\u20AE", symbolNative: "\u20AE", decimalDigits: 0, rounding: 0, namePlural: "Mongolian tugriks" },
3509
+ { code: "MOP", name: "Macanese Pataca", symbol: "MOP$", symbolNative: "MOP$", decimalDigits: 2, rounding: 0, namePlural: "Macanese patacas" },
3510
+ { code: "MUR", name: "Mauritian Rupee", symbol: "MURs", symbolNative: "MURs", decimalDigits: 0, rounding: 0, namePlural: "Mauritian rupees" },
3511
+ { code: "MXN", name: "Mexican Peso", symbol: "MX$", symbolNative: "$", decimalDigits: 2, rounding: 0, namePlural: "Mexican pesos" },
3512
+ { code: "MYR", name: "Malaysian Ringgit", symbol: "RM", symbolNative: "RM", decimalDigits: 2, rounding: 0, namePlural: "Malaysian ringgits" },
3513
+ { code: "MZN", name: "Mozambican Metical", symbol: "MTn", symbolNative: "MTn", decimalDigits: 2, rounding: 0, namePlural: "Mozambican meticals" },
3514
+ { code: "NAD", name: "Namibian Dollar", symbol: "N$", symbolNative: "N$", decimalDigits: 2, rounding: 0, namePlural: "Namibian dollars" },
3515
+ { code: "NGN", name: "Nigerian Naira", symbol: "\u20A6", symbolNative: "\u20A6", decimalDigits: 2, rounding: 0, namePlural: "Nigerian nairas" },
3516
+ { code: "NIO", name: "Nicaraguan C\xF3rdoba", symbol: "C$", symbolNative: "C$", decimalDigits: 2, rounding: 0, namePlural: "Nicaraguan c\xF3rdobas" },
3517
+ { code: "NOK", name: "Norwegian Krone", symbol: "Nkr", symbolNative: "kr", decimalDigits: 2, rounding: 0, namePlural: "Norwegian kroner" },
3518
+ { code: "NPR", name: "Nepalese Rupee", symbol: "NPRs", symbolNative: "\u0928\u0947\u0930\u0942", decimalDigits: 2, rounding: 0, namePlural: "Nepalese rupees" },
3519
+ { code: "NZD", name: "New Zealand Dollar", symbol: "NZ$", symbolNative: "$", decimalDigits: 2, rounding: 0, namePlural: "New Zealand dollars" },
3520
+ { code: "OMR", name: "Omani Rial", symbol: "OMR", symbolNative: "\u0631.\u0639.", decimalDigits: 3, rounding: 0, namePlural: "Omani rials" },
3521
+ { code: "PAB", name: "Panamanian Balboa", symbol: "B/.", symbolNative: "B/.", decimalDigits: 2, rounding: 0, namePlural: "Panamanian balboas" },
3522
+ { code: "PEN", name: "Peruvian Sol", symbol: "S/", symbolNative: "S/", decimalDigits: 2, rounding: 0, namePlural: "Peruvian soles" },
3523
+ { code: "PHP", name: "Philippine Peso", symbol: "\u20B1", symbolNative: "\u20B1", decimalDigits: 2, rounding: 0, namePlural: "Philippine pesos" },
3524
+ { code: "PKR", name: "Pakistani Rupee", symbol: "PKRs", symbolNative: "\u20A8", decimalDigits: 0, rounding: 0, namePlural: "Pakistani rupees" },
3525
+ { code: "PLN", name: "Polish Zloty", symbol: "z\u0142", symbolNative: "z\u0142", decimalDigits: 2, rounding: 0, namePlural: "Polish zlotys" },
3526
+ { code: "PYG", name: "Paraguayan Guarani", symbol: "\u20B2", symbolNative: "\u20B2", decimalDigits: 0, rounding: 0, namePlural: "Paraguayan guaranis" },
3527
+ { code: "QAR", name: "Qatari Rial", symbol: "QR", symbolNative: "\u0631.\u0642.", decimalDigits: 2, rounding: 0, namePlural: "Qatari rials" },
3528
+ { code: "RON", name: "Romanian Leu", symbol: "RON", symbolNative: "RON", decimalDigits: 2, rounding: 0, namePlural: "Romanian lei" },
3529
+ { code: "RSD", name: "Serbian Dinar", symbol: "din.", symbolNative: "\u0434\u0438\u043D.", decimalDigits: 0, rounding: 0, namePlural: "Serbian dinars" },
3530
+ { code: "RUB", name: "Russian Ruble", symbol: "RUB", symbolNative: "\u20BD", decimalDigits: 2, rounding: 0, namePlural: "Russian rubles" },
3531
+ { code: "RWF", name: "Rwandan Franc", symbol: "RWF", symbolNative: "FR", decimalDigits: 0, rounding: 0, namePlural: "Rwandan francs" },
3532
+ { code: "SAR", name: "Saudi Riyal", symbol: "SR", symbolNative: "\u0631.\u0633.", decimalDigits: 2, rounding: 0, namePlural: "Saudi riyals" },
3533
+ { code: "SEK", name: "Swedish Krona", symbol: "Skr", symbolNative: "kr", decimalDigits: 2, rounding: 0, namePlural: "Swedish kronor" },
3534
+ { code: "SGD", name: "Singapore Dollar", symbol: "S$", symbolNative: "$", decimalDigits: 2, rounding: 0, namePlural: "Singapore dollars" },
3535
+ { code: "SOS", name: "Somali Shilling", symbol: "Ssh", symbolNative: "Ssh", decimalDigits: 0, rounding: 0, namePlural: "Somali shillings" },
3536
+ { code: "SYP", name: "Syrian Pound", symbol: "SY\xA3", symbolNative: "\u0644.\u0633.", decimalDigits: 0, rounding: 0, namePlural: "Syrian pounds" },
3537
+ { code: "THB", name: "Thai Baht", symbol: "\u0E3F", symbolNative: "\u0E3F", decimalDigits: 2, rounding: 0, namePlural: "Thai baht" },
3538
+ { code: "TND", name: "Tunisian Dinar", symbol: "DT", symbolNative: "\u062F.\u062A.", decimalDigits: 3, rounding: 0, namePlural: "Tunisian dinars" },
3539
+ { code: "TOP", name: "Tongan Pa'anga", symbol: "T$", symbolNative: "T$", decimalDigits: 2, rounding: 0, namePlural: "Tongan pa'anga" },
3540
+ { code: "TRY", name: "Turkish Lira", symbol: "TL", symbolNative: "\u20BA", decimalDigits: 2, rounding: 0, namePlural: "Turkish liras" },
3541
+ { code: "TTD", name: "Trinidad & Tobago Dollar", symbol: "TT$", symbolNative: "$", decimalDigits: 2, rounding: 0, namePlural: "Trinidad & Tobago dollars" },
3542
+ { code: "TWD", name: "New Taiwan Dollar", symbol: "NT$", symbolNative: "NT$", decimalDigits: 2, rounding: 0, namePlural: "New Taiwan dollars" },
3543
+ { code: "TZS", name: "Tanzanian Shilling", symbol: "TSh", symbolNative: "TSh", decimalDigits: 0, rounding: 0, namePlural: "Tanzanian shillings" },
3544
+ { code: "UAH", name: "Ukrainian Hryvnia", symbol: "\u20B4", symbolNative: "\u20B4", decimalDigits: 2, rounding: 0, namePlural: "Ukrainian hryvnias" },
3545
+ { code: "UGX", name: "Ugandan Shilling", symbol: "USh", symbolNative: "USh", decimalDigits: 0, rounding: 0, namePlural: "Ugandan shillings" },
3546
+ { code: "USD", name: "US Dollar", symbol: "$", symbolNative: "$", decimalDigits: 2, rounding: 0, namePlural: "US dollars" },
3547
+ { code: "UYU", name: "Uruguayan Peso", symbol: "$U", symbolNative: "$", decimalDigits: 2, rounding: 0, namePlural: "Uruguayan pesos" },
3548
+ { code: "UZS", name: "Uzbekistani Som", symbol: "UZS", symbolNative: "UZS", decimalDigits: 0, rounding: 0, namePlural: "Uzbekistani som" },
3549
+ { code: "VES", name: "Venezuelan Bol\xEDvar", symbol: "Bs", symbolNative: "Bs", decimalDigits: 2, rounding: 0, namePlural: "Venezuelan bol\xEDvars" },
3550
+ { code: "VND", name: "Vietnamese Dong", symbol: "\u20AB", symbolNative: "\u20AB", decimalDigits: 0, rounding: 0, namePlural: "Vietnamese dong" },
3551
+ { code: "XAF", name: "Central African CFA Franc", symbol: "FCFA", symbolNative: "FCFA", decimalDigits: 0, rounding: 0, namePlural: "Central African CFA francs" },
3552
+ { code: "XOF", name: "West African CFA Franc", symbol: "CFA", symbolNative: "CFA", decimalDigits: 0, rounding: 0, namePlural: "West African CFA francs" },
3553
+ { code: "YER", name: "Yemeni Rial", symbol: "YR", symbolNative: "\u0631.\u064A.", decimalDigits: 0, rounding: 0, namePlural: "Yemeni rials" },
3554
+ { code: "ZAR", name: "South African Rand", symbol: "R", symbolNative: "R", decimalDigits: 2, rounding: 0, namePlural: "South African rand" },
3555
+ { code: "ZMW", name: "Zambian Kwacha", symbol: "ZK", symbolNative: "ZK", decimalDigits: 0, rounding: 0, namePlural: "Zambian kwachas" },
3556
+ { code: "ZWL", name: "Zimbabwean Dollar", symbol: "ZWL$", symbolNative: "ZWL$", decimalDigits: 0, rounding: 0, namePlural: "Zimbabwean dollars" }
3557
+ ];
3558
+ var getCurrencyByCode = (code) => {
3559
+ return currencies.find((c) => c.code === code.toUpperCase());
3560
+ };
3561
+ var searchCurrencies = (query) => {
3562
+ const lowerQuery = query.toLowerCase();
3563
+ return currencies.filter(
3564
+ (c) => c.code.toLowerCase().includes(lowerQuery) || c.name.toLowerCase().includes(lowerQuery)
3565
+ );
3566
+ };
3567
+ var formatCurrency = (amount, currencyCode, locale = "en-US") => {
3568
+ const currency = getCurrencyByCode(currencyCode);
3569
+ if (!currency) {
3570
+ return amount.toFixed(2);
3571
+ }
3572
+ try {
3573
+ return new Intl.NumberFormat(locale, {
3574
+ style: "currency",
3575
+ currency: currency.code,
3576
+ minimumFractionDigits: currency.decimalDigits,
3577
+ maximumFractionDigits: currency.decimalDigits
3578
+ }).format(amount);
3579
+ } catch {
3580
+ return `${currency.symbol}${amount.toFixed(currency.decimalDigits)}`;
3581
+ }
3582
+ };
3583
+ var formatCurrencyNative = (amount, currencyCode) => {
3584
+ const currency = getCurrencyByCode(currencyCode);
3585
+ if (!currency) {
3586
+ return amount.toFixed(2);
3587
+ }
3588
+ return `${currency.symbolNative}${amount.toFixed(currency.decimalDigits)}`;
3589
+ };
3590
+ var currencies_default = currencies;
3591
+
3592
+ // src/data/timezones.ts
3593
+ var timezones = [
3594
+ { name: "Pacific/Midway", label: "(UTC-11:00) Midway Island", offset: "-11:00", offsetMinutes: -660 },
3595
+ { name: "Pacific/Honolulu", label: "(UTC-10:00) Hawaii", offset: "-10:00", offsetMinutes: -600 },
3596
+ { name: "America/Anchorage", label: "(UTC-09:00) Alaska", offset: "-09:00", offsetMinutes: -540 },
3597
+ { name: "America/Los_Angeles", label: "(UTC-08:00) Pacific Time (US & Canada)", offset: "-08:00", offsetMinutes: -480 },
3598
+ { name: "America/Phoenix", label: "(UTC-07:00) Arizona", offset: "-07:00", offsetMinutes: -420 },
3599
+ { name: "America/Denver", label: "(UTC-07:00) Mountain Time (US & Canada)", offset: "-07:00", offsetMinutes: -420 },
3600
+ { name: "America/Chicago", label: "(UTC-06:00) Central Time (US & Canada)", offset: "-06:00", offsetMinutes: -360 },
3601
+ { name: "America/Mexico_City", label: "(UTC-06:00) Mexico City", offset: "-06:00", offsetMinutes: -360 },
3602
+ { name: "America/New_York", label: "(UTC-05:00) Eastern Time (US & Canada)", offset: "-05:00", offsetMinutes: -300 },
3603
+ { name: "America/Bogota", label: "(UTC-05:00) Bogota", offset: "-05:00", offsetMinutes: -300 },
3604
+ { name: "America/Lima", label: "(UTC-05:00) Lima", offset: "-05:00", offsetMinutes: -300 },
3605
+ { name: "America/Caracas", label: "(UTC-04:00) Caracas", offset: "-04:00", offsetMinutes: -240 },
3606
+ { name: "America/Halifax", label: "(UTC-04:00) Atlantic Time (Canada)", offset: "-04:00", offsetMinutes: -240 },
3607
+ { name: "America/Santiago", label: "(UTC-04:00) Santiago", offset: "-04:00", offsetMinutes: -240 },
3608
+ { name: "America/Sao_Paulo", label: "(UTC-03:00) Brasilia", offset: "-03:00", offsetMinutes: -180 },
3609
+ { name: "America/Buenos_Aires", label: "(UTC-03:00) Buenos Aires", offset: "-03:00", offsetMinutes: -180 },
3610
+ { name: "Atlantic/South_Georgia", label: "(UTC-02:00) Mid-Atlantic", offset: "-02:00", offsetMinutes: -120 },
3611
+ { name: "Atlantic/Azores", label: "(UTC-01:00) Azores", offset: "-01:00", offsetMinutes: -60 },
3612
+ { name: "Europe/London", label: "(UTC+00:00) London, Dublin", offset: "+00:00", offsetMinutes: 0 },
3613
+ { name: "UTC", label: "(UTC+00:00) UTC", offset: "+00:00", offsetMinutes: 0 },
3614
+ { name: "Africa/Casablanca", label: "(UTC+00:00) Casablanca", offset: "+00:00", offsetMinutes: 0 },
3615
+ { name: "Europe/Paris", label: "(UTC+01:00) Paris, Berlin, Rome", offset: "+01:00", offsetMinutes: 60 },
3616
+ { name: "Europe/Amsterdam", label: "(UTC+01:00) Amsterdam, Brussels", offset: "+01:00", offsetMinutes: 60 },
3617
+ { name: "Africa/Lagos", label: "(UTC+01:00) West Central Africa", offset: "+01:00", offsetMinutes: 60 },
3618
+ { name: "Europe/Athens", label: "(UTC+02:00) Athens, Istanbul", offset: "+02:00", offsetMinutes: 120 },
3619
+ { name: "Europe/Kiev", label: "(UTC+02:00) Kyiv", offset: "+02:00", offsetMinutes: 120 },
3620
+ { name: "Africa/Cairo", label: "(UTC+02:00) Cairo", offset: "+02:00", offsetMinutes: 120 },
3621
+ { name: "Africa/Johannesburg", label: "(UTC+02:00) Johannesburg", offset: "+02:00", offsetMinutes: 120 },
3622
+ { name: "Asia/Jerusalem", label: "(UTC+02:00) Jerusalem", offset: "+02:00", offsetMinutes: 120 },
3623
+ { name: "Europe/Moscow", label: "(UTC+03:00) Moscow", offset: "+03:00", offsetMinutes: 180 },
3624
+ { name: "Asia/Kuwait", label: "(UTC+03:00) Kuwait, Riyadh", offset: "+03:00", offsetMinutes: 180 },
3625
+ { name: "Africa/Nairobi", label: "(UTC+03:00) Nairobi", offset: "+03:00", offsetMinutes: 180 },
3626
+ { name: "Asia/Tehran", label: "(UTC+03:30) Tehran", offset: "+03:30", offsetMinutes: 210 },
3627
+ { name: "Asia/Dubai", label: "(UTC+04:00) Dubai, Abu Dhabi", offset: "+04:00", offsetMinutes: 240 },
3628
+ { name: "Asia/Baku", label: "(UTC+04:00) Baku", offset: "+04:00", offsetMinutes: 240 },
3629
+ { name: "Asia/Kabul", label: "(UTC+04:30) Kabul", offset: "+04:30", offsetMinutes: 270 },
3630
+ { name: "Asia/Karachi", label: "(UTC+05:00) Karachi", offset: "+05:00", offsetMinutes: 300 },
3631
+ { name: "Asia/Tashkent", label: "(UTC+05:00) Tashkent", offset: "+05:00", offsetMinutes: 300 },
3632
+ { name: "Asia/Kolkata", label: "(UTC+05:30) Mumbai, New Delhi", offset: "+05:30", offsetMinutes: 330 },
3633
+ { name: "Asia/Colombo", label: "(UTC+05:30) Sri Lanka", offset: "+05:30", offsetMinutes: 330 },
3634
+ { name: "Asia/Kathmandu", label: "(UTC+05:45) Kathmandu", offset: "+05:45", offsetMinutes: 345 },
3635
+ { name: "Asia/Dhaka", label: "(UTC+06:00) Dhaka", offset: "+06:00", offsetMinutes: 360 },
3636
+ { name: "Asia/Almaty", label: "(UTC+06:00) Almaty", offset: "+06:00", offsetMinutes: 360 },
3637
+ { name: "Asia/Yangon", label: "(UTC+06:30) Yangon", offset: "+06:30", offsetMinutes: 390 },
3638
+ { name: "Asia/Bangkok", label: "(UTC+07:00) Bangkok", offset: "+07:00", offsetMinutes: 420 },
3639
+ { name: "Asia/Jakarta", label: "(UTC+07:00) Jakarta", offset: "+07:00", offsetMinutes: 420 },
3640
+ { name: "Asia/Ho_Chi_Minh", label: "(UTC+07:00) Ho Chi Minh City", offset: "+07:00", offsetMinutes: 420 },
3641
+ { name: "Asia/Singapore", label: "(UTC+08:00) Singapore", offset: "+08:00", offsetMinutes: 480 },
3642
+ { name: "Asia/Hong_Kong", label: "(UTC+08:00) Hong Kong", offset: "+08:00", offsetMinutes: 480 },
3643
+ { name: "Asia/Shanghai", label: "(UTC+08:00) Beijing, Shanghai", offset: "+08:00", offsetMinutes: 480 },
3644
+ { name: "Asia/Taipei", label: "(UTC+08:00) Taipei", offset: "+08:00", offsetMinutes: 480 },
3645
+ { name: "Asia/Kuala_Lumpur", label: "(UTC+08:00) Kuala Lumpur", offset: "+08:00", offsetMinutes: 480 },
3646
+ { name: "Australia/Perth", label: "(UTC+08:00) Perth", offset: "+08:00", offsetMinutes: 480 },
3647
+ { name: "Asia/Seoul", label: "(UTC+09:00) Seoul", offset: "+09:00", offsetMinutes: 540 },
3648
+ { name: "Asia/Tokyo", label: "(UTC+09:00) Tokyo", offset: "+09:00", offsetMinutes: 540 },
3649
+ { name: "Australia/Darwin", label: "(UTC+09:30) Darwin", offset: "+09:30", offsetMinutes: 570 },
3650
+ { name: "Australia/Adelaide", label: "(UTC+09:30) Adelaide", offset: "+09:30", offsetMinutes: 570 },
3651
+ { name: "Australia/Sydney", label: "(UTC+10:00) Sydney, Melbourne", offset: "+10:00", offsetMinutes: 600 },
3652
+ { name: "Australia/Brisbane", label: "(UTC+10:00) Brisbane", offset: "+10:00", offsetMinutes: 600 },
3653
+ { name: "Pacific/Guam", label: "(UTC+10:00) Guam", offset: "+10:00", offsetMinutes: 600 },
3654
+ { name: "Pacific/Noumea", label: "(UTC+11:00) New Caledonia", offset: "+11:00", offsetMinutes: 660 },
3655
+ { name: "Pacific/Fiji", label: "(UTC+12:00) Fiji", offset: "+12:00", offsetMinutes: 720 },
3656
+ { name: "Pacific/Auckland", label: "(UTC+12:00) Auckland, Wellington", offset: "+12:00", offsetMinutes: 720 },
3657
+ { name: "Pacific/Tongatapu", label: "(UTC+13:00) Nuku'alofa", offset: "+13:00", offsetMinutes: 780 }
3658
+ ];
3659
+ var getTimezoneByName = (name) => {
3660
+ return timezones.find((tz) => tz.name === name);
3661
+ };
3662
+ var searchTimezones = (query) => {
3663
+ const lowerQuery = query.toLowerCase();
3664
+ return timezones.filter(
3665
+ (tz) => tz.name.toLowerCase().includes(lowerQuery) || tz.label.toLowerCase().includes(lowerQuery)
3666
+ );
3667
+ };
3668
+ var getTimezonesByOffset = (offsetMinutes) => {
3669
+ return timezones.filter((tz) => tz.offsetMinutes === offsetMinutes);
3670
+ };
3671
+ var sortTimezonesByOffset = (ascending = true) => {
3672
+ return [...timezones].sort(
3673
+ (a, b) => ascending ? a.offsetMinutes - b.offsetMinutes : b.offsetMinutes - a.offsetMinutes
3674
+ );
3675
+ };
3676
+ var timezones_default = timezones;
3677
+
3678
+ // src/data/logos.ts
3679
+ var brands = {
3680
+ botify: {
3681
+ name: "Botify",
3682
+ domain: "botify.life",
3683
+ tagline: "AI-Powered Chatbots",
3684
+ primaryColor: "#6366F1",
3685
+ secondaryColor: "#8B5CF6",
3686
+ logo: {
3687
+ full: {
3688
+ light: "https://botify.life/logos/botify-full-dark.svg",
3689
+ dark: "https://botify.life/logos/botify-full-light.svg"
3690
+ },
3691
+ icon: {
3692
+ light: "https://botify.life/logos/botify-icon-dark.svg",
3693
+ dark: "https://botify.life/logos/botify-icon-light.svg"
3694
+ },
3695
+ favicon: "https://botify.life/favicon.ico"
3696
+ }
3697
+ },
3698
+ exyconn: {
3699
+ name: "Exyconn",
3700
+ domain: "exyconn.com",
3701
+ tagline: "Connect. Create. Collaborate.",
3702
+ primaryColor: "#0EA5E9",
3703
+ secondaryColor: "#06B6D4",
3704
+ logo: {
3705
+ full: {
3706
+ light: "https://exyconn.com/logos/exyconn-full-dark.svg",
3707
+ dark: "https://exyconn.com/logos/exyconn-full-light.svg"
3708
+ },
3709
+ icon: {
3710
+ light: "https://exyconn.com/logos/exyconn-icon-dark.svg",
3711
+ dark: "https://exyconn.com/logos/exyconn-icon-light.svg"
3712
+ },
3713
+ favicon: "https://exyconn.com/favicon.ico"
3714
+ }
3715
+ },
3716
+ partywings: {
3717
+ name: "PartyWings",
3718
+ domain: "partywings.fun",
3719
+ tagline: "Your Party, Your Rules",
3720
+ primaryColor: "#EC4899",
3721
+ secondaryColor: "#F472B6",
3722
+ logo: {
3723
+ full: {
3724
+ light: "https://partywings.fun/logos/partywings-full-dark.svg",
3725
+ dark: "https://partywings.fun/logos/partywings-full-light.svg"
3726
+ },
3727
+ icon: {
3728
+ light: "https://partywings.fun/logos/partywings-icon-dark.svg",
3729
+ dark: "https://partywings.fun/logos/partywings-icon-light.svg"
3730
+ },
3731
+ favicon: "https://partywings.fun/favicon.ico"
3732
+ }
3733
+ },
3734
+ sibera: {
3735
+ name: "Sibera",
3736
+ domain: "sibera.work",
3737
+ tagline: "Work Smarter, Together",
3738
+ primaryColor: "#10B981",
3739
+ secondaryColor: "#34D399",
3740
+ logo: {
3741
+ full: {
3742
+ light: "https://sibera.work/logos/sibera-full-dark.svg",
3743
+ dark: "https://sibera.work/logos/sibera-full-light.svg"
3744
+ },
3745
+ icon: {
3746
+ light: "https://sibera.work/logos/sibera-icon-dark.svg",
3747
+ dark: "https://sibera.work/logos/sibera-icon-light.svg"
3748
+ },
3749
+ favicon: "https://sibera.work/favicon.ico"
3750
+ }
3751
+ },
3752
+ spentiva: {
3753
+ name: "Spentiva",
3754
+ domain: "spentiva.com",
3755
+ tagline: "Smart Spending, Smart Living",
3756
+ primaryColor: "#F59E0B",
3757
+ secondaryColor: "#FBBF24",
3758
+ logo: {
3759
+ full: {
3760
+ light: "https://spentiva.com/logos/spentiva-full-dark.svg",
3761
+ dark: "https://spentiva.com/logos/spentiva-full-light.svg"
3762
+ },
3763
+ icon: {
3764
+ light: "https://spentiva.com/logos/spentiva-icon-dark.svg",
3765
+ dark: "https://spentiva.com/logos/spentiva-icon-light.svg"
3766
+ },
3767
+ favicon: "https://spentiva.com/favicon.ico"
3768
+ }
3769
+ }
3770
+ };
3771
+ var getBrand = (key) => {
3772
+ return brands[key.toLowerCase()];
3773
+ };
3774
+ var getBrandByDomain = (domain) => {
3775
+ return Object.values(brands).find((b) => b.domain === domain);
3776
+ };
3777
+ var getLogo = (brandKey, mode, type = "full") => {
3778
+ const brand = getBrand(brandKey);
3779
+ if (!brand) return void 0;
3780
+ return brand.logo[type][mode];
3781
+ };
3782
+ var getAllBrands = () => {
3783
+ return Object.values(brands);
3784
+ };
3785
+ var getAllBrandKeys = () => {
3786
+ return Object.keys(brands);
3787
+ };
3788
+ var logos_default = brands;
3789
+
3790
+ export { client_exports as client, data_exports as data, server_exports as server, shared_exports as shared };
3791
+ //# sourceMappingURL=index.mjs.map
3792
+ //# sourceMappingURL=index.mjs.map