create-flexireact 1.3.2 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # create-flexireact
2
2
 
3
- Create FlexiReact apps with one command.
3
+ Create FlexiReact v2 apps with one command.
4
4
 
5
5
  ## Usage
6
6
 
@@ -16,20 +16,29 @@ npm create flexireact@latest my-app
16
16
 
17
17
  ## Templates
18
18
 
19
- - **Default** - Basic FlexiReact app with TypeScript and Tailwind
20
- - **FlexiUI** - FlexiReact with FlexiUI component library
21
- - **Minimal** - Bare minimum FlexiReact setup
19
+ | Template | Description |
20
+ |----------|-------------|
21
+ | **Default** | Full-featured with `routes/`, components, and Tailwind v4 |
22
+ | **Minimal** | Bare minimum FlexiReact setup |
23
+ | **App Router** | Next.js style `app/` directory routing |
22
24
 
23
- ## What's included
25
+ ## What's New in v2
24
26
 
25
- - **FlexiReact** - The Modern React Framework
26
- - 📘 **TypeScript** - Full type safety
27
- - 🎨 **Tailwind CSS** - Utility-first styling
28
- - 📁 **File-based routing** - Create a file, get a route
29
- - 🏝️ **Islands architecture** - Partial hydration
30
- - 🖥️ **SSR** - Server-side rendering
27
+ - 🆕 **TypeScript Native** CLI rewritten in TypeScript
28
+ - 🎨 **Tailwind CSS v4** New `@import "tailwindcss"` syntax
29
+ - 📁 **Routes Directory** New `routes/` with route groups
30
+ - **Modern Templates** Beautiful, production-ready starters
31
31
 
32
- ## After creation
32
+ ## What's Included
33
+
34
+ - ⚡ **FlexiReact v2** — The Modern React Framework
35
+ - 📘 **TypeScript** — Full type safety
36
+ - 🎨 **Tailwind CSS v4** — Latest styling features
37
+ - 📁 **File-based routing** — `routes/`, `app/`, or `pages/`
38
+ - 🏝️ **Islands architecture** — Partial hydration
39
+ - 🖥️ **SSR** — Server-side rendering
40
+
41
+ ## After Creation
33
42
 
