{{--
    Server-side half of the client-side live preview bridge for the Master
    Control tenant form. The repainting logic itself is a registered Filament
    asset (resources/js/preview-bridge.js — see its docblock for the wiring);
    this block only embeds the data that is generated on the server, because
    the theme/invoice fields are not `->live()` and the previews are repainted
    in the browser from the form's CURRENT state:

      - the full per-preset colour sets ({@see ThemePresets::previewSets()})
      - the font stacks and radius/scale steps ({@see ThemeFonts::catalogue()})
      - the currency symbols
      - the stored currency, from the same server state the previews were
        first painted with — the bridge's baseline until the Locale-tab
        select has booted (and every repaint after, while it stays unread).
--}}
<script>
    window.previewBridgeConfig = {
        presets: @js(\App\Support\Theme\ThemePresets::previewSets()),
        fontStacks: @js(collect(\App\Support\Theme\ThemeFonts::all())
            ->mapWithKeys(fn (array $font, string $key): array => [$key => \App\Support\Theme\ThemeFonts::stack($key)])
            ->all()),
        radii: @js(collect(\App\Support\Theme\ThemeFonts::RADII)
            ->map(fn (array $r): string => $r['value'])
            ->all()),
        scales: @js(collect(\App\Support\Theme\ThemeFonts::SCALES)
            ->map(fn (array $s): string => $s['value'])
            ->all()),
        currencySymbols: @js(\App\Models\Reference\Currency::query()->pluck('symbol', 'code')->all()),
        defaultPreset: @js(\App\Support\Theme\ThemePresets::DEFAULT_KEY),
        defaultFont: @js(\App\Support\Theme\ThemeFonts::DEFAULT_BODY),
        fallbackAppName: @js(config('app.name')),
        savedCurrency: @js($currency ?? null),
    };
</script>