From 8a2550e7d5cd19e25616087052915e1c9978e0ad Mon Sep 17 00:00:00 2001 From: Eldon Koyle Date: Tue, 5 Jan 2016 17:35:26 -0700 Subject: [PATCH] Squashed 'lib/typeahead/' changes from 588440f..3d2a7eb 3d2a7eb Merge pull request #28 from sheeley/feature/select-on-hover 2d5d521 Set cursor on hover. d60aed0 Merge pull request #27 from sheeley/feature/complete-current-selection 5e351d1 Merge pull request #41 from Pheil/patch-1 53400c3 Fixed 404 links 5c49ed8 Complete to currently selected suggestion. 6da45f5 Merge pull request #37 from jorrit/patch-1 eab11e6 Fix typos in comments in plugin.js 3d929c8 Add stuff that has been changed or added by now 79a991b Reformat changelog b46224c Merge pull request #25 from jesperronn/node_version f241826 update travis to run latest supported node version 5d69578 Merge pull request #19 from jesperronn/npm_package_updates d78ad00 lock jasmine-query to old version 1.7.0, which has guaranteed support for jquery 1. 0cb71e9 updating npm packages dependencies e7dfc42 Change capitalization 14dfe96 Update to new domain name 9c2b65c Merge pull request #22 from jesperronn/cache_node_modules 9e40c85 General overhaul of the readme c665a6b Add some badges b111a6f Remove jQuery package manager has been deprecated b802342 Update NPM and Bower 6c12035 attempt to speed up Travis builds with cache directive e5c0213 Merge pull request #18 from jesperronn/license_for_npm_package 8d448ea Fixed npm error: adding License link e0556c5 Merge pull request #16 from jesperronn/node_static_dependency c1c6ef9 Merge pull request #15 from jesperronn/npm_postinstall 76dbb90 Travis must have bower installed before running "npm install" b170811 node-static webserver installed locally is good enough. eee05f0 added a postinstall step to npm to cater for easy setup 1f0684f Merge pull request #14 from jcrben/patch-1 e232400 bloodhound.get->bloodhound.search c69b990 Merge pull request #10 from thiagof/dist-build a080d81 distribution build 8e1ffc4 Merge pull request #8 from coopy/fix-async-render-corejs a52bd45 Update rendered-count _after_ async results have displayed 6f191d2 Merge pull request #5 from corejavascript/integration-0.11.2 5e62960 Merge pull request #2 from chip-miller/integration-0.11.2 fad5bd1 Merge pull request #4 from corejavascript/integration-0.11.2 9722aeb Adding Option: matchAnyQueryToken (default false) - By default a search result must match ALL query-tokens. Instead, this option returns results that match ANY a36e6a0 gh-pages are now hosted on the .io domain 6e33c92 Merge pull request #1 from corejavascript/update-name 86ddae4 Update name and links 312d481 Merge pull request #1200 from jharding/1185-bad-async-logic e2d9608 Merge pull request #1199 from jharding/1163-val-undefined 173b4b5 Fix bad async suggestions rendering logic c58519e Coerce val to string when set through API b2b588d Merge pull request #1192 from jharding/1102-scroll-top-open 04f1d66 Scroll menu to top on open 4fe2a34 Merge remote-tracking branch 'origin/1148-index-remote' into integration-0.11.2 212fe89 Register as an anonymous AMD module f885f48 Make indexing remote a top-level option 5b70c60 Bloodhound optionally indexes/matches remote data - https://github.com/twitter/typeahead.js/issues/1148 git-subtree-dir: lib/typeahead git-subtree-split: 3d2a7eb548ef2b737f875e8da634466bd62edd5e --- .travis.yml | 21 +- CHANGELOG.md | 249 ------------------ Gruntfile.js | 2 - README.md | 188 ------------- bower.json | 9 +- changelog.md | 171 ++++++++++++ CONTRIBUTING.md => contributing.md | 0 dist/bloodhound.js | 20 +- dist/bloodhound.min.js | 2 +- dist/typeahead.bundle.js | 34 ++- dist/typeahead.bundle.min.js | 4 +- dist/typeahead.jquery.js | 14 +- dist/typeahead.jquery.min.js | 2 +- doc/bloodhound.md | 27 +- LICENSE => license | 0 package.json | 49 ++-- readme.md | 135 ++++++++++ src/bloodhound/bloodhound.js | 9 +- src/bloodhound/options_parser.js | 2 + src/bloodhound/remote.js | 1 + src/bloodhound/search_index.js | 9 +- src/typeahead/dataset.js | 2 +- src/typeahead/menu.js | 2 + src/typeahead/plugin.js | 6 +- src/typeahead/typeahead.js | 4 +- test/bloodhound/bloodhound_spec.js | 51 ++++ test/bloodhound/search_index_spec.js | 9 +- test/ci | 2 +- test/typeahead/dataset_spec.js | 27 ++ .../{results_spec.js => menu_spec.js} | 7 + test/typeahead/plugin_spec.js | 8 + typeahead.js.jquery.json | 40 --- 32 files changed, 547 insertions(+), 559 deletions(-) delete mode 100644 CHANGELOG.md delete mode 100644 README.md create mode 100644 changelog.md rename CONTRIBUTING.md => contributing.md (100%) rename LICENSE => license (100%) create mode 100644 readme.md rename test/typeahead/{results_spec.js => menu_spec.js} (97%) delete mode 100644 typeahead.js.jquery.json diff --git a/.travis.yml b/.travis.yml index 626ffaccf..e66b005bc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: node_js -env: - matrix: +env: + matrix: - TEST_SUITE=unit - TEST_SUITE=integration BROWSER='firefox' - TEST_SUITE=integration BROWSER='firefox:3.5' @@ -13,16 +13,21 @@ env: - TEST_SUITE=integration BROWSER='internet explorer:10' - TEST_SUITE=integration BROWSER='internet explorer:11' - TEST_SUITE=integration BROWSER='chrome' - global: + global: - secure: VY4J2ERfrMEin++f4+UDDtTMWLuE3jaYAVchRxfO2c6PQUYgR+SW4SMekz855U/BuptMtiVMR2UUoNGMgOSKIFkIXpPfHhx47G5a541v0WNjXfQ2qzivXAWaXNK3l3C58z4dKxgPWsFY9JtMVCddJd2vQieAILto8D8G09p7bpo= - secure: kehbNCoYUG2gLnhmCH/oKhlJG6LoxgcOPMCtY7KOI4ropG8qlypb+O2b/19+BWeO3aIuMB0JajNh3p2NL0UKgLmUK7EYBA9fQz+vesFReRk0V/KqMTSxHJuseM4aLOWA2Wr9US843VGltfODVvDN5sNrfY7RcoRx2cTK/k1CXa8= -node_js: -- 0.11.13 -before_script: +node_js: +- "4.1" +cache: + directories: + - node_modules + - bower_components +before_install: - npm install -g grunt-cli@0.1.13 -- npm install -g node-static@0.7.3 - npm install -g bower@1.3.8 -- bower install +install: +- npm install +before_script: - grunt build script: test/ci addons: diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 2e7e7b8b6..000000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,249 +0,0 @@ -Changelog -========= - -For transparency and insight into our release cycle, releases will be numbered -with the follow format: - -`..` - -And constructed with the following guidelines: - -* Breaking backwards compatibility bumps the major -* New additions without breaking backwards compatibility bumps the minor -* Bug fixes and misc changes bump the patch - -For more information on semantic versioning, please visit http://semver.org/. - ---- - -### 0.11.1 April 26, 2015 - -* Add prepare option to prefetch. [#1181] -* Handle QuotaExceededError. [#1110] -* Escape HTML entities from suggestion display value when rendering with default - template. [#964] -* List jquery as a dependency in package.json. [#1143] - -### 0.11.0 April 25, 2015 - -An overhaul of typeahead.js – consider this a release candidate for v1. There -are bunch of API changes with this release so don't expect backwards -compatibility with previous versions. There are also many new undocumented -features that have been introduced. Documentation for those features will be -added before v1 ships. - -Beware that since this release is pretty much a rewrite, there are bound to be -some bugs. To be safe, you should consider this release beta software and -throughly test your integration of it before using it in production -environments. This caveat only applies to this release as subsequent releases -will address any issues that come up. - -### 0.10.5 August 7, 2014 - -* Increase supported version range for jQuery dependency. [#917] - -### 0.10.4 July 13, 2014 - -**Hotfix** - -* Fix regression that breaks Bloodhound instances when more than 1 instance is - relying on remote data. [#899] - -### 0.10.3 July 10, 2014 - -**Bug fixes** - -* `Bloodhound#clearPrefetchCache` now works with cache keys that contain regex - characters. [#771] -* Prevent outdated network requests from being sent. [#809] -* Add support to object tokenizers for multiple property tokenization. [#811] -* Fix broken `jQuery#typeahead('val')` method. [#815] -* Remove `disabled` attribute from the hint input control. [#839] -* Add `tt-highlight` class to highlighted text. [#833] -* Handle non-string types that are passed to `jQuery#typeahead('val', val)`. [#881] - -### 0.10.2 March 10, 2014 - -* Prevent flickering of dropdown menu when requesting remote suggestions. [#718] -* Reduce hint flickering. [#754] -* Added `Bloodhound#{clear, clearPrefetchCache, clearRemoteCache}` and made it - possible to reinitialize Bloodhound instances. [#703] -* Invoke `local` function during initialization. [#687] -* In addition to HTML strings, templates can now return DOM nodes. [#742] -* Prevent `jQuery#typeahead('val', val)` from opening dropdown menus of - non-active typeaheads. [#646] -* Fix bug in IE that resulted in dropdown menus with overflow being closed - when clicking on the scrollbar. [#705] -* Only show dropdown menu if `minLength` is satisfied. [#710] - -### 0.10.1 February 9, 2014 - -**Hotfix** - -* Fixed bug that prevented some ajax configs from being respected. [#630] -* Event delegation on suggestion clicks is no longer broken. [#118] -* Ensure dataset names are valid class name suffixes. [#610] -* Added support for `displayKey` to be a function. [#633] -* `jQuery#typeahead('val')` now mirrors `jQuery#val()`. [#659] -* Datasets can now be passed to jQuery plugin as an array. [#664] -* Added a `noConflict` method to the jQuery plugin. [#612] -* Bloodhound's `local` property can now be a function. [#485] - -### 0.10.0 February 2, 2014 - -**Introducting Bloodhound** - -This release was almost a complete rewrite of typeahead.js and will hopefully -lay the foundation for the 1.0.0 release. It's impossible to enumerate all of -the issues that were fixed. If you want to get an idea of what issues 0.10.0 -resolved, take a look at the closed issues in the [0.10.0 milestone]. - -The most important change in 0.10.0 is that typeahead.js was broken up into 2 -individual components: Bloodhound and jQuery#typeahead. Bloodhound is an -feature-rich suggestion engine. jQuery#typeahead is a jQuery plugin that turns -input controls into typeaheads. - -It's impossible to write a typeahead library that supports every use-case out -of the box – that was the main motivation behind decomposing typeahead.js. -Previously, some prospective typeahead.js users were unable to use the library -because either the suggestion engine or the typeahead UI did not meet their -requirements. In those cases, they were either forced to fork typeahead.js and -make the necessary modifications or they had to give up on using typeahead.js -entirely. Now they have the option of swapping out the component that doesn't -work for them with a custom implementation. - -### 0.9.3 June 24, 2013 - -* Ensure cursor visibility in menus with overflow. [#209] -* Fixed bug that led to the menu staying open when it should have been closed. [#260] -* Private browsing in Safari no longer breaks prefetch. [#270] -* Pressing tab while a suggestion is highlighted now results in a selection. [#266] -* Dataset name is now passed as an argument for typeahead:selected event. [#207] - -### 0.9.2 April 14, 2013 - -* Prefetch usage no longer breaks when cookies are disabled. [#190] -* Precompiled templates are now wrapped in the appropriate DOM element. [#172] - -### 0.9.1 April 1, 2013 - -* Multiple requests no longer get sent for a query when datasets share a remote source. [#152] -* Datasets now support precompiled templates. [#137] -* Cached remote suggestions now get rendered immediately. [#156] -* Added typeahead:autocompleted event. [#132] -* Added a plugin method for programmatically setting the query. Experimental. [#159] -* Added minLength option for datasets. Experimental. [#131] -* Prefetch objects now support thumbprint option. Experimental. [#157] - -### 0.9.0 March 24, 2013 - -**Custom events, no more typeahead.css, and an improved API** - -* Implemented the triggering of custom events. [#106] -* Got rid of typeahead.css and now apply styling through JavaScript. [#15] -* Made the API more flexible and addressed a handful of remote issues by rewriting the transport component. [#25] -* Added support for dataset headers and footers. [#81] -* No longer cache unnamed datasets. [#116] -* Made the key name of the value property configurable. [#115] -* Input values set before initialization of typeaheads are now respected. [#109] -* Fixed an input value/hint casing bug. [#108] - -### 0.8.2 March 04, 2013 - -* Fixed bug causing error to be thrown when initializing a typeahead on multiple elements. [#51] -* Tokens with falsy values are now filtered out – was causing wonky behavior. [#75] -* No longer making remote requests for blank queries. [#74] -* Datums with regex characters in their value no longer cause errors. [#77] -* Now compatible with the Closure Compiler. [#48] -* Reference to jQuery is now obtained through window.jQuery, not window.$. [#47] -* Added a plugin method for destroying typeaheads. Won't be documented until v0.9 and might change before then. [#59] - -### 0.8.1 February 25, 2013 - -* Fixed bug preventing local and prefetch from being used together. [#39] -* No longer prevent default browser behavior when up or down arrow is pressed with a modifier. [#6] -* Hint is hidden when user entered query is wider than the input. [#26] -* Data stored in localStorage now expires properly. [#34] -* Normalized search tokens and fixed query tokenization. [#38] -* Remote suggestions now are appended, not prepended to suggestions list. [#40] -* Fixed some typos through the codebase. [#3] - -### 0.8.0 February 19, 2013 - -**Initial public release** - -* Prefetch and search data locally insanely fast. -* Search hard-coded, prefetched, and/or remote data. -* Hinting. -* RTL/IME/international support. -* Search multiple datasets. -* Share datasets (and caching) between multiple inputs. -* And much, much more... - -[0.10.0 milestone]: https://github.com/twitter/typeahead.js/issues?milestone=8&page=1&state=closed - -[#1181]: https://github.com/twitter/typeahead.js/pull/1181 -[#1143]: https://github.com/twitter/typeahead.js/pull/1143 -[#1110]: https://github.com/twitter/typeahead.js/pull/1110 -[#964]: https://github.com/twitter/typeahead.js/pull/964 -[#917]: https://github.com/twitter/typeahead.js/pull/917 -[#899]: https://github.com/twitter/typeahead.js/pull/899 -[#881]: https://github.com/twitter/typeahead.js/pull/881 -[#839]: https://github.com/twitter/typeahead.js/pull/839 -[#833]: https://github.com/twitter/typeahead.js/pull/833 -[#815]: https://github.com/twitter/typeahead.js/pull/815 -[#811]: https://github.com/twitter/typeahead.js/pull/811 -[#809]: https://github.com/twitter/typeahead.js/pull/809 -[#771]: https://github.com/twitter/typeahead.js/pull/771 -[#754]: https://github.com/twitter/typeahead.js/pull/754 -[#742]: https://github.com/twitter/typeahead.js/pull/742 -[#718]: https://github.com/twitter/typeahead.js/pull/718 -[#710]: https://github.com/twitter/typeahead.js/pull/710 -[#705]: https://github.com/twitter/typeahead.js/pull/705 -[#703]: https://github.com/twitter/typeahead.js/pull/703 -[#687]: https://github.com/twitter/typeahead.js/pull/687 -[#664]: https://github.com/twitter/typeahead.js/pull/664 -[#659]: https://github.com/twitter/typeahead.js/pull/659 -[#646]: https://github.com/twitter/typeahead.js/pull/646 -[#633]: https://github.com/twitter/typeahead.js/pull/633 -[#630]: https://github.com/twitter/typeahead.js/pull/630 -[#612]: https://github.com/twitter/typeahead.js/pull/612 -[#610]: https://github.com/twitter/typeahead.js/pull/610 -[#485]: https://github.com/twitter/typeahead.js/pull/485 -[#270]: https://github.com/twitter/typeahead.js/pull/270 -[#266]: https://github.com/twitter/typeahead.js/pull/266 -[#260]: https://github.com/twitter/typeahead.js/pull/260 -[#209]: https://github.com/twitter/typeahead.js/pull/209 -[#207]: https://github.com/twitter/typeahead.js/pull/207 -[#190]: https://github.com/twitter/typeahead.js/pull/190 -[#172]: https://github.com/twitter/typeahead.js/pull/172 -[#159]: https://github.com/twitter/typeahead.js/pull/159 -[#157]: https://github.com/twitter/typeahead.js/pull/157 -[#156]: https://github.com/twitter/typeahead.js/pull/156 -[#152]: https://github.com/twitter/typeahead.js/pull/152 -[#137]: https://github.com/twitter/typeahead.js/pull/137 -[#132]: https://github.com/twitter/typeahead.js/pull/132 -[#131]: https://github.com/twitter/typeahead.js/pull/131 -[#118]: https://github.com/twitter/typeahead.js/pull/118 -[#116]: https://github.com/twitter/typeahead.js/pull/116 -[#115]: https://github.com/twitter/typeahead.js/pull/115 -[#109]: https://github.com/twitter/typeahead.js/pull/109 -[#108]: https://github.com/twitter/typeahead.js/pull/108 -[#106]: https://github.com/twitter/typeahead.js/pull/106 -[#81]: https://github.com/twitter/typeahead.js/pull/81 -[#77]: https://github.com/twitter/typeahead.js/pull/77 -[#75]: https://github.com/twitter/typeahead.js/pull/75 -[#74]: https://github.com/twitter/typeahead.js/pull/74 -[#59]: https://github.com/twitter/typeahead.js/pull/59 -[#51]: https://github.com/twitter/typeahead.js/pull/51 -[#48]: https://github.com/twitter/typeahead.js/pull/48 -[#47]: https://github.com/twitter/typeahead.js/pull/47 -[#40]: https://github.com/twitter/typeahead.js/pull/40 -[#39]: https://github.com/twitter/typeahead.js/pull/39 -[#38]: https://github.com/twitter/typeahead.js/pull/38 -[#34]: https://github.com/twitter/typeahead.js/pull/34 -[#26]: https://github.com/twitter/typeahead.js/pull/26 -[#25]: https://github.com/twitter/typeahead.js/pull/25 -[#15]: https://github.com/twitter/typeahead.js/pull/15 -[#6]: https://github.com/twitter/typeahead.js/pull/6 -[#3]: https://github.com/twitter/typeahead.js/pull/3 diff --git a/Gruntfile.js b/Gruntfile.js index f074763bd..efdcc884f 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -135,7 +135,6 @@ module.exports = function(grunt) { bloodhound: { src: '<%= tempDir %>/bloodhound.js', objectToExport: 'Bloodhound', - amdModuleId: 'bloodhound', deps: { default: ['$'], amd: ['jquery'], @@ -145,7 +144,6 @@ module.exports = function(grunt) { }, typeahead: { src: '<%= tempDir %>/typeahead.jquery.js', - amdModuleId: 'typeahead.js', deps: { default: ['$'], amd: ['jquery'], diff --git a/README.md b/README.md deleted file mode 100644 index ff2f6c378..000000000 --- a/README.md +++ /dev/null @@ -1,188 +0,0 @@ -[![build status](https://secure.travis-ci.org/twitter/typeahead.js.svg?branch=master)](http://travis-ci.org/twitter/typeahead.js) -[![Built with Grunt](https://cdn.gruntjs.com/builtwith.png)](http://gruntjs.com/) - - -[typeahead.js][gh-page] -======================= - -Inspired by [twitter.com]'s autocomplete search functionality, typeahead.js is -a flexible JavaScript library that provides a strong foundation for building -robust typeaheads. - -The typeahead.js library consists of 2 components: the suggestion engine, -[Bloodhound], and the UI view, [Typeahead]. -The suggestion engine is responsible for computing suggestions for a given -query. The UI view is responsible for rendering suggestions and handling DOM -interactions. Both components can be used separately, but when used together, -they can provide a rich typeahead experience. - - - -[gh-page]: http://twitter.github.io/typeahead.js/ -[twitter.com]: https://twitter.com -[Bloodhound]: https://github.com/twitter/typeahead.js/blob/master/doc/bloodhound.md -[Typeahead]: https://github.com/twitter/typeahead.js/blob/master/doc/jquery_typeahead.md - -Getting Started ---------------- - -How you acquire typeahead.js is up to you. - -Preferred method: -* Install with [Bower]: `$ bower install typeahead.js` - -Other methods: -* [Download zipball of latest release][zipball]. -* Download the latest dist files individually: - * *[bloodhound.js]* (standalone suggestion engine) - * *[typeahead.jquery.js]* (standalone UI view) - * *[typeahead.bundle.js]* (*bloodhound.js* + *typeahead.jquery.js*) - * *[typeahead.bundle.min.js]* - -**Note:** both *bloodhound.js* and *typeahead.jquery.js* have a dependency on -[jQuery] 1.9+. - - - -[Bower]: http://bower.io/ -[zipball]: http://twitter.github.com/typeahead.js/releases/latest/typeahead.js.zip -[bloodhound.js]: http://twitter.github.com/typeahead.js/releases/latest/bloodhound.js -[typeahead.jquery.js]: http://twitter.github.com/typeahead.js/releases/latest/typeahead.jquery.js -[typeahead.bundle.js]: http://twitter.github.com/typeahead.js/releases/latest/typeahead.bundle.js -[typeahead.bundle.min.js]: http://twitter.github.com/typeahead.js/releases/latest/typeahead.bundle.min.js -[jQuery]: http://jquery.com/ - -Documentation -------------- - -* [Typeahead Docs] -* [Bloodhound Docs] - -[Typeahead Docs]: https://github.com/twitter/typeahead.js/blob/master/doc/jquery_typeahead.md -[Bloodhound Docs]: https://github.com/twitter/typeahead.js/blob/master/doc/bloodhound.md - -Examples --------- - -For some working examples of typeahead.js, visit the [examples page]. - - - -[examples page]: http://twitter.github.io/typeahead.js/examples - -Browser Support ---------------- - -* Chrome -* Firefox 3.5+ -* Safari 4+ -* Internet Explorer 8+ -* Opera 11+ - -**NOTE:** typeahead.js is not tested on mobile browsers. - -Customer Support ----------------- - -For general questions about typeahead.js, tweet at [@typeahead]. - -For technical questions, you should post a question on [Stack Overflow] and tag -it with [typeahead.js][so tag]. - - - -[Stack Overflow]: http://stackoverflow.com/ -[@typeahead]: https://twitter.com/typeahead -[so tag]: http://stackoverflow.com/questions/tagged/typeahead.js - -Issues ------- - -Discovered a bug? Please create an issue here on GitHub! - -https://github.com/twitter/typeahead.js/issues - -Versioning ----------- - -For transparency and insight into our release cycle, releases will be numbered -with the following format: - -`..` - -And constructed with the following guidelines: - -* Breaking backwards compatibility bumps the major -* New additions without breaking backwards compatibility bumps the minor -* Bug fixes and misc changes bump the patch - -For more information on semantic versioning, please visit http://semver.org/. - -Testing -------- - -Tests are written using [Jasmine] and ran with [Karma]. To run -the test suite with PhantomJS, run `$ npm test`. - - - -[Jasmine]: http://jasmine.github.io/ -[Karma]: http://karma-runner.github.io/ - -Developers ----------- - -If you plan on contributing to typeahead.js, be sure to read the -[contributing guidelines]. A good starting place for new contributors are issues -labeled with [entry-level]. Entry-level issues tend to require minor changes -and provide developers a chance to get more familiar with typeahead.js before -taking on more challenging work. - -In order to build and test typeahead.js, you'll need to install its dev -dependencies (`$ npm install`) and have [grunt-cli] -installed (`$ npm install -g grunt-cli`). Below is an overview of the available -Grunt tasks that'll be useful in development. - -* `grunt build` – Builds *typeahead.js* from source. -* `grunt lint` – Runs source and test files through JSHint. -* `grunt watch` – Rebuilds *typeahead.js* whenever a source file is modified. -* `grunt server` – Serves files from the root of typeahead.js on localhost:8888. - Useful for using *test/playground.html* for debugging/testing. -* `grunt dev` – Runs `grunt watch` and `grunt server` in parallel. - - - -[contributing guidelines]: https://github.com/twitter/typeahead.js/blob/master/CONTRIBUTING.md -[entry-level]: https://github.com/twitter/typeahead.js/issues?&labels=entry-level&state=open -[grunt-cli]: https://github.com/gruntjs/grunt-cli - -Maintainers ------------ - -* **Jake Harding** - * [@JakeHarding](https://twitter.com/JakeHarding) - * [GitHub](https://github.com/jharding) - -* **You?** - -Authors -------- - -* **Jake Harding** - * [@JakeHarding](https://twitter.com/JakeHarding) - * [GitHub](https://github.com/jharding) - -* **Veljko Skarich** - * [@vskarich](https://twitter.com/vskarich) - * [GitHub](https://github.com/vskarich) - -* **Tim Trueman** - * [@timtrueman](https://twitter.com/timtrueman) - * [GitHub](https://github.com/timtrueman) - -License -------- - -Copyright 2013 Twitter, Inc. - -Licensed under the MIT License diff --git a/bower.json b/bower.json index 1de2364ee..6d98143f3 100644 --- a/bower.json +++ b/bower.json @@ -1,5 +1,5 @@ { - "name": "typeahead.js", + "name": "corejs-typeahead", "version": "0.11.1", "main": "dist/typeahead.bundle.js", "dependencies": { @@ -8,6 +8,9 @@ "devDependencies": { "jquery": "~1.7", "jasmine-ajax": "~1.3.1", - "jasmine-jquery": "~1.5.2" + "jasmine-jquery": "~1.7.0" + }, + "resolutions": { + "jquery": "1.7.2" } -} \ No newline at end of file +} diff --git a/changelog.md b/changelog.md new file mode 100644 index 000000000..5146eac35 --- /dev/null +++ b/changelog.md @@ -0,0 +1,171 @@ +# Changelog + +### 0.11.2 TBD, 2015 + +* Add matchAnyQueryToken option. [#2](https://github.com/corejavascript/typeahead.js/pull/2) +* Update rendered-count after async results have displayed. [#8](https://github.com/corejavascript/typeahead.js/pull/8) +* Add default on option to stop propagation when selecting an entry. [#13](https://github.com/corejavascript/typeahead.js/pull/13) + +### 0.11.1 April 26, 2015 + +* Add prepare option to prefetch. [#1181](https://github.com/twitter/typeahead.js/pull/1181) +* Handle QuotaExceededError. [#1110](https://github.com/twitter/typeahead.js/pull/1110) +* Escape HTML entities from suggestion display value when rendering with default + template. [#964](https://github.com/twitter/typeahead.js/pull/964) +* List jquery as a dependency in package.json. [#1143](https://github.com/twitter/typeahead.js/pull/1143) + +### 0.11.0 April 25, 2015 + +An overhaul of typeahead.js – consider this a release candidate for v1. There +are bunch of API changes with this release so don't expect backwards +compatibility with previous versions. There are also many new undocumented +features that have been introduced. Documentation for those features will be +added before v1 ships. + +Beware that since this release is pretty much a rewrite, there are bound to be +some bugs. To be safe, you should consider this release beta software and +throughly test your integration of it before using it in production +environments. This caveat only applies to this release as subsequent releases +will address any issues that come up. + +### 0.10.5 August 7, 2014 + +* Increase supported version range for jQuery dependency. [#917](https://github.com/twitter/typeahead.js/pull/917) + +### 0.10.4 July 13, 2014 + +**Hotfix** + +* Fix regression that breaks Bloodhound instances when more than 1 instance is + relying on remote data. [#899](https://github.com/twitter/typeahead.js/pull/899) + +### 0.10.3 July 10, 2014 + +**Bug fixes** + +* `Bloodhound#clearPrefetchCache` now works with cache keys that contain regex + characters. [#771](https://github.com/twitter/typeahead.js/pull/771) +* Prevent outdated network requests from being sent. [#809](https://github.com/twitter/typeahead.js/pull/809) +* Add support to object tokenizers for multiple property tokenization. [#811](https://github.com/twitter/typeahead.js/pull/811) +* Fix broken `jQuery#typeahead('val')` method. [#815](https://github.com/twitter/typeahead.js/pull/815) +* Remove `disabled` attribute from the hint input control. [#839](https://github.com/twitter/typeahead.js/pull/839) +* Add `tt-highlight` class to highlighted text. [#833](https://github.com/twitter/typeahead.js/pull/833) +* Handle non-string types that are passed to `jQuery#typeahead('val', val)`. [#881](https://github.com/twitter/typeahead.js/pull/881) + +### 0.10.2 March 10, 2014 + +* Prevent flickering of dropdown menu when requesting remote suggestions. [#718](https://github.com/twitter/typeahead.js/pull/718) +* Reduce hint flickering. [#754](https://github.com/twitter/typeahead.js/pull/754) +* Added `Bloodhound#{clear, clearPrefetchCache, clearRemoteCache}` and made it + possible to reinitialize Bloodhound instances. [#703](https://github.com/twitter/typeahead.js/pull/703) +* Invoke `local` function during initialization. [#687](https://github.com/twitter/typeahead.js/pull/687) +* In addition to HTML strings, templates can now return DOM nodes. [#742](https://github.com/twitter/typeahead.js/pull/742) +* Prevent `jQuery#typeahead('val', val)` from opening dropdown menus of + non-active typeaheads. [#646](https://github.com/twitter/typeahead.js/pull/646) +* Fix bug in IE that resulted in dropdown menus with overflow being closed + when clicking on the scrollbar. [#705](https://github.com/twitter/typeahead.js/pull/705) +* Only show dropdown menu if `minLength` is satisfied. [#710](https://github.com/twitter/typeahead.js/pull/710) + +### 0.10.1 February 9, 2014 + +**Hotfix** + +* Fixed bug that prevented some ajax configs from being respected. [#630](https://github.com/twitter/typeahead.js/pull/630) +* Event delegation on suggestion clicks is no longer broken. [#118](https://github.com/twitter/typeahead.js/pull/118) +* Ensure dataset names are valid class name suffixes. [#610](https://github.com/twitter/typeahead.js/pull/610) +* Added support for `displayKey` to be a function. [#633](https://github.com/twitter/typeahead.js/pull/633) +* `jQuery#typeahead('val')` now mirrors `jQuery#val()`. [#659](https://github.com/twitter/typeahead.js/pull/659) +* Datasets can now be passed to jQuery plugin as an array. [#664](https://github.com/twitter/typeahead.js/pull/664) +* Added a `noConflict` method to the jQuery plugin. [#612](https://github.com/twitter/typeahead.js/pull/612) +* Bloodhound's `local` property can now be a function. [#485](https://github.com/twitter/typeahead.js/pull/485) + +### 0.10.0 February 2, 2014 + +**Introducting Bloodhound** + +This release was almost a complete rewrite of typeahead.js and will hopefully +lay the foundation for the 1.0.0 release. It's impossible to enumerate all of +the issues that were fixed. If you want to get an idea of what issues 0.10.0 +resolved, take a look at the closed issues in the [0.10.0 milestone](https://github.com/twitter/typeahead.js/issues?milestone=8&page=1&state=closed). + +The most important change in 0.10.0 is that typeahead.js was broken up into 2 +individual components: Bloodhound and jQuery#typeahead. Bloodhound is an +feature-rich suggestion engine. jQuery#typeahead is a jQuery plugin that turns +input controls into typeaheads. + +It's impossible to write a typeahead library that supports every use-case out +of the box – that was the main motivation behind decomposing typeahead.js. +Previously, some prospective typeahead.js users were unable to use the library +because either the suggestion engine or the typeahead UI did not meet their +requirements. In those cases, they were either forced to fork typeahead.js and +make the necessary modifications or they had to give up on using typeahead.js +entirely. Now they have the option of swapping out the component that doesn't +work for them with a custom implementation. + +### 0.9.3 June 24, 2013 + +* Ensure cursor visibility in menus with overflow. [#209](https://github.com/twitter/typeahead.js/pull/209) +* Fixed bug that led to the menu staying open when it should have been closed. [#260](https://github.com/twitter/typeahead.js/pull/260) +* Private browsing in Safari no longer breaks prefetch. [#270](https://github.com/twitter/typeahead.js/pull/270) +* Pressing tab while a suggestion is highlighted now results in a selection. [#266](https://github.com/twitter/typeahead.js/pull/266) +* Dataset name is now passed as an argument for typeahead:selected event. [#207](https://github.com/twitter/typeahead.js/pull/207) + +### 0.9.2 April 14, 2013 + +* Prefetch usage no longer breaks when cookies are disabled. [#190](https://github.com/twitter/typeahead.js/pull/190) +* Precompiled templates are now wrapped in the appropriate DOM element. [#172](https://github.com/twitter/typeahead.js/pull/172) + +### 0.9.1 April 1, 2013 + +* Multiple requests no longer get sent for a query when datasets share a remote source. [#152](https://github.com/twitter/typeahead.js/pull/152) +* Datasets now support precompiled templates. [#137](https://github.com/twitter/typeahead.js/pull/137) +* Cached remote suggestions now get rendered immediately. [#156](https://github.com/twitter/typeahead.js/pull/156) +* Added typeahead:autocompleted event. [#132](https://github.com/twitter/typeahead.js/pull/132) +* Added a plugin method for programmatically setting the query. Experimental. [#159](https://github.com/twitter/typeahead.js/pull/159) +* Added minLength option for datasets. Experimental. [#131](https://github.com/twitter/typeahead.js/pull/131) +* Prefetch objects now support thumbprint option. Experimental. [#157](https://github.com/twitter/typeahead.js/pull/157) + +### 0.9.0 March 24, 2013 + +**Custom events, no more typeahead.css, and an improved API** + +* Implemented the triggering of custom events. [#106](https://github.com/twitter/typeahead.js/pull/106) +* Got rid of typeahead.css and now apply styling through JavaScript. [#15](https://github.com/twitter/typeahead.js/pull/15) +* Made the API more flexible and addressed a handful of remote issues by rewriting the transport component. [#25](https://github.com/twitter/typeahead.js/pull/81) +* Added support for dataset headers and footers. [#81](https://github.com/twitter/typeahead.js/pull/81) +* No longer cache unnamed datasets. [#116](https://github.com/twitter/typeahead.js/pull/116) +* Made the key name of the value property configurable. [#115](https://github.com/twitter/typeahead.js/pull/115) +* Input values set before initialization of typeaheads are now respected. [#109](https://github.com/twitter/typeahead.js/pull/109) +* Fixed an input value/hint casing bug. [#108](https://github.com/twitter/typeahead.js/pull/108) + +### 0.8.2 March 04, 2013 + +* Fixed bug causing error to be thrown when initializing a typeahead on multiple elements. [#51](https://github.com/twitter/typeahead.js/pull/51) +* Tokens with falsy values are now filtered out – was causing wonky behavior. [#75](https://github.com/twitter/typeahead.js/pull/75) +* No longer making remote requests for blank queries. [#74](https://github.com/twitter/typeahead.js/pull/74) +* Datums with regex characters in their value no longer cause errors. [#77](https://github.com/twitter/typeahead.js/pull/77) +* Now compatible with the Closure Compiler. [#48](https://github.com/twitter/typeahead.js/pull/48) +* Reference to jQuery is now obtained through window.jQuery, not window.$. [#47](https://github.com/twitter/typeahead.js/pull/47) +* Added a plugin method for destroying typeaheads. Won't be documented until v0.9 and might change before then. [#59](https://github.com/twitter/typeahead.js/pull/59) + +### 0.8.1 February 25, 2013 + +* Fixed bug preventing local and prefetch from being used together. [#39](https://github.com/twitter/typeahead.js/pull/39) +* No longer prevent default browser behavior when up or down arrow is pressed with a modifier. [#6](https://github.com/twitter/typeahead.js/pull/6) +* Hint is hidden when user entered query is wider than the input. [#26](https://github.com/twitter/typeahead.js/pull/26) +* Data stored in localStorage now expires properly. [#34](https://github.com/twitter/typeahead.js/pull/34) +* Normalized search tokens and fixed query tokenization. [#38](https://github.com/twitter/typeahead.js/pull/38) +* Remote suggestions now are appended, not prepended to suggestions list. [#40](https://github.com/twitter/typeahead.js/pull/40) +* Fixed some typos through the codebase. [#3](https://github.com/twitter/typeahead.js/pull/3) + +### 0.8.0 February 19, 2013 + +**Initial public release** + +* Prefetch and search data locally insanely fast. +* Search hard-coded, prefetched, and/or remote data. +* Hinting. +* RTL/IME/international support. +* Search multiple datasets. +* Share datasets (and caching) between multiple inputs. +* And much, much more... diff --git a/CONTRIBUTING.md b/contributing.md similarity index 100% rename from CONTRIBUTING.md rename to contributing.md diff --git a/dist/bloodhound.js b/dist/bloodhound.js index 6095f2915..f4332219e 100644 --- a/dist/bloodhound.js +++ b/dist/bloodhound.js @@ -6,7 +6,7 @@ (function(root, factory) { if (typeof define === "function" && define.amd) { - define("bloodhound", [ "jquery" ], function(a0) { + define([ "jquery" ], function(a0) { return root["Bloodhound"] = factory(a0); }); } else if (typeof exports === "object") { @@ -423,6 +423,7 @@ this.identify = o.identify || _.stringify; this.datumTokenizer = o.datumTokenizer; this.queryTokenizer = o.queryTokenizer; + this.matchAnyQueryToken = o.matchAnyQueryToken; this.reset(); } _.mixin(SearchIndex.prototype, { @@ -459,7 +460,7 @@ tokens = normalizeTokens(this.queryTokenizer(query)); _.each(tokens, function(token) { var node, chars, ch, ids; - if (matches && matches.length === 0) { + if (matches && matches.length === 0 && !that.matchAnyQueryToken) { return false; } node = that.trie; @@ -471,8 +472,10 @@ ids = node[IDS].slice(0); matches = matches ? getIntersection(matches, ids) : ids; } else { - matches = []; - return false; + if (!that.matchAnyQueryToken) { + matches = []; + return false; + } } }); return matches ? _.map(unique(matches), function(id) { @@ -614,6 +617,7 @@ this.url = o.url; this.prepare = o.prepare; this.transform = o.transform; + this.indexResponse = o.indexResponse; this.transport = new Transport({ cache: o.cache, limiter: o.limiter, @@ -655,7 +659,9 @@ identify: _.stringify, datumTokenizer: null, queryTokenizer: null, + matchAnyQueryToken: false, sufficient: 5, + indexRemote: false, sorter: null, local: [], prefetch: null, @@ -806,6 +812,7 @@ this.sorter = o.sorter; this.identify = o.identify; this.sufficient = o.sufficient; + this.indexRemote = o.indexRemote; this.local = o.local; this.remote = o.remote ? new Remote(o.remote) : null; this.prefetch = o.prefetch ? new Prefetch(o.prefetch) : null; @@ -875,6 +882,8 @@ }, search: function search(query, sync, async) { var that = this, local; + sync = sync || _.noop; + async = async || _.noop; local = this.sorter(this.index.search(query)); sync(this.remote ? local.slice() : local); if (this.remote && local.length < this.sufficient) { @@ -890,7 +899,8 @@ return that.identify(r) === that.identify(l); }) && nonDuplicates.push(r); }); - async && async(nonDuplicates); + that.indexRemote && that.add(nonDuplicates); + async(nonDuplicates); } }, all: function all() { diff --git a/dist/bloodhound.min.js b/dist/bloodhound.min.js index f517582b9..94869ceef 100644 --- a/dist/bloodhound.min.js +++ b/dist/bloodhound.min.js @@ -4,4 +4,4 @@ * Copyright 2013-2015 Twitter, Inc. and other contributors; Licensed MIT */ -!function(a,b){"function"==typeof define&&define.amd?define("bloodhound",["jquery"],function(c){return a.Bloodhound=b(c)}):"object"==typeof exports?module.exports=b(require("jquery")):a.Bloodhound=b(jQuery)}(this,function(a){var b=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(a){return!a||/^\s*$/.test(a)},escapeRegExChars:function(a){return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},isString:function(a){return"string"==typeof a},isNumber:function(a){return"number"==typeof a},isArray:a.isArray,isFunction:a.isFunction,isObject:a.isPlainObject,isUndefined:function(a){return"undefined"==typeof a},isElement:function(a){return!(!a||1!==a.nodeType)},isJQuery:function(b){return b instanceof a},toStr:function(a){return b.isUndefined(a)||null===a?"":a+""},bind:a.proxy,each:function(b,c){function d(a,b){return c(b,a)}a.each(b,d)},map:a.map,filter:a.grep,every:function(b,c){var d=!0;return b?(a.each(b,function(a,e){return(d=c.call(null,e,a,b))?void 0:!1}),!!d):d},some:function(b,c){var d=!1;return b?(a.each(b,function(a,e){return(d=c.call(null,e,a,b))?!1:void 0}),!!d):d},mixin:a.extend,identity:function(a){return a},clone:function(b){return a.extend(!0,{},b)},getIdGenerator:function(){var a=0;return function(){return a++}},templatify:function(b){function c(){return String(b)}return a.isFunction(b)?b:c},defer:function(a){setTimeout(a,0)},debounce:function(a,b,c){var d,e;return function(){var f,g,h=this,i=arguments;return f=function(){d=null,c||(e=a.apply(h,i))},g=c&&!d,clearTimeout(d),d=setTimeout(f,b),g&&(e=a.apply(h,i)),e}},throttle:function(a,b){var c,d,e,f,g,h;return g=0,h=function(){g=new Date,e=null,f=a.apply(c,d)},function(){var i=new Date,j=b-(i-g);return c=this,d=arguments,0>=j?(clearTimeout(e),e=null,g=i,f=a.apply(c,d)):e||(e=setTimeout(h,j)),f}},stringify:function(a){return b.isString(a)?a:JSON.stringify(a)},noop:function(){}}}(),c="0.11.1",d=function(){"use strict";function a(a){return a=b.toStr(a),a?a.split(/\s+/):[]}function c(a){return a=b.toStr(a),a?a.split(/\W+/):[]}function d(a){return function(c){return c=b.isArray(c)?c:[].slice.call(arguments,0),function(d){var e=[];return b.each(c,function(c){e=e.concat(a(b.toStr(d[c])))}),e}}}return{nonword:c,whitespace:a,obj:{nonword:d(c),whitespace:d(a)}}}(),e=function(){"use strict";function c(c){this.maxSize=b.isNumber(c)?c:100,this.reset(),this.maxSize<=0&&(this.set=this.get=a.noop)}function d(){this.head=this.tail=null}function e(a,b){this.key=a,this.val=b,this.prev=this.next=null}return b.mixin(c.prototype,{set:function(a,b){var c,d=this.list.tail;this.size>=this.maxSize&&(this.list.remove(d),delete this.hash[d.key],this.size--),(c=this.hash[a])?(c.val=b,this.list.moveToFront(c)):(c=new e(a,b),this.list.add(c),this.hash[a]=c,this.size++)},get:function(a){var b=this.hash[a];return b?(this.list.moveToFront(b),b.val):void 0},reset:function(){this.size=0,this.hash={},this.list=new d}}),b.mixin(d.prototype,{add:function(a){this.head&&(a.next=this.head,this.head.prev=a),this.head=a,this.tail=this.tail||a},remove:function(a){a.prev?a.prev.next=a.next:this.head=a.next,a.next?a.next.prev=a.prev:this.tail=a.prev},moveToFront:function(a){this.remove(a),this.add(a)}}),c}(),f=function(){"use strict";function c(a,c){this.prefix=["__",a,"__"].join(""),this.ttlKey="__ttl__",this.keyMatcher=new RegExp("^"+b.escapeRegExChars(this.prefix)),this.ls=c||h,!this.ls&&this._noop()}function d(){return(new Date).getTime()}function e(a){return JSON.stringify(b.isUndefined(a)?null:a)}function f(b){return a.parseJSON(b)}function g(a){var b,c,d=[],e=h.length;for(b=0;e>b;b++)(c=h.key(b)).match(a)&&d.push(c.replace(a,""));return d}var h;try{h=window.localStorage,h.setItem("~~~","!"),h.removeItem("~~~")}catch(i){h=null}return b.mixin(c.prototype,{_prefix:function(a){return this.prefix+a},_ttlKey:function(a){return this._prefix(a)+this.ttlKey},_noop:function(){this.get=this.set=this.remove=this.clear=this.isExpired=b.noop},_safeSet:function(a,b){try{this.ls.setItem(a,b)}catch(c){"QuotaExceededError"===c.name&&(this.clear(),this._noop())}},get:function(a){return this.isExpired(a)&&this.remove(a),f(this.ls.getItem(this._prefix(a)))},set:function(a,c,f){return b.isNumber(f)?this._safeSet(this._ttlKey(a),e(d()+f)):this.ls.removeItem(this._ttlKey(a)),this._safeSet(this._prefix(a),e(c))},remove:function(a){return this.ls.removeItem(this._ttlKey(a)),this.ls.removeItem(this._prefix(a)),this},clear:function(){var a,b=g(this.keyMatcher);for(a=b.length;a--;)this.remove(b[a]);return this},isExpired:function(a){var c=f(this.ls.getItem(this._ttlKey(a)));return b.isNumber(c)&&d()>c?!0:!1}}),c}(),g=function(){"use strict";function c(a){a=a||{},this.cancelled=!1,this.lastReq=null,this._send=a.transport,this._get=a.limiter?a.limiter(this._get):this._get,this._cache=a.cache===!1?new e(0):h}var d=0,f={},g=6,h=new e(10);return c.setMaxPendingRequests=function(a){g=a},c.resetCache=function(){h.reset()},b.mixin(c.prototype,{_fingerprint:function(b){return b=b||{},b.url+b.type+a.param(b.data||{})},_get:function(a,b){function c(a){b(null,a),k._cache.set(i,a)}function e(){b(!0)}function h(){d--,delete f[i],k.onDeckRequestArgs&&(k._get.apply(k,k.onDeckRequestArgs),k.onDeckRequestArgs=null)}var i,j,k=this;i=this._fingerprint(a),this.cancelled||i!==this.lastReq||((j=f[i])?j.done(c).fail(e):g>d?(d++,f[i]=this._send(a).done(c).fail(e).always(h)):this.onDeckRequestArgs=[].slice.call(arguments,0))},get:function(c,d){var e,f;d=d||a.noop,c=b.isString(c)?{url:c}:c||{},f=this._fingerprint(c),this.cancelled=!1,this.lastReq=f,(e=this._cache.get(f))?d(null,e):this._get(c,d)},cancel:function(){this.cancelled=!0}}),c}(),h=window.SearchIndex=function(){"use strict";function c(c){c=c||{},c.datumTokenizer&&c.queryTokenizer||a.error("datumTokenizer and queryTokenizer are both required"),this.identify=c.identify||b.stringify,this.datumTokenizer=c.datumTokenizer,this.queryTokenizer=c.queryTokenizer,this.reset()}function d(a){return a=b.filter(a,function(a){return!!a}),a=b.map(a,function(a){return a.toLowerCase()})}function e(){var a={};return a[i]=[],a[h]={},a}function f(a){for(var b={},c=[],d=0,e=a.length;e>d;d++)b[a[d]]||(b[a[d]]=!0,c.push(a[d]));return c}function g(a,b){var c=0,d=0,e=[];a=a.sort(),b=b.sort();for(var f=a.length,g=b.length;f>c&&g>d;)a[c]b[d]?d++:(e.push(a[c]),c++,d++);return e}var h="c",i="i";return b.mixin(c.prototype,{bootstrap:function(a){this.datums=a.datums,this.trie=a.trie},add:function(a){var c=this;a=b.isArray(a)?a:[a],b.each(a,function(a){var f,g;c.datums[f=c.identify(a)]=a,g=d(c.datumTokenizer(a)),b.each(g,function(a){var b,d,g;for(b=c.trie,d=a.split("");g=d.shift();)b=b[h][g]||(b[h][g]=e()),b[i].push(f)})})},get:function(a){var c=this;return b.map(a,function(a){return c.datums[a]})},search:function(a){var c,e,j=this;return c=d(this.queryTokenizer(a)),b.each(c,function(a){var b,c,d,f;if(e&&0===e.length)return!1;for(b=j.trie,c=a.split("");b&&(d=c.shift());)b=b[h][d];return b&&0===c.length?(f=b[i].slice(0),void(e=e?g(e,f):f)):(e=[],!1)}),e?b.map(f(e),function(a){return j.datums[a]}):[]},all:function(){var a=[];for(var b in this.datums)a.push(this.datums[b]);return a},reset:function(){this.datums={},this.trie=e()},serialize:function(){return{datums:this.datums,trie:this.trie}}}),c}(),i=function(){"use strict";function a(a){this.url=a.url,this.ttl=a.ttl,this.cache=a.cache,this.prepare=a.prepare,this.transform=a.transform,this.transport=a.transport,this.thumbprint=a.thumbprint,this.storage=new f(a.cacheKey)}var c;return c={data:"data",protocol:"protocol",thumbprint:"thumbprint"},b.mixin(a.prototype,{_settings:function(){return{url:this.url,type:"GET",dataType:"json"}},store:function(a){this.cache&&(this.storage.set(c.data,a,this.ttl),this.storage.set(c.protocol,location.protocol,this.ttl),this.storage.set(c.thumbprint,this.thumbprint,this.ttl))},fromCache:function(){var a,b={};return this.cache?(b.data=this.storage.get(c.data),b.protocol=this.storage.get(c.protocol),b.thumbprint=this.storage.get(c.thumbprint),a=b.thumbprint!==this.thumbprint||b.protocol!==location.protocol,b.data&&!a?b.data:null):null},fromNetwork:function(a){function b(){a(!0)}function c(b){a(null,e.transform(b))}var d,e=this;a&&(d=this.prepare(this._settings()),this.transport(d).fail(b).done(c))},clear:function(){return this.storage.clear(),this}}),a}(),j=function(){"use strict";function a(a){this.url=a.url,this.prepare=a.prepare,this.transform=a.transform,this.transport=new g({cache:a.cache,limiter:a.limiter,transport:a.transport})}return b.mixin(a.prototype,{_settings:function(){return{url:this.url,type:"GET",dataType:"json"}},get:function(a,b){function c(a,c){b(a?[]:e.transform(c))}var d,e=this;if(b)return a=a||"",d=this.prepare(a,this._settings()),this.transport.get(d,c)},cancelLastRequest:function(){this.transport.cancel()}}),a}(),k=function(){"use strict";function d(d){var e;return d?(e={url:null,ttl:864e5,cache:!0,cacheKey:null,thumbprint:"",prepare:b.identity,transform:b.identity,transport:null},d=b.isString(d)?{url:d}:d,d=b.mixin(e,d),!d.url&&a.error("prefetch requires url to be set"),d.transform=d.filter||d.transform,d.cacheKey=d.cacheKey||d.url,d.thumbprint=c+d.thumbprint,d.transport=d.transport?h(d.transport):a.ajax,d):null}function e(c){var d;if(c)return d={url:null,cache:!0,prepare:null,replace:null,wildcard:null,limiter:null,rateLimitBy:"debounce",rateLimitWait:300,transform:b.identity,transport:null},c=b.isString(c)?{url:c}:c,c=b.mixin(d,c),!c.url&&a.error("remote requires url to be set"),c.transform=c.filter||c.transform,c.prepare=f(c),c.limiter=g(c),c.transport=c.transport?h(c.transport):a.ajax,delete c.replace,delete c.wildcard,delete c.rateLimitBy,delete c.rateLimitWait,c}function f(a){function b(a,b){return b.url=f(b.url,a),b}function c(a,b){return b.url=b.url.replace(g,encodeURIComponent(a)),b}function d(a,b){return b}var e,f,g;return e=a.prepare,f=a.replace,g=a.wildcard,e?e:e=f?b:a.wildcard?c:d}function g(a){function c(a){return function(c){return b.debounce(c,a)}}function d(a){return function(c){return b.throttle(c,a)}}var e,f,g;return e=a.limiter,f=a.rateLimitBy,g=a.rateLimitWait,e||(e=/^throttle$/i.test(f)?d(g):c(g)),e}function h(c){return function(d){function e(a){b.defer(function(){g.resolve(a)})}function f(a){b.defer(function(){g.reject(a)})}var g=a.Deferred();return c(d,e,f),g}}return function(c){var f,g;return f={initialize:!0,identify:b.stringify,datumTokenizer:null,queryTokenizer:null,sufficient:5,sorter:null,local:[],prefetch:null,remote:null},c=b.mixin(f,c||{}),!c.datumTokenizer&&a.error("datumTokenizer is required"),!c.queryTokenizer&&a.error("queryTokenizer is required"),g=c.sorter,c.sorter=g?function(a){return a.sort(g)}:b.identity,c.local=b.isFunction(c.local)?c.local():c.local,c.prefetch=d(c.prefetch),c.remote=e(c.remote),c}}(),l=function(){"use strict";function c(a){a=k(a),this.sorter=a.sorter,this.identify=a.identify,this.sufficient=a.sufficient,this.local=a.local,this.remote=a.remote?new j(a.remote):null,this.prefetch=a.prefetch?new i(a.prefetch):null,this.index=new h({identify:this.identify,datumTokenizer:a.datumTokenizer,queryTokenizer:a.queryTokenizer}),a.initialize!==!1&&this.initialize()}var e;return e=window&&window.Bloodhound,c.noConflict=function(){return window&&(window.Bloodhound=e),c},c.tokenizers=d,b.mixin(c.prototype,{__ttAdapter:function(){function a(a,b,d){return c.search(a,b,d)}function b(a,b){return c.search(a,b)}var c=this;return this.remote?a:b},_loadPrefetch:function(){function b(a,b){return a?c.reject():(e.add(b),e.prefetch.store(e.index.serialize()),void c.resolve())}var c,d,e=this;return c=a.Deferred(),this.prefetch?(d=this.prefetch.fromCache())?(this.index.bootstrap(d),c.resolve()):this.prefetch.fromNetwork(b):c.resolve(),c.promise()},_initialize:function(){function a(){b.add(b.local)}var b=this;return this.clear(),(this.initPromise=this._loadPrefetch()).done(a),this.initPromise},initialize:function(a){return!this.initPromise||a?this._initialize():this.initPromise},add:function(a){return this.index.add(a),this},get:function(a){return a=b.isArray(a)?a:[].slice.call(arguments),this.index.get(a)},search:function(a,c,d){function e(a){var c=[];b.each(a,function(a){!b.some(f,function(b){return g.identify(a)===g.identify(b)})&&c.push(a)}),d&&d(c)}var f,g=this;return f=this.sorter(this.index.search(a)),c(this.remote?f.slice():f),this.remote&&f.length=j?(clearTimeout(e),e=null,g=i,f=a.apply(c,d)):e||(e=setTimeout(h,j)),f}},stringify:function(a){return b.isString(a)?a:JSON.stringify(a)},noop:function(){}}}(),c="0.11.1",d=function(){"use strict";function a(a){return a=b.toStr(a),a?a.split(/\s+/):[]}function c(a){return a=b.toStr(a),a?a.split(/\W+/):[]}function d(a){return function(c){return c=b.isArray(c)?c:[].slice.call(arguments,0),function(d){var e=[];return b.each(c,function(c){e=e.concat(a(b.toStr(d[c])))}),e}}}return{nonword:c,whitespace:a,obj:{nonword:d(c),whitespace:d(a)}}}(),e=function(){"use strict";function c(c){this.maxSize=b.isNumber(c)?c:100,this.reset(),this.maxSize<=0&&(this.set=this.get=a.noop)}function d(){this.head=this.tail=null}function e(a,b){this.key=a,this.val=b,this.prev=this.next=null}return b.mixin(c.prototype,{set:function(a,b){var c,d=this.list.tail;this.size>=this.maxSize&&(this.list.remove(d),delete this.hash[d.key],this.size--),(c=this.hash[a])?(c.val=b,this.list.moveToFront(c)):(c=new e(a,b),this.list.add(c),this.hash[a]=c,this.size++)},get:function(a){var b=this.hash[a];return b?(this.list.moveToFront(b),b.val):void 0},reset:function(){this.size=0,this.hash={},this.list=new d}}),b.mixin(d.prototype,{add:function(a){this.head&&(a.next=this.head,this.head.prev=a),this.head=a,this.tail=this.tail||a},remove:function(a){a.prev?a.prev.next=a.next:this.head=a.next,a.next?a.next.prev=a.prev:this.tail=a.prev},moveToFront:function(a){this.remove(a),this.add(a)}}),c}(),f=function(){"use strict";function c(a,c){this.prefix=["__",a,"__"].join(""),this.ttlKey="__ttl__",this.keyMatcher=new RegExp("^"+b.escapeRegExChars(this.prefix)),this.ls=c||h,!this.ls&&this._noop()}function d(){return(new Date).getTime()}function e(a){return JSON.stringify(b.isUndefined(a)?null:a)}function f(b){return a.parseJSON(b)}function g(a){var b,c,d=[],e=h.length;for(b=0;e>b;b++)(c=h.key(b)).match(a)&&d.push(c.replace(a,""));return d}var h;try{h=window.localStorage,h.setItem("~~~","!"),h.removeItem("~~~")}catch(i){h=null}return b.mixin(c.prototype,{_prefix:function(a){return this.prefix+a},_ttlKey:function(a){return this._prefix(a)+this.ttlKey},_noop:function(){this.get=this.set=this.remove=this.clear=this.isExpired=b.noop},_safeSet:function(a,b){try{this.ls.setItem(a,b)}catch(c){"QuotaExceededError"===c.name&&(this.clear(),this._noop())}},get:function(a){return this.isExpired(a)&&this.remove(a),f(this.ls.getItem(this._prefix(a)))},set:function(a,c,f){return b.isNumber(f)?this._safeSet(this._ttlKey(a),e(d()+f)):this.ls.removeItem(this._ttlKey(a)),this._safeSet(this._prefix(a),e(c))},remove:function(a){return this.ls.removeItem(this._ttlKey(a)),this.ls.removeItem(this._prefix(a)),this},clear:function(){var a,b=g(this.keyMatcher);for(a=b.length;a--;)this.remove(b[a]);return this},isExpired:function(a){var c=f(this.ls.getItem(this._ttlKey(a)));return b.isNumber(c)&&d()>c?!0:!1}}),c}(),g=function(){"use strict";function c(a){a=a||{},this.cancelled=!1,this.lastReq=null,this._send=a.transport,this._get=a.limiter?a.limiter(this._get):this._get,this._cache=a.cache===!1?new e(0):h}var d=0,f={},g=6,h=new e(10);return c.setMaxPendingRequests=function(a){g=a},c.resetCache=function(){h.reset()},b.mixin(c.prototype,{_fingerprint:function(b){return b=b||{},b.url+b.type+a.param(b.data||{})},_get:function(a,b){function c(a){b(null,a),k._cache.set(i,a)}function e(){b(!0)}function h(){d--,delete f[i],k.onDeckRequestArgs&&(k._get.apply(k,k.onDeckRequestArgs),k.onDeckRequestArgs=null)}var i,j,k=this;i=this._fingerprint(a),this.cancelled||i!==this.lastReq||((j=f[i])?j.done(c).fail(e):g>d?(d++,f[i]=this._send(a).done(c).fail(e).always(h)):this.onDeckRequestArgs=[].slice.call(arguments,0))},get:function(c,d){var e,f;d=d||a.noop,c=b.isString(c)?{url:c}:c||{},f=this._fingerprint(c),this.cancelled=!1,this.lastReq=f,(e=this._cache.get(f))?d(null,e):this._get(c,d)},cancel:function(){this.cancelled=!0}}),c}(),h=window.SearchIndex=function(){"use strict";function c(c){c=c||{},c.datumTokenizer&&c.queryTokenizer||a.error("datumTokenizer and queryTokenizer are both required"),this.identify=c.identify||b.stringify,this.datumTokenizer=c.datumTokenizer,this.queryTokenizer=c.queryTokenizer,this.matchAnyQueryToken=c.matchAnyQueryToken,this.reset()}function d(a){return a=b.filter(a,function(a){return!!a}),a=b.map(a,function(a){return a.toLowerCase()})}function e(){var a={};return a[i]=[],a[h]={},a}function f(a){for(var b={},c=[],d=0,e=a.length;e>d;d++)b[a[d]]||(b[a[d]]=!0,c.push(a[d]));return c}function g(a,b){var c=0,d=0,e=[];a=a.sort(),b=b.sort();for(var f=a.length,g=b.length;f>c&&g>d;)a[c]b[d]?d++:(e.push(a[c]),c++,d++);return e}var h="c",i="i";return b.mixin(c.prototype,{bootstrap:function(a){this.datums=a.datums,this.trie=a.trie},add:function(a){var c=this;a=b.isArray(a)?a:[a],b.each(a,function(a){var f,g;c.datums[f=c.identify(a)]=a,g=d(c.datumTokenizer(a)),b.each(g,function(a){var b,d,g;for(b=c.trie,d=a.split("");g=d.shift();)b=b[h][g]||(b[h][g]=e()),b[i].push(f)})})},get:function(a){var c=this;return b.map(a,function(a){return c.datums[a]})},search:function(a){var c,e,j=this;return c=d(this.queryTokenizer(a)),b.each(c,function(a){var b,c,d,f;if(e&&0===e.length&&!j.matchAnyQueryToken)return!1;for(b=j.trie,c=a.split("");b&&(d=c.shift());)b=b[h][d];if(b&&0===c.length)f=b[i].slice(0),e=e?g(e,f):f;else if(!j.matchAnyQueryToken)return e=[],!1}),e?b.map(f(e),function(a){return j.datums[a]}):[]},all:function(){var a=[];for(var b in this.datums)a.push(this.datums[b]);return a},reset:function(){this.datums={},this.trie=e()},serialize:function(){return{datums:this.datums,trie:this.trie}}}),c}(),i=function(){"use strict";function a(a){this.url=a.url,this.ttl=a.ttl,this.cache=a.cache,this.prepare=a.prepare,this.transform=a.transform,this.transport=a.transport,this.thumbprint=a.thumbprint,this.storage=new f(a.cacheKey)}var c;return c={data:"data",protocol:"protocol",thumbprint:"thumbprint"},b.mixin(a.prototype,{_settings:function(){return{url:this.url,type:"GET",dataType:"json"}},store:function(a){this.cache&&(this.storage.set(c.data,a,this.ttl),this.storage.set(c.protocol,location.protocol,this.ttl),this.storage.set(c.thumbprint,this.thumbprint,this.ttl))},fromCache:function(){var a,b={};return this.cache?(b.data=this.storage.get(c.data),b.protocol=this.storage.get(c.protocol),b.thumbprint=this.storage.get(c.thumbprint),a=b.thumbprint!==this.thumbprint||b.protocol!==location.protocol,b.data&&!a?b.data:null):null},fromNetwork:function(a){function b(){a(!0)}function c(b){a(null,e.transform(b))}var d,e=this;a&&(d=this.prepare(this._settings()),this.transport(d).fail(b).done(c))},clear:function(){return this.storage.clear(),this}}),a}(),j=function(){"use strict";function a(a){this.url=a.url,this.prepare=a.prepare,this.transform=a.transform,this.indexResponse=a.indexResponse,this.transport=new g({cache:a.cache,limiter:a.limiter,transport:a.transport})}return b.mixin(a.prototype,{_settings:function(){return{url:this.url,type:"GET",dataType:"json"}},get:function(a,b){function c(a,c){b(a?[]:e.transform(c))}var d,e=this;if(b)return a=a||"",d=this.prepare(a,this._settings()),this.transport.get(d,c)},cancelLastRequest:function(){this.transport.cancel()}}),a}(),k=function(){"use strict";function d(d){var e;return d?(e={url:null,ttl:864e5,cache:!0,cacheKey:null,thumbprint:"",prepare:b.identity,transform:b.identity,transport:null},d=b.isString(d)?{url:d}:d,d=b.mixin(e,d),!d.url&&a.error("prefetch requires url to be set"),d.transform=d.filter||d.transform,d.cacheKey=d.cacheKey||d.url,d.thumbprint=c+d.thumbprint,d.transport=d.transport?h(d.transport):a.ajax,d):null}function e(c){var d;if(c)return d={url:null,cache:!0,prepare:null,replace:null,wildcard:null,limiter:null,rateLimitBy:"debounce",rateLimitWait:300,transform:b.identity,transport:null},c=b.isString(c)?{url:c}:c,c=b.mixin(d,c),!c.url&&a.error("remote requires url to be set"),c.transform=c.filter||c.transform,c.prepare=f(c),c.limiter=g(c),c.transport=c.transport?h(c.transport):a.ajax,delete c.replace,delete c.wildcard,delete c.rateLimitBy,delete c.rateLimitWait,c}function f(a){function b(a,b){return b.url=f(b.url,a),b}function c(a,b){return b.url=b.url.replace(g,encodeURIComponent(a)),b}function d(a,b){return b}var e,f,g;return e=a.prepare,f=a.replace,g=a.wildcard,e?e:e=f?b:a.wildcard?c:d}function g(a){function c(a){return function(c){return b.debounce(c,a)}}function d(a){return function(c){return b.throttle(c,a)}}var e,f,g;return e=a.limiter,f=a.rateLimitBy,g=a.rateLimitWait,e||(e=/^throttle$/i.test(f)?d(g):c(g)),e}function h(c){return function(d){function e(a){b.defer(function(){g.resolve(a)})}function f(a){b.defer(function(){g.reject(a)})}var g=a.Deferred();return c(d,e,f),g}}return function(c){var f,g;return f={initialize:!0,identify:b.stringify,datumTokenizer:null,queryTokenizer:null,matchAnyQueryToken:!1,sufficient:5,indexRemote:!1,sorter:null,local:[],prefetch:null,remote:null},c=b.mixin(f,c||{}),!c.datumTokenizer&&a.error("datumTokenizer is required"),!c.queryTokenizer&&a.error("queryTokenizer is required"),g=c.sorter,c.sorter=g?function(a){return a.sort(g)}:b.identity,c.local=b.isFunction(c.local)?c.local():c.local,c.prefetch=d(c.prefetch),c.remote=e(c.remote),c}}(),l=function(){"use strict";function c(a){a=k(a),this.sorter=a.sorter,this.identify=a.identify,this.sufficient=a.sufficient,this.indexRemote=a.indexRemote,this.local=a.local,this.remote=a.remote?new j(a.remote):null,this.prefetch=a.prefetch?new i(a.prefetch):null,this.index=new h({identify:this.identify,datumTokenizer:a.datumTokenizer,queryTokenizer:a.queryTokenizer}),a.initialize!==!1&&this.initialize()}var e;return e=window&&window.Bloodhound,c.noConflict=function(){return window&&(window.Bloodhound=e),c},c.tokenizers=d,b.mixin(c.prototype,{__ttAdapter:function(){function a(a,b,d){return c.search(a,b,d)}function b(a,b){return c.search(a,b)}var c=this;return this.remote?a:b},_loadPrefetch:function(){function b(a,b){return a?c.reject():(e.add(b),e.prefetch.store(e.index.serialize()),void c.resolve())}var c,d,e=this;return c=a.Deferred(),this.prefetch?(d=this.prefetch.fromCache())?(this.index.bootstrap(d),c.resolve()):this.prefetch.fromNetwork(b):c.resolve(),c.promise()},_initialize:function(){function a(){b.add(b.local)}var b=this;return this.clear(),(this.initPromise=this._loadPrefetch()).done(a),this.initPromise},initialize:function(a){return!this.initPromise||a?this._initialize():this.initPromise},add:function(a){return this.index.add(a),this},get:function(a){return a=b.isArray(a)?a:[].slice.call(arguments),this.index.get(a)},search:function(a,c,d){function e(a){var c=[];b.each(a,function(a){!b.some(f,function(b){return g.identify(a)===g.identify(b)})&&c.push(a)}),g.indexRemote&&g.add(c),d(c)}var f,g=this;return c=c||b.noop,d=d||b.noop,f=this.sorter(this.index.search(a)),c(this.remote?f.slice():f),this.remote&&f.length=j?(clearTimeout(e),e=null,g=i,f=a.apply(c,d)):e||(e=setTimeout(h,j)),f}},stringify:function(a){return b.isString(a)?a:JSON.stringify(a)},noop:function(){}}}(),c="0.11.1",d=function(){"use strict";function a(a){return a=b.toStr(a),a?a.split(/\s+/):[]}function c(a){return a=b.toStr(a),a?a.split(/\W+/):[]}function d(a){return function(c){return c=b.isArray(c)?c:[].slice.call(arguments,0),function(d){var e=[];return b.each(c,function(c){e=e.concat(a(b.toStr(d[c])))}),e}}}return{nonword:c,whitespace:a,obj:{nonword:d(c),whitespace:d(a)}}}(),e=function(){"use strict";function c(c){this.maxSize=b.isNumber(c)?c:100,this.reset(),this.maxSize<=0&&(this.set=this.get=a.noop)}function d(){this.head=this.tail=null}function e(a,b){this.key=a,this.val=b,this.prev=this.next=null}return b.mixin(c.prototype,{set:function(a,b){var c,d=this.list.tail;this.size>=this.maxSize&&(this.list.remove(d),delete this.hash[d.key],this.size--),(c=this.hash[a])?(c.val=b,this.list.moveToFront(c)):(c=new e(a,b),this.list.add(c),this.hash[a]=c,this.size++)},get:function(a){var b=this.hash[a];return b?(this.list.moveToFront(b),b.val):void 0},reset:function(){this.size=0,this.hash={},this.list=new d}}),b.mixin(d.prototype,{add:function(a){this.head&&(a.next=this.head,this.head.prev=a),this.head=a,this.tail=this.tail||a},remove:function(a){a.prev?a.prev.next=a.next:this.head=a.next,a.next?a.next.prev=a.prev:this.tail=a.prev},moveToFront:function(a){this.remove(a),this.add(a)}}),c}(),f=function(){"use strict";function c(a,c){this.prefix=["__",a,"__"].join(""),this.ttlKey="__ttl__",this.keyMatcher=new RegExp("^"+b.escapeRegExChars(this.prefix)),this.ls=c||h,!this.ls&&this._noop()}function d(){return(new Date).getTime()}function e(a){return JSON.stringify(b.isUndefined(a)?null:a)}function f(b){return a.parseJSON(b)}function g(a){var b,c,d=[],e=h.length;for(b=0;e>b;b++)(c=h.key(b)).match(a)&&d.push(c.replace(a,""));return d}var h;try{h=window.localStorage,h.setItem("~~~","!"),h.removeItem("~~~")}catch(i){h=null}return b.mixin(c.prototype,{_prefix:function(a){return this.prefix+a},_ttlKey:function(a){return this._prefix(a)+this.ttlKey},_noop:function(){this.get=this.set=this.remove=this.clear=this.isExpired=b.noop},_safeSet:function(a,b){try{this.ls.setItem(a,b)}catch(c){"QuotaExceededError"===c.name&&(this.clear(),this._noop())}},get:function(a){return this.isExpired(a)&&this.remove(a),f(this.ls.getItem(this._prefix(a)))},set:function(a,c,f){return b.isNumber(f)?this._safeSet(this._ttlKey(a),e(d()+f)):this.ls.removeItem(this._ttlKey(a)),this._safeSet(this._prefix(a),e(c))},remove:function(a){return this.ls.removeItem(this._ttlKey(a)),this.ls.removeItem(this._prefix(a)),this},clear:function(){var a,b=g(this.keyMatcher);for(a=b.length;a--;)this.remove(b[a]);return this},isExpired:function(a){var c=f(this.ls.getItem(this._ttlKey(a)));return b.isNumber(c)&&d()>c?!0:!1}}),c}(),g=function(){"use strict";function c(a){a=a||{},this.cancelled=!1,this.lastReq=null,this._send=a.transport,this._get=a.limiter?a.limiter(this._get):this._get,this._cache=a.cache===!1?new e(0):h}var d=0,f={},g=6,h=new e(10);return c.setMaxPendingRequests=function(a){g=a},c.resetCache=function(){h.reset()},b.mixin(c.prototype,{_fingerprint:function(b){return b=b||{},b.url+b.type+a.param(b.data||{})},_get:function(a,b){function c(a){b(null,a),k._cache.set(i,a)}function e(){b(!0)}function h(){d--,delete f[i],k.onDeckRequestArgs&&(k._get.apply(k,k.onDeckRequestArgs),k.onDeckRequestArgs=null)}var i,j,k=this;i=this._fingerprint(a),this.cancelled||i!==this.lastReq||((j=f[i])?j.done(c).fail(e):g>d?(d++,f[i]=this._send(a).done(c).fail(e).always(h)):this.onDeckRequestArgs=[].slice.call(arguments,0))},get:function(c,d){var e,f;d=d||a.noop,c=b.isString(c)?{url:c}:c||{},f=this._fingerprint(c),this.cancelled=!1,this.lastReq=f,(e=this._cache.get(f))?d(null,e):this._get(c,d)},cancel:function(){this.cancelled=!0}}),c}(),h=window.SearchIndex=function(){"use strict";function c(c){c=c||{},c.datumTokenizer&&c.queryTokenizer||a.error("datumTokenizer and queryTokenizer are both required"),this.identify=c.identify||b.stringify,this.datumTokenizer=c.datumTokenizer,this.queryTokenizer=c.queryTokenizer,this.reset()}function d(a){return a=b.filter(a,function(a){return!!a}),a=b.map(a,function(a){return a.toLowerCase()})}function e(){var a={};return a[i]=[],a[h]={},a}function f(a){for(var b={},c=[],d=0,e=a.length;e>d;d++)b[a[d]]||(b[a[d]]=!0,c.push(a[d]));return c}function g(a,b){var c=0,d=0,e=[];a=a.sort(),b=b.sort();for(var f=a.length,g=b.length;f>c&&g>d;)a[c]b[d]?d++:(e.push(a[c]),c++,d++);return e}var h="c",i="i";return b.mixin(c.prototype,{bootstrap:function(a){this.datums=a.datums,this.trie=a.trie},add:function(a){var c=this;a=b.isArray(a)?a:[a],b.each(a,function(a){var f,g;c.datums[f=c.identify(a)]=a,g=d(c.datumTokenizer(a)),b.each(g,function(a){var b,d,g;for(b=c.trie,d=a.split("");g=d.shift();)b=b[h][g]||(b[h][g]=e()),b[i].push(f)})})},get:function(a){var c=this;return b.map(a,function(a){return c.datums[a]})},search:function(a){var c,e,j=this;return c=d(this.queryTokenizer(a)),b.each(c,function(a){var b,c,d,f;if(e&&0===e.length)return!1;for(b=j.trie,c=a.split("");b&&(d=c.shift());)b=b[h][d];return b&&0===c.length?(f=b[i].slice(0),void(e=e?g(e,f):f)):(e=[],!1)}),e?b.map(f(e),function(a){return j.datums[a]}):[]},all:function(){var a=[];for(var b in this.datums)a.push(this.datums[b]);return a},reset:function(){this.datums={},this.trie=e()},serialize:function(){return{datums:this.datums,trie:this.trie}}}),c}(),i=function(){"use strict";function a(a){this.url=a.url,this.ttl=a.ttl,this.cache=a.cache,this.prepare=a.prepare,this.transform=a.transform,this.transport=a.transport,this.thumbprint=a.thumbprint,this.storage=new f(a.cacheKey)}var c;return c={data:"data",protocol:"protocol",thumbprint:"thumbprint"},b.mixin(a.prototype,{_settings:function(){return{url:this.url,type:"GET",dataType:"json"}},store:function(a){this.cache&&(this.storage.set(c.data,a,this.ttl),this.storage.set(c.protocol,location.protocol,this.ttl),this.storage.set(c.thumbprint,this.thumbprint,this.ttl))},fromCache:function(){var a,b={};return this.cache?(b.data=this.storage.get(c.data),b.protocol=this.storage.get(c.protocol),b.thumbprint=this.storage.get(c.thumbprint),a=b.thumbprint!==this.thumbprint||b.protocol!==location.protocol,b.data&&!a?b.data:null):null},fromNetwork:function(a){function b(){a(!0)}function c(b){a(null,e.transform(b))}var d,e=this;a&&(d=this.prepare(this._settings()),this.transport(d).fail(b).done(c))},clear:function(){return this.storage.clear(),this}}),a}(),j=function(){"use strict";function a(a){this.url=a.url,this.prepare=a.prepare,this.transform=a.transform,this.transport=new g({cache:a.cache,limiter:a.limiter,transport:a.transport})}return b.mixin(a.prototype,{_settings:function(){return{url:this.url,type:"GET",dataType:"json"}},get:function(a,b){function c(a,c){b(a?[]:e.transform(c))}var d,e=this;if(b)return a=a||"",d=this.prepare(a,this._settings()),this.transport.get(d,c)},cancelLastRequest:function(){this.transport.cancel()}}),a}(),k=function(){"use strict";function d(d){var e;return d?(e={url:null,ttl:864e5,cache:!0,cacheKey:null,thumbprint:"",prepare:b.identity,transform:b.identity,transport:null},d=b.isString(d)?{url:d}:d,d=b.mixin(e,d),!d.url&&a.error("prefetch requires url to be set"),d.transform=d.filter||d.transform,d.cacheKey=d.cacheKey||d.url,d.thumbprint=c+d.thumbprint,d.transport=d.transport?h(d.transport):a.ajax,d):null}function e(c){var d;if(c)return d={url:null,cache:!0,prepare:null,replace:null,wildcard:null,limiter:null,rateLimitBy:"debounce",rateLimitWait:300,transform:b.identity,transport:null},c=b.isString(c)?{url:c}:c,c=b.mixin(d,c),!c.url&&a.error("remote requires url to be set"),c.transform=c.filter||c.transform,c.prepare=f(c),c.limiter=g(c),c.transport=c.transport?h(c.transport):a.ajax,delete c.replace,delete c.wildcard,delete c.rateLimitBy,delete c.rateLimitWait,c}function f(a){function b(a,b){return b.url=f(b.url,a),b}function c(a,b){return b.url=b.url.replace(g,encodeURIComponent(a)),b}function d(a,b){return b}var e,f,g;return e=a.prepare,f=a.replace,g=a.wildcard,e?e:e=f?b:a.wildcard?c:d}function g(a){function c(a){return function(c){return b.debounce(c,a)}}function d(a){return function(c){return b.throttle(c,a)}}var e,f,g;return e=a.limiter,f=a.rateLimitBy,g=a.rateLimitWait,e||(e=/^throttle$/i.test(f)?d(g):c(g)),e}function h(c){return function(d){function e(a){b.defer(function(){g.resolve(a)})}function f(a){b.defer(function(){g.reject(a)})}var g=a.Deferred();return c(d,e,f),g}}return function(c){var f,g;return f={initialize:!0,identify:b.stringify,datumTokenizer:null,queryTokenizer:null,sufficient:5,sorter:null,local:[],prefetch:null,remote:null},c=b.mixin(f,c||{}),!c.datumTokenizer&&a.error("datumTokenizer is required"),!c.queryTokenizer&&a.error("queryTokenizer is required"),g=c.sorter,c.sorter=g?function(a){return a.sort(g)}:b.identity,c.local=b.isFunction(c.local)?c.local():c.local,c.prefetch=d(c.prefetch),c.remote=e(c.remote),c}}(),l=function(){"use strict";function c(a){a=k(a),this.sorter=a.sorter,this.identify=a.identify,this.sufficient=a.sufficient,this.local=a.local,this.remote=a.remote?new j(a.remote):null,this.prefetch=a.prefetch?new i(a.prefetch):null,this.index=new h({identify:this.identify,datumTokenizer:a.datumTokenizer,queryTokenizer:a.queryTokenizer}),a.initialize!==!1&&this.initialize()}var e;return e=window&&window.Bloodhound,c.noConflict=function(){return window&&(window.Bloodhound=e),c},c.tokenizers=d,b.mixin(c.prototype,{__ttAdapter:function(){function a(a,b,d){return c.search(a,b,d)}function b(a,b){return c.search(a,b)}var c=this;return this.remote?a:b},_loadPrefetch:function(){function b(a,b){return a?c.reject():(e.add(b),e.prefetch.store(e.index.serialize()),void c.resolve())}var c,d,e=this;return c=a.Deferred(),this.prefetch?(d=this.prefetch.fromCache())?(this.index.bootstrap(d),c.resolve()):this.prefetch.fromNetwork(b):c.resolve(),c.promise()},_initialize:function(){function a(){b.add(b.local)}var b=this;return this.clear(),(this.initPromise=this._loadPrefetch()).done(a),this.initPromise},initialize:function(a){return!this.initPromise||a?this._initialize():this.initPromise},add:function(a){return this.index.add(a),this},get:function(a){return a=b.isArray(a)?a:[].slice.call(arguments),this.index.get(a)},search:function(a,c,d){function e(a){var c=[];b.each(a,function(a){!b.some(f,function(b){return g.identify(a)===g.identify(b)})&&c.push(a)}),d&&d(c)}var f,g=this;return f=this.sorter(this.index.search(a)),c(this.remote?f.slice():f),this.remote&&f.length=j?(clearTimeout(e),e=null,g=i,f=a.apply(c,d)):e||(e=setTimeout(h,j)),f}},stringify:function(a){return b.isString(a)?a:JSON.stringify(a)},noop:function(){}}}(),c=function(){"use strict";function a(a){var g,h;return h=b.mixin({},f,a),g={css:e(),classes:h,html:c(h),selectors:d(h)},{css:g.css,html:g.html,classes:g.classes,selectors:g.selectors,mixin:function(a){b.mixin(a,g)}}}function c(a){return{wrapper:'',menu:'
'}}function d(a){var c={};return b.each(a,function(a,b){c[b]="."+a}),c}function e(){var a={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 b.isMsie()&&b.mixin(a.input,{backgroundImage:"url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)"}),a}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 a}(),d=function(){"use strict";function c(b){b&&b.el||a.error("EventBus initialized without el"),this.$el=a(b.el)}var d,e;return d="typeahead:",e={render:"rendered",cursorchange:"cursorchanged",select:"selected",autocomplete:"autocompleted"},b.mixin(c.prototype,{_trigger:function(b,c){var e;return e=a.Event(d+b),(c=c||[]).unshift(e),this.$el.trigger.apply(this.$el,c),e},before:function(a){var b,c;return b=[].slice.call(arguments,1),c=this._trigger("before"+a,b),c.isDefaultPrevented()},trigger:function(a){var b;this._trigger(a,[].slice.call(arguments,1)),(b=e[a])&&this._trigger(b,[].slice.call(arguments,1))}}),c}(),e=function(){"use strict";function a(a,b,c,d){var e;if(!c)return this;for(b=b.split(i),c=d?h(c,d):c,this._callbacks=this._callbacks||{};e=b.shift();)this._callbacks[e]=this._callbacks[e]||{sync:[],async:[]},this._callbacks[e][a].push(c);return this}function b(b,c,d){return a.call(this,"async",b,c,d)}function c(b,c,d){return a.call(this,"sync",b,c,d)}function d(a){var b;if(!this._callbacks)return this;for(a=a.split(i);b=a.shift();)delete this._callbacks[b];return this}function e(a){var b,c,d,e,g;if(!this._callbacks)return this;for(a=a.split(i),d=[].slice.call(arguments,1);(b=a.shift())&&(c=this._callbacks[b]);)e=f(c.sync,this,[b].concat(d)),g=f(c.async,this,[b].concat(d)),e()&&j(g);return this}function f(a,b,c){function d(){for(var d,e=0,f=a.length;!d&&f>e;e+=1)d=a[e].apply(b,c)===!1;return!d}return d}function g(){var a;return a=window.setImmediate?function(a){setImmediate(function(){a()})}:function(a){setTimeout(function(){a()},0)}}function h(a,b){return a.bind?a.bind(b):function(){a.apply(b,[].slice.call(arguments,0))}}var i=/\s+/,j=g();return{onSync:c,onAsync:b,off:d,trigger:e}}(),f=function(a){"use strict";function c(a,c,d){for(var e,f=[],g=0,h=a.length;h>g;g++)f.push(b.escapeRegExChars(a[g]));return e=d?"\\b("+f.join("|")+")\\b":"("+f.join("|")+")",c?new RegExp(e):new RegExp(e,"i")}var d={node:null,pattern:null,tagName:"strong",className:null,wordsOnly:!1,caseSensitive:!1};return function(e){function f(b){var c,d,f;return(c=h.exec(b.data))&&(f=a.createElement(e.tagName),e.className&&(f.className=e.className),d=b.splitText(c.index),d.splitText(c[0].length),f.appendChild(d.cloneNode(!0)),b.parentNode.replaceChild(f,d)),!!c}function g(a,b){for(var c,d=3,e=0;e