import { startStimulusApp } from '@symfony/stimulus-bridge';

// Registers Stimulus controllers from controllers.json and in the controllers/ directory
export const app = startStimulusApp(require.context(
    '@symfony/stimulus-bridge/lazy-controller-loader!./controllers',
    true,
    /\.[jt]sx?$/
));

// register any custom, 3rd party controllers here
// app.register('some_controller_name', SomeImportedController);

//DEBUG TURBO
// import * as Turbo from "@hotwired/turbo"
//
// Turbo.session.drive = false
// Turbo.start()
//
// // Écouteurs existants
// document.addEventListener("turbo:before-stream-render", (event) => {
//   console.log("Before stream render", event.target);
// });
//
// document.addEventListener("turbo:stream-render", (event) => {
//   console.log("Stream rendered", event.target);
// });
//
// // Nouvel écouteur pour les événements de création
// document.addEventListener("turbo:before-fetch-request", (event) => {
//   console.log("Before fetch request", event.detail.fetchOptions);
// });
//
// document.addEventListener("turbo:before-fetch-response", (event) => {
//   console.log("Before fetch response", event.detail.fetchResponse);
// });
