Socket
Socket
Sign inDemoInstall

@meilisearch/instant-meilisearch

Package Overview
Dependencies
Maintainers
4
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@meilisearch/instant-meilisearch - npm Package Compare versions

Comparing version 0.4.1 to 0.4.2

8

dist/instant-meilisearch.cjs.js

@@ -160,6 +160,10 @@ 'use strict';

transformToMeiliSearchParams: function (_a) {
var query = _a.query, facets = _a.facets, facetFilters = _a.facetFilters, attributesToCrop = _a.attributesToSnippet, attributesToRetrieve = _a.attributesToRetrieve, attributesToHighlight = _a.attributesToHighlight, filters = _a.filters;
var query = _a.query, facets = _a.facets, facetFilters = _a.facetFilters, attributesToCrop = _a.attributesToSnippet, attributesToRetrieve = _a.attributesToRetrieve, attributesToHighlight = _a.attributesToHighlight, _b = _a.filters, filters = _b === void 0 ? '' : _b, _c = _a.numericFilters, numericFilters = _c === void 0 ? [] : _c;
var limit = this.paginationTotalHits;
var filter = [numericFilters.join(' AND '), filters.trim()]
.filter(function (x) { return x; })
.join(' AND ')
.trim();
// Creates search params object compliant with MeiliSearch
return __assign(__assign(__assign(__assign(__assign(__assign({ q: query }, ((facets === null || facets === void 0 ? void 0 : facets.length) && { facetsDistribution: facets })), (facetFilters && { facetFilters: facetFilters })), (attributesToCrop && { attributesToCrop: attributesToCrop })), (attributesToRetrieve && { attributesToRetrieve: attributesToRetrieve })), (filters && { filters: filters })), { attributesToHighlight: attributesToHighlight || ['*'], limit: (!this.placeholderSearch && query === '') || !limit ? 0 : limit });
return __assign(__assign(__assign(__assign(__assign(__assign({ q: query }, ((facets === null || facets === void 0 ? void 0 : facets.length) && { facetsDistribution: facets })), (facetFilters && { facetFilters: facetFilters })), (attributesToCrop && { attributesToCrop: attributesToCrop })), (attributesToRetrieve && { attributesToRetrieve: attributesToRetrieve })), (filter && { filters: filter })), { attributesToHighlight: attributesToHighlight || ['*'], limit: (!this.placeholderSearch && query === '') || !limit ? 0 : limit });
},

@@ -166,0 +170,0 @@ /*

@@ -15,3 +15,3 @@ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("meilisearch"),e=function(){return(e=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)};

PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */function r(t,e,r,i){return new(r||(r=Promise))((function(n,a){function s(t){try{u(i.next(t))}catch(t){a(t)}}function o(t){try{u(i.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,o)}u((i=i.apply(t,e||[])).next())}))}function i(t,e){var r,i,n,a,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return a={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function o(a){return function(o){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,i&&(n=2&a[0]?i.return:a[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,a[1])).done)return n;switch(i=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,i=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){s.label=a[1];break}if(6===a[0]&&s.label<n[1]){s.label=n[1],n=a;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(a);break}n[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],i=0}finally{r=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,o])}}}function n(t){return"string"==typeof t||t instanceof String}function a(t,e,r){return e=e||"__ais-highlight__",r=r||"__/ais-highlight__",n(t)?t.replace(/<em>/g,e).replace(/<\/em>/g,r):JSON.stringify(t)}function s(t){var e=t.formattedHit,r=t.highlightPreTag,i=t.highlightPostTag;return Object.keys(e).reduce((function(t,n){return t[n]={value:a(e[n],r,i)},t}),{})}function o(t,e,r,i){var s=t;return void 0!==e&&n(s)&&(s[0]===s[0].toLowerCase()&&!1===s.startsWith("<em>")&&(s=""+e+s),!1==!!s.match(/[.!?]$/)&&(s=""+s+e)),a(s,r,i)}function u(t){var e=t.formattedHit,r=t.attributesToSnippet,i=t.snippetEllipsisText,n=t.highlightPreTag,a=t.highlightPostTag;return void 0===r?null:(r=r.map((function(t){return t.split(":")[0]})),Object.keys(e).reduce((function(t,s){return r.includes(s)&&(t[s]={value:o(e[s],i,n,a)}),t}),{}))}exports.instantMeiliSearch=function(n,a,o){return void 0===o&&(o={}),{client:new t.MeiliSearch({host:n,apiKey:a}),paginationTotalHits:o.paginationTotalHits||200,primaryKey:o.primaryKey||void 0,placeholderSearch:!1!==o.placeholderSearch,hitsPerPage:20,page:0,transformToMeiliSearchParams:function(t){var r=t.query,i=t.facets,n=t.facetFilters,a=t.attributesToSnippet,s=t.attributesToRetrieve,o=t.attributesToHighlight,u=t.filters,c=this.paginationTotalHits;return e(e(e(e(e(e({q:r},(null==i?void 0:i.length)&&{facetsDistribution:i}),n&&{facetFilters:n}),a&&{attributesToCrop:a}),s&&{attributesToRetrieve:s}),u&&{filters:u}),{attributesToHighlight:o||["*"],limit:!this.placeholderSearch&&""===r||!c?0:c})},getNumberPages:function(t){var e=t%this.hitsPerPage==0?0:1;return Math.floor(t/this.hitsPerPage)+e},paginateHits:function(t){var e=this.page*this.hitsPerPage;return t.splice(e,this.hitsPerPage)},transformToISHits:function(t,r){var i=this;return this.paginateHits(t).map((function(t){var n=t._formatted,a=function(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]])}return r}(t,["_formatted"]);return e(e(e({},a),{_highlightResult:s(e({formattedHit:n},r)),_snippetResult:u(e({formattedHit:n},r))}),i.primaryKey&&{objectID:t[i.primaryKey]})}))},transformToISResponse:function(t,r,i){var n=r.exhaustiveFacetsCount,a=r.exhaustiveNbHits,s=r.facetsDistribution,o=r.nbHits,u=r.processingTimeMs,c=r.query,l=r.hits;return{results:[e(e(e({index:t,hitsPerPage:this.hitsPerPage},s&&{facets:s}),n&&{exhaustiveFacetsCount:n}),{page:this.page,nbPages:this.getNumberPages(l.length),exhaustiveNbHits:a,nbHits:o,processingTimeMS:u,query:c,hits:this.transformToISHits(l,i)})]}},search:function(t){var e=t[0];return r(this,void 0,void 0,(function(){var t,r,n,a,s,o,u;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),t=e.params,r=e.indexName,n=t.page,a=t.hitsPerPage,this.page=n||0,this.hitsPerPage=a||20,s=this.transformToMeiliSearchParams(t),[4,this.client.index(r).search(s.q,s)];case 1:return o=i.sent(),[2,this.transformToISResponse(r,o,t)];case 2:throw u=i.sent(),console.error(u),new Error(u);case 3:return[2]}}))}))}}};
***************************************************************************** */function r(t,e,r,i){return new(r||(r=Promise))((function(n,a){function o(t){try{u(i.next(t))}catch(t){a(t)}}function s(t){try{u(i.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,s)}u((i=i.apply(t,e||[])).next())}))}function i(t,e){var r,i,n,a,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,i&&(n=2&a[0]?i.return:a[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,a[1])).done)return n;switch(i=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,i=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(n=o.trys,(n=n.length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){o.label=a[1];break}if(6===a[0]&&o.label<n[1]){o.label=n[1],n=a;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(a);break}n[2]&&o.ops.pop(),o.trys.pop();continue}a=e.call(t,o)}catch(t){a=[6,t],i=0}finally{r=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}function n(t){return"string"==typeof t||t instanceof String}function a(t,e,r){return e=e||"__ais-highlight__",r=r||"__/ais-highlight__",n(t)?t.replace(/<em>/g,e).replace(/<\/em>/g,r):JSON.stringify(t)}function o(t){var e=t.formattedHit,r=t.highlightPreTag,i=t.highlightPostTag;return Object.keys(e).reduce((function(t,n){return t[n]={value:a(e[n],r,i)},t}),{})}function s(t,e,r,i){var o=t;return void 0!==e&&n(o)&&(o[0]===o[0].toLowerCase()&&!1===o.startsWith("<em>")&&(o=""+e+o),!1==!!o.match(/[.!?]$/)&&(o=""+o+e)),a(o,r,i)}function u(t){var e=t.formattedHit,r=t.attributesToSnippet,i=t.snippetEllipsisText,n=t.highlightPreTag,a=t.highlightPostTag;return void 0===r?null:(r=r.map((function(t){return t.split(":")[0]})),Object.keys(e).reduce((function(t,o){return r.includes(o)&&(t[o]={value:s(e[o],i,n,a)}),t}),{}))}exports.instantMeiliSearch=function(n,a,s){return void 0===s&&(s={}),{client:new t.MeiliSearch({host:n,apiKey:a}),paginationTotalHits:s.paginationTotalHits||200,primaryKey:s.primaryKey||void 0,placeholderSearch:!1!==s.placeholderSearch,hitsPerPage:20,page:0,transformToMeiliSearchParams:function(t){var r=t.query,i=t.facets,n=t.facetFilters,a=t.attributesToSnippet,o=t.attributesToRetrieve,s=t.attributesToHighlight,u=t.filters,c=void 0===u?"":u,l=t.numericFilters,h=void 0===l?[]:l,f=this.paginationTotalHits,p=[h.join(" AND "),c.trim()].filter((function(t){return t})).join(" AND ").trim();return e(e(e(e(e(e({q:r},(null==i?void 0:i.length)&&{facetsDistribution:i}),n&&{facetFilters:n}),a&&{attributesToCrop:a}),o&&{attributesToRetrieve:o}),p&&{filters:p}),{attributesToHighlight:s||["*"],limit:!this.placeholderSearch&&""===r||!f?0:f})},getNumberPages:function(t){var e=t%this.hitsPerPage==0?0:1;return Math.floor(t/this.hitsPerPage)+e},paginateHits:function(t){var e=this.page*this.hitsPerPage;return t.splice(e,this.hitsPerPage)},transformToISHits:function(t,r){var i=this;return this.paginateHits(t).map((function(t){var n=t._formatted,a=function(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]])}return r}(t,["_formatted"]);return e(e(e({},a),{_highlightResult:o(e({formattedHit:n},r)),_snippetResult:u(e({formattedHit:n},r))}),i.primaryKey&&{objectID:t[i.primaryKey]})}))},transformToISResponse:function(t,r,i){var n=r.exhaustiveFacetsCount,a=r.exhaustiveNbHits,o=r.facetsDistribution,s=r.nbHits,u=r.processingTimeMs,c=r.query,l=r.hits;return{results:[e(e(e({index:t,hitsPerPage:this.hitsPerPage},o&&{facets:o}),n&&{exhaustiveFacetsCount:n}),{page:this.page,nbPages:this.getNumberPages(l.length),exhaustiveNbHits:a,nbHits:s,processingTimeMS:u,query:c,hits:this.transformToISHits(l,i)})]}},search:function(t){var e=t[0];return r(this,void 0,void 0,(function(){var t,r,n,a,o,s,u;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),t=e.params,r=e.indexName,n=t.page,a=t.hitsPerPage,this.page=n||0,this.hitsPerPage=a||20,o=this.transformToMeiliSearchParams(t),[4,this.client.index(r).search(o.q,o)];case 1:return s=i.sent(),[2,this.transformToISResponse(r,s,t)];case 2:throw u=i.sent(),console.error(u),new Error(u);case 3:return[2]}}))}))}}};
//# sourceMappingURL=instant-meilisearch.cjs.min.js.map

