URI be the string representing the data URI.If URI does not start with a case-insensitive "data:":
MALFORMED_URI exception.If URI does not contain a ",":
MALFORMED_URI exception.supportedContentEncodings be an array of strings representing the supported content encodings. (["base64"] for example)mimeType be a string with the value "text/plain".contentEncoding be an empy string.contentEncodingAlreadySet be a boolean with a value of false.supportedValues be a map of string:string pairs where the first string in each pair represents the name of the supported value and the second string in each pair represents an empty string or default string value. (Example: {"charset" : "", "filename" : "", "content-disposition" : ""})supportedValueSetBits be a map of string:bool pairs representing each of the names in supportedValues with each name set to false.comma be the position of the first "," found in URI.temp be the substring of URI from, and including, position 5 to, and excluding, the comma position. (between "data:" and first ",")headers be an array of strings returned by splitting temp by ";".For each string s in headers:
s equal the lowercase version of seq be the position result of searching for "=" in s.name and value be empty strings.If eq is not a valid position in s:
name equal the result of percent-decoding s.name equal the result of trimming leading and trailing white-space from name.Else:
name equal the substring of s from position 0 to, but not including, position eq.name equal the result of percent-decoding name.name equal the result of trimmnig leading and trailing white-space from name.value equal the substring of s from position eq + 1 to the end of s.value equal the result of precent-decoding value.value equal the result of trimming leading and trailing white-space from value.If s is the first element in headers and eq is not a valid position in s and the length of name is greater than 0:
mimeType equal name.Else:
If eq is not a valid position in s:
If name is found case-insensitively in supportedContentEncodings:
If contentEncodingAlreadySet is false:
contentEncoding equal name.ContentEncodingAlreadySet equal true.Else:
If the length of value is greater than 0 and name is found case-insensitively in supportedValues:
If the corresponding value for name found (case-insensitivley) in supportedValueSetBits is false:
name found (case-insensitively) in supportedValues equal value.name found (case-insensitively) in supportedValueSetBits equal true.data be the substring of URI from position comma + 1 to the end of URI.data be the result of percent-decoding data.dataURIObject be an object consisting of the mimeType, contentEncoding, data and supportedValues objects.dataURIObject.