const OFFICIAL_HOST = /(^|\.)dify\.(ai|com)$/i export function isOfficialDifyUrl(value?: string | null): boolean { const trimmed = value?.trim() ?? '' if (!trimmed) return false const mailto = trimmed.match(/^mailto:([^?]+)/i) if (mailto) { const host = mailto[1]?.split('@').pop() ?? '' return OFFICIAL_HOST.test(host) } try { return OFFICIAL_HOST.test(new URL(trimmed).hostname) } catch { return false } }