@@ -156,6 +156,10 @@ import { MeiliSearch } from 'meilisearch';

transformToMeiliSearchParams: function (_a) {
var query = _a.query, facets = _a.facets, facetFilters = _a.facetFilters, attributesToCrop = _a.attributesToSnippet, attributesToRetrieve = _a.attributesToRetrieve, attributesToHighlight = _a.attributesToHighlight, filters = _a.filters;
var query = _a.query, facets = _a.facets, facetFilters = _a.facetFilters, attributesToCrop = _a.attributesToSnippet, attributesToRetrieve = _a.attributesToRetrieve, attributesToHighlight = _a.attributesToHighlight, _b = _a.filters, filters = _b === void 0 ? '' : _b, _c = _a.numericFilters, numericFilters = _c === void 0 ? [] : _c;
var limit = this.paginationTotalHits;
var filter = [numericFilters.join(' AND '), filters.trim()]
.filter(function (x) { return x; })
.join(' AND ')
.trim();
// Creates search params object compliant with MeiliSearch
return __assign(__assign(__assign(__assign(__assign(__assign({ q: query }, ((facets === null || facets === void 0 ? void 0 : facets.length) && { facetsDistribution: facets })), (facetFilters && { facetFilters: facetFilters })), (attributesToCrop && { attributesToCrop: attributesToCrop })), (attributesToRetrieve && { attributesToRetrieve: attributesToRetrieve })), (filters && { filters: filters })), { attributesToHighlight: attributesToHighlight || ['*'], limit: (!this.placeholderSearch && query === '') || !limit ? 0 : limit });
return __assign(__assign(__assign(__assign(__assign(__assign({ q: query }, ((facets === null || facets === void 0 ? void 0 : facets.length) && { facetsDistribution: facets })), (facetFilters && { facetFilters: facetFilters })), (attributesToCrop && { attributesToCrop: attributesToCrop })), (attributesToRetrieve && { attributesToRetrieve: attributesToRetrieve })), (filter && { filters: filter })), { attributesToHighlight: attributesToHighlight || ['*'], limit: (!this.placeholderSearch && query === '') || !limit ? 0 : limit });
},

@@ -162,0 +166,0 @@ /*

@@ -15,3 +15,3 @@ import{MeiliSearch as t}from"meilisearch";

PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var e=function(){return(e=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)};function r(t,e,r,i){return new(r||(r=Promise))((function(n,a){function o(t){try{u(i.next(t))}catch(t){a(t)}}function s(t){try{u(i.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,s)}u((i=i.apply(t,e||[])).next())}))}function i(t,e){var r,i,n,a,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,i&&(n=2&a[0]?i.return:a[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,a[1])).done)return n;switch(i=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,i=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(n=o.trys,(n=n.length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){o.label=a[1];break}if(6===a[0]&&o.label<n[1]){o.label=n[1],n=a;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(a);break}n[2]&&o.ops.pop(),o.trys.pop();continue}a=e.call(t,o)}catch(t){a=[6,t],i=0}finally{r=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}function n(t){return"string"==typeof t||t instanceof String}function a(t,e,r){return e=e||"__ais-highlight__",r=r||"__/ais-highlight__",n(t)?t.replace(/<em>/g,e).replace(/<\/em>/g,r):JSON.stringify(t)}function o(t){var e=t.formattedHit,r=t.highlightPreTag,i=t.highlightPostTag;return Object.keys(e).reduce((function(t,n){return t[n]={value:a(e[n],r,i)},t}),{})}function s(t,e,r,i){var o=t;return void 0!==e&&n(o)&&(o[0]===o[0].toLowerCase()&&!1===o.startsWith("<em>")&&(o=""+e+o),!1==!!o.match(/[.!?]$/)&&(o=""+o+e)),a(o,r,i)}function u(t){var e=t.formattedHit,r=t.attributesToSnippet,i=t.snippetEllipsisText,n=t.highlightPreTag,a=t.highlightPostTag;return void 0===r?null:(r=r.map((function(t){return t.split(":")[0]})),Object.keys(e).reduce((function(t,o){return r.includes(o)&&(t[o]={value:s(e[o],i,n,a)}),t}),{}))}function c(n,a,s){return void 0===s&&(s={}),{client:new t({host:n,apiKey:a}),paginationTotalHits:s.paginationTotalHits||200,primaryKey:s.primaryKey||void 0,placeholderSearch:!1!==s.placeholderSearch,hitsPerPage:20,page:0,transformToMeiliSearchParams:function(t){var r=t.query,i=t.facets,n=t.facetFilters,a=t.attributesToSnippet,o=t.attributesToRetrieve,s=t.attributesToHighlight,u=t.filters,c=this.paginationTotalHits;return e(e(e(e(e(e({q:r},(null==i?void 0:i.length)&&{facetsDistribution:i}),n&&{facetFilters:n}),a&&{attributesToCrop:a}),o&&{attributesToRetrieve:o}),u&&{filters:u}),{attributesToHighlight:s||["*"],limit:!this.placeholderSearch&&""===r||!c?0:c})},getNumberPages:function(t){var e=t%this.hitsPerPage==0?0:1;return Math.floor(t/this.hitsPerPage)+e},paginateHits:function(t){var e=this.page*this.hitsPerPage;return t.splice(e,this.hitsPerPage)},transformToISHits:function(t,r){var i=this;return this.paginateHits(t).map((function(t){var n=t._formatted,a=function(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]])}return r}(t,["_formatted"]);return e(e(e({},a),{_highlightResult:o(e({formattedHit:n},r)),_snippetResult:u(e({formattedHit:n},r))}),i.primaryKey&&{objectID:t[i.primaryKey]})}))},transformToISResponse:function(t,r,i){var n=r.exhaustiveFacetsCount,a=r.exhaustiveNbHits,o=r.facetsDistribution,s=r.nbHits,u=r.processingTimeMs,c=r.query,h=r.hits;return{results:[e(e(e({index:t,hitsPerPage:this.hitsPerPage},o&&{facets:o}),n&&{exhaustiveFacetsCount:n}),{page:this.page,nbPages:this.getNumberPages(h.length),exhaustiveNbHits:a,nbHits:s,processingTimeMS:u,query:c,hits:this.transformToISHits(h,i)})]}},search:function(t){var e=t[0];return r(this,void 0,void 0,(function(){var t,r,n,a,o,s,u;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),t=e.params,r=e.indexName,n=t.page,a=t.hitsPerPage,this.page=n||0,this.hitsPerPage=a||20,o=this.transformToMeiliSearchParams(t),[4,this.client.index(r).search(o.q,o)];case 1:return s=i.sent(),[2,this.transformToISResponse(r,s,t)];case 2:throw u=i.sent(),console.error(u),new Error(u);case 3:return[2]}}))}))}}}export{c as instantMeiliSearch};
***************************************************************************** */var e=function(){return(e=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)};function r(t,e,r,i){return new(r||(r=Promise))((function(n,a){function o(t){try{u(i.next(t))}catch(t){a(t)}}function s(t){try{u(i.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,s)}u((i=i.apply(t,e||[])).next())}))}function i(t,e){var r,i,n,a,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,i&&(n=2&a[0]?i.return:a[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,a[1])).done)return n;switch(i=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,i=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(n=o.trys,(n=n.length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){o.label=a[1];break}if(6===a[0]&&o.label<n[1]){o.label=n[1],n=a;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(a);break}n[2]&&o.ops.pop(),o.trys.pop();continue}a=e.call(t,o)}catch(t){a=[6,t],i=0}finally{r=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}function n(t){return"string"==typeof t||t instanceof String}function a(t,e,r){return e=e||"__ais-highlight__",r=r||"__/ais-highlight__",n(t)?t.replace(/<em>/g,e).replace(/<\/em>/g,r):JSON.stringify(t)}function o(t){var e=t.formattedHit,r=t.highlightPreTag,i=t.highlightPostTag;return Object.keys(e).reduce((function(t,n){return t[n]={value:a(e[n],r,i)},t}),{})}function s(t,e,r,i){var o=t;return void 0!==e&&n(o)&&(o[0]===o[0].toLowerCase()&&!1===o.startsWith("<em>")&&(o=""+e+o),!1==!!o.match(/[.!?]$/)&&(o=""+o+e)),a(o,r,i)}function u(t){var e=t.formattedHit,r=t.attributesToSnippet,i=t.snippetEllipsisText,n=t.highlightPreTag,a=t.highlightPostTag;return void 0===r?null:(r=r.map((function(t){return t.split(":")[0]})),Object.keys(e).reduce((function(t,o){return r.includes(o)&&(t[o]={value:s(e[o],i,n,a)}),t}),{}))}function c(n,a,s){return void 0===s&&(s={}),{client:new t({host:n,apiKey:a}),paginationTotalHits:s.paginationTotalHits||200,primaryKey:s.primaryKey||void 0,placeholderSearch:!1!==s.placeholderSearch,hitsPerPage:20,page:0,transformToMeiliSearchParams:function(t){var r=t.query,i=t.facets,n=t.facetFilters,a=t.attributesToSnippet,o=t.attributesToRetrieve,s=t.attributesToHighlight,u=t.filters,c=void 0===u?"":u,l=t.numericFilters,h=void 0===l?[]:l,f=this.paginationTotalHits,p=[h.join(" AND "),c.trim()].filter((function(t){return t})).join(" AND ").trim();return e(e(e(e(e(e({q:r},(null==i?void 0:i.length)&&{facetsDistribution:i}),n&&{facetFilters:n}),a&&{attributesToCrop:a}),o&&{attributesToRetrieve:o}),p&&{filters:p}),{attributesToHighlight:s||["*"],limit:!this.placeholderSearch&&""===r||!f?0:f})},getNumberPages:function(t){var e=t%this.hitsPerPage==0?0:1;return Math.floor(t/this.hitsPerPage)+e},paginateHits:function(t){var e=this.page*this.hitsPerPage;return t.splice(e,this.hitsPerPage)},transformToISHits:function(t,r){var i=this;return this.paginateHits(t).map((function(t){var n=t._formatted,a=function(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]])}return r}(t,["_formatted"]);return e(e(e({},a),{_highlightResult:o(e({formattedHit:n},r)),_snippetResult:u(e({formattedHit:n},r))}),i.primaryKey&&{objectID:t[i.primaryKey]})}))},transformToISResponse:function(t,r,i){var n=r.exhaustiveFacetsCount,a=r.exhaustiveNbHits,o=r.facetsDistribution,s=r.nbHits,u=r.processingTimeMs,c=r.query,l=r.hits;return{results:[e(e(e({index:t,hitsPerPage:this.hitsPerPage},o&&{facets:o}),n&&{exhaustiveFacetsCount:n}),{page:this.page,nbPages:this.getNumberPages(l.length),exhaustiveNbHits:a,nbHits:s,processingTimeMS:u,query:c,hits:this.transformToISHits(l,i)})]}},search:function(t){var e=t[0];return r(this,void 0,void 0,(function(){var t,r,n,a,o,s,u;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),t=e.params,r=e.indexName,n=t.page,a=t.hitsPerPage,this.page=n||0,this.hitsPerPage=a||20,o=this.transformToMeiliSearchParams(t),[4,this.client.index(r).search(o.q,o)];case 1:return s=i.sent(),[2,this.transformToISResponse(r,s,t)];case 2:throw u=i.sent(),console.error(u),new Error(u);case 3:return[2]}}))}))}}}export{c as instantMeiliSearch};
//# sourceMappingURL=instant-meilisearch.esm.min.js.map

