Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@algolia/autocomplete-core

Package Overview
Dependencies
Maintainers
62
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@algolia/autocomplete-core - npm Package Compare versions

Comparing version 1.0.0-alpha.48 to 1.0.0-alpha.49

42

dist/esm/types/AutocompleteOptions.d.ts

@@ -36,6 +36,6 @@ import { MaybePromise } from '@algolia/autocomplete-shared';

*
* See [**Debugging**](https://autocomplete.algolia.com/docs/debugging) for more information.
* See [**Debugging**](https://www.algolia.com/doc/ui-libraries/autocomplete/guides/debugging/) for more information.
*
* @default false
* @link https://autocomplete.algolia.com/docs/autocomplete-js#debug
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-debug
*/

@@ -49,3 +49,3 @@ debug?: boolean;

* @default "autocomplete-0"
* @link https://autocomplete.algolia.com/docs/autocomplete-js#id
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-id
*/

@@ -56,3 +56,3 @@ id?: string;

*
* @link https://autocomplete.algolia.com/docs/autocomplete-js#onstatechange
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-onstatechange
*/

@@ -63,3 +63,3 @@ onStateChange?(props: OnStateChangeProps<TItem>): void;

*
* @link https://autocomplete.algolia.com/docs/autocomplete-js#placeholder
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-placeholder
*/

@@ -71,3 +71,3 @@ placeholder?: string;

* @default false
* @link https://autocomplete.algolia.com/docs/autocomplete-js#autofocus
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-autofocus
*/

@@ -81,3 +81,3 @@ autoFocus?: boolean;

* @default null
* @link https://autocomplete.algolia.com/docs/autocomplete-js#defaultactiveitemid
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-defaultactiveitemid
*/

@@ -89,10 +89,10 @@ defaultActiveItemId?: number | null;

* @default false
* @link https://autocomplete.algolia.com/docs/autocomplete-js#openonfocus
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-openonfocus
*/
openOnFocus?: boolean;
/**
* How many milliseconds must elapse before considering the autocomplete experience [stalled](https://autocomplete.algolia.com/docs/state#status).
* How many milliseconds must elapse before considering the autocomplete experience [stalled](https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/state/#param-status).
*
* @default 300
* @link https://autocomplete.algolia.com/docs/autocomplete-js#stallthreshold
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-stallthreshold
*/

@@ -103,9 +103,9 @@ stallThreshold?: number;

*
* @link https://autocomplete.algolia.com/docs/autocomplete-js#initialstate
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-initialstate
*/
initialState?: Partial<AutocompleteState<TItem>>;
/**
* The [sources](https://autocomplete.algolia.com/docs/sources) to get the suggestions from.
* The [sources](https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/sources/) to get the suggestions from.
*
* @link https://autocomplete.algolia.com/docs/autocomplete-js#getsources
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-getsources
*/

@@ -119,3 +119,3 @@ getSources?: GetSources<TItem>;

* @default window
* @link https://autocomplete.algolia.com/docs/autocomplete-js#environment
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-environment
*/

@@ -126,5 +126,5 @@ environment?: AutocompleteEnvironment;

*
* Learn more on the [**Navigator API**](https://autocomplete.algolia.com/docs/keyboard-navigation) documentation.
* Learn more on the [**Navigator API**](https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/keyboard-navigation/) documentation.
*
* @link https://autocomplete.algolia.com/docs/autocomplete-js#navigator
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-navigator
*/

@@ -137,3 +137,3 @@ navigator?: Partial<AutocompleteNavigator<TItem>>;

*
* @link https://autocomplete.algolia.com/docs/autocomplete-js#shouldpanelopen
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-shouldpanelopen
*/

@@ -146,3 +146,3 @@ shouldPanelOpen?(params: {

*
* @link https://autocomplete.algolia.com/docs/autocomplete-js#onsubmit
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-onsubmit
*/

@@ -153,3 +153,3 @@ onSubmit?(params: OnSubmitParams<TItem>): void;

*
* @link https://autocomplete.algolia.com/docs/autocomplete-js#onreset
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-onreset
*/

@@ -160,5 +160,5 @@ onReset?(params: OnResetParams<TItem>): void;

*
* See [**Plugins**](https://autocomplete.algolia.com/docs/plugins) for more information.
* See [**Plugins**](https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/plugins/) for more information.
*
* @link https://autocomplete.algolia.com/docs/autocomplete-js#plugins
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-plugins
*/

@@ -165,0 +165,0 @@ plugins?: Array<AutocompletePlugin<any, any>>;

@@ -14,2 +14,4 @@ import { AutocompleteScopeApi, BaseItem } from './AutocompleteApi';

* It lets you subscribe to lifecycle hooks and interact with the instance's state and context.
*
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/plugins/#param-subscribe
*/

@@ -19,2 +21,4 @@ subscribe?(params: PluginSubscribeParams<any>): void;

* An extra plugin object to expose properties and functions as APIs.
*
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/plugins/#param-data
*/

@@ -21,0 +25,0 @@ data?: TData;

@@ -11,3 +11,3 @@ import { BaseItem } from './AutocompleteApi';

*
* @link https://autocomplete.algolia.com/docs/state#setactiveitemid
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/state/#param-setactiveitemid
*/

@@ -18,3 +18,3 @@ setActiveItemId: StateUpdater<AutocompleteState<TItem>['activeItemId']>;

*
* @link https://autocomplete.algolia.com/docs/state#setquery
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/state/#param-setquery
*/

@@ -25,3 +25,3 @@ setQuery: StateUpdater<AutocompleteState<TItem>['query']>;

*
* @link https://autocomplete.algolia.com/docs/state#setcollections
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/state/#param-setcollections
*/

@@ -32,3 +32,3 @@ setCollections: StateUpdater<Array<AutocompleteCollection<TItem> | AutocompleteCollectionItemsArray<TItem>>>;

*
* @link https://autocomplete.algolia.com/docs/state#setisopen
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/state/#param-setisopen
*/

@@ -39,3 +39,3 @@ setIsOpen: StateUpdater<AutocompleteState<TItem>['isOpen']>;

*
* @link https://autocomplete.algolia.com/docs/state#setisopen
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/state/#param-setisopen
*/

@@ -46,7 +46,7 @@ setStatus: StateUpdater<AutocompleteState<TItem>['status']>;

*
* See more in [**Context**](https://autocomplete.algolia.com/docs/context).
* See more in [**Context**](https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/context/).
*
* @link https://autocomplete.algolia.com/docs/state#setcontext
* @link https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/state/#param-setcontext
*/
setContext: StateUpdater<AutocompleteState<TItem>['context']>;
}

@@ -32,3 +32,3 @@ import type { RequesterDescription } from '@algolia/autocomplete-preset-algolia';

*
* The value is used to add [keyboard accessibility](https://autocomplete.algolia.com/docs/keyboard-navigation) features to let users open items in the current tab, a new tab, or a new window.
* The value is used to add [keyboard accessibility](https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/keyboard-navigation/) features to let users open items in the current tab, a new tab, or a new window.
*/

@@ -35,0 +35,0 @@ getItemUrl?({ item, state, }: {

import type { SearchForFacetValuesResponse, SearchResponse } from '@algolia/client-search';
export declare function mapToAlgoliaResponse<THit>(results: Array<SearchResponse<THit> | SearchForFacetValuesResponse>): {
export declare function mapToAlgoliaResponse<THit>(rawResults: Array<SearchResponse<THit> | SearchForFacetValuesResponse>): {
results: (SearchForFacetValuesResponse | SearchResponse<THit>)[];

@@ -4,0 +4,0 @@ hits: import("@algolia/client-search").Hit<THit>[][];

@@ -1,2 +0,21 @@

export function mapToAlgoliaResponse(results) {
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
export function mapToAlgoliaResponse(rawResults) {
var results = rawResults.map(function (result) {
var _hits;
return _objectSpread(_objectSpread({}, result), {}, {
hits: (_hits = result.hits) === null || _hits === void 0 ? void 0 : _hits.map(function (hit) {
// Bring support for the Insights plugin.
return _objectSpread(_objectSpread({}, hit), {}, {
__autocomplete_indexName: result.index,
__autocomplete_queryID: result.queryID
});
})
});
});
return {

@@ -11,2 +30,3 @@ results: results,

return (_facetHits = result.facetHits) === null || _facetHits === void 0 ? void 0 : _facetHits.map(function (facetHit) {
// Bring support for the highlighting components.
return {

@@ -13,0 +33,0 @@ label: facetHit.value,

@@ -1,1 +0,1 @@

export declare const version = "1.0.0-alpha.48";
export declare const version = "1.0.0-alpha.49";

@@ -1,1 +0,1 @@

export var version = '1.0.0-alpha.48';
export var version = '1.0.0-alpha.49';

@@ -1,2 +0,2 @@

/*! @algolia/autocomplete-core 1.0.0-alpha.48 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/autocomplete */
/*! @algolia/autocomplete-core 1.0.0-alpha.49 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/autocomplete */
(function (global, factory) {

@@ -385,3 +385,16 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :

function mapToAlgoliaResponse(results) {
function mapToAlgoliaResponse(rawResults) {
var results = rawResults.map(function (result) {
var _hits;
return _objectSpread2(_objectSpread2({}, result), {}, {
hits: (_hits = result.hits) === null || _hits === void 0 ? void 0 : _hits.map(function (hit) {
// Bring support for the Insights plugin.
return _objectSpread2(_objectSpread2({}, hit), {}, {
__autocomplete_indexName: result.index,
__autocomplete_queryID: result.queryID
});
})
});
});
return {

@@ -396,2 +409,3 @@ results: results,

return (_facetHits = result.facetHits) === null || _facetHits === void 0 ? void 0 : _facetHits.map(function (facetHit) {
// Bring support for the highlighting components.
return {

@@ -1414,3 +1428,3 @@ label: facetHit.value,

var version = '1.0.0-alpha.48';
var version = '1.0.0-alpha.49';

@@ -1417,0 +1431,0 @@ exports.createAutocomplete = createAutocomplete;

@@ -1,3 +0,3 @@

/*! @algolia/autocomplete-core 1.0.0-alpha.48 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/autocomplete */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@algolia/autocomplete-core"]={})}(this,(function(e){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?r(Object(o),!0).forEach((function(t){n(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function u(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return a(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var c=0;function l(e){return 0===e.collections.length?0:e.collections.reduce((function(e,t){return e+t.items.length}),0)}function s(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function f(e,t,n,r){if(e<0&&(null===t||null!==r&&0===t))return n+e;var o=(null===t?-1:t)+e;return o<=-1||o>=n?null===r?null:0:o}var p=function(){};function m(e){var t=function(e){var t=e.collections.map((function(e){return e.items.length})).reduce((function(e,t,n){var r=(e[n-1]||0)+t;return e.push(r),e}),[]).reduce((function(t,n){return n<=e.activeItemId?t+1:t}),0);return e.collections[t]}(e);if(!t)return null;var n=t.items[function(e){for(var t=e.state,n=e.collection,r=!1,o=0,i=0;!1===r;){var u=t.collections[o];if(u===n){r=!0;break}i+=u.items.length,o++}return t.activeItemId-i}({state:e,collection:t})],r=t.source;return{item:n,itemInputValue:r.getItemInputValue({item:n,state:e}),itemUrl:r.getItemUrl({item:n,state:e}),source:r}}function v(e,t){return e===t||e.contains(t)}function d(e,n){var r,i="undefined"!=typeof window?window:{},a=e.plugins||[];return o(o({debug:!1,openOnFocus:!1,placeholder:"",autoFocus:!1,defaultActiveItemId:null,stallThreshold:300,environment:i,shouldPanelOpen:function(e){return l(e.state)>0}},e),{},{id:null!==(r=e.id)&&void 0!==r?r:"autocomplete-".concat(c++),plugins:a,initialState:o({activeItemId:null,query:"",completion:null,collections:[],isOpen:!1,status:"idle",context:{}},e.initialState),onStateChange:function(t){var n;null===(n=e.onStateChange)||void 0===n||n.call(e,t),a.forEach((function(e){var n;return null===(n=e.onStateChange)||void 0===n?void 0:n.call(e,t)}))},onSubmit:function(t){var n;null===(n=e.onSubmit)||void 0===n||n.call(e,t),a.forEach((function(e){var n;return null===(n=e.onSubmit)||void 0===n?void 0:n.call(e,t)}))},onReset:function(t){var n;null===(n=e.onReset)||void 0===n||n.call(e,t),a.forEach((function(e){var n;return null===(n=e.onReset)||void 0===n?void 0:n.call(e,t)}))},getSources:function(r){return Promise.all([].concat(u(a.map((function(e){return e.getSources}))),[e.getSources]).filter(Boolean).map((function(e){return function(e,n){var r=[];return Promise.resolve(e(n)).then((function(e){return Array.isArray(e),"The `getSources` function must return an array of sources but returned type ".concat(JSON.stringify(t(e)),":\n\n").concat(JSON.stringify(e,null,2)),Promise.all(e.filter((function(e){return Boolean(e)})).map((function(e){if(e.sourceId,r.includes(e.sourceId))throw new Error("[Autocomplete] The `sourceId` ".concat(JSON.stringify(e.sourceId)," is not unique."));r.push(e.sourceId);var t=o({getItemInputValue:function(e){return e.state.query},getItemUrl:function(){},onSelect:function(e){(0,e.setIsOpen)(!1)},onActive:p},e);return Promise.resolve(t)})))}))}(e,r)}))).then((function(e){return s(e)})).then((function(e){return e.map((function(e){return o(o({},e),{},{onSelect:function(t){e.onSelect(t),n.forEach((function(e){var n;return null===(n=e.onSelect)||void 0===n?void 0:n.call(e,t)}))},onActive:function(t){e.onActive(t),n.forEach((function(e){var n;return null===(n=e.onActive)||void 0===n?void 0:n.call(e,t)}))}})}))}))},navigator:o({navigate:function(e){var t=e.itemUrl;i.location.assign(t)},navigateNewTab:function(e){var t=e.itemUrl,n=i.open(t,"_blank","noopener");null==n||n.focus()},navigateNewWindow:function(e){var t=e.itemUrl;i.open(t,"_blank","noopener")}},e.navigator)})}function g(e){return Boolean(e.execute)}function h(e,t){return Boolean(e.execute)?o(o({},e),{},{requests:e.queries.map((function(n){return{query:n,sourceId:t,transformResponse:e.transformResponse}}))}):{items:e,sourceId:t}}function I(e){var t=e.reduce((function(e,t){if(!g(t))return e.push(t),e;var n=t.searchClient,r=t.execute,o=t.requests,i=e.find((function(e){return g(t)&&g(e)&&e.searchClient===n&&e.execute===r}));if(i){var a;(a=i.items).push.apply(a,u(o))}else{var c={execute:r,items:o,searchClient:n};e.push(c)}return e}),[]).map((function(e){if(!g(e))return Promise.resolve(e);var t=e,n=t.execute,r=t.items;return n({searchClient:t.searchClient,requests:r})}));return Promise.all(t).then((function(e){return s(e)}))}function y(e,n){return n.map((function(n){var r=e.filter((function(e){return e.sourceId===n.sourceId})),o=r.map((function(e){return e.items})),i=r[0].transformResponse,u=i?i(function(e){return{results:e,hits:e.map((function(e){return e.hits})).filter(Boolean),facetHits:e.map((function(e){var t;return null===(t=e.facetHits)||void 0===t?void 0:t.map((function(e){return{label:e.value,count:e.count,_highlightResult:{label:{value:e.highlighted}}}}))})).filter(Boolean)}}(o)):o;return Array.isArray(u),"The `getItems` function must return an array of items but returned type ".concat(JSON.stringify(t(u)),":\n\n").concat(JSON.stringify(u,null,2)),{source:n,items:u}}))}var S=null;function b(e){var t=e.event,n=e.nextState,r=void 0===n?{}:n,u=e.props,a=e.query,c=e.refresh,l=e.store,s=i(e,["event","nextState","props","query","refresh","store"]);S&&u.environment.clearTimeout(S);var f,p=s.setCollections,v=s.setIsOpen,d=s.setQuery,g=s.setActiveItemId,b=s.setStatus;return d(a),g(u.defaultActiveItemId),a||!1!==u.openOnFocus?(b("loading"),S=u.environment.setTimeout((function(){b("stalled")}),u.stallThreshold),u.getSources(o({query:a,refresh:c,state:l.getState()},s)).then((function(e){return b("loading"),Promise.all(e.map((function(e){return Promise.resolve(e.getItems(o({query:a,refresh:c,state:l.getState()},s))).then((function(t){return h(t,e.sourceId)}))}))).then(I).then((function(t){return y(t,e)})).then((function(e){var n;b("idle"),p(e);var i=u.shouldPanelOpen({state:l.getState()});v(null!==(n=r.isOpen)&&void 0!==n?n:u.openOnFocus&&!a&&i||i);var f=m(l.getState());if(null!==l.getState().activeItemId&&f){var d=f.item,g=f.itemInputValue,h=f.itemUrl,I=f.source;I.onActive(o({event:t,item:d,itemInputValue:g,itemUrl:h,refresh:c,source:I,state:l.getState()},s))}})).finally((function(){S&&u.environment.clearTimeout(S)}))}))):(b("idle"),p(l.getState().collections.map((function(e){return o(o({},e),{},{items:[]})}))),v(null!==(f=r.isOpen)&&void 0!==f?f:u.shouldPanelOpen({state:l.getState()})),Promise.resolve())}function O(e){var t=e.props,n=e.refresh,r=e.store,u=i(e,["props","refresh","store"]);return{getEnvironmentProps:function(e){var n=e.inputElement,u=e.formElement,a=e.panelElement;return o({onTouchStart:function(e){!1!==r.getState().isOpen&&e.target!==n&&(!1===[u,a].some((function(n){return v(n,e.target)||v(n,t.environment.document.activeElement)}))&&r.dispatch("blur",null))},onTouchMove:function(e){!1!==r.getState().isOpen&&n===t.environment.document.activeElement&&e.target!==n&&n.blur()}},i(e,["inputElement","formElement","panelElement"]))},getRootProps:function(e){return o({role:"combobox","aria-expanded":r.getState().isOpen,"aria-haspopup":"listbox","aria-owns":r.getState().isOpen?"".concat(t.id,"-list"):void 0,"aria-labelledby":"".concat(t.id,"-label")},e)},getFormProps:function(e){e.inputElement;return o({action:"",noValidate:!0,role:"search",onSubmit:function(i){var a;i.preventDefault(),t.onSubmit(o({event:i,refresh:n,state:r.getState()},u)),r.dispatch("submit",null),null===(a=e.inputElement)||void 0===a||a.blur()},onReset:function(i){var a;i.preventDefault(),t.onReset(o({event:i,refresh:n,state:r.getState()},u)),r.dispatch("reset",null),null===(a=e.inputElement)||void 0===a||a.focus()}},i(e,["inputElement"]))},getLabelProps:function(e){return o({htmlFor:"".concat(t.id,"-input"),id:"".concat(t.id,"-label")},e)},getInputProps:function(e){function a(e){(t.openOnFocus||Boolean(r.getState().query))&&b(o({event:e,props:t,query:r.getState().completion||r.getState().query,refresh:n,store:r},u)),r.dispatch("focus",null)}var c="ontouchstart"in t.environment,l=e||{},s=(l.inputElement,l.maxLength),f=void 0===s?512:s,p=i(l,["inputElement","maxLength"]),v=m(r.getState());return o({"aria-autocomplete":"both","aria-activedescendant":r.getState().isOpen&&null!==r.getState().activeItemId?"".concat(t.id,"-item-").concat(r.getState().activeItemId):void 0,"aria-controls":r.getState().isOpen?"".concat(t.id,"-list"):void 0,"aria-labelledby":"".concat(t.id,"-label"),value:r.getState().completion||r.getState().query,id:"".concat(t.id,"-input"),autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",enterKeyHint:null!=v&&v.itemUrl?"go":"search",spellCheck:"false",autoFocus:t.autoFocus,placeholder:t.placeholder,maxLength:f,type:"search",onChange:function(e){b(o({event:e,props:t,query:e.currentTarget.value.slice(0,f),refresh:n,store:r},u))},onKeyDown:function(e){!function(e){var t=e.event,n=e.props,r=e.refresh,u=e.store,a=i(e,["event","props","refresh","store"]);if("ArrowUp"===t.key||"ArrowDown"===t.key){t.preventDefault(),u.dispatch(t.key,null);var c=n.environment.document.getElementById("".concat(n.id,"-item-").concat(u.getState().activeItemId));c&&(c.scrollIntoViewIfNeeded?c.scrollIntoViewIfNeeded(!1):c.scrollIntoView(!1));var l=m(u.getState());if(null!==u.getState().activeItemId&&l){var s=l.item,f=l.itemInputValue,p=l.itemUrl,v=l.source;v.onActive(o({event:t,item:s,itemInputValue:f,itemUrl:p,refresh:r,source:v,state:u.getState()},a))}}else if("Escape"===t.key)t.preventDefault(),u.dispatch(t.key,null);else if("Enter"===t.key){if(null===u.getState().activeItemId||u.getState().collections.every((function(e){return 0===e.items.length})))return;t.preventDefault();var d=m(u.getState()),g=d.item,h=d.itemInputValue,I=d.itemUrl,y=d.source;if(t.metaKey||t.ctrlKey)void 0!==I&&(y.onSelect(o({event:t,item:g,itemInputValue:h,itemUrl:I,refresh:r,source:y,state:u.getState()},a)),n.navigator.navigateNewTab({itemUrl:I,item:g,state:u.getState()}));else if(t.shiftKey)void 0!==I&&(y.onSelect(o({event:t,item:g,itemInputValue:h,itemUrl:I,refresh:r,source:y,state:u.getState()},a)),n.navigator.navigateNewWindow({itemUrl:I,item:g,state:u.getState()}));else if(t.altKey);else{if(void 0!==I)return y.onSelect(o({event:t,item:g,itemInputValue:h,itemUrl:I,refresh:r,source:y,state:u.getState()},a)),void n.navigator.navigate({itemUrl:I,item:g,state:u.getState()});b(o({event:t,nextState:{isOpen:!1},props:n,query:h,refresh:r,store:u},a)).then((function(){y.onSelect(o({event:t,item:g,itemInputValue:h,itemUrl:I,refresh:r,source:y,state:u.getState()},a))}))}}}(o({event:e,props:t,refresh:n,store:r},u))},onFocus:a,onBlur:function(){c||r.dispatch("blur",null)},onClick:function(n){e.inputElement!==t.environment.document.activeElement||r.getState().isOpen||a(n)}},p)},getPanelProps:function(e){return o({onMouseDown:function(e){e.preventDefault()},onMouseLeave:function(){r.dispatch("mouseleave",null)}},e)},getListProps:function(e){return o({role:"listbox","aria-labelledby":"".concat(t.id,"-label"),id:"".concat(t.id,"-list")},e)},getItemProps:function(e){var a=e.item,c=e.source,l=i(e,["item","source"]);return o({id:"".concat(t.id,"-item-").concat(a.__autocomplete_id),role:"option","aria-selected":r.getState().activeItemId===a.__autocomplete_id,onMouseMove:function(e){if(a.__autocomplete_id!==r.getState().activeItemId){r.dispatch("mousemove",a.__autocomplete_id);var t=m(r.getState());if(null!==r.getState().activeItemId&&t){var i=t.item,c=t.itemInputValue,l=t.itemUrl,s=t.source;s.onActive(o({event:e,item:i,itemInputValue:c,itemUrl:l,refresh:n,source:s,state:r.getState()},u))}}},onMouseDown:function(e){e.preventDefault()},onClick:function(e){var i=c.getItemInputValue({item:a,state:r.getState()}),l=c.getItemUrl({item:a,state:r.getState()});(l?Promise.resolve():b(o({event:e,nextState:{isOpen:!1},props:t,query:i,refresh:n,store:r},u))).then((function(){c.onSelect(o({event:e,item:a,itemInputValue:i,itemUrl:l,refresh:n,source:c,state:r.getState()},u))}))}},l)}}}function w(e){var t=e.state;return!1===t.isOpen||null===t.activeItemId?null:m(t).itemInputValue||null}var A=function(e,t){switch(t.type){case"setActiveItemId":return o(o({},e),{},{activeItemId:t.payload});case"setQuery":return o(o({},e),{},{query:t.payload,completion:null});case"setCollections":return o(o({},e),{},{collections:t.payload});case"setIsOpen":return o(o({},e),{},{isOpen:t.payload});case"setStatus":return o(o({},e),{},{status:t.payload});case"setContext":return o(o({},e),{},{context:o(o({},e.context),t.payload)});case"ArrowDown":var n=o(o({},e),{},{activeItemId:f(1,e.activeItemId,l(e),t.props.defaultActiveItemId)});return o(o({},n),{},{completion:w({state:n})});case"ArrowUp":var r=o(o({},e),{},{activeItemId:f(-1,e.activeItemId,l(e),t.props.defaultActiveItemId)});return o(o({},r),{},{completion:w({state:r})});case"Escape":return e.isOpen?o(o({},e),{},{isOpen:!1,completion:null}):o(o({},e),{},{query:"",status:"idle",collections:[]});case"submit":return o(o({},e),{},{activeItemId:null,isOpen:!1,status:"idle"});case"reset":return o(o({},e),{},{activeItemId:!0===t.props.openOnFocus?t.props.defaultActiveItemId:null,status:"idle",query:""});case"focus":return o(o({},e),{},{activeItemId:t.props.defaultActiveItemId,isOpen:(t.props.openOnFocus||Boolean(e.query))&&t.props.shouldPanelOpen({state:e})});case"blur":return t.props.debug?e:o(o({},e),{},{isOpen:!1,activeItemId:null});case"mousemove":return o(o({},e),{},{activeItemId:t.payload});case"mouseleave":return o(o({},e),{},{activeItemId:t.props.defaultActiveItemId});default:return"The reducer action ".concat(JSON.stringify(t.type)," is not supported."),e}};e.createAutocomplete=function(e){var t=[],n=d(e,t),r=function(e,t,n){var r=t.initialState;return{getState:function(){return r},dispatch:function(i,u){var a=o({},r);r=e(r,{type:i,props:t,payload:u}),n({state:r,prevState:a})}}}(A,n,(function(e){var t=e.prevState,r=e.state;n.onStateChange(o({prevState:t,state:r,refresh:a},i))})),i=function(e){var t=e.store;return{setActiveItemId:function(e){t.dispatch("setActiveItemId",e)},setQuery:function(e){t.dispatch("setQuery",e)},setCollections:function(e){var n=0,r=e.map((function(e){return o(o({},e),{},{items:s(e.items).map((function(e){return o(o({},e),{},{__autocomplete_id:n++})}))})}));t.dispatch("setCollections",r)},setIsOpen:function(e){t.dispatch("setIsOpen",e)},setStatus:function(e){t.dispatch("setStatus",e)},setContext:function(e){t.dispatch("setContext",e)}}}({store:r}),u=O(o({props:n,refresh:a,store:r},i));function a(){return b(o({event:new Event("input"),nextState:{isOpen:r.getState().isOpen},props:n,query:r.getState().query,refresh:a,store:r},i))}return n.plugins.forEach((function(e){var n;return null===(n=e.subscribe)||void 0===n?void 0:n.call(e,o(o({},i),{},{refresh:a,onSelect:function(e){t.push({onSelect:e})},onActive:function(e){t.push({onActive:e})}}))})),o(o({refresh:a},u),i)},e.getDefaultProps=d,e.version="1.0.0-alpha.48",Object.defineProperty(e,"__esModule",{value:!0})}));
/*! @algolia/autocomplete-core 1.0.0-alpha.49 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/autocomplete */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@algolia/autocomplete-core"]={})}(this,(function(e){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?r(Object(o),!0).forEach((function(t){n(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function u(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return a(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var c=0;function l(e){return 0===e.collections.length?0:e.collections.reduce((function(e,t){return e+t.items.length}),0)}function s(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function f(e,t,n,r){if(e<0&&(null===t||null!==r&&0===t))return n+e;var o=(null===t?-1:t)+e;return o<=-1||o>=n?null===r?null:0:o}var p=function(){};function m(e){var t=function(e){var t=e.collections.map((function(e){return e.items.length})).reduce((function(e,t,n){var r=(e[n-1]||0)+t;return e.push(r),e}),[]).reduce((function(t,n){return n<=e.activeItemId?t+1:t}),0);return e.collections[t]}(e);if(!t)return null;var n=t.items[function(e){for(var t=e.state,n=e.collection,r=!1,o=0,i=0;!1===r;){var u=t.collections[o];if(u===n){r=!0;break}i+=u.items.length,o++}return t.activeItemId-i}({state:e,collection:t})],r=t.source;return{item:n,itemInputValue:r.getItemInputValue({item:n,state:e}),itemUrl:r.getItemUrl({item:n,state:e}),source:r}}function v(e,t){return e===t||e.contains(t)}function d(e,n){var r,i="undefined"!=typeof window?window:{},a=e.plugins||[];return o(o({debug:!1,openOnFocus:!1,placeholder:"",autoFocus:!1,defaultActiveItemId:null,stallThreshold:300,environment:i,shouldPanelOpen:function(e){return l(e.state)>0}},e),{},{id:null!==(r=e.id)&&void 0!==r?r:"autocomplete-".concat(c++),plugins:a,initialState:o({activeItemId:null,query:"",completion:null,collections:[],isOpen:!1,status:"idle",context:{}},e.initialState),onStateChange:function(t){var n;null===(n=e.onStateChange)||void 0===n||n.call(e,t),a.forEach((function(e){var n;return null===(n=e.onStateChange)||void 0===n?void 0:n.call(e,t)}))},onSubmit:function(t){var n;null===(n=e.onSubmit)||void 0===n||n.call(e,t),a.forEach((function(e){var n;return null===(n=e.onSubmit)||void 0===n?void 0:n.call(e,t)}))},onReset:function(t){var n;null===(n=e.onReset)||void 0===n||n.call(e,t),a.forEach((function(e){var n;return null===(n=e.onReset)||void 0===n?void 0:n.call(e,t)}))},getSources:function(r){return Promise.all([].concat(u(a.map((function(e){return e.getSources}))),[e.getSources]).filter(Boolean).map((function(e){return function(e,n){var r=[];return Promise.resolve(e(n)).then((function(e){return Array.isArray(e),"The `getSources` function must return an array of sources but returned type ".concat(JSON.stringify(t(e)),":\n\n").concat(JSON.stringify(e,null,2)),Promise.all(e.filter((function(e){return Boolean(e)})).map((function(e){if(e.sourceId,r.includes(e.sourceId))throw new Error("[Autocomplete] The `sourceId` ".concat(JSON.stringify(e.sourceId)," is not unique."));r.push(e.sourceId);var t=o({getItemInputValue:function(e){return e.state.query},getItemUrl:function(){},onSelect:function(e){(0,e.setIsOpen)(!1)},onActive:p},e);return Promise.resolve(t)})))}))}(e,r)}))).then((function(e){return s(e)})).then((function(e){return e.map((function(e){return o(o({},e),{},{onSelect:function(t){e.onSelect(t),n.forEach((function(e){var n;return null===(n=e.onSelect)||void 0===n?void 0:n.call(e,t)}))},onActive:function(t){e.onActive(t),n.forEach((function(e){var n;return null===(n=e.onActive)||void 0===n?void 0:n.call(e,t)}))}})}))}))},navigator:o({navigate:function(e){var t=e.itemUrl;i.location.assign(t)},navigateNewTab:function(e){var t=e.itemUrl,n=i.open(t,"_blank","noopener");null==n||n.focus()},navigateNewWindow:function(e){var t=e.itemUrl;i.open(t,"_blank","noopener")}},e.navigator)})}function g(e){return Boolean(e.execute)}function h(e,t){return Boolean(e.execute)?o(o({},e),{},{requests:e.queries.map((function(n){return{query:n,sourceId:t,transformResponse:e.transformResponse}}))}):{items:e,sourceId:t}}function I(e){var t=e.reduce((function(e,t){if(!g(t))return e.push(t),e;var n=t.searchClient,r=t.execute,o=t.requests,i=e.find((function(e){return g(t)&&g(e)&&e.searchClient===n&&e.execute===r}));if(i){var a;(a=i.items).push.apply(a,u(o))}else{var c={execute:r,items:o,searchClient:n};e.push(c)}return e}),[]).map((function(e){if(!g(e))return Promise.resolve(e);var t=e,n=t.execute,r=t.items;return n({searchClient:t.searchClient,requests:r})}));return Promise.all(t).then((function(e){return s(e)}))}function y(e,n){return n.map((function(n){var r=e.filter((function(e){return e.sourceId===n.sourceId})),i=r.map((function(e){return e.items})),u=r[0].transformResponse,a=u?u(function(e){var t=e.map((function(e){var t;return o(o({},e),{},{hits:null===(t=e.hits)||void 0===t?void 0:t.map((function(t){return o(o({},t),{},{__autocomplete_indexName:e.index,__autocomplete_queryID:e.queryID})}))})}));return{results:t,hits:t.map((function(e){return e.hits})).filter(Boolean),facetHits:t.map((function(e){var t;return null===(t=e.facetHits)||void 0===t?void 0:t.map((function(e){return{label:e.value,count:e.count,_highlightResult:{label:{value:e.highlighted}}}}))})).filter(Boolean)}}(i)):i;return Array.isArray(a),"The `getItems` function must return an array of items but returned type ".concat(JSON.stringify(t(a)),":\n\n").concat(JSON.stringify(a,null,2)),{source:n,items:a}}))}var S=null;function b(e){var t=e.event,n=e.nextState,r=void 0===n?{}:n,u=e.props,a=e.query,c=e.refresh,l=e.store,s=i(e,["event","nextState","props","query","refresh","store"]);S&&u.environment.clearTimeout(S);var f,p=s.setCollections,v=s.setIsOpen,d=s.setQuery,g=s.setActiveItemId,b=s.setStatus;return d(a),g(u.defaultActiveItemId),a||!1!==u.openOnFocus?(b("loading"),S=u.environment.setTimeout((function(){b("stalled")}),u.stallThreshold),u.getSources(o({query:a,refresh:c,state:l.getState()},s)).then((function(e){return b("loading"),Promise.all(e.map((function(e){return Promise.resolve(e.getItems(o({query:a,refresh:c,state:l.getState()},s))).then((function(t){return h(t,e.sourceId)}))}))).then(I).then((function(t){return y(t,e)})).then((function(e){var n;b("idle"),p(e);var i=u.shouldPanelOpen({state:l.getState()});v(null!==(n=r.isOpen)&&void 0!==n?n:u.openOnFocus&&!a&&i||i);var f=m(l.getState());if(null!==l.getState().activeItemId&&f){var d=f.item,g=f.itemInputValue,h=f.itemUrl,I=f.source;I.onActive(o({event:t,item:d,itemInputValue:g,itemUrl:h,refresh:c,source:I,state:l.getState()},s))}})).finally((function(){S&&u.environment.clearTimeout(S)}))}))):(b("idle"),p(l.getState().collections.map((function(e){return o(o({},e),{},{items:[]})}))),v(null!==(f=r.isOpen)&&void 0!==f?f:u.shouldPanelOpen({state:l.getState()})),Promise.resolve())}function O(e){var t=e.props,n=e.refresh,r=e.store,u=i(e,["props","refresh","store"]);return{getEnvironmentProps:function(e){var n=e.inputElement,u=e.formElement,a=e.panelElement;return o({onTouchStart:function(e){!1!==r.getState().isOpen&&e.target!==n&&(!1===[u,a].some((function(n){return v(n,e.target)||v(n,t.environment.document.activeElement)}))&&r.dispatch("blur",null))},onTouchMove:function(e){!1!==r.getState().isOpen&&n===t.environment.document.activeElement&&e.target!==n&&n.blur()}},i(e,["inputElement","formElement","panelElement"]))},getRootProps:function(e){return o({role:"combobox","aria-expanded":r.getState().isOpen,"aria-haspopup":"listbox","aria-owns":r.getState().isOpen?"".concat(t.id,"-list"):void 0,"aria-labelledby":"".concat(t.id,"-label")},e)},getFormProps:function(e){e.inputElement;return o({action:"",noValidate:!0,role:"search",onSubmit:function(i){var a;i.preventDefault(),t.onSubmit(o({event:i,refresh:n,state:r.getState()},u)),r.dispatch("submit",null),null===(a=e.inputElement)||void 0===a||a.blur()},onReset:function(i){var a;i.preventDefault(),t.onReset(o({event:i,refresh:n,state:r.getState()},u)),r.dispatch("reset",null),null===(a=e.inputElement)||void 0===a||a.focus()}},i(e,["inputElement"]))},getLabelProps:function(e){return o({htmlFor:"".concat(t.id,"-input"),id:"".concat(t.id,"-label")},e)},getInputProps:function(e){function a(e){(t.openOnFocus||Boolean(r.getState().query))&&b(o({event:e,props:t,query:r.getState().completion||r.getState().query,refresh:n,store:r},u)),r.dispatch("focus",null)}var c="ontouchstart"in t.environment,l=e||{},s=(l.inputElement,l.maxLength),f=void 0===s?512:s,p=i(l,["inputElement","maxLength"]),v=m(r.getState());return o({"aria-autocomplete":"both","aria-activedescendant":r.getState().isOpen&&null!==r.getState().activeItemId?"".concat(t.id,"-item-").concat(r.getState().activeItemId):void 0,"aria-controls":r.getState().isOpen?"".concat(t.id,"-list"):void 0,"aria-labelledby":"".concat(t.id,"-label"),value:r.getState().completion||r.getState().query,id:"".concat(t.id,"-input"),autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",enterKeyHint:null!=v&&v.itemUrl?"go":"search",spellCheck:"false",autoFocus:t.autoFocus,placeholder:t.placeholder,maxLength:f,type:"search",onChange:function(e){b(o({event:e,props:t,query:e.currentTarget.value.slice(0,f),refresh:n,store:r},u))},onKeyDown:function(e){!function(e){var t=e.event,n=e.props,r=e.refresh,u=e.store,a=i(e,["event","props","refresh","store"]);if("ArrowUp"===t.key||"ArrowDown"===t.key){t.preventDefault(),u.dispatch(t.key,null);var c=n.environment.document.getElementById("".concat(n.id,"-item-").concat(u.getState().activeItemId));c&&(c.scrollIntoViewIfNeeded?c.scrollIntoViewIfNeeded(!1):c.scrollIntoView(!1));var l=m(u.getState());if(null!==u.getState().activeItemId&&l){var s=l.item,f=l.itemInputValue,p=l.itemUrl,v=l.source;v.onActive(o({event:t,item:s,itemInputValue:f,itemUrl:p,refresh:r,source:v,state:u.getState()},a))}}else if("Escape"===t.key)t.preventDefault(),u.dispatch(t.key,null);else if("Enter"===t.key){if(null===u.getState().activeItemId||u.getState().collections.every((function(e){return 0===e.items.length})))return;t.preventDefault();var d=m(u.getState()),g=d.item,h=d.itemInputValue,I=d.itemUrl,y=d.source;if(t.metaKey||t.ctrlKey)void 0!==I&&(y.onSelect(o({event:t,item:g,itemInputValue:h,itemUrl:I,refresh:r,source:y,state:u.getState()},a)),n.navigator.navigateNewTab({itemUrl:I,item:g,state:u.getState()}));else if(t.shiftKey)void 0!==I&&(y.onSelect(o({event:t,item:g,itemInputValue:h,itemUrl:I,refresh:r,source:y,state:u.getState()},a)),n.navigator.navigateNewWindow({itemUrl:I,item:g,state:u.getState()}));else if(t.altKey);else{if(void 0!==I)return y.onSelect(o({event:t,item:g,itemInputValue:h,itemUrl:I,refresh:r,source:y,state:u.getState()},a)),void n.navigator.navigate({itemUrl:I,item:g,state:u.getState()});b(o({event:t,nextState:{isOpen:!1},props:n,query:h,refresh:r,store:u},a)).then((function(){y.onSelect(o({event:t,item:g,itemInputValue:h,itemUrl:I,refresh:r,source:y,state:u.getState()},a))}))}}}(o({event:e,props:t,refresh:n,store:r},u))},onFocus:a,onBlur:function(){c||r.dispatch("blur",null)},onClick:function(n){e.inputElement!==t.environment.document.activeElement||r.getState().isOpen||a(n)}},p)},getPanelProps:function(e){return o({onMouseDown:function(e){e.preventDefault()},onMouseLeave:function(){r.dispatch("mouseleave",null)}},e)},getListProps:function(e){return o({role:"listbox","aria-labelledby":"".concat(t.id,"-label"),id:"".concat(t.id,"-list")},e)},getItemProps:function(e){var a=e.item,c=e.source,l=i(e,["item","source"]);return o({id:"".concat(t.id,"-item-").concat(a.__autocomplete_id),role:"option","aria-selected":r.getState().activeItemId===a.__autocomplete_id,onMouseMove:function(e){if(a.__autocomplete_id!==r.getState().activeItemId){r.dispatch("mousemove",a.__autocomplete_id);var t=m(r.getState());if(null!==r.getState().activeItemId&&t){var i=t.item,c=t.itemInputValue,l=t.itemUrl,s=t.source;s.onActive(o({event:e,item:i,itemInputValue:c,itemUrl:l,refresh:n,source:s,state:r.getState()},u))}}},onMouseDown:function(e){e.preventDefault()},onClick:function(e){var i=c.getItemInputValue({item:a,state:r.getState()}),l=c.getItemUrl({item:a,state:r.getState()});(l?Promise.resolve():b(o({event:e,nextState:{isOpen:!1},props:t,query:i,refresh:n,store:r},u))).then((function(){c.onSelect(o({event:e,item:a,itemInputValue:i,itemUrl:l,refresh:n,source:c,state:r.getState()},u))}))}},l)}}}function w(e){var t=e.state;return!1===t.isOpen||null===t.activeItemId?null:m(t).itemInputValue||null}var A=function(e,t){switch(t.type){case"setActiveItemId":return o(o({},e),{},{activeItemId:t.payload});case"setQuery":return o(o({},e),{},{query:t.payload,completion:null});case"setCollections":return o(o({},e),{},{collections:t.payload});case"setIsOpen":return o(o({},e),{},{isOpen:t.payload});case"setStatus":return o(o({},e),{},{status:t.payload});case"setContext":return o(o({},e),{},{context:o(o({},e.context),t.payload)});case"ArrowDown":var n=o(o({},e),{},{activeItemId:f(1,e.activeItemId,l(e),t.props.defaultActiveItemId)});return o(o({},n),{},{completion:w({state:n})});case"ArrowUp":var r=o(o({},e),{},{activeItemId:f(-1,e.activeItemId,l(e),t.props.defaultActiveItemId)});return o(o({},r),{},{completion:w({state:r})});case"Escape":return e.isOpen?o(o({},e),{},{isOpen:!1,completion:null}):o(o({},e),{},{query:"",status:"idle",collections:[]});case"submit":return o(o({},e),{},{activeItemId:null,isOpen:!1,status:"idle"});case"reset":return o(o({},e),{},{activeItemId:!0===t.props.openOnFocus?t.props.defaultActiveItemId:null,status:"idle",query:""});case"focus":return o(o({},e),{},{activeItemId:t.props.defaultActiveItemId,isOpen:(t.props.openOnFocus||Boolean(e.query))&&t.props.shouldPanelOpen({state:e})});case"blur":return t.props.debug?e:o(o({},e),{},{isOpen:!1,activeItemId:null});case"mousemove":return o(o({},e),{},{activeItemId:t.payload});case"mouseleave":return o(o({},e),{},{activeItemId:t.props.defaultActiveItemId});default:return"The reducer action ".concat(JSON.stringify(t.type)," is not supported."),e}};e.createAutocomplete=function(e){var t=[],n=d(e,t),r=function(e,t,n){var r=t.initialState;return{getState:function(){return r},dispatch:function(i,u){var a=o({},r);r=e(r,{type:i,props:t,payload:u}),n({state:r,prevState:a})}}}(A,n,(function(e){var t=e.prevState,r=e.state;n.onStateChange(o({prevState:t,state:r,refresh:a},i))})),i=function(e){var t=e.store;return{setActiveItemId:function(e){t.dispatch("setActiveItemId",e)},setQuery:function(e){t.dispatch("setQuery",e)},setCollections:function(e){var n=0,r=e.map((function(e){return o(o({},e),{},{items:s(e.items).map((function(e){return o(o({},e),{},{__autocomplete_id:n++})}))})}));t.dispatch("setCollections",r)},setIsOpen:function(e){t.dispatch("setIsOpen",e)},setStatus:function(e){t.dispatch("setStatus",e)},setContext:function(e){t.dispatch("setContext",e)}}}({store:r}),u=O(o({props:n,refresh:a,store:r},i));function a(){return b(o({event:new Event("input"),nextState:{isOpen:r.getState().isOpen},props:n,query:r.getState().query,refresh:a,store:r},i))}return n.plugins.forEach((function(e){var n;return null===(n=e.subscribe)||void 0===n?void 0:n.call(e,o(o({},i),{},{refresh:a,onSelect:function(e){t.push({onSelect:e})},onActive:function(e){t.push({onActive:e})}}))})),o(o({refresh:a},u),i)},e.getDefaultProps=d,e.version="1.0.0-alpha.49",Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=index.production.js.map
{
"name": "@algolia/autocomplete-core",
"description": "Core primitives for building autocomplete experiences.",
"version": "1.0.0-alpha.48",
"version": "1.0.0-alpha.49",
"license": "MIT",

@@ -34,6 +34,6 @@ "homepage": "https://github.com/algolia/autocomplete",

"dependencies": {
"@algolia/autocomplete-shared": "1.0.0-alpha.48"
"@algolia/autocomplete-shared": "1.0.0-alpha.49"
},
"devDependencies": {
"@algolia/autocomplete-preset-algolia": "1.0.0-alpha.48",
"@algolia/autocomplete-preset-algolia": "1.0.0-alpha.49",
"@algolia/client-search": "4.9.1",

@@ -40,0 +40,0 @@ "algoliasearch": "4.9.1"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc