Write a Python function called `parse_duration` that takes a string like "2h30m15s" and returns the total number of seconds as an integer. The function must handle hours (h), minutes (m), and seconds (s) in any order. If a component is missing, treat it as zero. If the input format is invalid, raise a ValueError with a descriptive message. Include a docstring and type hints. Do not import any external libraries. Return only the function definition, no examples or tests.