/** * DO NOT EDIT THIS FILE. * See the following change record for more information, * https://www.drupal.org/node/2815083 * @preserve **/ (function ($, Drupal) { var autocomplete = void 0; function autocompleteSplitValues(value) { var result = []; var quote = false; var current = ''; var valueLength = value.length; var character = void 0; for (var i = 0; i < valueLength; i++) { character = value.charAt(i); if (character === '"') { current += character; quote = !quote; } else if (character === ',' && !quote) { result.push(current.trim()); current = ''; } else { current += character; } } if (value.length > 0) { result.push($.trim(current)); } return result; } function extractLastTerm(terms) { return autocomplete.splitValues(terms).pop(); } function searchHandler(event) { var options = autocomplete.options; if (options.isComposing) { return false; } var term = autocomplete.extractLastTerm(event.target.value); if (term.length > 0 && options.firstCharacterBlacklist.indexOf(term[0]) !== -1) { return false; } return term.length >= options.minLength; } function sourceData(request, response) { var elementId = this.element.attr('id'); if (!(elementId in autocomplete.cache)) { autocomplete.cache[elementId] = {}; } function showSuggestions(suggestions) { var tagged = autocomplete.splitValues(request.term); var il = tagged.length; for (var i = 0; i < il; i++) { var index = suggestions.indexOf(tagged[i]); if (index >= 0) { suggestions.splice(index, 1); } } response(suggestions); } var term = autocomplete.extractLastTerm(request.term); function sourceCallbackHandler(data) { autocomplete.cache[elementId][term] = data; showSuggestions(data); } if (autocomplete.cache[elementId].hasOwnProperty(term)) { showSuggestions(autocomplete.cache[elementId][term]); } else { var options = $.extend({ success: sourceCallbackHandler, data: { q: term } }, autocomplete.ajax); $.ajax(this.element.attr('data-autocomplete-path'), options); } } function focusHandler() { return false; } function selectHandler(event, ui) { var terms = autocomplete.splitValues(event.target.value); terms.pop(); terms.push(ui.item.value); event.target.value = terms.join(', '); return false; } function renderItem(ul, item) { return $('