// TODO: obviously ugly. But sadly necessary until Microsoft enhances the UX within EDGE (compare to https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/9573654/)
// adapted out of https://gist.github.com/gaboratorium/25f08b76eb82b1e7b91b01a0448f8b1d :
// Check for whether the events target was an input and still check for an existing instance of the datalist and polyfilling select
if("input"===t.tagName.toLowerCase()&&null!==i)
// Handling IE10+ & EDGE
if(s||d)
// On keypress check for value
""===A(t)||a||e.keyCode===c||e.keyCode===v||
// As only EDGE doesn't trigger the input event after selecting an item via mouse, we need to differentiate here
!s&&"text"!==t.type||(b(t,i),
// TODO: Check whether this update is necessary depending on the options values
t.focus());else{varn=!1,
// Creating the select if there's no instance so far (e.g. because of that it hasn't been handled or it has been dynamically inserted)
r=i.getElementsByClassName(m)[0]||x(t,i);
// On an ESC or ENTER key press within the input, let's break here and afterwards hide the datalist select, but if the input contains a value or one of the opening keys have been pressed ...
"Each option element that is a descendant of the datalist element, that is not disabled, and whose value is a string that isn't the empty string, represents a suggestion. Each suggestion has a value and a label."
"If appropriate, the user agent should use the suggestion's label and value to identify the suggestion to the user."
// Set the value of the first option to it's value - this actually triggers a redraw of the complete list
vara=t.list.options[0];a.value=a.value}
// Break here for IE10+ & EDGE
if(!s&&!d){var// Creating the select if there's no instance so far (e.g. because of that it hasn't been handled or it has been dynamically inserted)
n=i.getElementsByClassName(m)[0]||x(t,i),
// Either have the select set to the state to get displayed in case of that it would have been focused or because it's the target on the inputs blur - and check for general existance of any option as suggestions
// On keypress check all options for that as a substring, save the original value as a data-attribute and preset that inputs value (for sorting) for all option values (probably as well enhanced by a token)
// Break here for IE10+ & EDGE
if(
// Binding the focus event - matching the input[list]s happens in the function afterwards
u.addEventListener("focusin",E,!0),!s&&!d){
// Function for preparing and sorting the options/suggestions
vark=function(e,n){void0!==a&&a.disconnect();var// Creating the select if there's no instance so far (e.g. because of that it hasn't been handled or it has been dynamically inserted)
"The list IDL attribute must return the current suggestions source element, if any, or null otherwise."
"If there is no list attribute, or if there is no element with that ID, or if the first element with that ID is not a datalist element, then there is no suggestions source element."