@mastra/deployer-vercel 0.0.0-vnext-inngest-20250508131921 → 0.0.0-vnext-20251104230439

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md CHANGED
@@ -1,46 +1,15 @@
1
- # Elastic License 2.0 (ELv2)
1
+ # Apache License 2.0
2
2
 
3
- Copyright (c) 2025 Mastra AI, Inc.
3
+ Copyright (c) 2025 Kepler Software, Inc.
4
4
 
5
- **Acceptance**
6
- By using the software, you agree to all of the terms and conditions below.
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
7
8
 
8
- **Copyright License**
9
- The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license to use, copy, distribute, make available, and prepare derivative works of the software, in each case subject to the limitations and conditions below
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
10
 
11
- **Limitations**
12
- You may not provide the software to third parties as a hosted or managed service, where the service provides users with access to any substantial set of the features or functionality of the software.
13
-
14
- You may not move, change, disable, or circumvent the license key functionality in the software, and you may not remove or obscure any functionality in the software that is protected by the license key.
15
-
16
- You may not alter, remove, or obscure any licensing, copyright, or other notices of the licensor in the software. Any use of the licensor’s trademarks is subject to applicable law.
17
-
18
- **Patents**
19
- The licensor grants you a license, under any patent claims the licensor can license, or becomes able to license, to make, have made, use, sell, offer for sale, import and have imported the software, in each case subject to the limitations and conditions in this license. This license does not cover any patent claims that you cause to be infringed by modifications or additions to the software. If you or your company make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
20
-
21
- **Notices**
22
- You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms.
23
-
24
- If you modify the software, you must include in any modified copies of the software prominent notices stating that you have modified the software.
25
-
26
- **No Other Rights**
27
- These terms do not imply any licenses other than those expressly granted in these terms.
28
-
29
- **Termination**
30
- If you use the software in violation of these terms, such use is not licensed, and your licenses will automatically terminate. If the licensor provides you with a notice of your violation, and you cease all violation of this license no later than 30 days after you receive that notice, your licenses will be reinstated retroactively. However, if you violate these terms after such reinstatement, any additional violation of these terms will cause your licenses to terminate automatically and permanently.
31
-
32
- **No Liability**
33
- As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.
34
-
35
- **Definitions**
36
- The _licensor_ is the entity offering these terms, and the _software_ is the software the licensor makes available under these terms, including any portion of it.
37
-
38
- _you_ refers to the individual or entity agreeing to these terms.
39
-
40
- _your company_ is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. _control_ means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
41
-
42
- _your licenses_ are all the licenses granted to you for the software under these terms.
43
-
44
- _use_ means anything you do with the software requiring one of your licenses.
45
-
46
- _trademark_ means trademarks, service marks, and similar rights.
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
package/README.md CHANGED
@@ -21,13 +21,14 @@ pnpm add @mastra/deployer-vercel
21
21
  The Vercel deployer is used as part of the Mastra framework:
22
22
 