34
43
  ```bash
35
44
  cd my-app
@@ -39,10 +48,10 @@ npm run dev
39
48
 
40
49
  Then open http://localhost:3000
41
50
 
42
- ## Learn More
51
+ ## Links
43
52
 
44
- - [FlexiReact Documentation](https://github.com/flexireact/flexireact)
45
- - [FlexiUI Components](https://github.com/flexireact/flexi-ui)
53
+ - [GitHub Repository](https://github.com/flexireact/flexireact)
54
+ - [npm Package](https://www.npmjs.com/package/@flexireact/core)
46
55
 
47
56
  ## License
48
57
 
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * create-flexireact CLI v2.0.0
4
+ * Create FlexiReact applications with ease
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;GAGG"}
package/dist/index.js ADDED
@@ -0,0 +1,175 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * create-flexireact CLI v2.0.0
4
+ * Create FlexiReact applications with ease
5
+ */
6
+ import fs from 'fs';
7
+ import path from 'path';
8
+ import readline from 'readline';
9
+ import { execSync } from 'child_process';
10
+ import { TEMPLATES, getTemplateFiles } from './templates/index.js';
11
+ import { BANNER, SUCCESS_BANNER, colors as c } from './ui.js';
12
+ // ============================================================================
13
+ // Utilities
14
+ // ============================================================================
15
+ function log(msg) {
16
+ console.log(` ${msg}`);
17
+ }
18
+ function success(msg) {
19
+ console.log(` ${c.green}✓${c.reset} ${msg}`);
20
+ }
21
+ function error(msg) {
22
+ console.log(` ${c.red}✗${c.reset} ${msg}`);
23
+ }
24
+ function info(msg) {
25
+ console.log(` ${c.cyan}ℹ${c.reset} ${msg}`);
26
+ }
27
+ async function prompt(question, defaultValue = '') {
28
+ const rl = readline.createInterface({
29
+ input: process.stdin,
30
+ output: process.stdout,
31
+ });
32
+ return new Promise((resolve) => {
33
+ const defaultText = defaultValue ? ` ${c.dim}(${defaultValue})${c.reset}` : '';
34
+ rl.question(` ${c.cyan}?${c.reset} ${question}${defaultText}: `, (answer) => {
35
+ rl.close();
36
+ resolve(answer.trim() || defaultValue);
37
+ });
38
+ });
39
+ }
40
+ async function select(question, options) {
41
+ console.log(` ${c.cyan}?${c.reset} ${question}\n`);
42
+ options.forEach((opt, i) => {
43
+ console.log(` ${c.dim}${i + 1}.${c.reset} ${opt.icon} ${c.bold}${opt.name}${c.reset}`);
44
+ console.log(` ${c.dim}${opt.description}${c.reset}\n`);
45
+ });
46
+ const rl = readline.createInterface({
47
+ input: process.stdin,
48
+ output: process.stdout,
49
+ });
50
+ return new Promise((resolve) => {
51
+ rl.question(` ${c.cyan}→${c.reset} Enter number (1-${options.length}): `, (answer) => {
52
+ rl.close();
53
+ const index = parseInt(answer.trim()) - 1;
54
+ if (index >= 0 && index < options.length) {
55
+ resolve(options[index]);
56
+ }
57
+ else {
58
+ resolve(options[0]);
59
+ }
60
+ });
61
+ });
62
+ }
63
+ class Spinner {
64
+ message;
65
+ frames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
66
+ current = 0;
67
+ interval = null;
68
+ startTime = 0;
69
+ constructor(message) {
70
+ this.message = message;
71
+ }
72
+ start() {
73
+ this.startTime = Date.now();
74
+ process.stdout.write(` ${this.frames[0]} ${this.message}`);
75
+ this.interval = setInterval(() => {
76
+ this.current = (this.current + 1) % this.frames.length;
77
+ const elapsed = ((Date.now() - this.startTime) / 1000).toFixed(1);
78
+ process.stdout.clearLine(0);
79
+ process.stdout.cursorTo(0);
80
+ process.stdout.write(` ${c.primary}${this.frames[this.current]}${c.reset} ${this.message} ${c.dim}(${elapsed}s)${c.reset}`);
81
+ }, 80);
82
+ }
83
+ stop(isSuccess = true) {
84
+ if (this.interval) {
85
+ clearInterval(this.interval);
86
+ }
87
+ const elapsed = ((Date.now() - this.startTime) / 1000).toFixed(1);
88
+ process.stdout.clearLine(0);
89
+ process.stdout.cursorTo(0);
90
+ const icon = isSuccess ? `${c.green}✓${c.reset}` : `${c.red}✗${c.reset}`;
91
+ console.log(` ${icon} ${this.message} ${c.dim}(${elapsed}s)${c.reset}`);
92
+ }
93
+ }
94
+ function isDirEmpty(dir) {
95
+ if (!fs.existsSync(dir))
96
+ return true;
97
+ return fs.readdirSync(dir).length === 0;
98
+ }
99
+ // ============================================================================
100
+ // Main
101
+ // ============================================================================
102
+ async function main() {
103
+ console.clear();
104
+ console.log(BANNER);
105
+ // Get project name from args or prompt
106
+ let projectName = process.argv[2];
107
+ if (!projectName) {
108
+ projectName = await prompt('Project name', 'my-flexireact-app');
109
+ }
110
+ // Validate project name
111
+ if (!/^[a-zA-Z0-9-_]+$/.test(projectName)) {
112
+ error('Project name can only contain letters, numbers, dashes, and underscores');
113
+ process.exit(1);
114
+ }
115
+ const projectPath = path.resolve(process.cwd(), projectName);
116
+ // Check if directory exists
117
+ if (fs.existsSync(projectPath) && !isDirEmpty(projectPath)) {
118
+ error(`Directory ${projectName} already exists and is not empty`);
119
+ process.exit(1);
120
+ }
121
+ // Select template
122
+ console.log('');
123
+ const templateOptions = Object.entries(TEMPLATES).map(([key, value]) => ({
124
+ key,
125
+ ...value,
126
+ }));
127
+ const selectedTemplate = await select('Select a template:', templateOptions);
128
+ const templateKey = selectedTemplate.key;
129
+ console.log('');
130
+ log(`Creating project in ${c.cyan}${projectPath}${c.reset}`);
131
+ console.log('');
132
+ // Create project directory
133
+ fs.mkdirSync(projectPath, { recursive: true });
134
+ // Write template files
135
+ const spinner1 = new Spinner('Creating project structure...');
136
+ spinner1.start();
137
+ try {
138
+ const files = getTemplateFiles(templateKey, projectName);
139
+ for (const [filePath, content] of Object.entries(files)) {
140
+ const fullPath = path.join(projectPath, filePath);
141
+ const dir = path.dirname(fullPath);
142
+ if (!fs.existsSync(dir)) {
143
+ fs.mkdirSync(dir, { recursive: true });
144
+ }
145
+ fs.writeFileSync(fullPath, content);
146
+ }
147
+ spinner1.stop(true);
148
+ }
149
+ catch (err) {
150
+ spinner1.stop(false);
151
+ error(`Failed to create project: ${err.message}`);
152
+ process.exit(1);
153
+ }
154
+ // Initialize git
155
+ const spinner2 = new Spinner('Initializing git repository...');
156
+ spinner2.start();
157
+ try {
158
+ execSync('git init', { cwd: projectPath, stdio: 'ignore' });
159
+ execSync('git add .', { cwd: projectPath, stdio: 'ignore' });
160
+ execSync('git commit -m "Initial commit from create-flexireact"', { cwd: projectPath, stdio: 'ignore' });
161
+ spinner2.stop(true);
162
+ }
163
+ catch {
164
+ spinner2.stop(false);
165
+ // Git init is not critical, continue
166
+ }
167
+ // Success message
168
+ console.log('');
169
+ console.log(SUCCESS_BANNER(projectName));
170
+ }
171
+ main().catch((err) => {
172
+ error(err.message);
173
+ process.exit(1);
174
+ });
175
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,SAAS,CAAC;AAE9D,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E,SAAS,GAAG,CAAC,GAAW;IACtB,OAAO,CAAC,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAC3B,CAAC;AAED,SAAS,OAAO,CAAC,GAAW;IAC1B,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,IAAI,GAAG,EAAE,CAAC,CAAC;AACjD,CAAC;AAED,SAAS,KAAK,CAAC,GAAW;IACxB,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,CA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AQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;IAAC,MAAM,CAAC;QACP,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACrB,qCAAqC;IACvC,CAAC;IAED,kBAAkB;IAClB,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC;AAC3C,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * App Router Template - Next.js style app/ directory routing
3
+ */
4
+ import type { TemplateFiles } from './index.js';
5
+ export declare function appRouterTemplate(projectName: string): TemplateFiles;
6
+ //# sourceMappingURL=app-router.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-router.d.ts","sourceRoot":"","sources":["../../src/templates/app-router.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,aAAa,CA2NpE"}
@@ -0,0 +1,211 @@
1
+ /**
2
+ * App Router Template - Next.js style app/ directory routing
3
+ */
4
+ export function appRouterTemplate(projectName) {
5
+ return {
6
+ 'package.json': JSON.stringify({
7
+ name: projectName,
8
+ version: '1.0.0',
9
+ private: true,
10
+ type: 'module',
11
+ scripts: {
12
+ dev: 'npm run css && flexireact dev',
13
+ build: 'npm run css && flexireact build',
14
+ start: 'flexireact start',
15
+ css: 'npx @tailwindcss/cli -i ./app/globals.css -o ./public/styles.css --minify',
16
+ },
17
+ dependencies: {
18
+ react: '^18.2.0',
19
+ 'react-dom': '^18.2.0',
20
+ '@flexireact/core': '^2.0.0',
21
+ clsx: '^2.1.0',
22
+ 'tailwind-merge': '^2.2.0',
23
+ },
24
+ devDependencies: {
25
+ '@types/react': '^18.2.0',
26
+ '@types/react-dom': '^18.2.0',
27
+ typescript: '^5.3.0',
28
+ tailwindcss: '^4.0.0',
29
+ '@tailwindcss/cli': '^4.0.0',
30
+ '@tailwindcss/postcss': '^4.0.0',
31
+ },
32
+ }, null, 2),
33
+ 'tsconfig.json': JSON.stringify({
34
+ compilerOptions: {
35
+ target: 'ES2022',
36
+ lib: ['DOM', 'DOM.Iterable', 'ES2022'],
37
+ module: 'ESNext',
38
+ moduleResolution: 'bundler',
39
+ jsx: 'react-jsx',
40
+ strict: true,
41
+ skipLibCheck: true,
42
+ esModuleInterop: true,
43
+ resolveJsonModule: true,
44
+ isolatedModules: true,
45
+ noEmit: true,
46
+ baseUrl: '.',
47
+ paths: {
48
+ '@/*': ['./*'],
49
+ },
50
+ },
51
+ include: ['**/*.ts', '**/*.tsx'],
52
+ exclude: ['node_modules', '.flexi', 'public'],
53
+ }, null, 2),
54
+ 'postcss.config.js': `export default {
55
+ plugins: {
56
+ "@tailwindcss/postcss": {},
57
+ },
58
+ };
59
+ `,
60
+ 'flexireact.config.js': `export default {
61
+ server: { port: 3000 },
62
+ styles: ['/styles.css'],
63
+ };
64
+ `,
65
+ // App directory
66
+ 'app/layout.tsx': `import React from 'react';
67
+
68
+ export default function RootLayout({ children }: { children: React.ReactNode }) {
69
+ return (
70
+ <html lang="en" className="dark">
71
+ <head>
72
+ <meta charSet="UTF-8" />
73
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
74
+ <link rel="stylesheet" href="/styles.css" />
75
+ <link rel="icon" href="/favicon.svg" />
76
+ <title>FlexiReact App</title>
77
+ </head>
78
+ <body className="bg-[#0a0a0a] text-white min-h-screen antialiased">
79
+ {children}
80
+ </body>
81
+ </html>
82
+ );
83
+ }
84
+ `,
85
+ 'app/page.tsx': `import React from 'react';
86
+
87
+ export default function HomePage() {
88
+ return (
89
+ <main className="min-h-screen flex flex-col items-center justify-center p-8">
90
+ <div className="text-center">
91
+ <div className="w-20 h-20 bg-[#00FF9C] rounded-2xl flex items-center justify-center mx-auto mb-8">
92
+ <span className="text-black font-bold text-3xl">F</span>
93
+ </div>
94
+
95
+ <h1 className="text-5xl font-bold mb-4">
96
+ Welcome to <span className="text-[#00FF9C]">FlexiReact</span>
97
+ </h1>
98
+
99
+ <p className="text-gray-400 text-lg mb-8">
100
+ Using App Router with Next.js style routing
101
+ </p>
102
+
103
+ <div className="flex gap-4 justify-center">
104
+ <a
105
+ href="https://github.com/nicksdev/flexireact"
106
+ className="px-6 py-3 bg-[#00FF9C] text-black font-semibold rounded-lg hover:opacity-90 transition"
107
+ >
108
+ Get Started →
109
+ </a>
110
+ <a
111
+ href="https://github.com/nicksdev/flexireact"
112
+ className="px-6 py-3 border border-gray-700 rounded-lg hover:border-[#00FF9C] transition"
113
+ >
114
+ Documentation
115
+ </a>
116
+ </div>
117
+ </div>
118
+ </main>
119
+ );
120
+ }
121
+ `,
122
+ 'app/loading.tsx': `import React from 'react';
123
+
124
+ export default function Loading() {
125
+ return (
126
+ <div className="min-h-screen flex items-center justify-center">
127
+ <div className="w-8 h-8 border-2 border-[#00FF9C] border-t-transparent rounded-full animate-spin" />
128
+ </div>
129
+ );
130
+ }
131
+ `,
132
+ 'app/error.tsx': `'use client';
133
+
134
+ import React from 'react';
135
+
136
+ export default function Error({ error, reset }: { error: Error; reset: () => void }) {
137
+ return (
138
+ <div className="min-h-screen flex flex-col items-center justify-center p-8">
139
+ <h1 className="text-4xl font-bold text-red-500 mb-4">Something went wrong</h1>
140
+ <p className="text-gray-400 mb-8">{error.message}</p>
141
+ <button
142
+ onClick={reset}
143
+ className="px-6 py-3 bg-[#00FF9C] text-black font-semibold rounded-lg"
144
+ >
145
+ Try again
146
+ </button>
147
+ </div>
148
+ );
149
+ }
150
+ `,
151
+ 'app/not-found.tsx': `import React from 'react';
152
+
153
+ export default function NotFound() {
154
+ return (
155
+ <div className="min-h-screen flex flex-col items-center justify-center p-8">
156
+ <h1 className="text-6xl font-bold text-[#00FF9C] mb-4">404</h1>
157
+ <p className="text-gray-400 text-xl mb-8">Page not found</p>
158
+ <a
159
+ href="/"
160
+ className="px-6 py-3 bg-[#00FF9C] text-black font-semibold rounded-lg"
161
+ >
162
+ ← Back Home
163
+ </a>
164
+ </div>
165
+ );
166
+ }
167
+ `,
168
+ 'app/globals.css': `@import "tailwindcss";
169
+
170
+ @theme {
171
+ --color-background: #0a0a0a;
172
+ --color-foreground: #fafafa;
173
+ --color-primary: #00FF9C;
174
+ --font-sans: "Inter", system-ui, sans-serif;
175
+ }
176
+
177
+ body {
178
+ font-family: var(--font-sans);
179
+ }
180
+ `,
181
+ // Lib
182
+ 'lib/utils.ts': `import { clsx, type ClassValue } from 'clsx';
183
+ import { twMerge } from 'tailwind-merge';
184
+
185
+ export function cn(...inputs: ClassValue[]) {
186
+ return twMerge(clsx(inputs));
187
+ }
188
+ `,
189
+ // Public
190
+ 'public/favicon.svg': `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
191
+ <defs>
192
+ <linearGradient id="grad" x1="0%" y1="0%" x2="100%" y2="100%">
193
+ <stop offset="0%" style="stop-color:#00FF9C"/>
194
+ <stop offset="100%" style="stop-color:#00D68F"/>
195
+ </linearGradient>
196
+ </defs>
197
+ <rect width="100" height="100" rx="20" fill="#0a0a0a"/>
198
+ <text x="50" y="68" font-family="system-ui" font-size="50" font-weight="900" fill="url(#grad)" text-anchor="middle">F</text>
199
+ </svg>`,
200
+ 'public/.gitkeep': '',
201
+ '.gitignore': `node_modules/
202
+ .flexi/
203
+ dist/
204
+ public/styles.css
205
+ *.log
206
+ .env
207
+ .env.local
208
+ `,
209
+ };
210
+ }
211
+ //# sourceMappingURL=app-router.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-router.js","sourceRoot":"","sources":["../../src/templates/app-router.ts"],"names":[],"mappings":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U,CAAC;YAChC,OAAO,EAAE,CAAC,cAAc,EAAE,QAAQ,EAAE,QAAQ,CAAC;SAC9C,EAAE,IAAI,EAAE,CAAC,CAAC;QAEX,mBAAmB,EAAE;;;;;CAKxB;QAEG,sBAAsB,EAAE;;;;CAI3B;QAEG,gBAAgB;QAChB,gBAAgB,EAAE;;;;;;;;;;;;;;;;;;CAkBrB;QAEG,cAAc,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCnB;QAEG,iBAAiB,EAAE;;;;;;;;;CAStB;QAEG,eAAe,EAAE;;;;;;;;;;;;;;;;;;CAkBpB;QAEG,mBAAmB,EAAE;;;;;;;;;;;;;;;;CAgBxB;QAEG,iBAAiB,EAAE;;;;;;;;;;;;CAYtB;QAEG,MAAM;QACN,cAAc,EAAE;;;;;;CAMnB;QAEG,SAAS;QACT,oBAAoB,EAAE;;;;;;;;;OASnB;QAEH,iBAAiB,EAAE,EAAE;QAErB,YAAY,EAAE;;;;;;;CAOjB;KACE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Default Template - Full-featured FlexiReact v2 setup
3
+ *
4
+ * Structure:
5
+ * - app/ : Layout, components, styles, providers
6
+ * - routes/ : FlexiReact v2 file-based routing
7
+ * - lib/ : Utilities
8
+ * - public/ : Static assets
9
+ */
10
+ import type { TemplateFiles } from './index.js';
11
+ export declare function defaultTemplate(projectName: string): TemplateFiles;
12
+ //# sourceMappingURL=default.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../src/templates/default.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,aAAa,CA8jBlE"}