b4n1-web 0.7.0 → 0.9.3
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 +69 -107
- package/bin/b4n1web +0 -0
- package/bin/b4n1web-linux +0 -0
- package/dist/binary.d.ts +4 -0
- package/dist/binary.d.ts.map +1 -0
- package/dist/binary.js +108 -0
- package/dist/binary.js.map +1 -0
- package/dist/browser.d.ts +20 -22
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +124 -174
- package/dist/browser.js.map +1 -1
- package/dist/errors.js +2 -0
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/page.d.ts +12 -0
- package/dist/page.d.ts.map +1 -0
- package/dist/page.js +28 -0
- package/dist/page.js.map +1 -0
- package/dist/security.d.ts +46 -46
- package/dist/security.d.ts.map +1 -1
- package/dist/security.js +128 -94
- package/dist/security.js.map +1 -1
- package/dist/types.d.ts +5 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -1,146 +1,108 @@
|
|
|
1
1
|
# B4n1Web JavaScript/TypeScript SDK
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
<a href="https://github.com/B4N1-com/b4n1-web"><img src="https://img.shields.io/github/stars/B4N1-com/b4n1-web?style=flat" alt="GitHub stars"></a>
|
|
7
|
-
</p>
|
|
3
|
+
[](https://www.npmjs.com/package/b4n1-web)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
[](https://nodejs.org/)
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
> Ultra-lightweight agentic browser engine with bundled binary.
|
|
10
8
|
|
|
11
|
-
##
|
|
12
|
-
|
|
13
|
-
### 1. Install the B4n1Web Binary
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
curl -sL https://github.com/B4N1-com/b4n1-web/releases/latest/download/b4n1web-v0.6.2-flat.tar.gz | tar -xz && ./b4n1web --version
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
### 2. Install the JavaScript SDK
|
|
9
|
+
## Install
|
|
20
10
|
|
|
21
11
|
```bash
|
|
22
12
|
npm install b4n1-web
|
|
23
13
|
```
|
|
24
14
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
yarn add b4n1-web
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
Or with pnpm:
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
pnpm add b4n1-web
|
|
35
|
-
```
|
|
15
|
+
Binary is bundled — no separate installation needed.
|
|
36
16
|
|
|
37
17
|
## Quick Start
|
|
38
18
|
|
|
39
19
|
```typescript
|
|
40
|
-
import { AgentBrowser, BrowserMode
|
|
20
|
+
import { AgentBrowser, BrowserMode } from 'b4n1-web';
|
|
41
21
|
|
|
42
|
-
// Create a browser instance
|
|
43
22
|
const browser = new AgentBrowser({ mode: BrowserMode.LIGHT });
|
|
44
|
-
|
|
45
|
-
// Navigate to a page
|
|
46
23
|
const page = await browser.goto('https://example.com');
|
|
24
|
+
console.log(page.markdown);
|
|
25
|
+
console.log(`${page.links.length} links found`);
|
|
26
|
+
browser.close();
|
|
27
|
+
```
|
|
47
28
|
|
|
48
|
-
|
|
49
|
-
console.log('Page content:', page.markdown);
|
|
50
|
-
console.log('Found', page.links.length, 'links');
|
|
51
|
-
|
|
52
|
-
// Extract main content
|
|
53
|
-
const mainContent = page.getMainContent();
|
|
54
|
-
console.log('Main content:', mainContent.substring(0, 200) + '...');
|
|
29
|
+
## Page API
|
|
55
30
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
31
|
+
```typescript
|
|
32
|
+
page.url // string
|
|
33
|
+
page.markdown // string
|
|
34
|
+
page.links // string[]
|
|
35
|
+
page.screenshot // string | undefined
|
|
59
36
|
|
|
60
|
-
//
|
|
61
|
-
|
|
37
|
+
page.getMainContent() // string: content without headers
|
|
38
|
+
page.findLinksByText("more") // string[]: matching links
|
|
62
39
|
```
|
|
63
40
|
|
|
64
41
|
## Browser Modes
|
|
65
42
|
|
|
66
|
-
|
|
43
|
+
| Mode | Description |
|
|
44
|
+
|------|-------------|
|
|
45
|
+
| `BrowserMode.LIGHT` | HTTP + HTML parsing |
|
|
46
|
+
| `BrowserMode.JS` | Light + script extraction |
|
|
47
|
+
| `BrowserMode.RENDER` | Full Chromium + screenshots |
|
|
67
48
|
|
|
68
|
-
|
|
69
|
-
- **Performance**: < 15MB RAM, instant startup
|
|
70
|
-
- **Capabilities**: HTML parsing, markdown conversion, link extraction
|
|
71
|
-
- **Limitations**: No JavaScript execution
|
|
49
|
+
## Security
|
|
72
50
|
|
|
73
51
|
```typescript
|
|
74
|
-
|
|
75
|
-
```
|
|
52
|
+
import { SecurityShield } from 'b4n1-web';
|
|
76
53
|
|
|
77
|
-
|
|
54
|
+
const shield = new SecurityShield();
|
|
55
|
+
shield.markDomain('evil.com', false);
|
|
56
|
+
const { isSafe, needsApiCheck } = shield.isUrlSafe('https://evil.com');
|
|
57
|
+
```
|
|
78
58
|
|
|
79
|
-
|
|
80
|
-
- **Performance**: Same as Light, instant startup
|
|
81
|
-
- **Capabilities**: HTML parsing + JavaScript tag extraction
|
|
59
|
+
## Error Handling
|
|
82
60
|
|
|
83
61
|
```typescript
|
|
84
|
-
|
|
62
|
+
import { BinaryNotFoundError } from 'b4n1-web';
|
|
63
|
+
|
|
64
|
+
try {
|
|
65
|
+
const browser = new AgentBrowser();
|
|
66
|
+
} catch (e) {
|
|
67
|
+
if (e instanceof BinaryNotFoundError) {
|
|
68
|
+
console.error('Install binary: curl -sL https://web.b4n1.com/install | bash');
|
|
69
|
+
}
|
|
70
|
+
}
|
|
85
71
|
```
|
|
86
72
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
- **Use case**: SPAs, form filling, visual verification, E2E testing
|
|
90
|
-
- **Status**: Coming in v0.3.0
|
|
91
|
-
|
|
92
|
-
## API Reference
|
|
93
|
-
|
|
94
|
-
### AgentBrowser
|
|
95
|
-
|
|
96
|
-
Main browser class for web automation.
|
|
97
|
-
|
|
98
|
-
#### Constructor Options
|
|
99
|
-
|
|
100
|
-
- `mode`: BrowserMode.LIGHT, BrowserMode.JS, or BrowserMode.RENDER
|
|
101
|
-
- `timeout`: Request timeout in seconds (default: 30)
|
|
102
|
-
- `userAgent`: Custom user agent string
|
|
103
|
-
|
|
104
|
-
#### Methods
|
|
105
|
-
|
|
106
|
-
- `goto(url: string)`: Navigate to URL and return structured page data
|
|
107
|
-
- `close()`: Close the browser session
|
|
108
|
-
|
|
109
|
-
### Page
|
|
110
|
-
|
|
111
|
-
Structured data from a web page.
|
|
112
|
-
|
|
113
|
-
#### Properties
|
|
114
|
-
|
|
115
|
-
- `url: string`: The page URL
|
|
116
|
-
- `markdown: string`: Clean markdown content
|
|
117
|
-
- `links: string[]`: Extracted links
|
|
118
|
-
- `screenshot?: string`: Base64-encoded screenshot (render mode only)
|
|
119
|
-
|
|
120
|
-
#### Methods
|
|
121
|
-
|
|
122
|
-
- `getMainContent()`: Extract main content, skipping headers/footers
|
|
123
|
-
- `findLinksByText(text: string)`: Find links containing specific text
|
|
124
|
-
|
|
125
|
-
## SecurityShield
|
|
126
|
-
|
|
127
|
-
Optional security validation with caching:
|
|
73
|
+
## Context Manager
|
|
128
74
|
|
|
129
75
|
```typescript
|
|
130
|
-
import {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
76
|
+
import { AgentBrowser } from 'b4n1-web';
|
|
77
|
+
|
|
78
|
+
async function main() {
|
|
79
|
+
const browser = new AgentBrowser();
|
|
80
|
+
try {
|
|
81
|
+
const page = await browser.goto('https://example.com');
|
|
82
|
+
console.log(page.markdown);
|
|
83
|
+
} finally {
|
|
84
|
+
browser.close();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Or with async dispose:
|
|
89
|
+
const browser = new AgentBrowser();
|
|
90
|
+
try {
|
|
91
|
+
await browser.goto('https://example.com');
|
|
92
|
+
} finally {
|
|
93
|
+
await browser[Symbol.asyncDispose]();
|
|
94
|
+
}
|
|
138
95
|
```
|
|
139
96
|
|
|
140
|
-
##
|
|
97
|
+
## Version
|
|
98
|
+
|
|
99
|
+
SDK: **0.4.0** | Binary: **0.4.0** (bundled)
|
|
141
100
|
|
|
142
|
-
|
|
101
|
+
## Links
|
|
143
102
|
|
|
144
|
-
|
|
103
|
+
- [npm](https://www.npmjs.com/package/b4n1-web)
|
|
104
|
+
- [GitHub](https://github.com/B4N1-com/b4n1-web)
|
|
105
|
+
- [Website](https://web.b4n1.com)
|
|
145
106
|
|
|
146
|
-
|
|
107
|
+
---
|
|
108
|
+
*Built by B4N1 with ❤️ · All rights reserved.*
|
package/bin/b4n1web
ADDED
|
Binary file
|
package/bin/b4n1web-linux
CHANGED
|
Binary file
|
package/dist/binary.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary.d.ts","sourceRoot":"","sources":["../src/binary.ts"],"names":[],"mappings":"AAKA,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAyChD;AAED,wBAAgB,iBAAiB,IAAI,MAAM,GAAG,IAAI,CAejD;AAID,wBAAgB,yBAAyB,IAAI,MAAM,GAAG,IAAI,CAczD"}
|
package/dist/binary.js
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.getB4n1webBinary = getB4n1webBinary;
|
|
37
|
+
exports.getB4n1webVersion = getB4n1webVersion;
|
|
38
|
+
exports.checkVersionCompatibility = checkVersionCompatibility;
|
|
39
|
+
const os = __importStar(require("os"));
|
|
40
|
+
const fs = __importStar(require("fs"));
|
|
41
|
+
const path = __importStar(require("path"));
|
|
42
|
+
const child_process_1 = require("child_process");
|
|
43
|
+
function getB4n1webBinary() {
|
|
44
|
+
const home = os.homedir();
|
|
45
|
+
const paths = [];
|
|
46
|
+
const bundledBinary = path.join(__dirname, '..', 'bin', 'b4n1web-linux');
|
|
47
|
+
if (fs.existsSync(bundledBinary)) {
|
|
48
|
+
try {
|
|
49
|
+
fs.accessSync(bundledBinary, fs.constants.X_OK);
|
|
50
|
+
return bundledBinary;
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const envBinary = process.env.B4N1WEB_BINARY;
|
|
56
|
+
if (envBinary)
|
|
57
|
+
paths.push(envBinary);
|
|
58
|
+
paths.push(home + '/.local/bin/b4n1web', home + '/.b4n1web/bin/b4n1web', '/usr/local/bin/b4n1web', '/usr/bin/b4n1web');
|
|
59
|
+
const pathEnv = process.env.PATH || '';
|
|
60
|
+
const pathDirs = pathEnv.split(':').filter(p => p);
|
|
61
|
+
for (const dir of pathDirs) {
|
|
62
|
+
paths.push(dir + '/b4n1web');
|
|
63
|
+
}
|
|
64
|
+
for (const filePath of paths) {
|
|
65
|
+
try {
|
|
66
|
+
if (fs.existsSync(filePath)) {
|
|
67
|
+
const stats = fs.statSync(filePath);
|
|
68
|
+
if (stats.isFile() && (stats.mode & 0o111) !== 0) {
|
|
69
|
+
return filePath;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
function getB4n1webVersion() {
|
|
79
|
+
const binaryPath = getB4n1webBinary();
|
|
80
|
+
if (!binaryPath) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
try {
|
|
84
|
+
const version = (0, child_process_1.execSync)(`${binaryPath} --version`, { timeout: 5000 }).toString().trim();
|
|
85
|
+
const parts = version.split(' ');
|
|
86
|
+
if (parts.length >= 2 && parts[0] === 'b4n1web') {
|
|
87
|
+
return parts[1];
|
|
88
|
+
}
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
const SDK_VERSION = '0.8.0';
|
|
96
|
+
function checkVersionCompatibility() {
|
|
97
|
+
const binaryVersion = getB4n1webVersion();
|
|
98
|
+
if (!binaryVersion) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
if (binaryVersion !== SDK_VERSION) {
|
|
102
|
+
console.warn(`Warning: Version mismatch: SDK v${SDK_VERSION} requires binary v${SDK_VERSION}, ` +
|
|
103
|
+
`but found v${binaryVersion}. Some features may not work correctly. ` +
|
|
104
|
+
`To update: curl -sL https://web.b4n1.com/install | bash`);
|
|
105
|
+
}
|
|
106
|
+
return binaryVersion;
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=binary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary.js","sourceRoot":"","sources":["../src/binary.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,4CAyCC;AAED,8CAeC;AAID,8DAcC;AAjFD,uCAAyB;AACzB,uCAAyB;AACzB,2CAA6B;AAC7B,iDAAyC;AAEzC,SAAgB,gBAAgB;IAC9B,MAAM,IAAI,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;IAC1B,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC;IACzE,IAAI,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;QACjC,IAAI,CAAC;YACH,EAAE,CAAC,UAAU,CAAC,aAAa,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAChD,OAAO,aAAa,CAAC;QACvB,CAAC;QAAC,MAAM,CAAC;QACT,CAAC;IACH,CAAC;IAED,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;IAC7C,IAAI,SAAS;QAAE,KAAK,CAAC,IAAI,CAAC,SAAS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AK,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;YAChD,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,MAAM,WAAW,GAAG,OAAO,CAAC;AAE5B,SAAgB,yBAAyB;IACvC,MAAM,aAAa,GAAG,iBAAiB,EAAE,CAAC;IAC1C,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,aAAa,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO,CAAC,IAAI,CACV,mCAAmC,WAAW,qBAAqB,WAAW,IAAI;YAClF,cAAc,aAAa,0CAA0C;YACrE,yDAAyD,CAC1D,CAAC;IACJ,CAAC;IACD,OAAO,aAAa,CAAC;AACvB,CAAC"}
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,35 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export declare class Page implements PageData {
|
|
6
|
-
url: string;
|
|
7
|
-
markdown: string;
|
|
8
|
-
links: string[];
|
|
9
|
-
screenshot?: string;
|
|
10
|
-
jsOutput?: string;
|
|
11
|
-
constructor(data: PageData);
|
|
12
|
-
getMainContent(): string;
|
|
13
|
-
findLinksByText(text: string): string[];
|
|
14
|
-
}
|
|
1
|
+
import { type BrowserOptions } from './types';
|
|
2
|
+
import { Page } from './page';
|
|
3
|
+
export { getB4n1webBinary, getB4n1webVersion, checkVersionCompatibility } from './binary';
|
|
4
|
+
export { Page } from './page';
|
|
15
5
|
export declare class AgentBrowser {
|
|
16
6
|
private mode;
|
|
17
7
|
private timeout;
|
|
18
8
|
private userAgent;
|
|
19
9
|
private binaryPath;
|
|
20
10
|
private currentUrl;
|
|
11
|
+
private sessionId;
|
|
12
|
+
private sessionStarted;
|
|
13
|
+
private viewportWidth;
|
|
14
|
+
private viewportHeight;
|
|
15
|
+
private emulatedDevice;
|
|
21
16
|
constructor(options?: BrowserOptions);
|
|
17
|
+
private escapeArg;
|
|
18
|
+
private runSessionCommand;
|
|
19
|
+
private ensureSession;
|
|
22
20
|
goto(url: string, waitFor?: string): Promise<Page>;
|
|
23
21
|
private parseOutput;
|
|
24
|
-
close(): void;
|
|
25
22
|
[Symbol.asyncDispose](): Promise<void>;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
click(selector: string): Promise<string>;
|
|
24
|
+
typeText(selector: string, text: string, clearFirst?: boolean): Promise<string>;
|
|
25
|
+
waitForSelector(selector: string, timeoutMs?: number): Promise<string>;
|
|
26
|
+
screenshot(url: string, fullPage?: boolean): Promise<string>;
|
|
27
|
+
setViewport(width: number, height: number): Promise<void>;
|
|
28
|
+
setUserAgent(ua: string): Promise<void>;
|
|
29
|
+
emulateDevice(device: string): Promise<void>;
|
|
30
|
+
close(): void;
|
|
33
31
|
}
|
|
34
32
|
export declare function createBrowserAndGoto(url: string, options?: BrowserOptions): Promise<Page>;
|
|
35
33
|
//# sourceMappingURL=browser.d.ts.map
|
package/dist/browser.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAEA,OAAO,EAAe,KAAK,cAAc,EAAuB,MAAM,SAAS,CAAC;AAChF,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAG9B,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAA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