23
23
  ```typescript
24
- import { Mastra } from '@mastra/core';
24
+ import { Mastra } from '@mastra/core/mastra';
25
25
  import { VercelDeployer } from '@mastra/deployer-vercel';
26
26
 
27
27
  const deployer = new VercelDeployer({
28
- teamSlug: 'your-team-slug',
29
- projectName: 'your-project-name',
30
- token: 'your-vercel-token',
28
+ // Optional per-function overrides (written to .vc-config.json)
29
+ maxDuration: 600,
30
+ memory: 1536,
31
+ regions: ['sfo1', 'iad1'],
31
32
  });
32
33
 
33
34
  const mastra = new Mastra({
@@ -40,9 +41,11 @@ const mastra = new Mastra({
40
41
 
41
42
  ### Constructor Options
42
43
 
43
- - `teamSlug` (required): Your Vercel team slug
44
- - `projectName`: Name of your Vercel project (will be created if it doesn't exist)
45
- - `token`: Your Vercel API token (required for authentication)
44
+ High‑value overrides written to `.vercel/output/functions/index.func/.vc-config.json`:
45
+
46
+ - `maxDuration?: number` Function execution timeout (seconds)
47
+ - `memory?: number` — Function memory (MB)
48
+ - `regions?: string[]` — Regions (e.g. `['sfo1','iad1']`)
46
49
 
47
50
  ## Project Structure
48
51
 
package/dist/index.cjs CHANGED
@@ -1,234 +1,105 @@
1
1
  'use strict';
2
2
 
3
- var child_process = require('child_process');
4
3
  var fs = require('fs');
5
4
  var path = require('path');
6
5
  var process = require('process');
7
6
  var deployer = require('@mastra/deployer');
7
+ var esm = require('fs-extra/esm');
8
8
 
9
9
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
10
 
11
- function _interopNamespace(e) {
12
- if (e && e.__esModule) return e;
13
- var n = Object.create(null);
14
- if (e) {
15
- Object.keys(e).forEach(function (k) {
16
- if (k !== 'default') {
17
- var d = Object.getOwnPropertyDescriptor(e, k);
18
- Object.defineProperty(n, k, d.get ? d : {
19
- enumerable: true,
20
- get: function () { return e[k]; }
21
- });
22
- }
23
- });
24
- }
25
- n.default = e;
26
- return Object.freeze(n);
27
- }
28
-
29
- var child_process__namespace = /*#__PURE__*/_interopNamespace(child_process);
30
11
  var process__default = /*#__PURE__*/_interopDefault(process);
31
12
 
32
13
  // src/index.ts
33
14
  var VercelDeployer = class extends deployer.Deployer {
34
- teamSlug;
35
- projectName;
36
- token;
37
- constructor({ teamSlug, projectName, token }) {
15
+ vcConfigOverrides = {};
16
+ constructor(options = {}) {
38
17
  super({ name: "VERCEL" });
39
- this.teamSlug = teamSlug;
40
- this.projectName = projectName;
41
- this.token = token;
42
- }
43
- getProjectId({ dir }) {
44
- const projectJsonPath = path.join(dir, "output", ".vercel", "project.json");
45
- try {
46
- const projectJson = JSON.parse(fs.readFileSync(projectJsonPath, "utf-8"));
47
- return projectJson.projectId;
48
- } catch {
49
- throw new Error("Could not find project ID. Make sure the project has been deployed first.");
50
- }
51
- }
52
- async getTeamId() {
53
- const response = await fetch(`https://api.vercel.com/v2/teams`, {
54
- headers: {
55
- Authorization: `Bearer ${this.token}`
56
- }
57
- });
58
- const res = await response.json();
59
- const teams = res.teams;
60
- return teams.find((team) => team.slug === this.teamSlug)?.id;
61
- }
62
- async syncEnv(envVars, { outputDirectory }) {
63
- console.log("Syncing environment variables...");
64
- const vercelEnvVars = Array.from(envVars.entries()).map(([key, value]) => {
65
- if (!key || !value) {
66
- throw new Error(`Invalid environment variable format: ${key || value}`);
67
- }
68
- return {
69
- key,
70
- value,
71
- target: ["production", "preview", "development"],
72
- type: "plain"
73
- };
74
- });
75
- try {
76
- const projectId = this.getProjectId({ dir: outputDirectory });
77
- const teamId = await this.getTeamId();
78
- const response = await fetch(
79
- `https://api.vercel.com/v10/projects/${projectId}/env?teamId=${teamId}&upsert=true`,
80
- {
81
- method: "POST",
82
- headers: {
83
- Authorization: `Bearer ${this.token}`,
84
- "Content-Type": "application/json"
85
- },
86
- body: JSON.stringify(vercelEnvVars)
87
- }
88
- );
89
- if (!response.ok) {
90
- const error = await response.json();
91
- throw new Error(`Failed to sync environment variables: ${error.message}`);
92
- }
93
- console.log("\u2713 Successfully synced environment variables");
94
- } catch (error) {
95
- if (error instanceof Error) {
96
- console.error("Failed to sync environment variables:", error.message);
97
- } else {
98
- console.error("Failed to sync environment variables:", error);
99
- }
100
- throw error;
101
- }
18
+ this.outputDir = path.join(".vercel", "output", "functions", "index.func");
19
+ this.vcConfigOverrides = { ...options };
102
20
  }
103
21
  async prepare(outputDirectory) {
104
22
  await super.prepare(outputDirectory);
23
+ this.writeVercelJSON(path.join(outputDirectory, this.outputDir, "..", ".."));
105
24
  }