@@ -15,3 +15,3 @@ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).window=t.window||{})}(this,(function(t){"use strict";

PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var e=function(){return(e=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function r(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{a(n.next(t))}catch(t){o(t)}}function u(t){try{a(n.throw(t))}catch(t){o(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,u)}a((n=n.apply(t,e||[])).next())}))}function n(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}}var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};!function(t){!function(e){var r="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,i="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in t,s="ArrayBuffer"in t;if(s)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],a=ArrayBuffer.isView||function(t){return t&&u.indexOf(Object.prototype.toString.call(t))>-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function h(t){return"string"!=typeof t&&(t=String(t)),t}function f(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function p(t){this.map={},t instanceof p?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function d(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function l(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function y(t){var e=new FileReader,r=l(e);return e.readAsArrayBuffer(t),r}function v(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s&&i&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=v(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||a(t))?this._bodyArrayBuffer=v(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=d(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?d(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var t,e,r,n=d(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=l(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then(w)}),this.json=function(){return this.text().then(JSON.parse)},this}p.prototype.append=function(t,e){t=c(t),e=h(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},p.prototype.delete=function(t){delete this.map[c(t)]},p.prototype.get=function(t){return t=c(t),this.has(t)?this.map[t]:null},p.prototype.has=function(t){return this.map.hasOwnProperty(c(t))},p.prototype.set=function(t,e){this.map[c(t)]=h(e)},p.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},p.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),f(t)},p.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),f(t)},p.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),f(t)},n&&(p.prototype[Symbol.iterator]=p.prototype.entries);var g=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function m(t,e){var r,n,i=(e=e||{}).body;if(t instanceof m){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new p(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new p(e.headers)),this.method=(r=e.method||this.method||"GET",n=r.toUpperCase(),g.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function w(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}})),e}function R(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new p(e.headers),this.url=e.url||"",this._initBody(t)}m.prototype.clone=function(){return new m(this,{body:this._bodyInit})},b.call(m.prototype),b.call(R.prototype),R.prototype.clone=function(){return new R(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},R.error=function(){var t=new R(null,{status:0,statusText:""});return t.type="error",t};var S=[301,302,303,307,308];R.redirect=function(t,e){if(-1===S.indexOf(e))throw new RangeError("Invalid status code");return new R(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function C(t,r){return new Promise((function(n,o){var s=new m(t,r);if(s.signal&&s.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function a(){u.abort()}u.onload=function(){var t,e,r={status:u.status,statusText:u.statusText,headers:(t=u.getAllResponseHeaders()||"",e=new p,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();e.append(n,i)}})),e)};r.url="responseURL"in u?u.responseURL:r.headers.get("X-Request-URL");var i="response"in u?u.response:u.responseText;n(new R(i,r))},u.onerror=function(){o(new TypeError("Network request failed"))},u.ontimeout=function(){o(new TypeError("Network request failed"))},u.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},u.open(s.method,s.url,!0),"include"===s.credentials?u.withCredentials=!0:"omit"===s.credentials&&(u.withCredentials=!1),"responseType"in u&&i&&(u.responseType="blob"),s.headers.forEach((function(t,e){u.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",a),u.onreadystatechange=function(){4===u.readyState&&s.signal.removeEventListener("abort",a)}),u.send(void 0===s._bodyInit?null:s._bodyInit)}))}C.polyfill=!0,t.fetch||(t.fetch=C,t.Headers=p,t.Request=m,t.Response=R),e.Headers=p,e.Request=m,e.Response=R,e.fetch=C}({})}("undefined"!=typeof self?self:i);var o=function(t){var e={exports:{}};return t(e,e.exports),e.exports}((function(t,e){!function(t){
***************************************************************************** */var e=function(){return(e=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function r(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{a(n.next(t))}catch(t){o(t)}}function u(t){try{a(n.throw(t))}catch(t){o(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,u)}a((n=n.apply(t,e||[])).next())}))}function n(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}}var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};!function(t){!function(e){var r="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,i="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in t,s="ArrayBuffer"in t;if(s)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],a=ArrayBuffer.isView||function(t){return t&&u.indexOf(Object.prototype.toString.call(t))>-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function h(t){return"string"!=typeof t&&(t=String(t)),t}function f(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function d(t){this.map={},t instanceof d?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function p(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function l(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function y(t){var e=new FileReader,r=l(e);return e.readAsArrayBuffer(t),r}function v(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s&&i&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=v(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||a(t))?this._bodyArrayBuffer=v(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=p(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?p(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var t,e,r,n=p(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=l(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then(w)}),this.json=function(){return this.text().then(JSON.parse)},this}d.prototype.append=function(t,e){t=c(t),e=h(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},d.prototype.delete=function(t){delete this.map[c(t)]},d.prototype.get=function(t){return t=c(t),this.has(t)?this.map[t]:null},d.prototype.has=function(t){return this.map.hasOwnProperty(c(t))},d.prototype.set=function(t,e){this.map[c(t)]=h(e)},d.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},d.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),f(t)},d.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),f(t)},d.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),f(t)},n&&(d.prototype[Symbol.iterator]=d.prototype.entries);var g=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function m(t,e){var r,n,i=(e=e||{}).body;if(t instanceof m){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new d(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new d(e.headers)),this.method=(r=e.method||this.method||"GET",n=r.toUpperCase(),g.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function w(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}})),e}function R(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new d(e.headers),this.url=e.url||"",this._initBody(t)}m.prototype.clone=function(){return new m(this,{body:this._bodyInit})},b.call(m.prototype),b.call(R.prototype),R.prototype.clone=function(){return new R(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},R.error=function(){var t=new R(null,{status:0,statusText:""});return t.type="error",t};var S=[301,302,303,307,308];R.redirect=function(t,e){if(-1===S.indexOf(e))throw new RangeError("Invalid status code");return new R(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function C(t,r){return new Promise((function(n,o){var s=new m(t,r);if(s.signal&&s.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function a(){u.abort()}u.onload=function(){var t,e,r={status:u.status,statusText:u.statusText,headers:(t=u.getAllResponseHeaders()||"",e=new d,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();e.append(n,i)}})),e)};r.url="responseURL"in u?u.responseURL:r.headers.get("X-Request-URL");var i="response"in u?u.response:u.responseText;n(new R(i,r))},u.onerror=function(){o(new TypeError("Network request failed"))},u.ontimeout=function(){o(new TypeError("Network request failed"))},u.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},u.open(s.method,s.url,!0),"include"===s.credentials?u.withCredentials=!0:"omit"===s.credentials&&(u.withCredentials=!1),"responseType"in u&&i&&(u.responseType="blob"),s.headers.forEach((function(t,e){u.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",a),u.onreadystatechange=function(){4===u.readyState&&s.signal.removeEventListener("abort",a)}),u.send(void 0===s._bodyInit?null:s._bodyInit)}))}C.polyfill=!0,t.fetch||(t.fetch=C,t.Headers=d,t.Request=m,t.Response=R),e.Headers=d,e.Request=m,e.Response=R,e.fetch=C}({})}("undefined"!=typeof self?self:i);var o=function(t){var e={exports:{}};return t(e,e.exports),e.exports}((function(t,e){!function(t){
/*! *****************************************************************************

@@ -29,3 +29,3 @@ Copyright (c) Microsoft Corporation.

***************************************************************************** */
var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,r)};function r(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var n=function(){return(n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function i(t,e,r,n){function i(t){return t instanceof r?t:new r((function(e){e(t)}))}return new(r||(r=Promise))((function(r,o){function s(t){try{a(n.next(t))}catch(t){o(t)}}function u(t){try{a(n.throw(t))}catch(t){o(t)}}function a(t){t.done?r(t.value):i(t.value).then(s,u)}a((n=n.apply(t,e||[])).next())}))}function o(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(t){return function(e){return a([t,e])}}function a(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}}var s=function(t){function e(r){var n=t.call(this,r)||this;return n.name="MeiliSearchError",n.type="MeiliSearchError",Error.captureStackTrace&&Error.captureStackTrace(n,e),n}return r(e,t),e}(Error),u=function(t){function e(r){var n=t.call(this,r)||this;return n.name="MeiliSearchTimeOutError",n.type=n.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(n,e),n}return r(e,t),e}(Error);function a(t){return Object.entries(t).reduce((function(t,e){var r=e[0],n=e[1];return void 0!==n&&(t[r]=n),t}),{})}function c(t){return i(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,new Promise((function(e){return setTimeout(e,t)}))];case 1:return[2,e.sent()]}}))}))}var h=function(t){function e(r,n){var i=t.call(this,r)||this;return i.name="MeiliSearchCommunicationError",i.type="MeiliSearchCommunicationError",n instanceof Response&&(i.message=n.statusText,i.statusCode=n.status),n instanceof Error&&(i.errno=n.errno,i.code=n.code),Error.captureStackTrace&&Error.captureStackTrace(i,e),i}return r(e,t),e}(Error),f=function(t){function e(e,r){var n=t.call(this,e.message)||this;return n.type="MeiliSearchApiError",n.name="MeiliSearchApiError",n.errorCode=e.errorCode,n.errorType=e.errorType,n.errorLink=e.errorLink,n.message=e.message,n.httpStatus=r,Error.captureStackTrace&&Error.captureStackTrace(n,f),n}return r(e,t),e}(Error);function p(t){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:if(t.ok)return[3,5];e=void 0,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,t.json()];case 2:return e=r.sent(),[3,4];case 3:throw r.sent(),new h(t.statusText,t);case 4:throw new f(e,t.status);case 5:return[2,t]}}))}))}function d(t){if("MeiliSearchApiError"!==t.type)throw new h(t.message,t);throw t}var l=function(){function t(t){this.headers=n(n(n({},t.headers||{}),{"Content-Type":"application/json"}),t.apiKey?{"X-Meili-API-Key":t.apiKey}:{}),this.url=new URL(t.host)}return t.addTrailingSlash=function(t){return t.endsWith("/")||(t+="/"),t},t.prototype.request=function(t){var e=t.method,r=t.url,s=t.params,u=t.body,a=t.config;return i(this,void 0,void 0,(function(){var t,i,c;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),t=new URL(r,this.url),s&&(i=new URLSearchParams,Object.keys(s).filter((function(t){return null!==s[t]})).map((function(t){return i.set(t,s[t])})),t.search=i.toString()),[4,fetch(t.toString(),n(n({},a),{method:e,body:u?JSON.stringify(u):void 0,headers:this.headers})).then((function(t){return p(t)}))];case 1:return[4,o.sent().text()];case 2:c=o.sent();try{return[2,JSON.parse(c)]}catch(t){return[2]}return[3,4];case 3:return d(o.sent()),[3,4];case 4:return[2]}}))}))},t.prototype.get=function(t,e,r){return i(this,void 0,void 0,(function(){return o(this,(function(n){switch(n.label){case 0:return[4,this.request({method:"GET",url:t,params:e,config:r})];case 1:return[2,n.sent()]}}))}))},t.prototype.post=function(t,e,r,n){return i(this,void 0,void 0,(function(){return o(this,(function(i){switch(i.label){case 0:return[4,this.request({method:"POST",url:t,body:e,params:r,config:n})];case 1:return[2,i.sent()]}}))}))},t.prototype.put=function(t,e,r,n){return i(this,void 0,void 0,(function(){return o(this,(function(i){switch(i.label){case 0:return[4,this.request({method:"PUT",url:t,body:e,params:r,config:n})];case 1:return[2,i.sent()]}}))}))},t.prototype.delete=function(t,e,r,n){return i(this,void 0,void 0,(function(){return o(this,(function(i){switch(i.label){case 0:return[4,this.request({method:"DELETE",url:t,body:e,params:r,config:n})];case 1:return[2,i.sent()]}}))}))},t}(),y=function(){function t(t,e,r){this.uid=e,this.primaryKey=r,this.httpRequest=new l(t)}return t.getApiRoutes=function(){return t.apiRoutes},t.getRouteConstructors=function(){return t.routeConstructors},t.prototype.getUpdateStatus=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.getUpdateStatus(this.uid,e),[4,this.httpRequest.get(r)];case 1:return[2,n.sent()]}}))}))},t.prototype.waitForPendingUpdate=function(t,e){var r=void 0===e?{}:e,n=r.timeOutMs,s=void 0===n?5e3:n,a=r.intervalMs,h=void 0===a?50:a;return i(this,void 0,void 0,(function(){var e,r;return o(this,(function(n){switch(n.label){case 0:e=Date.now(),n.label=1;case 1:return Date.now()-e<s?[4,this.getUpdateStatus(t)]:[3,4];case 2:return"enqueued"!==(r=n.sent()).status?[2,r]:[4,c(h)];case 3:return n.sent(),[3,1];case 4:throw new u("timeout of "+s+"ms has exceeded on process "+t+" when waiting for pending update to resolve.")}}))}))},t.prototype.getAllUpdateStatus=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getAllUpdateStatus(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.search=function(e,r,u,c){return void 0===u&&(u="POST"),i(this,void 0,void 0,(function(){var i,h,f;return o(this,(function(o){switch(o.label){case 0:return i=t.routeConstructors.search(this.uid),h={q:e,offset:null==r?void 0:r.offset,limit:null==r?void 0:r.limit,cropLength:null==r?void 0:r.cropLength,filters:null==r?void 0:r.filters,matches:null==r?void 0:r.matches,facetFilters:null==r?void 0:r.facetFilters,facetsDistribution:null==r?void 0:r.facetsDistribution,attributesToRetrieve:null==r?void 0:r.attributesToRetrieve,attributesToCrop:null==r?void 0:r.attributesToCrop,attributesToHighlight:null==r?void 0:r.attributesToHighlight},"POST"!==u.toUpperCase()?[3,2]:[4,this.httpRequest.post(i,a(h),void 0,c)];case 1:return[2,o.sent()];case 2:return"GET"!==u.toUpperCase()?[3,4]:(f=n(n({},h),{facetFilters:Array.isArray(null==r?void 0:r.facetFilters)&&(null==r?void 0:r.facetFilters)?JSON.stringify(r.facetFilters):void 0,facetsDistribution:(null==r?void 0:r.facetsDistribution)?JSON.stringify(r.facetsDistribution):void 0,attributesToRetrieve:(null==r?void 0:r.attributesToRetrieve)?r.attributesToRetrieve.join(","):void 0,attributesToCrop:(null==r?void 0:r.attributesToCrop)?r.attributesToCrop.join(","):void 0,attributesToHighlight:(null==r?void 0:r.attributesToHighlight)?r.attributesToHighlight.join(","):void 0}),[4,this.httpRequest.get(i,a(f),c)]);case 3:return[2,o.sent()];case 4:throw new s("method parameter should be either POST or GET")}}))}))},t.prototype.getRawInfo=function(){return i(this,void 0,void 0,(function(){var e,r;return o(this,(function(n){switch(n.label){case 0:return e=t.routeConstructors.indexRoute(this.uid),[4,this.httpRequest.get(e)];case 1:return r=n.sent(),this.primaryKey=r.primaryKey,[2,r]}}))}))},t.prototype.fetchInfo=function(){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.getRawInfo()];case 1:return t.sent(),[2,this]}}))}))},t.prototype.fetchPrimaryKey=function(){return i(this,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:return t=this,[4,this.getRawInfo()];case 1:return t.primaryKey=e.sent().primaryKey,[2,this.primaryKey]}}))}))},t.create=function(e,r,s){return void 0===s&&(s={}),i(this,void 0,void 0,(function(){var i,u;return o(this,(function(o){switch(o.label){case 0:return i=t.apiRoutes.indexes,[4,new l(e).post(i,n(n({},s),{uid:r}))];case 1:return u=o.sent(),[2,new t(e,r,u.primaryKey)]}}))}))},t.prototype.update=function(e){return i(this,void 0,void 0,(function(){var r,n;return o(this,(function(i){switch(i.label){case 0:return r=t.routeConstructors.update(this.uid),[4,this.httpRequest.put(r,e)];case 1:return n=i.sent(),this.primaryKey=n.primaryKey,[2,this]}}))}))},t.prototype.delete=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.delete(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getStats=function(){return i(this,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/stats",[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getDocuments=function(e){return i(this,void 0,void 0,(function(){var r,i;return o(this,(function(o){switch(o.label){case 0:return r=t.routeConstructors.getDocuments(this.uid),void 0!==e&&Array.isArray(e.attributesToRetrieve)&&(i=e.attributesToRetrieve.join(",")),[4,this.httpRequest.get(r,n(n({},e),void 0!==i?{attributesToRetrieve:i}:{}))];case 1:return[2,o.sent()]}}))}))},t.prototype.getDocument=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.getDocument(this.uid,e),[4,this.httpRequest.get(r)];case 1:return[2,n.sent()]}}))}))},t.prototype.addDocuments=function(e,r){return i(this,void 0,void 0,(function(){var n;return o(this,(function(i){switch(i.label){case 0:return n=t.routeConstructors.addDocuments(this.uid),[4,this.httpRequest.post(n,e,r)];case 1:return[2,i.sent()]}}))}))},t.prototype.updateDocuments=function(e,r){return i(this,void 0,void 0,(function(){var n;return o(this,(function(i){switch(i.label){case 0:return n=t.routeConstructors.updateDocuments(this.uid),[4,this.httpRequest.put(n,e,r)];case 1:return[2,i.sent()]}}))}))},t.prototype.deleteDocument=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.deleteDocument(this.uid,e),[4,this.httpRequest.delete(r)];case 1:return[2,n.sent()]}}))}))},t.prototype.deleteDocuments=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.deleteDocuments(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.deleteAllDocuments=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.deleteAllDocuments(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getSettings=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getSettings(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateSettings=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateSettings(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetSettings=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetSettings(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getSynonyms=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getSynonyms(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateSynonyms=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateSynonyms(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetSynonyms=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetSynonyms(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getStopWords=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getStopWords(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateStopWords=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateStopWords(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetStopWords=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetStopWords(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getRankingRules=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getRankingRules(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateRankingRules=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateRankingRules(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetRankingRules=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetRankingRules(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getDistinctAttribute=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getDistinctAttribute(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateDistinctAttribute=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateDistinctAttribute(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetDistinctAttribute=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetDistinctAttribute(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getAttributesForFaceting=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getAttributesForFaceting(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateAttributesForFaceting=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateAttributesForFaceting(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetAttributesForFaceting=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetAttributesForFaceting(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getSearchableAttributes=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getSearchableAttributes(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateSearchableAttributes=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateSearchableAttributes(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetSearchableAttributes=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetSearchableAttributes(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getDisplayedAttributes=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getDisplayedAttributes(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateDisplayedAttributes=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateDisplayedAttributes(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetDisplayedAttributes=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetDisplayedAttributes(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.apiRoutes={indexes:"indexes"},t.routeConstructors={indexRoute:function(e){return t.apiRoutes.indexes+"/"+e},getUpdateStatus:function(e,r){return t.routeConstructors.indexRoute(e)+"/updates/"+r},getAllUpdateStatus:function(e){return t.routeConstructors.indexRoute(e)+"/updates"},search:function(e){return t.routeConstructors.indexRoute(e)+"/search"},getRawInfo:function(t){return"indexes/"+t},update:function(e){return t.routeConstructors.indexRoute(e)},delete:function(e){return t.routeConstructors.indexRoute(e)},getStats:function(e){return t.routeConstructors.indexRoute(e)+"/stats"},getDocument:function(e,r){return t.routeConstructors.indexRoute(e)+"/documents/"+r},getDocuments:function(e){return t.routeConstructors.indexRoute(e)+"/documents"},addDocuments:function(e){return t.routeConstructors.getDocuments(e)},updateDocuments:function(e){return t.routeConstructors.getDocuments(e)},deleteAllDocuments:function(e){return t.routeConstructors.getDocuments(e)},deleteDocument:function(e,r){return t.routeConstructors.indexRoute(e)+"/documents/"+r},deleteDocuments:function(e){return t.routeConstructors.indexRoute(e)+"/documents/delete-batch"},getSettings:function(e){return t.routeConstructors.indexRoute(e)+"/settings"},updateSettings:function(e){return t.routeConstructors.getSettings(e)},resetSettings:function(e){return t.routeConstructors.getSettings(e)},getSynonyms:function(e){return t.routeConstructors.indexRoute(e)+"/settings/synonyms"},updateSynonyms:function(e){return t.routeConstructors.getSynonyms(e)},resetSynonyms:function(e){return t.routeConstructors.getSynonyms(e)},getStopWords:function(e){return t.routeConstructors.indexRoute(e)+"/settings/stop-words"},updateStopWords:function(e){return t.routeConstructors.getStopWords(e)},resetStopWords:function(e){return t.routeConstructors.getStopWords(e)},getRankingRules:function(e){return t.routeConstructors.indexRoute(e)+"/settings/ranking-rules"},updateRankingRules:function(e){return t.routeConstructors.getRankingRules(e)},resetRankingRules:function(e){return t.routeConstructors.getRankingRules(e)},getDistinctAttribute:function(e){return t.routeConstructors.indexRoute(e)+"/settings/distinct-attribute"},updateDistinctAttribute:function(e){return t.routeConstructors.getDistinctAttribute(e)},resetDistinctAttribute:function(e){return t.routeConstructors.getDistinctAttribute(e)},getAttributesForFaceting:function(e){return t.routeConstructors.indexRoute(e)+"/settings/attributes-for-faceting"},updateAttributesForFaceting:function(e){return t.routeConstructors.getAttributesForFaceting(e)},resetAttributesForFaceting:function(e){return t.routeConstructors.getAttributesForFaceting(e)},getSearchableAttributes:function(e){return t.routeConstructors.indexRoute(e)+"/settings/searchable-attributes"},updateSearchableAttributes:function(e){return t.routeConstructors.getSearchableAttributes(e)},resetSearchableAttributes:function(e){return t.routeConstructors.getSearchableAttributes(e)},getDisplayedAttributes:function(e){return t.routeConstructors.indexRoute(e)+"/settings/displayed-attributes"},updateDisplayedAttributes:function(e){return t.routeConstructors.getDisplayedAttributes(e)},resetDisplayedAttributes:function(e){return t.routeConstructors.getDisplayedAttributes(e)}},t}(),v=function(){function t(t){t.host=l.addTrailingSlash(t.host),this.config=t,this.httpRequest=new l(t)}return t.getApiRoutes=function(){return t.apiRoutes},t.getRouteConstructors=function(){return t.routeConstructors},t.prototype.index=function(t){return new y(this.config,t)},t.prototype.getIndex=function(t){return i(this,void 0,void 0,(function(){return o(this,(function(e){return[2,new y(this.config,t).fetchInfo()]}))}))},t.prototype.getOrCreateIndex=function(t,e){return void 0===e&&(e={}),i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getIndex(t)];case 1:return[2,n.sent()];case 2:if("index_not_found"===(r=n.sent()).errorCode)return[2,this.createIndex(t,e)];throw new f(r,r.status);case 3:return[2]}}))}))},t.prototype.listIndexes=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.apiRoutes.listIndexes,[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.createIndex=function(t,e){return void 0===e&&(e={}),i(this,void 0,void 0,(function(){return o(this,(function(r){switch(r.label){case 0:return[4,y.create(this.config,t,e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateIndex=function(t,e){return void 0===e&&(e={}),i(this,void 0,void 0,(function(){return o(this,(function(r){return[2,new y(this.config,t).update(e)]}))}))},t.prototype.deleteIndex=function(t){return i(this,void 0,void 0,(function(){return o(this,(function(e){return[2,new y(this.config,t).delete()]}))}))},t.prototype.getKeys=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.apiRoutes.getKeys,[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.isHealthy=function(){return i(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,this.httpRequest.get(t.apiRoutes.isHealthy).then((function(){return!0}))];case 1:return[2,e.sent()]}}))}))},t.prototype.stats=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.apiRoutes.stats,[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.version=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.apiRoutes.version,[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.createDump=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.apiRoutes.createDump,[4,this.httpRequest.post(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getDumpStatus=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.getDumpStatus(e),[4,this.httpRequest.get(r)];case 1:return[2,n.sent()]}}))}))},t.apiRoutes={listIndexes:"indexes",getKeys:"keys",isHealthy:"health",stats:"stats",version:"version",createDump:"dumps"},t.routeConstructors={getDumpStatus:function(t){return"dumps/"+t+"/status"}},t}();t.MeiliSearch=v,Object.defineProperty(t,"__esModule",{value:!0})}(e)}));function s(t){return"string"==typeof t||t instanceof String}function u(t,e,r){return e=e||"__ais-highlight__",r=r||"__/ais-highlight__",s(t)?t.replace(/<em>/g,e).replace(/<\/em>/g,r):JSON.stringify(t)}function a(t){var e=t.formattedHit,r=t.highlightPreTag,n=t.highlightPostTag;return Object.keys(e).reduce((function(t,i){return t[i]={value:u(e[i],r,n)},t}),{})}function c(t,e,r,n){var i=t;return void 0!==e&&s(i)&&(i[0]===i[0].toLowerCase()&&!1===i.startsWith("<em>")&&(i=""+e+i),!1==!!i.match(/[.!?]$/)&&(i=""+i+e)),u(i,r,n)}function h(t){var e=t.formattedHit,r=t.attributesToSnippet,n=t.snippetEllipsisText,i=t.highlightPreTag,o=t.highlightPostTag;return void 0===r?null:(r=r.map((function(t){return t.split(":")[0]})),Object.keys(e).reduce((function(t,s){return r.includes(s)&&(t[s]={value:c(e[s],n,i,o)}),t}),{}))}t.instantMeiliSearch=function(t,i,s){return void 0===s&&(s={}),{client:new o.MeiliSearch({host:t,apiKey:i}),paginationTotalHits:s.paginationTotalHits||200,primaryKey:s.primaryKey||void 0,placeholderSearch:!1!==s.placeholderSearch,hitsPerPage:20,page:0,transformToMeiliSearchParams:function(t){var r=t.query,n=t.facets,i=t.facetFilters,o=t.attributesToSnippet,s=t.attributesToRetrieve,u=t.attributesToHighlight,a=t.filters,c=this.paginationTotalHits;return e(e(e(e(e(e({q:r},(null==n?void 0:n.length)&&{facetsDistribution:n}),i&&{facetFilters:i}),o&&{attributesToCrop:o}),s&&{attributesToRetrieve:s}),a&&{filters:a}),{attributesToHighlight:u||["*"],limit:!this.placeholderSearch&&""===r||!c?0:c})},getNumberPages:function(t){var e=t%this.hitsPerPage==0?0:1;return Math.floor(t/this.hitsPerPage)+e},paginateHits:function(t){var e=this.page*this.hitsPerPage;return t.splice(e,this.hitsPerPage)},transformToISHits:function(t,r){var n=this;return this.paginateHits(t).map((function(t){var i=t._formatted,o=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]])}return r}(t,["_formatted"]);return e(e(e({},o),{_highlightResult:a(e({formattedHit:i},r)),_snippetResult:h(e({formattedHit:i},r))}),n.primaryKey&&{objectID:t[n.primaryKey]})}))},transformToISResponse:function(t,r,n){var i=r.exhaustiveFacetsCount,o=r.exhaustiveNbHits,s=r.facetsDistribution,u=r.nbHits,a=r.processingTimeMs,c=r.query,h=r.hits;return{results:[e(e(e({index:t,hitsPerPage:this.hitsPerPage},s&&{facets:s}),i&&{exhaustiveFacetsCount:i}),{page:this.page,nbPages:this.getNumberPages(h.length),exhaustiveNbHits:o,nbHits:u,processingTimeMS:a,query:c,hits:this.transformToISHits(h,n)})]}},search:function(t){var e=t[0];return r(this,void 0,void 0,(function(){var t,r,i,o,s,u,a;return n(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),t=e.params,r=e.indexName,i=t.page,o=t.hitsPerPage,this.page=i||0,this.hitsPerPage=o||20,s=this.transformToMeiliSearchParams(t),[4,this.client.index(r).search(s.q,s)];case 1:return u=n.sent(),[2,this.transformToISResponse(r,u,t)];case 2:throw a=n.sent(),console.error(a),new Error(a);case 3:return[2]}}))}))}}},Object.defineProperty(t,"__esModule",{value:!0})}));
var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,r)};function r(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var n=function(){return(n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function i(t,e,r,n){function i(t){return t instanceof r?t:new r((function(e){e(t)}))}return new(r||(r=Promise))((function(r,o){function s(t){try{a(n.next(t))}catch(t){o(t)}}function u(t){try{a(n.throw(t))}catch(t){o(t)}}function a(t){t.done?r(t.value):i(t.value).then(s,u)}a((n=n.apply(t,e||[])).next())}))}function o(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(t){return function(e){return a([t,e])}}function a(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}}var s=function(t){function e(r){var n=t.call(this,r)||this;return n.name="MeiliSearchError",n.type="MeiliSearchError",Error.captureStackTrace&&Error.captureStackTrace(n,e),n}return r(e,t),e}(Error),u=function(t){function e(r){var n=t.call(this,r)||this;return n.name="MeiliSearchTimeOutError",n.type=n.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(n,e),n}return r(e,t),e}(Error);function a(t){return Object.entries(t).reduce((function(t,e){var r=e[0],n=e[1];return void 0!==n&&(t[r]=n),t}),{})}function c(t){return i(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,new Promise((function(e){return setTimeout(e,t)}))];case 1:return[2,e.sent()]}}))}))}var h=function(t){function e(r,n){var i=t.call(this,r)||this;return i.name="MeiliSearchCommunicationError",i.type="MeiliSearchCommunicationError",n instanceof Response&&(i.message=n.statusText,i.statusCode=n.status),n instanceof Error&&(i.errno=n.errno,i.code=n.code),Error.captureStackTrace&&Error.captureStackTrace(i,e),i}return r(e,t),e}(Error),f=function(t){function e(e,r){var n=t.call(this,e.message)||this;return n.type="MeiliSearchApiError",n.name="MeiliSearchApiError",n.errorCode=e.errorCode,n.errorType=e.errorType,n.errorLink=e.errorLink,n.message=e.message,n.httpStatus=r,Error.captureStackTrace&&Error.captureStackTrace(n,f),n}return r(e,t),e}(Error);function d(t){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:if(t.ok)return[3,5];e=void 0,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,t.json()];case 2:return e=r.sent(),[3,4];case 3:throw r.sent(),new h(t.statusText,t);case 4:throw new f(e,t.status);case 5:return[2,t]}}))}))}function p(t){if("MeiliSearchApiError"!==t.type)throw new h(t.message,t);throw t}var l=function(){function t(t){this.headers=n(n(n({},t.headers||{}),{"Content-Type":"application/json"}),t.apiKey?{"X-Meili-API-Key":t.apiKey}:{}),this.url=new URL(t.host)}return t.addTrailingSlash=function(t){return t.endsWith("/")||(t+="/"),t},t.prototype.request=function(t){var e=t.method,r=t.url,s=t.params,u=t.body,a=t.config;return i(this,void 0,void 0,(function(){var t,i,c;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),t=new URL(r,this.url),s&&(i=new URLSearchParams,Object.keys(s).filter((function(t){return null!==s[t]})).map((function(t){return i.set(t,s[t])})),t.search=i.toString()),[4,fetch(t.toString(),n(n({},a),{method:e,body:u?JSON.stringify(u):void 0,headers:this.headers})).then((function(t){return d(t)}))];case 1:return[4,o.sent().text()];case 2:c=o.sent();try{return[2,JSON.parse(c)]}catch(t){return[2]}return[3,4];case 3:return p(o.sent()),[3,4];case 4:return[2]}}))}))},t.prototype.get=function(t,e,r){return i(this,void 0,void 0,(function(){return o(this,(function(n){switch(n.label){case 0:return[4,this.request({method:"GET",url:t,params:e,config:r})];case 1:return[2,n.sent()]}}))}))},t.prototype.post=function(t,e,r,n){return i(this,void 0,void 0,(function(){return o(this,(function(i){switch(i.label){case 0:return[4,this.request({method:"POST",url:t,body:e,params:r,config:n})];case 1:return[2,i.sent()]}}))}))},t.prototype.put=function(t,e,r,n){return i(this,void 0,void 0,(function(){return o(this,(function(i){switch(i.label){case 0:return[4,this.request({method:"PUT",url:t,body:e,params:r,config:n})];case 1:return[2,i.sent()]}}))}))},t.prototype.delete=function(t,e,r,n){return i(this,void 0,void 0,(function(){return o(this,(function(i){switch(i.label){case 0:return[4,this.request({method:"DELETE",url:t,body:e,params:r,config:n})];case 1:return[2,i.sent()]}}))}))},t}(),y=function(){function t(t,e,r){this.uid=e,this.primaryKey=r,this.httpRequest=new l(t)}return t.getApiRoutes=function(){return t.apiRoutes},t.getRouteConstructors=function(){return t.routeConstructors},t.prototype.getUpdateStatus=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.getUpdateStatus(this.uid,e),[4,this.httpRequest.get(r)];case 1:return[2,n.sent()]}}))}))},t.prototype.waitForPendingUpdate=function(t,e){var r=void 0===e?{}:e,n=r.timeOutMs,s=void 0===n?5e3:n,a=r.intervalMs,h=void 0===a?50:a;return i(this,void 0,void 0,(function(){var e,r;return o(this,(function(n){switch(n.label){case 0:e=Date.now(),n.label=1;case 1:return Date.now()-e<s?[4,this.getUpdateStatus(t)]:[3,4];case 2:return"enqueued"!==(r=n.sent()).status?[2,r]:[4,c(h)];case 3:return n.sent(),[3,1];case 4:throw new u("timeout of "+s+"ms has exceeded on process "+t+" when waiting for pending update to resolve.")}}))}))},t.prototype.getAllUpdateStatus=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getAllUpdateStatus(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.search=function(e,r,u,c){return void 0===u&&(u="POST"),i(this,void 0,void 0,(function(){var i,h,f;return o(this,(function(o){switch(o.label){case 0:return i=t.routeConstructors.search(this.uid),h={q:e,offset:null==r?void 0:r.offset,limit:null==r?void 0:r.limit,cropLength:null==r?void 0:r.cropLength,filters:null==r?void 0:r.filters,matches:null==r?void 0:r.matches,facetFilters:null==r?void 0:r.facetFilters,facetsDistribution:null==r?void 0:r.facetsDistribution,attributesToRetrieve:null==r?void 0:r.attributesToRetrieve,attributesToCrop:null==r?void 0:r.attributesToCrop,attributesToHighlight:null==r?void 0:r.attributesToHighlight},"POST"!==u.toUpperCase()?[3,2]:[4,this.httpRequest.post(i,a(h),void 0,c)];case 1:return[2,o.sent()];case 2:return"GET"!==u.toUpperCase()?[3,4]:(f=n(n({},h),{facetFilters:Array.isArray(null==r?void 0:r.facetFilters)&&(null==r?void 0:r.facetFilters)?JSON.stringify(r.facetFilters):void 0,facetsDistribution:(null==r?void 0:r.facetsDistribution)?JSON.stringify(r.facetsDistribution):void 0,attributesToRetrieve:(null==r?void 0:r.attributesToRetrieve)?r.attributesToRetrieve.join(","):void 0,attributesToCrop:(null==r?void 0:r.attributesToCrop)?r.attributesToCrop.join(","):void 0,attributesToHighlight:(null==r?void 0:r.attributesToHighlight)?r.attributesToHighlight.join(","):void 0}),[4,this.httpRequest.get(i,a(f),c)]);case 3:return[2,o.sent()];case 4:throw new s("method parameter should be either POST or GET")}}))}))},t.prototype.getRawInfo=function(){return i(this,void 0,void 0,(function(){var e,r;return o(this,(function(n){switch(n.label){case 0:return e=t.routeConstructors.indexRoute(this.uid),[4,this.httpRequest.get(e)];case 1:return r=n.sent(),this.primaryKey=r.primaryKey,[2,r]}}))}))},t.prototype.fetchInfo=function(){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.getRawInfo()];case 1:return t.sent(),[2,this]}}))}))},t.prototype.fetchPrimaryKey=function(){return i(this,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:return t=this,[4,this.getRawInfo()];case 1:return t.primaryKey=e.sent().primaryKey,[2,this.primaryKey]}}))}))},t.create=function(e,r,s){return void 0===s&&(s={}),i(this,void 0,void 0,(function(){var i,u;return o(this,(function(o){switch(o.label){case 0:return i=t.apiRoutes.indexes,[4,new l(e).post(i,n(n({},s),{uid:r}))];case 1:return u=o.sent(),[2,new t(e,r,u.primaryKey)]}}))}))},t.prototype.update=function(e){return i(this,void 0,void 0,(function(){var r,n;return o(this,(function(i){switch(i.label){case 0:return r=t.routeConstructors.update(this.uid),[4,this.httpRequest.put(r,e)];case 1:return n=i.sent(),this.primaryKey=n.primaryKey,[2,this]}}))}))},t.prototype.delete=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.delete(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getStats=function(){return i(this,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:return t="/indexes/"+this.uid+"/stats",[4,this.httpRequest.get(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getDocuments=function(e){return i(this,void 0,void 0,(function(){var r,i;return o(this,(function(o){switch(o.label){case 0:return r=t.routeConstructors.getDocuments(this.uid),void 0!==e&&Array.isArray(e.attributesToRetrieve)&&(i=e.attributesToRetrieve.join(",")),[4,this.httpRequest.get(r,n(n({},e),void 0!==i?{attributesToRetrieve:i}:{}))];case 1:return[2,o.sent()]}}))}))},t.prototype.getDocument=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.getDocument(this.uid,e),[4,this.httpRequest.get(r)];case 1:return[2,n.sent()]}}))}))},t.prototype.addDocuments=function(e,r){return i(this,void 0,void 0,(function(){var n;return o(this,(function(i){switch(i.label){case 0:return n=t.routeConstructors.addDocuments(this.uid),[4,this.httpRequest.post(n,e,r)];case 1:return[2,i.sent()]}}))}))},t.prototype.updateDocuments=function(e,r){return i(this,void 0,void 0,(function(){var n;return o(this,(function(i){switch(i.label){case 0:return n=t.routeConstructors.updateDocuments(this.uid),[4,this.httpRequest.put(n,e,r)];case 1:return[2,i.sent()]}}))}))},t.prototype.deleteDocument=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.deleteDocument(this.uid,e),[4,this.httpRequest.delete(r)];case 1:return[2,n.sent()]}}))}))},t.prototype.deleteDocuments=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.deleteDocuments(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.deleteAllDocuments=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.deleteAllDocuments(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getSettings=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getSettings(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateSettings=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateSettings(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetSettings=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetSettings(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getSynonyms=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getSynonyms(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateSynonyms=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateSynonyms(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetSynonyms=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetSynonyms(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getStopWords=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getStopWords(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateStopWords=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateStopWords(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetStopWords=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetStopWords(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getRankingRules=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getRankingRules(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateRankingRules=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateRankingRules(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetRankingRules=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetRankingRules(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getDistinctAttribute=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getDistinctAttribute(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateDistinctAttribute=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateDistinctAttribute(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetDistinctAttribute=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetDistinctAttribute(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getAttributesForFaceting=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getAttributesForFaceting(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateAttributesForFaceting=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateAttributesForFaceting(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetAttributesForFaceting=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetAttributesForFaceting(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getSearchableAttributes=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getSearchableAttributes(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateSearchableAttributes=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateSearchableAttributes(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetSearchableAttributes=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetSearchableAttributes(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getDisplayedAttributes=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.getDisplayedAttributes(this.uid),[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateDisplayedAttributes=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.updateDisplayedAttributes(this.uid),[4,this.httpRequest.post(r,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.resetDisplayedAttributes=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.routeConstructors.resetDisplayedAttributes(this.uid),[4,this.httpRequest.delete(e)];case 1:return[2,r.sent()]}}))}))},t.apiRoutes={indexes:"indexes"},t.routeConstructors={indexRoute:function(e){return t.apiRoutes.indexes+"/"+e},getUpdateStatus:function(e,r){return t.routeConstructors.indexRoute(e)+"/updates/"+r},getAllUpdateStatus:function(e){return t.routeConstructors.indexRoute(e)+"/updates"},search:function(e){return t.routeConstructors.indexRoute(e)+"/search"},getRawInfo:function(t){return"indexes/"+t},update:function(e){return t.routeConstructors.indexRoute(e)},delete:function(e){return t.routeConstructors.indexRoute(e)},getStats:function(e){return t.routeConstructors.indexRoute(e)+"/stats"},getDocument:function(e,r){return t.routeConstructors.indexRoute(e)+"/documents/"+r},getDocuments:function(e){return t.routeConstructors.indexRoute(e)+"/documents"},addDocuments:function(e){return t.routeConstructors.getDocuments(e)},updateDocuments:function(e){return t.routeConstructors.getDocuments(e)},deleteAllDocuments:function(e){return t.routeConstructors.getDocuments(e)},deleteDocument:function(e,r){return t.routeConstructors.indexRoute(e)+"/documents/"+r},deleteDocuments:function(e){return t.routeConstructors.indexRoute(e)+"/documents/delete-batch"},getSettings:function(e){return t.routeConstructors.indexRoute(e)+"/settings"},updateSettings:function(e){return t.routeConstructors.getSettings(e)},resetSettings:function(e){return t.routeConstructors.getSettings(e)},getSynonyms:function(e){return t.routeConstructors.indexRoute(e)+"/settings/synonyms"},updateSynonyms:function(e){return t.routeConstructors.getSynonyms(e)},resetSynonyms:function(e){return t.routeConstructors.getSynonyms(e)},getStopWords:function(e){return t.routeConstructors.indexRoute(e)+"/settings/stop-words"},updateStopWords:function(e){return t.routeConstructors.getStopWords(e)},resetStopWords:function(e){return t.routeConstructors.getStopWords(e)},getRankingRules:function(e){return t.routeConstructors.indexRoute(e)+"/settings/ranking-rules"},updateRankingRules:function(e){return t.routeConstructors.getRankingRules(e)},resetRankingRules:function(e){return t.routeConstructors.getRankingRules(e)},getDistinctAttribute:function(e){return t.routeConstructors.indexRoute(e)+"/settings/distinct-attribute"},updateDistinctAttribute:function(e){return t.routeConstructors.getDistinctAttribute(e)},resetDistinctAttribute:function(e){return t.routeConstructors.getDistinctAttribute(e)},getAttributesForFaceting:function(e){return t.routeConstructors.indexRoute(e)+"/settings/attributes-for-faceting"},updateAttributesForFaceting:function(e){return t.routeConstructors.getAttributesForFaceting(e)},resetAttributesForFaceting:function(e){return t.routeConstructors.getAttributesForFaceting(e)},getSearchableAttributes:function(e){return t.routeConstructors.indexRoute(e)+"/settings/searchable-attributes"},updateSearchableAttributes:function(e){return t.routeConstructors.getSearchableAttributes(e)},resetSearchableAttributes:function(e){return t.routeConstructors.getSearchableAttributes(e)},getDisplayedAttributes:function(e){return t.routeConstructors.indexRoute(e)+"/settings/displayed-attributes"},updateDisplayedAttributes:function(e){return t.routeConstructors.getDisplayedAttributes(e)},resetDisplayedAttributes:function(e){return t.routeConstructors.getDisplayedAttributes(e)}},t}(),v=function(){function t(t){t.host=l.addTrailingSlash(t.host),this.config=t,this.httpRequest=new l(t)}return t.getApiRoutes=function(){return t.apiRoutes},t.getRouteConstructors=function(){return t.routeConstructors},t.prototype.index=function(t){return new y(this.config,t)},t.prototype.getIndex=function(t){return i(this,void 0,void 0,(function(){return o(this,(function(e){return[2,new y(this.config,t).fetchInfo()]}))}))},t.prototype.getOrCreateIndex=function(t,e){return void 0===e&&(e={}),i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getIndex(t)];case 1:return[2,n.sent()];case 2:if("index_not_found"===(r=n.sent()).errorCode)return[2,this.createIndex(t,e)];throw new f(r,r.status);case 3:return[2]}}))}))},t.prototype.listIndexes=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.apiRoutes.listIndexes,[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.createIndex=function(t,e){return void 0===e&&(e={}),i(this,void 0,void 0,(function(){return o(this,(function(r){switch(r.label){case 0:return[4,y.create(this.config,t,e)];case 1:return[2,r.sent()]}}))}))},t.prototype.updateIndex=function(t,e){return void 0===e&&(e={}),i(this,void 0,void 0,(function(){return o(this,(function(r){return[2,new y(this.config,t).update(e)]}))}))},t.prototype.deleteIndex=function(t){return i(this,void 0,void 0,(function(){return o(this,(function(e){return[2,new y(this.config,t).delete()]}))}))},t.prototype.getKeys=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.apiRoutes.getKeys,[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.isHealthy=function(){return i(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,this.httpRequest.get(t.apiRoutes.isHealthy).then((function(){return!0}))];case 1:return[2,e.sent()]}}))}))},t.prototype.stats=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.apiRoutes.stats,[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.version=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.apiRoutes.version,[4,this.httpRequest.get(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.createDump=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return e=t.apiRoutes.createDump,[4,this.httpRequest.post(e)];case 1:return[2,r.sent()]}}))}))},t.prototype.getDumpStatus=function(e){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=t.routeConstructors.getDumpStatus(e),[4,this.httpRequest.get(r)];case 1:return[2,n.sent()]}}))}))},t.apiRoutes={listIndexes:"indexes",getKeys:"keys",isHealthy:"health",stats:"stats",version:"version",createDump:"dumps"},t.routeConstructors={getDumpStatus:function(t){return"dumps/"+t+"/status"}},t}();t.MeiliSearch=v,Object.defineProperty(t,"__esModule",{value:!0})}(e)}));function s(t){return"string"==typeof t||t instanceof String}function u(t,e,r){return e=e||"__ais-highlight__",r=r||"__/ais-highlight__",s(t)?t.replace(/<em>/g,e).replace(/<\/em>/g,r):JSON.stringify(t)}function a(t){var e=t.formattedHit,r=t.highlightPreTag,n=t.highlightPostTag;return Object.keys(e).reduce((function(t,i){return t[i]={value:u(e[i],r,n)},t}),{})}function c(t,e,r,n){var i=t;return void 0!==e&&s(i)&&(i[0]===i[0].toLowerCase()&&!1===i.startsWith("<em>")&&(i=""+e+i),!1==!!i.match(/[.!?]$/)&&(i=""+i+e)),u(i,r,n)}function h(t){var e=t.formattedHit,r=t.attributesToSnippet,n=t.snippetEllipsisText,i=t.highlightPreTag,o=t.highlightPostTag;return void 0===r?null:(r=r.map((function(t){return t.split(":")[0]})),Object.keys(e).reduce((function(t,s){return r.includes(s)&&(t[s]={value:c(e[s],n,i,o)}),t}),{}))}t.instantMeiliSearch=function(t,i,s){return void 0===s&&(s={}),{client:new o.MeiliSearch({host:t,apiKey:i}),paginationTotalHits:s.paginationTotalHits||200,primaryKey:s.primaryKey||void 0,placeholderSearch:!1!==s.placeholderSearch,hitsPerPage:20,page:0,transformToMeiliSearchParams:function(t){var r=t.query,n=t.facets,i=t.facetFilters,o=t.attributesToSnippet,s=t.attributesToRetrieve,u=t.attributesToHighlight,a=t.filters,c=void 0===a?"":a,h=t.numericFilters,f=void 0===h?[]:h,d=this.paginationTotalHits,p=[f.join(" AND "),c.trim()].filter((function(t){return t})).join(" AND ").trim();return e(e(e(e(e(e({q:r},(null==n?void 0:n.length)&&{facetsDistribution:n}),i&&{facetFilters:i}),o&&{attributesToCrop:o}),s&&{attributesToRetrieve:s}),p&&{filters:p}),{attributesToHighlight:u||["*"],limit:!this.placeholderSearch&&""===r||!d?0:d})},getNumberPages:function(t){var e=t%this.hitsPerPage==0?0:1;return Math.floor(t/this.hitsPerPage)+e},paginateHits:function(t){var e=this.page*this.hitsPerPage;return t.splice(e,this.hitsPerPage)},transformToISHits:function(t,r){var n=this;return this.paginateHits(t).map((function(t){var i=t._formatted,o=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]])}return r}(t,["_formatted"]);return e(e(e({},o),{_highlightResult:a(e({formattedHit:i},r)),_snippetResult:h(e({formattedHit:i},r))}),n.primaryKey&&{objectID:t[n.primaryKey]})}))},transformToISResponse:function(t,r,n){var i=r.exhaustiveFacetsCount,o=r.exhaustiveNbHits,s=r.facetsDistribution,u=r.nbHits,a=r.processingTimeMs,c=r.query,h=r.hits;return{results:[e(e(e({index:t,hitsPerPage:this.hitsPerPage},s&&{facets:s}),i&&{exhaustiveFacetsCount:i}),{page:this.page,nbPages:this.getNumberPages(h.length),exhaustiveNbHits:o,nbHits:u,processingTimeMS:a,query:c,hits:this.transformToISHits(h,n)})]}},search:function(t){var e=t[0];return r(this,void 0,void 0,(function(){var t,r,i,o,s,u,a;return n(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),t=e.params,r=e.indexName,i=t.page,o=t.hitsPerPage,this.page=i||0,this.hitsPerPage=o||20,s=this.transformToMeiliSearchParams(t),[4,this.client.index(r).search(s.q,s)];case 1:return u=n.sent(),[2,this.transformToISResponse(r,u,t)];case 2:throw a=n.sent(),console.error(a),new Error(a);case 3:return[2]}}))}))}}},Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=instant-meilisearch.umd.min.js.map

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

