import { invoke } from "@tauri-apps/api/core"; import { getCurrentWindow } from "@tauri-apps/api/window"; export function go(path) { window.location.hash = path === "/" ? "" : path; } export async function openWindow(path) { if (!window.__TAURI_INTERNALS__) { go(path); return; } try { await invoke("open_popup_window", { route: path }); } catch (error) { console.error("Failed to open popup window", error); go(path); } } export async function closeWindow() { if (!window.__TAURI_INTERNALS__) { go("/"); return; } await getCurrentWindow().close(); } export async function startWindowDrag() { if (!window.__TAURI_INTERNALS__) return; await getCurrentWindow().startDragging(); }