public/be-assets/node_modules/@yaireo/tagify/dist/tagify.esm.js
/**
   * Create a tag from the currently active suggestion option
   * @param {Object} elm  DOM node to select
   */
Create a tag from the currently active suggestion option
@param {Object} elm  DOM node to select
Create a tag from the currently active suggestion option @param { Object } elm DOM node to select
selectOption(elm) {
    var _this$settings$dropdo = this.settings.dropdown,
        clearOnSelect = _this$settings$dropdo.clearOnSelect,
        closeOnSelect = _this$settings$dropdo.closeOnSelect,
        addedTag;
    if (!elm) {
      addedTag = this.addTags(this.state.inputText, true);
      closeOnSelect && this.dropdown.hide();
      return;
    } 
    var tagifySuggestionIdx = elm.getAttribute('tagifySuggestionIdx'),
        tagData = this.suggestedListItems[+tagifySuggestionIdx];
    this.trigger("dropdown:select", {
      data: tagData,
      elm
    }); 
    if (!tagifySuggestionIdx || !tagData) {
      this.dropdown.hide();
      return;
    }
    if (this.state.editing) 
      this.onEditTagDone(null, extend({
        __isValid: true
      }, this.normalizeTags(tagData)[0])); 
    else {
      addedTag = this[this.settings.mode == 'mix' ? "addMixTags" : "addTags"]([tagData], clearOnSelect);
    } 
    if (!this.DOM.input.parentNode) return;
    setTimeout(() => {
      this.DOM.input.focus();
      this.toggleFocusClass(true);
      this.placeCaretAfterNode(addedTag);
    });
    if (closeOnSelect) {
      setTimeout(this.dropdown.hide.bind(this));
    } else this.dropdown.refilter();
  }
selectOption ( elm ) { var _this$settings$dropdo = this . settings . dropdown , clearOnSelect = _this$settings$dropdo . clearOnSelect , closeOnSelect = _this$settings$dropdo . closeOnSelect , addedTag ; if ( ! elm ) { addedTag = this . addTags ( this . state . inputText , true ) ; closeOnSelect && this . dropdown . hide ( ) ; return ; } var tagifySuggestionIdx = elm . getAttribute ( 'tagifySuggestionIdx' ) , tagData = this . suggestedListItems [ + tagifySuggestionIdx ] ; this . trigger ( "dropdown:select" , { data : tagData , elm } ) ; if ( ! tagifySuggestionIdx || ! tagData ) { this . dropdown . hide ( ) ; return ; } if ( this . state . editing ) this . onEditTagDone ( null , extend ( { __isValid : true } , this . normalizeTags ( tagData ) [ 0 ] ) ) ; else { addedTag = this [ this . settings . mode == 'mix' ? "addMixTags" : "addTags" ] ( [ tagData ] , clearOnSelect ) ; } if ( ! this . DOM . input . parentNode ) return ; setTimeout ( ( ) => { this . DOM . input . focus ( ) ; this . toggleFocusClass ( true ) ; this . placeCaretAfterNode ( addedTag ) ; } ) ; if ( closeOnSelect ) { setTimeout ( this . dropdown . hide . bind ( this ) ) ; } else this . dropdown . refilter ( ) ; }
Create a tag from the currently active suggestion option
 @param {Object} elm  DOM node to select
Create a tag from the currently active suggestion option @param { Object } elm DOM node to select
// if in edit-mode, do not continue but instead replace the tag's text. // the scenario is that "addTags" was called from a dropdown suggested option selected while editing // The above event must be triggered, regardless of anything else which might go wrong // normalizing value, because "tagData" might be a string, and therefore will not be able to extend the object // Tagify instances should re-focus to the input element once an option was selected, to allow continuous typing // todo: consider not doing this on mix-mode