anchor.diff:  	Payload = inflate_frame(unmask(Data2, MaskKey, ParsedLen), Inflate, TakeOver, FragState, Eof),
   	validate_payload(Payload, Rest, Utf8State, ParsedLen, Type, FragState, Eof);
   %% Empty frame.
  -parse_payload(Data, _, <<>>, 0, _, 0, _, _, _) ->
  -	{ok, <<>>, <<>>, Data};
  +parse_payload(Data, _, Utf8State = 0, 0, _, 0, _, _, _) ->
  +	{ok, <<>>, Utf8State, Data};
   %% Start of close frame.
   parse_payload(Data, MaskKey, Utf8State, 0, Type = close, Len, FragState, _, << 0:3 >>) ->
   	{<< MaskedCode:2/binary, Data2/bits >>, Rest, Eof} = split_payload(Data, Len),
  
positive.code: validate_payload(Payload, Rest, Utf8State, _, _, _, true) ->
  	{ok, Payload, Utf8State, Rest}.
  
  %% Returns <<>> if the argument is valid UTF-8, false if not,
  %% or the incomplete part of the argument if we need more data.
  validate_utf8(<<>>) ->
  	<<>>;
  validate_utf8(<< _/utf8, Rest/bits >>) ->
  	validate_utf8(Rest);
  %% 2 bytes. Codepages C0 and C1 are invalid; fail early.
  validate_utf8(<< 2#1100000:7, _/bits >>) ->
  	false;
  validate_utf8(Incomplete = << 2#110:3, _:5 >>) ->
  	Incomplete;
  %% 3 bytes.
  validate_utf8(Incomplete = << 2#1110:4, _:4 >>) ->
  	Incomplete;
  validate_utf8(Incomplete = << 2#1110:4, _:4, 2#10:2, _:6 >>) ->
  	Incomplete;
  %% 4 bytes. Codepage F4 may have invalid values greater than 0x10FFFF.
  validate_utf8(<< 2#11110100:8, 2#10:2, High:6, _/bits >>) when High >= 2#10000 ->
  	false;
  validate_utf8(Incomplete = << 2#11110:5, _:3 >>) ->
  	Incomplete;
  validate_utf8(Incomplete = << 2#11110:5, _:3, 2#10:2, _:6 >>) ->
  	Incomplete;
  validate_utf8(Incomplete = << 2#11110:5, _:3, 2#10:2, _:6, 2#10:2, _:6 >>) ->
  	Incomplete;
  %% Invalid.
  validate_utf8(_) ->
  	false.
  
  %% @doc Return a frame tuple from parsed state and data.
  
  
negative.code: 	| {fragment, fin | nofin, text | binary, iodata()}.
  -export_type([frame/0]).
  
  -type utf8_state() :: 0..8.
  -export_type([utf8_state/0]).
  
  -type extensions() :: map().
  -type frame_type() :: fragment | text | binary | close | ping | pong.
  -type mask_key() :: undefined | 0..16#ffffffff.
  -type rsv() :: <<_:3>>.
  
  %% @doc Negotiate the permessage-deflate extension.
  
  