<?php

declare(strict_types=1);
/* Variables: $baseUrl, $assetsUrl, $project, $user, $navItems, $pageTitle, $configJson */
?>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
    <title><?= htmlspecialchars($project['name'] ?? 'Project') ?> - Output</title>

    <?php include constant('BASE_PATH') . '/core/views/project-head.php'; ?>

    <?= \PpPhp\Core\ModuleAssets::style('Output', 'Views/styles.css') ?>
    <?= \PpPhp\Core\ModuleAssets::style('Output', 'Views/output-app-theme.css', '', 'outputAppThemeCss') ?>
</head>

<body class="output-body">
    <?php include __DIR__ . '/partials/shell.php'; ?>

    <div id="mainArea" class="main-area">
        <div class="right-workspace w-100">
            <div class="ob-layout">
            <aside class="ob-sidebar" aria-label="Output settings navigation">
                <!-- ── Module identity ─────────────────────────────── -->
                <div class="ob-toolbar">
                <div class="ob-toolbar-brand">
                    <span class="ob-toolbar-icon"><i class="bi bi-box-arrow-up-right"></i></span>
                    <div class="ob-toolbar-titles">
                        <h6>Output &amp; Build Settings</h6>
                        <span class="ob-toolbar-sub">How your project is generated, optimized &amp; packaged</span>
                    </div>
                </div>
                </div>

                <!-- ── Tabs (keeps Bootstrap IDs and targets intact) ─ -->
                <ul class="nav ob-tabs" id="outputTabs" role="tablist">
                    <li class="nav-item" role="presentation">
                        <button class="nav-link active" id="general-tab" data-bs-toggle="tab" data-bs-target="#generalPane" type="button" role="tab">
                            <span class="ob-tab-icon"><i class="bi bi-sliders2"></i></span>
                            <span class="ob-tab-copy"><strong>General</strong><small>Target and build behavior</small></span>
                            <i class="bi bi-chevron-right ob-tab-arrow" aria-hidden="true"></i>
                        </button>
                    </li>
                    <li class="nav-item" role="presentation">
                        <button class="nav-link" id="optimization-tab" data-bs-toggle="tab" data-bs-target="#optimizationPane" type="button" role="tab">
                            <span class="ob-tab-icon"><i class="bi bi-speedometer2"></i></span>
                            <span class="ob-tab-copy"><strong>Optimization</strong><small>Assets and documents</small></span>
                            <i class="bi bi-chevron-right ob-tab-arrow" aria-hidden="true"></i>
                        </button>
                    </li>
                    <li class="nav-item" role="presentation">
                        <button class="nav-link" id="advanced-tab" data-bs-toggle="tab" data-bs-target="#advancedPane" type="button" role="tab">
                            <span class="ob-tab-icon"><i class="bi bi-sliders"></i></span>
                            <span class="ob-tab-copy"><strong>Advanced</strong><small>Hooks and generated files</small></span>
                            <i class="bi bi-chevron-right ob-tab-arrow" aria-hidden="true"></i>
                        </button>
                    </li>
                </ul>

                <div class="ob-sidebar-foot">
                    <span class="ob-sidebar-caption">Project output</span>
                    <div class="ob-toolbar-actions">
                    <span class="ob-save-pill" id="lastSavedIndicator" title="Changes save automatically">
                        <i class="bi bi-cloud-check"></i> <span class="ob-save-text">All changes saved</span>
                    </span>
                    <button type="button" class="ob-guide-btn pp-guide-trigger" data-ob-help-open title="Open the Output &amp; Build guide" aria-label="Open Output and Build guide">
                        <i class="bi bi-question-circle-fill" aria-hidden="true"></i><span>Guide</span>
                    </button>
                    </div>
                </div>
            </aside>

            <main class="ob-content-scroll" aria-label="Output settings">
              <div class="ob-content">
                <div class="tab-content ob-tabcontent" id="outputTabContent">

                    <!-- ══════════════ GENERAL ══════════════ -->
                    <div class="tab-pane fade show active" id="generalPane" role="tabpanel">

                        <section class="ob-card">
                            <header class="ob-card-head">
                                <span class="ob-card-ic ic-blue"><i class="bi bi-folder2-open"></i></span>
                                <div>
                                    <h6>Output Target</h6>
                                    <p>Where the generated application is written and how it is addressed.</p>
                                </div>
                            </header>
                            <div class="ob-card-body">
                                <div class="row g-3">
                                    <div class="col-lg-12">
                                        <label class="ob-label" for="outputDir">Output Directory</label>
                                        <div class="input-group">
                                            <span class="input-group-text"><i class="bi bi-hdd"></i></span>
                                            <input type="text" class="form-control" id="outputDir" placeholder="e.g. /var/www/html/myapp  or  ../output"
                                                data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Absolute path (e.g. /var/www/html/myapp) or a path relative to the app root (e.g. ../output). Created automatically on the first build if it doesn't exist.">
                                            <button class="btn btn-outline-secondary" type="button" id="btnBrowseDir"
                                                data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Insert a common output path">
                                                <i class="bi bi-folder2-open"></i>
                                            </button>
                                        </div>
                                        <div class="ob-hint d-flex align-items-center flex-wrap gap-2">
                                            <span>Absolute path (or relative to the app root) where generated files are written.</span>
                                            <span class="ob-status-badge" id="outputDirStatus" hidden></span>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <label class="ob-label" for="baseUrlSetting">Base URL</label>
                                        <div class="input-group">
                                            <span class="input-group-text"><i class="bi bi-diagram-3"></i></span>
                                            <input type="text" class="form-control" id="baseUrlSetting" placeholder="/myapp  or  https://example.com/app"
                                                data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Public base of the app, with no trailing slash. Use / for a domain root, /myapp for a subfolder, or a full https:// URL. Drives generated routes and asset links.">
                                        </div>
                                        <div class="ob-hint">Website base URL (no trailing slash). Used to build generated routes &amp; asset links.</div>
                                    </div>
                                    <div class="col-md-6">
                                        <label class="ob-label" for="previewUrl">Preview URL</label>
                                        <div class="input-group">
                                            <span class="input-group-text"><i class="bi bi-eye"></i></span>
                                            <input type="url" class="form-control" id="previewUrl" placeholder="http://localhost/myapp"
                                                data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="URL opened by the Preview button on the Finished screen. Leave blank to open the output folder on disk instead.">
                                        </div>
                                        <div class="ob-hint">Opened by the <b>Preview</b> action on the Finished screen.</div>
                                    </div>
                                </div>
                            </div>
                        </section>

                        <section class="ob-card">
                            <header class="ob-card-head">
                                <span class="ob-card-ic ic-violet"><i class="bi bi-hammer"></i></span>
                                <div>
                                    <h6>Build Behavior</h6>
                                    <p>Control how each build runs. Pick an environment preset to set sensible defaults in one click.</p>
                                </div>
                            </header>
                            <div class="ob-card-body">
                                <div class="ob-presets" role="group" aria-label="Environment preset">
                                    <span class="ob-presets-label">Preset:</span>
                                    <button type="button" class="ob-preset" data-env="development"
                                        data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="One click: readable (un-minified) output, all errors shown, debug on. Ideal while building and testing.">
                                        <i class="bi bi-code-slash"></i> Development
                                    </button>
                                    <button type="button" class="ob-preset" data-env="production"
                                        data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="One click: minified assets, cache-busting on, errors logged (not shown), debug off. Ideal for a public release.">
                                        <i class="bi bi-rocket-takeoff"></i> Production
                                    </button>
                                    <span class="ob-preset-note">Applies optimization &amp; error-reporting defaults — you can still fine-tune each below.</span>
                                </div>

                                <div class="row g-3 mt-1">
                                    <div class="col-md-5">
                                        <label class="ob-label" for="buildType">Build Type</label>
                                        <select class="form-select" id="buildType"
                                            data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Full regenerates every file (safe default). Incremental only rewrites files that changed since the last build — faster, but assumes prior output exists.">
                                            <option value="full">Full Build — regenerate everything</option>
                                            <option value="incremental">Incremental — only changed files</option>
                                        </select>
                                        <div class="ob-hint">Full rebuilds the whole app. Incremental is faster but assumes prior output exists.</div>
                                    </div>
                                    <div class="col-md-7 d-flex align-items-start">
                                        <label class="ob-switch-row" for="cleanBeforeBuild"
                                            data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Empties the output directory before writing, so files you removed don't linger. Turn off for incremental builds.">
                                            <span class="form-check form-switch mb-0">
                                                <input class="form-check-input" type="checkbox" id="cleanBeforeBuild">
                                            </span>
                                            <span class="ob-switch-text">
                                                <b>Clean output directory before build</b>
                                                <small>Delete existing generated files first for a pristine build. Skip for incremental.</small>
                                            </span>
                                        </label>
                                    </div>
                                </div>
                            </div>
                        </section>

                        <section class="ob-card">
                            <header class="ob-card-head">
                                <span class="ob-card-ic ic-green"><i class="bi bi-clipboard-data"></i></span>
                                <div>
                                    <h6>Build Information</h6>
                                    <p>Live status of the last build and the current output directory.</p>
                                </div>
                                <button class="ob-head-btn" id="btnRefreshInfo" type="button"
                                    data-bs-toggle="tooltip" data-bs-placement="left" data-bs-title="Re-scan the output directory and reload the latest build stats">
                                    <i class="bi bi-arrow-clockwise"></i>
                                </button>
                            </header>
                            <div class="ob-card-body">
                                <div class="ob-stats">
                                    <div class="ob-stat">
                                        <span class="ob-stat-ic"><i class="bi bi-clock-history"></i></span>
                                        <div class="ob-stat-meta">
                                            <span class="ob-stat-label">Last Build</span>
                                            <span class="ob-stat-value" id="lastBuildTime">Never</span>
                                        </div>
                                    </div>
                                    <div class="ob-stat">
                                        <span class="ob-stat-ic"><i class="bi bi-files"></i></span>
                                        <div class="ob-stat-meta">
                                            <span class="ob-stat-label">Files Generated</span>
                                            <span class="ob-stat-value" id="filesGenerated">&mdash;</span>
                                        </div>
                                    </div>
                                    <div class="ob-stat">
                                        <span class="ob-stat-ic"><i class="bi bi-stopwatch"></i></span>
                                        <div class="ob-stat-meta">
                                            <span class="ob-stat-label">Build Duration</span>
                                            <span class="ob-stat-value" id="buildDuration">&mdash;</span>
                                        </div>
                                    </div>
                                    <div class="ob-stat">
                                        <span class="ob-stat-ic"><i class="bi bi-hdd-stack"></i></span>
                                        <div class="ob-stat-meta">
                                            <span class="ob-stat-label">Output Size</span>
                                            <span class="ob-stat-value" id="buildSize">&mdash;</span>
                                        </div>
                                    </div>
                                </div>
                                <div class="ob-info-foot">
                                    <span class="ob-status-badge" id="buildStatusBadge" hidden></span>
                                    <a class="ob-link-muted" href="<?= $baseUrl ?>/project/<?= urlencode($project['slug']) ?>/finished">
                                        <i class="bi bi-box-arrow-up-right"></i> Go to Build &amp; Finish
                                    </a>
                                </div>
                            </div>
                        </section>
                    </div>

                    <!-- ══════════════ OPTIMIZATION ══════════════ -->
                    <div class="tab-pane fade" id="optimizationPane" role="tabpanel">

                        <section class="ob-card">
                            <header class="ob-card-head">
                                <span class="ob-card-ic ic-amber"><i class="bi bi-lightning-charge"></i></span>
                                <div>
                                    <h6>Asset Optimization</h6>
                                    <p>Shrink and cache-bust generated assets for faster, production-ready pages.</p>
                                </div>
                            </header>
                            <div class="ob-card-body">
                                <div class="ob-toggle-list">
                                    <label class="ob-switch-row" for="compressJs"
                                        data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Minify generated JavaScript (strips whitespace &amp; comments). Smaller files and faster loads; keep off while debugging.">
                                        <span class="form-check form-switch mb-0"><input class="form-check-input" type="checkbox" id="compressJs"></span>
                                        <span class="ob-switch-text"><b>Compress JavaScript</b><small>Minify generated JS to reduce size and improve load times.</small></span>
                                    </label>
                                    <label class="ob-switch-row" for="compressCss"
                                        data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Minify generated CSS (strips whitespace &amp; comments) for smaller files and faster loads.">
                                        <span class="form-check form-switch mb-0"><input class="form-check-input" type="checkbox" id="compressCss"></span>
                                        <span class="ob-switch-text"><b>Compress CSS</b><small>Minify generated CSS to reduce size and improve load times.</small></span>
                                    </label>
                                    <label class="ob-switch-row" for="compressHtml"
                                        data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Strip whitespace and comments from generated HTML pages. Saves bytes; can make View Source harder to read.">
                                        <span class="form-check form-switch mb-0"><input class="form-check-input" type="checkbox" id="compressHtml"></span>
                                        <span class="ob-switch-text"><b>Compress HTML output</b><small>Strip whitespace and comments from generated HTML.</small></span>
                                    </label>
                                    <label class="ob-switch-row" for="assetVersioning"
                                        data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Adds ?v=<hash> to CSS/JS links so browsers always fetch the newest file after an update — prevents stale-cache bugs in production.">
                                        <span class="form-check form-switch mb-0"><input class="form-check-input" type="checkbox" id="assetVersioning"></span>
                                        <span class="ob-switch-text"><b>Asset versioning (cache busting)</b><small>Append <code>?v=hash</code> to CSS/JS URLs so browsers fetch fresh files after updates.</small></span>
                                    </label>
                                    <label class="ob-switch-row" for="minifyInline"
                                        data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Minify &lt;script&gt; and &lt;style&gt; blocks written directly inside HTML pages (in addition to external files).">
                                        <span class="form-check form-switch mb-0"><input class="form-check-input" type="checkbox" id="minifyInline"></span>
                                        <span class="ob-switch-text"><b>Minify inline scripts &amp; styles</b><small>Minify <code>&lt;script&gt;</code> and <code>&lt;style&gt;</code> blocks embedded in HTML.</small></span>
                                    </label>
                                </div>
                            </div>
                        </section>

                        <section class="ob-card">
                            <header class="ob-card-head">
                                <span class="ob-card-ic ic-slate"><i class="bi bi-file-earmark-code"></i></span>
                                <div>
                                    <h6>Document Output</h6>
                                    <p>Doctype and character encoding written into generated HTML.</p>
                                </div>
                            </header>
                            <div class="ob-card-body">
                                <div class="row g-3">
                                    <div class="col-md-6">
                                        <label class="ob-label" for="htmlDoctype">HTML Doctype</label>
                                        <select class="form-select" id="htmlDoctype"
                                            data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Doctype line written at the top of every generated page. HTML5 is recommended for all modern apps.">
                                            <option value="html5">HTML5 &nbsp;(&lt;!DOCTYPE html&gt;)</option>
                                            <option value="xhtml">XHTML Strict</option>
                                            <option value="html4">HTML4 Transitional</option>
                                        </select>
                                    </div>
                                    <div class="col-md-6">
                                        <label class="ob-label" for="charset">Character Encoding</label>
                                        <select class="form-select" id="charset"
                                            data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Character set declared in generated pages. UTF-8 is recommended unless you have a specific legacy requirement.">
                                            <option value="utf-8">UTF-8 &nbsp;(recommended)</option>
                                            <option value="iso-8859-1">ISO-8859-1 (Latin-1)</option>
                                            <option value="windows-1251">Windows-1251 (Cyrillic)</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </section>
                    </div>

                    <!-- ══════════════ ADVANCED ══════════════ -->
                    <div class="tab-pane fade" id="advancedPane" role="tabpanel">

                        <section class="ob-card">
                            <header class="ob-card-head">
                                <span class="ob-card-ic ic-rose"><i class="bi bi-terminal"></i></span>
                                <div>
                                    <h6>Build Hooks</h6>
                                    <p>Commands run automatically around every build. Leave blank if unused.</p>
                                </div>
                            </header>
                            <div class="ob-card-body">
                                <div class="mb-3">
                                    <label class="ob-label" for="preBuildHook">Pre-Build Command</label>
                                    <textarea class="form-control font-monospace ob-code" id="preBuildHook" rows="2" placeholder="e.g. php cleanup.php   or   rm -rf ./cache/*"
                                        data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Runs before generation begins — e.g. clear a cache. Shell command or PHP script executed on the server with the web server's privileges."></textarea>
                                    <div class="ob-hint">Shell command or PHP script executed <b>before</b> the build starts.</div>
                                </div>
                                <div>
                                    <label class="ob-label" for="postBuildHook">Post-Build Command</label>
                                    <textarea class="form-control font-monospace ob-code" id="postBuildHook" rows="2" placeholder="e.g. php notify.php   or   chmod -R 755 ./output"
                                        data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Runs after generation completes — e.g. set permissions, warm a cache, or notify a service."></textarea>
                                    <div class="ob-hint">Shell command or PHP script executed <b>after</b> the build completes.</div>
                                </div>
                                <div class="ob-callout warn">
                                    <i class="bi bi-exclamation-triangle-fill"></i>
                                    <div>Hooks run with the web server's privileges. Only enter commands you trust.</div>
                                </div>
                            </div>
                        </section>

                        <section class="ob-card">
                            <header class="ob-card-head">
                                <span class="ob-card-ic ic-slate"><i class="bi bi-tools"></i></span>
                                <div>
                                    <h6>Generated File Options</h6>
                                    <p>Filesystem, versioning and runtime behavior of the generated app.</p>
                                </div>
                            </header>
                            <div class="ob-card-body">
                                <div class="row g-3">
                                    <div class="col-md-4">
                                        <label class="ob-label" for="filePermissions">File Permissions</label>
                                        <div class="input-group">
                                            <span class="input-group-text"><i class="bi bi-shield-lock"></i></span>
                                            <input type="text" class="form-control" id="filePermissions" placeholder="0644" maxlength="4"
                                                data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Octal permission mode applied to generated files (e.g. 0644). Use the Presets menu for common values; 0644 suits most shared hosts.">
                                            <button class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown">Presets</button>
                                            <ul class="dropdown-menu dropdown-menu-end">
                                                <li><a class="dropdown-item preset-permission" href="#" data-value="0644">0644 &nbsp;(rw-r--r--)</a></li>
                                                <li><a class="dropdown-item preset-permission" href="#" data-value="0755">0755 &nbsp;(rwxr-xr-x)</a></li>
                                                <li><a class="dropdown-item preset-permission" href="#" data-value="0600">0600 &nbsp;(rw-------)</a></li>
                                                <li><a class="dropdown-item preset-permission" href="#" data-value="0777">0777 &nbsp;(rwxrwxrwx)</a></li>
                                            </ul>
                                        </div>
                                        <div class="ob-hint">Octal permissions for generated files.</div>
                                    </div>
                                    <div class="col-md-4">
                                        <label class="ob-label" for="lineEndings">Line Endings</label>
                                        <select class="form-select" id="lineEndings"
                                            data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Newline style for generated text files. LF for Linux/macOS servers, CRLF for Windows, or match the build machine's OS.">
                                            <option value="lf">LF — Unix / macOS</option>
                                            <option value="crlf">CRLF — Windows</option>
                                            <option value="native">OS Default</option>
                                        </select>
                                    </div>
                                    <div class="col-md-4">
                                        <label class="ob-label" for="versionLabel">Version Label</label>
                                        <input type="text" class="form-control" id="versionLabel" placeholder="1.0.0  or  build-20240315"
                                            data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Free-form version string embedded in generated file metadata, e.g. 1.0.0 or build-20240315. Handy for tracking what's deployed.">
                                        <div class="ob-hint">Embedded in generated file metadata.</div>
                                    </div>
                                    <div class="col-md-6">
                                        <label class="ob-label" for="errorReporting">Error Reporting Level</label>
                                        <select class="form-select" id="errorReporting"
                                            data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="How the generated app handles PHP errors. Production logs silently; Development shows them on-screen; None suppresses all.">
                                            <option value="development">Development — show all errors</option>
                                            <option value="production">Production — hide errors, log only</option>
                                            <option value="none">None — suppress all</option>
                                        </select>
                                    </div>
                                    <div class="col-md-6 d-flex align-items-end">
                                        <label class="ob-switch-row w-100" for="debugMode"
                                            data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Enables verbose runtime diagnostics in the generated app. Useful while developing — never leave on for production.">
                                            <span class="form-check form-switch mb-0"><input class="form-check-input" type="checkbox" id="debugMode"></span>
                                            <span class="ob-switch-text"><b>Enable debug mode in generated app</b><small>Verbose diagnostics — never leave on for production.</small></span>
                                        </label>
                                    </div>
                                </div>
                            </div>
                        </section>

                        <section class="ob-card">
                            <header class="ob-card-head">
                                <span class="ob-card-ic ic-teal"><i class="bi bi-file-plus"></i></span>
                                <div>
                                    <h6>Additional Files</h6>
                                    <p>Optional server &amp; SEO files emitted alongside the app.</p>
                                </div>
                            </header>
                            <div class="ob-card-body">
                                <div class="ob-toggle-list">
                                    <label class="ob-switch-row" for="generateHtaccess"
                                        data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Emit an Apache .htaccess with clean-URL rewriting and security rules. Enable for typical Apache/cPanel hosting.">
                                        <span class="form-check form-switch mb-0"><input class="form-check-input" type="checkbox" id="generateHtaccess"></span>
                                        <span class="ob-switch-text"><b>Generate <code>.htaccess</code></b><small>Apache URL rewriting and security rules.</small></span>
                                    </label>
                                    <label class="ob-switch-row" for="generateWebConfig"
                                        data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Emit an IIS web.config with URL rewriting and security rules — the Windows-server equivalent of .htaccess.">
                                        <span class="form-check form-switch mb-0"><input class="form-check-input" type="checkbox" id="generateWebConfig"></span>
                                        <span class="ob-switch-text"><b>Generate <code>web.config</code></b><small>IIS URL rewriting and security rules.</small></span>
                                    </label>
                                    <label class="ob-switch-row" for="generateRobotsTxt"
                                        data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Emit a robots.txt with search-engine crawling directives at the site root.">
                                        <span class="form-check form-switch mb-0"><input class="form-check-input" type="checkbox" id="generateRobotsTxt"></span>
                                        <span class="ob-switch-text"><b>Generate <code>robots.txt</code></b><small>Search-engine crawling directives.</small></span>
                                    </label>
                                    <label class="ob-switch-row" for="standaloneInstaller"
                                        data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Ship a guided install.php: on the target server it tests the database connection, imports the schema + seed data, and creates the first admin. The bundle carries NO credentials and no dev admin hash — they're set at install time.">
                                        <span class="form-check form-switch mb-0"><input class="form-check-input" type="checkbox" id="standaloneInstaller"></span>
                                        <span class="ob-switch-text"><b>Include standalone <code>install.php</code></b><small>Runtime DB setup wizard — no baked credentials.</small></span>
                                    </label>
                                </div>
                            </div>
                        </section>
                    </div>
                </div>
              </div>
            </main>
            </div>
        </div>
    </div>

    <!-- in-app Guide (self-contained partial) -->
    <?php include __DIR__ . '/partials/help.php'; ?>

    <?php include constant('BASE_PATH') . '/core/views/project-scripts.php'; ?>

    <script>
        const projectSlug = <?= json_encode($project['slug'] ?? '') ?>;
        const baseUrl = <?= json_encode($baseUrl) ?>;
        const outputConfig = <?= $configJson ?>;
    </script>

    <?= \PpPhp\Core\ModuleAssets::script('Output', 'Views/scripts/core.js') ?>
    <?= \PpPhp\Core\ModuleAssets::script('Output', 'Views/scripts/save.js') ?>
    <?= \PpPhp\Core\ModuleAssets::script('Output', 'Views/scripts/init.js') ?>
</body>

</html>