// Type definitions for @meilisearch/instant-meilisearch 0.4.1
// Type definitions for @meilisearch/instant-meilisearch 0.4.2
// Project: https://github.com/meilisearch/instant-meilisearch.git

@@ -3,0 +3,0 @@ // Definitions by: Clementine Urquizar <https://github.com/meilisearch>

{
"name": "@meilisearch/instant-meilisearch",
"version": "0.4.1",
"version": "0.4.2",
"private": false,

@@ -5,0 +5,0 @@ "description": "The search client to use MeiliSearch with InstantSearch.",

@@ -33,6 +33,12 @@ import { MeiliSearch } from 'meilisearch'

attributesToHighlight,
filters,
filters = '',
numericFilters = [],
}) {
const limit = this.paginationTotalHits
const filter = [numericFilters.join(' AND '), filters.trim()]
.filter((x) => x)
.join(' AND ')
.trim()
// Creates search params object compliant with MeiliSearch

@@ -45,3 +51,3 @@ return {

...(attributesToRetrieve && { attributesToRetrieve }),
...(filters && { filters }),
...(filter && { filters: filter }),
attributesToHighlight: attributesToHighlight || ['*'],

@@ -48,0 +54,0 @@ limit: (!this.placeholderSearch && query === '') || !limit ? 0 : limit,

Sorry, the diff of this file is too big to display

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