106
25
  getEntry() {
107
26
  return `
108
27
  import { handle } from 'hono/vercel'
109
28
  import { mastra } from '#mastra';
110
- import { createHonoServer } from '#server';
111
- import { evaluate } from '@mastra/core/eval';
112
- import { AvailableHooks, registerHook } from '@mastra/core/hooks';
113
- import { TABLE_EVALS } from '@mastra/core/storage';
114
- import { checkEvalStorageFields } from '@mastra/core/utils';
115
-
116
- registerHook(AvailableHooks.ON_GENERATION, ({ input, output, metric, runId, agentName, instructions }) => {
117
- evaluate({
118
- agentName,
119
- input,
120
- metric,
121
- output,
122
- runId,
123
- globalRunId: runId,
124
- instructions,
125
- });
126
- });
29
+ import { createHonoServer, getToolExports } from '#server';
30
+ import { tools } from '#tools';
31
+ import { scoreTracesWorkflow } from '@mastra/core/evals/scoreTraces';
127
32
 
128
33
  if (mastra.getStorage()) {
129
- // start storage init in the background
130
- mastra.getStorage().init();
34
+ mastra.__registerInternalWorkflow(scoreTracesWorkflow);
131
35
  }
132
36
 
133
- registerHook(AvailableHooks.ON_EVALUATION, async traceObject => {
134
- const storage = mastra.getStorage();
135
- if (storage) {
136
- // Check for required fields
137
- const logger = mastra?.getLogger();
138
- const areFieldsValid = checkEvalStorageFields(traceObject, logger);
139
- if (!areFieldsValid) return;
140
-
141
- await storage.insert({
142
- tableName: TABLE_EVALS,
143
- record: {
144
- input: traceObject.input,
145
- output: traceObject.output,
146
- result: JSON.stringify(traceObject.result || {}),
147
- agent_name: traceObject.agentName,
148
- metric_name: traceObject.metricName,
149
- instructions: traceObject.instructions,
150
- test_info: null,
151
- global_run_id: traceObject.globalRunId,
152
- run_id: traceObject.runId,
153
- created_at: new Date().toISOString(),
154
- },
155
- });
156
- }
157
- });
158
-
159
- const app = await createHonoServer(mastra);
37
+ const app = await createHonoServer(mastra, { tools: getToolExports(tools) });
160
38
 
161
39
  export const GET = handle(app);
162
40
  export const POST = handle(app);
41
+ export const PUT = handle(app);
42
+ export const DELETE = handle(app);
43
+ export const PATCH = handle(app);
44
+ export const OPTIONS = handle(app);
45
+ export const HEAD = handle(app);
163
46
  `;
164
47
  }
