!function(t,e){"function"==typeofdefine&&define.amd?define(["jquery"],function(t){returne(t)}):"object"==typeofexports?module.exports=e(require("jquery")):e(jQuery)}(this,function(t){vare,i;i={ESC:27,TAB:9,ENTER:13,CTRL:17,A:65,P:80,N:78,LEFT:37,UP:38,RIGHT:39,DOWN:40,BACKSPACE:8,SPACE:32},e={beforeSave:function(t){returnr.arrayToDefaultHash(t)},matcher:function(t,e,i,n){varr,o,s,a,h;returnt=t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),i&&(t="(?:^|\\s)"+t),r=decodeURI("%C3%80"),o=decodeURI("%C3%BF"),h=n?" ":"",a=newRegExp(t+"([A-Za-z"+r+"-"+o+"0-9_"+h+"'.+-]*)$|"+t+"([^\\x00-\\xff]*)$","gi"),s=a.exec(e),s?s[2]||s[1]:null},filter:function(t,e,i){varn,r,o,s;for(n=[],r=0,s=e.length;r<s;r++)o=e[r],~newString(o[i]).toLowerCase().indexOf(t.toLowerCase())&&n.push(o);returnn},remoteFilter:null,sorter:function(t,e,i){varn,r,o,s;if(!t)returne;for(n=[],r=0,s=e.length;r<s;r++)o=e[r],o.atwho_order=newString(o[i]).toLowerCase().indexOf(t.toLowerCase()),o.atwho_order>-1&&n.push(o);returnn.sort(function(t,e){returnt.atwho_order-e.atwho_order})},tplEval:function(t,e){vari,n;n=t;try{return"string"!=typeoft&&(n=t(e)),n.replace(/\$\{([^\}]*)\}/g,function(t,i,n){returne[i]})}catch(r){returni=r,""}},highlighter:function(t,e){vari;returne?(i=newRegExp(">\\s*([^<]*?)("+e.replace("+","\\+")+")([^<]*)\\s*<","ig"),t.replace(i,function(t,e,i,n){return"> "+e+"<strong>"+i+"</strong>"+n+" <"})):t},beforeInsert:function(t,e,i){returnt},beforeReposition:function(t){returnt},afterMatchFailed:function(t,e){}};varn;n=function(){functione(e){this.currentFlag=null,this.controllers={},this.aliasMaps={},this.$inputor=t(e),this.setupRootElement(),this.listen()}returne.prototype.createContainer=function(e){vari;returnnull!=(i=this.$el)&&i.remove(),t(e.body).append(this.$el=t("<div class='atwho-container'></div>"))},e.prototype.setupRootElement=function(e,i){varn;if(null==i&&(i=!1),e)this.window=e.contentWindow,this.document=e.contentDocument||this.window.document,this.iframe=e;else{this.document=this.$inputor[0].ownerDocument,this.window=this.document.defaultView||this.document.parentWindow;try{this.iframe=this.window.frameElement}catch(r){if(n=r,this.iframe=null,t.fn.atwho.debug)thrownewError("iframe auto-discovery is failed.\nPlease use `setIframe` to set the target iframe manually.\n"+n)}}returnthis.createContainer((this.iframeAsRoot=i)?this.document:document)},e.prototype.controller=function(t){vare,i,n,r;if(this.aliasMaps[t])i=this.controllers[this.aliasMaps[t]];else{r=this.controllers;for(ninr)if(e=r[n],n===t){i=e;break}}returni?i:this.controllers[this.currentFlag]},e.prototype.setContextFor=function(t){returnthis.currentFlag=t,this},e.prototype.reg=function(t,e){vari,n;returnn=(i=this.controllers)[t]||(i[t]=this.$inputor.is("[contentEditable]")?newl(this,t):news(this,t)),e.alias&&(this.aliasMaps[e.alias]=t),n.init(e),this},e.prototype.listen=function(){returnthis.$inputor.on("compositionstart",function(t){returnfunction(e){vari;returnnull!=(i=t.controller())&&i.view.hide(),t.isComposing=!0,null}}(this)).on("compositionend",function(t){returnfunction(e){returnt.isComposing=!1,setTimeout(function(e){returnt.dispatch(e)}),null}}(this)).on("keyup.atwhoInner",function(t){returnfunction(e){returnt.onKeyup(e)}}(this)).on("keydown.atwhoInner",function(t){returnfunction(e){returnt.onKeydown(e)}}(this)).on("blur.atwhoInner",function(t){returnfunction(e){vari;if(i=t.controller())returni.expectedQueryCBId=null,i.view.hide(e,i.getOpt("displayTimeout"))}}(this)).on("click.atwhoInner",function(t){returnfunction(e){returnt.dispatch(e)}}(this)).on("scroll.atwhoInner",function(t){returnfunction(){vare;returne=t.$inputor.scrollTop(),function(i){varn,r;returnn=i.target.scrollTop,e!==n&&null!=(r=t.controller())&&r.view.hide(i),e=n,!0}}}(this)())},e.prototype.shutdown=function(){vart,e,i;i=this.controllers;for(tini)e=i[t],e.destroy(),deletethis.controllers[t];returnthis.$inputor.off(".atwhoInner"),this.$el.remove()},e.prototype.dispatch=function(t){vare,i,n,r;n=this.controllers,r=[];for(einn)i=