function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}AUI.add("liferay-autocomplete-input",(e=>{const t=e.Array,r=e.Lang,i=/trigger/g,s="phraseMatch",n="trigger",o="visible",a={activateFirstItem:!0,resultFilters:s,resultHighlighter:s},g=function AutoCompleteInputBase(){};g.ATTRS={caretAtTerm:{validator:r.isBoolean,value:!0},inputNode:{setter:e.one,writeOnce:!0},offset:{validator:"_validateOffset",value:10},regExp:{validator:e=>r.isRegExp(e)||r.isString(e),value:"(?:\\strigger|^trigger)(\\w[\\s\\w]*)"},source:{},tplReplace:{validator:r.isString},tplResults:{validator:r.isString},trigger:{setter:t,value:"@"}},g.prototype={_acResultFormatter(e,t){const i=this.get("tplResults");return t.map((e=>r.sub(i,e.raw)))},_adjustACPosition(){const e=this,t=e._getACPositionBase(),i=e._getCaretOffset(),s=e.get("offset");let n=0,o=0;Array.isArray(s)?(n=s[0],o=s[1]):r.isNumber(s)&&(o=s);const a=e._getACPositionOffset();t[0]+=i.x+n+a[0],t[1]+=i.y+o+a[1],e.get("boundingBox").setXY(t)},_afterACVisibleChange(e){const t=this;e.newVal&&t._adjustACPosition(),t._uiSetVisible(e.newVal)},_bindUIACIBase(){const e=this;e.on("query",e._onACQuery,e),e.after("visibleChange",e._afterACVisibleChange,e)},_defSelectFn(e){const t=this,i=t.get("tplReplace");let s=e.result.text;const n=document.getElementById("_com_liferay_mentions_web_portlet_MentionsPortlet_mentionsResult");i&&(s=r.sub(i,e.result.raw)),n.style.display="none",t._inputNode.focus(),t._updateValue(s),t._ariaSay("item_selected",{item:e.result.text}),t.hide()},_getRegExp(){const e=this;let t=e.get("regExp");if(r.isString(t)){const r="["+e._getTriggers().join("|")+"]";t=new RegExp(t.replace(i,r))}return t},_getTriggers(){const e=this;if(!e._triggers){const t=[];e.get(n).forEach((e=>{t.push(r.isString(e)?e:e.term)})),e._triggers=t}return e._triggers},_keyDown(){const e=this;e.get(o)&&e._activateNextItem()},_onACQuery(e){const t=this,r=t._getQuery(e.query);r?(t._setTriggerConfig(r[0]),e.query=r.substring(1)):(e.preventDefault(),t.get(o)&&t.hide())},_processKeyUp(e){const t=this;e?(t._setTriggerConfig(e[0]),e=e.substring(1),t.sendRequest(e)):t.get(o)&&t.hide()},_setTriggerConfig(e){const t=this;if(e!==t._trigger){const r=t._getTriggers(),i=t.get(n)[r.indexOf(e)];t.setAttrs(_objectSpread(_objectSpread({},t._triggerConfigDefaults),i)),t._trigger=e}},_syncUIPosAlign:r.emptyFn,_validateOffset:e=>Array.isArray(e)||r.isNumber(e),destructor(){new e.EventHandle(this._eventHandles).detach()},initializer(){const t=this;t.get("boundingBox").addClass("lfr-autocomplete-input-list"),t.set("resultFormatter",e.bind("_acResultFormatter",t)),t._bindUIACIBase();const r=Object.keys(e.AutoComplete.ATTRS).filter((e=>"value"!==e));t._triggerConfigDefaults=a,Object.assign({},t._triggerConfigDefaults,t.getAttrs(),!1,r)}},Liferay.AutoCompleteInputBase=g}),"",{requires:["aui-base","autocomplete","autocomplete-filters","autocomplete-highlighters"]});
//# sourceMappingURL=autocomplete_input.js.map