// lib/editor/pdf/spike_launcher.dart
//
// THROWAWAY M1 entry: lets the user open the pdfrx pen/perf spike from the
// running app (so the CI-built Windows package can exercise MUST #3/#4/#5 on a
// real Surface Pen with the user's OWN large PDFs). Remove together with the
// rest of lib/editor/pdf/spike_* once M1 is signed off.

import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';

import '../canvas/pen_editor_screen.dart';

/// Opens a file picker for a PDF, then pushes the NEW pen-first canvas editor.
///
/// The 🧪 entry now opens the clean-room canvas (lib/editor/canvas/), which
/// OWNS the gesture pipeline (pressure, pinch-zoom, palm rejection). The old
/// spike_* files are left in place but no longer wired to this entry.
Future<void> openM1Spike(BuildContext context) async {
  final result = await FilePicker.platform.pickFiles(
    type: FileType.custom,
    allowedExtensions: ['pdf'],
  );
  final path = result?.files.single.path;
  if (path == null) return;
  if (!context.mounted) return;
  Navigator.of(context).push(
    MaterialPageRoute(
      builder: (_) => PenEditorScreen(pdfPath: path),
    ),
  );
}
