public/be-assets/node_modules/@yaireo/tagify/dist/tagify.esm.js
/**
   * returns an HTML string of the suggestions' list items
   * @param {String} value string to filter the whitelist by
   * @param {Object} options "exact" - for exact complete match
   * @return {Array} list of filtered whitelist items according to the settings provided and current value
   */
returns an HTML string of the suggestions' list items
@param {String} value string to filter the whitelist by
@param {Object} options "exact" - for exact complete match
@return {Array} list of filtered whitelist items according to the settings provided and current value
returns an HTML string of the suggestions ' list items @param { String } value string to filter the whitelist by @param { Object } options " exact " - for exact complete match @return { Array } list of filtered whitelist items according to the settings provided and current value
filterListItems(value, options) {
    var _s = this.settings,
        _sd = _s.dropdown,
        options = options || {},
        value = _s.mode == 'select' && this.value.length && this.value[0][_s.tagTextProp] == value ? '' 
    : value,
        list = [],
        exactMatchesList = [],
        whitelist = _s.whitelist,
        suggestionsCount = _sd.maxItems || Infinity,
        searchKeys = _sd.searchKeys,
        whitelistItem,
        valueIsInWhitelist,
        searchBy,
        isDuplicate,
        niddle,
        i = 0;
    if (!value || !searchKeys.length) {
      return (_s.duplicates ? whitelist : whitelist.filter(item => !this.isTagDuplicate(isObject(item) ? item.value : item)) 
      ).slice(0, suggestionsCount); 
    }
    niddle = _sd.caseSensitive ? "" + value : ("" + value).toLowerCase(); 
    function stringHasAll(s, query) {
      return query.toLowerCase().split(' ').every(q => s.includes(q.toLowerCase()));
    }
    for (; i < whitelist.length; i++) {
      let startsWithMatch, exactMatch;
      whitelistItem = whitelist[i] instanceof Object ? whitelist[i] : {
        value: whitelist[i]
      }; 
      let itemWithoutSearchKeys = !Object.keys(whitelistItem).some(k => searchKeys.includes(k)),
          _searchKeys = itemWithoutSearchKeys ? ["value"] : searchKeys;
      if (_sd.fuzzySearch && !options.exact) {
        searchBy = _searchKeys.reduce((values, k) => values + " " + (whitelistItem[k] || ""), "").toLowerCase().trim();
        if (_sd.accentedSearch) {
          searchBy = unaccent(searchBy);
          niddle = unaccent(niddle);
        }
        startsWithMatch = searchBy.indexOf(niddle) == 0;
        exactMatch = searchBy === niddle;
        valueIsInWhitelist = stringHasAll(searchBy, niddle);
      } else {
        startsWithMatch = true;
        valueIsInWhitelist = _searchKeys.some(k => {
          var v = '' + (whitelistItem[k] || ''); 
          if (_sd.accentedSearch) {
            v = unaccent(v);
            niddle = unaccent(niddle);
          }
          if (!_sd.caseSensitive) v = v.toLowerCase();
          exactMatch = v === niddle;
          return options.exact ? v === niddle : v.indexOf(niddle) == 0;
        });
      }
      isDuplicate = !_s.duplicates && this.isTagDuplicate(isObject(whitelistItem) ? whitelistItem.value : whitelistItem); 
      if (valueIsInWhitelist && !isDuplicate) if (exactMatch && startsWithMatch) exactMatchesList.push(whitelistItem);else if (_sd.sortby == 'startsWith' && startsWithMatch) list.unshift(whitelistItem);else list.push(whitelistItem);
    } 
    return typeof _sd.sortby == 'function' ? _sd.sortby(exactMatchesList.concat(list), niddle) : exactMatchesList.concat(list).slice(0, suggestionsCount);
  }
