{"version":3,"file":"ai-BLH3ZnRj.mjs","names":["DEFAULT_SKILL_NAME","DEFAULT_SKILL_NAME"],"sources":["../src/ai/writers.ts","../src/ai/content-shared.ts","../src/ai/content-claude.ts","../src/ai/content-codex.ts","../src/ai/content-gemini.ts","../src/ai/content-memory.ts","../src/ai/index.ts"],"sourcesContent":["import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"fs\";\nimport { dirname } from \"path\";\nimport type { AiArtifact, AiInstallStatus } from \"./types\";\n\nexport function withManagedBlock(id: string, content: string): string {\n  return [\n    `<!-- pagesmith-ai:${id}:start -->`,\n    content.trim(),\n    `<!-- pagesmith-ai:${id}:end -->`,\n  ].join(\"\\n\");\n}\n\nexport function writeArtifact(artifact: AiArtifact, force = false): AiInstallStatus {\n  mkdirSync(dirname(artifact.path), { recursive: true });\n\n  if (!existsSync(artifact.path)) {\n    writeFileSync(artifact.path, artifact.content);\n    return \"written\";\n  }\n\n  const current = readFileSync(artifact.path, \"utf-8\");\n  if (current === artifact.content) {\n    return \"unchanged\";\n  }\n\n  if (artifact.mode === \"replace\") {\n    writeFileSync(artifact.path, artifact.content);\n    return \"replaced\";\n  }\n\n  const markerId = `${artifact.assistant ?? \"shared\"}-${artifact.kind}`;\n  const start = `<!-- pagesmith-ai:${markerId}:start -->`;\n  const end = `<!-- pagesmith-ai:${markerId}:end -->`;\n\n  if (current.includes(start) && current.includes(end)) {\n    const pattern = new RegExp(`${escapeForRegExp(start)}[\\\\s\\\\S]*?${escapeForRegExp(end)}`, \"m\");\n    const next = current.replace(pattern, artifact.content);\n    if (next === current) return \"unchanged\";\n    writeFileSync(artifact.path, next);\n    return \"merged\";\n  }\n\n  if (force) {\n    writeFileSync(artifact.path, artifact.content);\n    return \"replaced\";\n  }\n\n  const next = `${current.trimEnd()}\\n\\n${artifact.content}\\n`;\n  writeFileSync(artifact.path, next);\n  return \"merged\";\n}\n\nexport function escapeForRegExp(value: string): string {\n  return value.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n","export const PAGESMITH_TITLE = \"Pagesmith\";\nexport const DEFAULT_SKILL_NAME = \"pagesmith\";\n\nexport function renderSharedOverview(): string {\n  return [\n    `${PAGESMITH_TITLE} is a filesystem-first content toolkit with three public packages: \\`@pagesmith/core\\` (headless content layer), \\`@pagesmith/site\\` (site toolkit and \\`pagesmith-site\\`), and \\`@pagesmith/docs\\` (opinionated docs preset and \\`pagesmith-docs\\`).`,\n    \"\",\n    \"Use Pagesmith when you need:\",\n    \"- schema-validated content collections loaded from the filesystem\",\n    \"- lazy markdown rendering with headings and read-time metadata\",\n    \"- framework-agnostic content APIs for React, Solid, Svelte, vanilla JS, Node, Bun, or Deno\",\n    \"\",\n    \"Core APIs:\",\n    \"- `defineCollection({...})` to define a typed collection\",\n    \"- `defineConfig({...})` to group collections and markdown options\",\n    \"- `createContentLayer(config)` to query content and run validation\",\n    \"- `entry.render()` to convert markdown on demand\",\n    \"\",\n    \"Site APIs:\",\n    \"- `pagesmith-site` CLI for preset-driven dev/build/preview flows\",\n    \"- `@pagesmith/site/jsx-runtime` for server-side TSX\",\n    \"- `@pagesmith/site/vite` for SSG helpers\",\n    \"\",\n    \"Working rules:\",\n    \"- for first-time content-layer setup or retrofit work, start with `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/setup-core.md`\",\n    \"- for custom site setup on top of core, start with `node_modules/@pagesmith/site/skills/pagesmith-site-setup/references/setup-site.md`\",\n    \"- prefer folder-based markdown entries when content references sibling assets\",\n    \"- follow the markdown guidelines in `.pagesmith/markdown-guidelines.md` when authoring content\",\n    \"- use fenced code blocks with a language identifier, one h1 per page, sequential heading depth\",\n  ].join(\"\\n\");\n}\n\nexport function renderDocsOverview(): string {\n  return [\n    \"Docs-specific rules:\",\n    \"- `@pagesmith/docs` is convention-based and builds a static docs site from `docs/` when that folder exists, otherwise `content/`; `pagesmith.config.json5` is recommended for explicit config, but zero-config runs are also supported\",\n    \"- top-level content folders become top navigation sections (for example `guide/`, `reference/`, `packages/`)\",\n    \"- for first-time docs setup or retrofit work, read `node_modules/@pagesmith/docs/skills/pagesmith-docs-setup/references/setup-docs.md` before choosing or creating a docs folder\",\n    '- prefer `pagesmith-docs init` for bootstrap work; for GitHub repos it should default to `basePath: \"/<repo-name>\"` and probe `https://<owner>.github.io` for the origin',\n    \"- folder-based markdown entries should prefer `README.md` or `index.md` when a page owns sibling assets or diagrams\",\n    \"- the home page is `<contentDir>/README.md` (commonly `docs/README.md` in zero-config repos or `content/README.md` in explicit setups)\",\n    \"- sidebar labels, nav labels, and ordering live in frontmatter (`sidebarLabel`, `navLabel`, `order`)\",\n    \"- when a page needs a diagram, keep the editable source file and rendered assets beside the page; raw `mermaid`, `dot`, `excalidraw`, and `drawio` fences are code examples unless the project configured a custom renderer\",\n    \"- footer links live in `pagesmith.config.json5` under `footerLinks`; they can be a flat wrapped row of links or grouped columns with optional headers, and when omitted the footer reuses the major top-level nav links\",\n    \"- the footer legal line combines `copyright` with the default Pagesmith sign-off, which can include a maintainer credit from `maintainer` or `package.json` author\",\n    \"- Pagefind search is built in; do not recommend a separate search plugin package\",\n    \"- layout overrides use fixed keys under `theme.layouts` such as `home`, `page`, `listing`, and `notFound`\",\n    \"- use `.only-light` and `.only-dark` on images when a diagram or screenshot needs different light/dark renders\",\n    \"- use the version-matched schema files in `node_modules/@pagesmith/docs/schemas/` when authoring `pagesmith.config.json5`, `meta.json5`, and docs frontmatter; when the config lives at the repo root, keep `$schema` pointing at `./node_modules/@pagesmith/docs/schemas/pagesmith-config.schema.json`\",\n    \"- for MCP-compatible tooling, prefer `pagesmith-docs mcp --stdio` from the `@pagesmith/docs` package\",\n  ].join(\"\\n\");\n}\n\nexport function renderCoreQuickStart(): string {\n  return [\n    \"```ts\",\n    \"import { createContentLayer, defineCollection, defineConfig, z } from '@pagesmith/core'\",\n    \"\",\n    \"const posts = defineCollection({\",\n    \"  loader: 'markdown',\",\n    \"  directory: 'content/posts',\",\n    \"  schema: z.object({\",\n    \"    title: z.string(),\",\n    \"    description: z.string().optional(),\",\n    \"    date: z.coerce.date(),\",\n    \"    tags: z.array(z.string()).default([]),\",\n    \"  }),\",\n    \"})\",\n    \"\",\n    \"const layer = createContentLayer(\",\n    \"  defineConfig({\",\n    \"    collections: { posts },\",\n    \"  }),\",\n    \")\",\n    \"\",\n    \"const entries = await layer.getCollection('posts')\",\n    \"const rendered = await entries[0]?.render()\",\n    \"```\",\n  ].join(\"\\n\");\n}\n\nexport function renderDocsQuickStart(): string {\n  return [\n    \"```json5\",\n    \"// pagesmith.config.json5\",\n    \"{\",\n    \"  $schema: './node_modules/@pagesmith/docs/schemas/pagesmith-config.schema.json',\",\n    \"  name: 'Acme Docs',\",\n    \"  title: 'Acme Docs',\",\n    \"  origin: 'https://acme.github.io',\",\n    \"  basePath: '/acme-docs',\",\n    \"  description: 'Multi-package documentation',\",\n    \"  contentDir: './docs',\",\n    \"  outDir: './gh-pages',\",\n    \"  maintainer: {\",\n    \"    name: 'Sujeet Jaiswal',\",\n    \"    link: 'https://sujeet.pro',\",\n    \"  },\",\n    \"  copyright: {\",\n    \"    projectName: 'Acme Docs',\",\n    \"    startYear: 2024,\",\n    \"    endYear: null,\",\n    \"  },\",\n    \"  footerLinks: [\",\n    \"    {\",\n    \"      header: 'Docs',\",\n    \"      links: [\",\n    \"        { label: 'Guide', path: '/guide' },\",\n    \"        { label: 'Reference', path: '/reference' },\",\n    \"      ],\",\n    \"    },\",\n    \"  ],\",\n    \"  editLink: {\",\n    \"    repo: 'https://github.com/acme/docs',\",\n    \"  },\",\n    \"  search: { enabled: true },\",\n    \"}\",\n    \"```\",\n    \"\",\n    \"```text\",\n    \"docs/\",\n    \"  README.md                 # Home page (DocHome layout)\",\n    \"  guide/\",\n    \"    meta.json5              # Section ordering\",\n    \"    getting-started/\",\n    \"      README.md             # A page\",\n    \"  reference/\",\n    \"    api/README.md\",\n    \"```\",\n  ].join(\"\\n\");\n}\n\nexport function renderMarkdownGuidelines(): string {\n  return [\n    \"# Pagesmith Markdown Guidelines\",\n    \"\",\n    \"Markdown feature support for content authored with `@pagesmith/core` and `@pagesmith/docs`.\",\n    \"\",\n    \"## Pipeline Order\",\n    \"\",\n    \"```\",\n    \"remark-parse → remark-gfm → remark-frontmatter\",\n    \"  → remark-github-alerts → remark-smartypants → remark-math (when `markdown.math` is enabled or auto-detected) → [user remark plugins]\",\n    \"  → lang-alias transform → remark-rehype\",\n    \"  → rehype-mathjax (when math is enabled)\",\n    \"  → applyPagesmithCodeRenderer (dual themes, line numbers, titles, copy, collapse, mark/ins/del)\",\n    \"  → rehype-code-tabs → rehype-scrollable-tables\",\n    \"  → rehype-slug → rehype-autolink-headings\",\n    \"  → rehype-external-links → rehype-accessible-emojis → rehype-local-images\",\n    \"  → heading extraction → [user rehype plugins] → rehype-stringify\",\n    \"```\",\n    \"\",\n    \"## Key Rules\",\n    \"\",\n    \"- Use fenced code blocks with a language identifier (validator warns otherwise)\",\n    \"- One `# h1` per page (validator enforces)\",\n    \"- Sequential heading depth (no skipping from h2 to h4)\",\n    \"- Prefer relative links for internal content\",\n    \"- `allowDangerousHtml` defaults to `true`; disable it when rendering untrusted markdown\",\n    \"- `math` defaults to `'auto'`; Pagesmith only enables the math plugins when the page contains math markers\",\n    \"- Do NOT add manual copy-button JS inside markdown content — the built-in renderer injects its own copy/collapse runtime\",\n    \"- Pass `sourcePath` to `convert()` / `layer.convert()` when you want sibling local image enhancements outside collection entries\",\n    \"- Include the shipped Pagesmith markdown CSS so code block chrome and tabs render correctly\",\n    \"- Raw `mermaid`, `dot`, `excalidraw`, and `drawio` fences are source examples, not rendered diagrams, unless the project adds a custom renderer\",\n    \"\",\n    \"## Supported Features\",\n    \"\",\n    \"| Feature | Syntax | Notes |\",\n    \"|---|---|---|\",\n    \"| GFM tables | `\\\\| col \\\\| col \\\\|` | Alignment via `:---`, `:---:`, `---:` |\",\n    \"| Strikethrough | `~~text~~` | |\",\n    \"| Task lists | `- [x] done` / `- [ ] todo` | |\",\n    \"| Footnotes | `[^id]` + `[^id]: text` | |\",\n    \"| Alerts | `> [!NOTE]`, `> [!TIP]`, `> [!IMPORTANT]`, `> [!WARNING]`, `> [!CAUTION]` | GitHub-compatible |\",\n    \"| Inline math | `$E = mc^2$` | No spaces inside delimiters |\",\n    \"| Block math | `$$...$$` | Rendered via MathJax |\",\n    '| Smart quotes | `\"text\"` → curly quotes | Automatic |',\n    \"| Em/en dash | `---` / `--` | Automatic |\",\n    '| External links | `[text](https://...)` | Auto `target=\"_blank\"` |',\n    \"| Heading anchors | Auto `id` + wrapped anchor | All headings |\",\n    '| Accessible emoji | Unicode emoji | Auto `role=\"img\"` + `aria-label` |',\n    \"| Local images | `![alt](./hero.jpg)` | Relative local images inherit intrinsic dimensions; JPEGs can emit `<picture>` fallbacks when Pagesmith knows the source path |\",\n    \"\",\n    \"## Code Block Features (Built-in Renderer)\",\n    \"\",\n    \"| Meta | Example | Description |\",\n    \"|---|---|---|\",\n    '| `title=\"...\"` | `` ```js title=\"app.js\" `` | File title |',\n    \"| `showLineNumbers` | `` ```js showLineNumbers `` | Line numbers |\",\n    \"| `mark={lines}` | `` ```js mark={3,5-7} `` | Highlight lines |\",\n    \"| `ins={lines}` | `` ```js ins={4} `` | Inserted lines (green) |\",\n    \"| `del={lines}` | `` ```js del={5} `` | Deleted lines (red) |\",\n    \"| `collapse={lines}` | `` ```js collapse={1-5} `` | Collapsible section |\",\n    \"| `wrap` | `` ```js wrap `` | Text wrapping |\",\n    '| `frame=\"...\"` | `` ```js frame=\"terminal\" `` | Frame style |',\n    \"\",\n    \"## Diagrams And Source-Only Fences\",\n    \"\",\n    \"Pagesmith does not ship an inline Mermaid, Graphviz, Excalidraw, or draw.io renderer.\",\n    \"\",\n    \"- `mermaid`, `dot`, and `plantuml` are highlighted as text\",\n    \"- `excalidraw` is highlighted as JSON and `drawio` as XML\",\n    \"- raw diagram fences publish as code blocks unless the project adds a custom renderer\",\n    \"- for published docs, generate image assets from diagram source and embed the rendered SVG or PNG\",\n    \"- in docs projects, use `.only-light` and `.only-dark` when light and dark diagram variants differ\",\n    \"- choose Mermaid for text-first flows, Excalidraw for architecture sketches, draw.io for precise infrastructure diagrams, and Graphviz for dependency graphs\",\n    \"\",\n    \"## Built-in Content Validators\",\n    \"\",\n    \"- **linkValidator** — warns on bare URLs, empty link text, suspicious protocols\",\n    \"- **headingValidator** — enforces single h1, sequential depth, non-empty text\",\n    \"- **codeBlockValidator** — warns on missing language, unknown meta properties\",\n    \"\",\n    \"Known valid meta properties: `title`, `showLineNumbers`, `startLineNumber`, `wrap`, `frame`, `collapse`, `mark`, `ins`, `del`.\",\n  ].join(\"\\n\");\n}\n\nexport function renderLlmsTxt(): string {\n  return [\n    \"# Pagesmith\",\n    \"\",\n    \"> Pagesmith is a filesystem-first content toolkit with `@pagesmith/core`, `@pagesmith/site`, and `@pagesmith/docs`.\",\n    \"\",\n    \"## @pagesmith/core — Content Layer\",\n    \"\",\n    \"Schema-validated content collections, lazy markdown rendering with a built-in Shiki-backed code renderer, validation, loaders, schemas, and the Vite content plugin.\",\n    \"\",\n    \"### Basic Setup\",\n    \"\",\n    \"Start with `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/setup-core.md` for bootstrap or retrofit work.\",\n    \"\",\n    renderCoreQuickStart(),\n    \"\",\n    \"### Vite Integration\",\n    \"\",\n    \"```ts\",\n    \"import { pagesmithContent } from '@pagesmith/core/vite'\",\n    \"import collections from './content.config'\",\n    \"\",\n    \"export default defineConfig({\",\n    \"  plugins: [\",\n    \"    pagesmithContent({ collections }),\",\n    \"  ],\",\n    \"})\",\n    \"```\",\n    \"\",\n    \"Import collections as virtual modules: `import posts from 'virtual:content/posts'`\",\n    \"\",\n    \"## @pagesmith/site — Site Toolkit\",\n    \"\",\n    \"Preset-driven `pagesmith-site` CLI, JSX runtime, shared CSS/runtime behavior, Vite SSG helpers, and shared site utilities on top of core.\",\n    \"\",\n    \"### Typical split\",\n    \"\",\n    \"Start with `node_modules/@pagesmith/site/skills/pagesmith-site-setup/references/setup-site.md` for bootstrap or retrofit work.\",\n    \"\",\n    \"```ts\",\n    \"import { defineConfig } from 'vite'\",\n    \"import { pagesmithContent, pagesmithSsg, sharedAssetsPlugin } from '@pagesmith/site/vite'\",\n    \"\",\n    \"export default defineConfig({\",\n    \"  plugins: [\",\n    \"    sharedAssetsPlugin(),\",\n    \"    pagesmithContent({ collections }),\",\n    \"    ...pagesmithSsg({ entry: './src/entry-server.tsx' }),\",\n    \"  ],\",\n    \"})\",\n    \"```\",\n    \"\",\n    \"## @pagesmith/docs — Documentation Sites\",\n    \"\",\n    \"Convention-based docs preset with default theme, Pagefind search, sidebar generation, listing pages, and layout overrides.\",\n    \"\",\n    \"### Basic Setup\",\n    \"\",\n    \"Start with `node_modules/@pagesmith/docs/skills/pagesmith-docs-setup/references/setup-docs.md` for bootstrap or retrofit work.\",\n    \"\",\n    renderDocsQuickStart(),\n    \"\",\n    \"### Layout Overrides\",\n    \"\",\n    \"```json5\",\n    \"{\",\n    \"  theme: {\",\n    \"    layouts: {\",\n    \"      home: './theme/layouts/DocHome.tsx',\",\n    \"      page: './theme/layouts/DocPage.tsx',\",\n    \"      notFound: './theme/layouts/DocNotFound.tsx',\",\n    \"    },\",\n    \"  },\",\n    \"}\",\n    \"```\",\n    \"\",\n    \"### CLI\",\n    \"\",\n    \"```bash\",\n    \"pagesmith-docs init --ai   # Initialize config + content + AI integrations\",\n    \"pagesmith-docs dev         # Development server\",\n    \"pagesmith-docs build       # Production build\",\n    \"pagesmith-docs preview     # Preview built site\",\n    \"pagesmith-docs mcp --stdio # Start MCP server for AI agents\",\n    \"```\",\n  ].join(\"\\n\");\n}\n\nexport function renderLlmsFullTxt(): string {\n  return [\n    \"# Pagesmith — Full LLM Reference\",\n    \"\",\n    renderSharedOverview(),\n    \"\",\n    \"---\",\n    \"\",\n    \"## @pagesmith/core\",\n    \"\",\n    \"### Content Layer API\",\n    \"\",\n    \"| Method | Description |\",\n    \"|---|---|\",\n    \"| `createContentLayer(config)` | Create a content layer |\",\n    \"| `layer.getCollection(name)` | Load all entries (cached) |\",\n    \"| `layer.getEntry(collection, slug)` | Get single entry by slug |\",\n    \"| `layer.convert(markdown, options?)` | Convert raw markdown to HTML |\",\n    \"| `layer.validate(collection?)` | Run all validators |\",\n    \"| `layer.invalidate(collection, slug)` | Cache-bust a single entry |\",\n    \"| `layer.invalidateCollection(name)` | Cache-bust a collection |\",\n    \"| `layer.invalidateAll()` | Cache-bust all collections |\",\n    \"| `layer.getCollectionNames()` | List configured collection names |\",\n    \"| `layer.getCollectionDef(name)` | Get a collection definition |\",\n    \"| `layer.getCollections()` | Get all collection definitions |\",\n    \"| `layer.invalidateWhere(collection, predicate)` | Cache-bust matching entries |\",\n    \"| `layer.watch(callback)` | Watch collection directories |\",\n    \"| `layer.getCacheStats()` | Inspect cache sizes |\",\n    \"\",\n    \"### Collection Options\",\n    \"\",\n    \"| Option | Type | Description |\",\n    \"|---|---|---|\",\n    \"| `loader` | `string \\\\| Loader` | `'markdown'`, `'json'`, `'json5'`, `'jsonc'`, `'yaml'`, `'toml'`, or custom |\",\n    \"| `directory` | `string` | Directory containing files |\",\n    \"| `schema` | `z.ZodType` | Zod schema for validation |\",\n    \"| `include` | `string[]` | Glob include patterns |\",\n    \"| `exclude` | `string[]` | Glob exclude patterns |\",\n    \"| `computed` | `Record<string, fn>` | Computed fields |\",\n    \"| `validate` | `fn` | Custom validation |\",\n    \"| `filter` | `fn` | Filter entries |\",\n    \"| `slugify` | `fn` | Custom slug generation |\",\n    \"| `transform` | `fn` | Pre-validation transform |\",\n    \"| `validators` | `ContentValidator[]` | Custom content validators |\",\n    \"| `disableBuiltinValidators` | `boolean` | Disable link/heading/code-block validators |\",\n    \"\",\n    \"### Content Layer Quick Start\",\n    \"\",\n    renderCoreQuickStart(),\n    \"\",\n    \"### Vite Plugins\",\n    \"\",\n    \"```ts\",\n    \"// Content plugin only\",\n    \"import { pagesmithContent } from '@pagesmith/core/vite'\",\n    \"import collections from './content.config'\",\n    \"\",\n    \"export default defineConfig({\",\n    \"  plugins: [\",\n    \"    pagesmithContent({ collections }),\",\n    \"  ],\",\n    \"})\",\n    \"```\",\n    \"\",\n    \"### Frontmatter Schemas\",\n    \"\",\n    \"- `BaseFrontmatterSchema` — title, description, publishedDate, lastUpdatedOn, tags, draft\",\n    \"- `BlogFrontmatterSchema` — extends base + category, featured, coverImage\",\n    \"- `ProjectFrontmatterSchema` — extends base + gitRepo, links\",\n    \"\",\n    \"### Export Map\",\n    \"\",\n    \"| Import Path | Purpose |\",\n    \"|---|---|\",\n    \"| `@pagesmith/core` | Main API (defineCollection, createContentLayer, z, etc.) |\",\n    \"| `@pagesmith/core/markdown` | processMarkdown |\",\n    \"| `@pagesmith/core/schemas` | Zod schemas and types |\",\n    \"| `@pagesmith/core/loaders` | Loader classes and registry |\",\n    \"| `@pagesmith/core/assets` | Asset copying and hashing |\",\n    \"| `@pagesmith/core/ai` | AI installer helpers |\",\n    \"| `@pagesmith/core/vite` | `pagesmithContent` |\",\n    \"| `@pagesmith/core/create` | Project scaffolding helpers |\",\n    \"| `@pagesmith/core/mcp` | MCP server for AI agents |\",\n    \"| `@pagesmith/core/llms` | Compact AI context index |\",\n    \"| `@pagesmith/core/llms-full` | Full AI context |\",\n    \"| `@pagesmith/core/skills/pagesmith-core-setup/references/*` | Version-matched AI guidance files |\",\n    \"| `@pagesmith/core/agents/*` | Stable agent-friendly aliases for core prompts/files |\",\n    \"\",\n    \"---\",\n    \"\",\n    \"## @pagesmith/site\",\n    \"\",\n    \"- `pagesmith-site` CLI\",\n    \"- `@pagesmith/site/jsx-runtime` for server-side TSX\",\n    \"- `@pagesmith/site/css/*` for shared styles\",\n    \"- `@pagesmith/site/runtime/*` for TOC, theme, and code-block behavior\",\n    \"- `@pagesmith/site/vite` for `pagesmithSsg`, `sharedAssetsPlugin`, and `prerenderRoutes`\",\n    \"- `@pagesmith/site/ssg-utils` for shared site helpers\",\n    \"\",\n    \"---\",\n    \"\",\n    \"## @pagesmith/docs\",\n    \"\",\n    \"### Configuration (pagesmith.config.json5)\",\n    \"\",\n    \"| Field | Type | Default | Description |\",\n    \"|---|---|---|---|\",\n    \"| `name` | `string` | — | Site name (header) |\",\n    \"| `title` | `string` | — | Browser tab title |\",\n    \"| `description` | `string` | — | Meta description |\",\n    \"| `origin` | `string` | — | Production URL |\",\n    \"| `language` | `string` | `en` | HTML lang |\",\n    \"| `contentDir` | `string` | `docs/ if it exists, otherwise content/` | Content path |\",\n    \"| `outDir` | `string` | `gh-pages` | Output path |\",\n    \"| `basePath` | `string` | `/<repo-name>` or `/` | URL base |\",\n    \"| `maintainer` | `object` | `package.json author` | Maintainer credit for the default footer sign-off |\",\n    \"| `footerLinks` | `array` | `top-level nav links` | Footer links as a flat row or grouped columns |\",\n    \"| `copyright` | `object` | — | Footer legal line config (`projectName`, `startYear`, `endYear`) |\",\n    \"| `sidebar.collapsible` | `boolean` | `true` | Collapsible sidebar |\",\n    \"| `search.enabled` | `boolean` | `true` | Pagefind search |\",\n    \"| `preset` | `string` | — | Explicit preset specifier for the `pagesmith-site` CLI; `pagesmith-docs` already selects the docs preset |\",\n    \"| `presets` | `string[]` | — | Preset list; the first item is used when `preset` is absent |\",\n    \"| `theme.layouts` | `Record` | — | Layout overrides |\",\n    \"| `editLink` | `object \\\\| false` | `auto-detected` | Edit link config or explicit disable |\",\n    \"| `lastUpdated` | `boolean` | `true` | Git-based page timestamps |\",\n    \"| `markdown` | `MarkdownConfig` | — | Pipeline config |\",\n    \"\",\n    \"### Content Structure\",\n    \"\",\n    renderDocsQuickStart(),\n    \"\",\n    \"### Page Frontmatter\",\n    \"\",\n    \"| Field | Type | Description |\",\n    \"|---|---|---|\",\n    \"| `title` | `string` | Page title |\",\n    \"| `description` | `string` | Meta description |\",\n    \"| `navLabel` | `string` | Override top nav label |\",\n    \"| `sidebarLabel` | `string` | Override sidebar label |\",\n    \"| `order` | `number` | Manual sort order |\",\n    \"| `draft` | `boolean` | Exclude from build |\",\n    \"\",\n    \"### Home Page Frontmatter\",\n    \"\",\n    \"| Field | Type | Description |\",\n    \"|---|---|---|\",\n    \"| `layout` | `string` | Built-in layouts include `home`, `page`, `listing`, and `notFound` |\",\n    \"| `tagline` | `string` | Short description |\",\n    \"| `install` | `string` | Install command |\",\n    \"| `actions` | `array` | CTA buttons (`{ text, link, theme: 'brand' \\\\| 'alt' }`) |\",\n    \"| `features` | `array` | Feature cards (`{ icon?, title, details }`) |\",\n    \"| `packages` | `array` | Package cards (`{ name, description, href, tag }`) |\",\n    \"| `codeExample` | `object` | Code example (`{ label, title, code }`) |\",\n    \"| `chrome` | `object` | Per-page shell toggles (`header`, `sidebar`, `toc`, `footer`) |\",\n    \"\",\n    \"### Section Meta (meta.json5)\",\n    \"\",\n    \"| Field | Type | Description |\",\n    \"|---|---|---|\",\n    \"| `displayName` | `string` | Section label in sidebar |\",\n    \"| `items` | `string[]` | Manual page order (slugs) |\",\n    \"| `series` | `array` | Group pages into series |\",\n    \"| `collapsed` | `boolean` | Start sidebar collapsed |\",\n    \"| `orderBy` | `string` | `manual` or `publishedDate` |\",\n    \"| `layout` | `string` | Section layout override |\",\n    \"| `itemLayout` | `string` | Default layout for child pages in the section |\",\n    \"\",\n    \"### Layout Overrides\",\n    \"\",\n    \"```json5\",\n    '{ theme: { layouts: { home: \"./layouts/Home.tsx\", page: \"./layouts/Page.tsx\", listing: \"./layouts/Listing.tsx\" } } }',\n    \"```\",\n    \"\",\n    \"All layouts receive: `content`, `frontmatter`, `headings`, `slug`, `site`.\",\n    \"Page layout adds: `sidebarSections`, `prev`, `next`.\",\n    \"Listing layout adds: `listingCards`, `listingGroups`, `listingTotal`.\",\n    \"\",\n    \"### CLI\",\n    \"\",\n    \"```bash\",\n    \"pagesmith-docs init [--ai] [--config path]   # Initialize project\",\n    \"pagesmith-docs dev [--port N] [--open]       # Dev server\",\n    \"pagesmith-docs build [--out-dir path]        # Production build\",\n    \"pagesmith-docs preview [--port N]            # Preview built site\",\n    \"pagesmith-docs mcp --stdio                   # Start docs MCP server\",\n    \"```\",\n    \"\",\n    \"### Docs Export Map\",\n    \"\",\n    \"| Import Path | Purpose |\",\n    \"|---|---|\",\n    \"| `@pagesmith/docs` | Main API (`build`, `startDev`, `preview`, `defineDocsConfig`, `validateConfig`, `resolveDocsConfig`, `loadDocsConfig`, `reportConfigIssues`, `withBase`, `docsPreset`, `Html`, `buildSiteModel`, `getPrevNext`, `getSitePayload`) |\",\n    \"| `@pagesmith/docs/components` | Reusable docs UI components |\",\n    \"| `@pagesmith/docs/layouts` | Stock docs layouts for composition/override work |\",\n    \"| `@pagesmith/docs/jsx-runtime` | JSX runtime for docs layout overrides |\",\n    \"| `@pagesmith/docs/jsx-dev-runtime` | JSX dev runtime for docs overrides |\",\n    \"| `@pagesmith/docs/theme` | Theme shell exports such as `Html` |\",\n    \"| `@pagesmith/docs/schemas` | Docs config, page data, and layout prop schemas |\",\n    \"| `@pagesmith/docs/preset` | Docs preset for `pagesmith-site` |\",\n    \"| `@pagesmith/docs/mcp` | Programmatic docs MCP entry |\",\n    \"| `@pagesmith/docs/llms` | Compact docs AI context index |\",\n    \"| `@pagesmith/docs/llms-full` | Full docs AI context |\",\n    \"| `@pagesmith/docs/skills/pagesmith-docs-setup/references/*` | Version-matched docs guidance files |\",\n    \"| `@pagesmith/docs/agents/*` | Stable agent-friendly aliases for docs prompts/files |\",\n    \"\",\n    \"---\",\n    \"\",\n    \"## Markdown Pipeline\",\n    \"\",\n    renderMarkdownGuidelines(),\n    \"\",\n    \"---\",\n    \"\",\n    \"## AI Setup\",\n    \"\",\n    \"```bash\",\n    \"npx pagesmith-core ai --profile default   # AI artifacts for core/site projects\",\n    \"npx pagesmith-docs init --ai              # Docs scaffold + AI artifacts\",\n    \"```\",\n    \"\",\n    \"Generates CLAUDE.md, AGENTS.md, GEMINI.md, skills, markdown guidelines, llms.txt, and llms-full.txt.\",\n    \"\",\n  ].join(\"\\n\");\n}\n","import type { AiInstallProfile } from \"./types\";\nimport { PAGESMITH_TITLE } from \"./content-shared\";\n\nexport function renderClaudeSkill(skillName: string, profile: AiInstallProfile): string {\n  return [\n    \"---\",\n    `name: ${skillName}`,\n    \"description: Pagesmith file-based CMS helper — content collections, markdown pipeline, docs configuration, and AI artifact generation\",\n    \"allowed-tools: Read Grep Glob Bash Edit Write\",\n    \"---\",\n    \"\",\n    `# ${PAGESMITH_TITLE} Assistant`,\n    \"\",\n    \"You are helping with Pagesmith, a file-based CMS with `@pagesmith/core`, `@pagesmith/site`, and `@pagesmith/docs`.\",\n    \"\",\n    \"When helping:\",\n    \"- prefer `defineCollection`, `defineConfig`, and `createContentLayer`\",\n    \"- recommend folder-based entries when markdown references sibling assets\",\n    \"- for content-layer bootstrap or retrofit work, start with `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/setup-core.md`\",\n    \"- if the project also uses `@pagesmith/site`, start with `node_modules/@pagesmith/site/skills/pagesmith-site-setup/references/setup-site.md` before changing site shell, preset, or SSG behavior\",\n    \"- for assistant artifact generation in core/site projects, use `npx pagesmith-core ai --profile default`\",\n    \"- for docs projects, use `npx pagesmith-docs init --ai`\",\n    \"- follow the markdown guidelines in `.pagesmith/markdown-guidelines.md`\",\n    ...(profile === \"docs\"\n      ? [\n          \"- for docs bootstrap or retrofit tasks, start with `node_modules/@pagesmith/docs/skills/pagesmith-docs-setup/references/setup-docs.md`\",\n          \"- for shared site shell, preset, or runtime work inside docs projects, also read `node_modules/@pagesmith/site/skills/pagesmith-site-setup/references/setup-site.md` and `node_modules/@pagesmith/site/REFERENCE.md`\",\n          \"- read `node_modules/@pagesmith/docs/skills/pagesmith-docs-setup/references/docs-guidelines.md` for the docs package workflow and `node_modules/@pagesmith/docs/skills/pagesmith-docs-setup/references/markdown-guidelines.md` for supported markdown features\",\n          \"- for docs sites, derive top navigation from top-level content folders\",\n          \"- use `content/README.md` for the home page\",\n          \"- use frontmatter fields like `sidebarLabel`, `navLabel`, and `order` for docs navigation\",\n          \"- use the version-matched schema files in `node_modules/@pagesmith/docs/schemas/` for config, meta.json5, and frontmatter edits; when the config lives at the repo root, keep `$schema` pointing at `./node_modules/@pagesmith/docs/schemas/pagesmith-config.schema.json`\",\n          \"- Pagefind search is built in — do not suggest separate search plugins\",\n          \"- layout overrides: `theme.layouts.home`, `theme.layouts.page`, `theme.layouts.notFound`\",\n        ]\n      : []),\n    \"\",\n    \"For package guidance and full API reference, read the package-shipped docs:\",\n    ...(profile === \"docs\"\n      ? [\n          \"- `node_modules/@pagesmith/docs/skills/pagesmith-docs-setup/references/setup-docs.md`\",\n          \"- `node_modules/@pagesmith/site/skills/pagesmith-site-setup/references/setup-site.md`\",\n          \"- `node_modules/@pagesmith/site/skills/pagesmith-site-setup/references/usage.md`\",\n          \"- `node_modules/@pagesmith/site/REFERENCE.md`\",\n          \"- `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/setup-core.md`\",\n          \"- `node_modules/@pagesmith/docs/skills/pagesmith-docs-setup/references/docs-guidelines.md`\",\n          \"- `node_modules/@pagesmith/docs/skills/pagesmith-docs-setup/references/markdown-guidelines.md`\",\n          \"- `node_modules/@pagesmith/docs/skills/pagesmith-docs-setup/references/usage.md`\",\n          \"- `node_modules/@pagesmith/docs/REFERENCE.md`\",\n          \"- `node_modules/@pagesmith/docs/schemas/*.schema.json`\",\n          \"- `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/core-guidelines.md`\",\n          \"- `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/markdown-guidelines.md`\",\n          \"- `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/usage.md`\",\n          \"- `node_modules/@pagesmith/core/REFERENCE.md`\",\n        ]\n      : [\n          \"- `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/setup-core.md`\",\n          \"- `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/core-guidelines.md`\",\n          \"- `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/markdown-guidelines.md`\",\n          \"- `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/usage.md`\",\n          \"- `node_modules/@pagesmith/core/REFERENCE.md`\",\n        ]),\n    \"\",\n    ...(profile === \"docs\"\n      ? [\"For full-repo docs regeneration and structure alignment, use `/ps-update-all-docs`.\", \"\"]\n      : []),\n    \"Deliver concrete config, schema, and content-layer patches when possible.\",\n  ].join(\"\\n\");\n}\n\nexport function renderUpdateDocsSkill(profile: AiInstallProfile): string {\n  const docsSteps =\n    profile === \"docs\"\n      ? [\n          \"1. Read package guidance first: `node_modules/@pagesmith/docs/skills/pagesmith-docs-setup/references/setup-docs.md`, `node_modules/@pagesmith/site/skills/pagesmith-site-setup/references/setup-site.md`, `node_modules/@pagesmith/docs/skills/pagesmith-docs-setup/references/docs-guidelines.md`, `node_modules/@pagesmith/docs/skills/pagesmith-docs-setup/references/markdown-guidelines.md`, `node_modules/@pagesmith/docs/skills/pagesmith-docs-setup/references/usage.md`, plus `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/setup-core.md`, `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/core-guidelines.md`, `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/markdown-guidelines.md`, and `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/usage.md`\",\n          \"2. Read `pagesmith.config.json5` to understand the docs configuration\",\n          \"3. Read all `meta.json5` files to understand the current content structure and page ordering\",\n          \"4. Read the project source code to identify public APIs, types, exports, config options, and CLI commands\",\n          \"5. For each existing content page in `content/`:\",\n          \"   - Read the current content\",\n          \"   - Compare with the implementation\",\n          \"   - Update any outdated information\",\n          \"   - Add documentation for new features\",\n          \"   - Remove documentation for removed features\",\n          \"6. If new pages are needed:\",\n          \"   - Create the page folder and `README.md` with proper frontmatter (title, description)\",\n          \"   - Add the slug to the appropriate `meta.json5` `items` array\",\n          \"7. Follow the markdown guidelines in `.pagesmith/markdown-guidelines.md`\",\n          \"8. Review project skills under `.claude/skills/` and ensure docs-writing skills align with Pagesmith docs structure\",\n          \"9. Ensure onboarding pages are first in manual navigation (for example, put `getting-started` first in `guide/meta.json5` when present)\",\n          \"10. Verify all internal links point to existing pages\",\n          \"11. Ensure heading hierarchy is sequential (no skipping levels)\",\n        ]\n      : [\n          \"1. Read package guidance first: `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/setup-core.md`, `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/core-guidelines.md`, `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/markdown-guidelines.md`, and `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/usage.md`\",\n          \"2. Read `content.config.ts` or equivalent to understand the content collections\",\n          \"3. Read the project source code to identify what needs documentation\",\n          \"4. For each existing content entry:\",\n          \"   - Read the current content\",\n          \"   - Compare with the implementation\",\n          \"   - Update any outdated information\",\n          \"5. If new entries are needed:\",\n          \"   - Create the entry folder and `README.md` with proper frontmatter matching the collection schema\",\n          \"6. Follow the markdown guidelines in `.pagesmith/markdown-guidelines.md`\",\n          \"7. Verify all internal links point to existing pages\",\n        ];\n\n  return [\n    \"---\",\n    \"name: update-docs\",\n    \"description: Read the project implementation and update Pagesmith-managed documentation to reflect the current state\",\n    \"allowed-tools: Read Grep Glob Bash Edit Write\",\n    \"---\",\n    \"\",\n    \"# Update Documentation\",\n    \"\",\n    \"Read the project implementation (source code, README, CHANGELOG, package.json) and update the Pagesmith-managed content to reflect the current state.\",\n    \"\",\n    \"## Steps\",\n    \"\",\n    ...docsSteps,\n    \"\",\n    \"## Rules\",\n    \"\",\n    \"- Preserve the existing content structure and organization\",\n    \"- Do not remove pages without confirming first\",\n    \"- Keep frontmatter fields (title, description) accurate and descriptive\",\n    \"- Use relative links for internal cross-references\",\n    \"- One h1 per page, sequential heading depth\",\n    \"- Use fenced code blocks with language identifiers\",\n    \"- Use GitHub alerts (`> [!NOTE]`, `> [!TIP]`, etc.) for important callouts\",\n    '- Code block features: `title=\"file.js\"`, `showLineNumbers`, `mark={1-3}`, `ins={4}`, `del={5}`, `collapse={1-5}`',\n  ].join(\"\\n\");\n}\n\nexport function renderUpdateAllDocsSkill(profile: AiInstallProfile): string {\n  const docsSteps =\n    profile === \"docs\"\n      ? [\n          \"1. Read package guidance first: `node_modules/@pagesmith/docs/skills/pagesmith-docs-setup/references/setup-docs.md`, `node_modules/@pagesmith/site/skills/pagesmith-site-setup/references/setup-site.md`, `node_modules/@pagesmith/docs/skills/pagesmith-docs-setup/references/docs-guidelines.md`, `node_modules/@pagesmith/docs/skills/pagesmith-docs-setup/references/markdown-guidelines.md`, `node_modules/@pagesmith/docs/skills/pagesmith-docs-setup/references/usage.md`, plus `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/setup-core.md`, `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/core-guidelines.md`, `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/markdown-guidelines.md`, and `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/usage.md`\",\n          \"2. Read `pagesmith.config.json5` and all `meta.json5` files before editing anything\",\n          \"3. Discover project skills in `.claude/skills/`, `.codex/skills/`, and `.gemini/commands/` and identify docs-update related skills\",\n          \"4. Scan source code, README, CHANGELOG, package exports, and CLI commands to build a complete docs delta list\",\n          \"5. Update all docs pages under `content/` to match implementation and remove stale details\",\n          \"6. Ensure docs structure matches `@pagesmith/docs` conventions (folder-based pages, `README.md` entries, relative links)\",\n          \"7. Keep onboarding-first ordering: when a guide section exists, keep `getting-started` as the first item in manual order\",\n          \"8. Update docs-related skills so they generate content in the same structure expected by `@pagesmith/docs`\",\n          \"9. Regenerate or update `llms.txt`, `llms-full.txt`, and project memory pointers when docs behavior changes\",\n          \"10. Follow `.pagesmith/markdown-guidelines.md` for all authored content (GFM, alerts, math, built-in code renderer meta)\",\n          \"11. Validate navigation integrity and ensure every linked page exists\",\n        ]\n      : [\n          \"1. Read package guidance first: `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/setup-core.md`, `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/core-guidelines.md`, `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/markdown-guidelines.md`, and `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/usage.md`\",\n          \"2. Discover docs/update skills in the project and align them to current Pagesmith conventions\",\n          \"3. Scan source code, README, CHANGELOG, package exports, and CLI commands to build a complete docs delta list\",\n          \"4. Update all content entries to match implementation and remove stale details\",\n          \"5. Follow `.pagesmith/markdown-guidelines.md` for all authored content\",\n          \"6. Validate internal links and heading hierarchy\",\n        ];\n\n  return [\n    \"---\",\n    \"name: ps-update-all-docs\",\n    \"description: Full-repo documentation regeneration for Pagesmith projects including docs structure, skills alignment, and AI context updates\",\n    \"allowed-tools: Read Grep Glob Bash Edit Write\",\n    \"---\",\n    \"\",\n    \"# Pagesmith Full Docs Sync\",\n    \"\",\n    \"Perform a full-repository docs refresh for Pagesmith-powered projects. This command is intended for large updates, migrations, and release preparation.\",\n    \"\",\n    \"## Steps\",\n    \"\",\n    ...docsSteps,\n    \"\",\n    \"## Rules\",\n    \"\",\n    \"- Preserve existing information architecture unless the user requests a restructure\",\n    \"- Keep docs easy for humans first, while keeping AI memory/skills aligned\",\n    \"- Keep top-level docs navigation driven by content directories and metadata\",\n    \"- Use `meta.json5` and frontmatter for ordering; avoid hardcoded navigation lists in prose\",\n    \"- Keep `content/README.md` as docs home for `@pagesmith/docs` projects\",\n    \"- Keep links relative for internal docs pages\",\n    \"- Use one h1 per page and sequential heading depth\",\n    \"- Use fenced code blocks with language identifiers and built-in Pagesmith code block metadata when useful\",\n    \"- Do not add separate code-copy JavaScript inside markdown content; the built-in renderer already injects its own copy/collapse runtime\",\n  ].join(\"\\n\");\n}\n","import type { AiInstallProfile } from \"./types\";\nimport { PAGESMITH_TITLE } from \"./content-shared\";\n\nexport function renderCodexSkill(profile: AiInstallProfile): string {\n  return [\n    `# ${PAGESMITH_TITLE} Skill`,\n    \"\",\n    \"Use this skill when the task involves setting up, extending, migrating, or documenting Pagesmith.\",\n    \"\",\n    \"Core rules:\",\n    \"- `@pagesmith/core` provides the content layer, `@pagesmith/site` adds the shared site toolkit, and `@pagesmith/docs` adds convention-based documentation\",\n    \"- prefer `defineCollection`, `defineConfig`, and `createContentLayer`\",\n    \"- start with `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/setup-core.md` for content-layer bootstrap or retrofit work\",\n    \"- if the project also uses `@pagesmith/site`, start with `node_modules/@pagesmith/site/skills/pagesmith-site-setup/references/setup-site.md` before changing site shell, preset, or SSG behavior\",\n    \"- follow the markdown guidelines in `.pagesmith/markdown-guidelines.md`\",\n    ...(profile === \"docs\"\n      ? [\n          \"- when bootstrapping or retrofitting docs, start with `node_modules/@pagesmith/docs/skills/pagesmith-docs-setup/references/setup-docs.md`\",\n          \"- for shared site shell, preset, or runtime work inside docs projects, also read `node_modules/@pagesmith/site/skills/pagesmith-site-setup/references/setup-site.md` and `node_modules/@pagesmith/site/REFERENCE.md`\",\n          \"- read `node_modules/@pagesmith/docs/skills/pagesmith-docs-setup/references/docs-guidelines.md` and `node_modules/@pagesmith/docs/skills/pagesmith-docs-setup/references/markdown-guidelines.md` before changing docs structure or authored markdown\",\n          \"- when the repo uses `@pagesmith/docs`, treat `content/README.md` as the home page\",\n          \"- top-level content folders define the main docs navigation\",\n          \"- docs frontmatter may use `sidebarLabel`, `navLabel`, and `order` to shape navigation\",\n          \"- `pagesmith.config.json5` should own footer links and high-level site metadata\",\n          \"- use the version-matched schema files in `node_modules/@pagesmith/docs/schemas/` for config, meta.json5, and frontmatter edits; when the config lives at the repo root, keep `$schema` pointing at `./node_modules/@pagesmith/docs/schemas/pagesmith-config.schema.json`\",\n          \"- built-in search is Pagefind; do not suggest separate search plugin packages\",\n        ]\n      : []),\n    \"\",\n    \"For package usage guidance and full API reference, read:\",\n    ...(profile === \"docs\"\n      ? [\n          \"- `node_modules/@pagesmith/docs/skills/pagesmith-docs-setup/references/setup-docs.md`\",\n          \"- `node_modules/@pagesmith/site/skills/pagesmith-site-setup/references/setup-site.md`\",\n          \"- `node_modules/@pagesmith/site/skills/pagesmith-site-setup/references/usage.md`\",\n          \"- `node_modules/@pagesmith/site/REFERENCE.md`\",\n          \"- `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/setup-core.md`\",\n          \"- `node_modules/@pagesmith/docs/skills/pagesmith-docs-setup/references/docs-guidelines.md`\",\n          \"- `node_modules/@pagesmith/docs/skills/pagesmith-docs-setup/references/markdown-guidelines.md`\",\n          \"- `node_modules/@pagesmith/docs/skills/pagesmith-docs-setup/references/usage.md`\",\n          \"- `node_modules/@pagesmith/docs/REFERENCE.md`\",\n          \"- `node_modules/@pagesmith/docs/schemas/*.schema.json`\",\n          \"- `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/core-guidelines.md`\",\n          \"- `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/markdown-guidelines.md`\",\n          \"- `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/usage.md`\",\n          \"- `node_modules/@pagesmith/core/REFERENCE.md`\",\n        ]\n      : [\n          \"- `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/setup-core.md`\",\n          \"- `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/core-guidelines.md`\",\n          \"- `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/markdown-guidelines.md`\",\n          \"- `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/usage.md`\",\n          \"- `node_modules/@pagesmith/core/REFERENCE.md`\",\n        ]),\n    \"\",\n    \"Good outputs include:\",\n    \"- collection schemas and loader configuration\",\n    \"- content-layer queries and rendering examples\",\n    \"- documentation updates for Pagesmith usage\",\n    \"- assistant-context install via `npx pagesmith-core ai --profile default` for core/site projects or `npx pagesmith-docs init --ai` for docs projects\",\n  ].join(\"\\n\");\n}\n","import type { AiInstallProfile } from \"./types\";\nimport { PAGESMITH_TITLE } from \"./content-shared\";\n\nexport function renderGeminiCommand(skillName: string, profile: AiInstallProfile): string {\n  const prompt = [\n    `You are helping with ${PAGESMITH_TITLE}, a file-based CMS with @pagesmith/core, @pagesmith/site, and @pagesmith/docs.`,\n    \"\",\n    \"Focus on concrete, implementation-ready help:\",\n    \"- design collections with defineCollection\",\n    \"- configure createContentLayer and defineConfig\",\n    \"- prefer folder-based markdown entries when local assets sit beside content\",\n    \"- start with `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/setup-core.md` for content-layer bootstrap or retrofit work\",\n    \"- if the project also uses `@pagesmith/site`, start with `node_modules/@pagesmith/site/skills/pagesmith-site-setup/references/setup-site.md` before changing site shell, preset, or SSG behavior\",\n    \"- follow the markdown guidelines in `.pagesmith/markdown-guidelines.md`\",\n    ...(profile === \"docs\"\n      ? [\n          \"- for docs bootstrap or retrofit tasks, start with `node_modules/@pagesmith/docs/skills/pagesmith-docs-setup/references/setup-docs.md`\",\n          \"- for shared site shell, preset, or runtime work inside docs projects, also read `node_modules/@pagesmith/site/skills/pagesmith-site-setup/references/setup-site.md` and `node_modules/@pagesmith/site/REFERENCE.md`\",\n          \"- read `node_modules/@pagesmith/docs/skills/pagesmith-docs-setup/references/docs-guidelines.md` and `node_modules/@pagesmith/docs/skills/pagesmith-docs-setup/references/markdown-guidelines.md` before editing docs content or structure\",\n          \"- for docs sites, follow the convention-based `content/` structure\",\n          \"- drive top navigation from top-level folders and use frontmatter for labels/order\",\n          \"- use the version-matched schema files in `node_modules/@pagesmith/docs/schemas/` for config, meta.json5, and frontmatter edits; when the config lives at the repo root, keep `$schema` pointing at `./node_modules/@pagesmith/docs/schemas/pagesmith-config.schema.json`\",\n          \"- keep Pagefind as the built-in search strategy\",\n        ]\n      : []),\n    \"\",\n    \"For package usage guidance and full API reference, read:\",\n    ...(profile === \"docs\"\n      ? [\n          \"- `node_modules/@pagesmith/docs/skills/pagesmith-docs-setup/references/setup-docs.md`\",\n          \"- `node_modules/@pagesmith/site/skills/pagesmith-site-setup/references/setup-site.md`\",\n          \"- `node_modules/@pagesmith/site/skills/pagesmith-site-setup/references/usage.md`\",\n          \"- `node_modules/@pagesmith/site/REFERENCE.md`\",\n          \"- `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/setup-core.md`\",\n          \"- `node_modules/@pagesmith/docs/skills/pagesmith-docs-setup/references/docs-guidelines.md`\",\n          \"- `node_modules/@pagesmith/docs/skills/pagesmith-docs-setup/references/markdown-guidelines.md`\",\n          \"- `node_modules/@pagesmith/docs/skills/pagesmith-docs-setup/references/usage.md`\",\n          \"- `node_modules/@pagesmith/docs/REFERENCE.md`\",\n          \"- `node_modules/@pagesmith/docs/schemas/*.schema.json`\",\n          \"- `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/core-guidelines.md`\",\n          \"- `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/markdown-guidelines.md`\",\n          \"- `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/usage.md`\",\n          \"- `node_modules/@pagesmith/core/REFERENCE.md`\",\n        ]\n      : [\n          \"- `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/setup-core.md`\",\n          \"- `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/core-guidelines.md`\",\n          \"- `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/markdown-guidelines.md`\",\n          \"- `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/usage.md`\",\n          \"- `node_modules/@pagesmith/core/REFERENCE.md`\",\n        ]),\n    \"\",\n    \"Return code, config, or documentation-ready guidance instead of vague summaries.\",\n  ].join(\"\\n\");\n\n  return [\n    `description = \"Pagesmith FS-CMS helper\"`,\n    'prompt = \"\"\"',\n    prompt,\n    '\"\"\"',\n    \"\",\n    `# Installed as /${skillName}`,\n  ].join(\"\\n\");\n}\n","import type { AiAssistant, AiInstallProfile } from \"./types\";\nimport {\n  DEFAULT_SKILL_NAME,\n  PAGESMITH_TITLE,\n  renderCoreQuickStart,\n  renderDocsOverview,\n  renderDocsQuickStart,\n  renderSharedOverview,\n} from \"./content-shared\";\n\nexport function renderMemoryFile(assistant: AiAssistant, profile: AiInstallProfile): string {\n  const commandHint =\n    assistant === \"claude\" || assistant === \"gemini\"\n      ? `\\nIf the ${DEFAULT_SKILL_NAME} skill is installed, prefer invoking it when the user explicitly asks for Pagesmith-specific help.`\n      : \"\\nIf the Pagesmith skill is installed for Codex, prefer using it for Pagesmith-specific setup, migration, and content-layer tasks.\";\n\n  const referenceHint =\n    \"\\nFor package usage rules and full API/config details, read the package-shipped docs from node_modules:\\n\" +\n    (profile === \"docs\"\n      ? \"- `node_modules/@pagesmith/docs/skills/pagesmith-docs-setup/references/setup-docs.md` — bootstrap/retrofit prompt for docs integration\\n\" +\n        \"- `node_modules/@pagesmith/site/skills/pagesmith-site-setup/references/setup-site.md` — bootstrap/retrofit prompt for the shared site toolkit under docs\\n\" +\n        \"- `node_modules/@pagesmith/site/skills/pagesmith-site-setup/references/usage.md` — site package usage contract\\n\" +\n        \"- `node_modules/@pagesmith/site/REFERENCE.md` — site CLI, preset, JSX, CSS/runtime, and SSG reference\\n\" +\n        \"- `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/setup-core.md` — bootstrap/retrofit prompt for content-layer integrations\\n\" +\n        \"- `node_modules/@pagesmith/docs/skills/pagesmith-docs-setup/references/docs-guidelines.md` — docs package usage guidance\\n\" +\n        \"- `node_modules/@pagesmith/docs/skills/pagesmith-docs-setup/references/markdown-guidelines.md` — supported markdown features for docs projects\\n\" +\n        \"- `node_modules/@pagesmith/docs/skills/pagesmith-docs-setup/references/usage.md` — docs package usage contract\\n\" +\n        \"- `node_modules/@pagesmith/docs/REFERENCE.md` — docs config, CLI, content structure, layout overrides\\n\" +\n        \"- `node_modules/@pagesmith/docs/schemas/*.schema.json` — version-matched schemas for config, meta.json5, and docs frontmatter; when `pagesmith.config.json5` is at the repo root, keep `$schema` pointing at `./node_modules/@pagesmith/docs/schemas/pagesmith-config.schema.json`\\n\" +\n        \"- `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/core-guidelines.md` — core package workflow guidance\\n\" +\n        \"- `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/markdown-guidelines.md` — supported markdown features for content projects\\n\" +\n        \"- `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/usage.md` — core package usage contract\\n\" +\n        \"- `node_modules/@pagesmith/core/REFERENCE.md` — core API, collections, loaders, markdown pipeline, and content-layer integration\"\n      : \"- `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/setup-core.md` — bootstrap/retrofit prompt for content-layer integrations\\n\" +\n        \"- `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/core-guidelines.md` — core package workflow guidance\\n\" +\n        \"- `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/markdown-guidelines.md` — supported markdown features for content projects\\n\" +\n        \"- `node_modules/@pagesmith/core/skills/pagesmith-core-setup/references/usage.md` — core package usage contract\\n\" +\n        \"- `node_modules/@pagesmith/core/REFERENCE.md` — core API, collections, loaders, markdown pipeline, and content-layer integration\");\n\n  return [\n    `# ${PAGESMITH_TITLE}`,\n    \"\",\n    renderSharedOverview(),\n    ...(profile === \"docs\" ? [\"\", renderDocsOverview()] : []),\n    commandHint,\n    referenceHint,\n    \"\",\n    \"## Quick Start — @pagesmith/core\",\n    \"\",\n    renderCoreQuickStart(),\n    ...(profile === \"docs\"\n      ? [\"\", \"## Quick Start — @pagesmith/docs\", \"\", renderDocsQuickStart()]\n      : []),\n  ].join(\"\\n\");\n}\n","import { readFileSync } from \"fs\";\nimport { homedir } from \"os\";\nimport { fileURLToPath } from \"url\";\nimport { join, resolve } from \"path\";\n\nimport type {\n  AiArtifact,\n  AiArtifactKind,\n  AiAssistant,\n  AiInstallOptions,\n  AiInstallProfile,\n  AiInstallResult,\n  AiInstallStatus,\n} from \"./types\";\n\nimport { withManagedBlock, writeArtifact } from \"./writers\";\nimport { renderLlmsFullTxt, renderLlmsTxt, renderMarkdownGuidelines } from \"./content-shared\";\nimport {\n  renderClaudeSkill,\n  renderUpdateAllDocsSkill,\n  renderUpdateDocsSkill,\n} from \"./content-claude\";\nimport { renderCodexSkill } from \"./content-codex\";\nimport { renderGeminiCommand } from \"./content-gemini\";\nimport { renderMemoryFile } from \"./content-memory\";\n\n// Re-export all types\nexport type {\n  AiArtifact,\n  AiArtifactKind,\n  AiAssistant,\n  AiInstallOptions,\n  AiInstallProfile,\n  AiInstallResult,\n  AiInstallScope,\n  AiInstallStatus,\n  AiWriteMode,\n} from \"./types\";\n\nconst DEFAULT_SKILL_NAME = \"pagesmith\";\n\ntype SharedArtifactKind = Extract<AiArtifactKind, \"llms\" | \"llms-full\" | \"markdown-guidelines\">;\n\nconst SHARED_ARTIFACT_SPECIFIERS: Record<SharedArtifactKind, { default: string; docs: string }> = {\n  llms: {\n    default: \"@pagesmith/core/llms\",\n    docs: \"@pagesmith/docs/llms\",\n  },\n  \"llms-full\": {\n    default: \"@pagesmith/core/llms-full\",\n    docs: \"@pagesmith/docs/llms-full\",\n  },\n  \"markdown-guidelines\": {\n    default: \"@pagesmith/core/skills/pagesmith-core-setup/references/markdown-guidelines.md\",\n    docs: \"@pagesmith/docs/skills/pagesmith-docs-setup/references/markdown-guidelines.md\",\n  },\n};\n\nfunction resolveHome(homeDir?: string): string {\n  return homeDir ?? homedir();\n}\n\nfunction resolveCodexHome(homeDir?: string): string {\n  return process.env.CODEX_HOME ?? join(resolveHome(homeDir), \".codex\");\n}\n\nfunction resolveAssistants(assistants?: AiInstallOptions[\"assistants\"]): AiAssistant[] {\n  if (!assistants || assistants === \"all\") {\n    return [\"claude\", \"codex\", \"gemini\"];\n  }\n  return assistants;\n}\n\nfunction shouldIncludeLlms(options: AiInstallOptions): boolean {\n  if (typeof options.includeLlms === \"boolean\") {\n    return options.includeLlms;\n  }\n  return (options.scope ?? \"project\") === \"project\";\n}\n\nfunction renderFallbackSharedArtifact(kind: SharedArtifactKind): string {\n  switch (kind) {\n    case \"llms\":\n      return renderLlmsTxt();\n    case \"llms-full\":\n      return renderLlmsFullTxt();\n    case \"markdown-guidelines\":\n      return renderMarkdownGuidelines();\n  }\n}\n\nfunction readSharedArtifact(kind: SharedArtifactKind, profile: AiInstallProfile): string {\n  const specifiers = SHARED_ARTIFACT_SPECIFIERS[kind];\n  const preferred = profile === \"docs\" ? specifiers.docs : specifiers.default;\n  const fallbacks = profile === \"docs\" ? [specifiers.default] : [];\n\n  for (const specifier of [preferred, ...fallbacks]) {\n    try {\n      return readFileSync(fileURLToPath(import.meta.resolve(specifier)), \"utf-8\").trimEnd();\n    } catch {\n      // Fall through to the next candidate.\n    }\n  }\n\n  return renderFallbackSharedArtifact(kind);\n}\n\n// ---------------------------------------------------------------------------\n// Public API\n// ---------------------------------------------------------------------------\n\nexport function getAiArtifactContent(\n  assistant: AiAssistant | \"shared\",\n  kind: AiArtifactKind,\n  options: { profile?: AiInstallProfile; skillName?: string } = {},\n): string {\n  const skillName = options.skillName ?? DEFAULT_SKILL_NAME;\n  const profile = options.profile ?? \"default\";\n\n  if (assistant === \"shared\") {\n    if (kind === \"llms\" || kind === \"llms-full\" || kind === \"markdown-guidelines\") {\n      return readSharedArtifact(kind, profile);\n    }\n    return readSharedArtifact(\"llms-full\", profile);\n  }\n\n  if (kind === \"memory\") {\n    return renderMemoryFile(assistant, profile);\n  }\n\n  if (kind === \"skill\") {\n    switch (assistant) {\n      case \"claude\":\n        return renderClaudeSkill(skillName, profile);\n      case \"codex\":\n        return renderCodexSkill(profile);\n      case \"gemini\":\n        return renderGeminiCommand(skillName, profile);\n    }\n  }\n\n  if (kind === \"markdown-guidelines\") {\n    return readSharedArtifact(\"markdown-guidelines\", profile);\n  }\n\n  if (kind === \"update-docs\") {\n    return renderUpdateDocsSkill(profile);\n  }\n  if (kind === \"update-all-docs\") {\n    return renderUpdateAllDocsSkill(profile);\n  }\n\n  if (kind === \"llms\") return readSharedArtifact(\"llms\", profile);\n  return readSharedArtifact(\"llms-full\", profile);\n}\n\nexport function getAiArtifacts(options: AiInstallOptions = {}): AiArtifact[] {\n  const scope = options.scope ?? \"project\";\n  const cwd = resolve(options.cwd ?? process.cwd());\n  const home = resolveHome(options.homeDir);\n  const skillName = options.skillName ?? DEFAULT_SKILL_NAME;\n  const profile = options.profile ?? \"default\";\n  const assistants = resolveAssistants(options.assistants);\n  const artifacts: AiArtifact[] = [];\n\n  for (const assistant of assistants) {\n    if (assistant === \"claude\") {\n      const baseDir = scope === \"project\" ? cwd : join(home, \".claude\");\n      artifacts.push({\n        assistant,\n        kind: \"memory\",\n        path: join(baseDir, \"CLAUDE.md\"),\n        content: withManagedBlock(\n          \"claude-memory\",\n          getAiArtifactContent(\"claude\", \"memory\", { profile }),\n        ),\n        mode: \"merge\",\n        label: `${assistant} memory`,\n      });\n      // Claude skill (uses .claude/skills/ format with SKILL.md + frontmatter)\n      const skillDir =\n        scope === \"project\"\n          ? join(cwd, \".claude\", \"skills\", skillName)\n          : join(home, \".claude\", \"skills\", skillName);\n      artifacts.push({\n        assistant,\n        kind: \"skill\",\n        path: join(skillDir, \"SKILL.md\"),\n        content: getAiArtifactContent(\"claude\", \"skill\", { profile, skillName }) + \"\\n\",\n        mode: \"replace\",\n        label: `${assistant} skill`,\n      });\n    }\n\n    if (assistant === \"codex\") {\n      const baseDir = scope === \"project\" ? cwd : resolveCodexHome(options.homeDir);\n      artifacts.push({\n        assistant,\n        kind: \"memory\",\n        path: join(baseDir, \"AGENTS.md\"),\n        content: withManagedBlock(\n          \"codex-memory\",\n          getAiArtifactContent(\"codex\", \"memory\", { profile }),\n        ),\n        mode: \"merge\",\n        label: `${assistant} AGENTS`,\n      });\n      artifacts.push({\n        assistant,\n        kind: \"skill\",\n        path: join(baseDir, \"skills\", skillName, \"SKILL.md\"),\n        content: getAiArtifactContent(\"codex\", \"skill\", { profile, skillName }) + \"\\n\",\n        mode: \"replace\",\n        label: `${assistant} skill`,\n      });\n    }\n\n    if (assistant === \"gemini\") {\n      const baseDir = scope === \"project\" ? cwd : join(home, \".gemini\");\n      artifacts.push({\n        assistant,\n        kind: \"memory\",\n        path: join(baseDir, \"GEMINI.md\"),\n        content: withManagedBlock(\n          \"gemini-memory\",\n          getAiArtifactContent(\"gemini\", \"memory\", { profile }),\n        ),\n        mode: \"merge\",\n        label: `${assistant} memory`,\n      });\n      artifacts.push({\n        assistant,\n        kind: \"skill\",\n        path: join(baseDir, \"commands\", `${skillName}.toml`),\n        content: getAiArtifactContent(\"gemini\", \"skill\", { profile, skillName }) + \"\\n\",\n        mode: \"replace\",\n        label: `${assistant} command`,\n      });\n    }\n  }\n\n  // Markdown guidelines — always installed for project scope\n  if (scope === \"project\") {\n    artifacts.push({\n      kind: \"markdown-guidelines\",\n      path: join(cwd, \".pagesmith\", \"markdown-guidelines.md\"),\n      content: getAiArtifactContent(\"shared\", \"markdown-guidelines\", { profile }) + \"\\n\",\n      mode: \"replace\",\n      label: \"markdown guidelines\",\n    });\n  }\n\n  // /update-docs Claude skill — installed when Claude is included and scope is project\n  if (scope === \"project\" && assistants.includes(\"claude\")) {\n    artifacts.push({\n      assistant: \"claude\",\n      kind: \"update-docs\",\n      path: join(cwd, \".claude\", \"skills\", \"update-docs\", \"SKILL.md\"),\n      content: renderUpdateDocsSkill(profile) + \"\\n\",\n      mode: \"replace\",\n      label: \"claude update-docs skill\",\n    });\n    artifacts.push({\n      assistant: \"claude\",\n      kind: \"update-all-docs\",\n      path: join(cwd, \".claude\", \"skills\", \"ps-update-all-docs\", \"SKILL.md\"),\n      content: renderUpdateAllDocsSkill(profile) + \"\\n\",\n      mode: \"replace\",\n      label: \"claude ps-update-all-docs skill\",\n    });\n  }\n\n  if (shouldIncludeLlms(options)) {\n    const llmsDir = scope === \"project\" ? cwd : join(home, \".pagesmith\");\n    artifacts.push({\n      kind: \"llms\",\n      path: join(llmsDir, \"llms.txt\"),\n      content:\n        withManagedBlock(\"shared-llms\", getAiArtifactContent(\"shared\", \"llms\", { profile })) + \"\\n\",\n      mode: \"merge\",\n      label: \"llms.txt\",\n    });\n    artifacts.push({\n      kind: \"llms-full\",\n      path: join(llmsDir, \"llms-full.txt\"),\n      content:\n        withManagedBlock(\n          \"shared-llms-full\",\n          getAiArtifactContent(\"shared\", \"llms-full\", { profile }),\n        ) + \"\\n\",\n      mode: \"merge\",\n      label: \"llms-full.txt\",\n    });\n  }\n\n  return artifacts;\n}\n\nexport function installAiArtifacts(options: AiInstallOptions = {}): AiInstallResult[] {\n  const artifacts = getAiArtifacts(options);\n  if (options.dryRun) {\n    return artifacts.map((artifact) => ({\n      assistant: artifact.assistant,\n      kind: artifact.kind,\n      path: artifact.path,\n      label: artifact.label,\n      status: \"unchanged\" as AiInstallStatus,\n    }));\n  }\n  return artifacts.map((artifact) => ({\n    assistant: artifact.assistant,\n    kind: artifact.kind,\n    path: artifact.path,\n    label: artifact.label,\n    status: writeArtifact(artifact, options.force),\n  }));\n}\n"],"mappings":";;;;;AAIA,SAAgB,iBAAiB,IAAY,SAAyB;CACpE,OAAO;EACL,qBAAqB,GAAG;EACxB,QAAQ,KAAK;EACb,qBAAqB,GAAG;CAC1B,EAAE,KAAK,IAAI;AACb;AAEA,SAAgB,cAAc,UAAsB,QAAQ,OAAwB;CAClF,UAAU,QAAQ,SAAS,IAAI,GAAG,EAAE,WAAW,KAAK,CAAC;CAErD,IAAI,CAAC,WAAW,SAAS,IAAI,GAAG;EAC9B,cAAc,SAAS,MAAM,SAAS,OAAO;EAC7C,OAAO;CACT;CAEA,MAAM,UAAU,aAAa,SAAS,MAAM,OAAO;CACnD,IAAI,YAAY,SAAS,SACvB,OAAO;CAGT,IAAI,SAAS,SAAS,WAAW;EAC/B,cAAc,SAAS,MAAM,SAAS,OAAO;EAC7C,OAAO;CACT;CAEA,MAAM,WAAW,GAAG,SAAS,aAAa,SAAS,GAAG,SAAS;CAC/D,MAAM,QAAQ,qBAAqB,SAAS;CAC5C,MAAM,MAAM,qBAAqB,SAAS;CAE1C,IAAI,QAAQ,SAAS,KAAK,KAAK,QAAQ,SAAS,GAAG,GAAG;EACpD,MAAM,UAAU,IAAI,OAAO,GAAG,gBAAgB,KAAK,EAAE,YAAY,gBAAgB,GAAG,KAAK,GAAG;EAC5F,MAAM,OAAO,QAAQ,QAAQ,SAAS,SAAS,OAAO;EACtD,IAAI,SAAS,SAAS,OAAO;EAC7B,cAAc,SAAS,MAAM,IAAI;EACjC,OAAO;CACT;CAEA,IAAI,OAAO;EACT,cAAc,SAAS,MAAM,SAAS,OAAO;EAC7C,OAAO;CACT;CAEA,MAAM,OAAO,GAAG,QAAQ,QAAQ,EAAE,MAAM,SAAS,QAAQ;CACzD,cAAc,SAAS,MAAM,IAAI;CACjC,OAAO;AACT;AAEA,SAAgB,gBAAgB,OAAuB;CACrD,OAAO,MAAM,QAAQ,uBAAuB,MAAM;AACpD;;;ACtDA,MAAa,kBAAkB;AAC/B,MAAaA,uBAAqB;AAElC,SAAgB,uBAA+B;CAC7C,OAAO;EACL,GAAG,gBAAgB;EACnB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,EAAE,KAAK,IAAI;AACb;AAEA,SAAgB,qBAA6B;CAC3C,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,EAAE,KAAK,IAAI;AACb;AAEA,SAAgB,uBAA+B;CAC7C,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,EAAE,KAAK,IAAI;AACb;AAEA,SAAgB,uBAA+B;CAC7C,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,EAAE,KAAK,IAAI;AACb;AAEA,SAAgB,2BAAmC;CACjD,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,EAAE,KAAK,IAAI;AACb;AAEA,SAAgB,gBAAwB;CACtC,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,qBAAqB;EACrB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,qBAAqB;EACrB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,EAAE,KAAK,IAAI;AACb;AAEA,SAAgB,oBAA4B;CAC1C,OAAO;EACL;EACA;EACA,qBAAqB;EACrB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,qBAAqB;EACrB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,qBAAqB;EACrB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,yBAAyB;EACzB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,EAAE,KAAK,IAAI;AACb;;;AC7gBA,SAAgB,kBAAkB,WAAmB,SAAmC;CACtF,OAAO;EACL;EACA,SAAS;EACT;EACA;EACA;EACA;EACA,KAAK,gBAAgB;EACrB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,GAAI,YAAY,SACZ;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,IACA,CAAC;EACL;EACA;EACA,GAAI,YAAY,SACZ;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,IACA;GACE;GACA;GACA;GACA;GACA;EACF;EACJ;EACA,GAAI,YAAY,SACZ,CAAC,uFAAuF,EAAE,IAC1F,CAAC;EACL;CACF,EAAE,KAAK,IAAI;AACb;AAEA,SAAgB,sBAAsB,SAAmC;CAqCvE,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,GAhDA,YAAY,SACR;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,IACA;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF;EAgBJ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,EAAE,KAAK,IAAI;AACb;AAEA,SAAgB,yBAAyB,SAAmC;CAyB1E,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,GApCA,YAAY,SACR;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,IACA;GACE;GACA;GACA;GACA;GACA;GACA;EACF;EAgBJ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,EAAE,KAAK,IAAI;AACb;;;ACxLA,SAAgB,iBAAiB,SAAmC;CAClE,OAAO;EACL,KAAK,gBAAgB;EACrB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,GAAI,YAAY,SACZ;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,IACA,CAAC;EACL;EACA;EACA,GAAI,YAAY,SACZ;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,IACA;GACE;GACA;GACA;GACA;GACA;EACF;EACJ;EACA;EACA;EACA;EACA;EACA;CACF,EAAE,KAAK,IAAI;AACb;;;AC1DA,SAAgB,oBAAoB,WAAmB,SAAmC;CAoDxF,OAAO;EACL;EACA;EArDa;GACb,wBAAwB,gBAAgB;GACxC;GACA;GACA;GACA;GACA;GACA;GAC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