accessible-autocomplete
Advanced tools
Comparing version 1.6.2 to 2.0.0
@@ -5,2 +5,41 @@ # CHANGELOG | ||
We recommend you update to the latest release using npm: | ||
`npm install accessible-autocomplete@latest` | ||
### Breaking changes | ||
You must make the following change when you migrate to this release, or your service may break. | ||
#### Migrate to the new accessible focus state | ||
The focus state [now meets the new WCAG 2.1 level AA requirements](https://designnotes.blog.gov.uk/2019/07/29/weve-made-the-gov-uk-design-system-more-accessible/). | ||
You do not need to do anything if you’re using Sass. | ||
If you’ve previously copied CSS from our code into your project, you must copy all the CSS from our [`accessible-autocomplete.min.css` file](https://github.com/alphagov/accessible-autocomplete/blob/master/dist/accessible-autocomplete.min.css) into your CSS file. | ||
If you’ve created custom CSS, you should check that your component meets WCAG 2.1 level AA requirements. You can [read how we made the GOV.UK Design System focus states accessible](https://design-system.service.gov.uk/get-started/focus-states/). | ||
[Pull request #360: Update focus styles to meet WCAG 2.1 level AA non-text contrast requirements](https://github.com/alphagov/accessible-autocomplete/pull/360). | ||
### Fixes | ||
#### Better compatibility with screen readers | ||
The input field is now visible to all screen readers, because the input field now meets the Accessible Rich Internet Applications (ARIA) 1.0 standard instead of ARIA 1.1. ARIA 1.0 is better supported by the current versions of most screen readers. | ||
Screen readers will now consistently tell users: | ||
- when users have entered too few characters in the input field | ||
- the correct number of search results, and what the results are | ||
- which result users have highlighted | ||
- how to use autocomplete in different screen readers - by reading hidden hint text | ||
Screen readers will also now avoid telling users information they do not need to know after they highlight an option. | ||
Thanks to [Mark Hunter](https://github.com/markhunter27), Chris Moore and everyone at HMRC who worked on these improvements. | ||
[Pull request #355: Refinements to address accessibility issues](https://github.com/alphagov/accessible-autocomplete/pull/355) | ||
## 1.6.2 - 2018-11-13 | ||
@@ -7,0 +46,0 @@ |
@@ -1,2 +0,2 @@ | ||
(function webpackUniversalModuleDefinition(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["accessibleAutocomplete"]=t():e["accessibleAutocomplete"]=t()})(window,function(){return function(n){var r={};function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}return o.m=n,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="/",o(o.s=37)}([function(e,t,n){var m=n(1),v=n(6),y=n(7),_=n(16),b=n(18),g="prototype",x=function(e,t,n){var r,o,i,u,l=e&x.F,a=e&x.G,s=e&x.S,c=e&x.P,p=e&x.B,f=a?m:s?m[t]||(m[t]={}):(m[t]||{})[g],d=a?v:v[t]||(v[t]={}),h=d[g]||(d[g]={});for(r in a&&(n=t),n)i=((o=!l&&f&&f[r]!==undefined)?f:n)[r],u=p&&o?b(i,m):c&&"function"==typeof i?b(Function.call,i):i,f&&_(f,r,i,e&x.U),d[r]!=i&&y(d,r,u),c&&h[r]!=i&&(h[r]=i)};m.core=v,x.F=1,x.G=2,x.S=4,x.P=8,x.B=16,x.W=32,x.U=64,x.R=128,e.exports=x},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){e.exports=!n(4)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t){e.exports=function(e){try{return!!e()}catch(t){return!0}}},function(e,t,n){"use strict";n.r(t),n.d(t,"h",function(){return r}),n.d(t,"createElement",function(){return r}),n.d(t,"cloneElement",function(){return i}),n.d(t,"Component",function(){return _}),n.d(t,"render",function(){return b}),n.d(t,"rerender",function(){return f}),n.d(t,"options",function(){return E});var a=function a(){},E={},s=[],c=[];function r(e,t){var n,r,o,i,u=c;for(i=arguments.length;2<i--;)s.push(arguments[i]);for(t&&null!=t.children&&(s.length||s.push(t.children),delete t.children);s.length;)if((r=s.pop())&&r.pop!==undefined)for(i=r.length;i--;)s.push(r[i]);else"boolean"==typeof r&&(r=null),(o="function"!=typeof e)&&(null==r?r="":"number"==typeof r?r=String(r):"string"!=typeof r&&(o=!1)),o&&n?u[u.length-1]+=r:u===c?u=[r]:u.push(r),n=o;var l=new a;return l.nodeName=e,l.children=u,l.attributes=null==t?undefined:t,l.key=null==t?undefined:t.key,E.vnode!==undefined&&E.vnode(l),l}function N(e,t){for(var n in t)e[n]=t[n];return e}var o="function"==typeof Promise?Promise.resolve().then.bind(Promise.resolve()):setTimeout;function i(e,t){return r(e.nodeName,N(N({},e.attributes),t),2<arguments.length?[].slice.call(arguments,2):e.children)}var p=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,u=[];function l(e){!e._dirty&&(e._dirty=!0)&&1==u.push(e)&&(E.debounceRendering||o)(f)}function f(){var e,t=u;for(u=[];e=t.pop();)e._dirty&&V(e)}function k(e,t){return e.normalizedNodeName===t||e.nodeName.toLowerCase()===t.toLowerCase()}function I(e){var t=N({},e.attributes);t.children=e.children;var n=e.nodeName.defaultProps;if(n!==undefined)for(var r in n)t[r]===undefined&&(t[r]=n[r]);return t}function P(e){var t=e.parentNode;t&&t.removeChild(e)}function v(e,t,n,r,o){if("className"===t&&(t="class"),"key"===t);else if("ref"===t)n&&n(null),r&&r(e);else if("class"!==t||o)if("style"===t){if(r&&"string"!=typeof r&&"string"!=typeof n||(e.style.cssText=r||""),r&&"object"==typeof r){if("string"!=typeof n)for(var i in n)i in r||(e.style[i]="");for(var i in r)e.style[i]="number"==typeof r[i]&&!1===p.test(i)?r[i]+"px":r[i]}}else if("dangerouslySetInnerHTML"===t)r&&(e.innerHTML=r.__html||"");else if("o"==t[0]&&"n"==t[1]){var u=t!==(t=t.replace(/Capture$/,""));t=t.toLowerCase().substring(2),r?n||e.addEventListener(t,d,u):e.removeEventListener(t,d,u),(e._listeners||(e._listeners={}))[t]=r}else if("list"!==t&&"type"!==t&&!o&&t in e){try{e[t]=null==r?"":r}catch(a){}null!=r&&!1!==r||"spellcheck"==t||e.removeAttribute(t)}else{var l=o&&t!==(t=t.replace(/^xlink:?/,""));null==r||!1===r?l?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.removeAttribute(t):"function"!=typeof r&&(l?e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),r):e.setAttribute(t,r))}else e.className=r||""}function d(e){return this._listeners[e.type](E.event&&E.event(e)||e)}var M=[],j=0,A=!1,T=!1;function L(){for(var e;e=M.pop();)E.afterMount&&E.afterMount(e),e.componentDidMount&&e.componentDidMount()}function B(e,t,n,r,o,i){j++||(A=null!=o&&o.ownerSVGElement!==undefined,T=null!=e&&!("__preactattr_"in e));var u=F(e,t,n,r,i);return o&&u.parentNode!==o&&o.appendChild(u),--j||(T=!1,i||L()),u}function F(e,t,n,r,o){var i=e,u=A;if(null!=t&&"boolean"!=typeof t||(t=""),"string"==typeof t||"number"==typeof t)return e&&e.splitText!==undefined&&e.parentNode&&(!e._component||o)?e.nodeValue!=t&&(e.nodeValue=t):(i=document.createTextNode(t),e&&(e.parentNode&&e.parentNode.replaceChild(i,e),D(e,!0))),i["__preactattr_"]=!0,i;var l=t.nodeName;if("function"==typeof l)return function d(e,t,n,r){var o=e&&e._component,i=o,u=e,l=o&&e._componentConstructor===t.nodeName,a=l,s=I(t);for(;o&&!a&&(o=o._parentComponent);)a=o.constructor===t.nodeName;o&&a&&(!r||o._component)?(U(o,s,3,n,r),e=o.base):(i&&!l&&(q(i),e=u=null),o=R(t.nodeName,s,n),e&&!o.nextBase&&(o.nextBase=e,u=null),U(o,s,1,n,r),e=o.base,u&&e!==u&&(u._component=null,D(u,!1)));return e}(e,t,n,r);if(A="svg"===l||"foreignObject"!==l&&A,l=String(l),(!e||!k(e,l))&&(i=function h(e,t){var n=t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e);return n.normalizedNodeName=e,n}(l,A),e)){for(;e.firstChild;)i.appendChild(e.firstChild);e.parentNode&&e.parentNode.replaceChild(i,e),D(e,!0)}var a=i.firstChild,s=i["__preactattr_"],c=t.children;if(null==s){s=i["__preactattr_"]={};for(var p=i.attributes,f=p.length;f--;)s[p[f].name]=p[f].value}return!T&&c&&1===c.length&&"string"==typeof c[0]&&null!=a&&a.splitText!==undefined&&null==a.nextSibling?a.nodeValue!=c[0]&&(a.nodeValue=c[0]):(c&&c.length||null!=a)&&function S(e,t,n,r,o){var i,u,l,a,s,c=e.childNodes,p=[],f={},d=0,h=0,m=c.length,v=0,y=t?t.length:0;if(0!==m)for(var _=0;_<m;_++){var b=c[_],g=b["__preactattr_"],x=y&&g?b._component?b._component.__key:g.key:null;null!=x?(d++,f[x]=b):(g||(b.splitText!==undefined?!o||b.nodeValue.trim():o))&&(p[v++]=b)}if(0!==y)for(var _=0;_<y;_++){a=t[_],s=null;var x=a.key;if(null!=x)d&&f[x]!==undefined&&(s=f[x],f[x]=undefined,d--);else if(h<v)for(i=h;i<v;i++)if(p[i]!==undefined&&(w=u=p[i],C=o,"string"==typeof(O=a)||"number"==typeof O?w.splitText!==undefined:"string"==typeof O.nodeName?!w._componentConstructor&&k(w,O.nodeName):C||w._componentConstructor===O.nodeName)){s=u,p[i]=undefined,i===v-1&&v--,i===h&&h++;break}s=F(s,a,n,r),l=c[_],s&&s!==e&&s!==l&&(null==l?e.appendChild(s):s===l.nextSibling?P(l):e.insertBefore(s,l))}var w,O,C;if(d)for(var _ in f)f[_]!==undefined&&D(f[_],!1);for(;h<=v;)(s=p[v--])!==undefined&&D(s,!1)}(i,c,n,r,T||null!=s.dangerouslySetInnerHTML),function m(e,t,n){var r;for(r in n)t&&null!=t[r]||null==n[r]||v(e,r,n[r],n[r]=undefined,A);for(r in t)"children"===r||"innerHTML"===r||r in n&&t[r]===("value"===r||"checked"===r?e[r]:n[r])||v(e,r,n[r],n[r]=t[r],A)}(i,t.attributes,s),A=u,i}function D(e,t){var n=e._component;n?q(n):(null!=e["__preactattr_"]&&e["__preactattr_"].ref&&e["__preactattr_"].ref(null),!1!==t&&null!=e["__preactattr_"]||P(e),h(e))}function h(e){for(e=e.lastChild;e;){var t=e.previousSibling;D(e,!0),e=t}}var m=[];function R(e,t,n){var r,o=m.length;for(e.prototype&&e.prototype.render?(r=new e(t,n),_.call(r,t,n)):((r=new _(t,n)).constructor=e,r.render=y);o--;)if(m[o].constructor===e)return r.nextBase=m[o].nextBase,m.splice(o,1),r;return r}function y(e,t,n){return this.constructor(e,n)}function U(e,t,n,r,o){e._disable||(e._disable=!0,e.__ref=t.ref,e.__key=t.key,delete t.ref,delete t.key,"undefined"==typeof e.constructor.getDerivedStateFromProps&&(!e.base||o?e.componentWillMount&&e.componentWillMount():e.componentWillReceiveProps&&e.componentWillReceiveProps(t,r)),r&&r!==e.context&&(e.prevContext||(e.prevContext=e.context),e.context=r),e.prevProps||(e.prevProps=e.props),e.props=t,e._disable=!1,0!==n&&(1!==n&&!1===E.syncComponentUpdates&&e.base?l(e):V(e,1,o)),e.__ref&&e.__ref(e))}function V(e,t,n,r){if(!e._disable){var o,i,u,l=e.props,a=e.state,s=e.context,c=e.prevProps||l,p=e.prevState||a,f=e.prevContext||s,d=e.base,h=e.nextBase,m=d||h,v=e._component,y=!1,_=f;if(e.constructor.getDerivedStateFromProps&&(a=N(N({},a),e.constructor.getDerivedStateFromProps(l,a)),e.state=a),d&&(e.props=c,e.state=p,e.context=f,2!==t&&e.shouldComponentUpdate&&!1===e.shouldComponentUpdate(l,a,s)?y=!0:e.componentWillUpdate&&e.componentWillUpdate(l,a,s),e.props=l,e.state=a,e.context=s),e.prevProps=e.prevState=e.prevContext=e.nextBase=null,e._dirty=!1,!y){o=e.render(l,a,s),e.getChildContext&&(s=N(N({},s),e.getChildContext())),d&&e.getSnapshotBeforeUpdate&&(_=e.getSnapshotBeforeUpdate(c,p));var b,g,x=o&&o.nodeName;if("function"==typeof x){var w=I(o);(i=v)&&i.constructor===x&&w.key==i.__key?U(i,w,1,s,!1):(b=i,e._component=i=R(x,w,s),i.nextBase=i.nextBase||h,i._parentComponent=e,U(i,w,0,s,!1),V(i,1,n,!0)),g=i.base}else u=m,(b=v)&&(u=e._component=null),(m||1===t)&&(u&&(u._component=null),g=function B(t,n,r,o,i,u){j++||(A=null!=i&&i.ownerSVGElement!==undefined,T=null!=t&&!("__preactattr_"in t));var l=F(t,n,r,o,u);return i&&l.parentNode!==i&&i.appendChild(l),--j||(T=!1,u||L()),l}(u,o,s,n||!d,m&&m.parentNode,!0));if(m&&g!==m&&i!==v){var O=m.parentNode;O&&g!==O&&(O.replaceChild(g,m),b||(m._component=null,D(m,!1)))}if(b&&q(b),(e.base=g)&&!r){for(var C=e,S=e;S=S._parentComponent;)(C=S).base=g;g._component=C,g._componentConstructor=C.constructor}}for(!d||n?M.unshift(e):y||(e.componentDidUpdate&&e.componentDidUpdate(c,p,_),E.afterUpdate&&E.afterUpdate(e));e._renderCallbacks.length;)e._renderCallbacks.pop().call(e);j||r||L()}}function q(e){E.beforeUnmount&&E.beforeUnmount(e);var t=e.base;e._disable=!0,e.componentWillUnmount&&e.componentWillUnmount(),e.base=null;var n=e._component;n?q(n):t&&(t["__preactattr_"]&&t["__preactattr_"].ref&&t["__preactattr_"].ref(null),P(e.nextBase=t),m.push(e),h(t)),e.__ref&&e.__ref(null)}function _(e,t){this._dirty=!0,this.context=t,this.props=e,this.state=this.state||{},this._renderCallbacks=[]}function b(e,t,n){return B(n,e,{},!1,t,!1)}N(_.prototype,{setState:function(e,t){this.prevState||(this.prevState=this.state),this.state=N(N({},this.state),"function"==typeof e?e(this.state,this.props):e),t&&this._renderCallbacks.push(t),l(this)},forceUpdate:function(e){e&&this._renderCallbacks.push(e),V(this,2)},render:function b(){}});var g={h:r,createElement:r,cloneElement:i,Component:_,render:b,rerender:f,options:E};t["default"]=g},function(e,t){var n=e.exports={version:"2.5.7"};"number"==typeof __e&&(__e=n)},function(e,t,n){var r=n(8),o=n(40);e.exports=n(3)?function(e,t,n){return r.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){var o=n(9),i=n(38),u=n(39),l=Object.defineProperty;t.f=n(3)?Object.defineProperty:function(e,t,n){if(o(e),t=u(t,!0),o(n),i)try{return l(e,t,n)}catch(r){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){var r=n(2);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(e===undefined?"":e,")_",(++n+r).toString(36))}},function(e,t,n){var r=n(22);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t){e.exports=function(e){if(e==undefined)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){"use strict";var r=n(4);e.exports=function(e,t){return!!e&&r(function(){t?e.call(null,function(){},1):e.call(null)})}},function(e,t,n){var r=n(0);r(r.S+r.F,"Object",{assign:n(41)})},function(e,t,n){var r=n(2),o=n(1).document,i=r(o)&&r(o.createElement);e.exports=function(e){return i?o.createElement(e):{}}},function(e,t,n){var i=n(1),u=n(7),l=n(17),a=n(10)("src"),r="toString",o=Function[r],s=(""+o).split(r);n(6).inspectSource=function(e){return o.call(e)},(e.exports=function(e,t,n,r){var o="function"==typeof n;o&&(l(n,"name")||u(n,"name",t)),e[t]!==n&&(o&&(l(n,a)||u(n,a,e[t]?""+e[t]:s.join(String(t)))),e===i?e[t]=n:r?e[t]?e[t]=n:u(e,t,n):(delete e[t],u(e,t,n)))})(Function.prototype,r,function(){return"function"==typeof this&&this[a]||o.call(this)})},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var i=n(19);e.exports=function(r,o,e){if(i(r),o===undefined)return r;switch(e){case 1:return function(e){return r.call(o,e)};case 2:return function(e,t){return r.call(o,e,t)};case 3:return function(e,t,n){return r.call(o,e,t,n)}}return function(){return r.apply(o,arguments)}}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,n){var r=n(42),o=n(28);e.exports=Object.keys||function(e){return r(e,o)}},function(e,t,n){var r=n(11),o=n(12);e.exports=function(e){return r(o(e))}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var a=n(21),s=n(24),c=n(43);e.exports=function(l){return function(e,t,n){var r,o=a(e),i=s(o.length),u=c(n,i);if(l&&t!=t){for(;u<i;)if((r=o[u++])!=r)return!0}else for(;u<i;u++)if((l||u in o)&&o[u]===t)return l||u||0;return!l&&-1}}},function(e,t,n){var r=n(25),o=Math.min;e.exports=function(e){return 0<e?o(r(e),9007199254740991):0}},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(0<e?r:n)(e)}},function(e,t,n){var r=n(27)("keys"),o=n(10);e.exports=function(e){return r[e]||(r[e]=o(e))}},function(e,t,n){var r=n(6),o=n(1),i="__core-js_shared__",u=o[i]||(o[i]={});(e.exports=function(e,t){return u[e]||(u[e]=t!==undefined?t:{})})("versions",[]).push({version:r.version,mode:n(44)?"pure":"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){var r=n(12);e.exports=function(e){return Object(r(e))}},function(e,t,n){var r=n(8).f,o=Function.prototype,i=/^\s*function ([^ (]*)/;"name"in o||n(3)&&r(o,"name",{configurable:!0,get:function(){try{return(""+this).match(i)[1]}catch(e){return""}}})},function(e,t,n){"use strict";var r=n(0),o=n(32)(1);r(r.P+r.F*!n(13)([].map,!0),"Array",{map:function(e){return o(this,e,arguments[1])}})},function(e,t,n){var b=n(18),g=n(11),x=n(29),w=n(24),r=n(47);e.exports=function(p,e){var f=1==p,d=2==p,h=3==p,m=4==p,v=6==p,y=5==p||v,_=e||r;return function(e,t,n){for(var r,o,i=x(e),u=g(i),l=b(t,n,3),a=w(u.length),s=0,c=f?_(e,a):d?_(e,0):undefined;s<a;s++)if((y||s in u)&&(o=l(r=u[s],s,i),p))if(f)c[s]=o;else if(o)switch(p){case 3:return!0;case 5:return r;case 6:return s;case 2:c.push(r)}else if(m)return!1;return v?-1:h||m?m:c}}},function(e,t,n){var r=n(22);e.exports=Array.isArray||function(e){return"Array"==r(e)}},function(e,t,n){var r=n(27)("wks"),o=n(10),i=n(1).Symbol,u="function"==typeof i;(e.exports=function(e){return r[e]||(r[e]=u&&i[e]||(u?i:o)("Symbol."+e))}).store=r},function(e,t,n){"use strict";var r=n(0),o=n(23)(!1),i=[].indexOf,u=!!i&&1/[1].indexOf(1,-0)<0;r(r.P+r.F*(u||!n(13)(i)),"Array",{indexOf:function(e){return u?i.apply(this,arguments)||0:o(this,e,arguments[1])}})},function(e,t,n){var r=n(0);r(r.S,"Object",{create:n(52)})},function(e,t,n){"use strict";t.__esModule=!0,t["default"]=void 0,n(14),n(30),n(31),n(35),n(49),n(50);var r=n(5),o=function a(e){return e&&e.__esModule?e:{"default":e}}(n(51));function i(e){if(!e.element)throw new Error("element is not defined");if(!e.id)throw new Error("id is not defined");if(!e.source)throw new Error("source is not defined");Array.isArray(e.source)&&(e.source=u(e.source)),(0,r.render)((0,r.createElement)(o["default"],e),e.element)}var u=function u(n){return function(t,e){e(n.filter(function(e){return-1!==e.toLowerCase().indexOf(t.toLowerCase())}))}};i.enhanceSelectElement=function(n){if(!n.selectElement)throw new Error("selectElement is not defined");if(!n.source){var e=[].filter.call(n.selectElement.options,function(e){return e.value||n.preserveNullOptions});n.source=e.map(function(e){return e.textContent||e.innerText})}if(n.onConfirm=n.onConfirm||function(t){var e=[].filter.call(n.selectElement.options,function(e){return(e.textContent||e.innerText)===t})[0];e&&(e.selected=!0)},n.selectElement.value||n.defaultValue===undefined){var t=n.selectElement.options[n.selectElement.options.selectedIndex];n.defaultValue=t.textContent||t.innerText}n.name===undefined&&(n.name=""),n.id===undefined&&(n.selectElement.id===undefined?n.id="":n.id=n.selectElement.id),n.autoselect===undefined&&(n.autoselect=!0);var r=document.createElement("span");n.selectElement.parentNode.insertBefore(r,n.selectElement),i(Object.assign({},n,{element:r})),n.selectElement.style.display="none",n.selectElement.id=n.selectElement.id+"-select"};var l=i;t["default"]=l},function(e,t,n){e.exports=!n(3)&&!n(4)(function(){return 7!=Object.defineProperty(n(15)("div"),"a",{get:function(){return 7}}).a})},function(e,t,n){var o=n(2);e.exports=function(e,t){if(!o(e))return e;var n,r;if(t&&"function"==typeof(n=e.toString)&&!o(r=n.call(e)))return r;if("function"==typeof(n=e.valueOf)&&!o(r=n.call(e)))return r;if(!t&&"function"==typeof(n=e.toString)&&!o(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){"use strict";var f=n(20),d=n(45),h=n(46),m=n(29),v=n(11),o=Object.assign;e.exports=!o||n(4)(function(){var e={},t={},n=Symbol(),r="abcdefghijklmnopqrst";return e[n]=7,r.split("").forEach(function(e){t[e]=e}),7!=o({},e)[n]||Object.keys(o({},t)).join("")!=r})?function(e,t){for(var n=m(e),r=arguments.length,o=1,i=d.f,u=h.f;o<r;)for(var l,a=v(arguments[o++]),s=i?f(a).concat(i(a)):f(a),c=s.length,p=0;p<c;)u.call(a,l=s[p++])&&(n[l]=a[l]);return n}:o},function(e,t,n){var u=n(17),l=n(21),a=n(23)(!1),s=n(26)("IE_PROTO");e.exports=function(e,t){var n,r=l(e),o=0,i=[];for(n in r)n!=s&&u(r,n)&&i.push(n);for(;t.length>o;)u(r,n=t[o++])&&(~a(i,n)||i.push(n));return i}},function(e,t,n){var r=n(25),o=Math.max,i=Math.min;e.exports=function(e,t){return(e=r(e))<0?o(e+t,0):i(e,t)}},function(e,t){e.exports=!1},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,n){var r=n(48);e.exports=function(e,t){return new(r(e))(t)}},function(e,t,n){var r=n(2),o=n(33),i=n(34)("species");e.exports=function(e){var t;return o(e)&&("function"!=typeof(t=e.constructor)||t!==Array&&!o(t.prototype)||(t=undefined),r(t)&&null===(t=t[i])&&(t=undefined)),t===undefined?Array:t}},function(e,t,n){"use strict";var r=n(0),o=n(32)(2);r(r.P+r.F*!n(13)([].filter,!0),"Array",{filter:function(e){return o(this,e,arguments[1])}})},function(e,t,n){var r=n(0);r(r.S,"Array",{isArray:n(33)})},function(e,t,n){"use strict";t.__esModule=!0,t["default"]=void 0,n(14),n(36),n(31),n(35),n(30),n(55),n(58);var $=n(5),H=o(n(60)),r=o(n(61));function o(e){return e&&e.__esModule?e:{"default":e}}function Q(){return(Q=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function i(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var u,l={13:"enter",27:"escape",32:"space",38:"up",40:"down"},z=((u=document.createElement("x")).style.cssText="pointer-events:auto","auto"===u.style.pointerEvents);function f(){return!(!navigator.userAgent.match(/(iPod|iPhone|iPad)/g)||!navigator.userAgent.match(/AppleWebKit/g))}var a=function(n){function e(e){var t;return(t=n.call(this,e)||this).elementReferences={},t.state={focused:null,hovered:null,clicked:null,menuOpen:!1,options:e.defaultValue?[e.defaultValue]:[],query:e.defaultValue,selected:null},t.handleComponentBlur=t.handleComponentBlur.bind(i(i(t))),t.handleKeyDown=t.handleKeyDown.bind(i(i(t))),t.handleUpArrow=t.handleUpArrow.bind(i(i(t))),t.handleDownArrow=t.handleDownArrow.bind(i(i(t))),t.handleEnter=t.handleEnter.bind(i(i(t))),t.handlePrintableKey=t.handlePrintableKey.bind(i(i(t))),t.handleListMouseLeave=t.handleListMouseLeave.bind(i(i(t))),t.handleOptionBlur=t.handleOptionBlur.bind(i(i(t))),t.handleOptionClick=t.handleOptionClick.bind(i(i(t))),t.handleOptionFocus=t.handleOptionFocus.bind(i(i(t))),t.handleOptionMouseEnter=t.handleOptionMouseEnter.bind(i(i(t))),t.handleInputBlur=t.handleInputBlur.bind(i(i(t))),t.handleInputChange=t.handleInputChange.bind(i(i(t))),t.handleInputFocus=t.handleInputFocus.bind(i(i(t))),t.pollInputElement=t.pollInputElement.bind(i(i(t))),t.getDirectInputChanges=t.getDirectInputChanges.bind(i(i(t))),t}(function r(e,t){e.prototype=Object.create(t.prototype),(e.prototype.constructor=e).__proto__=t})(e,n);var t=e.prototype;return t.componentDidMount=function(){this.pollInputElement()},t.componentWillUnmount=function(){clearTimeout(this.$pollInput),clearTimeout(this.$blurInput)},t.pollInputElement=function(){var e=this;this.getDirectInputChanges(),this.$pollInput=setTimeout(function(){e.pollInputElement()},100)},t.getDirectInputChanges=function(){var e=this.elementReferences[-1];e&&e.value!==this.state.query&&this.handleInputChange({target:{value:e.value}})},t.componentDidUpdate=function(e,t){var n=this.state,r=n.focused,o=n.clicked,i=null===r,u=t.focused!==r;(u&&!i||null!==o)&&this.elementReferences[r].focus();var l=-1===r,a=u&&null===t.focused;if(l&&a){var s=this.elementReferences[r];s.setSelectionRange(0,s.value.length)}},t.hasAutoselect=function(){return!f()&&this.props.autoselect},t.templateInputValue=function(e){var t=this.props.templates&&this.props.templates.inputValue;return t?t(e):e},t.templateSuggestion=function(e){var t=this.props.templates&&this.props.templates.suggestion;return t?t(e):e},t.handleComponentBlur=function(e){var t,n=this.state,r=n.options,o=n.query,i=n.selected;this.props.confirmOnBlur?(t=e.query||o,this.props.onConfirm(r[i])):t=o,this.setState({focused:null,clicked:null,menuOpen:e.menuOpen||!1,query:t,selected:null})},t.handleListMouseLeave=function(e){this.setState({hovered:null})},t.handleOptionBlur=function(e,t){var n=this.state,r=n.focused,o=n.clicked,i=n.menuOpen,u=n.options,l=n.selected,a=null===e.relatedTarget&&null===o,s=e.relatedTarget===this.elementReferences[-1],c=r!==t&&-1!==r;if(!c&&a||!(c||s)){var p=i&&f();this.handleComponentBlur({menuOpen:p,query:this.templateInputValue(u[l])})}},t.handleInputBlur=function(e){var t=this,n=this.state,r=n.focused,o=n.menuOpen,i=n.options,u=n.query,l=n.selected,a=-1!==r;if(clearTimeout(this.$blurInput),!a){var s=o&&f(),c=f()?u:this.templateInputValue(i[l]);this.$blurInput=setTimeout(function(){return t.handleComponentBlur({menuOpen:s,query:c})},200)}},t.handleInputChange=function(e){var n=this,t=this.props,r=t.minLength,o=t.source,i=t.showAllValues,u=this.hasAutoselect(),l=e.target.value,a=0===l.length,s=this.state.query.length!==l.length,c=l.length>=r;this.setState({query:l}),i||!a&&s&&c?o(l,function(e){var t=0<e.length;n.setState({menuOpen:t,options:e,selected:u&&t?0:-1})}):!a&&c||this.setState({menuOpen:!1,options:[]})},t.handleInputClick=function(e){this.handleInputChange(e)},t.handleInputFocus=function(e){this.setState({focused:-1})},t.handleOptionFocus=function(e){this.setState({focused:e,hovered:null,selected:e})},t.handleOptionMouseEnter=function(e,t){f()||this.setState({hovered:t})},t.handleOptionClick=function(e,t){var n=this.state.options[t],r=this.templateInputValue(n);clearTimeout(this.$blurInput),this.props.onConfirm(n),this.setState({focused:-1,clicked:t,hovered:null,menuOpen:!1,query:r,selected:-1}),this.forceUpdate()},t.handleUpArrow=function(e){e.preventDefault();var t=this.state,n=t.menuOpen,r=t.selected;-1!==r&&n&&this.handleOptionFocus(r-1)},t.handleDownArrow=function(e){var t=this;if(e.preventDefault(),this.props.showAllValues&&!1===this.state.menuOpen)e.preventDefault(),this.props.source("",function(e){t.setState({menuOpen:!0,options:e,selected:0,focused:0,hovered:null})});else if(!0===this.state.menuOpen){var n=this.state,r=n.menuOpen,o=n.options,i=n.selected;i!==o.length-1&&r&&this.handleOptionFocus(i+1)}},t.handleSpace=function(e){var t=this;this.props.showAllValues&&!1===this.state.menuOpen&&""===this.state.query&&(e.preventDefault(),this.props.source("",function(e){t.setState({menuOpen:!0,options:e})})),-1!==this.state.focused&&(e.preventDefault(),this.handleOptionClick(e,this.state.focused))},t.handleEnter=function(e){this.state.menuOpen&&(e.preventDefault(),0<=this.state.selected&&this.handleOptionClick(e,this.state.selected))},t.handlePrintableKey=function(e){var t=this.elementReferences[-1];e.target===t||t.focus()},t.handleKeyDown=function(e){switch(l[e.keyCode]){case"up":this.handleUpArrow(e);break;case"down":this.handleDownArrow(e);break;case"space":this.handleSpace(e);break;case"enter":this.handleEnter(e);break;case"escape":this.handleComponentBlur({query:this.state.query});break;default:(function t(e){return 47<e&&e<58||32===e||8===e||64<e&&e<91||95<e&&e<112||185<e&&e<193||218<e&&e<223})(e.keyCode)&&this.handlePrintableKey(e)}},t.render=function(){var e,o=this,t=this.props,n=t.cssNamespace,r=t.displayMenu,i=t.id,u=t.minLength,l=t.name,a=t.placeholder,s=t.required,c=t.showAllValues,p=t.tNoResults,f=t.tStatusQueryTooShort,d=t.tStatusNoResults,h=t.tStatusSelectedOption,m=t.tStatusResults,v=t.dropdownArrow,y=this.state,_=y.focused,b=y.hovered,g=y.menuOpen,x=y.options,w=y.query,O=y.selected,C=this.hasAutoselect(),S=-1===_,E=0===x.length,N=0!==w.length,k=w.length>=u,I=this.props.showNoOptionsFound&&S&&E&&N&&k,P=n+"__wrapper",M=n+"__input",j=null!==_?" "+M+"--focused":"",A=this.props.showAllValues?" "+M+"--show-all-values":" "+M+"--default",T=n+"__dropdown-arrow-down",L=-1!==_&&null!==_,B=n+"__menu",F=B+"--"+r,D=B+"--"+(g||I?"visible":"hidden"),R=n+"__option",U=n+"__hint",V=this.templateInputValue(x[O]),q=V&&0===V.toLowerCase().indexOf(w.toLowerCase())&&C?w+V.substr(w.length):"",W=z&&q;return c&&"string"==typeof(e=v({className:T}))&&(e=(0,$.createElement)("div",{className:n+"__dropdown-arrow-down-wrapper",dangerouslySetInnerHTML:{__html:e}})),(0,$.createElement)("div",{className:P,onKeyDown:this.handleKeyDown,role:"combobox","aria-expanded":g?"true":"false"},(0,$.createElement)(H["default"],{length:x.length,queryLength:w.length,minQueryLength:u,selectedOption:this.templateInputValue(x[O]),selectedOptionIndex:O,tQueryTooShort:f,tNoResults:d,tSelectedOption:h,tResults:m}),W&&(0,$.createElement)("span",null,(0,$.createElement)("input",{className:U,readonly:!0,tabIndex:"-1",value:q})),(0,$.createElement)("input",Q({"aria-activedescendant":!!L&&i+"__option--"+_,"aria-owns":i+"__listbox",autoComplete:"off",className:""+M+j+A,id:i,onClick:function(e){return o.handleInputClick(e)},onBlur:this.handleInputBlur},function K(e){return{onInput:e}}(this.handleInputChange),{onFocus:this.handleInputFocus,name:l,placeholder:a,ref:function(e){o.elementReferences[-1]=e},type:"text",role:"textbox",required:s,value:w})),e,(0,$.createElement)("ul",{className:B+" "+F+" "+D,onMouseLeave:function(e){return o.handleListMouseLeave(e)},id:i+"__listbox",role:"listbox"},x.map(function(e,t){var n=(-1===_?O===t:_===t)&&null===b?" "+R+"--focused":"",r=t%2?" "+R+"--odd":"";return(0,$.createElement)("li",{"aria-selected":_===t,className:""+R+n+r,dangerouslySetInnerHTML:{__html:o.templateSuggestion(e)},id:i+"__option--"+t,key:t,onBlur:function(e){return o.handleOptionBlur(e,t)},onClick:function(e){return o.handleOptionClick(e,t)},onMouseEnter:function(e){return o.handleOptionMouseEnter(e,t)},ref:function(e){o.elementReferences[t]=e},role:"option",tabIndex:"-1"})}),I&&(0,$.createElement)("li",{className:R+" "+R+"--no-results"},p())))},e}($.Component);(t["default"]=a).defaultProps={autoselect:!1,cssNamespace:"autocomplete",defaultValue:"",displayMenu:"inline",minLength:0,name:"input-autocomplete",placeholder:"",onConfirm:function(){},confirmOnBlur:!0,showNoOptionsFound:!0,showAllValues:!1,required:!1,tNoResults:function(){return"No results found"},dropdownArrow:r["default"]}},function(e,t,r){var o=r(9),i=r(53),u=r(28),l=r(26)("IE_PROTO"),a=function(){},s="prototype",c=function(){var e,t=r(15)("iframe"),n=u.length;for(t.style.display="none",r(54).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("<script>document.F=Object<\/script>"),e.close(),c=e.F;n--;)delete c[s][u[n]];return c()};e.exports=Object.create||function(e,t){var n;return null!==e?(a[s]=o(e),n=new a,a[s]=null,n[l]=e):n=c(),t===undefined?n:i(n,t)}},function(e,t,n){var u=n(8),l=n(9),a=n(20);e.exports=n(3)?Object.defineProperties:function(e,t){l(e);for(var n,r=a(t),o=r.length,i=0;i<o;)u.f(e,n=r[i++],t[n]);return e}},function(e,t,n){var r=n(1).document;e.exports=r&&r.documentElement},function(e,t,n){var r=n(0);r(r.P,"Function",{bind:n(56)})},function(e,t,n){"use strict";var i=n(19),u=n(2),l=n(57),a=[].slice,s={};e.exports=Function.bind||function(t){var n=i(this),r=a.call(arguments,1),o=function(){var e=r.concat(a.call(arguments));return this instanceof o?function(e,t,n){if(!(t in s)){for(var r=[],o=0;o<t;o++)r[o]="a["+o+"]";s[t]=Function("F,a","return new F("+r.join(",")+")")}return s[t](e,n)}(n,e.length,e):l(n,e,t)};return u(n.prototype)&&(o.prototype=n.prototype),o}},function(e,t){e.exports=function(e,t,n){var r=n===undefined;switch(t.length){case 0:return r?e():e.call(n);case 1:return r?e(t[0]):e.call(n,t[0]);case 2:return r?e(t[0],t[1]):e.call(n,t[0],t[1]);case 3:return r?e(t[0],t[1],t[2]):e.call(n,t[0],t[1],t[2]);case 4:return r?e(t[0],t[1],t[2],t[3]):e.call(n,t[0],t[1],t[2],t[3])}return e.apply(n,t)}},function(e,t,n){n(59)("match",1,function(r,o,e){return[function(e){"use strict";var t=r(this),n=e==undefined?undefined:e[o];return n!==undefined?n.call(e,t):new RegExp(e)[o](String(t))},e]})},function(e,t,n){"use strict";var l=n(7),a=n(16),s=n(4),c=n(12),p=n(34);e.exports=function(t,e,n){var r=p(t),o=n(c,r,""[t]),i=o[0],u=o[1];s(function(){var e={};return e[r]=function(){return 7},7!=""[t](e)})&&(a(String.prototype,t,i),l(RegExp.prototype,r,2==e?function(e,t){return u.call(e,this,t)}:function(e){return u.call(e,this)}))}},function(e,t,n){"use strict";t.__esModule=!0,t["default"]=void 0,n(36);var m=n(5);var r=function(o){function e(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return(e=o.call.apply(o,[this].concat(n))||this).state={bump:!1},e}(function n(e,t){e.prototype=Object.create(t.prototype),(e.prototype.constructor=e).__proto__=t})(e,o);var t=e.prototype;return t.componentWillReceiveProps=function(e){e.queryLength!==this.props.queryLength&&this.setState(function(e){return{bump:!e.bump}})},t.render=function(){var e=this.props,t=e.length,n=e.queryLength,r=e.minQueryLength,o=e.selectedOption,i=e.selectedOptionIndex,u=e.tQueryTooShort,l=e.tNoResults,a=e.tSelectedOption,s=e.tResults,c=this.state.bump,p=n<r,f=0===t,d=o?a(o,t,i):"",h=null;return h=p?u(r):f?l():s(t,d),(0,m.createElement)("div",{"aria-atomic":"true","aria-live":"polite",role:"status",style:{border:"0",clip:"rect(0 0 0 0)",height:"1px",marginBottom:"-1px",marginRight:"-1px",overflow:"hidden",padding:"0",position:"absolute",whiteSpace:"nowrap",width:"1px"}},h,(0,m.createElement)("span",null,c?",":",,"))},e}(m.Component);(t["default"]=r).defaultProps={tQueryTooShort:function(e){return"Type in "+e+" or more characters for results."},tNoResults:function(){return"No search results."},tSelectedOption:function(e,t,n){return e+" ("+(n+1)+" of "+t+") is selected."},tResults:function(e,t){return e+" "+(1===e?"result":"results")+" "+(1===e?"is":"are")+" available. "+t}}},function(e,t,n){"use strict";t.__esModule=!0,t["default"]=void 0;var r=n(5),o=function i(e){var t=e.className;return(0,r.createElement)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",className:t,focusable:"false"},(0,r.createElement)("g",{stroke:"none",fill:"none","fill-rule":"evenodd"},(0,r.createElement)("polygon",{fill:"#000000",points:"0 0 22 0 11 17"})))};t["default"]=o}])["default"]}); | ||
(function webpackUniversalModuleDefinition(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["accessibleAutocomplete"]=t():e["accessibleAutocomplete"]=t()})(window,function(){return function(n){var r={};function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}return o.m=n,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="/",o(o.s=37)}([function(e,t,n){var m=n(1),v=n(6),y=n(7),b=n(16),g=n(18),_="prototype",w=function(e,t,n){var r,o,i,u,a=e&w.F,l=e&w.G,s=e&w.S,c=e&w.P,p=e&w.B,f=l?m:s?m[t]||(m[t]={}):(m[t]||{})[_],d=l?v:v[t]||(v[t]={}),h=d[_]||(d[_]={});for(r in l&&(n=t),n)i=((o=!a&&f&&f[r]!==undefined)?f:n)[r],u=p&&o?g(i,m):c&&"function"==typeof i?g(Function.call,i):i,f&&b(f,r,i,e&w.U),d[r]!=i&&y(d,r,u),c&&h[r]!=i&&(h[r]=i)};m.core=v,w.F=1,w.G=2,w.S=4,w.P=8,w.B=16,w.W=32,w.U=64,w.R=128,e.exports=w},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){e.exports=!n(4)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t){e.exports=function(e){try{return!!e()}catch(t){return!0}}},function(e,t,n){"use strict";n.r(t),n.d(t,"h",function(){return r}),n.d(t,"createElement",function(){return r}),n.d(t,"cloneElement",function(){return i}),n.d(t,"Component",function(){return b}),n.d(t,"render",function(){return g}),n.d(t,"rerender",function(){return f}),n.d(t,"options",function(){return E});var l=function l(){},E={},s=[],c=[];function r(e,t){var n,r,o,i,u=c;for(i=arguments.length;2<i--;)s.push(arguments[i]);for(t&&null!=t.children&&(s.length||s.push(t.children),delete t.children);s.length;)if((r=s.pop())&&r.pop!==undefined)for(i=r.length;i--;)s.push(r[i]);else"boolean"==typeof r&&(r=null),(o="function"!=typeof e)&&(null==r?r="":"number"==typeof r?r=String(r):"string"!=typeof r&&(o=!1)),o&&n?u[u.length-1]+=r:u===c?u=[r]:u.push(r),n=o;var a=new l;return a.nodeName=e,a.children=u,a.attributes=null==t?undefined:t,a.key=null==t?undefined:t.key,E.vnode!==undefined&&E.vnode(a),a}function N(e,t){for(var n in t)e[n]=t[n];return e}var o="function"==typeof Promise?Promise.resolve().then.bind(Promise.resolve()):setTimeout;function i(e,t){return r(e.nodeName,N(N({},e.attributes),t),2<arguments.length?[].slice.call(arguments,2):e.children)}var p=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,u=[];function a(e){!e._dirty&&(e._dirty=!0)&&1==u.push(e)&&(E.debounceRendering||o)(f)}function f(){var e,t=u;for(u=[];e=t.pop();)e._dirty&&V(e)}function I(e,t){return e.normalizedNodeName===t||e.nodeName.toLowerCase()===t.toLowerCase()}function M(e){var t=N({},e.attributes);t.children=e.children;var n=e.nodeName.defaultProps;if(n!==undefined)for(var r in n)t[r]===undefined&&(t[r]=n[r]);return t}function k(e){var t=e.parentNode;t&&t.removeChild(e)}function v(e,t,n,r,o){if("className"===t&&(t="class"),"key"===t);else if("ref"===t)n&&n(null),r&&r(e);else if("class"!==t||o)if("style"===t){if(r&&"string"!=typeof r&&"string"!=typeof n||(e.style.cssText=r||""),r&&"object"==typeof r){if("string"!=typeof n)for(var i in n)i in r||(e.style[i]="");for(var i in r)e.style[i]="number"==typeof r[i]&&!1===p.test(i)?r[i]+"px":r[i]}}else if("dangerouslySetInnerHTML"===t)r&&(e.innerHTML=r.__html||"");else if("o"==t[0]&&"n"==t[1]){var u=t!==(t=t.replace(/Capture$/,""));t=t.toLowerCase().substring(2),r?n||e.addEventListener(t,d,u):e.removeEventListener(t,d,u),(e._listeners||(e._listeners={}))[t]=r}else if("list"!==t&&"type"!==t&&!o&&t in e){try{e[t]=null==r?"":r}catch(l){}null!=r&&!1!==r||"spellcheck"==t||e.removeAttribute(t)}else{var a=o&&t!==(t=t.replace(/^xlink:?/,""));null==r||!1===r?a?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.removeAttribute(t):"function"!=typeof r&&(a?e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),r):e.setAttribute(t,r))}else e.className=r||""}function d(e){return this._listeners[e.type](E.event&&E.event(e)||e)}var A=[],P=0,j=!1,T=!1;function L(){for(var e;e=A.pop();)E.afterMount&&E.afterMount(e),e.componentDidMount&&e.componentDidMount()}function B(e,t,n,r,o,i){P++||(j=null!=o&&o.ownerSVGElement!==undefined,T=null!=e&&!("__preactattr_"in e));var u=F(e,t,n,r,i);return o&&u.parentNode!==o&&o.appendChild(u),--P||(T=!1,i||L()),u}function F(e,t,n,r,o){var i=e,u=j;if(null!=t&&"boolean"!=typeof t||(t=""),"string"==typeof t||"number"==typeof t)return e&&e.splitText!==undefined&&e.parentNode&&(!e._component||o)?e.nodeValue!=t&&(e.nodeValue=t):(i=document.createTextNode(t),e&&(e.parentNode&&e.parentNode.replaceChild(i,e),R(e,!0))),i["__preactattr_"]=!0,i;var a=t.nodeName;if("function"==typeof a)return function d(e,t,n,r){var o=e&&e._component,i=o,u=e,a=o&&e._componentConstructor===t.nodeName,l=a,s=M(t);for(;o&&!l&&(o=o._parentComponent);)l=o.constructor===t.nodeName;o&&l&&(!r||o._component)?(U(o,s,3,n,r),e=o.base):(i&&!a&&(q(i),e=u=null),o=D(t.nodeName,s,n),e&&!o.nextBase&&(o.nextBase=e,u=null),U(o,s,1,n,r),e=o.base,u&&e!==u&&(u._component=null,R(u,!1)));return e}(e,t,n,r);if(j="svg"===a||"foreignObject"!==a&&j,a=String(a),(!e||!I(e,a))&&(i=function h(e,t){var n=t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e);return n.normalizedNodeName=e,n}(a,j),e)){for(;e.firstChild;)i.appendChild(e.firstChild);e.parentNode&&e.parentNode.replaceChild(i,e),R(e,!0)}var l=i.firstChild,s=i["__preactattr_"],c=t.children;if(null==s){s=i["__preactattr_"]={};for(var p=i.attributes,f=p.length;f--;)s[p[f].name]=p[f].value}return!T&&c&&1===c.length&&"string"==typeof c[0]&&null!=l&&l.splitText!==undefined&&null==l.nextSibling?l.nodeValue!=c[0]&&(l.nodeValue=c[0]):(c&&c.length||null!=l)&&function S(e,t,n,r,o){var i,u,a,l,s,c=e.childNodes,p=[],f={},d=0,h=0,m=c.length,v=0,y=t?t.length:0;if(0!==m)for(var b=0;b<m;b++){var g=c[b],_=g["__preactattr_"],w=y&&_?g._component?g._component.__key:_.key:null;null!=w?(d++,f[w]=g):(_||(g.splitText!==undefined?!o||g.nodeValue.trim():o))&&(p[v++]=g)}if(0!==y)for(var b=0;b<y;b++){l=t[b],s=null;var w=l.key;if(null!=w)d&&f[w]!==undefined&&(s=f[w],f[w]=undefined,d--);else if(h<v)for(i=h;i<v;i++)if(p[i]!==undefined&&(x=u=p[i],C=o,"string"==typeof(O=l)||"number"==typeof O?x.splitText!==undefined:"string"==typeof O.nodeName?!x._componentConstructor&&I(x,O.nodeName):C||x._componentConstructor===O.nodeName)){s=u,p[i]=undefined,i===v-1&&v--,i===h&&h++;break}s=F(s,l,n,r),a=c[b],s&&s!==e&&s!==a&&(null==a?e.appendChild(s):s===a.nextSibling?k(a):e.insertBefore(s,a))}var x,O,C;if(d)for(var b in f)f[b]!==undefined&&R(f[b],!1);for(;h<=v;)(s=p[v--])!==undefined&&R(s,!1)}(i,c,n,r,T||null!=s.dangerouslySetInnerHTML),function m(e,t,n){var r;for(r in n)t&&null!=t[r]||null==n[r]||v(e,r,n[r],n[r]=undefined,j);for(r in t)"children"===r||"innerHTML"===r||r in n&&t[r]===("value"===r||"checked"===r?e[r]:n[r])||v(e,r,n[r],n[r]=t[r],j)}(i,t.attributes,s),j=u,i}function R(e,t){var n=e._component;n?q(n):(null!=e["__preactattr_"]&&e["__preactattr_"].ref&&e["__preactattr_"].ref(null),!1!==t&&null!=e["__preactattr_"]||k(e),h(e))}function h(e){for(e=e.lastChild;e;){var t=e.previousSibling;R(e,!0),e=t}}var m=[];function D(e,t,n){var r,o=m.length;for(e.prototype&&e.prototype.render?(r=new e(t,n),b.call(r,t,n)):((r=new b(t,n)).constructor=e,r.render=y);o--;)if(m[o].constructor===e)return r.nextBase=m[o].nextBase,m.splice(o,1),r;return r}function y(e,t,n){return this.constructor(e,n)}function U(e,t,n,r,o){e._disable||(e._disable=!0,e.__ref=t.ref,e.__key=t.key,delete t.ref,delete t.key,"undefined"==typeof e.constructor.getDerivedStateFromProps&&(!e.base||o?e.componentWillMount&&e.componentWillMount():e.componentWillReceiveProps&&e.componentWillReceiveProps(t,r)),r&&r!==e.context&&(e.prevContext||(e.prevContext=e.context),e.context=r),e.prevProps||(e.prevProps=e.props),e.props=t,e._disable=!1,0!==n&&(1!==n&&!1===E.syncComponentUpdates&&e.base?a(e):V(e,1,o)),e.__ref&&e.__ref(e))}function V(e,t,n,r){if(!e._disable){var o,i,u,a=e.props,l=e.state,s=e.context,c=e.prevProps||a,p=e.prevState||l,f=e.prevContext||s,d=e.base,h=e.nextBase,m=d||h,v=e._component,y=!1,b=f;if(e.constructor.getDerivedStateFromProps&&(l=N(N({},l),e.constructor.getDerivedStateFromProps(a,l)),e.state=l),d&&(e.props=c,e.state=p,e.context=f,2!==t&&e.shouldComponentUpdate&&!1===e.shouldComponentUpdate(a,l,s)?y=!0:e.componentWillUpdate&&e.componentWillUpdate(a,l,s),e.props=a,e.state=l,e.context=s),e.prevProps=e.prevState=e.prevContext=e.nextBase=null,e._dirty=!1,!y){o=e.render(a,l,s),e.getChildContext&&(s=N(N({},s),e.getChildContext())),d&&e.getSnapshotBeforeUpdate&&(b=e.getSnapshotBeforeUpdate(c,p));var g,_,w=o&&o.nodeName;if("function"==typeof w){var x=M(o);(i=v)&&i.constructor===w&&x.key==i.__key?U(i,x,1,s,!1):(g=i,e._component=i=D(w,x,s),i.nextBase=i.nextBase||h,i._parentComponent=e,U(i,x,0,s,!1),V(i,1,n,!0)),_=i.base}else u=m,(g=v)&&(u=e._component=null),(m||1===t)&&(u&&(u._component=null),_=function B(t,n,r,o,i,u){P++||(j=null!=i&&i.ownerSVGElement!==undefined,T=null!=t&&!("__preactattr_"in t));var a=F(t,n,r,o,u);return i&&a.parentNode!==i&&i.appendChild(a),--P||(T=!1,u||L()),a}(u,o,s,n||!d,m&&m.parentNode,!0));if(m&&_!==m&&i!==v){var O=m.parentNode;O&&_!==O&&(O.replaceChild(_,m),g||(m._component=null,R(m,!1)))}if(g&&q(g),(e.base=_)&&!r){for(var C=e,S=e;S=S._parentComponent;)(C=S).base=_;_._component=C,_._componentConstructor=C.constructor}}for(!d||n?A.unshift(e):y||(e.componentDidUpdate&&e.componentDidUpdate(c,p,b),E.afterUpdate&&E.afterUpdate(e));e._renderCallbacks.length;)e._renderCallbacks.pop().call(e);P||r||L()}}function q(e){E.beforeUnmount&&E.beforeUnmount(e);var t=e.base;e._disable=!0,e.componentWillUnmount&&e.componentWillUnmount(),e.base=null;var n=e._component;n?q(n):t&&(t["__preactattr_"]&&t["__preactattr_"].ref&&t["__preactattr_"].ref(null),k(e.nextBase=t),m.push(e),h(t)),e.__ref&&e.__ref(null)}function b(e,t){this._dirty=!0,this.context=t,this.props=e,this.state=this.state||{},this._renderCallbacks=[]}function g(e,t,n){return B(n,e,{},!1,t,!1)}N(b.prototype,{setState:function(e,t){this.prevState||(this.prevState=this.state),this.state=N(N({},this.state),"function"==typeof e?e(this.state,this.props):e),t&&this._renderCallbacks.push(t),a(this)},forceUpdate:function(e){e&&this._renderCallbacks.push(e),V(this,2)},render:function g(){}});var _={h:r,createElement:r,cloneElement:i,Component:b,render:g,rerender:f,options:E};t["default"]=_},function(e,t){var n=e.exports={version:"2.5.7"};"number"==typeof __e&&(__e=n)},function(e,t,n){var r=n(8),o=n(40);e.exports=n(3)?function(e,t,n){return r.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){var o=n(9),i=n(38),u=n(39),a=Object.defineProperty;t.f=n(3)?Object.defineProperty:function(e,t,n){if(o(e),t=u(t,!0),o(n),i)try{return a(e,t,n)}catch(r){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){var r=n(2);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(e===undefined?"":e,")_",(++n+r).toString(36))}},function(e,t,n){var r=n(22);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t){e.exports=function(e){if(e==undefined)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){"use strict";var r=n(4);e.exports=function(e,t){return!!e&&r(function(){t?e.call(null,function(){},1):e.call(null)})}},function(e,t,n){var r=n(0);r(r.S+r.F,"Object",{assign:n(41)})},function(e,t,n){var r=n(2),o=n(1).document,i=r(o)&&r(o.createElement);e.exports=function(e){return i?o.createElement(e):{}}},function(e,t,n){var i=n(1),u=n(7),a=n(17),l=n(10)("src"),r="toString",o=Function[r],s=(""+o).split(r);n(6).inspectSource=function(e){return o.call(e)},(e.exports=function(e,t,n,r){var o="function"==typeof n;o&&(a(n,"name")||u(n,"name",t)),e[t]!==n&&(o&&(a(n,l)||u(n,l,e[t]?""+e[t]:s.join(String(t)))),e===i?e[t]=n:r?e[t]?e[t]=n:u(e,t,n):(delete e[t],u(e,t,n)))})(Function.prototype,r,function(){return"function"==typeof this&&this[l]||o.call(this)})},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var i=n(19);e.exports=function(r,o,e){if(i(r),o===undefined)return r;switch(e){case 1:return function(e){return r.call(o,e)};case 2:return function(e,t){return r.call(o,e,t)};case 3:return function(e,t,n){return r.call(o,e,t,n)}}return function(){return r.apply(o,arguments)}}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,n){var r=n(42),o=n(28);e.exports=Object.keys||function(e){return r(e,o)}},function(e,t,n){var r=n(11),o=n(12);e.exports=function(e){return r(o(e))}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var l=n(21),s=n(24),c=n(43);e.exports=function(a){return function(e,t,n){var r,o=l(e),i=s(o.length),u=c(n,i);if(a&&t!=t){for(;u<i;)if((r=o[u++])!=r)return!0}else for(;u<i;u++)if((a||u in o)&&o[u]===t)return a||u||0;return!a&&-1}}},function(e,t,n){var r=n(25),o=Math.min;e.exports=function(e){return 0<e?o(r(e),9007199254740991):0}},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(0<e?r:n)(e)}},function(e,t,n){var r=n(27)("keys"),o=n(10);e.exports=function(e){return r[e]||(r[e]=o(e))}},function(e,t,n){var r=n(6),o=n(1),i="__core-js_shared__",u=o[i]||(o[i]={});(e.exports=function(e,t){return u[e]||(u[e]=t!==undefined?t:{})})("versions",[]).push({version:r.version,mode:n(44)?"pure":"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){var r=n(12);e.exports=function(e){return Object(r(e))}},function(e,t,n){var r=n(8).f,o=Function.prototype,i=/^\s*function ([^ (]*)/;"name"in o||n(3)&&r(o,"name",{configurable:!0,get:function(){try{return(""+this).match(i)[1]}catch(e){return""}}})},function(e,t,n){"use strict";var r=n(0),o=n(32)(1);r(r.P+r.F*!n(13)([].map,!0),"Array",{map:function(e){return o(this,e,arguments[1])}})},function(e,t,n){var g=n(18),_=n(11),w=n(29),x=n(24),r=n(47);e.exports=function(p,e){var f=1==p,d=2==p,h=3==p,m=4==p,v=6==p,y=5==p||v,b=e||r;return function(e,t,n){for(var r,o,i=w(e),u=_(i),a=g(t,n,3),l=x(u.length),s=0,c=f?b(e,l):d?b(e,0):undefined;s<l;s++)if((y||s in u)&&(o=a(r=u[s],s,i),p))if(f)c[s]=o;else if(o)switch(p){case 3:return!0;case 5:return r;case 6:return s;case 2:c.push(r)}else if(m)return!1;return v?-1:h||m?m:c}}},function(e,t,n){var r=n(22);e.exports=Array.isArray||function(e){return"Array"==r(e)}},function(e,t,n){var r=n(27)("wks"),o=n(10),i=n(1).Symbol,u="function"==typeof i;(e.exports=function(e){return r[e]||(r[e]=u&&i[e]||(u?i:o)("Symbol."+e))}).store=r},function(e,t,n){"use strict";var r=n(0),o=n(23)(!1),i=[].indexOf,u=!!i&&1/[1].indexOf(1,-0)<0;r(r.P+r.F*(u||!n(13)(i)),"Array",{indexOf:function(e){return u?i.apply(this,arguments)||0:o(this,e,arguments[1])}})},function(e,t,n){var r=n(0);r(r.S,"Object",{create:n(52)})},function(e,t,n){"use strict";t.__esModule=!0,t["default"]=void 0,n(14),n(30),n(31),n(35),n(49),n(50);var r=n(5),o=function l(e){return e&&e.__esModule?e:{"default":e}}(n(51));function i(e){if(!e.element)throw new Error("element is not defined");if(!e.id)throw new Error("id is not defined");if(!e.source)throw new Error("source is not defined");Array.isArray(e.source)&&(e.source=u(e.source)),(0,r.render)((0,r.createElement)(o["default"],e),e.element)}var u=function u(n){return function(t,e){e(n.filter(function(e){return-1!==e.toLowerCase().indexOf(t.toLowerCase())}))}};i.enhanceSelectElement=function(n){if(!n.selectElement)throw new Error("selectElement is not defined");if(!n.source){var e=[].filter.call(n.selectElement.options,function(e){return e.value||n.preserveNullOptions});n.source=e.map(function(e){return e.textContent||e.innerText})}if(n.onConfirm=n.onConfirm||function(t){var e=[].filter.call(n.selectElement.options,function(e){return(e.textContent||e.innerText)===t})[0];e&&(e.selected=!0)},n.selectElement.value||n.defaultValue===undefined){var t=n.selectElement.options[n.selectElement.options.selectedIndex];n.defaultValue=t.textContent||t.innerText}n.name===undefined&&(n.name=""),n.id===undefined&&(n.selectElement.id===undefined?n.id="":n.id=n.selectElement.id),n.autoselect===undefined&&(n.autoselect=!0);var r=document.createElement("span");n.selectElement.parentNode.insertBefore(r,n.selectElement),i(Object.assign({},n,{element:r})),n.selectElement.style.display="none",n.selectElement.id=n.selectElement.id+"-select"};var a=i;t["default"]=a},function(e,t,n){e.exports=!n(3)&&!n(4)(function(){return 7!=Object.defineProperty(n(15)("div"),"a",{get:function(){return 7}}).a})},function(e,t,n){var o=n(2);e.exports=function(e,t){if(!o(e))return e;var n,r;if(t&&"function"==typeof(n=e.toString)&&!o(r=n.call(e)))return r;if("function"==typeof(n=e.valueOf)&&!o(r=n.call(e)))return r;if(!t&&"function"==typeof(n=e.toString)&&!o(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){"use strict";var f=n(20),d=n(45),h=n(46),m=n(29),v=n(11),o=Object.assign;e.exports=!o||n(4)(function(){var e={},t={},n=Symbol(),r="abcdefghijklmnopqrst";return e[n]=7,r.split("").forEach(function(e){t[e]=e}),7!=o({},e)[n]||Object.keys(o({},t)).join("")!=r})?function(e,t){for(var n=m(e),r=arguments.length,o=1,i=d.f,u=h.f;o<r;)for(var a,l=v(arguments[o++]),s=i?f(l).concat(i(l)):f(l),c=s.length,p=0;p<c;)u.call(l,a=s[p++])&&(n[a]=l[a]);return n}:o},function(e,t,n){var u=n(17),a=n(21),l=n(23)(!1),s=n(26)("IE_PROTO");e.exports=function(e,t){var n,r=a(e),o=0,i=[];for(n in r)n!=s&&u(r,n)&&i.push(n);for(;t.length>o;)u(r,n=t[o++])&&(~l(i,n)||i.push(n));return i}},function(e,t,n){var r=n(25),o=Math.max,i=Math.min;e.exports=function(e,t){return(e=r(e))<0?o(e+t,0):i(e,t)}},function(e,t){e.exports=!1},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,n){var r=n(48);e.exports=function(e,t){return new(r(e))(t)}},function(e,t,n){var r=n(2),o=n(33),i=n(34)("species");e.exports=function(e){var t;return o(e)&&("function"!=typeof(t=e.constructor)||t!==Array&&!o(t.prototype)||(t=undefined),r(t)&&null===(t=t[i])&&(t=undefined)),t===undefined?Array:t}},function(e,t,n){"use strict";var r=n(0),o=n(32)(2);r(r.P+r.F*!n(13)([].filter,!0),"Array",{filter:function(e){return o(this,e,arguments[1])}})},function(e,t,n){var r=n(0);r(r.S,"Array",{isArray:n(33)})},function(e,t,n){"use strict";t.__esModule=!0,t["default"]=void 0,n(14),n(36),n(30),n(31),n(35),n(55),n(58);var G=n(5),J=o(n(60)),r=o(n(61));function o(e){return e&&e.__esModule?e:{"default":e}}function X(){return(X=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function i(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var u,a={13:"enter",27:"escape",32:"space",38:"up",40:"down"},Y=((u=document.createElement("x")).style.cssText="pointer-events:auto","auto"===u.style.pointerEvents);function Z(){return!(!navigator.userAgent.match(/(iPod|iPhone|iPad)/g)||!navigator.userAgent.match(/AppleWebKit/g))}var l=function(n){function e(e){var t;return(t=n.call(this,e)||this).elementReferences={},t.state={focused:null,hovered:null,clicked:null,menuOpen:!1,options:e.defaultValue?[e.defaultValue]:[],query:e.defaultValue,validChoiceMade:!1,selected:null,ariaHint:!0},t.handleComponentBlur=t.handleComponentBlur.bind(i(i(t))),t.handleKeyDown=t.handleKeyDown.bind(i(i(t))),t.handleUpArrow=t.handleUpArrow.bind(i(i(t))),t.handleDownArrow=t.handleDownArrow.bind(i(i(t))),t.handleEnter=t.handleEnter.bind(i(i(t))),t.handlePrintableKey=t.handlePrintableKey.bind(i(i(t))),t.handleListMouseLeave=t.handleListMouseLeave.bind(i(i(t))),t.handleOptionBlur=t.handleOptionBlur.bind(i(i(t))),t.handleOptionClick=t.handleOptionClick.bind(i(i(t))),t.handleOptionFocus=t.handleOptionFocus.bind(i(i(t))),t.handleOptionMouseEnter=t.handleOptionMouseEnter.bind(i(i(t))),t.handleInputBlur=t.handleInputBlur.bind(i(i(t))),t.handleInputChange=t.handleInputChange.bind(i(i(t))),t.handleInputFocus=t.handleInputFocus.bind(i(i(t))),t.pollInputElement=t.pollInputElement.bind(i(i(t))),t.getDirectInputChanges=t.getDirectInputChanges.bind(i(i(t))),t}(function r(e,t){e.prototype=Object.create(t.prototype),(e.prototype.constructor=e).__proto__=t})(e,n);var t=e.prototype;return t.isQueryAnOption=function(e,t){var n=this;return-1!==t.map(function(e){return n.templateInputValue(e).toLowerCase()}).indexOf(e.toLowerCase())},t.componentDidMount=function(){this.pollInputElement()},t.componentWillUnmount=function(){clearTimeout(this.$pollInput),clearTimeout(this.$blurInput)},t.pollInputElement=function(){var e=this;this.getDirectInputChanges(),this.$pollInput=setTimeout(function(){e.pollInputElement()},100)},t.getDirectInputChanges=function(){var e=this.elementReferences[-1];e&&e.value!==this.state.query&&this.handleInputChange({target:{value:e.value}})},t.componentDidUpdate=function(e,t){var n=this.state,r=n.focused,o=n.clicked,i=null===r,u=t.focused!==r;(u&&!i||null!==o)&&this.elementReferences[r].focus();var a=-1===r,l=u&&null===t.focused;if(a&&l){var s=this.elementReferences[r];s.setSelectionRange(0,s.value.length)}},t.hasAutoselect=function(){return!Z()&&this.props.autoselect},t.templateInputValue=function(e){var t=this.props.templates&&this.props.templates.inputValue;return t?t(e):e},t.templateSuggestion=function(e){var t=this.props.templates&&this.props.templates.suggestion;return t?t(e):e},t.handleComponentBlur=function(e){var t,n=this.state,r=n.options,o=n.query,i=n.selected;this.props.confirmOnBlur?(t=e.query||o,this.props.onConfirm(r[i])):t=o,this.setState({focused:null,clicked:null,menuOpen:e.menuOpen||!1,query:t,selected:null,validChoiceMade:this.isQueryAnOption(t,r)})},t.handleListMouseLeave=function(e){this.setState({hovered:null})},t.handleOptionBlur=function(e,t){var n=this.state,r=n.focused,o=n.clicked,i=n.menuOpen,u=n.options,a=n.selected,l=null===e.relatedTarget&&null===o,s=e.relatedTarget===this.elementReferences[-1],c=r!==t&&-1!==r;if(!c&&l||!(c||s)){var p=i&&Z();this.handleComponentBlur({menuOpen:p,query:this.templateInputValue(u[a])})}},t.handleInputBlur=function(e){var t=this,n=this.state,r=n.focused,o=n.menuOpen,i=n.options,u=n.query,a=n.selected,l=-1!==r;if(clearTimeout(this.$blurInput),!l){var s=o&&Z(),c=Z()?u:this.templateInputValue(i[a]);this.$blurInput=setTimeout(function(){return t.handleComponentBlur({menuOpen:s,query:c})},200)}},t.handleInputChange=function(e){var n=this,t=this.props,r=t.minLength,o=t.source,i=t.showAllValues,u=this.hasAutoselect(),a=e.target.value,l=0===a.length,s=this.state.query.length!==a.length,c=a.length>=r;this.setState({query:a,ariaHint:l}),i||!l&&s&&c?o(a,function(e){var t=0<e.length;n.setState({menuOpen:t,options:e,selected:u&&t?0:-1,validChoiceMade:!1})}):!l&&c||this.setState({menuOpen:!1,options:[]})},t.handleInputClick=function(e){this.handleInputChange(e)},t.handleInputFocus=function(e){var t=this.state,n=t.query,r=t.validChoiceMade,o=t.options,i=this.props.minLength,u=!r&&n.length>=i&&0<o.length;u?this.setState(function(e){var t=e.menuOpen;return{focused:-1,menuOpen:u||t,selected:-1}}):this.setState({focused:-1})},t.handleOptionFocus=function(e){this.setState({focused:e,hovered:null,selected:e})},t.handleOptionMouseEnter=function(e,t){Z()||this.setState({hovered:t})},t.handleOptionClick=function(e,t){var n=this.state.options[t],r=this.templateInputValue(n);clearTimeout(this.$blurInput),this.props.onConfirm(n),this.setState({focused:-1,clicked:t,hovered:null,menuOpen:!1,query:r,selected:-1,validChoiceMade:!0}),this.forceUpdate()},t.handleUpArrow=function(e){e.preventDefault();var t=this.state,n=t.menuOpen,r=t.selected;-1!==r&&n&&this.handleOptionFocus(r-1)},t.handleDownArrow=function(e){var t=this;if(e.preventDefault(),this.props.showAllValues&&!1===this.state.menuOpen)e.preventDefault(),this.props.source("",function(e){t.setState({menuOpen:!0,options:e,selected:0,focused:0,hovered:null})});else if(!0===this.state.menuOpen){var n=this.state,r=n.menuOpen,o=n.options,i=n.selected;i!==o.length-1&&r&&this.handleOptionFocus(i+1)}},t.handleSpace=function(e){var t=this;this.props.showAllValues&&!1===this.state.menuOpen&&""===this.state.query&&(e.preventDefault(),this.props.source("",function(e){t.setState({menuOpen:!0,options:e})})),-1!==this.state.focused&&(e.preventDefault(),this.handleOptionClick(e,this.state.focused))},t.handleEnter=function(e){this.state.menuOpen&&(e.preventDefault(),0<=this.state.selected&&this.handleOptionClick(e,this.state.selected))},t.handlePrintableKey=function(e){var t=this.elementReferences[-1];e.target===t||t.focus()},t.handleKeyDown=function(e){switch(a[e.keyCode]){case"up":this.handleUpArrow(e);break;case"down":this.handleDownArrow(e);break;case"space":this.handleSpace(e);break;case"enter":this.handleEnter(e);break;case"escape":this.handleComponentBlur({query:this.state.query});break;default:(function t(e){return 47<e&&e<58||32===e||8===e||64<e&&e<91||95<e&&e<112||185<e&&e<193||218<e&&e<223})(e.keyCode)&&this.handlePrintableKey(e)}},t.render=function(){var e,i=this,t=this.props,n=t.cssNamespace,r=t.displayMenu,u=t.id,o=t.minLength,a=t.name,l=t.placeholder,s=t.required,c=t.showAllValues,p=t.tNoResults,f=t.tStatusQueryTooShort,d=t.tStatusNoResults,h=t.tStatusSelectedOption,m=t.tStatusResults,v=t.tAssistiveHint,y=t.dropdownArrow,b=this.state,g=b.focused,_=b.hovered,w=b.menuOpen,x=b.options,O=b.query,C=b.selected,S=b.ariaHint,E=b.validChoiceMade,N=this.hasAutoselect(),I=-1===g,M=0===x.length,k=0!==O.length,A=O.length>=o,P=this.props.showNoOptionsFound&&I&&M&&k&&A,j=n+"__wrapper",T=n+"__input",L=null!==g?" "+T+"--focused":"",B=this.props.showAllValues?" "+T+"--show-all-values":" "+T+"--default",F=n+"__dropdown-arrow-down",R=-1!==g&&null!==g,D=n+"__menu",U=D+"--"+r,V=D+"--"+(w||P?"visible":"hidden"),q=n+"__option",W=n+"__hint",H=this.templateInputValue(x[C]),K=H&&0===H.toLowerCase().indexOf(O.toLowerCase())&&N?O+H.substr(O.length):"",Q=Y&&K,$=S?{"aria-describedby":"assistiveHint"}:null;return c&&"string"==typeof(e=y({className:F}))&&(e=(0,G.createElement)("div",{className:n+"__dropdown-arrow-down-wrapper",dangerouslySetInnerHTML:{__html:e}})),(0,G.createElement)("div",{className:j,onKeyDown:this.handleKeyDown},(0,G.createElement)(J["default"],{length:x.length,queryLength:O.length,minQueryLength:o,selectedOption:this.templateInputValue(x[C]),selectedOptionIndex:C,validChoiceMade:E,isInFocus:null!==this.state.focused,tQueryTooShort:f,tNoResults:d,tSelectedOption:h,tResults:m}),Q&&(0,G.createElement)("span",null,(0,G.createElement)("input",{className:W,readonly:!0,tabIndex:"-1",value:K})),(0,G.createElement)("input",X({"aria-expanded":w?"true":"false","aria-activedescendant":!!R&&u+"__option--"+g,"aria-owns":u+"__listbox","aria-autocomplete":this.hasAutoselect()?"both":"list"},$,{autoComplete:"off",className:""+T+L+B,id:u,onClick:function(e){return i.handleInputClick(e)},onBlur:this.handleInputBlur},function z(e){return{onInput:e}}(this.handleInputChange),{onFocus:this.handleInputFocus,name:a,placeholder:l,ref:function(e){i.elementReferences[-1]=e},type:"text",role:"combobox",required:s,value:O})),e,(0,G.createElement)("ul",{className:D+" "+U+" "+V,onMouseLeave:function(e){return i.handleListMouseLeave(e)},id:u+"__listbox",role:"listbox"},x.map(function(e,t){var n=(-1===g?C===t:g===t)&&null===_?" "+q+"--focused":"",r=t%2?" "+q+"--odd":"",o=Z()?"<span id="+u+"__option-suffix--"+t+' style="border:0;clip:rect(0 0 0 0);height:1px;marginBottom:-1px;marginRight:-1px;overflow:hidden;padding:0;position:absolute;whiteSpace:nowrap;width:1px"> '+(t+1)+" of "+x.length+"</span>":"";return(0,G.createElement)("li",{"aria-selected":g===t,className:""+q+n+r,dangerouslySetInnerHTML:{__html:i.templateSuggestion(e)+o},id:u+"__option--"+t,key:t,onBlur:function(e){return i.handleOptionBlur(e,t)},onClick:function(e){return i.handleOptionClick(e,t)},onMouseEnter:function(e){return i.handleOptionMouseEnter(e,t)},ref:function(e){i.elementReferences[t]=e},role:"option",tabIndex:"-1","aria-posinset":t+1,"aria-setsize":x.length})}),P&&(0,G.createElement)("li",{className:q+" "+q+"--no-results"},p())),(0,G.createElement)("span",{id:"assistiveHint",style:{display:"none"}},v()))},e}(G.Component);(t["default"]=l).defaultProps={autoselect:!1,cssNamespace:"autocomplete",defaultValue:"",displayMenu:"inline",minLength:0,name:"input-autocomplete",placeholder:"",onConfirm:function(){},confirmOnBlur:!0,showNoOptionsFound:!0,showAllValues:!1,required:!1,tNoResults:function(){return"No results found"},tAssistiveHint:function(){return"When autocomplete results are available use up and down arrows to review and enter to select. Touch device users, explore by touch or with swipe gestures."},dropdownArrow:r["default"]}},function(e,t,r){var o=r(9),i=r(53),u=r(28),a=r(26)("IE_PROTO"),l=function(){},s="prototype",c=function(){var e,t=r(15)("iframe"),n=u.length;for(t.style.display="none",r(54).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("<script>document.F=Object<\/script>"),e.close(),c=e.F;n--;)delete c[s][u[n]];return c()};e.exports=Object.create||function(e,t){var n;return null!==e?(l[s]=o(e),n=new l,l[s]=null,n[a]=e):n=c(),t===undefined?n:i(n,t)}},function(e,t,n){var u=n(8),a=n(9),l=n(20);e.exports=n(3)?Object.defineProperties:function(e,t){a(e);for(var n,r=l(t),o=r.length,i=0;i<o;)u.f(e,n=r[i++],t[n]);return e}},function(e,t,n){var r=n(1).document;e.exports=r&&r.documentElement},function(e,t,n){var r=n(0);r(r.P,"Function",{bind:n(56)})},function(e,t,n){"use strict";var i=n(19),u=n(2),a=n(57),l=[].slice,s={};e.exports=Function.bind||function(t){var n=i(this),r=l.call(arguments,1),o=function(){var e=r.concat(l.call(arguments));return this instanceof o?function(e,t,n){if(!(t in s)){for(var r=[],o=0;o<t;o++)r[o]="a["+o+"]";s[t]=Function("F,a","return new F("+r.join(",")+")")}return s[t](e,n)}(n,e.length,e):a(n,e,t)};return u(n.prototype)&&(o.prototype=n.prototype),o}},function(e,t){e.exports=function(e,t,n){var r=n===undefined;switch(t.length){case 0:return r?e():e.call(n);case 1:return r?e(t[0]):e.call(n,t[0]);case 2:return r?e(t[0],t[1]):e.call(n,t[0],t[1]);case 3:return r?e(t[0],t[1],t[2]):e.call(n,t[0],t[1],t[2]);case 4:return r?e(t[0],t[1],t[2],t[3]):e.call(n,t[0],t[1],t[2],t[3])}return e.apply(n,t)}},function(e,t,n){n(59)("match",1,function(r,o,e){return[function(e){"use strict";var t=r(this),n=e==undefined?undefined:e[o];return n!==undefined?n.call(e,t):new RegExp(e)[o](String(t))},e]})},function(e,t,n){"use strict";var a=n(7),l=n(16),s=n(4),c=n(12),p=n(34);e.exports=function(t,e,n){var r=p(t),o=n(c,r,""[t]),i=o[0],u=o[1];s(function(){var e={};return e[r]=function(){return 7},7!=""[t](e)})&&(l(String.prototype,t,i),a(RegExp.prototype,r,2==e?function(e,t){return u.call(e,this,t)}:function(e){return u.call(e,this)}))}},function(e,t,n){"use strict";t.__esModule=!0,t["default"]=void 0,n(36);var b=n(5);var r=function r(o,i,u){var a;return function(){var e=this,t=arguments,n=function n(){a=null,u||o.apply(e,t)},r=u&&!a;clearTimeout(a),a=setTimeout(n,i),r&&o.apply(e,t)}},o=function(o){function e(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return(e=o.call.apply(o,[this].concat(n))||this).state={bump:!1,debounced:!1},e}(function n(e,t){e.prototype=Object.create(t.prototype),(e.prototype.constructor=e).__proto__=t})(e,o);var t=e.prototype;return t.componentWillMount=function(){var e=this;this.debounceStatusUpdate=r(function(){if(!e.state.debounced){var t=!e.props.isInFocus||e.props.validChoiceMade;e.setState(function(e){return{bump:!e.bump,debounced:!0,silenced:t}})}},1400)},t.componentWillReceiveProps=function(e){e.queryLength;this.setState({debounced:!1})},t.render=function(){var e=this.props,t=e.length,n=e.queryLength,r=e.minQueryLength,o=e.selectedOption,i=e.selectedOptionIndex,u=e.tQueryTooShort,a=e.tNoResults,l=e.tSelectedOption,s=e.tResults,c=this.state,p=c.bump,f=c.debounced,d=c.silenced,h=n<r,m=0===t,v=o?l(o,t,i):"",y=null;return y=h?u(r):m?a():s(t,v),this.debounceStatusUpdate(),(0,b.createElement)("div",{style:{border:"0",clip:"rect(0 0 0 0)",height:"1px",marginBottom:"-1px",marginRight:"-1px",overflow:"hidden",padding:"0",position:"absolute",whiteSpace:"nowrap",width:"1px"}},(0,b.createElement)("div",{id:"ariaLiveA",role:"status","aria-atomic":"true","aria-live":"polite"},!d&&f&&p?y:""),(0,b.createElement)("div",{id:"ariaLiveB",role:"status","aria-atomic":"true","aria-live":"polite"},d||!f||p?"":y))},e}(b.Component);(t["default"]=o).defaultProps={tQueryTooShort:function(e){return"Type in "+e+" or more characters for results"},tNoResults:function(){return"No search results"},tSelectedOption:function(e,t,n){return e+" "+(n+1)+" of "+t+" is highlighted"},tResults:function(e,t){return e+" "+(1===e?"result":"results")+" "+(1===e?"is":"are")+" available. "+t}}},function(e,t,n){"use strict";t.__esModule=!0,t["default"]=void 0;var r=n(5),o=function i(e){var t=e.className;return(0,r.createElement)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",className:t,focusable:"false"},(0,r.createElement)("g",{stroke:"none",fill:"none","fill-rule":"evenodd"},(0,r.createElement)("polygon",{fill:"#000000",points:"0 0 22 0 11 17"})))};t["default"]=o}])["default"]}); | ||
//# sourceMappingURL=accessible-autocomplete.min.js.map |
@@ -1,2 +0,2 @@ | ||
(function webpackUniversalModuleDefinition(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("preact")):"function"==typeof define&&define.amd?define(["preact"],t):"object"==typeof exports?exports["Autocomplete"]=t(require("preact")):e["Autocomplete"]=t(e["preact"])})(window,function(n){return function(n){var r={};function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}return o.m=n,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="/",o(o.s=31)}([function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){var m=n(0),v=n(5),y=n(6),g=n(14),b=n(16),O="prototype",w=function(e,t,n){var r,o,u,i,a=e&w.F,s=e&w.G,l=e&w.S,c=e&w.P,p=e&w.B,f=s?m:l?m[t]||(m[t]={}):(m[t]||{})[O],d=s?v:v[t]||(v[t]={}),h=d[O]||(d[O]={});for(r in s&&(n=t),n)u=((o=!a&&f&&f[r]!==undefined)?f:n)[r],i=p&&o?b(u,m):c&&"function"==typeof u?b(Function.call,u):u,f&&g(f,r,u,e&w.U),d[r]!=u&&y(d,r,i),c&&h[r]!=u&&(h[r]=u)};m.core=v,w.F=1,w.G=2,w.S=4,w.P=8,w.B=16,w.W=32,w.U=64,w.R=128,e.exports=w},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){e.exports=!n(4)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t){e.exports=function(e){try{return!!e()}catch(t){return!0}}},function(e,t){var n=e.exports={version:"2.5.7"};"number"==typeof __e&&(__e=n)},function(e,t,n){var r=n(7),o=n(35);e.exports=n(3)?function(e,t,n){return r.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){var o=n(8),u=n(33),i=n(34),a=Object.defineProperty;t.f=n(3)?Object.defineProperty:function(e,t,n){if(o(e),t=i(t,!0),o(n),u)try{return a(e,t,n)}catch(r){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){var r=n(2);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(e===undefined?"":e,")_",(++n+r).toString(36))}},function(e,t,n){var r=n(20);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t){e.exports=function(e){if(e==undefined)throw TypeError("Can't call method on "+e);return e}},function(e,t){e.exports=n},function(e,t,n){var r=n(2),o=n(0).document,u=r(o)&&r(o.createElement);e.exports=function(e){return u?o.createElement(e):{}}},function(e,t,n){var u=n(0),i=n(6),a=n(15),s=n(9)("src"),r="toString",o=Function[r],l=(""+o).split(r);n(5).inspectSource=function(e){return o.call(e)},(e.exports=function(e,t,n,r){var o="function"==typeof n;o&&(a(n,"name")||i(n,"name",t)),e[t]!==n&&(o&&(a(n,s)||i(n,s,e[t]?""+e[t]:l.join(String(t)))),e===u?e[t]=n:r?e[t]?e[t]=n:i(e,t,n):(delete e[t],i(e,t,n)))})(Function.prototype,r,function(){return"function"==typeof this&&this[s]||o.call(this)})},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var u=n(17);e.exports=function(r,o,e){if(u(r),o===undefined)return r;switch(e){case 1:return function(e){return r.call(o,e)};case 2:return function(e,t){return r.call(o,e,t)};case 3:return function(e,t,n){return r.call(o,e,t,n)}}return function(){return r.apply(o,arguments)}}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,n){var r=n(37),o=n(26);e.exports=Object.keys||function(e){return r(e,o)}},function(e,t,n){var r=n(10),o=n(11);e.exports=function(e){return r(o(e))}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var s=n(19),l=n(22),c=n(38);e.exports=function(a){return function(e,t,n){var r,o=s(e),u=l(o.length),i=c(n,u);if(a&&t!=t){for(;i<u;)if((r=o[i++])!=r)return!0}else for(;i<u;i++)if((a||i in o)&&o[i]===t)return a||i||0;return!a&&-1}}},function(e,t,n){var r=n(23),o=Math.min;e.exports=function(e){return 0<e?o(r(e),9007199254740991):0}},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(0<e?r:n)(e)}},function(e,t,n){var r=n(25)("keys"),o=n(9);e.exports=function(e){return r[e]||(r[e]=o(e))}},function(e,t,n){var r=n(5),o=n(0),u="__core-js_shared__",i=o[u]||(o[u]={});(e.exports=function(e,t){return i[e]||(i[e]=t!==undefined?t:{})})("versions",[]).push({version:r.version,mode:n(39)?"pure":"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){var r=n(11);e.exports=function(e){return Object(r(e))}},function(e,t,n){var r=n(1);r(r.S,"Object",{create:n(42)})},function(e,t,n){var r=n(25)("wks"),o=n(9),u=n(0).Symbol,i="function"==typeof u;(e.exports=function(e){return r[e]||(r[e]=i&&u[e]||(i?u:o)("Symbol."+e))}).store=r},function(e,t,n){"use strict";var r=n(4);e.exports=function(e,t){return!!e&&r(function(){t?e.call(null,function(){},1):e.call(null)})}},function(e,t,n){"use strict";t.__esModule=!0,t["default"]=void 0,n(32),n(28),n(45),n(50),n(51),n(52),n(55);var $=n(12),W=o(n(57)),r=o(n(58));function o(e){return e&&e.__esModule?e:{"default":e}}function z(){return(z=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function u(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var i,a={13:"enter",27:"escape",32:"space",38:"up",40:"down"},G=((i=document.createElement("x")).style.cssText="pointer-events:auto","auto"===i.style.pointerEvents);function f(){return!(!navigator.userAgent.match(/(iPod|iPhone|iPad)/g)||!navigator.userAgent.match(/AppleWebKit/g))}var s=function(n){function e(e){var t;return(t=n.call(this,e)||this).elementReferences={},t.state={focused:null,hovered:null,clicked:null,menuOpen:!1,options:e.defaultValue?[e.defaultValue]:[],query:e.defaultValue,selected:null},t.handleComponentBlur=t.handleComponentBlur.bind(u(u(t))),t.handleKeyDown=t.handleKeyDown.bind(u(u(t))),t.handleUpArrow=t.handleUpArrow.bind(u(u(t))),t.handleDownArrow=t.handleDownArrow.bind(u(u(t))),t.handleEnter=t.handleEnter.bind(u(u(t))),t.handlePrintableKey=t.handlePrintableKey.bind(u(u(t))),t.handleListMouseLeave=t.handleListMouseLeave.bind(u(u(t))),t.handleOptionBlur=t.handleOptionBlur.bind(u(u(t))),t.handleOptionClick=t.handleOptionClick.bind(u(u(t))),t.handleOptionFocus=t.handleOptionFocus.bind(u(u(t))),t.handleOptionMouseEnter=t.handleOptionMouseEnter.bind(u(u(t))),t.handleInputBlur=t.handleInputBlur.bind(u(u(t))),t.handleInputChange=t.handleInputChange.bind(u(u(t))),t.handleInputFocus=t.handleInputFocus.bind(u(u(t))),t.pollInputElement=t.pollInputElement.bind(u(u(t))),t.getDirectInputChanges=t.getDirectInputChanges.bind(u(u(t))),t}(function r(e,t){e.prototype=Object.create(t.prototype),(e.prototype.constructor=e).__proto__=t})(e,n);var t=e.prototype;return t.componentDidMount=function(){this.pollInputElement()},t.componentWillUnmount=function(){clearTimeout(this.$pollInput),clearTimeout(this.$blurInput)},t.pollInputElement=function(){var e=this;this.getDirectInputChanges(),this.$pollInput=setTimeout(function(){e.pollInputElement()},100)},t.getDirectInputChanges=function(){var e=this.elementReferences[-1];e&&e.value!==this.state.query&&this.handleInputChange({target:{value:e.value}})},t.componentDidUpdate=function(e,t){var n=this.state,r=n.focused,o=n.clicked,u=null===r,i=t.focused!==r;(i&&!u||null!==o)&&this.elementReferences[r].focus();var a=-1===r,s=i&&null===t.focused;if(a&&s){var l=this.elementReferences[r];l.setSelectionRange(0,l.value.length)}},t.hasAutoselect=function(){return!f()&&this.props.autoselect},t.templateInputValue=function(e){var t=this.props.templates&&this.props.templates.inputValue;return t?t(e):e},t.templateSuggestion=function(e){var t=this.props.templates&&this.props.templates.suggestion;return t?t(e):e},t.handleComponentBlur=function(e){var t,n=this.state,r=n.options,o=n.query,u=n.selected;this.props.confirmOnBlur?(t=e.query||o,this.props.onConfirm(r[u])):t=o,this.setState({focused:null,clicked:null,menuOpen:e.menuOpen||!1,query:t,selected:null})},t.handleListMouseLeave=function(e){this.setState({hovered:null})},t.handleOptionBlur=function(e,t){var n=this.state,r=n.focused,o=n.clicked,u=n.menuOpen,i=n.options,a=n.selected,s=null===e.relatedTarget&&null===o,l=e.relatedTarget===this.elementReferences[-1],c=r!==t&&-1!==r;if(!c&&s||!(c||l)){var p=u&&f();this.handleComponentBlur({menuOpen:p,query:this.templateInputValue(i[a])})}},t.handleInputBlur=function(e){var t=this,n=this.state,r=n.focused,o=n.menuOpen,u=n.options,i=n.query,a=n.selected,s=-1!==r;if(clearTimeout(this.$blurInput),!s){var l=o&&f(),c=f()?i:this.templateInputValue(u[a]);this.$blurInput=setTimeout(function(){return t.handleComponentBlur({menuOpen:l,query:c})},200)}},t.handleInputChange=function(e){var n=this,t=this.props,r=t.minLength,o=t.source,u=t.showAllValues,i=this.hasAutoselect(),a=e.target.value,s=0===a.length,l=this.state.query.length!==a.length,c=a.length>=r;this.setState({query:a}),u||!s&&l&&c?o(a,function(e){var t=0<e.length;n.setState({menuOpen:t,options:e,selected:i&&t?0:-1})}):!s&&c||this.setState({menuOpen:!1,options:[]})},t.handleInputClick=function(e){this.handleInputChange(e)},t.handleInputFocus=function(e){this.setState({focused:-1})},t.handleOptionFocus=function(e){this.setState({focused:e,hovered:null,selected:e})},t.handleOptionMouseEnter=function(e,t){f()||this.setState({hovered:t})},t.handleOptionClick=function(e,t){var n=this.state.options[t],r=this.templateInputValue(n);clearTimeout(this.$blurInput),this.props.onConfirm(n),this.setState({focused:-1,clicked:t,hovered:null,menuOpen:!1,query:r,selected:-1}),this.forceUpdate()},t.handleUpArrow=function(e){e.preventDefault();var t=this.state,n=t.menuOpen,r=t.selected;-1!==r&&n&&this.handleOptionFocus(r-1)},t.handleDownArrow=function(e){var t=this;if(e.preventDefault(),this.props.showAllValues&&!1===this.state.menuOpen)e.preventDefault(),this.props.source("",function(e){t.setState({menuOpen:!0,options:e,selected:0,focused:0,hovered:null})});else if(!0===this.state.menuOpen){var n=this.state,r=n.menuOpen,o=n.options,u=n.selected;u!==o.length-1&&r&&this.handleOptionFocus(u+1)}},t.handleSpace=function(e){var t=this;this.props.showAllValues&&!1===this.state.menuOpen&&""===this.state.query&&(e.preventDefault(),this.props.source("",function(e){t.setState({menuOpen:!0,options:e})})),-1!==this.state.focused&&(e.preventDefault(),this.handleOptionClick(e,this.state.focused))},t.handleEnter=function(e){this.state.menuOpen&&(e.preventDefault(),0<=this.state.selected&&this.handleOptionClick(e,this.state.selected))},t.handlePrintableKey=function(e){var t=this.elementReferences[-1];e.target===t||t.focus()},t.handleKeyDown=function(e){switch(a[e.keyCode]){case"up":this.handleUpArrow(e);break;case"down":this.handleDownArrow(e);break;case"space":this.handleSpace(e);break;case"enter":this.handleEnter(e);break;case"escape":this.handleComponentBlur({query:this.state.query});break;default:(function t(e){return 47<e&&e<58||32===e||8===e||64<e&&e<91||95<e&&e<112||185<e&&e<193||218<e&&e<223})(e.keyCode)&&this.handlePrintableKey(e)}},t.render=function(){var e,o=this,t=this.props,n=t.cssNamespace,r=t.displayMenu,u=t.id,i=t.minLength,a=t.name,s=t.placeholder,l=t.required,c=t.showAllValues,p=t.tNoResults,f=t.tStatusQueryTooShort,d=t.tStatusNoResults,h=t.tStatusSelectedOption,m=t.tStatusResults,v=t.dropdownArrow,y=this.state,g=y.focused,b=y.hovered,O=y.menuOpen,w=y.options,x=y.query,_=y.selected,S=this.hasAutoselect(),I=-1===g,E=0===w.length,j=0!==x.length,C=x.length>=i,M=this.props.showNoOptionsFound&&I&&E&&j&&C,A=n+"__wrapper",P=n+"__input",k=null!==g?" "+P+"--focused":"",F=this.props.showAllValues?" "+P+"--show-all-values":" "+P+"--default",R=n+"__dropdown-arrow-down",q=-1!==g&&null!==g,T=n+"__menu",N=T+"--"+r,D=T+"--"+(O||M?"visible":"hidden"),L=n+"__option",B=n+"__hint",V=this.templateInputValue(w[_]),K=V&&0===V.toLowerCase().indexOf(x.toLowerCase())&&S?x+V.substr(x.length):"",U=G&&K;return c&&"string"==typeof(e=v({className:R}))&&(e=(0,$.createElement)("div",{className:n+"__dropdown-arrow-down-wrapper",dangerouslySetInnerHTML:{__html:e}})),(0,$.createElement)("div",{className:A,onKeyDown:this.handleKeyDown,role:"combobox","aria-expanded":O?"true":"false"},(0,$.createElement)(W["default"],{length:w.length,queryLength:x.length,minQueryLength:i,selectedOption:this.templateInputValue(w[_]),selectedOptionIndex:_,tQueryTooShort:f,tNoResults:d,tSelectedOption:h,tResults:m}),U&&(0,$.createElement)("span",null,(0,$.createElement)("input",{className:B,readonly:!0,tabIndex:"-1",value:K})),(0,$.createElement)("input",z({"aria-activedescendant":!!q&&u+"__option--"+g,"aria-owns":u+"__listbox",autoComplete:"off",className:""+P+k+F,id:u,onClick:function(e){return o.handleInputClick(e)},onBlur:this.handleInputBlur},function Q(e){return{onInput:e}}(this.handleInputChange),{onFocus:this.handleInputFocus,name:a,placeholder:s,ref:function(e){o.elementReferences[-1]=e},type:"text",role:"textbox",required:l,value:x})),e,(0,$.createElement)("ul",{className:T+" "+N+" "+D,onMouseLeave:function(e){return o.handleListMouseLeave(e)},id:u+"__listbox",role:"listbox"},w.map(function(e,t){var n=(-1===g?_===t:g===t)&&null===b?" "+L+"--focused":"",r=t%2?" "+L+"--odd":"";return(0,$.createElement)("li",{"aria-selected":g===t,className:""+L+n+r,dangerouslySetInnerHTML:{__html:o.templateSuggestion(e)},id:u+"__option--"+t,key:t,onBlur:function(e){return o.handleOptionBlur(e,t)},onClick:function(e){return o.handleOptionClick(e,t)},onMouseEnter:function(e){return o.handleOptionMouseEnter(e,t)},ref:function(e){o.elementReferences[t]=e},role:"option",tabIndex:"-1"})}),M&&(0,$.createElement)("li",{className:L+" "+L+"--no-results"},p())))},e}($.Component);(t["default"]=s).defaultProps={autoselect:!1,cssNamespace:"autocomplete",defaultValue:"",displayMenu:"inline",minLength:0,name:"input-autocomplete",placeholder:"",onConfirm:function(){},confirmOnBlur:!0,showNoOptionsFound:!0,showAllValues:!1,required:!1,tNoResults:function(){return"No results found"},dropdownArrow:r["default"]}},function(e,t,n){var r=n(1);r(r.S+r.F,"Object",{assign:n(36)})},function(e,t,n){e.exports=!n(3)&&!n(4)(function(){return 7!=Object.defineProperty(n(13)("div"),"a",{get:function(){return 7}}).a})},function(e,t,n){var o=n(2);e.exports=function(e,t){if(!o(e))return e;var n,r;if(t&&"function"==typeof(n=e.toString)&&!o(r=n.call(e)))return r;if("function"==typeof(n=e.valueOf)&&!o(r=n.call(e)))return r;if(!t&&"function"==typeof(n=e.toString)&&!o(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){"use strict";var f=n(18),d=n(40),h=n(41),m=n(27),v=n(10),o=Object.assign;e.exports=!o||n(4)(function(){var e={},t={},n=Symbol(),r="abcdefghijklmnopqrst";return e[n]=7,r.split("").forEach(function(e){t[e]=e}),7!=o({},e)[n]||Object.keys(o({},t)).join("")!=r})?function(e,t){for(var n=m(e),r=arguments.length,o=1,u=d.f,i=h.f;o<r;)for(var a,s=v(arguments[o++]),l=u?f(s).concat(u(s)):f(s),c=l.length,p=0;p<c;)i.call(s,a=l[p++])&&(n[a]=s[a]);return n}:o},function(e,t,n){var i=n(15),a=n(19),s=n(21)(!1),l=n(24)("IE_PROTO");e.exports=function(e,t){var n,r=a(e),o=0,u=[];for(n in r)n!=l&&i(r,n)&&u.push(n);for(;t.length>o;)i(r,n=t[o++])&&(~s(u,n)||u.push(n));return u}},function(e,t,n){var r=n(23),o=Math.max,u=Math.min;e.exports=function(e,t){return(e=r(e))<0?o(e+t,0):u(e,t)}},function(e,t){e.exports=!1},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,r){var o=r(8),u=r(43),i=r(26),a=r(24)("IE_PROTO"),s=function(){},l="prototype",c=function(){var e,t=r(13)("iframe"),n=i.length;for(t.style.display="none",r(44).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("<script>document.F=Object<\/script>"),e.close(),c=e.F;n--;)delete c[l][i[n]];return c()};e.exports=Object.create||function(e,t){var n;return null!==e?(s[l]=o(e),n=new s,s[l]=null,n[a]=e):n=c(),t===undefined?n:u(n,t)}},function(e,t,n){var i=n(7),a=n(8),s=n(18);e.exports=n(3)?Object.defineProperties:function(e,t){a(e);for(var n,r=s(t),o=r.length,u=0;u<o;)i.f(e,n=r[u++],t[n]);return e}},function(e,t,n){var r=n(0).document;e.exports=r&&r.documentElement},function(e,t,n){"use strict";var r=n(1),o=n(46)(1);r(r.P+r.F*!n(30)([].map,!0),"Array",{map:function(e){return o(this,e,arguments[1])}})},function(e,t,n){var b=n(16),O=n(10),w=n(27),x=n(22),r=n(47);e.exports=function(p,e){var f=1==p,d=2==p,h=3==p,m=4==p,v=6==p,y=5==p||v,g=e||r;return function(e,t,n){for(var r,o,u=w(e),i=O(u),a=b(t,n,3),s=x(i.length),l=0,c=f?g(e,s):d?g(e,0):undefined;l<s;l++)if((y||l in i)&&(o=a(r=i[l],l,u),p))if(f)c[l]=o;else if(o)switch(p){case 3:return!0;case 5:return r;case 6:return l;case 2:c.push(r)}else if(m)return!1;return v?-1:h||m?m:c}}},function(e,t,n){var r=n(48);e.exports=function(e,t){return new(r(e))(t)}},function(e,t,n){var r=n(2),o=n(49),u=n(29)("species");e.exports=function(e){var t;return o(e)&&("function"!=typeof(t=e.constructor)||t!==Array&&!o(t.prototype)||(t=undefined),r(t)&&null===(t=t[u])&&(t=undefined)),t===undefined?Array:t}},function(e,t,n){var r=n(20);e.exports=Array.isArray||function(e){return"Array"==r(e)}},function(e,t,n){"use strict";var r=n(1),o=n(21)(!1),u=[].indexOf,i=!!u&&1/[1].indexOf(1,-0)<0;r(r.P+r.F*(i||!n(30)(u)),"Array",{indexOf:function(e){return i?u.apply(this,arguments)||0:o(this,e,arguments[1])}})},function(e,t,n){var r=n(7).f,o=Function.prototype,u=/^\s*function ([^ (]*)/;"name"in o||n(3)&&r(o,"name",{configurable:!0,get:function(){try{return(""+this).match(u)[1]}catch(e){return""}}})},function(e,t,n){var r=n(1);r(r.P,"Function",{bind:n(53)})},function(e,t,n){"use strict";var u=n(17),i=n(2),a=n(54),s=[].slice,l={};e.exports=Function.bind||function(t){var n=u(this),r=s.call(arguments,1),o=function(){var e=r.concat(s.call(arguments));return this instanceof o?function(e,t,n){if(!(t in l)){for(var r=[],o=0;o<t;o++)r[o]="a["+o+"]";l[t]=Function("F,a","return new F("+r.join(",")+")")}return l[t](e,n)}(n,e.length,e):a(n,e,t)};return i(n.prototype)&&(o.prototype=n.prototype),o}},function(e,t){e.exports=function(e,t,n){var r=n===undefined;switch(t.length){case 0:return r?e():e.call(n);case 1:return r?e(t[0]):e.call(n,t[0]);case 2:return r?e(t[0],t[1]):e.call(n,t[0],t[1]);case 3:return r?e(t[0],t[1],t[2]):e.call(n,t[0],t[1],t[2]);case 4:return r?e(t[0],t[1],t[2],t[3]):e.call(n,t[0],t[1],t[2],t[3])}return e.apply(n,t)}},function(e,t,n){n(56)("match",1,function(r,o,e){return[function(e){"use strict";var t=r(this),n=e==undefined?undefined:e[o];return n!==undefined?n.call(e,t):new RegExp(e)[o](String(t))},e]})},function(e,t,n){"use strict";var a=n(6),s=n(14),l=n(4),c=n(11),p=n(29);e.exports=function(t,e,n){var r=p(t),o=n(c,r,""[t]),u=o[0],i=o[1];l(function(){var e={};return e[r]=function(){return 7},7!=""[t](e)})&&(s(String.prototype,t,u),a(RegExp.prototype,r,2==e?function(e,t){return i.call(e,this,t)}:function(e){return i.call(e,this)}))}},function(e,t,n){"use strict";t.__esModule=!0,t["default"]=void 0,n(28);var m=n(12);var r=function(o){function e(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return(e=o.call.apply(o,[this].concat(n))||this).state={bump:!1},e}(function n(e,t){e.prototype=Object.create(t.prototype),(e.prototype.constructor=e).__proto__=t})(e,o);var t=e.prototype;return t.componentWillReceiveProps=function(e){e.queryLength!==this.props.queryLength&&this.setState(function(e){return{bump:!e.bump}})},t.render=function(){var e=this.props,t=e.length,n=e.queryLength,r=e.minQueryLength,o=e.selectedOption,u=e.selectedOptionIndex,i=e.tQueryTooShort,a=e.tNoResults,s=e.tSelectedOption,l=e.tResults,c=this.state.bump,p=n<r,f=0===t,d=o?s(o,t,u):"",h=null;return h=p?i(r):f?a():l(t,d),(0,m.createElement)("div",{"aria-atomic":"true","aria-live":"polite",role:"status",style:{border:"0",clip:"rect(0 0 0 0)",height:"1px",marginBottom:"-1px",marginRight:"-1px",overflow:"hidden",padding:"0",position:"absolute",whiteSpace:"nowrap",width:"1px"}},h,(0,m.createElement)("span",null,c?",":",,"))},e}(m.Component);(t["default"]=r).defaultProps={tQueryTooShort:function(e){return"Type in "+e+" or more characters for results."},tNoResults:function(){return"No search results."},tSelectedOption:function(e,t,n){return e+" ("+(n+1)+" of "+t+") is selected."},tResults:function(e,t){return e+" "+(1===e?"result":"results")+" "+(1===e?"is":"are")+" available. "+t}}},function(e,t,n){"use strict";t.__esModule=!0,t["default"]=void 0;var r=n(12),o=function u(e){var t=e.className;return(0,r.createElement)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",className:t,focusable:"false"},(0,r.createElement)("g",{stroke:"none",fill:"none","fill-rule":"evenodd"},(0,r.createElement)("polygon",{fill:"#000000",points:"0 0 22 0 11 17"})))};t["default"]=o}])}); | ||
(function webpackUniversalModuleDefinition(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("preact")):"function"==typeof define&&define.amd?define(["preact"],t):"object"==typeof exports?exports["Autocomplete"]=t(require("preact")):e["Autocomplete"]=t(e["preact"])})(window,function(n){return function(n){var r={};function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}return o.m=n,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="/",o(o.s=31)}([function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){var v=n(0),m=n(5),y=n(6),g=n(14),b=n(16),O="prototype",w=function(e,t,n){var r,o,i,u,a=e&w.F,s=e&w.G,l=e&w.S,c=e&w.P,p=e&w.B,f=s?v:l?v[t]||(v[t]={}):(v[t]||{})[O],d=s?m:m[t]||(m[t]={}),h=d[O]||(d[O]={});for(r in s&&(n=t),n)i=((o=!a&&f&&f[r]!==undefined)?f:n)[r],u=p&&o?b(i,v):c&&"function"==typeof i?b(Function.call,i):i,f&&g(f,r,i,e&w.U),d[r]!=i&&y(d,r,u),c&&h[r]!=i&&(h[r]=i)};v.core=m,w.F=1,w.G=2,w.S=4,w.P=8,w.B=16,w.W=32,w.U=64,w.R=128,e.exports=w},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){e.exports=!n(4)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t){e.exports=function(e){try{return!!e()}catch(t){return!0}}},function(e,t){var n=e.exports={version:"2.5.7"};"number"==typeof __e&&(__e=n)},function(e,t,n){var r=n(7),o=n(35);e.exports=n(3)?function(e,t,n){return r.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){var o=n(8),i=n(33),u=n(34),a=Object.defineProperty;t.f=n(3)?Object.defineProperty:function(e,t,n){if(o(e),t=u(t,!0),o(n),i)try{return a(e,t,n)}catch(r){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){var r=n(2);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(e===undefined?"":e,")_",(++n+r).toString(36))}},function(e,t,n){var r=n(20);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t){e.exports=function(e){if(e==undefined)throw TypeError("Can't call method on "+e);return e}},function(e,t){e.exports=n},function(e,t,n){var r=n(2),o=n(0).document,i=r(o)&&r(o.createElement);e.exports=function(e){return i?o.createElement(e):{}}},function(e,t,n){var i=n(0),u=n(6),a=n(15),s=n(9)("src"),r="toString",o=Function[r],l=(""+o).split(r);n(5).inspectSource=function(e){return o.call(e)},(e.exports=function(e,t,n,r){var o="function"==typeof n;o&&(a(n,"name")||u(n,"name",t)),e[t]!==n&&(o&&(a(n,s)||u(n,s,e[t]?""+e[t]:l.join(String(t)))),e===i?e[t]=n:r?e[t]?e[t]=n:u(e,t,n):(delete e[t],u(e,t,n)))})(Function.prototype,r,function(){return"function"==typeof this&&this[s]||o.call(this)})},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var i=n(17);e.exports=function(r,o,e){if(i(r),o===undefined)return r;switch(e){case 1:return function(e){return r.call(o,e)};case 2:return function(e,t){return r.call(o,e,t)};case 3:return function(e,t,n){return r.call(o,e,t,n)}}return function(){return r.apply(o,arguments)}}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,n){var r=n(37),o=n(26);e.exports=Object.keys||function(e){return r(e,o)}},function(e,t,n){var r=n(10),o=n(11);e.exports=function(e){return r(o(e))}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var s=n(19),l=n(22),c=n(38);e.exports=function(a){return function(e,t,n){var r,o=s(e),i=l(o.length),u=c(n,i);if(a&&t!=t){for(;u<i;)if((r=o[u++])!=r)return!0}else for(;u<i;u++)if((a||u in o)&&o[u]===t)return a||u||0;return!a&&-1}}},function(e,t,n){var r=n(23),o=Math.min;e.exports=function(e){return 0<e?o(r(e),9007199254740991):0}},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(0<e?r:n)(e)}},function(e,t,n){var r=n(25)("keys"),o=n(9);e.exports=function(e){return r[e]||(r[e]=o(e))}},function(e,t,n){var r=n(5),o=n(0),i="__core-js_shared__",u=o[i]||(o[i]={});(e.exports=function(e,t){return u[e]||(u[e]=t!==undefined?t:{})})("versions",[]).push({version:r.version,mode:n(39)?"pure":"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){var r=n(11);e.exports=function(e){return Object(r(e))}},function(e,t,n){var r=n(1);r(r.S,"Object",{create:n(42)})},function(e,t,n){var r=n(25)("wks"),o=n(9),i=n(0).Symbol,u="function"==typeof i;(e.exports=function(e){return r[e]||(r[e]=u&&i[e]||(u?i:o)("Symbol."+e))}).store=r},function(e,t,n){"use strict";var r=n(4);e.exports=function(e,t){return!!e&&r(function(){t?e.call(null,function(){},1):e.call(null)})}},function(e,t,n){"use strict";t.__esModule=!0,t["default"]=void 0,n(32),n(28),n(45),n(46),n(51),n(52),n(55);var G=n(12),J=o(n(57)),r=o(n(58));function o(e){return e&&e.__esModule?e:{"default":e}}function X(){return(X=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function i(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var u,a={13:"enter",27:"escape",32:"space",38:"up",40:"down"},Y=((u=document.createElement("x")).style.cssText="pointer-events:auto","auto"===u.style.pointerEvents);function Z(){return!(!navigator.userAgent.match(/(iPod|iPhone|iPad)/g)||!navigator.userAgent.match(/AppleWebKit/g))}var s=function(n){function e(e){var t;return(t=n.call(this,e)||this).elementReferences={},t.state={focused:null,hovered:null,clicked:null,menuOpen:!1,options:e.defaultValue?[e.defaultValue]:[],query:e.defaultValue,validChoiceMade:!1,selected:null,ariaHint:!0},t.handleComponentBlur=t.handleComponentBlur.bind(i(i(t))),t.handleKeyDown=t.handleKeyDown.bind(i(i(t))),t.handleUpArrow=t.handleUpArrow.bind(i(i(t))),t.handleDownArrow=t.handleDownArrow.bind(i(i(t))),t.handleEnter=t.handleEnter.bind(i(i(t))),t.handlePrintableKey=t.handlePrintableKey.bind(i(i(t))),t.handleListMouseLeave=t.handleListMouseLeave.bind(i(i(t))),t.handleOptionBlur=t.handleOptionBlur.bind(i(i(t))),t.handleOptionClick=t.handleOptionClick.bind(i(i(t))),t.handleOptionFocus=t.handleOptionFocus.bind(i(i(t))),t.handleOptionMouseEnter=t.handleOptionMouseEnter.bind(i(i(t))),t.handleInputBlur=t.handleInputBlur.bind(i(i(t))),t.handleInputChange=t.handleInputChange.bind(i(i(t))),t.handleInputFocus=t.handleInputFocus.bind(i(i(t))),t.pollInputElement=t.pollInputElement.bind(i(i(t))),t.getDirectInputChanges=t.getDirectInputChanges.bind(i(i(t))),t}(function r(e,t){e.prototype=Object.create(t.prototype),(e.prototype.constructor=e).__proto__=t})(e,n);var t=e.prototype;return t.isQueryAnOption=function(e,t){var n=this;return-1!==t.map(function(e){return n.templateInputValue(e).toLowerCase()}).indexOf(e.toLowerCase())},t.componentDidMount=function(){this.pollInputElement()},t.componentWillUnmount=function(){clearTimeout(this.$pollInput),clearTimeout(this.$blurInput)},t.pollInputElement=function(){var e=this;this.getDirectInputChanges(),this.$pollInput=setTimeout(function(){e.pollInputElement()},100)},t.getDirectInputChanges=function(){var e=this.elementReferences[-1];e&&e.value!==this.state.query&&this.handleInputChange({target:{value:e.value}})},t.componentDidUpdate=function(e,t){var n=this.state,r=n.focused,o=n.clicked,i=null===r,u=t.focused!==r;(u&&!i||null!==o)&&this.elementReferences[r].focus();var a=-1===r,s=u&&null===t.focused;if(a&&s){var l=this.elementReferences[r];l.setSelectionRange(0,l.value.length)}},t.hasAutoselect=function(){return!Z()&&this.props.autoselect},t.templateInputValue=function(e){var t=this.props.templates&&this.props.templates.inputValue;return t?t(e):e},t.templateSuggestion=function(e){var t=this.props.templates&&this.props.templates.suggestion;return t?t(e):e},t.handleComponentBlur=function(e){var t,n=this.state,r=n.options,o=n.query,i=n.selected;this.props.confirmOnBlur?(t=e.query||o,this.props.onConfirm(r[i])):t=o,this.setState({focused:null,clicked:null,menuOpen:e.menuOpen||!1,query:t,selected:null,validChoiceMade:this.isQueryAnOption(t,r)})},t.handleListMouseLeave=function(e){this.setState({hovered:null})},t.handleOptionBlur=function(e,t){var n=this.state,r=n.focused,o=n.clicked,i=n.menuOpen,u=n.options,a=n.selected,s=null===e.relatedTarget&&null===o,l=e.relatedTarget===this.elementReferences[-1],c=r!==t&&-1!==r;if(!c&&s||!(c||l)){var p=i&&Z();this.handleComponentBlur({menuOpen:p,query:this.templateInputValue(u[a])})}},t.handleInputBlur=function(e){var t=this,n=this.state,r=n.focused,o=n.menuOpen,i=n.options,u=n.query,a=n.selected,s=-1!==r;if(clearTimeout(this.$blurInput),!s){var l=o&&Z(),c=Z()?u:this.templateInputValue(i[a]);this.$blurInput=setTimeout(function(){return t.handleComponentBlur({menuOpen:l,query:c})},200)}},t.handleInputChange=function(e){var n=this,t=this.props,r=t.minLength,o=t.source,i=t.showAllValues,u=this.hasAutoselect(),a=e.target.value,s=0===a.length,l=this.state.query.length!==a.length,c=a.length>=r;this.setState({query:a,ariaHint:s}),i||!s&&l&&c?o(a,function(e){var t=0<e.length;n.setState({menuOpen:t,options:e,selected:u&&t?0:-1,validChoiceMade:!1})}):!s&&c||this.setState({menuOpen:!1,options:[]})},t.handleInputClick=function(e){this.handleInputChange(e)},t.handleInputFocus=function(e){var t=this.state,n=t.query,r=t.validChoiceMade,o=t.options,i=this.props.minLength,u=!r&&n.length>=i&&0<o.length;u?this.setState(function(e){var t=e.menuOpen;return{focused:-1,menuOpen:u||t,selected:-1}}):this.setState({focused:-1})},t.handleOptionFocus=function(e){this.setState({focused:e,hovered:null,selected:e})},t.handleOptionMouseEnter=function(e,t){Z()||this.setState({hovered:t})},t.handleOptionClick=function(e,t){var n=this.state.options[t],r=this.templateInputValue(n);clearTimeout(this.$blurInput),this.props.onConfirm(n),this.setState({focused:-1,clicked:t,hovered:null,menuOpen:!1,query:r,selected:-1,validChoiceMade:!0}),this.forceUpdate()},t.handleUpArrow=function(e){e.preventDefault();var t=this.state,n=t.menuOpen,r=t.selected;-1!==r&&n&&this.handleOptionFocus(r-1)},t.handleDownArrow=function(e){var t=this;if(e.preventDefault(),this.props.showAllValues&&!1===this.state.menuOpen)e.preventDefault(),this.props.source("",function(e){t.setState({menuOpen:!0,options:e,selected:0,focused:0,hovered:null})});else if(!0===this.state.menuOpen){var n=this.state,r=n.menuOpen,o=n.options,i=n.selected;i!==o.length-1&&r&&this.handleOptionFocus(i+1)}},t.handleSpace=function(e){var t=this;this.props.showAllValues&&!1===this.state.menuOpen&&""===this.state.query&&(e.preventDefault(),this.props.source("",function(e){t.setState({menuOpen:!0,options:e})})),-1!==this.state.focused&&(e.preventDefault(),this.handleOptionClick(e,this.state.focused))},t.handleEnter=function(e){this.state.menuOpen&&(e.preventDefault(),0<=this.state.selected&&this.handleOptionClick(e,this.state.selected))},t.handlePrintableKey=function(e){var t=this.elementReferences[-1];e.target===t||t.focus()},t.handleKeyDown=function(e){switch(a[e.keyCode]){case"up":this.handleUpArrow(e);break;case"down":this.handleDownArrow(e);break;case"space":this.handleSpace(e);break;case"enter":this.handleEnter(e);break;case"escape":this.handleComponentBlur({query:this.state.query});break;default:(function t(e){return 47<e&&e<58||32===e||8===e||64<e&&e<91||95<e&&e<112||185<e&&e<193||218<e&&e<223})(e.keyCode)&&this.handlePrintableKey(e)}},t.render=function(){var e,i=this,t=this.props,n=t.cssNamespace,r=t.displayMenu,u=t.id,o=t.minLength,a=t.name,s=t.placeholder,l=t.required,c=t.showAllValues,p=t.tNoResults,f=t.tStatusQueryTooShort,d=t.tStatusNoResults,h=t.tStatusSelectedOption,v=t.tStatusResults,m=t.tAssistiveHint,y=t.dropdownArrow,g=this.state,b=g.focused,O=g.hovered,w=g.menuOpen,x=g.options,_=g.query,S=g.selected,I=g.ariaHint,C=g.validChoiceMade,E=this.hasAutoselect(),M=-1===b,j=0===x.length,A=0!==_.length,P=_.length>=o,k=this.props.showNoOptionsFound&&M&&j&&A&&P,F=n+"__wrapper",R=n+"__input",T=null!==b?" "+R+"--focused":"",L=this.props.showAllValues?" "+R+"--show-all-values":" "+R+"--default",q=n+"__dropdown-arrow-down",N=-1!==b&&null!==b,B=n+"__menu",D=B+"--"+r,V=B+"--"+(w||k?"visible":"hidden"),U=n+"__option",K=n+"__hint",H=this.templateInputValue(x[S]),Q=H&&0===H.toLowerCase().indexOf(_.toLowerCase())&&E?_+H.substr(_.length):"",W=Y&&Q,$=I?{"aria-describedby":"assistiveHint"}:null;return c&&"string"==typeof(e=y({className:q}))&&(e=(0,G.createElement)("div",{className:n+"__dropdown-arrow-down-wrapper",dangerouslySetInnerHTML:{__html:e}})),(0,G.createElement)("div",{className:F,onKeyDown:this.handleKeyDown},(0,G.createElement)(J["default"],{length:x.length,queryLength:_.length,minQueryLength:o,selectedOption:this.templateInputValue(x[S]),selectedOptionIndex:S,validChoiceMade:C,isInFocus:null!==this.state.focused,tQueryTooShort:f,tNoResults:d,tSelectedOption:h,tResults:v}),W&&(0,G.createElement)("span",null,(0,G.createElement)("input",{className:K,readonly:!0,tabIndex:"-1",value:Q})),(0,G.createElement)("input",X({"aria-expanded":w?"true":"false","aria-activedescendant":!!N&&u+"__option--"+b,"aria-owns":u+"__listbox","aria-autocomplete":this.hasAutoselect()?"both":"list"},$,{autoComplete:"off",className:""+R+T+L,id:u,onClick:function(e){return i.handleInputClick(e)},onBlur:this.handleInputBlur},function z(e){return{onInput:e}}(this.handleInputChange),{onFocus:this.handleInputFocus,name:a,placeholder:s,ref:function(e){i.elementReferences[-1]=e},type:"text",role:"combobox",required:l,value:_})),e,(0,G.createElement)("ul",{className:B+" "+D+" "+V,onMouseLeave:function(e){return i.handleListMouseLeave(e)},id:u+"__listbox",role:"listbox"},x.map(function(e,t){var n=(-1===b?S===t:b===t)&&null===O?" "+U+"--focused":"",r=t%2?" "+U+"--odd":"",o=Z()?"<span id="+u+"__option-suffix--"+t+' style="border:0;clip:rect(0 0 0 0);height:1px;marginBottom:-1px;marginRight:-1px;overflow:hidden;padding:0;position:absolute;whiteSpace:nowrap;width:1px"> '+(t+1)+" of "+x.length+"</span>":"";return(0,G.createElement)("li",{"aria-selected":b===t,className:""+U+n+r,dangerouslySetInnerHTML:{__html:i.templateSuggestion(e)+o},id:u+"__option--"+t,key:t,onBlur:function(e){return i.handleOptionBlur(e,t)},onClick:function(e){return i.handleOptionClick(e,t)},onMouseEnter:function(e){return i.handleOptionMouseEnter(e,t)},ref:function(e){i.elementReferences[t]=e},role:"option",tabIndex:"-1","aria-posinset":t+1,"aria-setsize":x.length})}),k&&(0,G.createElement)("li",{className:U+" "+U+"--no-results"},p())),(0,G.createElement)("span",{id:"assistiveHint",style:{display:"none"}},m()))},e}(G.Component);(t["default"]=s).defaultProps={autoselect:!1,cssNamespace:"autocomplete",defaultValue:"",displayMenu:"inline",minLength:0,name:"input-autocomplete",placeholder:"",onConfirm:function(){},confirmOnBlur:!0,showNoOptionsFound:!0,showAllValues:!1,required:!1,tNoResults:function(){return"No results found"},tAssistiveHint:function(){return"When autocomplete results are available use up and down arrows to review and enter to select. Touch device users, explore by touch or with swipe gestures."},dropdownArrow:r["default"]}},function(e,t,n){var r=n(1);r(r.S+r.F,"Object",{assign:n(36)})},function(e,t,n){e.exports=!n(3)&&!n(4)(function(){return 7!=Object.defineProperty(n(13)("div"),"a",{get:function(){return 7}}).a})},function(e,t,n){var o=n(2);e.exports=function(e,t){if(!o(e))return e;var n,r;if(t&&"function"==typeof(n=e.toString)&&!o(r=n.call(e)))return r;if("function"==typeof(n=e.valueOf)&&!o(r=n.call(e)))return r;if(!t&&"function"==typeof(n=e.toString)&&!o(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){"use strict";var f=n(18),d=n(40),h=n(41),v=n(27),m=n(10),o=Object.assign;e.exports=!o||n(4)(function(){var e={},t={},n=Symbol(),r="abcdefghijklmnopqrst";return e[n]=7,r.split("").forEach(function(e){t[e]=e}),7!=o({},e)[n]||Object.keys(o({},t)).join("")!=r})?function(e,t){for(var n=v(e),r=arguments.length,o=1,i=d.f,u=h.f;o<r;)for(var a,s=m(arguments[o++]),l=i?f(s).concat(i(s)):f(s),c=l.length,p=0;p<c;)u.call(s,a=l[p++])&&(n[a]=s[a]);return n}:o},function(e,t,n){var u=n(15),a=n(19),s=n(21)(!1),l=n(24)("IE_PROTO");e.exports=function(e,t){var n,r=a(e),o=0,i=[];for(n in r)n!=l&&u(r,n)&&i.push(n);for(;t.length>o;)u(r,n=t[o++])&&(~s(i,n)||i.push(n));return i}},function(e,t,n){var r=n(23),o=Math.max,i=Math.min;e.exports=function(e,t){return(e=r(e))<0?o(e+t,0):i(e,t)}},function(e,t){e.exports=!1},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,r){var o=r(8),i=r(43),u=r(26),a=r(24)("IE_PROTO"),s=function(){},l="prototype",c=function(){var e,t=r(13)("iframe"),n=u.length;for(t.style.display="none",r(44).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("<script>document.F=Object<\/script>"),e.close(),c=e.F;n--;)delete c[l][u[n]];return c()};e.exports=Object.create||function(e,t){var n;return null!==e?(s[l]=o(e),n=new s,s[l]=null,n[a]=e):n=c(),t===undefined?n:i(n,t)}},function(e,t,n){var u=n(7),a=n(8),s=n(18);e.exports=n(3)?Object.defineProperties:function(e,t){a(e);for(var n,r=s(t),o=r.length,i=0;i<o;)u.f(e,n=r[i++],t[n]);return e}},function(e,t,n){var r=n(0).document;e.exports=r&&r.documentElement},function(e,t,n){var r=n(7).f,o=Function.prototype,i=/^\s*function ([^ (]*)/;"name"in o||n(3)&&r(o,"name",{configurable:!0,get:function(){try{return(""+this).match(i)[1]}catch(e){return""}}})},function(e,t,n){"use strict";var r=n(1),o=n(47)(1);r(r.P+r.F*!n(30)([].map,!0),"Array",{map:function(e){return o(this,e,arguments[1])}})},function(e,t,n){var b=n(16),O=n(10),w=n(27),x=n(22),r=n(48);e.exports=function(p,e){var f=1==p,d=2==p,h=3==p,v=4==p,m=6==p,y=5==p||m,g=e||r;return function(e,t,n){for(var r,o,i=w(e),u=O(i),a=b(t,n,3),s=x(u.length),l=0,c=f?g(e,s):d?g(e,0):undefined;l<s;l++)if((y||l in u)&&(o=a(r=u[l],l,i),p))if(f)c[l]=o;else if(o)switch(p){case 3:return!0;case 5:return r;case 6:return l;case 2:c.push(r)}else if(v)return!1;return m?-1:h||v?v:c}}},function(e,t,n){var r=n(49);e.exports=function(e,t){return new(r(e))(t)}},function(e,t,n){var r=n(2),o=n(50),i=n(29)("species");e.exports=function(e){var t;return o(e)&&("function"!=typeof(t=e.constructor)||t!==Array&&!o(t.prototype)||(t=undefined),r(t)&&null===(t=t[i])&&(t=undefined)),t===undefined?Array:t}},function(e,t,n){var r=n(20);e.exports=Array.isArray||function(e){return"Array"==r(e)}},function(e,t,n){"use strict";var r=n(1),o=n(21)(!1),i=[].indexOf,u=!!i&&1/[1].indexOf(1,-0)<0;r(r.P+r.F*(u||!n(30)(i)),"Array",{indexOf:function(e){return u?i.apply(this,arguments)||0:o(this,e,arguments[1])}})},function(e,t,n){var r=n(1);r(r.P,"Function",{bind:n(53)})},function(e,t,n){"use strict";var i=n(17),u=n(2),a=n(54),s=[].slice,l={};e.exports=Function.bind||function(t){var n=i(this),r=s.call(arguments,1),o=function(){var e=r.concat(s.call(arguments));return this instanceof o?function(e,t,n){if(!(t in l)){for(var r=[],o=0;o<t;o++)r[o]="a["+o+"]";l[t]=Function("F,a","return new F("+r.join(",")+")")}return l[t](e,n)}(n,e.length,e):a(n,e,t)};return u(n.prototype)&&(o.prototype=n.prototype),o}},function(e,t){e.exports=function(e,t,n){var r=n===undefined;switch(t.length){case 0:return r?e():e.call(n);case 1:return r?e(t[0]):e.call(n,t[0]);case 2:return r?e(t[0],t[1]):e.call(n,t[0],t[1]);case 3:return r?e(t[0],t[1],t[2]):e.call(n,t[0],t[1],t[2]);case 4:return r?e(t[0],t[1],t[2],t[3]):e.call(n,t[0],t[1],t[2],t[3])}return e.apply(n,t)}},function(e,t,n){n(56)("match",1,function(r,o,e){return[function(e){"use strict";var t=r(this),n=e==undefined?undefined:e[o];return n!==undefined?n.call(e,t):new RegExp(e)[o](String(t))},e]})},function(e,t,n){"use strict";var a=n(6),s=n(14),l=n(4),c=n(11),p=n(29);e.exports=function(t,e,n){var r=p(t),o=n(c,r,""[t]),i=o[0],u=o[1];l(function(){var e={};return e[r]=function(){return 7},7!=""[t](e)})&&(s(String.prototype,t,i),a(RegExp.prototype,r,2==e?function(e,t){return u.call(e,this,t)}:function(e){return u.call(e,this)}))}},function(e,t,n){"use strict";t.__esModule=!0,t["default"]=void 0,n(28);var g=n(12);var r=function r(o,i,u){var a;return function(){var e=this,t=arguments,n=function n(){a=null,u||o.apply(e,t)},r=u&&!a;clearTimeout(a),a=setTimeout(n,i),r&&o.apply(e,t)}},o=function(o){function e(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return(e=o.call.apply(o,[this].concat(n))||this).state={bump:!1,debounced:!1},e}(function n(e,t){e.prototype=Object.create(t.prototype),(e.prototype.constructor=e).__proto__=t})(e,o);var t=e.prototype;return t.componentWillMount=function(){var e=this;this.debounceStatusUpdate=r(function(){if(!e.state.debounced){var t=!e.props.isInFocus||e.props.validChoiceMade;e.setState(function(e){return{bump:!e.bump,debounced:!0,silenced:t}})}},1400)},t.componentWillReceiveProps=function(e){e.queryLength;this.setState({debounced:!1})},t.render=function(){var e=this.props,t=e.length,n=e.queryLength,r=e.minQueryLength,o=e.selectedOption,i=e.selectedOptionIndex,u=e.tQueryTooShort,a=e.tNoResults,s=e.tSelectedOption,l=e.tResults,c=this.state,p=c.bump,f=c.debounced,d=c.silenced,h=n<r,v=0===t,m=o?s(o,t,i):"",y=null;return y=h?u(r):v?a():l(t,m),this.debounceStatusUpdate(),(0,g.createElement)("div",{style:{border:"0",clip:"rect(0 0 0 0)",height:"1px",marginBottom:"-1px",marginRight:"-1px",overflow:"hidden",padding:"0",position:"absolute",whiteSpace:"nowrap",width:"1px"}},(0,g.createElement)("div",{id:"ariaLiveA",role:"status","aria-atomic":"true","aria-live":"polite"},!d&&f&&p?y:""),(0,g.createElement)("div",{id:"ariaLiveB",role:"status","aria-atomic":"true","aria-live":"polite"},d||!f||p?"":y))},e}(g.Component);(t["default"]=o).defaultProps={tQueryTooShort:function(e){return"Type in "+e+" or more characters for results"},tNoResults:function(){return"No search results"},tSelectedOption:function(e,t,n){return e+" "+(n+1)+" of "+t+" is highlighted"},tResults:function(e,t){return e+" "+(1===e?"result":"results")+" "+(1===e?"is":"are")+" available. "+t}}},function(e,t,n){"use strict";t.__esModule=!0,t["default"]=void 0;var r=n(12),o=function i(e){var t=e.className;return(0,r.createElement)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",className:t,focusable:"false"},(0,r.createElement)("g",{stroke:"none",fill:"none","fill-rule":"evenodd"},(0,r.createElement)("polygon",{fill:"#000000",points:"0 0 22 0 11 17"})))};t["default"]=o}])}); | ||
//# sourceMappingURL=accessible-autocomplete.preact.min.js.map |
@@ -1,2 +0,2 @@ | ||
(function webpackUniversalModuleDefinition(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports["Autocomplete"]=t(require("react")):e["Autocomplete"]=t(e["React"])})(window,function(n){return function(n){var r={};function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}return o.m=n,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="/",o(o.s=31)}([function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){var m=n(0),v=n(5),y=n(6),g=n(14),b=n(16),O="prototype",w=function(e,t,n){var r,o,u,i,a=e&w.F,s=e&w.G,l=e&w.S,c=e&w.P,p=e&w.B,f=s?m:l?m[t]||(m[t]={}):(m[t]||{})[O],d=s?v:v[t]||(v[t]={}),h=d[O]||(d[O]={});for(r in s&&(n=t),n)u=((o=!a&&f&&f[r]!==undefined)?f:n)[r],i=p&&o?b(u,m):c&&"function"==typeof u?b(Function.call,u):u,f&&g(f,r,u,e&w.U),d[r]!=u&&y(d,r,i),c&&h[r]!=u&&(h[r]=u)};m.core=v,w.F=1,w.G=2,w.S=4,w.P=8,w.B=16,w.W=32,w.U=64,w.R=128,e.exports=w},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){e.exports=!n(4)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t){e.exports=function(e){try{return!!e()}catch(t){return!0}}},function(e,t){var n=e.exports={version:"2.5.7"};"number"==typeof __e&&(__e=n)},function(e,t,n){var r=n(7),o=n(35);e.exports=n(3)?function(e,t,n){return r.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){var o=n(8),u=n(33),i=n(34),a=Object.defineProperty;t.f=n(3)?Object.defineProperty:function(e,t,n){if(o(e),t=i(t,!0),o(n),u)try{return a(e,t,n)}catch(r){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){var r=n(2);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(e===undefined?"":e,")_",(++n+r).toString(36))}},function(e,t,n){var r=n(20);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t){e.exports=function(e){if(e==undefined)throw TypeError("Can't call method on "+e);return e}},function(e,t){e.exports=n},function(e,t,n){var r=n(2),o=n(0).document,u=r(o)&&r(o.createElement);e.exports=function(e){return u?o.createElement(e):{}}},function(e,t,n){var u=n(0),i=n(6),a=n(15),s=n(9)("src"),r="toString",o=Function[r],l=(""+o).split(r);n(5).inspectSource=function(e){return o.call(e)},(e.exports=function(e,t,n,r){var o="function"==typeof n;o&&(a(n,"name")||i(n,"name",t)),e[t]!==n&&(o&&(a(n,s)||i(n,s,e[t]?""+e[t]:l.join(String(t)))),e===u?e[t]=n:r?e[t]?e[t]=n:i(e,t,n):(delete e[t],i(e,t,n)))})(Function.prototype,r,function(){return"function"==typeof this&&this[s]||o.call(this)})},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var u=n(17);e.exports=function(r,o,e){if(u(r),o===undefined)return r;switch(e){case 1:return function(e){return r.call(o,e)};case 2:return function(e,t){return r.call(o,e,t)};case 3:return function(e,t,n){return r.call(o,e,t,n)}}return function(){return r.apply(o,arguments)}}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,n){var r=n(37),o=n(26);e.exports=Object.keys||function(e){return r(e,o)}},function(e,t,n){var r=n(10),o=n(11);e.exports=function(e){return r(o(e))}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var s=n(19),l=n(22),c=n(38);e.exports=function(a){return function(e,t,n){var r,o=s(e),u=l(o.length),i=c(n,u);if(a&&t!=t){for(;i<u;)if((r=o[i++])!=r)return!0}else for(;i<u;i++)if((a||i in o)&&o[i]===t)return a||i||0;return!a&&-1}}},function(e,t,n){var r=n(23),o=Math.min;e.exports=function(e){return 0<e?o(r(e),9007199254740991):0}},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(0<e?r:n)(e)}},function(e,t,n){var r=n(25)("keys"),o=n(9);e.exports=function(e){return r[e]||(r[e]=o(e))}},function(e,t,n){var r=n(5),o=n(0),u="__core-js_shared__",i=o[u]||(o[u]={});(e.exports=function(e,t){return i[e]||(i[e]=t!==undefined?t:{})})("versions",[]).push({version:r.version,mode:n(39)?"pure":"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){var r=n(11);e.exports=function(e){return Object(r(e))}},function(e,t,n){var r=n(1);r(r.S,"Object",{create:n(42)})},function(e,t,n){var r=n(25)("wks"),o=n(9),u=n(0).Symbol,i="function"==typeof u;(e.exports=function(e){return r[e]||(r[e]=i&&u[e]||(i?u:o)("Symbol."+e))}).store=r},function(e,t,n){"use strict";var r=n(4);e.exports=function(e,t){return!!e&&r(function(){t?e.call(null,function(){},1):e.call(null)})}},function(e,t,n){"use strict";t.__esModule=!0,t["default"]=void 0,n(32),n(28),n(45),n(50),n(51),n(52),n(55);var $=n(12),W=o(n(57)),r=o(n(58));function o(e){return e&&e.__esModule?e:{"default":e}}function z(){return(z=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function u(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var i,a={13:"enter",27:"escape",32:"space",38:"up",40:"down"},G=((i=document.createElement("x")).style.cssText="pointer-events:auto","auto"===i.style.pointerEvents);function f(){return!(!navigator.userAgent.match(/(iPod|iPhone|iPad)/g)||!navigator.userAgent.match(/AppleWebKit/g))}var s=function(n){function e(e){var t;return(t=n.call(this,e)||this).elementReferences={},t.state={focused:null,hovered:null,clicked:null,menuOpen:!1,options:e.defaultValue?[e.defaultValue]:[],query:e.defaultValue,selected:null},t.handleComponentBlur=t.handleComponentBlur.bind(u(u(t))),t.handleKeyDown=t.handleKeyDown.bind(u(u(t))),t.handleUpArrow=t.handleUpArrow.bind(u(u(t))),t.handleDownArrow=t.handleDownArrow.bind(u(u(t))),t.handleEnter=t.handleEnter.bind(u(u(t))),t.handlePrintableKey=t.handlePrintableKey.bind(u(u(t))),t.handleListMouseLeave=t.handleListMouseLeave.bind(u(u(t))),t.handleOptionBlur=t.handleOptionBlur.bind(u(u(t))),t.handleOptionClick=t.handleOptionClick.bind(u(u(t))),t.handleOptionFocus=t.handleOptionFocus.bind(u(u(t))),t.handleOptionMouseEnter=t.handleOptionMouseEnter.bind(u(u(t))),t.handleInputBlur=t.handleInputBlur.bind(u(u(t))),t.handleInputChange=t.handleInputChange.bind(u(u(t))),t.handleInputFocus=t.handleInputFocus.bind(u(u(t))),t.pollInputElement=t.pollInputElement.bind(u(u(t))),t.getDirectInputChanges=t.getDirectInputChanges.bind(u(u(t))),t}(function r(e,t){e.prototype=Object.create(t.prototype),(e.prototype.constructor=e).__proto__=t})(e,n);var t=e.prototype;return t.componentDidMount=function(){this.pollInputElement()},t.componentWillUnmount=function(){clearTimeout(this.$pollInput),clearTimeout(this.$blurInput)},t.pollInputElement=function(){var e=this;this.getDirectInputChanges(),this.$pollInput=setTimeout(function(){e.pollInputElement()},100)},t.getDirectInputChanges=function(){var e=this.elementReferences[-1];e&&e.value!==this.state.query&&this.handleInputChange({target:{value:e.value}})},t.componentDidUpdate=function(e,t){var n=this.state,r=n.focused,o=n.clicked,u=null===r,i=t.focused!==r;(i&&!u||null!==o)&&this.elementReferences[r].focus();var a=-1===r,s=i&&null===t.focused;if(a&&s){var l=this.elementReferences[r];l.setSelectionRange(0,l.value.length)}},t.hasAutoselect=function(){return!f()&&this.props.autoselect},t.templateInputValue=function(e){var t=this.props.templates&&this.props.templates.inputValue;return t?t(e):e},t.templateSuggestion=function(e){var t=this.props.templates&&this.props.templates.suggestion;return t?t(e):e},t.handleComponentBlur=function(e){var t,n=this.state,r=n.options,o=n.query,u=n.selected;this.props.confirmOnBlur?(t=e.query||o,this.props.onConfirm(r[u])):t=o,this.setState({focused:null,clicked:null,menuOpen:e.menuOpen||!1,query:t,selected:null})},t.handleListMouseLeave=function(e){this.setState({hovered:null})},t.handleOptionBlur=function(e,t){var n=this.state,r=n.focused,o=n.clicked,u=n.menuOpen,i=n.options,a=n.selected,s=null===e.relatedTarget&&null===o,l=e.relatedTarget===this.elementReferences[-1],c=r!==t&&-1!==r;if(!c&&s||!(c||l)){var p=u&&f();this.handleComponentBlur({menuOpen:p,query:this.templateInputValue(i[a])})}},t.handleInputBlur=function(e){var t=this,n=this.state,r=n.focused,o=n.menuOpen,u=n.options,i=n.query,a=n.selected,s=-1!==r;if(clearTimeout(this.$blurInput),!s){var l=o&&f(),c=f()?i:this.templateInputValue(u[a]);this.$blurInput=setTimeout(function(){return t.handleComponentBlur({menuOpen:l,query:c})},200)}},t.handleInputChange=function(e){var n=this,t=this.props,r=t.minLength,o=t.source,u=t.showAllValues,i=this.hasAutoselect(),a=e.target.value,s=0===a.length,l=this.state.query.length!==a.length,c=a.length>=r;this.setState({query:a}),u||!s&&l&&c?o(a,function(e){var t=0<e.length;n.setState({menuOpen:t,options:e,selected:i&&t?0:-1})}):!s&&c||this.setState({menuOpen:!1,options:[]})},t.handleInputClick=function(e){this.handleInputChange(e)},t.handleInputFocus=function(e){this.setState({focused:-1})},t.handleOptionFocus=function(e){this.setState({focused:e,hovered:null,selected:e})},t.handleOptionMouseEnter=function(e,t){f()||this.setState({hovered:t})},t.handleOptionClick=function(e,t){var n=this.state.options[t],r=this.templateInputValue(n);clearTimeout(this.$blurInput),this.props.onConfirm(n),this.setState({focused:-1,clicked:t,hovered:null,menuOpen:!1,query:r,selected:-1}),this.forceUpdate()},t.handleUpArrow=function(e){e.preventDefault();var t=this.state,n=t.menuOpen,r=t.selected;-1!==r&&n&&this.handleOptionFocus(r-1)},t.handleDownArrow=function(e){var t=this;if(e.preventDefault(),this.props.showAllValues&&!1===this.state.menuOpen)e.preventDefault(),this.props.source("",function(e){t.setState({menuOpen:!0,options:e,selected:0,focused:0,hovered:null})});else if(!0===this.state.menuOpen){var n=this.state,r=n.menuOpen,o=n.options,u=n.selected;u!==o.length-1&&r&&this.handleOptionFocus(u+1)}},t.handleSpace=function(e){var t=this;this.props.showAllValues&&!1===this.state.menuOpen&&""===this.state.query&&(e.preventDefault(),this.props.source("",function(e){t.setState({menuOpen:!0,options:e})})),-1!==this.state.focused&&(e.preventDefault(),this.handleOptionClick(e,this.state.focused))},t.handleEnter=function(e){this.state.menuOpen&&(e.preventDefault(),0<=this.state.selected&&this.handleOptionClick(e,this.state.selected))},t.handlePrintableKey=function(e){var t=this.elementReferences[-1];e.target===t||t.focus()},t.handleKeyDown=function(e){switch(a[e.keyCode]){case"up":this.handleUpArrow(e);break;case"down":this.handleDownArrow(e);break;case"space":this.handleSpace(e);break;case"enter":this.handleEnter(e);break;case"escape":this.handleComponentBlur({query:this.state.query});break;default:(function t(e){return 47<e&&e<58||32===e||8===e||64<e&&e<91||95<e&&e<112||185<e&&e<193||218<e&&e<223})(e.keyCode)&&this.handlePrintableKey(e)}},t.render=function(){var e,o=this,t=this.props,n=t.cssNamespace,r=t.displayMenu,u=t.id,i=t.minLength,a=t.name,s=t.placeholder,l=t.required,c=t.showAllValues,p=t.tNoResults,f=t.tStatusQueryTooShort,d=t.tStatusNoResults,h=t.tStatusSelectedOption,m=t.tStatusResults,v=t.dropdownArrow,y=this.state,g=y.focused,b=y.hovered,O=y.menuOpen,w=y.options,x=y.query,_=y.selected,S=this.hasAutoselect(),I=-1===g,E=0===w.length,j=0!==x.length,C=x.length>=i,M=this.props.showNoOptionsFound&&I&&E&&j&&C,A=n+"__wrapper",P=n+"__input",k=null!==g?" "+P+"--focused":"",F=this.props.showAllValues?" "+P+"--show-all-values":" "+P+"--default",R=n+"__dropdown-arrow-down",q=-1!==g&&null!==g,T=n+"__menu",N=T+"--"+r,D=T+"--"+(O||M?"visible":"hidden"),L=n+"__option",B=n+"__hint",V=this.templateInputValue(w[_]),K=V&&0===V.toLowerCase().indexOf(x.toLowerCase())&&S?x+V.substr(x.length):"",U=G&&K;return c&&"string"==typeof(e=v({className:R}))&&(e=(0,$.createElement)("div",{className:n+"__dropdown-arrow-down-wrapper",dangerouslySetInnerHTML:{__html:e}})),(0,$.createElement)("div",{className:A,onKeyDown:this.handleKeyDown,role:"combobox","aria-expanded":O?"true":"false"},(0,$.createElement)(W["default"],{length:w.length,queryLength:x.length,minQueryLength:i,selectedOption:this.templateInputValue(w[_]),selectedOptionIndex:_,tQueryTooShort:f,tNoResults:d,tSelectedOption:h,tResults:m}),U&&(0,$.createElement)("span",null,(0,$.createElement)("input",{className:B,readonly:!0,tabIndex:"-1",value:K})),(0,$.createElement)("input",z({"aria-activedescendant":!!q&&u+"__option--"+g,"aria-owns":u+"__listbox",autoComplete:"off",className:""+P+k+F,id:u,onClick:function(e){return o.handleInputClick(e)},onBlur:this.handleInputBlur},function Q(e){return{onChange:e}}(this.handleInputChange),{onFocus:this.handleInputFocus,name:a,placeholder:s,ref:function(e){o.elementReferences[-1]=e},type:"text",role:"textbox",required:l,value:x})),e,(0,$.createElement)("ul",{className:T+" "+N+" "+D,onMouseLeave:function(e){return o.handleListMouseLeave(e)},id:u+"__listbox",role:"listbox"},w.map(function(e,t){var n=(-1===g?_===t:g===t)&&null===b?" "+L+"--focused":"",r=t%2?" "+L+"--odd":"";return(0,$.createElement)("li",{"aria-selected":g===t,className:""+L+n+r,dangerouslySetInnerHTML:{__html:o.templateSuggestion(e)},id:u+"__option--"+t,key:t,onBlur:function(e){return o.handleOptionBlur(e,t)},onClick:function(e){return o.handleOptionClick(e,t)},onMouseEnter:function(e){return o.handleOptionMouseEnter(e,t)},ref:function(e){o.elementReferences[t]=e},role:"option",tabIndex:"-1"})}),M&&(0,$.createElement)("li",{className:L+" "+L+"--no-results"},p())))},e}($.Component);(t["default"]=s).defaultProps={autoselect:!1,cssNamespace:"autocomplete",defaultValue:"",displayMenu:"inline",minLength:0,name:"input-autocomplete",placeholder:"",onConfirm:function(){},confirmOnBlur:!0,showNoOptionsFound:!0,showAllValues:!1,required:!1,tNoResults:function(){return"No results found"},dropdownArrow:r["default"]}},function(e,t,n){var r=n(1);r(r.S+r.F,"Object",{assign:n(36)})},function(e,t,n){e.exports=!n(3)&&!n(4)(function(){return 7!=Object.defineProperty(n(13)("div"),"a",{get:function(){return 7}}).a})},function(e,t,n){var o=n(2);e.exports=function(e,t){if(!o(e))return e;var n,r;if(t&&"function"==typeof(n=e.toString)&&!o(r=n.call(e)))return r;if("function"==typeof(n=e.valueOf)&&!o(r=n.call(e)))return r;if(!t&&"function"==typeof(n=e.toString)&&!o(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){"use strict";var f=n(18),d=n(40),h=n(41),m=n(27),v=n(10),o=Object.assign;e.exports=!o||n(4)(function(){var e={},t={},n=Symbol(),r="abcdefghijklmnopqrst";return e[n]=7,r.split("").forEach(function(e){t[e]=e}),7!=o({},e)[n]||Object.keys(o({},t)).join("")!=r})?function(e,t){for(var n=m(e),r=arguments.length,o=1,u=d.f,i=h.f;o<r;)for(var a,s=v(arguments[o++]),l=u?f(s).concat(u(s)):f(s),c=l.length,p=0;p<c;)i.call(s,a=l[p++])&&(n[a]=s[a]);return n}:o},function(e,t,n){var i=n(15),a=n(19),s=n(21)(!1),l=n(24)("IE_PROTO");e.exports=function(e,t){var n,r=a(e),o=0,u=[];for(n in r)n!=l&&i(r,n)&&u.push(n);for(;t.length>o;)i(r,n=t[o++])&&(~s(u,n)||u.push(n));return u}},function(e,t,n){var r=n(23),o=Math.max,u=Math.min;e.exports=function(e,t){return(e=r(e))<0?o(e+t,0):u(e,t)}},function(e,t){e.exports=!1},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,r){var o=r(8),u=r(43),i=r(26),a=r(24)("IE_PROTO"),s=function(){},l="prototype",c=function(){var e,t=r(13)("iframe"),n=i.length;for(t.style.display="none",r(44).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("<script>document.F=Object<\/script>"),e.close(),c=e.F;n--;)delete c[l][i[n]];return c()};e.exports=Object.create||function(e,t){var n;return null!==e?(s[l]=o(e),n=new s,s[l]=null,n[a]=e):n=c(),t===undefined?n:u(n,t)}},function(e,t,n){var i=n(7),a=n(8),s=n(18);e.exports=n(3)?Object.defineProperties:function(e,t){a(e);for(var n,r=s(t),o=r.length,u=0;u<o;)i.f(e,n=r[u++],t[n]);return e}},function(e,t,n){var r=n(0).document;e.exports=r&&r.documentElement},function(e,t,n){"use strict";var r=n(1),o=n(46)(1);r(r.P+r.F*!n(30)([].map,!0),"Array",{map:function(e){return o(this,e,arguments[1])}})},function(e,t,n){var b=n(16),O=n(10),w=n(27),x=n(22),r=n(47);e.exports=function(p,e){var f=1==p,d=2==p,h=3==p,m=4==p,v=6==p,y=5==p||v,g=e||r;return function(e,t,n){for(var r,o,u=w(e),i=O(u),a=b(t,n,3),s=x(i.length),l=0,c=f?g(e,s):d?g(e,0):undefined;l<s;l++)if((y||l in i)&&(o=a(r=i[l],l,u),p))if(f)c[l]=o;else if(o)switch(p){case 3:return!0;case 5:return r;case 6:return l;case 2:c.push(r)}else if(m)return!1;return v?-1:h||m?m:c}}},function(e,t,n){var r=n(48);e.exports=function(e,t){return new(r(e))(t)}},function(e,t,n){var r=n(2),o=n(49),u=n(29)("species");e.exports=function(e){var t;return o(e)&&("function"!=typeof(t=e.constructor)||t!==Array&&!o(t.prototype)||(t=undefined),r(t)&&null===(t=t[u])&&(t=undefined)),t===undefined?Array:t}},function(e,t,n){var r=n(20);e.exports=Array.isArray||function(e){return"Array"==r(e)}},function(e,t,n){"use strict";var r=n(1),o=n(21)(!1),u=[].indexOf,i=!!u&&1/[1].indexOf(1,-0)<0;r(r.P+r.F*(i||!n(30)(u)),"Array",{indexOf:function(e){return i?u.apply(this,arguments)||0:o(this,e,arguments[1])}})},function(e,t,n){var r=n(7).f,o=Function.prototype,u=/^\s*function ([^ (]*)/;"name"in o||n(3)&&r(o,"name",{configurable:!0,get:function(){try{return(""+this).match(u)[1]}catch(e){return""}}})},function(e,t,n){var r=n(1);r(r.P,"Function",{bind:n(53)})},function(e,t,n){"use strict";var u=n(17),i=n(2),a=n(54),s=[].slice,l={};e.exports=Function.bind||function(t){var n=u(this),r=s.call(arguments,1),o=function(){var e=r.concat(s.call(arguments));return this instanceof o?function(e,t,n){if(!(t in l)){for(var r=[],o=0;o<t;o++)r[o]="a["+o+"]";l[t]=Function("F,a","return new F("+r.join(",")+")")}return l[t](e,n)}(n,e.length,e):a(n,e,t)};return i(n.prototype)&&(o.prototype=n.prototype),o}},function(e,t){e.exports=function(e,t,n){var r=n===undefined;switch(t.length){case 0:return r?e():e.call(n);case 1:return r?e(t[0]):e.call(n,t[0]);case 2:return r?e(t[0],t[1]):e.call(n,t[0],t[1]);case 3:return r?e(t[0],t[1],t[2]):e.call(n,t[0],t[1],t[2]);case 4:return r?e(t[0],t[1],t[2],t[3]):e.call(n,t[0],t[1],t[2],t[3])}return e.apply(n,t)}},function(e,t,n){n(56)("match",1,function(r,o,e){return[function(e){"use strict";var t=r(this),n=e==undefined?undefined:e[o];return n!==undefined?n.call(e,t):new RegExp(e)[o](String(t))},e]})},function(e,t,n){"use strict";var a=n(6),s=n(14),l=n(4),c=n(11),p=n(29);e.exports=function(t,e,n){var r=p(t),o=n(c,r,""[t]),u=o[0],i=o[1];l(function(){var e={};return e[r]=function(){return 7},7!=""[t](e)})&&(s(String.prototype,t,u),a(RegExp.prototype,r,2==e?function(e,t){return i.call(e,this,t)}:function(e){return i.call(e,this)}))}},function(e,t,n){"use strict";t.__esModule=!0,t["default"]=void 0,n(28);var m=n(12);var r=function(o){function e(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return(e=o.call.apply(o,[this].concat(n))||this).state={bump:!1},e}(function n(e,t){e.prototype=Object.create(t.prototype),(e.prototype.constructor=e).__proto__=t})(e,o);var t=e.prototype;return t.componentWillReceiveProps=function(e){e.queryLength!==this.props.queryLength&&this.setState(function(e){return{bump:!e.bump}})},t.render=function(){var e=this.props,t=e.length,n=e.queryLength,r=e.minQueryLength,o=e.selectedOption,u=e.selectedOptionIndex,i=e.tQueryTooShort,a=e.tNoResults,s=e.tSelectedOption,l=e.tResults,c=this.state.bump,p=n<r,f=0===t,d=o?s(o,t,u):"",h=null;return h=p?i(r):f?a():l(t,d),(0,m.createElement)("div",{"aria-atomic":"true","aria-live":"polite",role:"status",style:{border:"0",clip:"rect(0 0 0 0)",height:"1px",marginBottom:"-1px",marginRight:"-1px",overflow:"hidden",padding:"0",position:"absolute",whiteSpace:"nowrap",width:"1px"}},h,(0,m.createElement)("span",null,c?",":",,"))},e}(m.Component);(t["default"]=r).defaultProps={tQueryTooShort:function(e){return"Type in "+e+" or more characters for results."},tNoResults:function(){return"No search results."},tSelectedOption:function(e,t,n){return e+" ("+(n+1)+" of "+t+") is selected."},tResults:function(e,t){return e+" "+(1===e?"result":"results")+" "+(1===e?"is":"are")+" available. "+t}}},function(e,t,n){"use strict";t.__esModule=!0,t["default"]=void 0;var r=n(12),o=function u(e){var t=e.className;return(0,r.createElement)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",className:t,focusable:"false"},(0,r.createElement)("g",{stroke:"none",fill:"none","fill-rule":"evenodd"},(0,r.createElement)("polygon",{fill:"#000000",points:"0 0 22 0 11 17"})))};t["default"]=o}])}); | ||
(function webpackUniversalModuleDefinition(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports["Autocomplete"]=t(require("react")):e["Autocomplete"]=t(e["React"])})(window,function(n){return function(n){var r={};function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}return o.m=n,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="/",o(o.s=31)}([function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){var v=n(0),m=n(5),y=n(6),g=n(14),b=n(16),O="prototype",w=function(e,t,n){var r,o,i,u,a=e&w.F,s=e&w.G,l=e&w.S,c=e&w.P,p=e&w.B,f=s?v:l?v[t]||(v[t]={}):(v[t]||{})[O],d=s?m:m[t]||(m[t]={}),h=d[O]||(d[O]={});for(r in s&&(n=t),n)i=((o=!a&&f&&f[r]!==undefined)?f:n)[r],u=p&&o?b(i,v):c&&"function"==typeof i?b(Function.call,i):i,f&&g(f,r,i,e&w.U),d[r]!=i&&y(d,r,u),c&&h[r]!=i&&(h[r]=i)};v.core=m,w.F=1,w.G=2,w.S=4,w.P=8,w.B=16,w.W=32,w.U=64,w.R=128,e.exports=w},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){e.exports=!n(4)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t){e.exports=function(e){try{return!!e()}catch(t){return!0}}},function(e,t){var n=e.exports={version:"2.5.7"};"number"==typeof __e&&(__e=n)},function(e,t,n){var r=n(7),o=n(35);e.exports=n(3)?function(e,t,n){return r.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){var o=n(8),i=n(33),u=n(34),a=Object.defineProperty;t.f=n(3)?Object.defineProperty:function(e,t,n){if(o(e),t=u(t,!0),o(n),i)try{return a(e,t,n)}catch(r){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){var r=n(2);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(e===undefined?"":e,")_",(++n+r).toString(36))}},function(e,t,n){var r=n(20);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t){e.exports=function(e){if(e==undefined)throw TypeError("Can't call method on "+e);return e}},function(e,t){e.exports=n},function(e,t,n){var r=n(2),o=n(0).document,i=r(o)&&r(o.createElement);e.exports=function(e){return i?o.createElement(e):{}}},function(e,t,n){var i=n(0),u=n(6),a=n(15),s=n(9)("src"),r="toString",o=Function[r],l=(""+o).split(r);n(5).inspectSource=function(e){return o.call(e)},(e.exports=function(e,t,n,r){var o="function"==typeof n;o&&(a(n,"name")||u(n,"name",t)),e[t]!==n&&(o&&(a(n,s)||u(n,s,e[t]?""+e[t]:l.join(String(t)))),e===i?e[t]=n:r?e[t]?e[t]=n:u(e,t,n):(delete e[t],u(e,t,n)))})(Function.prototype,r,function(){return"function"==typeof this&&this[s]||o.call(this)})},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var i=n(17);e.exports=function(r,o,e){if(i(r),o===undefined)return r;switch(e){case 1:return function(e){return r.call(o,e)};case 2:return function(e,t){return r.call(o,e,t)};case 3:return function(e,t,n){return r.call(o,e,t,n)}}return function(){return r.apply(o,arguments)}}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,n){var r=n(37),o=n(26);e.exports=Object.keys||function(e){return r(e,o)}},function(e,t,n){var r=n(10),o=n(11);e.exports=function(e){return r(o(e))}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var s=n(19),l=n(22),c=n(38);e.exports=function(a){return function(e,t,n){var r,o=s(e),i=l(o.length),u=c(n,i);if(a&&t!=t){for(;u<i;)if((r=o[u++])!=r)return!0}else for(;u<i;u++)if((a||u in o)&&o[u]===t)return a||u||0;return!a&&-1}}},function(e,t,n){var r=n(23),o=Math.min;e.exports=function(e){return 0<e?o(r(e),9007199254740991):0}},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(0<e?r:n)(e)}},function(e,t,n){var r=n(25)("keys"),o=n(9);e.exports=function(e){return r[e]||(r[e]=o(e))}},function(e,t,n){var r=n(5),o=n(0),i="__core-js_shared__",u=o[i]||(o[i]={});(e.exports=function(e,t){return u[e]||(u[e]=t!==undefined?t:{})})("versions",[]).push({version:r.version,mode:n(39)?"pure":"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){var r=n(11);e.exports=function(e){return Object(r(e))}},function(e,t,n){var r=n(1);r(r.S,"Object",{create:n(42)})},function(e,t,n){var r=n(25)("wks"),o=n(9),i=n(0).Symbol,u="function"==typeof i;(e.exports=function(e){return r[e]||(r[e]=u&&i[e]||(u?i:o)("Symbol."+e))}).store=r},function(e,t,n){"use strict";var r=n(4);e.exports=function(e,t){return!!e&&r(function(){t?e.call(null,function(){},1):e.call(null)})}},function(e,t,n){"use strict";t.__esModule=!0,t["default"]=void 0,n(32),n(28),n(45),n(46),n(51),n(52),n(55);var G=n(12),J=o(n(57)),r=o(n(58));function o(e){return e&&e.__esModule?e:{"default":e}}function X(){return(X=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function i(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var u,a={13:"enter",27:"escape",32:"space",38:"up",40:"down"},Y=((u=document.createElement("x")).style.cssText="pointer-events:auto","auto"===u.style.pointerEvents);function Z(){return!(!navigator.userAgent.match(/(iPod|iPhone|iPad)/g)||!navigator.userAgent.match(/AppleWebKit/g))}var s=function(n){function e(e){var t;return(t=n.call(this,e)||this).elementReferences={},t.state={focused:null,hovered:null,clicked:null,menuOpen:!1,options:e.defaultValue?[e.defaultValue]:[],query:e.defaultValue,validChoiceMade:!1,selected:null,ariaHint:!0},t.handleComponentBlur=t.handleComponentBlur.bind(i(i(t))),t.handleKeyDown=t.handleKeyDown.bind(i(i(t))),t.handleUpArrow=t.handleUpArrow.bind(i(i(t))),t.handleDownArrow=t.handleDownArrow.bind(i(i(t))),t.handleEnter=t.handleEnter.bind(i(i(t))),t.handlePrintableKey=t.handlePrintableKey.bind(i(i(t))),t.handleListMouseLeave=t.handleListMouseLeave.bind(i(i(t))),t.handleOptionBlur=t.handleOptionBlur.bind(i(i(t))),t.handleOptionClick=t.handleOptionClick.bind(i(i(t))),t.handleOptionFocus=t.handleOptionFocus.bind(i(i(t))),t.handleOptionMouseEnter=t.handleOptionMouseEnter.bind(i(i(t))),t.handleInputBlur=t.handleInputBlur.bind(i(i(t))),t.handleInputChange=t.handleInputChange.bind(i(i(t))),t.handleInputFocus=t.handleInputFocus.bind(i(i(t))),t.pollInputElement=t.pollInputElement.bind(i(i(t))),t.getDirectInputChanges=t.getDirectInputChanges.bind(i(i(t))),t}(function r(e,t){e.prototype=Object.create(t.prototype),(e.prototype.constructor=e).__proto__=t})(e,n);var t=e.prototype;return t.isQueryAnOption=function(e,t){var n=this;return-1!==t.map(function(e){return n.templateInputValue(e).toLowerCase()}).indexOf(e.toLowerCase())},t.componentDidMount=function(){this.pollInputElement()},t.componentWillUnmount=function(){clearTimeout(this.$pollInput),clearTimeout(this.$blurInput)},t.pollInputElement=function(){var e=this;this.getDirectInputChanges(),this.$pollInput=setTimeout(function(){e.pollInputElement()},100)},t.getDirectInputChanges=function(){var e=this.elementReferences[-1];e&&e.value!==this.state.query&&this.handleInputChange({target:{value:e.value}})},t.componentDidUpdate=function(e,t){var n=this.state,r=n.focused,o=n.clicked,i=null===r,u=t.focused!==r;(u&&!i||null!==o)&&this.elementReferences[r].focus();var a=-1===r,s=u&&null===t.focused;if(a&&s){var l=this.elementReferences[r];l.setSelectionRange(0,l.value.length)}},t.hasAutoselect=function(){return!Z()&&this.props.autoselect},t.templateInputValue=function(e){var t=this.props.templates&&this.props.templates.inputValue;return t?t(e):e},t.templateSuggestion=function(e){var t=this.props.templates&&this.props.templates.suggestion;return t?t(e):e},t.handleComponentBlur=function(e){var t,n=this.state,r=n.options,o=n.query,i=n.selected;this.props.confirmOnBlur?(t=e.query||o,this.props.onConfirm(r[i])):t=o,this.setState({focused:null,clicked:null,menuOpen:e.menuOpen||!1,query:t,selected:null,validChoiceMade:this.isQueryAnOption(t,r)})},t.handleListMouseLeave=function(e){this.setState({hovered:null})},t.handleOptionBlur=function(e,t){var n=this.state,r=n.focused,o=n.clicked,i=n.menuOpen,u=n.options,a=n.selected,s=null===e.relatedTarget&&null===o,l=e.relatedTarget===this.elementReferences[-1],c=r!==t&&-1!==r;if(!c&&s||!(c||l)){var p=i&&Z();this.handleComponentBlur({menuOpen:p,query:this.templateInputValue(u[a])})}},t.handleInputBlur=function(e){var t=this,n=this.state,r=n.focused,o=n.menuOpen,i=n.options,u=n.query,a=n.selected,s=-1!==r;if(clearTimeout(this.$blurInput),!s){var l=o&&Z(),c=Z()?u:this.templateInputValue(i[a]);this.$blurInput=setTimeout(function(){return t.handleComponentBlur({menuOpen:l,query:c})},200)}},t.handleInputChange=function(e){var n=this,t=this.props,r=t.minLength,o=t.source,i=t.showAllValues,u=this.hasAutoselect(),a=e.target.value,s=0===a.length,l=this.state.query.length!==a.length,c=a.length>=r;this.setState({query:a,ariaHint:s}),i||!s&&l&&c?o(a,function(e){var t=0<e.length;n.setState({menuOpen:t,options:e,selected:u&&t?0:-1,validChoiceMade:!1})}):!s&&c||this.setState({menuOpen:!1,options:[]})},t.handleInputClick=function(e){this.handleInputChange(e)},t.handleInputFocus=function(e){var t=this.state,n=t.query,r=t.validChoiceMade,o=t.options,i=this.props.minLength,u=!r&&n.length>=i&&0<o.length;u?this.setState(function(e){var t=e.menuOpen;return{focused:-1,menuOpen:u||t,selected:-1}}):this.setState({focused:-1})},t.handleOptionFocus=function(e){this.setState({focused:e,hovered:null,selected:e})},t.handleOptionMouseEnter=function(e,t){Z()||this.setState({hovered:t})},t.handleOptionClick=function(e,t){var n=this.state.options[t],r=this.templateInputValue(n);clearTimeout(this.$blurInput),this.props.onConfirm(n),this.setState({focused:-1,clicked:t,hovered:null,menuOpen:!1,query:r,selected:-1,validChoiceMade:!0}),this.forceUpdate()},t.handleUpArrow=function(e){e.preventDefault();var t=this.state,n=t.menuOpen,r=t.selected;-1!==r&&n&&this.handleOptionFocus(r-1)},t.handleDownArrow=function(e){var t=this;if(e.preventDefault(),this.props.showAllValues&&!1===this.state.menuOpen)e.preventDefault(),this.props.source("",function(e){t.setState({menuOpen:!0,options:e,selected:0,focused:0,hovered:null})});else if(!0===this.state.menuOpen){var n=this.state,r=n.menuOpen,o=n.options,i=n.selected;i!==o.length-1&&r&&this.handleOptionFocus(i+1)}},t.handleSpace=function(e){var t=this;this.props.showAllValues&&!1===this.state.menuOpen&&""===this.state.query&&(e.preventDefault(),this.props.source("",function(e){t.setState({menuOpen:!0,options:e})})),-1!==this.state.focused&&(e.preventDefault(),this.handleOptionClick(e,this.state.focused))},t.handleEnter=function(e){this.state.menuOpen&&(e.preventDefault(),0<=this.state.selected&&this.handleOptionClick(e,this.state.selected))},t.handlePrintableKey=function(e){var t=this.elementReferences[-1];e.target===t||t.focus()},t.handleKeyDown=function(e){switch(a[e.keyCode]){case"up":this.handleUpArrow(e);break;case"down":this.handleDownArrow(e);break;case"space":this.handleSpace(e);break;case"enter":this.handleEnter(e);break;case"escape":this.handleComponentBlur({query:this.state.query});break;default:(function t(e){return 47<e&&e<58||32===e||8===e||64<e&&e<91||95<e&&e<112||185<e&&e<193||218<e&&e<223})(e.keyCode)&&this.handlePrintableKey(e)}},t.render=function(){var e,i=this,t=this.props,n=t.cssNamespace,r=t.displayMenu,u=t.id,o=t.minLength,a=t.name,s=t.placeholder,l=t.required,c=t.showAllValues,p=t.tNoResults,f=t.tStatusQueryTooShort,d=t.tStatusNoResults,h=t.tStatusSelectedOption,v=t.tStatusResults,m=t.tAssistiveHint,y=t.dropdownArrow,g=this.state,b=g.focused,O=g.hovered,w=g.menuOpen,x=g.options,_=g.query,S=g.selected,I=g.ariaHint,C=g.validChoiceMade,E=this.hasAutoselect(),M=-1===b,j=0===x.length,A=0!==_.length,P=_.length>=o,k=this.props.showNoOptionsFound&&M&&j&&A&&P,F=n+"__wrapper",R=n+"__input",T=null!==b?" "+R+"--focused":"",L=this.props.showAllValues?" "+R+"--show-all-values":" "+R+"--default",q=n+"__dropdown-arrow-down",N=-1!==b&&null!==b,B=n+"__menu",D=B+"--"+r,V=B+"--"+(w||k?"visible":"hidden"),U=n+"__option",K=n+"__hint",H=this.templateInputValue(x[S]),Q=H&&0===H.toLowerCase().indexOf(_.toLowerCase())&&E?_+H.substr(_.length):"",W=Y&&Q,$=I?{"aria-describedby":"assistiveHint"}:null;return c&&"string"==typeof(e=y({className:q}))&&(e=(0,G.createElement)("div",{className:n+"__dropdown-arrow-down-wrapper",dangerouslySetInnerHTML:{__html:e}})),(0,G.createElement)("div",{className:F,onKeyDown:this.handleKeyDown},(0,G.createElement)(J["default"],{length:x.length,queryLength:_.length,minQueryLength:o,selectedOption:this.templateInputValue(x[S]),selectedOptionIndex:S,validChoiceMade:C,isInFocus:null!==this.state.focused,tQueryTooShort:f,tNoResults:d,tSelectedOption:h,tResults:v}),W&&(0,G.createElement)("span",null,(0,G.createElement)("input",{className:K,readonly:!0,tabIndex:"-1",value:Q})),(0,G.createElement)("input",X({"aria-expanded":w?"true":"false","aria-activedescendant":!!N&&u+"__option--"+b,"aria-owns":u+"__listbox","aria-autocomplete":this.hasAutoselect()?"both":"list"},$,{autoComplete:"off",className:""+R+T+L,id:u,onClick:function(e){return i.handleInputClick(e)},onBlur:this.handleInputBlur},function z(e){return{onChange:e}}(this.handleInputChange),{onFocus:this.handleInputFocus,name:a,placeholder:s,ref:function(e){i.elementReferences[-1]=e},type:"text",role:"combobox",required:l,value:_})),e,(0,G.createElement)("ul",{className:B+" "+D+" "+V,onMouseLeave:function(e){return i.handleListMouseLeave(e)},id:u+"__listbox",role:"listbox"},x.map(function(e,t){var n=(-1===b?S===t:b===t)&&null===O?" "+U+"--focused":"",r=t%2?" "+U+"--odd":"",o=Z()?"<span id="+u+"__option-suffix--"+t+' style="border:0;clip:rect(0 0 0 0);height:1px;marginBottom:-1px;marginRight:-1px;overflow:hidden;padding:0;position:absolute;whiteSpace:nowrap;width:1px"> '+(t+1)+" of "+x.length+"</span>":"";return(0,G.createElement)("li",{"aria-selected":b===t,className:""+U+n+r,dangerouslySetInnerHTML:{__html:i.templateSuggestion(e)+o},id:u+"__option--"+t,key:t,onBlur:function(e){return i.handleOptionBlur(e,t)},onClick:function(e){return i.handleOptionClick(e,t)},onMouseEnter:function(e){return i.handleOptionMouseEnter(e,t)},ref:function(e){i.elementReferences[t]=e},role:"option",tabIndex:"-1","aria-posinset":t+1,"aria-setsize":x.length})}),k&&(0,G.createElement)("li",{className:U+" "+U+"--no-results"},p())),(0,G.createElement)("span",{id:"assistiveHint",style:{display:"none"}},m()))},e}(G.Component);(t["default"]=s).defaultProps={autoselect:!1,cssNamespace:"autocomplete",defaultValue:"",displayMenu:"inline",minLength:0,name:"input-autocomplete",placeholder:"",onConfirm:function(){},confirmOnBlur:!0,showNoOptionsFound:!0,showAllValues:!1,required:!1,tNoResults:function(){return"No results found"},tAssistiveHint:function(){return"When autocomplete results are available use up and down arrows to review and enter to select. Touch device users, explore by touch or with swipe gestures."},dropdownArrow:r["default"]}},function(e,t,n){var r=n(1);r(r.S+r.F,"Object",{assign:n(36)})},function(e,t,n){e.exports=!n(3)&&!n(4)(function(){return 7!=Object.defineProperty(n(13)("div"),"a",{get:function(){return 7}}).a})},function(e,t,n){var o=n(2);e.exports=function(e,t){if(!o(e))return e;var n,r;if(t&&"function"==typeof(n=e.toString)&&!o(r=n.call(e)))return r;if("function"==typeof(n=e.valueOf)&&!o(r=n.call(e)))return r;if(!t&&"function"==typeof(n=e.toString)&&!o(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){"use strict";var f=n(18),d=n(40),h=n(41),v=n(27),m=n(10),o=Object.assign;e.exports=!o||n(4)(function(){var e={},t={},n=Symbol(),r="abcdefghijklmnopqrst";return e[n]=7,r.split("").forEach(function(e){t[e]=e}),7!=o({},e)[n]||Object.keys(o({},t)).join("")!=r})?function(e,t){for(var n=v(e),r=arguments.length,o=1,i=d.f,u=h.f;o<r;)for(var a,s=m(arguments[o++]),l=i?f(s).concat(i(s)):f(s),c=l.length,p=0;p<c;)u.call(s,a=l[p++])&&(n[a]=s[a]);return n}:o},function(e,t,n){var u=n(15),a=n(19),s=n(21)(!1),l=n(24)("IE_PROTO");e.exports=function(e,t){var n,r=a(e),o=0,i=[];for(n in r)n!=l&&u(r,n)&&i.push(n);for(;t.length>o;)u(r,n=t[o++])&&(~s(i,n)||i.push(n));return i}},function(e,t,n){var r=n(23),o=Math.max,i=Math.min;e.exports=function(e,t){return(e=r(e))<0?o(e+t,0):i(e,t)}},function(e,t){e.exports=!1},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,r){var o=r(8),i=r(43),u=r(26),a=r(24)("IE_PROTO"),s=function(){},l="prototype",c=function(){var e,t=r(13)("iframe"),n=u.length;for(t.style.display="none",r(44).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("<script>document.F=Object<\/script>"),e.close(),c=e.F;n--;)delete c[l][u[n]];return c()};e.exports=Object.create||function(e,t){var n;return null!==e?(s[l]=o(e),n=new s,s[l]=null,n[a]=e):n=c(),t===undefined?n:i(n,t)}},function(e,t,n){var u=n(7),a=n(8),s=n(18);e.exports=n(3)?Object.defineProperties:function(e,t){a(e);for(var n,r=s(t),o=r.length,i=0;i<o;)u.f(e,n=r[i++],t[n]);return e}},function(e,t,n){var r=n(0).document;e.exports=r&&r.documentElement},function(e,t,n){var r=n(7).f,o=Function.prototype,i=/^\s*function ([^ (]*)/;"name"in o||n(3)&&r(o,"name",{configurable:!0,get:function(){try{return(""+this).match(i)[1]}catch(e){return""}}})},function(e,t,n){"use strict";var r=n(1),o=n(47)(1);r(r.P+r.F*!n(30)([].map,!0),"Array",{map:function(e){return o(this,e,arguments[1])}})},function(e,t,n){var b=n(16),O=n(10),w=n(27),x=n(22),r=n(48);e.exports=function(p,e){var f=1==p,d=2==p,h=3==p,v=4==p,m=6==p,y=5==p||m,g=e||r;return function(e,t,n){for(var r,o,i=w(e),u=O(i),a=b(t,n,3),s=x(u.length),l=0,c=f?g(e,s):d?g(e,0):undefined;l<s;l++)if((y||l in u)&&(o=a(r=u[l],l,i),p))if(f)c[l]=o;else if(o)switch(p){case 3:return!0;case 5:return r;case 6:return l;case 2:c.push(r)}else if(v)return!1;return m?-1:h||v?v:c}}},function(e,t,n){var r=n(49);e.exports=function(e,t){return new(r(e))(t)}},function(e,t,n){var r=n(2),o=n(50),i=n(29)("species");e.exports=function(e){var t;return o(e)&&("function"!=typeof(t=e.constructor)||t!==Array&&!o(t.prototype)||(t=undefined),r(t)&&null===(t=t[i])&&(t=undefined)),t===undefined?Array:t}},function(e,t,n){var r=n(20);e.exports=Array.isArray||function(e){return"Array"==r(e)}},function(e,t,n){"use strict";var r=n(1),o=n(21)(!1),i=[].indexOf,u=!!i&&1/[1].indexOf(1,-0)<0;r(r.P+r.F*(u||!n(30)(i)),"Array",{indexOf:function(e){return u?i.apply(this,arguments)||0:o(this,e,arguments[1])}})},function(e,t,n){var r=n(1);r(r.P,"Function",{bind:n(53)})},function(e,t,n){"use strict";var i=n(17),u=n(2),a=n(54),s=[].slice,l={};e.exports=Function.bind||function(t){var n=i(this),r=s.call(arguments,1),o=function(){var e=r.concat(s.call(arguments));return this instanceof o?function(e,t,n){if(!(t in l)){for(var r=[],o=0;o<t;o++)r[o]="a["+o+"]";l[t]=Function("F,a","return new F("+r.join(",")+")")}return l[t](e,n)}(n,e.length,e):a(n,e,t)};return u(n.prototype)&&(o.prototype=n.prototype),o}},function(e,t){e.exports=function(e,t,n){var r=n===undefined;switch(t.length){case 0:return r?e():e.call(n);case 1:return r?e(t[0]):e.call(n,t[0]);case 2:return r?e(t[0],t[1]):e.call(n,t[0],t[1]);case 3:return r?e(t[0],t[1],t[2]):e.call(n,t[0],t[1],t[2]);case 4:return r?e(t[0],t[1],t[2],t[3]):e.call(n,t[0],t[1],t[2],t[3])}return e.apply(n,t)}},function(e,t,n){n(56)("match",1,function(r,o,e){return[function(e){"use strict";var t=r(this),n=e==undefined?undefined:e[o];return n!==undefined?n.call(e,t):new RegExp(e)[o](String(t))},e]})},function(e,t,n){"use strict";var a=n(6),s=n(14),l=n(4),c=n(11),p=n(29);e.exports=function(t,e,n){var r=p(t),o=n(c,r,""[t]),i=o[0],u=o[1];l(function(){var e={};return e[r]=function(){return 7},7!=""[t](e)})&&(s(String.prototype,t,i),a(RegExp.prototype,r,2==e?function(e,t){return u.call(e,this,t)}:function(e){return u.call(e,this)}))}},function(e,t,n){"use strict";t.__esModule=!0,t["default"]=void 0,n(28);var g=n(12);var r=function r(o,i,u){var a;return function(){var e=this,t=arguments,n=function n(){a=null,u||o.apply(e,t)},r=u&&!a;clearTimeout(a),a=setTimeout(n,i),r&&o.apply(e,t)}},o=function(o){function e(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return(e=o.call.apply(o,[this].concat(n))||this).state={bump:!1,debounced:!1},e}(function n(e,t){e.prototype=Object.create(t.prototype),(e.prototype.constructor=e).__proto__=t})(e,o);var t=e.prototype;return t.componentWillMount=function(){var e=this;this.debounceStatusUpdate=r(function(){if(!e.state.debounced){var t=!e.props.isInFocus||e.props.validChoiceMade;e.setState(function(e){return{bump:!e.bump,debounced:!0,silenced:t}})}},1400)},t.componentWillReceiveProps=function(e){e.queryLength;this.setState({debounced:!1})},t.render=function(){var e=this.props,t=e.length,n=e.queryLength,r=e.minQueryLength,o=e.selectedOption,i=e.selectedOptionIndex,u=e.tQueryTooShort,a=e.tNoResults,s=e.tSelectedOption,l=e.tResults,c=this.state,p=c.bump,f=c.debounced,d=c.silenced,h=n<r,v=0===t,m=o?s(o,t,i):"",y=null;return y=h?u(r):v?a():l(t,m),this.debounceStatusUpdate(),(0,g.createElement)("div",{style:{border:"0",clip:"rect(0 0 0 0)",height:"1px",marginBottom:"-1px",marginRight:"-1px",overflow:"hidden",padding:"0",position:"absolute",whiteSpace:"nowrap",width:"1px"}},(0,g.createElement)("div",{id:"ariaLiveA",role:"status","aria-atomic":"true","aria-live":"polite"},!d&&f&&p?y:""),(0,g.createElement)("div",{id:"ariaLiveB",role:"status","aria-atomic":"true","aria-live":"polite"},d||!f||p?"":y))},e}(g.Component);(t["default"]=o).defaultProps={tQueryTooShort:function(e){return"Type in "+e+" or more characters for results"},tNoResults:function(){return"No search results"},tSelectedOption:function(e,t,n){return e+" "+(n+1)+" of "+t+" is highlighted"},tResults:function(e,t){return e+" "+(1===e?"result":"results")+" "+(1===e?"is":"are")+" available. "+t}}},function(e,t,n){"use strict";t.__esModule=!0,t["default"]=void 0;var r=n(12),o=function i(e){var t=e.className;return(0,r.createElement)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",className:t,focusable:"false"},(0,r.createElement)("g",{stroke:"none",fill:"none","fill-rule":"evenodd"},(0,r.createElement)("polygon",{fill:"#000000",points:"0 0 22 0 11 17"})))};t["default"]=o}])}); | ||
//# sourceMappingURL=accessible-autocomplete.react.min.js.map |
{ | ||
"name": "accessible-autocomplete", | ||
"version": "1.6.2", | ||
"version": "2.0.0", | ||
"main": "dist/accessible-autocomplete.min.js", | ||
@@ -71,3 +71,3 @@ "style": "dist/accessible-autocomplete.min.css", | ||
"mocha": "^5.2.0", | ||
"npm-run-all": "^4.1.3", | ||
"npm-run-all": "^4.1.5", | ||
"puppeteer": "^1.10.0", | ||
@@ -74,0 +74,0 @@ "replace-bundle-webpack-plugin": "^1.0.0", |
# Accessible autocomplete | ||
[![npm version](https://img.shields.io/npm/v/accessible-autocomplete.svg)](http://npm.im/accessible-autocomplete) | ||
[![Build Status](https://travis-ci.org/alphagov/accessible-autocomplete.svg?branch=master)](https://travis-ci.org/alphagov/accessible-autocomplete) | ||
[![Build Status](https://travis-ci.com/alphagov/accessible-autocomplete.svg?branch=master)](https://travis-ci.com/alphagov/accessible-autocomplete) | ||
[![Coverage Status](https://coveralls.io/repos/github/alphagov/accessible-autocomplete/badge.svg?branch=master)](https://coveralls.io/github/alphagov/accessible-autocomplete?branch=master) | ||
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/alphagov/accessible-autocomplete.svg)](https://greenkeeper.io/) | ||
[![gzip size](http://img.badgesize.io/https://unpkg.com/accessible-autocomplete/dist/accessible-autocomplete.min.js?compression=gzip)](https://unpkg.com/accessible-autocomplete/dist/accessible-autocomplete.min.js) | ||
@@ -282,3 +281,3 @@ | ||
#### `tStatusQueryTooShort` (default: `` (minQueryLength) => `Type in ${minQueryLength} or more characters for results.` ``) | ||
#### `tStatusQueryTooShort` (default: `` (minQueryLength) => `Type in ${minQueryLength} or more characters for results` ``) | ||
@@ -289,3 +288,3 @@ Type: `Function` | ||
#### `tStatusNoResults` (default: `() => 'No search results.'`) | ||
#### `tStatusNoResults` (default: `() => 'No search results'`) | ||
@@ -296,3 +295,3 @@ Type: `Function` | ||
#### `tStatusSelectedOption` (default: `` (selectedOption, length, index) => `${selectedOption} (${index + 1} of ${length}) is selected.` ``) | ||
#### `tStatusSelectedOption` (default: `` (selectedOption, length, index) => `${selectedOption} ${index + 1} of ${length} is highlighted` ``) | ||
@@ -322,2 +321,10 @@ Type: `Function` | ||
#### `tAssistiveHint` (default: `() => 'When autocomplete results are available use up and down arrows to review and enter to select. Touch device users, explore by touch or with swipe gestures.'`) | ||
Type: `Function` | ||
A function that receives no arguments and should return the text to be assigned as the aria description of the html `input` element, via the `aria-describedby` attribute. | ||
This text is intended as an initial instruction to the assistive tech user. The `aria-describedby` attribute is automatically removed once user input is detected, in order to reduce screen reader verbosity. | ||
## Progressive enhancement | ||
@@ -324,0 +331,0 @@ |
@@ -59,2 +59,3 @@ import { createElement, Component } from 'preact' /** @jsx createElement */ | ||
tNoResults: () => 'No results found', | ||
tAssistiveHint: () => 'When autocomplete results are available use up and down arrows to review and enter to select. Touch device users, explore by touch or with swipe gestures.', | ||
dropdownArrow: DropdownArrowDown | ||
@@ -75,3 +76,5 @@ } | ||
query: props.defaultValue, | ||
selected: null | ||
validChoiceMade: false, | ||
selected: null, | ||
ariaHint: true | ||
} | ||
@@ -101,2 +104,6 @@ | ||
isQueryAnOption (query, options) { | ||
return options.map(entry => this.templateInputValue(entry).toLowerCase()).indexOf(query.toLowerCase()) !== -1 | ||
} | ||
componentDidMount () { | ||
@@ -178,3 +185,4 @@ this.pollInputElement() | ||
query: newQuery, | ||
selected: null | ||
selected: null, | ||
validChoiceMade: this.isQueryAnOption(newQuery, options) | ||
}) | ||
@@ -226,3 +234,6 @@ } | ||
this.setState({ query }) | ||
this.setState({ | ||
query, | ||
ariaHint: queryEmpty | ||
}) | ||
@@ -236,3 +247,4 @@ const searchForOptions = showAllValues || (!queryEmpty && queryChanged && queryLongEnough) | ||
options, | ||
selected: (autoselect && optionsAvailable) ? 0 : -1 | ||
selected: (autoselect && optionsAvailable) ? 0 : -1, | ||
validChoiceMade: false | ||
}) | ||
@@ -253,5 +265,11 @@ }) | ||
handleInputFocus (event) { | ||
this.setState({ | ||
focused: -1 | ||
}) | ||
const { query, validChoiceMade, options } = this.state | ||
const { minLength } = this.props | ||
const shouldReopenMenu = !validChoiceMade && query.length >= minLength && options.length > 0 | ||
if (shouldReopenMenu) { | ||
this.setState(({ menuOpen }) => ({ focused: -1, menuOpen: shouldReopenMenu || menuOpen, selected: -1 })) | ||
} else { | ||
this.setState({ focused: -1 }) | ||
} | ||
} | ||
@@ -288,3 +306,4 @@ | ||
query: newQuery, | ||
selected: -1 | ||
selected: -1, | ||
validChoiceMade: true | ||
}) | ||
@@ -409,5 +428,6 @@ this.forceUpdate() | ||
tStatusResults, | ||
tAssistiveHint, | ||
dropdownArrow: dropdownArrowFactory | ||
} = this.props | ||
const { focused, hovered, menuOpen, options, query, selected } = this.state | ||
const { focused, hovered, menuOpen, options, query, selected, ariaHint, validChoiceMade } = this.state | ||
const autoselect = this.hasAutoselect() | ||
@@ -447,2 +467,6 @@ | ||
const ariaDescribedProp = (ariaHint) ? { | ||
'aria-describedby': 'assistiveHint' | ||
} : null | ||
let dropdownArrow | ||
@@ -461,3 +485,3 @@ | ||
return ( | ||
<div className={wrapperClassName} onKeyDown={this.handleKeyDown} role='combobox' aria-expanded={menuOpen ? 'true' : 'false'}> | ||
<div className={wrapperClassName} onKeyDown={this.handleKeyDown}> | ||
<Status | ||
@@ -469,2 +493,4 @@ length={options.length} | ||
selectedOptionIndex={selected} | ||
validChoiceMade={validChoiceMade} | ||
isInFocus={this.state.focused !== null} | ||
tQueryTooShort={tStatusQueryTooShort} | ||
@@ -481,4 +507,7 @@ tNoResults={tStatusNoResults} | ||
<input | ||
aria-expanded={menuOpen ? 'true' : 'false'} | ||
aria-activedescendant={optionFocused ? `${id}__option--${focused}` : false} | ||
aria-owns={`${id}__listbox`} | ||
aria-autocomplete={(this.hasAutoselect()) ? 'both' : 'list'} | ||
{...ariaDescribedProp} | ||
autoComplete='off' | ||
@@ -495,3 +524,3 @@ className={`${inputClassName}${inputModifierFocused}${inputModifierType}`} | ||
type='text' | ||
role='textbox' | ||
role='combobox' | ||
required={required} | ||
@@ -513,2 +542,7 @@ value={query} | ||
const optionModifierOdd = (index % 2) ? ` ${optionClassName}--odd` : '' | ||
const iosPosinsetHtml = (isIosDevice()) | ||
? `<span id=${id}__option-suffix--${index} style="border:0;clip:rect(0 0 0 0);height:1px;` + | ||
'marginBottom:-1px;marginRight:-1px;overflow:hidden;padding:0;position:absolute;' + | ||
'whiteSpace:nowrap;width:1px">' + ` ${index + 1} of ${options.length}</span>` | ||
: '' | ||
@@ -519,3 +553,3 @@ return ( | ||
className={`${optionClassName}${optionModifierFocused}${optionModifierOdd}`} | ||
dangerouslySetInnerHTML={{ __html: this.templateSuggestion(option) }} | ||
dangerouslySetInnerHTML={{ __html: this.templateSuggestion(option) + iosPosinsetHtml }} | ||
id={`${id}__option--${index}`} | ||
@@ -529,2 +563,4 @@ key={index} | ||
tabIndex='-1' | ||
aria-posinset={index + 1} | ||
aria-setsize={options.length} | ||
/> | ||
@@ -538,2 +574,5 @@ ) | ||
</ul> | ||
<span id='assistiveHint' style={{ display: 'none' }}>{tAssistiveHint()}</span> | ||
</div> | ||
@@ -540,0 +579,0 @@ ) |
import { createElement, Component } from 'preact' /** @jsx createElement */ | ||
const debounce = function (func, wait, immediate) { | ||
var timeout | ||
return function () { | ||
var context = this | ||
var args = arguments | ||
var later = function () { | ||
timeout = null | ||
if (!immediate) func.apply(context, args) | ||
} | ||
var callNow = immediate && !timeout | ||
clearTimeout(timeout) | ||
timeout = setTimeout(later, wait) | ||
if (callNow) func.apply(context, args) | ||
} | ||
} | ||
const statusDebounceMillis = 1400 | ||
export default class Status extends Component { | ||
static defaultProps = { | ||
tQueryTooShort: (minQueryLength) => `Type in ${minQueryLength} or more characters for results.`, | ||
tNoResults: () => 'No search results.', | ||
tSelectedOption: (selectedOption, length, index) => `${selectedOption} (${index + 1} of ${length}) is selected.`, | ||
tQueryTooShort: (minQueryLength) => `Type in ${minQueryLength} or more characters for results`, | ||
tNoResults: () => 'No search results', | ||
tSelectedOption: (selectedOption, length, index) => `${selectedOption} ${index + 1} of ${length} is highlighted`, | ||
tResults: (length, contentSelectedOption) => { | ||
@@ -19,10 +36,18 @@ const words = { | ||
state = { | ||
bump: false | ||
bump: false, | ||
debounced: false | ||
} | ||
componentWillMount () { | ||
const that = this | ||
this.debounceStatusUpdate = debounce(function () { | ||
if (!that.state.debounced) { | ||
const shouldSilence = !that.props.isInFocus || that.props.validChoiceMade | ||
that.setState(({ bump }) => ({ bump: !bump, debounced: true, silenced: shouldSilence })) | ||
} | ||
}, statusDebounceMillis) | ||
} | ||
componentWillReceiveProps ({ queryLength }) { | ||
const hasChanged = queryLength !== this.props.queryLength | ||
if (hasChanged) { | ||
this.setState(({ bump }) => ({ bump: !bump })) | ||
} | ||
this.setState({ debounced: false }) | ||
} | ||
@@ -42,3 +67,3 @@ | ||
} = this.props | ||
const { bump } = this.state | ||
const { bump, debounced, silenced } = this.state | ||
@@ -61,23 +86,35 @@ const queryTooShort = queryLength < minQueryLength | ||
return <div | ||
aria-atomic='true' | ||
aria-live='polite' | ||
role='status' | ||
style={{ | ||
border: '0', | ||
clip: 'rect(0 0 0 0)', | ||
height: '1px', | ||
marginBottom: '-1px', | ||
marginRight: '-1px', | ||
overflow: 'hidden', | ||
padding: '0', | ||
position: 'absolute', | ||
whiteSpace: 'nowrap', | ||
width: '1px' | ||
}} | ||
> | ||
{content} | ||
<span>{bump ? ',' : ',,'}</span> | ||
</div> | ||
this.debounceStatusUpdate() | ||
return ( | ||
<div | ||
style={{ | ||
border: '0', | ||
clip: 'rect(0 0 0 0)', | ||
height: '1px', | ||
marginBottom: '-1px', | ||
marginRight: '-1px', | ||
overflow: 'hidden', | ||
padding: '0', | ||
position: 'absolute', | ||
whiteSpace: 'nowrap', | ||
width: '1px' | ||
}}> | ||
<div | ||
id='ariaLiveA' | ||
role='status' | ||
aria-atomic='true' | ||
aria-live='polite'> | ||
{(!silenced && debounced && bump) ? content : ''} | ||
</div> | ||
<div | ||
id='ariaLiveB' | ||
role='status' | ||
aria-atomic='true' | ||
aria-live='polite'> | ||
{(!silenced && debounced && !bump) ? content : ''} | ||
</div> | ||
</div> | ||
) | ||
} | ||
} |
/* global after, describe, before, beforeEach, expect, it */ | ||
import { createElement, render } from 'preact' /** @jsx createElement */ | ||
import Autocomplete from '../../src/autocomplete' | ||
import Status from '../../src/status' | ||
@@ -72,10 +73,40 @@ function suggest (query, syncResults) { | ||
it('renders with the correct aria attributes', () => { | ||
it('renders with an aria-expanded attribute', () => { | ||
render(<Autocomplete required />, scratch) | ||
let wrapperElement = scratch.getElementsByClassName('autocomplete__wrapper')[0] | ||
let inputElement = wrapperElement.getElementsByTagName('input')[0] | ||
expect(wrapperElement.getAttribute('aria-expanded')).to.equal('false') | ||
expect(inputElement.getAttribute('aria-expanded')).to.equal('false') | ||
}) | ||
it('renders with an aria-describedby attribute', () => { | ||
render(<Autocomplete required />, scratch) | ||
let wrapperElement = scratch.getElementsByClassName('autocomplete__wrapper')[0] | ||
let inputElement = wrapperElement.getElementsByTagName('input')[0] | ||
expect(inputElement.getAttribute('aria-describedby')).to.equal('assistiveHint') | ||
}) | ||
describe('renders with an aria-autocomplete attribute', () => { | ||
it('of value "list", when autoselect is not enabled', () => { | ||
render(<Autocomplete required />, scratch) | ||
let wrapperElement = scratch.getElementsByClassName('autocomplete__wrapper')[0] | ||
let inputElement = wrapperElement.getElementsByTagName('input')[0] | ||
expect(inputElement.getAttribute('aria-autocomplete')).to.equal('list') | ||
}) | ||
it('of value "both", when autoselect is enabled', () => { | ||
render(<Autocomplete required autoselect />, scratch) | ||
let wrapperElement = scratch.getElementsByClassName('autocomplete__wrapper')[0] | ||
let inputElement = wrapperElement.getElementsByTagName('input')[0] | ||
expect(inputElement.getAttribute('aria-autocomplete')).to.equal('both') | ||
}) | ||
}) | ||
it('renders with the correct roles', () => { | ||
@@ -88,3 +119,3 @@ render(<Autocomplete required />, scratch) | ||
expect(inputElement.getAttribute('role')).to.equal('textbox', 'input should have textbox role') | ||
expect(inputElement.getAttribute('role')).to.equal('combobox', 'input should have combobox role') | ||
expect(dropdownElement.getAttribute('role')).to.equal('listbox', 'menu should have listbox role') | ||
@@ -157,2 +188,10 @@ }) | ||
it('removes the aria-describedby attribute when query is non empty', () => { | ||
expect(autocomplete.state.ariaHint).to.equal(true) | ||
autocomplete.handleInputChange({ target: { value: 'a' } }) | ||
expect(autocomplete.state.ariaHint).to.equal(false) | ||
autocomplete.handleInputChange({ target: { value: '' } }) | ||
expect(autocomplete.state.ariaHint).to.equal(true) | ||
}) | ||
describe('with minLength', () => { | ||
@@ -190,16 +229,54 @@ beforeEach(() => { | ||
describe('focusing input', () => { | ||
it('does not display menu when something is typed in', () => { | ||
autocomplete.setState({ query: 'f' }) | ||
autocomplete.handleInputFocus() | ||
expect(autocomplete.state.menuOpen).to.equal(false) | ||
expect(autocomplete.state.focused).to.equal(-1) | ||
describe('when no query is present', () => { | ||
it('does not display menu', () => { | ||
autocomplete.setState({ query: '' }) | ||
autocomplete.handleInputFocus() | ||
expect(autocomplete.state.menuOpen).to.equal(false) | ||
expect(autocomplete.state.focused).to.equal(-1) | ||
}) | ||
}) | ||
it('hides menu when query is empty', () => { | ||
autocomplete.setState({ query: '' }) | ||
autocomplete.handleInputFocus() | ||
expect(autocomplete.state.menuOpen).to.equal(false) | ||
expect(autocomplete.state.focused).to.equal(-1) | ||
describe('when a non-matched query is present (no matching options are present)', () => { | ||
it('does not display menu', () => { | ||
autocomplete.setState({ query: 'f' }) | ||
autocomplete.handleInputFocus() | ||
expect(autocomplete.state.menuOpen).to.equal(false) | ||
expect(autocomplete.state.focused).to.equal(-1) | ||
}) | ||
}) | ||
describe('when a matched query is present (matching options exist)', () => { | ||
describe('and no user choice has yet been made', () => { | ||
it('displays menu', () => { | ||
autocomplete.setState({ | ||
menuOpen: false, | ||
options: ['France'], | ||
query: 'fr', | ||
focused: null, | ||
selected: null, | ||
validChoiceMade: false | ||
}) | ||
autocomplete.handleInputFocus() | ||
expect(autocomplete.state.focused).to.equal(-1) | ||
expect(autocomplete.state.menuOpen).to.equal(true) | ||
expect(autocomplete.state.selected).to.equal(-1) | ||
}) | ||
}) | ||
describe('and a user choice HAS been made', () => { | ||
it('does not display menu', () => { | ||
autocomplete.setState({ | ||
menuOpen: false, | ||
options: ['France'], | ||
query: 'fr', | ||
focused: null, | ||
selected: null, | ||
validChoiceMade: true | ||
}) | ||
autocomplete.handleInputFocus() | ||
expect(autocomplete.state.focused).to.equal(-1) | ||
expect(autocomplete.state.menuOpen).to.equal(false) | ||
}) | ||
}) | ||
}) | ||
describe('with option selected', () => { | ||
@@ -488,3 +565,155 @@ it('leaves menu open, does not change query', () => { | ||
}) | ||
describe('derived state', () => { | ||
it('initially assumes no valid choice on each new input', () => { | ||
autocomplete.handleInputChange({ target: { value: 'F' } }) | ||
expect(autocomplete.state.validChoiceMade).to.equal(false) | ||
}) | ||
describe('identifies that the user has made a valid choice', () => { | ||
it('when an option is actively clicked', () => { | ||
autocomplete.setState({ query: 'f', options: ['France'], validChoiceMade: false }) | ||
autocomplete.handleOptionClick({}, 0) | ||
expect(autocomplete.state.validChoiceMade).to.equal(true) | ||
}) | ||
it('when the input is blurred, autoselect is disabled, and the current query exactly matches an option', () => { | ||
autocomplete.setState({ query: 'France', options: ['France'], validChoiceMade: false }) | ||
autocomplete.handleComponentBlur({}) | ||
expect(autocomplete.state.validChoiceMade).to.equal(true) | ||
}) | ||
it('when in the same scenario, but the match differs only by case sensitivity', () => { | ||
autocomplete.setState({ query: 'fraNCe', options: ['France'], validChoiceMade: false }) | ||
autocomplete.handleComponentBlur({}) | ||
expect(autocomplete.state.validChoiceMade).to.equal(true) | ||
}) | ||
it('when the input is blurred, autoselect is enabled, and the current query results in at least one option', () => { | ||
autoselectAutocomplete.setState({ options: ['France'], validChoiceMade: false }) | ||
autoselectAutocomplete.handleInputChange({ target: { value: 'France' } }) | ||
autoselectAutocomplete.handleComponentBlur({}) | ||
expect(autoselectAutocomplete.state.validChoiceMade).to.equal(true) | ||
}) | ||
}) | ||
describe('identifies that the user has not made a valid choice', () => { | ||
it('when the input is blurred, autoselect is disabled, and the current query does not match an option', () => { | ||
autocomplete.setState({ query: 'Fracne', options: ['France'], validChoiceMade: false }) | ||
autocomplete.handleComponentBlur({}) | ||
expect(autocomplete.state.validChoiceMade).to.equal(false) | ||
}) | ||
it('when the input is blurred, autoselect is enabled, but no options exist for the current query', () => { | ||
autoselectAutocomplete.setState({ options: [], validChoiceMade: false }) | ||
autoselectAutocomplete.handleInputChange({ target: { value: 'gpvx' } }) | ||
autoselectAutocomplete.handleComponentBlur({}) | ||
expect(autoselectAutocomplete.state.validChoiceMade).to.equal(false) | ||
}) | ||
}) | ||
describe('identifies that the valid choice situation has changed', () => { | ||
it('when the user amends a previously matched query such that it no longer matches an option', () => { | ||
autocomplete.setState({ query: 'France', options: ['France'], validChoiceMade: false }) | ||
autocomplete.handleComponentBlur({}) | ||
expect(autocomplete.state.validChoiceMade).to.equal(true) | ||
autocomplete.handleInputChange({ target: { value: 'Francey' } }) | ||
autocomplete.handleComponentBlur({}) | ||
expect(autocomplete.state.validChoiceMade).to.equal(false) | ||
autocomplete.handleInputChange({ target: { value: 'France' } }) | ||
autocomplete.handleComponentBlur({}) | ||
expect(autocomplete.state.validChoiceMade).to.equal(true) | ||
autocomplete.handleInputChange({ target: { value: 'Franc' } }) | ||
autocomplete.handleComponentBlur({}) | ||
expect(autocomplete.state.validChoiceMade).to.equal(false) | ||
}) | ||
}) | ||
}) | ||
}) | ||
}) | ||
describe('Status', () => { | ||
describe('rendering', () => { | ||
let scratch | ||
before(() => { | ||
scratch = document.createElement('div'); | ||
(document.body || document.documentElement).appendChild(scratch) | ||
}) | ||
beforeEach(() => { | ||
scratch.innerHTML = '' | ||
}) | ||
after(() => { | ||
scratch.parentNode.removeChild(scratch) | ||
scratch = null | ||
}) | ||
it('renders a pair of aria live regions', () => { | ||
render(<Status />, scratch) | ||
expect(scratch.innerHTML).to.contain('div') | ||
let wrapperElement = scratch.getElementsByTagName('div')[0] | ||
let ariaLiveA = wrapperElement.getElementsByTagName('div')[0] | ||
let ariaLiveB = wrapperElement.getElementsByTagName('div')[1] | ||
expect(ariaLiveA.getAttribute('role')).to.equal('status', 'first aria live region should be marked as role=status') | ||
expect(ariaLiveA.getAttribute('aria-atomic')).to.equal('true', 'first aria live region should be marked as atomic') | ||
expect(ariaLiveA.getAttribute('aria-live')).to.equal('polite', 'first aria live region should be marked as polite') | ||
expect(ariaLiveB.getAttribute('role')).to.equal('status', 'second aria live region should be marked as role=status') | ||
expect(ariaLiveB.getAttribute('aria-atomic')).to.equal('true', 'second aria live region should be marked as atomic') | ||
expect(ariaLiveB.getAttribute('aria-live')).to.equal('polite', 'second aria live region should be marked as polite') | ||
}) | ||
describe('behaviour', () => { | ||
describe('silences aria live announcement', () => { | ||
it('when a valid choice has been made and the input has focus', (done) => { | ||
let status = new Status({ | ||
...Status.defaultProps, | ||
validChoiceMade: true, | ||
isInFocus: true | ||
}) | ||
status.componentWillMount() | ||
status.render() | ||
setTimeout(() => { | ||
expect(status.state.silenced).to.equal(true) | ||
done() | ||
}, 1500) | ||
}) | ||
it('when the input no longer has focus', (done) => { | ||
let status = new Status({ | ||
...Status.defaultProps, | ||
validChoiceMade: false, | ||
isInFocus: false | ||
}) | ||
status.componentWillMount() | ||
status.render() | ||
setTimeout(() => { | ||
expect(status.state.silenced).to.equal(true) | ||
done() | ||
}, 1500) | ||
}) | ||
}) | ||
describe('does not silence aria live announcement', () => { | ||
it('when a valid choice has not been made and the input has focus', (done) => { | ||
let status = new Status({ | ||
...Status.defaultProps, | ||
validChoiceMade: false, | ||
isInFocus: true | ||
}) | ||
status.componentWillMount() | ||
status.render() | ||
setTimeout(() => { | ||
expect(status.state.silenced).to.equal(false) | ||
done() | ||
}, 1500) | ||
}) | ||
}) | ||
}) | ||
}) | ||
}) |
@@ -241,2 +241,72 @@ /* global before, beforeEach, after, describe, expect, it */ | ||
it('includes aria attributes on each option, to indicate position within the full set of list item elements', (done) => { | ||
const select = injectSelectToEnhanceIntoDOM(scratch) | ||
accessibleAutocomplete.enhanceSelectElement({ | ||
selectElement: select | ||
}) | ||
const autocompleteInstances = document.querySelectorAll('.autocomplete__wrapper') | ||
const autocompleteInstance = autocompleteInstances[0] | ||
const autocompleteInput = autocompleteInstance.querySelector('.autocomplete__input') | ||
autocompleteInput.value = 'e' | ||
setTimeout(() => { | ||
const autocompleteOptions = autocompleteInstance.querySelectorAll('.autocomplete__option') | ||
expect(autocompleteOptions.length).to.equal(3) | ||
expect(autocompleteOptions[0].getAttribute('aria-posinset')).to.equal('1') | ||
expect(autocompleteOptions[0].getAttribute('aria-setsize')).to.equal('3') | ||
expect(autocompleteOptions[1].getAttribute('aria-posinset')).to.equal('2') | ||
expect(autocompleteOptions[1].getAttribute('aria-setsize')).to.equal('3') | ||
expect(autocompleteOptions[2].getAttribute('aria-posinset')).to.equal('3') | ||
expect(autocompleteOptions[2].getAttribute('aria-setsize')).to.equal('3') | ||
done() | ||
}, 250) | ||
}) | ||
it('includes an explicit position suffix on each list item option when iOS is detected', (done) => { | ||
Object.defineProperty(global.navigator, 'userAgent', { value: 'iPhone AppleWebKit', configurable: true }) | ||
const select = injectSelectToEnhanceIntoDOM(scratch) | ||
accessibleAutocomplete.enhanceSelectElement({ | ||
selectElement: select | ||
}) | ||
const autocompleteInstances = document.querySelectorAll('.autocomplete__wrapper') | ||
const autocompleteInstance = autocompleteInstances[0] | ||
const autocompleteInput = autocompleteInstance.querySelector('.autocomplete__input') | ||
const autocompleteOption = autocompleteInstance.querySelector('.autocomplete__option') | ||
autocompleteInput.value = 'Fran' | ||
setTimeout(() => { | ||
expect(autocompleteOption.textContent).to.equal('France 1 of 1') | ||
const iosSuffixSpan = autocompleteOption.querySelector('#location-picker-id__option-suffix--0') | ||
expect(iosSuffixSpan.textContent).to.equal(' 1 of 1') | ||
done() | ||
}, 250) | ||
}) | ||
it('does not include a position suffix on each list item option, when iOS is not detected', (done) => { | ||
Object.defineProperty(global.navigator, 'userAgent', { value: 'definitely not an iDevice', configurable: true }) | ||
const select = injectSelectToEnhanceIntoDOM(scratch) | ||
accessibleAutocomplete.enhanceSelectElement({ | ||
selectElement: select | ||
}) | ||
const autocompleteInstances = document.querySelectorAll('.autocomplete__wrapper') | ||
const autocompleteInstance = autocompleteInstances[0] | ||
const autocompleteInput = autocompleteInstance.querySelector('.autocomplete__input') | ||
const autocompleteOption = autocompleteInstance.querySelector('.autocomplete__option') | ||
autocompleteInput.value = 'Fran' | ||
setTimeout(() => { | ||
expect(autocompleteOption.textContent).to.equal('France') | ||
const iosSuffixSpan = autocompleteOption.querySelector('#location-picker-id__option-suffix--0') | ||
expect(iosSuffixSpan).to.equal(null) | ||
done() | ||
}, 250) | ||
}) | ||
it('onConfirm updates original select', (done) => { | ||
@@ -243,0 +313,0 @@ const select = injectSelectToEnhanceIntoDOM(scratch, { selected: 'de' }) |
@@ -10,2 +10,3 @@ /* global afterEach, before, beforeEach, browser, describe, it */ | ||
// const isIE11 = isIE && version === '11.103' | ||
const liveRegionWaitTimeMillis = 10000 | ||
@@ -42,2 +43,32 @@ const basicExample = () => { | ||
// These tests are flakey when run through Saucelabs so we only run them | ||
// in Chrome | ||
if (isChrome) { | ||
it('should announce status changes using two alternately updated aria live regions', () => { | ||
const flip = browser.$('div#ariaLiveA') | ||
const flop = browser.$('div#ariaLiveB') | ||
browser.click(input) | ||
browser.setValue(input, 'a') | ||
expect(flip.getText()).to.equal('') | ||
expect(flop.getText()).to.equal('') | ||
browser.waitUntil(() => { return flip.getText() !== '' }, | ||
liveRegionWaitTimeMillis, | ||
'expected the first aria live region to be populated within ' + liveRegionWaitTimeMillis + ' milliseconds' | ||
) | ||
browser.addValue(input, 's') | ||
browser.waitUntil(() => { return (flip.getText() === '' && flop.getText() !== '') }, | ||
liveRegionWaitTimeMillis, | ||
'expected the first aria live region to be cleared, and the second to be populated within ' + | ||
liveRegionWaitTimeMillis + ' milliseconds' | ||
) | ||
browser.addValue(input, 'h') | ||
browser.waitUntil(() => { return (flip.getText() !== '' && flop.getText() === '') }, | ||
liveRegionWaitTimeMillis, | ||
'expected the first aria live region to be populated, and the second to be cleared within ' + | ||
liveRegionWaitTimeMillis + ' milliseconds' | ||
) | ||
}) | ||
} | ||
describe('keyboard use', () => { | ||
@@ -44,0 +75,0 @@ it('should allow typing', () => { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
600068
38
2566
424
5