diff --git a/.agents/plugins/marketplace.json b/.agents/plugins/marketplace.json
new file mode 100644
index 0000000000..96551bd897
--- /dev/null
+++ b/.agents/plugins/marketplace.json
@@ -0,0 +1,20 @@
+{
+ "name": "studio",
+ "interface": {
+ "displayName": "studio"
+ },
+ "plugins": [
+ {
+ "name": "data-liberation",
+ "source": {
+ "source": "local",
+ "path": "./packages/data-liberation-agent"
+ },
+ "policy": {
+ "installation": "AVAILABLE",
+ "authentication": "ON_INSTALL"
+ },
+ "category": "Coding"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/.agents/skills/codex.marketplace.json b/.agents/skills/codex.marketplace.json
new file mode 120000
index 0000000000..68dd22cea9
--- /dev/null
+++ b/.agents/skills/codex.marketplace.json
@@ -0,0 +1 @@
+../plugins/marketplace.json
\ No newline at end of file
diff --git a/.agents/skills/marketplace.json b/.agents/skills/marketplace.json
new file mode 120000
index 0000000000..68dd22cea9
--- /dev/null
+++ b/.agents/skills/marketplace.json
@@ -0,0 +1 @@
+../plugins/marketplace.json
\ No newline at end of file
diff --git a/.buildkite/commands/run-lint.sh b/.buildkite/commands/run-lint.sh
index b391398c23..4f366b3463 100755
--- a/.buildkite/commands/run-lint.sh
+++ b/.buildkite/commands/run-lint.sh
@@ -14,3 +14,16 @@ npm run lint
echo '--- :typescript: Typecheck'
npm run typecheck
+
+# The data-liberation plugin ships its MCP server as a committed esbuild
+# bundle (the plugin installer copies the package from git verbatim — no
+# npm install, no build). Rebuild it and fail if the committed artifact
+# doesn't match src/, so the two can never drift. The build is
+# byte-deterministic for a given lockfile, so a clean tree means fresh.
+echo '--- :package: Verify data-liberation MCP bundle is fresh'
+npm -w data-liberation run build:mcp-bundle
+if ! git diff --exit-code -- packages/data-liberation-agent/dist/mcp-server.bundle.mjs; then
+ echo "^^^ +++"
+ echo "The committed data-liberation MCP bundle is stale. Run 'npm -w data-liberation run build:mcp-bundle' and commit the updated bundle."
+ exit 1
+fi
diff --git a/packages/data-liberation-agent/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json
similarity index 83%
rename from packages/data-liberation-agent/.claude-plugin/marketplace.json
rename to .claude-plugin/marketplace.json
index 7b7f8c1751..56d18c798b 100644
--- a/packages/data-liberation-agent/.claude-plugin/marketplace.json
+++ b/.claude-plugin/marketplace.json
@@ -1,12 +1,12 @@
{
- "name": "data-liberation",
+ "name": "studio",
"owner": {
"name": "Automattic"
},
"plugins": [
{
"name": "data-liberation",
- "source": "./",
+ "source": "./packages/data-liberation-agent",
"description": "Extract content from closed web platforms (GoDaddy Websites & Marketing, Hostinger, HubSpot, Shopify, Squarespace, Webflow, Weebly, Wix) into WordPress-compatible WXR files. Inspect, extract, QA, and import to WordPress."
}
]
diff --git a/.gitignore b/.gitignore
index c47aadf3cc..38246bc530 100644
--- a/.gitignore
+++ b/.gitignore
@@ -114,6 +114,10 @@ cli/vendor/
dist
dist-hosted
dist-local
+# …except the data-liberation plugin's committed MCP server bundle (the plugin
+# installer copies the package without running npm install or a build). The
+# package-level .gitignore keeps everything else in its dist/ ignored.
+!packages/data-liberation-agent/dist
# Playwright traces
test-results
diff --git a/package-lock.json b/package-lock.json
index 8666bca93d..7bef9d37a3 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -33133,6 +33133,7 @@
"@types/pixelmatch": "^5.2.6",
"@types/pngjs": "^6.0.5",
"@types/react": "^19.2.14",
+ "esbuild": "^0.28.0",
"jsdom": "^26.1.0",
"single-file-cli": "^2.0.83",
"tsx": "^4.19.0",
diff --git a/packages/data-liberation-agent/.claude-plugin/plugin.json b/packages/data-liberation-agent/.claude-plugin/plugin.json
index f754ebde89..439f7a47f8 100644
--- a/packages/data-liberation-agent/.claude-plugin/plugin.json
+++ b/packages/data-liberation-agent/.claude-plugin/plugin.json
@@ -1,12 +1,12 @@
{
"name": "data-liberation",
"description": "Extract content from closed web platforms (GoDaddy Websites & Marketing, Hostinger, HubSpot, Shopify, Squarespace, Webflow, Weebly, Wix) into WordPress-compatible WXR files. Inspect, extract, QA, and import to WordPress.",
- "version": "0.2.2",
+ "version": "1.0.0",
"author": {
"name": "Automattic"
},
- "homepage": "https://github.com/Automattic/data-liberation-agent",
- "repository": "https://github.com/Automattic/data-liberation-agent",
+ "homepage": "https://github.com/Automattic/studio",
+ "repository": "https://github.com/Automattic/studio",
"license": "GPL-2.0-or-later",
"keywords": [
"content-extraction",
@@ -23,8 +23,5 @@
"wordpress",
"wxr"
],
- "mcp": {
- "command": "npx",
- "args": ["tsx", "src/mcp-server.ts"]
- }
+ "mcpServers": "./.mcp.json"
}
diff --git a/packages/data-liberation-agent/.codex-plugin/plugin.json b/packages/data-liberation-agent/.codex-plugin/plugin.json
index d769b11fc4..99a0c9c410 100644
--- a/packages/data-liberation-agent/.codex-plugin/plugin.json
+++ b/packages/data-liberation-agent/.codex-plugin/plugin.json
@@ -1,14 +1,14 @@
{
"name": "data-liberation",
"description": "Extract content from closed web platforms (GoDaddy Websites & Marketing, Hostinger, HubSpot, Shopify, Squarespace, Webflow, Weebly, Wix) into WordPress-compatible WXR files. Inspect, extract, QA, and import to WordPress.",
- "version": "0.2.2",
+ "version": "1.0.0",
"author": {
"name": "Automattic"
},
- "homepage": "https://github.com/Automattic/data-liberation-agent",
+ "homepage": "https://github.com/Automattic/studio",
"license": "GPL-2.0-or-later",
"skills": "./skills/",
- "mcpServers": "./.mcp.json",
+ "mcpServers": "./.mcp.codex.json",
"interface": {
"displayName": "Data Liberation",
"shortDescription": "Extract closed-platform sites into WordPress-compatible exports",
@@ -20,7 +20,7 @@
"Read",
"Write"
],
- "websiteURL": "https://github.com/Automattic/data-liberation-agent",
+ "websiteURL": "https://github.com/Automattic/studio",
"defaultPrompt": [
"Inspect a site for liberation",
"Extract this site into WordPress-compatible WXR",
diff --git a/packages/data-liberation-agent/.gitignore b/packages/data-liberation-agent/.gitignore
index 14c416ed8c..b0df77f796 100644
--- a/packages/data-liberation-agent/.gitignore
+++ b/packages/data-liberation-agent/.gitignore
@@ -4,7 +4,11 @@ skills/replicate-workspace/
node_modules/
.DS_Store
*.log
-dist/
+# dist/ is build output, EXCEPT the committed plugin bundle: the Claude/Codex
+# plugin installer copies this package verbatim (no npm install, no build), so
+# the self-contained MCP server bundle must live in git.
+dist/*
+!dist/mcp-server.bundle.mjs
docs/plans/
docs/superpowers/
qa-screenshots/
@@ -15,6 +19,8 @@ qa-screenshots/
.worktrees/
.tmp-test/
TODOS.md
+# Local discovery log — see CONTRIBUTING.md; intentionally not committed
+DISCOVERIES.md
# Streaming compose-then-install scratch dir
.tmp-compose/
diff --git a/packages/data-liberation-agent/.mcp.codex.json b/packages/data-liberation-agent/.mcp.codex.json
new file mode 100644
index 0000000000..89fded61ad
--- /dev/null
+++ b/packages/data-liberation-agent/.mcp.codex.json
@@ -0,0 +1,9 @@
+{
+ "mcpServers": {
+ "data-liberation": {
+ "command": "node",
+ "args": ["./scripts/mcp-launcher.mjs"],
+ "cwd": "."
+ }
+ }
+}
diff --git a/packages/data-liberation-agent/.mcp.json b/packages/data-liberation-agent/.mcp.json
index 5b0c593718..5f7278ba45 100644
--- a/packages/data-liberation-agent/.mcp.json
+++ b/packages/data-liberation-agent/.mcp.json
@@ -1,9 +1,9 @@
{
"mcpServers": {
"data-liberation": {
- "command": "npx",
- "args": ["tsx", "${CLAUDE_PLUGIN_ROOT:-.}/src/mcp-server.ts"],
- "cwd": "${CLAUDE_PLUGIN_ROOT:-.}"
+ "command": "node",
+ "args": ["${CLAUDE_PLUGIN_ROOT}/scripts/mcp-launcher.mjs"],
+ "cwd": "${CLAUDE_PLUGIN_ROOT}"
}
}
}
diff --git a/packages/data-liberation-agent/AGENTS.md b/packages/data-liberation-agent/AGENTS.md
index f69a22ce81..a3d59429e9 100644
--- a/packages/data-liberation-agent/AGENTS.md
+++ b/packages/data-liberation-agent/AGENTS.md
@@ -50,6 +50,7 @@ When `adminToken` is present, `shopifyAdapter.extract` fetches products via the
## Non-obvious Details
- **MCP server runs `tsx src/mcp-server.ts` as ONE long-lived process — editing `src/` does NOT hot-reload it.** ESM modules are cached per process, so a re-called `liberate_*` tool keeps running the code that was loaded at server start. After editing handler/lib source, either restart the MCP server (so all callers pick it up) or, for a quick one-off re-run, drive the handler from a fresh `tsx` process (import the handler, pass a minimal `HandlerContext` with `textResult`/`errorResult`). Unit tests (`vitest`) always use the on-disk source, so they reflect edits immediately — the staleness is only the running MCP server.
+- **`.mcp.json` starts the MCP server through `scripts/mcp-launcher.mjs`: dev checkouts run `src/` via tsx; plugin installs run the COMMITTED bundle `dist/mcp-server.bundle.mjs`.** The launcher only uses the bundle when the package's dependencies don't resolve, so a dev environment never runs a stale dist. The bundle must be committed because plugin installs are plain git copies: Claude's installer restores npm deps only when a per-package `package-lock.json` exists (this workspace package has none), and Codex's installer NEVER restores deps — so `claude/codex plugin marketplace add Automattic/studio` only works with a prebuilt self-contained artifact in the tree. After changing `src/` or dependencies, regenerate with `npm run build:mcp-bundle` and commit the result — CI (Buildkite Lint) rebuilds it and fails on drift. `playwright` and `single-file-cli` stay external to the bundle (guarded dynamic imports that degrade with install guidance). See `scripts/build-mcp-bundle.mjs` for the import.meta.url asset-resolution seam.
- DLA consumes `@automattic/blocks-engine` through the local pre-publish override `"file:../blocks-engine/packages/blocks-engine"`; standalone `npm install` therefore needs the sibling `blocks-engine` checkout until the package is published. On publish, flip the dependency to the authorized semver range (for example `"^0.x.y"`). Publishing itself remains gated on explicit user authorization.
- **`tsx scripts/*.ts` that call `page.evaluate` must create the page via `newShimmedPage` from `scripts/_pw.ts`** — tsx's esbuild keepNames rewrites named functions to `__name(...)`, which is undefined in the browser context Playwright serializes into (`ReferenceError: __name is not defined`). The shim installs a `__name` identity via `addInitScript`. vitest-run code is unaffected (its transform doesn't keepNames).
- WXR builder targets WXR 1.2 spec compliance
diff --git a/packages/data-liberation-agent/CONTRIBUTING.md b/packages/data-liberation-agent/CONTRIBUTING.md
index bea13e04bd..2c767eee78 100644
--- a/packages/data-liberation-agent/CONTRIBUTING.md
+++ b/packages/data-liberation-agent/CONTRIBUTING.md
@@ -54,7 +54,7 @@ If you can't test against a real site, note that in the PR and explain what you
### 3. Add to DISCOVERIES.md
-This is required. Add a new entry at the top of [DISCOVERIES.md](./DISCOVERIES.md) in this format:
+This is required. DISCOVERIES.md is a local, untracked log (gitignored — it is not committed to the repo); create it at the package root if it doesn't exist yet. Add a new entry at the top in this format:
```markdown
## YYYY-MM-DD — Short title
diff --git a/packages/data-liberation-agent/DISCOVERIES.md b/packages/data-liberation-agent/DISCOVERIES.md
deleted file mode 100644
index 00e60a0aba..0000000000
--- a/packages/data-liberation-agent/DISCOVERIES.md
+++ /dev/null
@@ -1,1002 +0,0 @@
-# Discoveries
-
-A living log of findings from real migrations. Newest entries at the top.
-
-AI agents: when you contribute an improvement, add an entry here. See [CONTRIBUTING.md](./CONTRIBUTING.md) for the required format.
-
----
-
-## 2026-06-04 — getsnooz.com (Shopify) carry run: capture 429s, carry-path media-install timeout, carry-tool schema gap
-
-**Found by:** Claude + Matt
-**During:** A `/liberate` → theme-replication (carry-and-scope) pass on getsnooz.com (Shopify, ~99 URLs, 436 media).
-**Type:** capture reliability + install-path bug + fix + MCP schema fix
-
-### 1. CDP beats Shopify's 403, but capture concurrency 6 trips a 429 rate-limit
-Memory said "Shopify capture needs CDP (headless 403s)" — true: a real Chrome over `--remote-debugging-port` captured cleanly where headless got 403s. But the *first* run still failed **168 capture ops** with `HTTP 429 Too Many Requests`, all clustered ~2 min in: the **default screenshot concurrency (6) × 2 viewports** hammered the origin fast enough that Shopify's edge throttled every subsequent `goto`. The capture loop does `attempt: 1` with **no 429 retry/backoff**, so once throttled the rest of the run cascaded into manifest stubs (slug+capturedAt, no PNG). **Workaround:** resume `liberate_screenshot` at `concurrency: 2` → 90 captured, **0 failed**. **Open fix:** add 429-aware retry/backoff (honor `Retry-After`) to `screenshotter.ts`, and/or lower the default capture concurrency for Shopify origins. (Extends the prior "default to CDP for Shopify" note.)
-
-### 2. Carry-path media install hit the SAME Studio 120s timeout that import-wxr.php already fixed
-`liberate_reconstruct_pages_carry` returned `mediaInstalled: 0` with every entry erroring `install-media.php failed: … No activity for 120s`. Root cause is identical to the 2026-05-27 `import-wxr.php` finding below: `install-media.php` calls `wp_generate_attachment_metadata()` (thumbnail regen) per file and **emits no output until after the loop**, so a large media set (here the run's full 992-file map installed on the first page) runs silently past Studio's 120s IPC-silence kill — leaving carried `` on the source CDN (carry's "self-hosted media" promise broken). **Fix (applied, uncommitted):** mirror `import-wxr.php` in `src/lib/preview/scripts/install-media.php` — `add_filter('intermediate_image_sizes_advanced','__return_empty_array')` + a `WP_CLI::log` heartbeat inside the loop (printed before the `DLA_INSTALL_MEDIA_JSON_BEGIN` sentinel, so `media-install.ts`'s marker-delimited slice ignores it). Result after fix: **mediaInstalled 992, 0 errors**; homepage island went from all-CDN to 88 local `/wp-content/uploads/` refs (7 CDN left = known CSS-`url()` limit). Lesson: the thumbnail-skip + heartbeat pattern belongs in **every** vendored WP-CLI script that loops over media, not just `import-wxr.php`.
-
-### 3. `liberate_reconstruct_pages_carry` MCP schema under-declared `htmlSlug` + `postType`
-The handler reads `p.htmlSlug` (cached-HTML stem: `html/.html`) and `p.postType` (`page`|`post`), but the tool's `inputSchema.pages.items` only declared `slug`/`sourceUrl`/`title`/`isHome`. The server happens to pass args raw (no strip), so it worked — but the schema lied about the contract, and without `htmlSlug` every page (e.g. `about` whose file is `pages--about.html`) would silently fall back to a live fetch of `sourceUrl`. **Fix (applied):** added `postType` (enum page/post) + `htmlSlug` to the schema in `src/mcp-server.ts` so it matches the handler.
-
----
-
-## 2026-05-28 — corneliusholmes.com (Wix) re-run: content-width band layers + verify `__name` tooling bug
-
-**Found by:** Claude + Matt
-**During:** A second `/liberate` pass on corneliusholmes.com. After the prior fixes, content pages STILL rendered flat-white and every captured section `backgroundColor` was `rgb(255,255,255)`.
-**Type:** reconstruction fidelity + tooling bug
-
-### 1. Section bands missed because the colored layer is content-width, not full-bleed
-The descendant bg-layer scan in `section-extract.ts` (`pickEffectiveBg`) required the colored child to span **≥90% width AND ≥90% height**. A live DOM probe showed Wix paints each band's tint on an **~810px-of-1440 (~56%) inner column** beside a photo (peach `#fadcd6`, blue `#b6d1d9`, sage `#d5e1ca`, warm-grey `#f0eded`), so the ≥90%-width gate skipped them and the section recorded white. **Fix:** accept a *content-width band* — `width ≥ 50%` when it still spans `height ≥ 90%` of the section (full-height ⇒ it's the band, not a small card); largest-area still wins. 40/40 `section-extract.test.ts` pass. Re-extracting with `refresh:true` restored the pastel bands across all content pages. (Extends fix #5 below.)
-
-### 2. `liberate_replicate_verify` section-metrics crash: `__name is not defined`
-Every desktop capture's `measureReplicaSectionsInBrowser` `page.evaluate` threw `ReferenceError: __name is not defined` — esbuild/tsx's `keepNames` helper (`__name`) is referenced inside the function body but isn't defined in the page context. This silently disables the automated `SectionParity` live-DOM metrics, forcing QA onto the vision+pngjs fallback. **Still open** — the browser-evaluated function needs to be self-contained (no bundler-injected helpers). Screenshots themselves capture fine.
-
-### 3. Card-grid flatten (prior "still open") — hand-fixed per-page for the homepage
-The 3-card numbered service row and the two-tone My-Approach/About-Me blocks still flatten (geometry classifier reads them as `static`, no `cells[]`). For this run they were rebuilt as an R2 per-page `post_content` patch (3 peach cards in a columns row; peach+coral two-tone cards), and the homepage hero was rebuilt as a `wp:cover` (the captured hero `` src came back empty, so the structured render fell back to a black band with an invisible black-on-black title). The underlying **card-grid / cover-hero classifier** gap remains the right systemic fix.
-
----
-
-## 2026-05-28 — Visual-parity fixes from the corneliusholmes.com (Wix) rebuild: gapless sections, exact captured colors, fluid-off, suffix-tolerant font match, QA sampling
-
-**Found by:** Claude + Matt
-**During:** A long parity pass on the corneliusholmes.com homepage where the block reconstruction looked significantly different from the source (muddy/dark hero, saturated-wrong card colors, flattened tiles, white gaps between sections). Root retro → 5 systemic fixes.
-**Type:** reconstruction fidelity + scaffold defaults + QA workflow
-
-### What was wrong (and the meta-lesson)
-Core-block reconstruction re-derives a bespoke design with generic blocks and *inferred* values, and the agent compounded that by **guessing colors/sizes and declaring "parity" before measuring**. Almost every fix came from MEASURING the source (sampling screenshot pixels, reading the SectionSpec) instead of eyeballing. Treat that as the default: sample, don't guess; lead with the differences.
-
-### Fixes shipped
-1. **Suffix-tolerant captured-font matching** (`font-capture.ts` `matchCapturedFamily`). The capture pipeline derives a suffix-free family (`futura-lt-w01`) while the computed style carries a weight/style suffix or builder hash (`futura-lt-w01-book`, `avenir-lt-w01_35-light1475496`). The old EXACT match failed, so the substitution path wrongly fired and replaced the real self-hosted source font with Inter. Now falls back to comparing weight/style/hash-stripped base names. Also reordered `theme-scaffold.ts buildFontFamilies` so a real captured family beats the free substitute.
-2. **Fluid typography OFF for replicas** (`theme-scaffold.ts`). `settings.typography.fluid:true` silently rewrote the reconstruction's exact px sizes into shrinking `clamp()`s (a captured 36px heading rendered ~22px). Faithful px wins over fluid scaling.
-3. **Gapless full-bleed section stacking** (`page-reconstruct.ts wrapSection`). White gaps between sections came from WP's default top-level block-gap. Every section now zeroes its top/bottom margin so bands butt edge-to-edge; all vertical rhythm comes from each section's own captured padding (`padTopPx`/`padBottomPx`, which the spec already carried).
-4. **Paint the exact captured band color** (`page-reconstruct.ts`). A band now renders its real captured tint (e.g. pale-blue `#e8eff1`) instead of the generic `surface-raised` grey approximation. Guarded: near-white and low-alpha (<0.6) and near-neutral-grey tints fall back to the token (don't over-saturate).
-5. **Capture the band's real background from a full-span DESCENDANT layer** (`section-extract.ts` `pickEffectiveBg`). Page builders (Wix) paint a section's color on a full-span child (`colorUnderlay`/bgLayers) div, not the `` or its ancestors — so the own→ancestor→sibling walk reported the page white and missed the real band color. Added a geometry-based descendant scan (≥90% width AND height of the section) when own+ancestors give no color or near-white.
-6. **design-qa now samples + gates per-section** (`skills/design-qa/SKILL.md`). The skill must sample source-vs-replica pixels per band (colors, inter-section gaps, heading/body sizes), report a per-section delta table, and treat a high structural delta as disqualifying — not declare "matches" from vision alone.
-
-### Still open (next)
-- **Card-grid DETECTION.** The 3-card service row flattened to stacked text because the geometry classifier read it as flat `static` (so no `cells[]` were captured → no card bgs). The cell-bg walk already handles descendants; the gap is detecting the grid in the first place. Needs a stronger card-grid/hero-cover/pill-row/testimonial-grid classifier + `section-mapping` templates.
-- **Set the html-first expectation up front.** Core-block reconstruction can't pixel-match a bespoke Wix design (absolute positioning, full-bleed image backgrounds, container-query scaling). The skill should say so early and offer the carried-CSS html-first path when the user prioritizes pixel fidelity over editable blocks.
-
-### Verification
-`font-capture` / `theme-scaffold` / `font-substitution` (82), `page-reconstruct` / `validate-block-markup` / `compose-instantiate` (71), `section-extract` (40) unit suites pass, incl. new cases (suffix-tolerant match, gapless margins, exact-tint paint, grey-skip). Browser-eval (`pickEffectiveBg` descendant scan) needs a live re-extract to exercise; the MCP server must be restarted to pick up `src/` changes.
-
----
-
-## 2026-05-28 — Wix `/liberate`: scaffold drops valid captured fonts to Inter; updating post_content in a Studio site needs the VFS path
-
-**Found by:** Claude + Matt
-**During:** Migrating https://www.corneliusholmes.com/ (Wix therapy practice — 18 pages, 32 posts).
-**Type:** theme-scaffold behavior + Studio CLI operational gotcha
-
-### Finding 1 — `liberate_theme_scaffold` substituted self-hostable source fonts with a generic
-The source uses commercial Wix faces — **Futura LT** (display) and **Avenir LT** (body). The scaffold's font pipeline successfully downloaded BOTH as valid woff2 into `theme/assets/fonts/` (verified `file` → "Web Open Font Format (Version 2), TrueType"), yet `theme.json` bound the `body` AND `display` families to **Inter** via `fontSubstitutions` (`arial→Inter`, `futura-lt-w01-book→Inter`). Net effect: the source's geometric-display / humanist-body contrast collapses into one neutral face. The design-foundation's intended substitutes (Jost/Mulish) were also ignored.
-
-**Workaround this run:** hand-rebound `theme.json` `body`→`avenir-lt-w01_35-light1475496` and `display`→`futura-lt-w01` (the real captured woff2, with Jost/Mulish kept as fallback in the stack). Worth tightening the substitution logic: when a captured woff2 is present and valid, prefer self-hosting the real face (or the foundation's chosen substitute) over a generic Inter fallback. Note licensing — Futura/Avenir are commercial; fine for a local benchmark replica, flag for publication.
-
-### Finding 2 — `studio wp post update ` can only read files via the `/wordpress` VFS path
-QA edits to a page's `post_content` (re-carding the homepage service row) failed two ways before working:
-- `post update 208 /abs/host/path.html` → `Error: Unable to read content from '...'` (Studio's PHP sandbox can't see arbitrary host paths).
-- `post update 208 - < file.html` (STDIN) → reports `Success` but silently sets `post_content` to **empty** (the proxy doesn't forward stdin).
-
-**Working method:** copy the content file INTO the site dir (`~/Studio//`) and reference it by its VFS path — Studio mounts the site at `/wordpress`, so `studio wp --path post update /wordpress/`. This mirrors how `studio.ts` drives WXR import (`toVfsPath` + `eval-file`). Always verify with a follow-up `post get --field=post_content | wc -c` — the STDIN path's false success is the dangerous one.
-
-### Why it matters
-Both bite any agent-driven Wix replica: Finding 1 silently flattens type identity on sites whose fonts ARE capturable; Finding 2 can blank a reconstructed page during QA touch-ups while reporting success.
-
----
-
-## 2026-05-22 — `liberate_extract_one` clobbered the WXR (same bug as the 2026-04-30 resume fix, second site of)
-
-**Found by:** Claude + Matt
-**During:** Migrating https://www.swiftlumber.com/ — first full extract produced 6 pages; retrying the single failed `/projects` URL via `liberate_extract_one` left the WXR with only that one (failed) page, destroying the other 6.
-**Type:** extraction infrastructure bug
-
-### What I found
-The 2026-04-30 fix only patched the resume path of `liberate_extract` (`handlers/extract.ts`). `handlers/extract-one.ts` — the agent-first single-URL tool — has the *same* shape: it constructs a fresh `WxrBuilder`, extracts one URL into it, and calls `wxr.serialize(wxrPath)`, atomically overwriting whatever multi-page WXR was already there. Its own comment even flagged the limitation ("v1 extract-one writes a per-call WXR that the watch CLI is expected to merge if needed"), but when the tool is driven directly (not through the watch CLI's shared in-memory builder), nothing merges — so every `extract_one` against an existing extraction truncates it to one item.
-
-### How it's fixed
-Extracted the rehydrate-before-serialize logic into a shared helper `src/lib/extraction/wxr-rehydrate.ts` (`rehydrateBuilderFromWxr(wxr, wxrPath)`): reads the prior WXR, copies authors/categories/tags/terms/comments/redirects + non-`nav_menu_item` items onto the fresh builder, and reseeds `_nextId` past the largest retained id. `nav_menu_items` are dropped because the extraction loop regenerates them deterministically each run. Missing prior WXR → no-op; corrupt prior WXR → treated as a fresh start (builder untouched).
-
-- `extract.ts` now calls the helper on `args.resume` (replacing its inline block).
-- `extract-one.ts` calls it unconditionally — every `extract_one` is an append to an existing extraction.
-
-Covered by `wxr-rehydrate.test.ts` (merge/nav-drop/id-reseed, missing-file no-op, corrupt-file no-op) and `extract-one.test.ts` (prior pages survive a single-URL append). The latter reproduces the swiftlumber data loss: red before the fix (only `['new']` survived), green after (`['about','contact','home','new']`).
-
-### Why it matters
-`extract_one` is the agent-first streaming primitive — the orchestrator calls it repeatedly, once per URL. Pre-fix, any multi-call agent run kept only the *last* URL's item in the WXR. The bug was masked in the watch CLI (shared builder via `processOneUrl`) but active for every direct MCP/agent caller.
-
----
-
-## 2026-05-22 — Wix Pro Gallery pages fail extraction with "Execution context was destroyed"
-
-**Found by:** Claude + Matt
-**During:** Migrating https://www.swiftlumber.com/ — the `/projects` page (a "GALLERY" nav item) failed both in the full extract and on single-URL retry, identically: `page.evaluate: Execution context was destroyed, most likely because of a navigation`.
-**Type:** Wix adapter limitation
-
-### What I found
-`/projects` returns HTTP 200 (no server redirect) and is a Wix **Pro Gallery** page — `pro-gallery` appears ~876× in the served HTML, with `ProGallery` widgets and inline `window.location` / `location.href` handlers. During hydration the gallery fires a client-side navigation (route/lightbox state), which invalidates the JS execution context just as the adapter's in-page `page.evaluate` extraction script runs. Result: deterministic failure, no HTML capture, no screenshot, no content for that page. All other pages on the site extracted at high quality.
-
-### How it's fixed (2026-05-23)
-Layered defense in `src/adapters/wix.ts` so the page survives the navigation-destroys-context race instead of erroring out. All four layers were shipped because the failure is **intermittent and timing-dependent** (under concurrent load the gallery's deferred navigation lands mid-evaluate; in isolation it often doesn't fire at all) — no single layer is reliable on its own:
-
-1. **Route pinning before navigation.** `addInitScript(ROUTE_PIN_INIT_SCRIPT)` no-ops `history.pushState`/`replaceState` and swallows `location.assign`/`replace` writes for the page's lifetime, so the gallery can't navigate away during extraction. Best-effort (the native `location` setter can't always be overridden), installed inside try/catch.
-2. **Settle before evaluate.** `goto('domcontentloaded')` → bounded `waitForLoadState('networkidle')` (6s, best-effort — Wix telemetry never truly idles) → fixed 4s delay → a lazy-load scroll pass (so below-the-fold gallery thumbnails enter the DOM) → re-settle. This lets the gallery finish hydrating *before* we read it.
-3. **Retry once on destroyed context.** Every in-page `page.evaluate` (globals/JSON-LD/meta, rendered content, blog-archive probe) goes through `evaluateWithRetry`, which on a `isExecutionContextDestroyed(err)` match re-settles and re-runs the evaluate exactly once. The globals read — historically the *unguarded* call that crashed the whole URL — now degrades to an empty shell on a second failure instead of throwing.
-4. **Served-HTML fallback.** When the live path fails (or `page.content()` is unreadable), we plain-GET the URL (`fetchHtml`) and run `extractGalleryFromHtml`, which recovers the title, an og:description/heading content shell, and the gallery image URLs from full `static.wixstatic.com/media/...` links *and* the bare `~mv2.` media tokens in the `wix-warmup-data` JSON (promoted to canonical CDN URLs). This runs on every page (folding any token-derived URLs the live scan missed into `mediaUrls`), so a Pro Gallery page is never dropped entirely.
-
-New exported, unit-tested helpers: `isExecutionContextDestroyed`, `extractGalleryFromHtml`, `ROUTE_PIN_INIT_SCRIPT`. Covered by `test/adapters/wix-pro-gallery.test.ts` (12 tests, fixture `test/fixtures/wix-pro-gallery.html`): error-classification (matches Playwright + bare CDP phrasings, rejects unrelated errors), gallery image recovery (img src / background-image / og:image / warmup tokens, all normalized to absolute CDN URLs, de-duped), title-suffix stripping, content-shell assembly, and no-false-positives on plain markup.
-
-### Verified live (2026-05-23)
-Ran the real `wixAdapter.extract` against just `https://www.swiftlumber.com/projects`:
-- **No "execution context destroyed" error escaped** (`thrown: null`); URL logged as `processed` with `qualityScore: high`.
-- `pagesExtracted: 1, failed: 0`; WXR item `type: page`, `title: "GALLERY"`, content length 6419 with **25 `` tags** (descriptive alt text) plus heading/body text.
-- **72 media collected / 70 image files downloaded** (the gallery photos).
-- The served-HTML fallback, exercised in isolation against the live 1 MB markup with **zero JS execution**, independently recovered the title, a content shell, and **33 absolute gallery image URLs** — so even in the worst case (context destroyed, `page.content()` unreadable) the page still yields content + images.
-
-### Honest reliability assessment
-**Best-effort, not a guarantee — but the page is no longer dropped.** The live `page.evaluate` path now succeeds on the runs I observed (the destroyed-context error did not reproduce in isolation at the time of the fix; the site may hydrate faster now, or the race only triggers under the concurrent load of a full multi-page + screenshot run). Layers 1–3 widen the window where the live read succeeds; layer 4 guarantees that *if* the live read still fails, the page is salvaged from the served HTML (title + content shell + gallery image URLs) rather than failing the whole URL. The remaining gap vs. a clean live extract is **layout fidelity in the worst case**: the HTML fallback yields the images and a thin content shell, not the full rendered gallery markup. The images themselves — the gallery's actual value — are recovered in every path.
-
----
-
-## 2026-04-30 — `--resume` overwrites the existing WXR with only newly-extracted items
-
-**Found by:** Claude + James
-**During:** Migrating https://www.corneliusholmes.com/ — first run extracted 16 pages, the resume run for 2 remaining failures left only those 2 pages in the final WXR
-**Type:** extraction infrastructure bug
-
-### What I found
-The `liberate_extract` MCP handler in `src/mcp-server.ts` constructs a fresh `WxrBuilder` on every invocation and calls `wxr.serialize(wxrPath)` at the end, which `writeFileSync`s the WXR (overwriting whatever's there). The `runExtractionLoop` correctly filters URLs already in `extraction-log.jsonl` on `--resume`, so the in-memory builder ends each resume run with *only the newly-extracted items*. Serialize then atomically replaces the prior multi-item WXR with whatever was extracted this run.
-
-Concretely on the test site:
-- Run 1 (fresh): extracted 16 pages → `output.wxr` contains 16 pages.
-- Run 2 (`--resume`, retrying 2 previously-failed URLs): builder sees 2 new pages → `output.wxr` rewritten with 2 pages, the prior 16 destroyed.
-
-This makes resume worse than useless — it actively damages the prior output. The user thought they were extending the extraction; they were truncating it.
-
-### How it works
-On resume, rehydrate the `WxrBuilder` from the existing `output.wxr` *before* calling `adapter.extract`. The repo already has `readWxr` (`src/lib/extraction/wxr-reader.ts`) which produces typed `WxrItem[]` / `Author[]` / etc. matching the builder's public fields. Direct field assignment + reseed `_nextId` past the max existing ID.
-
-`nav_menu_item`s are dropped on load because the extraction loop regenerates them deterministically from the current inventory's navigation each run; keeping the prior ones would produce duplicates.
-
-```ts
-if (typedArgs.resume && existsSync(wxrPath)) {
- try {
- const prior = readWxr(wxrPath);
- wxr.authors = prior.authors;
- wxr.categories = prior.categories;
- wxr.tags = prior.tags;
- wxr.terms = prior.terms;
- wxr.comments = prior.comments;
- wxr.redirects = prior.redirects;
- wxr.items = prior.items.filter((i) => i.type !== 'nav_menu_item');
-
- let maxId = 0;
- for (const it of wxr.items) maxId = Math.max(maxId, it.id);
- // ...same for authors/categories/tags/terms/comments
- wxr._nextId = maxId + 1;
- } catch {
- // Corrupt prior WXR: fall through and treat as a fresh run.
- }
-}
-```
-
-### Why it's better than the previous approach
-Before: `--resume` was destructive — every resume run shrank the WXR to whatever was extracted in that single invocation, even though the underlying log correctly recorded all prior URLs as processed. Users who hit per-page failures and re-ran lost the bulk of their extraction silently.
-After: resume is genuinely incremental — prior items survive, only new URLs are added, the WXR grows monotonically until extraction is complete.
-
-
-## 2026-04-28 — Wix authenticated content endpoints — catalogue
-
-**Found by:** Claude + human contributor
-**During:** Mapping Wix's authenticated traffic during a parallel Wix
-migration project; needed a reference for the *content* endpoints (vs.
-the dashboard infrastructure endpoints already documented)
-**Type:** API endpoint | content type
-
-### What I found
-The 2026-03-31 *Wix Dashboard API reverse engineering via CDP* entry
-covers auth (cookie + XSRF + per-app JWT), window globals, and the
-infrastructure endpoints a Wix dashboard hits at load (account,
-premium-status, feature-flag, alerts, etc.). What it does not
-catalogue is the ten *content* endpoints a logged-in editor or
-dashboard hits to read the data the public renderer doesn't expose:
-CMS Data Collections including drafts, contacts, members, full-variant
-products, form submissions, bookings, blog drafts with Ricos
-`richContent` source, full-resolution media originals, and hidden /
-password-protected pages.
-
-### How it works
-Added a new reference doc at `docs/wix-content-endpoints.md` listing
-the ten endpoints with URL, response shape, what public scraping
-misses, and per-endpoint gotchas (e.g. CMS items needing
-`SANDBOX_PREFERRED` + `includeDraftItems: true` for drafts; signed
-media URLs expiring in ~10 minutes; Stores `manageVariants` true/false
-branching; three distinct forms-product variants). Linked from
-`README.md`.
-
-### Why it's better than the previous approach
-Today's adapter relies entirely on rendered HTML + JSON-LD +
-opportunistic API capture from public navigation. The reference doc
-gives future contributors a baseline of "here's what exists behind
-auth, here's what each endpoint returns, here are the traps" — so
-subsequent authenticated-mode work doesn't restart from scratch.
-
-## 2026-04-28 — Wix splits hosted media across three CDN hosts
-
-**Found by:** Claude + human contributor
-**During:** Migrating Wix sites; noticed platform assets (icons,
-decorative imagery) weren't being downloaded
-**Type:** platform quirk
-
-### What I found
-All Wix-hosted media uses one of three CDN hostnames:
-
-- `static.wixstatic.com` — images, documents (the well-known one)
-- `static.parastorage.com` — platform assets: icons, decorative
- imagery, pattern fills used by Wix templates
-- `video.wixstatic.com` — video content (already covered by the
- existing `wixstatic.com` term)
-
-The image-CDN regex in `extractImageUrls()` only matched
-`wixstatic.com` / `wixmp.com`. `parastorage.com` was silently dropped
-during the "only keep image-looking URLs" filter, so platform
-decorative assets never made it into the media-download set.
-
-### How it works
-Add `parastorage\.com` to the `imageCdns` regex inside
-`extractImageUrls()` in `src/adapters/wix.ts`. Comment documents all
-three hosts so the next reader doesn't have to re-discover them.
-
-### Why it's better than the previous approach
-Before: any URL on `static.parastorage.com` was filtered out unless it
-also passed the file-extension check, missing extension-less or
-query-param-styled CDN URLs. After: all three Wix CDN hosts are
-recognised consistently.
-
-## 2026-04-28 — Wix appends " Main" to every site name
-
-**Found by:** Claude + human contributor
-**During:** Migrating multiple Wix sites; noticed every WordPress import
-ended up with a site title like "My Studio Main"
-**Type:** platform quirk
-
-### What I found
-Wix's editor appends a literal " Main" suffix to every site's name. It
-shows up in two places:
-
-- `` content ends in " Main" (e.g.
- "Gilded Carat Main")
-- `document.title` follows the pattern `Page Title | Site Name Main`
-
-The suffix is a Wix internal label (probably the default page-set
-name, "Main"). It is never part of the agency's actual site name.
-
-### How it works
-At the homepage `siteTitle` extraction site in `discover()`, take the
-substring after the last ` | ` and strip a trailing ` Main`:
-
-```js
-const t = document.title;
-const pipeIdx = t.lastIndexOf(' | ');
-const sitePart = pipeIdx > 0 ? t.slice(pipeIdx + 3).trim() : t;
-return sitePart.replace(/ Main$/, '').trim();
-```
-
-The per-page title stripping in `runExtractionLoop` (slice everything
-after ` | `) already handles per-page titles correctly — the trailing
-" Main" suffix goes with the site-name half. The bug was site-level
-only.
-
-### Why it's better than the previous approach
-Before: WordPress imports landed with site titles like
-"Home | Gilded Carat Main". After: clean "Gilded Carat".
-
-## 2026-04-28 — Wix product pages expose stable `data-hook` selectors
-
-**Found by:** Claude + human contributor
-**During:** Migrating Wix Stores sites where JSON-LD was malformed or
-missing AND the products API call hadn't been captured during navigation
-**Type:** platform quirk | content type
-
-### What I found
-Wix product pages tag key elements with `data-hook="..."` attributes
-that have been stable across every Wix Stores site we've tested. When
-JSON-LD is missing or malformed *and* the products API call hasn't
-been captured, the rendered DOM is still extractable via these hooks —
-no need to give up on the product.
-
-| Element | Selector |
-|---|---|
-| Product title | `[data-hook="product-title"]` |
-| Product price (clean) | `[data-hook="formatted-primary-price"]` |
-| Product price (wrapper, includes SR "Price") | `[data-hook="product-price"]` |
-| Product gallery root | `[data-hook="product-gallery-root"]` |
-| Main product image | `[data-hook="main-media-image-wrapper"] img` |
-| Thumbnail images | `[data-hook="thumbnail-image"] img` |
-| Product description | `[data-hook="product-description"]` |
-| Product options | `[data-hook="product-options"]` |
-
-The `[data-hook="product-price"]` wrapper contains a screen-reader span
-(`[data-hook="sr-formatted-primary-price"]`) with the literal word
-"Price" — use `[data-hook="formatted-primary-price"]` for the clean
-value.
-
-### How it works
-Added a third fallback path in `extractWixProduct()` after the
-JSON-LD and captured-API paths. When both upstream paths fail, parse
-the rendered HTML using the hooks above. Required adding an optional
-`pageHtml` field to `PageData` so the raw HTML (already captured for
-media-URL extraction) is available to the product extractor.
-
-### Why it's better than the previous approach
-Before: `extractWixProduct()` returned `null` whenever JSON-LD was
-missing AND the product API call wasn't captured (e.g. cached
-navigation, slow hydration, throttled requests). After: name, price,
-description, and gallery images recover from the rendered DOM —
-typically the worst-case path that still yields a usable product
-record.
-
-
-## 2026-04-28 — Wix's `networkidle` never resolves; use `domcontentloaded` + delay
-
-**Found by:** Claude + human contributor
-**During:** Building a Wix → WordPress.com migration tool against ~12 live Wix sites
-**Type:** platform quirk | bug fix
-
-### What I found
-Using `page.goto(url, { waitUntil: 'networkidle' })` against Wix sites
-times out on roughly half of product pages. Wix's analytics, chat
-widgets, and tracking pixels keep firing requests indefinitely, so the
-network never goes idle inside the 30s budget.
-
-### How it works
-Switch the wait strategy from `networkidle` to `domcontentloaded` and
-add a fixed `await p.waitForTimeout(4000)` afterwards. The 4s delay
-covers Wix's client-side hydration of lazy content (Thunderbolt
-rendering engine). Applied at all three navigation sites in the Wix
-adapter (page extraction, homepage crawl fallback, navigation
-extraction).
-
-### Why it's better than the previous approach
-Validated empirically across multiple live Wix sites: with
-`networkidle`, ~50% of product pages timed out and emitted partial or
-empty extractions. With `domcontentloaded` + 4s delay, the same pages
-extract reliably and the 30s budget is no longer exhausted by
-background telemetry.
-
-## 2026-04-17 — Dedupe Wix URLs across child sitemaps
-
-**Found by:** Claude + human contributor
-**During:** Testing the Wix adapter against a range of live Wix sites
-**Type:** bug fix
-
-### What I found
-
-`fetchSitemapPw()` pushed every non-XML URL found in each sitemap child into a flat `sitemapUrls` array with no deduplication. Wix sites commonly list the same URL in multiple child sitemaps — most often `/blog` appears in both `pages-sitemap.xml` (as a regular site page) and `blog-categories-sitemap.xml` (as the blog category index). The URL then gets processed twice, and the WXR ends up with two items sharing the same slug, which breaks WordPress import (the importer either rejects the second or silently appends a suffix, leaving inconsistent URLs).
-
-Observed on roughly 24% of tested sites — always the same `/blog` duplication pattern.
-
-### How it works
-
-Added two dedupe Sets in `discover()`:
-
-```ts
-const seenUrls = new Set();
-const seenSitemaps = new Set();
-
-async function fetchSitemapPw(sitemapUrl, depth = 0) {
- if (depth > 3) return;
- if (seenSitemaps.has(sitemapUrl)) return;
- seenSitemaps.add(sitemapUrl);
- // …existing fetch / parse…
- for (const loc of locs) {
- if (loc.endsWith('.xml')) {
- await fetchSitemapPw(loc, depth + 1);
- } else if (!seenUrls.has(loc)) {
- seenUrls.add(loc);
- sitemapUrls.push(loc);
- }
- }
-}
-```
-
-`seenUrls` rejects identical URLs across sibling sitemaps. `seenSitemaps` prevents re-fetching a sitemap index file if it appears more than once (defensive — not observed during testing but cheap to add).
-
-### Why it's better than the previous approach
-
-Tested on an affected site after the fix: the WXR no longer contains two items with `slug=blog`. Content coverage unchanged — the URL is still extracted, just once.
-
----
-
-## 2026-04-17 — Dedupe Wix URLs across child sitemaps
-
-**Found by:** Claude + human contributor
-**During:** Testing the Wix adapter against a range of live Wix sites
-**Type:** bug fix
-
-### What I found
-
-`runExtractionLoop()` in `src/adapters/shared.ts` had a type-promotion fallback: if `classifyUrl()` returned `page` or `homepage`, it would re-check via a regex `/@type.*BlogPosting|NewsArticle|Article|SocialMediaPosting/` run across the full `pageData.content` string. Any occurrence anywhere in the HTML promoted the item to `post`.
-
-The problem: blog *listing* pages (`/blog--categories--X`, `/blog`) commonly embed `BlogPosting` JSON-LD cards for each post they display in their index. The regex happily matched those embedded cards and promoted the listing page to `post` — producing authorless "posts" in the WXR whose content was a list of links to other posts. Observed on multiple tested sites: one jewellery ecommerce site had 6 of 15 "posts" misclassified; an interior-design blog had 11 of 96; a furniture store had 2 of 7.
-
-### How it works
-
-Replaced the raw-content regex with a structured check using `pageData.jsonLd` (the array of already-parsed JSON-LD objects the adapter returned):
-
-```ts
-const BLOG_TYPES = new Set(['BlogPosting', 'NewsArticle', 'Article', 'SocialMediaPosting']);
-const isRealBlogPost = Array.isArray(pageData.jsonLd) && pageData.jsonLd.some((ld) => {
- if (!ld || typeof ld !== 'object') return false;
- const obj = ld as Record;
- const atType = obj['@type'];
- if (typeof atType !== 'string' || !BLOG_TYPES.has(atType)) return false;
- const mep = obj.mainEntityOfPage;
- if (mep && typeof mep === 'object') {
- const mepRec = mep as Record;
- const mepUrl = typeof mepRec.url === 'string' ? mepRec.url :
- typeof mepRec['@id'] === 'string' ? mepRec['@id'] as string : null;
- if (mepUrl && mepUrl !== url) return false;
- }
- return true;
-});
-```
-
-Two tightenings: (1) `@type` must be at the top level of a JSON-LD object, not anywhere in the raw HTML; (2) when `mainEntityOfPage` is present, its URL must match the current page URL — so embedded-card JSON-LD (whose `mainEntityOfPage` points to *other* posts) can't promote the current page.
-
-Also added `jsonLd?: unknown[]` to the `ExtractedPage` interface and piped `pageData.jsonLd` through the Wix adapter's `extractPage` callback so the shared loop has the parsed objects available.
-
-### Why it's better than the previous approach
-
-Tested on a food-blog site alongside the sibling URL-classifier fix that stops bare `/blog` from classifying as `post`: the `/blog` listing page is now correctly a `page` with its listing content, and no longer promoted to a post by its embedded BlogPosting cards for indexed posts.
-
-## 2026-04-17 — Wix sitemap discovery silently loses child sitemaps under CDN pressure
-
-**Found by:** Claude + human contributor
-**During:** Testing the Wix adapter against multiple live sites in parallel
-**Type:** bug fix
-
-### What I found
-
-`fetchSitemapPw()` in the Wix adapter's `discover()` wrapped `p.goto(sitemapUrl)` in `try { … } catch { /* sitemap fetch failed */ }` with a silent early-return on `!resp.ok()`. When Playwright timed out or the Wix CDN returned a transient error on a child sitemap (e.g. `pages-sitemap.xml`, `blog-posts-sitemap.xml`), the failure was swallowed — no log, no retry, no end-of-discovery warning. The extraction proceeded with whatever URLs happened to arrive before the failure, producing a WXR with (often) zero real pages.
-
-Observed on roughly 20% of sites during parallel-worker testing: several produced zero-content WXRs outright (media downloaded, pages empty), while others had `pages-sitemap.xml` children silently skipped while other sitemaps (store-products, blog-posts) went through.
-
-Re-running the affected sites sequentially (outside the parallel run) extracted them cleanly — confirming the failures were transient, not deterministic, and the old code gave the user no way to know they'd lost data.
-
-### How it works
-
-Wrapped the `p.goto` call in an up-to-3-attempt retry loop with exponential backoff (500ms × attempt number):
-
-```ts
-const RETRIES = 3;
-for (let attempt = 1; attempt <= RETRIES; attempt++) {
- try {
- const resp = await p.goto(sitemapUrl, { timeout: 15000 });
- if (!resp || !resp.ok()) {
- lastErr = resp ? 'HTTP status-not-ok' : 'no response';
- if (attempt < RETRIES) { await sleep(500 * attempt); continue; }
- console.warn(`[wix:discover] sitemap fetch failed after ${RETRIES} attempts: ${sitemapUrl} (${lastErr})`);
- sitemapFailures.push({ url: sitemapUrl, reason: lastErr });
- return;
- }
- // …parse and recurse as before, then `return` on success
- } catch (err) {
- // …same retry pattern on thrown errors
- }
-}
-```
-
-On final failure the URL + reason is logged via `console.warn` and appended to a `sitemapFailures` array. After the recursive discovery completes, an end-of-phase summary warns if any fetches failed — so the operator sees that inventory may be incomplete rather than silently getting partial data.
-
-### Why it's better than the previous approach
-
-Tested on a small Wix business site with a dry run (clean discovery, no retries needed). The previous silent-failure behavior turned transient network blips or CDN rate-limits into silent data loss; now the same blips are retried and — if persistent — surfaced as visible warnings.
-
-
-
-## 2026-04-17 — Site-level JSON-LD leaks into Wix category-page content
-
-**Found by:** Claude + human contributor
-**During:** Testing the Wix adapter against a range of live Wix sites
-**Type:** bug fix
-
-### What I found
-
-`deriveContent()` step 3 accepted `description` from *any* JSON-LD object on the page. Wix ecommerce templates commonly include a site-level JSON-LD block — `@type: "FurnitureStore"`, `"Organization"`, `"LocalBusiness"`, `"Restaurant"`, etc. — whose `description` field is a generic store tagline written once by the site owner. Every page that falls through to step 3 (Wix category archives whose product grids are JS-rendered, for example) ends up with the same site-wide tagline as its body content.
-
-Observed on a tested furniture-store site: 49 of 58 pages (84%) had the identical 266-character site-tagline as `` — because each `/category/…` page has no static content (the product grid is rendered client-side) so derivation fell through API → DOM → and grabbed the `FurnitureStore` JSON-LD description. When imported to WordPress, the category pages are indistinguishable.
-
-### How it works
-
-Two changes to `deriveContent()`:
-
-1. **`@type` allow-list for JSON-LD description**: introduced `CONTENT_LD_TYPES = {Article, BlogPosting, NewsArticle, SocialMediaPosting, Product, ItemPage, Event, Recipe, Course, Book, Movie}`. The JSON-LD `description` fallback now only accepts a match whose top-level `@type` is in the allow-list. `articleBody` remains universally accepted (it's inherently content-level).
-
-2. **`og:description` fallback** (new step 4): when steps 1–3 fail, use `pageData.meta.ogDescription || pageData.meta.description` if ≥ 50 chars. `og:description` is per-page (written by the site owner for sharing), so pages that share the old site-level fallback now carry their own per-page description instead.
-
-The accessibility-tree fallback moves from step 4 to step 5; empty from 5 to 6.
-
-### Why it's better than the previous approach
-
-Tested on two category pages from the affected site: both now derive content from `og:description` instead of the shared `FurnitureStore` block, so the category pages produce distinct content rather than identical boilerplate.
-
----
-
-## 2026-04-17 — Wix API responses leak ``/`` tags as page content
-
-**Found by:** Claude + human contributor
-**During:** Testing the Wix adapter against a range of live Wix sites
-**Type:** bug fix
-
-### What I found
-
-`deriveContent()` in the Wix adapter tries API-call responses first, using `findHtmlContent()` to walk JSON bodies for keys named `html`/`richText`/`body`/`content`/`text`/`plainText` containing HTML-like strings. The existing validator (after the earlier tag-manager fix) strips ``:null}var tu=3,Mvt=30,Pvt=/\b(\d{4}-\d{2}-\d{2}|(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)[a-z]*\.?\s+\d{1,2},?\s*\d{4}|(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)[a-z]*\.?\s+\d{1,2})\b/i,Lvt="html,body,main,section";function NR(e,t){let r=e(t).children().toArray().map(n=>n.tagName?.toLowerCase()).filter(n=>!!n).sort();return`${t.tagName.toLowerCase()}>${r.join(",")}`}function Fvt(e,t){let r=[],n=i=>{for(let s of e(i).children().toArray())r.push(s),n(s)};return n(t),r}function MR(e,t){let r=e.parent;for(;r;){if(r===t)return!0;r=r.parent}return!1}function Ovt(e,t){let r=i=>{let s=[],o=i;for(;o&&o.type==="tag";)s.push(o),o=o.parent;return s},n=new Set(r(e));for(let i of r(t))if(n.has(i))return i;return null}function Uvt(e,t){let r=new Map;for(let a of t){let c=a.parent;if(!c||c.type!=="tag")continue;let u=r.get(c)??[];u.push(a),r.set(c,u)}let n=[],i=[];for(let[a,c]of r)c.length>=tu?n.push({cards:[...c],container:a}):i.push(...c);if(n.length===0)return t.length>=tu?[t]:[];for(let a of i){let c=null;for(let u of n){let l=Ovt(a,u.container);l&&(!c||MR(l,c.ancestor))&&(c={grid:u,ancestor:l})}c&&(c.grid.cards.push(a),c.grid.container=c.ancestor)}let s=e("*").toArray(),o=new Map(s.map((a,c)=>[a,c]));return n.map(a=>a.cards.sort((c,u)=>(o.get(c)??0)-(o.get(u)??0)))}function $vt(e,t){let r=e(t).attr("id");if(r&&e(`#${Hvt(r)}`).length===1)return`#${r}`;let n=[],i=t;for(;i&&i.type==="tag";){let s=e(i).attr("id");if(s){n.unshift(`#${s}`);break}let o=i.tagName.toLowerCase(),a=e(i).prevAll(o).length+1;n.unshift(`${o}:nth-of-type(${a})`),i=i.parent}return n.join(" > ")}function Hvt(e){return e.replace(/[^a-zA-Z0-9_-]/g,t=>`\\${t}`)}function CV(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function pxe(e,t){let r=e(t),n=r.find("h1,h2,h3,h4,h5,h6").length>0||r.find('[class*="title" i],[class*="headline" i]').length>0,i=r.find("img[src],source[srcset]").length>0||!!r.find('[style*="background-image" i]').attr("style"),s=r.find("a[href]").toArray().some(a=>e(a).text().trim().length>0),o=r.text().replace(/\s+/g," ").trim().length;return n&&(i||s)&&o>=20}function DR(e){let t=e.find("h1,h2,h3,h4,h5,h6").first();return t.length&&t.text().trim()?t.text().replace(/\s+/g," ").trim():e.find('[class*="title" i],[class*="headline" i]').first().text().replace(/\s+/g," ").trim()}function jvt(e,t){return e(t).children("h1,h2,h3,h4,h5,h6").first().text().replace(/\s+/g," ").trim()}function qvt(e){let t=e.find("img[src]").first().attr("src");if(t)return t;let n=(e.find('[style*="background-image" i]').first().attr("style")??"").match(/url\(\s*['"]?([^'")]+)['"]?\s*\)/i);return n?n[1]:""}function zvt(e,t){let r=e(t);return r.is('[class*="cat" i],[class*="tag" i]')||r.closest('[class*="cat" i],[class*="tag" i]').length>0?1:0}function RR(e,t,r){let n=e(t),i=DR(n),s=n.find("h1,h2,h3,h4,h5,h6").first().find("a[href]").first().attr("href"),o=n.find("a[href]").toArray().map(A=>e(A).attr("href")).find(Boolean),a=s??o??"",c=qvt(n),u=n.find("p").first().text().replace(/\s+/g," ").trim(),d=(n.find("time").first().text().trim()||(n.text().match(Pvt)?.[0]??"")).trim(),p=n.find("a[href]").toArray().map((A,g)=>({href:e(A).attr("href")??"",text:e(A).text().replace(/\s+/g," ").trim(),order:g,score:zvt(e,A)})).filter(A=>A.text&&A.text!==i&&A.href!==a&&A.text.length<=Mvt).sort((A,g)=>g.score-A.score||A.order-g.order)[0]?.text??"";return{id:CV(i)||CV(a.replace(/\.[a-z]+$/i,""))||`card-${r+1}`,title:i,excerpt:u,image:c,category:p,date:d,link:a,meta:{}}}function IV(e,t,r){let n=le(e.html(t),void 0,!1),i=n.root().children().first();if(r.title){let o=i.find("h1,h2,h3,h4,h5,h6").first(),a=o.find("a[href]").first().length?o.find("a[href]").first():o;a.length&&a.attr("data-dla-text","title").text("")}if(r.excerpt){let o=i.find("p").toArray().find(a=>n(a).text().replace(/\s+/g," ").trim()===r.excerpt);o&&n(o).attr("data-dla-text","content").text("")}if(r.category){let o=i.find("a[href]").toArray().find(a=>n(a).text().replace(/\s+/g," ").trim()===r.category);o&&n(o).attr("data-dla-text","cat.label").text("")}if(r.date){let o=i.find("time").first();if(o.length)o.attr("data-dla-text","meta.date").text("");else{let a=i.find("span").toArray().find(c=>n(c).text().replace(/\s+/g," ").trim()===r.date);a&&n(a).attr("data-dla-text","meta.date").text("")}}if(r.image){let o=i.find("img[src]").first();o.length&&o.attr("data-dla-attr","src:meta.image").removeAttr("src")}let s=(o,a)=>{let c=o.attr("data-dla-attr");o.attr("data-dla-attr",c?`${c},${a}`:a)};if(r.link&&i.find("a[href]").toArray().forEach(o=>{(n(o).attr("href")??"")===r.link&&s(n(o),"href:permalink")}),r.category){let o=i.find('[data-dla-text="cat.label"]').first();o.length&&o.is("a[href]")&&s(o,"href:cat.url")}return(n.html(i)??"").trim()}function Vvt(e,t,r){let n=r.filter(l=>l.parent===t),i=r.filter(l=>l.parent!==t),s=new Map;for(let l of i){let d=l.parent;if(!d||d.type!=="tag")continue;let f=s.get(d)??[];f.push(l),s.set(d,f)}if(n.length<1||s.size!==1)return;let[[o,a]]=[...s.entries()];if(a.length<2||n.length+a.length!==r.length||!MR(o,t)||r.includes(o))return;let c=[...n,...a].map(l=>CV(RR(e,l,0).category)).filter(Boolean),u=c.length>0&&c.every(l=>l===c[0])?c[0]:void 0;return{leadCount:n.length,columnWrapperClass:(e(o).attr("class")??"").trim(),leadTemplate:IV(e,n[0],RR(e,n[0],0)),rowTemplate:IV(e,a[0],RR(e,a[0],0)),...u?{termSlug:u}:{}}}function Gvt(e,t,r,n){let i=Zvt(e,t),s=$vt(e,i),o=(e(i).attr("class")??"").trim(),a=t.filter(g=>pxe(e,g));if(a.lengthRR(e,g,m)),u=c.map(g=>{let m={id:g.id,title:g.title,link:g.link,excerpt:g.excerpt};g.image&&(m.image=g.image),g.category&&(m.category=g.category),g.date&&(m.date=g.date);for(let[b,E]of Object.entries(g.meta))m[`meta_${b}`]=E;return m}),l=new Map;for(let g of c)g.link&&l.set(g.link,(l.get(g.link)??0)+1);for(let g=0;g1:!1,E=c[g].excerpt;if(n.resolvePage&&m&&!b)try{let C=n.resolvePage(m);if(C){let I=QR(C);I&&I.trim()&&(E=I)}}catch{}u[g].content=E}let d=[...l.entries()].filter(([,g])=>g>1).map(([g])=>g),f=d.length?` shared-target(single-template)=${d.join(",")}`:"",p=c.every(g=>g.title),h=IV(e,a[0],c[0]),A=Vvt(e,i,a);return{containerSelector:s,containerClass:o,records:u,cardTemplate:h,...A?{featured:A}:{},confidence:p&&h?"high":"low",evidence:`signature=${r} cards=${a.length} roles=title,excerpt,image,category,date,link${f}`}}function Wvt(e){let t=new Map;for(let r of e){let n=t.get(r.sig)??{sig:r.sig,candidates:[],richCards:[]};n.candidates.push(r);for(let i of r.richCards)n.richCards.includes(i)||n.richCards.push(i);t.set(r.sig,n)}return[...t.values()]}function fxe(e,t){return e.map(r=>t.filter(n=>MR(n,r)).length)}function Yvt(e,t,r){let n=0,i=!1;for(let s of t){let o=r.filter(u=>MR(u,s));if(o.length===0)continue;if(o.length!==1)return"none";let a=DR(e(s)),c=DR(e(o[0]));a&&c&&a!==c&&(i=!0),n+=1}return nc>=tu)&&r.add(s)}for(let s of i)for(let o of i){if(s===o||fxe(s.richCards,o.richCards).reduce((l,d)=>l+d,0)!==o.richCards.length)continue;let u=Yvt(e,s.richCards,o.richCards);u==="part"?n.add(o.sig):u==="wrapper"&&s.candidates.forEach(l=>r.add(l))}return t.filter(s=>!r.has(s)&&!n.has(s.sig))}function Zvt(e,t){let r=t[0].parent;return r&&r.type==="tag"&&!e(r).is(Lvt)?r:Kvt(e,t)?t[0]:r??t[0]}function Kvt(e,t){if(t.lengthn.parent).filter(n=>!!n))];return r.lengthn.tagName?.toLowerCase()!=="section")||r.some(n=>t.filter(i=>i.parent===n).length!==1)?!1:t.some(n=>{let i=jvt(e,n.parent),s=DR(e(n));return!!(i&&s&&i!==s)})}function wV(e,t={}){let r=le(e),n=r("body")[0],i=n?Fvt(r,n):[],s=new Map;for(let l of i){if(r(l).children().length===0)continue;let d=NR(r,l),f=s.get(d)??[];f.push(l),s.set(d,f)}let o=[];for(let[l,d]of s)if(!(d.length=tu&&o.push({cards:f,sig:l});let a=o.map(l=>({...l,richCards:l.cards.filter(d=>pxe(r,d))})).filter(l=>l.richCards.length>=tu),c=Jvt(r,a),u=[];for(let{cards:l,sig:d}of c){let f=Gvt(r,l,d,t);f.records.length>0&&u.push(f)}return u}var Xvt=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,78,5,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,199,7,137,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,55,9,266,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239],bxe=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,7,25,39,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,5,57,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,24,43,261,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,208,30,2,2,2,1,2,6,3,4,10,1,225,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],ext="\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65",Exe="\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",SV={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},vV="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",txt={5:vV,"5module":vV+" export import",6:vV+" const class extends export import super"},Cxe=/^in(stanceof)?$/,rxt=new RegExp("["+Exe+"]"),nxt=new RegExp("["+Exe+ext+"]");function BV(e,t){for(var r=65536,n=0;ne)return!1;if(r+=t[n+1],r>=e)return!0}return!1}function ru(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&rxt.test(String.fromCharCode(e)):t===!1?!1:BV(e,bxe)}function Zd(e,t){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&nxt.test(String.fromCharCode(e)):t===!1?!1:BV(e,bxe)||BV(e,Xvt)}var Sr=function(t,r){r===void 0&&(r={}),this.label=t,this.keyword=r.keyword,this.beforeExpr=!!r.beforeExpr,this.startsExpr=!!r.startsExpr,this.isLoop=!!r.isLoop,this.isAssign=!!r.isAssign,this.prefix=!!r.prefix,this.postfix=!!r.postfix,this.binop=r.binop||null,this.updateContext=null};function ma(e,t){return new Sr(e,{beforeExpr:!0,binop:t})}var ya={beforeExpr:!0},ro={startsExpr:!0},QV={};function Ar(e,t){return t===void 0&&(t={}),t.keyword=e,QV[e]=new Sr(e,t)}var x={num:new Sr("num",ro),regexp:new Sr("regexp",ro),string:new Sr("string",ro),name:new Sr("name",ro),privateId:new Sr("privateId",ro),eof:new Sr("eof"),bracketL:new Sr("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new Sr("]"),braceL:new Sr("{",{beforeExpr:!0,startsExpr:!0}),braceR:new Sr("}"),parenL:new Sr("(",{beforeExpr:!0,startsExpr:!0}),parenR:new Sr(")"),comma:new Sr(",",ya),semi:new Sr(";",ya),colon:new Sr(":",ya),dot:new Sr("."),question:new Sr("?",ya),questionDot:new Sr("?."),arrow:new Sr("=>",ya),template:new Sr("template"),invalidTemplate:new Sr("invalidTemplate"),ellipsis:new Sr("...",ya),backQuote:new Sr("`",ro),dollarBraceL:new Sr("${",{beforeExpr:!0,startsExpr:!0}),eq:new Sr("=",{beforeExpr:!0,isAssign:!0}),assign:new Sr("_=",{beforeExpr:!0,isAssign:!0}),incDec:new Sr("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new Sr("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:ma("||",1),logicalAND:ma("&&",2),bitwiseOR:ma("|",3),bitwiseXOR:ma("^",4),bitwiseAND:ma("&",5),equality:ma("==/!=/===/!==",6),relational:ma(">/<=/>=",7),bitShift:ma("<>>/>>>",8),plusMin:new Sr("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:ma("%",10),star:ma("*",10),slash:ma("/",10),starstar:new Sr("**",{beforeExpr:!0}),coalesce:ma("??",1),_break:Ar("break"),_case:Ar("case",ya),_catch:Ar("catch"),_continue:Ar("continue"),_debugger:Ar("debugger"),_default:Ar("default",ya),_do:Ar("do",{isLoop:!0,beforeExpr:!0}),_else:Ar("else",ya),_finally:Ar("finally"),_for:Ar("for",{isLoop:!0}),_function:Ar("function",ro),_if:Ar("if"),_return:Ar("return",ya),_switch:Ar("switch"),_throw:Ar("throw",ya),_try:Ar("try"),_var:Ar("var"),_const:Ar("const"),_while:Ar("while",{isLoop:!0}),_with:Ar("with"),_new:Ar("new",{beforeExpr:!0,startsExpr:!0}),_this:Ar("this",ro),_super:Ar("super",ro),_class:Ar("class",ro),_extends:Ar("extends",ya),_export:Ar("export"),_import:Ar("import",ro),_null:Ar("null",ro),_true:Ar("true",ro),_false:Ar("false",ro),_in:Ar("in",{beforeExpr:!0,binop:7}),_instanceof:Ar("instanceof",{beforeExpr:!0,binop:7}),_typeof:Ar("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:Ar("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:Ar("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},no=/\r\n?|\n|\u2028|\u2029/,ixt=new RegExp(no.source,"g");function b0(e){return e===10||e===13||e===8232||e===8233}function Ixe(e,t,r){r===void 0&&(r=e.length);for(var n=t;n>10)+55296,(e&1023)+56320))}var axt=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,ww=function(t,r){this.line=t,this.column=r};ww.prototype.offset=function(t){return new ww(this.line,this.column+t)};var $R=function(t,r,n){this.start=r,this.end=n,t.sourceFile!==null&&(this.source=t.sourceFile)};function vxe(e,t){for(var r=1,n=0;;){var i=Ixe(e,n,t);if(i<0)return new ww(r,t-n);++r,n=i}}var kV={ecmaVersion:null,sourceType:"script",strict:!1,onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},gxe=!1;function cxt(e){var t={};for(var r in kV)t[r]=e&&E0(e,r)?e[r]:kV[r];if(t.ecmaVersion==="latest"?t.ecmaVersion=1e8:t.ecmaVersion==null?(!gxe&&typeof console=="object"&&console.warn&&(gxe=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
+Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved==null&&(t.allowReserved=t.ecmaVersion<5),(!e||e.allowHashBang==null)&&(t.allowHashBang=t.ecmaVersion>=14),hxe(t.onToken)){var n=t.onToken;t.onToken=function(i){return n.push(i)}}if(hxe(t.onComment)&&(t.onComment=uxt(t,t.onComment)),t.sourceType==="commonjs"&&t.allowAwaitOutsideFunction)throw new Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");return t}function uxt(e,t){return function(r,n,i,s,o,a){var c={type:r?"Block":"Line",value:n,start:i,end:s};e.locations&&(c.loc=new $R(this,o,a)),e.ranges&&(c.range=[i,s]),t.push(c)}}var kh=1,_h=2,RV=4,xxe=8,DV=16,Bxe=32,HR=64,kxe=128,Th=256,Sw=512,_xe=1024,jR=kh|_h|Th;function NV(e,t){return _h|(e?RV:0)|(t?xxe:0)}var LR=0,MV=1,ol=2,Txe=3,Qxe=4,Rxe=5,Kn=function(t,r,n){this.options=t=cxt(t),this.sourceFile=t.sourceFile,this.keywords=Jd(txt[t.ecmaVersion>=6?6:t.sourceType==="module"?"5module":5]);var i="";t.allowReserved!==!0&&(i=SV[t.ecmaVersion>=6?6:t.ecmaVersion===5?5:3],t.sourceType==="module"&&(i+=" await")),this.reservedWords=Jd(i);var s=(i?i+" ":"")+SV.strict;this.reservedWordsStrict=Jd(s),this.reservedWordsStrictBind=Jd(s+" "+SV.strictBind),this.input=String(r),this.containsEsc=!1,n?(this.pos=n,this.lineStart=this.input.lastIndexOf(`
+`,n-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(no).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=x.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=t.sourceType==="module",this.strict=this.inModule||t.strict===!0||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&t.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(this.options.sourceType==="commonjs"?_h:kh),this.regexpState=null,this.privateNameStack=[]},Ea={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowReturn:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},allowUsing:{configurable:!0},inClassStaticBlock:{configurable:!0}};Kn.prototype.parse=function(){var t=this,r=this.options.program||this.startNode();return this.nextToken(),this.catchStackOverflow(function(){return t.parseTopLevel(r)})};Ea.inFunction.get=function(){return(this.currentVarScope().flags&_h)>0};Ea.inGenerator.get=function(){return(this.currentVarScope().flags&xxe)>0};Ea.inAsync.get=function(){return(this.currentVarScope().flags&RV)>0};Ea.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e],r=t.flags;if(r&(Th|Sw))return!1;if(r&_h)return(r&RV)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};Ea.allowReturn.get=function(){return!!(this.inFunction||this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&kh)};Ea.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags;return(t&HR)>0||this.options.allowSuperOutsideMethod};Ea.allowDirectSuper.get=function(){return(this.currentThisScope().flags&kxe)>0};Ea.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};Ea.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e],r=t.flags;if(r&(Th|Sw)||r&_h&&!(r&DV))return!0}return!1};Ea.allowUsing.get=function(){var e=this.currentScope(),t=e.flags;return!(t&_xe||!this.inModule&&t&kh)};Ea.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Th)>0};Kn.extend=function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];for(var n=this,i=0;i=,?^&]/.test(i)||i==="!"&&this.input.charAt(n+1)==="=")}e+=t[0].length,gi.lastIndex=e,e+=gi.exec(this.input)[0].length,this.input[e]===";"&&e++}};is.eat=function(e){return this.type===e?(this.next(),!0):!1};is.isContextual=function(e){return this.type===x.name&&this.value===e&&!this.containsEsc};is.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1};is.catchStackOverflow=function(e){try{return e()}catch(t){if(t instanceof Error&&(/\bstack\b.*\b(exceeded|overflow)\b/i.test(t.message)||/\btoo much recursion\b/i.test(t.message)))this.raise(this.start,"Not enough stack space to parse input");else throw t}};is.expectContextual=function(e){this.eatContextual(e)||this.unexpected()};is.canInsertSemicolon=function(){return this.type===x.eof||this.type===x.braceR||no.test(this.input.slice(this.lastTokEnd,this.start))};is.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0};is.semicolon=function(){!this.eat(x.semi)&&!this.insertSemicolon()&&this.unexpected()};is.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0};is.expect=function(e){this.eat(e)||this.unexpected()};is.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var qR=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};is.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var r=t?e.parenthesizedAssign:e.parenthesizedBind;r>-1&&this.raiseRecoverable(r,t?"Assigning to rvalue":"Parenthesized pattern")}};is.checkExpressionErrors=function(e,t){if(!e)return!1;var r=e.shorthandAssign,n=e.doubleProto;if(!t)return r>=0||n>=0;r>=0&&this.raise(r,"Shorthand property assignments are valid only in destructuring patterns"),n>=0&&this.raiseRecoverable(n,"Redefinition of __proto__ property")};is.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos=6&&this.unexpected(),this.parseFunctionStatement(i,!1,!e);case x._class:return e&&this.unexpected(),this.parseClass(i,!0);case x._if:return this.parseIfStatement(i);case x._return:return this.parseReturnStatement(i);case x._switch:return this.parseSwitchStatement(i);case x._throw:return this.parseThrowStatement(i);case x._try:return this.parseTryStatement(i);case x._const:case x._var:return s=s||this.value,e&&s!=="var"&&this.unexpected(),this.parseVarStatement(i,s);case x._while:return this.parseWhileStatement(i);case x._with:return this.parseWithStatement(i);case x.braceL:return this.parseBlock(!0,i);case x.semi:return this.parseEmptyStatement(i);case x._export:case x._import:if(this.options.ecmaVersion>10&&n===x._import){gi.lastIndex=this.pos;var o=gi.exec(this.input),a=this.pos+o[0].length,c=this.input.charCodeAt(a);if(c===40||c===46)return this.parseExpressionStatement(i,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),n===x._import?this.parseImport(i):this.parseExport(i,r);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(i,!0,!e);var u=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(u)return this.allowUsing||this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement"),e&&this.raise(this.start,"Using declaration is not allowed in single-statement positions"),u==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.next(),this.parseVar(i,!1,u),this.semicolon(),this.finishNode(i,"VariableDeclaration");var l=this.value,d=this.parseExpression();return n===x.name&&d.type==="Identifier"&&this.eat(x.colon)?this.parseLabeledStatement(i,l,d,e):this.parseExpressionStatement(i,d)}};nt.parseBreakContinueStatement=function(e,t){var r=t==="break";this.next(),this.eat(x.semi)||this.insertSemicolon()?e.label=null:this.type!==x.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var n=0;n=6?this.eat(x.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")};nt.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(PV),this.enterScope(0),this.expect(x.parenL),this.type===x.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var r=this.isLet();if(this.type===x._var||this.type===x._const||r){var n=this.startNode(),i=r?"let":this.value;return this.next(),this.parseVar(n,!0,i),this.finishNode(n,"VariableDeclaration"),this.parseForAfterInit(e,n,t)}var s=this.isContextual("let"),o=!1,a=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(a){var c=this.startNode();return this.next(),a==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.parseVar(c,!0,a),this.finishNode(c,"VariableDeclaration"),this.parseForAfterInit(e,c,t)}var u=this.containsEsc,l=new qR,d=this.start,f=t>-1?this.parseExprSubscripts(l,"await"):this.parseExpression(!0,l);return this.type===x._in||(o=this.options.ecmaVersion>=6&&this.isContextual("of"))?(t>-1?(this.type===x._in&&this.unexpected(t),e.await=!0):o&&this.options.ecmaVersion>=8&&(f.start===d&&!u&&f.type==="Identifier"&&f.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(e.await=!1)),s&&o&&this.raise(f.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(f,!1,l),this.checkLValPattern(f),this.parseForIn(e,f)):(this.checkExpressionErrors(l,!0),t>-1&&this.unexpected(t),this.parseFor(e,f))};nt.parseForAfterInit=function(e,t,r){return(this.type===x._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&t.declarations.length===1?(this.type===x._in?((t.kind==="using"||t.kind==="await using")&&!t.declarations[0].init&&this.raise(this.start,"Using declaration is not allowed in for-in loops"),this.options.ecmaVersion>=9&&r>-1&&this.unexpected(r)):this.options.ecmaVersion>=9&&(e.await=r>-1),this.parseForIn(e,t)):(r>-1&&this.unexpected(r),this.parseFor(e,t))};nt.parseFunctionStatement=function(e,t,r){return this.next(),this.parseFunction(e,Iw|(r?0:_V),!1,t)};nt.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(x._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")};nt.parseReturnStatement=function(e){return this.allowReturn||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(x.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")};nt.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(x.braceL),this.labels.push(dxt),this.enterScope(_xe);for(var t,r=!1;this.type!==x.braceR;)if(this.type===x._case||this.type===x._default){var n=this.type===x._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),n?t.test=this.parseExpression():(r&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),r=!0,t.test=null),this.expect(x.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(e,"SwitchStatement")};nt.parseThrowStatement=function(e){return this.next(),no.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var fxt=[];nt.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type==="Identifier";return this.enterScope(t?Bxe:0),this.checkLValPattern(e,t?Qxe:ol),this.expect(x.parenR),e};nt.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===x._catch){var t=this.startNode();this.next(),this.eat(x.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,"CatchClause")}return e.finalizer=this.eat(x._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")};nt.parseVarStatement=function(e,t,r){return this.next(),this.parseVar(e,!1,t,r),this.semicolon(),this.finishNode(e,"VariableDeclaration")};nt.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(PV),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")};nt.parseWithStatement=function(e){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement("with"),this.finishNode(e,"WithStatement")};nt.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")};nt.parseLabeledStatement=function(e,t,r,n){for(var i=0,s=this.labels;i=0;c--){var u=this.labels[c];if(u.statementStart===e.start)u.statementStart=this.start,u.kind=a;else break}return this.labels.push({name:t,kind:a,statementStart:this.start}),e.body=this.parseStatement(n?n.indexOf("label")===-1?n+"label":n:"label"),this.labels.pop(),e.label=r,this.finishNode(e,"LabeledStatement")};nt.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")};nt.parseBlock=function(e,t,r){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(x.braceL),e&&this.enterScope(0);this.type!==x.braceR;){var n=this.parseStatement(null);t.body.push(n)}return r&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")};nt.parseFor=function(e,t){return e.init=t,this.expect(x.semi),e.test=this.type===x.semi?null:this.parseExpression(),this.expect(x.semi),e.update=this.type===x.parenR?null:this.parseExpression(),this.expect(x.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")};nt.parseForIn=function(e,t){var r=this.type===x._in;return this.next(),t.type==="VariableDeclaration"&&t.declarations[0].init!=null&&(!r||this.options.ecmaVersion<8||this.strict||t.kind!=="var"||t.declarations[0].id.type!=="Identifier")&&this.raise(t.start,(r?"for-in":"for-of")+" loop variable declaration may not have an initializer"),e.left=t,e.right=r?this.parseExpression():this.parseMaybeAssign(),this.expect(x.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,r?"ForInStatement":"ForOfStatement")};nt.parseVar=function(e,t,r,n){for(e.declarations=[],e.kind=r;;){var i=this.startNode();if(this.parseVarId(i,r),this.eat(x.eq)?i.init=this.parseMaybeAssign(t):!n&&r==="const"&&!(this.type===x._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!n&&(r==="using"||r==="await using")&&this.options.ecmaVersion>=17&&this.type!==x._in&&!this.isContextual("of")?this.raise(this.lastTokEnd,"Missing initializer in "+r+" declaration"):!n&&i.id.type!=="Identifier"&&!(t&&(this.type===x._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):i.init=null,e.declarations.push(this.finishNode(i,"VariableDeclarator")),!this.eat(x.comma))break}return e};nt.parseVarId=function(e,t){e.id=t==="using"||t==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(e.id,t==="var"?MV:ol,!1)};var Iw=1,_V=2,Dxe=4;nt.parseFunction=function(e,t,r,n,i){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!n)&&(this.type===x.star&&t&_V&&this.unexpected(),e.generator=this.eat(x.star)),this.options.ecmaVersion>=8&&(e.async=!!n),t&Iw&&(e.id=t&Dxe&&this.type!==x.name?null:this.parseIdent(),e.id&&!(t&_V)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?MV:ol:Txe));var s=this.yieldPos,o=this.awaitPos,a=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(NV(e.async,e.generator)),t&Iw||(e.id=this.type===x.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,r,!1,i),this.yieldPos=s,this.awaitPos=o,this.awaitIdentPos=a,this.finishNode(e,t&Iw?"FunctionDeclaration":"FunctionExpression")};nt.parseFunctionParams=function(e){this.expect(x.parenL),e.params=this.parseBindingList(x.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};nt.parseClass=function(e,t){this.next();var r=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var n=this.enterClassBody(),i=this.startNode(),s=!1;for(i.body=[],this.expect(x.braceL);this.type!==x.braceR;){var o=this.parseClassElement(e.superClass!==null);o&&(i.body.push(o),o.type==="MethodDefinition"&&o.kind==="constructor"?(s&&this.raiseRecoverable(o.start,"Duplicate constructor in the same class"),s=!0):o.key&&o.key.type==="PrivateIdentifier"&&pxt(n,o)&&this.raiseRecoverable(o.key.start,"Identifier '#"+o.key.name+"' has already been declared"))}return this.strict=r,this.next(),e.body=this.finishNode(i,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")};nt.parseClassElement=function(e){if(this.eat(x.semi))return null;var t=this.options.ecmaVersion,r=this.startNode(),n="",i=!1,s=!1,o="method",a=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(x.braceL))return this.parseClassStaticBlock(r),r;this.isClassElementNameStart()||this.type===x.star?a=!0:n="static"}if(r.static=a,!n&&t>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===x.star)&&!this.canInsertSemicolon()?s=!0:n="async"),!n&&(t>=9||!s)&&this.eat(x.star)&&(i=!0),!n&&!s&&!i){var c=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?o=c:n=c)}if(n?(r.computed=!1,r.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),r.key.name=n,this.finishNode(r.key,"Identifier")):this.parseClassElementName(r),t<13||this.type===x.parenL||o!=="method"||i||s){var u=!r.static&&FR(r,"constructor"),l=u&&e;u&&o!=="method"&&this.raise(r.key.start,"Constructor can't have get/set modifier"),r.kind=u?"constructor":o,this.parseClassMethod(r,i,s,l)}else this.parseClassField(r);return r};nt.isClassElementNameStart=function(){return this.type===x.name||this.type===x.privateId||this.type===x.num||this.type===x.string||this.type===x.bracketL||this.type.keyword};nt.parseClassElementName=function(e){this.type===x.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)};nt.parseClassMethod=function(e,t,r,n){var i=e.key;e.kind==="constructor"?(t&&this.raise(i.start,"Constructor can't be a generator"),r&&this.raise(i.start,"Constructor can't be an async method")):e.static&&FR(e,"prototype")&&this.raise(i.start,"Classes may not have a static property named prototype");var s=e.value=this.parseMethod(t,r,n);return e.kind==="get"&&s.params.length!==0&&this.raiseRecoverable(s.start,"getter should have no params"),e.kind==="set"&&s.params.length!==1&&this.raiseRecoverable(s.start,"setter should have exactly one param"),e.kind==="set"&&s.params[0].type==="RestElement"&&this.raiseRecoverable(s.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")};nt.parseClassField=function(e){return FR(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&FR(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(x.eq)?(this.enterScope(Sw|HR),e.value=this.parseMaybeAssign(),this.exitScope()):e.value=null,this.semicolon(),this.finishNode(e,"PropertyDefinition")};nt.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(Th|HR);this.type!==x.braceR;){var r=this.parseStatement(null);e.body.push(r)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")};nt.parseClassId=function(e,t){this.type===x.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,ol,!1)):(t===!0&&this.unexpected(),e.id=null)};nt.parseClassSuper=function(e){e.superClass=this.eat(x._extends)?this.parseExprSubscripts(null,!1):null};nt.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared};nt.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,r=e.used;if(this.options.checkPrivateFields)for(var n=this.privateNameStack.length,i=n===0?null:this.privateNameStack[n-1],s=0;s=11&&(this.eatContextual("as")?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual("from"),this.type!==x.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")};nt.parseExport=function(e,t){if(this.next(),this.eat(x.star))return this.parseExportAllDeclaration(e,t);if(this.eat(x._default))return this.checkExport(t,"default",this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),e.declaration.type==="VariableDeclaration"?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[]);else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual("from"))this.type!==x.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var r=0,n=e.specifiers;r=16&&(e.attributes=[])}this.semicolon()}return this.finishNode(e,"ExportNamedDeclaration")};nt.parseExportDeclaration=function(e){return this.parseStatement(null)};nt.parseExportDefaultDeclaration=function(){var e;if(this.type===x._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,Iw|Dxe,!1,e)}else if(this.type===x._class){var r=this.startNode();return this.parseClass(r,"nullableID")}else{var n=this.parseMaybeAssign();return this.semicolon(),n}};nt.checkExport=function(e,t,r){e&&(typeof t!="string"&&(t=t.type==="Identifier"?t.name:t.value),E0(e,t)&&this.raiseRecoverable(r,"Duplicate export '"+t+"'"),e[t]=!0)};nt.checkPatternExport=function(e,t){var r=t.type;if(r==="Identifier")this.checkExport(e,t,t.start);else if(r==="ObjectPattern")for(var n=0,i=t.properties;n=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ImportDeclaration")};nt.parseImportSpecifier=function(){var e=this.startNode();return e.imported=this.parseModuleExportName(),this.eatContextual("as")?e.local=this.parseIdent():(this.checkUnreserved(e.imported),e.local=e.imported),this.checkLValSimple(e.local,ol),this.finishNode(e,"ImportSpecifier")};nt.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,ol),this.finishNode(e,"ImportDefaultSpecifier")};nt.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual("as"),e.local=this.parseIdent(),this.checkLValSimple(e.local,ol),this.finishNode(e,"ImportNamespaceSpecifier")};nt.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===x.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(x.comma)))return e;if(this.type===x.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(x.braceL);!this.eat(x.braceR);){if(t)t=!1;else if(this.expect(x.comma),this.afterTrailingComma(x.braceR))break;e.push(this.parseImportSpecifier())}return e};nt.parseWithClause=function(){var e=[];if(!this.eat(x._with))return e;this.expect(x.braceL);for(var t={},r=!0;!this.eat(x.braceR);){if(r)r=!1;else if(this.expect(x.comma),this.afterTrailingComma(x.braceR))break;var n=this.parseImportAttribute(),i=n.key.type==="Identifier"?n.key.name:n.key.value;E0(t,i)&&this.raiseRecoverable(n.key.start,"Duplicate attribute key '"+i+"'"),t[i]=!0,e.push(n)}return e};nt.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===x.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(x.colon),this.type!==x.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,"ImportAttribute")};nt.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===x.string){var e=this.parseLiteral(this.value);return axt.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)};nt.adaptDirectivePrologue=function(e){for(var t=0;t=5&&e.type==="ExpressionStatement"&&e.expression.type==="Literal"&&typeof e.expression.value=="string"&&(this.input[e.start]==='"'||this.input[e.start]==="'")};var Ca=Kn.prototype;Ca.toAssignable=function(e,t,r){if(this.options.ecmaVersion>=6&&e)switch(e.type){case"Identifier":this.inAsync&&e.name==="await"&&this.raise(e.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":e.type="ObjectPattern",r&&this.checkPatternErrors(r,!0);for(var n=0,i=e.properties;n=6)switch(this.type){case x.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(x.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case x.braceL:return this.parseObj(!0)}return this.parseIdent()};Ca.parseBindingList=function(e,t,r,n){for(var i=[],s=!0;!this.eat(e);)if(s?s=!1:this.expect(x.comma),t&&this.type===x.comma)i.push(null);else{if(r&&this.afterTrailingComma(e))break;if(this.type===x.ellipsis){var o=this.parseRestBinding();this.parseBindingListItem(o),i.push(o),this.type===x.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}else i.push(this.parseAssignableListItem(n))}return i};Ca.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t};Ca.parseBindingListItem=function(e){return e};Ca.parseMaybeDefault=function(e,t,r){if(r=r||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(x.eq))return r;var n=this.startNodeAt(e,t);return n.left=r,n.right=this.parseMaybeAssign(),this.finishNode(n,"AssignmentPattern")};Ca.checkLValSimple=function(e,t,r){t===void 0&&(t=LR);var n=t!==LR;switch(e.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(n?"Binding ":"Assigning to ")+e.name+" in strict mode"),n&&(t===ol&&e.name==="let"&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),r&&(E0(r,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),r[e.name]=!0),t!==Rxe&&this.declareName(e.name,t,e.start));break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":n&&this.raiseRecoverable(e.start,"Binding member expression");break;case"ParenthesizedExpression":return n&&this.raiseRecoverable(e.start,"Binding parenthesized expression"),this.checkLValSimple(e.expression,t,r);default:this.raise(e.start,(n?"Binding":"Assigning to")+" rvalue")}};Ca.checkLValPattern=function(e,t,r){switch(t===void 0&&(t=LR),e.type){case"ObjectPattern":for(var n=0,i=e.properties;n=1;e--){var t=this.context[e];if(t.token==="function")return t.generator}return!1};C0.updateContext=function(e){var t,r=this.type;r.keyword&&e===x.dot?this.exprAllowed=!1:(t=r.updateContext)?t.call(this,e):this.exprAllowed=r.beforeExpr};C0.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)};x.parenR.updateContext=x.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var e=this.context.pop();e===In.b_stat&&this.curContext().token==="function"&&(e=this.context.pop()),this.exprAllowed=!e.isExpr};x.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?In.b_stat:In.b_expr),this.exprAllowed=!0};x.dollarBraceL.updateContext=function(){this.context.push(In.b_tmpl),this.exprAllowed=!0};x.parenL.updateContext=function(e){var t=e===x._if||e===x._for||e===x._with||e===x._while;this.context.push(t?In.p_stat:In.p_expr),this.exprAllowed=!0};x.incDec.updateContext=function(){};x._function.updateContext=x._class.updateContext=function(e){e.beforeExpr&&e!==x._else&&!(e===x.semi&&this.curContext()!==In.p_stat)&&!(e===x._return&&no.test(this.input.slice(this.lastTokEnd,this.start)))&&!((e===x.colon||e===x.braceL)&&this.curContext()===In.b_stat)?this.context.push(In.f_expr):this.context.push(In.f_stat),this.exprAllowed=!1};x.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0};x.backQuote.updateContext=function(){this.curContext()===In.q_tmpl?this.context.pop():this.context.push(In.q_tmpl),this.exprAllowed=!1};x.star.updateContext=function(e){if(e===x._function){var t=this.context.length-1;this.context[t]===In.f_expr?this.context[t]=In.f_expr_gen:this.context[t]=In.f_gen}this.exprAllowed=!0};x.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==x.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var Tt=Kn.prototype;Tt.checkPropClash=function(e,t,r){if(!(this.options.ecmaVersion>=9&&e.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var n=e.key,i;switch(n.type){case"Identifier":i=n.name;break;case"Literal":i=String(n.value);break;default:return}var s=e.kind;if(this.options.ecmaVersion>=6){i==="__proto__"&&s==="init"&&(t.proto&&(r?r.doubleProto<0&&(r.doubleProto=n.start):this.raiseRecoverable(n.start,"Redefinition of __proto__ property")),t.proto=!0);return}i="$"+i;var o=t[i];if(o){var a;s==="init"?a=this.strict&&o.init||o.get||o.set:a=o.init||o[s],a&&this.raiseRecoverable(n.start,"Redefinition of property")}else o=t[i]={init:!1,get:!1,set:!1};o[s]=!0}};Tt.parseExpression=function(e,t){var r=this;return this.catchStackOverflow(function(){var n=r.start,i=r.startLoc,s=r.parseMaybeAssign(e,t);if(r.type===x.comma){var o=r.startNodeAt(n,i);for(o.expressions=[s];r.eat(x.comma);)o.expressions.push(r.parseMaybeAssign(e,t));return r.finishNode(o,"SequenceExpression")}return s})};Tt.parseMaybeAssign=function(e,t,r){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var n=!1,i=-1,s=-1,o=-1;t?(i=t.parenthesizedAssign,s=t.trailingComma,o=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new qR,n=!0);var a=this.start,c=this.startLoc;(this.type===x.parenL||this.type===x.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e==="await");var u=this.parseMaybeConditional(e,t);if(r&&(u=r.call(this,u,a,c)),this.type.isAssign){var l=this.startNodeAt(a,c);return l.operator=this.value,this.type===x.eq&&(u=this.toAssignable(u,!1,t)),n||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=u.start&&(t.shorthandAssign=-1),this.type===x.eq?this.checkLValPattern(u):this.checkLValSimple(u),l.left=u,this.next(),l.right=this.parseMaybeAssign(e),o>-1&&(t.doubleProto=o),this.finishNode(l,"AssignmentExpression")}else n&&this.checkExpressionErrors(t,!0);return i>-1&&(t.parenthesizedAssign=i),s>-1&&(t.trailingComma=s),u};Tt.parseMaybeConditional=function(e,t){var r=this.start,n=this.startLoc,i=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return i;if(!(i.type==="ArrowFunctionExpression"&&i.start===r)&&this.eat(x.question)){var s=this.startNodeAt(r,n);return s.test=i,s.consequent=this.parseMaybeAssign(),this.expect(x.colon),s.alternate=this.parseMaybeAssign(e),this.finishNode(s,"ConditionalExpression")}return i};Tt.parseExprOps=function(e,t){var r=this.start,n=this.startLoc,i=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||i.start===r&&i.type==="ArrowFunctionExpression"?i:this.parseExprOp(i,r,n,-1,e)};Tt.parseExprOp=function(e,t,r,n,i){var s=this.type.binop;if(s!=null&&(!i||this.type!==x._in)&&s>n){var o=this.type===x.logicalOR||this.type===x.logicalAND,a=this.type===x.coalesce;a&&(s=x.logicalAND.binop);var c=this.value;this.next();var u=this.start,l=this.startLoc,d=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,i),u,l,s,i),f=this.buildBinary(t,r,e,d,c,o||a);return(o&&this.type===x.coalesce||a&&(this.type===x.logicalOR||this.type===x.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(f,t,r,n,i)}return e};Tt.buildBinary=function(e,t,r,n,i,s){n.type==="PrivateIdentifier"&&this.raise(n.start,"Private identifier can only be left side of binary expression");var o=this.startNodeAt(e,t);return o.left=r,o.operator=i,o.right=n,this.finishNode(o,s?"LogicalExpression":"BinaryExpression")};Tt.parseMaybeUnary=function(e,t,r,n){var i=this.start,s=this.startLoc,o;if(this.isContextual("await")&&this.canAwait)o=this.parseAwait(n),t=!0;else if(this.type.prefix){var a=this.startNode(),c=this.type===x.incDec;a.operator=this.value,a.prefix=!0,this.next(),a.argument=this.parseMaybeUnary(null,!0,c,n),this.checkExpressionErrors(e,!0),c?this.checkLValSimple(a.argument):this.strict&&a.operator==="delete"&&Nxe(a.argument)?this.raiseRecoverable(a.start,"Deleting local variable in strict mode"):a.operator==="delete"&&TV(a.argument)?this.raiseRecoverable(a.start,"Private fields can not be deleted"):t=!0,o=this.finishNode(a,c?"UpdateExpression":"UnaryExpression")}else if(!t&&this.type===x.privateId)(n||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),o=this.parsePrivateIdent(),this.type!==x._in&&this.unexpected();else{if(o=this.parseExprSubscripts(e,n),this.checkExpressionErrors(e))return o;for(;this.type.postfix&&!this.canInsertSemicolon();){var u=this.startNodeAt(i,s);u.operator=this.value,u.prefix=!1,u.argument=o,this.checkLValSimple(o),this.next(),o=this.finishNode(u,"UpdateExpression")}}if(!r&&this.eat(x.starstar))if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(i,s,o,this.parseMaybeUnary(null,!1,!1,n),"**",!1);else return o};function Nxe(e){return e.type==="Identifier"||e.type==="ParenthesizedExpression"&&Nxe(e.expression)}function TV(e){return e.type==="MemberExpression"&&e.property.type==="PrivateIdentifier"||e.type==="ChainExpression"&&TV(e.expression)||e.type==="ParenthesizedExpression"&&TV(e.expression)}Tt.parseExprSubscripts=function(e,t){var r=this.start,n=this.startLoc,i=this.parseExprAtom(e,t);if(i.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return i;var s=this.parseSubscripts(i,r,n,!1,t);return e&&s.type==="MemberExpression"&&(e.parenthesizedAssign>=s.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=s.start&&(e.parenthesizedBind=-1),e.trailingComma>=s.start&&(e.trailingComma=-1)),s};Tt.parseSubscripts=function(e,t,r,n,i){for(var s=this.options.ecmaVersion>=8&&e.type==="Identifier"&&e.name==="async"&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,o=!1;;){var a=this.parseSubscript(e,t,r,n,s,o,i);if(a.optional&&(o=!0),a===e||a.type==="ArrowFunctionExpression"){if(o){var c=this.startNodeAt(t,r);c.expression=a,a=this.finishNode(c,"ChainExpression")}return a}e=a}};Tt.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(x.arrow)};Tt.parseSubscriptAsyncArrow=function(e,t,r,n){return this.parseArrowExpression(this.startNodeAt(e,t),r,!0,n)};Tt.parseSubscript=function(e,t,r,n,i,s,o){var a=this.options.ecmaVersion>=11,c=a&&this.eat(x.questionDot);n&&c&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var u=this.eat(x.bracketL);if(u||c&&this.type!==x.parenL&&this.type!==x.backQuote||this.eat(x.dot)){var l=this.startNodeAt(t,r);l.object=e,u?(l.property=this.parseExpression(),this.expect(x.bracketR)):this.type===x.privateId&&e.type!=="Super"?l.property=this.parsePrivateIdent():l.property=this.parseIdent(this.options.allowReserved!=="never"),l.computed=!!u,a&&(l.optional=c),e=this.finishNode(l,"MemberExpression")}else if(!n&&this.eat(x.parenL)){var d=new qR,f=this.yieldPos,p=this.awaitPos,h=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var A=this.parseExprList(x.parenR,this.options.ecmaVersion>=8,!1,d);if(i&&!c&&this.shouldParseAsyncArrow())return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=f,this.awaitPos=p,this.awaitIdentPos=h,this.parseSubscriptAsyncArrow(t,r,A,o);this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=p||this.awaitPos,this.awaitIdentPos=h||this.awaitIdentPos;var g=this.startNodeAt(t,r);g.callee=e,g.arguments=A,a&&(g.optional=c),e=this.finishNode(g,"CallExpression")}else if(this.type===x.backQuote){(c||s)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var m=this.startNodeAt(t,r);m.tag=e,m.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(m,"TaggedTemplateExpression")}return e};Tt.parseExprAtom=function(e,t,r){this.type===x.slash&&this.readRegexp();var n,i=this.potentialArrowAt===this.start;switch(this.type){case x._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),n=this.startNode(),this.next(),this.type===x.parenL&&!this.allowDirectSuper&&this.raise(n.start,"super() call outside constructor of a subclass"),this.type!==x.dot&&this.type!==x.bracketL&&this.type!==x.parenL&&this.unexpected(),this.finishNode(n,"Super");case x._this:return n=this.startNode(),this.next(),this.finishNode(n,"ThisExpression");case x.name:var s=this.start,o=this.startLoc,a=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!a&&c.name==="async"&&!this.canInsertSemicolon()&&this.eat(x._function))return this.overrideContext(In.f_expr),this.parseFunction(this.startNodeAt(s,o),0,!1,!0,t);if(i&&!this.canInsertSemicolon()){if(this.eat(x.arrow))return this.parseArrowExpression(this.startNodeAt(s,o),[c],!1,t);if(this.options.ecmaVersion>=8&&c.name==="async"&&this.type===x.name&&!a&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return c=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(x.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(s,o),[c],!0,t)}return c;case x.regexp:var u=this.value;return n=this.parseLiteral(u.value),n.regex={pattern:u.pattern,flags:u.flags},n;case x.num:case x.string:return this.parseLiteral(this.value);case x._null:case x._true:case x._false:return n=this.startNode(),n.value=this.type===x._null?null:this.type===x._true,n.raw=this.type.keyword,this.next(),this.finishNode(n,"Literal");case x.parenL:var l=this.start,d=this.parseParenAndDistinguishExpression(i,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(d)&&(e.parenthesizedAssign=l),e.parenthesizedBind<0&&(e.parenthesizedBind=l)),d;case x.bracketL:return n=this.startNode(),this.next(),n.elements=this.parseExprList(x.bracketR,!0,!0,e),this.finishNode(n,"ArrayExpression");case x.braceL:return this.overrideContext(In.b_expr),this.parseObj(!1,e);case x._function:return n=this.startNode(),this.next(),this.parseFunction(n,0);case x._class:return this.parseClass(this.startNode(),!1);case x._new:return this.parseNew();case x.backQuote:return this.parseTemplate();case x._import:return this.options.ecmaVersion>=11?this.parseExprImport(r):this.unexpected();default:return this.parseExprAtomDefault()}};Tt.parseExprAtomDefault=function(){this.unexpected()};Tt.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===x.parenL&&!e)return this.parseDynamicImport(t);if(this.type===x.dot){var r=this.startNodeAt(t.start,t.loc&&t.loc.start);return r.name="import",t.meta=this.finishNode(r,"Identifier"),this.parseImportMeta(t)}else this.unexpected()};Tt.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(x.parenR)?e.options=null:(this.expect(x.comma),this.afterTrailingComma(x.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(x.parenR)||(this.expect(x.comma),this.afterTrailingComma(x.parenR)||this.unexpected())));else if(!this.eat(x.parenR)){var t=this.start;this.eat(x.comma)&&this.eat(x.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")};Tt.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!=="meta"&&this.raiseRecoverable(e.property.start,"The only valid meta property for import is 'import.meta'"),t&&this.raiseRecoverable(e.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,"Cannot use 'import.meta' outside a module"),this.finishNode(e,"MetaProperty")};Tt.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.value!=null?t.value.toString():t.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(t,"Literal")};Tt.parseParenExpression=function(){this.expect(x.parenL);var e=this.parseExpression();return this.expect(x.parenR),e};Tt.shouldParseArrow=function(e){return!this.canInsertSemicolon()};Tt.parseParenAndDistinguishExpression=function(e,t){var r=this.start,n=this.startLoc,i,s=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var o=this.start,a=this.startLoc,c=[],u=!0,l=!1,d=new qR,f=this.yieldPos,p=this.awaitPos,h;for(this.yieldPos=0,this.awaitPos=0;this.type!==x.parenR;)if(u?u=!1:this.expect(x.comma),s&&this.afterTrailingComma(x.parenR,!0)){l=!0;break}else if(this.type===x.ellipsis){h=this.start,c.push(this.parseParenItem(this.parseRestBinding())),this.type===x.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else c.push(this.parseMaybeAssign(!1,d,this.parseParenItem));var A=this.lastTokEnd,g=this.lastTokEndLoc;if(this.expect(x.parenR),e&&this.shouldParseArrow(c)&&this.eat(x.arrow))return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=f,this.awaitPos=p,this.parseParenArrowList(r,n,c,t);(!c.length||l)&&this.unexpected(this.lastTokStart),h&&this.unexpected(h),this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=p||this.awaitPos,c.length>1?(i=this.startNodeAt(o,a),i.expressions=c,this.finishNodeAt(i,"SequenceExpression",A,g)):i=c[0]}else i=this.parseParenExpression();if(this.options.preserveParens){var m=this.startNodeAt(r,n);return m.expression=i,this.finishNode(m,"ParenthesizedExpression")}else return i};Tt.parseParenItem=function(e){return e};Tt.parseParenArrowList=function(e,t,r,n){return this.parseArrowExpression(this.startNodeAt(e,t),r,!1,n)};var hxt=[];Tt.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===x.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name="new",e.meta=this.finishNode(t,"Identifier"),this.next();var r=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!=="target"&&this.raiseRecoverable(e.property.start,"The only valid meta property for new is 'new.target'"),r&&this.raiseRecoverable(e.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(e.start,"'new.target' can only be used in functions and class static block"),this.finishNode(e,"MetaProperty")}var n=this.start,i=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),n,i,!0,!1),e.callee.type==="Super"&&this.raiseRecoverable(n,"Invalid use of 'super'"),this.eat(x.parenL)?e.arguments=this.parseExprList(x.parenR,this.options.ecmaVersion>=8,!1):e.arguments=hxt,this.finishNode(e,"NewExpression")};Tt.parseTemplateElement=function(e){var t=e.isTagged,r=this.startNode();return this.type===x.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),r.value={raw:this.value.replace(/\r\n?/g,`
+`),cooked:null}):r.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
+`),cooked:this.value},this.next(),r.tail=this.type===x.backQuote,this.finishNode(r,"TemplateElement")};Tt.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=!1);var r=this.startNode();this.next(),r.expressions=[];var n=this.parseTemplateElement({isTagged:t});for(r.quasis=[n];!n.tail;)this.type===x.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(x.dollarBraceL),r.expressions.push(this.parseExpression()),this.expect(x.braceR),r.quasis.push(n=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(r,"TemplateLiteral")};Tt.isAsyncProp=function(e){return!e.computed&&e.key.type==="Identifier"&&e.key.name==="async"&&(this.type===x.name||this.type===x.num||this.type===x.string||this.type===x.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===x.star)&&!no.test(this.input.slice(this.lastTokEnd,this.start))};Tt.parseObj=function(e,t){var r=this.startNode(),n=!0,i={};for(r.properties=[],this.next();!this.eat(x.braceR);){if(n)n=!1;else if(this.expect(x.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(x.braceR))break;var s=this.parseProperty(e,t);e||this.checkPropClash(s,i,t),r.properties.push(s)}return this.finishNode(r,e?"ObjectPattern":"ObjectExpression")};Tt.parseProperty=function(e,t){var r=this.startNode(),n,i,s,o;if(this.options.ecmaVersion>=9&&this.eat(x.ellipsis))return e?(r.argument=this.parseIdent(!1),this.type===x.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(r,"RestElement")):(r.argument=this.parseMaybeAssign(!1,t),this.type===x.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(r,"SpreadElement"));this.options.ecmaVersion>=6&&(r.method=!1,r.shorthand=!1,(e||t)&&(s=this.start,o=this.startLoc),e||(n=this.eat(x.star)));var a=this.containsEsc;return this.parsePropertyName(r),!e&&!a&&this.options.ecmaVersion>=8&&!n&&this.isAsyncProp(r)?(i=!0,n=this.options.ecmaVersion>=9&&this.eat(x.star),this.parsePropertyName(r)):i=!1,this.parsePropertyValue(r,e,n,i,s,o,t,a),this.finishNode(r,"Property")};Tt.parseGetterSetter=function(e){var t=e.key.name;this.parsePropertyName(e),e.value=this.parseMethod(!1),e.kind=t;var r=e.kind==="get"?0:1;if(e.value.params.length!==r){var n=e.value.start;e.kind==="get"?this.raiseRecoverable(n,"getter should have no params"):this.raiseRecoverable(n,"setter should have exactly one param")}else e.kind==="set"&&e.value.params[0].type==="RestElement"&&this.raiseRecoverable(e.value.params[0].start,"Setter cannot use rest params")};Tt.parsePropertyValue=function(e,t,r,n,i,s,o,a){(r||n)&&this.type===x.colon&&this.unexpected(),this.eat(x.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,o),e.kind="init"):this.options.ecmaVersion>=6&&this.type===x.parenL?(t&&this.unexpected(),e.method=!0,e.value=this.parseMethod(r,n),e.kind="init"):!t&&!a&&this.options.ecmaVersion>=5&&!e.computed&&e.key.type==="Identifier"&&(e.key.name==="get"||e.key.name==="set")&&this.type!==x.comma&&this.type!==x.braceR&&this.type!==x.eq?((r||n)&&this.unexpected(),this.parseGetterSetter(e)):this.options.ecmaVersion>=6&&!e.computed&&e.key.type==="Identifier"?((r||n)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=i),t?e.value=this.parseMaybeDefault(i,s,this.copyNode(e.key)):this.type===x.eq&&o?(o.shorthandAssign<0&&(o.shorthandAssign=this.start),e.value=this.parseMaybeDefault(i,s,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.kind="init",e.shorthand=!0):this.unexpected()};Tt.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(x.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(x.bracketR),e.key;e.computed=!1}return e.key=this.type===x.num||this.type===x.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};Tt.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)};Tt.parseMethod=function(e,t,r){var n=this.startNode(),i=this.yieldPos,s=this.awaitPos,o=this.awaitIdentPos;return this.initFunction(n),this.options.ecmaVersion>=6&&(n.generator=e),this.options.ecmaVersion>=8&&(n.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(NV(t,n.generator)|HR|(r?kxe:0)),this.expect(x.parenL),n.params=this.parseBindingList(x.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(n,!1,!0,!1),this.yieldPos=i,this.awaitPos=s,this.awaitIdentPos=o,this.finishNode(n,"FunctionExpression")};Tt.parseArrowExpression=function(e,t,r,n){var i=this.yieldPos,s=this.awaitPos,o=this.awaitIdentPos;return this.enterScope(NV(r,!1)|DV),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!r),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,n),this.yieldPos=i,this.awaitPos=s,this.awaitIdentPos=o,this.finishNode(e,"ArrowFunctionExpression")};Tt.parseFunctionBody=function(e,t,r,n){var i=t&&this.type!==x.braceL,s=this.strict,o=!1;if(i)e.body=this.parseMaybeAssign(n),e.expression=!0,this.checkParams(e,!1);else{var a=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!s||a)&&(o=this.strictDirective(this.end),o&&a&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var c=this.labels;this.labels=[],o&&(this.strict=!0),this.checkParams(e,!s&&!o&&!t&&!r&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,Rxe),e.body=this.parseBlock(!1,void 0,o&&!s),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=c}this.exitScope()};Tt.isSimpleParamList=function(e){for(var t=0,r=e;t-1||i.functions.indexOf(e)>-1||i.var.indexOf(e)>-1,i.lexical.push(e),this.inModule&&i.flags&kh&&delete this.undefinedExports[e]}else if(t===Qxe){var s=this.currentScope();s.lexical.push(e)}else if(t===Txe){var o=this.currentScope();this.treatFunctionsAsVar?n=o.lexical.indexOf(e)>-1:n=o.lexical.indexOf(e)>-1||o.var.indexOf(e)>-1,o.functions.push(e)}else for(var a=this.scopeStack.length-1;a>=0;--a){var c=this.scopeStack[a];if(c.lexical.indexOf(e)>-1&&!(c.flags&Bxe&&c.lexical[0]===e)||!this.treatFunctionsAsVarInScope(c)&&c.functions.indexOf(e)>-1){n=!0;break}if(c.var.push(e),this.inModule&&c.flags&kh&&delete this.undefinedExports[e],c.flags&jR)break}n&&this.raiseRecoverable(r,"Identifier '"+e+"' has already been declared")};Kd.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)};Kd.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};Kd.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(jR|Sw|Th))return t}};Kd.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(jR|Sw|Th)&&!(t.flags&DV))return t}};var zR=function(t,r,n){this.type="",this.start=r,this.end=0,t.options.locations&&(this.loc=new $R(t,n)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[r,0])},vw=Kn.prototype;vw.startNode=function(){return new zR(this,this.start,this.startLoc)};vw.startNodeAt=function(e,t){return new zR(this,e,t)};function Mxe(e,t,r,n){return e.type=t,e.end=r,this.options.locations&&(e.loc.end=n),this.options.ranges&&(e.range[1]=r),e}vw.finishNode=function(e,t){return Mxe.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)};vw.finishNodeAt=function(e,t,r,n){return Mxe.call(this,e,t,r,n)};vw.copyNode=function(e){var t=new zR(this,e.start,this.startLoc);for(var r in e)t[r]=e[r];return t};var gxt="Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz",Pxe="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",Lxe=Pxe+" Extended_Pictographic",Fxe=Lxe,Oxe=Fxe+" EBase EComp EMod EPres ExtPict",Uxe=Oxe,mxt=Uxe,yxt={9:Pxe,10:Lxe,11:Fxe,12:Oxe,13:Uxe,14:mxt},bxt="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",Ext={9:"",10:"",11:"",12:"",13:"",14:bxt},mxe="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",$xe="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",Hxe=$xe+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",jxe=Hxe+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",qxe=jxe+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",zxe=qxe+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",Cxt=zxe+" "+gxt,Ixt={9:$xe,10:Hxe,11:jxe,12:qxe,13:zxe,14:Cxt},Vxe={};function wxt(e){var t=Vxe[e]={binary:Jd(yxt[e]+" "+mxe),binaryOfStrings:Jd(Ext[e]),nonBinary:{General_Category:Jd(mxe),Script:Jd(Ixt[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(PR=0,xV=[9,10,11,12,13,14];PR=6?"uy":"")+(t.options.ecmaVersion>=9?"s":"")+(t.options.ecmaVersion>=13?"d":"")+(t.options.ecmaVersion>=15?"v":""),this.unicodeProperties=Vxe[t.options.ecmaVersion>=14?14:t.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};nu.prototype.reset=function(t,r,n){var i=n.indexOf("v")!==-1,s=n.indexOf("u")!==-1;this.start=t|0,this.source=r+"",this.flags=n,i&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=s&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=s&&this.parser.options.ecmaVersion>=9)};nu.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)};nu.prototype.at=function(t,r){r===void 0&&(r=!1);var n=this.source,i=n.length;if(t>=i)return-1;var s=n.charCodeAt(t);if(!(r||this.switchU)||s<=55295||s>=57344||t+1>=i)return s;var o=n.charCodeAt(t+1);return o>=56320&&o<=57343?(s<<10)+o-56613888:s};nu.prototype.nextIndex=function(t,r){r===void 0&&(r=!1);var n=this.source,i=n.length;if(t>=i)return i;var s=n.charCodeAt(t),o;return!(r||this.switchU)||s<=55295||s>=57344||t+1>=i||(o=n.charCodeAt(t+1))<56320||o>57343?t+1:t+2};nu.prototype.current=function(t){return t===void 0&&(t=!1),this.at(this.pos,t)};nu.prototype.lookahead=function(t){return t===void 0&&(t=!1),this.at(this.nextIndex(this.pos,t),t)};nu.prototype.advance=function(t){t===void 0&&(t=!1),this.pos=this.nextIndex(this.pos,t)};nu.prototype.eat=function(t,r){return r===void 0&&(r=!1),this.current(r)===t?(this.advance(r),!0):!1};nu.prototype.eatChars=function(t,r){r===void 0&&(r=!1);for(var n=this.pos,i=0,s=t;i-1&&this.raise(e.start,"Duplicate regular expression flag"),o==="u"&&(n=!0),o==="v"&&(i=!0)}this.options.ecmaVersion>=15&&n&&i&&this.raise(e.start,"Invalid regular expression flag")};function Sxt(e){for(var t in e)return!0;return!1}tt.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&Sxt(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))};tt.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue="",e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames=Object.create(null),e.backReferenceNames.length=0,e.branchID=null,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise("Unmatched ')'"),(e.eat(93)||e.eat(125))&&e.raise("Lone quantifier brackets")),e.maxBackReference>e.numCapturingParens&&e.raise("Invalid escape");for(var t=0,r=e.backReferenceNames;t=16;for(t&&(e.branchID=new UR(e.branchID,null)),this.regexp_alternative(e);e.eat(124);)t&&(e.branchID=e.branchID.sibling()),this.regexp_alternative(e);t&&(e.branchID=e.branchID.parent),this.regexp_eatQuantifier(e,!0)&&e.raise("Nothing to repeat"),e.eat(123)&&e.raise("Lone quantifier brackets")};tt.regexp_alternative=function(e){for(;e.pos=9&&(r=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise("Unterminated group"),e.lastAssertionIsQuantifiable=!r,!0}return e.pos=t,!1};tt.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),!0):!1};tt.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)};tt.regexp_eatBracedQuantifier=function(e,t){var r=e.pos;if(e.eat(123)){var n=0,i=-1;if(this.regexp_eatDecimalDigits(e)&&(n=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(i=e.lastIntValue),e.eat(125)))return i!==-1&&i=16){var r=this.regexp_eatModifiers(e),n=e.eat(45);if(r||n){for(var i=0;i-1&&e.raise("Duplicate regular expression modifiers")}if(n){var o=this.regexp_eatModifiers(e);!r&&!o&&e.current()===58&&e.raise("Invalid regular expression modifiers");for(var a=0;a-1||r.indexOf(c)>-1)&&e.raise("Duplicate regular expression modifiers")}}}}if(e.eat(58)){if(this.regexp_disjunction(e),e.eat(41))return!0;e.raise("Unterminated group")}}e.pos=t}return!1};tt.regexp_eatCapturingGroup=function(e){if(e.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(e):e.current()===63&&e.raise("Invalid group"),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise("Unterminated group")}return!1};tt.regexp_eatModifiers=function(e){for(var t="",r=0;(r=e.current())!==-1&&vxt(r);)t+=il(r),e.advance();return t};function vxt(e){return e===105||e===109||e===115}tt.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)};tt.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise("Nothing to repeat"),!1};tt.regexp_eatSyntaxCharacter=function(e){var t=e.current();return Gxe(t)?(e.lastIntValue=t,e.advance(),!0):!1};function Gxe(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}tt.regexp_eatPatternCharacters=function(e){for(var t=e.pos,r=0;(r=e.current())!==-1&&!Gxe(r);)e.advance();return e.pos!==t};tt.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return t!==-1&&t!==36&&!(t>=40&&t<=43)&&t!==46&&t!==63&&t!==91&&t!==94&&t!==124?(e.advance(),!0):!1};tt.regexp_groupSpecifier=function(e){if(e.eat(63)){this.regexp_eatGroupName(e)||e.raise("Invalid group");var t=this.options.ecmaVersion>=16,r=e.groupNames[e.lastStringValue];if(r)if(t)for(var n=0,i=r;n=11,n=e.current(r);return e.advance(r),n===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,r)&&(n=e.lastIntValue),xxt(n)?(e.lastIntValue=n,!0):(e.pos=t,!1)};function xxt(e){return ru(e,!0)||e===36||e===95}tt.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,r=this.options.ecmaVersion>=11,n=e.current(r);return e.advance(r),n===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,r)&&(n=e.lastIntValue),Bxt(n)?(e.lastIntValue=n,!0):(e.pos=t,!1)};function Bxt(e){return Zd(e,!0)||e===36||e===95||e===8204||e===8205}tt.regexp_eatAtomEscape=function(e){return this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e)?!0:(e.switchU&&(e.current()===99&&e.raise("Invalid unicode escape"),e.raise("Invalid escape")),!1)};tt.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var r=e.lastIntValue;if(e.switchU)return r>e.maxBackReference&&(e.maxBackReference=r),!0;if(r<=e.numCapturingParens)return!0;e.pos=t}return!1};tt.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise("Invalid named reference")}return!1};tt.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)};tt.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1};tt.regexp_eatZero=function(e){return e.current()===48&&!VR(e.lookahead())?(e.lastIntValue=0,e.advance(),!0):!1};tt.regexp_eatControlEscape=function(e){var t=e.current();return t===116?(e.lastIntValue=9,e.advance(),!0):t===110?(e.lastIntValue=10,e.advance(),!0):t===118?(e.lastIntValue=11,e.advance(),!0):t===102?(e.lastIntValue=12,e.advance(),!0):t===114?(e.lastIntValue=13,e.advance(),!0):!1};tt.regexp_eatControlLetter=function(e){var t=e.current();return Wxe(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function Wxe(e){return e>=65&&e<=90||e>=97&&e<=122}tt.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){t===void 0&&(t=!1);var r=e.pos,n=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var i=e.lastIntValue;if(n&&i>=55296&&i<=56319){var s=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var o=e.lastIntValue;if(o>=56320&&o<=57343)return e.lastIntValue=(i-55296)*1024+(o-56320)+65536,!0}e.pos=s,e.lastIntValue=i}return!0}if(n&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&kxt(e.lastIntValue))return!0;n&&e.raise("Invalid unicode escape"),e.pos=r}return!1};function kxt(e){return e>=0&&e<=1114111}tt.regexp_eatIdentityEscape=function(e){if(e.switchU)return this.regexp_eatSyntaxCharacter(e)?!0:e.eat(47)?(e.lastIntValue=47,!0):!1;var t=e.current();return t!==99&&(!e.switchN||t!==107)?(e.lastIntValue=t,e.advance(),!0):!1};tt.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do e.lastIntValue=10*e.lastIntValue+(t-48),e.advance();while((t=e.current())>=48&&t<=57);return!0}return!1};var Yxe=0,sl=1,ba=2;tt.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(_xt(t))return e.lastIntValue=-1,e.advance(),sl;var r=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((r=t===80)||t===112)){e.lastIntValue=-1,e.advance();var n;if(e.eat(123)&&(n=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return r&&n===ba&&e.raise("Invalid property name"),n;e.raise("Invalid property name")}return Yxe};function _xt(e){return e===100||e===68||e===115||e===83||e===119||e===87}tt.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var r=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var n=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,r,n),sl}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var i=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,i)}return Yxe};tt.regexp_validateUnicodePropertyNameAndValue=function(e,t,r){E0(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(r)||e.raise("Invalid property value")};tt.regexp_validateUnicodePropertyNameOrValue=function(e,t){if(e.unicodeProperties.binary.test(t))return sl;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return ba;e.raise("Invalid property name")};tt.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";Jxe(t=e.current());)e.lastStringValue+=il(t),e.advance();return e.lastStringValue!==""};function Jxe(e){return Wxe(e)||e===95}tt.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";Txt(t=e.current());)e.lastStringValue+=il(t),e.advance();return e.lastStringValue!==""};function Txt(e){return Jxe(e)||VR(e)}tt.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)};tt.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),r=this.regexp_classContents(e);return e.eat(93)||e.raise("Unterminated character class"),t&&r===ba&&e.raise("Negated character class may contain strings"),!0}return!1};tt.regexp_classContents=function(e){return e.current()===93?sl:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),sl)};tt.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var r=e.lastIntValue;e.switchU&&(t===-1||r===-1)&&e.raise("Invalid character class"),t!==-1&&r!==-1&&t>r&&e.raise("Range out of order in character class")}}};tt.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var r=e.current();(r===99||Xxe(r))&&e.raise("Invalid class escape"),e.raise("Invalid escape")}e.pos=t}var n=e.current();return n!==93?(e.lastIntValue=n,e.advance(),!0):!1};tt.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)};tt.regexp_classSetExpression=function(e){var t=sl,r;if(!this.regexp_eatClassSetRange(e))if(r=this.regexp_eatClassSetOperand(e)){r===ba&&(t=ba);for(var n=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(r=this.regexp_eatClassSetOperand(e))){r!==ba&&(t=sl);continue}e.raise("Invalid character in character class")}if(n!==e.pos)return t;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise("Invalid character in character class");if(n!==e.pos)return t}else e.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(e)){if(r=this.regexp_eatClassSetOperand(e),!r)return t;r===ba&&(t=ba)}};tt.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var r=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var n=e.lastIntValue;return r!==-1&&n!==-1&&r>n&&e.raise("Range out of order in character class"),!0}e.pos=t}return!1};tt.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?sl:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)};tt.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var r=e.eat(94),n=this.regexp_classContents(e);if(e.eat(93))return r&&n===ba&&e.raise("Negated character class may contain strings"),n;e.pos=t}if(e.eat(92)){var i=this.regexp_eatCharacterClassEscape(e);if(i)return i;e.pos=t}return null};tt.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var r=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return r}else e.raise("Invalid escape");e.pos=t}return null};tt.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===ba&&(t=ba);return t};tt.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?sl:ba};tt.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return this.regexp_eatCharacterEscape(e)||this.regexp_eatClassSetReservedPunctuator(e)?!0:e.eat(98)?(e.lastIntValue=8,!0):(e.pos=t,!1);var r=e.current();return r<0||r===e.lookahead()&&Qxt(r)||Rxt(r)?!1:(e.advance(),e.lastIntValue=r,!0)};function Qxt(e){return e===33||e>=35&&e<=38||e>=42&&e<=44||e===46||e>=58&&e<=64||e===94||e===96||e===126}function Rxt(e){return e===40||e===41||e===45||e===47||e>=91&&e<=93||e>=123&&e<=125}tt.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return Dxt(t)?(e.lastIntValue=t,e.advance(),!0):!1};function Dxt(e){return e===33||e===35||e===37||e===38||e===44||e===45||e>=58&&e<=62||e===64||e===96||e===126}tt.regexp_eatClassControlLetter=function(e){var t=e.current();return VR(t)||t===95?(e.lastIntValue=t%32,e.advance(),!0):!1};tt.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise("Invalid escape"),e.pos=t}return!1};tt.regexp_eatDecimalDigits=function(e){var t=e.pos,r=0;for(e.lastIntValue=0;VR(r=e.current());)e.lastIntValue=10*e.lastIntValue+(r-48),e.advance();return e.pos!==t};function VR(e){return e>=48&&e<=57}tt.regexp_eatHexDigits=function(e){var t=e.pos,r=0;for(e.lastIntValue=0;Zxe(r=e.current());)e.lastIntValue=16*e.lastIntValue+Kxe(r),e.advance();return e.pos!==t};function Zxe(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Kxe(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}tt.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var r=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=t*64+r*8+e.lastIntValue:e.lastIntValue=t*8+r}else e.lastIntValue=t;return!0}return!1};tt.regexp_eatOctalDigit=function(e){var t=e.current();return Xxe(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function Xxe(e){return e>=48&&e<=55}tt.regexp_eatFixedHexDigits=function(e,t){var r=e.pos;e.lastIntValue=0;for(var n=0;n=this.input.length)return this.finishToken(x.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())};sr.readToken=function(e){return ru(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)};sr.fullCharCodeAt=function(e){var t=this.input.charCodeAt(e);if(t<=55295||t>=56320)return t;var r=this.input.charCodeAt(e+1);return r<=56319||r>=57344?t:(t<<10)+r-56613888};sr.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)};sr.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,r=this.input.indexOf("*/",this.pos+=2);if(r===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=r+2,this.options.locations)for(var n=void 0,i=t;(n=Ixe(this.input,i,this.pos))>-1;)++this.curLine,i=this.lineStart=n;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,r),t,this.pos,e,this.curPosition())};sr.skipLineComment=function(e){for(var t=this.pos,r=this.options.onComment&&this.curPosition(),n=this.input.charCodeAt(this.pos+=e);this.pos8&&e<14||e>=5760&&wxe.test(String.fromCharCode(e)))++this.pos;else break e}}};sr.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var r=this.type;this.type=e,this.value=t,this.updateContext(r)};sr.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&e===46&&t===46?(this.pos+=3,this.finishToken(x.ellipsis)):(++this.pos,this.finishToken(x.dot))};sr.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(x.assign,2):this.finishOp(x.slash,1)};sr.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),r=1,n=e===42?x.star:x.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++r,n=x.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(x.assign,r+1):this.finishOp(n,r)};sr.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);if(t===e){if(this.options.ecmaVersion>=12){var r=this.input.charCodeAt(this.pos+2);if(r===61)return this.finishOp(x.assign,3)}return this.finishOp(e===124?x.logicalOR:x.logicalAND,2)}return t===61?this.finishOp(x.assign,2):this.finishOp(e===124?x.bitwiseOR:x.bitwiseAND,1)};sr.readToken_caret=function(){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(x.assign,2):this.finishOp(x.bitwiseXOR,1)};sr.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?t===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||no.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(x.incDec,2):t===61?this.finishOp(x.assign,2):this.finishOp(x.plusMin,1)};sr.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),r=1;return t===e?(r=e===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+r)===61?this.finishOp(x.assign,r+1):this.finishOp(x.bitShift,r)):t===33&&e===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(t===61&&(r=2),this.finishOp(x.relational,r))};sr.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(x.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(x.arrow)):this.finishOp(e===61?x.eq:x.prefix,1)};sr.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(t===46){var r=this.input.charCodeAt(this.pos+2);if(r<48||r>57)return this.finishOp(x.questionDot,2)}if(t===63){if(e>=12){var n=this.input.charCodeAt(this.pos+2);if(n===61)return this.finishOp(x.assign,3)}return this.finishOp(x.coalesce,2)}}return this.finishOp(x.question,1)};sr.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),ru(t,!0)||t===92))return this.finishToken(x.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+il(t)+"'")};sr.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(x.parenL);case 41:return++this.pos,this.finishToken(x.parenR);case 59:return++this.pos,this.finishToken(x.semi);case 44:return++this.pos,this.finishToken(x.comma);case 91:return++this.pos,this.finishToken(x.bracketL);case 93:return++this.pos,this.finishToken(x.bracketR);case 123:return++this.pos,this.finishToken(x.braceL);case 125:return++this.pos,this.finishToken(x.braceR);case 58:return++this.pos,this.finishToken(x.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(x.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(t===120||t===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(t===111||t===79)return this.readRadixNumber(8);if(t===98||t===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(x.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+il(e)+"'")};sr.finishOp=function(e,t){var r=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,r)};sr.readRegexp=function(){for(var e,t,r=this.pos;;){this.pos>=this.input.length&&this.raise(r,"Unterminated regular expression");var n=this.input.charAt(this.pos);if(no.test(n)&&this.raise(r,"Unterminated regular expression"),e)e=!1;else{if(n==="[")t=!0;else if(n==="]"&&t)t=!1;else if(n==="/"&&!t)break;e=n==="\\"}++this.pos}var i=this.input.slice(r,this.pos);++this.pos;var s=this.pos,o=this.readWord1();this.containsEsc&&this.unexpected(s);var a=this.regexpState||(this.regexpState=new nu(this));a.reset(r,i,o),this.validateRegExpFlags(a),this.validateRegExpPattern(a);var c=null;try{c=new RegExp(i,o)}catch{}return this.finishToken(x.regexp,{pattern:i,flags:o,value:c})};sr.readInt=function(e,t,r){for(var n=this.options.ecmaVersion>=12&&t===void 0,i=r&&this.input.charCodeAt(this.pos)===48,s=this.pos,o=0,a=0,c=0,u=t??1/0;c=97?d=l-97+10:l>=65?d=l-65+10:l>=48&&l<=57?d=l-48:d=1/0,d>=e)break;a=l,o=o*e+d}return n&&a===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===s||t!=null&&this.pos-s!==t?null:o};function Nxt(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function eBe(e){return typeof BigInt!="function"?null:BigInt(e.replace(/_/g,""))}sr.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var r=this.readInt(e);return r==null&&this.raise(this.start+2,"Expected number in radix "+e),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(r=eBe(this.input.slice(t,this.pos)),++this.pos):ru(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(x.num,r)};sr.readNumber=function(e){var t=this.pos;!e&&this.readInt(10,void 0,!0)===null&&this.raise(t,"Invalid number");var r=this.pos-t>=2&&this.input.charCodeAt(t)===48;r&&this.strict&&this.raise(t,"Invalid number");var n=this.input.charCodeAt(this.pos);if(!r&&!e&&this.options.ecmaVersion>=11&&n===110){var i=eBe(this.input.slice(t,this.pos));return++this.pos,ru(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(x.num,i)}r&&/[89]/.test(this.input.slice(t,this.pos))&&(r=!1),n===46&&!r&&(++this.pos,this.readInt(10),n=this.input.charCodeAt(this.pos)),(n===69||n===101)&&!r&&(n=this.input.charCodeAt(++this.pos),(n===43||n===45)&&++this.pos,this.readInt(10)===null&&this.raise(t,"Invalid number")),ru(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var s=Nxt(this.input.slice(t,this.pos),r);return this.finishToken(x.num,s)};sr.readCodePoint=function(){var e=this.input.charCodeAt(this.pos),t;if(e===123){this.options.ecmaVersion<6&&this.unexpected();var r=++this.pos;t=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(r,"Code point out of bounds")}else t=this.readHexChar(4);return t};sr.readString=function(e){for(var t="",r=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var n=this.input.charCodeAt(this.pos);if(n===e)break;n===92?(t+=this.input.slice(r,this.pos),t+=this.readEscapedChar(!1),r=this.pos):n===8232||n===8233?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(b0(n)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(r,this.pos++),this.finishToken(x.string,t)};var tBe={};sr.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===tBe)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1};sr.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw tBe;this.raise(e,t)};sr.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var r=this.input.charCodeAt(this.pos);if(r===96||r===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===x.template||this.type===x.invalidTemplate)?r===36?(this.pos+=2,this.finishToken(x.dollarBraceL)):(++this.pos,this.finishToken(x.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(x.template,e));if(r===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(b0(r)){switch(e+=this.input.slice(t,this.pos),++this.pos,r){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:e+=`
+`;break;default:e+=String.fromCharCode(r);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}};sr.readInvalidTemplateToken=function(){for(;this.pos=48&&t<=55){var n=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],i=parseInt(n,8);return i>255&&(n=n.slice(0,-1),i=parseInt(n,8)),this.pos+=n.length-1,t=this.input.charCodeAt(this.pos),(n!=="0"||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-n.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(i)}return b0(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(t)}};sr.readHexChar=function(e){var t=this.pos,r=this.readInt(16,e);return r===null&&this.invalidStringToken(t,"Bad character escape sequence"),r};sr.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,r=this.pos,n=this.options.ecmaVersion>=6;this.posnBe?`${r.slice(0,nBe)}...`:r}function Uxt(e){return!e||e.type!=="ArrayExpression"||e.elements.length===0?!1:e.elements.every(t=>!t||t.type!=="ObjectExpression"?!1:(t.properties??[]).some(r=>{let n=r.key?.name??r.key?.value;return n==="id"||n==="slug"||typeof n=="string"&&/id$/i.test(n)}))}function xw(e){return e?e.type==="Literal"?!0:e.type==="ArrayExpression"?(e.elements??[]).every(t=>t===null||xw(t)):e.type==="ObjectExpression"?(e.properties??[]).every(t=>!t||t.type!=="Property"||t.kind!=="init"||t.method||t.shorthand||t.computed&&!xw(t.key)?!1:xw(t.value)):e.type==="UnaryExpression"&&["-","+","!","~"].includes(e.operator)?xw(e.argument):e.type==="TemplateLiteral"?(e.expressions??[]).length===0:!1:!1}function $xt(e,t){let r=e.slice(t.start,t.end),n=Oxt(e,t);if(r.length>Lxt)return{confidence:"low",evidence:`literal too large (${r.length} chars) :: ${n}`};if(!xw(t))return{confidence:"low",evidence:n};try{let i=Pxt(`(${r})`,Object.create(null),{timeout:1e3});return!Array.isArray(i)||i.length>Fxt?{confidence:"low",evidence:n}:{records:i,confidence:"high",evidence:n}}catch(i){return{confidence:"low",evidence:`${i.message} :: ${n}`}}}function Hxt(e){return e??"(anonymous)"}function iBe(e){let t=Rh(e);if(!t)return[];let r=[],n=new Set,i=(s,o)=>{!Uxt(s)||n.has(s.start)||(n.add(s.start),r.push({name:Hxt(o),...$xt(e,s)}))};return Qh(t,s=>{if(s.type==="VariableDeclarator"&&s.id?.type==="Identifier"&&i(s.init,s.id.name),s.type==="AssignmentExpression"){let o=s.left,a=o?.type==="Identifier"?o.name:o?.property?.name;i(s.right,a)}s.type==="Property"&&i(s.value,s.key?.name??s.key?.value),s.type==="ReturnStatement"&&i(s.argument,void 0)}),r}var jxt=/^(#[\w-]+|\.[\w-]+|\[[\w-]+(=("[^"]*"|'[^']*'|[\w-]+))?\])$/;function qxt(e){for(let t of e.arguments??[])if(t.type==="Literal"&&typeof t.value=="number")return t.value;for(let t of e.arguments??[])if(t.type==="CallExpression"){let r=(t.arguments??[]).find(n=>n.type==="Literal"&&typeof n.value=="number");if(r)return r.value}}function sBe(e,t){let r=le(e),n=Rh(t),i=new Map;n&&Qh(n,a=>{if(a.type!=="CallExpression")return;let c=(a.arguments??[]).filter(u=>u.type==="Literal"&&typeof u.value=="string").map(u=>String(u.value)).find(u=>jxt.test(u));c&&!i.has(c)&&i.set(c,{source:t.slice(a.start,a.end),perPage:qxt(a)})});let s=[],o=new Set;for(let[a,c]of i){let u=r(a).first();u.length!==0&&(o.add(a),s.push({selector:a,wrapperClass:u.attr("class")||void 0,sourceCall:c.source,perPageHint:c.perPage,confidence:"high",evidence:c.source}))}return r("[id]").each((a,c)=>{let l=`#${r(c).attr("id")}`;o.has(l)||r(c).children().length>0||s.push({selector:l,wrapperClass:r(c).attr("class")||void 0,confidence:"low",evidence:`empty container ${l} has no matching JS call`})}),s}function oBe(e){let t=Rh(e);if(!t)return[];let r=new Set,n=i=>i?.type==="MemberExpression"&&i.property?.name==="id";return Qh(t,i=>{if(i.type==="CallExpression"&&i.callee?.type==="MemberExpression"&&i.callee.property?.name==="find"&&i.callee.object?.type==="Identifier"){let s=i.arguments?.[0]?.body;s?.type==="BinaryExpression"&&/^===?$/.test(s.operator)&&(n(s.left)||n(s.right))&&r.add(i.callee.object.name)}}),[...r]}var zxt=["title","name","label","heading"],Vxt=["content","story","description","body","excerpt"],Gxt=["category","cat","kind","type","collection","group"],Wxt=["images","gallery","photos","media"];var Yxt=e=>[...new Set(e.flatMap(t=>Object.keys(t)))],Xd=(e,t)=>e.map(r=>r[t]).filter(r=>r!==void 0),Jxt=e=>e.length>0&&e.every(t=>typeof t=="string"||typeof t=="number"),FV=e=>e.length>0&&e.every(t=>typeof t=="string"),Zxt=e=>new Set(e).size===e.length,I0=(e,t)=>e.find(r=>t.includes(r.toLowerCase()));function OV(e,t){let r=Xd(e,t).filter(n=>typeof n=="string");return r.length?r.reduce((n,i)=>n+i.length,0)/r.length:0}function Kxt(e){return Array.isArray(e)&&e.every(t=>typeof t=="string"||!!(t&&typeof t=="object"&&("caption"in t||"url"in t)))}function Xxt(e){return e.every(t=>typeof t=="boolean")?"boolean":e.every(t=>typeof t=="number")?e.every(t=>Number.isInteger(t))?"integer":"number":"string"}function eBt(e){let t=e.filter(r=>typeof r=="string");if(t.length!==0){if(t.every(r=>/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(r)))return"email";if(t.every(r=>/^https?:\/\//.test(r)))return"url";if(t.every(r=>/^\d{4}-\d{2}-\d{2}/.test(r)))return"date";if(t.some(r=>r.length>=60))return"textarea"}}function tBt(e,t){let r=Xd(e,t),n=Xxt(r),i=n==="string"?eBt(r):void 0;return i?{key:t,type:n,format:i}:{key:t,type:n}}function aBe(e){let t=Yxt(e),r=I0(t,["id","slug"])??t[0]??"id",n="low";I0(t,["id","slug"])&&Jxt(Xd(e,r))&&Zxt(Xd(e,r))&&(n="high");let i=I0(t,zxt),s=i?"high":"low";i||(i=t.filter(f=>f!==r&&FV(Xd(e,f))).sort((f,p)=>OV(e,f)-OV(e,p))[0]??r);let o=I0(t,Vxt)??t.find(f=>f!==i&&FV(Xd(e,f))&&OV(e,f)>=60),a=I0(t,Gxt),c=a?"high":"low";a||(a=t.find(f=>{let p=Xd(e,f);return f!==r&&f!==i&&FV(p)&&new Set(p).size<=Math.max(1,Math.floor(p.length/2))}),a&&(c="low"));let u=I0(t,Wxt)??t.find(f=>{let p=Xd(e,f);return p.length>0&&p.every(Kxt)}),l=new Set;n==="high"&&l.add(r),s==="high"&&l.add(i),o&&l.add(o),a&&c==="high"&&l.add(a),u&&l.add(u);let d=t.filter(f=>!l.has(f)).map(f=>tBt(e,f));return{idKey:r,titleKey:i,contentKey:o,termKey:a,galleryKey:u,fields:d,confidence:{id:n,title:s,terms:c}}}function cBe(e,t){let r=`${e}::${t}`,n=2166136261;for(let i=0;i>>0).toString(36)}`}var nBt=2e5,iBt=5e3,UV=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),sBt=e=>e.replace(/s$/i,""),$V=e=>e.replace(/[-_]+/g," ").replace(/\b\w/g,t=>t.toUpperCase()).trim(),uBe=e=>["string","number","boolean"].includes(typeof e),oBt=["newest","recent","latest"],fBe=(e,t)=>e?"category":`${t}_cat`;function pBe(e){let t=[],r=mBt(e.js),n=oBe(e.js),i=sBe(e.html,e.js),o={arrays:r.map(d=>({name:d.name,confidence:d.confidence,recordCount:d.records?.length,reason:d.confidence==="low"?d.evidence.slice(0,120):void 0})),skippedFiles:e.skippedFiles??[],unmatchedContainers:i.filter(d=>d.confidence==="low"||!d.sourceCall).map(d=>d.selector)},a=dBt(r,n,i);if(a?.records)return lBe({records:a.records,typeName:a.name,mounts:i,idLookupNames:n,source:"js-array",cardTemplateTodoEvidence:IBt(e.js),deterministicCard:void 0,discovered:o,todos:t});let c=e.htmlFiles?.length?e.htmlFiles.flatMap(d=>wV(d.text,{resolvePage:e.resolvePage}).map((f,p)=>({grid:f,disambiguator:`${d.name}:${p}`,sourcePage:d.name}))):wV(e.html,{resolvePage:e.resolvePage}).map((d,f)=>({grid:d,disambiguator:String(f),sourcePage:void 0})),u=c.filter(({grid:d})=>d.records.length>=1);if(u.length>0){let d=aBt(u.flatMap(({grid:A})=>A.records)),f=u.find(({grid:A})=>A.featured),p=fBe(!0,"post"),h=u.map(({grid:A,disambiguator:g,sourcePage:m})=>({selector:`#${cBe(A.containerSelector,g)}`,sourceSelector:A.containerSelector,...m?{sourcePage:m}:{},sourceCall:`html-cards:${A.containerSelector}`,...A.containerClass?{wrapperClass:A.containerClass}:{},perPageHint:A.records.length,...A.featured?{featured:{columnWrapperClass:A.featured.columnWrapperClass,leadPerPage:A.featured.leadCount,columnPerPage:A.records.length-A.featured.leadCount,variant:"row",...A.featured.termSlug?{termSlug:A.featured.termSlug,taxonomy:p}:{}}}:{},confidence:"high",evidence:A.evidence}));return lBe({records:d,coreType:"post",mounts:h,idLookupNames:[],source:"html-cards",cardTemplateTodoEvidence:void 0,deterministicCard:u[0].grid.cardTemplate,deterministicCardVariants:f?.grid.featured?{row:f.grid.featured.rowTemplate}:void 0,discovered:{...o,unmatchedContainers:c.filter(({grid:A})=>A.records.length===0).map(({grid:A})=>A.containerSelector)},todos:t})}let l=gBt();return t.push({path:"items",instruction:"No static data array literal and no repeated content-card grid were found. Author items[] and the model by hand from the source.",evidence:r[0]?.evidence??"(no array-like declarations or card grids found)"}),{model:l,skillTodos:t,discovered:{...o,source:"none"},validation:Cw(l)}}function lBe(e){let{records:t,todos:r}=e,n=e.coreType==="post",i=aBe(t),s=n&&t.some(h=>Object.prototype.hasOwnProperty.call(h,"content"))?{...i,contentKey:"content",fields:cBt(t,i).filter(h=>h.key!=="content")}:i,o=e.typeName??"item",a=sBt(o==="(anonymous)"?"item":o).toLowerCase(),c=n?"post":UV(a)||"item",u=fBe(n,c),l=new Map;if(s.termKey)for(let h of t){let A=h[s.termKey];typeof A=="string"&&l.set(UV(A),$V(A))}let d=t.map(h=>{let A={};for(let C of s.fields){let I=h[C.key];uBe(I)&&(A[C.key]=I)}let g=s.galleryKey?h[s.galleryKey]:void 0,m=Array.isArray(g)?g.map(C=>{if(typeof C=="string")return{caption:C};let I=C;return{caption:String(I.caption??""),url:I.url}}):[],b=s.termKey?h[s.termKey]:void 0,E=h[s.idKey];return{id:uBe(E)?String(E):"",title:String(h[s.titleKey]??""),terms:typeof b=="string"?[UV(b)]:[],meta:A,gallery:m,content:s.contentKey?String(h[s.contentKey]??""):void 0}}),f=[];for(let h of e.mounts){if(h.confidence!=="high"||!h.sourceCall)continue;let A=f.length,g=h.perPageHint??-1,m=pBt(h,g);m.confidence==="low"&&r.push({path:`mounts[${A}].query.order`,instruction:`Confirm ordering/perPage for ${h.selector}; source call: "${h.sourceCall}". Default applied: date/DESC. Adjust to match the source's selection semantics.`,evidence:h.evidence}),f.push({selector:h.selector,sourceCall:h.sourceCall,query:{postType:c,perPage:g,orderBy:"date",order:m.order},wrapperClass:h.wrapperClass,...h.sourceSelector?{sourceSelector:h.sourceSelector}:{},...h.sourcePage?{sourcePage:h.sourcePage}:{},...h.featured?{featured:h.featured}:{}})}e.cardTemplateTodoEvidence&&r.unshift({path:"card.template",instruction:"Author card.template: rewrite the source per-item card function into a single-root skeleton with data-dla-* bindings (data-dla-text/attr/class/if), preserving the source classes. Reference: id, title, content, cat.slug, cat.label, meta., gallery..caption, map... Add any value-keyed lookups to card.maps.",evidence:e.cardTemplateTodoEvidence}),s.confidence.id==="low"&&r.push({path:"items[].id",instruction:`The id field was guessed ('${s.idKey}') and may be non-unique or non-scalar; confirm/choose the stable per-item id (it is the idempotency key for inserts).`,evidence:`record keys: ${Object.keys(t[0]??{}).join(", ")}`}),s.confidence.title==="low"&&r.push({path:"items[].title",instruction:`Title was guessed ('${s.titleKey}') with no name match; confirm it is the human title.`,evidence:`record keys: ${Object.keys(t[0]??{}).join(", ")}`}),s.confidence.terms==="low"&&s.termKey&&r.push({path:"taxonomy",instruction:`Taxonomy column was guessed ('${s.termKey}') by low cardinality; confirm it is a content category.`,evidence:`distinct: ${[...l.keys()].join(", ")}`});let p={cpt:n?{slug:"post",singular:"Post",plural:"Posts",public:!0,supports:["title","editor","thumbnail","custom-fields"]}:{slug:c,singular:$V(a),plural:$V((o==="(anonymous)"?"items":o).toLowerCase()),public:!0,supports:["title","editor","custom-fields"]},taxonomy:{slug:u,label:"Categories",hierarchical:!0,terms:[...l].map(([h,A])=>({slug:h,label:A}))},fields:s.fields,items:d,mounts:f,card:{template:e.deterministicCard??"",maps:{},...e.deterministicCardVariants?{variants:e.deterministicCardVariants}:{}},sourceArrays:n?[]:[...new Set([...e.idLookupNames,o].filter(h=>h&&h!=="(anonymous)"))],schema:3};return{model:p,skillTodos:r,discovered:{...e.discovered,source:e.source},validation:Cw(p)}}function aBt(e){let t=new Map,r=[];for(let n of e){let i=n.id;if(typeof i=="string"&&i){let s=t.get(i);if(s){let o=dBe(s),a=dBe(n);o!==a&&console.warn(`[local-data] dropping duplicate card id "${i}" (title "${a}") - shared id/idempotency key`);continue}t.set(i,n)}r.push(n)}return r}function dBe(e){let t=e.title;return t==null?"":String(t)}function cBt(e,t){let r=[...t.fields];t.contentKey&&t.contentKey!=="content"&&!r.some(i=>i.key===t.contentKey)&&r.push(lBt(e,t.contentKey));let n=new Map(uBt(e).map((i,s)=>[i,s]));return r.sort((i,s)=>(n.get(i.key)??Number.MAX_SAFE_INTEGER)-(n.get(s.key)??Number.MAX_SAFE_INTEGER))}function uBt(e){return[...new Set(e.flatMap(t=>Object.keys(t)))]}function lBt(e,t){let r=e.map(i=>i[t]).filter(i=>i!==void 0);if(r.length>0&&r.every(i=>typeof i=="boolean"))return{key:t,type:"boolean"};if(r.length>0&&r.every(i=>typeof i=="number"))return{key:t,type:r.every(i=>Number.isInteger(i))?"integer":"number"};let n=r.filter(i=>typeof i=="string");return n.length>0&&n.every(i=>/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(i))?{key:t,type:"string",format:"email"}:n.length>0&&n.every(i=>/^https?:\/\//.test(i))?{key:t,type:"string",format:"url"}:n.length>0&&n.every(i=>/^\d{4}-\d{2}-\d{2}/.test(i))?{key:t,type:"string",format:"date"}:n.some(i=>i.length>=60)?{key:t,type:"string",format:"textarea"}:{key:t,type:"string"}}function dBt(e,t,r){let n=e.filter(c=>c.records?.length);if(n.length===0)return;let i=new Set(t),s=n.find(c=>i.has(c.name));if(s)return s;let o=r.map(c=>c.sourceCall).filter(c=>!!c),a=n.find(c=>o.some(u=>fBt(u,c.name)));return a||n.reduce((c,u)=>(u.records?.length??0)>(c.records?.length??0)?u:c)}function fBt(e,t){if(!/^[A-Za-z_$][\w$]*$/.test(t))return!1;let r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`(^|[^A-Za-z0-9_$])${r}($|[^A-Za-z0-9_$])`).test(e)}function pBt(e,t){return e.sourceCall?.startsWith("html-cards:")?{order:"ASC",confidence:"high"}:e.perPageHint===void 0||t===-1?{order:"ASC",confidence:"high"}:hBt(e.sourceCall??"")?{order:"DESC",confidence:"high"}:{order:"DESC",confidence:"low"}}function hBt(e){return(e.match(/[A-Za-z][A-Za-z0-9_$]*/g)??[]).some(r=>oBt.some(n=>ABt(r,n)))}function ABt(e,t){let r=e.toLowerCase();if(r===t)return!0;if(!r.startsWith(t))return!1;let n=e[t.length];return!!(n&&/[A-Z0-9_$]/.test(n))}function gBt(){return{cpt:{slug:"item",singular:"Item",plural:"Items",public:!0,supports:["title","editor","custom-fields"]},taxonomy:{slug:"item_cat",label:"Categories",hierarchical:!0,terms:[]},fields:[],items:[],mounts:[],card:{template:"",maps:{}},sourceArrays:[],schema:3}}function mBt(e){let t=iBe(e);return t.some(r=>r.records?.length)?t:[...t,...yBt(e,t)]}function yBt(e,t){let r=Rh(e);if(!r)return[];let n=new Set(t.map(a=>a.evidence)),i=[],s=new Set,o=(a,c)=>{if(!bBt(a)||s.has(a.start))return;s.add(a.start);let u=CBt(e,a);if(n.has(u))return;let l=EBt(e,a,u);i.push({name:c,...l})};return Qh(r,a=>{if(a.type==="VariableDeclarator"&&a.id?.type==="Identifier"&&o(a.init,a.id.name),a.type==="AssignmentExpression"){let c=a.left,u=c?.type==="Identifier"?c.name:c?.property?.name;o(a.right,u??"(anonymous)")}a.type==="Property"&&o(a.value,String(a.key?.name??a.key?.value??"(anonymous)"))}),i}function bBt(e){return!!(e?.type==="ArrayExpression"&&e.elements?.length>0&&e.elements.every(t=>t?.type==="ObjectExpression"))}function Bw(e){return e?e.type==="Literal"?!0:e.type==="ArrayExpression"?(e.elements??[]).every(t=>t===null||Bw(t)):e.type==="ObjectExpression"?(e.properties??[]).every(t=>!t||t.type!=="Property"||t.kind!=="init"||t.method||t.shorthand||t.computed&&!Bw(t.key)?!1:Bw(t.value)):e.type==="UnaryExpression"&&["-","+","!","~"].includes(e.operator)?Bw(e.argument):e.type==="TemplateLiteral"?(e.expressions??[]).length===0:!1:!1}function EBt(e,t,r){let n=e.slice(t.start,t.end);if(n.length>nBt)return{confidence:"low",evidence:`literal too large (${n.length} chars) :: ${r}`};if(!Bw(t))return{confidence:"low",evidence:r};try{let i=rBt(`(${n})`,Object.create(null),{timeout:1e3});return!Array.isArray(i)||i.length>iBt?{confidence:"low",evidence:r}:{records:i,confidence:"high",evidence:r}}catch(i){return{confidence:"low",evidence:`${i.message} :: ${r}`}}}function CBt(e,t){let r=e.slice(t.start,t.end);return r.length>400?`${r.slice(0,400)}...`:r}function IBt(e){let t=e.match(/function\s+\w*[Cc]ard\s*\([^)]*\)\s*\{[\s\S]*?\}/);return t?t[0].length>600?`${t[0].slice(0,600)}...`:t[0]:"(no *Card function found; author from the rendered card markup)"}var _Bt=256*1024;function HV(e,t){if(!gBe(e))return[];let r=[];for(let n of wBt(e))if(t.includes(xBt(n).toLowerCase()))try{r.push({name:n,text:mBe(GR(e,n),"utf8")})}catch{}return r}function TBt(e){let t=[];for(let r of e)try{let n=le(r.text);n("script").each((i,s)=>{if(n(s).attr("src")!==void 0)return;let o=n(s).text();o.trim()&&t.push(o)})}catch{}return t}function QBt(e){return t=>{if(!t||/^(https?:|mailto:|tel:|#|javascript:)/i.test(t))return null;let r=decodeURIComponent(t.split(/[?#]/)[0]);if(!r||ABe(r))return null;let n=hBe(kBt(e)),i=hBe(GR(n,r));if(!i.startsWith(n))return null;let s=BBt(n,i);if(s.startsWith("..")||ABe(s)||!/\.html?$/i.test(i))return null;try{return gBe(i)?mBe(i,"utf8"):null}catch{return null}}}var yBe=async(e,t)=>{let r=e.dir,n=e.outputDir??r;if(!r)return t.errorResult("dir is required");if(!n)return t.errorResult("outputDir is required");let i=Date.now();try{let s=HV(r,[".html",".htm"]),o=s.map(f=>f.text).join(`
+`),a=[...HV(GR(r,"assets"),[".js"]),...HV(r,[".js"])],c=TBt(s),u=[],l=[];for(let f of a){if(f.text.length>_Bt||Rh(f.text)===null){u.push(f.name);continue}l.push(f.text)}let d=pBe({html:o,htmlFiles:s,js:[...l,...c].join(`
+`),skippedFiles:u,resolvePage:QBt(r)});return vBt(n,{recursive:!0}),SBt(GR(n,"data-model.draft.json"),JSON.stringify(d.model,null,2),"utf8"),console.error(`[data-model] ${JSON.stringify({tool:"scaffold",dir:r,ok:!0,source:d.discovered.source,items:d.model.items.length,todos:d.skillTodos.length,arrays:d.discovered.arrays,skipped:u,durationMs:Date.now()-i})}`),t.textResult(d)}catch(s){return console.error(`[data-model] ${JSON.stringify({tool:"scaffold",dir:r,ok:!1,durationMs:Date.now()-i})}`),t.errorResult(s.message)}};var bBe=async(e,t)=>{let r=e.outputDir,n=e.origin,i=Date.now();try{let{scaffoldDesignFoundation:s}=await Promise.resolve().then(()=>(wj(),Ube)),o=s(r,{origin:n});return console.error(`[design-foundation] ${JSON.stringify({tool:"scaffold",outputDir:r,ok:!0,durationMs:Date.now()-i})}`),t.textResult(o)}catch(s){return console.error(`[design-foundation] ${JSON.stringify({tool:"scaffold",outputDir:r,ok:!1,durationMs:Date.now()-i})}`),t.errorResult(s.message)}};function EBe(e,t){let r=t.split("."),n=e;for(let c of r){if(!n||typeof n!="object")return!1;n=n[c]}if(!n||typeof n!="object")return!1;let i=n,s=Array.isArray(i.evidence)&&i.evidence.length>0,o=typeof i.value=="string"&&i.value.length>0&&i.value!=="TODO"||typeof i.css=="string"&&i.css.length>0&&i.css!=="TODO",a=typeof i.role=="string"&&i.role.length>0&&i.role!=="TODO";return s&&o&&a}var vBe=async(e,t)=>{let r=e.foundation,n=Date.now(),{DesignFoundationSchema:i}=await Promise.resolve().then(()=>(zV(),SBe)),s=i.safeParse(r),o={ok:s.success};if(s.success||(o.errors=s.error.issues),s.success){let a=s.data,c=[];for(let u of a.skillTodos)EBe(a,u)||c.push(u);c.length>0&&(o.ok=!1,o.errors=c.map(u=>({code:"skill_todo_unfilled",path:u.split("."),message:`skillTodos entry "${u}" is still empty or TODO`})))}return console.error(`[design-foundation] ${JSON.stringify({tool:"validate",ok:o.ok,durationMs:Date.now()-n,errorCount:o.errors?.length??0})}`),t.textResult(o)};var NBe=async(e,t)=>{let r=e.outputDir,n=e.foundation,i=!!e.force,s=Date.now(),{saveDesignFoundation:o}=await Promise.resolve().then(()=>(DBe(),RBe));try{let a=o(r,n,{force:i});return console.error(`[design-foundation] ${JSON.stringify({tool:"save",outputDir:r,ok:a.ok,durationMs:Date.now()-s,...a.ok?{unchanged:a.unchanged}:{errorCount:a.errors.length}})}`),t.textResult(a)}catch(a){return console.error(`[design-foundation] ${JSON.stringify({tool:"save",outputDir:r,ok:!1,durationMs:Date.now()-s})}`),t.errorResult(a.message)}};var UBe=async(e,t)=>{let r=e.outputDir,n=Date.now();try{let{inventoryReplica:i}=await Promise.resolve().then(()=>(OBe(),FBe)),s=i(r);return console.error(`[replicate] ${JSON.stringify({tool:"inventory",outputDir:r,ok:!0,durationMs:Date.now()-n,archetypes:Object.fromEntries(Object.entries(s.archetypes).map(([o,a])=>[o,a.count]))})}`),t.textResult(s)}catch(i){return console.error(`[replicate] ${JSON.stringify({tool:"inventory",outputDir:r,ok:!1,durationMs:Date.now()-n})}`),t.errorResult(i.message)}};var GBe=async(e,t)=>{let r=e.outputDir,n=e.replicaBaseUrl,i=e.urls??[],s=Date.now();try{let{verifyReplica:o}=await Promise.resolve().then(()=>(VBe(),zBe)),a=await o({outputDir:r,replicaBaseUrl:n,urls:i,viewports:e.viewports,outputSubdir:e.outputSubdir,cdpPort:e.cdpPort,concurrency:e.concurrency});return console.error(`[replicate] ${JSON.stringify({tool:"verify",outputDir:r,replicaBaseUrl:n,urlCount:i.length,ok:a.ok,durationMs:Date.now()-s})}`),t.textResult(a)}catch(o){return console.error(`[replicate] ${JSON.stringify({tool:"verify",outputDir:r,replicaBaseUrl:n,ok:!1,durationMs:Date.now()-s})}`),t.errorResult(o.message)}};import{writeFileSync as wkt,renameSync as Skt}from"node:fs";import{join as vkt}from"node:path";var cke=async(e,t)=>{let r=e.originDir,n=e.replicaDir;if(!r||!n)return t.errorResult("liberate_compare requires originDir + replicaDir");let i=Date.now();try{let{compareScreenshotDirs:s,buildRepairTasks:o,DEFAULT_MAX_HEIGHT_DELTA:a}=await Promise.resolve().then(()=>(eD(),ake)),c=e.maxHeightDelta??a,u=e.floor??.99,l=await s({originDir:r,replicaDir:n,viewports:e.viewports,diffOutputDir:e.diffOutputDir,maxHeightDelta:c}),d=o(l.results,{floor:u}),f=vkt(n,"repair-tasks.json"),p=`${f}.tmp.${process.pid}`;return wkt(p,JSON.stringify({schema:1,floor:u,maxHeightDelta:c,tasks:d},null,2)+`
+`),Skt(p,f),console.error(`[compare] ${JSON.stringify({tool:"compare",originDir:r,replicaDir:n,count:l.results.length,repairTasks:d.length,durationMs:Date.now()-i})}`),t.textResult({...l,heightGate:{maxHeightDelta:c,perPage:l.results.map(h=>({pathname:h.pathname,desktop:h.desktop.heightDelta??null,mobile:h.mobile.heightDelta??null}))},repairTasks:{count:d.length,path:f}})}catch(s){return console.error(`[compare] ${JSON.stringify({tool:"compare",originDir:r,replicaDir:n,ok:!1,durationMs:Date.now()-i})}`),t.errorResult(s.message)}};function uke(e){return e.sections.map(t=>{let r=[t.columns!=null?`c${t.columns}`:"",t.mediaPosition?`m${t.mediaPosition[0]}`:"",t.imageBucket?`i${t.imageBucket[0]}`:""].filter(Boolean).join(",");return r?`${t.type}{${r}}`:t.type}).join("|")}function lke(e){let t=new Map;for(let n of e){let i=uke(n),s=t.get(i);s?s.push(n):t.set(i,[n])}let r=[];for(let[n,i]of t){let s=i.reduce((o,a)=>a.htmlBytes>o.htmlBytes?a:o);r.push({key:n,members:i.map(o=>o.url),representative:s.url,signature:s})}return{clusters:r}}var dke=async(e,t)=>{let r=e.signatures;return Array.isArray(r)?t.textResult(lke(r)):t.errorResult("signatures[] is required")};E2();var fke=async(e,t)=>{let r=e.url,n=e.detail;if(!r||!n)return t.errorResult("url and detail are required");if(n==="signature"){let i=e.html;return i?t.textResult(xme(r,i,i.length)):t.errorResult("html is required for detail=signature")}if(n==="full"){let i=e.mediaMap??{},s=typeof e.cdpPort=="number"?e.cdpPort:void 0;try{let{specs:o}=await b2(r,i,{cdpPort:s});return t.textResult(o)}catch(o){return t.errorResult(`section_extract detail=full failed for ${r}: ${o instanceof Error?o.message:String(o)}`)}}return t.errorResult(`unknown detail: ${n} (expected 'signature' or 'full')`)};function tD(e,t,r){let n=[],i=[];for(let c of e.sections){let u=``;for(let l of c.slots){let d=t[l];d==null||d===""?n.push(l):u+=`
+${String(d)}`}i.push(u)}let o=Number(t.__extraSections??0)>0,a=n.length>0||o;return{postContent:i.join(`
+`),misfit:a,sanity:{unfilledSlots:n,sectionCountMismatch:o}}}var pke=async(e,t)=>{let r=e.skeleton,n=e.pageContent;return!r||!n?t.errorResult("skeleton and pageContent are required"):t.textResult(tD(r,n,e.mediaMap??{}))};eE();import{mkdirSync as U_t,renameSync as qke,unlinkSync as zke,writeFileSync as c7}from"node:fs";import{join as Vke}from"node:path";St();import{readdirSync as xkt,readFileSync as Bkt,lstatSync as kkt}from"node:fs";import{join as _kt,relative as Tkt,sep as Qkt}from"node:path";function Rkt(e){let t=[],r=n=>{for(let i of xkt(n)){if(i.startsWith(".")||i==="node_modules")continue;let s=_kt(n,i),o=kkt(s);o.isSymbolicLink()||(o.isDirectory()?r(s):(i.toLowerCase().endsWith(".html")||i.toLowerCase().endsWith(".htm"))&&t.push(s))}};return r(e),t}function Dkt(e){return e.toLowerCase().replace(/[^a-z0-9-]+/g,"-").replace(/-{2,}/g,"-").replace(/^-+|-+$/g,"")}function hke(e){return e.map(Dkt).filter(Boolean).join("-")}function t7(e){let r=e.replace(/\.html?$/i,"").split(Qkt).filter(Boolean);return r.length===0?"home":r[r.length-1].toLowerCase()==="index"?r.length===1?"home":hke(r.slice(0,-1))||"home":hke(r)||"home"}function rD(e){let t=Rkt(e);if(t.length===0)throw new Error(`no html pages found under ${e}`);let r=t.map(i=>{let s=Bkt(i,"utf8"),o=le(s),a=Tkt(e,i),c={},u=o("body").attr()??{};for(let[l,d]of Object.entries(u))l.startsWith("data-")&&(c[l.slice(5)]=d);return{relPath:a,slug:t7(a),html:s,title:o("title").first().text().trim(),...Object.keys(c).length>0?{bodyData:c}:{}}});r.sort((i,s)=>i.slug.localeCompare(s.slug));let n=new Set;for(let i of r){if(n.has(i.slug))throw new Error(`slug collision: "${i.slug}" from "${i.relPath}"`);n.add(i.slug)}return{root:e,pages:r}}pi();St();function Ake(e){return e==="home"?"/":`/${e}/`}function nD(e,t){let r=le(e),n=new Set(t);return r("a[href]").each((i,s)=>{let o=r(s).attr("href")??"";if(!o||/^[a-z]+:/i.test(o)||o.startsWith("//")||o.startsWith("#"))return;let a=o.split(/[?#]/)[0];try{a=decodeURIComponent(a)}catch{}let c=t7(a.replace(/^\.\//,"").replace(/^\//,""));n.has(c)&&r(s).attr("href",Ake(c))}),r("body").html()??e}function gke(e,t){let r=t.flatMap(i=>{let s=Ake(i.slug);return[i.relPath,`./${i.relPath}`,`/${i.relPath}`].map(o=>({raw:o,url:s}))}).sort((i,s)=>s.raw.length-i.raw.length),n=e;for(let{raw:i,url:s}of r){let o=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");n=n.replace(new RegExp(`(['"])${o}\\1`,"g"),(a,c)=>`${c}${s}${c}`)}return n}St();En();import{createHash as Nkt}from"node:crypto";function Mkt(e){return e.split(";").map(t=>t.trim().replace(/\s+/g," ")).filter(Boolean).map(t=>{let r=t.indexOf(":");return r<0?t:`${t.slice(0,r).trim()}:${t.slice(r+1).trim()}`}).join(";")}var S0=class{rules=new Map;classFor(t){let r=Mkt(t??"");if(!r)return null;let n=`lib-i${Nkt("sha1").update(r).digest("hex").slice(0,10)}`;return this.rules.set(n,r),n}get size(){return this.rules.size}toCss(){return[...this.rules.entries()].sort((t,r)=>t[0]r[0]?1:0).map(([t,r])=>`.${t}{${r}}`).join(`
+`)}};function mke(...e){let t=new Set;for(let r of e)for(let n of(r??"").split(`
+`)){let i=n.trim();i&&t.add(i)}return[...t].sort().join(`
+`)}En();function n7(e,t,r,n={}){let i=Okt(e,t);if(!i)return null;let s=$kt(e,i);if(s.unsupported)return null;let o=[],a=0,c=new Set,u=Hkt(e,i);for(let l of s.fields){let d=l.tagName.toLowerCase(),f=e(l);if(d==="textarea"){o.push(r7("jetpack/field-textarea",iD(e,i,l,f.attr("placeholder")),{inputType:"textarea"})),a+=1;continue}if(d==="select"){let A=Wkt(e,l);if(A.length===0)return null;o.push(r7("jetpack/field-select",iD(e,i,l,Ykt(e,l),A),{inputType:"dropdown"})),a+=1;continue}if(d!=="input")return null;let p=Tw(f);if(p==="radio"){let A=(f.attr("name")??"").trim(),g=A?`name:${A}`:`node:${s.fields.indexOf(l)}`;if(c.has(g))continue;let m=Vkt(e,i,l);if(!m)return null;c.add(g),o.push(Zkt("jetpack/field-radio",m,"radio")),a+=1;continue}if(p==="checkbox"){let A=iD(e,i,l),g=e_t(e,l,A.label)?"jetpack/field-consent":"jetpack/field-checkbox";o.push(Kkt(g,A)),a+=1;continue}let h=zkt(e,l);if(!h)return null;o.push(r7(h,iD(e,i,l,f.attr("placeholder")),{inputBlockName:h==="jetpack/field-telephone"?"jetpack/phone-input":"jetpack/input",inputType:h==="jetpack/field-telephone"?void 0:p})),a+=1}return a===0?null:(u&&o.push(Jkt(e,u)),{markup:`
+