!function(n,t){"function"==typeof define&&define.amd?define("typeahead.js",["jquery"],function(n){return t(n)}):"object"==typeof exports?module.exports=t(require("jquery")):t(jQuery)}(this,function(n){var t=function(){"use strict";return{isMsie:function(){return/(msie|trident)/i.test(navigator.userAgent)?navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2]:!1},isBlankString:function(n){return!n||/^\s*$/.test(n)},escapeRegExChars:function(n){return n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},isString:function(n){return"string"==typeof n},isNumber:function(n){return"number"==typeof n},isArray:n.isArray,isFunction:n.isFunction,isObject:n.isPlainObject,isUndefined:function(n){return"undefined"==typeof n},isElement:function(n){return!(!n||1!==n.nodeType)},isJQuery:function(t){return t instanceof n},toStr:function(n){return t.isUndefined(n)||null===n?"":n+""},bind:n.proxy,each:function(t,i){function r(n,t){return i(t,n)}n.each(t,r)},map:n.map,filter:n.grep,every:function(t,i){var r=!0;return t?(n.each(t,function(n,u){if(!(r=i.call(null,u,n,t)))return!1}),!!r):r},some:function(t,i){var r=!1;return t?(n.each(t,function(n,u){if((r=i.call(null,u,n,t)))return!1}),!!r):r},mixin:n.extend,identity:function(n){return n},clone:function(t){return n.extend(!0,{},t)},getIdGenerator:function(){var n=0;return function(){return n++}},templatify:function(t){function i(){return String(t)}return n.isFunction(t)?t:i},defer:function(n){setTimeout(n,0)},debounce:function(n,t,i){var r,u;return function(){var f,e,o=this,s=arguments;return f=function(){r=null;i||(u=n.apply(o,s))},e=i&&!r,clearTimeout(r),r=setTimeout(f,t),e&&(u=n.apply(o,s)),u}},throttle:function(n,t){var u,f,i,e,r,o;return r=0,o=function(){r=new Date;i=null;e=n.apply(u,f)},function(){var s=new Date,h=t-(s-r);return u=this,f=arguments,0>=h?(clearTimeout(i),i=null,r=s,e=n.apply(u,f)):i||(i=setTimeout(o,h)),e}},stringify:function(n){return t.isString(n)?n:JSON.stringify(n)},noop:function(){}}}(),e=function(){"use strict";function n(n){var e,o;return o=t.mixin({},f,n),e={css:u(),classes:o,html:i(o),selectors:r(o)},{css:e.css,html:e.html,classes:e.classes,selectors:e.selectors,mixin:function(n){t.mixin(n,e)}}}function i(n){return{wrapper:'<\/span>',menu:'
<\/div>'}}function r(n){var i={};return t.each(n,function(n,t){i[t]="."+n}),i}function u(){var n={wrapper:{position:"relative",display:"inline-block"},hint:{position:"absolute",top:"0",left:"0",borderColor:"transparent",boxShadow:"none",opacity:"1"},input:{position:"relative",verticalAlign:"top",backgroundColor:"transparent"},inputWithNoHint:{position:"relative",verticalAlign:"top"},menu:{position:"absolute",top:"100%",left:"0",zIndex:"100",display:"none"},ltr:{left:"0",right:"auto"},rtl:{left:"auto",right:" 0"}};return t.isMsie()&&t.mixin(n.input,{backgroundImage:"url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)"}),n}var f={wrapper:"twitter-typeahead",input:"tt-input",hint:"tt-hint",menu:"tt-menu",dataset:"tt-dataset",suggestion:"tt-suggestion",selectable:"tt-selectable",empty:"tt-empty",open:"tt-open",cursor:"tt-cursor",highlight:"tt-highlight"};return n}(),o=function(){"use strict";function i(t){t&&t.el||n.error("EventBus initialized without el");this.$el=n(t.el)}var r,u;return r="typeahead:",u={render:"rendered",cursorchange:"cursorchanged",select:"selected",autocomplete:"autocompleted"},t.mixin(i.prototype,{_trigger:function(t,i){var u;return u=n.Event(r+t),(i=i||[]).unshift(u),this.$el.trigger.apply(this.$el,i),u},before:function(n){var t,i;return t=[].slice.call(arguments,1),i=this._trigger("before"+n,t),i.isDefaultPrevented()},trigger:function(n){var t;this._trigger(n,[].slice.call(arguments,1));(t=u[n])&&this._trigger(t,[].slice.call(arguments,1))}}),i}(),r=function(){"use strict";function t(t,i,r,u){var f;if(!r)return this;for(i=i.split(n),r=u?s(r,u):r,this._callbacks=this._callbacks||{};f=i.shift();)this._callbacks[f]=this._callbacks[f]||{sync:[],async:[]},this._callbacks[f][t].push(r);return this}function r(n,i,r){return t.call(this,"async",n,i,r)}function u(n,i,r){return t.call(this,"sync",n,i,r)}function f(t){var i;if(!this._callbacks)return this;for(t=t.split(n);i=t.shift();)delete this._callbacks[i];return this}function e(t){var r,u,f,e,o;if(!this._callbacks)return this;for(t=t.split(n),f=[].slice.call(arguments,1);(r=t.shift())&&(u=this._callbacks[r]);)e=i(u.sync,this,[r].concat(f)),o=i(u.async,this,[r].concat(f)),e()&&h(o);return this}function i(n,t,i){function r(){for(var r,u=0,f=n.length;!r&&f>u;u+=1)r=n[u].apply(t,i)===!1;return!r}return r}function o(){return window.setImmediate?function(n){setImmediate(function(){n()})}:function(n){setTimeout(function(){n()},0)}}function s(n,t){return n.bind?n.bind(t):function(){n.apply(t,[].slice.call(arguments,0))}}var n=/\s+/,h=o();return{onSync:u,onAsync:r,off:f,trigger:e}}(),s=function(n){"use strict";function i(n,i,r){for(var u,f=[],e=0,o=n.length;o>e;e++)f.push(t.escapeRegExChars(n[e]));return u=r?"\\b("+f.join("|")+")\\b":"("+f.join("|")+")",i?new RegExp(u):new RegExp(u,"i")}var r={node:null,pattern:null,tagName:"strong",className:null,wordsOnly:!1,caseSensitive:!1};return function(u){function o(t){var i,r,f;return(i=e.exec(t.data))&&(f=n.createElement(u.tagName),u.className&&(f.className=u.className),r=t.splitText(i.index),r.splitText(i[0].length),f.appendChild(r.cloneNode(!0)),t.parentNode.replaceChild(f,r)),!!i}function f(n,t){for(var i,r=0;r