").append(st.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,a||[e.responseText,t,e])}),this},st.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){st.fn[t]=function(e){return this.on(t,e)}}),st.each(["get","post"],function(e,n){st[n]=function(e,r,i,o){return st.isFunction(r)&&(o=o||i,i=r,r=t),st.ajax({url:e,type:n,dataType:o,data:r,success:i})}}),st.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Dn,type:"GET",isLocal:Fn.test(jn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":In,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":st.parseJSON,"text xml":st.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?H(H(e,st.ajaxSettings),t):H(st.ajaxSettings,e)},ajaxPrefilter:D(Wn),ajaxTransport:D($n),ajax:function(e,n){function r(e,n,r,s){var l,f,v,b,T,N=n;2!==x&&(x=2,u&&clearTimeout(u),i=t,a=s||"",w.readyState=e>0?4:0,r&&(b=M(p,w,r)),e>=200&&300>e||304===e?(p.ifModified&&(T=w.getResponseHeader("Last-Modified"),T&&(st.lastModified[o]=T),T=w.getResponseHeader("etag"),T&&(st.etag[o]=T)),304===e?(l=!0,N="notmodified"):(l=q(p,b),N=l.state,f=l.data,v=l.error,l=!v)):(v=N,(e||!N)&&(N="error",0>e&&(e=0))),w.status=e,w.statusText=(n||N)+"",l?g.resolveWith(d,[f,N,w]):g.rejectWith(d,[w,N,v]),w.statusCode(y),y=t,c&&h.trigger(l?"ajaxSuccess":"ajaxError",[w,p,l?f:v]),m.fireWith(d,[w,N]),c&&(h.trigger("ajaxComplete",[w,p]),--st.active||st.event.trigger("ajaxStop")))}"object"==typeof e&&(n=e,e=t),n=n||{};var i,o,a,s,u,l,c,f,p=st.ajaxSetup({},n),d=p.context||p,h=p.context&&(d.nodeType||d.jquery)?st(d):st.event,g=st.Deferred(),m=st.Callbacks("once memory"),y=p.statusCode||{},v={},b={},x=0,T="canceled",w={readyState:0,getResponseHeader:function(e){var t;if(2===x){if(!s)for(s={};t=_n.exec(a);)s[t[1].toLowerCase()]=t[2];t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===x?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return x||(e=b[n]=b[n]||e,v[e]=t),this},overrideMimeType:function(e){return x||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>x)for(t in e)y[t]=[y[t],e[t]];else w.always(e[w.status]);return this},abort:function(e){var t=e||T;return i&&i.abort(t),r(0,t),this}};if(g.promise(w).complete=m.add,w.success=w.done,w.error=w.fail,p.url=((e||p.url||Dn)+"").replace(Mn,"").replace(Bn,jn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=st.trim(p.dataType||"*").toLowerCase().match(lt)||[""],null==p.crossDomain&&(l=Pn.exec(p.url.toLowerCase()),p.crossDomain=!(!l||l[1]===jn[1]&&l[2]===jn[2]&&(l[3]||("http:"===l[1]?80:443))==(jn[3]||("http:"===jn[1]?80:443)))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=st.param(p.data,p.traditional)),L(Wn,p,n,w),2===x)return w;c=p.global,c&&0===st.active++&&st.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!On.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(Hn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=qn.test(o)?o.replace(qn,"$1_="+Ln++):o+(Hn.test(o)?"&":"?")+"_="+Ln++)),p.ifModified&&(st.lastModified[o]&&w.setRequestHeader("If-Modified-Since",st.lastModified[o]),st.etag[o]&&w.setRequestHeader("If-None-Match",st.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&w.setRequestHeader("Content-Type",p.contentType),w.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+In+"; q=0.01":""):p.accepts["*"]);for(f in p.headers)w.setRequestHeader(f,p.headers[f]);if(p.beforeSend&&(p.beforeSend.call(d,w,p)===!1||2===x))return w.abort();T="abort";for(f in{success:1,error:1,complete:1})w[f](p[f]);if(i=L($n,p,n,w)){w.readyState=1,c&&h.trigger("ajaxSend",[w,p]),p.async&&p.timeout>0&&(u=setTimeout(function(){w.abort("timeout")},p.timeout));try{x=1,i.send(v,r)}catch(N){if(!(2>x))throw N;r(-1,N)}}else r(-1,"No Transport");return w},getScript:function(e,n){return st.get(e,t,n,"script")},getJSON:function(e,t,n){return st.get(e,t,n,"json")}}),st.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return st.globalEval(e),e}}}),st.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),st.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=V.head||st("head")[0]||V.documentElement;return{send:function(t,i){n=V.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var Xn=[],Un=/(=)\?(?=&|$)|\?\?/;st.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Xn.pop()||st.expando+"_"+Ln++;return this[e]=!0,e}}),st.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,u=n.jsonp!==!1&&(Un.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Un.test(n.data)&&"data");return u||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=st.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,u?n[u]=n[u].replace(Un,"$1"+o):n.jsonp!==!1&&(n.url+=(Hn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||st.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,Xn.push(o)),s&&st.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Vn,Yn,Jn=0,Gn=e.ActiveXObject&&function(){var e;for(e in Vn)Vn[e](t,!0)};st.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&_()||F()}:_,Yn=st.ajaxSettings.xhr(),st.support.cors=!!Yn&&"withCredentials"in Yn,Yn=st.support.ajax=!!Yn,Yn&&st.ajaxTransport(function(n){if(!n.crossDomain||st.support.cors){var r;return{send:function(i,o){var a,s,u=n.xhr();if(n.username?u.open(n.type,n.url,n.async,n.username,n.password):u.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)u[s]=n.xhrFields[s];n.mimeType&&u.overrideMimeType&&u.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)u.setRequestHeader(s,i[s])}catch(l){}u.send(n.hasContent&&n.data||null),r=function(e,i){var s,l,c,f,p;try{if(r&&(i||4===u.readyState))if(r=t,a&&(u.onreadystatechange=st.noop,Gn&&delete Vn[a]),i)4!==u.readyState&&u.abort();else{f={},s=u.status,p=u.responseXML,c=u.getAllResponseHeaders(),p&&p.documentElement&&(f.xml=p),"string"==typeof u.responseText&&(f.text=u.responseText);try{l=u.statusText}catch(d){l=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=f.text?200:404}}catch(h){i||o(-1,h)}f&&o(s,l,f,c)},n.async?4===u.readyState?setTimeout(r):(a=++Jn,Gn&&(Vn||(Vn={},st(e).unload(Gn)),Vn[a]=r),u.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Qn,Kn,Zn=/^(?:toggle|show|hide)$/,er=RegExp("^(?:([+-])=|)("+ut+")([a-z%]*)$","i"),tr=/queueHooks$/,nr=[W],rr={"*":[function(e,t){var n,r,i=this.createTween(e,t),o=er.exec(t),a=i.cur(),s=+a||0,u=1,l=20;if(o){if(n=+o[2],r=o[3]||(st.cssNumber[e]?"":"px"),"px"!==r&&s){s=st.css(i.elem,e,!0)||n||1;do u=u||".5",s/=u,st.style(i.elem,e,s+r);while(u!==(u=i.cur()/a)&&1!==u&&--l)}i.unit=r,i.start=s,i.end=o[1]?s+(o[1]+1)*n:n}return i}]};st.Animation=st.extend(P,{tweener:function(e,t){st.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");for(var n,r=0,i=e.length;i>r;r++)n=e[r],rr[n]=rr[n]||[],rr[n].unshift(t)},prefilter:function(e,t){t?nr.unshift(e):nr.push(e)}}),st.Tween=$,$.prototype={constructor:$,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(st.cssNumber[n]?"":"px")},cur:function(){var e=$.propHooks[this.prop];return e&&e.get?e.get(this):$.propHooks._default.get(this)},run:function(e){var t,n=$.propHooks[this.prop];return this.pos=t=this.options.duration?st.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):$.propHooks._default.set(this),this}},$.prototype.init.prototype=$.prototype,$.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=st.css(e.elem,e.prop,"auto"),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){st.fx.step[e.prop]?st.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[st.cssProps[e.prop]]||st.cssHooks[e.prop])?st.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},$.propHooks.scrollTop=$.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},st.each(["toggle","show","hide"],function(e,t){var n=st.fn[t];st.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(I(t,!0),e,r,i)}}),st.fn.extend({fadeTo:function(e,t,n,r){return this.filter(w).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=st.isEmptyObject(e),o=st.speed(t,n,r),a=function(){var t=P(this,st.extend({},e),o);a.finish=function(){t.stop(!0)},(i||st._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=st.timers,a=st._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&tr.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&st.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=st._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=st.timers,a=r?r.length:0;for(n.finish=!0,st.queue(this,e,[]),i&&i.cur&&i.cur.finish&&i.cur.finish.call(this),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}}),st.each({slideDown:I("show"),slideUp:I("hide"),slideToggle:I("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){st.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),st.speed=function(e,t,n){var r=e&&"object"==typeof e?st.extend({},e):{complete:n||!n&&t||st.isFunction(e)&&e,duration:e,easing:n&&t||t&&!st.isFunction(t)&&t};return r.duration=st.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in st.fx.speeds?st.fx.speeds[r.duration]:st.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){st.isFunction(r.old)&&r.old.call(this),r.queue&&st.dequeue(this,r.queue)},r},st.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},st.timers=[],st.fx=$.prototype.init,st.fx.tick=function(){var e,n=st.timers,r=0;for(Qn=st.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||st.fx.stop(),Qn=t},st.fx.timer=function(e){e()&&st.timers.push(e)&&st.fx.start()},st.fx.interval=13,st.fx.start=function(){Kn||(Kn=setInterval(st.fx.tick,st.fx.interval))},st.fx.stop=function(){clearInterval(Kn),Kn=null},st.fx.speeds={slow:600,fast:200,_default:400},st.fx.step={},st.expr&&st.expr.filters&&(st.expr.filters.animated=function(e){return st.grep(st.timers,function(t){return e===t.elem}).length}),st.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){st.offset.setOffset(this,e,t)});var n,r,i={top:0,left:0},o=this[0],a=o&&o.ownerDocument;if(a)return n=a.documentElement,st.contains(n,o)?(o.getBoundingClientRect!==t&&(i=o.getBoundingClientRect()),r=z(a),{top:i.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:i.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):i},st.offset={setOffset:function(e,t,n){var r=st.css(e,"position");"static"===r&&(e.style.position="relative");var i,o,a=st(e),s=a.offset(),u=st.css(e,"top"),l=st.css(e,"left"),c=("absolute"===r||"fixed"===r)&&st.inArray("auto",[u,l])>-1,f={},p={};c?(p=a.position(),i=p.top,o=p.left):(i=parseFloat(u)||0,o=parseFloat(l)||0),st.isFunction(t)&&(t=t.call(e,n,s)),null!=t.top&&(f.top=t.top-s.top+i),null!=t.left&&(f.left=t.left-s.left+o),"using"in t?t.using.call(e,f):a.css(f)}},st.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===st.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),st.nodeName(e[0],"html")||(n=e.offset()),n.top+=st.css(e[0],"borderTopWidth",!0),n.left+=st.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-st.css(r,"marginTop",!0),left:t.left-n.left-st.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent||V.documentElement;e&&!st.nodeName(e,"html")&&"static"===st.css(e,"position");)e=e.offsetParent;return e||V.documentElement})}}),st.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);st.fn[e]=function(i){return st.access(this,function(e,i,o){var a=z(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?st(a).scrollLeft():o,r?o:st(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}}),st.each({Height:"height",Width:"width"},function(e,n){st.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){st.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return st.access(this,function(n,r,i){var o;return st.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?st.css(n,r,s):st.style(n,r,i,s)},n,a?i:t,a,null)}})}),e.jQuery=e.$=st,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return st})})(window);
+//@ sourceMappingURL=jquery.min.map
\ No newline at end of file
diff --git a/_patternlab-files/styleguide/js/vendor/jwerty.js b/_patternlab-files/styleguide/js/vendor/jwerty.js
new file mode 100644
index 0000000..2ba7730
--- /dev/null
+++ b/_patternlab-files/styleguide/js/vendor/jwerty.js
@@ -0,0 +1,523 @@
+/*
+ * jwerty - Awesome handling of keyboard events
+ *
+ * jwerty is a JS lib which allows you to bind, fire and assert key combination
+ * strings against elements and events. It normalises the poor std api into
+ * something easy to use and clear.
+ *
+ * This code is licensed under the MIT
+ * For the full license see: http://keithamus.mit-license.org/
+ * For more information see: http://keithamus.github.com/jwerty
+ *
+ * @author Keith Cirkel ('keithamus')
+ * @license http://keithamus.mit-license.org/
+ * @copyright Copyright © 2011, Keith Cirkel
+ *
+ */
+(function (global, exports) {
+
+ // Helper methods & vars:
+ var $d = global.document,
+ $ = (global.jQuery || global.Zepto || global.ender || $d),
+ $$, // Element selector function
+ $b, // Event binding function
+ $f, // Event firing function
+ ke = 'keydown';
+
+ function realTypeOf(v, s) {
+ return (v === null) ? s === 'null'
+ : (v === undefined) ? s === 'undefined'
+ : (v.is && v instanceof $) ? s === 'element'
+ : Object.prototype.toString.call(v).toLowerCase().indexOf(s) > 7;
+ }
+
+ if ($ === $d) {
+ $$ = function (selector, context) {
+ return selector ? $.querySelector(selector, context || $) : $;
+ };
+ $b = function (e, fn) { e.addEventListener(ke, fn, false); };
+ $f = function (e, jwertyEv) {
+ var ret = $d.createEvent('Event'),
+ i;
+
+ ret.initEvent(ke, true, true);
+
+ for (i in jwertyEv) ret[i] = jwertyEv[i];
+
+ return (e || $).dispatchEvent(ret);
+ };
+ } else {
+ $$ = function (selector, context) { return $(selector || $d, context); };
+ $b = function (e, fn) { $(e).bind(ke + '.jwerty', fn); };
+ $f = function (e, ob) { $(e || $d).trigger($.Event(ke, ob)); };
+ }
+
+ // Private
+ var _modProps = { 16: 'shiftKey', 17: 'ctrlKey', 18: 'altKey', 91: 'metaKey' };
+
+ // Generate key mappings for common keys that are not printable.
+ var _keys = {
+
+ // MOD aka toggleable keys
+ mods: {
+ // Shift key, ⇧
+ '⇧': 16,
+ shift: 16,
+ // CTRL key, on Mac: ⌃
+ '⌃': 17,
+ ctrl: 17,
+ // ALT key, on Mac: ⌥ (Alt)
+ '⌥': 18,
+ alt: 18,
+ option: 18,
+ // META, on Mac: ⌘ (CMD), on Windows (Win), on Linux (Super)
+ '⌘': 91,
+ meta: 91,
+ cmd: 91,
+ 'super': 91,
+ win: 91
+ },
+
+ // Normal keys
+ keys: {
+ // Backspace key, on Mac: ⌫ (Backspace)
+ '⌫': 8,
+ backspace: 8,
+ // Tab Key, on Mac: ⇥ (Tab), on Windows ⇥⇥
+ '⇥': 9,
+ '⇆': 9,
+ tab: 9,
+ // Return key, ↩
+ '↩': 13,
+ 'return': 13,
+ enter: 13,
+ '⌅': 13,
+ // Pause/Break key
+ 'pause': 19,
+ 'pause-break': 19,
+ // Caps Lock key, ⇪
+ '⇪': 20,
+ caps: 20,
+ 'caps-lock': 20,
+ // Escape key, on Mac: ⎋, on Windows: Esc
+ '⎋': 27,
+ escape: 27,
+ esc: 27,
+ // Space key
+ space: 32,
+ // Page-Up key, or pgup, on Mac: ↖
+ '↖': 33,
+ pgup: 33,
+ 'page-up': 33,
+ // Page-Down key, or pgdown, on Mac: ↘
+ '↘': 34,
+ pgdown: 34,
+ 'page-down': 34,
+ // END key, on Mac: ⇟
+ '⇟': 35,
+ end: 35,
+ // HOME key, on Mac: ⇞
+ '⇞': 36,
+ home: 36,
+ // Insert key, or ins
+ ins: 45,
+ insert: 45,
+ // Delete key, on Mac: ⌫ (Delete)
+ del: 46,
+ 'delete': 46,
+
+ // Left Arrow Key, or ←
+ '←': 37,
+ left: 37,
+ 'arrow-left': 37,
+ // Up Arrow Key, or ↑
+ '↑': 38,
+ up: 38,
+ 'arrow-up': 38,
+ // Right Arrow Key, or →
+ '→': 39,
+ right: 39,
+ 'arrow-right': 39,
+ // Up Arrow Key, or ↓
+ '↓': 40,
+ down: 40,
+ 'arrow-down': 40,
+
+ // odities, printing characters that come out wrong:
+ // Num-Multiply, or *
+ '*': 106,
+ star: 106,
+ asterisk: 106,
+ multiply: 106,
+ // Num-Plus or +
+ '+': 107,
+ 'plus': 107,
+ // Num-Subtract, or -
+ '-': 109,
+ subtract: 109,
+ 'num-.': 110,
+ 'num-period': 110,
+ 'num-dot': 110,
+ 'num-full-stop': 110,
+ 'num-delete': 110,
+ // Semicolon
+ ';': 186,
+ semicolon: 186,
+ // = or equals
+ '=': 187,
+ 'equals': 187,
+ // Comma, or ,
+ ',': 188,
+ comma: 188,
+ //'-': 189, //???
+ // Period, or ., or full-stop
+ '.': 190,
+ period: 190,
+ 'full-stop': 190,
+ // Slash, or /, or forward-slash
+ '/': 191,
+ slash: 191,
+ 'forward-slash': 191,
+ // Tick, or `, or back-quote
+ '`': 192,
+ tick: 192,
+ 'back-quote': 192,
+ // Open bracket, or [
+ '[': 219,
+ 'open-bracket': 219,
+ // Back slash, or \
+ '\\': 220,
+ 'back-slash': 220,
+ // Close backet, or ]
+ ']': 221,
+ 'close-bracket': 221,
+ // Apostraphe, or Quote, or '
+ '\'': 222,
+ quote: 222,
+ apostraphe: 222
+ }
+
+ };
+
+ // To minimise code bloat, add all of the 0-9 and NUMPAD 0-9 keys in a loop
+ var i = 47,
+ n = 0;
+ while (++i < 106) {
+ _keys.keys[n] = i;
+ _keys.keys['num-' + n] = i + 48;
+ ++n;
+ }
+
+ // To minimise code bloat, add all of the F1-F25 keys in a loop
+ i = 111,
+ n = 1;
+ while (++i < 136) {
+ _keys.keys['f' + n] = i;
+ ++n;
+ }
+
+ // To minimise code bloat, add all of the letters of the alphabet in a loop
+ i = 64;
+ while (++i < 91) {
+ _keys.keys[String.fromCharCode(i).toLowerCase()] = i;
+ }
+
+ function JwertyCode(jwertyCode) {
+ var i,
+ c,
+ n,
+ z,
+ keyCombo,
+ optionals,
+ jwertyCodeFragment,
+ rangeMatches,
+ rangeI;
+
+ // In-case we get called with an instance of ourselves, just return that.
+ if (jwertyCode instanceof JwertyCode) return jwertyCode;
+
+ // If jwertyCode isn't an array, cast it as a string and split into array.
+ if (!realTypeOf(jwertyCode, 'array')) {
+ jwertyCode = (String(jwertyCode)).replace(/\s/g, '').toLowerCase()
+ .match(/(?:\+,|[^,])+/g);
+ }
+
+ // Loop through each key sequence in jwertyCode
+ for (i = 0, c = jwertyCode.length; i < c; ++i) {
+
+ // If the key combo at this part of the sequence isn't an array,
+ // cast as a string and split into an array.
+ if (!realTypeOf(jwertyCode[i], 'array')) {
+ jwertyCode[i] = String(jwertyCode[i])
+ .match(/(?:\+\/|[^\/])+/g);
+ }
+
+ // Parse the key optionals in this sequence
+ optionals = [],
+ n = jwertyCode[i].length;
+ while (n--) {
+
+ // Begin creating the object for this key combo
+ jwertyCodeFragment = jwertyCode[i][n];
+
+ keyCombo = {
+ jwertyCombo: String(jwertyCodeFragment),
+ shiftKey: false,
+ ctrlKey: false,
+ altKey: false,
+ metaKey: false
+ };
+
+ // If jwertyCodeFragment isn't an array then cast as a string
+ // and split it into one.
+ if (!realTypeOf(jwertyCodeFragment, 'array')) {
+ jwertyCodeFragment = String(jwertyCodeFragment).toLowerCase()
+ .match(/(?:(?:[^\+])+|\+\+|^\+$)/g);
+ }
+
+ z = jwertyCodeFragment.length;
+ while (z--) {
+
+ // Normalise matching errors
+ if (jwertyCodeFragment[z] === '++') jwertyCodeFragment[z] = '+';
+
+ // Inject either keyCode or ctrl/meta/shift/altKey into keyCombo
+ if (jwertyCodeFragment[z] in _keys.mods) {
+ keyCombo[_modProps[_keys.mods[jwertyCodeFragment[z]]]] = true;
+ } else if (jwertyCodeFragment[z] in _keys.keys) {
+ keyCombo.keyCode = _keys.keys[jwertyCodeFragment[z]];
+ } else {
+ rangeMatches = jwertyCodeFragment[z].match(/^\[([^-]+\-?[^-]*)-([^-]+\-?[^-]*)\]$/);
+ }
+ }
+ if (realTypeOf(keyCombo.keyCode, 'undefined')) {
+ // If we picked up a range match earlier...
+ if (rangeMatches && (rangeMatches[1] in _keys.keys) && (rangeMatches[2] in _keys.keys)) {
+ rangeMatches[2] = _keys.keys[rangeMatches[2]];
+ rangeMatches[1] = _keys.keys[rangeMatches[1]];
+
+ // Go from match 1 and capture all key-comobs up to match 2
+ for (rangeI = rangeMatches[1]; rangeI < rangeMatches[2]; ++rangeI) {
+ optionals.push({
+ altKey: keyCombo.altKey,
+ shiftKey: keyCombo.shiftKey,
+ metaKey: keyCombo.metaKey,
+ ctrlKey: keyCombo.ctrlKey,
+ keyCode: rangeI,
+ jwertyCombo: String(jwertyCodeFragment)
+ });
+
+ }
+ keyCombo.keyCode = rangeI;
+ // Inject either keyCode or ctrl/meta/shift/altKey into keyCombo
+ } else {
+ keyCombo.keyCode = 0;
+ }
+ }
+ optionals.push(keyCombo);
+
+ }
+ this[i] = optionals;
+ }
+ this.length = i;
+ return this;
+ }
+
+ var jwerty = exports.jwerty = {
+ /**
+ * jwerty.event
+ *
+ * `jwerty.event` will return a function, which expects the first
+ * argument to be a key event. When the key event matches `jwertyCode`,
+ * `callbackFunction` is fired. `jwerty.event` is used by `jwerty.key`
+ * to bind the function it returns. `jwerty.event` is useful for
+ * attaching to your own event listeners. It can be used as a decorator
+ * method to encapsulate functionality that you only want to fire after
+ * a specific key combo. If `callbackContext` is specified then it will
+ * be supplied as `callbackFunction`'s context - in other words, the
+ * keyword `this` will be set to `callbackContext` inside the
+ * `callbackFunction` function.
+ *
+ * @param {Mixed} jwertyCode can be an array, or string of key
+ * combinations, which includes optinals and or sequences
+ * @param {Function} callbackFucntion is a function (or boolean) which
+ * is fired when jwertyCode is matched. Return false to
+ * preventDefault()
+ * @param {Object} callbackContext (Optional) The context to call
+ * `callback` with (i.e this)
+ *
+ */
+ event: function (jwertyCode, callbackFunction, callbackContext /*? this */) {
+
+ // Construct a function out of callbackFunction, if it is a boolean.
+ if (realTypeOf(callbackFunction, 'boolean')) {
+ var bool = callbackFunction;
+ callbackFunction = function () { return bool; };
+ }
+
+ jwertyCode = new JwertyCode(jwertyCode);
+
+ // Initialise in-scope vars.
+ var i = 0,
+ c = jwertyCode.length - 1,
+ returnValue,
+ jwertyCodeIs;
+
+ // This is the event listener function that gets returned...
+ return function (event) {
+
+ // if jwertyCodeIs returns truthy (string)...
+ if ((jwertyCodeIs = jwerty.is(jwertyCode, event, i))) {
+ // ... and this isn't the last key in the sequence,
+ // incriment the key in sequence to check.
+ if (i < c) {
+ ++i;
+ return;
+ // ... and this is the last in the sequence (or the only
+ // one in sequence), then fire the callback
+ } else {
+ returnValue = callbackFunction.call(
+ callbackContext || this, event, jwertyCodeIs);
+
+ // If the callback returned false, then we should run
+ // preventDefault();
+ if (returnValue === false) event.preventDefault();
+
+ // Reset i for the next sequence to fire.
+ i = 0;
+ return;
+ }
+ }
+
+ // If the event didn't hit this time, we should reset i to 0,
+ // that is, unless this combo was the first in the sequence,
+ // in which case we should reset i to 1.
+ i = jwerty.is(jwertyCode, event) ? 1 : 0;
+ };
+ },
+
+ /**
+ * jwerty.is
+ *
+ * `jwerty.is` will return a boolean value, based on if `event` matches
+ * `jwertyCode`. `jwerty.is` is called by `jwerty.event` to check
+ * whether or not to fire the callback. `event` can be a DOM event, or
+ * a jQuery/Zepto/Ender manufactured event. The properties of
+ * `jwertyCode` (speficially ctrlKey, altKey, metaKey, shiftKey and
+ * keyCode) should match `jwertyCode`'s properties - if they do, then
+ * `jwerty.is` will return `true`. If they don't, `jwerty.is` will
+ * return `false`.
+ *
+ * @param {Mixed} jwertyCode can be an array, or string of key
+ * combinations, which includes optinals and or sequences
+ * @param {KeyboardEvent} event is the KeyboardEvent to assert against
+ * @param {Integer} i (Optional) checks the `i` key in jwertyCode
+ * sequence
+ *
+ */
+ is: function (jwertyCode, event, i /*? 0*/) {
+ jwertyCode = new JwertyCode(jwertyCode);
+ // Default `i` to 0
+ i = i || 0;
+ // We are only interested in `i` of jwertyCode;
+ jwertyCode = jwertyCode[i];
+ // jQuery stores the *real* event in `originalEvent`, which we use
+ // because it does annoything stuff to `metaKey`
+ event = event.originalEvent || event;
+
+ // We'll look at each optional in this jwertyCode sequence...
+ var n = jwertyCode.length,
+ returnValue = false;
+
+ // Loop through each fragment of jwertyCode
+ while (n--) {
+ returnValue = jwertyCode[n].jwertyCombo;
+ // For each property in the jwertyCode object, compare to `event`
+ for (var p in jwertyCode[n]) {
+ // ...except for jwertyCode.jwertyCombo...
+ if (p !== 'jwertyCombo' && event[p] != jwertyCode[n][p]) returnValue = false;
+ }
+ // If this jwertyCode optional wasn't falsey, then we can return early.
+ if (returnValue !== false) return returnValue;
+ }
+ return returnValue;
+ },
+
+ /**
+ * jwerty.key
+ *
+ * `jwerty.key` will attach an event listener and fire
+ * `callbackFunction` when `jwertyCode` matches. The event listener is
+ * attached to `document`, meaning it will listen for any key events
+ * on the page (a global shortcut listener). If `callbackContext` is
+ * specified then it will be supplied as `callbackFunction`'s context
+ * - in other words, the keyword `this` will be set to
+ * `callbackContext` inside the `callbackFunction` function.
+ *
+ * @param {Mixed} jwertyCode can be an array, or string of key
+ * combinations, which includes optinals and or sequences
+ * @param {Function} callbackFunction is a function (or boolean) which
+ * is fired when jwertyCode is matched. Return false to
+ * preventDefault()
+ * @param {Object} callbackContext (Optional) The context to call
+ * `callback` with (i.e this)
+ * @param {Mixed} selector can be a string, jQuery/Zepto/Ender object,
+ * or an HTML*Element on which to bind the eventListener
+ * @param {Mixed} selectorContext can be a string, jQuery/Zepto/Ender
+ * object, or an HTML*Element on which to scope the selector
+ *
+ */
+ key: function (jwertyCode, callbackFunction, callbackContext /*? this */, selector /*? document */, selectorContext /*? body */) {
+ // Because callbackContext is optional, we should check if the
+ // `callbackContext` is a string or element, and if it is, then the
+ // function was called without a context, and `callbackContext` is
+ // actually `selector`
+ var realSelector = realTypeOf(callbackContext, 'element') || realTypeOf(callbackContext, 'string') ? callbackContext : selector,
+ // If `callbackContext` is undefined, or if we skipped it (and
+ // therefore it is `realSelector`), set context to `global`.
+ realcallbackContext = realSelector === callbackContext ? global : callbackContext,
+ // Finally if we did skip `callbackContext`, then shift
+ // `selectorContext` to the left (take it from `selector`)
+ realSelectorContext = realSelector === callbackContext ? selector : selectorContext;
+
+ // If `realSelector` is already a jQuery/Zepto/Ender/DOM element,
+ // then just use it neat, otherwise find it in DOM using $$()
+ $b(
+ realTypeOf(realSelector, 'element') ? realSelector : $$(realSelector, realSelectorContext),
+ jwerty.event(jwertyCode, callbackFunction, realcallbackContext)
+ );
+ },
+
+ /**
+ * jwerty.fire
+ *
+ * `jwerty.fire` will construct a keyup event to fire, based on
+ * `jwertyCode`. The event will be fired against `selector`.
+ * `selectorContext` is used to search for `selector` within
+ * `selectorContext`, similar to jQuery's
+ * `$('selector', 'context')`.
+ *
+ * @param {Mixed} jwertyCode can be an array, or string of key
+ * combinations, which includes optinals and or sequences
+ * @param {Mixed} selector can be a string, jQuery/Zepto/Ender object,
+ * or an HTML*Element on which to bind the eventListener
+ * @param {Mixed} selectorContext can be a string, jQuery/Zepto/Ender
+ * object, or an HTML*Element on which to scope the selector
+ *
+ */
+ fire: function (jwertyCode, selector /*? document */, selectorContext /*? body */, i) {
+ jwertyCode = new JwertyCode(jwertyCode);
+ var realI = realTypeOf(selectorContext, 'number') ? selectorContext : i;
+
+ // If `realSelector` is already a jQuery/Zepto/Ender/DOM element,
+ // then just use it neat, otherwise find it in DOM using $$()
+ $f(
+ realTypeOf(selector, 'element') ? selector : $$(selector, selectorContext),
+ jwertyCode[realI || 0][0]
+ );
+ },
+
+ KEYS: _keys
+ };
+
+}(this, (typeof module !== 'undefined' && module.exports ? module.exports : this)));
\ No newline at end of file
diff --git a/_patternlab-files/styleguide/js/vendor/prism.js b/_patternlab-files/styleguide/js/vendor/prism.js
new file mode 100644
index 0000000..40287b9
--- /dev/null
+++ b/_patternlab-files/styleguide/js/vendor/prism.js
@@ -0,0 +1,7 @@
+/**
+ * Prism: Lightweight, robust, elegant syntax highlighting
+ * MIT license http://www.opensource.org/licenses/mit-license.php/
+ * @author Lea Verou http://lea.verou.me
+ */(function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=self.Prism={util:{type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},clone:function(e){var n=t.util.type(e);switch(n){case"Object":var r={};for(var i in e)e.hasOwnProperty(i)&&(r[i]=t.util.clone(e[i]));return r;case"Array":return e.slice()}return e}},languages:{extend:function(e,n){var r=t.util.clone(t.languages[e]);for(var i in n)r[i]=n[i];return r},insertBefore:function(e,n,r,i){i=i||t.languages;var s=i[e],o={};for(var u in s)if(s.hasOwnProperty(u)){if(u==n)for(var a in r)r.hasOwnProperty(a)&&(o[a]=r[a]);o[u]=s[u]}return i[e]=o},DFS:function(e,n){for(var r in e){n.call(e,r,e[r]);t.util.type(e)==="Object"&&t.languages.DFS(e[r],n)}}},highlightAll:function(e,n){var r=document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code');for(var i=0,s;s=r[i++];)t.highlightElement(s,e===!0,n)},highlightElement:function(r,i,s){var o,u,a=r;while(a&&!e.test(a.className))a=a.parentNode;if(a){o=(a.className.match(e)||[,""])[1];u=t.languages[o]}if(!u)return;r.className=r.className.replace(e,"").replace(/\s+/g," ")+" language-"+o;a=r.parentNode;/pre/i.test(a.nodeName)&&(a.className=a.className.replace(e,"").replace(/\s+/g," ")+" language-"+o);var f=r.textContent;if(!f)return;f=f.replace(/&/g,"&").replace(/e.length)break e;if(p instanceof i)continue;a.lastIndex=0;var d=a.exec(p);if(d){l&&(c=d[1].length);var v=d.index-1+c,d=d[0].slice(c),m=d.length,g=v+m,y=p.slice(0,v+1),b=p.slice(g+1),w=[h,1];y&&w.push(y);var E=new i(u,f?t.tokenize(d,f):d);w.push(E);b&&w.push(b);Array.prototype.splice.apply(s,w)}}}return s},hooks:{all:{},add:function(e,n){var r=t.hooks.all;r[e]=r[e]||[];r[e].push(n)},run:function(e,n){var r=t.hooks.all[e];if(!r||!r.length)return;for(var i=0,s;s=r[i++];)s(n)}}},n=t.Token=function(e,t){this.type=e;this.content=t};n.stringify=function(e,r,i){if(typeof e=="string")return e;if(Object.prototype.toString.call(e)=="[object Array]")return e.map(function(t){return n.stringify(t,r,e)}).join("");var s={type:e.type,content:n.stringify(e.content,r,i),tag:"span",classes:["token",e.type],attributes:{},language:r,parent:i};s.type=="comment"&&(s.attributes.spellcheck="true");t.hooks.run("wrap",s);var o="";for(var u in s.attributes)o+=u+'="'+(s.attributes[u]||"")+'"';return"<"+s.tag+' class="'+s.classes.join(" ")+'" '+o+">"+s.content+""+s.tag+">"};if(!self.document){self.addEventListener("message",function(e){var n=JSON.parse(e.data),r=n.language,i=n.code;self.postMessage(JSON.stringify(t.tokenize(i,t.languages[r])));self.close()},!1);return}var r=document.getElementsByTagName("script");r=r[r.length-1];if(r){t.filename=r.src;document.addEventListener&&!r.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll)}})();;
+Prism.languages.markup={comment:/<!--[\w\W]*?-->/g,prolog:/<\?.+?\?>/,doctype:/<!DOCTYPE.+?>/,cdata:/<!\[CDATA\[[\w\W]*?]]>/i,tag:{pattern:/<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|\w+))?\s*)*\/?>/gi,inside:{tag:{pattern:/^<\/?[\w:-]+/i,inside:{punctuation:/^<\/?/,namespace:/^[\w-]+?:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/gi,inside:{punctuation:/=|>|"/g}},punctuation:/\/?>/g,"attr-name":{pattern:/[\w:-]+/g,inside:{namespace:/^[\w-]+?:/}}}},entity:/&#?[\da-z]{1,8};/gi};Prism.hooks.add("wrap",function(e){e.type==="entity"&&(e.attributes.title=e.content.replace(/&/,"&"))});;
+Prism.languages.css={comment:/\/\*[\w\W]*?\*\//g,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*{))/gi,inside:{punctuation:/[;:]/g}},url:/url\((["']?).*?\1\)/gi,selector:/[^\{\}\s][^\{\};]*(?=\s*\{)/g,property:/(\b|\B)[\w-]+(?=\s*:)/ig,string:/("|')(\\?.)*?\1/g,important:/\B!important\b/gi,ignore:/&(lt|gt|amp);/gi,punctuation:/[\{\};:]/g};Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{style:{pattern:/(<|<)style[\w\W]*?(>|>)[\w\W]*?(<|<)\/style(>|>)/ig,inside:{tag:{pattern:/(<|<)style[\w\W]*?(>|>)|(<|<)\/style(>|>)/ig,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.css}}});;
\ No newline at end of file
diff --git a/_patternlab-files/styleguide/js/vendor/typeahead.bundle.min.js b/_patternlab-files/styleguide/js/vendor/typeahead.bundle.min.js
new file mode 100644
index 0000000..e28c2ac
--- /dev/null
+++ b/_patternlab-files/styleguide/js/vendor/typeahead.bundle.min.js
@@ -0,0 +1,7 @@
+/*!
+ * typeahead.js 0.10.1
+ * https://github.com/twitter/typeahead.js
+ * Copyright 2013 Twitter, Inc. and other contributors; Licensed MIT
+ */
+
+!function(a){var b={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},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,getUniqueId: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}},noop:function(){}},c="0.10.1",d=function(){function a(a){this.maxSize=a||100,this.size=0,this.hash={},this.list=new c}function c(){this.head=this.tail=null}function d(a,b){this.key=a,this.val=b,this.prev=this.next=null}return b.mixin(a.prototype,{set:function(a,b){var c,e=this.list.tail;this.size>=this.maxSize&&(this.list.remove(e),delete this.hash[e.key]),(c=this.hash[a])?(c.val=b,this.list.moveToFront(c)):(c=new d(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}}),b.mixin(c.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)}}),a}(this),e=function(){function a(a){this.prefix=["__",a,"__"].join(""),this.ttlKey="__ttl__",this.keyMatcher=new RegExp("^"+this.prefix)}function c(){return(new Date).getTime()}function d(a){return JSON.stringify(b.isUndefined(a)?null:a)}function e(a){return JSON.parse(a)}var f,g;try{f=window.localStorage,f.setItem("~~~","!"),f.removeItem("~~~")}catch(h){f=null}return g=f&&window.JSON?{_prefix:function(a){return this.prefix+a},_ttlKey:function(a){return this._prefix(a)+this.ttlKey},get:function(a){return this.isExpired(a)&&this.remove(a),e(f.getItem(this._prefix(a)))},set:function(a,e,g){return b.isNumber(g)?f.setItem(this._ttlKey(a),d(c()+g)):f.removeItem(this._ttlKey(a)),f.setItem(this._prefix(a),d(e))},remove:function(a){return f.removeItem(this._ttlKey(a)),f.removeItem(this._prefix(a)),this},clear:function(){var a,b,c=[],d=f.length;for(a=0;d>a;a++)(b=f.key(a)).match(this.keyMatcher)&&c.push(b.replace(this.keyMatcher,""));for(a=c.length;a--;)this.remove(c[a]);return this},isExpired:function(a){var d=e(f.getItem(this._ttlKey(a)));return b.isNumber(d)&&c()>d?!0:!1}}:{get:b.noop,set:b.noop,remove:b.noop,clear:b.noop,isExpired:b.noop},b.mixin(a.prototype,g),a}(),f=function(){function c(b){b=b||{},this._send=b.transport?e(b.transport):a.ajax,this._get=b.rateLimiter?b.rateLimiter(this._get):this._get}function e(c){return function(d,e){function f(a){b.defer(function(){h.resolve(a)})}function g(a){b.defer(function(){h.reject(a)})}var h=a.Deferred();return c(d,e,f,g),h}}var f=0,g={},h=6,i=new d(10);return c.setMaxPendingRequests=function(a){h=a},c.resetCache=function(){i=new d(10)},b.mixin(c.prototype,{_get:function(a,b,c){function d(b){c&&c(b),i.set(a,b)}function e(){f--,delete g[a],k.onDeckRequestArgs&&(k._get.apply(k,k.onDeckRequestArgs),k.onDeckRequestArgs=null)}var j,k=this;(j=g[a])?j.done(d):h>f?(f++,g[a]=this._send(a,b).done(d).always(e)):this.onDeckRequestArgs=[].slice.call(arguments,0)},get:function(a,c,d){var e;return b.isFunction(c)&&(d=c,c={}),(e=i.get(a))?b.defer(function(){d&&d(e)}):this._get(a,c,d),!!e}}),c}(),g=function(){function c(b){b=b||{},b.datumTokenizer&&b.queryTokenizer||a.error("datumTokenizer and queryTokenizer are both required"),this.datumTokenizer=b.datumTokenizer,this.queryTokenizer=b.queryTokenizer,this.datums=[],this.trie=e()}function d(a){return a=b.filter(a,function(a){return!!a}),a=b.map(a,function(a){return a.toLowerCase()})}function e(){return{ids:[],children:{}}}function f(a){for(var b={},c=[],d=0;db[e]?e++:(f.push(a[d]),d++,e++);return f}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;f=c.datums.push(a)-1,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.children[g]||(b.children[g]=e()),b.ids.push(f)})})},get:function(a){var c,e,h=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=h.trie,c=a.split("");b&&(d=c.shift());)b=b.children[d];return b&&0===c.length?(f=b.ids.slice(0),void(e=e?g(e,f):f)):(e=[],!1)}),e?b.map(f(e),function(a){return h.datums[a]}):[]},serialize:function(){return{datums:this.datums,trie:this.trie}}}),c}(),h=function(){function d(a){var c=a.local||null;return b.isFunction(c)&&(c=c.call(null)),c}function e(d){var e,f;return f={url:null,thumbprint:"",ttl:864e5,filter:null,ajax:{}},(e=d.prefetch||null)&&(e=b.isString(e)?{url:e}:e,e=b.mixin(f,e),e.thumbprint=c+e.thumbprint,e.ajax.type=e.ajax.type||"GET",e.ajax.dataType=e.ajax.dataType||"json",!e.url&&a.error("prefetch requires url to be set")),e}function f(c){function d(a){return function(c){return b.debounce(c,a)}}function e(a){return function(c){return b.throttle(c,a)}}var f,g;return g={url:null,wildcard:"%QUERY",replace:null,rateLimitBy:"debounce",rateLimitWait:300,send:null,filter:null,ajax:{}},(f=c.remote||null)&&(f=b.isString(f)?{url:f}:f,f=b.mixin(g,f),f.rateLimiter=/^throttle$/i.test(f.rateLimitBy)?e(f.rateLimitWait):d(f.rateLimitWait),f.ajax.type=f.ajax.type||"GET",f.ajax.dataType=f.ajax.dataType||"json",delete f.rateLimitBy,delete f.rateLimitWait,!f.url&&a.error("remote requires url to be set")),f}return{local:d,prefetch:e,remote:f}}(),i=(window.Bloodhound=function(){function c(b){b&&(b.local||b.prefetch||b.remote)||a.error("one of local, prefetch, or remote is required"),this.limit=b.limit||5,this.sorter=d(b.sorter),this.dupDetector=b.dupDetector||i,this.local=h.local(b),this.prefetch=h.prefetch(b),this.remote=h.remote(b),this.cacheKey=this.prefetch?this.prefetch.cacheKey||this.prefetch.url:null,this.index=new g({datumTokenizer:b.datumTokenizer,queryTokenizer:b.queryTokenizer}),this.storage=this.cacheKey?new e(this.cacheKey):null}function d(a){function c(b){return b.sort(a)}function d(a){return a}return b.isFunction(a)?c:d}function i(){return!1}var j;return j={data:"data",protocol:"protocol",thumbprint:"thumbprint"},c.tokenizers={whitespace:function(a){return a.split(/\s+/)},nonword:function(a){return a.split(/\W+/)}},b.mixin(c.prototype,{_loadPrefetch:function(b){function c(a){var c;c=b.filter?b.filter(a):a,f.add(c),f._saveToStorage(f.index.serialize(),b.thumbprint,b.ttl)}var d,e,f=this;return(d=this._readFromStorage(b.thumbprint))?(this.index.bootstrap(d),e=a.Deferred().resolve()):e=a.ajax(b.url,b.ajax).done(c),e},_getFromRemote:function(a,b){function c(a){var c=f.remote.filter?f.remote.filter(a):a;b(c)}var d,e,f=this;return a=a||"",e=encodeURIComponent(a),d=this.remote.replace?this.remote.replace(this.remote.url,a):this.remote.url.replace(this.remote.wildcard,e),this.transport.get(d,this.remote.ajax,c)},_saveToStorage:function(a,b,c){this.storage&&(this.storage.set(j.data,a,c),this.storage.set(j.protocol,location.protocol,c),this.storage.set(j.thumbprint,b,c))},_readFromStorage:function(a){var b,c={};return this.storage&&(c.data=this.storage.get(j.data),c.protocol=this.storage.get(j.protocol),c.thumbprint=this.storage.get(j.thumbprint)),b=c.thumbprint!==a||c.protocol!==location.protocol,c.data&&!b?c.data:null},initialize:function(){function b(){d.add(d.local)}var c,d=this;return c=this.prefetch?this._loadPrefetch(this.prefetch):a.Deferred().resolve(),this.local&&c.done(b),this.transport=this.remote?new f(this.remote):null,this.initialize=function(){return c.promise()},c.promise()},add:function(a){this.index.add(a)},get:function(a,c){function d(a){var d=e.slice(0);b.each(a,function(a){var c;return c=b.some(d,function(b){return f.dupDetector(a,b)}),!c&&d.push(a),d.length