<?php

use Illuminate\Http\Request;

define('LARAVEL_START', microtime(true));

// Register the Composer autoloader...
require __DIR__.'/../vendor/autoload.php';

// КРИТИЧНО: Отключаем IPC режим MadelineProto ПЕРЕД любым кодом
putenv('MADELINEPROTO_WORKER=0');

// Загружаем .env.local если он существует (для локальной разработки)
if (file_exists(__DIR__.'/../.env.local')) {
    $dotenv = Dotenv\Dotenv::createImmutable(__DIR__.'/../', '.env.local');
    $dotenv->load();
}

// Determine if the application is in maintenance mode...
if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) {
    require $maintenance;
}

// Bootstrap Laravel and handle the request...
(require_once __DIR__.'/../bootstrap/app.php')
    ->handleRequest(Request::capture());
