{
  "name": "Selection Word Count",
  "description": "Highlight text, right-click, and get its word count, character count, and estimated reading time.",
  "tags": [
    "word count",
    "character count",
    "reading time",
    "selection",
    "right-click",
    "text"
  ],
  "type": "triggered",
  "nodes": [
    {
      "id": "sticky-intro",
      "position": {
        "x": 20,
        "y": 20
      },
      "data": {
        "color": "#fff266",
        "content": "🔢 Count what you selected.\n\nHighlight any text on a page, right-click, and choose this workflow. It counts the words and characters and estimates how long it takes to read (about 200 words per minute), then shows it in a quick notification.",
        "isRunning": false,
        "runned": false,
        "wasRunned": false,
        "failed": false
      },
      "type": "stickyNote",
      "width": 360,
      "height": 190,
      "measured": {
        "width": 360,
        "height": 190
      }
    },
    {
      "id": "trigger-context-menu",
      "position": {
        "x": 30,
        "y": 300
      },
      "data": {
        "instance": {
          "id": "af-base-node:trigger:contextMenu"
        },
        "label": "Right-click a selection",
        "inputs": {
          "contexts": [
            "selection"
          ]
        },
        "parameters": {
          "notes": "Adds this workflow to the right-click menu whenever you have text selected."
        },
        "isRunning": false,
        "runned": false,
        "wasRunned": false,
        "failed": false
      },
      "type": "trigger",
      "measured": {
        "width": 50,
        "height": 50
      },
      "selected": false,
      "dragging": false
    },
    {
      "id": "get-selection",
      "position": {
        "x": 245,
        "y": 300
      },
      "data": {
        "instance": {
          "id": "af-base-node:basic:getSelectedTextNode"
        },
        "label": "Get selected text",
        "inputs": {
          "outputFieldName": "selection",
          "options": {
            "includeInputFields": true
          }
        },
        "parameters": {
          "notes": "Reads the full text you highlighted on the page. The context-menu event only carries a short, truncated copy, so this node gets the complete selection reliably."
        },
        "isRunning": false,
        "runned": false,
        "wasRunned": false,
        "failed": false
      },
      "type": "basic",
      "measured": {
        "width": 50,
        "height": 50
      },
      "selected": false,
      "dragging": false
    },
    {
      "id": "count-words",
      "position": {
        "x": 440,
        "y": 300
      },
      "data": {
        "instance": {
          "id": "af-base-node:basic:text-formatter"
        },
        "label": "Count words",
        "inputs": {
          "operation": "wordCount",
          "text": "{{ $input.selection }}"
        },
        "parameters": {
          "notes": "Counts how many words are in your selection."
        },
        "isRunning": false,
        "runned": false,
        "wasRunned": false,
        "failed": false
      },
      "type": "basic",
      "measured": {
        "width": 50,
        "height": 50
      },
      "selected": false
    },
    {
      "id": "count-chars",
      "position": {
        "x": 760,
        "y": 300
      },
      "data": {
        "instance": {
          "id": "af-base-node:basic:text-formatter"
        },
        "label": "Count characters",
        "inputs": {
          "operation": "charCount",
          "text": "{{ $('Get selected text').selection }}"
        },
        "parameters": {
          "notes": "Counts the characters in your original selection."
        },
        "isRunning": false,
        "runned": false,
        "wasRunned": false,
        "failed": false
      },
      "type": "basic",
      "measured": {
        "width": 50,
        "height": 50
      },
      "selected": false
    },
    {
      "id": "reading-minutes",
      "position": {
        "x": 1080,
        "y": 300
      },
      "data": {
        "instance": {
          "id": "af-base-node:basic:math"
        },
        "label": "Reading minutes",
        "inputs": {
          "operation": "divide",
          "value": "{{ $('Count words').count }}",
          "operand": 200,
          "precision": 0,
          "wholeNumber": true,
          "outputFieldName": "minutes",
          "includeInputFields": true
        },
        "parameters": {
          "notes": "Estimates reading time by dividing the word count by 200 words per minute."
        },
        "isRunning": false,
        "runned": false,
        "wasRunned": false,
        "failed": false
      },
      "type": "basic",
      "measured": {
        "width": 50,
        "height": 50
      },
      "selected": false
    },
    {
      "id": "notify",
      "position": {
        "x": 1400,
        "y": 300
      },
      "data": {
        "instance": {
          "id": "af-base-node:basic:showNotificationNode"
        },
        "label": "Show the stats",
        "inputs": {
          "title": "Selection stats",
          "message": "{{ $('Count words').count }} words · {{ $('Count characters').count }} chars · ~{{ max(1, $('Reading minutes').minutes) }} min read"
        },
        "parameters": {
          "notes": "Shows the word count, character count, and reading time in a notification."
        },
        "isRunning": false,
        "runned": false,
        "wasRunned": false,
        "failed": false
      },
      "type": "basic",
      "measured": {
        "width": 50,
        "height": 50
      },
      "selected": true
    }
  ],
  "edges": [
    {
      "id": "e-ctx-get-selection",
      "type": "flowEdge",
      "source": "trigger-context-menu",
      "target": "get-selection",
      "markerEnd": {
        "type": "arrowclosed"
      }
    },
    {
      "id": "e-trigger-words",
      "type": "flowEdge",
      "source": "get-selection",
      "target": "count-words",
      "markerEnd": {
        "type": "arrowclosed"
      }
    },
    {
      "id": "e-words-chars",
      "type": "flowEdge",
      "source": "count-words",
      "target": "count-chars",
      "markerEnd": {
        "type": "arrowclosed"
      }
    },
    {
      "id": "e-chars-minutes",
      "type": "flowEdge",
      "source": "count-chars",
      "target": "reading-minutes",
      "markerEnd": {
        "type": "arrowclosed"
      }
    },
    {
      "id": "e-minutes-notify",
      "type": "flowEdge",
      "source": "reading-minutes",
      "target": "notify",
      "markerEnd": {
        "type": "arrowclosed"
      }
    }
  ]
}