filterListItems ( value , options ) { var _s = this . settings , _sd = _s . dropdown , options = options || { } , value = _s . mode == 'select' && this . value . length && this . value [ 0 ] [ _s . tagTextProp ] == value ? '' : value , list = [ ] , exactMatchesList = [ ] , whitelist = _s . whitelist , suggestionsCount = _sd . maxItems || Infinity , searchKeys = _sd . searchKeys , whitelistItem , valueIsInWhitelist , searchBy , isDuplicate , niddle , i = 0 ; if ( ! value || ! searchKeys . length ) { return ( _s . duplicates ? whitelist : whitelist . filter ( item => ! this . isTagDuplicate ( isObject ( item ) ? item . value : item ) ) ) . slice ( 0 , suggestionsCount ) ; } niddle = _sd . caseSensitive ? "" + value : ( "" + value ) . toLowerCase ( ) ; function stringHasAll ( s , query ) { return query . toLowerCase ( ) . split ( ' ' ) . every ( q => s . includes ( q . toLowerCase ( ) ) ) ; } for ( ; i < whitelist . length ; i ++ ) { let startsWithMatch , exactMatch ; whitelistItem = whitelist [ i ] instanceof Object ? whitelist [ i ] : { value : whitelist [ i ] } ; let itemWithoutSearchKeys = ! Object . keys ( whitelistItem ) . some ( k => searchKeys . includes ( k ) ) , _searchKeys = itemWithoutSearchKeys ? [ "value" ] : searchKeys ; if ( _sd . fuzzySearch && ! options . exact ) { searchBy = _searchKeys . reduce ( ( values , k ) => values + " " + ( whitelistItem [ k ] || "" ) , "" ) . toLowerCase ( ) . trim ( ) ; if ( _sd . accentedSearch ) { searchBy = unaccent ( searchBy ) ; niddle = unaccent ( niddle ) ; } startsWithMatch = searchBy . indexOf ( niddle ) == 0 ; exactMatch = searchBy === niddle ; valueIsInWhitelist = stringHasAll ( searchBy , niddle ) ; } else { startsWithMatch = true ; valueIsInWhitelist = _searchKeys . some ( k => { var v = '' + ( whitelistItem [ k ] || '' ) ; if ( _sd . accentedSearch ) { v = unaccent ( v ) ; niddle = unaccent ( niddle ) ; } if ( ! _sd . caseSensitive ) v = v . toLowerCase ( ) ; exactMatch = v === niddle ; return options . exact ? v === niddle : v . indexOf ( niddle ) == 0 ; } ) ; } isDuplicate = ! _s . duplicates && this . isTagDuplicate ( isObject ( whitelistItem ) ? whitelistItem . value : whitelistItem ) ; if ( valueIsInWhitelist && ! isDuplicate ) if ( exactMatch && startsWithMatch ) exactMatchesList . push ( whitelistItem ) ; else if ( _sd . sortby == 'startsWith' && startsWithMatch ) list . unshift ( whitelistItem ) ; else list . push ( whitelistItem ) ; } return typeof _sd . sortby == 'function' ? _sd . sortby ( exactMatchesList . concat ( list ) , niddle ) : exactMatchesList . concat ( list ) . slice ( 0 , suggestionsCount ) ; }
returns an HTML string of the suggestions' list items
 @param {String} value string to filter the whitelist by
 @param {Object} options "exact" - for exact complete match
 @return {Array} list of filtered whitelist items according to the settings provided and current value
returns an HTML string of the suggestions ' list items @param { String } value string to filter the whitelist by @param { Object } options " exact " - for exact complete match @return { Array } list of filtered whitelist items according to the settings provided and current value
// do not filter if the tag, which is already selecetd in "select" mode, is the same as the typed text // don't include tags which have already been added. // respect "maxItems" dropdown setting // checks if ALL of the words in the search query exists in the current whitelist item, regardless of their order //normalize value as an Object // if key exists, cast to type String // match for the value within each "whitelist" item // custom sorting function