// Mobile platform detection helpers used by popup views to gate Capacitor-only paths. // Kept tiny and runtime-only — never import @capacitor/core at module scope, since // desktop builds must not pull it. // eslint-disable-next-line @typescript-eslint/no-explicit-any type Cap = { isNativePlatform?: () => boolean; Plugins?: Record }; function cap(): Cap | null { const g = globalThis as unknown as { Capacitor?: Cap }; return g.Capacitor ?? null; } export function isNativePlatform(): boolean { const c = cap(); if (!c) return false; if (typeof c.isNativePlatform === "function") return c.isNativePlatform(); return false; } // eslint-disable-next-line @typescript-eslint/no-explicit-any export function nativePlugin(name: string): T | null { return (cap()?.Plugins?.[name] as T | undefined) ?? null; }