@hireobi/cli 0.1.7 → 0.1.8
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 +5 -5
- package/README.md +7 -3
- package/dist/obi.js +627 -470
- package/package.json +23 -6
- package/skills/obi/SKILL.md +2 -2
- package/skills/obi/references/host-work.md +1 -1
- package/dist/heysurface.js +0 -33566
- package/skills/heysurface/SKILL.md +0 -56
- package/skills/heysurface/references/action-experiment.md +0 -79
- package/skills/heysurface/references/ai-search-measurement.md +0 -112
- package/skills/heysurface/references/business-judgment.md +0 -95
- package/skills/heysurface/references/business.md +0 -22
- package/skills/heysurface/references/connection.md +0 -47
- package/skills/heysurface/references/drafting.md +0 -59
- package/skills/heysurface/references/host-work.md +0 -107
- package/skills/heysurface/references/native-capture.md +0 -99
- package/skills/heysurface/references/outcomes.md +0 -70
- package/skills/heysurface/references/purchase.md +0 -89
- package/skills/heysurface/references/questions.md +0 -40
package/dist/obi.js
CHANGED
|
@@ -17692,7 +17692,7 @@ async function send(context, request) {
|
|
|
17692
17692
|
headers2.authorization = `Bearer ${request.bearer}`;
|
|
17693
17693
|
}
|
|
17694
17694
|
if (context.evaluationCaseId && /^\/api\/v1\/(?:status|business(?:\/.*)?|questions(?:\/.*)?|readiness|strategies|work\/[0-9a-fA-F-]+\/artifact(?:\/revisions(?:\/[1-9][0-9]*)?)?|harness(?:\/(?:evidence|outcomes))?|memory)(?:\?.*)?$/.test(request.path)) {
|
|
17695
|
-
headers2["x-
|
|
17695
|
+
headers2["x-obi-evaluation-case"] = context.evaluationCaseId;
|
|
17696
17696
|
}
|
|
17697
17697
|
if (request.idempotencyKey !== void 0) {
|
|
17698
17698
|
headers2[IDEMPOTENCY_KEY_HEADER] = request.idempotencyKey;
|
|
@@ -18063,37 +18063,114 @@ async function readReadiness(context, accessToken) {
|
|
|
18063
18063
|
|
|
18064
18064
|
// src/refresh.ts
|
|
18065
18065
|
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
18066
|
-
import { open as open2, readFile, stat, unlink as
|
|
18066
|
+
import { open as open2, readFile, stat, unlink as unlink3 } from "node:fs/promises";
|
|
18067
18067
|
import { hostname as hostname3 } from "node:os";
|
|
18068
18068
|
import { join as join3 } from "node:path";
|
|
18069
18069
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
18070
18070
|
|
|
18071
18071
|
// src/file-backend.ts
|
|
18072
18072
|
import { randomBytes } from "node:crypto";
|
|
18073
|
-
import { constants } from "node:fs";
|
|
18074
|
-
import { lstat as lstat2, open, readdir, rename, unlink } from "node:fs/promises";
|
|
18073
|
+
import { constants as constants2 } from "node:fs";
|
|
18074
|
+
import { lstat as lstat2, open, readdir as readdir2, rename as rename2, unlink as unlink2 } from "node:fs/promises";
|
|
18075
18075
|
import { join as join2 } from "node:path";
|
|
18076
18076
|
|
|
18077
18077
|
// src/state-directory.ts
|
|
18078
18078
|
import { createHash } from "node:crypto";
|
|
18079
|
-
import {
|
|
18079
|
+
import { constants } from "node:fs";
|
|
18080
|
+
import { chmod, copyFile, cp, link, lstat, mkdir, readdir, rename, rm, unlink } from "node:fs/promises";
|
|
18080
18081
|
import { homedir } from "node:os";
|
|
18081
|
-
import { dirname, isAbsolute, join } from "node:path";
|
|
18082
|
+
import { basename, dirname, isAbsolute, join } from "node:path";
|
|
18082
18083
|
var posixModes = process.platform !== "win32";
|
|
18083
|
-
function
|
|
18084
|
+
function stateBase(environment) {
|
|
18084
18085
|
const stateHome = environment.XDG_STATE_HOME;
|
|
18085
18086
|
if (stateHome !== void 0 && isAbsolute(stateHome)) {
|
|
18086
|
-
return
|
|
18087
|
+
return stateHome;
|
|
18087
18088
|
}
|
|
18088
18089
|
if (process.platform === "darwin") {
|
|
18089
|
-
return join(homedir(), "Library", "Application Support"
|
|
18090
|
+
return join(homedir(), "Library", "Application Support");
|
|
18090
18091
|
}
|
|
18091
18092
|
if (process.platform === "win32") {
|
|
18092
18093
|
const localAppData = environment.LOCALAPPDATA;
|
|
18093
|
-
|
|
18094
|
-
|
|
18094
|
+
return localAppData !== void 0 && isAbsolute(localAppData) ? localAppData : join(homedir(), "AppData", "Local");
|
|
18095
|
+
}
|
|
18096
|
+
return join(homedir(), ".local", "state");
|
|
18097
|
+
}
|
|
18098
|
+
var currentName = "obi-cli";
|
|
18099
|
+
function resolveStateDirectory(environment) {
|
|
18100
|
+
return join(stateBase(environment), currentName);
|
|
18101
|
+
}
|
|
18102
|
+
var legacyName = "heysurface";
|
|
18103
|
+
function legacyStateDirectory(environment) {
|
|
18104
|
+
return join(stateBase(environment), legacyName);
|
|
18105
|
+
}
|
|
18106
|
+
function legacySibling(stateDirectory) {
|
|
18107
|
+
return basename(stateDirectory) === currentName ? join(dirname(stateDirectory), legacyName) : null;
|
|
18108
|
+
}
|
|
18109
|
+
async function present(path) {
|
|
18110
|
+
try {
|
|
18111
|
+
await lstat(path);
|
|
18112
|
+
return true;
|
|
18113
|
+
} catch (error51) {
|
|
18114
|
+
if (error51.code === "ENOENT") return false;
|
|
18115
|
+
throw error51;
|
|
18095
18116
|
}
|
|
18096
|
-
|
|
18117
|
+
}
|
|
18118
|
+
async function prepareStateDirectory(environment) {
|
|
18119
|
+
const current = resolveStateDirectory(environment);
|
|
18120
|
+
const legacy = legacyStateDirectory(environment);
|
|
18121
|
+
try {
|
|
18122
|
+
if (!await present(legacy)) return current;
|
|
18123
|
+
if (await present(current)) {
|
|
18124
|
+
await adoptConnection(legacy, current).catch(() => void 0);
|
|
18125
|
+
return current;
|
|
18126
|
+
}
|
|
18127
|
+
try {
|
|
18128
|
+
await rename(legacy, current);
|
|
18129
|
+
return current;
|
|
18130
|
+
} catch (error51) {
|
|
18131
|
+
const code = error51.code;
|
|
18132
|
+
if (code === "EXDEV") {
|
|
18133
|
+
await copyThenRemove(legacy, current);
|
|
18134
|
+
return current;
|
|
18135
|
+
}
|
|
18136
|
+
if ((code === "ENOENT" || code === "EEXIST" || code === "ENOTEMPTY") && await present(current)) return current;
|
|
18137
|
+
return legacy;
|
|
18138
|
+
}
|
|
18139
|
+
} catch {
|
|
18140
|
+
return await present(current).catch(() => false) ? current : legacy;
|
|
18141
|
+
}
|
|
18142
|
+
}
|
|
18143
|
+
var connectionFile = /^(credentials|pending)-[0-9a-f]{24}\.json$/;
|
|
18144
|
+
async function adoptConnection(legacy, current) {
|
|
18145
|
+
if ((await readdir(current)).some((name) => connectionFile.test(name))) return;
|
|
18146
|
+
for (const name of (await readdir(legacy)).filter((entry) => connectionFile.test(entry))) {
|
|
18147
|
+
const source = join(legacy, name);
|
|
18148
|
+
const target = join(current, name);
|
|
18149
|
+
if (!(await lstat(source)).isFile() || await present(target)) continue;
|
|
18150
|
+
try {
|
|
18151
|
+
await link(source, target);
|
|
18152
|
+
} catch (error51) {
|
|
18153
|
+
if (error51.code !== "EXDEV") throw error51;
|
|
18154
|
+
await copyFile(source, target, constants.COPYFILE_EXCL);
|
|
18155
|
+
if (posixModes) await chmod(target, 384);
|
|
18156
|
+
}
|
|
18157
|
+
await unlink(source);
|
|
18158
|
+
}
|
|
18159
|
+
}
|
|
18160
|
+
async function copyThenRemove(legacy, current) {
|
|
18161
|
+
const stats = await lstat(legacy);
|
|
18162
|
+
if (!stats.isDirectory()) throw new Error("not a directory");
|
|
18163
|
+
const staging = `${current}.${process.pid}.moving`;
|
|
18164
|
+
await mkdir(staging, { mode: 448 });
|
|
18165
|
+
try {
|
|
18166
|
+
await cp(legacy, staging, { recursive: true, preserveTimestamps: true, verbatimSymlinks: true, errorOnExist: true, force: false });
|
|
18167
|
+
if (posixModes) await chmod(staging, stats.mode & 511);
|
|
18168
|
+
await rename(staging, current);
|
|
18169
|
+
} catch (error51) {
|
|
18170
|
+
await rm(staging, { recursive: true, force: true });
|
|
18171
|
+
throw error51;
|
|
18172
|
+
}
|
|
18173
|
+
await rm(legacy, { recursive: true, force: true });
|
|
18097
18174
|
}
|
|
18098
18175
|
function originKey(origin) {
|
|
18099
18176
|
return createHash("sha256").update(origin).digest("hex").slice(0, 24);
|
|
@@ -18148,7 +18225,7 @@ async function ensureStateDirectory(directory) {
|
|
|
18148
18225
|
|
|
18149
18226
|
// src/file-backend.ts
|
|
18150
18227
|
var maxItemBytes = 64 * 1024;
|
|
18151
|
-
var noFollow =
|
|
18228
|
+
var noFollow = constants2.O_NOFOLLOW ?? 0;
|
|
18152
18229
|
function isMissing(error51) {
|
|
18153
18230
|
return error51.code === "ENOENT";
|
|
18154
18231
|
}
|
|
@@ -18190,7 +18267,7 @@ var FileBackend = class {
|
|
|
18190
18267
|
}
|
|
18191
18268
|
let handle;
|
|
18192
18269
|
try {
|
|
18193
|
-
handle = await open(path,
|
|
18270
|
+
handle = await open(path, constants2.O_RDONLY | noFollow);
|
|
18194
18271
|
} catch (error51) {
|
|
18195
18272
|
if (error51.code === "ELOOP") {
|
|
18196
18273
|
throw insecureStorage();
|
|
@@ -18220,7 +18297,7 @@ var FileBackend = class {
|
|
|
18220
18297
|
}
|
|
18221
18298
|
}
|
|
18222
18299
|
const temporary = join2(this.directory, `.${item}-${originKey(origin)}.${process.pid}.${randomBytes(6).toString("hex")}.tmp`);
|
|
18223
|
-
const handle = await open(temporary,
|
|
18300
|
+
const handle = await open(temporary, constants2.O_WRONLY | constants2.O_CREAT | constants2.O_EXCL | noFollow, 384);
|
|
18224
18301
|
try {
|
|
18225
18302
|
if (posixModes) {
|
|
18226
18303
|
await handle.chmod(384);
|
|
@@ -18229,14 +18306,14 @@ var FileBackend = class {
|
|
|
18229
18306
|
await handle.sync();
|
|
18230
18307
|
} catch (error51) {
|
|
18231
18308
|
await handle.close();
|
|
18232
|
-
await
|
|
18309
|
+
await unlink2(temporary);
|
|
18233
18310
|
throw error51;
|
|
18234
18311
|
}
|
|
18235
18312
|
await handle.close();
|
|
18236
18313
|
try {
|
|
18237
|
-
await
|
|
18314
|
+
await rename2(temporary, path);
|
|
18238
18315
|
} catch (error51) {
|
|
18239
|
-
await
|
|
18316
|
+
await unlink2(temporary);
|
|
18240
18317
|
throw error51;
|
|
18241
18318
|
}
|
|
18242
18319
|
}
|
|
@@ -18244,7 +18321,7 @@ var FileBackend = class {
|
|
|
18244
18321
|
async remove(item, origin) {
|
|
18245
18322
|
let names;
|
|
18246
18323
|
try {
|
|
18247
|
-
names = await
|
|
18324
|
+
names = await readdir2(this.directory);
|
|
18248
18325
|
} catch (error51) {
|
|
18249
18326
|
if (isMissing(error51)) {
|
|
18250
18327
|
return;
|
|
@@ -18255,7 +18332,7 @@ var FileBackend = class {
|
|
|
18255
18332
|
const paths = names.filter((name) => name.startsWith(leftover) && name.endsWith(".tmp")).map((name) => join2(this.directory, name));
|
|
18256
18333
|
for (const path of [this.path(item, origin), ...paths]) {
|
|
18257
18334
|
try {
|
|
18258
|
-
await
|
|
18335
|
+
await unlink2(path);
|
|
18259
18336
|
} catch (error51) {
|
|
18260
18337
|
if (!isMissing(error51)) {
|
|
18261
18338
|
throw error51;
|
|
@@ -18266,8 +18343,9 @@ var FileBackend = class {
|
|
|
18266
18343
|
};
|
|
18267
18344
|
|
|
18268
18345
|
// src/os-backends.ts
|
|
18269
|
-
import { accessSync, constants as
|
|
18270
|
-
var
|
|
18346
|
+
import { accessSync, constants as constants3, existsSync as existsSync2, statSync } from "node:fs";
|
|
18347
|
+
var currentService = "obi-cli";
|
|
18348
|
+
var legacyService = "heysurface-cli";
|
|
18271
18349
|
var plainToken = /^[A-Za-z0-9:/.[\]_-]+$/;
|
|
18272
18350
|
var keychainNotFound = 44;
|
|
18273
18351
|
var maxCommandLength = 4e3;
|
|
@@ -18305,14 +18383,16 @@ async function run(executable, args, stdin) {
|
|
|
18305
18383
|
var KeychainBackend = class {
|
|
18306
18384
|
kind = "keychain";
|
|
18307
18385
|
executable;
|
|
18308
|
-
|
|
18386
|
+
service;
|
|
18387
|
+
constructor(executable, service = currentService) {
|
|
18309
18388
|
this.executable = executable;
|
|
18389
|
+
this.service = service;
|
|
18310
18390
|
}
|
|
18311
18391
|
async exists(item, origin) {
|
|
18312
18392
|
return await this.read(item, origin) !== null;
|
|
18313
18393
|
}
|
|
18314
18394
|
async read(item, origin) {
|
|
18315
|
-
const result = await run(this.executable, ["find-generic-password", "-s", service, "-a", account(item, origin), "-w"]);
|
|
18395
|
+
const result = await run(this.executable, ["find-generic-password", "-s", this.service, "-a", account(item, origin), "-w"]);
|
|
18316
18396
|
if (result.exitCode === keychainNotFound) {
|
|
18317
18397
|
return null;
|
|
18318
18398
|
}
|
|
@@ -18323,7 +18403,7 @@ var KeychainBackend = class {
|
|
|
18323
18403
|
}
|
|
18324
18404
|
async write(item, origin, value) {
|
|
18325
18405
|
const hex3 = Buffer.from(encode3(value), "utf8").toString("hex");
|
|
18326
|
-
const command = `add-generic-password -U -s ${service} -a ${account(item, origin)} -X ${hex3}
|
|
18406
|
+
const command = `add-generic-password -U -s ${this.service} -a ${account(item, origin)} -X ${hex3}
|
|
18327
18407
|
`;
|
|
18328
18408
|
if (command.length > maxCommandLength) {
|
|
18329
18409
|
throw refused();
|
|
@@ -18334,7 +18414,7 @@ var KeychainBackend = class {
|
|
|
18334
18414
|
}
|
|
18335
18415
|
}
|
|
18336
18416
|
async remove(item, origin) {
|
|
18337
|
-
const result = await run(this.executable, ["delete-generic-password", "-s", service, "-a", account(item, origin)]);
|
|
18417
|
+
const result = await run(this.executable, ["delete-generic-password", "-s", this.service, "-a", account(item, origin)]);
|
|
18338
18418
|
if (result.exitCode !== 0 && result.exitCode !== keychainNotFound) {
|
|
18339
18419
|
throw refused();
|
|
18340
18420
|
}
|
|
@@ -18343,11 +18423,13 @@ var KeychainBackend = class {
|
|
|
18343
18423
|
var SecretServiceBackend = class {
|
|
18344
18424
|
kind = "secret-service";
|
|
18345
18425
|
executable;
|
|
18346
|
-
|
|
18426
|
+
service;
|
|
18427
|
+
constructor(executable, service = currentService) {
|
|
18347
18428
|
this.executable = executable;
|
|
18429
|
+
this.service = service;
|
|
18348
18430
|
}
|
|
18349
18431
|
attributes(item, origin) {
|
|
18350
|
-
return ["service", service, "account", account(item, origin)];
|
|
18432
|
+
return ["service", this.service, "account", account(item, origin)];
|
|
18351
18433
|
}
|
|
18352
18434
|
async exists(item, origin) {
|
|
18353
18435
|
return await this.read(item, origin) !== null;
|
|
@@ -18363,7 +18445,7 @@ var SecretServiceBackend = class {
|
|
|
18363
18445
|
return decode3(result.stdout);
|
|
18364
18446
|
}
|
|
18365
18447
|
async write(item, origin, value) {
|
|
18366
|
-
const result = await run(this.executable, ["store", "--label=
|
|
18448
|
+
const result = await run(this.executable, ["store", "--label=Obi CLI", ...this.attributes(item, origin)], encode3(value));
|
|
18367
18449
|
if (result.exitCode !== 0) {
|
|
18368
18450
|
throw refused();
|
|
18369
18451
|
}
|
|
@@ -18379,7 +18461,7 @@ var secretToolLocations = ["/usr/bin/secret-tool", "/usr/local/bin/secret-tool",
|
|
|
18379
18461
|
function installedSecretTool() {
|
|
18380
18462
|
for (const candidate of secretToolLocations) {
|
|
18381
18463
|
try {
|
|
18382
|
-
accessSync(candidate,
|
|
18464
|
+
accessSync(candidate, constants3.X_OK);
|
|
18383
18465
|
if (statSync(candidate).isFile()) {
|
|
18384
18466
|
return candidate;
|
|
18385
18467
|
}
|
|
@@ -18388,15 +18470,58 @@ function installedSecretTool() {
|
|
|
18388
18470
|
}
|
|
18389
18471
|
return null;
|
|
18390
18472
|
}
|
|
18473
|
+
var MigratingBackend = class {
|
|
18474
|
+
kind;
|
|
18475
|
+
current;
|
|
18476
|
+
legacy;
|
|
18477
|
+
constructor(current, legacy) {
|
|
18478
|
+
this.kind = current.kind;
|
|
18479
|
+
this.current = current;
|
|
18480
|
+
this.legacy = legacy;
|
|
18481
|
+
}
|
|
18482
|
+
async exists(item, origin) {
|
|
18483
|
+
return await this.read(item, origin) !== null;
|
|
18484
|
+
}
|
|
18485
|
+
async read(item, origin) {
|
|
18486
|
+
const value = await this.current.read(item, origin);
|
|
18487
|
+
if (value !== null) return value;
|
|
18488
|
+
const old = await this.legacy.read(item, origin);
|
|
18489
|
+
if (old === null) return null;
|
|
18490
|
+
const moved = await this.current.read(item, origin);
|
|
18491
|
+
if (moved !== null) {
|
|
18492
|
+
await this.legacy.remove(item, origin).catch(() => void 0);
|
|
18493
|
+
return moved;
|
|
18494
|
+
}
|
|
18495
|
+
try {
|
|
18496
|
+
await this.current.write(item, origin, old);
|
|
18497
|
+
} catch {
|
|
18498
|
+
return old;
|
|
18499
|
+
}
|
|
18500
|
+
await this.legacy.remove(item, origin).catch(() => void 0);
|
|
18501
|
+
return old;
|
|
18502
|
+
}
|
|
18503
|
+
async write(item, origin, value) {
|
|
18504
|
+
await this.current.write(item, origin, value);
|
|
18505
|
+
}
|
|
18506
|
+
async remove(item, origin) {
|
|
18507
|
+
await this.current.remove(item, origin);
|
|
18508
|
+
try {
|
|
18509
|
+
await this.legacy.remove(item, origin);
|
|
18510
|
+
} catch {
|
|
18511
|
+
process.stderr.write("Warning: a copy of this connection under the former store name could not be removed.\n");
|
|
18512
|
+
}
|
|
18513
|
+
}
|
|
18514
|
+
};
|
|
18391
18515
|
function systemBackend() {
|
|
18392
18516
|
if (process.platform === "darwin") {
|
|
18393
|
-
|
|
18517
|
+
const security = "/usr/bin/security";
|
|
18518
|
+
return existsSync2(security) ? new MigratingBackend(new KeychainBackend(security), new KeychainBackend(security, legacyService)) : null;
|
|
18394
18519
|
}
|
|
18395
18520
|
if (process.platform === "win32") {
|
|
18396
18521
|
return null;
|
|
18397
18522
|
}
|
|
18398
18523
|
const secretTool = installedSecretTool();
|
|
18399
|
-
return secretTool === null ? null : new SecretServiceBackend(secretTool);
|
|
18524
|
+
return secretTool === null ? null : new MigratingBackend(new SecretServiceBackend(secretTool), new SecretServiceBackend(secretTool, legacyService));
|
|
18400
18525
|
}
|
|
18401
18526
|
|
|
18402
18527
|
// src/retired-origin.ts
|
|
@@ -18634,7 +18759,7 @@ async function acquireLock(path) {
|
|
|
18634
18759
|
if (holder !== null && isStale(holder)) {
|
|
18635
18760
|
const current = await readHolder(path);
|
|
18636
18761
|
if (current !== null && current.raw === holder.raw && current.identity === holder.identity) {
|
|
18637
|
-
await
|
|
18762
|
+
await unlink3(path).catch((error51) => {
|
|
18638
18763
|
if (error51.code !== "ENOENT") throw error51;
|
|
18639
18764
|
});
|
|
18640
18765
|
}
|
|
@@ -18653,7 +18778,7 @@ async function withCredentialLock(context, action) {
|
|
|
18653
18778
|
try {
|
|
18654
18779
|
return await action();
|
|
18655
18780
|
} finally {
|
|
18656
|
-
await
|
|
18781
|
+
await unlink3(path).catch((error51) => {
|
|
18657
18782
|
if (error51.code !== "ENOENT") throw error51;
|
|
18658
18783
|
});
|
|
18659
18784
|
}
|
|
@@ -19708,7 +19833,7 @@ import { resolve } from "node:path";
|
|
|
19708
19833
|
|
|
19709
19834
|
// src/local-json.ts
|
|
19710
19835
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
19711
|
-
import { rename as
|
|
19836
|
+
import { rename as rename3, unlink as unlink4, writeFile as writeFile2 } from "node:fs/promises";
|
|
19712
19837
|
function localFileError(message, nextAction) {
|
|
19713
19838
|
return new CliError({
|
|
19714
19839
|
code: "RESEARCH_FILE_ERROR",
|
|
@@ -19726,9 +19851,9 @@ async function writeJsonAtomic(path, value, options) {
|
|
|
19726
19851
|
if (bytes > options.maxBytes) throw localFileError(options.tooLarge, options.nextAction);
|
|
19727
19852
|
try {
|
|
19728
19853
|
await writeFile2(temporary, content, { mode: 384, flag: "wx" });
|
|
19729
|
-
await
|
|
19854
|
+
await rename3(temporary, path);
|
|
19730
19855
|
} catch {
|
|
19731
|
-
await
|
|
19856
|
+
await unlink4(temporary).catch(() => void 0);
|
|
19732
19857
|
throw localFileError("The output could not be written atomically.", options.nextAction);
|
|
19733
19858
|
}
|
|
19734
19859
|
return bytes;
|
|
@@ -20020,7 +20145,7 @@ import { setTimeout as sleep2 } from "node:timers/promises";
|
|
|
20020
20145
|
import { execFileSync } from "node:child_process";
|
|
20021
20146
|
import { readFileSync } from "node:fs";
|
|
20022
20147
|
import { hostname as hostname4 } from "node:os";
|
|
20023
|
-
import { basename } from "node:path";
|
|
20148
|
+
import { basename as basename2 } from "node:path";
|
|
20024
20149
|
var maxLabelLength = 64;
|
|
20025
20150
|
function parentProcessName() {
|
|
20026
20151
|
try {
|
|
@@ -20033,7 +20158,7 @@ function parentProcessName() {
|
|
|
20033
20158
|
stdio: ["ignore", "pipe", "ignore"],
|
|
20034
20159
|
timeout: 2e3
|
|
20035
20160
|
});
|
|
20036
|
-
return
|
|
20161
|
+
return basename2(command.trim());
|
|
20037
20162
|
}
|
|
20038
20163
|
} catch {
|
|
20039
20164
|
}
|
|
@@ -20056,17 +20181,30 @@ function deviceLabel() {
|
|
|
20056
20181
|
// src/origin.ts
|
|
20057
20182
|
var productionOrigin = "https://agent.hireobi.com";
|
|
20058
20183
|
var developmentOrigin = /^http:\/\/(localhost|127\.0\.0\.1|\[::1\]):([1-9][0-9]{0,4})$/;
|
|
20184
|
+
var retiredVariable = "HEYSURFACE_ORIGIN";
|
|
20059
20185
|
function invalidOrigin() {
|
|
20060
20186
|
return new CliError({
|
|
20061
20187
|
code: "INVALID_ORIGIN",
|
|
20062
|
-
message: "
|
|
20188
|
+
message: "OBI_ORIGIN must be a loopback development origin with an explicit port.",
|
|
20189
|
+
exitCode: 2,
|
|
20190
|
+
retryable: false,
|
|
20191
|
+
nextAction: "Unset OBI_ORIGIN, or set it to http://localhost:<port>, http://127.0.0.1:<port> or http://[::1]:<port>."
|
|
20192
|
+
});
|
|
20193
|
+
}
|
|
20194
|
+
function retiredOrigin() {
|
|
20195
|
+
return new CliError({
|
|
20196
|
+
code: "INVALID_ORIGIN",
|
|
20197
|
+
message: `${retiredVariable} is no longer read; the development origin is OBI_ORIGIN.`,
|
|
20063
20198
|
exitCode: 2,
|
|
20064
20199
|
retryable: false,
|
|
20065
|
-
nextAction:
|
|
20200
|
+
nextAction: `Unset ${retiredVariable}, and set OBI_ORIGIN instead if you meant a development server.`
|
|
20066
20201
|
});
|
|
20067
20202
|
}
|
|
20068
20203
|
function resolveOrigin(environment) {
|
|
20069
|
-
|
|
20204
|
+
if (environment[retiredVariable] !== void 0) {
|
|
20205
|
+
throw retiredOrigin();
|
|
20206
|
+
}
|
|
20207
|
+
const override = environment.OBI_ORIGIN;
|
|
20070
20208
|
if (override === void 0) {
|
|
20071
20209
|
return { origin: productionOrigin, development: false };
|
|
20072
20210
|
}
|
|
@@ -20294,14 +20432,12 @@ var storageLabels = {
|
|
|
20294
20432
|
"secret-service": "the system Secret Service",
|
|
20295
20433
|
file: "a file readable only by your user"
|
|
20296
20434
|
};
|
|
20297
|
-
function toHumanOutput(result
|
|
20435
|
+
function toHumanOutput(result) {
|
|
20298
20436
|
if (!result.ok) {
|
|
20299
20437
|
return failureText(result);
|
|
20300
20438
|
}
|
|
20301
20439
|
if (result.command === "help") {
|
|
20302
|
-
|
|
20303
|
-
`;
|
|
20304
|
-
const usage2 = result.data.usage.split("\n").map((line) => ` ${line.trimStart().replace(/^heysurface /, "obi ")}`).join("\n");
|
|
20440
|
+
const usage2 = result.data.usage.split("\n").map((line) => ` ${line.trimStart()}`).join("\n");
|
|
20305
20441
|
return `Obi \xB7 AI Search Employee
|
|
20306
20442
|
|
|
20307
20443
|
Get started
|
|
@@ -20321,8 +20457,8 @@ ${usage2}
|
|
|
20321
20457
|
}
|
|
20322
20458
|
if (result.command === "skill") {
|
|
20323
20459
|
return result.data.action === "path" ? `${sanitizeHumanText(result.data.path)}
|
|
20324
|
-
` :
|
|
20325
|
-
${result.data.removed.length > 0 ? "
|
|
20460
|
+
` : `Obi Skill registered locally. In a new Claude Code or Cursor chat, type /obi. In Codex CLI, type $obi or choose Obi from /skills. In the desktop app, select Obi from the skills picker.
|
|
20461
|
+
${result.data.removed.length > 0 ? "Earlier Skill links of this package under another name were removed; use /obi.\n" : ""}`;
|
|
20326
20462
|
}
|
|
20327
20463
|
if (result.command === "capabilities") {
|
|
20328
20464
|
return "Available: business, capabilities, credentials, doctor, eval, harness, login, logout, memory, questions, readiness, research, skill, status, strategies. Scan execution requires server authorization and a separate customer decision.\n";
|
|
@@ -20538,11 +20674,11 @@ ${sanitizeHumanText(data.revision.content)}
|
|
|
20538
20674
|
];
|
|
20539
20675
|
if (review.identity === null) lines.push(" pending");
|
|
20540
20676
|
else {
|
|
20541
|
-
const { identity
|
|
20542
|
-
lines.push(` Current company name [${
|
|
20543
|
-
lines.push(` Site proposal [${
|
|
20544
|
-
if (
|
|
20545
|
-
for (const evidence2 of
|
|
20677
|
+
const { identity } = review;
|
|
20678
|
+
lines.push(` Current company name [${identity.origin}${identity.latestReview === null ? "" : `, ${identity.latestReview}`}]: ${sanitizeHumanText(identity.value.companyName ?? "unresolved")} (company only).`);
|
|
20679
|
+
lines.push(` Site proposal [${identity.proposal.status}]: ${sanitizeHumanText(identity.proposal.name ?? "unresolved")} on ${sanitizeHumanText(identity.proposal.domain)} (${sanitizeHumanText(identity.proposal.reason)}).`);
|
|
20680
|
+
if (identity.conflict !== null) lines.push(` Name conflict: customer says ${sanitizeHumanText(identity.conflict.customerName)}; site proposes ${sanitizeHumanText(identity.conflict.siteProposedName)}. Keep the customer name and review the discrepancy.`);
|
|
20681
|
+
for (const evidence2 of identity.proposal.evidence) lines.push(` Proposal evidence: ${sanitizeHumanText(evidence2.quote)} \u2014 ${sanitizeHumanText(evidence2.url)}`);
|
|
20546
20682
|
}
|
|
20547
20683
|
lines.push("Summary:");
|
|
20548
20684
|
if (review.summary === null) lines.push(" pending");
|
|
@@ -20649,13 +20785,13 @@ function humanWarnings(result) {
|
|
|
20649
20785
|
}
|
|
20650
20786
|
return "";
|
|
20651
20787
|
}
|
|
20652
|
-
function writeResult(result, json2
|
|
20788
|
+
function writeResult(result, json2) {
|
|
20653
20789
|
if (json2) {
|
|
20654
20790
|
process.stdout.write(toJsonLine(result));
|
|
20655
20791
|
return;
|
|
20656
20792
|
}
|
|
20657
|
-
const human = toHumanOutput(result
|
|
20658
|
-
const heading2 =
|
|
20793
|
+
const human = toHumanOutput(result);
|
|
20794
|
+
const heading2 = !result.ok || result.command !== "version" && result.command !== "skill" && result.command !== "help" ? "Obi\n\n" : "";
|
|
20659
20795
|
const output = `${heading2}${result.evaluationCaseId ? `Evaluation case ${result.evaluationCaseId}
|
|
20660
20796
|
${human}` : human}`;
|
|
20661
20797
|
if (result.ok) {
|
|
@@ -20684,7 +20820,7 @@ async function confirmAccount(account2) {
|
|
|
20684
20820
|
}
|
|
20685
20821
|
|
|
20686
20822
|
// src/version.ts
|
|
20687
|
-
var cliVersion = "0.1.
|
|
20823
|
+
var cliVersion = "0.1.8";
|
|
20688
20824
|
|
|
20689
20825
|
// src/login.ts
|
|
20690
20826
|
var loginRequestTimeoutMs = 1e4;
|
|
@@ -20704,10 +20840,10 @@ function connectionLink(pending) {
|
|
|
20704
20840
|
return pending.verificationUriComplete ?? pending.verificationUri;
|
|
20705
20841
|
}
|
|
20706
20842
|
function announcementLines(pending, opening) {
|
|
20707
|
-
const
|
|
20843
|
+
const link2 = sanitizeHumanText(connectionLink(pending));
|
|
20708
20844
|
const code = sanitizeHumanText(pending.userCode);
|
|
20709
20845
|
return [
|
|
20710
|
-
opening ? `Opening ${
|
|
20846
|
+
opening ? `Opening ${link2} in your browser: sign in there, or create your Obi account.` : `Open ${link2} to sign in or create your Obi account.`,
|
|
20711
20847
|
`Check that the page shows the code ${code}, and approve the connection only if it does.`
|
|
20712
20848
|
];
|
|
20713
20849
|
}
|
|
@@ -21140,12 +21276,12 @@ import { urlToHttpOptions } from "node:url";
|
|
|
21140
21276
|
|
|
21141
21277
|
// ../geo-engine/src/safe-fetch-decoding.ts
|
|
21142
21278
|
import { Duplex, pipeline } from "node:stream";
|
|
21143
|
-
import { constants as
|
|
21279
|
+
import { constants as constants4, createBrotliDecompress, createGunzip, createInflate, createInflateRaw } from "node:zlib";
|
|
21144
21280
|
var MAX_CODINGS = 5;
|
|
21145
21281
|
var ZLIB_DEFLATE_METHOD = 8;
|
|
21146
21282
|
var BODILESS_STATUSES = /* @__PURE__ */ new Set([204, 205, 304]);
|
|
21147
|
-
var ZLIB_LENIENCY = { flush:
|
|
21148
|
-
var BROTLI_LENIENCY = { flush:
|
|
21283
|
+
var ZLIB_LENIENCY = { flush: constants4.Z_SYNC_FLUSH, finishFlush: constants4.Z_SYNC_FLUSH };
|
|
21284
|
+
var BROTLI_LENIENCY = { flush: constants4.BROTLI_OPERATION_FLUSH, finishFlush: constants4.BROTLI_OPERATION_FLUSH };
|
|
21149
21285
|
function createDeflateDecoder() {
|
|
21150
21286
|
let inflater;
|
|
21151
21287
|
const start = (format) => {
|
|
@@ -21523,20 +21659,20 @@ var SEQUENCES = {
|
|
|
21523
21659
|
PUBLIC: "public",
|
|
21524
21660
|
SYSTEM: "system"
|
|
21525
21661
|
};
|
|
21526
|
-
function isSurrogate(
|
|
21527
|
-
return
|
|
21662
|
+
function isSurrogate(cp2) {
|
|
21663
|
+
return cp2 >= 55296 && cp2 <= 57343;
|
|
21528
21664
|
}
|
|
21529
|
-
function isSurrogatePair(
|
|
21530
|
-
return
|
|
21665
|
+
function isSurrogatePair(cp2) {
|
|
21666
|
+
return cp2 >= 56320 && cp2 <= 57343;
|
|
21531
21667
|
}
|
|
21532
21668
|
function getSurrogatePairCodePoint(cp1, cp2) {
|
|
21533
21669
|
return (cp1 - 55296) * 1024 + 9216 + cp2;
|
|
21534
21670
|
}
|
|
21535
|
-
function isControlCodePoint(
|
|
21536
|
-
return
|
|
21671
|
+
function isControlCodePoint(cp2) {
|
|
21672
|
+
return cp2 !== 32 && cp2 !== 10 && cp2 !== 13 && cp2 !== 9 && cp2 !== 12 && cp2 >= 1 && cp2 <= 31 || cp2 >= 127 && cp2 <= 159;
|
|
21537
21673
|
}
|
|
21538
|
-
function isUndefinedCodePoint(
|
|
21539
|
-
return
|
|
21674
|
+
function isUndefinedCodePoint(cp2) {
|
|
21675
|
+
return cp2 >= 64976 && cp2 <= 65007 || UNDEFINED_CODE_POINTS.has(cp2);
|
|
21540
21676
|
}
|
|
21541
21677
|
|
|
21542
21678
|
// ../node_modules/parse5/dist/common/error-codes.js
|
|
@@ -21654,20 +21790,20 @@ var Preprocessor = class {
|
|
|
21654
21790
|
this.gapStack.push(this.lastGapPos);
|
|
21655
21791
|
this.lastGapPos = this.pos;
|
|
21656
21792
|
}
|
|
21657
|
-
_processSurrogate(
|
|
21793
|
+
_processSurrogate(cp2) {
|
|
21658
21794
|
if (this.pos !== this.html.length - 1) {
|
|
21659
21795
|
const nextCp = this.html.charCodeAt(this.pos + 1);
|
|
21660
21796
|
if (isSurrogatePair(nextCp)) {
|
|
21661
21797
|
this.pos++;
|
|
21662
21798
|
this._addGap();
|
|
21663
|
-
return getSurrogatePairCodePoint(
|
|
21799
|
+
return getSurrogatePairCodePoint(cp2, nextCp);
|
|
21664
21800
|
}
|
|
21665
21801
|
} else if (!this.lastChunkWritten) {
|
|
21666
21802
|
this.endOfChunkHit = true;
|
|
21667
21803
|
return CODE_POINTS.EOF;
|
|
21668
21804
|
}
|
|
21669
21805
|
this._err(ERR.surrogateInInputStream);
|
|
21670
|
-
return
|
|
21806
|
+
return cp2;
|
|
21671
21807
|
}
|
|
21672
21808
|
willDropParsedChunk() {
|
|
21673
21809
|
return this.pos > this.bufferWaterline;
|
|
@@ -21704,8 +21840,8 @@ var Preprocessor = class {
|
|
|
21704
21840
|
return this.html.startsWith(pattern, this.pos);
|
|
21705
21841
|
}
|
|
21706
21842
|
for (let i = 0; i < pattern.length; i++) {
|
|
21707
|
-
const
|
|
21708
|
-
if (
|
|
21843
|
+
const cp2 = this.html.charCodeAt(this.pos + i) | 32;
|
|
21844
|
+
if (cp2 !== pattern.charCodeAt(i)) {
|
|
21709
21845
|
return false;
|
|
21710
21846
|
}
|
|
21711
21847
|
}
|
|
@@ -21731,13 +21867,13 @@ var Preprocessor = class {
|
|
|
21731
21867
|
this.endOfChunkHit = !this.lastChunkWritten;
|
|
21732
21868
|
return CODE_POINTS.EOF;
|
|
21733
21869
|
}
|
|
21734
|
-
let
|
|
21735
|
-
if (
|
|
21870
|
+
let cp2 = this.html.charCodeAt(this.pos);
|
|
21871
|
+
if (cp2 === CODE_POINTS.CARRIAGE_RETURN) {
|
|
21736
21872
|
this.isEol = true;
|
|
21737
21873
|
this.skipNextNewLine = true;
|
|
21738
21874
|
return CODE_POINTS.LINE_FEED;
|
|
21739
21875
|
}
|
|
21740
|
-
if (
|
|
21876
|
+
if (cp2 === CODE_POINTS.LINE_FEED) {
|
|
21741
21877
|
this.isEol = true;
|
|
21742
21878
|
if (this.skipNextNewLine) {
|
|
21743
21879
|
this.line--;
|
|
@@ -21747,19 +21883,19 @@ var Preprocessor = class {
|
|
|
21747
21883
|
}
|
|
21748
21884
|
}
|
|
21749
21885
|
this.skipNextNewLine = false;
|
|
21750
|
-
if (isSurrogate(
|
|
21751
|
-
|
|
21886
|
+
if (isSurrogate(cp2)) {
|
|
21887
|
+
cp2 = this._processSurrogate(cp2);
|
|
21752
21888
|
}
|
|
21753
|
-
const isCommonValidRange = this.handler.onParseError === null ||
|
|
21889
|
+
const isCommonValidRange = this.handler.onParseError === null || cp2 > 31 && cp2 < 127 || cp2 === CODE_POINTS.LINE_FEED || cp2 === CODE_POINTS.CARRIAGE_RETURN || cp2 > 159 && cp2 < 64976;
|
|
21754
21890
|
if (!isCommonValidRange) {
|
|
21755
|
-
this._checkForProblematicCharacters(
|
|
21891
|
+
this._checkForProblematicCharacters(cp2);
|
|
21756
21892
|
}
|
|
21757
|
-
return
|
|
21893
|
+
return cp2;
|
|
21758
21894
|
}
|
|
21759
|
-
_checkForProblematicCharacters(
|
|
21760
|
-
if (isControlCodePoint(
|
|
21895
|
+
_checkForProblematicCharacters(cp2) {
|
|
21896
|
+
if (isControlCodePoint(cp2)) {
|
|
21761
21897
|
this._err(ERR.controlCharacterInInputStream);
|
|
21762
|
-
} else if (isUndefinedCodePoint(
|
|
21898
|
+
} else if (isUndefinedCodePoint(cp2)) {
|
|
21763
21899
|
this._err(ERR.noncharacterInInputStream);
|
|
21764
21900
|
}
|
|
21765
21901
|
}
|
|
@@ -22825,29 +22961,29 @@ var TokenizerMode = {
|
|
|
22825
22961
|
PLAINTEXT: State.PLAINTEXT,
|
|
22826
22962
|
CDATA_SECTION: State.CDATA_SECTION
|
|
22827
22963
|
};
|
|
22828
|
-
function isAsciiDigit(
|
|
22829
|
-
return
|
|
22964
|
+
function isAsciiDigit(cp2) {
|
|
22965
|
+
return cp2 >= CODE_POINTS.DIGIT_0 && cp2 <= CODE_POINTS.DIGIT_9;
|
|
22830
22966
|
}
|
|
22831
|
-
function isAsciiUpper(
|
|
22832
|
-
return
|
|
22967
|
+
function isAsciiUpper(cp2) {
|
|
22968
|
+
return cp2 >= CODE_POINTS.LATIN_CAPITAL_A && cp2 <= CODE_POINTS.LATIN_CAPITAL_Z;
|
|
22833
22969
|
}
|
|
22834
|
-
function isAsciiLower(
|
|
22835
|
-
return
|
|
22970
|
+
function isAsciiLower(cp2) {
|
|
22971
|
+
return cp2 >= CODE_POINTS.LATIN_SMALL_A && cp2 <= CODE_POINTS.LATIN_SMALL_Z;
|
|
22836
22972
|
}
|
|
22837
|
-
function isAsciiLetter(
|
|
22838
|
-
return isAsciiLower(
|
|
22973
|
+
function isAsciiLetter(cp2) {
|
|
22974
|
+
return isAsciiLower(cp2) || isAsciiUpper(cp2);
|
|
22839
22975
|
}
|
|
22840
|
-
function isAsciiAlphaNumeric2(
|
|
22841
|
-
return isAsciiLetter(
|
|
22976
|
+
function isAsciiAlphaNumeric2(cp2) {
|
|
22977
|
+
return isAsciiLetter(cp2) || isAsciiDigit(cp2);
|
|
22842
22978
|
}
|
|
22843
|
-
function toAsciiLower(
|
|
22844
|
-
return
|
|
22979
|
+
function toAsciiLower(cp2) {
|
|
22980
|
+
return cp2 + 32;
|
|
22845
22981
|
}
|
|
22846
|
-
function isWhitespace(
|
|
22847
|
-
return
|
|
22982
|
+
function isWhitespace(cp2) {
|
|
22983
|
+
return cp2 === CODE_POINTS.SPACE || cp2 === CODE_POINTS.LINE_FEED || cp2 === CODE_POINTS.TABULATION || cp2 === CODE_POINTS.FORM_FEED;
|
|
22848
22984
|
}
|
|
22849
|
-
function isScriptDataDoubleEscapeSequenceEnd(
|
|
22850
|
-
return isWhitespace(
|
|
22985
|
+
function isScriptDataDoubleEscapeSequenceEnd(cp2) {
|
|
22986
|
+
return isWhitespace(cp2) || cp2 === CODE_POINTS.SOLIDUS || cp2 === CODE_POINTS.GREATER_THAN_SIGN;
|
|
22851
22987
|
}
|
|
22852
22988
|
function getErrorForNumericCharacterReference(code) {
|
|
22853
22989
|
if (code === CODE_POINTS.NULL) {
|
|
@@ -22881,9 +23017,9 @@ var Tokenizer = class {
|
|
|
22881
23017
|
this.currentAttr = { name: "", value: "" };
|
|
22882
23018
|
this.preprocessor = new Preprocessor(handler);
|
|
22883
23019
|
this.currentLocation = this.getCurrentLocation(-1);
|
|
22884
|
-
this.entityDecoder = new EntityDecoder(htmlDecodeTree, (
|
|
23020
|
+
this.entityDecoder = new EntityDecoder(htmlDecodeTree, (cp2, consumed) => {
|
|
22885
23021
|
this.preprocessor.pos = this.entityStartPos + consumed - 1;
|
|
22886
|
-
this._flushCodePointConsumedAsCharacterReference(
|
|
23022
|
+
this._flushCodePointConsumedAsCharacterReference(cp2);
|
|
22887
23023
|
}, handler.onParseError ? {
|
|
22888
23024
|
missingSemicolonAfterCharacterReference: () => {
|
|
22889
23025
|
this._err(ERR.missingSemicolonAfterCharacterReference, 1);
|
|
@@ -22923,9 +23059,9 @@ var Tokenizer = class {
|
|
|
22923
23059
|
this.inLoop = true;
|
|
22924
23060
|
while (this.active && !this.paused) {
|
|
22925
23061
|
this.consumedAfterSnapshot = 0;
|
|
22926
|
-
const
|
|
23062
|
+
const cp2 = this._consume();
|
|
22927
23063
|
if (!this._ensureHibernation()) {
|
|
22928
|
-
this._callState(
|
|
23064
|
+
this._callState(cp2);
|
|
22929
23065
|
}
|
|
22930
23066
|
}
|
|
22931
23067
|
this.inLoop = false;
|
|
@@ -23160,9 +23296,9 @@ var Tokenizer = class {
|
|
|
23160
23296
|
}
|
|
23161
23297
|
this._createCharacterToken(type, ch);
|
|
23162
23298
|
}
|
|
23163
|
-
_emitCodePoint(
|
|
23164
|
-
const type = isWhitespace(
|
|
23165
|
-
this._appendCharToCurrentCharacterToken(type,
|
|
23299
|
+
_emitCodePoint(cp2) {
|
|
23300
|
+
const type = isWhitespace(cp2) ? TokenType.WHITESPACE_CHARACTER : cp2 === CODE_POINTS.NULL ? TokenType.NULL_CHARACTER : TokenType.CHARACTER;
|
|
23301
|
+
this._appendCharToCurrentCharacterToken(type, cp2 < 65536 ? String.fromCharCode(cp2) : String.fromCodePoint(cp2));
|
|
23166
23302
|
}
|
|
23167
23303
|
//NOTE: used when we emit characters explicitly.
|
|
23168
23304
|
//This is always for non-whitespace and non-null characters, which allows us to avoid additional checks.
|
|
@@ -23179,298 +23315,298 @@ var Tokenizer = class {
|
|
|
23179
23315
|
_isCharacterReferenceInAttribute() {
|
|
23180
23316
|
return this.returnState === State.ATTRIBUTE_VALUE_DOUBLE_QUOTED || this.returnState === State.ATTRIBUTE_VALUE_SINGLE_QUOTED || this.returnState === State.ATTRIBUTE_VALUE_UNQUOTED;
|
|
23181
23317
|
}
|
|
23182
|
-
_flushCodePointConsumedAsCharacterReference(
|
|
23318
|
+
_flushCodePointConsumedAsCharacterReference(cp2) {
|
|
23183
23319
|
if (this._isCharacterReferenceInAttribute()) {
|
|
23184
|
-
this.currentAttr.value += String.fromCodePoint(
|
|
23320
|
+
this.currentAttr.value += String.fromCodePoint(cp2);
|
|
23185
23321
|
} else {
|
|
23186
|
-
this._emitCodePoint(
|
|
23322
|
+
this._emitCodePoint(cp2);
|
|
23187
23323
|
}
|
|
23188
23324
|
}
|
|
23189
23325
|
// Calling states this way turns out to be much faster than any other approach.
|
|
23190
|
-
_callState(
|
|
23326
|
+
_callState(cp2) {
|
|
23191
23327
|
switch (this.state) {
|
|
23192
23328
|
case State.DATA: {
|
|
23193
|
-
this._stateData(
|
|
23329
|
+
this._stateData(cp2);
|
|
23194
23330
|
break;
|
|
23195
23331
|
}
|
|
23196
23332
|
case State.RCDATA: {
|
|
23197
|
-
this._stateRcdata(
|
|
23333
|
+
this._stateRcdata(cp2);
|
|
23198
23334
|
break;
|
|
23199
23335
|
}
|
|
23200
23336
|
case State.RAWTEXT: {
|
|
23201
|
-
this._stateRawtext(
|
|
23337
|
+
this._stateRawtext(cp2);
|
|
23202
23338
|
break;
|
|
23203
23339
|
}
|
|
23204
23340
|
case State.SCRIPT_DATA: {
|
|
23205
|
-
this._stateScriptData(
|
|
23341
|
+
this._stateScriptData(cp2);
|
|
23206
23342
|
break;
|
|
23207
23343
|
}
|
|
23208
23344
|
case State.PLAINTEXT: {
|
|
23209
|
-
this._statePlaintext(
|
|
23345
|
+
this._statePlaintext(cp2);
|
|
23210
23346
|
break;
|
|
23211
23347
|
}
|
|
23212
23348
|
case State.TAG_OPEN: {
|
|
23213
|
-
this._stateTagOpen(
|
|
23349
|
+
this._stateTagOpen(cp2);
|
|
23214
23350
|
break;
|
|
23215
23351
|
}
|
|
23216
23352
|
case State.END_TAG_OPEN: {
|
|
23217
|
-
this._stateEndTagOpen(
|
|
23353
|
+
this._stateEndTagOpen(cp2);
|
|
23218
23354
|
break;
|
|
23219
23355
|
}
|
|
23220
23356
|
case State.TAG_NAME: {
|
|
23221
|
-
this._stateTagName(
|
|
23357
|
+
this._stateTagName(cp2);
|
|
23222
23358
|
break;
|
|
23223
23359
|
}
|
|
23224
23360
|
case State.RCDATA_LESS_THAN_SIGN: {
|
|
23225
|
-
this._stateRcdataLessThanSign(
|
|
23361
|
+
this._stateRcdataLessThanSign(cp2);
|
|
23226
23362
|
break;
|
|
23227
23363
|
}
|
|
23228
23364
|
case State.RCDATA_END_TAG_OPEN: {
|
|
23229
|
-
this._stateRcdataEndTagOpen(
|
|
23365
|
+
this._stateRcdataEndTagOpen(cp2);
|
|
23230
23366
|
break;
|
|
23231
23367
|
}
|
|
23232
23368
|
case State.RCDATA_END_TAG_NAME: {
|
|
23233
|
-
this._stateRcdataEndTagName(
|
|
23369
|
+
this._stateRcdataEndTagName(cp2);
|
|
23234
23370
|
break;
|
|
23235
23371
|
}
|
|
23236
23372
|
case State.RAWTEXT_LESS_THAN_SIGN: {
|
|
23237
|
-
this._stateRawtextLessThanSign(
|
|
23373
|
+
this._stateRawtextLessThanSign(cp2);
|
|
23238
23374
|
break;
|
|
23239
23375
|
}
|
|
23240
23376
|
case State.RAWTEXT_END_TAG_OPEN: {
|
|
23241
|
-
this._stateRawtextEndTagOpen(
|
|
23377
|
+
this._stateRawtextEndTagOpen(cp2);
|
|
23242
23378
|
break;
|
|
23243
23379
|
}
|
|
23244
23380
|
case State.RAWTEXT_END_TAG_NAME: {
|
|
23245
|
-
this._stateRawtextEndTagName(
|
|
23381
|
+
this._stateRawtextEndTagName(cp2);
|
|
23246
23382
|
break;
|
|
23247
23383
|
}
|
|
23248
23384
|
case State.SCRIPT_DATA_LESS_THAN_SIGN: {
|
|
23249
|
-
this._stateScriptDataLessThanSign(
|
|
23385
|
+
this._stateScriptDataLessThanSign(cp2);
|
|
23250
23386
|
break;
|
|
23251
23387
|
}
|
|
23252
23388
|
case State.SCRIPT_DATA_END_TAG_OPEN: {
|
|
23253
|
-
this._stateScriptDataEndTagOpen(
|
|
23389
|
+
this._stateScriptDataEndTagOpen(cp2);
|
|
23254
23390
|
break;
|
|
23255
23391
|
}
|
|
23256
23392
|
case State.SCRIPT_DATA_END_TAG_NAME: {
|
|
23257
|
-
this._stateScriptDataEndTagName(
|
|
23393
|
+
this._stateScriptDataEndTagName(cp2);
|
|
23258
23394
|
break;
|
|
23259
23395
|
}
|
|
23260
23396
|
case State.SCRIPT_DATA_ESCAPE_START: {
|
|
23261
|
-
this._stateScriptDataEscapeStart(
|
|
23397
|
+
this._stateScriptDataEscapeStart(cp2);
|
|
23262
23398
|
break;
|
|
23263
23399
|
}
|
|
23264
23400
|
case State.SCRIPT_DATA_ESCAPE_START_DASH: {
|
|
23265
|
-
this._stateScriptDataEscapeStartDash(
|
|
23401
|
+
this._stateScriptDataEscapeStartDash(cp2);
|
|
23266
23402
|
break;
|
|
23267
23403
|
}
|
|
23268
23404
|
case State.SCRIPT_DATA_ESCAPED: {
|
|
23269
|
-
this._stateScriptDataEscaped(
|
|
23405
|
+
this._stateScriptDataEscaped(cp2);
|
|
23270
23406
|
break;
|
|
23271
23407
|
}
|
|
23272
23408
|
case State.SCRIPT_DATA_ESCAPED_DASH: {
|
|
23273
|
-
this._stateScriptDataEscapedDash(
|
|
23409
|
+
this._stateScriptDataEscapedDash(cp2);
|
|
23274
23410
|
break;
|
|
23275
23411
|
}
|
|
23276
23412
|
case State.SCRIPT_DATA_ESCAPED_DASH_DASH: {
|
|
23277
|
-
this._stateScriptDataEscapedDashDash(
|
|
23413
|
+
this._stateScriptDataEscapedDashDash(cp2);
|
|
23278
23414
|
break;
|
|
23279
23415
|
}
|
|
23280
23416
|
case State.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN: {
|
|
23281
|
-
this._stateScriptDataEscapedLessThanSign(
|
|
23417
|
+
this._stateScriptDataEscapedLessThanSign(cp2);
|
|
23282
23418
|
break;
|
|
23283
23419
|
}
|
|
23284
23420
|
case State.SCRIPT_DATA_ESCAPED_END_TAG_OPEN: {
|
|
23285
|
-
this._stateScriptDataEscapedEndTagOpen(
|
|
23421
|
+
this._stateScriptDataEscapedEndTagOpen(cp2);
|
|
23286
23422
|
break;
|
|
23287
23423
|
}
|
|
23288
23424
|
case State.SCRIPT_DATA_ESCAPED_END_TAG_NAME: {
|
|
23289
|
-
this._stateScriptDataEscapedEndTagName(
|
|
23425
|
+
this._stateScriptDataEscapedEndTagName(cp2);
|
|
23290
23426
|
break;
|
|
23291
23427
|
}
|
|
23292
23428
|
case State.SCRIPT_DATA_DOUBLE_ESCAPE_START: {
|
|
23293
|
-
this._stateScriptDataDoubleEscapeStart(
|
|
23429
|
+
this._stateScriptDataDoubleEscapeStart(cp2);
|
|
23294
23430
|
break;
|
|
23295
23431
|
}
|
|
23296
23432
|
case State.SCRIPT_DATA_DOUBLE_ESCAPED: {
|
|
23297
|
-
this._stateScriptDataDoubleEscaped(
|
|
23433
|
+
this._stateScriptDataDoubleEscaped(cp2);
|
|
23298
23434
|
break;
|
|
23299
23435
|
}
|
|
23300
23436
|
case State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH: {
|
|
23301
|
-
this._stateScriptDataDoubleEscapedDash(
|
|
23437
|
+
this._stateScriptDataDoubleEscapedDash(cp2);
|
|
23302
23438
|
break;
|
|
23303
23439
|
}
|
|
23304
23440
|
case State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH: {
|
|
23305
|
-
this._stateScriptDataDoubleEscapedDashDash(
|
|
23441
|
+
this._stateScriptDataDoubleEscapedDashDash(cp2);
|
|
23306
23442
|
break;
|
|
23307
23443
|
}
|
|
23308
23444
|
case State.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN: {
|
|
23309
|
-
this._stateScriptDataDoubleEscapedLessThanSign(
|
|
23445
|
+
this._stateScriptDataDoubleEscapedLessThanSign(cp2);
|
|
23310
23446
|
break;
|
|
23311
23447
|
}
|
|
23312
23448
|
case State.SCRIPT_DATA_DOUBLE_ESCAPE_END: {
|
|
23313
|
-
this._stateScriptDataDoubleEscapeEnd(
|
|
23449
|
+
this._stateScriptDataDoubleEscapeEnd(cp2);
|
|
23314
23450
|
break;
|
|
23315
23451
|
}
|
|
23316
23452
|
case State.BEFORE_ATTRIBUTE_NAME: {
|
|
23317
|
-
this._stateBeforeAttributeName(
|
|
23453
|
+
this._stateBeforeAttributeName(cp2);
|
|
23318
23454
|
break;
|
|
23319
23455
|
}
|
|
23320
23456
|
case State.ATTRIBUTE_NAME: {
|
|
23321
|
-
this._stateAttributeName(
|
|
23457
|
+
this._stateAttributeName(cp2);
|
|
23322
23458
|
break;
|
|
23323
23459
|
}
|
|
23324
23460
|
case State.AFTER_ATTRIBUTE_NAME: {
|
|
23325
|
-
this._stateAfterAttributeName(
|
|
23461
|
+
this._stateAfterAttributeName(cp2);
|
|
23326
23462
|
break;
|
|
23327
23463
|
}
|
|
23328
23464
|
case State.BEFORE_ATTRIBUTE_VALUE: {
|
|
23329
|
-
this._stateBeforeAttributeValue(
|
|
23465
|
+
this._stateBeforeAttributeValue(cp2);
|
|
23330
23466
|
break;
|
|
23331
23467
|
}
|
|
23332
23468
|
case State.ATTRIBUTE_VALUE_DOUBLE_QUOTED: {
|
|
23333
|
-
this._stateAttributeValueDoubleQuoted(
|
|
23469
|
+
this._stateAttributeValueDoubleQuoted(cp2);
|
|
23334
23470
|
break;
|
|
23335
23471
|
}
|
|
23336
23472
|
case State.ATTRIBUTE_VALUE_SINGLE_QUOTED: {
|
|
23337
|
-
this._stateAttributeValueSingleQuoted(
|
|
23473
|
+
this._stateAttributeValueSingleQuoted(cp2);
|
|
23338
23474
|
break;
|
|
23339
23475
|
}
|
|
23340
23476
|
case State.ATTRIBUTE_VALUE_UNQUOTED: {
|
|
23341
|
-
this._stateAttributeValueUnquoted(
|
|
23477
|
+
this._stateAttributeValueUnquoted(cp2);
|
|
23342
23478
|
break;
|
|
23343
23479
|
}
|
|
23344
23480
|
case State.AFTER_ATTRIBUTE_VALUE_QUOTED: {
|
|
23345
|
-
this._stateAfterAttributeValueQuoted(
|
|
23481
|
+
this._stateAfterAttributeValueQuoted(cp2);
|
|
23346
23482
|
break;
|
|
23347
23483
|
}
|
|
23348
23484
|
case State.SELF_CLOSING_START_TAG: {
|
|
23349
|
-
this._stateSelfClosingStartTag(
|
|
23485
|
+
this._stateSelfClosingStartTag(cp2);
|
|
23350
23486
|
break;
|
|
23351
23487
|
}
|
|
23352
23488
|
case State.BOGUS_COMMENT: {
|
|
23353
|
-
this._stateBogusComment(
|
|
23489
|
+
this._stateBogusComment(cp2);
|
|
23354
23490
|
break;
|
|
23355
23491
|
}
|
|
23356
23492
|
case State.MARKUP_DECLARATION_OPEN: {
|
|
23357
|
-
this._stateMarkupDeclarationOpen(
|
|
23493
|
+
this._stateMarkupDeclarationOpen(cp2);
|
|
23358
23494
|
break;
|
|
23359
23495
|
}
|
|
23360
23496
|
case State.COMMENT_START: {
|
|
23361
|
-
this._stateCommentStart(
|
|
23497
|
+
this._stateCommentStart(cp2);
|
|
23362
23498
|
break;
|
|
23363
23499
|
}
|
|
23364
23500
|
case State.COMMENT_START_DASH: {
|
|
23365
|
-
this._stateCommentStartDash(
|
|
23501
|
+
this._stateCommentStartDash(cp2);
|
|
23366
23502
|
break;
|
|
23367
23503
|
}
|
|
23368
23504
|
case State.COMMENT: {
|
|
23369
|
-
this._stateComment(
|
|
23505
|
+
this._stateComment(cp2);
|
|
23370
23506
|
break;
|
|
23371
23507
|
}
|
|
23372
23508
|
case State.COMMENT_LESS_THAN_SIGN: {
|
|
23373
|
-
this._stateCommentLessThanSign(
|
|
23509
|
+
this._stateCommentLessThanSign(cp2);
|
|
23374
23510
|
break;
|
|
23375
23511
|
}
|
|
23376
23512
|
case State.COMMENT_LESS_THAN_SIGN_BANG: {
|
|
23377
|
-
this._stateCommentLessThanSignBang(
|
|
23513
|
+
this._stateCommentLessThanSignBang(cp2);
|
|
23378
23514
|
break;
|
|
23379
23515
|
}
|
|
23380
23516
|
case State.COMMENT_LESS_THAN_SIGN_BANG_DASH: {
|
|
23381
|
-
this._stateCommentLessThanSignBangDash(
|
|
23517
|
+
this._stateCommentLessThanSignBangDash(cp2);
|
|
23382
23518
|
break;
|
|
23383
23519
|
}
|
|
23384
23520
|
case State.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH: {
|
|
23385
|
-
this._stateCommentLessThanSignBangDashDash(
|
|
23521
|
+
this._stateCommentLessThanSignBangDashDash(cp2);
|
|
23386
23522
|
break;
|
|
23387
23523
|
}
|
|
23388
23524
|
case State.COMMENT_END_DASH: {
|
|
23389
|
-
this._stateCommentEndDash(
|
|
23525
|
+
this._stateCommentEndDash(cp2);
|
|
23390
23526
|
break;
|
|
23391
23527
|
}
|
|
23392
23528
|
case State.COMMENT_END: {
|
|
23393
|
-
this._stateCommentEnd(
|
|
23529
|
+
this._stateCommentEnd(cp2);
|
|
23394
23530
|
break;
|
|
23395
23531
|
}
|
|
23396
23532
|
case State.COMMENT_END_BANG: {
|
|
23397
|
-
this._stateCommentEndBang(
|
|
23533
|
+
this._stateCommentEndBang(cp2);
|
|
23398
23534
|
break;
|
|
23399
23535
|
}
|
|
23400
23536
|
case State.DOCTYPE: {
|
|
23401
|
-
this._stateDoctype(
|
|
23537
|
+
this._stateDoctype(cp2);
|
|
23402
23538
|
break;
|
|
23403
23539
|
}
|
|
23404
23540
|
case State.BEFORE_DOCTYPE_NAME: {
|
|
23405
|
-
this._stateBeforeDoctypeName(
|
|
23541
|
+
this._stateBeforeDoctypeName(cp2);
|
|
23406
23542
|
break;
|
|
23407
23543
|
}
|
|
23408
23544
|
case State.DOCTYPE_NAME: {
|
|
23409
|
-
this._stateDoctypeName(
|
|
23545
|
+
this._stateDoctypeName(cp2);
|
|
23410
23546
|
break;
|
|
23411
23547
|
}
|
|
23412
23548
|
case State.AFTER_DOCTYPE_NAME: {
|
|
23413
|
-
this._stateAfterDoctypeName(
|
|
23549
|
+
this._stateAfterDoctypeName(cp2);
|
|
23414
23550
|
break;
|
|
23415
23551
|
}
|
|
23416
23552
|
case State.AFTER_DOCTYPE_PUBLIC_KEYWORD: {
|
|
23417
|
-
this._stateAfterDoctypePublicKeyword(
|
|
23553
|
+
this._stateAfterDoctypePublicKeyword(cp2);
|
|
23418
23554
|
break;
|
|
23419
23555
|
}
|
|
23420
23556
|
case State.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER: {
|
|
23421
|
-
this._stateBeforeDoctypePublicIdentifier(
|
|
23557
|
+
this._stateBeforeDoctypePublicIdentifier(cp2);
|
|
23422
23558
|
break;
|
|
23423
23559
|
}
|
|
23424
23560
|
case State.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED: {
|
|
23425
|
-
this._stateDoctypePublicIdentifierDoubleQuoted(
|
|
23561
|
+
this._stateDoctypePublicIdentifierDoubleQuoted(cp2);
|
|
23426
23562
|
break;
|
|
23427
23563
|
}
|
|
23428
23564
|
case State.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED: {
|
|
23429
|
-
this._stateDoctypePublicIdentifierSingleQuoted(
|
|
23565
|
+
this._stateDoctypePublicIdentifierSingleQuoted(cp2);
|
|
23430
23566
|
break;
|
|
23431
23567
|
}
|
|
23432
23568
|
case State.AFTER_DOCTYPE_PUBLIC_IDENTIFIER: {
|
|
23433
|
-
this._stateAfterDoctypePublicIdentifier(
|
|
23569
|
+
this._stateAfterDoctypePublicIdentifier(cp2);
|
|
23434
23570
|
break;
|
|
23435
23571
|
}
|
|
23436
23572
|
case State.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS: {
|
|
23437
|
-
this._stateBetweenDoctypePublicAndSystemIdentifiers(
|
|
23573
|
+
this._stateBetweenDoctypePublicAndSystemIdentifiers(cp2);
|
|
23438
23574
|
break;
|
|
23439
23575
|
}
|
|
23440
23576
|
case State.AFTER_DOCTYPE_SYSTEM_KEYWORD: {
|
|
23441
|
-
this._stateAfterDoctypeSystemKeyword(
|
|
23577
|
+
this._stateAfterDoctypeSystemKeyword(cp2);
|
|
23442
23578
|
break;
|
|
23443
23579
|
}
|
|
23444
23580
|
case State.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER: {
|
|
23445
|
-
this._stateBeforeDoctypeSystemIdentifier(
|
|
23581
|
+
this._stateBeforeDoctypeSystemIdentifier(cp2);
|
|
23446
23582
|
break;
|
|
23447
23583
|
}
|
|
23448
23584
|
case State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED: {
|
|
23449
|
-
this._stateDoctypeSystemIdentifierDoubleQuoted(
|
|
23585
|
+
this._stateDoctypeSystemIdentifierDoubleQuoted(cp2);
|
|
23450
23586
|
break;
|
|
23451
23587
|
}
|
|
23452
23588
|
case State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED: {
|
|
23453
|
-
this._stateDoctypeSystemIdentifierSingleQuoted(
|
|
23589
|
+
this._stateDoctypeSystemIdentifierSingleQuoted(cp2);
|
|
23454
23590
|
break;
|
|
23455
23591
|
}
|
|
23456
23592
|
case State.AFTER_DOCTYPE_SYSTEM_IDENTIFIER: {
|
|
23457
|
-
this._stateAfterDoctypeSystemIdentifier(
|
|
23593
|
+
this._stateAfterDoctypeSystemIdentifier(cp2);
|
|
23458
23594
|
break;
|
|
23459
23595
|
}
|
|
23460
23596
|
case State.BOGUS_DOCTYPE: {
|
|
23461
|
-
this._stateBogusDoctype(
|
|
23597
|
+
this._stateBogusDoctype(cp2);
|
|
23462
23598
|
break;
|
|
23463
23599
|
}
|
|
23464
23600
|
case State.CDATA_SECTION: {
|
|
23465
|
-
this._stateCdataSection(
|
|
23601
|
+
this._stateCdataSection(cp2);
|
|
23466
23602
|
break;
|
|
23467
23603
|
}
|
|
23468
23604
|
case State.CDATA_SECTION_BRACKET: {
|
|
23469
|
-
this._stateCdataSectionBracket(
|
|
23605
|
+
this._stateCdataSectionBracket(cp2);
|
|
23470
23606
|
break;
|
|
23471
23607
|
}
|
|
23472
23608
|
case State.CDATA_SECTION_END: {
|
|
23473
|
-
this._stateCdataSectionEnd(
|
|
23609
|
+
this._stateCdataSectionEnd(cp2);
|
|
23474
23610
|
break;
|
|
23475
23611
|
}
|
|
23476
23612
|
case State.CHARACTER_REFERENCE: {
|
|
@@ -23478,7 +23614,7 @@ var Tokenizer = class {
|
|
|
23478
23614
|
break;
|
|
23479
23615
|
}
|
|
23480
23616
|
case State.AMBIGUOUS_AMPERSAND: {
|
|
23481
|
-
this._stateAmbiguousAmpersand(
|
|
23617
|
+
this._stateAmbiguousAmpersand(cp2);
|
|
23482
23618
|
break;
|
|
23483
23619
|
}
|
|
23484
23620
|
default: {
|
|
@@ -23489,8 +23625,8 @@ var Tokenizer = class {
|
|
|
23489
23625
|
// State machine
|
|
23490
23626
|
// Data state
|
|
23491
23627
|
//------------------------------------------------------------------
|
|
23492
|
-
_stateData(
|
|
23493
|
-
switch (
|
|
23628
|
+
_stateData(cp2) {
|
|
23629
|
+
switch (cp2) {
|
|
23494
23630
|
case CODE_POINTS.LESS_THAN_SIGN: {
|
|
23495
23631
|
this.state = State.TAG_OPEN;
|
|
23496
23632
|
break;
|
|
@@ -23501,7 +23637,7 @@ var Tokenizer = class {
|
|
|
23501
23637
|
}
|
|
23502
23638
|
case CODE_POINTS.NULL: {
|
|
23503
23639
|
this._err(ERR.unexpectedNullCharacter);
|
|
23504
|
-
this._emitCodePoint(
|
|
23640
|
+
this._emitCodePoint(cp2);
|
|
23505
23641
|
break;
|
|
23506
23642
|
}
|
|
23507
23643
|
case CODE_POINTS.EOF: {
|
|
@@ -23509,14 +23645,14 @@ var Tokenizer = class {
|
|
|
23509
23645
|
break;
|
|
23510
23646
|
}
|
|
23511
23647
|
default: {
|
|
23512
|
-
this._emitCodePoint(
|
|
23648
|
+
this._emitCodePoint(cp2);
|
|
23513
23649
|
}
|
|
23514
23650
|
}
|
|
23515
23651
|
}
|
|
23516
23652
|
// RCDATA state
|
|
23517
23653
|
//------------------------------------------------------------------
|
|
23518
|
-
_stateRcdata(
|
|
23519
|
-
switch (
|
|
23654
|
+
_stateRcdata(cp2) {
|
|
23655
|
+
switch (cp2) {
|
|
23520
23656
|
case CODE_POINTS.AMPERSAND: {
|
|
23521
23657
|
this._startCharacterReference();
|
|
23522
23658
|
break;
|
|
@@ -23535,14 +23671,14 @@ var Tokenizer = class {
|
|
|
23535
23671
|
break;
|
|
23536
23672
|
}
|
|
23537
23673
|
default: {
|
|
23538
|
-
this._emitCodePoint(
|
|
23674
|
+
this._emitCodePoint(cp2);
|
|
23539
23675
|
}
|
|
23540
23676
|
}
|
|
23541
23677
|
}
|
|
23542
23678
|
// RAWTEXT state
|
|
23543
23679
|
//------------------------------------------------------------------
|
|
23544
|
-
_stateRawtext(
|
|
23545
|
-
switch (
|
|
23680
|
+
_stateRawtext(cp2) {
|
|
23681
|
+
switch (cp2) {
|
|
23546
23682
|
case CODE_POINTS.LESS_THAN_SIGN: {
|
|
23547
23683
|
this.state = State.RAWTEXT_LESS_THAN_SIGN;
|
|
23548
23684
|
break;
|
|
@@ -23557,14 +23693,14 @@ var Tokenizer = class {
|
|
|
23557
23693
|
break;
|
|
23558
23694
|
}
|
|
23559
23695
|
default: {
|
|
23560
|
-
this._emitCodePoint(
|
|
23696
|
+
this._emitCodePoint(cp2);
|
|
23561
23697
|
}
|
|
23562
23698
|
}
|
|
23563
23699
|
}
|
|
23564
23700
|
// Script data state
|
|
23565
23701
|
//------------------------------------------------------------------
|
|
23566
|
-
_stateScriptData(
|
|
23567
|
-
switch (
|
|
23702
|
+
_stateScriptData(cp2) {
|
|
23703
|
+
switch (cp2) {
|
|
23568
23704
|
case CODE_POINTS.LESS_THAN_SIGN: {
|
|
23569
23705
|
this.state = State.SCRIPT_DATA_LESS_THAN_SIGN;
|
|
23570
23706
|
break;
|
|
@@ -23579,14 +23715,14 @@ var Tokenizer = class {
|
|
|
23579
23715
|
break;
|
|
23580
23716
|
}
|
|
23581
23717
|
default: {
|
|
23582
|
-
this._emitCodePoint(
|
|
23718
|
+
this._emitCodePoint(cp2);
|
|
23583
23719
|
}
|
|
23584
23720
|
}
|
|
23585
23721
|
}
|
|
23586
23722
|
// PLAINTEXT state
|
|
23587
23723
|
//------------------------------------------------------------------
|
|
23588
|
-
_statePlaintext(
|
|
23589
|
-
switch (
|
|
23724
|
+
_statePlaintext(cp2) {
|
|
23725
|
+
switch (cp2) {
|
|
23590
23726
|
case CODE_POINTS.NULL: {
|
|
23591
23727
|
this._err(ERR.unexpectedNullCharacter);
|
|
23592
23728
|
this._emitChars(REPLACEMENT_CHARACTER);
|
|
@@ -23597,19 +23733,19 @@ var Tokenizer = class {
|
|
|
23597
23733
|
break;
|
|
23598
23734
|
}
|
|
23599
23735
|
default: {
|
|
23600
|
-
this._emitCodePoint(
|
|
23736
|
+
this._emitCodePoint(cp2);
|
|
23601
23737
|
}
|
|
23602
23738
|
}
|
|
23603
23739
|
}
|
|
23604
23740
|
// Tag open state
|
|
23605
23741
|
//------------------------------------------------------------------
|
|
23606
|
-
_stateTagOpen(
|
|
23607
|
-
if (isAsciiLetter(
|
|
23742
|
+
_stateTagOpen(cp2) {
|
|
23743
|
+
if (isAsciiLetter(cp2)) {
|
|
23608
23744
|
this._createStartTagToken();
|
|
23609
23745
|
this.state = State.TAG_NAME;
|
|
23610
|
-
this._stateTagName(
|
|
23746
|
+
this._stateTagName(cp2);
|
|
23611
23747
|
} else
|
|
23612
|
-
switch (
|
|
23748
|
+
switch (cp2) {
|
|
23613
23749
|
case CODE_POINTS.EXCLAMATION_MARK: {
|
|
23614
23750
|
this.state = State.MARKUP_DECLARATION_OPEN;
|
|
23615
23751
|
break;
|
|
@@ -23622,7 +23758,7 @@ var Tokenizer = class {
|
|
|
23622
23758
|
this._err(ERR.unexpectedQuestionMarkInsteadOfTagName);
|
|
23623
23759
|
this._createCommentToken(1);
|
|
23624
23760
|
this.state = State.BOGUS_COMMENT;
|
|
23625
|
-
this._stateBogusComment(
|
|
23761
|
+
this._stateBogusComment(cp2);
|
|
23626
23762
|
break;
|
|
23627
23763
|
}
|
|
23628
23764
|
case CODE_POINTS.EOF: {
|
|
@@ -23635,19 +23771,19 @@ var Tokenizer = class {
|
|
|
23635
23771
|
this._err(ERR.invalidFirstCharacterOfTagName);
|
|
23636
23772
|
this._emitChars("<");
|
|
23637
23773
|
this.state = State.DATA;
|
|
23638
|
-
this._stateData(
|
|
23774
|
+
this._stateData(cp2);
|
|
23639
23775
|
}
|
|
23640
23776
|
}
|
|
23641
23777
|
}
|
|
23642
23778
|
// End tag open state
|
|
23643
23779
|
//------------------------------------------------------------------
|
|
23644
|
-
_stateEndTagOpen(
|
|
23645
|
-
if (isAsciiLetter(
|
|
23780
|
+
_stateEndTagOpen(cp2) {
|
|
23781
|
+
if (isAsciiLetter(cp2)) {
|
|
23646
23782
|
this._createEndTagToken();
|
|
23647
23783
|
this.state = State.TAG_NAME;
|
|
23648
|
-
this._stateTagName(
|
|
23784
|
+
this._stateTagName(cp2);
|
|
23649
23785
|
} else
|
|
23650
|
-
switch (
|
|
23786
|
+
switch (cp2) {
|
|
23651
23787
|
case CODE_POINTS.GREATER_THAN_SIGN: {
|
|
23652
23788
|
this._err(ERR.missingEndTagName);
|
|
23653
23789
|
this.state = State.DATA;
|
|
@@ -23663,15 +23799,15 @@ var Tokenizer = class {
|
|
|
23663
23799
|
this._err(ERR.invalidFirstCharacterOfTagName);
|
|
23664
23800
|
this._createCommentToken(2);
|
|
23665
23801
|
this.state = State.BOGUS_COMMENT;
|
|
23666
|
-
this._stateBogusComment(
|
|
23802
|
+
this._stateBogusComment(cp2);
|
|
23667
23803
|
}
|
|
23668
23804
|
}
|
|
23669
23805
|
}
|
|
23670
23806
|
// Tag name state
|
|
23671
23807
|
//------------------------------------------------------------------
|
|
23672
|
-
_stateTagName(
|
|
23808
|
+
_stateTagName(cp2) {
|
|
23673
23809
|
const token = this.currentToken;
|
|
23674
|
-
switch (
|
|
23810
|
+
switch (cp2) {
|
|
23675
23811
|
case CODE_POINTS.SPACE:
|
|
23676
23812
|
case CODE_POINTS.LINE_FEED:
|
|
23677
23813
|
case CODE_POINTS.TABULATION:
|
|
@@ -23699,31 +23835,31 @@ var Tokenizer = class {
|
|
|
23699
23835
|
break;
|
|
23700
23836
|
}
|
|
23701
23837
|
default: {
|
|
23702
|
-
token.tagName += String.fromCodePoint(isAsciiUpper(
|
|
23838
|
+
token.tagName += String.fromCodePoint(isAsciiUpper(cp2) ? toAsciiLower(cp2) : cp2);
|
|
23703
23839
|
}
|
|
23704
23840
|
}
|
|
23705
23841
|
}
|
|
23706
23842
|
// RCDATA less-than sign state
|
|
23707
23843
|
//------------------------------------------------------------------
|
|
23708
|
-
_stateRcdataLessThanSign(
|
|
23709
|
-
if (
|
|
23844
|
+
_stateRcdataLessThanSign(cp2) {
|
|
23845
|
+
if (cp2 === CODE_POINTS.SOLIDUS) {
|
|
23710
23846
|
this.state = State.RCDATA_END_TAG_OPEN;
|
|
23711
23847
|
} else {
|
|
23712
23848
|
this._emitChars("<");
|
|
23713
23849
|
this.state = State.RCDATA;
|
|
23714
|
-
this._stateRcdata(
|
|
23850
|
+
this._stateRcdata(cp2);
|
|
23715
23851
|
}
|
|
23716
23852
|
}
|
|
23717
23853
|
// RCDATA end tag open state
|
|
23718
23854
|
//------------------------------------------------------------------
|
|
23719
|
-
_stateRcdataEndTagOpen(
|
|
23720
|
-
if (isAsciiLetter(
|
|
23855
|
+
_stateRcdataEndTagOpen(cp2) {
|
|
23856
|
+
if (isAsciiLetter(cp2)) {
|
|
23721
23857
|
this.state = State.RCDATA_END_TAG_NAME;
|
|
23722
|
-
this._stateRcdataEndTagName(
|
|
23858
|
+
this._stateRcdataEndTagName(cp2);
|
|
23723
23859
|
} else {
|
|
23724
23860
|
this._emitChars("</");
|
|
23725
23861
|
this.state = State.RCDATA;
|
|
23726
|
-
this._stateRcdata(
|
|
23862
|
+
this._stateRcdata(cp2);
|
|
23727
23863
|
}
|
|
23728
23864
|
}
|
|
23729
23865
|
handleSpecialEndTag(_cp) {
|
|
@@ -23733,8 +23869,8 @@ var Tokenizer = class {
|
|
|
23733
23869
|
this._createEndTagToken();
|
|
23734
23870
|
const token = this.currentToken;
|
|
23735
23871
|
token.tagName = this.lastStartTagName;
|
|
23736
|
-
const
|
|
23737
|
-
switch (
|
|
23872
|
+
const cp2 = this.preprocessor.peek(this.lastStartTagName.length);
|
|
23873
|
+
switch (cp2) {
|
|
23738
23874
|
case CODE_POINTS.SPACE:
|
|
23739
23875
|
case CODE_POINTS.LINE_FEED:
|
|
23740
23876
|
case CODE_POINTS.TABULATION:
|
|
@@ -23761,49 +23897,49 @@ var Tokenizer = class {
|
|
|
23761
23897
|
}
|
|
23762
23898
|
// RCDATA end tag name state
|
|
23763
23899
|
//------------------------------------------------------------------
|
|
23764
|
-
_stateRcdataEndTagName(
|
|
23765
|
-
if (this.handleSpecialEndTag(
|
|
23900
|
+
_stateRcdataEndTagName(cp2) {
|
|
23901
|
+
if (this.handleSpecialEndTag(cp2)) {
|
|
23766
23902
|
this._emitChars("</");
|
|
23767
23903
|
this.state = State.RCDATA;
|
|
23768
|
-
this._stateRcdata(
|
|
23904
|
+
this._stateRcdata(cp2);
|
|
23769
23905
|
}
|
|
23770
23906
|
}
|
|
23771
23907
|
// RAWTEXT less-than sign state
|
|
23772
23908
|
//------------------------------------------------------------------
|
|
23773
|
-
_stateRawtextLessThanSign(
|
|
23774
|
-
if (
|
|
23909
|
+
_stateRawtextLessThanSign(cp2) {
|
|
23910
|
+
if (cp2 === CODE_POINTS.SOLIDUS) {
|
|
23775
23911
|
this.state = State.RAWTEXT_END_TAG_OPEN;
|
|
23776
23912
|
} else {
|
|
23777
23913
|
this._emitChars("<");
|
|
23778
23914
|
this.state = State.RAWTEXT;
|
|
23779
|
-
this._stateRawtext(
|
|
23915
|
+
this._stateRawtext(cp2);
|
|
23780
23916
|
}
|
|
23781
23917
|
}
|
|
23782
23918
|
// RAWTEXT end tag open state
|
|
23783
23919
|
//------------------------------------------------------------------
|
|
23784
|
-
_stateRawtextEndTagOpen(
|
|
23785
|
-
if (isAsciiLetter(
|
|
23920
|
+
_stateRawtextEndTagOpen(cp2) {
|
|
23921
|
+
if (isAsciiLetter(cp2)) {
|
|
23786
23922
|
this.state = State.RAWTEXT_END_TAG_NAME;
|
|
23787
|
-
this._stateRawtextEndTagName(
|
|
23923
|
+
this._stateRawtextEndTagName(cp2);
|
|
23788
23924
|
} else {
|
|
23789
23925
|
this._emitChars("</");
|
|
23790
23926
|
this.state = State.RAWTEXT;
|
|
23791
|
-
this._stateRawtext(
|
|
23927
|
+
this._stateRawtext(cp2);
|
|
23792
23928
|
}
|
|
23793
23929
|
}
|
|
23794
23930
|
// RAWTEXT end tag name state
|
|
23795
23931
|
//------------------------------------------------------------------
|
|
23796
|
-
_stateRawtextEndTagName(
|
|
23797
|
-
if (this.handleSpecialEndTag(
|
|
23932
|
+
_stateRawtextEndTagName(cp2) {
|
|
23933
|
+
if (this.handleSpecialEndTag(cp2)) {
|
|
23798
23934
|
this._emitChars("</");
|
|
23799
23935
|
this.state = State.RAWTEXT;
|
|
23800
|
-
this._stateRawtext(
|
|
23936
|
+
this._stateRawtext(cp2);
|
|
23801
23937
|
}
|
|
23802
23938
|
}
|
|
23803
23939
|
// Script data less-than sign state
|
|
23804
23940
|
//------------------------------------------------------------------
|
|
23805
|
-
_stateScriptDataLessThanSign(
|
|
23806
|
-
switch (
|
|
23941
|
+
_stateScriptDataLessThanSign(cp2) {
|
|
23942
|
+
switch (cp2) {
|
|
23807
23943
|
case CODE_POINTS.SOLIDUS: {
|
|
23808
23944
|
this.state = State.SCRIPT_DATA_END_TAG_OPEN;
|
|
23809
23945
|
break;
|
|
@@ -23816,57 +23952,57 @@ var Tokenizer = class {
|
|
|
23816
23952
|
default: {
|
|
23817
23953
|
this._emitChars("<");
|
|
23818
23954
|
this.state = State.SCRIPT_DATA;
|
|
23819
|
-
this._stateScriptData(
|
|
23955
|
+
this._stateScriptData(cp2);
|
|
23820
23956
|
}
|
|
23821
23957
|
}
|
|
23822
23958
|
}
|
|
23823
23959
|
// Script data end tag open state
|
|
23824
23960
|
//------------------------------------------------------------------
|
|
23825
|
-
_stateScriptDataEndTagOpen(
|
|
23826
|
-
if (isAsciiLetter(
|
|
23961
|
+
_stateScriptDataEndTagOpen(cp2) {
|
|
23962
|
+
if (isAsciiLetter(cp2)) {
|
|
23827
23963
|
this.state = State.SCRIPT_DATA_END_TAG_NAME;
|
|
23828
|
-
this._stateScriptDataEndTagName(
|
|
23964
|
+
this._stateScriptDataEndTagName(cp2);
|
|
23829
23965
|
} else {
|
|
23830
23966
|
this._emitChars("</");
|
|
23831
23967
|
this.state = State.SCRIPT_DATA;
|
|
23832
|
-
this._stateScriptData(
|
|
23968
|
+
this._stateScriptData(cp2);
|
|
23833
23969
|
}
|
|
23834
23970
|
}
|
|
23835
23971
|
// Script data end tag name state
|
|
23836
23972
|
//------------------------------------------------------------------
|
|
23837
|
-
_stateScriptDataEndTagName(
|
|
23838
|
-
if (this.handleSpecialEndTag(
|
|
23973
|
+
_stateScriptDataEndTagName(cp2) {
|
|
23974
|
+
if (this.handleSpecialEndTag(cp2)) {
|
|
23839
23975
|
this._emitChars("</");
|
|
23840
23976
|
this.state = State.SCRIPT_DATA;
|
|
23841
|
-
this._stateScriptData(
|
|
23977
|
+
this._stateScriptData(cp2);
|
|
23842
23978
|
}
|
|
23843
23979
|
}
|
|
23844
23980
|
// Script data escape start state
|
|
23845
23981
|
//------------------------------------------------------------------
|
|
23846
|
-
_stateScriptDataEscapeStart(
|
|
23847
|
-
if (
|
|
23982
|
+
_stateScriptDataEscapeStart(cp2) {
|
|
23983
|
+
if (cp2 === CODE_POINTS.HYPHEN_MINUS) {
|
|
23848
23984
|
this.state = State.SCRIPT_DATA_ESCAPE_START_DASH;
|
|
23849
23985
|
this._emitChars("-");
|
|
23850
23986
|
} else {
|
|
23851
23987
|
this.state = State.SCRIPT_DATA;
|
|
23852
|
-
this._stateScriptData(
|
|
23988
|
+
this._stateScriptData(cp2);
|
|
23853
23989
|
}
|
|
23854
23990
|
}
|
|
23855
23991
|
// Script data escape start dash state
|
|
23856
23992
|
//------------------------------------------------------------------
|
|
23857
|
-
_stateScriptDataEscapeStartDash(
|
|
23858
|
-
if (
|
|
23993
|
+
_stateScriptDataEscapeStartDash(cp2) {
|
|
23994
|
+
if (cp2 === CODE_POINTS.HYPHEN_MINUS) {
|
|
23859
23995
|
this.state = State.SCRIPT_DATA_ESCAPED_DASH_DASH;
|
|
23860
23996
|
this._emitChars("-");
|
|
23861
23997
|
} else {
|
|
23862
23998
|
this.state = State.SCRIPT_DATA;
|
|
23863
|
-
this._stateScriptData(
|
|
23999
|
+
this._stateScriptData(cp2);
|
|
23864
24000
|
}
|
|
23865
24001
|
}
|
|
23866
24002
|
// Script data escaped state
|
|
23867
24003
|
//------------------------------------------------------------------
|
|
23868
|
-
_stateScriptDataEscaped(
|
|
23869
|
-
switch (
|
|
24004
|
+
_stateScriptDataEscaped(cp2) {
|
|
24005
|
+
switch (cp2) {
|
|
23870
24006
|
case CODE_POINTS.HYPHEN_MINUS: {
|
|
23871
24007
|
this.state = State.SCRIPT_DATA_ESCAPED_DASH;
|
|
23872
24008
|
this._emitChars("-");
|
|
@@ -23887,14 +24023,14 @@ var Tokenizer = class {
|
|
|
23887
24023
|
break;
|
|
23888
24024
|
}
|
|
23889
24025
|
default: {
|
|
23890
|
-
this._emitCodePoint(
|
|
24026
|
+
this._emitCodePoint(cp2);
|
|
23891
24027
|
}
|
|
23892
24028
|
}
|
|
23893
24029
|
}
|
|
23894
24030
|
// Script data escaped dash state
|
|
23895
24031
|
//------------------------------------------------------------------
|
|
23896
|
-
_stateScriptDataEscapedDash(
|
|
23897
|
-
switch (
|
|
24032
|
+
_stateScriptDataEscapedDash(cp2) {
|
|
24033
|
+
switch (cp2) {
|
|
23898
24034
|
case CODE_POINTS.HYPHEN_MINUS: {
|
|
23899
24035
|
this.state = State.SCRIPT_DATA_ESCAPED_DASH_DASH;
|
|
23900
24036
|
this._emitChars("-");
|
|
@@ -23917,14 +24053,14 @@ var Tokenizer = class {
|
|
|
23917
24053
|
}
|
|
23918
24054
|
default: {
|
|
23919
24055
|
this.state = State.SCRIPT_DATA_ESCAPED;
|
|
23920
|
-
this._emitCodePoint(
|
|
24056
|
+
this._emitCodePoint(cp2);
|
|
23921
24057
|
}
|
|
23922
24058
|
}
|
|
23923
24059
|
}
|
|
23924
24060
|
// Script data escaped dash dash state
|
|
23925
24061
|
//------------------------------------------------------------------
|
|
23926
|
-
_stateScriptDataEscapedDashDash(
|
|
23927
|
-
switch (
|
|
24062
|
+
_stateScriptDataEscapedDashDash(cp2) {
|
|
24063
|
+
switch (cp2) {
|
|
23928
24064
|
case CODE_POINTS.HYPHEN_MINUS: {
|
|
23929
24065
|
this._emitChars("-");
|
|
23930
24066
|
break;
|
|
@@ -23951,64 +24087,64 @@ var Tokenizer = class {
|
|
|
23951
24087
|
}
|
|
23952
24088
|
default: {
|
|
23953
24089
|
this.state = State.SCRIPT_DATA_ESCAPED;
|
|
23954
|
-
this._emitCodePoint(
|
|
24090
|
+
this._emitCodePoint(cp2);
|
|
23955
24091
|
}
|
|
23956
24092
|
}
|
|
23957
24093
|
}
|
|
23958
24094
|
// Script data escaped less-than sign state
|
|
23959
24095
|
//------------------------------------------------------------------
|
|
23960
|
-
_stateScriptDataEscapedLessThanSign(
|
|
23961
|
-
if (
|
|
24096
|
+
_stateScriptDataEscapedLessThanSign(cp2) {
|
|
24097
|
+
if (cp2 === CODE_POINTS.SOLIDUS) {
|
|
23962
24098
|
this.state = State.SCRIPT_DATA_ESCAPED_END_TAG_OPEN;
|
|
23963
|
-
} else if (isAsciiLetter(
|
|
24099
|
+
} else if (isAsciiLetter(cp2)) {
|
|
23964
24100
|
this._emitChars("<");
|
|
23965
24101
|
this.state = State.SCRIPT_DATA_DOUBLE_ESCAPE_START;
|
|
23966
|
-
this._stateScriptDataDoubleEscapeStart(
|
|
24102
|
+
this._stateScriptDataDoubleEscapeStart(cp2);
|
|
23967
24103
|
} else {
|
|
23968
24104
|
this._emitChars("<");
|
|
23969
24105
|
this.state = State.SCRIPT_DATA_ESCAPED;
|
|
23970
|
-
this._stateScriptDataEscaped(
|
|
24106
|
+
this._stateScriptDataEscaped(cp2);
|
|
23971
24107
|
}
|
|
23972
24108
|
}
|
|
23973
24109
|
// Script data escaped end tag open state
|
|
23974
24110
|
//------------------------------------------------------------------
|
|
23975
|
-
_stateScriptDataEscapedEndTagOpen(
|
|
23976
|
-
if (isAsciiLetter(
|
|
24111
|
+
_stateScriptDataEscapedEndTagOpen(cp2) {
|
|
24112
|
+
if (isAsciiLetter(cp2)) {
|
|
23977
24113
|
this.state = State.SCRIPT_DATA_ESCAPED_END_TAG_NAME;
|
|
23978
|
-
this._stateScriptDataEscapedEndTagName(
|
|
24114
|
+
this._stateScriptDataEscapedEndTagName(cp2);
|
|
23979
24115
|
} else {
|
|
23980
24116
|
this._emitChars("</");
|
|
23981
24117
|
this.state = State.SCRIPT_DATA_ESCAPED;
|
|
23982
|
-
this._stateScriptDataEscaped(
|
|
24118
|
+
this._stateScriptDataEscaped(cp2);
|
|
23983
24119
|
}
|
|
23984
24120
|
}
|
|
23985
24121
|
// Script data escaped end tag name state
|
|
23986
24122
|
//------------------------------------------------------------------
|
|
23987
|
-
_stateScriptDataEscapedEndTagName(
|
|
23988
|
-
if (this.handleSpecialEndTag(
|
|
24123
|
+
_stateScriptDataEscapedEndTagName(cp2) {
|
|
24124
|
+
if (this.handleSpecialEndTag(cp2)) {
|
|
23989
24125
|
this._emitChars("</");
|
|
23990
24126
|
this.state = State.SCRIPT_DATA_ESCAPED;
|
|
23991
|
-
this._stateScriptDataEscaped(
|
|
24127
|
+
this._stateScriptDataEscaped(cp2);
|
|
23992
24128
|
}
|
|
23993
24129
|
}
|
|
23994
24130
|
// Script data double escape start state
|
|
23995
24131
|
//------------------------------------------------------------------
|
|
23996
|
-
_stateScriptDataDoubleEscapeStart(
|
|
24132
|
+
_stateScriptDataDoubleEscapeStart(cp2) {
|
|
23997
24133
|
if (this.preprocessor.startsWith(SEQUENCES.SCRIPT, false) && isScriptDataDoubleEscapeSequenceEnd(this.preprocessor.peek(SEQUENCES.SCRIPT.length))) {
|
|
23998
|
-
this._emitCodePoint(
|
|
24134
|
+
this._emitCodePoint(cp2);
|
|
23999
24135
|
for (let i = 0; i < SEQUENCES.SCRIPT.length; i++) {
|
|
24000
24136
|
this._emitCodePoint(this._consume());
|
|
24001
24137
|
}
|
|
24002
24138
|
this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;
|
|
24003
24139
|
} else if (!this._ensureHibernation()) {
|
|
24004
24140
|
this.state = State.SCRIPT_DATA_ESCAPED;
|
|
24005
|
-
this._stateScriptDataEscaped(
|
|
24141
|
+
this._stateScriptDataEscaped(cp2);
|
|
24006
24142
|
}
|
|
24007
24143
|
}
|
|
24008
24144
|
// Script data double escaped state
|
|
24009
24145
|
//------------------------------------------------------------------
|
|
24010
|
-
_stateScriptDataDoubleEscaped(
|
|
24011
|
-
switch (
|
|
24146
|
+
_stateScriptDataDoubleEscaped(cp2) {
|
|
24147
|
+
switch (cp2) {
|
|
24012
24148
|
case CODE_POINTS.HYPHEN_MINUS: {
|
|
24013
24149
|
this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH;
|
|
24014
24150
|
this._emitChars("-");
|
|
@@ -24030,14 +24166,14 @@ var Tokenizer = class {
|
|
|
24030
24166
|
break;
|
|
24031
24167
|
}
|
|
24032
24168
|
default: {
|
|
24033
|
-
this._emitCodePoint(
|
|
24169
|
+
this._emitCodePoint(cp2);
|
|
24034
24170
|
}
|
|
24035
24171
|
}
|
|
24036
24172
|
}
|
|
24037
24173
|
// Script data double escaped dash state
|
|
24038
24174
|
//------------------------------------------------------------------
|
|
24039
|
-
_stateScriptDataDoubleEscapedDash(
|
|
24040
|
-
switch (
|
|
24175
|
+
_stateScriptDataDoubleEscapedDash(cp2) {
|
|
24176
|
+
switch (cp2) {
|
|
24041
24177
|
case CODE_POINTS.HYPHEN_MINUS: {
|
|
24042
24178
|
this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH;
|
|
24043
24179
|
this._emitChars("-");
|
|
@@ -24061,14 +24197,14 @@ var Tokenizer = class {
|
|
|
24061
24197
|
}
|
|
24062
24198
|
default: {
|
|
24063
24199
|
this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;
|
|
24064
|
-
this._emitCodePoint(
|
|
24200
|
+
this._emitCodePoint(cp2);
|
|
24065
24201
|
}
|
|
24066
24202
|
}
|
|
24067
24203
|
}
|
|
24068
24204
|
// Script data double escaped dash dash state
|
|
24069
24205
|
//------------------------------------------------------------------
|
|
24070
|
-
_stateScriptDataDoubleEscapedDashDash(
|
|
24071
|
-
switch (
|
|
24206
|
+
_stateScriptDataDoubleEscapedDashDash(cp2) {
|
|
24207
|
+
switch (cp2) {
|
|
24072
24208
|
case CODE_POINTS.HYPHEN_MINUS: {
|
|
24073
24209
|
this._emitChars("-");
|
|
24074
24210
|
break;
|
|
@@ -24096,39 +24232,39 @@ var Tokenizer = class {
|
|
|
24096
24232
|
}
|
|
24097
24233
|
default: {
|
|
24098
24234
|
this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;
|
|
24099
|
-
this._emitCodePoint(
|
|
24235
|
+
this._emitCodePoint(cp2);
|
|
24100
24236
|
}
|
|
24101
24237
|
}
|
|
24102
24238
|
}
|
|
24103
24239
|
// Script data double escaped less-than sign state
|
|
24104
24240
|
//------------------------------------------------------------------
|
|
24105
|
-
_stateScriptDataDoubleEscapedLessThanSign(
|
|
24106
|
-
if (
|
|
24241
|
+
_stateScriptDataDoubleEscapedLessThanSign(cp2) {
|
|
24242
|
+
if (cp2 === CODE_POINTS.SOLIDUS) {
|
|
24107
24243
|
this.state = State.SCRIPT_DATA_DOUBLE_ESCAPE_END;
|
|
24108
24244
|
this._emitChars("/");
|
|
24109
24245
|
} else {
|
|
24110
24246
|
this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;
|
|
24111
|
-
this._stateScriptDataDoubleEscaped(
|
|
24247
|
+
this._stateScriptDataDoubleEscaped(cp2);
|
|
24112
24248
|
}
|
|
24113
24249
|
}
|
|
24114
24250
|
// Script data double escape end state
|
|
24115
24251
|
//------------------------------------------------------------------
|
|
24116
|
-
_stateScriptDataDoubleEscapeEnd(
|
|
24252
|
+
_stateScriptDataDoubleEscapeEnd(cp2) {
|
|
24117
24253
|
if (this.preprocessor.startsWith(SEQUENCES.SCRIPT, false) && isScriptDataDoubleEscapeSequenceEnd(this.preprocessor.peek(SEQUENCES.SCRIPT.length))) {
|
|
24118
|
-
this._emitCodePoint(
|
|
24254
|
+
this._emitCodePoint(cp2);
|
|
24119
24255
|
for (let i = 0; i < SEQUENCES.SCRIPT.length; i++) {
|
|
24120
24256
|
this._emitCodePoint(this._consume());
|
|
24121
24257
|
}
|
|
24122
24258
|
this.state = State.SCRIPT_DATA_ESCAPED;
|
|
24123
24259
|
} else if (!this._ensureHibernation()) {
|
|
24124
24260
|
this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;
|
|
24125
|
-
this._stateScriptDataDoubleEscaped(
|
|
24261
|
+
this._stateScriptDataDoubleEscaped(cp2);
|
|
24126
24262
|
}
|
|
24127
24263
|
}
|
|
24128
24264
|
// Before attribute name state
|
|
24129
24265
|
//------------------------------------------------------------------
|
|
24130
|
-
_stateBeforeAttributeName(
|
|
24131
|
-
switch (
|
|
24266
|
+
_stateBeforeAttributeName(cp2) {
|
|
24267
|
+
switch (cp2) {
|
|
24132
24268
|
case CODE_POINTS.SPACE:
|
|
24133
24269
|
case CODE_POINTS.LINE_FEED:
|
|
24134
24270
|
case CODE_POINTS.TABULATION:
|
|
@@ -24139,7 +24275,7 @@ var Tokenizer = class {
|
|
|
24139
24275
|
case CODE_POINTS.GREATER_THAN_SIGN:
|
|
24140
24276
|
case CODE_POINTS.EOF: {
|
|
24141
24277
|
this.state = State.AFTER_ATTRIBUTE_NAME;
|
|
24142
|
-
this._stateAfterAttributeName(
|
|
24278
|
+
this._stateAfterAttributeName(cp2);
|
|
24143
24279
|
break;
|
|
24144
24280
|
}
|
|
24145
24281
|
case CODE_POINTS.EQUALS_SIGN: {
|
|
@@ -24151,14 +24287,14 @@ var Tokenizer = class {
|
|
|
24151
24287
|
default: {
|
|
24152
24288
|
this._createAttr("");
|
|
24153
24289
|
this.state = State.ATTRIBUTE_NAME;
|
|
24154
|
-
this._stateAttributeName(
|
|
24290
|
+
this._stateAttributeName(cp2);
|
|
24155
24291
|
}
|
|
24156
24292
|
}
|
|
24157
24293
|
}
|
|
24158
24294
|
// Attribute name state
|
|
24159
24295
|
//------------------------------------------------------------------
|
|
24160
|
-
_stateAttributeName(
|
|
24161
|
-
switch (
|
|
24296
|
+
_stateAttributeName(cp2) {
|
|
24297
|
+
switch (cp2) {
|
|
24162
24298
|
case CODE_POINTS.SPACE:
|
|
24163
24299
|
case CODE_POINTS.LINE_FEED:
|
|
24164
24300
|
case CODE_POINTS.TABULATION:
|
|
@@ -24168,7 +24304,7 @@ var Tokenizer = class {
|
|
|
24168
24304
|
case CODE_POINTS.EOF: {
|
|
24169
24305
|
this._leaveAttrName();
|
|
24170
24306
|
this.state = State.AFTER_ATTRIBUTE_NAME;
|
|
24171
|
-
this._stateAfterAttributeName(
|
|
24307
|
+
this._stateAfterAttributeName(cp2);
|
|
24172
24308
|
break;
|
|
24173
24309
|
}
|
|
24174
24310
|
case CODE_POINTS.EQUALS_SIGN: {
|
|
@@ -24180,7 +24316,7 @@ var Tokenizer = class {
|
|
|
24180
24316
|
case CODE_POINTS.APOSTROPHE:
|
|
24181
24317
|
case CODE_POINTS.LESS_THAN_SIGN: {
|
|
24182
24318
|
this._err(ERR.unexpectedCharacterInAttributeName);
|
|
24183
|
-
this.currentAttr.name += String.fromCodePoint(
|
|
24319
|
+
this.currentAttr.name += String.fromCodePoint(cp2);
|
|
24184
24320
|
break;
|
|
24185
24321
|
}
|
|
24186
24322
|
case CODE_POINTS.NULL: {
|
|
@@ -24189,14 +24325,14 @@ var Tokenizer = class {
|
|
|
24189
24325
|
break;
|
|
24190
24326
|
}
|
|
24191
24327
|
default: {
|
|
24192
|
-
this.currentAttr.name += String.fromCodePoint(isAsciiUpper(
|
|
24328
|
+
this.currentAttr.name += String.fromCodePoint(isAsciiUpper(cp2) ? toAsciiLower(cp2) : cp2);
|
|
24193
24329
|
}
|
|
24194
24330
|
}
|
|
24195
24331
|
}
|
|
24196
24332
|
// After attribute name state
|
|
24197
24333
|
//------------------------------------------------------------------
|
|
24198
|
-
_stateAfterAttributeName(
|
|
24199
|
-
switch (
|
|
24334
|
+
_stateAfterAttributeName(cp2) {
|
|
24335
|
+
switch (cp2) {
|
|
24200
24336
|
case CODE_POINTS.SPACE:
|
|
24201
24337
|
case CODE_POINTS.LINE_FEED:
|
|
24202
24338
|
case CODE_POINTS.TABULATION:
|
|
@@ -24224,14 +24360,14 @@ var Tokenizer = class {
|
|
|
24224
24360
|
default: {
|
|
24225
24361
|
this._createAttr("");
|
|
24226
24362
|
this.state = State.ATTRIBUTE_NAME;
|
|
24227
|
-
this._stateAttributeName(
|
|
24363
|
+
this._stateAttributeName(cp2);
|
|
24228
24364
|
}
|
|
24229
24365
|
}
|
|
24230
24366
|
}
|
|
24231
24367
|
// Before attribute value state
|
|
24232
24368
|
//------------------------------------------------------------------
|
|
24233
|
-
_stateBeforeAttributeValue(
|
|
24234
|
-
switch (
|
|
24369
|
+
_stateBeforeAttributeValue(cp2) {
|
|
24370
|
+
switch (cp2) {
|
|
24235
24371
|
case CODE_POINTS.SPACE:
|
|
24236
24372
|
case CODE_POINTS.LINE_FEED:
|
|
24237
24373
|
case CODE_POINTS.TABULATION:
|
|
@@ -24254,14 +24390,14 @@ var Tokenizer = class {
|
|
|
24254
24390
|
}
|
|
24255
24391
|
default: {
|
|
24256
24392
|
this.state = State.ATTRIBUTE_VALUE_UNQUOTED;
|
|
24257
|
-
this._stateAttributeValueUnquoted(
|
|
24393
|
+
this._stateAttributeValueUnquoted(cp2);
|
|
24258
24394
|
}
|
|
24259
24395
|
}
|
|
24260
24396
|
}
|
|
24261
24397
|
// Attribute value (double-quoted) state
|
|
24262
24398
|
//------------------------------------------------------------------
|
|
24263
|
-
_stateAttributeValueDoubleQuoted(
|
|
24264
|
-
switch (
|
|
24399
|
+
_stateAttributeValueDoubleQuoted(cp2) {
|
|
24400
|
+
switch (cp2) {
|
|
24265
24401
|
case CODE_POINTS.QUOTATION_MARK: {
|
|
24266
24402
|
this.state = State.AFTER_ATTRIBUTE_VALUE_QUOTED;
|
|
24267
24403
|
break;
|
|
@@ -24281,14 +24417,14 @@ var Tokenizer = class {
|
|
|
24281
24417
|
break;
|
|
24282
24418
|
}
|
|
24283
24419
|
default: {
|
|
24284
|
-
this.currentAttr.value += String.fromCodePoint(
|
|
24420
|
+
this.currentAttr.value += String.fromCodePoint(cp2);
|
|
24285
24421
|
}
|
|
24286
24422
|
}
|
|
24287
24423
|
}
|
|
24288
24424
|
// Attribute value (single-quoted) state
|
|
24289
24425
|
//------------------------------------------------------------------
|
|
24290
|
-
_stateAttributeValueSingleQuoted(
|
|
24291
|
-
switch (
|
|
24426
|
+
_stateAttributeValueSingleQuoted(cp2) {
|
|
24427
|
+
switch (cp2) {
|
|
24292
24428
|
case CODE_POINTS.APOSTROPHE: {
|
|
24293
24429
|
this.state = State.AFTER_ATTRIBUTE_VALUE_QUOTED;
|
|
24294
24430
|
break;
|
|
@@ -24308,14 +24444,14 @@ var Tokenizer = class {
|
|
|
24308
24444
|
break;
|
|
24309
24445
|
}
|
|
24310
24446
|
default: {
|
|
24311
|
-
this.currentAttr.value += String.fromCodePoint(
|
|
24447
|
+
this.currentAttr.value += String.fromCodePoint(cp2);
|
|
24312
24448
|
}
|
|
24313
24449
|
}
|
|
24314
24450
|
}
|
|
24315
24451
|
// Attribute value (unquoted) state
|
|
24316
24452
|
//------------------------------------------------------------------
|
|
24317
|
-
_stateAttributeValueUnquoted(
|
|
24318
|
-
switch (
|
|
24453
|
+
_stateAttributeValueUnquoted(cp2) {
|
|
24454
|
+
switch (cp2) {
|
|
24319
24455
|
case CODE_POINTS.SPACE:
|
|
24320
24456
|
case CODE_POINTS.LINE_FEED:
|
|
24321
24457
|
case CODE_POINTS.TABULATION:
|
|
@@ -24345,7 +24481,7 @@ var Tokenizer = class {
|
|
|
24345
24481
|
case CODE_POINTS.EQUALS_SIGN:
|
|
24346
24482
|
case CODE_POINTS.GRAVE_ACCENT: {
|
|
24347
24483
|
this._err(ERR.unexpectedCharacterInUnquotedAttributeValue);
|
|
24348
|
-
this.currentAttr.value += String.fromCodePoint(
|
|
24484
|
+
this.currentAttr.value += String.fromCodePoint(cp2);
|
|
24349
24485
|
break;
|
|
24350
24486
|
}
|
|
24351
24487
|
case CODE_POINTS.EOF: {
|
|
@@ -24354,14 +24490,14 @@ var Tokenizer = class {
|
|
|
24354
24490
|
break;
|
|
24355
24491
|
}
|
|
24356
24492
|
default: {
|
|
24357
|
-
this.currentAttr.value += String.fromCodePoint(
|
|
24493
|
+
this.currentAttr.value += String.fromCodePoint(cp2);
|
|
24358
24494
|
}
|
|
24359
24495
|
}
|
|
24360
24496
|
}
|
|
24361
24497
|
// After attribute value (quoted) state
|
|
24362
24498
|
//------------------------------------------------------------------
|
|
24363
|
-
_stateAfterAttributeValueQuoted(
|
|
24364
|
-
switch (
|
|
24499
|
+
_stateAfterAttributeValueQuoted(cp2) {
|
|
24500
|
+
switch (cp2) {
|
|
24365
24501
|
case CODE_POINTS.SPACE:
|
|
24366
24502
|
case CODE_POINTS.LINE_FEED:
|
|
24367
24503
|
case CODE_POINTS.TABULATION:
|
|
@@ -24389,14 +24525,14 @@ var Tokenizer = class {
|
|
|
24389
24525
|
default: {
|
|
24390
24526
|
this._err(ERR.missingWhitespaceBetweenAttributes);
|
|
24391
24527
|
this.state = State.BEFORE_ATTRIBUTE_NAME;
|
|
24392
|
-
this._stateBeforeAttributeName(
|
|
24528
|
+
this._stateBeforeAttributeName(cp2);
|
|
24393
24529
|
}
|
|
24394
24530
|
}
|
|
24395
24531
|
}
|
|
24396
24532
|
// Self-closing start tag state
|
|
24397
24533
|
//------------------------------------------------------------------
|
|
24398
|
-
_stateSelfClosingStartTag(
|
|
24399
|
-
switch (
|
|
24534
|
+
_stateSelfClosingStartTag(cp2) {
|
|
24535
|
+
switch (cp2) {
|
|
24400
24536
|
case CODE_POINTS.GREATER_THAN_SIGN: {
|
|
24401
24537
|
const token = this.currentToken;
|
|
24402
24538
|
token.selfClosing = true;
|
|
@@ -24412,15 +24548,15 @@ var Tokenizer = class {
|
|
|
24412
24548
|
default: {
|
|
24413
24549
|
this._err(ERR.unexpectedSolidusInTag);
|
|
24414
24550
|
this.state = State.BEFORE_ATTRIBUTE_NAME;
|
|
24415
|
-
this._stateBeforeAttributeName(
|
|
24551
|
+
this._stateBeforeAttributeName(cp2);
|
|
24416
24552
|
}
|
|
24417
24553
|
}
|
|
24418
24554
|
}
|
|
24419
24555
|
// Bogus comment state
|
|
24420
24556
|
//------------------------------------------------------------------
|
|
24421
|
-
_stateBogusComment(
|
|
24557
|
+
_stateBogusComment(cp2) {
|
|
24422
24558
|
const token = this.currentToken;
|
|
24423
|
-
switch (
|
|
24559
|
+
switch (cp2) {
|
|
24424
24560
|
case CODE_POINTS.GREATER_THAN_SIGN: {
|
|
24425
24561
|
this.state = State.DATA;
|
|
24426
24562
|
this.emitCurrentComment(token);
|
|
@@ -24437,13 +24573,13 @@ var Tokenizer = class {
|
|
|
24437
24573
|
break;
|
|
24438
24574
|
}
|
|
24439
24575
|
default: {
|
|
24440
|
-
token.data += String.fromCodePoint(
|
|
24576
|
+
token.data += String.fromCodePoint(cp2);
|
|
24441
24577
|
}
|
|
24442
24578
|
}
|
|
24443
24579
|
}
|
|
24444
24580
|
// Markup declaration open state
|
|
24445
24581
|
//------------------------------------------------------------------
|
|
24446
|
-
_stateMarkupDeclarationOpen(
|
|
24582
|
+
_stateMarkupDeclarationOpen(cp2) {
|
|
24447
24583
|
if (this._consumeSequenceIfMatch(SEQUENCES.DASH_DASH, true)) {
|
|
24448
24584
|
this._createCommentToken(SEQUENCES.DASH_DASH.length + 1);
|
|
24449
24585
|
this.state = State.COMMENT_START;
|
|
@@ -24463,13 +24599,13 @@ var Tokenizer = class {
|
|
|
24463
24599
|
this._err(ERR.incorrectlyOpenedComment);
|
|
24464
24600
|
this._createCommentToken(2);
|
|
24465
24601
|
this.state = State.BOGUS_COMMENT;
|
|
24466
|
-
this._stateBogusComment(
|
|
24602
|
+
this._stateBogusComment(cp2);
|
|
24467
24603
|
}
|
|
24468
24604
|
}
|
|
24469
24605
|
// Comment start state
|
|
24470
24606
|
//------------------------------------------------------------------
|
|
24471
|
-
_stateCommentStart(
|
|
24472
|
-
switch (
|
|
24607
|
+
_stateCommentStart(cp2) {
|
|
24608
|
+
switch (cp2) {
|
|
24473
24609
|
case CODE_POINTS.HYPHEN_MINUS: {
|
|
24474
24610
|
this.state = State.COMMENT_START_DASH;
|
|
24475
24611
|
break;
|
|
@@ -24483,15 +24619,15 @@ var Tokenizer = class {
|
|
|
24483
24619
|
}
|
|
24484
24620
|
default: {
|
|
24485
24621
|
this.state = State.COMMENT;
|
|
24486
|
-
this._stateComment(
|
|
24622
|
+
this._stateComment(cp2);
|
|
24487
24623
|
}
|
|
24488
24624
|
}
|
|
24489
24625
|
}
|
|
24490
24626
|
// Comment start dash state
|
|
24491
24627
|
//------------------------------------------------------------------
|
|
24492
|
-
_stateCommentStartDash(
|
|
24628
|
+
_stateCommentStartDash(cp2) {
|
|
24493
24629
|
const token = this.currentToken;
|
|
24494
|
-
switch (
|
|
24630
|
+
switch (cp2) {
|
|
24495
24631
|
case CODE_POINTS.HYPHEN_MINUS: {
|
|
24496
24632
|
this.state = State.COMMENT_END;
|
|
24497
24633
|
break;
|
|
@@ -24511,15 +24647,15 @@ var Tokenizer = class {
|
|
|
24511
24647
|
default: {
|
|
24512
24648
|
token.data += "-";
|
|
24513
24649
|
this.state = State.COMMENT;
|
|
24514
|
-
this._stateComment(
|
|
24650
|
+
this._stateComment(cp2);
|
|
24515
24651
|
}
|
|
24516
24652
|
}
|
|
24517
24653
|
}
|
|
24518
24654
|
// Comment state
|
|
24519
24655
|
//------------------------------------------------------------------
|
|
24520
|
-
_stateComment(
|
|
24656
|
+
_stateComment(cp2) {
|
|
24521
24657
|
const token = this.currentToken;
|
|
24522
|
-
switch (
|
|
24658
|
+
switch (cp2) {
|
|
24523
24659
|
case CODE_POINTS.HYPHEN_MINUS: {
|
|
24524
24660
|
this.state = State.COMMENT_END_DASH;
|
|
24525
24661
|
break;
|
|
@@ -24541,15 +24677,15 @@ var Tokenizer = class {
|
|
|
24541
24677
|
break;
|
|
24542
24678
|
}
|
|
24543
24679
|
default: {
|
|
24544
|
-
token.data += String.fromCodePoint(
|
|
24680
|
+
token.data += String.fromCodePoint(cp2);
|
|
24545
24681
|
}
|
|
24546
24682
|
}
|
|
24547
24683
|
}
|
|
24548
24684
|
// Comment less-than sign state
|
|
24549
24685
|
//------------------------------------------------------------------
|
|
24550
|
-
_stateCommentLessThanSign(
|
|
24686
|
+
_stateCommentLessThanSign(cp2) {
|
|
24551
24687
|
const token = this.currentToken;
|
|
24552
|
-
switch (
|
|
24688
|
+
switch (cp2) {
|
|
24553
24689
|
case CODE_POINTS.EXCLAMATION_MARK: {
|
|
24554
24690
|
token.data += "!";
|
|
24555
24691
|
this.state = State.COMMENT_LESS_THAN_SIGN_BANG;
|
|
@@ -24561,44 +24697,44 @@ var Tokenizer = class {
|
|
|
24561
24697
|
}
|
|
24562
24698
|
default: {
|
|
24563
24699
|
this.state = State.COMMENT;
|
|
24564
|
-
this._stateComment(
|
|
24700
|
+
this._stateComment(cp2);
|
|
24565
24701
|
}
|
|
24566
24702
|
}
|
|
24567
24703
|
}
|
|
24568
24704
|
// Comment less-than sign bang state
|
|
24569
24705
|
//------------------------------------------------------------------
|
|
24570
|
-
_stateCommentLessThanSignBang(
|
|
24571
|
-
if (
|
|
24706
|
+
_stateCommentLessThanSignBang(cp2) {
|
|
24707
|
+
if (cp2 === CODE_POINTS.HYPHEN_MINUS) {
|
|
24572
24708
|
this.state = State.COMMENT_LESS_THAN_SIGN_BANG_DASH;
|
|
24573
24709
|
} else {
|
|
24574
24710
|
this.state = State.COMMENT;
|
|
24575
|
-
this._stateComment(
|
|
24711
|
+
this._stateComment(cp2);
|
|
24576
24712
|
}
|
|
24577
24713
|
}
|
|
24578
24714
|
// Comment less-than sign bang dash state
|
|
24579
24715
|
//------------------------------------------------------------------
|
|
24580
|
-
_stateCommentLessThanSignBangDash(
|
|
24581
|
-
if (
|
|
24716
|
+
_stateCommentLessThanSignBangDash(cp2) {
|
|
24717
|
+
if (cp2 === CODE_POINTS.HYPHEN_MINUS) {
|
|
24582
24718
|
this.state = State.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH;
|
|
24583
24719
|
} else {
|
|
24584
24720
|
this.state = State.COMMENT_END_DASH;
|
|
24585
|
-
this._stateCommentEndDash(
|
|
24721
|
+
this._stateCommentEndDash(cp2);
|
|
24586
24722
|
}
|
|
24587
24723
|
}
|
|
24588
24724
|
// Comment less-than sign bang dash dash state
|
|
24589
24725
|
//------------------------------------------------------------------
|
|
24590
|
-
_stateCommentLessThanSignBangDashDash(
|
|
24591
|
-
if (
|
|
24726
|
+
_stateCommentLessThanSignBangDashDash(cp2) {
|
|
24727
|
+
if (cp2 !== CODE_POINTS.GREATER_THAN_SIGN && cp2 !== CODE_POINTS.EOF) {
|
|
24592
24728
|
this._err(ERR.nestedComment);
|
|
24593
24729
|
}
|
|
24594
24730
|
this.state = State.COMMENT_END;
|
|
24595
|
-
this._stateCommentEnd(
|
|
24731
|
+
this._stateCommentEnd(cp2);
|
|
24596
24732
|
}
|
|
24597
24733
|
// Comment end dash state
|
|
24598
24734
|
//------------------------------------------------------------------
|
|
24599
|
-
_stateCommentEndDash(
|
|
24735
|
+
_stateCommentEndDash(cp2) {
|
|
24600
24736
|
const token = this.currentToken;
|
|
24601
|
-
switch (
|
|
24737
|
+
switch (cp2) {
|
|
24602
24738
|
case CODE_POINTS.HYPHEN_MINUS: {
|
|
24603
24739
|
this.state = State.COMMENT_END;
|
|
24604
24740
|
break;
|
|
@@ -24612,15 +24748,15 @@ var Tokenizer = class {
|
|
|
24612
24748
|
default: {
|
|
24613
24749
|
token.data += "-";
|
|
24614
24750
|
this.state = State.COMMENT;
|
|
24615
|
-
this._stateComment(
|
|
24751
|
+
this._stateComment(cp2);
|
|
24616
24752
|
}
|
|
24617
24753
|
}
|
|
24618
24754
|
}
|
|
24619
24755
|
// Comment end state
|
|
24620
24756
|
//------------------------------------------------------------------
|
|
24621
|
-
_stateCommentEnd(
|
|
24757
|
+
_stateCommentEnd(cp2) {
|
|
24622
24758
|
const token = this.currentToken;
|
|
24623
|
-
switch (
|
|
24759
|
+
switch (cp2) {
|
|
24624
24760
|
case CODE_POINTS.GREATER_THAN_SIGN: {
|
|
24625
24761
|
this.state = State.DATA;
|
|
24626
24762
|
this.emitCurrentComment(token);
|
|
@@ -24643,15 +24779,15 @@ var Tokenizer = class {
|
|
|
24643
24779
|
default: {
|
|
24644
24780
|
token.data += "--";
|
|
24645
24781
|
this.state = State.COMMENT;
|
|
24646
|
-
this._stateComment(
|
|
24782
|
+
this._stateComment(cp2);
|
|
24647
24783
|
}
|
|
24648
24784
|
}
|
|
24649
24785
|
}
|
|
24650
24786
|
// Comment end bang state
|
|
24651
24787
|
//------------------------------------------------------------------
|
|
24652
|
-
_stateCommentEndBang(
|
|
24788
|
+
_stateCommentEndBang(cp2) {
|
|
24653
24789
|
const token = this.currentToken;
|
|
24654
|
-
switch (
|
|
24790
|
+
switch (cp2) {
|
|
24655
24791
|
case CODE_POINTS.HYPHEN_MINUS: {
|
|
24656
24792
|
token.data += "--!";
|
|
24657
24793
|
this.state = State.COMMENT_END_DASH;
|
|
@@ -24672,14 +24808,14 @@ var Tokenizer = class {
|
|
|
24672
24808
|
default: {
|
|
24673
24809
|
token.data += "--!";
|
|
24674
24810
|
this.state = State.COMMENT;
|
|
24675
|
-
this._stateComment(
|
|
24811
|
+
this._stateComment(cp2);
|
|
24676
24812
|
}
|
|
24677
24813
|
}
|
|
24678
24814
|
}
|
|
24679
24815
|
// DOCTYPE state
|
|
24680
24816
|
//------------------------------------------------------------------
|
|
24681
|
-
_stateDoctype(
|
|
24682
|
-
switch (
|
|
24817
|
+
_stateDoctype(cp2) {
|
|
24818
|
+
switch (cp2) {
|
|
24683
24819
|
case CODE_POINTS.SPACE:
|
|
24684
24820
|
case CODE_POINTS.LINE_FEED:
|
|
24685
24821
|
case CODE_POINTS.TABULATION:
|
|
@@ -24689,7 +24825,7 @@ var Tokenizer = class {
|
|
|
24689
24825
|
}
|
|
24690
24826
|
case CODE_POINTS.GREATER_THAN_SIGN: {
|
|
24691
24827
|
this.state = State.BEFORE_DOCTYPE_NAME;
|
|
24692
|
-
this._stateBeforeDoctypeName(
|
|
24828
|
+
this._stateBeforeDoctypeName(cp2);
|
|
24693
24829
|
break;
|
|
24694
24830
|
}
|
|
24695
24831
|
case CODE_POINTS.EOF: {
|
|
@@ -24704,18 +24840,18 @@ var Tokenizer = class {
|
|
|
24704
24840
|
default: {
|
|
24705
24841
|
this._err(ERR.missingWhitespaceBeforeDoctypeName);
|
|
24706
24842
|
this.state = State.BEFORE_DOCTYPE_NAME;
|
|
24707
|
-
this._stateBeforeDoctypeName(
|
|
24843
|
+
this._stateBeforeDoctypeName(cp2);
|
|
24708
24844
|
}
|
|
24709
24845
|
}
|
|
24710
24846
|
}
|
|
24711
24847
|
// Before DOCTYPE name state
|
|
24712
24848
|
//------------------------------------------------------------------
|
|
24713
|
-
_stateBeforeDoctypeName(
|
|
24714
|
-
if (isAsciiUpper(
|
|
24715
|
-
this._createDoctypeToken(String.fromCharCode(toAsciiLower(
|
|
24849
|
+
_stateBeforeDoctypeName(cp2) {
|
|
24850
|
+
if (isAsciiUpper(cp2)) {
|
|
24851
|
+
this._createDoctypeToken(String.fromCharCode(toAsciiLower(cp2)));
|
|
24716
24852
|
this.state = State.DOCTYPE_NAME;
|
|
24717
24853
|
} else
|
|
24718
|
-
switch (
|
|
24854
|
+
switch (cp2) {
|
|
24719
24855
|
case CODE_POINTS.SPACE:
|
|
24720
24856
|
case CODE_POINTS.LINE_FEED:
|
|
24721
24857
|
case CODE_POINTS.TABULATION:
|
|
@@ -24747,16 +24883,16 @@ var Tokenizer = class {
|
|
|
24747
24883
|
break;
|
|
24748
24884
|
}
|
|
24749
24885
|
default: {
|
|
24750
|
-
this._createDoctypeToken(String.fromCodePoint(
|
|
24886
|
+
this._createDoctypeToken(String.fromCodePoint(cp2));
|
|
24751
24887
|
this.state = State.DOCTYPE_NAME;
|
|
24752
24888
|
}
|
|
24753
24889
|
}
|
|
24754
24890
|
}
|
|
24755
24891
|
// DOCTYPE name state
|
|
24756
24892
|
//------------------------------------------------------------------
|
|
24757
|
-
_stateDoctypeName(
|
|
24893
|
+
_stateDoctypeName(cp2) {
|
|
24758
24894
|
const token = this.currentToken;
|
|
24759
|
-
switch (
|
|
24895
|
+
switch (cp2) {
|
|
24760
24896
|
case CODE_POINTS.SPACE:
|
|
24761
24897
|
case CODE_POINTS.LINE_FEED:
|
|
24762
24898
|
case CODE_POINTS.TABULATION:
|
|
@@ -24782,15 +24918,15 @@ var Tokenizer = class {
|
|
|
24782
24918
|
break;
|
|
24783
24919
|
}
|
|
24784
24920
|
default: {
|
|
24785
|
-
token.name += String.fromCodePoint(isAsciiUpper(
|
|
24921
|
+
token.name += String.fromCodePoint(isAsciiUpper(cp2) ? toAsciiLower(cp2) : cp2);
|
|
24786
24922
|
}
|
|
24787
24923
|
}
|
|
24788
24924
|
}
|
|
24789
24925
|
// After DOCTYPE name state
|
|
24790
24926
|
//------------------------------------------------------------------
|
|
24791
|
-
_stateAfterDoctypeName(
|
|
24927
|
+
_stateAfterDoctypeName(cp2) {
|
|
24792
24928
|
const token = this.currentToken;
|
|
24793
|
-
switch (
|
|
24929
|
+
switch (cp2) {
|
|
24794
24930
|
case CODE_POINTS.SPACE:
|
|
24795
24931
|
case CODE_POINTS.LINE_FEED:
|
|
24796
24932
|
case CODE_POINTS.TABULATION:
|
|
@@ -24818,16 +24954,16 @@ var Tokenizer = class {
|
|
|
24818
24954
|
this._err(ERR.invalidCharacterSequenceAfterDoctypeName);
|
|
24819
24955
|
token.forceQuirks = true;
|
|
24820
24956
|
this.state = State.BOGUS_DOCTYPE;
|
|
24821
|
-
this._stateBogusDoctype(
|
|
24957
|
+
this._stateBogusDoctype(cp2);
|
|
24822
24958
|
}
|
|
24823
24959
|
}
|
|
24824
24960
|
}
|
|
24825
24961
|
}
|
|
24826
24962
|
// After DOCTYPE public keyword state
|
|
24827
24963
|
//------------------------------------------------------------------
|
|
24828
|
-
_stateAfterDoctypePublicKeyword(
|
|
24964
|
+
_stateAfterDoctypePublicKeyword(cp2) {
|
|
24829
24965
|
const token = this.currentToken;
|
|
24830
|
-
switch (
|
|
24966
|
+
switch (cp2) {
|
|
24831
24967
|
case CODE_POINTS.SPACE:
|
|
24832
24968
|
case CODE_POINTS.LINE_FEED:
|
|
24833
24969
|
case CODE_POINTS.TABULATION:
|
|
@@ -24865,15 +25001,15 @@ var Tokenizer = class {
|
|
|
24865
25001
|
this._err(ERR.missingQuoteBeforeDoctypePublicIdentifier);
|
|
24866
25002
|
token.forceQuirks = true;
|
|
24867
25003
|
this.state = State.BOGUS_DOCTYPE;
|
|
24868
|
-
this._stateBogusDoctype(
|
|
25004
|
+
this._stateBogusDoctype(cp2);
|
|
24869
25005
|
}
|
|
24870
25006
|
}
|
|
24871
25007
|
}
|
|
24872
25008
|
// Before DOCTYPE public identifier state
|
|
24873
25009
|
//------------------------------------------------------------------
|
|
24874
|
-
_stateBeforeDoctypePublicIdentifier(
|
|
25010
|
+
_stateBeforeDoctypePublicIdentifier(cp2) {
|
|
24875
25011
|
const token = this.currentToken;
|
|
24876
|
-
switch (
|
|
25012
|
+
switch (cp2) {
|
|
24877
25013
|
case CODE_POINTS.SPACE:
|
|
24878
25014
|
case CODE_POINTS.LINE_FEED:
|
|
24879
25015
|
case CODE_POINTS.TABULATION:
|
|
@@ -24908,15 +25044,15 @@ var Tokenizer = class {
|
|
|
24908
25044
|
this._err(ERR.missingQuoteBeforeDoctypePublicIdentifier);
|
|
24909
25045
|
token.forceQuirks = true;
|
|
24910
25046
|
this.state = State.BOGUS_DOCTYPE;
|
|
24911
|
-
this._stateBogusDoctype(
|
|
25047
|
+
this._stateBogusDoctype(cp2);
|
|
24912
25048
|
}
|
|
24913
25049
|
}
|
|
24914
25050
|
}
|
|
24915
25051
|
// DOCTYPE public identifier (double-quoted) state
|
|
24916
25052
|
//------------------------------------------------------------------
|
|
24917
|
-
_stateDoctypePublicIdentifierDoubleQuoted(
|
|
25053
|
+
_stateDoctypePublicIdentifierDoubleQuoted(cp2) {
|
|
24918
25054
|
const token = this.currentToken;
|
|
24919
|
-
switch (
|
|
25055
|
+
switch (cp2) {
|
|
24920
25056
|
case CODE_POINTS.QUOTATION_MARK: {
|
|
24921
25057
|
this.state = State.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;
|
|
24922
25058
|
break;
|
|
@@ -24941,15 +25077,15 @@ var Tokenizer = class {
|
|
|
24941
25077
|
break;
|
|
24942
25078
|
}
|
|
24943
25079
|
default: {
|
|
24944
|
-
token.publicId += String.fromCodePoint(
|
|
25080
|
+
token.publicId += String.fromCodePoint(cp2);
|
|
24945
25081
|
}
|
|
24946
25082
|
}
|
|
24947
25083
|
}
|
|
24948
25084
|
// DOCTYPE public identifier (single-quoted) state
|
|
24949
25085
|
//------------------------------------------------------------------
|
|
24950
|
-
_stateDoctypePublicIdentifierSingleQuoted(
|
|
25086
|
+
_stateDoctypePublicIdentifierSingleQuoted(cp2) {
|
|
24951
25087
|
const token = this.currentToken;
|
|
24952
|
-
switch (
|
|
25088
|
+
switch (cp2) {
|
|
24953
25089
|
case CODE_POINTS.APOSTROPHE: {
|
|
24954
25090
|
this.state = State.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;
|
|
24955
25091
|
break;
|
|
@@ -24974,15 +25110,15 @@ var Tokenizer = class {
|
|
|
24974
25110
|
break;
|
|
24975
25111
|
}
|
|
24976
25112
|
default: {
|
|
24977
|
-
token.publicId += String.fromCodePoint(
|
|
25113
|
+
token.publicId += String.fromCodePoint(cp2);
|
|
24978
25114
|
}
|
|
24979
25115
|
}
|
|
24980
25116
|
}
|
|
24981
25117
|
// After DOCTYPE public identifier state
|
|
24982
25118
|
//------------------------------------------------------------------
|
|
24983
|
-
_stateAfterDoctypePublicIdentifier(
|
|
25119
|
+
_stateAfterDoctypePublicIdentifier(cp2) {
|
|
24984
25120
|
const token = this.currentToken;
|
|
24985
|
-
switch (
|
|
25121
|
+
switch (cp2) {
|
|
24986
25122
|
case CODE_POINTS.SPACE:
|
|
24987
25123
|
case CODE_POINTS.LINE_FEED:
|
|
24988
25124
|
case CODE_POINTS.TABULATION:
|
|
@@ -25018,15 +25154,15 @@ var Tokenizer = class {
|
|
|
25018
25154
|
this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier);
|
|
25019
25155
|
token.forceQuirks = true;
|
|
25020
25156
|
this.state = State.BOGUS_DOCTYPE;
|
|
25021
|
-
this._stateBogusDoctype(
|
|
25157
|
+
this._stateBogusDoctype(cp2);
|
|
25022
25158
|
}
|
|
25023
25159
|
}
|
|
25024
25160
|
}
|
|
25025
25161
|
// Between DOCTYPE public and system identifiers state
|
|
25026
25162
|
//------------------------------------------------------------------
|
|
25027
|
-
_stateBetweenDoctypePublicAndSystemIdentifiers(
|
|
25163
|
+
_stateBetweenDoctypePublicAndSystemIdentifiers(cp2) {
|
|
25028
25164
|
const token = this.currentToken;
|
|
25029
|
-
switch (
|
|
25165
|
+
switch (cp2) {
|
|
25030
25166
|
case CODE_POINTS.SPACE:
|
|
25031
25167
|
case CODE_POINTS.LINE_FEED:
|
|
25032
25168
|
case CODE_POINTS.TABULATION:
|
|
@@ -25059,15 +25195,15 @@ var Tokenizer = class {
|
|
|
25059
25195
|
this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier);
|
|
25060
25196
|
token.forceQuirks = true;
|
|
25061
25197
|
this.state = State.BOGUS_DOCTYPE;
|
|
25062
|
-
this._stateBogusDoctype(
|
|
25198
|
+
this._stateBogusDoctype(cp2);
|
|
25063
25199
|
}
|
|
25064
25200
|
}
|
|
25065
25201
|
}
|
|
25066
25202
|
// After DOCTYPE system keyword state
|
|
25067
25203
|
//------------------------------------------------------------------
|
|
25068
|
-
_stateAfterDoctypeSystemKeyword(
|
|
25204
|
+
_stateAfterDoctypeSystemKeyword(cp2) {
|
|
25069
25205
|
const token = this.currentToken;
|
|
25070
|
-
switch (
|
|
25206
|
+
switch (cp2) {
|
|
25071
25207
|
case CODE_POINTS.SPACE:
|
|
25072
25208
|
case CODE_POINTS.LINE_FEED:
|
|
25073
25209
|
case CODE_POINTS.TABULATION:
|
|
@@ -25105,15 +25241,15 @@ var Tokenizer = class {
|
|
|
25105
25241
|
this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier);
|
|
25106
25242
|
token.forceQuirks = true;
|
|
25107
25243
|
this.state = State.BOGUS_DOCTYPE;
|
|
25108
|
-
this._stateBogusDoctype(
|
|
25244
|
+
this._stateBogusDoctype(cp2);
|
|
25109
25245
|
}
|
|
25110
25246
|
}
|
|
25111
25247
|
}
|
|
25112
25248
|
// Before DOCTYPE system identifier state
|
|
25113
25249
|
//------------------------------------------------------------------
|
|
25114
|
-
_stateBeforeDoctypeSystemIdentifier(
|
|
25250
|
+
_stateBeforeDoctypeSystemIdentifier(cp2) {
|
|
25115
25251
|
const token = this.currentToken;
|
|
25116
|
-
switch (
|
|
25252
|
+
switch (cp2) {
|
|
25117
25253
|
case CODE_POINTS.SPACE:
|
|
25118
25254
|
case CODE_POINTS.LINE_FEED:
|
|
25119
25255
|
case CODE_POINTS.TABULATION:
|
|
@@ -25148,15 +25284,15 @@ var Tokenizer = class {
|
|
|
25148
25284
|
this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier);
|
|
25149
25285
|
token.forceQuirks = true;
|
|
25150
25286
|
this.state = State.BOGUS_DOCTYPE;
|
|
25151
|
-
this._stateBogusDoctype(
|
|
25287
|
+
this._stateBogusDoctype(cp2);
|
|
25152
25288
|
}
|
|
25153
25289
|
}
|
|
25154
25290
|
}
|
|
25155
25291
|
// DOCTYPE system identifier (double-quoted) state
|
|
25156
25292
|
//------------------------------------------------------------------
|
|
25157
|
-
_stateDoctypeSystemIdentifierDoubleQuoted(
|
|
25293
|
+
_stateDoctypeSystemIdentifierDoubleQuoted(cp2) {
|
|
25158
25294
|
const token = this.currentToken;
|
|
25159
|
-
switch (
|
|
25295
|
+
switch (cp2) {
|
|
25160
25296
|
case CODE_POINTS.QUOTATION_MARK: {
|
|
25161
25297
|
this.state = State.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;
|
|
25162
25298
|
break;
|
|
@@ -25181,15 +25317,15 @@ var Tokenizer = class {
|
|
|
25181
25317
|
break;
|
|
25182
25318
|
}
|
|
25183
25319
|
default: {
|
|
25184
|
-
token.systemId += String.fromCodePoint(
|
|
25320
|
+
token.systemId += String.fromCodePoint(cp2);
|
|
25185
25321
|
}
|
|
25186
25322
|
}
|
|
25187
25323
|
}
|
|
25188
25324
|
// DOCTYPE system identifier (single-quoted) state
|
|
25189
25325
|
//------------------------------------------------------------------
|
|
25190
|
-
_stateDoctypeSystemIdentifierSingleQuoted(
|
|
25326
|
+
_stateDoctypeSystemIdentifierSingleQuoted(cp2) {
|
|
25191
25327
|
const token = this.currentToken;
|
|
25192
|
-
switch (
|
|
25328
|
+
switch (cp2) {
|
|
25193
25329
|
case CODE_POINTS.APOSTROPHE: {
|
|
25194
25330
|
this.state = State.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;
|
|
25195
25331
|
break;
|
|
@@ -25214,15 +25350,15 @@ var Tokenizer = class {
|
|
|
25214
25350
|
break;
|
|
25215
25351
|
}
|
|
25216
25352
|
default: {
|
|
25217
|
-
token.systemId += String.fromCodePoint(
|
|
25353
|
+
token.systemId += String.fromCodePoint(cp2);
|
|
25218
25354
|
}
|
|
25219
25355
|
}
|
|
25220
25356
|
}
|
|
25221
25357
|
// After DOCTYPE system identifier state
|
|
25222
25358
|
//------------------------------------------------------------------
|
|
25223
|
-
_stateAfterDoctypeSystemIdentifier(
|
|
25359
|
+
_stateAfterDoctypeSystemIdentifier(cp2) {
|
|
25224
25360
|
const token = this.currentToken;
|
|
25225
|
-
switch (
|
|
25361
|
+
switch (cp2) {
|
|
25226
25362
|
case CODE_POINTS.SPACE:
|
|
25227
25363
|
case CODE_POINTS.LINE_FEED:
|
|
25228
25364
|
case CODE_POINTS.TABULATION:
|
|
@@ -25244,15 +25380,15 @@ var Tokenizer = class {
|
|
|
25244
25380
|
default: {
|
|
25245
25381
|
this._err(ERR.unexpectedCharacterAfterDoctypeSystemIdentifier);
|
|
25246
25382
|
this.state = State.BOGUS_DOCTYPE;
|
|
25247
|
-
this._stateBogusDoctype(
|
|
25383
|
+
this._stateBogusDoctype(cp2);
|
|
25248
25384
|
}
|
|
25249
25385
|
}
|
|
25250
25386
|
}
|
|
25251
25387
|
// Bogus DOCTYPE state
|
|
25252
25388
|
//------------------------------------------------------------------
|
|
25253
|
-
_stateBogusDoctype(
|
|
25389
|
+
_stateBogusDoctype(cp2) {
|
|
25254
25390
|
const token = this.currentToken;
|
|
25255
|
-
switch (
|
|
25391
|
+
switch (cp2) {
|
|
25256
25392
|
case CODE_POINTS.GREATER_THAN_SIGN: {
|
|
25257
25393
|
this.emitCurrentDoctype(token);
|
|
25258
25394
|
this.state = State.DATA;
|
|
@@ -25272,8 +25408,8 @@ var Tokenizer = class {
|
|
|
25272
25408
|
}
|
|
25273
25409
|
// CDATA section state
|
|
25274
25410
|
//------------------------------------------------------------------
|
|
25275
|
-
_stateCdataSection(
|
|
25276
|
-
switch (
|
|
25411
|
+
_stateCdataSection(cp2) {
|
|
25412
|
+
switch (cp2) {
|
|
25277
25413
|
case CODE_POINTS.RIGHT_SQUARE_BRACKET: {
|
|
25278
25414
|
this.state = State.CDATA_SECTION_BRACKET;
|
|
25279
25415
|
break;
|
|
@@ -25284,25 +25420,25 @@ var Tokenizer = class {
|
|
|
25284
25420
|
break;
|
|
25285
25421
|
}
|
|
25286
25422
|
default: {
|
|
25287
|
-
this._emitCodePoint(
|
|
25423
|
+
this._emitCodePoint(cp2);
|
|
25288
25424
|
}
|
|
25289
25425
|
}
|
|
25290
25426
|
}
|
|
25291
25427
|
// CDATA section bracket state
|
|
25292
25428
|
//------------------------------------------------------------------
|
|
25293
|
-
_stateCdataSectionBracket(
|
|
25294
|
-
if (
|
|
25429
|
+
_stateCdataSectionBracket(cp2) {
|
|
25430
|
+
if (cp2 === CODE_POINTS.RIGHT_SQUARE_BRACKET) {
|
|
25295
25431
|
this.state = State.CDATA_SECTION_END;
|
|
25296
25432
|
} else {
|
|
25297
25433
|
this._emitChars("]");
|
|
25298
25434
|
this.state = State.CDATA_SECTION;
|
|
25299
|
-
this._stateCdataSection(
|
|
25435
|
+
this._stateCdataSection(cp2);
|
|
25300
25436
|
}
|
|
25301
25437
|
}
|
|
25302
25438
|
// CDATA section end state
|
|
25303
25439
|
//------------------------------------------------------------------
|
|
25304
|
-
_stateCdataSectionEnd(
|
|
25305
|
-
switch (
|
|
25440
|
+
_stateCdataSectionEnd(cp2) {
|
|
25441
|
+
switch (cp2) {
|
|
25306
25442
|
case CODE_POINTS.GREATER_THAN_SIGN: {
|
|
25307
25443
|
this.state = State.DATA;
|
|
25308
25444
|
break;
|
|
@@ -25314,7 +25450,7 @@ var Tokenizer = class {
|
|
|
25314
25450
|
default: {
|
|
25315
25451
|
this._emitChars("]]");
|
|
25316
25452
|
this.state = State.CDATA_SECTION;
|
|
25317
|
-
this._stateCdataSection(
|
|
25453
|
+
this._stateCdataSection(cp2);
|
|
25318
25454
|
}
|
|
25319
25455
|
}
|
|
25320
25456
|
}
|
|
@@ -25343,15 +25479,15 @@ var Tokenizer = class {
|
|
|
25343
25479
|
}
|
|
25344
25480
|
// Ambiguos ampersand state
|
|
25345
25481
|
//------------------------------------------------------------------
|
|
25346
|
-
_stateAmbiguousAmpersand(
|
|
25347
|
-
if (isAsciiAlphaNumeric2(
|
|
25348
|
-
this._flushCodePointConsumedAsCharacterReference(
|
|
25482
|
+
_stateAmbiguousAmpersand(cp2) {
|
|
25483
|
+
if (isAsciiAlphaNumeric2(cp2)) {
|
|
25484
|
+
this._flushCodePointConsumedAsCharacterReference(cp2);
|
|
25349
25485
|
} else {
|
|
25350
|
-
if (
|
|
25486
|
+
if (cp2 === CODE_POINTS.SEMICOLON) {
|
|
25351
25487
|
this._err(ERR.unknownNamedCharacterReference);
|
|
25352
25488
|
}
|
|
25353
25489
|
this.state = this.returnState;
|
|
25354
|
-
this._callState(
|
|
25490
|
+
this._callState(cp2);
|
|
25355
25491
|
}
|
|
25356
25492
|
}
|
|
25357
25493
|
};
|
|
@@ -30516,7 +30652,7 @@ function searchCrawlers() {
|
|
|
30516
30652
|
return CRAWLER_REGISTRY.filter((entry) => entry.purpose === "search_index").map((entry) => entry.token);
|
|
30517
30653
|
}
|
|
30518
30654
|
function probeUserAgent(token) {
|
|
30519
|
-
return `Mozilla/5.0 (compatible; ${token};
|
|
30655
|
+
return `Mozilla/5.0 (compatible; ${token}; Obi readiness check)`;
|
|
30520
30656
|
}
|
|
30521
30657
|
function firewallProbePlan(origin) {
|
|
30522
30658
|
const base = new URL(origin).origin;
|
|
@@ -30622,6 +30758,7 @@ function auditFirewall(probes, origin) {
|
|
|
30622
30758
|
}
|
|
30623
30759
|
|
|
30624
30760
|
// ../geo-engine/src/geo/host-acquisition.ts
|
|
30761
|
+
var ROBOTS_TOKENS = ["Obi", "Heysurface"];
|
|
30625
30762
|
var INVENTORY_SAFETY_LIMIT = 1e5;
|
|
30626
30763
|
var priority = { robots: 0, sitemap: 1, page: 2, llms: 3 };
|
|
30627
30764
|
var pagePriority = {
|
|
@@ -30697,9 +30834,9 @@ function discoverHostPageLinks(state, body, pageUrl, known = new Set(state.resou
|
|
|
30697
30834
|
const alias = new URL(pageUrl);
|
|
30698
30835
|
alias.hostname = alias.hostname.startsWith("www.") ? alias.hostname.slice(4) : `www.${alias.hostname}`;
|
|
30699
30836
|
const links = [pageUrl, alias.href].flatMap((base) => extractSameOriginLinks(body, base, INVENTORY_SAFETY_LIMIT));
|
|
30700
|
-
for (const
|
|
30701
|
-
if (/\.(?:xml|pdf|png|jpe?g|gif|svg|webp|ico|css|js|zip|mp4|woff2?)$/i.test(new URL(
|
|
30702
|
-
const resource = appendResource(state,
|
|
30837
|
+
for (const link2 of links) {
|
|
30838
|
+
if (/\.(?:xml|pdf|png|jpe?g|gif|svg|webp|ico|css|js|zip|mp4|woff2?)$/i.test(new URL(link2).pathname)) continue;
|
|
30839
|
+
const resource = appendResource(state, link2, "page", known);
|
|
30703
30840
|
if (resource) added.push(resource);
|
|
30704
30841
|
}
|
|
30705
30842
|
return added;
|
|
@@ -30794,6 +30931,7 @@ async function crawlHostBatch(raw, options = {}) {
|
|
|
30794
30931
|
const pages = [];
|
|
30795
30932
|
const fetcher = options.fetcher ?? observeSelectedHttp;
|
|
30796
30933
|
const probePlan = options.probeBots ? firewallProbePlan(state.origin) : [];
|
|
30934
|
+
const parsedRobots = /* @__PURE__ */ new Map();
|
|
30797
30935
|
for (let attempt = 0; attempt < batchSize; attempt++) {
|
|
30798
30936
|
if (pendingChanged) {
|
|
30799
30937
|
pending.sort((a, b) => order.get(a.url) - order.get(b.url));
|
|
@@ -30829,7 +30967,12 @@ async function crawlHostBatch(raw, options = {}) {
|
|
|
30829
30967
|
if (next.kind !== "robots" && state.robots) {
|
|
30830
30968
|
const robots = state.robots;
|
|
30831
30969
|
const unavailable2 = robots.errorKind || robots.truncated || robots.status === null || robots.status === 429 || robots.status >= 500;
|
|
30832
|
-
|
|
30970
|
+
let rules = null;
|
|
30971
|
+
if (robots.status === 200 && robots.body !== null) {
|
|
30972
|
+
rules = parsedRobots.get(robots.body) ?? parseRobots(robots.body);
|
|
30973
|
+
parsedRobots.set(robots.body, rules);
|
|
30974
|
+
}
|
|
30975
|
+
const blocked = rules !== null && ROBOTS_TOKENS.some((token) => !evaluateAccess(rules, token, next.url).allowed);
|
|
30833
30976
|
if (unavailable2 || blocked) {
|
|
30834
30977
|
next.status = "blocked";
|
|
30835
30978
|
next.error = unavailable2 ? "robots_unavailable" : "robots_disallow";
|
|
@@ -31147,7 +31290,7 @@ function auditLlms(obs, ctx) {
|
|
|
31147
31290
|
}
|
|
31148
31291
|
const valid = links.filter((l) => l.resolved !== null);
|
|
31149
31292
|
const seen = /* @__PURE__ */ new Map();
|
|
31150
|
-
for (const
|
|
31293
|
+
for (const link2 of valid) seen.set(normalize(link2.resolved), [...seen.get(normalize(link2.resolved)) ?? [], link2]);
|
|
31151
31294
|
const duplicates = [...seen.entries()].filter(([, list]) => list.length > 1).slice(0, MAX_LISTED);
|
|
31152
31295
|
if (duplicates.length > 0) {
|
|
31153
31296
|
fail("llms.duplicate-links", duplicates.map(([u]) => u).join("\n"), duplicates.flatMap(([, list]) => list.map((l) => l.line)), { links: duplicates.map(([u]) => u) }, "info");
|
|
@@ -32680,7 +32823,7 @@ async function captureResearch(input, checkpoint, output) {
|
|
|
32680
32823
|
|
|
32681
32824
|
// src/research-video.ts
|
|
32682
32825
|
import { spawn as spawn2 } from "node:child_process";
|
|
32683
|
-
import { mkdir as mkdir2, readdir as
|
|
32826
|
+
import { mkdir as mkdir2, readdir as readdir3, readFile as readFile7, rm as rm2 } from "node:fs/promises";
|
|
32684
32827
|
import { join as join4, resolve as resolve3 } from "node:path";
|
|
32685
32828
|
var maxToolOutputBytes = 256 * 1024;
|
|
32686
32829
|
var runTool = (executable, args, timeoutMs) => new Promise((done, fail) => {
|
|
@@ -32708,7 +32851,7 @@ var runTool = (executable, args, timeoutMs) => new Promise((done, fail) => {
|
|
|
32708
32851
|
});
|
|
32709
32852
|
});
|
|
32710
32853
|
var presenceTimeoutMs = 6e4;
|
|
32711
|
-
async function
|
|
32854
|
+
async function present2(runner, executable, flag) {
|
|
32712
32855
|
try {
|
|
32713
32856
|
return (await runner(executable, [flag], presenceTimeoutMs)).exitCode === 0;
|
|
32714
32857
|
} catch {
|
|
@@ -32716,7 +32859,7 @@ async function present(runner, executable, flag) {
|
|
|
32716
32859
|
}
|
|
32717
32860
|
}
|
|
32718
32861
|
async function videoTools(runner = runTool) {
|
|
32719
|
-
const [ytDlp, ffmpeg] = await Promise.all([
|
|
32862
|
+
const [ytDlp, ffmpeg] = await Promise.all([present2(runner, "yt-dlp", "--version"), present2(runner, "ffmpeg", "-version")]);
|
|
32720
32863
|
return { ytDlp, ffmpeg };
|
|
32721
32864
|
}
|
|
32722
32865
|
var missingTool = (frames) => videoError(
|
|
@@ -32776,7 +32919,7 @@ function publicVideoUrl(raw) {
|
|
|
32776
32919
|
}
|
|
32777
32920
|
async function readVideo(rawUrl, outputDir, frames, runner = runTool) {
|
|
32778
32921
|
const url3 = publicVideoUrl(rawUrl);
|
|
32779
|
-
if (frames > 0 && !await
|
|
32922
|
+
if (frames > 0 && !await present2(runner, "ffmpeg", "-version")) throw missingTool(frames);
|
|
32780
32923
|
const directory = resolve3(outputDir);
|
|
32781
32924
|
await mkdir2(directory, { recursive: true });
|
|
32782
32925
|
const base = ["--ignore-config", "--no-playlist", "--quiet", "--no-warnings"];
|
|
@@ -32803,7 +32946,7 @@ async function readVideo(rawUrl, outputDir, frames, runner = runTool) {
|
|
|
32803
32946
|
...target,
|
|
32804
32947
|
url3.href
|
|
32805
32948
|
], 18e4).catch(() => null);
|
|
32806
|
-
const file2 = (await
|
|
32949
|
+
const file2 = (await readdir3(directory)).find((name) => name === `video.${chosen.language}.vtt`);
|
|
32807
32950
|
if (subtitles?.exitCode !== 0 || !file2) {
|
|
32808
32951
|
throw failed("The video has captions but their download failed.", "Retry in a minute; the platform may be rate-limiting.");
|
|
32809
32952
|
}
|
|
@@ -32831,7 +32974,7 @@ async function readVideo(rawUrl, outputDir, frames, runner = runTool) {
|
|
|
32831
32974
|
throw failed("The video's length is unknown, so frames cannot be spaced.", "Retry with --frames 0 to keep the captions only.");
|
|
32832
32975
|
}
|
|
32833
32976
|
if (frames > 0 && duration3) {
|
|
32834
|
-
const removeMedia = async () => Promise.all((await
|
|
32977
|
+
const removeMedia = async () => Promise.all((await readdir3(directory)).filter((file2) => file2.startsWith("media.")).map((file2) => rm2(join4(directory, file2), { force: true })));
|
|
32835
32978
|
await removeMedia();
|
|
32836
32979
|
try {
|
|
32837
32980
|
const download = await runner("yt-dlp", [
|
|
@@ -32844,7 +32987,7 @@ async function readVideo(rawUrl, outputDir, frames, runner = runTool) {
|
|
|
32844
32987
|
], 6e5).catch(() => {
|
|
32845
32988
|
throw failed("The video download did not finish.", "Retry with --frames 0 to keep the captions only.");
|
|
32846
32989
|
});
|
|
32847
|
-
const media = (await
|
|
32990
|
+
const media = (await readdir3(directory)).find((file2) => file2.startsWith("media.") && !file2.endsWith(".part"));
|
|
32848
32991
|
if (download.exitCode !== 0 || !media) {
|
|
32849
32992
|
throw failed("The video could not be downloaded for frames.", "Retry with --frames 0 to keep the captions only.");
|
|
32850
32993
|
}
|
|
@@ -32925,7 +33068,20 @@ async function removeEverywhere(context) {
|
|
|
32925
33068
|
await new CredentialStore(backend, context.origin.origin).removeCredential();
|
|
32926
33069
|
}
|
|
32927
33070
|
}
|
|
33071
|
+
async function forgetLegacyFolder(context) {
|
|
33072
|
+
const legacy = legacySibling(context.stateDirectory);
|
|
33073
|
+
if (legacy === null) return;
|
|
33074
|
+
const backend = new FileBackend(legacy);
|
|
33075
|
+
for (const item of ["credentials", "pending"]) {
|
|
33076
|
+
await backend.remove(item, context.origin.origin).catch(() => void 0);
|
|
33077
|
+
}
|
|
33078
|
+
}
|
|
32928
33079
|
async function logout(context) {
|
|
33080
|
+
const data = await logoutHere(context);
|
|
33081
|
+
await forgetLegacyFolder(context);
|
|
33082
|
+
return data;
|
|
33083
|
+
}
|
|
33084
|
+
async function logoutHere(context) {
|
|
32929
33085
|
const origin = context.origin.origin;
|
|
32930
33086
|
let located;
|
|
32931
33087
|
try {
|
|
@@ -32970,27 +33126,28 @@ async function showAlphaStrategies(context) {
|
|
|
32970
33126
|
}
|
|
32971
33127
|
|
|
32972
33128
|
// src/skill-install.ts
|
|
32973
|
-
import { lstat as lstat3, mkdir as mkdir3, realpath, symlink, unlink as
|
|
33129
|
+
import { lstat as lstat3, mkdir as mkdir3, readlink, realpath, symlink, unlink as unlink5 } from "node:fs/promises";
|
|
32974
33130
|
import { homedir as homedir2 } from "node:os";
|
|
32975
33131
|
import { join as join5, sep } from "node:path";
|
|
32976
33132
|
var skillDirectories = [".agents/skills", ".claude/skills"];
|
|
32977
|
-
|
|
33133
|
+
var alphaSkillName = "heysurface";
|
|
33134
|
+
function installError(message) {
|
|
32978
33135
|
return new CliError({
|
|
32979
33136
|
code: "SKILL_INSTALL_FAILED",
|
|
32980
33137
|
message,
|
|
32981
33138
|
exitCode: 4,
|
|
32982
33139
|
retryable: false,
|
|
32983
|
-
nextAction:
|
|
33140
|
+
nextAction: "Check the personal Skill directories and run obi skill install again. Existing files are never replaced.",
|
|
32984
33141
|
mode: "local"
|
|
32985
33142
|
});
|
|
32986
33143
|
}
|
|
32987
|
-
async function existingPath(path
|
|
33144
|
+
async function existingPath(path) {
|
|
32988
33145
|
try {
|
|
32989
33146
|
await lstat3(path);
|
|
32990
33147
|
return true;
|
|
32991
33148
|
} catch (error51) {
|
|
32992
33149
|
if (error51.code === "ENOENT") return false;
|
|
32993
|
-
throw installError(`Cannot inspect ${path}
|
|
33150
|
+
throw installError(`Cannot inspect ${path}.`);
|
|
32994
33151
|
}
|
|
32995
33152
|
}
|
|
32996
33153
|
async function linksIntoPackage(path, packageRoot) {
|
|
@@ -32999,50 +33156,51 @@ async function linksIntoPackage(path, packageRoot) {
|
|
|
32999
33156
|
entry = await lstat3(path);
|
|
33000
33157
|
} catch (error51) {
|
|
33001
33158
|
if (error51.code === "ENOENT") return false;
|
|
33002
|
-
throw installError(`Cannot inspect ${path}
|
|
33159
|
+
throw installError(`Cannot inspect ${path}.`);
|
|
33003
33160
|
}
|
|
33004
33161
|
if (!entry.isSymbolicLink()) return false;
|
|
33005
|
-
let target;
|
|
33006
33162
|
try {
|
|
33007
|
-
target = await realpath(path);
|
|
33163
|
+
const target = await realpath(path);
|
|
33164
|
+
return target === packageRoot || target.startsWith(`${packageRoot}${sep}`);
|
|
33008
33165
|
} catch {
|
|
33009
|
-
|
|
33166
|
+
try {
|
|
33167
|
+
return await readlink(path) === join5(packageRoot, "skills", alphaSkillName);
|
|
33168
|
+
} catch {
|
|
33169
|
+
return false;
|
|
33170
|
+
}
|
|
33010
33171
|
}
|
|
33011
|
-
return target === packageRoot || target.startsWith(`${packageRoot}${sep}`);
|
|
33012
33172
|
}
|
|
33013
|
-
async function installSkill(sourceDirectory
|
|
33173
|
+
async function installSkill(sourceDirectory) {
|
|
33014
33174
|
const source = await realpath(sourceDirectory);
|
|
33015
33175
|
const home = homedir2();
|
|
33016
|
-
const destinations = skillDirectories.map((directory) => join5(home, directory,
|
|
33176
|
+
const destinations = skillDirectories.map((directory) => join5(home, directory, "obi"));
|
|
33017
33177
|
for (const destination of destinations) {
|
|
33018
|
-
if (!await existingPath(destination
|
|
33178
|
+
if (!await existingPath(destination)) continue;
|
|
33019
33179
|
try {
|
|
33020
33180
|
if (await realpath(destination) === source) continue;
|
|
33021
33181
|
} catch {
|
|
33022
33182
|
}
|
|
33023
|
-
throw installError(`A Skill entry already exists at ${destination}
|
|
33183
|
+
throw installError(`A Skill entry already exists at ${destination}.`);
|
|
33024
33184
|
}
|
|
33025
33185
|
for (const destination of destinations) {
|
|
33026
|
-
if (await existingPath(destination
|
|
33186
|
+
if (await existingPath(destination)) continue;
|
|
33027
33187
|
try {
|
|
33028
33188
|
await mkdir3(join5(destination, ".."), { recursive: true });
|
|
33029
33189
|
await symlink(source, destination, process.platform === "win32" ? "junction" : "dir");
|
|
33030
33190
|
} catch {
|
|
33031
|
-
throw installError(`Could not register the
|
|
33191
|
+
throw installError(`Could not register the Obi Skill at ${destination}.`);
|
|
33032
33192
|
}
|
|
33033
33193
|
}
|
|
33034
33194
|
const removed = [];
|
|
33035
|
-
|
|
33036
|
-
|
|
33037
|
-
|
|
33038
|
-
|
|
33039
|
-
|
|
33040
|
-
|
|
33041
|
-
|
|
33042
|
-
throw installError(`Could not retire the alpha /heysurface Skill link at ${alpha}.`, identity);
|
|
33043
|
-
}
|
|
33044
|
-
removed.push(alpha);
|
|
33195
|
+
const packageRoot = await realpath(join5(source, "..", ".."));
|
|
33196
|
+
for (const alpha of skillDirectories.map((directory) => join5(home, directory, alphaSkillName))) {
|
|
33197
|
+
if (!await linksIntoPackage(alpha, packageRoot)) continue;
|
|
33198
|
+
try {
|
|
33199
|
+
await unlink5(alpha);
|
|
33200
|
+
} catch {
|
|
33201
|
+
throw installError(`Could not retire the earlier Skill link at ${alpha}.`);
|
|
33045
33202
|
}
|
|
33203
|
+
removed.push(alpha);
|
|
33046
33204
|
}
|
|
33047
33205
|
return { paths: destinations, removed };
|
|
33048
33206
|
}
|
|
@@ -33260,7 +33418,7 @@ async function executeCommand(args, runtime) {
|
|
|
33260
33418
|
});
|
|
33261
33419
|
}
|
|
33262
33420
|
if (args.command === "skill") {
|
|
33263
|
-
const path = fileURLToPath(new URL(
|
|
33421
|
+
const path = fileURLToPath(new URL("../skills/obi/SKILL.md", import.meta.url));
|
|
33264
33422
|
try {
|
|
33265
33423
|
await access(path);
|
|
33266
33424
|
} catch {
|
|
@@ -33273,7 +33431,7 @@ async function executeCommand(args, runtime) {
|
|
|
33273
33431
|
mode: "local"
|
|
33274
33432
|
});
|
|
33275
33433
|
}
|
|
33276
|
-
return success2("skill", "local", args.skillAction === "install" ? { action: "install", ...await installSkill(fileURLToPath(new URL(
|
|
33434
|
+
return success2("skill", "local", args.skillAction === "install" ? { action: "install", ...await installSkill(fileURLToPath(new URL("../skills/obi", import.meta.url))) } : { action: "path", path });
|
|
33277
33435
|
}
|
|
33278
33436
|
if (args.command === "login") {
|
|
33279
33437
|
return success2("login", "product", await login(session, {
|
|
@@ -33496,7 +33654,7 @@ function failureResult(error51, command, mode) {
|
|
|
33496
33654
|
function markOrigin(result, origin) {
|
|
33497
33655
|
return origin?.development === true ? cliResultSchema.parse({ ...result, origin: origin.origin, development: true }) : result;
|
|
33498
33656
|
}
|
|
33499
|
-
async function runCli(
|
|
33657
|
+
async function runCli() {
|
|
33500
33658
|
const argv = process.argv.slice(2);
|
|
33501
33659
|
const json2 = wantsJson(argv);
|
|
33502
33660
|
const welcome = argv.length === 0 && process.stdin.isTTY === true && process.stdout.isTTY === true;
|
|
@@ -33511,7 +33669,7 @@ async function runCli(identity) {
|
|
|
33511
33669
|
const resolved = resolveOrigin(process.env);
|
|
33512
33670
|
if (resolved.development && !json2 && !warned) {
|
|
33513
33671
|
warned = true;
|
|
33514
|
-
process.stderr.write(`Warning:
|
|
33672
|
+
process.stderr.write(`Warning: OBI_ORIGIN points this CLI at the development server ${sanitizeHumanText(resolved.origin)}, not at Obi.
|
|
33515
33673
|
`);
|
|
33516
33674
|
}
|
|
33517
33675
|
return resolved;
|
|
@@ -33523,8 +33681,7 @@ async function runCli(identity) {
|
|
|
33523
33681
|
origin = activeOrigin();
|
|
33524
33682
|
const result = await executeCommand(args, {
|
|
33525
33683
|
origin,
|
|
33526
|
-
stateDirectory:
|
|
33527
|
-
identity
|
|
33684
|
+
stateDirectory: await prepareStateDirectory(process.env)
|
|
33528
33685
|
});
|
|
33529
33686
|
const evaluationCaseId = args.evaluationCaseId;
|
|
33530
33687
|
const scopeNext = (data) => ({
|
|
@@ -33539,7 +33696,7 @@ async function runCli(identity) {
|
|
|
33539
33696
|
if (scoped.ok && welcome) {
|
|
33540
33697
|
process.stdout.write(renderWelcome(process.env, process.stdout.columns, process.stdout.getColorDepth()));
|
|
33541
33698
|
} else {
|
|
33542
|
-
writeResult(markOrigin(scoped, origin), args.json
|
|
33699
|
+
writeResult(markOrigin(scoped, origin), args.json);
|
|
33543
33700
|
}
|
|
33544
33701
|
} catch (error51) {
|
|
33545
33702
|
if (origin === void 0) {
|
|
@@ -33555,7 +33712,7 @@ async function runCli(identity) {
|
|
|
33555
33712
|
retryable: false,
|
|
33556
33713
|
nextAction: "Run the command again or inspect the local CLI installation."
|
|
33557
33714
|
});
|
|
33558
|
-
writeResult(markOrigin(failureResult(knownError, knownError.command ?? command, mode), origin), json2
|
|
33715
|
+
writeResult(markOrigin(failureResult(knownError, knownError.command ?? command, mode), origin), json2);
|
|
33559
33716
|
process.exitCode = knownError.exitCode;
|
|
33560
33717
|
} finally {
|
|
33561
33718
|
closeIdleConnections();
|
|
@@ -33563,4 +33720,4 @@ async function runCli(identity) {
|
|
|
33563
33720
|
}
|
|
33564
33721
|
|
|
33565
33722
|
// src/obi.ts
|
|
33566
|
-
void runCli(
|
|
33723
|
+
void runCli();
|