@k-msg/provider 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/abstract/provider.base.d.ts +108 -0
- package/dist/adapters/aligo.adapter.d.ts +50 -0
- package/dist/adapters/iwinv.adapter.d.ts +111 -0
- package/dist/aligo/provider.d.ts +18 -0
- package/dist/config/provider-config-v2.d.ts +122 -0
- package/dist/contracts/provider.contract.d.ts +355 -0
- package/dist/contracts/sms.contract.d.ts +135 -0
- package/dist/index.d.ts +29 -1424
- package/dist/index.js +21 -2003
- package/dist/index.js.map +98 -1
- package/dist/index.mjs +25 -0
- package/dist/index.mjs.map +98 -0
- package/dist/interfaces/index.d.ts +14 -0
- package/dist/interfaces/plugin.d.ts +122 -0
- package/dist/interfaces/services.d.ts +222 -0
- package/dist/iwinv/contracts/account.contract.d.ts +11 -0
- package/dist/iwinv/contracts/analytics.contract.d.ts +16 -0
- package/dist/iwinv/contracts/channel.contract.d.ts +15 -0
- package/dist/iwinv/contracts/messaging.contract.d.ts +14 -0
- package/dist/iwinv/contracts/sms.contract.d.ts +33 -0
- package/dist/iwinv/contracts/template.contract.d.ts +18 -0
- package/dist/iwinv/index.d.ts +5 -0
- package/dist/iwinv/provider-multi.d.ts +116 -0
- package/dist/iwinv/provider-sms.d.ts +55 -0
- package/dist/iwinv/provider.d.ts +42 -0
- package/dist/iwinv/types/iwinv.d.ts +153 -0
- package/dist/middleware/index.d.ts +27 -0
- package/dist/mock/index.d.ts +1 -0
- package/dist/providers/mock/index.d.ts +1 -0
- package/dist/providers/mock/mock.provider.d.ts +22 -0
- package/dist/registry/index.d.ts +1 -0
- package/dist/registry/plugin-registry.d.ts +15 -0
- package/dist/services/provider.manager.d.ts +24 -0
- package/dist/services/provider.service.d.ts +49 -0
- package/dist/test-helpers.d.ts +110 -0
- package/dist/types/aligo.d.ts +69 -0
- package/dist/types/base.d.ts +172 -0
- package/dist/types/typed-templates.d.ts +199 -0
- package/dist/types/unified-config.d.ts +197 -0
- package/dist/types/unified-errors.d.ts +225 -0
- package/dist/utils/base-plugin.d.ts +35 -0
- package/dist/utils/index.d.ts +12 -0
- package/package.json +25 -14
- package/dist/index.cjs +0 -2061
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -1425
package/dist/index.js
CHANGED
|
@@ -1,2007 +1,25 @@
|
|
|
1
|
-
// src/registry/plugin-registry.ts
|
|
2
|
-
import { EventEmitter } from "events";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (!plugin) {
|
|
16
|
-
throw new Error(`Plugin ${pluginId} not found`);
|
|
17
|
-
}
|
|
18
|
-
const PluginClass = plugin.constructor;
|
|
19
|
-
const instance = new PluginClass();
|
|
20
|
-
const context = {
|
|
21
|
-
config,
|
|
22
|
-
logger: options.logger || new ConsoleLogger(),
|
|
23
|
-
metrics: options.metrics || new NoOpMetricsCollector(),
|
|
24
|
-
storage: options.storage || new MemoryStorage(),
|
|
25
|
-
eventBus: new EventEmitter()
|
|
26
|
-
};
|
|
27
|
-
await instance.initialize(context);
|
|
28
|
-
const instanceKey = `${pluginId}-${Date.now()}`;
|
|
29
|
-
this.instances.set(instanceKey, instance);
|
|
30
|
-
return instance;
|
|
31
|
-
}
|
|
32
|
-
async loadAndCreate(pluginId, config, options) {
|
|
33
|
-
return this.create(pluginId, config, options);
|
|
34
|
-
}
|
|
35
|
-
getSupportedTypes() {
|
|
36
|
-
return Array.from(this.plugins.keys());
|
|
37
|
-
}
|
|
38
|
-
validateProviderConfig(type, config) {
|
|
39
|
-
const plugin = this.plugins.get(type.toLowerCase());
|
|
40
|
-
if (!plugin) return false;
|
|
41
|
-
return !!(config.apiUrl && config.apiKey);
|
|
42
|
-
}
|
|
43
|
-
async destroyAll() {
|
|
44
|
-
const destroyPromises = Array.from(this.instances.values()).map(
|
|
45
|
-
(instance) => instance.destroy()
|
|
46
|
-
);
|
|
47
|
-
await Promise.all(destroyPromises);
|
|
48
|
-
this.instances.clear();
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
var ConsoleLogger = class {
|
|
52
|
-
info(message, ...args) {
|
|
53
|
-
console.log(`[INFO] ${message}`, ...args);
|
|
54
|
-
}
|
|
55
|
-
error(message, error) {
|
|
56
|
-
console.error(`[ERROR] ${message}`, error);
|
|
57
|
-
}
|
|
58
|
-
debug(message, ...args) {
|
|
59
|
-
console.debug(`[DEBUG] ${message}`, ...args);
|
|
60
|
-
}
|
|
61
|
-
warn(message, ...args) {
|
|
62
|
-
console.warn(`[WARN] ${message}`, ...args);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
var NoOpMetricsCollector = class {
|
|
66
|
-
increment(_metric, _labels) {
|
|
67
|
-
}
|
|
68
|
-
histogram(_metric, _value, _labels) {
|
|
69
|
-
}
|
|
70
|
-
gauge(_metric, _value, _labels) {
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
var MemoryStorage = class {
|
|
74
|
-
store = /* @__PURE__ */ new Map();
|
|
75
|
-
async get(key) {
|
|
76
|
-
const item = this.store.get(key);
|
|
77
|
-
if (!item) return void 0;
|
|
78
|
-
if (item.expiry && Date.now() > item.expiry) {
|
|
79
|
-
this.store.delete(key);
|
|
80
|
-
return void 0;
|
|
81
|
-
}
|
|
82
|
-
return item.value;
|
|
83
|
-
}
|
|
84
|
-
async set(key, value, ttl) {
|
|
85
|
-
const expiry = ttl ? Date.now() + ttl * 1e3 : void 0;
|
|
86
|
-
this.store.set(key, { value, expiry });
|
|
87
|
-
}
|
|
88
|
-
async delete(key) {
|
|
89
|
-
this.store.delete(key);
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
// src/middleware/index.ts
|
|
94
|
-
function createRetryMiddleware(options) {
|
|
95
|
-
return {
|
|
96
|
-
name: "retry",
|
|
97
|
-
error: async (error, context) => {
|
|
98
|
-
const retries = context.metadata.retries || 0;
|
|
99
|
-
if (retries >= options.maxRetries) {
|
|
100
|
-
throw error;
|
|
101
|
-
}
|
|
102
|
-
const isRetryable = options.retryableErrors?.includes(error.code) || options.retryableStatusCodes?.includes(error.status) || error.code === "ETIMEDOUT" || error.code === "ECONNRESET";
|
|
103
|
-
if (!isRetryable) {
|
|
104
|
-
throw error;
|
|
105
|
-
}
|
|
106
|
-
await new Promise(
|
|
107
|
-
(resolve) => setTimeout(resolve, options.retryDelay * (retries + 1))
|
|
108
|
-
);
|
|
109
|
-
context.metadata.retries = retries + 1;
|
|
110
|
-
throw { ...error, shouldRetry: true };
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
function createRateLimitMiddleware(options) {
|
|
115
|
-
const windows = /* @__PURE__ */ new Map();
|
|
116
|
-
return {
|
|
117
|
-
name: "rate-limit",
|
|
118
|
-
pre: async (context) => {
|
|
119
|
-
const now = Date.now();
|
|
120
|
-
const key = "global";
|
|
121
|
-
if (!windows.has(key)) {
|
|
122
|
-
windows.set(key, []);
|
|
123
|
-
}
|
|
124
|
-
const timestamps = windows.get(key);
|
|
125
|
-
if (options.messagesPerSecond) {
|
|
126
|
-
const recentCount = timestamps.filter((t) => now - t < 1e3).length;
|
|
127
|
-
if (recentCount >= options.messagesPerSecond) {
|
|
128
|
-
throw new Error("Rate limit exceeded: messages per second");
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
if (options.messagesPerMinute) {
|
|
132
|
-
const recentCount = timestamps.filter((t) => now - t < 6e4).length;
|
|
133
|
-
if (recentCount >= options.messagesPerMinute) {
|
|
134
|
-
throw new Error("Rate limit exceeded: messages per minute");
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
timestamps.push(now);
|
|
138
|
-
const cutoff = now - 36e5;
|
|
139
|
-
const filtered = timestamps.filter((t) => t > cutoff);
|
|
140
|
-
windows.set(key, filtered);
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
function createLoggingMiddleware(options) {
|
|
145
|
-
return {
|
|
146
|
-
name: "logging",
|
|
147
|
-
pre: async (context) => {
|
|
148
|
-
if (options.logLevel === "debug") {
|
|
149
|
-
options.logger.debug("Request started", {
|
|
150
|
-
metadata: context.metadata,
|
|
151
|
-
timestamp: context.startTime
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
post: async (context) => {
|
|
156
|
-
const duration = Date.now() - context.startTime;
|
|
157
|
-
options.logger.info("Request completed", {
|
|
158
|
-
duration,
|
|
159
|
-
success: true
|
|
160
|
-
});
|
|
161
|
-
},
|
|
162
|
-
error: async (error, context) => {
|
|
163
|
-
const duration = Date.now() - context.startTime;
|
|
164
|
-
options.logger.error("Request failed", {
|
|
165
|
-
error: error.message,
|
|
166
|
-
duration,
|
|
167
|
-
stack: error.stack
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
function createMetricsMiddleware(options) {
|
|
173
|
-
return {
|
|
174
|
-
name: "metrics",
|
|
175
|
-
pre: async (context) => {
|
|
176
|
-
options.collector.increment("requests_total", options.labels);
|
|
177
|
-
},
|
|
178
|
-
post: async (context) => {
|
|
179
|
-
const duration = Date.now() - context.startTime;
|
|
180
|
-
options.collector.histogram("request_duration_ms", duration, options.labels);
|
|
181
|
-
options.collector.increment("requests_success_total", options.labels);
|
|
182
|
-
},
|
|
183
|
-
error: async (error, context) => {
|
|
184
|
-
const duration = Date.now() - context.startTime;
|
|
185
|
-
options.collector.histogram("request_duration_ms", duration, options.labels);
|
|
186
|
-
options.collector.increment("requests_error_total", {
|
|
187
|
-
...options.labels,
|
|
188
|
-
error_type: error.constructor.name
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
function createCircuitBreakerMiddleware(options) {
|
|
194
|
-
let state = "CLOSED";
|
|
195
|
-
let failures = 0;
|
|
196
|
-
let nextAttempt = 0;
|
|
197
|
-
return {
|
|
198
|
-
name: "circuit-breaker",
|
|
199
|
-
pre: async (context) => {
|
|
200
|
-
const now = Date.now();
|
|
201
|
-
if (state === "OPEN") {
|
|
202
|
-
if (now < nextAttempt) {
|
|
203
|
-
throw new Error("Circuit breaker is OPEN");
|
|
204
|
-
}
|
|
205
|
-
state = "HALF_OPEN";
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
post: async (context) => {
|
|
209
|
-
if (state === "HALF_OPEN") {
|
|
210
|
-
state = "CLOSED";
|
|
211
|
-
failures = 0;
|
|
212
|
-
}
|
|
213
|
-
},
|
|
214
|
-
error: async (error, context) => {
|
|
215
|
-
failures++;
|
|
216
|
-
if (failures >= options.threshold) {
|
|
217
|
-
state = "OPEN";
|
|
218
|
-
nextAttempt = Date.now() + options.resetTimeout;
|
|
219
|
-
}
|
|
220
|
-
throw error;
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
// src/utils/base-plugin.ts
|
|
226
|
-
var BasePlugin = class {
|
|
227
|
-
context;
|
|
228
|
-
middleware = [];
|
|
229
|
-
async initialize(context) {
|
|
230
|
-
this.context = context;
|
|
231
|
-
this.context.logger.info(`Initializing plugin: ${this.metadata.name}`);
|
|
232
|
-
}
|
|
233
|
-
async destroy() {
|
|
234
|
-
this.context.logger.info(`Destroying plugin: ${this.metadata.name}`);
|
|
235
|
-
}
|
|
236
|
-
async executeMiddleware(phase, context, error) {
|
|
237
|
-
for (const middleware of this.middleware) {
|
|
238
|
-
try {
|
|
239
|
-
if (phase === "pre" && middleware.pre) {
|
|
240
|
-
await middleware.pre(context);
|
|
241
|
-
} else if (phase === "post" && middleware.post) {
|
|
242
|
-
await middleware.post(context);
|
|
243
|
-
} else if (phase === "error" && middleware.error && error) {
|
|
244
|
-
await middleware.error(error, context);
|
|
245
|
-
}
|
|
246
|
-
} catch (err) {
|
|
247
|
-
this.context.logger.error(`Middleware ${middleware.name} failed`, err);
|
|
248
|
-
throw err;
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
createMiddlewareContext(request, metadata = {}) {
|
|
253
|
-
return {
|
|
254
|
-
request,
|
|
255
|
-
response: void 0,
|
|
256
|
-
metadata: {
|
|
257
|
-
...metadata,
|
|
258
|
-
pluginName: this.metadata.name,
|
|
259
|
-
pluginVersion: this.metadata.version
|
|
260
|
-
},
|
|
261
|
-
startTime: Date.now()
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
validateConfig(config, required) {
|
|
265
|
-
for (const field of required) {
|
|
266
|
-
if (!config[field]) {
|
|
267
|
-
throw new Error(`${this.metadata.name}: Missing required config field: ${field}`);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
async makeRequest(url, options, metadata = {}) {
|
|
272
|
-
const context = this.createMiddlewareContext({ url, options }, metadata);
|
|
273
|
-
try {
|
|
274
|
-
await this.executeMiddleware("pre", context);
|
|
275
|
-
const response = await fetch(url, {
|
|
276
|
-
...options,
|
|
277
|
-
headers: {
|
|
278
|
-
"User-Agent": `K-OTP-${this.metadata.name}/${this.metadata.version}`,
|
|
279
|
-
...this.context.config.headers,
|
|
280
|
-
...options.headers
|
|
281
|
-
},
|
|
282
|
-
signal: AbortSignal.timeout(this.context.config.timeout || 3e4)
|
|
283
|
-
});
|
|
284
|
-
context.response = response;
|
|
285
|
-
await this.executeMiddleware("post", context);
|
|
286
|
-
return response;
|
|
287
|
-
} catch (error) {
|
|
288
|
-
await this.executeMiddleware("error", context, error);
|
|
289
|
-
throw error;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* Make HTTP request and parse JSON response
|
|
294
|
-
* Subclasses should use their specific response adapters to transform the result
|
|
295
|
-
*/
|
|
296
|
-
async makeJSONRequest(url, options, metadata = {}) {
|
|
297
|
-
const response = await this.makeRequest(url, options, metadata);
|
|
298
|
-
if (!response.ok) {
|
|
299
|
-
const error = new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
300
|
-
error.response = response;
|
|
301
|
-
error.status = response.status;
|
|
302
|
-
throw error;
|
|
303
|
-
}
|
|
304
|
-
try {
|
|
305
|
-
return await response.json();
|
|
306
|
-
} catch (parseError) {
|
|
307
|
-
const error = new Error("Failed to parse JSON response");
|
|
308
|
-
error.response = response;
|
|
309
|
-
error.parseError = parseError;
|
|
310
|
-
throw error;
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
/**
|
|
314
|
-
* Helper method for logging provider-specific operations
|
|
315
|
-
*/
|
|
316
|
-
logOperation(operation, data) {
|
|
317
|
-
this.context.logger.info(`${this.metadata.name}: ${operation}`, data);
|
|
318
|
-
}
|
|
319
|
-
/**
|
|
320
|
-
* Helper method for logging provider-specific errors
|
|
321
|
-
*/
|
|
322
|
-
logError(operation, error, data) {
|
|
323
|
-
this.context.logger.error(`${this.metadata.name}: ${operation} failed`, { error, data });
|
|
324
|
-
}
|
|
325
|
-
};
|
|
326
|
-
|
|
327
|
-
// src/utils/index.ts
|
|
328
|
-
function normalizePhoneNumber(phone) {
|
|
329
|
-
const cleaned = phone.replace(/[^\d]/g, "");
|
|
330
|
-
if (cleaned.startsWith("82")) {
|
|
331
|
-
return "0" + cleaned.substring(2);
|
|
332
|
-
}
|
|
333
|
-
if (cleaned.startsWith("0")) {
|
|
334
|
-
return cleaned;
|
|
335
|
-
}
|
|
336
|
-
if (cleaned.length >= 10 && cleaned.length <= 11) {
|
|
337
|
-
return "0" + cleaned;
|
|
338
|
-
}
|
|
339
|
-
return cleaned;
|
|
340
|
-
}
|
|
341
|
-
function validatePhoneNumber(phone) {
|
|
342
|
-
const normalized = normalizePhoneNumber(phone);
|
|
343
|
-
return /^01[0-9]{8,9}$/.test(normalized);
|
|
344
|
-
}
|
|
345
|
-
function formatDateTime(date) {
|
|
346
|
-
const year = date.getFullYear();
|
|
347
|
-
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
348
|
-
const day = String(date.getDate()).padStart(2, "0");
|
|
349
|
-
const hours = String(date.getHours()).padStart(2, "0");
|
|
350
|
-
const minutes = String(date.getMinutes()).padStart(2, "0");
|
|
351
|
-
const seconds = String(date.getSeconds()).padStart(2, "0");
|
|
352
|
-
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
353
|
-
}
|
|
354
|
-
function parseTemplate(template, variables) {
|
|
355
|
-
let result = template;
|
|
356
|
-
for (const [key, value] of Object.entries(variables)) {
|
|
357
|
-
const regex = new RegExp(`#{${key}}`, "g");
|
|
358
|
-
result = result.replace(regex, value);
|
|
359
|
-
}
|
|
360
|
-
for (const [key, value] of Object.entries(variables)) {
|
|
361
|
-
const regex = new RegExp(`{{${key}}}`, "g");
|
|
362
|
-
result = result.replace(regex, value);
|
|
363
|
-
}
|
|
364
|
-
return result;
|
|
365
|
-
}
|
|
366
|
-
function extractVariables(template) {
|
|
367
|
-
const variables = /* @__PURE__ */ new Set();
|
|
368
|
-
const hashMatches = template.match(/#\{([^}]+)\}/g);
|
|
369
|
-
if (hashMatches) {
|
|
370
|
-
hashMatches.forEach((match) => {
|
|
371
|
-
const variable = match.slice(2, -1);
|
|
372
|
-
variables.add(variable);
|
|
373
|
-
});
|
|
374
|
-
}
|
|
375
|
-
const braceMatches = template.match(/\{\{([^}]+)\}\}/g);
|
|
376
|
-
if (braceMatches) {
|
|
377
|
-
braceMatches.forEach((match) => {
|
|
378
|
-
const variable = match.slice(2, -2);
|
|
379
|
-
variables.add(variable);
|
|
380
|
-
});
|
|
381
|
-
}
|
|
382
|
-
return Array.from(variables);
|
|
383
|
-
}
|
|
384
|
-
function delay(ms) {
|
|
385
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
386
|
-
}
|
|
387
|
-
function retry(fn, options) {
|
|
388
|
-
return new Promise(async (resolve, reject) => {
|
|
389
|
-
let lastError;
|
|
390
|
-
for (let attempt = 0; attempt <= options.maxRetries; attempt++) {
|
|
391
|
-
try {
|
|
392
|
-
if (attempt > 0) {
|
|
393
|
-
const delayMs = options.backoff === "exponential" ? options.delay * Math.pow(2, attempt - 1) : options.delay * attempt;
|
|
394
|
-
await delay(delayMs);
|
|
395
|
-
}
|
|
396
|
-
const result = await fn();
|
|
397
|
-
resolve(result);
|
|
398
|
-
return;
|
|
399
|
-
} catch (error) {
|
|
400
|
-
lastError = error;
|
|
401
|
-
if (attempt === options.maxRetries) {
|
|
402
|
-
reject(lastError);
|
|
403
|
-
return;
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
});
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
// src/abstract/provider.base.ts
|
|
411
|
-
var BaseAlimTalkProvider = class {
|
|
412
|
-
config = {};
|
|
413
|
-
isConfigured = false;
|
|
414
|
-
constructor(config) {
|
|
415
|
-
if (config) {
|
|
416
|
-
this.configure(config);
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
/**
|
|
420
|
-
* Configure the provider with necessary credentials and settings
|
|
421
|
-
*/
|
|
422
|
-
configure(config) {
|
|
423
|
-
this.validateConfiguration(config);
|
|
424
|
-
this.config = { ...config };
|
|
425
|
-
this.isConfigured = true;
|
|
426
|
-
this.onConfigured();
|
|
427
|
-
}
|
|
428
|
-
/**
|
|
429
|
-
* Validate the provided configuration
|
|
430
|
-
*/
|
|
431
|
-
validateConfiguration(config) {
|
|
432
|
-
const schema = this.getConfigurationSchema();
|
|
433
|
-
for (const field of schema.required) {
|
|
434
|
-
if (!(field.key in config)) {
|
|
435
|
-
throw new Error(`Required configuration field '${field.key}' is missing`);
|
|
436
|
-
}
|
|
437
|
-
this.validateFieldValue(field, config[field.key]);
|
|
438
|
-
}
|
|
439
|
-
for (const field of schema.optional) {
|
|
440
|
-
if (field.key in config) {
|
|
441
|
-
this.validateFieldValue(field, config[field.key]);
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
validateFieldValue(field, value) {
|
|
446
|
-
switch (field.type) {
|
|
447
|
-
case "string":
|
|
448
|
-
if (typeof value !== "string") {
|
|
449
|
-
throw new Error(`Field '${field.key}' must be a string`);
|
|
450
|
-
}
|
|
451
|
-
break;
|
|
452
|
-
case "number":
|
|
453
|
-
if (typeof value !== "number") {
|
|
454
|
-
throw new Error(`Field '${field.key}' must be a number`);
|
|
455
|
-
}
|
|
456
|
-
break;
|
|
457
|
-
case "boolean":
|
|
458
|
-
if (typeof value !== "boolean") {
|
|
459
|
-
throw new Error(`Field '${field.key}' must be a boolean`);
|
|
460
|
-
}
|
|
461
|
-
break;
|
|
462
|
-
case "url":
|
|
463
|
-
try {
|
|
464
|
-
new URL(String(value));
|
|
465
|
-
} catch {
|
|
466
|
-
throw new Error(`Field '${field.key}' must be a valid URL`);
|
|
467
|
-
}
|
|
468
|
-
break;
|
|
469
|
-
}
|
|
470
|
-
if (field.validation) {
|
|
471
|
-
if (field.validation.pattern) {
|
|
472
|
-
const regex = new RegExp(field.validation.pattern);
|
|
473
|
-
if (!regex.test(String(value))) {
|
|
474
|
-
throw new Error(`Field '${field.key}' does not match required pattern`);
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
if (field.validation.min !== void 0 && Number(value) < field.validation.min) {
|
|
478
|
-
throw new Error(`Field '${field.key}' must be at least ${field.validation.min}`);
|
|
479
|
-
}
|
|
480
|
-
if (field.validation.max !== void 0 && Number(value) > field.validation.max) {
|
|
481
|
-
throw new Error(`Field '${field.key}' must be at most ${field.validation.max}`);
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
/**
|
|
486
|
-
* Called after configuration is set
|
|
487
|
-
*/
|
|
488
|
-
onConfigured() {
|
|
489
|
-
}
|
|
490
|
-
/**
|
|
491
|
-
* Check if the provider is properly configured
|
|
492
|
-
*/
|
|
493
|
-
isReady() {
|
|
494
|
-
return this.isConfigured;
|
|
495
|
-
}
|
|
496
|
-
/**
|
|
497
|
-
* Get configuration value
|
|
498
|
-
*/
|
|
499
|
-
getConfig(key) {
|
|
500
|
-
if (!this.isConfigured) {
|
|
501
|
-
throw new Error("Provider is not configured");
|
|
502
|
-
}
|
|
503
|
-
return this.config[key];
|
|
504
|
-
}
|
|
505
|
-
/**
|
|
506
|
-
* Check if a configuration key exists
|
|
507
|
-
*/
|
|
508
|
-
hasConfig(key) {
|
|
509
|
-
return key in this.config;
|
|
510
|
-
}
|
|
511
|
-
/**
|
|
512
|
-
* Perform health check on the provider
|
|
513
|
-
*/
|
|
514
|
-
async healthCheck() {
|
|
515
|
-
const issues = [];
|
|
516
|
-
const startTime = Date.now();
|
|
517
|
-
try {
|
|
518
|
-
if (!this.isReady()) {
|
|
519
|
-
issues.push("Provider is not configured");
|
|
520
|
-
return { healthy: false, issues };
|
|
521
|
-
}
|
|
522
|
-
await this.testConnectivity();
|
|
523
|
-
await this.testAuthentication();
|
|
524
|
-
const latency = Date.now() - startTime;
|
|
525
|
-
return {
|
|
526
|
-
healthy: issues.length === 0,
|
|
527
|
-
issues,
|
|
528
|
-
latency
|
|
529
|
-
};
|
|
530
|
-
} catch (error) {
|
|
531
|
-
issues.push(`Health check failed: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
532
|
-
return { healthy: false, issues };
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
/**
|
|
536
|
-
* Get provider information
|
|
537
|
-
*/
|
|
538
|
-
getInfo() {
|
|
539
|
-
return {
|
|
540
|
-
id: this.id,
|
|
541
|
-
name: this.name,
|
|
542
|
-
version: this.getVersion(),
|
|
543
|
-
capabilities: this.capabilities,
|
|
544
|
-
configured: this.isConfigured
|
|
545
|
-
};
|
|
546
|
-
}
|
|
547
|
-
/**
|
|
548
|
-
* Cleanup resources when provider is destroyed
|
|
549
|
-
*/
|
|
550
|
-
destroy() {
|
|
551
|
-
this.config = {};
|
|
552
|
-
this.isConfigured = false;
|
|
553
|
-
this.onDestroy();
|
|
554
|
-
}
|
|
555
|
-
/**
|
|
556
|
-
* Called when provider is being destroyed
|
|
557
|
-
*/
|
|
558
|
-
onDestroy() {
|
|
559
|
-
}
|
|
560
|
-
/**
|
|
561
|
-
* Create standardized error
|
|
562
|
-
*/
|
|
563
|
-
createError(code, message, details) {
|
|
564
|
-
const error = new Error(message);
|
|
565
|
-
error.code = code;
|
|
566
|
-
error.provider = this.id;
|
|
567
|
-
error.details = details;
|
|
568
|
-
return error;
|
|
569
|
-
}
|
|
570
|
-
/**
|
|
571
|
-
* Log provider activity
|
|
572
|
-
*/
|
|
573
|
-
log(level, message, data) {
|
|
574
|
-
const logData = {
|
|
575
|
-
provider: this.id,
|
|
576
|
-
level,
|
|
577
|
-
message,
|
|
578
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
579
|
-
};
|
|
580
|
-
if (data) {
|
|
581
|
-
logData.data = data;
|
|
582
|
-
}
|
|
583
|
-
console.log(JSON.stringify(logData));
|
|
584
|
-
}
|
|
585
|
-
/**
|
|
586
|
-
* Handle rate limiting
|
|
587
|
-
*/
|
|
588
|
-
async handleRateLimit(operation) {
|
|
589
|
-
const rateLimit = this.capabilities.messaging.maxRequestsPerSecond;
|
|
590
|
-
if (rateLimit > 0) {
|
|
591
|
-
const delay2 = 1e3 / rateLimit;
|
|
592
|
-
await new Promise((resolve) => setTimeout(resolve, delay2));
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
/**
|
|
596
|
-
* Retry mechanism for failed operations
|
|
597
|
-
*/
|
|
598
|
-
async withRetry(operation, options = {}) {
|
|
599
|
-
const {
|
|
600
|
-
maxRetries = 3,
|
|
601
|
-
initialDelay = 1e3,
|
|
602
|
-
maxDelay = 1e4,
|
|
603
|
-
backoffFactor = 2
|
|
604
|
-
} = options;
|
|
605
|
-
let lastError;
|
|
606
|
-
let delay2 = initialDelay;
|
|
607
|
-
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
608
|
-
try {
|
|
609
|
-
return await operation();
|
|
610
|
-
} catch (error) {
|
|
611
|
-
lastError = error;
|
|
612
|
-
if (attempt === maxRetries) {
|
|
613
|
-
break;
|
|
614
|
-
}
|
|
615
|
-
this.log("warn", `Operation failed, retrying in ${delay2}ms`, {
|
|
616
|
-
attempt: attempt + 1,
|
|
617
|
-
maxRetries,
|
|
618
|
-
error: lastError.message
|
|
619
|
-
});
|
|
620
|
-
await new Promise((resolve) => setTimeout(resolve, delay2));
|
|
621
|
-
delay2 = Math.min(delay2 * backoffFactor, maxDelay);
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
throw lastError;
|
|
625
|
-
}
|
|
626
|
-
};
|
|
627
|
-
|
|
628
|
-
// src/adapters/request.adapter.ts
|
|
629
|
-
var BaseRequestAdapter = class {
|
|
630
|
-
/**
|
|
631
|
-
* Common transformation utilities
|
|
632
|
-
*/
|
|
633
|
-
formatPhoneNumber(phoneNumber, countryCode = "KR") {
|
|
634
|
-
const digits = phoneNumber.replace(/\D/g, "");
|
|
635
|
-
if (countryCode === "KR") {
|
|
636
|
-
if (digits.startsWith("82")) {
|
|
637
|
-
return digits.substring(2);
|
|
638
|
-
}
|
|
639
|
-
if (digits.startsWith("0")) {
|
|
640
|
-
return digits;
|
|
641
|
-
}
|
|
642
|
-
return "0" + digits;
|
|
643
|
-
}
|
|
644
|
-
return phoneNumber;
|
|
645
|
-
}
|
|
646
|
-
formatVariables(variables) {
|
|
647
|
-
const formatted = {};
|
|
648
|
-
for (const [key, value] of Object.entries(variables)) {
|
|
649
|
-
if (value instanceof Date) {
|
|
650
|
-
formatted[key] = value.toISOString();
|
|
651
|
-
} else if (typeof value === "object") {
|
|
652
|
-
formatted[key] = JSON.stringify(value);
|
|
653
|
-
} else {
|
|
654
|
-
formatted[key] = String(value);
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
return formatted;
|
|
658
|
-
}
|
|
659
|
-
validateRequiredFields(data, requiredFields) {
|
|
660
|
-
const obj = data;
|
|
661
|
-
for (const field of requiredFields) {
|
|
662
|
-
if (!(field in obj) || obj[field] === void 0 || obj[field] === null) {
|
|
663
|
-
throw new Error(`Required field '${field}' is missing`);
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
};
|
|
668
|
-
var IWINVRequestAdapter = class extends BaseRequestAdapter {
|
|
669
|
-
transformMessageRequest(request) {
|
|
670
|
-
this.validateRequiredFields(request, ["templateCode", "phoneNumber"]);
|
|
671
|
-
return {
|
|
672
|
-
profile_key: this.getProfileKey(),
|
|
673
|
-
template_code: request.templateCode,
|
|
674
|
-
phone_number: this.formatPhoneNumber(request.phoneNumber),
|
|
675
|
-
message_variables: this.formatVariables(request.variables),
|
|
676
|
-
sender_number: request.senderNumber,
|
|
677
|
-
reserve_time: request.options?.scheduledAt ? Math.floor(new Date(request.options.scheduledAt).getTime() / 1e3) : void 0
|
|
678
|
-
};
|
|
679
|
-
}
|
|
680
|
-
transformTemplateRequest(request) {
|
|
681
|
-
this.validateRequiredFields(request, ["name", "content"]);
|
|
682
|
-
return {
|
|
683
|
-
profile_key: this.getProfileKey(),
|
|
684
|
-
template_name: request.name,
|
|
685
|
-
template_content: request.content,
|
|
686
|
-
template_category: this.mapCategory(request.category),
|
|
687
|
-
template_variables: request.variables?.map((v) => ({
|
|
688
|
-
name: v.name,
|
|
689
|
-
type: v.type,
|
|
690
|
-
required: v.required ? "Y" : "N",
|
|
691
|
-
max_length: v.maxLength
|
|
692
|
-
})),
|
|
693
|
-
template_buttons: request.buttons?.map((b) => ({
|
|
694
|
-
type: b.type,
|
|
695
|
-
name: b.name,
|
|
696
|
-
url_mobile: b.linkMobile,
|
|
697
|
-
url_pc: b.linkPc,
|
|
698
|
-
scheme_ios: b.schemeIos,
|
|
699
|
-
scheme_android: b.schemeAndroid
|
|
700
|
-
}))
|
|
701
|
-
};
|
|
702
|
-
}
|
|
703
|
-
getProfileKey() {
|
|
704
|
-
return process.env.IWINV_PROFILE_KEY || "";
|
|
705
|
-
}
|
|
706
|
-
mapCategory(category) {
|
|
707
|
-
const categoryMap = {
|
|
708
|
-
"AUTHENTICATION": "A",
|
|
709
|
-
"NOTIFICATION": "N",
|
|
710
|
-
"PROMOTION": "P",
|
|
711
|
-
"INFORMATION": "I"
|
|
712
|
-
};
|
|
713
|
-
return categoryMap[category] || "I";
|
|
714
|
-
}
|
|
715
|
-
};
|
|
716
|
-
var AligoRequestAdapter = class extends BaseRequestAdapter {
|
|
717
|
-
transformMessageRequest(request) {
|
|
718
|
-
this.validateRequiredFields(request, ["templateCode", "phoneNumber"]);
|
|
719
|
-
return {
|
|
720
|
-
apikey: this.getApiKey(),
|
|
721
|
-
userid: this.getUserId(),
|
|
722
|
-
senderkey: this.getSenderKey(),
|
|
723
|
-
template_code: request.templateCode,
|
|
724
|
-
receiver: this.formatPhoneNumber(request.phoneNumber),
|
|
725
|
-
subject: "AlimTalk",
|
|
726
|
-
message: this.buildMessage(request),
|
|
727
|
-
button: request.variables.buttons ? JSON.stringify(request.variables.buttons) : void 0,
|
|
728
|
-
reservation: request.options?.scheduledAt ? this.formatDateTime(new Date(request.options.scheduledAt)) : void 0
|
|
729
|
-
};
|
|
730
|
-
}
|
|
731
|
-
transformTemplateRequest(request) {
|
|
732
|
-
this.validateRequiredFields(request, ["name", "content"]);
|
|
733
|
-
return {
|
|
734
|
-
apikey: this.getApiKey(),
|
|
735
|
-
userid: this.getUserId(),
|
|
736
|
-
senderkey: this.getSenderKey(),
|
|
737
|
-
template_name: request.name,
|
|
738
|
-
template_content: request.content,
|
|
739
|
-
template_emphasis: this.extractEmphasis(request.content),
|
|
740
|
-
template_extra: this.buildTemplateExtra(request),
|
|
741
|
-
template_ad: this.isPromotional(request.category) ? "Y" : "N"
|
|
742
|
-
};
|
|
743
|
-
}
|
|
744
|
-
getApiKey() {
|
|
745
|
-
return process.env.ALIGO_API_KEY || "";
|
|
746
|
-
}
|
|
747
|
-
getUserId() {
|
|
748
|
-
return process.env.ALIGO_USER_ID || "";
|
|
749
|
-
}
|
|
750
|
-
getSenderKey() {
|
|
751
|
-
return process.env.ALIGO_SENDER_KEY || "";
|
|
752
|
-
}
|
|
753
|
-
buildMessage(request) {
|
|
754
|
-
return request.templateCode;
|
|
755
|
-
}
|
|
756
|
-
formatDateTime(date) {
|
|
757
|
-
return date.toISOString().replace(/[-:]/g, "").replace("T", "").substring(0, 12);
|
|
758
|
-
}
|
|
759
|
-
extractEmphasis(content) {
|
|
760
|
-
const emphasisMatch = content.match(/\*\*(.*?)\*\*/);
|
|
761
|
-
return emphasisMatch ? emphasisMatch[1] : "";
|
|
762
|
-
}
|
|
763
|
-
buildTemplateExtra(request) {
|
|
764
|
-
const extra = {};
|
|
765
|
-
if (request.buttons) {
|
|
766
|
-
extra.buttons = request.buttons;
|
|
767
|
-
}
|
|
768
|
-
if (request.variables) {
|
|
769
|
-
extra.variables = request.variables;
|
|
770
|
-
}
|
|
771
|
-
return JSON.stringify(extra);
|
|
772
|
-
}
|
|
773
|
-
isPromotional(category) {
|
|
774
|
-
return category === "PROMOTION";
|
|
775
|
-
}
|
|
776
|
-
};
|
|
777
|
-
var KakaoRequestAdapter = class extends BaseRequestAdapter {
|
|
778
|
-
transformMessageRequest(request) {
|
|
779
|
-
this.validateRequiredFields(request, ["templateCode", "phoneNumber"]);
|
|
780
|
-
return {
|
|
781
|
-
template_object: {
|
|
782
|
-
object_type: "text",
|
|
783
|
-
text: this.buildTemplateText(request),
|
|
784
|
-
link: this.buildTemplateLink(request),
|
|
785
|
-
button_title: request.variables.buttonTitle || ""
|
|
786
|
-
},
|
|
787
|
-
user_ids: [this.formatPhoneNumber(request.phoneNumber)]
|
|
788
|
-
};
|
|
789
|
-
}
|
|
790
|
-
transformTemplateRequest(request) {
|
|
791
|
-
this.validateRequiredFields(request, ["name", "content"]);
|
|
792
|
-
return {
|
|
793
|
-
template: {
|
|
794
|
-
name: request.name,
|
|
795
|
-
content: request.content,
|
|
796
|
-
category_code: this.mapCategoryCode(request.category),
|
|
797
|
-
template_message_type: "BA",
|
|
798
|
-
// Basic AlimTalk
|
|
799
|
-
template_emphasis_type: this.extractEmphasisType(request.content),
|
|
800
|
-
template_title: request.name,
|
|
801
|
-
template_subtitle: "",
|
|
802
|
-
template_imageurl: "",
|
|
803
|
-
template_header: "",
|
|
804
|
-
template_item_highlight: {
|
|
805
|
-
title: "",
|
|
806
|
-
description: ""
|
|
807
|
-
},
|
|
808
|
-
template_item: {
|
|
809
|
-
list: []
|
|
810
|
-
},
|
|
811
|
-
template_button: this.buildTemplateButtons(request.buttons || [])
|
|
812
|
-
}
|
|
813
|
-
};
|
|
814
|
-
}
|
|
815
|
-
buildTemplateText(request) {
|
|
816
|
-
let text = request.templateCode;
|
|
817
|
-
for (const [key, value] of Object.entries(request.variables)) {
|
|
818
|
-
text = text.replace(new RegExp(`#{${key}}`, "g"), String(value));
|
|
819
|
-
}
|
|
820
|
-
return text;
|
|
821
|
-
}
|
|
822
|
-
buildTemplateLink(request) {
|
|
823
|
-
if (request.variables.linkUrl) {
|
|
824
|
-
return {
|
|
825
|
-
web_url: request.variables.linkUrl,
|
|
826
|
-
mobile_web_url: request.variables.linkUrl
|
|
827
|
-
};
|
|
828
|
-
}
|
|
829
|
-
return {};
|
|
830
|
-
}
|
|
831
|
-
mapCategoryCode(category) {
|
|
832
|
-
const categoryMap = {
|
|
833
|
-
"AUTHENTICATION": "999999",
|
|
834
|
-
"NOTIFICATION": "999998",
|
|
835
|
-
"PROMOTION": "999997",
|
|
836
|
-
"INFORMATION": "999996"
|
|
837
|
-
};
|
|
838
|
-
return categoryMap[category] || "999999";
|
|
839
|
-
}
|
|
840
|
-
extractEmphasisType(content) {
|
|
841
|
-
if (content.includes("**")) return "BOLD";
|
|
842
|
-
if (content.includes("__")) return "UNDERLINE";
|
|
843
|
-
return "NONE";
|
|
844
|
-
}
|
|
845
|
-
buildTemplateButtons(buttons) {
|
|
846
|
-
return buttons.map((button) => {
|
|
847
|
-
const btn = button;
|
|
848
|
-
return {
|
|
849
|
-
name: btn.name,
|
|
850
|
-
type: btn.type,
|
|
851
|
-
url_mobile: btn.linkMobile,
|
|
852
|
-
url_pc: btn.linkPc,
|
|
853
|
-
scheme_ios: btn.schemeIos,
|
|
854
|
-
scheme_android: btn.schemeAndroid
|
|
855
|
-
};
|
|
856
|
-
});
|
|
857
|
-
}
|
|
858
|
-
};
|
|
859
|
-
var RequestAdapterFactory = class _RequestAdapterFactory {
|
|
860
|
-
static adapters = /* @__PURE__ */ new Map();
|
|
861
|
-
static {
|
|
862
|
-
_RequestAdapterFactory.adapters.set("iwinv", IWINVRequestAdapter);
|
|
863
|
-
_RequestAdapterFactory.adapters.set("aligo", AligoRequestAdapter);
|
|
864
|
-
_RequestAdapterFactory.adapters.set("kakao", KakaoRequestAdapter);
|
|
865
|
-
}
|
|
866
|
-
static create(providerId) {
|
|
867
|
-
const AdapterClass = this.adapters.get(providerId.toLowerCase());
|
|
868
|
-
if (!AdapterClass) {
|
|
869
|
-
throw new Error(`No request adapter found for provider: ${providerId}`);
|
|
870
|
-
}
|
|
871
|
-
return new AdapterClass();
|
|
872
|
-
}
|
|
873
|
-
static register(providerId, adapterClass) {
|
|
874
|
-
this.adapters.set(providerId.toLowerCase(), adapterClass);
|
|
875
|
-
}
|
|
876
|
-
};
|
|
877
|
-
|
|
878
|
-
// src/adapters/response.adapter.ts
|
|
879
|
-
var BaseResponseAdapter = class {
|
|
880
|
-
/**
|
|
881
|
-
* Common error transformation
|
|
882
|
-
*/
|
|
883
|
-
transformError(providerError) {
|
|
884
|
-
return {
|
|
885
|
-
code: this.extractErrorCode(providerError),
|
|
886
|
-
message: this.extractErrorMessage(providerError),
|
|
887
|
-
details: this.extractErrorDetails(providerError)
|
|
888
|
-
};
|
|
889
|
-
}
|
|
890
|
-
/**
|
|
891
|
-
* Common status mapping utilities
|
|
892
|
-
*/
|
|
893
|
-
mapMessageStatus(providerStatus) {
|
|
894
|
-
const statusMap = {
|
|
895
|
-
"queued": "QUEUED" /* QUEUED */,
|
|
896
|
-
"sending": "SENDING" /* SENDING */,
|
|
897
|
-
"sent": "SENT" /* SENT */,
|
|
898
|
-
"delivered": "DELIVERED" /* DELIVERED */,
|
|
899
|
-
"failed": "FAILED" /* FAILED */,
|
|
900
|
-
"cancelled": "CANCELLED" /* CANCELLED */
|
|
901
|
-
};
|
|
902
|
-
return statusMap[providerStatus.toLowerCase()] || "FAILED" /* FAILED */;
|
|
903
|
-
}
|
|
904
|
-
mapTemplateStatus(providerStatus) {
|
|
905
|
-
const statusMap = {
|
|
906
|
-
"draft": "DRAFT" /* DRAFT */,
|
|
907
|
-
"pending": "PENDING" /* PENDING */,
|
|
908
|
-
"approved": "APPROVED" /* APPROVED */,
|
|
909
|
-
"rejected": "REJECTED" /* REJECTED */,
|
|
910
|
-
"disabled": "DISABLED" /* DISABLED */
|
|
911
|
-
};
|
|
912
|
-
return statusMap[providerStatus.toLowerCase()] || "DRAFT" /* DRAFT */;
|
|
913
|
-
}
|
|
914
|
-
parseDate(dateString) {
|
|
915
|
-
if (!dateString) return void 0;
|
|
916
|
-
try {
|
|
917
|
-
return new Date(dateString);
|
|
918
|
-
} catch {
|
|
919
|
-
return void 0;
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
};
|
|
923
|
-
var IWINVResponseAdapter = class extends BaseResponseAdapter {
|
|
924
|
-
transformMessageResponse(providerResponse) {
|
|
925
|
-
const response = providerResponse;
|
|
926
|
-
return {
|
|
927
|
-
messageId: response.msg_id || response.msgid,
|
|
928
|
-
status: this.mapIWINVMessageStatus(response.result_code),
|
|
929
|
-
sentAt: this.parseDate(response.send_time),
|
|
930
|
-
error: response.result_code !== "1" ? this.transformError(providerResponse) : void 0
|
|
931
|
-
};
|
|
932
|
-
}
|
|
933
|
-
transformTemplateResponse(providerResponse) {
|
|
934
|
-
const response = providerResponse;
|
|
935
|
-
return {
|
|
936
|
-
templateId: response.template_id,
|
|
937
|
-
providerTemplateCode: response.template_code,
|
|
938
|
-
status: this.mapIWINVTemplateStatus(response.status),
|
|
939
|
-
message: response.message || response.comment
|
|
940
|
-
};
|
|
941
|
-
}
|
|
942
|
-
mapIWINVMessageStatus(resultCode) {
|
|
943
|
-
const statusMap = {
|
|
944
|
-
"1": "SENT" /* SENT */,
|
|
945
|
-
"0": "FAILED" /* FAILED */,
|
|
946
|
-
"-1": "FAILED" /* FAILED */,
|
|
947
|
-
"-2": "FAILED" /* FAILED */,
|
|
948
|
-
"-3": "FAILED" /* FAILED */,
|
|
949
|
-
"-4": "FAILED" /* FAILED */
|
|
950
|
-
};
|
|
951
|
-
return statusMap[resultCode] || "FAILED" /* FAILED */;
|
|
952
|
-
}
|
|
953
|
-
mapIWINVTemplateStatus(status) {
|
|
954
|
-
const statusMap = {
|
|
955
|
-
"R": "PENDING" /* PENDING */,
|
|
956
|
-
// Request
|
|
957
|
-
"A": "APPROVED" /* APPROVED */,
|
|
958
|
-
// Approved
|
|
959
|
-
"C": "REJECTED" /* REJECTED */,
|
|
960
|
-
// Cancelled/Rejected
|
|
961
|
-
"S": "PENDING" /* PENDING */
|
|
962
|
-
// Standby
|
|
963
|
-
};
|
|
964
|
-
return statusMap[status] || "DRAFT" /* DRAFT */;
|
|
965
|
-
}
|
|
966
|
-
extractErrorCode(providerError) {
|
|
967
|
-
const error = providerError;
|
|
968
|
-
return error.result_code || error.error_code || "UNKNOWN_ERROR";
|
|
969
|
-
}
|
|
970
|
-
extractErrorMessage(providerError) {
|
|
971
|
-
const error = providerError;
|
|
972
|
-
return error.message || error.error_message || "Unknown error occurred";
|
|
973
|
-
}
|
|
974
|
-
extractErrorDetails(providerError) {
|
|
975
|
-
const error = providerError;
|
|
976
|
-
return {
|
|
977
|
-
resultCode: error.result_code,
|
|
978
|
-
originalResponse: providerError
|
|
979
|
-
};
|
|
980
|
-
}
|
|
981
|
-
};
|
|
982
|
-
var AligoResponseAdapter = class extends BaseResponseAdapter {
|
|
983
|
-
transformMessageResponse(providerResponse) {
|
|
984
|
-
const response = providerResponse;
|
|
985
|
-
return {
|
|
986
|
-
messageId: response.msg_id || response.mid,
|
|
987
|
-
status: this.mapAligoMessageStatus(response.result_code),
|
|
988
|
-
sentAt: this.parseDate(response.send_time),
|
|
989
|
-
error: response.result_code !== "1" ? this.transformError(providerResponse) : void 0
|
|
990
|
-
};
|
|
991
|
-
}
|
|
992
|
-
transformTemplateResponse(providerResponse) {
|
|
993
|
-
const response = providerResponse;
|
|
994
|
-
return {
|
|
995
|
-
templateId: response.template_code,
|
|
996
|
-
providerTemplateCode: response.template_code,
|
|
997
|
-
status: this.mapAligoTemplateStatus(response.inspect_status),
|
|
998
|
-
message: response.comment
|
|
999
|
-
};
|
|
1000
|
-
}
|
|
1001
|
-
mapAligoMessageStatus(resultCode) {
|
|
1002
|
-
const statusMap = {
|
|
1003
|
-
"1": "SENT" /* SENT */,
|
|
1004
|
-
"0": "FAILED" /* FAILED */,
|
|
1005
|
-
"-1": "FAILED" /* FAILED */,
|
|
1006
|
-
"-101": "FAILED" /* FAILED */,
|
|
1007
|
-
"-102": "FAILED" /* FAILED */
|
|
1008
|
-
};
|
|
1009
|
-
return statusMap[resultCode] || "FAILED" /* FAILED */;
|
|
1010
|
-
}
|
|
1011
|
-
mapAligoTemplateStatus(inspectStatus) {
|
|
1012
|
-
const statusMap = {
|
|
1013
|
-
"REG": "PENDING" /* PENDING */,
|
|
1014
|
-
// Registered
|
|
1015
|
-
"REQ": "PENDING" /* PENDING */,
|
|
1016
|
-
// Request
|
|
1017
|
-
"APR": "APPROVED" /* APPROVED */,
|
|
1018
|
-
// Approved
|
|
1019
|
-
"REJ": "REJECTED" /* REJECTED */,
|
|
1020
|
-
// Rejected
|
|
1021
|
-
"STOP": "DISABLED" /* DISABLED */
|
|
1022
|
-
// Stopped
|
|
1023
|
-
};
|
|
1024
|
-
return statusMap[inspectStatus] || "DRAFT" /* DRAFT */;
|
|
1025
|
-
}
|
|
1026
|
-
extractErrorCode(providerError) {
|
|
1027
|
-
const error = providerError;
|
|
1028
|
-
return error.result_code || error.code || "UNKNOWN_ERROR";
|
|
1029
|
-
}
|
|
1030
|
-
extractErrorMessage(providerError) {
|
|
1031
|
-
const error = providerError;
|
|
1032
|
-
return error.message || error.error || "Unknown error occurred";
|
|
1033
|
-
}
|
|
1034
|
-
extractErrorDetails(providerError) {
|
|
1035
|
-
const error = providerError;
|
|
1036
|
-
return {
|
|
1037
|
-
resultCode: error.result_code,
|
|
1038
|
-
inspectStatus: error.inspect_status,
|
|
1039
|
-
originalResponse: providerError
|
|
1040
|
-
};
|
|
1041
|
-
}
|
|
1042
|
-
};
|
|
1043
|
-
var KakaoResponseAdapter = class extends BaseResponseAdapter {
|
|
1044
|
-
transformMessageResponse(providerResponse) {
|
|
1045
|
-
const response = providerResponse;
|
|
1046
|
-
return {
|
|
1047
|
-
messageId: response.message_id,
|
|
1048
|
-
status: this.mapKakaoMessageStatus(response.result_code),
|
|
1049
|
-
sentAt: this.parseDate(response.sent_time),
|
|
1050
|
-
error: response.result_code !== 0 ? this.transformError(providerResponse) : void 0
|
|
1051
|
-
};
|
|
1052
|
-
}
|
|
1053
|
-
transformTemplateResponse(providerResponse) {
|
|
1054
|
-
const response = providerResponse;
|
|
1055
|
-
return {
|
|
1056
|
-
templateId: response.template_id,
|
|
1057
|
-
providerTemplateCode: response.template_code,
|
|
1058
|
-
status: this.mapKakaoTemplateStatus(response.status),
|
|
1059
|
-
message: response.comments
|
|
1060
|
-
};
|
|
1061
|
-
}
|
|
1062
|
-
mapKakaoMessageStatus(resultCode) {
|
|
1063
|
-
const statusMap = {
|
|
1064
|
-
0: "SENT" /* SENT */,
|
|
1065
|
-
[-1]: "FAILED" /* FAILED */,
|
|
1066
|
-
[-2]: "FAILED" /* FAILED */,
|
|
1067
|
-
[-3]: "FAILED" /* FAILED */,
|
|
1068
|
-
[-999]: "FAILED" /* FAILED */
|
|
1069
|
-
};
|
|
1070
|
-
return statusMap[resultCode] || "FAILED" /* FAILED */;
|
|
1071
|
-
}
|
|
1072
|
-
mapKakaoTemplateStatus(status) {
|
|
1073
|
-
const statusMap = {
|
|
1074
|
-
"TSC01": "PENDING" /* PENDING */,
|
|
1075
|
-
// Under review
|
|
1076
|
-
"TSC02": "APPROVED" /* APPROVED */,
|
|
1077
|
-
// Approved
|
|
1078
|
-
"TSC03": "REJECTED" /* REJECTED */,
|
|
1079
|
-
// Rejected
|
|
1080
|
-
"TSC04": "DISABLED" /* DISABLED */
|
|
1081
|
-
// Disabled
|
|
1082
|
-
};
|
|
1083
|
-
return statusMap[status] || "DRAFT" /* DRAFT */;
|
|
1084
|
-
}
|
|
1085
|
-
extractErrorCode(providerError) {
|
|
1086
|
-
const error = providerError;
|
|
1087
|
-
return String(error.result_code || error.error_code || "UNKNOWN_ERROR");
|
|
1088
|
-
}
|
|
1089
|
-
extractErrorMessage(providerError) {
|
|
1090
|
-
const error = providerError;
|
|
1091
|
-
return error.message || error.error_message || "Unknown error occurred";
|
|
1092
|
-
}
|
|
1093
|
-
extractErrorDetails(providerError) {
|
|
1094
|
-
const error = providerError;
|
|
1095
|
-
return {
|
|
1096
|
-
resultCode: error.result_code,
|
|
1097
|
-
originalResponse: providerError
|
|
1098
|
-
};
|
|
1099
|
-
}
|
|
1100
|
-
};
|
|
1101
|
-
var NHNResponseAdapter = class extends BaseResponseAdapter {
|
|
1102
|
-
transformMessageResponse(providerResponse) {
|
|
1103
|
-
const response = providerResponse;
|
|
1104
|
-
return {
|
|
1105
|
-
messageId: response.requestId,
|
|
1106
|
-
status: this.mapNHNMessageStatus(response.statusCode),
|
|
1107
|
-
sentAt: this.parseDate(response.statusDateTime),
|
|
1108
|
-
error: response.statusCode !== "SSS" ? this.transformError(providerResponse) : void 0
|
|
1109
|
-
};
|
|
1110
|
-
}
|
|
1111
|
-
transformTemplateResponse(providerResponse) {
|
|
1112
|
-
const response = providerResponse;
|
|
1113
|
-
return {
|
|
1114
|
-
templateId: response.templateId,
|
|
1115
|
-
providerTemplateCode: response.templateId,
|
|
1116
|
-
status: this.mapNHNTemplateStatus(response.templateStatus),
|
|
1117
|
-
message: response.templateStatusName
|
|
1118
|
-
};
|
|
1119
|
-
}
|
|
1120
|
-
mapNHNMessageStatus(statusCode) {
|
|
1121
|
-
const statusMap = {
|
|
1122
|
-
"SSS": "SENT" /* SENT */,
|
|
1123
|
-
// Success
|
|
1124
|
-
"RDY": "QUEUED" /* QUEUED */,
|
|
1125
|
-
// Ready
|
|
1126
|
-
"PRG": "SENDING" /* SENDING */,
|
|
1127
|
-
// Progress
|
|
1128
|
-
"CPL": "DELIVERED" /* DELIVERED */,
|
|
1129
|
-
// Complete
|
|
1130
|
-
"FAL": "FAILED" /* FAILED */,
|
|
1131
|
-
// Failed
|
|
1132
|
-
"CAL": "CANCELLED" /* CANCELLED */
|
|
1133
|
-
// Cancelled
|
|
1134
|
-
};
|
|
1135
|
-
return statusMap[statusCode] || "FAILED" /* FAILED */;
|
|
1136
|
-
}
|
|
1137
|
-
mapNHNTemplateStatus(templateStatus) {
|
|
1138
|
-
const statusMap = {
|
|
1139
|
-
"WAITING": "PENDING" /* PENDING */,
|
|
1140
|
-
"APPROVED": "APPROVED" /* APPROVED */,
|
|
1141
|
-
"REJECTED": "REJECTED" /* REJECTED */,
|
|
1142
|
-
"DISABLED": "DISABLED" /* DISABLED */
|
|
1143
|
-
};
|
|
1144
|
-
return statusMap[templateStatus] || "DRAFT" /* DRAFT */;
|
|
1145
|
-
}
|
|
1146
|
-
extractErrorCode(providerError) {
|
|
1147
|
-
const error = providerError;
|
|
1148
|
-
return error.statusCode || error.errorCode || "UNKNOWN_ERROR";
|
|
1149
|
-
}
|
|
1150
|
-
extractErrorMessage(providerError) {
|
|
1151
|
-
const error = providerError;
|
|
1152
|
-
return error.statusMessage || error.errorMessage || "Unknown error occurred";
|
|
1153
|
-
}
|
|
1154
|
-
extractErrorDetails(providerError) {
|
|
1155
|
-
const error = providerError;
|
|
1156
|
-
return {
|
|
1157
|
-
statusCode: error.statusCode,
|
|
1158
|
-
statusMessage: error.statusMessage,
|
|
1159
|
-
originalResponse: providerError
|
|
1160
|
-
};
|
|
1161
|
-
}
|
|
1162
|
-
};
|
|
1163
|
-
var ResponseAdapterFactory = class {
|
|
1164
|
-
static adapters = /* @__PURE__ */ new Map([
|
|
1165
|
-
["iwinv", IWINVResponseAdapter],
|
|
1166
|
-
["aligo", AligoResponseAdapter],
|
|
1167
|
-
["kakao", KakaoResponseAdapter],
|
|
1168
|
-
["nhn", NHNResponseAdapter]
|
|
1169
|
-
]);
|
|
1170
|
-
static create(providerId) {
|
|
1171
|
-
const AdapterClass = this.adapters.get(providerId.toLowerCase());
|
|
1172
|
-
if (!AdapterClass) {
|
|
1173
|
-
throw new Error(`No response adapter found for provider: ${providerId}`);
|
|
1174
|
-
}
|
|
1175
|
-
return new AdapterClass();
|
|
1176
|
-
}
|
|
1177
|
-
static register(providerId, adapterClass) {
|
|
1178
|
-
this.adapters.set(providerId.toLowerCase(), adapterClass);
|
|
1179
|
-
}
|
|
1180
|
-
};
|
|
1181
|
-
|
|
1182
|
-
// src/services/provider.manager.ts
|
|
1183
|
-
var ProviderManager = class {
|
|
1184
|
-
providers = /* @__PURE__ */ new Map();
|
|
1185
|
-
defaultProvider;
|
|
1186
|
-
registerProvider(provider) {
|
|
1187
|
-
this.providers.set(provider.id, provider);
|
|
1188
|
-
if (!this.defaultProvider) {
|
|
1189
|
-
this.defaultProvider = provider.id;
|
|
1190
|
-
}
|
|
1191
|
-
}
|
|
1192
|
-
unregisterProvider(providerId) {
|
|
1193
|
-
this.providers.delete(providerId);
|
|
1194
|
-
if (this.defaultProvider === providerId) {
|
|
1195
|
-
const remaining = Array.from(this.providers.keys());
|
|
1196
|
-
this.defaultProvider = remaining.length > 0 ? remaining[0] : void 0;
|
|
1197
|
-
}
|
|
1198
|
-
}
|
|
1199
|
-
getProvider(providerId) {
|
|
1200
|
-
const id = providerId || this.defaultProvider;
|
|
1201
|
-
return id ? this.providers.get(id) || null : null;
|
|
1202
|
-
}
|
|
1203
|
-
listProviders() {
|
|
1204
|
-
return Array.from(this.providers.values());
|
|
1205
|
-
}
|
|
1206
|
-
setDefaultProvider(providerId) {
|
|
1207
|
-
if (!this.providers.has(providerId)) {
|
|
1208
|
-
throw new Error(`Provider ${providerId} not found`);
|
|
1209
|
-
}
|
|
1210
|
-
this.defaultProvider = providerId;
|
|
1211
|
-
}
|
|
1212
|
-
async healthCheckAll() {
|
|
1213
|
-
const results = {};
|
|
1214
|
-
for (const [id, provider] of this.providers.entries()) {
|
|
1215
|
-
try {
|
|
1216
|
-
const health = await provider.healthCheck();
|
|
1217
|
-
results[id] = health.healthy;
|
|
1218
|
-
} catch (error) {
|
|
1219
|
-
results[id] = false;
|
|
1220
|
-
}
|
|
1221
|
-
}
|
|
1222
|
-
return results;
|
|
1223
|
-
}
|
|
1224
|
-
getProvidersForChannel(channel) {
|
|
1225
|
-
return Array.from(this.providers.values()).filter((provider) => {
|
|
1226
|
-
const providerWithChannels = provider;
|
|
1227
|
-
return providerWithChannels.supportedChannels?.includes(channel);
|
|
1228
|
-
});
|
|
1229
|
-
}
|
|
1230
|
-
};
|
|
1231
|
-
|
|
1232
|
-
// src/iwinv/contracts/messaging.contract.ts
|
|
1233
|
-
var IWINVMessagingContract = class {
|
|
1234
|
-
constructor(config) {
|
|
1235
|
-
this.config = config;
|
|
1236
|
-
}
|
|
1237
|
-
async send(message) {
|
|
1238
|
-
try {
|
|
1239
|
-
const response = await fetch(`${this.config.baseUrl}/send`, {
|
|
1240
|
-
method: "POST",
|
|
1241
|
-
headers: {
|
|
1242
|
-
"Content-Type": "application/json",
|
|
1243
|
-
"Authorization": `Bearer ${this.config.apiKey}`
|
|
1244
|
-
},
|
|
1245
|
-
body: JSON.stringify({
|
|
1246
|
-
templateCode: message.templateCode,
|
|
1247
|
-
phone: message.phoneNumber,
|
|
1248
|
-
variables: message.variables,
|
|
1249
|
-
senderNumber: message.senderNumber,
|
|
1250
|
-
...message.options
|
|
1251
|
-
})
|
|
1252
|
-
});
|
|
1253
|
-
const result = await response.json();
|
|
1254
|
-
if (!response.ok) {
|
|
1255
|
-
return {
|
|
1256
|
-
messageId: `failed_${Date.now()}`,
|
|
1257
|
-
status: "FAILED" /* FAILED */,
|
|
1258
|
-
error: {
|
|
1259
|
-
code: result.code || "SEND_FAILED",
|
|
1260
|
-
message: result.message || "Failed to send message"
|
|
1261
|
-
}
|
|
1262
|
-
};
|
|
1263
|
-
}
|
|
1264
|
-
return {
|
|
1265
|
-
messageId: result.messageId || `msg_${Date.now()}`,
|
|
1266
|
-
status: "SENT" /* SENT */,
|
|
1267
|
-
sentAt: /* @__PURE__ */ new Date()
|
|
1268
|
-
};
|
|
1269
|
-
} catch (error) {
|
|
1270
|
-
return {
|
|
1271
|
-
messageId: `error_${Date.now()}`,
|
|
1272
|
-
status: "FAILED" /* FAILED */,
|
|
1273
|
-
error: {
|
|
1274
|
-
code: "NETWORK_ERROR",
|
|
1275
|
-
message: error instanceof Error ? error.message : "Network error occurred"
|
|
1276
|
-
}
|
|
1277
|
-
};
|
|
1278
|
-
}
|
|
1279
|
-
}
|
|
1280
|
-
async sendBulk(messages) {
|
|
1281
|
-
const results = [];
|
|
1282
|
-
for (const message of messages) {
|
|
1283
|
-
const result = await this.send(message);
|
|
1284
|
-
results.push(result);
|
|
1285
|
-
}
|
|
1286
|
-
const sent = results.filter((r) => r.status === "SENT" /* SENT */).length;
|
|
1287
|
-
const failed = results.filter((r) => r.status === "FAILED" /* FAILED */).length;
|
|
1288
|
-
return {
|
|
1289
|
-
requestId: `bulk_${Date.now()}`,
|
|
1290
|
-
results,
|
|
1291
|
-
summary: {
|
|
1292
|
-
total: messages.length,
|
|
1293
|
-
sent,
|
|
1294
|
-
failed
|
|
1295
|
-
}
|
|
1296
|
-
};
|
|
1297
|
-
}
|
|
1298
|
-
async schedule(message, scheduledAt) {
|
|
1299
|
-
return {
|
|
1300
|
-
scheduleId: `schedule_${Date.now()}`,
|
|
1301
|
-
messageId: `msg_${Date.now()}`,
|
|
1302
|
-
scheduledAt,
|
|
1303
|
-
status: "scheduled"
|
|
1304
|
-
};
|
|
1305
|
-
}
|
|
1306
|
-
async cancel(messageId) {
|
|
1307
|
-
const response = await fetch(`${this.config.baseUrl}/cancel`, {
|
|
1308
|
-
method: "POST",
|
|
1309
|
-
headers: {
|
|
1310
|
-
"Content-Type": "application/json",
|
|
1311
|
-
"Authorization": `Bearer ${this.config.apiKey}`
|
|
1312
|
-
},
|
|
1313
|
-
body: JSON.stringify({ messageId })
|
|
1314
|
-
});
|
|
1315
|
-
if (!response.ok) {
|
|
1316
|
-
const result = await response.json();
|
|
1317
|
-
throw new Error(`Failed to cancel message: ${result.message}`);
|
|
1318
|
-
}
|
|
1319
|
-
}
|
|
1320
|
-
async getStatus(messageId) {
|
|
1321
|
-
try {
|
|
1322
|
-
const response = await fetch(`${this.config.baseUrl}/status`, {
|
|
1323
|
-
method: "POST",
|
|
1324
|
-
headers: {
|
|
1325
|
-
"Content-Type": "application/json",
|
|
1326
|
-
"Authorization": `Bearer ${this.config.apiKey}`
|
|
1327
|
-
},
|
|
1328
|
-
body: JSON.stringify({ messageId })
|
|
1329
|
-
});
|
|
1330
|
-
const result = await response.json();
|
|
1331
|
-
if (!response.ok) {
|
|
1332
|
-
return "FAILED" /* FAILED */;
|
|
1333
|
-
}
|
|
1334
|
-
switch (result.statusCode) {
|
|
1335
|
-
case "OK":
|
|
1336
|
-
return "DELIVERED" /* DELIVERED */;
|
|
1337
|
-
case "PENDING":
|
|
1338
|
-
return "SENDING" /* SENDING */;
|
|
1339
|
-
case "FAILED":
|
|
1340
|
-
return "FAILED" /* FAILED */;
|
|
1341
|
-
default:
|
|
1342
|
-
return "SENT" /* SENT */;
|
|
1343
|
-
}
|
|
1344
|
-
} catch (error) {
|
|
1345
|
-
return "FAILED" /* FAILED */;
|
|
1346
|
-
}
|
|
1347
|
-
}
|
|
1348
|
-
};
|
|
1349
|
-
|
|
1350
|
-
// src/iwinv/contracts/template.contract.ts
|
|
1351
|
-
var IWINVTemplateContract = class {
|
|
1352
|
-
constructor(config) {
|
|
1353
|
-
this.config = config;
|
|
1354
|
-
}
|
|
1355
|
-
async create(template) {
|
|
1356
|
-
try {
|
|
1357
|
-
const response = await fetch(`${this.config.baseUrl}/template/create`, {
|
|
1358
|
-
method: "POST",
|
|
1359
|
-
headers: {
|
|
1360
|
-
"Content-Type": "application/json",
|
|
1361
|
-
"Authorization": `Bearer ${this.config.apiKey}`
|
|
1362
|
-
},
|
|
1363
|
-
body: JSON.stringify({
|
|
1364
|
-
templateName: template.name,
|
|
1365
|
-
templateContent: template.content,
|
|
1366
|
-
templateCategory: template.category,
|
|
1367
|
-
templateVariables: template.variables,
|
|
1368
|
-
templateButtons: template.buttons
|
|
1369
|
-
})
|
|
1370
|
-
});
|
|
1371
|
-
const result = await response.json();
|
|
1372
|
-
if (!response.ok) {
|
|
1373
|
-
throw new Error(`Template creation failed: ${result.message}`);
|
|
1374
|
-
}
|
|
1375
|
-
return {
|
|
1376
|
-
templateId: result.templateId || `tpl_${Date.now()}`,
|
|
1377
|
-
providerTemplateCode: result.templateCode || template.name,
|
|
1378
|
-
status: "PENDING" /* PENDING */,
|
|
1379
|
-
message: result.message || "Template created successfully"
|
|
1380
|
-
};
|
|
1381
|
-
} catch (error) {
|
|
1382
|
-
throw new Error(`Failed to create template: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
1383
|
-
}
|
|
1384
|
-
}
|
|
1385
|
-
async update(templateId, template) {
|
|
1386
|
-
try {
|
|
1387
|
-
const response = await fetch(`${this.config.baseUrl}/template/modify`, {
|
|
1388
|
-
method: "POST",
|
|
1389
|
-
headers: {
|
|
1390
|
-
"Content-Type": "application/json",
|
|
1391
|
-
"Authorization": `Bearer ${this.config.apiKey}`
|
|
1392
|
-
},
|
|
1393
|
-
body: JSON.stringify({
|
|
1394
|
-
templateCode: templateId,
|
|
1395
|
-
templateName: template.name,
|
|
1396
|
-
templateContent: template.content,
|
|
1397
|
-
templateButtons: template.buttons
|
|
1398
|
-
})
|
|
1399
|
-
});
|
|
1400
|
-
const result = await response.json();
|
|
1401
|
-
if (!response.ok) {
|
|
1402
|
-
throw new Error(`Template update failed: ${result.message}`);
|
|
1403
|
-
}
|
|
1404
|
-
return {
|
|
1405
|
-
templateId,
|
|
1406
|
-
status: "PENDING" /* PENDING */,
|
|
1407
|
-
message: result.message || "Template updated successfully"
|
|
1408
|
-
};
|
|
1409
|
-
} catch (error) {
|
|
1410
|
-
throw new Error(`Failed to update template: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
1411
|
-
}
|
|
1412
|
-
}
|
|
1413
|
-
async delete(templateId) {
|
|
1414
|
-
try {
|
|
1415
|
-
const response = await fetch(`${this.config.baseUrl}/template/delete`, {
|
|
1416
|
-
method: "POST",
|
|
1417
|
-
headers: {
|
|
1418
|
-
"Content-Type": "application/json",
|
|
1419
|
-
"Authorization": `Bearer ${this.config.apiKey}`
|
|
1420
|
-
},
|
|
1421
|
-
body: JSON.stringify({
|
|
1422
|
-
templateCode: templateId
|
|
1423
|
-
})
|
|
1424
|
-
});
|
|
1425
|
-
const result = await response.json();
|
|
1426
|
-
if (!response.ok) {
|
|
1427
|
-
throw new Error(`Template deletion failed: ${result.message}`);
|
|
1428
|
-
}
|
|
1429
|
-
} catch (error) {
|
|
1430
|
-
throw new Error(`Failed to delete template: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
1431
|
-
}
|
|
1432
|
-
}
|
|
1433
|
-
async get(templateId) {
|
|
1434
|
-
const templates = await this.list({ templateCode: templateId });
|
|
1435
|
-
const template = templates.find((t) => t.code === templateId);
|
|
1436
|
-
if (!template) {
|
|
1437
|
-
throw new Error(`Template ${templateId} not found`);
|
|
1438
|
-
}
|
|
1439
|
-
return template;
|
|
1440
|
-
}
|
|
1441
|
-
async list(filters) {
|
|
1442
|
-
try {
|
|
1443
|
-
const response = await fetch(`${this.config.baseUrl}/template/list`, {
|
|
1444
|
-
method: "POST",
|
|
1445
|
-
headers: {
|
|
1446
|
-
"Content-Type": "application/json",
|
|
1447
|
-
"Authorization": `Bearer ${this.config.apiKey}`
|
|
1448
|
-
},
|
|
1449
|
-
body: JSON.stringify({
|
|
1450
|
-
page: 1,
|
|
1451
|
-
size: 100,
|
|
1452
|
-
...filters
|
|
1453
|
-
})
|
|
1454
|
-
});
|
|
1455
|
-
const result = await response.json();
|
|
1456
|
-
if (!response.ok) {
|
|
1457
|
-
throw new Error(`Failed to list templates: ${result.message}`);
|
|
1458
|
-
}
|
|
1459
|
-
return (result.list || []).map((template) => ({
|
|
1460
|
-
id: template.templateId || template.templateCode,
|
|
1461
|
-
code: template.templateCode,
|
|
1462
|
-
name: template.templateName,
|
|
1463
|
-
content: template.templateContent,
|
|
1464
|
-
status: this.mapIWINVStatus(template.status || template.templateStatus),
|
|
1465
|
-
createdAt: template.createDate ? new Date(template.createDate) : /* @__PURE__ */ new Date(),
|
|
1466
|
-
updatedAt: template.updateDate ? new Date(template.updateDate) : /* @__PURE__ */ new Date(),
|
|
1467
|
-
approvedAt: template.approvedAt ? new Date(template.approvedAt) : void 0,
|
|
1468
|
-
rejectedAt: template.rejectedAt ? new Date(template.rejectedAt) : void 0,
|
|
1469
|
-
rejectionReason: template.rejectionReason
|
|
1470
|
-
}));
|
|
1471
|
-
} catch (error) {
|
|
1472
|
-
throw new Error(`Failed to list templates: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
1473
|
-
}
|
|
1474
|
-
}
|
|
1475
|
-
async sync() {
|
|
1476
|
-
try {
|
|
1477
|
-
const templates = await this.list();
|
|
1478
|
-
return {
|
|
1479
|
-
synced: templates.length,
|
|
1480
|
-
created: 0,
|
|
1481
|
-
updated: 0,
|
|
1482
|
-
deleted: 0,
|
|
1483
|
-
errors: []
|
|
1484
|
-
};
|
|
1485
|
-
} catch (error) {
|
|
1486
|
-
return {
|
|
1487
|
-
synced: 0,
|
|
1488
|
-
created: 0,
|
|
1489
|
-
updated: 0,
|
|
1490
|
-
deleted: 0,
|
|
1491
|
-
errors: [{
|
|
1492
|
-
templateId: "unknown",
|
|
1493
|
-
error: error instanceof Error ? error.message : "Sync failed"
|
|
1494
|
-
}]
|
|
1495
|
-
};
|
|
1496
|
-
}
|
|
1497
|
-
}
|
|
1498
|
-
mapIWINVStatus(status) {
|
|
1499
|
-
switch (status) {
|
|
1500
|
-
case "Y":
|
|
1501
|
-
return "APPROVED" /* APPROVED */;
|
|
1502
|
-
case "I":
|
|
1503
|
-
return "PENDING" /* PENDING */;
|
|
1504
|
-
case "R":
|
|
1505
|
-
return "REJECTED" /* REJECTED */;
|
|
1506
|
-
case "D":
|
|
1507
|
-
return "DISABLED" /* DISABLED */;
|
|
1508
|
-
default:
|
|
1509
|
-
return "DRAFT" /* DRAFT */;
|
|
1510
|
-
}
|
|
1511
|
-
}
|
|
1512
|
-
};
|
|
1513
|
-
|
|
1514
|
-
// src/iwinv/contracts/channel.contract.ts
|
|
1515
|
-
var IWINVChannelContract = class {
|
|
1516
|
-
constructor(config) {
|
|
1517
|
-
this.config = config;
|
|
1518
|
-
}
|
|
1519
|
-
async register(channel) {
|
|
1520
|
-
return {
|
|
1521
|
-
id: `channel_${Date.now()}`,
|
|
1522
|
-
name: channel.name,
|
|
1523
|
-
profileKey: channel.profileKey,
|
|
1524
|
-
status: "pending",
|
|
1525
|
-
createdAt: /* @__PURE__ */ new Date(),
|
|
1526
|
-
updatedAt: /* @__PURE__ */ new Date()
|
|
1527
|
-
};
|
|
1528
|
-
}
|
|
1529
|
-
async list() {
|
|
1530
|
-
return [
|
|
1531
|
-
{
|
|
1532
|
-
id: "iwinv-default",
|
|
1533
|
-
name: "IWINV Default Channel",
|
|
1534
|
-
profileKey: "default",
|
|
1535
|
-
status: "active",
|
|
1536
|
-
createdAt: /* @__PURE__ */ new Date(),
|
|
1537
|
-
updatedAt: /* @__PURE__ */ new Date()
|
|
1538
|
-
}
|
|
1539
|
-
];
|
|
1540
|
-
}
|
|
1541
|
-
async addSenderNumber(channelId, number) {
|
|
1542
|
-
return {
|
|
1543
|
-
id: `sender_${Date.now()}`,
|
|
1544
|
-
channelId,
|
|
1545
|
-
phoneNumber: number,
|
|
1546
|
-
isVerified: false,
|
|
1547
|
-
createdAt: /* @__PURE__ */ new Date()
|
|
1548
|
-
};
|
|
1549
|
-
}
|
|
1550
|
-
async verifySenderNumber(number, verificationCode) {
|
|
1551
|
-
return true;
|
|
1552
|
-
}
|
|
1553
|
-
};
|
|
1554
|
-
|
|
1555
|
-
// src/iwinv/contracts/analytics.contract.ts
|
|
1556
|
-
var IWINVAnalyticsContract = class {
|
|
1557
|
-
constructor(config) {
|
|
1558
|
-
this.config = config;
|
|
1559
|
-
}
|
|
1560
|
-
async getUsage(period) {
|
|
1561
|
-
try {
|
|
1562
|
-
const response = await fetch(`${this.config.baseUrl}/history/list`, {
|
|
1563
|
-
method: "POST",
|
|
1564
|
-
headers: {
|
|
1565
|
-
"Content-Type": "application/json",
|
|
1566
|
-
"Authorization": `Bearer ${this.config.apiKey}`
|
|
1567
|
-
},
|
|
1568
|
-
body: JSON.stringify({
|
|
1569
|
-
startDate: period.from.toISOString(),
|
|
1570
|
-
endDate: period.to.toISOString(),
|
|
1571
|
-
page: 1,
|
|
1572
|
-
size: 1e3
|
|
1573
|
-
})
|
|
1574
|
-
});
|
|
1575
|
-
const result = await response.json();
|
|
1576
|
-
if (!response.ok) {
|
|
1577
|
-
throw new Error(`Failed to get usage stats: ${result.message}`);
|
|
1578
|
-
}
|
|
1579
|
-
const messages = result.list || [];
|
|
1580
|
-
const totalMessages = messages.length;
|
|
1581
|
-
const deliveredMessages = messages.filter((msg) => msg.statusCode === "OK").length;
|
|
1582
|
-
const failedMessages = messages.filter((msg) => msg.statusCode === "FAILED").length;
|
|
1583
|
-
const sentMessages = totalMessages - failedMessages;
|
|
1584
|
-
return {
|
|
1585
|
-
period,
|
|
1586
|
-
totalMessages,
|
|
1587
|
-
sentMessages,
|
|
1588
|
-
deliveredMessages,
|
|
1589
|
-
failedMessages,
|
|
1590
|
-
deliveryRate: totalMessages > 0 ? deliveredMessages / totalMessages * 100 : 0,
|
|
1591
|
-
failureRate: totalMessages > 0 ? failedMessages / totalMessages * 100 : 0,
|
|
1592
|
-
breakdown: {
|
|
1593
|
-
byTemplate: this.groupByTemplate(messages),
|
|
1594
|
-
byDay: this.groupByDay(messages, period),
|
|
1595
|
-
byHour: this.groupByHour(messages)
|
|
1596
|
-
}
|
|
1597
|
-
};
|
|
1598
|
-
} catch (error) {
|
|
1599
|
-
return {
|
|
1600
|
-
period,
|
|
1601
|
-
totalMessages: 0,
|
|
1602
|
-
sentMessages: 0,
|
|
1603
|
-
deliveredMessages: 0,
|
|
1604
|
-
failedMessages: 0,
|
|
1605
|
-
deliveryRate: 0,
|
|
1606
|
-
failureRate: 0,
|
|
1607
|
-
breakdown: {
|
|
1608
|
-
byTemplate: {},
|
|
1609
|
-
byDay: {},
|
|
1610
|
-
byHour: {}
|
|
1611
|
-
}
|
|
1612
|
-
};
|
|
1613
|
-
}
|
|
1614
|
-
}
|
|
1615
|
-
async getTemplateStats(templateId, period) {
|
|
1616
|
-
try {
|
|
1617
|
-
const usage = await this.getUsage(period);
|
|
1618
|
-
const templateMessages = usage.breakdown.byTemplate[templateId] || 0;
|
|
1619
|
-
return {
|
|
1620
|
-
templateId,
|
|
1621
|
-
period,
|
|
1622
|
-
totalSent: templateMessages,
|
|
1623
|
-
delivered: Math.round(templateMessages * (usage.deliveryRate / 100)),
|
|
1624
|
-
failed: Math.round(templateMessages * (usage.failureRate / 100)),
|
|
1625
|
-
deliveryRate: usage.deliveryRate,
|
|
1626
|
-
averageDeliveryTime: 30
|
|
1627
|
-
// Mock average delivery time in seconds
|
|
1628
|
-
};
|
|
1629
|
-
} catch (error) {
|
|
1630
|
-
return {
|
|
1631
|
-
templateId,
|
|
1632
|
-
period,
|
|
1633
|
-
totalSent: 0,
|
|
1634
|
-
delivered: 0,
|
|
1635
|
-
failed: 0,
|
|
1636
|
-
deliveryRate: 0,
|
|
1637
|
-
averageDeliveryTime: 0
|
|
1638
|
-
};
|
|
1639
|
-
}
|
|
1640
|
-
}
|
|
1641
|
-
async getDeliveryReport(messageId) {
|
|
1642
|
-
try {
|
|
1643
|
-
const response = await fetch(`${this.config.baseUrl}/history/detail`, {
|
|
1644
|
-
method: "POST",
|
|
1645
|
-
headers: {
|
|
1646
|
-
"Content-Type": "application/json",
|
|
1647
|
-
"Authorization": `Bearer ${this.config.apiKey}`
|
|
1648
|
-
},
|
|
1649
|
-
body: JSON.stringify({
|
|
1650
|
-
messageId: parseInt(messageId) || 0
|
|
1651
|
-
})
|
|
1652
|
-
});
|
|
1653
|
-
const result = await response.json();
|
|
1654
|
-
if (!response.ok) {
|
|
1655
|
-
throw new Error(`Failed to get delivery report: ${result.message}`);
|
|
1656
|
-
}
|
|
1657
|
-
return {
|
|
1658
|
-
messageId,
|
|
1659
|
-
phoneNumber: result.phone || "unknown",
|
|
1660
|
-
templateCode: result.templateCode || "unknown",
|
|
1661
|
-
status: this.mapStatus(result.statusCode),
|
|
1662
|
-
sentAt: result.sendDate ? new Date(result.sendDate) : void 0,
|
|
1663
|
-
deliveredAt: result.receiveDate ? new Date(result.receiveDate) : void 0,
|
|
1664
|
-
failedAt: result.statusCode === "FAILED" ? new Date(result.sendDate) : void 0,
|
|
1665
|
-
clickedAt: result.clickedAt ? new Date(result.clickedAt) : void 0,
|
|
1666
|
-
error: result.statusCode !== "OK" ? {
|
|
1667
|
-
code: result.statusCode,
|
|
1668
|
-
message: result.statusCodeName
|
|
1669
|
-
} : void 0,
|
|
1670
|
-
attempts: [
|
|
1671
|
-
{
|
|
1672
|
-
attemptNumber: 1,
|
|
1673
|
-
attemptedAt: new Date(result.requestDate),
|
|
1674
|
-
status: this.mapStatus(result.statusCode),
|
|
1675
|
-
error: result.statusCode !== "OK" ? {
|
|
1676
|
-
code: result.statusCode,
|
|
1677
|
-
message: result.statusCodeName
|
|
1678
|
-
} : void 0
|
|
1
|
+
var{defineProperty:Y$,getOwnPropertyNames:Q6,getOwnPropertyDescriptor:Y6}=Object,K6=Object.prototype.hasOwnProperty;var Qg=new WeakMap,m6=(c)=>{var $=Qg.get(c),v;if($)return $;if($=Y$({},"__esModule",{value:!0}),c&&typeof c==="object"||typeof c==="function")Q6(c).map((u)=>!K6.call($,u)&&Y$($,u,{get:()=>c[u],enumerable:!(v=Y6(c,u))||v.enumerable}));return Qg.set(c,$),$};var nc=(c,$)=>{for(var v in $)Y$(c,v,{get:$[v],enumerable:!0,configurable:!0,set:(u)=>$[v]=()=>u})};class A_{config;startTime=Date.now();services=new Map;lastCheck=new Map;constructor(c={}){this.config=c}registerService(c,$){this.services.set(c,$)}unregisterService(c){return this.lastCheck.delete(c),this.services.delete(c)}clearServices(){this.services.clear(),this.lastCheck.clear()}async checkHealth(){let c=Date.now(),$={},v=!0;for(let[u,n]of this.services)try{let b=await Promise.race([n(),this.timeoutPromise(this.config.timeout||5000)]);if($[u]={...b,lastCheck:new Date,latency:Date.now()-c},this.lastCheck.set(u,$[u]),!b.healthy)v=!1}catch(b){let r={healthy:!1,error:b instanceof Error?b.message:"Unknown error",lastCheck:new Date,latency:Date.now()-c};$[u]=r,this.lastCheck.set(u,r),v=!1}return{healthy:v,timestamp:new Date,uptime:Date.now()-this.startTime,services:$,...this.config.includeMetrics&&{metrics:{totalServices:this.services.size,healthyServices:Object.values($).filter((u)=>u.healthy).length,averageLatency:this.calculateAverageLatency($)}}}}getLastKnownStatus(){let c={},$=!0;for(let[v,u]of this.lastCheck)if(c[v]=u,!u.healthy)$=!1;return{healthy:$,timestamp:new Date,uptime:Date.now()-this.startTime,services:c}}async timeoutPromise(c){return new Promise(($,v)=>{setTimeout(()=>v(Error(`Health check timeout after ${c}ms`)),c)})}calculateAverageLatency(c){let $=Object.values(c).map((v)=>v.latency).filter((v)=>typeof v==="number");return $.length>0?$.reduce((v,u)=>v+u,0)/$.length:0}}var W_={};nc(W_,{validatePhoneNumber:()=>vO,toLegacyIWINVConfig:()=>X6,retry:()=>gO,parseTemplate:()=>bO,normalizePhoneNumber:()=>fg,isValidUnifiedConfig:()=>Hg,isValidIWINVBaseConfig:()=>H6,isUnifiedError:()=>Wg,isTemplateError:()=>L6,isRetryableError:()=>B6,isProviderError:()=>G6,isNetworkError:()=>W6,initializeIWINV:()=>P6,initializeAligo:()=>S6,formatDateTime:()=>uO,extractVariables:()=>rO,delay:()=>yg,createRetryMiddleware:()=>R6,createRateLimitMiddleware:()=>V6,createMetricsMiddleware:()=>T6,createLoggingMiddleware:()=>M6,createIWINVSMSProvider:()=>h6,createIWINVProvider:()=>Ag,createIWINVMultiProvider:()=>x6,createDefaultIWINVSMSProvider:()=>A6,createDefaultIWINVProvider:()=>xg,createDefaultIWINVMultiProvider:()=>z6,createDefaultAligoProvider:()=>Pg,createCircuitBreakerMiddleware:()=>E6,createAligoProvider:()=>kg,UnifiedError:()=>E,UnifiedConfigFactory:()=>Xg,UnifiedConfigBuilder:()=>Ac,TypedProvider:()=>Jg,TemplateValidator:()=>gc,TemplateTypeConverter:()=>Pc,TemplateError:()=>Ln,TEMPLATE_REGISTRY:()=>hc,ProviderService:()=>N6,ProviderManager:()=>i6,ProviderError:()=>Tc,PluginRegistry:()=>lg,NetworkError:()=>Ec,MockProvider:()=>U6,IWINVSMSProvider:()=>kc,IWINVProviderFactory:()=>zg,IWINVProvider:()=>q,IWINVMultiProvider:()=>Gn,IWINVAdapterFactory:()=>Dg,IWINVAdapter:()=>Dc,ErrorSeverity:()=>F$,ErrorFactory:()=>Gg,ErrorConverter:()=>Lg,ErrorCategory:()=>B$,ErrorAnalyzer:()=>Bg,BasePlugin:()=>Cg,BaseAlimTalkProvider:()=>V$,AligoProviderFactory:()=>hg,AligoProvider:()=>Mc,AligoAdapter:()=>Vc});module.exports=m6(W_);function R6(c){return{name:"retry",error:async($,v)=>{let u=v.metadata.retries||0;if(u>=c.maxRetries)throw $;if(!(c.retryableErrors?.includes($.code)||c.retryableStatusCodes?.includes($.status)||$.code==="ETIMEDOUT"||$.code==="ECONNRESET"))throw $;throw await new Promise((b)=>setTimeout(b,c.retryDelay*(u+1))),v.metadata.retries=u+1,{...$,shouldRetry:!0}}}}function V6(c){let $=new Map;return{name:"rate-limit",pre:async(v)=>{let u=Date.now(),n="global";if(!$.has("global"))$.set("global",[]);let b=$.get("global");if(c.messagesPerSecond){if(b.filter((_)=>u-_<1000).length>=c.messagesPerSecond)throw Error("Rate limit exceeded: messages per second")}if(c.messagesPerMinute){if(b.filter((_)=>u-_<60000).length>=c.messagesPerMinute)throw Error("Rate limit exceeded: messages per minute")}b.push(u);let r=u-3600000,g=b.filter((I)=>I>r);$.set("global",g)}}}function M6(c){return{name:"logging",pre:async($)=>{if(c.logLevel==="debug")c.logger.debug("Request started",{metadata:$.metadata,timestamp:$.startTime})},post:async($)=>{let v=Date.now()-$.startTime;c.logger.info("Request completed",{duration:v,success:!0})},error:async($,v)=>{let u=Date.now()-v.startTime;c.logger.error("Request failed",{error:$.message,duration:u,stack:$.stack})}}}function T6(c){return{name:"metrics",pre:async($)=>{c.collector.increment("requests_total",c.labels)},post:async($)=>{let v=Date.now()-$.startTime;c.collector.histogram("request_duration_ms",v,c.labels),c.collector.increment("requests_success_total",c.labels)},error:async($,v)=>{let u=Date.now()-v.startTime;c.collector.histogram("request_duration_ms",u,c.labels),c.collector.increment("requests_error_total",{...c.labels,error_type:$.constructor.name})}}}function E6(c){let $="CLOSED",v=0,u=0;return{name:"circuit-breaker",pre:async(n)=>{let b=Date.now();if($==="OPEN"){if(b<u)throw Error("Circuit breaker is OPEN");$="HALF_OPEN"}},post:async(n)=>{if($==="HALF_OPEN")$="CLOSED",v=0},error:async(n,b)=>{if(v++,v>=c.threshold)$="OPEN",u=Date.now()+c.resetTimeout;throw n}}}var m$=Symbol.for,Oc=Symbol("kCapture"),Rg=m$("events.errorMonitor"),l6=Symbol("events.maxEventTargetListeners"),o6=Symbol("events.maxEventTargetListenersWarned"),Yg=m$("nodejs.rejection"),Z6=m$("nodejs.rejection"),Kg=Array.prototype.slice,Ic=10,$c=function(c){if(this._events===void 0||this._events===this.__proto__._events)this._events={__proto__:null},this._eventsCount=0;if(this._maxListeners??=void 0,this[Oc]=c?.captureRejections?Boolean(c?.captureRejections):Q[Oc])this.emit=y6},Q=$c.prototype={};Q._events=void 0;Q._eventsCount=0;Q._maxListeners=void 0;Q.setMaxListeners=function(c){return R$(c,"setMaxListeners",0),this._maxListeners=c,this};Q.constructor=$c;Q.getMaxListeners=function(){return this?._maxListeners??Ic};function Vg(c,$){var{_events:v}=c;if($[0]??=Error("Unhandled error."),!v)throw $[0];var u=v[Rg];if(u)for(var n of Kg.call(u))n.apply(c,$);var b=v.error;if(!b)throw $[0];for(var n of Kg.call(b))n.apply(c,$);return!0}function q6(c,$,v,u){$.then(void 0,function(n){queueMicrotask(()=>C6(c,n,v,u))})}function C6(c,$,v,u){if(typeof c[Yg]==="function")c[Yg]($,v,...u);else try{c[Oc]=!1,c.emit("error",$)}finally{c[Oc]=!0}}var f6=function(c,...$){if(c==="error")return Vg(this,$);var{_events:v}=this;if(v===void 0)return!1;var u=v[c];if(u===void 0)return!1;let n=u.length>1?u.slice():u;for(let b=0,{length:r}=n;b<r;b++){let g=n[b];switch($.length){case 0:g.call(this);break;case 1:g.call(this,$[0]);break;case 2:g.call(this,$[0],$[1]);break;case 3:g.call(this,$[0],$[1],$[2]);break;default:g.apply(this,$);break}}return!0},y6=function(c,...$){if(c==="error")return Vg(this,$);var{_events:v}=this;if(v===void 0)return!1;var u=v[c];if(u===void 0)return!1;let n=u.length>1?u.slice():u;for(let b=0,{length:r}=n;b<r;b++){let g=n[b],I;switch($.length){case 0:I=g.call(this);break;case 1:I=g.call(this,$[0]);break;case 2:I=g.call(this,$[0],$[1]);break;case 3:I=g.call(this,$[0],$[1],$[2]);break;default:I=g.apply(this,$);break}if(I!==void 0&&typeof I?.then==="function"&&I.then===Promise.prototype.then)q6(this,I,c,$)}return!0};Q.emit=f6;Q.addListener=function(c,$){lc($);var v=this._events;if(!v)v=this._events={__proto__:null},this._eventsCount=0;else if(v.newListener)this.emit("newListener",c,$.listener??$);var u=v[c];if(!u)v[c]=[$],this._eventsCount++;else{u.push($);var n=this._maxListeners??Ic;if(n>0&&u.length>n&&!u.warned)Mg(this,c,u)}return this};Q.on=Q.addListener;Q.prependListener=function(c,$){lc($);var v=this._events;if(!v)v=this._events={__proto__:null},this._eventsCount=0;else if(v.newListener)this.emit("newListener",c,$.listener??$);var u=v[c];if(!u)v[c]=[$],this._eventsCount++;else{u.unshift($);var n=this._maxListeners??Ic;if(n>0&&u.length>n&&!u.warned)Mg(this,c,u)}return this};function Mg(c,$,v){v.warned=!0;let u=Error(`Possible EventEmitter memory leak detected. ${v.length} ${String($)} listeners added to [${c.constructor.name}]. Use emitter.setMaxListeners() to increase limit`);u.name="MaxListenersExceededWarning",u.emitter=c,u.type=$,u.count=v.length,console.warn(u)}function Tg(c,$,...v){this.removeListener(c,$),$.apply(this,v)}Q.once=function(c,$){lc($);let v=Tg.bind(this,c,$);return v.listener=$,this.addListener(c,v),this};Q.prependOnceListener=function(c,$){lc($);let v=Tg.bind(this,c,$);return v.listener=$,this.prependListener(c,v),this};Q.removeListener=function(c,$){lc($);var{_events:v}=this;if(!v)return this;var u=v[c];if(!u)return this;var n=u.length;let b=-1;for(let r=n-1;r>=0;r--)if(u[r]===$||u[r].listener===$){b=r;break}if(b<0)return this;if(b===0)u.shift();else u.splice(b,1);if(u.length===0)delete v[c],this._eventsCount--;return this};Q.off=Q.removeListener;Q.removeAllListeners=function(c){var{_events:$}=this;if(c&&$){if($[c])delete $[c],this._eventsCount--}else this._events={__proto__:null};return this};Q.listeners=function(c){var{_events:$}=this;if(!$)return[];var v=$[c];if(!v)return[];return v.map((u)=>u.listener??u)};Q.rawListeners=function(c){var{_events:$}=this;if(!$)return[];var v=$[c];if(!v)return[];return v.slice()};Q.listenerCount=function(c){var{_events:$}=this;if(!$)return 0;return $[c]?.length??0};Q.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};Q[Oc]=!1;function d6(c,$,v){var u=v?.signal;if(Eg(u,"options.signal"),u?.aborted)throw new K$(void 0,{cause:u?.reason});let{resolve:n,reject:b,promise:r}=$newPromiseCapability(Promise),g=(U)=>{if(c.removeListener($,I),u!=null)Wn(u,"abort",_);b(U)},I=(...U)=>{if(typeof c.removeListener==="function")c.removeListener("error",g);if(u!=null)Wn(u,"abort",_);n(U)};if(mg(c,$,I,{once:!0}),$!=="error"&&typeof c.once==="function")c.once("error",g);function _(){Wn(c,$,I),Wn(c,"error",g),b(new K$(void 0,{cause:u?.reason}))}if(u!=null)mg(u,"abort",_,{once:!0});return r}function p6(c,$){return c.listeners($)}function e6(c,...$){R$(c,"setMaxListeners",0);var v;if($&&(v=$.length))for(let u=0;u<v;u++)$[u].setMaxListeners(c);else Ic=c}function a6(c,$){return c.listenerCount($)}function Wn(c,$,v,u){if(typeof c.removeListener==="function")c.removeListener($,v);else c.removeEventListener($,v,u)}function mg(c,$,v,u){if(typeof c.on==="function")if(u.once)c.once($,v);else c.on($,v);else c.addEventListener($,v,u)}class K$ extends Error{constructor(c="The operation was aborted",$=void 0){if($!==void 0&&typeof $!=="object")throw zc("options","Object",$);super(c,$);this.code="ABORT_ERR",this.name="AbortError"}}function zc(c,$,v){let u=TypeError(`The "${c}" argument must be of type ${$}. Received ${v}`);return u.code="ERR_INVALID_ARG_TYPE",u}function s6(c,$,v){let u=RangeError(`The "${c}" argument is out of range. It must be ${$}. Received ${v}`);return u.code="ERR_OUT_OF_RANGE",u}function Eg(c,$){if(c!==void 0&&(c===null||typeof c!=="object"||!("aborted"in c)))throw zc($,"AbortSignal",c)}function R$(c,$,v,u){if(typeof c!=="number")throw zc($,"number",c);if(v!=null&&c<v||u!=null&&c>u||(v!=null||u!=null)&&Number.isNaN(c))throw s6($,`${v!=null?`>= ${v}`:""}${v!=null&&u!=null?" && ":""}${u!=null?`<= ${u}`:""}`,c)}function lc(c){if(typeof c!=="function")throw TypeError("The listener must be a function")}function cO(c,$){if(typeof c!=="boolean")throw zc($,"boolean",c)}function nO(c){return c?._maxListeners??Ic}function $O(c,$){if(c===void 0)throw zc("signal","AbortSignal",c);if(Eg(c,"signal"),typeof $!=="function")throw zc("listener","function",$);let v;if(c.aborted)queueMicrotask(()=>$());else c.addEventListener("abort",$,{__proto__:null,once:!0}),v=()=>{c.removeEventListener("abort",$)};return{__proto__:null,[Symbol.dispose](){v?.()}}}Object.defineProperties($c,{captureRejections:{get(){return Q[Oc]},set(c){cO(c,"EventEmitter.captureRejections"),Q[Oc]=c},enumerable:!0},defaultMaxListeners:{enumerable:!0,get:()=>{return Ic},set:(c)=>{R$(c,"defaultMaxListeners",0),Ic=c}},kMaxEventTargetListeners:{value:l6,enumerable:!1,configurable:!1,writable:!1},kMaxEventTargetListenersWarned:{value:o6,enumerable:!1,configurable:!1,writable:!1}});Object.assign($c,{once:d6,getEventListeners:p6,getMaxListeners:nO,setMaxListeners:e6,EventEmitter:$c,usingDomains:!1,captureRejectionSymbol:Z6,errorMonitor:Rg,addAbortListener:$O,init:$c,listenerCount:a6});class lg{plugins=new Map;instances=new Map;register(c){let $=c.metadata.name.toLowerCase();if(this.plugins.has($))throw Error(`Plugin ${$} is already registered`);this.plugins.set($,c)}async create(c,$,v={}){let u=this.plugins.get(c.toLowerCase());if(!u)throw Error(`Plugin ${c} not found`);let b=new u.constructor,r={config:$,logger:v.logger||new og,metrics:v.metrics||new Zg,storage:v.storage||new qg,eventBus:new $c};await b.initialize(r);let g=`${c}-${Date.now()}`;return this.instances.set(g,b),b}async loadAndCreate(c,$,v){return this.create(c,$,v)}getSupportedTypes(){return Array.from(this.plugins.keys())}validateProviderConfig(c,$){if(!this.plugins.get(c.toLowerCase()))return!1;return!!($.apiUrl&&$.apiKey)}async destroyAll(){let c=Array.from(this.instances.values()).map(($)=>$.destroy());await Promise.all(c),this.instances.clear()}}class og{info(c,...$){console.log(`[INFO] ${c}`,...$)}error(c,$){console.error(`[ERROR] ${c}`,$)}debug(c,...$){console.debug(`[DEBUG] ${c}`,...$)}warn(c,...$){console.warn(`[WARN] ${c}`,...$)}}class Zg{increment(c,$){}histogram(c,$,v){}gauge(c,$,v){}}class qg{store=new Map;async get(c){let $=this.store.get(c);if(!$)return;if($.expiry&&Date.now()>$.expiry){this.store.delete(c);return}return $.value}async set(c,$,v){let u=v?Date.now()+v*1000:void 0;this.store.set(c,{value:$,expiry:u})}async delete(c){this.store.delete(c)}}class Cg{context;middleware=[];async initialize(c){this.context=c,this.context.logger.info(`Initializing plugin: ${this.metadata.name}`)}async destroy(){this.context.logger.info(`Destroying plugin: ${this.metadata.name}`)}async executeMiddleware(c,$,v){for(let u of this.middleware)try{if(c==="pre"&&u.pre)await u.pre($);else if(c==="post"&&u.post)await u.post($);else if(c==="error"&&u.error&&v)await u.error(v,$)}catch(n){throw this.context.logger.error(`Middleware ${u.name} failed`,n),n}}createMiddlewareContext(c,$={}){return{request:c,response:void 0,metadata:{...$,pluginName:this.metadata.name,pluginVersion:this.metadata.version},startTime:Date.now()}}validateConfig(c,$){for(let v of $)if(!c[v])throw Error(`${this.metadata.name}: Missing required config field: ${v}`)}async makeRequest(c,$,v={}){let u=this.createMiddlewareContext({url:c,options:$},v);try{await this.executeMiddleware("pre",u);let n=await fetch(c,{...$,headers:{"User-Agent":`K-OTP-${this.metadata.name}/${this.metadata.version}`,...this.context.config.headers,...$.headers},signal:AbortSignal.timeout(this.context.config.timeout||30000)});return u.response=n,await this.executeMiddleware("post",u),n}catch(n){throw await this.executeMiddleware("error",u,n),n}}async makeJSONRequest(c,$,v={}){let u=await this.makeRequest(c,$,v);if(!u.ok){let n=Error(`HTTP ${u.status}: ${u.statusText}`);throw n.response=u,n.status=u.status,n}try{return await u.json()}catch(n){let b=Error("Failed to parse JSON response");throw b.response=u,b.parseError=n,b}}logOperation(c,$){this.context.logger.info(`${this.metadata.name}: ${c}`,$)}logError(c,$,v){this.context.logger.error(`${this.metadata.name}: ${c} failed`,{error:$,data:v})}}function fg(c){let $=c.replace(/[^\d]/g,"");if($.startsWith("82"))return"0"+$.substring(2);if($.startsWith("0"))return $;if($.length>=10&&$.length<=11)return"0"+$;return $}function vO(c){let $=fg(c);return/^01[0-9]{8,9}$/.test($)}function uO(c){let $=c.getFullYear(),v=String(c.getMonth()+1).padStart(2,"0"),u=String(c.getDate()).padStart(2,"0"),n=String(c.getHours()).padStart(2,"0"),b=String(c.getMinutes()).padStart(2,"0"),r=String(c.getSeconds()).padStart(2,"0");return`${$}-${v}-${u} ${n}:${b}:${r}`}function bO(c,$){let v=c;for(let[u,n]of Object.entries($)){let b=new RegExp(`#{${u}}`,"g");v=v.replace(b,n)}for(let[u,n]of Object.entries($)){let b=new RegExp(`{{${u}}}`,"g");v=v.replace(b,n)}return v}function rO(c){let $=new Set,v=c.match(/#\{([^}]+)\}/g);if(v)v.forEach((n)=>{let b=n.slice(2,-1);$.add(b)});let u=c.match(/\{\{([^}]+)\}\}/g);if(u)u.forEach((n)=>{let b=n.slice(2,-2);$.add(b)});return Array.from($)}function yg(c){return new Promise(($)=>setTimeout($,c))}function gO(c,$){return(async()=>{let v;for(let u=0;u<=$.maxRetries;u++)try{if(u>0){let n=$.backoff==="exponential"?$.delay*2**(u-1):$.delay*u;await yg(n)}return await c()}catch(n){if(v=n,u===$.maxRetries)throw v}throw v??Error("Retry failed")})()}class V${type="messaging";config={};isConfigured=!1;constructor(c){if(c)this.configure(c)}configure(c){this.validateConfiguration(c),this.config={...c},this.isConfigured=!0,this.onConfigured()}validateConfiguration(c){let $=this.getProviderConfiguration();for(let v of $.required){if(!(v.key in c))throw Error(`Required configuration field '${v.key}' is missing`);this.validateFieldValue(v,c[v.key])}for(let v of $.optional)if(v.key in c)this.validateFieldValue(v,c[v.key])}validateFieldValue(c,$){switch(c.type){case"string":if(typeof $!=="string")throw Error(`Field '${c.key}' must be a string`);break;case"number":if(typeof $!=="number")throw Error(`Field '${c.key}' must be a number`);break;case"boolean":if(typeof $!=="boolean")throw Error(`Field '${c.key}' must be a boolean`);break;case"url":try{new URL(String($))}catch{throw Error(`Field '${c.key}' must be a valid URL`)}break}if(c.validation){if(c.validation.pattern){if(!new RegExp(c.validation.pattern).test(String($)))throw Error(`Field '${c.key}' does not match required pattern`)}if(c.validation.min!==void 0&&Number($)<c.validation.min)throw Error(`Field '${c.key}' must be at least ${c.validation.min}`);if(c.validation.max!==void 0&&Number($)>c.validation.max)throw Error(`Field '${c.key}' must be at most ${c.validation.max}`)}}onConfigured(){}isReady(){return this.isConfigured}getConfig(c){if(!this.isConfigured)throw Error("Provider is not configured");return this.config[c]}hasConfig(c){return c in this.config}getCapabilities(){return this.capabilities}async healthCheck(){let c=[],$=Date.now();try{if(!this.isReady())return c.push("Provider is not configured"),{healthy:!1,issues:c};await this.testConnectivity(),await this.testAuthentication();let v=Date.now()-$;return{healthy:c.length===0,issues:c,latency:v}}catch(v){return c.push(`Health check failed: ${v instanceof Error?v.message:"Unknown error"}`),{healthy:!1,issues:c,latency:Date.now()-$}}}getInfo(){return{id:this.id,name:this.name,version:this.getVersion(),capabilities:this.capabilities,configured:this.isConfigured}}destroy(){this.config={},this.isConfigured=!1,this.onDestroy()}onDestroy(){}createError(c,$,v){let u=Error($);return u.code=c,u.provider=this.id,u.details=v,u}log(c,$,v){let u={provider:this.id,level:c,message:$,timestamp:new Date().toISOString()};if(v)u.data=v;console.log(JSON.stringify(u))}async handleRateLimit(c){let $=this.capabilities.messaging.maxRequestsPerSecond;if($>0){let v=1000/$;await new Promise((u)=>setTimeout(u,v))}}async withRetry(c,$={}){let{maxRetries:v=3,initialDelay:u=1000,maxDelay:n=1e4,backoffFactor:b=2}=$,r,g=u;for(let I=0;I<=v;I++)try{return await c()}catch(_){if(r=_,I===v)break;this.log("warn",`Operation failed, retrying in ${g}ms`,{attempt:I+1,maxRetries:v,error:r.message}),await new Promise((U)=>setTimeout(U,g)),g=Math.min(g*b,n)}throw r}}var D={};nc(D,{xid:()=>Ut,void:()=>Kt,uuidv7:()=>rt,uuidv6:()=>bt,uuidv4:()=>ut,uuid:()=>vt,url:()=>gt,uppercase:()=>_n,unknown:()=>z$,union:()=>rg,undefined:()=>Qt,ulid:()=>wt,uint64:()=>Bt,uint32:()=>Gt,tuple:()=>lt,trim:()=>Dn,treeifyError:()=>y$,transform:()=>Ig,toUpperCase:()=>Pn,toLowerCase:()=>kn,toJSONSchema:()=>Hr,templateLiteral:()=>et,symbol:()=>Ft,superRefine:()=>I6,success:()=>dt,stringbool:()=>$_,stringFormat:()=>xt,string:()=>Kr,strictObject:()=>Mt,startsWith:()=>Un,size:()=>On,setErrorMap:()=>r_,set:()=>qt,safeParseAsync:()=>Yr,safeParse:()=>Qr,registry:()=>yn,regexes:()=>d,regex:()=>In,refine:()=>O6,record:()=>M4,readonly:()=>v6,property:()=>Sr,promise:()=>at,prettifyError:()=>d$,preprocess:()=>u_,prefault:()=>p4,positive:()=>Ur,pipe:()=>X$,partialRecord:()=>ot,parseAsync:()=>Fr,parse:()=>Br,overwrite:()=>a,optional:()=>J$,object:()=>Vt,number:()=>z4,nullish:()=>yt,nullable:()=>H$,null:()=>L4,normalize:()=>Sn,nonpositive:()=>Nr,nonoptional:()=>e4,nonnegative:()=>jr,never:()=>vg,negative:()=>ir,nativeEnum:()=>Ct,nanoid:()=>It,nan:()=>pt,multipleOf:()=>Nc,minSize:()=>jc,minLength:()=>bc,mime:()=>jn,maxSize:()=>Qc,maxLength:()=>Yc,map:()=>Zt,lte:()=>Z,lt:()=>p,lowercase:()=>tn,looseObject:()=>Tt,locales:()=>bn,literal:()=>Z4,length:()=>Kc,lazy:()=>r6,ksuid:()=>it,keyof:()=>Rt,jwt:()=>At,json:()=>v_,iso:()=>A$,ipv6:()=>jt,ipv4:()=>Nt,intersection:()=>R4,int64:()=>Wt,int32:()=>Xt,int:()=>mr,instanceof:()=>n_,includes:()=>wn,hostname:()=>zt,guid:()=>$t,gte:()=>T,gt:()=>e,globalRegistry:()=>f,getErrorMap:()=>g_,function:()=>Jr,formatError:()=>sc,float64:()=>Ht,float32:()=>Jt,flattenError:()=>ac,file:()=>ft,enum:()=>l4,endsWith:()=>Nn,emoji:()=>Ot,email:()=>nt,e164:()=>ht,discriminatedUnion:()=>Et,date:()=>mt,custom:()=>c_,cuid2:()=>_t,cuid:()=>tt,core:()=>s,config:()=>m,coerce:()=>ig,clone:()=>M,cidrv6:()=>Dt,cidrv4:()=>St,check:()=>st,catch:()=>c6,boolean:()=>J4,bigint:()=>Lt,base64url:()=>Pt,base64:()=>kt,array:()=>ug,any:()=>Yt,_default:()=>y4,_ZodString:()=>Rr,ZodXID:()=>qr,ZodVoid:()=>Q4,ZodUnknown:()=>B4,ZodUnion:()=>bg,ZodUndefined:()=>X4,ZodUUID:()=>cc,ZodURL:()=>Mr,ZodULID:()=>Zr,ZodType:()=>z,ZodTuple:()=>V4,ZodTransform:()=>Og,ZodTemplateLiteral:()=>u6,ZodSymbol:()=>H4,ZodSuccess:()=>a4,ZodStringFormat:()=>F,ZodString:()=>xn,ZodSet:()=>E4,ZodRecord:()=>gg,ZodRealError:()=>mc,ZodReadonly:()=>$6,ZodPromise:()=>g6,ZodPrefault:()=>d4,ZodPipe:()=>wg,ZodOptional:()=>tg,ZodObject:()=>L$,ZodNumberFormat:()=>Rc,ZodNumber:()=>zn,ZodNullable:()=>C4,ZodNull:()=>G4,ZodNonOptional:()=>_g,ZodNever:()=>F4,ZodNanoID:()=>Er,ZodNaN:()=>n6,ZodMap:()=>T4,ZodLiteral:()=>o4,ZodLazy:()=>b6,ZodKSUID:()=>Cr,ZodJWT:()=>cg,ZodIssueCode:()=>b_,ZodIntersection:()=>m4,ZodISOTime:()=>P$,ZodISODuration:()=>h$,ZodISODateTime:()=>D$,ZodISODate:()=>k$,ZodIPv6:()=>yr,ZodIPv4:()=>fr,ZodGUID:()=>x$,ZodFirstPartyTypeKind:()=>Ug,ZodFile:()=>q4,ZodError:()=>sI,ZodEnum:()=>An,ZodEmoji:()=>Tr,ZodEmail:()=>Vr,ZodE164:()=>sr,ZodDiscriminatedUnion:()=>K4,ZodDefault:()=>f4,ZodDate:()=>G$,ZodCustomStringFormat:()=>ng,ZodCustom:()=>W$,ZodCatch:()=>s4,ZodCUID2:()=>or,ZodCUID:()=>lr,ZodCIDRv6:()=>pr,ZodCIDRv4:()=>dr,ZodBoolean:()=>Jn,ZodBigIntFormat:()=>$g,ZodBigInt:()=>Hn,ZodBase64URL:()=>ar,ZodBase64:()=>er,ZodArray:()=>Y4,ZodAny:()=>W4,TimePrecision:()=>Tb,NEVER:()=>M$,$output:()=>mb,$input:()=>Rb,$brand:()=>T$});var s={};nc(s,{version:()=>qv,util:()=>k,treeifyError:()=>y$,toJSONSchema:()=>Hr,toDotPath:()=>ag,safeParseAsync:()=>e$,safeParse:()=>p$,registry:()=>yn,regexes:()=>d,prettifyError:()=>d$,parseAsync:()=>mn,parse:()=>Yn,locales:()=>bn,isValidJWT:()=>j4,isValidBase64URL:()=>N4,isValidBase64:()=>wu,globalRegistry:()=>f,globalConfig:()=>oc,function:()=>Jr,formatError:()=>sc,flattenError:()=>ac,config:()=>m,clone:()=>M,_xid:()=>r$,_void:()=>Ir,_uuidv7:()=>sn,_uuidv6:()=>an,_uuidv4:()=>en,_uuid:()=>pn,_url:()=>c$,_uppercase:()=>_n,_unknown:()=>Fc,_union:()=>BI,_undefined:()=>br,_ulid:()=>b$,_uint64:()=>vr,_uint32:()=>eb,_tuple:()=>Dr,_trim:()=>Dn,_transform:()=>TI,_toUpperCase:()=>Pn,_toLowerCase:()=>kn,_templateLiteral:()=>dI,_symbol:()=>ur,_superRefine:()=>Ar,_success:()=>qI,_stringbool:()=>xr,_stringFormat:()=>j$,_string:()=>Vb,_startsWith:()=>Un,_size:()=>On,_set:()=>mI,_safeParseAsync:()=>Vn,_safeParse:()=>Rn,_regex:()=>In,_refine:()=>hr,_record:()=>YI,_readonly:()=>yI,_property:()=>Sr,_promise:()=>eI,_positive:()=>Ur,_pipe:()=>fI,_parseAsync:()=>Kn,_parse:()=>Qn,_overwrite:()=>a,_optional:()=>EI,_number:()=>qb,_nullable:()=>lI,_null:()=>rr,_normalize:()=>Sn,_nonpositive:()=>Nr,_nonoptional:()=>ZI,_nonnegative:()=>jr,_never:()=>Or,_negative:()=>ir,_nativeEnum:()=>VI,_nanoid:()=>$$,_nan:()=>wr,_multipleOf:()=>Nc,_minSize:()=>jc,_minLength:()=>bc,_min:()=>T,_mime:()=>jn,_maxSize:()=>Qc,_maxLength:()=>Yc,_max:()=>Z,_map:()=>KI,_lte:()=>Z,_lt:()=>p,_lowercase:()=>tn,_literal:()=>MI,_length:()=>Kc,_lazy:()=>pI,_ksuid:()=>g$,_jwt:()=>N$,_isoTime:()=>ob,_isoDuration:()=>Zb,_isoDateTime:()=>Eb,_isoDate:()=>lb,_ipv6:()=>I$,_ipv4:()=>O$,_intersection:()=>QI,_int64:()=>$r,_int32:()=>pb,_int:()=>fb,_includes:()=>wn,_guid:()=>gn,_gte:()=>T,_gt:()=>e,_float64:()=>db,_float32:()=>yb,_file:()=>kr,_enum:()=>RI,_endsWith:()=>Nn,_emoji:()=>n$,_email:()=>dn,_e164:()=>i$,_discriminatedUnion:()=>FI,_default:()=>oI,_date:()=>tr,_custom:()=>Pr,_cuid2:()=>u$,_cuid:()=>v$,_coercedString:()=>Mb,_coercedNumber:()=>Cb,_coercedDate:()=>_r,_coercedBoolean:()=>sb,_coercedBigint:()=>nr,_cidrv6:()=>_$,_cidrv4:()=>t$,_check:()=>P4,_catch:()=>CI,_boolean:()=>ab,_bigint:()=>cr,_base64url:()=>U$,_base64:()=>w$,_array:()=>hn,_any:()=>gr,TimePrecision:()=>Tb,NEVER:()=>M$,JSONSchemaGenerator:()=>S$,JSONSchema:()=>h4,Doc:()=>ln,$output:()=>mb,$input:()=>Rb,$constructor:()=>O,$brand:()=>T$,$ZodXID:()=>$u,$ZodVoid:()=>Ju,$ZodUnknown:()=>Bc,$ZodUnion:()=>fn,$ZodUndefined:()=>hu,$ZodUUID:()=>yv,$ZodURL:()=>pv,$ZodULID:()=>nu,$ZodType:()=>A,$ZodTuple:()=>ic,$ZodTransform:()=>$n,$ZodTemplateLiteral:()=>qu,$ZodSymbol:()=>Pu,$ZodSuccess:()=>Eu,$ZodStringFormat:()=>B,$ZodString:()=>Uc,$ZodSet:()=>Fu,$ZodRegistry:()=>rn,$ZodRecord:()=>Wu,$ZodRealError:()=>Lc,$ZodReadonly:()=>Zu,$ZodPromise:()=>Cu,$ZodPrefault:()=>Mu,$ZodPipe:()=>vn,$ZodOptional:()=>mu,$ZodObject:()=>Xu,$ZodNumberFormat:()=>Du,$ZodNumber:()=>qn,$ZodNullable:()=>Ru,$ZodNull:()=>Au,$ZodNonOptional:()=>Tu,$ZodNever:()=>zu,$ZodNanoID:()=>av,$ZodNaN:()=>ou,$ZodMap:()=>Bu,$ZodLiteral:()=>Yu,$ZodLazy:()=>fu,$ZodKSUID:()=>vu,$ZodJWT:()=>ju,$ZodIntersection:()=>Lu,$ZodISOTime:()=>ru,$ZodISODuration:()=>gu,$ZodISODateTime:()=>uu,$ZodISODate:()=>bu,$ZodIPv6:()=>Iu,$ZodIPv4:()=>Ou,$ZodGUID:()=>fv,$ZodFunction:()=>zr,$ZodFile:()=>Ku,$ZodError:()=>ec,$ZodEnum:()=>Qu,$ZodEmoji:()=>ev,$ZodEmail:()=>dv,$ZodE164:()=>Nu,$ZodDiscriminatedUnion:()=>Gu,$ZodDefault:()=>Vu,$ZodDate:()=>Hu,$ZodCustomStringFormat:()=>Su,$ZodCustom:()=>yu,$ZodCheckUpperCase:()=>Vv,$ZodCheckStringFormat:()=>Wc,$ZodCheckStartsWith:()=>Tv,$ZodCheckSizeEquals:()=>Fv,$ZodCheckRegex:()=>mv,$ZodCheckProperty:()=>lv,$ZodCheckOverwrite:()=>Zv,$ZodCheckNumberFormat:()=>Gv,$ZodCheckMultipleOf:()=>Xv,$ZodCheckMinSize:()=>Bv,$ZodCheckMinLength:()=>Yv,$ZodCheckMimeType:()=>ov,$ZodCheckMaxSize:()=>Wv,$ZodCheckMaxLength:()=>Qv,$ZodCheckLowerCase:()=>Rv,$ZodCheckLessThan:()=>Tn,$ZodCheckLengthEquals:()=>Kv,$ZodCheckIncludes:()=>Mv,$ZodCheckGreaterThan:()=>En,$ZodCheckEndsWith:()=>Ev,$ZodCheckBigIntFormat:()=>Lv,$ZodCheck:()=>Y,$ZodCatch:()=>lu,$ZodCUID2:()=>cu,$ZodCUID:()=>sv,$ZodCIDRv6:()=>_u,$ZodCIDRv4:()=>tu,$ZodBoolean:()=>cn,$ZodBigIntFormat:()=>ku,$ZodBigInt:()=>Cn,$ZodBase64URL:()=>iu,$ZodBase64:()=>Uu,$ZodAsyncError:()=>y,$ZodArray:()=>nn,$ZodAny:()=>xu});var M$=Object.freeze({status:"aborted"});function O(c,$,v){function u(g,I){var _;Object.defineProperty(g,"_zod",{value:g._zod??{},enumerable:!1}),(_=g._zod).traits??(_.traits=new Set),g._zod.traits.add(c),$(g,I);for(let U in r.prototype)if(!(U in g))Object.defineProperty(g,U,{value:r.prototype[U].bind(g)});g._zod.constr=r,g._zod.def=I}let n=v?.Parent??Object;class b extends n{}Object.defineProperty(b,"name",{value:c});function r(g){var I;let _=v?.Parent?new b:this;u(_,g),(I=_._zod).deferred??(I.deferred=[]);for(let U of _._zod.deferred)U();return _}return Object.defineProperty(r,"init",{value:u}),Object.defineProperty(r,Symbol.hasInstance,{value:(g)=>{if(v?.Parent&&g instanceof v.Parent)return!0;return g?._zod?.traits?.has(c)}}),Object.defineProperty(r,"name",{value:c}),r}var T$=Symbol("zod_brand");class y extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}var oc={};function m(c){if(c)Object.assign(oc,c);return oc}var k={};nc(k,{unwrapMessage:()=>Zc,stringifyPrimitive:()=>S,required:()=>HO,randomString:()=>SO,propertyKeyTypes:()=>yc,promiseAllObject:()=>jO,primitiveTypes:()=>Z$,prefixIssues:()=>l,pick:()=>hO,partial:()=>JO,optionalKeys:()=>q$,omit:()=>AO,objectClone:()=>UO,numKeys:()=>DO,nullish:()=>vc,normalizeParams:()=>N,mergeDefs:()=>uc,merge:()=>zO,jsonStringifyReplacer:()=>Hc,joinValues:()=>w,issue:()=>Gc,isPlainObject:()=>Xc,isObject:()=>Jc,getSizableOrigin:()=>dc,getParsedType:()=>kO,getLengthableOrigin:()=>pc,getEnumValues:()=>qc,getElementAtPath:()=>NO,floatSafeRemainder:()=>l$,finalizeIssue:()=>o,extend:()=>xO,escapeRegex:()=>C,esc:()=>Bn,defineLazy:()=>G,createTransparentProxy:()=>PO,cloneDef:()=>iO,clone:()=>M,cleanRegex:()=>fc,cleanEnum:()=>XO,captureStackTrace:()=>Fn,cached:()=>Cc,assignProp:()=>tc,assertNotEqual:()=>IO,assertNever:()=>_O,assertIs:()=>tO,assertEqual:()=>OO,assert:()=>wO,allowsEval:()=>o$,aborted:()=>_c,NUMBER_FORMAT_RANGES:()=>C$,Class:()=>pg,BIGINT_FORMAT_RANGES:()=>f$});function OO(c){return c}function IO(c){return c}function tO(c){}function _O(c){throw Error()}function wO(c){}function qc(c){let $=Object.values(c).filter((u)=>typeof u==="number");return Object.entries(c).filter(([u,n])=>$.indexOf(+u)===-1).map(([u,n])=>n)}function w(c,$="|"){return c.map((v)=>S(v)).join($)}function Hc(c,$){if(typeof $==="bigint")return $.toString();return $}function Cc(c){return{get value(){{let v=c();return Object.defineProperty(this,"value",{value:v}),v}throw Error("cached value already set")}}}function vc(c){return c===null||c===void 0}function fc(c){let $=c.startsWith("^")?1:0,v=c.endsWith("$")?c.length-1:c.length;return c.slice($,v)}function l$(c,$){let v=(c.toString().split(".")[1]||"").length,u=$.toString(),n=(u.split(".")[1]||"").length;if(n===0&&/\d?e-\d?/.test(u)){let I=u.match(/\d?e-(\d?)/);if(I?.[1])n=Number.parseInt(I[1])}let b=v>n?v:n,r=Number.parseInt(c.toFixed(b).replace(".","")),g=Number.parseInt($.toFixed(b).replace(".",""));return r%g/10**b}var dg=Symbol("evaluating");function G(c,$,v){let u=void 0;Object.defineProperty(c,$,{get(){if(u===dg)return;if(u===void 0)u=dg,u=v();return u},set(n){Object.defineProperty(c,$,{value:n})},configurable:!0})}function UO(c){return Object.create(Object.getPrototypeOf(c),Object.getOwnPropertyDescriptors(c))}function tc(c,$,v){Object.defineProperty(c,$,{value:v,writable:!0,enumerable:!0,configurable:!0})}function uc(...c){let $={};for(let v of c){let u=Object.getOwnPropertyDescriptors(v);Object.assign($,u)}return Object.defineProperties({},$)}function iO(c){return uc(c._zod.def)}function NO(c,$){if(!$)return c;return $.reduce((v,u)=>v?.[u],c)}function jO(c){let $=Object.keys(c),v=$.map((u)=>c[u]);return Promise.all(v).then((u)=>{let n={};for(let b=0;b<$.length;b++)n[$[b]]=u[b];return n})}function SO(c=10){let v="";for(let u=0;u<c;u++)v+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return v}function Bn(c){return JSON.stringify(c)}var Fn="captureStackTrace"in Error?Error.captureStackTrace:(...c)=>{};function Jc(c){return typeof c==="object"&&c!==null&&!Array.isArray(c)}var o$=Cc(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(c){return!1}});function Xc(c){if(Jc(c)===!1)return!1;let $=c.constructor;if($===void 0)return!0;let v=$.prototype;if(Jc(v)===!1)return!1;if(Object.prototype.hasOwnProperty.call(v,"isPrototypeOf")===!1)return!1;return!0}function DO(c){let $=0;for(let v in c)if(Object.prototype.hasOwnProperty.call(c,v))$++;return $}var kO=(c)=>{let $=typeof c;switch($){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(c)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(c))return"array";if(c===null)return"null";if(c.then&&typeof c.then==="function"&&c.catch&&typeof c.catch==="function")return"promise";if(typeof Map<"u"&&c instanceof Map)return"map";if(typeof Set<"u"&&c instanceof Set)return"set";if(typeof Date<"u"&&c instanceof Date)return"date";if(typeof File<"u"&&c instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${$}`)}},yc=new Set(["string","number","symbol"]),Z$=new Set(["string","number","bigint","boolean","symbol","undefined"]);function C(c){return c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function M(c,$,v){let u=new c._zod.constr($??c._zod.def);if(!$||v?.parent)u._zod.parent=c;return u}function N(c){let $=c;if(!$)return{};if(typeof $==="string")return{error:()=>$};if($?.message!==void 0){if($?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");$.error=$.message}if(delete $.message,typeof $.error==="string")return{...$,error:()=>$.error};return $}function PO(c){let $;return new Proxy({},{get(v,u,n){return $??($=c()),Reflect.get($,u,n)},set(v,u,n,b){return $??($=c()),Reflect.set($,u,n,b)},has(v,u){return $??($=c()),Reflect.has($,u)},deleteProperty(v,u){return $??($=c()),Reflect.deleteProperty($,u)},ownKeys(v){return $??($=c()),Reflect.ownKeys($)},getOwnPropertyDescriptor(v,u){return $??($=c()),Reflect.getOwnPropertyDescriptor($,u)},defineProperty(v,u,n){return $??($=c()),Reflect.defineProperty($,u,n)}})}function S(c){if(typeof c==="bigint")return c.toString()+"n";if(typeof c==="string")return`"${c}"`;return`${c}`}function q$(c){return Object.keys(c).filter(($)=>{return c[$]._zod.optin==="optional"&&c[$]._zod.optout==="optional"})}var C$={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},f$={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function hO(c,$){let v=c._zod.def,u=uc(c._zod.def,{get shape(){let n={};for(let b in $){if(!(b in v.shape))throw Error(`Unrecognized key: "${b}"`);if(!$[b])continue;n[b]=v.shape[b]}return tc(this,"shape",n),n},checks:[]});return M(c,u)}function AO(c,$){let v=c._zod.def,u=uc(c._zod.def,{get shape(){let n={...c._zod.def.shape};for(let b in $){if(!(b in v.shape))throw Error(`Unrecognized key: "${b}"`);if(!$[b])continue;delete n[b]}return tc(this,"shape",n),n},checks:[]});return M(c,u)}function xO(c,$){if(!Xc($))throw Error("Invalid input to extend: expected a plain object");let v=uc(c._zod.def,{get shape(){let u={...c._zod.def.shape,...$};return tc(this,"shape",u),u},checks:[]});return M(c,v)}function zO(c,$){let v=uc(c._zod.def,{get shape(){let u={...c._zod.def.shape,...$._zod.def.shape};return tc(this,"shape",u),u},get catchall(){return $._zod.def.catchall},checks:[]});return M(c,v)}function JO(c,$,v){let u=uc($._zod.def,{get shape(){let n=$._zod.def.shape,b={...n};if(v)for(let r in v){if(!(r in n))throw Error(`Unrecognized key: "${r}"`);if(!v[r])continue;b[r]=c?new c({type:"optional",innerType:n[r]}):n[r]}else for(let r in n)b[r]=c?new c({type:"optional",innerType:n[r]}):n[r];return tc(this,"shape",b),b},checks:[]});return M($,u)}function HO(c,$,v){let u=uc($._zod.def,{get shape(){let n=$._zod.def.shape,b={...n};if(v)for(let r in v){if(!(r in b))throw Error(`Unrecognized key: "${r}"`);if(!v[r])continue;b[r]=new c({type:"nonoptional",innerType:n[r]})}else for(let r in n)b[r]=new c({type:"nonoptional",innerType:n[r]});return tc(this,"shape",b),b},checks:[]});return M($,u)}function _c(c,$=0){for(let v=$;v<c.issues.length;v++)if(c.issues[v]?.continue!==!0)return!0;return!1}function l(c,$){return $.map((v)=>{var u;return(u=v).path??(u.path=[]),v.path.unshift(c),v})}function Zc(c){return typeof c==="string"?c:c?.message}function o(c,$,v){let u={...c,path:c.path??[]};if(!c.message){let n=Zc(c.inst?._zod.def?.error?.(c))??Zc($?.error?.(c))??Zc(v.customError?.(c))??Zc(v.localeError?.(c))??"Invalid input";u.message=n}if(delete u.inst,delete u.continue,!$?.reportInput)delete u.input;return u}function dc(c){if(c instanceof Set)return"set";if(c instanceof Map)return"map";if(c instanceof File)return"file";return"unknown"}function pc(c){if(Array.isArray(c))return"array";if(typeof c==="string")return"string";return"unknown"}function Gc(...c){let[$,v,u]=c;if(typeof $==="string")return{message:$,code:"custom",input:v,inst:u};return{...$}}function XO(c){return Object.entries(c).filter(([$,v])=>{return Number.isNaN(Number.parseInt($,10))}).map(($)=>$[1])}class pg{constructor(...c){}}var eg=(c,$)=>{c.name="$ZodError",Object.defineProperty(c,"_zod",{value:c._zod,enumerable:!1}),Object.defineProperty(c,"issues",{value:$,enumerable:!1}),c.message=JSON.stringify($,Hc,2),Object.defineProperty(c,"toString",{value:()=>c.message,enumerable:!1})},ec=O("$ZodError",eg),Lc=O("$ZodError",eg,{Parent:Error});function ac(c,$=(v)=>v.message){let v={},u=[];for(let n of c.issues)if(n.path.length>0)v[n.path[0]]=v[n.path[0]]||[],v[n.path[0]].push($(n));else u.push($(n));return{formErrors:u,fieldErrors:v}}function sc(c,$){let v=$||function(b){return b.message},u={_errors:[]},n=(b)=>{for(let r of b.issues)if(r.code==="invalid_union"&&r.errors.length)r.errors.map((g)=>n({issues:g}));else if(r.code==="invalid_key")n({issues:r.issues});else if(r.code==="invalid_element")n({issues:r.issues});else if(r.path.length===0)u._errors.push(v(r));else{let g=u,I=0;while(I<r.path.length){let _=r.path[I];if(I!==r.path.length-1)g[_]=g[_]||{_errors:[]};else g[_]=g[_]||{_errors:[]},g[_]._errors.push(v(r));g=g[_],I++}}};return n(c),u}function y$(c,$){let v=$||function(b){return b.message},u={errors:[]},n=(b,r=[])=>{var g,I;for(let _ of b.issues)if(_.code==="invalid_union"&&_.errors.length)_.errors.map((U)=>n({issues:U},_.path));else if(_.code==="invalid_key")n({issues:_.issues},_.path);else if(_.code==="invalid_element")n({issues:_.issues},_.path);else{let U=[...r,..._.path];if(U.length===0){u.errors.push(v(_));continue}let i=u,j=0;while(j<U.length){let t=U[j],P=j===U.length-1;if(typeof t==="string")i.properties??(i.properties={}),(g=i.properties)[t]??(g[t]={errors:[]}),i=i.properties[t];else i.items??(i.items=[]),(I=i.items)[t]??(I[t]={errors:[]}),i=i.items[t];if(P)i.errors.push(v(_));j++}}};return n(c),u}function ag(c){let $=[],v=c.map((u)=>typeof u==="object"?u.key:u);for(let u of v)if(typeof u==="number")$.push(`[${u}]`);else if(typeof u==="symbol")$.push(`[${JSON.stringify(String(u))}]`);else if(/[^\w$]/.test(u))$.push(`[${JSON.stringify(u)}]`);else{if($.length)$.push(".");$.push(u)}return $.join("")}function d$(c){let $=[],v=[...c.issues].sort((u,n)=>(u.path??[]).length-(n.path??[]).length);for(let u of v)if($.push(`✖ ${u.message}`),u.path?.length)$.push(` → at ${ag(u.path)}`);return $.join(`
|
|
2
|
+
`)}var Qn=(c)=>($,v,u,n)=>{let b=u?Object.assign(u,{async:!1}):{async:!1},r=$._zod.run({value:v,issues:[]},b);if(r instanceof Promise)throw new y;if(r.issues.length){let g=new(n?.Err??c)(r.issues.map((I)=>o(I,b,m())));throw Fn(g,n?.callee),g}return r.value},Yn=Qn(Lc),Kn=(c)=>async($,v,u,n)=>{let b=u?Object.assign(u,{async:!0}):{async:!0},r=$._zod.run({value:v,issues:[]},b);if(r instanceof Promise)r=await r;if(r.issues.length){let g=new(n?.Err??c)(r.issues.map((I)=>o(I,b,m())));throw Fn(g,n?.callee),g}return r.value},mn=Kn(Lc),Rn=(c)=>($,v,u)=>{let n=u?{...u,async:!1}:{async:!1},b=$._zod.run({value:v,issues:[]},n);if(b instanceof Promise)throw new y;return b.issues.length?{success:!1,error:new(c??ec)(b.issues.map((r)=>o(r,n,m())))}:{success:!0,data:b.value}},p$=Rn(Lc),Vn=(c)=>async($,v,u)=>{let n=u?Object.assign(u,{async:!0}):{async:!0},b=$._zod.run({value:v,issues:[]},n);if(b instanceof Promise)b=await b;return b.issues.length?{success:!1,error:new c(b.issues.map((r)=>o(r,n,m())))}:{success:!0,data:b.value}},e$=Vn(Lc);var d={};nc(d,{xid:()=>nv,uuid7:()=>FO,uuid6:()=>BO,uuid4:()=>WO,uuid:()=>wc,uppercase:()=>Hv,unicodeEmail:()=>KO,undefined:()=>zv,ulid:()=>cv,time:()=>jv,string:()=>Dv,rfc5322Email:()=>YO,number:()=>hv,null:()=>xv,nanoid:()=>vv,lowercase:()=>Jv,ksuid:()=>$v,ipv6:()=>Iv,ipv4:()=>Ov,integer:()=>Pv,idnEmail:()=>mO,html5Email:()=>QO,hostname:()=>Uv,guid:()=>bv,extendedDuration:()=>LO,emoji:()=>gv,email:()=>rv,e164:()=>iv,duration:()=>uv,domain:()=>VO,datetime:()=>Sv,date:()=>Nv,cuid2:()=>s$,cuid:()=>a$,cidrv6:()=>_v,cidrv4:()=>tv,browserEmail:()=>RO,boolean:()=>Av,bigint:()=>kv,base64url:()=>Mn,base64:()=>wv});var a$=/^[cC][^\s-]{8,}$/,s$=/^[0-9a-z]+$/,cv=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,nv=/^[0-9a-vA-V]{20}$/,$v=/^[A-Za-z0-9]{27}$/,vv=/^[a-zA-Z0-9_-]{21}$/,uv=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,LO=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,bv=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,wc=(c)=>{if(!c)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${c}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},WO=wc(4),BO=wc(6),FO=wc(7),rv=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,QO=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,YO=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,KO=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,mO=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,RO=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;function gv(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var Ov=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Iv=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,tv=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,_v=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,wv=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Mn=/^[A-Za-z0-9_-]*$/,Uv=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,VO=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,iv=/^\+(?:[0-9]){6,14}[0-9]$/,sg="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Nv=new RegExp(`^${sg}$`);function c4(c){return typeof c.precision==="number"?c.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":c.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${c.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function jv(c){return new RegExp(`^${c4(c)}$`)}function Sv(c){let $=c4({precision:c.precision}),v=["Z"];if(c.local)v.push("");if(c.offset)v.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let u=`${$}(?:${v.join("|")})`;return new RegExp(`^${sg}T(?:${u})$`)}var Dv=(c)=>{let $=c?`[\\s\\S]{${c?.minimum??0},${c?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${$}$`)},kv=/^\d+n?$/,Pv=/^\d+$/,hv=/^-?\d+(?:\.\d+)?/i,Av=/true|false/i,xv=/null/i;var zv=/undefined/i;var Jv=/^[^A-Z]*$/,Hv=/^[^a-z]*$/;var Y=O("$ZodCheck",(c,$)=>{var v;c._zod??(c._zod={}),c._zod.def=$,(v=c._zod).onattach??(v.onattach=[])}),$4={number:"number",bigint:"bigint",object:"date"},Tn=O("$ZodCheckLessThan",(c,$)=>{Y.init(c,$);let v=$4[typeof $.value];c._zod.onattach.push((u)=>{let n=u._zod.bag,b=($.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;if($.value<b)if($.inclusive)n.maximum=$.value;else n.exclusiveMaximum=$.value}),c._zod.check=(u)=>{if($.inclusive?u.value<=$.value:u.value<$.value)return;u.issues.push({origin:v,code:"too_big",maximum:$.value,input:u.value,inclusive:$.inclusive,inst:c,continue:!$.abort})}}),En=O("$ZodCheckGreaterThan",(c,$)=>{Y.init(c,$);let v=$4[typeof $.value];c._zod.onattach.push((u)=>{let n=u._zod.bag,b=($.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if($.value>b)if($.inclusive)n.minimum=$.value;else n.exclusiveMinimum=$.value}),c._zod.check=(u)=>{if($.inclusive?u.value>=$.value:u.value>$.value)return;u.issues.push({origin:v,code:"too_small",minimum:$.value,input:u.value,inclusive:$.inclusive,inst:c,continue:!$.abort})}}),Xv=O("$ZodCheckMultipleOf",(c,$)=>{Y.init(c,$),c._zod.onattach.push((v)=>{var u;(u=v._zod.bag).multipleOf??(u.multipleOf=$.value)}),c._zod.check=(v)=>{if(typeof v.value!==typeof $.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof v.value==="bigint"?v.value%$.value===BigInt(0):l$(v.value,$.value)===0)return;v.issues.push({origin:typeof v.value,code:"not_multiple_of",divisor:$.value,input:v.value,inst:c,continue:!$.abort})}}),Gv=O("$ZodCheckNumberFormat",(c,$)=>{Y.init(c,$),$.format=$.format||"float64";let v=$.format?.includes("int"),u=v?"int":"number",[n,b]=C$[$.format];c._zod.onattach.push((r)=>{let g=r._zod.bag;if(g.format=$.format,g.minimum=n,g.maximum=b,v)g.pattern=Pv}),c._zod.check=(r)=>{let g=r.value;if(v){if(!Number.isInteger(g)){r.issues.push({expected:u,format:$.format,code:"invalid_type",continue:!1,input:g,inst:c});return}if(!Number.isSafeInteger(g)){if(g>0)r.issues.push({input:g,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:c,origin:u,continue:!$.abort});else r.issues.push({input:g,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:c,origin:u,continue:!$.abort});return}}if(g<n)r.issues.push({origin:"number",input:g,code:"too_small",minimum:n,inclusive:!0,inst:c,continue:!$.abort});if(g>b)r.issues.push({origin:"number",input:g,code:"too_big",maximum:b,inst:c})}}),Lv=O("$ZodCheckBigIntFormat",(c,$)=>{Y.init(c,$);let[v,u]=f$[$.format];c._zod.onattach.push((n)=>{let b=n._zod.bag;b.format=$.format,b.minimum=v,b.maximum=u}),c._zod.check=(n)=>{let b=n.value;if(b<v)n.issues.push({origin:"bigint",input:b,code:"too_small",minimum:v,inclusive:!0,inst:c,continue:!$.abort});if(b>u)n.issues.push({origin:"bigint",input:b,code:"too_big",maximum:u,inst:c})}}),Wv=O("$ZodCheckMaxSize",(c,$)=>{var v;Y.init(c,$),(v=c._zod.def).when??(v.when=(u)=>{let n=u.value;return!vc(n)&&n.size!==void 0}),c._zod.onattach.push((u)=>{let n=u._zod.bag.maximum??Number.POSITIVE_INFINITY;if($.maximum<n)u._zod.bag.maximum=$.maximum}),c._zod.check=(u)=>{let n=u.value;if(n.size<=$.maximum)return;u.issues.push({origin:dc(n),code:"too_big",maximum:$.maximum,input:n,inst:c,continue:!$.abort})}}),Bv=O("$ZodCheckMinSize",(c,$)=>{var v;Y.init(c,$),(v=c._zod.def).when??(v.when=(u)=>{let n=u.value;return!vc(n)&&n.size!==void 0}),c._zod.onattach.push((u)=>{let n=u._zod.bag.minimum??Number.NEGATIVE_INFINITY;if($.minimum>n)u._zod.bag.minimum=$.minimum}),c._zod.check=(u)=>{let n=u.value;if(n.size>=$.minimum)return;u.issues.push({origin:dc(n),code:"too_small",minimum:$.minimum,input:n,inst:c,continue:!$.abort})}}),Fv=O("$ZodCheckSizeEquals",(c,$)=>{var v;Y.init(c,$),(v=c._zod.def).when??(v.when=(u)=>{let n=u.value;return!vc(n)&&n.size!==void 0}),c._zod.onattach.push((u)=>{let n=u._zod.bag;n.minimum=$.size,n.maximum=$.size,n.size=$.size}),c._zod.check=(u)=>{let n=u.value,b=n.size;if(b===$.size)return;let r=b>$.size;u.issues.push({origin:dc(n),...r?{code:"too_big",maximum:$.size}:{code:"too_small",minimum:$.size},inclusive:!0,exact:!0,input:u.value,inst:c,continue:!$.abort})}}),Qv=O("$ZodCheckMaxLength",(c,$)=>{var v;Y.init(c,$),(v=c._zod.def).when??(v.when=(u)=>{let n=u.value;return!vc(n)&&n.length!==void 0}),c._zod.onattach.push((u)=>{let n=u._zod.bag.maximum??Number.POSITIVE_INFINITY;if($.maximum<n)u._zod.bag.maximum=$.maximum}),c._zod.check=(u)=>{let n=u.value;if(n.length<=$.maximum)return;let r=pc(n);u.issues.push({origin:r,code:"too_big",maximum:$.maximum,inclusive:!0,input:n,inst:c,continue:!$.abort})}}),Yv=O("$ZodCheckMinLength",(c,$)=>{var v;Y.init(c,$),(v=c._zod.def).when??(v.when=(u)=>{let n=u.value;return!vc(n)&&n.length!==void 0}),c._zod.onattach.push((u)=>{let n=u._zod.bag.minimum??Number.NEGATIVE_INFINITY;if($.minimum>n)u._zod.bag.minimum=$.minimum}),c._zod.check=(u)=>{let n=u.value;if(n.length>=$.minimum)return;let r=pc(n);u.issues.push({origin:r,code:"too_small",minimum:$.minimum,inclusive:!0,input:n,inst:c,continue:!$.abort})}}),Kv=O("$ZodCheckLengthEquals",(c,$)=>{var v;Y.init(c,$),(v=c._zod.def).when??(v.when=(u)=>{let n=u.value;return!vc(n)&&n.length!==void 0}),c._zod.onattach.push((u)=>{let n=u._zod.bag;n.minimum=$.length,n.maximum=$.length,n.length=$.length}),c._zod.check=(u)=>{let n=u.value,b=n.length;if(b===$.length)return;let r=pc(n),g=b>$.length;u.issues.push({origin:r,...g?{code:"too_big",maximum:$.length}:{code:"too_small",minimum:$.length},inclusive:!0,exact:!0,input:u.value,inst:c,continue:!$.abort})}}),Wc=O("$ZodCheckStringFormat",(c,$)=>{var v,u;if(Y.init(c,$),c._zod.onattach.push((n)=>{let b=n._zod.bag;if(b.format=$.format,$.pattern)b.patterns??(b.patterns=new Set),b.patterns.add($.pattern)}),$.pattern)(v=c._zod).check??(v.check=(n)=>{if($.pattern.lastIndex=0,$.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:$.format,input:n.value,...$.pattern?{pattern:$.pattern.toString()}:{},inst:c,continue:!$.abort})});else(u=c._zod).check??(u.check=()=>{})}),mv=O("$ZodCheckRegex",(c,$)=>{Wc.init(c,$),c._zod.check=(v)=>{if($.pattern.lastIndex=0,$.pattern.test(v.value))return;v.issues.push({origin:"string",code:"invalid_format",format:"regex",input:v.value,pattern:$.pattern.toString(),inst:c,continue:!$.abort})}}),Rv=O("$ZodCheckLowerCase",(c,$)=>{$.pattern??($.pattern=Jv),Wc.init(c,$)}),Vv=O("$ZodCheckUpperCase",(c,$)=>{$.pattern??($.pattern=Hv),Wc.init(c,$)}),Mv=O("$ZodCheckIncludes",(c,$)=>{Y.init(c,$);let v=C($.includes),u=new RegExp(typeof $.position==="number"?`^.{${$.position}}${v}`:v);$.pattern=u,c._zod.onattach.push((n)=>{let b=n._zod.bag;b.patterns??(b.patterns=new Set),b.patterns.add(u)}),c._zod.check=(n)=>{if(n.value.includes($.includes,$.position))return;n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:$.includes,input:n.value,inst:c,continue:!$.abort})}}),Tv=O("$ZodCheckStartsWith",(c,$)=>{Y.init(c,$);let v=new RegExp(`^${C($.prefix)}.*`);$.pattern??($.pattern=v),c._zod.onattach.push((u)=>{let n=u._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(v)}),c._zod.check=(u)=>{if(u.value.startsWith($.prefix))return;u.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:$.prefix,input:u.value,inst:c,continue:!$.abort})}}),Ev=O("$ZodCheckEndsWith",(c,$)=>{Y.init(c,$);let v=new RegExp(`.*${C($.suffix)}$`);$.pattern??($.pattern=v),c._zod.onattach.push((u)=>{let n=u._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(v)}),c._zod.check=(u)=>{if(u.value.endsWith($.suffix))return;u.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:$.suffix,input:u.value,inst:c,continue:!$.abort})}});function n4(c,$,v){if(c.issues.length)$.issues.push(...l(v,c.issues))}var lv=O("$ZodCheckProperty",(c,$)=>{Y.init(c,$),c._zod.check=(v)=>{let u=$.schema._zod.run({value:v.value[$.property],issues:[]},{});if(u instanceof Promise)return u.then((n)=>n4(n,v,$.property));n4(u,v,$.property);return}}),ov=O("$ZodCheckMimeType",(c,$)=>{Y.init(c,$);let v=new Set($.mime);c._zod.onattach.push((u)=>{u._zod.bag.mime=$.mime}),c._zod.check=(u)=>{if(v.has(u.value.type))return;u.issues.push({code:"invalid_value",values:$.mime,input:u.value.type,inst:c,continue:!$.abort})}}),Zv=O("$ZodCheckOverwrite",(c,$)=>{Y.init(c,$),c._zod.check=(v)=>{v.value=$.tx(v.value)}});class ln{constructor(c=[]){if(this.content=[],this.indent=0,this)this.args=c}indented(c){this.indent+=1,c(this),this.indent-=1}write(c){if(typeof c==="function"){c(this,{execution:"sync"}),c(this,{execution:"async"});return}let v=c.split(`
|
|
3
|
+
`).filter((b)=>b),u=Math.min(...v.map((b)=>b.length-b.trimStart().length)),n=v.map((b)=>b.slice(u)).map((b)=>" ".repeat(this.indent*2)+b);for(let b of n)this.content.push(b)}compile(){let c=Function,$=this?.args,u=[...(this?.content??[""]).map((n)=>` ${n}`)];return new c(...$,u.join(`
|
|
4
|
+
`))}}var qv={major:4,minor:0,patch:15};var A=O("$ZodType",(c,$)=>{var v;c??(c={}),c._zod.def=$,c._zod.bag=c._zod.bag||{},c._zod.version=qv;let u=[...c._zod.def.checks??[]];if(c._zod.traits.has("$ZodCheck"))u.unshift(c);for(let n of u)for(let b of n._zod.onattach)b(c);if(u.length===0)(v=c._zod).deferred??(v.deferred=[]),c._zod.deferred?.push(()=>{c._zod.run=c._zod.parse});else{let n=(b,r,g)=>{let I=_c(b),_;for(let U of r){if(U._zod.def.when){if(!U._zod.def.when(b))continue}else if(I)continue;let i=b.issues.length,j=U._zod.check(b);if(j instanceof Promise&&g?.async===!1)throw new y;if(_||j instanceof Promise)_=(_??Promise.resolve()).then(async()=>{if(await j,b.issues.length===i)return;if(!I)I=_c(b,i)});else{if(b.issues.length===i)continue;if(!I)I=_c(b,i)}}if(_)return _.then(()=>{return b});return b};c._zod.run=(b,r)=>{let g=c._zod.parse(b,r);if(g instanceof Promise){if(r.async===!1)throw new y;return g.then((I)=>n(I,u,r))}return n(g,u,r)}}c["~standard"]={validate:(n)=>{try{let b=p$(c,n);return b.success?{value:b.data}:{issues:b.error?.issues}}catch(b){return e$(c,n).then((r)=>r.success?{value:r.data}:{issues:r.error?.issues})}},vendor:"zod",version:1}}),Uc=O("$ZodString",(c,$)=>{A.init(c,$),c._zod.pattern=[...c?._zod.bag?.patterns??[]].pop()??Dv(c._zod.bag),c._zod.parse=(v,u)=>{if($.coerce)try{v.value=String(v.value)}catch(n){}if(typeof v.value==="string")return v;return v.issues.push({expected:"string",code:"invalid_type",input:v.value,inst:c}),v}}),B=O("$ZodStringFormat",(c,$)=>{Wc.init(c,$),Uc.init(c,$)}),fv=O("$ZodGUID",(c,$)=>{$.pattern??($.pattern=bv),B.init(c,$)}),yv=O("$ZodUUID",(c,$)=>{if($.version){let u={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[$.version];if(u===void 0)throw Error(`Invalid UUID version: "${$.version}"`);$.pattern??($.pattern=wc(u))}else $.pattern??($.pattern=wc());B.init(c,$)}),dv=O("$ZodEmail",(c,$)=>{$.pattern??($.pattern=rv),B.init(c,$)}),pv=O("$ZodURL",(c,$)=>{B.init(c,$),c._zod.check=(v)=>{try{let u=v.value.trim(),n=new URL(u);if($.hostname){if($.hostname.lastIndex=0,!$.hostname.test(n.hostname))v.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Uv.source,input:v.value,inst:c,continue:!$.abort})}if($.protocol){if($.protocol.lastIndex=0,!$.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol))v.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:$.protocol.source,input:v.value,inst:c,continue:!$.abort})}if($.normalize)v.value=n.href;else v.value=u;return}catch(u){v.issues.push({code:"invalid_format",format:"url",input:v.value,inst:c,continue:!$.abort})}}}),ev=O("$ZodEmoji",(c,$)=>{$.pattern??($.pattern=gv()),B.init(c,$)}),av=O("$ZodNanoID",(c,$)=>{$.pattern??($.pattern=vv),B.init(c,$)}),sv=O("$ZodCUID",(c,$)=>{$.pattern??($.pattern=a$),B.init(c,$)}),cu=O("$ZodCUID2",(c,$)=>{$.pattern??($.pattern=s$),B.init(c,$)}),nu=O("$ZodULID",(c,$)=>{$.pattern??($.pattern=cv),B.init(c,$)}),$u=O("$ZodXID",(c,$)=>{$.pattern??($.pattern=nv),B.init(c,$)}),vu=O("$ZodKSUID",(c,$)=>{$.pattern??($.pattern=$v),B.init(c,$)}),uu=O("$ZodISODateTime",(c,$)=>{$.pattern??($.pattern=Sv($)),B.init(c,$)}),bu=O("$ZodISODate",(c,$)=>{$.pattern??($.pattern=Nv),B.init(c,$)}),ru=O("$ZodISOTime",(c,$)=>{$.pattern??($.pattern=jv($)),B.init(c,$)}),gu=O("$ZodISODuration",(c,$)=>{$.pattern??($.pattern=uv),B.init(c,$)}),Ou=O("$ZodIPv4",(c,$)=>{$.pattern??($.pattern=Ov),B.init(c,$),c._zod.onattach.push((v)=>{let u=v._zod.bag;u.format="ipv4"})}),Iu=O("$ZodIPv6",(c,$)=>{$.pattern??($.pattern=Iv),B.init(c,$),c._zod.onattach.push((v)=>{let u=v._zod.bag;u.format="ipv6"}),c._zod.check=(v)=>{try{new URL(`http://[${v.value}]`)}catch{v.issues.push({code:"invalid_format",format:"ipv6",input:v.value,inst:c,continue:!$.abort})}}}),tu=O("$ZodCIDRv4",(c,$)=>{$.pattern??($.pattern=tv),B.init(c,$)}),_u=O("$ZodCIDRv6",(c,$)=>{$.pattern??($.pattern=_v),B.init(c,$),c._zod.check=(v)=>{let[u,n]=v.value.split("/");try{if(!n)throw Error();let b=Number(n);if(`${b}`!==n)throw Error();if(b<0||b>128)throw Error();new URL(`http://[${u}]`)}catch{v.issues.push({code:"invalid_format",format:"cidrv6",input:v.value,inst:c,continue:!$.abort})}}});function wu(c){if(c==="")return!0;if(c.length%4!==0)return!1;try{return atob(c),!0}catch{return!1}}var Uu=O("$ZodBase64",(c,$)=>{$.pattern??($.pattern=wv),B.init(c,$),c._zod.onattach.push((v)=>{v._zod.bag.contentEncoding="base64"}),c._zod.check=(v)=>{if(wu(v.value))return;v.issues.push({code:"invalid_format",format:"base64",input:v.value,inst:c,continue:!$.abort})}});function N4(c){if(!Mn.test(c))return!1;let $=c.replace(/[-_]/g,(u)=>u==="-"?"+":"/"),v=$.padEnd(Math.ceil($.length/4)*4,"=");return wu(v)}var iu=O("$ZodBase64URL",(c,$)=>{$.pattern??($.pattern=Mn),B.init(c,$),c._zod.onattach.push((v)=>{v._zod.bag.contentEncoding="base64url"}),c._zod.check=(v)=>{if(N4(v.value))return;v.issues.push({code:"invalid_format",format:"base64url",input:v.value,inst:c,continue:!$.abort})}}),Nu=O("$ZodE164",(c,$)=>{$.pattern??($.pattern=iv),B.init(c,$)});function j4(c,$=null){try{let v=c.split(".");if(v.length!==3)return!1;let[u]=v;if(!u)return!1;let n=JSON.parse(atob(u));if("typ"in n&&n?.typ!=="JWT")return!1;if(!n.alg)return!1;if($&&(!("alg"in n)||n.alg!==$))return!1;return!0}catch{return!1}}var ju=O("$ZodJWT",(c,$)=>{B.init(c,$),c._zod.check=(v)=>{if(j4(v.value,$.alg))return;v.issues.push({code:"invalid_format",format:"jwt",input:v.value,inst:c,continue:!$.abort})}}),Su=O("$ZodCustomStringFormat",(c,$)=>{B.init(c,$),c._zod.check=(v)=>{if($.fn(v.value))return;v.issues.push({code:"invalid_format",format:$.format,input:v.value,inst:c,continue:!$.abort})}}),qn=O("$ZodNumber",(c,$)=>{A.init(c,$),c._zod.pattern=c._zod.bag.pattern??hv,c._zod.parse=(v,u)=>{if($.coerce)try{v.value=Number(v.value)}catch(r){}let n=v.value;if(typeof n==="number"&&!Number.isNaN(n)&&Number.isFinite(n))return v;let b=typeof n==="number"?Number.isNaN(n)?"NaN":!Number.isFinite(n)?"Infinity":void 0:void 0;return v.issues.push({expected:"number",code:"invalid_type",input:n,inst:c,...b?{received:b}:{}}),v}}),Du=O("$ZodNumber",(c,$)=>{Gv.init(c,$),qn.init(c,$)}),cn=O("$ZodBoolean",(c,$)=>{A.init(c,$),c._zod.pattern=Av,c._zod.parse=(v,u)=>{if($.coerce)try{v.value=Boolean(v.value)}catch(b){}let n=v.value;if(typeof n==="boolean")return v;return v.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:c}),v}}),Cn=O("$ZodBigInt",(c,$)=>{A.init(c,$),c._zod.pattern=kv,c._zod.parse=(v,u)=>{if($.coerce)try{v.value=BigInt(v.value)}catch(n){}if(typeof v.value==="bigint")return v;return v.issues.push({expected:"bigint",code:"invalid_type",input:v.value,inst:c}),v}}),ku=O("$ZodBigInt",(c,$)=>{Lv.init(c,$),Cn.init(c,$)}),Pu=O("$ZodSymbol",(c,$)=>{A.init(c,$),c._zod.parse=(v,u)=>{let n=v.value;if(typeof n==="symbol")return v;return v.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:c}),v}}),hu=O("$ZodUndefined",(c,$)=>{A.init(c,$),c._zod.pattern=zv,c._zod.values=new Set([void 0]),c._zod.optin="optional",c._zod.optout="optional",c._zod.parse=(v,u)=>{let n=v.value;if(typeof n>"u")return v;return v.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:c}),v}}),Au=O("$ZodNull",(c,$)=>{A.init(c,$),c._zod.pattern=xv,c._zod.values=new Set([null]),c._zod.parse=(v,u)=>{let n=v.value;if(n===null)return v;return v.issues.push({expected:"null",code:"invalid_type",input:n,inst:c}),v}}),xu=O("$ZodAny",(c,$)=>{A.init(c,$),c._zod.parse=(v)=>v}),Bc=O("$ZodUnknown",(c,$)=>{A.init(c,$),c._zod.parse=(v)=>v}),zu=O("$ZodNever",(c,$)=>{A.init(c,$),c._zod.parse=(v,u)=>{return v.issues.push({expected:"never",code:"invalid_type",input:v.value,inst:c}),v}}),Ju=O("$ZodVoid",(c,$)=>{A.init(c,$),c._zod.parse=(v,u)=>{let n=v.value;if(typeof n>"u")return v;return v.issues.push({expected:"void",code:"invalid_type",input:n,inst:c}),v}}),Hu=O("$ZodDate",(c,$)=>{A.init(c,$),c._zod.parse=(v,u)=>{if($.coerce)try{v.value=new Date(v.value)}catch(g){}let n=v.value,b=n instanceof Date;if(b&&!Number.isNaN(n.getTime()))return v;return v.issues.push({expected:"date",code:"invalid_type",input:n,...b?{received:"Invalid Date"}:{},inst:c}),v}});function u4(c,$,v){if(c.issues.length)$.issues.push(...l(v,c.issues));$.value[v]=c.value}var nn=O("$ZodArray",(c,$)=>{A.init(c,$),c._zod.parse=(v,u)=>{let n=v.value;if(!Array.isArray(n))return v.issues.push({expected:"array",code:"invalid_type",input:n,inst:c}),v;v.value=Array(n.length);let b=[];for(let r=0;r<n.length;r++){let g=n[r],I=$.element._zod.run({value:g,issues:[]},u);if(I instanceof Promise)b.push(I.then((_)=>u4(_,v,r)));else u4(I,v,r)}if(b.length)return Promise.all(b).then(()=>v);return v}});function on(c,$,v,u){if(c.issues.length)$.issues.push(...l(v,c.issues));if(c.value===void 0){if(v in u)$.value[v]=void 0}else $.value[v]=c.value}var Xu=O("$ZodObject",(c,$)=>{A.init(c,$);let v=Cc(()=>{let i=Object.keys($.shape);for(let t of i)if(!($.shape[t]instanceof A))throw Error(`Invalid element at key "${t}": expected a Zod schema`);let j=q$($.shape);return{shape:$.shape,keys:i,keySet:new Set(i),numKeys:i.length,optionalKeys:new Set(j)}});G(c._zod,"propValues",()=>{let i=$.shape,j={};for(let t in i){let P=i[t]._zod;if(P.values){j[t]??(j[t]=new Set);for(let h of P.values)j[t].add(h)}}return j});let u=(i)=>{let j=new ln(["shape","payload","ctx"]),t=v.value,P=(L)=>{let W=Bn(L);return`shape[${W}]._zod.run({ value: input[${W}], issues: [] }, ctx)`};j.write("const input = payload.value;");let h=Object.create(null),X=0;for(let L of t.keys)h[L]=`key_${X++}`;j.write("const newResult = {}");for(let L of t.keys){let W=h[L],V=Bn(L);j.write(`const ${W} = ${P(L)};`),j.write(`
|
|
5
|
+
if (${W}.issues.length) {
|
|
6
|
+
payload.issues = payload.issues.concat(${W}.issues.map(iss => ({
|
|
7
|
+
...iss,
|
|
8
|
+
path: iss.path ? [${V}, ...iss.path] : [${V}]
|
|
9
|
+
})));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if (${W}.value === undefined) {
|
|
13
|
+
if (${V} in input) {
|
|
14
|
+
newResult[${V}] = undefined;
|
|
1679
15
|
}
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
} catch (error) {
|
|
1683
|
-
return {
|
|
1684
|
-
messageId,
|
|
1685
|
-
phoneNumber: "unknown",
|
|
1686
|
-
templateCode: "unknown",
|
|
1687
|
-
status: "FAILED",
|
|
1688
|
-
error: {
|
|
1689
|
-
code: "API_ERROR",
|
|
1690
|
-
message: error instanceof Error ? error.message : "Unknown error"
|
|
1691
|
-
},
|
|
1692
|
-
attempts: []
|
|
1693
|
-
};
|
|
1694
|
-
}
|
|
1695
|
-
}
|
|
1696
|
-
groupByTemplate(messages) {
|
|
1697
|
-
const groups = {};
|
|
1698
|
-
messages.forEach((msg) => {
|
|
1699
|
-
const template = msg.templateCode || "unknown";
|
|
1700
|
-
groups[template] = (groups[template] || 0) + 1;
|
|
1701
|
-
});
|
|
1702
|
-
return groups;
|
|
1703
|
-
}
|
|
1704
|
-
groupByDay(messages, period) {
|
|
1705
|
-
const groups = {};
|
|
1706
|
-
const current = new Date(period.from);
|
|
1707
|
-
while (current <= period.to) {
|
|
1708
|
-
const dateKey = current.toISOString().split("T")[0];
|
|
1709
|
-
groups[dateKey] = 0;
|
|
1710
|
-
current.setDate(current.getDate() + 1);
|
|
1711
|
-
}
|
|
1712
|
-
messages.forEach((msg) => {
|
|
1713
|
-
if (msg.requestDate) {
|
|
1714
|
-
const dateKey = new Date(msg.requestDate).toISOString().split("T")[0];
|
|
1715
|
-
if (groups.hasOwnProperty(dateKey)) {
|
|
1716
|
-
groups[dateKey]++;
|
|
16
|
+
} else {
|
|
17
|
+
newResult[${V}] = ${W}.value;
|
|
1717
18
|
}
|
|
1718
|
-
}
|
|
1719
|
-
});
|
|
1720
|
-
return groups;
|
|
1721
|
-
}
|
|
1722
|
-
groupByHour(messages) {
|
|
1723
|
-
const groups = {};
|
|
1724
|
-
for (let i = 0; i < 24; i++) {
|
|
1725
|
-
groups[i.toString()] = 0;
|
|
1726
|
-
}
|
|
1727
|
-
messages.forEach((msg) => {
|
|
1728
|
-
if (msg.requestDate) {
|
|
1729
|
-
const hour = new Date(msg.requestDate).getHours();
|
|
1730
|
-
groups[hour.toString()]++;
|
|
1731
|
-
}
|
|
1732
|
-
});
|
|
1733
|
-
return groups;
|
|
1734
|
-
}
|
|
1735
|
-
mapStatus(statusCode) {
|
|
1736
|
-
switch (statusCode) {
|
|
1737
|
-
case "OK":
|
|
1738
|
-
return "DELIVERED";
|
|
1739
|
-
case "PENDING":
|
|
1740
|
-
return "SENDING";
|
|
1741
|
-
case "FAILED":
|
|
1742
|
-
return "FAILED";
|
|
1743
|
-
default:
|
|
1744
|
-
return "SENT";
|
|
1745
|
-
}
|
|
1746
|
-
}
|
|
1747
|
-
};
|
|
19
|
+
`)}j.write("payload.value = newResult;"),j.write("return payload;");let H=j.compile();return(L,W)=>H(i,L,W)},n,b=Jc,r=!oc.jitless,I=r&&o$.value,_=$.catchall,U;c._zod.parse=(i,j)=>{U??(U=v.value);let t=i.value;if(!b(t))return i.issues.push({expected:"object",code:"invalid_type",input:t,inst:c}),i;let P=[];if(r&&I&&j?.async===!1&&j.jitless!==!0){if(!n)n=u($.shape);i=n(i,j)}else{i.value={};let W=U.shape;for(let V of U.keys){let Q$=W[V]._zod.run({value:t[V],issues:[]},j);if(Q$ instanceof Promise)P.push(Q$.then((F6)=>on(F6,i,V,t)));else on(Q$,i,V,t)}}if(!_)return P.length?Promise.all(P).then(()=>i):i;let h=[],X=U.keySet,H=_._zod,L=H.def.type;for(let W of Object.keys(t)){if(X.has(W))continue;if(L==="never"){h.push(W);continue}let V=H.run({value:t[W],issues:[]},j);if(V instanceof Promise)P.push(V.then((Fg)=>on(Fg,i,W,t)));else on(V,i,W,t)}if(h.length)i.issues.push({code:"unrecognized_keys",keys:h,input:t,inst:c});if(!P.length)return i;return Promise.all(P).then(()=>{return i})}});function b4(c,$,v,u){for(let b of c)if(b.issues.length===0)return $.value=b.value,$;let n=c.filter((b)=>!_c(b));if(n.length===1)return $.value=n[0].value,n[0];return $.issues.push({code:"invalid_union",input:$.value,inst:v,errors:c.map((b)=>b.issues.map((r)=>o(r,u,m())))}),$}var fn=O("$ZodUnion",(c,$)=>{A.init(c,$),G(c._zod,"optin",()=>$.options.some((n)=>n._zod.optin==="optional")?"optional":void 0),G(c._zod,"optout",()=>$.options.some((n)=>n._zod.optout==="optional")?"optional":void 0),G(c._zod,"values",()=>{if($.options.every((n)=>n._zod.values))return new Set($.options.flatMap((n)=>Array.from(n._zod.values)));return}),G(c._zod,"pattern",()=>{if($.options.every((n)=>n._zod.pattern)){let n=$.options.map((b)=>b._zod.pattern);return new RegExp(`^(${n.map((b)=>fc(b.source)).join("|")})$`)}return});let v=$.options.length===1,u=$.options[0]._zod.run;c._zod.parse=(n,b)=>{if(v)return u(n,b);let r=!1,g=[];for(let I of $.options){let _=I._zod.run({value:n.value,issues:[]},b);if(_ instanceof Promise)g.push(_),r=!0;else{if(_.issues.length===0)return _;g.push(_)}}if(!r)return b4(g,n,c,b);return Promise.all(g).then((I)=>{return b4(I,n,c,b)})}}),Gu=O("$ZodDiscriminatedUnion",(c,$)=>{fn.init(c,$);let v=c._zod.parse;G(c._zod,"propValues",()=>{let n={};for(let b of $.options){let r=b._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${$.options.indexOf(b)}"`);for(let[g,I]of Object.entries(r)){if(!n[g])n[g]=new Set;for(let _ of I)n[g].add(_)}}return n});let u=Cc(()=>{let n=$.options,b=new Map;for(let r of n){let g=r._zod.propValues?.[$.discriminator];if(!g||g.size===0)throw Error(`Invalid discriminated union option at index "${$.options.indexOf(r)}"`);for(let I of g){if(b.has(I))throw Error(`Duplicate discriminator value "${String(I)}"`);b.set(I,r)}}return b});c._zod.parse=(n,b)=>{let r=n.value;if(!Jc(r))return n.issues.push({code:"invalid_type",expected:"object",input:r,inst:c}),n;let g=u.value.get(r?.[$.discriminator]);if(g)return g._zod.run(n,b);if($.unionFallback)return v(n,b);return n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:$.discriminator,input:r,path:[$.discriminator],inst:c}),n}}),Lu=O("$ZodIntersection",(c,$)=>{A.init(c,$),c._zod.parse=(v,u)=>{let n=v.value,b=$.left._zod.run({value:n,issues:[]},u),r=$.right._zod.run({value:n,issues:[]},u);if(b instanceof Promise||r instanceof Promise)return Promise.all([b,r]).then(([I,_])=>{return r4(v,I,_)});return r4(v,b,r)}});function Cv(c,$){if(c===$)return{valid:!0,data:c};if(c instanceof Date&&$ instanceof Date&&+c===+$)return{valid:!0,data:c};if(Xc(c)&&Xc($)){let v=Object.keys($),u=Object.keys(c).filter((b)=>v.indexOf(b)!==-1),n={...c,...$};for(let b of u){let r=Cv(c[b],$[b]);if(!r.valid)return{valid:!1,mergeErrorPath:[b,...r.mergeErrorPath]};n[b]=r.data}return{valid:!0,data:n}}if(Array.isArray(c)&&Array.isArray($)){if(c.length!==$.length)return{valid:!1,mergeErrorPath:[]};let v=[];for(let u=0;u<c.length;u++){let n=c[u],b=$[u],r=Cv(n,b);if(!r.valid)return{valid:!1,mergeErrorPath:[u,...r.mergeErrorPath]};v.push(r.data)}return{valid:!0,data:v}}return{valid:!1,mergeErrorPath:[]}}function r4(c,$,v){if($.issues.length)c.issues.push(...$.issues);if(v.issues.length)c.issues.push(...v.issues);if(_c(c))return c;let u=Cv($.value,v.value);if(!u.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`);return c.value=u.data,c}var ic=O("$ZodTuple",(c,$)=>{A.init(c,$);let v=$.items,u=v.length-[...v].reverse().findIndex((n)=>n._zod.optin!=="optional");c._zod.parse=(n,b)=>{let r=n.value;if(!Array.isArray(r))return n.issues.push({input:r,inst:c,expected:"tuple",code:"invalid_type"}),n;n.value=[];let g=[];if(!$.rest){let _=r.length>v.length,U=r.length<u-1;if(_||U)return n.issues.push({..._?{code:"too_big",maximum:v.length}:{code:"too_small",minimum:v.length},input:r,inst:c,origin:"array"}),n}let I=-1;for(let _ of v){if(I++,I>=r.length){if(I>=u)continue}let U=_._zod.run({value:r[I],issues:[]},b);if(U instanceof Promise)g.push(U.then((i)=>Zn(i,n,I)));else Zn(U,n,I)}if($.rest){let _=r.slice(v.length);for(let U of _){I++;let i=$.rest._zod.run({value:U,issues:[]},b);if(i instanceof Promise)g.push(i.then((j)=>Zn(j,n,I)));else Zn(i,n,I)}}if(g.length)return Promise.all(g).then(()=>n);return n}});function Zn(c,$,v){if(c.issues.length)$.issues.push(...l(v,c.issues));$.value[v]=c.value}var Wu=O("$ZodRecord",(c,$)=>{A.init(c,$),c._zod.parse=(v,u)=>{let n=v.value;if(!Xc(n))return v.issues.push({expected:"record",code:"invalid_type",input:n,inst:c}),v;let b=[];if($.keyType._zod.values){let r=$.keyType._zod.values;v.value={};for(let I of r)if(typeof I==="string"||typeof I==="number"||typeof I==="symbol"){let _=$.valueType._zod.run({value:n[I],issues:[]},u);if(_ instanceof Promise)b.push(_.then((U)=>{if(U.issues.length)v.issues.push(...l(I,U.issues));v.value[I]=U.value}));else{if(_.issues.length)v.issues.push(...l(I,_.issues));v.value[I]=_.value}}let g;for(let I in n)if(!r.has(I))g=g??[],g.push(I);if(g&&g.length>0)v.issues.push({code:"unrecognized_keys",input:n,inst:c,keys:g})}else{v.value={};for(let r of Reflect.ownKeys(n)){if(r==="__proto__")continue;let g=$.keyType._zod.run({value:r,issues:[]},u);if(g instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(g.issues.length){v.issues.push({code:"invalid_key",origin:"record",issues:g.issues.map((_)=>o(_,u,m())),input:r,path:[r],inst:c}),v.value[g.value]=g.value;continue}let I=$.valueType._zod.run({value:n[r],issues:[]},u);if(I instanceof Promise)b.push(I.then((_)=>{if(_.issues.length)v.issues.push(...l(r,_.issues));v.value[g.value]=_.value}));else{if(I.issues.length)v.issues.push(...l(r,I.issues));v.value[g.value]=I.value}}}if(b.length)return Promise.all(b).then(()=>v);return v}}),Bu=O("$ZodMap",(c,$)=>{A.init(c,$),c._zod.parse=(v,u)=>{let n=v.value;if(!(n instanceof Map))return v.issues.push({expected:"map",code:"invalid_type",input:n,inst:c}),v;let b=[];v.value=new Map;for(let[r,g]of n){let I=$.keyType._zod.run({value:r,issues:[]},u),_=$.valueType._zod.run({value:g,issues:[]},u);if(I instanceof Promise||_ instanceof Promise)b.push(Promise.all([I,_]).then(([U,i])=>{g4(U,i,v,r,n,c,u)}));else g4(I,_,v,r,n,c,u)}if(b.length)return Promise.all(b).then(()=>v);return v}});function g4(c,$,v,u,n,b,r){if(c.issues.length)if(yc.has(typeof u))v.issues.push(...l(u,c.issues));else v.issues.push({code:"invalid_key",origin:"map",input:n,inst:b,issues:c.issues.map((g)=>o(g,r,m()))});if($.issues.length)if(yc.has(typeof u))v.issues.push(...l(u,$.issues));else v.issues.push({origin:"map",code:"invalid_element",input:n,inst:b,key:u,issues:$.issues.map((g)=>o(g,r,m()))});v.value.set(c.value,$.value)}var Fu=O("$ZodSet",(c,$)=>{A.init(c,$),c._zod.parse=(v,u)=>{let n=v.value;if(!(n instanceof Set))return v.issues.push({input:n,inst:c,expected:"set",code:"invalid_type"}),v;let b=[];v.value=new Set;for(let r of n){let g=$.valueType._zod.run({value:r,issues:[]},u);if(g instanceof Promise)b.push(g.then((I)=>O4(I,v)));else O4(g,v)}if(b.length)return Promise.all(b).then(()=>v);return v}});function O4(c,$){if(c.issues.length)$.issues.push(...c.issues);$.value.add(c.value)}var Qu=O("$ZodEnum",(c,$)=>{A.init(c,$);let v=qc($.entries),u=new Set(v);c._zod.values=u,c._zod.pattern=new RegExp(`^(${v.filter((n)=>yc.has(typeof n)).map((n)=>typeof n==="string"?C(n):n.toString()).join("|")})$`),c._zod.parse=(n,b)=>{let r=n.value;if(u.has(r))return n;return n.issues.push({code:"invalid_value",values:v,input:r,inst:c}),n}}),Yu=O("$ZodLiteral",(c,$)=>{if(A.init(c,$),$.values.length===0)throw Error("Cannot create literal schema with no valid values");c._zod.values=new Set($.values),c._zod.pattern=new RegExp(`^(${$.values.map((v)=>typeof v==="string"?C(v):v?C(v.toString()):String(v)).join("|")})$`),c._zod.parse=(v,u)=>{let n=v.value;if(c._zod.values.has(n))return v;return v.issues.push({code:"invalid_value",values:$.values,input:n,inst:c}),v}}),Ku=O("$ZodFile",(c,$)=>{A.init(c,$),c._zod.parse=(v,u)=>{let n=v.value;if(n instanceof File)return v;return v.issues.push({expected:"file",code:"invalid_type",input:n,inst:c}),v}}),$n=O("$ZodTransform",(c,$)=>{A.init(c,$),c._zod.parse=(v,u)=>{let n=$.transform(v.value,v);if(u.async)return(n instanceof Promise?n:Promise.resolve(n)).then((r)=>{return v.value=r,v});if(n instanceof Promise)throw new y;return v.value=n,v}});function I4(c,$){if(c.issues.length&&$===void 0)return{issues:[],value:void 0};return c}var mu=O("$ZodOptional",(c,$)=>{A.init(c,$),c._zod.optin="optional",c._zod.optout="optional",G(c._zod,"values",()=>{return $.innerType._zod.values?new Set([...$.innerType._zod.values,void 0]):void 0}),G(c._zod,"pattern",()=>{let v=$.innerType._zod.pattern;return v?new RegExp(`^(${fc(v.source)})?$`):void 0}),c._zod.parse=(v,u)=>{if($.innerType._zod.optin==="optional"){let n=$.innerType._zod.run(v,u);if(n instanceof Promise)return n.then((b)=>I4(b,v.value));return I4(n,v.value)}if(v.value===void 0)return v;return $.innerType._zod.run(v,u)}}),Ru=O("$ZodNullable",(c,$)=>{A.init(c,$),G(c._zod,"optin",()=>$.innerType._zod.optin),G(c._zod,"optout",()=>$.innerType._zod.optout),G(c._zod,"pattern",()=>{let v=$.innerType._zod.pattern;return v?new RegExp(`^(${fc(v.source)}|null)$`):void 0}),G(c._zod,"values",()=>{return $.innerType._zod.values?new Set([...$.innerType._zod.values,null]):void 0}),c._zod.parse=(v,u)=>{if(v.value===null)return v;return $.innerType._zod.run(v,u)}}),Vu=O("$ZodDefault",(c,$)=>{A.init(c,$),c._zod.optin="optional",G(c._zod,"values",()=>$.innerType._zod.values),c._zod.parse=(v,u)=>{if(v.value===void 0)return v.value=$.defaultValue,v;let n=$.innerType._zod.run(v,u);if(n instanceof Promise)return n.then((b)=>t4(b,$));return t4(n,$)}});function t4(c,$){if(c.value===void 0)c.value=$.defaultValue;return c}var Mu=O("$ZodPrefault",(c,$)=>{A.init(c,$),c._zod.optin="optional",G(c._zod,"values",()=>$.innerType._zod.values),c._zod.parse=(v,u)=>{if(v.value===void 0)v.value=$.defaultValue;return $.innerType._zod.run(v,u)}}),Tu=O("$ZodNonOptional",(c,$)=>{A.init(c,$),G(c._zod,"values",()=>{let v=$.innerType._zod.values;return v?new Set([...v].filter((u)=>u!==void 0)):void 0}),c._zod.parse=(v,u)=>{let n=$.innerType._zod.run(v,u);if(n instanceof Promise)return n.then((b)=>_4(b,c));return _4(n,c)}});function _4(c,$){if(!c.issues.length&&c.value===void 0)c.issues.push({code:"invalid_type",expected:"nonoptional",input:c.value,inst:$});return c}var Eu=O("$ZodSuccess",(c,$)=>{A.init(c,$),c._zod.parse=(v,u)=>{let n=$.innerType._zod.run(v,u);if(n instanceof Promise)return n.then((b)=>{return v.value=b.issues.length===0,v});return v.value=n.issues.length===0,v}}),lu=O("$ZodCatch",(c,$)=>{A.init(c,$),G(c._zod,"optin",()=>$.innerType._zod.optin),G(c._zod,"optout",()=>$.innerType._zod.optout),G(c._zod,"values",()=>$.innerType._zod.values),c._zod.parse=(v,u)=>{let n=$.innerType._zod.run(v,u);if(n instanceof Promise)return n.then((b)=>{if(v.value=b.value,b.issues.length)v.value=$.catchValue({...v,error:{issues:b.issues.map((r)=>o(r,u,m()))},input:v.value}),v.issues=[];return v});if(v.value=n.value,n.issues.length)v.value=$.catchValue({...v,error:{issues:n.issues.map((b)=>o(b,u,m()))},input:v.value}),v.issues=[];return v}}),ou=O("$ZodNaN",(c,$)=>{A.init(c,$),c._zod.parse=(v,u)=>{if(typeof v.value!=="number"||!Number.isNaN(v.value))return v.issues.push({input:v.value,inst:c,expected:"nan",code:"invalid_type"}),v;return v}}),vn=O("$ZodPipe",(c,$)=>{A.init(c,$),G(c._zod,"values",()=>$.in._zod.values),G(c._zod,"optin",()=>$.in._zod.optin),G(c._zod,"optout",()=>$.out._zod.optout),G(c._zod,"propValues",()=>$.in._zod.propValues),c._zod.parse=(v,u)=>{let n=$.in._zod.run(v,u);if(n instanceof Promise)return n.then((b)=>w4(b,$,u));return w4(n,$,u)}});function w4(c,$,v){if(c.issues.length)return c;return $.out._zod.run({value:c.value,issues:c.issues},v)}var Zu=O("$ZodReadonly",(c,$)=>{A.init(c,$),G(c._zod,"propValues",()=>$.innerType._zod.propValues),G(c._zod,"values",()=>$.innerType._zod.values),G(c._zod,"optin",()=>$.innerType._zod.optin),G(c._zod,"optout",()=>$.innerType._zod.optout),c._zod.parse=(v,u)=>{let n=$.innerType._zod.run(v,u);if(n instanceof Promise)return n.then(U4);return U4(n)}});function U4(c){return c.value=Object.freeze(c.value),c}var qu=O("$ZodTemplateLiteral",(c,$)=>{A.init(c,$);let v=[];for(let u of $.parts)if(u instanceof A){if(!u._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...u._zod.traits].shift()}`);let n=u._zod.pattern instanceof RegExp?u._zod.pattern.source:u._zod.pattern;if(!n)throw Error(`Invalid template literal part: ${u._zod.traits}`);let b=n.startsWith("^")?1:0,r=n.endsWith("$")?n.length-1:n.length;v.push(n.slice(b,r))}else if(u===null||Z$.has(typeof u))v.push(C(`${u}`));else throw Error(`Invalid template literal part: ${u}`);c._zod.pattern=new RegExp(`^${v.join("")}$`),c._zod.parse=(u,n)=>{if(typeof u.value!=="string")return u.issues.push({input:u.value,inst:c,expected:"template_literal",code:"invalid_type"}),u;if(c._zod.pattern.lastIndex=0,!c._zod.pattern.test(u.value))return u.issues.push({input:u.value,inst:c,code:"invalid_format",format:$.format??"template_literal",pattern:c._zod.pattern.source}),u;return u}}),Cu=O("$ZodPromise",(c,$)=>{A.init(c,$),c._zod.parse=(v,u)=>{return Promise.resolve(v.value).then((n)=>$.innerType._zod.run({value:n,issues:[]},u))}}),fu=O("$ZodLazy",(c,$)=>{A.init(c,$),G(c._zod,"innerType",()=>$.getter()),G(c._zod,"pattern",()=>c._zod.innerType._zod.pattern),G(c._zod,"propValues",()=>c._zod.innerType._zod.propValues),G(c._zod,"optin",()=>c._zod.innerType._zod.optin??void 0),G(c._zod,"optout",()=>c._zod.innerType._zod.optout??void 0),c._zod.parse=(v,u)=>{return c._zod.innerType._zod.run(v,u)}}),yu=O("$ZodCustom",(c,$)=>{Y.init(c,$),A.init(c,$),c._zod.parse=(v,u)=>{return v},c._zod.check=(v)=>{let u=v.value,n=$.fn(u);if(n instanceof Promise)return n.then((b)=>i4(b,v,u,c));i4(n,v,u,c);return}});function i4(c,$,v,u){if(!c){let n={code:"custom",input:v,inst:u,path:[...u._zod.def.path??[]],continue:!u._zod.def.abort};if(u._zod.def.params)n.params=u._zod.def.params;$.issues.push(Gc(n))}}var bn={};nc(bn,{zhTW:()=>Yb,zhCN:()=>Qb,yo:()=>Kb,vi:()=>Fb,ur:()=>Bb,ua:()=>Wb,tr:()=>Lb,th:()=>Gb,ta:()=>Xb,sv:()=>Hb,sl:()=>Jb,ru:()=>zb,pt:()=>xb,ps:()=>hb,pl:()=>Ab,ota:()=>Pb,no:()=>kb,nl:()=>Db,ms:()=>Sb,mk:()=>jb,ko:()=>Nb,kh:()=>ib,ja:()=>Ub,it:()=>wb,is:()=>_b,id:()=>tb,hu:()=>Ib,he:()=>Ob,frCA:()=>gb,fr:()=>rb,fi:()=>bb,fa:()=>ub,es:()=>vb,eo:()=>$b,en:()=>un,de:()=>nb,da:()=>cb,cs:()=>su,ca:()=>au,be:()=>eu,az:()=>pu,ar:()=>du});var MO=()=>{let c={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"};return(n)=>{switch(n.code){case"invalid_type":return`مدخلات غير مقبولة: يفترض إدخال ${n.expected}، ولكن تم إدخال ${v(n.input)}`;case"invalid_value":if(n.values.length===1)return`مدخلات غير مقبولة: يفترض إدخال ${S(n.values[0])}`;return`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${w(n.values,"|")}`;case"too_big":{let b=n.inclusive?"<=":"<",r=$(n.origin);if(r)return` أكبر من اللازم: يفترض أن تكون ${n.origin??"القيمة"} ${b} ${n.maximum.toString()} ${r.unit??"عنصر"}`;return`أكبر من اللازم: يفترض أن تكون ${n.origin??"القيمة"} ${b} ${n.maximum.toString()}`}case"too_small":{let b=n.inclusive?">=":">",r=$(n.origin);if(r)return`أصغر من اللازم: يفترض لـ ${n.origin} أن يكون ${b} ${n.minimum.toString()} ${r.unit}`;return`أصغر من اللازم: يفترض لـ ${n.origin} أن يكون ${b} ${n.minimum.toString()}`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`نَص غير مقبول: يجب أن يبدأ بـ "${n.prefix}"`;if(b.format==="ends_with")return`نَص غير مقبول: يجب أن ينتهي بـ "${b.suffix}"`;if(b.format==="includes")return`نَص غير مقبول: يجب أن يتضمَّن "${b.includes}"`;if(b.format==="regex")return`نَص غير مقبول: يجب أن يطابق النمط ${b.pattern}`;return`${u[b.format]??n.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${n.divisor}`;case"unrecognized_keys":return`معرف${n.keys.length>1?"ات":""} غريب${n.keys.length>1?"ة":""}: ${w(n.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${n.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${n.origin}`;default:return"مدخل غير مقبول"}}};function du(){return{localeError:MO()}}var TO=()=>{let c={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return(n)=>{switch(n.code){case"invalid_type":return`Yanlış dəyər: gözlənilən ${n.expected}, daxil olan ${v(n.input)}`;case"invalid_value":if(n.values.length===1)return`Yanlış dəyər: gözlənilən ${S(n.values[0])}`;return`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${w(n.values,"|")}`;case"too_big":{let b=n.inclusive?"<=":"<",r=$(n.origin);if(r)return`Çox böyük: gözlənilən ${n.origin??"dəyər"} ${b}${n.maximum.toString()} ${r.unit??"element"}`;return`Çox böyük: gözlənilən ${n.origin??"dəyər"} ${b}${n.maximum.toString()}`}case"too_small":{let b=n.inclusive?">=":">",r=$(n.origin);if(r)return`Çox kiçik: gözlənilən ${n.origin} ${b}${n.minimum.toString()} ${r.unit}`;return`Çox kiçik: gözlənilən ${n.origin} ${b}${n.minimum.toString()}`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`Yanlış mətn: "${b.prefix}" ilə başlamalıdır`;if(b.format==="ends_with")return`Yanlış mətn: "${b.suffix}" ilə bitməlidir`;if(b.format==="includes")return`Yanlış mətn: "${b.includes}" daxil olmalıdır`;if(b.format==="regex")return`Yanlış mətn: ${b.pattern} şablonuna uyğun olmalıdır`;return`Yanlış ${u[b.format]??n.format}`}case"not_multiple_of":return`Yanlış ədəd: ${n.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${n.keys.length>1?"lar":""}: ${w(n.keys,", ")}`;case"invalid_key":return`${n.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${n.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function pu(){return{localeError:TO()}}function D4(c,$,v,u){let n=Math.abs(c),b=n%10,r=n%100;if(r>=11&&r<=19)return u;if(b===1)return $;if(b>=2&&b<=4)return v;return u}var EO=()=>{let c={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"NaN":"лік";case"object":{if(Array.isArray(n))return"масіў";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"};return(n)=>{switch(n.code){case"invalid_type":return`Няправільны ўвод: чакаўся ${n.expected}, атрымана ${v(n.input)}`;case"invalid_value":if(n.values.length===1)return`Няправільны ўвод: чакалася ${S(n.values[0])}`;return`Няправільны варыянт: чакаўся адзін з ${w(n.values,"|")}`;case"too_big":{let b=n.inclusive?"<=":"<",r=$(n.origin);if(r){let g=Number(n.maximum),I=D4(g,r.unit.one,r.unit.few,r.unit.many);return`Занадта вялікі: чакалася, што ${n.origin??"значэнне"} павінна ${r.verb} ${b}${n.maximum.toString()} ${I}`}return`Занадта вялікі: чакалася, што ${n.origin??"значэнне"} павінна быць ${b}${n.maximum.toString()}`}case"too_small":{let b=n.inclusive?">=":">",r=$(n.origin);if(r){let g=Number(n.minimum),I=D4(g,r.unit.one,r.unit.few,r.unit.many);return`Занадта малы: чакалася, што ${n.origin} павінна ${r.verb} ${b}${n.minimum.toString()} ${I}`}return`Занадта малы: чакалася, што ${n.origin} павінна быць ${b}${n.minimum.toString()}`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`Няправільны радок: павінен пачынацца з "${b.prefix}"`;if(b.format==="ends_with")return`Няправільны радок: павінен заканчвацца на "${b.suffix}"`;if(b.format==="includes")return`Няправільны радок: павінен змяшчаць "${b.includes}"`;if(b.format==="regex")return`Няправільны радок: павінен адпавядаць шаблону ${b.pattern}`;return`Няправільны ${u[b.format]??n.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${n.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${n.keys.length>1?"ключы":"ключ"}: ${w(n.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${n.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${n.origin}`;default:return"Няправільны ўвод"}}};function eu(){return{localeError:EO()}}var lO=()=>{let c={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"entrada",email:"adreça electrònica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return(n)=>{switch(n.code){case"invalid_type":return`Tipus invàlid: s'esperava ${n.expected}, s'ha rebut ${v(n.input)}`;case"invalid_value":if(n.values.length===1)return`Valor invàlid: s'esperava ${S(n.values[0])}`;return`Opció invàlida: s'esperava una de ${w(n.values," o ")}`;case"too_big":{let b=n.inclusive?"com a màxim":"menys de",r=$(n.origin);if(r)return`Massa gran: s'esperava que ${n.origin??"el valor"} contingués ${b} ${n.maximum.toString()} ${r.unit??"elements"}`;return`Massa gran: s'esperava que ${n.origin??"el valor"} fos ${b} ${n.maximum.toString()}`}case"too_small":{let b=n.inclusive?"com a mínim":"més de",r=$(n.origin);if(r)return`Massa petit: s'esperava que ${n.origin} contingués ${b} ${n.minimum.toString()} ${r.unit}`;return`Massa petit: s'esperava que ${n.origin} fos ${b} ${n.minimum.toString()}`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`Format invàlid: ha de començar amb "${b.prefix}"`;if(b.format==="ends_with")return`Format invàlid: ha d'acabar amb "${b.suffix}"`;if(b.format==="includes")return`Format invàlid: ha d'incloure "${b.includes}"`;if(b.format==="regex")return`Format invàlid: ha de coincidir amb el patró ${b.pattern}`;return`Format invàlid per a ${u[b.format]??n.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${n.divisor}`;case"unrecognized_keys":return`Clau${n.keys.length>1?"s":""} no reconeguda${n.keys.length>1?"s":""}: ${w(n.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${n.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${n.origin}`;default:return"Entrada invàlida"}}};function au(){return{localeError:lO()}}var oO=()=>{let c={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"NaN":"číslo";case"string":return"řetězec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(n))return"pole";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"regulární výraz",email:"e-mailová adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"};return(n)=>{switch(n.code){case"invalid_type":return`Neplatný vstup: očekáváno ${n.expected}, obdrženo ${v(n.input)}`;case"invalid_value":if(n.values.length===1)return`Neplatný vstup: očekáváno ${S(n.values[0])}`;return`Neplatná možnost: očekávána jedna z hodnot ${w(n.values,"|")}`;case"too_big":{let b=n.inclusive?"<=":"<",r=$(n.origin);if(r)return`Hodnota je příliš velká: ${n.origin??"hodnota"} musí mít ${b}${n.maximum.toString()} ${r.unit??"prvků"}`;return`Hodnota je příliš velká: ${n.origin??"hodnota"} musí být ${b}${n.maximum.toString()}`}case"too_small":{let b=n.inclusive?">=":">",r=$(n.origin);if(r)return`Hodnota je příliš malá: ${n.origin??"hodnota"} musí mít ${b}${n.minimum.toString()} ${r.unit??"prvků"}`;return`Hodnota je příliš malá: ${n.origin??"hodnota"} musí být ${b}${n.minimum.toString()}`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`Neplatný řetězec: musí začínat na "${b.prefix}"`;if(b.format==="ends_with")return`Neplatný řetězec: musí končit na "${b.suffix}"`;if(b.format==="includes")return`Neplatný řetězec: musí obsahovat "${b.includes}"`;if(b.format==="regex")return`Neplatný řetězec: musí odpovídat vzoru ${b.pattern}`;return`Neplatný formát ${u[b.format]??n.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${n.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${w(n.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${n.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${n.origin}`;default:return"Neplatný vstup"}}};function su(){return{localeError:oO()}}var ZO=()=>{let c={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}},$={string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"sæt",file:"fil"};function v(r){return c[r]??null}function u(r){return $[r]??r}let n=(r)=>{let g=typeof r;switch(g){case"number":return Number.isNaN(r)?"NaN":"tal";case"object":{if(Array.isArray(r))return"liste";if(r===null)return"null";if(Object.getPrototypeOf(r)!==Object.prototype&&r.constructor)return r.constructor.name;return"objekt"}}return g},b={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslæt",date:"ISO-dato",time:"ISO-klokkeslæt",duration:"ISO-varighed",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return(r)=>{switch(r.code){case"invalid_type":return`Ugyldigt input: forventede ${u(r.expected)}, fik ${u(n(r.input))}`;case"invalid_value":if(r.values.length===1)return`Ugyldig værdi: forventede ${S(r.values[0])}`;return`Ugyldigt valg: forventede en af følgende ${w(r.values,"|")}`;case"too_big":{let g=r.inclusive?"<=":"<",I=v(r.origin),_=u(r.origin);if(I)return`For stor: forventede ${_??"value"} ${I.verb} ${g} ${r.maximum.toString()} ${I.unit??"elementer"}`;return`For stor: forventede ${_??"value"} havde ${g} ${r.maximum.toString()}`}case"too_small":{let g=r.inclusive?">=":">",I=v(r.origin),_=u(r.origin);if(I)return`For lille: forventede ${_} ${I.verb} ${g} ${r.minimum.toString()} ${I.unit}`;return`For lille: forventede ${_} havde ${g} ${r.minimum.toString()}`}case"invalid_format":{let g=r;if(g.format==="starts_with")return`Ugyldig streng: skal starte med "${g.prefix}"`;if(g.format==="ends_with")return`Ugyldig streng: skal ende med "${g.suffix}"`;if(g.format==="includes")return`Ugyldig streng: skal indeholde "${g.includes}"`;if(g.format==="regex")return`Ugyldig streng: skal matche mønsteret ${g.pattern}`;return`Ugyldig ${b[g.format]??r.format}`}case"not_multiple_of":return`Ugyldigt tal: skal være deleligt med ${r.divisor}`;case"unrecognized_keys":return`${r.keys.length>1?"Ukendte nøgler":"Ukendt nøgle"}: ${w(r.keys,", ")}`;case"invalid_key":return`Ugyldig nøgle i ${r.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig værdi i ${r.origin}`;default:return"Ugyldigt input"}}};function cb(){return{localeError:ZO()}}var qO=()=>{let c={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"NaN":"Zahl";case"object":{if(Array.isArray(n))return"Array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return(n)=>{switch(n.code){case"invalid_type":return`Ungültige Eingabe: erwartet ${n.expected}, erhalten ${v(n.input)}`;case"invalid_value":if(n.values.length===1)return`Ungültige Eingabe: erwartet ${S(n.values[0])}`;return`Ungültige Option: erwartet eine von ${w(n.values,"|")}`;case"too_big":{let b=n.inclusive?"<=":"<",r=$(n.origin);if(r)return`Zu groß: erwartet, dass ${n.origin??"Wert"} ${b}${n.maximum.toString()} ${r.unit??"Elemente"} hat`;return`Zu groß: erwartet, dass ${n.origin??"Wert"} ${b}${n.maximum.toString()} ist`}case"too_small":{let b=n.inclusive?">=":">",r=$(n.origin);if(r)return`Zu klein: erwartet, dass ${n.origin} ${b}${n.minimum.toString()} ${r.unit} hat`;return`Zu klein: erwartet, dass ${n.origin} ${b}${n.minimum.toString()} ist`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`Ungültiger String: muss mit "${b.prefix}" beginnen`;if(b.format==="ends_with")return`Ungültiger String: muss mit "${b.suffix}" enden`;if(b.format==="includes")return`Ungültiger String: muss "${b.includes}" enthalten`;if(b.format==="regex")return`Ungültiger String: muss dem Muster ${b.pattern} entsprechen`;return`Ungültig: ${u[b.format]??n.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${n.divisor} sein`;case"unrecognized_keys":return`${n.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${w(n.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${n.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${n.origin}`;default:return"Ungültige Eingabe"}}};function nb(){return{localeError:qO()}}var CO=(c)=>{let $=typeof c;switch($){case"number":return Number.isNaN(c)?"NaN":"number";case"object":{if(Array.isArray(c))return"array";if(c===null)return"null";if(Object.getPrototypeOf(c)!==Object.prototype&&c.constructor)return c.constructor.name}}return $},fO=()=>{let c={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function $(u){return c[u]??null}let v={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return(u)=>{switch(u.code){case"invalid_type":return`Invalid input: expected ${u.expected}, received ${CO(u.input)}`;case"invalid_value":if(u.values.length===1)return`Invalid input: expected ${S(u.values[0])}`;return`Invalid option: expected one of ${w(u.values,"|")}`;case"too_big":{let n=u.inclusive?"<=":"<",b=$(u.origin);if(b)return`Too big: expected ${u.origin??"value"} to have ${n}${u.maximum.toString()} ${b.unit??"elements"}`;return`Too big: expected ${u.origin??"value"} to be ${n}${u.maximum.toString()}`}case"too_small":{let n=u.inclusive?">=":">",b=$(u.origin);if(b)return`Too small: expected ${u.origin} to have ${n}${u.minimum.toString()} ${b.unit}`;return`Too small: expected ${u.origin} to be ${n}${u.minimum.toString()}`}case"invalid_format":{let n=u;if(n.format==="starts_with")return`Invalid string: must start with "${n.prefix}"`;if(n.format==="ends_with")return`Invalid string: must end with "${n.suffix}"`;if(n.format==="includes")return`Invalid string: must include "${n.includes}"`;if(n.format==="regex")return`Invalid string: must match pattern ${n.pattern}`;return`Invalid ${v[n.format]??u.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${u.divisor}`;case"unrecognized_keys":return`Unrecognized key${u.keys.length>1?"s":""}: ${w(u.keys,", ")}`;case"invalid_key":return`Invalid key in ${u.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${u.origin}`;default:return"Invalid input"}}};function un(){return{localeError:fO()}}var yO=(c)=>{let $=typeof c;switch($){case"number":return Number.isNaN(c)?"NaN":"nombro";case"object":{if(Array.isArray(c))return"tabelo";if(c===null)return"senvalora";if(Object.getPrototypeOf(c)!==Object.prototype&&c.constructor)return c.constructor.name}}return $},dO=()=>{let c={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function $(u){return c[u]??null}let v={regex:"enigo",email:"retadreso",url:"URL",emoji:"emoĝio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-daŭro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"};return(u)=>{switch(u.code){case"invalid_type":return`Nevalida enigo: atendiĝis ${u.expected}, riceviĝis ${yO(u.input)}`;case"invalid_value":if(u.values.length===1)return`Nevalida enigo: atendiĝis ${S(u.values[0])}`;return`Nevalida opcio: atendiĝis unu el ${w(u.values,"|")}`;case"too_big":{let n=u.inclusive?"<=":"<",b=$(u.origin);if(b)return`Tro granda: atendiĝis ke ${u.origin??"valoro"} havu ${n}${u.maximum.toString()} ${b.unit??"elementojn"}`;return`Tro granda: atendiĝis ke ${u.origin??"valoro"} havu ${n}${u.maximum.toString()}`}case"too_small":{let n=u.inclusive?">=":">",b=$(u.origin);if(b)return`Tro malgranda: atendiĝis ke ${u.origin} havu ${n}${u.minimum.toString()} ${b.unit}`;return`Tro malgranda: atendiĝis ke ${u.origin} estu ${n}${u.minimum.toString()}`}case"invalid_format":{let n=u;if(n.format==="starts_with")return`Nevalida karaktraro: devas komenciĝi per "${n.prefix}"`;if(n.format==="ends_with")return`Nevalida karaktraro: devas finiĝi per "${n.suffix}"`;if(n.format==="includes")return`Nevalida karaktraro: devas inkluzivi "${n.includes}"`;if(n.format==="regex")return`Nevalida karaktraro: devas kongrui kun la modelo ${n.pattern}`;return`Nevalida ${v[n.format]??u.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${u.divisor}`;case"unrecognized_keys":return`Nekonata${u.keys.length>1?"j":""} ŝlosilo${u.keys.length>1?"j":""}: ${w(u.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${u.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${u.origin}`;default:return"Nevalida enigo"}}};function $b(){return{localeError:dO()}}var pO=()=>{let c={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"NaN":"número";case"object":{if(Array.isArray(n))return"arreglo";if(n===null)return"nulo";if(Object.getPrototypeOf(n)!==Object.prototype)return n.constructor.name}}return b},u={regex:"entrada",email:"dirección de correo electrónico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return(n)=>{switch(n.code){case"invalid_type":return`Entrada inválida: se esperaba ${n.expected}, recibido ${v(n.input)}`;case"invalid_value":if(n.values.length===1)return`Entrada inválida: se esperaba ${S(n.values[0])}`;return`Opción inválida: se esperaba una de ${w(n.values,"|")}`;case"too_big":{let b=n.inclusive?"<=":"<",r=$(n.origin);if(r)return`Demasiado grande: se esperaba que ${n.origin??"valor"} tuviera ${b}${n.maximum.toString()} ${r.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${n.origin??"valor"} fuera ${b}${n.maximum.toString()}`}case"too_small":{let b=n.inclusive?">=":">",r=$(n.origin);if(r)return`Demasiado pequeño: se esperaba que ${n.origin} tuviera ${b}${n.minimum.toString()} ${r.unit}`;return`Demasiado pequeño: se esperaba que ${n.origin} fuera ${b}${n.minimum.toString()}`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`Cadena inválida: debe comenzar con "${b.prefix}"`;if(b.format==="ends_with")return`Cadena inválida: debe terminar en "${b.suffix}"`;if(b.format==="includes")return`Cadena inválida: debe incluir "${b.includes}"`;if(b.format==="regex")return`Cadena inválida: debe coincidir con el patrón ${b.pattern}`;return`Inválido ${u[b.format]??n.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${n.divisor}`;case"unrecognized_keys":return`Llave${n.keys.length>1?"s":""} desconocida${n.keys.length>1?"s":""}: ${w(n.keys,", ")}`;case"invalid_key":return`Llave inválida en ${n.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${n.origin}`;default:return"Entrada inválida"}}};function vb(){return{localeError:pO()}}var eO=()=>{let c={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"NaN":"عدد";case"object":{if(Array.isArray(n))return"آرایه";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"};return(n)=>{switch(n.code){case"invalid_type":return`ورودی نامعتبر: میبایست ${n.expected} میبود، ${v(n.input)} دریافت شد`;case"invalid_value":if(n.values.length===1)return`ورودی نامعتبر: میبایست ${S(n.values[0])} میبود`;return`گزینه نامعتبر: میبایست یکی از ${w(n.values,"|")} میبود`;case"too_big":{let b=n.inclusive?"<=":"<",r=$(n.origin);if(r)return`خیلی بزرگ: ${n.origin??"مقدار"} باید ${b}${n.maximum.toString()} ${r.unit??"عنصر"} باشد`;return`خیلی بزرگ: ${n.origin??"مقدار"} باید ${b}${n.maximum.toString()} باشد`}case"too_small":{let b=n.inclusive?">=":">",r=$(n.origin);if(r)return`خیلی کوچک: ${n.origin} باید ${b}${n.minimum.toString()} ${r.unit} باشد`;return`خیلی کوچک: ${n.origin} باید ${b}${n.minimum.toString()} باشد`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`رشته نامعتبر: باید با "${b.prefix}" شروع شود`;if(b.format==="ends_with")return`رشته نامعتبر: باید با "${b.suffix}" تمام شود`;if(b.format==="includes")return`رشته نامعتبر: باید شامل "${b.includes}" باشد`;if(b.format==="regex")return`رشته نامعتبر: باید با الگوی ${b.pattern} مطابقت داشته باشد`;return`${u[b.format]??n.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${n.divisor} باشد`;case"unrecognized_keys":return`کلید${n.keys.length>1?"های":""} ناشناس: ${w(n.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${n.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${n.origin}`;default:return"ورودی نامعتبر"}}};function ub(){return{localeError:eO()}}var aO=()=>{let c={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return(n)=>{switch(n.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${n.expected}, oli ${v(n.input)}`;case"invalid_value":if(n.values.length===1)return`Virheellinen syöte: täytyy olla ${S(n.values[0])}`;return`Virheellinen valinta: täytyy olla yksi seuraavista: ${w(n.values,"|")}`;case"too_big":{let b=n.inclusive?"<=":"<",r=$(n.origin);if(r)return`Liian suuri: ${r.subject} täytyy olla ${b}${n.maximum.toString()} ${r.unit}`.trim();return`Liian suuri: arvon täytyy olla ${b}${n.maximum.toString()}`}case"too_small":{let b=n.inclusive?">=":">",r=$(n.origin);if(r)return`Liian pieni: ${r.subject} täytyy olla ${b}${n.minimum.toString()} ${r.unit}`.trim();return`Liian pieni: arvon täytyy olla ${b}${n.minimum.toString()}`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`Virheellinen syöte: täytyy alkaa "${b.prefix}"`;if(b.format==="ends_with")return`Virheellinen syöte: täytyy loppua "${b.suffix}"`;if(b.format==="includes")return`Virheellinen syöte: täytyy sisältää "${b.includes}"`;if(b.format==="regex")return`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${b.pattern}`;return`Virheellinen ${u[b.format]??n.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${n.divisor} monikerta`;case"unrecognized_keys":return`${n.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${w(n.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}}};function bb(){return{localeError:aO()}}var sO=()=>{let c={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"NaN":"nombre";case"object":{if(Array.isArray(n))return"tableau";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"entrée",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return(n)=>{switch(n.code){case"invalid_type":return`Entrée invalide : ${n.expected} attendu, ${v(n.input)} reçu`;case"invalid_value":if(n.values.length===1)return`Entrée invalide : ${S(n.values[0])} attendu`;return`Option invalide : une valeur parmi ${w(n.values,"|")} attendue`;case"too_big":{let b=n.inclusive?"<=":"<",r=$(n.origin);if(r)return`Trop grand : ${n.origin??"valeur"} doit ${r.verb} ${b}${n.maximum.toString()} ${r.unit??"élément(s)"}`;return`Trop grand : ${n.origin??"valeur"} doit être ${b}${n.maximum.toString()}`}case"too_small":{let b=n.inclusive?">=":">",r=$(n.origin);if(r)return`Trop petit : ${n.origin} doit ${r.verb} ${b}${n.minimum.toString()} ${r.unit}`;return`Trop petit : ${n.origin} doit être ${b}${n.minimum.toString()}`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`Chaîne invalide : doit commencer par "${b.prefix}"`;if(b.format==="ends_with")return`Chaîne invalide : doit se terminer par "${b.suffix}"`;if(b.format==="includes")return`Chaîne invalide : doit inclure "${b.includes}"`;if(b.format==="regex")return`Chaîne invalide : doit correspondre au modèle ${b.pattern}`;return`${u[b.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${n.divisor}`;case"unrecognized_keys":return`Clé${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${w(n.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${n.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entrée invalide"}}};function rb(){return{localeError:sO()}}var cI=()=>{let c={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"entrée",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return(n)=>{switch(n.code){case"invalid_type":return`Entrée invalide : attendu ${n.expected}, reçu ${v(n.input)}`;case"invalid_value":if(n.values.length===1)return`Entrée invalide : attendu ${S(n.values[0])}`;return`Option invalide : attendu l'une des valeurs suivantes ${w(n.values,"|")}`;case"too_big":{let b=n.inclusive?"≤":"<",r=$(n.origin);if(r)return`Trop grand : attendu que ${n.origin??"la valeur"} ait ${b}${n.maximum.toString()} ${r.unit}`;return`Trop grand : attendu que ${n.origin??"la valeur"} soit ${b}${n.maximum.toString()}`}case"too_small":{let b=n.inclusive?"≥":">",r=$(n.origin);if(r)return`Trop petit : attendu que ${n.origin} ait ${b}${n.minimum.toString()} ${r.unit}`;return`Trop petit : attendu que ${n.origin} soit ${b}${n.minimum.toString()}`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`Chaîne invalide : doit commencer par "${b.prefix}"`;if(b.format==="ends_with")return`Chaîne invalide : doit se terminer par "${b.suffix}"`;if(b.format==="includes")return`Chaîne invalide : doit inclure "${b.includes}"`;if(b.format==="regex")return`Chaîne invalide : doit correspondre au motif ${b.pattern}`;return`${u[b.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${n.divisor}`;case"unrecognized_keys":return`Clé${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${w(n.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${n.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entrée invalide"}}};function gb(){return{localeError:cI()}}var nI=()=>{let c={string:{unit:"אותיות",verb:"לכלול"},file:{unit:"בייטים",verb:"לכלול"},array:{unit:"פריטים",verb:"לכלול"},set:{unit:"פריטים",verb:"לכלול"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"קלט",email:"כתובת אימייל",url:"כתובת רשת",emoji:"אימוג'י",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"תאריך וזמן ISO",date:"תאריך ISO",time:"זמן ISO",duration:"משך זמן ISO",ipv4:"כתובת IPv4",ipv6:"כתובת IPv6",cidrv4:"טווח IPv4",cidrv6:"טווח IPv6",base64:"מחרוזת בבסיס 64",base64url:"מחרוזת בבסיס 64 לכתובות רשת",json_string:"מחרוזת JSON",e164:"מספר E.164",jwt:"JWT",template_literal:"קלט"};return(n)=>{switch(n.code){case"invalid_type":return`קלט לא תקין: צריך ${n.expected}, התקבל ${v(n.input)}`;case"invalid_value":if(n.values.length===1)return`קלט לא תקין: צריך ${S(n.values[0])}`;return`קלט לא תקין: צריך אחת מהאפשרויות ${w(n.values,"|")}`;case"too_big":{let b=n.inclusive?"<=":"<",r=$(n.origin);if(r)return`גדול מדי: ${n.origin??"value"} צריך להיות ${b}${n.maximum.toString()} ${r.unit??"elements"}`;return`גדול מדי: ${n.origin??"value"} צריך להיות ${b}${n.maximum.toString()}`}case"too_small":{let b=n.inclusive?">=":">",r=$(n.origin);if(r)return`קטן מדי: ${n.origin} צריך להיות ${b}${n.minimum.toString()} ${r.unit}`;return`קטן מדי: ${n.origin} צריך להיות ${b}${n.minimum.toString()}`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`מחרוזת לא תקינה: חייבת להתחיל ב"${b.prefix}"`;if(b.format==="ends_with")return`מחרוזת לא תקינה: חייבת להסתיים ב "${b.suffix}"`;if(b.format==="includes")return`מחרוזת לא תקינה: חייבת לכלול "${b.includes}"`;if(b.format==="regex")return`מחרוזת לא תקינה: חייבת להתאים לתבנית ${b.pattern}`;return`${u[b.format]??n.format} לא תקין`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${n.divisor}`;case"unrecognized_keys":return`מפתח${n.keys.length>1?"ות":""} לא מזוה${n.keys.length>1?"ים":"ה"}: ${w(n.keys,", ")}`;case"invalid_key":return`מפתח לא תקין ב${n.origin}`;case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${n.origin}`;default:return"קלט לא תקין"}}};function Ob(){return{localeError:nI()}}var $I=()=>{let c={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"NaN":"szám";case"object":{if(Array.isArray(n))return"tömb";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"bemenet",email:"email cím",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"};return(n)=>{switch(n.code){case"invalid_type":return`Érvénytelen bemenet: a várt érték ${n.expected}, a kapott érték ${v(n.input)}`;case"invalid_value":if(n.values.length===1)return`Érvénytelen bemenet: a várt érték ${S(n.values[0])}`;return`Érvénytelen opció: valamelyik érték várt ${w(n.values,"|")}`;case"too_big":{let b=n.inclusive?"<=":"<",r=$(n.origin);if(r)return`Túl nagy: ${n.origin??"érték"} mérete túl nagy ${b}${n.maximum.toString()} ${r.unit??"elem"}`;return`Túl nagy: a bemeneti érték ${n.origin??"érték"} túl nagy: ${b}${n.maximum.toString()}`}case"too_small":{let b=n.inclusive?">=":">",r=$(n.origin);if(r)return`Túl kicsi: a bemeneti érték ${n.origin} mérete túl kicsi ${b}${n.minimum.toString()} ${r.unit}`;return`Túl kicsi: a bemeneti érték ${n.origin} túl kicsi ${b}${n.minimum.toString()}`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`Érvénytelen string: "${b.prefix}" értékkel kell kezdődnie`;if(b.format==="ends_with")return`Érvénytelen string: "${b.suffix}" értékkel kell végződnie`;if(b.format==="includes")return`Érvénytelen string: "${b.includes}" értéket kell tartalmaznia`;if(b.format==="regex")return`Érvénytelen string: ${b.pattern} mintának kell megfelelnie`;return`Érvénytelen ${u[b.format]??n.format}`}case"not_multiple_of":return`Érvénytelen szám: ${n.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${n.keys.length>1?"s":""}: ${w(n.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${n.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${n.origin}`;default:return"Érvénytelen bemenet"}}};function Ib(){return{localeError:$I()}}var vI=()=>{let c={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return(n)=>{switch(n.code){case"invalid_type":return`Input tidak valid: diharapkan ${n.expected}, diterima ${v(n.input)}`;case"invalid_value":if(n.values.length===1)return`Input tidak valid: diharapkan ${S(n.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${w(n.values,"|")}`;case"too_big":{let b=n.inclusive?"<=":"<",r=$(n.origin);if(r)return`Terlalu besar: diharapkan ${n.origin??"value"} memiliki ${b}${n.maximum.toString()} ${r.unit??"elemen"}`;return`Terlalu besar: diharapkan ${n.origin??"value"} menjadi ${b}${n.maximum.toString()}`}case"too_small":{let b=n.inclusive?">=":">",r=$(n.origin);if(r)return`Terlalu kecil: diharapkan ${n.origin} memiliki ${b}${n.minimum.toString()} ${r.unit}`;return`Terlalu kecil: diharapkan ${n.origin} menjadi ${b}${n.minimum.toString()}`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`String tidak valid: harus dimulai dengan "${b.prefix}"`;if(b.format==="ends_with")return`String tidak valid: harus berakhir dengan "${b.suffix}"`;if(b.format==="includes")return`String tidak valid: harus menyertakan "${b.includes}"`;if(b.format==="regex")return`String tidak valid: harus sesuai pola ${b.pattern}`;return`${u[b.format]??n.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${n.keys.length>1?"s":""}: ${w(n.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${n.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${n.origin}`;default:return"Input tidak valid"}}};function tb(){return{localeError:vI()}}var uI=(c)=>{let $=typeof c;switch($){case"number":return Number.isNaN(c)?"NaN":"númer";case"object":{if(Array.isArray(c))return"fylki";if(c===null)return"null";if(Object.getPrototypeOf(c)!==Object.prototype&&c.constructor)return c.constructor.name}}return $},bI=()=>{let c={string:{unit:"stafi",verb:"að hafa"},file:{unit:"bæti",verb:"að hafa"},array:{unit:"hluti",verb:"að hafa"},set:{unit:"hluti",verb:"að hafa"}};function $(u){return c[u]??null}let v={regex:"gildi",email:"netfang",url:"vefslóð",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og tími",date:"ISO dagsetning",time:"ISO tími",duration:"ISO tímalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 tölugildi",jwt:"JWT",template_literal:"gildi"};return(u)=>{switch(u.code){case"invalid_type":return`Rangt gildi: Þú slóst inn ${uI(u.input)} þar sem á að vera ${u.expected}`;case"invalid_value":if(u.values.length===1)return`Rangt gildi: gert ráð fyrir ${S(u.values[0])}`;return`Ógilt val: má vera eitt af eftirfarandi ${w(u.values,"|")}`;case"too_big":{let n=u.inclusive?"<=":"<",b=$(u.origin);if(b)return`Of stórt: gert er ráð fyrir að ${u.origin??"gildi"} hafi ${n}${u.maximum.toString()} ${b.unit??"hluti"}`;return`Of stórt: gert er ráð fyrir að ${u.origin??"gildi"} sé ${n}${u.maximum.toString()}`}case"too_small":{let n=u.inclusive?">=":">",b=$(u.origin);if(b)return`Of lítið: gert er ráð fyrir að ${u.origin} hafi ${n}${u.minimum.toString()} ${b.unit}`;return`Of lítið: gert er ráð fyrir að ${u.origin} sé ${n}${u.minimum.toString()}`}case"invalid_format":{let n=u;if(n.format==="starts_with")return`Ógildur strengur: verður að byrja á "${n.prefix}"`;if(n.format==="ends_with")return`Ógildur strengur: verður að enda á "${n.suffix}"`;if(n.format==="includes")return`Ógildur strengur: verður að innihalda "${n.includes}"`;if(n.format==="regex")return`Ógildur strengur: verður að fylgja mynstri ${n.pattern}`;return`Rangt ${v[n.format]??u.format}`}case"not_multiple_of":return`Röng tala: verður að vera margfeldi af ${u.divisor}`;case"unrecognized_keys":return`Óþekkt ${u.keys.length>1?"ir lyklar":"ur lykill"}: ${w(u.keys,", ")}`;case"invalid_key":return`Rangur lykill í ${u.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi í ${u.origin}`;default:return"Rangt gildi"}}};function _b(){return{localeError:bI()}}var rI=()=>{let c={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"NaN":"numero";case"object":{if(Array.isArray(n))return"vettore";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return(n)=>{switch(n.code){case"invalid_type":return`Input non valido: atteso ${n.expected}, ricevuto ${v(n.input)}`;case"invalid_value":if(n.values.length===1)return`Input non valido: atteso ${S(n.values[0])}`;return`Opzione non valida: atteso uno tra ${w(n.values,"|")}`;case"too_big":{let b=n.inclusive?"<=":"<",r=$(n.origin);if(r)return`Troppo grande: ${n.origin??"valore"} deve avere ${b}${n.maximum.toString()} ${r.unit??"elementi"}`;return`Troppo grande: ${n.origin??"valore"} deve essere ${b}${n.maximum.toString()}`}case"too_small":{let b=n.inclusive?">=":">",r=$(n.origin);if(r)return`Troppo piccolo: ${n.origin} deve avere ${b}${n.minimum.toString()} ${r.unit}`;return`Troppo piccolo: ${n.origin} deve essere ${b}${n.minimum.toString()}`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`Stringa non valida: deve iniziare con "${b.prefix}"`;if(b.format==="ends_with")return`Stringa non valida: deve terminare con "${b.suffix}"`;if(b.format==="includes")return`Stringa non valida: deve includere "${b.includes}"`;if(b.format==="regex")return`Stringa non valida: deve corrispondere al pattern ${b.pattern}`;return`Invalid ${u[b.format]??n.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${n.divisor}`;case"unrecognized_keys":return`Chiav${n.keys.length>1?"i":"e"} non riconosciut${n.keys.length>1?"e":"a"}: ${w(n.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${n.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${n.origin}`;default:return"Input non valido"}}};function wb(){return{localeError:rI()}}var gI=()=>{let c={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"NaN":"数値";case"object":{if(Array.isArray(n))return"配列";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"};return(n)=>{switch(n.code){case"invalid_type":return`無効な入力: ${n.expected}が期待されましたが、${v(n.input)}が入力されました`;case"invalid_value":if(n.values.length===1)return`無効な入力: ${S(n.values[0])}が期待されました`;return`無効な選択: ${w(n.values,"、")}のいずれかである必要があります`;case"too_big":{let b=n.inclusive?"以下である":"より小さい",r=$(n.origin);if(r)return`大きすぎる値: ${n.origin??"値"}は${n.maximum.toString()}${r.unit??"要素"}${b}必要があります`;return`大きすぎる値: ${n.origin??"値"}は${n.maximum.toString()}${b}必要があります`}case"too_small":{let b=n.inclusive?"以上である":"より大きい",r=$(n.origin);if(r)return`小さすぎる値: ${n.origin}は${n.minimum.toString()}${r.unit}${b}必要があります`;return`小さすぎる値: ${n.origin}は${n.minimum.toString()}${b}必要があります`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`無効な文字列: "${b.prefix}"で始まる必要があります`;if(b.format==="ends_with")return`無効な文字列: "${b.suffix}"で終わる必要があります`;if(b.format==="includes")return`無効な文字列: "${b.includes}"を含む必要があります`;if(b.format==="regex")return`無効な文字列: パターン${b.pattern}に一致する必要があります`;return`無効な${u[b.format]??n.format}`}case"not_multiple_of":return`無効な数値: ${n.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${n.keys.length>1?"群":""}: ${w(n.keys,"、")}`;case"invalid_key":return`${n.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${n.origin}内の無効な値`;default:return"無効な入力"}}};function Ub(){return{localeError:gI()}}var OI=()=>{let c={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"មិនមែនជាលេខ (NaN)":"លេខ";case"object":{if(Array.isArray(n))return"អារេ (Array)";if(n===null)return"គ្មានតម្លៃ (null)";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"};return(n)=>{switch(n.code){case"invalid_type":return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${n.expected} ប៉ុន្តែទទួលបាន ${v(n.input)}`;case"invalid_value":if(n.values.length===1)return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${S(n.values[0])}`;return`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${w(n.values,"|")}`;case"too_big":{let b=n.inclusive?"<=":"<",r=$(n.origin);if(r)return`ធំពេក៖ ត្រូវការ ${n.origin??"តម្លៃ"} ${b} ${n.maximum.toString()} ${r.unit??"ធាតុ"}`;return`ធំពេក៖ ត្រូវការ ${n.origin??"តម្លៃ"} ${b} ${n.maximum.toString()}`}case"too_small":{let b=n.inclusive?">=":">",r=$(n.origin);if(r)return`តូចពេក៖ ត្រូវការ ${n.origin} ${b} ${n.minimum.toString()} ${r.unit}`;return`តូចពេក៖ ត្រូវការ ${n.origin} ${b} ${n.minimum.toString()}`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${b.prefix}"`;if(b.format==="ends_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${b.suffix}"`;if(b.format==="includes")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${b.includes}"`;if(b.format==="regex")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${b.pattern}`;return`មិនត្រឹមត្រូវ៖ ${u[b.format]??n.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${n.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${w(n.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${n.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${n.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function ib(){return{localeError:OI()}}var II=()=>{let c={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"};return(n)=>{switch(n.code){case"invalid_type":return`잘못된 입력: 예상 타입은 ${n.expected}, 받은 타입은 ${v(n.input)}입니다`;case"invalid_value":if(n.values.length===1)return`잘못된 입력: 값은 ${S(n.values[0])} 이어야 합니다`;return`잘못된 옵션: ${w(n.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{let b=n.inclusive?"이하":"미만",r=b==="미만"?"이어야 합니다":"여야 합니다",g=$(n.origin),I=g?.unit??"요소";if(g)return`${n.origin??"값"}이 너무 큽니다: ${n.maximum.toString()}${I} ${b}${r}`;return`${n.origin??"값"}이 너무 큽니다: ${n.maximum.toString()} ${b}${r}`}case"too_small":{let b=n.inclusive?"이상":"초과",r=b==="이상"?"이어야 합니다":"여야 합니다",g=$(n.origin),I=g?.unit??"요소";if(g)return`${n.origin??"값"}이 너무 작습니다: ${n.minimum.toString()}${I} ${b}${r}`;return`${n.origin??"값"}이 너무 작습니다: ${n.minimum.toString()} ${b}${r}`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`잘못된 문자열: "${b.prefix}"(으)로 시작해야 합니다`;if(b.format==="ends_with")return`잘못된 문자열: "${b.suffix}"(으)로 끝나야 합니다`;if(b.format==="includes")return`잘못된 문자열: "${b.includes}"을(를) 포함해야 합니다`;if(b.format==="regex")return`잘못된 문자열: 정규식 ${b.pattern} 패턴과 일치해야 합니다`;return`잘못된 ${u[b.format]??n.format}`}case"not_multiple_of":return`잘못된 숫자: ${n.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${w(n.keys,", ")}`;case"invalid_key":return`잘못된 키: ${n.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${n.origin}`;default:return"잘못된 입력"}}};function Nb(){return{localeError:II()}}var tI=()=>{let c={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"NaN":"број";case"object":{if(Array.isArray(n))return"низа";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"};return(n)=>{switch(n.code){case"invalid_type":return`Грешен внес: се очекува ${n.expected}, примено ${v(n.input)}`;case"invalid_value":if(n.values.length===1)return`Invalid input: expected ${S(n.values[0])}`;return`Грешана опција: се очекува една ${w(n.values,"|")}`;case"too_big":{let b=n.inclusive?"<=":"<",r=$(n.origin);if(r)return`Премногу голем: се очекува ${n.origin??"вредноста"} да има ${b}${n.maximum.toString()} ${r.unit??"елементи"}`;return`Премногу голем: се очекува ${n.origin??"вредноста"} да биде ${b}${n.maximum.toString()}`}case"too_small":{let b=n.inclusive?">=":">",r=$(n.origin);if(r)return`Премногу мал: се очекува ${n.origin} да има ${b}${n.minimum.toString()} ${r.unit}`;return`Премногу мал: се очекува ${n.origin} да биде ${b}${n.minimum.toString()}`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`Неважечка низа: мора да започнува со "${b.prefix}"`;if(b.format==="ends_with")return`Неважечка низа: мора да завршува со "${b.suffix}"`;if(b.format==="includes")return`Неважечка низа: мора да вклучува "${b.includes}"`;if(b.format==="regex")return`Неважечка низа: мора да одгоара на патернот ${b.pattern}`;return`Invalid ${u[b.format]??n.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${w(n.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${n.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${n.origin}`;default:return"Грешен внес"}}};function jb(){return{localeError:tI()}}var _I=()=>{let c={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"NaN":"nombor";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return(n)=>{switch(n.code){case"invalid_type":return`Input tidak sah: dijangka ${n.expected}, diterima ${v(n.input)}`;case"invalid_value":if(n.values.length===1)return`Input tidak sah: dijangka ${S(n.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${w(n.values,"|")}`;case"too_big":{let b=n.inclusive?"<=":"<",r=$(n.origin);if(r)return`Terlalu besar: dijangka ${n.origin??"nilai"} ${r.verb} ${b}${n.maximum.toString()} ${r.unit??"elemen"}`;return`Terlalu besar: dijangka ${n.origin??"nilai"} adalah ${b}${n.maximum.toString()}`}case"too_small":{let b=n.inclusive?">=":">",r=$(n.origin);if(r)return`Terlalu kecil: dijangka ${n.origin} ${r.verb} ${b}${n.minimum.toString()} ${r.unit}`;return`Terlalu kecil: dijangka ${n.origin} adalah ${b}${n.minimum.toString()}`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`String tidak sah: mesti bermula dengan "${b.prefix}"`;if(b.format==="ends_with")return`String tidak sah: mesti berakhir dengan "${b.suffix}"`;if(b.format==="includes")return`String tidak sah: mesti mengandungi "${b.includes}"`;if(b.format==="regex")return`String tidak sah: mesti sepadan dengan corak ${b.pattern}`;return`${u[b.format]??n.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${w(n.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${n.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${n.origin}`;default:return"Input tidak sah"}}};function Sb(){return{localeError:_I()}}var wI=()=>{let c={string:{unit:"tekens"},file:{unit:"bytes"},array:{unit:"elementen"},set:{unit:"elementen"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"NaN":"getal";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return(n)=>{switch(n.code){case"invalid_type":return`Ongeldige invoer: verwacht ${n.expected}, ontving ${v(n.input)}`;case"invalid_value":if(n.values.length===1)return`Ongeldige invoer: verwacht ${S(n.values[0])}`;return`Ongeldige optie: verwacht één van ${w(n.values,"|")}`;case"too_big":{let b=n.inclusive?"<=":"<",r=$(n.origin);if(r)return`Te lang: verwacht dat ${n.origin??"waarde"} ${b}${n.maximum.toString()} ${r.unit??"elementen"} bevat`;return`Te lang: verwacht dat ${n.origin??"waarde"} ${b}${n.maximum.toString()} is`}case"too_small":{let b=n.inclusive?">=":">",r=$(n.origin);if(r)return`Te kort: verwacht dat ${n.origin} ${b}${n.minimum.toString()} ${r.unit} bevat`;return`Te kort: verwacht dat ${n.origin} ${b}${n.minimum.toString()} is`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`Ongeldige tekst: moet met "${b.prefix}" beginnen`;if(b.format==="ends_with")return`Ongeldige tekst: moet op "${b.suffix}" eindigen`;if(b.format==="includes")return`Ongeldige tekst: moet "${b.includes}" bevatten`;if(b.format==="regex")return`Ongeldige tekst: moet overeenkomen met patroon ${b.pattern}`;return`Ongeldig: ${u[b.format]??n.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${n.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${n.keys.length>1?"s":""}: ${w(n.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${n.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${n.origin}`;default:return"Ongeldige invoer"}}};function Db(){return{localeError:wI()}}var UI=()=>{let c={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"NaN":"tall";case"object":{if(Array.isArray(n))return"liste";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return(n)=>{switch(n.code){case"invalid_type":return`Ugyldig input: forventet ${n.expected}, fikk ${v(n.input)}`;case"invalid_value":if(n.values.length===1)return`Ugyldig verdi: forventet ${S(n.values[0])}`;return`Ugyldig valg: forventet en av ${w(n.values,"|")}`;case"too_big":{let b=n.inclusive?"<=":"<",r=$(n.origin);if(r)return`For stor(t): forventet ${n.origin??"value"} til å ha ${b}${n.maximum.toString()} ${r.unit??"elementer"}`;return`For stor(t): forventet ${n.origin??"value"} til å ha ${b}${n.maximum.toString()}`}case"too_small":{let b=n.inclusive?">=":">",r=$(n.origin);if(r)return`For lite(n): forventet ${n.origin} til å ha ${b}${n.minimum.toString()} ${r.unit}`;return`For lite(n): forventet ${n.origin} til å ha ${b}${n.minimum.toString()}`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`Ugyldig streng: må starte med "${b.prefix}"`;if(b.format==="ends_with")return`Ugyldig streng: må ende med "${b.suffix}"`;if(b.format==="includes")return`Ugyldig streng: må inneholde "${b.includes}"`;if(b.format==="regex")return`Ugyldig streng: må matche mønsteret ${b.pattern}`;return`Ugyldig ${u[b.format]??n.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${w(n.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${n.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${n.origin}`;default:return"Ugyldig input"}}};function kb(){return{localeError:UI()}}var iI=()=>{let c={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"NaN":"numara";case"object":{if(Array.isArray(n))return"saf";if(n===null)return"gayb";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"giren",email:"epostagâh",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"};return(n)=>{switch(n.code){case"invalid_type":return`Fâsit giren: umulan ${n.expected}, alınan ${v(n.input)}`;case"invalid_value":if(n.values.length===1)return`Fâsit giren: umulan ${S(n.values[0])}`;return`Fâsit tercih: mûteberler ${w(n.values,"|")}`;case"too_big":{let b=n.inclusive?"<=":"<",r=$(n.origin);if(r)return`Fazla büyük: ${n.origin??"value"}, ${b}${n.maximum.toString()} ${r.unit??"elements"} sahip olmalıydı.`;return`Fazla büyük: ${n.origin??"value"}, ${b}${n.maximum.toString()} olmalıydı.`}case"too_small":{let b=n.inclusive?">=":">",r=$(n.origin);if(r)return`Fazla küçük: ${n.origin}, ${b}${n.minimum.toString()} ${r.unit} sahip olmalıydı.`;return`Fazla küçük: ${n.origin}, ${b}${n.minimum.toString()} olmalıydı.`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`Fâsit metin: "${b.prefix}" ile başlamalı.`;if(b.format==="ends_with")return`Fâsit metin: "${b.suffix}" ile bitmeli.`;if(b.format==="includes")return`Fâsit metin: "${b.includes}" ihtivâ etmeli.`;if(b.format==="regex")return`Fâsit metin: ${b.pattern} nakşına uymalı.`;return`Fâsit ${u[b.format]??n.format}`}case"not_multiple_of":return`Fâsit sayı: ${n.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${n.keys.length>1?"s":""}: ${w(n.keys,", ")}`;case"invalid_key":return`${n.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${n.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function Pb(){return{localeError:iI()}}var NI=()=>{let c={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"NaN":"عدد";case"object":{if(Array.isArray(n))return"ارې";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",jwt:"JWT",template_literal:"ورودي"};return(n)=>{switch(n.code){case"invalid_type":return`ناسم ورودي: باید ${n.expected} وای, مګر ${v(n.input)} ترلاسه شو`;case"invalid_value":if(n.values.length===1)return`ناسم ورودي: باید ${S(n.values[0])} وای`;return`ناسم انتخاب: باید یو له ${w(n.values,"|")} څخه وای`;case"too_big":{let b=n.inclusive?"<=":"<",r=$(n.origin);if(r)return`ډیر لوی: ${n.origin??"ارزښت"} باید ${b}${n.maximum.toString()} ${r.unit??"عنصرونه"} ولري`;return`ډیر لوی: ${n.origin??"ارزښت"} باید ${b}${n.maximum.toString()} وي`}case"too_small":{let b=n.inclusive?">=":">",r=$(n.origin);if(r)return`ډیر کوچنی: ${n.origin} باید ${b}${n.minimum.toString()} ${r.unit} ولري`;return`ډیر کوچنی: ${n.origin} باید ${b}${n.minimum.toString()} وي`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`ناسم متن: باید د "${b.prefix}" سره پیل شي`;if(b.format==="ends_with")return`ناسم متن: باید د "${b.suffix}" سره پای ته ورسيږي`;if(b.format==="includes")return`ناسم متن: باید "${b.includes}" ولري`;if(b.format==="regex")return`ناسم متن: باید د ${b.pattern} سره مطابقت ولري`;return`${u[b.format]??n.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${n.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${n.keys.length>1?"کلیډونه":"کلیډ"}: ${w(n.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${n.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${n.origin} کې`;default:return"ناسمه ورودي"}}};function hb(){return{localeError:NI()}}var jI=()=>{let c={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"NaN":"liczba";case"object":{if(Array.isArray(n))return"tablica";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"wyrażenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"};return(n)=>{switch(n.code){case"invalid_type":return`Nieprawidłowe dane wejściowe: oczekiwano ${n.expected}, otrzymano ${v(n.input)}`;case"invalid_value":if(n.values.length===1)return`Nieprawidłowe dane wejściowe: oczekiwano ${S(n.values[0])}`;return`Nieprawidłowa opcja: oczekiwano jednej z wartości ${w(n.values,"|")}`;case"too_big":{let b=n.inclusive?"<=":"<",r=$(n.origin);if(r)return`Za duża wartość: oczekiwano, że ${n.origin??"wartość"} będzie mieć ${b}${n.maximum.toString()} ${r.unit??"elementów"}`;return`Zbyt duż(y/a/e): oczekiwano, że ${n.origin??"wartość"} będzie wynosić ${b}${n.maximum.toString()}`}case"too_small":{let b=n.inclusive?">=":">",r=$(n.origin);if(r)return`Za mała wartość: oczekiwano, że ${n.origin??"wartość"} będzie mieć ${b}${n.minimum.toString()} ${r.unit??"elementów"}`;return`Zbyt mał(y/a/e): oczekiwano, że ${n.origin??"wartość"} będzie wynosić ${b}${n.minimum.toString()}`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`Nieprawidłowy ciąg znaków: musi zaczynać się od "${b.prefix}"`;if(b.format==="ends_with")return`Nieprawidłowy ciąg znaków: musi kończyć się na "${b.suffix}"`;if(b.format==="includes")return`Nieprawidłowy ciąg znaków: musi zawierać "${b.includes}"`;if(b.format==="regex")return`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${b.pattern}`;return`Nieprawidłow(y/a/e) ${u[b.format]??n.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${n.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${n.keys.length>1?"s":""}: ${w(n.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${n.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${n.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function Ab(){return{localeError:jI()}}var SI=()=>{let c={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"NaN":"número";case"object":{if(Array.isArray(n))return"array";if(n===null)return"nulo";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"padrão",email:"endereço de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereço IPv4",ipv6:"endereço IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return(n)=>{switch(n.code){case"invalid_type":return`Tipo inválido: esperado ${n.expected}, recebido ${v(n.input)}`;case"invalid_value":if(n.values.length===1)return`Entrada inválida: esperado ${S(n.values[0])}`;return`Opção inválida: esperada uma das ${w(n.values,"|")}`;case"too_big":{let b=n.inclusive?"<=":"<",r=$(n.origin);if(r)return`Muito grande: esperado que ${n.origin??"valor"} tivesse ${b}${n.maximum.toString()} ${r.unit??"elementos"}`;return`Muito grande: esperado que ${n.origin??"valor"} fosse ${b}${n.maximum.toString()}`}case"too_small":{let b=n.inclusive?">=":">",r=$(n.origin);if(r)return`Muito pequeno: esperado que ${n.origin} tivesse ${b}${n.minimum.toString()} ${r.unit}`;return`Muito pequeno: esperado que ${n.origin} fosse ${b}${n.minimum.toString()}`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`Texto inválido: deve começar com "${b.prefix}"`;if(b.format==="ends_with")return`Texto inválido: deve terminar com "${b.suffix}"`;if(b.format==="includes")return`Texto inválido: deve incluir "${b.includes}"`;if(b.format==="regex")return`Texto inválido: deve corresponder ao padrão ${b.pattern}`;return`${u[b.format]??n.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${n.divisor}`;case"unrecognized_keys":return`Chave${n.keys.length>1?"s":""} desconhecida${n.keys.length>1?"s":""}: ${w(n.keys,", ")}`;case"invalid_key":return`Chave inválida em ${n.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${n.origin}`;default:return"Campo inválido"}}};function xb(){return{localeError:SI()}}function k4(c,$,v,u){let n=Math.abs(c),b=n%10,r=n%100;if(r>=11&&r<=19)return u;if(b===1)return $;if(b>=2&&b<=4)return v;return u}var DI=()=>{let c={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"NaN":"число";case"object":{if(Array.isArray(n))return"массив";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"};return(n)=>{switch(n.code){case"invalid_type":return`Неверный ввод: ожидалось ${n.expected}, получено ${v(n.input)}`;case"invalid_value":if(n.values.length===1)return`Неверный ввод: ожидалось ${S(n.values[0])}`;return`Неверный вариант: ожидалось одно из ${w(n.values,"|")}`;case"too_big":{let b=n.inclusive?"<=":"<",r=$(n.origin);if(r){let g=Number(n.maximum),I=k4(g,r.unit.one,r.unit.few,r.unit.many);return`Слишком большое значение: ожидалось, что ${n.origin??"значение"} будет иметь ${b}${n.maximum.toString()} ${I}`}return`Слишком большое значение: ожидалось, что ${n.origin??"значение"} будет ${b}${n.maximum.toString()}`}case"too_small":{let b=n.inclusive?">=":">",r=$(n.origin);if(r){let g=Number(n.minimum),I=k4(g,r.unit.one,r.unit.few,r.unit.many);return`Слишком маленькое значение: ожидалось, что ${n.origin} будет иметь ${b}${n.minimum.toString()} ${I}`}return`Слишком маленькое значение: ожидалось, что ${n.origin} будет ${b}${n.minimum.toString()}`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`Неверная строка: должна начинаться с "${b.prefix}"`;if(b.format==="ends_with")return`Неверная строка: должна заканчиваться на "${b.suffix}"`;if(b.format==="includes")return`Неверная строка: должна содержать "${b.includes}"`;if(b.format==="regex")return`Неверная строка: должна соответствовать шаблону ${b.pattern}`;return`Неверный ${u[b.format]??n.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${n.divisor}`;case"unrecognized_keys":return`Нераспознанн${n.keys.length>1?"ые":"ый"} ключ${n.keys.length>1?"и":""}: ${w(n.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${n.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${n.origin}`;default:return"Неверные входные данные"}}};function zb(){return{localeError:DI()}}var kI=()=>{let c={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"NaN":"število";case"object":{if(Array.isArray(n))return"tabela";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"vnos",email:"e-poštni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",jwt:"JWT",template_literal:"vnos"};return(n)=>{switch(n.code){case"invalid_type":return`Neveljaven vnos: pričakovano ${n.expected}, prejeto ${v(n.input)}`;case"invalid_value":if(n.values.length===1)return`Neveljaven vnos: pričakovano ${S(n.values[0])}`;return`Neveljavna možnost: pričakovano eno izmed ${w(n.values,"|")}`;case"too_big":{let b=n.inclusive?"<=":"<",r=$(n.origin);if(r)return`Preveliko: pričakovano, da bo ${n.origin??"vrednost"} imelo ${b}${n.maximum.toString()} ${r.unit??"elementov"}`;return`Preveliko: pričakovano, da bo ${n.origin??"vrednost"} ${b}${n.maximum.toString()}`}case"too_small":{let b=n.inclusive?">=":">",r=$(n.origin);if(r)return`Premajhno: pričakovano, da bo ${n.origin} imelo ${b}${n.minimum.toString()} ${r.unit}`;return`Premajhno: pričakovano, da bo ${n.origin} ${b}${n.minimum.toString()}`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`Neveljaven niz: mora se začeti z "${b.prefix}"`;if(b.format==="ends_with")return`Neveljaven niz: mora se končati z "${b.suffix}"`;if(b.format==="includes")return`Neveljaven niz: mora vsebovati "${b.includes}"`;if(b.format==="regex")return`Neveljaven niz: mora ustrezati vzorcu ${b.pattern}`;return`Neveljaven ${u[b.format]??n.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${n.divisor}`;case"unrecognized_keys":return`Neprepoznan${n.keys.length>1?"i ključi":" ključ"}: ${w(n.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${n.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${n.origin}`;default:return"Neveljaven vnos"}}};function Jb(){return{localeError:kI()}}var PI=()=>{let c={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"NaN":"antal";case"object":{if(Array.isArray(n))return"lista";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"reguljärt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return(n)=>{switch(n.code){case"invalid_type":return`Ogiltig inmatning: förväntat ${n.expected}, fick ${v(n.input)}`;case"invalid_value":if(n.values.length===1)return`Ogiltig inmatning: förväntat ${S(n.values[0])}`;return`Ogiltigt val: förväntade en av ${w(n.values,"|")}`;case"too_big":{let b=n.inclusive?"<=":"<",r=$(n.origin);if(r)return`För stor(t): förväntade ${n.origin??"värdet"} att ha ${b}${n.maximum.toString()} ${r.unit??"element"}`;return`För stor(t): förväntat ${n.origin??"värdet"} att ha ${b}${n.maximum.toString()}`}case"too_small":{let b=n.inclusive?">=":">",r=$(n.origin);if(r)return`För lite(t): förväntade ${n.origin??"värdet"} att ha ${b}${n.minimum.toString()} ${r.unit}`;return`För lite(t): förväntade ${n.origin??"värdet"} att ha ${b}${n.minimum.toString()}`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`Ogiltig sträng: måste börja med "${b.prefix}"`;if(b.format==="ends_with")return`Ogiltig sträng: måste sluta med "${b.suffix}"`;if(b.format==="includes")return`Ogiltig sträng: måste innehålla "${b.includes}"`;if(b.format==="regex")return`Ogiltig sträng: måste matcha mönstret "${b.pattern}"`;return`Ogiltig(t) ${u[b.format]??n.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${w(n.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${n.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${n.origin??"värdet"}`;default:return"Ogiltig input"}}};function Hb(){return{localeError:PI()}}var hI=()=>{let c={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"எண் அல்லாதது":"எண்";case"object":{if(Array.isArray(n))return"அணி";if(n===null)return"வெறுமை";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"};return(n)=>{switch(n.code){case"invalid_type":return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${n.expected}, பெறப்பட்டது ${v(n.input)}`;case"invalid_value":if(n.values.length===1)return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${S(n.values[0])}`;return`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${w(n.values,"|")} இல் ஒன்று`;case"too_big":{let b=n.inclusive?"<=":"<",r=$(n.origin);if(r)return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${n.origin??"மதிப்பு"} ${b}${n.maximum.toString()} ${r.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`;return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${n.origin??"மதிப்பு"} ${b}${n.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{let b=n.inclusive?">=":">",r=$(n.origin);if(r)return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${n.origin} ${b}${n.minimum.toString()} ${r.unit} ஆக இருக்க வேண்டும்`;return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${n.origin} ${b}${n.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`தவறான சரம்: "${b.prefix}" இல் தொடங்க வேண்டும்`;if(b.format==="ends_with")return`தவறான சரம்: "${b.suffix}" இல் முடிவடைய வேண்டும்`;if(b.format==="includes")return`தவறான சரம்: "${b.includes}" ஐ உள்ளடக்க வேண்டும்`;if(b.format==="regex")return`தவறான சரம்: ${b.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`;return`தவறான ${u[b.format]??n.format}`}case"not_multiple_of":return`தவறான எண்: ${n.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${n.keys.length>1?"கள்":""}: ${w(n.keys,", ")}`;case"invalid_key":return`${n.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${n.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function Xb(){return{localeError:hI()}}var AI=()=>{let c={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"ไม่ใช่ตัวเลข (NaN)":"ตัวเลข";case"object":{if(Array.isArray(n))return"อาร์เรย์ (Array)";if(n===null)return"ไม่มีค่า (null)";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"};return(n)=>{switch(n.code){case"invalid_type":return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${n.expected} แต่ได้รับ ${v(n.input)}`;case"invalid_value":if(n.values.length===1)return`ค่าไม่ถูกต้อง: ควรเป็น ${S(n.values[0])}`;return`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${w(n.values,"|")}`;case"too_big":{let b=n.inclusive?"ไม่เกิน":"น้อยกว่า",r=$(n.origin);if(r)return`เกินกำหนด: ${n.origin??"ค่า"} ควรมี${b} ${n.maximum.toString()} ${r.unit??"รายการ"}`;return`เกินกำหนด: ${n.origin??"ค่า"} ควรมี${b} ${n.maximum.toString()}`}case"too_small":{let b=n.inclusive?"อย่างน้อย":"มากกว่า",r=$(n.origin);if(r)return`น้อยกว่ากำหนด: ${n.origin} ควรมี${b} ${n.minimum.toString()} ${r.unit}`;return`น้อยกว่ากำหนด: ${n.origin} ควรมี${b} ${n.minimum.toString()}`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${b.prefix}"`;if(b.format==="ends_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${b.suffix}"`;if(b.format==="includes")return`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${b.includes}" อยู่ในข้อความ`;if(b.format==="regex")return`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${b.pattern}`;return`รูปแบบไม่ถูกต้อง: ${u[b.format]??n.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${n.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${w(n.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${n.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${n.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function Gb(){return{localeError:AI()}}var xI=(c)=>{let $=typeof c;switch($){case"number":return Number.isNaN(c)?"NaN":"number";case"object":{if(Array.isArray(c))return"array";if(c===null)return"null";if(Object.getPrototypeOf(c)!==Object.prototype&&c.constructor)return c.constructor.name}}return $},zI=()=>{let c={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}};function $(u){return c[u]??null}let v={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Şablon dizesi"};return(u)=>{switch(u.code){case"invalid_type":return`Geçersiz değer: beklenen ${u.expected}, alınan ${xI(u.input)}`;case"invalid_value":if(u.values.length===1)return`Geçersiz değer: beklenen ${S(u.values[0])}`;return`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${w(u.values,"|")}`;case"too_big":{let n=u.inclusive?"<=":"<",b=$(u.origin);if(b)return`Çok büyük: beklenen ${u.origin??"değer"} ${n}${u.maximum.toString()} ${b.unit??"öğe"}`;return`Çok büyük: beklenen ${u.origin??"değer"} ${n}${u.maximum.toString()}`}case"too_small":{let n=u.inclusive?">=":">",b=$(u.origin);if(b)return`Çok küçük: beklenen ${u.origin} ${n}${u.minimum.toString()} ${b.unit}`;return`Çok küçük: beklenen ${u.origin} ${n}${u.minimum.toString()}`}case"invalid_format":{let n=u;if(n.format==="starts_with")return`Geçersiz metin: "${n.prefix}" ile başlamalı`;if(n.format==="ends_with")return`Geçersiz metin: "${n.suffix}" ile bitmeli`;if(n.format==="includes")return`Geçersiz metin: "${n.includes}" içermeli`;if(n.format==="regex")return`Geçersiz metin: ${n.pattern} desenine uymalı`;return`Geçersiz ${v[n.format]??u.format}`}case"not_multiple_of":return`Geçersiz sayı: ${u.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${u.keys.length>1?"lar":""}: ${w(u.keys,", ")}`;case"invalid_key":return`${u.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${u.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function Lb(){return{localeError:zI()}}var JI=()=>{let c={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"NaN":"число";case"object":{if(Array.isArray(n))return"масив";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"};return(n)=>{switch(n.code){case"invalid_type":return`Неправильні вхідні дані: очікується ${n.expected}, отримано ${v(n.input)}`;case"invalid_value":if(n.values.length===1)return`Неправильні вхідні дані: очікується ${S(n.values[0])}`;return`Неправильна опція: очікується одне з ${w(n.values,"|")}`;case"too_big":{let b=n.inclusive?"<=":"<",r=$(n.origin);if(r)return`Занадто велике: очікується, що ${n.origin??"значення"} ${r.verb} ${b}${n.maximum.toString()} ${r.unit??"елементів"}`;return`Занадто велике: очікується, що ${n.origin??"значення"} буде ${b}${n.maximum.toString()}`}case"too_small":{let b=n.inclusive?">=":">",r=$(n.origin);if(r)return`Занадто мале: очікується, що ${n.origin} ${r.verb} ${b}${n.minimum.toString()} ${r.unit}`;return`Занадто мале: очікується, що ${n.origin} буде ${b}${n.minimum.toString()}`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`Неправильний рядок: повинен починатися з "${b.prefix}"`;if(b.format==="ends_with")return`Неправильний рядок: повинен закінчуватися на "${b.suffix}"`;if(b.format==="includes")return`Неправильний рядок: повинен містити "${b.includes}"`;if(b.format==="regex")return`Неправильний рядок: повинен відповідати шаблону ${b.pattern}`;return`Неправильний ${u[b.format]??n.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${n.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${n.keys.length>1?"і":""}: ${w(n.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${n.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${n.origin}`;default:return"Неправильні вхідні дані"}}};function Wb(){return{localeError:JI()}}var HI=()=>{let c={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"NaN":"نمبر";case"object":{if(Array.isArray(n))return"آرے";if(n===null)return"نل";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"};return(n)=>{switch(n.code){case"invalid_type":return`غلط ان پٹ: ${n.expected} متوقع تھا، ${v(n.input)} موصول ہوا`;case"invalid_value":if(n.values.length===1)return`غلط ان پٹ: ${S(n.values[0])} متوقع تھا`;return`غلط آپشن: ${w(n.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{let b=n.inclusive?"<=":"<",r=$(n.origin);if(r)return`بہت بڑا: ${n.origin??"ویلیو"} کے ${b}${n.maximum.toString()} ${r.unit??"عناصر"} ہونے متوقع تھے`;return`بہت بڑا: ${n.origin??"ویلیو"} کا ${b}${n.maximum.toString()} ہونا متوقع تھا`}case"too_small":{let b=n.inclusive?">=":">",r=$(n.origin);if(r)return`بہت چھوٹا: ${n.origin} کے ${b}${n.minimum.toString()} ${r.unit} ہونے متوقع تھے`;return`بہت چھوٹا: ${n.origin} کا ${b}${n.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`غلط سٹرنگ: "${b.prefix}" سے شروع ہونا چاہیے`;if(b.format==="ends_with")return`غلط سٹرنگ: "${b.suffix}" پر ختم ہونا چاہیے`;if(b.format==="includes")return`غلط سٹرنگ: "${b.includes}" شامل ہونا چاہیے`;if(b.format==="regex")return`غلط سٹرنگ: پیٹرن ${b.pattern} سے میچ ہونا چاہیے`;return`غلط ${u[b.format]??n.format}`}case"not_multiple_of":return`غلط نمبر: ${n.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${n.keys.length>1?"ز":""}: ${w(n.keys,"، ")}`;case"invalid_key":return`${n.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${n.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function Bb(){return{localeError:HI()}}var XI=()=>{let c={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"NaN":"số";case"object":{if(Array.isArray(n))return"mảng";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"đầu vào",email:"địa chỉ email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"};return(n)=>{switch(n.code){case"invalid_type":return`Đầu vào không hợp lệ: mong đợi ${n.expected}, nhận được ${v(n.input)}`;case"invalid_value":if(n.values.length===1)return`Đầu vào không hợp lệ: mong đợi ${S(n.values[0])}`;return`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${w(n.values,"|")}`;case"too_big":{let b=n.inclusive?"<=":"<",r=$(n.origin);if(r)return`Quá lớn: mong đợi ${n.origin??"giá trị"} ${r.verb} ${b}${n.maximum.toString()} ${r.unit??"phần tử"}`;return`Quá lớn: mong đợi ${n.origin??"giá trị"} ${b}${n.maximum.toString()}`}case"too_small":{let b=n.inclusive?">=":">",r=$(n.origin);if(r)return`Quá nhỏ: mong đợi ${n.origin} ${r.verb} ${b}${n.minimum.toString()} ${r.unit}`;return`Quá nhỏ: mong đợi ${n.origin} ${b}${n.minimum.toString()}`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`Chuỗi không hợp lệ: phải bắt đầu bằng "${b.prefix}"`;if(b.format==="ends_with")return`Chuỗi không hợp lệ: phải kết thúc bằng "${b.suffix}"`;if(b.format==="includes")return`Chuỗi không hợp lệ: phải bao gồm "${b.includes}"`;if(b.format==="regex")return`Chuỗi không hợp lệ: phải khớp với mẫu ${b.pattern}`;return`${u[b.format]??n.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${n.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${w(n.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${n.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${n.origin}`;default:return"Đầu vào không hợp lệ"}}};function Fb(){return{localeError:XI()}}var GI=()=>{let c={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"非数字(NaN)":"数字";case"object":{if(Array.isArray(n))return"数组";if(n===null)return"空值(null)";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"};return(n)=>{switch(n.code){case"invalid_type":return`无效输入:期望 ${n.expected},实际接收 ${v(n.input)}`;case"invalid_value":if(n.values.length===1)return`无效输入:期望 ${S(n.values[0])}`;return`无效选项:期望以下之一 ${w(n.values,"|")}`;case"too_big":{let b=n.inclusive?"<=":"<",r=$(n.origin);if(r)return`数值过大:期望 ${n.origin??"值"} ${b}${n.maximum.toString()} ${r.unit??"个元素"}`;return`数值过大:期望 ${n.origin??"值"} ${b}${n.maximum.toString()}`}case"too_small":{let b=n.inclusive?">=":">",r=$(n.origin);if(r)return`数值过小:期望 ${n.origin} ${b}${n.minimum.toString()} ${r.unit}`;return`数值过小:期望 ${n.origin} ${b}${n.minimum.toString()}`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`无效字符串:必须以 "${b.prefix}" 开头`;if(b.format==="ends_with")return`无效字符串:必须以 "${b.suffix}" 结尾`;if(b.format==="includes")return`无效字符串:必须包含 "${b.includes}"`;if(b.format==="regex")return`无效字符串:必须满足正则表达式 ${b.pattern}`;return`无效${u[b.format]??n.format}`}case"not_multiple_of":return`无效数字:必须是 ${n.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${w(n.keys,", ")}`;case"invalid_key":return`${n.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${n.origin} 中包含无效值(value)`;default:return"无效输入"}}};function Qb(){return{localeError:GI()}}var LI=()=>{let c={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"輸入",email:"郵件地址",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"};return(n)=>{switch(n.code){case"invalid_type":return`無效的輸入值:預期為 ${n.expected},但收到 ${v(n.input)}`;case"invalid_value":if(n.values.length===1)return`無效的輸入值:預期為 ${S(n.values[0])}`;return`無效的選項:預期為以下其中之一 ${w(n.values,"|")}`;case"too_big":{let b=n.inclusive?"<=":"<",r=$(n.origin);if(r)return`數值過大:預期 ${n.origin??"值"} 應為 ${b}${n.maximum.toString()} ${r.unit??"個元素"}`;return`數值過大:預期 ${n.origin??"值"} 應為 ${b}${n.maximum.toString()}`}case"too_small":{let b=n.inclusive?">=":">",r=$(n.origin);if(r)return`數值過小:預期 ${n.origin} 應為 ${b}${n.minimum.toString()} ${r.unit}`;return`數值過小:預期 ${n.origin} 應為 ${b}${n.minimum.toString()}`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`無效的字串:必須以 "${b.prefix}" 開頭`;if(b.format==="ends_with")return`無效的字串:必須以 "${b.suffix}" 結尾`;if(b.format==="includes")return`無效的字串:必須包含 "${b.includes}"`;if(b.format==="regex")return`無效的字串:必須符合格式 ${b.pattern}`;return`無效的 ${u[b.format]??n.format}`}case"not_multiple_of":return`無效的數字:必須為 ${n.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${n.keys.length>1?"們":""}:${w(n.keys,"、")}`;case"invalid_key":return`${n.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${n.origin} 中有無效的值`;default:return"無效的輸入值"}}};function Yb(){return{localeError:LI()}}var WI=()=>{let c={string:{unit:"àmi",verb:"ní"},file:{unit:"bytes",verb:"ní"},array:{unit:"nkan",verb:"ní"},set:{unit:"nkan",verb:"ní"}};function $(n){return c[n]??null}let v=(n)=>{let b=typeof n;switch(b){case"number":return Number.isNaN(n)?"NaN":"nọ́mbà";case"object":{if(Array.isArray(n))return"akopọ";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return b},u={regex:"ẹ̀rọ ìbáwọlé",email:"àdírẹ́sì ìmẹ́lì",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"àkókò ISO",date:"ọjọ́ ISO",time:"àkókò ISO",duration:"àkókò tó pé ISO",ipv4:"àdírẹ́sì IPv4",ipv6:"àdírẹ́sì IPv6",cidrv4:"àgbègbè IPv4",cidrv6:"àgbègbè IPv6",base64:"ọ̀rọ̀ tí a kọ́ ní base64",base64url:"ọ̀rọ̀ base64url",json_string:"ọ̀rọ̀ JSON",e164:"nọ́mbà E.164",jwt:"JWT",template_literal:"ẹ̀rọ ìbáwọlé"};return(n)=>{switch(n.code){case"invalid_type":return`Ìbáwọlé aṣìṣe: a ní láti fi ${n.expected}, àmọ̀ a rí ${v(n.input)}`;case"invalid_value":if(n.values.length===1)return`Ìbáwọlé aṣìṣe: a ní láti fi ${S(n.values[0])}`;return`Àṣàyàn aṣìṣe: yan ọ̀kan lára ${w(n.values,"|")}`;case"too_big":{let b=n.inclusive?"<=":"<",r=$(n.origin);if(r)return`Tó pọ̀ jù: a ní láti jẹ́ pé ${n.origin??"iye"} ${r.verb} ${b}${n.maximum} ${r.unit}`;return`Tó pọ̀ jù: a ní láti jẹ́ ${b}${n.maximum}`}case"too_small":{let b=n.inclusive?">=":">",r=$(n.origin);if(r)return`Kéré ju: a ní láti jẹ́ pé ${n.origin} ${r.verb} ${b}${n.minimum} ${r.unit}`;return`Kéré ju: a ní láti jẹ́ ${b}${n.minimum}`}case"invalid_format":{let b=n;if(b.format==="starts_with")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${b.prefix}"`;if(b.format==="ends_with")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${b.suffix}"`;if(b.format==="includes")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${b.includes}"`;if(b.format==="regex")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${b.pattern}`;return`Aṣìṣe: ${u[b.format]??n.format}`}case"not_multiple_of":return`Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${n.divisor}`;case"unrecognized_keys":return`Bọtìnì àìmọ̀: ${w(n.keys,", ")}`;case"invalid_key":return`Bọtìnì aṣìṣe nínú ${n.origin}`;case"invalid_union":return"Ìbáwọlé aṣìṣe";case"invalid_element":return`Iye aṣìṣe nínú ${n.origin}`;default:return"Ìbáwọlé aṣìṣe"}}};function Kb(){return{localeError:WI()}}var mb=Symbol("ZodOutput"),Rb=Symbol("ZodInput");class rn{constructor(){this._map=new Map,this._idmap=new Map}add(c,...$){let v=$[0];if(this._map.set(c,v),v&&typeof v==="object"&&"id"in v){if(this._idmap.has(v.id))throw Error(`ID ${v.id} already exists in the registry`);this._idmap.set(v.id,c)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(c){let $=this._map.get(c);if($&&typeof $==="object"&&"id"in $)this._idmap.delete($.id);return this._map.delete(c),this}get(c){let $=c._zod.parent;if($){let v={...this.get($)??{}};delete v.id;let u={...v,...this._map.get(c)};return Object.keys(u).length?u:void 0}return this._map.get(c)}has(c){return this._map.has(c)}}function yn(){return new rn}var f=yn();function Vb(c,$){return new c({type:"string",...N($)})}function Mb(c,$){return new c({type:"string",coerce:!0,...N($)})}function dn(c,$){return new c({type:"string",format:"email",check:"string_format",abort:!1,...N($)})}function gn(c,$){return new c({type:"string",format:"guid",check:"string_format",abort:!1,...N($)})}function pn(c,$){return new c({type:"string",format:"uuid",check:"string_format",abort:!1,...N($)})}function en(c,$){return new c({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...N($)})}function an(c,$){return new c({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...N($)})}function sn(c,$){return new c({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...N($)})}function c$(c,$){return new c({type:"string",format:"url",check:"string_format",abort:!1,...N($)})}function n$(c,$){return new c({type:"string",format:"emoji",check:"string_format",abort:!1,...N($)})}function $$(c,$){return new c({type:"string",format:"nanoid",check:"string_format",abort:!1,...N($)})}function v$(c,$){return new c({type:"string",format:"cuid",check:"string_format",abort:!1,...N($)})}function u$(c,$){return new c({type:"string",format:"cuid2",check:"string_format",abort:!1,...N($)})}function b$(c,$){return new c({type:"string",format:"ulid",check:"string_format",abort:!1,...N($)})}function r$(c,$){return new c({type:"string",format:"xid",check:"string_format",abort:!1,...N($)})}function g$(c,$){return new c({type:"string",format:"ksuid",check:"string_format",abort:!1,...N($)})}function O$(c,$){return new c({type:"string",format:"ipv4",check:"string_format",abort:!1,...N($)})}function I$(c,$){return new c({type:"string",format:"ipv6",check:"string_format",abort:!1,...N($)})}function t$(c,$){return new c({type:"string",format:"cidrv4",check:"string_format",abort:!1,...N($)})}function _$(c,$){return new c({type:"string",format:"cidrv6",check:"string_format",abort:!1,...N($)})}function w$(c,$){return new c({type:"string",format:"base64",check:"string_format",abort:!1,...N($)})}function U$(c,$){return new c({type:"string",format:"base64url",check:"string_format",abort:!1,...N($)})}function i$(c,$){return new c({type:"string",format:"e164",check:"string_format",abort:!1,...N($)})}function N$(c,$){return new c({type:"string",format:"jwt",check:"string_format",abort:!1,...N($)})}var Tb={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function Eb(c,$){return new c({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...N($)})}function lb(c,$){return new c({type:"string",format:"date",check:"string_format",...N($)})}function ob(c,$){return new c({type:"string",format:"time",check:"string_format",precision:null,...N($)})}function Zb(c,$){return new c({type:"string",format:"duration",check:"string_format",...N($)})}function qb(c,$){return new c({type:"number",checks:[],...N($)})}function Cb(c,$){return new c({type:"number",coerce:!0,checks:[],...N($)})}function fb(c,$){return new c({type:"number",check:"number_format",abort:!1,format:"safeint",...N($)})}function yb(c,$){return new c({type:"number",check:"number_format",abort:!1,format:"float32",...N($)})}function db(c,$){return new c({type:"number",check:"number_format",abort:!1,format:"float64",...N($)})}function pb(c,$){return new c({type:"number",check:"number_format",abort:!1,format:"int32",...N($)})}function eb(c,$){return new c({type:"number",check:"number_format",abort:!1,format:"uint32",...N($)})}function ab(c,$){return new c({type:"boolean",...N($)})}function sb(c,$){return new c({type:"boolean",coerce:!0,...N($)})}function cr(c,$){return new c({type:"bigint",...N($)})}function nr(c,$){return new c({type:"bigint",coerce:!0,...N($)})}function $r(c,$){return new c({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...N($)})}function vr(c,$){return new c({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...N($)})}function ur(c,$){return new c({type:"symbol",...N($)})}function br(c,$){return new c({type:"undefined",...N($)})}function rr(c,$){return new c({type:"null",...N($)})}function gr(c){return new c({type:"any"})}function Fc(c){return new c({type:"unknown"})}function Or(c,$){return new c({type:"never",...N($)})}function Ir(c,$){return new c({type:"void",...N($)})}function tr(c,$){return new c({type:"date",...N($)})}function _r(c,$){return new c({type:"date",coerce:!0,...N($)})}function wr(c,$){return new c({type:"nan",...N($)})}function p(c,$){return new Tn({check:"less_than",...N($),value:c,inclusive:!1})}function Z(c,$){return new Tn({check:"less_than",...N($),value:c,inclusive:!0})}function e(c,$){return new En({check:"greater_than",...N($),value:c,inclusive:!1})}function T(c,$){return new En({check:"greater_than",...N($),value:c,inclusive:!0})}function Ur(c){return e(0,c)}function ir(c){return p(0,c)}function Nr(c){return Z(0,c)}function jr(c){return T(0,c)}function Nc(c,$){return new Xv({check:"multiple_of",...N($),value:c})}function Qc(c,$){return new Wv({check:"max_size",...N($),maximum:c})}function jc(c,$){return new Bv({check:"min_size",...N($),minimum:c})}function On(c,$){return new Fv({check:"size_equals",...N($),size:c})}function Yc(c,$){return new Qv({check:"max_length",...N($),maximum:c})}function bc(c,$){return new Yv({check:"min_length",...N($),minimum:c})}function Kc(c,$){return new Kv({check:"length_equals",...N($),length:c})}function In(c,$){return new mv({check:"string_format",format:"regex",...N($),pattern:c})}function tn(c){return new Rv({check:"string_format",format:"lowercase",...N(c)})}function _n(c){return new Vv({check:"string_format",format:"uppercase",...N(c)})}function wn(c,$){return new Mv({check:"string_format",format:"includes",...N($),includes:c})}function Un(c,$){return new Tv({check:"string_format",format:"starts_with",...N($),prefix:c})}function Nn(c,$){return new Ev({check:"string_format",format:"ends_with",...N($),suffix:c})}function Sr(c,$,v){return new lv({check:"property",property:c,schema:$,...N(v)})}function jn(c,$){return new ov({check:"mime_type",mime:c,...N($)})}function a(c){return new Zv({check:"overwrite",tx:c})}function Sn(c){return a(($)=>$.normalize(c))}function Dn(){return a((c)=>c.trim())}function kn(){return a((c)=>c.toLowerCase())}function Pn(){return a((c)=>c.toUpperCase())}function hn(c,$,v){return new c({type:"array",element:$,...N(v)})}function BI(c,$,v){return new c({type:"union",options:$,...N(v)})}function FI(c,$,v,u){return new c({type:"union",options:v,discriminator:$,...N(u)})}function QI(c,$,v){return new c({type:"intersection",left:$,right:v})}function Dr(c,$,v,u){let n=v instanceof A;return new c({type:"tuple",items:$,rest:n?v:null,...N(n?u:v)})}function YI(c,$,v,u){return new c({type:"record",keyType:$,valueType:v,...N(u)})}function KI(c,$,v,u){return new c({type:"map",keyType:$,valueType:v,...N(u)})}function mI(c,$,v){return new c({type:"set",valueType:$,...N(v)})}function RI(c,$,v){let u=Array.isArray($)?Object.fromEntries($.map((n)=>[n,n])):$;return new c({type:"enum",entries:u,...N(v)})}function VI(c,$,v){return new c({type:"enum",entries:$,...N(v)})}function MI(c,$,v){return new c({type:"literal",values:Array.isArray($)?$:[$],...N(v)})}function kr(c,$){return new c({type:"file",...N($)})}function TI(c,$){return new c({type:"transform",transform:$})}function EI(c,$){return new c({type:"optional",innerType:$})}function lI(c,$){return new c({type:"nullable",innerType:$})}function oI(c,$,v){return new c({type:"default",innerType:$,get defaultValue(){return typeof v==="function"?v():v}})}function ZI(c,$,v){return new c({type:"nonoptional",innerType:$,...N(v)})}function qI(c,$){return new c({type:"success",innerType:$})}function CI(c,$,v){return new c({type:"catch",innerType:$,catchValue:typeof v==="function"?v:()=>v})}function fI(c,$,v){return new c({type:"pipe",in:$,out:v})}function yI(c,$){return new c({type:"readonly",innerType:$})}function dI(c,$,v){return new c({type:"template_literal",parts:$,...N(v)})}function pI(c,$){return new c({type:"lazy",getter:$})}function eI(c,$){return new c({type:"promise",innerType:$})}function Pr(c,$,v){let u=N(v);return u.abort??(u.abort=!0),new c({type:"custom",check:"custom",fn:$,...u})}function hr(c,$,v){return new c({type:"custom",check:"custom",fn:$,...N(v)})}function Ar(c){let $=P4((v)=>{return v.addIssue=(u)=>{if(typeof u==="string")v.issues.push(Gc(u,v.value,$._zod.def));else{let n=u;if(n.fatal)n.continue=!1;n.code??(n.code="custom"),n.input??(n.input=v.value),n.inst??(n.inst=$),n.continue??(n.continue=!$._zod.def.abort),v.issues.push(Gc(n))}},c(v.value,v)});return $}function P4(c,$){let v=new Y({check:"custom",...N($)});return v._zod.check=c,v}function xr(c,$){let v=N($),u=v.truthy??["true","1","yes","on","y","enabled"],n=v.falsy??["false","0","no","off","n","disabled"];if(v.case!=="sensitive")u=u.map((P)=>typeof P==="string"?P.toLowerCase():P),n=n.map((P)=>typeof P==="string"?P.toLowerCase():P);let b=new Set(u),r=new Set(n),g=c.Pipe??vn,I=c.Boolean??cn,_=c.String??Uc,i=new(c.Transform??$n)({type:"transform",transform:(P,h)=>{let X=P;if(v.case!=="sensitive")X=X.toLowerCase();if(b.has(X))return!0;else if(r.has(X))return!1;else return h.issues.push({code:"invalid_value",expected:"stringbool",values:[...b,...r],input:h.value,inst:i,continue:!1}),{}},error:v.error}),j=new g({type:"pipe",in:new _({type:"string",error:v.error}),out:i,error:v.error});return new g({type:"pipe",in:j,out:new I({type:"boolean",error:v.error}),error:v.error})}function j$(c,$,v,u={}){let n=N(u),b={...N(u),check:"string_format",type:"string",format:$,fn:typeof v==="function"?v:(g)=>v.test(g),...n};if(v instanceof RegExp)b.pattern=v;return new c(b)}class zr{constructor(c){this._def=c,this.def=c}implement(c){if(typeof c!=="function")throw Error("implement() must be called with a function");let $=(...v)=>{let u=this._def.input?Yn(this._def.input,v,void 0,{callee:$}):v;if(!Array.isArray(u))throw Error("Invalid arguments schema: not an array or tuple schema.");let n=c(...u);return this._def.output?Yn(this._def.output,n,void 0,{callee:$}):n};return $}implementAsync(c){if(typeof c!=="function")throw Error("implement() must be called with a function");let $=async(...v)=>{let u=this._def.input?await mn(this._def.input,v,void 0,{callee:$}):v;if(!Array.isArray(u))throw Error("Invalid arguments schema: not an array or tuple schema.");let n=await c(...u);return this._def.output?mn(this._def.output,n,void 0,{callee:$}):n};return $}input(...c){let $=this.constructor;if(Array.isArray(c[0]))return new $({type:"function",input:new ic({type:"tuple",items:c[0],rest:c[1]}),output:this._def.output});return new $({type:"function",input:c[0],output:this._def.output})}output(c){return new this.constructor({type:"function",input:this._def.input,output:c})}}function Jr(c){return new zr({type:"function",input:Array.isArray(c?.input)?Dr(ic,c?.input):c?.input??hn(nn,Fc(Bc)),output:c?.output??Fc(Bc)})}class S${constructor(c){this.counter=0,this.metadataRegistry=c?.metadata??f,this.target=c?.target??"draft-2020-12",this.unrepresentable=c?.unrepresentable??"throw",this.override=c?.override??(()=>{}),this.io=c?.io??"output",this.seen=new Map}process(c,$={path:[],schemaPath:[]}){var v;let u=c._zod.def,n={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},b=this.seen.get(c);if(b){if(b.count++,$.schemaPath.includes(c))b.cycle=$.path;return b.schema}let r={schema:{},count:1,cycle:void 0,path:$.path};this.seen.set(c,r);let g=c._zod.toJSONSchema?.();if(g)r.schema=g;else{let U={...$,schemaPath:[...$.schemaPath,c],path:$.path},i=c._zod.parent;if(i)r.ref=i,this.process(i,U),this.seen.get(i).isParent=!0;else{let j=r.schema;switch(u.type){case"string":{let t=j;t.type="string";let{minimum:P,maximum:h,format:X,patterns:H,contentEncoding:L}=c._zod.bag;if(typeof P==="number")t.minLength=P;if(typeof h==="number")t.maxLength=h;if(X){if(t.format=n[X]??X,t.format==="")delete t.format}if(L)t.contentEncoding=L;if(H&&H.size>0){let W=[...H];if(W.length===1)t.pattern=W[0].source;else if(W.length>1)r.schema.allOf=[...W.map((V)=>({...this.target==="draft-7"||this.target==="draft-4"?{type:"string"}:{},pattern:V.source}))]}break}case"number":{let t=j,{minimum:P,maximum:h,format:X,multipleOf:H,exclusiveMaximum:L,exclusiveMinimum:W}=c._zod.bag;if(typeof X==="string"&&X.includes("int"))t.type="integer";else t.type="number";if(typeof W==="number")if(this.target==="draft-4")t.minimum=W,t.exclusiveMinimum=!0;else t.exclusiveMinimum=W;if(typeof P==="number"){if(t.minimum=P,typeof W==="number"&&this.target!=="draft-4")if(W>=P)delete t.minimum;else delete t.exclusiveMinimum}if(typeof L==="number")if(this.target==="draft-4")t.maximum=L,t.exclusiveMaximum=!0;else t.exclusiveMaximum=L;if(typeof h==="number"){if(t.maximum=h,typeof L==="number"&&this.target!=="draft-4")if(L<=h)delete t.maximum;else delete t.exclusiveMaximum}if(typeof H==="number")t.multipleOf=H;break}case"boolean":{let t=j;t.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema");break}case"null":{j.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema");break}case"never":{j.not={};break}case"date":{if(this.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema");break}case"array":{let t=j,{minimum:P,maximum:h}=c._zod.bag;if(typeof P==="number")t.minItems=P;if(typeof h==="number")t.maxItems=h;t.type="array",t.items=this.process(u.element,{...U,path:[...U.path,"items"]});break}case"object":{let t=j;t.type="object",t.properties={};let P=u.shape;for(let H in P)t.properties[H]=this.process(P[H],{...U,path:[...U.path,"properties",H]});let h=new Set(Object.keys(P)),X=new Set([...h].filter((H)=>{let L=u.shape[H]._zod;if(this.io==="input")return L.optin===void 0;else return L.optout===void 0}));if(X.size>0)t.required=Array.from(X);if(u.catchall?._zod.def.type==="never")t.additionalProperties=!1;else if(!u.catchall){if(this.io==="output")t.additionalProperties=!1}else if(u.catchall)t.additionalProperties=this.process(u.catchall,{...U,path:[...U.path,"additionalProperties"]});break}case"union":{let t=j;t.anyOf=u.options.map((P,h)=>this.process(P,{...U,path:[...U.path,"anyOf",h]}));break}case"intersection":{let t=j,P=this.process(u.left,{...U,path:[...U.path,"allOf",0]}),h=this.process(u.right,{...U,path:[...U.path,"allOf",1]}),X=(L)=>("allOf"in L)&&Object.keys(L).length===1,H=[...X(P)?P.allOf:[P],...X(h)?h.allOf:[h]];t.allOf=H;break}case"tuple":{let t=j;t.type="array";let P=u.items.map((H,L)=>this.process(H,{...U,path:[...U.path,"prefixItems",L]}));if(this.target==="draft-2020-12")t.prefixItems=P;else t.items=P;if(u.rest){let H=this.process(u.rest,{...U,path:[...U.path,"items"]});if(this.target==="draft-2020-12")t.items=H;else t.additionalItems=H}if(u.rest)t.items=this.process(u.rest,{...U,path:[...U.path,"items"]});let{minimum:h,maximum:X}=c._zod.bag;if(typeof h==="number")t.minItems=h;if(typeof X==="number")t.maxItems=X;break}case"record":{let t=j;if(t.type="object",this.target!=="draft-4")t.propertyNames=this.process(u.keyType,{...U,path:[...U.path,"propertyNames"]});t.additionalProperties=this.process(u.valueType,{...U,path:[...U.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema");break}case"enum":{let t=j,P=qc(u.entries);if(P.every((h)=>typeof h==="number"))t.type="number";if(P.every((h)=>typeof h==="string"))t.type="string";t.enum=P;break}case"literal":{let t=j,P=[];for(let h of u.values)if(h===void 0){if(this.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof h==="bigint")if(this.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else P.push(Number(h));else P.push(h);if(P.length===0);else if(P.length===1){let h=P[0];if(t.type=h===null?"null":typeof h,this.target==="draft-4")t.enum=[h];else t.const=h}else{if(P.every((h)=>typeof h==="number"))t.type="number";if(P.every((h)=>typeof h==="string"))t.type="string";if(P.every((h)=>typeof h==="boolean"))t.type="string";if(P.every((h)=>h===null))t.type="null";t.enum=P}break}case"file":{let t=j,P={type:"string",format:"binary",contentEncoding:"binary"},{minimum:h,maximum:X,mime:H}=c._zod.bag;if(h!==void 0)P.minLength=h;if(X!==void 0)P.maxLength=X;if(H)if(H.length===1)P.contentMediaType=H[0],Object.assign(t,P);else t.anyOf=H.map((L)=>{return{...P,contentMediaType:L}});else Object.assign(t,P);break}case"transform":{if(this.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let t=this.process(u.innerType,U);j.anyOf=[t,{type:"null"}];break}case"nonoptional":{this.process(u.innerType,U),r.ref=u.innerType;break}case"success":{let t=j;t.type="boolean";break}case"default":{this.process(u.innerType,U),r.ref=u.innerType,j.default=JSON.parse(JSON.stringify(u.defaultValue));break}case"prefault":{if(this.process(u.innerType,U),r.ref=u.innerType,this.io==="input")j._prefault=JSON.parse(JSON.stringify(u.defaultValue));break}case"catch":{this.process(u.innerType,U),r.ref=u.innerType;let t;try{t=u.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}j.default=t;break}case"nan":{if(this.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let t=j,P=c._zod.pattern;if(!P)throw Error("Pattern not found in template literal");t.type="string",t.pattern=P.source;break}case"pipe":{let t=this.io==="input"?u.in._zod.def.type==="transform"?u.out:u.in:u.out;this.process(t,U),r.ref=t;break}case"readonly":{this.process(u.innerType,U),r.ref=u.innerType,j.readOnly=!0;break}case"promise":{this.process(u.innerType,U),r.ref=u.innerType;break}case"optional":{this.process(u.innerType,U),r.ref=u.innerType;break}case"lazy":{let t=c._zod.innerType;this.process(t,U),r.ref=t;break}case"custom":{if(this.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema");break}default:}}}let I=this.metadataRegistry.get(c);if(I)Object.assign(r.schema,I);if(this.io==="input"&&R(c))delete r.schema.examples,delete r.schema.default;if(this.io==="input"&&r.schema._prefault)(v=r.schema).default??(v.default=r.schema._prefault);return delete r.schema._prefault,this.seen.get(c).schema}emit(c,$){let v={cycles:$?.cycles??"ref",reused:$?.reused??"inline",external:$?.external??void 0},u=this.seen.get(c);if(!u)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(_)=>{let U=this.target==="draft-2020-12"?"$defs":"definitions";if(v.external){let P=v.external.registry.get(_[0])?.id,h=v.external.uri??((H)=>H);if(P)return{ref:h(P)};let X=_[1].defId??_[1].schema.id??`schema${this.counter++}`;return _[1].defId=X,{defId:X,ref:`${h("__shared")}#/${U}/${X}`}}if(_[1]===u)return{ref:"#"};let j=`${"#"}/${U}/`,t=_[1].schema.id??`__schema${this.counter++}`;return{defId:t,ref:j+t}},b=(_)=>{if(_[1].schema.$ref)return;let U=_[1],{ref:i,defId:j}=n(_);if(U.def={...U.schema},j)U.defId=j;let t=U.schema;for(let P in t)delete t[P];t.$ref=i};if(v.cycles==="throw")for(let _ of this.seen.entries()){let U=_[1];if(U.cycle)throw Error(`Cycle detected: #/${U.cycle?.join("/")}/<root>
|
|
1748
20
|
|
|
1749
|
-
// src/iwinv/contracts/account.contract.ts
|
|
1750
|
-
var IWINVAccountContract = class {
|
|
1751
|
-
constructor(config) {
|
|
1752
|
-
this.config = config;
|
|
1753
|
-
}
|
|
1754
|
-
async getBalance() {
|
|
1755
|
-
try {
|
|
1756
|
-
const response = await fetch(`${this.config.baseUrl}/balance`, {
|
|
1757
|
-
method: "GET",
|
|
1758
|
-
headers: {
|
|
1759
|
-
"Authorization": `Bearer ${this.config.apiKey}`
|
|
1760
|
-
}
|
|
1761
|
-
});
|
|
1762
|
-
const result = await response.json();
|
|
1763
|
-
if (!response.ok) {
|
|
1764
|
-
throw new Error(`Failed to get balance: ${result.message}`);
|
|
1765
|
-
}
|
|
1766
|
-
return {
|
|
1767
|
-
current: Number(result.balance) || 0,
|
|
1768
|
-
currency: "KRW",
|
|
1769
|
-
lastUpdated: /* @__PURE__ */ new Date(),
|
|
1770
|
-
threshold: Number(result.threshold) || void 0
|
|
1771
|
-
};
|
|
1772
|
-
} catch (error) {
|
|
1773
|
-
return {
|
|
1774
|
-
current: 0,
|
|
1775
|
-
currency: "KRW",
|
|
1776
|
-
lastUpdated: /* @__PURE__ */ new Date()
|
|
1777
|
-
};
|
|
1778
|
-
}
|
|
1779
|
-
}
|
|
1780
|
-
async getProfile() {
|
|
1781
|
-
try {
|
|
1782
|
-
const balance = await this.getBalance();
|
|
1783
|
-
return {
|
|
1784
|
-
accountId: "iwinv-account",
|
|
1785
|
-
name: "IWINV Account",
|
|
1786
|
-
email: "account@iwinv.kr",
|
|
1787
|
-
phone: "1588-1234",
|
|
1788
|
-
status: balance.current > 0 ? "active" : "suspended",
|
|
1789
|
-
tier: "standard",
|
|
1790
|
-
features: ["alimtalk", "sms", "lms"],
|
|
1791
|
-
limits: {
|
|
1792
|
-
dailyMessageLimit: 1e4,
|
|
1793
|
-
monthlyMessageLimit: 3e5,
|
|
1794
|
-
rateLimit: 100
|
|
1795
|
-
// per second
|
|
1796
|
-
}
|
|
1797
|
-
};
|
|
1798
|
-
} catch (error) {
|
|
1799
|
-
return {
|
|
1800
|
-
accountId: "iwinv-account",
|
|
1801
|
-
name: "IWINV Account",
|
|
1802
|
-
email: "account@iwinv.kr",
|
|
1803
|
-
phone: "1588-1234",
|
|
1804
|
-
status: "active",
|
|
1805
|
-
tier: "basic",
|
|
1806
|
-
features: ["alimtalk"],
|
|
1807
|
-
limits: {
|
|
1808
|
-
dailyMessageLimit: 1e3,
|
|
1809
|
-
monthlyMessageLimit: 3e4,
|
|
1810
|
-
rateLimit: 10
|
|
1811
|
-
}
|
|
1812
|
-
};
|
|
1813
|
-
}
|
|
1814
|
-
}
|
|
1815
|
-
};
|
|
21
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let _ of this.seen.entries()){let U=_[1];if(c===_[0]){b(_);continue}if(v.external){let j=v.external.registry.get(_[0])?.id;if(c!==_[0]&&j){b(_);continue}}if(this.metadataRegistry.get(_[0])?.id){b(_);continue}if(U.cycle){b(_);continue}if(U.count>1){if(v.reused==="ref"){b(_);continue}}}let r=(_,U)=>{let i=this.seen.get(_),j=i.def??i.schema,t={...j};if(i.ref===null)return;let P=i.ref;if(i.ref=null,P){r(P,U);let h=this.seen.get(P).schema;if(h.$ref&&(U.target==="draft-7"||U.target==="draft-4"))j.allOf=j.allOf??[],j.allOf.push(h);else Object.assign(j,h),Object.assign(j,t)}if(!i.isParent)this.override({zodSchema:_,jsonSchema:j,path:i.path??[]})};for(let _ of[...this.seen.entries()].reverse())r(_[0],{target:this.target});let g={};if(this.target==="draft-2020-12")g.$schema="https://json-schema.org/draft/2020-12/schema";else if(this.target==="draft-7")g.$schema="http://json-schema.org/draft-07/schema#";else if(this.target==="draft-4")g.$schema="http://json-schema.org/draft-04/schema#";else console.warn(`Invalid target: ${this.target}`);if(v.external?.uri){let _=v.external.registry.get(c)?.id;if(!_)throw Error("Schema is missing an `id` property");g.$id=v.external.uri(_)}Object.assign(g,u.def);let I=v.external?.defs??{};for(let _ of this.seen.entries()){let U=_[1];if(U.def&&U.defId)I[U.defId]=U.def}if(v.external);else if(Object.keys(I).length>0)if(this.target==="draft-2020-12")g.$defs=I;else g.definitions=I;try{return JSON.parse(JSON.stringify(g))}catch(_){throw Error("Error converting schema to JSON.")}}}function Hr(c,$){if(c instanceof rn){let u=new S$($),n={};for(let g of c._idmap.entries()){let[I,_]=g;u.process(_)}let b={},r={registry:c,uri:$?.uri,defs:n};for(let g of c._idmap.entries()){let[I,_]=g;b[I]=u.emit(_,{...$,external:r})}if(Object.keys(n).length>0){let g=u.target==="draft-2020-12"?"$defs":"definitions";b.__shared={[g]:n}}return{schemas:b}}let v=new S$($);return v.process(c),v.emit(c,$)}function R(c,$){let v=$??{seen:new Set};if(v.seen.has(c))return!1;v.seen.add(c);let n=c._zod.def;switch(n.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return R(n.element,v);case"object":{for(let b in n.shape)if(R(n.shape[b],v))return!0;return!1}case"union":{for(let b of n.options)if(R(b,v))return!0;return!1}case"intersection":return R(n.left,v)||R(n.right,v);case"tuple":{for(let b of n.items)if(R(b,v))return!0;if(n.rest&&R(n.rest,v))return!0;return!1}case"record":return R(n.keyType,v)||R(n.valueType,v);case"map":return R(n.keyType,v)||R(n.valueType,v);case"set":return R(n.valueType,v);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return R(n.innerType,v);case"lazy":return R(n.getter(),v);case"default":return R(n.innerType,v);case"prefault":return R(n.innerType,v);case"custom":return!1;case"transform":return!0;case"pipe":return R(n.in,v)||R(n.out,v);case"success":return!1;case"catch":return!1;default:}throw Error(`Unknown schema type: ${n.type}`)}var h4={};var A$={};nc(A$,{time:()=>Lr,duration:()=>Wr,datetime:()=>Xr,date:()=>Gr,ZodISOTime:()=>P$,ZodISODuration:()=>h$,ZodISODateTime:()=>D$,ZodISODate:()=>k$});var D$=O("ZodISODateTime",(c,$)=>{uu.init(c,$),F.init(c,$)});function Xr(c){return Eb(D$,c)}var k$=O("ZodISODate",(c,$)=>{bu.init(c,$),F.init(c,$)});function Gr(c){return lb(k$,c)}var P$=O("ZodISOTime",(c,$)=>{ru.init(c,$),F.init(c,$)});function Lr(c){return ob(P$,c)}var h$=O("ZodISODuration",(c,$)=>{gu.init(c,$),F.init(c,$)});function Wr(c){return Zb(h$,c)}var x4=(c,$)=>{ec.init(c,$),c.name="ZodError",Object.defineProperties(c,{format:{value:(v)=>sc(c,v)},flatten:{value:(v)=>ac(c,v)},addIssue:{value:(v)=>{c.issues.push(v),c.message=JSON.stringify(c.issues,Hc,2)}},addIssues:{value:(v)=>{c.issues.push(...v),c.message=JSON.stringify(c.issues,Hc,2)}},isEmpty:{get(){return c.issues.length===0}}})},sI=O("ZodError",x4),mc=O("ZodError",x4,{Parent:Error});var Br=Qn(mc),Fr=Kn(mc),Qr=Rn(mc),Yr=Vn(mc);var z=O("ZodType",(c,$)=>{return A.init(c,$),c.def=$,Object.defineProperty(c,"_def",{value:$}),c.check=(...v)=>{return c.clone({...$,checks:[...$.checks??[],...v.map((u)=>typeof u==="function"?{_zod:{check:u,def:{check:"custom"},onattach:[]}}:u)]})},c.clone=(v,u)=>M(c,v,u),c.brand=()=>c,c.register=(v,u)=>{return v.add(c,u),c},c.parse=(v,u)=>Br(c,v,u,{callee:c.parse}),c.safeParse=(v,u)=>Qr(c,v,u),c.parseAsync=async(v,u)=>Fr(c,v,u,{callee:c.parseAsync}),c.safeParseAsync=async(v,u)=>Yr(c,v,u),c.spa=c.safeParseAsync,c.refine=(v,u)=>c.check(O6(v,u)),c.superRefine=(v)=>c.check(I6(v)),c.overwrite=(v)=>c.check(a(v)),c.optional=()=>J$(c),c.nullable=()=>H$(c),c.nullish=()=>J$(H$(c)),c.nonoptional=(v)=>e4(c,v),c.array=()=>ug(c),c.or=(v)=>rg([c,v]),c.and=(v)=>R4(c,v),c.transform=(v)=>X$(c,Ig(v)),c.default=(v)=>y4(c,v),c.prefault=(v)=>p4(c,v),c.catch=(v)=>c6(c,v),c.pipe=(v)=>X$(c,v),c.readonly=()=>v6(c),c.describe=(v)=>{let u=c.clone();return f.add(u,{description:v}),u},Object.defineProperty(c,"description",{get(){return f.get(c)?.description},configurable:!0}),c.meta=(...v)=>{if(v.length===0)return f.get(c);let u=c.clone();return f.add(u,v[0]),u},c.isOptional=()=>c.safeParse(void 0).success,c.isNullable=()=>c.safeParse(null).success,c}),Rr=O("_ZodString",(c,$)=>{Uc.init(c,$),z.init(c,$);let v=c._zod.bag;c.format=v.format??null,c.minLength=v.minimum??null,c.maxLength=v.maximum??null,c.regex=(...u)=>c.check(In(...u)),c.includes=(...u)=>c.check(wn(...u)),c.startsWith=(...u)=>c.check(Un(...u)),c.endsWith=(...u)=>c.check(Nn(...u)),c.min=(...u)=>c.check(bc(...u)),c.max=(...u)=>c.check(Yc(...u)),c.length=(...u)=>c.check(Kc(...u)),c.nonempty=(...u)=>c.check(bc(1,...u)),c.lowercase=(u)=>c.check(tn(u)),c.uppercase=(u)=>c.check(_n(u)),c.trim=()=>c.check(Dn()),c.normalize=(...u)=>c.check(Sn(...u)),c.toLowerCase=()=>c.check(kn()),c.toUpperCase=()=>c.check(Pn())}),xn=O("ZodString",(c,$)=>{Uc.init(c,$),Rr.init(c,$),c.email=(v)=>c.check(dn(Vr,v)),c.url=(v)=>c.check(c$(Mr,v)),c.jwt=(v)=>c.check(N$(cg,v)),c.emoji=(v)=>c.check(n$(Tr,v)),c.guid=(v)=>c.check(gn(x$,v)),c.uuid=(v)=>c.check(pn(cc,v)),c.uuidv4=(v)=>c.check(en(cc,v)),c.uuidv6=(v)=>c.check(an(cc,v)),c.uuidv7=(v)=>c.check(sn(cc,v)),c.nanoid=(v)=>c.check($$(Er,v)),c.guid=(v)=>c.check(gn(x$,v)),c.cuid=(v)=>c.check(v$(lr,v)),c.cuid2=(v)=>c.check(u$(or,v)),c.ulid=(v)=>c.check(b$(Zr,v)),c.base64=(v)=>c.check(w$(er,v)),c.base64url=(v)=>c.check(U$(ar,v)),c.xid=(v)=>c.check(r$(qr,v)),c.ksuid=(v)=>c.check(g$(Cr,v)),c.ipv4=(v)=>c.check(O$(fr,v)),c.ipv6=(v)=>c.check(I$(yr,v)),c.cidrv4=(v)=>c.check(t$(dr,v)),c.cidrv6=(v)=>c.check(_$(pr,v)),c.e164=(v)=>c.check(i$(sr,v)),c.datetime=(v)=>c.check(Xr(v)),c.date=(v)=>c.check(Gr(v)),c.time=(v)=>c.check(Lr(v)),c.duration=(v)=>c.check(Wr(v))});function Kr(c){return Vb(xn,c)}var F=O("ZodStringFormat",(c,$)=>{B.init(c,$),Rr.init(c,$)}),Vr=O("ZodEmail",(c,$)=>{dv.init(c,$),F.init(c,$)});function nt(c){return dn(Vr,c)}var x$=O("ZodGUID",(c,$)=>{fv.init(c,$),F.init(c,$)});function $t(c){return gn(x$,c)}var cc=O("ZodUUID",(c,$)=>{yv.init(c,$),F.init(c,$)});function vt(c){return pn(cc,c)}function ut(c){return en(cc,c)}function bt(c){return an(cc,c)}function rt(c){return sn(cc,c)}var Mr=O("ZodURL",(c,$)=>{pv.init(c,$),F.init(c,$)});function gt(c){return c$(Mr,c)}var Tr=O("ZodEmoji",(c,$)=>{ev.init(c,$),F.init(c,$)});function Ot(c){return n$(Tr,c)}var Er=O("ZodNanoID",(c,$)=>{av.init(c,$),F.init(c,$)});function It(c){return $$(Er,c)}var lr=O("ZodCUID",(c,$)=>{sv.init(c,$),F.init(c,$)});function tt(c){return v$(lr,c)}var or=O("ZodCUID2",(c,$)=>{cu.init(c,$),F.init(c,$)});function _t(c){return u$(or,c)}var Zr=O("ZodULID",(c,$)=>{nu.init(c,$),F.init(c,$)});function wt(c){return b$(Zr,c)}var qr=O("ZodXID",(c,$)=>{$u.init(c,$),F.init(c,$)});function Ut(c){return r$(qr,c)}var Cr=O("ZodKSUID",(c,$)=>{vu.init(c,$),F.init(c,$)});function it(c){return g$(Cr,c)}var fr=O("ZodIPv4",(c,$)=>{Ou.init(c,$),F.init(c,$)});function Nt(c){return O$(fr,c)}var yr=O("ZodIPv6",(c,$)=>{Iu.init(c,$),F.init(c,$)});function jt(c){return I$(yr,c)}var dr=O("ZodCIDRv4",(c,$)=>{tu.init(c,$),F.init(c,$)});function St(c){return t$(dr,c)}var pr=O("ZodCIDRv6",(c,$)=>{_u.init(c,$),F.init(c,$)});function Dt(c){return _$(pr,c)}var er=O("ZodBase64",(c,$)=>{Uu.init(c,$),F.init(c,$)});function kt(c){return w$(er,c)}var ar=O("ZodBase64URL",(c,$)=>{iu.init(c,$),F.init(c,$)});function Pt(c){return U$(ar,c)}var sr=O("ZodE164",(c,$)=>{Nu.init(c,$),F.init(c,$)});function ht(c){return i$(sr,c)}var cg=O("ZodJWT",(c,$)=>{ju.init(c,$),F.init(c,$)});function At(c){return N$(cg,c)}var ng=O("ZodCustomStringFormat",(c,$)=>{Su.init(c,$),F.init(c,$)});function xt(c,$,v={}){return j$(ng,c,$,v)}function zt(c){return j$(ng,"hostname",d.hostname,c)}var zn=O("ZodNumber",(c,$)=>{qn.init(c,$),z.init(c,$),c.gt=(u,n)=>c.check(e(u,n)),c.gte=(u,n)=>c.check(T(u,n)),c.min=(u,n)=>c.check(T(u,n)),c.lt=(u,n)=>c.check(p(u,n)),c.lte=(u,n)=>c.check(Z(u,n)),c.max=(u,n)=>c.check(Z(u,n)),c.int=(u)=>c.check(mr(u)),c.safe=(u)=>c.check(mr(u)),c.positive=(u)=>c.check(e(0,u)),c.nonnegative=(u)=>c.check(T(0,u)),c.negative=(u)=>c.check(p(0,u)),c.nonpositive=(u)=>c.check(Z(0,u)),c.multipleOf=(u,n)=>c.check(Nc(u,n)),c.step=(u,n)=>c.check(Nc(u,n)),c.finite=()=>c;let v=c._zod.bag;c.minValue=Math.max(v.minimum??Number.NEGATIVE_INFINITY,v.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,c.maxValue=Math.min(v.maximum??Number.POSITIVE_INFINITY,v.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,c.isInt=(v.format??"").includes("int")||Number.isSafeInteger(v.multipleOf??0.5),c.isFinite=!0,c.format=v.format??null});function z4(c){return qb(zn,c)}var Rc=O("ZodNumberFormat",(c,$)=>{Du.init(c,$),zn.init(c,$)});function mr(c){return fb(Rc,c)}function Jt(c){return yb(Rc,c)}function Ht(c){return db(Rc,c)}function Xt(c){return pb(Rc,c)}function Gt(c){return eb(Rc,c)}var Jn=O("ZodBoolean",(c,$)=>{cn.init(c,$),z.init(c,$)});function J4(c){return ab(Jn,c)}var Hn=O("ZodBigInt",(c,$)=>{Cn.init(c,$),z.init(c,$),c.gte=(u,n)=>c.check(T(u,n)),c.min=(u,n)=>c.check(T(u,n)),c.gt=(u,n)=>c.check(e(u,n)),c.gte=(u,n)=>c.check(T(u,n)),c.min=(u,n)=>c.check(T(u,n)),c.lt=(u,n)=>c.check(p(u,n)),c.lte=(u,n)=>c.check(Z(u,n)),c.max=(u,n)=>c.check(Z(u,n)),c.positive=(u)=>c.check(e(BigInt(0),u)),c.negative=(u)=>c.check(p(BigInt(0),u)),c.nonpositive=(u)=>c.check(Z(BigInt(0),u)),c.nonnegative=(u)=>c.check(T(BigInt(0),u)),c.multipleOf=(u,n)=>c.check(Nc(u,n));let v=c._zod.bag;c.minValue=v.minimum??null,c.maxValue=v.maximum??null,c.format=v.format??null});function Lt(c){return cr(Hn,c)}var $g=O("ZodBigIntFormat",(c,$)=>{ku.init(c,$),Hn.init(c,$)});function Wt(c){return $r($g,c)}function Bt(c){return vr($g,c)}var H4=O("ZodSymbol",(c,$)=>{Pu.init(c,$),z.init(c,$)});function Ft(c){return ur(H4,c)}var X4=O("ZodUndefined",(c,$)=>{hu.init(c,$),z.init(c,$)});function Qt(c){return br(X4,c)}var G4=O("ZodNull",(c,$)=>{Au.init(c,$),z.init(c,$)});function L4(c){return rr(G4,c)}var W4=O("ZodAny",(c,$)=>{xu.init(c,$),z.init(c,$)});function Yt(){return gr(W4)}var B4=O("ZodUnknown",(c,$)=>{Bc.init(c,$),z.init(c,$)});function z$(){return Fc(B4)}var F4=O("ZodNever",(c,$)=>{zu.init(c,$),z.init(c,$)});function vg(c){return Or(F4,c)}var Q4=O("ZodVoid",(c,$)=>{Ju.init(c,$),z.init(c,$)});function Kt(c){return Ir(Q4,c)}var G$=O("ZodDate",(c,$)=>{Hu.init(c,$),z.init(c,$),c.min=(u,n)=>c.check(T(u,n)),c.max=(u,n)=>c.check(Z(u,n));let v=c._zod.bag;c.minDate=v.minimum?new Date(v.minimum):null,c.maxDate=v.maximum?new Date(v.maximum):null});function mt(c){return tr(G$,c)}var Y4=O("ZodArray",(c,$)=>{nn.init(c,$),z.init(c,$),c.element=$.element,c.min=(v,u)=>c.check(bc(v,u)),c.nonempty=(v)=>c.check(bc(1,v)),c.max=(v,u)=>c.check(Yc(v,u)),c.length=(v,u)=>c.check(Kc(v,u)),c.unwrap=()=>c.element});function ug(c,$){return hn(Y4,c,$)}function Rt(c){let $=c._zod.def.shape;return Z4(Object.keys($))}var L$=O("ZodObject",(c,$)=>{Xu.init(c,$),z.init(c,$),k.defineLazy(c,"shape",()=>$.shape),c.keyof=()=>l4(Object.keys(c._zod.def.shape)),c.catchall=(v)=>c.clone({...c._zod.def,catchall:v}),c.passthrough=()=>c.clone({...c._zod.def,catchall:z$()}),c.loose=()=>c.clone({...c._zod.def,catchall:z$()}),c.strict=()=>c.clone({...c._zod.def,catchall:vg()}),c.strip=()=>c.clone({...c._zod.def,catchall:void 0}),c.extend=(v)=>{return k.extend(c,v)},c.merge=(v)=>k.merge(c,v),c.pick=(v)=>k.pick(c,v),c.omit=(v)=>k.omit(c,v),c.partial=(...v)=>k.partial(tg,c,v[0]),c.required=(...v)=>k.required(_g,c,v[0])});function Vt(c,$){let v={type:"object",get shape(){return k.assignProp(this,"shape",c?k.objectClone(c):{}),this.shape},...k.normalizeParams($)};return new L$(v)}function Mt(c,$){return new L$({type:"object",get shape(){return k.assignProp(this,"shape",k.objectClone(c)),this.shape},catchall:vg(),...k.normalizeParams($)})}function Tt(c,$){return new L$({type:"object",get shape(){return k.assignProp(this,"shape",k.objectClone(c)),this.shape},catchall:z$(),...k.normalizeParams($)})}var bg=O("ZodUnion",(c,$)=>{fn.init(c,$),z.init(c,$),c.options=$.options});function rg(c,$){return new bg({type:"union",options:c,...k.normalizeParams($)})}var K4=O("ZodDiscriminatedUnion",(c,$)=>{bg.init(c,$),Gu.init(c,$)});function Et(c,$,v){return new K4({type:"union",options:$,discriminator:c,...k.normalizeParams(v)})}var m4=O("ZodIntersection",(c,$)=>{Lu.init(c,$),z.init(c,$)});function R4(c,$){return new m4({type:"intersection",left:c,right:$})}var V4=O("ZodTuple",(c,$)=>{ic.init(c,$),z.init(c,$),c.rest=(v)=>c.clone({...c._zod.def,rest:v})});function lt(c,$,v){let u=$ instanceof A,n=u?v:$;return new V4({type:"tuple",items:c,rest:u?$:null,...k.normalizeParams(n)})}var gg=O("ZodRecord",(c,$)=>{Wu.init(c,$),z.init(c,$),c.keyType=$.keyType,c.valueType=$.valueType});function M4(c,$,v){return new gg({type:"record",keyType:c,valueType:$,...k.normalizeParams(v)})}function ot(c,$,v){let u=M(c);return u._zod.values=void 0,new gg({type:"record",keyType:u,valueType:$,...k.normalizeParams(v)})}var T4=O("ZodMap",(c,$)=>{Bu.init(c,$),z.init(c,$),c.keyType=$.keyType,c.valueType=$.valueType});function Zt(c,$,v){return new T4({type:"map",keyType:c,valueType:$,...k.normalizeParams(v)})}var E4=O("ZodSet",(c,$)=>{Fu.init(c,$),z.init(c,$),c.min=(...v)=>c.check(jc(...v)),c.nonempty=(v)=>c.check(jc(1,v)),c.max=(...v)=>c.check(Qc(...v)),c.size=(...v)=>c.check(On(...v))});function qt(c,$){return new E4({type:"set",valueType:c,...k.normalizeParams($)})}var An=O("ZodEnum",(c,$)=>{Qu.init(c,$),z.init(c,$),c.enum=$.entries,c.options=Object.values($.entries);let v=new Set(Object.keys($.entries));c.extract=(u,n)=>{let b={};for(let r of u)if(v.has(r))b[r]=$.entries[r];else throw Error(`Key ${r} not found in enum`);return new An({...$,checks:[],...k.normalizeParams(n),entries:b})},c.exclude=(u,n)=>{let b={...$.entries};for(let r of u)if(v.has(r))delete b[r];else throw Error(`Key ${r} not found in enum`);return new An({...$,checks:[],...k.normalizeParams(n),entries:b})}});function l4(c,$){let v=Array.isArray(c)?Object.fromEntries(c.map((u)=>[u,u])):c;return new An({type:"enum",entries:v,...k.normalizeParams($)})}function Ct(c,$){return new An({type:"enum",entries:c,...k.normalizeParams($)})}var o4=O("ZodLiteral",(c,$)=>{Yu.init(c,$),z.init(c,$),c.values=new Set($.values),Object.defineProperty(c,"value",{get(){if($.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return $.values[0]}})});function Z4(c,$){return new o4({type:"literal",values:Array.isArray(c)?c:[c],...k.normalizeParams($)})}var q4=O("ZodFile",(c,$)=>{Ku.init(c,$),z.init(c,$),c.min=(v,u)=>c.check(jc(v,u)),c.max=(v,u)=>c.check(Qc(v,u)),c.mime=(v,u)=>c.check(jn(Array.isArray(v)?v:[v],u))});function ft(c){return kr(q4,c)}var Og=O("ZodTransform",(c,$)=>{$n.init(c,$),z.init(c,$),c._zod.parse=(v,u)=>{v.addIssue=(b)=>{if(typeof b==="string")v.issues.push(k.issue(b,v.value,$));else{let r=b;if(r.fatal)r.continue=!1;r.code??(r.code="custom"),r.input??(r.input=v.value),r.inst??(r.inst=c),v.issues.push(k.issue(r))}};let n=$.transform(v.value,v);if(n instanceof Promise)return n.then((b)=>{return v.value=b,v});return v.value=n,v}});function Ig(c){return new Og({type:"transform",transform:c})}var tg=O("ZodOptional",(c,$)=>{mu.init(c,$),z.init(c,$),c.unwrap=()=>c._zod.def.innerType});function J$(c){return new tg({type:"optional",innerType:c})}var C4=O("ZodNullable",(c,$)=>{Ru.init(c,$),z.init(c,$),c.unwrap=()=>c._zod.def.innerType});function H$(c){return new C4({type:"nullable",innerType:c})}function yt(c){return J$(H$(c))}var f4=O("ZodDefault",(c,$)=>{Vu.init(c,$),z.init(c,$),c.unwrap=()=>c._zod.def.innerType,c.removeDefault=c.unwrap});function y4(c,$){return new f4({type:"default",innerType:c,get defaultValue(){return typeof $==="function"?$():$}})}var d4=O("ZodPrefault",(c,$)=>{Mu.init(c,$),z.init(c,$),c.unwrap=()=>c._zod.def.innerType});function p4(c,$){return new d4({type:"prefault",innerType:c,get defaultValue(){return typeof $==="function"?$():$}})}var _g=O("ZodNonOptional",(c,$)=>{Tu.init(c,$),z.init(c,$),c.unwrap=()=>c._zod.def.innerType});function e4(c,$){return new _g({type:"nonoptional",innerType:c,...k.normalizeParams($)})}var a4=O("ZodSuccess",(c,$)=>{Eu.init(c,$),z.init(c,$),c.unwrap=()=>c._zod.def.innerType});function dt(c){return new a4({type:"success",innerType:c})}var s4=O("ZodCatch",(c,$)=>{lu.init(c,$),z.init(c,$),c.unwrap=()=>c._zod.def.innerType,c.removeCatch=c.unwrap});function c6(c,$){return new s4({type:"catch",innerType:c,catchValue:typeof $==="function"?$:()=>$})}var n6=O("ZodNaN",(c,$)=>{ou.init(c,$),z.init(c,$)});function pt(c){return wr(n6,c)}var wg=O("ZodPipe",(c,$)=>{vn.init(c,$),z.init(c,$),c.in=$.in,c.out=$.out});function X$(c,$){return new wg({type:"pipe",in:c,out:$})}var $6=O("ZodReadonly",(c,$)=>{Zu.init(c,$),z.init(c,$),c.unwrap=()=>c._zod.def.innerType});function v6(c){return new $6({type:"readonly",innerType:c})}var u6=O("ZodTemplateLiteral",(c,$)=>{qu.init(c,$),z.init(c,$)});function et(c,$){return new u6({type:"template_literal",parts:c,...k.normalizeParams($)})}var b6=O("ZodLazy",(c,$)=>{fu.init(c,$),z.init(c,$),c.unwrap=()=>c._zod.def.getter()});function r6(c){return new b6({type:"lazy",getter:c})}var g6=O("ZodPromise",(c,$)=>{Cu.init(c,$),z.init(c,$),c.unwrap=()=>c._zod.def.innerType});function at(c){return new g6({type:"promise",innerType:c})}var W$=O("ZodCustom",(c,$)=>{yu.init(c,$),z.init(c,$)});function st(c){let $=new Y({check:"custom"});return $._zod.check=c,$}function c_(c,$){return Pr(W$,c??(()=>!0),$)}function O6(c,$={}){return hr(W$,c,$)}function I6(c){return Ar(c)}function n_(c,$={error:`Input not instance of ${c.name}`}){let v=new W$({type:"custom",check:"custom",fn:(u)=>u instanceof c,abort:!0,...k.normalizeParams($)});return v._zod.bag.Class=c,v}var $_=(...c)=>xr({Pipe:wg,Boolean:Jn,String:xn,Transform:Og},...c);function v_(c){let $=r6(()=>{return rg([Kr(c),z4(),J4(),L4(),ug($),M4(Kr(),$)])});return $}function u_(c,$){return X$(Ig(c),$)}var b_={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function r_(c){m({customError:c})}function g_(){return m().customError}var Ug;(function(c){})(Ug||(Ug={}));var ig={};nc(ig,{string:()=>O_,number:()=>I_,date:()=>w_,boolean:()=>t_,bigint:()=>__});function O_(c){return Mb(xn,c)}function I_(c){return Cb(zn,c)}function t_(c){return sb(Jn,c)}function __(c){return nr(Hn,c)}function w_(c){return _r(G$,c)}m(un());var Ng;((n)=>{n.DEBUG="DEBUG";n.INFO="INFO";n.WARN="WARN";n.ERROR="ERROR"})(Ng||={});var U_=D.object({host:D.string().default("localhost"),port:D.number().min(1).max(65535).default(5432),database:D.string().min(1),username:D.string().min(1),password:D.string().min(1),ssl:D.boolean().default(!1),maxConnections:D.number().min(1).max(100).default(10),connectionTimeout:D.number().min(1000).default(30000)}),i_=D.object({host:D.string().default("localhost"),port:D.number().min(1).max(65535).default(6379),password:D.string().optional(),db:D.number().min(0).max(15).default(0),keyPrefix:D.string().default("kmsg:"),maxRetries:D.number().min(0).default(3)}),N_=D.object({level:D.nativeEnum(Ng).default("INFO"),enableConsole:D.boolean().default(!0),enableFile:D.boolean().default(!1),filePath:D.string().optional(),maxFileSize:D.number().min(1024).default(10485760),maxFiles:D.number().min(1).default(5),enableJson:D.boolean().default(!1),enableColors:D.boolean().default(!0)}),j_=D.object({timeout:D.number().min(1000).max(30000).default(5000),interval:D.number().min(1000).default(30000),retries:D.number().min(0).max(5).default(3),includeMetrics:D.boolean().default(!0)}),S_=D.object({apiKey:D.string().min(1),baseUrl:D.string().url().default("https://alimtalk.bizservice.iwinv.kr"),timeout:D.number().min(1000).max(60000).default(1e4),retryAttempts:D.number().min(0).max(5).default(3),retryDelay:D.number().min(100).default(1000),debug:D.boolean().default(!1),rateLimit:D.object({requests:D.number().min(1).default(100),perSecond:D.number().min(1).default(1)}).default({requests:100,perSecond:1})}),D_=D.object({provider:D.enum(["iwinv","aligo","coolsms"]),apiKey:D.string().min(1),apiSecret:D.string().optional(),senderId:D.string().min(1),defaultCountryCode:D.string().default("+82"),timeout:D.number().min(1000).default(1e4)}),k_=D.object({port:D.number().min(1).max(65535).default(3000),host:D.string().default("localhost"),cors:D.object({origins:D.array(D.string()).default(["*"]),credentials:D.boolean().default(!1)}).default({origins:["*"],credentials:!1}),maxRequestSize:D.number().min(1024).default(10485760),requestTimeout:D.number().min(1000).default(30000),enableMetrics:D.boolean().default(!0),enableDocs:D.boolean().default(!0)}),P_=D.object({maxConcurrency:D.number().min(1).max(100).default(10),maxRetries:D.number().min(0).max(10).default(3),retryDelay:D.number().min(100).default(1000),maxAge:D.number().min(60000).default(3600000),batchSize:D.number().min(1).max(1000).default(100),processingInterval:D.number().min(100).default(5000)}),wi=D.object({environment:D.enum(["development","staging","production"]).default("development"),server:k_.default({port:3000,host:"localhost",cors:{origins:["*"],credentials:!1},maxRequestSize:10485760,requestTimeout:30000,enableMetrics:!0,enableDocs:!0}),database:U_.optional(),redis:i_.optional(),logger:N_.default({level:"INFO",enableConsole:!0,enableFile:!1,maxFileSize:10485760,maxFiles:5,enableJson:!1,enableColors:!0}),health:j_.default({timeout:5000,interval:30000,retries:3,includeMetrics:!0}),queue:P_.default({maxConcurrency:10,maxRetries:3,retryDelay:1000,maxAge:3600000,batchSize:100,processingInterval:5000}),providers:D.object({iwinv:S_.optional(),sms:D_.optional()}).default({iwinv:void 0,sms:void 0}),features:D.object({enableBulkSending:D.boolean().default(!0),enableScheduling:D.boolean().default(!1),enableAnalytics:D.boolean().default(!0),enableWebhooks:D.boolean().default(!1),enableTemplateCache:D.boolean().default(!0),maxTemplatesPerProvider:D.number().min(1).default(1000),maxRecipientsPerBatch:D.number().min(1).max(1e4).default(1000)}).default({enableBulkSending:!0,enableScheduling:!1,enableAnalytics:!0,enableWebhooks:!1,enableTemplateCache:!0,maxTemplatesPerProvider:1000,maxRecipientsPerBatch:1000}),security:D.object({apiKeyRequired:D.boolean().default(!0),rateLimitEnabled:D.boolean().default(!0),maxRequestsPerMinute:D.number().min(1).default(1000),enableCors:D.boolean().default(!0),trustedProxies:D.array(D.string()).default([])}).default({apiKeyRequired:!0,rateLimitEnabled:!0,maxRequestsPerMinute:1000,enableCors:!0,trustedProxies:[]})});var Ui={logger:{level:"DEBUG",enableColors:!0,enableJson:!1},server:{enableDocs:!0}},ii={logger:{level:"INFO",enableColors:!1,enableJson:!0},server:{enableDocs:!1},security:{apiKeyRequired:!0,rateLimitEnabled:!0,maxRequestsPerMinute:1000,enableCors:!0}};class x extends Error{code;details;constructor(c,$,v){super($);if(this.name="KMsgError",this.code=c,this.details=v,Error.captureStackTrace)Error.captureStackTrace(this,x)}toJSON(){return{name:this.name,code:this.code,message:this.message,details:this.details}}}class Xn{config;constructor(c){this.config=c}getRequestConfig(){return{method:"POST",headers:this.getAuthHeaders()}}validateResponse(c){return c.ok}generateMessageId(){return`msg_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}log(c,$){if(this.config.debug)console.log(`[Adapter] ${c}`,$||"")}isRetryableError(c){return!1}}class Sc{id;name;type="messaging";version;adapter;config;isConfigured=!1;constructor(c,$){this.adapter=c,this.id=$.id,this.name=$.name,this.version=$.version,this.config=c.config,this.isConfigured=!0}configure(c){this.config=c;let $=this.adapter.constructor;this.adapter=new $(c),this.isConfigured=!0}isReady(){return this.isConfigured&&!!this.config.apiKey&&!!this.config.baseUrl}async healthCheck(){let c=[],$=Date.now();try{if(!this.isReady())return c.push("Provider is not configured properly"),{healthy:!1,issues:c};let v=this.adapter.getBaseUrl();try{new URL(v)}catch{c.push("Invalid base URL configuration")}try{let n=this.adapter.getAuthHeaders();if(!n||Object.keys(n).length===0)c.push("Authentication headers not properly configured")}catch(n){c.push(`Authentication configuration error: ${n instanceof Error?n.message:"Unknown"}`)}let u=Date.now()-$;return{healthy:c.length===0,issues:c,latency:u,data:{provider:this.id,baseUrl:this.adapter.getBaseUrl(),configured:this.isConfigured}}}catch(v){return c.push(`Health check failed: ${v instanceof Error?v.message:"Unknown error"}`),{healthy:!1,issues:c,latency:Date.now()-$}}}destroy(){this.isConfigured=!1,this.config={}}async send(c){if(!this.isReady())throw Error("Provider is not configured");try{let $=this.adapter.adaptRequest(c),v=await this.makeHttpRequest($),u=this.adapter.adaptResponse(v);return u.phoneNumber=c.phoneNumber,u}catch($){let v=this.adapter.mapError($);return{messageId:this.adapter.generateMessageId?.()||`error_${Date.now()}`,status:"FAILED",provider:this.id,timestamp:new Date,phoneNumber:c.phoneNumber,error:v}}}async getStatus(c){try{let $=`${this.adapter.getBaseUrl()}${this.adapter.getEndpoint("status")}`,v=this.adapter.getRequestConfig(),u=await fetch($,{...v,body:JSON.stringify({messageId:c})});if(!u.ok)throw Error(`HTTP ${u.status}`);let n=await u.json(),b=this.adapter.adaptResponse(n);return{status:this.mapStandardStatusToDeliveryStatus(b.status),timestamp:b.timestamp,details:b.metadata||{}}}catch($){return{status:"failed",timestamp:new Date,details:{error:$ instanceof Error?$.message:"Unknown error",requestId:c}}}}async cancel(c){try{let $=`${this.adapter.getBaseUrl()}${this.adapter.getEndpoint("cancel")}`,v=this.adapter.getRequestConfig();return(await fetch($,{...v,body:JSON.stringify({messageId:c})})).ok}catch{return!1}}getCapabilities(){return{maxRecipientsPerRequest:1,maxRequestsPerSecond:10,supportsBulk:!1,supportsScheduling:!0,supportsTemplating:!0,supportsWebhooks:!1}}getSupportedFeatures(){return["standard_messaging","error_handling","status_tracking","configuration_validation"]}getConfigurationSchema(){return{required:[{key:"apiKey",type:"secret",description:"API key for authentication"},{key:"baseUrl",type:"url",description:"Base URL for the provider API"}],optional:[{key:"debug",type:"boolean",description:"Enable debug logging"},{key:"timeout",type:"number",description:"Request timeout in milliseconds"}]}}async makeHttpRequest(c){let $=`${this.adapter.getBaseUrl()}${this.adapter.getEndpoint("send")}`,v=this.adapter.getRequestConfig();if(this.config.debug)console.log(`[${this.id}] Making request to:`,$),console.log(`[${this.id}] Request data:`,JSON.stringify(c).substring(0,200));let u=await fetch($,{...v,body:JSON.stringify(c)}),n=await u.text();if(this.config.debug)console.log(`[${this.id}] Response status:`,u.status),console.log(`[${this.id}] Response body:`,n.substring(0,500));if(!this.adapter.validateResponse(u))throw Error(`HTTP ${u.status}: ${u.statusText} - ${n}`);try{return JSON.parse(n)}catch(b){throw Error(`Invalid JSON response: ${n}`)}}mapStandardStatusToDeliveryStatus(c){switch(c){case"PENDING":return"pending";case"SENT":return"sent";case"DELIVERED":return"delivered";case"FAILED":return"failed";case"CANCELLED":return"cancelled";default:return"failed"}}getAdapter(){return this.adapter}getMetadata(){return{id:this.id,name:this.name,version:this.version,type:this.type,adapter:this.adapter.constructor.name}}}class t6{factories=new Map;providers=new Map;metadata=new Map;debug=!1;registerFactory(c){let $=c.getMetadata();if(this.factories.set($.id,c),this.metadata.set($.id,$),this.debug)console.log(`[ProviderRegistry] Registered factory: ${$.id}`)}createProvider(c,$){let v=this.factories.get(c);if(!v)throw Error(`Provider factory not found: ${c}`);if(!v.supports(c))throw Error(`Factory does not support provider: ${c}`);let u=v.create($),n=this.metadata.get(c),b=new Sc(u,{id:n.id,name:n.name,version:n.version});if(this.providers.set(c,b),this.debug)console.log(`[ProviderRegistry] Created provider: ${c}`);return b}getProvider(c){return this.providers.get(c)||null}getAvailableProviders(){return Array.from(this.factories.keys())}getProviderMetadata(c){return this.metadata.get(c)||null}getAllMetadata(){return Array.from(this.metadata.values())}findProvidersByFeature(c){return Array.from(this.metadata.values()).filter(($)=>$.supportedFeatures.includes(c))}unregisterProvider(c){let $=this.providers.get(c);if($){if($.destroy?.(),this.providers.delete(c),this.factories.delete(c),this.metadata.delete(c),this.debug)console.log(`[ProviderRegistry] Unregistered provider: ${c}`);return!0}return!1}clear(){for(let c of this.providers.values())c.destroy?.();if(this.providers.clear(),this.factories.clear(),this.metadata.clear(),this.debug)console.log("[ProviderRegistry] Cleared all providers")}getStatus(){return{registeredFactories:this.factories.size,activeProviders:this.providers.size,availableProviders:this.getAvailableProviders(),metadata:this.getAllMetadata()}}async healthCheck(){let c={};for(let[$,v]of this.providers.entries())try{c[$]=await v.healthCheck()}catch(u){c[$]={healthy:!1,issues:[`Health check failed: ${u instanceof Error?u.message:"Unknown error"}`]}}return c}setDebug(c){this.debug=c}}var Wi=new t6;var K=(c)=>({isSuccess:!0,isFailure:!1,value:c}),J=(c)=>({isSuccess:!1,isFailure:!0,error:c});var J_=require("bun:test");class Vc extends Xn{aligoConfig;static directTemplates=new Set(["SMS_DIRECT","LMS_DIRECT","MMS_DIRECT","FRIENDTALK_DIRECT"]);id="aligo";name="Aligo Smart SMS";SMS_HOST;ALIMTALK_HOST;constructor(c){super({baseUrl:c.smsBaseUrl||"https://apis.aligo.in",...c});this.aligoConfig=c;this.SMS_HOST=c.smsBaseUrl||"https://apis.aligo.in",this.ALIMTALK_HOST=c.alimtalkBaseUrl||"https://kakaoapi.aligo.in"}async send(c){try{if(c.type==="ALIMTALK")return this.sendAlimTalk(c);if(c.type==="FRIENDTALK")return this.sendFriendTalk(c);return this.sendSMS(c)}catch($){return J(this.handleError($))}}async sendStandard(c){try{let $=this.resolveStandardChannel(c);if(this.isKakaoChannel($)&&!this.aligoConfig.senderKey)throw new x("INVALID_REQUEST","Sender key required for KakaoTalk messages");let v;if($==="ALIMTALK")v=await this.request(this.ALIMTALK_HOST,this.getEndpoint("sendAlimTalk"),this.buildAlimTalkBodyFromStandard(c));else if($==="FRIENDTALK")v=await this.request(this.ALIMTALK_HOST,this.getEndpoint("sendFriendTalk"),this.buildFriendTalkBodyFromStandard(c));else v=await this.request(this.SMS_HOST,this.getEndpoint("sendSMS"),this.buildSmsBodyFromStandard(c,$));let u=this.isKakaoChannel($)?"0":"1",n=v.result_code===u;return{messageId:v.msg_id||this.generateMessageId(),status:n?"SENT":"FAILED",provider:this.id,timestamp:new Date,phoneNumber:c.phoneNumber,error:!n?this.mapError(v):void 0,metadata:{channel:this.toProviderChannel($),resultCode:v.result_code,resultMessage:v.message}}}catch($){return{messageId:this.generateMessageId(),status:"FAILED",provider:this.id,timestamp:new Date,phoneNumber:c.phoneNumber,error:this.mapError($)}}}adaptRequest(c){let $=this.resolveStandardChannel(c);if($==="ALIMTALK")return this.buildAlimTalkBodyFromStandard(c);if($==="FRIENDTALK")return this.buildFriendTalkBodyFromStandard(c);return this.buildSmsBodyFromStandard(c,$)}adaptResponse(c){let $=c.result_code==="1"||c.result_code==="0";return{messageId:c.msg_id||this.generateMessageId(),status:$?"SENT":"FAILED",provider:this.id,timestamp:new Date,phoneNumber:"",error:!$?this.mapError(c):void 0}}mapError(c){let $=this.mapAligoError(c),v="PROVIDER_ERROR";switch($.code){case"AUTHENTICATION_FAILED":v="AUTHENTICATION_FAILED";break;case"INSUFFICIENT_BALANCE":v="INSUFFICIENT_BALANCE";break;case"TEMPLATE_NOT_FOUND":v="TEMPLATE_NOT_FOUND";break;case"INVALID_REQUEST":v="INVALID_REQUEST";break;case"NETWORK_ERROR":v="NETWORK_ERROR";break;default:v="PROVIDER_ERROR"}return{code:v,message:$.message,retryable:v==="PROVIDER_ERROR"||v==="NETWORK_ERROR"}}mapAligoError(c){if(c instanceof x)return c;let $=c&&c.result_code?String(c.result_code):"UNKNOWN",v=c&&(c.message||c.msg)?c.message||c.msg:"Unknown Aligo error",u="PROVIDER_ERROR";switch($){case"-100":case"-101":u="AUTHENTICATION_FAILED";break;case"-102":case"-201":u="INSUFFICIENT_BALANCE";break;case"-103":case"-105":u="INVALID_REQUEST";break;case"-109":u="PROVIDER_ERROR";break;case"-501":u="TEMPLATE_NOT_FOUND";break;default:u="PROVIDER_ERROR"}return new x(u,`${v} (code: ${$})`)}getAuthHeaders(){return{}}getBaseUrl(){return this.SMS_HOST}getEndpoint(c){switch(c){case"send":case"sendSMS":return"/send/";case"sendAlimTalk":return"/akv10/alimtalk/send/";case"sendFriendTalk":return this.aligoConfig.friendtalkEndpoint||"/akv10/friendtalk/send/";case"templateList":return"/akv10/template/list/";case"templateAdd":return"/akv10/template/add/";case"templateDel":return"/akv10/template/del/";case"getBalance":return"/remain/";default:return"/"}}async getBalance(){try{let c={key:this.aligoConfig.apiKey,user_id:this.aligoConfig.userId},$=await this.request(this.SMS_HOST,this.getEndpoint("getBalance"),c);if($.result_code!=="1")throw this.mapAligoError($);return Number($.SMS_CNT)||0}catch(c){return this.log("Failed to get balance",c),0}}async createTemplate(c){try{let $={apikey:this.aligoConfig.apiKey,userid:this.aligoConfig.userId,senderkey:this.aligoConfig.senderKey,tpl_name:c.name,tpl_content:c.content,tpl_button:c.buttons?JSON.stringify(c.buttons):void 0},v=await this.request(this.ALIMTALK_HOST,this.getEndpoint("templateAdd"),$);if(v.result_code!=="0")return J(this.mapAligoError(v));return K({...c,id:c.code,status:"PENDING",createdAt:new Date,updatedAt:new Date})}catch($){return J(this.handleError($))}}async updateTemplate(c,$){return J(new x("UNKNOWN_ERROR","Update not supported by provider directly"))}async deleteTemplate(c){try{let $={apikey:this.aligoConfig.apiKey,userid:this.aligoConfig.userId,senderkey:this.aligoConfig.senderKey,tpl_code:c},v=await this.request(this.ALIMTALK_HOST,this.getEndpoint("templateDel"),$);if(v.result_code!=="0")return J(this.mapAligoError(v));return K(void 0)}catch($){return J(this.handleError($))}}async getTemplate(c){let $=await this.listTemplates({status:void 0});if($.isFailure)return $;let v=$.value.find((u)=>u.code===c);if(!v)return J(new x("TEMPLATE_NOT_FOUND","Template not found"));return K(v)}async listTemplates(c){try{let $={apikey:this.aligoConfig.apiKey,userid:this.aligoConfig.userId,senderkey:this.aligoConfig.senderKey},v=await this.request(this.ALIMTALK_HOST,this.getEndpoint("templateList"),$);if(v.result_code!=="0")return J(this.mapAligoError(v));let n=(v.list||[]).map((b)=>({id:b.templtCode,code:b.templtCode,name:b.templtName,content:b.templtContent,status:this.mapTemplateStatus(b.inspectionStatus),createdAt:new Date,updatedAt:new Date}));return K(n)}catch($){return J(this.handleError($))}}async sendSMS(c){if(c.type==="ALIMTALK"||c.type==="FRIENDTALK")return J(new x("INVALID_REQUEST","Invalid type for SMS"));let $={key:this.aligoConfig.apiKey,user_id:this.aligoConfig.userId,sender:c.from||this.aligoConfig.sender||"",receiver:c.to,msg:c.text,msg_type:c.type,title:c.subject,testmode_yn:this.aligoConfig.testMode?"Y":"N"};if(c.scheduledAt){let{date:u,time:n}=this.formatAligoDate(c.scheduledAt);$.rdate=u,$.rtime=n}let v=await this.request(this.SMS_HOST,this.getEndpoint("sendSMS"),$);if(v.result_code!=="1")return J(this.mapAligoError(v));return K({messageId:v.msg_id||"",status:"PENDING",provider:this.id})}async sendAlimTalk(c){if(c.type!=="ALIMTALK")return J(new x("INVALID_REQUEST","Invalid type for AlimTalk"));if(!this.aligoConfig.senderKey)return J(new x("INVALID_REQUEST","Sender key required for AlimTalk"));let $={apikey:this.aligoConfig.apiKey,userid:this.aligoConfig.userId,senderkey:this.aligoConfig.senderKey,tpl_code:c.templateId,sender:c.from||this.aligoConfig.sender||"",receiver_1:c.to,subject_1:"알림톡",message_1:this.interpolateMessage(c.variables||{}),testMode:this.aligoConfig.testMode?"Y":"N"};if(c.type==="ALIMTALK"&&c.scheduledAt){let{date:u,time:n}=this.formatAligoDate(c.scheduledAt);$.reserve="Y",$.reserve_date=u,$.reserve_time=n}let v=await this.request(this.ALIMTALK_HOST,this.getEndpoint("sendAlimTalk"),$);if(v.result_code!=="0")return J(this.mapAligoError(v));return K({messageId:v.msg_id||"",status:"PENDING",provider:this.id})}async sendFriendTalk(c){if(c.type!=="FRIENDTALK")return J(new x("INVALID_REQUEST","Invalid type for FriendTalk"));if(!this.aligoConfig.senderKey)return J(new x("INVALID_REQUEST","Sender key required for FriendTalk"));let $=this.buildFriendTalkBody({to:c.to,from:c.from,text:c.text,imageUrl:c.imageUrl,buttons:c.buttons,subject:c.subject,scheduledAt:c.scheduledAt}),v=await this.request(this.ALIMTALK_HOST,this.getEndpoint("sendFriendTalk"),$);if(v.result_code!=="0")return J(this.mapAligoError(v));return K({messageId:v.msg_id||"",status:"PENDING",provider:this.id})}formatAligoDate(c){let $=c.getFullYear(),v=String(c.getMonth()+1).padStart(2,"0"),u=String(c.getDate()).padStart(2,"0"),n=String(c.getHours()).padStart(2,"0"),b=String(c.getMinutes()).padStart(2,"0");return{date:`${$}${v}${u}`,time:`${n}${b}`}}async request(c,$,v){let u=new FormData;for(let b in v)if(v[b]!==void 0&&v[b]!==null)u.append(b,String(v[b]));let n=await fetch(`${c}${$}`,{method:"POST",body:u});if(!n.ok)throw new x("NETWORK_ERROR",`HTTP error! status: ${n.status}`);return n.json()}handleError(c){if(c instanceof x)return c;return new x("NETWORK_ERROR",String(c))}toProviderChannel(c){if(c==="ALIMTALK")return"alimtalk";if(c==="FRIENDTALK")return"friendtalk";if(c==="MMS")return"mms";return"sms"}normalizeChannelLike(c){if(typeof c!=="string")return;return c.trim().toUpperCase()}resolveStandardChannel(c){let $=this.normalizeChannelLike(c.channel),v=this.normalizeChannelLike(c.options?.channel),u=this.normalizeChannelLike(c.templateCode),n=$||v;if(n==="MMS")return"MMS";if(n==="LMS")return"LMS";if(n==="SMS")return"SMS";if(n==="FRIENDTALK")return"FRIENDTALK";if(n==="ALIMTALK")return"ALIMTALK";if(u==="MMS_DIRECT")return"MMS";if(u==="LMS_DIRECT")return"LMS";if(u==="SMS_DIRECT")return"SMS";if(u==="FRIENDTALK_DIRECT")return"FRIENDTALK";if(u&&Vc.directTemplates.has(u))return"SMS";return"ALIMTALK"}extractStandardMessage(c){let $=c.variables||{};if(typeof c.text==="string")return c.text;if(typeof $.message==="string")return $.message;return this.interpolateMessage($,c.templateContent)}buildSmsBodyFromStandard(c,$){let v={key:this.aligoConfig.apiKey,user_id:this.aligoConfig.userId,sender:c.options?.senderNumber||this.aligoConfig.sender||"",receiver:c.phoneNumber,msg:this.extractStandardMessage(c),msg_type:$,title:c.options?.subject||(typeof c.variables?.subject==="string"?c.variables.subject:void 0),testmode_yn:this.aligoConfig.testMode?"Y":"N"};if(c.options?.scheduledAt){let{date:u,time:n}=this.formatAligoDate(c.options.scheduledAt);v.rdate=u,v.rtime=n}if($==="MMS"&&c.imageUrl)v.image=c.imageUrl;return v}isKakaoChannel(c){return c==="ALIMTALK"||c==="FRIENDTALK"}buildFriendTalkBody(c){let $={apikey:this.aligoConfig.apiKey,userid:this.aligoConfig.userId,senderkey:this.aligoConfig.senderKey,sender:c.from||this.aligoConfig.sender||"",receiver_1:c.to,subject_1:c.subject||"친구톡",message_1:c.text,testMode:this.aligoConfig.testMode?"Y":"N"};if(c.templateCode&&this.normalizeChannelLike(c.templateCode)!=="FRIENDTALK_DIRECT")$.tpl_code=c.templateCode;if(c.imageUrl)$.image_1=c.imageUrl;if(c.buttons)$.button_1=JSON.stringify(c.buttons);if(c.scheduledAt){let{date:v,time:u}=this.formatAligoDate(c.scheduledAt);$.reserve="Y",$.reserve_date=v,$.reserve_time=u}return $}buildAlimTalkBodyFromStandard(c){let $={apikey:this.aligoConfig.apiKey,userid:this.aligoConfig.userId,senderkey:this.aligoConfig.senderKey,tpl_code:c.templateCode,sender:c.options?.senderNumber||this.aligoConfig.sender||"",receiver_1:c.phoneNumber,subject_1:c.options?.subject||(typeof c.variables?.subject==="string"?c.variables.subject:"알림톡"),message_1:this.extractStandardMessage(c),testMode:this.aligoConfig.testMode?"Y":"N"};if(c.options?.scheduledAt){let{date:v,time:u}=this.formatAligoDate(c.options.scheduledAt);$.reserve="Y",$.reserve_date=v,$.reserve_time=u}return $}buildFriendTalkBodyFromStandard(c){let $=this.extractStandardMessage(c),v=c.options?.subject||(typeof c.variables?.subject==="string"?c.variables.subject:void 0),u=c.buttons??(Array.isArray(c.options?.buttons)?c.options?.buttons:void 0),n=c.imageUrl||(typeof c.options?.imageUrl==="string"?c.options.imageUrl:void 0);return this.buildFriendTalkBody({to:c.phoneNumber,from:c.options?.senderNumber,text:$,subject:v,buttons:u,imageUrl:n,scheduledAt:c.options?.scheduledAt,templateCode:c.templateCode})}interpolateMessage(c,$){if(c._full_text)return String(c._full_text);if(!$)return Object.values(c).join(`
|
|
22
|
+
`);let v=$;for(let[u,n]of Object.entries(c))v=v.replace(new RegExp(`#{${u}}`,"g"),String(n));return v}mapTemplateStatus(c){switch(c){case"REG":return"PENDING";case"APR":return"APPROVED";case"REJ":return"REJECTED";default:return"PENDING"}}}function w6(c){return typeof c==="object"&&c!==null&&"code"in c&&typeof c.code==="number"}function H_(c){return typeof c==="object"&&c!==null&&"code"in c&&"message"in c}function X_(c){return typeof c==="object"&&c!==null&&"code"in c&&"charge"in c}class Dc extends Xn{static directTemplates=new Set(["SMS_DIRECT","LMS_DIRECT","MMS_DIRECT"]);endpoints={send:"/api/v2/send/",template:"/template/",history:"/history/",balance:"/balance/",cancel:"/cancel/"};constructor(c){if(!c.apiKey)throw Error("API key is required");if(!c.baseUrl)throw Error("Base URL is required");try{new URL(c.baseUrl)}catch{throw Error("Base URL must be a valid URL")}super(c)}adaptRequest(c){this.log("Adapting standard request to IWINV format",c);let $=!!c.options?.scheduledAt,v=$?this.formatIWINVDate(c.options.scheduledAt):void 0,u=c.channel||c.options?.channel,n=u==="SMS"||u==="LMS"||u==="MMS"||u==="sms"||u==="mms"||Dc.directTemplates.has(c.templateCode),b=c.text??(typeof c.variables?.message==="string"?c.variables.message:void 0)??(typeof c.variables?._full_text==="string"?c.variables._full_text:void 0),r=n?void 0:Object.values(c.variables).map(String),g=c.options?.subject??(typeof c.variables?.subject==="string"?c.variables.subject:void 0),I={templateCode:c.templateCode,reserve:$?"Y":"N",sendDate:v,reSend:"Y",resendCallback:c.options?.senderNumber||this.config.senderNumber,resendType:b?"N":"Y",resendTitle:g,resendContent:b,list:[{phone:c.phoneNumber,templateParam:r&&r.length>0?r:void 0}]};return this.log("Converted to IWINV request",I),I}adaptResponse(c){this.log("Adapting IWINV response to standard format",c);let $=c.code===200,v=this.mapIWINVStatus(c.code),u={messageId:c.seqNo?.toString()||this.generateMessageId(),status:v,provider:"iwinv",timestamp:new Date,phoneNumber:"",error:!$?this.mapError(c):void 0,metadata:{success:c.success,fail:c.fail,originalCode:c.code}};return this.log("Converted to standard result",u),u}mapError(c){this.log("Mapping IWINV error",c);let $="UNKNOWN_ERROR",v=!1,u="Unknown error";if(w6(c))switch(u=c.message,c.code){case 200:break;case 201:$="AUTHENTICATION_FAILED",v=!1;break;case 206:$="AUTHENTICATION_FAILED",v=!1;break;case 400:$="INVALID_REQUEST",v=!1;break;case 401:$="AUTHENTICATION_FAILED",v=!1;break;case 403:$="INSUFFICIENT_BALANCE",v=!1;break;case 404:$="TEMPLATE_NOT_FOUND",v=!1;break;case 501:case 502:case 503:case 504:case 505:case 506:case 507:case 508:case 509:case 510:case 511:case 512:case 513:case 514:case 515:case 516:case 517:case 540:$="INVALID_REQUEST",v=!1;break;case 518:$="PROVIDER_ERROR",v=!0;break;case 519:$="INSUFFICIENT_BALANCE",v=!1;break;case 429:$="RATE_LIMIT_EXCEEDED",v=!0;break;case 500:$="PROVIDER_ERROR",v=!0;break;default:if(c.code>=500)$="PROVIDER_ERROR",v=!0;else $="INVALID_REQUEST",v=!1}else if(c instanceof Error)u=c.message,$="NETWORK_ERROR",v=!0;else if(typeof c==="string")u=c;else u=String(c);return{code:$,message:u,retryable:v,details:{originalError:c,provider:"iwinv"}}}getAuthHeaders(){return{AUTH:btoa(this.config.apiKey),"Content-Type":"application/json"}}getBaseUrl(){return this.config.baseUrl||"https://alimtalk.bizservice.iwinv.kr"}getEndpoint(c){if(c==="send"){let v=this.config.sendEndpoint;if(v&&v.length>0)return v.startsWith("/")?v:`/${v}`}let $=this.endpoints[c];if(!$)throw Error(`Unsupported operation: ${c}`);return $}getRequestConfig(){return{method:"POST",headers:this.getAuthHeaders()}}async createTemplate(c){try{this.log("Creating template",c);let $=`${this.getBaseUrl()}${this.getEndpoint("template")}create`,u=await(await fetch($,{...this.getRequestConfig(),body:JSON.stringify({templateName:c.name,templateContent:c.content,buttons:c.buttons})})).json();if(u.code!==200)return J(new x("PROVIDER_ERROR",u.message||"Failed to create template"));return K({...c,id:c.code,status:"PENDING",createdAt:new Date,updatedAt:new Date})}catch($){return this.log("Failed to create template",$),J(new x("NETWORK_ERROR",$ instanceof Error?$.message:String($)))}}async updateTemplate(c,$){try{this.log(`Updating template ${c}`,$);let v=`${this.getBaseUrl()}${this.getEndpoint("template")}modify`,u=await this.getTemplate(c);if(u.isFailure)return u;let n=u.value,r=await(await fetch(v,{...this.getRequestConfig(),body:JSON.stringify({templateCode:c,templateName:$.name||n.name,templateContent:$.content||n.content,buttons:$.buttons||n.buttons})})).json();if(r.code!==200)return J(new x("PROVIDER_ERROR",r.message||"Failed to update template"));return K({...n,...$,updatedAt:new Date})}catch(v){return this.log(`Failed to update template ${c}`,v),J(new x("NETWORK_ERROR",v instanceof Error?v.message:String(v)))}}async deleteTemplate(c){try{this.log(`Deleting template ${c}`);let $=`${this.getBaseUrl()}${this.getEndpoint("template")}delete`,u=await(await fetch($,{...this.getRequestConfig(),body:JSON.stringify({templateCode:c})})).json();if(u.code!==200)return J(new x("PROVIDER_ERROR",u.message||"Failed to delete template"));return K(void 0)}catch($){return this.log(`Failed to delete template ${c}`,$),J(new x("NETWORK_ERROR",$ instanceof Error?$.message:String($)))}}async getTemplate(c){try{this.log(`Getting template ${c}`);let $=`${this.getBaseUrl()}${this.getEndpoint("template")}list`,v=new URLSearchParams;v.append("templateCode",c);let u=await fetch(`${$}?${v.toString()}`,this.getRequestConfig());if(!u.ok)return J(new x("NETWORK_ERROR",`HTTP error! status: ${u.status}`));let n=await u.json();if(n.code!==200)return J(new x("PROVIDER_ERROR",n.message||"Failed to get template"));let b=n.list.find((r)=>r.templateCode===c);if(!b)return J(new x("TEMPLATE_NOT_FOUND",`Template with code ${c} not found`));return K(this.mapIWINVTemplate(b))}catch($){return this.log(`Failed to get template ${c}`,$),J(new x("NETWORK_ERROR",$ instanceof Error?$.message:String($)))}}async listTemplates(c){try{this.log("Listing templates",c);let $=`${this.getBaseUrl()}${this.getEndpoint("template")}list`,v=new URLSearchParams;if(c?.page)v.append("pageNum",c.page.toString());if(c?.limit)v.append("pageSize",c.limit.toString());if(c?.status){let r=c.status==="APPROVED"?"Y":c.status==="REJECTED"?"R":c.status==="PENDING"?"I":void 0;if(r)v.append("templateStatus",r)}let u=await fetch(`${$}?${v.toString()}`,this.getRequestConfig());if(!u.ok)return J(new x("NETWORK_ERROR",`HTTP error! status: ${u.status}`));let n=await u.json();if(n.code!==200)return J(new x("PROVIDER_ERROR",n.message||"Failed to list templates"));let b=n.list.map((r)=>this.mapIWINVTemplate(r));return K(b)}catch($){return this.log("Failed to list templates",$),J(new x("NETWORK_ERROR",$ instanceof Error?$.message:String($)))}}mapIWINVTemplate(c){return{id:c.templateCode,code:c.templateCode,name:c.templateName,content:c.templateContent,status:this.mapIWINVTemplateStatus(c.status),buttons:c.buttons,createdAt:new Date(c.createDate),updatedAt:new Date(c.createDate)}}mapIWINVTemplateStatus(c){switch(c){case"Y":return"APPROVED";case"I":return"PENDING";case"R":return"REJECTED";default:return"PENDING"}}isRetryableError(c){if(w6(c))return c.code>=500||c.code===429;return super.isRetryableError(c)}formatIWINVDate(c){let $=c.getFullYear(),v=String(c.getMonth()+1).padStart(2,"0"),u=String(c.getDate()).padStart(2,"0"),n=String(c.getHours()).padStart(2,"0"),b=String(c.getMinutes()).padStart(2,"0"),r=String(c.getSeconds()).padStart(2,"0");return`${$}-${v}-${u} ${n}:${b}:${r}`}mapIWINVStatus(c){switch(c){case 200:return"SENT";case 201:case 206:case 400:case 401:case 403:case 404:case 501:case 502:case 503:case 504:case 505:case 506:case 507:case 508:case 509:case 510:case 511:case 512:case 513:case 514:case 515:case 516:case 517:case 519:case 540:return"FAILED";case 518:case 429:case 500:return"PENDING";default:return"FAILED"}}async cancelScheduledMessage(c){try{let $=`${this.getBaseUrl()}${this.getEndpoint("cancel")}`,v=await fetch($,{...this.getRequestConfig(),body:JSON.stringify({seqNo:parseInt(c)})});if(!v.ok)return!1;let u=await v.json();if(!H_(u))throw Error("Invalid IWINV response format");return u.code===200}catch($){return this.log("Failed to cancel scheduled message",$),!1}}async getBalance(){try{let c=`${this.getBaseUrl()}${this.getEndpoint("balance")}`,$=await fetch(c,this.getRequestConfig());if(!$.ok)throw Error(`HTTP ${$.status}`);let v=await $.json();if(!X_(v))throw Error("Invalid balance response format");return v.charge||0}catch(c){return this.log("Failed to get balance",c),0}}}class Dg{create(c){if(!this.isValidIWINVConfig(c))throw Error("Invalid IWINV configuration");return new Dc(c)}isValidIWINVConfig(c){return c.apiKey!==void 0&&c.baseUrl!==void 0&&typeof c.apiKey==="string"&&typeof c.baseUrl==="string"}supports(c){return c.toLowerCase()==="iwinv"}getMetadata(){return{id:"iwinv",name:"IWINV AlimTalk Provider",version:"1.0.0",description:"IWINV AlimTalk messaging service adapter",supportedFeatures:["alimtalk","template_messaging","scheduled_messaging","bulk_messaging","status_tracking","balance_checking"],capabilities:{maxRecipientsPerRequest:1e4,maxRequestsPerSecond:100,supportsBulk:!0,supportsScheduling:!0,supportsTemplating:!0,supportsWebhooks:!1},endpoints:{send:"/api/v2/send/",template:"/template/",history:"/history/",balance:"/balance/",cancel:"/cancel/"},authType:"header",responseFormat:"json"}}}class U6{id="mock";name="Mock Provider";calls=[];failureCount=0;templates=new Map;async send(c){if(this.calls.push(c),this.failureCount>0)return this.failureCount--,J(new x("PROVIDER_ERROR","Mock provider simulated failure",{provider:this.id}));let $={messageId:`mock-${Date.now()}-${Math.random().toString(36).substring(2,11)}`,status:"SENT",provider:this.id};return K($)}mockSuccess(){this.failureCount=0}mockFailure(c){this.failureCount=c}getHistory(){return this.calls}clearHistory(){this.calls=[]}async createTemplate(c){let $={...c,id:`tpl-${Math.random().toString(36).substr(2,9)}`,status:"APPROVED",createdAt:new Date,updatedAt:new Date};return this.templates.set($.code,$),K($)}async updateTemplate(c,$){let v=this.templates.get(c);if(!v)return J(new x("TEMPLATE_NOT_FOUND",`Template not found: ${c}`));let u={...v,...$,updatedAt:new Date};return this.templates.set(c,u),K(u)}async deleteTemplate(c){if(!this.templates.has(c))return J(new x("TEMPLATE_NOT_FOUND",`Template not found: ${c}`));return this.templates.delete(c),K(void 0)}async getTemplate(c){let $=this.templates.get(c);if(!$)return J(new x("TEMPLATE_NOT_FOUND",`Template not found: ${c}`));return K($)}async listTemplates(c){let $=Array.from(this.templates.values());if(c?.status)$=$.filter((r)=>r.status===c.status);let v=c?.page||1,u=c?.limit||10,n=(v-1)*u,b=n+u;return K($.slice(n,b))}}class i6{providers=new Map;defaultProvider;registerProvider(c){if(this.providers.set(c.id,c),!this.defaultProvider)this.defaultProvider=c.id}unregisterProvider(c){if(this.providers.delete(c),this.defaultProvider===c){let $=Array.from(this.providers.keys());this.defaultProvider=$.length>0?$[0]:void 0}}getProvider(c){let $=c||this.defaultProvider;return $?this.providers.get($)||null:null}getAlimTalkProvider(c){let $=this.getProvider(c);return $&&this.isAlimTalkProvider($)?$:null}listProviders(){return Array.from(this.providers.values())}listAlimTalkProviders(){return Array.from(this.providers.values()).filter(this.isAlimTalkProvider)}setDefaultProvider(c){if(!this.providers.has(c))throw Error(`Provider ${c} not found`);this.defaultProvider=c}async healthCheckAll(){let c={};for(let[$,v]of this.providers.entries())try{let u=await v.healthCheck();c[$]=u.healthy}catch(u){c[$]=!1}return c}getProvidersForChannel(c){return Array.from(this.providers.values()).filter(($)=>{switch(c){case"alimtalk":return this.isAlimTalkProvider($);case"sms":return this.isSMSProvider($);default:return!1}})}getProvidersByType(c){return Array.from(this.providers.values()).filter(($)=>$.type===c)}getSMSProvider(c){let $=this.getProvider(c);return $&&this.isSMSProvider($)?$:null}listSMSProviders(){return Array.from(this.providers.values()).filter(this.isSMSProvider)}async send(c,$){let v=this.getProvider(c);if(!v)throw Error(`Provider not found: ${c}`);return v.send($)}async sendAlimTalk(c,$){let v=this.getAlimTalkProvider(c);if(!v)throw Error(`AlimTalk provider not found: ${c}`);return v.send($)}async sendSMS(c,$){let v=this.getSMSProvider(c);if(!v)throw Error(`SMS provider not found: ${c}`);return v.send($)}isAlimTalkProvider(c){return c.type==="messaging"&&"templates"in c&&"channels"in c&&"messaging"in c&&"analytics"in c&&"account"in c}isSMSProvider(c){return c.type==="sms"&&"sms"in c&&"account"in c}}class N6{providers=new Map;defaultProviderId;constructor(c){this.defaultProviderId=c}register(c){if(this.providers.set(c.id,c),!this.defaultProviderId)this.defaultProviderId=c.id}get(c){return this.providers.get(c)}getAlimTalk(c){let $=this.providers.get(c);return $&&this.isAlimTalkProvider($)?$:void 0}getDefault(){if(!this.defaultProviderId)return;return this.providers.get(this.defaultProviderId)}list(){return Array.from(this.providers.values())}listAlimTalk(){return Array.from(this.providers.values()).filter(this.isAlimTalkProvider)}async send(c,$){let v=this.get(c);if(!v)throw Error(`Provider not found: ${c}`);return v.send($)}async sendAlimTalk(c,$){let v=this.getAlimTalk(c);if(!v)throw Error(`AlimTalk provider not found: ${c}`);return v.send($)}isAlimTalkProvider(c){return c.type==="messaging"&&"templates"in c&&"channels"in c&&"messaging"in c&&"analytics"in c&&"account"in c}}class Mc extends Sc{constructor(c){let $=new Vc(c);super($,{id:"aligo",name:"Aligo Smart SMS Provider",version:"1.0.0"})}async send(c){let $=this.getAdapter();if(G_(c))return $.sendStandard(c);if(L_(c))return $.send(c);return $.sendStandard(c)}async getBalance(){return this.getAdapter().getBalance()}}function j6(c){return typeof c==="object"&&c!==null}function G_(c){if(!j6(c))return!1;return typeof c.templateCode==="string"&&typeof c.phoneNumber==="string"&&typeof c.variables==="object"&&c.variables!==null}function L_(c){if(!j6(c))return!1;return typeof c.type==="string"&&typeof c.to==="string"}var kg=(c)=>new Mc(c),Pg=()=>{let c={apiKey:process.env.ALIGO_API_KEY||"",userId:process.env.ALIGO_USER_ID||"",senderKey:process.env.ALIGO_SENDER_KEY||"",sender:process.env.ALIGO_SENDER||"",friendtalkEndpoint:process.env.ALIGO_FRIENDTALK_ENDPOINT,testMode:!0,debug:!0};if(!c.apiKey||!c.userId)throw Error("ALIGO_API_KEY and ALIGO_USER_ID environment variables are required");return kg(c)};class hg{static create(c){return new Mc(c)}static createDefault(){return Pg()}static getInstance(){return{createProvider:(c)=>new Mc(c),initialize:()=>{}}}}function S6(){}var D6=2,k6=800;class q extends Sc{static directSmsTemplates=new Set(["SMS_DIRECT","LMS_DIRECT","MMS_DIRECT"]);iwinvConfig;constructor(c){let $={...c,senderNumber:c.senderNumber||c.smsSenderNumber,sendEndpoint:c.sendEndpoint||"/api/v2/send/"},v=new Dc($);super(v,{id:"iwinv",name:"IWINV AlimTalk Provider",version:"1.0.0"});this.iwinvConfig=$}async send(c){if(!this.isStandardRequest(c))return super.send(c);if(this.isSmsChannelRequest(c)){let v=this.extractMessageText(c),u=this.resolveSmsMessageType(c,v),n={channel:u,endpoint:"/api/v2/send/",phoneNumber:c.phoneNumber,templateCode:c.templateCode};return this.sendWithIpRetry(()=>this.sendSmsRequestOnce(c,v,u),n)}let $=typeof c.channel==="string"?c.channel.toUpperCase():typeof c.options?.channel==="string"?c.options.channel.toUpperCase():"ALIMTALK";return this.sendWithIpRetry(()=>super.send(c),{channel:$,endpoint:this.iwinvConfig.sendEndpoint||"/api/v2/send/",phoneNumber:c.phoneNumber,templateCode:c.templateCode})}isStandardRequest(c){if(!c||typeof c!=="object")return!1;let $=c;return typeof $.templateCode==="string"&&typeof $.phoneNumber==="string"&&typeof $.variables==="object"&&$.variables!==null}isSmsChannelRequest(c){let $=(c.channel||"").toUpperCase();if($==="SMS"||$==="LMS"||$==="MMS")return!0;let v=typeof c.options?.channel==="string"?c.options.channel.toUpperCase():"";if(v==="SMS"||v==="LMS"||v==="MMS")return!0;return q.directSmsTemplates.has(c.templateCode)}resolveSmsBaseUrl(){let $=(typeof this.iwinvConfig.smsBaseUrl==="string"&&this.iwinvConfig.smsBaseUrl.length>0?this.iwinvConfig.smsBaseUrl:this.iwinvConfig.baseUrl)||"https://sms.bizservice.iwinv.kr";return $=$.replace("alimtalk.bizservice.iwinv.kr","sms.bizservice.iwinv.kr"),$=$.replace(/\/api\/?$/,""),$.replace(/\/+$/,"")}isLongMessage(c,$){let v=(c.channel||"").toUpperCase();if(v==="LMS"||v==="MMS")return!0;if(c.templateCode==="LMS_DIRECT"||c.templateCode==="MMS_DIRECT")return!0;return $.length>90}resolveSmsMessageType(c,$){let v=typeof c.options?.msgType==="string"?c.options.msgType.toUpperCase():"";if(v==="GSMS")return"GSMS";if(v==="MMS")return"MMS";if(v==="LMS")return"LMS";if(v==="SMS")return"SMS";let u=(c.channel||"").toUpperCase();if(u==="MMS"||c.templateCode==="MMS_DIRECT")return"MMS";if(u==="LMS"||c.templateCode==="LMS_DIRECT")return"LMS";if(u==="SMS"||c.templateCode==="SMS_DIRECT")return"SMS";return $.length>90?"LMS":"SMS"}extractMessageText(c){if(typeof c.text==="string"&&c.text.trim().length>0)return c.text;if(typeof c.variables.message==="string"&&c.variables.message.trim().length>0)return c.variables.message;if(typeof c.variables._full_text==="string"&&c.variables._full_text.trim().length>0)return c.variables._full_text;return""}formatSmsReserveDate(c){let $=(v)=>v.toString().padStart(2,"0");return`${c.getFullYear()}-${$(c.getMonth()+1)}-${$(c.getDate())} ${$(c.getHours())}:${$(c.getMinutes())}:${$(c.getSeconds())}`}normalizePhoneNumber(c){return c.replace(/[^0-9]/g,"")}buildSmsSecretHeader(){if(this.iwinvConfig.smsApiKey&&this.iwinvConfig.smsAuthKey)return Buffer.from(`${this.iwinvConfig.smsApiKey}&${this.iwinvConfig.smsAuthKey}`,"utf8").toString("base64");let c=this.iwinvConfig.smsAuthKey||this.iwinvConfig.smsApiKey;if(!c)return"";let $=`${this.iwinvConfig.apiKey}&${c}`;return Buffer.from($,"utf8").toString("base64")}buildLmsTitle(c,$){let v=c.options?.subject||(typeof c.variables.subject==="string"?c.variables.subject:void 0);if(v&&v.trim().length>0)return v.trim();return $.slice(0,20)}mapSmsResponseMessage(c,$){return{"0":"전송 성공","1":"메시지가 전송되지 않았습니다.","11":"운영 중인 서비스가 아닙니다.","12":"요금제 충전 중입니다. 잠시 후 다시 시도해 보시기 바랍니다.","13":"등록되지 않은 발신번호입니다.","14":"인증 요청이 올바르지 않습니다.","15":"등록하지 않은 IP에서는 발송되지 않습니다.","21":"장문 메시지는 2000 Bytes까지만 입력이 가능합니다.","22":"제목 입력 가능 문자가 올바르지 않습니다.","23":"제목은 40 Byte까지만 입력이 가능합니다.","31":"파일 업로드는 100KB까지 가능합니다.","32":"허용되지 않는 파일 확장자입니다.","33":"이미지 업로드에 실패했습니다.","41":"수신 번호를 입력하여 주세요.","42":"예약 전송 가능 시간이 아닙니다.","43":"날짜와 시간 표현 형식에 맞춰 입력하여 주십시오.","44":"최대 1000건 전송 가능합니다.","50":"SMS 자동 충전 한도를 초과하였습니다.","202":"SMS API 인증 실패 또는 SMS 서비스 권한이 없습니다.","206":"등록하지 않은 IP에서는 발송되지 않습니다."}[c]||$}mapSmsErrorCode(c,$){if(c==="14"||c==="15"||c==="202"||c==="206")return"AUTHENTICATION_FAILED";if(c==="50")return"INSUFFICIENT_BALANCE";if(c==="13"||c==="21"||c==="22"||c==="23"||c==="31"||c==="32"||c==="33"||c==="41"||c==="42"||c==="43"||c==="44")return"INVALID_REQUEST";if(c==="12")return"PROVIDER_ERROR";if(!$)return"NETWORK_ERROR";return"PROVIDER_ERROR"}isSmsRetryableCode(c,$){if(!$)return!0;return c==="12"||c==="429"||c.startsWith("5")}normalizeCode(c){if(typeof c==="number"&&Number.isFinite(c))return c.toString();if(typeof c==="string")return c.trim();return""}extractProviderCode(c){let $=this.normalizeCode(c.metadata?.originalCode);if($)return $;let v=this.normalizeCode(c.error?.details?.originalCode);if(v)return v;let u=this.normalizeCode(c.error?.details?.originalError?.code);if(u)return u;return""}isIpRestrictionResult(c){let $=this.extractProviderCode(c);if($==="15"||$==="206")return!0;let v=c.error?.message||"";return v.includes("등록하지 않은 IP")||v.toLowerCase().includes("unregistered ip")}getIpRetryCount(){let c=Number(this.iwinvConfig.ipRetryCount??D6);if(!Number.isFinite(c)||c<0)return D6;return Math.floor(c)}getIpRetryDelayMs(c){let $=Number(this.iwinvConfig.ipRetryDelayMs??k6);if(!Number.isFinite($)||$<=0)return k6;return Math.floor($*c)}async wait(c){await new Promise(($)=>setTimeout($,c))}async emitIpRestrictionAlert(c,$,v,u){let n=this.extractProviderCode($)||"206",b=$.error?.message||"등록하지 않은 IP에서는 발송되지 않습니다.",r={provider:"iwinv",channel:c.channel,endpoint:c.endpoint,phoneNumber:c.phoneNumber,templateCode:c.templateCode,code:n,message:b,attempt:v,maxAttempts:u,timestamp:new Date().toISOString()};if(console.warn(`[iwinv] Unregistered IP response detected (${c.channel}, attempt ${v}/${u}, code=${n}, endpoint=${c.endpoint})`),typeof this.iwinvConfig.onIpRestrictionAlert==="function")try{await Promise.resolve(this.iwinvConfig.onIpRestrictionAlert(r))}catch(g){console.warn("[iwinv] onIpRestrictionAlert callback failed:",g)}if(typeof this.iwinvConfig.ipAlertWebhookUrl==="string"&&this.iwinvConfig.ipAlertWebhookUrl.length>0)try{await fetch(this.iwinvConfig.ipAlertWebhookUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})}catch(g){console.warn("[iwinv] IP alert webhook delivery failed:",g)}}addIpRetryMetadata(c,$){if(!c.error)return c;let v=c.error.message||"등록하지 않은 IP에서는 발송되지 않습니다.",u=v.includes("재시도")?v:`${v} (미등록 IP로 ${$}회 재시도 후 중단)`;return{...c,error:{...c.error,message:u,details:{...c.error.details||{},ipRestriction:!0,ipRetryAttempts:$}},metadata:{...c.metadata||{},ipRestriction:!0,ipRetryAttempts:$}}}async sendWithIpRetry(c,$){let u=this.getIpRetryCount()+1,n=null;for(let b=1;b<=u;b+=1){let r=await c();if(n=r,!this.isIpRestrictionResult(r))return r;if(await this.emitIpRestrictionAlert($,r,b,u),b<u)await this.wait(this.getIpRetryDelayMs(b))}if(!n)return{messageId:`ip_retry_error_${Date.now()}`,status:"FAILED",provider:this.id,timestamp:new Date,phoneNumber:$.phoneNumber,error:{code:"NETWORK_ERROR",message:"Unknown send failure after retry",retryable:!1}};return this.addIpRetryMetadata(n,u)}async sendSmsRequestOnce(c,$,v){if(!$)return{messageId:`sms_error_${Date.now()}`,status:"FAILED",provider:this.id,timestamp:new Date,phoneNumber:c.phoneNumber,error:{code:"INVALID_REQUEST",message:"SMS/LMS message text is required",retryable:!1}};let u=c.options?.senderNumber||this.iwinvConfig.senderNumber||this.iwinvConfig.smsSenderNumber,n=u?this.normalizePhoneNumber(u):"";if(!n)return{messageId:`sms_error_${Date.now()}`,status:"FAILED",provider:this.id,timestamp:new Date,phoneNumber:c.phoneNumber,error:{code:"INVALID_REQUEST",message:"SMS sender number is required",retryable:!1}};let b={version:"1.0",from:n,to:[this.normalizePhoneNumber(c.phoneNumber)],text:$};if(!b.to[0])return{messageId:`sms_error_${Date.now()}`,status:"FAILED",provider:this.id,timestamp:new Date,phoneNumber:c.phoneNumber,error:{code:"INVALID_REQUEST",message:"SMS recipient number is required",retryable:!1}};if(v==="LMS"||v==="MMS")b.title=this.buildLmsTitle(c,$);if(v!=="LMS"&&v!=="MMS")b.msgType=v;if(c.options?.scheduledAt instanceof Date&&!Number.isNaN(c.options.scheduledAt.getTime()))b.date=this.formatSmsReserveDate(c.options.scheduledAt);let g="/api/v2/send/",I=`${this.resolveSmsBaseUrl()}${g}`,_=this.buildSmsSecretHeader();if(!_)return{messageId:`sms_error_${Date.now()}`,status:"FAILED",provider:this.id,timestamp:new Date,phoneNumber:c.phoneNumber,error:{code:"AUTHENTICATION_FAILED",message:"SMS 인증키가 없습니다. IWINV_SMS_AUTH_KEY 또는 IWINV_SMS_API_KEY를 설정하세요.",retryable:!1}};if(this.iwinvConfig.debug)console.log(`[${this.id}] Making request to:`,I),console.log(`[${this.id}] Request data:`,JSON.stringify(b).substring(0,200));try{let U=await fetch(I,{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8",secret:_},body:JSON.stringify(b)}),i=await U.text();if(this.iwinvConfig.debug)console.log(`[${this.id}] Response status:`,U.status),console.log(`[${this.id}] Response body:`,i.substring(0,500));let j;try{j=i?JSON.parse(i):{}}catch{j=i}let t=j&&typeof j==="object"&&!Array.isArray(j)?j:{resultCode:j},P=t.resultCode??t.code,h=this.normalizeCode(P),X=typeof t.message==="string"&&t.message.length>0?t.message:this.mapSmsResponseMessage(h,"SMS send failed"),H=U.ok&&h==="0";return{messageId:typeof t.requestNo==="string"&&t.requestNo.length>0?t.requestNo:typeof t.msgid==="string"&&t.msgid.length>0?t.msgid:`sms_${Date.now()}_${Math.random().toString(36).slice(2,10)}`,status:H?"SENT":"FAILED",provider:this.id,timestamp:new Date,phoneNumber:c.phoneNumber,error:H?void 0:{code:this.mapSmsErrorCode(h,U.ok),message:X,retryable:this.isSmsRetryableCode(h,U.ok),details:{originalCode:P}},metadata:{channel:v,msgType:t.msgType,originalCode:P}}}catch(U){return{messageId:`sms_error_${Date.now()}`,status:"FAILED",provider:this.id,timestamp:new Date,phoneNumber:c.phoneNumber,error:{code:"NETWORK_ERROR",message:U instanceof Error?U.message:"Unknown network error",retryable:!0}}}}}var Ag=(c)=>new q(c),xg=()=>{let c={apiKey:process.env.IWINV_API_KEY||"",smsApiKey:process.env.IWINV_SMS_API_KEY,smsAuthKey:process.env.IWINV_SMS_AUTH_KEY,baseUrl:process.env.IWINV_BASE_URL||"https://alimtalk.bizservice.iwinv.kr",smsBaseUrl:process.env.IWINV_SMS_BASE_URL,senderNumber:process.env.IWINV_SENDER_NUMBER||process.env.IWINV_SMS_SENDER_NUMBER,sendEndpoint:process.env.IWINV_SEND_ENDPOINT||"/api/v2/send/",ipRetryCount:process.env.IWINV_IP_RETRY_COUNT?Number(process.env.IWINV_IP_RETRY_COUNT):void 0,ipRetryDelayMs:process.env.IWINV_IP_RETRY_DELAY_MS?Number(process.env.IWINV_IP_RETRY_DELAY_MS):void 0,ipAlertWebhookUrl:process.env.IWINV_IP_ALERT_WEBHOOK_URL,debug:!0};if(!c.apiKey)throw Error("IWINV_API_KEY environment variable is required");return Ag(c)};class zg{static create(c){return new q(c)}static createDefault(){return xg()}static getInstance(){return{createProvider:(c)=>new q(c),initialize:()=>{}}}}function P6(){}class kc extends q{constructor(c){super(c)}async sendSMS(c,$,v){return this.send({type:"SMS",templateId:"SMS_DIRECT",to:c,from:v?.senderNumber||"",variables:{message:$},...v})}async sendLMS(c,$,v,u){return this.send({type:"LMS",templateId:"LMS_DIRECT",to:c,from:u?.senderNumber||"",variables:{subject:$,message:v},...u})}async sendBulkSMS(c,$){let v=[],u=$?.batchSize||100;for(let n=0;n<c.length;n+=u){let r=c.slice(n,n+u).map((I)=>this.sendSMS(I.phoneNumber,I.message,{senderNumber:$?.senderNumber,scheduledAt:$?.scheduledAt})),g=await Promise.allSettled(r);v.push(...g)}return v}async sendMessage(c,$,v){if($.length<=90)return this.sendSMS(c,$,v);else{let u=v?.subject||$.substring(0,30)+"...";return this.sendLMS(c,u,$,v)}}}var h6=(c)=>new kc(c),A6=()=>{let c={apiKey:process.env.IWINV_API_KEY||"",baseUrl:process.env.IWINV_BASE_URL||"https://alimtalk.bizservice.iwinv.kr",debug:!0};if(!c.apiKey)throw Error("IWINV_API_KEY environment variable is required");return new kc(c)};class Gn{alimtalkProvider;smsProvider;config;constructor(c){this.config=c,this.alimtalkProvider=new q(c),this.smsProvider=new kc(c)}get id(){return"iwinv-multi"}get name(){return"IWINV Multi Channel Provider"}get version(){return"1.0.0"}get type(){return"messaging"}getAlimTalkProvider(){return this.alimtalkProvider}getSMSProvider(){return this.smsProvider}async send(c){switch(c.channel||"auto"){case"alimtalk":return this.alimtalkProvider.send(c);case"sms":return this.smsProvider.send(c);case"auto":default:if(c.templateCode&&c.templateCode!=="SMS_DIRECT"&&c.templateCode!=="LMS_DIRECT")try{return await this.alimtalkProvider.send(c)}catch(v){return console.warn("AlimTalk failed, falling back to SMS:",v),this.smsProvider.send(c)}else return this.smsProvider.send(c)}}async sendAlimTalk(c,$,v,u){return this.alimtalkProvider.send({type:"ALIMTALK",templateId:c,to:$,from:u?.senderNumber||this.config.senderNumber||"",variables:v,...u})}async sendSMS(c,$,v){return this.smsProvider.sendSMS(c,$,v)}async sendLMS(c,$,v,u){return this.smsProvider.sendLMS(c,$,v,u)}async sendWithFallback(c){try{return{...await this.sendAlimTalk(c.templateCode,c.phoneNumber,c.variables,c.options),channel:"alimtalk"}}catch($){console.warn("AlimTalk failed, attempting SMS fallback:",$);let v=c.fallbackMessage||Object.entries(c.variables).map(([n,b])=>`${n}: ${b}`).join(", ");return{...await this.sendSMS(c.phoneNumber,v,c.options),channel:"sms"}}}async sendBulk(c,$){let v=$?.batchSize||100,u=$?.concurrency||5,n=[];for(let b=0;b<c.length;b+=v){let r=c.slice(b,b+v),g=Array(u).fill(null),I=r.map(async(U,i)=>{let j=i%u;await g[j];let t=this.send(U);return g[j]=t,t}),_=await Promise.allSettled(I);n.push(..._.map((U)=>U.status==="fulfilled"?U.value:{messageId:`error_${Date.now()}`,status:"FAILED",provider:this.id,timestamp:new Date,phoneNumber:"",error:{code:"UNKNOWN_ERROR",message:U.status==="rejected"?U.reason?.message||"Unknown error":"Unknown error",retryable:!0}}))}return n}async healthCheck(){let[c,$]=await Promise.allSettled([this.alimtalkProvider.healthCheck(),this.smsProvider.healthCheck()]),v=[];if(c.status==="rejected")v.push(`AlimTalk: ${c.reason?.message||"Health check failed"}`);else if(!c.value.healthy)v.push(`AlimTalk: ${c.value.issues.join(", ")}`);if($.status==="rejected")v.push(`SMS: ${$.reason?.message||"Health check failed"}`);else if(!$.value.healthy)v.push(`SMS: ${$.value.issues.join(", ")}`);return{healthy:v.length===0,issues:v,data:{alimtalk:c.status==="fulfilled"?c.value:null,sms:$.status==="fulfilled"?$.value:null}}}getSupportedFeatures(){return["alimtalk","sms","lms","multi_channel","auto_fallback","bulk_messaging","scheduled_messaging"]}getCapabilities(){return{channels:["alimtalk","sms","lms"],maxRecipientsPerRequest:1000,maxRequestsPerSecond:100,supportsBulk:!0,supportsScheduling:!0,supportsTemplating:!0,supportsAutoFallback:!0,supportsWebhooks:!1}}}var x6=(c)=>new Gn(c),z6=()=>{let c={apiKey:process.env.IWINV_API_KEY||"",baseUrl:process.env.IWINV_BASE_URL||"https://alimtalk.bizservice.iwinv.kr",debug:!0};if(!c.apiKey)throw Error("IWINV_API_KEY environment variable is required");return new Gn(c)};class Pc{static toStandardRequest(c){let $={};for(let[v,u]of Object.entries(c.variables))$[v]=String(u);return{templateCode:c.templateCode,phoneNumber:c.phoneNumber,variables:$,options:c.options?{scheduledAt:c.options.scheduledAt,priority:c.options.priority,senderNumber:c.options.senderNumber,subject:c.options.subject}:void 0}}static toTypedResult(c,$,v){return{messageId:c.messageId,templateCode:$,phoneNumber:c.phoneNumber,channel:Pc.inferChannel($,c),status:Pc.mapStandardStatus(c.status),timestamp:c.timestamp,variables:v,error:c.error?{code:c.error.code,message:c.error.message,retryable:c.error.retryable}:void 0}}static inferChannel(c,$){let v=hc[c];if($.metadata&&"channel"in $.metadata){let u=$.metadata.channel;if(v.channels.includes(u))return u}return v.channels[0]}static mapStandardStatus(c){switch(c){case"SENT":case"DELIVERED":return"sent";case"PENDING":return"pending";case"FAILED":case"CANCELLED":default:return"failed"}}}class Jg{provider;constructor(c){this.provider=c}async send(c){let $=gc.validateVariables(c.templateCode,c.variables);if(!$.isValid)throw Error(`Template validation failed: ${$.errors.join(", ")}`);if(c.options?.channel&&!gc.validateChannel(c.templateCode,c.options.channel))throw Error(`Channel '${c.options.channel}' not supported for template '${c.templateCode}'`);let v=Pc.toStandardRequest(c),u=await this.provider.send(v);return Pc.toTypedResult(u,c.templateCode,$.validatedVariables)}async sendBulk(c,$){let{batchSize:v=50,concurrency:u=5,failFast:n=!1}=$||{},b=[];for(let r=0;r<c.length;r+=v){let g=c.slice(r,r+v),I=g.map(async(i)=>{try{return await this.send(i)}catch(j){if(n)throw j;return{messageId:`error_${Date.now()}_${Math.random()}`,templateCode:i.templateCode,phoneNumber:i.phoneNumber,channel:hc[i.templateCode].channels[0],status:"failed",timestamp:new Date,variables:i.variables,error:{code:"SEND_FAILED",message:j instanceof Error?j.message:"Unknown error",retryable:!0}}}}),U=(await Promise.allSettled(I)).map((i,j)=>{if(i.status==="fulfilled")return i.value;else{let t=g[j];return{messageId:`error_${Date.now()}_${Math.random()}`,templateCode:t.templateCode,phoneNumber:t.phoneNumber,channel:hc[t.templateCode].channels[0],status:"failed",timestamp:new Date,variables:t.variables,error:{code:"SEND_FAILED",message:i.reason instanceof Error?i.reason.message:"Unknown error",retryable:!0}}}});b.push(...U)}return b}async getStatus(c){if(!this.provider.getStatus)throw Error("Provider does not support status check");return this.provider.getStatus(c)}getUnderlyingProvider(){return this.provider}}var hc={WELCOME_001:{templateCode:"WELCOME_001",name:"환영 메시지",description:"신규 가입자를 위한 환영 메시지",channels:["alimtalk"],variables:{name:{type:"string",required:!0,description:"사용자 이름",validation:{minLength:1,maxLength:50}},service:{type:"string",required:!0,description:"서비스 이름",validation:{minLength:1,maxLength:100}},date:{type:"date",required:!0,description:"가입 날짜"}},metadata:{category:"onboarding",version:"1.0",author:"K-MSG Team"}},OTP_AUTH_001:{templateCode:"OTP_AUTH_001",name:"OTP 인증",description:"본인 인증을 위한 OTP 코드 발송",channels:["alimtalk","sms"],variables:{code:{type:"string",required:!0,description:"6자리 인증 코드",validation:{pattern:/^\d{6}$/,minLength:6,maxLength:6}},expiry:{type:"string",required:!0,description:"만료 시간",validation:{minLength:1,maxLength:20}},serviceName:{type:"string",required:!1,description:"서비스 이름",defaultValue:"K-MSG"}},metadata:{category:"authentication",version:"1.0"}},ORDER_CONFIRM_001:{templateCode:"ORDER_CONFIRM_001",name:"주문 확인",description:"주문 완료 확인 메시지",channels:["alimtalk"],variables:{orderNumber:{type:"string",required:!0,description:"주문 번호",validation:{pattern:/^ORD-\d+$/}},productName:{type:"string",required:!0,description:"상품명",validation:{minLength:1,maxLength:200}},amount:{type:"string",required:!0,description:"결제 금액",validation:{pattern:/^[\d,]+원?$/}},deliveryDate:{type:"date",required:!0,description:"배송 예정일"},customerName:{type:"string",required:!0,description:"고객명",validation:{minLength:1,maxLength:50}}},metadata:{category:"commerce",version:"1.0"}},PAYMENT_COMPLETE_001:{templateCode:"PAYMENT_COMPLETE_001",name:"결제 완료",description:"결제 완료 알림 메시지",channels:["alimtalk","sms"],variables:{amount:{type:"string",required:!0,description:"결제 금액"},paymentMethod:{type:"string",required:!0,description:"결제 수단"},transactionId:{type:"string",required:!0,description:"거래 ID"},customerName:{type:"string",required:!0,description:"고객명"}},metadata:{category:"commerce",version:"1.0"}},SMS_DIRECT:{templateCode:"SMS_DIRECT",name:"SMS 직접 발송",description:"템플릿 없이 SMS 직접 발송",channels:["sms"],variables:{message:{type:"string",required:!0,description:"SMS 메시지",validation:{maxLength:90}}},metadata:{category:"direct",version:"1.0"}},LMS_DIRECT:{templateCode:"LMS_DIRECT",name:"LMS 직접 발송",description:"템플릿 없이 LMS 직접 발송",channels:["sms"],variables:{subject:{type:"string",required:!0,description:"LMS 제목",validation:{maxLength:40}},message:{type:"string",required:!0,description:"LMS 메시지",validation:{maxLength:2000}}},metadata:{category:"direct",version:"1.0"}},EMERGENCY_NOTIFICATION:{templateCode:"EMERGENCY_NOTIFICATION",name:"긴급 알림",description:"긴급 상황 알림 메시지",channels:["alimtalk","sms","mms"],variables:{alertType:{type:"string",required:!0,description:"알림 유형"},message:{type:"string",required:!0,description:"알림 메시지"},contactInfo:{type:"string",required:!0,description:"연락처 정보"},urgencyLevel:{type:"string",required:!0,description:"긴급도",validation:{pattern:/^(LOW|MEDIUM|HIGH|CRITICAL)$/}}},metadata:{category:"emergency",version:"1.0"}}};class gc{static validateVariables(c,$){let v=hc[c],u=[],n=[];for(let[b,r]of Object.entries(v.variables)){if(r.required&&!(b in $)){u.push(`Required variable '${b}' is missing`);continue}let g=$[b];if(g===void 0||g===null){if(r.required)u.push(`Required variable '${b}' cannot be null or undefined`);continue}if(!gc.validateType(g,r.type)){u.push(`Variable '${b}' must be of type ${r.type}`);continue}let I=gc.validateValue(b,g,r);u.push(...I)}for(let b of Object.keys($))if(!(b in v.variables))n.push(`Unknown variable '${b}' will be ignored`);return{isValid:u.length===0,errors:u,warnings:n,validatedVariables:gc.applyDefaults($,v)}}static validateChannel(c,$){return hc[c].channels.includes($)}static validateType(c,$){switch($){case"string":return typeof c==="string";case"number":return typeof c==="number"&&!isNaN(c);case"boolean":return typeof c==="boolean";case"date":return typeof c==="string"&&!isNaN(Date.parse(c));case"phoneNumber":return typeof c==="string"&&/^[0-9-+\s()]+$/.test(c);case"url":try{return new URL(c),!0}catch{return!1}case"email":return typeof c==="string"&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(c);default:return!1}}static validateValue(c,$,v){let u=[];if(!v.validation)return u;let{pattern:n,minLength:b,maxLength:r,min:g,max:I}=v.validation;if(typeof $==="string"){if(n&&!n.test($))u.push(`Variable '${c}' does not match required pattern`);if(b!==void 0&&$.length<b)u.push(`Variable '${c}' must be at least ${b} characters long`);if(r!==void 0&&$.length>r)u.push(`Variable '${c}' must be at most ${r} characters long`)}if(typeof $==="number"){if(g!==void 0&&$<g)u.push(`Variable '${c}' must be at least ${g}`);if(I!==void 0&&$>I)u.push(`Variable '${c}' must be at most ${I}`)}return u}static applyDefaults(c,$){let v={...c};for(let[u,n]of Object.entries($.variables))if(!(u in v)&&n.defaultValue!==void 0)v[u]=n.defaultValue;return v}}function J6(c){return typeof c==="object"&&c!==null&&"environment"in c&&["development","staging","production"].includes(c.environment)}function H6(c){return J6(c)&&"apiKey"in c&&typeof c.apiKey==="string"&&"baseUrl"in c&&typeof c.baseUrl==="string"}function Hg(c){return J6(c)&&typeof c==="object"&&c!==null&&"provider"in c&&typeof c.provider==="object"&&c.provider!==null&&"apiKey"in c.provider&&"baseUrl"in c.provider}class Ac{config={};static create(){return new Ac}environment(c){return this.config.environment=c,this}provider(c,$){return this.config.provider={type:"iwinv",apiKey:c,baseUrl:$},this}alimtalk(c){if(!this.config.channels)this.config.channels={};return this.config.channels.alimtalk=c,this}sms(c){if(!this.config.channels)this.config.channels={};return this.config.channels.sms=c,this}mms(c){if(!this.config.channels)this.config.channels={};return this.config.channels.mms=c,this}performance(c){return this.config.performance=c,this}monitoring(c){return this.config.monitoring=c,this}multiChannel(c,$){return this.config.multiChannel={defaultChannel:c,fallbackChain:$},this}build(){if(!Hg(this.config))throw Error("Invalid configuration: missing required fields");return this.config}}class Xg{static development(c,$){return Ac.create().environment("development").provider(c,$||"https://alimtalk.bizservice.iwinv.kr").performance({rateLimiting:{requestsPerSecond:10,burstSize:20,strategy:"token_bucket"},circuitBreaker:{enabled:!0,failureThreshold:5,timeoutMs:30000,retryDelayMs:5000},caching:{enabled:!0,ttl:300000,maxSize:1000}}).monitoring({enableMetrics:!0,enableTracing:!0,enableHealthChecks:!0,metricsInterval:60000}).build()}static production(c,$){return Ac.create().environment("production").provider(c,$||"https://alimtalk.bizservice.iwinv.kr").performance({rateLimiting:{requestsPerSecond:100,burstSize:200,strategy:"token_bucket"},circuitBreaker:{enabled:!0,failureThreshold:10,timeoutMs:60000,retryDelayMs:30000},caching:{enabled:!0,ttl:600000,maxSize:1e4},connectionPool:{maxConnections:50,idleTimeout:60000,connectionTimeout:1e4}}).monitoring({enableMetrics:!0,enableTracing:!1,enableHealthChecks:!0,metricsInterval:30000}).build()}static fromEnvironment(){let c=process.env.IWINV_API_KEY,$=process.env.IWINV_BASE_URL,v="development";if(!c)throw Error("IWINV_API_KEY environment variable is required");return Ac.create().environment("development").provider(c,$||"https://alimtalk.bizservice.iwinv.kr").performance({rateLimiting:{requestsPerSecond:10,burstSize:20,strategy:"token_bucket"},circuitBreaker:{enabled:!0,failureThreshold:5,timeoutMs:30000,retryDelayMs:5000},caching:{enabled:!0,ttl:300000,maxSize:1000}}).monitoring({enableMetrics:!0,enableTracing:!0,enableHealthChecks:!0}).build()}}function X6(c){return{apiKey:c.provider.apiKey,baseUrl:c.provider.baseUrl,environment:c.environment,debug:c.debug,logLevel:c.logLevel,timeout:c.timeout,userId:c.channels?.alimtalk?.userId||c.channels?.sms?.userId,senderNumber:c.channels?.alimtalk?.senderNumber||c.channels?.sms?.senderNumber}}var xc={AUTHENTICATION_FAILED:"AUTHENTICATION_FAILED",INVALID_REQUEST:"INVALID_REQUEST",TEMPLATE_NOT_FOUND:"TEMPLATE_NOT_FOUND",RATE_LIMIT_EXCEEDED:"RATE_LIMIT_EXCEEDED",NETWORK_ERROR:"NETWORK_ERROR",PROVIDER_ERROR:"PROVIDER_ERROR",UNKNOWN_ERROR:"UNKNOWN_ERROR"},B$;((i)=>{i.SYSTEM="SYSTEM";i.NETWORK="NETWORK";i.CONFIGURATION="CONFIGURATION";i.AUTHENTICATION="AUTHENTICATION";i.AUTHORIZATION="AUTHORIZATION";i.VALIDATION="VALIDATION";i.BUSINESS_LOGIC="BUSINESS_LOGIC";i.PROVIDER="PROVIDER";i.TEMPLATE="TEMPLATE";i.RATE_LIMIT="RATE_LIMIT";i.UNKNOWN="UNKNOWN"})(B$||={});var F$;((n)=>{n.LOW="LOW";n.MEDIUM="MEDIUM";n.HIGH="HIGH";n.CRITICAL="CRITICAL"})(F$||={});class E extends Error{category;severity;retryable;timestamp;context;constructor(c){super(c.message);this.name=this.constructor.name,this.category=c.category,this.severity=c.severity,this.retryable=c.retryable,this.timestamp=c.timestamp,this.context=c.context||{}}toStandardError(){return{code:this.mapToStandardErrorCode(),message:this.message,retryable:this.retryable,details:{category:this.category,severity:this.severity,timestamp:this.timestamp,context:this.context}}}mapToStandardErrorCode(){switch(this.category){case"AUTHENTICATION":return xc.AUTHENTICATION_FAILED;case"VALIDATION":return xc.INVALID_REQUEST;case"TEMPLATE":return xc.TEMPLATE_NOT_FOUND;case"RATE_LIMIT":return xc.RATE_LIMIT_EXCEEDED;case"NETWORK":return xc.NETWORK_ERROR;case"PROVIDER":return xc.PROVIDER_ERROR;default:return xc.UNKNOWN_ERROR}}}class Tc extends E{provider;originalCode;originalMessage;endpoint;requestId;constructor(c){super(c);this.provider=c.provider,this.originalCode=c.originalCode,this.originalMessage=c.originalMessage,this.endpoint=c.endpoint,this.requestId=c.requestId}}class Ln extends E{templateCode;templateName;validationErrors;missingVariables;constructor(c){super(c);this.templateCode=c.templateCode,this.templateName=c.templateName,this.validationErrors=c.validationErrors,this.missingVariables=c.missingVariables}}class Ec extends E{url;method;statusCode;timeout;connectionRefused;constructor(c){super(c);this.url=c.url,this.method=c.method,this.statusCode=c.statusCode,this.timeout=c.timeout,this.connectionRefused=c.connectionRefused}}class Gg{static createProviderError(c){return new Tc({code:`PROVIDER_${c.provider.toUpperCase()}_ERROR`,message:c.message,category:"PROVIDER",severity:"HIGH",retryable:c.retryable??!0,timestamp:new Date,context:c.context,provider:c.provider,originalCode:c.originalCode,originalMessage:c.originalMessage,endpoint:c.endpoint})}static createTemplateError(c){return new Ln({code:"TEMPLATE_ERROR",message:c.message,category:"TEMPLATE",severity:"MEDIUM",retryable:c.retryable??!1,timestamp:new Date,templateCode:c.templateCode,validationErrors:c.validationErrors,missingVariables:c.missingVariables})}static createNetworkError(c){let $=c.statusCode?c.statusCode>=500||c.statusCode===429:!0;return new Ec({code:"NETWORK_ERROR",message:c.message,category:"NETWORK",severity:c.statusCode&&c.statusCode>=500?"HIGH":"MEDIUM",retryable:$,timestamp:new Date,url:c.url,method:c.method,statusCode:c.statusCode,timeout:c.timeout,connectionRefused:c.connectionRefused})}static createAuthenticationError(c="Authentication failed"){return new E({code:"AUTHENTICATION_FAILED",message:c,category:"AUTHENTICATION",severity:"HIGH",retryable:!1,timestamp:new Date})}static createValidationError(c,$){return new E({code:"VALIDATION_ERROR",message:c,category:"VALIDATION",severity:"MEDIUM",retryable:!1,timestamp:new Date,context:$})}static createRateLimitError(c="Rate limit exceeded",$){return new E({code:"RATE_LIMIT_EXCEEDED",message:c,category:"RATE_LIMIT",severity:"MEDIUM",retryable:!0,timestamp:new Date,context:$?{retryAfter:$}:void 0})}}class Lg{static toUnifiedError(c,$){if(c instanceof E)return c;if(c instanceof Error)return new E({code:"GENERIC_ERROR",message:c.message,category:"UNKNOWN",severity:"MEDIUM",retryable:!1,timestamp:new Date,context:{...$,originalName:c.name,originalStack:c.stack}});if(typeof c==="string")return new E({code:"STRING_ERROR",message:c,category:"UNKNOWN",severity:"LOW",retryable:!1,timestamp:new Date,context:$});return new E({code:"UNKNOWN_ERROR",message:"An unknown error occurred",category:"UNKNOWN",severity:"MEDIUM",retryable:!1,timestamp:new Date,context:{...$,originalError:c}})}static fromIWINVError(c){let $=c.code>=500||c.code===429,v=c.code>=500?"HIGH":"MEDIUM";return new Tc({code:`IWINV_${c.code}`,message:c.message,category:"PROVIDER",severity:v,retryable:$,timestamp:new Date,provider:"iwinv",originalCode:c.code,originalMessage:c.message,context:c.data?{data:c.data}:void 0})}static fromHttpError(c){let{url:$,method:v,statusCode:u,statusText:n,responseBody:b}=c,r=u>=500||u===429;return new Ec({code:`HTTP_${u}`,message:`HTTP ${u}: ${n||"Unknown error"}`,category:"NETWORK",severity:u>=500?"HIGH":"MEDIUM",retryable:r,timestamp:new Date,url:$,method:v,statusCode:u,context:b?{responseBody:b}:void 0})}}function Wg(c){return c instanceof E}function G6(c){return c instanceof Tc}function L6(c){return c instanceof Ln}function W6(c){return c instanceof Ec}function B6(c){if(Wg(c))return c.retryable;return c instanceof Error&&(c.message.includes("network")||c.message.includes("timeout")||c.message.includes("ECONNREFUSED"))}class Bg{static analyze(c){let $={total:c.length,byCategory:{},bySeverity:{},retryable:0,nonRetryable:0};return Object.values(B$).forEach((v)=>{$.byCategory[v]=0}),Object.values(F$).forEach((v)=>{$.bySeverity[v]=0}),c.forEach((v)=>{if($.byCategory[v.category]++,$.bySeverity[v.severity]++,v.retryable)$.retryable++;else $.nonRetryable++}),$}static getCriticalErrors(c){return c.filter(($)=>$.severity==="CRITICAL"||$.severity==="HIGH")}static getRetryableErrors(c){return c.filter(($)=>$.retryable)}}
|
|
1816
23
|
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
id = "iwinv";
|
|
1820
|
-
name = "IWINV AlimTalk Provider";
|
|
1821
|
-
capabilities = {
|
|
1822
|
-
templates: {
|
|
1823
|
-
maxLength: 1e3,
|
|
1824
|
-
maxVariables: 20,
|
|
1825
|
-
maxButtons: 5,
|
|
1826
|
-
supportedButtonTypes: ["WL", "AL", "DB", "BK", "MD"],
|
|
1827
|
-
requiresApproval: true,
|
|
1828
|
-
approvalTime: "1-2 days"
|
|
1829
|
-
},
|
|
1830
|
-
messaging: {
|
|
1831
|
-
maxRecipientsPerRequest: 1,
|
|
1832
|
-
maxRequestsPerSecond: 100,
|
|
1833
|
-
supportsBulk: false,
|
|
1834
|
-
// IWINV doesn't have native bulk API
|
|
1835
|
-
supportsScheduling: true,
|
|
1836
|
-
maxScheduleDays: 30,
|
|
1837
|
-
supportsFallback: true
|
|
1838
|
-
},
|
|
1839
|
-
channels: {
|
|
1840
|
-
requiresBusinessVerification: true,
|
|
1841
|
-
maxSenderNumbers: 10,
|
|
1842
|
-
supportsMultipleChannels: false
|
|
1843
|
-
}
|
|
1844
|
-
};
|
|
1845
|
-
// Contract implementations
|
|
1846
|
-
templates;
|
|
1847
|
-
channels;
|
|
1848
|
-
messaging;
|
|
1849
|
-
analytics;
|
|
1850
|
-
account;
|
|
1851
|
-
constructor(config) {
|
|
1852
|
-
super(config);
|
|
1853
|
-
const iwinvConfig = this.getIWINVConfig();
|
|
1854
|
-
this.templates = new IWINVTemplateContract(iwinvConfig);
|
|
1855
|
-
this.channels = new IWINVChannelContract(iwinvConfig);
|
|
1856
|
-
this.messaging = new IWINVMessagingContract(iwinvConfig);
|
|
1857
|
-
this.analytics = new IWINVAnalyticsContract(iwinvConfig);
|
|
1858
|
-
this.account = new IWINVAccountContract(iwinvConfig);
|
|
1859
|
-
}
|
|
1860
|
-
getConfigurationSchema() {
|
|
1861
|
-
return {
|
|
1862
|
-
required: [
|
|
1863
|
-
{
|
|
1864
|
-
key: "apiKey",
|
|
1865
|
-
name: "IWINV API Key",
|
|
1866
|
-
type: "password",
|
|
1867
|
-
description: "Your IWINV API key",
|
|
1868
|
-
required: true,
|
|
1869
|
-
validation: {
|
|
1870
|
-
pattern: "^[a-zA-Z0-9-_]+$",
|
|
1871
|
-
min: 10
|
|
1872
|
-
}
|
|
1873
|
-
}
|
|
1874
|
-
],
|
|
1875
|
-
optional: [
|
|
1876
|
-
{
|
|
1877
|
-
key: "baseUrl",
|
|
1878
|
-
name: "Base URL",
|
|
1879
|
-
type: "url",
|
|
1880
|
-
description: "IWINV API base URL",
|
|
1881
|
-
required: false,
|
|
1882
|
-
default: "https://alimtalk.bizservice.iwinv.kr",
|
|
1883
|
-
validation: {
|
|
1884
|
-
pattern: "^https?://.+"
|
|
1885
|
-
}
|
|
1886
|
-
},
|
|
1887
|
-
{
|
|
1888
|
-
key: "debug",
|
|
1889
|
-
name: "Debug Mode",
|
|
1890
|
-
type: "boolean",
|
|
1891
|
-
description: "Enable debug logging",
|
|
1892
|
-
required: false,
|
|
1893
|
-
default: false
|
|
1894
|
-
}
|
|
1895
|
-
]
|
|
1896
|
-
};
|
|
1897
|
-
}
|
|
1898
|
-
async testConnectivity() {
|
|
1899
|
-
const config = this.getIWINVConfig();
|
|
1900
|
-
try {
|
|
1901
|
-
const response = await fetch(`${config.baseUrl}/balance`, {
|
|
1902
|
-
method: "GET",
|
|
1903
|
-
headers: {
|
|
1904
|
-
"Authorization": `Bearer ${config.apiKey}`
|
|
1905
|
-
}
|
|
1906
|
-
});
|
|
1907
|
-
if (!response.ok) {
|
|
1908
|
-
throw new Error(`Connectivity test failed: ${response.status} ${response.statusText}`);
|
|
1909
|
-
}
|
|
1910
|
-
} catch (error) {
|
|
1911
|
-
throw new Error(`Cannot connect to IWINV API: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
1912
|
-
}
|
|
1913
|
-
}
|
|
1914
|
-
async testAuthentication() {
|
|
1915
|
-
const config = this.getIWINVConfig();
|
|
1916
|
-
try {
|
|
1917
|
-
const response = await fetch(`${config.baseUrl}/balance`, {
|
|
1918
|
-
method: "GET",
|
|
1919
|
-
headers: {
|
|
1920
|
-
"Authorization": `Bearer ${config.apiKey}`
|
|
1921
|
-
}
|
|
1922
|
-
});
|
|
1923
|
-
if (response.status === 401 || response.status === 403) {
|
|
1924
|
-
throw new Error("Invalid API key or insufficient permissions");
|
|
1925
|
-
}
|
|
1926
|
-
if (!response.ok) {
|
|
1927
|
-
const result = await response.json().catch(() => ({}));
|
|
1928
|
-
throw new Error(`Authentication failed: ${result.message || response.statusText}`);
|
|
1929
|
-
}
|
|
1930
|
-
} catch (error) {
|
|
1931
|
-
if (error instanceof Error && error.message.includes("Authentication failed")) {
|
|
1932
|
-
throw error;
|
|
1933
|
-
}
|
|
1934
|
-
throw new Error(`Authentication test failed: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
1935
|
-
}
|
|
1936
|
-
}
|
|
1937
|
-
getVersion() {
|
|
1938
|
-
return "2.0.0";
|
|
1939
|
-
}
|
|
1940
|
-
/**
|
|
1941
|
-
* Get IWINV-specific configuration
|
|
1942
|
-
*/
|
|
1943
|
-
getIWINVConfig() {
|
|
1944
|
-
return {
|
|
1945
|
-
apiKey: this.getConfig("apiKey"),
|
|
1946
|
-
baseUrl: this.getConfig("baseUrl") || "https://alimtalk.bizservice.iwinv.kr",
|
|
1947
|
-
debug: this.getConfig("debug") || false
|
|
1948
|
-
};
|
|
1949
|
-
}
|
|
1950
|
-
/**
|
|
1951
|
-
* IWINV-specific methods for backward compatibility
|
|
1952
|
-
*/
|
|
1953
|
-
/**
|
|
1954
|
-
* Send AlimTalk message (legacy method)
|
|
1955
|
-
*/
|
|
1956
|
-
async sendMessage(options) {
|
|
1957
|
-
return this.messaging.send({
|
|
1958
|
-
templateCode: options.templateCode,
|
|
1959
|
-
phoneNumber: options.phoneNumber,
|
|
1960
|
-
variables: options.variables,
|
|
1961
|
-
senderNumber: options.senderNumber
|
|
1962
|
-
});
|
|
1963
|
-
}
|
|
1964
|
-
/**
|
|
1965
|
-
* Get account balance (legacy method)
|
|
1966
|
-
*/
|
|
1967
|
-
async getBalance() {
|
|
1968
|
-
return this.account.getBalance();
|
|
1969
|
-
}
|
|
1970
|
-
/**
|
|
1971
|
-
* List templates (legacy method)
|
|
1972
|
-
*/
|
|
1973
|
-
async listTemplates(filters) {
|
|
1974
|
-
return this.templates.list(filters);
|
|
1975
|
-
}
|
|
1976
|
-
};
|
|
1977
|
-
export {
|
|
1978
|
-
AligoRequestAdapter,
|
|
1979
|
-
AligoResponseAdapter,
|
|
1980
|
-
BaseAlimTalkProvider,
|
|
1981
|
-
BasePlugin,
|
|
1982
|
-
BaseRequestAdapter,
|
|
1983
|
-
BaseResponseAdapter,
|
|
1984
|
-
IWINVProvider,
|
|
1985
|
-
IWINVRequestAdapter,
|
|
1986
|
-
IWINVResponseAdapter,
|
|
1987
|
-
KakaoRequestAdapter,
|
|
1988
|
-
KakaoResponseAdapter,
|
|
1989
|
-
NHNResponseAdapter,
|
|
1990
|
-
PluginRegistry,
|
|
1991
|
-
ProviderManager,
|
|
1992
|
-
RequestAdapterFactory,
|
|
1993
|
-
ResponseAdapterFactory,
|
|
1994
|
-
createCircuitBreakerMiddleware,
|
|
1995
|
-
createLoggingMiddleware,
|
|
1996
|
-
createMetricsMiddleware,
|
|
1997
|
-
createRateLimitMiddleware,
|
|
1998
|
-
createRetryMiddleware,
|
|
1999
|
-
delay,
|
|
2000
|
-
extractVariables,
|
|
2001
|
-
formatDateTime,
|
|
2002
|
-
normalizePhoneNumber,
|
|
2003
|
-
parseTemplate,
|
|
2004
|
-
retry,
|
|
2005
|
-
validatePhoneNumber
|
|
2006
|
-
};
|
|
2007
|
-
//# sourceMappingURL=index.js.map
|
|
24
|
+
//# debugId=0ADE6620BF8A92FB64756E2164756E21
|
|
25
|
+
//# sourceMappingURL=index.js.map
|