{
  "name": "Web Search Selection",
  "description": "Highlight anything, right-click, and get web search results for it right away — no new tab needed.",
  "tags": [
    "web search",
    "selection",
    "lookup",
    "right-click",
    "research"
  ],
  "type": "triggered",
  "nodes": [
    {
      "id": "sticky-intro",
      "position": {
        "x": 20,
        "y": 20
      },
      "data": {
        "color": "#fff266",
        "content": "🔎 Search your selection.\n\nSelect any text on a page, right-click, and run this. It takes the highlighted text and returns the top web results — titles, links and snippets — without opening a new tab."
      },
      "type": "stickyNote",
      "width": 360,
      "height": 180
    },
    {
      "id": "trigger-menu",
      "position": {
        "x": 120,
        "y": 300
      },
      "data": {
        "instance": {
          "id": "af-base-node:trigger:contextMenu"
        },
        "label": "On right-click (selection)",
        "inputs": {
          "contexts": [
            "selection"
          ]
        },
        "parameters": {
          "notes": "Adds a right-click menu item that appears when you have text selected."
        }
      },
      "type": "trigger"
    },
    {
      "id": "get-selection",
      "position": {
        "x": 440,
        "y": 300
      },
      "data": {
        "instance": {
          "id": "af-base-node:basic:getSelectedTextNode"
        },
        "label": "Get selected text",
        "inputs": {
          "outputFieldName": "selection"
        },
        "parameters": {
          "notes": "Reads the text you highlighted on the page."
        }
      },
      "type": "basic"
    },
    {
      "id": "search",
      "position": {
        "x": 760,
        "y": 300
      },
      "data": {
        "instance": {
          "id": "af-base-node:basic:searchNode"
        },
        "label": "Search the web",
        "inputs": {
          "query": "{{ $input.selection }}",
          "engine": "duckduckgo",
          "maxResults": 10
        },
        "parameters": {
          "notes": "Runs a web search for the selected text and returns the top results."
        }
      },
      "type": "basic"
    },
    {
      "id": "show",
      "position": {
        "x": 1080,
        "y": 300
      },
      "data": {
        "instance": {
          "id": "af-base-node:basic:displayObjectNode"
        },
        "label": "Show the results",
        "inputs": {
          "title": "Search results"
        },
        "parameters": {
          "notes": "Displays the search results (title, link, snippet)."
        }
      },
      "type": "basic"
    }
  ],
  "edges": [
    {
      "id": "e-menu-sel",
      "type": "flowEdge",
      "source": "trigger-menu",
      "target": "get-selection"
    },
    {
      "id": "e-sel-search",
      "type": "flowEdge",
      "source": "get-selection",
      "target": "search"
    },
    {
      "id": "e-search-show",
      "type": "flowEdge",
      "source": "search",
      "target": "show"
    }
  ]
}