@dynamoi/mcp 1.0.1 → 1.0.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.
Files changed (73) hide show
  1. package/CAPABILITY_PARITY.md +20 -13
  2. package/CHANGELOG.md +105 -0
  3. package/README.md +33 -4
  4. package/dist/auth/protected-resource.d.ts +11 -1
  5. package/dist/auth/protected-resource.js +106 -11
  6. package/dist/consent.d.ts +83 -4
  7. package/dist/consent.js +61 -11
  8. package/dist/flow-types.d.ts +73 -3
  9. package/dist/index.d.ts +14 -6
  10. package/dist/index.js +2571 -616
  11. package/dist/readiness-types.d.ts +21 -1
  12. package/dist/server/about.d.ts +17 -14
  13. package/dist/server/account-schema.generated.d.ts +62 -0
  14. package/dist/server/channel-results-schema.d.ts +104 -0
  15. package/dist/server/create-server.d.ts +40 -30
  16. package/dist/server/distribution-tools.d.ts +30 -23
  17. package/dist/server/messaging.d.ts +0 -1
  18. package/dist/server/openai-tools.d.ts +30 -23
  19. package/dist/server/output-schemas.d.ts +367 -75
  20. package/dist/server/shop-tools.d.ts +36 -29
  21. package/dist/server/smart-link-tools.d.ts +511 -73
  22. package/dist/server/tools.d.ts +740 -220
  23. package/dist/server/workflow-tools.d.ts +97 -86
  24. package/dist/server/workspace/data.d.ts +67 -0
  25. package/dist/server/workspace/tool.d.ts +82 -0
  26. package/dist/server/youtube-channel-data-schema.d.ts +105 -0
  27. package/dist/server/youtube-strategy-guide.d.ts +103 -0
  28. package/dist/transport/http.d.ts +0 -1
  29. package/dist/types.d.ts +131 -12
  30. package/dist/version.d.ts +0 -1
  31. package/dist/youtube-metrics.d.ts +135 -0
  32. package/dist/youtube-metrics.js +114 -0
  33. package/package.json +48 -12
  34. package/server.json +1 -1
  35. package/dist/auth/protected-resource.d.ts.map +0 -1
  36. package/dist/auth/protected-resource.js.map +0 -9
  37. package/dist/chunk-3htwe57a.js +0 -85
  38. package/dist/chunk-3htwe57a.js.map +0 -10
  39. package/dist/chunk-n5xmtwjj.js +0 -9
  40. package/dist/chunk-n5xmtwjj.js.map +0 -10
  41. package/dist/consent.d.ts.map +0 -1
  42. package/dist/consent.js.map +0 -9
  43. package/dist/flow-types.d.ts.map +0 -1
  44. package/dist/index.d.ts.map +0 -1
  45. package/dist/index.js.map +0 -28
  46. package/dist/readiness-types.d.ts.map +0 -1
  47. package/dist/server/about.d.ts.map +0 -1
  48. package/dist/server/create-server.d.ts.map +0 -1
  49. package/dist/server/distribution-tools.d.ts.map +0 -1
  50. package/dist/server/instructions.d.ts +0 -3
  51. package/dist/server/instructions.d.ts.map +0 -1
  52. package/dist/server/messaging.d.ts.map +0 -1
  53. package/dist/server/onboarding-tool-definitions.d.ts +0 -106
  54. package/dist/server/onboarding-tool-definitions.d.ts.map +0 -1
  55. package/dist/server/openai-tools.d.ts.map +0 -1
  56. package/dist/server/output-schemas.d.ts.map +0 -1
  57. package/dist/server/playbook-resources.d.ts +0 -3
  58. package/dist/server/playbook-resources.d.ts.map +0 -1
  59. package/dist/server/prompts.d.ts +0 -3
  60. package/dist/server/prompts.d.ts.map +0 -1
  61. package/dist/server/resources.d.ts +0 -4
  62. package/dist/server/resources.d.ts.map +0 -1
  63. package/dist/server/shared-schemas.d.ts +0 -14
  64. package/dist/server/shared-schemas.d.ts.map +0 -1
  65. package/dist/server/shop-tools.d.ts.map +0 -1
  66. package/dist/server/smart-link-theme-preview.d.ts +0 -73
  67. package/dist/server/smart-link-theme-preview.d.ts.map +0 -1
  68. package/dist/server/smart-link-tools.d.ts.map +0 -1
  69. package/dist/server/tools.d.ts.map +0 -1
  70. package/dist/server/workflow-tools.d.ts.map +0 -1
  71. package/dist/transport/http.d.ts.map +0 -1
  72. package/dist/types.d.ts.map +0 -1
  73. package/dist/version.d.ts.map +0 -1
package/dist/index.js CHANGED
@@ -1,41 +1,952 @@
1
- import {
2
- DYNAMOI_BETTER_AUTH_MCP_SCOPES2,
3
- DYNAMOI_MCP_TOOL_SCOPES2,
4
- buildWwwAuthenticateHeader2
5
- } from "./chunk-3htwe57a.js";
6
- import {
7
- PROSPECTIVE_BUDGET_FUNDING_CONSENT_VERSION2,
8
- PROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY2,
9
- PROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY_HASH2
10
- } from "./chunk-n5xmtwjj.js";
1
+ // src/auth/protected-resource.ts
2
+ var DYNAMOI_BETTER_AUTH_MCP_SCOPES = [
3
+ "dynamoi:read",
4
+ "dynamoi:mcp.full",
5
+ "dynamoi:billing.read",
6
+ "dynamoi:campaign.launch",
7
+ "dynamoi:campaign.write",
8
+ "dynamoi:distribution.apply",
9
+ "dynamoi:distribution.read",
10
+ "dynamoi:platform.read",
11
+ "dynamoi:platform.write",
12
+ "dynamoi:smart_links.write"
13
+ ];
14
+ var DYNAMOI_MCP_TOOL_SCOPES = {
15
+ dynamoi_about: [],
16
+ dynamoi_apply_for_distribution: [
17
+ "dynamoi:read",
18
+ "dynamoi:distribution.apply"
19
+ ],
20
+ dynamoi_create_smart_link_from_spotify: [
21
+ "dynamoi:read",
22
+ "dynamoi:smart_links.write"
23
+ ],
24
+ dynamoi_create_smart_links_from_spotify_artist: [
25
+ "dynamoi:read",
26
+ "dynamoi:smart_links.write"
27
+ ],
28
+ dynamoi_get_account_overview: ["dynamoi:read"],
29
+ dynamoi_get_artist_analytics: ["dynamoi:read"],
30
+ dynamoi_get_audience_analytics: ["dynamoi:read"],
31
+ dynamoi_get_billing: ["dynamoi:read", "dynamoi:billing.read"],
32
+ dynamoi_get_campaign: ["dynamoi:read"],
33
+ dynamoi_get_campaign_readiness: ["dynamoi:read"],
34
+ dynamoi_get_distribution_application: [
35
+ "dynamoi:read",
36
+ "dynamoi:distribution.read"
37
+ ],
38
+ dynamoi_get_growth_audit: ["dynamoi:read"],
39
+ dynamoi_get_platform_status: ["dynamoi:read", "dynamoi:platform.read"],
40
+ dynamoi_get_playlist_analytics: ["dynamoi:read"],
41
+ dynamoi_get_resume_funding: ["dynamoi:read", "dynamoi:billing.read"],
42
+ dynamoi_get_smart_link: ["dynamoi:read"],
43
+ dynamoi_get_youtube_channel_data: ["dynamoi:read"],
44
+ dynamoi_launch_campaign: ["dynamoi:read", "dynamoi:campaign.launch"],
45
+ dynamoi_list_artists: ["dynamoi:read"],
46
+ dynamoi_list_available_countries: ["dynamoi:read"],
47
+ dynamoi_list_campaigns: ["dynamoi:read"],
48
+ dynamoi_list_media_assets: ["dynamoi:read"],
49
+ dynamoi_list_smart_links: ["dynamoi:read"],
50
+ dynamoi_manage_youtube_draft: ["dynamoi:read", "dynamoi:campaign.write"],
51
+ dynamoi_open_workspace: ["dynamoi:read"],
52
+ dynamoi_preview_smart_link_themes: ["dynamoi:read"],
53
+ dynamoi_search: ["dynamoi:read"],
54
+ dynamoi_shop_create_checkout: ["dynamoi:read", "dynamoi:mcp.full"],
55
+ dynamoi_shop_get_quote: ["dynamoi:read", "dynamoi:mcp.full"],
56
+ dynamoi_start_meta_connection: ["dynamoi:read", "dynamoi:platform.write"],
57
+ dynamoi_start_youtube_channel_link: [
58
+ "dynamoi:read",
59
+ "dynamoi:platform.write"
60
+ ],
61
+ dynamoi_update_campaign: ["dynamoi:read", "dynamoi:campaign.write"],
62
+ dynamoi_update_smart_link: ["dynamoi:read", "dynamoi:smart_links.write"],
63
+ dynamoi_update_smart_link_artist_hub_settings: [
64
+ "dynamoi:read",
65
+ "dynamoi:smart_links.write"
66
+ ],
67
+ dynamoi_update_smart_link_artist_settings: [
68
+ "dynamoi:read",
69
+ "dynamoi:smart_links.write"
70
+ ],
71
+ dynamoi_update_smart_link_description: [
72
+ "dynamoi:read",
73
+ "dynamoi:smart_links.write"
74
+ ],
75
+ dynamoi_update_smart_link_release_settings: [
76
+ "dynamoi:read",
77
+ "dynamoi:smart_links.write"
78
+ ],
79
+ fetch: ["dynamoi:read"],
80
+ search: ["dynamoi:read"]
81
+ };
82
+ function buildWwwAuthenticateHeader(options) {
83
+ const scope = options.scope ?? "dynamoi:read";
84
+ const params = [
85
+ `resource_metadata="${escapeHeaderValue(options.resourceMetadataUrl)}"`,
86
+ `scope="${escapeHeaderValue(scope)}"`
87
+ ];
88
+ if (options.error) {
89
+ const errorDescription = options.errorDescription ?? (options.error === "insufficient_scope" ? "Additional Dynamoi permissions are required." : "Sign in to Dynamoi to continue.");
90
+ params.push(`error="${escapeHeaderValue(options.error)}"`, `error_description="${escapeHeaderValue(errorDescription)}"`);
91
+ }
92
+ return `Bearer ${params.join(", ")}`;
93
+ }
94
+ function escapeHeaderValue(value) {
95
+ const containsControlCharacter = Array.from(value).some((character) => {
96
+ const codePoint = character.codePointAt(0) ?? 0;
97
+ return codePoint <= 31 || codePoint === 127;
98
+ });
99
+ if (containsControlCharacter) {
100
+ throw new Error("WWW-Authenticate values cannot contain control characters.");
101
+ }
102
+ return value.replaceAll("\\", "\\\\").replaceAll('"', "\\\"");
103
+ }
104
+ // src/consent.ts
105
+ var PROSPECTIVE_BUDGET_FUNDING_CONSENT_VERSION = "managed-ads-prospective-daily-v7";
106
+ var PROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY = "Charge my default payment method daily for this campaign's budget, after my available credits, until I pause or end it.";
107
+ var PROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY_HASH = "f49b33a4f7e8aa3cc814d5057d03e97eaa0c35a9f3f2bc0315dbd031efa0f356";
108
+ var PROSPECTIVE_BUDGET_FUNDING_CONSENT_V5_VERSION = "managed-ads-prospective-daily-v5";
109
+ var PROSPECTIVE_BUDGET_FUNDING_CONSENT_V5_COPY = "Automatically charge my payment method for this campaign's daily budget, after credits and campaign funds: the rest of today and tomorrow now, then each day ahead, until I pause or end the campaign. Unused funds stay available.";
110
+ var PROSPECTIVE_BUDGET_FUNDING_CONSENT_V5_COPY_HASH = "14a318c6ef3defc44a13aa4813f0af9d3432db1c2910bada98581e762b35f9e2";
111
+ var PROSPECTIVE_BUDGET_FUNDING_CONSENT_V4_VERSION = "managed-ads-prospective-daily-v4";
112
+ var PROSPECTIVE_BUDGET_FUNDING_CONSENT_V4_COPY = "Automatically charge my payment method for this campaign's daily budget, after credits and campaign funds: the rest of today and tomorrow (Pacific time) now, then each day ahead, until I pause or end the campaign. Unused funds stay available.";
113
+ var PROSPECTIVE_BUDGET_FUNDING_CONSENT_V4_COPY_HASH = "e40485780d7b025c7a10bde969a25eecdcb0b4ebf1783251440e870fd8e10a60";
114
+ var PROSPECTIVE_BUDGET_FUNDING_CONSENT_V3_VERSION = "managed-ads-prospective-daily-v3";
115
+ var PROSPECTIVE_BUDGET_FUNDING_CONSENT_V3_COPY = "Authorize automatic card funding for this campaign's daily budget, after available credits and campaign funds. Fund the rest of today and all of tomorrow (Pacific time) now, then each following day up to one hour before it starts, until I pause or end the campaign. Unused funds become available after delivery is reconciled.";
116
+ var PROSPECTIVE_BUDGET_FUNDING_CONSENT_V3_COPY_HASH = "53647786746f962c91f5cad78d8bba531c478109041b2808a4a81efbe380abf1";
117
+ var PROSPECTIVE_BUDGET_FUNDING_CONSENT_V2_VERSION = "managed-ads-prospective-daily-v2";
118
+ var PROSPECTIVE_BUDGET_FUNDING_CONSENT_V2_COPY = "Authorize automatic card funding for this campaign's daily budget, after available credits and campaign funds. Fund the first approximately 24 hours now and each following 24-hour window up to one hour before it starts, until I pause or end the campaign. Unused funds become available after delivery is reconciled.";
119
+ var PROSPECTIVE_BUDGET_FUNDING_CONSENT_V2_COPY_HASH = "06bbd517d58f345a767be9aaeb59f4959d11c6db16e7d07cb889f3ce7950f805";
120
+ var TOTAL_BUDGET_FUNDING_CONSENT_VERSION = "managed-ads-total-daily-v3";
121
+ var TOTAL_BUDGET_FUNDING_CONSENT_COPY = "Charge my default payment method daily for this campaign, after my available credits, up to my total budget.";
122
+ var TOTAL_BUDGET_FUNDING_CONSENT_COPY_HASH = "8bece5f58e0c94b04b35ac1a98f0e8a142ed968bbe34dcc0d51fe52e2c0d75bd";
123
+ function isCurrentTotalBudgetFundingConsent(input) {
124
+ return input.copyVersion === TOTAL_BUDGET_FUNDING_CONSENT_VERSION && input.copyHash === TOTAL_BUDGET_FUNDING_CONSENT_COPY_HASH;
125
+ }
126
+ function isCurrentProspectiveBudgetFundingConsent(input) {
127
+ return input.copyVersion === PROSPECTIVE_BUDGET_FUNDING_CONSENT_VERSION && input.copyHash === PROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY_HASH;
128
+ }
129
+ var PROSPECTIVE_BUDGET_FUNDING_CONSENT_V6_VERSION = "managed-ads-prospective-daily-v6";
130
+ var PROSPECTIVE_BUDGET_FUNDING_CONSENT_V6_COPY = "Charge my default payment method daily for this campaign's budget, until I pause or end it.";
131
+ var PROSPECTIVE_BUDGET_FUNDING_CONSENT_V6_COPY_HASH = "b4c2d0b0eef5a3d54165c4225e9b316d473f07f8581b0715f803575fc815557b";
132
+ var TOTAL_BUDGET_FUNDING_CONSENT_V2_VERSION = "managed-ads-total-daily-v2";
133
+ var TOTAL_BUDGET_FUNDING_CONSENT_V2_COPY = "Charge my default payment method daily for this campaign, up to my total budget.";
134
+ var TOTAL_BUDGET_FUNDING_CONSENT_V2_COPY_HASH = "e6afbb5d76383f9f336f4924caaf51022c686fa5b77bba4e2f480a1d5a118aed";
135
+ function isRenewableProspectiveBudgetFundingConsent(input) {
136
+ return isCurrentProspectiveBudgetFundingConsent(input) || isCurrentTotalBudgetFundingConsent(input) || input.copyVersion === TOTAL_BUDGET_FUNDING_CONSENT_V2_VERSION && input.copyHash === TOTAL_BUDGET_FUNDING_CONSENT_V2_COPY_HASH || input.copyVersion === PROSPECTIVE_BUDGET_FUNDING_CONSENT_V6_VERSION && input.copyHash === PROSPECTIVE_BUDGET_FUNDING_CONSENT_V6_COPY_HASH || input.copyVersion === PROSPECTIVE_BUDGET_FUNDING_CONSENT_V5_VERSION && input.copyHash === PROSPECTIVE_BUDGET_FUNDING_CONSENT_V5_COPY_HASH || input.copyVersion === PROSPECTIVE_BUDGET_FUNDING_CONSENT_V4_VERSION && input.copyHash === PROSPECTIVE_BUDGET_FUNDING_CONSENT_V4_COPY_HASH || input.copyVersion === PROSPECTIVE_BUDGET_FUNDING_CONSENT_V3_VERSION && input.copyHash === PROSPECTIVE_BUDGET_FUNDING_CONSENT_V3_COPY_HASH || input.copyVersion === PROSPECTIVE_BUDGET_FUNDING_CONSENT_V2_VERSION && input.copyHash === PROSPECTIVE_BUDGET_FUNDING_CONSENT_V2_COPY_HASH;
137
+ }
11
138
  // src/server/about.ts
12
- import * as z2 from "zod/v4";
139
+ import * as z8 from "zod/v4";
13
140
 
14
141
  // src/server/output-schemas.ts
142
+ import * as z7 from "zod/v4";
143
+
144
+ // src/server/channel-results-schema.ts
15
145
  import * as z from "zod/v4";
16
- var ResultErrorCodeSchema = z.enum([
146
+ var ProvenanceSchema = z.object({
147
+ asOfDate: z.string().nullable(),
148
+ attribution: z.literal("Observed on the channel; not attributed to the campaign."),
149
+ source: z.literal("YouTube Analytics BigQuery warehouse")
150
+ }).strict();
151
+ var ChannelResultsSchema = z.discriminatedUnion("status", [
152
+ z.object({
153
+ provenance: ProvenanceSchema,
154
+ reason: z.string(),
155
+ status: z.literal("unavailable")
156
+ }).strict(),
157
+ z.object({
158
+ coverage: z.object({
159
+ latestCompleteDay: z.string(),
160
+ observedThroughDay: z.string().nullable(),
161
+ provenance: ProvenanceSchema,
162
+ videoMetricsThroughDay: z.string().nullable()
163
+ }).strict(),
164
+ dateRange: z.object({ end: z.string(), start: z.string() }).strict(),
165
+ provenance: ProvenanceSchema,
166
+ reason: z.string(),
167
+ status: z.literal("pending")
168
+ }).strict(),
169
+ z.object({
170
+ channelMetrics: z.object({
171
+ estimatedMinutesWatched: z.number(),
172
+ estimatedRevenueUsd: z.number().optional(),
173
+ monetizationCompleteness: z.enum(["available", "delayed", "missing"]),
174
+ provenance: ProvenanceSchema,
175
+ revenueThroughDay: z.string().nullable(),
176
+ subscribersGained: z.number().nullable(),
177
+ subscribersLost: z.number().nullable(),
178
+ views: z.number()
179
+ }).strict(),
180
+ coverage: z.object({
181
+ latestCompleteDay: z.string(),
182
+ missingDays: z.array(z.string()),
183
+ observedThroughDay: z.string(),
184
+ placeholderDays: z.array(z.string()),
185
+ provenance: ProvenanceSchema,
186
+ trafficSourceDaysWithData: z.number(),
187
+ trafficSourcePlaceholderRows: z.number(),
188
+ videoMetricsThroughDay: z.string().nullable()
189
+ }).strict(),
190
+ dateRange: z.object({ end: z.string(), start: z.string() }).strict(),
191
+ playlistFunnel: z.object({
192
+ averageTimeInPlaylistSeconds: z.number(),
193
+ playlistAddsPer1kViews: z.number().nullable(),
194
+ playlistStarts: z.number(),
195
+ provenance: ProvenanceSchema,
196
+ viewsPerPlaylistStart: z.number()
197
+ }).strict(),
198
+ status: z.literal("available"),
199
+ trafficSources: z.object({
200
+ advertisingSourceViews: z.number().nullable(),
201
+ otherSourceViews: z.number().nullable(),
202
+ provenance: ProvenanceSchema,
203
+ rows: z.array(z.object({
204
+ estimatedMinutesWatched: z.number(),
205
+ trafficSourceType: z.string(),
206
+ views: z.number()
207
+ }).strict()),
208
+ scope: z.literal("channel-date-aggregate")
209
+ }).strict(),
210
+ viewsPerAdClick: z.object({
211
+ adClicks: z.number().nullable(),
212
+ days: z.number(),
213
+ signal: z.literal("playlist-waterfall"),
214
+ value: z.number().nullable(),
215
+ views: z.number().nullable()
216
+ }).strict()
217
+ }).strict()
218
+ ]);
219
+
220
+ // src/server/funding-preview-schema.generated.ts
221
+ import { z as z2 } from "zod";
222
+ var CampaignFundingPreviewOutputSchema = z2.fromJSONSchema({
223
+ $schema: "https://json-schema.org/draft/2020-12/schema",
224
+ type: "object",
225
+ properties: {
226
+ asOf: {
227
+ type: "string",
228
+ format: "date-time",
229
+ pattern: "^(?:(?:\\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])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
230
+ },
231
+ availableBalanceMinor: {
232
+ anyOf: [
233
+ {
234
+ type: "integer",
235
+ minimum: 0,
236
+ maximum: 9007199254740991
237
+ },
238
+ {
239
+ type: "null"
240
+ }
241
+ ]
242
+ },
243
+ consentCopy: {
244
+ type: "string"
245
+ },
246
+ consentCopyHash: {
247
+ type: "string"
248
+ },
249
+ consentVersion: {
250
+ type: "string"
251
+ },
252
+ currency: {
253
+ type: "string",
254
+ enum: [
255
+ "USD",
256
+ "EUR",
257
+ "GBP",
258
+ "CAD",
259
+ "AUD",
260
+ "MXN",
261
+ "BRL",
262
+ "JPY",
263
+ "AED",
264
+ "CHF",
265
+ "CLP",
266
+ "COP",
267
+ "CZK",
268
+ "DKK",
269
+ "EGP",
270
+ "HKD",
271
+ "HUF",
272
+ "IDR",
273
+ "ILS",
274
+ "INR",
275
+ "KRW",
276
+ "KZT",
277
+ "MYR",
278
+ "NGN",
279
+ "NOK",
280
+ "NZD",
281
+ "PEN",
282
+ "PHP",
283
+ "PKR",
284
+ "PLN",
285
+ "QAR",
286
+ "RON",
287
+ "SAR",
288
+ "SEK",
289
+ "SGD",
290
+ "THB",
291
+ "TRY",
292
+ "TWD",
293
+ "TZS",
294
+ "VND",
295
+ "ZAR",
296
+ "AFN",
297
+ "ALL",
298
+ "AMD",
299
+ "ANG",
300
+ "AOA",
301
+ "ARS",
302
+ "AWG",
303
+ "AZN",
304
+ "BAM",
305
+ "BBD",
306
+ "BDT",
307
+ "BIF",
308
+ "BMD",
309
+ "BND",
310
+ "BOB",
311
+ "BSD",
312
+ "BWP",
313
+ "BYN",
314
+ "BZD",
315
+ "CDF",
316
+ "CRC",
317
+ "CVE",
318
+ "DJF",
319
+ "DOP",
320
+ "DZD",
321
+ "ETB",
322
+ "FJD",
323
+ "FKP",
324
+ "GEL",
325
+ "GHS",
326
+ "GIP",
327
+ "GMD",
328
+ "GNF",
329
+ "GTQ",
330
+ "GYD",
331
+ "HNL",
332
+ "HTG",
333
+ "IQD",
334
+ "ISK",
335
+ "JMD",
336
+ "JOD",
337
+ "KES",
338
+ "KGS",
339
+ "KHR",
340
+ "KMF",
341
+ "KYD",
342
+ "LAK",
343
+ "LKR",
344
+ "LRD",
345
+ "LSL",
346
+ "MAD",
347
+ "MDL",
348
+ "MGA",
349
+ "MKD",
350
+ "MMK",
351
+ "MNT",
352
+ "MOP",
353
+ "MUR",
354
+ "MVR",
355
+ "MWK",
356
+ "MZN",
357
+ "NAD",
358
+ "NIO",
359
+ "NPR",
360
+ "PAB",
361
+ "PGK",
362
+ "PYG",
363
+ "RSD",
364
+ "RWF",
365
+ "SBD",
366
+ "SCR",
367
+ "SHP",
368
+ "SLE",
369
+ "SOS",
370
+ "SRD",
371
+ "STD",
372
+ "SZL",
373
+ "TJS",
374
+ "TOP",
375
+ "TTD",
376
+ "UAH",
377
+ "UGX",
378
+ "UYU",
379
+ "UZS",
380
+ "VUV",
381
+ "WST",
382
+ "XAF",
383
+ "XCD",
384
+ "XCG",
385
+ "XOF",
386
+ "XPF",
387
+ "YER",
388
+ "ZMW"
389
+ ]
390
+ },
391
+ currencyExponent: {
392
+ type: "integer",
393
+ minimum: 0,
394
+ maximum: 3
395
+ },
396
+ firstWindowCardMinor: {
397
+ anyOf: [
398
+ {
399
+ type: "integer",
400
+ minimum: 0,
401
+ maximum: 9007199254740991
402
+ },
403
+ {
404
+ type: "null"
405
+ }
406
+ ]
407
+ },
408
+ firstWindowCardUpperBoundMinor: {
409
+ type: "integer",
410
+ minimum: 0,
411
+ maximum: 9007199254740991
412
+ },
413
+ firstWindowCreditCoverageMinor: {
414
+ anyOf: [
415
+ {
416
+ type: "integer",
417
+ minimum: 0,
418
+ maximum: 9007199254740991
419
+ },
420
+ {
421
+ type: "null"
422
+ }
423
+ ]
424
+ },
425
+ firstWindowMinor: {
426
+ type: "integer",
427
+ minimum: 0,
428
+ maximum: 9007199254740991
429
+ },
430
+ fullFlightCardMinor: {
431
+ anyOf: [
432
+ {
433
+ type: "integer",
434
+ minimum: 0,
435
+ maximum: 9007199254740991
436
+ },
437
+ {
438
+ type: "null"
439
+ }
440
+ ]
441
+ },
442
+ fullFlightCardUpperBoundMinor: {
443
+ anyOf: [
444
+ {
445
+ type: "integer",
446
+ minimum: 0,
447
+ maximum: 9007199254740991
448
+ },
449
+ {
450
+ type: "null"
451
+ }
452
+ ]
453
+ },
454
+ fullFlightCreditCoverageMinor: {
455
+ anyOf: [
456
+ {
457
+ type: "integer",
458
+ minimum: 0,
459
+ maximum: 9007199254740991
460
+ },
461
+ {
462
+ type: "null"
463
+ }
464
+ ]
465
+ },
466
+ fullFlightMinor: {
467
+ anyOf: [
468
+ {
469
+ type: "integer",
470
+ minimum: 0,
471
+ maximum: 9007199254740991
472
+ },
473
+ {
474
+ type: "null"
475
+ }
476
+ ]
477
+ },
478
+ fundingDays: {
479
+ type: "integer",
480
+ exclusiveMinimum: 0,
481
+ maximum: 9007199254740991
482
+ },
483
+ initialWindowCount: {
484
+ type: "integer",
485
+ minimum: 1,
486
+ maximum: 2
487
+ },
488
+ nextExpiryAt: {
489
+ anyOf: [
490
+ {
491
+ type: "string",
492
+ format: "date-time",
493
+ pattern: "^(?:(?:\\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])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
494
+ },
495
+ {
496
+ type: "null"
497
+ }
498
+ ]
499
+ },
500
+ status: {
501
+ type: "string",
502
+ enum: [
503
+ "known",
504
+ "unavailable"
505
+ ]
506
+ },
507
+ windows: {
508
+ type: "array",
509
+ items: {
510
+ type: "object",
511
+ properties: {
512
+ budgetMinor: {
513
+ type: "integer",
514
+ minimum: 0,
515
+ maximum: 9007199254740991
516
+ },
517
+ endsAt: {
518
+ type: "string",
519
+ format: "date-time",
520
+ pattern: "^(?:(?:\\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])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
521
+ },
522
+ startsAt: {
523
+ type: "string",
524
+ format: "date-time",
525
+ pattern: "^(?:(?:\\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])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
526
+ }
527
+ },
528
+ required: [
529
+ "budgetMinor",
530
+ "endsAt",
531
+ "startsAt"
532
+ ],
533
+ additionalProperties: false
534
+ }
535
+ }
536
+ },
537
+ required: [
538
+ "asOf",
539
+ "availableBalanceMinor",
540
+ "consentCopy",
541
+ "consentCopyHash",
542
+ "consentVersion",
543
+ "currency",
544
+ "currencyExponent",
545
+ "firstWindowCardMinor",
546
+ "firstWindowCardUpperBoundMinor",
547
+ "firstWindowCreditCoverageMinor",
548
+ "firstWindowMinor",
549
+ "fullFlightCardMinor",
550
+ "fullFlightCardUpperBoundMinor",
551
+ "fullFlightCreditCoverageMinor",
552
+ "fullFlightMinor",
553
+ "fundingDays",
554
+ "initialWindowCount",
555
+ "nextExpiryAt",
556
+ "status",
557
+ "windows"
558
+ ],
559
+ additionalProperties: false
560
+ });
561
+
562
+ // src/server/youtube-channel-data-schema.ts
563
+ import * as z6 from "zod/v4";
564
+
565
+ // src/server/shared-schemas.ts
566
+ import * as z4 from "zod/v4";
567
+
568
+ // src/server/account-schema.generated.ts
569
+ import { z as z3 } from "zod/v4";
570
+ var ToolFormatSchema = z3.enum(["json", "summary"]);
571
+ var DescriptiveEntitySchema = z3.object({
572
+ id: z3.string().optional(),
573
+ name: z3.string().optional(),
574
+ publicUrl: z3.string().optional(),
575
+ summary: z3.string().optional()
576
+ }).passthrough();
577
+ var DynamoiListArtistsInputSchema = z3.object({
578
+ artistId: z3.string().uuid().optional(),
579
+ cursor: z3.string().optional(),
580
+ format: ToolFormatSchema.optional(),
581
+ limit: z3.number().int().min(1).max(50).optional()
582
+ }).strict();
583
+ var DynamoiGetCurrentUserIntentSchema = z3.enum([
584
+ "account_overview",
585
+ "artist_access_check",
586
+ "organization_access_check",
587
+ "platform_connection_check"
588
+ ]);
589
+ var DynamoiGetCurrentUserInputSchema = z3.object({
590
+ format: ToolFormatSchema.optional(),
591
+ intent: DynamoiGetCurrentUserIntentSchema.default("account_overview")
592
+ }).strict();
593
+ var DynamoiAccountOverviewDescriptiveDataSchema = z3.object({
594
+ artistCount: z3.number().optional(),
595
+ artists: z3.object({
596
+ count: z3.number(),
597
+ summaries: z3.array(DescriptiveEntitySchema)
598
+ }).optional(),
599
+ organizationCount: z3.number().optional(),
600
+ recommendedNextActions: z3.array(z3.string()).optional(),
601
+ state: z3.object({}).passthrough().optional(),
602
+ summary: z3.string().optional(),
603
+ user: z3.object({ name: z3.string().optional() }).optional()
604
+ }).passthrough();
605
+ var DynamoiArtistListDescriptiveDataSchema = z3.object({
606
+ artists: z3.array(DescriptiveEntitySchema).optional(),
607
+ nextCursor: z3.string().optional(),
608
+ summary: z3.string().optional(),
609
+ totalCount: z3.number().optional()
610
+ }).passthrough();
611
+
612
+ // src/server/shared-schemas.ts
613
+ var SearchQuerySchema = z4.string().trim().max(120);
614
+ var IsoDateSchema = z4.string().regex(/^\d{4}-\d{2}-\d{2}$/);
615
+ var UserIntentSummarySchema = z4.string().trim().max(500).optional();
616
+ var ClientRequestIdSchema = z4.string().uuid().optional();
617
+ var RequiredClientRequestIdSchema = z4.string().uuid();
618
+ function isValidCalendarDate(value) {
619
+ const date = new Date(`${value}T00:00:00.000Z`);
620
+ return Number.isFinite(date.getTime()) && date.toISOString().slice(0, 10) === value;
621
+ }
622
+ var IsoCalendarDateSchema = IsoDateSchema.refine(isValidCalendarDate, {
623
+ message: "must be a valid calendar date"
624
+ });
625
+ var DateRangeSchema = z4.object({
626
+ end: IsoDateSchema,
627
+ start: IsoDateSchema
628
+ }).strict().superRefine((data, ctx) => {
629
+ if (!isValidCalendarDate(data.start)) {
630
+ ctx.addIssue({
631
+ code: "custom",
632
+ message: "start must be a valid calendar date",
633
+ path: ["start"]
634
+ });
635
+ }
636
+ if (!isValidCalendarDate(data.end)) {
637
+ ctx.addIssue({
638
+ code: "custom",
639
+ message: "end must be a valid calendar date",
640
+ path: ["end"]
641
+ });
642
+ }
643
+ if (isValidCalendarDate(data.start) && isValidCalendarDate(data.end) && data.start > data.end) {
644
+ ctx.addIssue({
645
+ code: "custom",
646
+ message: "start must be on or before end",
647
+ path: ["start"]
648
+ });
649
+ }
650
+ });
651
+
652
+ // src/server/youtube-strategy-guide.ts
653
+ import * as z5 from "zod/v4";
654
+ var YOUTUBE_CAMPAIGN_STRATEGIES_RESOURCE_URI = "dynamoi://youtube/campaign-strategies";
655
+ var YouTubeStrategyKeySchema = z5.enum([
656
+ "CHEAPEST_VIEWS",
657
+ "ORGANIC_VIEWS",
658
+ "SUBSCRIBERS",
659
+ "ORGANIC_VIEWS_AND_SUBSCRIBERS",
660
+ "ADSENSE_ROI"
661
+ ]);
662
+ var CAMPAIGN_PERIOD_LIFT_SIGNAL = "Campaign-period lift: channel views above the pre-campaign baseline while the campaign runs. These are mostly ad sessions, because ad click-throughs into the playlist appear as PLAYLIST and SUBSCRIBER traffic.";
663
+ var ORGANIC_LIFT_SIGNAL = "Organic lift: growth in sources the ads do not touch (YT_SEARCH, RELATED_VIDEO suggested views, browse features and similar), plus lift that persists after spend stops.";
664
+ var VIEWS_PER_AD_CLICK_SIGNAL = "Views per ad click (the playlist waterfall signal): channel views divided by ad clicks, over days that have both.";
665
+ var CHEAP_VIEWS_MISLEAD = "A low cost per click or per ad network view with no organic lift is a miss, not a win.";
666
+ var CONTINUED_VIEWS_MISLEAD = "Ad network-credited continued views are the organic views directly attributed to the campaign by click date. Do not say whether they include the first watch after the click, and they are not proof of overall organic growth.";
667
+ var TRAFFIC_SOURCE_MISLEAD = "YouTube traffic sources are not organic proof: PLAYLIST and SUBSCRIBER views during the campaign are mostly ad sessions, and only a small share of ad-driven views is tagged ADVERTISING.";
668
+ var STRATEGY_ENTRIES = {
669
+ ADSENSE_ROI: {
670
+ adNetworkOptimizesFor: "Viewers it predicts will keep watching the artist's videos after the ad (its continued-views goal, the same as Watch Time). The ad network does not see the channel's revenue while it bids; Dynamoi judges revenue afterwards from YouTube data.",
671
+ bestFor: "Monetized channels that want channel revenue to grow faster than campaign spend.",
672
+ goal: "Grow the channel's YouTube ad revenue from the views the campaign brings.",
673
+ judgeBy: [
674
+ "Channel revenue during the campaign compared with its pre-campaign baseline and with campaign spend as shown in Dynamoi.",
675
+ "Revenue per 1,000 monetized playbacks by country and by video.",
676
+ CAMPAIGN_PERIOD_LIFT_SIGNAL,
677
+ ORGANIC_LIFT_SIGNAL
678
+ ],
679
+ key: "ADSENSE_ROI",
680
+ label: "Revenue",
681
+ misleadingSignals: [
682
+ "Cheap views or clicks from viewers who do not earn are a miss, not a win.",
683
+ "Revenue for the latest 2-3 days is incomplete; YouTube also revises its revenue estimates.",
684
+ TRAFFIC_SOURCE_MISLEAD,
685
+ CONTINUED_VIEWS_MISLEAD
686
+ ],
687
+ placements: "In-feed YouTube placements (home feed, watch-next and search) plus the ad network's Discover feed.",
688
+ requirements: "Monetized channels only: YouTube revenue or monetized playbacks in the last 90 days. A playlist entry point is required."
689
+ },
690
+ CHEAPEST_VIEWS: {
691
+ adNetworkOptimizesFor: "The most video ad views for the budget, as a fixed-length video campaign.",
692
+ bestFor: "A launch push or a one-off view target for a single video.",
693
+ goal: "Show the promoted video to as many viewers as possible for the budget.",
694
+ judgeBy: [
695
+ "Ad network-reported views and cost per view against the budget and end date.",
696
+ "Watch time per ad network view, to check viewers actually watched."
697
+ ],
698
+ key: "CHEAPEST_VIEWS",
699
+ label: "Views",
700
+ misleadingSignals: [
701
+ "Weak organic lift or few subscribers are expected: this strategy does not aim for them.",
702
+ "Many ad network views come from ads shown before or during other videos, so they can carry less watch time than in-feed views."
703
+ ],
704
+ placements: "All YouTube video placements, including ads that play before or during other videos.",
705
+ requirements: "One video; a playlist is optional. Uses a total budget with an end date."
706
+ },
707
+ ORGANIC_VIEWS: {
708
+ adNetworkOptimizesFor: "Viewers it predicts will keep watching the artist's videos after the ad (its continued-views goal).",
709
+ bestFor: "Channels that want ongoing views of their catalog, not just the promoted video.",
710
+ goal: "Grow the channel's ongoing views by reaching viewers who keep watching after the ad, and look for lift that lasts beyond the spend.",
711
+ judgeBy: [
712
+ CAMPAIGN_PERIOD_LIFT_SIGNAL,
713
+ ORGANIC_LIFT_SIGNAL,
714
+ VIEWS_PER_AD_CLICK_SIGNAL,
715
+ "Watch time, playlist starts and views per playlist start.",
716
+ "Cost per click or per ad network view only as a secondary efficiency check."
717
+ ],
718
+ key: "ORGANIC_VIEWS",
719
+ label: "Watch Time",
720
+ misleadingSignals: [
721
+ CHEAP_VIEWS_MISLEAD,
722
+ TRAFFIC_SOURCE_MISLEAD,
723
+ CONTINUED_VIEWS_MISLEAD
724
+ ],
725
+ placements: "In-feed YouTube placements: home feed, watch-next and search results.",
726
+ requirements: "A playlist entry point is required."
727
+ },
728
+ ORGANIC_VIEWS_AND_SUBSCRIBERS: {
729
+ adNetworkOptimizesFor: "Both continued watching after the ad and new subscribers, balanced by the ad network.",
730
+ bestFor: "Most channels that are not monetized yet; this is Dynamoi's default for them.",
731
+ goal: "Grow views and subscribers together, and look for lift that lasts beyond the spend.",
732
+ judgeBy: [
733
+ CAMPAIGN_PERIOD_LIFT_SIGNAL,
734
+ ORGANIC_LIFT_SIGNAL,
735
+ VIEWS_PER_AD_CLICK_SIGNAL,
736
+ "Net subscribers (gained minus lost) compared with the pre-campaign baseline.",
737
+ "Watch time and playlist starts."
738
+ ],
739
+ key: "ORGANIC_VIEWS_AND_SUBSCRIBERS",
740
+ label: "Channel Growth",
741
+ misleadingSignals: [
742
+ CHEAP_VIEWS_MISLEAD,
743
+ "Subscribers gained without subscribers lost overstates growth.",
744
+ TRAFFIC_SOURCE_MISLEAD,
745
+ CONTINUED_VIEWS_MISLEAD
746
+ ],
747
+ placements: "In-feed YouTube placements: home feed, watch-next and search results.",
748
+ requirements: "A playlist entry point is required."
749
+ },
750
+ SUBSCRIBERS: {
751
+ adNetworkOptimizesFor: "Viewers it predicts will subscribe to the channel after the ad.",
752
+ bestFor: "Channels whose main goal is audience size, for example to reach monetization thresholds.",
753
+ goal: "Grow the channel's subscriber base.",
754
+ judgeBy: [
755
+ "Net subscribers (gained minus lost) compared with the pre-campaign baseline.",
756
+ "Campaign spend per net subscriber."
757
+ ],
758
+ key: "SUBSCRIBERS",
759
+ label: "Subscribers",
760
+ misleadingSignals: [
761
+ "View volume: this strategy can trade views for subscribers.",
762
+ "Subscribers gained without subscribers lost overstates growth."
763
+ ],
764
+ placements: "In-feed YouTube placements: home feed, watch-next and search results.",
765
+ requirements: "A playlist entry point is required."
766
+ }
767
+ };
768
+ var VOCABULARY = {
769
+ adNetwork: "Dynamoi YouTube campaigns run on Google's ad network and serve on YouTube. When reporting to users, say 'the ad network' (you may name Google once); do not repeat 'Google Ads'.",
770
+ adNetworkReportedContinuedViews: "Organic views directly attributed: continued views of the artist's videos that the ad account credits to the campaign, by click date and provisional for two days. Do not claim whether the count includes the first watch after the click. It is not YouTube's channel view count and not proof of overall organic growth.",
771
+ advertisingSourceViews: "Channel views YouTube tags with traffic source ADVERTISING. It undercounts ad-driven views: an ad click that lands in a playlist is credited mostly to PLAYLIST and SUBSCRIBER, not ADVERTISING.",
772
+ campaignPeriodLift: "Channel views above the pre-campaign baseline during the campaign. They are mostly ad sessions, because ad click-throughs into the playlist appear as PLAYLIST and SUBSCRIBER traffic. It shows what the campaign period delivered, not what the channel keeps.",
773
+ organicLift: "Growth in sources the ads do not touch (YT_SEARCH, RELATED_VIDEO suggested views, browse features and similar), plus lift that persists after spend stops. The comparison with the pre-campaign baseline, not the raw total, shows it. Neither YouTube traffic sources nor the ad network's continued views are organic proof.",
774
+ otherSourceViews: "Every channel view not tagged ADVERTISING. It is not organic: it includes ad sessions credited to PLAYLIST and SUBSCRIBER.",
775
+ strategyNames: "Use the strategy label with users (for example 'Revenue'); use the key (for example ADSENSE_ROI) only in tool calls.",
776
+ viewsPerAdClick: "Channel views divided by ad clicks from campaign analytics, over the campaign window's days that have both. It is the playlist waterfall signal: how many views each ad click produces once playback continues through the playlist. It is not attributed per viewer."
777
+ };
778
+ var PLAYLIST_WATERFALL = {
779
+ advice: [
780
+ "Use long playlists, up to about 10 hours; repeat the catalog when there are not enough videos.",
781
+ "The video after the promoted one must be the artist's own.",
782
+ "Similar-artist videos further down the playlist are only an optional idea the artist decides on.",
783
+ "Do not claim that every stream earns revenue."
784
+ ],
785
+ measurement: "Views per ad click (channel views divided by ad clicks, over days that have both) measures the waterfall. Ad clicks that land in a playlist are credited mostly to PLAYLIST and SUBSCRIBER, so the ADVERTISING traffic source shows only a small share of ad-driven views, and other-source views are not organic.",
786
+ measurementLimits: "YouTube data reports totals by day, video and traffic source. It does not follow individual viewers from video to video, so no data source proves how many views the playlist itself caused. Report playlist starts, views per playlist start, views per ad click, campaign-period lift and organic lift; do not claim exact playlist-caused views.",
787
+ mechanism: "Except the Views strategy, each campaign promotes a video as the entry point into a playlist of the artist's own videos. After a viewer clicks, playback continues through that playlist instead of YouTube autoplay choosing unrelated videos.",
788
+ purpose: "Keep ad-driven and background listeners on the artist's channel. It improves listener quality; it is not a hidden view multiplier."
789
+ };
790
+ var RESULT_TIMING = {
791
+ baseline: "Compare with the channel's own pre-campaign period of similar length, on complete days only.",
792
+ dataLag: "YouTube views, subscribers and revenue arrive about 2-3 days late, and the latest days may be partial. Check the coverage fields (observedThroughDay, revenueThroughDay) before comparing.",
793
+ learning: "The ad network learns for about 7-14 days after launch or a strategy change. Delivery and cost swing during this time; do not give a verdict in the first week.",
794
+ missingData: "Missing days are unknown, not zero."
795
+ };
796
+ function buildYouTubeCampaignStrategiesGuide() {
797
+ return {
798
+ playlistWaterfall: PLAYLIST_WATERFALL,
799
+ resultTiming: RESULT_TIMING,
800
+ strategies: Object.values(STRATEGY_ENTRIES),
801
+ vocabulary: VOCABULARY
802
+ };
803
+ }
804
+ function buildYouTubeStrategyGuide(strategy) {
805
+ const parsed = YouTubeStrategyKeySchema.safeParse(strategy);
806
+ if (!parsed.success) {
807
+ return null;
808
+ }
809
+ const entry = STRATEGY_ENTRIES[parsed.data];
810
+ return {
811
+ ...entry,
812
+ judgeBy: [...entry.judgeBy],
813
+ misleadingSignals: [...entry.misleadingSignals],
814
+ moreDetail: `Read ${YOUTUBE_CAMPAIGN_STRATEGIES_RESOURCE_URI} for view definitions, the playlist waterfall and result timing.`,
815
+ resultTiming: `${RESULT_TIMING.learning} ${RESULT_TIMING.dataLag}`
816
+ };
817
+ }
818
+
819
+ // src/server/youtube-channel-data-schema.ts
820
+ var YOUTUBE_CHANNEL_DATASETS = [
821
+ "channel_daily",
822
+ "video_daily",
823
+ "country_daily",
824
+ "traffic_source_daily",
825
+ "search_term_daily",
826
+ "subscribed_status_daily",
827
+ "device_daily",
828
+ "operating_system_daily",
829
+ "playback_location_daily",
830
+ "creator_content_type_daily",
831
+ "video_catalog"
832
+ ];
833
+ var YouTubeChannelDatasetSchema = z6.enum(YOUTUBE_CHANNEL_DATASETS);
834
+ var YOUTUBE_CHANNEL_VIDEO_DATASETS = [
835
+ "video_daily",
836
+ "video_catalog"
837
+ ];
838
+ var YOUTUBE_CHANNEL_DATA_MAX_RANGE_DAYS = 400;
839
+ var YOUTUBE_CHANNEL_DATA_MAX_VIDEO_IDS = 50;
840
+ var YOUTUBE_CHANNEL_DATA_DEFAULT_LIMIT = 500;
841
+ var YOUTUBE_CHANNEL_DATA_MAX_LIMIT = 1000;
842
+ var YouTubeVideoIdSchema = z6.string().regex(/^[A-Za-z0-9_-]{11}$/, {
843
+ message: "must be an 11-character video ID"
844
+ });
845
+ function inclusiveDaySpan(start, end) {
846
+ const startMs = Date.parse(`${start}T00:00:00.000Z`);
847
+ const endMs = Date.parse(`${end}T00:00:00.000Z`);
848
+ return Math.round((endMs - startMs) / 86400000) + 1;
849
+ }
850
+ var DynamoiGetYouTubeChannelDataInputSchema = z6.object({
851
+ artistId: z6.string().uuid(),
852
+ cursor: z6.string().min(1).max(1000).optional(),
853
+ dataset: YouTubeChannelDatasetSchema,
854
+ endDate: IsoCalendarDateSchema,
855
+ format: ToolFormatSchema.optional(),
856
+ limit: z6.number().int().min(1).max(YOUTUBE_CHANNEL_DATA_MAX_LIMIT).optional(),
857
+ startDate: IsoCalendarDateSchema,
858
+ videoIds: z6.array(YouTubeVideoIdSchema).min(1).max(YOUTUBE_CHANNEL_DATA_MAX_VIDEO_IDS).optional()
859
+ }).strict().superRefine((data, ctx) => {
860
+ if (data.startDate > data.endDate) {
861
+ ctx.addIssue({
862
+ code: "custom",
863
+ message: "startDate must be on or before endDate",
864
+ path: ["startDate"]
865
+ });
866
+ } else if (inclusiveDaySpan(data.startDate, data.endDate) > YOUTUBE_CHANNEL_DATA_MAX_RANGE_DAYS) {
867
+ ctx.addIssue({
868
+ code: "custom",
869
+ message: `The date range can cover at most ${YOUTUBE_CHANNEL_DATA_MAX_RANGE_DAYS} days`,
870
+ path: ["endDate"]
871
+ });
872
+ }
873
+ if (data.videoIds && !YOUTUBE_CHANNEL_VIDEO_DATASETS.includes(data.dataset)) {
874
+ ctx.addIssue({
875
+ code: "custom",
876
+ message: "videoIds only applies to video_daily and video_catalog",
877
+ path: ["videoIds"]
878
+ });
879
+ }
880
+ });
881
+ var YouTubeChannelDataRowSchema = z6.record(z6.string(), z6.union([z6.string(), z6.number(), z6.boolean(), z6.null()]));
882
+ var YouTubeChannelDataCoverageSchema = z6.object({
883
+ datasetLatestDay: z6.string().nullable(),
884
+ latestCompleteDay: z6.string(),
885
+ missingDays: z6.array(z6.string()),
886
+ note: z6.string(),
887
+ observedThroughDay: z6.string().nullable(),
888
+ placeholderDays: z6.array(z6.string()),
889
+ requestedEndDate: z6.string(),
890
+ requestedStartDate: z6.string(),
891
+ revenueThroughDay: z6.string().nullable()
892
+ }).strict();
893
+ var YouTubeChannelDataCampaignSchema = z6.object({
894
+ campaignId: z6.string(),
895
+ createdAt: z6.string(),
896
+ endDate: z6.string().nullable(),
897
+ promotedVideos: z6.array(z6.object({ playlistId: z6.string().nullable(), videoId: z6.string() }).strict()),
898
+ status: z6.string().nullable(),
899
+ strategy: z6.object({ key: YouTubeStrategyKeySchema, label: z6.string() }).strict(),
900
+ title: z6.string().nullable()
901
+ }).strict();
902
+ var YouTubeChannelDataSchema = z6.object({
903
+ artistId: z6.string(),
904
+ campaigns: z6.array(YouTubeChannelDataCampaignSchema),
905
+ channelId: z6.string(),
906
+ channelName: z6.string().nullable(),
907
+ coverage: YouTubeChannelDataCoverageSchema,
908
+ dataLagNote: z6.string(),
909
+ dataset: YouTubeChannelDatasetSchema,
910
+ nextCursor: z6.string().optional(),
911
+ notAvailable: z6.array(z6.string()),
912
+ rowCount: z6.number().int().min(0),
913
+ rows: z6.array(YouTubeChannelDataRowSchema).optional(),
914
+ source: z6.object({
915
+ attribution: z6.string(),
916
+ name: z6.string()
917
+ }).strict(),
918
+ strategyGuideResource: z6.string(),
919
+ summary: z6.string()
920
+ }).strict();
921
+
922
+ // src/server/output-schemas.ts
923
+ var ResultErrorCodeSchema = z7.enum([
17
924
  "ACCOUNT_READ_ONLY",
18
925
  "INVALID_SPOTIFY_SOURCE",
19
926
  "CAPABILITY_REQUIRED",
20
927
  "INSUFFICIENT_SCOPE",
928
+ "TENANT_ACCESS_DENIED",
21
929
  "STATE_CONFLICT",
22
930
  "QUOTE_CHANGED",
23
931
  "RATE_LIMITED",
24
932
  "OUTPUT_INVALID",
25
933
  "UNKNOWN_EFFECT"
26
934
  ]);
27
- var ResultNextActionSchema = z.object({
28
- field: z.string().trim().min(1).max(120).optional(),
29
- kind: z.enum(["provide_input", "read_status", "reconnect", "handoff"]),
30
- reason: z.string().trim().min(1).max(240).optional()
935
+ var ResultNextActionSchema = z7.object({
936
+ field: z7.string().trim().min(1).max(120).optional(),
937
+ kind: z7.enum(["provide_input", "read_status", "reconnect", "handoff"]),
938
+ reason: z7.string().trim().min(1).max(240).optional()
31
939
  }).strict();
32
- var ResultErrorRecoverySchema = z.object({
940
+ var ResultErrorRecoverySchema = z7.object({
33
941
  code: ResultErrorCodeSchema.optional(),
34
- field: z.string().trim().min(1).max(120).optional(),
942
+ draftId: z7.string().uuid().optional(),
943
+ failureStage: z7.string().trim().min(1).max(120).optional(),
944
+ field: z7.string().trim().min(1).max(120).optional(),
35
945
  nextAction: ResultNextActionSchema.optional(),
36
- prerequisite: z.string().trim().min(1).max(240).optional(),
37
- retryAfterSeconds: z.number().int().min(0).max(86400).optional(),
38
- retryable: z.boolean().optional()
946
+ prerequisite: z7.string().trim().min(1).max(240).optional(),
947
+ retryAfterSeconds: z7.number().int().min(0).max(86400).optional(),
948
+ retryable: z7.boolean().optional(),
949
+ screeningResult: z7.string().trim().min(1).max(120).optional()
39
950
  }).strict();
40
951
  function addRecoverySafetyIssues(value, context) {
41
952
  if (value.retryAfterSeconds !== undefined && value.retryable !== true) {
@@ -64,6 +975,9 @@ function addRecoverySafetyIssues(value, context) {
64
975
  }
65
976
  }
66
977
  var RESULT_ERROR_RECOVERY_FIELDS = [
978
+ "draftId",
979
+ "failureStage",
980
+ "screeningResult",
67
981
  "code",
68
982
  "field",
69
983
  "nextAction",
@@ -71,18 +985,36 @@ var RESULT_ERROR_RECOVERY_FIELDS = [
71
985
  "retryable",
72
986
  "retryAfterSeconds"
73
987
  ];
74
- var MoneyDisplayOutputSchema = z.object({
75
- amountUsd: z.number(),
76
- formatted: z.string()
77
- }).strict();
988
+ var MoneyDisplayOutputSchema = z7.object({
989
+ amount: z7.number(),
990
+ amountUsd: z7.number().optional(),
991
+ currency: z7.string(),
992
+ formatted: z7.string()
993
+ }).strict().superRefine((value, context) => {
994
+ const hasUsdAmount = value.amountUsd !== undefined;
995
+ if (value.currency.toUpperCase() === "USD" ? !hasUsdAmount : hasUsdAmount) {
996
+ context.addIssue({
997
+ code: "custom",
998
+ message: "amountUsd is required for USD and forbidden otherwise.",
999
+ path: ["amountUsd"]
1000
+ });
1001
+ }
1002
+ if (hasUsdAmount && value.amountUsd !== value.amount) {
1003
+ context.addIssue({
1004
+ code: "custom",
1005
+ message: "amountUsd must equal amount for USD.",
1006
+ path: ["amountUsd"]
1007
+ });
1008
+ }
1009
+ });
78
1010
  function createOutputEnvelopeSchema(dataSchema, options) {
79
1011
  const statuses = options?.allowPartial ? ["success", "partial_success", "error"] : ["success", "error"];
80
- return z.object({
1012
+ return z7.object({
81
1013
  data: dataSchema.optional(),
82
- kind: z.enum(["validation", "business", "platform", "unknown"]).optional(),
83
- message: z.string().optional(),
1014
+ kind: z7.enum(["validation", "business", "platform", "unknown"]).optional(),
1015
+ message: z7.string().optional(),
84
1016
  ...ResultErrorRecoverySchema.shape,
85
- status: z.enum(statuses)
1017
+ status: z7.enum(statuses)
86
1018
  }).strict().superRefine((value, context) => {
87
1019
  if (value.status === "error" && !value.message) {
88
1020
  context.addIssue({
@@ -114,167 +1046,323 @@ function createOutputEnvelopeSchema(dataSchema, options) {
114
1046
  addRecoverySafetyIssues(value, context);
115
1047
  });
116
1048
  }
117
- var AnyToolDataOutputSchema = z.object({}).passthrough();
118
- var MediaAssetSummaryOutputSchema = z.object({
119
- aspectRatio: z.string().optional(),
120
- createdAt: z.string(),
121
- fileName: z.string().optional(),
122
- fileType: z.string(),
123
- height: z.number().optional(),
124
- id: z.string(),
125
- url: z.string().optional(),
126
- urlExpiresAt: z.string().optional(),
127
- width: z.number().optional()
1049
+ var AnyToolDataOutputSchema = z7.object({}).passthrough();
1050
+ var MediaAssetSummaryOutputSchema = z7.object({
1051
+ aspectRatio: z7.string().optional(),
1052
+ createdAt: z7.string(),
1053
+ fileName: z7.string().optional(),
1054
+ fileType: z7.string(),
1055
+ height: z7.number().optional(),
1056
+ id: z7.string(),
1057
+ url: z7.string().optional(),
1058
+ urlExpiresAt: z7.string().optional(),
1059
+ width: z7.number().optional()
128
1060
  }).strict();
129
- var ListMediaAssetsDataOutputSchema = z.object({
130
- assets: z.array(MediaAssetSummaryOutputSchema),
131
- nextCursor: z.string().optional()
1061
+ var ListMediaAssetsDataOutputSchema = z7.object({
1062
+ assets: z7.array(MediaAssetSummaryOutputSchema),
1063
+ nextCursor: z7.string().optional()
132
1064
  }).strict();
133
- var ListMediaAssetsSummaryOutputSchema = z.object({
134
- nextCursor: z.string().optional(),
135
- summary: z.string(),
136
- totalCount: z.number()
1065
+ var ListMediaAssetsSummaryOutputSchema = z7.object({
1066
+ nextCursor: z7.string().optional(),
1067
+ summary: z7.string(),
1068
+ totalCount: z7.number()
137
1069
  }).strict();
138
1070
  var SmartLinkStatusSchemas = {
139
- claimStatus: z.enum([
1071
+ claimStatus: z7.enum([
140
1072
  "auto_approved",
141
1073
  "pending_ops_review",
142
1074
  "verification_deferred",
143
1075
  "approved_by_ops",
144
1076
  "rejected"
145
1077
  ]),
146
- publishState: z.enum(["published", "unpublished"]),
147
- renderState: z.enum(["queued", "rendering", "rendered", "failed"]),
148
- takedownStatus: z.enum(["none", "active", "resolved"]),
149
- theme: z.enum(["classic", "brutalist", "aurora", "cinematic"])
1078
+ publishState: z7.enum(["published", "unpublished"]),
1079
+ renderState: z7.enum(["queued", "rendering", "rendered", "failed"]),
1080
+ takedownStatus: z7.enum(["none", "active", "resolved"]),
1081
+ theme: z7.enum(["classic", "brutalist", "aurora", "cinematic"])
150
1082
  };
151
- var SmartLinkSummaryOutputSchema = z.object({
152
- artistHubUrl: z.string(),
153
- artistId: z.string(),
154
- artistName: z.string(),
1083
+ var SmartLinkSummaryOutputSchema = z7.object({
1084
+ artistHubUrl: z7.string(),
1085
+ artistId: z7.string(),
1086
+ artistName: z7.string(),
155
1087
  claimStatus: SmartLinkStatusSchemas.claimStatus,
156
- createdAt: z.string(),
157
- id: z.string(),
158
- isPublic: z.boolean(),
159
- localizedPublicUrls: z.array(z.string()).optional(),
160
- publicUrl: z.string(),
1088
+ createdAt: z7.string(),
1089
+ id: z7.string(),
1090
+ isPublic: z7.boolean(),
1091
+ localizedPublicUrls: z7.array(z7.string()).optional(),
1092
+ publicUrl: z7.string(),
161
1093
  publishState: SmartLinkStatusSchemas.publishState,
162
- releaseSlug: z.string(),
163
- releaseTitle: z.string(),
164
- releaseType: z.string(),
1094
+ releaseSlug: z7.string(),
1095
+ releaseTitle: z7.string(),
1096
+ releaseType: z7.string(),
165
1097
  renderState: SmartLinkStatusSchemas.renderState,
166
- spotifyUrl: z.string().nullable(),
1098
+ spotifyUrl: z7.string().nullable(),
167
1099
  takedownStatus: SmartLinkStatusSchemas.takedownStatus,
168
1100
  theme: SmartLinkStatusSchemas.theme,
169
- updatedAt: z.string()
1101
+ updatedAt: z7.string()
170
1102
  }).strict();
171
1103
  var SmartLinkDetailsOutputSchema = SmartLinkSummaryOutputSchema.extend({
172
- actionRequired: z.array(z.string()).optional(),
173
- customDescription: z.string().nullable(),
174
- nextActions: z.array(z.string()),
175
- originalSpotifyUrl: z.string().nullable(),
176
- summary: z.string(),
177
- warnings: z.array(z.string()).optional()
1104
+ actionRequired: z7.array(z7.string()).optional(),
1105
+ customDescription: z7.string().nullable(),
1106
+ nextActions: z7.array(z7.string()),
1107
+ originalSpotifyUrl: z7.string().nullable(),
1108
+ summary: z7.string(),
1109
+ warnings: z7.array(z7.string()).optional()
178
1110
  }).strict();
179
- var ListSmartLinksDataOutputSchema = z.object({
180
- nextCursor: z.string().optional(),
181
- smartLinks: z.array(SmartLinkSummaryOutputSchema)
1111
+ var ListSmartLinksDataOutputSchema = z7.object({
1112
+ nextCursor: z7.string().optional(),
1113
+ smartLinks: z7.array(SmartLinkSummaryOutputSchema)
182
1114
  }).strict();
183
- var ListSmartLinksSummaryOutputSchema = z.object({
184
- nextCursor: z.string().optional(),
185
- summary: z.string(),
186
- totalCount: z.number()
1115
+ var ListSmartLinksSummaryOutputSchema = z7.object({
1116
+ nextCursor: z7.string().optional(),
1117
+ summary: z7.string(),
1118
+ totalCount: z7.number()
187
1119
  }).strict();
188
- var AvailableCountryOutputSchema = z.object({
189
- code: z.string(),
190
- dominantLanguage: z.string().optional(),
191
- googleAdsId: z.number(),
192
- name: z.string()
1120
+ var AvailableCountryOutputSchema = z7.object({
1121
+ code: z7.string(),
1122
+ dominantLanguage: z7.string().optional(),
1123
+ googleAdsId: z7.number(),
1124
+ name: z7.string()
193
1125
  }).strict();
194
- var ListAvailableCountriesDataOutputSchema = z.object({
195
- campaignType: z.enum(["SMART_CAMPAIGN", "YOUTUBE"]),
196
- countries: z.array(AvailableCountryOutputSchema),
197
- nextCursor: z.string().optional(),
198
- notes: z.array(z.string()),
199
- source: z.enum(["SMART_CAMPAIGN_COUNTRIES", "GOOGLE_ADS_COUNTRIES"]),
200
- totalCount: z.number()
1126
+ var ListAvailableCountriesDataOutputSchema = z7.object({
1127
+ campaignType: z7.enum(["SMART_CAMPAIGN", "YOUTUBE"]),
1128
+ countries: z7.array(AvailableCountryOutputSchema),
1129
+ nextCursor: z7.string().optional(),
1130
+ notes: z7.array(z7.string()),
1131
+ source: z7.enum(["SMART_CAMPAIGN_COUNTRIES", "GOOGLE_ADS_COUNTRIES"]),
1132
+ totalCount: z7.number()
201
1133
  }).strict();
202
- var SummaryCountOutputSchema = z.object({
203
- nextCursor: z.string().optional(),
204
- summary: z.string(),
205
- totalCount: z.number()
1134
+ var SummaryCountOutputSchema = z7.object({
1135
+ nextCursor: z7.string().optional(),
1136
+ summary: z7.string(),
1137
+ totalCount: z7.number()
206
1138
  }).strict();
207
- var SummaryWarningsActionsOutputSchema = z.object({
208
- actionRequired: z.array(z.string()).optional(),
209
- summary: z.string(),
210
- warnings: z.array(z.string()).optional()
1139
+ var SummaryWarningsActionsOutputSchema = z7.object({
1140
+ actionRequired: z7.array(z7.string()).optional(),
1141
+ summary: z7.string(),
1142
+ warnings: z7.array(z7.string()).optional()
211
1143
  }).strict();
212
- var NormalizedTargetingOutputSchema = z.union([
213
- z.object({ mode: z.literal("GLOBAL") }).strict(),
214
- z.object({
215
- countries: z.array(z.object({ code: z.string(), name: z.string() }).strict()),
216
- mode: z.literal("COUNTRIES")
1144
+ var NormalizedTargetingOutputSchema = z7.union([
1145
+ z7.object({ mode: z7.literal("GLOBAL") }).strict(),
1146
+ z7.object({
1147
+ countries: z7.array(z7.object({ code: z7.string(), name: z7.string() }).strict()),
1148
+ mode: z7.literal("COUNTRIES")
217
1149
  }).strict()
218
1150
  ]);
219
- var GetCampaignReadinessDataOutputSchema = z.object({
220
- artistId: z.string(),
221
- artistName: z.string(),
222
- blockingIssues: z.array(z.string()),
223
- campaignType: z.enum(["SMART_CAMPAIGN", "YOUTUBE"]),
224
- isReady: z.boolean(),
225
- missingInputs: z.array(z.string()),
1151
+ var GetCampaignReadinessDataOutputSchema = z7.object({
1152
+ artistId: z7.string(),
1153
+ artistName: z7.string(),
1154
+ blockingCodes: z7.array(z7.enum([
1155
+ "budget_policy",
1156
+ "currency_unavailable",
1157
+ "daily_spending_limit",
1158
+ "funding_unavailable",
1159
+ "invalid_end_date",
1160
+ "onboarding",
1161
+ "promo_constraints",
1162
+ "unsupported_content_type"
1163
+ ])),
1164
+ blockingIssues: z7.array(z7.string()),
1165
+ budgetConstraints: z7.object({
1166
+ budgetType: z7.enum(["DAILY", "TOTAL"]).nullable(),
1167
+ currency: z7.string().length(3),
1168
+ currencyExponent: z7.number().int().min(0).max(3),
1169
+ effectiveDailyBudgetMinor: z7.number().int().nonnegative().nullable(),
1170
+ maximumBudgetMinor: z7.number().int().nonnegative().nullable(),
1171
+ maximumDailyBudgetMinor: z7.number().int().nonnegative(),
1172
+ maximumTotalBudgetMinor: z7.number().int().nonnegative(),
1173
+ minimumBudgetMinor: z7.number().int().nonnegative().nullable(),
1174
+ minimumCampaignDays: z7.number().int().positive(),
1175
+ minimumDailyBudgetMinor: z7.number().int().nonnegative(),
1176
+ minimumEndDate: z7.iso.date(),
1177
+ minimumTotalBudgetMinor: z7.number().int().nonnegative()
1178
+ }).strict().nullable(),
1179
+ campaignType: z7.enum(["SMART_CAMPAIGN", "YOUTUBE"]),
1180
+ fundingPreview: CampaignFundingPreviewOutputSchema.nullable().optional(),
1181
+ isReady: z7.boolean(),
1182
+ missingInputs: z7.array(z7.string()),
226
1183
  normalizedTargeting: NormalizedTargetingOutputSchema,
227
- recommendedNextAction: z.string(),
228
- warnings: z.array(z.string())
1184
+ recommendedNextAction: z7.string(),
1185
+ warnings: z7.array(z7.string()),
1186
+ youtubeEntries: z7.array(z7.object({
1187
+ playlistId: z7.string().nullable().optional(),
1188
+ videoId: z7.string()
1189
+ }).strict()).optional()
229
1190
  }).strict();
230
1191
  var CreateSmartLinkFromSpotifyDataOutputSchema = SmartLinkDetailsOutputSchema.extend({
231
- outcome: z.enum(["created", "existing"]),
232
- workflowWarning: z.string().nullable()
1192
+ outcome: z7.enum(["created", "existing"]),
1193
+ workflowWarning: z7.string().nullable()
233
1194
  }).strict();
234
- var CreateSmartLinksFromSpotifyArtistDataOutputSchema = z.object({
235
- artistCreatedFromSpotify: z.boolean().optional(),
236
- artistHubUrl: z.string(),
237
- artistId: z.string(),
238
- artistName: z.string(),
239
- catalogImportStatus: z.enum(["started", "start_failed"]),
240
- currentSmartLinkCount: z.number(),
241
- existingCount: z.number(),
1195
+ var CreateSmartLinksFromSpotifyArtistDataOutputSchema = z7.object({
1196
+ artistCreatedFromSpotify: z7.boolean().optional(),
1197
+ artistHubUrl: z7.string(),
1198
+ artistId: z7.string(),
1199
+ artistName: z7.string(),
1200
+ catalogImportStatus: z7.enum(["started", "start_failed"]),
1201
+ currentSmartLinkCount: z7.number(),
1202
+ existingCount: z7.number(),
242
1203
  initialSmartLink: SmartLinkSummaryOutputSchema.nullable(),
243
- newlyAvailableCount: z.number(),
244
- nextActions: z.array(z.string()),
245
- smartLinks: z.array(SmartLinkSummaryOutputSchema),
246
- spotifyArtistUrl: z.string(),
247
- summary: z.string(),
248
- warnings: z.array(z.string()).optional()
1204
+ newlyAvailableCount: z7.number(),
1205
+ nextActions: z7.array(z7.string()),
1206
+ smartLinks: z7.array(SmartLinkSummaryOutputSchema),
1207
+ spotifyArtistUrl: z7.string(),
1208
+ summary: z7.string(),
1209
+ warnings: z7.array(z7.string()).optional()
249
1210
  }).strict();
250
- var LaunchCampaignDataOutputSchema = z.object({
1211
+ var LaunchCampaignDataOutputSchema = z7.object({
251
1212
  budget: MoneyDisplayOutputSchema,
252
- budgetType: z.enum(["DAILY", "TOTAL"]),
253
- campaignType: z.enum(["SMART_CAMPAIGN", "YOUTUBE"]),
254
- contentTitle: z.string(),
255
- deliveryState: z.enum(["ACTIVE", "PENDING_REVIEW", "CONTENT_VALIDATION"]),
256
- id: z.string(),
257
- isLive: z.boolean(),
258
- nextSteps: z.array(z.string()),
259
- platforms: z.array(z.string()),
260
- status: z.string(),
261
- summary: z.string(),
262
- warnings: z.array(z.string()).optional()
1213
+ budgetType: z7.enum(["DAILY", "TOTAL"]),
1214
+ campaignType: z7.enum(["SMART_CAMPAIGN", "YOUTUBE"]),
1215
+ contentTitle: z7.string(),
1216
+ deliveryState: z7.enum(["ACTIVE", "PENDING_REVIEW", "CONTENT_VALIDATION"]),
1217
+ id: z7.string(),
1218
+ isLive: z7.boolean(),
1219
+ nextSteps: z7.array(z7.string()),
1220
+ platforms: z7.array(z7.string()),
1221
+ status: z7.string(),
1222
+ summary: z7.string(),
1223
+ warnings: z7.array(z7.string()).optional(),
1224
+ youtubeEntries: z7.array(z7.object({
1225
+ playlistId: z7.string(),
1226
+ selectionIndex: z7.number(),
1227
+ videoId: z7.string()
1228
+ }).strict()).optional()
263
1229
  }).strict();
264
1230
  var AnyOutputEnvelopeSchema = createOutputEnvelopeSchema(AnyToolDataOutputSchema, { allowPartial: true });
265
- var ListMediaAssetsOutputEnvelopeSchema = createOutputEnvelopeSchema(z.union([
1231
+ var GetCampaignOutputEnvelopeSchema = createOutputEnvelopeSchema(z7.object({
1232
+ analytics: z7.object({
1233
+ countsAvailability: z7.enum(["available", "incomplete", "sample", "not_linked"]).optional()
1234
+ }).passthrough().optional(),
1235
+ channelResults: ChannelResultsSchema.optional(),
1236
+ summary: z7.string()
1237
+ }).passthrough(), { allowPartial: true });
1238
+ var UpdateCampaignOutputEnvelopeSchema = createOutputEnvelopeSchema(z7.union([
1239
+ z7.object({
1240
+ actionRequired: z7.array(z7.string()).optional(),
1241
+ contentTitle: z7.string(),
1242
+ id: z7.string(),
1243
+ newStatus: z7.enum(["PAUSED", "ACTIVE"]),
1244
+ platformResults: z7.array(z7.object({
1245
+ message: z7.string().optional(),
1246
+ platform: z7.enum(["META", "GOOGLE"]),
1247
+ success: z7.boolean()
1248
+ }).strict()),
1249
+ warnings: z7.array(z7.string()).optional()
1250
+ }).strict(),
1251
+ z7.object({
1252
+ actionRequired: z7.array(z7.string()).optional(),
1253
+ budgetType: z7.enum(["DAILY", "TOTAL"]),
1254
+ contentTitle: z7.string(),
1255
+ endDate: z7.string().optional(),
1256
+ id: z7.string(),
1257
+ newBudget: MoneyDisplayOutputSchema,
1258
+ previousBudget: MoneyDisplayOutputSchema,
1259
+ warnings: z7.array(z7.string()).optional()
1260
+ }).strict(),
1261
+ z7.object({
1262
+ contentTitle: z7.string(),
1263
+ didChange: z7.boolean(),
1264
+ endDate: z7.string().nullable(),
1265
+ id: z7.string(),
1266
+ previousEndDate: z7.string().nullable()
1267
+ }).strict(),
1268
+ z7.object({
1269
+ campaignId: z7.string(),
1270
+ locationTargets: z7.array(z7.object({ code: z7.string(), name: z7.string() }).strict()),
1271
+ mode: z7.enum(["GLOBAL", "COUNTRIES"])
1272
+ }).strict(),
1273
+ z7.object({
1274
+ campaignId: z7.string(),
1275
+ contentTitle: z7.string(),
1276
+ id: z7.string(),
1277
+ inventoryConfig: z7.string(),
1278
+ strategy: z7.string()
1279
+ }).strict(),
1280
+ z7.object({
1281
+ contentTitle: z7.string(),
1282
+ id: z7.string(),
1283
+ newStatus: z7.literal("ARCHIVED"),
1284
+ warnings: z7.array(z7.string())
1285
+ }).strict(),
1286
+ z7.object({
1287
+ campaignId: z7.string(),
1288
+ monetizationQualificationMode: z7.enum([
1289
+ "STANDARD",
1290
+ "MONETIZATION_QUALIFICATION"
1291
+ ]),
1292
+ optimizeForOrganicViews: z7.boolean(),
1293
+ optimizeForSubscribers: z7.boolean()
1294
+ }).strict()
1295
+ ]), { allowPartial: true });
1296
+ var ListMediaAssetsOutputEnvelopeSchema = createOutputEnvelopeSchema(z7.union([
266
1297
  ListMediaAssetsDataOutputSchema,
267
1298
  ListMediaAssetsSummaryOutputSchema
268
1299
  ]));
269
1300
  var LaunchCampaignOutputEnvelopeSchema = createOutputEnvelopeSchema(LaunchCampaignDataOutputSchema);
270
- var ListAvailableCountriesOutputEnvelopeSchema = createOutputEnvelopeSchema(z.union([ListAvailableCountriesDataOutputSchema, SummaryCountOutputSchema]));
271
- var GetCampaignReadinessOutputEnvelopeSchema = createOutputEnvelopeSchema(z.union([
1301
+ var ManageYoutubeDraftOutputEnvelopeSchema = createOutputEnvelopeSchema(z7.union([
1302
+ z7.object({
1303
+ artistId: z7.string().uuid(),
1304
+ draft: z7.object({
1305
+ campaignId: z7.string().uuid(),
1306
+ completedSteps: z7.array(z7.string()),
1307
+ content: z7.object({
1308
+ screening: z7.object({ status: z7.string() }).passthrough().nullable()
1309
+ }).passthrough()
1310
+ }).passthrough().nullable(),
1311
+ failureStage: z7.string().nullable(),
1312
+ updatedAt: z7.string().datetime().nullable()
1313
+ }).strict(),
1314
+ z7.object({
1315
+ artistId: z7.string().uuid(),
1316
+ campaignId: z7.string().uuid(),
1317
+ discarded: z7.literal(true)
1318
+ }).strict()
1319
+ ]));
1320
+ var ListAvailableCountriesOutputEnvelopeSchema = createOutputEnvelopeSchema(z7.union([ListAvailableCountriesDataOutputSchema, SummaryCountOutputSchema]));
1321
+ var GetCampaignReadinessOutputEnvelopeSchema = createOutputEnvelopeSchema(z7.union([
272
1322
  GetCampaignReadinessDataOutputSchema,
273
1323
  SummaryWarningsActionsOutputSchema
274
1324
  ]));
1325
+ var GetYouTubeChannelDataOutputEnvelopeSchema = createOutputEnvelopeSchema(YouTubeChannelDataSchema);
275
1326
  var CreateSmartLinkFromSpotifyOutputEnvelopeSchema = createOutputEnvelopeSchema(CreateSmartLinkFromSpotifyDataOutputSchema);
276
1327
  var CreateSmartLinksFromSpotifyArtistOutputEnvelopeSchema = createOutputEnvelopeSchema(CreateSmartLinksFromSpotifyArtistDataOutputSchema);
277
- var ListSmartLinksOutputEnvelopeSchema = createOutputEnvelopeSchema(z.union([ListSmartLinksDataOutputSchema, ListSmartLinksSummaryOutputSchema]));
1328
+ var ListSmartLinksOutputEnvelopeSchema = createOutputEnvelopeSchema(z7.union([ListSmartLinksDataOutputSchema, ListSmartLinksSummaryOutputSchema]));
1329
+ var ResumeFundingDataSchema = z7.object({
1330
+ appliedCreditsCents: z7.number().int().nonnegative(),
1331
+ appliedCreditsMinor: z7.number().int().nonnegative().optional(),
1332
+ budgetCents: z7.number().int().nonnegative(),
1333
+ budgetMinor: z7.number().int().nonnegative().optional(),
1334
+ consent: z7.object({
1335
+ copy: z7.string().min(1),
1336
+ copyHash: z7.string().min(1),
1337
+ version: z7.string().min(1)
1338
+ }).nullable(),
1339
+ coveredByFundedWindow: z7.boolean(),
1340
+ currency: z7.string().length(3),
1341
+ currencyExponent: z7.number().int().min(0).max(3).optional(),
1342
+ deliveryWindowCents: z7.number().int().nonnegative(),
1343
+ deliveryWindowMinor: z7.number().int().nonnegative().optional(),
1344
+ firstWindow: z7.boolean(),
1345
+ formatted: z7.object({
1346
+ appliedCredits: z7.string(),
1347
+ budget: z7.string(),
1348
+ deliveryWindow: z7.string(),
1349
+ netImmediateCharge: z7.string()
1350
+ }),
1351
+ isTotal: z7.boolean(),
1352
+ netImmediateChargeCents: z7.number().int().nonnegative(),
1353
+ netImmediateChargeMinor: z7.number().int().nonnegative().optional(),
1354
+ paymentMethod: z7.object({
1355
+ brand: z7.string().nullable(),
1356
+ displayName: z7.string(),
1357
+ last4: z7.string().nullable()
1358
+ }).nullable(),
1359
+ refusal: z7.enum([
1360
+ "card_collection_closed",
1361
+ "credit_review_required",
1362
+ "payment_method_required"
1363
+ ]).nullable()
1364
+ });
1365
+ var GetResumeFundingOutputEnvelopeSchema = createOutputEnvelopeSchema(z7.union([ResumeFundingDataSchema, z7.object({ summary: z7.string() })]));
278
1366
 
279
1367
  // src/server/about.ts
280
1368
  var DYNAMOI_ABOUT_INTRO = "Dynamoi is a music marketing platform founded in 2021 by Trevor Loucks. It runs managed Meta and YouTube ad campaigns, music distribution, and royalty analytics for independent artists, labels, managers, and YouTube creators, alongside free Smart Links and analytics. An artist can go from a Spotify URL to a shareable release page, a running campaign, or a distribution application in one place: Dynamoi brings the whole artist lifecycle (distribution, campaigns, and royalties) into one system.";
@@ -286,7 +1374,7 @@ var DYNAMOI_ABOUT_COMPANY = `## Company
286
1374
  - **Support** — email support@dynamoi.com. The Dynamoi team replies within 24 hours.`;
287
1375
  var DYNAMOI_ABOUT_CAMPAIGN_NOTE = "Campaigns run on Dynamoi's own managed Meta and Google ad infrastructure, so artists do not need their own Business Manager, pixels, or ad accounts. They reach real people through official ad networks, never bots, fake streams, click farms, or paid playlist placement. Results vary by campaign and are never guaranteed.";
288
1376
  var DYNAMOI_ABOUT_SMART_LINKS_BULLET = "- **Free Smart Links** — create and manage Smart Links and artist hubs from Spotify artist, album, or track URLs at no cost. Link analytics, custom themes, validated pixel IDs, and team seats are included. High-popularity or unverifiable artist links may stay unpublished in verification hold until Dynamoi can verify the client relationship.";
289
- var DYNAMOI_ABOUT_YOUTUBE_BULLET = "- **YouTube campaigns** — managed Google Ads campaigns for YouTube channel growth. Dynamoi optimizes ad spend against AdSense revenue per country, so delivery favors audiences that actually monetize.";
1377
+ var DYNAMOI_ABOUT_YOUTUBE_BULLET = "- **YouTube campaigns** — managed campaigns on Google's ad network for YouTube channel growth. Each campaign follows a strategy (Views, Watch Time, Subscribers, Channel Growth, or Revenue for monetized channels) and is judged from the channel's own YouTube data. Every strategy except Views starts viewers in a playlist of the artist's own videos.";
290
1378
  var DYNAMOI_ABOUT_DISTRIBUTION_GATE = "Dynamoi scores five requirements before an application can be submitted — including an established audience (at least 10,000 monthly Spotify listeners) and identity verification — and approval is not guaranteed.";
291
1379
  var DYNAMOI_ABOUT_GETTING_STARTED = `## How to get started
292
1380
 
@@ -302,7 +1390,7 @@ ${DYNAMOI_ABOUT_INTRO}
302
1390
  ${DYNAMOI_ABOUT_SMART_LINKS_BULLET}
303
1391
  - **Managed Smart Campaigns** — Dynamoi runs Meta ad campaigns that promote Spotify tracks, albums, and playlists.
304
1392
  ${DYNAMOI_ABOUT_YOUTUBE_BULLET}
305
- - **Music distribution** — an opt-in product that delivers releases to 100+ stores including Spotify, Apple Music, Amazon Music, YouTube Music, TikTok, Deezer, and Tidal. The artist keeps 90% of Net Receipts (Dynamoi keeps 10%), there are no upfront release fees, and Content ID is included. Optional publishing administration is available to distribution clients for 10% of Net Receipts. ${DYNAMOI_ABOUT_DISTRIBUTION_GATE}
1393
+ - **Music distribution** — an opt-in product that delivers releases to 100+ stores including Spotify, Apple Music, Amazon Music, YouTube Music, TikTok, Deezer, and Tidal. The artist keeps 90% of Net Receipts (Dynamoi keeps 10%), and there are no upfront release fees. Optional publishing administration is available to distribution clients for 10% of Net Receipts. ${DYNAMOI_ABOUT_DISTRIBUTION_GATE}
306
1394
  - **YouTube promotion Shop** — one-off YouTube promotion purchases without a subscription, for users who do not want managed advertising.
307
1395
 
308
1396
  ${DYNAMOI_ABOUT_CAMPAIGN_NOTE}
@@ -313,7 +1401,7 @@ ${DYNAMOI_ABOUT_GETTING_STARTED}
313
1401
 
314
1402
  ## Pricing
315
1403
 
316
- Smart Links are free. Starter is $25/month with a $50 launch campaign credit, and campaign budgets start at $10/day. There are no contracts: pause between releases or cancel anytime and keep your free tools. Managed advertising and distribution are paid products — see current plans and pricing at https://dynamoi.com/pricing.`;
1404
+ Smart Links are free. In USD, Starter is $25/month with a $50 launch campaign credit, and campaign budgets start at $10/day. Other currencies use their own approved catalog prices and limits; consult the selected account’s billing response. There are no contracts: pause between releases or cancel anytime and keep your free tools. Managed advertising and distribution are paid products — see current plans and pricing at https://dynamoi.com/pricing.`;
317
1405
  var DYNAMOI_ABOUT_DIRECTORY_MARKDOWN = `# About Dynamoi
318
1406
 
319
1407
  ${DYNAMOI_ABOUT_INTRO}
@@ -330,7 +1418,7 @@ ${DYNAMOI_ABOUT_CAMPAIGN_NOTE}
330
1418
  ${DYNAMOI_ABOUT_COMPANY}
331
1419
 
332
1420
  ${DYNAMOI_ABOUT_GETTING_STARTED}`;
333
- var DYNAMOI_ABOUT_SUMMARY = "Dynamoi is a music marketing platform founded in 2021 by Trevor Loucks and based in Sioux Falls, South Dakota: free Smart Links and analytics, managed Meta Smart Campaigns and YouTube campaigns, a YouTube promotion Shop, and opt-in distribution to 100+ stores. Operated by humans, assisted by AI. Starter is $25/month with a $50 launch campaign credit, and campaign budgets start at $10/day. Sign in at dynamoi.com, connect Spotify, and create a free Smart Link to start. Pricing: https://dynamoi.com/pricing. Support: support@dynamoi.com (replies within 24 hours).";
1421
+ var DYNAMOI_ABOUT_SUMMARY = "Dynamoi is a music marketing platform founded in 2021 by Trevor Loucks and based in Sioux Falls, South Dakota: free Smart Links and analytics, managed Meta Smart Campaigns and YouTube campaigns, a YouTube promotion Shop, and opt-in distribution to 100+ stores. Operated by humans, assisted by AI. In USD, Starter is $25/month with a $50 launch campaign credit, and campaign budgets start at $10/day. Other currencies use their own approved catalog prices and limits; consult the selected account’s billing response. Sign in at dynamoi.com, connect Spotify, and create a free Smart Link to start. Pricing: https://dynamoi.com/pricing. Support: support@dynamoi.com (replies within 24 hours).";
334
1422
  var DYNAMOI_ABOUT_DIRECTORY_SUMMARY = "Dynamoi is a music marketing platform founded in 2021 by Trevor Loucks and based in Sioux Falls, South Dakota: free Smart Links and analytics, managed Meta Smart Campaigns and YouTube campaigns, and opt-in distribution to 100+ stores. Operated by humans, assisted by AI. Sign in at dynamoi.com, connect Spotify, and create a free Smart Link to start. Support: support@dynamoi.com (replies within 24 hours).";
335
1423
  var DYNAMOI_ABOUT_RESOURCE = {
336
1424
  description: "Canonical About Dynamoi overview: what Dynamoi is, who it is for, free Smart Links, managed Smart Campaigns, YouTube campaigns, distribution, company facts, support, and how to get started.",
@@ -347,7 +1435,7 @@ var DYNAMOI_ABOUT_TOOL_DEFINITION = {
347
1435
  openWorldHint: false,
348
1436
  outputSchema: AnyOutputEnvelopeSchema,
349
1437
  readOnlyHint: true,
350
- schema: z2.object({}).strict(),
1438
+ schema: z8.object({}).strict(),
351
1439
  title: "About Dynamoi"
352
1440
  };
353
1441
  function getDynamoiAbout(options) {
@@ -370,25 +1458,25 @@ function getDynamoiAbout(options) {
370
1458
  import {
371
1459
  McpServer
372
1460
  } from "@modelcontextprotocol/server";
373
- import * as z12 from "zod/v4";
1461
+ import * as z18 from "zod/v4";
374
1462
 
375
1463
  // src/version.ts
376
- var BUNDLED_DYNAMOI_MCP_VERSION = "1.0.1";
377
- var DYNAMOI_MCP_VERSION = BUNDLED_DYNAMOI_MCP_VERSION.length > 0 && !BUNDLED_DYNAMOI_MCP_VERSION.includes("__") ? BUNDLED_DYNAMOI_MCP_VERSION : "1.0.1";
1464
+ var BUNDLED_DYNAMOI_MCP_VERSION = "1.0.2";
1465
+ var DYNAMOI_MCP_VERSION = BUNDLED_DYNAMOI_MCP_VERSION.length > 0 && !BUNDLED_DYNAMOI_MCP_VERSION.includes("__") ? BUNDLED_DYNAMOI_MCP_VERSION : "1.0.2";
378
1466
 
379
1467
  // src/server/distribution-tools.ts
380
- import * as z3 from "zod/v4";
381
- var DynamoiGetDistributionApplicationInputSchema = z3.object({
382
- artistId: z3.string().uuid()
1468
+ import * as z9 from "zod/v4";
1469
+ var DynamoiGetDistributionApplicationInputSchema = z9.object({
1470
+ artistId: z9.string().uuid()
383
1471
  }).strict();
384
- var DynamoiApplyForDistributionInputSchema = z3.object({
385
- adultSignerAttestation: z3.literal(true),
386
- applicantCountry: z3.string().trim().length(2),
387
- artistId: z3.string().uuid(),
388
- confirmApplicationSubmission: z3.literal(true),
389
- payoutCountry: z3.string().trim().length(2),
390
- taxResidencyCountry: z3.string().trim().length(2),
391
- userIntentSummary: z3.string().trim().min(1).max(500)
1472
+ var DynamoiApplyForDistributionInputSchema = z9.object({
1473
+ adultSignerAttestation: z9.literal(true),
1474
+ applicantCountry: z9.string().trim().length(2),
1475
+ artistId: z9.string().uuid(),
1476
+ confirmApplicationSubmission: z9.literal(true),
1477
+ payoutCountry: z9.string().trim().length(2),
1478
+ taxResidencyCountry: z9.string().trim().length(2),
1479
+ userIntentSummary: z9.string().trim().min(1).max(500)
392
1480
  }).strict();
393
1481
  var DISTRIBUTION_TOOL_DEFINITIONS = [
394
1482
  {
@@ -432,7 +1520,7 @@ Route by state from dynamoi_get_account_overview:
432
1520
 
433
1521
  - state.hasAnyArtist === false: This is a brand-new user. Ask whether they are a Spotify artist, a YouTube creator, or a label/manager.
434
1522
  - Spotify artist with a URL → call dynamoi_create_smart_links_from_spotify_artist immediately to create their free hub. Read dynamoi://playbooks/spotify-artist for scripted phrasing.
435
- - YouTube creator → read dynamoi://playbooks/youtube-creator and explain Dynamoi's revenue-per-view optimization advantage before asking whether they want to link the channel. If yes, call dynamoi_start_youtube_channel_link.
1523
+ - YouTube creator → read dynamoi://playbooks/youtube-creator and explain how Dynamoi campaigns grow organic views, subscribers and, for monetized channels, channel revenue before asking whether they want to link the channel. If yes, call dynamoi_start_youtube_channel_link.
436
1524
  - Label or manager with a roster → read dynamoi://playbooks/label-or-manager for the multi-artist setup walkthrough.
437
1525
 
438
1526
  - state.hasAnyArtist === true && state.hasAnySmartLink === false: The fastest visible win is a free Smart Link. Offer dynamoi_create_smart_link_from_spotify (single release) or dynamoi_create_smart_links_from_spotify_artist (full catalog) before campaign tools.
@@ -470,8 +1558,9 @@ Principles:
470
1558
  - When the user asks about music distribution, call dynamoi_get_distribution_application before making eligibility claims. Treat its five scored requirements as authoritative. Applicant country, tax-residency country, payout country, and the adult signer attestation are required submission fields, but they are not additional eligibility-score requirements.
471
1559
  - For missing Meta or YouTube distribution identity, use purpose=distribution_identity on the relevant connection tool when that tool is available. These least-privilege identity flows do not require advertising billing. Never substitute the advertising flow.
472
1560
  - Call dynamoi_apply_for_distribution only after the user explicitly asks to submit, confirms the application, provides valid ISO country or territory fields, and attests that the signer is an adult. Submission starts manual review; country, tax, payout, sanctions, and provider-delivery gates still decide progression. It never implies approval, agreement acceptance, release submission, rights clearance, store delivery, royalty setup, or payout readiness.
473
- - Money values are shown in USD as presented in Dynamoi.
474
- - Budget minimums: $10/day (daily), $50 total (Smart Campaign), $50 total (YouTube).
1561
+ - YouTube campaigns each have a strategy with its own goal. Before judging results, read the strategyGuide that dynamoi_get_campaign returns (or dynamoi://youtube/campaign-strategies). When reporting to users, say "the ad network" (you may name Google once; do not repeat "Google Ads"; it serves on YouTube), "advertising-tagged views" (YouTube's ADVERTISING traffic source, which undercounts ad-driven views), "campaign-period lift" (views above the pre-campaign baseline while the campaign runs, mostly ad sessions) and "organic lift" (growth in sources the ads do not touch, such as search and suggested views, or lift that persists after spend stops). Never call all non-ADVERTISING views organic: ad clicks into a playlist are credited mostly to PLAYLIST and SUBSCRIBER. Use strategy labels such as "Revenue Optimization" with users, not keys such as ADSENSE_ROI.
1562
+ - Preserve each returned money value’s currency, exponent and formatted amount. Never relabel a local amount as USD or combine amounts in different currencies.
1563
+ - Read budget minimums and caps from the selected artist’s readiness or budget-policy response. Fixed USD examples are not limits for other currencies.
475
1564
  - Shop tools are a separate one-off purchase surface for YouTube promotion, independent of managed-advertising billing. Use dynamoi_shop_get_quote for a read-only Shop estimate. Use dynamoi_shop_create_checkout only after explicit user intent to create an unpaid Stripe Checkout Session. Re-quote when the tool reports a changed amount. Never describe Checkout creation as payment, an order, or campaign launch.
476
1565
  - Product and pricing details are available as MCP resources. Keep runtime answers
477
1566
  focused on the user's account data and requested action.
@@ -483,6 +1572,10 @@ Common workflows:
483
1572
  dynamoi_list_campaigns to resolve missing or ambiguous identity, then read the
484
1573
  resolved resource.
485
1574
  - Artist performance summary: dynamoi_get_artist_analytics with granularity=DAILY when requested. If that response already includes the strongest campaign, do not call more analytics tools.
1575
+ - Spotify growth score, recommendations, and listener or playlist-reach trends: dynamoi_get_growth_audit. Keep its status, coverage dates, and limitations with the answer; it is separate from paid campaign performance.
1576
+ - Tracked playlist reach, placements, and movement: dynamoi_get_playlist_analytics. Include the returned freshness and snapshot dates; these observations are not campaign attribution.
1577
+ - Streaming audience by country, service, paid/free tier, or daily trend: dynamoi_get_audience_analytics, with range=7d, 30d, or 90d. Report source unavailability as unavailable rather than zero audience.
1578
+ - YouTube channel data science (trends, videos, countries, traffic sources, advertising-tagged versus other-source views, revenue): dynamoi_get_youtube_channel_data, one dataset per call, paging with nextCursor. It supports channel analysis, not campaign attribution. Preserve the returned source, coverage, freshness, and synthetic/sample qualifications; do not treat synthetic/sample data as observed channel results, campaign attribution, or actual earnings/payouts. Treat returned ad revenue as estimated revenue, not an AdSense payout.
486
1579
  - Diagnose stuck campaign: dynamoi_get_campaign → dynamoi_get_platform_status →
487
1580
  propose next steps
488
1581
  - Pause/resume: dynamoi_get_campaign (confirm) → dynamoi_update_campaign with action=pause or action=resume; a resume that needs card funding also requires the funding-consent fields (see the tool description).
@@ -528,14 +1621,22 @@ Principles:
528
1621
  - For an identified campaign, call dynamoi_get_campaign directly. Use
529
1622
  dynamoi_list_campaigns to resolve a missing or ambiguous campaign, and use
530
1623
  dynamoi_get_artist_analytics when the user asks for artist performance.
1624
+ For analysis of the artist's own YouTube channel (trends, videos, countries,
1625
+ traffic sources, advertising-tagged versus other-source views, revenue), use
1626
+ dynamoi_get_youtube_channel_data for channel analysis, not campaign attribution.
1627
+ Preserve the returned source, coverage, freshness, and synthetic/sample qualifications; do not treat synthetic/sample data as observed channel results, campaign attribution, or actual earnings/payouts. Treat returned ad revenue as estimated revenue, not an AdSense payout.
531
1628
  These tools are read-only.
1629
+ - YouTube campaigns each have a strategy with its own goal. Before judging results, read the strategyGuide that dynamoi_get_campaign returns (or dynamoi://youtube/campaign-strategies). When reporting to users, say "the ad network" (you may name Google once; do not repeat "Google Ads"; it serves on YouTube), "advertising-tagged views" (YouTube's ADVERTISING traffic source, which undercounts ad-driven views), "campaign-period lift" (views above the pre-campaign baseline while the campaign runs, mostly ad sessions) and "organic lift" (growth in sources the ads do not touch, such as search and suggested views, or lift that persists after spend stops). Never call all non-ADVERTISING views organic: ad clicks into a playlist are credited mostly to PLAYLIST and SUBSCRIBER. Use strategy labels such as "Revenue Optimization" with users, not keys such as ADSENSE_ROI.
1630
+ - Spotify growth audit, tracked playlist analytics, and streaming audience analytics answer different questions from paid campaign analytics: use dynamoi_get_growth_audit, dynamoi_get_playlist_analytics, and dynamoi_get_audience_analytics for those insight requests, and preserve each response's coverage or freshness evidence.
532
1631
  - For music distribution, use dynamoi_get_distribution_application to explain the exact
533
1632
  five requirements and current application status. Use dynamoi_apply_for_distribution
534
1633
  only after explicit user confirmation and complete country/adult-attestation fields.
535
1634
  An application starts manual review and never guarantees approval or distributes a release.
536
1635
  - For free Smart Links, use dynamoi_create_smart_link_from_spotify,
537
1636
  dynamoi_create_smart_links_from_spotify_artist, dynamoi_list_smart_links,
538
- dynamoi_get_smart_link, and dynamoi_update_smart_link.
1637
+ and dynamoi_get_smart_link. Use dynamoi_update_smart_link_description only
1638
+ for one link's public description, or dynamoi_update_smart_link_artist_settings
1639
+ only for artist-level theme and validated pixel settings.
539
1640
  - When reading Smart Links, set includeAnalytics=true for visit/click analytics and
540
1641
  includeArtistSettings=true for artist-level theme or pixel settings.
541
1642
  - Smart Link pixel tools accept validated pixel IDs only. Do not ask for arbitrary
@@ -551,7 +1652,7 @@ Principles:
551
1652
  `.trim();
552
1653
 
553
1654
  // src/server/prompts.ts
554
- import * as z4 from "zod/v4";
1655
+ import * as z10 from "zod/v4";
555
1656
  function asTextPrompt(text) {
556
1657
  return {
557
1658
  messages: [
@@ -564,9 +1665,9 @@ function asTextPrompt(text) {
564
1665
  }
565
1666
  function registerDynamoiPrompts(server) {
566
1667
  server.registerPrompt("dynamoi_find_smart_link_url", {
567
- argsSchema: z4.object({
568
- artistId: z4.string().uuid().optional(),
569
- query: z4.string().trim().optional()
1668
+ argsSchema: z10.object({
1669
+ artistId: z10.string().uuid().optional(),
1670
+ query: z10.string().trim().optional()
570
1671
  }),
571
1672
  description: "Find a user's free Smart Link URL and answer with public URLs, titles, and statuses.",
572
1673
  title: "Find Smart Link URL"
@@ -580,7 +1681,7 @@ function registerDynamoiPrompts(server) {
580
1681
  ].filter(Boolean).join(`
581
1682
  `)));
582
1683
  server.registerPrompt("dynamoi_explain_free_smart_links", {
583
- argsSchema: z4.object({}),
1684
+ argsSchema: z10.object({}),
584
1685
  description: "Explain Dynamoi free Smart Links and how they differ from paid managed advertising.",
585
1686
  title: "Explain Free Smart Links"
586
1687
  }, () => asTextPrompt([
@@ -591,9 +1692,9 @@ function registerDynamoiPrompts(server) {
591
1692
  ].join(`
592
1693
  `)));
593
1694
  server.registerPrompt("dynamoi_create_free_smart_link", {
594
- argsSchema: z4.object({
595
- artistId: z4.string().uuid().optional(),
596
- spotifyUrl: z4.string().trim().optional()
1695
+ argsSchema: z10.object({
1696
+ artistId: z10.string().uuid().optional(),
1697
+ spotifyUrl: z10.string().trim().optional()
597
1698
  }),
598
1699
  description: "Create free Smart Links from a Spotify artist, album, or track URL.",
599
1700
  title: "Create Free Smart Link"
@@ -607,8 +1708,8 @@ function registerDynamoiPrompts(server) {
607
1708
  ].join(`
608
1709
  `)));
609
1710
  server.registerPrompt("dynamoi_audit_campaigns", {
610
- argsSchema: z4.object({
611
- artistId: z4.string().uuid().optional()
1711
+ argsSchema: z10.object({
1712
+ artistId: z10.string().uuid().optional()
612
1713
  }),
613
1714
  description: "Audit an artist's campaigns and summarize what is working and what to fix next.",
614
1715
  title: "Audit Campaigns"
@@ -623,10 +1724,10 @@ function registerDynamoiPrompts(server) {
623
1724
  ].join(`
624
1725
  `)));
625
1726
  server.registerPrompt("dynamoi_release_launch_plan", {
626
- argsSchema: z4.object({
627
- artistId: z4.string().uuid().optional(),
628
- contentTitle: z4.string().trim().optional(),
629
- contentType: z4.enum(["TRACK", "ALBUM", "PLAYLIST", "VIDEO"]).optional()
1727
+ argsSchema: z10.object({
1728
+ artistId: z10.string().uuid().optional(),
1729
+ contentTitle: z10.string().trim().optional(),
1730
+ contentType: z10.enum(["TRACK", "ALBUM", "PLAYLIST", "VIDEO"]).optional()
630
1731
  }),
631
1732
  description: "Create a pragmatic release launch plan and propose a Dynamoi campaign setup.",
632
1733
  title: "Release Launch Plan"
@@ -647,8 +1748,8 @@ function registerDynamoiPrompts(server) {
647
1748
  ].filter(Boolean).join(`
648
1749
  `)));
649
1750
  server.registerPrompt("dynamoi_why_campaign_blocked", {
650
- argsSchema: z4.object({
651
- campaignId: z4.string().uuid()
1751
+ argsSchema: z10.object({
1752
+ campaignId: z10.string().uuid()
652
1753
  }),
653
1754
  description: "Diagnose why a campaign is blocked/stuck and recommend the next fix.",
654
1755
  title: "Why Is My Campaign Blocked?"
@@ -666,7 +1767,13 @@ function registerDynamoiPrompts(server) {
666
1767
 
667
1768
  // src/server/resources.ts
668
1769
  import { ResourceTemplate } from "@modelcontextprotocol/server";
669
- import * as z5 from "zod/v4";
1770
+ import * as z11 from "zod/v4";
1771
+
1772
+ // src/server/budget-minimums.ts
1773
+ var USD_BUDGET_MINIMUMS = {
1774
+ smartCampaign: { dailyUsd: 10, totalUsd: 50 },
1775
+ youtube: { dailyUsd: 10, totalUsd: 75 }
1776
+ };
670
1777
 
671
1778
  // src/server/playbook-resources.ts
672
1779
  function registerPlaybookResources(server) {
@@ -712,7 +1819,7 @@ function registerPlaybookResources(server) {
712
1819
  ]
713
1820
  }));
714
1821
  server.registerResource("playbook-youtube-creator", "dynamoi://playbooks/youtube-creator", {
715
- description: "Persona playbook: how to introduce a YouTube creator to Dynamoi's revenue-per-view optimization advantage.",
1822
+ description: "Persona playbook: how to introduce a YouTube creator to Dynamoi's goal-based YouTube campaigns.",
716
1823
  mimeType: "application/json",
717
1824
  title: "Playbook: YouTube Creator"
718
1825
  }, async (uri) => ({
@@ -721,21 +1828,21 @@ function registerPlaybookResources(server) {
721
1828
  mimeType: "application/json",
722
1829
  text: JSON.stringify({
723
1830
  channelLinkingPath: "When connection tools are available to this client, call dynamoi_start_youtube_channel_link for the target artist, give the user the returned Google authorization URL, then poll dynamoi_get_platform_status for that artist with the returned onboardingAttemptId and onboardingFlow=youtube after the return page sends them back to chat. The completion field is platforms.youtube.connected. On surfaces without connection tools, direct the user: 'You can do this in the Dynamoi dashboard at https://dynamoi.com/dashboard.'",
724
- differentiator: "Dynamoi optimizes YouTube ad spend against AdSense revenue per country. Most ad tools optimize for views; Dynamoi optimizes for views that make money. The system explores small bids in new markets, scales countries where viewer revenue is strong, and pauses countries that cannot cover their costs.",
1831
+ differentiator: "Dynamoi runs YouTube campaigns on Google's ad network aimed at what the channel needs, not raw views: organic views, subscribers, or channel revenue for monetized channels. Each ad starts viewers in a playlist of the artist's own videos, so listeners stay on the channel instead of drifting to YouTube autoplay. Dynamoi judges results from the channel's own YouTube data: campaign-period lift (mostly ad sessions), organic lift that persists after spend stops, subscribers, and revenue. See dynamoi://youtube/campaign-strategies for each strategy.",
725
1832
  persona: "Channel owner of any niche (music, education, gaming, vlog, podcast, tutorial, product reviews) who wants subscriber growth that pays back via AdSense.",
726
- postLinkingFlow: "After channel link, call dynamoi_get_campaign_readiness for a YouTube growth campaign when that tool is available to this client; otherwise direct campaign setup to the Dynamoi dashboard. Mention that ad copy is internationalized per market for lower cost and that campaigns require playlists so each paid view drives sustained organic views downstream.",
727
- sampleScript: "Most YouTube ad systems optimize for raw views. Dynamoi merges your AdSense revenue with ad cost data to optimize bids per country based on real viewer revenue, so you grow toward viewers who actually monetize. I can help you link your YouTube channel, then we can plan your first campaign.",
1833
+ postLinkingFlow: "After channel link, call dynamoi_get_campaign_readiness for a YouTube growth campaign when that tool is available to this client; otherwise direct campaign setup to the Dynamoi dashboard. Mention that ad copy is internationalized per market for lower cost and that campaigns use a playlist entry point so viewers who click keep watching the artist's own videos.",
1834
+ sampleScript: "Most YouTube ad tools sell raw views. Dynamoi picks a campaign strategy for your goal (organic views, subscribers, or revenue if your channel is monetized), starts viewers in a playlist of your own videos, and reports results from your channel's YouTube data. I can help you link your YouTube channel, then we can plan your first campaign.",
728
1835
  talkingPoints: {
729
1836
  differentiatorComparison: {
730
- claim: "Most creator ad tools optimize for views or subscribers. Dynamoi compares ad cost with AdSense revenue by country so delivery can favor viewers who are more likely to pay back over time.",
731
- trigger: "User asks how YouTube campaigns differ from normal Google Ads or creator-growth services."
1837
+ claim: "Most creator ad tools optimize for raw views. Dynamoi campaigns aim at viewers who keep watching or subscribe, keep them in the artist's own playlist, and judge success from the channel's YouTube data, including revenue for monetized channels.",
1838
+ trigger: "User asks how YouTube campaigns differ from normal YouTube ads or creator-growth services."
732
1839
  },
733
1840
  hesitationReassurance: {
734
1841
  claim: "Managed advertising billing is completed in the Dynamoi dashboard. On surfaces without billing or launch tools, keep the flow focused on channel linking, readiness, and campaign management after billing setup is complete.",
735
1842
  trigger: "User expresses pricing concern or asks whether they can test without a long commitment."
736
1843
  },
737
1844
  playlistWaterfall: {
738
- claim: "Playlist promotion sends viewers into a sequence, so one paid view can lead to additional organic views across related videos and channel-wide subscriber growth.",
1845
+ claim: "Playlist promotion starts viewers in a sequence of the artist's own videos, so listeners who click keep watching the channel instead of YouTube autoplay. It improves listener quality; YouTube data cannot show exactly how many views the playlist itself caused.",
739
1846
  trigger: "User asks whether campaigns can help subscribers or the whole channel instead of one video."
740
1847
  },
741
1848
  postLaunchExpectations: {
@@ -873,14 +1980,14 @@ function registerDynamoiResources(server, adapter) {
873
1980
  text: JSON.stringify({
874
1981
  budgetMinimums: {
875
1982
  smartCampaign: {
876
- dailyUsd: 10,
1983
+ dailyUsd: USD_BUDGET_MINIMUMS.smartCampaign.dailyUsd,
877
1984
  note: "Meta Ads for Spotify promotion",
878
- totalUsd: 50
1985
+ totalUsd: USD_BUDGET_MINIMUMS.smartCampaign.totalUsd
879
1986
  },
880
1987
  youtube: {
881
- dailyUsd: 10,
882
- note: "Google Ads for YouTube channel growth",
883
- totalUsd: 50
1988
+ dailyUsd: USD_BUDGET_MINIMUMS.youtube.dailyUsd,
1989
+ note: "Google's ad network for YouTube channel growth",
1990
+ totalUsd: USD_BUDGET_MINIMUMS.youtube.totalUsd
884
1991
  }
885
1992
  },
886
1993
  includes: "Free Smart Links, Smart Link analytics, custom themes, validated pixel IDs, team seats, and campaign landing pages where available",
@@ -922,7 +2029,7 @@ function registerDynamoiResources(server, adapter) {
922
2029
  toolInput: { campaignType: "SMART_CAMPAIGN" }
923
2030
  },
924
2031
  youtubeCampaigns: {
925
- meaning: "Google Ads geo targets for YouTube campaign deployment and localization.",
2032
+ meaning: "The ad network's geo targets for YouTube campaign deployment and localization.",
926
2033
  source: "GOOGLE_ADS_COUNTRIES",
927
2034
  tool: "dynamoi_list_available_countries",
928
2035
  toolInput: { campaignType: "YOUTUBE" }
@@ -1112,11 +2219,24 @@ function registerDynamoiResources(server, adapter) {
1112
2219
  }
1113
2220
  ]
1114
2221
  }));
2222
+ server.registerResource("youtube-campaign-strategies", YOUTUBE_CAMPAIGN_STRATEGIES_RESOURCE_URI, {
2223
+ description: "How each YouTube campaign strategy works: its goal, what the ad network optimizes for, how to judge results, advertising-tagged vs other-source views, campaign-period vs organic lift, the playlist waterfall, and when results are fair to judge.",
2224
+ mimeType: "application/json",
2225
+ title: "YouTube Campaign Strategies"
2226
+ }, async (uri) => ({
2227
+ contents: [
2228
+ {
2229
+ mimeType: "application/json",
2230
+ text: JSON.stringify(buildYouTubeCampaignStrategiesGuide()),
2231
+ uri: uri.href
2232
+ }
2233
+ ]
2234
+ }));
1115
2235
  server.registerResource("artist-resource", new ResourceTemplate("dynamoi://artist/{artistId}", {
1116
2236
  list: async () => ({ resources: [] })
1117
2237
  }), { mimeType: "application/json", title: "Artist" }, async (uri, variables) => {
1118
2238
  const artistId = variables["artistId"];
1119
- const parsed = z5.string().uuid().safeParse(artistId);
2239
+ const parsed = z11.string().uuid().safeParse(artistId);
1120
2240
  if (!parsed.success) {
1121
2241
  return {
1122
2242
  contents: [
@@ -1148,7 +2268,7 @@ function registerDynamoiResources(server, adapter) {
1148
2268
  list: async () => ({ resources: [] })
1149
2269
  }), { mimeType: "application/json", title: "Campaign" }, async (uri, variables) => {
1150
2270
  const campaignId = variables["campaignId"];
1151
- const parsed = z5.string().uuid().safeParse(campaignId);
2271
+ const parsed = z11.string().uuid().safeParse(campaignId);
1152
2272
  if (!parsed.success) {
1153
2273
  return {
1154
2274
  contents: [
@@ -1180,7 +2300,7 @@ function registerDynamoiResources(server, adapter) {
1180
2300
  list: async () => ({ resources: [] })
1181
2301
  }), { mimeType: "application/json", title: "Smart Link" }, async (uri, variables) => {
1182
2302
  const playLinkId = variables["playLinkId"];
1183
- const parsed = z5.string().uuid().safeParse(playLinkId);
2303
+ const parsed = z11.string().uuid().safeParse(playLinkId);
1184
2304
  if (!parsed.success) {
1185
2305
  return {
1186
2306
  contents: [
@@ -1212,7 +2332,7 @@ function registerDynamoiResources(server, adapter) {
1212
2332
  list: async () => ({ resources: [] })
1213
2333
  }), { mimeType: "application/json", title: "Smart Link Artist Settings" }, async (uri, variables) => {
1214
2334
  const artistId = variables["artistId"];
1215
- const parsed = z5.string().uuid().safeParse(artistId);
2335
+ const parsed = z11.string().uuid().safeParse(artistId);
1216
2336
  if (!parsed.success) {
1217
2337
  return {
1218
2338
  contents: [
@@ -1243,114 +2363,114 @@ function registerDynamoiResources(server, adapter) {
1243
2363
  }
1244
2364
 
1245
2365
  // src/server/shop-tools.ts
1246
- import * as z6 from "zod/v4";
2366
+ import * as z12 from "zod/v4";
1247
2367
  var DYNAMOI_SHOP_FULL_SCOPE = "dynamoi:mcp.full";
1248
2368
  var DYNAMOI_SHOP_MAX_TARGET_COUNTRY_CODES = 50;
1249
2369
  var DYNAMOI_SHOP_CUSTOM_MIN_TARGET_VIEWS = 25000;
1250
2370
  var DYNAMOI_SHOP_CUSTOM_MAX_TARGET_VIEWS = 1e6;
1251
2371
  var DYNAMOI_SHOP_CUSTOM_MIN_DURATION_DAYS = 7;
1252
2372
  var DYNAMOI_SHOP_CUSTOM_MAX_DURATION_DAYS = 30;
1253
- var ShopPackageSelectionInputSchema = z6.object({
1254
- kind: z6.literal("package"),
1255
- tier: z6.enum(["starter", "standard", "premium"])
2373
+ var ShopPackageSelectionInputSchema = z12.object({
2374
+ kind: z12.literal("package"),
2375
+ tier: z12.enum(["starter", "standard", "premium"])
1256
2376
  }).strict();
1257
- var ShopCustomSelectionInputSchema = z6.object({
1258
- campaignDurationDays: z6.number().int().min(DYNAMOI_SHOP_CUSTOM_MIN_DURATION_DAYS).max(DYNAMOI_SHOP_CUSTOM_MAX_DURATION_DAYS),
1259
- kind: z6.literal("custom"),
1260
- targetViews: z6.number().int().min(DYNAMOI_SHOP_CUSTOM_MIN_TARGET_VIEWS).max(DYNAMOI_SHOP_CUSTOM_MAX_TARGET_VIEWS)
2377
+ var ShopCustomSelectionInputSchema = z12.object({
2378
+ campaignDurationDays: z12.number().int().min(DYNAMOI_SHOP_CUSTOM_MIN_DURATION_DAYS).max(DYNAMOI_SHOP_CUSTOM_MAX_DURATION_DAYS),
2379
+ kind: z12.literal("custom"),
2380
+ targetViews: z12.number().int().min(DYNAMOI_SHOP_CUSTOM_MIN_TARGET_VIEWS).max(DYNAMOI_SHOP_CUSTOM_MAX_TARGET_VIEWS)
1261
2381
  }).strict();
1262
- var DynamoiShopSelectionInputSchema = z6.discriminatedUnion("kind", [
2382
+ var DynamoiShopSelectionInputSchema = z12.discriminatedUnion("kind", [
1263
2383
  ShopPackageSelectionInputSchema,
1264
2384
  ShopCustomSelectionInputSchema
1265
2385
  ]);
1266
- var ShopGlobalTargetingInputSchema = z6.object({ mode: z6.literal("GLOBAL") }).strict();
1267
- var ShopIncludedTargetingInputSchema = z6.object({
1268
- countryCodes: z6.array(z6.string().regex(/^[A-Z]{2}$/)).min(1).max(DYNAMOI_SHOP_MAX_TARGET_COUNTRY_CODES),
1269
- mode: z6.literal("INCLUDE")
2386
+ var ShopGlobalTargetingInputSchema = z12.object({ mode: z12.literal("GLOBAL") }).strict();
2387
+ var ShopIncludedTargetingInputSchema = z12.object({
2388
+ countryCodes: z12.array(z12.string().regex(/^[A-Z]{2}$/)).min(1).max(DYNAMOI_SHOP_MAX_TARGET_COUNTRY_CODES),
2389
+ mode: z12.literal("INCLUDE")
1270
2390
  }).strict();
1271
- var DynamoiShopTargetingInputSchema = z6.discriminatedUnion("mode", [
2391
+ var DynamoiShopTargetingInputSchema = z12.discriminatedUnion("mode", [
1272
2392
  ShopGlobalTargetingInputSchema,
1273
2393
  ShopIncludedTargetingInputSchema
1274
2394
  ]);
1275
- var DynamoiShopGetQuoteInputSchema = z6.object({
1276
- marketLocale: z6.string().trim().min(2).max(35),
2395
+ var DynamoiShopGetQuoteInputSchema = z12.object({
2396
+ marketLocale: z12.string().trim().min(2).max(35),
1277
2397
  selection: DynamoiShopSelectionInputSchema,
1278
- storefrontSlug: z6.string().trim().min(1).max(160).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/),
2398
+ storefrontSlug: z12.string().trim().min(1).max(160).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/),
1279
2399
  targeting: DynamoiShopTargetingInputSchema,
1280
- youtubeUrl: z6.string().trim().url().max(500)
2400
+ youtubeUrl: z12.string().trim().url().max(500)
1281
2401
  }).strict();
1282
- var DynamoiShopCreateCheckoutInputSchema = z6.object({
1283
- expectedTotal: z6.object({
1284
- amountMinor: z6.number().int().positive(),
1285
- currency: z6.string().regex(/^[A-Z]{3}$/)
2402
+ var DynamoiShopCreateCheckoutInputSchema = z12.object({
2403
+ expectedTotal: z12.object({
2404
+ amountMinor: z12.number().int().positive(),
2405
+ currency: z12.string().regex(/^[A-Z]{3}$/)
1286
2406
  }).strict(),
1287
2407
  promotion: DynamoiShopGetQuoteInputSchema,
1288
- requestId: z6.string().uuid()
2408
+ requestId: z12.string().uuid()
1289
2409
  }).strict();
1290
2410
  var ShopSelectionOutputSchema = DynamoiShopSelectionInputSchema;
1291
- var ShopTargetingOutputSchema = z6.discriminatedUnion("mode", [
2411
+ var ShopTargetingOutputSchema = z12.discriminatedUnion("mode", [
1292
2412
  ShopGlobalTargetingInputSchema,
1293
- z6.object({
1294
- countryCodes: z6.array(z6.string().regex(/^[A-Z]{2}$/)).min(1),
1295
- mode: z6.literal("INCLUDE")
2413
+ z12.object({
2414
+ countryCodes: z12.array(z12.string().regex(/^[A-Z]{2}$/)).min(1),
2415
+ mode: z12.literal("INCLUDE")
1296
2416
  }).strict()
1297
2417
  ]);
1298
- var ShopMoneyOutputSchema = z6.object({
1299
- amountMinor: z6.number().int().positive(),
1300
- currency: z6.string().regex(/^[A-Z]{3}$/),
1301
- formatted: z6.string().min(1).max(80)
2418
+ var ShopMoneyOutputSchema = z12.object({
2419
+ amountMinor: z12.number().int().positive(),
2420
+ currency: z12.string().regex(/^[A-Z]{3}$/),
2421
+ formatted: z12.string().min(1).max(80)
1302
2422
  }).strict();
1303
- var DynamoiShopQuoteDataSchema = z6.object({
1304
- campaignDurationDays: z6.number().int().positive().nullable(),
1305
- estimatedViews: z6.object({
1306
- basis: z6.literal("rolling_30_day_cpv"),
1307
- max: z6.number().int().nonnegative(),
1308
- min: z6.number().int().nonnegative(),
1309
- notGuaranteed: z6.literal(true)
2423
+ var DynamoiShopQuoteDataSchema = z12.object({
2424
+ campaignDurationDays: z12.number().int().positive().nullable(),
2425
+ estimatedViews: z12.object({
2426
+ basis: z12.literal("rolling_30_day_cpv"),
2427
+ max: z12.number().int().nonnegative(),
2428
+ min: z12.number().int().nonnegative(),
2429
+ notGuaranteed: z12.literal(true)
1310
2430
  }).strict().nullable(),
1311
- kind: z6.literal("shop_quote"),
1312
- reviewRequired: z6.boolean(),
2431
+ kind: z12.literal("shop_quote"),
2432
+ reviewRequired: z12.boolean(),
1313
2433
  selection: ShopSelectionOutputSchema,
1314
- storefront: z6.object({
1315
- currency: z6.string().regex(/^[A-Z]{3}$/),
1316
- marketLocale: z6.string(),
1317
- slug: z6.string()
2434
+ storefront: z12.object({
2435
+ currency: z12.string().regex(/^[A-Z]{3}$/),
2436
+ marketLocale: z12.string(),
2437
+ slug: z12.string()
1318
2438
  }).strict(),
1319
2439
  targeting: ShopTargetingOutputSchema,
1320
2440
  total: ShopMoneyOutputSchema,
1321
- video: z6.object({
1322
- normalizedUrl: z6.string().url(),
1323
- videoId: z6.string().regex(/^[A-Za-z0-9_-]{11}$/)
2441
+ video: z12.object({
2442
+ normalizedUrl: z12.string().url(),
2443
+ videoId: z12.string().regex(/^[A-Za-z0-9_-]{11}$/)
1324
2444
  }).strict()
1325
2445
  }).strict();
1326
- var DynamoiShopCheckoutDataSchema = z6.object({
1327
- checkoutUrl: z6.string().url(),
1328
- expiresAt: z6.string().datetime({ offset: true }),
1329
- kind: z6.literal("shop_checkout"),
1330
- orderCreated: z6.literal(false),
1331
- paymentCompleted: z6.literal(false),
1332
- status: z6.literal("checkout_required"),
2446
+ var DynamoiShopCheckoutDataSchema = z12.object({
2447
+ checkoutUrl: z12.string().url(),
2448
+ expiresAt: z12.string().datetime({ offset: true }),
2449
+ kind: z12.literal("shop_checkout"),
2450
+ orderCreated: z12.literal(false),
2451
+ paymentCompleted: z12.literal(false),
2452
+ status: z12.literal("checkout_required"),
1333
2453
  total: ShopMoneyOutputSchema
1334
2454
  }).strict();
1335
- var ToolErrorEnvelopeSchema = z6.object({
1336
- kind: z6.enum(["validation", "business", "platform", "unknown"]),
1337
- message: z6.string().min(1),
2455
+ var ToolErrorEnvelopeSchema = z12.object({
2456
+ kind: z12.enum(["validation", "business", "platform", "unknown"]),
2457
+ message: z12.string().min(1),
1338
2458
  ...ResultErrorRecoverySchema.shape,
1339
- status: z6.literal("error")
2459
+ status: z12.literal("error")
1340
2460
  }).strict().superRefine((value, context) => {
1341
2461
  addRecoverySafetyIssues(value, context);
1342
2462
  });
1343
- var DynamoiShopQuoteOutputEnvelopeSchema = z6.union([
1344
- z6.object({
2463
+ var DynamoiShopQuoteOutputEnvelopeSchema = z12.union([
2464
+ z12.object({
1345
2465
  data: DynamoiShopQuoteDataSchema,
1346
- status: z6.literal("success")
2466
+ status: z12.literal("success")
1347
2467
  }).strict(),
1348
2468
  ToolErrorEnvelopeSchema
1349
2469
  ]);
1350
- var DynamoiShopCheckoutOutputEnvelopeSchema = z6.union([
1351
- z6.object({
2470
+ var DynamoiShopCheckoutOutputEnvelopeSchema = z12.union([
2471
+ z12.object({
1352
2472
  data: DynamoiShopCheckoutDataSchema,
1353
- status: z6.literal("success")
2473
+ status: z12.literal("success")
1354
2474
  }).strict(),
1355
2475
  ToolErrorEnvelopeSchema
1356
2476
  ]);
@@ -1380,10 +2500,10 @@ var SHOP_TOOL_DEFINITIONS = [
1380
2500
  ];
1381
2501
 
1382
2502
  // src/server/smart-link-theme-preview.ts
1383
- import * as z7 from "zod/v4";
2503
+ import * as z13 from "zod/v4";
1384
2504
  var SMART_LINK_THEME_PREVIEW_RESOURCE_URI = "ui://dynamoi/smart-link-theme-preview-v1.html";
1385
- var SampleTextSchema = z7.string().trim().min(1).max(80);
1386
- var DynamoiPreviewSmartLinkThemesInputSchema = z7.object({
2505
+ var SampleTextSchema = z13.string().trim().min(1).max(80);
2506
+ var DynamoiPreviewSmartLinkThemesInputSchema = z13.object({
1387
2507
  artistName: SampleTextSchema.optional(),
1388
2508
  releaseTitle: SampleTextSchema.optional()
1389
2509
  }).strict();
@@ -1642,100 +2762,67 @@ function registerSmartLinkThemePreviewResource(server) {
1642
2762
  }
1643
2763
 
1644
2764
  // src/server/smart-link-tools.ts
1645
- import * as z9 from "zod/v4";
1646
-
1647
- // src/server/shared-schemas.ts
1648
- import * as z8 from "zod/v4";
1649
- var ToolFormatSchema = z8.enum(["json", "summary"]);
1650
- var IsoDateSchema = z8.string().regex(/^\d{4}-\d{2}-\d{2}$/);
1651
- var UserIntentSummarySchema = z8.string().trim().max(500).optional();
1652
- var ClientRequestIdSchema = z8.string().uuid().optional();
1653
- var RequiredClientRequestIdSchema = z8.string().uuid();
1654
- function isValidCalendarDate(value) {
1655
- const date = new Date(`${value}T00:00:00.000Z`);
1656
- return Number.isFinite(date.getTime()) && date.toISOString().slice(0, 10) === value;
1657
- }
1658
- var IsoCalendarDateSchema = IsoDateSchema.refine(isValidCalendarDate, {
1659
- message: "must be a valid calendar date"
1660
- });
1661
- var DateRangeSchema = z8.object({
1662
- end: IsoDateSchema,
1663
- start: IsoDateSchema
1664
- }).strict().superRefine((data, ctx) => {
1665
- if (!isValidCalendarDate(data.start)) {
2765
+ import * as z14 from "zod/v4";
2766
+ var SmartLinkAnalyticsDateRangeSchema = DateRangeSchema.superRefine((range, ctx) => {
2767
+ const days = (Date.parse(range.end) - Date.parse(range.start)) / 86400000 + 1;
2768
+ if (days > 366) {
1666
2769
  ctx.addIssue({
1667
2770
  code: "custom",
1668
- message: "start must be a valid calendar date",
1669
- path: ["start"]
1670
- });
1671
- }
1672
- if (!isValidCalendarDate(data.end)) {
1673
- ctx.addIssue({
1674
- code: "custom",
1675
- message: "end must be a valid calendar date",
1676
- path: ["end"]
1677
- });
1678
- }
1679
- if (isValidCalendarDate(data.start) && isValidCalendarDate(data.end) && data.start > data.end) {
1680
- ctx.addIssue({
1681
- code: "custom",
1682
- message: "start must be on or before end",
1683
- path: ["start"]
2771
+ message: "Smart-link analytics date windows cover at most 366 days",
2772
+ path: ["end"]
1684
2773
  });
1685
2774
  }
1686
2775
  });
1687
-
1688
- // src/server/smart-link-tools.ts
1689
2776
  var SmartLinkStatusFiltersSchema = {
1690
- claimStatus: z9.enum([
2777
+ claimStatus: z14.enum([
1691
2778
  "auto_approved",
1692
2779
  "pending_ops_review",
1693
2780
  "verification_deferred",
1694
2781
  "approved_by_ops",
1695
2782
  "rejected"
1696
2783
  ]).optional(),
1697
- publishState: z9.enum(["published", "unpublished"]).optional(),
1698
- renderState: z9.enum(["queued", "rendering", "rendered", "failed"]).optional()
2784
+ publishState: z14.enum(["published", "unpublished"]).optional(),
2785
+ renderState: z14.enum(["queued", "rendering", "rendered", "failed"]).optional()
1699
2786
  };
1700
- var SmartLinkThemeSchema = z9.enum([
2787
+ var SmartLinkThemeSchema = z14.enum([
1701
2788
  "classic",
1702
2789
  "brutalist",
1703
2790
  "aurora",
1704
2791
  "cinematic"
1705
2792
  ]);
1706
- var DynamoiCreateSmartLinkFromSpotifyInputSchema = z9.object({
1707
- artistId: z9.string().uuid(),
2793
+ var DynamoiCreateSmartLinkFromSpotifyInputSchema = z14.object({
2794
+ artistId: z14.string().uuid(),
1708
2795
  clientRequestId: RequiredClientRequestIdSchema.optional(),
1709
- customDescription: z9.string().trim().max(500).optional(),
2796
+ customDescription: z14.string().trim().max(500).optional(),
1710
2797
  format: ToolFormatSchema.optional(),
1711
- spotifyUrl: z9.string().trim().min(1).max(500),
2798
+ spotifyUrl: z14.string().trim().min(1).max(500),
1712
2799
  userIntentSummary: UserIntentSummarySchema
1713
2800
  }).strict();
1714
- var DynamoiCreateSmartLinksFromSpotifyArtistInputSchema = z9.object({
1715
- artistId: z9.string().uuid().optional(),
2801
+ var DynamoiCreateSmartLinksFromSpotifyArtistInputSchema = z14.object({
2802
+ artistId: z14.string().uuid().optional(),
1716
2803
  clientRequestId: RequiredClientRequestIdSchema.optional(),
1717
2804
  format: ToolFormatSchema.optional(),
1718
- spotifyArtistUrl: z9.string().trim().min(1).max(500),
2805
+ spotifyArtistUrl: z14.string().trim().min(1).max(500),
1719
2806
  userIntentSummary: UserIntentSummarySchema
1720
2807
  }).strict();
1721
- var DynamoiListSmartLinksInputSchema = z9.object({
1722
- artistId: z9.string().uuid(),
1723
- cursor: z9.string().optional(),
2808
+ var DynamoiListSmartLinksInputSchema = z14.object({
2809
+ artistId: z14.string().uuid(),
2810
+ cursor: z14.string().optional(),
1724
2811
  format: ToolFormatSchema.optional(),
1725
- limit: z9.number().int().min(1).max(50).optional(),
1726
- query: z9.string().trim().max(120).optional(),
2812
+ limit: z14.number().int().min(1).max(50).optional(),
2813
+ query: z14.string().trim().max(120).optional(),
1727
2814
  ...SmartLinkStatusFiltersSchema
1728
2815
  }).strict();
1729
2816
  var DynamoiGetSmartLinkInputShape = {
1730
- artistId: z9.string().uuid().optional(),
1731
- dateRange: DateRangeSchema.optional(),
2817
+ artistId: z14.string().uuid().optional(),
2818
+ dateRange: SmartLinkAnalyticsDateRangeSchema.optional(),
1732
2819
  format: ToolFormatSchema.optional(),
1733
- granularity: z9.enum(["TOTAL", "DAILY"]).optional(),
1734
- includeAnalytics: z9.boolean().optional(),
1735
- includeArtistSettings: z9.boolean().optional(),
1736
- includeBreakdowns: z9.boolean().optional(),
1737
- playLinkId: z9.string().uuid().optional(),
1738
- spotifyUrl: z9.string().trim().min(1).max(500).optional()
2820
+ granularity: z14.enum(["TOTAL", "DAILY"]).optional(),
2821
+ includeAnalytics: z14.boolean().optional(),
2822
+ includeArtistSettings: z14.boolean().optional(),
2823
+ includeBreakdowns: z14.boolean().optional(),
2824
+ playLinkId: z14.string().uuid().optional(),
2825
+ spotifyUrl: z14.string().trim().min(1).max(500).optional()
1739
2826
  };
1740
2827
  function validateDynamoiGetSmartLinkInput(data, ctx) {
1741
2828
  const settingsOnly = data.includeArtistSettings === true && !data.playLinkId && !data.spotifyUrl && Boolean(data.artistId);
@@ -1754,33 +2841,33 @@ function validateDynamoiGetSmartLinkInput(data, ctx) {
1754
2841
  });
1755
2842
  }
1756
2843
  }
1757
- var StrictDynamoiGetSmartLinkInputSchema = z9.object(DynamoiGetSmartLinkInputShape).strict().superRefine(validateDynamoiGetSmartLinkInput);
2844
+ var StrictDynamoiGetSmartLinkInputSchema = z14.object(DynamoiGetSmartLinkInputShape).strict().superRefine(validateDynamoiGetSmartLinkInput);
1758
2845
  var DynamoiGetSmartLinkInputSchema = StrictDynamoiGetSmartLinkInputSchema;
1759
2846
  function parseDynamoiGetSmartLinkInput(rawInput) {
1760
2847
  return StrictDynamoiGetSmartLinkInputSchema.parse(rawInput);
1761
2848
  }
1762
- var DynamoiGetSmartLinkAnalyticsInputSchema = z9.object({
1763
- dateRange: DateRangeSchema.optional(),
2849
+ var DynamoiGetSmartLinkAnalyticsInputSchema = z14.object({
2850
+ dateRange: SmartLinkAnalyticsDateRangeSchema.optional(),
1764
2851
  format: ToolFormatSchema.optional(),
1765
- granularity: z9.enum(["TOTAL", "DAILY"]).optional(),
1766
- includeBreakdowns: z9.boolean().optional(),
1767
- playLinkId: z9.string().uuid()
2852
+ granularity: z14.enum(["TOTAL", "DAILY"]).optional(),
2853
+ includeBreakdowns: z14.boolean().optional(),
2854
+ playLinkId: z14.string().uuid()
1768
2855
  }).strict();
1769
- var DynamoiGetSmartLinkArtistSettingsInputSchema = z9.object({
1770
- artistId: z9.string().uuid(),
2856
+ var DynamoiGetSmartLinkArtistSettingsInputSchema = z14.object({
2857
+ artistId: z14.string().uuid(),
1771
2858
  format: ToolFormatSchema.optional()
1772
2859
  }).strict();
1773
- var DynamoiUpdateSmartLinkInputSchema = z9.object({
1774
- action: z9.enum(["update_description", "update_artist_settings"]),
1775
- artistId: z9.string().uuid().optional(),
2860
+ var DynamoiUpdateSmartLinkInputSchema = z14.object({
2861
+ action: z14.enum(["update_description", "update_artist_settings"]),
2862
+ artistId: z14.string().uuid().optional(),
1776
2863
  clientRequestId: ClientRequestIdSchema,
1777
- customDescription: z9.string().max(500).nullable().optional(),
1778
- expectedUpdatedAt: z9.string().datetime().optional(),
1779
- googleAdsConversionId: z9.string().trim().max(32).nullable().optional(),
1780
- metaPixelId: z9.string().trim().max(32).nullable().optional(),
1781
- playLinkId: z9.string().uuid().optional(),
2864
+ customDescription: z14.string().max(500).nullable().optional(),
2865
+ expectedUpdatedAt: z14.string().datetime().optional(),
2866
+ googleAdsConversionId: z14.string().trim().max(32).nullable().optional(),
2867
+ metaPixelId: z14.string().trim().max(32).nullable().optional(),
2868
+ playLinkId: z14.string().uuid().optional(),
1782
2869
  theme: SmartLinkThemeSchema.optional(),
1783
- tiktokPixelId: z9.string().trim().max(32).nullable().optional(),
2870
+ tiktokPixelId: z14.string().trim().max(32).nullable().optional(),
1784
2871
  userIntentSummary: UserIntentSummarySchema
1785
2872
  }).strict().superRefine((data, ctx) => {
1786
2873
  if (data.action === "update_description" && data.customDescription === undefined) {
@@ -1831,13 +2918,13 @@ var DynamoiUpdateSmartLinkInputSchema = z9.object({
1831
2918
  }
1832
2919
  }
1833
2920
  });
1834
- var DynamoiUpdateSmartLinkArtistSettingsInputSchema = z9.object({
1835
- artistId: z9.string().uuid(),
2921
+ var DynamoiUpdateSmartLinkArtistSettingsInputSchema = z14.object({
2922
+ artistId: z14.string().uuid(),
1836
2923
  clientRequestId: ClientRequestIdSchema,
1837
- googleAdsConversionId: z9.string().trim().max(32).nullable().optional(),
1838
- metaPixelId: z9.string().trim().max(32).nullable().optional(),
2924
+ googleAdsConversionId: z14.string().trim().max(32).nullable().optional(),
2925
+ metaPixelId: z14.string().trim().max(32).nullable().optional(),
1839
2926
  theme: SmartLinkThemeSchema.optional(),
1840
- tiktokPixelId: z9.string().trim().max(32).nullable().optional(),
2927
+ tiktokPixelId: z14.string().trim().max(32).nullable().optional(),
1841
2928
  userIntentSummary: UserIntentSummarySchema
1842
2929
  }).strict().superRefine((data, ctx) => {
1843
2930
  if (data.theme === undefined && data.metaPixelId === undefined && data.tiktokPixelId === undefined && data.googleAdsConversionId === undefined) {
@@ -1848,9 +2935,119 @@ var DynamoiUpdateSmartLinkArtistSettingsInputSchema = z9.object({
1848
2935
  });
1849
2936
  }
1850
2937
  });
2938
+ var DynamoiUpdateSmartLinkDescriptionInputSchema = z14.object({
2939
+ clientRequestId: ClientRequestIdSchema,
2940
+ customDescription: z14.string().max(500).nullable(),
2941
+ expectedUpdatedAt: z14.string().datetime().optional(),
2942
+ playLinkId: z14.string().uuid(),
2943
+ userIntentSummary: UserIntentSummarySchema
2944
+ }).strict();
2945
+ var ArtistHubSettingsShape = {
2946
+ hubDescription: z14.string().max(500).nullable().optional(),
2947
+ profileLinks: z14.array(z14.object({
2948
+ isHidden: z14.boolean(),
2949
+ service: z14.enum([
2950
+ "spotify",
2951
+ "applemusic",
2952
+ "youtube",
2953
+ "instagram",
2954
+ "facebook",
2955
+ "tiktok",
2956
+ "soundcloud",
2957
+ "bandcamp",
2958
+ "deezer",
2959
+ "tidal",
2960
+ "boomplay",
2961
+ "audiomack"
2962
+ ]),
2963
+ url: z14.string().max(1024).nullable()
2964
+ }).strict()).max(12).optional(),
2965
+ servicePriority: z14.array(z14.string().max(32)).max(4).optional(),
2966
+ servicePriorityMode: z14.enum(["country", "fixed"]).optional()
2967
+ };
2968
+ var ArtistStudioSettingsHandlerInputSchema = z14.object({
2969
+ artistId: z14.string().uuid(),
2970
+ clientRequestId: ClientRequestIdSchema,
2971
+ googleAdsConversionId: z14.string().trim().max(32).nullable().optional(),
2972
+ metaPixelId: z14.string().trim().max(32).nullable().optional(),
2973
+ ...ArtistHubSettingsShape,
2974
+ theme: SmartLinkThemeSchema.optional(),
2975
+ tiktokPixelId: z14.string().trim().max(32).nullable().optional(),
2976
+ userIntentSummary: UserIntentSummarySchema
2977
+ }).strict().superRefine((data, ctx) => {
2978
+ if (data.theme === undefined && data.metaPixelId === undefined && data.tiktokPixelId === undefined && data.googleAdsConversionId === undefined && data.hubDescription === undefined && data.profileLinks === undefined && data.servicePriority === undefined && data.servicePriorityMode === undefined) {
2979
+ ctx.addIssue({
2980
+ code: "custom",
2981
+ message: "Provide at least one setting to update",
2982
+ path: ["theme"]
2983
+ });
2984
+ }
2985
+ });
2986
+ var DynamoiUpdateSmartLinkArtistHubSettingsInputSchema = z14.object({
2987
+ artistId: z14.string().uuid(),
2988
+ clientRequestId: ClientRequestIdSchema,
2989
+ ...ArtistHubSettingsShape,
2990
+ userIntentSummary: UserIntentSummarySchema
2991
+ }).strict().superRefine((data, ctx) => {
2992
+ if (data.hubDescription === undefined && data.profileLinks === undefined && data.servicePriority === undefined && data.servicePriorityMode === undefined) {
2993
+ ctx.addIssue({
2994
+ code: "custom",
2995
+ message: "Provide at least one Artist Hub setting to update",
2996
+ path: ["hubDescription"]
2997
+ });
2998
+ }
2999
+ });
3000
+ var DynamoiUpdateSmartLinkReleaseSettingsInputSchema = z14.object({
3001
+ clientRequestId: ClientRequestIdSchema,
3002
+ customDescription: z14.string().max(500).nullable().optional(),
3003
+ expectedUpdatedAt: z14.string().datetime().optional(),
3004
+ playLinkId: z14.string().uuid(),
3005
+ serviceOverrides: z14.array(z14.object({
3006
+ hidden: z14.boolean(),
3007
+ service: z14.string().max(32),
3008
+ url: z14.string().max(1024).nullable()
3009
+ }).strict()).max(15).optional(),
3010
+ userIntentSummary: UserIntentSummarySchema,
3011
+ youtubeUrl: z14.string().max(512).nullable().optional()
3012
+ }).strict().superRefine((data, ctx) => {
3013
+ if (data.customDescription === undefined && data.youtubeUrl === undefined && data.serviceOverrides === undefined) {
3014
+ ctx.addIssue({
3015
+ code: "custom",
3016
+ message: "Provide at least one release setting to update",
3017
+ path: ["customDescription"]
3018
+ });
3019
+ }
3020
+ });
3021
+ function parseDynamoiCreateSmartLinksFromSpotifyArtistInput(rawInput) {
3022
+ return DynamoiCreateSmartLinksFromSpotifyArtistInputSchema.parse(rawInput);
3023
+ }
3024
+ function parseDynamoiGetSmartLinkAnalyticsInput(rawInput) {
3025
+ return DynamoiGetSmartLinkAnalyticsInputSchema.parse(rawInput);
3026
+ }
3027
+ function parseDynamoiCreateSmartLinkFromSpotifyInput(rawInput) {
3028
+ return DynamoiCreateSmartLinkFromSpotifyInputSchema.parse(rawInput);
3029
+ }
3030
+ function parseDynamoiListSmartLinksInput(rawInput) {
3031
+ return DynamoiListSmartLinksInputSchema.parse(rawInput);
3032
+ }
3033
+ function parseDynamoiGetSmartLinkArtistSettingsInput(rawInput) {
3034
+ return DynamoiGetSmartLinkArtistSettingsInputSchema.parse(rawInput);
3035
+ }
3036
+ function parseDynamoiUpdateSmartLinkInput(rawInput) {
3037
+ return DynamoiUpdateSmartLinkInputSchema.parse(rawInput);
3038
+ }
3039
+ function parseDynamoiUpdateSmartLinkArtistSettingsInput(rawInput) {
3040
+ return ArtistStudioSettingsHandlerInputSchema.parse(rawInput);
3041
+ }
3042
+ function parseDynamoiUpdateSmartLinkArtistHubSettingsInput(rawInput) {
3043
+ return DynamoiUpdateSmartLinkArtistHubSettingsInputSchema.parse(rawInput);
3044
+ }
3045
+ function parseDynamoiUpdateSmartLinkReleaseSettingsInput(rawInput) {
3046
+ return DynamoiUpdateSmartLinkReleaseSettingsInputSchema.parse(rawInput);
3047
+ }
1851
3048
  var PHASE_4_TOOL_DEFINITIONS = [
1852
3049
  {
1853
- description: "Use this when the user wants to create one free Dynamoi Smart Link from a Spotify album or track URL/URI, or a single starter release from a Spotify artist URL. For full-catalog artist imports or artist hub requests, prefer dynamoi_create_smart_links_from_spotify_artist. Smart Links are free to create and manage. High-popularity or unverifiable artist links may stay unpublished in verification hold until Dynamoi can verify the client relationship. This does not create a paid ad campaign. Spotify playlist URLs are not supported today. If the Smart Link already exists, return the existing link instead of creating a duplicate; if customDescription is provided, update that Smart Link's public description. In the final answer, lead with the public URL and do not expose internal IDs unless asked.",
3050
+ description: "Use this when the user wants to create one free Dynamoi Smart Link from a Spotify album or track URL/URI, or a single starter release from a Spotify artist URL. For full-catalog artist imports or artist hub requests, prefer dynamoi_create_smart_links_from_spotify_artist. Smart Links are free to create and manage. High-popularity or unverifiable artist links may stay unpublished in verification hold until Dynamoi can verify the client relationship. This does not create a paid ad campaign. Spotify playlist URLs are not supported today. This is also how to add a release missing from an artist's imported catalog: the user pastes that release's exact Spotify album, single, or EP URL. If the Smart Link already exists, return the existing link instead of creating a duplicate; if customDescription is provided, update that Smart Link's public description. In the final answer, lead with the public URL and do not expose internal IDs unless asked.",
1854
3051
  destructiveHint: true,
1855
3052
  idempotentHint: true,
1856
3053
  name: "dynamoi_create_smart_link_from_spotify",
@@ -1903,9 +3100,57 @@ var PHASE_4_TOOL_DEFINITIONS = [
1903
3100
  title: "Update Smart Link"
1904
3101
  }
1905
3102
  ];
3103
+ var SMART_LINK_UPDATE_OPERATION_TOOL_DEFINITIONS = [
3104
+ {
3105
+ description: "Use this when the user wants to update one Smart Link's public description. This tool only changes that link's description; it cannot change artist-level theme or pixel settings and does not publish or unpublish links. Confirm the requested description before calling. A description change may queue background rendering.",
3106
+ destructiveHint: true,
3107
+ idempotentHint: true,
3108
+ name: "dynamoi_update_smart_link_description",
3109
+ openWorldHint: true,
3110
+ outputSchema: AnyOutputEnvelopeSchema,
3111
+ readOnlyHint: false,
3112
+ schema: DynamoiUpdateSmartLinkDescriptionInputSchema,
3113
+ title: "Update Smart Link Description"
3114
+ },
3115
+ {
3116
+ description: "Use this when the user wants to change artist-level Smart Link theme or validated pixel settings. This tool only changes artist settings; it cannot change a link description or publish or unpublish links. Confirm the requested settings before calling. Theme-only changes switch instantly; pixel changes may queue background rendering.",
3117
+ destructiveHint: true,
3118
+ idempotentHint: true,
3119
+ name: "dynamoi_update_smart_link_artist_settings",
3120
+ openWorldHint: true,
3121
+ outputSchema: AnyOutputEnvelopeSchema,
3122
+ readOnlyHint: false,
3123
+ schema: DynamoiUpdateSmartLinkArtistSettingsInputSchema,
3124
+ title: "Update Smart Link Artist Settings"
3125
+ }
3126
+ ];
3127
+ var FULL_SMART_LINK_STUDIO_TOOL_DEFINITIONS = [
3128
+ {
3129
+ description: "Use this when the user wants to change the artist-level Smart Link introduction, official profile links or service order. Omitted fields preserve stored values; null explicitly clears supported fields. Theme and pixel changes belong to dynamoi_update_smart_link_artist_settings. Confirm the requested settings before calling. The result includes the saved artistHub readback. A partial save is reported truthfully; read the current introduction, profile links and service order with dynamoi_get_smart_link (artistId, includeArtistSettings=true; see artistHub) before retrying.",
3130
+ destructiveHint: true,
3131
+ idempotentHint: true,
3132
+ name: "dynamoi_update_smart_link_artist_hub_settings",
3133
+ openWorldHint: true,
3134
+ outputSchema: AnyOutputEnvelopeSchema,
3135
+ readOnlyHint: false,
3136
+ schema: DynamoiUpdateSmartLinkArtistHubSettingsInputSchema,
3137
+ title: "Update Smart Link Artist Hub Settings"
3138
+ },
3139
+ {
3140
+ description: "Use this when the user wants to change one Smart Link's release video or catalog destination visibility. Set any of customDescription, youtubeUrl or serviceOverrides; omitted fields preserve stored values and null explicitly clears supported fields. Public availability is artist-wide in the dashboard; this tool does not publish or unpublish individual links. Confirm the requested settings before calling. The result includes the saved releaseSettings readback; after an ambiguous failure, read it with dynamoi_get_smart_link (playLinkId; see releaseSettings) before retrying. A description or video change may queue background rendering.",
3141
+ destructiveHint: true,
3142
+ idempotentHint: true,
3143
+ name: "dynamoi_update_smart_link_release_settings",
3144
+ openWorldHint: true,
3145
+ outputSchema: AnyOutputEnvelopeSchema,
3146
+ readOnlyHint: false,
3147
+ schema: DynamoiUpdateSmartLinkReleaseSettingsInputSchema,
3148
+ title: "Update Smart Link Release Settings"
3149
+ }
3150
+ ];
1906
3151
 
1907
3152
  // src/server/tools.ts
1908
- import * as z11 from "zod/v4";
3153
+ import * as z16 from "zod/v4";
1909
3154
 
1910
3155
  // src/server/onboarding-tool-definitions.ts
1911
3156
  function createPhaseOnboardingToolDefinitions(schemas) {
@@ -1936,12 +3181,12 @@ function createPhaseOnboardingToolDefinitions(schemas) {
1936
3181
  }
1937
3182
 
1938
3183
  // src/server/openai-tools.ts
1939
- import * as z10 from "zod/v4";
1940
- var DynamoiOpenAiSearchInputSchema = z10.object({
1941
- query: z10.string().trim().min(1).max(500)
3184
+ import * as z15 from "zod/v4";
3185
+ var DynamoiOpenAiSearchInputSchema = z15.object({
3186
+ query: SearchQuerySchema.min(1)
1942
3187
  }).strict();
1943
- var DynamoiOpenAiFetchInputSchema = z10.object({
1944
- id: z10.string().trim().min(1).max(200)
3188
+ var DynamoiOpenAiFetchInputSchema = z15.object({
3189
+ id: z15.string().trim().min(1).max(200)
1945
3190
  }).strict();
1946
3191
  var OPENAI_TOOL_DEFINITIONS = [
1947
3192
  {
@@ -1967,10 +3212,11 @@ var OPENAI_TOOL_DEFINITIONS = [
1967
3212
  ];
1968
3213
 
1969
3214
  // src/server/tools.ts
3215
+ var YouTubeStrategySchema = YouTubeStrategyKeySchema.describe(`YouTube campaign strategy. Labels for users: CHEAPEST_VIEWS = Views, ORGANIC_VIEWS = Watch Time, SUBSCRIBERS = Subscribers, ORGANIC_VIEWS_AND_SUBSCRIBERS = Channel Growth (default for non-monetized channels), ADSENSE_ROI = Revenue (monetized channels only). Read ${YOUTUBE_CAMPAIGN_STRATEGIES_RESOURCE_URI} before recommending or changing one.`);
1970
3216
  var DateRangeSchema2 = DateRangeSchema;
1971
3217
  var ToolFormatSchema2 = ToolFormatSchema;
1972
- var OnboardingAttemptIdSchema = z11.string().trim().min(1).max(120).optional();
1973
- var ExpectedCampaignStatusEnum = z11.enum([
3218
+ var OnboardingAttemptIdSchema = z16.string().trim().min(1).max(120).optional();
3219
+ var ExpectedCampaignStatusEnum = z16.enum([
1974
3220
  "AWAITING_SMART_LINK",
1975
3221
  "ACTIVE",
1976
3222
  "ARCHIVED",
@@ -1983,23 +3229,15 @@ var ExpectedCampaignStatusEnum = z11.enum([
1983
3229
  "SUBSCRIPTION_PAUSED"
1984
3230
  ]);
1985
3231
  var ExpectedCampaignStatusSchema = ExpectedCampaignStatusEnum.optional();
1986
- var CampaignStatusFilterSchema = ExpectedCampaignStatusEnum.exclude([
1987
- "ENDED"
1988
- ]).optional();
1989
- var DynamoiListArtistsInputSchema = z11.object({
1990
- artistId: z11.string().uuid().optional(),
1991
- cursor: z11.string().optional(),
1992
- format: ToolFormatSchema2.optional(),
1993
- limit: z11.number().int().min(1).max(50).optional()
1994
- }).strict();
1995
- var DynamoiSearchInputSchema = z11.object({
1996
- artistId: z11.string().uuid().optional(),
1997
- cursor: z11.string().optional(),
3232
+ var CampaignStatusFilterSchema = ExpectedCampaignStatusEnum.optional();
3233
+ var DynamoiSearchInputSchema = z16.object({
3234
+ artistId: z16.string().uuid().optional(),
3235
+ cursor: z16.string().optional(),
1998
3236
  format: ToolFormatSchema2.optional(),
1999
- includeArchived: z11.boolean().optional(),
2000
- limit: z11.number().int().min(1).max(50).optional(),
2001
- query: z11.string().trim().max(120).optional(),
2002
- type: z11.enum(["artist", "campaign", "smartlink"]).optional()
3237
+ includeArchived: z16.boolean().optional(),
3238
+ limit: z16.number().int().min(1).max(50).optional(),
3239
+ query: SearchQuerySchema.optional(),
3240
+ type: z16.enum(["artist", "campaign", "smartlink"]).optional()
2003
3241
  }).strict().superRefine((data, ctx) => {
2004
3242
  if (!(data.type || data.query)) {
2005
3243
  ctx.addIssue({
@@ -2009,115 +3247,181 @@ var DynamoiSearchInputSchema = z11.object({
2009
3247
  });
2010
3248
  }
2011
3249
  });
2012
- var DynamoiGetCurrentUserIntentSchema = z11.enum([
2013
- "account_overview",
2014
- "artist_access_check",
2015
- "organization_access_check",
2016
- "platform_connection_check"
2017
- ]);
2018
- var DynamoiGetCurrentUserInputSchema = z11.object({
2019
- format: ToolFormatSchema2.optional(),
2020
- intent: DynamoiGetCurrentUserIntentSchema.default("account_overview")
2021
- }).strict();
2022
- var DynamoiGetArtistInputSchema = z11.object({
2023
- artistId: z11.string().uuid(),
3250
+ var DynamoiGetArtistInputSchema = z16.object({
3251
+ artistId: z16.string().uuid(),
2024
3252
  format: ToolFormatSchema2.optional()
2025
3253
  }).strict();
2026
- var DynamoiListCampaignsInputSchema = z11.object({
2027
- artistId: z11.string().uuid(),
2028
- campaignType: z11.enum(["SMART_CAMPAIGN", "YOUTUBE"]).optional(),
2029
- cursor: z11.string().optional(),
3254
+ var DynamoiListCampaignsInputSchema = z16.object({
3255
+ artistId: z16.string().uuid(),
3256
+ campaignType: z16.enum(["SMART_CAMPAIGN", "YOUTUBE"]).optional(),
3257
+ cursor: z16.string().optional(),
2030
3258
  format: ToolFormatSchema2.optional(),
2031
- limit: z11.number().int().min(1).max(50).optional(),
3259
+ limit: z16.number().int().min(1).max(50).optional(),
2032
3260
  status: CampaignStatusFilterSchema
2033
3261
  }).strict();
2034
- var DynamoiGetCampaignInputSchema = z11.object({
3262
+ var DynamoiGetCampaignInputSchema = z16.object({
2035
3263
  analyticsDateRange: DateRangeSchema2.optional(),
2036
- analyticsGranularity: z11.enum(["TOTAL", "DAILY"]).optional(),
2037
- campaignId: z11.string().uuid(),
3264
+ analyticsGranularity: z16.enum(["TOTAL", "DAILY"]).optional(),
3265
+ campaignId: z16.string().uuid(),
2038
3266
  format: ToolFormatSchema2.optional(),
2039
- includeAnalytics: z11.boolean().optional(),
2040
- includeCountries: z11.boolean().optional(),
2041
- includeDeploymentStatus: z11.boolean().optional()
3267
+ includeAnalytics: z16.boolean().optional(),
3268
+ includeChannelResults: z16.boolean().optional(),
3269
+ includeCountries: z16.boolean().optional(),
3270
+ includeDeploymentStatus: z16.boolean().optional()
2042
3271
  }).strict();
2043
- var DynamoiGetCampaignAnalyticsInputSchema = z11.object({
2044
- campaignId: z11.string().uuid(),
3272
+ var DynamoiGetCampaignAnalyticsInputSchema = z16.object({
3273
+ campaignId: z16.string().uuid(),
2045
3274
  dateRange: DateRangeSchema2.optional(),
2046
3275
  format: ToolFormatSchema2.optional(),
2047
- granularity: z11.enum(["TOTAL", "DAILY"]).optional()
3276
+ granularity: z16.enum(["TOTAL", "DAILY"]).optional()
2048
3277
  }).strict();
2049
- var DynamoiGetArtistAnalyticsInputSchema = z11.object({
2050
- artistId: z11.string().uuid(),
3278
+ var DynamoiGetArtistAnalyticsInputSchema = z16.object({
3279
+ artistId: z16.string().uuid(),
2051
3280
  dateRange: DateRangeSchema2.optional(),
2052
3281
  format: ToolFormatSchema2.optional(),
2053
- granularity: z11.enum(["TOTAL", "DAILY"]).optional()
3282
+ granularity: z16.enum(["TOTAL", "DAILY"]).optional()
2054
3283
  }).strict();
2055
- var DynamoiGetBillingInputSchema = z11.object({
2056
- artistId: z11.string().uuid(),
3284
+ var DynamoiGetGrowthAuditInputSchema = z16.object({ artistId: z16.string().uuid() }).strict();
3285
+ var DynamoiGetPlaylistAnalyticsInputSchema = z16.object({ artistId: z16.string().uuid() }).strict();
3286
+ var DynamoiGetAudienceAnalyticsInputSchema = z16.object({
3287
+ artistId: z16.string().uuid(),
3288
+ range: z16.enum(["7d", "30d", "90d"]).default("30d")
3289
+ }).strict();
3290
+ var DynamoiGetBillingInputSchema = z16.object({
3291
+ artistId: z16.string().uuid(),
2057
3292
  format: ToolFormatSchema2.optional(),
2058
3293
  onboardingAttemptId: OnboardingAttemptIdSchema
2059
3294
  }).strict();
2060
- var LocationTargetSchema = z11.object({
2061
- code: z11.string().trim().min(1).max(8),
2062
- name: z11.string().trim().min(1).max(120)
3295
+ var LocationTargetSchema = z16.object({
3296
+ code: z16.string().trim().min(1).max(8),
3297
+ name: z16.string().trim().min(1).max(120)
2063
3298
  }).strict();
2064
- var DynamoiGetPlatformStatusInputSchema = z11.object({
2065
- artistId: z11.string().uuid(),
3299
+ var DynamoiGetPlatformStatusInputSchema = z16.object({
3300
+ artistId: z16.string().uuid(),
2066
3301
  format: ToolFormatSchema2.optional(),
2067
3302
  onboardingAttemptId: OnboardingAttemptIdSchema,
2068
- onboardingFlow: z11.enum(["meta", "youtube"]).optional()
3303
+ onboardingFlow: z16.enum(["meta", "youtube"]).optional()
2069
3304
  }).strict();
2070
- var DynamoiStartYoutubeChannelLinkInputSchema = z11.object({
2071
- artistId: z11.string().uuid(),
3305
+ var DynamoiStartYoutubeChannelLinkInputSchema = z16.object({
3306
+ artistId: z16.string().uuid(),
2072
3307
  format: ToolFormatSchema2.optional(),
2073
- purpose: z11.enum(["advertising", "distribution_identity"]).optional(),
3308
+ purpose: z16.enum(["advertising", "distribution_identity"]).optional(),
2074
3309
  userIntentSummary: UserIntentSummarySchema
2075
3310
  }).strict();
2076
- var DynamoiStartMetaConnectionInputSchema = z11.object({
2077
- artistId: z11.string().uuid(),
3311
+ var DynamoiStartMetaConnectionInputSchema = z16.object({
3312
+ artistId: z16.string().uuid(),
2078
3313
  format: ToolFormatSchema2.optional(),
2079
- purpose: z11.enum(["advertising", "distribution_identity"]).optional(),
3314
+ purpose: z16.enum(["advertising", "distribution_identity"]).optional(),
2080
3315
  userIntentSummary: UserIntentSummarySchema
2081
3316
  }).strict();
2082
- var DynamoiListAvailableCountriesInputSchema = z11.object({
2083
- campaignType: z11.enum(["SMART_CAMPAIGN", "YOUTUBE"]),
2084
- cursor: z11.string().optional(),
3317
+ var DynamoiListAvailableCountriesInputSchema = z16.object({
3318
+ campaignType: z16.enum(["SMART_CAMPAIGN", "YOUTUBE"]),
3319
+ cursor: z16.string().optional(),
2085
3320
  format: ToolFormatSchema2.optional(),
2086
- limit: z11.number().int().min(1).max(100).optional(),
2087
- query: z11.string().trim().max(120).optional()
3321
+ limit: z16.number().int().min(1).max(100).optional(),
3322
+ query: z16.string().trim().max(120).optional()
2088
3323
  }).strict();
2089
- var DynamoiGetOnboardingStatusInputSchema = z11.object({
2090
- artistId: z11.string().uuid(),
3324
+ var DynamoiGetOnboardingStatusInputSchema = z16.object({
3325
+ artistId: z16.string().uuid(),
2091
3326
  format: ToolFormatSchema2.optional()
2092
3327
  }).strict();
2093
- var DynamoiGetCampaignReadinessInputSchema = z11.object({
2094
- artistId: z11.string().uuid(),
2095
- budgetAmount: z11.number().finite().positive().optional(),
2096
- budgetType: z11.enum(["DAILY", "TOTAL"]).optional(),
2097
- campaignType: z11.enum(["SMART_CAMPAIGN", "YOUTUBE"]),
2098
- contentType: z11.enum(["TRACK", "ALBUM", "PLAYLIST", "VIDEO"]).optional(),
3328
+ var YouTubeEntriesSchema = z16.array(z16.object({
3329
+ playlistId: z16.string().trim().min(1).max(128).optional(),
3330
+ videoId: z16.string().trim().min(1).max(128)
3331
+ }).strict()).min(1).max(10);
3332
+ function validateYouTubeEntries(data, ctx) {
3333
+ if (data.youtubeEntries && (data.youtubeVideoId || data.youtubePlaylistId)) {
3334
+ ctx.addIssue({
3335
+ code: "custom",
3336
+ message: "Use youtubeEntries or youtubeVideoId/youtubePlaylistId, not both",
3337
+ path: ["youtubeEntries"]
3338
+ });
3339
+ }
3340
+ if (data.youtubeEntries && data.youtubeStrategy !== "CHEAPEST_VIEWS") {
3341
+ data.youtubeEntries.forEach((entry, index) => {
3342
+ if (!entry.playlistId) {
3343
+ ctx.addIssue({
3344
+ code: "custom",
3345
+ message: "playlistId is required unless youtubeStrategy is CHEAPEST_VIEWS",
3346
+ path: ["youtubeEntries", index, "playlistId"]
3347
+ });
3348
+ }
3349
+ });
3350
+ }
3351
+ if (data.youtubeEntries && data.youtubeStrategy === "CHEAPEST_VIEWS" && data.youtubeEntries.length > 1) {
3352
+ ctx.addIssue({
3353
+ code: "custom",
3354
+ message: "Views campaigns support one promoted video.",
3355
+ path: ["youtubeEntries"]
3356
+ });
3357
+ }
3358
+ }
3359
+ var DynamoiGetCampaignReadinessInputSchema = z16.object({
3360
+ adCopy: z16.string().trim().max(500).optional(),
3361
+ artistId: z16.string().uuid(),
3362
+ budgetAmount: z16.number().finite().positive().optional(),
3363
+ budgetType: z16.enum(["DAILY", "TOTAL"]).optional(),
3364
+ campaignType: z16.enum(["SMART_CAMPAIGN", "YOUTUBE"]),
3365
+ contentType: z16.enum(["TRACK", "ALBUM", "PLAYLIST", "VIDEO"]).optional(),
2099
3366
  endDate: IsoCalendarDateSchema.optional(),
2100
3367
  format: ToolFormatSchema2.optional(),
2101
- locationTargets: z11.array(LocationTargetSchema).optional(),
2102
- mediaAssetIds: z11.array(z11.string().uuid()).optional(),
2103
- spotifyUrl: z11.string().trim().min(1).max(500).optional(),
2104
- youtubeVideoId: z11.string().trim().min(1).max(128).optional()
2105
- }).strict();
2106
- var DynamoiGetCampaignDeploymentStatusInputSchema = z11.object({
2107
- campaignId: z11.string().uuid(),
3368
+ locationTargets: z16.array(LocationTargetSchema).optional(),
3369
+ mediaAssetIds: z16.array(z16.string().uuid()).optional(),
3370
+ spotifyUrl: z16.string().trim().min(1).max(500).optional(),
3371
+ useAiGeneratedCopy: z16.boolean().optional(),
3372
+ youtubeEntries: YouTubeEntriesSchema.optional(),
3373
+ youtubePlaylistId: z16.string().trim().min(1).max(128).optional(),
3374
+ youtubeStrategy: YouTubeStrategySchema.optional(),
3375
+ youtubeVideoId: z16.string().trim().min(1).max(128).optional()
3376
+ }).strict().superRefine(validateYouTubeEntries);
3377
+ var DynamoiManageYoutubeDraftInputSchema = z16.object({
3378
+ action: z16.enum(["inspect", "discard"]),
3379
+ artistId: z16.string().uuid(),
3380
+ campaignId: z16.string().uuid().optional(),
3381
+ expectedUpdatedAt: z16.string().datetime().optional(),
3382
+ userIntentSummary: UserIntentSummarySchema.optional()
3383
+ }).strict().superRefine((data, ctx) => {
3384
+ if (data.action === "discard" && !data.campaignId) {
3385
+ ctx.addIssue({
3386
+ code: "custom",
3387
+ message: "campaignId is required to discard a draft",
3388
+ path: ["campaignId"]
3389
+ });
3390
+ }
3391
+ if (data.action === "discard" && !data.expectedUpdatedAt) {
3392
+ ctx.addIssue({
3393
+ code: "custom",
3394
+ message: "expectedUpdatedAt is required to discard a draft",
3395
+ path: ["expectedUpdatedAt"]
3396
+ });
3397
+ }
3398
+ if (data.action === "discard" && !data.userIntentSummary) {
3399
+ ctx.addIssue({
3400
+ code: "custom",
3401
+ message: "userIntentSummary is required to discard a draft",
3402
+ path: ["userIntentSummary"]
3403
+ });
3404
+ }
3405
+ });
3406
+ var DynamoiGetCampaignDeploymentStatusInputSchema = z16.object({
3407
+ campaignId: z16.string().uuid(),
2108
3408
  format: ToolFormatSchema2.optional()
2109
3409
  }).strict();
2110
- var DynamoiPauseCampaignInputSchema = z11.object({
2111
- campaignId: z11.string().uuid(),
3410
+ var DynamoiPauseCampaignInputSchema = z16.object({
3411
+ campaignId: z16.string().uuid(),
2112
3412
  clientRequestId: ClientRequestIdSchema,
2113
3413
  expectedCurrentStatus: ExpectedCampaignStatusSchema,
2114
3414
  userIntentSummary: UserIntentSummarySchema
2115
3415
  }).strict();
2116
- var DynamoiResumeCampaignInputSchema = z11.object({
2117
- acceptedConsentCopyHash: z11.literal(PROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY_HASH2).optional(),
2118
- acceptedConsentVersion: z11.literal(PROSPECTIVE_BUDGET_FUNDING_CONSENT_VERSION2).optional(),
2119
- authorizeAutomaticDailyFunding: z11.literal(true).optional(),
2120
- campaignId: z11.string().uuid(),
3416
+ var DynamoiGetResumeFundingInputSchema = z16.object({
3417
+ campaignId: z16.string().uuid(),
3418
+ format: ToolFormatSchema2.optional()
3419
+ }).strict();
3420
+ var DynamoiResumeCampaignInputSchema = z16.object({
3421
+ acceptedConsentCopyHash: z16.literal(PROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY_HASH).optional(),
3422
+ acceptedConsentVersion: z16.literal(PROSPECTIVE_BUDGET_FUNDING_CONSENT_VERSION).optional(),
3423
+ authorizeAutomaticDailyFunding: z16.literal(true).optional(),
3424
+ campaignId: z16.string().uuid(),
2121
3425
  clientRequestId: ClientRequestIdSchema,
2122
3426
  expectedCurrentStatus: ExpectedCampaignStatusSchema,
2123
3427
  userIntentSummary: UserIntentSummarySchema
@@ -2130,15 +3434,15 @@ var DynamoiResumeCampaignInputSchema = z11.object({
2130
3434
  });
2131
3435
  }
2132
3436
  });
2133
- var DynamoiUpdateBudgetInputSchema = z11.object({
2134
- acceptedConsentCopyHash: z11.literal(PROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY_HASH2).optional(),
2135
- acceptedConsentVersion: z11.literal(PROSPECTIVE_BUDGET_FUNDING_CONSENT_VERSION2).optional(),
2136
- authorizeAutomaticDailyFunding: z11.literal(true).describe(`Set only after the client explicitly accepts: “${PROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY2}”`).optional(),
2137
- budgetAmount: z11.number().finite().positive(),
2138
- campaignId: z11.string().uuid(),
3437
+ var DynamoiUpdateBudgetInputSchema = z16.object({
3438
+ acceptedConsentCopyHash: z16.literal(PROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY_HASH).optional(),
3439
+ acceptedConsentVersion: z16.literal(PROSPECTIVE_BUDGET_FUNDING_CONSENT_VERSION).optional(),
3440
+ authorizeAutomaticDailyFunding: z16.literal(true).describe(`Set only after the client explicitly accepts: “${PROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY}”`).optional(),
3441
+ budgetAmount: z16.number().finite().positive().describe("Budget in the artist's commercial currency (major units; use only exact minor units)."),
3442
+ campaignId: z16.string().uuid(),
2139
3443
  clientRequestId: ClientRequestIdSchema,
2140
3444
  endDate: IsoCalendarDateSchema.optional(),
2141
- expectedCurrentBudgetAmount: z11.number().finite().positive().optional(),
3445
+ expectedCurrentBudgetAmount: z16.number().finite().positive().describe("Current budget in the artist's commercial currency (major units).").optional(),
2142
3446
  expectedCurrentEndDate: IsoCalendarDateSchema.optional(),
2143
3447
  userIntentSummary: UserIntentSummarySchema
2144
3448
  }).strict().superRefine((data, ctx) => {
@@ -2150,20 +3454,53 @@ var DynamoiUpdateBudgetInputSchema = z11.object({
2150
3454
  });
2151
3455
  }
2152
3456
  });
2153
- var DynamoiUpdateCampaignInputSchema = z11.object({
2154
- acceptedConsentCopyHash: z11.literal(PROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY_HASH2).optional(),
2155
- acceptedConsentVersion: z11.literal(PROSPECTIVE_BUDGET_FUNDING_CONSENT_VERSION2).optional(),
2156
- action: z11.enum(["pause", "resume", "update_budget"]),
2157
- authorizeAutomaticDailyFunding: z11.literal(true).describe(`Set only after the client explicitly accepts: “${PROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY2}”`).optional(),
2158
- budgetAmount: z11.number().finite().positive().optional(),
2159
- campaignId: z11.string().uuid(),
3457
+ var DynamoiUpdateCampaignInputSchema = z16.object({
3458
+ acceptedConsentCopyHash: z16.literal(PROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY_HASH).optional(),
3459
+ acceptedConsentVersion: z16.literal(PROSPECTIVE_BUDGET_FUNDING_CONSENT_VERSION).optional(),
3460
+ action: z16.enum([
3461
+ "pause",
3462
+ "resume",
3463
+ "update_budget",
3464
+ "change_strategy",
3465
+ "update_location",
3466
+ "update_end_date",
3467
+ "archive",
3468
+ "update_goals"
3469
+ ]),
3470
+ authorizeAutomaticDailyFunding: z16.literal(true).describe(`Set only after the client explicitly accepts: “${PROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY}”`).optional(),
3471
+ budgetAmount: z16.number().finite().positive().describe("Budget in the artist's commercial currency (major units; use only exact minor units).").optional(),
3472
+ campaignId: z16.string().uuid(),
2160
3473
  clientRequestId: ClientRequestIdSchema,
2161
3474
  endDate: IsoCalendarDateSchema.optional(),
2162
- expectedCurrentBudgetAmount: z11.number().finite().positive().optional(),
3475
+ expectedCurrentBudgetAmount: z16.number().finite().positive().describe("Current budget in the artist's commercial currency (major units).").optional(),
2163
3476
  expectedCurrentEndDate: IsoCalendarDateSchema.optional(),
2164
3477
  expectedCurrentStatus: ExpectedCampaignStatusSchema,
3478
+ locationTargets: z16.union([
3479
+ z16.object({ mode: z16.literal("GLOBAL") }).strict(),
3480
+ z16.object({
3481
+ countries: z16.array(z16.string().length(2)).min(1),
3482
+ mode: z16.literal("COUNTRIES")
3483
+ }).strict()
3484
+ ]).optional(),
3485
+ monetizationQualificationMode: z16.enum(["STANDARD", "MONETIZATION_QUALIFICATION"]).optional(),
3486
+ optimizeForOrganicViews: z16.boolean().optional(),
3487
+ optimizeForSubscribers: z16.boolean().optional(),
3488
+ strategy: YouTubeStrategySchema.optional(),
2165
3489
  userIntentSummary: UserIntentSummarySchema
2166
3490
  }).strict().superRefine((data, ctx) => {
3491
+ if ([
3492
+ "change_strategy",
3493
+ "update_location",
3494
+ "update_end_date",
3495
+ "archive",
3496
+ "update_goals"
3497
+ ].includes(data.action) && !data.clientRequestId) {
3498
+ ctx.addIssue({
3499
+ code: "custom",
3500
+ message: "clientRequestId is required for this action",
3501
+ path: ["clientRequestId"]
3502
+ });
3503
+ }
2167
3504
  if (data.action === "update_budget" && data.budgetAmount === undefined) {
2168
3505
  ctx.addIssue({
2169
3506
  code: "custom",
@@ -2171,7 +3508,35 @@ var DynamoiUpdateCampaignInputSchema = z11.object({
2171
3508
  path: ["budgetAmount"]
2172
3509
  });
2173
3510
  }
2174
- if (data.action !== "update_budget") {
3511
+ if (data.action === "update_end_date" && data.endDate === undefined) {
3512
+ ctx.addIssue({
3513
+ code: "custom",
3514
+ message: "endDate is required",
3515
+ path: ["endDate"]
3516
+ });
3517
+ }
3518
+ if (data.action === "change_strategy" && data.strategy === undefined) {
3519
+ ctx.addIssue({
3520
+ code: "custom",
3521
+ message: "strategy is required",
3522
+ path: ["strategy"]
3523
+ });
3524
+ }
3525
+ if (data.action === "update_location" && data.locationTargets === undefined) {
3526
+ ctx.addIssue({
3527
+ code: "custom",
3528
+ message: "locationTargets is required",
3529
+ path: ["locationTargets"]
3530
+ });
3531
+ }
3532
+ if (data.action === "update_goals" && data.optimizeForOrganicViews === undefined && data.optimizeForSubscribers === undefined && data.monetizationQualificationMode === undefined) {
3533
+ ctx.addIssue({
3534
+ code: "custom",
3535
+ message: "At least one goal or monetizationQualificationMode is required",
3536
+ path: ["action"]
3537
+ });
3538
+ }
3539
+ if (data.action !== "update_budget" && data.action !== "update_end_date") {
2175
3540
  for (const field of [
2176
3541
  "budgetAmount",
2177
3542
  "endDate",
@@ -2187,7 +3552,36 @@ var DynamoiUpdateCampaignInputSchema = z11.object({
2187
3552
  }
2188
3553
  }
2189
3554
  }
2190
- if (data.action === "pause") {
3555
+ if (data.action === "update_end_date" && data.expectedCurrentBudgetAmount !== undefined) {
3556
+ ctx.addIssue({
3557
+ code: "custom",
3558
+ message: "expectedCurrentBudgetAmount is not valid for an end-date-only edit",
3559
+ path: ["expectedCurrentBudgetAmount"]
3560
+ });
3561
+ }
3562
+ for (const [field, action] of [
3563
+ ["strategy", "change_strategy"],
3564
+ ["locationTargets", "update_location"],
3565
+ ["optimizeForOrganicViews", "update_goals"],
3566
+ ["optimizeForSubscribers", "update_goals"],
3567
+ ["monetizationQualificationMode", "update_goals"]
3568
+ ]) {
3569
+ if (data[field] !== undefined && data.action !== action) {
3570
+ ctx.addIssue({
3571
+ code: "custom",
3572
+ message: `${field} is only valid when action is ${action}`,
3573
+ path: [field]
3574
+ });
3575
+ }
3576
+ }
3577
+ if (data.action === "update_end_date" && data.budgetAmount !== undefined) {
3578
+ ctx.addIssue({
3579
+ code: "custom",
3580
+ message: "budgetAmount is not valid for an end-date-only edit",
3581
+ path: ["budgetAmount"]
3582
+ });
3583
+ }
3584
+ if (data.action !== "update_budget" && data.action !== "update_end_date" && data.action !== "resume") {
2191
3585
  for (const field of [
2192
3586
  "acceptedConsentCopyHash",
2193
3587
  "acceptedConsentVersion",
@@ -2210,42 +3604,37 @@ var DynamoiUpdateCampaignInputSchema = z11.object({
2210
3604
  });
2211
3605
  }
2212
3606
  });
2213
- var DynamoiListMediaAssetsInputSchema = z11.object({
2214
- artistId: z11.string().uuid(),
2215
- cursor: z11.string().optional(),
3607
+ var DynamoiListMediaAssetsInputSchema = z16.object({
3608
+ artistId: z16.string().uuid(),
3609
+ cursor: z16.string().optional(),
2216
3610
  format: ToolFormatSchema2.optional(),
2217
- includeUrls: z11.boolean().optional(),
2218
- limit: z11.number().int().min(1).max(50).optional()
3611
+ includeUrls: z16.boolean().optional(),
3612
+ limit: z16.number().int().min(1).max(50).optional()
2219
3613
  }).strict();
2220
- var DynamoiLaunchCampaignInputSchema = z11.object({
2221
- acceptedConsentCopyHash: z11.literal(PROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY_HASH2).optional(),
2222
- acceptedConsentVersion: z11.literal(PROSPECTIVE_BUDGET_FUNDING_CONSENT_VERSION2).optional(),
2223
- adCopy: z11.string().trim().max(500).optional(),
2224
- appleMusicUrl: z11.string().trim().min(1).max(500).optional(),
2225
- artistId: z11.string().uuid(),
2226
- authorizeAutomaticDailyFunding: z11.literal(true).describe(`Required for DAILY budgets. Set only after the client explicitly accepts: “${PROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY2}”`).optional(),
2227
- budgetAmount: z11.number().finite().positive(),
2228
- budgetSplits: z11.record(z11.enum(["META", "GOOGLE"]), z11.number().int().min(0).max(100)),
2229
- budgetType: z11.enum(["DAILY", "TOTAL"]),
2230
- campaignType: z11.enum(["SMART_CAMPAIGN", "YOUTUBE"]),
2231
- clientRequestId: z11.string().uuid(),
2232
- contentTitle: z11.string().trim().min(1).max(160),
2233
- contentType: z11.enum(["TRACK", "ALBUM", "PLAYLIST", "VIDEO"]),
3614
+ var DynamoiLaunchCampaignInputSchema = z16.object({
3615
+ acceptedConsentCopyHash: z16.literal(PROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY_HASH).optional(),
3616
+ acceptedConsentVersion: z16.literal(PROSPECTIVE_BUDGET_FUNDING_CONSENT_VERSION).optional(),
3617
+ adCopy: z16.string().trim().max(500).optional(),
3618
+ appleMusicUrl: z16.string().trim().min(1).max(500).optional(),
3619
+ artistId: z16.string().uuid(),
3620
+ authorizeAutomaticDailyFunding: z16.literal(true).describe(`Required for DAILY budgets. Set only after the client explicitly accepts: “${PROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY}”`).optional(),
3621
+ budgetAmount: z16.number().finite().positive().describe("Budget in the artist's commercial currency (major units; use only exact minor units)."),
3622
+ budgetSplits: z16.record(z16.enum(["META", "GOOGLE"]), z16.number().int().min(0).max(100)),
3623
+ budgetType: z16.enum(["DAILY", "TOTAL"]),
3624
+ campaignType: z16.enum(["SMART_CAMPAIGN", "YOUTUBE"]),
3625
+ clientRequestId: z16.string().uuid(),
3626
+ contentTitle: z16.string().trim().min(1).max(160),
3627
+ contentType: z16.enum(["TRACK", "ALBUM", "PLAYLIST", "VIDEO"]),
2234
3628
  endDate: IsoCalendarDateSchema.optional(),
2235
- locationTargets: z11.array(LocationTargetSchema).optional(),
2236
- mediaAssetIds: z11.array(z11.string().uuid()).optional(),
2237
- spotifyUrl: z11.string().trim().min(1).max(500).optional(),
2238
- useAiGeneratedCopy: z11.boolean().optional(),
3629
+ locationTargets: z16.array(LocationTargetSchema).optional(),
3630
+ mediaAssetIds: z16.array(z16.string().uuid()).optional(),
3631
+ spotifyUrl: z16.string().trim().min(1).max(500).optional(),
3632
+ useAiGeneratedCopy: z16.boolean().optional(),
2239
3633
  userIntentSummary: UserIntentSummarySchema,
2240
- youtubePlaylistId: z11.string().trim().min(1).max(128).optional(),
2241
- youtubeStrategy: z11.enum([
2242
- "CHEAPEST_VIEWS",
2243
- "ORGANIC_VIEWS",
2244
- "SUBSCRIBERS",
2245
- "ORGANIC_VIEWS_AND_SUBSCRIBERS",
2246
- "ADSENSE_ROI"
2247
- ]).optional(),
2248
- youtubeVideoId: z11.string().trim().min(1).max(128).optional()
3634
+ youtubeEntries: YouTubeEntriesSchema.optional(),
3635
+ youtubePlaylistId: z16.string().trim().min(1).max(128).optional(),
3636
+ youtubeStrategy: YouTubeStrategySchema.optional(),
3637
+ youtubeVideoId: z16.string().trim().min(1).max(128).optional()
2249
3638
  }).strict().superRefine((data, ctx) => {
2250
3639
  if (data.budgetType === "DAILY" && !(data.authorizeAutomaticDailyFunding && data.acceptedConsentCopyHash && data.acceptedConsentVersion)) {
2251
3640
  ctx.addIssue({
@@ -2293,7 +3682,8 @@ var DynamoiLaunchCampaignInputSchema = z11.object({
2293
3682
  }
2294
3683
  }
2295
3684
  if (data.campaignType === "YOUTUBE") {
2296
- if (!data.youtubeVideoId) {
3685
+ validateYouTubeEntries(data, ctx);
3686
+ if (!(data.youtubeVideoId || data.youtubeEntries)) {
2297
3687
  ctx.addIssue({
2298
3688
  code: "custom",
2299
3689
  message: "youtubeVideoId is required for YOUTUBE",
@@ -2307,7 +3697,7 @@ var DynamoiLaunchCampaignInputSchema = z11.object({
2307
3697
  path: ["youtubeStrategy"]
2308
3698
  });
2309
3699
  }
2310
- if (data.youtubeStrategy && data.youtubeStrategy !== "CHEAPEST_VIEWS" && !data.youtubePlaylistId) {
3700
+ if (data.youtubeStrategy && data.youtubeStrategy !== "CHEAPEST_VIEWS" && !data.youtubePlaylistId && !data.youtubeEntries) {
2311
3701
  ctx.addIssue({
2312
3702
  code: "custom",
2313
3703
  message: "youtubePlaylistId is required for YOUTUBE unless youtubeStrategy is CHEAPEST_VIEWS",
@@ -2380,11 +3770,11 @@ var PHASE_1_TOOL_DEFINITIONS = [
2380
3770
  title: "List Campaigns"
2381
3771
  },
2382
3772
  {
2383
- description: "Use this when the user wants full details for one campaign, including budget, targeting, platform status, and next actions. Set includeAnalytics=true for one-campaign performance, includeDeploymentStatus=true for delivery/deployment blockers, and includeCountries=true only when the full country list is needed. Do not use this for a campaign list; use dynamoi_list_campaigns instead. After a successful launch or campaign mutation, prefer format=summary when you need a follow-up read to relay the final answer.",
3773
+ description: "Use this when the user wants full details for one campaign, including budget, targeting, platform status, and next actions. YouTube campaigns return youtubeStrategy and strategyGuide: read the guide's goal and judgeBy before interpreting results. Set includeAnalytics=true for paid delivery, includeChannelResults=true for observed YouTube channel results with paid and organic views (never attributed to the campaign), includeDeploymentStatus=true for delivery/deployment blockers, and includeCountries=true only when the full country list is needed. Do not use this for a campaign list; use dynamoi_list_campaigns instead. After a successful launch or campaign mutation, prefer format=summary when you need a follow-up read to relay the final answer.",
2384
3774
  destructiveHint: false,
2385
3775
  name: "dynamoi_get_campaign",
2386
3776
  openWorldHint: false,
2387
- outputSchema: AnyOutputEnvelopeSchema,
3777
+ outputSchema: GetCampaignOutputEnvelopeSchema,
2388
3778
  readOnlyHint: true,
2389
3779
  schema: DynamoiGetCampaignInputSchema,
2390
3780
  title: "Get Campaign"
@@ -2399,6 +3789,46 @@ var PHASE_1_TOOL_DEFINITIONS = [
2399
3789
  schema: DynamoiGetArtistAnalyticsInputSchema,
2400
3790
  title: "Get Artist Analytics"
2401
3791
  },
3792
+ {
3793
+ description: "Use this when the user asks for an artist's Spotify monthly listeners, listener growth over time, growth audit or score, playlist reach, or growth recommendations. The response carries its status, coverage dates, and limitations; preserve unavailable or stale status and do not treat a missing metric as zero. This is Spotify and market insight data, not paid campaign performance.",
3794
+ destructiveHint: false,
3795
+ name: "dynamoi_get_growth_audit",
3796
+ openWorldHint: false,
3797
+ outputSchema: AnyOutputEnvelopeSchema,
3798
+ readOnlyHint: true,
3799
+ schema: DynamoiGetGrowthAuditInputSchema,
3800
+ title: "Get Spotify Growth Audit"
3801
+ },
3802
+ {
3803
+ description: "Use this when the user asks about an artist's tracked playlist placements, reach, or playlist movement. The response includes freshness and snapshot dates with the playlist and movement rows. These observed placements are not attributed to a paid campaign.",
3804
+ destructiveHint: false,
3805
+ name: "dynamoi_get_playlist_analytics",
3806
+ openWorldHint: false,
3807
+ outputSchema: AnyOutputEnvelopeSchema,
3808
+ readOnlyHint: true,
3809
+ schema: DynamoiGetPlaylistAnalyticsInputSchema,
3810
+ title: "Get Playlist Analytics"
3811
+ },
3812
+ {
3813
+ description: "Use this when the user asks about an artist's streaming audience by country, service, paid/free tier, or daily trend. Choose range=7d, 30d, or 90d; it defaults to 30d. The response comes from audience analytics and preserves the requested date range. If the source is temporarily unavailable, report that instead of treating it as zero audience.",
3814
+ destructiveHint: false,
3815
+ name: "dynamoi_get_audience_analytics",
3816
+ openWorldHint: false,
3817
+ outputSchema: AnyOutputEnvelopeSchema,
3818
+ readOnlyHint: true,
3819
+ schema: DynamoiGetAudienceAnalyticsInputSchema,
3820
+ title: "Get Audience Analytics"
3821
+ },
3822
+ {
3823
+ description: "Use this to analyze an artist's own connected YouTube channel's estimated ad revenue to inform AdSense strategy and channel growth, alongside subscribers, views, watch time or country, device and subscribed-status breakdowns: paged channel data from the YouTube Analytics warehouse or explicitly qualified synthetic/sample data. Pick one dataset: channel_daily (views, watch time, subscribers gained and lost, likes, shares, playlist starts, estimated revenue, ad revenue, gross revenue, monetized playbacks, CPM and playback-based CPM), video_daily (per-video metrics with titles; filter with videoIds), country_daily, traffic_source_daily, search_term_daily (YouTube search terms for the whole channel), subscribed_status_daily, device_daily, operating_system_daily, playback_location_daily, creator_content_type_daily, or video_catalog (video titles and publish dates). traffic_source_daily rows with source ADVERTISING carry trafficClass=paid and every other source carries trafficClass=organic, but that label only groups sources and is not organic proof: ad clicks that land in a playlist are credited mostly to PLAYLIST and SUBSCRIBER, so trafficClass=organic rows include ad sessions. Organic lift is growth in sources ads do not touch (YT_SEARCH, RELATED_VIDEO, browse features) or lift that persists after spend stops. Warehouse data is observed on the channel, not attributed to any campaign. Preserve the returned source, coverage, freshness, and synthetic/sample qualifications; do not treat synthetic/sample data as observed channel results, campaign attribution, or actual earnings/payouts. Treat returned ad revenue as estimated revenue, not an AdSense payout. Compare periods yourself and use the campaigns block (dates, strategy, promoted videos) as context. YouTube data arrives about 2-3 days late and revenue can lag further: check coverage before comparing, and treat placeholderDays and missingDays as unknown, never zero. Not available yet: audience demographics, per-video traffic sources and per-video search terms. Needs a connected channel; a channel that must be reconnected is refused. Returns no ad spend. Before judging a campaign's strategy, read the strategyGuide from dynamoi_get_campaign. Page with nextCursor; format=summary returns only the summary and coverage.",
3824
+ destructiveHint: false,
3825
+ name: "dynamoi_get_youtube_channel_data",
3826
+ openWorldHint: false,
3827
+ outputSchema: GetYouTubeChannelDataOutputEnvelopeSchema,
3828
+ readOnlyHint: true,
3829
+ schema: DynamoiGetYouTubeChannelDataInputSchema,
3830
+ title: "Get YouTube Channel Data"
3831
+ },
2402
3832
  {
2403
3833
  description: "Use this when the user asks about billing state, credit balance, promo limits, subscription status, or whether billing blocks launches for one artist. This is a read-only status check; it does not create checkout links or collect payment. If billing blocks a launch, starting or restoring managed advertising is not available through this MCP surface; tell the user: 'You can do this in the Dynamoi dashboard at https://dynamoi.com/dashboard.' Then call this tool again to confirm the status. Do not use this for campaign analytics or platform connection troubleshooting.",
2404
3834
  destructiveHint: false,
@@ -2409,6 +3839,16 @@ var PHASE_1_TOOL_DEFINITIONS = [
2409
3839
  schema: DynamoiGetBillingInputSchema,
2410
3840
  title: "Get Billing"
2411
3841
  },
3842
+ {
3843
+ description: "Read the existing campaign's resume funding breakdown before requesting funding consent: campaign budget, funded-window coverage, usable credits, immediate charge, payment method, refusal and current consent. Amounts carry their commercial currency and minor-unit exponent. This read never reserves funds, authorizes collection or resumes delivery. A refusal is not a zero-charge approval. Use dynamoi_update_campaign to resume only after explicit user consent when required.",
3844
+ destructiveHint: false,
3845
+ name: "dynamoi_get_resume_funding",
3846
+ openWorldHint: false,
3847
+ outputSchema: GetResumeFundingOutputEnvelopeSchema,
3848
+ readOnlyHint: true,
3849
+ schema: DynamoiGetResumeFundingInputSchema,
3850
+ title: "Get Resume Funding"
3851
+ },
2412
3852
  {
2413
3853
  description: "Use this when the user wants to know whether Spotify, Meta, or YouTube are connected and what setup steps still block launches. When polling after a connection-start flow, pass the returned onboardingAttemptId and onboardingFlow so Dynamoi ops can correlate the browser step. Do not use this for detailed billing questions. Never use this to personalize generic Instagram or marketing-advice questions.",
2414
3854
  destructiveHint: false,
@@ -2430,7 +3870,7 @@ var PHASE_1_TOOL_DEFINITIONS = [
2430
3870
  title: "List Available Countries"
2431
3871
  },
2432
3872
  {
2433
- description: "Use this when the user is planning a campaign and wants to know if the proposed inputs are ready before dynamoi_launch_campaign. This validates readiness and targeting without creating a campaign. Do not use this to create or mutate campaigns.",
3873
+ description: "Use this when the user is planning a campaign and wants to know if the proposed inputs are ready before dynamoi_launch_campaign. This validates readiness and targeting without creating a campaign. Complete budget inputs also return the shared, nonbinding campaign funding preview with known or unavailable credit coverage, card upper bounds and expiry timing. For TOTAL budgets the preview describes total-daily funding for web and native creation; MCP TOTAL launch uses existing credits only, cannot authorize card funding, and does not accept the preview's total-daily consent. Do not use this to create or mutate campaigns.",
2434
3874
  destructiveHint: false,
2435
3875
  name: "dynamoi_get_campaign_readiness",
2436
3876
  openWorldHint: false,
@@ -2446,12 +3886,22 @@ var PHASE_ONBOARDING_TOOL_DEFINITIONS = createPhaseOnboardingToolDefinitions({
2446
3886
  });
2447
3887
  var PHASE_2_TOOL_DEFINITIONS = [
2448
3888
  {
2449
- description: `Use this when the user explicitly wants to pause, resume, or update the budget/end date for an existing campaign. Set action to pause, resume, or update_budget. Pause takes effect immediately. For resume or update_budget on a campaign that needs automatic daily card funding, first show the user this exact consent copy: "${PROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY2}" — then pass authorizeAutomaticDailyFunding=true with the exact acceptedConsentVersion ("${PROSPECTIVE_BUDGET_FUNDING_CONSENT_VERSION2}") and acceptedConsentCopyHash ("${PROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY_HASH2}") plus the request's clientRequestId. Without them, a resume that needs card funding is refused with: "Review and accept the daily funding authorization to resume this campaign." When retrying the same resume, reuse the same clientRequestId. Do not use this for inspection-only questions; this changes live campaign workflow state or external campaign settings.`,
3889
+ description: "Inspect an artist's open YouTube draft with action=inspect after an interrupted launch. Returns completed steps, screening, failure stage, and updatedAt. Use action=discard only when the user explicitly asks to discard that draft, supplying its campaignId, expectedUpdatedAt from inspect, and userIntentSummary. Discard cannot be undone.",
3890
+ destructiveHint: true,
3891
+ name: "dynamoi_manage_youtube_draft",
3892
+ openWorldHint: false,
3893
+ outputSchema: ManageYoutubeDraftOutputEnvelopeSchema,
3894
+ readOnlyHint: false,
3895
+ schema: DynamoiManageYoutubeDraftInputSchema,
3896
+ title: "Manage YouTube Draft"
3897
+ },
3898
+ {
3899
+ description: `Use only when the user explicitly requests a campaign change. Actions: pause, resume, update_budget, update_end_date (DAILY or TOTAL budget; TOTAL end-date extensions may require the same funding consent fields as update_budget or resume), update_location (GLOBAL or catalog-valid countries), change_strategy (managed YouTube Demand Gen), update_goals (YouTube optimization toggles and monetization qualification mode), archive (never deletes). Inspect the campaign first and supply expectedCurrentStatus where possible. For resume, update_budget, or a TOTAL update_end_date that needs automatic daily card funding, first show the user this exact consent copy: "${PROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY}" — then pass authorizeAutomaticDailyFunding=true with the exact acceptedConsentVersion ("${PROSPECTIVE_BUDGET_FUNDING_CONSENT_VERSION}") and acceptedConsentCopyHash ("${PROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY_HASH}") plus the request's clientRequestId. Without them, a resume that needs card funding is refused with: "Review and accept the daily funding authorization to resume this campaign." When retrying the same action, reuse the same clientRequestId.`,
2450
3900
  destructiveHint: true,
2451
3901
  idempotentHint: true,
2452
3902
  name: "dynamoi_update_campaign",
2453
3903
  openWorldHint: true,
2454
- outputSchema: AnyOutputEnvelopeSchema,
3904
+ outputSchema: UpdateCampaignOutputEnvelopeSchema,
2455
3905
  readOnlyHint: false,
2456
3906
  schema: DynamoiUpdateCampaignInputSchema,
2457
3907
  title: "Update Campaign"
@@ -2471,7 +3921,7 @@ var PHASE_3_TOOL_DEFINITIONS = [
2471
3921
  title: "List Media Assets"
2472
3922
  },
2473
3923
  {
2474
- description: `Use this when the user explicitly wants to create a new Smart Campaign or YouTube Campaign and start the launch workflow with provided details. Ads are not necessarily live until the returned delivery state is ACTIVE. DAILY budgets require authorizeAutomaticDailyFunding=true plus the exact acceptedConsentVersion ("${PROSPECTIVE_BUDGET_FUNDING_CONSENT_VERSION2}") and acceptedConsentCopyHash ("${PROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY_HASH2}"); first show the user this exact consent copy: "${PROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY2}". TOTAL budgets use existing credit and need no consent. YOUTUBE campaigns require youtubeVideoId and youtubeStrategy, plus youtubePlaylistId unless the strategy is CHEAPEST_VIEWS. After a successful launch, answer from the returned campaign details directly instead of chaining more tools unless the user explicitly asked for more.`,
3924
+ description: `Use this when the user explicitly wants to create a new Smart Campaign or YouTube Campaign and start the launch workflow with provided details. Ads are not necessarily live until the returned delivery state is ACTIVE. DAILY budgets require authorizeAutomaticDailyFunding=true plus the exact acceptedConsentVersion ("${PROSPECTIVE_BUDGET_FUNDING_CONSENT_VERSION}") and acceptedConsentCopyHash ("${PROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY_HASH}"); first show the user this exact consent copy: "${PROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY}". TOTAL budgets use existing credit and need no consent. YOUTUBE campaigns require youtubeStrategy and either legacy youtubeVideoId/youtubePlaylistId or ordered youtubeEntries (up to 10 videoId/playlistId pairs); playlistId is optional for CHEAPEST_VIEWS, which supports one video. After a successful launch, answer from the returned campaign details directly instead of chaining more tools unless the user explicitly asked for more.`,
2475
3925
  destructiveHint: true,
2476
3926
  idempotentHint: true,
2477
3927
  name: "dynamoi_launch_campaign",
@@ -2483,87 +3933,378 @@ var PHASE_3_TOOL_DEFINITIONS = [
2483
3933
  }
2484
3934
  ];
2485
3935
 
3936
+ // src/server/workspace/tool.ts
3937
+ import * as z17 from "zod/v4";
3938
+
3939
+ // src/server/workspace/data.ts
3940
+ var UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
3941
+ function object13(value) {
3942
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
3943
+ }
3944
+ function text(value, max = 160) {
3945
+ return typeof value === "string" ? Array.from(value).map((character) => {
3946
+ const code = character.codePointAt(0) ?? 0;
3947
+ return code < 32 || code === 127 ? " " : character;
3948
+ }).join("").slice(0, max) : "";
3949
+ }
3950
+ function artists(value) {
3951
+ return (Array.isArray(value) ? value : []).slice(0, 50).flatMap((item) => {
3952
+ const row = object13(item);
3953
+ return typeof row["id"] === "string" && UUID.test(row["id"]) && text(row["name"]) ? [
3954
+ {
3955
+ id: row["id"],
3956
+ name: text(row["name"]),
3957
+ ...text(row["organizationName"]) ? { organizationName: text(row["organizationName"]) } : {}
3958
+ }
3959
+ ] : [];
3960
+ });
3961
+ }
3962
+ function cursor(value) {
3963
+ return typeof value === "string" && value.length > 0 && value.length <= 2048 ? value : undefined;
3964
+ }
3965
+
3966
+ // src/server/workspace/style.ts
3967
+ var WORKSPACE_STYLE = `
3968
+ :root{color-scheme:light dark;--bg:var(--color-background-primary,light-dark(#fff,#171717));--fg:var(--color-text-primary,light-dark(#202020,#eee));--muted:var(--color-text-secondary,light-dark(#595959,#b5b5b5));--line:var(--color-border-primary,light-dark(#d6d6d6,#484848));--surface:var(--color-background-secondary,light-dark(#f4f4f4,#252525));--focus:var(--color-text-primary,light-dark(#202020,#eee));font:14px/1.5 var(--font-sans,system-ui,sans-serif)}
3969
+ *{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--fg)}main{max-width:1080px;margin:auto;padding:20px}h1{font-size:20px;margin:0;font-weight:650;letter-spacing:-.02em}h2{font-size:16px;margin:0 0 12px}h3{font-size:14px;margin:20px 0 8px}p{margin:8px 0;color:var(--muted);max-width:65ch}header{padding-bottom:12px;border-bottom:1px solid var(--line)}button,select{font:inherit;color:inherit;background:var(--bg);border:1px solid var(--line);border-radius:6px;min-height:40px;padding:8px 12px}button{cursor:pointer}button:hover{background:var(--surface)}button:disabled{opacity:.55;cursor:default}button:focus-visible,select:focus-visible,a:focus-visible{outline:2px solid var(--focus);outline-offset:3px}a{color:inherit;text-underline-offset:3px}label{font-weight:600;display:block;margin-bottom:6px}select{width:100%;max-width:460px}nav{display:flex;flex-wrap:wrap;gap:8px;margin:16px 0}button[aria-pressed=true]{background:var(--fg);color:var(--bg);border-color:var(--fg)}.columns{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:28px}.rows{list-style:none;margin:0;padding:0}.rows li{border-bottom:1px solid var(--line)}.row{width:100%;display:flex;flex-direction:column;align-items:flex-start;text-align:left;border:0;border-radius:0;padding:12px 4px;overflow-wrap:anywhere}.row small{color:var(--muted)}.row[aria-current=true]{background:var(--surface)}.detail{border-top:1px solid var(--line);padding-top:14px;overflow-wrap:anywhere}dl{margin:12px 0}dl div{display:flex;justify-content:space-between;gap:16px;padding:8px 0;border-bottom:1px solid var(--line)}dt{color:var(--muted)}dd{margin:0;font-variant-numeric:tabular-nums}#connection{font-size:12px}.notice{padding:12px 0}.actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:16px}.error{color:var(--fg);font-weight:600}.more{margin-top:12px}::selection{background:var(--fg);color:var(--bg)}@media(max-width:600px){main{padding:16px}.columns{grid-template-columns:1fr;gap:20px}button,select{min-height:44px}}`;
3970
+
3971
+ // src/server/workspace/workspace-script.generated.ts
3972
+ var WORKSPACE_SCRIPT = `(()=>{var H_=Object.defineProperty;var B_=(e)=>e;function W_(e,t){this[e]=B_.bind(null,t)}var js=(e,t)=>{for(var r in t)H_(e,r,{get:t[r],enumerable:!0,configurable:!0,set:W_.bind(t,r)})};var bt={};js(bt,{anyString:()=>ku,base64:()=>gu,base64url:()=>vu,bigint:()=>Iu,boolean:()=>Ru,browserEmail:()=>TS,cidrv4:()=>fu,cidrv6:()=>hu,creditCard:()=>Ws,cuid:()=>eu,cuid2:()=>tu,currencyCode:()=>yu,date:()=>$u,datetime:()=>wu,domain:()=>_u,duration:()=>su,e164:()=>Su,email:()=>lu,emoji:()=>uu,extendedDuration:()=>zS,guid:()=>cu,hex:()=>Ou,hostname:()=>bu,html5Email:()=>IS,httpProtocol:()=>Wi,iban:()=>Ks,idnEmail:()=>PS,integer:()=>Ki,ipv4:()=>du,ipv6:()=>mu,ksuid:()=>iu,lowercase:()=>Eu,mac:()=>pu,md5_base64:()=>NS,md5_base64url:()=>jS,md5_hex:()=>OS,nanoid:()=>ou,nanoidOfLength:()=>au,null:()=>Pu,number:()=>Gt,rfc5322Email:()=>RS,sha1_base64:()=>US,sha1_base64url:()=>DS,sha1_hex:()=>AS,sha256_base64:()=>LS,sha256_base64url:()=>qS,sha256_hex:()=>MS,sha384_base64:()=>ZS,sha384_base64url:()=>FS,sha384_hex:()=>VS,sha512_base64:()=>HS,sha512_base64url:()=>BS,sha512_hex:()=>JS,string:()=>xu,time:()=>zu,ulid:()=>ru,undefined:()=>Tu,unicodeEmail:()=>Qp,uppercase:()=>Cu,uuid:()=>wr,uuid4:()=>wS,uuid6:()=>kS,uuid7:()=>xS,xid:()=>nu});var kn={};js(kn,{ZodAny:()=>Ov,ZodArray:()=>Uv,ZodBase64:()=>xm,ZodBase64URL:()=>Im,ZodBigInt:()=>qc,ZodBigIntFormat:()=>Tm,ZodBoolean:()=>Lc,ZodCIDRv4:()=>wm,ZodCIDRv6:()=>km,ZodCUID:()=>vm,ZodCUID2:()=>bm,ZodCatch:()=>rb,ZodCodec:()=>Bc,ZodCreditCard:()=>Rv,ZodCustom:()=>Wc,ZodCustomStringFormat:()=>zn,ZodDate:()=>Em,ZodDefault:()=>Gv,ZodDiscriminatedUnion:()=>Mv,ZodE164:()=>Rm,ZodEmail:()=>mm,ZodEmoji:()=>hm,ZodEnum:()=>lo,ZodExactOptional:()=>Om,ZodFile:()=>Hv,ZodFunction:()=>db,ZodGUID:()=>fm,ZodIBAN:()=>Pv,ZodIPv4:()=>$m,ZodIPv6:()=>zm,ZodISODate:()=>Pr,ZodISODateTime:()=>Rr,ZodISODuration:()=>Er,ZodISOTime:()=>Tr,ZodInstanceOf:()=>fb,ZodIntersection:()=>Lv,ZodJWT:()=>Pm,ZodKSUID:()=>ym,ZodLazy:()=>lb,ZodLiteral:()=>Jv,ZodMAC:()=>Iv,ZodMap:()=>Zv,ZodNaN:()=>ib,ZodNanoID:()=>gm,ZodNever:()=>jv,ZodNonOptional:()=>Nm,ZodNull:()=>Cv,ZodNullable:()=>Kv,ZodNumber:()=>mo,ZodNumberFormat:()=>wn,ZodObject:()=>Zc,ZodOptional:()=>Jc,ZodPipe:()=>Hc,ZodPrefault:()=>Xv,ZodPreprocess:()=>ob,ZodPromise:()=>ub,ZodReadonly:()=>ab,ZodRecord:()=>co,ZodSet:()=>Fv,ZodString:()=>Dc,ZodStringFormat:()=>ne,ZodSuccess:()=>tb,ZodSymbol:()=>Tv,ZodTemplateLiteral:()=>cb,ZodTransform:()=>Bv,ZodTuple:()=>qv,ZodType:()=>W,ZodULID:()=>_m,ZodURL:()=>Mc,ZodUUID:()=>Nt,ZodUndefined:()=>Ev,ZodUnion:()=>Fc,ZodUnknown:()=>Nv,ZodVoid:()=>Av,ZodXID:()=>Sm,ZodXor:()=>Dv,_ZodString:()=>dm,_default:()=>Yv,_function:()=>w$,any:()=>po,array:()=>v,base64:()=>qy,base64url:()=>Vy,bigint:()=>r$,boolean:()=>T,catch:()=>nb,check:()=>k$,cidrv4:()=>My,cidrv6:()=>Ly,codec:()=>S$,creditCard:()=>Fy,cuid:()=>Ey,cuid2:()=>Cy,currencyCode:()=>Gy,custom:()=>x$,date:()=>s$,describe:()=>I$,discriminatedUnion:()=>At,e164:()=>Zy,email:()=>pm,emoji:()=>Py,enum:()=>Z,exactOptional:()=>Wv,file:()=>g$,float32:()=>Xy,float64:()=>Qy,function:()=>w$,guid:()=>zy,hash:()=>Yy,hex:()=>Ky,hostname:()=>Wy,httpUrl:()=>Ry,iban:()=>Jy,instanceof:()=>P$,int:()=>lm,int32:()=>e$,int64:()=>n$,intersection:()=>_t,invertCodec:()=>y$,ipv4:()=>Ay,ipv6:()=>Dy,json:()=>E$,jwt:()=>Hy,keyof:()=>c$,ksuid:()=>jy,lazy:()=>Cr,literal:()=>p,looseObject:()=>q,looseRecord:()=>m$,mac:()=>Uy,map:()=>p$,meta:()=>R$,nan:()=>_$,nanoid:()=>Ty,nativeEnum:()=>h$,never:()=>fo,nonoptional:()=>eb,null:()=>jt,nullable:()=>Uc,nullish:()=>v$,number:()=>y,object:()=>d,optional:()=>N,partialRecord:()=>d$,pipe:()=>um,prefault:()=>Qv,preprocess:()=>er,promise:()=>z$,readonly:()=>sb,record:()=>I,refine:()=>mb,set:()=>f$,strictObject:()=>l$,string:()=>s,stringFormat:()=>By,stringbool:()=>T$,success:()=>b$,superRefine:()=>pb,symbol:()=>o$,templateLiteral:()=>$$,transform:()=>Cm,tuple:()=>Vv,uint32:()=>t$,uint64:()=>i$,ulid:()=>Oy,undefined:()=>Vc,union:()=>P,unknown:()=>O,url:()=>uo,uuid:()=>wy,uuidv4:()=>ky,uuidv6:()=>xy,uuidv7:()=>Iy,void:()=>a$,xid:()=>Ny,xor:()=>u$});var Nc={};js(Nc,{endsWith:()=>wc,gt:()=>Xt,gte:()=>mt,includes:()=>$c,length:()=>no,lowercase:()=>Sc,lt:()=>Yt,lte:()=>dt,maxLength:()=>ro,maxSize:()=>gn,mime:()=>xc,minLength:()=>kr,minSize:()=>Qt,multipleOf:()=>hn,negative:()=>qg,nonnegative:()=>Zg,nonpositive:()=>Vg,normalize:()=>Ic,overwrite:()=>Ot,positive:()=>Lg,properties:()=>kc,property:()=>Fg,regex:()=>_c,size:()=>to,slugify:()=>Ec,startsWith:()=>zc,toLowerCase:()=>Pc,toUpperCase:()=>Tc,trim:()=>Rc,uppercase:()=>yc});var xn={};js(xn,{ZodISODate:()=>Pr,ZodISODateTime:()=>Rr,ZodISODuration:()=>Er,ZodISOTime:()=>Tr,date:()=>vb,datetime:()=>ho,duration:()=>N$,time:()=>O$});var{create:K_,defineProperty:As,getOwnPropertyDescriptor:G_,getOwnPropertyNames:Y_,getPrototypeOf:X_}=Object,Q_=Object.prototype.hasOwnProperty,Sp=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),yp=(e,t)=>{let r={};for(var n in e)As(r,n,{get:e[n],enumerable:!0});if(t)As(r,Symbol.toStringTag,{value:"Module"});return r},eS=(e,t,r,n)=>{if(t&&typeof t==="object"||typeof t==="function"){for(var i=Y_(t),o=0,a=i.length,c;o<a;o++)if(c=i[o],!Q_.call(e,c)&&c!==r)As(e,c,{get:((l)=>t[l]).bind(null,c),enumerable:!(n=G_(t,c))||n.enumerable})}return e},$p=(e,t,r)=>(r=e!=null?K_(X_(e)):{},eS(t||!e||!e.__esModule?As(r,"default",{value:e,enumerable:!0}):r,e));var tS=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]);function zp(e){return typeof e==="string"&&tS.has(e.replace(/#$/,""))}function Li(e){let t=Object.values(e).filter((n)=>typeof n==="number");return Object.entries(e).filter(([n,i])=>t.indexOf(+n)===-1).map(([n,i])=>i)}function j(e,t="|"){return e.map((r)=>A(r)).join(t)}function qi(e,t){if(typeof t==="bigint")return t.toString();return t}class kp{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function Vi(e){return new kp(e)}function Ul(e){return e===null||e===void 0}function Kt(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Dl(e,t){let r=e/t,n=Math.round(r),i=4*Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-n)<i)return 0;return r-n}var wp=Symbol("evaluating");function xp(e,t,r){let n=void 0;Object.defineProperty(e,t,{get(){if(n===wp)return;if(n===void 0)n=wp,n=r();return n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function Ze(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Zi(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function Tt(e){return Zi(e._zod.def)??e._zod.def.shape}function Ip(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return Ze(this,t,n),n},enumerable:!0,configurable:!0})}function Rp(e,t,r){if(t in e)Ze(e,t,r);else e[t]=r}function $r(e,t,r,n){let i=Tt(t);for(let o of r){let a=Object.getOwnPropertyDescriptor(i,o);if(!a.enumerable)continue;if(a.get)Ip(e,o,()=>{let c=t._zod.def.shape[o];return n?n(c,o):c});else Rp(e,o,n?n(a.value,o):a.value)}}function rS(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);if(!n.enumerable)continue;if(n.get)Ip(e,r,()=>t[r]);else Rp(e,r,n.value)}}function Fe(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Ml(e){return JSON.stringify(e)}function Pp(e){return e.toLowerCase().trim().replace(/[^\\w\\s-]/g,"").replace(/[\\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Ll="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function mn(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Tp=Vi(()=>{if(Ie.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Ct(e){if(mn(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(mn(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function Us(e){if(Ct(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var Ds=new Set(["string","number","symbol"]),Ep=new Set(["string","number","bigint","boolean","symbol","undefined"]);function lt(e){return e.replace(/[.*+?^\${}()|[\\]\\\\]/g,"\\\\$&")}function Je(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}function x(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both \`message\` and \`error\` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function A(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return\`"\${e}"\`;return\`\${e}\`}function Cp(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Ms=(()=>({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]}))(),Ls={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function nS(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let o={};return $r(o,e,qs(e,t)),Je(e,Fe(r,{shape:o,checks:[]}))}function qs(e,t){let r=Tt(e),n=[];for(let i of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,i)?.enumerable)throw Error(\`Unrecognized key: "\${String(i)}"\`);if(t[i])n.push(i)}return n}function iS(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let o=new Set(qs(e,t)),a={};return $r(a,e,Reflect.ownKeys(Tt(e)).filter((c)=>!o.has(c))),Je(e,Fe(r,{shape:a,checks:[]}))}function oS(e,t){if(!Ct(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let i=Tt(e);for(let o of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(i,o)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use \`.safeExtend()\` instead.")}return Je(e,Fe(e._zod.def,{shape:Op(e,t)}))}function Op(e,t){let r={};return $r(r,e,Reflect.ownKeys(Tt(e))),rS(r,t),r}function aS(e,t){if(!Ct(t))throw Error("Invalid input to safeExtend: expected a plain object");return Je(e,Fe(e._zod.def,{shape:Op(e,t)}))}function sS(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use \`.extend()\`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};$r(r,e,Reflect.ownKeys(Tt(e))),$r(r,t,Reflect.ownKeys(Tt(t)));let n=Fe(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Je(e,n)}function Np(e,t,r,n="partial"){let o=t._zod.def.checks;if(o&&o.length>0)throw Error(\`.\${n}() cannot be used on object schemas containing refinements\`);let c=r?new Set(qs(t,r)):void 0,l={};return $r(l,t,Reflect.ownKeys(Tt(t)),e&&((u,m)=>c&&!c.has(m)?u:new e({type:"optional",innerType:u}))),Je(t,Fe(t._zod.def,{shape:l,checks:[]}))}function cS(e,t,r){let n=r?new Set(qs(t,r)):void 0,i={};return $r(i,t,Reflect.ownKeys(Tt(t)),(o,a)=>n&&!n.has(a)?o:new e({type:"nonoptional",innerType:o})),Je(t,Fe(t._zod.def,{shape:i}))}function He(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function jp(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function Ye(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Mi(e){return typeof e==="string"?e:e?.message}function ql(e,t,r){var n;for(let i=t;i<e.length;i++)(n=e[i]).schema??(n.schema=r)}function Xe(e,t,r){var n;let i=e.inst?._zod?.traits;if(i?.has("$ZodType"))if(i.has("$ZodCheck"))(n=e).schema??(n.schema=e.inst);else e.schema=e.inst;let o=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,a=e.message?e.message:Mi(e.inst?._zod.def?.error?.(e))??Mi(o?.(e))??Mi(t?.error?.(e))??Mi(r.customError?.(e))??Mi(r.localeError?.(e))??"Invalid input",c={};for(let l of Object.keys(e)){if(l==="inst"||l==="schema"||l==="continue"||l==="input"||l==="__proto__")continue;c[l]=e[l]}if(c.path??(c.path=[]),c.message=a,t?.reportInput)c.input=e.input;return c}function Vs(e){if(e instanceof Set)return"set";if(e instanceof Map)return"map";if(e instanceof File)return"file";return"unknown"}var lS=/[\\uD800-\\uDBFF]/;function Fi(e){let t=e.length;if(!lS.test(e))return t;let r=t;for(let n=0;n<t-1;n++)if((e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320)r--,n++;return r}function Zs(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function U(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function zr(...e){let[t,r,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}function Ap(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);if(n.get)Object.defineProperty(e,r,{...n,enumerable:!1});else uS(e,r,n.value)}}function Et(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function Ji(e,t,r){return Et(e,t,r,!1)}function Fs(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return Et(this,r,n(this))},set(i){Et(this,r,i)}})}return t}function uS(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:Et(this,t,r.bind(this))},set(n){Et(this,t,n)}})}function dS(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var Al,Wt=!1,mS={configurable:!0,get(){Wt=!0;return}};function K(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&Al!==e._zod){Al=void 0;return}Al=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,mS);let i=Wt;Wt=!1;try{let o=r(this);if(Wt)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o});return Wt=Wt||i,o}catch(o){throw delete this[t],Wt=Wt||i,o}},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i})}})}function pS(e,t,r,n){let i=dS(e,t);if(!i)return;Object.defineProperty(i,t,{configurable:!0,get(){let o={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,o),o.value=r(this),Object.defineProperty(this,t,o),o.value},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:o})}})}var Up="~constantCatch";function Dp(e){let t=()=>e;return t[Up]=!0,t}var Mp,Zl=Object.freeze({status:"aborted"}),Vl={value:void 0,enumerable:!1},Lp="captureStackTrace"in Error?Error:null;function fS(e){let t=Lp;if(t){let r=t.stackTraceLimit;if(typeof r==="number"){try{t.stackTraceLimit=0}catch{return Lp=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function g(e,t,r,n){let i={};function o(h){this.def=h,this.constr=f,this.traits=new Set}o.prototype=i;let a=r,c=a&&new WeakSet;function l(h,b){if(!h._zod){Vl.value=new o(b);try{Object.defineProperty(h,"_zod",Vl)}finally{Vl.value=void 0}}else if(h._zod.traits.has(e))return;if(h._zod.traits.add(e),t(h,b),c){let S=Object.getPrototypeOf(h),w=h._zod.constr.prototype,C=S;while(C&&C!==w)C=Object.getPrototypeOf(C);let F=C??S;if(!c.has(F))c.add(F),Ap(F,a)}let _=f.prototype;for(let S in _){if(!Object.prototype.hasOwnProperty.call(_,S))continue;if(!(S in h))h[S]=_[S].bind(h)}}let u=n?.Parent??Object;class m extends u{}Object.defineProperty(m,"name",{value:e});function f(h){let b=n?.Parent?fS(m):this;l(b,h);let _=b._zod.deferred;if(_){for(let w of _)w();b._zod.deferred=void 0}let S=globalThis.__zod_globalConfig?.postProcessor;if(S)S(b);return b}return Object.defineProperty(f,"init",{value:l}),Object.defineProperty(f,Symbol.hasInstance,{value:(h)=>{if(n?.Parent&&h instanceof n.Parent)return!0;return h?._zod?.traits?.has(e)}}),Object.defineProperty(f,"name",{value:e}),f}class ut extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class pn extends Error{constructor(e){super(\`Encountered unidirectional transform during encode: \${e}\`);this.name="ZodEncodeError"}}(Mp=globalThis).__zod_globalConfig??(Mp.__zod_globalConfig={});var Ie=globalThis.__zod_globalConfig;function ge(e){if(e)Object.assign(Ie,e);return Ie}function hS(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,qi,2)),e.message}function gS(e){this._zod.message=e}var vS={get:hS,set:gS,enumerable:!0,configurable:!0},Jl={value:void 0,enumerable:!1},qp=new WeakSet([Object.prototype,Error.prototype]),Vp=(e,t)=>{e.name="$ZodError",Jl.value=t,Object.defineProperty(e,"issues",Jl),Jl.value=void 0,Object.defineProperty(e,"message",vS);let r=Object.getPrototypeOf(e);if(!qp.has(r))qp.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}})},Zp=g("$ZodError",Vp),Hl=g("$ZodError",Vp,void 0,{Parent:Error});function bS(e,t,r){if(!Object.prototype.hasOwnProperty.call(e,t))if(t==="__proto__")Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0});else e[t]=r();return e[t]}function Bl(e,t=(r)=>r.message){let r={},n=[];for(let i of e.issues)if(i.path.length>0)bS(r,i.path[0],()=>[]).push(t(i));else n.push(t(i));return{formErrors:n,fieldErrors:r}}function Wl(e,t=(r)=>r.message){let r={_errors:[]},n=(i,o=[])=>{for(let a of i.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map((c)=>n({issues:c},[...o,...a.path]));else if(a.code==="invalid_key")n({issues:a.issues},[...o,...a.path]);else if(a.code==="invalid_element")n({issues:a.issues},[...o,...a.path]);else{let c=[...o,...a.path];if(c.length===0)r._errors.push(t(a));else{let l=r,u=0;while(u<c.length){let m=c[u],f=u===c.length-1;if(m==="_errors"){if(f)l._errors.push(t(a));u++;continue}if(!Object.prototype.hasOwnProperty.call(l,m))Object.defineProperty(l,m,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let h=l[m];if(f)h._errors.push(t(a));l=h,u++}}}};return n(e),r}function Js(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Hi=(e)=>{let t=(r,n,i,o)=>{let a=i?{...i,async:!1}:{async:!1},c=r._zod.run({value:n,issues:[]},a);if(c instanceof Promise)throw new ut;if(c.issues.length){let l=new(o?.Err??e)(c.issues.map((u)=>Xe(u,a,ge())));throw Ll(l,o?.callee??t),l}return c.value};return t},Kl=Hi(Hl),Bi=(e)=>{let t=async(r,n,i,o)=>{let a=i?{...i,async:!0}:{async:!0},c=r._zod.run({value:n,issues:[]},a);if(c instanceof Promise)c=await c;if(c.issues.length){let l=new(o?.Err??e)(c.issues.map((u)=>Xe(u,a,ge())));throw Ll(l,o?.callee??t),l}return c.value};return t},Gl=Bi(Hl),Hs=(e)=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new ut;return o.issues.length?Fp(e,o.issues,i):{success:!0,data:o.value}};function Fp(e,t,r){let n;return{success:!1,get error(){if(!n)n=new e(t.map((i)=>Xe(i,r,ge()))),t=void 0,r=void 0;return n},set error(i){n=i,t=void 0,r=void 0}}}var Bs=(e)=>async(t,r,n)=>{let i=n?{...n,async:!0}:{async:!0},o=t._zod.run({value:r,issues:[]},i);if(o instanceof Promise)o=await o;return o.issues.length?Fp(e,o.issues,i):{success:!0,data:o.value}};var SS=Symbol.for("zod.compile.invalid"),yS=Symbol.for("zod.compile.fallback"),Yl=(e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==SS)return!0;if(n.definite===!0&&r===void 0)return!1}return $S(e,t,r)};function $S(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,o;if(i)n[yS]=!0,o=i({value:t,issues:[]},n);else o=e._zod.run({value:t,issues:[]},n);if(o instanceof Promise)throw new ut;return o.issues.length===0}var Xl=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},n);if(i instanceof Promise)i=await i;return i.issues.length===0},Jp=(e)=>{let t=Hi(e),r=(n,i,o,a)=>{let c=o?{...o,direction:"backward"}:{direction:"backward"};return t(n,i,c,Js(r,a))};return r};var Hp=(e)=>{let t=Hi(e),r=(n,i,o,a)=>t(n,i,o,Js(r,a));return r};var Bp=(e)=>{let t=Bi(e),r=async(n,i,o,a)=>{let c=o?{...o,direction:"backward"}:{direction:"backward"};return await t(n,i,c,Js(r,a))};return r};var Wp=(e)=>{let t=Bi(e),r=async(n,i,o,a)=>await t(n,i,o,Js(r,a));return r};var Kp=(e)=>(t,r,n)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return Hs(e)(t,r,i)};var Gp=(e)=>(t,r,n)=>Hs(e)(t,r,n);var Yp=(e)=>async(t,r,n)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return Bs(e)(t,r,i)};var Xp=(e)=>async(t,r,n)=>Bs(e)(t,r,n);var eu=/^[cC][0-9a-z]{6,}$/,tu=/^[0-9a-z]+$/,ru=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,nu=/^[0-9a-vA-V]{20}$/,iu=/^[A-Za-z0-9]{27}$/,ou=/^[a-zA-Z0-9_-]{21}$/;function au(e){return new RegExp(\`^[a-zA-Z0-9_-]{\${e}}$\`)}var su=/^P(?:(\\d+W)|(?!.*W)(?=\\d|T\\d)(\\d+Y)?(\\d+M)?(\\d+D)?(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+([.,]\\d+)?S)?)?)$/,zS=/^[-+]?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)?)??$/,cu=/^([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})$/,wr=(e)=>{if(!e)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|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(\`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-\${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$\`)},wS=wr(4),kS=wr(6),xS=wr(7),lu=/^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$/,IS=/^[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])?)*$/,RS=/^(([^<>()\\[\\]\\\\.,;:\\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,}))$/,Qp=/^[^\\s@"]{1,64}@[^\\s@]{1,255}$/u,PS=Qp,TS=/^[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])?)*$/,ES="^(?=[\\\\s\\\\S]*[\\\\p{Extended_Pictographic}\\\\p{Regional_Indicator}\\\\u20E3])[\\\\p{Extended_Pictographic}\\\\p{Emoji_Component}]+$";function uu(){return new RegExp(ES,"u")}var du=/^(?:(?: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])$/,mu=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,pu=(e)=>{let t=lt(e??":");return new RegExp(\`^(?:[0-9A-F]{2}\${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}\${t}){5}[0-9a-f]{2}$\`)},fu=/^((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])$/,hu=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,gu=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,vu=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,bu=/^(?=.{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])?)*\\.?$/,_u=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,63}$/,Wi=/^https?$/,Su=/^\\+[1-9]\\d{6,14}$/,Ws=/^\\d(?:[ -]?\\d){11,18}$/,yu=/^(?:AED|AFN|ALL|AMD|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BHD|BIF|BMD|BND|BOB|BOV|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHE|CHF|CHW|CLF|CLP|CNY|COP|COU|CRC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MXV|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|USN|UYI|UYU|UYW|UZS|VED|VES|VND|VUV|WST|XAD|XAF|XAG|XAU|XBA|XBB|XBC|XBD|XCD|XCG|XDR|XOF|XPD|XPF|XPT|XSU|XTS|XUA|XXX|YER|ZAR|ZMW|ZWG)$/,Ks=/^[A-Z]{2}(?!00|01|99)\\d{2}[A-Z0-9]{11,30}$/,ef="(?:(?:\\\\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])))";function CS(e){return new RegExp(\`^\${e}$\`)}var $u=CS(ef);function Ql(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\\\d|2[0-3]):[0-5]\\\\d":e.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{\${e.precision}}\`:e.seconds?"(?:[01]\\\\d|2[0-3]):[0-5]\\\\d:[0-5]\\\\d(?:\\\\.\\\\d+)?":"(?:[01]\\\\d|2[0-3]):[0-5]\\\\d(?::[0-5]\\\\d(?:\\\\.\\\\d+)?)?"}function zu(e){return new RegExp(\`^\${Ql(e)}$\`)}function wu(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\\\d|2[0-3]):[0-5]\\\\d)");let r=\`\${Ql({precision:e.precision,seconds:!0})}(?:\${t.join("|")})\`,n=e.local?\`\${r}|\${Ql({precision:e.precision})}\`:r;return new RegExp(\`^\${ef}T(?:\${n})$\`)}var ku=/^[\\s\\S]{0,}$/,xu=(e)=>{let t=e?\`[\\\\s\\\\S]{\${e?.minimum??0},\${e?.maximum??""}}\`:"[\\\\s\\\\S]*";return new RegExp(\`^\${t}$\`)},Iu=/^-?\\d+n?$/,Ki=/^-?\\d+$/,Gt=/^-?\\d+(?:\\.\\d+)?$/,Ru=/^(?:true|false)$/i,Pu=/^null$/i;var Tu=/^undefined$/i;var Eu=/^[^A-Z]*$/,Cu=/^[^a-z]*$/,Ou=/^[0-9a-fA-F]*$/;function Gi(e,t){return new RegExp(\`^[A-Za-z0-9+/]{\${e}}\${t}$\`)}function Yi(e){return new RegExp(\`^[A-Za-z0-9_-]{\${e}}$\`)}var OS=/^[0-9a-fA-F]{32}$/,NS=Gi(22,"=="),jS=Yi(22),AS=/^[0-9a-fA-F]{40}$/,US=Gi(27,"="),DS=Yi(27),MS=/^[0-9a-fA-F]{64}$/,LS=Gi(43,"="),qS=Yi(43),VS=/^[0-9a-fA-F]{96}$/,ZS=Gi(64,""),FS=Yi(64),JS=/^[0-9a-fA-F]{128}$/,HS=Gi(86,"=="),BS=Yi(86);var ie=g("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Nu=(e)=>{let t=e.value;return!Ul(t)&&t.size!==void 0},ju=(e)=>{let t=e.value;return!Ul(t)&&t.length!==void 0},Gs={number:"number",bigint:"bigint",object:"date"},Au=g("$ZodCheckLessThan",(e,t)=>{ie.init(e,t);let r=Gs[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value<=t.value:n.value<t.value)return;n.issues.push({origin:Gs[typeof n.value]??r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Uu=g("$ZodCheckGreaterThan",(e,t)=>{ie.init(e,t);let r=Gs[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value>=t.value:n.value>t.value)return;n.issues.push({origin:Gs[typeof n.value]??r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),tf=g("$ZodCheckMultipleOf",(e,t)=>{ie.init(e,t),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):Dl(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),rf=g("$ZodCheckNumberFormat",(e,t)=>{ie.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[i,o]=Ms[t.format];e._zod.check=(a)=>{let c=a.value;if(r){if(!Number.isInteger(c)){a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){if(c>0)a.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});else a.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}if(c<i)a.issues.push({origin:"number",input:c,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort});if(c>o)a.issues.push({origin:"number",input:c,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),nf=g("$ZodCheckBigIntFormat",(e,t)=>{ie.init(e,t);let[r,n]=Ls[t.format];e._zod.check=(i)=>{let o=i.value;if(o<r)i.issues.push({origin:"bigint",input:o,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort});if(o>n)i.issues.push({origin:"bigint",input:o,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),of=g("$ZodCheckMaxSize",(e,t)=>{var r;ie.init(e,t),(r=e._zod.def).when??(r.when=Nu),e._zod.check=(n)=>{let i=n.value;if(i.size<=t.maximum)return;n.issues.push({origin:Vs(i),code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),af=g("$ZodCheckMinSize",(e,t)=>{var r;ie.init(e,t),(r=e._zod.def).when??(r.when=Nu),e._zod.check=(n)=>{let i=n.value;if(i.size>=t.minimum)return;n.issues.push({origin:Vs(i),code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),sf=g("$ZodCheckSizeEquals",(e,t)=>{var r;ie.init(e,t),(r=e._zod.def).when??(r.when=Nu),e._zod.check=(n)=>{let i=n.value,o=i.size;if(o===t.size)return;let a=o>t.size;n.issues.push({origin:Vs(i),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),cf=g("$ZodCheckMaxLength",(e,t)=>{var r;ie.init(e,t),(r=e._zod.def).when??(r.when=ju),e._zod.check=(n)=>{let i=n.value,o=i.length;if((typeof i==="string"&&o>t.maximum?Fi(i):o)<=t.maximum)return;let c=Zs(i);n.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),lf=g("$ZodCheckMinLength",(e,t)=>{var r;ie.init(e,t),(r=e._zod.def).when??(r.when=ju),e._zod.check=(n)=>{let i=n.value,o=i.length;if((typeof i==="string"&&o>=t.minimum&&o<t.minimum*2?Fi(i):o)>=t.minimum)return;let c=Zs(i);n.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),uf=g("$ZodCheckLengthEquals",(e,t)=>{var r;ie.init(e,t),(r=e._zod.def).when??(r.when=ju),e._zod.check=(n)=>{let i=n.value,o=i.length,a=typeof i==="string"&&o>=t.length&&o<=t.length*2?Fi(i):o;if(a===t.length)return;let c=Zs(i),l=a>t.length;n.issues.push({origin:c,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Xi=g("$ZodCheckStringFormat",(e,t)=>{var r,n;if(ie.init(e,t),t.pattern)(r=e._zod).check??(r.check=(i)=>{if(t.pattern.lastIndex=0,t.pattern.test(i.value))return;i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(n=e._zod).check??(n.check=()=>{})}),df=g("$ZodCheckRegex",(e,t)=>{Xi.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),mf=g("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Eu),Xi.init(e,t)}),pf=g("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Cu),Xi.init(e,t)}),ff=g("$ZodCheckIncludes",(e,t)=>{ie.init(e,t);let r=lt(t.includes),n=new RegExp(typeof t.position==="number"?\`^.{\${t.position},}\${r}\`:r);t.pattern=n,e._zod.check=(i)=>{if(i.value.includes(t.includes,t.position))return;i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),hf=g("$ZodCheckStartsWith",(e,t)=>{ie.init(e,t);let r=new RegExp(\`^\${lt(t.prefix)}.*\`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.startsWith(t.prefix))return;n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),gf=g("$ZodCheckEndsWith",(e,t)=>{ie.init(e,t);let r=new RegExp(\`.*\${lt(t.suffix)}$\`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.endsWith(t.suffix))return;n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});function Ys(e,t,r){if(e.issues.length)t.issues.push(...Ye(r,e.issues))}var vf=g("$ZodCheckProperty",(e,t)=>{ie.init(e,t),e._zod.check=(r)=>{let n=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then((i)=>Ys(i,r,t.property));Ys(n,r,t.property);return}}),bf=g("$ZodCheckProperties",(e,t)=>{ie.init(e,t),Ji(e,Symbol.iterator,function*(){yield e});let r;e._zod.check=(n)=>{if(n.value==null){n.issues.push({expected:"object",code:"invalid_type",input:n.value,inst:e});return}r??(r=Reflect.ownKeys(t.shape).map((a)=>[a,t.shape[a]]));let i=n.value,o;for(let[a,c]of r){let l=c._zod.run({value:i[a],issues:[]},{});if(l instanceof Promise)o??(o=[]),o.push(l.then((u)=>Ys(u,n,a)));else Ys(l,n,a)}if(o)return Promise.all(o).then(()=>{return});return}}),_f=g("$ZodCheckMimeType",(e,t)=>{ie.init(e,t);let r=new Set(t.mime);e._zod.check=(n)=>{if(r.has(n.value.type))return;n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),Sf=g("$ZodCheckOverwrite",(e,t)=>{ie.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class Xs{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(\`
3973
+ \`).filter((o)=>o),n=Math.min(...r.map((o)=>o.length-o.trimStart().length)),i=r.map((o)=>o.slice(n)).map((o)=>" ".repeat(this.indent*2)+o);for(let o of i)this.content.push(o)}compile(){let e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),\`return function (\${this.args.join(", ")}) {
3974
+ \${t.join(\`
3975
+ \`)}
3976
+ };\`)(...Object.values(this.closed))}}var $f={major:4,minor:6,patch:5};var J=g("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=$f;let n=e._zod.def.checks,i=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let o of i)for(let a of o._zod.onattach)a(e);if(i.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(c,l,u)=>{if(c.memo)return c;let m=He(c),f;for(let h of l){if(h._zod.def.when){if(jp(c))continue;if(!h._zod.def.when(c))continue}else if(m)continue;let b=c.issues.length,_=h._zod.check(c);if(_ instanceof Promise&&u?.async===!1)throw new ut;if(f||_ instanceof Promise)f=(f??Promise.resolve()).then(async()=>{if(await _,c.issues.length===b)return;if(ql(c.issues,b,e),!m)m=He(c,b)});else{if(c.issues.length===b)continue;if(ql(c.issues,b,e),!m)m=He(c,b)}}if(f)return f.then(()=>c);return c},a=(c,l,u)=>{if(He(c))return c.aborted=!0,c;let m=o(l,i,u);if(m instanceof Promise){if(u.async===!1)throw new ut;return m.then((f)=>e._zod.parse(f,u))}return e._zod.parse(m,u)};e._zod.run=(c,l)=>{if(l.skipChecks)return e._zod.parse(c,l);if(l.direction==="backward"){let m=e._zod.parse({value:c.value,issues:[]},{...l,skipChecks:!0});if(m instanceof Promise)return m.then((f)=>a(f,c,l));return a(m,c,l)}let u=e._zod.parse(c,l);if(u instanceof Promise){if(l.async===!1)throw new ut;return u.then((m)=>o(m,i,l))}return o(u,i,l)}}},{get "~standard"(){return Ji(this,"~standard",Lu(this))},set "~standard"(e){Et(this,"~standard",e)}}),Df=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>Xe(r,t,ge()))}:{value:e.value};async function WS(e,t){let r={async:!0};return Df(await e._zod.run({value:t,issues:[]},r),r)}function Lu(e){return{validate:(t)=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return Df(n,r)}catch(n){}return WS(e,t)},vendor:"zod",version:1}}var fn=g("$ZodString",(e,t)=>{J.init(e,t),e._zod.pattern=t.pattern??ku,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(i){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),te=g("$ZodStringFormat",(e,t)=>{Xi.init(e,t),fn.init(e,t)}),Mf=g("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=cu),te.init(e,t)}),Lf=g("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw Error(\`Invalid UUID version: "\${t.version}"\`);t.pattern??(t.pattern=wr(n))}else t.pattern??(t.pattern=wr());te.init(e,t)}),qf=g("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=lu),te.init(e,t)}),Vf=1,rc=2;function Zf(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function Ff(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return Zf(e)||rc;return KS(e,t)}function KS(e,t){if(!t.normalize&&t.protocol?.source===Wi.source&&!/^https?:\\/\\//i.test(e))return Vf;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse==="function")return r.parse(e)??rc}return new URL(e)}catch{return rc}}var GS=/[\\t\\n\\r]/g;function Du(e){return e.replace(GS,"")}function Jf(e,t){return t.lastIndex=0,t.test(e.hostname)}function Hf(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var Bf=g("$ZodURL",(e,t)=>{te.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim(),i=Ff(n,t);if(i===Vf){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(i===rc){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(i===!0){r.value=Du(n);return}if(t.hostname&&!Jf(i,t.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort});if(t.protocol&&!Hf(i,t.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort});r.value=t.normalize?i.href:Du(n);return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Wf=g("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=uu()),te.init(e,t)}),Kf=g("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(\`Invalid nanoid length: \${t.length}\`);t.pattern??(t.pattern=t.length===void 0?ou:au(t.length)),te.init(e,t)}),Gf=g("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=eu),te.init(e,t)}),Yf=g("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=tu),te.init(e,t)}),Xf=g("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ru),te.init(e,t)}),Qf=g("$ZodXID",(e,t)=>{t.pattern??(t.pattern=nu),te.init(e,t)}),eh=g("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=iu),te.init(e,t)}),th=g("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=wu(t)),te.init(e,t)}),rh=g("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=$u),te.init(e,t)}),nh=g("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=zu(t)),te.init(e,t)}),ih=g("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=su),te.init(e,t)}),oh=g("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=du),te.init(e,t)}),YS=/^[0-9a-fA-F:.]+$/;function qu(e){if(!YS.test(e))return!1;return Zf(\`http://[\${e}]\`)}var ah=g("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=mu),te.init(e,t),e._zod.check=(r)=>{if(!qu(r.value))r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}),sh=g("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=pu(t.delimiter)),te.init(e,t)}),ch=g("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=fu),te.init(e,t)});function lh(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let i=Number(n);if(\`\${i}\`!==n)return!1;if(i<0||i>128)return!1;return qu(r)}var uh=g("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=hu),te.init(e,t),e._zod.check=(r)=>{if(!lh(r.value))r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function Vu(e){if(e==="")return!0;if(/\\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Zu=/^[0-9a-zA-Z+/]*={0,2}$/,dh=g("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Zu),te.init(e,t),e._zod.check=(r)=>{if(Vu(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),oc=/^[A-Za-z0-9_-]*$/;function mh(e){if(!oc.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Vu(r)}var ph=g("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=oc),te.init(e,t),e._zod.check=(r)=>{if(mh(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),fh=g("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Su),te.init(e,t)}),XS=/[- ]/g;function QS(e){let t=e.length,r=1,n=0;while(t){let i=e.charCodeAt(--t)-48;r^=1,n+=r?[0,2,4,6,8,1,3,5,7,9][i]:i}return n%10===0}function hh(e){if(!Ws.test(e))return!1;return QS(e.replace(XS,""))}var gh=g("$ZodCreditCard",(e,t)=>{t.pattern??(t.pattern=Ws),te.init(e,t),e._zod.check=(r)=>{if(hh(r.value))return;r.issues.push({code:"invalid_format",format:"credit_card",input:r.value,inst:e,continue:!t.abort})}});function ey(e){let t=0,r=e.length;for(let n=4;n<r;n++){let i=e.charCodeAt(n);t=(i>=65?t*100+(i-55):t*10+(i-48))%97}for(let n=0;n<4;n++){let i=e.charCodeAt(n);t=(i>=65?t*100+(i-55):t*10+(i-48))%97}return t===1}function vh(e){if(!Ks.test(e))return!1;return ey(e)}var bh=g("$ZodIBAN",(e,t)=>{t.pattern??(t.pattern=Ks),te.init(e,t),e._zod.check=(r)=>{if(vh(r.value))return;r.issues.push({code:"invalid_format",format:"iban",input:r.value,inst:e,continue:!t.abort})}});function _h(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let i=JSON.parse(atob(n));if("typ"in i&&i?.typ!=="JWT")return!1;if(!i.alg)return!1;if(t&&(!("alg"in i)||i.alg!==t))return!1;return!0}catch{return!1}}var Sh=g("$ZodJWT",(e,t)=>{te.init(e,t),e._zod.check=(r)=>{if(_h(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),yh=g("$ZodCustomStringFormat",(e,t)=>{te.init(e,t),e._zod.check=(r)=>{if(t.fn(r.value))return;r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),Fu=g("$ZodNumber",(e,t)=>{J.init(e,t),e._zod.pattern=Gt,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(a){}let i=r.value;if(typeof i==="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let o=typeof i==="number"?Number.isNaN(i)?"NaN":!Number.isFinite(i)?String(i):void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),r}}),$h=g("$ZodNumberFormat",(e,t)=>{rf.init(e,t),Fu.init(e,t)}),ac=g("$ZodBoolean",(e,t)=>{J.init(e,t),e._zod.pattern=Ru,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(o){}let i=r.value;if(typeof i==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),Ju=g("$ZodBigInt",(e,t)=>{J.init(e,t),e._zod.pattern=Iu,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch(i){}if(typeof r.value==="bigint")return r;return r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),zh=g("$ZodBigIntFormat",(e,t)=>{nf.init(e,t),Ju.init(e,t)}),wh=g("$ZodSymbol",(e,t)=>{J.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(typeof i==="symbol")return r;return r.issues.push({expected:"symbol",code:"invalid_type",input:i,inst:e}),r}}),kh=g("$ZodUndefined",(e,t)=>{J.init(e,t),e._zod.pattern=Tu,e._zod.values=new Set([void 0]),e._zod.parse=(r,n)=>{let i=r.value;if(typeof i>"u")return r;return r.issues.push({expected:"undefined",code:"invalid_type",input:i,inst:e}),r}}),xh=g("$ZodNull",(e,t)=>{J.init(e,t),e._zod.pattern=Pu,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let i=r.value;if(i===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:i,inst:e}),r}}),Ih=g("$ZodAny",(e,t)=>{J.init(e,t),e._zod.parse=(r)=>r}),Rh=g("$ZodUnknown",(e,t)=>{J.init(e,t),e._zod.parse=(r)=>r}),Ph=g("$ZodNever",(e,t)=>{J.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),Th=g("$ZodVoid",(e,t)=>{J.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(typeof i>"u")return r;return r.issues.push({expected:"void",code:"invalid_type",input:i,inst:e}),r}}),Eh=g("$ZodDate",(e,t)=>{J.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch(c){}let i=r.value,o=i instanceof Date;if(o&&!Number.isNaN(i.getTime()))return r;return r.issues.push({expected:"date",code:"invalid_type",input:i,...o?{received:"Invalid Date"}:{},inst:e}),r}});function zf(e,t,r){if(e.issues.length)t.issues.push(...Ye(r,e.issues));t.value[r]=e.value}var Ch=g("$ZodArray",(e,t)=>{J.init(e,t);let r=Ie.memoizer;r?.attach(e),e._zod.parse=(n,i)=>{let o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=r?r.alloc(e,n,Array(o.length),i):Array(o.length);let a=[],c=i?.abortEarly;for(let l=0;l<o.length;l++){let u=o[l],m=t.element._zod.run({value:u,issues:[]},i);if(m instanceof Promise)a.push(m.then((f)=>zf(f,n,l)));else if(zf(m,n,l),c&&m.issues.length!==0&&He(m))break}if(a.length)return Promise.all(a).then(()=>n);return n}});function nc(e,t,r,n,i,o){let a=r in n,c=o==="optional";if(!a&&c&&i==="optional")return;if(e.issues.length){if(i!==void 0&&c&&!a)return;t.issues.push(...Ye(r,e.issues))}if(!a&&i===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(a||i==="defaulted"&&!c)t.value[r]=void 0}else t.value[r]=e.value}var ty=[];function Oh(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:ty,i=n.length?[...t,...n]:t;for(let a of i)if(!e.shape?.[a]?._zod?.traits?.has("$ZodType"))throw Error(\`Invalid element at key "\${String(a)}": expected a Zod schema\`);let o=Cp(e.shape);return{...e,allKeys:i,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(o)}}function Nh(e,t,r,n,i,o,a){let c=[],l=i.keySet,u=i.catchall._zod,m=u.def.type,{optin:f,optout:h}=u,b=0;for(let _ in t){if(a&&r.issues.length!==b){if(He(r,b))break;b=r.issues.length}if(l.has(_))continue;if(_==="__proto__"){if(m==="never")c.push(_);continue}if(m==="never"){c.push(_);continue}let S=u.run({value:t[_],issues:[]},n);if(S instanceof Promise)e.push(S.then((w)=>nc(w,r,_,t,f,h)));else nc(S,r,_,t,f,h)}if(c.length)r.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:o,continue:!0});if(!e.length)return r;return Promise.all(e).then(()=>r)}var ry=g("$ZodObject",(e,t)=>{J.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let u=()=>{let m={...n};return Object.defineProperty(t,"shape",{value:m}),u.raw=m,m};u.raw=n,Object.defineProperty(t,"shape",{get:u})}let i=Vi(()=>Oh(t));K(e,"propValues",(u)=>{let m=u.def.shape,f={};for(let h in m){let b=m[h]._zod;if(b.values){if(!Object.prototype.hasOwnProperty.call(f,h))Ze(f,h,new Set);for(let _ of b.values)f[h].add(_);if(b.optin!==void 0)f[h].add(void 0)}}return f});let o=mn,a=t.catchall,c,l=Ie.memoizer;l?.attach(e),e._zod.parse=(u,m)=>{c??(c=i.value);let f=u.value;if(!o(f))return u.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),u;u.value=l?l.alloc(e,u,{},m):{};let h=[],b=c.shape,_=m?.abortEarly,S=u.issues.length;for(let w of c.allKeys){if(_&&u.issues.length!==S){if(He(u,S))break;S=u.issues.length}if(w==="__proto__")continue;let C=b[w],F=C._zod.optin,D=C._zod.optout,B=C._zod.run({value:f[w],issues:[]},m);if(B instanceof Promise)h.push(B.then((k)=>nc(k,u,w,f,F,D)));else nc(B,u,w,f,F,D)}if(!a)return h.length?Promise.all(h).then(()=>u):u;return Nh(h,f,u,m,i.value,e,_===!0)}}),jh=g("$ZodObjectJIT",(e,t)=>{ry.init(e,t);let r=e._zod.parse,n=Vi(()=>Oh(t)),i=Ie.memoizer,o=(b)=>{let _=n.value,S=_.symbolKeys,w=new Xs(["payload","ctx"],{shape:b,inst:e,memo:i,syms:S}),C=(k)=>\`shape[\${k}]._zod.run({ value: input[\${k}], issues: [] }, ctx)\`,F=(k,z)=>\`
3977
+ let \${k}_ab = false;
3978
+ for (let i = 0; i < \${k}.issues.length; i++) {
3979
+ const iss = \${k}.issues[i];
3980
+ iss.path = iss.path ? [\${z}, ...iss.path] : [\${z}];
3981
+ payload.issues.push(iss);
3982
+ if (iss.continue !== true) \${k}_ab = true;
3983
+ }
3984
+ if (\${k}_ab && ctx && ctx.abortEarly) {
3985
+ payload.value = newResult;
3986
+ return payload;
3987
+ }\`;w.write("const input = payload.value;");let D=Object.create(null),B=0;for(let k of _.allKeys)D[k]=\`key_\${B++}\`;w.write(i?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let k of _.allKeys){if(k==="__proto__")continue;let z=D[k],R=typeof k==="symbol"?\`syms[\${S.indexOf(k)}]\`:Ml(k),H=\`\${R} in input\`,V=b[k],ee=V?._zod?.optin,be=ee!==void 0,Ae=V?._zod?.optout==="optional";if(w.write(\`const \${z} = \${C(R)};\`),be&&Ae){let Ce=ee==="optional"?\`\${z}_present\`:\`\${z}.value !== undefined || \${z}_present\`;w.write(\`
3988
+ const \${z}_present = \${H};
3989
+ if (!\${z}.issues.length || \${z}_present) {
3990
+ if (\${z}.issues.length) {\${F(z,R)}
3991
+ }
3992
+
3993
+ if (\${Ce}) {
3994
+ newResult[\${R}] = \${z}.value;
3995
+ }
3996
+ }
3997
+
3998
+ \`)}else if(!be)w.write(\`
3999
+ const \${z}_present = \${H};
4000
+ if (\${z}.issues.length) {\${F(z,R)}
4001
+ }
4002
+ if (!\${z}_present && !\${z}.issues.length) {
4003
+ payload.issues.push({
4004
+ code: "invalid_type",
4005
+ expected: "nonoptional",
4006
+ input: undefined,
4007
+ path: [\${R}]
4008
+ });
4009
+ if (ctx && ctx.abortEarly) {
4010
+ payload.value = newResult;
4011
+ return payload;
4012
+ }
4013
+ }
4014
+
4015
+ if (\${z}_present) {
4016
+ newResult[\${R}] = \${z}.value;
4017
+ }
4018
+
4019
+ \`);else if(w.write(\`
4020
+ if (\${z}.issues.length) {\${F(z,R)}
4021
+ }
4022
+ \`),ee==="defaulted")w.write(\`newResult[\${R}] = \${z}.value;\`);else w.write(\`
4023
+ if (\${z}.value !== undefined || \${H}) {
4024
+ newResult[\${R}] = \${z}.value;
4025
+ }
4026
+ \`)}return w.write("payload.value = newResult;"),w.write("return payload;"),w.compile()},a,c=mn,l=!Ie.jitless,m=l&&Tp.value,f=t.catchall,h;e._zod.parse=(b,_)=>{h??(h=n.value);let S=b.value;if(!c(S))return b.issues.push({expected:"object",code:"invalid_type",input:S,inst:e}),b;if(l&&m&&_?.async===!1&&_.jitless!==!0){if(!a)a=o(t.shape);if(b=a(b,_),!f)return b;return Nh([],S,b,_,h,e,_?.abortEarly===!0)}return r(b,_)}});function wf(e,t,r,n){for(let o of e)if(o.issues.length===0)return t.value=o.value,t;let i=e.filter((o)=>!He(o));if(i.length===1)return t.value=i[0].value,i[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((o)=>o.issues.map((a)=>Xe(a,n,ge())))}),t}var sc=g("$ZodUnion",(e,t)=>{J.init(e,t),K(e,"optin",(n)=>n.def.options.some((i)=>i._zod.optin==="defaulted")?"defaulted":n.def.options.some((i)=>i._zod.optin!==void 0)?"optional":void 0),K(e,"optout",(n)=>n.def.options.some((i)=>i._zod.optout==="optional")?"optional":void 0),K(e,"values",(n)=>{if(n.def.options.every((i)=>i._zod.values))return new Set(n.def.options.flatMap((i)=>Array.from(i._zod.values)));return}),K(e,"pattern",(n)=>{if(n.def.options.every((i)=>i._zod.pattern)){let i=n.def.options.map((o)=>o._zod.pattern);return new RegExp(\`^(\${i.map((o)=>Kt(o.source)).join("|")})$\`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,i)=>{if(r)return r(n,i);let o=!1,a=[];for(let c of t.options){let l=c._zod.run({value:n.value,issues:[]},i);if(l instanceof Promise)a.push(l),o=!0;else{if(l.issues.length===0)return l;a.push(l)}}if(!o)return wf(a,n,e,i);return Promise.all(a).then((c)=>wf(c,n,e,i))}});function kf(e,t,r,n){let i=[];for(let o=0;o<e.length;o++)if(e[o].issues.length===0)i.push(o);if(i.length===1)return t.value=e[i[0]].value,t;if(i.length===0)t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((o)=>o.issues.map((a)=>Xe(a,n,ge())))});else t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1,matches:i});return t}var Ah=g("$ZodXor",(e,t)=>{sc.init(e,t),t.inclusive=!1;let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,i)=>{if(r)return r(n,i);let o=!1,a=[];for(let c of t.options){let l=c._zod.run({value:n.value,issues:[]},i);if(l instanceof Promise)a.push(l),o=!0;else a.push(l)}if(!o)return kf(a,n,e,i);return Promise.all(a).then((c)=>kf(c,n,e,i))}});function ny(e){let t=new Map;for(let r of e.options){let n=r._zod.propValues?.[e.discriminator];if(!n||n.size===0)throw Error(\`Invalid discriminated union option at index "\${e.options.indexOf(r)}"\`);for(let i of n)if(t.has(i)){if(i!==void 0)throw Error(\`Duplicate discriminator value "\${String(i)}"\`);t.set(i,null)}else t.set(i,r)}return t}var Uh=g("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,sc.init(e,t);let r=e._zod.parse;K(e,"propValues",(i)=>{let o={},a=0;for(let c of i.def.options){let l=c._zod.propValues;if(!l||Object.keys(l).length===0)throw Error(\`Invalid discriminated union option at index "\${i.def.options.indexOf(c)}"\`);if(l[i.def.discriminator]?.has(void 0))a++;for(let[u,m]of Object.entries(l)){if(!Object.prototype.hasOwnProperty.call(o,u))Ze(o,u,new Set);for(let f of m)o[u].add(f)}}if(!i.def.unionFallback&&a>1)o[i.def.discriminator]?.delete(void 0);return o}),t.options.forEach((i,o)=>{let a=Zi(i._zod.def);if(a&&!Object.prototype.hasOwnProperty.call(a,t.discriminator))throw Error(\`Invalid discriminated union option at index "\${o}"\`)});let n=Vi(()=>ny(t));e._zod.parse=(i,o)=>{let a=i.value;if(!mn(a))return i.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),i;let c=a?.[t.discriminator],l=n.value.get(c);if(l&&(c!==void 0||o.direction!=="backward"))return l._zod.run(i,o);if(t.unionFallback||o.direction==="backward")return r(i,o);return i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()).filter((u)=>n.value.get(u)!==null),input:a,path:[t.discriminator],inst:e}),i}}),Dh=g("$ZodIntersection",(e,t)=>{J.init(e,t),e._zod.parse=(r,n)=>{let i=r.value,o=t.left._zod.run({value:i,issues:[]},n),a=t.right._zod.run({value:i,issues:[]},n);if(o instanceof Promise||a instanceof Promise)return Promise.all([o,a]).then(([l,u])=>xf(r,l,u));return xf(r,o,a)}});function ic(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(Ct(e)&&Ct(t)){let r=Object.keys(t),n=Object.keys(e).filter((o)=>r.indexOf(o)!==-1),i={...e,...t};if(Object.prototype.hasOwnProperty.call(i,"__proto__"))delete i.__proto__;for(let o of n){if(o==="__proto__")continue;let a=ic(e[o],t[o]);if(!a.valid)return{valid:!1,mergeErrorPath:[o,...a.mergeErrorPath]};i[o]=a.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let i=e[n],o=t[n],a=ic(i,o);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function xf(e,t,r){let n=new Map,i,o=new Map,a=(u,m)=>{let f;if(u.code==="unrecognized_keys"&&!u.path?.length)i??(i=u),f=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let h=String(u.path[0]);if(!o.has(h))o.set(h,u);f=[h]}else return!1;for(let h of f){if(!n.has(h))n.set(h,{});n.get(h)[m]=!0}return!0};for(let u of t.issues)if(!a(u,"l"))e.issues.push(u);for(let u of r.issues)if(!a(u,"r"))e.issues.push(u);let c=[...n].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(c.length){let u=i?c.filter((m)=>i.keys.includes(m)):[];if(u.length)e.issues.push({...i,keys:u});for(let m of c)if(!u.includes(m)&&o.has(m))e.issues.push(o.get(m))}let l=ic(t.value,r.value);if(!l.valid){if(He(e))return e;throw Error(\`Unmergable intersection. Error path: \${JSON.stringify(l.mergeErrorPath)}\`)}return e.value=l.data,e}var Hu=g("$ZodTuple",(e,t)=>{J.init(e,t);let r=t.items,n=Ie.memoizer;n?.attach(e),e._zod.parse=(i,o)=>{let a=i.value;if(!Array.isArray(a))return i.issues.push({input:a,inst:e,expected:"tuple",code:"invalid_type"}),i;i.value=n?n.alloc(e,i,[],o):[];let c=[],l=If(r,"optin"),u=If(r,"optout");if(!t.rest){if(a.length<l)return i.issues.push({code:"too_small",minimum:l,inclusive:!0,input:a,inst:e,origin:"array"}),i;if(a.length>r.length)i.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:a,inst:e,origin:"array"})}let m=Array(r.length),f=t.rest?o?.abortEarly:void 0,h=!1;for(let b=0;b<r.length;b++){let _=r[b]._zod.run({value:a[b],issues:[]},o);if(_ instanceof Promise)c.push(_.then((S)=>{m[b]=S}));else if(m[b]=_,f&&!h&&_.issues.length)h=He(_)}if(t.rest&&!h){let b=r.length-1,_=a.slice(r.length),S=i.issues.length;for(let w of _){if(f&&i.issues.length!==S){if(He(i,S))break;S=i.issues.length}b++;let C=t.rest._zod.run({value:w,issues:[]},o);if(C instanceof Promise)c.push(C.then((F)=>Rf(F,i,b)));else Rf(C,i,b)}}if(c.length)return Promise.all(c).then(()=>Pf(m,i,r,a,u));return Pf(m,i,r,a,u)}});function If(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}function Rf(e,t,r){if(e.issues.length)t.issues.push(...Ye(r,e.issues));t.value[r]=e.value}function Pf(e,t,r,n,i){for(let o=0;o<r.length;o++){let a=e[o],c=o<n.length;if(!c&&o>=i&&r[o]._zod.optin==="optional"){t.value.length=o;break}if(a.issues.length){if(!c&&o>=i){t.value.length=o;break}t.issues.push(...Ye(o,a.issues))}t.value[o]=a.value}for(let o=t.value.length-1;o>=n.length;o--)if(r[o]._zod.optout==="optional"&&t.value[o]===void 0)t.value.length=o;else break;return t}var Mh=g("$ZodRecord",(e,t)=>{J.init(e,t);let r=Ie.memoizer;r?.attach(e),e._zod.parse=(n,i)=>{let o=n.value;if(!Ct(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;let a=[],c=t.keyType._zod.values;if(c&&!t.partial){n.value=r?r.alloc(e,n,{},i):{};let l=new Set;for(let m of c)if(typeof m==="string"||typeof m==="number"||typeof m==="symbol"){if(l.add(typeof m==="number"?m.toString():m),m==="__proto__")continue;let f=t.keyType._zod.run({value:m,issues:[]},i);if(f instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(f.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map((_)=>Xe(_,i,ge())),input:m,path:[m],inst:e});continue}let h=f.value;if(h==="__proto__")continue;let b=t.valueType._zod.run({value:o[m],issues:[]},i);if(b instanceof Promise)a.push(b.then((_)=>{if(_.issues.length)n.issues.push(...Ye(m,_.issues));n.value[h]=_.value}));else{if(b.issues.length)n.issues.push(...Ye(m,b.issues));n.value[h]=b.value}}let u;for(let m in o)if(!l.has(m))if(t.mode==="loose"){if(m==="__proto__")continue;n.value[m]=o[m]}else u=u??[],u.push(m);if(u&&u.length>0)n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:u,continue:!0})}else{n.value=r?r.alloc(e,n,{},i):{};let l;for(let u of Reflect.ownKeys(o)){if(u==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(o,u))continue;let m=t.keyType._zod.run({value:u,issues:[]},i);if(m instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof u==="string"&&Gt.test(u)&&m.issues.length){let _=t.keyType._zod.run({value:Number(u),issues:[]},i);if(_ instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(_.issues.length===0)m=_}if(m.issues.length){if(t.mode==="loose")n.value[u]=o[u];else if(c)l=l??[],l.push(u);else n.issues.push({code:"invalid_key",origin:"record",issues:m.issues.map((_)=>Xe(_,i,ge())),input:u,path:[u],inst:e});continue}let h=m.value;if(h==="__proto__")continue;let b=t.valueType._zod.run({value:o[u],issues:[]},i);if(b instanceof Promise)a.push(b.then((_)=>{if(_.issues.length)n.issues.push(...Ye(u,_.issues));n.value[h]=_.value}));else{if(b.issues.length)n.issues.push(...Ye(u,b.issues));n.value[h]=b.value}}if(l&&l.length>0)n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:l,continue:!0})}if(a.length)return Promise.all(a).then(()=>n);return n}}),Lh=g("$ZodMap",(e,t)=>{J.init(e,t);let r=Ie.memoizer;r?.attach(e),e._zod.parse=(n,i)=>{let o=n.value;if(!(o instanceof Map))return n.issues.push({expected:"map",code:"invalid_type",input:o,inst:e}),n;let a=[];n.value=r?r.alloc(e,n,new Map,i):new Map;let c=i?.abortEarly,l=n.issues.length;for(let[u,m]of o){if(c&&n.issues.length!==l){if(He(n,l))break;l=n.issues.length}let f=t.keyType._zod.run({value:u,issues:[]},i),h=t.valueType._zod.run({value:m,issues:[]},i);if(f instanceof Promise||h instanceof Promise)a.push(Promise.all([f,h]).then(([b,_])=>{Tf(b,_,n,u,o,e,i)}));else Tf(f,h,n,u,o,e,i)}if(a.length)return Promise.all(a).then(()=>n);return n}});function Tf(e,t,r,n,i,o,a){if(e.issues.length)if(Ds.has(typeof n))r.issues.push(...Ye(n,e.issues));else r.issues.push({code:"invalid_key",origin:"map",input:i,inst:o,issues:e.issues.map((c)=>Xe(c,a,ge()))});if(t.issues.length)if(Ds.has(typeof n))r.issues.push(...Ye(n,t.issues));else r.issues.push({origin:"map",code:"invalid_element",input:i,inst:o,key:n,issues:t.issues.map((c)=>Xe(c,a,ge()))});r.value.set(e.value,t.value)}var qh=g("$ZodSet",(e,t)=>{J.init(e,t);let r=Ie.memoizer;r?.attach(e),e._zod.parse=(n,i)=>{let o=n.value;if(!(o instanceof Set))return n.issues.push({input:o,inst:e,expected:"set",code:"invalid_type"}),n;let a=[];n.value=r?r.alloc(e,n,new Set,i):new Set;let c=i?.abortEarly,l=n.issues.length;for(let u of o){if(c&&n.issues.length!==l){if(He(n,l))break;l=n.issues.length}let m=t.valueType._zod.run({value:u,issues:[]},i);if(m instanceof Promise)a.push(m.then((f)=>Ef(f,n)));else Ef(m,n)}if(a.length)return Promise.all(a).then(()=>n);return n}});function Ef(e,t){if(e.issues.length)t.issues.push(...e.issues);t.value.add(e.value)}var Vh=g("$ZodEnum",(e,t)=>{J.init(e,t);let r=Li(t.entries),n=new Set(r);e._zod.values=n,K(e,"pattern",(i)=>{let o=Li(i.def.entries).filter((a)=>Ds.has(typeof a));return new RegExp(o.length?\`^(\${o.map((a)=>lt(a.toString())).join("|")})$\`:"^[^\\\\s\\\\S]$")}),e._zod.parse=(i,o)=>{let a=i.value;if(n.has(a))return i;return i.issues.push({code:"invalid_value",values:r,input:a,inst:e}),i}}),Zh=g("$ZodLiteral",(e,t)=>{J.init(e,t);let r=new Set(t.values);e._zod.values=r,K(e,"pattern",(n)=>{let i=n.def.values;return new RegExp(i.length?\`^(\${i.map((o)=>typeof o==="string"?lt(o):o?lt(o.toString()):String(o)).join("|")})$\`:"^[^\\\\s\\\\S]$")}),e._zod.parse=(n,i)=>{let o=n.value;if(r.has(o))return n;return n.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),n}}),Fh=g("$ZodFile",(e,t)=>{J.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(i instanceof File)return r;return r.issues.push({expected:"file",code:"invalid_type",input:i,inst:e}),r}}),Jh=g("$ZodTransform",(e,t)=>{J.init(e,t),e._zod.optin="optional",Ie.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new pn(e.constructor.name);let i=t.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then((a)=>(r.value=a,r));if(i instanceof Promise)throw new ut;return r.value=i,r}});function Cf(e,t){return e.value=t.issues.length?void 0:t.value,e}var Bu=g("$ZodOptional",(e,t)=>{J.init(e,t),K(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",K(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),K(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(\`^(\${Kt(n.source)})?$\`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let i=t.innerType._zod.run({value:r.value,issues:[]},n);if(i instanceof Promise)return i.then((o)=>Cf(r,o));return Cf(r,i)}return t.innerType._zod.run(r,n)}}),Hh=g("$ZodExactOptional",(e,t)=>{Bu.init(e,t),K(e,"values",(r)=>r.def.innerType._zod.values),K(e,"pattern",(r)=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Bh=g("$ZodNullable",(e,t)=>{J.init(e,t),K(e,"optin",(r)=>r.def.innerType._zod.optin),K(e,"optout",(r)=>r.def.innerType._zod.optout),K(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(\`^(\${Kt(n.source)}|null)$\`):void 0}),K(e,"values",(r)=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>{if(r.value===null)return r;return t.innerType._zod.run(r,n)}}),Wh=g("$ZodDefault",(e,t)=>{J.init(e,t),e._zod.optin="defaulted",K(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let i=t.innerType._zod.run(r,n);if(i instanceof Promise)return i.then((o)=>Of(o,t));return Of(i,t)}});function Of(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var Kh=g("$ZodPrefault",(e,t)=>{J.init(e,t),e._zod.optin="defaulted",K(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,n)}}),Gh=g("$ZodNonOptional",(e,t)=>{J.init(e,t),K(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter((i)=>i!==void 0)):void 0}),e._zod.parse=(r,n)=>{let i=t.innerType._zod.run(r,n);if(i instanceof Promise)return i.then((o)=>Nf(o,e));return Nf(i,e)}});function Nf(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}var Yh=g("$ZodSuccess",(e,t)=>{J.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new pn("ZodSuccess");let i=t.innerType._zod.run(r,n);if(i instanceof Promise)return i.then((o)=>(r.value=o.issues.length===0,r));return r.value=i.issues.length===0,r}});function jf(e,t,r,n){if(!t.issues.length){if(e.value=t.value,t.memo)e.memo=!0;return e}return e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map((i)=>Xe(i,n,ge()))},input:e.value}),e}var Xh=g("$ZodCatch",(e,t)=>{J.init(e,t),K(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),K(e,"optout",(r)=>r.def.innerType._zod.optout),K(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let i=t.innerType._zod.run({value:r.value,issues:[]},n);if(i instanceof Promise)return i.then((o)=>jf(r,o,t,n));return jf(r,i,t,n)}}),Qh=g("$ZodNaN",(e,t)=>{J.init(e,t),e._zod.parse=(r,n)=>{if(typeof r.value!=="number"||!Number.isNaN(r.value))return r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r;return r}}),Wu=g("$ZodPipe",(e,t)=>{J.init(e,t),K(e,"values",(r)=>r.def.in._zod.values),K(e,"optin",(r)=>r.def.in._zod.optin),K(e,"optout",(r)=>r.def.out._zod.optout),K(e,"propValues",(r)=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let o=t.out._zod.run(r,n);if(o instanceof Promise)return o.then((a)=>Qs(a,t.in,n));return Qs(o,t.in,n)}let i=t.in._zod.run(r,n);if(i instanceof Promise)return i.then((o)=>Qs(o,t.out,n));return Qs(i,t.out,n)}});function Qs(e,t,r){if(e.issues.some((n)=>n.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},r)}var cc=g("$ZodCodec",(e,t)=>{J.init(e,t),K(e,"values",(r)=>r.def.in._zod.values),K(e,"optin",(r)=>r.def.in._zod.optin),K(e,"optout",(r)=>r.def.out._zod.optout),K(e,"propValues",(r)=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((a)=>ec(a,t,n));return ec(o,t,n)}else{let o=t.out._zod.run(r,n);if(o instanceof Promise)return o.then((a)=>ec(a,t,n));return ec(o,t,n)}}});function ec(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){let i=t.transform(e.value,e);if(i instanceof Promise)return i.then((o)=>tc(e,o,t.out,r));return tc(e,i,t.out,r)}else{let i=t.reverseTransform(e.value,e);if(i instanceof Promise)return i.then((o)=>tc(e,o,t.in,r));return tc(e,i,t.in,r)}}function tc(e,t,r,n){if(e.issues.length)return e.aborted=!0,e;return r._zod.run({value:t,issues:e.issues},n)}var eg=g("$ZodPreprocess",(e,t)=>{Wu.init(e,t)}),tg=g("$ZodReadonly",(e,t)=>{J.init(e,t),K(e,"propValues",(r)=>r.def.innerType._zod.propValues),K(e,"values",(r)=>r.def.innerType._zod.values),K(e,"optin",(r)=>r.def.innerType?._zod?.optin),K(e,"optout",(r)=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let i=t.innerType._zod.run(r,n);if(i instanceof Promise)return i.then(Af);return Af(i)}});function Af(e){if(!e.memo)e.value=Object.freeze(e.value);return e}function iy(e){let t=e._zod.def,r=t.pattern,n=!!t.format?.includes("int"),i,o;for(let c of t.checks??[]){let l=c._zod.def;if(l.pattern)r=l.pattern;n||(n=!!l.format?.includes("int"));let u=l.minimum??l.length,m=l.maximum??l.length;if(u!==void 0&&(i===void 0||u>i))i=u;if(m!==void 0&&(o===void 0||m<o))o=m}if(r)return r.source;if(i!==void 0&&o!==void 0&&i>o)return"(?!)";if(i!==void 0||o!==void 0)return xu({minimum:i,maximum:o}).source;let a=e._zod.pattern;return(n&&a===Gt?Ki:a)?.source}function Mu(e){let t=e._zod.def,r=e._zod.pattern?.source,n=t.innerType??e._zod.innerType;if(n){let i=n._zod.pattern?.source,o=Mu(n);if(r&&i&&o&&o!==i)return r.replace(Kt(i),()=>Kt(o));return r}if(t.options){let i=t.options.map(Mu);if(i.every(Boolean))return\`^(\${i.map((o)=>Kt(o)).join("|")})$\`}return iy(e)}var rg=g("$ZodTemplateLiteral",(e,t)=>{J.init(e,t);let r=[];for(let n of t.parts)if(typeof n==="object"&&n!==null){let i=Mu(n);if(!i)throw Error(\`Invalid template literal part, no pattern found: \${[...n._zod.traits].shift()}\`);r.push(Kt(i))}else if(n===null||Ep.has(typeof n))r.push(lt(\`\${n}\`));else throw Error(\`Invalid template literal part: \${n}\`);e._zod.pattern=new RegExp(\`^\${r.join("")}$\`),e._zod.parse=(n,i)=>{if(typeof n.value!=="string")return n.issues.push({input:n.value,inst:e,expected:"string",code:"invalid_type"}),n;if(e._zod.pattern.lastIndex=0,!e._zod.pattern.test(n.value))return n.issues.push({input:n.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),n;return n}}),ng=g("$ZodFunction",(e,t)=>(J.init(e,t),Object.defineProperty(e,"_def",{value:t}),e._zod.def=t,e.implement=(r)=>{if(typeof r!=="function")throw Error("implement() must be called with a function");return Object.defineProperty(function(...n){let i=e._def.input?Kl(e._def.input,n):n,o=Reflect.apply(r,this,i);if(e._def.output)return Kl(e._def.output,o);return o},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=(r)=>{if(typeof r!=="function")throw Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...n){let i=e._def.input?await Gl(e._def.input,n):n,o=await Reflect.apply(r,this,i);if(e._def.output)return await Gl(e._def.output,o);return o},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(r,n)=>{if(typeof r.value!=="function")return r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r;if(e._def.output&&e._def.output._zod.def.type==="promise")r.value=e.implementAsync(r.value);else r.value=e.implement(r.value);return r},e.input=(...r)=>{let n=e.constructor;if(Array.isArray(r[0]))return new n({type:"function",input:new Hu({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output});return new n({type:"function",input:r[0],output:e._def.output})},e.output=(r)=>new e.constructor({type:"function",input:e._def.input,output:r}),e)),ig=g("$ZodPromise",(e,t)=>{J.init(e,t),e._zod.parse=(r,n)=>Promise.resolve(r.value).then((i)=>t.innerType._zod.run({value:i,issues:[]},n))}),Ku=g("$ZodLazy",(e,t)=>{J.init(e,t),xp(e._zod,"innerType",()=>{let r=t;if(!r._cachedInner)r._cachedInner=t.getter();return r._cachedInner}),K(e,"pattern",(r)=>r.innerType?._zod?.pattern),K(e,"propValues",(r)=>r.innerType?._zod?.propValues),K(e,"optin",(r)=>r.innerType?._zod?.optin??void 0),K(e,"optout",(r)=>r.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),og=g("$ZodCustom",(e,t)=>{ie.init(e,t),J.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=(r)=>{let n=r.value,i=t.fn(n);if(i instanceof Promise)return i.then((o)=>Uf(o,r,n,e));Uf(i,r,n,e);return}});function Uf(e,t,r,n){if(!e){let i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};if(n._zod.def.params)i.params=n._zod.def.params;t.issues.push(zr(i))}}class cg extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var Yu="~memo",sg=[];function lg(e){return e!==null&&typeof e==="object"}function Gu(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var ug=new WeakMap,Qi=0,dc=1,eo=2;function mc(e,t,r){let n=ug.get(e);if(n!==void 0)return n?eo:Qi;if(t.has(e))return eo;t.add(e);let i=Qi,o=(m)=>{if(i!==eo&&m?._zod){let f=mc(m,t,r);if(f>i)i=f}},a=(m,f)=>{let h=Qi;for(let b of Reflect.ownKeys(m)){let _=Object.getOwnPropertyDescriptor(m,b);if(f&&!_.enumerable)continue;let S=_.get?dc:_.value?._zod?mc(_.value,t,r):Qi;if(S>h)h=S}return h},c=(m)=>{if(m>i)i=m},l=e._zod.def,u=l.type;switch(u){case"object":{let m=Zi(l);c(m?a(m,!0):dc),o(l.catchall);break}case"array":o(l.element);break;case"tuple":for(let m of l.items)o(m);o(l.rest);break;case"record":case"map":o(l.keyType),o(l.valueType);break;case"set":o(l.valueType);break;case"union":for(let m of l.options)o(m);break;case"intersection":o(l.left),o(l.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":o(l.innerType);break;case"pipe":o(l.in),o(l.out);break;case"function":o(l.input),o(l.output);break;case"lazy":{let m=l._cachedInner??(r?e._zod.innerType:void 0);c(m?mc(m,t,!1):dc);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let m in l){let f=Object.getOwnPropertyDescriptor(l,m);if(!f||f.get)continue;let h=f.value;if(!h||typeof h!=="object")continue;if(h._zod)o(h);else if(Array.isArray(h))for(let b of h)o(b)}}return t.delete(e),oy(e,i)}function oy(e,t){if(t!==dc)ug.set(e,t===eo);return t}function ay(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}var lc,uc=[],sy={alloc(e,t,r){let n=lc;if(!n)return r;lc=void 0;let i={value:r,issues:null};return n.set(t.value,i),uc.push(i),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(i,o)=>{if(o.direction!=="backward"&&dg(o,i.value))throw new cg;return r(i,o)};if(e._zod.parse=n,e._zod.run===r)e._zod.run=n})},attach(e){var t;let r,n=!1,i,o;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let a=e._zod.parse,c=(l,u)=>{if(r===void 0){let C=mc(e,new Set,!1);if(C===Qi){if(e._zod.parse=a,e._zod.run===c)e._zod.run=a;return a(l,u)}if(C===eo||n)r=!0;else n=!0}let m=l.value;if(!lg(m))return a(l,u);let f=u[Yu];if(!f)f={buckets:new WeakMap,backEdges:void 0},u[Yu]=f;let h;if(i===u)h=o;else h=ay(f,e),i=u,o=h;let b=h.get(m);if(b){if(l.value=b.value,b.issues){if(b.issues.length)l.issues.push(...Gu(b.issues))}else l.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(b.value);return l}lc=h;let _=uc.length,S=a(l,u);lc=void 0;let w=uc.length>_?uc.pop():void 0;if(S instanceof Promise)return S.then((C)=>{if(w)w.issues=C.issues.length?Gu(C.issues):sg;return C});if(w)w.issues=S.issues.length?Gu(S.issues):sg;return S};if(e._zod.parse=c,e._zod.run===a)e._zod.run=c})}};function Xu(){return sy}function dg(e,t){let r=e[Yu]?.backEdges;return r!==void 0&&lg(t)&&r.has(t)}var cy=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(o){return e[o]??null}let r={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",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function i(o,a){if(o==="number"&&typeof a==="number"&&!Number.isFinite(a))return String(a);return n[o]??o}return(o)=>{switch(o.code){case"invalid_type":{let a=i(o.expected),c=U(o.input),l=i(c,o.input);return\`Invalid input: expected \${a}, received \${l}\`}case"invalid_value":if(o.values.length===1)return\`Invalid input: expected \${A(o.values[0])}\`;return\`Invalid option: expected one of \${j(o.values,"|")}\`;case"too_big":{let a=o.exact?"exactly ":o.inclusive?"<=":"<",c=t(o.origin);if(c)return\`Too big: expected \${o.origin??"value"} to have \${a}\${o.maximum.toString()} \${c.unit??"elements"}\`;return\`Too big: expected \${o.origin??"value"} to be \${a}\${o.maximum.toString()}\`}case"too_small":{let a=o.exact?"exactly ":o.inclusive?">=":">",c=t(o.origin);if(c)return\`Too small: expected \${o.origin} to have \${a}\${o.minimum.toString()} \${c.unit}\`;return\`Too small: expected \${o.origin} to be \${a}\${o.minimum.toString()}\`}case"invalid_format":{let a=o;if(a.format==="starts_with")return\`Invalid string: must start with "\${a.prefix}"\`;if(a.format==="ends_with")return\`Invalid string: must end with "\${a.suffix}"\`;if(a.format==="includes")return\`Invalid string: must include "\${a.includes}"\`;if(a.format==="regex")return\`Invalid string: must match pattern \${a.pattern}\`;return\`Invalid \${r[a.format]??o.format}\`}case"not_multiple_of":return\`Invalid number: must be a multiple of \${o.divisor}\`;case"unrecognized_keys":return\`Unrecognized key\${o.keys.length>1?"s":""}: \${j(o.keys,", ")}\`;case"invalid_key":return\`Invalid key in \${o.origin}\`;case"invalid_union":if(o.options&&Array.isArray(o.options)&&o.options.length>0)return\`Invalid discriminator value. Expected \${o.options.map((c)=>\`'\${c}'\`).join(" | ")}\`;if(o.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return\`Invalid value in \${o.origin}\`;default:return"Invalid input"}}};function pc(){return{localeError:cy()}}var pg;class fg{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function hg(){return new fg}(pg=globalThis).__zod_globalRegistry??(pg.__zod_globalRegistry=hg());var Be=globalThis.__zod_globalRegistry;function Qu(e){if(e.checks)e.checks=[...e.checks];return e}function gg(e,t){return new e(Qu({type:"string",...x(t)}))}function ed(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...x(t)})}function td(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...x(t)})}function rd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...x(t)})}function nd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...x(t)})}function id(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...x(t)})}function od(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...x(t)})}function fc(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...x(t)})}function ad(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...x(t)})}function sd(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...x(t)})}function cd(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...x(t)})}function ld(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...x(t)})}function ud(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...x(t)})}function dd(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...x(t)})}function md(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...x(t)})}function pd(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...x(t)})}function fd(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...x(t)})}function vg(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...x(t)})}function hd(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...x(t)})}function gd(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...x(t)})}function vd(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...x(t)})}function bd(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...x(t)})}function _d(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...x(t)})}function bg(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,...x(t)})}function _g(e,t){return new e({type:"string",format:"iban",check:"string_format",abort:!1,...x(t)})}function Sd(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...x(t)})}function hc(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...x(t)})}function gc(e,t){return new e({type:"string",format:"date",check:"string_format",...x(t)})}function vc(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...x(t)})}function bc(e,t){return new e({type:"string",format:"duration",check:"string_format",...x(t)})}function Sg(e,t){return new e(Qu({type:"number",checks:[],...x(t)}))}function yg(e,t){return new e(Qu({type:"number",coerce:!0,checks:[],...x(t)}))}function $g(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...x(t)})}function zg(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...x(t)})}function wg(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...x(t)})}function kg(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...x(t)})}function xg(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...x(t)})}function Ig(e,t){return new e({type:"boolean",...x(t)})}function Rg(e,t){return new e({type:"bigint",...x(t)})}function Pg(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...x(t)})}function Tg(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...x(t)})}function Eg(e,t){return new e({type:"symbol",...x(t)})}function Cg(e,t){return new e({type:"undefined",...x(t)})}function Og(e,t){return new e({type:"null",...x(t)})}function Ng(e){return new e({type:"any"})}function jg(e){return new e({type:"unknown"})}function Ag(e,t){return new e({type:"never",...x(t)})}function Ug(e,t){return new e({type:"void",...x(t)})}function Dg(e,t){return new e({type:"date",...x(t)})}function Mg(e,t){return new e({type:"nan",...x(t)})}function Yt(e,t){return new Au({check:"less_than",...x(t),value:e,inclusive:!1})}function dt(e,t){return new Au({check:"less_than",...x(t),value:e,inclusive:!0})}function Xt(e,t){return new Uu({check:"greater_than",...x(t),value:e,inclusive:!1})}function mt(e,t){return new Uu({check:"greater_than",...x(t),value:e,inclusive:!0})}function Lg(e){return Xt(0,e)}function qg(e){return Yt(0,e)}function Vg(e){return dt(0,e)}function Zg(e){return mt(0,e)}function hn(e,t){return new tf({check:"multiple_of",...x(t),value:e})}function gn(e,t){return new of({check:"max_size",...x(t),maximum:e})}function Qt(e,t){return new af({check:"min_size",...x(t),minimum:e})}function to(e,t){return new sf({check:"size_equals",...x(t),size:e})}function ro(e,t){return new cf({check:"max_length",...x(t),maximum:e})}function kr(e,t){return new lf({check:"min_length",...x(t),minimum:e})}function no(e,t){return new uf({check:"length_equals",...x(t),length:e})}function _c(e,t){return new df({check:"string_format",format:"regex",...x(t),pattern:e})}function Sc(e){return new mf({check:"string_format",format:"lowercase",...x(e)})}function yc(e){return new pf({check:"string_format",format:"uppercase",...x(e)})}function $c(e,t){return new ff({check:"string_format",format:"includes",...x(t),includes:e})}function zc(e,t){return new hf({check:"string_format",format:"starts_with",...x(t),prefix:e})}function wc(e,t){return new gf({check:"string_format",format:"ends_with",...x(t),suffix:e})}function Fg(e,t,r){return new vf({check:"property",property:e,schema:t,...x(r)})}function kc(e,t){return new bf({check:"properties",shape:e,...x(t)})}function xc(e,t){return new _f({check:"mime_type",mime:e,...x(t)})}function Ot(e){return new Sf({check:"overwrite",tx:e})}function Ic(e){return Ot((t)=>t.normalize(e))}function Rc(){return Ot((e)=>e.trim())}function Pc(){return Ot((e)=>e.toLowerCase())}function Tc(){return Ot((e)=>e.toUpperCase())}function Ec(){return Ot((e)=>Pp(e))}function Jg(e,t,r){return new e({type:"array",element:t,...x(r)})}function Hg(e,t){return new e({type:"file",...x(t)})}function Bg(e,t,r){let n=x(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function Wg(e,t,r){return new e({type:"custom",check:"custom",fn:t,...x(r)})}function Kg(e,t){let r=my((n)=>(n.addIssue=(i)=>{if(typeof i==="string")n.issues.push(zr(i,n.value,r._zod.def));else{let o=i;if(o.fatal)o.continue=!1;if(o.code??(o.code="custom"),!("input"in o))o.input=n.value;o.inst??(o.inst=r),o.continue??(o.continue=!r._zod.def.abort),n.issues.push(zr(o))}},e(n.value,n)),t);return r}function my(e,t){let r=new ie({check:"custom",...x(t)});return r._zod.check=e,r}function Gg(e){let t=new ie({check:"describe"});return t._zod.onattach=[(r)=>{let n=Be.get(r)??{};Be.add(r,{...n,description:e})}],t._zod.check=()=>{},t}function Yg(e){let t=new ie({check:"meta"});return t._zod.onattach=[(r)=>{let n=Be.get(r)??{};Be.add(r,{...n,...e})}],t._zod.check=()=>{},t}function Xg(e,t){let r=x(t),n=r.truthy??["true","1","yes","on","y","enabled"],i=r.falsy??["false","0","no","off","n","disabled"];if(r.case!=="sensitive")n=n.map((b)=>typeof b==="string"?b.toLowerCase():b),i=i.map((b)=>typeof b==="string"?b.toLowerCase():b);let o=new Set(n),a=new Set(i),c=e.Codec??cc,l=e.Boolean??ac,m=new(e.String??fn)({type:"string",error:r.error}),f=new l({type:"boolean",error:r.error}),h=new c({type:"pipe",in:m,out:f,transform:(b,_)=>{let S=b;if(r.case!=="sensitive")S=S.toLowerCase();if(o.has(S))return!0;else if(a.has(S))return!1;else return _.issues.push({code:"invalid_value",expected:"stringbool",values:[...o,...a],input:_.value,inst:h,continue:!1}),{}},reverseTransform:(b,_)=>{if(b===!0)return n[0]||"true";else return i[0]||"false"},error:r.error});return h._zod.bag.truthy=n,h._zod.bag.falsy=i,h._zod.bag.case=r.case??"insensitive",h}function vn(e,t,r,n={}){let i=x(n),o={check:"string_format",type:"string",format:t,fn:typeof r==="function"?r:(c)=>r.test(c),...i};if(r instanceof RegExp)o.pattern=r;return new e(o)}function io(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))if(Object.prototype.propertyIsEnumerable.call(r,n))Ze(e,n,r[n]);return e}function bn(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??Be,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function ze(e,t,r,n,i){let o=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:n.path,message:i}):t.unrepresentable;if(o==="any")return!1;if(o===void 0||o==="throw")throw Error(i);return Object.assign(r,o),!0}function re(e,t,r={path:[],schemaPath:[]}){var n;let i=e._zod.def,o=t.seen.get(e);if(o){if(o.count++,r.schemaPath.includes(e))o.cycle=r.path;return o.schema}let a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let c=e._zod.toJSONSchema?.();if(c)a.schema=c;else{let m={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,m);else{let h=a.schema,b=t.processors[i.type];if(!b)throw Error(\`[toJSONSchema]: Non-representable type encountered: \${i.type}\`);b(e,t,h,m)}let f=e._zod.parent;if(f){if(!a.ref)a.ref=f;re(f,t,m),t.seen.get(f).isParent=!0}}let l=t.metadataRegistry.get(e);if(l)io(a.schema,l);if(t.io==="input"&&De(e))delete a.schema.examples,delete a.schema.default;if(t.io==="input"&&"_prefault"in a.schema)(n=a.schema).default??(n.default=a.schema._prefault);return delete a.schema._prefault,t.seen.get(e).schema}function Qg(e){return e.replace(/~/g,"~0").replace(/\\//g,"~1")}function _n(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let a of e.seen.entries()){let c=e.metadataRegistry.get(a[0])?.id;if(c){let l=n.get(c);if(l&&l!==a[0])throw Error(\`Duplicate schema id "\${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.\`);n.set(c,a[0])}}let i=(a)=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(a[0])?.id,h=e.external.uri??((_)=>_);if(f)return{ref:h(f)};let b=a[1].defId??a[1].schema.id??\`schema\${e.counter++}\`;return a[1].defId=b,{defId:b,ref:\`\${h("__shared")}#/\${c}/\${Qg(b)}\`}}let l="#",u=\`\${l}/\${c}/\`;if(a[1]===r&&!a[1].schema.id)return{ref:l};let m=a[1].schema.id??\`__schema\${e.counter++}\`;return{defId:m,ref:u+Qg(m)}},o=(a)=>{if(a[1].schema.$ref)return;let c=a[1],{ref:l,defId:u}=i(a);if(c.def={...c.schema},u)c.defId=u;let m=c.schema;for(let f in m)delete m[f];m.$ref=l};if(e.cycles==="throw")for(let a of e.seen.entries()){let c=a[1];if(c.cycle)throw Error(\`Cycle detected: #/\${c.cycle?.join("/")}/<root>
4027
+
4028
+ Set the \\\`cycles\\\` parameter to \\\`"ref"\\\` to resolve cyclical schemas with defs.\`)}for(let a of e.seen.entries()){let c=a[1];if(t===a[0]){o(a);continue}if(e.external){let u=e.external.registry.get(a[0])?.id;if(t!==a[0]&&u){o(a);continue}}if(e.metadataRegistry.get(a[0])?.id){o(a);continue}if(c.cycle){o(a);continue}if(c.count>1){if(e.reused==="ref")o(a)}}if(e.external)e.sharedDefsExtractedFor=e.external}function rv(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!=="object")return;rv(n);let i=Object.keys(n);if(i.length!==1||i[0]!=="type")return;let o=n.type;for(let a of Array.isArray(o)?o:[o]){if(typeof a!=="string")return;if(!r.includes(a))r.push(a)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var nv=new Set(["type","properties","required","additionalProperties"]),ev=["oneOf","anyOf"];function tv(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function yd(e){let t=[];for(let o of e){if(typeof o!=="object"||o.type!=="object")return null;for(let a in o)if(!nv.has(a))return null;t.push(o)}let r={},n=new Set;for(let o of t){for(let a in o.properties){if(Object.prototype.hasOwnProperty.call(r,a))continue;let c=[];for(let u of t){let m=u.properties?.[a]??tv(u);if(m===null||m===void 0)continue;if(!c.some((f)=>JSON.stringify(f)===JSON.stringify(m)))c.push(m)}let l=c.length===1?c[0]:yd(c)??{allOf:c};Ze(r,a,l)}for(let a of o.required??[])n.add(a)}let i={type:"object",properties:r};if(n.size)i.required=[...n];if(t.every((o)=>o.additionalProperties===!1))i.additionalProperties=!1;else{let o=[];for(let a of t){let c=tv(a);if(c&&!o.some((l)=>JSON.stringify(l)===JSON.stringify(c)))o.push(c)}if(o.length===1)i.additionalProperties=o[0];else if(o.length>1)i.additionalProperties={allOf:o}}return i}function py(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let i of nv)if(i in e)return;let r=t.filter((i)=>ev.some((o)=>Array.isArray(i[o]))),n=null;if(!r.length)n=yd(t);else{let i=r[0],o=ev.find((l)=>Array.isArray(i[l]));if(Object.keys(i).length!==1)return;let a=t.filter((l)=>l!==i),c=i[o].map((l)=>yd([...a,l]));if(c.some((l)=>!l))return;n={[o]:c}}if(!n)return;delete e.allOf,io(e,n)}function Sn(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(c)=>{let l=e.seen.get(c);if(l.ref===null)return;let u=l.def??l.schema,m={...u},f=l.ref;if(l.ref=null,f){n(f);let b=e.seen.get(f),_=b.schema;if(_.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))u.allOf=u.allOf??[],u.allOf.push(_);else io(u,_);if(io(u,m),c._zod.parent===f)for(let w in u){if(w==="$ref"||w==="allOf")continue;if(!(w in m))delete u[w]}if(_.$ref&&b.def)for(let w in u){if(w==="$ref"||w==="allOf")continue;if(w in b.def&&JSON.stringify(u[w])===JSON.stringify(b.def[w]))delete u[w]}}let h=c._zod.parent;if(h&&h!==f){n(h);let b=e.seen.get(h);if(b?.schema.$ref){if(u.$ref=b.schema.$ref,b.def)for(let _ in u){if(_==="$ref"||_==="allOf")continue;if(_ in b.def&&JSON.stringify(u[_])===JSON.stringify(b.def[_]))delete u[_]}}}e.override({zodSchema:c,jsonSchema:u,path:l.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())n(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())rv(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let l of e.seen.values())for(let u of[l.schema,l.def]){let m=u?.allOf;if(!Array.isArray(m))continue;let f=c.get(m);if(f)f.push(u);else c.set(m,[u])}for(let l of e.intersections)for(let u of c.get(l)??[])py(u)}}let i={};if(e.target==="draft-2020-12")i.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")i.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")i.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw Error("Schema is missing an \`id\` property");i.$id=e.external.uri(c)}io(i,r.defId?r.schema:r.def??r.schema);let o=e.metadataRegistry.get(t)?.id;if(o!==void 0&&i.id===o)delete i.id;let a=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let l=c[1];if(l.def&&l.defId){if(l.def.id===l.defId)delete l.def.id;Ze(a,l.defId,l.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(a).length>0)if(e.target==="draft-2020-12")i.$defs=a;else i.definitions=a;try{let c=JSON.parse(JSON.stringify(i));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:oo(t,"input",e.processors),output:oo(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch(c){throw Error("Error converting schema to JSON.")}}function De(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return De(n.element,r);if(n.type==="set")return De(n.valueType,r);if(n.type==="lazy")return De(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return De(n.innerType,r);if(n.type==="intersection")return De(n.left,r)||De(n.right,r);if(n.type==="record"||n.type==="map")return De(n.keyType,r)||De(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return De(n.in,r)||De(n.out,r)}if(n.type==="object"){for(let i in n.shape)if(De(n.shape[i],r))return!0;return!1}if(n.type==="union"){for(let i of n.options)if(De(i,r))return!0;return!1}if(n.type==="tuple"){for(let i of n.items)if(De(i,r))return!0;if(n.rest&&De(n.rest,r))return!0;return!1}return!1}var iv=(e,t={})=>(r)=>{let n=bn({...r,processors:t});return re(e,n),_n(n,e),Sn(n,e)},oo=(e,t,r={})=>(n)=>{let{libraryOptions:i,target:o}=n??{},a=bn({...i??{},target:o,io:t,processors:r});return re(e,a),_n(a,e),Sn(a,e)};var yn=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},$n=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},ov=(e,t)=>{yn(e,"minimum",t),$n(e,"maximum",t)},lv=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},uv=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},dv=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},mv=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},av=(e,t)=>yn(e,"minimum",t.minimum),sv=(e,t)=>$n(e,"maximum",t.maximum),cv=(e)=>(t,r)=>{mv(t,r.format);let[n,i]=e[r.format];yn(t,"minimum",n),$n(t,"maximum",i)},fy={greater_than:(e,t)=>yn(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>$n(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>lv(e,t.value),number_format:cv(Ms),bigint_format:cv(Ls),min_length:av,max_length:sv,length_equals:(e,t)=>ov(e,t.length),min_size:av,max_size:sv,size_equals:(e,t)=>ov(e,t.size),string_format:(e,t)=>{if(mv(e,t.format),t.pattern)uv(e,t.pattern);if(t.format==="base64"||t.format==="base64url")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>dv(e,t.mime)};function ye(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let o of n)fy[o._zod.def.check]?.(t,o._zod.def);let i=e._zod.bag;if(i.minimum!==void 0)yn(t,"minimum",i.minimum);if(i.exclusiveMinimum!==void 0)yn(t,"exclusiveMinimum",i.exclusiveMinimum);if(i.maximum!==void 0)$n(t,"maximum",i.maximum);if(i.exclusiveMaximum!==void 0)$n(t,"exclusiveMaximum",i.exclusiveMaximum);if(i.multipleOf!==void 0)lv(t,i.multipleOf);if(i.format!==void 0){if(t.format??(t.format=i.format),i.format.includes("int"))t.isInt=!0}if(i.mime)dv(t,i.mime);for(let o of i.patterns??[])uv(t,o);return t}var hy={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},gy=new Map([[Zu,gu],[oc,vu]]),pv=(e)=>gy.get(e)??e,kd=(e,t,r,n)=>{let i=r;i.type="string";let{minimum:o,maximum:a,format:c,patterns:l,contentEncoding:u,laxFormat:m}=ye(e);if(typeof o==="number")i.minLength=o;if(typeof a==="number")i.maxLength=a;if(c){if(i.format=hy[c]??c,i.format==="")delete i.format;if(c==="time"||m)delete i.format}if(u)i.contentEncoding=u;if(l&&l.size>0){let f=[...l].map(pv);if(f.length===1)i.pattern=f[0].source;else if(f.length>1)i.allOf=[...f.map((h)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))]}},xd=(e,t,r,n)=>{let i=r,{minimum:o,maximum:a,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u,isInt:m}=ye(e);i.type=m?"integer":"number";let f=typeof u==="number"&&u>=(o??Number.NEGATIVE_INFINITY),h=typeof l==="number"&&l<=(a??Number.POSITIVE_INFINITY),b=t.target==="draft-04"||t.target==="openapi-3.0";if(f)if(b)i.minimum=u,i.exclusiveMinimum=!0;else i.exclusiveMinimum=u;else if(typeof o==="number")i.minimum=o;if(h)if(b)i.maximum=l,i.exclusiveMaximum=!0;else i.exclusiveMaximum=l;else if(typeof a==="number")i.maximum=a;if(c){let _=new Set;for(let C of c)if(Number.isFinite(C)&&C!==0)_.add(Math.abs(C));else ze(e,t,i,n,\`A multipleOf divisor of \${C} cannot be represented in JSON Schema\`);let[S,...w]=_;if(S!==void 0)i.multipleOf=S;if(w.length)i.allOf=[...i.allOf??[],...w.map((C)=>({multipleOf:C}))]}},Id=(e,t,r,n)=>{r.type="boolean"},Rd=(e,t,r,n)=>{ze(e,t,r,n,"BigInt cannot be represented in JSON Schema")},Pd=(e,t,r,n)=>{ze(e,t,r,n,"Symbols cannot be represented in JSON Schema")},Td=(e,t,r,n)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"},Ed=(e,t,r,n)=>{ze(e,t,r,n,"Undefined cannot be represented in JSON Schema")},Cd=(e,t,r,n)=>{ze(e,t,r,n,"Void cannot be represented in JSON Schema")},Od=(e,t,r,n)=>{r.not={}},Nd=(e,t,r,n)=>{},jd=(e,t,r,n)=>{},Ad=(e,t,r,n)=>{ze(e,t,r,n,"Date cannot be represented in JSON Schema")},Ud=(e,t,r,n)=>{let i=e._zod.def,o=Li(i.entries);if(o.length===0){r.not={};return}if(o.every((a)=>typeof a==="number"))r.type="number";if(o.every((a)=>typeof a==="string"))r.type="string";r.enum=o},Dd=(e,t,r,n)=>{let i=e._zod.def;if(i.values.length===0){r.not={};return}let o=[];for(let a of i.values)if(a===void 0){if(ze(e,t,r,n,"Literal \`undefined\` cannot be represented in JSON Schema"))return}else if(typeof a==="bigint"){if(ze(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;o.push(Number(a))}else o.push(a);if(o.length===0);else if(o.length===1){let a=o[0];if(r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[a];else r.const=a}else{if(o.every((a)=>typeof a==="number"))r.type="number";if(o.every((a)=>typeof a==="string"))r.type="string";if(o.every((a)=>typeof a==="boolean"))r.type="boolean";if(o.every((a)=>a===null))r.type="null";r.enum=o}},Md=(e,t,r,n)=>{ze(e,t,r,n,"NaN cannot be represented in JSON Schema")},Ld=(e,t,r,n)=>{let i=r,o=e._zod.pattern;if(!o)throw Error("Pattern not found in template literal");i.type="string",i.pattern=o.source},qd=(e,t,r,n)=>{let i=r;i.type="string",i.format="binary",i.contentEncoding="binary";let{minimum:o,maximum:a,mime:c}=ye(e);if(o!==void 0)i.minLength=o;if(a!==void 0)i.maxLength=a;if(!c)return;if(c.length===0)i.not={};else if(c.length===1)i.contentMediaType=c[0];else i.anyOf=c.map((l)=>({contentMediaType:l}))},Vd=(e,t,r,n)=>{r.type="boolean"},Zd=(e,t,r,n)=>{ze(e,t,r,n,"Custom types cannot be represented in JSON Schema")},Fd=(e,t,r,n)=>{ze(e,t,r,n,"Function types cannot be represented in JSON Schema")},Jd=(e,t,r,n)=>{ze(e,t,r,n,"Transforms cannot be represented in JSON Schema")},Hd=(e,t,r,n)=>{ze(e,t,r,n,"Map cannot be represented in JSON Schema")},Bd=(e,t,r,n)=>{ze(e,t,r,n,"Set cannot be represented in JSON Schema")},Wd=(e,t,r,n)=>{let i=r,o=e._zod.def,{minimum:a,maximum:c}=ye(e);if(typeof a==="number")i.minItems=a;if(typeof c==="number")i.maxItems=c;i.type="array",i.items=re(o.element,t,{...n,path:[...n.path,"items"]})};function ao(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return ao(t.out);if(t.type==="catch")return ao(t.innerType);return e._zod.optin}var Kd=(e,t,r,n)=>{let i=r,o=e._zod.def,a=o.shape;if(Object.getOwnPropertySymbols(a).length&&ze(e,t,i,n,"Symbol keys cannot be represented in JSON Schema"))return;i.type="object",i.properties={};for(let u in a)Ze(i.properties,u,re(a[u],t,{...n,path:[...n.path,"properties",u]}));let l=[];for(let u of Object.keys(a)){let m=o.shape[u];if(t.io==="input"?ao(m)===void 0:m._zod.optout===void 0)l.push(u)}if(l.length>0)i.required=l;if(o.catchall?._zod.def.type==="never")i.additionalProperties=!1;else if(!o.catchall){if(t.io==="output")i.additionalProperties=!1}else if(o.catchall)i.additionalProperties=re(o.catchall,t,{...n,path:[...n.path,"additionalProperties"]})},Cc=(e,t,r,n)=>{let i=e._zod.def,o=i.inclusive===!1,a=i.options.map((c,l)=>re(c,t,{...n,path:[...n.path,o?"oneOf":"anyOf",l]}));if(o)r.oneOf=a;else r.anyOf=a},Gd=(e,t,r,n)=>{let i=e._zod.def,o=re(i.left,t,{...n,path:[...n.path,"allOf",0]}),a=re(i.right,t,{...n,path:[...n.path,"allOf",1]}),c=(u)=>("allOf"in u)&&Object.keys(u).length===1,l=[...c(o)?o.allOf:[o],...c(a)?a.allOf:[a]];r.allOf=l,t.intersections.push(l)},Yd=(e,t,r,n)=>{let i=r,o=e._zod.def;i.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",l=o.items.map((S,w)=>re(S,t,{...n,path:[...n.path,a,w]})),u=o.rest?re(o.rest,t,{...n,path:[...n.path,c,...t.target==="openapi-3.0"?[o.items.length]:[]]}):null,m=o.items.length;while(m>0){let S=o.items[m-1];if(!(t.io==="input"?ao(S)!==void 0:S._zod.optout==="optional"))break;m--}let f=o.items.length,h=!o.rest;if(t.target==="draft-2020-12"){if(i.prefixItems=l,h)i.items=!1;else if(u)i.items=u;if(m>0)i.minItems=m;if(h)i.maxItems=f}else if(t.target==="openapi-3.0"){if(i.items={anyOf:l},u)i.items.anyOf.push(u);if(m>0)i.minItems=m;if(h)i.maxItems=f}else{if(i.items=l,h)i.additionalItems=!1;else if(u)i.additionalItems=u;if(m>0)i.minItems=m;if(h)i.maxItems=f}let{minimum:b,maximum:_}=ye(e);if(typeof b==="number")i.minItems=b;if(typeof _==="number")i.maxItems=_};function $d(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let _=e.get(t)?.def;if(!_)return t;let S=$d(e,_,r);return S===_?t:S}for(let _ of["anyOf","oneOf"]){let S=t[_];if(!Array.isArray(S))continue;let w=S.map((C)=>$d(e,C,r));if(w.some((C,F)=>C!==S[F]))t={...t,[_]:w}}let n=Array.isArray(t.type)?t.type:[t.type],i=!n.includes("string")&&n.some((_)=>_==="number"||_==="integer"),o=t.enum??(t.const!==void 0?[t.const]:void 0);if(!i&&!o?.some((_)=>typeof _==="number"))return t;let{minimum:a,maximum:c,exclusiveMinimum:l,exclusiveMaximum:u,multipleOf:m,format:f,id:h,...b}=t;if(b.enum)b.enum=b.enum.map((_)=>typeof _==="number"?String(_):_);else if(typeof b.const==="number")b.const=String(b.const);if(!i)return b;if(b.type="string",!o)b.pattern=(n.includes("number")?Gt:Ki).source;return b}var zd=new WeakMap;function vy(e){let t=new Map;for(let n of e.seen.values())if(n.def&&!t.has(n.schema))t.set(n.schema,n);let r=new Map;for(let n of zd.get(e)??[]){let i=e.seen.get(n),o=(i?.def??i?.schema)?.propertyNames;if(!o||o===!0||r.has(o))continue;let a=$d(t,o,new Set);if(a!==o)r.set(o,a)}if(!r.size)return;for(let n of e.seen.values())for(let i of[n.schema,n.def]){let o=i&&r.get(i.propertyNames);if(o)i.propertyNames=o}}var Xd=(e,t,r,n)=>{let i=r,o=e._zod.def;i.type="object";let a=o.keyType,c=ye(a).patterns;if(o.mode==="loose"&&c&&c.size>0){let m=re(o.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});i.patternProperties={};for(let f of c)Ze(i.patternProperties,pv(f).source,m)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){i.propertyNames=re(o.keyType,t,{...n,path:[...n.path,"propertyNames"]});let m=zd.get(t);if(!m)m=[],zd.set(t,m),t.deferred.push(()=>vy(t));m.push(e)}i.additionalProperties=re(o.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let l=a._zod.values,u=t.io==="input"&&ao(o.valueType)!==void 0;if(l&&!o.partial&&!u){let m=[...l].filter((f)=>typeof f==="string"||typeof f==="number");if(m.length>0)i.required=m.map(String)}},Qd=(e,t,r,n)=>{let i=e._zod.def,o=re(i.innerType,t,n),a=t.seen.get(e);if(t.target==="openapi-3.0")a.ref=i.innerType,r.nullable=!0;else r.anyOf=[o,{type:"null"}]},em=(e,t,r,n)=>{let i=e._zod.def;re(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType},tm=Symbol();function fv(e,t,r,n,i){let o=!1,a=JSON.stringify(e,(c,l)=>{if(typeof l!=="bigint")return l;return o=!0,null});if(!o)return JSON.parse(a);return ze(t,r,n,i,"BigInt defaults cannot be represented in JSON Schema"),tm}var rm=(e,t,r,n)=>{let i=e._zod.def;re(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType;let a=fv(i.defaultValue,e,t,r,n);if(a!==tm)r.default=a},nm=(e,t,r,n)=>{let i=e._zod.def;re(i.innerType,t,n);let o=t.seen.get(e);if(o.ref=i.innerType,t.io!=="input")return;let a=fv(i.defaultValue,e,t,r,n);if(a!==tm)r._prefault=a},im=(e,t,r,n)=>{let i=e._zod.def;re(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType;let a;try{a=i.catchValue(void 0)}catch{ze(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=a},om=(e,t,r,n)=>{let i=e._zod.def,o=i.in._zod.traits.has("$ZodTransform"),a=t.io==="input"?o?i.out:i.in:i.out;re(a,t,n);let c=t.seen.get(e);c.ref=a},am=(e,t,r,n)=>{let i=e._zod.def;re(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType,r.readOnly=!0},sm=(e,t,r,n)=>{let i=e._zod.def;re(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType},Oc=(e,t,r,n)=>{let i=e._zod.def;re(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType},cm=(e,t,r,n)=>{let i=e._zod.innerType;re(i,t,n);let o=t.seen.get(e);o.ref=i},wd={string:kd,number:xd,boolean:Id,bigint:Rd,symbol:Pd,null:Td,undefined:Ed,void:Cd,never:Od,any:Nd,unknown:jd,date:Ad,enum:Ud,literal:Dd,nan:Md,template_literal:Ld,file:qd,success:Vd,custom:Zd,function:Fd,transform:Jd,map:Hd,set:Bd,array:Wd,object:Kd,union:Cc,intersection:Gd,tuple:Yd,record:Xd,nullable:Qd,nonoptional:em,default:rm,prefault:nm,catch:im,pipe:om,readonly:am,promise:sm,optional:Oc,lazy:cm};function so(e,t){if("_idmap"in e){let n=e,i=bn({...t,processors:wd}),o={};for(let l of n._idmap.entries()){let[u,m]=l;re(m,i)}let a={},c={registry:n,uri:t?.uri,defs:o};i.external=c;for(let l of n._idmap.entries()){let[u,m]=l;_n(i,m),Ze(a,u,Sn(i,m))}if(Object.keys(o).length>0){let l=i.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[l]:o}}return{schemas:a}}let r=bn({...t,processors:wd});return re(e,r),_n(r,e),Sn(r,e)}var hv=new WeakSet([Object.prototype,Error.prototype]);function jc(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var Sy=(e,t)=>{Zp.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(hv.has(r))return;hv.add(r),jc(r,"format",(n)=>(i)=>Wl(n,i)),jc(r,"flatten",(n)=>(i)=>Bl(n,i)),jc(r,"addIssue",(n)=>(i)=>{n.issues.push(i),n.message=JSON.stringify(n.issues,qi,2)}),jc(r,"addIssues",(n)=>(i)=>{n.issues.push(...i),n.message=JSON.stringify(n.issues,qi,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var Qe=g("ZodError",Sy,void 0,{Parent:Error});var gv=Hi(Qe),vv=Bi(Qe),Ac=Hs(Qe),bv=Bs(Qe),_v=Jp(Qe),Sv=Hp(Qe),yv=Bp(Qe),$v=Wp(Qe),zv=Kp(Qe),wv=Gp(Qe),kv=Yp(Qe),xv=Xp(Qe);function $y(){if(!Ie.localeError)ge(pc())}function Ir(){if(!Ie.memoizer)ge({memoizer:Xu()})}var W=g("ZodType",(e,t)=>($y(),J.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(Fe(t,{checks:[...t.checks??[],...e.map((r)=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Je(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(mb(e,t))},superRefine(e,t){return this.check(pb(e,t))},overwrite(e){return this.check(Ot(e))},optional(){return N(this)},exactOptional(){return Wv(this)},nullable(){return Uc(this)},nullish(){return N(Uc(this))},nonoptional(e){return eb(this,e)},array(){return v(this)},or(e){return P([this,e])},and(e){return _t(this,e)},transform(e){return um(this,Cm(e))},default(e){return Yv(this,e)},prefault(e){return Qv(this,e)},catch(e){return nb(this,e)},pipe(e){return um(this,e)},readonly(){return sb(this)},describe(e){let t=this.clone();return Be.add(t,{description:e}),t},meta(...e){if(e.length===0)return Be.get(this);let t=this.clone();return Be.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get "~standard"(){return Ji(this,"~standard",{...Lu(this),jsonSchema:{input:oo(this,"input"),output:oo(this,"output")}})},set "~standard"(e){Et(this,"~standard",e)},parse:function e(t,r){return gv(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await vv(this,t,r,{callee:e})},safeParse(e,t){return Ac(this,e,t)},async safeParseAsync(e,t){return bv(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Et(this,"spa",e)},validate(e,t){return Yl(this,e,t)},validateAsync(e,t){return Xl(this,e,t)},encode:function e(t,r){return _v(this,t,r,{callee:e})},decode:function e(t,r){return Sv(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await yv(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await $v(this,t,r,{callee:e})},safeEncode(e,t){return zv(this,e,t)},safeDecode(e,t){return wv(this,e,t)},async safeEncodeAsync(e,t){return kv(this,e,t)},async safeDecodeAsync(e,t){return xv(this,e,t)},toJSONSchema(e){return iv(this,{})(e)},get description(){return Be.get(this)?.description},get _def(){return this._zod.def}}),dm=g("_ZodString",(e,t)=>{fn.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>kd(e,r,n,i)},Fs({format:(e)=>ye(e).format??null,minLength:(e)=>ye(e).minimum??null,maxLength:(e)=>ye(e).maximum??null},{regex(...e){return this.check(_c(...e))},includes(...e){return this.check($c(...e))},startsWith(...e){return this.check(zc(...e))},endsWith(...e){return this.check(wc(...e))},min(...e){return this.check(kr(...e))},max(...e){return this.check(ro(...e))},length(...e){return this.check(no(...e))},nonempty(...e){return this.check(kr(1,...e))},lowercase(e){return this.check(Sc(e))},uppercase(e){return this.check(yc(e))},trim(){return this.check(Rc())},normalize(...e){return this.check(Ic(...e))},toLowerCase(){return this.check(Pc())},toUpperCase(){return this.check(Tc())},slugify(){return this.check(Ec())}})),Dc=g("ZodString",(e,t)=>{fn.init(e,t),dm.init(e,t)},{email(e){return this.check(ed(mm,e))},url(e){return this.check(fc(Mc,e))},jwt(e){return this.check(Sd(Pm,e))},emoji(e){return this.check(ad(hm,e))},guid(e){return this.check(td(fm,e))},uuid(e){return this.check(rd(Nt,e))},uuidv4(e){return this.check(nd(Nt,e))},uuidv6(e){return this.check(id(Nt,e))},uuidv7(e){return this.check(od(Nt,e))},nanoid(e){return this.check(sd(gm,e))},cuid(e){return this.check(cd(vm,e))},cuid2(e){return this.check(ld(bm,e))},ulid(e){return this.check(ud(_m,e))},base64(e){return this.check(vd(xm,e))},base64url(e){return this.check(bd(Im,e))},xid(e){return this.check(dd(Sm,e))},ksuid(e){return this.check(md(ym,e))},ipv4(e){return this.check(pd($m,e))},ipv6(e){return this.check(fd(zm,e))},cidrv4(e){return this.check(hd(wm,e))},cidrv6(e){return this.check(gd(km,e))},e164(e){return this.check(_d(Rm,e))},datetime(e){return this.check(hc(Rr,e))},date(e){return this.check(gc(Pr,e))},time(e){return this.check(vc(Tr,e))},duration(e){return this.check(bc(Er,e))}});function s(e){return gg(Dc,e)}var ne=g("ZodStringFormat",(e,t)=>{te.init(e,t),dm.init(e,t)}),Rr=g("ZodISODateTime",(e,t)=>{th.init(e,t),ne.init(e,t)}),Pr=g("ZodISODate",(e,t)=>{rh.init(e,t),ne.init(e,t)}),Tr=g("ZodISOTime",(e,t)=>{nh.init(e,t),ne.init(e,t)}),Er=g("ZodISODuration",(e,t)=>{ih.init(e,t),ne.init(e,t)}),mm=g("ZodEmail",(e,t)=>{qf.init(e,t),ne.init(e,t)});function pm(e){return ed(mm,e)}var fm=g("ZodGUID",(e,t)=>{Mf.init(e,t),ne.init(e,t)});function zy(e){return td(fm,e)}var Nt=g("ZodUUID",(e,t)=>{Lf.init(e,t),ne.init(e,t)});function wy(e){return rd(Nt,e)}function ky(e){return nd(Nt,e)}function xy(e){return id(Nt,e)}function Iy(e){return od(Nt,e)}var Mc=g("ZodURL",(e,t)=>{Bf.init(e,t),ne.init(e,t)});function uo(e){return fc(Mc,e)}function Ry(e){return fc(Mc,{protocol:Wi,hostname:_u,...x(e)})}var hm=g("ZodEmoji",(e,t)=>{Wf.init(e,t),ne.init(e,t)});function Py(e){return ad(hm,e)}var gm=g("ZodNanoID",(e,t)=>{Kf.init(e,t),ne.init(e,t)});function Ty(e){return sd(gm,e)}var vm=g("ZodCUID",(e,t)=>{Gf.init(e,t),ne.init(e,t)});function Ey(e){return cd(vm,e)}var bm=g("ZodCUID2",(e,t)=>{Yf.init(e,t),ne.init(e,t)});function Cy(e){return ld(bm,e)}var _m=g("ZodULID",(e,t)=>{Xf.init(e,t),ne.init(e,t)});function Oy(e){return ud(_m,e)}var Sm=g("ZodXID",(e,t)=>{Qf.init(e,t),ne.init(e,t)});function Ny(e){return dd(Sm,e)}var ym=g("ZodKSUID",(e,t)=>{eh.init(e,t),ne.init(e,t)});function jy(e){return md(ym,e)}var $m=g("ZodIPv4",(e,t)=>{oh.init(e,t),ne.init(e,t)});function Ay(e){return pd($m,e)}var Iv=g("ZodMAC",(e,t)=>{sh.init(e,t),ne.init(e,t)});function Uy(e){return vg(Iv,e)}var zm=g("ZodIPv6",(e,t)=>{ah.init(e,t),ne.init(e,t)});function Dy(e){return fd(zm,e)}var wm=g("ZodCIDRv4",(e,t)=>{ch.init(e,t),ne.init(e,t)});function My(e){return hd(wm,e)}var km=g("ZodCIDRv6",(e,t)=>{uh.init(e,t),ne.init(e,t)});function Ly(e){return gd(km,e)}var xm=g("ZodBase64",(e,t)=>{dh.init(e,t),ne.init(e,t)});function qy(e){return vd(xm,e)}var Im=g("ZodBase64URL",(e,t)=>{ph.init(e,t),ne.init(e,t)});function Vy(e){return bd(Im,e)}var Rm=g("ZodE164",(e,t)=>{fh.init(e,t),ne.init(e,t)});function Zy(e){return _d(Rm,e)}var Rv=g("ZodCreditCard",(e,t)=>{gh.init(e,t),ne.init(e,t)});function Fy(e){return bg(Rv,e)}var Pv=g("ZodIBAN",(e,t)=>{bh.init(e,t),ne.init(e,t)});function Jy(e){return _g(Pv,e)}var Pm=g("ZodJWT",(e,t)=>{Sh.init(e,t),ne.init(e,t)});function Hy(e){return Sd(Pm,e)}var zn=g("ZodCustomStringFormat",(e,t)=>{yh.init(e,t),ne.init(e,t)});function By(e,t,r={}){return vn(zn,e,t,r)}function Wy(e){return vn(zn,"hostname",bu,e)}function Ky(e){return vn(zn,"hex",Ou,e)}function Gy(e){return vn(zn,"currency_code",yu,e)}function Yy(e,t){let r=t?.enc??"hex",n=\`\${e}_\${r}\`,i=bt[n];if(!i)throw Error(\`Unrecognized hash format: \${n}\`);return vn(zn,n,i,t)}var mo=g("ZodNumber",(e,t)=>{Fu.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>xd(e,r,n,i),e.isFinite=!0},Fs({minValue:(e)=>{let{minimum:t,exclusiveMinimum:r}=ye(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:r}=ye(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:r}=ye(e);return!!t||!!r?.some(Number.isSafeInteger)},format:(e)=>ye(e).format??null},{gt(e,t){return this.check(Xt(e,t))},gte(e,t){return this.check(mt(e,t))},min(e,t){return this.check(mt(e,t))},lt(e,t){return this.check(Yt(e,t))},lte(e,t){return this.check(dt(e,t))},max(e,t){return this.check(dt(e,t))},int(e){return this.check(lm(e))},safe(e){return this.check(lm(e))},positive(e){return this.check(Xt(0,e))},nonnegative(e){return this.check(mt(0,e))},negative(e){return this.check(Yt(0,e))},nonpositive(e){return this.check(dt(0,e))},multipleOf(e,t){return this.check(hn(e,t))},step(e,t){return this.check(hn(e,t))},finite(){return this}}));function y(e){return Sg(mo,e)}var wn=g("ZodNumberFormat",(e,t)=>{$h.init(e,t),mo.init(e,t)});function lm(e){return $g(wn,e)}function Xy(e){return zg(wn,e)}function Qy(e){return wg(wn,e)}function e$(e){return kg(wn,e)}function t$(e){return xg(wn,e)}var Lc=g("ZodBoolean",(e,t)=>{ac.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Id(e,r,n,i)});function T(e){return Ig(Lc,e)}var qc=g("ZodBigInt",(e,t)=>{Ju.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Rd(e,r,n,i)},Fs({minValue:(e)=>ye(e).minimum??null,maxValue:(e)=>ye(e).maximum??null,format:(e)=>ye(e).format??null},{gte(e,t){return this.check(mt(e,t))},min(e,t){return this.check(mt(e,t))},gt(e,t){return this.check(Xt(e,t))},lt(e,t){return this.check(Yt(e,t))},lte(e,t){return this.check(dt(e,t))},max(e,t){return this.check(dt(e,t))},positive(e){return this.check(Xt(BigInt(0),e))},negative(e){return this.check(Yt(BigInt(0),e))},nonpositive(e){return this.check(dt(BigInt(0),e))},nonnegative(e){return this.check(mt(BigInt(0),e))},multipleOf(e,t){return this.check(hn(e,t))}}));function r$(e){return Rg(qc,e)}var Tm=g("ZodBigIntFormat",(e,t)=>{zh.init(e,t),qc.init(e,t)});function n$(e){return Pg(Tm,e)}function i$(e){return Tg(Tm,e)}var Tv=g("ZodSymbol",(e,t)=>{wh.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Pd(e,r,n,i)});function o$(e){return Eg(Tv,e)}var Ev=g("ZodUndefined",(e,t)=>{kh.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Ed(e,r,n,i)});function Vc(e){return Cg(Ev,e)}var Cv=g("ZodNull",(e,t)=>{xh.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Td(e,r,n,i)});function jt(e){return Og(Cv,e)}var Ov=g("ZodAny",(e,t)=>{Ih.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Nd(e,r,n,i)});function po(){return Ng(Ov)}var Nv=g("ZodUnknown",(e,t)=>{Rh.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>jd(e,r,n,i)});function O(){return jg(Nv)}var jv=g("ZodNever",(e,t)=>{Ph.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Od(e,r,n,i)});function fo(e){return Ag(jv,e)}var Av=g("ZodVoid",(e,t)=>{Th.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Cd(e,r,n,i)});function a$(e){return Ug(Av,e)}var Em=g("ZodDate",(e,t)=>{Eh.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Ad(e,r,n,i),e.min=(r,n)=>e.check(mt(r,n)),e.max=(r,n)=>e.check(dt(r,n))},Fs({minDate:(e)=>{let{minimum:t}=ye(e);return t?new Date(t):null},maxDate:(e)=>{let{maximum:t}=ye(e);return t?new Date(t):null}},{}));function s$(e){return Dg(Em,e)}var Uv=g("ZodArray",(e,t)=>{Ir(),Ch.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Wd(e,r,n,i),e.element=t.element},{min(e,t){return this.check(kr(e,t))},nonempty(e){return this.check(kr(1,e))},max(e,t){return this.check(ro(e,t))},length(e,t){return this.check(no(e,t))},unwrap(){return this.element}});function v(e,t){return Jg(Uv,e,t)}function c$(e){let t=e._zod.def.shape;return Z(Object.keys(t))}var Zc=g("ZodObject",(e,t)=>{Ir(),jh.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Kd(e,r,n,i),pS(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return Z(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(Fe(this._zod.def,{catchall:e}))},passthrough(){return this.clone(Fe(this._zod.def,{catchall:O()}))},loose(){return this.clone(Fe(this._zod.def,{catchall:O()}))},strict(){return this.clone(Fe(this._zod.def,{catchall:fo()}))},strip(){return this.clone(Fe(this._zod.def,{catchall:void 0}))},extend(e){return oS(this,e)},safeExtend(e){return aS(this,e)},merge(e){return sS(this,e)},pick(e){return nS(this,e)},omit(e){return iS(this,e)},partial(...e){return Np(Jc,this,e[0])},exactPartial(...e){return Np(Om,this,e[0],"exactPartial")},required(...e){return cS(Nm,this,e[0])}});function d(e,t){let r={type:"object",shape:e??{},...x(t)};return new Zc(r)}function l$(e,t){return new Zc({type:"object",shape:e,catchall:fo(),...x(t)})}function q(e,t){return new Zc({type:"object",shape:e,catchall:O(),...x(t)})}var Fc=g("ZodUnion",(e,t)=>{sc.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Cc(e,r,n,i),e.options=t.options});function P(e,t){return new Fc({type:"union",options:e,...x(t)})}var Dv=g("ZodXor",(e,t)=>{Fc.init(e,t),Ah.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Cc(e,r,n,i),e.options=t.options});function u$(e,t){return new Dv({type:"union",options:e,inclusive:!1,...x(t)})}var Mv=g("ZodDiscriminatedUnion",(e,t)=>{Fc.init(e,t),Uh.init(e,t)});function At(e,t,r){return new Mv({type:"union",options:t,discriminator:e,...x(r)})}var Lv=g("ZodIntersection",(e,t)=>{Dh.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Gd(e,r,n,i)});function _t(e,t){return new Lv({type:"intersection",left:e,right:t})}var qv=g("ZodTuple",(e,t)=>{Ir(),Hu.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Yd(e,r,n,i)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map((t)=>new Jc({type:"optional",innerType:t}))})}});function Vv(e,t,r){let n=t instanceof J,i=n?r:t;return new qv({type:"tuple",items:e,rest:n?t:null,...x(i)})}var co=g("ZodRecord",(e,t)=>{Ir(),Mh.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Xd(e,r,n,i),e.keyType=t.keyType,e.valueType=t.valueType});function I(e,t,r){if(!t||!t._zod)return new co({type:"record",keyType:s(),valueType:e,...x(t)});return new co({type:"record",keyType:e,valueType:t,...x(r)})}function d$(e,t,r){return new co({type:"record",keyType:e,valueType:t,...x(r),partial:!0})}function m$(e,t,r){return new co({type:"record",keyType:e,valueType:t,mode:"loose",...x(r)})}var Zv=g("ZodMap",(e,t)=>{Ir(),Lh.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Hd(e,r,n,i),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(Qt(...r)),e.nonempty=(r)=>e.check(Qt(1,r)),e.max=(...r)=>e.check(gn(...r)),e.size=(...r)=>e.check(to(...r))});function p$(e,t,r){return new Zv({type:"map",keyType:e,valueType:t,...x(r)})}var Fv=g("ZodSet",(e,t)=>{Ir(),qh.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Bd(e,r,n,i),e.min=(...r)=>e.check(Qt(...r)),e.nonempty=(r)=>e.check(Qt(1,r)),e.max=(...r)=>e.check(gn(...r)),e.size=(...r)=>e.check(to(...r))});function f$(e,t){return new Fv({type:"set",valueType:e,...x(t)})}var lo=g("ZodEnum",(e,t)=>{Vh.init(e,t),W.init(e,t),e._zod.processJSONSchema=(n,i,o)=>Ud(e,n,i,o),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,i)=>{let o={};for(let a of n)if(r.has(a))o[a]=t.entries[a];else throw Error(\`Key \${a} not found in enum\`);return new lo({...t,checks:[],...x(i),entries:o})},e.exclude=(n,i)=>{let o={...t.entries};for(let a of n)if(r.has(a))delete o[a];else throw Error(\`Key \${a} not found in enum\`);return new lo({...t,checks:[],...x(i),entries:o})}});function Z(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new lo({type:"enum",entries:r,...x(t)})}function h$(e,t){return new lo({type:"enum",entries:e,...x(t)})}var Jv=g("ZodLiteral",(e,t)=>{Zh.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Dd(e,r,n,i),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use \`.values\` instead.");return t.values[0]}})});function p(e,t){return new Jv({type:"literal",values:Array.isArray(e)?e:[e],...x(t)})}var Hv=g("ZodFile",(e,t)=>{Fh.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>qd(e,r,n,i),e.min=(r,n)=>e.check(Qt(r,n)),e.max=(r,n)=>e.check(gn(r,n)),e.mime=(r,n)=>e.check(xc(Array.isArray(r)?r:[r],n))});function g$(e){return Hg(Hv,e)}var Bv=g("ZodTransform",(e,t)=>{Ir(),Jh.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Jd(e,r,n,i),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new pn(e.constructor.name);r.addIssue=(o)=>{if(typeof o==="string")r.issues.push(zr(o,r.value,t));else{let a=o;if(a.fatal)a.continue=!1;if(a.code??(a.code="custom"),!("input"in a))a.input=r.value;a.inst??(a.inst=e),r.issues.push(zr(a))}};let i=t.transform(r.value,r);if(i instanceof Promise)return i.then((o)=>(r.value=o,r));return r.value=i,r}});function Cm(e){return new Bv({type:"transform",transform:e})}var Jc=g("ZodOptional",(e,t)=>{Bu.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Oc(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function N(e){return new Jc({type:"optional",innerType:e})}var Om=g("ZodExactOptional",(e,t)=>{Hh.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Oc(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function Wv(e){return new Om({type:"optional",innerType:e})}var Kv=g("ZodNullable",(e,t)=>{Bh.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Qd(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function Uc(e){return new Kv({type:"nullable",innerType:e})}function v$(e){return N(Uc(e))}var Gv=g("ZodDefault",(e,t)=>{Wh.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>rm(e,r,n,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Yv(e,t){return new Gv({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Us(t)}})}var Xv=g("ZodPrefault",(e,t)=>{Kh.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>nm(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function Qv(e,t){return new Xv({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Us(t)}})}var Nm=g("ZodNonOptional",(e,t)=>{Gh.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>em(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function eb(e,t){return new Nm({type:"nonoptional",innerType:e,...x(t)})}var tb=g("ZodSuccess",(e,t)=>{Yh.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Vd(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function b$(e){return new tb({type:"success",innerType:e})}var rb=g("ZodCatch",(e,t)=>{Xh.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>im(e,r,n,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function nb(e,t){return new rb({type:"catch",innerType:e,catchValue:typeof t==="function"?t:Dp(t)})}var ib=g("ZodNaN",(e,t)=>{Qh.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Md(e,r,n,i)});function _$(e){return Mg(ib,e)}var Hc=g("ZodPipe",(e,t)=>{Wu.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>om(e,r,n,i),e.in=t.in,e.out=t.out});function um(e,t){return new Hc({type:"pipe",in:e,out:t})}var Bc=g("ZodCodec",(e,t)=>{Hc.init(e,t),cc.init(e,t)});function S$(e,t,r){return new Bc({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}function y$(e){let t=e._zod.def;return new Bc({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var ob=g("ZodPreprocess",(e,t)=>{Hc.init(e,t),eg.init(e,t)}),ab=g("ZodReadonly",(e,t)=>{tg.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>am(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function sb(e){return new ab({type:"readonly",innerType:e})}var cb=g("ZodTemplateLiteral",(e,t)=>{rg.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Ld(e,r,n,i)});function $$(e,t){return new cb({type:"template_literal",parts:e,...x(t)})}var lb=g("ZodLazy",(e,t)=>{Ku.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>cm(e,r,n,i),e.unwrap=()=>e._zod.def.getter()});function Cr(e){return new lb({type:"lazy",getter:e})}var ub=g("ZodPromise",(e,t)=>{ig.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>sm(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function z$(e){return new ub({type:"promise",innerType:e})}var db=g("ZodFunction",(e,t)=>{ng.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Fd(e,r,n,i)});function w$(e){return new db({type:"function",input:Array.isArray(e?.input)?Vv(e?.input):e?.input??v(O()),output:e?.output??O()})}var Wc=g("ZodCustom",(e,t)=>{og.init(e,t),W.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Zd(e,r,n,i)});function k$(e){let t=new ie({check:"custom"});return t._zod.check=e,t}function x$(e,t){return Bg(Wc,e??(()=>!0),t)}function mb(e,t={}){return Wg(Wc,e,t)}function pb(e,t){return Kg(e,t)}var I$=Gg,R$=Yg,fb=g("ZodInstanceOf",(e,t)=>{Wc.init(e,t)},{properties(e,t){return this.check(kc(e,t))}});function P$(e,t={}){let r=new fb({type:"custom",check:"custom",fn:(n)=>n instanceof e,abort:!0,...x(t)});return r._zod.bag.Class=e,r._zod.check=(n)=>{if(!(n.value instanceof e))n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}var T$=(...e)=>Xg({Codec:Bc,Boolean:Lc,String:Dc},...e);function E$(e){let t=Cr(()=>P([s(e),y(),T(),jt(),v(t),I(s(),t)]));return t}function er(e,t){return new ob({type:"pipe",in:Cm(e),out:t})}var gb={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"};var hb;(function(e){})(hb||(hb={}));function ho(e){return hc(Rr,e)}function vb(e){return gc(Pr,e)}function O$(e){return vc(Tr,e)}function N$(e){return bc(Er,e)}var OP={...kn,...Nc,iso:xn};var AP=Symbol("z.visit/resolving");function A$(e){return yg(mo,e)}var Gc="2025-11-25";var Yc=[Gc,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Xc="io.modelcontextprotocol/related-task",Or="io.modelcontextprotocol/protocolVersion",In="io.modelcontextprotocol/clientInfo",rr="io.modelcontextprotocol/serverInfo",Nr="io.modelcontextprotocol/clientCapabilities",Qc="io.modelcontextprotocol/subscriptionId",Rn="io.modelcontextprotocol/logLevel";var jr="2.0";var Ut=Cr(()=>P([s(),y(),T(),jt(),I(s(),Ut),v(Ut)])),ue=I(s(),Ut),el=v(Ut),Pn=P([s(),y().int()]),Tn=s(),go=d({ttl:y().optional()}),vo=d({taskId:s()}),En=q({progressToken:Pn.optional(),[Xc]:vo.optional()}),ke=d({_meta:En.optional()}),nr=ke.extend({task:go.optional()}),de=d({method:s(),params:ke.loose().optional()}),je=d({_meta:En.optional()}),Re=d({method:s(),params:je.loose().optional()}),Cn=q({get[rr](){return yt.optional().catch(void 0)}}),me=q({_meta:Cn.optional()}),pt=P([s(),y().int()]),On=d({jsonrpc:p(jr),id:pt,...de.shape}).strict(),Nn=d({jsonrpc:p(jr),...Re.shape}).strict(),Ar=d({jsonrpc:p(jr),id:pt,result:me}).strict(),Ur=d({jsonrpc:p(jr),id:pt.optional(),error:d({code:y().int(),message:s(),data:O().optional()})}).strict(),Dr=P([On,Nn,Ar,Ur]),tl=P([Ar,Ur]),ir=me.strict(),bo=je.extend({requestId:pt.optional(),reason:s().optional()}),jn=Re.extend({method:p("notifications/cancelled"),params:bo}),_o=d({src:s(),mimeType:s().optional(),sizes:v(s()).optional(),theme:Z(["light","dark"]).optional()}),Dt=d({icons:v(_o).optional()}),St=d({name:s(),title:s().optional()}),yt=St.extend({...St.shape,...Dt.shape,version:s(),websiteUrl:s().optional(),description:s().optional()}),U$=_t(d({applyDefaults:T().optional()}),ue),D$=er((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)&&Object.keys(e).length===0)return{form:{}};return e},_t(d({form:U$.optional(),url:ue.optional()}),ue.optional())),rl=q({list:ue.optional(),cancel:ue.optional(),requests:q({sampling:q({createMessage:ue.optional()}).optional(),elicitation:q({create:ue.optional()}).optional()}).optional()}),nl=q({list:ue.optional(),cancel:ue.optional(),requests:q({tools:q({call:ue.optional()}).optional()}).optional()}),So=d({experimental:I(s(),ue).optional(),sampling:d({context:ue.optional(),tools:ue.optional()}).optional(),elicitation:D$.optional(),roots:d({listChanged:T().optional()}).optional(),tasks:rl.optional(),extensions:I(s(),ue).optional()}),yo=ke.extend({protocolVersion:s(),capabilities:So,clientInfo:yt}),$o=de.extend({method:p("initialize"),params:yo}),An=d({experimental:I(s(),ue).optional(),logging:ue.optional(),completions:ue.optional(),prompts:d({listChanged:T().optional()}).optional(),resources:d({subscribe:T().optional(),listChanged:T().optional()}).optional(),tools:d({listChanged:T().optional()}).optional(),tasks:nl.optional(),extensions:I(s(),ue).optional()}),zo=me.extend({protocolVersion:s(),capabilities:An,serverInfo:yt,instructions:s().optional()}),wo=Re.extend({method:p("notifications/initialized"),params:je.optional()}),ko=de.extend({method:p("server/discover"),params:ke.optional()}),Un=me.extend({supportedVersions:v(s()),capabilities:An,instructions:s().optional()}),Dn=de.extend({method:p("ping"),params:ke.optional()}),xo=d({progress:y(),total:N(y()),message:N(s())}),Io=d({...je.shape,...xo.shape,progressToken:Pn}),Mn=Re.extend({method:p("notifications/progress"),params:Io}),Ro=ke.extend({cursor:Tn.optional()}),Mt=de.extend({params:Ro.optional()}),Lt=me.extend({nextCursor:Tn.optional()}),Ln=d({uri:s(),mimeType:N(s()),_meta:I(s(),O()).optional()}),qn=Ln.extend({text:s()}),Um=s().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Vn=Ln.extend({blob:Um}),qt=Z(["user","assistant"]),$t=d({audience:v(qt).optional(),priority:y().min(0).max(1).optional(),lastModified:ho({offset:!0}).optional()}),Zn=d({...St.shape,...Dt.shape,uri:s(),description:N(s()),mimeType:N(s()),size:N(y()),annotations:$t.optional(),_meta:N(q({}))}),Po=d({...St.shape,...Dt.shape,uriTemplate:s(),description:N(s()),mimeType:N(s()),annotations:$t.optional(),_meta:N(q({}))}),To=Mt.extend({method:p("resources/list")}),Eo=Lt.extend({resources:v(Zn)}),Co=Mt.extend({method:p("resources/templates/list")}),Oo=Lt.extend({resourceTemplates:v(Po)}),Mr=ke.extend({uri:s()}),No=Mr,jo=de.extend({method:p("resources/read"),params:No}),Ao=me.extend({contents:v(P([qn,Vn]))}),Uo=Re.extend({method:p("notifications/resources/list_changed"),params:je.optional()}),Do=Mr,Mo=de.extend({method:p("resources/subscribe"),params:Do}),Lo=Mr,qo=de.extend({method:p("resources/unsubscribe"),params:Lo}),Fn=d({toolsListChanged:T().optional(),promptsListChanged:T().optional(),resourcesListChanged:T().optional(),resourceSubscriptions:v(s()).optional()}),Vo=ke.extend({notifications:Fn}),Zo=de.extend({method:p("subscriptions/listen"),params:Vo}),Fo=je.extend({notifications:Fn}),Jo=Re.extend({method:p("notifications/subscriptions/acknowledged"),params:Fo}),Ho=Cn.extend({[Qc]:pt}),Bo=me.extend({_meta:Ho}),Wo=je.extend({uri:s()}),Ko=Re.extend({method:p("notifications/resources/updated"),params:Wo}),Go=d({name:s(),description:N(s()),required:N(T())}),Yo=d({...St.shape,...Dt.shape,description:N(s()),arguments:N(v(Go)),_meta:N(q({}))}),Xo=Mt.extend({method:p("prompts/list")}),Qo=Lt.extend({prompts:v(Yo)}),ea=ke.extend({name:s(),arguments:I(s(),s()).optional()}),ta=de.extend({method:p("prompts/get"),params:ea}),Lr=d({type:p("text"),text:s(),annotations:$t.optional(),_meta:I(s(),O()).optional()}),qr=d({type:p("image"),data:Um,mimeType:s(),annotations:$t.optional(),_meta:I(s(),O()).optional()}),Vr=d({type:p("audio"),data:Um,mimeType:s(),annotations:$t.optional(),_meta:I(s(),O()).optional()}),ra=d({type:p("tool_use"),name:s(),id:s(),input:I(s(),O()),_meta:I(s(),O()).optional()}),Zr=d({type:p("resource"),resource:P([qn,Vn]),annotations:$t.optional(),_meta:I(s(),O()).optional()}),Fr=Zn.extend({type:p("resource_link")}),zt=P([Lr,qr,Vr,Fr,Zr]),na=d({role:qt,content:zt}),ia=me.extend({description:s().optional(),messages:v(na)}),oa=Re.extend({method:p("notifications/prompts/list_changed"),params:je.optional()}),aa=d({title:s().optional(),readOnlyHint:T().optional(),destructiveHint:T().optional(),idempotentHint:T().optional(),openWorldHint:T().optional()}),sa=d({taskSupport:Z(["required","optional","forbidden"]).optional()}),or=d({...St.shape,...Dt.shape,description:s().optional(),inputSchema:d({type:p("object"),properties:I(s(),Ut).optional(),required:v(s()).optional()}).catchall(O()),outputSchema:q({$schema:s().optional()}).optional(),annotations:aa.optional(),execution:sa.optional(),_meta:I(s(),O()).optional()}),ca=Mt.extend({method:p("tools/list")}),la=Lt.extend({tools:v(or)}),ar=me.extend({content:v(zt).default([]),structuredContent:O().optional(),isError:T().optional()}),il=ar.or(me.extend({toolResult:O()})),ua=nr.extend({name:s(),arguments:I(s(),O()).optional()}),da=de.extend({method:p("tools/call"),params:ua}),ma=Re.extend({method:p("notifications/tools/list_changed"),params:je.optional()}),ol=d({autoRefresh:T().default(!0),debounceMs:y().int().nonnegative().default(300)}),Jn=Z(["debug","info","notice","warning","error","critical","alert","emergency"]),pa=ke.extend({level:Jn}),fa=de.extend({method:p("logging/setLevel"),params:pa}),ha=je.extend({level:Jn,logger:s().optional(),data:O()}),ga=Re.extend({method:p("notifications/message"),params:ha}),va=d({name:s().optional()}),ba=d({hints:v(va).optional(),costPriority:y().min(0).max(1).optional(),speedPriority:y().min(0).max(1).optional(),intelligencePriority:y().min(0).max(1).optional()}),_a=d({mode:Z(["auto","required","none"]).optional()}),Sa=d({type:p("tool_result"),toolUseId:s().describe("The unique identifier for the corresponding tool call."),content:v(zt),structuredContent:O().optional(),isError:T().optional(),_meta:I(s(),O()).optional()}),ya=At("type",[Lr,qr,Vr]),tr=At("type",[Lr,qr,Vr,ra,Sa]),$a=d({role:qt,content:P([tr,v(tr)]),_meta:I(s(),O()).optional()}),za=nr.extend({messages:v($a),modelPreferences:ba.optional(),systemPrompt:s().optional(),includeContext:Z(["none","thisServer","allServers"]).optional(),temperature:y().optional(),maxTokens:y().int(),stopSequences:v(s()).optional(),metadata:ue.optional(),tools:v(or).optional(),toolChoice:_a.optional()}),wa=de.extend({method:p("sampling/createMessage"),params:za}),ka=me.extend({model:s(),stopReason:N(Z(["endTurn","stopSequence","maxTokens"]).or(s())),role:qt,content:ya}),xa=me.extend({model:s(),stopReason:N(Z(["endTurn","stopSequence","maxTokens","toolUse"]).or(s())),role:qt,content:P([tr,v(tr)])}),Hn=d({type:p("boolean"),title:s().optional(),description:s().optional(),default:T().optional()}),Jr=d({type:p("string"),title:s().optional(),description:s().optional(),minLength:y().optional(),maxLength:y().optional(),format:Z(["email","uri","date","date-time"]).optional(),default:s().optional()}),Hr=d({type:Z(["number","integer"]),title:s().optional(),description:s().optional(),minimum:y().optional(),maximum:y().optional(),default:y().optional()}),Bn=d({type:p("string"),title:s().optional(),description:s().optional(),enum:v(s()),default:s().optional()}),Wn=d({type:p("string"),title:s().optional(),description:s().optional(),oneOf:v(d({const:s(),title:s()})),default:s().optional()}),Kn=d({type:p("string"),title:s().optional(),description:s().optional(),enum:v(s()),enumNames:v(s()).optional(),default:s().optional()}),Ia=P([Bn,Wn]),Gn=d({type:p("array"),title:s().optional(),description:s().optional(),minItems:y().optional(),maxItems:y().optional(),items:d({type:p("string"),enum:v(s())}),default:v(s()).optional()}),Yn=d({type:p("array"),title:s().optional(),description:s().optional(),minItems:y().optional(),maxItems:y().optional(),items:d({anyOf:v(d({const:s(),title:s()}))}),default:v(s()).optional()}),Ra=P([Gn,Yn]),Pa=P([Kn,Ia,Ra]),Xn=P([Pa,Hn,Jr,Hr]),Br=nr.extend({mode:p("form").optional(),message:s(),requestedSchema:d({type:p("object"),properties:I(s(),Xn),required:v(s()).optional()}).catchall(O())}),Ta=nr.extend({mode:p("url"),message:s(),elicitationId:s(),url:s().url()}),Ea=P([Br,Ta]),Ca=de.extend({method:p("elicitation/create"),params:Ea}),Oa=je.extend({elicitationId:s()}),Na=Re.extend({method:p("notifications/elicitation/complete"),params:Oa}),ja=me.extend({action:Z(["accept","decline","cancel"]),content:er((e)=>e===null?void 0:e,I(s(),P([s(),y(),T(),v(s())])).optional())}),Aa=d({type:p("ref/resource"),uri:s()}),Ua=d({type:p("ref/prompt"),name:s()}),Da=ke.extend({ref:P([Ua,Aa]),argument:d({name:s(),value:s()}),context:d({arguments:I(s(),s()).optional()}).optional()}),Ma=de.extend({method:p("completion/complete"),params:Da}),La=me.extend({completion:q({values:v(s()).max(100),total:N(y().int()),hasMore:N(T())})}),qa=d({uri:s().startsWith("file://"),name:s().optional(),_meta:I(s(),O()).optional()}),Va=de.extend({method:p("roots/list"),params:ke.optional()}),Za=me.extend({roots:v(qa)}),Fa=Re.extend({method:p("notifications/roots/list_changed"),params:je.optional()}),al=q({ttl:y().optional(),pollInterval:y().optional()}),Ja=Z(["working","input_required","completed","failed","cancelled"]),Vt=d({taskId:s(),status:Ja,ttl:P([y(),jt()]),createdAt:s(),lastUpdatedAt:s(),pollInterval:N(y()),statusMessage:N(s())}),sl=me.extend({task:Vt}),Ha=je.merge(Vt),cl=Re.extend({method:p("notifications/tasks/status"),params:Ha}),ll=de.extend({method:p("tasks/get"),params:ke.extend({taskId:s()})}),ul=me.merge(Vt),dl=de.extend({method:p("tasks/result"),params:ke.extend({taskId:s()})}),ml=me.loose(),pl=Mt.extend({method:p("tasks/list")}),fl=Lt.extend({tasks:v(Vt)}),hl=de.extend({method:p("tasks/cancel"),params:ke.extend({taskId:s()})}),gl=me.merge(Vt),vl=P([Dn,$o,ko,Ma,fa,ta,Xo,To,Co,jo,Mo,qo,Zo,da,ca]),bl=P([jn,Mn,wo,Fa]),_l=P([ir,ka,xa,ja,Za]),Sl=P([Dn,wa,Ca,Va]),yl=P([jn,Mn,ga,Ko,Uo,ma,oa,Jo,Na]),$l=P([ir,zo,Un,La,ia,Qo,Eo,Oo,Ao,ar,la,Bo]),we=uo().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:gb.custom,message:"URL must be parseable",fatal:!0}),Zl}).refine((e)=>{let t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),Ba=q({resource:s().url(),authorization_servers:v(we).optional(),jwks_uri:s().url().optional(),scopes_supported:v(s()).optional(),bearer_methods_supported:v(s()).optional(),resource_signing_alg_values_supported:v(s()).optional(),resource_name:s().optional(),resource_documentation:s().optional(),resource_policy_uri:s().url().optional(),resource_tos_uri:s().url().optional(),tls_client_certificate_bound_access_tokens:T().optional(),authorization_details_types_supported:v(s()).optional(),dpop_signing_alg_values_supported:v(s()).optional(),dpop_bound_access_tokens_required:T().optional()}),Qn=q({issuer:s(),authorization_endpoint:we,token_endpoint:we,registration_endpoint:we.optional(),scopes_supported:v(s()).optional(),response_types_supported:v(s()),response_modes_supported:v(s()).optional(),grant_types_supported:v(s()).optional(),token_endpoint_auth_methods_supported:v(s()).optional(),token_endpoint_auth_signing_alg_values_supported:v(s()).optional(),service_documentation:we.optional(),revocation_endpoint:we.optional(),revocation_endpoint_auth_methods_supported:v(s()).optional(),revocation_endpoint_auth_signing_alg_values_supported:v(s()).optional(),introspection_endpoint:s().optional(),introspection_endpoint_auth_methods_supported:v(s()).optional(),introspection_endpoint_auth_signing_alg_values_supported:v(s()).optional(),code_challenge_methods_supported:v(s()).optional(),client_id_metadata_document_supported:T().optional(),authorization_response_iss_parameter_supported:T().optional().catch(void 0),dpop_signing_alg_values_supported:v(s()).optional()}),Wa=q({issuer:s(),authorization_endpoint:we,token_endpoint:we,userinfo_endpoint:we.optional(),jwks_uri:we,registration_endpoint:we.optional(),scopes_supported:v(s()).optional(),response_types_supported:v(s()),response_modes_supported:v(s()).optional(),grant_types_supported:v(s()).optional(),acr_values_supported:v(s()).optional(),subject_types_supported:v(s()),id_token_signing_alg_values_supported:v(s()),id_token_encryption_alg_values_supported:v(s()).optional(),id_token_encryption_enc_values_supported:v(s()).optional(),userinfo_signing_alg_values_supported:v(s()).optional(),userinfo_encryption_alg_values_supported:v(s()).optional(),userinfo_encryption_enc_values_supported:v(s()).optional(),request_object_signing_alg_values_supported:v(s()).optional(),request_object_encryption_alg_values_supported:v(s()).optional(),request_object_encryption_enc_values_supported:v(s()).optional(),token_endpoint_auth_methods_supported:v(s()).optional(),token_endpoint_auth_signing_alg_values_supported:v(s()).optional(),display_values_supported:v(s()).optional(),claim_types_supported:v(s()).optional(),claims_supported:v(s()).optional(),service_documentation:s().optional(),claims_locales_supported:v(s()).optional(),ui_locales_supported:v(s()).optional(),claims_parameter_supported:T().optional(),request_parameter_supported:T().optional(),request_uri_parameter_supported:T().optional(),require_request_uri_registration:T().optional(),op_policy_uri:we.optional(),op_tos_uri:we.optional(),client_id_metadata_document_supported:T().optional(),authorization_response_iss_parameter_supported:T().optional().catch(void 0)}),Ka=d({...Wa.shape,...Qn.pick({code_challenge_methods_supported:!0}).shape}),Ga=d({access_token:s(),id_token:s().optional(),token_type:s(),expires_in:A$().optional(),scope:s().optional(),refresh_token:s().optional()}).strip(),Ya=d({issued_token_type:p("urn:ietf:params:oauth:token-type:id-jag"),access_token:s(),token_type:s().optional(),expires_in:y().optional(),scope:s().optional()}).strip(),Xa=d({error:s(),error_description:s().optional(),error_uri:s().optional()}),Am=we.optional().or(p("").transform(()=>{return})),Qa=d({redirect_uris:v(we),token_endpoint_auth_method:s().optional(),grant_types:v(s()).optional(),response_types:v(s()).optional(),application_type:s().optional(),client_name:s().optional(),client_uri:we.optional(),logo_uri:Am,scope:s().optional(),contacts:v(s()).optional(),tos_uri:Am,policy_uri:s().optional(),jwks_uri:we.optional(),jwks:po().optional(),software_id:s().optional(),software_version:s().optional(),software_statement:s().optional()}).strip(),es=d({client_id:s(),client_secret:s().optional(),client_id_issued_at:y().optional(),client_secret_expires_at:y().optional()}).strip(),ts=Qa.merge(es),zl=d({error:s(),error_description:s().optional()}).strip(),wl=d({token:s(),token_type_hint:s().optional()}).strip();var Zm=Symbol.for("mcp.sdk.errorBrands");function Kr(e,t){let r=new Set,n=t;while(typeof n==="function"){let i=n.mcpBrand;if(Object.prototype.hasOwnProperty.call(n,"mcpBrand")&&typeof i==="string")r.add(i);n=Object.getPrototypeOf(n)}if(r.size===0)return;Object.defineProperty(e,Zm,{value:r,enumerable:!1,configurable:!0})}function et(e,t){try{if(typeof t==="object"&&t!==null&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&typeof e.mcpBrand==="string"&&Object.prototype.hasOwnProperty.call(t,Zm)){let r=t[Zm];if(r&&typeof r.has==="function"&&r.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var M$=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return et(this,t)}static isInstance(t){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. \`SdkError.isInstance(value)\`); for callbacks use \`v => SdkError.isInstance(v)\`");return et(this,t)}constructor(t,r,n){super(r);this.code=t,this.errorUri=n,this.name="OAuthError",Kr(this,new.target)}toResponseObject(){let t={error:this.code,error_description:this.message};if(this.errorUri)t.error_uri=this.errorUri;return t}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}},Pe=function(e){return e.NotConnected="NOT_CONNECTED",e.AlreadyConnected="ALREADY_CONNECTED",e.NotInitialized="NOT_INITIALIZED",e.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",e.RequestTimeout="REQUEST_TIMEOUT",e.ConnectionClosed="CONNECTION_CLOSED",e.SendFailed="SEND_FAILED",e.InvalidResult="INVALID_RESULT",e.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",e.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",e.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",e.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",e.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",e.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",e.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",e.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",e.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",e.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",e.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",e}({}),ve=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return et(this,e)}static isInstance(e){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. \`SdkError.isInstance(value)\`); for callbacks use \`v => SdkError.isInstance(v)\`");return et(this,e)}constructor(e,t,r,n){super(t,n);this.code=e,this.data=r,this.name="SdkError",Kr(this,new.target)}},L$=class extends ve{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(e,t,r,n){super(e,t,r,n);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};var q$="2026-07-28";function Db(e){return e>=q$}function Mb(e){let t=e.structuredContent;if(t===void 0)return e;if(!(typeof t!=="object"||t===null||Array.isArray(t)))return e;if(e.content?.some((r)=>r.type==="text")??!1)return e;return{...e,content:[...e.content??[],{type:"text",text:JSON.stringify(t)}]}}var Lb=["task","inputRequests","requestState"];function V$(e){if(e===null||typeof e!=="object"||Array.isArray(e)||e.content!==void 0||Lb.some((t)=>(t in e)))return e;return{...e,content:[]}}function Z$(){let e=Cr(()=>P([s(),y(),T(),jt(),I(s(),e),v(e)])),t=I(s(),e),r=P([s(),y().int()]),n=s(),i=d({ttl:y().optional()}),o=d({taskId:s()}),a=q({progressToken:r.optional(),"io.modelcontextprotocol/related-task":o.optional()}),c=d({_meta:a.optional()}),l=c.extend({task:i.optional()}),u=d({method:s(),params:c.loose().optional()}),m=d({_meta:a.optional()}),f=d({method:s(),params:m.loose().optional()}),h=q({_meta:a.optional()}),b=P([s(),y().int()]),_=h.strict(),S=m.extend({requestId:b.optional(),reason:s().optional()}),w=f.extend({method:p("notifications/cancelled"),params:S}),C=d({src:s(),mimeType:s().optional(),sizes:v(s()).optional(),theme:Z(["light","dark"]).optional()}),F=d({icons:v(C).optional()}),D=d({name:s(),title:s().optional()}),B=D.extend({...D.shape,...F.shape,version:s(),websiteUrl:s().optional(),description:s().optional()}),k=_t(d({applyDefaults:T().optional()}),t),z=er((Ne)=>{if(Ne&&typeof Ne==="object"&&!Array.isArray(Ne)&&Object.keys(Ne).length===0)return{form:{}};return Ne},_t(d({form:k.optional(),url:t.optional()}),t.optional())),R=q({list:t.optional(),cancel:t.optional(),requests:q({sampling:q({createMessage:t.optional()}).optional(),elicitation:q({create:t.optional()}).optional()}).optional()}),H=q({list:t.optional(),cancel:t.optional(),requests:q({tools:q({call:t.optional()}).optional()}).optional()}),V=d({experimental:I(s(),t).optional(),sampling:d({context:t.optional(),tools:t.optional()}).optional(),elicitation:z.optional(),roots:d({listChanged:T().optional()}).optional(),tasks:R.optional(),extensions:I(s(),t).optional()}),ee=c.extend({protocolVersion:s(),capabilities:V,clientInfo:B}),be=u.extend({method:p("initialize"),params:ee}),Ae=d({experimental:I(s(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:d({listChanged:T().optional()}).optional(),resources:d({subscribe:T().optional(),listChanged:T().optional()}).optional(),tools:d({listChanged:T().optional()}).optional(),tasks:H.optional(),extensions:I(s(),t).optional()}),Ce=h.extend({protocolVersion:s(),capabilities:Ae,serverInfo:B,instructions:s().optional()}),ce=f.extend({method:p("notifications/initialized"),params:m.optional()}),_e=u.extend({method:p("ping"),params:c.optional()}),ot=d({progress:y(),total:N(y()),message:N(s())}),tt=d({...m.shape,...ot.shape,progressToken:r}),ht=f.extend({method:p("notifications/progress"),params:tt}),Ft=c.extend({cursor:n.optional()}),Me=u.extend({params:Ft.optional()}),xe=h.extend({nextCursor:n.optional()}),rt=d({uri:s(),mimeType:N(s()),_meta:I(s(),O()).optional()}),It=rt.extend({text:s()}),at=s().refine((Ne)=>{try{return atob(Ne),!0}catch{return!1}},{message:"Invalid Base64 string"}),gt=rt.extend({blob:at}),Le=Z(["user","assistant"]),Ue=d({audience:v(Le).optional(),priority:y().min(0).max(1).optional(),lastModified:ho({offset:!0}).optional()}),Rt=d({...D.shape,...F.shape,uri:s(),description:N(s()),mimeType:N(s()),size:N(y()),annotations:Ue.optional(),_meta:N(q({}))}),Pt=d({...D.shape,...F.shape,uriTemplate:s(),description:N(s()),mimeType:N(s()),annotations:Ue.optional(),_meta:N(q({}))}),ur=Me.extend({method:p("resources/list")}),dr=xe.extend({resources:v(Rt)}),oe=Me.extend({method:p("resources/templates/list")}),L=xe.extend({resourceTemplates:v(Pt)}),M=c.extend({uri:s()}),Q=M,X=u.extend({method:p("resources/read"),params:Q}),le=h.extend({contents:v(P([It,gt]))}),pe=f.extend({method:p("notifications/resources/list_changed"),params:m.optional()}),fe=M,Se=u.extend({method:p("resources/subscribe"),params:fe}),nt=M,vt=u.extend({method:p("resources/unsubscribe"),params:nt}),mr=m.extend({uri:s()}),st=f.extend({method:p("notifications/resources/updated"),params:mr}),ai=d({name:s(),description:N(s()),required:N(T())}),si=d({...D.shape,...F.shape,description:N(s()),arguments:N(v(ai)),_meta:N(q({}))}),ci=Me.extend({method:p("prompts/list")}),li=xe.extend({prompts:v(si)}),ui=c.extend({name:s(),arguments:I(s(),s()).optional()}),di=u.extend({method:p("prompts/get"),params:ui}),pr=d({type:p("text"),text:s(),annotations:Ue.optional(),_meta:I(s(),O()).optional()}),fr=d({type:p("image"),data:at,mimeType:s(),annotations:Ue.optional(),_meta:I(s(),O()).optional()}),hr=d({type:p("audio"),data:at,mimeType:s(),annotations:Ue.optional(),_meta:I(s(),O()).optional()}),mi=d({type:p("tool_use"),name:s(),id:s(),input:I(s(),O()),_meta:I(s(),O()).optional()}),Jt=d({type:p("resource"),resource:P([It,gt]),annotations:Ue.optional(),_meta:I(s(),O()).optional()}),pi=Rt.extend({type:p("resource_link")}),it=P([pr,fr,hr,pi,Jt]),en=d({role:Le,content:it}),tn=h.extend({description:s().optional(),messages:v(en)}),gr=f.extend({method:p("notifications/prompts/list_changed"),params:m.optional()}),fi=d({title:s().optional(),readOnlyHint:T().optional(),destructiveHint:T().optional(),idempotentHint:T().optional(),openWorldHint:T().optional()}),rn=d({taskSupport:Z(["required","optional","forbidden"]).optional()}),vr=d({...D.shape,...F.shape,description:s().optional(),inputSchema:d({type:p("object"),properties:I(s(),e).optional(),required:v(s()).optional()}).catchall(O()),outputSchema:d({type:p("object"),properties:I(s(),e).optional(),required:v(s()).optional()}).catchall(O()).optional(),annotations:fi.optional(),execution:rn.optional(),_meta:I(s(),O()).optional()}),nn=Me.extend({method:p("tools/list")}),on=xe.extend({tools:v(vr)}),an=h.extend({content:v(it),structuredContent:I(s(),O()).optional(),isError:T().optional()}),Oe=l.extend({name:s(),arguments:I(s(),O()).optional()}),hi=u.extend({method:p("tools/call"),params:Oe}),bs=f.extend({method:p("notifications/tools/list_changed"),params:m.optional()}),sn=Z(["debug","info","notice","warning","error","critical","alert","emergency"]),gi=c.extend({level:sn}),vi=u.extend({method:p("logging/setLevel"),params:gi}),bi=m.extend({level:sn,logger:s().optional(),data:O()}),_i=f.extend({method:p("notifications/message"),params:bi}),Si=d({name:s().optional()}),yi=d({hints:v(Si).optional(),costPriority:y().min(0).max(1).optional(),speedPriority:y().min(0).max(1).optional(),intelligencePriority:y().min(0).max(1).optional()}),$i=d({mode:Z(["auto","required","none"]).optional()}),_s=d({type:p("tool_result"),toolUseId:s().describe("The unique identifier for the corresponding tool call."),content:v(it),structuredContent:d({}).loose().optional(),isError:T().optional(),_meta:I(s(),O()).optional()}),zi=At("type",[pr,fr,hr]),Ht=At("type",[pr,fr,hr,mi,_s]),wi=d({role:Le,content:P([Ht,v(Ht)]),_meta:I(s(),O()).optional()}),ki=l.extend({messages:v(wi),modelPreferences:yi.optional(),systemPrompt:s().optional(),includeContext:Z(["none","thisServer","allServers"]).optional(),temperature:y().optional(),maxTokens:y().int(),stopSequences:v(s()).optional(),metadata:t.optional(),tools:v(vr).optional(),toolChoice:$i.optional()}),xi=u.extend({method:p("sampling/createMessage"),params:ki}),Ii=h.extend({model:s(),stopReason:N(Z(["endTurn","stopSequence","maxTokens"]).or(s())),role:Le,content:zi}),Ri=h.extend({model:s(),stopReason:N(Z(["endTurn","stopSequence","maxTokens","toolUse"]).or(s())),role:Le,content:P([Ht,v(Ht)])}),Pi=d({type:p("boolean"),title:s().optional(),description:s().optional(),default:T().optional()}),Ti=d({type:p("string"),title:s().optional(),description:s().optional(),minLength:y().optional(),maxLength:y().optional(),format:Z(["email","uri","date","date-time"]).optional(),default:s().optional()}),Ei=d({type:Z(["number","integer"]),title:s().optional(),description:s().optional(),minimum:y().optional(),maximum:y().optional(),default:y().optional()}),Ci=d({type:p("string"),title:s().optional(),description:s().optional(),enum:v(s()),default:s().optional()}),Oi=d({type:p("string"),title:s().optional(),description:s().optional(),oneOf:v(d({const:s(),title:s()})),default:s().optional()}),Ni=d({type:p("string"),title:s().optional(),description:s().optional(),enum:v(s()),enumNames:v(s()).optional(),default:s().optional()}),ji=P([Ci,Oi]),br=d({type:p("array"),title:s().optional(),description:s().optional(),minItems:y().optional(),maxItems:y().optional(),items:d({type:p("string"),enum:v(s())}),default:v(s()).optional()}),_r=d({type:p("array"),title:s().optional(),description:s().optional(),minItems:y().optional(),maxItems:y().optional(),items:d({anyOf:v(d({const:s(),title:s()}))}),default:v(s()).optional()}),Ss=P([br,_r]),ys=P([Ni,ji,Ss]),Ke=P([ys,Pi,Ti,Ei]),Ge=l.extend({mode:p("form").optional(),message:s(),requestedSchema:d({type:p("object"),properties:I(s(),Ke),required:v(s()).optional()}).catchall(O())}),Ai=l.extend({mode:p("url"),message:s(),elicitationId:s(),url:s().url()}),ct=P([Ge,Ai]),$s=u.extend({method:p("elicitation/create"),params:ct}),zs=m.extend({elicitationId:s()}),ws=f.extend({method:p("notifications/elicitation/complete"),params:zs}),ks=h.extend({action:Z(["accept","decline","cancel"]),content:er((Ne)=>Ne===null?void 0:Ne,I(s(),P([s(),y(),T(),v(s())])).optional())}),xs=d({type:p("ref/resource"),uri:s()}),Is=d({type:p("ref/prompt"),name:s()}),Rs=c.extend({ref:P([Is,xs]),argument:d({name:s(),value:s()}),context:d({arguments:I(s(),s()).optional()}).optional()}),Ui=u.extend({method:p("completion/complete"),params:Rs}),Ps=h.extend({completion:q({values:v(s()).max(100),total:N(y().int()),hasMore:N(T())})}),Ts=d({uri:s().startsWith("file://"),name:s().optional(),_meta:I(s(),O()).optional()}),cn=u.extend({method:p("roots/list"),params:c.optional()}),Di=h.extend({roots:v(Ts)}),Es=f.extend({method:p("notifications/roots/list_changed"),params:m.optional()}),Cs=q({ttl:y().optional(),pollInterval:y().optional()}),Os=Z(["working","input_required","completed","failed","cancelled"]),Bt=d({taskId:s(),status:Os,ttl:P([y(),jt()]),createdAt:s(),lastUpdatedAt:s(),pollInterval:N(y()),statusMessage:N(s())}),qe=h.extend({task:Bt}),Ns=m.merge(Bt),Sr=f.extend({method:p("notifications/tasks/status"),params:Ns}),ln=u.extend({method:p("tasks/get"),params:c.extend({taskId:s()})}),un=h.merge(Bt),dn=u.extend({method:p("tasks/result"),params:c.extend({taskId:s()})}),jl=h.loose(),Ve=Me.extend({method:p("tasks/list")}),he=xe.extend({tasks:v(Bt)}),yr=u.extend({method:p("tasks/cancel"),params:c.extend({taskId:s()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:n,TaskMetadataSchema:i,RelatedTaskMetadataSchema:o,RequestMetaSchema:a,BaseRequestParamsSchema:c,TaskAugmentedRequestParamsSchema:l,RequestSchema:u,NotificationsParamsSchema:m,NotificationSchema:f,ResultSchema:h,RequestIdSchema:b,EmptyResultSchema:_,CancelledNotificationParamsSchema:S,CancelledNotificationSchema:w,IconSchema:C,IconsSchema:F,BaseMetadataSchema:D,ImplementationSchema:B,ClientTasksCapabilitySchema:R,ServerTasksCapabilitySchema:H,ClientCapabilitiesSchema:V,InitializeRequestParamsSchema:ee,InitializeRequestSchema:be,ServerCapabilitiesSchema:Ae,InitializeResultSchema:Ce,InitializedNotificationSchema:ce,PingRequestSchema:_e,ProgressSchema:ot,ProgressNotificationParamsSchema:tt,ProgressNotificationSchema:ht,PaginatedRequestParamsSchema:Ft,PaginatedRequestSchema:Me,PaginatedResultSchema:xe,ResourceContentsSchema:rt,TextResourceContentsSchema:It,BlobResourceContentsSchema:gt,RoleSchema:Le,AnnotationsSchema:Ue,ResourceSchema:Rt,ResourceTemplateSchema:Pt,ListResourcesRequestSchema:ur,ListResourcesResultSchema:dr,ListResourceTemplatesRequestSchema:oe,ListResourceTemplatesResultSchema:L,ResourceRequestParamsSchema:M,ReadResourceRequestParamsSchema:Q,ReadResourceRequestSchema:X,ReadResourceResultSchema:le,ResourceListChangedNotificationSchema:pe,SubscribeRequestParamsSchema:fe,SubscribeRequestSchema:Se,UnsubscribeRequestParamsSchema:nt,UnsubscribeRequestSchema:vt,ResourceUpdatedNotificationParamsSchema:mr,ResourceUpdatedNotificationSchema:st,PromptArgumentSchema:ai,PromptSchema:si,ListPromptsRequestSchema:ci,ListPromptsResultSchema:li,GetPromptRequestParamsSchema:ui,GetPromptRequestSchema:di,TextContentSchema:pr,ImageContentSchema:fr,AudioContentSchema:hr,ToolUseContentSchema:mi,EmbeddedResourceSchema:Jt,ResourceLinkSchema:pi,ContentBlockSchema:it,PromptMessageSchema:en,GetPromptResultSchema:tn,PromptListChangedNotificationSchema:gr,ToolAnnotationsSchema:fi,ToolExecutionSchema:rn,ToolSchema:vr,ListToolsRequestSchema:nn,ListToolsResultSchema:on,CallToolResultSchema:an,CallToolRequestParamsSchema:Oe,CallToolRequestSchema:hi,ToolListChangedNotificationSchema:bs,LoggingLevelSchema:sn,SetLevelRequestParamsSchema:gi,SetLevelRequestSchema:vi,LoggingMessageNotificationParamsSchema:bi,LoggingMessageNotificationSchema:_i,ModelHintSchema:Si,ModelPreferencesSchema:yi,ToolChoiceSchema:$i,ToolResultContentSchema:_s,SamplingContentSchema:zi,SamplingMessageContentBlockSchema:Ht,SamplingMessageSchema:wi,CreateMessageRequestParamsSchema:ki,CreateMessageRequestSchema:xi,CreateMessageResultSchema:Ii,CreateMessageResultWithToolsSchema:Ri,BooleanSchemaSchema:Pi,StringSchemaSchema:Ti,NumberSchemaSchema:Ei,UntitledSingleSelectEnumSchemaSchema:Ci,TitledSingleSelectEnumSchemaSchema:Oi,LegacyTitledEnumSchemaSchema:Ni,SingleSelectEnumSchemaSchema:ji,UntitledMultiSelectEnumSchemaSchema:br,TitledMultiSelectEnumSchemaSchema:_r,MultiSelectEnumSchemaSchema:Ss,EnumSchemaSchema:ys,PrimitiveSchemaDefinitionSchema:Ke,ElicitRequestFormParamsSchema:Ge,ElicitRequestURLParamsSchema:Ai,ElicitRequestParamsSchema:ct,ElicitRequestSchema:$s,ElicitationCompleteNotificationParamsSchema:zs,ElicitationCompleteNotificationSchema:ws,ElicitResultSchema:ks,ResourceTemplateReferenceSchema:xs,PromptReferenceSchema:Is,CompleteRequestParamsSchema:Rs,CompleteRequestSchema:Ui,CompleteResultSchema:Ps,RootSchema:Ts,ListRootsRequestSchema:cn,ListRootsResultSchema:Di,RootsListChangedNotificationSchema:Es,TaskCreationParamsSchema:Cs,TaskStatusSchema:Os,TaskSchema:Bt,CreateTaskResultSchema:qe,TaskStatusNotificationParamsSchema:Ns,TaskStatusNotificationSchema:Sr,GetTaskRequestSchema:ln,GetTaskResultSchema:un,GetTaskPayloadRequestSchema:dn,GetTaskPayloadResultSchema:jl,ListTasksRequestSchema:Ve,ListTasksResultSchema:he,CancelTaskRequestSchema:yr,CancelTaskResultSchema:h.merge(Bt),ClientRequestSchema:P([_e,be,Ui,vi,di,ci,ur,oe,X,Se,vt,hi,nn,ln,dn,Ve,yr]),ClientNotificationSchema:P([w,ht,ce,Es,Sr]),ClientResultSchema:P([_,Ii,Ri,ks,Di,un,he,qe]),ServerRequestSchema:P([_e,xi,$s,cn,ln,dn,Ve,yr]),ServerNotificationSchema:P([w,ht,_i,st,pe,bs,gr,Sr,ws]),ServerResultSchema:P([_,Ce,Ps,tn,li,dr,L,le,an,on,un,he,qe]),CallToolResultWireSchema:O().superRefine((Ne,J_)=>{if(typeof Ne!=="object"||Ne===null||Array.isArray(Ne)||Ne.content!==void 0)return;for(let _p of Lb)if(_p in Ne){J_.addIssue({code:"custom",message:\`content is required when the body carries '\${_p}' — another result family cannot default into an empty tools/call success\`});return}}).transform(V$).pipe(an)}}var F$;function qb(){return F$??=Z$()}function Vb(e){return e.type!=="object"}var J$=new Set(["const","enum","default","examples"]),H$=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function Rb(e){return e!==void 0&&!(typeof e==="string"&&e.startsWith("#"))}function B$(e){let t=typeof e.$schema==="string"?e.$schema:void 0;if(Rb(e.$id))return{...t!==void 0&&{$schema:t},type:"object",properties:{result:e},required:["result"]};let r=zp(e.$schema)&&e.$recursiveAnchor!==!0,n=(i,o)=>{if(Array.isArray(i))return i.map((l)=>n(l,!1));if(i===null||typeof i!=="object")return i;if(!o&&Rb(i.$id))return i;let a={},c=!1;for(let[l,u]of Object.entries(i))if(o)a[l]=n(u,!1);else if((l==="$ref"||l==="$dynamicRef")&&typeof u==="string")a[l]=u==="#"?"#/properties/result":u.startsWith("#/")?\`#/properties/result\${u.slice(1)}\`:u;else if(l==="$recursiveRef"&&u==="#"&&r)c=!0;else if(J$.has(l))a[l]=u;else if(H$.has(l))a[l]=n(u,!0);else a[l]=n(u,!1);if(c)if("$ref"in a)a.allOf=[...Array.isArray(a.allOf)?a.allOf:[],{$ref:"#/properties/result"}];else a.$ref="#/properties/result";return a};return{...t!==void 0&&{$schema:t},type:"object",properties:{result:n(e,!1)},required:["result"]}}var Zb={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Fb={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},W$={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},kl;function Km(){if(kl)return kl;let e=qb();return kl={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},kl}function Jb(e){return Object.prototype.hasOwnProperty.call(Zb,e)}function Hb(e){return Object.prototype.hasOwnProperty.call(Fb,e)}function K$(e){return Object.prototype.hasOwnProperty.call(W$,e)}function G$(e){return K$(e)?Km().resultSchemas[e]:void 0}function Y$(e){return Jb(e)?Km().requestSchemas[e]:void 0}function X$(e){return Hb(e)?Km().notificationSchemas[e]:void 0}var RT=Object.keys(Zb),PT=Object.keys(Fb);function Fm(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function xl(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var Pb={ok:!1,reason:"not-in-era"};function Tb(e){return Fm(e)&&Fm(e.outputSchema)&&Vb(e.outputSchema)}function Eb(e){return e}var Gm={era:"2025-11-25",hasRequestMethod:Jb,hasNotificationMethod:Hb,validateRequest:(e,t)=>xl(Y$(e),t),validateResult:(e,t)=>xl(G$(e),t),validateNotification:(e,t)=>xl(X$(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Pb,validateInputResponse:()=>Pb,samplingResultVariant:(e,t)=>{let r=qb();return xl(e?r.CreateMessageResultWithToolsSchema:r.CreateMessageResultSchema,t)},outboundEnvelope:(e)=>{return},validateEnvelopeMeta:(e)=>[],projectCallToolResult(e,t){let r=Mb(e),n=r.structuredContent;if(n===void 0)return r;let i=typeof n!=="object"||n===null||Array.isArray(n),o=t!==void 0&&Vb(t);if(!i&&!o)return r;return{...r,structuredContent:{result:n}}},decodeResult(e,t){if(Fm(t)&&"resultType"in t){let r={...t};return delete r.resultType,{kind:"complete",result:Eb(r)}}return{kind:"complete",result:Eb(t)}},encodeResult(e,t){if(e!=="tools/list")return t;let r=t.tools;if(!Array.isArray(r)||!r.some((n)=>Tb(n)))return t;return{...t,tools:r.map((n)=>Tb(n)?{...n,outputSchema:B$(n.outputSchema)}:n)}},encodeErrorCode:(e)=>e===-32002?-32602:e,checkInboundEnvelope:(e)=>{return}};function Q$(){let e=Cr(()=>P([s(),y(),T(),jt(),I(s(),e),v(e)])),t=I(s(),e),r=P([s(),y().int()]),n=s(),i=P([s(),y().int()]),o=Z(["user","assistant"]),a=Z(["debug","info","notice","warning","error","critical","alert","emergency"]),c=s().refine((he)=>{try{return atob(he),!0}catch{return!1}},{message:"Invalid Base64 string"}),l=d({ttl:y().optional()}),u=d({taskId:s()}),m=q({progressToken:r.optional(),"io.modelcontextprotocol/related-task":u.optional()}),f=d({_meta:m.optional()}),h=f.extend({task:l.optional()}),b=d({_meta:m.optional()}),_=d({method:s(),params:b.loose().optional()}),S=d({src:s(),mimeType:s().optional(),sizes:v(s()).optional(),theme:Z(["light","dark"]).optional()}),w=d({icons:v(S).optional()}),C=d({name:s(),title:s().optional()}),F=C.extend({...C.shape,...w.shape,version:s(),websiteUrl:s().optional(),description:s().optional()}),D=_t(d({applyDefaults:T().optional()}),t),B=er((he)=>{if(he&&typeof he==="object"&&!Array.isArray(he)&&Object.keys(he).length===0)return{form:{}};return he},_t(d({form:D.optional(),url:t.optional()}),t.optional())),k=q({list:t.optional(),cancel:t.optional(),requests:q({sampling:q({createMessage:t.optional()}).optional(),elicitation:q({create:t.optional()}).optional()}).optional()}),z=q({list:t.optional(),cancel:t.optional(),requests:q({tools:q({call:t.optional()}).optional()}).optional()}),R=d({experimental:I(s(),t).optional(),sampling:d({context:t.optional(),tools:t.optional()}).optional(),elicitation:B.optional(),roots:d({listChanged:T().optional()}).optional(),tasks:k.optional(),extensions:I(s(),t).optional()}),H=d({experimental:I(s(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:d({listChanged:T().optional()}).optional(),resources:d({subscribe:T().optional(),listChanged:T().optional()}).optional(),tools:d({listChanged:T().optional()}).optional(),tasks:z.optional(),extensions:I(s(),t).optional()}),V=d({progress:y(),total:N(y()),message:N(s())}),ee=d({...b.shape,...V.shape,progressToken:r}),be=_.extend({method:p("notifications/progress"),params:ee}),Ae=b.extend({level:a,logger:s().optional(),data:O()}),Ce=_.extend({method:p("notifications/message"),params:Ae}),ce=d({uri:s(),mimeType:N(s()),_meta:I(s(),O()).optional()}),_e=ce.extend({text:s()}),ot=ce.extend({blob:c}),tt=d({audience:v(o).optional(),priority:y().min(0).max(1).optional(),lastModified:ho({offset:!0}).optional()}),ht=d({...C.shape,...w.shape,uri:s(),description:N(s()),mimeType:N(s()),size:N(y()),annotations:tt.optional(),_meta:N(q({}))}),Ft=d({...C.shape,...w.shape,uriTemplate:s(),description:N(s()),mimeType:N(s()),annotations:tt.optional(),_meta:N(q({}))}),Me=_.extend({method:p("notifications/resources/list_changed"),params:b.optional()}),xe=b.extend({uri:s()}),rt=_.extend({method:p("notifications/resources/updated"),params:xe}),It=d({name:s(),description:N(s()),required:N(T())}),at=d({...C.shape,...w.shape,description:N(s()),arguments:N(v(It)),_meta:N(q({}))}),gt=_.extend({method:p("notifications/prompts/list_changed"),params:b.optional()}),Le=d({type:p("text"),text:s(),annotations:tt.optional(),_meta:I(s(),O()).optional()}),Ue=d({type:p("image"),data:c,mimeType:s(),annotations:tt.optional(),_meta:I(s(),O()).optional()}),Rt=d({type:p("audio"),data:c,mimeType:s(),annotations:tt.optional(),_meta:I(s(),O()).optional()}),Pt=d({type:p("tool_use"),name:s(),id:s(),input:I(s(),O()),_meta:I(s(),O()).optional()}),ur=d({type:p("resource"),resource:P([_e,ot]),annotations:tt.optional(),_meta:I(s(),O()).optional()}),dr=ht.extend({type:p("resource_link")}),oe=P([Le,Ue,Rt,dr,ur]),L=d({role:o,content:oe}),M=d({title:s().optional(),readOnlyHint:T().optional(),destructiveHint:T().optional(),idempotentHint:T().optional(),openWorldHint:T().optional()}),Q=_.extend({method:p("notifications/tools/list_changed"),params:b.optional()}),X=d({name:s().optional()}),le=d({hints:v(X).optional(),costPriority:y().min(0).max(1).optional(),speedPriority:y().min(0).max(1).optional(),intelligencePriority:y().min(0).max(1).optional()}),pe=d({mode:Z(["auto","required","none"]).optional()}),fe=d({type:p("boolean"),title:s().optional(),description:s().optional(),default:T().optional()}),Se=d({type:p("string"),title:s().optional(),description:s().optional(),minLength:y().optional(),maxLength:y().optional(),format:Z(["email","uri","date","date-time"]).optional(),default:s().optional()}),nt=d({type:Z(["number","integer"]),title:s().optional(),description:s().optional(),minimum:y().optional(),maximum:y().optional(),default:y().optional()}),vt=d({type:p("string"),title:s().optional(),description:s().optional(),enum:v(s()),default:s().optional()}),mr=d({type:p("string"),title:s().optional(),description:s().optional(),oneOf:v(d({const:s(),title:s()})),default:s().optional()}),st=d({type:p("string"),title:s().optional(),description:s().optional(),enum:v(s()),enumNames:v(s()).optional(),default:s().optional()}),ai=P([vt,mr]),si=d({type:p("array"),title:s().optional(),description:s().optional(),minItems:y().optional(),maxItems:y().optional(),items:d({type:p("string"),enum:v(s())}),default:v(s()).optional()}),ci=d({type:p("array"),title:s().optional(),description:s().optional(),minItems:y().optional(),maxItems:y().optional(),items:d({anyOf:v(d({const:s(),title:s()}))}),default:v(s()).optional()}),li=P([si,ci]),ui=P([st,ai,li]),di=P([ui,fe,Se,nt]),pr=h.extend({mode:p("form").optional(),message:s(),requestedSchema:d({type:p("object"),properties:I(s(),di),required:v(s()).optional()}).catchall(O())}),fr=d({type:p("ref/resource"),uri:s()}),hr=d({type:p("ref/prompt"),name:s()}),mi=d({uri:s().startsWith("file://"),name:s().optional(),_meta:I(s(),O()).optional()}),Jt=R.shape,pi=d({experimental:Jt.experimental,sampling:Jt.sampling,elicitation:Jt.elicitation,roots:Jt.roots,extensions:Jt.extensions}),it=H.shape,en=d({experimental:it.experimental,logging:it.logging,completions:it.completions,prompts:it.prompts,resources:it.resources,tools:it.tools,extensions:it.extensions}),tn=q({progressToken:r.optional(),[Or]:s(),[In]:F.optional(),[Nr]:pi,[Rn]:a.optional()}),gr=d({...C.shape,...w.shape,description:s().optional(),inputSchema:q({$schema:s().optional(),type:p("object")}),outputSchema:q({$schema:s().optional()}).optional(),annotations:M.optional(),_meta:I(s(),O()).optional()}),fi=d({type:p("tool_result"),toolUseId:s(),content:v(oe),structuredContent:O().optional(),isError:T().optional(),_meta:I(s(),O()).optional()}),rn=P([Le,Ue,Rt,Pt,fi]),vr=d({role:o,content:P([rn,v(rn)]),_meta:I(s(),O()).optional()}),nn=s(),on=q({[rr]:F.optional().catch(void 0)}),an=on.optional();function Oe(he){return q({_meta:an,resultType:nn.default("complete"),...he})}let hi=Oe({}),bs=Oe({nextCursor:n.optional()}),sn=Oe({content:v(oe),structuredContent:O().optional(),isError:T().optional()}),gi=Oe({ttlMs:y().int().min(0),cacheScope:Z(["public","private"]),tools:v(gr),nextCursor:n.optional()}),vi=Oe({ttlMs:y().int().min(0),cacheScope:Z(["public","private"]),prompts:v(at),nextCursor:n.optional()}),bi=Oe({description:s().optional(),messages:v(L)}),_i=Oe({ttlMs:y().int().min(0),cacheScope:Z(["public","private"]),resources:v(ht),nextCursor:n.optional()}),Si=Oe({ttlMs:y().int().min(0),cacheScope:Z(["public","private"]),resourceTemplates:v(Ft),nextCursor:n.optional()}),yi=Oe({ttlMs:y().int().min(0),cacheScope:Z(["public","private"]),contents:v(P([_e,ot]))}),$i=Oe({completion:d({values:v(s()).max(100),total:y().int().optional(),hasMore:T().optional()}).loose()}),_s=Oe({ttlMs:y().int().min(0),cacheScope:Z(["public","private"])}),zi=Oe({ttlMs:y().int().min(0).catch(0),cacheScope:Z(["public","private"]).catch("private"),supportedVersions:v(s()),capabilities:en,instructions:s().optional()}),Ht=d({messages:v(vr),modelPreferences:le.optional(),systemPrompt:s().optional(),includeContext:Z(["none","thisServer","allServers"]).optional(),temperature:y().optional(),maxTokens:y().int(),stopSequences:v(s()).optional(),metadata:t.optional(),tools:v(gr).optional(),toolChoice:pe.optional()}),wi=d({method:p("sampling/createMessage"),params:Ht}),ki=d({method:p("roots/list"),params:d({_meta:I(s(),O()).optional()}).optional()}),xi=d({...vr.shape,model:s(),stopReason:s().optional()}),Ii=d({roots:v(mi)}),Ri=d({action:Z(["accept","decline","cancel"]),content:I(s(),P([s(),y(),T(),v(s())])).optional()}),Pi=d({mode:p("url"),message:s(),url:s().url()}),Ti=P([pr,Pi]),Ei=d({method:p("elicitation/create"),params:Ti}),Ci=P([wi,ki,Ei]),Oi=P([xi,Ii,Ri]),Ni=I(s(),Ci),ji=I(s(),Oi),br=Oe({inputRequests:Ni.optional(),requestState:s().optional()}),_r={inputResponses:ji.optional(),requestState:s().optional()},Ss=d({_meta:tn,..._r}),ys=q({progressToken:r.optional()});function Ke(he,yr){return d({method:p(he),params:d({_meta:tn,...yr})})}function Ge(he,yr){return d({method:p(he),params:d({_meta:ys.optional(),...yr}).optional()})}let Ai={name:s(),arguments:I(s(),O()).optional(),..._r},ct={cursor:n.optional()},$s=Ke("tools/call",Ai),zs=Ke("tools/list",ct),ws=Ke("prompts/list",ct),ks=Ke("prompts/get",{name:s(),arguments:I(s(),s()).optional(),..._r}),xs=Ke("resources/list",ct),Is=Ke("resources/templates/list",ct),Rs=Ke("resources/read",{uri:s(),..._r}),Ui={ref:P([hr,fr]),argument:d({name:s(),value:s()}),context:d({arguments:I(s(),s()).optional()}).optional()},Ps=Ke("completion/complete",Ui),Ts=Ke("server/discover",{}),cn=d({toolsListChanged:T().optional(),promptsListChanged:T().optional(),resourcesListChanged:T().optional(),resourceSubscriptions:v(s()).optional()}),Di={notifications:cn},Es=Ke("subscriptions/listen",Di),Cs=on.extend({"io.modelcontextprotocol/subscriptionId":i}),Os=q({_meta:Cs,resultType:nn.default("complete")}),Bt={"tools/call":Ge("tools/call",Ai),"tools/list":Ge("tools/list",ct),"prompts/get":Ge("prompts/get",{name:s(),arguments:I(s(),s()).optional()}),"prompts/list":Ge("prompts/list",ct),"resources/list":Ge("resources/list",ct),"resources/templates/list":Ge("resources/templates/list",ct),"resources/read":Ge("resources/read",{uri:s()}),"completion/complete":Ge("completion/complete",Ui),"server/discover":Ge("server/discover",{}),"subscriptions/listen":Ge("subscriptions/listen",Di)};function qe(he){return q({_meta:an,...he})}let Ns={"tools/call":qe({content:v(oe),structuredContent:O().optional(),isError:T().optional()}),"tools/list":qe({ttlMs:y().int().min(0),cacheScope:Z(["public","private"]),tools:v(gr),nextCursor:n.optional()}),"prompts/get":qe({description:s().optional(),messages:v(L)}),"prompts/list":qe({ttlMs:y().int().min(0),cacheScope:Z(["public","private"]),prompts:v(at),nextCursor:n.optional()}),"resources/list":qe({ttlMs:y().int().min(0),cacheScope:Z(["public","private"]),resources:v(ht),nextCursor:n.optional()}),"resources/templates/list":qe({ttlMs:y().int().min(0),cacheScope:Z(["public","private"]),resourceTemplates:v(Ft),nextCursor:n.optional()}),"resources/read":qe({ttlMs:y().int().min(0),cacheScope:Z(["public","private"]),contents:v(P([_e,ot]))}),"completion/complete":qe({completion:d({values:v(s()).max(100),total:y().int().optional(),hasMore:T().optional()}).loose()}),"server/discover":qe({ttlMs:y().int().min(0).catch(0),cacheScope:Z(["public","private"]).catch("private"),supportedVersions:v(s()),capabilities:en,instructions:s().optional()}),"subscriptions/listen":qe({})},Sr=q({"io.modelcontextprotocol/subscriptionId":i.optional()}),ln=d({method:p("notifications/subscriptions/acknowledged"),params:d({_meta:Sr.optional(),notifications:cn})}),un=d({_meta:Sr.optional(),requestId:i,reason:s().optional()}),dn=d({method:p("notifications/cancelled"),params:un}),jl={"notifications/cancelled":dn,"notifications/progress":be,"notifications/message":Ce,"notifications/resources/updated":rt,"notifications/resources/list_changed":Me,"notifications/tools/list_changed":Q,"notifications/prompts/list_changed":gt,"notifications/subscriptions/acknowledged":ln},Ve=(he)=>d({jsonrpc:p("2.0"),id:P([s(),y().int()]),result:he}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:n,RequestIdSchema:i,RoleSchema:o,LoggingLevelSchema:a,TaskMetadataSchema:l,RelatedTaskMetadataSchema:u,RequestMetaSchema:m,BaseRequestParamsSchema:f,TaskAugmentedRequestParamsSchema:h,NotificationsParamsSchema:b,NotificationSchema:_,IconSchema:S,IconsSchema:w,BaseMetadataSchema:C,ImplementationSchema:F,ClientTasksCapabilitySchema:k,ServerTasksCapabilitySchema:z,ClientCapabilitiesSchema:R,ServerCapabilitiesSchema:H,ProgressSchema:V,ProgressNotificationParamsSchema:ee,ProgressNotificationSchema:be,LoggingMessageNotificationParamsSchema:Ae,LoggingMessageNotificationSchema:Ce,ResourceContentsSchema:ce,TextResourceContentsSchema:_e,BlobResourceContentsSchema:ot,AnnotationsSchema:tt,ResourceSchema:ht,ResourceTemplateSchema:Ft,ResourceListChangedNotificationSchema:Me,ResourceUpdatedNotificationParamsSchema:xe,ResourceUpdatedNotificationSchema:rt,PromptArgumentSchema:It,PromptSchema:at,PromptListChangedNotificationSchema:gt,TextContentSchema:Le,ImageContentSchema:Ue,AudioContentSchema:Rt,ToolUseContentSchema:Pt,EmbeddedResourceSchema:ur,ResourceLinkSchema:dr,ContentBlockSchema:oe,PromptMessageSchema:L,ToolAnnotationsSchema:M,ToolListChangedNotificationSchema:Q,ModelHintSchema:X,ModelPreferencesSchema:le,ToolChoiceSchema:pe,BooleanSchemaSchema:fe,StringSchemaSchema:Se,NumberSchemaSchema:nt,UntitledSingleSelectEnumSchemaSchema:vt,TitledSingleSelectEnumSchemaSchema:mr,LegacyTitledEnumSchemaSchema:st,SingleSelectEnumSchemaSchema:ai,UntitledMultiSelectEnumSchemaSchema:si,TitledMultiSelectEnumSchemaSchema:ci,MultiSelectEnumSchemaSchema:li,EnumSchemaSchema:ui,PrimitiveSchemaDefinitionSchema:di,ElicitRequestFormParamsSchema:pr,ResourceTemplateReferenceSchema:fr,PromptReferenceSchema:hr,RootSchema:mi,ClientCapabilities2026Schema:pi,ServerCapabilities2026Schema:en,RequestMetaEnvelopeSchema:tn,ToolSchema:gr,ToolResultContentSchema:fi,SamplingMessageContentBlockSchema:rn,SamplingMessageSchema:vr,ResultTypeSchema:nn,ResultMetaSchema:on,ResultSchema:hi,PaginatedResultSchema:bs,CallToolResultSchema:sn,ListToolsResultSchema:gi,ListPromptsResultSchema:vi,GetPromptResultSchema:bi,ListResourcesResultSchema:_i,ListResourceTemplatesResultSchema:Si,ReadResourceResultSchema:yi,CompleteResultSchema:$i,CacheableResultSchema:_s,DiscoverResultSchema:zi,CreateMessageRequestParamsSchema:Ht,CreateMessageRequestSchema:wi,ListRootsRequestSchema:ki,CreateMessageResultSchema:xi,ListRootsResultSchema:Ii,ElicitResultSchema:Ri,ElicitRequestURLParamsSchema:Pi,ElicitRequestParamsSchema:Ti,ElicitRequestSchema:Ei,InputRequestSchema:Ci,InputResponseSchema:Oi,InputRequestsSchema:Ni,InputResponsesSchema:ji,InputRequiredResultSchema:br,InputResponseRequestParamsSchema:Ss,CallToolRequestSchema:$s,ListToolsRequestSchema:zs,ListPromptsRequestSchema:ws,GetPromptRequestSchema:ks,ListResourcesRequestSchema:xs,ListResourceTemplatesRequestSchema:Is,ReadResourceRequestSchema:Rs,CompleteRequestSchema:Ps,DiscoverRequestSchema:Ts,SubscriptionFilterSchema:cn,SubscriptionsListenRequestSchema:Es,SubscriptionsListenResultMetaSchema:Cs,SubscriptionsListenResultSchema:Os,dispatchRequestSchemas:Bt,dispatchResultSchemas:Ns,NotificationMetaSchema:Sr,SubscriptionsAcknowledgedNotificationSchema:ln,CancelledNotificationParamsSchema:un,CancelledNotificationSchema:dn,notificationSchemas2026:jl,JSONRPCResultResponseSchema:Ve(hi),CallToolResultResponseSchema:Ve(P([sn,br])),ListToolsResultResponseSchema:Ve(gi),ListPromptsResultResponseSchema:Ve(vi),GetPromptResultResponseSchema:Ve(P([bi,br])),ListResourcesResultResponseSchema:Ve(_i),ListResourceTemplatesResultResponseSchema:Ve(Si),ReadResourceResultResponseSchema:Ve(P([yi,br])),CompleteResultResponseSchema:Ve($i),DiscoverResultResponseSchema:Ve(zi)}}var ez;function Wr(){return ez??=Q$()}var tz=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function rz(e){return tz.includes(e)}var Ym=Symbol("modelcontextprotocol.resultCacheHintFallback");function nz(e){return e[Ym]}function Bb(e){return typeof e==="number"&&Number.isSafeInteger(e)&&e>=0}function Wb(e){return e==="public"||e==="private"}var G=function(e){return e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.ResourceNotFound=-32002]="ResourceNotFound",e[e.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",e[e.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired",e}({}),Te=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return et(this,t)}static isInstance(t){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. \`SdkError.isInstance(value)\`); for callbacks use \`v => SdkError.isInstance(v)\`");return et(this,t)}constructor(t,r,n){super(r);this.code=t,this.data=n,this.name="ProtocolError",Kr(this,new.target)}static fromError(t,r,n){if(t===G.UrlElicitationRequired&&n){let i=n;if(i.elicitations)return new Gb(i.elicitations,r)}if(t===G.UnsupportedProtocolVersion&&n){let i=n;if(Array.isArray(i.supported)&&typeof i.requested==="string")return new Yb({supported:i.supported,requested:i.requested},r)}if(t===G.InvalidParams||t===G.ResourceNotFound){let i=n;if(typeof i?.uri==="string"&&(t===G.ResourceNotFound||Object.keys(i).length===1))return new Kb(i.uri,r)}if(t===G.MissingRequiredClientCapability&&n){let i=n;if(i.requiredCapabilities!==null&&typeof i.requiredCapabilities==="object"&&!Array.isArray(i.requiredCapabilities))return new Xb({requiredCapabilities:i.requiredCapabilities},r)}return new e(t,r,n)}},Kb=class extends Te{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=\`Resource not found: \${e}\`){super(G.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},Gb=class extends Te{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=\`URL elicitation\${e.length>1?"s":""} required\`){super(G.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},Yb=class extends Te{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=\`Unsupported protocol version: \${e.requested}\`){super(G.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},Xb=class extends Te{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=\`Missing required client capabilities: \${Object.keys(e.requiredCapabilities).join(", ")}\`){super(G.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},iz=0,oz="private",az=["tools/call","prompts/get","resources/read"];function sz(e,t){let r=t.resultType;if(r===void 0)return{...t,resultType:"complete"};if(r==="complete")return t;if(az.includes(e))return t;throw new Te(G.InternalError,\`Handler for \${e} returned resultType '\${String(r)}', but results of \${e} only support 'complete' on protocol revision 2026-07-28\`)}function cz(e,t){let r=nz(t);if(t.resultType!=="complete"||!rz(e))return r===void 0?t:pz(t);let n=t,i=Bb(n.ttlMs)?n.ttlMs:dz(r),o=Wb(n.cacheScope)?n.cacheScope:mz(r),a={...n,ttlMs:i,cacheScope:o};return delete a[Ym],a}function lz(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function uz(e,t){if(t===void 0)return e;let r=e._meta;if(r===void 0)return{...e,_meta:{[rr]:t}};if(!lz(r))return e;if(r[rr]!==void 0)return e;return{...e,_meta:{...r,[rr]:t}}}function dz(e){return e!==void 0&&Bb(e.ttlMs)?e.ttlMs:iz}function mz(e){return e!==void 0&&Wb(e.cacheScope)?e.cacheScope:oz}function pz(e){let t={...e};return delete t[Ym],t}var fz=["elicitation/create","sampling/createMessage","roots/list"],Il;function Qb(){if(Il)return Il;let e=Wr();return Il={request:{"elicitation/create":d({method:p("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":d({method:p("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":d({method:p("roots/list"),params:q({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},Il}function e_(e){return fz.includes(e)}function Dm(e){return e_(e)?Qb().request[e]:void 0}function hz(e){return e_(e)?Qb().response[e]:void 0}var Xm={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},t_={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function r_(e){return Object.prototype.hasOwnProperty.call(Xm,e)}function n_(e){return Object.prototype.hasOwnProperty.call(t_,e)}function gz(e){return Object.prototype.hasOwnProperty.call(Xm,e)}function vz(e){return r_(e)?Wr().dispatchRequestSchemas[e]:void 0}function bz(e){return gz(e)?Wr().dispatchResultSchemas[e]:void 0}function _z(e){return n_(e)?Wr().notificationSchemas2026[e]:void 0}var TT=Object.keys(Xm),ET=Object.keys(t_);function is(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function rs(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var Sz={ok:!1,reason:"not-in-era"},yz=[Or,Nr];function $z(e,t){let r=t,n=!1,i=()=>{if(!n)r={...r},n=!0;return r},o=t.tools;if(e==="tools/list"&&Array.isArray(o)&&o.some((c)=>is(c)&&("execution"in c)))i().tools=o.map((c)=>{if(!is(c)||!("execution"in c))return c;let l={...c};return delete l.execution,l});let a=t.capabilities;if(is(a)&&"tasks"in a){let c={...a};delete c.tasks,i().capabilities=c}return r}var Qm={era:"2026-07-28",hasRequestMethod:r_,hasNotificationMethod:n_,hasInputRequestMethod:(e)=>Dm(e)!==void 0,validateRequest:(e,t)=>rs(vz(e),t),validateResult:(e,t)=>rs(bz(e),t),validateNotification:(e,t)=>rs(_z(e),t),validateInputRequest:(e,t)=>rs(Dm(e),t),validateInputResponse:(e,t)=>rs(hz(e),t),samplingResultVariant:()=>Sz,outboundEnvelope(e){return{[Or]:e.protocolVersion,[In]:e.clientInfo,[Nr]:e.clientCapabilities,...e.logLevel!==void 0&&{[Rn]:e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of yz)if(!(n in e))t.push({key:n,problem:"missing"});let r=Wr().RequestMetaEnvelopeSchema.safeParse(e);if(!r.success)for(let n of r.error.issues){let i=n.path.map(String),o=i.length>0?i.join("."):"_meta";if(i.length===1&&t.some((a)=>a.key===o&&a.problem==="missing"))continue;t.push({key:o,problem:n.message})}return t},projectCallToolResult:(e)=>Mb(e),inputRequestSchema:Dm,decodeResult(e,t){if(!is(t))return{kind:"invalid",error:new ve(Pe.InvalidResult,\`Invalid result for \${e}: not an object\`,{method:e})};let r=t.resultType;if(r===void 0)return{kind:"invalid",error:new ve(Pe.InvalidResult,\`Invalid result for \${e}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)\`,{method:e,violation:"missing-resultType"})};if(typeof r!=="string")return{kind:"invalid",error:new ve(Pe.InvalidResult,\`Invalid result for \${e}: non-string resultType\`,{method:e,resultType:r})};if(r==="input_required"){let a=t.inputRequests,c=is(a)?a:{},l=t.requestState;if(Object.keys(c).length===0&&typeof l!=="string")return{kind:"invalid",error:new ve(Pe.InvalidResult,\`Invalid result for \${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)\`,{method:e,violation:"input-required-missing-both"})};return{kind:"input_required",inputRequests:c,...typeof l==="string"&&{requestState:l}}}if(r!=="complete")return{kind:"invalid",error:new ve(Pe.UnsupportedResultType,\`Unsupported result type '\${r}' for \${e}\`,{resultType:r,method:e})};let n=zz(),i=Object.hasOwn(n,e)?n[e]:void 0;if(i!==void 0){let a=i.safeParse(t);if(!a.success)return{kind:"invalid",error:new ve(Pe.InvalidResult,\`Invalid result for \${e}: \${a.error}\`,{method:e})}}let o={...t};return delete o.resultType,{kind:"complete",result:o}},encodeResult(e,t,r){return uz(cz(e,sz(e,$z(e,t))),r)},encodeErrorCode:(e)=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let t=Wr().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return\`Invalid _meta envelope for protocol revision 2026-07-28: \${t.error.issues.map((r)=>r.message).join("; ")}\`}},Rl;function zz(){if(Rl)return Rl;let e=Wr();return Rl={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},Rl}var ep="2026-07-28";function as(e){return e!==void 0&&Db(e)?Qm:Gm}function Cb(e){if(e.revision!==void 0)return as(e.revision).era;return e.era==="modern"?Qm.era:Gm.era}function Mm(e){return i_.some((t)=>t.hasRequestMethod(e))}function Lm(e){return i_.some((t)=>t.hasNotificationMethod(e))}var i_=[Gm,Qm],wz=yp({AnnotationsSchema:()=>$t,AudioContentSchema:()=>Vr,BaseMetadataSchema:()=>St,BaseRequestParamsSchema:()=>ke,BlobResourceContentsSchema:()=>Vn,BooleanSchemaSchema:()=>Hn,CallToolRequestParamsSchema:()=>ua,CallToolRequestSchema:()=>da,CallToolResultSchema:()=>ar,CancelTaskRequestSchema:()=>hl,CancelTaskResultSchema:()=>gl,CancelledNotificationParamsSchema:()=>bo,CancelledNotificationSchema:()=>jn,ClientCapabilitiesSchema:()=>So,ClientNotificationSchema:()=>bl,ClientRequestSchema:()=>vl,ClientResultSchema:()=>_l,ClientTasksCapabilitySchema:()=>rl,CompatibilityCallToolResultSchema:()=>il,CompleteRequestParamsSchema:()=>Da,CompleteRequestSchema:()=>Ma,CompleteResultSchema:()=>La,ContentBlockSchema:()=>zt,CreateMessageRequestParamsSchema:()=>za,CreateMessageRequestSchema:()=>wa,CreateMessageResultSchema:()=>ka,CreateMessageResultWithToolsSchema:()=>xa,CreateTaskResultSchema:()=>sl,CursorSchema:()=>Tn,DiscoverRequestSchema:()=>ko,DiscoverResultSchema:()=>Un,ElicitRequestFormParamsSchema:()=>Br,ElicitRequestParamsSchema:()=>Ea,ElicitRequestSchema:()=>Ca,ElicitRequestURLParamsSchema:()=>Ta,ElicitResultSchema:()=>ja,ElicitationCompleteNotificationParamsSchema:()=>Oa,ElicitationCompleteNotificationSchema:()=>Na,EmbeddedResourceSchema:()=>Zr,EmptyResultSchema:()=>ir,EnumSchemaSchema:()=>Pa,GetPromptRequestParamsSchema:()=>ea,GetPromptRequestSchema:()=>ta,GetPromptResultSchema:()=>ia,GetTaskPayloadRequestSchema:()=>dl,GetTaskPayloadResultSchema:()=>ml,GetTaskRequestSchema:()=>ll,GetTaskResultSchema:()=>ul,IconSchema:()=>_o,IconsSchema:()=>Dt,ImageContentSchema:()=>qr,ImplementationSchema:()=>yt,InitializeRequestParamsSchema:()=>yo,InitializeRequestSchema:()=>$o,InitializeResultSchema:()=>zo,InitializedNotificationSchema:()=>wo,JSONArraySchema:()=>el,JSONObjectSchema:()=>ue,JSONRPCErrorResponseSchema:()=>Ur,JSONRPCMessageSchema:()=>Dr,JSONRPCNotificationSchema:()=>Nn,JSONRPCRequestSchema:()=>On,JSONRPCResponseSchema:()=>tl,JSONRPCResultResponseSchema:()=>Ar,JSONValueSchema:()=>Ut,LegacyTitledEnumSchemaSchema:()=>Kn,ListChangedOptionsBaseSchema:()=>ol,ListPromptsRequestSchema:()=>Xo,ListPromptsResultSchema:()=>Qo,ListResourceTemplatesRequestSchema:()=>Co,ListResourceTemplatesResultSchema:()=>Oo,ListResourcesRequestSchema:()=>To,ListResourcesResultSchema:()=>Eo,ListRootsRequestSchema:()=>Va,ListRootsResultSchema:()=>Za,ListTasksRequestSchema:()=>pl,ListTasksResultSchema:()=>fl,ListToolsRequestSchema:()=>ca,ListToolsResultSchema:()=>la,LoggingLevelSchema:()=>Jn,LoggingMessageNotificationParamsSchema:()=>ha,LoggingMessageNotificationSchema:()=>ga,ModelHintSchema:()=>va,ModelPreferencesSchema:()=>ba,MultiSelectEnumSchemaSchema:()=>Ra,NotificationSchema:()=>Re,NotificationsParamsSchema:()=>je,NumberSchemaSchema:()=>Hr,PaginatedRequestParamsSchema:()=>Ro,PaginatedRequestSchema:()=>Mt,PaginatedResultSchema:()=>Lt,PingRequestSchema:()=>Dn,PrimitiveSchemaDefinitionSchema:()=>Xn,ProgressNotificationParamsSchema:()=>Io,ProgressNotificationSchema:()=>Mn,ProgressSchema:()=>xo,ProgressTokenSchema:()=>Pn,PromptArgumentSchema:()=>Go,PromptListChangedNotificationSchema:()=>oa,PromptMessageSchema:()=>na,PromptReferenceSchema:()=>Ua,PromptSchema:()=>Yo,ReadResourceRequestParamsSchema:()=>No,ReadResourceRequestSchema:()=>jo,ReadResourceResultSchema:()=>Ao,RelatedTaskMetadataSchema:()=>vo,RequestIdSchema:()=>pt,RequestMetaSchema:()=>En,RequestSchema:()=>de,ResourceContentsSchema:()=>Ln,ResourceLinkSchema:()=>Fr,ResourceListChangedNotificationSchema:()=>Uo,ResourceRequestParamsSchema:()=>Mr,ResourceSchema:()=>Zn,ResourceTemplateReferenceSchema:()=>Aa,ResourceTemplateSchema:()=>Po,ResourceUpdatedNotificationParamsSchema:()=>Wo,ResourceUpdatedNotificationSchema:()=>Ko,ResultMetaObjectSchema:()=>Cn,ResultSchema:()=>me,RoleSchema:()=>qt,RootSchema:()=>qa,RootsListChangedNotificationSchema:()=>Fa,SamplingContentSchema:()=>ya,SamplingMessageContentBlockSchema:()=>tr,SamplingMessageSchema:()=>$a,ServerCapabilitiesSchema:()=>An,ServerNotificationSchema:()=>yl,ServerRequestSchema:()=>Sl,ServerResultSchema:()=>$l,ServerTasksCapabilitySchema:()=>nl,SetLevelRequestParamsSchema:()=>pa,SetLevelRequestSchema:()=>fa,SingleSelectEnumSchemaSchema:()=>Ia,StringSchemaSchema:()=>Jr,SubscribeRequestParamsSchema:()=>Do,SubscribeRequestSchema:()=>Mo,SubscriptionFilterSchema:()=>Fn,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Fo,SubscriptionsAcknowledgedNotificationSchema:()=>Jo,SubscriptionsListenRequestParamsSchema:()=>Vo,SubscriptionsListenRequestSchema:()=>Zo,SubscriptionsListenResultMetaSchema:()=>Ho,SubscriptionsListenResultSchema:()=>Bo,TaskAugmentedRequestParamsSchema:()=>nr,TaskCreationParamsSchema:()=>al,TaskMetadataSchema:()=>go,TaskSchema:()=>Vt,TaskStatusNotificationParamsSchema:()=>Ha,TaskStatusNotificationSchema:()=>cl,TaskStatusSchema:()=>Ja,TextContentSchema:()=>Lr,TextResourceContentsSchema:()=>qn,TitledMultiSelectEnumSchemaSchema:()=>Yn,TitledSingleSelectEnumSchemaSchema:()=>Wn,ToolAnnotationsSchema:()=>aa,ToolChoiceSchema:()=>_a,ToolExecutionSchema:()=>sa,ToolListChangedNotificationSchema:()=>ma,ToolResultContentSchema:()=>Sa,ToolSchema:()=>or,ToolUseContentSchema:()=>ra,UnsubscribeRequestParamsSchema:()=>Lo,UnsubscribeRequestSchema:()=>qo,UntitledMultiSelectEnumSchemaSchema:()=>Gn,UntitledSingleSelectEnumSchemaSchema:()=>Bn});var o_=(e)=>On.safeParse(e).success,a_=(e)=>Nn.safeParse(e).success,Jm=(e)=>Ar.safeParse(e).success,s_=(e)=>Ur.safeParse(e).success;var os=-32020,CT=[{rung:"http-method",order:1,evaluatedAt:"edge",codes:[-32000],conformance:[],rationale:"The modern era is POST-only; GET/DELETE are body-less 2025-era session operations and are method-routed to legacy serving (405 when legacy serving is not configured), before any body is read."},{rung:"jsonrpc-shape",order:2,evaluatedAt:"edge",codes:[G.InvalidRequest],conformance:["server-stateless"],rationale:"The body must be a JSON-RPC request or notification: posted responses and batch arrays containing a modern or invalid element are rejected before classification (element-wise batch rule); all-legacy arrays stay legacy traffic."},{rung:"era-classification",order:3,evaluatedAt:"edge",codes:[os,G.UnsupportedProtocolVersion],conformance:["server-stateless","http-header-validation","http-custom-header-server-validation"],rationale:"Body-primary era classification with the protocol-version header as a cross-check; a header/body disagreement is rejected with -32020 (HeaderMismatch), and an envelope-less request on a modern-only endpoint is answered with the unsupported-protocol-version error naming the supported revisions."},{rung:"envelope",order:4,evaluatedAt:"edge",codes:[G.InvalidParams],conformance:["server-stateless"],rationale:"A present envelope claim with a malformed envelope — and a missing envelope on a request whose protocol-version header names a modern revision — is an invalid-params rejection naming the offending or missing key(s); never a silent fall back to legacy handling. This is the only place an invalid-params rejection maps to HTTP 400."},{rung:"method-registry",order:5,evaluatedAt:"dispatch",codes:[G.MethodNotFound],conformance:["server-stateless"],rationale:"Method existence outranks parameter validity: a method absent from the negotiated revision’s registry (or with no handler installed) answers method-not-found before params or capabilities are looked at."},{rung:"request-params",order:6,evaluatedAt:"dispatch",codes:[G.InvalidParams],conformance:[],rationale:"Per-method params validation; emitted in-band by the dispatch layer (HTTP 200), never via the ladder status table."},{rung:"standard-header-validation",order:7,evaluatedAt:"pre-dispatch",codes:[os],conformance:["http-header-validation"],rationale:"SEP-2243 standard \`MCP-Protocol-Version\` / \`Mcp-Method\` / \`Mcp-Name\` headers — presence, sentinel decoding, and \`Mcp-Name\` ↔ body cross-check — are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before dispatch. The spec requires \`MCP-Protocol-Version\` and \`Mcp-Method\` on every modern *request* POST (\`Mcp-Name\` only for the methods that mirror \`params.name\` / \`params.uri\` / \`params.taskId\`, see \`MCP_NAME_HEADER_SOURCE\`) and names them in that order, so a request missing several is answered by the earliest. Notification POSTs are exempt: the presence half runs on requests only, so a modern-enveloped notification is dispatched even with no standard headers at all. The classifier’s own header-mismatch cells (protocol-version, \`Mcp-Method\` mismatch) stay on the edge \`era-classification\` rung; this rung carries the entry-layer presence/\`Mcp-Name\` half — including the missing \`MCP-Protocol-Version\` cell, which cannot live on the edge rung without breaking body-primary classification. Evaluated before the capability gate, the factory call, and the \`Mcp-Param-*\` rung so a request that fails several rungs is answered by the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request that also fails a dispatch rung is answered here before the dispatch rungs (5–6) are consulted."},{rung:"client-capabilities",order:8,evaluatedAt:"pre-dispatch",codes:[G.MissingRequiredClientCapability],conformance:["server-stateless"],rationale:"The capability requirement is checked by the HTTP entry, pre-dispatch, against the validated envelope the classifier produced — pinning the spec-mandated HTTP 400 independently of how dispatch- and handler-produced errors are mapped. The documented order (after method resolution and params validation) is preserved observably only while the requirement table is empty: once a served method gains a requirement entry, a request that is missing the capability and would also fail a dispatch rung is answered by this gate first, so the entry must consult the method registry before the gate if the documented precedence is to stay observable."},{rung:"param-header-validation",order:9,evaluatedAt:"pre-dispatch",codes:[os],conformance:["http-custom-header-server-validation"],rationale:"SEP-2243 \`Mcp-Param-*\` headers are validated against the named tool’s \`x-mcp-header\` declarations and the body \`arguments\` after the tool registry is known and before dispatch reaches the handler; a missing/disagreeing/malformed header is rejected 400 / -32020 with the same shape as the standard-header cross-checks. The documented order (after method resolution and params validation) is preserved observably only when the body \`arguments\` would otherwise validate: the check runs pre-dispatch, so a \`tools/call\` that fails BOTH this rung and a dispatch-time rung (e.g. order-6 \`request-params\`, -32602) is answered by this gate first with 400 / -32020, not by the earlier-ordered rung."}],OT={[G.ParseError]:400,[G.InvalidRequest]:400,[G.MethodNotFound]:404,[G.UnsupportedProtocolVersion]:400,[G.MissingRequiredClientCapability]:400,[os]:400};function tp(e,t){return Ac(e,t)}function ns(e){return new Set(e.flatMap((t)=>Object.keys(t.shape)))}function Hm(e){if(e==null)return!1;let t=typeof e;if(t!=="object"&&t!=="function")return!1;if(!("~standard"in e))return!1;return typeof e["~standard"]?.validate==="function"}var Ob=!1,Bm="draft-2020-12";function kz(e,t="input"){let r=e["~standard"],n;if(r.jsonSchema)n=r.jsonSchema[t]({target:Bm});else if(r.vendor==="zod"){if(!("_zod"in e))throw Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");if(!Ob)Ob=!0,console.warn("[mcp-sdk] Your zod version does not implement \`~standard.jsonSchema\` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.");n=so(e,{target:Bm,io:t})}else throw Error(\`Schema library "\${r.vendor}" does not implement StandardJSONSchemaV1 (\\\`~standard.jsonSchema\\\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().\`);if(t==="output"){if(n.type!==void 0)return n;return c_(n)?{type:"object",...n}:n}if(n.type!==void 0&&n.type!=="object")throw Error(\`MCP tool and prompt schemas must describe objects (got type: \${JSON.stringify(n.type)}). Wrap your schema in z.object({...}) or equivalent.\`);return{type:"object",...n}}function c_(e){if("properties"in e||"patternProperties"in e||"additionalProperties"in e||"required"in e)return!0;for(let t of["oneOf","anyOf","allOf"]){let r=e[t];if(Array.isArray(r)&&r.length>0)return r.every((n)=>n!==null&&typeof n==="object"&&(n.type==="object"||c_(n)))}return!1}function xz(e){if(!e.path?.length)return e.message;return\`\${e.path.map((t)=>String(typeof t==="object"?t.key:t)).join(".")}: \${e.message}\`}async function qm(e,t){let r=await e["~standard"].validate(t);if(r.issues&&r.issues.length>0)return{success:!1,error:r.issues.map((n)=>xz(n)).join(", ")};return{success:!0,data:r.value}}function Iz(e){let t=so(e,{target:Bm,io:"input"});return typeof t.pattern==="string"?t.pattern:void 0}var Rz=/\\\\\\.\\\\d\\{(\\d+)\\}/;function Pz(e){let t=Rz.exec(e),r=[void 0,-1,0];if(t)r.push(Number(t[1]));return[!1,!0].flatMap((n)=>[!1,!0].flatMap((i)=>r.map((o)=>ho({local:n,offset:i,precision:o}))))}function Tz(e,t){let r;switch(e){case"email":r=[pm()];break;case"uri":r=[uo()];break;case"date":r=[vb()];break;case"date-time":r=Pz(t);break}return new Set(r.map((n)=>Iz(n)).filter((n)=>n!==void 0))}function Ez(e,t,r){if(r!=="zod")return!0;return Tz(e,t).has(t)}function ss(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Cz(e){try{return kz(e,"input")}catch(t){let r=t instanceof Error?t.message:String(t);throw new Te(G.InvalidParams,\`Elicitation requestedSchema must describe an object with flat primitive properties: \${r}\`)}}var Oz=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function rp(e){return Oz.has(e)||e.startsWith("x-")}var Nz=new Set(["$schema",...Object.keys(Br.shape.requestedSchema.shape)]),Nb={string:ns([Jr,Bn,Wn,Kn]),number:ns([Hr]),integer:ns([Hr]),boolean:ns([Hn]),array:ns([Gn,Yn])},jz=new Set(Jr.shape.format.unwrap().options);function Az(e,t,r,n){if(!ss(e))return e;let i=typeof e.type==="string"&&Object.hasOwn(Nb,e.type)?Nb[e.type]:void 0;if(i===void 0)return e;let o={};for(let[a,c]of Object.entries(e))if(i.has(a)||rp(a))o[a]=c;else if(a==="pattern"&&e.type==="string"&&typeof e.format==="string"){if(!jz.has(e.format))o[a]=c;else if(typeof c!=="string"||!Ez(e.format,c,r))n.push(\`\${t}.\${a}\`)}else n.push(\`\${t}.\${a}\`);return o}function Uz(e,t){let r={},n=[];for(let[i,o]of Object.entries(e))if(i==="properties"&&ss(o))r[i]=Object.fromEntries(Object.entries(o).map(([a,c])=>[a,Az(c,\`properties.\${a}\`,t,n)]));else if(Nz.has(i))r[i]=o;else if(!rp(i))n.push(i);if(n.length>0)throw new Te(G.InvalidParams,\`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: \${n.join(", ")}\`);return r}function Dz(e,t){if(!ss(e.properties))return t;let r=Object.entries(e.properties).filter(([,n])=>!tp(Xn,n).success).map(([n])=>\`properties.\${n}\`);return r.length>0?r.join(", "):t}function Wm(e,t,r=""){if(Array.isArray(e)&&Array.isArray(t))return e.flatMap((n,i)=>Wm(n,t[i],\`\${r}[\${i}]\`));if(!ss(e)||!ss(t))return[];return Object.entries(e).flatMap(([n,i])=>{let o=r?\`\${r}.\${n}\`:n;if(!Object.prototype.hasOwnProperty.call(t,n))return rp(n)?[]:[o];return Wm(i,t[n],o)})}function Mz(e){if(!Hm(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let t=e.requestedSchema["~standard"].vendor,r=Uz(Cz(e.requestedSchema),t),n=tp(Br.shape.requestedSchema,r);if(!n.success)throw new Te(G.InvalidParams,\`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): \${Dz(r,n.error.message)}\`);let i=Wm(r,n.data);if(i.length>0)throw new Te(G.InvalidParams,\`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: \${i.join(", ")}\`);let o=(n.data.required??[]).filter((a)=>!Object.prototype.hasOwnProperty.call(n.data.properties,a));if(o.length>0)throw new Te(G.InvalidParams,\`Elicitation requestedSchema lists required properties that are not defined in properties: \${o.join(", ")}\`);return{...e,mode:"form",requestedSchema:n.data}}function Lz(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,r=typeof e.requestState==="string";if(!t&&!r)throw TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}var NT=Object.assign(Lz,{elicit(e){try{return{method:"elicitation/create",params:Mz(e)}}catch(t){throw t instanceof Te?TypeError(t.message,{cause:t}):t}},elicitUrl(e){return{method:"elicitation/create",params:{...e,mode:"url"}}},createMessage(e){return{method:"sampling/createMessage",params:e}},listRoots(){return{method:"roots/list"}}});var qz=["AnnotationsSchema","AudioContentSchema","BaseMetadataSchema","BlobResourceContentsSchema","BooleanSchemaSchema","CallToolRequestSchema","CallToolRequestParamsSchema","CallToolResultSchema","CancelledNotificationSchema","CancelledNotificationParamsSchema","CancelTaskRequestSchema","CancelTaskResultSchema","ClientCapabilitiesSchema","ClientNotificationSchema","ClientRequestSchema","ClientResultSchema","CompatibilityCallToolResultSchema","CompleteRequestSchema","CompleteRequestParamsSchema","CompleteResultSchema","ContentBlockSchema","CreateMessageRequestSchema","CreateMessageRequestParamsSchema","CreateMessageResultSchema","CreateMessageResultWithToolsSchema","CreateTaskResultSchema","CursorSchema","DiscoverRequestSchema","DiscoverResultSchema","ElicitationCompleteNotificationSchema","ElicitationCompleteNotificationParamsSchema","ElicitRequestSchema","ElicitRequestFormParamsSchema","ElicitRequestParamsSchema","ElicitRequestURLParamsSchema","ElicitResultSchema","EmbeddedResourceSchema","EmptyResultSchema","EnumSchemaSchema","GetPromptRequestSchema","GetPromptRequestParamsSchema","GetPromptResultSchema","GetTaskPayloadRequestSchema","GetTaskPayloadResultSchema","GetTaskRequestSchema","GetTaskResultSchema","IconSchema","IconsSchema","ImageContentSchema","ImplementationSchema","InitializedNotificationSchema","InitializeRequestSchema","InitializeRequestParamsSchema","InitializeResultSchema","JSONArraySchema","JSONObjectSchema","JSONRPCErrorResponseSchema","JSONRPCMessageSchema","JSONRPCNotificationSchema","JSONRPCRequestSchema","JSONRPCResponseSchema","JSONRPCResultResponseSchema","JSONValueSchema","LegacyTitledEnumSchemaSchema","ListPromptsRequestSchema","ListPromptsResultSchema","ListResourcesRequestSchema","ListResourcesResultSchema","ListResourceTemplatesRequestSchema","ListResourceTemplatesResultSchema","ListRootsRequestSchema","ListRootsResultSchema","ListTasksRequestSchema","ListTasksResultSchema","ListToolsRequestSchema","ListToolsResultSchema","LoggingLevelSchema","LoggingMessageNotificationSchema","LoggingMessageNotificationParamsSchema","ModelHintSchema","ModelPreferencesSchema","MultiSelectEnumSchemaSchema","NotificationSchema","NumberSchemaSchema","PaginatedRequestSchema","PaginatedRequestParamsSchema","PaginatedResultSchema","PingRequestSchema","PrimitiveSchemaDefinitionSchema","ProgressSchema","ProgressNotificationSchema","ProgressNotificationParamsSchema","ProgressTokenSchema","PromptSchema","PromptArgumentSchema","PromptListChangedNotificationSchema","PromptMessageSchema","PromptReferenceSchema","ReadResourceRequestSchema","ReadResourceRequestParamsSchema","ReadResourceResultSchema","RelatedTaskMetadataSchema","RequestSchema","RequestIdSchema","RequestMetaSchema","ResourceSchema","ResourceContentsSchema","ResourceLinkSchema","ResourceListChangedNotificationSchema","ResourceRequestParamsSchema","ResourceTemplateSchema","ResourceTemplateReferenceSchema","ResourceUpdatedNotificationSchema","ResourceUpdatedNotificationParamsSchema","ResultMetaObjectSchema","ResultSchema","RoleSchema","RootSchema","RootsListChangedNotificationSchema","SamplingContentSchema","SamplingMessageSchema","SamplingMessageContentBlockSchema","ServerCapabilitiesSchema","ServerNotificationSchema","ServerRequestSchema","ServerResultSchema","SetLevelRequestSchema","SetLevelRequestParamsSchema","SingleSelectEnumSchemaSchema","StringSchemaSchema","SubscribeRequestSchema","SubscribeRequestParamsSchema","SubscriptionFilterSchema","SubscriptionsAcknowledgedNotificationSchema","SubscriptionsAcknowledgedNotificationParamsSchema","SubscriptionsListenRequestSchema","SubscriptionsListenRequestParamsSchema","SubscriptionsListenResultSchema","SubscriptionsListenResultMetaSchema","TaskAugmentedRequestParamsSchema","TaskCreationParamsSchema","TaskMetadataSchema","TaskSchema","TaskStatusSchema","TaskStatusNotificationSchema","TaskStatusNotificationParamsSchema","TextContentSchema","TextResourceContentsSchema","TitledMultiSelectEnumSchemaSchema","TitledSingleSelectEnumSchemaSchema","ToolSchema","ToolAnnotationsSchema","ToolChoiceSchema","ToolExecutionSchema","ToolListChangedNotificationSchema","ToolResultContentSchema","ToolUseContentSchema","UnsubscribeRequestSchema","UnsubscribeRequestParamsSchema","UntitledMultiSelectEnumSchemaSchema","UntitledSingleSelectEnumSchemaSchema"],Vz={IdJagTokenExchangeResponseSchema:Ya,OAuthClientInformationFullSchema:ts,OAuthClientInformationSchema:es,OAuthClientMetadataSchema:Qa,OAuthClientRegistrationErrorSchema:zl,OAuthErrorResponseSchema:Xa,OAuthMetadataSchema:Qn,OAuthProtectedResourceMetadataSchema:Ba,OAuthTokenRevocationRequestSchema:wl,OAuthTokensSchema:Ga,OpenIdProviderDiscoveryMetadataSchema:Ka,OpenIdProviderMetadataSchema:Wa},l_={},u_={};function d_(e,t){let r=e.slice(0,-6);l_[r]=t,u_[r]=(n)=>t.safeParse(n).success}for(let e of qz)d_(e,wz[e]);for(let[e,t]of Object.entries(Vz))d_(e,t);var Zz=Object.freeze(l_),Fz=Object.freeze(u_);function Jz(e){switch(e){case"initialize":case"notifications/initialized":return as(void 0);case"server/discover":return as(ep);default:return}}var m_=60000,Hz=[Or,In,Nr,Rn],Bz=["inputResponses","requestState"];function jb(e,t){let r=e.params;if(!Vm(r))return{message:e,lifted:{}};let n=r._meta,i=Vm(n)?Hz.filter((l)=>(l in n)):[],o=t==="request"?Bz.filter((l)=>(l in r)):[];if(i.length===0&&o.length===0)return{message:e,lifted:{}};let a={},c={...r};if(i.length>0&&Vm(n)){let l={},u={...n};for(let m of i)l[m]=n[m],delete u[m];if(a.envelope=l,Object.keys(u).length>0)c._meta=u;else delete c._meta}for(let l of o){if(l==="inputResponses")a.inputResponses=c[l];if(l==="requestState")a.requestState=c[l];delete c[l]}return{message:{...e,params:c},lifted:a}}function Ab(e,t){let r=e.validateResult(t,void 0);if(!r.ok&&r.reason==="not-in-era")return;return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(n){let i=e.validateResult(t,n);if(i.ok)return{value:i.value};return{issues:[{message:i.reason==="invalid"?i.message:\`not-in-era: \${t}\`}]}}}}}function p_(e){return()=>e}var Wz=p_(void 0),Kz,np=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;static{Kz=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??Yc,this.setNotificationHandler("notifications/cancelled",(t)=>{this._oncancel(t)}),this.setNotificationHandler("notifications/progress",(t)=>{this._onprogress(t)}),this.setRequestHandler("ping",(t)=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let r=e.params??{};return{...e,params:{...r,_meta:{...t,...r._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new ve(Pe.UnsupportedResultType,\`Unsupported result type '\${e.kind}' for \${t.request.method}\`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){if(e.params.requestId===void 0)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,n,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:i,onTimeout:n})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new ve(Pe.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);if(t)clearTimeout(t.timeoutId),this._timeoutInfo.delete(e)}async connect(e){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{this._onclose()}};let r=this.transport?.onerror;this._transport.onerror=(i)=>{r?.(i),this._onerror(i)};let n=this._transport?.onmessage;this._transport.onmessage=(i,o)=>{if(n?.(i,o),Jm(i)||s_(i))this._onresponse(i);else if(o_(i))this._onrequest(i,o);else if(a_(i))this._onnotification(i,o);else this._onerror(Error(\`Unknown message type: \${JSON.stringify(i)}\`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._timeoutInfo.values())clearTimeout(n.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let r=new ve(Pe.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let n of e.values())n(r);for(let n of t.values())n.abort(r)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:r}=jb(e,"notification"),n=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop")return;if(t?.classification!==void 0){let a=Cb(t.classification);if(a!==n.era){this._onerror(Error(\`Era mismatch on inbound notification '\${r.method}': classified as \${a} but this instance serves \${n.era}\`));return}}if(Lm(r.method)&&!n.hasNotificationMethod(r.method))return;let i=this._notificationHandlers.get(r.method),o=this.fallbackNotificationHandler;if(i===void 0&&o===void 0)return;Promise.resolve().then(()=>i===void 0?o(r):i(r,n)).catch((a)=>this._onerror(Error(\`Uncaught error in notification handler: \${a}\`)))}_onrequest(e,t){let{message:r,lifted:n}=jb(e,"request"),i=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop"){this._onerror(Error(\`Dropped inbound request '\${e.method}': not servable on this connection's protocol era\`));return}let o=this._transport,a=(S,w,C)=>{let F={jsonrpc:"2.0",id:r.id,error:{code:S,message:w,...C!==void 0&&{data:C}}};o?.send(F).catch((D)=>this._onerror(Error(\`Failed to send an error response: \${D}\`)))};if(t?.classification!==void 0){let S=Cb(t.classification);if(S!==i.era){this._onerror(Error(\`Era mismatch on inbound request '\${r.method}': classified as \${S} but this instance serves \${i.era}\`));let w=t.classification.revision??S;a(G.UnsupportedProtocolVersion,\`Unsupported protocol version: \${w}\`,{supported:this._supportedProtocolVersions,requested:w});return}}if(Mm(r.method)&&!i.hasRequestMethod(r.method)){a(G.MethodNotFound,"Method not found");return}let c=this._requestHandlers.get(r.method)??this.fallbackRequestHandler;if(c===void 0){a(G.MethodNotFound,"Method not found");return}let l=i.checkInboundEnvelope(n);if(l!==void 0){a(G.InvalidParams,l);return}let u=(S,w)=>this._notificationViaCodec(this._resolveOutboundCodec(S.method),S,{...w,relatedRequestId:r.id}),m=(S,w,C)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(S.method),S,w,{...C,relatedRequestId:r.id}),f=new AbortController;this._requestHandlerAbortControllers.set(r.id,f);let h=n.inputResponses===void 0?void 0:Gz(n.inputResponses),b={sessionId:o?.sessionId,mcpReq:{id:r.id,method:r.method,_meta:r.params?._meta,...n.envelope!==void 0&&{envelope:n.envelope},...h!==void 0&&{inputResponses:h.accepted},...h!==void 0&&h.droppedKeys.length>0&&{droppedInputResponseKeys:h.droppedKeys},requestState:n.requestState===void 0?Wz:p_(n.requestState),signal:f.signal,send:(S,w,C)=>{let F=this._resolveOutboundCodec(S.method);if(this._assertOutboundRequestInEra(F,S.method),Hm(w))return m(S,w,C);let D=Ab(F,S.method);if(D===void 0)throw TypeError(\`'\${S.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().\`);return m(S,D,w)},notify:u},http:t?.authInfo?{authInfo:t.authInfo}:void 0},_=this.buildContext(b,t);Promise.resolve().then(()=>c(r,_)).then(async(S)=>{if(f.signal.aborted)return;let w;try{w=i.encodeResult(r.method,S,this._outboundServerInfo())}catch(F){this._onerror(Error(\`Failed to encode result for \${r.method}: \${F}\`)),a(G.InternalError,"Internal error");return}let C={result:w,jsonrpc:"2.0",id:r.id};await o?.send(C)},async(S)=>{if(f.signal.aborted)return;let w=Number.isSafeInteger(S.code)?S.code:G.InternalError,C={jsonrpc:"2.0",id:r.id,error:{code:i.encodeErrorCode(w),message:S.message??"Internal error",...S.data!==void 0&&{data:S.data}}};await o?.send(C)}).catch((S)=>this._onerror(Error(\`Failed to send response: \${S}\`))).finally(()=>{if(this._requestHandlerAbortControllers.get(r.id)===f)this._requestHandlerAbortControllers.delete(r.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,n=Number(t),i=this._progressHandlers.get(n);if(!i){this._onerror(Error(\`Received a progress notification for an unknown token: \${JSON.stringify(e)}\`));return}let o=this._responseHandlers.get(n),a=this._timeoutInfo.get(n);if(a&&o&&a.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(c){this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),o(c);return}i(r)}_onresponse(e){let t=Number(e.id),r=this._responseHandlers.get(t);if(r===void 0){this._onerror(Error(\`Received a response for an unknown message ID: \${JSON.stringify(e)}\`));return}if(this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),Jm(e))r(e);else r(Te.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,r){let n=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(n,e.method),Hm(t))return this._requestWithSchemaViaCodec(n,e,t,r);let i=Ab(n,e.method);if(i===void 0)throw TypeError(\`'\${e.method}' is not a spec method; pass a result schema as the second argument to request().\`);return this._requestWithSchemaViaCodec(n,e,i,t)}_negotiatedWireCodec(){return as(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=Jz(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(Mm(t)&&!e.hasRequestMethod(t))throw new ve(Pe.MethodNotSupportedByProtocolVersion,\`Method '\${t}' is not supported by the negotiated protocol version (wire era \${e.era})\`,{method:t,era:e.era})}_requestWithSchema(e,t,r){let n=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(n,e.method),this._requestWithSchemaViaCodec(n,e,t,r)}_requestWithSchemaViaCodec(e,t,r,n){let{relatedRequestId:i,resumptionToken:o,onresumptiontoken:a,headers:c}=n??{},l=Date.now(),u,m;return new Promise((f,h)=>{let b=(z)=>{h(z)};if(!this._transport){b(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(z){b(z);return}if(n?.signal?.aborted){let z=n.signal.reason;throw z instanceof ve?z:new ve(Pe.RequestTimeout,String(z))}let _=e.era===ep&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,S=this._requestMessageId++;m=S;let w={...t,jsonrpc:"2.0",id:S};if(n?.onprogress)this._progressHandlers.set(S,n.onprogress),w.params={...t.params,_meta:{...t.params?._meta,progressToken:S}};let C=this._envelopeOutbound(w),F=!1,D=(z)=>{if(F)return;if(this._progressHandlers.delete(S),_===void 0){if(t.method!=="initialize")this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:S,reason:String(z)}}),{relatedRequestId:i,resumptionToken:o,onresumptiontoken:a}).catch((R)=>this._onerror(Error(\`Failed to send cancellation: \${R}\`)))}else _.abort();h(z instanceof ve?z:new ve(Pe.RequestTimeout,String(z)))};this._responseHandlers.set(S,(z)=>{if(n?.signal?.aborted)return;if(F=!0,z instanceof Error)return h(z);let R;try{R=e.decodeResult(t.method,z.result)}catch(V){return h(V instanceof Error?V:Error(String(V)))}if(R.kind==="invalid")return h(R.error);if(R.kind==="input_required"){if(n?.allowInputRequired===!0)return f(Yz(R));let V={codec:e,request:t,resultSchema:r,options:n,flowStartedAt:l,retry:(ee,be)=>this._requestWithSchemaViaCodec(e,ee===void 0?{method:t.method}:{method:t.method,params:ee},r,be)};return f(this._resolveNonCompleteResult(R,V))}let H=R.result;qm(r,H).then((V)=>{if(V.success)f(V.data);else h(new ve(Pe.InvalidResult,\`Invalid result for \${t.method}: \${V.error}\`))},h)}),u=()=>D(n?.signal?.reason),n?.signal?.addEventListener("abort",u,{once:!0});let B=n?.timeout??m_,k=()=>D(new ve(Pe.RequestTimeout,"Request timed out",{timeout:B}));this._setupTimeout(S,B,n?.maxTotalTimeout,k,n?.resetTimeoutOnProgress??!1),this._transport.send(C,{relatedRequestId:i,resumptionToken:o,onresumptiontoken:a,headers:c,requestSignal:_?.signal}).catch((z)=>{this._progressHandlers.delete(S),h(z)})}).finally(()=>{if(u)n?.signal?.removeEventListener("abort",u);if(m!==void 0)this._responseHandlers.delete(m),this._cleanupTimeout(m)})}async notification(e,t){return this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,r){if(!this._transport)throw new ve(Pe.NotConnected,"Not connected");if(Lm(t.method)&&!e.hasNotificationMethod(t.method))throw new ve(Pe.MethodNotSupportedByProtocolVersion,\`Notification '\${t.method}' is not supported by the negotiated protocol version (wire era \${e.era})\`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let n=this._envelopeOutbound({jsonrpc:"2.0",...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&r?.relatedRequestId===void 0){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;this._transport?.send(n,r).catch((i)=>this._onerror(i))});return}await this._transport.send(n,r)}setRequestHandler(e,t,r){this.assertRequestHandlerCapability(e);let n;if(typeof t==="function"){if(!Mm(e))throw TypeError(\`'\${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().\`);n=(i,o)=>{let a=this._negotiatedWireCodec(),c=a.validateRequest(e,i);if(!c.ok&&c.reason==="not-in-era")c=a.validateInputRequest(e,i);if(!c.ok){if(c.reason==="not-in-era")throw new Te(G.InternalError,\`No wire schema for \${e} in the resolved era\`);throw Error(c.message)}return Promise.resolve(t(c.value,o))}}else if(r)n=async(i,o)=>{let a=await qm(t.params,{...i.params});if(!a.success)throw new Te(G.InvalidParams,\`Invalid params for \${e}: \${a.error}\`);return r(a.data,o)};else throw TypeError("setRequestHandler: handler is required");this._requestHandlers.set(e,this._wrapHandler(e,n))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(\`A request handler for \${e} already exists, which would be overridden\`)}setNotificationHandler(e,t,r){if(typeof t==="function"){if(!Lm(e))throw TypeError(\`'\${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().\`);this._notificationHandlers.set(e,(n,i)=>{let o=i.validateNotification(e,n);if(!o.ok){if(o.reason==="not-in-era")throw new Te(G.InternalError,\`No wire schema for \${e} in the resolved era\`);throw Error(o.message)}return Promise.resolve(t(o.value))});return}if(!r)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(e,async(n)=>{let i=await qm(t.params,{...n.params});if(!i.success)throw new Te(G.InvalidParams,\`Invalid params for notification \${e}: \${i.error}\`);await r(i.data,n)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Vm(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Ub(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Gz(e){let t={},r=[];if(!Ub(e))return{accepted:t,droppedKeys:r};for(let[n,i]of Object.entries(e)){if(!Ub(i)||"method"in i||"result"in i){r.push(n);continue}t[n]=i}return{accepted:t,droppedKeys:r}}function Yz(e){return{resultType:"input_required",inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState}}}/*!
4029
+ * content-type
4030
+ * Copyright(c) 2015 Douglas Christopher Wilson
4031
+ * MIT Licensed
4032
+ */var Xz=Sp((e)=>{var t=/; *([!#$%&'*+.^_\`|~0-9A-Za-z-]+) *= *("(?:[\\u000b\\u0020\\u0021\\u0023-\\u005b\\u005d-\\u007e\\u0080-\\u00ff]|\\\\[\\u000b\\u0020-\\u00ff])*"|[!#$%&'*+.^_\`|~0-9A-Za-z-]+) */g,r=/\\\\([\\u000b\\u0020-\\u00ff])/g,n=/^[!#$%&'*+.^_\`|~0-9A-Za-z-]+\\/[!#$%&'*+.^_\`|~0-9A-Za-z-]+$/;e.parse=i;function i(c){if(!c)throw TypeError("argument string is required");var l=typeof c==="object"?o(c):c;if(typeof l!=="string")throw TypeError("argument string is required to be a string");var u=l.indexOf(";"),m=u!==-1?l.slice(0,u).trim():l.trim();if(!n.test(m))throw TypeError("invalid media type");var f=new a(m.toLowerCase());if(u!==-1){var h,b,_;t.lastIndex=u;while(b=t.exec(l)){if(b.index!==u)throw TypeError("invalid parameter format");if(u+=b[0].length,h=b[1].toLowerCase(),_=b[2],_.charCodeAt(0)===34){if(_=_.slice(1,-1),_.indexOf("\\\\")!==-1)_=_.replace(r,"$1")}f.parameters[h]=_}if(u!==l.length)throw TypeError("invalid parameter format")}return f}function o(c){var l;if(typeof c.getHeader==="function")l=c.getHeader("content-type");else if(typeof c.headers==="object")l=c.headers&&c.headers["content-type"];if(typeof l!=="string")throw TypeError("content-type header is missing from object");return l}function a(c){this.parameters=Object.create(null),this.type=c}}),jT=$p(Xz(),1);var HT=typeof self<"u"&&self.location&&self.location.origin!=="null"?new URL(self.location.origin+self.location.pathname+location.search):new URL("https://github.com/cfworker");var Qz=/^(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)$/,ew=[0,31,28,31,30,31,30,31,31,30,31,30,31],tw=/^(\\d\\d):(\\d\\d):(\\d\\d)(\\.\\d+)?(z|[+-]\\d\\d(?::?\\d\\d)?)?$/i,rw=/^(?=.{1,253}\\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\\.?$/i,nw=/^(?:[a-z][a-z0-9+\\-.]*:)?(?:\\/?\\/(?:(?:[a-z0-9\\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\\.[a-z0-9\\-._~!$&'()*+,;=:]+)\\]|(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)|(?:[a-z0-9\\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\\d*)?(?:\\/(?:[a-z0-9\\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\\/(?:(?:[a-z0-9\\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\\/(?:[a-z0-9\\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\\/(?:[a-z0-9\\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\\?(?:[a-z0-9\\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,iw=/^(?:(?:[^\\x00-\\x20"'<>%\\\\^\`{|}]|%[0-9a-f]{2})|\\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\\*)?)*\\})*$/i,ow=/^(?:(?:https?|ftp):\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?!10(?:\\.\\d{1,3}){3})(?!127(?:\\.\\d{1,3}){3})(?!169\\.254(?:\\.\\d{1,3}){2})(?!192\\.168(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u{00a1}-\\u{ffff}0-9]+-?)*[a-z\\u{00a1}-\\u{ffff}0-9]+)(?:\\.(?:[a-z\\u{00a1}-\\u{ffff}0-9]+-?)*[a-z\\u{00a1}-\\u{ffff}0-9]+)*(?:\\.(?:[a-z\\u{00a1}-\\u{ffff}]{2,})))(?::\\d{2,5})?(?:\\/[^\\s]*)?$/iu,aw=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,sw=/^(?:\\/(?:[^~/]|~0|~1)*)*$/,cw=/^#(?:\\/(?:[a-z0-9_\\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,lw=/^(?:0|[1-9][0-9]*)(?:#|(?:\\/(?:[^~/]|~0|~1)*)*)$/,uw=(e)=>{if(e[0]==='"')return!1;let[t,r,...n]=e.split("@");if(!t||!r||n.length!==0||t.length>64||r.length>253)return!1;if(t[0]==="."||t.endsWith(".")||t.includes(".."))return!1;if(!/^[a-z0-9.-]+$/i.test(r)||!/^[a-z0-9.!#$%&'*+/=?^_\`{|}~-]+$/i.test(t))return!1;return r.split(".").every((i)=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(i))},dw=/^(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)$/,mw=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))$/i,pw=(e)=>e.length>1&&e.length<80&&(/^P\\d+([.,]\\d+)?W$/.test(e)||/^P[\\dYMDTHS]*(\\d[.,]\\d+)?[YMDHS]$/.test(e)&&/^P([.,\\d]+Y)?([.,\\d]+M)?([.,\\d]+D)?(T([.,\\d]+H)?([.,\\d]+M)?([.,\\d]+S)?)?$/.test(e));function wt(e){return e.test.bind(e)}var BT={date:f_,time:h_.bind(void 0,!1),"date-time":gw,duration:pw,uri:_w,"uri-reference":wt(nw),"uri-template":wt(iw),url:wt(ow),email:uw,hostname:wt(rw),ipv4:wt(dw),ipv6:wt(mw),regex:yw,uuid:wt(aw),"json-pointer":wt(sw),"json-pointer-uri-fragment":wt(cw),"relative-json-pointer":wt(lw)};function fw(e){return e%4===0&&(e%100!==0||e%400===0)}function f_(e){let t=e.match(Qz);if(!t)return!1;let r=+t[1],n=+t[2],i=+t[3];return n>=1&&n<=12&&i>=1&&i<=(n==2&&fw(r)?29:ew[n])}function h_(e,t){let r=t.match(tw);if(!r)return!1;let n=+r[1],i=+r[2],o=+r[3],a=!!r[5];return(n<=23&&i<=59&&o<=59||n==23&&i==59&&o==60)&&(!e||a)}var hw=/t|\\s/i;function gw(e){let t=e.split(hw);return t.length==2&&f_(t[0])&&h_(!0,t[1])}var vw=/\\/|:/,bw=/^(?:[a-z][a-z0-9+\\-.]*:)(?:\\/?\\/(?:(?:[a-z0-9\\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\\.[a-z0-9\\-._~!$&'()*+,;=:]+)\\]|(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)|(?:[a-z0-9\\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\\d*)?(?:\\/(?:[a-z0-9\\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\\/(?:(?:[a-z0-9\\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\\/(?:[a-z0-9\\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\\/(?:[a-z0-9\\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\\?(?:[a-z0-9\\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function _w(e){return vw.test(e)&&bw.test(e)}var Sw=/[^\\\\]\\\\Z/;function yw(e){if(Sw.test(e))return!1;try{return new RegExp(e,"u"),!0}catch(t){return!1}}var zw;zw=globalThis.crypto;class cs extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}var g_=10,ww=13,Gr=32;function ip(e){}function Pl(e){if(typeof e=="function")throw TypeError("\`config\` must be an object, got a function instead. Did you mean \`createParser({onEvent: fn})\`?");let{onEvent:t=ip,onError:r=ip,onRetry:n=ip,onComment:i,maxBufferSize:o}=e,a=[],c=0,l=!0,u,m="",f=0,h,b=!1;function _(k){if(b)throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call \`reset()\` to resume parsing.");if(l&&(l=!1,k.charCodeAt(0)===239&&k.charCodeAt(1)===187&&k.charCodeAt(2)===191&&(k=k.slice(3))),a.length===0){let H=w(k);H!==""&&(a.push(H),c=H.length),S();return}if(k.indexOf(\`
4033
+ \`)===-1&&k.indexOf("\\r")===-1){a.push(k),c+=k.length,S();return}a.push(k);let z=a.join("");a.length=0,c=0;let R=w(z);R!==""&&(a.push(R),c=R.length),S()}function S(){o!==void 0&&(c+m.length<=o||(b=!0,a.length=0,c=0,u=void 0,m="",f=0,h=void 0,r(new cs(\`Buffered data exceeded max buffer size of \${o} characters\`,{type:"max-buffer-size-exceeded"}))))}function w(k){let z=0;if(k.indexOf("\\r")===-1){let R=k.indexOf(\`
4034
+ \`,z);for(;R!==-1;){if(z===R){f>0&&t({id:u,event:h,data:m}),u=void 0,m="",f=0,h=void 0,z=R+1,R=k.indexOf(\`
4035
+ \`,z);continue}let H=k.charCodeAt(z);if(v_(k,z,H)){let V=k.charCodeAt(z+5)===Gr?z+6:z+5,ee=k.slice(V,R);if(f===0&&k.charCodeAt(R+1)===g_){t({id:u,event:h,data:ee}),u=void 0,m="",h=void 0,z=R+2,R=k.indexOf(\`
4036
+ \`,z);continue}m=f===0?ee:\`\${m}
4037
+ \${ee}\`,f++}else b_(k,z,H)?h=k.slice(k.charCodeAt(z+6)===Gr?z+7:z+6,R)||void 0:C(k,z,R);z=R+1,R=k.indexOf(\`
4038
+ \`,z)}return k.slice(z)}for(;z<k.length;){let R=k.indexOf("\\r",z),H=k.indexOf(\`
4039
+ \`,z),V=-1;if(R!==-1&&H!==-1?V=R<H?R:H:R!==-1?R===k.length-1?V=-1:V=R:H!==-1&&(V=H),V===-1)break;C(k,z,V),z=V+1,k.charCodeAt(z-1)===ww&&k.charCodeAt(z)===g_&&z++}return k.slice(z)}function C(k,z,R){if(z===R){D();return}let H=k.charCodeAt(z);if(v_(k,z,H)){let ce=k.charCodeAt(z+5)===Gr?z+6:z+5,_e=k.slice(ce,R);m=f===0?_e:\`\${m}
4040
+ \${_e}\`,f++;return}if(b_(k,z,H)){h=k.slice(k.charCodeAt(z+6)===Gr?z+7:z+6,R)||void 0;return}if(H===105&&k.charCodeAt(z+1)===100&&k.charCodeAt(z+2)===58){let ce=k.slice(k.charCodeAt(z+3)===Gr?z+4:z+3,R);ce.includes("\\x00")||(u=ce);return}if(H===58){if(i){let ce=k.slice(z,R);i(ce.slice(k.charCodeAt(z+1)===Gr?2:1))}return}let V=k.slice(z,R),ee=V.indexOf(":");if(ee===-1){F(V,"",V);return}let be=V.slice(0,ee),Ae=V.charCodeAt(ee+1)===Gr?2:1,Ce=V.slice(ee+Ae);F(be,Ce,V)}function F(k,z,R){switch(k){case"event":h=z||void 0;break;case"data":m=f===0?z:\`\${m}
4041
+ \${z}\`,f++;break;case"id":z.includes("\\x00")||(u=z);break;case"retry":/^\\d+$/.test(z)?n(parseInt(z,10)):r(new cs(\`Invalid \\\`retry\\\` value: "\${z}"\`,{type:"invalid-retry",value:z,line:R}));break;default:r(new cs(\`Unknown field "\${k.length>20?\`\${k.slice(0,20)}…\`:k}"\`,{type:"unknown-field",field:k,value:z,line:R}));break}}function D(){f>0&&t({id:u,event:h,data:m}),u=void 0,m="",f=0,h=void 0}function B(k={}){if(k.consume&&a.length>0){let z=a.join("");C(z,0,z.length)}l=!0,u=void 0,m="",f=0,h=void 0,a.length=0,c=0,b=!1}return{feed:_,reset:B}}function v_(e,t,r){return r===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function b_(e,t,r){return r===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}class op extends Event{constructor(e,t){var r,n;super(e),this.code=(r=t==null?void 0:t.code)!=null?r:void 0,this.message=(n=t==null?void 0:t.message)!=null?n:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,t,r){return r(__(this),t)}[Symbol.for("Deno.customInspect")](e,t){return e(__(this),t)}}function kw(e){let t=globalThis.DOMException;return typeof t=="function"?new t(e,"SyntaxError"):SyntaxError(e)}function ap(e){return e instanceof Error?"errors"in e&&Array.isArray(e.errors)?e.errors.map(ap).join(", "):("cause"in e)&&e.cause instanceof Error?\`\${e}: \${ap(e.cause)}\`:e.message:\`\${e}\`}function __(e){return{type:e.type,message:e.message,code:e.code,defaultPrevented:e.defaultPrevented,cancelable:e.cancelable,timeStamp:e.timeStamp}}var y_=(e)=>{throw TypeError(e)},fp=(e,t,r)=>t.has(e)||y_("Cannot "+r),Y=(e,t,r)=>(fp(e,t,"read from private field"),r?r.call(e):t.get(e)),$e=(e,t,r)=>t.has(e)?y_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),se=(e,t,r,n)=>(fp(e,t,"write to private field"),t.set(e,r),r),Zt=(e,t,r)=>(fp(e,t,"access private method"),r),We,Yr,ei,Tl,El,ds,ni,ms,sr,ti,ii,ri,ls,ft,sp,cp,lp,S_,up,dp,us,mp,pp;class ps extends EventTarget{constructor(e,t){var r,n;super(),$e(this,ft),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,$e(this,We),$e(this,Yr),$e(this,ei),$e(this,Tl),$e(this,El),$e(this,ds),$e(this,ni),$e(this,ms,null),$e(this,sr),$e(this,ti),$e(this,ii,null),$e(this,ri,null),$e(this,ls,null),$e(this,cp,async(i)=>{var o;Y(this,ti).reset();let{body:a,redirected:c,status:l,headers:u}=i;if(l===204){Zt(this,ft,us).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?se(this,ei,new URL(i.url)):se(this,ei,void 0),l!==200){Zt(this,ft,us).call(this,\`Non-200 status code (\${l})\`,l);return}if(!(u.get("content-type")||"").startsWith("text/event-stream")){Zt(this,ft,us).call(this,'Invalid content type, expected "text/event-stream"',l);return}if(Y(this,We)===this.CLOSED)return;se(this,We,this.OPEN);let m=new Event("open");if((o=Y(this,ls))==null||o.call(this,m),this.dispatchEvent(m),typeof a!="object"||!a||!("getReader"in a)){Zt(this,ft,us).call(this,"Invalid response body, expected a web ReadableStream",l),this.close();return}let f=new TextDecoder,h=a.getReader(),b=!0;do{let{done:_,value:S}=await h.read();S&&Y(this,ti).feed(f.decode(S,{stream:!_})),_&&(b=!1,Y(this,ti).reset(),Zt(this,ft,mp).call(this))}while(b)}),$e(this,lp,(i)=>{se(this,sr,void 0),!(i.name==="AbortError"||i.type==="aborted")&&Zt(this,ft,mp).call(this,ap(i))}),$e(this,up,(i)=>{typeof i.id=="string"&&se(this,ms,i.id);let o=new MessageEvent(i.event||"message",{data:i.data,origin:Y(this,ei)?Y(this,ei).origin:Y(this,Yr).origin,lastEventId:i.id||""});Y(this,ri)&&(!i.event||i.event==="message")&&Y(this,ri).call(this,o),this.dispatchEvent(o)}),$e(this,dp,(i)=>{se(this,ds,i)}),$e(this,pp,()=>{se(this,ni,void 0),Y(this,We)===this.CONNECTING&&Zt(this,ft,sp).call(this)});try{if(e instanceof URL)se(this,Yr,e);else if(typeof e=="string")se(this,Yr,new URL(e,xw()));else throw Error("Invalid URL")}catch{throw kw("An invalid or illegal string was specified")}se(this,ti,Pl({onEvent:Y(this,up),onRetry:Y(this,dp)})),se(this,We,this.CONNECTING),se(this,ds,3000),se(this,El,(r=t==null?void 0:t.fetch)!=null?r:globalThis.fetch),se(this,Tl,(n=t==null?void 0:t.withCredentials)!=null?n:!1),Zt(this,ft,sp).call(this)}get readyState(){return Y(this,We)}get url(){return Y(this,Yr).href}get withCredentials(){return Y(this,Tl)}get onerror(){return Y(this,ii)}set onerror(e){se(this,ii,e)}get onmessage(){return Y(this,ri)}set onmessage(e){se(this,ri,e)}get onopen(){return Y(this,ls)}set onopen(e){se(this,ls,e)}addEventListener(e,t,r){let n=t;super.addEventListener(e,n,r)}removeEventListener(e,t,r){let n=t;super.removeEventListener(e,n,r)}close(){Y(this,ni)&&clearTimeout(Y(this,ni)),Y(this,We)!==this.CLOSED&&(Y(this,sr)&&Y(this,sr).abort(),se(this,We,this.CLOSED),se(this,sr,void 0))}}We=new WeakMap,Yr=new WeakMap,ei=new WeakMap,Tl=new WeakMap,El=new WeakMap,ds=new WeakMap,ni=new WeakMap,ms=new WeakMap,sr=new WeakMap,ti=new WeakMap,ii=new WeakMap,ri=new WeakMap,ls=new WeakMap,ft=new WeakSet,sp=function(){se(this,We,this.CONNECTING),se(this,sr,new AbortController),Y(this,El)(Y(this,Yr),Zt(this,ft,S_).call(this)).then(Y(this,cp)).catch(Y(this,lp))},cp=new WeakMap,lp=new WeakMap,S_=function(){var e;let t={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Y(this,ms)?{"Last-Event-ID":Y(this,ms)}:void 0},cache:"no-store",signal:(e=Y(this,sr))==null?void 0:e.signal};return"window"in globalThis&&(t.credentials=this.withCredentials?"include":"same-origin"),t},up=new WeakMap,dp=new WeakMap,us=function(e,t){var r;Y(this,We)!==this.CLOSED&&se(this,We,this.CLOSED);let n=new op("error",{code:t,message:e});(r=Y(this,ii))==null||r.call(this,n),this.dispatchEvent(n)},mp=function(e,t){var r;if(Y(this,We)===this.CLOSED)return;se(this,We,this.CONNECTING);let n=new op("error",{code:t,message:e});(r=Y(this,ii))==null||r.call(this,n),this.dispatchEvent(n),se(this,ni,setTimeout(Y(this,pp),Y(this,ds)))},pp=new WeakMap,ps.CONNECTING=0,ps.OPEN=1,ps.CLOSED=2;function xw(){let e="document"in globalThis?globalThis.document:void 0;return e&&typeof e=="object"&&"baseURI"in e&&typeof e.baseURI=="string"?e.baseURI:void 0}class $_ extends TransformStream{constructor({onError:e,onRetry:t,onComment:r,maxBufferSize:n}={}){let i;super({start(o){i=Pl({onEvent:(a)=>{o.enqueue(a)},onError(a){typeof e=="function"&&e(a),(e==="terminate"||a.type==="max-buffer-size-exceeded")&&o.error(a)},onRetry:t,onComment:r,maxBufferSize:n})},transform(o){i.feed(o)}})}}var fs=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthClientFlowError"})}static[Symbol.hasInstance](e){return et(this,e)}static isInstance(e){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. \`SdkError.isInstance(value)\`); for callbacks use \`v => SdkError.isInstance(v)\`");return et(this,e)}constructor(e){super(e);this.name=new.target.name,Kr(this,new.target)}},HE=class extends fs{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.IssuerMismatchError"})}kind;expected;received;constructor(e,t,r){super(\`Issuer mismatch in \${e==="metadata"?"authorization server metadata (RFC 8414 §3.3)":"authorization response (RFC 9207)"}: expected \${JSON.stringify(t)}, received \${JSON.stringify(r)}\`);this.kind=e,this.expected=t,this.received=r}},BE=class extends fs{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.RegistrationRejectedError"})}status;body;submittedMetadata;constructor(e){super(\`Dynamic Client Registration rejected (HTTP \${e.status}): \${e.body}\`);this.status=e.status,this.body=e.body,this.submittedMetadata=e.submittedMetadata}},WE=class extends fs{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsecureTokenEndpointError"})}tokenEndpoint;constructor(e){super(\`Refusing to send credentials to non-https token endpoint '\${e}'. OAuth token requests MUST use TLS (localhost / 127.0.0.1 / ::1 are exempt).\`);this.tokenEndpoint=e}},KE=class extends fs{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.AuthorizationServerMismatchError"})}constructor(e,t){super(\`Authorization server changed between redirect and callback (redirected to \${JSON.stringify(e)}, callback resolved \${JSON.stringify(t)}); refusing to send authorization_code/code_verifier to a different token endpoint\`);this.recordedIssuer=e,this.currentIssuer=t}},GE=class extends fs{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsufficientScopeError"})}requiredScope;resourceMetadataUrl;errorDescription;constructor(e){super(\`Insufficient scope\${e.requiredScope?\`: required "\${e.requiredScope}"\`:""}\`);this.requiredScope=e.requiredScope,this.resourceMetadataUrl=e.resourceMetadataUrl,this.errorDescription=e.errorDescription}};var YE=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnauthorizedError"})}static[Symbol.hasInstance](e){return et(this,e)}static isInstance(e){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. \`SdkError.isInstance(value)\`); for callbacks use \`v => SdkError.isInstance(v)\`");return et(this,e)}constructor(e){super(e??"Unauthorized");this.name="UnauthorizedError",Kr(this,new.target)}};var XE=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SseError"})}static[Symbol.hasInstance](e){return et(this,e)}static isInstance(e){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. \`SdkError.isInstance(value)\`); for callbacks use \`v => SdkError.isInstance(v)\`");return et(this,e)}constructor(e,t,r){super(\`SSE error: \${t}\`);this.code=e,this.event=r,Kr(this,new.target)}};class R_{_eventSlots=new Map;setHandler(e,t){let r=this._ensureEventSlot(e);if(r.onHandler&&t)console.warn(\`[MCP Apps] on\${String(e)} handler replaced. Use addEventListener("\${String(e)}", …) to add multiple listeners without replacing.\`);r.onHandler=t}getHandler(e){return this._eventSlots.get(e)?.onHandler}addEventListener(e,t){this._ensureEventSlot(e).listeners.push(t)}removeEventListener(e,t){let r=this._eventSlots.get(e);if(!r)return;let n=r.listeners.indexOf(t);if(n!==-1)r.listeners.splice(n,1)}dispatch(e,t){let r=this._eventSlots.get(e);if(!r)return;r.onHandler?.(t);for(let n of[...r.listeners])n(t)}_ensureEventSlot(e){let t=this._eventSlots.get(e);if(!t)t={listeners:[]},this._eventSlots.set(e,t);return t}}class P_{_methods=new Set;claim(e,t){if(this._methods.has(e))throw Error(\`Handler for "\${e}" already registered (via \${t}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.\`);this._methods.add(e)}replace(e){this._methods.add(e)}release(e){this._methods.delete(e)}has(e){return this._methods.has(e)}}var z_=new Set;function w_(e,t){let[r,n]=t,i=r?.shape;if(typeof i?.method?.value!=="string")return;let o=i.method.value,a=e==="request"?"setRequestHandler":"setNotificationHandler";if(!z_.has(a))z_.add(a),console.warn(\`[ext-apps] \${a}(Schema, handler) is deprecated; use \${a}("\${o}", { params: Schema.shape.params }, handler).\`);let c=n;return[o,{params:i.params},e==="request"?(l,u)=>c({method:o,params:l},Iw(u)):(l)=>c({method:o,params:l})]}function Iw(e){return{signal:e.mcpReq.signal,requestId:e.mcpReq.id,sessionId:e.sessionId,_meta:e.mcpReq._meta,sendRequest:e.mcpReq.send,sendNotification:e.mcpReq.notify,authInfo:e.http?.authInfo}}var Rw="2026-01-26";var Pw="ui/notifications/tool-input-partial";class T_{eventTarget;eventSource;messageListener;constructor(e=window.parent,t){this.eventTarget=e,this.eventSource=t,this.messageListener=(r)=>{if(t&&r.source!==this.eventSource){console.debug("Ignoring message from unknown source",r);return}let n=Dr.safeParse(r.data);if(n.success)console.debug("Parsed message",n.data),this.onmessage?.(n.data);else if(r.data?.jsonrpc!=="2.0")console.debug("Ignoring non-JSON-RPC message",n.error.message,r);else console.error("Failed to parse message",n.error.message,r),this.onerror?.(Error("Invalid JSON-RPC message received: "+n.error.message))}}async start(){window.addEventListener("message",this.messageListener)}async send(e,t){if(e.method!==Pw)console.debug("Sending message",e);this.eventTarget.postMessage(e,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}var Tw=P([p("light"),p("dark")]).describe("Color theme preference for the host environment."),hs=P([p("inline"),p("fullscreen"),p("pip")]).describe("Display mode for UI presentation."),Ew=P([p("--color-background-primary"),p("--color-background-secondary"),p("--color-background-tertiary"),p("--color-background-inverse"),p("--color-background-ghost"),p("--color-background-info"),p("--color-background-danger"),p("--color-background-success"),p("--color-background-warning"),p("--color-background-disabled"),p("--color-text-primary"),p("--color-text-secondary"),p("--color-text-tertiary"),p("--color-text-inverse"),p("--color-text-ghost"),p("--color-text-info"),p("--color-text-danger"),p("--color-text-success"),p("--color-text-warning"),p("--color-text-disabled"),p("--color-border-primary"),p("--color-border-secondary"),p("--color-border-tertiary"),p("--color-border-inverse"),p("--color-border-ghost"),p("--color-border-info"),p("--color-border-danger"),p("--color-border-success"),p("--color-border-warning"),p("--color-border-disabled"),p("--color-ring-primary"),p("--color-ring-secondary"),p("--color-ring-inverse"),p("--color-ring-info"),p("--color-ring-danger"),p("--color-ring-success"),p("--color-ring-warning"),p("--font-sans"),p("--font-mono"),p("--font-weight-normal"),p("--font-weight-medium"),p("--font-weight-semibold"),p("--font-weight-bold"),p("--font-text-xs-size"),p("--font-text-sm-size"),p("--font-text-md-size"),p("--font-text-lg-size"),p("--font-heading-xs-size"),p("--font-heading-sm-size"),p("--font-heading-md-size"),p("--font-heading-lg-size"),p("--font-heading-xl-size"),p("--font-heading-2xl-size"),p("--font-heading-3xl-size"),p("--font-text-xs-line-height"),p("--font-text-sm-line-height"),p("--font-text-md-line-height"),p("--font-text-lg-line-height"),p("--font-heading-xs-line-height"),p("--font-heading-sm-line-height"),p("--font-heading-md-line-height"),p("--font-heading-lg-line-height"),p("--font-heading-xl-line-height"),p("--font-heading-2xl-line-height"),p("--font-heading-3xl-line-height"),p("--border-radius-xs"),p("--border-radius-sm"),p("--border-radius-md"),p("--border-radius-lg"),p("--border-radius-xl"),p("--border-radius-full"),p("--border-width-regular"),p("--shadow-hairline"),p("--shadow-sm"),p("--shadow-md"),p("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),Cw=I(Ew.describe(\`Style variables for theming MCP apps.
4042
+
4043
+ Individual style keys are optional - hosts may provide any subset of these values.
4044
+ Values are strings containing CSS values (colors, sizes, font stacks, etc.).
4045
+
4046
+ Note: This type uses \\\`Record<K, string | undefined>\\\` rather than \\\`Partial<Record<K, string>>\\\`
4047
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.\`),P([s(),Vc()]).describe(\`Style variables for theming MCP apps.
4048
+
4049
+ Individual style keys are optional - hosts may provide any subset of these values.
4050
+ Values are strings containing CSS values (colors, sizes, font stacks, etc.).
4051
+
4052
+ Note: This type uses \\\`Record<K, string | undefined>\\\` rather than \\\`Partial<Record<K, string>>\\\`
4053
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.\`)).describe(\`Style variables for theming MCP apps.
4054
+
4055
+ Individual style keys are optional - hosts may provide any subset of these values.
4056
+ Values are strings containing CSS values (colors, sizes, font stacks, etc.).
4057
+
4058
+ Note: This type uses \\\`Record<K, string | undefined>\\\` rather than \\\`Partial<Record<K, string>>\\\`
4059
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.\`),h0=d({method:p("ui/open-link"),params:d({url:s().describe("URL to open in the host's browser")})}),Ow=d({isError:T().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),Nw=d({isError:T().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),jw=d({isError:T().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough(),g0=d({method:p("ui/notifications/sandbox-proxy-ready"),params:d({})}),hp=d({connectDomains:v(s()).optional().describe(\`Origins for network requests (fetch/XHR/WebSocket).
4060
+
4061
+ - Maps to CSP \\\`connect-src\\\` directive
4062
+ - Empty or omitted → no network connections (secure default)\`),resourceDomains:v(s()).optional().describe("Origins for static resources (images, scripts, stylesheets, fonts, media).\\n\\n- Maps to CSP \`img-src\`, \`script-src\`, \`style-src\`, \`font-src\`, \`media-src\` directives\\n- Wildcard subdomains supported: \`https://*.example.com\`\\n- Empty or omitted → no network resources (secure default)"),frameDomains:v(s()).optional().describe("Origins for nested iframes.\\n\\n- Maps to CSP \`frame-src\` directive\\n- Empty or omitted → no nested iframes allowed (\`frame-src 'none'\`)"),baseUriDomains:v(s()).optional().describe("Allowed base URIs for the document.\\n\\n- Maps to CSP \`base-uri\` directive\\n- Empty or omitted → only same origin allowed (\`base-uri 'self'\`)")}),gp=d({camera:d({}).optional().describe("Request camera access.\\n\\nMaps to Permission Policy \`camera\` feature."),microphone:d({}).optional().describe("Request microphone access.\\n\\nMaps to Permission Policy \`microphone\` feature."),geolocation:d({}).optional().describe("Request geolocation access.\\n\\nMaps to Permission Policy \`geolocation\` feature."),clipboardWrite:d({}).optional().describe("Request clipboard write access.\\n\\nMaps to Permission Policy \`clipboard-write\` feature.")}),v0=d({method:p("ui/notifications/size-changed"),params:d({width:y().optional().describe("New width in pixels."),height:y().optional().describe("New height in pixels.")})}),Aw=d({method:p("ui/notifications/tool-input"),params:d({arguments:I(s(),O().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),Uw=d({method:p("ui/notifications/tool-input-partial"),params:d({arguments:I(s(),O().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),Dw=d({method:p("ui/notifications/tool-cancelled"),params:d({reason:s().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),Mw=d({fonts:s().optional()}),Lw=d({variables:Cw.optional().describe("CSS variables for theming the app."),css:Mw.optional().describe("CSS blocks that apps can inject.")}),qw=d({method:p("ui/resource-teardown"),params:d({})}),Vw=I(s(),O()),k_=d({text:d({}).optional().describe("Host supports text content blocks."),image:d({}).optional().describe("Host supports image content blocks."),audio:d({}).optional().describe("Host supports audio content blocks."),resource:d({}).optional().describe("Host supports resource content blocks."),resourceLink:d({}).optional().describe("Host supports resource link content blocks."),structuredContent:d({}).optional().describe("Host supports structured content.")}),b0=d({method:p("ui/notifications/request-teardown"),params:d({}).optional()}),Zw=d({experimental:I(s(),I(s(),po()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),openLinks:d({}).optional().describe("Host supports opening external URLs."),downloadFile:d({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:d({listChanged:T().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:d({listChanged:T().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:d({}).optional().describe("Host accepts log messages."),sandbox:d({permissions:gp.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:hp.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:k_.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:k_.optional().describe("Host supports receiving content messages (ui/message) from the view."),sampling:d({tools:d({}).optional().describe("Host supports tool use via \`tools\` and \`toolChoice\` parameters.")}).optional().describe("Host supports LLM sampling (sampling/createMessage) from the view.\\nMirrors the MCP \`ClientCapabilities.sampling\` shape so hosts can pass it through.")}),Fw=d({experimental:I(s(),I(s(),po()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),tools:d({listChanged:T().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:v(hs).optional().describe("Display modes the app supports.")}),_0=d({method:p("ui/notifications/initialized"),params:d({}).optional()}),S0=d({csp:hp.optional().describe("Content Security Policy configuration for UI resources."),permissions:gp.optional().describe("Sandbox permissions requested by the UI resource."),domain:s().optional().describe(\`Dedicated origin for view sandbox.
4063
+
4064
+ Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
4065
+
4066
+ **Host-dependent:** The format and validation rules for this field are determined by each host. Servers MUST consult host-specific documentation for the expected domain format. Common patterns include:
4067
+ - Hash-based subdomains (e.g., \\\`{hash}.claudemcpcontent.com\\\`)
4068
+ - URL-derived subdomains (e.g., \\\`www-example-com.oaiusercontent.com\\\`)
4069
+
4070
+ If omitted, host uses default sandbox origin (typically per-conversation).\`),prefersBorder:T().optional().describe(\`Visual boundary preference - true if view prefers a visible border.
4071
+
4072
+ Boolean requesting whether a visible border and background is provided by the host. Specifying an explicit value for this is recommended because hosts' defaults may vary.
4073
+
4074
+ - \\\`true\\\`: request visible border + background
4075
+ - \\\`false\\\`: request no visible border + background
4076
+ - omitted: host decides border\`)}),y0=d({method:p("ui/request-display-mode"),params:d({mode:hs.describe("The display mode being requested.")})}),Jw=d({mode:hs.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),Hw=P([p("model"),p("app")]).describe("Tool visibility scope - who can access the tool."),$0=d({resourceUri:s().optional(),visibility:v(Hw).optional().describe(\`Who can access this tool. Default: ["model", "app"]
4077
+ - "model": Tool visible to and callable by the agent
4078
+ - "app": Tool callable by the app from this server only\`),csp:fo().optional(),permissions:fo().optional()}),z0=d({mimeTypes:v(s()).optional().describe('Array of supported MIME types for UI resources.\\nMust include \`"text/html;profile=mcp-app"\` for MCP Apps support.')}),w0=d({method:p("ui/download-file"),params:d({contents:v(P([Zr,Fr])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),k0=d({method:p("ui/message"),params:d({role:p("user").describe('Message role, currently only "user" is supported.'),content:v(zt).describe("Message content blocks (text, image, etc.).")})}),x0=d({method:p("ui/notifications/sandbox-resource-ready"),params:d({html:s().describe("HTML content to load into the inner iframe."),sandbox:s().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:hp.optional().describe("CSP configuration from resource metadata."),permissions:gp.optional().describe("Sandbox permissions from resource metadata.")})}),Bw=d({method:p("ui/notifications/tool-result"),params:ar.describe("Standard MCP tool execution result.")}),E_=d({toolInfo:d({id:pt.optional().describe("JSON-RPC id of the tools/call request."),tool:or.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:Tw.optional().describe("Current color theme preference."),styles:Lw.optional().describe("Style configuration for theming the app."),displayMode:hs.optional().describe("How the UI is currently displayed."),availableDisplayModes:v(hs).optional().describe("Display modes the host supports."),containerDimensions:P([d({height:y().describe("Fixed container height in pixels.")}),d({maxHeight:P([y(),Vc()]).optional().describe("Maximum container height in pixels.")})]).and(P([d({width:y().describe("Fixed container width in pixels.")}),d({maxWidth:P([y(),Vc()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(\`Container dimensions. Represents the dimensions of the iframe or other
4079
+ container holding the app. Specify either width or maxWidth, and either height or maxHeight.\`),locale:s().optional().describe("User's language and region preference in BCP 47 format."),timeZone:s().optional().describe("User's timezone in IANA format."),userAgent:s().optional().describe("Host application identifier."),platform:P([p("web"),p("desktop"),p("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:d({touch:T().optional().describe("Whether the device supports touch input."),hover:T().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:d({top:y().describe("Top safe area inset in pixels."),right:y().describe("Right safe area inset in pixels."),bottom:y().describe("Bottom safe area inset in pixels."),left:y().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),Ww=d({method:p("ui/notifications/host-context-changed"),params:E_.describe("Partial context update containing only changed fields.")}),I0=d({method:p("ui/update-model-context"),params:d({content:v(zt).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:I(s(),O().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),R0=d({method:p("ui/initialize"),params:d({appInfo:yt.describe("App identification (name and version)."),appCapabilities:Fw.describe("Features and capabilities this app provides."),protocolVersion:s().describe("Protocol version this app supports.")})}),Kw=d({protocolVersion:s().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:yt.describe("Host application identification and version."),hostCapabilities:Zw.describe("Features and capabilities provided by the host."),hostContext:E_.describe("Rich context about the host environment.")}).passthrough(),Gw={target:"draft-2020-12"};async function x_(e,t){let r=e["~standard"];if(r.jsonSchema)return r.jsonSchema[t](Gw);throw Error(\`Schema (vendor: \${r.vendor}) does not implement Standard JSON Schema (~standard.jsonSchema). Use a library that does (zod v4, ArkType, Valibot) or wrap your schema accordingly.\`)}async function I_(e,t,r=""){let n=await e["~standard"].validate(t);if(n.issues){let i=n.issues.map((o)=>{let a=o.path?.map((c)=>typeof c==="object"?c.key:c).join(".");return a?\`\${a}: \${o.message}\`:o.message}).join("; ");throw Error(r+i)}return n.value}function C_(e,t=document.documentElement){for(let[r,n]of Object.entries(e))if(n!==void 0)t.style.setProperty(r,n)}function Yw(e,t){let r={...e,...t};if(t.experimental!==void 0)r.experimental={...e.experimental,...t.experimental};if(t.tools!==void 0)r.tools={...e.tools,...t.tools};return r}class Cl extends np{_appInfo;_appCapabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_registeredEvents=new Set;_events=new R_;_methods=new P_;setRequestHandler=(...e)=>{let[t,...r]=w_("request",e)??e;this._methods.claim(t,"setRequestHandler"),super.setRequestHandler.call(this,t,...r)};setNotificationHandler=(...e)=>{let[t,...r]=w_("notification",e)??e;this._methods.claim(t,"setNotificationHandler"),super.setNotificationHandler.call(this,t,...r)};removeRequestHandler=(e)=>{this._methods.release(e),super.removeRequestHandler(e)};removeNotificationHandler=(e)=>{this._methods.release(e),super.removeNotificationHandler(e)};replaceRequestHandler=(e,...t)=>{this._methods.replace(e),super.setRequestHandler.call(this,e,...t)};_assertInitialized(e){if(this._initializedSent)return;let t=\`[ext-apps] App.\${e}() called before connect() completed the ui/initialize handshake. Await app.connect() before calling this method, or move data loading to an ontoolresult handler.\`;if(this.options?.strict)throw Error(t);console.warn(\`\${t}. This will throw in a future release.\`)}eventSchemas={toolinput:Aw,toolinputpartial:Uw,toolresult:Bw,toolcancelled:Dw,hostcontextchanged:Ww};static ONE_SHOT_EVENTS=new Set(["toolinput","toolinputpartial","toolresult","toolcancelled"]);_everHadListener=new Set;_assertHandlerTiming(e){if(!Cl.ONE_SHOT_EVENTS.has(e)||this._everHadListener.has(e))return;if(this._everHadListener.add(e),!this._initializedSent)return;let t=\`[ext-apps] "\${String(e)}" handler registered after connect() completed the ui/initialize handshake. The host may have already sent this notification. Register handlers before calling app.connect().\`;if(this.options?.strict)throw Error(t);console.warn(t)}setEventHandler(e,t){if(t)this._assertHandlerTiming(e);this._ensureEventSlot(e),this._events.setHandler(e,t)}addEventListener(e,t){this._assertHandlerTiming(e),this._ensureEventSlot(e),this._events.addEventListener(e,t)}removeEventListener(e,t){this._events.removeEventListener(e,t)}_ensureEventSlot(e){if(this._registeredEvents.has(e))return;let t=this.eventSchemas[e];if(!t)throw Error(\`Unknown event: \${String(e)}\`);this.setNotificationHandler(t.shape.method.value,{params:t.shape.params},(r)=>{let n=r;if(e==="hostcontextchanged")this._hostContext={...this._hostContext,...n};this._events.dispatch(e,n)}),this._registeredEvents.add(e)}getEventHandler(e){return this._events.getHandler(e)}warnIfRequestHandlerReplaced(e,t,r){if(t&&r)console.warn(\`[MCP Apps] \${e} handler replaced. Previous handler will no longer be called.\`)}constructor(e,t={},r={autoResize:!0}){super(r);if(this._appInfo=e,this._appCapabilities=t,this.options=r,this._methods.replace("notifications/cancelled"),this._methods.replace("notifications/progress"),!r.allowUnsafeEval)ge({jitless:!0});this.replaceRequestHandler("ping",(n)=>(console.log("Received ping:",n.params),{})),this.setEventHandler("hostcontextchanged",void 0)}buildContext(e){return e}registerAppCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after transport is established");this._appCapabilities=Yw(this._appCapabilities,e)}registerTool(e,t,r){if(this._registeredTools[e])throw Error(\`Tool \${e} is already registered\`);let n=this,i=()=>{if(n._initializedSent&&n._appCapabilities.tools?.listChanged)n.sendToolListChanged()},o=t.inputSchema!==void 0,a={title:t.title,description:t.description,inputSchema:t.inputSchema,outputSchema:t.outputSchema,annotations:t.annotations,_meta:t._meta,enabled:!0,enable(){this.enabled=!0,i()},disable(){this.enabled=!1,i()},update(c){Object.assign(this,c),i()},remove(){if(n._registeredTools[e]!==a)return;delete n._registeredTools[e],i()},handler:async(c,l)=>{if(!a.enabled)throw Error(\`Tool \${e} is disabled\`);let u;if(o){let m=a.inputSchema,f=m?await I_(m,c??{},\`Invalid input for tool \${e}: \`):c??{};u=await r(f,l)}else u=await r(l);if(a.outputSchema&&!u.isError)u.structuredContent=await I_(a.outputSchema,u.structuredContent,\`Invalid output for tool \${e}: \`);return u}};if(this._registeredTools[e]=a,!this._appCapabilities.tools&&!this.transport)this.registerAppCapabilities({tools:{listChanged:!0}});return this.ensureToolHandlersInitialized(),i(),a}_toolHandlersInitialized=!1;ensureToolHandlersInitialized(){if(this._toolHandlersInitialized)return;this._toolHandlersInitialized=!0,this.oncalltool=async(e,t)=>{let r=this._registeredTools[e.name];if(!r)throw Error(\`Tool \${e.name} not found\`);return r.handler(e.arguments,t)},this.onlisttools=async(e,t)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([r,n])=>n.enabled).map(async([r,n])=>{let i={name:r,title:n.title,description:n.description,inputSchema:n.inputSchema?await x_(n.inputSchema,"input"):{type:"object",properties:{}}};if(n.outputSchema)i.outputSchema=await x_(n.outputSchema,"output");if(n.annotations)i.annotations=n.annotations;if(n._meta)i._meta=n._meta;return i}))})}async sendToolListChanged(e={}){this._assertInitialized("sendToolListChanged"),await this.notification({method:"notifications/tools/list_changed",params:e})}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}get ontoolinput(){return this.getEventHandler("toolinput")}set ontoolinput(e){this.setEventHandler("toolinput",e)}get ontoolinputpartial(){return this.getEventHandler("toolinputpartial")}set ontoolinputpartial(e){this.setEventHandler("toolinputpartial",e)}get ontoolresult(){return this.getEventHandler("toolresult")}set ontoolresult(e){this.setEventHandler("toolresult",e)}get ontoolcancelled(){return this.getEventHandler("toolcancelled")}set ontoolcancelled(e){this.setEventHandler("toolcancelled",e)}get onhostcontextchanged(){return this.getEventHandler("hostcontextchanged")}set onhostcontextchanged(e){this.setEventHandler("hostcontextchanged",e)}_onteardown;get onteardown(){return this._onteardown}set onteardown(e){this.warnIfRequestHandlerReplaced("onteardown",this._onteardown,e),this._onteardown=e,this.replaceRequestHandler("ui/resource-teardown",{params:qw.shape.params,result:Vw},(t,r)=>{if(!this._onteardown)throw Error("No onteardown handler set");return this._onteardown(t,r)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(e){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,e),this._oncalltool=e,this.replaceRequestHandler("tools/call",(t,r)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(t.params,r)})}_onlisttools;get onlisttools(){return this._onlisttools}set onlisttools(e){this.warnIfRequestHandlerReplaced("onlisttools",this._onlisttools,e),this._onlisttools=e,this.replaceRequestHandler("tools/list",(t,r)=>{if(!this._onlisttools)throw Error("No onlisttools handler set");return this._onlisttools(t.params,r)})}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._hostCapabilities?.sampling)throw Error(\`Host does not support sampling (required for \${e})\`);break}}assertRequestHandlerCapability(e){switch(e){case"tools/call":case"tools/list":if(!this._appCapabilities.tools)throw Error(\`Client does not support tool capability (required for \${e})\`);return;default:return}}assertNotificationCapability(e){}async callServerTool(e,t){if(this._assertInitialized("callServerTool"),typeof e==="string")throw Error(\`callServerTool() expects an object as its first argument, but received a string ("\${e}"). Did you mean: callServerTool({ name: "\${e}", arguments: { ... } })?\`);return await this.request({method:"tools/call",params:e},{onprogress:()=>{},resetTimeoutOnProgress:!0,...t})}async readServerResource(e,t){return this._assertInitialized("readServerResource"),await this.request({method:"resources/read",params:e},t)}async listServerResources(e,t){return this._assertInitialized("listServerResources"),await this.request({method:"resources/list",params:e},t)}async createSamplingMessage(e,t){return this._assertInitialized("createSamplingMessage"),await this.request({method:"sampling/createMessage",params:e},t)}sendMessage(e,t){return this._assertInitialized("sendMessage"),this.request({method:"ui/message",params:e},jw,t)}sendLog(e){return this.notification({method:"notifications/message",params:e})}updateModelContext(e,t){return this._assertInitialized("updateModelContext"),this.request({method:"ui/update-model-context",params:e},ir,t)}openLink(e,t){return this._assertInitialized("openLink"),this.request({method:"ui/open-link",params:e},Ow,t)}sendOpenLink=this.openLink;downloadFile(e,t){return this._assertInitialized("downloadFile"),this.request({method:"ui/download-file",params:e},Nw,t)}requestTeardown(e={}){return this.notification({method:"ui/notifications/request-teardown",params:e})}requestDisplayMode(e,t){return this._assertInitialized("requestDisplayMode"),this.request({method:"ui/request-display-mode",params:e},Jw,t)}sendSizeChanged(e){return this.notification({method:"ui/notifications/size-changed",params:e})}setupSizeChangedNotifications(){let e=!1,t=0,r=0,n=()=>{if(e)return;e=!0,requestAnimationFrame(()=>{e=!1;let o=document.documentElement,a=o.style.height;o.style.height="max-content";let c=Math.ceil(o.getBoundingClientRect().height);o.style.height=a;let l=Math.ceil(window.innerWidth);if(l!==t||c!==r)t=l,r=c,this.sendSizeChanged({width:l,height:c})})};n();let i=new ResizeObserver(n);return i.observe(document.documentElement),i.observe(document.body),()=>i.disconnect()}async connect(e=new T_(window.parent,window.parent),t){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");this._initializedSent=!1;try{await super.connect(e);let r=await this.request({method:"ui/initialize",params:{appCapabilities:this._appCapabilities,appInfo:this._appInfo,protocolVersion:Rw}},Kw,t);if(r===void 0)throw Error(\`Server sent invalid initialize result: \${r}\`);if(this._hostCapabilities=r.hostCapabilities,this._hostInfo=r.hostInfo,this._hostContext=r.hostContext,await this.notification({method:"ui/notifications/initialized"}),this._initializedSent=!0,this.options?.autoResize)this.setupSizeChangedNotifications()}catch(r){throw this.close(),r}}}var Xr=d({asOfDate:s().nullable(),attribution:p("Observed on the channel; not attributed to the campaign."),source:p("YouTube Analytics BigQuery warehouse")}).strict(),O_=At("status",[d({provenance:Xr,reason:s(),status:p("unavailable")}).strict(),d({coverage:d({latestCompleteDay:s(),observedThroughDay:s().nullable(),provenance:Xr,videoMetricsThroughDay:s().nullable()}).strict(),dateRange:d({end:s(),start:s()}).strict(),provenance:Xr,reason:s(),status:p("pending")}).strict(),d({channelMetrics:d({estimatedMinutesWatched:y(),estimatedRevenueUsd:y().optional(),monetizationCompleteness:Z(["available","delayed","missing"]),provenance:Xr,revenueThroughDay:s().nullable(),subscribersGained:y().nullable(),subscribersLost:y().nullable(),views:y()}).strict(),coverage:d({latestCompleteDay:s(),missingDays:v(s()),observedThroughDay:s(),placeholderDays:v(s()),provenance:Xr,trafficSourceDaysWithData:y(),trafficSourcePlaceholderRows:y(),videoMetricsThroughDay:s().nullable()}).strict(),dateRange:d({end:s(),start:s()}).strict(),playlistFunnel:d({averageTimeInPlaylistSeconds:y(),playlistAddsPer1kViews:y().nullable(),playlistStarts:y(),provenance:Xr,viewsPerPlaylistStart:y()}).strict(),status:p("available"),trafficSources:d({advertisingSourceViews:y().nullable(),otherSourceViews:y().nullable(),provenance:Xr,rows:v(d({estimatedMinutesWatched:y(),trafficSourceType:s(),views:y()}).strict()),scope:p("channel-date-aggregate")}).strict(),viewsPerAdClick:d({adClicks:y().nullable(),days:y(),signal:p("playlist-waterfall"),value:y().nullable(),views:y().nullable()}).strict()}).strict()]);var kt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Ee(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)?e:{}}function ae(e,t=160){return typeof e==="string"?Array.from(e).map((r)=>{let n=r.codePointAt(0)??0;return n<32||n===127?" ":r}).join("").slice(0,t):""}function Qr(e){return typeof e==="number"&&Number.isFinite(e)&&e>=0?e:void 0}function oi(e){return typeof e==="string"&&/^\\d{4}-\\d{2}-\\d{2}$/.test(e)?e:void 0}function vp(e){let t=Ee(e),r=oi(t.start),n=oi(t.end);return r&&n?\`\${r} to \${n}\`:void 0}function vs(e){return(Array.isArray(e)?e:[]).slice(0,50).flatMap((t)=>{let r=Ee(t);return typeof r.id==="string"&&kt.test(r.id)&&ae(r.name)?[{id:r.id,name:ae(r.name),...ae(r.organizationName)?{organizationName:ae(r.organizationName)}:{}}]:[]})}function Ol(e){return typeof e==="string"&&e.length>0&&e.length<=2048?e:void 0}function gs(e){if(typeof e!=="string"||e.length>2048)return;try{let t=new URL(e);if(t.protocol!=="https:"||t.username||t.password||t.port||t.hostname!=="play.dynamoi.com"||t.search||t.hash)return;return t.href}catch{return}}function N_(e){let t=Ee(e);if(Object.keys(t).length!==1||!Object.hasOwn(t,"url"))throw Error("Unsupported workspace link.");let r=t.url;if(r==="/")return null;if(typeof r!=="string"||r.length>180||/[%?#\\\\\\s]/.test(r))throw Error("Unsupported workspace link.");let n=/^\\/artists\\/([^/]+)(?:\\/(campaigns|links)\\/([^/]+))?$/.exec(r);if(!(n&&kt.test(n[1]??""))||n[3]&&!kt.test(n[3]))throw Error("Unsupported workspace link.");return{artistId:n[1]??"",...n[3]?{id:n[3],kind:n[2]==="campaigns"?"campaign":"smartlink"}:{}}}function Xw(e,t,r){let n=O_.safeParse(e.channelResults),i,o;if(t==="campaign"&&n.success&&n.data.status!=="available"){let a=n.data,c=oi(a.provenance.asOfDate),l=a.status==="pending"?oi(a.coverage.observedThroughDay):void 0,u=a.status==="pending"?vp(a.dateRange):void 0;o={status:a.status,...l?{observedThrough:l}:{},...u?{period:u}:{},...c?{asOf:c}:{}},r.push(a.status==="pending"?"YouTube channel results are pending; no channel totals are available.":"YouTube channel results are unavailable; no channel totals are available.")}else if(t==="campaign"&&e.channelResults!==void 0&&!n.success)r.push("YouTube channel results could not be verified; uncertain totals are omitted.");if(t==="campaign"&&n.success&&n.data.status==="available"){let a=n.data,c=[],l=Qr(a.channelMetrics.views),u=Qr(a.channelMetrics.subscribersGained);if(l!==void 0)c.push({label:"Channel views",value:l});if(u!==void 0)c.push({label:"Subscribers gained",value:u});i={asOf:oi(a.channelMetrics.provenance.asOfDate)??null,attribution:a.channelMetrics.provenance.attribution,metrics:c,missingDays:a.coverage.missingDays.length,observedThrough:oi(a.coverage.observedThroughDay)??"unknown",period:vp(a.dateRange)??"Window unavailable",placeholderDays:a.coverage.placeholderDays.length,source:a.channelMetrics.provenance.source}}return{...i?{channel:i}:{},...o?{channelAvailability:o}:{}}}function bp(e,t,r,n="summary"){let i=Ee(t);if(typeof i.id!=="string"||!kt.test(i.id))throw Error("This record could not be loaded.");let o=[],a=Ee(i.analytics),c=Ee(a.totals),l=e==="smartlink"?[["anonymousVisits","Anonymous visits"],["streamingServiceClicks","Streaming service clicks"],["youtubeVideoPlays","YouTube video plays"]]:[["impressions","Ad impressions"],["clicks","Ad clicks"]],u=[],m=a.countsAvailability,f=m==="available"||m==="sample",h=m==="sample";if(n==="detail"&&Object.keys(a).length===0)u.push("Results could not be read for this record.");else if(!f&&(n==="detail"||Object.keys(a).length>0))u.push(m==="not_linked"?"No ad platform is linked; no ad observations are available.":"Results are unavailable or incomplete; uncertain totals are omitted.");for(let[C,F]of f?l:[]){let D=Qr(c[C]);if(D!==void 0)o.push({label:F,value:D})}let{channel:b,channelAvailability:_}=Xw(i,e,u),S=vp(a.dateRange),w=e==="smartlink"&&i.isPublic===!0?gs(i.publicUrl):void 0;return{id:i.id,...r&&kt.test(r)?{artistId:r}:typeof i.artistId==="string"&&kt.test(i.artistId)?{artistId:i.artistId}:e==="artist"?{artistId:i.id}:{},...b?{channel:b}:{},..._?{channelAvailability:_}:{},...u.length>0?{warnings:u}:{},kind:e,...e==="campaign"&&(i.campaignType==="SMART_CAMPAIGN"||i.campaignType==="YOUTUBE")?{campaignType:i.campaignType}:{},...e==="smartlink"?{isPublic:i.isPublic===!0}:{},...h?{sampleResults:!0}:{},name:ae(e==="smartlink"?i.releaseTitle:i.contentTitle??i.name)||"Untitled",...ae(i.status??i.publishState,80)?{status:ae(i.status??i.publishState,80)}:{},...w?{url:w}:{},...o.length>0?{metrics:o}:{},...S?{period:S}:{},...o.length>0?{source:e==="smartlink"?"Smart Link analytics":h?"Sample campaign results":"Ad-network delivery"}:{}}}function j_(e){return JSON.stringify({artistId:e.artistId&&kt.test(e.artistId)?e.artistId:void 0,id:kt.test(e.id)?e.id:void 0,name:ae(e.name),...e.warnings?.length?{warnings:e.warnings.slice(0,3).map((t)=>ae(t,160))}:{},...e.channelAvailability?{channelAvailability:{status:e.channelAvailability.status,...e.channelAvailability.period?{period:ae(e.channelAvailability.period,40)}:{},...e.channelAvailability.asOf?{asOf:ae(e.channelAvailability.asOf,40)}:{},...e.channelAvailability.observedThrough?{observedThrough:ae(e.channelAvailability.observedThrough,40)}:{}}}:{},type:e.kind,...e.status?{status:ae(e.status,80)}:{},...e.isPublic===!0&&gs(e.url)?{url:gs(e.url)}:{},...e.metrics?.length?{metrics:e.metrics.slice(0,5).map(({label:t,value:r})=>({label:ae(t,80),value:Qr(r)??0})),source:ae(e.source,180)}:{},...e.period?{period:ae(e.period,40)}:{},...e.channel?{channel:{asOf:e.channel.asOf?ae(e.channel.asOf,40):null,attribution:ae(e.channel.attribution,100),metrics:e.channel.metrics.slice(0,2).map(({label:t,value:r})=>({label:ae(t,80),value:Qr(r)})),missingDays:Qr(e.channel.missingDays),observedThrough:ae(e.channel.observedThrough,40),period:ae(e.channel.period,40),placeholderDays:Qr(e.channel.placeholderDays),source:ae(e.channel.source,100)}}:{}})}function A_(e,t){if(t)return;let r=new Set;for(let n of e){if(r.has(n.name))return;r.add(n.name)}return e[0]}function U_(e,t){let r=(o)=>o.organizationName?\`\${o.name} — \${o.organizationName}\`:o.name,n=r(e),i=t.filter((o)=>r(o)===n);return i.length>1?\`\${n} (choice \${i.findIndex((o)=>o.id===e.id)+1})\`:n}function D_(e,t){let r=Ee(e),n=Ee(r.structuredContent).code,i=Boolean(Ee(r._meta)["mcp/www_authenticate"])||n==="INSUFFICIENT_SCOPE"||n==="TENANT_ACCESS_DENIED";if(i)t();return i}function Nl(e){let t=Ee(e),r=Ee(t.structuredContent);if(t.isError||r.status!=="success"){if(Ee(t._meta)["mcp/www_authenticate"]||r.code==="INSUFFICIENT_SCOPE")throw Error("Dynamoi access is unavailable. Reconnect in your host, then retry.");if(r.code==="TENANT_ACCESS_DENIED")throw Error("Artist access is unavailable. Choose another artist.");if(r.code==="RATE_LIMITED"&&r.retryable===!0&&typeof r.retryAfterSeconds==="number"&&Number.isInteger(r.retryAfterSeconds)&&r.retryAfterSeconds>0&&r.retryAfterSeconds<=86400)throw Error(\`This read is rate limited. Retry after \${r.retryAfterSeconds} seconds.\`);throw Error("This read could not complete. Check your Dynamoi access, then retry.")}return Ee(r.data)}function cr(e){return e instanceof Error&&/^(Artist access|Dynamoi access|This read|Unsupported workspace|This record)/.test(e.message)?e.message:"This read could not complete. Check your Dynamoi access, then retry."}async function M_(e,t){try{if(!(await e.openLink({url:t})).isError)return"Public Smart Link opened through your host."}catch{}return"The host could not open this link. Copy the displayed public URL to open it yourself."}var Qw=["dynamoi_list_artists","dynamoi_list_campaigns","dynamoi_get_campaign","dynamoi_list_smart_links","dynamoi_get_smart_link"];function L_(e,t,r,n){async function i(o,a){let c=t();if(c.disposed||!c.connected||!c.canRead||!Qw.includes(o))throw Error("Dynamoi access is unavailable. Reconnect in your host, then retry.");let l=typeof a.artistId==="string"?a.artistId:c.artistId,u=await e.callServerTool({arguments:a,name:o});try{return Nl(u)}catch(m){let f=t();if(f.disposed)throw m;let h=Ee(u.structuredContent);if(Ee(u._meta)["mcp/www_authenticate"]||h.code==="INSUFFICIENT_SCOPE")throw r(cr(m)),m;if(c.targetEpoch!==f.targetEpoch)throw m;if(h.code==="TENANT_ACCESS_DENIED"&&l){if(o==="dynamoi_get_campaign"||o==="dynamoi_get_smart_link"){try{let b=await i("dynamoi_list_artists",{artistId:l,format:"json"});if(t().targetEpoch!==c.targetEpoch||b.id!==l)throw Error("Artist verification did not complete.",{cause:m})}catch(b){throw Error("This record could not be accessed. Artist verification did not complete; retry this read.",{cause:b})}throw Error("This record could not be accessed. Choose an authorized record.",{cause:m})}if(typeof a.artistId==="string")n(l,"Artist access is unavailable. Choose another artist.")}throw m}}return i}function q_(e){function t(c,l){let u=e.createElement(c);if(l!==void 0)u.textContent=l;return u}function r(c,l,u){let m=t("button",c);if(m.type="button",m.onclick=l,u)m.dataset.focus=u;return m}function n({page:c,tab:l,selectedId:u,loadPage:m,chooseRecord:f}){let h=t("section");if(h.setAttribute("aria-label",l==="campaign"?"Campaign list":"Smart Link list"),h.setAttribute("aria-busy",String(c.loading)),c.loading)h.append(t("p","Loading records…"));if(c.error){let _=t("p",c.error);_.setAttribute("role","alert"),h.append(_,r("Retry records",()=>void m(c.rows.length>0)))}if(!(c.loading||c.error||c.warning||c.rows.length>0))h.append(t("p",l==="campaign"?"No campaigns for this artist.":"No Smart Links for this artist."));if(c.warning){let _=t("p",c.warning);_.setAttribute("role","alert"),h.append(_,r("Retry records",()=>void m()))}let b=t("ul");b.className="rows";for(let _ of c.rows){let S=t("li"),w=r("",()=>void f(l,_.id),_.id);if(w.className="row",w.append(t("span",_.name)),_.status)w.append(t("small",_.status));w.setAttribute("aria-current",String(_.id===u)),S.append(w),b.append(S)}if(h.append(b),c.next){let _=r("More records",()=>void m(!0),"records-more");_.disabled=c.loading,_.className="more",h.append(_)}return h}function i(c,l){for(let u of l.warnings??[]){let m=t("p",u);m.setAttribute("role","status"),c.append(m)}if(l.channelAvailability){let u=l.channelAvailability;c.append(t("p",[u.period,u.asOf?\`As of \${u.asOf}\`:"",u.observedThrough?\`Observed through \${u.observedThrough}\`:""].filter(Boolean).join("; ")))}if(!l.metrics?.length&&l.period)c.append(t("p",\`Requested results window: \${l.period}\`))}function o(c,l,u){let m=t("label","Artist");m.htmlFor="artist-selector";let f=t("select");if(f.id="artist-selector",f.dataset.focus="artist",f.disabled=!u,!l){let h=t("option","Choose an artist");h.value="",h.selected=!0,f.append(h)}for(let h of c){let b=t("option",U_(h,c));b.value=h.id,b.selected=h.id===l,f.append(b)}return{label:m,select:f}}function a({detailLoading:c,detailError:l,selectedId:u,tab:m,detail:f,shareMessage:h,canShare:b,canOpen:_,openPublicLink:S,chooseRecord:w,useInConversation:C}){let F=f?.sampleResults?"Sample results":"Observed results",D=t("section");if(D.className="detail",D.setAttribute("aria-label","Selected record"),D.setAttribute("aria-busy",String(c)),c)D.append(t("p","Loading details and observed results…"));if(l){let k=t("p",l);if(k.setAttribute("role","alert"),D.append(k),u)D.append(r("Retry details",()=>void w(m,u??"")))}if(f){if(D.append(t("h2",f.name)),f.status)D.append(t("p",f.status));if(i(D,f),f.metrics?.length){if(D.append(t("h3",F)),f.period)D.append(t("p",f.period));let R=t("dl");for(let H of f.metrics){let V=t("div");V.append(t("dt",H.label),t("dd",H.value.toLocaleString())),R.append(V)}D.append(R,t("p",f.source))}else if(f.kind!=="artist")D.append(t("p","No observed metrics were returned for this record."));if(f.channel){D.append(t("h3","Observed YouTube channel results"),t("p",f.channel.period));let R=t("dl");for(let H of f.channel.metrics){let V=t("div");V.append(t("dt",H.label),t("dd",H.value.toLocaleString())),R.append(V)}D.append(R,t("p",\`\${f.channel.source}. As of \${f.channel.asOf??"unknown"}; observed through \${f.channel.observedThrough}. \${f.channel.missingDays} missing days; \${f.channel.placeholderDays} placeholder days.\`),t("p",f.channel.attribution))}if(f.url){let R=r("Open public Smart Link",()=>void S(),"open-link");if(R.disabled=!_,D.append(R,t("p",f.url)),!_)D.append(t("p","This host cannot open links. Copy the public URL to open it yourself."))}let k=t("div");k.className="actions";let z=r("Use in conversation",()=>void C(),"share");z.disabled=!b,k.append(z),D.append(k),D.append(t("p",b?"Shares this record’s ID, artist ID, name, status, displayed results and availability warnings.":"Conversation context is unavailable in this host. Use the individual read tools instead."))}if(!(f||c||l))D.append(t("p","Choose a record to inspect its results."));let B=t("p",h);return B.setAttribute("role","status"),D.append(B),D}return{button:r,node:t,renderArtistSelector:o,renderDetail:a,renderList:n}}function V_(e,t){let r=e.ownerDocument,n=r.getElementById("connection");if(!n)throw Error("Workspace connection status is missing.");let i=n,o=[],a,c,l,u="campaign",m={loading:!1,rows:[]},f,h,b=!1,_,S="",w=!1,C=!1,F=!1,D=!1,B=!1,k=!1,z=0,R=0,H=0,V=0,ee=0,be=!1,Ae=Promise.resolve(null),Ce=!1,ce,{node:_e,button:ot,renderList:tt,renderDetail:ht,renderArtistSelector:Ft}=q_(r);function Me(){if(S="",!Ce)return;Ae=Ae.then(async()=>{try{await t.updateModelContext({content:[]}),Ce=!1}catch{if(!B)S="The host could not clear conversation context. Clear it in your host before continuing.",i.textContent=S,oe()}return null})}function xe(L=!0){if(z+=1,R+=1,m={loading:!1,rows:[]},f=void 0,h=void 0,b=!1,_=void 0,L)Me()}let rt=L_(t,()=>({artistId:l?.id,canRead:w,connected:D,detailEpoch:R,disposed:B,targetEpoch:ee}),(L)=>{ee+=1,xe(),w=!1,C=!1,o=[],a=void 0,l=void 0,k=!1,be=!0,i.textContent=L,oe()},(L,M)=>{ee+=1,V+=1,xe(),o=o.filter((Q)=>Q.id!==L),l=void 0,ce=void 0,i.textContent=M,oe()});async function It(){H+=1;let L=H;try{let M=await rt("dynamoi_list_artists",{format:"json",limit:50,...a?{cursor:a}:{}});if(B||L!==H)return;let Q=new Set(o.map((X)=>X.id));if(!Array.isArray(M.artists)||vs(M.artists).length!==M.artists.length)throw Error("This read returned an incomplete artist roster. Retry before treating it as complete.");o=[...o,...vs(M.artists).filter((X)=>!Q.has(X.id))],a=Ol(M.nextCursor),c=void 0}catch(M){if(!B&&L===H)c=cr(M)}oe()}async function at(L=!1){if(!l)return;z+=1;let M=z,Q=l.id,X=u,le=L?m.rows:[],pe=L?m.next:void 0;m={loading:!0,rows:le},oe();try{let fe=await rt(X==="campaign"?"dynamoi_list_campaigns":"dynamoi_list_smart_links",{artistId:Q,format:"json",limit:20,...pe?{cursor:pe}:{}});if(B||M!==z)return;let Se=X==="campaign"?fe.campaigns:fe.smartLinks,nt=(Array.isArray(Se)?Se:[]).slice(0,50).flatMap((st)=>{try{return[bp(X,st,Q)]}catch{return[]}}),vt=Array.isArray(Se)?Se.length-nt.length:1,mr=new Set(le.map((st)=>st.id));m={loading:!1,next:Ol(fe.nextCursor),...vt>0?{warning:"Some records could not be displayed. Retry this read before treating this list as complete."}:{},rows:[...le,...nt.filter((st)=>!mr.has(st.id))]}}catch(fe){if(!B&&M===z)m={error:cr(fe),loading:!1,next:pe,rows:le}}oe()}async function gt(L=!0){let M=L&&Ce?void 0:A_(o,a);if(M)await Le(M,!L)}async function Le(L,M=!0){ee+=1,xe(M),i.textContent="Read-only workspace",l=L,f={artistId:L.id,id:L.id,kind:"artist",name:L.name},oe(),await at()}async function Ue(L,M){if(!(l&&kt.test(M)))return;let Q=l.id;R+=1;let X=R;Me(),f=void 0,h=M,b=!0,_=void 0,oe();try{let le=m.rows.find((fe)=>fe.id===M)?.campaignType,pe=await rt(L==="campaign"?"dynamoi_get_campaign":"dynamoi_get_smart_link",L==="campaign"?{campaignId:M,format:"json",includeAnalytics:!0,includeChannelResults:le==="YOUTUBE"}:{format:"json",includeAnalytics:!0,playLinkId:M});if(B||X!==R)return;if(pe.artistId!==Q||pe.id!==M)throw Error("This record is outside the selected artist. Choose it from an authorized artist.");if(L==="campaign"&&le!=="YOUTUBE"&&pe.campaignType==="YOUTUBE"){let fe=await rt("dynamoi_get_campaign",{campaignId:M,format:"json",includeAnalytics:!1,includeChannelResults:!0});if(B||X!==R)return;if(fe.artistId!==Q||fe.id!==M)throw Error("This record is outside the selected artist. Choose it from an authorized artist.");pe={...pe,channelResults:fe.channelResults}}f=bp(L,pe,Q,"detail")}catch(le){if(!B&&X===R)_=cr(le)}if(!B&&X===R)b=!1,oe()}async function Rt(){if(!(f&&C)||B)return;let L=f,M=R;S="Sharing selected record…",oe(),Ae=Ae.then(async()=>{if(B||M!==R)return null;Ce=!0;try{if(await t.updateModelContext({content:[{text:j_(L),type:"text"}]}),!B&&M===R)S="Selected record is available for your next conversation turn."}catch{if(!B&&M===R)S="This host could not share the selection. Use the individual read tools in your conversation."}return oe(),null}),await Ae}async function Pt(L,M=!0){ee+=1,ce=L,V+=1;let Q=V;xe(M),l=void 0,oe();try{let X=N_(L);if(!(k&&D&&w))return;if(!X){await gt(!M);return}let le=await rt("dynamoi_list_artists",{artistId:X.artistId,format:"json"});if(B||Q!==V)return;if(le.id!==X.artistId||!ae(le.name))throw Error("This record could not be loaded.");let pe={id:X.artistId,name:ae(le.name)};if(!o.some((fe)=>fe.id===pe.id))o=[...o,pe];if(u=X.kind??"campaign",await Le(pe,M),!B&&Q===V&&X.kind&&X.id)await Ue(X.kind,X.id)}catch(X){if(!B&&Q===V)_=cr(X),oe()}}async function ur(){let L=gs(f?.url),M=R;if(!(L&&F&&f?.isPublic===!0)||B)return;let Q=await M_(t,L);if(!B&&M===R)S=Q;oe()}function dr(L){V+=1,ce=void 0,xe(),u=L,at()}function oe(){if(B)return;let L=r.activeElement?.dataset.focus;if(e.replaceChildren(),!k){e.append(_e("p",be?"Reconnect Dynamoi in your host, then reopen the workspace or use individual read tools.":D?"Waiting for your initial workspace result…":"Use Dynamoi’s individual read tools if your host does not support interactive apps."));return}if(!(o.length>0||a)){e.append(_e("h2","No artists available"),_e("p","This account has no accessible artist yet. An artist must be available in your Dynamoi account before campaigns or Smart Links can appear here."));return}let{label:M,select:Q}=Ft(o,l?.id,w);if(Q.onchange=()=>{V+=1,ce=void 0;let Se=o.find((nt)=>nt.id===Q.value);if(Se)Le(Se)},e.append(M,Q),a)e.append(ot("More artists",()=>void It(),"artists-more"));if(c)e.append(_e("p",c),ot("Retry artists",()=>void It()));if(!w){e.append(_e("p","This host cannot request further records. Use Dynamoi’s individual read tools in your conversation."));return}let X=_e("nav");X.setAttribute("aria-label","Artist records");for(let[Se,nt]of[["campaign","Campaigns"],["smartlink","Smart Links"]]){let vt=ot(nt,()=>dr(Se),Se);vt.setAttribute("aria-pressed",String(u===Se)),X.append(vt)}e.append(X);let le=_e("div");le.className="columns";let pe=tt({chooseRecord:Ue,loadPage:at,page:m,selectedId:h,tab:u}),fe=ht({canOpen:F,canShare:C,chooseRecord:Ue,detail:f,detailError:_,detailLoading:b,openPublicLink:ur,selectedId:h,shareMessage:S,tab:u,useInConversation:Rt});if(le.append(pe,fe),e.append(le),L)Array.from(e.querySelectorAll("[data-focus]")).find((Se)=>Se.dataset.focus===L)?.focus()}return{dispose(){ee+=1,V+=1,H+=1,z+=1,R+=1,B=!0,e.replaceChildren()},hostContext(L,M=!1){if(L.theme==="dark"||L.theme==="light")r.documentElement.style.colorScheme=L.theme;if(Object.hasOwn(L,"openai/modelContext")){let Q=L["openai/modelContext"];Ce=Q!==null&&Q!==void 0}if(be)Me();if((M||!D)&&Ce)ce=void 0;else if(Object.hasOwn(L,"openai/deepLink"))Pt(L["openai/deepLink"],!(M||!D))},initial(L){ee+=1,H+=1,V+=1,xe(!1),l=void 0;try{let M=Nl(L);if(!Array.isArray(M.artists)||M.artists.length>50||vs(M.artists).length!==M.artists.length)throw Error("This read returned an incomplete artist roster. Retry before treating this account as empty.");if(o=vs(M.artists),a=Ol(M.nextCursor),k=!0,be=!1,D&&w)if(ce===void 0)gt();else Pt(ce)}catch(M){be=D_(L,Me),k=!1,o=[],D=!1,w=!1,C=!1,i.textContent=cr(M)}oe()},setConnected(L,M,Q){if(D=!0,w=L,C=M,F=Q,!be)i.textContent=S||"Read-only workspace";if(oe(),k&&!l&&w)if(ce===void 0)gt();else Pt(ce)},unsupported(){D=!1,w=!1,C=!1,xe(!1),i.textContent="Interactive apps are unavailable in this host. Use Dynamoi’s individual read tools.",oe()}}}var xt=new Cl({name:"Dynamoi Artist Workspace",version:"1.0.0"},{}),Z_=document.getElementById("content");if(!Z_)throw Error("Workspace content is missing.");var lr=V_(Z_,xt);xt.addEventListener("toolresult",(e)=>lr.initial(e));xt.addEventListener("toolcancelled",()=>lr.unsupported());function F_(e,t=!1){let r=e.styles;if(r?.variables)C_(r.variables);lr.hostContext(e,t)}xt.addEventListener("hostcontextchanged",(e)=>F_(e));xt.onteardown=()=>(lr.dispose(),{});window.addEventListener("pagehide",()=>{lr.dispose(),xt.close()},{once:!0});if(window.parent===window)lr.unsupported();else xt.connect(void 0,{timeout:3000}).then(()=>{let e=xt.getHostCapabilities();return F_(xt.getHostContext()??{},!0),lr.setConnected(Boolean(e?.serverTools),Boolean(e?.updateModelContext?.text),Boolean(e?.openLinks)),null}).catch(()=>{lr.unsupported(),xt.close()});})();
4080
+ `;
4081
+
4082
+ // src/server/workspace/tool.ts
4083
+ var WORKSPACE_RESOURCE_URI = "ui://dynamoi/artist-workspace-v1.html";
4084
+ var WORKSPACE_METADATA = {
4085
+ "openai/ui": { entrypoints: [{ type: "global" }, { type: "thread" }] },
4086
+ ui: { resourceUri: WORKSPACE_RESOURCE_URI }
4087
+ };
4088
+ var WorkspaceOutputSchema = z17.object({
4089
+ data: z17.object({
4090
+ artistCount: z17.number().int().nonnegative(),
4091
+ artists: z17.array(z17.object({
4092
+ id: z17.uuid(),
4093
+ name: z17.string().min(1).max(160),
4094
+ organizationName: z17.string().min(1).max(160).optional()
4095
+ }).strict()).max(50),
4096
+ nextCursor: z17.string().min(1).max(2048).optional()
4097
+ }).strict().optional(),
4098
+ kind: z17.enum(["validation", "business", "platform", "unknown"]).optional(),
4099
+ message: z17.string().max(200).optional(),
4100
+ ...ResultErrorRecoverySchema.shape,
4101
+ status: z17.enum(["success", "error"])
4102
+ }).strict().superRefine((result, ctx) => {
4103
+ if (result.status === "error") {
4104
+ addRecoverySafetyIssues(result, ctx);
4105
+ } else {
4106
+ for (const field of Object.keys(ResultErrorRecoverySchema.shape)) {
4107
+ if (result[field] !== undefined) {
4108
+ ctx.addIssue({
4109
+ code: "custom",
4110
+ message: "Recovery metadata is only valid on error results.",
4111
+ path: [field]
4112
+ });
4113
+ }
4114
+ }
4115
+ }
4116
+ if (result.status === "success" && !result.data) {
4117
+ ctx.addIssue({
4118
+ code: "custom",
4119
+ message: "Success requires workspace data",
4120
+ path: ["data"]
4121
+ });
4122
+ }
4123
+ if (result.status === "error" && (!result.message || result.data)) {
4124
+ ctx.addIssue({
4125
+ code: "custom",
4126
+ message: "Error requires a message and no account data"
4127
+ });
4128
+ }
4129
+ });
4130
+ var WORKSPACE_TOOL_DEFINITION = {
4131
+ description: "Open the read-only Dynamoi workspace when the user wants to browse their existing artists, campaigns, Smart Links and observed results in ChatGPT. Returns an authorized artist roster or an honest empty account state. Does not create links, change campaigns, start purchases or connect accounts. Use individual read tools for follow-up details.",
4132
+ destructiveHint: false,
4133
+ name: "dynamoi_open_workspace",
4134
+ openWorldHint: false,
4135
+ outputSchema: WorkspaceOutputSchema,
4136
+ readOnlyHint: true,
4137
+ schema: z17.object({}).strict(),
4138
+ title: "Open Artist Workspace"
4139
+ };
4140
+ async function openWorkspace(adapter) {
4141
+ const overview = await adapter.getCurrentUser({ format: "json" });
4142
+ if (overview.status === "error") {
4143
+ return overview;
4144
+ }
4145
+ if (overview.status !== "success") {
4146
+ return {
4147
+ message: "Your workspace overview returned incomplete data. Retry this read.",
4148
+ status: "error"
4149
+ };
4150
+ }
4151
+ const artistCount = object13(overview.data)["artistCount"];
4152
+ if (typeof artistCount !== "number" || !Number.isFinite(artistCount) || !Number.isInteger(artistCount) || artistCount < 0) {
4153
+ return {
4154
+ message: "Your workspace overview returned incomplete data. Retry this read.",
4155
+ status: "error"
4156
+ };
4157
+ }
4158
+ const roster = await adapter.listArtists({ format: "json", limit: 50 });
4159
+ if (roster.status === "error") {
4160
+ return roster;
4161
+ }
4162
+ if (roster.status !== "success") {
4163
+ return {
4164
+ message: "Your artist roster returned incomplete data. Retry this read.",
4165
+ status: "error"
4166
+ };
4167
+ }
4168
+ const raw = object13(roster.data);
4169
+ if (!Array.isArray(raw["artists"]) || raw["artists"].length > 50 || artists(raw["artists"]).length !== raw["artists"].length) {
4170
+ return {
4171
+ message: "Your artist roster returned incomplete data. Retry before treating this account as empty.",
4172
+ status: "error"
4173
+ };
4174
+ }
4175
+ const nextCursor = cursor(raw["nextCursor"]);
4176
+ const data = {
4177
+ artistCount,
4178
+ artists: artists(raw["artists"]),
4179
+ ...nextCursor ? { nextCursor } : {}
4180
+ };
4181
+ return { data, status: "success" };
4182
+ }
4183
+ function workspaceHtml() {
4184
+ return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Dynamoi workspace</title><style>${WORKSPACE_STYLE}</style></head><body><main id="workspace"><header><h1>Dynamoi workspace</h1><p>Artists, campaigns and Smart Links</p></header><p role="status" id="connection">Connecting to your host…</p><section id="content" aria-label="Artist workspace"></section><noscript>This workspace needs JavaScript. Use Dynamoi’s individual read tools to inspect your account.</noscript></main><script>${WORKSPACE_SCRIPT.replaceAll("</script", "<\\/script")}</script></body></html>`;
4185
+ }
4186
+ function registerWorkspaceResource(server) {
4187
+ server.registerResource("artist-workspace", WORKSPACE_RESOURCE_URI, {
4188
+ description: "Read-only artist, campaign and Smart Link workspace.",
4189
+ mimeType: "text/html;profile=mcp-app",
4190
+ title: "Dynamoi Artist Workspace"
4191
+ }, async () => ({
4192
+ contents: [
4193
+ {
4194
+ _meta: {
4195
+ ui: {
4196
+ csp: { connectDomains: [], resourceDomains: [] },
4197
+ domain: "https://dynamoi.com",
4198
+ prefersBorder: true
4199
+ }
4200
+ },
4201
+ mimeType: "text/html;profile=mcp-app",
4202
+ text: workspaceHtml(),
4203
+ uri: WORKSPACE_RESOURCE_URI
4204
+ }
4205
+ ]
4206
+ }));
4207
+ }
4208
+
2486
4209
  // src/server/create-server.ts
2487
4210
  function buildDynamoiToolSecuritySchemes(scopes) {
2488
4211
  return scopes.length === 0 ? [{ type: "noauth" }] : [{ scopes: [...scopes], type: "oauth2" }];
2489
4212
  }
2490
- var DescriptiveEntitySchema = z12.object({
2491
- id: z12.string().optional(),
2492
- name: z12.string().optional(),
2493
- publicUrl: z12.string().optional(),
2494
- summary: z12.string().optional()
2495
- }).passthrough();
2496
4213
  var DIRECTORY_DESCRIPTIVE_DATA_SCHEMAS = {
2497
- dynamoi_get_account_overview: z12.object({
2498
- artistCount: z12.number().optional(),
2499
- artists: z12.object({
2500
- count: z12.number(),
2501
- summaries: z12.array(DescriptiveEntitySchema)
2502
- }).optional(),
2503
- organizationCount: z12.number().optional(),
2504
- recommendedNextActions: z12.array(z12.string()).optional(),
2505
- state: z12.object({}).passthrough().optional(),
2506
- summary: z12.string().optional(),
2507
- user: z12.object({ name: z12.string().optional() }).optional()
2508
- }).passthrough(),
2509
- dynamoi_get_artist_analytics: z12.object({
2510
- artistId: z12.string().optional(),
2511
- artistName: z12.string().optional(),
2512
- dateRange: z12.object({ end: z12.string(), start: z12.string() }).optional(),
2513
- summary: z12.string().optional()
4214
+ dynamoi_get_account_overview: DynamoiAccountOverviewDescriptiveDataSchema,
4215
+ dynamoi_get_artist_analytics: z18.object({
4216
+ artistId: z18.string().optional(),
4217
+ artistName: z18.string().optional(),
4218
+ dateRange: z18.object({ end: z18.string(), start: z18.string() }).optional(),
4219
+ summary: z18.string().optional()
2514
4220
  }).passthrough(),
2515
4221
  dynamoi_get_campaign: DescriptiveEntitySchema.extend({
2516
- artistId: z12.string().optional(),
2517
- contentTitle: z12.string().optional(),
2518
- nextActions: z12.array(z12.string()).optional(),
2519
- status: z12.string().optional()
4222
+ artistId: z18.string().optional(),
4223
+ contentTitle: z18.string().optional(),
4224
+ nextActions: z18.array(z18.string()).optional(),
4225
+ status: z18.string().optional()
2520
4226
  }).passthrough(),
2521
- dynamoi_get_platform_status: z12.object({
2522
- artistId: z12.string().optional(),
2523
- artistName: z12.string().optional(),
2524
- platforms: z12.object({}).passthrough().optional(),
2525
- summary: z12.string().optional()
4227
+ dynamoi_get_platform_status: z18.object({
4228
+ artistId: z18.string().optional(),
4229
+ artistName: z18.string().optional(),
4230
+ platforms: z18.object({}).passthrough().optional(),
4231
+ summary: z18.string().optional()
2526
4232
  }).passthrough(),
2527
4233
  dynamoi_get_smart_link: DescriptiveEntitySchema.extend({
2528
- artistId: z12.string().optional(),
2529
- artistName: z12.string().optional(),
2530
- nextActions: z12.array(z12.string()).optional(),
2531
- publishState: z12.string().optional(),
2532
- releaseTitle: z12.string().optional(),
2533
- theme: z12.string().optional()
4234
+ artistId: z18.string().optional(),
4235
+ artistName: z18.string().optional(),
4236
+ nextActions: z18.array(z18.string()).optional(),
4237
+ publishState: z18.string().optional(),
4238
+ releaseTitle: z18.string().optional(),
4239
+ theme: z18.string().optional()
2534
4240
  }).passthrough(),
2535
- dynamoi_list_artists: z12.object({
2536
- artists: z12.array(DescriptiveEntitySchema).optional(),
2537
- nextCursor: z12.string().optional(),
2538
- summary: z12.string().optional(),
2539
- totalCount: z12.number().optional()
4241
+ dynamoi_get_youtube_channel_data: z18.object({
4242
+ artistId: z18.string().optional(),
4243
+ channelName: z18.string().nullable().optional(),
4244
+ dataset: z18.string().optional(),
4245
+ nextCursor: z18.string().optional(),
4246
+ rowCount: z18.number().optional(),
4247
+ summary: z18.string().optional()
2540
4248
  }).passthrough(),
2541
- dynamoi_list_campaigns: z12.object({
2542
- campaigns: z12.array(DescriptiveEntitySchema).optional(),
2543
- nextCursor: z12.string().optional(),
2544
- summary: z12.string().optional(),
2545
- totalCount: z12.number().optional()
4249
+ dynamoi_list_artists: DynamoiArtistListDescriptiveDataSchema,
4250
+ dynamoi_list_campaigns: z18.object({
4251
+ campaigns: z18.array(DescriptiveEntitySchema).optional(),
4252
+ nextCursor: z18.string().optional(),
4253
+ summary: z18.string().optional(),
4254
+ totalCount: z18.number().optional()
2546
4255
  }).passthrough(),
2547
- dynamoi_preview_smart_link_themes: z12.object({
2548
- artistName: z12.string(),
2549
- releaseTitle: z12.string(),
2550
- themes: z12.array(DescriptiveEntitySchema)
4256
+ dynamoi_preview_smart_link_themes: z18.object({
4257
+ artistName: z18.string(),
4258
+ releaseTitle: z18.string(),
4259
+ themes: z18.array(DescriptiveEntitySchema)
2551
4260
  }).passthrough(),
2552
- dynamoi_search: z12.object({
2553
- nextCursor: z12.string().optional(),
2554
- results: z12.array(DescriptiveEntitySchema).optional(),
2555
- summary: z12.string().optional(),
2556
- totalCount: z12.number().optional()
4261
+ dynamoi_search: z18.object({
4262
+ nextCursor: z18.string().optional(),
4263
+ results: z18.array(DescriptiveEntitySchema).optional(),
4264
+ summary: z18.string().optional(),
4265
+ totalCount: z18.number().optional()
2557
4266
  }).passthrough(),
2558
4267
  dynamoi_update_smart_link: DescriptiveEntitySchema.extend({
2559
- artistId: z12.string().optional(),
2560
- artistName: z12.string().optional(),
2561
- defaultTheme: z12.string().optional(),
2562
- renderQueuedCount: z12.number().optional(),
2563
- renderWarning: z12.string().nullable().optional()
4268
+ artistId: z18.string().optional(),
4269
+ artistName: z18.string().optional(),
4270
+ defaultTheme: z18.string().optional(),
4271
+ renderQueuedCount: z18.number().optional(),
4272
+ renderWarning: z18.string().nullable().optional()
4273
+ }).passthrough(),
4274
+ dynamoi_update_smart_link_artist_hub_settings: DescriptiveEntitySchema.extend({
4275
+ artistHub: z18.object({}).passthrough().optional(),
4276
+ artistId: z18.string().optional(),
4277
+ artistName: z18.string().optional(),
4278
+ defaultTheme: z18.string().optional(),
4279
+ renderQueuedCount: z18.number().optional(),
4280
+ renderWarning: z18.string().nullable().optional()
4281
+ }).passthrough(),
4282
+ dynamoi_update_smart_link_artist_settings: DescriptiveEntitySchema.extend({
4283
+ artistId: z18.string().optional(),
4284
+ artistName: z18.string().optional(),
4285
+ defaultTheme: z18.string().optional(),
4286
+ renderQueuedCount: z18.number().optional(),
4287
+ renderWarning: z18.string().nullable().optional()
4288
+ }).passthrough(),
4289
+ dynamoi_update_smart_link_description: DescriptiveEntitySchema.extend({
4290
+ artistId: z18.string().optional(),
4291
+ artistName: z18.string().optional(),
4292
+ defaultTheme: z18.string().optional(),
4293
+ renderQueuedCount: z18.number().optional(),
4294
+ renderWarning: z18.string().nullable().optional()
4295
+ }).passthrough(),
4296
+ dynamoi_update_smart_link_release_settings: DescriptiveEntitySchema.extend({
4297
+ artistId: z18.string().optional(),
4298
+ customDescription: z18.string().nullable().optional(),
4299
+ nextActions: z18.array(z18.string()).optional(),
4300
+ publishState: z18.string().optional(),
4301
+ releaseSettings: z18.object({}).passthrough().optional(),
4302
+ releaseTitle: z18.string().optional(),
4303
+ renderWarning: z18.string().nullable().optional(),
4304
+ theme: z18.string().optional()
2564
4305
  }).passthrough(),
2565
4306
  fetch: DescriptiveEntitySchema,
2566
- search: z12.object({ results: z12.array(DescriptiveEntitySchema).optional() }).passthrough()
4307
+ search: z18.object({ results: z18.array(DescriptiveEntitySchema).optional() }).passthrough()
2567
4308
  };
2568
4309
  function getAdvertisedToolOutputSchema(options) {
2569
4310
  if (options.toolProfile !== "directory") {
@@ -2573,16 +4314,16 @@ function getAdvertisedToolOutputSchema(options) {
2573
4314
  if (!dataSchema) {
2574
4315
  return options.canonical;
2575
4316
  }
2576
- return z12.object({
4317
+ return z18.object({
2577
4318
  data: dataSchema.optional(),
2578
- kind: z12.string().optional(),
2579
- message: z12.string().optional(),
4319
+ kind: z18.string().optional(),
4320
+ message: z18.string().optional(),
2580
4321
  ...ResultErrorRecoverySchema.shape,
2581
- status: z12.enum(["success", "partial_success", "error"])
4322
+ status: z18.enum(["success", "partial_success", "error"])
2582
4323
  }).passthrough();
2583
4324
  }
2584
4325
  function getDynamoiToolOAuthScopes(toolName, providerScopes) {
2585
- const requiredScopes = DYNAMOI_MCP_TOOL_SCOPES2[toolName];
4326
+ const requiredScopes = DYNAMOI_MCP_TOOL_SCOPES[toolName];
2586
4327
  const missingScopes = requiredScopes.filter((scope) => !providerScopes.includes(scope));
2587
4328
  if (missingScopes.length > 0) {
2588
4329
  throw new Error(`MCP provider does not support ${toolName} scopes: ${missingScopes.join(", ")}`);
@@ -2590,6 +4331,7 @@ function getDynamoiToolOAuthScopes(toolName, providerScopes) {
2590
4331
  return requiredScopes;
2591
4332
  }
2592
4333
  var DYNAMOI_TOOL_DEFINITIONS = [
4334
+ WORKSPACE_TOOL_DEFINITION,
2593
4335
  DYNAMOI_ABOUT_TOOL_DEFINITION,
2594
4336
  ...PHASE_1_TOOL_DEFINITIONS,
2595
4337
  ...PHASE_ONBOARDING_TOOL_DEFINITIONS,
@@ -2598,29 +4340,53 @@ var DYNAMOI_TOOL_DEFINITIONS = [
2598
4340
  ...DISTRIBUTION_TOOL_DEFINITIONS,
2599
4341
  ...SHOP_TOOL_DEFINITIONS,
2600
4342
  SMART_LINK_THEME_PREVIEW_TOOL_DEFINITION,
2601
- ...PHASE_4_TOOL_DEFINITIONS
4343
+ ...PHASE_4_TOOL_DEFINITIONS,
4344
+ ...SMART_LINK_UPDATE_OPERATION_TOOL_DEFINITIONS,
4345
+ ...FULL_SMART_LINK_STUDIO_TOOL_DEFINITIONS
2602
4346
  ];
4347
+ var DYNAMOI_TOOL_NAMES = DYNAMOI_TOOL_DEFINITIONS.map((definition) => definition.name);
2603
4348
  var MUTATING_TOOL_NAMES = new Set(DYNAMOI_TOOL_DEFINITIONS.filter((definition) => !definition.readOnlyHint).map((definition) => definition.name));
2604
4349
  var DIRECTORY_EXCLUDED_TOOL_NAMES = new Set([
2605
4350
  "dynamoi_shop_create_checkout",
2606
4351
  "dynamoi_shop_get_quote",
2607
4352
  "dynamoi_get_billing",
4353
+ "dynamoi_get_resume_funding",
2608
4354
  "dynamoi_get_campaign_readiness",
4355
+ "dynamoi_manage_youtube_draft",
2609
4356
  "dynamoi_launch_campaign",
2610
4357
  "dynamoi_list_available_countries",
2611
4358
  "dynamoi_list_media_assets",
2612
4359
  "dynamoi_start_meta_connection",
2613
4360
  "dynamoi_start_youtube_channel_link",
2614
- "dynamoi_update_campaign"
4361
+ "dynamoi_update_campaign",
4362
+ "dynamoi_update_smart_link",
4363
+ "dynamoi_update_smart_link_artist_hub_settings",
4364
+ "dynamoi_update_smart_link_release_settings"
4365
+ ]);
4366
+ var DIRECTORY_ONLY_TOOL_NAMES = new Set([
4367
+ "dynamoi_update_smart_link_artist_settings",
4368
+ "dynamoi_update_smart_link_description"
4369
+ ]);
4370
+ var DIRECTORY_COMPATIBILITY_TOOL_NAMES = new Set([
4371
+ "dynamoi_update_smart_link"
2615
4372
  ]);
2616
4373
  function getDynamoiToolDefinitions(options) {
2617
4374
  const definitions = [...DYNAMOI_TOOL_DEFINITIONS];
2618
4375
  if (options?.toolProfile === "full") {
2619
- return definitions;
4376
+ return definitions.filter((definition) => !DIRECTORY_ONLY_TOOL_NAMES.has(definition.name));
2620
4377
  }
2621
4378
  return definitions.filter((definition) => !DIRECTORY_EXCLUDED_TOOL_NAMES.has(definition.name));
2622
4379
  }
4380
+ function getDynamoiToolCompatibilityDefinitions(options) {
4381
+ if (options?.toolProfile === "full") {
4382
+ return [];
4383
+ }
4384
+ return DYNAMOI_TOOL_DEFINITIONS.filter((definition) => DIRECTORY_COMPATIBILITY_TOOL_NAMES.has(definition.name));
4385
+ }
2623
4386
  var RECOVERY_METADATA_FIELDS = [
4387
+ "draftId",
4388
+ "failureStage",
4389
+ "screeningResult",
2624
4390
  "code",
2625
4391
  "field",
2626
4392
  "nextAction",
@@ -2642,6 +4408,7 @@ var SPOTIFY_ARTIST_CATALOG_ERROR_MESSAGES = new Set([
2642
4408
  "Use a Spotify artist URL for full-catalog Smart Link import. For album or track URLs, use dynamoi_create_smart_link_from_spotify."
2643
4409
  ]);
2644
4410
  var REVIEWER_WRITE_TOOL_NAMES = new Set([
4411
+ "dynamoi_manage_youtube_draft",
2645
4412
  "dynamoi_apply_for_distribution",
2646
4413
  "dynamoi_create_smart_link_from_spotify",
2647
4414
  "dynamoi_create_smart_links_from_spotify_artist",
@@ -2649,7 +4416,11 @@ var REVIEWER_WRITE_TOOL_NAMES = new Set([
2649
4416
  "dynamoi_start_meta_connection",
2650
4417
  "dynamoi_start_youtube_channel_link",
2651
4418
  "dynamoi_update_campaign",
2652
- "dynamoi_update_smart_link"
4419
+ "dynamoi_update_smart_link",
4420
+ "dynamoi_update_smart_link_artist_settings",
4421
+ "dynamoi_update_smart_link_description",
4422
+ "dynamoi_update_smart_link_artist_hub_settings",
4423
+ "dynamoi_update_smart_link_release_settings"
2653
4424
  ]);
2654
4425
  var SHOP_RATE_LIMIT_RETRY_AFTER_SECONDS = {
2655
4426
  checkout: 10 * 60,
@@ -2725,7 +4496,7 @@ function mapKnownErrorRecovery(toolName, kind, message) {
2725
4496
  retryable: false
2726
4497
  };
2727
4498
  }
2728
- if (toolName === "dynamoi_update_smart_link" && message === "Smart Link changed since it was last read. Read it again before updating.") {
4499
+ if ((toolName === "dynamoi_update_smart_link" || toolName === "dynamoi_update_smart_link_description" || toolName === "dynamoi_update_smart_link_artist_settings" || toolName === "dynamoi_update_smart_link_artist_hub_settings" || toolName === "dynamoi_update_smart_link_release_settings") && message === "Smart Link changed since it was last read. Read it again before updating.") {
2729
4500
  return {
2730
4501
  code: "STATE_CONFLICT",
2731
4502
  field: "expectedUpdatedAt",
@@ -2777,18 +4548,25 @@ var DYNAMOI_TOOL_DISPATCHERS = {
2777
4548
  dynamoi_create_smart_links_from_spotify_artist: (adapter, input) => adapter.createSmartLinksFromSpotifyArtist(input),
2778
4549
  dynamoi_get_account_overview: (adapter, input) => adapter.getCurrentUser(input),
2779
4550
  dynamoi_get_artist_analytics: (adapter, input) => adapter.getArtistAnalytics(input),
4551
+ dynamoi_get_audience_analytics: (adapter, input) => adapter.getAudienceAnalytics(input),
2780
4552
  dynamoi_get_billing: (adapter, input) => adapter.getBilling(input),
2781
4553
  dynamoi_get_campaign: (adapter, input) => adapter.getCampaign(input),
2782
4554
  dynamoi_get_campaign_readiness: (adapter, input) => adapter.getCampaignReadiness(input),
2783
4555
  dynamoi_get_distribution_application: (adapter, input) => adapter.getDistributionApplication(input),
4556
+ dynamoi_get_growth_audit: (adapter, input) => adapter.getGrowthAudit(input),
2784
4557
  dynamoi_get_platform_status: (adapter, input) => adapter.getPlatformStatus(input),
4558
+ dynamoi_get_playlist_analytics: (adapter, input) => adapter.getPlaylistAnalytics(input),
4559
+ dynamoi_get_resume_funding: (adapter, input) => adapter.getResumeFunding(input),
2785
4560
  dynamoi_get_smart_link: (adapter, input) => adapter.getSmartLink(input),
4561
+ dynamoi_get_youtube_channel_data: (adapter, input) => adapter.getYouTubeChannelData(input),
2786
4562
  dynamoi_launch_campaign: (adapter, input) => adapter.launchCampaign(input),
2787
4563
  dynamoi_list_artists: (adapter, input) => adapter.listArtists(input),
2788
4564
  dynamoi_list_available_countries: (adapter, input) => adapter.listAvailableCountries(input),
2789
4565
  dynamoi_list_campaigns: (adapter, input) => adapter.listCampaigns(input),
2790
4566
  dynamoi_list_media_assets: (adapter, input) => adapter.listMediaAssets(input),
2791
4567
  dynamoi_list_smart_links: (adapter, input) => adapter.listSmartLinks(input),
4568
+ dynamoi_manage_youtube_draft: (adapter, input) => adapter.manageYoutubeDraft(input),
4569
+ dynamoi_open_workspace: (adapter, input) => adapter.openWorkspace(input),
2792
4570
  dynamoi_preview_smart_link_themes: (_adapter, input) => Promise.resolve(previewSmartLinkThemes(input)),
2793
4571
  dynamoi_search: (adapter, input) => adapter.search(input),
2794
4572
  dynamoi_shop_create_checkout: (adapter, input) => adapter.shopCreateCheckout(input),
@@ -2797,9 +4575,36 @@ var DYNAMOI_TOOL_DISPATCHERS = {
2797
4575
  dynamoi_start_youtube_channel_link: (adapter, input) => adapter.startYoutubeChannelLink(input),
2798
4576
  dynamoi_update_campaign: (adapter, input) => adapter.updateCampaign(input),
2799
4577
  dynamoi_update_smart_link: (adapter, input) => adapter.updateSmartLink(input),
4578
+ dynamoi_update_smart_link_artist_hub_settings: (adapter, input) => adapter.updateSmartLinkArtistHubSettings(input),
4579
+ dynamoi_update_smart_link_artist_settings: (adapter, input) => adapter.updateSmartLink({
4580
+ ...input,
4581
+ action: "update_artist_settings"
4582
+ }),
4583
+ dynamoi_update_smart_link_description: (adapter, input) => adapter.updateSmartLink({
4584
+ ...input,
4585
+ action: "update_description"
4586
+ }),
4587
+ dynamoi_update_smart_link_release_settings: (adapter, input) => adapter.updateSmartLinkReleaseSettings(input),
2800
4588
  fetch: (adapter, input) => adapter.openAiFetch(input),
2801
4589
  search: (adapter, input) => adapter.openAiSearch(input)
2802
4590
  };
4591
+ var DEFAULT_OBSERVER_TIMEOUT_MS = 3000;
4592
+ async function runObserverBounded(observe, timeoutMs) {
4593
+ let timer;
4594
+ const observed = (async () => {
4595
+ try {
4596
+ await observe();
4597
+ } catch {}
4598
+ })();
4599
+ const timedOut = new Promise((resolve) => {
4600
+ timer = setTimeout(resolve, timeoutMs);
4601
+ });
4602
+ try {
4603
+ await Promise.race([observed, timedOut]);
4604
+ } finally {
4605
+ clearTimeout(timer);
4606
+ }
4607
+ }
2803
4608
  function snapshotForObserver(value) {
2804
4609
  try {
2805
4610
  return structuredClone(value);
@@ -2914,7 +4719,7 @@ function isObjectShapedJsonSchema(schema) {
2914
4719
  });
2915
4720
  }
2916
4721
  function toAdvertisedJsonSchema(schema, io) {
2917
- const { $schema: _dialect, ...jsonSchema } = z12.toJSONSchema(schema, {
4722
+ const { $schema: _dialect, ...jsonSchema } = z18.toJSONSchema(schema, {
2918
4723
  io,
2919
4724
  target: "draft-2020-12"
2920
4725
  });
@@ -2922,6 +4727,7 @@ function toAdvertisedJsonSchema(schema, io) {
2922
4727
  }
2923
4728
  function createDynamoiMcpServer(options) {
2924
4729
  const toolProfile = options.toolProfile ?? "directory";
4730
+ const observerTimeoutMs = options.observerTimeoutMs ?? DEFAULT_OBSERVER_TIMEOUT_MS;
2925
4731
  const server = new McpServer({
2926
4732
  name: "dynamoi",
2927
4733
  version: DYNAMOI_MCP_VERSION,
@@ -2935,18 +4741,27 @@ function createDynamoiMcpServer(options) {
2935
4741
  },
2936
4742
  instructions: toolProfile === "directory" ? DYNAMOI_CHATGPT_APP_INSTRUCTIONS : DYNAMOI_MCP_INSTRUCTIONS
2937
4743
  });
4744
+ const advertisedDefinitions = getDynamoiToolDefinitions({ toolProfile });
4745
+ const advertisedNames = new Set(advertisedDefinitions.map((definition) => definition.name));
4746
+ const definitionsToRegister = [
4747
+ ...advertisedDefinitions,
4748
+ ...getDynamoiToolCompatibilityDefinitions({ toolProfile })
4749
+ ];
2938
4750
  const advertisedTools = [];
2939
- for (const def of getDynamoiToolDefinitions({ toolProfile })) {
4751
+ for (const def of definitionsToRegister) {
2940
4752
  const title = def.title;
2941
4753
  const dispatcher = DYNAMOI_TOOL_DISPATCHERS[def.name];
2942
4754
  const idempotentHint = "idempotentHint" in def && typeof def.idempotentHint === "boolean" ? def.idempotentHint : undefined;
2943
4755
  const meta = {
2944
- securitySchemes: buildDynamoiToolSecuritySchemes(getDynamoiToolOAuthScopes(def.name, options.oauthScopes ?? DYNAMOI_BETTER_AUTH_MCP_SCOPES2))
4756
+ securitySchemes: buildDynamoiToolSecuritySchemes(getDynamoiToolOAuthScopes(def.name, options.oauthScopes ?? DYNAMOI_BETTER_AUTH_MCP_SCOPES))
2945
4757
  };
2946
4758
  if (def.name === "dynamoi_preview_smart_link_themes") {
2947
4759
  meta["openai/outputTemplate"] = SMART_LINK_THEME_PREVIEW_RESOURCE_URI;
2948
4760
  meta.ui = { resourceUri: SMART_LINK_THEME_PREVIEW_RESOURCE_URI };
2949
4761
  }
4762
+ if (def.name === "dynamoi_open_workspace") {
4763
+ Object.assign(meta, WORKSPACE_METADATA);
4764
+ }
2950
4765
  const annotations = {
2951
4766
  destructiveHint: def.destructiveHint,
2952
4767
  openWorldHint: def.openWorldHint,
@@ -2960,16 +4775,18 @@ function createDynamoiMcpServer(options) {
2960
4775
  toolName: def.name,
2961
4776
  toolProfile
2962
4777
  });
2963
- advertisedTools.push({
2964
- _meta: meta,
2965
- annotations,
2966
- description: def.description,
2967
- inputSchema: toAdvertisedJsonSchema(def.schema, "input"),
2968
- name: def.name,
2969
- outputSchema: toAdvertisedJsonSchema(outputSchema, "output"),
2970
- securitySchemes: meta.securitySchemes,
2971
- title
2972
- });
4778
+ if (advertisedNames.has(def.name)) {
4779
+ advertisedTools.push({
4780
+ _meta: meta,
4781
+ annotations,
4782
+ description: def.description,
4783
+ inputSchema: toAdvertisedJsonSchema(def.schema, "input"),
4784
+ name: def.name,
4785
+ outputSchema: toAdvertisedJsonSchema(outputSchema, "output"),
4786
+ securitySchemes: meta.securitySchemes,
4787
+ title
4788
+ });
4789
+ }
2973
4790
  server.registerTool(def.name, {
2974
4791
  _meta: meta,
2975
4792
  annotations,
@@ -2990,22 +4807,18 @@ function createDynamoiMcpServer(options) {
2990
4807
  outputSchema: def.outputSchema,
2991
4808
  toolName: def.name
2992
4809
  });
2993
- try {
2994
- await options.onToolCall?.({
2995
- durationMs: Date.now() - startedAt,
2996
- result: snapshotForObserver(finalized.structuredContent),
2997
- toolName: def.name
2998
- });
2999
- } catch {}
4810
+ await runObserverBounded(() => options.onToolCall?.({
4811
+ durationMs: Date.now() - startedAt,
4812
+ result: snapshotForObserver(finalized.structuredContent),
4813
+ toolName: def.name
4814
+ }), observerTimeoutMs);
3000
4815
  return finalized;
3001
4816
  } catch (error) {
3002
- try {
3003
- await options.onToolCall?.({
3004
- durationMs: Date.now() - startedAt,
3005
- error: snapshotForObserver(error),
3006
- toolName: def.name
3007
- });
3008
- } catch {}
4817
+ await runObserverBounded(() => options.onToolCall?.({
4818
+ durationMs: Date.now() - startedAt,
4819
+ error: snapshotForObserver(error),
4820
+ toolName: def.name
4821
+ }), observerTimeoutMs);
3009
4822
  throw error;
3010
4823
  }
3011
4824
  });
@@ -3029,6 +4842,7 @@ function createDynamoiMcpServer(options) {
3029
4842
  ]
3030
4843
  }));
3031
4844
  registerSmartLinkThemePreviewResource(server);
4845
+ registerWorkspaceResource(server);
3032
4846
  if (toolProfile === "full") {
3033
4847
  registerDynamoiPrompts(server);
3034
4848
  registerDynamoiResources(server, options.adapter);
@@ -3142,19 +4956,123 @@ async function handleMcpHttpRequest(options) {
3142
4956
  modernServerFactories.delete(options.request);
3143
4957
  }
3144
4958
  }
4959
+ // src/youtube-metrics.ts
4960
+ var YOUTUBE_CHANNEL_ANALYTICS_LAG_DAYS = 3;
4961
+ var YOUTUBE_PROVISIONAL_CONVERSION_DAYS = 2;
4962
+ var YOUTUBE_FOLLOW_ON_VIEWS_CONVERSION_ACTION_ID = "7108487969";
4963
+ var YOUTUBE_SUBSCRIBERS_CONVERSION_ACTION_ID = "1001375898";
4964
+ var YOUTUBE_METRIC_IDS = [
4965
+ "views_through_ad",
4966
+ "cost_per_view",
4967
+ "direct_organic_views",
4968
+ "direct_subscribers",
4969
+ "interactions",
4970
+ "channel_views",
4971
+ "channel_advertising_views",
4972
+ "channel_net_subscribers"
4973
+ ];
4974
+ var YOUTUBE_METRIC_DICTIONARY = {
4975
+ channel_advertising_views: {
4976
+ class: "context",
4977
+ clientLabel: null,
4978
+ freshness: "channel_analytics",
4979
+ id: "channel_advertising_views",
4980
+ meaning: "Channel views YouTube tags with the ADVERTISING traffic source. It undercounts ad-driven views, because an ad click that lands in a playlist is credited mostly to PLAYLIST and SUBSCRIBER traffic. It is not views through the ad and never a subtraction base for organic views.",
4981
+ sourceField: "YouTube Analytics API insightTrafficSourceType = ADVERTISING (views)"
4982
+ },
4983
+ channel_net_subscribers: {
4984
+ class: "context",
4985
+ clientLabel: "Channel subscribers",
4986
+ freshness: "channel_analytics",
4987
+ id: "channel_net_subscribers",
4988
+ meaning: "Subscribers gained minus subscribers lost across the whole channel. Not attributed to the campaign.",
4989
+ sourceField: "YouTube Analytics API subscribersGained - subscribersLost"
4990
+ },
4991
+ channel_views: {
4992
+ class: "context",
4993
+ clientLabel: "Channel views",
4994
+ freshness: "channel_analytics",
4995
+ id: "channel_views",
4996
+ meaning: "All views of the channel from every source, as YouTube reports them. Context for the campaign period; not attributed to the campaign and not organic proof.",
4997
+ sourceField: "YouTube Analytics API views"
4998
+ },
4999
+ cost_per_view: {
5000
+ class: "credited",
5001
+ clientLabel: "Cost per view",
5002
+ freshness: "ad_account",
5003
+ id: "cost_per_view",
5004
+ meaning: "Billed campaign cost divided by views through the ad. Never divided by interactions.",
5005
+ sourceField: "billed cost / google_ads.metrics.clicks"
5006
+ },
5007
+ direct_organic_views: {
5008
+ class: "credited",
5009
+ clientLabel: "Organic views directly attributed",
5010
+ freshness: "ad_account_provisional",
5011
+ id: "direct_organic_views",
5012
+ meaning: "Follow-on views of the artist's videos that the ad account credits to the campaign, counted by click date and provisional for two days. Whether the count includes the first watch after the click is unconfirmed; do not claim either way. Not a measure of all organic growth.",
5013
+ sourceField: `google_ads.metrics.all_conversions where conversion_action = ${YOUTUBE_FOLLOW_ON_VIEWS_CONVERSION_ACTION_ID} ("YouTube follow-on views")`
5014
+ },
5015
+ direct_subscribers: {
5016
+ class: "credited",
5017
+ clientLabel: "Subscribers directly attributed",
5018
+ freshness: "ad_account_provisional",
5019
+ id: "direct_subscribers",
5020
+ meaning: "Subscriptions the ad account credits to the campaign, counted by click date and provisional for two days. Subscriptions are a secondary goal, so the primary `conversions` metric reads zero; the count lives in `all_conversions`.",
5021
+ sourceField: `google_ads.metrics.all_conversions where conversion_action = ${YOUTUBE_SUBSCRIBERS_CONVERSION_ACTION_ID}`
5022
+ },
5023
+ interactions: {
5024
+ class: "internal",
5025
+ clientLabel: null,
5026
+ freshness: "ad_account",
5027
+ id: "interactions",
5028
+ meaning: "Demand Gen interactions: a five-second feed watch or a click. Roughly 1.5 to 1.9 times clicks. A delivery diagnostic shown only under its own Interactions label in the dashboard delivery detail, and the basis of Shop delivery economics. Never described as views and never the basis of cost per view.",
5029
+ sourceField: "google_ads.metrics.interactions"
5030
+ },
5031
+ views_through_ad: {
5032
+ class: "credited",
5033
+ clientLabel: "Views through the ad",
5034
+ freshness: "ad_account",
5035
+ id: "views_through_ad",
5036
+ meaning: "Viewers who clicked the in-feed ad through to the YouTube watch page. Not TrueView views, not interactions, and not the channel's ADVERTISING traffic source.",
5037
+ sourceField: "google_ads.metrics.clicks"
5038
+ }
5039
+ };
5040
+ function getYouTubeMetric(id) {
5041
+ return YOUTUBE_METRIC_DICTIONARY[id];
5042
+ }
5043
+ var YOUTUBE_AGENT_KNOWLEDGE = {
5044
+ doNotClaim: [
5045
+ "Do not call interactions, TrueView views or the channel's ADVERTISING traffic source 'views through the ad'.",
5046
+ "Do not say the directly attributed organic views include, or exclude, the first watch after the ad click. That is unconfirmed.",
5047
+ "Do not present a channel-wide change, or the channel's non-ADVERTISING views, as organic proof or as caused by the campaign.",
5048
+ "Do not publish a causal organic-lift number. The lift model stays unpublished until it passes its published test.",
5049
+ "Do not promise growth, guaranteed results, algorithm boosts, halo effects, multipliers, or that a campaign pays for itself.",
5050
+ "Do not state or imply any internal economics or how the price is built. Costs are the client's billed budget only."
5051
+ ],
5052
+ nuances: [
5053
+ "Views through the ad and cost per view use the ad account's daily numbers, complete through yesterday.",
5054
+ "Directly attributed organic views and subscribers are credited by click date and stay provisional for two days.",
5055
+ "Channel analytics from YouTube lag about three days. Days newer than that are still processing and must never be shown as zero; always show a 'Through <date>' marker.",
5056
+ "Report long-form views first and Shorts separately. Never lead with a combined total.",
5057
+ "Indirect organic effect is shown as the channel's trend against its own pre-campaign baseline, with campaign windows marked, never as a causal number."
5058
+ ],
5059
+ valueProp: "Dynamoi runs managed YouTube campaigns for music artists who want more people watching their own videos and playlists. The ad sends viewers to the artist's channel on YouTube, and Dynamoi reports how many viewers clicked through, plus the follow-on views and subscribers the ad account credits to the campaign. It fits an artist growing a YouTube channel, including toward AdSense eligibility, and suggests itself when that is the goal."
5060
+ };
5061
+ var YOUTUBE_DIRECT_ORGANIC_VIEWS_NOTE = "organic views directly attributed: follow-on views the ad account credits to this campaign by click date, provisional for two days; not YouTube's channel view count and not proof of overall organic growth";
3145
5062
  export {
5063
+ ChannelResultsSchema,
3146
5064
  DISTRIBUTION_TOOL_DEFINITIONS,
3147
5065
  DYNAMOI_ABOUT_DIRECTORY_MARKDOWN,
3148
5066
  DYNAMOI_ABOUT_MARKDOWN,
3149
5067
  DYNAMOI_ABOUT_RESOURCE,
3150
5068
  DYNAMOI_ABOUT_TOOL_DEFINITION,
3151
- DYNAMOI_BETTER_AUTH_MCP_SCOPES2 as DYNAMOI_BETTER_AUTH_MCP_SCOPES,
5069
+ DYNAMOI_BETTER_AUTH_MCP_SCOPES,
3152
5070
  DYNAMOI_MCP_REGISTRY_DESCRIPTION_MAX_LENGTH,
3153
5071
  DYNAMOI_MCP_SERVER_NAME,
3154
5072
  DYNAMOI_MCP_SHORT_DESCRIPTION,
3155
5073
  DYNAMOI_MCP_STANDARD_DESCRIPTION,
3156
5074
  DYNAMOI_MCP_TAGLINE,
3157
- DYNAMOI_MCP_TOOL_SCOPES2 as DYNAMOI_MCP_TOOL_SCOPES,
5075
+ DYNAMOI_MCP_TOOL_SCOPES,
3158
5076
  DYNAMOI_MCP_VERSION,
3159
5077
  DYNAMOI_SHOP_FULL_SCOPE,
3160
5078
  DYNAMOI_SHOP_MAX_TARGET_COUNTRY_CODES,
@@ -3164,6 +5082,7 @@ export {
3164
5082
  DynamoiCreateSmartLinksFromSpotifyArtistInputSchema,
3165
5083
  DynamoiGetArtistAnalyticsInputSchema,
3166
5084
  DynamoiGetArtistInputSchema,
5085
+ DynamoiGetAudienceAnalyticsInputSchema,
3167
5086
  DynamoiGetBillingInputSchema,
3168
5087
  DynamoiGetCampaignAnalyticsInputSchema,
3169
5088
  DynamoiGetCampaignDeploymentStatusInputSchema,
@@ -3171,17 +5090,22 @@ export {
3171
5090
  DynamoiGetCampaignReadinessInputSchema,
3172
5091
  DynamoiGetCurrentUserInputSchema,
3173
5092
  DynamoiGetDistributionApplicationInputSchema,
5093
+ DynamoiGetGrowthAuditInputSchema,
3174
5094
  DynamoiGetOnboardingStatusInputSchema,
3175
5095
  DynamoiGetPlatformStatusInputSchema,
5096
+ DynamoiGetPlaylistAnalyticsInputSchema,
5097
+ DynamoiGetResumeFundingInputSchema,
3176
5098
  DynamoiGetSmartLinkAnalyticsInputSchema,
3177
5099
  DynamoiGetSmartLinkArtistSettingsInputSchema,
3178
5100
  DynamoiGetSmartLinkInputSchema,
5101
+ DynamoiGetYouTubeChannelDataInputSchema,
3179
5102
  DynamoiLaunchCampaignInputSchema,
3180
5103
  DynamoiListArtistsInputSchema,
3181
5104
  DynamoiListAvailableCountriesInputSchema,
3182
5105
  DynamoiListCampaignsInputSchema,
3183
5106
  DynamoiListMediaAssetsInputSchema,
3184
5107
  DynamoiListSmartLinksInputSchema,
5108
+ DynamoiManageYoutubeDraftInputSchema,
3185
5109
  DynamoiOpenAiFetchInputSchema,
3186
5110
  DynamoiOpenAiSearchInputSchema,
3187
5111
  DynamoiPauseCampaignInputSchema,
@@ -3197,25 +5121,56 @@ export {
3197
5121
  DynamoiStartYoutubeChannelLinkInputSchema,
3198
5122
  DynamoiUpdateBudgetInputSchema,
3199
5123
  DynamoiUpdateCampaignInputSchema,
5124
+ DynamoiUpdateSmartLinkArtistHubSettingsInputSchema,
3200
5125
  DynamoiUpdateSmartLinkArtistSettingsInputSchema,
5126
+ DynamoiUpdateSmartLinkDescriptionInputSchema,
3201
5127
  DynamoiUpdateSmartLinkInputSchema,
5128
+ DynamoiUpdateSmartLinkReleaseSettingsInputSchema,
3202
5129
  PHASE_1_TOOL_DEFINITIONS,
3203
5130
  PHASE_2_TOOL_DEFINITIONS,
3204
5131
  PHASE_3_TOOL_DEFINITIONS,
3205
5132
  PHASE_4_TOOL_DEFINITIONS,
3206
5133
  PHASE_ONBOARDING_TOOL_DEFINITIONS,
3207
- PROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY2 as PROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY,
3208
- PROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY_HASH2 as PROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY_HASH,
3209
- PROSPECTIVE_BUDGET_FUNDING_CONSENT_VERSION2 as PROSPECTIVE_BUDGET_FUNDING_CONSENT_VERSION,
5134
+ PROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY,
5135
+ PROSPECTIVE_BUDGET_FUNDING_CONSENT_COPY_HASH,
5136
+ PROSPECTIVE_BUDGET_FUNDING_CONSENT_VERSION,
3210
5137
  SHOP_TOOL_DEFINITIONS,
5138
+ SMART_LINK_UPDATE_OPERATION_TOOL_DEFINITIONS,
5139
+ TOTAL_BUDGET_FUNDING_CONSENT_COPY,
5140
+ TOTAL_BUDGET_FUNDING_CONSENT_COPY_HASH,
5141
+ TOTAL_BUDGET_FUNDING_CONSENT_VERSION,
3211
5142
  ToolFormatSchema2 as ToolFormatSchema,
3212
- buildWwwAuthenticateHeader2 as buildWwwAuthenticateHeader,
5143
+ WORKSPACE_TOOL_DEFINITION,
5144
+ YOUTUBE_AGENT_KNOWLEDGE,
5145
+ YOUTUBE_CAMPAIGN_STRATEGIES_RESOURCE_URI,
5146
+ YOUTUBE_CHANNEL_ANALYTICS_LAG_DAYS,
5147
+ YOUTUBE_CHANNEL_DATASETS,
5148
+ YOUTUBE_CHANNEL_DATA_DEFAULT_LIMIT,
5149
+ YOUTUBE_DIRECT_ORGANIC_VIEWS_NOTE,
5150
+ YOUTUBE_FOLLOW_ON_VIEWS_CONVERSION_ACTION_ID,
5151
+ YOUTUBE_METRIC_DICTIONARY,
5152
+ YOUTUBE_METRIC_IDS,
5153
+ YOUTUBE_PROVISIONAL_CONVERSION_DAYS,
5154
+ YOUTUBE_SUBSCRIBERS_CONVERSION_ACTION_ID,
5155
+ YouTubeChannelDataSchema,
5156
+ YouTubeChannelDatasetSchema,
5157
+ buildWwwAuthenticateHeader,
5158
+ buildYouTubeStrategyGuide,
3213
5159
  createDynamoiMcpServer,
3214
5160
  getDynamoiAbout,
5161
+ getDynamoiToolCompatibilityDefinitions,
3215
5162
  getDynamoiToolDefinitions,
5163
+ getYouTubeMetric,
3216
5164
  handleMcpHttpRequest,
3217
- parseDynamoiGetSmartLinkInput
5165
+ openWorkspace,
5166
+ parseDynamoiCreateSmartLinkFromSpotifyInput,
5167
+ parseDynamoiCreateSmartLinksFromSpotifyArtistInput,
5168
+ parseDynamoiGetSmartLinkAnalyticsInput,
5169
+ parseDynamoiGetSmartLinkArtistSettingsInput,
5170
+ parseDynamoiGetSmartLinkInput,
5171
+ parseDynamoiListSmartLinksInput,
5172
+ parseDynamoiUpdateSmartLinkArtistHubSettingsInput,
5173
+ parseDynamoiUpdateSmartLinkArtistSettingsInput,
5174
+ parseDynamoiUpdateSmartLinkInput,
5175
+ parseDynamoiUpdateSmartLinkReleaseSettingsInput
3218
5176
  };
3219
-
3220
- //# debugId=4BED73D580BA650A64756E2164756E21
3221
- //# sourceMappingURL=index.js.map