public/be-assets/node_modules/@yaireo/tagify/dist/tagify.esm.js
/**
   * shows the suggestions select box
   * @param {String} value [optional, filter the whitelist by this value]
   */
shows the suggestions select box
@param {String} value [optional, filter the whitelist by this value]
shows the suggestions select box @param { String } value [ optional filter the whitelist by this value ]
show(value) {
    var _s = this.settings,
        firstListItem,
        firstListItemValue,
        allowNewTags = _s.mode == 'mix' && !_s.enforceWhitelist,
        noWhitelist = !_s.whitelist || !_s.whitelist.length,
        noMatchListItem,
        isManual = _s.dropdown.position == 'manual'; 
    value = value === undefined ? this.state.inputText : value; 
    if (noWhitelist && !allowNewTags && !_s.templates.dropdownItemNoMatch || _s.dropdown.enable === false || this.state.isLoading) return;
    clearTimeout(this.dropdownHide__bindEventsTimeout); 
    this.suggestedListItems = this.dropdown.filterListItems(value); 
    if (value && !this.suggestedListItems.length) {
      this.trigger('dropdown:noMatch', value);
      if (_s.templates.dropdownItemNoMatch) noMatchListItem = _s.templates.dropdownItemNoMatch.call(this, {
        value
      });
    } 
    if (!noMatchListItem) {
       in mix-mode, if the value isn't included in the whilelist & "enforceWhitelist" setting is "false",
       then add a custom suggestion item to the dropdown
      if (this.suggestedListItems.length) {
        if (value && allowNewTags && !this.state.editing.scope && !sameStr(this.suggestedListItems[0].value, value)) this.suggestedListItems.unshift({
          value
        });
      } else {
        if (value && allowNewTags && !this.state.editing.scope) {
          this.suggestedListItems = [{
            value
          }];
        }  hide suggestions list if no suggestion matched
        else {
          this.input.autocomplete.suggest.call(this);
          this.dropdown.hide();
          return;
        }
      }
      firstListItem = this.suggestedListItems[0];
      firstListItemValue = "" + (isObject(firstListItem) ? firstListItem.value : firstListItem);
      if (_s.autoComplete && firstListItemValue) {
         only fill the sugegstion if the value of the first list item STARTS with the input value (regardless of "fuzzysearch" setting)
        if (firstListItemValue.indexOf(value) == 0) this.input.autocomplete.suggest.call(this, firstListItem);
      }
    }
    this.dropdown.fill(noMatchListItem);
    if (_s.dropdown.highlightFirst) this.dropdown.highlightOption(this.DOM.dropdown.content.children[0]);  bind events, exactly at this stage of the code. "dropdown.show" method is allowed to be
     called multiple times, regardless if the dropdown is currently visible, but the events-binding
     should only be called if the dropdown wasn't previously visible.
    if (!this.state.dropdown.visible)  timeout is needed for when pressing arrow down to show the dropdown,
       so the key event won't get registered in the dropdown events listeners
      setTimeout(this.dropdown.events.binding.bind(this));  set the dropdown visible state to be the same as the searched value.
     MUST be set *before* position() is called
    this.state.dropdown.visible = value || true;
    this.state.dropdown.query = value;
    this.setStateSelection();  try to positioning the dropdown (it might not yet be on the page, doesn't matter, next code handles this)
    if (!isManual) {
       a slight delay is needed if the dropdown "position" setting is "text", and nothing was typed in the input,
       so sadly the "getCaretGlobalPosition" method doesn't recognize the caret position without this delay
      setTimeout(() => {
        this.dropdown.position();
        this.dropdown.render();
      });
    }  a delay is needed because of the previous delay reason.
     this event must be fired after the dropdown was rendered & positioned
    setTimeout(() => {
      this.trigger("dropdown:show", this.DOM.dropdown);
    });
  }
show ( value ) { var _s = this . settings , firstListItem , firstListItemValue , allowNewTags = _s . mode == 'mix' && ! _s . enforceWhitelist , noWhitelist = ! _s . whitelist || ! _s . whitelist . length , noMatchListItem , isManual = _s . dropdown . position == 'manual' ; value = value === undefined ? this . state . inputText : value ; if ( noWhitelist && ! allowNewTags && ! _s . templates . dropdownItemNoMatch || _s . dropdown . enable === false || this . state . isLoading ) return ; clearTimeout ( this . dropdownHide__bindEventsTimeout ) ; this . suggestedListItems = this . dropdown . filterListItems ( value ) ; if ( value && ! this . suggestedListItems . length ) { this . trigger ( 'dropdown:noMatch' , value ) ; if ( _s . templates . dropdownItemNoMatch ) noMatchListItem = _s . templates . dropdownItemNoMatch . call ( this , { value } ) ; } if ( ! noMatchListItem ) { if ( this . suggestedListItems . length ) { if ( value && allowNewTags && ! this . state . editing . scope && ! sameStr ( this . suggestedListItems [ 0 ] . value , value ) ) this . suggestedListItems . unshift ( { value } ) ; } else { if ( value && allowNewTags && ! this . state . editing . scope ) { this . suggestedListItems = [ { value } ] ; } else { this . input . autocomplete . suggest . call ( this ) ; this . dropdown . hide ( ) ; return ; } } firstListItem = this . suggestedListItems [ 0 ] ; firstListItemValue = "" + ( isObject ( firstListItem ) ? firstListItem . value : firstListItem ) ; if ( _s . autoComplete && firstListItemValue ) { if ( firstListItemValue . indexOf ( value ) == 0 ) this . input . autocomplete . suggest . call ( this , firstListItem ) ; } } this . dropdown . fill ( noMatchListItem ) ; if ( _s . dropdown . highlightFirst ) this . dropdown . highlightOption ( this . DOM . dropdown . content . children [ 0 ] ) ; if ( ! this . state . dropdown . visible ) setTimeout ( this . dropdown . events . binding . bind ( this ) ) ; this . state . dropdown . visible = value || true ; this . state . dropdown . query = value ; this . setStateSelection ( ) ; if ( ! isManual ) { setTimeout ( ( ) => { this . dropdown . position ( ) ; this . dropdown . render ( ) ; } ) ; } setTimeout ( ( ) => { this . trigger ( "dropdown:show" , this . DOM . dropdown ) ; } ) ; }
shows the suggestions select box
 @param {String} value [optional, filter the whitelist by this value]
shows the suggestions select box @param { String } value [ optional filter the whitelist by this value ]
// if text still exists in the input, and `show` method has no argument, then the input's text should be used // ⚠️ Do not render suggestions list  if: // 1. there's no whitelist (can happen while async loading) AND new tags arn't allowed // 2. dropdown is disabled // 3. loader is showing (controlled outside of this code) // if no value was supplied, show all the "whitelist" items in the dropdown // @type [Array] listItems // TODO: add a Setting to control items' sort order for "listItems" // trigger at this exact point to let the developer the chance to manually set "this.suggestedListItems" // if "dropdownItemNoMatch" was no defined, procceed regular flow. // // in mix-mode, if the value isn't included in the whilelist & "enforceWhitelist" setting is "false", // then add a custom suggestion item to the dropdown // hide suggestions list if no suggestion matched // only fill the sugegstion if the value of the first list item STARTS with the input value (regardless of "fuzzysearch" setting) // bind events, exactly at this stage of the code. "dropdown.show" method is allowed to be // called multiple times, regardless if the dropdown is currently visible, but the events-binding // should only be called if the dropdown wasn't previously visible. // timeout is needed for when pressing arrow down to show the dropdown, // so the key event won't get registered in the dropdown events listeners // set the dropdown visible state to be the same as the searched value. // MUST be set *before* position() is called // try to positioning the dropdown (it might not yet be on the page, doesn't matter, next code handles this) // a slight delay is needed if the dropdown "position" setting is "text", and nothing was typed in the input, // so sadly the "getCaretGlobalPosition" method doesn't recognize the caret position without this delay // a delay is needed because of the previous delay reason. // this event must be fired after the dropdown was rendered & positioned