165
- writeVercelJSON(outputDirectory, files = ["./*"]) {
48
+ writeVercelJSON(outputDirectory) {
166
49
  fs.writeFileSync(
167
- path.join(outputDirectory, this.outputDir, "vercel.json"),
168
- JSON.stringify(
169
- {
170
- version: 2,
171
- installCommand: "npm install --omit=dev",
172
- builds: [
173
- {
174
- src: "index.mjs",
175
- use: "@vercel/node",
176
- config: { includeFiles: files }
177
- }
178
- ],
179
- routes: [
180
- {
181
- src: "/(.*)",
182
- dest: "index.mjs"
183
- }
184
- ]
185
- },
186
- null,
187
- 2
188
- )
50
+ path.join(outputDirectory, "config.json"),
51
+ JSON.stringify({
52
+ version: 3,
53
+ routes: [
54
+ {
55
+ src: "/(.*)",
56
+ dest: "/"
57
+ }
58
+ ]
59
+ })
189
60
  );
190
61
  }
191
- async bundle(entryFile, outputDirectory, toolsPaths) {
192
- const result = await this._bundle(this.getEntry(), entryFile, outputDirectory, toolsPaths);
193
- const files = fs.readdirSync(path.join(outputDirectory, this.outputDir), {
194
- recursive: true
195
- });
196
- const filesWithoutNodeModules = files.filter(
197
- (file) => typeof file === "string" && !file.startsWith("node_modules")
62
+ async bundle(entryFile, outputDirectory, { toolsPaths, projectRoot }) {
63
+ const result = await this._bundle(
64
+ this.getEntry(),
65
+ entryFile,
66
+ { outputDirectory, projectRoot },
67
+ toolsPaths,
68
+ path.join(outputDirectory, this.outputDir)
198
69
  );
199
- this.writeVercelJSON(outputDirectory, filesWithoutNodeModules);
70
+ const nodeVersion = process__default.default.version?.split(".")?.[0]?.replace("v", "") ?? "22";
71
+ const vcConfig = {
72
+ handler: "index.mjs",
73
+ launcherType: "Nodejs",
74
+ runtime: `nodejs${nodeVersion}.x`,
75
+ shouldAddHelpers: true
76
+ };
77
+ const { maxDuration, memory, regions } = this.vcConfigOverrides;
78
+ if (typeof maxDuration === "number") vcConfig.maxDuration = maxDuration;
79
+ if (typeof memory === "number") vcConfig.memory = memory;
80
+ if (Array.isArray(regions) && regions.length > 0) vcConfig.regions = regions;
81
+ fs.writeFileSync(path.join(outputDirectory, this.outputDir, ".vc-config.json"), JSON.stringify(vcConfig, null, 2));
82
+ await esm.move(path.join(outputDirectory, ".vercel", "output"), path.join(process__default.default.cwd(), ".vercel", "output"), {
83
+ overwrite: true
84
+ });
200
85
  return result;
201
86
  }
202
- async deploy(outputDirectory) {
203
- const envVars = await this.loadEnvVars();
204
- const commandArgs = [
205
- "--scope",
206
- this.teamSlug,
207
- "--cwd",
208
- path.join(outputDirectory, this.outputDir),
209
- "--token",
210
- this.token,
211
- "deploy",
212
- "--yes",
213
- ...this.projectName ? ["--name", this.projectName] : []
214
- ];
215
- child_process__namespace.execSync(`npx vercel ${commandArgs.join(" ")}`, {
216
- cwd: path.join(outputDirectory, this.outputDir),
217
- env: {
218
- PATH: process__default.default.env.PATH
219
- },
220
- stdio: "inherit"
221
- });
222
- this.logger.info("Deployment started on Vercel. You can wait for it to finish or exit this command.");
223
- if (envVars.size > 0) {
224
- await this.syncEnv(envVars, { outputDirectory });
225
- } else {
226
- this.logger.info("\nAdd your ENV vars to .env or your vercel dashboard.\n");
227
- }
87
+ async deploy() {
88
+ this.logger?.info("Deploying to Vercel is deprecated. Please use the Vercel dashboard to deploy.");
228
89
  }
229
90
  async lint(entryFile, outputDirectory, toolsPaths) {
230
91
  await super.lint(entryFile, outputDirectory, toolsPaths);
92
+ const hasLibsql = await this.deps.checkDependencies(["@mastra/libsql"]) === `ok`;
93
+ if (hasLibsql) {
94
+ this.logger.error(
95
+ `Vercel Deployer does not support @libsql/client(which may have been installed by @mastra/libsql) as a dependency.
96
+ Use other Mastra Storage options instead e.g @mastra/pg`
97
+ );
98
+ process__default.default.exit(1);
99
+ }
231
100
  }
232
101
  };
233
102
 
234
103
  exports.VercelDeployer = VercelDeployer;
104
+ //# sourceMappingURL=index.cjs.map
105
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":["Deployer","join","writeFileSync","process","move"],"mappings":";;;;;;;;;;;;;AAOO,IAAM,cAAA,GAAN,cAA6BA,iBAAA,CAAS;AAAA,EAC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,EAEA,MAAM,IAAA,CAAK,SAAA,EAAmB,eAAA,EAAyB,UAAA,EAAkD;AACvG,IAAA,MAAM,KAAA,CAAM,IAAA,CAAK,SAAA,EAAW,eAAA,EAAiB,UAAU,CAAA;AAEvD,IAAA,MAAM,SAAA,GAAa,MAAM,IAAA,CAAK,IAAA,CAAK,kBAAkB,CAAC,gBAAgB,CAAC,CAAA,KAAO,CAAA,EAAA,CAAA;AAE9E,IAAA,IAAI,SAAA,EAAW;AACb,MAAA,IAAA,CAAK,MAAA,CAAO,KAAA;AAAA,QACV,CAAA;AAAA,2DAAA;AAAA,OAEF;AACA,MAAAA,wBAAA,CAAQ,KAAK,CAAC,CAAA;AAAA,IAChB;AAAA,EACF;AACF","file":"index.cjs","sourcesContent":["import { writeFileSync } from 'fs';\nimport { join } from 'path';\nimport process from 'process';\nimport { Deployer } from '@mastra/deployer';\nimport { move } from 'fs-extra/esm';\nimport type { VcConfig, VcConfigOverrides, VercelDeployerOptions } from './types';\n\nexport class VercelDeployer extends Deployer {\n private vcConfigOverrides: VcConfigOverrides = {};\n\n constructor(options: VercelDeployerOptions = {}) {\n super({ name: 'VERCEL' });\n this.outputDir = join('.vercel', 'output', 'functions', 'index.func');\n\n // Store all overrides centrally\n this.vcConfigOverrides = { ...options };\n }\n\n async prepare(outputDirectory: string): Promise<void> {\n await super.prepare(outputDirectory);\n\n this.writeVercelJSON(join(outputDirectory, this.outputDir, '..', '..'));\n }\n\n private getEntry(): string {\n return `\nimport { handle } from 'hono/vercel'\nimport { mastra } from '#mastra';\nimport { createHonoServer, getToolExports } from '#server';\nimport { tools } from '#tools';\nimport { scoreTracesWorkflow } from '@mastra/core/evals/scoreTraces';\n\nif (mastra.getStorage()) {\n mastra.__registerInternalWorkflow(scoreTracesWorkflow);\n}\n\nconst app = await createHonoServer(mastra, { tools: getToolExports(tools) });\n\nexport const GET = handle(app);\nexport const POST = handle(app);\nexport const PUT = handle(app);\nexport const DELETE = handle(app);\nexport const PATCH = handle(app);\nexport const OPTIONS = handle(app);\nexport const HEAD = handle(app);\n`;\n }\n\n private writeVercelJSON(outputDirectory: string) {\n writeFileSync(\n join(outputDirectory, 'config.json'),\n JSON.stringify({\n version: 3,\n routes: [\n {\n src: '/(.*)',\n dest: '/',\n },\n ],\n }),\n );\n }\n\n async bundle(\n entryFile: string,\n outputDirectory: string,\n { toolsPaths, projectRoot }: { toolsPaths: (string | string[])[]; projectRoot: string },\n ): Promise<void> {\n const result = await this._bundle(\n this.getEntry(),\n entryFile,\n { outputDirectory, projectRoot },\n toolsPaths,\n join(outputDirectory, this.outputDir),\n );\n\n const nodeVersion = process.version?.split('.')?.[0]?.replace('v', '') ?? '22';\n\n const vcConfig: VcConfig = {\n handler: 'index.mjs',\n launcherType: 'Nodejs',\n runtime: `nodejs${nodeVersion}.x`,\n shouldAddHelpers: true,\n };\n\n // Merge supported overrides\n const { maxDuration, memory, regions } = this.vcConfigOverrides;\n if (typeof maxDuration === 'number') vcConfig.maxDuration = maxDuration;\n if (typeof memory === 'number') vcConfig.memory = memory;\n if (Array.isArray(regions) && regions.length > 0) vcConfig.regions = regions;\n\n writeFileSync(join(outputDirectory, this.outputDir, '.vc-config.json'), JSON.stringify(vcConfig, null, 2));\n\n await move(join(outputDirectory, '.vercel', 'output'), join(process.cwd(), '.vercel', 'output'), {\n overwrite: true,\n });\n\n return result;\n }\n\n async deploy(): Promise<void> {\n this.logger?.info('Deploying to Vercel is deprecated. Please use the Vercel dashboard to deploy.');\n }\n\n async lint(entryFile: string, outputDirectory: string, toolsPaths: (string | string[])[]): Promise<void> {\n await super.lint(entryFile, outputDirectory, toolsPaths);\n\n const hasLibsql = (await this.deps.checkDependencies(['@mastra/libsql'])) === `ok`;\n\n if (hasLibsql) {\n this.logger.error(\n `Vercel Deployer does not support @libsql/client(which may have been installed by @mastra/libsql) as a dependency. \n\t\t\t\tUse other Mastra Storage options instead e.g @mastra/pg`,\n );\n process.exit(1);\n }\n }\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -1 +1,16 @@
1
- export { VercelDeployer } from './_tsup-dts-rollup.js';
1
+ import { Deployer } from '@mastra/deployer';
2
+ import type { VercelDeployerOptions } from './types.js';
3
+ export declare class VercelDeployer extends Deployer {
4
+ private vcConfigOverrides;
5
+ constructor(options?: VercelDeployerOptions);
6
+ prepare(outputDirectory: string): Promise<void>;
7
+ private getEntry;
8
+ private writeVercelJSON;
9
+ bundle(entryFile: string, outputDirectory: string, { toolsPaths, projectRoot }: {
10
+ toolsPaths: (string | string[])[];
11
+ projectRoot: string;
12
+ }): Promise<void>;
13
+ deploy(): Promise<void>;
14
+ lint(entryFile: string, outputDirectory: string, toolsPaths: (string | string[])[]): Promise<void>;
15
+ }
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,KAAK,EAA+B,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAElF,qBAAa,cAAe,SAAQ,QAAQ;IAC1C,OAAO,CAAC,iBAAiB,CAAyB;gBAEtC,OAAO,GAAE,qBAA0B;IAQzC,OAAO,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMrD,OAAO,CAAC,QAAQ;IAwBhB,OAAO,CAAC,eAAe;IAejB,MAAM,CACV,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,EACvB,EAAE,UAAU,EAAE,WAAW,EAAE,EAAE;QAAE,UAAU,EAAE,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,GACtF,OAAO,CAAC,IAAI,CAAC;IAiCV,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAIvB,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAazG"}