{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "software-glyph",
  "title": "Software Glyph",
  "author": "Visant Labs <visantsupply@gmail.com>",
  "description": "Logo de software em uma cor e leitores de nome de ferramenta e de link.",
  "dependencies": [
    "lucide-react",
    "simple-icons"
  ],
  "registryDependencies": [
    "utils"
  ],
  "files": [
    {
      "path": "registry/visant/ui/software-glyph.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport {\n  Bot,\n  FileText,\n  FolderOpen,\n  Globe,\n  type LucideIcon,\n  PencilLine,\n  Search,\n  SquareTerminal,\n  Wrench,\n} from \"lucide-react\";\nimport {\n  type SimpleIcon,\n  siBehance,\n  siBlender,\n  siClaude,\n  siDiscord,\n  siDribbble,\n  siFfmpeg,\n  siFigma,\n  siFramer,\n  siGithub,\n  siGmail,\n  siGooglecalendar,\n  siGooglechrome,\n  siGoogledocs,\n  siGoogledrive,\n  siGooglegemini,\n  siGooglesheets,\n  siInstagram,\n  siLinear,\n  siNotion,\n  siPinterest,\n  siSpotify,\n  siStripe,\n  siSupabase,\n  siTiktok,\n  siVercel,\n  siVimeo,\n  siWhatsapp,\n  siYoutube,\n} from \"simple-icons\";\n\nimport { cn } from \"@/lib/utils\";\n\n/**\n * Software Glyph — o logo de um software em uma cor só, e os dois leitores que\n * descobrem QUAL software está por trás de um nome de ferramenta ou de um link.\n *\n * Colhido do painel do agente do Estúdio (jaques-os), onde a linha de ações\n * mostrava `mcp__claude_ai_Figma__get_metadata, Bash` cru e o link do Figma\n * colado ocupava três linhas da bolha.\n *\n * ── O que não é óbvio ──────────────────────────────────────────────────────\n *\n * 1. **Uma cor só (`currentColor`).** A interface tem um destaque, e é o da\n *    marca dona da tela. Logo de terceiro em cor própria vira confete numa\n *    lista de dez ações.\n * 2. **Monograma onde o simple-icons não tem o logo.** A Adobe, a Canva, a\n *    OpenAI e o Slack saíram do simple-icons por pedido das marcas; a v16 não\n *    tem nenhum dos quatro. A saída é a sigla que o próprio software usa (Pr,\n *    Ps, Ai) numa moldura, e nunca um SVG copiado de outro lugar.\n * 3. **Só ícones que existem na v15 e na v16.** O app que instala pode estar em\n *    qualquer uma das duas; importar um ícone removido quebra o build dele.\n * 4. **Não sabe de onde vem o nome.** `softwareFromTool` lê o padrão\n *    `mcp__<servidor>__<ação>` e os nomes nativos do Claude Code (Bash, Read);\n *    quem tem outro agente passa outro nome e cai em \"ferramenta\".\n */\n\nexport interface Software {\n  id: string;\n  name: string;\n  /** Logo do simple-icons, desenhado em `currentColor`. */\n  icon?: SimpleIcon;\n  /** Sigla em moldura, quando não há logo livre (\"Pr\"). */\n  mono?: string;\n  /** Ícone genérico, para o que não é marca (terminal, arquivo). */\n  lucide?: LucideIcon;\n  /** Casa com o servidor MCP ou o nome da ferramenta. */\n  tool?: RegExp;\n  /** Casa com o host do link. */\n  host?: RegExp;\n}\n\nexport const SOFTWARE: Software[] = [\n  { id: \"figma\", name: \"Figma\", icon: siFigma, tool: /figma/i, host: /(^|\\.)figma\\.com$/ },\n  { id: \"premiere\", name: \"Premiere Pro\", mono: \"Pr\", tool: /premiere/i },\n  { id: \"photoshop\", name: \"Photoshop\", mono: \"Ps\", tool: /photoshop/i },\n  { id: \"illustrator\", name: \"Illustrator\", mono: \"Ai\", tool: /illustrator/i },\n  { id: \"after-effects\", name: \"After Effects\", mono: \"Ae\", tool: /after.?effects/i },\n  { id: \"adobe\", name: \"Adobe\", mono: \"Ad\", tool: /adobe|acrobat|express|firefly/i, host: /(^|\\.)adobe\\.com$/ },\n  { id: \"drive\", name: \"Google Drive\", icon: siGoogledrive, tool: /google_?drive/i, host: /^drive\\.google\\.com$/ },\n  { id: \"docs\", name: \"Google Docs\", icon: siGoogledocs, host: /^docs\\.google\\.com$/ },\n  { id: \"sheets\", name: \"Google Sheets\", icon: siGooglesheets },\n  { id: \"gmail\", name: \"Gmail\", icon: siGmail, tool: /gmail/i, host: /^mail\\.google\\.com$/ },\n  { id: \"calendar\", name: \"Google Agenda\", icon: siGooglecalendar, tool: /calendar/i, host: /^calendar\\.google\\.com$/ },\n  { id: \"linear\", name: \"Linear\", icon: siLinear, tool: /linear/i, host: /(^|\\.)linear\\.app$/ },\n  { id: \"github\", name: \"GitHub\", icon: siGithub, tool: /github/i, host: /(^|\\.)github\\.com$/ },\n  { id: \"vercel\", name: \"Vercel\", icon: siVercel, tool: /vercel/i, host: /(^|\\.)vercel\\.(com|app)$/ },\n  { id: \"supabase\", name: \"Supabase\", icon: siSupabase, tool: /supabase/i, host: /(^|\\.)supabase\\.(com|co)$/ },\n  { id: \"stripe\", name: \"Stripe\", icon: siStripe, tool: /stripe/i, host: /(^|\\.)stripe\\.com$/ },\n  { id: \"notion\", name: \"Notion\", icon: siNotion, tool: /notion/i, host: /(^|\\.)notion\\.(so|site)$/ },\n  { id: \"canva\", name: \"Canva\", mono: \"Cv\", tool: /canva/i, host: /(^|\\.)canva\\.com$/ },\n  { id: \"chrome\", name: \"Navegador\", icon: siGooglechrome, tool: /chrome|browser/i },\n  { id: \"claude\", name: \"Claude\", icon: siClaude, tool: /claude_docs|artifact/i, host: /(^|\\.)claude\\.ai$/ },\n  { id: \"gemini\", name: \"Gemini\", icon: siGooglegemini, tool: /gemini/i, host: /^gemini\\.google\\.com$/ },\n  { id: \"openai\", name: \"OpenAI\", mono: \"AI\", tool: /openai|codex/i, host: /(^|\\.)(openai|chatgpt)\\.com$/ },\n  { id: \"youtube\", name: \"YouTube\", icon: siYoutube, tool: /youtube/i, host: /(^|\\.)(youtube\\.com|youtu\\.be)$/ },\n  { id: \"instagram\", name: \"Instagram\", icon: siInstagram, host: /(^|\\.)instagram\\.com$/ },\n  { id: \"tiktok\", name: \"TikTok\", icon: siTiktok, host: /(^|\\.)tiktok\\.com$/ },\n  { id: \"vimeo\", name: \"Vimeo\", icon: siVimeo, host: /(^|\\.)vimeo\\.com$/ },\n  { id: \"behance\", name: \"Behance\", icon: siBehance, host: /(^|\\.)behance\\.net$/ },\n  { id: \"dribbble\", name: \"Dribbble\", icon: siDribbble, host: /(^|\\.)dribbble\\.com$/ },\n  { id: \"pinterest\", name: \"Pinterest\", icon: siPinterest, host: /(^|\\.)pinterest\\.[a-z.]+$/ },\n  { id: \"framer\", name: \"Framer\", icon: siFramer, host: /(^|\\.)framer\\.(com|website)$/ },\n  { id: \"spotify\", name: \"Spotify\", icon: siSpotify, host: /(^|\\.)spotify\\.com$/ },\n  { id: \"whatsapp\", name: \"WhatsApp\", icon: siWhatsapp, host: /(^|\\.)(whatsapp\\.com|wa\\.me)$/ },\n  { id: \"discord\", name: \"Discord\", icon: siDiscord, host: /(^|\\.)discord\\.(com|gg)$/ },\n  { id: \"blender\", name: \"Blender\", icon: siBlender, tool: /blender/i },\n  { id: \"ffmpeg\", name: \"FFmpeg\", icon: siFfmpeg, tool: /ffmpeg/i },\n  { id: \"terminal\", name: \"Terminal\", lucide: SquareTerminal },\n  { id: \"arquivo\", name: \"Arquivo\", lucide: FileText },\n  { id: \"edicao\", name: \"Edição\", lucide: PencilLine },\n  { id: \"pasta\", name: \"Pasta\", lucide: FolderOpen },\n  { id: \"busca\", name: \"Busca\", lucide: Search },\n  { id: \"web\", name: \"Web\", lucide: Globe },\n  { id: \"agente\", name: \"Agente\", lucide: Bot },\n  { id: \"ferramenta\", name: \"Ferramenta\", lucide: Wrench },\n];\n\nconst POR_ID = new Map(SOFTWARE.map((s) => [s.id, s]));\nexport const softwareById = (id: string): Software => POR_ID.get(id) ?? POR_ID.get(\"ferramenta\")!;\n\n/** Ferramentas nativas de agente de código: o nome diz o software e a ação. */\nconst NATIVAS: Record<string, [string, string]> = {\n  bash: [\"terminal\", \"rodar comando\"],\n  powershell: [\"terminal\", \"rodar comando\"],\n  read: [\"arquivo\", \"ler\"],\n  write: [\"edicao\", \"escrever\"],\n  edit: [\"edicao\", \"editar\"],\n  multiedit: [\"edicao\", \"editar\"],\n  notebookedit: [\"edicao\", \"editar notebook\"],\n  grep: [\"busca\", \"procurar no código\"],\n  glob: [\"busca\", \"procurar arquivos\"],\n  ls: [\"pasta\", \"listar\"],\n  webfetch: [\"web\", \"abrir página\"],\n  websearch: [\"web\", \"pesquisar\"],\n  agent: [\"agente\", \"delegar\"],\n  task: [\"agente\", \"delegar\"],\n  skill: [\"ferramenta\", \"usar skill\"],\n  toolsearch: [\"ferramenta\", \"carregar ferramentas\"],\n  todowrite: [\"ferramenta\", \"lista de tarefas\"],\n};\n\nconst humano = (s: string) => s.replace(/[_-]+/g, \" \").replace(/\\s+/g, \" \").trim().toLowerCase();\n\n/** `mcp__claude_ai_Figma__get_metadata` → Figma, \"get metadata\". `Bash` → Terminal, \"rodar comando\". */\nexport function softwareFromTool(nome: string): { software: Software; action: string } {\n  const mcp = /^mcp__(.+?)__(.+)$/.exec(nome);\n  if (mcp) {\n    const [, servidor, acao] = mcp;\n    const s = SOFTWARE.find((x) => x.tool?.test(servidor)) ?? SOFTWARE.find((x) => x.tool?.test(acao));\n    return { software: s ?? { ...softwareById(\"ferramenta\"), name: humano(servidor.replace(/^(claude_ai|plugin)_/, \"\")) }, action: humano(acao) };\n  }\n  const nativa = NATIVAS[nome.toLowerCase()];\n  if (nativa) return { software: softwareById(nativa[0]), action: nativa[1] };\n  return { software: SOFTWARE.find((x) => x.tool?.test(nome)) ?? softwareById(\"ferramenta\"), action: humano(nome) };\n}\n\n// ── Link → chip ──────────────────────────────────────────────────────────────\n// As regras por serviço vêm do `link-pills` do agentes-chat (packages/client/src/lib/link-pills.ts),\n// onde já foram pagas: só o host exato ganha logo (`github.com.evil.example` não), o endereço é\n// lido à mão porque o `URL` do celular é parcial, e um caminho que o navegador reescreve (`/../`)\n// fica como link comum, para o chip não mostrar um destino que não é o real.\n\ntype Dito = { name?: string; ref?: string; word?: string };\ntype Regra = [RegExp, (g: string[]) => Dito];\n\nconst decodificado = (seg: string) => {\n  let t = seg;\n  try {\n    t = decodeURIComponent(seg);\n  } catch {\n    // \"%\" solto não é escape: fica como está.\n  }\n  return t.replace(/[\\p{Cc}\\p{Cf}]/gu, \"\");\n};\nconst tituloDe = (slug: string) => decodificado(slug).replace(/[-_+\\s]+/g, \" \").trim();\nconst DOC_ID = String.raw`(?:u\\/\\d+\\/)?d\\/[\\w-]+`;\nconst PAGINAS_GITHUB =\n  \"about|account|apps|codespaces|collections|contact|copilot|dashboard|enterprise|explore|features|issues|join|login|marketplace|new|notifications|orgs|organizations|pricing|pulls|search|security|sessions|settings|site|solutions|sponsors|stars|team|topics|trending|users\";\n\nconst REGRAS: { host: RegExp; id: string; regras: Regra[] }[] = [\n  {\n    host: /^github\\.com$/,\n    id: \"github\",\n    regras: [\n      [/^\\/[\\w.-]+\\/([\\w.-]+)\\/pull\\/(\\d+)(?:\\/|$)/, ([r, n]) => ({ name: r, ref: `#${n}` })],\n      [/^\\/[\\w.-]+\\/([\\w.-]+)\\/issues\\/(\\d+)(?:\\/|$)/, ([r, n]) => ({ name: r, ref: `#${n}` })],\n      [/^\\/[\\w.-]+\\/([\\w.-]+)\\/commit\\/([0-9a-f]{7,40})(?:\\/|$)/, ([r, sha]) => ({ name: r, ref: (sha ?? \"\").slice(0, 7) })],\n      [/^\\/[\\w.-]+\\/([\\w.-]+)\\/blob\\/.*\\/([^/]+)$/, ([r, f]) => ({ name: r, ref: decodificado(f ?? \"\") })],\n      [new RegExp(String.raw`^\\/((?!(?:${PAGINAS_GITHUB})\\/)[\\w.-]+\\/[\\w.-]+)(?<!\\.git)\\/?$`), ([r]) => ({ name: r })],\n    ],\n  },\n  { host: /^linear\\.app$/, id: \"linear\", regras: [[/^\\/[\\w-]+\\/issue\\/([A-Za-z][A-Za-z0-9]*-\\d+)(?:\\/|$)/, ([i]) => ({ ref: (i ?? \"\").toUpperCase() })]] },\n  {\n    host: /^figma\\.com$/,\n    id: \"figma\",\n    regras: [\n      [/^\\/(?:file|design|board|slides|proto|make)\\/\\w+\\/([^/]+)\\/?$/, ([s]) => ({ name: tituloDe(s ?? \"\") })],\n      [/^\\/(?:file|design|board|slides|proto|make)\\/\\w+\\/?$/, () => ({ word: \"arquivo\" })],\n    ],\n  },\n  { host: /^(?:notion\\.so|[a-z0-9-]+\\.notion\\.site)$/, id: \"notion\", regras: [[/^\\/(?:[^/]+\\/)?([^/]+)-[0-9a-f]{32}\\/?$/, ([s]) => ({ name: tituloDe(s ?? \"\") })]] },\n  { host: /^docs\\.google\\.com$/, id: \"docs\", regras: [[new RegExp(String.raw`^\\/document\\/${DOC_ID}`), () => ({ word: \"documento\" })]] },\n  { host: /^docs\\.google\\.com$/, id: \"sheets\", regras: [[new RegExp(String.raw`^\\/spreadsheets\\/${DOC_ID}`), () => ({ word: \"planilha\" })]] },\n  { host: /^docs\\.google\\.com$/, id: \"drive\", regras: [[new RegExp(String.raw`^\\/presentation\\/${DOC_ID}`), () => ({ word: \"apresentação\" })]] },\n  {\n    host: /^drive\\.google\\.com$/,\n    id: \"drive\",\n    regras: [\n      [/^\\/file\\/(?:u\\/\\d+\\/)?d\\/[\\w-]+/, () => ({ word: \"arquivo\" })],\n      [/^\\/drive\\/(?:u\\/\\d+\\/)?folders\\/[\\w-]+/, () => ({ word: \"pasta\" })],\n    ],\n  },\n  { host: /^vercel\\.com$/, id: \"vercel\", regras: [[/^\\/[\\w-]+\\/([\\w.-]+)(?:\\/|$)/, ([p]) => ({ name: p })]] },\n  { host: /^(?:youtube\\.com|youtu\\.be)$/, id: \"youtube\", regras: [[/^\\/(?:watch|shorts\\/[\\w-]+|[\\w-]{11})/, () => ({ word: \"vídeo\" })]] },\n];\n\nconst ENDERECO = /^https?:\\/\\/([^/?#]+)(\\/[^?#]*)?/i;\nconst REESCRITO = /\\\\|(?:^|\\/)(?:\\.|%2e){1,2}(?:\\/|$)/i;\nconst ultimo = (caminho: string) => caminho.replace(/[\\\\/]+$/, \"\").split(/[\\\\/]/).pop() || caminho;\n\n/**\n * Um link ou caminho colado vira { software, label } curto para um chip.\n * Devolve null quando o texto não é um link nem um caminho inteiro. Nada é buscado: só o endereço.\n */\nexport function softwareFromLink(texto: string): { software: Software; label: string; href?: string } | null {\n  const t = texto.trim();\n  if (!t || /\\n/.test(t)) return null;\n  const [, autoridade, caminho = \"/\"] = t.match(ENDERECO) ?? [];\n  if (autoridade) {\n    if (/\\s/.test(t)) return null;\n    const host = autoridade.toLowerCase().replace(/^www\\./, \"\");\n    if (!REESCRITO.test(caminho)) {\n      for (const s of REGRAS) {\n        if (!s.host.test(host)) continue;\n        for (const [re, dizer] of s.regras) {\n          const achou = caminho.match(re);\n          if (!achou) continue;\n          const d = dizer(achou.slice(1));\n          const label = d.word ?? [d.name, d.ref].filter(Boolean).join(\" \");\n          if (label) return { software: softwareById(s.id), label, href: t };\n        }\n      }\n    }\n    // Serviço conhecido sem regra para esse caminho: o logo e o host; o resto, a web.\n    const s = SOFTWARE.find((x) => x.host?.test(host));\n    return { software: s ?? softwareById(\"web\"), label: s ? s.name : host, href: t };\n  }\n  // Caminho de disco inteiro: C:\\…, \\\\servidor\\…, /home/…\n  if (/^([a-z]:[\\\\/]|\\\\\\\\|\\/)[^<>|\"?*\\n]+$/i.test(t)) {\n    const drive = /[\\\\/](meu drive|my drive|shared drives|drives compartilhados)([\\\\/]|$)/i.test(t);\n    const ehArquivo = /\\.[a-z0-9]{1,5}$/i.test(t);\n    return { software: softwareById(drive ? \"drive\" : ehArquivo ? \"arquivo\" : \"pasta\"), label: ultimo(t) };\n  }\n  return null;\n}\n\nexport interface SoftwareGlyphProps extends React.HTMLAttributes<HTMLSpanElement> {\n  software: Software | string;\n  /** Lado em px. */\n  size?: number;\n}\n\n/** O logo em `currentColor`, num quadrado de `size`. Decorativo: o nome vai no texto ao lado. */\nexport function SoftwareGlyph({ software, size = 14, className, style, ...rest }: SoftwareGlyphProps) {\n  const s = typeof software === \"string\" ? softwareById(software) : software;\n  const caixa = cn(\"inline-grid shrink-0 place-items-center\", className);\n  if (s.icon) {\n    return (\n      <span aria-hidden=\"true\" className={caixa} style={{ width: size, height: size, ...style }} {...rest}>\n        <svg viewBox=\"0 0 24 24\" width={size} height={size} className=\"fill-current\">\n          <path d={s.icon.path} />\n        </svg>\n      </span>\n    );\n  }\n  if (s.mono) {\n    return (\n      <span\n        aria-hidden=\"true\"\n        className={cn(caixa, \"rounded-[calc(var(--r-control)/2)] font-semibold leading-none tracking-[-0.02em] ring-1 ring-current ring-inset\")}\n        style={{ width: size, height: size, fontSize: Math.max(7, Math.round(size * 0.5)), ...style }}\n        {...rest}\n      >\n        {s.mono}\n      </span>\n    );\n  }\n  const Icone = s.lucide ?? Wrench;\n  return (\n    <span aria-hidden=\"true\" className={caixa} style={{ width: size, height: size, ...style }} {...rest}>\n      <Icone width={size} height={size} strokeWidth={1.75} />\n    </span>\n  );\n}\n",
      "type": "registry:ui"
    }
  ],
  "meta": {
    "uso": {
      "quando": "Mostrar qual software está por trás de uma ação de agente ou de um link colado",
      "evite": "Parede de logos de cliente: logo-wall"
    }
  },
  "categories": [
    "agente",
    "ia",
    "logo",
    "link",
    "ferramenta"
  ],
  "type": "registry:ui"
}