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.45 to 1.0.0-alpha.46

dist/esm/resolve.d.ts

2

dist/esm/getAutocompleteSetters.js

@@ -23,3 +23,3 @@ 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; }

return _objectSpread(_objectSpread({}, collection), {}, {
// We flatten the stored items to support calling `getAlgoliaHits`
// We flatten the stored items to support calling `getAlgoliaResults`
// from the source itself.

@@ -26,0 +26,0 @@ items: flatten(collection.items).map(function (item) {

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

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
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; }

@@ -13,3 +11,3 @@

import { invariant } from '@algolia/autocomplete-shared';
import { preResolve, resolve, postResolve } from './resolve';
import { getActiveItem } from './utils';

@@ -63,4 +61,3 @@ var lastStalledId = null;

}, setters)).then(function (sources) {
setStatus('loading'); // @TODO: convert `Promise.all` to fetching strategy.
setStatus('loading');
return Promise.all(sources.map(function (source) {

@@ -71,10 +68,8 @@ return Promise.resolve(source.getItems(_objectSpread({

state: store.getState()
}, setters))).then(function (items) {
invariant(Array.isArray(items), "The `getItems` function must return an array of items but returned type ".concat(JSON.stringify(_typeof(items)), ":\n\n").concat(JSON.stringify(items, null, 2)));
return {
source: source,
items: items
};
}, setters))).then(function (itemsOrDescription) {
return preResolve(itemsOrDescription, source.sourceId);
});
})).then(function (collections) {
})).then(resolve).then(function (responses) {
return postResolve(responses, sources);
}).then(function (collections) {
var _nextState$isOpen2;

@@ -81,0 +76,0 @@

@@ -151,3 +151,3 @@ import { MaybePromise } from '@algolia/autocomplete-shared';

*/
plugins?: Array<AutocompletePlugin<TItem, unknown>>;
plugins?: Array<AutocompletePlugin<any, any>>;
}

@@ -167,3 +167,3 @@ export interface InternalAutocompleteOptions<TItem extends BaseItem> extends AutocompleteOptions<TItem> {

navigator: AutocompleteNavigator<TItem>;
plugins: Array<AutocompletePlugin<TItem, unknown>>;
plugins: Array<AutocompletePlugin<any, any>>;
shouldPanelOpen(params: {

@@ -170,0 +170,0 @@ state: AutocompleteState<TItem>;

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

}
export declare type AutocompletePlugin<TItem extends BaseItem, TData = unknown> = Partial<Pick<AutocompleteOptions<TItem>, 'onStateChange' | 'onSubmit' | 'onReset' | 'getSources'>> & {
export declare type AutocompletePlugin<TItem extends BaseItem, TData = unknown> = Partial<Pick<AutocompleteOptions<any>, 'onStateChange' | 'onSubmit' | 'onReset'> & Pick<AutocompleteOptions<TItem>, 'getSources'>> & {
/**

@@ -16,3 +16,3 @@ * The function called when Autocomplete starts.

*/
subscribe?(params: PluginSubscribeParams<TItem>): void;
subscribe?(params: PluginSubscribeParams<any>): void;
/**

@@ -19,0 +19,0 @@ * An extra plugin object to expose properties and functions as APIs.

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

import { MaybePromise } from '@algolia/autocomplete-shared';
import type { RequesterDescription } from '@algolia/autocomplete-preset-algolia';
import type { MaybePromise } from '@algolia/autocomplete-shared';
import { AutocompleteScopeApi, BaseItem } from './AutocompleteApi';

@@ -42,3 +43,3 @@ import { GetSourcesParams } from './AutocompleteOptions';

*/
getItems(params: GetSourcesParams<TItem>): MaybePromise<TItem[] | TItem[][]>;
getItems(params: GetSourcesParams<TItem>): MaybePromise<TItem[] | TItem[][] | RequesterDescription<TItem>>;
/**

@@ -45,0 +46,0 @@ * The function called whenever an item is selected.

@@ -12,2 +12,3 @@ 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; }

export function getNormalizedSources(getSources, params) {
var seenSourceIds = [];
return Promise.resolve(getSources(params)).then(function (sources) {

@@ -23,2 +24,8 @@ invariant(Array.isArray(sources), "The `getSources` function must return an array of sources but returned type ".concat(JSON.stringify(_typeof(sources)), ":\n\n").concat(JSON.stringify(sources, null, 2)));

if (seenSourceIds.includes(source.sourceId)) {
throw new Error("[Autocomplete] The `sourceId` ".concat(JSON.stringify(source.sourceId), " is not unique."));
}
seenSourceIds.push(source.sourceId);
var normalizedSource = _objectSpread({

@@ -25,0 +32,0 @@ getItemInputValue: function getItemInputValue(_ref) {

@@ -7,2 +7,3 @@ export * from './createConcurrentSafePromise';

export * from './isOrContainsNode';
export * from './mapToAlgoliaResponse';
export * from './noop';

@@ -7,2 +7,3 @@ export * from './createConcurrentSafePromise';

export * from './isOrContainsNode';
export * from './mapToAlgoliaResponse';
export * from './noop';

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

export declare const version = "1.0.0-alpha.45";
export declare const version = "1.0.0-alpha.46";

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

export var version = '1.0.0-alpha.45';
export var version = '1.0.0-alpha.46';

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

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

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

function getNormalizedSources(getSources, params) {
var seenSourceIds = [];
return Promise.resolve(getSources(params)).then(function (sources) {

@@ -269,2 +270,8 @@ invariant(Array.isArray(sources), "The `getSources` function must return an array of sources but returned type ".concat(JSON.stringify(_typeof(sources)), ":\n\n").concat(JSON.stringify(sources, null, 2)));

if (seenSourceIds.includes(source.sourceId)) {
throw new Error("[Autocomplete] The `sourceId` ".concat(JSON.stringify(source.sourceId), " is not unique."));
}
seenSourceIds.push(source.sourceId);
var normalizedSource = _objectSpread2({

@@ -380,2 +387,26 @@ getItemInputValue: function getItemInputValue(_ref) {

function mapToAlgoliaResponse(results) {
return {
results: results,
hits: results.map(function (result) {
return result.hits;
}).filter(Boolean),
facetHits: results.map(function (result) {
var _facetHits;
return (_facetHits = result.facetHits) === null || _facetHits === void 0 ? void 0 : _facetHits.map(function (facetHit) {
return {
label: facetHit.value,
count: facetHit.count,
_highlightResult: {
label: {
value: facetHit.highlighted
}
}
};
});
}).filter(Boolean)
};
}
function getAutocompleteSetters(_ref) {

@@ -396,3 +427,3 @@ var store = _ref.store;

return _objectSpread2(_objectSpread2({}, collection), {}, {
// We flatten the stored items to support calling `getAlgoliaHits`
// We flatten the stored items to support calling `getAlgoliaResults`
// from the source itself.

@@ -541,2 +572,94 @@ items: flatten(collection.items).map(function (item) {

function isDescription(item) {
return Boolean(item.execute);
}
function isRequesterDescription(description) {
return Boolean(description.execute);
}
function preResolve(itemsOrDescription, sourceId) {
if (isRequesterDescription(itemsOrDescription)) {
return _objectSpread2(_objectSpread2({}, itemsOrDescription), {}, {
requests: itemsOrDescription.queries.map(function (query) {
return {
query: query,
sourceId: sourceId,
transformResponse: itemsOrDescription.transformResponse
};
})
});
}
return {
items: itemsOrDescription,
sourceId: sourceId
};
}
function resolve(items) {
var packed = items.reduce(function (acc, current) {
if (!isDescription(current)) {
acc.push(current);
return acc;
}
var searchClient = current.searchClient,
execute = current.execute,
requests = current.requests;
var container = acc.find(function (item) {
return isDescription(current) && isDescription(item) && item.searchClient === searchClient && item.execute === execute;
});
if (container) {
var _container$items;
(_container$items = container.items).push.apply(_container$items, _toConsumableArray(requests));
} else {
var request = {
execute: execute,
items: requests,
searchClient: searchClient
};
acc.push(request);
}
return acc;
}, []);
var values = packed.map(function (maybeDescription) {
if (!isDescription(maybeDescription)) {
return Promise.resolve(maybeDescription);
}
var _ref = maybeDescription,
execute = _ref.execute,
items = _ref.items,
searchClient = _ref.searchClient;
return execute({
searchClient: searchClient,
requests: items
});
});
return Promise.all(values).then(function (responses) {
return flatten(responses);
});
}
function postResolve(responses, sources) {
return sources.map(function (source) {
var matches = responses.filter(function (response) {
return response.sourceId === source.sourceId;
});
var results = matches.map(function (_ref2) {
var items = _ref2.items;
return items;
});
var transform = matches[0].transformResponse;
var items = transform ? transform(mapToAlgoliaResponse(results)) : results;
invariant(Array.isArray(items), "The `getItems` function must return an array of items but returned type ".concat(JSON.stringify(_typeof(items)), ":\n\n").concat(JSON.stringify(items, null, 2)));
return {
source: source,
items: items
};
});
}
var lastStalledId = null;

@@ -589,4 +712,3 @@ function onInput(_ref) {

}, setters)).then(function (sources) {
setStatus('loading'); // @TODO: convert `Promise.all` to fetching strategy.
setStatus('loading');
return Promise.all(sources.map(function (source) {

@@ -597,10 +719,8 @@ return Promise.resolve(source.getItems(_objectSpread2({

state: store.getState()
}, setters))).then(function (items) {
invariant(Array.isArray(items), "The `getItems` function must return an array of items but returned type ".concat(JSON.stringify(_typeof(items)), ":\n\n").concat(JSON.stringify(items, null, 2)));
return {
source: source,
items: items
};
}, setters))).then(function (itemsOrDescription) {
return preResolve(itemsOrDescription, source.sourceId);
});
})).then(function (collections) {
})).then(resolve).then(function (responses) {
return postResolve(responses, sources);
}).then(function (collections) {
var _nextState$isOpen2;

@@ -1299,3 +1419,3 @@

var version = '1.0.0-alpha.45';
var version = '1.0.0-alpha.46';

@@ -1302,0 +1422,0 @@ exports.createAutocomplete = createAutocomplete;

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

/*! @algolia/autocomplete-core 1.0.0-alpha.45 | 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 a(e){return function(e){if(Array.isArray(e))return u(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 u(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 u(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 u(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 p(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 f=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 a=t.collections[o];if(a===n){r=!0;break}i+=a.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:{},u=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:u,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),u.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),u.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),u.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(a(u.map((function(e){return e.getSources}))),[e.getSources]).filter(Boolean).map((function(e){return function(e,n){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){e.sourceId;var t=o({getItemInputValue:function(e){return e.state.query},getItemUrl:function(){},onSelect:function(e){(0,e.setIsOpen)(!1)},onActive:f},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)})}var g=null;function y(e){var n=e.event,r=e.nextState,a=void 0===r?{}:r,u=e.props,c=e.query,l=e.refresh,s=e.store,p=i(e,["event","nextState","props","query","refresh","store"]);g&&u.environment.clearTimeout(g);var f,v=p.setCollections,d=p.setIsOpen,y=p.setQuery,h=p.setActiveItemId,I=p.setStatus;return y(c),h(u.defaultActiveItemId),c||!1!==u.openOnFocus?(I("loading"),g=u.environment.setTimeout((function(){I("stalled")}),u.stallThreshold),u.getSources(o({query:c,refresh:l,state:s.getState()},p)).then((function(e){return I("loading"),Promise.all(e.map((function(e){return Promise.resolve(e.getItems(o({query:c,refresh:l,state:s.getState()},p))).then((function(n){return Array.isArray(n),"The `getItems` function must return an array of items but returned type ".concat(JSON.stringify(t(n)),":\n\n").concat(JSON.stringify(n,null,2)),{source:e,items:n}}))}))).then((function(e){var t;I("idle"),v(e);var r=u.shouldPanelOpen({state:s.getState()});d(null!==(t=a.isOpen)&&void 0!==t?t:u.openOnFocus&&!c&&r||r);var i=m(s.getState());if(null!==s.getState().activeItemId&&i){var f=i.item,g=i.itemInputValue,y=i.itemUrl,h=i.source;h.onActive(o({event:n,item:f,itemInputValue:g,itemUrl:y,refresh:l,source:h,state:s.getState()},p))}})).finally((function(){g&&u.environment.clearTimeout(g)}))}))):(I("idle"),v(s.getState().collections.map((function(e){return o(o({},e),{},{items:[]})}))),d(null!==(f=a.isOpen)&&void 0!==f?f:u.shouldPanelOpen({state:s.getState()})),Promise.resolve())}function h(e){var t=e.props,n=e.refresh,r=e.store,a=i(e,["props","refresh","store"]);return{getEnvironmentProps:function(e){var n=e.inputElement,a=e.formElement,u=e.panelElement;return o({onTouchStart:function(e){!1!==r.getState().isOpen&&e.target!==n&&(!1===[a,u].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 u;i.preventDefault(),t.onSubmit(o({event:i,refresh:n,state:r.getState()},a)),r.dispatch("submit",null),null===(u=e.inputElement)||void 0===u||u.blur()},onReset:function(i){var u;i.preventDefault(),t.onReset(o({event:i,refresh:n,state:r.getState()},a)),r.dispatch("reset",null),null===(u=e.inputElement)||void 0===u||u.focus()}},i(e,["inputElement"]))},getLabelProps:function(e){return o({htmlFor:"".concat(t.id,"-input"),id:"".concat(t.id,"-label")},e)},getInputProps:function(e){function u(e){(t.openOnFocus||Boolean(r.getState().query))&&y(o({event:e,props:t,query:r.getState().completion||r.getState().query,refresh:n,store:r},a)),r.dispatch("focus",null)}var c="ontouchstart"in t.environment,l=e||{},s=(l.inputElement,l.maxLength),p=void 0===s?512:s,f=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:p,type:"search",onChange:function(e){y(o({event:e,props:t,query:e.currentTarget.value.slice(0,p),refresh:n,store:r},a))},onKeyDown:function(e){!function(e){var t=e.event,n=e.props,r=e.refresh,a=e.store,u=i(e,["event","props","refresh","store"]);if("ArrowUp"===t.key||"ArrowDown"===t.key){t.preventDefault(),a.dispatch(t.key,null);var c=n.environment.document.getElementById("".concat(n.id,"-item-").concat(a.getState().activeItemId));c&&(c.scrollIntoViewIfNeeded?c.scrollIntoViewIfNeeded(!1):c.scrollIntoView(!1));var l=m(a.getState());if(null!==a.getState().activeItemId&&l){var s=l.item,p=l.itemInputValue,f=l.itemUrl,v=l.source;v.onActive(o({event:t,item:s,itemInputValue:p,itemUrl:f,refresh:r,source:v,state:a.getState()},u))}}else if("Escape"===t.key)t.preventDefault(),a.dispatch(t.key,null);else if("Enter"===t.key){if(null===a.getState().activeItemId||a.getState().collections.every((function(e){return 0===e.items.length})))return;t.preventDefault();var d=m(a.getState()),g=d.item,h=d.itemInputValue,I=d.itemUrl,S=d.source;if(t.metaKey||t.ctrlKey)void 0!==I&&(S.onSelect(o({event:t,item:g,itemInputValue:h,itemUrl:I,refresh:r,source:S,state:a.getState()},u)),n.navigator.navigateNewTab({itemUrl:I,item:g,state:a.getState()}));else if(t.shiftKey)void 0!==I&&(S.onSelect(o({event:t,item:g,itemInputValue:h,itemUrl:I,refresh:r,source:S,state:a.getState()},u)),n.navigator.navigateNewWindow({itemUrl:I,item:g,state:a.getState()}));else if(t.altKey);else{if(void 0!==I)return S.onSelect(o({event:t,item:g,itemInputValue:h,itemUrl:I,refresh:r,source:S,state:a.getState()},u)),void n.navigator.navigate({itemUrl:I,item:g,state:a.getState()});y(o({event:t,nextState:{isOpen:!1},props:n,query:h,refresh:r,store:a},u)).then((function(){S.onSelect(o({event:t,item:g,itemInputValue:h,itemUrl:I,refresh:r,source:S,state:a.getState()},u))}))}}}(o({event:e,props:t,refresh:n,store:r},a))},onFocus:u,onBlur:function(){c||r.dispatch("blur",null)},onClick:function(n){e.inputElement!==t.environment.document.activeElement||r.getState().isOpen||u(n)}},f)},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 u=e.item,c=e.source,l=i(e,["item","source"]);return o({id:"".concat(t.id,"-item-").concat(u.__autocomplete_id),role:"option","aria-selected":r.getState().activeItemId===u.__autocomplete_id,onMouseMove:function(e){if(u.__autocomplete_id!==r.getState().activeItemId){r.dispatch("mousemove",u.__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()},a))}}},onMouseDown:function(e){e.preventDefault()},onClick:function(e){var i=c.getItemInputValue({item:u,state:r.getState()}),l=c.getItemUrl({item:u,state:r.getState()});(l?Promise.resolve():y(o({event:e,nextState:{isOpen:!1},props:t,query:i,refresh:n,store:r},a))).then((function(){c.onSelect(o({event:e,item:u,itemInputValue:i,itemUrl:l,refresh:n,source:c,state:r.getState()},a))}))}},l)}}}function I(e){var t=e.state;return!1===t.isOpen||null===t.activeItemId?null:m(t).itemInputValue||null}var S=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:p(1,e.activeItemId,l(e),t.props.defaultActiveItemId)});return o(o({},n),{},{completion:I({state:n})});case"ArrowUp":var r=o(o({},e),{},{activeItemId:p(-1,e.activeItemId,l(e),t.props.defaultActiveItemId)});return o(o({},r),{},{completion:I({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,a){var u=o({},r);r=e(r,{type:i,props:t,payload:a}),n({state:r,prevState:u})}}}(S,n,(function(e){var t=e.prevState,r=e.state;n.onStateChange(o({prevState:t,state:r,refresh:u},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}),a=h(o({props:n,refresh:u,store:r},i));function u(){return y(o({event:new Event("input"),nextState:{isOpen:r.getState().isOpen},props:n,query:r.getState().query,refresh:u,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:u,onSelect:function(e){t.push({onSelect:e})},onActive:function(e){t.push({onActive:e})}}))})),o(o({refresh:u},a),i)},e.getDefaultProps=d,e.version="1.0.0-alpha.45",Object.defineProperty(e,"__esModule",{value:!0})}));
/*! @algolia/autocomplete-core 1.0.0-alpha.46 | 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.46",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.45",
"version": "1.0.0-alpha.46",
"license": "MIT",

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

"dependencies": {
"@algolia/autocomplete-shared": "1.0.0-alpha.45"
"@algolia/autocomplete-shared": "1.0.0-alpha.46"
},
"devDependencies": {
"@algolia/autocomplete-preset-algolia": "1.0.0-alpha.46",
"@algolia/client-search": "4.9.0",
"algoliasearch": "4.9.0"
}
}

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