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