<?php

declare(strict_types=1);

namespace App\Providers;

use App\Http\Controllers\Support\Inertia;
use Hypervel\Support\Facades\Auth;
use Hypervel\Support\Facades\URL;
use Hypervel\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    public function boot(): void
    {
        Auth::viaRequest('bearer', function ($request) {
            return \App\Auth\BearerTokenResolver::resolve($request);
        });
    }

    public function register(): void
    {
    }
    function vite_asset(string $entry): string
    {
        static $manifest = null;
        if ($manifest === null) {
            $manifestPath = public_path('build/manifest.json');
            $manifest = file_exists($manifestPath) ? json_decode(file_get_contents($manifestPath), true) : [];
        }
        return '/build/' . ($manifest[$entry]['file'] ?? $entry);
    }
}
